What is the best local version control tool for personal use?

> **Possible Duplicate:**   >  Version control for independent developers? I was wondering if there is a tool out there which acts as Visual Source Safe but only on local machine. Basically I would like to check in and check out on my local machine when I am codeing on my personal project from home.


Version Control for One Man Dev Team?

I recently began work at a small company as a lone software developer. Before I came no true documentation/version control/etc. was in place. The best they have is Microsoft Word documents and Excel spreadsheets to keep track of everything the engineering team produces. Personally, among other things, I'd like to institute version control for my own sake, but they're extremely hesitant about it. My question, is version control sane for a lone developer? What are some of the benefits of version control to a lone developer? Also, what are some of the benefits to, say, a 2-3 man team? And, being that it is a private company, would Github or a private Git server be best?


Should I use a code repository if I am the only one working on a project?

> **Possible Duplicate:**   >  Version control for independent developers? I am not sure if I should use a code repository when I am the only one working on a project.


Infix vs Prefix Notation - Which do you prefer?

I have been learning Clojure and looking at Scheme and CL which introduced me to the world of prefix notation. At first I didn't like it but it is still starting to grow on me. To be honest though, there are still long calculations that are difficult for me to understand but I think that is an issue of me needing more exposure/practice and I'll get it. But that leads me to the question: Which type of notation do you prefer and why?


Is there a name for the not given/null/empty-problem?

