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

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


What licence should I use for internal projects?

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


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

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


TDD negative experience

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


Does a mature agile team requires any management?

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


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

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


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

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


Generators in Javascript into the new ECMA standard

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


How to visualize timer functionality in sequence diagram?

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


How to get better at solving Dynamic programming problems

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


Software Transactional Memory - Composability Example

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


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

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


Understanding Package Management Systems

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


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

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


Diagrams used to model the architecture and functionality of a website

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


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

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


Should a complex unifying class be doing computation?

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


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

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


Where do you have your Control key?

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


How would I access trac on mobile phone?

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


The best way of coding web system in term of performance

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


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

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


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

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


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

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


Tricky compareTo, inheritance, easy to extend - Java

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


An application to get statistical data about HTTP Request/Response

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


PHP programming in iPad

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


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

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


Computer Science and other advance topics taught in javascript

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


Is there a standard pseudocode for parallel algorithms?

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


Should we embed virtual machines rather than languages

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


Conditions for a traditional friends system vs. open following system

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


Keeping Backbone model in sync with editable view

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


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

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


How does one start mocking up a mobile app?

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


How can I influence my team to become more agile

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


Stroustrup and the C++ complexity admission

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


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

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


What should be in a coding standard?

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


What should I do in AJAX or PHP?

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


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

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


Should I pass an object or values?

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


Git workflow - advise a newbie

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


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

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


What is the best "bucket-fill" algorithm?

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


Should Properties have side effects

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


Team work and agile development

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


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


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

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


Control Flow of php

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


Why is Windows registry needed?

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


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

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


Statistics collection engine for C++ systems

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


How to organise Website CSS

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


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

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


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

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


Frontend vs Backend data handling

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


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

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


Could developers learn anything from studying malware?

Malware uses interesting techniques for hiding themselves from anti-malware software and more. They can "polymorph" themselves: practically change the code while it continuing to mean pretty much the same to the executing machine, making antivirus definitions invalid etc. I wonder if there is anything (non-malicious) developers could learn from studying the source of such, or reversing them and studying whatever you get from that process if the source isn't available, that could be useful outside this (dark?) realm. **I am _not_ interested in writing malware.** (at least not for non- educational purposes) This question isn't meant to be a question about how to write malware or such, but what you could learn from already written malware. Also, maybe a bit unethical (I hope not), would there be any gains from writing your own piece of malware, just for better understanding of vulnerabilities/exploits/security, or the underlying operating system?


Comparing features in a asp.net web application using different database methodologies

I have a webstore which sells components (it is a academic project) which looks like this. I have developed the same web application using following database methodologies:   1. MS Sql Server with Stored procedures and sql data reader   2. LINQ to Sql   3. DB4o using LINQ (Client/Server) What features can I compare apart from the technical and theoretical details between relational database and object oriented database ? It is my graduate/master's thesis final project. I want the features that i want to compare to be more practical and interesting so that I can draw some concrete and meaningful conclusions rather than abstract comparisons which don't create much interest and hard for inference. Please help me.


Private Repository Management for Potential Employers

I have some projects that I do not wish to be viewed publicly (some of them are school course work), but I want to show them to my potential employers. Ideally, I would be able to generate some bit.ly-like links that expire after certain period. I am guessing I can do this with Dropbox's public link where I put the link to the code on the resume and then I delete the folder after some time via `crontab`, but I am wondering if there are better options. I do have accounts on github and bitbucket.


Tips for a solo programmer's resume

**Short version:** I've been a solo programmer for 5 years, right out of school, and am looking to for resume tips as I aim to get a job with a larger, well structured company. **Long version:** I am a 26 year old who graduated in CS in 2007. I had an internship for a small company starting in 2006, and still work for them to this day. I'm looking to work for a larger company for reasons beyond the scope of this post. During this time I was the only programmer, and designed/coded/maintained four .NET applications for various industries. Those four projects kept me very busy. My applications have happy customers, they work well and look nice. I realize that being a solo developer has given me some strengths and some weaknesses compared to my peers.   * My strengths are that I can self educate well, and I've suffered the consequences of mistakes firsthand, so I can give VERY good reasons why I do things the way I do.   * My weaknesses are that I've lacked a mentor, and the missed opportunities to learn from him/her. I also lack team work with programming. I worked closely with other technical people, and had my own SVN/TFS servers, but never worked closely with other programmers, delegated orders, or really had a specific role other than "do everything." I realize that the teamwork is a crucial component of a mature developer. So now, some questions about a resume and/or interview:   1. Should I be up front about being on a lonely island of programming so long?   2. When listing my projects in a resume, since I was a solo dev should I describe the projects in great detail, and say that I did everything rather than say "I did xxx, yyy, zzz"?   3. My current employer has web pages with videos/screenshots of my software in action, should I link to them?   4. Do you think my strengths make up for my weaknesses and leave me > 0?   5. Any other tips?


When is it okay to reassign the model for a view in MVC?

