Website for code review

I know that we all are trying to improve our structure and style of our code, striving to be truly agile. Websites like Stack Overflow are great when you want an answer to a specific question but what about when you want to get your work critiqued. Are there any communities out there that focus on code review or, even better, agile solutions or even better still focus on T/BDD solutions?


Online Code Reviews

> **Possible Duplicate:**   >  Website for code review Where can I post my code online so people can comment, make suggestions, and/or criticism? I tried 4chan but people lose interest fast if you don't say something really stupid. Ideas? My language can be located at http://github.com/tekknolagi/gecho/tree/testing


Code Review Services

> **Possible Duplicate:**   >  Website for code review As a sole developer on a Sharp Architecture project, I'd like to find a way to get some code review. How do people do this? Are there services that people can recommend? Edit: Specifically, I need code review for the overall project - a big task.


How to get collaborators for an Android project?

How do I get people to want to collaborate on a project idea I have/actually contribute? I am a bit sensitive about my idea for a couple reasons:   1. I don't want people to take my idea.   2. I have gotten a couple people who wanted to help but then work/family/school stops them from having time and makes me less enthusiastic in the process. For now it's actually ok because it has forced me to become familiar with PHP and servers and I have just been working on it on my own because I want to learn and its fun, but at some point I will need others to help in order to make it robust and ready to distribute. How do I get collaborators when I will need them? I feel like I should start figuring that out now. I have just been learning how to write software using mainly Stack Overflow, idiot guides and YouTube. Great to learn, but development is slow.


Planning Development Projects

We are currently re-evaluating the way we manage, plan and run our projects (an area that I think we can massively improve upon) so I just wanted to get some ideas as to how other development teams go about starting new a web application project. At present, following the initial client meetings we produce a simple planning document that outlines what we intend to create for them (this usually contains screen shots of the various sections of the app and some detail about what each page will do). Once we have sign-off on this, this is what is used to by the developers as a blueprint to develop from. I can't help but feel we are lacking here as the client planning document simply isn't detailed enough and doesn't really show any of the business logic decisions made in the application. Following development, the application goes to testing where the testers record bugs in an Excel spreadsheet. I feel this is also a very basic way of doing things, I have looked at web apps like Sifter and think this is how we should be doing things. We use TFS as our source control but the bug-tracking in there is overkill for what we need. So what I'd love to know from you guys is, what sort of documentation you produce for projects and what processes you follow during planning and development.


SQL Servers Resource Governor - Pros and Cons

From what I have read about SQL Server Resource Governor, there really aren't any cons. I'm looking at implementing it into our infrastructure where we host websites as well as a management system plus reporting. The management system requires data to be loaded which has to be done out of hours because its quite resource intensive and has a knock-on effect to the websites. So, using the Resource Governor to split out the resources makes sense. Any thoughts?


Algorithm to calculate trajectories from vector field

