How to define item level permissions in a relational database

I need to model a database design to provide item level permissions to users based on the user's role access. I am using asp.net with sql server 2012 I am looking at similar experience on how SharePoint provides the security trimming when we access the resources with a SharePoint site (including search results)   1. Is it a best practice to model this in the database or the application programming? (I have seen SharePoint implement this, but haven't gone in to figuring out how they have done it)   2. I will also be using lucene.net for integrating with search. So even the search results should be security trimmed. Are there any best practices/resources available to suggest how to model this permission? /Sharath


How to become a more organized programmer?

I am a programmer that can code. But I find that I can get thing done, but not get thing do well or like most of the open source communities do. Well, I use some of the library from git hub. I find most of the programme is well structure. Also, a read me. My question are:   1. Is that any common file structure or naming convention in the community or this is just a matter of personal taste?    2. How to become a more organized programmer, instead of writing code just work. But more organized that let other easy to get in your project?


Why convert to assembly language instead of machine code?

When I compile a C program, it is compiled first to assembly code, then assembled into machine code. I'm curious why it doesn't just convert straight to machine code in the first place.


Dual pivot quicksort in face of expensive swaps

_I was told this is better place to ask this_   **TLDR**   Has anyone tested dual pivot quicksort performance with expensive-to-swap elements? It seems that in this case, it should massively underperform compared to standard quicksort. And yes, I know about Cycle Sort (if it is only the original array that is expensive to modify) and that I could use indices/pointers inside the array, sort them and then swap them into their correct place. However, the first is completely out of the question (Quadratic average case is just not good enough) and the second is unsuitable for implementation of general case sort. (It imposes both performance and memory consumption overhead even in cases where it is better and faster to work with the original array).    **Backstory**   Inspired by recent "question" on stack overflow, I decided to go and implement non trivial versions of given sorts (introsort, quicksort with 3-way partition, median of 3 pivot selection, small block insertion sort etc). During some research I also came upon dual pivot quicksort, which is the current implementation of quicksort in Java standard library. Generally it claims that it is always at least as good as standard quicksort, and empirical testing seemed to support it. (Which is the reason it is the current implementation.) However, it seems that no STL implementation uses dual pivot quicksort for the quicksort phase of introsort, which made me wonder why. After more research I found this paper. It says that while dual pivot quicksort performs on average 5% less comparisons, it performs significantly more swaps. (Approximately 80% more) Obviously, since Java has only primitives and reference types, swapping is always cheap. (Even so, it uses this sort only for primitives, because it is not stable) It also seems that at least part of the advantage of dual pivot quicksort is in its improved cache behaviour (Because it divides into smaller subarray that can fit into cache faster). So I wanted to see whether someone already tested standard quicksort vs dual pivot quicksort when elements are expensive to swap and has the numbers (and possibly source) lying around, or whether I will have to test this myself.


Generating Deep Arrays: Shallow to Deep, Deep to Shallow or Bad idea?

I'm working on an array structure that will be used as the data source for a report template in a web app. The data comes from relatively complex SQL queries that return one or many rows as one dimensional associative arrays. In the case of many, they are turned into two dimensional indexed array. The data is complex and in some cases there is a lot of it. To save trips to the database (which are extremely expensive in this scenario) I'm attempting to get all of the basic arrays (1 and 2 dimension raw database data) and put them, conditionally, into a single, five level deep array. Organizing the data in PHP seems like a better idea than by using where statements in the SQL. ## Array Structure                   Array of years(                 year => array of types(                                 types => array of information(                                                     total => value,                                                     table => array of data(                                                                     index => db array                                                                         )                                                             )                                     )                     )      My first question is, is this a bad idea. Are arrays like this appropriate for this situation? If this would work, how should I go about populating it? My initial thought was shallow to deep, but the more I work on this, the more I realize that it'd be very difficult to abstract out the conditionals that determine where each item goes in the array. So it seems that starting from the most deeply nested data may be the approach I should take. If this is array abuse, what alternatives exist? ## Edit I went ahead with this approach, learning and changing things as I went. But I ended up with a similar end array. What I learned in regards to the shallow to deep conundrum was this. I went into the process thinking of the outer arrays as the largest of a set of cups, containing multitudes of smaller cups which in turn contained another multitude of smaller cup until the last set which in my mind was water (this being the indexed array of database values). Arrays are not cups... The idea fell apart when I started legitimately hand drawing out the array structures and found that the base of these arrays, the water filled tiny cups I had envisioned, represented a heck of a lot more data than those big cups. This lead me to see these deeply nested arrays as towers, with the indexed data representing a base of sorts, tapering up to the tip, which was the containing array. From there, I figured out that the best way for me to process the data was to gather the bottom data, plug it into it's next layer and then go up the tower plugging each layer into it's next layer. I'm not sure if I'm right, but I do feel like I understand arrays more now than I did before. And I'm definitely still not sure if this is the best solution.


Should testers be equivalent to programmers?

I've been reading Joel Spolsky's old article about "Top Five (Wrong) Reasons You Don't Have Testers". it's an old article date back to 2000, but it's insightful as most of its content make sense after a decade. I cant agree more about the importance of test in order to produce qualify software. But there is one paragraph talking about what to deal with when top testers moved on and causing tester shortage, I really can't agree with Joel, although what he stated is still the case even today. In his analysis, I clearly felt a sense that Joel is saying "testers are inferior to programmers". A lot of people around me have this kind of prejudice. I don't know where does this come from, but I don't think this right. even myself is not willing to be a tester( but that's not because I think testers are inferior but rather testers are treated inferior ). but I don't think this is right. The way I think to prevent the out-flow of top testers is to treat them equivalently as top programmers, are they not qualified in terms of contributions to the project ? another important aspect is that we know testers have to work intimately with devs to better fulfill their job, in a culture where Managers inherently demeaning testers how would they fulfill their job ?


How can uTorrent be multi-platform while keeping such a small binary size?

Nowdays it turned into a bloated client that works in Mac, Linux, and Windows, while still keeping the whole program in a single binary file that weighs only 876 kb, while competitors that use gui libraries weigh around 6 mb. Do they create a separate native gui for each platform instead of using a multiplatform gui library? What's the best approach to achieve such a thing?   Thanks.


Abstract Data Access by use of Reflection

I am thinking about creating a data access API on top of Spring JDBC. The API will be able to automatically create objects from resultset, given we follow naming conventions for fields in the sql. We have lots of entities like: Patient, Disease etc. What I am thinking about is:               Patient p = (Patient)bean.fetchObject(resultSet,Patient.class);      Disease d = (Disease)bean.fetchObject(resultSet,Disease.class);      where `fetchObject()` uses reflection to read property names of entities and it generates field names and then it assigns those values to those properties. The rule I am thinking about is:   1. Give each entity a unique prefix   2. Generate column names automatically from variable names   3. Follow strict naming conventions on all sql queries Is this a good way to go about things? What are the possible pitfalls? Are there similar solutions already out there? (We are not using Hibernate)


How do I avoid GPL violations?

When I'm releasing a program, I like to license it under the GPL or LGPL. I also want to stay compliant with that license. I'm not good at reading legal documents, and the GPL3 is about 10 pages long. How do I avoid GPL violations in my code?


How many mistakes does a good software developer make?

I am currently in a situation where a lot of people criticized me for making bugs (on my first local try - the first time I run the code for the first locally done test - , not on a committed repo though, management look at me very closely). The majority of my bugs are most often not algorithmic (they are more like mistaking one var for another, a forgotten line, a missed method call). The people criticizing me say I need to be able to make code without bugs. Correct on first try. I have been practicing to improve my coding skills. While practicing with the USA CO set, I saw a message: > YOUR PROGRAM ('xyz') WORKED FIRST TIME! That's fantastic -- and a rare > thing. Please accept these special automated congratulations.   * Doesn't it mean it's rare to have things right right away?   * Does it mean that the people demanding correctness right off the bat are unreasonable?   * Or is it because USA CO participants code the problems in 10-15 mins? so it's normal for them to make mistakes (also they are highschoolers, professional software developers have to be better than them)? For more info: I could finish at least half of the USA CO set is about 30-60. I am not sure if that means slow or bad coding or not. Some difficult ones require about 2 hrs for improved correctness. And now, what is the way to avoid making mistakes now? (Other than practice more and focus on a particular area) EDIT: This is mainly to ask so that I know what a typical good developer would exhibit in coding error, and coding speed. I want to evaluate my performance based on that of a good developer. Sorry about the feeling of resentment or displease that this question might convey. FINAL EDIT: I come to the conclusion that this is simply a way they use to teach me their work style which then makes everything seems reasonable. In addition, a good answer was that I should use random experimentation less when I learn new things. That really makes people feel uncomfortable. The traditional approach of reading the book should be employed more and would often have many additional benefits besides just acquiring new knowledge. Thanks


Understanding JAVA generic keyword 'super'

Recently some people said that I was wrong when I explained why one cannot insert a `Number` object into a list declared as `List<? super RationalNumber>`. (This assumes that `RationalNumber` is a subclass of `Number`) My explanation was that in `List<? super RationalNumber>` the `<? super RationalNumber>` stands for an unknown super class of `RationalNumber`. This means that `<? super RationalNumber>` indicates that a valid object for `List<? super RationalNumber>` is an object that extends an unknown super class of `RationalNumber`. Since an unknown super class of `RationalNumber` is really unknown (e.g. it can be an interface `X` instead of `Number`), there is not guarantee that `Number` is a sub-class of `X` i.e. implements `X`, so `Number` is not a valid substitution of `<? super RationalNumber>`. What is wrong with this explanation? Edit: Note that I am asking for what wrong with the way I explain, my explanation. Not another explanation for the original question. Thanks.