Is it ever really acceptable to reassign the model for a view in MVC? (Or MV* where applicable.) In other words, for a single view instance, is it ever ok to reassign the view's model? That is, as opposed to using setters (mutators) on the model so that it does not have to be reassigned. Under what conditions (if any) is this acceptable MVC design? Here is an example in JavaScript, but the question is language-agnostic.               var Model = function (m) {         var message = m;         return {             getMessage: function () {                 return message;             },                  setMessage: function (m) {                 message = m;             }         };     };          var View = function (m) {         var model = m;         return {             render: function () {                 alert(model.getMessage());             },                  setModel: function (m) {                 model = m; // hmm, is this okay?             }         };     };          var model1 = new Model('hello world');     var view = new View(model1);     var model2 = new Model('hi there');     view.render();     view.setModel(model2); // reassign model     view.render();     model2.setMessage('hi again'); // mutate model via setter     view.render();      In the line `view.setModel(model2);`, the model is reassigned (the approach in question). In the line `model2.setMessage('hi again');`, the model is instead mutated via its own setter, which in my view seems generally preferred. One of the main drawbacks I can see to model reassignment is that it could complicate attempts to reuse the model elsewhere in the application. In some MVC applications a single shared model could be used to drive multiple views (e.g. list, editor, and display views of the same data), in which case model reassignment would be problematic -- it would at least require the added complexity of communicating the model reassignment to dependent views. Here I think the DRY principle trumps the no-mutators principle. (Open to argument here.) Can an even stronger case be made? To recap, under what circumstances might model assignment be acceptable, if any? Perhaps in certain languages, under extreme performance constraints...? Is _"do not reassign models"_ a good rule of thumb? A pointer to an authoritative source or real-world situation would be helpful.


What is the wireframe of a project?

What is the actual meaning of a wireframe of a project?


How can I design my classes to include calendar events stored in a database?

I'm developing a web calendar in php (using Symfony2) inspired by iCal for a project of mine. At this moment, I have two classes: a class "Calendar" and a class "CalendarCell". Here you are the two classes properties and method declarations.               class Calendar     {         private $month;         private $monthName;         private $year;         private $calendarCellList = array();         private $translator;              public function __construct($month, $year, $translator) {}                             public function getCalendarCellList() {}              public function getMonth() {}              public function getMonthName() {}              public function getNextMonth() {}              public function getNextYear() {}              public function getPreviousMonth() {}              public function getPreviousYear() {}              public function getYear() {}              private function calculateDaysPreviousMonth() {}              private function calculateNumericDayOfTheFirstDayOfTheWeek() {}              private function isCurrentDay(\DateTime $dateTime) {}              private function isDifferentMonth(\DateTime $dateTime) {}     }          class CalendarCell      {         private $day;         private $month;         private $dayNameAbbreviation;         private $numericDayOfTheWeek;         private $isCurrentDay;         private $isDifferentMonth;         private $translator;              public function __construct(array $parameters) {}              public function getDay() {}              public function getMonth() {}              public function getDayNameAbbreviation() {}              public function isCurrentDay() {}              public function isDifferentMonth() {}     }      Each calendar day can includes many calendar events (such as appointments or schedules) stored in a database. My question is: which is the best way to manage these calendar events in my classes? I think to add a eventList property in CalendarCell and populate it with an array of CalendarEvent objects fetched by the database. This kind of solution doesn't allow other coders to reuse the classes without db (because I should inject at least a repository services also) just to create and visualize a calendar... so maybe it could be better to extend CalendarCell (for instance in CalendarCellEvent) and add the database features? I feel like I'm missing some crucial design pattern! Any suggestion will be very appreciated!


What should take precedence: YAGNI or Good Design?

At which point should YAGNI take precedence against good coding practices and vice versa? I'm working on a project at work and want to slowly introduce good code standards to my co-workers (currently there are none and everything is just kind of hacked together without rhyme or reason), but after creating a series of classes (we don't do TDD, or sadly any kind of unit testing at all) I took a step back and thought it's violating YAGNI because I pretty much know with certainty that we don't require the need to extend some of these classes. Here's a concrete example of what I mean: I have a data access layer wrapping a set of stored procedures, which uses a rudimentary Repository-style pattern with basic CRUD functions. Since there are a handful of methods that all my repository classes need, I created a generic interface for my repositories, called `IRepository`. However, I then created a "marker" interface (i.e. interface that doesn't add any new functionality) for each type of repository (e.g. `ICustomerRepository`) and the concrete class implements that. I've done the same thing with a Factory implementation to build the business objects from DataReaders/DataSets returned by the Stored Procedure; the signature of my repository class tends to look something like this:               public class CustomerRepository : ICustomerRepository     {         ICustomerFactory factory = null;              public CustomerRepository() : this(new CustomerFactory() { }              public CustomerRepository(ICustomerFactory factory) {             this.factory = factory;         }                    public Customer Find(int customerID)         {             // data access stuff here             return factory.Build(ds.Tables[0].Rows[0]);         }     }      My concern here is that I'm violating YAGNI because I know with 99% certainty that there is never going to be a reason to give anything other than a concrete `CustomerFactory` to this repository; since we don't have unit tests I don't need a `MockCustomerFactory` or similar things, and having so many interfaces might confuse my co-workers. On the other hand, using a concrete implementation of the factory seems like a design smell. Is there a good way to come to a compromise between proper software design and not overarchitecting the solution? I'm questioning if I need to have all of the "single implemenation interfaces" or if I could sacrifice a bit of good design and just have, for example, the base interface and then the single concrete, and not worry about programming to the interface if the implementation is that will ever be used.


