title: Is there an official standard regarding user password storage practices?

text: I recently used a government service that I had an account for from years ago. I couldn't remember my password for the service so I used the "forgot password" link and was astonished to see that this government website sent my password to my email address in plain text. I'm personally aware of how to handle user passwords, and I sent some comments about my concerns through a feedback form (this is a government website. People use other online gov. services which deal with sensitive information, as well as the fact that most people use the same password or handful of passwords for everything (I know I do) and I suspect the same security practices are used throughout) which I got a prompt response for. They simply reassured me that "the Ministry has taken the necessary steps to protect password information, including storing them with the proper encryptions in place." I'd like to just say "well obviously you haven't taken the necessary steps if you're able to email my password to me" but I'm not trying to be rude, and I don't think my message would ever reach somebody who knows what I mean anyway. So I'd like to just state that "the necessary steps haven't been taken according to [some official security standard]" which might prompt someone to look into it. I did a quick search on OWASP but only found an article regarding plaintext storage. Is there a security standard regarding user password handling out there which prohibits (as I think it probably would) storage of retrievable password information? Even better: is there such a standard which _must_ be followed by websites dealing with sensitive information such as banks and government web services? I know I probably won't change anything but it's worth a shot IMO.


title: How does thinking on design patterns and OOP practices change in dynamic and weakly-typed languages?

text: There is a fairly helpful question already along these lines ("Non-OOP Design Patterns?"), but I am more curious about a transitional point of view for someone just getting started with dynamic and weakly-typed languages. That is: let's say I've been programming in C++, C#, or Java for many years, and absorbed lots of wisdom along the lines of the GoF design patterns, Fowler's _Patterns of Enterprise Application Architecture_ , SOLID principles, etc. Now I'm dabbling in Ruby, Python, JavaScript, etc., and wondering how my knowledge applies. Presumably I could do direct translations in many cases, but almost certainly that wouldn't be taking full advantage of my new setting. Duck typing alone turns a lot of my interface-based thinking on its head. What stays the same? What changes? Are there guiding principles like SOLID, or canonical patterns (perhaps entirely new ones) that a dynamic language newbie should know?


title: Should I modify an entity with many parameters or with the entity itself?

text: We have a SOA-based system. The service methods are like:   1. `UpdateEntity(Entity entity)` For small entities, it's all fine. However, when entities get bigger and bigger, to update one property we should follow this pattern in UI:   1. Get parameters from UI (user)   2. Create an instance of the Entity, using those parameters   3. Get the entity from service   4. Write code to fill the unchanged properties   5. Give the result entity to the service Another option that I've experienced in previous experiences is to create semantic update methods for each update scenario. In other words instead of having one global all-encompasing update method, we had many ad-hoc parametric methods. For example, for the `User` entity, instead of having `UpdateUser (User user)` method, we had these methods:   1. `ChangeUserPassword(int userId, string newPassword)`   2. `AddEmailToUserAccount(int userId, string email)`   3. `ChangeProfilePicture(int userId, Image image)`   4. ... Now, I don't know which method is truly better, and for each approach, we encounter problems. I mean, I'm going to design the infrastructure for a new system, and I don't have enough reasons to pick any of these approaches. I couldn't find good resources on the Internet, because of the lack of keywords I could provide. What approach is better? What pitfalls each has? What benefits can we get from each one?


title: Should integer divide by zero halt execution?

text: I know that modern languages handle integer divide by zero as an error just like the hardware does, but what if we could design a whole new language? Ignoring existing hardware, what _should_ a programming language does when an integer divide by zero occurs? Should it return a NaN of type integer? Or should it mirror IEEE 754 float and return +/- Infinity? Or is the existing design choice correct, and an error should be thrown? Is there a language that handles integer divide by zero nicely? **EDIT** When I said ignore existing hardware, I mean don't assume integer is represented as 32 bits, it can be represented in anyway you can to imagine.


title: In an MVC architecture, how closely coupled are the Model and View to the Controller?

text: I've got an app which uses MVC, but I'm struggling a little as to how the controller should be architected. For example, the View is only viewing some subset of the model's data at once. However, I'm unsure as to exactly how this should be arranged. Is it normal for the View or Model to directly call functions on the Controller, for example? Through some sort of interface? Or are they totally encapsulated and never know about the Controller or each other? Just as an edit; this is a custom app not written in any web framework, so I'm not looking for framework-specific details here and have the freedom to make my own choice.


title: Why don't we use dynamic (server-side generated) CSS?

text: As server-side generated HTML is trivial (and it was the only way to make dynamic webpages before AJAX), **server-side generated CSS** is not. Actually, I've never seen it. There are CSS compilers, but they generate CSS files which can be used as static. Technically, it requires no special libraries, the HTML _style_ tag should reference to the PHP(/ASP/whatever) templater script instead of the static CSS file, and the script should send out CSS _content-type_ header - that's all. Does it have cache problems? I don't think so. The script should send out _no- cache_ etc. headers. Is it problem for designers? No, they should edit the CSS template (as they edit the HTML template). Why we don't use dynamic CSS generators? Or if there's any, please let me know.


title: How to talk to management about using integrated project management/bug tracking

text: **Background:** I have just started at a new shop, where there is one other developer. This shop was not historically a software shop, and their software development process really shows it. They recently started using subversion (although most of the code is not in a repository), and they do not have a bug tracker. They sell desktop software, and more recently mobile GPS devices with proprietary software. This seems pretty unsustainable. **My problem:** My manager seems amenable to installing Trac and integrating it with subversion. He's asked me to write a proposal for the company owners about it to justify why I might spend my valuable time fiddling with a Trac installation, and why we might change the development process to include formal bug reports and feature requests. I have been trying to come up with reasons that matter to people other than me (e.g., not: "So I can see the whole story about why someone wrote this now- buggy code.") and sort of falling flat. I'm not a manager, and I don't know a lot about managing things. I just want to avoid the headaches attendant with coding in the wild west. **My Question:** How do I (politely) tell managers that it's in their best interest to use Trac?


title: Is too much whitespace a bad thing?

text: I'm often told by my friends and colleagues that I use way to much whitespace. I guess I do use a little _too_ much whitespace. I often add a line break almost after every line and large blocks of whitespace, often 3 or 4 lines because it helps me see what I've written and understand what I've written when I look back on it at a later time. I also think it just looks cleaner. Although I can see two issues with this, 1) It can increase the file size of the source files, even just a line break every two or three lines can add up in a long file. I know that a good compiler will optimize all the white space out (I'm not actually sure, I think LLVM/Clang does this) but the source file is still large. And 2) it may cause some people to think I'm embellishing my code to make it look longer and "bigger" to make others think I'm doing more work than I actually am (consider 3000 lines vs. 6000 lines, 3000 being newlines). Which I am not doing that by the way. Is using too much whitespace bad from a technical standpoint and/or a professional standpoint?


title: How do I go about choosing a development lifecycle model model?

text: Based on this question about alternatives to the agile philosophy and its answers and comments I thought it might be useful to discuss what goes into the decision of what "methodology" to use when at the start of the project. Seems the consensus is that if what you are building requires exact specifications that waterfall is the way to go over agile. That seems to leave a HUGE space for agile development. Beyond "this is how are shop develops software" are there questions or "indicators" at the early planning stage that might give a better indication of what might work best for the client/project? Like with languages the idea is best tool for the job so as professional developers what do you do to make sure you're using the correct development methodology for a project you're about to start? Is it really as cut and dry as "if it's a bridge or nuke reactor type project use waterfall else use agile? I am a self taught programmer working for company that gives a lot of flexibility and they put a lot of trust in me so this kind of question is important to me. I want to make sure I am addressing my work/projects in the most efficient cost/time manner as possible.


title: Should I use different projects for building different layers in a 3-layer model?

text: I am creating a new project from scratch and have decided to use a 3-layer model. I am using:   * the 1st layer for business entities,   * the 2nd layer for business logic,   * and the 3rd layer for data logic layer. Do I need to create different projects for these different layers or do I need to create different _folders_ in one project? What are the pros and cons of both approaches?


title: Difference between mutex in windows and linux

text: Is that correct that a mutex object in Linux cannot be used for cross process synchronization as opposed to its Windows counterpart? If that is true - what was the idea to limit mutex synchronisation functionality on Linux?


title: git in non-distributed, independent, lone programming ...best practice(s)?

text: I am currently studying the git documentation to get a hang of distributed version control workflow and use of git command line. I want to first start using git with small, personal, pet projects so to gain experience before doing it on large scale (i.e., bigger projects, team dev). What areas of the git system should I, as a lone player, devote most of my study time to... what parts should I leave for the larger scale work later on. In other words what features of the git system will fully be grasped in team work only, and therefore should not be too involved with at an individual level?


I heard about the Supreme Court's decision today in the Microsoft vs. i4i case, so I read the relevant patent and was surprised it appears to just keep formatting codes in a separate table with pointers instead of leaving the formatting codes embedded in the text. I'm surprised no one else did that before 1998, thereby invalidating the patent, and that Microsoft couldn't uncover an example of such a system. I recall a micro-based word processor a friend and I were going to build in the 70's (never finished because the hardware never worked), and I definitely considered the tradeoff between keeping format stuff separate vs. embedded, so I would think someone in the subsequent 20 years (if not before) did likewise and actually wrote such a system. Didn't anyone implement formatting codes separate from the text before 1998?


title: When counting function points, is my website menu an External Input?