Is serialization better done in instance methods or static methods

Say I have a class `workStockItem`, that I wish to serialize. Which is the better style?   1. using a static method  or   2. using a non-static method (maybe even implemented as a property as seen below) Example implementations:               internal static byte[] serialiaze(workStockItem toSer)         {             IFormatter formatter = new BinaryFormatter();             MemoryStream stream = new MemoryStream();             formatter.Serialize(stream, toSer);             return stream.ToArray();         }          internal byte[] binaryRepresentation         {             get             {                 IFormatter formatter = new BinaryFormatter();                 MemoryStream stream = new MemoryStream();                 formatter.Serialize(stream, this);                 return stream.ToArray();             }         }      Again:   Which is better style and why?


Where can I find a large dataset of tweets?

I'm trying some machine learning with Twitter, and I was wondering if there were any pre-collected just massive tweet data that anyone knew about before I went and just used the API (which has a request limit anyway)?


Migration strategies for deprecating in-house scripting language

We have a scripting language that we use internally for many things. It began as a simple evaluation statements for dynamic labels to become a Turing complete language used pervasively throughout our system. Problem is that it was never designed for this and it shows. Development environment is anemic, scripts produced are not testable and still to this day there is not formal definition of the language. A growing sentiment among the language's users feel that it has done it's job and it's time to let go but we are faced with a difficult challenge to migrate existing codebase to whatever new solution would be devised. This very argument is used against the idea of migrating. Have you ever faced a similar situation ? and if so what strategies did you use to stop usage of the old and promote the new ? One last thing (thanks Morons) is that many of these scripts are not documented and their original purpose is lost though they are still in active use. The scripts are also used at customer sites to customize the system so we have literally thousands of these scripts a large portion of which is not under source control or any versionning mechanism for that matter. * * * Accepted answer. Difficult choice this is. All answers were good and sound advice though I think the best lies somewhat of a hybrid of Moron's and Oliver's. I ended-up accepting Oliver's because it is the answer that stands the best chance of getting accepted higher up (ha! politics!). Packaging the old scripting environment in a callable statement that can be integrated in the new environment would provide a quick and easy upgrade path. Once done we can control better creation of new scripts by displaying warnings or disallowing all-together old scripts from being edited or created forcing to go with the new language. Thanks all for your input !


Scrum: How inclusive is enough with your client?

I work in a very small team and we're about to begin implementing Scrum. As we're such a small team I'll have direct and frequent access to the clients. I'll be fulfilling multiple roles. I feel I understand the workings of Scrum itself but not how this affects aspects of communicating with clients. How do you convey to your clients deadlines or timeboxes with Scrum in mind? For instance, do you mention sprints or that every x weeks new deployable features will be available for demonstration? Do many of you include the clients at planning meetings?


Should we only catch in exceptional circumstances?

Whether error handling by throwing exceptions is good or bad is contentious. Are exceptions as control flow considered a serious antipattern? If so, Why? The common line is that exceptions are for "exceptional circumstances". But what if a library author has decided to throw an exception? The library author cannot predict what might be an "exceptional circumstance" for us. Of course, if we cannot rule out an exception being thrown from a function that we must use as-is and permitting the exception to bubbling up to the top is unacceptable then we _must_ catch the exception. Often however, we can take preventative measures. With sufficient effort we might even be able to guarantee that the conditions under which the library function would throw an exception will never occur. The throw will still be there (it's not our choice) but we can eliminate the need for try and catch. An example is `std::map.at()`. (Pretend there's no `std::map.find()`.) What is the general wisdom? Is it in good taste to write code with the expectation that a library function will occasionally throw? Is client code obligated to minimize the use of exceptions? **Edit** To try and distinguish this more from past questions and be more concrete, suppose we have some library function that might throw a file not found exception. Some client code wants to use the library to access a file. The client code is being programmed with the expectation that the file sometimes will not exist, even under "unexceptional circumstances". The client code can be made able to check if the library function will throw an exception before being called but it's non-trivial to do so. Should client code pile additional error checking on top of the error checking within the library or should the client code use the library generated exception as control flow? In such a case adding error handling code on top of the library will almost certainly be less efficient than catching an error, will require less coding, and it could be argued that you _must_ have a try/catch anyway. On the other hand it is a decidedly unexceptional control flow mechanism.


Is there any Common Name for Edit,Save,Delete,Select

Can anyone suggest me a Common Name for Edit,Save,Delete,Select I want to create a Interface in C#, which will support all these methods. My Context is : I am developing an Invoice Application in which i need a Product to be Created,Deleted,Updated,Selected


Are there any additional considerations to make when designing a site structure if you plan to use persistent connection technologies?

As the title states, I'm thinking of making a simple-card-game based website, using persistent connection technology (Something like signalR) for the actual game part of it. I've never planned a site to use this technology, and wondering for those who have, are there any additional things that need to be taken into consideration for the site structure? I'm planning on using the asp MVC framework for the whole thing, and starting off with some simple game (e.g. card based Rock/Paper/Scissors) for proof of concept (to see if I can get it working how I think it would in my head).


What to learn after standard C++?