Effective team meetings

I'm a team leader of a team of 8 programmers in a company of about 20 technical people. They're working on a range of projects, these projects also involve people from other teams that are outside of my control. My organisation is not doing proper agile development, and they're somewhat resistant to change, but I've been holding daily stand up meetings within my team and we've all been finding them useful and everyone is engaged and we're done within 10-15 minutes. I also have weekly individual catch ups with every team member where we discuss various general topics (both technical and non- technical) in more detail, as well as various ad-hoc topical meetings. What I've been struggling with, however, is my weekly team meeting. It is losing steam and I have not been able to keep people interested. I still want to hold a longer meeting, even if it has to be fortnightly or monthly. The purpose was to discuss various topics that cannot be done during a stand up meeting because they require more time. Updates from me include a summary on every current project that they're working on (whether it is on schedule, various delays, etc), any changes in direction, future projects, changes to development process, etc. However, it ends up being a lecture from me, and at least 2 people are obviously zoned out and the rest are at most mildly interested. I tried getting people to be more engaged by getting them to talk about their week, but with 8 people it takes a long time and (partly because a lot of their work does not cross over all that much), most of the rest team does not care what their co-workers have been working on in more detail (they get a high level overview during stand ups). So, during these meetings, at least some people are very bored, and it is almost embarrassing for me to keep holding these. It is a stark contrast to our energised morning stand up meetings. Any advice on what I can do to keep people more engaged and more interested? And how can I get them to present things on their or start discussions that involve everyone instead of it being a monologue from me?


Notation for the average time complexity of an algorithm

What notation do you use for the **average** time complexity of an algorithm? It occurs to me that the proper way would be to use big-theta to refer to a set of results (even when a specific try may differ). For example, average array search would be Θ(n+1)/2. Is this right? Explanation of average search time being Θ(n+1)/2: Given that the access time sum for the n first integers is n(n+1)/2, the average time for a large number of random access to the array will be (n(n+1)/2)/n = (n+1)/2. In this case I would say that Θ(n+1)/2 will be the average access time. It makes sense (to me) but since I'm new to asymptotic notation (and programming in general), I'd like to know if this is common practice. I'm asking because I'm confused to see big-O being used for everywhere in pages like http://bigocheatsheet.com. eg: average case of array search O(n).


How can a server initiate request in SIP protocol?

Either a client or a server can initiate request in SIP. How is it possible? How will the server know about the client?


What is the value of checking in failing unit tests?

While there are ways of keeping unit tests from being executed, what is the value of checking in failing unit tests? I will use a simple example: Case Sensitivity. The current code is case sensitive. A valid input into the method is "Cat" and it would return an enum of Animal.Cat. However, the desired functionality of the method should not be case sensitive. So if the method described was passed "cat" it could possibly return something like Animal.Null instead of Animal.Cat and the unit test would fail. Though a simple code change would make this work, a more complex issue may take weeks to fix, but identifying the bug with a unit test could be a less complex task. The application currently being analyzed has 4 years of code that "works". However, recent discussions regarding unit tests have found flaws in the code. Some just need explicit implementation documentation (ex. case sensitive or not), or code that does not execute the bug based on how it is currently called. But unit tests can be created executing specific scenarios that will cause the bug to be seen and are valid inputs. > What is the value of checking in unit tests that exercise the bug until > someone can get around to fixing the code? Should this unit test be flagged with ignore, priority, category etc, to determine whether a build was successful based on tests executed? Eventually the unit test should be created to execute the code once someone fixes it. On one hand it shows that identified bugs have not been fixed. On the other, there could be hundreds of failed unit tests showing up in the logs and weeding through the ones that should fail vs. failures due to a code check-in would be difficult to find.


Does a web application have to live in a browser to be called a web application? Or is a thin client that uses a web service for most of it's functionality a web applicaiton?


Is OAuth suitable for this scenario?

I need to create a simple web application for track expenses, with some basic actions (user must be able to create an account and log in, list expenses, edit them, etc) with a REST API for each one, and the trick is that I need to be able to pass credentials to both the webpage and the API. So, after some research I've found some examples using Digest Authentication and HMAC Authentication but lot of posts also mentioned OAuth as an alternative approach, so my question is, given this scenario, would be proper to use OAuth? I mean, as far as I understand OAuth is suitable when you want to share resources with other application, which I'm not doing for this project; besides that, when you try to access the shared resource it appears a page requesting permission for the foreign application, would that page appear at some point in my application? (maybe after the login?) In case OAuth wouldn't be suitable, is there any other option besides Digest authentication and HMAC authentication?


What parameters to use to compare GUI frameworks / toolkits?

