Programming language with native concurrency support for large graphs?

I'm currently looking for a new programming language to learn (currently working through some C++, know some C and Python), specifically one that has built-in concurrency support? I want to try to build a large graph library that can do processing across clusters or multiple cores.. I know C++'s Boost library has support for concurrency, but I also want to learn a new language and I'm guessing a language that was designed with concurrency in mind would also be more pleasant to do concurrent programming in. Overall I see this as a chance to learn a new language, learn about concurrent programming, and tackle a big project. From looking around, Clojure and Scala seem to be the two popular candidates when looking for concurrent programming support.. though I'm not sure how these two compare in terms of   1. Speed (specifically for concurrent large graph processing)   2. Community (thinking about pushing this project onto somewhere like GitHub)   3. Ease of programming concurrently Or are there other languages I should consider aside from Clojure or Scala? I have never programmed in a functional language before, but I'm open to learning it.. I've seen one of my friends program in Haskell and Clojure and it looks daunting but I've heard good things about functional programming, esp. for data processing. Thanks!


Could someone break this nasty habit of mine please?

I recently graduated in cs and was mostly unsatisfied since I realized that I received only a basic theoretical approach in a wide range of subjects (which is what college is supposed to do but still...) . Anyway I took the habit of spending a lot of time looking for implementations of concepts and upon finding those I will used them as guides to writing my own implementation of those concepts just for fun. But now I feel like the only way I can fully understand a new concept is by trying to implement from scratch no matter how unoptimized the result may be. Anyway this behavior lead me to choose by default the hard way, that is time consuming instead of using a nicely written library until I hit my head again a huge wall and then try to find a library that works for my purpose.... Does anyone else do that and why? It seems so weird why would anyone (including me) do that ? Is it a bad practice ? and if so how can i stop doing that ?


Is copyrights notice of a BSD licensed library considered as endorsement?

As I am reviewing a BSD license for an open source library to use it in my commercial product, I found this paragraph: > Redistribution and use in source and binary forms are permitted provided > that the above copyright notice and this paragraph are duplicated in all > such forms and that any documentation, advertising materials, and other > materials related to such distribution and use acknowledge that the software > was developed by the organization. Its clear that I have to mention the copyright notice, but as for the next paragraph: > The name of the organization may not be used to endorse or promote products > derived from this software without specific prior written permission. If I just put the copyright notice of the used library, is that considered as I am promoting my product by mentioning the library copyrights notice? Shall I seek a written permission? or I just need to add the copyright notice only?


Should back end processes be included in use cases in requirements document?

We're writing a requirements document for our client and need to include the use cases of the system. We're following this template:               ID     Description     Actors     Precondition     Basic Steps     Alternate Steps     Exceptions     Business validations/Rules     Postconditions      In the Basic Steps section, should we include steps that the system performs in the back end or should we only include steps that the user directly interacts with? Example: Basic Steps for Search 1:               User goes to search page     User enters term     User presses search     System matches search term with database entries     System displays results      vs Basic Steps for Search 2:               User goes to search page     User enters term     User presses search     System displays results


Functional Programming vs. OOP

I've heard a lot of talk about using functional languages such as Haskell as of late. What are some of the big differences, pros and cons of functional programming vs. object-oriented programming?


How to write manageable code with functional programming?

I just started with functional programming (with JavaScript and Node.js) and from the look of things it looks as if the code I am writing would grow to be one hell of a code base to manage, when compared to programming languages that have a sort of object oriented paradigm. With OOP I am familiar with practices that would ensure your code is easily managed and extensible. But am nore sure of similar convention with functional programming.


When You Have Both Options, When Functional and When OOP?

Like (I suspect) a lot of JS devs, I tend to start with intuition first and then come to sound principles/practice with experience informing study of the comp. sci stuff I never really had any form training in that I like to look into in my spare time. Note: I tagged JS by way of identifying where I'm coming but I'm open to answers from any language where you might have the same dilemma. So, as I've come to understand more purely functional-oriented languages I've started to realize that I've occasionally been following that approach by accident. Essentially I'll have some data that doesn't change and a function or set of functions using those "constants" (yeah, yeah...) in conjunction with variable params to hand off a return value that won't necessarily be different on method firings. I tend to reach for whatever tool strikes me as likely to simplify the problem or reduce work the most but is there maybe something a little less ambiguous in terms of what are more formally considered the advantages of one vs. the other to come up with some heuristics to consider? So far the split is typically more with OOP at higher-level architectural concerns with occasional functional typically coming into play within or between objects.


Are Nested Static Library dependencies possible?

I am working in QT .   1. Can a static library depend on another static library?(Static Lib is made by linking another static lib)   2. If yes, is it possible that after linking to lib2, the generated lib(lib1) would not contain all the codes of lib2? In my Qt Project I am using a static library, which depends on multiple libraries. I had to add all the libraries (with all their headers in my project), although I need only one lib (and one .h of that class) in my code. Please explain the scenario.


Are there any benefits in not having referential integrity keys in database?

So Referential integrity is good, but are there scenarios where not having constraints is better? For example when all the logic of relationships is kept in code? or when the database upgrade is simplified? PS: I am not asking it is good not to have referential integrity, just that what scenarios would justify it


Why does a contenteditable div not behave like an input element?

The motivation for the content editable div would be to allow user input inside a normal div element. Why does it then behave so differently to input element? Mainly I am referring to the addition of a `div` or a `br` on line break. Additionally it does not have a placeholder item. So my question is what is the point of content-editable div? Why would I want to use it at all?


Entirely separate business logic layer from MVC

We are currently refactoring our controller methods in ASP.NET MVC application. At the beginning we've separated data access layer (our goal was to remove LINQ from controllers entirely). Now we are thinking about another step - how to create a business logic layer to reduce number of lines and logic in controller. Currently we have something like this:               public ActionResult CustomerProjects(some parameters)     {         var collectionOfSomeType = this.CustomerRepository.GetSomeData();         var anothercollection = this.ProjectsRepository.GetAnotherData(collectionOfSomeType);              var viewModel = CreateSomeViewModel(anotherCollection);              return View("Index", viewModel);     }      Of course it's just an example with four lines of code. We have some methods which are bigger (but still IMO not so bad). We injected our helper classes through IoC container, more complex logic sits there. But now we'd like to remove even that parts. Is it worth our time to create another layer which would be our 'last gate' before controllers? The final result would be:               public ActionResult CustomerProjects(some parameters)     {         var viewModel = someSource.PrepareCustomerProjectsViewModel(params);              return View("Index", viewModel);     }      What do you think?


How do you pronounce eval()?

I'm not a native speaker so please excuse me if you think the question is silly, but how should I pronounce eval()?


How does dependecy injection increase coupling?

On the Wikipedia page on dependency injection, the disadvantages section tells us this: > Dependency injection increases coupling by requiring the user of a subsystem > to provide for the needs of that subsystem. with a link to an article against dependency injection. Dependency injection makes a class use the interface instead of the concrete implementation. That should result in decreased coupling, no? What am I missing? How is dependency injection increasing coupling between classes?


Copyright registration against future patents

**Short question:** Could registering a work containing probable patentable ideas at one or more copyright registraion services (such as CRS) be used to effectively prove _prior art_ in case someone tries to patent the idea? **Details:** The particular work is software and some related stuff which show some novelties, maybe patentable, maybe not in the US. I live in Europe, and even if I lived in the US, I wouldn't want to care (and leave tons of $$$ in patent offices) about patents: the thing is to be released under GPL when the time comes. I want to protect it in such a way that it could stay free, which, as I see, involves protecting it against probable patent ventures (trying to capture those novelties the project has). Reading about the subject I see that copyright registration services (such as CRS) exist which for an affordable price would archive the state of the work reliably with their registration date. So in case someone tries to "attack" the GPL'ed work in the aforementioned way, how useful could these proofs be in proving _prior art_? (Could you think of any other effective methods for someone who has no reliable connections to release a true _printed publication_ , neither much funds, and neither lives in the US?) My goals are _solely protecting the published GPL'ed work from legal takedown_. That is as I understand patenting it might be possible that someone patents an already existing technology (in this case my published GPL'ed work), and then sues the original author (inventor) for patent infringement. I only seek for protection against this type of abuse building up some robust enough proof of _prior art_ so the work may remain free.


How to handle mutiple API calls using javascript/jquery

I need to build a service that will call multiple API's at the same time and then output the results on the page (Think of how a price comparison site works for example). The idea being that as each API call completes the results are sent to the browser immediately and the page would get progressively bigger until all process are complete. Because these API calls may take several seconds each to return I would like to do this via javascript/jquery in order to create a better user experience. I have never done anything like this before using javascript/jquery so I was wondering if there was any frameworks/advice that anyone would be willing to share.


Lua & Javascript documentation generation

I am in the beginning phase of create a mobile MMO with my team. The server software will be written in JavaScript using NodeJS, and the client software in Lua using Corona. We need a tool to auto-generate documentation for both the server-side and client-side code. Are there any tools which can generate documentation for both Lua and Javascript? And as a bonus: we are hosting our project on Bitbucket and the Bitbucket Wiki uses the Creole markup language. So if it's possible I want the tool to export to Creole. Edit: I know about tools for generating documentation for one of both languages. However, I don't want 2 different styles for documentation in one project. Therefore one tool which can generate documentation for both languages would be great.


What to choose API based server or Socket based server for data driven application