I switched to C++ a few months ago, learning its syntax, the main features of the STL and what you can usually find in a "learn C++" manual. Now I would like to go further. What would be your recommendations? I would like to know what to learn next (not only about the language, but also debugging, frameworks etc. etc.) I know probably the answer depends on the specific needs of each user, so here is a list of mine:   * Cross Platform development   * Developing GUI for my programs   * Develop extendible software, allowing the use of plugins   * Use of scientific libraries   * Interact with databases (mainly MySQL)   * Having server/client functionalities (I'd like users of my programs to interact through internet.. as you might have guessed I am not a programmer by training so I might have used the wrong terms.. if so I apologize for that). Of course I know it takes time, but I would like to have a good list of references and resources to start (both books and websites are ok). Thanks a lot for your help!


Which layer should my JBehave acceptance test target in a DDD application?

Given a DDD application with a hexagonal architecture, which layer should my JBehave acceptance tests target? I want to write Features and scenarios as specifications for the overall system behavior as we are introducing **ATDD** as our development process. In my application I have these layers:   * Presentation layer   * Web services layer   * Application services layer   * Domain layer   * Infrastructure layer


How to deal with the developers refusing to use certain technologies or tools? **Note:** Good help is hard to find, so answer 'Let them go' doesn't work in this case. Besides, they are very good in what they do, just don't want to do what they don't want to do. Examples: "Get away from me with this Crystal Reports stuff or you will never see me again." "I am not using SSIS for anything." "You can integrate sytem with MAS 500 yourself, I won't touch it with a 10-foot pole." **General Comment:** "Ask developers to provide a better solution" is not always an option as the technology / tool maybe given to us by the customer.   * Customer has people familiar with CR to tweak reports after they are delivered   * Customer already has Microsoft SQL server and don't want to invest in any other ETL   * Customer uses MAS 500 and doesn't want to switch to the other accounting package


Have I mistakenly assumed that my routines are loosely coupled?

My Selenium test structures goes as - Data Object class -               public class RegistrationData {            String firstName = "test first name";       String lastName = "test last name";            // Getter Setter Here      }      Page Object class which carries out operations on a Web Page -               public class RegistrationPage {        private RegistrationData regData;             public void setRegistrationData(RegistrationData regData) {        this.regData = regData();                 public NewAccountPage fillRegForm() {          enterFirstName("FirstNameTextBoxLocator", regData.getFirstName);          enterLastName("LastNameTextBoxLocator", regData.getLastName);          // Some more fields are filled here          return NewAccountPage();        }     }      And test class uses them as -               public class TestRegistration extends SelTestCase {             @Test        public void testRegNewUser() {          RegistrationData regData = new RegistrationData();          RegistrationPage regPage = New RegistrationPage();          regPage.setRegistrationData(regData)          regPage.fillRegForm();          // Some assertion here        }     }      Now since fillRegForm method does not take any argument, Can I assume that it is an example of loose coupling despite I need to set RegistrationData in RegistrationPage before being able to use fillRegForm method.


Providing friendly URLs for a website vs. realities of database IDs

We have a database of resources, be they products, blog posts or something. We need to design a URL scheme to address them, for the public website. Here are two examples that are database ID bound:   * https://www.youtube.com/watch?v=7FPS6llqhXw   * http://www.amazon.co.uk/gp/product/B000NHOMSQ Here's an example that's friendly:   * http://en.wikipedia.org/wiki/LED_circuit (A little glimpse into my browsing life there) I like the friendly URLs since you have an idea about what's on the end of the URL when you hover or see it in an email or document. It's better for SEO, or it used to be. What happens when the document or product is renamed? Either because it changed (Wiki may not change but our resources could) or due to a typo, right? Our resources are very technical, long words and error prone. Also, we have a database ID, which is a number. Let's look at an idea for an address of a video using a pretend rental store:   * http://vidsyeah.com/video/sliding-doors/287171 The ID is obvious and is used in the DB look-up. Fine. The sliding-doors bit is non-unique and just generated from the video title, it could be verified on GET, so if gliding-doors was entered and doesn't match what's really in doc 287171 it responds 404. Or maybe it could be ignored, allowing humans to stick whatever they like in there, if someone ever cared to. So this URL would also work:   * http://vidsyeah.com/video/anything-at_all/287171 The issue with verifying the friendly part is, as mentioned, the problem of renaming or typo correction. If the name changed, and in our domain that does happen, we don't want to break the URLs that are out there, so should we:   * Just not verify the friendly part.   * Verify, but add a 'history' of friendly parts to the database record so any previous friendly IDs still work! Your thoughts and ideas are welcome. Luke


Handling and managing error codes

I'm looking for examples of creating, handling and managing error numbers/codes. To understand what I'm takling about, let's take example scenario: (EU - end user, IT - it helpdesk)               EU: - (calls IT) something's wrong     IT: - what happened?     EU: - it says "cannot create xyz"     IT: - what have you done?     EU: - ummm....     (conversation continues for another gazillion years)      ... and exception that produces message `cannot create xyz` is being thrown in dozen places in whole system, so IT guy doesn't know where to look for. Another approach (which I really like and would like to use) is for example: ![example error message](http://i.stack.imgur.com/DnTp6.jpg) Now, when EU calls IT, whole conversation looks like this:               EU: - I have error 1004     IT: - ok, thanks, we'll take a look      Having error code, IT guy instantly knows where to look for error. He doesn't need to ask EU to provide loads of misleading details, he just can sit down and work or if he knows why, explain that this is intentional error because EU did something wrong. Sounds like flowers and donuts, doesn't it? But what are best practices to achieve this behaviour? Let's assume that this is Java and we're building app from scratch. What I know so far is that I cannot get error codes from database, because if Exception is being thrown, I cannot rely on external sources. This leads to problems with teamwork. Let's say that John, Paul and Adam assumed that they will use error codes while writing their app, and they will generate errors incrementaly. I see possible collision, when John wants to mark exception message in code using number `#256`, but Paul doesn't know about that and creates his own exception, also with `#256` related it, and uses this exception in few dozens of places in app. At the end of the day noone knows what error `#256` really means. So maybe there's another approach - use small but handy one-table web app that will handle generating error numbers, so John, Paul and Adam just can click "generate" when they want new unique error number? Above elaborate also leads to another question - what are best practices to set error codes? In exceptions themself, like this:               public class FooException extends Exception {       public FooException() { super(); }       public FooException(String message) { super("Error #256 - xyz is forbidden"); }       public FooException(String message, Throwable cause) { super("Error #256 - xyz is forbidden", cause); }       public FooException(Throwable cause) { super(cause); }     }      or:               try{         (some stuff)     } catch (FooException ex){         System.out.println("Error #256 - you cannot do xyz in here");     }      I suspect second option is better, because it indicates unique, specific place in code in whole project, but this looks harder to manage. Any thoughts? Any practices? Advices? Thanks.


Telerik ASP.NET MVC components licensing

There's thread on stackoverflow about this http://stackoverflow.com/questions/5524046/is-telerik-extensions-for-asp-net- mvc-free It says that it is ok for internal site, but I think it is still not clear (also in faq notice about internal site usage is gone I think). They say, as long as website is internal, you should be ok with open source license, but 1) Can I use it for site, that has closed community, I mean only logged in people will use telerik components? 2) Can I use only for site's administration part, that means that only internal staff will access it? UPDATE: It looks like same question (same license type) - Using GPL libraries without modification on a commercial website, do I need to make my source code available?, but answers are completely different? UPDATE2: I don't wish to in any way distribute site's code.


Assembly Language being used in Aircraft System

Today my lecturer mentioned the reason why the aircraft system is programmed in assembly language is due to the program being written have less error . Is this statement true ? Because when he asked about our opinion I said assembly can create faster program thus it is a good language for real-time oriented aircraft system program . I search around google but can't seem to find an article clarifying my lecturer's statement .


What is the advantage of using Direct Web Remoting over a REST web services design?

I have an enterprise Java web application deployed in tomcat. I am looking for ways to integrate a HTML & JS UI with the mid tier java code. So far, looking around I have found that there are two ways good ways to do this which fit my requirements : 1) DWR - Direct web remoting 2) Use REST web services. I am not sure which approach to use. Edit: What is the advantage of using DWR over a rest WS design? Edit 2: I will most likely be using dojo for the UI development(Works well with REST/DWR??), and I want to keep the java code chages minimal. I understand that by using web services, I would have to write an additional WS client layer on top of the existing java code. Also, the usual enterprise needs, performance, scalability, etc.


What class of problem is this, and what math do I need to know to solve it?

Mushroom cultivation requires fairly precise chemical composition of substrate (a.k.a. growing medium). Let's pretend we're growing shitakes and that this is the required composition of their substrate:               Nitrogen | Benzene | Toluene | Dioxygen Diflouride     5%       | 5%      | 10%     | 80%      We want to create an appropriate substrate from materials we have on hand which we know the chemical composition of.               Material | Nitrogen | Benzene | Toluene | Dioxygen Diflouride     apples   | 5%       | 0%      | 5%      | 90%     oranges  | 20%      | 20%     | 50%     | 10%     Etc...      How does one calculate this? It reminds me of solving matrices in high school. Is this something that can be done with matrices? What is this problem called? What do I need to know to solve it?


How to write unit tests for utility programs

I am working on a C# console application that loads the data from a third party and bulk inserts into tables. Basically the code consists of a static method with logging statements. In these scenarios, how does one write the unit test cases? Example code               void Main(string[] args)     {         // for loop here to read config from XML file              // initialize third party library         ReportLib objLib = new ReportLib();                   DataTable dt = objLib.Refresh("test");              //call SQL bulk copy         DBHelper.BulkCopy(dt, dictmappings, destTblName);//dbhelper is static class          }


Is the “jQuery programming style” a kind of Reactive programming?

jQuery is a Javascript library and framework, but when we are programming with jQuery into DOM problems/solutions, we can practice a style quite different of programming... We can read about jQuery at Wikipedia, _The set of jQuery core features — DOM element selections, traversal and manipulation —, enabled by its selector engine (...), created a new "programming style", **fusing** algorithms and DOM-data-structures_ This question is similar to the "subquestion-3" of this question but not so generic. The focus here is about this new kind of "programming style"... So, the question: **Is the "jQuery programming style in DOM context" a new paradign?** Or it is more one example of **reactive programming** (not "cell-oriented" but " _DOM- node oriented_ ") or another one? * * * We have no "standard taxonomy of paradigms", so, please, in your answer, indicate also your "best choice for Wikipedia Paradign". Example: if you understand that "jQuery programming DOM" is like "awk filtering data", your choice can be event-driven.


How long can I store the subscribe personal information?

In my subscription form I want to use a double opt-in method:   * First, the visitor subscribes   * Then a confirmation email is dispatched. If he replies...   * Then I add him to the system.  In the case where the user does not reply, how long can I store their email address? Are there any legal requirements with regard to that? I am from U.S. and I am also interested in the policy in European countries.


Why should I use an MVC pattern?

It seems everyone doing web applications nowadays wants to use MVC for everything. I find it hard to convince myself to use this pattern, however. I understand the general idea is to separate the backend logic from the frontend that represents the program. Generally, it seems that the views always depend on the controller to some extent, which ends up depending on the model. I don't see what advantage adding the controller gets me. I've read a lot of hype about "this is the way applications should be designed", but maybe I still don't understand what is supposed to go where. Whenever I talk to others about MVC it seems everyone has a different idea of what belongs in what category. So, why should I use MVC? What do I gain by using MVC over just separating the frontend from the backend logic? (Most "advantages" I see of this pattern are gained just by separating interface from implementation, and fail to explain the purpose of having a separate "controller")


How to minimize the usage of static variables and objects

I'm trying to implement this JavaFX code where I want to call remote Java class and pass boolean flag:               final CheckMenuItem toolbarSubMenuNavigation = new CheckMenuItem("Navigation");         toolbarSubMenuNavigation.setOnAction(new EventHandler<ActionEvent>()         {             @Override             public void handle(ActionEvent e)             {                      //DataTabs.renderTab = toolbarSubMenuNavigation.isSelected();                 DataTabs.setRenderTab(toolbarSubMenuNavigation.isSelected());                 // call here the getter setter and send boolean flag                 System.out.println("subsystem1 #1 Enabled!");             }         });      Java class which I want to call:               public class DataTabs     {             private static boolean renderTab; // make members *private*         private static TabPane tabPane;              public static boolean isRenderTab()         {             return DataTabs.renderTab;         }              public static void setRenderTab(boolean renderTab)         {             DataTabs.renderTab = renderTab;             tabPane.setVisible(renderTab);         }              // somewhere below         // set visible the tab pane         TabPane tabPane = DataTabs.tabPane = new TabPane();         tabPane.setVisible(renderTab);     }      This implementation works but I want to optimize it to use less static variables and objects. Can you tell me which sections of the code how can be optimized?


Why do programming languages encompass so much?

Programming languages are not just language. Each one tends to have:   * Its own IDEs,   * Its own package managers,   * Its own set of libraries,   * Its own build tools,   * Its own data formats. If you are writing Java syntax, you will be using Maven packages; if you are writing Haskell syntax, you will be using Cabal packages. What's the connection? Why does each programming language create its own world?