I'm doing some research on the best GUI toolkit to use for future products at the company. We're talking about a fairly large organizations with quite a bit of code and a complete rewrite project in planning. Don't ask. Anyway, I'm trying to create a list relevant parameters to judge the toolkits. What would you use to drive the comparison? Here's what I've got so far:   * Maturity   * Ease of development   * Ease of prototyping   * Ease of maintenance   * Size of hiring pool   * Available knowledge at the company   * Training costs   * Community size   * Community level of expertise (how hard to find good answers to complex problems)   * Amount of expert-level books available   * Ability to interface to other technologies   * Deployment considerations   * Visual aesthetics   * Ability to access OS resources   * Multiple monitor support (something that might come in handy in our particular application)


the future of commercial products

I'm seeing that the open source solutions are growing rapidly & many companies use them now. What do you think the future for commercial products or solutions will be?


Style and recommendations of commenting code

I want to hear from you any advice and experience of writing comments in your code. How do you write them in the most easy and informative way? What habits do you have when commenting parts of code? Maybe some exotic recommendations? I hope this question will collect the most interesting advices and recommendations forcommenting, something useful that everyone can learn from. OK, I will start.   1. Usually, I don't use `/* */` comments even when I need to comment many lines. **Advantages** : code visually looks better than when you mix such syntax with one-line comments. Most of IDEs have an ability to comment selected text and they usually do it with one-line syntax. **Disadvantages** : Hard to edit such code without IDE.   2. Place "dot" in the end of any finished comment. For example:              //Recognize wallpaper style. Here I wanted to add additional details     int style = int.Parse(styleValue);     //Apply style to image.     Apply(style);      **Advantages** : Place "dot" only in comments that you finished. Sometimes you can write temporal information, so lack of "dot" will tell you that you wanted to return and add some additional text to this comment.   3. Align text in the enumerations, commenting parameters etc. For example:              public enum WallpaperStyle     {         Fill = 100,     //WallpaperStyle = "10"; TileWallpaper = "0".         SizeToFit = 60, //WallpaperStyle = "6";  TileWallpaper = "0".         Stretch = 20,   //WallpaperStyle = "2";  TileWallpaper = "0".         Tile = 1,       //WallpaperStyle = "0";  TileWallpaper = "1".         Center = 0      //WallpaperStyle = "0";  TileWallpaper = "0".     };      **Advantages** : Just looks better and visually more easy to find what you need. **Disadvantages** : Spending time to align and harder to edit.   4. Write text in comment that you can't obtain by analyzing code. For example, stupid comment:              //Apply style.     Apply(style);      **Advantages** : You will have clear and small code with only useful information in comments.


Right mix of planning and programming on a new project

I am about to start a new project (a game, but thats unimportant). The basic idea is in my head but not all the details. I don't want to start programming without planning, but I am seriously fighting my urge to just do it. I want some planning before to prevent refactoring the whole app just because a new feature I could think of requires it. On the other hand, I don't want to plan multiple months (spare time) and start that because I have some fear that I will lose my motivation in this time. What I am looking for is a way of combining both without one dominating the other. Should I realize the project in the way of scrum? Should I creating user stories and then realize them? Should I work feature driven? (I have some experience in scrum and the classic "specification to code" way.) **Update** : How about starting with a "click dummy" and implementing the functionality later?


What is the recommended learning path for PHP and Javascript?

For a couple of months now I have been wanting to learn Javascript and PHP but the lack of time didn't give me that opportunity. I'm in a position that have enough time to learn only one language and practice it or both in a row without doing any practice for about 1-2 months except the code in the books. I have a bit of Java programming background and have built 3 applications in Java , so I'm not totaly new when it comes to programming, but I can't say I'm at an intermediate level. I also have some experience with jQuery, which by the way I recently realised it was a mistake to learn jQuery before Javascript and XHTML/CSS. These are the recources that I am planning to read for both of them: Javascript:   1. Getting Good with JavaScript   2. Professional JavaScript for Web Developers 3rd Edition   3. JavaScript 24-Hour Trainer   4. Javascript Patterns   5. JavaScript: The Good Parts PHP:   1. PHP Solutions Dynamic Web Design Made Easy 2nd.Edition   2. PHP and MySQL Web Development 4th Edition   3. Oreilly PHP Cookbook 2nd Edition These were the resources that were recommended to me by a friend to fully grasp these two technologies exactly in that order and these are the ones I plan to read in the time that I have in the summer. If there is anything you would like to add please feel free to tell me. I am committed to learning them both to their full potential. So what I want to ask if it is appropriate to try and learn PHP immediately after learning Javascript or should I stick just to one of them until I learn it better and move to the other after?


How to do documentation for code and why is software (often) poorly documented?

