Are there any private code review communities?

Similar to this question Code Review Services, are there any communities out there where I can get my code reviewed. Ideally this would be a private thing between you and the reviewer as it would be large chunks of a full, commercial project, the the whole thing would have to be under NDA or similar. I'm aware of codereview.stackexchange.com but that's not viable as I don't want to put the code in the public domain and the code would be too big for the format of the Q&A site.


How can I promote clean coding at my workplace?

I work with a lot of legacy Java and RPG code on an internal company application. As you might expect, a lot of the code is written in many different styles, and often is difficult to read because of poorly named variables, inconsistent formatting, and contradictory comments (if they're there at all). Also, a good amount of code is not robust. Many times code is pushed to production quickly by the more experienced programmers, while code by newer programmers is held back by "code reviews" that IMO are unsatisfactory. (They usually take the form of, "It works, must be ok," than a serious critique of the code.) We have a fair number of production issues, which I feel could be lessened by giving more thought to the original design and testing. I have been working for this company for about 4 months, and have been complimented on my coding style a couple of times. My manager is also a fan of cleaner coding than is the norm. Is it my place to try to push for better style and better defensive coding, or should I simply code in the best way I can, and hope that my example will help others see how cleaner, more robust code (as well as aggressive refactoring) will result in less debugging and change time?


Online and offline point of sales application

I am going to develop a simple Point of Sales system. Mainly all the data will be stored in a central db (mysql server). All the application are going to be winforms. Together each local client will have its db copy stored locally and all the operation will be based on the local db except for one operation that the transfer of stock between outlet. So at certain interval there will be updates from the local db into the central db. The reason to have the local copy of the db in each client desktop in case there is problem with connectivity with the central server so that business can go on as usual and update once it is online. I need help in deciding the right path to move to solve this solution is my design acceptable or being flaw ?


Multi-platform Mobile Development?

So my question is this: Is there any easy way for a single developer to release an app on iOS and Android? I am a web developer that primarily plays in PHP, Node, Ruby, AS, and JS. I have dabbled a tiny, tiny bit in Objective-C and Java. Basically I am looking for a good way to release a fairly simple app on both Android and iOS and have a uniform UI that is fairly easy to maintain. The app's main purpose is a well designed visual interface (with animation to help convey actions) to a simple backend API. Currently I was looking at using Flex, but want to find out other options if they exist. Thank you!


How useful are IT headhunters/recruiters when looking for a new job?

Since they exist for several fields with varying degrees of usefulness, I'm curious as to the reputation of headhunters/recruiters that focus solely on IT professionals (e.g. programmers, software engineers, CIOs, etc) when it comes to finding a new job. Are they actually useful or is it fairly hit or miss? Does the old adage of only working with a limited number apply or can you safely give you resume/CV to several of them?


How are OSS licenses upheld on unbacked projects?

If an OSS project is not backed (for example, by the Apache Foundation), how is the OSS license upheld? My specific scenario is this: if I create an GPLd mobile application with a non-commercial transformations clause, what's to actually stop someone from re-releasing it as "Pro" and charging for it? I assume the owner of the store (Apple/Google/MS) aren't going to uphold licenses on my behalf. Would it come down to me personally having to pay for a lawyer (which seems like a lot of effort to protect a good will gesture)?


Objective-C Lesson in Class Design

I have the following classes:                  Teacher        Student        Class (like a school class)      They all extend from KObject that has the following code:               - initWithKey     - send     - processKey      Teacher, Student Class all use the functions processKey and initWithKey from KObject parent class. They implement their own version of send. The problem I have is that KObject should not be instantiated ever. It is more like an abstract class, but there is no abstract class concept in objective-c. It is only useful for allowing subclasses to have access to one property and two functions. What can I do so that KObject cannot be instantiated but still allow subclasses to have access to the functions and properties of KObject?


Loop Invariants in Python

I have a bit of experience with loop invariants but I'm not really clear on them. I'm trying to learn them through an example in Python. Can someone point one out or help me understand? I've searched both on programmers.SX and on the web but the only things I could find were invariants and design by contract -- nothing on loop invariants.


Async network programming using Reactive Extensions

After doing some (more-or-less) "low-level" async `socket` programming years ago (in an Event-based Asynchronous Pattern (EAP) fashion) and recently moving "up" to a `TcpListener` (Asynchronous Programming Model (APM)) and then trying to move to `async/await` (Task-based Asynchronous Pattern (TAP)) I've pretty much had it with keep having to bother with all this 'low level plumbing'. So I was figuring; why not give `RX` a go (Reactive Extensions) since it might fit more snugly to my problem domain. A lot of code I write has to to with many clients connecting over Tcp to my application which then start a two-way (async) communication. The client _or_ server may at any point decide a message needs to be sent and do so, so this is not your classic `request/response` setup but more of a real-time, two-way, "line" open to both parties to send whatever they want, whenever they want. (If anyone has a decent name to describe this I'd be glad to hear it!). The "protocol" differs per application (and isn't really relevant to my question). I do, however have an initial question:   1. Given that only one "server" is running, but it has to keep track of many (usually thousands) of connections (e.g. clients) each having (for lack of a better description) their own "state machine" to keep track of their internal states etc, which approach would you prefer? EAP/TAP/APM? Would RX even be considered an option? If not, why? So, I need to work Async since a) it's not a request/response protocol so I cannot have a thread/client in a "waiting for message"-blocking call or "sending message"-blocking call (however, if the send is blocking for that client only I could live with it) and b) I need to handle many concurrent connections. I see no way of doing this (reliably) using blocking calls. Most of my applications are VoiP related; be it SIP messages from SIP cients or PBX (related) messaging from applications like FreeSwitch / OpenSIPS etc. but you can, in it's simplest form, try to imagine a "chat"server trying to handle many "chat"clients. Most protocols are text based (ASCII). So, after having implemented many different permutations of aforementioned techniques I would like to simplify my work by creating an object that I can simply instantiate, tell it on which `IPEndpoint` to listen and have it tell me whenever something of interest is going on (which I usually use events for, so some EAP is usually mixed with the other two techniques). The class should not bother trying to 'understand' the protocol; it should merely handle incoming/outgoing strings. And thus, having my eye on RX hoping that would (in the end) simplify the work, I created a new "fiddle" from scratch:               using System;     using System.Collections.Concurrent;     using System.Net;     using System.Net.Sockets;     using System.Reactive.Linq;     using System.Text;          class Program     {         static void Main(string[] args)         {             var f = new FiddleServer(new IPEndPoint(IPAddress.Any, 8084));             f.Start();             Console.ReadKey();             f.Stop();             Console.ReadKey();         }     }          public class FiddleServer     {         private TcpListener _listener;         private ConcurrentDictionary<ulong, FiddleClient> _clients;         private ulong _currentid = 0;              public IPEndPoint LocalEP { get; private set; }              public FiddleServer(IPEndPoint localEP)         {             this.LocalEP = localEP;             _clients = new ConcurrentDictionary<ulong, FiddleClient>();         }              public void Start()         {             _listener = new TcpListener(this.LocalEP);             _listener.Start();             Observable.While(() => true, Observable.FromAsync(_listener.AcceptTcpClientAsync)).Subscribe(                 //OnNext                 tcpclient =>                 {                     //Create new FSClient with unique ID                     var fsclient = new FiddleClient(_currentid++, tcpclient);                     //Keep track of clients                     _clients.TryAdd(fsclient.ClientId, fsclient);                     //Initialize connection                     fsclient.Send("connect\n\n");                          Console.WriteLine("Client {0} accepted", fsclient.ClientId);                 },                 //OnError                 ex =>                 {                      },                 //OnComplete                 () =>                 {                     Console.WriteLine("Client connection initialized");                     //Accept new connections                     _listener.AcceptTcpClientAsync();                 }             );             Console.WriteLine("Started");         }              public void Stop()         {             _listener.Stop();             Console.WriteLine("Stopped");         }              public void Send(ulong clientid, string rawmessage)         {             FiddleClient fsclient;             if (_clients.TryGetValue(clientid, out fsclient))             {                 fsclient.Send(rawmessage);             }         }     }          public class FiddleClient     {         private TcpClient _tcpclient;              public ulong ClientId { get; private set; }              public FiddleClient(ulong id, TcpClient tcpclient)         {             this.ClientId = id;             _tcpclient = tcpclient;         }              public void Send(string rawmessage)         {             Console.WriteLine("Sending {0}", rawmessage);             var data = Encoding.ASCII.GetBytes(rawmessage);             _tcpclient.GetStream().WriteAsync(data, 0, data.Length);    //Write vs WriteAsync?         }     }      I am aware that, in this "fiddle", there is a little implementation specific detail; in this case I'm working with FreeSwitch ESL so the `"connect\n\n"` in the fiddle should, when refactoring to a more generic approach, be removed. I am also aware that I need to refactor the anonymous methods to private instance methods on the Server class; I'm just not sure what convention (e.g. "`OnSomething`" for example) to use for their method-names? This is my basis/starting-point/foundation (which needs some "tweaking"). I have some questions about this:   1. See above question "1"   2. Am I on the right track? Or are my "design" decisions unjust?   3. Concurrency-wise: would this cope with thousands of clients (parsing/handling the actual messages aside)   4. On exceptions: I'm not sure how to get exceptions raised within clients "up" to the server ("RX-wise"); what would be a good way?   5. I can now get any connected client from my server class (using it's `ClientId`), assuming I expose the clients in one way or another, and call methods on them directly. I can also call methods via the Server class (for example, the `Send(clientId, rawmessage)` method (whereas the latter approach would be a "convenience" method for quickly getting a message to the other side).   6. I am not quite sure where (and how) to go from here:      * a) I need to handle incoming messages; how would I set this up? I can get the stream ofcourse, but _where_ would I handle retrieving the received bytes? I think I need some kind of "ObservableStream"-something I can subscribe to? Would I put this in the `FiddleClient` or `FiddleServer`?     * b) Assuming I want to avoid using event until these `FiddleClient`/`FiddleServer` classes are implemented more specifically to tailor their application specific protocol handling etc. using more specific `FooClient`/`FooServer` classes: how would I go from getting the data in the underlying 'Fiddle'-classes to their more specific counterparts? Articles/links I already read / skimmed / used for reference:   * Consume a Socket using Reactive Extension   * Creating and Subscribing to Simple Observable Sequences   * How to add or associate context to each ObservableTcpListener Connection/Session   * Asynchronous Programming with the Reactive Framework and the Task Parallel Library — Part 1, 2 and 3.   * Using Reactive Extensions (Rx) for socket programming practical?   * A .NET Rx Driven Web Server and .NET Rx Driven Web Server, Take 2   * Some Rx tutorials


Are you a member of a trade union?

Are you a member of a trade union? Why? Why not? If you are, and don't mind mentioning it, which one? Do you know of any programmers who were helped by being in a union, or would have been helped by being in a union? Do you know of any programmers who were hindered or would have been hindered by being in a union?


Today VS 2010 SP1 comes out, any news on the roadmap for Visual Studio 2012?

Today Visual Studio 2010 SP1 comes out as general availability release. This made me wondering about the upcoming release of Visual Studio 2012: What are Microsoft's plans for Visual Studio 2012? I heard they'll come with a new version every two years. Are there any open fora or discussions? When will a preview be publicly available? But most importantly: what are the new highlights, improvements in .NET and C#/F#/VB (and C++ of course, request from Stijn)?


Event Driven Programming: A sequence of unfortunate events

I have a very basic game loop whose primary purpose is to check for updates & changes to a list. I have contemplated using event driven programming to replace the game loop/list idea with an ObservableCollection, however I just have this big cloud of doubt on event driven programming. I'm posing these questions to those with experience with event driven programming:   1. What are good ways to test & build an event driven programming design?  That is, how will I know that I cannot run into "a sequence of unfortunate events"? I want to avoid the events I didn't plan for.   2. Are there unit tests schemes to test event driven programming? Because I have little reputation at the time of asking this question, I can't post more than two links: Observable collections are found at: http://msdn.microsoft.com/en-us/library/ms668604.aspx


Agile Development - Questions with regards to documentation

In an agile project -   1. I assume user requirements are captured in terms of user story. Is this correct?   2. How are system requirements encompassing all the constituent applications documented (in case of a large project)?   3. Are there any specific tools used?    4. Is it a good idea to capture system requirements as child user stories under a main user story?    5. Should individual component teams produce SRS document containing requirements specific to the component team?    6. Should there be a low level design document or will it be part of SRS document?


Measuring "novelty" of data

I have a heuristic in mind that should allow me to "score" data based on "novelty" that I would like to work in real-ish time. In this case, I mean novelty in the sense that the data source is something like a video and I want to know when there is a statistically significant change in the stream. For example, consider a video of a scene where the camera is turning to the right. As long as the velocity of the turn is constant, the data should be considered to be not-novel, or uninteresting. If a bird flies past in the opposite direction, then _the parts of frame where the bird is flying past_ would be considered novel, and would be assigned a high score. If the scores were assigned per 16x16 block of pixels, when the bird reached center frame it might look like:               0 0 0 0 0 0 0     0 0 0 3 1 0 0     0 0 0 0 1 0 0     0 0 0 0 0 0 0      As I understand it, there are algorithms that can do part of this for video compression, block Motion compensation and Global motion compensation, but the result of these algorithms seems to be a difference image that I would then need to digest further (average of differences), when all I want is a simple hash. That is, given the above 7x4 matrix:               0x00003200      The very first frame of the video, having no history, would be maximally novel:               0xFFFFFFFF      The cool thing would be to assign a score to the whole frame, and then for interesting frames break that up into smaller blocks, and for the interesting blocks another set, and so on, like a quadtree. So to summarise, is there a short-cut to get from a series of frames to a single hash value for each frame, based on the most recent frames? Or is there a better way to do this that I'm not aware of? **Further refinements** Reusing the example matrix above, where there is a _3_ the sample is more novel because the block where the bird is in this frame didn't have a bird there before, whereas the samples with a _1_ are still somewhat novel because there is no longer a bird there, but not as much because that block has returned to what would be expected in the background. This leads me to believe that there should be some kind of accumulating effect in the solution, because more than the very last frame needs to be taken into account.


How do I handle priority and propagation in an event system?

Let's say I have a simple event system with the following syntax:               object = new Object();     object.bind("my_trigger", function()  { print "hello"; });     object.bind("my_trigger", function()  { print "hello2"; });     object.trigger("my_trigger");      How could I make sure hello2 is printed out first? (I do not want my code to depend on which order the events were bind). On top of that, how would I prevent my events from propagating? (e.g. I want to stop every other event from being executed)


Licensing on forked projects

I forked a project that hasn't been maintained for a while now. I have a lot of changes I'd like to implement and want to actively maintain the project and keep it open source. How does the licensing work for situations like this? The original project is licensed under MIT and I would like to keep it that way. Would I be able to change the licence's copyright holders or would it have to stay the same?


C++ For C# programmers

I need to learn as much C++ as possible, I'm a senior C# developer. Is there any good tutorial for that? Or a book? And will it be difficult to learn C++? If you ask what I will do with C++, I have to get enough ability to make video processing application or image processing applications and whats the time period for that?


How does a CLI-oriented programmer's workflow differ from a GUI-oriented one?

I've heard a lot about the advantages of doing less programming work in GUI apps and using more command-line tools (especially with regard to getting things done more efficiently). However, since I don't understand how my workflow would be _different_ if I depended more on command-line tools, I can't readily evaluate whether there's enough of a payoff for me personally to invest time and effort learning a new toolset and changing my workflow. Right now:   * I code some side projects in languages like C/C++/D/C#/Java/Python using Visual Studio, Eclipse, etc., and run them by setting up the build settings, and pressing F5 to build/run.   * I'm developing a web program at work, so that involves using Django to set up a server, connect to a database, etc... almost all within the SciTE text editor.   * For launching regular programs, I use Launchy... still no terminal. :)   * For copying files and whatnot, I use a regular find/move in the graphical file manager (Windows Explorer, Nautilus).   * Debugging: I use either Visual Studio or Debugging tools for Windows (if I'm on Windows). I haven't done much debugging on Linux, but for the things I've done, I've used Eclipse (also for Java on Windows).   * At work: To connect to the build system and set up a project, I just use tools that have been integrated into Eclipse for my use -- no need for a terminal or anything (although I'm certainly welcome to use a terminal if I indeed want to) What is it like to do these things in CLI? Which parts become more/less efficient? Which aspects of my workflow would need to be changed to get the greatest advantage from a shift to working mostly in CLI? In other words... **If you magically transformed me into a command-line guru, how would my new coding workflow be different from my current, GUI-centered, way of doing things?**


What are concrete examples of use cases of linked lists?

A linked list can be used when you want cheap insertion and deletion of elements and when it doesn't matter that the elements aren't next to each other in memory. This is very abstract and I would like to see some concrete examples of when a linked list is used rather than an array. I'm not very experienced with programming, so I haven't got much (if any) real-world experience.


End-to-end tests versus unit tests, should tests be decoupled?

At our company we typically make sure that we write an end-to-end test for our websites/web apps. That means we access a URL, fill in a form, submit the form to another URL and check the results of the page. We do this to test form validation, test that the HTML templates have the correct context variables, etc. We also use it to indirectly test the underlying logic. I was told by a co-worker that the reason for this is that we can rip out and change the underlying implementation at any point as long as the end-to-end tests pass. I'm wondering if this sort of decoupling makes sense or if it's just a way to avoid writing tests for smaller units of code?


A programming language that allows you to define new limits for simple types

Many languages like `C++`, `C#`, and `Java` allow you to create objects that represent simple types like `integer` or `float`. Using a class interface you can override operators and perform logic like checking if a value exceeds a business rule of 100. I'm wondering if it's possible in some languages to define these rules as annotations or attributes of a variable/property. For example, in `C#` you might write:               [Range(0,100)]     public int Price { get; set; }      Or maybe in `C++` you could write:               int(0,100) x = 0;      I've never seen something like this done, but given how dependent we have become on data validation before storage. It's strange that this feature hasn't been added to languages. Can you give example of languages where this is possible?


Is the MSDN sufficient for taking MCPD exams?

I've been approved by management to begin taking the MCPD exams (re-imbursed by them). I've been developing in .NET since 1.1, but just to make sure I'll be going through the training kits so that I don't miss any areas that I haven't had much need to use in the past. The first exam I'll be taking is WCF and I must admit, I've only developed some simple services in the past and it's probably one of the weak points of my development repertoire. There is also currently no book available for WCF on .NET 4. Aside from there being no practice exams, would this: http://msdn.microsoft.com/en-us/library/dd456779.aspx be sufficient/efficient for studying to take the exam? If not, could you suggest any resource that might be? I have a copy of Lowy's Programming WCF Services that a friend lent me, but it's for .NET 3.5. Note: If you're suggesting resources, keep in mind that I'm looking to learn and understand WCF full and not looking _just_ to pass the exam, though the latter is definitely a focus/goal.


Does ORM promote database de-normalisation?

Doctrine and Propel both make use of single and concrete table inheritance to map object relationships. The former sees all possible fields in the class tree mapped to a single table - whereas the latter maps each class to a specific table, duplicating common fields in the inheritance hierarchy. While this facilitates the ORM apparatus, it suggests bad database design to me. Are these bad design patterns to enforce on a database?


how to manage a release of both sw and config data

in my repository I've got a sw and a cfg(config) folder under trunk, I'm thinking that when I release I'll branch both of these to the releases folder e.g. v1 of my app, with London config data. If I want to release v1 of my app to NewYork too then I'm thinking I'll branch my config data off of main and adjust it in the release folder. Does this sound ok? have I missed something? I want to be able to tell 12 months from now which city has which version of the app, and be able to support their config data too. Cheers               Trunk       sw         qweqwe.cs, asdasd.cs etc.       cfg         setupData.inixmlwhatever          Releases       London         sw@v1         cfg - London config data            NewYork... app at v1, NewYork cfg       Milan... app at v2, cfg data the same as London's but called milan.cfg       Tokyo... app at v2 but with a Tokyo specific patch, with cfg data the same as Milan      of should I go:               Trunk         sw         cfg          Releases         swV1         swV2         cfgTokyo         cfgLondon         cfgMilan      With this latter one, I don't know what version of the app's installed in London etc? I could use tags to get round this, but then someone might shift the tag. With the former, I've got loads of appV1's kicking about (which I'm ok with, branches are cheap etc. but it looks less organised). Cheers


Benefits of TOGAF or similar?

I can read the website blurb and be impressed by the alleged benefits, but I haven't worked anywhere or with anyone who followed the TOGAF (or any alternative) architecture framework. Our organisation has declared itself dedicated to moving from what is currently a fairly shambolic design & development model towards something approaching a modern structured process. Things like TOGAF have been mentioned as helping achieve a world-class enterprise development environment (!) but I'm convinced that no-one here really understands the real-world benefits that wholesale adoption might bring and, perhaps more importantly, the effort/pain required to achieve the same. Do you have experience in using TOGAF or similar to wrestle control in an organisation? Do you think that use of the framework brought any benefit? **Edit** : For clarification TOGAF is "The Open Group Architecture Framework", a detailed method and set of tools for developing an enterprise architecture. See: http://www.opengroup.org/architecture/togaf8-doc/arch/


Old Browsers and Polyfills

# Polyfilling, when is it too much? I've summed up this question into one sentance. Is it practical to polyfill all of the IE8 deficiencies with one solid javascript file, as in, would there be any drawbacks (performance) or blockages (impossibility to polyfill some features)? **Question Deprecation: (history)** _I've been working with my company for about half a year now, and we've constantly been fighting with clients on upgrading their browsers. Everyone is of the mind that moving to a newer browser is only going to introduce more problems than solutions (they have internal, old web applications designed for in-house work)_ _I'm at the point where I've had to hunt down and polyfill so many things with IE8 that I'm wondering if there is any draw-back to polyfilling every deficiency that IE8 has (or at least making it so that the javascript doesn't error/fail)_ Is it unreasonable to expect to be able to polyfill all of the deficiencies in older outdated browsers such as IE6-IE8, or would that be a bad idea (performance? stability?)... _If this is a possibility, how come there are no full-feature polyfill libraries, everyone will point to "modernizr", that is FEATURE DETECTION, and offers no polyfills of it's own._ _So, wheres the IE8 master/full polyfill library hiding, or am I gonna have to slave over this?_ Edit: the reason why I'm not just picking out the parts I need, is because there might be deficiencies we are not aware of, I'd love to have a fix-all for Internet Explorer, so if this doesn't exist I'm going to make it myself.*


Modeling user in MongoDB

Our team is learning to work with MongoDB. We have to model the **user** among other things for an OAuth-based application. We know how to model in the relational world, but are unsure about how to do it in NoSQL. In our application we identify the user **uniquely** by her **email address**. Email addresses are naturally unique and also verifiable. The email address seems to be a good candidate for a key. We don't model the person. We don't have the possibility to identify a person, only her email address. That means, if a person has more than an email address, she would have several documents in the database. Also if she changes her email address she would use a different document. And also, because people login with OAuth, there's no concept of them managing their data. There's no password, and the user name is given by OAuth. Why not using the email adress for a collection's primary key `_id`? Like this:               {       _id: "john.doe@example.com",       name: "John Doe",       provider: "example.com",       comments: [         // all comments       ]     }      What are the pros and cons of such an approach? **Edited to clarify the difference between _person_ and _user_**


Getting started with AI (Artificial Intelligence)

I recently got interested in Artificial Intelligence. In my daily life I am a software engineer at a company that develops mobile apps. I am wondering what is the best way to read up on AI? What are 'must-read' books for information about AI?


Comparing performance of different C++ self-made tree data structures

I have two tree data-structures that I made in C++ , and they give a response for range queries/point queries in that program. I am using Ubuntu. I need help in understanding the way to compare the performance of these two data structures (for answering the query in that program) in external memory. How can I do this? I searched a lot on the Internet, and I didn't find any clear idea on how this is done. I know I can measure disk I/O, memory consumption, CPU usage, etc. using Ubuntu's dstat, and iostat commands. I need some accurate and professional way to do this.


How does GDI/+ work and can it be replaced with my own code?

On wikipedia it says that GDI is an API and core operating system component responsible for representing graphical objects and transmitting them to output devices. I'm not finding much on what GDI+ actually does so I'm wondering, is GDI+ replaceable with gui frameworks like wxWidgets and GTK+ or are those frameworks rather built on top of GDI+? When drawing to screen with GDI+ it seems it makes sure one doesn't draw outside of the application's window. Is it actually GDI+ doing this and if not, what is? If it is GDI then doesn't everything have to go through GDI+ to promise this functionality and not let applications paint anywhere they want? Where does the framebuffer come into all of this? I would imagine that whatever controls the coordinate transforms controls the framebuffer as well. However it seems applications have much control of framebuffers and how to use them. I see that OpenGL has multiple types of framebuffers and functions for generating framebuffers, deleting them, ect. And I'm reading that they are stored in video memory. I would imagine that gui frameworks that are not as heavily involved with the GPU don't store theirs in video memory. So how does this stuff work and interact with the transformations?


Improving the efficiency of containers with dynamically allocated objects

This is not strictly related to C++ but its type system serves to illustrate the problem well. Assume:   * We have a generic template `Container<T>` (such as a `std::vector<T>`) which stores an unspecified number of elements of the same type `T` on the heap. Each element is allocated and deallocated via the constructor and destructor of `T`.   * A type `M` that stores `m` elements on the heap (so `M` itself is a kind of container). However, the value of `m` is not known at compile time, so it cannot be used as a template parameter to `M`. Problem:   * If we try to use a type `Container<M>`, accessing the elements of `M` inside this container would require two pointer dereferences, which in general has worse performance than if all elements of `M` were laid out contiguously. Non-ideal solution:   * Create a separate class `ContainerFixed<T>` that manages the memory of `T` directly, if `T` is assumed to have the same size throughout the container. `T` would also have to exchange information about its storage with the containing class. However, if we implement another kind of container, then we have to repeat this process again. The problem arises because the container class is oblivious of the storage requirements of `T` so it defers the allocation to `T` itself; if the container had known that `T` only requires a fixed (though not known at compile time) number of elements then this issue could have been avoided. Now I feel as though that if there was some way to communicate to the container that `M` has a definite size `m` (as in `M<m>`, which is not legal in C++), then from the type signature of `Container<M<m> >` one can potentially deduce that a faster allocation scheme is possible. (It's a bit like dependent types, in a way.) That is, any `Container1<Container2<m> >` can be allocated more efficiently as a "flattened" container. What would be a more general solution to this problem? I don't think this is something that can be easily solved in C++ (feel free to prove me wrong), so I would certainly like to hear if this is something that other languages can solve in a much simpler way (perhaps with more sophisticated type systems).


Which is faster NSDictionaries or object properties?

If I abandon creating model objects which I only use to pass information and use NSDictionaries instead and have constant for keys in the same place where I am using the model, then does it have any impact on performance ? **For example:** If I start passing NSDictionaries to custom cell's instead of creating Model classes for the cell, will it be fine if I am not providing any methods in the class of that model. I have seen this a lot in iOS APIs like NSNotifications. I have rarely seen this in Java where collections are being used as an integral part of an API.


When should we stop work and make tool?

As a software engineer, we are always eager to get effective tools to boost our productivity. And in our daily work, we are often unsatisfactory with the existing tools and would like to have better ways such as better GDB script config, Vim script and some Python script to make boring things automatic. However, it is actually a trade-off since making tools also needs time and energy. It does not give productivity boosting immediately. Therefore, how do you judge whether it is time to stop work and to make some tools to ease your future pain?


Origins of code indentation

I am interested in finding out who introduced code indentation, as well as when and where it was introduced. It seems so critical to code comprehension, but it was not universal. Most Fortran and Basic code was (is?) unindented, and the same goes for Cobol. I am pretty sure I have even seen old Lisp code written as continuous, line- wrapped text. You had to count brackets in your head just to parse it, never mind understanding it. So where did such a huge improvement come from? I have never seen any mention of its origin. Apart from original examples of its use, I am also looking for original discussions of indentation.


How relaxed (or not) should a sprint be?

What should be the attitude towards getting stories done that are assigned to a sprint? Obviously you want to prioritize getting them done in the sprint, but to me the whole point of agile is to be dynamic: You don't want to deliberately procrastinate or make it "ok" to miss finishing user stories in a sprint, but at the same time when unexpected things come up, and those stories do not get completed and are pushed to the next sprint, you don't want the feeling that you did something wrong. That shouldn't be a scary or negative experience, should it? Are negative/scary experiences acceptable for missed sprint commitments? Should developers be held accountable for missed sprint commitments when unexpected tasks come up that must be dealt with (Eg. production support)?


Un-Explainable Bugs?

I've encountered bugs that are extremely difficult to reproduce reliably and/or explain definitively, but that _appear_ to be solved. When this happens, how much time should I spend chasing it down? Example: this SO question and this related jQuery forum post, which offer differing solutions. The issue was reproducible intermittently until the change I discuss in the SO question, and not at all after the change. If I don't conclusively understand what caused the bug, can I claim with confidence that it won't come back in the future by surprise?


Determining Cost of API Calls

_[This is a cross-post originally posted by me in SO. I think the question is more appropriate here.]_ I was going through the adwords API and came across their rate sheet - http://code.google.com/apis/adwords/docs/ratesheet.html . They charge $0.25 per 1000 API units and under the 'Operation Costs' sections list the cost (in API units) of different API calls. I am curious - based on what factors do they (and others API developers) calculate the cost of an API call? Is there any simple formula or a standard way to determine this? **Note** : When I say 'cost' of an API call, I don't mean the money but the API units. For example, how do you determine one API call costs 100 'units' and another 1000? * * * **Expanding my original post** : Each API call will consume a specific amount of CPU cycles, memory and bandwidth on the server (and perhaps some other metric I haven't thought of). I would specifically like to know what tools / methods are available to determine these metrics if the API is developed using (any of the below combination): Perl, Python, PHP, .net, Ruby (or some other language). Postgres, MySQL, MS SQL Server, Firebird, SQLite (or some other database). Apache, IIS (or some other webserver). Windows, Linux (or some other OS).


Copyright notice in CSS or XML files

I'm currently working on an open-source project. Currently, we put our copyright notice at the top of every Java source file. I was wondering whether it was advisable or common practice to put copyright notices in CSS or XML files.


Creating objects with user-defined variable names

**Context:** I am making a learning project in XNA. What I would like to be able to do is allow the game to be moddable by allowing the users to place arbitrary values into a JSON data file which is read into the game. The thing is that I want to avoid hardcoding if possible _and_ have it automagically work for whatever the user throws at the engine. **Problem:** I have no idea how to design class(es) that can accommodate this sort of behavior, as my understanding is that whatever loads the JSON has to map it to existing variables on the object:               public class SomeGameEntity     {         public float Strength { get; set; }         public bool IsStrong { get; set; }     }      But what I want is for the client code to be able to do something like:               SomeGameEntity.Stats["Strength"] = 16;     SomeGameEntity.Stats["IsStrong"] = true;      **My Solution:** Upon consideration, I would only define a few valid data types, likely **float** , **bool** , and **string** (other types, such as `XNA.Color`, would probably have to be inferred from a combination of RGB floats on the object.) Thus, what makes sense is to create a class such as the following:               public class EntityStatComponent     {         private readonly Dictionary<string, float> _floatValues;         private readonly Dictionary<string, string> _stringValues;         private readonly Dictionary<string, bool> _boolValues;              public float GetValue(string name) { }         public void SetValue(string name, float value) { }              public string GetString(string name) { }         public void SetString(string name, string value) { }              public bool GetFlag(string name) { }         public void SetFlag(string name, bool value) { }     }      But, this seems like a heavy-handed approach, especially with _three dictionaries per active object_. I would probably say there are less than 250 objects onscreen at a time (characters, projectiles, etc). Unfortunately, I don't think generic typing is the way to go for this, since for T, it would have to accept a single data type into the dictionary. Alternatively, if I allowed any T value to be used via the get/set method, I would have to use the `if(someArg is float)` stuff, which I understand to be frowned upon. Am I overlooking something, or is there a better way to do it?


Starting Development with Python

I'm currently a beginning developer (3 years). I have been mainly doing Web Development for as long as I have been developing. This is my comfort zone when it comes to programming. I like both JavaScript and PHP because they are easy to use; however, I would really like to further my knowledge when it comes to programming. I've been doing some research on many different languages just getting to know the look and feel of other languages. I like C as it has a similar syntax to JavaScript. I also like Ruby and Java. However, I think I need to learn one at a time. I have decided on Python because of its clean syntax and the fact that a lot of people consider it a good beginner language. ### My Problem I'm coming from languages that are both easy to learn and use (JavaScript and PHP). For example, for JavaScript all you need is:               <script type="text/javascript">         //script here     </script>      And you can execute a script and you can do things such as DOM manipulation. For PHP all you need is a server that has PHP installed and you can use:               <?php         //script here     ?>      You can then just execute it either through AJAX or a request in a form. I don't understand how to use Python. I don't believe you can just do AJAX requests with `python` files like you can with `PHP` files. What can I do with Python? Or do I use it? What have you made using it?


Why should we preferably use first class collections?

As per rule number 4 of Object Calisthenics by Jeff Bay (RTF) in The ThoughtWorks Anthology, it is recommended that one should " **Use first-class collections** ". > **Rule 4: First class collections** > > Application of this rule is simple: any class that contains a collection > should contain no other member variables. Each collection gets wrapped in > its own class, so now behaviors related to the collection have a home. You > may find that filters become a part of this new class. Also, your new class > can handle activities like joining two groups together or applying a rule to > each element of the group. What I could understand from this was that we should use a separate class wrapping up the collection and with methods to add,delete modify data of that collection. and We need this so that we are sure of what datatype goes into the collection and what comes out. In case we use generic collection (in languages where it is applicable), do we need to follow this rule? If I am missing an important significance, please clarify.


Is there a name for this tree variant?

So I've created (and I'm sure someone else has come up with this before - I'm not claiming to have invented it) a data structure which consists of a binary search tree, only instead of each node having a single left and right child, they have two `Map<string, Node>` for the left and right, and the parent has a similar `Map<string, Node>` for the roots. When you create the tree, you give it a list of strings, which are the names of fields on the object you are storing on the tree. It creates one empty root for each name. When you insert an object, it is placed in each of the trees and sorted based on the data in that field. (The language in this case is C#, but it could be done in any OOP language. Storage should be by reference, so each object exists only once, but is referenced in multiple trees) So if I had an object like so:               class myObject     {         Map<string, object> attributes;         ...     }      And the map has one object (which must implement `IComparable`) for every string in the list of keys the tree uses. The benefit is that I can now choose a string as my sort-key, and quickly traverse through my tree in sorted order based on any of the sortable attributes. Likewise, I can perform a search on the tree based on any of the sortable attributes in O(log n) time. (A standard BST would allow this only on the single sort-key.) I've called mine a `MultiTree`, but I looked it up and that has another meaning which seems to be entirely unrelated. But I can't come up with a better name for it. Does this structure have an established name already?


How to compute scrum burndown chart when projects overlap?

In my team we have a multiple projects, some short term and some long term. The team is required to deliver these projects on different dates and the effort to deliver these is run in parallel with the team working on stories for more than one project during each sprint. When trying to compute our burndown we aren't sure what to do. As the team is split between projects the velocity can change dramatically week-on-week as people shuffle to the tasks best suited for their specialty across the projects. This makes it difficult to create a reliable and meaningful burndown chart for each project. However if we combine the stories into a single burndown chart how can we track against the release if the release dates are different and it isn't obvious which points remain for each project. Is there a good method for dealing with this?


Ip address filtering on valid user group : should we include the ip address of developers?

Imagine if your development team were asked to develop a system. The system should only response to some particular user groups such as "Group A", "Group B" or "Boss" who are the actually users of the system. If you receive a phone call from the user saying that the system crash upon some particular situation/parameters. You tried to reproduce the problem and discovered that you Ip was filtered because there are not any valid user groups which include you/your team. You cannot even reproduce the crash and you go to ask the caller if you can borrow his/her PC to reproduce the problem at once. After this, would you think adding a new valid group such as "Developers" would be necessary?


Most efficient multiple condition IF statement

I am using a function to compare over 100 variables inside of classes to each other an am curious if one method of comparing multiple condition statements is more efficient than another. I am currently considering one of these methods. I think the 'single If using And/Or' looks the cleanest but performance is more important. (my code is VB.Net) Multiple ElseIf               If Not ClassA.num = ClassB.num Then         Return False     ElseIf Not ClassA.str = ClassB.str Then         Return False     Else : Return True     End If      Single If using And/Or               If Not ClassA.num = ClassB.num Or        Not ClassA.str = ClassB.str Then            Return False     Else : Return True     End If      Nested If               If ClassA.num = ClassB.num Then         If ClassA.str = ClassB.str Then             Return True         End If     End If     Return False      Edit: Changed second code snippet from And to Or Edit 2: Changed third snippet from If Not to If


How do we go from assembly to machine code(code generation)

I know this is abstract as it's all about signals and switch - (electronics) - underneath, but is there a easy way to visualize the step between assembling code to machine code. For example if you open about a binary file in notepad you see a textually formatted representation of machine code. I assume that each byte(symbol) you see is the corresponding ascii character for it's binary value? There is still a part of the puzzle though that I am missing and I can't even explain exactly what that is. I have seen assembler source code(written in C) which obviously uses the C libraries put, getc, write functions etc, to actually generate the machine code. But how do we go from assembly to binary, what's going on behind the scenes?? I mean C/C++ or any language is essentially binary in itself as it's all signals and switches, key and mouse presses. I guess assembling is really organizing the bytes into a structure that is logical to the hardware.


How much do they study in the best universities, relative to the other universities?

In my university, our total required weekly attendance (for lectures and tutorials/similar) is about 12 hours. It was like that in the first year, and then everything required extremely little effort - I believe that if I invested as much efforts as someone who is studying for medicine or law, I could have learnt everything for 1-2 months - if not less! Now I'm second year and it doesn't look like it's going to be too different. This concerns me about the people who study in Oxford, Cambridge or Imperial College. It would be weird if they study that little, and it would be very concerning if they do study very hard, because this would mean that by the end of the year, their first year students will be better than our average third year student. Which is bad news for me, given that I share the market with them. I know the question can't have an absolutely accurate answer, but it can still be answered quite definitely, and it's relevant to many people.


Cocos2d-X is a game engine framework based on Cocos2d-iPhone, which consists of expanding supported platforms, with multiple choice of programming languages thats shares the same API structure. What is be better Project Resource Organization and Structure at Cocos2d-X Development?


Using Hibernate Criteria framework for complex queries vs. just making views in DB

I like using `Hibernate` for regular simple `CRUD` operations. However, I am trying to understand why anyone would resort to its `Criteria` framework to assemble complex recordset criteria as opposed to simply creating a view at the database level. E.g. here is a paraphrased snippet I am working with:               Criteria tableCriteria = session         .createCriteria(SomeEntity.class)         .add(Restrictions.eq("someID", someID))         .add(Restrictions.gtProperty("scoreOne", "scoreTwo"))         .add(Restrictions.gt("scoreThree", scoreThreeMin))         .add(Restrictions.or(Restrictions.eq("inactive", Boolean.FALSE), Restrictions.isNull("inactive"))).addOrder(Order.asc("ordCol"))      From the naked eye perspective, it is possible but let legible to discern what this filter definition is stipulating than to simply make a DB view where these restrictions could be expressed in the form of simpler `WHERE` clauses. Am I missing something? Is there an advantage to using Criteria vs. DB views that I am not aware of? Using views seems much cleaner. Is there a performance upside to Criteria?


How significant is node's advantage of training developers in only one language and putting them on tasks across the tech-stack?

I have recently joined a startup as CTO/co-founder. The startup and I have been thinking about moving the existing codebase (which is in PHP5.5, laravel framework) to node.js . Main reason for this being that at the stage we are in right now, I'll need to hire talented, but inexperienced developers and train them to work on different parts of the project. JS is already being used in a very big angular app, and will also be used in the mobile app (we are planning to go the phone gap route). The api only exists in PHP. I personally can re-implement the existing api in node.js in 3-6 weeks optimistically (I am confident of that time because I myself built the laravel api backend) and have a pretty good idea of the feature set required. Also, that's a time that the startup can afford at this stage. I think that having one language across our tech stack can increase our ability to get the maximum out of new developers who join the company as we can train them only in JS and in use their skills across the tech stack, by giving them proper training before exposing them to a new area of the stack. My question is, what are the benefits of training inexperienced devs in a single technology stack? Are my assumptions correct based on this list of benefits? Does an affordable 3-6 week turnaround become more realistic if inexperienced devs can focus on a single technology stack?


I have worked with many languages that do not generate a method signature based on the return type. I have also worked with one(maybe some?) that do. The ones that don't have given me problems in the past (like here). Why do programming languages generate method signatures without regard to the return type? Update: I'm referring specifically to compiled statically typed languages


Good way to document your software (product)?

Different from Fastest way to document software architecture and design. I'd like to write a manual for my software which includes   1. Command line usage   2. Howtos/Tutorials on using the software    3. Example code for writing plugins   4. Manual on functions and classes for the plugin sdk I'd like to mark words for linking so i can write "also see FuncA, FuncB, etc" with each func as a link. Perhaps have the code sample monospace width/font and indented like you would see in many books. What software/markup/format may i use to generate a manual? I'm unsure what format the manual will be but it will likely be html, pdf or both. Bonus if its a text format and plays nicely with source control (i'm using git) but that doesn't matter as i'll probably have it outside of my source control.


is PERT/CPM still being used?

I wonder whether PERT/CPM is still being used, or, is it an ancient methodology for the world of today? Thanks.


What should I name these methods?

I have two interfaces, one with and one without generic type parameters. The non-generic interface is used internally so that I can store instances of the generic interface in a collection. All would be well except for the fact that C# does not generate method signatures based on the return type. I have a method in each interface called GetItems. One returns an IList the other an IList<T>. Since I cannot give them both the same name I need to come up with two different names that both convey what they do. Here are the interfaces:               public interface IBatchProcessingStorage {         void Enqueue(object o);         void Enqueue(IEnumerable items);         void Dequeue(object o);         void Dequeue(IEnumerable items);         IList GetItems(int maxItems);     }     public interface IBatchProcessingStorage<T> : IBatchProcessingStorage {         void Enqueue(T item);         void Enqueue(IEnumerable<T> item);         void Dequeue(T item);         void Dequeue(IEnumerable<T> item);         IList<T> GetItems(int maxItems);     }      There is a task that runs every so often that will get items from the batch processing store, pass them to an external resource, and if they are processed by the external resource then they are removed from the store. The task needs the non-generic interface, that is the only reason it exists. I have created an abstract class that implements both, and redirects the calls in the non- generic interface to the generic ones and the generic ones are abstract like so:               public abstract class BatchProcessingStorage<T>        : IBatchProcessingStorage<T>       , IBatchProcessingStorage {              void IBatchProcessingStorage.Enqueue(object o) { Enqueue((T)o); }              void IBatchProcessingStorage.Enqueue(IEnumerable items) {             Enqueue((IEnumerable<T>)items); }              void IBatchProcessingStorage.Dequeue(object o) {              Dequeue((T)o); }              void IBatchProcessingStorage.Dequeue(IEnumerable items) {             Dequeue((IEnumerable<T>)items); }              IList IBatchProcessingStorage.GetItems(int maxItems) {             return this.GetItems(maxItems).ToArray(); }              public abstract void Enqueue(T item);              public abstract void Enqueue(IEnumerable<T> item);              public abstract void Dequeue(T item);              public abstract void Dequeue(IEnumerable<T> item);              public abstract IList<T> GetItems(int maxItems);     }      This is supposed to be the class that customers will inherit from, but I'm not going to force them into our inheritance hierarchy. So they may have to implement both interfaces. This is the reason for my great concern about the names. I don't want our API to have crap method names. So, what should I call GetItems in each class that conveys meaning without looking like I'm working around language limitations? ## Update: For those of you who think I am over analyzing this: We have learned a lot about our public API over the past 5 years. I have one chance to get this new one right. After that we are stuck with what is released. This is not your average internal software application. It is a software platform that is very extensible. It is used by some of the most well known companies in the world. It is going to be very hard for them to honestly get on stage at our conferences and tout the usefulness of our software platform, if It has a crappy API. This is not overly complex, or overly abstract. It is designed to serve a specific business need. Our customers are going to need this, better yet, they already do through a very poorly named, and overly complex API that makes you jump through hoops to get things done (hindsight is always 20/20).


How can a borderline beginner jump into open source?

With all the options and project available, especially the size of most of them, Open Source can be pretty daunting for a newbie to it all. My question is, how can I start helping and learning from open sourced software? Where do I start? Which files do I read first? Any advice to help a programmer above beginner level start contributing?


Modulo Operator Runtime

I am reading a review sheet for a class and the instructor said this of the modulo operator: Remember that modulus (%) has a runtime of O((logn)^2). He continued to display this piece of code: //Assumes n > 1               public boolean isPrime2 (int n) {         int sqrtN = (int) Math. sqrt (n) ;         for(int i = 2; i < sqrtN + 1; i++) {             if (n % i == 0) return false;         }         return true;     }      He said of this code: O(n) = sqrt(n) x n^2. As you can see, this method of checking if a number is prime only iterates from 2 to sqrt(n). Since we loop over a quadratic operation sqrt(n) times, the runtime is O(sqrt(n)). Two things I don't understand. One, why is the inside the for loop now an n^2 operation rather than a (logn)^2 operation. Two, even if it is only an n^2 operation, shouldn't the total runtime then be O(n)?


Does programming in front of a projector screen work?

I'm wondering if being in front of a very large screen (say 106" instead of your usual dual 22"), with appropriate distance, has any positive impact of your work conditions. I'm thinking about the case you are at home. You'll need to move your office into a large depot if you allow that to all your staff :)


How can I use Windows Workflow for validation of a Silverlight application?

I want to use Windows Workflow to provide a validation service. The validation that will be provided may have multiple tiers with chaining and redirecting to other stages of validation. The application that will generate the data for validation is a Silverlight app. I imagine the validation will take longer than the blink of an eye, so I don't want to tie the user up. Instead, I would like the user to submit the current data for validation. If the validation happens quickly, the service will perform an asynchronous callback to the app. The viewmodel that made the call would receive the validation output and post into the view. If the validation takes a long time, the user can move forward in the Silverlight app, disregarding the potential output of the validation. The viewmodel that made the call would be gone. I expect there would be another viewmodel that would contain the current validation output in its model. The validation value would change causing the user to get a notification in smaller notifcation area. I can see how the current view's viewmodel would call the validation through the viewmodel that is containing the validation output, but I am concerned that the service call will timeout. Also, I think the user may have already changed the values from the original validation, invalidating the feedback. I am sure asynchronous validation is a problem solved many times over, I am looking to glean from your experience in solving this kind of problem. Is this the right approach to the problem, or is there a better way to approach this?


How to design classes in right way (sending messages)

Trying to design small project in right way and have a trouble in it:\ about task: need to realize multiplication of big numbers, using fft First, i have classes               class LargeNumber{};     class Field{}; -- abstract (maybe interface would be better)     class C_C:public virtual Field{};     class Z_p:public virtual Field{};      So, LargeNumber can use Z_P(modulo P) or C_C(complex) classes (more correct: C_C and Z_P have Mul and Sum functions to multiply LargeNumber objects) but another task more interesting and difficult. I need to calculate all operations and time each 'big' operation take. And also need to throw messages and create logs. How to solve this problem? ( what should i do? ) Also will be great, if you comment patterns and your best practices. and so this classes:               class LargeNumber {       private:       int length;       vector <short int> number;       public:       //prototype       LargeNumber clone(){                         return (*this);       }       //get       int Length() const;       vector <short int> Number()const;             //static       static LargeNumber& GenerateOne(int);// create new LargeNumber       static void Print(const LargeNumber& print);       //constructors       LargeNumber();       LargeNumber(const LargeNumber& obj);       explicit LargeNumber(int len);             explicit LargeNumber(vector <short int>);       LargeNumber(int,int);       //destructors       ~LargeNumber();           void Kill();       //operators       LargeNumber& operator= (const LargeNumber& );       LargeNumber& operator--();           LargeNumber& operator++();       bool operator<(const LargeNumber&)const;                 };                class Field {       private:       inline int max(const int a, const int b){return (a>b?a:b);}              inline int min(const int a, const int b){return (a<b?a:b);}            int i;       //need Mod and 2**P-1       LargeNumber& Deux (const int );            LargeNumber& Mod (LargeNumber&);       public:              virtual ~Field();              virtual LargeNumber& Sum (const LargeNumber& , const LargeNumber& );              virtual LargeNumber& Sub (const LargeNumber& , const LargeNumber& );              virtual LargeNumber& Mul (const LargeNumber& , const LargeNumber& );                      virtual LargeNumber& Pow (const LargeNumber& , const LargeNumber& );              virtual bool Prime (LargeNumber& );                 };


How can I get into C++ graphics library?

I have been programming for a year so far and I know 2 languages: C and C++. I've covered the basics, I've written functional windows programs, and I've written complicated bits of code. When I was using Turbo C for learning the C language I noticed a library called "Graphics.h". I've looked it up and I received amazing examples of graphics manipulation. My question is straightforward. How can I get started with learning graphics in C++? Is there a good tutorial that covers it all up?


What design and planning techniques are the most suitable for individual projects?

This summer I'd like to develop a number of applications, all of them relatively small, yet risky -they're complex, I'm inexperienced-. I'm gonna work on my own because my classmates or other IT people I know really don't have a genuine interest in programming (I swear!). Besides from making good code, I'd like to analyze, design and plan everything correctly. Probably applying standard methodologies would be excesive for a single-person project wouldn't it be? So, what lifecycle and diagrams should I use? In college I've been taught only a very superficial approach to software engineering.


Trying to evaluate answers provided by an online technology school

I've been considering taking some web-related programming courses from an online technology school (it's probably best if I don't name names). When I read the syllabi of the different courses on their website (which included courses on HTML, JS, PHP, Perl, DB admin, and Unix/Linux system admin), I was a little concerned that some of the content and descriptions sounded a bit dated. I emailed my concerns to their representative, who responded promptly. I hope I'm not outside the scope of this forum, but based on the rep's responses (below), I have two questions that I think only experienced programmers can answer:   * Does the rep have a good point when she says that teaching earlier versions of technology is justified because "most people/sites/businesses do not change quickly"?   * Is there such a thing as PHP in the SQL style? (I couldn't find anything on that) _Discussion with representative:_ Hi, I'm wondering how much effort is taken to keep these courses up to date? Computer technologies and best practices change fairly quickly and I would obviously want to be taking courses based on current standards. > Yes you are correct that technology & practices change quickly, most > people/sites/businesses do not change quickly. Most often the systems are > several versions behind current upgrades. Our courses are kept as up to date > as possible. However, we find the earlier versions are still in use and a > good foundation for the majority of systems out there. For example, is your web programming certificate based more on HTML 4 or HTML 5? > We are still teaching HTML/CSS from 5 years ago. We are currently in the > process of creating a new HTML/CSS course for the newer technology, however > it is not available yet. Do you teach PHP in an object oriented style? > We are teaching PHP in the SQL style. Hopefully this answers your concerns. > If not, please do not hesitate to contact us with more specific questions. > > Wishing you all the best,


How do you encode Algebraic Data Types in a C#- or Java-like language?

There are some problems which are easily solved by Algebraic Data Types, for example a List type can be very succinctly expressed as:               data ConsList a = Empty | ConsCell a (ConsList a)          consmap f Empty          = Empty     consmap f (ConsCell a b) = ConsCell (f a) (consmap f b)          l = ConsCell 1 (ConsCell 2 (ConsCell 3 Empty))     consmap (+1) l      This particular example is in Haskell, but it would be similar in other languages with native support for Algebraic Data Types. It turns out that there is an obvious mapping to OO-style subtyping: the datatype becomes an abstract base class and every data constructor becomes a concrete subclass. Here's an example in Scala:               sealed abstract class ConsList[+T] {       def map[U](f: T => U): ConsList[U]     }          object Empty extends ConsList[Nothing] {       override def map[U](f: Nothing => U) = this     }          final class ConsCell[T](first: T, rest: ConsList[T]) extends ConsList[T] {       override def map[U](f: T => U) = new ConsCell(f(first), rest.map(f))     }          val l = (new ConsCell(1, new ConsCell(2, new ConsCell(3, Empty)))     l.map(1+)      The only thing needed beyond naive subclassing is a way to _seal_ classes, i.e. a way to make it impossible to add subclasses to a hierarchy. How would you approach this problem in a language like C# or Java? The two stumbling blocks I found when trying to use Algebraic Data Types in C# were:   * I couldn't figure out what the bottom type is called in C# (i.e. I couldn't figure out what to put into `class Empty : ConsList< ??? >`)   * I couldn't figure out a way to _seal_ `ConsList` so that no subclasses can be added to the hierarchy What would be the most idiomatic way to implement Algebraic Data Types in C# and/or Java? Or, if it isn't possible, what would be the idiomatic replacement?


How do I make sense of the javascript frameworks explosion ? Should I learn them all?

For a beginner web developer who is still doing web development the conventional way (PHP/J2EE/Struts on server side, HTML/CSS/Javascript on client side), I was bowled over by the recent blog post on Trello technology stack. I can't help feeling overwhelmed by the list of new technologies and frameworks mentioned in this post and specifically the ubiquitousness of Javascript frameworks. My question is, is this the future of web development? Are there any articles, websites or resources that can help me make sense of where each of these new frameworks fit in a modern web application ?


Why should identifiers not begin with a number?

Most programming languages appear to be designed to not allow one to declare an identifier that starts with a number. I was just curious to know the reason. I have already searched the web, but couldn't find a satisfactory explanation.


When to update jQuery?

When you recommend updating jQuery/jQuery UI? Or in other words: **what are the best practices for updating jQuery/jQuery UI?** I’m working on a long project that will take at least one more year. In that time span, I’m sure that jQuery/jQuery UI will be updated many times. Do you recommend update my jQuery/jQuery UI files every time an update is released? Or is better to stick with a particular version until the end of the project? I’m afraid of “breaking” code changes, and every time an update is released, I have to test everything. That takes too much time. But on the other hand, if I didn’t update, I’m afraid of bugs that later will bite me in the rear. The project is an ASP.MVC and I use jQuery a lot. Any thoughts?


Does simplicity always improve Readability?

Recently, I was developing a set of coding standards for our company. (We're a new team branching out into a new language for the company.) On my first draft, I set the purpose of our coding standards as improving Readability, Maintainability, Reliability, and Performance. (I ignored writability, portability, cost, compatibility with previous standards, etc.) One of my goals while writing this document was to push through the idea of simplicity of code. The idea was that there should be only one function call or operation per line. My hope was that this would increase readability. It's an idea that I carried over from our previous language. However, I've questioned the assumption behind this push: **Does simplicity always improve readability?** Is there a case where writing simpler code decreases readability? It should be obvious, but by "simpler", I don't mean "easier to write", but less stuff going on per line.


Can web technologies, like PHP, HTML, and CSS, be used for desktop development?

I have to develop an application for a gas agency where a database will store consumer numbers, names, addresses, and date delivered for a town with nearly 20,000 people. I only know PHP, MySQL, CSS, jQuery, and other web based technologies. Is it possible to deliver a package to the client using these technologies that can be installed on a computer and used locally? This application will run on a single PC for a single user. I'm familiar with tools such as XAMPP, but I do not want to run a web server locally. Both the application and database will be securely running on a particular computer. In the future, if this application must be on multiple computers, I want the database and application to be portable. I have searched for similar questions on Stack Overflow and I did find some recommendations like Jetty, Adobe Air and the recent Web SQL database. Is PHP GTK also a viable tool for building professional applications? I would like a recommendation specific for this kind of app.


Scala class with constructor requiring parameter of the same Class type

I can't remember but recently in one of the APIs I saw something like this `class A (member:A){}`. Scala does support it and there is no problem creating such a class but how do we initiate it and what purpose would such a class serve?


Should One Be Resilient to Overtime/Crunching/Stressors?

I ask this, because after two weeks of intense labor with no off-time (eat, sleep, program) I cracked today and went into a rage. Afterwards I fell into a mild depression for a couple of hours before I could finally compose myself and finish my project goals for the day. This is my first project and I took great care in designing a good solution that met all the requirements. The deadline was set very, very tight (less than a week to develop the entire frontend application) and I coded well into the night. This was ok for me, I didn't mind doing so if I knew that 1) I made the system flexible enough to adapt to new change and 2) this is the first project I'm developing on my own and I wanted to make a good impression. What really got me was the lack of communication forcing me to throw out large sections of my code. This needless rework left me without a night's sleep, which is admissable if it didn't happen again. What DID happen was that, on the day the backend people wanted to see some results on the frontend they HAD CHANGED THE SPECS WITHOUT TELLING ME. And then grew annoyed when I grew annoyed at the change! So not only did I have to rework my code because of a miscommunication, I had to rework my code because changes happened that I wans't even informed of! People acting as if it's my fault for missing something like that just tipped me over the edge. I blew up, decided to call it quits and take a walk. I talked to my boss about this, and although he's sympathetic, says that things like requirement changes, overtime, looming deadlines and miscommunication occasionally happen and that I should just take it with a little more ease. (He thinks I'm taking my job way too seriously and should just relax a bit.) I'm just a college student and this is my first job, so I would like to ask this as broadly as possible. What I have described here is the backstory for a hopefully general question: How resilient should I be to these kinds of stressors? Is two weeks too short? Is this common and I really am making a big deal out of it? Should I expect my work life to be filled with these kinds of mishaps and something I will have to deal with if I want to make a living as a programmer? PS: While I can imagine some people (like my professor) advising me to find a new job, this is not in the spirit of the question. I am not asking for career advice- I can tell how badly this is affecting my health and needs to change.


What rationale is used when programming language designers decide what sign the result of modulo operation takes?

Going through Modulo operation (the avenue I entered while exploring the difference between `rem` and `mod`) I came across: > In mathematics the result of the modulo operation is the remainder of the > Euclidean division. However, other conventions are possible. Computers and > calculators have various ways of storing and representing numbers; thus > their definition of the modulo operation depends on the programming language > and/or the underlying hardware. Questions:   * Going through Euclidean division I found that remainnder of this operation is always positive (or 0). What limitation of the underlying computer hardware forces programming language designers to differ from mathematics?   * Every programming language has it predefined, or undefined, rule according to which the result of the modulo operation gets it's sign. What rationale is adopted while making these rules? And if the underlying hardware is the concern then shouldn't rules change according to that, independent of programming language?


How do I dive deep into code that does not have a single entry point?

I work on enterprise Java projects that do not have a single entry point from where I can trace the flow of execution. Some of the projects have hundreds of classes, and when I'm asked to add a feature to a project, I often find myself at a loss as to where to start looking at code. What's the best way to dive into such projects so that I can implement the feature quickly without wasting time.


Is it possible (or desirable, if not) to make an database engine organize the order of sql statements to maintain the referential integrity?

Today at work I found the following situation: We had two tables, `A` and `B`, with B having a foreign key linked to the primary key of A. On our application, we got two main situations that created the _problem_ : One where we had to add add some records in A, followed by the creation of some records in B referring to the ones in A. This was just fine, since we created our BLL to handle first the changes in A and them B. The _"problem"_ is, sometimes we will have to delete the records of B and them delete the referred record in A, wich raises an error, since we are trying to delete A before deleting B, what could break the referential integrity of these tables. Of course everything is inside a transaction, and we could deal with that in our BLL code, simply changing the order of wich changes cames first (in A or in B) based on the actions that have to be made, **but** my question is more conceptual than a _"please help me solve my problem"_ one, since the "problem" is already solved (but of course, I'm accepting suggestions if they came up! =D). Chatting in the office, we agreed that, inside a transaction, everything is being donne and if some problem occurs, what was done is rolled back. **My idea** : Why can't the transaction evaluate everything and them order the statements and execute that in a way that don't break the referential integrity, since after the transaction everything will be done and the order might not matter at all? After thinking a little about it, even I am not sure if this thing would be nice or create some king of living hell, since I can think of some situations where the order of the statements would matter, so I'm posting it here so we can discuss about it. I hope that my text is not confusing. And just to mention, I'm using `Microsoft SQL Server`. Dunno if this is possible in other databases.


Client contracts as a sole proprietor - What should be in the contract?

If this has already been asked, feel free to redirect me and I'll close this. I gave my current employer notice to quit my job a few months ago, and they haven't been able to find anyone to replace me. I'm able to leave the job in another month, and the company has started to ask me if I'd be willing to continue working on a contract. I've considered registering myself as a sole proprietor and doing some additional work for them, if they're willing to pay me silly amounts of money. If I were to do this, it would be done professionally, with a contract and a lawyer to write up the contract. But that brings up a problem; I'm not sure exactly what should be in the contract. Is there anyone who has experience with this and could suggest what should be covered by the contract, or things that I might overlook until they bite me in the ass? On an additional note, but more specific to my situation, I'm currently working for this company in a foreign country. If I decide to do additional work for them, it will be from my home country. Is there anything that I should be careful of, since the company isn't located in my country? I'm wondering how realistic or financially viable it would be to hold a company located in a foreign country to a contract. If it's not realistic or doesn't make sense financially, I might be better off not accepting the work. Alternatively, skipping the lawyer and contract and just going on trust might be okay, but I'm still weary of doing this even though I've worked with the company for a few years.


A good IDE for NodeJS - debugging especially important

Have a significant amount of a Data Warehousing application written in Javascript. The application is set up so that the Javascript code runs in a web browser (Chrome). Of course, running a Data Warehousing application inside a web browser is pretty dumb (the application is of significant scale that the rest of it runs on a cloud server cluster). Would like to install NodeJS onto the server cluster. A major concern is losing the ease of debugging Javascript inside the Chrome web browser. The developer tools for Chrome are awesome. It is incredibly easy to set break points and view variable values and application state using the Chrome web browser. When we move the Javascript code to the server, what is a good IDE to use with NodeJS? Right now, the server is running Python. For that we use PyCharm and have remote debugging set up such that we can debug line-by-line, view variable values and application state within PyCharm on our local machines even though the code executes on the server. Is there a way to do this with Javascript and NodeJS? Thanks so much!


How to make a non-english clone of CoffeeScript?

I want to make a non-english programming language that is identical to what CoffeeScript is to JavaScript. What I mean is that I don't want to build my own design or syntax. Just want to have a non-english programming language that compiles to JavaScript. I want to follow everything CoffeeScript fellows so I don't really want to make any design decisions. For example: This is coffeescript:               number   = 42     opposite = true          number = -42 if opposite      I want my language to be something like:               رقم = 42     عكس = صحيح          رقم = -42 إذا عكس      that get compiled to:               var number, opposite;          number = 42;          opposite = true;          if (opposite) {       number = -42;     }


Do experienced Ruby on Rails developers use scaffolding?

In the Ruby on Rails tutorial, I read something that suggested that experienced developers do not use scaffolding since they tend to like to just write the code to connect the MVC on their own. In a different place I read that it is a good idea to use scaffolding because it helps you stick to convention so others who look at and interact with your code will understand what you are doing. I am pretty new to Ruby on Rails but not MVC or web application - should I generally try hard to stick to scaffolding conventions and let it guide me?


Creating huge decision tree

I'm to write an event correlator. A fundamental part of the system will be a decision tree that recognizes the origin of the fault basing on recorded states and log files. Often many accidents will differ with minor details and many decisions taken will be made basing on fuzzy, incomplete or unreliable data, but most of these decisions can be written down as binary logic functions. Thing is, there will be a lot of them. I expect at least 100 nodes in the decision tree, and I may underestimate the value by an order of magnitude. And on top of that, as new, unexpected patterns emerge, unforseen failures happen leaving new traces, or with extension of the system new failure modes become viable, the decision tree will have to be maintained. (and it won't always be a pure tree structure - some faults of the same effect have two or more modes of appearance, some of these branching off into different modes, e.g. event A means failure X, event B means: check event C. If C is true, it's also failure X, but if not, it's failure Y. Although I can always normalize it into X1 and X2, which are technically identical but different from the tree point of view.) Also, the tree will be often fairly deeply nested so I'm afraid a simple series of nested if() will quickly slip out of control. Now my question is, how to store / write / build that tree so that it could be compilable into something the machine can digest, but still maintainable for the developers? Note this is for an embedded system, so heavyweight solutions like JBoss don't really fit unless they appear only on the compiler side, and the final system runs a compiled ruleset in something much more machine friendly. (the system is written in C++, it also makes extensive use of JSON, and will run on an ARM9 CPU if that's of any help.) ![A sample of the tree](http://i.stack.imgur.com/hw9Ur.png)


Is overloading an example of the Open/closed principle?

Wikipedia says > _"software entities (classes, modules, functions, etc.) should be open for > extension, but closed for modification"_ The word **functions** caught my eyes, and I now wonder if we can assume that creating an overload for a method can be regarded as an example of the Open/closed principle or not? Let me explain an example. Consider that you have a method in your service layer, which is used in almost 1000 places. The method gets userId and determines whether user is admin or not:               bool IsAdmin(userId)      Now consider that somewhere it's necessary to determine if the user is admin or not, based on username, not userId. If we change the signature of the above-mentioned method, then we've broken code in 1000 places (functions should be closed to modification). Thus we can create an overload to get the username, find the userId based on username, and the original method:               public bool IsAdmin(string username)     {         int userId = UserManager.GetUser(username).Id;         return IsAdmin(userId);     }      This way, we've extended our function through creating an overload for it (functions should be open to extension). Is it an Open/closed principle example?


I've stopped coding for fun, is this a bad sign?

At some point in time, I just stopped coding for fun. I used to go to work, finish my assignments and then upon arriving home I'd go and write stuff on the side for fun. However, I now just go home and try to avoid the computer. I'd rather read the paper, watch TV, go out to the bar, etc. Is this a bad sign? I mean I still try to keep up on the latest trends, hit up the developer forums/blogs/etc but I haven't said, "I want to learn language X - I wonder if I could write app Y in it" Has this happened to anyone else?


What is bootstrap listener in the context of Spring framework?

I am studying Spring framework, in web.xml I added following which is a bootstrap listener. Can anyone give me a proper idea of what is a bootstrap listener?               <listener>         <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>     </listener>      You can see the doc here: ContextLoadListener > Bootstrap listener to start up and shut down Spring's root > WebApplicationContext. Simply delegates to `ContextLoader` as well as to > `ContextCleanupListener`. > > This listener should be registered after `Log4jConfigListener` in web.xml, > if the latter is used. > > As of Spring 3.1, `ContextLoaderListener` supports injecting the root web > application context via the `ContextLoaderListener(WebApplicationContext)` > constructor, allowing for programmatic configuration in Servlet 3.0+ > environments. See WebApplicationInitializer for usage examples...


Choosing between performance vs readable/cleaner code?

If you have to pay the price of performance to make code more readable would you prefer that or you would always prefer performance over it?


Session or request scope for account details

I have a (browser based) web application. On each page, I want to have a little label and link in a corner that displays the user's username and other account information along with a logout button. The information that will be displayed is immutable. Should I store that account information in session attributes when a user logs in and forget about it or should I use a filter/interceptor and load it on each request in the request attributes?


Throwing an Exception if a Query Doesn't Use an Index

I'm working on a largish webapp that was developed by several other programmers and I keep running into performance issues caused by poorly written SQL queries and queries that don't use an index. I'm working on fixing the problems by logging how long each query takes to complete and if it's using an index. I was wondering if other people have had this problem before and what they've done to keep it from happening again. My initial idea is to throw an exception if any query doesn't use an index so it has to be taken care of in devel but to continue to log the large/slow queries so we can see long term where the slowness is. **Update 2012-03-05 11:56 EDT** We're using MySQL and my plan WAS to run explain on each query after it's run to check for indexs.


Where to define view-specific data objects in Rails

Background: there are several places in our app where we want to display date- oriented information on a calendar. The event_calendar gem looks nice and has lots of reviews, so it's what I'm planning to use. However, it's designed to work with a model. I'm not going to update our existing models to meet its needs, so will create a DTO class and a helper function to construct an array of instances from our existing models. My question is: where should that DTO class live? It seems like it should be defined inside `ViewHelper`, but that will violate DRY as soon as I use the calendar for two models (note: the helper functions will differ, it's just the DTO class that will remain the same). So, is there a standard place in the Rails directory tree where non-model- related classes live? Or is there a better/more idiomatic way to do this? One thought that I had was to make my helper function decorate the existing model instances with the methods that event_calendar wants to see.


What is the exact syntax of inline?

### CASE 1 (Definition and declaration in same source file) Suppose both my prototype and definition of global function is in .cpp file. Where should I write inline keyword to make compiler know?   1. In the prototype   2. In the definition   3. Both ### CASE 2 (Definition and declaration in same header file) If I have declared prototypes in .h file I want to make that function inline in more than one .cpp file using it, then should I define the function (to be inlined) in that .h file and include it to individual .cpp files? If yes, then in this case where inline keyword should be used? ### CASE 3 (Definition in Header file and declaration in Source file) If the prototype is in a header file, definition in a source file (in which other functions use the inline function), where must the inline keyword be used?   1. In the declaration in header file   2. In the definition in source file   3. In both


Store a tree with near next neighbours

I would to find an efficient structure (speed and volume) to store nodes and their neighbourhood. My input is build out of stings in the following format                ./X/Y.log      where _X_ ∈ [0,359] and _Y_ ∈ [0,169] and each pair of ( _X,Y_ ) defined the coordinate of a cell on a grid of the size [170x360]. I would like to find which cells are neighboured (above, below, right and left), maximal 4 possibilities and to store this information (coordinate and direction). The structure, where the information will be stored, should not contain duplicate information (e.g. cell (50,50) is neighboured to cell (51,50) from the left side, but cell (51,50) is as well neighboured to cell (50,50) from the right side. Only one of those likes should be stored). An additional information, the number of input strings (format _./X/Y.log_ ) is not more then 5% of the total amount of possible cells (360*170 = 61200 possible cells). Which storage structure should I good to my problem? (The code would be written in C++)


How can I best organise a Jekyll + Bootstrap + Git site?

So after many many many years of building sites from scratch (and doing a lot of the lifting myself) I've dipped my toes into two projects that have been around for a few years that I've been avoiding: Bootstrap and Jekyll. The design was a very customised job that required me digging into the LESS so I've got a Bootstrap source files, source assets and a build directory within that directory. Then there's the Jekyll side. That has its own structure, I'm symlinking in the bootstrap build directory, and the final content (the stuff I want to actually serve) buried in `_site` directory. Here's how it looks:               /.git/*     /.gitignore     /bootstrap/     /bootstrap/... a load of source files ...     /bootstrap/bootstrap/  # the build output     /jek/     /jek/... all the jekyll files ...     /jek/bootstrap/  # symlink on ../bootstrap/bootstrap/     /jek/_site  # the stuff I actually want to upload - but don't really want in git      In _my_ history, I've either been dealing with a Django project layout (which makes a fair amount of sense) or a static layout. What I have here is two separate build systems and it's driving me nuts. Is there a better way of structuring all this junk, or failing that, is there a way I can make bootstrap output directly into the jek directory? How do you handle co-dependent static sites like this?


Is there a standard for Error Codes?

I've created a gateway which receives a POST from cUrl on one system which is a well-formed XML string. After processing the gateway sends back a response XML. All the fields in the XML are required and while the system sending the data constructs the XML itself I'm running some validation to make sure that every value that's being stored in the Request Class is actually. One thing my gateway does is that the response can also indicate an error and sends a message and response code which is then displaced on the system as the following message: > An unknown error occurred while processing. Code: # Message: ERROR_MESSAGE The original code just sends Code as 0 if there was no error or 1 if there was. I'm thinking of giving Code another value depending on the error since displaying Code in the error message is kinda useless if it's only ever going to be 1 (since you'll never see 0). So I'm wondering if there is a standard for creating error codes, particularly with PHP and XML.


Implementation of recurring fee system

I'm developing an application which will list members who have not paid their any previous month's fee and a separate list for those who have paid the fee. So, lets say a member who will be paying fee through out the year, each month and if he didn't pay fee for march 2013 then app should highlight him as un- paid member. What would be best practice to achieve it. Adding fee invoices for whole year already in database when member is added then loop through his payments to check if fee is paid or not, or add a validation date for member on his each payment, for example payment made in Feb 2013 then member is valid till 28.02.2013. Check if date today is >28.02.2013 then he has not paid..


anonymous checkout

Working on a E-commerce solution where I need to handle checkout based on anonymous customer and as of now I am not able to think properly how best this can be implemented. Our ShoppingCart is being saved in database and and every update/ edit in ShoppingCart is being updated in database. Now I need to take care about creating an anonymous customer and than assign this cart to that customer so that add to cart and well checkout can be associated with this customer. Can anyone suggest me what can be the right way to go for this?   1. Should I create one anonymous user in database and use it everytime a request for new customer (anonymous ) is being created.   2. Place that user in current user session.   3. Perform any operation on cart with respect to the current session


How to update User interface form through database update

I have a client server application. Assume I work as a Support executive, resolving customer tickets. We(our support team) have got two tickets to work on. Ticket 1: Client "Liver" raised a ticket to update his phone number.   Ticket 2: Same Client "Liver" raised a second ticket to update his email ID. I am working on ticket 1: Opened application, clicked edit Customer Info buttton, entered new phone number. I did not save the form(Edit form). In between, I left for CUPPA. My colleague is looking at ticket 2: He has edited the Customer information and updated with new email id: Its persisted in database. When, I come back and save my ticket with phone number update, it would overwrite his changes i.e.., his email ID change is lost or not updated for that Customer "Liver". Is there a way that when a get back to my work/page after CUPPA break, can I see the email ID with updated value? How to prevent this? What is the approach? Possible design ideas? How to ensure that there is no data loss?