language-agnostic

When to upgrade to a new version of a language or framework?

When a new version of a framework or language appears (e.g. .NET 3.5, SQL2008), what approach do people take to when to adopt/upgrade? Generally developers will say as soon as possible (they want it on their CV and from a management perspective giving them what they want provides a motivation boost) but commercially there is often littl...

How can I discover whether my CPU is 32 or 64 bits?

How do I find out if my processor is 32 bit or 64 bit (in your language of choice)? I want to know this for both Intel and AMD processors. ...

Do you create classes to handle "entities" for data driven apps?

I'm a newbie and when messing around with creating database applications I always just created my forms and put all the code and bindings in there. Instead of having arrays and lists that held information I made changes to the database directly. Now that I have evolved a little bit let's say that I sold widgets to customers and kept th...

Appropriate article (a/an) in String.Format

I'm looking for a culturally-sensitive way to properly insert a noun into a sentence while using the appropriate article (a/an). It could use String.Format, or possibly something else if the appropriate way to do this exists elsewhere. For example: Base Sentence: "You are looking at a/an {0}" This should format to: "You are looking at...

Which should one code first, functionality or validity checks?

When coding up, say, a registration form from scratch, does it make sense to get it functioning with the expected inputs first, and then go back and catch/handle the unexpected inputs and deal with errors? The alternative would be to process the input, checking any constraints and insuring that they are handled properly, and then dealin...

Sharing source code between machines

What is the best way to share source across local machines? I'm working on a cross platform project with an svn repository. I perform a checkout on one platform (perhaps osx), and make changes. I must then test my modified code on other platforms (xp, vista, ...) BEFORE checking it in. Manually copying files between machines or runni...

What is the difference betwen coder and programmer?

I've just concerned about this subject when I talked with my customer. They always call me as a "coder". What do you think is the difference between coder and programmer? ...

Polygon enclosing a set of points

Hello folks, I have a set S of points (2D : defined by x and y) and I want to find P, the smallest (meaning : with the smallest number of points) polygon enclosing all the points of the set, P being an ordered subset of S. Are there any known algorithms to compute this? (my lack of culture in this domain is astonishing...) Thanks for ...

Can a Non-Interpreted language have a Garbage Collector ?

Is it possible for a Non-Interpreted language to have a Garbage collector. Interpreted languages have the Interpretor executing the Program line by line so the Interpretor might just as well provide a runtime with a GC. But is it possible to have a Garbage collector for any other language without building the GC in your code itself ? ...

How safe is it to pre-generate a Guid and insert it into a table as a Primary Key?

I've seen many situations before where a PK is a Guid with no default value, and as such the developer would generate random Guids and use them to insert into the database. I've often wondered what is the possibility that they would generate a number that already existed? ...

GUID vs INT IDENTITY

I'm aware of the benefits of using a GUID, as well as the benefits of using and INT as a PK in a database. Considering that a GUID is in essence a 128 bit INT and a normal INT is 32 bit, the INT is a space saver (though this point is generally moot in most modern systems). In the end, in what circumstances would you see yourself using a...

Agile Methods Specifically taylored to working solo?

Most Agile Methodologies I'm reading about speak volumes about how best to keep communication bottle necks within a team to a minimum. When working as a solo developer, most of these don't really apply. Stand up meetings are "interesting" when done alone for example. :) My question is, when working solo, from what particular methodolog...

There's named parameters, and then there's...

Since named parameters are those parameters that are identified by their explicit name, instead of their ordering, what's the name of their cousins without names, the ones that are identified merely by the order? Anonymous parameters? Unnamed parameters? Do they have a name to begin with? ...

How do you avoid platform/framework decision paralysis?

So, I've got an idea for a website. I can start off using any platform and frameworks I want, but there are almost too many options. OS Platform: Windows, *nix Web Framework: Rails, ASP.NET, ASP.NET MVC, Django, Zend, Cake, others Hosting: EC2, Dedicated Server, Shared Hosting, VPS, App Engine, Azure, others Persistence: S3, MySql, P...

Is the CPU wasted waiting for keyboard input? (generic)

I was wandering if there's a way in witch the OS doesn't need to cycle ad infinitum waiting for the input from keyboard (or other input device) and if there are any OS using that. I can't believe that we do need to waste cycling just to wait for input, why can't the input do something once is pressed instead of having the machine to wait...

Algorithms: Interesting diffing algorithm.

This came up in a real-world situation, and I thought I would share it, as it could lead to some interesting solutions. Essentially, the algorithm needs to diff two lists, but let me give you a more rigorous definition of the problem. Mathematical Formulation Suppose you have two lists, L and R each of which contain elements from some...

What are some good criteria for using Tracer Bullets?

I was recently reading The Pragmatic Programmer for the first time and I came across the concept of Tracer Bullets. I realized that I had coded according to this model in the past and just kind of filed the way I was working away in my brain as "agile". They only give one example of where they had used it in the past. The way the si...

examples of useless/junk code and easy fixes

I recently came upon some code filed with the following } catch (FooException e) { //do something } catch (BarException e) { //do something } catch (Exception e) { throw e; } which is easily re-written as } catch (FooException e) { //do something } catch (BarException e) { //do something } and if (!(flag == false)) which ...

Beginner GUI question, organising different "views"

I've done plenty of programming before for CLI and the web, however recently I am getting into desktop GUI programming. Most of the tutorials for GUI programming I found just explain the different controls you can use and leave it at that. Some of the better ones also skim over a few usability issues. However, my problem is not with th...

small cycle finding in a planar graph

I have a geometric undirected planar graph, that is a graph where each node has a location and no 2 edges cross, and I want to find all cycles that have no edges crossing them. Are there any good solutions known to this problem? What I'm planning on doing is a sort of A* like solution: insert every edge in a min heap as a path exte...