There are some good examples of well-documented code out there, such as java api. But, a lot of code in public projects such as git and internal projects of companies is poorly documented and not very newcomer friendly. In all my software development stints, I have had to deal with poorly documented code. I noticed the following things -   1. Little or no comments in code.    2. Method and variable names are not self describing.    3. There is little or no documentation for how the code fits into the system or business processes.    4. Hiring bad developers or not mentoring the good ones . They can't write simple and clean code. Hence its difficult or impossible for anyone, including the developer to document the code. As a result, I have had to go through a lot of code and talk to many people to learn things. I feel this wastes everyone's time. It also creates the need for KT/Knowledge transfer sessions for newcomers to a project. I learned that documentation is not given the attention it deserves because of the following reasons:   1. Laziness.    2. Developers don't like to do anything but code.    3. Job security. (If no one can understand your code easily, then you might not be easily replaceable.)    4. Difficult deadlines leave little time to document.  So, I am wondering if there is a way to encourage and enforce good documentation practices in a company or project. What are the strategies to be used for creating decent documentation for the systems and code of any project, regardless of its complexity ? Are there any good examples of when minimal or no documentation is needed ? IMHO, I feel that we should have a documentation review after a project is delivered. If it is not simple, concise, illustrative and user friendly, the developer or technical documentation engineer own the responsibility for it and be made to fix it. I neither expect people to make reams of documentation, not hope that it will be user friendly like the head first books, but I expect it to eliminate the need for hours of analysis and wasteful KT sessions. Is there a way to end or alleviate this madness ? "Document driven development" perhaps ?


Understanding the stateless internet

I'm transitioning from being a desktop developer to a web developer, and I'm having trouble understanding why HTTP is stateless. What are the reasons for it? What are some ways a desktop developer like myself can make the transition to a stateless development environment?


As a Junior Software Engineer should I say that something has been done wrong if I feel so?

I recently joined a company and it is my first job. When reading the code base, I felt that the code was not well written. It seemed to me that the code had most of the problems mentioned here and also seemed to have an Anemic Domain Model. There are no unit tests and they don't employ any code quality checking tools like findbugs or pmd. The problem I have is that the code is very difficult to understand. Maybe my conclusions are wrong because I am not that experienced. I need advice on whether to communicate the above facts to a superior or not. If I am to communicate, to whom(Tech Lead, Architect, Product Manager) and how? And if I do communicate will they take it badly since I'm a Junior and has no experience?


Licensing question regarding no derivatives

I am working on a project where I'd like these licensing terms:   * Allow unmodified redistribution, with attribution to the author   * Disallow modified redistribution   * Non-commercial use Now the CC BY-NC-ND 4.0 license is perfect for this... however, it does not cover any software topics, and CC themselves say that you shouldn't really use the CC licenses for software projects. So what should you use in a case like this instead? LGPL comes close, but it does allow commercial use. Standard copyright, without a license, also comes close again, but allows commercial use while disallowing redistribution. BTW, I understand you guys aren't lawyers. But you might have experience with licensing to know what kind of license you should be looking for with my needs.


When using the Apache license, is there still a need for a Contributor License Agreement (CLA)?

I can certainly see the need for CLAs with a terser license like MIT or BSD, but the more verbose Apache seems to already have that type of verbiage in it. I would prefer to not add this level of complication an open source project if it is not necessary with the Apache 2.0 license. CLAs seem to primarily grant a copyright license and a patent license from the contributor to the project, both of which are already in the text of the Apache 2.0 license (sections 2 and 3). If I am using the Apache license, do I really need to also add the extra requirement for contributors to sign a CLA? I basically want to get the general benefits of a CLA (like the non-ambiguous right to relicense, though the contributor maintains ownership) without making contributors fill out a bunch of information and sign a contract in some third-party form. Doesn't the act of cloning a repository, modifying code, and sending a pull request indicate agreement to the terms of the associated license? Section 5 of the Apache 2.0 License explicitly states that contributions shall also be under Apache 2.0: > **Submission of Contributions** : Unless You explicitly state otherwise, any > Contribution intentionally submitted for inclusion in the Work by You to the > Licensor shall be under the terms and conditions of this License, without > any additional terms or conditions. Notwithstanding the above, nothing > herein shall supersede or modify the terms of any separate license agreement > you may have executed with Licensor regarding such Contributions. When combined with Sections 2 & 3 regarding grant of copyright license and patent license "...to reproduce, prepare Derivative Works of, sublicense..." it would seem that Apache 2.0 already covers the project's bases regarding submissions. Or am I misunderstanding a possible difference between a "sublicense" and actually changing the license of the project? (Since the Open Source Licensing Q&A site is still a just a proposal, I will accept IANAL answers here.)


Can the GitHub pull request process constitute an electronic signature of a CLA?

I appreciate the need for a Contributor License Agreement (CLA) in open source software projects and even understand that some tools are starting to make this process easier (like the low-friction CLAHub for GitHub and Project Harmony). However, rather than requiring a third-party form submission for an electronic signature, would adding an extra sentence and the CLA itself to CONTRIBUTING.md, which GitHub links to when a contributor files a pull request (displayed as "Please review the guideline for contributing to this repository"), allow for a valid electronic signature (e.g. "Submitting a pull request to this repository on GitHub with your name and email constitutes your agreement to and electronic signature of the following Contributor License Agreement...")? Perhaps that argument hinges on the definition of "electronic signature" (ESIGN, UETA, etc.): > **"Electronic signature"** means an electronic sound, symbol, or process > attached to or logically associated with a record and executed or adopted by > a person with the intent to sign the record. And I would like to propose that the GitHub pull request "process" is "logically associated" with the CONTRIBUTING.md/CLA "record" and that the contributor has the "intent to sign" by adopting the process... (Since the Open Source Licensing Q&A site is still a just a proposal, I will accept IANAL answers here.)


