title: What are some good questions (and good/bad answers) to ask at an interview to gauge the competency of the company/team?

text: > **Possible Duplicate:**   >  What questions do you ask about a company before deciding to work there? I'm already familiar with the Joel Test, but it's been my experience that some of the questions there have the answers "massaged" to make the company seem better than it is. I've had several jobs in the past that, for instance, claimed they had a QA process and did unit testing, and what they really meant is "The programmers test the app, and test with the debugger and via trial- and-error."; they said they used SVN but they just lumped everything into one giant repository and had no concept of branching/merging or anything more complicated than updating and committing; said they can build in one step and what they really mean is it's "one step" to copy dozens of files by hand from the programmer's PC to the live server. How do you go about properly gauging a company's environment to make sure that it's a well-evolved company and not stuck on doing things a certain way because they've done it for years and they're ignorant of change? You can almost never ask to see their source code, so you're stuck trying to figure out if the interviewer's answer is accurate or BS to make the company seem good. Besides the Joel Test what are some other good questions to get the proper feel for a company, and more importantly what are some good and bad answers that could indicate a good or bad company? I mean something like (take at face value, please, it's all I could think of at short notice): _Question:_ How does the software team apply the SOLID principles and Inversion of Control to their code? _Good Answer:_ We adhere to SOLID wherever possible; we use TDD so it kind of forces us to write abstract, testable code. We use Ninject for our IoC container because it's fairly easy to configure - it was that or StructureMap but I find Ninject a bit more intuitive, and who doesn't like ninjas? You're not a pirate, are you? _Bad Answer:_ Our code is pretty secure, yeah. And what's this Inversion of Control thing? I've never heard of it before. You see what I did there. The "good" answer uses facts to back it up and has a bit of "in crowd" humor; the bad answer shows complete ignorance of the question - not necessarily a bad thing if you are interviewing for a manger/director position, but a terrible answer and a huge red flag if you're interviewing as a developer and talking to a senior developer or manager! My biggest problem at the moment is being able to take a generic response and gauge whether it's the good or bad answer; more often than not it's the bad kind and I find myself frustrated almost from day one at the new job. I suppose I could name drop if I ask about specific things (e.g. "Do you write unit tests?" and if the answer is yes, ask if they use NUnit, MbUnit or something else; if they mention data access ask if they use a clean ORM like NHibernate or something more coupled like EF or Linq) but is there another way short of being resolute to actually call the interview on things (which will almost certainly result in not getting the job, but if they are skirting the question it's probably not a job I want).


title: Languages on a resume: Is it better to put "C/C++" or "C, C++"?

text: I'm graduating in a couple of weeks, and my resume (as expected) lists the languages that I've had experience with. Previously I've put **"C/C++"** , however back then I didn't have _that_ much experience with these two languages as I do now. Now that I've formally learned these two languages, it has become evident to me (and anyone who really knows these languages) that they are similar, and completely disimilar at the same time. Sure, most C code is compilable C++ code, but syntax and incorporation of library functions is pretty much where these similarities end. In most non-trivial problems, chances are that the desirable C++ solution will be different from the desirable C solution.   ### My question:    Will recruiters take note or care about whether you put **"C/C++"** as opposed to **"C, C++"**? Will they assume a lack of knowledge of the workings of either because of the inclusion of the first form, or perhaps see the inclusion of the second form as a potential "resume beefer" (listing them as 2 languages, instead of "one")? Furthermore, for jobs that you've applied to that were particularly interested in these two langauges, did the interview process include questions about the differences between C programming and C++ programming (so, about actual programming techniques, not only the extra paradigms in the latter)?


title: Is it a good pattern that no objects should know more than what it needs to know?

text: I am implementing a controller class to manage a view. I have a file uploader class, Grabber, which could communicate in one of 2 ways: 1) Offer some kind of notification event to the controller on upload start and finish 2) Provide a property on Grabber that indicates true or false if upload has completed I am concerned that with option 2) I am introducing a dependency between the controller and the Grabber. What is the better design here?


title: If OWIN is used on PC and Mac (Mono), then what is the abstraction for claims and authentication?

text: If the PC implementation of OWIN is Katana, and OWIN doesn't define authentication abstractions, (or authorizations)* then:   * What is the abstraction for Authentication (cookies, forms, OAuth, SAML, etc)? *This is from the MSFT Jabbr Room on SignalR and OWIN


title: Level order sorted binary tree from a binary tree

text: Lets suppose we have a binary tree . Tree node structure is as               struct node      {        int val ;        struct node *left , *right ;     }      Now we have to sort the tree in level order manner . For example lets suppose we have original tree like this               root = 6     root->left = 1      root->right = 9     root->left->left = 8     root->right->right = 2      Then after applying level order sorting , our tree will be               root = 1     root->left = 2     root->right = 6     root->left->left = 8     root->right->right = 9      One way of doing this problem is just take all the values in a array and apply any of the standard sorting algorithm and then put back the values in tree in level order traversal manner. This solution is not efficient in term of space and time both. What algorithm can I use to decrease operations and memory usage from my proposed plan? Is there a more efficient algorithm to do this without the use of a sorted array? **Level order sorting :**   Level order sorting means if you do level order traversal of the tree then you should get a sorted non-decreasing sequence . **Constraint :**   Shape of the tree should not alter that is if in original tree left child of the root does not have right child (as in my example) then after sorting too, it should not has right child .


title: What is the best way to introduce software created by you?

text: What is the best way to introduce applications that programmers develop to the world? For mobile apps you have the different marketplaces, but what about non-mobile applications? These could be web apps or desktop apps. Introduce = distribution to the end users as well as popularize amongst the software development community. Obviously the software that is being released would have a specific audience in mind (i.e. a community based web site or user based application versus an tool that developers could use).


title: Are promises suitable for Model Controller communication?

