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

text: 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.


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

text: 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.


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

text: 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.


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

text: 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?


title: Test driven vs Business requirements constant changing

text: 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?


title: Fixing bugs generated by another team

text: 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?


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

text: 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)


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

text: 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?


title: Tree View Children condition indicator on topmost un-expanded parent

text: 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 ?


title: What would be the Impact of P=NP?

text: 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?


title: Is it considered bad practice to run different JavaScript for IE

text: 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".


title: Business Objects - Containers or functional?

text: 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??


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

text: 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.


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

text: 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?


title: How abstract should you get with BDD

text: 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.


title: Approaching Java/JVM internals

text: 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.


title: Find all possible subarrays of an Array

text: 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.


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

text: 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?


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

text: 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`.


title: What is the difference between Repository Pattern and Facades Pattern?

text: 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?


title: Understanding Microsoft SQL certifications

text: 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?


title: Where is Smalltalk-80 best used?

text: 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.


title: Is there an official programming format?

text: 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?


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

text: 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?**


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

text: 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)?


title: What about all those coding rules?

text: 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?


title: Adobe Air apps on the Mac App Store?

text: 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?


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

text: 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!


title: Conflicting versions of jQuery in Separate Extensions

text: 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?


title: Ensuring successful merges in Subversion

text: 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?**


title: Why is Perl so heavily used in Bioinformatics?

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


title: Monitoring App: Client side or Server Side?

text: 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


title: How would you approach developing a Hotel Reservation System?

text: 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.


title: Will the customer benefit from a DVCS in any way?

text: 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"


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

text: 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?


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

text: 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!


title: How to spread awareness for generic programming among team members?

text: 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 ?


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

text: 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.


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

text: 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.


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

text: 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?


title: Task scheduling for software development

text: 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.


title: Git workflow for multiple teams

text: 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?


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

text: 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?


title: Knockout custom text binding handler

text: 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 ?


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

text: 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. :-)


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

text: 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.


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

text: 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 .


title: How should developers handle subpar working conditions?

text: 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?


title: How does the Java Virtual Machine execute code written in other languages?

text: Since Java 1.6 the JVM can run a myriad of programming languages on top of instead of just Java. I conceptually understand how Java is run on the Java VM, but not how other languages can run on it as well. To me, it all looks like black magic. Do you have any articles to point me to so I can better understand how this all fits together?


title: What licence should I use for internal projects?

text: I need to package an internal project as a debian package. That project will never ever be downloaded by anyone outside of our company, but the debian packaging system insists on there being a `copyright` file. What should I choose for this file? There's a remote possibility that a sysadmin could stumble upon that package and would like to read its licence. What should it then read?


title: How to better start learning programming - with imperative or declarative languages?

text: Someone is interested in learning to program. What language paradigm should I recomend him - imperative or declarative? And what programming language should he start with? I think that declarative because it is closer to math. And I would say that Prolog might be the best start because it is based on logic and programs are short. On the other hand at school we started learning from imperative languages and I am not sure whether there is a benefit to start with them instead of declarive ones. Thanks. :)


title: TDD negative experience

text: What is a negative side of your TDD experience? Do you find baby steps (the simplest fix to make test green) annoying and useless? Do you find no-value tests (when test has sense initially but in final implementation checks the same logic as other test) maintanence critical? etc. The questions above are about things which I am uncomfortable with during my TDD experience. So I am interested whether other developers have similar feelings and what do they think about them. Would be thankful for the links to articles describing negative sides of TDD (Google is fullfilled by positive and often fanatic articles).


title: Does a mature agile team requires any management?

text: After a recent heated debate over Scrum, I realized my problem is that I think of management as a quite unnecessary and redundant activity in a fully agile team. I believe a mature Agile team does not require management or any non- technical decision making process whatsoever. To my (apparently erring) eyes it is more than obvious that the only one suitable and capable of _managing_ a mature development team is their coach (who is the most technically competent colleague with proper communication skills). I can't imagine how a Scrum master can contribute to such a team. I am having great difficulty realizing and understanding the value of such things in Scrum and the _manager_ as someone who is not a veteran developer but is well skilled in planning the production cycles when a coach exists in the team. What does that even mean? How on earth can someone with no edge- skills of development manage a highly technical team? Perhaps management here means something else? I see management as a total waste of time and a by-product of immaturity. In my understanding a mature team is fully self-managing. Apparently I'm mistaken since many great people say the contrary but I can't convince myself.


title: WPF4: Is this indictment of DevExpress WPF controls valid and what is a good alternative vendor?

text: My company is starting a major greenfield development project using DevExpress WPF controls. I just read this critical review of their WPF controls. Do you agree that DevExpress does not understand the WPF paradigm and will cause our developers grief during development and maintenance? Can you suggest an alternate vendor of WPF controls? I'm looking for a vendor with WPF controls that will enhance our application while fitting well with the WPF API, binding and MVVM. You can read a quote from the blog post here.


title: What's the most readable way of echoing from PHP?

text:
Should I use               <?php         if(!$user->is_logged_in()){             echo '
Click here to log in
';         }     ?>      or               <?php         if(!$user->is_logged_in()){     ?>
Click here to login.
     <?php         }     ?>      ? Why? The first one will not have the HTML tags coloured so is less readable in code editors, but with the second one, it seems like it would be bad to take up three lines just to add a curly brace. Which should I be using?


title: Generators in Javascript into the new ECMA standard

text: Generators are being introduced in the new version of the ECMA standards. Could any one suggest the importance and the usage of generators in the present Javascript world? Examples of generators in real world problems will be helpful.


title: How to visualize timer functionality in sequence diagram?

text: I am developing software for communication with external device through serial port. To better understand the new functionality I am trying to display it in sequence diagram. Flow of events is as follows. I send to the device command to reset it. This is asynchronous operation so there is some delay between request and response (typically 100 ms). There can be case when the answer never comes (for example device is not connected to the specified port or is currently turned off). For this purpose I create a timer with period twice the maximum answer time. In my case it is 2 * 125 ms = 250 ms. If the answer comes in predefined time interval, I destroy already running timer. If the answer doesnt come in predefined interval, timer initiates some action. After this action we can destroy it. How to effectively model this situation in sequence diagram? **Addendum 1:** Based on advices made by scarfridge i drew following UML diagram. Comment by Ozair is also helpful for simplifying the diagram even more. ![enter image description here](http://i.stack.imgur.com/F4Vnh.png)


title: How to get better at solving Dynamic programming problems

text: I recently came across this question: "You are given a boolean expression consisting of a string of the symbols 'true', 'false', 'and', 'or', and 'xor'. Count the number of ways to parenthesize the expression such that it will evaluate to true. For example, there are two ways to parenthesize 'true and false xor true' such that it evaluates to true." I knew it is a dynamic programming problem so i tried to come up with a solution on my own which is as follows. Suppose we have a expression as A.B.C.....D where '.' represents any of the operations and, or, xor and the capital letters represent true or false. Lets say the number of ways for this expression of size K to produce a true is N. when a new boolean value E is added to this expression there are 2 ways to parenthesize this new expression 1. ((A.B.C.....D).E) ie. with all possible parenthesizations of A.B.C.....D we add E at the end. 2\. (A.B.C.(D.E)) ie. evaluate D.E first and then find the number of ways this expression of size K can produce true. suppose T[K] is the number of ways the expression with size K produces true then T[k]=val1+val2+val3 where val1,val2,val3 are calculated as follows. 1)when E is grouped with D. i)It does not change the value of D ii)it inverses the value of D in the first case val1=T[K]=N.( As this reduces to the initial A.B.C....D expression ). In the second case re-evaluate dp[K] with value of D reversed and that is val1. 2)when E is grouped with the whole expression. //val2 contains the number of 'true' E will produce with expressions which gave 'true' among all parenthesized instances of A.B.C.......D i) if true.E = true then val2 = N ii) if true.E = false then val2 = 0 //val3 contains the number of 'true' E will produce with expressions which gave 'false' among all parenthesized instances of A.B.C.......D iii) if false.E=true then val3=( 2^(K-2) - N ) = M ie. number of ways the expression with size K produces a false [ 2^(K-2) is the number of ways to parenthesize an expression of size K ]. iv) if false.E=false then val3 = 0 This is the basic idea i had in mind but when i checked for its solution http://people.csail.mit.edu/bdean/6.046/dp/dp_9.swf the approach there was completely different. Can someone tell me what am I doing wrong and how can i get better at solving DP so that I can come up with solutions like the one given above myself. Thanks in advance.


title: Software Transactional Memory - Composability Example

text: One of the major advantages of software transactional memory that always gets mentioned is composability and modularity. Different fragments can be combined to produce larger components. In lock-based programs, this is often not the case. I am looking for a simple example illustrating this with actual code. I'd prefer an example in Clojure, but Haskell is fine too. Bonus points if the example also exhibits some lock-based code which can't be composed easily.


title: Javascript/ui framework to compliment WebAPI/TypeScript/ASP.NET MVC?

text: We're about to venture into building a brand new SAAS application that needs to have a great looking and sophisticated front end. The UI is meant to be single-page, built on top of Web API and using Typescript. Backend is in ASP.NET/MVC. UI will be heavy on charts/graphs/reports/dashboards as well as data/entry of parameters. Dashboards need to be "live", but all other data can be refreshed on screens manually, no need to live-push it. Goals for the framework revolve around the following criteria: 1) Ability to acceptance-test UI data layer without Selenium (ie: json only, don't want to maintain tests at the brittle HTML layer) 2) Ability to work with Typescript 3) Great tooling with respect to Visual Studio 4) Easy to work with, understand, and catch issues/errors. 5) Html5 and responsive design are very important Appreciate any advice or follow up questions


title: Understanding Package Management Systems

text: I am attempting to understand what a Package Management System. I grasp the main concept of it but I have some queries.   * Does a package management system install features(compilers, libraries, virtual machines) necessary to run an application AND install an application or does it just install features necessary to run an application?    * Are package management systems external applications that you run with command line arguments or are they API libraries that you integrate into your installer code? To use an example; if my application uses python 2.7 and wxPython would a Package Management System ensure that python 2.7 is installed and wxPython is installed then finally install my application(python script files)?


title: Why shouldn't a GET request change data on the server?

text: All over the internet, I see the following advice:               A GET should never change data on the server- use a POST request for that      What is the basis for this idea? If I make a php service which inserts data in the database, and pass it parameters in the GET query string, why is that wrong? (I am using prepared statements, to take care of SQL Injection). Is a POST request in some way more secure? Or is there some historic reason for this? If so how valid is this advice today?


title: Diagrams used to model the architecture and functionality of a website

text: I am attempting to understand what UML models/diagrams can be used to communicate a websites architecture. The model or models' purpose is to communicate the architecture and functionality of a website to technical people (other software developers and engineers). Website Features:   \- The website is a recipe search engine   \- Server side code is Python. Client side uses HTML, CSS, JQuery and AJAX.   \- The website will have a Web Crawler/Indexer   \- Infinite Scrolling is utilised when viewing search results so I will need to model asynchronous requests (both GET and POST). The diagrams I am tending towards are Component Diagram (to communicate the architecture) and Sequence Diagram (to communicate the functionality of a HTTP request). What diagrams have you used in the past to communicate the architecture and functionality of a website to technical people?


title: In MVC is it considered good practice to have private, non-action, functions in a controller class?

text: Sometimes action functions in the controller class can become huge and nasty, with many-many lines of code to simply control the flow of data from the Model to the View. At some point these huge functions completely lose track of the basic principles of good code, i.e. only doing one thing, being small, readable and manageable etc. Would it be considered good practice to break these huge action functions into smaller private functions in the controller class or should the need of such optimization mean we should rather add them in the model? I would vote for having the smaller functions as private in the controller so that they are relative to the action, but I have heard arguments that the controller should preferably be simple while the model can get huge and clumpy; and was just wondering which one would be the most preferred method.


title: Should a complex unifying class be doing computation?

text: I have a large application in Java filled with independent classes which are unified in a `PlayerCharacter` class. The class is intended to hold a character's data for a game called the Burning Wheel, and as a result, is unusually complex. The data in the class needs to have computations controlled by the UI, but needs to do so in particular ways for each of the objects in the class. There are 19 objects in the class `PlayerCharacter`. I've thought about condensing it down, but I'm pretty sure this wouldn't work anywhere in the application as it stands so far.               private String name = ""; private String concept = "";     private String race = ""; private int age = -1;            private ArrayList<CharacterLifepath> lifepaths = new ArrayList<>();          private StatSet stats = new StatSet();     private ArrayList<Affiliation> affiliations = new ArrayList<>();     private ArrayList<Contact> contacts = new ArrayList<>();     private ArrayList<Reputation> reputations = new ArrayList<>();     //10 more lines of declarations      I've been considering this problem for some time now, and have considered multiple approaches. The problem arises primarily when data is deleted - for instance, since pretty much everything else (but not some parts!) depends upon Lifepaths, when a lifepath is deleted, nearly everything else must be recalculated. However, if a Skill is deleted, only a few things must be recalculated. Additionally, the application must somewhere track certain values; skill points, trait points, etc. to ensure that the user is not unintentionally exceeding those values. So my question is generally as follows: Where should everything go? What makes this easiest? There are a couple options:   * Place point total calculations in the PlayerCharacter class (but how does this generate a warning?)   * Handle all calculation outside of the PlayerCharacter class, and just use PlayerCharacter as a container for all the character's information   * Place _all_ calculations in the PlayerCharacter class; after each item is changed, recompute the entire character. Then, if there are issues arising from deletion, throw warnings back at the UI. I'm slightly overwhelmed by the scope of this particular class - whereas everything I've done so far has been easily broken down into small manageable chunks, this beast seems to resist being tamed. If there's a better approach to this, I'm all ears! But as of right now, I'm slightly confused, and progressing aimlessly probably won't get me anywhere. Any advice is appreciated. I apologize if this is unclear - I'm certain I lack the software vocabulary to properly communicate my ideas. I would love to improve this question - any help here is appreciated!


title: Will having ClassA extend ClassB slow down my runtime performance compared to having classC which contains all the members of ClassC?

text: I have a class with a lot of methods. I would like to group similar methods together in their own class, but _all_ of the methods need to extend another class, _ClassC_. So I was thinking of having _ClassA_ , which contains the first group of methods, extend _ClassB_ , which extends Class_C, etc. Is this inefficient in terms of runtime performance, or are they virtually the same? Note: there will be hundreds of instances of this class running at once, so I would really not want to waste memory.


title: Where do you have your Control key?

text: In relation to the fab question here: http://programmers.stackexchange.com/questions/2254/what-are-good-keyboards- for-programming Where do you map your Control key and why? ![Control Key](http://i.stack.imgur.com/z0syX.png)


title: How would I access trac on mobile phone?

text: as a programmer I live with Trac, how do you go about accessing trac projects via a mobile phone, nokia/android/iphone/windows mobile, the mobile platform is not important, I can get a new phone but trac is there to stay.


title: The best way of coding web system in term of performance

text: So far I've been using IPB and my custom scripts all coded in PHP but I am really disappointed of the long term performance of it. I would like to move to native coding, the learning time to put into doesn't matter at all. Ive found CppCMS and it seems to be the exact solution i was searching for. I would like to know from anyone who has chosen this way, what have you done? Is CppCMS the best one in term of performance? If yes, with what webserver should I run it with and any special configuration? I am really searching for the best way to go in term of performance (learning time and coding time does not matter).


title: How far should 'var' and null coalescing operator '??' be entertained without hampering readability?

text: I know the title of the question is very subjective, but I was confronted with usage of `??` operator by my peers, where at the same time I was not very happy/comfortable with applying `var` in new up-coming code. The argument given for using `??` operator was, it takes away readability in code. My question is, doesn't the same thing happens when you start using `var`?


title: What wiki/document system do you recommend for knowledge-management?

text: I'm founder of a web-site called Now.in. I wrote all programs by my-self at first. And we are going to run a start-up company. More people will soon get involved. Some know-how/overviews only exist in my mind, it takes time to explain to newcomers. Hence, I would like to write some documents for others to read. Here comes the problem, how to write documents? Which tool/platform should I use? I have some concerns. ## Portability For sure I can just write documents in Google Docs, run a Wiki, or even use wiki of BitBucket repo directly. But the problem is, what if I would like to use another document system rather than the current one? It would be difficult and costly to convert documents among markdown languages/Google Docs. ## Easy to use Diagrams are important in documents to explain things. Some of the simple wiki/doc systems don't support uploading images. You can upload the image somewhere else and insert the image tag in documents, which is kinda inconvenient to use. Also, it appears some of those markdown languages are difficult to learn and remember. I don't like to spend one month to learn something that looks like LaTeX and start to write a document, which will drive me crazy. Simple and expressive markdown/WYSIWYG would be nice. ## Code expression Google Doc is easy to use and powerful enough. But however, sometimes I would like to write code examples in documents. It's good to have syntax highlighting. But Google Doc isn't user friendly for code writing. Being code friendly, would be a nice to have feature, too. ## Integrate with API documents For overview/SOP/Know-how documents, it's fine to write them directly in the document system. But for my Python code base, there might be some generated API-level documents from those codes. It would be inconvenient to have two documents systems, one for API and one for overviews. So, I think it would be nice to have them integrated together. ## So.... What to use? Maybe I have some more concerns in my mind, but I can't recall them at this moment. I would like to know what kind of document system you are using? Could you recommend some? It's fine even if it takes some fee to use the platform/system, we can afford if it is not too expensive.


title: What is a good practice for reading culture (language) info for users of a web app?

text: I am trying to get an idea of what would be a better practice / implementation for the users of an application that I am going to localize. Which would be better and why?   * Read the culture info (preferred language) from the browser. or   * Have a language selection option in the application, commonly implemented using flags (icons) or a drop down. Or suggest a better idea.


title: Tricky compareTo, inheritance, easy to extend - Java

text: Let's say we have 4 classes A, B, C, D where: A is a superclass of both B and C and C is a superclass of D. I suppose, in a diagram, it should look like this:                  A      /   \     B     C            \             D      Moreover, the class A implements the interface               Comparable<A>       and also implements a method               public int compareTo(A another)      I'd like to be able to compare every pair of objects x, y such that they are instances of classes from the set {A, B, C, D}. Naturally, I should implement a compareTo method in each of these classes but by default I'm doing this with one sided effect, i.e. defining how to compare object c from C with b from B doesn't tell anything about how to compare b with c. Now, I could write a lot of code and handle all of those cases (this also means I would have to use 'isInstance' method to handle these, right?) but then every two classes have to be 'aware of' existence of others. So if I wanted to add another class, E, such that D is a superclass of E, I would have to serve all cases in the new class E and moreover I'd have to change something in classes A, B, C, D in order to 'be aware of E'. So I'm struggling to find an elegant solution to it, i.e. one that doesn't entail changing a lot while adding a new class to the hierarchy. How can I achieve this? Thank you in advance for help.


title: An application to get statistical data about HTTP Request/Response

text: I'm looking for an application which takes the address of a website, browses that website, and provides reports based on some user-defined criteria about the HTTP requests/responses. For example, this application should report how many images doesn't have Cach-Control response header, or how many items are more than 25KB in size (including images, scripts, styles, etc.). I know about PageSpeed or WebPageTest, or Firebug or YSlow and plugins like that. But they don't have customized reports, and you should manually go through each response to check something. Also they are not repeatable. I'm looking for an application in which you enter the parameters once, and then many times you can test a website during its development. Does such an application exist? Anyone have any reference?


title: PHP programming in iPad

text: I want to develop some PHP applications on my iPad device but there is 2 problems! First , i can not find any local server applications on iPad like Wamp or Lamp, and second my Googling only returns Cloud based IDEs for this!!! any idea?


title: What is the meaning of "inversion" in Dependency Inversion design principle?

text: I'm reading about design patterns. I know what this principle does. High-level and low-level classes depend on abstractions. But why we say this is _inversion_?


title: Computer Science and other advance topics taught in javascript

text: I'm an 'okay' Javascript developer working on browser javascript and node.js. However because I'm self taught, starting from copying and pasting jquery, there are a lot of holes in my programming/CS education. I don't really have the time to devote myself to fully learning all the CS concepts that might be taught in a real college program, and learning C or Scala or whatnot, I'm just too addicted to hacking and making things that work. On some level studying CS seems to be 'premature scaling' in Hacker News parlance. But every so often I get struck by the thought that maybe there is something that I should really really learn to take my skills and productivity to the next level. Is there a book, a list of concepts or things that I can study and learn in my 'down time' that would see reasonable returns on my productivity and ability in 1 - 2 months? Thanks! And yes, the only language I _know_ and use is Javascript, though I have tinkered with Python (High School), Ruby (RoR), PHP (Drupal), and Assembly (Making Diablo 2 Mods) in the past. Please note that a book like O'Reilly's JavaScript Web Applications is too easy for me and not really what I'm talking about.


title: Is there a standard pseudocode for parallel algorithms?

text: The common styles of pseudocode are largely intelligible, and it is more or less clear how to write pseudocode for sequential programs. But if parallelism is not hidden behind a full library and is regarded as a regular part of programming, then it should be treated as the same way in regards to pseudo-code. Is there a consistent and widely used style of pseudocode for parallel algorithms? Are there good, practical examples of this?


title: Should we embed virtual machines rather than languages

text: Ok, so I am trying to learn front-end programming. Trying to figure out how javascript is a pain, and various projects (GWT, Coffeescript, Capuccino's objective/j...) are trying to fix this with languages that compile to JS. What would you do if you were to reinvent the browser? I think I would embed a VM rather than a language (quite like Java applets except less complex and with a DOM API instead of a canvas and self-contained environment). I suppose this has been suggested many times, but I cannot find resources on this, and most of the embedding tutorial I stumble on address embedding languages (guile, lua, python, whatever). Thoughts?


title: Conditions for a traditional friends system vs. open following system

text: I'm just curious for everyone who is developing social sites out there. When you build a method for connecting users, do you prefer to use a following- style system (follow me, you can see all of my information and I can just choose to follow you back), or instead do you choose to have a friends-style system (I have to allow you see all of my information on your homepage, even if it is open to the public, vise versa). Why and under what circumstances do you use each? How do you manage privacy between your users? Have you use another way to connect your users? Examples of what methods you've choose and how you manage the user's privacy (private by default vs open to the web) are awesome; it could show correlation and provides an actual look.


title: Keeping Backbone model in sync with editable view

text: I'm making a web form for editing some objects. I'll call these objects Foos. I have a Backbone model that represents Foos. I have a Backbone view that renders an editor form, filling in fields based on the state of the Foo model it is given. My goal is to keep the Foo model in sync with the form fields.    Idea 1: I could wire up `onkeyup` or `onchange` listeners on all of the input boxes. Whenever the user changes a field, the model would be immediately updated. Manually adding an event listener to each input box seems excessive, though.    Idea 2: I could add an `updateModel` method to my view. Calling this method would inspect the form fields and bring the model up to date. The problem with this is that if you forget to call `updateModel`, you will be working with a stale model.    What are some best practices for syncing a Backbone model with its user- editable view?


title: How do I improve my skills working in a small shop?

text: I'm a self-taught programmer and I'm working for a company that doesn't deal directly with building software (a glass manufacturer with a small IT team). I'm the only .NET developer there, although there are 3 SAP programmers with a bit of Visual Basic 6 background. Now I'm only a medium-level developer myself and I want to improve my skills, but it's rather hard when you are the "one-eyed king" in the proverbial land of blinds. Without leaving the employer, what can I do to improve my skills in such a sub-par learning environment?


title: How does one start mocking up a mobile app?

text: I have this idea for the "best app in the world". I know what it's going to do, the need it's going to fill, a high to mid-level idea of the code, and who i'm going to target. Now i'm ready to begin: I grab my pen, paper, thinking- cap, can-do-attitude, set the clock to GO-TIME--This app is gonna be awesome!......2 hours later, all i have on my paper is a big rectangle... One would think that the mockup would be the _easy_ part, but drawing a "simple & sleek" design harder than it sounds. Are there any techniques/advice that you can give on mocking up an app? Any references or rules-of-thumb guidelines you can provide would also be greatly appreciated. Thanks in advance.


title: How can I influence my team to become more agile

text: I consider myself an agile developer, I have set up CI in the last three teams I have worked with, and in my previous role worked in a style which revolved around writing failing tests before fixing bugs, extremely short feedback cycles (typically starting UAT of new features within a couple of days), and a very short release cycle. Now I find myself the only person to write a C# unit test in the last 6 months, battling inertia to improve code quality, and supporting a system in which new features are just released with the intention of fixing them later. What tricks can I employ to try and stabilise things? I have tried setting up CI, automated UAT deployment from a separate branch in source control, and publicising local free talks on software development, but with little success.


title: Stroustrup and the C++ complexity admission

text: I heard from a friend that Bjarne Stroustroup admitted that he doesn't know entirely the C++ programming language due to its vast complexity Is it true and there's some referrable sources or is it just an exaggeration? This affirmation should be present on his website, he told it in an interview/conference some time ago


title: Why C++ cannot adopt D's approach for its concept implementation?

text: As many of you guys know, _concepts_ , C++'s approach for constraining possible types for a template argument has failed to be included in C++11. I learned that the D programming language 2.0 has a similar feature for its generic programming. Its solution seems to me quite elegant & simple. So my question is _why C++ cannot use a similar approach_.   * The C++ concept's goal might be bigger than what D's implementation provides?   * Or C++'s legacy prevents it from adopting such an approach?   * Or any other? Thanks for your answers. p.s. To see some examples of D's generic programming power, please refer to this: http://stackoverflow.com/questions/7300298/metaprogramming-in-c-and- in-d/7303534#7303534


title: What should be in a coding standard?

text: What should be in a good (read:useful) coding standard?   * Things the code should have.   * Things the code shouldn't have.   * Should the coding standard include definitions of things the language, compiler, or code formatter enforces?   * What about metrics like cyclomatic complexity, lines per file, etc?


title: What should I do in AJAX or PHP?

text: Since I discovered the joys of AJAX, I tend to do all my requests to the server using AJAX. Is this a good idea? According to you, what should I do in PHP and what should I do in AJAX? I like to do my requests to the server with AJAX because I can use it as a kind of web service.


title: Web applications have "the todo list." What analogous program is there for systems programming?

text: You can find many frameworks with an example todo list for demonstrating a small but full application in the framework. You don't have to consider large problems like scaling or caching, but you still exercise most of the fundamentals of that framework in a todo list. Is there an analogous application for systems-level programming?


title: Should I pass an object or values?

text: Let's say I have a model that has 'purchase' method. The purchase method should take care of purchasing a product. Signature of purchase               public function purchase($token, Model_Member $member, Model_Product $product, Model_Recipient $recipient);      To call this method, I need to make $member, $product, and $recipient in my controller. Is it considered a better approach to pass an array of values to the **purchase** so that purchase can make those required objects like below?               public function purchase($token, $member_id, $product_id, array $recipient);      in this case, **purchase** should pull up a member record from the database and make a model of it. What's the better approach?


title: Git workflow - advise a newbie

text: I'm starting to work with git for the first time, and I'm trying to come up with a workflow that works for me, so I thought of coming and asking around. Right now, I'm in a couple of projects where I'm the only programmer and, in fact, the only pusher to origin. I'm working like this, where `c` is a commit, `p` is a push and `m` is a merge:                             /feature2-c-c-c-c-m-c-c-c-c                  /                 /     \     master-----------------------m-p------m-p             \                  /           \                \-feature1-c-c-c-c-c-c-c-c-c-c-m-c-c      Now I've gathered that rebasing would be more "correct" than those `merge master` I do in the feature branches, or at least that's how it'd seem.. but I'm not sure I'm doing it right. What I've realized now is that by merging master into my other branches, I mess with my branch's history, and add all the unrelated features' commits to it. Maybe I should branch more, by the subtask, adding a third level like this:                                ....................\     master---------------------------m-p--m-p-....             \                       /         \              \-feature1------------m-----------m.....                 \                 /             \                    \-feature11-c-c-c          feature12-c-c-c..      This leaves unaddressed the fact that sometimes a feature is bigger than what a branch should be. These are my thoughts on the matter so far, so I'm very open to suggestions on what's the best git workflow on one or two person teams. I hope the diagrams are easy to follow.


title: What is the difference between 'code readability' and 'language conventions' used within a community?

text: When I'm looking at questions asked on sites like stackoverflow on how to make a particular piece of code "more pythonic" there are usually suggestions offered to use complex list comprehensions or generators or other python features that aren't available in, say, Java. I am a casual Python programmer, and sometimes I can't follow what's going on without carefully unwrapping the logic in my head. Sometimes the list comprehensions are nested in ways that I'm thinking "you probably should just write it out using loops". Of course, veteran Python users probably won't have an issue with this, but I'm increasingly getting the impression that "pythonic code" is preferred over writing code that would be readable for the "average programmer" that may not be very proficient in Python. In general, what are some guidelines and heuristics to follow when choosing between the readability of the code and following the conventions used in a specific programming language community?


title: What is the best "bucket-fill" algorithm?

text: I'm pretty new to image processing, and I am currently working on a paint-like application that will feature a bucket-fill. However, I have no idea what the best algorithm for a bucket-fill is. I implemented an example I found from this site, however, it ran into infinite loop problems when a user tried to bucket-fill an area that had already been bucket-filled with the same color. I'm currently working around that problem by filling left, right, up and then down; however, I made it so that once a pixel has been filled in to the left, it cannot fill to the right, which means shapes such as: ![Example](http://i.stack.imgur.com/bDHrE.png) will not be filled properly if the bucket tool is used at the red dot. Therefore, I am hoping someone knows of an algorithm or a link to one that will resolve all these issues. **Additional Information:** This will be implemented using Javascript as the paint tool. It will be used online utilizing the Canvas element.


title: Should Properties have side effects

text: Should properties in C# have side effects beside notifying of a change in it's states? I have seen properties used in several different ways. From properties that will load the value the first time they are accessed to properties that have massive side effects like causing a redirect to a different page.


title: Team work and agile development

text: I think this question related not only to agile but to teamwork in general. When we are working in a team and each member is working a user story to complete how to avoid creation of duplicate classes and conflict? I mean if my user story require the creation of class A and also my team member need the same class and created the same (he may create it with slightly different name), how would we plan so that we move smoothly?


What is the time complexity of the algorithm to check if a number is prime?   This is the algorithm :               bool isPrime(int number){          if(number < 2) return false;     if(number == 2) return true;     if(number % 2 == 0) return false;     for(int i=3; (i*i)<=number; i+=2){         if(number % i == 0 ) return false;     }     return true;     }


title: Is there a specific design strategy that can be applied to solve most chicken-and-egg problems while using immutable objects?

text: Coming from a OOP background (Java), I'm learning Scala on my own. While I can readily see the advantages of using immutable objects individually, I'm having a hard time seeing how one can design a whole application like that. I'll give an example: Say I have objects that represents "materials" and their properties (I'm designing a game, so I actually really have that problem), like water and ice. I would have a "manager" that owns all such materials instances. One property would be the freezing and melting point, and what the material freezes or melts to. [EDIT] All material instances are "singleton", kind of like a Java Enum. I want "water" to say it freezes to "ice" at 0C, and "ice" to say it melts to "water" at 1C. But if water and ice are immutable, they cannot get a reference to each other as constructor parameters, because one of them has to be created first, and that one could not get a reference to the not-yet-existing other as constructor parameter. I could solve this by giving them both a reference to the manager so that they can query it to find the other material instance they need every time they are being asked for their freezing/melting properties, but then I get the same problem between the manager and the materials, that they need a reference to each other, but it can only be provided in the constructor for one of them, so either the manager or the material cannot be immutable. Is their just no way around this problem, or do I need to use "functional" programming techniques, or some other pattern to solve it?


title: Control Flow of php

text: I have a php script example1.php How would the control flow be when I call another php script example2.php from example1.php. Foe E.g                example1.php looks like this      ....      ...      ....      example2.php (calling example2.php from example1.php)      .....      .....      How does the control flow work for this ? Does example1.php wait until example2.php completes execution and then continuous with rest of code logic or does it just continues allowing example2.php to run independently ?


title: Why is Windows registry needed?

text: As I have debugged problems in com, side by side, dealt with dll hell, all while hating the windows registry with passion, I was wondering why is it needed. I never felt compelled to read an entire book on registry best practices, and then just "get it". I have, however, used Linux and Mac OS, and look at the ways one can install multiple versions of Python and its libraries on the same *nix computer. Because registry has somewhat of a free (albeit ugly) format, and is used for all sorts of purposes, I have never understood what essential problem it is trying to solve. For instance, Microsoft does not want you to have two different versions of MS Office installed side by side. They use registry to enforce this during installation. This limitation is artificial, in my opinion. If they really cared to allow a different behavior, they could have adjusted their architecture accordingly. In Mac OS you can install and remove apps by just dropping them into a particular folder. So, A) What essential problem it is trying to solve? B) How do other operating systems solve it?


title: Is it good to start with a simple subset of requirements and then extend the program?

text: When I was assigned a program, I usually build them block by block. For example, I was required to write a program which enable FTP transfer of files, which also allow queueing of transfer and a multi-thread transfer instead of single thread transfer. What I would do is: 1) Try to make the program able to transfer 1 file 2) Try to make the transfer into a queue 3) Try to implement multi-threading Would you do this instead: 1) Read through all the material/tutorial of all 3 requirement 2) Try to assemble them into a general picture 3) Write the program at once. What do you think?


title: Statistics collection engine for C++ systems

text: We have a research project with idea->prototype->statistics development cycle. Anyway, our final product is a prototype, so the statistics collection suite is not used persistently. Supposing I have following class:               class Transform {         private:             someData;              public:             transformForward (inp_block, outp_block);             transformBackward (inp_block, outp_block);     };      Imagine that it is a part of a big system. I need to periodically collect some statistics on such transform (internal data could be considered as well). It seems that adding statistical routines would be a violation of single- responsibility principle. The second smell is that I do not want to touch code that uses `Transform` instances to explicitly invoke these routines. I would be best if I could just trigger some kind of switch so that the statistics for that module will be collected. I've met that challenge a number of times and I have a feeling that I'm constantly reinventing the wheel. Is there some good practices for configuring and collecting the statistics suite for a compound system without interfering into it's internal code base? ## UPDATE: As I can see from the answers proposed, my question is too non-specific, so I'll provide more concrete example. Consider an image-compression system composed by two _huge_ blocks: `Predictor` and `Encoder`. There are a lot of various prediction and compression algorithms, during our research we need to explore the behavior of the components under various conditions. We should answer questions like "how many times the pixel is processed within each context", "how well does this predictor works", "how does each predictor affects the `Encoder`'s internal state" and many others. Anyway, our final product is just a _Codec_ with no statistical suite shipped with it; all kind of statistics collection is used internally during our research. Thus the question arises: how could one build flexible statistics engine that knows the very internals of the system? How could one keep the system itself independent of the statistics engine?


title: How to organise Website CSS

text: I understand the concept of CSS. But on many projects I've found that I tend to lose myself and end up with a millions CSS files for a millions different pages! I realise that the point of CSS is that it cascades. Otherwise it would just be a style sheet! I would just like people to shed some light on how they use CSS to its full potential! On my current website I've got a MasterPage and one css file for that. then for all the sub pages i tend to write a separate css for every 5 pages or so. I dont like my css files to be HUGE cos then i just get confused. How do you do it? I find it hard to comprehend that some people use one css file for the WHOLE website. or is that the done thing?


title: How to create high quality code producing teams? (as a group leader)

text: I come with a clear agenda on how to code correctly. I used to be a team leader, and I managed using significant amount of mentoring to create a team that creates high quality code. Now I have 3 teams under me, each one has its own team leader. My time is mostly spent on strategic meetings and I can't devote enough of it to mentor my teams. Once I do get to see code or design, I usually finds flaws in it, but I get to see little of that and I am afraid that all the code I can not see is designed or written poorly. How can I make sure my teams produce great code? Note: I am not in the position to fire anyone.


title: When are chained assignments (i.e. a=b=c) bad form?

text: I'm working on a VB.Net WinForms project and found myself writing code like this:               this.Fizz.Enabled = this.Buzz.Enabled = someCondition;      I couldn't decide whether that was bad code or not. Are there any .NET guidelines for when/when-not to do assignment chaining?


title: Frontend vs Backend data handling

text: Firstly I would like an answer from an experienced person (not a one man band), someone whom has worked in a medium/large team and had to battle with this burning question before. **The problem** : I am constantly being asked to not submit **empty** rows by rows = I mean a list of items and properties. A good example would be, multiple file uploads.               <form>         <input type="text" name="pic[0][label]" />         <input type="file" name="pic[0][file]" />              <input type="text" name="pic[1][label]" />         <input type="file" name="pic[1][file]" />              <input type="text" name="pic[2][label]" />         <input type="file" name="pic[2][file]" />         <input type="submit" value="Upload" />     </form>       **The requirement states** : >   * As a user I should be presented with fields 3 (three) upload fields. >   * For each field there should be a corresponding title/name/label >   * There should be a "Add more" button, to allow me (the user) to add more > images. > The reason for the requirement above is user experience. (Less clicks are required) **The Backend argument** Submitting empty rows (to the server) is "error prone" or is seen as a "validation corner" **The Front-end argument**   * Backend should not dictate what the FE can/cannot do.   * JavaScript is very volatile and should not manage/validate whether empty rows should be sent or not **The question** if the user:   * Enters 1 (one) title/label   * Selects 1 (one) image from his/her local PC   * Clicks Upload   * Leaves the last 2 (two) upload fields empty. So in your opinion/experience with this kind of problem. Should the front end send empty rows or data to the server or not?


title: What groupware/project-management apps (preferably self-hosted webapp) do you recommend for a small dev shop?

text: I run a small Drupal consulting shop and we've been trying different groupware solutions for what seems like ages, yet nothing we've found seems to be a good fit.   * We don't need CRM-overkill such as SugarCRM offers -- it's just too much for our small size.   * We do need git integration (at a minimum, an easy way to associate commits with issues)   * Time tracking on configurable or 15m increments   * per-project issue tracking   * billing (incl. recurring billing for support contracts, etc)   * some sort of per-project notes/wiki for things like login credentials, client contact info, etc.   * Contact logging (Client foo called at 2:20pm and asked to add bar to the spec, signed addendum with pricing due to client NLT CoB today, to be returned by CoB tomorrow)   * Open source solutions are greatly preferred to closed ones   * **Most of all, it should be very efficient to use.** Several solutions just fell out of use here because they required too many clicks for simple, frequent tasks like logging time spent on an issue or noting a call from a client. It shouldn't take 20 minutes to make a note. **Edit:** I almost forgot to mention: we're a mixed Linux/Mac shop with no Windows users.