Apps for facilitating live code demos?

I really enjoy watching live code demos, especially when time is focused on what the code is doing instead of what the presenter is typing. Many seem to be using apps to manage their clipboard to paste code into the IDE. What apps are out there for skillfully managing your clipboard to seamlessly do a code demo? UPDATE: I found this app that Apple engineers use called _DemoMonkey_. It's actually an OS X app demo for, ironically enough, the clipboard and system services. The link includes the source so creating a PC equivalent would be easy, is there really nothing out there?


What is the ettiquite for releasing a Perl module based on someone else's module?

I have written a Perl module by starting with an existing Perl module of related functionality and modifying heavily. In fact, acccording to git blame I have changed (or created) every line of non-biolerplate code in the module. Of course, I have also changed the name of the module, so if I uploaded it to CPAN, it would not directly conflict with the original module. Anyway, despite my heavy modifications, the module is still conceptually based on its predecessor, and I would like to give credit to its authors. However, I can see how they might not appreciate having their names and emails slapped on what appears to be a new module without their knowing. So should I just put myself as the sole author and put the original module's authors in an "Acknowledgements" section? What is the best way to credit the original authors in my module?


What is "swarming"?

I've heard **swarming** mentioned in the context of Agile or Extreme Programming. It seems to be a complement to pairing. What exactly is it? When should it be applied? How do you do it well?


Is unconditional code considered a branch?

Having simple code like this:               int A=5;     object X=Console.ReadLine()     if(Condition)        DoSomething();     else        DoStuff();     DoSomethingElse();      Some sources say there are actually 4 branches: First unconditional, two for the IF and another unconditional after the IF statement. Some say there are only two branches. What would be correct? E.g. here: http://www.ruleworks.co.uk/testguide/BS7925-2-Annex-B7.asp


Where would I typically use a Deque in production software?

I'm fairly familiar with where to use Stacks, Queues, and Trees in software applications but I've never used a Deque (Double Ended Queue) before. Where would I typically encounter them in the wild? Would it be in the same places as a Queue but with extra gribbilies?


What is the Bible of Hashing?

Is there a Cormen-like reference on Hashes and Hashing? This particular structure has seen little attention in my CS education for some reason but I'd like to learn more as they seem to be everywhere. I know Cormen covers it but I'm looking for something more specialized and in-depth.


Why does the add() method of a Linkedlist return true in Java?

Why does the `add` method of a Linkedlist return true in Java? http://docs.oracle.com/javase/1.5.0/docs/api/java/util/LinkedList.html#add(E) Why not just make it a void method? I know it says "per the general contract of Collection.add", but why doesn't this contract/interface make `add` a void method?


Why do people consider Python a weak language?

I've been using Python for a little while now and I am enjoying it, but a few of my friends are telling me to start using a language like C# or Java instead and give these reasons:   1. Python is a scripting language   2. Python apps don't port well to people who don't have Python   3. It's hard to make good GUIs in Python since it's a scripting language I like the batteries included approach to Python and the ability to download and upload pre-built modules from PyPI is really useful to me. Is there any specific reason why Python is considered a weak language?


Naming a release

OS X 10.9 not just called 10.9 but also Mavericks. iOS7 is just called iOS7. Android releases are named after sweets. What is the rationale of giving a name to a release version?   What are the benefits if any? Most apps simply increment the number as they push new releases. Is naming a release (Mavericks, Kit kat etc...) just for marketing purpose?


Why .NET and C# are not available on Cloud Platforms?

I checked Google App Engine and Heroku but both don't support .NET/C# applications. Even though Google App Engine shows support for Windows Azure, but in the supported languages it doesn't show C# or VB. Is .NET not supported on Cloud Platform?


Show your customers your roadmap

I read a while ago an article about "Managing Expectations" and I ask myself, is it a good or bad idea to share your roadmap with your customers? In your experience, what are the pros and cons of doing this?


What is "lambda" code?

I have recently heard people talk about code being "lambda". I have never heard of this phrase before. What does it mean?


Where Are Multiple JUnit Test Methods Typically Placed in Code?

I've just read the Vogella JUnit tutorial and found it very helpful in understanding how to use JUnit. However, I'm a bit confused about what the convention is for placing multiple test methods in code. The tutorial only places one test method in a class, then describes how you can use a test suite to group multiple test classes together. Does this mean that it's common practice for each test class to only have one test method and then test suites are used to chain them together? Or was that just unintended and instead common practice is to put multiple test methods in a class?


Enterprise scalable vs internet scalable, what is the meaning & differences?