Javascript client - which is likely to be better serverside? WCF or MVC3 controller with restful messages?

I'm looking to write a server side service, which will be accessed from a Javascript/HTML5 client. The client will likely be sending a bunch of restful messages over HTTPS. All other things being equal, which is better designed to support this kind of scheme on the serverside - WCF or MVC3 (ie., a controller with only restful messages, no real view or model)?


Should I write HTML or CSS first?

There are a lot of analogies for HTML/CSS development; which can be a bit confuse for a beginner.                  HTML = foundations/house        CSS = walls/blueprint/wallpaper      Is there any best practice here? Which one should we write first?


Centrally managing 100+ websites without bankrupting a small company

I'm mainly interested in opinions on the trade-offs between having a **single central server** all the websites connect to as opposed to each website mirroring a subset of the master database with all the products in it. For example, will I run into severe performance issues (or even security issues, or restrictions) making queries to an offsite database? Will we hit scalability issues we can't handle early on from the sheer bandwidth required to maintain this? If we do go with something like a script that keeps smaller databases (each containing a subset of the central master data) in sync, what sorts of issues will we likely encounter there? I would really like the opinions of people far more knowledgeable than I am regarding the pros and cons of both setups and what headaches we are likely to encounter. **CLARIFICATION** : This should not be viewed as a question about whether we should implement one database vs multiple databases. This question has been answered numerous times. The question is regarding the pros and cons for a deployment like this having the ability to manage all the websites centrally (one **server** ) vs trying to keep them all in sync if they each have their own db (multiple servers). **REAL-WORLD EXAMPLE** : We are a t-shirt company, and we have individual websites for our different kinds of t-shirts, but we're looking at a central order management integrated with our single shopping cart (which is ColdFusion + MySQL). Now, let's say we have a t-shirt that's on 10 of our websites and we change an image for it. Ideally we would change that in one place and the change would propagate, but how would we set this up?


Search results that display in the form of "1 - 20 of about 65" - why the "about"?

I've noticed that Google and large search engines do not display "proper" paging, but display an approximation. For example, I tried to give a specific search on Google to return few results, as per below:               eating +ants in malta near the sea      This returned "About 71 results". However, it only showed 2 pages in the pages at the bottom. Considering 1 page contains 10 entries, the maximum this can actually be is somewhere in the range of 11 - 20. Then, I clicked on page 2, and this time the total results changed to `Page 2 of 16 results`. Just curious, any ideas why is this done? I am assuming for performance reasons, however since it did manage to get the page count right, why was the 'About 71' so off, from the actual 16 to 71, which is a huge discrepancy?


Best practice for configuration files in a website

I am creating something similar to a _Content Management System_ , that can be downloaded and used by everyone that needs it. I've been working in web- development for a couple of years (mainly as a hobby, i.e. creating personal homepages for acquaintances), but have never had the need of a user to enter his own configurations (let it be database connection, meta-data about his site, desired behaviour of the website). Therefore I have no experience with custom configuration file handling. That's where my question lies: What is the best practice to handle custom website- wide configuration files and handle them in PHP? I have thought of creating INI-files, that can be customized from within the admin panel and that are hidden to the user by .htaccess for security purposes. However I don't know if INI is the best method to do this considering that the page is being developed to be extensible through plugins (which may lead to another question soon). So what is my best bet to handle configurability? For instance do I want to store database configuration in files somehow and have other configurations outsourced to the database itself? Or do I store everything in INI-files (also considering configurability for plugins: Should everyone of these have their own config-file)?


What's best for a client library: userland code or schema files?

I'm building a client library that consumes a collection of OpenStack API services. I know that as time goes on more services will be added - so I want to come up with a clean and neat way of structuring my client library to minimize development time (for future new services) and avoid duplication. So far, I've thought of two solutions:   1. **Implement userland code from scratch.** Each service uses an underlying HTTP client, and for every API operation there is a concrete method in a concrete class that encapsulates logic. This is your standard application where everything exists in concrete code. Advantages are that it is straightforward and obvious for new contributors; disadvantages is that writing code is slow and there is a risk of duplicating boilerplate code.    2. **Implement some kind of service description layer** \- similar to WADLs but lighter and written in JSON. Each description document would act similar to Google's Discovery API where the API's resources are defined using JSON Schemas; HTTP operations are defined with all their parameters, URIs, verb types, expected status codes, etc.; authentication is also defined. Advantages are that it takes less time to write, it avoids duplication, and it forms an explicit contract which is useful for end-user documentation. Disadvantages are that it's quite meta-like and difficult to understand for newcomers. There are a number of popular client libraries that use this kind of schema pattern, but I'm trying to weigh up its positives and negatives. I'm leaning towards using schemas because I think they'll save time developing and avoid duplication. OpenStack APIs seem to be also moving towards json-schema. Are there any strong reasons why relying on schemas is a bad idea for a client library, and/or why userland code is a better approach?


What are some good ways to monitor team mood?

My software development team at work has various communication issues that resulted in management having the perception that the systems they have in place are working well... when they are not. While fixing the lack of communication is also something I dream of doing, I am asking specifically about both technical and social aspects of monitoring the mood of the team on various issues. The team is composed of roughly 4 groups of 5 developers at sites around the world. Each site is primarily working on separate projects that are built on some common embedded hardware and low-level libraries. There is certainly opportunity for more shared higher level libraries but they do not exist as such at present. I envision raising a topic and requesting that each team member anonymously provide feedback on two axes: how much does this affect you and how positively or negatively. This should help figure out which areas we are succeeding at and which are having a significantly negative impact. Hopefully developers could respond in less than 30 seconds. Am I heading in the right direction to figure out what the team should spend more time improving?


Is there a tool that will list all dependencies of a method in Java?

Say I'm looking at some code and I see:               MessageDigestPasswordEncoder encoder = new MessageDigestPasswordEncoder("SHA-512");      Now, in that file I also see:               import org.springframework.security.authentication.encoding.MessageDigestPasswordEncoder;      OK, pretty good guess that `Spring Security` is needed. But I guess, technically, `MessageDigestPasswordEncoder` could come from many different places. But, assuming I know it's Spring, then that should help. But here's what I'm after. I have many programs written by other people and sometimes, I just need to extract a small piece. For example, I needed to figure out how `CAS` was hashing passwords for an ETL job I'm working on. So I went to that very large project and just copied all of the jars over. Coded up what I needed and everything worked. However, I now have this very simple project with 60 jars in it. And I know not all are needed. So my question is, how can I "reverse engineer" this larger application and find out the minimum dependencies needed for that `MessageDigestPasswordEncoder` above? That's a crude example but you get the idea. I could start pulling jars out until something breaks but that would take forever. What I'd like to do is (even in the console) type `list_dependencies MessageDigestPasswordEncoder` and have a nice tree drawn. This sounds like a job for Maven but I'm not very experienced with Maven (I come from a .NET/Ruby world). Thanks.


Good or bad practice to mask Java collections with meaningful class names?

Lately I've been in the habit of "masking" Java collections with human- friendly class names. Some simple examples:               // Facade class that makes code more readable and understandable.     public class WidgetCache extends Map<String, Widget> {     }      Or:               // If you saw a ArrayList<ArrayList<?>> being passed around in the code, would you     // run away screaming, or would you actually understand what it is and what     // it represents?     public class Changelist extends ArrayList<ArrayList<SomePOJO>> {     }      A colleague pointed out to me that this is bad practice, and introduces lag/latency, as well as being an OO anti-pattern. I can understand it introducing a very _tiny_ degree of performance overhead, but can't imagine it's at all significant. So I ask: is this good or bad to do, and why?


Are Compiler Directives an Antipattern?

I'm working on a legacy system that has a helper class that is symbolically linked into many different .Net projects within a solution. The logic is riddled with compiler directives that change it's internal behavior based on which .Net project it happens to be compiled in. For instance, there's a compiler directive that interogates a "HAS_UI" variable and if true, compiles in a frmProgress instances and displays progress to the user. I'm trying to explain to colleagues why this is a poor design by referencing specific anti-patterns. All I can come up with so far are "positive" patterns that should have been used, like the Single Responsibility Pattern or the Observer pattern. Can anyone suggest specific anti-patterns that might apply here? Thx


The cost of longer delay between development and QA

At my current position, QA has become a bottleneck. We have had the unfortunate occurence of features being held out of the current build so that QA could finish testing. This means features that are done being developed may not get tested for 2-3 weeks after the developer has already moved on. With dev moving faster thean QA, this time gap is only going to get bigger. I keep flipping through my copy of Code Complete, looking for a "Hard Data" snippet that shows the cost of fixing defects grows exponentially the longer it exists. Can someone point me to some studies that back up this concept? I am trying to convince the powers that be that the QA bottleneck is a lot more costly than they think.


Code re-use in C++, via multiple inheritance or composition? Or...?