I am working on a project which has a Desktop Application for MAC/COCOA, a native application for iPhone another native application in iPad. All the application do almost same thing. The applications are data driven applications. Every communication to server is made via a restful API developed in PHP. When a user logs in a lot of data is fetched from server. And to remain in sync with server polling is done. As there are lot of data to poll it makes application slower and un-reliable. A possible solution that comes into my mind is to use Socket based server. My question is that will it reasonably improve the performance? And which technology (of sockets) will be good as a server side solution for data driven application? I have heard a lot about Node.js. Please give your suggestions.


I seem to be missing a few important concepts with PhoneGap

I'm planning on developing an app on multiple platforms and I'm thinking that PhoneGap might be perfect for me. I had been reading that it's one codebase for all platforms but looking at the PhoneGap guide it seems there are separate instructions for each platform. So if i want to develop for iOS, Android, BB and WP7 I need to write 4 different sets of code? I'm sure i'm missing something fundamental here. Aside from that, how do people usually approach a PhoneGap build? You obviously / probably want the finished app to look like a native app - is it more common than not to use jQuery Mobile together with PhoneGap? Is there a preferred IDE? I see, in the guide, for iOS they seem to suggest Xcode. I'm fine using Xcode but it seems a bit overkill for HTML & CSS. Do I need to develop in Xcode and if not how do i approach it? Use a different IDE / Text Editor and then copy paste into Xcode for building and testing? I know this question is long-winded and fundamental but it something which i don't think is properly addressed in the guides. Thanks.


How to organize back-end database design and front-end application in software repository?

I have an application that has a back-end database (tables, procedures, database specific dlls) and front-end (application logic and UI) that separate people are working on. I was wondering what's the best way to organize it in my repository (I'm using GIT). The options I see are:   * all-in-one repository   * submodules of main repository   * two separate repositories   * other? Any suggestions are welcome.


Preventing crawler from interfering with user tracking

