title: Refactoring this code that produces a reverse-lookup hash from another hash

text: This code is based on the idea of a Form Object http://blog.codeclimate.com/blog/2012/10/17/7-ways-to-decompose-fat- activerecord-models/ (see #3 if unfamiliar with the concept). My actual code in question may be found here: https://gist.github.com/frankjmattia/82a9945f30bde29eba88 The code takes a hash of objects/attributes and creates a reverse lookup hash to keep track of their delegations to do this.               delegate :first_name, :email, to: :user, prefix: true      But I am manually creating the delegations from a hash like this:               DELEGATIONS = {         user: [ :first_name, :email ]     }      At runtime when I want to look up the translated attribute names for the objects, all I have to go on are the delegated/prefixed (have to use a prefix to avoid naming collisions) attribute names like :user_first_name which aren't in sync with the rails i18n way of doing it:               en:       activerecord:         attributes:           user:             email: 'Email Address'      The code I have take the above delegations hash and turns it into a lookup table so when I override human_attribute_name I can get back the original attribute name and its class. Then I send #human_attribute_name to the original class with the original attribute name as its argument. The code I've come up with works but it is ugly to say the least. I've never really used #inject so this was a crash course for me and am quite unsure if this code effective way of solving my problem. Could someone recommend a simpler solution that does not require a reverse lookup table or does that seem like the right way to go? Thanks, \- FJM


title: what is the task of a coach in acm programming contests?

text: In the university that I am working they have decided to participate in the ACM regionals for the first time, they would like to appoint me like a coach. I have never been into that situation before and have not found so much information about it, so what is the real work of a coach in those contests? Sometimes I have found experienced programmers like coaches, but others are just people with no so good programming skills; so what is all about?


title: Why does not thinking about a bug sometimes help you solve it?

text: Yesterday I spent a good part of the afternoon trying to fix a bug, which I thought to be trivial. I was going around in circles, not having a clue what was wrong. Rewriting large parts of the code. Checking on SO. Still no joy. So I went home, walked the dog, watched a little TV and just before I went to sleep, bingo I realized the obvious mistake I was making. This morning it took about 10 minutes to fix. While I was home, I wasn't actively thinking about the problem. Yet taking myself out of the situation enabled me to solve it. It isn't the first time it has happened, and I know that it is a fairly common way to solve a programming problem. I have even heard of people dreaming the answers. Why does this work? Perhaps more importantly, is there a good guide as to when you should take a break from a problem, how long should the break be, and after how long does leaving a problem stop being effective? I suppose I am trying to work out how to optimize this subconscious processing (or whatever is going on)


title: Rewarding open-source contributors

text: Is there a service which could help me reward (pay) the contributors of an open-source project by their contribution to the project (Maybe using data from where the code is hosted GitHub)? Maybe by getting them to map their bank/paypal account to their account on a service like GitHub? How do projects currently reward their contributors? If I were to develop such a service, what would I need?


title: Advertising clause in Apache License

text: The Apache 1.0 license includes an advertising clause: **Apache** : > All advertising materials mentioning features or use of this *   >  software must display the following acknowledgment: * "This product > includes software developed by the Apache Group * for use in the Apache HTTP > server project (http://www.apache.org/)." I find the phrase "mentioning features or use of this software" unclear if I distribute Apache 1.0 licensed code with other code. Does "this software" mean the Apache licensed component or the whole software package. For example, if I am only using Apache licensed code for encryption, does the advertising clause only appear if an advertisement mentions encryption or does it apply even if the advertisement doesn't mention any functionality provided by the Apache licensed code?


title: Generic and type safe I/O model in any language

text: I am looking for an I/O model, in any programming language, that is _generic_ and _type safe_. By _genericity_ , I mean there should not be separate functions for performing the same operations on different devices (`read_file`, `read_socket`, `read_terminal`). Instead, a single `read` operation works on all `read`-able devices, a single `write` operation works on all `write`-able devices, and so on. By _type safety_ , I mean operations that do not make sense should not even be expressible in first place. Using the `read` operation on a non-`read`-able device ought to cause a type error at compile time, similarly for using the `write` operation on a non-`write`-able device, and so on. Is there any generic and type safe I/O model?


Why do we need to separate classes which have different functionality? For example, why should we separate a car class from a paint class. What would be the OOD concept behind this? Is there anything else apart from code reuse and modularity?


title: Running time insensitive to input?

text: I read the following in Algorithms 4th Edition by Robert Sedgewick and Kevin Wayne: > Our first qualitative observation about most programs is that there is a > problem size that characterizes the difficulty of the computational task. > Normaly, the problem size is either the size of the input or the value of a > command-line argument. Intuitively, the running time should increase with > problem size, but the question is by how much it increases... and > Another qualitative observation for many programs is that the running time > is relatively insensitive to the input itself; it depends primarily on the > problem size. If this relationship does not hold, we need to take steps to > better understand and perhaps better control the runnig time's sensitivity > to the input. But it does ofter hold, so we now focus on the goal of better > quantifying the relationship between problem size and running time My question is, if the input size (problem size of the program) increases, and thus the running time also increases, **why** would the running time of the program be relatively **insensitive** to the input? I'm confused.


title: Should session variables be avoided?

text: I used to heavily rely on session variables in the past, but have recently found many of them to be unnecessary, using things like query string parameters instead. A colleague of mine refuses to use session variables. Is this a realistic goal and should session variables be avoided for any practical reasons? Can session variables be avoided completely (except for session cookies to allow logins) and would this result in better designs? Some of the reasons my colleague has for not using them:   * Untyped nature of session variables    * Session time-outs causing loss of state    * Global scope nature of session variables    * Load balancing servers losing sessions (.Net specific?)    * Application pools/servers restarting   * They are unnecessary


title: Choosing the right license for a testing framework

text: I've finished a first working, releasable version of a testing framework. Prior to release, I want to apply a proper license to it. Normally I'd choose something like GPLv3 but here I am pretty unsure. If I put the testing framework under GPLv3, does that mean users won't be able to test their commercial applications without also putting them under the GPL? Would a license like the MIT be a better fit? I've just had a look at several popular testing frameworks (JUnit, Jasmine) and none of them uses the GPL. **EDIT** Forgot to mention the project is open sourced.


title: On what name should I claim copyright in open source software?

text: When I want to use the Apache 2.0 licence in my project, I should include this in the comments of my source code:               Copyright [yyyy] [name of copyright owner]          Licensed under the Apache License, Version 2.0 (the "License");     you may not use this file except in compliance with the License.     You may obtain a copy of the License at              http://www.apache.org/licenses/LICENSE-2.0          Unless required by applicable law or agreed to in writing, software     distributed under the License is distributed on an "AS IS" BASIS,     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.     See the License for the specific language governing permissions and     limitations under the License.      What name should I fill in for `[name of copyright owner]`? I am currently working alone on this project, but I'm going to release the source code so there might be other contributors in the near future.


title: How to learn Cloud Computing and Big Data at home?

text: I want to learn Cloud Computing and Big Data at home.   1. Is it possible to learn these technologies on home PC?      2. Which technologies to learn in Cloud Computing?    3. Which technologies to learn Big Data (Hadoop)?


title: How to store cache?

text: The data in my website is stored in many different tables(friends,relatives,etc) and every-time I have to query each and every table. But all this data is subject centric. E.g. data for a person is of the form               data[301]={             "pid"=>301,             "friends"=>array(),             "relatives"=>array(),             "interests"=>array()             }      So I want to store it in a cache in the db (and hence query only one table). But how do I store such data? should I be using blobs?


title: OO way to gather together data from multiple objects without getters

text: I'm writing a system that has a number of objects with data in them. For example one object has a user name attribute, another has a date, another shopping cart item etc. I'm making an object that generates a MD5 hash based on a concatenated string of these values. So for example `md5(username + date + special_number + cart_id)`. The way I was going to do this was pass the md5_generator object to each other the other objects in turn allowing them to call an `add_x` method (eg `add_username`) on the generator to add their specific piece of data. This avoids pulling the data out of each object, which I want to avoid. I'm wondering if this is the best idea or if there is some simpler OO pattern I'm missing?


title: Is it necessary to memorize code?

text: I am a new developer, who just got hired at a big company. I don't know how but I guess they are desperate. However, I am well-versed with HTML5/CSS3 though things change and new things are released and I keep up with as much as I can. But this job required me to hand-code Javascript, know Jquery and Ajax. I have been exposed to this a bit but I am not sure if I can hand-code Javascript. My question is, is it necessary to memorize all there is about Javascript or are there a few key things that I should know how to hand-code because looking at javascript code it seems there are lots of lines code! Please point me in the right direction.


title: Efficient way to compare scene-graph trees

text: I'm designing a scene graph system, where it is required to compare two trees. The trees are populated with individual objects, each with varied number of children; and they have a root.   Eg: Parent: Scene, Children: Bullet1, Bullet 2, Player What is a good way to compare two such tree? I'm using C++ for the code.   Also, this question is an off-shoot from this question


title: Blocks of Javascript in Web Pages