I originally asked this question on StackOverflow, but I was directed here, and I think my problem is perhaps as much conceptual as technical, so here goes. If you’re defining a hierarchy of abstract class in C++, and then creating concrete subclasses with implementations, you could end up with abstract classes something like this, say:                 A      / \     B1 B2      So the concrete classes then inherit like so:               B1   B2        B1   B2      |    |         |    |     C1   C2        D1   D2      And this is all fine and dandy when `Cn` and `Dn` are just implementing the interfaces of `Bn`, or where say `C1` and `C2` implement the `A` interface _differently_. However, if I want to have some _shared_ functionality in `C1` and `C2`, which comes from the `A` interface, where do I put it? It can’t go in `A`, both because `A` is abstract and because `Dn` should _not_ be inheriting it. It seems like there’s a notional `A_for_C` implementation, but does this belong in another ancestor class? Or in a composed sibling class?                  _____A_____                       _____A_____       /     |     \                     /     |     \     B1   A_for_C  B2        vs        B1     B2     A_for_C      |_____/ \____ |                   |      |     C1            C2                  C1     C2                                         (C1 and C2 then each have an A_for_C and delegate)      The first one seems conceptually accurate, but requires `virtual` inheritance, while the second requires delegation. So both impose a performance hit despite there not being any real ambiguity. Reading around the web, on this website I find it said > Some people believe that the purpose of inheritance is code reuse. In C++, > this is wrong. Stated plainly, “inheritance is not for code reuse.” How then should the implementation be shared? **Further thoughts** I found some relevant discussion in these questions:   * Where does this concept of "favor composition over inheritance" come from?   * Interface and Inheritance: Best of both worlds?   * Is there any "real" reason multiple inheritance is hated? I think utnapistim’s answer below is much pithier and to the point than these, and helped me mentally cut through a lot of what these other questions/answers discuss. Inheritance is about agreeing to fulfil a contract. Multiple inheritance is fine if the subclass really does guarantee fulfilling the parent contracts. Implementation, however, is only really the concern of the final object. Yes, it might be convenient to inherit the implementation sometimes, but that’s actually orthogonal to the interface, and there are various techniques for pulling in an implementation other than the default v-table-based approach, including:   * CRTP as per unaptism’s answer   * The template method pattern (Which are, I think, equivalent except that one is compile-time and one is run-time.)


Is it ok to use static (compile-time) assertions in unit tests?

Or more generally: to trigger compiler errors in test projects if something that can be checked at compile time is wrong?


Is it appropriate for interviewers to ask candidates for their Stack Exchange user name?

Would you consider it appropriate if you were asked for your Stack Exchange username in a software job interview (or as a pre-interview screening question)? To me, it seems like a very reasonable request, and one that would be extremely informative -- I'm sure I could learn more about a candidate in five minutes by looking at the questions and answers they have posted on Stack Exchange than by a 30 minute interview. But would such a question be bad form? Is it "too personal"? (Likewise for GitHub, or other public/online code sharing forums.)


Are JavaScript MVC Frameworks only for 'single-page' apps?

I've been looking into several of the JavaScript MVC Frameworks (Backbone.js, Spine, SproutCore,etc.) and it seems to me that all of these are designed to act as 'single-page' applications. All of the examples I see have an index page that act as a front controller, and use `#` or `#!` style URLs for different pages, and handle the entire rendering of the page. I have several projects where I would like to use a more 'traditional' style of URLs, and having more structured JavaScript to handle some of the more complicated parts of the application. are JS MVC frameworks the answer here, or should I be looking for something different?


Git Submodule for untracked folder?

I have a git repository with a folder in it. The folder is listed in my .gitignore file. I cloned another repository into that ignored folder from github. I may want to work inside of the new repository but I don't see any reason for it to be a part of the original repository. Perhaps I should just keep it outside of the original repository but it seems (to me anyway) like a reasonable place for it thematically (its in a place where I would know to look for it). I guess I'm having a hard time getting my head around the concept of a submodule. My specific question is "Should I use a submodule in this situation, even when the folder is ignored?" I noticed that "git status" gives me status of my original repository even though I issue the command inside of the ignored folder


Should you solve programming puzzles as a routine?

At the moment, the only times I try solving programming puzzles are:   * When I'm bored   * When I happened to find an interesting puzzle, while not actually searching for such (e.g. someone asked about such a thing at SO) I would probably get better effects (become better at them) if I solved them routinely. Do you solve puzzles routinely (e.g. one problem at Project Euler or somewhere else per day) and/or would you recommend others to do so? What is your "programming puzzle solving routine"?


Security in Transversal Layer in Domain Driven Design

I'm building a solution based on Domain Driven Design, I'm trying to implement the security system (authentication, authorization, roles, system configuration, connection strings, etc..) in a transversal layer (cross cutting concerns like Caching, Security, Logging, etc). The tiers of my application are two projects (ContractsTransversal and Transversal), where the ContractsTransversal project only exposes the services of transversal layer using interfaces (ICaching, ILogging, ISecurity,etc..) but the implementation of those interfaces are in the Transversal project. The design is based on the book "Guia de arquitectura de Ncapas orienta al dominio" by Microsoft, that suggests the implementation of transversal layer across IoC (Dependency Injection) and its relation with all parts of the system are decoupled. I'm doing this, I created my container to implement IoC. I have other projects which have only my business entities like UsersEntity, ProductEntity, etc. Is it correct to have a references of my business entities project to my Transaversal and ContractsTransversal project? I ask because in security project I need to know information about the user, roles, permissions, etc.. or what's the best practice to implement security in a domain driven design model?


How to make sure media are used only on authorised sites?

I have a video library that I need to publish for my clients. The clients need to be able to embed a player to their sites and play the videos. I need to restrict access to my clients only so that noone else could put videos on their sites or access them programmatically. I have no idea how to accomplish this. Would appreciate any help or guidance. EDIT: I am tying to figure out how to make sure that my videos are used only on the sites of my clients, and not on any unauthorized sites. Say, myclient.com wants to have a video on their site for all their visitors. How to accomplish this? This is my understanding so far:   1. when the client's site is visited, and the page containing the video is requested, the client's server authenticates against my API that serves videos (is a full scale oauth2 provider adequate here?)   2. after that, the client's server obtains a one time token for the specific video, which in addition to being one time, has a very short TTL   3. the client server renders this token as part of the page (or a javascript).   4. then the javascript will use the token to start the video after which the token becomes expired. note that the part of the API that starts streaming videos is not protected by oauth2 mechanism, and only is protected by these one time tokens. would this work? any other ways to do this? EDIT 2: I am not asking how to prevent the end user from saving the video on the local machine. I am asking whether it is feasible to prevent a web site that is not authorized from embedding the videos on their pages, and to make sure that only the sites that are allowed to do so, can do it.


ASP.NET MVVM Handling multiple Data Transfer Objects on a single page

I have an asp.net mvc "edit" page which allows the user to make edits to the parent entity, and then also "create" child entities on the same page. Note: I'm making these data transfer objects up.               public class CustomerViewModel     {         public int Id { get; set; }         public Byte[] Timestamp { get; set; }         public string CustomerName { get; set; }         public etc..         public CustomerOrderCreateViewModel CustomerOrderCreateViewModel { get; set; }     }      In my view I have two html form's. One for Customer "edit" Http Posts, and the other for CustomerOrder "create" Http Posts. In the view page, I load the CustomerOrder "create" form in using:               <div id="CustomerOrderCreate">         @Html.Partial("Vendor/_CustomerOrderCreatePartial", Model.CustomerOrderCreateViewModel)     </div>      The CustomerOrder html form action posts to a different controller HttpPost ActionResult than the Customer "edit" Action Result. My concern is this, on the CustomerOrder controller, in the HttpPost ActionResult               [HttpPost]     public ActionResult Create(CustomerOrderCreateViewModel vm)     {         if (!ModelState.IsValid)         {             return [What Do I Return Here]         }         ...[Persist to database code]...     }      I don't know what to return if the model state isn't valid. Right now it's not a problem, because jquery unobtrusive validation handles validation on the client. But what if I need more complex validation (ie: the server needs to handle the validation).


standards for technical specificaton on software+hardware system

Are there any documented standards for technical specifications within the IT industry? In theory, such a standard would be   * successfully used in practice   * deals with both software and hardware parts (we develop software and electronics)   * should be rather modern We want to stick to one standard and use it in our projects.


Multiple models or a single model with multiple custom data types?

I am writting a small webapp for learning. Is it better / best practice to create multiple models or one model with multiple custom data types? For example: Let's say the web app is "PublicLibrary." The library would have shelves. Shelves would have books and locations. Books would have titles, authors, text and a dewey decimal number. Would it be better to have a Book model, a shelf model (couldn't come up with a better example for this), and a Library model; or a book class, a shelf class, and a Library model that holds those classes. I understand that a model _is_ a class, but hopefully my question makes sense.


secure offline PC storage accessible through javascript

I'm attempting to build a browser-based HTML5 application that has the ability to store data locally on a PC (not mobile device) when offline. This data is sensitive and must be secure. Of course the trick is trying to find a way to be able to access the secure data with Javascript. I've ruled out browser local storage since its not secure. Could this be accomplished with a local database? If so, where could the DB credentials be stored? Javascript obviously doesn't seem like a good option to store them since its user-readable.


What's the difference between CRM, CMS and ERP