I'm scraping text from various webshops (no images/videos or other data). I'm no expert on user tracking, so I'd like to know if there's a way for me to write my crawler so it won't interfere with the webshop owners tracking. Perhaps this is already the case since the crawler isn't storing any cookies, requesting images or anything else but the actual pages, but I'd like to be sure. What would I do when requesting the pages to ensure that nothing is tracked in Google Analytics for instance? Should I send an e-mail to the owners telling them to filter a specific user-agent or...? I've seen How to be a good citizen when crawling web sites? where the last answer states that one should add "crawler" or "spider" in the user-agent. I'm not sure what to make of that as I can't find anything to back it up. (The crawler is written in node.js and uses the request-module to download websites) EDIT: For anyone interested, here's the infinitely simple crawler I've made. It doesn't obey robots.txt because I'm specifying what kind of links I want to follow myself (and I'm too lazy right now to write something that obeys robots.txt):               var request = require("request")     , cheerio = require("cheerio")     ;          exports.crawl = function(options) {         var links = [].concat(options.url) // Takes either an array of url's or just a string.         , ongoingRequests = 0         , index = 0         , done = false         ;         process.nextTick(ticker);         function ticker() {             if(ongoingRequests < options.maxRequests && index < links.length && !done) {                 var url = links[index++];                 ongoingRequests++;                 if(options.debug) console.log("Downloading " + url);                 request({ url: url, encoding: options.encoding || "utf-8" }, function(err, response) {                     ongoingRequests--;                     if(err) {                         return;                     }                     if(!done) {                         var $ = cheerio.load(response.body)                         , shouldContinue = options.data($, response, url)                         ;                         if(shouldContinue === false) {                             console.log("Crawler interrupted.");                             options.done();                             done = true;                         }                         var  newLinks = options.extractLinks($).filter(function(url, i) { return links.indexOf(url, i + 1) === -1; });                         if(options.debug && newLinks.length) console.log(newLinks);                         links = links.concat(newLinks);                         if((index - 1) % 5 === 0) console.log("Current index: " + (index - 1) + ", links found so far: " + links.length);                     }                 });             } else if(!ongoingRequests) {                 if(!done) {                     options.done();                     done = true;                 }                 return;             }             process.nextTick(ticker);         }     };      Use it like this:               var crawler = require("../crawler");          crawler.crawl({         url: "http://website.com"         , debug: true         , maxRequests: 5         , data: function($, response, url) {             if(url.indexOf("/product/") === -1) {                 return;             }             console.log("extract stuff from $ using CSS-selectors and a nice jQuery-like API");         }         , done: function() {             console.log("DONE!!");         }         , extractLinks: function($) {             return $("a").map(function() {                 return $(this).attr("href");             }).filter(function(url, i, a) {                 if(!url || url[0] !== "/") {                     return false;                 }                 return i === a.indexOf(url) // Remove duplicates                 && url.indexOf("/cart") === -1                         && url.indexOf(".htm") > -1                 ;             }).map(function(url) {                 return "http://website.com" + url;             });         }     });


Is DDD not appropriate for my website or should I introduce a Query Layer?

I have inherited an ASP.NET website application and the previous developer has used what I believe are some DDD concepts. I am new to DDD and I have to admit I am struggling with the practical side of it having come from an N-Tier Transaction Script background. One of the problems with the site is that it is slow. There is no paging on huge grids and also the business logic layer pulls down way more data than is needed for 90% of operations 70% of which are reads to bind data to grids. The general design is that the business logic layer has a Service class per aggregate root, with various "GetByX()", 'FindBestMatching()" and "Update()" type methods on it. These Service classes are the points from which trees of domain objects are created such as "Organisation" and "User." Back in my comfortable transaction script days, my service layer was similar: there would be some logic possibly, a call into a repository (or since EF 6 direct use of EF as it can be mocked for testing) and then the call would return. The objects that were returned would be DTO type objects containing return data relevant, including possibly some POCO entity objects. These DTOs would travel to clients via webservices, be bound to ASP.NET or Silverlight grids...all was good. My operations on my service layer could be very specific, allowing for queries like:               "GetUsersWithSurnameIncludeChildren(string surname, int skip, int take)"      allowing for nice narrow DB queries that supported paging and eager loading of related data. It was fast and loaded only the data that was actually needed. Now with this site I have inherited there is an actual OO model of the business domain. These classes are POCOs, not generated from EF, but EF is used database first as a repository (there is a lot of mapping between the domain objects and the EF objects). An example domain object is below (without any logic).               public class Organisation     {         public int OrganisationID { get; set; }         public string Name { get; set; }              public IList<Organisation> AssociatedOrganisations { get; set; }         public IList<User> Staff { get; set; }         public IList<User> Managers { get; set; }              // Business logic method implemented below here     }      Many of the classes are essentially copies of the underlying entity framework objects, others have a significant amount of logic encapsulated within them. The way the site works currently is that every time the OrganisationService service class creates a new Organisation domain object (and it may create a collection in one hit) it also populates ALL of the fields and collections in that object...and all of the fields and collections in those objects! A huge deep tree is created in memory and a stack of joins and unions (generated by EF) is needed to get all of the data. This is totally inappropriate for a website that mainly displays loads of flat grids. My questions are: 1) Is an application that is 70% pulling data out of a DB for display and 30% business logic actually a bad candidate for DDD? 2) If DDD is appropriate how are scenarios like this generally designed? Should I implement a separate "Query Service" that is designed just to pull out loads of flat data for binding to pages and grids (these could just be the EF POCOS themselves) and reserve the Domain objects just for parts of the application where logic must actually be performed? 3) Should I only load data into my Domain Object reference types and collections when it is actually accessed (like EF lazy loading...)? Previous posts I have read have suggested lazy loading in a Domain Object is a code smell: DDD Lazy Loading Code Smell I am about to buy a DDD book tonight :)


What Algorithm can be use for task allocation based on location?

What algorithm can be use for task scheduling based on location? For example there are 100 students and 5 lecturers available. Each lecturer must get same amount of student using location allocation which is allocation of students depends on the nearest place to lecturer. The system must assign automatically students to lecturer depends on shortest distance between student and lecturer.               Student A      Lecturer A      Student B      lecturer B     Student c      Lecturer C      EXAMPLE : Lecturer A can get student c because when compare 3 students address student C is near to lecturer A. I have done some research on algorithms such as ant colony, bee colony, location allocation but what I can learn from that is it doesn't meet my requirement. So looking for some new algo. What type of algorithm can be use to solve this problem?


What is the purpose of the "non-endorsement clause" in the New BSD license?

_**Note:** This question is not about the "obnoxious BSD advertising clause". The New BSD license does not contain that clause, and is compatible with the GPL._ I'm trying to pick between the New BSD license and the MIT license for my own projects. They are essentially identical, except the BSD license contains the following clause: >   * Neither the name of the <organization> nor the names of its contributors > may be used to endorse or promote products derived from this software > without specific prior written permission. > Why would anyone want to use this clause? What's wrong with gaining some notoriety if someone makes a well-known piece of software using your code? Also, wouldn't dictating what users can and cannot do with your given name fall outside the domain of intellectual property?


RefactorException: Good idea or bad idea?

When I'm doing large scale refactors I'm often commenting out the contents of methods and using NotImplementedExceptions for stuff that I still need to refactor. Problem is that this is interfering with 'valid' NotImplementedExceptions. I'm thinking about introducing a custom RefactorException, that I quite easily find back by reference to see what I still need to do. Good idea or bad idea? What are other common ways to do large scale refactors in stages? (of course the idea is that all these exceptions are removed before the I commit the whole refactoring)


Is it legaly allowed to state this in a software EULA?

Just read through the whole EULA from the game ("Minecraft") owned by ("Mojang AB"). And in there it was one sentence that got my attention:               We have the final say on what constitutes a tool / mod / plugin and what is not.      My questions are:   1. Is is legaly allowed to write this in a EULA?   2. Will this really hold up in court?      **EDIT:** As people apperently want more detail: I was initially thinking just generally but as more detail is required lets's take Sweden(Where's mojang is from) and USA(Just becase)..


What should a GetSelectedIndex method return when no rows are selected

I'm creating a UI table component that returns an array of selected indices. Some typical return values would be               var myRetVal1 = [0];//one value selected      var myRetVal2 = [0,1,2,3,8,11];//multiple value selected      as you can see I'm always returning an array. I had an idea to return `-1` when nothing is selected, but then I thought that might be confusing when in every other condition an array is returned. So checking for an empty set of values would be either               //returns -1     var selectedItems = tbl.GetSelectedIndex();     if(selectedItems !== -1){        //we have data to process     }      OR               //returns []     var selectedItems = tbl.GetSelectedIndex();     if(selectedItems.length > 0){        //we have data to process     }      OR               //returns null     var selectedItems = tbl.GetSelectedIndex();     if(selectedItems){        //we have data to process     }      Maybe I'm making too big a deal over this, but is there a standard expectation for this type of control? As I build other controls should they conform to a standard empty return value or should they always return a "empty" version of their expected return type?


Query regarding VBA as career option

I am a dot net developer, with over 7 years experience in VB, Vb.net, C# and Asp.net. Would it be worthwhile to learn VBA/VSTO? Would it be adding value to my career? Would there be any companies hiring a person who knows both VBA and Dot net? I heard that VBA would be used mostly used in finance industry and it won't pay much. Is it true?


best way to do the compile and check cycle

I am trying to learn lua and am experimenting on my linux machine. I am not a programmer, so I am looking for your help to give me some suggestions. What I want to accomplish is making my compile-rewrite-recompile cycle as efficient as possible. Here is what I do. I am using vim in one window to program. I have a shell open in another window. When I want to check my progress, I save the code in vim, switch to my shell, then execute the code. However, this is still kind of tedious, I was there was a faster, more elegant way. Any ideas? How do you go about this problem?


How can we protect the namespace of an object in Javascript?

Continuing from my previous question: Javascript simple code to understand prototype-based OOP basics Let's say we run into console this two separate objects(even if they are called child and parent there is no inheritance between them):               var parent = {         name: "parent",         print: function(){            console.log("Hello, "+this.name);         }     };          var child = {         name: "child",         print: function(){            console.log("Hi, "+this.name);         }     };          parent.print()     // This will print: Hello, parent     child.print()     // This will print: Hi, child          temp =parent;     parent = child;     child = temp;               parent.print()     // This will now print: Hi, child     child.print()      // This will now print: Hello, parent      Now suppose that parent is a library, as a HTML5 application in a browser this cannot do much harm because is practically running sandboxed, but now with the advent of the ChromeOS, FirefoxOS and other [Browser] OS they will also be linked to a native API, that would be a head out of the „sandbox”. Now if someone changes the namespace it would be harder for a code reviewer (either automated or not ) to spot an incorrect use if the namespaces changes. My question would be: Are there many ways in which the above situation can be done and what can be done to protect this namespaces? (Either in the javascript itself or by some static code analysis tool)


Generic code or code easy to understand?

at work now I had an argument with co-worker, because I made a page that he feels is **too generic**. The page has **3 modes** (simple, adv and special) - it has to work like this, because we don't choose how the specification is written. in each mode **the page looks different** (the changes are not big - **it shows/hides 5 text fields** in different combinations based on the mode). My co-worker think it should be **3 pages** and when you change something you should just **merge** the changes to other two modes. The fields now has code like `rendered="#{mode!=2}"`, etc. P.S. Now the difference is 5 fields, but **in the future no1 know how much it will be changed**. **EDIT:** We use Seam(JSF/Facelets), here is pseudo facelet code(to make it easier to understand). I did not put it in panelGroups to better present the problem.               <h:output rendered="mode=2" value="Name: " />     <h:input rendered="mode=2" value="bean.name" />     <h:output rendered="mode=2" value="Surename: " />     <h:input rendered="mode=2" value="bean.surname"  />          <h:output rendered="mode!=2" value="Surename: " />     <h:input rendered="mode!=2" value="bean.surname"  />     <h:output rendered="mode!=2" value="#{mode==1?'My Name':'My friends name'}" />     <h:input rendered="mode!=2" value="bean.name" />      **EDIT:** I duplicated version it would look like this(pseudo code)               <c:if test=mode=1>             <ui:include view=modeSimple.xhtml>     </c:if>     <c:if test=mode=2>             <ui:include view=modeAdv.xhtml>     </c:if>     <c:if test=mode=3>             <ui:include view=modeSpec.xhtml>     </c:if>               modeSimple.xhtml         <h:output value="Surename: " />         <h:input value="bean.surname"  />         <h:output value="My Name" />         <h:input value="bean.name" />     modeAdv.xhtml         <h:output value="Name: " />         <h:input value="bean.name" />         <h:output value="Surename: " />         <h:input value="bean.surname"  />     modeSpec.xhtml         <h:output value="Surename: " />         <h:input value="bean.surname"  />         <h:output value="My friends name" />         <h:input value="bean.name" />


Can my company give IP rights away for an application I wrote off hours to another startup?

I am an intern for a health company (unpaid), let's call it _Company A_ and I noticed that they are using a lot of paper form for things that can be done on the computer. Excel files for things that shouldn't be in Excel. So I wanted to improve on my programming and figured that it was the best opportunity to do. I developed a couple of apps for their use. All these applications were outside company time. One application I did and they love and one of the director has a brother who has a health start up company. He wants me to give over my source code so his brother's company can further develop it and maybe sell it (I am out of the equation). I have no intention of handing over my code as I put a lot of time outside doing it but I also don't want to burn bridges with anyone in the company. I can't go to the director and tell him "I don't think so". I am fine with demoing to the brother how it works but the line is giving up my code. If they want to build something like it then they can go right ahead I have no problem with it. What is the correct way of approaching this and do they have the right to do this to me? Edit: there is no contract I never signed anything


How is the DOM language independent?

Quoting from Wikipedia > The Document Object Model (DOM) is a cross-platform and language-independent > convention for representing and interacting with objects in HTML, XHTML and > XML documents. and from wc3 > In order to provide a precise, language-independent specification of the DOM > interfaces, we have chosen to define the specifications in OMG IDL Now I have been programming in Java, C# and PHP and in all these languages the keyword `interface` is provided, but how do you implement a language- independent interface? How come you can write an interface without a programming language? Moreover how can you interact with the DOM using any programming language? If someone invented a new programming language, what are the steps he needs to do to be able to interact with the DOM?


Cloud availability of short-term "virgin" Windows instances?

I have a situation where we on a regular basis need a freshly installed "virgin" Windows installation to do various work in isolation on, and building one from scratch every time in a vmware instance is getting tedious. Perhaps there are cloud offerings providing a service allowing to request one or more Windows instances and after a very short while they were available for logging in through Remote Desktop? After usage they were just recycled without having to pay for a full Windows license every time. Do this exist for a reasonable price? What is your personal experiences with this?


Why should I use MSBuild instead of Visual Studio Solution files?

We're using TeamCity for continuous integration and it's building our releases via the solution file (.sln). I've used Makefiles in the past for various systems but never msbuild (which I've heard is sorta like Makefiles + XML mashup). I've seen many posts on how to use msbuild directly instead of the solution files but I don't see a very clear answer on _why_ to do it. So, why should we bother migrating from solution files to an MSBuild 'makefile'? We do have a a couple of releases that differ by a #define (featurized builds) but for the most part everything works. The bigger concern is that now we'd have to maintain _two_ systems when adding projects/source code. _**UPDATE:_** Can folks shed light on the lifecycle and interplay of the following three components?   1. The Visual Studio .sln file   2. The many project level .csproj files (which I understand an "sub" msbuild scripts)   3. The custom msbuild script Is it safe to say that the .sln and .csproj are consumed/maintained as usual from within the Visual Studio IDE GUI while the custom msbuild script is hand- written and usually consumes the already existing individual .csproj "as-is"? That's one way I can see reduce overlap/duplicate in maintenance... Would appreciate some light on this from other folks' operational experience


A good way to learn a language and fully understand its features and classes is to try all methods in the API

I have an idea that to learn a language (i.e. Java)I need to try all methods from language's API; i want to try to use methods from its API. is this a good idea? there are 10 000 methods in Java API. is this a good way to learn all language capabilities?


Basic use of Business Rules

I have a query on whether the following requirements would need to be designed via Business Rules - this is for a JEE based application where currently this is coded as part of the Business logic. > System will create a tax account for every city, county and district > combination that imposes tax for only certain cities, counties or districts > depending on the taxpayer's business. > > When the user establishes an account which exists in all subdivisions (i.e. > at city or county level), the application must use his tax code and > automatically populate all the locations without requiring the user to data > enter every location. I assume this would mean a data lookup table from a master table (of tax accounts) and fetch and display all locations. Is there some way in which a Rules Engine can be used to manage these combinations?


Can I use my company name instead of using ofbiz logo and name

Sorry this is not a programming questions. My company is looking to do some work on ofbiz. I read the license of apache and I am not sure if its legal to change the logo to our company logo. http://www.apache.org/foundation/license-faq.html#WhatDoesItMEAN


How do I store an object in a way that I can use it even in a second execution of the program?

I am making program in Java in which I am making `Dialog box`, `button`, `checkbox`, etc. SWT widgets. Now my problem is, I want like if in one execution `button` is made and in second execution `checkbox` is made then they both should display in one box. So I need to store that box object. How can I do that?


How should I create a mutable, varied jtree with arbitrary/generic category nodes?

_Please note: I don't want coding help here, I'm on`Programmers` for a reason. I want to improve my program planning/writing skills not (just) my understanding of Java_. I'm trying to figure out how to make a tree which has an arbitrary category system, based on the skills listed for this LARP game here. My previous attempt had a bool for whether a skill was also a category. Trying to code around that was messy. Drawing out my tree I noticed that only my 'leaves' were skills and I'd labeled the others as categories. ### What I'm after is a way to make a tree which attempts to separate Model and View, and allow adding an arbitary type of child node (with a separate way of being edited/rendered) to an arbitrary parent. ![A tree listing various skill from the above link](http://i.stack.imgur.com/vmcFs.png) _N.B Everything here is bought as a skill, even where it seems like a property. The End-Users will see this as buying skills (which they do on paper atm) so should be presented as such, all on the same page._ **Explanation of tree:** The Tree is 'born' with a set of hard coded highest level categories ( _Weapons, Physical and Mental, Medical_ and more etc.). From this the user needs to be able to add a skill. Ultimately they want to add the 'One-handed Sword Specialisation' _skill_ ( **not** item) for instance. To do so you'd ideally click 'add' with `Weapons` selected and then select `One-handed` from a combobox node that appears on that child, then click add again and enter a name in a text field on _that_ child node that appears. Then click add again to add/specify a 'level' or 'tier' for that leaf; first proficiency, then specialisation (for example). Of course if you want to buy a different skill it's a completely different route to the leaf. You might not need a combo box at the same level down the tree as you did with the weapon example, and need some other logic behind it too. This is what I'm having trouble getting my head around let alone programming in; how to make a set of classes and **not** specify what order to attach them together in, but still have them all fit. What is a good system for describing this sort of tree in code? All the other JTree examples I've seen have some _predictable_ pattern, and mine _doesn't_. I don't want to have to code this all in 'literals', with long lists of what _type_ (combo-box, text field etc) of children node should be allowed on what parent. Should I be using abstract classes? Interfaces? How can I make this sort of cluster of objects extensible when I add in other skills not listed above that behave differently? If there is _not_ a good system to use, is there a good process for working out how to do this sort of thing? ### The gears in my head are turning: I always need to:   * Check the parent   * Provide options based on the parent I'm begining to think becasue of this commonality I need some sort of abstract/interface `skill` class that defines/outlines common methods for skill and category. I can (hopefully) put rules and options in a database and read to-from there. The question is I think now, between an abstract or interface method and how to bes implement that.


How to check if 4 points form a square?

Assume I have 4 points (they are 2-dimension), which are different from each other, and I want to know whether they form a square. How to do it? (let the process be as simple as possible.)


Advantages and disadvantages of structuring all code via classes and compiling to classes (like Java)

_Edit: my language allows for multiple inheritance, unlike Java._ I've started designing and developing my own programming language for educational, recreational, and potentially useful purposes. At first, I've decided to base it off Java. This implied that all the code would be written in form of classes, and that code compiles into classes, which are loaded by the VM. However, I've excluded features such as interfaces and abstract classes, because I found no need for them. They seemed to be enforcing a paradigm, and I'd like my language not to do that. I wanted to keep the classes as the compilation unit though, because it seemed convenient to implement, familiar, and I just liked the idea. Then I noticed that I'm basically left with a module system, where classes could be used either as "namespaces", providing constants and functions using the `static` directive, or as templates for objects that need to be instantiated ("actual" purpose of classes in other languages). Now I'm left wondering: **what are the upsides and the downsides of having classes as compilation units?** Also, any general commentary on my design would be much appreciated. An informative post on my language can be found here: http://www.yannbane.com/2012/12/kava.html.


Would using AJAX extensively improve server performance?

Clearly AJAX improves the user interface but does this also decrease server load? You would think it does because the entire page will not have to be served up each time, but maybe there are other variables I'm not considering.


Is OOP hard because it is not natural?

One can often hear that OOP naturally corresponds to the way people think about the world. But I would strongly disagree with this statement: We (or at least I) conceptualize the world in terms of _relationships_ between things we encounter, but the focus of OOP is designing individual classes and their hierarchies. Note that, in everyday life, relationships and actions exist mostly between objects that would have been instances of unrelated classes in OOP. Examples of such relationships are: "my screen is on top of the table"; "I (a human being) am sitting on a chair"; "a car is on the road"; "I am typing on the keyboard"; "the coffee machine boils water", "the text is shown in the terminal window." We think in terms of bivalent (sometimes trivalent, as, for example in, "I gave you flowers") verbs where the verb is the action (relation) that operates on two objects to produce some result/action. The _focus_ is on action, and the two (or three) [grammatical] objects have equal importance. Contrast that with OOP where you first have to find one object (noun) and tell it to perform some action on another object. The way of thinking is shifted from actions/verbs operating on nouns to nouns operating on nouns -- it is as if everything is being said in passive or reflexive voice, e.g., "the text is being shown by the terminal window". Or maybe "the text draws itself on the terminal window". Not only is the focus shifted to nouns, but one of the nouns (let's call it grammatical subject) is given higher "importance" than the other (grammatical object). Thus one must decide whether one will say terminalWindow.show(someText) or someText.show(terminalWindow). But why burden people with such trivial decisions with no operational consequences when one really means show(terminalWindow, someText)? [Consequences are _operationally_ insignificant -- in both cases the text is shown on the terminal window -- but can be very serious in the design of class hierarchies and a "wrong" choice can lead to convoluted and hard to maintain code.] I would therefore argue that the mainstream way of doing OOP (class-based, single-dispatch) is hard because it IS UNNATURAL and does not correspond to how humans think about the world. Generic methods from CLOS are closer to my way of thinking, but, alas, this is not widespread approach. Given these problems, how/why did it happen that the currently mainstream way of doing OOP became so popular? And what, if anything, can be done to dethrone it?


Does teaching programming make you a better programmer

I consider myself an intermediate Python programmer and have been offered an opportunity to be a trainer for a beginner Python programming class. I was wondering if this would really widen my programming repertoire. Has somebody had an enlightening experience after they successfully trained a group of people? Does it also depend on those people -- whether they're programmers or noob students? (In my case they are intermediate .NET and Java programmers) What should I expect from them? One of my fears is -- what if I choked when one of them asked a tangled question. Is this normal?


Should I break contract early?

About 7 months ago I made the switch from a 5 year permie role (as a support developer in C#) to a contract role. I did this because I was stagnating in my old role. The extra cash contracting is really helping too. Unfortunately my team leader has taken a dislike to me from day 1. He regularly tells me I went out contracting too early, and frequently remarks that people in their 20's have no idea what they are talking about (I am 29). I was recently given the task of configuring our reports via our in house reporting library. It works off of a database driven criteria base, with controls being loaded as needed. The configs can get fairly complex, with controls having various levels of dependency on each other. I had a short time frame to get 50 reports working, and I was told to just get the basic configuration done, after which they will be handed over to the reporting team for fine tuning, then the test team. Our updated system was deployed 2 weeks ago, and it turned out that about 15 reports had issues causing incorrect data to be returned. Upon investigation I discovered that the reporting team hadn't even looked at them, and the test team hadn't bothered to test the reports. In spite of this, my team leader has told me that it is 100% my fault. As a result, our help desk got hit hard. I worked back until 2am that night to fix the highest priority issues (on my wedding anniversary!). The next day I arrive at work at 7:45 am to continue with the fixes. I got no thanks, but keep getting repeatedly told by my manager that "I fucked up" and "this is all my fault". I told my team leader I would spend part of my weekend working to fix the remaining issues. His response was "so you fucking should! you fucked it all up!" in front of the rest of the team. I responded "No worries." and left. I spent a decent chunk of my weekend working on it. Within 2 business days of finding out about the issues, I had all the medium and high priority issues fixed. The only comments my team leader has made to me in the last 2 weeks is to tell me how I have caused a big mess, and to tell me it was all my fault. I get this multiple times a day. If I make any jokes to anyone else in the team, I get told not to be a smartass... even though the rest of the team jokes throughout the day. Apart from that, all I get is angry looks any time I am anywhere near the guy. I don't give any response other than "alright" or silence when he starts giving me a hard time. Today we found out that the pilot release for the next stage has been pushed back. My team leader has said this was caused by me (but the higher ups said no such thing). He also said I have "no understanding of the ramifications of my actions". My question is, should I break contract (I am contracted until June 30) and find another role? No one else in my team will speak up in my favour, as they are contractors too and have no interest in rocking the boat. I could complain to my team leaders boss, but I can't see that helping, as I will still be stuck in the same team. As this is my first contract, I imagine getting the next one will be hard without a reference. I can't figure out if this guy is trying to get me fired up to provoke a confrontation (the guy loves conflict), or if he is just venting anger, or what. Copping this blame day after day is really wearing me down and making me depressed... especially since I have a wife and kid to support).


Simulating double-click, how long should I wait between clicks?

I'm simulating a double click programmatically and I want to have a slight pause between both clicks in order to better simulate a real user. I know the interval should be less than `GetDoubleClickTime` but am not sure what would be a good time to choose. Does anyone know of any data on how fast a typical person performs a double-click? I was thinking in the direction `GetDoubleClickTime()/3` but of course the magic number seems a bit iffy.


How can I make sure my evening project code is mine?

I'm a physicist with a CS degree and just started my PhD at a tech company (wanted to do applied research). It deals with large scale finite element simulations. After reviewing their current approach, I think that a radically different method has to be applied (they are using a commercial tool which is very limited). I'd rather base my research on an open source finite element solver and write a program which makes use of it. I'd like to develop this idea in the evenings, because that's the time that best suits me for programming (during the day I prefer reading and maths) and use it at a late stage of my PhD. I'd like to have the option to release my program as open source on my website as a reference, for future personal or even commercial (e.g. consulting) use. How can I make sure that my company doesn't claim the code ownership? I thought that a version control system could help (check out only in the evening). This would document that I programmed not during regular office hours (documented elsewhere). But these data can be easily manufactured. Any other ideas? I want to stress that I'm not interested in selling software and neither is my company. * * * Very interesting responses so far. This clearly helps me. Some remarks:   * I'm not restrained by my work contract. National law says that the company owns anything I produce during working hours and no special agreement has been made (my employer is not selling software and may be a bit naive on this side). They mostly use software and non of my colleagues is a serious programmer.   * Secondly, I need to rethink the point raised by @Mark about trade secrets. This is quite serious in the particular industry.   * Thirdly, I care a lot about no to upset my supervisor/ boss. But, and this is the motivation for this question, I'd like to keep the _innovative_ part of my work a bit separated so I can reuse it or at least demonstrate it as a reference work.


Have you used a Framework/Lib whose LGPL License? if yes, what are the impressions of your customers?

I am trying to make my first app for sale, I would like to ask some questions for those who have already sold their software:   * Have you used a Framework/Lib whose LGPL License?   * if yes, what are the impressions of your customers? for example, if your customers/ competitors from the market reveal technology/secrets that you used in your solution (as LGPL requires that you make a Dynamic Link (.DLL) for your libs and you clearly tell the use of a Lib/Framework). Full story: For my project, I used a framework LGPL/commercial (Dual License) the second one it was too expensive (about 3000 USD) which pushed me to use LGPL however I still concerned. That is why I ask for advise and especially motivations.


easy way to search github, googlecode, codeplex,etc at the same time?

Is there an easy way to search open repository such as github, googlecode, codeplex, etc at the same time? I wonder whether google is good at this.


How to solve an event-queue problem in a computer emulator in Java

I'm writing a _low-level_ emulator (in Java) of the IBM 1620, a late-50s computer. By "low level," I mean that the lowest _observable_ unit of work is the 20-microsecond "trigger" -- machine instructions achieve their objectives by running a series of these triggers; and I've written code to emulate almost all of them. By "observable" I mean that the 1620's console contained a "Single Cycle Execution" key which allowed you to manually advance one trigger at a time - and most of the CPU's inner state (registers, PC, conditions) were displayed on a large console of lights. I am guaranteeing correctness of the state at the single-cycle level. Normally the emulator is either waiting for the operator to press START, or it's in its main run loop, executing trigger after trigger. It also needs to be able to respond to external events like a thrown toggle switch, or the afore-mentioned Single Cycle Execution key, which are conveyed to the CPU Thread from the GUI thread by an event queue. The run loop peeks at this queue before firing off the next trigger, and so far this has worked fine. Now, however, I'm implementing the card-reader I/O instructions, and I have a problem. All 1620 I/O was synchronous (the 1620 did not have interrupt capability), so when it executed the ReadCard instruction, it would literally wait in mid-trigger until the card reader delivered a card. This normally took a tenth of a second, _unless the operator had not mounted the card deck_! It's that latter contingency that creates the problem: the 1620 must wait in mid- trigger (i.e. the main run loop is not running), while remaining responsive to external events (thrown switches, the Reset key, or, of course, a card from the card reader). I can't seem to think of a clean, elegant way to design this. Polling for, and handling, "unrequested" events at the top of the run loop has worked well so far, but now I need a callable mechanism that does the same thing but is able to return control to its caller when the right event occurs. Here's what it looks like right now:               state:         MANUAL means unable to immediately process next trigger         AUTO means we can go ahead and process next trigger          do forever {         processQueuedEvents()  // event-processing never blocks         if (state == MANUAL) {            waitForEvents()     // this blocks until queue not empty         } else {               // state == AUTO            trigger = doTrigger(trigger) // run trigger and get next one         }     }      CPU trigger E30 sends a message to CardReader requesting a card buffer, and must wait to receive the event containing the buffer. In the meantime, the CPU must continue to receive and process events as usual. I could imagine this to be an operating-system design problem, but that's not my strong suit. Can anyone provide some guidance?


Test driven vs Business requirements constant changing

One of the new requirement of our dev team set by the CTO/CIO is to become test driven development, however I don't think the rest of the business is going to help because they have no sense of development life cycles, and requirements get changed all the time within a single sprint. Which gets me frustrated about wasting time writing 10 test cases and will become useless tomorrow. We have suggested setting up processes to dodge those requirement changes and educate the business about development life cycles. What if the business fails to get the idea? What would you do?


Fixing bugs generated by another team

I'm facing the following situation: There are 2 different teams working on the same project using Scrum, and every now and then, bugs related to user stories developed by team "A" are being assigned to team "B". We're used to fixing bugs made by other people when they belong to the same team, but things get a bit more complicated when different teams are involved. Some of the developers don't like working this way and say that the bugs must be fixed by the ones who made them, and this is causing some conflicts between the teams. While reading some of the similar questions I've found some interesting ones (Is fixing bugs made by other people a good approach? and also Parallel teams and scrum/agile), but they are not about the same situation, or at least I don't see them that way. During our discussions here we got 2 possible approaches: Leave the situation as is, or determine that the bugs must be assigned to the team that developed the feature. Do you guys have any suggestions?


Why was Objective-C popularity so sudden on TIOBE index?

I'd like to ask a question that is pretty similar to the one being asked here, but for Objective-C. According to TIOBE rankings, the rise of popularity of Objective-C is unprecedented. This is obviously tied to the popularity of Apple products, but I feel like this might be a hasty conclusion to make since it doesn't really explain the stagnant growth of Java (1. There are way more Android O/S devices distributed worldwide, 2. Java is used in virtually every platform one can imagine) Now I haven't programmed in Objective-C at all, but I'd like to ask if there are any unique features or advantages about the language itself compared to other prevalent languages such as C++, Java, C#, Python etc. What are some other factors that contributed into the rise of Objective-C in this short span of time? > ![http://i.stack.imgur.com/3q0tW.png](http://i.stack.imgur.com/3q0tW.png)


How do programmers in the West see programmers in the East?

The other half of this question: How do Programmers in the East see programmers in the West? * * * The eastern part of the world (India/China/Philippines ) mainly provide outsourcing services to the western world (USA and Europe). Do you have the experience of working with offshore teams? If yes, how was it? Do you hold any generalized ideas or opinions about the programmers from the East (e.g. Are they cooperative, do they deliver on time or do they do quality work?). What are these based on?


Tree View Children condition indicator on topmost un-expanded parent

I am using a tree view in c# and i am creating custom icons for the nodes. Let say this is my hierarchy with a node that satisfies a certain condition:               Root1     |_Ax      |_Bx1      |_Bx2       |_Cx1       |_Cx2(condition true)      |_Bx3      |_Bx4     |_Ay      |_By1      |_By2       |_Cy1      when the tree it's collapsed I don't know if some inner child satisfies that particular condition so I want to display an icon on the topmost un-expanded parent. For example let say that the tree it's completely collapsed I would like this behaviour : 1) the first root will be like this :               Root1(!)      2) I expand Root1 and i see there is something the children of Ax :               Root1     |_Ax(!)     |_Ay      3) I expand Ax :               Root1     |_Ax      |_Bx1      |_Bx2(!)      |_Bx3      |_Bx4     |_Ay      4) Last I expand Bx2 to find the target node Cx2:               Root1     |_Ax      |_Bx1      |_Bx2       |_Cx1       |_Cx2(condition true)      |_Bx3      |_Bx4     |_Ay      The symbol **(!)** appears only on the topmost un-expanded parent and disappears once the node is expanded indicating a path to locate the target node Cx2. But I would like some idea on how to add the node indicator (!) in an efficient fashion. I need to do this in 2 steps \- tree creation \- node expanded In the first case as soon as I create the node Cx2 and I notice it satisfies that particular condition I need to put the indicator on the topmost unexpanded parent node. In the second case I need to change the indicator location dynamically when the node it`s expanded. What is the most efficient way to do that ?


What would be the Impact of P=NP?

I am preparing for a test and I can't find a clear answer on the question: What would be the impact of proving that PTIME=NPTIME. I checked wikipedia and it just mentioned that it would have "profound impact on maths,AI,algorithms.." etc. Anyone can give me an answer?


Is it considered bad practice to run different JavaScript for IE

Is it considered bad practice (and how bad) to run different JavaScript for IE? Currently im writing some JavaScript and the simplist way to work arround IE quirks seems to be to check for browser version and run different code               var browserName = navigator.appName;          if (browserName == "Microsoft Internet Explorer") {       //Do some stuff     }     else     {     //Do other stuff     }      It's quick and works well but does lead to duplication of code and feels "hacky".


Business Objects - Containers or functional?

This is a question I asked a while back on SO, but it may get discussed better here... Where I work, we've gone back and forth on this subject a number of times and are looking for a sanity check. Here's the question: Should Business Objects be data containers (more like DTOs) or should they also contain logic that can perform some functionality on that object. Example - Take a customer object, it probably contains some common properties (Name, Id, etc), should that customer object also include functions (Save, Calc, etc.)? One line of reasoning says separate the object from the functionality (single responsibility principal) and put the functionality in a Business Logic layer or object. The other line of reasoning says, no, if I have a customer object I just want to call Customer.Save and be done with it. Why do I need to know about another class to save a customer if I'm consuming the object? Our last two projects have had the objects separated from the functionality, but the debate has been raised again on a new project. Which makes more sense and why??


How to introduce a willing manager to IT and web development?

After experiencing quite a lot of problems with our small project's manager (we're a startup, and he's the only guy who has the appropriate education; the rest of us are programmers), we have finally identified the cause of our troubles: his understanding of the inner works of our project is limited, as is his understanding of a normal software development workflow. He has expressed the desire to quickly learn and to fill these gaps; however, I don't really know what books, articles or blogs to recommend to him. In short, can you recommend a good reading for a manager-type person who is not going to be a developer himself, but needs to understand web application development process well enough to understand our explanations when he requests them? P.S. No, kicking him and finding another manager is not an option at this moment.


How could I hire a programmer to add a small feature to an OSS project?

I'd like a feature added to Eclipse, as a small plug-in, but:   * It's a bit niche, so not high demand. So if I post it as a feature request it's unlikely to be followed-up.   * Still, I'm sure someone else would find it handy.   * I'm a programmer, but I don't know Java, and I don't think it's currently worth my time learning Java just to code this. What might be a good way to find a programmer who could code such an Eclipse plug-in, and pay them to do the job? My example is specifically about Java and Eclipse, but what might be an answer to this question in general terms?


How abstract should you get with BDD

I was writing some tests in Gherkin (using Cucumber/Specflow). I was wondering how abstract should I get with my tests. In order to not make this open-ended, which of the following statements is better for BDD:               Given I am logged in with email admin@mycompany.com and password 12345     When I do something     Then something happens      as opposed to               Given I am logged in as the Administrator     When I do something     Then something happens      The reason I am confused is because 1 is more based on the behaviour (filing in email and password) and 2 is easier to process and write the tests.


Approaching Java/JVM internals

I've programmed in Java for about 8 years and I know the language quite well as a developer, but my goal is to deepen my knowledge of the internals. I've taken undergraduate courses in PL design, but they were very broad academic overviews (in Scheme, IIRC). Can someone suggest a route to start delving into the details? Specifically, are there particular topics (say, garbage collection) that might be more approachable or be a good starting point? Is there a decent high-level book on the internals of the JVM and the design of the Java programming language? My current approach is going to be to start with the JVM spec and research as needed.


Find all possible subarrays of an Array

I am lost I just can't seem to get my head around backtracking/recursion approaches. I understand how simple recursion problems like factorials work I can even trace those by hand. But when it comes to backtracking problems I am so lost. I keep trying. its been 5 hours I have been reading various approaches on forums and stack exchange but nothing has clicked. For instance say I have a array with `[1,2,3,4]` and my destination value is `5`. I am trying to find all possible combinations that equal to my destination value. I broke this problem down further to make it even more simple for my self to understand. First I can find all possible combinations of the array and then pass them to another function which checks if the sum of that array equals destination value and then only does it print it. Can someone advice how to approach this? I am not looking for code/answer I want to be able to think and imagine this in my head clearly.


Consolidating hotels data from various booking sites with different IDs or reference

In one of my projects, I have data for hotels, and other booking sites are able to book this hotel. For example: Hotel A - Booking (ID = 4002), Expedia (ID = 123), Priceline (ID = 147) The three booking engines each uses their own Id to reference to Hotel A. I would need to check manually and make the right reference to the hotel. If I have 100,000 hotels, I have to check manually 300,000 (considering 3 booking sites) times? They might provide API, then I can cross check the name, address or latitude/longitude, but if they differ a little bit then I might give the wrong reference to the wrong hotel. I'm sure there are better ways to do this. There are many travel sites out there which do hotel price checking on many booking sites, but how do they do to make sure they are checking the right hotel on these booking sites? Anyone has any experience on this?


Mockup strategy for Responsive Web Design (from a programmer point of view)

When making mockups for _Responsive Web Design_ projects, should I separate them by **Page** or by **Screen Size**? Which one would be more helpful when I start writing the source code? What are the pros and cons of the following:   * Page based: All the home page mockups in all different screen sizes   * Screen-size based: All the pages for width <= 960px I'm using Balsamiq Mockups to make mockups and I prefer to store all related mockups in a file like `homepage, login` or `960px, 768px`.


What is the difference between Repository Pattern and Facades Pattern?

I've always used the repository pattern in my applications. But I have seen that many people use facades instead of the repository for naming convention, but the operation is the same, I Think. Why is there this difference? There are a real difference between them or not?


Understanding Microsoft SQL certifications

I am royally confused about the certifications Microsoft has out for SQL server. From what I can gather from reading their site as well as others is there are various levels of tests (like in university) they have level 100 series tests, 200, 300... up to about 400 for the new master of SQL Server level. I wanted to knock a few out since I am doing daily SQL work now I figure I can get on the job practice and learning where I fall short. Where do I start? What test and test details do I need to know to take and pass each exam? what order should I take them in?


Where is Smalltalk-80 best used?

I want to know in which applications/programming domain are most suitable for Smalltalk. Could anyone please provide me some useful links that could answer my query? Through googling I learned that some companies use it for: logistics and foreign trade application desktop, server and script development data processing and logistics, scripts and presentations but I cant find documents/research papers that can tell me which programming domain Smalltalk-80 (or Smalltalk) is best suited. Some of the programming domains are: - Artificial intelligence reasoning - General purpose applications - Financial time series analysis - Natural language processing - Relational database querying - Application scripting - Internet - Symbolic mathematics - Numerical mathematics - Statistical applications - Text processing - Matrix algorithms I hope you guys can help me. I am doing this for my case study. Thanks in advance.


Is there an official programming format?

A person can make their code readable and neat in their own way. However, is there a standard programming format that professional programmers are compliant to?


How much business logic should be allowed to exist in the controller layer?

Sometimes we have some business logic represented in the controller code of our applications. This is usually logic that differentiates what methods to call from the model and/or what arguments to pass them. Another example of this is a set of utility functions that exist in the controller that may work to format or sanitize data returned from the model, according to a set of business rules. This works, but I am wondering if its flirting with disaster. If there is business logic shared between controller and model the two layers are no longer separable, and someone inheriting the code may be confused by this unevenness in location of business logic related code. **My question is how much business logic should be allowed in the controller and in what circumstances, if any?**


What's an assessment day and what kind of individual & group based programming activities are involved?

The only things that I know:   * An assessment day is much more than a simple interview. Actually 1 or more interviews are just a part of it.   * Both individual and group based programming activities are involved. Any ideas about what kind of programming activities to expect (preferably by people who have already participated in an assessment day)?


What about all those coding rules?

I always supported the idea of having coding rules for developers in a company or a specific project. Especially if the company is size greater than 10. The bigger the company the bigger the need. I know a lot of people will disagree, but I have seen projects that don't have them and the code looks like total disaster. The real problem that comes from this is how to make those hard headed ones that don't like to use brackets in if statements, or use the same connections string everywhere in the code, or whatever, to use the coding rules without making them oppose the idea?


Adobe Air apps on the Mac App Store?

Before you chastise me for asking this, I have an Adobe Air app that has a lot of investment in it, and if there is a way to utilize the existing code-base in _any_ way, it is worth considering. I have heard news reports in passing about Adobe creating some kind of tool to allow flash or air apps to be ported to native objective-c code, but the information found in google is mostly commentary on the one-time Apple blockade. My question(s) is/are this:   1. Is it even possible, at any level, to use an existing Air app to create a Mac Store app?   2. If possible, what are the resources I can use to accomplish this?


How to motivate co-workers to write unit-tests?

We're working on a large product which has been in production for about 5 years. The codebase is.. erm.. working. Not really well but it is working. New features are thrown into production and tested with a small QA. Bugs are fixed, etc. But no one, except me, is writing unit-tests. No one uses the power of "tracking" down bugs by writing unit tests to ensure this special bug (test case) would never, ever occur again. I've talked to management. I've talked to developers. I've talked to everyone in the whole company. Everybody says: "Yep, we must write more unit-tests!" That was about a year ago. Since then I have forced introduction of pre-commit code review (Gerrit) and continuous integration (Jenkins). I held some meetings about unit-tests and I also showed the benefits of writing unit-tests. But no one seems to be interested. **Q1: How do I motivate my fellow co-workers to write unit-tests?** **Q2: How do I stay motivated to follow my personal code quality standards?** (Sometimes it' s really frustrating!) PS: Some frustrating facts (reached in 1 year):   * Total unit-tests: 1693   * Total "example unit-tests": around 50   * Done by me: 1521 **Edit:** Am I expecting too much? Its my first working place and I'm trying to do my best. **Edit 2:** Based upon all answers I've made a small checklist for myself. I've talked to two developer in private and we had a good and honest talk. One of them told me, like Telastyn said, that he is really uncomfortable with unit-tests. He said that he would like to be "more professional" but he needs a kickstart. He also said that our unit-test meeting with all developers (around 9-11) was good, but it was too crowdy. Meh. Some critics for me, but I'll learn from that. (see answers below concering tdd kata meetings!) The other one said that he is not interested in writing unit-tests. He thinks that his work is good enough for his salary. He don't want to put more effort in. I was quite speechless. Typical 9-5 "worker". Next week I'm going to talk to the other developers. Thanks for your great answers (so far!) and your support. I really appreciate it! I'ved learned a lot, thank you very much!


Conflicting versions of jQuery in Separate Extensions

I have built a few browser extensions that live in GMail. Since they are larger extensions, they incorporate jQuery 1.6.x. I am using jQuery as a content script which means it is injected into GMail then my scripts reference jQuery as they are loaded afterwards. I have found that when other extensions are installed alongside of my extensions and they incorporate earlier versions of jQuery the earlier versions are loaded first and my 1.6.x is ignored. The functionality I have that depends on 1.6.x no longer works, and that's a dealbreaker. I'm trying to come up with an elegant solution for this. My first instinct is to namespace my version of jQuery, but loading jQuery twice seams clunky. Possibly testing for jQuery and then doing a diff, but that seems tedious. Any thoughts?


Ensuring successful merges in Subversion

Subversion Re-education actually convinced me, but for now I'll stick to svn - mastering the use of a very popular tool can't be bad. To date I've not used branching/merges in production code, now I decided to give it a try in a small team environment. I'm afraid of suffering the same pain as the described in Spolsky's article. **Is there a "right" way of working with branches in svn?**


Why is Perl so heavily used in Bioinformatics?

What is it about Perl that makes it so useful in Bioinformatics ? Why isn't C++ or Matlab or Python the big language?


Monitoring App: Client side or Server Side?

I have a monitoring web application which has a .Net Backend and a Silverlight frontend. The application crunchs big chunks of data, process them and presentates to user. Then user can interact with the data to see different graphs of log. He/She can unselect dimensions, group some values, choose metrics like transaction count, transaction amount(dollars) etc. Currently, I combine log data into 3 minute chunks. Then making a lookup from it and sending to clientside. With this raw form of data it's size is optimized for network. On clientside I have a lot of business logic to process this data for presentation. Also when user changes options clientside processes the data according to user's choices. We have chosen this path to serve this application only from one server. We don't have to scale with the user amount in the company because the whole thing happens on the clientside. This is good but we are sacrificing performance. I'm really curious about what is going to happen if I choose to do the all computation for user's choices on raw data at the serverside. -Is it going to be faster? -Do I need to scale immediately? -Is Fetching the data only once on the server then caching it something like redis than doing the computations according to user requests better solution? -If clientside approach is good, do I need to switch to Javascript and Javascript client side MVC frameworks like AngularJS? And I really don't know how to write the my whole business logic in Javascript at the moment. **Extra Info** Average desktop has 2gb ram and a dual core cpu which is core to duo. Our servers are in VM cluster. They have scalable ram min 8gb. And 8 core xeon cpus. 100-150 concurrent users can use it. Every user can do different manipulations on the data. That's why they all have their own data on the clientside. Thanks


How would you approach developing a Hotel Reservation System?

Till now, I have had the experience of developing either a desktop application or a Website. But, with this Hotel reservation system, I am interfacing a problem that needs both. The application needs to be fulfil the following requirements :   * Manager can do the bookings/checkout of the incoming customers at the reception counter System.   * Customers should be able to book themselves online.  As you can see, the second requirements clearly means that a web app is required, whereas the first can be accomplished via desktop development. This type of requirement is pretty common. Like, in case of cinema seat bookings, We are free to book ourself online or we can go the ticket window and buy one. The question is how are these simultaneous and different requirements fulfilled for a single project. There has to be a sync or else the customer might book himself in an already booked room. From my understanding, there are two ways to develop this solution.   1. You develop a Web application with a back-end(admin panel) and host it on a server. The customers can book themselves on the front-end, while the manager(at reception desk) can use the administrator panel to carry out his bookings and checkouts. Since both front-end and back-end are using a single database, there is no requirement for sync.   2. Develop a desktop application for use at the Hotel and a website for the customers to book online. The two applications are maintaining a single datbase, therefore synchronization comes into play. Some definite development for the sync is mandatory or else the system will fail.  Which of the above solutions should I choose ?. This is also a common scenario for banks. They handle transactions at the local branch as well as over the Internet. How do they achieve this thing. Much like i mentioned above or something different.


Will the customer benefit from a DVCS in any way?

Some of us can say a Distributed Version Control System (e.g. Mercurial, git) will have a positive impact on developers only out of the experience of using one (under the right conditions: higher productivity, higher code-base stability, etc.), but, in what situations could a customer ( **i.e. the observer of the outcome of the software development lifecycle** ) tell there is a difference from using a CVCS and a DVCS?. Anyone with empiric evidence of a customer "feeling" a difference upon DVCS adoption gets a big double-chocolate cookie with whipped cream and a cherry on top. Note: "tell the difference" doesn't mean "know there was a DVCS involved" nor even remotely "know what a DVCS is"


Is there a special name for a condition which will break a loop if it increments a set number of times

Is there a name for including a limitation in a loop structure to prevent it from running if its primary condition becomes unwieldy. For example               for (var i = 0; i < len; i++){             some_function();          }      but if len is somewhere set to ten million, I don't want to run it, so I would do something like:               for (var i = 0; i < len && i < 50; i++){             some_function();          }      Is there a name for this type of hard-coded condition?


Why is extending the DOM/built-in object prototypes a bad idea?

I'm looking for a definitive answer to why extending built-in prototypes is so heavily chastised in the JS developer community. I've been using the Prototype JS framework for a while, and to me doing `[1,2,3].each(doStuff)` seems much more elegant than `$.each([1,2,3], doStuff)`. I know that it creates "namespace pollution," but I stil don't understand why it's considered to be a bad thing. Also is there any real performance degradation associated with extending built-in prototypes? Thanks!


How to spread awareness for generic programming among team members?

I am staying in an environment, where people believe:   1. Java generics are the feature exclusively used for library writing and not for the real coding.   2. C++ is an OO programming language; `template` is an optional and avoidable feature Though, these people rely highly on the libraries written using generic programming (e.g. STL, Java containers). If I write a code using `template`s or `generics`, the code reviewer is most likely to reject it and will comment to write it in a **_"proper / understandable / elegant"_** way. Such mentality is applicable from normal programmer to senior most manager. There is no way out, because 90% of the time, these people have their lobbying. What is the best way ( _not being cut throat_ ) of explaining them, the practical approach of writing code which constitutes OO and generic programming both at the same time ?


How do you know if you should use Self-Tracking Entities or DTOs/POCOs?

What are some questions I can ask myself about our design to identify if we should use DTOs or Self-Tracking Entities in our application? Here's some things I know of to take into consideration:   * We have a standard n-tier application with a WPF/MVVM client, WCF server, and MS SQL Database.   * Users can define their own interface, so the data needed from the WCF service changes based on what interface the user has defined for themselves   * Models are used on both the client-side and server-side for validation. We would not be binding directly to the DTO or STE   * Some Models contain properties that get lazy-loaded from the WCF service if needed   * There are permission checks on the server-side which affect how the data is returned. For example, some data is either partially or fully masked based on the user's role   * Our resources are limited (time, manpower, etc) So, how can I determine what is right for us? I have never used EF before so I really don't know if STEs are right for us or not. I've seen people suggest starting with STEs and only implement DTOs if they it becomes a problem, however we currently have DTOs in place and are trying to decide if using STEs would make life easier. We're early enough in the process that switching would not be a huge deal, but I don't want to switch to STEs only to find out it doesn't work for us.


How to convert a copy/paste/spaghetti programmer to see the light?

This question was inspired by this one. While that other question was deemed localized, I believe the underlying problem is something that is extremely common in our industry. I know there are some developers, who will read this and think I'm making this stuff up and then they might reply how everyone cares about their work and wants to learn, but just looking at other Programmers SE posts (case in point), I know that's not universally true. So let's say you have someone on your team (or maybe majority) who's standard operating procedure is to copy/paste and who believes that everything can be solved if only you add enough function calls and variables. This person never heard of TDD, DRY or SOLID and outside of 40 hours at work when they are busy working, they never once read a single methodology/pratices/design book. In the past I (and others) have asked, how to do you teach OOD. But now I'm thinking that's not the right question. The real question is how do you approach such a person/team and make them curious about better way of doing things? How do you inspire them to learn? Without that, it seems that all the teaching, meetings, lectures, discussions are useless if they are perfectly happy going back to their desk and doing what they've always done. I work with a bunch of people like that. They are actually quite bright individuals, but I hate when I hear, "I'm done coding, just need to refactor and split into multiple classes to make DXM happy". They don't refactor for cleaner, readable, maintainable code, but only because otherwise they'll get scolded. I know they are capable of learning, just seems that there's a general lack of motivation. When I deliver work, it generally has way fewer bugs and the work I owned never became 5000-line monstrosity of a class. Other's would make comments like, "your code is much cleaner and readable than our stuff", so they see the difference. But at the same time, I feel like they believe they get paid for 40 hours regardless of what they do, so they actually don't mind if they spend 3 full days in QA looking for a bug that shouldn't have been introduced in the first place. Or that they take a week to modify one class because there are so many dependencies they end up touching. The though, "maybe that class should have been written differently" never seems to pop up. Can anything be done in these situations? Has anyone succeeded? Or is it best to isolate such mindset to non-critical parts of the project and minimize the damage? **NOTE:** When I say "lack of motivation". I don't think it's lack of motivation to work or do a good job because they simply stopped caring. Most of our team is actually quite the opposite. They definitely care about the product. We have guys that will work nights and weekends. The part I'm trying to get through is with improved habits and skills, they actually wouldn't have to work as much. I guess that "40 hours" thing made this post sound a little too negative.


Merging functionality from two controllers; should I place all actions in one controller?

Say I have 2 controllers, `OrderController` and `StatusController`. `OrderController` has several CRUD actions for Orders and `StatusController` has several actions pertinent to changing the satus of Orders (from created to sent, cancelled, etc). `StatusController` really only has one view where several actions can be performed, but for the sake of usability I've decided to merge the functionality of this one view with the Index action of `OrdersController`. (This is just an adapted example for the question, so bear with me if it sounds silly). Only by copy/pasting the Html in the views from here to there everything works, of course, but... What should I do with the actions on `StatusController`? Should I move them to `OrderController` or Should I let `StatusController` exist even though it has no views? I think it might be better than having `OrderController` have 15 actions, but is this desirable? Is there a recommended good practice/approach in such case?


Task scheduling for software development

I'm managing a team of 10 software developers and I'm looking for a tool which can be used to schedule/assign tasks. I envisage a fairly simple web-based tool which each developer signs into. Here they can see a list of tasks assigned to them. For each task it would be clear how long has been assigned (either the number of hours or number of days) and when it should be delivered. Drilling into a task would reveal any associated notes/specification, and each task would be associated with a client and a project. Each developer would 'sign off' a task when complete. An administrative interface would exist for managing users, clients, projects and tasks. Is there a free tool available which provides this basic functionality? Obviously we could write our own in a relatively short amount of time, but I'd be interesting in knowing if there are any (ideally open source) tools already out there that people have experience using.


Git workflow for multiple teams

We are going to start using Git (not using it yet), and I want to define the workflow. We have 4 teams at 4 different global locations, developing together the same product. Each team owns a part of product's code, but sometimes they also have to make changes in the code owned by other teams. Is there a recommendation for a Git workflow for such environment? I have already seen this article, but the approach here is "we create additional branches as seldom as possible", and I believe more in "branch for each user story" approach. Also, this article presents a nice approach. I had in mind having a master branch, a permanent branch per each team periodically merging to master, and a per-user-story branches merging to the teams' branches. Does it make sense, or it wouldn't work?


An efficient + extendable way to store/reference a normalized set of "causations"?

I'm looking for a good way to define and store references to a normalized set of "causations". I have a well-defined set of reasons (short, descriptive strings) why certain objects are created and persisted, and I need an efficient way to store references to them. I also need the flexibility to add new reasons in the future. Oh, and I need to implement it in a way that will please the developers as well as the database guys :) Some context: I'm working with a Rails app and a relational database. There are `events` and `payments` (as well as many other models). When a `payment` is created, it should include a reference to a causation. Similarly, when an `event` is canceled it should reference a cause for the cancellation. In the case of a canceled event, the current implementation stores the index of the cause, pulled from an array of possible causes defined in the `Event` model. The implicit (and probably unwise) assumption is that the array won't change in a way that would break the reference. Also, there's some overlap with similar "cause-arrays" in other models. In an attempt to normalize how we store "causation" data, I built a `Causation` model and accompanying table. The `causations` table entries form a unique list of causes that can be referenced by id from any other model. The drawback is that whenever we want to define a new `causation`, we have to add it to the database before we can reference it. This is a bit cumbersome, especially when deploying to testing environments, but maybe that's just the price paid for enforced normalization? A coworker suggested moving the definitions into the `Causation` model itself, rather than storing them in the database, and I wonder if that's a good middle-ground between the overly-brittle/disorganized original code and my own cumbersome/restrictive solution. Maybe something like:               module Causation       module Refund         UNHAPPY_CUSTOMER = 175         UNUSED_SUPPLIES  = 192       end            module Fee         SHIPPING   = 214         EXTRA_FOOD = 294       end            MAPPINGS = {         Refund::UNHAPPY_CUSTOMER => "Customer was dissatisfied",         Refund::UNUSED_SUPPLIES  => "Extra/unused supplies returned",         Fee::SHIPPING            => "Shipping cost",         Fee::EXTRA_FOOD          => "Ordered extra food"       }     end          payment.causation_int = Causation::Refund::UNUSED_SUPPLIES     payment.save     ...     Causation::MAPPINGS[payment.causation_int]     => "Extra/unused supplies returned"      You can see by the absurd numbers that I haven't figured out an elegant way to ensure uniqueness and prevent collisions. Also, you'll notice I need to be able to group causations into categories. Is the namespaced-module approach a better way to go (and is there a way to avoid using "magic numbers" like above), or should I stick with my database implementation? Or maybe there's something better than either of the two?


Knockout custom text binding handler

I created this custom binding handler :               ko.bindingHandlers.line = {         update: function (element, valueAccessor, allBindings) {             // First get the latest data that we're bound to             var value = valueAccessor();                  // Next, whether or not the supplied model property is observable, get its current value             var valueUnwrapped = ko.unwrap(value);                  // Now manipulate the DOM element             if (valueUnwrapped) {                 $(element).after('<br />');   // Make the element invisible             }             return ko.bindingHandlers.text.update(element, function () {                 return valueUnwrapped;             })         }     };      I'm wondering about the part where I do `ko.bindingHandlers.text.update`, is there a better way to solve this ? Question is: Is it the only way to update the DOM with ko.bindingHandler.text.update or is there any more straightfoward way to do it ?


If everyone thinks that PHP sucks, why no one tries fixing it?

I'm a junior web developer in the first steps of my professional career. I'm starting off by maintaining projects written in PHP. Wherever I looked, I see people saying that PHP is a bad language and it's broken in so many ways but it's so widely used now and we can't just make everyone switch to something else. So, why people doesn't seem to try fixing it? Is it because of PHP? The dev core team? People just fed-up and went trying using something else? Please don't get me wrong. I'm not trying to be rude here, I just want to find some answers. :-)


Can I rightfully claim this as my own project if I recieved help online?

Basically I'm new to network programming in Python, so I went on a tutorial online to find out about it. Using what was taught in the tutorial (creating a socket, connecting to ports, etc), I modified the code so that I made a program where two computers can send messages to one another. If I were to apply for a job and show this to my interviewers, would the code for it technically be mine? It is fair to say that I didn't modify the code by that much; However, what if for example I modified it into something like a tic-tac-toe game, where two users play each other from different PCs, would the code then be mine? I just don't want to look like a plagiarizer hence why I ask.


Is there any practical algorithm / data-structure that can't be done with non-recursive Lambda Calculus augmented with foldl?

In my search for a practical non-turing complete programming language, I've been paying attention to lambda-calculus with disallowed self-application - that is, `x x` forbidden. After taking that language and augmenting it with lists and the `foldl` and `range` operations, pretty much any algorithm I've tried so far is implementable. It is trivial to implement `filter`, `reverse`, `head`, `tail`, `map`, `scanl`, `zip` and many others - foldl replaces the need for recursion. Can you think in any practical, important algorithm that would be undoable in that language? > It is no coincidence that all of them use self-application—the application > of an expression to itself. It is through self-application that repetitive > computation can be simulated in the lambda calculus. Indeed, the third of > the previous three examples is famous because it can encode recursive > function deﬁnitions. From http://people.cis.ksu.edu/~schmidt/705s13/Lectures/ch6.pdf .


How should developers handle subpar working conditions?

I have been working in my current job for less than a year and at the beginning didn't have the courage to say anything about the things that bothered me. Now I'm a bit fed up and need things to get better. The first problem is not random but I'll mention it anyway. We are running out of space so every new employee gets a smaller table. We are promised that the space problem will be fixed soon. Almost every employee has a different keyboard, mouse, headphones (if any). Mine are $10 keyboard, some random cheap mouse and some random crappy headphones with a mic. All these were used and dirty when I got them. The number of monitor is 1-3 and with different sizes. I have 2 nice monitors and can't complain but some are given 1 small monitor. When it's their first job they don't have the guts to ask for 2 even if most others have 2. Nobody seems to care too. Project manager asked if it's ok? He obviously said he can handle the 1 small one. Then the manager said you can go ask for 1 more. I'm watching this and think go and ask where? The company is trying to hire more people but is not doing much after the person has signed the contract. We are put in one room that is open to the hallway and it's super noisy. Almost like a zoo at times. Even if nobody is talking the crappy keyboards make too much noise.   * Is this normal?   * Am I too negative and should I just do my job with what I was given?   * Should I demand better things?   * Should the company have some system that everybody gets things in some price range?