title: CPU recommendation for learning multiprocessor programming

text: This might be an odd question and the place to ask might not be appropriate. I am very interested in working with multiprocessor programming and parallel algorithms, mostly for research purposes. I want to build a computer specially for this and it should have at least 8 cores (many algorithms have contention problems only starting with 8 cores). Looking at what Intel and AMD offer I think the 8-core Intel CPUs are far too expensive, so I would have to choose between:   \- 6-core Intel i7 980X (3.33 Ghz)   \- 8-core AMD FX 8150 (3.6 Ghz)   \- 2x8-core AMD Opteron 4248 (3.0 Ghz, server version of FX 8150)   \- 1x or 2x-12-core AMD Opteron 6172 (2.1Ghz, expensive, but sometimes affordable on Ebay) I'm inclined for the 2xOpteron, but I'm not sure how the Bulldozer architecture compares to the Intel one; from what I understand the 8 cores actually share some parts and are not compleltely independent like the Intel ones (ignoring the shared L3 cache). I'm not sure that the results I get would reflect the ones that would be obtained on a " classical" CPU. On the other side, the i7 is much more powerful and might be sufficient for testing the parallel algorithms. The 2x12-core Opteron would probably be the best for testing, but they are also the slowest by far and I would like to use this computer as a workstation too. What would be the best solution? Is the Bulldozer architecture suitable for research (mostly for the massive parallelization of a compiler I wrote)?


title: How do you write straight to the point documentation without looking sloppy and informal?

text: I'm currently at a contract position and am looking to add to the documentation of the projects I worked on, to assist the next hiree taking over my projects. The documentation I received was overly technical (i.e. references code right away, references replacing certain values on certain lines, no high level description at all) How do I write documentation in simple plain English that is of actual benefit without looking sloppy? I find it difficult in areas such as outlining a system's flaws without coming off as judgmental, but still emphasize the severity of how detrimental some of the flaws are.


title: Will SSD make the distinction between column oriented DB and row oriented DB obsolete?