I work with code, where data is stored/exchanged in Hashtable/Dictionary/Associative-Array-like structures, like this               {        'alpha': None,        'bravo': '',        # 'charlie' is not given     }      there is not much standartization, which field is 'given', and when given, if it may be given as None/Null/Nil or an empty string. As a result, the code is littered with checks like `if hasattr(obj, 'alpha')` and default fallbacks. **Is there a name or slang term for this kind of (imho) anti-pattern?** UPDATE: it seems, currently there is no name, so i'd like to hear suggestions. Currently we have these:   * Incorporeal Horde (credits to psr)


Security concern regarding web service

I'm currently working on a pet project with two of my buddies. This web service will provide basic functionality such as Login/Password Modification/Registration etc. All of us are comfortable with jQuery and ASP.NET. My friend's idea is to - `Set up a web service on the same domain and send it data for registration, validation and password retrieval through jQuery ajax.` This same process is going to be used for other CRUD ops as well. I'm not sure though, isn't this a huge security risk? Couldn't a normal person write some code that could create thousands of dummy users in our application? Would setting up a secondary web service that handles authorization (OAUTH 2.0 or something like that) and calls the web service that connects directly to the database reduce the security risk?


How to structure a program into classes

So after a while of working in programming field I still haven't figured it out how exactly should programs be structured, in a large set I mean. Which I think it's also because of working in an enterprise development. Say that I want to write a program, a messenger for a LAN network. How do I really know what classes to make for this program? How to divide the program into smaller pieces and classes in the best and most efficient way? This is just an example. I don't mean specifically for this problem set, it's the general approach that I am wondering about. EDIT: I have asked this question here because it exactly says in the help center: > What topics can I ask about here? > > Programmers Stack Exchange is a Q&A site for professionals and students in > software development and related fields who are interested in getting expert > answers on conceptual questions about software development. > > If you have a question about... > > software requirements > > software architecture and design > > algorithm and data structure concepts My question, according to my understanding, refers to the to the _software architecture and design_. It's not a specific coding question otherwise it would have been asked on Stackoverflow. It is a **conceptual question** which should be fit here. The comments and answers are referring to that there are a lot of books covering this topic. I'd accept even a book name for an answer if the book answers my question. If the answer does not fit into this form of Q&A, at least I could be pointed to the right direction. After all we're all here to learn something.


Finding all nearby points in a point cloud

What's the best way to store 3D point cloud data, optimising for time it takes to find **all** the points in a sphere of 3D space, and also for time it takes to insert new data points into the data set? Background: I have a cloud of 3D point data (with each point also including some further attached data), and need to be able to query it to quickly find all the points within a user-specified sphere of 3D space, as well as to quickly add points to the data set. My current implementation uses a naive linear array of data points, but unsurprisingly, that's not scaling well as my data set grows. My priority is speed, both for finding points in the cloud and for inserting new points into the cloud (I'd really like to avoid needing to rebalance trees after every insertion, if I can). I never delete points from the data set, so speed for point removal isn't important at all. Memory usage also isn't important -- I'm quite happy to throw memory at this problem, if it'll speed things up!


ROI in choosing a CMS solution

At the company I work for we need a CMS. We have to choices, first one, work with an existing CMS ( Drupal, Joomla, whatever ) or develop our own. I know for sure that developing our own is the right approach. We need all the flexibility we can get, and developing our own is the best way to accomplish this. But I need to sell this based on ROI to upper management ( my boss ). Basically in terms of time and money. I can convince upper management that developing our own is the best way to go even without mentioning ROI, but I would also like to present this data to him. So I'm trying to investigate on the ROI of using already existing CMS solutions VS developing our own customized CMS ( based on a open source library or not ). After a search on google I found this: Choose between a commercial, open source, or customized CMS, but the link is from 2003, it has some truth's, but the world changed a lot from 2003. And I can't seem to find anything else about it. I've developed my own CMS ( actually I'm still developing it, it's always a work in progress ), so I know it's not the most easy thing to do, and that it takes time. Can someone give me any tips? On the ROI of one solution VS the other?


A new language's chances

I am creating a new language, with some nice features like OOP, static typing, imperative, etc. The main reason for making a language was to learn more about compiler construction. My question is, what are the chances for my language to be known? What can I do to make my language used by many? I know there are lot of similar projects, and much better than mine, but I want to make this project a success. The project is almost completed. I think it comes with useful tools such as automatic memory allocation, memory manager, pointers, and few others. I would like to know if my project can have a future or shall I just drop it like many others? Thank you.


Working with static constructor in Java

I didn't get a complete understanding of static constructors in Java. If it is allowed, why it is allowed? In what scenarios would you use it? What purpose would it serve? Can someone give me a simple example please?


How to become comfortable with javascript and its libraries(jQuery)?

I am a php lover,working with php for last 2+ years also freelancing in different php producus like wordpress,joomla,drupal.I feel comfortable with php, I tried to learn javascript and its other libraries but feeling uncomfortable.Can not become productive also. So would any one give suggestion how i can learn the javascript?


Secure Open Source?

I want to make a delicate application of mine (an antivirus actually) open source but I want to have a control on who really obtains the source or not. Preferably they should apply and I or administrators approve their applications. Is there any online platform for this? The main reason for the control/security is to possibly prevent malware makers to easily discover how to bypass the stealth checking methods it utilizes for malware detection. Edit: I am looking for advice - possibly to hear from someone who has done something similar. Thanks!


License compatibility question

I have a question regarding software licenses. I plan to put a license to a framework that I have written. My intention is that the license should be open, in order to maintain a community. To be clear I will explain how I expect things to work. The framework will define some common API for certain functionality as well as a Proxy class that will invoke an implementation of that API. The proxy will be part of the framework, but it will internally call an actual implementation which will be developed mostly by someone else. So, basically I want to be able to:   * Distribute my library as free and open-source   * Allow use of my library in commercial software   * Allow commercial products to depend on my library i.e. provide a derived work as long as it is a result of linking to my framework API (not using the source code directly in (un)modified form), and license their derived work as they choose.   * Provide legal means of respecting the licenses of any third party implementations invoked trough my library. This means a commercial application should be able to use my library an another commercial library designed to work with my library as long as it respects my licensing terms and those of the other commercial license.


TDD: Write a separate test for object initialization or relying on other tests exercising it

This seems to be the common pattern that's emerging in some of the tests I've worked on lately. We have a class, and quite often this is legacy code whose design can't be easily altered, which has a bunch of member variables. There's some kind of "Initialize" or "Load" function which would put an object into a valid state. Only after it is initialized/loaded, are the members in the proper state so that other methods can be exercised. So when we start writing tests, first test is "TestLoad" and all we put in there is exercising initialization logic. Then we might add one (or few) TestLoadFailureXXX tests and those are definitely valuable. Then we start writing tests to verify other behaviors but all of them require the object to be loaded. So they all start by running exactly the same code as "TestLoad". So my question: Is TestLoad even necessary? Do you take it out and let other tests simply exercise the loading? Or leave it so things are more explicit? I know that each unit test function should have no (or as little as possible) overlap with other test functions, but it seems like in cases of loading, this is unavoidable. And whether we like it or not, if something in the loading code breaks, we will end up with a whole test suite of failures. Is there another approach that I might be missing here? * * * Thank you for the responses. It definitely makes sense that you want to see "InitializationTest" and if that fails you know where to start looking. In case it matters, this question is mostly about C++ and we use CppUnit framework. And now, thanks to sleske, I'll be constantly wishing that CppUnit supported test dependencies. Might have to hack something in one of these days :)


Is python a good choice to develop UIs? If so, wxPython or Tkinter?

I am looking forward to develop a desktop application using python. I am a beginner and I do not have sufficient expertise in python. I am a java programmer. Although I have some experience in building UIs using swings, I see that apps developed on swings are too damn slow. Well this might be one reason why many of the major implementations are done in C/C++ as in browsers/games etc. Developing a UI in C++ might be a better option but I prefer to chose a high level programming language over C/C++. So I have opted for python presuming that it would perform well over java swings as python itself is natively build on C/C++. So can I go ahead with this assumption that python is better than java swings to develop a UI? Or do you suggest a language that is better than python to develop UIs? If at all I go ahead with python, which toolkit should I use Tkinter or wxPython and why? please help me.


What does "abstractions should not depend on details" actually mean?

Most readers will be familiar with Bob Martin's famous dependency inversion principle, which states -   1. High-level modules should not depend on low-level modules. Both should depend on abstractions   2. Abstractions should not depend upon details. Details should depend upon abstractions I believe I understand it all pretty well, except for the first sentence in the second line - "Abstractions should not depend upon details". What does this mean exactly? What would be a simple example of an abstraction being dependent upon a detail?


How should an undergraduate programmer organize his time learning the maximum possible?

I started programming lately(pre-final year of a CS degree) and now feel like there's a sea of uncovered treasure for me out there. So, I decided to cover as much as is possible before I look out for a job after graduation. So, I started to read books (The C++ Programming Language, Introduction to Algorithms, Cracking the Coding Interview, Programming Pearls,etc ) participate in StackExchange sites, solving problems (InterviewStreet and ProjectEuler), coding for open source, chatting to fellow programmers/mentors and try to learn more and more. **Good,then what's the problem??** The problem is I am trying to do many things, but I am doubtful that I am still utilizing my time properly. I am reading many books and sometimes I just leave a book halfway (jumping from one book to another), sometimes I spend way too much time on chatting and also in getting lost somewhere in the huge internet world, and lastly the wasteful burden of attending classes (I don't think my teachers know good enough or I prefer learning on my own) May be some of you had similar situation. How did you organize your time? Or what do you think is the best way to organize it for an undergraduate? Also what mistakes am I making that you can warn me of


How do I implement classes in my scripting language?

Let's suppose I have a code file that reads (I'll use Java-ish syntax) and it is being interpreted. Kind of like a ruby script.               class A{         int fieldName = 4;         A(){...}              void doSomething(){...}          }          A instanceOfA = new A();     A.fieldName = 7;      This is what I understand to happen when this file is interpreted.   1. File is lexed and parsed   2. AST or Parse tree is generated   3. Parse tree is walked to generate code in the runtime to represent the class.   4. Then what happens? How is the definition turned into an instance? And what kind of internal representation is require to represent the class? Does the interpreter keep the AST for the class around for re-processing each time an instance is created or is some other form created? I've been following the patterns in Terrence Parr's Language Implementations Patterns book. I think understand how to build the symbol table and scope objects. I'm just a little fuzzy on how take a structure like a class and create an instance of it.


How to define a natural id in database?

There are a lot of manuals. I am trying to create an database to hold information of these documents. But, there is a small problem. How can I give meaningful id to the manuals? Are there any standard or logic behind the giving meaningful id to the documents? If there is no standard, can you tell me how I should do that? example:                table :                   manual id | manual name      EDIT:               Not Meaningful ID                1        or  M1        or   foo          2            C2             bar          3            P123           name         ...           ...            ...          (i)          (ii)            (iii)      (i) Not meaningful for me because if some item deleted, there can be gap. ex 1 33 100. (ii) random character can be confusing when one try to give a name to new manual (iii) Why giving name is not preferred is because finding a name to the manual as ID is hard after 500 manuals. Meaningful : New ID               * Can be easily produced even if after 1000 manuals     * Should not be so complicated


Need an open-source license with a small commercial addition

I'm working on an open-source project and people can use it and modify it, no problems here. The only thing that I don't want to allow is that people exploit it and earn money using my work (because that's what my plans are!) What kind of license should I use to cover these requirements?


How many threads should access the file system at the same time?

We have a module in an application which stores data in multiple files and multilevel directories and access them from multiple threads (both reads and writes). The directory structure is based on a splitted hash value, like:               b1/94/6a/92/a.txt     b1/94/6a/ee/a.txt     a1/0e/db/bb/b.txt     ...      If a caller removes a file the module deletes empty directories immediately. How much should be the concurrency level of the module? Is it worth to create and delete folders from multiple threads at the same time? Can filesystems handle these effectively? Is it worth to use a multi-threaded module? (It would be much easier to write a single-threaded one.) (The application is written in Java and mainly runs on Windows, NTFS, non-SSDs but I'm also interested in other operating and filesystems if there are differences.)


What would you avoid re-inventing at all costs?

We recently had to re-invent a high-availability queueing engine like RabbitMQ (for various reasons). Naturally this turned out to be more time consuming and expensive than expected. What type of things would you avoid rebuilding at all costs? Which types of components should rather be reused?


How to describe styles and approaches of C++ programming?

How can I say more than just "C++" on my resume, reports or other writings, to convey clearly what kind of C++ programming I've been doing? Are there well-defined styles of C++? ("Styles" might not be quite the right word.) Examples: using C++ as an "improved C" taking advantage of stronger typechecking, syntactic niceties, but little or lightweight use of classes; using heavy OO techniques where almost everything is made into a class (and there could be different styles of that) - but staying away from templates and advanced techniques; and heavy use of metaprogramming and every cutting edge advanced C++ feature. I've seen code where there's such heavy use of computer science terminology and advanced features only a CS PhD would be able to understand it, and code so clean and straightforward that EEs and physicists with modest programming skills can understand it. This isn't about literally coding styles - fussy details about brackets, indentation, commenting and all that - but one's philosophy of what good code is, the approach to organizing it all, and degree of fanaticism or reluctance to use various major techniques, procedural vs OO vs functional and so forth. Can such variations be categorized in a meaningful way? How to name these for someone not expert at software development, with an amount of knowledge to be expected of a good executive or recruiter (never mind the PHBs)? Ideally, there'd be a way anyone can say on their resume "C++ in blah-blah style" or "mumbleific C++" and land jobs or freelance projects in that category/style of C++. An improved-C++ coder could avoid projects full of heavy template-bloated code. (To some extent this question may be more general than C++, but C++ being around for years and being multi-paradigm, leads to the most confusion.)


Changing jobs and leaving a project without a leader (aka, me)

> **Possible Duplicate:**   >  At what point during a project is it unreasonable to leave? I'm the lead on a project that has been underway for about a year and a half. Two of us have been working on it. One is the database guy. I'm the javascript/ui guy. Which is to say, essentially no overlap in code knowledge. Here's the thing. Someone is about to offer me a sweet job with a nearly 30% bump in pay. Though I am perfectly happy with my current job and love the project, the new one would be better and I can't imagine saying no. The big problem is that my project is supposed to go into production starting in a few weeks. I will consider the new guys to have disqualified the new job by being bad people who would ruin my life if they won't cooperate and let me start after deployment. Since they seem like decent, ethical people, I don't expect that to be a problem. The current project will be brutalized by my absence. I take some comfort in the fact that I have emphatically requested an understudy for at least six months. That puts a little of the responsibility on the boss's head, but still, it's going to be a really bad thing. What do others of you do when you are a critical to a project when it's time to move on? Do I owe any obligation to stick around even though something better shows up? I know my spouse would object if I found someone else. Does that apply to work? I do have an understudy now, though he's fresh out of college. He's not going to replace me anytime soon. It's a small shop and the boss is going to be crushed. I am traumatized in anticipation of telling him and feel guilty about the practical consequences. I'm looking for some solace and some strategy about how to deal with this transition. Thank you for listening. =========================Subsequent notes ========================= @ChaosPandion, Chance: No, I can't stay to finish the project. I will insist on a compromise where I finish the current sprint (about a month from now) but there is at least a half year, probably a year of solid, full-time, work still to be done. I wouldn't expect the new employer to hold the job that long.


How you return to a code when you don't remember what you were doing?

Well, I have some problems with procrastination and whatnot, but those get infinitely worse, when I cannot remember what I should be doing. I mean, I know my project, I wrote 100% of the code so far, and I knew more or less what I was doing, but I don't remember exactly what, I don't remember what file I was editing and why. How I get back on track? (because right now my technique of opening the source code and staring at it is not working)


An example of a beginner-level Algorithm, intermediate level Algorithm and a complex/expert level Algorithm?

I'd like to get a sense for the range of complexity that algorithms fall into. I think it would be interesting and helpful for those, like me, trying to better understand how algorithms are formulated and how to deconstruct them. Can you offer a basic algorithm with explanation, an intermediate algorithm with explanation, and maybe an expert level one (with or without) an explanation?


What can I do to make sure my code gets maintained in a developer light environment?

I am a contract data analyst, so I bounce between jobs every 3-6 months, which I find to be a good fit for me, but it leads to some problems when it comes to coding. I mostly do statistics (I've asked a similar question on cross validated, but the answers there are not relevant here), but I have also found out that the business world loves excel and loves copying and pasting the same thing over and over again even more. This led me to learn how to write VBA scripts and then VB.NET programs to automate as many of these reports as I can. I am certain my programs are not the most elegant, but I put a good bit of effort into making sure they work under as many cases as I can test, I add in exceptions and try to code so the program can handle changes in the files that it processes, but there is a limit, if you remove a huge portion of the data, there is a good chance my program is going to trip up, which I accept will inevitably happen. Usually a pretty minor change in the code fixes the problem and I do try and comment my code and make it readable under the assumption that some other person will have to read it some day. My problem is that I generally get put on teams of folks with essentially no experience with programming (like VBA would be a huge stretch for anyone I work directly with). I am wondering what I should be doing as the person that wrote the code to do my best to keep it maintained. I have two approaches in mind (outlined next), but would be very happy to get any advice. Solution 1: Find the more tech savvy coworkers and run them through the programs and what basic changes can be made. Honestly automating excel is about as easy as it can get when it comes to programming, so I feel like I could teach someone the basics of maintaining it pretty quick. Solution 2: Get in touch with the IT department and show them what is going on and maybe they will be able to help. The problem here is that the IT department is constantly swamped (as I'm sure many of you know) and I feel like kind of a jerk for dumping more things on them. I do leave my personal email address with places and am willing to answer quick questions via email, but I view the need for more exhaustive maintenance as something of an inevitability and would like to make sure I do my due diligence to make sure it gets done. I imagine some combination of the two approaches outlined there, but is there any kind of heads up I should give IT? I feel like I would be annoyed if I started getting requests to fix a program that I had never seen from some random guy that is no longer there.


How to refactor to cleaner version of maintaing states of the widget

**Backstory** I inherited a bunch of code that I'd like to refactor. It is a UI application written in javascript. **Current state:** We have main application which consist of several UI components. And each component has entry fields, textboxes, menus, etc), like "ticket", "customer information", etc. Based on input, where the application was called from, who is the user, we enable/disable, hide, show, change titles. Unfortunately, the app grew to the point where it is really hard to scale, add new features. Main the driver (application code) calls set/unset functions of the respective components. So a lot of the stuff look like this Main app unit               function1() {        **call_function2()**        component1.setX(true);        component1.setY(true);        component2.setX(false);     }          call_function2() {             // it may repeat some of the code function1 called      }      and we have a lot of this in the main union. I am cleaning this mess. What is the best way to maintain the state of widgets? Please let me know if you need me to clarify.


Can any programmer have 4-5 years of experience on Android in March, 2012?

Today I was reading a job circular that came into our internal yahoo group. It stated **Android developer needed with 4-5 years of experience**. I am not a developer with that amount of experience. I have started to learn android recently. The point here that caught my eyes is _4-5 years_. I thought android is very new. No one should have 4 years experience. So I google to find the history of android. And found this on ctoedge.com, > The Android SDK was first issued as an “early look” release in November > 2007. In September 2008, T-Mobile announced the availability of T-Mobile G1, > the first smartphone based on the Android platform. A few days after that, > Google announced the availability of Android SDK Release Candidate 1.0. In > October 2008, Google made the source code of the Android platform available > under Apache’s open source license. Now could you tell me what type of programmers would have 4-5 years of experience in this March, 2012? Do they really exists? To me its something like _Experienced Java programmer needed with 18-20 years of experience_


SOLID vs. static methods

Here's a problem I frequently run into: Let there be a web shop project that has a Product class. I want to add a feature which allows users to post reviews to a product. So I have a Review class which references a product. Now I need a method that lists all reviews to a product. There's two possibilities: (A)               public class Product {       ...       public Collection<Review> getReviews() {...}     }      (B)               public class Review {       ...       static public Collection<Review> forProduct( Product product ) {...}     }      From looking at the code, I'd choose (A): It's not static and it doesn't need a parameter. However, I sense that (A) violates the Single Responsibility Principle (SRP) and the Open-Closed Principle (OCP) whereas (B) doesn't:   * (SRP) When I want to change the way reviews are collected for a product, I have to change the Product class. But there should be only one reason why to change the Product class. And that's certainly not the reviews. If I pack every feature that has something to do with products in Product, it'll soon be clattered.   * (OCP) I have to change the Product class to extend it with this feature. I think this violates the 'Closed for change' part of the principle. Before I got the customer's request for implementing the reviews, I considered Product as finished, and "closed" it. What is more important: following the SOLID principles, or having a simpler interface? Or am I doing something wrong here altogether? **Result** Wow, thanks for all of your great answers! It's hard to pick one as official answer. Let me summarize the main arguments from the answers:   * pro (A): OCP is not a law and readability of the code matters as well.   * pro (A): the entity relationship should be navigable. Both classes may know about this relationship.   * pro (A)+(B): do both and delegate in (A) to (B) so Product is less likely to be changed again.   * pro (C): put finder methods into third class (service) where it's not static.   * contra (B): impedes mocking in tests. A few additional things my colleges at work contributed:   * pro (B): our ORM framework can automatically generate the code for (B).   * pro (A): for technical reasons of our ORM framework, it will be necessary to change the "closed" entity in some cases, independently from where the finder goes to. So I won't always be able to stick to SOLID, anyway.   * contra (C): to much fuss ;-) **Conclusion** I'm using both (A)+(B) with delegation for my current project. In a service- oriented environment, however, I'll go with (C).


Software development process for a part time University project for 1 developer?

I will be doing a part time University project soon and the time frame for it is around 8 months with approximately 10-15 hours a week spent working on it, with a review by a tutor each quarter. My question is what software development process would you recommend using when the course requires you to work on your own in order to manage yourself as well as the project? I wanted to use a weekly or bi-weekly iterative approach to my work but a lot of the processes seem tailored to teams of people. I am looking at XP (Extreme Programming) OR Scrum as something that is less than the norm for University work but again Scrum I don't know a lot about yet, and a question I have is; can you say you are doing XP without pair- programming? because my tutor seems to think that I have to stick to all the practices otherwise I can't do it (nevermind if I am working alone). We can have external user input as well but due to the small timescales with part time work it may be more beneficial for myself to be the user as well, which is not what I prefer considering how I can get lost in the design.


Developing a Code Library

So I am in the middle of making (and maintaining) my own code library with quick snippets to make life easier. I'm assuming a lot of other people do this to help. My question is, what sort of things do you store in this so called library Also, Do you use any tools to organise this library?


isn't number localization just unnecessary?

I've just read this page http://weblogs.asp.net/scottgu/archive/2010/06/10/jquery-globalization-plugin- from-microsoft.aspx One of the things they did was to convert the arabic date to the arabic calendar. I'm wondering if it is a good idea at all to do so. Will it actually be annoying/confusing for the user (even if the user is Arabic). Also, my second question is that do we really need to change 33,899.99 to 33.899,99 for some cultures like German? I mean it doesn't hurt to do so since the library already does it for us but wouldn't this actually cause more confusion to the user (even if he is German, etc). I'm sure whatever culture these people come from, if i give you a number 33,899.99 there's no way you'd get that wrong right? (unless my website/application is the first website/application you've ever used in your entire life, which arguably is possible but the probability is just that low) I meant "universal" as the format that everyone will see and know what it means. It doesn't have to be some standard written in black-and-white and the like. As long as everyone can read it and know straightaway without confusion what the text is representing, that's universal. To be sure, 1.234,00 is definitely not universal. I mean i'm very sure you can find someone who in their entire lifetime, has been using computers yet have never came across this number format at all. Since most websites/apps had been using 1,234.00 without changes to accommodate localization, I believe that it has been the de-facto (the universal format that everyone will see and know what it means). As for dates, if we write 01/02/03 I'm sure there's no way anyone will know (straightaway, rightaway, without ambiguity) what date it is. But no one can get Jan 2 2003, Feb 1 2003, Feb 3 2001 wrong if we wrote them as such isn't it? Btw this question is targeting localization, don't tell me stuff like "Hey not everyone reads English alright!" because that is a matter of internationalization (which is beyond this topic). Let's stick to the discussion on localization.


Should I provide a language reference in addition to a formal specification for the programming language I am designing?

I am designing a programming language, and I would like to provide a complete documentation for it. So far, I have planned to write the following documents:   1. An initial design outline, mostly as a reminder of the design and proposed changes to it, as well as an aid to construct all the other documents when the design phase has been completed.   2. A formal specification of the language's syntax and semantics, both in English and in a suitable formal mathematical notation.   3. A tutorial. I have found that some languages have references, and I have found on Wikipedia that language references and language specifications are not quite the same, references being usually less detailed due to being aimed at users of the language rather than implementors of it. However, I would like to know...   1. What parts of a language specification are usually omitted in a language reference?   2. Is it really useful to provide a language reference when ultimately a good programmer should consult the language specification as their definitive source of information?   3. In case the answer to the preceding question is "Yes"... Is it really worth the risk of introducing contradictions between the language specification and the language reference?


Why do we use story points instead of man days when estimating user stories?

In agile methodologies (e.g. SCRUM), the complexity/effort needed for user stories are measured in Story points. Story points are used to calculate how many user stories a team can take in an iteration. What is the advantage of introducing an abstract concept (story points), where we can just use a concrete measurement, like estimated man-days? We can also calculate velocity, estimate coverage of an iteration, etc. using estimated man-days. In contrast, story points are harder to use (because the concept is abstract), and also harder to explain to stakeholders. What advantage does it offer?


How to handle file access transactions properly?

I'm looking for good practices or any advice regarding **file access transaction mechanisms**. We will have multiple instances of an application spread over a redundant network (cloud) watching a directory on a 100% available NAS. I'm also looking for any alternative architecture that may be more appropriate.   * We will have thousands of mobile devices accessing the system every minute. The devices produce a binary file (picture for example) that is sent to a RESTful service without transformation. The device must do the job quickly to preserve battery.   * Since RESTful service must take the input as fast as possible, the binary file is currently written directly as a file in a 100% availability NAS.   * If an error occurs (file not being written correctly), the client is notified and can try again. We must build a worker service that will _watch_ the file folder for new files to process them. The worker will convert them to another format then move them to another folder on the NAS. We will use as many instances as possible to handle load. My main concern is about file access. The RESTful service is writing to a temporary file with an extension that the worker service is ignoring (.tmp), then after the last byte is written, the file is renamed. The process is quick, but we can't afford the case where 2 or more worker services access the same file at the same time. We need some transaction mechanism or any other entreprise architecture pattern. **Is there any kind of file system transaction mechanism that scales?**


How to handle the input file provided in programming contests?

In programming contests like Google CodeJam, Facebook Hacker Cup, each question is provided with an input file for testing one's code for that program. I get struck at this point only. I don't understand whether that input file should be read by my program or it is just for testing the correctness of my program for various test cases given in that input file and I can copy past each test case given in the input file one by one manually and see whether the output provided by my program is right or wrong. It would be very helpful for me if anyone who has been actively participating in such competitive contests can share their views.


Best Practice: Should error messages be handled by the API or by the App?

I am designing an application that interacts with a RESTful API. When returning error messages like `Unable to sign up user` Should the error message be generated by the app? or by the API? I am looking for best practices.


Fully Stable, In-Place Unique Algorithm in O(n)

Is there an algorithm that, given a sorted array, _swaps_ all the _first_ unique elements to the beginning of the array and the duplicates to the end, while remaining stable for _both_ the unique subarray and the duplicate subarray, and that runs in `O(n)` swaps (and preferably one pass)? It should return the length of the unique portion of the array. Contrived example input/result (Using python because it's easy to read):               >>> A = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5]   # already sorted     >>> r = Unique(A)     >>> r     5     >>> A     [1, 2, 3, 4, 5, 1, 2, 3, 4, 5]     >>> A[:r] # the sorted portion     [1, 2, 3, 4, 5]     >>> A[r:] # the duplicates portion     [1, 2, 3, 4, 5]      Stability means that even if two or more keys compare equal, the ordering of the keys in the result persists. E.g. if `A[i] == A[j] == A[k] and i < j < k` in the original array, all of those properties hold in the whole array after running the Unique algorithm. (Even though `A[i]` might be in the unique subarray and both `A[j]` & `A[k]` are in the duplicates subarray.) My failed attempt is a one-pass that tracks the current unique element while iterating through the array. The next unique element is swapped with the element after the end of the current unique subarray:               def Unique1(A):         if len(A) <= 1:             return 0         i = 0         for j in range(1, len(A)):             if A[i] < A[j]:                 i += 1                 if i < j:                     A[i], A[j] = A[j], A[i]         return i + 1      It swaps the first unique elements of a sorted array to the beginning of the array, runs in one pass (so is `O(n)`), and is stable for the unique subarray, **but** this does not satisfy the requirements because it scrambles the duplicates subarray:               >>> A = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5]     >>> r = Unique1(A)     >>> A[r:]          # duplicates part     [3, 2, 4, 1, 5]    # not sorted      While the changes the algorithm makes to the unique subarray is somewhat obvious, I can't "see" what's happening to the duplicates subarray, but I have a feeling that it could be reversed if we knew or stored more information about the duplicates. Note, just re-sorting the duplicates subarray is a non-starter because 1: it's `O(n log n)` not `O(n)` and 2: it breaks the stability. I can also think of another algorithm that swaps newly found unique items all the way down to the next position. While it would satisfy the other conditions, it would have `O(n^2)` swaps. Is such a unique algorithm possible? And if not, why not?


Subscribe/Publish Model in Web-based Application (c#) - Best Practices for Event Handlers

I was recently exposed to a desktop application that uses an publish/subscribe model to handle commands, events, etc. I can't seem to find any good examples of using this in a web application, so I wonder if I am off base in trying to use this for web based development (on the server side)? I'm using asp.net c#. My main question in regards to the design is: When using a publish/subscribe model, is it better to have generic commands/events that pass no parameters and then have the subscribers look at static context objects that contain the data relevant to the event? Or is it better to create custom arguments for every event that contain data related to the event? The whole concept of a global container seems so convenient but at the same time seems to break encapsulation. Any thoughts or best practices from anyone who has implemented this type of model in a web based application? Even suggestions on this model out of the scope of my question are appreciated.


Adding scripting capability to a .NET application

I already have a working implementation that adds scripting to an application. The application currently generates and compiles scripts from C# snippets (taken from different user provides configuration files) into assemblies using the CodeDOM. As it sounded like a good idea at first I ran into following issues:   1. difficult AppDomain handling and need for Serialization   2. performance issue => frequent script changes trigger a recompilation   3. changes cannot be made in-place in the scripts while running   4. difficult to provide a GUI for debugging (breakpoints), the script writer actually needs a debugger... I "hacked" a solution against 1 by loading everything in the main AppDomain. The problem is that nothing can be unloaded... After some time the memory use is huge. For this reason I eventually would consider to switch to an interpreted solution but want to remain near to a C# language because of the existing code-base. There is a bunch of libs around Vsa, S#, Script.NET, ... I need to access objects in my application from the scripts and also run methods in the scripts from my application. Do you also think that switching to an interpreted language the right strategy or should I try to add a debug mode to the existing concept by injecting code like calling a method between each line of the script to allow a step by step execution.... However the AppDomain handling remains a nightmare to handle. It is certainly not the first time someone runs in such a situation. I could not find any FOSS wrapper/helper library to make the CodeDOM handling easier nor GUI elements to provide building blocks for a minimal debugger. Currently I built ma own GUI and step over calls in the scripts and show changes in the application objects (before/after calls) inside the GUI. Please only refer to FOSS source/libs.


What is the advantage of using UI binder in GWT?

Mention the **pros and cons** of UIBinder in _GWT_. I want to develop a big project. Is it flexible to use **UIBinder** for my project?


Which commit to add issue/bug tracking ticket # to

I have been committing changes in git for a project over the last several months. I would like to start integrating Trac into my workflow. Generally, I have the 'git flow' style of git repository. I maintain a master and develop, and I branch features and bug-fixes from the develop branch. I see from answers in Which commit should close a Github issue when multiple commits are responsible? that I want to link the "merge commit" to the ticket. Since I already have several features in the git repository, I'd like to go "back in time" to associate them with a ticket that was entered in Trac. At this point, I have two choices:   1. Re-write history. I can use `git rebase --interactive --preserve-merges`. Then add the ticket information to the message.   2. Use `git notes add <rev>` to _add_ a note. **I am looking for opinions on which is the better option.** 1\. allows me to be more in keeping with defacto-standards, while 2. allows me to keep ticket management separate from the code repository. I have complete control over the repository, Trac server etc. Solo developer, no pushes (other than to a "backup", but I can rebuild that from the local)


How to test functions or the code inside $(document).ready() using Jasmine?

I have multiple functions and a lot of code inside `$(document).ready(function())`. I am using jasmine to test the functions inside the ready function as well as the code inside `ready()` but when the test cases inside describe are executed it is not able to access the code inside the `ready` function.               $(document).ready(function () {         function testMe(){             testVar = true;         }     });      Jasmine test suite               describe("test suite", function(){         beforeEach(function () {             testme = false         });         it("Test Alert Box Message For Change Modal", function() {             expect(testme).toEqual(true);         });     });      Kindly suggest what approach needs to be taken for the above approach.


The Underlying Value of Aspect-Oriented Programming

I recently got into PostSharp, an AOP tool for weaving in code. I've been finding a lot of resistance with other developers over giving up writing code to perform the tasks the weaving was meant to simplify. For instance, I'm finding logging or error-handling code where I have postsharp already doing that. I can understand why its happening, since its hard to remember everything that weaving was setup to do (I'm applying a global attribute definition). With that said, factoring in levels of experience, etc, is AOP beneficial to a project? What is your opinion? Thanks.


Can software licensed under GNU General Public License v3 be sold by the original author?

As I know, softwares licensed under the GNU GPL is totally free and not allowed for sale. However, today I found this program called Minitube and it is sold even though it is licensed under GPLv3. Does the original author has a permission to sell his own software, even if he releases it under the GPLv3?


Can the following Domain Entity contain logic for creating/deleting other entities?

a) As far as I understand it, in most cases _Domain Model_ **DM** doesn't contain code for creating/deleting _domain entities_ , but instead it is the job of layers ( ie _service layer_ or _UI layer_ ) on top of **DM** to create/delete _domain entities_? b) _Domain entities_ are modelled after _real world entities_. Assuming particular _real world entity_ being abstracted does have the functionality of creating/deleting other _real world entities_ , then I assume the _domain entity_ abstracting this _real world entity_ could also contain logic for creating/deleting other entities?               class RobotDestroyerCreator     {              ...              void heavyThinking()              {                       ...                       if(...)                              unitOfWork.registerDelete(robot);                       ...                            if(...)                       {                              var robotNew = new Robot(...);                               unitOfWork.registerNew(robotNew);                         {                       ...               }     }      Thank you


Team logistics to build a cloud service API from a Matlab prototype

My objective is to get from an algorithmically sound software prototype to a SaaS API product. To give a similar and illustrative example, suppose that I have prototyped scalable facial recognition software in a high level language like Matlab; this algorithm takes a real world image as input and detects and recognizes, say, celebrity faces. It's accurate and decently optimized, running about ~2 seconds per image on a 2.4 GHz processor. In C, it should run ~0.5 seconds per image. The goal is to get from a Matlab prototype to a cloud based API service that can scale massive amounts of image data. An initial test product should be to handle ~100 calls per second, but in the long term it should be able to handle >10,000 calls per second. This will eventually be combined with a web crawling application to scale all the web's image data. Given the source code of the prototype, how to build, test and deploy this in a scalable way? My background is math and algorithms rather than software and systems engineering.


How do I appropriately license my open-source project?

I have just recently completed my first open source project and while it is mostly a tool I still want to release it as open source considering it is C# so if someone wanted to they could decompile it. Also, I'm not looking to sell it. I was researching licensing but the wording is a bit over my head. Mostly I'm just looking for a license that recognizes me as the creator and does not allow anyone else to put their name on it and "steal it." I'm most likely going to use either google code or sourcefourge to host the project and ideally I could have a donation button. I'm not sure if or which software licenses would prevent that sort of thing? Also, I'm not really sure how licenses and copyrights "work." Do I just choose a license and paste it at the top of every source file? Should I include my name as well? Do I also put the licenses in the project's root directory? How does one obtain a copyright? It seems like most people just stick it on their stuff. Is there an actual process to obtaining one? As for software licenses I've looked at so far, it seems like Apache 2.0 or MIT/BSD is what I'm looking for but I'm not exactly sure. Basically I just don't want anyone to steal my program and put their name on it. Other than that I'm fine with people looking at the source code, modifying it, or taking pieces from it, as long as they credit me.


What are some really simple rules to keep a PHP codebase organized?

I'm new to PHP in a professional context. I want a few macro thumb rules to keep me on the enlightened path. Here are a few I'm proposing to myself:   * no absolute paths in include|require(_once)? statements   * no `..` `dirname(foo)`, or other means of walking up in include|require(_once)? statements   * put libs on the include path, not in subdirectories You can see that all of this is focusing on managing dependencies, because that is the problem I've encountered thus far. What other thumb-rule solutions to macro level problems do you have?


Amazon Kindle - Whispersync implementation?

For those who are not aware of Kindle's whispersync, here is how it works (from amazon.com): "...Whispersync synchronizes the bookmarks and furthest page read among devices registered to the same account. Whispersync is on by default to ensure a seamless reading experience for a book read across multiple Kindles." Can anyone give some details on how the Whispersync feature is implemented in Kindle and in the Backend of Amazon? I am guessing this implementation involves a very simple hashmap for each user account. Each hashmap maps Books with satellite information about the book. Satellite information contains bookmarks, furthest page read, device on which it was read, etc.. Thanks!


In languages that don't allow underscores in integer constants, is it a good practice to create a constant for 1 billion?

In languages that don't allow underscores in integer literals, is it a good idea to create a constant for 1 billion? e.g. in C++:               size_t ONE_BILLION = 1000000000;      Certainly, we shouldn't create constants for small numbers like 100. But with 9 zeros, it's arguably easy to leave off a zero or add an extra one in code like this:               tv_sec = timeInNanosec / 1000000000;     tv_nsec = timeInNanosec % 1000000000;


What are some things you have read that inspired and guided you as a programmer?

For example, being a beginner, I find a lot of inspiration and direction from reading this post by Bryan Woods.


Why are websites (even this one) sometimes "Down for Maintenance"?

I have personally never done this. I don't understand why so many sites do, if you do your development on a development server why would you ever need to shut down your production site? I have always wondered about this. What are they doing during this time, what requires doing this?


Deciding how to model customer when it can be both natural and legal person

Suppose that we are developing some application that requires us to be able to manage customers and that those customers can be both natural and legal person. There are some different ways on which we can deal with it and I'm not sure which of them is the best regarding extensibility, code reuse and so on. The first thing I thought was to construct two classes "NaturalCustomer" and "LegalCustomer". Then, the shared properties would be moved to a base class "Customer" and both NaturalCustomer and LegalCustomer would inherit from it. The second thing I thought was "consider every customer as a natural person, and consider that a legal person customer is just a natural person that has one or more companies". In that case I would create a class "Customer" and then a class "CustumerCompany". If there are other companies in the application that share properties with CustomerCompany I would build a new class Company and inherit from it. In this approach there would be a zero-to- many relationship between Customer and CustomerCompany: a customer can have one or none companies. I'm not really sure how to deal with this kind of problem. I'm just beginning with object oriented analysis and design and I'm still confused. The main problem is that if I select the first approach I wouldn't be really reusing lots of code. For instance, there could be other kinds of natural person in the app like "Employee" and it would share lots of properties with NaturalCustomer, and the same for companies, there could be companies like "Supplier" and it would share lots of properties with LegalCustomer and still I wouldn't be reusing it - so if I have to make a change on data that should be stored for companies I would have to change everywhere. How do we deal in this kind of situation when multiple inheritance isn't allowed (that is I cannot make LegalCustomer inherit _both_ from Customer and LegalPerson)? Thanks very much in advance!


What to name a new interface that is replacing an existing one?

We're redesigning our application's plugin interface, so we're using the Adapter pattern with our proof-of-concept design to show that the new interface will function without committing to using it in the application itself. We don't know what to call this new interface. It serves the same purpose as the old one - let's call that one `CAbstractAppPlugin`. Furthermore it will likely be, like its predecessor, an abstract class rather than a pure virtual interface (C++) indicating that we should still use "CAbstract" instead of "I". Slapping a "New" or "2" onto the name seems silly, but adopting a very similar name could lead to confusion until the old one is deprecated. So how do you name a thing X that's replacing thing Y?


How to structure an application which reads UPC barcodes

I have no previous experience on creating a project for a seller which will use barcode reader. I am trying to put together a small project but I cannot figure out how the pieces should glue together. I will create a sample with Motorola Scanner SDK to read barcodes and from that point, I have couple of questions:   * How UPC barcodes work in general? AFAIK, a barcode stores the manufacturer and product info but no price data.   * Should I store price information inside a database which corresponds to barcode data? I would really appreciate if you can guide me here.


New to Back End Development where to start?

I am an student learning web development by my own, I am very interested in back end development where can i start to learn?


Are non Turing-complete languages considered programming languages at all?

Reading a recent question: Is it actually possible to have a 'useful' programming language that isn't Turing complete?, I've come to wonder whether non Turing-complete programming languages are considered programming languages at all. Since Turing-completeness means a language has to have variables to store values as well as control structures ( for, while )... Is a language that lacks these features considered a programming language ?


Should static parameters in an API be part of each method?

I am currently creating a library that is a wrapper for an online API. The obvious end goal is to make it as easy for others to use as possible. As such I am trying to determine the best approach when it comes to common parameters for the API. In my current situation there are 3 (consumer key, consumer secret, and and authorization token). They are essentially needed in every API call. My question is should I make these 3 parameters required for each method or is there a better way. I see my current options as being:   1. Place the parameters in each method call              public ApiObject callMethod(String consumerKey, String consumerSecret, String token, ...)      This one seems reasonable, but seems awfully repetitive to me.   2. Create a singleton class that the user must initialize before calling any api methods. This seems wrong, and would essentially limit them to accessing one account at a time via the API (which may be reasonable, I dunno).   3. Make them place them in a properties file in their project. That way I can load the properties that way and store them. This seems similar to the singleton to me, but they would not have to explicitly call something to initialize these values. Is there another option I am not seeing, or a more common practice in this situation that I should be following?


Does C99 make the K&R book outdated? If so what to recomend in its place?

C99 has been with us for a while now. It introduces a lot of features that are not in K&Rs The C Programming Language. None of them are particularly radical. However, even small features like being able to intermingle declarations and code change how one organizes code. While I still consider the K&R book an invaluable reference, and like its writing style, is there a better book that takes into account the C99 standard? I'd buy a third edition of K&R in a heartbeat, but I don't think that is going to happen.


Should I continue teaching old Java input methods alongside the new ones?

I've been imparting a Java introduction course for several years. Some slides explain how to read from files and keyboard using `BufferedReaders, InputStreams, FileInputStreamReaders` etc. I'm adding slides explaining how to achieve this using newer approaches like `Scanner`. Should I leave out the old `BufferedReaders, InputStreams and FileInputStreamReaders` slides altogether, and teach only the new methods, or should I continue to teach these methods for the sake of completeness ? Will my students benefit from learning how to read from files and keyboard the old way ?


Is it a good habit to use C expressions in C++ code?

At school we started learning C this year, despite the fact I'm way ahead of class, and I learned Java, C++ and C while the class is at the base of C. Anyhow, I've been documenting myself, reading books, articles, and I've asked my teacher why I should learn C, and she said it was the foundation of C++. When I first started programming I found C++ alot easier, I later on learned C. But In books you can see that C code works in C++ yet it doesn't go vice- versa. My question is pretty straightforward ~ Is it a good habit to use C expressions in C++? Let me give you an example: Should this code               #include <stdio.h>     #include <iostream>          int main() {     int x;     scanf("%d", &x);     cout << "The number you entered is " << x << "And it's double is " << x*x;     return 0;     }      Be more efficient or better in any way than this:               #include <iostream>          int main() {     int x;     cin >> x;     cout << "The number you entered is " << x << "And it's double is " << x*x;     return 0;     }      I have already done some easy documentation on this in some dusty old books, and from what I could find, using scanf instead of cout also flushes the stream or something like that, so I'm basically asking if it's better to use scanf and in what contexts. This also applies to file IO as I've always found FIle IO to be easier in C than in C++. This question goes for pretty much every general expression in C applied to C++. It's also notable that I'm using a modern compiler and nevertheless this should not matter as I'm asking if it's a good programming habit to use C expressions in C++ code. There are probably cons and pros of doing this, but I'm only looking for a yes/why, no/why type of answer. Also if there are any details I've left out post a comment.


What is the difference between PHP and ASP.NET Web Forms in page size?

I plan to program web applications for small companies. When I read about ASP.NET Web Forms, I liked its way of building dynamic sites. However, I have heard from a friend that Web Forms could increase the size of the pages because of ViewState output. Will the difference between the size of PHP pages and the generated HTML of ASP.NET pages be dramatic?


main() function prototypes

As far as I know,               main ()      function has the following prototypes:                   int main();         int main(int argc, char **argv);      Now, C does not support overloading, then how are multiple prototypes of                   main ()      supported?


Should I include test runner module as a dependency in my module?

My module has no dependency on its own but for running tests you need to install `jasmine-node` module. Should I include that module as a dependency?


Security and code execution

If I am taking data from a website, for example status updates from Facebook and showing them on my website. What possible damage can be caused if I am not taking into account that the code written as status update would execute on my website? For example, Mr. Simon has putted his status update,               "
I love to code
"      Now, when I display this on my website, it transforms into the text **I love to code** written in red.


How to save images into files in a web application and avoid removing them with every build?

I am building a web application and users will be able to upload pics. And I want to store these images into files instead of storing them into the DB. But if I saved these pics into relative paths to the web application, they will be removed with each build. So how I can handle this and the best practices related to this issue.


Open Source Project and Revenue

I started an open source project in 2010 and the project is gaining some visibility. We are now 2 active committers and we hope to engage more contributors in the future. We received today the second offer to "partner" with a company. This time is a hosting company that wants us to offer a hosting plan with a automatic installation of the software and receive a affiliate payout for each (the company is well-known). The question is: **Is there a way we can share the revenue within the project contributors?** Our main goal for now is to have more contributors and make better software, not profitability... PS: We are also in the process to assign the project to the Outercurve Foundation.


Unusual languages for numerical analysis

This question is inspired by these questions (here and here). I do mostly numerical work, and I usually use C++, Fortran, and occasionally Numpy. I'm trying to broaden my horizons, and I'm looking for programming languages that are good for numerical work (have bindings for BLAS/LAPACK; fast, lightweight, multidimensional arrays; etc.) but are a little bit outside the mainstream. Which "unusual" languages are good for getting new ideas about numerical programming?


jQuery UI Widget Factory namespace limitations

As I can read in this tutorial, "There is a limitation that namespaces be exactly one level deep – that is, we can't use a namespace like nmk.foo". What isn't clear to me (and something I was unable to find an explanation for in any documentation) is the _why_ behind this reasoning. Coming from languages like Java and C#, the possibility to further subdivide namespaces seems almost blatantly obvious, yet in the `Widget Factory`, this is limited by design, so reserving namespaces to implement some sort of logical separation in types of widgets is not possible. Can someone provide some insight into this limitation? Is there a technical reason for it?


Working at home for a junior developer

I just recently got my first development job, and consider myself lucky to be working from home. However, I need advice... What should I be doing in order to make sure I get the most out of my new job, how can I make sure that I succeed, and what are some particular pitfalls I might run across? I have already set aside a distraction free home office, where should I go from here? Note: I have been reading up on some of the more general work from home stuff here but I am interested in what to watch out for as a junior developer.


End user query syntax?

I'm making a command line tool that allows end users to query a statically- schemed database; however, I want users to be able to specify boolean matchers in their query (effectively things like "get rows where (field1=abcd && field2=efgh) || field3=1234"). I did Googling a solution, but I couldn't find anything suitable for end users--still, this seems like it would be a very common problem so I suspect there is a standard solution. So:   1. What (if any) standard query "languages" are there that might be appropriate for end users?   2. What (if any) de facto standards are there (for example, Unix tools that solve similar problems).   3. Failing the previous two options, can you suggest a syntax that would be simple, concise, and easy to validate?


Do I need any licence to develop web applications in asp.net?

My goal is to develop web applications for small companies, medical clinics, small supermarkets, etc. Do I or my customers need any license?


How do you bridge the generational gap between managers and developers?

Typically, managers tend to be older and have more experience than the developers working under them. While young developers are often more knowledgeable about "newer" technologies/patterns (like .NET, Rails, SOLID, etc.), managers are more familiar with older technologies (COBOL, ASP). However, the manager often has proven experience in problem solving and providing value to the customer. Furthermore, many of the principles of good programming remain static. This generational gap can produce tension between the manager and the developer. A developer may feel that the manager has no idea what they are talking about and is outdated, while the manager feels the developer is naive and just going along with the current tech fads. How can this generational gap be bridged so that there is a healthy trust and respect between developers and managers even across age differences? How have you dealt with this issue?


How to deal with non-licensed software

I work for a very large fortune 500 company who is subcontracted to another fortune 500 company on a DoD contract. As you can guess the red tape is tremendous to do anything. We have simply shared a VM that is loaded up with Microsoft dev tools from someone elses MSDN subscription. When I have questioned our MSDN licensing, each time I was always told it is in the works. This has been going on for over a year now. We also have other products that we are using that have a 30 day trial. One developer found an exploit to extend the 30 day trial infinitely, this approach has been encouraged by our management while they get the licensing "worked". I have contacted 4 levels of managers on this program. No tangible action in over a year now. What should I do? Report them to Microsoft and the other appropriate software vendors? Contact my companies ethics hotline? STFU and go with the flow? Thanks


**Question** : **As an lone, Agile (PXP/PSP) developer what is the proper structure for a formal project post-mortem?** **Scenario** I'm using a PXP methodology (which is a blend of extreme programming and the personal software process) to work on an undergrad project. The project revolves around computer vision and architecture. Although the project has a lot of potential for future improvement, I need to write a project retrospective for this release. I'm used to working with an SRS (requirements specification) and DSD (design specification document) with a structure like : Introduction   * Purpose   * Scope   * Definitions, acronyms etc. Description   * Product perspective   * system interfaces   * interfaces   * Hardware Interfaces   * Software interfaces... constraints etc. Requirements   * Performance, interfaces etc...   * Attributes for security, portability etc. DSD   * system overview -Design consideration   * Architecture   * detailed system design ... etc. However, agile project as we know revolve more around stories than functional requirements, and firm designs. A recommended non-agile structure for this final report is : Introduction : \- Literature review : \- planning : - statement of the methodology used. Design :   * requirements   * design aims Implementation - language choices, coding guidelines etc. Evaluation - evaluation of how good the algorithms are. I've not been able to find an example online of a definite project postmortem structue for a PSP project (even the documentation 1 does not mention how it should be structured).


What practices exist for locale-specific unit testing?

We recently discovered a locale specific issue in our application and while it was easy to fix (once we figured out what was going on), it got the team I'm on thinking about unit testing practices in this regard. We would like to catch these issues sooner, ideally before they're discovered by a customer, and we want to protect ourselves from reintroducing locale specific bugs in the future, but duplicating every unit test in at least one other culture seems like a lot of overhead. How do you or how would you approach multi-locale unit testing?


Speeds of << >> multiplication and division

You can use `<<` to multiply and `>>` to divide numbers in python when I time them I find using the binary shift way of doing it is 10x faster than dividing or multiplying the regular way. Why is using `<<` and `>>` a lot faster than `*` and `/`? What are the behind the scene processes going on to make `*` and `/` so slow?


How to document a file format specification

For a project, I need to work with varying types of files from some old games and related software--configuration files, saves, resource archives, and so on. The bulk of these aren't yet documented, nor do tools exist to work with them, so I must reverse-engineer the formats and build my own libraries to handle them. Although I don't suppose there's great demand for most of it, I intend to publish the results of my efforts. Are there any accepted standards for documenting file formats? Looking around, there are several styles in use: some, like the .ZIP File Format Specification, are very wordy; others, like those on XentaxWiki, are much more terse--I find some of them difficult to read; the one I personally like best is this description of the PlayStation 2 Memory Card File System, which includes both detailed descriptive text and several 'memory maps' with offsets and such--it also most closely matches my use case. It will vary a little for different formats, but it seems there should be some general principles that I should try to follow. Edit: I seem not to have explained very well what I want to do. Let me construct an example. I may have some old piece of software which stores its configuration in a 'binary' file--a series of bitfields, integers, strings, and whatnot all glued together and understood by the program, but not human-readable. I decipher this. I wish to document exactly what is the format of this file, in a human- readable way, as a specification for implementing a library to parse and modify this file. Additionally, I'd like this to be easily understood by other people. There are several ways such a document might be written. The PKZIP example above is very wordy and mostly describes the file format in free text. The PS2 example gives tables of value types, offsets, and sizes, with extensive comments on what they all mean. Many others, like those on XentaxWiki, only list the variable types and sizes, with little or no commentary. I ask whether there is any standard, akin to a coding style guide, which provides guidance on how to write this kind of documentation. If not, is there any well-known excellent example that I should emulate? If not, can anyone at least summarize some useful advice?


Recursion or while loops

I was reading about some development interview practices, specifically about the technical questions and tests asked at interviews and I've stumbled quite a few times over sayings of the genre "Ok you solved the problem with a while loop, now can you do it with recursion", or "everyone can solve this with a 100 lines while loop, but can they do it in a 5 lines recursive function?" etc. My question is, is recursion generally better than if/while/for constructs? I've honestly always thought that recursion is not to be preferred, because it's limited to the stack memory which is a lot smaller than the heap, also doing a great number of function/method calls is suboptimal from a performance standpoint, but I may be wrong...


Recursion VS memory allocation

Which approach is most popular in real-world examples: recursion or iteration? For example, simple tree preorder traversal with recursion:               void preorderTraversal( Node root ){         if( root == null ) return;         root.printValue();         preorderTraversal( root.getLeft() );         preorderTraversal( root.getRight() );     }      and with iteration (using stack):               Push the root node on the stack     While the stack is not empty         Pop a node         Print its value         If right child exists, push the node's right child         If left child exists, push the node's left child      In the first example we have recursive method calls, but in the second - new ancillary data structure. Complexity is similar in both cases - O(n). So, the main question is memory footprint requirement?


Are there advantages for using recursion over iteration - other than sometimes readability and elegance?

I am about to make two assumptions. Please correct me if they're wrong:   1. There isn't a recursive algorithm without an iterative equivalent.   2. Iteration is always cheaper performance-wise than recursion (at least in general purpose languages such as Java, C++, Python etc.). If it's true that recursion is always more costly than iteration, and that it can always be replaced with an iterative algorithm (in languages that allow it) - than I think that the two remaining reasons to use recursion are: elegance and readability. Some algorithms are expressed more elegantly with recursion. E.g. scanning a binary tree. However apart from that, are there any reasons to use recursion over iteration? Does recursion have advantages over iteration other than sometimes elegance and readability?


Advantage or disadvantages between recursive functions and for-loops

Whats the difference between the two procedures? When should I be using a recursive function instead of a normal for-loop?


Mapping 40 unique integers to 41 and back

This was a question proposed by a friend of mine. Define an algorithm that, given 40 unique integers in the range 1-1000, returns 41 unique integers in this range. Given these 41 integers, we must then be able to map them back to our original 40. Does anyone have any insights? I have an idea, but it definitely isn't eloquent. Thanks! EDIT: I think I may need to clarify with an example. One naive solution would be: find the largest number in the set of 40. Increment it by 1 and this is your 41st number. When converting back, just get rid of the largest number. This obviously fails when the largest number in the set is 1000.


Which is better: a bunch of getters or 1 method with a selection string parameter?

Our knowledge domain involves people walking over a pressure-recording plate with their bare feet. We do image recognition which results in objects of the 'Foot' class, if a human foot is recognized in the sensor data. There are several calculations that must be performed on the foot's data. Now, which API would be better:               class Foot : public RecognizedObject  {        MaxPressureFrame getMaxPressureFrame();       FootAxis getFootAxis();       AnatomicalZones getAnatomicalZones();            // + similar getters for other calculations            // ...     }      Or:               class Foot : public RecognizedObject {       virtual CalculationBase getCalculation(QString aName);            // ...     }      Now, there are a lot of pro's and con's I can come up with, but I can't really decide which are the most important. Note, this is an end-user application, not a software library we sell. Any advice? Some pro's for the first approach could be:   * KISS - everything is very concrete. The API, but the implementation as well.   * strongly typed return values.   * inheriting from this class is fool-proof. Nothing can be overridden, only added.   * API is very closed, nothing goes in, nothing can be overridden, so less can go wrong. Some con's:   * The number of getters will grow, as every new calculation we invent gets added to the list   * API is more likely to change, and if breaking changes are introduced, we need a new API version, a Foot2.   * in case of re-use of the class in other projects, we might not need every calculation Some pro's for the second approach:   * more flexible   * the api is less likely to change, (assuming we got the abstraction correct, if not, changing will cost more) Some con's:   * loosely typed. Needs casts on every call.   * the string parameter - I have bad feelings about that (branching on string values...)   * There is no current use case/requirement that mandates the extra flexibility, but there might be in the future.   * the API imposes restrictions: every calculation needs to derive from a base class. Getting a calculation will be forced through this 1 method, and passing extra parameters will be impossible, unless we devise an even more dynamic, super-flexible way of passing parameters which increases complexity even more.


Creating public API definition for existing application

Let's say there's a successful open source application (written in PHP if it matters), which provides its users with multiple ways to extend it (think about something like Drupal or Wordpress, lots of custom plugins, etc.). Now let's say unfortunately there's no formal definition what constitutes the public API for this application, and we want to define such a public API, so that we could a) control application development and refactoring and know we don't screw up the extensions with the next version and b) give extenders some idea what they can safely use and what they better not use. So the question is - how is it best to approach this and what should be there? For example, some specific questions:   1. Should all classes be part of public API or should we mark those are public or mark those that aren't?   2. Should protected methods be part of the API (if somebody creates derived custom class, they will be relying on it) and if so - should we be explicitly marking those that we don't want others to use, or those we're allowing to use?    3. Should public properties be part of the API too? How about protected ones?   4. If we want to make change/refactoring which can't be backwards-compatible (e.g. old API was too buggy or doesn't really fit in the app anymore), how we best approach it?   5. If we want to remove some class/method completely, what should be the process? I imagine we want to make it deprecated first, and then remove in later versions, but for example should we give some warnings when deprecated, but still existing functionality is called? The problem here is we can't warn to aggressively as it may break the application, but if we're not agressive people would ignore the deprecated mark until we remove the old API piece and then they'd get major breakage.  Any other advice is welcome too, and references for good papers/examples/etc. on the topic.


Creating bonus incentives, reward structure - For yourself

Where I work, management knows **zero** whenever it comes to programming & design. I want everyone to understand before reading the question that this is not a technical company, they are retail sales people that like the idea of custom software. I was told that they want to create a incentive structure with bonus opportunities based of what I am working on. The flip side is I need to share goals with them in detail of what I want to have completed within xx amount of time to create this reward system. I would like to set this up the correct way instead of making easily achievable goals / deadlines. As attractive as that sounds, I would like to use this as an opportunity for the company to move in the right direction whenever it comes to this department. They have had a hard time with talent fleeing in the past due to bad management, no incentives, and a poor environment. I am happy to see them trying new things for improvement down the road. We all use github for version control and offsite repositories, one developer works in rails and cakephp, I work in c# and vb. My thoughts were to base the incentives on project completions - which they wanted more detailed specifics. But they do not understand actual code, terms, etc. Example: They would think that more code is always better because it's more, instead of realizing if you lessen the code in a function it may be more efficient and easier to read. What would you do, or have you done in a similar situation?


How to implement a lightweight clustered architecture for a distributed application

I currently have a distributed application that runs on multiple embedded PCs. The whole application is composed of one master server and several nodes. Each node is an embedded PC that runs Windows 7 Embedded and has a dual core CPU with 2GB of RAM. The application (by definition) only works if the master is up and running, controlling all the nodes. The master server has a SQL Express database where it keeps information about every node it's supposed to control and how they are organized. The nodes have no persisted state. Once the master and the nodes are up and running they will be manipulated and put into a certain state which is only kept in memory at this point. The master can be controlled by a WinForm client UI that connects to it and can read its state and send commands that will change it's state (it's basically a bunch of web services exposed using .NET WCF). The state kept inside the master (in memory) is what matters. The state inside each node can be regenerated if a node restarts for example. If the master is restarted it loses its current state (and the node states as a consequence). This means after a restart of the master server the configuration will be reloaded and a 'fresh' state will be set. Typically a setup of this application consists of one master and 9 nodes (this is a 3x3 setup). At any point a node can fail and the application will continue without it (as long as the master is up). If the node that failed comes back the master detects it and put it back to the desired state. I've been asked to improve the architecture of this application so the master server can run inside one of the nodes. So instead of a 9+1 setup we will have only 9 embedded PCs with one elected to be a master. According to our tests the hardware of the node has enough power to support both the node and the master piece together. However the embedded PC can't be trusted and will fail much more often than a regular server we've used to host the master so far. Because of that I was asked to come up with a redundancy solution. It's my understanding that the proper solution would be to put two or more embedded running in clusters so if the node running the master piece fails then another one will assume it's place. **Now, the question is: how to implement a lightweight cluster that can run in those conditions?** There are two main concerns that must be solved:   1. Data Persistency: not only the configuration must be saved but also the master state. That way when the master node goes down another node can assume as master without resetting the entire state of the application.   2. WCF Clustering: at any point if the master node fails another one must assume and all connected clients (the WinForm client UI) must be able to automatically reconnect to the new re-elected master node. This doesn't have to be really transparent to the user, but the clients must be able to reconnect automatically (doesn't matter if the new IP address will be the same or not). There are several limiting factors to a possible solution:   * There is no way to have a data storage shared between the nodes (each node has it's own HD and a private gigabit network between them)   * Hardware upgrades are out of question   * The solution have to be light enough so it runs on a embedded PC. So installing a cloud server or a clustered DB probably won't be fast enough (if you think MySQL clustered will work to solve the data layer, I'll be interested in hearing your thoughts)   * The solution can't involve buying an expensive piece of software   * The overall platform of this application must be Windows based The best solution I thought so far was to use something like Prevayler to keep the master state persisted and then implement a sync of every command the master received into the other nodes. That will solve the persistence problem across all nodes (maybe something similar can be implemented using memcache, I'm not sure). I have no solution yet to solve the WCF service problem. Because this will involve a huge lot of development and proper testing I thought I should hear from you guys before implementing anything. I think a solution could be put together either by using a framework or some sort of open source software that solves part of the problem. Please feel free to ask anything so I can improve the text of this question to make it more clear.


Is this considered repeating code?

C#/ASP.net:               /// <summary>     /// Is a group in the basket already?     /// </summary>     public static bool isItemInBasket(List<BasketItem> BasketItems, int GroupID)     {         return BasketItems.Where(c => c.GroupID == GroupID).SingleOrDefault() != null;     }     public static bool isItemInBasket(List<BasketItem> BasketItems, int GroupID, DateTime ArtworkDate)     {         return BasketItems.Where(c => c.GroupID == GroupID && c.ArtworkDate == ArtworkDate).SingleOrDefault() != null;     }      Some people I spoke to consider this to be repeating code, whereas I don't consider it to be repeating essentially because the repeating code are all things you would have to pass to a method anyway if you wanted to adopt another technique. I don't think it's possible this can be simplified, or broken up into a more simplified version any further, therefore it's not repeated code. Is this a reasonable thing to say?


How do I handle refactoring that takes longer than one sprint?

I work with a code base that is over 500K lines of code. It is in serious need of refactoring. There have been refactoring efforts identified that will take longer than the normal two week sprint. These can't be broken up into smaller tasks as I have seen suggested in other answers on this site. The product needs to work at the end of the iteration, and partial refactoring will leave the system in an unusable state as the dependency between items is horrible. So what would be the best way to approach this hurdle? Again I mention, breaking it down into smaller pieces is is not an option, that has already been done. Update: People seem to need an explanation of why this can't be fit into a 2 week sprint. There is more involved in a sprint than just writing code. We have a policy of no code without tests. That policy did not always exist and a large portion of the codebase does not have them. Also some of our integration tests are still manual tests. The issue is not that the refactoring itself is so large. It is with the fact that small changes have an effect on many parts of the system, and we need to ensure that those parts still operate correctly. We can't put off or extend a sprint because we have monthly hotfixes. So this change extending past a sprint cannot stop the other work being added to the hotfix. Refactoring vs Redesign: Just because our development process is not efficent enough to handle this refactoring in a two week cycle does not warrant renaming it to a redesign. I would like to believe that in the future we could accomplish the exact same task within a two week cycle as our process improves. The code in question here has not had to change in a very long time, and is quite stable. Now, as the direction of the company is becoming more adaptable to change, we want this portion of the code base to be as adaptable as the rest. Which requires refactoring it. Based on the answers here, it is becoming apparent that there is missing scaffolding necessary to make this refactoring work in the time frame of normal sprints. Answer: I am going to do the branch and merge approach that Corbin March suggested the first time so we can learn more about these problem areas and how to identify the missing tests. I think moving forward, we should take the approach that Buhb suggested of identifying the areas that are missing tests and implement those first, then do the refactoring. It will allow us to keep to our normal two week sprint cycle, just like many here have been saying should always be the case for refactoring.


Is displaying an HTML email a security risk?

I am writing a simple webmail where I want (obviously) to display the emails. I'm wondering if I should take any precaution while displaying HTML emails: is dumping the email content into a `<div>` a security risk? I'm guessing that yes since the email could contain anything (could it contain Javascript?). But then how should I proceed? How do other webmails do? I'm thinking that stripping dangerous HTML tags would be a bad solution since it's impossible to think of all the cases.


Approach for developing software that will need to be ported to multiple mobile platforms in the future

I am currently doing the preliminary design for a new product my company will be pushing out soon. We will start on Android, but then we will need to quickly develop the IPhone, IPad.... and then the Windows 8 ports of the application. Basically the only code that wouldn't be reusable is the view specific code and the multimedia functions. This will be an SIP client (of course the user of the app will not know this) with several bells and whistles for our own business specific purposes. My initial thought is to develop all of the engine in C and provide a nice API for the C library since JAVA and .NET will allow native invoking, and I should just be able to directly link to the C lib in objective-C. Is there a better approach for vast code reuse which also remains close to the native platform? I.e. I don't want dependencies such as Mono-droid and the like or complicated interpreter/translator schemes. I don't mind re-coding the view(s) for each platform, but I do not want to have multiple versions of the main engine. Also, if I want to have some good abstraction mechanisms (like I would in say, C++) is this possible? I have read that C++ is not allowed for the IPad and Iphone devices. I would love to handle the media decoding in the C library, but I assume that this will be platform dependent so that probably will not be an option either. Any ideas here?


Does following Agile methodology contradict programmers should have quiet working conditions (one of the Joel test)?

My organization is moving to Agile process of software development. As part of it, the developers and quality engineers will sit together with the cubicle walls scaled down. I am just wondering how does it satisfy one of the Joel's test - **programmers should have quiet working conditions**. Does it not contradict it? If yes, is it taken as granted while adopting Agile ?


Studies on how noise affects productivity of programmers

Does anyone have any links to studies that show how noise affects the productivity of programmers? Specifically I would like to see how/if productivity rises when noise levels decrease. As pointed in comments, the nature of the programming workflow is such that you go in and out of focus all the time -- so it's likely to be affected by noise differently than other lines of work. The reason I think that this is programmer specific is that I am also interested in mathematics. In a noisy place, if I start thinking about maths, the noise goes away and I find myself lost in a world of pictures. In fact my favourite place to do maths was always The Copper Kettle cafe, a busy tourist place. For programming it's completely different. While programming I'm usually thinking verbally, and any talking whatsoever destroys my train of thought. I'm literally incapable of programming anywhere where there is audible conversation. I've talked to other programmers who don't even notice noise that disables me, and they say that they think mainly in pictures. Which is why I'm wondering whether there are any actual academic studies into whether programming is particularly noise-affected compared to say maths or lawyering.


What does it mean that StAX parsers aren't complete or correct?

I've been browsing the net and found theses two slides on site of XOM (XML object model):   * slide1   * slide2 Where they refer to SAX(push) and StAX(pull) parsers. So I'm wondering, what does it mean that a StAX parser isn't complete or correct in practice?


Efficient way to sort large set of numbers

I have to sort a set of 100000 integers as a part of a programming Q. The time limit is pretty restrictive, so I have to use the most time-efficient approach possible. My current code -               #include<cstdio>     #include<algorithm>     using namespace std;          int main() {         int n,d[100000],i;         for(i=0;i<n;++i) {                          scanf("%d",&d[i]);         }         sort(d,d+n);         ....     }      Would this approach be more efiicient?               int main() {         int n,d[100000],i;         for(i=0;i<n;++i) {                          scanf("%d",&d[i]);                          sort(d,d+i+1);         }         ....     }      What is the most efficient way to sort a large dataset? Note - Not homework...


How Visual Studio could help to avoid duplicating code?

I work within a team of developers. Everyone is making their changes without carrying too much if the same thing is already implemented in the codebase. This leads to classes constantly growing and to severe duplication. I want to add line items to class definitions from which a developer could judge what this class has.   * Would it help?   * How to do it in Visual Studio?   * If it wouldn't help, what would be the better alternative to encourage the developers to check if something exists before implementing it?


How to find out if a tile is being covered by a polygon?

Given a (intersecting) polygon, I'd like find out which tiles are being covered by the polygon. **Example** : ![example](http://i.stack.imgur.com/xpNvv.png) **Details** :   * Tiles are square, 1 unit wide/high   * The grid begins in (0,0)   * The corners of the polygon can have floating point coordinates (i.e. 3.433, 5.234)   * In general, an edge of the polygon might be as long as 1000 - 10000 tiles I tried to iterate over all tiles and check whether they are in the polygon, however as I have to iterate over 10000² tiles it takes a quite a long time. I'm interested in a solution which allows me to quickly answer "Is tile (x,y) covered by the polygon?" without recomputing everything from scratch for each question. Any solution/approach/pseudo-code/hint which leads me to a correct solution will be accepted.