text: I'm trying to find the best patterns for javascript usage in my sites, and in doing so I tend to look at source code at some sites (meetup.com, facebook.com, etc). One thing that sticks out at me is the fact these sites seem to compress all of their javascript and place it in the actual page rather than using a `<script src="...." type="text/javascript">` My question(s): 1: How are they compressing (or how would one compress) the javascript? Should I use YUIcompress on every page call? 2: What is the benefit of doing things this way rather than importing separate scripts? I would think the separate scripts would make the page itself load quicker. Thanks


title: GCC: assembly listing for IA64 without an Itanium machine

text: I need to try the following thing: I would like to compile some simple C code samples and see the assembly listing generated by GCC for IA64 architecture, i.e. I just want to run GCC with the -S switch and see the resultant .s file. I don't have an Itanium machine, so in order to do it myself I'll probably need a cross-compiling version of GCC built for x86 RedHat. I'm not interested in full cross-compilation, meaning that I don't need to generate the binaries at all. The easiest way, of course, would be to find an Itanium machine with with GCC and just try it there. Unfortunately, I don't seem to have access to any. Another option is to build a cross-compiling version GCC on my RedHat, but apparently that's quite an endeavor for someone who hasn't done it before (I assume that the fact that I only need .s output doesn't make it simpler). What other options are there, if any? Maybe there's some sort of a web front to an Itanium GCC compiler on the Net (something like Comeau Online or ideone.com, but with .s output)? Anything else? I would appreciate any help.


title: Why many web developers use java programming language for web development?

text: I know a lot of programming languages that can be used to web development like PHP, ASP, etc. but why many web developers use java programming language for web development?


title: Why isn't Haskell able to optimize infinite lists?

text: Lets say you've got a list `l = [0, 2..]` and you want to get the `n`th number when `n` is pretty large, say `n=123456789`. So you call `l !! 123456789`. On my machine, this results in `out of memory`. So why aren't Haskell capable of realizing that the number at index `n` is `2n`, and making a call such as `l !! 1230981237` trivial? Or a more extreme example, `[1..] !! 123456789`. Shouldn't Haskell be able to realize that every number in `[1,1..]` is `1`?


title: I have made extensive use of Apache Commons libraries. I am now to release my (non-profit) application. Is there anything I should worry about?

text: I have developed a Java program for academic purposes (non-profit, non-open- source). In the process, I made extensive use of many apache common libraries. The program is now to be set free on the net, so I was wondering what my precautions should be. My program will (preferably) consist of a single .jar file, having all the apache commons .jar files living inside it (I didn't modify them in any way). Is the described approach just enough? Or do I have to take any more steps such that I don't commit an infraction? Thanks


title: Converting 'char*' to 'char'. Am I passing this array correctly?

text: So my CS professor gave the whole class a simple assignment. "Write a recursive function that will swap the order of a section in an array of chars." I thought to myself, "Easy. I'll finish this up in about 5 minutes and I'll get to work on my Trig homework before I leave." This is not what happened. An hour later, the professor and I are both wondering what on Earth is going wrong.               #include<iostream>     void swap(char charList, int start, int stop);          int main()     {         char myList[] = {'a', 'b', 'c', 'D', 'E', 'F', 'g', 'h', 'i', 'j'};         int size = 9;         printCharList(myList, size);         swap(myList, 3, 5);           //<--- It doesn't seem to like this call         return 0;     }          void swap(char charList[], int start, int stop)     {         char temp         if(start < stop)         {             temp = charList[stop];             charList[start] = charList[stop];             charList[stop] = temp;             swap(charList, start+1, stop-1);         }         else             std::cout << "start > stop\n";     }      The code is stupidly simple, so you can imagine my confusion when it refused to compile. It keeps throwing up an error message suggesting that I am trying to convert a pointer to a char, but I'm almost positive that I've done no such thing. I'm sure the problem is right in front of my face, but I have had no luck in finding it. Could you help a guy out?


title: Architecture for writing add-ins for closed-source software

text: currently I'm designing an add-in for the modelling tool Enterprise Architect. The general architecture is shown in the picture below. ![General add-in architecture](http://i.stack.imgur.com/PoJaJ.jpg) Basically every action where the add-in can react to is triggered by PreDefinedEvents for which the add-in can provide callback functions. These callback functions are the starting point for building whatever application someone would like to put on top EA. One has access to the Model Database (.mdb file) through the API (which uses closed-source algorithms) or by direct access, which can cause of course inconsistencies and is not safe against DB structure changes. The current approach from previous projects was to build monolithic classes called EA_XXX_Utilities containing a huge amount of static methods. All of these methods get as argument a reference to the model repository which is stored inside the Closed Source and work with it. I think that this approach is not very handy related to maintainability and extendability, which will have high priority in future projects, so I'm trying to find the best way which let's me fulfill the requirements according to these quality aspects. Every requirement basically consists of two parts:   * modify the underlying model   * present parts of the model in a custom way This smells for me like a kind of MVC architecture, but my major problem is that if I stored the reference the the Model Repository somewhere in my application then I would have to somehow get notified of all changes which the closed source algorithms do to the database. But not all of them are forwarded to the add-in, so at some time the model stored in the add-in will get inconsistent. This leads to the question: **How can I design the add-in, so that it has some architecture in it at all and even better satisfy the quality aspects?**


title: Programming methodology - best way to level up?

text: Ok, so I'm at a point where I think I have my basics down. I'd like to think I'm just starting to become an intermediate dev. So, how do I level up here? It feels like I have reached my threshold, but I really want to break it, and move ahead, do more crazy stuff (for context, I'm talking about programming). So, what would be the best strategy to achieve this? I'm working on multiple side projects of my own (I'm a student). How should I approach learning to program from here? What I currently do is, if I'm unable to understand a how to solve a problem, Google or SO it, find an answer, modify it as required and use it. It this the correct way to go? Is there a better way? How do I go about learning about new concepts, new classes etc. in an organized manner, one that doesn't overload my brain? I know it's practice, practice, practice, but the question is what to practice? There's just so much and only so much I can do. Share your knowledge! PS: My primary field is Java, so I tagged it for some specific advice as well. **EDIT** : As I said, I'm a student, NOT in CSE major, so I don't have any clients or "requirements" per se. So what's best strategies to develop my own projects? I have done a few projects and learned a lot from them, but is there a guide about standards or conventions about projects? How do I structure my projects? How do i build them efficiently?


title: Can JSP Expression Language provide type safety like scriptlets in Eclipse IDE?