While reading about Java EE applications, somewhere I have seen people saying they're enterprise scalable, I am confused as to what that really mean? Are Java web applications mainly written & suitable for building enterprise management tools, not for the high traffic websites of today's world, that need to scaled to a large internet population?


How do you organize your MVC framework while supporting modules/plugins?

There are a two main codebase structures that I have seen when it comes to MVC frameworks. The problem is that they both seem to have an organisational bug that goes with them. **Standard MVC**               /controller     /model     /view      _Problem: No separation of related components (forum, blog, user, etc..)_ **Modular MVC**               /blog         /controller         /model         /view     /user         /controller         /model         /view     /forum         /controller         /model         /view      Picking the module-based system leaves you with a problem.   * Long names (Forum_Model_Forum = forum/model/forum.php) (Like Zend)   * File system searches using `is_file()` to find which folder has the forum model? (Like Kohana) **Are their any other MVC structures that work well when trying to separate different modules?** Are there benefits from these structures that I'm missing?


Do Python programmers find the whitespace issue inconvenient?

Many programmers, upon first encountering Python, are immediately put off by the significance of whitespace. I've heard a variety of reasons that this is inconvenient, but I've never heard a complaint from a Python programmer. Of course, I haven't met a lot of Python programmers, as I have spent my career in the Java world. So my question is for those of you that have participated in a large Python project (more than 3 months, with Python being the primary language used): Did you find the whitespace issue to be inconvenient and continually annoying? Or was it a non-issue once you got in the flow? I'm not asking the question because I'm for or against Python, or for or against its use of whitespace. I happen to like Python, but I've never used it for anything big. Please don't provide speculations if you are not experienced in Python.


Are design principles important, and if so, why don't more people use them?

I am a developer who works for an in-house information communications technology (ICT) department. I am usually quite critical when looking over code that I have not written as I find time and time again that it does not follow principles like SOLID (single responsibility etc). I used to assume that it was because I worked in an in-house ICT department rather than an outsourced ICT service. However, I am now trying to integrate an internally developed app with a few third party apps developed by large software vendors. However, again the code does not seem to be very well written e.g. there are no interfaces and every method is public. I see it time and time again were developers create a bunch of classes and that's it (i.e., everything related to Sales goes in the Sales class, etc.) I don't want to sound like I am whining; I just wondered whether other developers see design principles as important. I wonder if I am too narrow minded.


How do ORM'S manage CRUD operations in multi thread environment

Suppose I have code which retrieves an object and modifies it and submits it via any ORM from a web application. Below is the pseudo code: First request               var objCust = _dbContext.Customers.Where(c=>c.CustomerId == "ALFKI").SingleOrDefault();     objCust.Address ="test address 1";     //and add some orders     _dbContext.SubmitChanges();       Second simultaneous request               var objCategory = _dbContext.Categories.Where(c=>c.CategoryId == 1).SingleOrDefault();     objCategoryName = "test name";     _dbContext.SubmitChanges();      How does the first request only grasp the changes done to customers and submit the changes. Is there any mechanism inbuilt in ORM's to track changes to entities per thread or request.


Does this status show a green signal?