text: I have an Express app built with the Yeoman Angular fullstack generator to build an API to send JSON to Angular. I'm trying to work out the best way to pass back information from my model to my controller, further processing may occur in the controller. I'm currently using promises. I feel uncomfortable about my model returning a promise to the controller. Should I? Currently my Model looks like this:               function returnCountries(lim, offset) {         var promise = new Promise(function(resolve, reject) {             //SQL is just an example             connection.query('SELECT * FROM countries LIMIT 1', function(err, result) {                 return resolve(result);             });         })         return promise     }          function returnCountry(countryID) {       //not yet implemented     }     module.exports = {         "returnCountries": returnCountries,         "returnCountry": returnCountry     }      And controller looks like this:               var Country = require('./country.model');          // Get list of countries     exports.index = function(req, res) {           Country.returnCountries().then(function(countries){                   return res.json(200, countries);     })


title: Has anyone nailed dependency management?

text: I've used various dependency management tools for installing software: homebrew, cabal, rubygems, etc. Invariably, despite someone's simple instructions for installing their package, there are times when dependencies don't get worked out by the package manager and the installation fails. This is more common than it ought be. And frustrating! You end up trying to troubleshoot the installation process which I feel is something users (even if they are developers) shouldn't have to do. This is one reason people knock Linux (which I love!) as compared to Windows: installations can be associated with complications. Windows users aren't tasked with compiling source. Is someone aware of a dependency management tool (or dependency management strategies) that has been especially successful at eliminating the bumps associated with installs? Clearly some package managers must be better than others. Or does this remain an unsolved problem?


title: Is there anything groundbreaking about NoSQL?

text: I am a very solid Relational Database guy and understand all the way to 3rd normal form, appreciate the algebraic set theory roots of SQL, and can probably relationalize a broken heart (or not). I haven't figured out a relational database structure FOR date nights with my wife, but I HAVE thought about relational database projects ON date nights with my wife.. Now I'm hearing about NoSQL, and researching it. Cutting to the chase, is there anything about NoSQL that is ground breaking, mathematically novel, or a "hey you don't even really need to organize your data relationally, this is so much easier" type of approach? Is NoSQL like a super shell to the data structure? In my mind, data must ultimately have structure to be retrieved and the retrieval must be defined in a language of some sort.


title: Traits, Inheritance and Interfaces in Groovy, when to use them?

text: I'm learning groovy and I've just learned about the new feature added in 2.3, which is the addition of _Traits_. Now to me it seems like Traits allow you to do basically everything a super-class and an Interface can do. Does the addition of Traits to Groovy make Inheritance and Interfaces obsolete? And if not, then what is the best time to use each of these mechanisms?


title: Are there any limitations of an idealistic HTML5 web application

text: Let's assume the following two assumptions are true.   * Your entire userbase has broadband access _everywhere_   * There is an imaginary browser X that implements the entire draft specification of the HTML5 and WHATWG groups, consistently and all users use browser X. What are the _intrinsic_ limitations of a commercial public HTML5 web application that we need commercial public desktop applications for? I'm interested in the limitations of plugin-less web applications that don't rely on Flash/Java/SilverLight/etc bridges for extra features nor rely on browser plugins for extra features. **Possible Limitations that don't apply:**   * Databases? We have WebSQL and indexedDB.   * File IO? We have the HTML5 File API which does both reading and writing.   * Speed? With the recent JavaScript engine race, the browser is no longer slow. Native C++ is only 3 times faster then chrome's V8 engine.   * Development Tools? The web has matured and there is a whole range of tools available which are too numerous to list.   * Closed Source? Yes, all the code is open source. This is a double-edged sword and there are numerous opinions on use of closed source or open source code. I personally believe the advantages of open source code outweigh the disadvantages.   * JavaScript/HTML5? Arguments along the likes of "I personally think HTML5 and EcmaScript are horrible development platforms" do not count. **Known Limitations:**   * Real time / security (top secret) critical code does not belong on the web nor can it. It needs to be written in a low level, highly controllable language like C or C++.   * Any tool that needs to interact with a foreign 3rd party piece of hardware attached to your computer will have a difficult time talking to your web application.  There is also a whole suite of programs that do not belong on the web. Operation systems, drivers, server software, low level APIs. I'm aware of that but I don't classify them as "commercial public" applications, these are the type of software that can be pre-installed on computers. As an aside, I know the two assumptions are horribly unrealistic, but we might achieve them in 5/10/20/30 years. I'm interested in the type of applications and the features of the applications that make them _completely incompatible_ with the web. **Motivation:**   * Google applications   * Microsoft Office365   * Web application list   * Adobe Aviary **The point:** Given the set of problems where a desktop application is a valid solution.   * Why is a web application not a valid solution?   * How do I identify whether or not I can use a web application as a solution. I've tried to remove the main difficulties with web applications (internet connection and browser support) by asserting they don't exist. As a further aside, HTML5 offline applications and Modernizr are on track to solving both those issues. What are the other difficulties with web application development?


title: How is performance testing integrated into your product lifecycle?

text: Do you do any performance testing in any repeatable and automated way? Do you trigger it as a part of CI builds? What tools do you use? How do you spot changes in trends? I'm looking for how-tos and description of working set-ups for end-to-end automated performance testing approaches.


title: For what reasons should I keep "using" section clean in C#?

text: Once when I was refactoring my code, I went up the IDE to the **using** section of my C# class, and cleaned _unused namespaces_ and _duplicate namespaces_ , and sorted them all. My pair (pair programming) asked me the reason. I had no idea why I did that. I did it out of my habit to keep all of my code clean and tidy. I mean, I told him that having a cleaner code is a good idea in general, but of course that reason was not a good justification, as I won't even bother to spend my time in the **using** section of any C# code page. Since many times you move a class or an enum (or a type in general) from one namespace to another namespace, and this adds new using statements to your code (either manually by going up the code window and writing the using statement yourself, or through the editor using Alt+Ctrl+F10 combination), and since these new **using statements** would be added to the end of **using section** , which makes them not sorted alphabetically, and since compiler never complaints about any of these problems, why should we care to make this section clean and tidy? What reasons might we have?


title: What is your approach to multi-paradigm programming?

text: I have been learning some Ruby recently and I had the following experience. I had written a small tool of about 200 lines of code and, as an inexperienced Ruby programmer, I had used several loops to build arrays from other arrays. E.g.               gs = ... # Some array of input data.     l  = gs.size     i  = 0     r  = Array.new     while (i < l) do       if (cond(gs[i]))         r.push(gs[i])       end       i = i + 1     end          # r contains the result now.      Then I discovered that I can do it in a functional style:               gs = ... # Some array     r  = gs.select { |g| cond(g) }          # r contains the result now.      So I immediately replaced most of my loops in the code with constructs like each, select, take_while, drop_while, and so on. I have decided to use a functional style in Ruby whenever possible and try to avoid an imperative style. As another example, in C++ I tend to use classes and methods everywhere and use functions only for small utility tasks that are private to the implementation of some class. So I tend to think object-oriented when working in C++ and avoid a procedural style almost completely. More in general, when working on a given project in a given language, I tend to pick one paradigm and stick to it throughout the project: I find this makes my code more uniform, easier to read and to debug, which, IMO, is very important, especially for production code. Yet, I often think that maybe I should explore more and try out different possibilities offered by a language, e.g. use different paradigms and try out different solutions. For me this involves some overhead both while coding (should I make it procedural or object-oriented? imperative or functional?) and when reviewing or debugging code (what did I want to do here?) because of the increased complexity. So my question is: do you also tend to select a preferred programming paradigm when coding and stick to it, or do you tend to explore more and mix different paradigms? If you mix different paradigms, do you have the feeling that there is some overhead in terms of how fast you can write and debug code (added complexity, switching between different mindsets) or is it just a matter of learning how to do it and then you can even be more productive? Or do you mix different paradigms in a more structured way, e.g. you apply each paradigm to a specific class of problems (e.g. functional for queries, object-oriented for architectural aspects, and so on)?


Are all scripting languages dynamically typed? I am using TCL. It is a scripting language and it does not enforce or allow type delaration of variables. It is instead a dynamically-typed language with ducktyping. The type of a variable is assumed by the interpreter according to the value assigned to it. I would really like to know is there are scripting languages that are strictly/strongly typed.


title: Help me choose an Open-Source license

text: So I've done lots of open-source work. I have released many projects, most of which have fallen under GPL, LGPL, or BSD licensing. Now I have a new project (an implementation library), and I can't find a license that meets my needs (although I believe one may exist, hence this question). This is the list of things I'm looking for in the license.   1. Appropriate credit given for ALL usage or derivative works.   2. No warranty expressed or implied.   3. The library may be freely used in ANY other open-source/free-software product (regardless of license, GPL, BSD, EPL, etc).   4. The library may be used in closed-source/commercial products ONLY WITH WRITTEN PERMISSION. GPL - Useless to me, obviously, as it completely precludes any and all closed- source use, violating requirement (4). BSD/LGPL/MIT - Won't work, because they wouldn't require closed-source developers to get my permission, violating requirement (4). If it wasn't for that, BSD (FreeBSD in particular) would look like a good choice here. EPL/MPL - Won't work either, as the code couldn't be combined with GPL-code, therefore violating requirement (3). Also I'm pretty sure they allow commercial works without asking permission, so they don't meet (4) either. Dual-licensing is an option, but in that case, what combination would hold to all four requirements? Basically, I want BSD minus the commercial use, plus an option to use in commercial/closed-source as long as the developer has my written permission. EDIT: At the moment, thinking something like multiple-licensing under GPL/LGPL plus something else for commercial?


title: How to alter the code at runtime in an interpreter?

text: While reading the difference between Compiler and interpreter , I found the following differences fromt he internet. Advantages of using compiler:   * Since compiler converts the program to native code of the target machine (object code), faster performance can be expected.   * There is a scope for code optimisation.  Advantages of using interpreter:   * Process of execution can be done in a single stage. There is no need of a compilation stage.   * Alteration of codes possible during runtime.   * Really useful for debugging the codes (because source code execution can be analyzed in an IDE)   * Facilitates interactive code development. In case of interpreter, stated as interpreter "there is a possibility of alter the code" and In case of compiler "code optimization will be there" Can anyone explain these 2 points ?


title: Eclipse vs. Aptana

text: I know that Eclipse is a universal IDE and variety of plugins are available to scale it. What is the difference between: The original Eclipse IDE, Aptana and NetBeans. I looked into Wikipedia and came to know that the latter two originate from the main Eclipse. For Aptana specially, what was the need to reproduce a new variant that resembles too much with its base IDE? If your preferred choice is Eclipse itself, what makes it unique as compared to the other two.


title: How do I include Implementation and Usage Documentation in one file

text: There are two types of documentation. One type, the **Implementation Documentation** , contains information about specific implementation of a construct (eg. Class, Method, etc.). It is targeted to the future me, maintainer, debugger and so on. And there is **Usage Documentation** , containing information how to use a provided api. It does not contain information about specific implementation and is targeted to users of the api. How do I include both of them in one file? (Or do I include both of them in one file? And if not, what type belongs into the source file?) Are there special techniques, using java-doc and/or best practices?


title: What career opportunities exist for developers with a degree in computer science?

text: I have an upcoming speaking engagement at a local University and will be address students in a 102 computer science course. Being more of an introductory course, there will be comp sci majors, along with some business/comp sci hybrid majors, as well as Math and Physics majors. It is one of those 'see someone from the real world with your degree' type things. The professor's requested topic is what career opportunities does a student have when they have some programming courses under their belt. Now, my degree was a B.S. in Comp Sci and my entire experience (5 years out of school) has been in what you would generically label the 'business world' (first job was for a consulting firm, my current job is for a company in distribution). I was hoping to get outside opinions so that I'm not just pulling from my own experience for these college students. What opportunities exist for students that have some degree and ability to program/develop software outside of the business world? (ie. research and grant type work, military/government, etc.) How can the skills learned in programming courses help you beyond developing software? (Being able to better communicate with an I.T. staff is something I thought of) Any other benefits you can think of would be appreciated! Thanks!


title: Type parameterized methods to avoid casting

text: In a library I am developing I have a factory method that looks a bit like:               public <T> T instantiate(Type targetType) {         return ...;     }      I am using a type parameterized method to avoid that users of my library have to cast every time they invoke it (that would be the case if I would have chosen to return `Object`). Is there any reason this is **not** a good design choice ?. I do not like that the programmer can invoke my method like:               String s = instantiate(Integer.class);      Which is clearly wrong. Unfortunately, the method requires a type and not a class, otherwise I could have written something like:               public <T> T instantiate(Class<T> targetClass) {         return ...;     }


title: Saving multiple copies of a single image at different sizes

text: I'm building a file storage programme that will also display images in photo galleries to users who upload them. I was wondering if anybody could help me out. My plan was if an image was wider than 500px then I would resize it to 500px (gallery and mobile use) width and 250px (thumbnail use) width I have no serious experience with this so I was wondering if anybody could help me. How many different versions of a single image should I store and at what sizes. Thanks


title: Is imposing the same code format for all developers a good idea?

text: We are considering to impose a single standard code format in our project (auto format with save actions in Eclipse). The reason is that currently there is a big difference in the code formats used by several (>10) developers which makes it harder for one developer to work on the code of another developer. The same Java file sometimes uses 3 different formats. So I believe the advantage is clear (readability => productivity) but would it be a good idea to impose this? And if not, why? **UPDATE**   We all use Eclipse and everyone is aware of the plan. There already is a code format used by most but it is not enforced since some prefer to stick to their own code format. Because of the above reasons some would prefer to enforce it.


title: When you should and should not use the 'new' keyword?

text: I watched a Google Tech Talk presentation on Unit Testing, given by Misko Hevery, and he said to avoid using the `new` keyword in business logic code. I wrote a program, and I did end up using the `new` keyword here and there, but they were mostly for instantiating objects that hold data (ie, they didn't have any functions or methods). I'm wondering, did I do something wrong when I used the new keyword for my program. And where can we break that 'rule'?


title: External framework to fix code growth problems

text: I'm currently working on a project, and there are some "code growth" problems, that need a solution for. The deadline is not very far, and it would be advisable to stay within allocated time-frame. Still, the code needs some restructuring, and here lies the question. Should we try to use a new framework to fix the current problem, or not. My colleague is very open towards external frameworks and offers to restructure the code by finding an existing library something along the lines of WTL/boost/TinyXML/ATL. I, on the other hand, am very cautions concerning new frameworks for existing code bases. The language is C++, and I have a fair amount of experience where libraries like MFC backfire with a huge flamethrower. I am not saying my way is the right one, as I guess the truth is somewhere between, but I need to decide how to proceed. The deadline is pretty close and the changes would touch a large part of the code-base, app logic layer. Restructuring the existing code base would require some peaceful thinking and some extra coding. But the code is not TDWTF kind, rather it has grown past the original requirements and needs new clothes. The app is heavily asynchronous, and uses multiple threads, so it's not the trivial kind. Can anyone tell me what is the general rule when you have to decide whether to use the premade wheel vs. reinventing a new one? What would be the acceptance criteria for new code?


title: What guidelines should I follow while designing a library?

text: I am working on a Arduino project using the Uno. The project contains a significant amount of code. I would like to create a library and I may even share it later on. What guidelines should I follow while designing the library?


title: .Net developer trying to learn ruby on rails

text: I am a .NET developer and I just had the chance to play with Ruby on Rails this weekend. In .NET we separate layers of the application by creating separate class library projects. From the design pattern standpoint, do we have to do that in Rails too or is it just one whole project with everything in it?


title: Job market-wise, are more and more companies moving to NoSQL?

text: I know NoSQL isn't nearly as mature, but it's been about a year or so since I've kept up with anything recent. Is it still "the future", are companies moving towards this, or are they still stuck in relational land? Obviously each has it's pro's and con's, and a lot of companies software is built around the traditional RDMS, but is the general direction moving towards a NoSQL solution? Also what about Jobs? I have experience with C++/Java and have always been interested in databases, I only graduated about 9 months ago with my B.S. in Comp Science, and it's something I'd like to pursue (however I'm only knowledgeable on traditional RDMS). What would be the wisest thing for me to concentrate on at this point?


title: Suggestions for getting an open source electron beam tracking code going

text: I work in the field of accelerator physics and synchrotron radiation. High energy electrons circulating in large rings of magnets produce x-rays that are used for a variety of different kinds of science. Running and improving these facilities requires controlling and modelling the electron beam as it circulates in the ring. A code to model this basically requires trackers to follow the electrons through the elements (something called a symplectic integrator), and then the computation of different parameters associated with this motion. The problem with these codes is that every facility has there own (maybe 4-5 different codes, some with multiple versions). In principle the code is not so complex. And as a modelling project, one might think it has some general interest. Who doesn't want to be able to create a track in space out of magnets and watch the electrons circulate? There is a Matlab based code to do this called Accelerator Toolbox, but the creator of the code is no longer in the field. I put the code in Sourceforge under the name atcollab. The basic resource is a set of symplectic integrators written in C. These are then compiled into mex code and interfaced via Matlab. It has been useful to put the code on Sourceforge in order to exchange code, but the community of users is quite small and most are too busy to put that much time into collaboration. So in terms of really improving the code, I don't think it has been so successful. Any piece of this picture could be recreated without that much difficulty, but overall it is a bit complex, and because each lab has their own installation with lots of added-on code and locally developed tools, people find it hard to really work together and share code. Somehow I think we need to involve a wider community in our development, or just use some standard tools. But for that, I suppose it needs to be of some general interest. I think symplectic integrators may have some general interest. And the part about a plug-in architecture to build up the ring ought to fit other patterns. Or the other option is to just accept that this is not a problem of general interest, and work harder within our small community. Suggestions or anecdotes of analogous experience would be appreciated.


title: Real performance of node.js

text: I've got a question concerning node.js performance. There is quite lot of "benchmarks" and a lot of fuss about great performance of node.js. But how does it stand in real world? Not just process empty request at high speed. If someone could try to compare this scenario: Java (or equivalent) server running an application with complex business logic between receiving request and sending response. How would node.js deal with it? If there was need for a lot of JavaScript processing on server side, is node.js really so fast that it can execute JavaScript, and stand a chance against more heavyveight competitors?


title: Why the static data members have to be defined outside the class separately in C++ (unlike Java)?

text: class A {       static int foo () {} // ok       static int x; // <--- needed to be defined separately in .cpp file     };      I don't see a need of having `A::x` defined separately in a .cpp file (or same file for templates). Why can't be `A::x` declared and defined at the same time? Has it been forbidden for historical reasons? My main question is, will it affect any functionality if `static` data members were declared/defined at the same time (same as **Java** ) ?


title: Why use phpunit when traditional manual testing can be used

text: When I make a web app I test my work on the browser to see if I receive any errors and fix them. I have made complex applications and testing this way has been easy and fast. I have watched many videos on youtube regarding phpunit and cannot find a purpose for it. Why is this library useful? Is phpunit more for php framworks like cakephp or zend? I dont use any framework just core php. Would or can phpunit be useful for me? If yes, how? There is also xdebug but I'm not sure if it relates.


title: Trac/SVN to DVCS Migration

text: The project I'm currently working on is using Trac, with SVN integration. It's worked great until now. Now, however, we've taken on some additional developers and we're running into issues with branching and merging. Because of this, I think a move to a distributed version control system is in order. The problem is that Trac is very closely integrated with the SVN repository. We have tight integration between the tickets and the revision numbers of code changes corresponding to those tickets. In addition we have a support wiki that has a lot of data that helps the tech. support team. Is there a way we can migrate to git or mercurial without losing the benefits of Trac? I've looked at the git plugin for Trac, and I'm unsure of how well it works. Has anyone here used it with a project that's been migrated from SVN? **EDIT:** I should note that the most important priority for us is maintaining the links between Trac tickets and the corresponding changesets in SVN. That's a tool that we use every day, and it provides an easy way to jump to code changes when reviewing tickets. Wiki migration would be nice to have, but if it's not possible, we can continue to run the old system whilst we write some kind of a one-off script to migrate the content.


title: I need some counter-points to counter the argument of why NOT to use M-V-P

text: I whipped up a demo on Friday before the holiday weekend of using the Model- View-Presenter pattern (the "Passive View" version, I believe) that I want to show to my co-workers this week as an example of how to architect our WebForms application moving forward and get maintainable, clean code. We currently keep almost all logic outside of some data access routines in the code-behind files. I know immediately one of the points raised will be that it's _faster/easier to just use code-behind_ rather than create a separate class library for the views and presenters, and having to create a separate view per page (that at least can get hairy as we have well over a hundred pages, although at this point I'm talking about future development and not retrofitting the rest of the code). The argument will be that it's much faster to get a task done by doing something like this:               protected void Page_Load(object sender, EventArgs e)     {         DataSet ds = Customer.Get(Request.QueryString["custid"]);         if (ds.Tables[0].Rows.Count > 0)         {            txtFirstName.Text = ds.Tables[0].Rows[0]["fname"].ToString();            // other properties here..          }     }      than this:               // CustomerDetails.aspx     private CustomerDetailsPresenter _presenter;          protected void Page_Load(object sender, EventArgs e)     {         long customerId = Convert.ToInt64(Request.QueryString["custid"]);         _presenter = new CustomerDetailsPresenter(this);         _presenter.Init(customerId);     }          // CustomerDetailsPresenter.cs     class CustomerDetailsPresenter      {         private ICustomerDetailsView _view;              // ctor here...              public void Init(long customerId);         {             // get customer somehow, via ORM or DataSet or whatever...             _view.FirstName = firstName; // some string, whether from dataset or ORM         }     }      What counter-arguments can I use to show the benefit of using the MVP pattern? Specifically ways it would **improve** the speed and efficiency of getting things done. Just saying "it's cleaner" or "you can properly abstract the code" isn't enough because code quality has never been a big issue, just speed (and now that mentality is biting us in the rear). **NOTE:** This is for new features to an existing brownfield/legacy application, not for a new site (I would chose MVC for a brand new site). New pages that have to interact with the application as a whole, radical changes to old pages, and the like is what we normally do and what I'm talking about using MVP for.


title: old KDE project

text: So I have this old C++, KDE project for QT 3.3.x. The IDE's version is 3.0.0-10, the one that comes with Linux RedHat 7.3. I'd want to get rid of the dependency to this environment, in other words I'd like to manage the project throught Makefiles. Alternatively, it would also be acceptable if I could port this KDE project to Eclipse. Has someone been successful in doing this?


title: Data Access Objects old fashioned?

text: A couple of weeks ago I delivered some work for a university project. After a code review with some teachers I got some snarky remarks about the fact that I was (still) using Data Access Objects. The teacher in question who said this mentions the use of DAO's in his classes and always says something along the lines of "Back then we always used DAO's". He's a big fan of Object Relational Mapping, which I also think is a great tool. When I was talking about this with some of my fellow students, they also mentioned that they prefer the use of ORM, which I can understand. It did make me wonder though, is using DAO's really so old fashioned? I know that at my work DAO's are still being used, but this is due to the fact that some of the code is rather old and therefor can't be coupled with ORM. We also do use ORM at my work. Trying to find some more information on Google or Stack Exchange sites didn't really enlighten me. Should I step away from the use of DAO's and only start implementing ORM? I just feel that ORM's can be a bit overkill for some simple projects. I'd love to hear your opinions (or facts) about this.


title: When should a method of a class return the same instance after modifying itself?

text: I have a class that has three methods `A()`, `B()` and `C()`. Those methods modify the own instance. While the methods have to return an instance when the instance is a separate copy (just as `Clone()`), I got a free choice to return `void` or the same instance (`return this;`) when modifying the same instance in the method and not returning any other value. When deciding for returning the same modified instance, I can do neat method chains like `obj.A().B().C();`. Would this be the only reason for doing so? Is it even okay to modify the own instance and return it, too? Or should it only return a copy and leave the original object as before? Because when returning the same modified instance the user would maybe admit the returned value is a copy, otherwise it would not be returned? If it's okay, what's the best way to clarify such things on the method?


title: Front end first or Back end first. Of the two which is a Good system design pratice?

text: I have a client right now requiring me to develop a school enrollment system. Now this is the first time im having this kind of challenge. Most of the past software that i created are not that complex. I know most all of you have created complex softwares, i just want your advise on this. Should i design first the front end or back end? thanks! Here's a conclusion of an article I found in the internet a while ago. Just whant to share http://www.skitoy.com/p/front-end-vs-back-end-developers-my-take/157 **Front-end vs. back-end developers (my take)** My personal take Again it’s a matter of training, some broad stroke generalizations: **Front end developers**   * **Typically don’t have a CS degree, or have a CS degree from a 3rd tier school.**   * Work in languages that similar to basic (see PHP is Basic)   * Have a visual skill in converting photoshop documents to CSS/HTML/etc.   * Have a high tolerance for iterative programming, due to type free languages **Back end developers**   * **Have a CS degree or lots of experience**   * Tend to me more systematic in their problem solving approach   * Don’t mind spending days finding the one object that is leaking   * Try and build tools to solve problems


title: Nicest way to map rgb colors from html to led

text: I have attached an rgb led to a color picker on a webpage and have hit the obvious problem that though the led is 8-bit like html the color rendition is very different so with the more subtle shades the led values for the color are wildly different to the html values. The brute-force method would be for me to have a lookup-table on the webserver to map the two sets of values but would ideally like to do it more elegantly Before I start listing all my 101 ideas for doing this I wondered if anyone else had come across the issue, the end-game would be to be able to abstract the color-rendition of different leds and make it available as a webservice (html value and device id in, led value out)


title: Should Whitebox testers be involved in the software design process?

text: Should Whitebox testers be involved in the software design process and why?


title: inheritance and static final variables

text: I'm a programing student. I've been having problem to organize Java classes that use inheritance and static final variables. Let say I have an abstract class named Form that has two children named Rectangle and Triangle. Those two children have a final static variable named NumberOfSides. Both children classes need identical getters for that variable.... Would it be possible to write that getter in the "mother" class? Thanks for your help.


title: Is embedded programming closer to electrical engineering or software development?

text: I am being approached with a job for writing embedded C on micro controllers. At first I would have thought that embedding programming is too low on the software stack for me, but maybe I am thinking about it wrong. Normally I would have shrugged off an opportunity to write embedded code, as I don't consider myself an electrical engineer. Is this a bad assumption? Am I able to write interesting and useful software for embedded systems, or will I kick myself for dropping too low on the software stack? I went to school for computer science and really enjoyed writing a compiler, thinking about concurrent algorithms, designing data structures, and developing frameworks. However, I am currently employed as a web developer, which doesn't scream the interesting things I just described. (I currently deal with issues like: "this check box needs to be 4 pixels to the left" and "this date is formatted wrong".) I appreciate everyone's input. I know I have to make the decision for myself, I just would like some clarification on what it means to be a embedded programmer, and if it fits what I find to be interesting.


title: Working with fubar/refuctored code

text: I'm working with some code which was written by a contractor who left a year ago leaving a number of projects with buggy, disgustingly bad code. This is what I call cowboy PHP, say no more. Ideally I'd like to leave the project as is and never touch it again. Things break, requirements change and it needs to be maintained. Part A needs to be changed. There is a bug I cannot reproduce. Part A is connect to parts B D and E. This kind of work gives me a headache and makes me die a little inside. It kills my motivation and productivity. To be honest I'd say it's affecting my mental health. Perhaps being at the start of my career I'm being naive to think production code should be reasonably clean. I would like to hear from anyone else who has been in this situation before. What did you do to get out of it? I'm thinking long term I might have to find another job. **Edit** I've moved on from this company now, to a place where idiots are not employed. The code isn't perfect but it's at least manageable and peer reviewed. There are a lot of people in the comments below telling me that software is messy like this. Sure I don't agree with the way some programmers do things but this code was seriously mangled. The guy who wrote it tried to reinvent every wheel he could, and badly. He stopped getting work from us because of his bad code that nobody on the team could stand. If it were easy to refactor I would have. Eventually after many ' _just do this small 10minute change_ ' situations had ballooned into hours of lost time (regardless of who on the team was doing the work) my boss finally caved in it was rewritten.


title: Which one of the SOLID principles had the largest effect on your code?

text: Which if the SOLID principles introduced by "Uncle Bob" Martin had the largest effect on your day to day coding? Please give details!


title: If the UI layer depends on the Application layer. Who starts the application/process?

text: This is related to DDD for a desktop application in c#...with 4 layers ui/application/domain/infrastructure. Actually 3 desktop applications sharing part of the domain and part of the infrastructure. In an effort to avoid developers crossing the wrong layers and using the wrong classes, I separated the layer in assemblies and set the reference/dependencies in accordance. If the infrastructure is a dll/assembly and the domain another dll/assembly and the application is an exe/assembly and the ui is a dll/assembly... then the project cannot the build. Who's gonna load the the ui.dll? Am I missing something here? The only solution i have come with is creating a fifth layer called Program. That layer will have the entry point of the program and will wire everything together (I'm using DI with Unity ) Any idea?


title: Checking that a function is only run from __main__ in Python

text: I often end up with code files that can either be imported or run as `__main__`. It's easy to handle this by checking if `__name__ == '__main__'`. But sometimes if my main function gets too big I split out pieces of it into other functions, expecting that they'll only be called when `__name__ == '__main__'`. Sometimes I enforce this condition by calling the following `assert_main` function:               def assert_main():         "Use this in a module you only expect to get run as __main__, not imported"         mod = sys._getframe(1).f_globals["__name__"]         if "__main__" != mod:             raise Exception("Module {} is not main".format(mod))      Other options would include making `assert_main` into a decorator or putting the definitions of the functions in question inside of `if __name__ == '__main__'` block. And there may well be other options I haven't thought of. What is the idiomatically correct thing to do?


title: Would you use C, today, for a software project?

text: If yes, where and why would you use it? If no, please provide an explanation to why C is not acceptable to you.


title: What's the practical difference between the styles of dependency injection?

text: I'm new to dependency injection and I have a few questions about which style I shouldI use in my applications. I've just read _Inversion of Control Containers and the Dependency Injection pattern_ by Martin Fowler, but I can't get the practical difference between constructor, setter and interface injection. It seems to me that the reasons for using one over the other are just a matter of code cleaning and/or clarity. What is the difference? Are there any strong advantages or disadvantages for using one over the other, or is it just what I've stated before? In my opinion, _constructor injection_ is the most intuitive of all, as well as _interface injection_ is the least. In the other hand, _setter injection_ is a middle term, but, are you supposed to be able to change the instance of the dependency object you initially injected? Does this style of injection guarantees that the object which needs the dependency will always have it injected? I believe not, but please correct me if I'm wrong.


title: I don't understand value iteration

text: In class I am learning about value iteration and markov decision problems, we are doing through the UC Berkley pac-man project, so I am trying to write the value iterator for it and as I understand it, value iteration is that for each iteration you are visiting every state, and then tracking to a terminal state to get its value. I have a feeling I am not right, because when I try that in python I get a recursive depth exceed. So I return to the pseudo-code, and there is a `Vk[s]` and `Vk-1[s']`, which I had thought to mean value of state, and value of `newState`, but I must be missing something. So what is the significance of the `k` and `k-1`? My Code:                def val(i, state):             if mdp.isTerminal(state) or i == 0:                 return 0.0             actionCost = {}             for action in mdp.getPossibleActions(state):                 actionCost[action] = 0                 for (nextState, probability) in mdp.getTransitionStatesAndProbs(state, action):                     reward = mdp.getReward(state, action, nextState)                     actionCost[action] += probability * reward + discount * val(i - 1, nextState)                     return actionCost[max(actionCost, key=actionCost.get)]              for i in range(iterations):             for state in mdp.getStates():                   self.values[state] = val(i, state)      Pseudo Code:               k ←0      repeat           k ←k+1            for each state s do                Vk[s] = maxa ∑s' P(s'|s,a) (R(s,a,s')+ γVk-1[s'])      until ∀s |Vk[s]-Vk-1[s]| < θ


title: Multiple javaScript libraries | Emerging standards - compare to C++

text: It seems like there are many different styles to write JavaScript, in fact I've heard that JavaScript is an expressive language. But the point of code is functionality (function) not expression (form). Is there a library that will be adopted into the ECMA standard the way the STL and Boost Library were adopted in to the C++ standard?


title: Converting data-structure in Perl

text: A function produces this hash of arrays:               'KEYNAME1' => ARRAY(0x1edeeb0)        0  'val11'        1  'val12'        2  'val13'     'KEYNAME2' => ARRAY(0x1efacb8)        0  'val21'        1  'val22'        2  'val23'      Another function requires an array of hashes containing arrays:               0  HASH(0x1f6df98)        'KEYNAME1' => ARRAY(0x1f776b0)           0  'val11'           1  'val12'           2  'val13'     1  HASH(0x1f6dfe0)        'KEYNAME2' => ARRAY(0x1f6df80)           0  'val21'           1  'val22'           2  'val23'      This code converts the first to the second, but is there an easier way?


title: Why put a simple query into a stored procedure in a web service?

text: I'm working as a junior programmer, and the senior programmer above me has instructed me to follow a certain unofficial policy for constructing new queries on our web development projects. Generally, we are developing an intranet site for some client, and they always have databases. He wants me to have a **class** containing a method for each query that the website will perform. This class calls web methods in a web service, hosted on the same machine. Those web methods use ADO to run stored procedures that perform simple queries. Sometimes the queries need parameters and sometimes they don't. When I say simple queries, I mean simple...`select * from table where column=@parameter` I feel like there are several extra steps here, and I'm hoping someone can explain why he might want this as our standard procedure for using databases in web apps. He says each step adds a layer of security. I'm genuinely interested in how all this provides security. Is all this necessary? Why or why not?


title: Deleting dynamic elements from a database

text: I have a select dropdown, with '+' and '-' buttons that add and remove items before submission. I would like to be able to remove the elements with the '-' button after they have been added to the database. I'm not sure how to go about doing this, other than removing prior entries and rewriting the options again. Ideally, it would be reusable and simple to figure for the other developer on the team, or anyone who may replace me down the line. Can someone point me in the right direction?


title: How to swap out a DB from MySQL to SQL Server in a multiple large projects?

text: Is there a sane way / best practices way to swap out a DB from MySQL to SQL Server in a multiple large projects? Some of the projects are ASP projects, some of them are windows services, some are standalone windows apps. I don't think any ORM is used. I think its just SQL statements all over the place.


title: Dependency injection in constructor, method or just use a static class instead?

text: What is the best between:               $dispatcher = new Dispatcher($request);     $dispatcher->dispatch();      and               $dispatcher = new Dispatcher();     $dispatcher->dispatch($request);      or even               Dispatcher::dispatch($request);      Knowing that only one method of this class uses the $request instance. I naturally tend to the last solution because the class have no other states, but by I feel that it may not be the best OOP solution.


title: What is 'work' in the Pomodoro Technique?

text: I have just started to use Pomodoro today and I am trying to work out what I should and should not do during my 25 minute work time. For my 25 minute work stint I started to write some code and realised that I had done something similar in a related project so I opened that solution to copy and paste that existing code. Question is, is this allowed? Also, if during my 25 minutes I realise that there is an important work- related email that I need to send can I do that or should I wait for the next 25 minutes or the break ? I am writing this question during my, now extended, 5 minute break. Is this work or is it a break? I really will appreciate some guidance as I want to use Pomodoro to focus better on my work. Another thing that happened to me was that a Adobe AIR update alert came up on my desktop during the 25 minutes. Should I ignore such things until the break? Sachin


title: How do I tell my boss he made the wrong choice?

text: Recently, our biggest product failed majorly because we'd only used outsourced labor to do it, and they never tested anything, etc. Finally, our CEO decided that the US team should learn the code and fix it up. (Not a total rewrite, but lots of formatting/style changes, refactoring, etc). However, he knows next to nothing about programming (thankfully, he admits it). He had been grooming me to take on the project manager position, but I had to go back to college. Now he gave it to another programmer who is naive and inexperienced. I don't feel the naive programmer will do nearly as well. The CEO's reasoning is that the naive programmer can work full time and I can only do part time, so the less senior programmer could put more work into it. How can I convince him that 15 hours of my time is worth more than the other guy's 40?


title: Should I continue learning a language if in the meanwhile I became interested in another language/platform?

text: I started learning Java a couple of months ago. I also wanted to become more exposed to linux so I installed ubuntu and started working with Java since then. In the meanwhile however I became more interested in C# and in learning the Windows platform. At this point I'm asking myself if I should stop learning Java and move to the .NET world. I don't hate or dislike Java by the way, I am just more curious about windows/.NET at this point in time. My question is, should I remain with Java or go with C#/.NET? What is your advice?


title: Why a hashtable? Why not just a non-hashed associative array?

text: I've been learning about using a hashtable to efficiently check for items in a list without looping through the whole thing, but there's one thing that I don't get: Why hashed keys? It seems like:               var wordList = {        'aa'    : ['aa'],        'aah'   : ['aah'],        'ahhed' : ['aahed']     };      Would work just as well as:               var wordList = {        '/* hashed value of aa*/'    : ['aa'],        '/* hashed value of aah*/'   : ['aah'],        '/* hashed value of aahed*/' : ['aahed']     };      **What's the performance difference between looking up a hashed key and a simple name key?**


title: What is the actual problem with a prototype based design?

text: I feel like anything that can be developed using OO/functional languages can be generally made 'better' using a prototype based language, because they appaer to have the best of them all: high order functions, flexibility to simulate any OO structure, productivity (low verbosity) and scalability because of concurrency. But it seems like they are avoided for the creation of executable applications and of bigger projects in general. Why that?


title: Removing hard-coded values and defensive design vs YAGNI

text: First a bit of background. I'm coding a lookup from Age -> Rate. There are 7 age brackets so the lookup table is 3 columns (From|To|Rate) with 7 rows. The values rarely change - they are legislated rates (first and third columns) that have stayed the same for 3 years. I figured that the easiest way to store this table without hard-coding it is in the database in a global configuration table, as a single text value containing a CSV (so "65,69,0.05,70,74,0.06" is how the 65-69 and 70-74 tiers would be stored). Relatively easy to parse then use. Then I realised that to implement this I would have to create a new table, a repository to wrap around it, data layer tests for the repo, unit tests around the code that unflattens the CSV into the table, and tests around the lookup itself. The only benefit of all this work is avoiding hard-coding the lookup table. When talking to the users (who currently use the lookup table directly - by looking at a hard copy) the opinion is pretty much that "the rates never change." Obviously that isn't actually correct - the rates were only created three years ago and in the past things that "never change" have had a habit of changing - so for me to defensively program this I definitely shouldn't store the lookup table in the application. Except when I think YAGNI. The feature I am implementing doesn't specify that the rates will change. If the rates do change, they will still change so rarely that maintenance isn't even a consideration, and the feature isn't actually critical enough that anything would be affected if there was a delay between the rate change and the updated application. I've pretty much decided that nothing of value will be lost if I hard-code the lookup, and I'm not too concerned about my approach to this particular feature. My question is, as a professional have I properly justified that decision? Hard-coding values is bad design, but going to the trouble of removing the values from the application seems to violate the YAGNI principle. EDIT To clarify the question, I'm not concerned about the actual implementation. I'm concerned that I can either do a quick, bad thing, and justify it by saying YAGNI, or I can take a more defensive, high-effort approach, that even in the best case ultimately has low benefits. As a professional programmer does my decision to implement a design that I know is flawed simply come down to a cost/benefit analysis? EDIT While all the answers were very interesting as I think this comes down to an individual's design choices, I think the best answers were @Corbin's and @E.Z. Hart's as they bring up things that I hadn't considered in the question:   * the false dichotomy of 'correctly removing hard-coded values' by moving it to the database vs 'efficiently applying YAGNI' by using hard-coding. There was a third option of putting the lookup table into the app configuration, which doesn't incur the overhead of the correct way, and without the efficiency of YAGNI. We generally aren't limited to either/or decisions, and it then comes down to a cost/benefit decision.   * code generation can reduce the overhead of moving the hard-coded values to the database, and in a way that also removes my over-engineered decision to process a CSV into the table. Potentially this also adds a long-term maintenance issue with the generated code if the basic requirements change for the lookup method. This all just affects the cost/benefit analysis, and it is likely that if I had had that automation available I wouldn't have even considered hard-coding something like this. I'm marking @Corbin's answer as correct because it changes my assumptions of development cost, and I'll probably add some code generation tools to my arsenal in the near future.


title: Definition of a 3-tier system

text: People often claim that they are following a '3-tier (or n-tier) architecture', and sometimes they then claim to be switching to a Domain Model. But I really never have understood what this mythical '3-tier architecture' is. It seems to have no formal definition. Whereas there are numerous references and examples around that explain and demonstrate the Domain Model pattern, any reference to 3-tier simply suggests you should separate your code into UI, Business Logic and Data Access Layers. And that's all they seem to say. What I find particularly strange is that to me, Domain Model is the perfect embodiment of this 3-tier paradigm. the ORM and mapping files are the Data Access Layer, the Domain is the Business Logic, and the UI is the, well, UI. So why do people talk as though it is something new and different, and something they should switch to? Before I saw people implementing Domain Model, most applications were UIs accessing stored procedures with the logic split across the UI and the SPs. Sometimes there were a few assemblies called 'UI', 'BLL' and 'DLL' but usually these were just mediators between the UIs and SPs, leaving more places for the logic to be randomly spread across. So what is this mythical '3-tier' architecture? Does it really even exist? and if so, where are some examples of it implemented well?


title: Managing manual test protocols

text: We have to organize a very long list of manually running tests. Currently we use Word documents, print them out check them off etc. Ugh-ly but works, with problems. **Problems with the current solution**   * Requesting and executing subsets, depending on the actual changes. (i.e. tests 153, 155-157 and 24325 need to run only if Module X changed)   * Branching. Different releases (which are still maintained, up to a point) have different test protocols, but share a lot of contents. Manual copy & paste.   * Tracking "Test Template" vs. "Test executed" documents. It's a bit old-style office with lots of forms & binders.    * Tracking in source control together with the source changes. Ideally, the same way features are copied / moved between branches, i.e. as diffable document that is included in a commit. **Content requirements** Documents need images (usually, hardware setup specs and screenshots of "good" curves), "Pass / Fail" checkboxes and minor formatting (suc has emphasis, steps, distinction of "things to do" and "what to expect") **Current idea** One of my devs suggested we use HTML documents instead (Sharepoint Designer is deemed appropriate for editing), "normalize them somehow so they are diffable", and put them under version control together with the sources. I am personally not wholly sold on this idea for various reasons, but I agree with the other guys that if it works it's better than Word documents. **The Question:** How do you / would manage the documentation for manual tests? Do you know any tools? Ideas? We are open to other solutions, but only with minimal custom development efforts. Example: installing dedicated software, configuring some templates would be great, but we have no resources for "hack something together with XML and stylesheets and a database, that should be easy". **Some facts &figures** Source control is git, 6 software developers, ~1.5KLoc, one run through _all_ manual tests takes about 4 man-weeks (order of magnitude) and roughly the same in wall time with all modifications and repetitions. (A full run only happens for major releases.) * * * Note: _Please don't tell me to test automatically,_ thank you but we already do. The manual tests involve integration, visualization and external measurement equipment. In addition, the information produced is so multifold that the discoveries of a engineer who knows the whole system discovers a whole lot more with a single look at a chart. * * * Example: A typcial test setup would look like this, every question mark needs to be "checked", it's usually 5..15 tests per setup > Connect 10Ohm resistor to S1. Connect amplifier input to OUT 1. Run test > Template 42. > >   * Measure voltage over resistor. ~1Vrms ? >   * In Table 3 Uac = 1.0 V, Iac= 0.1 A, ISNR+D > 45 dB ? >   * U(f) Spectrum flat for f > 10 Hz? >   * ... >


title: Looking for searchable code archives

text: As part of research for a user group presentation I'm looking for usage examples of certain code constructs. I'm looking for online source code repository collections that allow me to search inside the source code across the whole collection. GitHub does it but it's a bit light on the sort of code I'm looking for. Sourceforge searches only the project description text rather than the source code. Any others I should try?


title: General solution to solve different sports results in different languages

text: I currently have some code that checks if squash and tennis scores are valid, both in javascript and PHP. This results in 4 blocks of code existing, 2 languages * 2 sports, which does not scale well should any extra sports come around, or extra languages... How can one describe the valid scores of games via a settings/text file, so that each language can parse them and apply these rules. I'm stumped with the strange tie break situations in tennis should it reach 6-6 in a set, and also infinite play off in the final set should it reach 2 sets all. ie:               tennis = {         "format": [             {                 "name": "sets",                 "min": 3,                 "max": 5,                 "winby": 1             },             {                 "name": "games",                 "min": 6,                 "max": 7,                 "winby": 2             }         ]     }          squash = {         "format": [             {                 "name": "games",                 "min": 3,                 "max": 5,                 "winby": 1             },             {                 "name": "points",                 "min": 15,                 "max": 0,                 "winby": 2             }         ]     }


title: Is any JavaScript  code used only for websites, open source?

text: **Rewritten question:** I'm not asking a JavaScript-related question, but all "client" languages used on the web (HTML5, JavaScript, CSS, and so on). If I put JavaScript code (that is GPLed) on my website, and this website is accessible from anyone over the web, am I violating the GPL in some way? What happens if I would like to sell the client-code (HTML, CSS, JavaScript) to someone? Do I need a different license in this case? Isn't JavaScript (when used for websites) always open source? When you open a webpage you can always read the source. Do I also need to release my server-side code if I'm selling a website which contains JavaScript GPLed code? What happens if this website is partially accessible (a part is free and the other requires you to pay) but the GPLed code (the same part) is used on both sides of the website? What if the GPLed code is only in a part of the website that requires you to pay to access it? If I'm selling a website to a customer in this way:   1. I'm selling you (one time fee) all client-related code (JavaScript, HTML and CSS)   2. I'm **not** selling you the server-side code, you're renting it (I don't want to let you reuse my server-side code) If I'm using some JavaScript GPLed code, am I violating something? (The website is accessible from anyone over the web.) **Edit 2:** Added a new specific question: What if the website can work without server-side code, I mean, JavaScript is just calling some PHP pages that contains data in JSON format. Other people can build a website with the client side, but they will need to provide data. In this case JavaScript is calling the "PHP" code (but not the opposite) I think. In this case, am I violating GPL?


title: Why Big Data Needs To Be Functional?

text: I started working on a new project lately related to Big Data for my internship. My managers recommended to start learning functional programming (They highly recommended Scala). I had a humbled experience using F#, but I couldn't see the the important of using this paradigm of programming as it's expensive in some cases. Dean gave an interesting talk about this topic, and shared his thoughts on why "Big Data" here : http://www.youtube.com/watch?v=DFAdLCqDbLQ But it wasn't very convenient as Big Data doesn't mean only Hadoop. As BigData is very vague concept. I forget it for a while. I tried to come-up with one simple example to compare between the different aspects when we deal with data, to see if functional way is expensive or no. If functional programming is expensive and memory-consuming for small data, why do we need it for Big Data ? Far from fancy tools, I tried to build a solution for one specific and popular problem using three approaches: Imperative way and functional way (recursion, using collections). I compared time and complexity,to compare between the three approaches. I used Scala to write these functions as it's the best tool to write an algorithm using three paradigms               def main(args: Array[String]) {         val start = System.currentTimeMillis()         // Fibonacci_P         val s = Fibonacci_P(400000000)         val end = System.currentTimeMillis()         println("Functional way: \n the Fibonacci sequence whose values do not exceed four million : %d \n Time : %d ".format(s, end - start))         val start2 = System.currentTimeMillis()              // Fibonacci_I         val s2 = Fibonacci_I(40000000 0)         val end2 = System.currentTimeMillis();         println("Imperative way: \n the Fibonacci sequence whose values do not exceed four million : %d \n Time : %d ".format(s2, end2 - start2))     }      Functional way :               def Fibonacci_P(max: BigInt): BigInt = {         //http://www.scala-lang.org/api/current/index.html#scala.collection.immutable.Stream         //lazy val Fibonaccis: Stream[Long] = 0 #:: 1 #:: Fibonaccis.zip(Fibonaccis.tail).map { case (a, b) => a + b }         lazy val fibs: Stream[BigInt] = BigInt(0)#::BigInt(1)#::fibs.zip(fibs.tail).map {             n = > n._1 + n._2         }         // println(fibs.takeWhile(p => p < max).toList)         fibs.takeWhile(p = > p < max).foldLeft(BigInt(0))(_ + _)     }      Recursive way:               def Fibonacci_R(n: Int): BigInt = n match {         case 1 | 2 = > 1         case _ = > Fibonacci_R(n - 1) + Fibonacci_R(n - 2)     }      Imperative way:               def Fibonacci_I(max: BigInt): BigInt = {         var first_element: BigInt = 0         var second_element: BigInt = 1         var sum: BigInt = 0              while (second_element < max) {             sum += second_element                  second_element = first_element + second_element             first_element = second_element - first_element         }              //Return          sum     }      I noticed that Functional programming is heavy! it takes longer time and consume more space in memory. I am confused, whenever I read an article or watch a talk, they say that we should use functional programming in data science. True, it 's easier and more productive, specially in data world. but it takes more time and more memory space . So, why do we need to use Functional programming in Big Data ? What are the best practices to use functional programming (Scala) for Big Data ?


title: Does C# Cache Calculation Results?

text: I am recently building a basic ray tracer in C# from scratch, as a learning/teaching project. A previous release of the project (let's call it A) does reflections and diffuse shading. The program renders the scene at around 900ms. Now I've just made a release B which adds specular highlights. Naturally, I assumed rendering time would increase. Imagine my surprise when the same scene rendered in a speedy 120ms! The results are absolutely the same (since the objects in the scene don't actually have specular highlights). Curious, I tried to narrow down what part of the code is actually making it faster. I think I've narrowed it down to a calculation that is made in both the reflection component, and the specular component (calculating the reflection vector). For each iteration of the ray tracing, both calculate the same vector (same inputs, same output), but there is no data sharing between the two. So I was wondering if C# is somehow caching the results which would account for the performance increase? Here's the code for the reflection rendering               private Color TraceReflection(Ray ray, Vector3D normal, Vector3D hitPoint, IPrimitive hitObject, int Level)         {             //Calculate reflection direction             var reflectionDir = (ray.Direction - (2 * (ray.Direction * normal) * normal)).Normalize();                  //Create reflection ray from just outside the intersection point, and trace it             var reflectionRay = new Ray(hitPoint + reflectionDir * Globals.Epsilon, reflectionDir);                  //Get the color from the reflection             var reflectionColor = RayTrace(reflectionRay, Level + 1);                  //Calculate final color             var resultColor = reflectionColor * hitObject.PrimitiveMaterial.ReflectionCoeff;                  return resultColor;         }      And here's the specular highlight function:               public  Color GetColor(IPrimitive HitObject, ILight Light, Vector3D ViewDirection, Vector3D LightDirection, Vector3D Normal)         {             //Caulcate reflection vector             var reflectionDirection = (LightDirection - (2 * LightDirection * Normal) * Normal).Normalize();                  var dot = reflectionDirection * ViewDirection; //if the dot product is zero or less that means the angle between the two vectors is 90 or more and no highlighting occurs.                  if (dot > 0)             {                 var specularPower = HitObject.PrimitiveMaterial.SpecularCoeff * Math.Pow(dot, HitObject.PrimitiveMaterial.SpecularExponent);                 var highlightColor = HitObject.PrimitiveMaterial.DiffuseColor * specularPower;                      return highlightColor;             }                  return new Color();         }      ## UPDATE The previous numbers were when both programs were running in debug mode. I just switched them both to release, and the numbers are what I was expecting them to be in the first place (270ms without specular. 380ms **with** specular). So it seems the debug mode, somehow, is the culprit.


title: Task Planning on an Agile Team

text: At the beginning of each sprint our team will pull in a handful of user stories and then, one by one, write slightly more detailed tasks for them as well as assign specific hours to each task. Having individual tasks helps us establish our sprint burn-down by having a specific total number of hours up front, as well as make it more feasible to keep track of who's working on what and what all has been completed. However, I recently read that some mature Agile teams have eliminated the use of writing tasks altogether and head right into their sprints armed only with their user stories as the modularized sources of work for the sprint. I'm having a hard time seeing how eliminating task planning could still provide an Agile team with small enough units of work so as to keep the sprint organized and transparent. Has anyone here tried or use this approach and if so how do you keep track of exactly who is working on what?


title: How to properly structure a project in winform?

text: A while ago I started to create a winform application and at that time it was small and I did not give any thought of how to structure the project. Since then I added additional features as I needed and the project folder is getting bigger and bigger and now I think it is time to structure the project in some way, but I am not sure what is the proper way, so I have few questions. **How to properly restructure the project folder?** At the moment I am thinking of something like this:   * Create Folder for Forms   * Create Folder for Utility classes   * Create Folder for Classes that contain only data  **What is the naming convention when adding classes?** Should I also rename classes so that their functionality can be identified by just looking at their name? For example renaming all forms classes, so that their name ends with **Form**. Or is this not necessary if special folders for them are created? **What to do, so that not all the code for main form ends up in Form1.cs** Another problem I encountered is that as the main form is getting more massive with each feature I add, the code file (Form1.cs) is getting really big. I have for example a TabControl and each tab has bunch of controls and all the code ended up in Form1.cs. How to avoid this? **Also, Do you know any articles or books that deal with these problems?**


title: Matching two lists of data with different conventions

text: I have two lists of data, A and B. These lists are themselves aggregated from multiple sources, and contain typos, abbreviations not found in the other, and also lack a 1-1 mapping, but will never have a value in A that maps to two values in B and vice-versa. Right now, we're doing a naive (string comparison) match to create a map between the two lists. That has about 80% accuracy. I'd like to get that accuracy to at least 90% (95% would be incredible). Are there any software tools that can be used for something like this? I'd like some sort of tool that could traverse both lists and suggest matches. **Update from comments:** Right now, we only produce a hit if `A[x] == B[y]`. That gives us matches for 80% of the data in the data sets (which contain roughly fifty thousand rows each). What I'd like to do is find a tool or develop one based on an algorithm that will allow me to suggest a match for two values that are likely to have the same meaning, e.g. `KING ROAD` and `KG RD`. These potential matches would then be provided to a human to review and approve or ignore. Generally, I'd use something like Levenshtein, but this is somewhat parametrized data (think addresses) and I don't know how to apply something like Levenshtein to structured data.


title: Security in a private web service

text: I am developing a web site and a web service for a small on-line game. Technically, I'll be using Express (node.js) and MongoDB+Redis for the databases. This the structure I came up with:   * One Express server that will server as the Web Service. This will connect to the databases.    * One Express server that will provide the web site. It will connect to the Web Service to retrieve and push the information.   * iOS and Android application will be able to interact with the WebService. Taking into account:   * It is a small game. The information transferred is not critical.   * There will NOT be third party applications. At least for the moment. My concern is about which level of security I should use in each of the scenarios:   * Security of the user playing through web browser   * Security of the applications and the Web Server connecting to the WS. I have take a look at the different options and:   * OAuth and/or Https is too much for this scenario, isn't it?   * Will be a good option to hash the user and password with MD5(or similar) and some salt? I would like to get some directions and investigate by my own rather than getting a response like "you should you use this node.js module..." Thanks in advance,


title: Handling compiler bugs in Continuous Integration

text: I believe that warnings should be treated as errors. If you start ignoring warnings you'll start missing "important" warnings among the "unimportant" ones. So my Continuous Integration system fails a build if there are warnings. One of my compilers has a bug that causes it to raise a warning when it shouldn't. My code is valid and compiles correctly, and I can't disable this particular warning. How should my CI system handle this? Should I temporarily disable "warnings as errors", until the compiler is patched?


title: HTTP requests/responses analyser for Android

text: When using Firefox on my PC, for example, HTTP analysis is quite easy using for example the Net tab of Firebug. GETs, POSTs, etc., all there. What would be the best technique to see the HTTP requests an Android app sends? Another app? Some kind of hack via Wi-Fi and a router or USB modem?


title: Visual PHP? or Visual Ruby?

text: I am intrigued. Why does the open source industry not have 'Visual' products like 'Visual' Basic, 'Visual' C++ or 'Visual' ASP.NET? Why don't we have Visual PHP? or Visual RUBY?


title: How to write tasks in Jira when using Scrum?

text: I am going to start a new project using Scrum and Jira and I have some questions regarding how to write proper tasks in Jira. From what I understand user stories are small non-technical descriptions written by the stakeholders (ideally) that can have the form: As a user I want to order monkies so I can earn money. However these tasks must be elaborated with requirements, technical requirements etc. My question is: How do you write such tasks in Jira properly, and do I have the right understanding of user stories. Should I create user stories as super tasks and then create subtasks with the actual tasks/requirements? Should I estimate super tasks/user stories, or only the sub tasks?


title: Should we validate a state transition before attempting it in the State Pattern?

text: When applying the State Pattern illegal transitions should result in an exception being thrown (or at least that's what I understood from the pattern) I know exceptions are for "unexpected behavior" where an action isn't supposed to happen. Errors would be more appropriate if the required action is common (ex: user enters a wrong password) Now picture this, I have an admin panel where a list of orders are shown and each order has 3 buttons (Refund, Cancel, Reorder) where each one of them changes the state of the order if the operation is allowed. The 3 buttons are enabled by default (I'm simplifying my case here as my real system is much more complex than that). Now a user can for example push the cancel button for an order with state (Cancelled) which is an invalid state transition.   1. Since I expected that this illegal transition action to occur would a validation before attempting to **Cancel** the line be more appropriate?   2. If I validate before transition do I still need exceptions in the model?   3. Is there a better approach to the whole problem (ignoring disabling the buttons and client side validation)


title: How do you refrain from doing too much when maintaining code?

text: At my previous job, I was in a relatively easy ASP.NET developer role that had me turning over a large number of small database systems for internal use within the company. I churned out the required code, and all the while I had almost complete creative control. After releasing a system, I'd even come back to it when I was in a low period of work and refactor the code and generally improve the system for the users and/or other developers. I've now moved on, and tried to shift my career more towards what I am interested in. In doing so, I managed to find myself a great job (lots of learning, complex algorithms, etc). The problem is, I seem to have picked up some bad habits in my former job that seem to have leaked into my new job. My first task at my new job is updating a Bash script that performs a build and deploy of some code, and basically the guy I was doing the work for essentially refused to review my code because the file diff was _massive_. The problem was that while going through the code, I'd basically refactored half of the code into functions, standardized all the output, added a "debug mode" and basically given the script a hell of a spit-shine. But in doing this, I'd gone way off reservation and done _too much_. My colleague agreed that the code was good, but there was no way that I could commit the code without confusing other developers, and causing merge conflicts. Now I'm worried that my freedom at my last job, coupled with my inexperience as a programmer has gotten me into the habit of changing code on autopilot. **Are there any sure fire techniques for keeping yourself on a tight leash when maintaining code? Any tips for judging when you've done too much refactoring? Where do you draw the line between "if it ain't broke don't fix it", and allowing the code to rot?** Thanks! * * * **Some Clarifications**   * I've been working on this particular script for three days, and while I have been doing so, I've had the code change every day when pulling from source control! It's not big changes by any means, but changes nonetheless that require merging.   * The combined length of the Bash scripts (if they were to be concatenated) is approximately 4000-5000 lines. The part I'm working on (one file) is 2000.   * You have to consider that I am definitely at the bottom of the food chain here. Doing "code walkthroughs", while I have done them in the past, is not an option here because I can't tell other developers how to do their job with only 2 weeks experience under my belt. I'm looking more to establish a rapport with my colleagues at the minute, not rub them the wrong way by criticising their code.


title: Open Source P2P Java Chat library

text: I am making a P2P Android application. The initial functionality I am aiming for is chatting. Can anyone please suggest a good open source P2P library, using which I can build my application upon? Most of the ones I found are complete applications, but I want a library I can use to build my application.


title: Possible for one developer to work on a site thats on another developer's server?

text: Sorry for the confusing title. Let me explain: I am currently trying to get a site developed. My current developer has taken the site about as far as I think they are capable of and I am planning on hiring another developer to put the finishing touches on it, debug it and upgrade some of the more technical details. The site is hosted on my current developer's server. They are scheduled to work on it until mid-April, at which point they will transfer the site to my server. I would like the new developer to get started on the upgrades to the site as soon as possible. So my question is this: Is it possible for the new developer to start working on upgrades to the site while it is still on the old developer's server (and without the old developer knowing about it)? Would the new developer have to create a mirror site and work on it that way? I'm having trouble imagining if this is possible so any advice you can offer would be much appreciated!


title: Javadoc for outsiders versus javadoc for insiders

text: When building an API for a customer, the public javadoc has to contain just what you want to show the customer. Which is a shame, as it the javadoc is also, in some ways, the obvious target for some kinds of internal design documentation. One might imagine a custom doclet or some other trickery to allow the two types of information to coexist in the source. Anybody been there?


title: Why does Garbage Collection only sweep the heap?

text: Basically, I've learned so far that garbage collection erases forever any data structure that is not currently being pointed to. But this only checks the heap for such conditions. Why doesn't it also check the data section (globals, constants, etc etc) or the stack as well? What is it about the heap that it's the only thing that we want to be garbage collected?


title: What is a good time/task tracking software to use when consulting?

text: I am looking for time tracking software to use as an individual consulting on multiple projects at once. The projects I work on are billable to different clients. Some clients are billed on an hourly basis while others are billed on a project basis. I also track personal projects that may never produce income. I need to be able to track the time down to the individual task level. I am looking for software that is easy to use, cost effective, easy to invoice out of and has data mining reports.


title: Is this book a reliable source for beginning Java EE?

text: Core Servlets and Javaserver Pages: Core Technologies, Vol. 1 (2nd Edition) Can I rely on this book to learn Servlets and JSP,or is there a better book out there I should be reading instead?


title: What semantics should be used when referring to waterfall and agile methodologies

text: I've just been involved in a debate regarding semantics of how to define approaches to the software development lifecycle. As far as I have been concerned, waterfall and agile are not methodologies, they are vaguely defined approaches/models. The definition of a methodology being a set of tools and techniques used to exactly define the steps taken to develop a successful software project. In my understanding, the following statements are true: -   * SSADM (Structured System Analysis and Design) is a waterfall methodology   * Scrum is an agile methodology   * XP is an agile methodology Thus, it would not make sense to write: -   * Waterfall is a waterfall methodology   * Agile is an agile methodology Since you would get into a recursive mess. The issue is, whenever I get into this debate with anyone, they seem to be certain that waterfall is a methodology and so is agile. An example of what I see as being incorrect is the following article: - http://en.wikipedia.org/wiki/Software_development_methodology > Methodologies Waterfall Prototype model Incremental Iterative V-Model Spiral > Scrum Cleanroom RAD DSDM RUP XP Agile Lean Dual Vee Model TDD FDD DDD These are listed as methodologies on the wikipedia page and I find that this is just plain wrong. Can someone please correct me and/or let me know what terminology I should be using?


title: Why Microsoft’s Web API is named as ASP.Net Web API

text: ASP.Net is Active Server Pages using .Net Framework Wikipedia says > It was first released in January 2002 with version 1.0 of the .NET > Framework, and is the successor to Microsoft's Active Server Pages (ASP) > technology. While answering this question following thought came to me – why Microsoft named it’s Web API as “ASP.Net Web API”. There are no `Pages` involved in Web API. Then why do some people call it as “Active Server Pages .Net Web Api” ? I believe there are some `fundamental features` of ASP.Net shared with Web API. So what are they? Another observation - why is the tag in `programmers` naming it as "asp.net- mvc-web-api"? **Reference** :   1. ScottGu's Blog- ASP.NET Web API


title: How does Elastic Search approach the problem of distributed membership and consensus?

text: I already understand that Elastic Search is supposed to be deployed in a distributed topology, in that you can have multiple nodes for a cluster of ES instances. I like the API, and it looks promising. But I wonder how Elastic Search solves some standard problems in distributed computing. My "architectural" questions are motivated out of trying to understand whether I ought to commit to using the product. Consider membership problem: If I add a node to the cluster, how does Elastic Search cluster know to add that node wants to join? Or what if a node goes down (or the network to the data center it is in) gets too flaky. Is it using some sort of gossip protocol like Amazon Dynamo does? Consider the consensus problem: if I POST a document to one node to the cluster, how does the change get propagated to the other nodes? Of course, I understand that the document has to be indexed, so I cannot expect a search query to find it immediately. Does ES use a Paxos algorithm? Raft algorithm? N.B. if someone could tag this question as "elasticsearch" I'd appreciate it!


title: Which licenses are free for commercial use?

text: I'm lost in a mass of licences - GPL, LGPL, Creative Commons, BSD, Apache, etc, and looking for a beginners guide. When using a component under a popular licence like these, what are the restrictions for using them without paying in a commercial product? E.g.   * do I have to redistribute the source?   * do I have to credit them?   * what if I modify the component? etc. From what I can tell from http://www.codeproject.com/info/Licenses.aspx, only GPL and Creative Commons force you to redistribute source?


title: Is an 8 second (incremental) build time common?

text: My current project takes 8 seconds to build one C++ file. Is this common? Other files take 12-15 seconds but most at the moment are about 8 seconds. I use Visual Studio to tell me the time. I have gone into the headers and removed things I didn't need and used forward declaration. It did save me about 2 seconds per file and one header takes about 4 seconds to go through alone. In that header I need all its declarations and using a lite version which removes private methods public functions I don't need. Should I be happy it's 8 or so seconds or is that too long to compile one file?


title: Planning software development

text: I'm fairly new to programming (still a student), and I haven't had much experience with planning out my software development. Usually if it's a large project, the profs break it up into steps for me. If it's smaller, I usually just dive right in. This has worked so far, but I'd like a better process. I'm planning to do a rather ambitious project, and I'm worried that my code will turn out a mess and/or take a lot longer than if I had planned it properly. I'd like a method/technique/advice for planning out my software development.


title: Why was the first compiler written before the first interpreter?

text: The first compiler was written by Grace Hopper in 1952 while the Lisp interpreter was written in 1958 by John McCarthy's student Steve Russell. Writing a compiler seems like a much harder problem than an interpreter. If that is so, why was the first compiler written six-years before the first interpreter?