text: Almost everywhere you can read that you should use EL instead of scriptles in JSP. And **I agree that you should not use any JAVA code in JSP except for calling getter methods on model objects**. This is quite obvious for me and I don't need any clarification here. But there is this one thing that I really cannot understand is the lack of support for EL in Eclipse IDE. Let's start with comparing some code. First EL example:               ${user.name}     ${user.surname}      And now some scriptlet/JSP expression example:               <jsp:useBean id="user" class="com.mycompany.User">         <%= user.getName() %>         <%= user.getSurname() %>     </jsp:useBean>      It clearly visible that EL is more elegant. However, Eclipse doesn't provide any autocompletion nor refactoring support for EL. And for JSP expressions it works like a charm. If you delete getName() method from Java class, JSP validator will show you an error during compilation. If you rename the method, all the connected JSP files will update automatically. Moreover, even when you are looking for references to method getName(), Eclipse will show you all calls across Java/JSP files (provided you used JSP expressions/scriptlets). And none of these features are available for EL. Some of the programmers might say that they don't really care and EL syntax is much better for them, period. But I work with a quite complex legacy code (that I didn't write) in my current project and believe me that the refactoring of EL/model objects is a nightmare. There are a lot of DTO objects extending and composing other DTO objects that are being used on multiple JSP views. Every change is difficult, because I cannot tell at compile time if I didn't break anything. Based on that experience I just cannot understand how anybody could suggest using EL instead of JSP expressions. Please tell me that I'm missing something and that either using JSP expressions is correct (in my example) or that there is a way to enable all the advantages of using type safety with EL. EDIT:   I know that IntelliJ has better support for JSP, but I would like to focus on Eclipse first. I hope that there are still some people working on JSP projects on Eclipse/Spring Tool Suite.


title: How do you keep from running into the same problems over and over?

text: I keep running into the same problems. The problem is irrelevant, but the fact that I keep running into is completely frustrating. The problem only happens once every, 3-6 months or so as I stub out a new iteration of the project. I keep a journal every time, but I spend at least a day or two each iteration trying to get the issue resolved. How do you guys keep from making the same mistakes over and over?   I've tried a journal but it apparently doesn't work for me. * * * [Edit]   A few more details about the issue: Each time I make a new project to hold the files, I import a particular library. The library is a C++ library which imports `glew.h` and `glx.h` GLX redefines `BOOL` and that's not kosher since `BOOL` is a keyword for ObjC. I had a fix the last time I went through this. I `#ifndef` the header in the library to exclude GLEW and GLX and everything worked hunky-dory. This time, however, I do the same thing, use the same `#ifndef` block but now it throws a bunch of errors. I go back to the old project, and it works. New project no-worky. It seems like it does this every time, and my solution to it is new each time for some reason. I know `#defines` and `#include`s are one of the trickiest areas of C++ (and cross-language with Objective-C), but _I had this working_ and now it's not.


title: Why is Java the lingua franca at so many institutions?

text: **EDIT: This question at first seems to be bashing Java, and I guess at this point it is a bit. However, the bigger point I am trying to make is why any one single language is chosen as the one end all be all solution to all problems. Java happens to be the one that's used so that's the one I had to beat on here, but I'm not intentionality ripping Java a new one :)** I don't like Java in most academic settings. I'm not saying the language itself is bad -- it has several extremely desirable aspects, most importantly the ability to run without recompilation on most any platform. Nothing wrong with using the language for Your Next App ^TM. (Not something I would personally do, but that's more because I have less experience with it, rather than it's design being poor) I think it is a waste that high level CS courses are taught using Java as a language. Too many of my co-students cannot program worth a damn, because they don't know how to work in a non-garbage-collected world. They don't fundamentally understand the machines they are programming for. When someone can work outside of a garbage collected world, they can work inside of one, but not vice versa. GC is a tool, not a crutch. But the way it is used to teach computer science students is a as a crutch. Computer science should not teach an entire suite of courses tailored to a single language. Students leave with the idea that all good design is idiomatic Java design, and that Object Oriented Design is the ONE TRUE WAY THAT IS THE ONLY WAY THINGS CAN BE DONE. Other languages, at least one of them not being a garbage collected language, should be used in teaching, in order to give the graduate a better understanding of the machines. It is an embarrassment that somebody with a PHD in CS from a respected institution cannot program their way out of a paper bag. What's worse, is that when I talk to those CS professors who actually do understand how things operate, they share feelings like this, that we're doing a disservice to our students by doing everything in Java. (Note that the above would be the same if I replaced it with any other language, generally using a single language is the problem, not Java itself) In total, I feel I can no longer respect any kind of degree at all -- when I can't see those around me able to program their way out of fizzbuzz problems. Why/how did it get to be this way?


title: Is there any reason not to let your group of developers install third party Visual Studio add-ons?

text: Is there any risk in allowing your team of developers to install whatever Visual Studio Add-ons they want? Is it a good idea to allow them this freedom?


title: Isn't functional paradigm too divergent with underlying hardware to be generally efficient?

text: Inspired by a question from SO: http://stackoverflow.com/questions/6623391/how-to-gain-control-of-a-5gb-heap- in-haskell It can be a long debate about FP's numerous advantages and disadvantages, but for now, I'd like to narrow the scope to _principal efficiency_ of FP on modern hardware. Thesis: > Functional paradigm implies immutability and statelessness (?), but the > hardware we run functional programs on are stateful finite automata. > Translation of 'pure functional' program to a 'stateful hardware' > representation leaves little control to programmer, brings overhead (?) and > limits the use of hardware capabilities (?). Am I right or wrong in the questioned statements? Can it be proven that FP does / doesn't imply principal performance penalties on modern general-purpose computer architecture? **EDIT:** As I've already stated in response to some comments, the question isn't about implementation performance and details. It is about **presence or absence of principal overhead** , which running FP on stateful automata may bring.


title: Application internal API

text: I am currently building a small python `CLI` (Command Line Interface) application with ambition. In the first development phase I would concentrate on making it work through the `CLI` interface only, but in the second phase I will make it work through a `GUI`. To avoid a lot of refactoring of the functionnalities and to keep both version running on a similar code base I was thinking of developping my own internal API to handle processing. IE:   * Loading the config file   * Saving the config file   * Logging info (through `CLI` or log files)   * And the general process of the application I was wondering where to start and what to keep in mind while building an internal API? I already watched the following presentation : How To Design A Good API and Why it Matters or and read the text version ** What I mean by `API` is : If i want to load the configs I would only have to do something like `config = api.load.config(path/to/config/file)` and i would get a `dictionnary` (or `object`, yet to be determined) without having to detect the type of file and if the file exists, that part would be handled by the internal `API`'s framework


title: Is ROA a specific form of doing SOA?

text: I have read somewhere that ROA (Resource Oriented Architecture) is SOA (Service Oriented Architecture) with specific constraints added. SOA is the abstract concept of combining discrete pieces of software and ROA is an implementation of SOA with all of the constraints of RESTful services applied to it: > SOA = the concept > > ROA = the concept + specific implementation details I also had my share of posts saying that ROA is different than SOA, then simply fallback to statements like "ROA is REST" and "SOA is SOAP" and presenting the same more or less pertinent comparisons and differences between SOAP and REST. So just to clear up my confusion: **Is ROA a specific form of doing SOA?**


title: Browser-based GUI for a python application

text: I want to create a web/browser-based GUI for a command-line python application. The goal is to make use of HTML/JS technologies to create this GUI. As the application itself, it needs to run on Linux and Windows, and the interface will be accessible only from localhost (not exposed to internet). The GUI will contain 5 to 10 pages. I don't want a traditional desktop GUI that includes HTML/JS, but just a bunch of html files and some kind of controller between those and the application. I also want to make use of asynchronous programming (ajax like) so I can load and print data in the GUI without refreshing the whole page. I'd probably use jQuery for that and a couple other things. How would you recommend to design this? Performance is not the key here, I'm rather looking at reliability, portability and simplicity. I'm thinking of using a lightweight python HTTP server / framework (like CherryPy) and maybe later a Python templating system (at the begining it will just be a couple pages). **EDIT:**   I'm looking for ideas/recommendations how to build this, not for alternatives to browser/web-based GUI.


Last year, my department developed web based gaming, and needed Flash. It was difficult to manage. The Flash guys didn't fit in regardless of skill or popularity in the office. Maybe it's prejudice from the AS 2.0 days, or C programmers do things differently in my department. I don't get it! **EXAMPLE**   They hired a BAD Flash Guy used Tweener and Keyframes (they hated him). Then they hired a GOOD Flash Guy that was expert at AS 3.0 and followed best OOP standards (they liked him). The result was the same, the C programmers overwrote all of they're code, even the GOOD Flash Guy's code. **QUESTION**   **Is it better to have C developers learn Flash, than hire Flash guys?** No offense to Flash guy's, I'm trying to understand this on a project management level.   Thanks,


title: Suggestion for a Non-CSE developer

text: Due to financial problems, I couldn't go for CSE in my country and had to settle for a BCIS honors degree. Now, after quite some time, when I want to go for a higher position in software development then I get asked about algorithms and basics that I have missed back in uni. This is affecting my chances of getting selected and I cannot afford that any longer. My question would be that what you would suggest smn like me to do in order to cover the 'basics' without any university or educational institute e.g. books,learn C++,etc? Any suggestion (including -ve) is welcomed and appreciated.


title: Anti Identity Column

text: I recently came across some code which generates an _identity_ value for a key:               DECLARE @ID INT;          SELECT @ID = MAX(ID) + 1 FROM Person;          INSERT INTO [Person]         ([ID], [FirstName], [LastName])     VALUES         (@ID, @FirstName, @LastName);      I brought this to the attention of a coworker who claimed that not using a built in auto incrementing field is a perfectly reasonable approach to database design and in some circles a best practice. The coworker's rational is that it gives you more control over the values and allows you to manipulate the data more easily. I could only counter by pointing out that it just seems silly to do implement your own version of a feature that is supported by the server. And it is extremely error prone should someone decide to use a different method to insert a record. Are there really any good reasons not to use an Identity column when all you need is an artificial key on a table?


title: VS2010 SP1 & Resharper - flickering editor?

text: I have VS2010 (Ultimate), plus Resharper, and since SP1, I've noticed a regular and really irritating bug where the editor tab that I'm working on temporarily disappears, suddenly reappearing a second or two later. Has anyone else noticed anything similar? Is it a Resharper issue? Appreciate any advice.


title: Ajax race conditions

text: Is there a pattern or standard way to handle Ajax race conditions? Take the following example. You have two tables. Clicking a row on table 1 removes the data from DB and then updates table 2 (which would now be showing all the rows of table 1 less the row that was clicked). If someone where to click a bunch of rows in fast succession you could get a scenario where table 2 doesn't update for all the clicks do to timing/lag issues. What might be a good way to approach this? I was thinking of using a possible queue but that kind of defeats the purpose of doing it asynchronously. However I would still have the benefit of the UI not locking.


title: Tracking translations in localized software

text: I created and maintain an open source Android app. Recently someone offered to translate my app into several other languages. At the same time, development continues on the app which can sometimes add string resources which need to be translated. How can I ensure that the additional string resources are translated with as little pain as possible? In particular, the translator doesn't seems to have very minimal technical skills. I think that teaching him version control won't be very helpful. Also asking him to manually comb through the updated English resources for changes can be error prone. Any suggestions would be greatly appreciated.


title: What are the essential things one needs to know about UML?

text: I want my scribbles of a program's design and behaviour to become more streamlined and have a common language with other developers. I looked at UML and _in principle_ it seems to be what I'm looking for, but it seems to be overkill. The information I found online also seems very bloated and academic. How can I understand UML in plain-English way, enough to be able to explain it to my colleagues? What are the canonical resources for understanding UML at a ground level?


title: What are the boundaries of Domain Events?

text: As I get it, domain events imply loose coupling and separation of responsibilities. That's fine. But if domain events are allowed to cross aggregate's boundaries then it is a question how to guarantee that all concerned entities are materialized from persistence storage? For now it looks like events can only bubble through aggregate to the root or be handled by services triggering in-transaction scripts. In the letter case I believe the targeting specifics of the event is lost. Again and again My questions arise from the fact that the whole model does not live in the memory.


title: Observing progress of a distributed system

text: For a distributed system, there is a requirement of observing the progress of smaller applications on distributed computers (runtime 5 - 20 minutes). There is a web fronted, which right now only shows a list of those smaller applications (called jobs), with the state of each of them, like `preparing`, `running`, `finished` So in web-ui, an administrator can see:   * name   * state   * starting time   * call parameters from any computer in the network, possibly for the whole system. Each of the properties is stored in the database, so each state change leads to a call to write to the database. There might be thousends of those jobs at a time. **Description of the distributed system:** Central components, served at one location only:   * Database server (holding results of the jobs to runs statistics, have an overview of jobs run the last three month etc)   * Application server (glassfish, java, runs central server software) Distributed components, each site has at least one, connected via internet / WAN area: (probably about 20 sites, each has 1..4 Job controllers, each job controller runs about 20 jobs in parallel)   * Job-controller component (windows, c#, wcf, starts and observes small jobs)   * Small applications running tasks, started by Job-Controller (the jobs) So, for a vague estimation:               20 sites * 4 Job-controllers * 20 jobs = 1600 jobs in parallel          each of which runs from 0 to 100 percent in about 5 minutes on average,     resulting in a progress update each 3 seconds.          giving 533 progress updates per second (over the internet)      Now the customer wants to see something like a progressbar for each of these jobs. At first, I thought this might lead to a high network traffic and to a vast amount of traffic on the database server. I do not think that writing progress like 1%, 2%, 3% to the database is a good idea. The runtime of those jobs is not very easy to be estimated good (so it is near enough to a real result), but each job can tell very well what his progress is. **What would be a good architectural approach to observe progress of possibly thousends of those mini-jobs?** (Please note that a mixed infrastructure is given. There is the constraint that the system will be built upon that. so: Central glassfish + java and per site Windows + WCF + C#) Right now I think that each Job-controller could update the progress of all jobs it controls every 10 seconds at once. Would that be an acceptable approach?


title: Good books on how to manage yourself and tackle programming tasks?

text: There seem to be a lot of programming books on coding style and best practices and then of course a lot of books on organizational or team process e.g. agile/scrum/kanban, etc. I'm looking for books that discuss the process and method of solving programming problems.


title: Ways for beginner programmer to practice with C++

text: So i just finished my first semester of college. In my intro to programming class we made a bunch of super interesting ( _sarcasm_ ) console applications. Any suggestions on ways other than just messing around with console applications for a beginner C++ student to improve?


title: API Design Question

text: I am currently designing a API and have come to a slight design issue and was hoping for a few other opinions. My url structure for accessing basic data from the API is: /clientName/appName/methodName/. Basically each client may have a different set of methods for each application, so the base application class is extended through each client if the file exists. My question is with limiting the data pulled back through a GET request. Should the limiting number be appended to the URL or is that something that should be handled through POST request only? Should it even be a option? Looking for best practices in this scenario, thanks.


title: Test task : real tasks or not?

text: Just had a discussion with coworkers about test tasks for programmers. Is it morally appropriate to ask programmers do some helpful work for the project in their test tasks or such company just uses the job applicants to do job for free? Is it ethical to do it?


title: Does TDD formally use black box testing to supplement unit tests?

text: Unit tests are never perfect at capturing functionality, particularly in certain parts of an application (such as the GUI), so everyone needs some measure black box testing. **Does TDD have anything to say regarding black box testing?** If it does not say much, could it be true that while writing unit tests is the developers job, functional black box tests fall into a different domain like that of a business analyst or a dedicated tester?


title: Test Doubles : Do they go in "source packages" or "test packages"?

text: I've got a couple of data access objects (DefaultPersonServices.class, DefaultAddressServices.class) which is responsible for various CRUD operations in a database. A few different classes use these services, but as the services requires that a connection is established with a database I can't really use them in unit tests as they take too long. Thus, I'd like to create a test doubles for them and simply do FakePersonServices.class and FakeAddressService.class implementations which I can use throughout testing. Now, this is all good (I assume)...but my question relates to where I put the test doubles. Should I keep them along with the default implementations (aka "real" implementations) or should I keep them in a corresponding test package. The default implementations are found in **Source Packages : com.company.data.services**. Should I keep the test doubles here too, or should the test doubles rather be in **Test Packages : com.company.data.services**?


title: iOS: Versioned static frameworks vs Git Submodules and included code

text: For the last couple of years I've been building static frameworks of common APIs for my iOS projects. I can build a universal binary containing all the architectures (i386, armv6, armv7) and wrap it up in a .framework directory structure. I then stored this in a directory based on the version of the framework. For example `..../myAPI/v0.1.0/myAPI.framework` Once I have this framework I can then easily add it to a project and if I want to advance the version, merely change the framework search paths to the later version. This works, but the approach is very similar to what I would use in the Java world. Recently I've been reading about using Git submodules and static framework sub projects in XCode 4. Im wondering if my currently approach is something that I should consider retiring and what the pros/cons are of the new approach. I'm weary of just including code because I've already had issues in a work project which had (effectively) multiple versions of a third party API. Any opinions?


title: Integrating different branches from external sources into a single Mercurial repository

text: **Edit** : Making this even clearer as the bounty is about to expire: is there a way of importing history (pulling from different SCM) directly into a specific branch with Mercurial? * * * I'm currently working in a company using Perforce and am making way for distributed version control with Mercurial. I've had success importing Perforce history using the **perfarce** (quite a suitable name, I laugh every time I see/say it) however, this only works with a single branch at a time. Here's how my P4 integration setup works:   * In perforce, create a "client", which is kind of a description of what you will be constantly updating/checking-out. This can only address one branch at a time (trunk or other).   * Once you do this, run `hg clone p4://<server>/<client_name>`   * Go to .hg/hgrc and put the perforce path line: `perforce = p4://<server>/<client_name>`   * Work normally with the code under mercurial, do `hg pull perforce` to sync up, `hg push` to export a changelist What I'd like to be able to do is have a perforce path per branch and have everything work in the same repository. Now, pushing is not a problem, however, if I pull the history from another branch it would end up at the default branch. I'd like to be able to do something like `hg pull perforce-R5` and have it land in mercurial's R5 branch. Even if I have no merging history, it would be sweet enough to be able to preserve the branch's history. There are also other plugins for CVCSs that let you integrate mercurial, but AFAIK the subversion one has the same problem. I don't think there is a straight-through way of doing this, but as long as I could automate the process with some hooks and scripts in a single Mercurial machine, that would be good enough. * * * **Edit** : To make things a little clearer:   * Perforce **trunk** is mapped to Mercurial's **default** branch   * Perforce **R1** branch should be mapped to Mercurial's **release-1** branch (same for R2, R3, etc.)   * When I tell Mercurial to pull from perforce (i.e. `hg pull perforce`, where "perforce" is the name of the path pointing to the Perforce client) it should pull the Perforce trunk into Mercurial's default.   * When I tell Mercurial to pull from perforce-R1 (i.e. `hg pull perforce-R1`, where "perforce-R1" is the path to the R1 client) it should pull the Perforce R1 branch to Mercurial's "release-1" branch. **THIS IS THE PART I'M ASKING ABOUT**.


title: What operating systems are used in airplanes, and what programming languages are they developed in?

text: I was wondering if anyone knows what is the operating system used in commercial airplanes (say Boeing or Airbus). Also, what is the (preferred) real-time programing language? I heard that Ada is used in Boeing, so my question is - why Ada? what are the criteria the Boeing-guys had to choose this language? (I guess Java wouldn't be a great choice if exactly on lift-off the garbage collector wakes up).


title: Long-Term Strategy For Implementing a QA System?

text: I have been given the task of implementing some QA testing into a massive existing system. We're going to start out with system-level tests and might add unit tests if it is deemed necessary. I don't really know where to start. I'm thinking of creating a new project in the main solution dedicated entirely to QA testing. From there, I'll just add system-level NUnit tests that can be run automatically from that project. How does that sound? I want to make sure that I make the right decisions now so that the QA system doesn't get messy and overly complicated in the future. Since it will be running alongside a big system, I anticipate that it too will grow to be a big system, which makes it vulnerable to becoming a cumbersome mess of code. Any suggestions would be great!


title: How to make a training session effective?

text: In recent months I've been working on a project, and two weeks from now I'm leaving the company. I've scheduled a 4-hour training session next week in order to train my colleagues (the team leader and fellow programmers) on this project. One of the programmers has already written some code in it, so I'm not leaving the team with zero knowledge, but I'd like the others to be experts as well. The project has a few thousand lines of code, it includes some concepts which are new to the team (such as ORM and IoC), and due to its central role it will probably be heavily maintained in the future. So far I've written two presentations about different modules of the project, so these presentations can be used both for the current session and for training programmers that will come to the team in the future. From your experience, how can I make this session fun and effective? I really want this application to be maintained well, I'd like to leave a "fine legacy", so that the code will be maintained in the same spirit that I intended it to be. Thanks!


title: Run Time Type Identification using Composition

text: It is said that programmers should prefer composition over inheritance. I was wondering if RTTI can be achieved as easily using composition.


title: In a REST service project, where should we put code that calls a third party REST API?

text: My project is organized in layers like   * Configuration   * Controller   * Service   * Repository   * Domain Our REST Controller is in the Controller layer. We need to connect to another API via REST calls and I'm not sure if I should make a new Controller or do it in the Service layer. I'm going to implement the REST calls with Spring's RestTemplate. The way our API will be used is like this:   * REST call is made that goes through our REST endpoint.    * Our REST endpoint will call the third party API (either by calling another controller method or a service method).   * We will then do a conversion between our format and the third party format   * Then we will return the JSON of our format back to the client


title: PHP Parallel Requests and Session Stability

text: I've experienced a lot of issues that were the result of the nature of PHP living within the bounds of a stateless HTTP request, especially considering the asynchronous environment expected of modern web applications. Namely, regeneration of session handles can cause session self-destructs if parallel requests are occurring. Additionally, unless a request locks the session for its duration, session updates on parallel requests are at risk of conflicting and being overwritten by the other. If they do lock the session, it forces serialization of the requests. What did you find to be the most effective response to this problem? Do you just live with it and implement workarounds? Did you ultimately migrate to a different platform that didn't have this flaw? Or is there a PHP solution to this problem I'm not aware of?


title: Preparing for algorithm-related interview questions

text: So, I've just realized that some employers may ask an interview question that is relative to some complex mathematical algorithm. It seems like answering these questions is a skill in its own right. After all, I'm quite good at developing algorithms when the need arises, such as graphical algorithms, generic problem solving, or basic pattern matching, but I am not a mathematician. These problems require a completely different type of algorithmic thinking not necessarily had by most programmers, so where do I develop these skills? Is there a book I can read on this subject?


title: How many bytes can I fit into a QR code, with low error correction?

text: I need to fit at least 300 bytes (or much much more) into a QR code and think I can do this by mapping each byte into the associated ISO/IEC 8859-1 character located here. Since each byte (1-255) will only have one character associated with it, I can test the utility of the idea with this demo (the Email link has the dense QR I'm referring to) Since I know that camera resolution plays a factor here, among other things I'm unaware of, I'd like to get a sense of how many individual characters I can put into a QR code before running into issues. Any sizing, or resolution tips would be helpful. The other assumption I have is that a QR reader can read every ISO/IEC 8859-1 character and pass it to my app


title: How to choose between different open-source libraries?

text: Recently, I found multiple GitHub repositories that would allow me to perform the same task. (In my case, assess the readability of text strings.) It made me wonder, what are the best practices for programmers to choose between different open-source libraries, and in particular, libraries hosted on GitHub? GitHub statistics of users who watch, star, or fork a repository are one option, but are there others?


title: How to create an automated email in several languages (multipart/alternative)?

text: I need to send automated emails to customers whose language I am not sure about. 90 % are french and would probably not be able to read mails in english. The other 10 % would probably be able to read in english and clearly not in french. I don't know what their language is. I investigated the multipart/alternative that looked promising, give the mailer several variants and he selects the best one. ( see: http://www.ietf.org/rfc/rfc1766.txt ) Unfortunately no mailer seems to care about that, they always show the last part... did someone manage to make multi-lingual mail with automatic selection of the best version for the users? Is there some kind of trick to know? Do you have another solution?


title: Designing a loosely coupled app -> stored proc interface for PostgreSQL. A couple of questions

text: I am in the middle of designing a next generation database access class for one of the programs I am building. We use PostgreSQL exclusively. Our current approach is procedural (largely inspired believe it or not by RESTful web services, but paying attention to discoverability as well). The database defines (rather loosely) an API which the application discovers. The API is designed to be both readily useful and readable for computers and DBA's. You can read about our current approach at http://ledgersmbdev.blogspot.com/2011/10/introduction-to-soda.html but the basic point is that we look up _names_ only of data and generate procedural calls that are easily mapped to methods. Our Perl classes support a call interface like:                $recon_report->exec_method({ funcname => 'cash_recon__approve' });      This would re-use object properties to fill in the expected arguments for cash_recon. This allows the API to be changed to a small extent without breaking the basic contract with the application, and thus allows the worst of the stored procedure woes to be avoided. The above might generate a sql query like:                SELECT * FROM cash_recon__approve(134);      The function definition in PostgreSQL would look like:                CREATE OR REPLACE FUNCTION cash_recon__approve(in_id int) returns ...      One of the big problems with this approach though is that it is very had to manage large numbers of function names in this way, so I am looking for a more object-like interface around the database. We currently manage this by using double underscores, but this creates about as many problems as it solves. It is slightly better than using nonstandard characters and requiring every function name to be quoted when a dba types it or in test cases though. The new interface I am looking at would be different. Instead of identifying the type by the portion before the underscore it would be the type used by the first argument. The equivalent to the above would be the much more annoying looking:               SELECT * FROM approve('(35,65,1111111,f,f,2011-10-06,"2011-10-07 13:11:24.324195",186,chris,f,,,,f)'::cash_recon);      The function definition here would look something like:               CREATE OR REPLACE FUNCTION approve(obj cash_recon) RETURNS ....      Such an interface would also be discoverable but it would rely on discovery. It is not as likely that individuals could read the call and understand exactly what it did right away. The major advantage however is that it would allow complex data structures to be passed in, and this would be necessary for procedures that expect to be able to determine whether a transaction is balanced before writing it to the database so there are cases where this is clearly preferable. It requires though that test cases would need to be dynamically generated from the database. Manually written test cases would likely be quite brittle. So the example above strikes me as a case where the existing stored procedure interface is probably preferable, while posting a journal entry strikes me as one where the approach under development is significantly preferable. So my first question is, given that these two API's have different strengths and weaknesses, does it raise any red flags to support both and assume that stored procedures may be written to either spec? Or is it generally better to have a smaller spec with only one API approach supported. In other words should the old API be deprecated or used alongside the new one? I am leaning towards the latter but would like to get feedback. The second question is, assuming we do support both, is it better to discover the form of the API at run-time or to require a different call for the old vs the new style? I am leaning here towards discovery because it allows the functions in the db to be rewritten and remain call-compatible if need be.


title: How to set up a Java project with unit tests, references and something like a VS .sln using IntelliJ

text: I do a lot of c# development work. Recently, our company decided it was important for webservices to be able to run on Unix machines, and decided that we should write new services in Java as a result. We've got licenses to IntelliJ, so I'll probably start with that as an IDE. I've found it pretty easy to find resources about the Java language and the standard libraries. There are several low level details that are harder to find.   * How do I (how should I?) setup a new project with unit tests?   * How do you manage references? (I spent hours trying to figure out classpath stuff in eclipse a couple years ago)   * How do you setup something equivalent to a .sln file? So I need pretty low-level help, but without it focusing on code (I don't need help learning to write Hello World, or a for loop).


title: Is map-reduce the basic factor that makes NoSQL more scalable than SQL?

text: I'm studying the differences between NoSQL and SQL, and what makes the first more scalable. I think I got the point, so I'll try to explain: Suppose an app has a list of billions of users, each with a quantity of money, and it wants to display the sum of the money of them all. In SQL, it'd have to `SELECT SUM(money) FROM users`, which would cause the engine to iterate through every user (O(n)) to compute the sum, which is slow. In NoSQL, on other hands, it could previously set up a map reduce function such as `nosql_engine.mapReduce(get_money,sum)`. This would cause the retrieval of the sum to be instantaneous (O(1)) as it would be cached, and updating that computation drops to O(log(n)), because of the associability of the reduction operation. So, in general, this map-reducing capacity is the basic underlying principle that makes NoSQL more scalable than SQL. **Is this correct to some extent?**


title: Programming Discrete Wavelet Transform

text: I am trying to program Discrete Wavelet Transform in Matlab. I do understand that their are various libraries available, but my project requires that I must implement it from scratch. I am taking a vector of length N. I then provide this vector as input to my my Low Pass and High Pass Filters. My first question is, what must be the cut-off for these two filters? Once I am done passing my signal through these two filters, I have S_LowPass and S_HighPass. I now down sample these vectors. Once I have down sampled these vectors, the size of my vector has been reduced. Now when I use Matlab's Wavelet toolbox, the sizes remain the same on each level. My second question: Why are the sizes remaining the same?


title: What would be a best way to code a rudimentary LIMS?

text: I hope that I am asking the right question at right place. If not, please do not hesitate to point me to the right place. I am working in a laboratory, where computers/programming/programmers are all used only as support. But I believe that we need better information organization and management. Given the diverse information generated in the lab I believe that we need some sort of Laboratory Information Management System. Is there a good starting point to do this? I am myself not a trained programmer. I can code reasonably well in `python` and `R`, and if necessary I can learn `MySql`, `php`.


title: How to use lists in equivalence partitioning?

text: I have read that equivalence partitioning can be used typically for intervals or lists, e.g. I assume it can be used for every set of inputs. Anyway if the requirement says that allowed colors are (RED,BLUE,BLACK, GREEN), I cannot treat them like a list, right? I mean, testing one of them would not be enough because developers most likely used some switch-case and thus it is not real "set" where one could represent also the others. So how it is meant with lists? Also what is not that clear to me, I do not think it is always possible to do the initial partioning and then design the test cases.   What about checking two lines intersection: Y=MX+C. (two inputs) 1) The lines are paraller. M1=M1 but C1 must be different from C2.   2) Lines are intersecting. M1 must be different from M2.   3) Coincident. The are the same. How can I use partitioning here? THis is actually taken from a book and it says that these sets are eq.classes.


title: What grammatical tense should I write my specifications in?

text: We are currently writing functional and technical specifications in a two column format; summary sentence and technical detail. The details often refer to an appendix with diagrams, layout designs ect. However I am struggling with what tense to write it in: With past tense as if the work is done I struggle to show highlight extensions of exiting work. Future tense as in it needs to do X starts to sound like a to do list or Tense neutral very hard as it has either going to be done or is done. To add further confusion this specification may be read by people who do not have English as a first language.


title: Structure vs. programming

text: Is it bad that I often find myself spending more time on program structure than actually writing code inside methods? Is this common? I feel I spend more time laying the foundation than actually building the house (metaphorically). While I understand that without a good foundation the house will cave in, but does it legitimately need to take half of the project to finalize code structure? I understand design patterns, and I know where to go if I need help on choosing one, but often I find myself doubting my own choices.


title: I am a beginner. Can I directly start learning C++11? or I have to learn old C++?

text: I'm a beginner and have only little knowledge in programming. Would it be good if I directly learn C++ from books which cover new C++11 or should I study through the old best C++ books? Should I have little knowledge about C++ before learning C++11? or I can start directly from there? Would it cause problem if I directly start from C++11? If no, then suggest some books on C++11.


title: Why do business analysts and project managers get higher salaries than programmers?

text: We have to admit that programming is much more difficult than creating documentation or even creating Gantt chart and asking progress to programmers. So for us that are naives, knowing that programming is generally more difficult, why do business analysts and project managers get higher salary than programmers? What is it that makes their job a high paying job when even at most times programmers are the ones that go home late? **UPDATE** Excuse my ignorance, from some of the response it seems that the reason why BAs and PMs gets higher salary because they are the ones that usually responsible for the mess programmers make. But at the end of the day, it is programmers that get their hands dirty to fix the mess and work harder. So it still does not make sense.


title: Usage of raw pointers

text: So from the top-voted answer to this question, it appears that using raw pointers for storage isn't frowned upon so much. However, then what is the point of a `std::weak_ptr`? I thought that storage was the exact purpose of that class. If so, is there any circumstance in which a raw pointer is considered good, valid code? If there isn't any, what is the point of having them in the language? Is it simply historical artifact?


title: How do web servers enforce the same-origin policy?

text: I'm diving deeper into developing RESTful APIs and have so far worked with a few different frameworks to achieve this. Of course I've run into the same- origin policy, and now I'm wondering how web servers (rather than web browsers) enforce it. From what I understand, some enforcing seems to happen in the browser's end (e.g., honoring an Access-Control-Allow-Origin header received from a server). But what about the server? For example, let's say a web server is hosting a Javascript web app that accesses an API, also hosted on that server. I assume that the server would enforce the same-origin policy --- so that only the javascript that is hosted on that server would be allowed to access the API. This would prevent someone else from writing a javascript client for that API and hosting it on another site, right? So how would a web server be able to stop a malicious client that would try to make AJAX requests to its API endpoints while claiming to be running javascript that originated from that same web server? What's the way most popular servers (Apache, nginx) protect against this kind of attack? Or is my understanding of this somehow off the mark? Or is the cross-origin policy only enforced on the client end?


title: What are the most relevant books on software task estimation for individuals?

text: What books have you read that helped you, as a programmer, learn to estimate time for completing small-to-medium programming tasks, such as bug fixes or implementing new features? Which have you the most helpful? Please describe how it helped you, citing its strengths and weaknesses.


title: Motivation for programming in a specific language

text: I'm 21 and didn't go to University and hence completely self-taught from tutorials, screencasts, books etc, but when it came to the decision of what languages to specifically learn, I thought, what's going to the most beneficial to learn, ie. for money, exposure, etc... So I did the Sun Certified Java Programmer course, but have never used it since, I learned Objective C to make iPhone apps, I have used it lots, I used PHP for web stuff, I've used it lots. So my question is, if you chose to learn a specific language, was it for money or for a certain job or because your employer needed you to get up to speed on a language for a specific project? I cant really think of any other motivations to be a programmer? Is that shallow??


title: Using JOIN keyword or not

text: The following SQL queries are the same:               SELECT column1, column2     FROM table1, table2     WHERE table1.id = table2.id;          SELECT column1, column2     FROM table1 JOIN table2      ON table1.id = table2.id;      And certainly result in the same query plans on every DBMS I've ever tried. But every so often, I read or hear an opinion that one is definitely better than the other. Naturally, these claims are never substantiated with an explanation. Where I work, the second version seems to be favored by the majority of other devs, and so I also tend toward that style to minimize surprise. But In my heart, I'm really thinking the first one (since that's how I originally learned it). Is one of these forms objectively better than the other? If not, what would be the reasons to use one over the other?


title: How to document requirements for an API systematically?

text: I am currently working on a project, where I have to analyze the requirements of two given IT systems, that use cloud computing, for a Cloud API. In other words, I have to analyze what requirements these systems have for a Cloud API, such that they would be able to switch it, while being able to accomplish their current goals. Let me give you an example for some informal requirements of Project A:   1. When starting virtual machines in the cloud through the API, it must be possible to specify the memory size, CPU type, operating system and a SSH key for the root user.   2. It must be possible to monitor the inbound and outbound network traffic per hour per virtual machine.   3. The API must support the assignment of public IPs to a virtual machine and the retrieval of the public IPs.   4. ... In a later stage of the project I will analyze some Cloud Computing standards that standardize cloud APIs to find out where possible shortcomings in the current standards are. A finding could and will probably be, that a certain standard does not support monitoring resource usage and thus is not currently usable. I am currently trying to find a way to systematically write down and classify my requirements. I feel that the way I currently have them written down (like the three points above) is too informal. I have read in a couple of requirements enineering and software architecture books, but they all focus too much on details and implementation. I do really only care about the functionalities provided through the API/interface and I don't think UML diagrams etc. are the right choice for me. I think currently the requirements that I collected can be described as user stories, but is that already enough for a sophisticated requirements analysis? Probably I should go "one level deeper" ...


title: Would this be an effective use of the Subject/Observer pattern, or is there a better way?

text: TBH: I've never used an observer pattern. But it looks pretty useful for this situation: I'm developing a very simple strategy game. It involves two combatants who simultaneously bludgeon each other over a short period of time, the winner being the combatant with the most health remaining in the end. Now, there's a lot of configurable strategies for the combatants, different pieces of equipment that can change how often they attack, etc. I'm also planning on including some "outside" factors like weather that will affect the combatants. So.... I could create a Fight object that is the subject. It keeps track of the time and notifies the observers every "tick" of the clock. The observers are two instances of a Combatant object and one Weather object. It seems like a good idea, but where are the pitfalls? Actually, as I'm typing this I think one problem is that observers are probably ignorant of each others' parameters. Or must they be? Has anyone used an effective design pattern to do something like this?


title: Bug root cause analysis

text: In our group we usually don't ponder too much about what kind of design or implementation decisions caused a bug, we just fix it. Of course if some module constantly produces bugs people start to notice it, and sometimes this leads to major refactoring. But we don't have a process where bugs are routinely analyzed for their root causes. My question is whether a formal process of bug root cause analysis is common in software development, and if not why not.


title: What happens when both heap and stack are full?

text: Suppose I am using a very heavy applications(or you can say that it is a very bad code which keeps on allocating memory on heap and won't free it and also uses recursion) Now after some point of time both heap and stack will have no space to expand. Now In this situation heap and stack don't have any free space in between them and if I try to allocate some memory on heap then what will happen? will it overflow over stack? And also what happens if we make a recursive call and stack needs to expand then will it overflow over heap?


title: parallel computing list of objects

text: I have a list of objects that all require the exact same filtering, basically a set of conditionals in a function which outputs if the object is "good" or "bad". I want to keep all of my "good" objects in the list. Lets say I have 1000 objects in this list and the function I want to filter on in written. What languages/functionality would maximize how parallel this operation could be? I have played with python's multiprocessing, which does improve performance, but still left me unsatisfied. I suppose this is an "embarrassingly parallel" problem as no state needs to be shared.


title: UML communication diagrams, implementation details or not?

text: After reading Applying UML and Patterns (Larman) and looking around on the Internet it still seems ambiguous to me if a UML communication diagram should depict implementation details (such as GUI related function calls) or be more bound to the analysis. What is the correct answer? Does UML even specify it?


title: Should I not try to emulate private class data in javascript?

text: So I have been building this ORM style library for AngularJS (JavaScript) and since I come from a C++/PHP/C# background, I always try to make sure that private things stay private. While this can be accomplished in JavaScript, I keep running into issues that I have to work around probably because JavaScript really does not have the transitional class system that I am used to. Should I just take the python approach and allow people to access private methods/data if they think they know what they are doing? Is this type of approach common in the JavaScript world?


title: better method to revert state if failure occures during add/delete

text: So I have a generic framework with a concept of children and parent objects, the objects don't have to be the same type, and I can add or remove any of them. Adding calls add on all the children, and informs the parents, inverse for remove. the concept of Parent is generic enough that there can be a loop across classes. A may be a parent of B which is a parent of C which is a parent of A. This still works, since I mark an object as added or removed as the first step in the abstract class; so even if a circular dependency calls Add a second time on the same object the second time through the add will return without doing anything (because the added boolean is already set) and we halt our recursion. If some unexpected exception occurs I want to revert my state back to what it was before the exception occurs. I was doing this with exception handling, if I catch a run time connection I remove objects I added and update parents before throwing the exception. This is where my logic can fail. As of now I 'revert' the AddObject method by calling removeObject and vice versa. If my state somehow ended up in a truly bizarre state I could keep throwing exceptions, add throws and calls remove, remove throws and calls add, etc etc. I think this still has a chance for infinite recursion; though admittedly something would already have to be pretty messed up in my state for it to happen. Is there a cleaner way to do my rollback logic to avoid this potential? At a point like this what should I say my state should be once I recover anyways?


title: Reuse Business Logic between Web and API

text: We have a website and two mobile apps that connect through an API. All the platforms do the exactly same things. Right now the structure is the following:   * Website. It manages models, controllers, views for the website. It also executes all background tasks. So if a user create a place, everything is executed in this code.    * API. It manages models, controllers and return a JSON. If a user creates a place on the mobile app, the place is created here. After, we add a background task to update other fields. This background task is executed by the Website. We are redoing everything, so it's time to improve the approach. Which is the best way to reuse the business logic so I only need to code the insert/edit/delete of the place & other actions related in just one place? **Is a service oriented approach a good idea?** For example:   * Service. It has the models and gets, adds, updates and deletes info from the DB.   * Website. It send the info to the service, and it renders HTML.   * API. It sends info to the service, and it returns JSON. Some problems I have found:   * More initial work? Not sure..   * It can work slower. Any experience? The benefits:   * We only have the business logic in one place, both for web and api.   * It's easier to scale. We can put each piece on different servers. **Other solutions**   * Duplicate the code and be careful not to forget anything (do tests!)   * DUplicate some code but execute background tasks that updates the related fields and executes other things (emails, indexing...) A "small" detail is we are 1.3 person in backend, for now ;)


title: Are the criticisms against Dart valid?

text: According to this Wikipedia article, Microsoft, Apple, Mozilla, and others criticize Dart, a programming language Google introduced to work in web browsers, because they feel "it seems harmful (cf. VBScript in IE)". But Dart also compiles to Javascript, so a web application written in Dart can run on any modern browser. So are their concerns valid? Can Dart really be a threat to the web's openness?


title: "Imprinting" as a language feature?

text: ## Idea I had this idea for a language feature that I think would be useful, does anyone know of a language that implements something like this? The idea is that besides inheritance a class can also use something called "imprinting" (for lack of better term). A class can imprint one or several (non-abstract) classes. When a class imprints another class it gets all it's properties and all it's methods. It's like the class storing an instance of the imprinted class and redirecting it's methods/properties to it. A class that imprints another class therefore by definition also implements all it's interfaces and it's abstract class. So what's the point? Well, inheritance and polymorphism is hard to get right. Often composition gives far more flexibility. Multiple inheritance offers a slew of different problems without much benefits (IMO). I often write adapter classes (in C#) by implementing some interface and passing along the actual methods/properties to an encapsulated object. The downside to that approach is that if the interface changes the class breaks. You also you have to put in a lot of code that does nothing but pass things along to the encapsulated object. A classic example is that you have some class that implements IEnumerable or IList and contains an internal class it uses. With this technique things would be much easier ## Example (c#)               [imprint List<Person> as peopleList]     public class People : PersonBase      {         public void SomeMethod()         {             DoSomething(this.Count); //Count is from List         }     }           //Now People can be treated as an List<Person>      People people = new People();      foreach(Person person in people)      {       ...      }      peopleList is an alias/variablename (of your choice)used internally to alias the instance but can be skipped if not needed. One thing that's useful is to override an imprinted method, that could be achieved with the ordinary override syntax               public override void Add(Person person)     {          DoSomething();         personList.Add(person);      }      note that the above is functional equivalent (and could be rewritten by the compiler) to:               public class People : PersonBase , IList<Person>     {         private List<Person> personList = new  List<Person>();                   public override void Add(object obj)         {            this.personList.Add(obj)         }             public override int IndexOf(object obj)         {            return personList.IndexOf(obj)         }             //etc etc for each signature in the interface     }      only if IList changes your class will break. IList won't change but an interface that you, someone in your team, or a thirdparty has designed might just change. Also this saves you writing a whole lot of code for some interfaces/abstract classes. ## Caveats There's a couple of gotchas. First we, syntax must be added to call the imprinted classes's constructors from the imprinting class constructor. Also, what happends if a class imprints two classes which have the same method? In that case the compiler would detect it and force the class to define an override of that method (where you could chose if you wanted to call either imprinted class or both) So what do you think, would it be useful, any caveats? It seems it would be pretty straightforward to implement something like that in the C# language but I might be missing something :) **Sidenote - Why is this different from multiple inheritance** Ok, so some people have asked about this. Why is this different from multiple inheritance and why not multiple inheritance. In C# methods are either virtual or not. Say that we have ClassB who inherits from ClassA. ClassA has the methods MethodA and MethodB. ClassB overrides MethodA but not MethodB. Now say that MethodB has a call to MethodA. if MethodA is virtual it will call the implementation that ClassB has, if not it will use the base class, ClassA's MethodA and you'll end up wondering why your class doesn't work as it should. By the terminology sofar you might already confused. So what happens if ClassB inherits both from ClassA and another ClassC. I bet both programmers and compilers will be scratching their heads. The benefit of this approach IMO is that the imprinting classes are totally encapsulated and need not be designed with multiple inheritance in mind. You can basically imprint anything.


title: Are C++ templates just a kind of glorified macros?

text: From different comparisons among C++ templates and C#/Java generics like this one- http://stackoverflow.com/questions/31693/what-are-the-differences-between- generics-in-c-and-java-and-templates-in-c/31929#31929 I got a perception that, C++ templates are implemented by some kind of preprocessing(plain text replacement prior to parsing), not compiling. Because the type checking in C++ templates resembles C macros. I mean, if there are some errors, they are errors from the generated code after processing templated code blocks, not from the templates themselves. In other words, they are just a kind of upper version of macros in C. Then I found some other facts supporting this-   * I thought, if C++ templates are implemented by preprocessing, there will be issues with dynamic linking(using .dll). And a quick googling supported this.   * Another point is, integer constants can be passed as arguments to the templates. And it even supports some kind of recursion. But this recursion is not found in the compiled assembly/machine code. The recursion thing is managed in compile time by generating a functions for every recursive call and thus having a larger but faster executable binary. Though unlike C macros, it has some superior abilities. But isn't C++ template implemented with some kind of preprocessing? How is this implemented in different C++ compilers?


title: What are good interview questions for a Software Tester with focus on automation?

text: Today's testing is not much like yesterday's testing. More services, more distributed systems, more automation. I want the kind of testers that are self-starters and will constantly work themselves out of the job by writing test code. What are good interview questions for the modern software tester?


title: How to create html pages which don't change very much and not very often?

text: I have a Rails server that connects to a json API on another server to get data to build the pages dynamically. These pages, however, don't change very much and not very often. I was thinking I could cut down the page load time, also, cut down the calls to the JSON API significantly if I just periodically called the JSON API and wrote the html files as static html pages. What is a way for building the html files in ruby / rails from scratch?


title: What's the benefit of the Nothing constructor in Haskell?

text: I'm new to Haskell and I'm not really sold on the `Nothing` constructor. It sounds like just another silent fail that's going to create headaches down the line. It seems much more useful to throw an error so I'll have a clue what's happening. Why am I wrong here?


title: Beyond Object Oriented Programming

text: Is there something beyond OOP? In today's world, almost any problem can be solved with OOP as the basis. But how many of them are really effective? For example, Java is purely Object Oriented. It generates the byte code and interprets it. Now, obviously the execution time is greater in Java when compared with C and C++. Problems are of various nature. Some are really computationally intensive, some others are GUI Programming, some want to reduce the response time. So, globally can OOP solve all these or is there a life beyond it?


title: Differences between Software Quality certification levels?

text: First off, thanks for reading the question. I understand that this would theoretically be best asked in the SQA stack area \- but - seeing as how that doesn't officially exist yet, maybe this was the most appropriate place for it for now. I'm looking into tracking down a certification in Software Quality, however, there are so many different awarding bodies and certifications that telling the difference between them is difficult. So far I've found:   * Six Sigma - a QA process, originally founded by Motorola & not limited to software. (in fact I'm not sure if it even covers software development). Based on a series of 'belts' (black being the best, I assume it starts at green? or white?)   * ASQ - American Society of Quality - offers numerous certifications in quality     * CQA - Quality Auditor     * CQE - Quality Engineer     * CQIA - Quality Improvement Associate     * CQI - Quality Inspector     * CQPA - Quality Process Analyst     * CQT - Quality Technician     * CRE - Reliability Engineer   * QAI Global     * Software Testing     * Software Quality Assurance     * Process Engineering     * Process Management With all the different designations and levels, I'm having trouble understanding the differences and the 'start point' and progression between the levels. (Are they a hierarchy or are they in parallell?)


title: Etymology of 'virtual' (method/method table/inheritance)

text: As far as I know, it generally refers to _late_ or _dynamic bindng_. So why a word like _late_ or _dynamic_ wasn't used?


title: What are the great unsolved challenges (or recent promising breakthroughs) of enterprise programming?

text: My experience with programming came from a field, computational linguistics, where there LOTS of unsolved problems (computationally modeling natural language, or having effective statistical approximations). This is not an exception: many other fields (like computational biology) have big unsolved problems, and promising breakthroughs. Yet, most of the programming that is done (and most of the money made from it) seem to be in areas like Enterprise Resource Planning, Client Relation Management..etc. Companies seem to be able to churn out new versions of such software and make more money year after year, and clients keep spending money upgrading to newer versions..etc. So, as an outsider to that world, I am wondering: What are the great advancements spurring this growth? Were there some grand challenges that got solved or are getting solved?


title: Does a method to check the file type being uploaded belong in the controller?

text: If I create a controller that has a method `ActionResult UploadFile(HttpPostedFileBase file)` Where is the best place to add the code that will verify that this is a good and useable file? The reason I ask, is I will have to do more checking than just the file extension. For instance; check number of columns in spread sheet, check column names, etc..


title: Is it better to put the JS code on the html file or in an external file?

text: If I'm designing a one page website, is it better to create external file for my JS code, or just put it in the html code? Is putting it on the page faster to load? Can I change the permissions to deny the users requests for the code, but the html page can still call the code?


title: Why are null references shunned while throwing exceptions is considered okay?

text: I don't quite understand the consistent bashing of null references by some programming language folks. What's so bad about them? If I request read access to a file that doesn't exist then I'm perfectly happy to get an exception or a null reference and yet exceptions are considered good but null references are considered bad. What's the reasoning behind this?


title: Is passing the Model around in this way considered bad practice?

text: If I have a view called, for example, `ViewDetails` that displays user information in labels and has a Model called `ViewDetailsModel` and if I want to allow the user to click a button to edit some of these details, is it considered bad practice is I pass the entire Model in the markup to a controller method which then assigns the values for another model, using the values stored in the Model that was passed in as a parameter to that action method? If so, should there instead be a service method that gets the data required for the edit view? For example: In the `ViewDetails` view, the user clicks the edit button which calls an action method in the controller (and passes in the Model object). The action method then uses the data in the Model object to populate another model which will be used for the `EditDetails` view that will be returned.


title: Is there a case study that convincingly demonstrates that clean code improved development?

text: I'm in my first real job as programmer and what I see is just the "Big Ball of Mud" code (without useful comments too), but I like to do clean code, and it's really hard for me to code in a worse way. I'm searching for some study case where the usage of clean code (I see various definitions here of what is clean code) improved the development and maintainability.


title: best practices for NoSQL database design

text: I have just started using a NoSQL document based database (MongoDB) and i'm curious about the best practices for designing databases. I presume the architecture should be different from relational databases? Should I still aim for a normalized database? For example I have a particular use case; > I have a user with a rental history (array of addresses) should that array > be an array on the user or as a separate collection with a shared key?


title: How to implement a software development process in an existing project?

text: My question involves setting up a Software Development process. If you came in to an existing project that had no formal methodology or process set up, and then were asked to set one up yourself, how would you handle it? I have looked into various methodologies like Agile, or subsets thereof like XP, but these are primarily aimed at how to set up new projects. I am rather unsure how to implement them into an existing project. Also, many of these are aimed at web or desktop applications. My software project is an embedded system, so while many aspects of them are applicable, it is a bit overwhelming trying to figure out which one to use and how to convert it for use in an embedded system. Unit testing on embedded hardware (especially with a Single Board Computer for which no simulator exists) is incredibly difficult, particularly if the software is very far along, and to add a hardware abstraction layer to aid unit testing would involve tearing up the code dramatically. What tips would you have for setting up a Software Development Process for an existing project, for a programmer that knows how to program, but is new to software development process management?


title: Are there any examples of implementing and effectively responding to a "Chaos Monkey"?

text: Jeff Atwood recently wrote a blog post about Netflix's implementation of a "Chaos Monkey". It is a very high level article. I am curious if anyone has actually implemented this technique for testing a system. I guess what Im really trying to ask is: What strategies do you implement to ensure your architecture can survive a part of the system crashing ?


title: Why would you use built-in WebDev instead of local IIS

text: Since starting developing ASP.NET projects I find myself familiar just touching F5 for debugging. I think most of us are learned that way? From then and much later I learned to live with the spooky port number dedication, xx multiple instances of WebDevXX.exe in my notification bar and the relatively slow loading time. Partly by the start-up and partly also the browsing and testing. Who avoided any kind of issues with erroneous PDB file locations? (Breakpoint could not be hit) Not me! I never had a real reason to dispute this. But the project settings tab has always been there. "Web" tab, "Servers". I never touched it. Sometimes I manually entered a port number and or a start page path. Custom IIS Web Server? Custom Web Server? That option looked too spooky to touch. I've now taken the step to kick this absurd thing "WebDev", freshen up my local IIS installation and hooked it into my Visual Studio environment to see and decide what I will loose on this... Surprisingly, I just press F5. The web page opens surprisingly quick (compared to webdev). The breakpoints were hit immediately. Browsing and testing the web app is nearly the same speed as deployed. I thought, "OK I'm Lost with IIS when it came to debug client side content" Again, I was surprised. I put breakpoints in a line of JavaScript. I got a superquick break of code and second later Visual Studio showed the breakpoint to me. My question for discussion is, why are we so automatically using Cassini and what are the drawbacks of local IIS? I say we because I know lot of developers do this - including a few really experienced ones.


title: How do I go from being able to write code to being a good developer?

text: I'm frustrated by the lack of concrete explanations on how to go from being able to script (bash, awk) and write simple applications (c, php, python) to designing and developing larger, more complicated software. It seems that on one side there are programming language books and on the other side there are the software engineering/project management books designed for teams of programmers. I've read plenty of both. I've read the XP/Agile classics and have a decent _theoretical_ understanding of the software development process. I like to read other people's code and can follow it fairly well. But when I have an idea for a project or want to go from "here's the problem/need" to "here's the solution", my mind draws a blank and I don't know where to begin. Do I just hack it out? Are there any structured workflows for individual developers that don't work in teams or for a big software house? I really don't have any desire to get a PMP or work for a software company. I'm just looking for an effective, efficient, practical workflow.


title: Why are the <b> and <i> tags deprecated?

text: This question came up in one of my college classes. The professor only gave the answer that it was more descriptive, but it seems as though `<b>` and `<i>` are rather explicit in their meaning and is easier to type than `<strong>` and `<em>`. **What were the official arguments for the deprecation of these tags?**


title: Lying to get a job

text: I've been looking for a way to get into programming for about a year now. I have about 2 years experience with scripting and programming at home and have been working for an 'IT' company for nearly 2 years. I say IT company loosely. They are an IT company but literally anybody could do the job. My trouble is finding a job without any professional experience (I'm sure most people can relate to this). I've had several interviews this year for help desk roles and devops roles all with the same outcome, "you are good but we need someone with more professional experience". I'm about to apply for a junior software engineering role but want to do things a little differently. I am rubbish at lying and far too honest when it comes to interviews. But I feel like I am needing to lie about my current job to include the things I do at home. I know I can do the jobs I'm applying for, but with no relevant education or proper experience I'm finding it impossible to prove I can do what they need me to do. I recently set up a website which I'm using as a platform to present my work and what I'm doing. I've not really had a chance to show it off to any potential employers yet though. I will definitely work in software development one day and I have no doubts about that because I am so determined. I just want to know if its OK to lie to take a short-cut. In short my question is. Is it OK to lie about what you do at work in an interview as long as you know you are capable of doing it. I've also been looking at going back into education for something computer science related. I already have a degree in Structural Engineering so it's not a decision I want to take lightly considering I'd have to fund it myself, but if it was going to get me a job then I would definitely think it would be worth while. P.S. references aren't a problem for me.


title: Which type of query do wide column stores optimize

text: I have some experience with document based stores (MongoDB and CouchDB) and I am interested in exploring wide column databases. Based on my initial exploration I can grasp a basic understanding of how wide column stores are different, but I do not really understand in which type of operations they are a better fit than an indexed document store. My initial impression is that column stores are better if the column combinations for the queries are highly dynamic (no indexed view really required) and/or if there is a high rate of writing (that triggers map-reduce indexes in a document store). Performance wise, it seems that column stores might be better if I have documents with many properties but not all of them are needed. Document stores seems to promote that the whole document will be retrieved, but not sure how much impact this really has. Maybe the document needs to have many filtered columns to make a difference? Also I got the impresion that column stores "might" be more performant for multi-tenant systems which shared database where one of the columns holds the tenant id and maybe another one the roles. **In which type of queries wide column stores are a better fit against document stores?** **UPDATE** : After reading my own question, I am getting the feeling that wide column stores are very good for the queries done by data analysis applications, where there is a large set of collected data for each entry, only few fields must be extracted and the combination of columns is totally random.