I have done this static code analysis with Code Analyzer. Is it a green signal or should I improve my coding standards? ![enter image description here](http://i.stack.imgur.com/UVXFb.jpg)


Git Project Dependencies on GitHub

I've written a PHP framework and a CMS on top of the framework. The CMS is dependent on the framework, but the framework exists as a self-contained folder within the CMS files. I'd like to maintain them as separate projects on GitHub, but I don't want to have the mess of updating the CMS project every time I update the framework. Ideally, I'd like to have the CMS somehow pull the framework files for inclusion into a predefined sub-directory rather than physically committing those files. Is this possible with Git/GitHub? If so, what do I need to know to make it work? Keep in mind that I'm at a very, very basic level of experience with Git - I can make repositories and commit using the Git plugin for Eclipse, connect to GitHub, and that's about it. I'm currently working solo on the projects, so I haven't had to learn much more about Git so far, but I'd like to open it up to others in the future and I want to make sure I have it right. Also, what should my ideal workflow be for projects with dependencies? Any tips on that subject would also greatly appreciated. If you need more info on my setup, just ask in the comments.


What follows after lexical analysis?

I'm working on a toy compiler (for some simple language like PL/0) and I have my lexer up and running. At this point I should start working on building the parse tree, but before I start I was wondering: How much information can one gather from just the string of tokens? Here's what I gathered so far:   1. One can already do syntax highlighting having only the list of tokens. Numbers and operators get coloured accordingly and keywords also.   2. Autoformatting (indenting) should also be possible. How? Specify for each token type how many white spaces or new line characters should follow it. Also when you print tokens modify an alignment variable (when the code printer reads "{" increment the alignment variable by 1, and decrement by 1 for "}". Whenever it starts printing on a new line the code printer will align according to this alignment variable)   3. In languages without nested subroutines one can get a complete list of subroutines and their signature. How? Just read what follows after the "procedure" or "function" keyword until you hit the first ")" (this should work fine in a Pascal language with no nested subroutines)   4. In languages like Pascal you can even determine local variables and their types, as they are declared in a special place (ok, you can't handle initialization as well, but you can parse sequences like: "var a, b, c: integer")   5. Detection of recursive functions may also be possible, or even a graph representation of which subroutine calls who. If one can identify the body of a function then one can also search if there are any mentions of other function's names.   6. Gathering statistics about the code, like number of lines, instructions, subroutines EDIT: I clarified why I think some processes are possible. As I read comments and responses I realise that the answer depends very much on the language that I'm parsing.


CSS vs codebehind, if I have to do part of the style in codebehind, should I do all of it there?

I'm working with ASP.Net and trying to style an ImageButton. I tried to do this via CSS only to discover that for some reason, .Net writes out an inline style setting the border width to 0 automatically. This overrides the border width from CSS, so I have to set it manually in the codebehind. My question is, should I do all the styling in the codebehind to keep it all in one place, or only do the border width there and do the rest in a style sheet? For clarification, I mean all the styling _for that object_ not for the whole site.


Creating and assigning console.log a new object

I have seen code like this in several places:               (function() {         var method;         var noop = function noop() {};         var methods = [             'assert', 'clear', 'count', 'debug', 'dir', 'dirxml', 'error',             'exception', 'group', 'groupCollapsed', 'groupEnd', 'info', 'log',             'markTimeline', 'profile', 'profileEnd', 'table', 'time', 'timeEnd',             'timeStamp', 'trace', 'warn'         ];         var length = methods.length;         var console = (window.console = window.console || {});              while (length--) {             method = methods[length];                  // Only stub undefined methods.             if (!console[method]) {                 console[method] = noop;             }         }     }());      Specifically I am interested in this line of code               var console = (window.console = window.console || {});      Why are we creating a new `window.console` object if `window.console` is not defined ? So why are we setting `window.console={}`?


Are there decent entry-level tutorials on debugging?

In the tags I frequent on Stack Overflow, a big chunk of questions _should_ be answered with some basic knowledge about how to debug things - ie., teaching the OP to fish - instead of giving a fix for the piece of code presented. Are there any good debugging tutorials for newbies, especially   * Basic debugging techniques - understanding a piece of code, finding the problem by walking through it step by step instead of posting on SO and saying "it doesn't work"   * How to debug simple PHP scripts (For situations like "my POST variables aren't showing", etc.)   * How to debug Ajax scripts (How to use Firebug to see what gets sent, etc.) but also other languages and platforms?


Macbook pro for a C++ programmer?

I am a computer science student and I'm thinking of getting a new laptop. Is Macbook C++ programmer friendly? Does OSX have enough tools as in Linux for programming. Does working on a macbook hinter my growth as a C++ programmer. EDIT: I mainly use gedit, gdb, g++, meld, ddd (gdb front end), valgrind etc in Ubuntu Does OSX have equivalent softwares.


PHP as a scripting language

I have reasonable knowledge of PHP, Perl, and Bash. I use Perl for most text processing on my system (find, replace, filter output, etc). I use PHP for web development, allowing a user to view and interact with database data via the browser. I use Bash for quick and dirty scripts often to supplement the more complex Perl scripts. I'm a big believer of focusing on as few languages as possible (to get the job done) and becoming an expert in them. So the question is, why not use PHP for the common tasks that Perl (and Bash) are used? Are there good reasons (limitations or features) why PHP is mostly used for web development, while Perl and Bash are mostly used for "offline" "scripting"?


Limitations of using Hyper-V Virtual Machine as .NET Development enviroment

I've been thinking of using a Hyper-V Machine as instead of physical computer for installing my .NET / Azure / Xamarin / ASP.NET / Windows Phone development tools. That way I could easily move from my desktop to my laptop when I need to develop something on the go. Are there any limitations in this scenario that I should be aware of? Thanks, Adrian


how to check email address exist or not in php

I have tried a lot but could not find a way by which I will find if an email id exists or not. My problem is that I do not want to make visitor to email me with fake email Id. Is there any solution for this? I do not want to use smpt service as it send mail to solve this.


Which license for an open source project which may be, but is not intended to be, used as a bot in some apps?

I'm wondering if there is some license which I could put on my website on which I could publish an open-source application that potentially could be used for purposes of cheating in one game for smartphones. Now, I have to stress that the goal of the application is in no way cheating, so with this license I want to eliminate the possibility that the authors of the smartphone game (in which my bot could be used) could sue me if someone else starts using the application to get better at their game. I may be too paranoid, but with all the weird laws you just never know. I did a little research and came up with Creative Commons Attribution 3.0 (CC BY 3.0), but was wondering whether any of you guys were ever in a similar situation, and what you did in that case? By the way, I did read and consider the moral implications of the possible app appearing on my site, so now I just need some license as stated in the question.


Do I include association links for Objects that only have method scope in UML class diagrams

For example I have a utility Class which contains a few constants (GCMConstants), this class is used in one method in the application. However as it is not a member of the Class it should not be modeled via an association link. Should I continue as is and not include a link or should I include one? I've checked my UML books but none of them seem to cover stuff like this.