I have a two-dimensional vector field, i.e., for each point `(x, y)` I have a vector `(u, v)`, whereas `u` and `v` are functions of `x` and `y`. This vector field canonically defines a set of trajectories, i.e. a set of paths a particle would take if it follows along the vector field. In the following image, the vector field is depicted in red, and there are four trajectories which are partly visible, depicted in dark red: ![trajectories](http://i.stack.imgur.com/u78WF.gif) I need an algorithm which efficiently calculates some trajectories for a given vector field. The trajectories must satisfy some kind of minimum denseness in the plane (for every point in the plane we must have a 'nearby' trajectory), or some other condition to get a reasonable set of trajectories. I could not find anything useful on Google on this, and Stackexchange doesn't seem to handle the topic either. Before I start devising such an algorithm by myself: **Are there any known algorithms for this problem? What is their name, for which keywords do I have to search?**


How to write an optimal LAN messenger software?

I am asking this question as an extension to the following question: https://superuser.com/questions/713409/how-to-message-any-user-on-your-lan I don't think I have a real answer. I found it quite difficult to get the `net send` command working on Windows 7 and even if I could have it would have been enabled only for admin users. So I have decided to write my own program to solve the problem. Using `python` I can write a program to check for messages on a common file (which I can store on a common harddrive which we have on our LAN). So the program will write `from:192.168.23.44 to:192.168.23.45 Hello`. Assuming the program is installed on both machines, I can ask the machines to poll this file every few seconds and pop-up a message if a message has been written for it, by searching for it in the `to:` field. If writing to a single file becomes an issue I will make multiple files which will act as inboxes for each of the computers on the LAN. However, this approach is very inelegant. I don't suppose internet messengers, Google talk for instance, poll a server to check whether there are any new messages for the user. So my question is: what is the optimal way to write a LAN messenger program. Now that I think of it, I am looking for a minimalist approach. I will just put the program in the `Startup` folder of all the machines and it should come alive whenever any user logs in. I was just able to configure the machine to respond to the `ping` command by making a new rule for the ICMPv4 protocol (ref: http://answers.microsoft.com/en-us/windows/forum/windows_7-networking/how-to- enable-ping-response-in-windows-7/5aff5f8d-f138-4c9a-8646-5b3a99f1cae6). I am guessing that answer lies in `python` and the `ICMPv4` protocol, but I needed some direction.


Are the IETF BCP 47 language tags defined as enums anywhere in JDK? For `Locale.forLanguageTag()` we pass values like `fr-FR`, `jp-JP` etc. Are there any enums already provided by JDK for it? Or should the developer be writing a custom enum for that? How to handle it in i18n application?


Git Branch Model for iOS projects with one developer

I'm using git for an iOS project, and so far have the following branch model:                feature_brach(usually multiple) -> development -> testing -> master      Feature-branches are short-lived, just used to add a feature or bug, then merged back in to development and deleted. Development is fairly stable, but not ready for production.   Testing is when we have a stable version with enough features for a new update, and we ship to beta testers. Once testing is finished, it can be moved back into development or advanced into master.   The problem, however, lies in the fact that we can't instantly deploy. On iOS, it can be several weeks between the time a build is released and when it actually hits users. I always want to have a version of the code that is currently on the market in my repo, but I also have to have a place to keep the current stable code to be sent for release.   So:   * where should I keep stable code   * where should I keep the code currently on the market   * and where should I keep the code that is in review with Apple, and will be (hopefully) put on the market soon?  Also, this is a one developer team, so collaboration is not totally necessary, but preferred because there may be more members in the future.


Service as a Model in MVC

I have a PHP MVC application and a file table. I need to implement the functionality: mark all as read. The best solution for the code I found so far was to put the actual implementation in a Model/Service/FileService.php The problem is the class FileService will get bloated really fast with different functionality. What would be a good solution to avoid bloated Services. Should I created different Services for each action?


You write the server, I write the client: Best practices for designing an API?

I'm working on a brand new application that involves a client and a server. Specifically, it's a native mobile app talking to a web server, using a custom API that we will define. I was hired to write the client and another guy (I've never met) has been hired to write the server. To get started we need to agree on an API. We both have very different perspectives on it, working with different technologies. Each of us might not even be sure what sort of small changes make things easier or harder for the other guy. I can't deliver a client if his server isn't working, and his server is pretty useless without a client. What are good strategies for dealing with arrangements like this? I know the answer usually boils down to "it depends on your situation" but if I can learn from anybody else's mistakes, I'd sure like to avoid making them again on my own.


Which microsoft qualification should a C# ASP.NET Web developer work towards?

I've been working as a vb.net ASP.NET web developer for the past 4 years, and I'm currently making the change over to C# Apart from school/sixth form qualifications, I'm currently lacking any industry related qualifications, and I'm keen to start working towards a Microsoft qualification. What would be the best suited qualification for me to work towards? Any relevant links would be most appreciated.


How to deal with "software end-of-life" situations?

When a vendor declares that they no longer intend to provide any support or services to a piece of software (and stated the intent to exit the business - offering no upgrade paths), what kind of recourse is available to the customer? Please consider this from the _customer's_ viewpoint. The customer's IT staff will likely only consider the technical options, but there are likely non- technical options which the customer can pursue as well. Also, what kind of reasonable steps can be taken by the customer ahead of time to minimize disruption, such as in contract terms? Things I can think of:   * Need to purchase spare hardware and set up a spare environment on which the software can continue to operate.   * Various data export methods which do not require vendor involvement. (This can include trivial techniques such as examining the data stored in a commodity database backend, to the more involved techniques such as screen scraping, printing to image followed by re-scanning, etc)   * Parallel systems where staff will duplicate the old data into a new system manually or semi-automatically   * Legal means, in case the vendor is in financial trouble (as in the case of source code escrow) Any other ideas?   * Assuming that there is no "circumvention" involved (no DRM, no DMCA), is data recovery or reverse engineering legal/acceptable? _**Edited note:_** _It is a combination of several anecdotal, but real stories. I am not directly involved in any of those. It is simply my desire to learn about how "software end-of-life" situation is handled in general. It is not my intention to make the original story sound like too "difficult" to be solved._


Sencha Ext JS run time license

Do you need to buy a run time license from Sencha if your application code written is developed in Ext JS and deployed on a web server? http://www.sencha.com


Collaborate on UML online

Some friends and I are starting up a hobby programming project. I wonder if there is any good method/tool/service which lets us collaborate on UML diagrams online. This can be in any form (online direct edit, source-control style, etc.) as long as we can make changes independent of each other.


How to let the outside world decorate my private field?

Imagine a simple `Controller` (as in process control) interface. I have some concrete classes, say `PIDController`, that implement it. I also have some decorator classes that extend these classes somehow, say `ITAETuningDecorator`. Now imagine that a `FloodGate` class has a private `Controller` field. I would like, from the outside and at runtime, to attach to the `Controller` in `FloodGate` an `ITAETuningDecorator`. How can I do it? I have no access to the field from the outside and obviously the decorator needs a reference to the original controller to be built.


Redundancy caused by polymorphism

I have two chat rooms, one has administration behaviour, and one doesn't. I have factored out all of the common code into a base chat room, but the `AdministerChatroom` behaviour I have pulled out into an interface called `IAdministrable` and it sits on the base chatroom class. My issue is that because the interface is on the base class, which allows for the behaviour to polymorphic, the `NonAdministratableChatroom` chatroom class must implement that behaviour even though it will do nothing. I have seen some developers put the interface on only one subclass: the class that has the behaviour, in this case the `AdministerChatroom` method, and when a chatroom is being used, they simply check the existence of the the `IAdministrable` interface, something like `if(Chatroom is IAdministrable){ // do something }`, which seems like a violation of the "tell don't ask" principle. I seem to have two choices: I stick to the polymorphic strategy pattern, or I test the instance for an interface; the former seems preferable but I am wondering if there are any other options? The code for the classes is as follows:               public interface IAdministrable     {         void AdministerChatroom();     }          public abstract class BaseChatRoom : IAdministrable     {         public void Close()         {         }              public abstract void AdministerChatroom();     }          public class AdministrableChatroom : BaseChatRoom     {         private readonly Administrator _administrator;              public AdministrableChatroom(Administrator administrator)         {             _administrator = administrator;         }              public override void AdministerChatroom()         {             _administrator.DoSomethingSpecial();         }     }          public class NonAdministratableChatroom : BaseChatRoom     {         public override void AdministerChatroom()         {             // do nothing as this is not administrable         }     }          public class Participant     {          }          public class Administrator : Participant     {         public void DoSomethingSpecial()         {             // implement something special here         }     }


TDD: Mocking out tightly coupled objects

Sometimes objects just need to be tightly coupled. For example, a `CsvFile` class will probably need to work tightly with the `CsvRecord` class (or `ICsvRecord` interface). However from what I learned in the past, one of test-driven development's main tenets is "Never test more than one class at a time." Meaning you should use `ICsvRecord` mocks or stubs rather than actual instances of `CsvRecord`. However after trying this approach, I noticed that mocking out the `CsvRecord` class can get a little hairy. Which leads me to one of two conclusions:   1. It's hard to write unit tests! That's a code smell! Refactor!   2. Mocking out every single dependency is just unreasonable. When I replaced my mocks with actual `CsvRecord` instances, things went much more smoothly. When looking around for other peoples' thoughts I stumbled across this blog post, which seems to support #2 above. For objects that are naturally tightly coupled, we should not worry so much about mocking. Am I way off track? Are there any downsides to assumption #2 above? Should I actually be thinking about refactoring my design?


What is a legitimate reason to use Cucumber?

I've worked in several contracts where the client used Cucumber and I've often felt that the testing suite didn't really have a place in our stack. From what I understand, business analysts/non-technical coworkers write up the tests and the developers make the step definitions work. My problem with this approach is the tests are never valid or terse enough to be used without rewriting the whole file.


increasing productivity - mastering a language vs. selecting efficient tools

I'm looking for advice from experienced developers on this question. In my work there's a need for a lot of one-off code. It's tempting to just dip into the right python/perl library calls to do these little tasks as quickly as possible. I used to be of the philosophy of - "use most efficient tool for the task". However, I'm afraid that over time, this means that I won't have a deeper experience and expertise, so recently I've been forcing myself to use C++ (w/ Boost and STL) for everything, even if I could do the task in python or perl much more quickly. I'm hoping that in the long run, this will make me a more productive developer. I hope to reach a level of familiarity that I can do things in C++ as quickly as I can in python (and also have the practice to work on bigger projects that would require C++). Is this a good strategy towards long-term productivity and deeper skills? Or am I unnecessarily wasting time / torturing myself?


Best Object Oriented way of parsing a model with several fields(>50) and with null checks

I have a JSON-based data which contains many fields from a particular model. Any value from the list of fields can be null. I am trying to find the best object oriented way of parsing it and also it has to be light-weighted as it's a mobile application. PS: Want to avoid numerous "if-checks" Structure of JSON Data:               data=(                                 classId=""             classDesc=""             items=(                 {                     //Array of 50 Items                 },{                     //Array of 50 Items                 },{                     //Array of 50 Items                 }                );         },        //Remaining Items         );


Have they missunderstood currying or have I?

This question is similar to the question posted on Does groovy call partial application 'currying'?, but not completely the same, and the answers given there do not really satisfy me. I would like to state right at this point, before I go any further, that currying is one of the concepts that have been hard to fully understand. I think the reason for that is the fact that there seem to be two general definitions of currying, and they don't really mean the same thing both in theory and in application. That being said, I think currying is a very simple concept once you decide to take only one of the two definitions and stick to it. In fact, currying should not be difficult to understand at all, but in my experience, understanding currying has been the equivalent of showing a little boy an apple and telling him that fruit is called apple, and then you go on calling that fruit an orange. The boy will never understand the simple concept of an apple because you have caused an enormous amount of confusion by calling the apple an orange. The definition of currying that I've accepted as the right one is that currying is taking a function of an arbitrary arity and turning it into multiple chainable functions each of which accepts only one parameter (unary functions). In code, it would look like this:               f(1,2,3);     //becomes     f(1)(2)(3);      However, some people, including well known programmers like John Resig, explain currying as something completely different. For them, currying is no more than simple partial application. There is even a generally accepted javascript function for currying:               Function.prototype.curry = function() {         var fn = this, args = Array.prototype.slice.call(arguments);         return function() {           return fn.apply(this, args.concat(             Array.prototype.slice.call(arguments)));         };       };      This functions does not really curry anything, but rather partially applies the supplied arguments. The reason why I don't think this function curries anything is because you can end up with a function that accepts more than one argument:               var f2 = f.curry(1); //f accepts 3 arguments f(1,2,3);     f2(2,3); // calling the resulting "curried" function.      So, my question is, have I misunderstood currying or have they? I wanted to post links to the material I've read on currying, but I cannot post more than 2 links since I don't have a reputation of at least 10. I will leave you with this post that explains currying in javascript, but in a way in which I don't really see any currying: https://javascriptweblog.wordpress.com/2010/04/05/curry-cooking-up-tastier- functions/


How Does A Compiler Work?

_Note: I am surprised that this hasn't been asked before, and if it has I could not find it in a search._ I've been on tons of websites, I've read tons of articles, and I have heard tons of explanations. Most of them were good, but they were all either to broad or too complicated or just plain bad. So my question is , how does a compiler work? If this is a difficult, broad question, please tell me. But if not, please answer the question.


Compiler optimization examples

I'd like to see (good) examples of optimizations performed by compilers (static and JIT). Why?   * To learn what we don't have to optimize ourselves (often leading to better code)   * To be amazed


What's the best way to show a CLI CRUD app to client?

I'm developing a CRUD application on command line for a non-tech client. What's a simple (for both parties) way for me to demo the application remotely? A middle-ground between SSH (easy for me) and setting it up as a webapp (easy for the client) would be great.


What is the best way to introduce algorithms to undergraduate students?

If you are given the task of designing the courses leading up to a degree in computer science and are allowed just two courses on the topic of 'Algorithms', how would you structure the courses? My specific questions are:   1. Should the first course introduce some of the fundamental algorithms of Sorting and Searching without introducing the notions of time and space complexity?    2. A second course on designing algorithms. This course would cover not only time and space complexities but also generic algorithm design techniques such as Divide and Conquer, Dynamic Programming etc.. This is the typical profile of the students I am designing this course for:   1. Most would be new to the notion of programming though familiar with the use of computers.   2. They would be learning C programming in the same semester that they learn about algorithms.   3. They Would be taking a simultaneous course on introduction to computer science.  Most of the text books I have considered are either too voluminous or too intimidating for the student with over emphasis on the analysis of the complexity of algorithms. Any suggestions on either the appropriate text books or methodology for teaching would be appreciated!


How do I protect my website (Codes, Database, FTP informations) from freelancer?

I'm developing a website using Joomla and many other 3rd party plugins and also I want to make some custom components so I'm hiring some freelancer developers and few are an online companies they say located in UK or somewhere. After explaining them about the component's functionality and layouts they are requesting access to my website's FTP, Database, CPanel. In this case how I'm going to protect my website? What if they take my other code and make a clone site or something? Is there any ideas besides company contract?


Do you need to buy Visual Studio to develop/deploy an ASP.NET web application?

Since the .NET Framework SDK is free, is Visual Studio anything more than an IDE? If yes, do I need to buy Visual Studio to deploy my ASP.NET web application (written in C#)? I'm using MySQL for the database. I'm a student that is going to graduate college soon, and I'm exploring technologies for a web application that I'm building for a startup.


What job is better for a newbie, one that requires you to create a new program frequently, or something like software maintenance?

One of my friends has just completed his college degree and is ready to join the programmers' world. Today he has two offers, one with new projects every time, and another with software maintenance. The remaining factors are not important to him, what he wants to know is which option is better? My experience goes with second option because my first job was the maintenance one and **I could learn how my fellow programmers made mistakes while coding** . But I soon switched to a new job which required me to create new project every time. I enjoyed both but I must admit that my first job has given me a more advantage today. But it's not necessary that my experience can give benefit to him. But I want to know what is general approach? If I have to give him final verdict on these two, what should I tell him? _**Edit_** Everybody deserves one up vote here, I am really learning a lot from you guys.


What is an algorithm to find simple cycles?

I have a graph with an Eulerian cycle and no Hamiltonian cycles. I would like to divide this graph into simple cycles.   Edges may not be repeated in simple cycles. How can this be done?


Dependency Injection and Singleton. Are they two entirely different concepts?

I've been hearing about using the dependency injection over Singleton for my colleague. I still can't make out if it they are two orthogonal patterns which can be replaced with one another? Or is DI a method to make the Singleton pattern testable? Please take a look at the following code snippet.                   IMathFace obj = Singleton.Instance;              SingletonConsumer singConsumer = new SingletonConsumer(obj);              singConsumer.ConsumerAdd(10,20);      The `SingletonConsumer` is accepting a parameter of type `IMathFace`. Instead of accessing the singleton class internally, `SingletonConsumer` will get the singleton instance passed by the caller. Is this a good example of consuming singleton class via dependency injection?


How do programs like subversion detect when a file has been edited as opposed to created/deleted?

This is my first question here so I hope it is not off topic. Although I am using the Linux `inotify` library to listen for changes to files, and I compare use of that against the `Subversion` program, I am specifically looking for the algorithm used. To a human it is very easy to tell if a file has been created or modified. Clicking the `New` button constitutes the former, and clicking the `Save` button constitutes the latter. To Linux, both those actions have serious overlap. In text editors, for example, generally a swap file is created and then copied/moved. This makes it difficult to distinguish via `inotify` between a minor edit to a file and a deliberate overwrite of a file. What I am trying to understand is how a program such as `Subversion` recognizes the difference between a user having modified a file with a text editor, and a user having actually deleted the file and opened a new file with the same name. **Edit:** It has been pointed out that subversion does not do what I want it to do, so it was a blunder on my part to use it as an example. Instead allow me to rephrase the question: "Is there any known program or programming approach to match high level actions such as creating new files and saving them to low level actions such as modifying, moving, copying, etc. such that I can log all the files in the system and changes to them"?


Is it a good practice set connection strings in a web config?

Recently I have a discussion with some of my colleagues at my work because they said that it's better have in a .DLL a string connection encrypted. And I said why just don't use the string connection defined in the web.config encrypted? it's the same and it's better because entity framework, for example looks for the name of the connection in the web config of the application, Now i want to know from a security point what's better or what's the best practice??


How is DRY principle ( applied at class level ) related to SRP?

In other words, is DRY (don't repeat yourself) applied at a class level a subset of SRP (single responsibilty principle)? What I mean is that while SRP states that each class should have only a single responsibility ( ie. class should only have one reason to change ), is it the application of DRY at class level that prevents two classes from having the same responsibility ( thus it is DRY that prevents the repetition/duplication of same responsibility in two different classes )? Thank you


Running time of simple for-loops

I'm reading algorithms and I understand most of it, one thing that I can still struggle with a lot is something as simple as running times on different for- loops. Everyone seems to have easy with that, except for me and therefore I search help here. I am currently doing some excercises from my book and I need help completing them in order to figure out the different running times. The title of the exercise is: "Give the order of growth(as a function of N) of the running times of each of the following code fragments" a:               int sum = 0;     for (int n = N; n > 0; n /= 2)       for(int i = 0; i < n; i++)         sum++;      b:               int sum = 0;     for (int i = 1; i < N; i *= 2)       for(int j = 0; j < i; j++)         sum++;      c:               int sum = 0;     for (int i = 1; i < N; i *= 2)       for(int j = 0; j < N; j++)         sum++;      We have learned different kinds of running times/order of growth like n, n^2, n^3, Log N, N Log N etc. But I have hard understanding which to choose when the for loop differs like it does. the "n, n^2, n^3" is not a problem though, but I can't tell what these for-loops running time is. Here's an attempt of something.. the y-axis represents "N" value and the x axis represents times the outer loop has been run. The drawings in the left is: arrow to the right = outer-loop, circle = inner loop and the current N value. I have then drawn some graphs just to look at it but I'm not sure this is right though.. Especially the last one where N remains 16 all the time. Thanks. ![My drawing](http://i.stack.imgur.com/35QwR.jpg)


Domain knowledge vs Programming

> **Possible Duplicate:**   >  How important is Domain knowledge vs. Technical knowledge? I often hear from my colleagues and sometimes from interviewers that, > "There is nothing so great in having excellent programming knowledge. One > must gain the domain knowledge as the 1st priority. If you have a good > domain knowledge, then writing code for that is not a big deal." (Here domain knowledge is something related to area you are working in. For example, I work in telecom domain, someone might be in Finance or Pharma or Web development or Embedded and so on.) I disagree with above passage and think exactly opposite. In my career _till now_ , I have seldom missed any deadline for bugfix or feature enhancement. I have kept changing the domains (within telecom) but stuck with learning the programming techniques. Though I might be wrong. **Questions** :   * Is my current approach correct ?   * Given a choice between domain or programming (with limited time) which one should be chosen ?   * Is there a good future for a person, who is primarily a very good coder but not so great in a domain (of course initially) ? I ask this because, I feel that every domain ultimately boil down to code sea in which one has to dive!


How to store historical user data?

I'm trying to think of fine way to store historical data for my web application. The application has users that add photos, comment and grade them. All this is stored in relational database. The users also have ability to delete own photos (and thus comments/grades) and own account. I want to store those deleted entities as historical data. **The aim of it is to distinguish categories of what people like to photograph and classify users towards those categories**. Should I store it in some NoSQL database? Or maybe in my origin database by marking it with `is_deleted` field? Maybe different table e.g. `archived_users`, `archived_photos`? Another database instance for only historical data? Has anybody dealt with such task and is willing to share thoughts? * * * So far, I'm using `is_deleted` flag for photos and backup table (`archived_users`) for users. Why such distinction? To avoid violating `unique` constraint on `username` field. This solution has 3 problems to me.   * It is incoherent to do same thing in 2 ways. Or maybe it's ok?   * It is somehow strange moving `user` to another table (with associations to photos). It creates some superficial fields. Or maybe it's ok?   * "Living" data is mixed with historical data. Could it be a performance problem when database is really huge?


Internal and external API architecture

The company I work for maintains a successful SaaS product that grew "organically" over the years. We are planning to expand the line with a suite of new products that will share data with the existing product. To support this, we are looking to consolidate business logic into a single place: a web service layer. The WS layer will be used by:   * The web applications   * A tool to import data   * A tool to integrate with other client software (not an API per se) We also want to create an API that can be used by our customers that are capable of using it to create their own integrations. We are struggling with the following question: Should the internal API (aka the WS layer) and the external API be one in the same, with security and permission settings to control what can be done by who, or should they be two separate applications where the external API just calls the internal API like any other application? So far in our debate it seems that separating them may be more secure, but will add overhead. What have others done in a similar situation?


Is table inheritance the wrong approach

If we take the two below entities as en example.               public class Person     {         public string Username {get;set;}         public string DisplayName {get;set;}     }          public class Worker:Person     {         public string Title {get;set}         public int SecurityId {get;set;}     }      When anyone first registers with this app, basic information would be captured and a Person would be created. Once an admin comes along, they may want to assign a role to this Person. Now Roles in the sense of Authorisation are not in question, there is a RoleProvider. However, if I make someone a worker, some additional details need to be captured. How those new details are best stored is what is in question.   * I could have a WorkerProperties class with the fields and give Person \--> Worker a 0.1->1 relationship.   * I could have all the fields as part of Person and just fill in what is required. At runtime accessing the Persons role would be needed to work out what fields would be required.   * I could create a Worker as shown above. Inheriting from Person. With this option there is the problem that the PK is the username registered with. I would need to somehow change the discriminator column generated by EF to essentially change the object type to Worker.


Open Close Principle (OCP) vs Dependency Inversion Principle (DIP)

I was trying to understand the difference between Open Closed Principle (OCP) and Dependency Inversion Princible (DIP). Based on research I've made on the internet so far, I came to the conclusion that 'DIP is one option through which we can achieve OCP'. I'm I right on this? Can you give me an example which doesn't follow DIP but follows OCP ?


Should my statefull widget generate necessary html itself?

What behaviour should be preferred for widget initialization: 1) Required HTML is generated by widget itself: Layout:
      Initialization:               $('#my-widget').myWidget(); // Creates HTML      2) Required HTML is placed to the page by user:

      Initialization:               $('#my-widget').myWidget(); // Won't create nested div's      Mark Otto (one of Bootstrap creators) suggest not to generate markup by javascript: https://github.com/mdo/code-guide#javascript-generated-markup Currently, I use the following function, which appends element to the root of the widget (this.$element) only if it doesn't exist:               function($content) {       var $child = this.$element.children('.' + $content.attr('class'));       return $child.length ? $child : $content.appendTo(this.$element);     };


Should Uncle Bob's example be refactored to an AbstractFactory or a SimpleFactory?

In the book "Clean Code" Robert Martin makes a statement regarding the following code:               public Money calculatePay(Employee e) throws InvalidEmployeeType {   switch (e.type) {         case COMMISSIONED:           return calculateCommissionedPay(e);         case HOURLY:           return calculateHourlyPay(e);         case SALARIED:           return calculateSalariedPay(e);         default:           throw new InvalidEmployeeType(e.type);   } }      Statement: The solution to this problem (see Listing 3-5) is to bury the switch statement in the basement of an ABSTRACT FACTORY,9 and never let anyone see it. What I don't understand is why does he call it an Abstract Factory? If the solution is to create 3 Employee subclasses each implementing it's own CalculatePay method then the logic is moved up to let's say the controller. But then we have to create a "Simple Factory (Idiom)" not an Abstract Factory as presented in the original book from the GOF. The Abstract Factory has the intent to: "Provide an interface for creating families of related or dependent objects without specifying their concrete classes." but this is clearly not the case.


Rich Domain Models -- how, exactly, does behavior fit in?

In the debate of Rich vs. Anemic domain models, the internet is full of philosophical advice but short on authoritative examples. The objective of this question is to find definitive guidelines and concrete examples of proper Domain-Driven Design models. (Ideally in C#.) For a real-world example, this implementation of DDD seems to be wrong: The WorkItem domain models below are nothing but property bags, used by Entity Framework for a code-first database. Per Fowler, it is anemic. The WorkItemService layer is apparently a common misperception of Domain Services; it contains all of the behavior / business logic for the WorkItem. Per Yemelyanov and others, it is procedural. (pg. 6) So if the below is wrong, how can I make it right?   The behavior, i.e. _AddStatusUpdate_ or _Checkout_ , should belong in the WorkItem class correct?   What dependencies should the WorkItem model have? ![enter image description here](http://i.stack.imgur.com/QKWNn.png)               public class WorkItemService : IWorkItemService {         private IUnitOfWorkFactory _unitOfWorkFactory;              //using Unity for dependency injection         public WorkItemService(IUnitOfWorkFactory unitOfWorkFactory) {             _unitOfWorkFactory = unitOfWorkFactory;         }              public void AddStatusUpdate(int workItemId, int statusId) {                  using (var unitOfWork = _unitOfWorkFactory.GetUnitOfWork<IWorkItemUnitOfWork>()) {                 var workItemRepo = unitOfWork.WorkItemRepository;                 var workItemStatusRepo = unitOfWork.WorkItemStatusRepository;                      var workItem = workItemRepo.Read(wi => wi.Id == workItemId).FirstOrDefault();                 if (workItem == null)                     throw new ArgumentException(string.Format(@"The provided WorkItem Id '{0}' is not recognized", workItemId), "workItemId");                      var status = workItemStatusRepo.Read(s => s.Id == statusId).FirstOrDefault();                 if (status == null)                     throw new ArgumentException(string.Format(@"The provided Status Id '{0}' is not recognized", statusId), "statusId");                      workItem.StatusHistory.Add(status);                      workItemRepo.Update(workItem);                 unitOfWork.Save();             }         }     }      (This example was simplified to be more readable. There are other entities, and for instance the AddStatusUpdate has some extra behavior -- IRL it actually takes a status category name, and if that category doesn't exist, the category is created.) ## Update @AlexeyZimarev gave the correct answer, a perfect video on the subject in C# by Jimmy Bogard, but it was apparently moved into a comment below because it didn't give enough information beyond the link. I have a rough draft of my notes summarizing the video in my answer below. Please feel free to comment on the answer with any corrections. The video is an hour long but very worth watching.


Should I be concerned that I can't program very fast without Google?

> **Possible Duplicate:**   >  Google is good or bad for programmer? I'm currently in college to be a software engineer, and one of the main principles taught to us is how to learn for ourselves, and how to search the web when we have a doubt. This leads to a proactive attitude - when I need something, I go get it. Recently, I started wondering how much development would I be able to do without internet access and the answer bugged me quite a bit. I know the concept of the languages and how to use them, but I was amazed by how "slow" things were without having the Google to help in the development. Most of the problems I have are related to specific syntax. For example, reading and writing to a file in Java. I have done this about a dozen times in my life, yet every time I need to do it, I end up googling "read file java" and refreshing my memory. I completely understand the code and fully understand what it does, but I am sure that without Google it would take me a few tries to get the code correct. Is this normal? Should I be worried and try to change something in my programming behaviour?


Private comments in git

I need to add a feature to some code in a big project and due to the complexity I find it very helpful to add detailed comments to many lines to keep track of what's happening. This is only for my own understanding however and I will delete the comments before pushing the code. The problem however is that if I do private commits during my development, when I push to the main server, I guess git will show the lines that I commented and then uncommented (but didn't otherwise modify) as being modified by me, making "blame" more opaque. I suppose the only way to do this cleanly is to have 2 private branches, one for development and one for commenting, or can anyone recommend a better way?


Which management book would you recommend to read for a fresh Team Leader?


What is a benefit of having source code for ICS?

People are so happy the source code of Ice Cream Sandwich became available for syncing. Why is that cool?


LL(∞) and left-recursion

I want to understand the relation between LL/LR grammars and the left- recursion problem (for any question I know parcially the answer, but I ask them as I don't know nothing, because I am a little confused now, and prefer complete answers) I'm happy with sintetized or short and direct answers (or just links solving it unambiguously):   1. What type of context free-language isn't LL(∞) languages?   2. LL(K) and LL(∞) have problems with left-recursion? Or only LL(k) parsers?   3. LALR(1) parser have troubles with left or right recursion? What type of troubles?   4. Only in terms of the LL/LALR comparision. What is better, Bison (LALR(1)) or Boost.Spirit (LL(∞))? (Let's suppose other features of them are irrelevant in this question)   5. Why GCC use a (hand-made) LL(∞) parser? Only for the "handling-error" problem?


What is the definition of "Big Data"?

Is there one? All the definitions I can find describe the size, complexity / variety or velocity of the data. Wikipedia's definition is the only one I've found with an actual number > Big data sizes are a constantly moving target, as of 2012 ranging from a few > dozen terabytes to many petabytes of data in a single data set. However, this seemingly contradicts the MIKE2.0 definition, referenced in the next paragraph, which indicates that "big" data can be small and that 100,000 sensors on an aircraft creating only 3GB of data could be considered big. IBM despite saying that: > Big data is more simply than a matter of size. have emphasised size in their definition. O'Reilly has stressed `"volume, velocity and variety"` as well. Though explained well, and in more depth, the definition seems to be a re-hash of the others - or vice-versa of course. I think that a Computer Weekly article _title_ sums up a number of articles fairly well "What is big data and how can it be used to gain competitive advantage". But ZDNet wins with the following from 2012: > “Big Data” is a catch phrase that has been bubbling up from the high > performance computing niche of the IT market... If one sits through the > presentations from ten suppliers of technology, fifteen or so different > definitions are likely to come forward. Each definition, of course, tends to > support the need for that supplier’s products and services. Imagine that. Basically "big data" is "big" in some way shape or form. What is "big"? Is it quantifiable at the current time? If "big" is unquantifiable is there a definition that does not rely solely on generalities?


php return values

I have a codeigniter app and in my model, I always return true or false for all functions, and if I have data that needs to be passed, I also set a property that contains my data. The only trouble is, in my controller, if I have to call 3 or 4 methods in my model, the code gets really repetitive.               If ( $this->my_model->functionA() )      {         $localvar = $this->my_model->data();     }     else     {         show_error("Error A");     }     If ( $this->my_model->functionB() )      {         $localvar = $this->my_model->data();     }     else     {         show_error("Error B");     }     If ( $this->my_model->functionC() )      {         $localvar = $this->my_model->data();     }     else     {         show_error("Error C");     }      I'm wondering if i change the logic so that the functions don't return true, but return the data instead... does it simplify things alot? I think I'd still need code like this:               If (! $this->my_model->functionA() )      {         show_error("Error A");             }     else     {         $localvar = $this->my_model->data();     }      Or is there a way I can combine my $localvar assignment statement with the if statement? Is there a better way to do this?


Where can I find programming puzzles and challenges?

I'm trying to find places where I can hone my craft outside the context of school or work. Are there places online, or books available, where I can access lists of programming puzzles or challenges?


Confusion over a hacker-howto article

I have gone through http://www.catb.org/esr/faqs/hacker-howto.html What I understand from the article:   1. develop a hacker attitude.   2. learn programming language (eg. python)   3. solve interesting problems Point 3) is where I'm stuck. Where do I find these interesting problems? Sure, I can go to UVA Online and other sites which have good set of programming problems. But solving these problem I just like an exercise from which I can polish my python skills and learn how to go about solving a problem. I want to do something real/fun problems which the above programming problems lack. I need a bit of guidance on the issue.


Fun Learning Exercises Recommendations

> **Possible Duplicate:**   >  Where can I find programming puzzles and challenges? Recently in our workplace we have been playing Design Pattern Poker. This is fun and really helps the participants to understand design patterns and to think of useful way to apply them. Can anyone recommend any other similar, fun games that will help us improve our development skills?


Good collection of short code samples in different languages to solve programming problems?

I am interested in learning some new programming languages and looking for the collection of short solutions for programming problems provided in different languages. The optimal format would be: > **Problem description**   >  Language A: .... (solution)   >  Language B: .... (solution) etc It would be best if I could sort/filter the samples basing upon the languages and programming paradigms. What I am currently doing is using the Project Euler and some other sites for programming contests where I first have to solve a problem on my own and then I can pick the examples in the languages I am interested in the forum thread of this particular problem. This is ok, but sometimes it is a somewhat too long way for me.


Site for programming tasks

> **Possible Duplicate:**   >  Programming Puzzles This may sound crazy, but is there a website where you can pick and choose a programming task for someone? Unpayed. As a matter of exercise. I would like to have some real world challenges that I can do in my spare time maybe.


Exercises for starting programmer

I'm learning how to program with a book on Objective-c. I know, that's not great start, but anyway. What I want to find is exercises which gradually increase in difficulty from starting ones like hello world to fairly complex ones which require few hours to complete. Is there any site out there that offers those excercises? Not necessarily language-specific. I have seen Project Euler but it is more math based, and I'm not too good in math. I know loops, got some grasp on classes, inheritance. What I want is to make something useful. I can't understand where to start.


Spending a good fortune on a certificate holding Scrum Master or a Veteran XP coach?

There is a very prestigious company that delivers a well-sold software about financial systems. It has more that 20 years of history, and is staffed with about 20 programmers and much larger number of managerial staff. Dissatisfied customers have reported strange bugs and no one has a clue what is wrong, hard to read code, and customization is prohibitively expensive. In a word, the software is rotten. The company decided to spend a fortune and found the Agile thing as the remedy but they are stuck about what it is they need most urgently. Is it about the process or the developers or both? The challenge breaks down to the following options:   1. They can hire a certificate holding Scrum Master to teach them Scrum. When asked about the value of doing it, the SM responded: "I will prepare them to embrace Agile and only then they can go Agile and save the product".   2. They can as well hire a veteran XP coach. When posed with the same question he responded : "The most urgent problem is with the programmers and not the management, XP will save the product from rot and only then Scrum will make sense" Developers are far from capable of doing agile programming practices at the moment. No unit tests, no pair programmings, no CI (huh? what is it?) ... you get the idea. Some say they would be far better trying to improve their programming first (hire option 2) and then go with the process. Many say quite the opposite. Any insights ?


How do I parse a header with two different version [ID3] avoiding code duplication?

I really hope you can give me some interesting viewpoints for my situation, because I am not satisfied with my current approach. I am writing an MP3 parser, starting with an ID3v2 parser. Right now I`m working on the extended header parsing, my issue is that the optional header is defined differently in version 2.3 and 2.4 of the tag. The 2.3 version optional header is defined as follows:               struct ID3_3_EXTENDED_HEADER{         DWORD dwExtHeaderSize;          //Extended header size (either 6 or 8 bytes , excluded)         WORD  wExtFlags;                //Extended header flags         DWORD dwSizeOfPadding;          //Size of padding (size of the tag excluding the frames and headers)     };      While the 2.4 version is defined :               struct ID3_4_EXTENDED_HEADER{         DWORD dwExtHeaderSize;          //Extended header size (synchsafe int)         BYTE  bNumberOfFlagBytes;       //Number of flag bytes         BYTE  bFlags;                   //Flags     };      How could I parse the header while minimizing code duplication? Using two different functions to parse each version sounds less great, using a single function with a different flow for each occasion is similar, any good practices for this kind of issues ? Any tips for avoiding code duplication? Any help would be appreciated.


When do you think of efficiency? Before/During/After actually coding?

I've been programming in Java for quite some time and I always find myself doing very little "planning" (I haven't worked on anything HUGE yet, but im no stranger to big projects) and develop ideas and fix code efficiency as I go. I tend to write a block of code, test it, test it again, try to break it, then make it look nice (visually) and then worry about modifying it to be more efficient (if possible). Is this how most people think/work? I'm wondering if anyone else takes the time to pretty up their code after its done or if they plan how its supposed to look and the most efficient method of writing it before actually coding anything. I'm trying to fine tune my own efficiency and hearing from the community will give me a broader idea of how professional and amateur programmers alike think.


.NET internals:Where is a good place to learn the "under the hood" stuff in .NET?

I'll be completely honest, one reason I love C# and .NET is that it has for ALL of my development career abstracted me from the well crafted under the hood stuff, I believe as a .NET developer I shouldn't need to know much about. This might seem like blasphemy for me to say I really do not care much about CLR, CIL, JIT, or MSIL and all the other internal technologies which up until now to be completely honest are more or less acronyms that mean very little to every day problems I find myself facing as a .NET developer, and solving with the bread and butter of .NET. My experience is varied like most of you guys with 2 years + experience. I've been using .NET since it was launched, and even back in the days when ASP.NET was called ASP+. I have yet to come across a situation where knowing how .NET does what it does provides me any practical value. I also fully believe that the authors of .NET very carefully planned .NET to provide this fantastic level of abstraction from specific hardware and OS version for this reason - simply put write your code and get on with your job! Long story short: Going for an interview next week, and I'm sure these theoretical questions will come up, and so I would like to put in about 4-5 hours to study the internals so I can (with confidence) satisfy an interview test. Is there a good book or site which details all the .NET internals in a way that is easy to understand? EDIT: To clear things up a bit, when I refer to .net internals - what I mean is not reflecting and inspecting framework code, mainly knowing how .net code from writing it ends up as executable byte code.


is there any relationship between a story point in two different projects?

Assume we have two projects and one or more teams (one team doing the projects in serial or two teams doing the projects in parallel). If Team A decides that a task is 8 story points and Team B decides that a task on their project is also 8 story points, does that say anything about the relationship between the two tasks? Or is there no relationship between the complexity of the two tasks?


high level design of a browser layout engine?

I'm interested in how browser layout engines like gecko, webkit and trident are architected from a high level. what are the key abstractions? how are they layered? what are the inputs/outputs for the different abstractions? Is there a diagram or article that explains this particularly well? I am sure the implementations vary, but I'm generally curious about how all the pieces fit together. I realize webkit is open source and I can just look at the code, but I wouldn't know where to start.


Coupling. Best practices

Following on from this thread I started The Singleton Pattern It got me thinking about how coupled my classes are and how best to achieve loose coupling. Please bear in mind I am a new programmer (4 months into my first job) and this is really the first consideration I have given to this, and am very keen to understand the concept. So, what exactly constitutes loose coupling vs heavy coupling? In my current(and first project), I am working on a c# winforms project, where the GUI section creates objects and subcribes to their events, when they are triggered, the GUI creates another object (in this example, a datagridview (a class that I have created that wraps around a standard datagridview and adds additional functionality) and attaches it to the GUI. Is this bad coupling or good? I really don't want to get into bad habits and start coding poorly, hence I would appreciate your responses.


What is inversion of control, and when should I use it?

I am designing a new system and I want to know what inversion of control (IOC) is, and more importantly, when to use it. Does it have to be implemented with interfaces or can be done with classes?


British royal succession algorithm

I was reading about the rules for royal succession of the British monarchy and thought the easiest way I could understand it is with code (or pseudo-code). I came up with this (in a C# like pseudo-code):               EventHandler CurrentMonarch_Died {         CurrentMonarch = SuccessorRootedAt(Person.Electress_Sophia_Of_Hanover);     }          enum Gender { Male, Female };  // Male must come before Female          Person SuccessorRootedAt(Person person) {         if (person.IsAlive && IsQualified(person.Religion, person.Citizenship))             return person;              sortedChildren = person.Children.OrderBy(p => p.Gender).ThenBy(p => p.DateOfBirth);              foreach (child in sortedChildren) {             successor = SuccessorRootedAt(child);             if (successor != null)                 return successor;         }              return null;     }      Is it correct?


Using an open source non-free license

Are there any projects/products out there that use an open source license that basically says "free for small companies" and "cost money for larger companies" in addition to "make modifications available"? (And are there any standard licenses with such a wording?) If I were to release a project under such a license, would it be automatically shunned by every developer on the face of the earth, or, assuming it is actually a useful project, does it have a fair chance at getting contributions from Joe Programmer? The second part of this question can easily become subjective, but any well argued point of view will be highly appreciated. For example, do dual licensed projects made by commercial entities have success with the open source communities?


How to keep your programming resources, tips, tools and snippets handy and easy to find?

In my everyday work and on my free time, I tend to discover/learn/find pieces of information that can be really useful if used at the right moment but also really easy to forget and/or to find again when it's required. To give you examples, I am thinking about things such as :   * nice algorithms or concepts from a book   * crazy options for a compiler   * neat online tools such as interpreters/compilers.   * snippet of codes   * documentation of different languages   * programming tips from a forum and/or SE.question   * page of an interesting github project As you can imagine, most of them could be saved as bookmarks but not all of them. Also, bookmarks wouldn't have any explanation/documentation/tagging/nice formatting around it. At the moment, I was thinking about creating a plain HTML page or a personal wiki to keep everything somehow organised. Thus, I was wondering which support/tool programmers were using to keep that kind of resources handy and easy to find when required and how they were organizing them?


Pushing changes to an open web page

I have a warehouse management app that I have written that handles batching of orders for batch picking, scanning of items for packing and accuracy. Part of this app is a Dash or control panel that the different managers in the warehouse work out of. It shows who's picking, packing, who's available, how many orders are available to be batched and a BUNCH of other details and controls. Right now i have an ajax call that checks a time stamp that runs every 30 seconds or so to see if the page should be updated (a change made on another managers workstation). A manager does something that should be shown on all other workstations that are viewing the "dash". Maybe they batched some orders and pickers that were available are no longer available. Right now when the change is made i update a timestamp saved in a database. On the html page the timestamp that was in the db at last page load is saved in a hidden div. The javascript takes that timestamp and checks the database at an interval if its different the page updates. Its a bit more complicated than this as sections of the page get changed not the whole thing but the description sums up the process. This works but i don't like it. It requires a database hit from each workstation every 30 seconds. Seems overly complex. I am looking for some thoughts on how I might push a change as it occurs and minimize or eliminate some of the database interactions. Thoughts?


Adding to the System namespace in C#

Would it be acceptable for some very generic utilities or classes to be added in the `System` namespace? I'm thinking of really basic stuff like a generic `EventArgs` (`EventArgs<T>`), Use case: would be shared in a company's core library (so that it can be recompiled in a new project as-is, without changing the namespace);


Why it is not possible to Instantiating Types with Wildcards in Java

I am trying to instantiate               LinkedList<?> op = new LinkedList<?>();      But I get error               Cannot instantiate the type LinkedList<?>      Why is it that this cannot be instantiated in Java?


Pros/cons between emphasizing client-side or server-side processing

Why would I want to write a web app with lots of processing server-side? To me, writing the program client-side is a huge advantage because it takes away as much server load as possible because it only has to send data to the client with minimal processing. I see very little on writing web-apps besides writing it server-side and treating client-side as _only a view_. Why would I ever want to do this? The only advantage I see is that I can write in whatever language I want (http://www.paulgraham.com/avg.html).


HTTP Session or Database approach

I am confused a little as what should be my approach, Working on a design of shopping cart and i need to store shopping cart either in session or in database but not sure which approach would be best.here are the use case   1. User is not logged in and adding product to cart (Anonymous user)   2. User is logged in and adding product to cart. First case is more confusing to me, since there can be many cases where user just visiting web-shop and adding product without logging in and can be quite possible that he might not going for a checkout process. But still we need to create a Shopping-Cart for this user, in order to create and save shopping-cart i have two option.   1. When user adding a product, create a cart in the database and associate this cart with this user, moment he logged in move this cart to logged in user.   2. Create Cart, add product to it and save it to the Session, when user logged in create Cart in the database and associated logged in user with this cart with User. I know that both database driven Cart system as well Session based can have there positive as well negative aspects, but not sure which one might be the best approach taking in to account following points   1. Scalability   2. Flexibility   3. Extensibility   4. Application Should take care of speed Looking for input on this aspect to decide the path.


Need help understanding "An Image Signature for any Kind of Image"

I'm trying to implement the paper titled An Image Signature for any Kind of Image, but I'm having trouble understanding what they mean in this paragraph: > For each column of the image, we compute the sum of absolute values of > differences between adjacent pixels in that column. We compute the total of > all columns, and crop the image at the 5% and 95% columns, that is, the > columns such that 5% of the total sum of differences lies on either side of > the cropped image. We crop the rows of the image the same way (using the > sums of original uncropped rows). First, what do they mean by "sum of absolute values of differences between adjacent pixels in that column"? If start at the top-left pixel and work downwards (down the column), we can compute the difference between (0,0) and (0,1), but what about the next pixel? Am I supposed to compute the difference with just the pixel below, or the pixels on either side, or perhaps even the 4 or 8 neighbours? And then, as I understand it, we sum these differences for each column such that each column is reduced to a single number? Then we use this information to crop the _left_ and _right_ edges of the photo, right?


How often do you take notes, and how are you able to maintain a consistent amount?

I take notes about language features, project details, etc. I've noticed that I tend to take a lot of notes when I start learning a new aspect of a language or start working on a new project, but then as the momentum builds my note taking drops off. I often wish I would take more notes, since I frequently find them helpful months later when I encounter a problem for the second time or when I want to remember some past detail. Do you take a lot of notes? and how do you or don't you maintain the volume of notes you take? My problem is that once I'm going on something, jotting done a note feels like an interruption; even though, I know it will be useful in the future. Any suggestions?


Apache 2 License and copyrighted Libraries

I am working on my first big(ger than before) project at my university which is coded under the Apache 2 License. So here is the question: Can I use copyrighted material/libraries (no restrictions and free to use) inside that project? I want to be specific: The library is flot (flotcharts.org) My guess is yes, but guesses do not count.


C++ skills higher than C skills?

I feel that the often seen C/C++ doesn't really describe my skills in my CV. So I'm planning to separate it into advanced C++ knowledge and mediocre C skills. Do you think this is confusing for the reader? She could think: "C is a subset of C++, so what is this guy trying to tel me?" Well, what I'm trying to tell is: I have done several real world C++ projects while pure C projects where just a hobby thing. Do you agree that a skilled C++ programmer not necessarily is a qualified C guy or do you think that this switch is done easily?


Books on software development career path

Can you recommend books **and other material(video)** on how to build career , what path and wayouts are there in the whole area of software engineering? **What a developer can evolve into?** Some sort of evolution path from development? I m not asking just for 2 well- known directions: project management and freelancing, i m asking for the whole range of possibilities where these skills can be useful I m not asking for stuff about:   * frameworks, languages    * certifications for Microsoft, Oracle etc


Is depending on references a common process or should I be memorizing syntax?

> **Possible Duplicate:**   >  Is it important for a programmer to memorize the syntax of the language? For example I could not write a SQL connection string from scratch if I tried. I always either Google it or copy and paste it from a previous project. For some reason this bothers me, but I don't know if it should or if it's just not a big deal. There are probably other people who can relate and think of other examples as well.


If I have two developer license accounts with Apple, can I easily switch between the two for app development and publishing?

I've been interested in iPhone development since the release of the iPhone, however, I am on a limited personal budget. I've never been willing/able to fork out the money necessary for an iPhone and a Macbook. I know, some may argue that it's not that expensive, but for a hobby it hasn't been worth the price. By some twist of amazing fortune, the company that I work for is wanting me to develop an iPhone and iPod app. This means I am getting pretty much all the hardware you would want to develop on-- an awesome Macbook, Thunderbolt display, an iPhone, an iPad, a few accessories. In short, it's basically my "wish list" that I have dreamt of one day owning. In my free time, I will be allowed to use the hardware to develop whatever software I desire but since my development laptop will primarily be used for my employing companies project I need assurance that any work I do under my own developer license will not affect my developer license associated with my work account. Can I easily switch between two developer accounts when developing and publishing applications? What if one account is a standard one and the other is an enterprise? As of yet, I don't have any hardware or any developer licenses and I'm asking in complete ignorance. Can I do this or will the accounts collide? **REQUESTING UPDATE/SECOND OPINION** Thanks to **mouviciel** for promptly answering this question with a straight- forward response. However, I've been working with with XCode for quite a while and I've also had experience with downloading sample projects and modify them so that I can run them on my iOS device. This lends me to believe that answering my initial question might involve tweaking PList files and other project settings, but should still be doable without having to create a separate account on my Macbook. So I ask again, can I easily switch between two developer accounts when developing and publishing applications, strictly using one account on my Macbook? If the answer is, yes, (which is what I assume is the case) how must I redefine my personal projects which may initially inherit user setting associated with my business account and credentials?


Where can you find your first customers as a freelancer?

I want to start doing freelance work, but no matter how I look at it, it seems like the best way to get customers and to have work most of the time, you have to already be in the freelancing game. Most freelancers I've talked to have had the same customers over the years or got new customers because their satisfied clients referred them. What I'd like to know from the successful people here that work as freelancers is how do you start doing business when you haven't yet set foot in freelancing? I want to start small, creating websites that won't require me to hire other people other than maybe a designer I already know. (I'd like to create desktop applications as well, but I think I should keep that for later when I'm more experienced) . I thought about localized Google ads or visiting companies and meeting the people in charge there, but I wouldn't know which kind of businesses to look for or if it's even a good way to approach this. Anyone care to share their personal startup experiences / advice that can help future freelancers?


Creating a web-end for a C++ program

I was wondering what would be the best method for creating a web end for interfacing with a C++ program on the server. At first I simply thought just using shell execution from the web server side language (like `shell_exec()` in PHP), but I was wondering if there is a "better" way. Maybe something more native or is this a bad practice for some reason?


Algorithm/research on detecting language of text

I am interested in finding an approach that will detect what language a string of text is. As Google translate does.


.NET software design and Oracle ODP.NET UDT

I'm working on a new common .NET software design (mainly) for WCF-based web service applications with related client frontends (all written in C#). As far I've chosen some frameworks (NUnit,Autofac/Castle Windsor) as basis for the application. Now I'm doing some research concerning db abstraction. I'm considering NHibernate (together with FluentNHibernate) as persistence framework. But there are some concerns about NHibernate. Database interfaces provided by our db dev team heavily rely on stored procedures and often use UDT objects as output parameters (sometimes also ref cursors). Many already existing applications are using auto-generated UDT C# classes. NHibernate seems to work well with Oracle (with appropriate configuration and usage of ODP.NET). See Fluent NHibernate - how to configure for oracle?, Fluent NHibernate - Configure Oracle Data Provider ODP. Also ref cursors and stored procedure calls seem to work with nhibernate (see Calling an Oracle store procedure with nHibernate and Oracle stored procedures, SYS_REFCURSOR and NHibernate). Is it appropriate to use NHibernate in this case (stored procedures and UDT/ref cursor output)? Or would it be better to keep auto-generated UDT C# classes and implement custom data access objects? Design A (with auto-generated UDT classes):   * Create business objects in the domain model (e.g. `class Product`)   * Define database-independent interfaces e.g. `IDataAccessProduct`.    * Implement it in classes e.g. `OracleDataAccessProduct` that represent specific data access objects. For example this class calls performs a mapping of auto-generated UDT classes (entities) to `Product` domain objects and vice versa. Design B (with NHibernate):   * Create business objects in the domain model (e.g. entity class `Product : IEntity<Product>`.)    * Add interface an IProductRepository for the repository. In the domain model. Add `ProductRepository` that extends the e.g. base class `Rhino.Commons.NHRepository`.    * Usage of hibernate-mapping for domain objects to db table (`Product.hbm.xml`). So which design would you prefer?


What are the differences between a website and a web application?

How do you differentiate a web application from websites? It's language/platform agnostic.


What is the difference between web designers and developers?

> **Possible Duplicate:**   >  What are the boundaries between the responsibilities of a web designer and > a web developer? Web designers and developers work in the same project, I've been searcing for an hour and can't find what's the difference? I found some slides on Slideshare that discuss the difference, but I'd like more explanation on the topic.


How should I implement an unsubscribe feature for text messages?

On many e-mail subscription lists, the is a link at the bottom that says something to the effect of: > You are subscribed to our e-mail list as you@example.com. To unsubscribe, > click here What is the best way (and is there a way?) to emulate this when sending out mass text messages through SMS gateway?


Dividing 2D grid to most efficient search

## Requirements   1. I have `Grid` of unlimited size (I don't and can't know what its size)   2. There is `Object` that should be placed on the grid, every object have hes stream distance (in other words: range, default: 300) and 2D coordinates (position)   3. There is function `find` that takes 2D coordinates and should return what object are shown It seems that R-tree is the answer to my question, is there any explanation about how exactly the algorithm works? ## My way   1. Dividing the cell sizes to levels, level 1 is 600x600 (2 times bigger than default stream distance), level 2 is 1200x1200 and so on... (every time the cell sizes is multiplied by 2).   2. Associate the objects in the corresponding cell by multiplying the stream distance by 2 and round to the next multiple of 600, for example: stream distance is 450, multiplying it by 2 gives 900, rounding it to the next multiple of 600 gives 1200.   3. Every time object inserted check what cells does the object fit and adding the object to the cell object list.   4. When function `find` get called he search's only in the cell of the given coordinate. [ Assume triangle is an object ] ![enter image description here](http://i.stack.imgur.com/BUWJz.jpg) ## Similar Questions   * Most efficient way of finding entities in a grid? (The accepted answer )


Does switching from one programming language to another cause a loss in experience?

If I was working for a programming language X and want to switch to Y (from Java to C++, or from Java to Objective-c), does this cause my years of experience in the previous languages to be lost (from point of view for companies)? For example, if I was a Senior in X, and want to move to Y, will I start Junior at Y or Senior? I believe that languages are just tools, and the experience is in problem solving and way of thinking, but do companies concern?


Should my async task library swallow exceptions quietly?

I've just learned that .NET 4.5 introduced a change to how exceptions inside a `Task` are handled. Namely, they are quietly suppressed. The official reasoning for why this was done appears to be "we wanted to be more friendly to inexperienced developers": > In .NET 4.5, Tasks have significantly more prominence than they did in .NET > 4, as they’re baked in to the C# and Visual Basic languages as part of the > new async features supported by the languages. This in effect moves Tasks > out of the domain of experienced developers into the realm of everyone. As a > result, it also leads to a new set of tradeoffs about how strict to be > around exception handling. (source) I've learned to trust that many of the decisions in .NET were made by people who really know what they're doing, and there is usually a very good reason behind things they decide. But this one escapes me. If I were designing my own async task library, what is the advantage of swallowing exceptions that the developers of the Framework saw that I'm not seeing?


Programmers and Database Professionals in Performance Based Companies

Anybody here work for a company (or know of someone that does) in the fields of programming or anything related to DBs and not have set work hours? Where you are paid for performance rather than how many hours you sit in a chair at the office? Any project / company I have been apart of always has pretty strict primary hours with the "great opportunity" / expectation to stay until the job is done. Is this type of flexibility really feasible in a group environment in these fields? Would pay for performance work within a company in these fields? With having strict primary hours I notice a lot of inefficiencies. Some weeks or days there is only so much that can be done (for whatever the reason may be) and if your work is done it doesn't help moral to force someone to stay for 8 hrs/day or 40hrs/week if the next week they may have to pull a 60+hr work week. I know that a lot of flexibility can come from working independently or as a consultant so this question really does not encompass those types of positions.


What can I do to let our team have code reviews of branch merges having hundreds of screens worth of Github diffs?

"Code review" (aka "peer review") seems like a really great idea, so my team started practicing it. For a little while it worked well, but then a co-worker merged a branch in, and asked for a review of the code. When I went to review her code, the Github diff page was about 420k pixels in height. Given that my screen is about 500px, that works out to 840 screens worth of code to review. To read the code, fully "grok" it, and write appropriate comments, I probably need an average of one minute per screen, which works out to 14 hours. Now to be fair, some libraries got checked in to this commit, so some portion of that can be skipped ... but even if libraries took up 6 hours worth, that still leaves me with an entire day spent reviewing this merge. That can't be the most effective use of my time. And this is just one merge; we will no doubt have other large merges to review in the future as well. So, my question is, what can I do (either in terms of procedure or in terms of utilizing review tools) to let our team have code reviews of branch merges, while at the same time not eating up entire days on reviews?


Submit issue, pull request, or both for a very small fix?

I've made a 4-line bug fix to a minor issue in a library on github. The project is actively maintained with changes every few days. What is the ideal way to submit a fix that small? Is it to fork, fix and submit a pull request; file an issue _and_ a pull request; or just file the issue with my fix copy-pasted? (Or something else?)


Is hungarian notation a workaround for languages with insufficiently-expressive (i.e. Haskell-style) static typing?

### Edit To be clear, I'm _not_ talking about annotation variable names with the _data_ type, but rather with information about the _meaning_ of the variable in the context of the program. For example, a variable may be an integer or float or double or long or whatever, but maybe the variable's _meaning_ is that it's a relative x-coordinate measured in inches. This is the kind of information I'm talking about encoding via Hungarian Notation (and via Haskell types). ### Original Question: In Eric Lippert's article What's Up With Hungarian Notation?, he states that the purpose of Hungarian Notation (the good kind) is to > extend the concept of "type" to encompass semantic information in addition > to storage representation information. A simple example would be prefixing a variable that represents an X-coordinate with "x" and a variable that represents a Y-coordinate with "y", regardless of whether those variables are integers or floats or whatever, so that when you accidentally write `xFoo + yBar`, the code clearly looks wrong. But I've also been reading about Haskell's type system, and it seems that in Haskell, one can accomplish the same thing (i.e. "extend the concept of type to encompass semantic information") using _actual types_ that the compiler will check for you. So in the example above, `xFoo + yBar` in Haskell would actually fail to compile if you designed your program correctly, since they would be declared as incompatible types. In other words, it seems like Haskell's type system effectively supports compile-time checking equivalent to Hungarian Notation So, is Hungarian Notation just a band-aid for programming languages whose type systems cannot encode semantic information? Or does Hungarian Notation offer something beyond what a static type system such as Haskell's can offer? (Of course, I'm using Haskell as an example. I'm sure there are other languages with similarly expressive (rich? strong?) type systems, though I haven't come across any.)


Designing a self-describing JSON document system

I'm trying to devise a document system for a specific domain involving simple objects (People, Companies, Invoices, etc.) that would also be able to completely describe itself. This self-description ability would ideally be recursive. The document system will be based on JSON, but I believe the principle in question applies to any structured notation. To illustrate what I mean, let's say I have the following JSON document that describes a person (company, invoice, etc. are basically all the same, only with different properties):               {       "Name": "John Doe",       "Email": "john.doe@example.org",       "BirthDate": "1976-07-04"     }      Then, I have a second JSON document that describes the structure of the first one. Let's call this a "Level 1 Meta-document":               {       "Type": "Person",       "Properties": {         "Name": { "Type": "String", "Required": true },         "Email": { "Type": "String" },         "BirthDate": { "Type": "Date" }       }     }      This would be simple enough, if not for the requirement, that system should also be able to fully describe this meta-document. To put it in more general terms: I'm looking for a way to define a self- sufficient "Level N Meta-document", that would be able to describe a structure of the "Level N-1 Meta-documents". **NOTE** : I'd be willing to go with a solution for N = 2, but instinct tells me that a true solution for N = 2 would also work for any N. Now that I think of it, this may be more of a math puzzle than programming one. :) Is this even possible? If yes, can you give me some examples? If not, what are my other options? **EDIT: I've included a naive example of how a "Level 2 Meta-Document" would look, based on the above:**               {       "Type": "MetaLevel2",       "Properties": {         "Properties": { "Type": "Hash", "Required": true }       }     }      The problem with this is that it doesn't describe the object that describes the property details (i.e. the one with the "Type" and "Required" attributes). If I were to include description of those, I'd have to add another attribute **to the very same object I'm trying to describe** :               {       "Type": "MetaLevel2",       "Properties": {         "Properties": {           "Type": "Hash",           "Required": true,           "ValueProperties": { "Type": "String", "Required": "Boolean" }         }       }     }      Unfortunately, this throws me into recursive problem, because I now lack the description for "ValueProperties". In fact, for every new attribute I invent on level N, I have a problem describing it on level N+1 without introducing yet another attribute that needs description. What I'm looking for is a solution that wouldn't suffer from this problem. To be clear: I'm aware of XSD, but I'm not sure how to apply its principles to my case. Unless I'm missing something, XSD would suffer from the same recursive problem. This gives me reason to believe I have a problem with the approach itself.


What constitutes a dead programming language?

Imagine you were elected coroner of IEEE or somesuch governing body and you had to pronounce a programming language as dead. What signs would you look for? Are there any zombie languages out there that don't know they're already dead?


Zend Framework: Should I worry about the details of the MVC implementation?

I've been studying Zend Framework's MVC for a few weeks, and am having a really, really difficult time with it. I'm new to OOP, but I understand OOP in PHP without too much difficulty; I understand how to use some of the packages in Zend's library, etc. I understand interfaces, abstract classes, composition, etc. etc. etc. I understand MVC on a high-level, but does anyone know if/where there is a resource that describes the MVC implementation on the ground level? Or should I just stop worrying about it and try to ignore the mechanics of the implementation initially? I've been working through several books and resources online on the MVC implementation, and it seems extremely complex. (Also, earlier versions had different implementations, making it slightly more confusing to understand). The tack I'm trying to take is what I usually do when I want to understand something: go through it line by line and follow the logic around until it all becomes clear. After trying this over and over (and not getting very far), I'm wondering if I'm not going about this the wrong way. After all, OOP is all about not worrying about the implementation, right? I mean, I hear myself saying that and I cringe. I don't like not knowing what's going on, but I'm finding this extremely complicated, and I would really like to get to the part where I actually create something. From what I can tell, though, Zend is incredibly well-conceived (perhaps too thoroughly well-conceived, if that makes any sense). All of the i's are dotted and t's crossed, which makes it very difficult to dig through (lots of abstract classes, some interfaces, objects being passed here and there, etc.-- hard to follow). But the books and sites I've looked at don't go into significant detail about how the process works, only high level descriptions, or they are outdated and using an different implementation. I would prefer to understand it at a lower level.


Caching strategies for entities and collections

We currently have an application framework in which we automatically cache both entities and collections of entities at the business layer (using .NET cache). So the method GetWidget(int id) checks the cache using a key Widget_Id_{0} before hitting the database, and the method GetWidgetsByStatusId(int statusId) checks the cache using Widgets_Collections_ByStatusId_{0}. If the objects are not in the cache they are retrieved from the database and added to the cache. This approach is obviously quick for read scenarios, and as a blanket approach is quick for us to implement, but requires large numbers of cache keys to be purged when CRUD operations are carried out on entities. Obviously as additional methods are added this impacts performance and the benefits of caching diminish. I'm interested in alternative approaches to handling caching of collections. I know that NHibernate caches a list of the identifiers in the collection rather than the actual entities. Is this an approach other people have tried - what are the pros and cons? In particular I am looking for options that optimise performance and can be implemented automatically through boilerplate generated code (we have our own code generation tool). I know some people will say that caching needs to be done by hand each time to meet the needs of the specific situation but I am looking for something that will get us most of the way automatically.


Two interfaces with identical signatures

I am attempting to model a card game where cards have two important sets of features: The first is an effect. These are the changes to the game state that happen when you play the card. The interface for effect is as follows:               boolean isPlayable(Player p, GameState gs);     void play(Player p, GameState gs);      And you could consider the card to be playable if and only if you can meet its cost and all its effects are playable. Like so:               // in Card class     boolean isPlayable(Player p, GameState gs) {         if(p.resource < this.cost) return false;         for(Effect e : this.effects) {             if(!e.isPlayable(p,gs)) return false;         }         return true;     }      Okay, so far, pretty simple. The other set of features on the card are abilities. These abilities are changes to the game state that you can activate at-will. When coming up with the interface for these, I realized they needed a method for determining whether they can be activated or not, and a method for implementing the activation. It ends up being               boolean isActivatable(Player p, GameState gs);     void activate(Player p, GameState gs);      And I realize that with the exception of calling it "activate" instead of "play", `Ability` and `Effect` have the exact same signature. * * * Is it a bad thing to have multiple interfaces with an identical signature? Should I simply use one, and have two sets of the same interface? As so:               Set<Effect> effects;     Set<Effect> abilities;      If so, what **refactoring** steps should I take down the road if they become non-identical (as more features are released), particularly if they're divergent (i.e. they both gain something the other shouldn't, as opposed to only one gaining and the other being a complete subset)? I'm particularly concerned that combining them will be non-sustainable as soon as something changes. The fine print: I recognize this question is spawned by game development, but I feel it's the sort of problem that could just as easily creep up in non-game development, particularly when trying to accommodate the business models of multiple clients in one application as happens with just about every project I've ever done with more than one business influence... Also, the snippets used are Java snippets, but this could just as easily apply to a multitude of object oriented languages.


What can procs and lambdas do that functions can't in ruby

I've been working in Ruby for the last couple weeks, and I've come to the subject of procs, lambdas and blocks. After reading a fair share of examples from a variety of sources, I don't how they're much different from small, specialized functions. It's entirely possible that the examples I've read aren't showing the power behind procs and lambdas.               def zero_function(x)         x = x.to_s        if x.length == 1         return x = "0" + x        else         return x        end     end          zero_lambda = lambda {|x|       x = x.to_s        if x.length == 1         return x = "0" + x        else         return x        end     }          zero_proc = Proc.new {|x|       x = x.to_s        if x.length == 1         puts x = "0" + x        else         puts x        end     }               puts zero_function(4)     puts zero_lambda.call(3)     zero_proc.call(2)      This function, proc, and lambda do the exact same thing, just slightly different. Is there any reason to choose one over another?


How long to spend estimating programming tasks?

For example, if I break a project into n discrete work products (say classes or functions or components) is there a time t such that n*t is a suitable amount of time to spend on estimation?


Is it better to define all routes in the Global.asax than to define separately in the areas?

I am working on a MVC 4 project that will serve as an API layer of a larger application. The developers that came before me set up separate `Areas` to separate different API requests (i.e `Search`, `Customers`, `Products`, and so forth). I am noticing that each `Area` has separate Area registration classes that define routes for that area. However, the routes defined are not area-specific (i.e. `{controller}/{action}/{id}` might be defined redundantly in a couple of areas). My instinct would be to move all of these route definitions to a common place like the `Global.asax` to avoid redundancy and collisions, but I am not sure if I am correct about that.


Should functions of a C library always expect a string's length?

I'm currently working on a library written in C. Many functions of this library expect a string as `char*` or `const char*` in their arguments. I started out with those functions always expecting the string's length as a `size_t` so that null-termination wasn't required. However, when writing tests, this resulted in frequent use of `strlen()`, like so:               const char* string = "Ugh, strlen is tedious";     libFunction(string, strlen(string));      Trusting the user to pass properly terminated strings would lead to less safe, but more concise and (in my opinion) readable code:               libFunction("I hope there's a null-terminator there!");      So, what's the sensible practice here? Make the API more complicated to use, but force the user to think of their input, or document the requirement for a null-terminated string and trust the caller?