I know that CRM stands for Customer Relationship Management, CMS stands for Content Management System and ERP stands for Enterprise Resource Planner. I would like to know what each of things does best and which scenarios they are used in. So basic understanding of the three with differences among them and the environments in which they are used. **Edit:** I read up on the Wiki a bit more and now I understand according to the ERP wiki that a CRM is a part of the ERP. My question to be more specific is:   * Why have a CRM separately if it's already a part of the ERP? Abstraction?    * To log and store the information of a call-center that calls a hundred odd people to get info, which is more better to achieve the following tasks, a CRM or an ERP? :     * Store all the information about all the people that we have been called      * Store information about which person called and how many hours a person has worked?     * Find out which employee has been more productive? My friend strongly believes a CRM will get the job done. So thought I'd ask you guys which would be better and why does it make it better.


Interconnect nodes in a Java distributed infrastructure for tweet processing

I'm working in a new version of an old project that I used to download and process user statuses from Twitter. The main problem of that project was its infrastructure. I used multiple instances of a java application (trackers) to download from Twitter given an specific task (basically terms to search for), connected with a central node (a web application) that had to process all tweets once per day and generate a new task for each trackers once each 15 minutes. The central node also had to monitor all trackers and enable/disable them under user petition. ![enter image description here](http://i.stack.imgur.com/xINey.png) This, as I said, was too slow because I had multiple bottlenecks, so in this new version I want to improve the infrastructure and isolate all functionalities in specific nodes. I also need a good notification system to receive notifications for any node. So, in the next diagram I show the components that I'll need in this new version: ![enter image description here](http://i.stack.imgur.com/dXCZe.png) As you can see, there are more nodes. Here are some notes about them:   * **Dashboard:** Controls trackers statuses and send a single task to each of them (under user request). The trackers will use this task until replaced with a new one (if done, not each 15 minutes like before).   * **Search engine:** I need to store all the tweets. They are firstly stored in a local database for each tracker but after that I'm thinking on using something like Elasticsearch to be able to do fast searches.   * **Tweet processor:** Just and isolated component with its own database (maybe something like the search engine to have fast access to info generated by the module). In the future more could be added.   * **Application UI:** A web application with a shared database with the Dashboard (mainly to store users information and preferences). Indeed, both could be merged into a single web. The main difference with the previous version of the project is that now they will be isolated and they will only show information and send requests. I will not do any heavy task in them (like process tweets as I did before). So, having this components, my main headache is **how to structure all** to not have to rewrite a lot of code every time I need to access any new data. Another headache is **how** can I **interconnect nodes**. I could use sockets but that is a pain in the ass. Maybe a REST layer? And finally, if all the nodes are isolated, how could I **generate notifications** for each user which info is only in the database used by the Application UI? I'm programming this using Java and Spring (at least I used them in the last version) but I have no problems with changing the language if I can take advantage of a tool/library/engine to make my life easier and have a better platform. Any comment will be appreciated.


On Developing Web Services with Global State

I'm new to web programming. I'm more experienced and comfortable with client- side code. Recently, I've been dabbling in web programming through Python's Google App Engine. I ran into some difficulty while trying to write some simple apps for the purposes of learning, mainly involving how to maintain some kind of consistent universally-accessible state for the application. I tried to write a simple queueing management system, the kind you would expect to be used in a small clinic, or at a cafeteria. Typically, this is done with hardware. You take a number from a ticketing machine, and when your number is displayed or called you approach the counter for service. Alternatively, you could be given a small pager, which will beep or vibrate when it is your turn to receive service. The former is somewhat better in that you have an idea of how many people are still ahead of you in the queue. In this situation, the global state is the last number in queue, which needs to be updated whenever a request is made to the server. I'm not sure how to best to store and maintain this value in a GAE context. The solution I thought of was to keep the value in the Datastore, attempt to query it during a ticket request, update the value, and then re-store it with put. My problem is that I haven't figured out how to lock the resource so that other requests do not check the value while it is in the middle of being updated. I am concerned that I may end up ticket requests that have the same queue number. Also, the whole solution feels awkward to me. I was wondering if there was a more natural way to accomplish this without having to go through the Datastore. Can anyone with more experience in this domain provide some advice on how to approach the design of the above application?


Correct way to sell commercial product with GPL small scripts in it

I'm developing a commercial cms. I'm going to sell this cms. I use jQuery, also I use date and time picker jQuery plugin in my cms, I can say this is just a 1% of my big script, I don't want sell my whole program as GPL because of these two small integrations (jQuery and DateTime picker). Please ask on these questions:   1. I'm worry about license issue. What is the best way to sell my product(licensing type)?   2. Is there any way to provide some partial licenses? I mean just add small notification in my license that the jQuery and The DateTime picker is still in GPL, but other part of this CMS has commercial license?   3. If there isn't any way to sell commercial product as close source with GPL small parts, what is the most strong license for selling my product to keep it safe? Please sorry for my English


Implementation ideas to store multiple files within a single file for faster access?

My requirement is to store a large number of files within a single file.The files stored could be anything like images, videos or simple text files as well. I want some ideas to implement the same. I am thinking of implementing a file system within a file, but am not sure if its a good idea. Adding in more details as requested : Platform to be developed on is Android. The idea initially was to store all the data using sqlite and provide encryption on it, but I think it will eventually lead to a slow down as the file size increases. The file is going to increase in size with time. The main area of concern here is the access time. Also I want to provide encryption for this single file. Any suggestions are welcome.


A good tool for browser automation/client-side Web scripting

I'm interested in adopting a tool/scripting language to automate some daily tasks connected with fighting forum spammers. A brief overview of these tasks: analyze new registrations and posts on a phpBB forum, and delete or deactivate spammers using a website/community that collects such spam reports. Typically such automation is integrated into the phpBB installation itself, which certainly has its advantages. My approach has the advantage of independent operation, etc. One way to think about this is in terms of browser automation. I've used iOpus iMacros for Firefox (the free version) in the past to respond to individual spammers, but current attacks are highly distributed. My "logic" for pigeonholing spammers vs. nonspammers seems beyond the easy reach of the free version of iMacros. From a more technical perspective one can think about dispensing with the browser altogether and programming GET/POST requests directed to my forum and other Web-based resources. I'm familiar with some scripting languages like Ruby and Lua, but I could be persuaded that a compiled application is better suited for these tasks. However in my experience the dynamic flexibility of interpreted environments is very useful in prototyping and debugging the application logic. So I'm leaning in the direction of scripting languages. Among browsers I favor Firefox and Chrome. I use both Windows and Linux platforms, and if the tool can adapt to an Android platform, it would make a neat demonstration of skills, yes? Thanks in advance for your suggestions!


How should data be passed between client-side Javascript and C# code behind an ASP.NET app?

I'm looking for the most efficient / standard way of passing data between client-side Javascript code and C# code behind an ASP.NET application. I've been using the following methods to achieve this but they all feel a bit of a fudge. To pass data from Javascript to the C# code is by setting hidden ASP variables and triggering a postback:               <asp:HiddenField ID="RandomList" runat="server" />          function SetDataField(data) {           document.getElementById('<%=RandomList.ClientID%>').value = data;     }      Then in the C# code I collect the list:               protected void GetData(object sender, EventArgs e)     {           var _list = RandomList.value;     }      Going back the other way I often use either ScriptManager to register a function and pass it data during Page_Load:               ScriptManager.RegisterStartupScript(this.GetType(), "Set","get("Test();",true);      or I add attributes to controls before a post back or during the initialization or pre-rendering stages:               Btn.Attributes.Add("onclick", "DisplayMessage("Hello");");      These methods have served me well and do the job, but they just dont feel complete. Is there a more standard way of passing data between client side Javascript and C# backend code? Ive seen some posts like this one that describe HtmlElement class; is this something I should look into?


Java abstract class naming

Example: You create an abstract class for Ajax actions. Different Ajax actions will all extend this class. Problem:   1. Do you name the class AjaxAction or AbstractAjaxAction?   2. When you create subclasses, do you name them:      * Action     * AjaxAction     * Just name them what they are I have not been able to find what the "official" convention is. I don't see a need for the "Abstract" prefix or any _required_ naming convention in the subclasses. (It may fit anyway, depending.) Is there an official convention? Could you link me to it? And what are your opinions on this subject?


Fullstack programmers and web design

I have been looking into full stack developments and I am confused as I am getting different answers from people. I know that full stack developers are responsible for front end and back end programming, but some people say that they are also responsible for designing websites as well. Can someone clarify this? If this is true, it seems impossible that someone would be able to keep up with all of the latest design/art trends while keeping up with an insane amount of languages and frameworks which constantly change (considering they would technically be doing 3 jobs in 1) EDIT: By designing websites, I mean, are they responsible for making the template in Photoshop and then implementing it? Or will they be presented with a photoshop template which they will have to implement? It was incorrectly worded by me, so I thought I would clarify.


Should I create specific classes for JSON Objects or only use the container(Array/Dictionary) for accessing Data?

I'm using Foursquare to get a List of Restaurants nearby inside an iOS app. The Result is stored in an Array which consists of Dictionaries and regarding how deep the Data is, each Dictionary contains also an Array with Dictionaries and so on. The Result should be shown inside a UITableView. Should I create a Class that represents a Restaurant and then create an instance for every Restaurant which I put in an Array and use this as the Data Source for my UITableView or should I use the complete Array I got the first Time. I think, using an Array with a dedicated Restaurant class would make the handling much easier but maybe there are reasons to not do it this way? Performance maybe?


How does rapid prototyping fit into an agile methodology?

I work for a large company, which dictates the use of agile processes. For example, for our projects, we use cloud-based services that are specifically targeted at managing agile development. The specific engineering group I work for has not traditionally developed software (instead we help drive projects from a much more birds-eye point of view), but that is changing. We have a wide range of upcoming/planned software projects that are mostly data-centric - e.g., we will be doing data monitoring, collection, aggregation, and some reporting. Other tasks involve automation with specialized hardware and various types of client/server (multitiered) architectures. I am to assist in the process of hiring several people, and formulating many of our plans in moving forward. My question is whether or not doing rapid prototyping (throwaway code) fits into an agile philosophy. For example, I love Python and its wide range of packages. I see the possibility of implementing many of our ideas very quickly with a Python based workflow. However, I think that there will be a lot of perceptions that Python is not "enterprise-quality", and much of this work would need to be rewritten in Java or maybe C++. However, creating the Python prototypes would give us a lot of bang for our buck in enabling us to quickly deliver real results. Have you been able to incorporate rapid prototyping - hopefully in Python - into a solid agile workflow in an enterprise environment?


JIRA Ticket Best Practices: How to write a good JIRA ticket

We "use" JIRA as our ticketing system, but "use" is a real stretch. We have no standards, no templates, no "best practices" documentation for writing a proper JIRA ticket. So I'm spearheading the movement to create such a doc. It's bad. Real bad. Sometimes, the reporter just copies-n-pastes a stacktrace and submits the ticket without providing any context, backstory, or directions to reproduce. I was wondering if anybody had some good input for what format/template we could use and enforce so that I never get a lousily-written ticket assigned to me ever again! Thanks in advance!


Recommended guidelines for declaring bash/sh variables

I have been programming in BASH for a while now and the scripts that I write are starting to get more complicated. I realized that I started to bring in some habits from C/C++ and wanted to get confirmation on if I needed to break my current habits or not. The reason being, not all programming languages are the same and they should be used to capitalize on their strengths. **Using Variables**               function()     {         #declaration block         runCommand=              for string in "$@"; do             runCommand="$runCommand $string"         done     }      vs               function()     {         for string in "$@"; do             runCommand="$runCommand $string"         done     }      **Which is advised for BASH/SH and for what reasons?** I have currently referred to the following websites. http://lug.fh-swf.de/vim/vim-bash/StyleGuideShell.en.pdf http://stackoverflow.com/questions/15610794/bash-coding-conventions http://wiki.bash-hackers.org/scripting/style **Edit: My question was a little unclear so I changed the code example a little bit.**


Create a behavior/Component based system for games

## Background I do game development as a hobby, and am looking for a better way to design them. Currently, I am using a standard OOP approach (I have been doing enterprise development for 8 years so it comes nartually). Take for example a "baddie"               public class Baddie:AnimatedSprite //(or StaticSprite if needed, which inherit Sprite)     {         //sprite base will have things like what texture to use,          //what the current position is, the base Update/Draw/GetInput methods, etc..         //an AnimatedSprite contains helpers to animated the player while          //a StaticSprite is just one that will draw whatever texture is there     }      ## The problem Lets say I am making a 2d platformer, and need the baddie to be able to Jump. Usually what I do is add the appropriate code in the Update/GetInput methods. Then if I need to make the player crawl, duck, climb, etc... the code will go there. If I'm not careful, those methods get cluttered, so I end up creating methods pairs like this `CheckForJumpAction(Input input)` and `DoJump()` `CheckforDuckAction(Input input)` and `DoDuck()` so GetInput looks like               public void DoInput(Input input)     {         CheckForJumpAction(input);         CheckForDuckAction(input);     }      and Update looks like               public void Update()     {         DoJump();         DoDuck();     }      If I go and create _another_ game where the player needs to jump and duck, I usually go into a game that has the functionality and copy it over. Messy, I know. Thats I why I'm looking for something better. ## Solution? I really like how Blend has behaviors I can attach to an element. I have been thinking about using the same concept in my games. So lets look at the same examples. I would create a base Behavior object               public class Behavior     {         public void Update()         Public void GetInput()     }      And I can create behaviors using that. `JumpBehavior:Behavior` and `DuckBehavior:Behavior` I can then add a collection of behaviors to the Sprite base and add what I need to each entity.               public class Baddie:AnimatedSprite     {         public Baddie()         {             this.behaviors = new Behavior[2];             this.behaviors[0] = new JumpBehavior();             //etc...         }              public void Update()         {             //behaviors.update         }              public GetInput()         {             //behaviors.getinput         }     }      So now If I wanted to use Jump and Duck in many games, I can just bring the behaviors over. I could even make a library for the common ones. ## Does it work? What I can't figure out is how to share state between them. Looking at Jump and Duck, both affect not only the current portion of the texture being drawn, but also the state of the player. (Jump is going to apply a decrementing amount of upward force over time, while duck is just going to stop movement, change the texture and the collision size of the baddie. How can I tie this together so it works? Should I create dependency properties between the behaviors? Should I have each behavior _know_ about the parent and directly modify it? One thing I thought was being able to pass a delegate into each behavior to get executed when it is triggered. I'm sure there are more issues I am looking over, but the entire purpose is for me to be able to easily reuse these behaviors between games, and entities in the same game. So I turn it over to you. Care to explain how/if this can be done? Do you have a better idea? I'm all ears.


Should I use default access modifier or not -- Coding practice?

Normally when creating new global variables I do not define its access modifier. So as per java it will adopt property default access modifier. When I'm need to access that variable in out of default scope I change its access modifier else leave it as it is. So my question is " _Am I doing it right way? Is it normal to have default access variables? or should I use private/public for them? Is it good coding practice to not to use access modifiers?_ "


Need help modelling a User/Project/Task relationship

So I'm creating a very simple project/task management application in Laravel 4 and I'm not sure how these relationships would work. I have a `Project`, `Task` and `User` model. A `User` can own a `Project` or be a member of a `Project`. A `Task` belongs to a `User` and a `Project`. What is the best way to define the `User`/`Project` relationship? I could have a many to many relationship from `User` to `Project` and use a `project_user` pivot table to associate the two. If I wanted to determine if a `User` owned the project I could add a field to `Project` called `owner` and populate it with the id of the `User` who created it. This seems kind of wrong though as this relationship would normally be modeled in a belongs to relationship? Any advice is greatly appreciated :)


Best practices for working with multiple programmers

I think most programmers prefer to work solo on projects, even when it's not feasible. I prefer to work alone, even outside of programming projects. When working with other developers, I typically find that   * I don't like their formatting or conventions (such as variable or method names)   * I don't have a good understanding of how the code they wrote works, which I would have if I wrote it myself   * I think there is a better or more efficient way to implement something they wrote What are the best ways to overcome these issues and any other similar team issues for a project with 4-5 programmers?


How do you do to create the ViewModel part of your MVVM designs?

Sometimes, when I plan to create a program using this architectural pattern, I've got a lot of difficulties when I'm in the View Model phase. I'm using WAF Framework to develop this architectural pattern. I'm a still a newbie. Before you start, do you create all the UML design or do you use another tool to help you? How do you handle the design of your ViewModels ?


What is the difference between HaXe NME and OpenFL?

On http://en.wikipedia.org/wiki/NME_%28framework%29 there is an info: > NME is an open-source game and application framework that supports iOS, > Android, BlackBerry, Microsoft Windows, Mac OS X, Linux, Flash Player and > HTML5, with legacy compatibility for webOS. On OpenFL website ( http://www.openfl.org/about/overview/ ), is this info: > OpenFL is a software development kit that provides an environment for > building fast, native games and applications for iOS, Android, BlackBerry, > Windows, Mac, Linux, Flash and HTML5. The link to the website of HaXe NME (on wikipage), redirects to website of OpenFL, and on that website, is zero informations about HaXe NME, it looks like it doesn't have its own website and any documentation. I have impression that both do kinda the same thing - enable easy compilation to the same platforms, but are clearly two different libraries in haxelib, so - what is the difference between them? How they relate to each other?


Where to place 3rd party software license information?

After a user installs my application, where in the app's install directory should I place information regarding 3rd party software (e.g. FOSS) licenses? Should I just append it to my EULA? Is there some sort of convention or standard that I should following to make it easily scan-able by license detection scripts?


When should I increment version number?

I didn't learn programming at school and I do not work as a (professional) developer, hence a lot of basics are not quite clear to me. This question tries to clarify one of them. * * * Now let's suppose that I have issues `#1`, `#2` and `#3` in my Issues Tracker that are set to be corrected/enhanced for version `1.0.0` and that the last (stable) version is `0.9.0`. When should I increment to version `1.0.0` ? When a) **just one** of the listed above issues is closed or b) when **all** the issues related to version `1.0` are closed ? Which one is the _right_ way to do it ? And by the _right_ way, I mean what is currently used in the industry.