text: I had a discussion with a friend about row vs column oriented RDBMS. From my understanding, these things are closely linked with the fact that there's a concrete drive head reading and writing the data. This head moves and reading/writing data is faster if the head moves are limited. Still from my understanding, SSD drives drops those mechanical artifacts and accessing the data is now taking the same amount time regardless of where they are physically stored on the chip / device (don't know the right term). Considering these two points, will the SSD drives (when they'll have reached their full potential) make the distinction between row oriented and column oriented either obsolete or pointless?


title: Extending Mono's C# compiler with additional custom features (more or less syntactic sugar)

text: I'm aware that this is a rather broad question, but here it goes anyway... What is, in your opinion, the most practical way to create own C# implementation with minor additions to the existing 4.0 feature set? For context: I'm thinking about adding a couple of (mostly syntactic) niceties to the dynamic feature set that would improve the whole duck-typing experience. For example, these would include the idea of a dynamic interface, as proposed in this debate (particularly in the last comment from MiddleTommy). I'm aware that nothing is stopping me from simply diving into the Mono sources. However, I'm compelled to first ask about potentially similar projects that may already exist in the wild. Any such extension efforts underway?


title: How to debug/change Java code while the program is running?

text: I just saw a video showing how Notch (of Minecraft fame) is debugging and changing Minecraft while it is running. He pauses the game, changes something in the code and then unpauses the game where the change takes immediate effect without the need to restart the program. How does this work? Which kind of technique is used to achieve this?


title: Object design where hard-coded values are used to instantiate objects?

text: I'm creating the design for a browser bookmark merging program and I've ran into a design problem that I've seen before yet I've never come up with a good solution for it. So lets say I have a Browser class:               Browser:       String bookmarkFilePath       String type       Bool bookmarkFileExists()      When my program runs I will want to have hard-coded values of common browsers and the locations of their Bookmarks file:               Object with hard-coded values:       "~/Library/Application Support/Google/Default/Bookmarks", "Chrome"       "~/Library/Safari/Bookmarks.plist", "Safari"      **Is there a design pattern or object type that could effectively take an object with hard-coded values (Browser name / bookmarks file path) and uses it to instantiate (and possibly manage) other (Browser) objects?** Also, flexibility is important since there are edge cases such as Firefox's file path to the bookmarks file is always different and some searching needs to be done. **EDIT: I will be implementing this in Python. _Sorry for not mentioning this before_.**


title: Trial/Free & Full Version VS. Free App + In-app billing?

text: I'm just wondering what would be the best strategy to publish an application on the Android Market. If you have a free and paid version you have two codes to update (I know it will be 99% the same but still) and besides all the popular paid apps are quite easy to find for "free" in "alternative" markets. Also if you have any stored data in the trial/free version you lose it when you buy the full version.. On the other hand if you put a free application but inside you allow the user to unlock options (remove ads/more settings/etc...) you only have to worry about one code. I don't know the drawbacks of that strategy and how easy/hard is to hack that to get all the options for "free".


title: Is OCaml any good for numerical analysis?

text: I'm currently using C and some FORTRAN to solve numerically systems of differential equations. I'm a bit fed up with both of these languages but I need to have some (rather) efficient code... I'm thinking of switching to OCaml. Is it worth it?


title: Application design for web/iPad/iPhone/Android application

text: I have a web application which is a pretty standard SAAS database driven app. I have a few customers asking for iOS or Android versions of the app. Is it better to build an API on the web app which is then used to drive the native mobile apps UI? This would be simplest but mean the mobile apps are not 'stand alone'. Alternatively I could try and implement a full mobile solution that then synchronizes with the web app somehow. This would be much more work as all the business logic needs to be build into the mobile apps rather than behind the API. What is standard practice for this kind of thing?


title: Organizing MVC entities communication

text: I have the following situation. Imagine you have a MainWindow object who is layouting two different widgets, ListWidget and DisplayWidget. ListWidget is populated with data from the disk. DisplayWidget shows the details of the selection the user performs in the ListWidget. I am planning to do the following: in MainWindow I have the following objects:   * ListWidget   * ListView   * ListModel   * ListController ListView is initialized passing the ListWidget. ListViewController is initialized passing the View and the Model. Same happens for the DisplayWidget:   * DisplayWidget   * DisplayView   * DisplayModel   * DisplayController I initialize the DisplayView with the widget, and initialize the Model with the ListController. I do this because the DisplayModel wraps the ListController to get the information about the current selection, and the data to be displayed in the DisplayView. I am very rusty with MVC, being out of UI programming since a while. Is this the expected interaction layout for having different MVC triplets communicate ? In other words, MVC focus on the interaction of three objects. How do you put this interaction as a whole into a larger context of communication with other similar entities, MVC or not ?


title: Can the customer be a SCRUM Product Owner in a project?

text: I just had a discussion with a colleague about the Product Owner role: In a project where a customer organization has brought in a sofware developing organization (supplier), can the role of Product Owner be successfully held by the customer organization, or should it always be held by the supplier? I always imagined, that the PO was the supplier organizations guy. The guy that ensured that the customer is happy, and continously fed with new and high-businessvalue functionality, but still an integral part of the developer organization. However, maybe I have viewed the PO role too much like the waterfall project manager. My colleague made me think: If the customer organization is mature and proffessional enough, why not let a person from their camp prioritize the backlog?? That would put the PO role much closer to the business, thus being (in theory) better to assess the business value of backlog items. To me, that is an intriguing thought. But what are the implication of such a setup??? I look forward to your input.


title: Is object-oriented conceptual thinking something you build with experience?

text: I know that the answer is pretty clear because you get better on everything with time and experience. But I'll tell you where I'm coming from: A couple of months ago I decided to learn iOS development, so I studied C (read the C primer plus book, pretty good book). Recently I finished "Programming in Objective C" and lately I started following the Stanford course for Winter 2013 (I'm really enjoying it. I'm only at the beginning of the course, on lecture #3, and had to do only 2 homeworks). I understand all the syntax and concepts so far, and I think Objective C is an amazing language. But something has been bothering me, I thought it might be because I'm new to OOP. For example when the instructor defines models (matching cards game for instance), I definitely understand the syntax and logic, but sometimes I'm trying to think if it as taking a task (card game for instance) and breaking it into the right logic. Is this something I will get used to with time? Because at this stage when I try to predict things I'm supposed to do, pretty often I go and see some of his logic and go back to code. Actually we haven't had to go from zero, he always tells us to follow the presentation with the code in this stage, but I really want to improve at taking a task and knowing how to break it into the right models, controllers, etc.


title: What is "toolkit design"?

text: What does "toolkit design" mean and what are the basic steps to design a toolkit for a specific task/project? It appears in a task description which says: "This task deals with the design of detailed specification of the various tools that are employed in order to implement [insert some development task here]" So what I understand is that: it's required to design and provide the specifications of a toolkit which will be used for doing some specific tasks. But how is toolkit design done? Searching Google hardly gives any meaningful result. They are mostly about "design toolkits" which is not what I'm looking for. For example this guy has designed a software toolkit in some of his previous projects http://logonpro.com/resume.doc


title: Project Management - Asana / activeCollab / basecamp / alternative / none

text: I don't know whether this should be on programmers - I've been looking at the above three apps over the past few weeks just for myself and I'm in two minds. All three look good, are easy to use, and I came to this conclusion;   * Asana is the easiest to use    * ActiveCollab is the feature rich and easiest flow   * BaseCamp is the best UX / design But I didn't really find my workflow was any more quicker / efficient, in fact it was a bit slower and organized. Is there a realistic place for them in workflow - should programmers use them for themselves, or only when a project manager can take control of it?


title: What is a good design strategy for retaining history of user activities and files like Visual Studio projects?

text: OK so I'm not so sure that "project" is the right term, but for my purposes, I define "project" as similar to what Visual Studio uses, or Microsoft word - files that the user can open and work on and then save, and when the user runs the application again the program is aware of the files that were worked on last time the application was open. So I ask, what is a good design strategy for retaining history of user activities and files like Visual Studio projects?


title: Differences between a Unified Process and an Agile project plan?

text: There've been many discussions on SO about the differences between (Rational) Unified Process and the Agile methodology. Can someone please give me an example on how different a project plan would be if there are 2 teams doing the same project, but following these 2 different methods?


title: What are the best XP practices?

text: In "Extreme Programming Explained", Beck lists 13 "primary practices". They are:   * Sit Together   * Whole Team   * Informative Workspace   * Energized Work   * Pair Programming   * Stories   * Weekly Cycle   * Quarterly Cycle   * Slack   * 10 Minute Build   * Continuous Integration   * Test-First Programming   * Incremental Design Which of these have you actually implemented in your workplace? Which has been the most useful?


title: What software development process should I learn first for a solo project?

text: I want to develop a project on my own (if it is sucessful more people might start working on it too). Also I want to apply some proper software engineering from the first until the last day. On one hand just to try it out and compare results with previous projects that were just about writing code quick and dirty, and on the other hand to learn! I know the proper answer to this question is "It depends very much on the project...", "There is no single correct answer...". But I just need someplace to start, somewhere where every step is written down and tells me what to do. If I'm not happy next time I'll try something else. So, how/where should I start? I would love to hear some book suggestions cause I'm all about books :-D. EDIT: Answering a few of the questions that popped up: **Customer** : There is kind of a customer/friend. No real pressure.   **Version Control** : I have used subversion in the past and want to try mercurial.   **Bug tracking** : I was under the impression that for s single developer a checklist was enough (am I wrong there?)   **Testing** : I want to try Lime (because I use Symfony) and Selenium.   On the whole I will try out a lot of stuff I haven't used before but as I said one of the main points is learning. The Pomodoro Technique keeps popping up wherever I look, so maybe I should have a look at that...


title: How can programmers improve their UX skills?

text: As programmers we can solve very complex problems, but then, when we have to design a user interface we tend to fail on making them easy to use. In small companies they can’t afford having designers and UX experts, programmers have to do almost everything in the software. But these interfaces are rarely intuitive (the classic example). What is the problem? How can developers improve their skills in designing good user experiences?


title: Original author rights in a licensed software project

text: I'm working on a software project where so far I'm the sole developer. As of right now the code is unlicensed, but the copyright of whatever I've written belongs to me (this is true at least in North America AFAIK). Before I release the software to the public, I'm going to license its distribution, probably under something like MPL or GPL. Question 1: As the original copyright holder, does this effect me in anyway? Or do I still have unrestricted distribution rights? Question 2: After some time, more developers join the project. Now much of source code copyright belongs to me+contributors. How do distribution rights work for the authors now? Regards, kfl


title: What is the / your most effective QA process?

text: I'm looking for some ideas on how to improve our current Quality Assurance process. There is no official QA method in place right now, but we basically just get some requirements using a ticket system and we go back and forth until all the requirements are covered. The problem right now is some requirements change and we may spend a day or 5 days on multiple requirements but in the end they all get tossed because the end user decided it's not appropriate or wanted something else. So we lose time and money, but how can we have foreseen these situations? I have to believe there is an effective way to communicate with end users about their set of requirements so that we can EXTRACT and squeeze out any doubts to foreshadow a change in a range of requirements. And then we need to be very sure that the requirements won't be tossed or changed so drastically that our work was a waste. In some ways it is about understanding really really well what the user eventually wants. But what is this effective QA process? Any ideas are greatly appreciated. I'd be happy to clarify any concerns. Thank you!


title: Estimed number of tries

text: **Problem:** The Oscar Committee wants to decide which person should get the best actor award among the given N actors.For that they decided to use a random function random_bit() which returns either 0 or 1 with equal probablity. For the results to be fair,the committee was asked to generate a random number between 1 to N (inclusive) , such that all actors have equal probability of being chosen (which in this case should always be equal to 1 / N. First of all Committee wants to know the expected number of times they will need to call random_bit() function to generate a random number between 1 to N.Also, while calling the function, they should follow the optimal strategy (i.e. the strategy that minimizes the expected number of function calls) * * * This is problem of past contests at codechef.com and here's the link to it. This site allows to see other users solution and till now only one solution has been accepted. The solution is in C++ code:               #include <iostream>     using namespace std     int main() {         int T;         cin >> T;         for(int ii = 0; ii<T; ++ii)          {              int N;              cin >> N;              double p = 1, ans = 0;              int x = 1 % N;              for(int i = 0; i<100000; ++i)              {                   ans += x * p;                   x = (x * 2) % N;                   p /= 2;              }              cout << ans;         }         return 0;     }      I know how the code runs and what it does, but I can't find the logic behind it. Any help/ clue? Also it would be nice if someone can post another algorithm.


title: What happens to equal elements when inserting into a binary search tree?

text: Most BST examples show a sample of a BST with unique values; mainly to demonstrate the order of values. e.g. values in the left subtree are smaller than the root, and values in the right subtree are larger. Is this because BSTs are normally just used to represents SETs ? If I insert an element say 4 which already exists in the BST, what should happen ? e.g. In my case, 4 is associated with a payload. Does it mean I override the existing node's payload.


title: How do you coordinate with interaction designers during implementation?

text: Programmers are largely responsible for helping move a product from design to implementation. This process is always full of snags:   * implementation details rear their ugly head and make parts of the design infeasible   * user feedback on early prototypes leads to changes in the design   * new technologies alter the field of what is possible, bringing back designs previously thought impossible   * priorities shift, schedules change, and requirements wander How do you keep design and implementation in contact during the implementation? What processes do you use? Tools? Artifacts? Guidelines? Communication strategies?


title: Origin of "Readme"

text: When did people start writing Readme files? It seems that pretty much all programs have this file, regardless of the format. Is there any documented first use of this document?


title: Dynamic vs Statically typed languages for websites

text: This statement suggests that statically typed languages are not ideal for web sites: > I’ll contrast that with building a website. When rendering web pages, often > you have very many components interacting on a web page. You have buttons > over here and little widgets over there and there are dozens of them on a > webpage, as well as possibly dozens or hundreds of web pages on your website > that are all dynamic. With a system with a really large surface area like > that, using a statically typed language is actually quite inflexible. I > would find it painful probably to program in Scala and render a web page > with it, when I want to interactively push around buttons and what-not. If > the whole system has to be coherent, like the whole system has to type check > just to be able to move a button around, I think that can be really > inflexible. Source: http://www.infoq.com/interviews/kallen-scala-twitter Is this correct? Why or why not?


title: Production-safe SQL stored procedure debugging

text: We have an enormous number of nested SQL stored procedures, and a number of different ways of debugging them (varying from developer to developer). So far, our methods include:   1. An optional `@debug` parameter, that causes the procedure to `print`messages as it runs (passing the variable down to called procedures).   2. Checking `@@servername` against a table of test server names, and `print`ing as above   3. Writing everything the procedure does to a log table (in production and test) Which of these is preferable (and why), or is there a better method we've overlooked?


title: Creating New Wrapper Objects and Extension Classes and Keeping it Organized

text: Here's my situation: I'm programming an embedded device with a very simple, but customizable LED array display. It's 10 RGB LEDs linearly setup. The LEDs will be used to display many different things depending on the device's mode. Now, I've started down the road, but feel after spending a lot of time coding and finding a lot of duplicate coding that this should be simplified with some abstraction and wrappers methods and classes. At the very bare minimum and starting point, I have a class, the LED driver, which represents the hardware driving the LEDS. It has one Method which is primarily used `TLC5940.Display(ushort[] greyscaleData)` where greyscaleData is an array of size equal to the amount of output pins, a multiple of 16(16 per chip, chips can be connected to each other).This array controls each pins individually allowing direct control of the leds. This lead me to creating different "extension" methods in a static class which had different routines of populating this array and then passing it into the `Display` method. This works ok for testing different methods, but I found a lot of duplicate code with how I populate the array because each RGB led consumes 3 physical pins(and 3 consecutive array values) to control a specific RGB LED. So, I need to write a consecutive chunk of three values to control an LED. I came up with this private method in the static extension class:               private static void FillLEDArray(ref ushort[] brightnessArray, ushort LEDNumber, ushort rVal, ushort gVal, ushort bVal, short ledStartPin = 2, ushort numLEDs = 10)     {         //logic for how to shift array for physical pin layout         if (ledStartPin == 2) { ledStartPin = 0; }         else if (ledStartPin == 1) { ledStartPin = -1; }         else { throw new Exception("Can only be 1 or 2"); }              ushort pinStart = (ushort)(LEDNumber*3  + ledStartPin);         brightnessArray[pinStart] = bVal;         brightnessArray[pinStart-1] = gVal;         brightnessArray[pinStart - 2] = rVal;     }      It's simple and this makes things easier with my extension display methods so I can loop from 1 to 10 and call this method to write a specific LED to the array in one call. On a deeper level, I thought to make an LED object, which would contain an array of the 3 values and also offer some functions like LED.Colors.Red, LED.Colors.Blue, etc and return an array that would represent that color to make coding easier and more fun. Moreover, create a LED container object class to contain LED object. ex: `LEDS.LED(1).Color.Red` this could also generate an array on demand. One more level of complexity, My device is user customizable, so I have created a User Settings class, which contains all of the device's user settings, many of which apply to the LEDs like certain colors of the RGBs, overall brightness, color schemes, etc. These settings, such as brightness, would need to be applied the whole array before it's sent to the display also. If you've read this far, Thanks. **Question:** At this point have all the tools and ways to control the LEDs, but I'm looking to rewrite this all and wondering what's the best way to encapsulate all of this functionality? Is there a certain coding pattern or style that would apply to this? * * * My Own thoughts: In writing this out and getting it out of my head, maybe a new `DeviceDisplay` class which would contain an instance of the LED hardware and settings classes? Should this class be Static or Singleton? I'm also concerned about Memory/RAM/Speed because this is an embedded device. I would appreciate some feedback on this as it seems there's a lot of different dependencies and getting a little lost in my brain.


title: Child to Parent linking - bad idea?

text: I have a situation where my parent knows about it's child (duh) but I want the child to be able to reference the parent. The reason for this is that I want the child to have the ability to designate itself as most important or least important when it feels like it. When the child does this, it moves it to the top or bottom of the parent's children. In the past I've used a WeakReference property on the child to refer back tot he parent, but I feel that adds an annoying overhead, but maybe it's just the best way to do it. Is this just a bad idea? How would you implement this ability differently? Update 1: Adding more context. This is a rendering system so the parent container is a list of windows grouped together. The child item (window) that says "I'm most important!" wants to basically be rendered on the top of the rest of the windows. The parent is just a logical container to group these children together. I can see where adding an event to signal the request to be on the top is a good idea. But implementation (what the child wants to do with the parent) aside, why wouldn't you want to have child->parent linking? Doubly linked lists do this so people can traverse to and from something.


title: Too complex/too many objects?

text: I know that this will be a difficult question to answer without context, but hopefully there are at least some good guidelines to share on this. The questions are at the bottom if you want to skip the details. Most are about OOP in general. Begin context. I am a jr dev on a PHP application, and in general the devs I work with consider themselves to use many more OO concepts than most PHP devs. Still, in my research on clean code I have read about so many ways of using OO features to make code flexible, powerful, expressive, testable, etc. that is just plain not in use here. The current strongly OO API that I've proposed is being called too complex, even though it is trivial to implement. The problem I'm solving is that our permission checks are done via a message object (my API, they wanted to use arrays of constants) and the message object does not hold the validation object accountable for checking all provided data. Metaphorically, if your perm containing 'allowable' and 'rare but disallowed' is sent into a validator, the validator may not know to look for 'rare but disallowed', but approve 'allowable', which will actually approve the whole perm check. We have like 11 validators, too many to easily track at such minute detail. So I proposed an `AtomicPermission` class. To fix the previous example, the perm would instead contain two atomic permissions, one wrapping 'allowable' and the other wrapping 'rare but disallowed'. Where previously the validator would say 'the check is OK because it contains allowable,' now it would instead say '"allowable" is ok', at which point the check ends...and the check fails, because 'rare but disallowed' was not specifically okay-ed. The implementation is just 4 trivial objects, and rewriting a 10 line function into a 15 line function.               abstract class PermissionAtom {     public function allow(); // maybe deny() as well     public function wasAllowed();     }          class PermissionField extends PermissionAtom {     public function getName();     public function getValue();     }          class PermissionIdentifier extends PermissionAtom {     public function getIdentifier();     }          class PermissionAction extends PermissionAtom {     public function getType();     }      They say that this is 'not going to get us anything important' and it is 'too complex' and 'will be difficult for new developers to pick up.' I respectfully disagree, and there I end my context to begin the broader questions. So the question is about my OOP, are there any guidelines I should know:   1. _is_ this too complicated/too much OOP? Not that I expect to get more than 'it depends, I'd have to see if...'   2. when is OO abstraction too much?   3. when is OO abstraction too little?   4. how can I determine when I am overthinking a problem vs fixing one?   5. how can I determine when I am adding bad code to a bad project?   6. how can I pitch these APIs? I feel the other devs would just rather say 'its too complicated' than ask 'can you explain it?' whenever I suggest a new class.


title: Is it OK to let invalid arguments slip to another method?

text: For example lets take this method:               public List<string[]> ReadAll(int listCapacity)     {         List<string[]> list = new List<string[]>(listCapacity);              while (Read())         {             list.Add(GetCurrentRow());         }              return list;     }      If `listCapacity` is less than zero, an `ArgumentException` will be thrown by the constructor of `List<T>`. Does it make sense to double check this? Passing the argument to `List<T>` immediately seems careless, but checking it seems silly because `List<T>` will definitely check it. Important note: the code snippet is not just a copy-paste method, its part of a full utility.


title: Any good hackathons/competitions to refresh my programming skill?

text: I spent this summer as a PM, so my programming skills may have gotten a little rusty. I want to refresh those skills, and I'm looking for things like online hackathons or competitions. Preferably ones that happen every week or day so I can practice often. Where should I look ?


title: Are UML class diagrams adequate to design javascript systems?

text: Given that UML is oriented towards a more classic approach to object orientation, is it still usable in a reliable way to design javascript systems? One specific problem that I can see is that class diagrams are, in fact, a structural view of the system, and javascript is more behaviour driven, how can you deal with it? Please, keep in mind that I'm not talking abot the real world domain here, It's a model for the solution that I'm trying to achieve.


title: Starter BOOKS On Data Analytics and Algorithms in Computer Science

text: Am Programmer cum Co-Founder of Start-up,Am a computer Science Graduate though am not good at Algorithms,I want to learn and sharp that side.Please suggest me some nice books for starters and Advance Level.


title: Link between tests and user stories

text: I have not see these links explicitly stated in the Agile literature I have read. So, I was wondering if this approach was correct: Let a story be defined as _"In order to [RESULT], [ROLE] needs to [ACTION]"_ then   1. _RESULT_ generates system tests.   2. _ROLE_ generates acceptance tests.   3. _ACTION_ generates component and unit tests. Where the definitions are the ones used in xUnit Patterns which to be fair are fairly standard. Is this a correct interpretation or did I misunderstand something?


title: Should we use JavaScript and CGI variables to weed out bots from our visitor reports?

text: I am using ColdFusion 8 and jQuery 1.7. ** This is a programming question, because the solution I am questioning requires programming. It may not be the right solution to the problem, but if it is, then I need to figure out how to best program the concept. ** When a user comes to our site, we track their session by writing various CGI variables to a database using a CFC and stored procures. First we filter out non human traffic by keywords in the user agent such as "bot". Unfortunately a lot of bots and spammers mask their user agents. Later, we try to exclude from our visitor reports the bad bots and a few other known entities that are scraping pages and such. But this is a manual process. We are considering using an additional/alternate method of tracking usage. Once the user's page loads, we will use JavaScript to send the CGI variables from the client back to our server and store them. Specifically, we'll write the server variables to JavaScript on each page and then have JavaScript send them right back to us. If a bot or user doesn't fully view the page or have JavaScript enabled, the usage won't be counted is a real user. Correct me if I am wrong, but this is the same method that Google Analytics uses to track user behavior. Our goal is to eliminate good and bad bots from being counted as visitors in our reports. Does using JavaScript on a page like this minimize bots being counted? Is there a gaping hole in this plan?


title: Rights and use of developed software

text: I have been working on a piece of software for a company, that they wish to resell. There was an mail-based agreement upon a flat hourly rate for my work, and eager me chose to accept a rather low fee. Due to the stress and tempo of the task, a direct contract was never formed or signed. The software was developed locally on my machine, and I was pretty much alone with it, except by excellent help from StackOverflow when I got stuck. Now, the software is nearing completion, I suddenly hear that they have hired a new developer to make the same piece of software as me, and that I was expected to resign within long. Confused I ask around, and realize that the CEO of the company had informed the rest of the company that I was terminally ill and had cancer, and was expected to leave the company soon. Since I'm perfectly healthy, this confused me even more, until I realized what was going on. When I confronted my boss with this, I was no longer seen as a member of the company, and I left the same day, never to return. Later, I raised the question about my missing pay, since I had been working for quite a bit, and not received any payment for my software. I saw that they had already sold a fair copy of my software, and since it's not exactly sold cheap, the company should have plenty of gold to pay me. The company refused, and said that they owned the software, and everything it contained. That was a lot of drama, but my question is this: **Who has the rights to the software ?** The source code had my personal watermarks and copyrights inprinted, but they have since simply deleted it. The company claim that they have all the rights, because they have a website made about the product, where they write that they have "All rights reserved" in the bottom. My instinct tells me that if a company buys a service like this, and then refuses to pay their developer, then they should not be allowed to keep, and much less resell the product. I have not signed any agreements about giving the company the use of this product, I have made it in my own time and without help from the rest of the company. This all takes place in Denmark, Europe, but I would guess that the rules about this is somewhat universal. Im not the strongest person to legal-talk, so I might be wrong.


title: best and most used algorithm for finding the primality of given positive number

text: When I was in college and as a programming language learner I wrote program for finding out prime numbers but then I never mind the program performance in terms of speed. Now after long time just started solving the problems from projecteuler.net. Now I wonder is there any best and most used algorithm for finding the primality of a given positive number which produces the result fast? Thanks


title: What specifications in software development are relevant to the clients?

text: Say your company develops software, and a client wants you to handle their development. It just so happens, that they have their own IT-team, but it is fully tied up, so they outsource to you. The project is in a quotation phase, and your client's Head of IT now asks for a requirement specification (SRS), an architectural specification, and so on. The Head of IT wants to know functions, modules and other decisions that will be in construction. Other than the SRS for analysis, is your company obliged to provide these specifications, even before the project has been confirmed?


title: Sending e-mail from a web application without being filtered out

text: For a web application I'm working on right now it's very important that automated e-mails arrive at the recipient. I've set up the mail server on the VPS that the application is going to run on. I've taken all the regular precautions to make sure that the e-mails it sends are not going to be filtered out: SPF, DKIM, e-mails have both a plain text and html part, html part is valid html etc. etc. Still some services - in particular Microsofts outlook.net addresses - either block the message or automatically mark it as junk mail. I've read up a little on how Microsoft determines if a message is junk and in our case it's most likely the reputation of the mail server. Since it's a new server it doesn't have any reputation yet. How do other developers deal with this type of problem? Do you use external SMTP services like Google Apps to send mail from your application? Any ideas or tips?


title: Is there such thing as an example driven parser generator or ad-hoc DSL development?

text: I'm intrested to know if there exists a tool that lets you input examples of valid documents and lets you then generalize from that to a reusable parser. I can imagine this, but everytime i start learning about parsers it gets to the granularity of something like lex and yacc and it seems more complicated than my instincts say it should be. So I'm left wondering if   * a) it's just fundamentally that complicated and I need to see it or    * b) there's a way to build ad-hoc DSLs for relatively simple tasks that I could learn about Update: a simple example of an "ad hoc" dsl i might like to make quickly. Instead of the XML               <foo>       <item>bar</item>       <item>bat</item>     </foo>      I might want something like:               foo       bar       bat        * lines contain data items   * indentation produces parent-child relations My imaginary tool lets me convey the above information. Then, in my imaginary tool, I might highlight "foo" above and right click, at which point it would prompt me to restrict the values to a choice list.... Then I might extend the first one to:               foo       bar(5)       bat        * in a line, '(' and ')' surround a sub item The above might be qualified with a boolean value that specifies recursion or not, if set to true then bar(lala(4)) might work... This is the kind of train of thought I generally have that led me to ask the question. It's possible that now I've qualified it, the answer changes - if so I apologize in advance.


title: Is there a good Cognitive Architecture for implementing intelligent software agents?

text: So, I like dabbling in intelligent agent design (mainly video-game 'bots' but also some general task automation), but as a budding psychologist, I'd be really interested in a platform for developing such agents in a cognitively plausible setting. Such a platform would probably take the form of a cognitive architecture, but since these are meant to be implementations of psychological theories above all else, I'm worried that none of them are up for actually acting as an intelligent agent in a complex software environment like a video-game. Has anyone tried using such an architecture to produce an agent of the kind I've been describing? Failing that, do any cognitive architectures look particularly suitable for this sort of job? My current hunch is that a hybrid architecture like CLARION might work, but not having any experience with it, I'm still hesitant. I know that SOAR has famously been used to simulate a fighter pilot, but that took years of hand-coding production rules, and thus seems like an impractical platform from my standpoint.


title: Single Responsibility Principle Implementation

text: In my spare time, I've been designing a CMS in order to learn more about actual software design and architecture, etc. Going through the SOLID principles, I already notice that ideas like "MVC", "DRY", and "KISS", pretty much fall right into place. That said, I'm still having problems deciding if one of two implementations is the best choice when it comes to the Single Responsibility Principle. Implementation #1:               class User         getName         getPassword         getEmail         // etc...          class UserManager         create         read         update         delete          class Session         start         stop          class Login         main          class Logout         main          class Register         main      The idea behind this implementation is that all user-based actions are separated out into different classes (creating a possible case of the aptly- named Ravioli Code), but following the SRP to a "tee", almost literally. But then I thought that it was a bit much, and came up with this next implementation               class UserView extends View         getLogin //Returns the html for the login screen         getShortLogin //Returns the html for an inline login bar         getLogout //Returns the html for a logout button         getRegister //Returns the html for a register page         // etc... as needed          class UserModel extends DataModel implements IDataModel         // Implements no new methods yet, outside of the interface methods         // Haven't figured out anything special to go here at the moment         // All CRUD operations are handled by DataModel          //   through methods implemented by the interface          class UserControl extends Control implements IControl         login         logout         register         startSession         stopSession          class User extends DataObject         getName         getPassword         getEmail         // etc...      This is obviously still very organized, and still very "single responsibility". The `User` class is a data object that I can manipulate data on and then pass to the `UserModel` to save it to the database. All the user data rendering (what the user will see) is handled by `UserView` and it's methods, and all the user actions are in one space in `UserControl` (plus some automated stuff required by the CMS to keep a user logged in or to ensure that they stay out.) I personally can't think of anything wrong with this implementation either. In my personal feelings I feel that both are effectively correct, but I can't decide which one would be easier to maintain and extend as life goes on (despite leaning towards Implementation #1.) So what about you guys? What are your opinions on this? Which one is better? What basics (or otherwise, nuances) of that principle have I missed in either design?


title: GPL- How much source must be released?

text: Suppose I have a GPL v2-licensed library that is of interest to a closed- source project (e.g. Wolfram Alpha). If some of my code were used in Wolfram Alpha, or a product that interfaces with Wolfram Alpha, would they have to release all of their code for Wolfram Alpha under the GPL v2 license?


title: How to stop switching between keyboard and mouse

text: I touch-type since several years, but very often I need to switch between different applications. For text editing I don't need the mouse, but as soon as I need a web browser, I switch to the mouse. I guess I loose a lot of time and energy doing this. Since I do web development I often switch between keyboard and mouse. Do you have a working solution? Please don't tell me about browser plugins you have never used yourself. Thank you.


title: DataMapper for a MMO game plugin to send packets

text: I am working on an plugin for some game-server. The information about the plugin is not really necessary. _Few points you might find helpful to answer to this question:_ **The server** The server is programmed very badly. The whole design structure and how it handles things, therefore I cannot implement anything that will need to make me change how the server handles packets. The server has a list of all "being-sent" packets, and **sends them to the client every 600ms** So basically, the client is being updated every 600ms if there are incoming packets from the server. **My plugin** My plugin needs to update a few UIs of the client, such as new player names, change the current opened interface window, and so on. I can use a `DataMapper` class, which contains the object which has ability & access to add new packets to the list (it's not really a list; it's just a list of bytes and frames). Now look at this _dummy_ snippet (Note - this is not my plugin, but just a simple example of what I mean):               public class MyPluginPlayer {              private DataMapper mapper;         private int state;              public void setState(int state) {             this.state = state;         }              public void getState() {             return this.state;         }              public void selectWindowForState() {             if (this.state == 5) {                 mapper.createLongWindow();             }             else if (this.state == 4) {                 mapper.createWideWindow();             }             // .... etc ....         }     }      In my _dummy_ example, `MyPluginPlayer` is the lass which is responsible to handle business logic for the player that is part of my plugin, let's say my plugin is a small mini-game, like a cards game. So basically, imagine there is a manager class, which contains a List of `MyPluginPlayer` objects, and it loops through them all and works them out, setting the current state, and then calls `selectWindowForState()`. `selectWindowForState()` method basically reads all possible states, and then reads which state is the current state, and then calls the suitable method in the `DataMapper`, to send the right packet. The `DataMapper` class basically does all the dirty work such as creating new packet frame, writing the bytes, `int`s and whatever that is needed for the specific packet. **The problem** I call the use of `DataMapper` above bad, because I don't feel like the domain class should really have direct access to the `DataMapper`. I thought of making a `Queue` list and instead of calling `mapper.createWideWindow()` or whatever, it will add the action to the queue list, and then the `DataMapper` will access that list, and process all these packets to the server's global outgoing packet list. The `DataMapper` will do that at the end of every loop cycle that's done in the manager class.               for (Player p : players) {         MyPluginPlayer domain = p.getDomain();         // ...... management ..... //              p.getMapper().update(); //goes through the Queue list and adds all packets to the server outgoing packets     }      But I am not really sure on how to define these packet updates. The only method I can think of is, every packet will have an own class which implements an interface. But I will need to create a class for each packet, and I don't really like the design of many many classes for a small thing. What do you think of both of these methods? Could you suggest something better?


title: What advantages switching to ruby might give me as a python programmer?

text: This is my first question on stackoverflow, so please bear with me. I'm trying to stay away from any form of trolling or flame baiting as i have a tremendous respect for both languages. I'm a python programmer (though not an expert) and i love it. My first language was C++. My line of work (web development) is pushing me towards other languages like php and javascript. Recently, I've been very excited by Ruby's increasing popularity. However I used to be under the impression that Python and Ruby were so close that there was little point in trying to learn and master both. But I get the sense that I was wrong, hence my question : I'd like to hear from python programmers who have either switched entirely to ruby or added ruby to their toolset. What specific benefits did you get from switching (entirely or partially) to Ruby from Python ? Ideally I'd like to hear from real world experiences.


title: Java for loop: why can't I declare two variables in the for loop 'header'?

text: I always wondered, why doesn't this compile?               for(int i=0, int q=0; i<a.length; i++){        ...     }      Why doesn't Java allow me to declare more than one variable in the for loop 'header'? Is there a logical reason behind this?


title: The age-old question about beginning programming hasn't been answered for me

text: I've been wanting to learn how to program for years but thus far, every book and video has gotten over head very quickly. I eventually want to learn C# for both Windows software development and game development (Unity3D to be specific - it's a game engine that uses C#). I know absolutely nothing about programming/scripting, other than generally what can be achieved. I've been a web developer for years and know HTML very well, CSS semi-well, and Javascript not at all. I'm a pro at breaking scripts. :) I've sort of shifted away from web development and want to focus on learning programming itself. It's like a vicious cycle for me - every 6 months or so I get into the "Ok I'm prepared to learn" phase, find a tutorial or book, get overwhelmed, then give up. I'm writing this just after I saw a video series about C# fundamentals, but after 3 videos I was completely lost. It's like they all mention a concept like conditional strings, breeze over it, then assume you understand it. Although C# is the end-goal, is it worth learning an easier language like VB as a complete and utter novice at first? I know there's not a ton of difference and learning new languages gets easier and easier as it's mostly about syntax, but I feel like I can't wrap my head around even the most basic of concepts as a foundation. For example, I know exactly what I want a program to do and when I explain it to a programmer they normally code it very quickly. If I could write it in plain English I could do it myself. :) Should I keep trying to learn C# or should I delve into another language to get more of a basic understanding of coding itself then transition to it? Every house needs a foundation but I feel like I can't even grasp how concrete is made when building it.


title: To find the oldest/newest element in a heap

text: I want to find the oldest/newest element added into a heap of size k. At any given point of time if I have to find say the oldest element in the heap is there any approach with O(1) space and O(1) time. I was thinking of an approach of having a queue of the same size as that of the heap and add all the element into the queue as they are added to the heap. This yields a constant time solution but this requires an extra O(k) space. I would like to know if this problem can be solved with constant space.


title: Should I give the answer to a failed interview coding exercise?

text: We had a senior level interview candidate fail a nuance of the FizzBuzz question*. I mean, really, utterly, completely, failed the question - not even close. I even coached him through to thinking about using a loop and that `3` and `5` were **really** worth considering as special cases. He blew it. Just for QA purposes, I gave the same exact question to three teammates; gave them 5 minutes; and then came back to collect their pseudo-code. **All of them** nailed it and hadn't seen the question before. Two asked what the trick was... On a different logic exercise, the candidate showed some understanding of some of the features available within the language he chose to use (C#). So it's not as if he had _never_ written a line of code. But his logic still stunk. My question is whether or not I should have given him the answer to the logic questions. He knew he blew them, and acknowledged it later in the interview. On the other hand, he never asked for the answer or what I was expecting to see. I know coding exercises can be used to set candidates up for failure (again, see second link from above). And I really tried to help him home in on answering the core of the question. But this was a senior level candidate and Fizz-Buzz is, frankly, ridiculously easy even with accounting for interview jitters. I felt like I should have shown him a way of solving the problem so that he could at least learn from the experience. But again, he didn't ask. What's the right way to handle that situation? * * * * _Okay, that's not the link to the actual FizzBuzz question, but it is a good P.SE discussion around FizzBuzz and links to the various aspects of it._ _Footnote 2_ : To help clarify, this is the nuance of Fizz-Buzz I asked and it's from Project Euler's first problem. Substitute printing Fizz | Buzz for summing the numbers and you have the same fundamental question. `If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.   Write a function that finds the sum of all the multiples of 3 or 5 below 1000.` _Footnote 3_ : This question attracted more attention than I had expected, and I appreciate all of the replies. Some of the later answers have really gotten to the core of my question, so I'll allow the community to review and up-vote before assigning "the" answer. _Footnote 4_ : I selected "the" answer based upon community votes at that point in time. And I think Yannis' answer is appropriate for interviews with newer devs. I think the collective response focusing on the lack of asking for the answer is spot-on as well.


title: What is meaning of the term "Sans" in a class name?

text: I was reading code of a java project where I found a class name like "UserSansXml". This class is dealing with user objects. I wanted to know the meaning of "sans".


title: Java Cryptography Extension

text: I was told that in order to support AES256 encryption inside my Java app that I would need the JCE with Unlimited Strength Jurisdiction Policy Files. I downloaded this from Oracle and unzipped it and I'm only seeing 2 JARs:   * `local_policy.jar`; and   * `US_export_polic.jar` I just want to confirm I'm not missing anything here! My understanding (after reading the `README.txt`) is that I just drop these two into my `<JAVA_HOME>/lib/security/` directory and they should be installed. By the names of these JARs I have to assume that its not the Java Crypto API that cannot handle AES256, but it's in fact a **legal** issue, perhaps? And that these two JARs basically tell the JRE " _yes, it's legally-acceptable to run this level of crypto (AES256)._ " Am I correct or off-base?


title: C simple arrays and pointers question

text: So here's the confusion, let's say I declare an array of characters               char name[3] = "Sam";      and then I declare another array but this time using pointers               char * name = "Sam";      What's the difference between the two? I mean they work the same way in a program. Also how does the latter store the size of the stuff that someone puts in it, in this case 3 characters? Also how is it different from               char * name = new char[3];      If those three are different where should they be used I mean in what circumstances?


title: How much time should jquery wait?

text: I'm programming a jQuery functionality for doing a search on articles while the user is typing in the search field. I implemented a bind in jQuery that at every `keyup`, it sets a `clearTimeout` and a `setTimeout` to the actual function doing the `post` to the server. This is because users can be writing something and I want to avoid multiple `post`s. I got "stuck" with: from the user interface point of view, what time should I set for the `setTimeout`? I tried different times (1s, 1.5s, 0.5s) but I have to admit the choice seems kind of random to me. This raised the broader question: Is there any reference or study that answers the question of what are the "optimal" times for dynamic web interfaces? I only now noticed that I've used more timers before (e.g. slides), that were also chosen "randomly". Putting in other terms, does anyone knows how to _justify_ why a given event in web interface has (or should have) a specific delta-time or range of delta- times? (I'm sorry if this question is not adequate to here, It seemed to me closer than SO.)


title: Why using FMOD?

text: I'm creating a music player using C++ and QT, everyone says use FMOD. But QT has all the components, I can play audio, create playlist, and everything i need, so what does FMOD offer me, that can't be done with QT? I did some research, here and here and here, and so many other results; in fact if you just google _"create music player"_ you get _"use fmod and qt as GUI"_.


title: Best practices for team workflow with RoR/Github for designer + coder?

text: My friend and I have started to try to collaborate on some projects. For background, I come from a PHP/Wordpress/Drupal coding background, but recently I've become more experienced with the RoR framework, while he is more experienced as an HTML/CSS designer, working with PHP and WordPress. We're both relatively new to RoR I think, and so we're trying to figure out our collaborative workflow, but we have no idea where to start. For instance, we were trying to figure out how he could do some minor edits to the CSS file without having to do a full RoR deploy on his box. We still haven't figured out a solution, so I think it's best if we start to set some sort of workflow based on best practices. I was wondering if you guys have any insight or links to articles/case studies regarding this topic?


title: Java regex patterns - compile time constants or instance members?

text: Currently, I have a couple of **_singleton_** objects where I'm doing matching on regular expressions, and my `Pattern`s are defined like so:               class Foobar {       private final Pattern firstPattern =         Pattern.compile("some regex");       private final Pattern secondPattern =         Pattern.compile("some other regex");       // more Patterns, etc.       private Foobar() {}       public static Foobar create() { /* singleton stuff */ }     }      But I was told by someone the other day that this is bad style, and `Pattern`s should **always** be defined at the class level, and look something like this instead:               class Foobar {       private static final Pattern FIRST_PATTERN =         Pattern.compile("some regex");       private static final Pattern SECOND_PATTERN =         Pattern.compile("some other regex");       // more Patterns, etc.       private Foobar() {}       public static Foobar create() { /* singleton stuff */ }     }      The lifetime of this particular object isn't that long, and my main reason for using the first approach is because it doesn't make sense to me to hold on to the `Pattern`s once the object gets GC'd. Any suggestions / thoughts?


title: Finding the order of a set's elements

text: A little rephrased, in the form of a game, real-life problem: Suppose there is a set of elements {1, 2, ..., n}. Player A has chosen a single permutation of this set. Player B wants to find out the order of the elements by asking questions of form "Is X earlier in the permutation than Y?", where X and Y are elements of the set. Assuming B wants to minimize the amount of questions, how many times would he have to ask, and what would be the algorithm?


title: How to Implement a Parallel Workflow

text: I'm trying to implement a parallel split task using a workflow system. I'm using .NET but my process is very simple and I don't want to use WF or anything heavy like that. I've tried using Stateless. So far is was easy to set up and run, but I may be using the wrong tool for the job because I'm not sure how you're supposed to model parallel split workflows, where you have multiple sub-tasks required before you can advance to the next state, but the steps don't require being performed in any particular order. I can easily use the dynamic configuration options to check my data model manually to see if the model is in the correct state (all sub-tasks completed) and can transition to the next state, but this seems to completely break the workflow paradigm. What is the proper, orthodox way to implement a parallel split process? Thanks


title: Structural pattern for an unconventional use of a database

text: I'm writing a game client as a personal project and using using it as a vehicle to learn about Java database access, specifically Neo4j, and possibly Spring Data Neo4j if I decide it's appropriate. I'm well aware that my application is a bit unconventional, and this has raised questions that are hard frame narrowly. I hope this question is appropriate for this site. Maybe the best way to ask this is to first explain what I'm thinking of doing and why. My main reason for incorporating a database is persistence, not queryability. Because reaction times are critical, my plan is for the primary model of the game state to be an in-memory POJO graph. I want to update the persistent database in an asynchronous, eventually-consistent way. If I understand correctly, this is the reverse of most database applications, in which the database is authoritative and the in-memory data is just a snapshot copy. Is there a name for this pattern? If you've written something like this, what are some of the pitfalls I may encounter? Is it naive to even try this?


title: Business rule to display data in all uppercase - how to handle?

text: Part of a system I am working on manages some securities information (stocks, bonds, etc...) and business rules specify certain fields be displayed only in all CAPS (stock symbols and CUSIPs for example). Users will have to look at data displayed on the screen as well as perform create/edit data-entry operations. Where is the best place to deal with this? _1\. Presentation layer only_ user enters "ibm" as stock symbol, stored in database as "ibm", converted to uppercase when displayed in app ("IBM") _2\. Convert to CAPS before storing in DB_ user enters "ibm", model class converts to uppercase and sends to database, stored as "IBM" Something like a custom setter:               private string _StockSymbol;     public string StockSymbol     {         get { return _StockSymbol; }         set          {             if (value != null)                 value = value.ToUpper();             _StockSymbol = value;         }     }      _3\. Convert to CAPS at DB_ user enters "ibm", database insert query converts to "IBM" (for example, using the `UPPER` function in SQL) The end result is the same for the users - they see their data in all CAPS and the system doesn't care if their data input is in the proper case or not. The most "MVC compliant" answer seems to be #1, but if this data will never be used in any other format other than all CAPS, I would argue it should be validated as such before being stored in the database. That then becomes more of a controller or view model concern, right? I've heard people speak about accomplishing this client-side with Java (and even CSS), but that seems like a very poor solution. I think the question is language/system-agnostic, but if it matters, I'm using MS SQL with Entity Framework/ASP.Net MVC. What I'm scratching my head over is whether or not a presentational business rule like this should influence how the data is stored in the DB (CAPS vs no CAPS). The application doesn't care if the stock symbol IBM is input as "iBm" or "ibM" but it seems wrong to store the data like that (it will only ever be used/displayed in CAPS). Would you consider this a data validation issue to be handled at the controller/model level, or a presentational detail to be handled only at the view?


title: Make Return Type an Interface - Problem with Initialization

text: I would like to make the return type of my method an interface rather than a class for similar reasons stated in c# List or IList, however I am having trouble figuring out how to initialize the interface to return it. I cannot use `new IA()` and `(IA) new A()` does not work as I cannot cast the result to `B`.               interface IA{}        class A: IA{}     class B: IA{}          class UseIA     {       public IA DesiredMethod()       {         return ???;// new IA()       }       public A UndesiredMethod()       {         return new A();       }     }


title: storing map template in database

text: I am working on an application that displays choropleth maps. These maps are of all different types, some display state by county, country by state/province, or world by country. How should I handle storing the map information in the database? **My Thoughts:** I won't need to do queries to find POI inside a region, so I don't think there is a need to use spatial datatypes. I am considering storing a map as a geoJSON object (I am using JS mapping library that accepts geoJSON). The only issue is what if I want a map of the US northeast. Then I would have geoJSON for the US and a separate one for the US northeast, which would be redundant. Would it make sense to have a shape database where I had each state then when I needed a map of the US I could query for each state, and when I needed a map of the US Northeast I could again query for what I need? **Note** : I am not concerned with storing the data for each region, just the region itself. I will query for the data on the fly for the specific region.


title: Configuration data: single-row table vs. name-value-pair table

text: Let's say you write an application that can be configured by the user. For storing this "configuration data" into a database, two patterns are commonly used.   1. The _single-row table_                CompanyName  |  StartFullScreen  |  RefreshSeconds  |  ...     ---------------+-------------------+------------------+--------       ACME Inc.    |        true       |       20         |  ...        2. The _name-value-pair_ table                ConfigOption   |   Value     -----------------+-------------      CompanyName     | ACME Inc.      StartFullScreen | true (or 1, or Y, ...)      RefreshSeconds  | 20      ...             | ...      I've seen both options in the wild, and both have obvious advantages and disadvantages, for example:   * The single-row tables limits the number of configuration options you can have (since the number of columns in a row is usually limited). Every additional configuration option requires a DB schema change.   * In a name-value-pair table everything is "stringly typed" (you have to encode/decode your Boolean/Date/etc. parameters).   * (many more) Is there some consensus within the development community about which option is preferable?


title: What does cheap copying/branching mean for a versioning system like SVN?

text: One of the advantages of SVN over CVS as given here is **cheap copying and branching**. What does " _cheap copying and branching_ " mean in SVN parlance? How is it different from CVS copying and branching?


title: licensing a ' Sharepoint bug-Fix' to reserve it

text: My friend recently finished his personal work on a project that fixes a known bug in `sharepoint 2010`. The guy spent significant time\effort to reach this point   He consulted me on how to license this `fix` and asked if this possible and is it accepted for a such type of solutions! Actually I don't have any experiences in this area, especially that he is willing to start selling the `fix` and don't want to be lost in the market P.S.: his current location is U.A.E TIA.


title: DI and hypothetical readonly setters in C#

text: Sometimes I would like to declare a property like this:               public string Name { get; readonly set; }      I am wondering if anyone sees a reason why such a syntax shouldn't exist. I believe that because it is a subset of "get; private set;", it could only make code more robust. My feeling is that such setters would be extremely DI friendly, but of course I'm more interested in hearing your opinions than my own, so what do _you_ think? _I am aware of 'public readonly' fields, but those are not interface friendly so I don't even consider them. That said, I don't mind if you bring them up into the discussion_ **Edit** I realize reading the comments that perhaps my idea is a little confusing. The ultimate purpose of this new syntax would be to have an automatic property syntax that specifies that the backing private field should be readonly. Basically declaring a property using my hypothetical syntax               public string Name { get; readonly set; }      would be interpreted by C# as:               private readonly string name;     public string Name     {         get         {             return this.name;         }     }      And the reason I say this would be DI friendly is because when we rely heavily on constructor injection, I believe it is good practice to declare our constructor injected fields as readonly.


title: How do I get from a highly manual process of development and deploy to continuous integration?

text: We have a development process which is completely manual. No unit tests, interface tests are manual, and merging and integration are as well. How could we go from this state to implementing continuous integration with full (or at least close to full) automation of build and test? We have a pretty intense development cycle, and are not currently using agile, so switching to agile with CI in one move would be a very complicated and expensive investment. How can we take it slowly, and still moving constantly towards a CI environment?


title: Smartphones and tablets for testing

text: In my work I have started development of a website/webapp that will be viewed primarily on smartphones and tablet. I have now been given the task of buying the necessary hardware for testing the webapp. As I'm not really a mobile-nerd, I'm not really up to date with the latest and greatest on the mobile market. So I need some advice on which units to buy. Some initial thoughts   1. I would like to cover the browsers in the most common systems; iOS, Android and Symbian? (are there any more I should know about?).   2. I would like each browser in both Phone size and tablet size. iPhone and iPad seems like a given choice, but after that my knowledge is limited. I hope this is in the realms of this site, feel free to move this question to another SE site if this question fits better somewhere else. Thanks in advance! **Edit:** In this scenario there aren't really any customer who can pay, this is an app that shall be used by our customers but is developed on our own initiative. Secondly, I get the feeling that for example the iPhone simulator uses the safari desktop browser for rendering the content (am I wrong?), if that is the case, how does it cope with the slight defferences in the desktop version and the phone version (for eaxample videos not being able to autostart on the phone and stuff like that). I can be totally wrong here, just raising the question.


Is there ever a reason to use C++ in a Mac-only application? I not talking about integrating external libraries which are C++, what I mean is using C++ because of any advantages in a particular application. While the UI code must be written in Obj-C, what about logic code? Because of the dynamic nature of Objective-C, C++ method calls tend to be ever so slightly faster but does this have any effect in any imaginable real life scenario? For example, would it make sense to use C++ over Objective-C for simulating large particle systems where some methods would need to be called over and over in short time? I can also see some cases where C++ has a more appropriate "feel". For example when doing graphics, it's nice to have vector and matrix types with appropriate operator overloads and methods. This, to me, seems like it would be a bit clunkier to implement in Objective-C. Also, Objective-C objects can never be treated plain old data structures in the same manner as C++ types since Objective-C objects always have an isa-pointer. Wouldn't it make sense to use C++ instead in something like this? Does anyone have a real life example of a situation where C++ was chosen for some parts of an application? Does Apple use any C++ except for the kernel? (I don't want to start a flame war here, both languages have their merits and I use both equally though in different applications.)


title: Under what circumstances should error messages be presented to the user?

text: Should error messages ever be presented to an end user and if so what rules or advice should you have about what should be in them?


title: How to keep a team well-trained?

text: I'm currently mentoring a small team of 4 junior dev in small software company. They are very smart and often achieve their tasks with a high-quality job but I'm sure they still can do better - actually I have exactly the same feeling for myself :) -. Besides some of them are more "junior" than other. So I would like to find of a funny way to improve their CS skills (design, coding, testing, algorithmic...) in addition to the experience they acquire in their daily work. For instance, I was thinking of setting up weekly sessions, not longer than 2 hours, where we could get together to work on challenging CS exercises. A bit like a coding dojo. I'm sure the team would enjoy that but is it really a good idea? Would it be efficient in a professional context? They already spend all their week to code so how should I organize that in order for them to get some benefits? Any feedback welcome !


title: To integrate git versions as build numbers or not?

text: A colleague and I have been taking turns debating/discussing the issues/merits of integrating a version derived from the current git repository into our code whenever it builds. We think the merits include:   * No need to worry about human error in updating a version number   * Traceability between what we find in a device and the source code it was derived from The issues that have arisen (for us) include:   * IDE derived build systems (e.g. MPLABX) can make it hard to figure out where to put these kinds of hooks in (and it can end up pretty cheesy in the end)   * More work to actually integrate this into the build scripts/makefiles   * Coupling to a particular build approach (e.g. what if one person builds with XCode and the other MPLABX) may create downstream surprises So we're curious where others have landed on this debate. It's really easy for the discussion to become anecdotal. There are lots of people out there who are insistent on end-to-end automation, hang the amount of up front work and coupling it creates. And there are a lot of others on the other side of the debate, who just do the easiest thing that works and live with the risks. Is there a reasoned answer to which side is best to land on?


title: Why the sudden rise in popularity of Lua?

text: Does anyone know why the Lua progamming language has seen such a rise in popularity recently? I am going by the TIOBE ratings. http://www.tiobe.com/index.php/paperinfo/tpci/Lua.html I've used Lua in the past when I worked at a game development shop, but did not think it was used outside of that arena. Now it is the 11th most popular language according to TIOBE http://www.tiobe.com/index.php/content/paperinfo/tpci/index.html Has there been any recent activity or news that might have caused this sudden surge? Thanks! EDIT: I am particularly interested in the extreme increase over the last year as shown in this chart: ![Lua History](http://i.stack.imgur.com/krjpB.png)


title: Forbidding or controlling "Hidden IT..." Who should write and maintain ad-hoc software applications?

text: Bigger companies usually have the problem, that it is not possible to write all programs employees want (to save time and to optimize processes) due to a lack of staff and money. Then hidden programs will be created by some people having (at least some) coding experience (or by cheap students/interns...). Under some circumstances these applications will raise in importance and spread from one user to a whole department. Then there is the critical point: Who will maintain the application, add new features, ...? And this app is critical. It IS needed. But the intern has left the company. No one knows how it works. You only have a bunch of sources and some sort of documentation. Does it make sense to try and control or forbid application development done ad-hoc outside of the IT department (with the exception of minor stuff like Excel macros)?


title: How are Apache HTTP Server and Apache Tomcat related? (If at all)

text: I currently have Apache httpd running on a production Ubuntu VPS server. I write php scripts. I'm interested in learning Java and I was wondering how I would go about writing some server-side Java to work on my current set-up. How are _Apache Tomcat_ and _Apache HTTP Server_ related to each other? Can Tomcat be a module of httpd? Or are they simply just two very different projects that happen to be steered by the same organisation (Apache Software Foundation)?


title: Entry point to Mobile Computing

text: I'm a novice programmer who has just learnt some languages and want to experiment & sharpen my skills. I've learnt quite a few languages like C, C++, Python, VC++, Java. I want to learn to program on Mobile(Hand-held) devices.What would be the best way to start? Could anyone please suggest me from where to start? I have heard that I would have to work on Emulators, but googling it didn't help. I know that there are quite a few experienced programmers who could help me and show me the appropriate path. As you'll must have guessed by just reading my question that I don't have a perfect picture of what I want, so may be my question isn't Bang On!! ... Please Help


title: Is it appropriate to try to control the order of finalization?

text: I'm writing a class which is roughly analogous to a CancellationToken, except it has a third state for "never going to be cancelled". At the moment I'm trying to decide what to do if the 'source' of the token is garbage collected without ever being set. It seems that, intuitively, the source should transition the associated token to the 'never cancelled' state when it is about to be collected. However, this could trigger callbacks who were only kept alive by their linkage from the token. That means what those callbacks reference might now in the process of finalization. Calling them would be bad. In order to "fix" this, I wrote this class:               public sealed class GCRoot {         private static readonly GCRoot MainRoot = new GCRoot();         private GCRoot _next;         private GCRoot _prev;         private object _value;         private GCRoot() {             this._next = this._prev = this;         }         private GCRoot(GCRoot prev, object value) {             this._value = value;             this._prev = prev;             this._next = prev._next;             _prev._next = this;             _next._prev = this;         }         public static GCRoot Root(object value) {             return new GCRoot(MainRoot, value);         }         public void Unroot() {             lock (MainRoot) {                 _next._prev = _prev;                 _prev._next = _next;                 this._next = this._prev = this;             }         }     }      intending to use it like this:               Source() {         ...         _root = GCRoot.Root(callbacks);     }     void TransitionToNeverCancelled() {         _root.Unlink();         ...     }     ~Source() {         TransitionToNeverCancelled();     }      but now I'm troubled. This seems to open the possibility for memory leaks, without actually fixing all cases of sources in limbo. Like, if a source is closed over in one of its own callbacks, then it is rooted by the callback root and so can never be collected. Presumably I should just let my sources be collected without a peep. Or maybe not? Is it ever appropriate to try to control the order of finalization, or is it a giant warning sign?


title: Using Node.js with Heroku to make a chat server?

text: I currently have a goal of creating a sort of chat website. I just finished trying with PHP and long polling, which hit a resource limit on my webhost's server. I was told that I should use Node.js and that it can be hosted with Heroku. I honestly have very little understanding of what Node.js or Heroku are. From what I've been told and have read after looking this up is that you can install Node.js and run apps online with it. The tutorial here: http://www.jamesward.com/2011/06/21/getting-started-with-node-js-on-the-cloud/ goes over installing and executing a script on heroku with Node.js. I have NO experience with command line, and wouldn't be able to do anything but copy the exact commands in that tutorial. I also don't understand when he accesses the script with localhost if the app is supposed to be on Heroku. Can anyone explain what Heroku is, and provide some resources on how to use it? How can I work my way up to knowing how to use it?


title: What are the London and Chicago schools of TDD?

text: I’ve been hearing about the London style vs. Chicago style (sometimes called Detroit style) of Test Driven Development (TDD). Workshop of Utah Extreme Programming User's Group: > _Interaction-style_ TDD is also called _mockist-style_ , or _London-style_ > after London's Extreme Tuesday club where it became popular. It is usually > contrasted with _Detroit-style_ or _classic_ TDD which is more state-based. Jason Gorman's workshop: > The workshop covers both the _Chicago school_ of TDD (state-based behaviour > testing and triangulation), and the _London school_ , which focuses more on > interaction testing, mocking and end-to-end TDD, with particular emphasis on > _Responsibility-Driven Design_ and the _Tell, Don't Ask_ approach to _OO_ > recently re-popularized by Steve Freeman's and Nat Pryce's excellent > _Growing Object Oriented Software Guided By Tests_ book. The post **Classic TDD or "London School"?** by Jason Gorman was helpful, but his examples confused me, because he uses two different examples instead of one example with both approaches. What are the differences? When do you use each style?


title: Practical size limits of a Hashtable and Dictionary in c#

text: What are the practical limits for the number of items a C# 4 Dictionary or Hashtable can contain and the total number of bytes these structures can reasonable contain. I'll be working with large numbers of objects and want to know when these structures start to experience issues. For context, I'll be using a 64 bit system with tons of memory. Also, I'll need to find objects using some form or 'key'. Given the performance demands, these objects will need to reside in memory, and many will be long-lived. Feel free to suggest other approaches/patterns, although I need to avoid using third-party or open-source libraries. For specification reasons, I need to be able to build this using native C# ( _or C++\CLI_ ).


title: Hooking up a Business Layer and Repository using Unit of Work Pattern

text: I am having a bit of trouble explaining precisely the question I have here so bear with me. it is similar to the unanswered question found here: http://stackoverflow.com/questions/5580651/what-is-the-correct-way-to-use- unit-of-work-repositories-within-the-business-laye Apologies if this is too rambling. Scenario: \+ .Net solution \+ IRepository used to retrieve objects from DB \+ IUnitOfWork used to allow transactions across multiple repositories This makes sense to me and I have implemented something along these lines that works fine. Now I want to introduce a business logic layer and am having trouble organising the three elements (BLL, UnitOfWork and Repository) in my mind. My understanding: \- Repository - data retrieval, manipulation \- UnitOfWork - persistence \- BLL - logic relevant to the business ('real world') (dislike that term!) Consider we have an ASP.Net MVC front end. I guess the question is: what does a BLL look like and what does the MVC controller that uses it look like? For reference: I wonder if perhaps my IUnitOfWork/IRepository implementation might be the underlying cause of my confusion.               public class IRepository<T>      {         private IObjectSet<T> objSet;         public IRepository<T>(IUnitOfWork uow)         {             objSet = uow.CreateObjectSet<T>();         }              public IQueryable<T> Add(T entity)         {             objSet.Add(entity);         }         //etc. etc. for delete, attach, getall     }      So I feel like if I have a BLL, I should be passing it the IUnitOfWork, so that it can use that to create the IRepository instances that it needs. But how will the BLL (separate DLL from the front end) 'know' what implementation of IRepository to build?


title: How do I get over my .NET hump?

text: I've been teaching myself how to write code with the help of a very talented friend, who unfortunately is talented enough that he has never free time. I've read and worked out of a couple books, but I feel more like I'm going through motions, rather than elegantly solving real world problems. What did you guys do to get out of your larval stage? Is there a course or educational product out there that isn't quite the $1500 all encompassing lecture, but more than just a dry,"regurgitate this example," type book?


title: Leaving a contract from a recruiter for a permanent position

text: So after months of searching, I finally get an offer. It's a contract position through my recruiter. Then all of a suddenly I get another offer from one of the MAJOR software engineer companies. I already accepted my position at the first place, but this other offer gives me so much more money and it has benefits. Can I leave the contract from my recruiter to go to this other company?


title: Is this an example of a pattern or an algorithm?

text: I feel like I have a reusable "something" here and I'm not sure whether to think of it as a pattern or an algorithm (or neither). It's characterized by having an unknown amount of work to accomplish a task because the subtasks can encounter various conditions which cause them to add "Issues" to a global queue. Then, the command is run repeatedly coupled with a round of "Issue Fixing" until either there are no issues left or the number of issues does not change. I'm just putting enough code here to show what I'm talking about - there's a bit more to it (let me know if I should post more).                       public void FindNewCampaigns()             {                 var findNewCampaigns = Locator.Get<ICommand<IEnumerable<Campaign>>>("FindNewCampaigns");                 var campaigns = findNewCampaigns.Execute();                 var issues = Locator.Get<ICollection<Issue>>("CommandIssues");                 while (issues.Count > 0)                 {                     int before = issues.Count;                     FixIssues(issues);                     issues.Clear();                     campaigns = findNewCampaigns.Execute();                     int after = issues.Count;                     if (before == after)                     {                         System.Console.WriteLine("No issues got fixed, quitting ({0}/{1}).", before, after);                         break;                     }                 }                 if (issues.Count == 0)                 {                     CreateCampaigns(campaigns);                 }             }                  private void FixIssues(ICollection<Issues.Issue> issues)             {                 foreach (var issue in issues)                 {                     System.Console.WriteLine("ISSUE: " + issue.GetType().Name + " - " + issue.ToString());                          if (issue is AdvertiserDoesNotExist)                     {                         var specificIssue = (AdvertiserDoesNotExist)issue;                         var command = Locator.Get<ICommand<string, DirectAgents.SynchService.Model.EomDatabase.Advertiser>>("CreateAdvertiser");                         command.Execute(specificIssue.AdvertiserName);                     }                     else if (issue is AccountManagerDoesNotExist)                     {                         var specificIssue = (AccountManagerDoesNotExist)issue;                         var command = Locator.Get<ICommand<string, DirectAgents.SynchService.Model.EomDatabase.AccountManager>>("CreateAccountManager");                         command.Execute(specificIssue.AccountManagerName);                     }                     else if (issue is AdManagerDoesNotExist)                     {                         var specificIssue = (AdManagerDoesNotExist)issue;                         var command = Locator.Get<ICommand<string, DirectAgents.SynchService.Model.EomDatabase.AdManager>>("CreateAdManager");                         command.Execute(specificIssue.AdManagerName);                     }                     else if (issue is MediaBuyerDoesNotExist)                     {                         var specificIssue = (MediaBuyerDoesNotExist)issue;                         var command = Locator.Get<ICommand<string, DirectAgents.SynchService.Model.EomDatabase.MediaBuyer>>("CreateMediaBuyer");                         command.Execute(specificIssue.MediaBuyerName);                     }                 }             }      Here's the code for `FindNewCampaigns`. It adds issues as it finds them. An _Issue_ is supposed to be something that needs to happen before a new campaign is able to actually get created in a target store.                   public class FindNewCampaigns : Command<IEnumerable<Campaign>>         {             private IFactory<CakeEntities> cakeEntities;             private IFactory<DADatabase> eomDatabase;                  public FindNewCampaigns(IFactory<CakeEntities> cakeEntities, IFactory<DADatabase> eomDatabase)             {                 this.cakeEntities = cakeEntities;                 this.eomDatabase = eomDatabase;             }                  public override IEnumerable<Campaign> Execute()             {                 using (var eom = eomDatabase.Create())                 using (var cake = cakeEntities.Create())                 {                     // Get EOM campaigns                     var campaigns = eom.Campaigns.Select(c => c.pid).ToList();                     // Get Cake offers                     var offers = cake.CakeOffers.Select(c => c.Offer_Id).ToList();                     // Get Cake offers that don't match to EOM campaigns                     var newOffers = offers.Except(campaigns).ToList();                     // Get default values                     int accountManagerID = DefaultAccountManagerId(eom);                     int adManagerID = DefaultAdManagerId(eom);                     int advertiserID = DefaultAdvertiserID(eom);                     int campaignStatusID = DefaultCampaignStatus(eom);                     // Create new campaigns in memory                     var newCampaigns = (from offer in cake.CakeOffers                                         where newOffers.Contains(offer.Offer_Id)                                         select new                                         {                                             Offer = offer,                                             Campaign = new Campaign {                                                 pid = offer.Offer_Id,                                                 campaign_name = offer.OfferName,                                                 campaign_status_id = campaignStatusID,                                                 account_manager_id = accountManagerID,                                                 ad_manager_id = adManagerID,                                                 advertiser_id = advertiserID,                                             }                                         }).ToList();                     // Set campaign status                     var campaignStatus = eom.CampaignStatus.ToDictionary(c => c.name, c => c.id);                     campaignStatus.Add("Private", campaignStatus["Active"]);                     campaignStatus.Add("Apply To Run", campaignStatus["Active"]);                     campaignStatus.Add("Inactive", campaignStatus["default"]);                     foreach (var item in newCampaigns)                     {                         string statusName = item.Offer.StatusName;                         if (campaignStatus.ContainsKey(statusName))                         {                             item.Campaign.campaign_status_id = campaignStatus[statusName];                         }                         else                         {                             AddIssue(new CampaignStatusDoesNotExist(statusName));                         }                     }                     // Set advertiser                     var cakeAdvertisers = cake.CakeAdvertisers.ToDictionary(c => c.Advertiser_Id);                     foreach (var item in newCampaigns)                     {                         int offerAdvertiserID = int.Parse(item.Offer.Advertiser_Id);                         var offerAdvertiser = cake.CakeAdvertisers.FirstOrDefault(c => c.Advertiser_Id == offerAdvertiserID);                         string offerAdvertiserName = offerAdvertiser.AdvertiserName;                         var eomAdvertiser = eom.Advertisers.FirstOrDefault(c => c.name == offerAdvertiserName);                         if (eomAdvertiser != null)                         {                             item.Campaign.advertiser_id = eomAdvertiser.id;                         }                         else                         {                             AddIssue(new AdvertiserDoesNotExist(offerAdvertiserName));                         }                     }                     // Set account manager                     foreach (var item in newCampaigns)                     {                         int offerAdvertiserID = int.Parse(item.Offer.Advertiser_Id);                         var offerAdvertiser = cake.CakeAdvertisers.FirstOrDefault(c => c.Advertiser_Id == offerAdvertiserID);                         string offerAccountManager = offerAdvertiser.AccountManagerName;                         if (offerAccountManager != null)                         {                             AccountManager am = eom.AccountManagers.ToList().SingleOrDefault(c => c.NameIsEquivalentTo(offerAccountManager));                             if (am != null)                             {                                 item.Campaign.account_manager_id = am.id;                             }                             else                             {                                 AddIssue(new AccountManagerDoesNotExist(offerAccountManager));                             }                         }                         else                         {                             AddIssue(new OfferHasNoAccountManager(item.Offer.OfferName));                         }                     }                     // Set ad manager                     foreach (var item in newCampaigns)                     {                         int offerAdvertiserID = int.Parse(item.Offer.Advertiser_Id);                         var offerAdvertiser = cake.CakeAdvertisers.FirstOrDefault(c => c.Advertiser_Id == offerAdvertiserID);                         string offerAdManager = offerAdvertiser.AdManagerName;                         if (offerAdManager != null)                         {                             AdManager ad = eom.AdManagers.ToList().SingleOrDefault(c => c.NameIsEquivalentTo(offerAdManager));                             if (ad != null)                             {                                 item.Campaign.ad_manager_id = ad.id;                             }                             else                             {                                 AddIssue(new AdManagerDoesNotExist(offerAdManager));                             }                         }                         else                         {                             AddIssue(new OfferHasNoAdManager(item.Offer.OfferName));                         }                     }                     return newCampaigns.Select(c => c.Campaign).ToList();                 }             }