text: I'm doing a function point count for a large website. Does the main website menu count as an External Input? I'm doing a function point count as described in this article. If so, since you only click on one menu item at a time, I assume the number of DETs == 1?


title: Linux OpenGL programming, should I use GLX or any other?

text: I'm new to OpenGL and found that there are a lot of libraries to do that in C, and I also found that glx is most friendly with Linux X Server, I just want to do basic stuff, and I cannot find any tutorials for GLX. Is GLX a bad thing? I just want to do some small graphical things without installing many libraries and getting confused. Can anyone suggest me something which has tutorials and simple to compile? I found a link with an example with GLX and it worked perfect with no errors: anyone please suggest where I can find nice documentation or any better libraries.


title: CTO has left — codebase is a huge kludge, any advice on how to manage/handle/damage control?

text: I began work at a company 2 months ago as a PHP developer. I stepped in to somewhat of a kludge, but I've yet to find a company that isn't... The development stable is currently two developers (including myself) who will act as the interim CTO while the company seeks out a replacement CTO. The company is a news site that runs on top of an inhouse WordPress theme with enhancements in the form of arbitrary plugins, features built into the actual theme, and plugins some built in-house and some 3rd party ((some whose core code has been modified, which renders upgrading a nightmare). No coding standards have been upheld in the creation of the WordPress code and it appears that it has been a number of developers managing the code and no two components are completed using the same methodology, which is beyond a huge mess when it comes to debugging. I am the "WordPress" developer. The other developer is in charge of the latest foray which is developing an e commerce platform to complement the news site, which will be run on top of Magento. As the only WordPress developer I am handling all bugs and feature requests on a prioritized basis - I am interacting with business directly to hammer this out. The biggest issue I foresee is any bug/enhancement/project that is deemed a priority and requires a significant amount of work (read: 1 week+) becomes a bottleneck and essentially nothing can get worked on until I complete the project. They say that they understand that now but I foresee that becoming an issue when they actually see it in practice. I am looking towards the future and fully expect it to become a stressful situation (14+ hour days 7 days a week anyone?) - which is something I need to avoid at all costs. Until we restaff a CTO or I am considering proposing that I write up coding standards for the WordPress development and utilize odesk or another outsourcing solution for handling feature requests - ensuring they conform to the standards set forth. In the proposed environment I will (a) manage the odesk developers (ensure I communicate exactly what is needed, ensure they are coding to proper standards) (b) handle any quick feature requests / bug fixes (c) begin refactoring the WordPress code so that it conforms to the aforementioned in-house coding standards - to get us to a manageable state. The company has used outsourcing solutions in the past, so I am confident that the idea of using one would not be an issue. At this point I am only forumlating the plan to propose to management -- not yet thinking of HOW to do what I accomplish - I just want to get the full OK from them before doing that. What are your thoughts on this plan? Is there anything else that I should think about/consider? Thanks.


title: Storing n-gram data

text: (hopefully I landed on the right stack exchange site) I was hoping to brainstorm a little bit on the subject of storing n-gram data. In my project, I am trying to solve linguistic problems where I know all ( _n_ -1) data items and want to statistically guess my _n_ using linear interpolation over all applicable n-grams. (Yes, there is a tagger that assigns tags to known words according to its lexicon and a suffix tree that tries to guess the word kind for unknown words; the n-gram component discussed here will be tasked with resolving ambuguity.) My initial approach would be to simply store all observed n-grams (for _n_ = 1..3, i.e. monogram, bigram, trigram) data in respective SQL databases and call it a day. But the requirements of my project may change to include other vector lengths ( _n_ ), and I would like my application to adapt to 4-gram without a lot of work (updating schema, updating application code, etc.); ideally, I would simply tell my application to work with 4-grams now without having to change code much (or at all) and train its data from a given data source. To sum up all requirements:   * Ability to store _n_ -gram data (initially for _n_ = {1, 2, 3}   * Ability to change what kinds of n-grams should be used (between application runs)   * Ability to (re-)train n-gram data (between application runs)   * Ability to query the data store (e.g. if I have observed A, B, C, I'd like to know the most frequently observed item for what might follow using my trained 4-, 3-, 2-, 1-gram data sets) The application will most likely be read-heavy, data sets most likely won't be retrained that often   * The solution employs the .NET Framework (up to 4.0) Now what design would be better fit for such a task?   * A fixed table managed by a SQL server (MSSQL, MySQL, ...) for each _n_ (eg. dedicated tables for bi-grams, tri-grams, etc.)   * Or a NoSQL document database solution that stores the first _n_ -1 as the key of the document, and the document itself contains the _n_ -th value and observed frequencies?   * Or something different?


title: Why is x=x++ undefined?

text: It's undefined because the it modifies `x` twice between sequence points. The standard says it's undefined, therefore it's undefined.   That much I know. ### But why? My understanding is that forbidding this allows compilers to optimize better. This could have made sense when C was invented, but now seems like a weak argument.   If we were to reinvent C today, would we do it this way, or can it be done better?   Or maybe there's a deeper problem, that makes it hard to define consistent rules for such expressions, so it's best to forbid them? So suppose we were to reinvent C today. I'd like to suggest simple rules for expressions such as `x=x++`, which seem to me to work better than the existing rules.   I'd like to get your opinion on the suggested rules compared to the existing ones, or other suggestions. ### Suggested Rules:   1. Between sequence points, order of evaluation is unspecified.     2. Side effects take place immediately.   There's no undefined behavior involved. Expressions evaluate to this value or that, but surely won't format your hard disk (strangely, I've never seen an implementation where `x=x++` formats the hard disk). ### Example Expressions   1. `x=x++` \- Well defined, doesn't change `x`.   First, `x` is incremented (immediately when `x++` is evaluated), then it's old value is stored in `x`.   2. `x++ + ++x` \- Increments `x` twice, evaluates to `2*x+2`.   Though either side may be evaluated first, the result is either `x + (x+2)` (left side first) or `(x+1) + (x+1)` (right side first).   3. `x = x + (x=3)` \- Unspecified, `x` set to either `x+3` or `6`.   If the right side is evaluated first, it's `x+3`. It's also possible that `x=3` is evaluated first, so it's `3+3`. In either case, the `x=3` assignment happens immediately when `x=3` is evaluated, so the value stored is overwritten by the other assignment.   4. `x+=(x=3)` \- Well defined, sets `x` to 6.   You could argue that this is just shorthand for the expression above.   But I'd say that `+=` must be executed after `x=3`, and not in two parts (read `x`, evaluate `x=3`, add and store new value). ### What's the Advantage? Some comments raised this good point.   I certainly don't think expressions such as `x=x++` should be used in any normal code.   Actually, I'm much more strict than that - I think the only good usage for `x++` in as `x++;` alone.   However, I think the language rules must be as simple as possible. Otherwise programmers just don't understand them. the rule forbidding changing a variable twice between sequence points is certainly a rule most programmers don't understand.   A very basic rule is this:   If A is valid, and B is valid, and they're combined in a valid way, the result is valid.   `x` is a valid L-value, `x++` is a valid expression, and `=` is a valid way to combine an L-value and an expression, so how come `x=x++` isn't legal?   The C standard makes an exception here, and this exception complicates the rules. You can search stackoverflow.com and see how much this exception confuses people.   So I say - get rid of this confusion. === Summary of Answers ===   1. Why do that?   I tried to explain in the section above - I want C rules to be simple.   2. Potential for optimization:   This does take some freedom from the compiler, but I didn't see anything that convinced me that it might be significant.   Most optimizations can still be done. For example, `a=3;b=5;` can be reordered, even though the standard specifies the order. Expressions such as `a=b[i++]` can still be optimized similarly.     3. You can't change the existing standard.   I admit, I can't. I never thought I can actually go ahead and change standards and compilers. I only wanted to think if things could have been done differently.


Any one ever heard of the term collapsed Backbone? Could it be a virtual network that could be referred also to this term.


title: Software bug/defect classification

text: We're trying to come up with terms that better describe our bugs/defects. To us, the term 'bug' or 'defect' is too generic and doesn't accurately reflect what is happening. For example, instead of saying that there is a bug (in the general sense), we'd rather say what type of bug (an error, or enhancement, or improvement, etc.). What names do you use for describing 'bugs'? We found http://www.softwaredevelopment.ca/bugs.shtml which has some pretty good classifications. How do you classify them?


title: Asset licensing and GPL compatibility

text: If I want to bundle fonts and images with an application released under the GPL, are there specific requirements for the license of these assets?


title: Are there any alternatives to Hibernate Envers 3.6.2.Final?

text: I'm currently evaluating Hibernate Envers 3.6.2.Final; an auditing module part of Hibernate. As far as I am in my evaluation, I feel a _little_ disappointed by Envers. I would expect much more from it :   1. More _clear_ documentation     * The documentation is sparse or unclear; lack of small drawings in the document   2. More activity from the community     * I have waited two days for having an answer from... the creator on the forum. Is he a busy man or there is nearly no people out there?   3. Much powerful and flexible API     * Querying the historical data is painful. I have to rely on direct SQL to achieve a simple "select field, count(id) from table_aud group by field" Do you know any equivalent or do you want to share your thougths with me ?


title: Is this right in the use case of exec method of child_process? is there away to cody the envirorment along with the require module too?

text: I'm learning node. I am using child_process to move data to another script to be executed. But it seem that it does not copy the hold environment or I could be doing something wrong. To copy the hold environment --require modules too-- or is this when I use spawn, I'm not so clear or understanding spawn exec and execfile --although execfile is like what I'm doing at the bottom, but with exec... right?-- And I would just love to have some clarity on this matter. Please anyone? Thank you. **parent.js** -               "use strict";          var fs, path, _err;     fs = require("fs"),      path = require("path"),      _err = require("./err.js");               var url;     url= process.argv[1];          var dirname, locate_r;     dirname = path.dirname(url);     locate_r = dirname + "/" + "test.json";//path.join(dirname,"/", "test.json");          var flag, str; flag = "r", str = "";     fs.open(locate_r, flag, function opd(error, fd){         if (error){_err(error, function(){             fs.close(fd,function(){             process.stderr.write("\n" +              "In Finally Block: File Closed!" + "\n");});})}         var readBuff, buffOffset, buffLength, filePos;         readBuff = new Buffer(15),         buffOffset = 0,         buffLength = readBuff.length,         filePos = 0;         fs.read(fd, readBuff, buffOffset, buffLength, filePos,         function rd(error, readBytes){             error&&_err(error, fd);             str = readBuff.toString("utf8");             process.env.str = str;             process.stdout.write("str: "+ str + "\n" + "readBuff: " + readBuff + "\n");             fs.close(fd, function(){process.stdout.write(                 "Read and Closed File." + "\n"                 )});             //write(str);             //run test for process.exec**             var env, varName, envCopy, exec;             env = process.env,             varName,             envCopy = {},             exec = require("child_process").exec;             for(varName in env){                 envCopy[varName] = env[varName];             }             process.env.fs = fs,             process.env.path = path,             process.env.dirname = dirname,             process.env.flag = flag,             process.env.str = str,             process.env._err = _err;             process.env.fd = fd;             exec("node child.js", env, function(error, stdout, stderr){                 if(error){throw (new Error(error));}         });         });     });      **child.js** -               "use strict";          var fs, path, _err;     fs = require("fs"),      path = require("path"),      _err = require("./err.js");          var fd, fs, flag, path, dirname, str, _err;     fd = process.env.fd,     //fs = process.env.fs,     //path = process.env.path,     dirname = process.env.dirname,     flag = process.env.flag,     str = process.env.str,     _err = process.env._err;               var url;     url= process.argv[1];          var locate_r;     dirname = path.dirname(url);     locate_r = dirname + "/" + "test.json";//path.join(dirname,"/", "test.json");          //function write(str){     var locate_a;     locate_a = dirname + "/" + "test.json"; //path.join(dirname,"/", "test.json");     flag = "a";     fs.open(locate_a, flag, function opd(error, fd){         error&&_err(error, fs, fd);         var writeBuff, buffPos, buffLgh, filePs;         writeBuff = new Buffer(str),         process.stdout.write(             "writeBuff: " + writeBuff + "\n" + "str: " + str + "\n"),         buffPos = 0,         buffLgh = writeBuff.length,         filePs = buffLgh;//null;         fs.write(fd, writeBuff, buffPos, buffLgh, filePs-3,         function(error, written){             error&&_err(error, function(){             fs.close(fd,function(){             process.stderr.write("\n" +              "In Finally Block: File Closed!" + "\n");                 });             });             fs.close(fd,              function(){process.stdout.write(                 "Written and Closed File." + "\n");});         });     });     //}      **err.js** -                "use strict";         var fs;         fs = require("fs");              module.exports = function _err(err, scp, cd){             try{                 throw (new Error(err));              }catch(e){                 process.stderr.write(e + "\n");             }finally{                 cd;             }         }


title: Dependency Inversion Principle

text: I have been studying also S.O.L.I.D. and watched this video:   https://www.youtube.com/watch?v=huEEkx5P5Hs 01:45:30 into the video he talks about the Dependency Inversion Principle and I am scratching my head??? I had to simplify it(if possible) to get it through this thick scull of mine and here is what I came up with. Code on the marked My_modified_code my version, code marked Original DIP video version. Can I accomplish the same with the latter code? Thanks in advance. Original:               namespace simple.main     {          class main         {             static void Main()             {                 FirstClass FirstClass = new FirstClass(new OtherClass());                 FirstClass.Method();                 Console.ReadKey();                      //tempClass temp = new OtherClass();                 //temp.Method();             }         }               public class FirstClass          {              private tempClass _LastClass;              public FirstClass(tempClass tempClass)//ctor              {                  _LastClass = tempClass;              }                   public void Method()              {                  _LastClass.Method();              }          }              public abstract class tempClass{public abstract void Method();}              public class LASTCLASS : tempClass         {             public override void Method()             {                 Console.WriteLine("\nHello World!");             }         }              public class OtherClass : tempClass         {             public override void Method()             {                 Console.WriteLine("\nOther World!");             }         }     }      My_modified_code:               namespace simple.main     {          class main         {             static void Main()             {                 //FirstClass FirstClass = new FirstClass(new OtherClass());                 //FirstClass.Method();                 //Console.ReadKey();                      tempClass temp = new OtherClass();                 temp.Method();             }         }               //public class FirstClass          //{          //    private tempClass _LastClass;          //    public FirstClass(tempClass tempClass)//ctor          //    {          //        _LastClass = tempClass;          //    }               //    public void Method()          //    {          //        _LastClass.Method();          //    }          //}              public abstract class tempClass{public abstract void Method();}              public class LASTCLASS : tempClass         {             public override void Method()             {                 Console.WriteLine("\nHello World!");             }         }              public class OtherClass : tempClass         {             public override void Method()             {                 Console.WriteLine("\nOther World!");             }         }


title: How to find out if a company has insane policies

text: When interviewing for a job, is there a delicate yet accurate way to find out if they have insane policies, like "no open source", or "no installing software without permission", "not upgrading software until it's about to lose support", or "no visiting blogs"?


title: Ruby or Python?

text: This question is extremely subjective and open-ended. It might even sound like something I should just research for myself and make my own decision. But I'd like to put it out there and get some thoughts from others. Long story short - I burned out with the rat race and am on a self-funded sabbatical this year. Much of it is to take a break from the corporate grind and travel around, but I also want to play around with new technologies and do some self-learning projects, to stay up to speed on programming, and well - I just love tinkering with programming, when there's no pressure! Here's the thing: I am a lifetime C/C++/Java programmer. I'm a bit of a squiggly bracket snob since I've been working with this family of languages for my entire programming career. So I'd like to learn a language which isn't so closely syntactically related to this group. What I'm basically looking for is a language which is relatively general purpose, fun to learn, has some new concepts that are different from C++/Java, and has a good community. A secondary consideration is that it has good web development frameworks. A tertiary consideration is that it's not totally academic (read: there are real world jobs out there using it). I've narrowed it down to Ruby or Python. My impression of Ruby is that it is extremely web oriented - that the only real application of it is as a server side scripting language for doing web stuff (mainly Ruby on Rails). I don't have much of an impression of Python at all, except that it seems to have a passionate fan base and appears to be a fairly versatile language. **TL;DR** and to put it as succinctly as possible: which of these would be better for a C++/Java guy to learn to get some new perspectives on programming? And which is more open and general purpose and applicable to a wider set of applications? I'm leaning towards Ruby at the moment, but I worry to an extent that it looks like it's used as nothing but a server side web language.


title: Is MVC ever considered/applied system-wide?

text: I was having a discussion with a colleague and he bought up the topic of MVC and the use of ViewModels in ASP.NET MVC. The discussion was that, in an n-layer architecture, the UI, Business Layer and Data Access Layer are individual assemblies/projects and ViewModels are the UI's representation of a database/business object. The discussion on whether ViewModel's are useful moved into a discussion about how MVC should be applied. In my version (which is what I am used to/have seen elsewhere) takes into account separation of concerns and waterfall dependencies, where the UI project references the BLL, the BLL references the DAL and possibly all of them reference an "Entities" project. "MVC" is restricted to the UI. That is, the notion of "Models" (in my version, they are technically just ViewModels), "Views" and "Controllers" are individual files/objects in the UI layer. The BLL talks in terms of database entities and the UI will generally contain helpers that map a ViewModel to an entity. My colleague's version took this to the system/layer level, where the "Model" is the DAL, the "View" is the entire UI and the "Controllers" are the BLL as a whole. Given that in an MVC triad, the Model is unaware of Views or Controllers, the Views know about Models and the Controllers know about both.. does the system- level application of MVC not violate modular programming concepts/code reusability (disregarding the possible circular dependency issues)? Are patterns such as MVC applied at a system level often? My understanding was that MVC and related patterns were more often applied purely to the UI and not spread out across an entire n-layer system. By the way, we had a look at this question: What is MVC, really? ..but we also seem to disagree on whose argument the answers to this question supports! :) I could be just stuck in my little tiny .NET-oriented world and cannot see the bigger picture, so I would like to hear some thoughts on this.


title: We have a large Ruby on Rails application (25 million monthly users), our management decided to rewrite in Node.js, am I crazy?

text: Please tell me if:   * Node.js will make our site faster!   * Node.js will consume fewer server resources, we can save money!   * Node.js will make us more productive!   * Node.js means we can share client and server side JavaScript code. To clarify, we're rewriting a frontend server, which will talk to our existing Ruby on Rails application as an API. Meanwhile, we'll refactor our Ruby on Rails application into services. More details on the existing architecture:   * Memcached for HTML partials caching   * Redis for session, and some structured data caching   * MySQL single master, multiple slaves      * There's one large table that accepts a lot of writes (imagine a poll)     * Otherwise mostly reads.   * MongoDB for some metadata   * Ruby on Rails 3.0   * nginx and Unicorn


title: What should we include in SSAS cube design documentation?

text: What should we include in a SSAS cube design documentation? This is the initial phase of the document. I have included:   * data models,   * facts,    * dimensions,   * surrogate keys,   * hierarchies and levels within hierarchies,   * reports that we can pull from the cube,   * proactive caching. What else can we include?


title: Java or C++ for university CS courses?

text: I'm in the throes of getting myself enrolled in school to get a CS degree. The school I am looking at actually offers both Java- and C++-based for the introductory software development courses (object-oriented programming, design patterns, that sort of thing). It is student's choice which track to follow, but there is only time to follow one. _Knowing what you know now, if you had the choice, would you lay down your CS curriculum foundation in Java or C++?_ My current debate currently looks like this: A good friend (who has a PhD in AI) is touting Java as the better choice regardless of what I do, if only to open up more job opportunities later, though he might be biased since all of his work has been in Java (he loves it). I live in the Boston, MA, USA area and I see an equal amount of Java and C work. On the flip side, although I haven't entirely yet settled on what I want to do with the degree when I'm done, my preference would be to develop for the Mac, which I am doing now albeit in a limited capacity. To that end, I'm getting some limited exposure to C++ already, but I've had none with Java, and looking at my projects at my day job I don't see a need to use it anytime soon, "soon" measured by at least two years. I probably should note that I'm an adult going back to school after 20 years (I currently have _no_ degree of any kind) so I'm looking to maximize the opportunity and time spent as best I can. I'm kind of leaning towards C++ but I'm still ambivalent, and some outside, objective advice would help here. Or I could just be thinking too hard about it. **UPDATE:** It turns out the language selection wasn't so clear cut as I originally surmised. While a couple of core courses focused on Java, some of the other core courses work in primarily C and Java, but also a few others thrown in for good measure. In fact, my rest of my semester is going to be in Objective-C after spending time in Java and Javascript. Last semester was C, Javascript, and PHP, plus a few others thrown in as assignments required. Since things were pretty much split down the middle overall, and I am still getting answers to this, I am now trying to work my curriculum such that I meet all of the requirements for the degree but to absorb as many languages as I can reasonably handle. So far, my grades have not suffered trying to do this.


title: Can SQL Server and Mongo be used together?

text: We have a large news-oriented site that has high web traffic. The architecture is your often seen DB - Repo Layer - Services Layer - Asp.Net MVC. The problem that we've been seeing is around read performance. It turns out that all this DDD domain object stuff is great, in theory, for business rules, but has made life harder when it comes to optimizing read performance. As a solution, I'm considering something entirely new (for us): using noSQL. I'd like to use a noSQL database for data being presented on our website. We can't get rid of our SQL Server (at least not anytime soon), but it seems to me that a practical step would be to use Mongo as a query database for all new development. My question is whether it is possible to use SQL Server as your database of record and Mongo as your query database **together**? So when one of our editors updates a record, the data will be stored in SQL Server. This is necessary, because there is too much legacy code that cannot be re-written overnight. But when a viewer on the web site views an article or a list of articles, I'd like to take advantage of the performance of Mongo versus SQL Server. In order to keep data somewhat current, let's say 15 minutes old or less, SQL Server data would need to refresh Mongo. RDBMS have replication tools for operations like this and I'm wondering if there exists anything to do the same from SQL Server to Mongo. Lync server, maybe?


title: How do I get started with HTML5?

text: What is the recommended workflow to learn HTML5? What tools should I install? What SDK? Where to start? How to test? How to debug? What do I read? I understand that what is often labelled as "HTML5 development" is in fact a mixture of HTML, CSS, JS and more, however I don't believe that bigger projects are developed in Notepad. That is why I am asking you to reveal your tips and tricks about your workflow.


title: What are the best practices regarding unsigned ints?

text: I use unsigned ints everywhere, and I'm not sure if I should. This can be from database primary key id columns to counters, etc. If a number should never be negative, then I will always used an unsigned int. However I notice from other's code that no one else seems to do this. Is there something crucial that I'm overlooking? Edit: Since this question I've also noticed that in C, returning negative values for errors is commonplace rather than throwing exceptions as in C++.


title: Why can't the PHP engine handle HTTP communication?

text: The PHP engine interprets the PHP code and is perfectly capable of working with sockets, forming HTTP packets, etc. Why then do we need a separate Apache server, when the http serving duties could be embedded into the php application along with the page creation code?


title: Can you recommend a good commit message template / guidelines to enforce in the company?

text: In Git it's possible to set and enforce a good commit template. Can you recommend (preferably with argumentation) a good commit template / guidelines to enforce in the company?


title: c# class naming standards/guidelines

text: Over the years I've used various naming conventions for services in my applications for example:               [ClassName]Service       [ClassName]Manager       [ClassName]Factory       [ClassName]Provider       [ClassName]Helper      I generally only use the "Helper" suffix for utility classes that have no external dependencies. However I find that there is a bit of a cross-over between the others, and wondered if there was any recommendations/standards/guidelines on what to use and when?


title: Does Google Code source hosting have an API like Github

text: I looked and looked, and perhaps I am dense, but I could not find an API for open source projects on Google Code, similar to that offered by Github. Does it exist?


title: Automated Testing: Explaining its Business Value

text: To start I don't think this is a repeat of other questions on unit testing. What I'm looking for help with is articulating its value to a team of programmers, analysts, managers and testers. By automated tests, I don't think I need to make a distinction between unit tests (e.g. JUnit), BDD (e.g. JBehave, Fitness) and UI (Selenium , Watir) because I think they all provide similar value (but feel free to write an answer that disagrees :)) The following is a list I've identified, I'm looking for answers that help expand or refine:   1. **Time/Cost Savings** : writing automated tests can take more time than written test cases. However, considering tests are run multiple times, the marginal work (i.e. cost/time) to _execute_ automated tests is several orders of magnitude less. That the automated tests are cheap to run facilitates _changing_ the system over time.   2. **Documentation** : there is no truer way to know how a system works than its tests. Any other documentation is usually out of date the moment its written, but tests (at least those that pass) reveal how things actually work. This is true for both end-user AND API documentation.    3. **Code Quality** : test writing forces you to:      * consider clients because tests are a client     * breaks dependencies where making code testable often means figuring out how to make that code not require some other large system be available


title: Shortcomings of using dynamic types in C#

text: I have been recently studying more on the dynamic types in C#. With some examples I understood once the code is compiled, it does not need to be recompiled again but can be executed directly. I feel the flexibility provided by the keyword to actually be able to change data type at will is a great advantage. Question, Are there **any specific shortcomings** apart from wrong dynamic method calls which throw run time exceptions **which developers must know** before starting the implementation.


title: How, when, and why do developers use custom data structures in python?

text: Python's lack of pointers makes data-structure construction intuitively more challenging, and has so much built in functionality that, as an amateur, I can't see when, why, or how you would create something beyond what's already there. When have you built your own, and why did you do it? E.g. special types of trees, etc.


title: Non Blocking Sockets vs Blocking sockets - UDP - C&linux

text: When to use blocking sockets over non blocking sockets on UDP? Question 1:What's is recommended for the following scenario ? Multiple clients send data over multiple UDP sockets, i.e. say client1 sends data over sockets 100, 101, 102,..,105 . client2 on sockets 110,111,112...115 etc. Port numbers are fixed for clients. Number of clients are fixed(10). So totally 10 * 5 sockets. Data on each sockets(atleast 3 sockets) is sent every few milliseconds. The other 2 sockets are for sending commands and getting data. After receiving the data there is some IO involved where i write to disks. (I cant change any of the above. i.e. number of sockets ,etc ) Question 2:Is it best to use Threads for this scenario (or) Asynchronous IO multiplexing with nonblocking sockets?


title: Versions of .NET in an Interview

text: Interviews are full of an array of different types of questions. What I'm curious about is what people think about asking an interviewee about the differences in .NET versions. For instance, asking what was new in .NET V2.0 to 3.0 and then from 3.0 to 3.5 and so on. Is this a good interview question to find out what a person knows about the .NET world? As V2.0 was released in 2005, I start to wonder how valid it is to ask about what was new in a release done 6 years ago. Is it a good question at guaging a developers knowledge or just his/her memory?


title: How to credit other authors in an open source project

text: I have a pet project that I am planning to release as open source at some point in the not-too-distant future. A couple of the files use or are mostly code that was taken from a project released under the New BSD License. While I have changed it to fit my needs and added some small stuff, the algorithm and the functionality is basically exactly the same. I want to make sure that the author of the code gets credit and that the license is not broken, but I also want to make the reader aware that this is not the code as it was orignally released. How should I approach this? Should I isolate the code as much as possible and just retain the original license? Maybe put all the files that contain foreign code in their own folder and add a readme explaining what has been added/removed? There must have been tons of projects using other open source code. What is the standard approach to this?


title: Are there any industry standards that define code quality?

text: Our specific situation is that we are creating an agreement between ourselves and another team for shared control or use of a PHP based web application that we have been building. We have a set of standards and conventions documented in our technical specs. However, I have been asked to define them in terms of an industry standard. I am aware of different terminology for coding conventions. Hungarian notation, CamelCase, for example. And some defined standards for very specific things, PSR-0 for example covers namespaces in PHP. It seems the point is to try to give us stronger ground in the agreement, by pointing to industry standards rather than an arbitrary standard we set forth. They're looking for things like the PSR-0 or an ISO#### or IEEE#### that we can point to. My personal concern is that I've spent the time working with the team to show them the standards we have and to get buy in on the bigger parts of it. So I'm worried we'll either end up having to conform to some standard that doesn't match how we like to program, or the better case will be picking and choosing pieces of standards if they exist, to fit our current conventions. Anyway, the core of the question is, **Are there any industry standards regarding code quality, coding processes, or other areas that would help us keep their programmers from making disruptive or difficult to maintain code?** I realize we can't prevent it, but if we can point to the agreement, at least we have recourse other than refactoring or recoding it ourselves. Any other thoughts or suggestions would be helpful.


title: How to learn the practical uses of design patterns

text: I use OOP programming with inheritance, but I've not yet used interfaces.I want to learn how to use design patterns, but I'm finding them very difficult to learn. Is there is any way to learn design patterns easily? I searched quite a bit, but I was not able to find useful information.


title: Can you decipher this binary

text: _Thought I post this to the best community of programmers I know._ > David Johnston, the new Governor General, has the digital world confused. > > Just what is the meaning of that 33 character-long string of ones and zeros > that is emblazoned across the bottom of his fresh new Coat of Arms? > > According to the GG's website, "The wavy band inscribed with zeros and ones > represents a flow of information, digital communication and modern media." The binry is this:               110010111001001010100100111010011      It's not ASCII, is it just random? > Original article: http://www.cbc.ca/politics/insidepolitics/2010/10/the-new- > ggs-binary-banner-whats-it-mean.html _I'll accept the correct (if it can be solved) answer or failing that, the highest voted answer._


title: If you had to teach professional development to students that just graduated school, what would be the topics?

text: The idea is to give them more chances to be efficient in a professional environment. Most students are good with theory, most of them are smart, but they have to learn how to solve common technical problems. They will be better programmers as they practice, but maybe we can help them with some introduction training. > Which topics you would select for a two weeks full time training? It's an open question, I don't want to suggest things that will reduce the answers to a particular field.


title: Constructor vs setter validations

text: I have the following class :               public class Project {              private int id;         private String name;                public Project(int id, String name, Date creationDate, int fps, List<String> frames) {             if(name == null ){                 throw new NullPointerException("Name can't be null");             }                  if(id == 0 ){                 throw new IllegalArgumentException("id can't be zero");             }                      this.name = name;                 this.id = id;              }              private Project(){}              public int getId() {             return id;         }              public void setId(int id) {              this.id = id;         }              public String getName() {             return name;         }              public void setName(String name) {             this.name = name;         }          }      I have three questions:   1. Do I use the class setters instead of setting the fields directly. One of the reason that I set it directly, is that in the code the setters are not final and they could be overridden.    2. If the right way is to set it directly and I want to make sure that the name filed is not null always. Should I provide two checks, one in the constructor and one in the setter.   3. I read in effective java that I should use `NullPointerException` for null parameters. Should I use `IllegalArgumentException` for other checks, like id in the example.


title: How do I keep my projects from dragging on with endless tweaks and changes?

text: After working out a project, it might require too much tweaks and changes to get it working right... What can I do to prevent this?


title: Who uses GnuSTEP?

text: This has been a big question lurking at the back of my head. From what I see, GnuSTEP nowadays is primarily a "hobby" project of a small but tightly-knit group of people. However I haven't seen a large commercial (off-the-shelf) application that uses it, apart from the small applications that comes with the GnuSTEP distribution. Heck, since even Ubuntu doesn't really use it then is GnuSTEP really more than being a "hobby" framework? I know that Sony's SNAP at one brief moment uses GnuSTEP, but they killed the platform before it can do anything meaningful.


title: Why is design by contract considered an alternative to the pseudo programming process?

text: Right now I'm reading Code Complete by Steve McConnell and in chapter 9 he talks about the Pseudo Programming Process (PPP). From what I've understood, the PPP is a way of programming in which the programmer first writes the pseudo code for the routine he's working on, then refines it up to the point where pretty much each pseudo code line can be implemented in 1-3 lines of code, then writes the code in the designated programming language and finally the pseudo code is saved as comments for the purpose of documenting the routine. In chapter 9.4 the author mentions alternatives to the PPP, one of which is 'design by contract'. In design by contract you basically assert preconditions and postconditions of each routine. Now why would that be considered an alternative? To me it seems obvious that I should use both techniques at the same time and not chose one over the other.


title: Automated Acceptance tests under specific contraints

text: This question is a follow up to my previous question, which was a bit general, so I shall be more specific with this one. I want to automate acceptance testing on a web application. Briefly, this application allows the user to create contracts for subscribers with two constraints:   * You cannot create more than one contract for a subscriber.   * Once a contract is created, it cannot be deleted (from the UI). Let's say TestCreate is a test case with tests for the normal creation of a contract. The constraints have introduced complexities to the testing process, mainly dependencies between test cases and test executions.   * Before we run TestCreate we need to make sure that the application is in a suitable state (the subscriber has no contract)   * If we run TestCreate twice, the second run will fail since the state of the application will have changed.   * So we need to revert back to the initial state (i.e. delete the contract), which is impossible to do from the UI. More generally, after each test case we should guarantee that the state is reverted back. And since, in this case, it is impossible to do it from the UI, how do you handle this? **Possible solution** : I thought about doing a backup of the database in the state that I desire, and after each test case, run a script which deletes the db and restores the backup. However, I find that to be too heavy to do for each single test case. In addition, what if some information are stored in files? or in multiple or unaccessible databases? **My question:** In this situation, what would an experienced tester do to write automated and maintanable tests. Thank you. **More info** : I'm trying to integrate tests into a BDD (Behaviour Driven Development) framework, which I find to be a neat solution for test documentation and communication, but it does not solve this particular problem (it even makes it harder)


title: What are the warning signs of impending doom to watch out for on a project?

text: Having worked on a failed project is one of the few things that most programmers have in common, regardless of language used, industry or experience. These projects can be great learning experiences, soul-crushing disasters (or both!), and can occur for a multitude of reasons:   * upper management change of heart   * under-skilled / under-resourced team   * emergence of superior competitor during dev cycle   * over/under management Once you've worked on a couple of such projects, is it possible to recognise at an early stage exactly when a project is doomed to fail? For me, a big sign is having a hard & fast external **deadline combined with feature creep**. I've seen projects which were well planned out and proceeding right on schedule go horribly off the rails once the late feature requests started to roll in and get added to the final "deliverable". The proposers of these requests earned the nickname of Columbo, due to rarely leaving the room without asking for "just one more thing". What are the warning signs you look out for that set off the alarm bells of impending doom in your head?


title: use areFoo or isFoo?

text: I have never seen the use of "are" for boolean methods, but the use of "is" is very common. When I want to use "are" is usually because I am passing multiple variables, or a list of objects. I suppose I could rationalize my list of objects or multiple variables as one thing, such as "isSetupParametersValid", but that would still be plural. Is the lack of use of "are" in boolean methods, simply an arbitrary convention or a side-effect of using best practices. If it's a side-effect of best- practices, which ones? Note: for non-native English speakers "is" refers to a singular object, "are" refers to plural/multiple objects


title: PHP Project deployment

text: I have a PHP project that I'm currently developing. I'm nearly finished and I was wondering what is the best practice when it comes to beta testing and deploying updates/changes to the production site? For example, in order to test out new features, I thought about creating a sub-domain called beta.mysite.com that uses a duplication of the same project files as the production version and a duplication of the mysql db. Then after I test everything out, I need to export the mysql tables (if I changed the db structure) and copy over the files to the production area. But how do I do all that with keeping all the data that have been produced during my beta testing? I'm the only person that works on this project, I currently don't use any versioning tool, just Dreamweaver. Thanks,


title: How should you proceed when somebody rejected a good thing you made?

text: I made an application in extjs, and it was rejected by my technical architect, project manager, and team leader because it was a big JavaScript file. It feels very bad when you develop an application and it is rejected by your seniors. I don't want to feel bad and I want to concentrate on my work. I would like to restructure the code, as the coding structure in my company is very bad and I want to improve that. I want to work better and grow - how should I proceed?


title: Session states in ajax callback

text: Someone told me `Session` or `HttpContext.Current.User` will return different value when we are working with ajax postback, in case of when the are so many user are live to site. For example, suppose there are 1000 people are online in site, and from them 100 call ajax method/ wenmethod and on this we might get different value of `Session` or `HttpContext.Current.User` as per every user's `Session` or `HttpContext.Current.User` value are different. But my concept says it will return specific person's (who requested) `Session` or `HttpContext.Current.User` value, and server will be clear whose value need to be return. What you all guys says?


title: Is it possible to implement a native compiler for a 'managed language' such as Java?

text: In most cases, it is possible to create both a native compiler and an interpreter for a programming language. The compiler would simply convert the source code to machine code, and the interpreter would simply execute the source code (or some IL produced by a compiler). However, I'm not sure about languages with garbage collection. Let's take Java for example. When Java was designed, it was clear that Java programs were always going to be run on the JVM. And the JVM was supposed to feature a garbage collection mechanism. So while designing the Java language itself, there was no need for destructors and such. If one was going to implement a _native_ Java compiler, that would mean the Java source code would be compiled to machine code to be run on the machine itself, not on a VM. And the machine itself doesn't feature a mechanism for garbage collection. **How would someone implementing a native Java compiler deal with this situation? Is it possible to create a native compiler for Java, since the Java design 'counts' on automatic garbage collection? (And possibly on some additional things the VM does for the program?)**


title: What is the proper relationship between the software developer and the business customer?

text: IT professionals are experts who are trusted with the IT assets of a business or organisation. As trusted professionals we have responsibilities that extend beyond things that a non-IT customer can be expected to understand or be aware of. So I think the proper relationship between an IT professional and his internal/external customers is more like that between a doctor and patient than a servant and master. Am I right? Here's an analogy to think about. A patient insists that his leg needs to be amputated. His doctor disagrees but the patient cannot be persuaded. Should the doctor amputate the leg just to satisfy the patient? Another analogy. A customer wants a civil engineer to build a bridge to an unsafe design. Even when the engineer explains that it is unsafe the customer doesn't believe him. Should the engineer build the bridge anyway? I think the right answer in both these analogies is NO. The medical professional and engineering professional are supposed to be in a position of trust and ought to exercise their own judgement, even in the face of patient/customer disapproval. Shouldn't the same apply to IT professionals when the IT professional is qualified to make the decision but his customer is not?


title: How can I create a solid business case for upgrading our programmers to 256 GB SSD and 16 GB of RAM?

text: We have an environment based on Microsoft stack (VS2010, SQL Server, etc), and I firmly believe that we could improve productivity a little bit, having more RAM and a faster secondary SSD. What data do you advice to gather so I can solidify my request in such a way the advantages can be unbiasedly demonstrated? Currently we have only 6GB of RAM and slower HD drives, and at home I have a 128 GB SSD in my desktop and 16 GB of RAM (I also think is the max amount of memory supported by our workstations, if we could go bigger then better), so I can feel the difference and it's real. The issue actually is how to get a budget approval from management and spend it wisely to increase productivity.


title: How to use database adapters' cursors safely?

text: I started to use psycopg2 to connect my little python script to a PostgreSQL database few days ago. After some research I found that a lot of database connector, like psycopg, work using cursors. I know what is a cursor and how to use it. But I still wonder if it's safe to use the same cursor all along the script life. Is it safe? Or would it be preferable to use a different cursor for each query?


title: Is making a small change, testing it, then "rinse and repeat", a bad habit?

text: I am a programmer with a number of years of experience. I realized I got a certain habit. I'm not sure whether it's really a bad habit or not. I get a list of tasks to perform for a solution, even small small tasks, for example,   1. Change resources of this user control   2. Change size of another one   3. Add some HTML and coding on another user control All of these tasks are small. I mean they can be done within 10 minutes, **but I got a bad habit of making small changes and then test them again and again in a web browser**. Is this a good practice? Or should I perform them all at once and then test them together? If it is really a bad habit then how do I rectify it, since it feels like wasting time testing small changes over and over?


title: Writing code with 5 fingers, is more efficient?

text: Actually I tend to write with 4 fingers, my actual typing speed is in average 110~120 ( using http://www.typingtest.com/ with an spanish from spain ) I have some time trying to force myself to use 5 fingers, It's kind of weird, but I have noticed that when i'm writing a text like this, fingers tend to be in a really natural position, with time I could handle this... But when i'm programming everything is weir,using alt+tab is weird, using ctrl+b is wird, and all those shorcuts that some terminal related programs use, the "natural 5 fingers way" is natural just when i have to write text, but that don't apply when there is a lot of symbols like . -> ( ) [ ] " " && || , etc... Is there somebody that actually use 5 fingers to type?, is comfortable to write code using 5 fingers using that kind of "natural way" ? worth the effort to learn to use the 5 fingers?


title: Approached to build app centered around new API and suddenly API is abandoned

text: This isn't a huge deal, but I was approached by colleagues/friends to build an app using their new API. There was some potential for pecuniary gain for me depending on app usage. I spent a considerable amount of time polishing the mobile app, based on my assumption that, having been approached in a serious way, that the company would not suddenly shift focus and abandon the API. I wasn't even given so much as a heads up that the API was dead even though I had an app in production that relied on it... For the most part, building the app was a learning experience which I enjoyed, but I don't think I'd have expended all the effort if I knew that the company wasn't as serious about the API as their reaching out to me clearly indicated. How, if at all, would you react?


title: How can I put multiple hierarchical forms in a single web page and avoid making it a mess?

text: We are a group of developers working on a web application that accepts forms filled and sent by our users and present it in an overall view. Our main form view looks like this: ![enter image description here](http://i.stack.imgur.com/cReBC.png) There are multiple forms on this page. The form on the left is the parent form which contains general questions about the project. The right panels are more detailed questions and are about sub-projects. The forms are lengthy and contain different types of properties (form elements) in them. The parent form is static and is opened on page load. We have given no options to close or minimize it. The right panels (child forms) are collapsed by default and open by click and the contents are then rendered. This is done to reduce the page load time. I have annotated the picture so I don't have to explain everything myself. Everything in the picture that has a rectangle around it is a (Backbone) view by itself. To make it even more complex, look at this other picture: ![enter image description here](http://i.stack.imgur.com/BJs3N.png) Look at the photo slider view. Each slide in that slider is again, a view by itself. The manipulation buttons are rendered along with each slide so moving them somewhere else (like next to the "move left/right" buttons) is quite a pain. That is why we have not done it. Now look at the grand child form's fields that I have marked as "properties with relationships". If you change them, they become highlighted (with a yellow hollow color around them) and that changes a whole lot other things in the "child form" and the "parent form". We have managed that kind of relationship when saving the page but this kind of relationship adds to the complexity of the view. I guess you already have figured it out by now but I'm going to say it anyway: the code has grown out of hand. It is truly a can of worms. There are more than 30 functions in the base view file and 15 other views attached to this page. Multiple people have worked on this view and because it is a big file (base file: 2500 LOC), everybody has just tried to do their bit of task and not think about refactoring or simplifying the design of the page. The page is flawed because it is not extensible. For example, the grand-child forms have two more levels of child forms and we cannot add them to the page. We have been discussing for days on how to redesign this page but none of us seems to come up with a good idea. Now the question here is how can we redesign this page so it keeps all the functionality but with much simpler code? We are OK with a total redesign, a total new concept. We want to write the whole thing from scratch. All your ideas are appreciated.


title: show different xibs from inside a xib file

text: I'm a newbie in mac programming so here's my questions: I'm developing a mac app that has two xib file MainViewController and SecondViewController in MainViewController there's a button in which it calls Second View Controller. I'm using XCode 5 How to do this? and How to display video in a mac in XCode 5


title: What is the abstract name for Drive, Directory and file?

text: I want to give nice name to my function while returns drive, directory and file. Can you please suggest a good abstract name for this trio? This is the function.                 static IEnumerable<string> GetDriveDirectoriesAndFile(string path)       {          if (path.Contains('/'))          {             path = path.Replace('/', '\\');          }          if (path.Contains('\\'))          {             return path.Split('\\');          }          return null;       }      Thanks, Omkar


title: Is there a 'design pattern' type listing of common algorithms?

text: Is there a 'design pattern' styled listing of common/popular algorithms anywhere? Specifically, something that has a similar format along the lines of: **Algorithm Name:** e.g., Quick Sort, Bubble Sort, etc.   **Problem:** A description of the stereotypical problem the algorithm is supposed to address   **Description:** Description of the solution   **Implementation:** Code examples of the solution   **Big O Rating:** Self-explanatory   **Similar Algorithms:** Algorithms that address the same problem in different ways, or similar problems I really like the GoF design pattern listing style, and I think it would help me learn various algorithms better/easier if I could find a resource that was similar in terms of organization.


title: Simple vs Complex (but performance efficient) solution - which one to choose and when?

text: I have been programming for a couple of years and have often found myself at a dilemma. There are two solutions -   * one is simple one i.e. simple approach, easier to understand and maintain. It involves some redundancy, some extra work (extra IO, extra processing) and therefore is not the most optimal solution.    * but other uses a complex approach,difficult to implement, often involving interaction between lot of modules and is a performance efficient solution. Which solution should I strive for when I do not have hard performance SLA to meet and even the simple solution can meet the performance SLA? I have felt disdain among my fellow developers for simple solution. Is it good practice to come up with most optimal complex solution if your performance SLA can be met by a simple solution?


title: Best practice for packing Java enums?

text: What is the best practice for packaging Java enums? is it separate file for each enum?   or   having same file for all the enums? What are the pros and cons ?


title: How is data integrity maintained in a clustered environment when schema changes?

text: ## Scenario A clustered environment running N identical application nodes interacting with a single relational database. ## Problem Is it possible to upgrade the nodes to a new application version, which requires a new database schema **and** maintain data integrity in the database **without** any downtime in the application and **without** losing any data or ending up with data in an inconsistent state?


title: Can I learn touch typing while doing normal typing during coding?

text: I'm having a big problem as I don't know touch typing. I look at the keyboard (hunt and peck). However, I really want to learn touch typing. I have tried many times, but I don't have the patience and time to spare an hour everyday for that. So, can I learn typing while I do some practice at my work? I mean, practicing those lessons whilst coding. Anyone know if that will work?


title: Are costs part of the requirements?

text: I am new to requirements analysis and have a simple questions: Would you include the budget in the requirements, if e. g. the departments budget for running costs is 10k a year.


title: What would you change about C# if you could?

text: > **With nearly 60 answers to this question it's highly likely that _your_ > answer has already been posted. Please don't post an answer unless you have > something new to say** Assume that your objectives are the same as for C#. I don't want an answer like "I'd write Python instead". I'm only interested in changes in the language itself - not in the standard library. Perhaps this would be interesting to discuss, but as it is shared between many languages it would be better to discuss this in another question instead. **Please post a single idea per answer; if you want to post several ideas, post several separate answers. Thanks!**


title: Is it possible to compile a higher level language to readable C++?

text: C++ is a great language in many ways, but some things in particular are cumbersome to write without an IDE. As a VIM user, it would be very interesting if I had access to a higher level language which enabled me to write C++ with S-Expressions and possibly with Lisp-like macros, allowing for the generation of clean code while avoiding rewriting the same patters over and over again. I've asked on freenode and tested several ideas, such as compiling Lisp->C with compilers such as ECL and Bigloo, but none of those generated particularly clean C code. Are there any works on this issue?


title: Does music increase your productivity?

text: I wanted to know whether you think and audio background is just a distraction or could be of some help while programming. For me, it works like this: when I'm writing pseudocode, or implementing procedures that are very clear in my mind in a language I can write without looking up docs, having music playing in the background (very straightforward electronics, mostly) helps me a lot: it kind of gives some rhythm to my coding and, if the procedures are trivial, avoids the distractions that boredom can cause. When I incur in a problem, or I have to try to fix a bug, instead, it just distracts me. Also, if the song is really regular and I know it well enough not to cause me to focus on it, it eliminates unexpected environmental noise that sometimes make me waste precious seconds before I can concentrate on the code again. * * * _Guidelines checklist: 1 ok, 2 I hope; 3 I suppose; 4 Definitely; 5 I would like that to happen; 6 Doch (English should implement a way to disambiguate double negatives in answers)_


title: Features to generate time expiring

text: There are something out of box to generate time expiring in php? For example I need to control the access to the system, I was thinking something to verify every first day of every month, and do this in my code. But it is not 100% safety, since another programmer can remove this line code that verify. Then I thought is it possible, to verify in another server, if the monthly time expire or not? and return the message to the user if the copy expired or not? What is the best to way to create a licensing features for time expiry? or I really need to get inside IonCube (Compiled Code Encoding) for example? What is the best practice?


title: How can Java be improved so that it no longer needs to perform type erasure?

text: The official Java tutorial on generics explains type erasure and why it was added to the compiler: > When a generic type is instantiated, the compiler translates those types by > a technique called type erasure — a process where the compiler removes all > information related to type parameters and type arguments within a class or > method. Type erasure enables Java applications that use generics to maintain > binary compatibility with Java libraries and applications that were created > before generics. This most likely was a pragmatic approach, or perhaps the least painful one. However, now that generics is widely supported across the industry, what can be done in order for us to not need type erasure? Is it feasible with out needing to break backwards compatibility, or if it is feasible, is it practical? Has the last statement in the quote above become self referential? That is: "type erasure enables Java applications that use generics to maintain binary compatibility with Java libraries and applications that were created with Java versions that perform type erasure."


title: Conditional attribute in XML - most concise solution?

text: I am tasked with setting up conditional profiling - a method of tagging chunks of XML with an attribute, which will then be used as a conditional value to extract subset of that XML. Have a look at another definition/example: DITA profiling The XML is documents that are equivalent to printed books - i.e. documents that are often looked at by a human, even if indirectly. Therefore I am looking at a few requirements here:   1. keeping the value list brief - so it doesn't affect the readability of the document   2. be able to process with standard XML tools - a space-separated list inside an attribute is still probably fine, but I'd rather not use too much regexp for this   3. be obvious for various users, including 3rd parties, which content goes where   4. Be easy to maintain going forward Therefore one easy solution is:               <test condition="print epub"/>     <test condition="web kf8 app mobi"/>      The problem with this:   1. As the list grows the value of the attribute can be a bit verbose   2. One needs to explicitly state every value even if it's a scenario of this vs everything else Therefore I am also looking at other approaches such as:   1. Using "+" and "-" modifiers, Apache htaccess style to override the default cascading of profiling - by default all content goes everywhere and if we want to exclude a bit we just say "-kindle". It does require parsing the whole tree, is not supported by editing tools and one needs to regexp the attribute value a bit deeper...   2. Using an intermediate file to define groups of values such as "other" or "non-print", example of this in DITA. It allows concise XML as well as different grouping and values for each document but it does create a certain level of abstraction which may make it a little less obvious for a 3rd party? Altogether, if you received such XML and were tasked to process it, which option you'd rather receive? If you have any experiences like that, even in an unrelated areas such a builds, don't hesitate to comment!


title: Is BDD actually writable by non-programmers?

text: Behavior-Driven Development with its emblematic “Given-When-Then” scenarios syntax has lately been quite hyped for its possible uses as a boundary object for software functionality assessment. I definitely agree that Gherkin, or whichever feature definition script you prefer, is a business- **readable** DSL, and already provides value as such. However, I disagree that it is _writable_ by non-programmers (as does Martin Fowler). Does anyone have accounts of scenarios being written by non-programmers, then instrumented by developers? If there is indeed a consensus on the lack of writability, then would you see a problem with a tool that, instead of _starting_ with the scenarios and instrumenting them, would _generate_ business-readable scenarios from the actual tests? **Update:** regarding the “scenario-generator” tool, it would of course not guess business language magically  ;)  But, just like we currently use regexp matchers to create tests in a top-down approach (on the abstraction dimension), we could use string builders to create scenarios in a bottom-up approach. A “to give an idea only” example:               Given I am on page ${test.currentPage.name}     And I click on element ${test.currentAction.element}     …


title: Black Hat Hackers vs Programmers?

text: This came up with another question I had here, I have decided on a programming verification system that requires a hardware verification system, a software key, and a name/password system. Now people are saying that hackers will bypass any new security, which may be true, but I have a few questions. There has to be a balance between programmers programming and hackers stealing software, otherwise programs wouldn’t be made, and we wouldn’t be where we are today. What is that balance? 5%, 10%, 20%, 50%?   1. What is too much security for the end user?    2. What is too little security so the hacker can just push through without issue?    3. If your software becomes popular, what should you expect or accept as acceptable loss?    4. Why should we accept black hat hackers as a way of life?


title: Does double-shifting as a PM affect your developer-productivity?

text: Has it ever happened to you that you are a good developer but suddenly you need to lead a team or are responsible for some PM activities as well? Did you find that it affected your productivity? How did you handle it? I love my job, but I sometimes feel I was much happier as a programmer and the additional burden of being a Project Manager is currently affecting my productivity as a developer. What do you guys suggest as remedies to this? I do not have an alternative currently to quit from my job - basically because Im working for a startup that I co-founded.


title: Help me learn to program with humility?

text: I wanted to ask this question so that I can come back to it and have it serve as a **constant reminder** for me. Throughout my life, I've had milestones where I've sat down and really evaluated myself. Every time I've found something negative I've striven to put it right. One of those negatives is pride or arrogance. Sadly the nature of programming leads to plenty of fuel to endlessly fill one's own ego. Can you give me any words of wisdom that can serve as a reminder for me to **"eat humble pie"**? I want to keep my arrogance in check, even if that arrogance is the weight of a grain of sand.


title: about build process

text: I have programmed in Obj C and C, but until now found that I dont fully understand the steps in taking the software from source code to executable, I found this image kind of explaining it (sorry couldn't upload as I'm new but I still not get when the debugger, make, builder come into action, when it goes to asm and when to binary   * are the steps the same for OOP of for procedural?   * how about different languages? python, php, objc, C, same steps? Thanks a lot!


title: Increase production by specifying a development computer

text: Interesting post by Seth Grodin by increasing productivity by specifying one device for work and one for everything else. Would you be more productive if you only programmed on one machine and forced yourself to surf, chat, email, and play games on another device or would it hinder productivity? If your boss saw you on your phone or tablet for an hour, it would raise a red flag. Could be a problem if you mix work and personal email. Obviously doesn't work if you don't have another device. EDIT: maybe the advantage would be for a developer to have more than one computer instead of just a faster computer and more monitors?


title: How do you judge if you're paid enough?

text: How do you evaluate how much you feel you ought to be paid as a junior programmer?


title: Business knowledge in a large financial org?

text: As a programmer working in the finance industry, I recently got a project that is a hedge fund adminsitrative application(used to calculate NAVs, allocate assets etc.) From a business point of view this is a good thing. When we think of our 'next' project, typically the impulse is to think in terms of technology. e.g: 'I want to work on a project that uses SOA/cloud etc etc.' I am interested to know if anyone while career planning also takes into account the business aspect of a future project. i.e. what the application does. So does anybody ever think like this : 'I wish to work on a trading system so I can understand capital markets better.' instead of 'I want to work on a project that uses SOA/cloud etc etc.' I say this because it appears to me in the finance domain, for senior position, good business knowledge pays well. So maybe a guy that knows more business but maybe not so much latest technologies is at an advantage? The rockstar programmer seems more suited for an aggressive startup. Particularly big old finance orgs rarely invest in tech just for the 'cool factor'. No?


title: Good Design and how to achieve Low Coupling?

text: what do you think about this design? ![enter image description here](http://i.stack.imgur.com/VmBGO.png) In this image i have reported the dependencies between packages. I would like to reduce the coupling between them, but do you have any idea about how to do this? I think it is impossible to reduce it more than this. The Preferences package is responsible to manage program options, Persistence instead to save them in storage. Applogic and model are in domain layer. Thanks in advance!


title: Is there an efficient way to align degenerate strings?

text: I have a degenerate string `S1=xadcdax`, where `x` can be replaced by any of the four characters `a`, `b`, `c`, or `d`. This `S1` string is match with another non-degerate string `S2=dcbaa`. I can first use brute force to find all possible strings of `S1`, which requires `4^n` (`n` is the number of degenerates in a string), so the complexity is `4^2`. After that, for each string of `S1` matched with `S2` by using dynamic programming which requires `(i x j)` running time (where `i` is the length of `S1` and `j` is the length of `S2`). But the total running time will be `4^n x ij = 4ij^n`, which is quite slow. Is there a more efficient algorithm for this?


title: How can I learn old school know how

text: I recently read this article online and began to question my knowledge. Now I went to uni(ish) and have a honours degree, I program in c++ using pointers but I wonder if i would have made it in Joel's class. We had two programming modules but mostly I am self taught. So I want to know how can I learn the things mentioned in the article but without it feeling like gappy self taught knowledge without having to do another 3 year degree? How can I go back to the real basics and learn it properly so I am confident in my abilities and dont feel I have a dumbed down modern degree knowledge ?


title: alternatives to nested try-catches for fallbacks

text: I have a situation where I am trying to retrieve an object. If the lookup fails I have several fallbacks in place, each of which may fail. So the code looks like:               try {         return repository.getElement(x);     } catch (NotFoundException e) {         try {             return repository.getSimilarElement(x);         } catch (NotFoundException e1) {             try {                 return repository.getParentElement(x);             } catch (NotFoundException e2) {                 //can't recover                 throw new IllegalArgumentException(e);             }         }     }      This looks awfully ugly. I hate to return null, but is that better in this situation?               Element e = return repository.getElement(x);     if (e == null) {         e = repository.getSimilarElement(x);     }     if (e == null) {         e = repository.getParentElement(x);     }     if (e == null) {         throw new IllegalArgumentException();     }     return e;      Are there other alternatives? Is using nested try-catch blocks an anti-pattern? is related, but the answers there are along the lines of "sometimes, but it's usually avoidable", without saying when or how to avoid it.


title: Python Forgiveness vs. Permission and Duck Typing

text: In Python, I often hear that it is better to "beg forgiveness" (exception catching) instead of "ask permission" (type/condition checking). In regards to enforcing duck typing in Python, is this               try:         x = foo.bar     except AttributeError:         pass     else:         do(x)      better or worse than               if hasattr(foo, "bar"):         do(foo.bar)     else:         pass      in terms of performance, readability, "pythonic", or some other important factor?


title: Which of these is the best strategy for dependency injection?

text: I am working on a Java project that uses a dependency injection framework built by the company itself. The framework enforces the following naming convention: suppose you have a class `Foo` that depends on an interface called `org.company.IBar`:               class Foo {        @Injection        private IBar bar;             ...     }      then the framework will search for a class called `org.company.implementation.Bar`, create a new instance of that class and then assign it to the attribute `Foo.bar`. The framework allows for some customization, though. In that `@Injection` annotation, you can declare your own factory, with which you can enforce your own conventions. But every time you want to use a certain factory, you will have to declare it explicitly in the annotation over the attribute to be injected. This strategy, however, will make your classes tightly coupled to each other, because when you declare a dependency on an interface, you are already committing to a given implementation. So, I decided to implement my own factory to manually perform dependency injection. It is basically a class that instantiates all application objects and wires them together. Each object has its scope (singleton or prototype) controlled by the factory. Think of a Spring IoC configuration file (but written in Java, instead of XML). My colleagues did not approve this decision. Their argument is that the factory I created “has too many responsibilities” and the instantiation of each object must be left to the framework. If you need to use another convention, you should create custom factories for each class (as described above). Definitely, according to them, there should not be one single factory where all the objects are instantiated. I strongly disagree with their argument. The factory has _only one_ responsibility: creating the object graph. Should the need arise to modify that graph, there is only one class that will have to change. But I may be missing something here. What are the pros and cons of each strategy?


title: Methods to Manage/Document "one-off" Reports

text: I'm a programmer that also does database stuff and I get a lot of so-called one-time report requests and recurring report requests. I work at a company that has a SQL Server database that we integrate third- party data with and we also have some third-party vendors that we have to use their proprietary reporting system to extract data in flat file format from that we don't integrate into SQL Server for security reasons. To generate many of these reports I have to query data from various systems, write small scripts to combine data from the separate systems, cry, pull my hair, curse the last guy's name that made the report before me, etc. **My question is, what are some good methods for documenting the steps taken to generate these reports so the next poor soul that has to do them won't curse my name?** As of now I just have a folder with subfolders per project with the selects and scripts that generated the last report but that seems like a "poor man's" solution. :)


title: How to implement Cache in web apps?

text: This is really two questions. Im doing a project for the university for storing baseball players statitics, but from baseball data I have to calculate the score by year for the player who is beign displayed. The background is, lets say 10, 000 users hit the player "Alex Rodriguez", the application have to calculate 10, 000 the A-Rod stats by years intead of just read it from some where is temporal saved. Here I go:   1. What is the best method for caching this type of data? Do I have to used the same database, and some temporal values on the same database, or create a Web Service for that?   2. What reading about web caching so you recommend?


title: Questions about identifying the components in MVC

text: I'm currently developing an client-server application in node.js, Express, mustache and MySQL. However, I believe this question should be mostly language and framework agnostic. This is the first time I'm doing a real MVC application and I'm having trouble deciding exactly what means each component. (I've done web applications that could perhaps be called MVC before, but I wouldn't confidently refer to them as such) I have a `server.js` that ties the whole application together. It does initialization of all other components (including the database connection, and what I think are the "models" and the "views"), receiving HTTP requests and deciding which "views" to use. Does this mean that my `server.js` file is the controller? Or am I mixing code that doesn't belong there? What components should I break the `server.js` file into? Some examples of code that's in the server.js file:               var connection = mysql.createConnection({         host : 'localhost',         user : 'root',         password : 'sqlrevenge',         database : 'blog'     });          //...          app.get("/login", function (req, res) { //Function handles a GET request for login forms         if (process.env.NODE_ENV == 'DEVELOPMENT') {             mu.clearCache();         }              session.session_from_request(connection, req, function (err, session) {             if (err) {                 console.log('index.js session error', err);                 session = null;             }                  login_view.html(res, user_model, post_model, session, mu); //I named my view functions "html" for the case I might want to add other output types (such as a JSON API), or should I opt for completely separate views then?         });     });      I have another file that belongs named `session.js`. It receives a `cookies` object, reads the stored data to decide if it's a valid user session or not. It also includes a function named `login` that does change the value of cookies.   * First, I thought it would be part of the controller, since it kind of dealt with user input and supplied data to the models.   * Then, I thought that maybe it was a model since it dealt with the application data/database and the data it supplies is used by views.   * Now, I'm even wondering if it could be considered a `View`, since it outputs data (cookies are part of HTTP headers, which are output)


title: How do you distinguish your public API interfaces from the interfaces you use for testing/mocking?

text: Mocking frameworks are useful for creating mock objects that isolate the code under test from its surrounding software environment. Some mocking frameworks cannot mock non-virtual methods, so they require that you create an `Interface` for each class, if you don't want to make the methods `virtual`. How do you distinguish those Interfaces from the "real" ones? That is, if you have a public API, do you name the interfaces that you intend your customer to use something else, or do you hide the testing Interfaces in a separate assembly or namespace? As an aside, is it really necessary to create all those Interfaces? I don't like the idea of making all my methods `virtual`, but I _really_ don't like the idea of creating that many interfaces just to make them accessible to a mocking framework.


title: alternative to environment variables

text: The amount of servers and the complexity of our application is growing and we now have servers in different regions (hosted on AWS). Certain database operations require low latency so we have stuck a database in each region (which is basically a user cache) to keep the network latency low. The way the application server currently knows which user cache/database to make its call to depends on an environemnt variable set in it. This has been working fine, but it seems hacky and not optimal. Is there any way for this to be done automatically? I was considering using a package like fping and pinging each database when the app server reloads (or caching it the first time) and using the corresponding latencies to decide which database has the lowest latency for each app server. Not sure if this is the best idea though.


title: Reasons for a Java Developer to learn RoR

text: Just wondering if there are any reasons why a Java developer should learn **Ruby on Rails** knowing that there are technologies such as _Grails_ or (especially) **Spring Roo** that can be more familiar?


title: Divide and Conquer algorithms – Why not split in more parts than two?

text: In divide and conquer algorithms such as quicksort and mergesort, the input is usually (at least in introductory texts) split in **two** , and the two smaller data sets are then dealt with recursively. It does make sense to me that this makes it faster to solve a problem if the two halves takes less than half the work of dealing with the whole data set. But why not split the data set in three parts? Four? _n_? I guess the work of splitting the data in many, many sub sets makes it not worth it, but I am lacking the intuition to see that one should stop at two sub sets. I have also seen many references to 3-way quicksort. When is this faster? What is used in practice?