Benefits of rapid release development cycle adopted by the Mozilla Foundation

Which the real benefits of rapid release development cycle adopted by the Mozilla Foundation in comparison with the strategy adopted previously?


How should I organize the Presenters/Views for model view presenter?

We have several hundred ASPX files (could be more than that, into the thousands, I haven't actually counted) that currently use no architecture and have all the logic/data access in code-behind files. Moving forward I want to push using `Model-View-Presenter` (probably the "Supervising Controller" version) to try and get some clean separation. What would be the best approach to logically lay out these files in my Presentation library? Most of the aspx files aren't organized and just thrown into the main directory, but some are grouped (or are misgrouped e.g. having customer-related files in a folder called "orders"). Should I try to group presenters and views by modules (e.g. have `Presentation.Views.Customers` and/or `Presentation.Customers`)? The correct approach does **not** seem to be just have hundreds of `XPresenter` and `XView` files thrown into the class library.


Is "Free for non-commercial use" license compatible with GNU GPLv3 license?

I want to ask whether any materials that has "Free for non-commercial use" license can be used in a GNU GPLv3 licensed software. In my opinion, it is "free for non-commericial use", and GNU GPLv3 is also non-commericial, so it can be used in the software, is it? I'm asking this question because there are no explicit or clear declaration about "FREE FOR NON-COMMERCIAL USE" license out there....


What's the proper term for a function inverse to a constructor - to unwrap a value from a data type?

**Edit:** I'm rephrasing the question a bit. Apparently I caused some confusion because I didn't realize that the term destructor is used in OOP for something quite different - it's a function invoked when an object is being destroyed. In functional programming we (try to) avoid mutable state so there is no such equivalent to it. (I added the proper tag to the question.) Instead, I've seen that the record field for unwrapping a value (especially for single-valued data types such as `newtype`s) is sometimes called _destructor_ or perhaps _deconstructor_. For example, let's have (in Haskell):               newtype Wrap = Wrap { unwrap :: Int }      Here `Wrap` is the constructor and `unwrap` is what? The questions are:   * **How do we call`unwrap` in functional programming?** Deconstructor? Destructor? Or by some other term?   * And to clarify, **is this/other terminology applicable to other functional languages** , or is it used just in the Haskell?   * Perhaps also, **is there any terminology for this in general, in non-functional languages**? * * * I've seen both terms, for example: > ... Most often, one supplies smart constructors and **destructors** for > these to ease working with them. ... at Haskell wiki, or > ... The general theme here is to fuse constructor - **deconstructor** pairs > like ... at Haskell wikibook (here it's probably meant in a bit more general sense), or > >     newtype DList a = DL { unDL :: [a] -> [a] } >   > > The unDL function is our **deconstructor** , which removes the DL > constructor. ... in The Real World Haskell.


API Wordpress & Inksoft

I am new to this whole website design and API bit. My husband has bought a license for the program InkSoft. Their site does not offer very much customization, so we decided to buy a Wordpress.org site that is hosted through godaddy. With all of that said, I am trying to figure out a way to take the products that are on InkSoft's website, which get their information from the suppliers' warehouses (for things like inventory), and put them on the Wordpress site. There is an area on InkSoft where I can access "Store API...API feeds." I guess I am just confused on where to put this type of stuff in the WordPress site or how to put it in there? If I go to the "Products" area on this Store API, I am given a URL that deals with the product stuff and I am also given a HUGE list of stuff that contains stuff such as:               <ProductCategoryList>     <vw_product_categories product_category_id="1000076" name="Most Popular" path="Most Popular" thumburl_front="REPLACE_DOMAIN_WITH/images/publishers/2433/ProductCategories/Most_Popular/80.gif" />      How to use all this stuff?


When to use inheritance or composition/aggregation?

In general, how do I decide whether to use make a class a super class, or to make it a private data member of another class? For example, given two classes, how does one decide whether to do this:               public class Sprite {         private BaseImage image;         ...      or this:               public class Sprite extends BaseImage {         ...      Functionally, I know the difference: in the second case, any method that uses an instance of the Sprite class will have access to the underlying BaseImage behavior. In the first case the behavior of the BaseImage object is hidden. But from a design perspective, which is preferable in what cases?


How can I effectively manage long-term feature development and short-term bug fixing at the same time?

We have a huge C, and C++ code base. There is a plan to add a new feature into the existing system, but, this should happen only after 3 to 4 months. So, we are looking for best possible options.   1. Branching off is one option, but, this involves porting the bug fixes to the feature branch from the trunk.    2. Staying on the trunk itself, have `ifdef` to differentiate the new feature compilation   3. Split the source/header files that involve the new feature, edit the makefiles to pick the right file. I understand this question is pretty vague, and only people working on it can well decide the way forward. But, I'm looking for generalized opinions on a case like this.


What is the development workflow for an Android SIP application?

I want to build an Android SIP application, and I'm looking at csipsimple's source for inspiration. I am using:   * Linux,   * Eclipse 3.7,   * Android sdk & ndk,   * swig. What are the development phases or steps for such an application? And what would be an appropriate licence? I am not asking for code, but for an overview of the development workflow for such an application.


Figuring a max repetitive sub-tree in an object tree

I am trying to solve a problem of finding a max repetitive sub-tree in an object tree. By the object tree I mean a tree where each leaf and node has a name. Each leaf has a type and a value of that type associated with that leaf. Each node has a set of leaves / nodes in certain order. Given an object tree that - we know - has a repetitive sub-tree in it. By repetitive I mean 2 or more sub-trees that are similar in everything (names/types/order of sub-elements) but the values of leaves. No nodes/leaves can be shared between sub-trees. Problem is to identify these sub-trees of the max height. I know that the exhaustive search can do the trick. I am rather looking for more efficient approach.


Algorithm for determining the order of property resolution

I have a list of properties, that are bound to some string expression: > property z, expression '[x] + [y]'   >  property x, expression '[y] + 1'   >  property y, expression '1' So to solve z, I need first to solve x and y. My current approximation is this:               var solved = new List<string>();     while (properties.Count() > 0)      {        var property = properties.Dequeue();        var dependencies = FindDependencies(property)              .Where(x => !solved.Contains(x))              .ToList();             // no unsolved dependencies, solve it        if (dependencies.Count == 0)         {            property.Solve();            solved.Add(property.Name);        }         // it can't be solved now, add to the end of queue        else         {               properties.Enqueue();        }     }      This approximation has two problems: a) I think it is not optimal, because not solved property is added to the end, may be it could be solved sooner and in that case on it dependant properties would not postponed also.   b) Could not get any good exit condition, when it is unsolvable (meaning, that there's circular reference). Does anybody recognize here existing well known algorithm, or has ideas how to optimize it?


where can I find an overview of known "multithreading systems architectures" design patterns?

Using C#, I have been doing multithreaded development for about 5 years, and consider myself quite proficient (I wrote my own lock-free queue and task parallel framework before Microsoft made TPF). However, I find it incredibly difficult to find information on practical multithreaded system design patterns anywhere. There are some good resources on low-level algorithms and collections, but not much on system design. So to the question, anyone know where this information can be found?


Is the "Gets or sets .." necessary in XML documentation of properties?

I am looking for a recommendation of a best practice for XML comments in C#. When you create a property, it seems like that the expected XML documentation has the following form:               /// <summary>     /// Gets or sets the ID the uniquely identifies this <see cref="User" /> instance.     /// </summary>     public int ID {         get;         set;     }      But since the signature of the property already tells you what operations are available to the external clients of the class (in this case it is both `get` and `set`) I feel like the comments are too chatty and that perhaps the following would be sufficient:               /// <summary>     /// ID that uniquely identifies this <see cref="User" /> instance.     /// </summary>     public int ID {         get;         set;     }      Microsoft uses the first form so it seems like it is an implied convention. But I think that the second one is better for the reasons I stated. I understand that this quetion is an adept for being marked as not being constructive, but the amount of properties that one has to comment is huge and so I believe that this question has its right to be here. I will appreciate any ideas or links to official recommended practices.


Use of NotImplementedException

Is it considered bad practice to throw `NotImplementedException` for code you haven't written yet? Possibly TODO comments would be considered safer?


What is a good strategy for binding view objects to model objects in C++?

Imagine I have a rich data model that is represented by a hierarchy of objects. I also have a view hierarchy with views that can extract required data from model objects and display the data (and allow the user to manipulate the data). Actually, there could be multiple view hierarchies that can represent and manipulate the model (e.g. an overview-detail view and a direct manipulation view). My current approach for this is for the controller layer to store a reference to the underlying model object in the View object. The view object can then get the current data from the model for display, and can send the model object messages to update the data. View objects are effectively observers of the model objects and the model objects broadcast notifications when properties change. This approach allows all the views to update simultaneously when any view changes the model. Implemented carefully, this all works. However, it does require a lot of work to ensure that no view or model objects hold any stale references to model objects. The user can delete model objects or sub-hierarchies of the model at any time. Ensuring that all the view objects that hold references to the model objects that have been deleted is time-consuming and difficult. It feels like the approach I have been taking is not especially clean; while I don't want to have to have explicit code in the controller layer for mediating the communication between the views and the model, it seems like there must be a better (implicit) approach for establishing bindings between the view and the model and between related model objects. In particular, I am looking for an approach (in C++) that understands two key points:   1. There is a many to one relationship between view and model objects   2. If the underlying model object is destroyed, all the dependent view objects must be cleaned up so that no stale references exist While shared_ptr and weak_ptr can be used to manage the lifetimes of the underlying model objects and allows for weak references from the view to the model, they don't provide for notification of the destruction of the underlying object (they do in the sense that the use of a stale weak_ptr allows for notification), but I need an approach that notifies the dependent objects that their weak reference is going away. Can anyone suggest a good strategy to manage this?


Which extreme-programming techniques are appropriate to use in a research environment?

Which (if any) extreme-programming techniques would be appropriate to use in a research environment - where the goal is to produce prototypes, patentable, and/or publishable work?