language-agnostic

Which HTML element has the largest number of children of a certain type, for instance tags?

In any language, XSLT, PHP, Ruby, Perl, anything: how can I get the XPath or other path or identifier to the element containing the largest number of <p> tags? ...

Hardest types of bugs to track?

What are some of the nastiest, most difficult bugs you have had to track and fix and why? I am both genuinely curious and knee deep in the process as we speak. So as they say - misery likes company. ...

Software finance books

Can anyone recommend a good book for software people who are looking to break into the finance industry as a developer? ...

latest programming tools under construction?

This site has been great for me to learn what's out there for programming tools and libraries. I'm wondering what are some promising tools/libraries/algorithms -- in any areas of programming or software engineering -- that are in alpha or beta right now that I should keep my eyes on when they get released. Some ones that come to mind to...

Convert a quadratic curve points to polynomial representation?

I have the X,Y of 2 end points and 1 bezier point, of a Quadratic Bezier curve. Using this data, how can I derive the polynomial representation of the curve? ...

Domain Specific Language for Business Objects?

I'm thinking of writing a domain specific language (DSL) to model business objects. The DSL will not be executed, instead it will be used by a template based code generator (probably CodeSmith) to generate the .NET & SQL. The DSL will need to support the definition of the following elements: Classes (name & description) Properties (na...

Quicksort terminology? (like fat pivot)

Does anyone know the full technical vocabulary to describe all the various versions of quicksort? The one I know is "fat pivot"[A] (where all items matching the pivot placed in the middle of the subarray and excluded from further sorting). The ones I'd like to know are when one element (the pivot) is placed in the middle and excluded fr...

Where to get a Database of Spanish <-> English Translations?

Hi! for a program I am writing I would need a dictionary between Spanish and English words. I googled a while, but I could not find any database freely available. Does anybody know where or how to get such a database (preferably a simple CSV or XML file)? So far my best idea to create such a dictionary is to create a little program tha...

Javascript OO question

So I want to build a form validation class/object in javascript. The way I see it working would be something like this: var form=new Validation(); form.addField("name","Your name","required"); form.addField("email","Email Address","is_email"); ......... form.validate(); I was thinking that the validation class would be defined someth...

Selling Your Own Company Your Code

I work for a large software company. On the contract I'm currently working on, I have to work with a grossly inefficient legacy application that we simply don't have the budget to fix, but which is very important to our customer. Just for fun, over the course of a few months, I wrote a new, much improved version of it at home on my own...

What's the best approach to get Date/Time input from the user?

This is a wheel that's been re-invented again and again over the years. The Problem: The user needs to input a Date/Time Basic considerations We want to make it as easy as possible for the user to enter the desired date/time Some applications call for historical dates, some applications call for future dates only, some will need to ...

Join a string using delimiters

What is the best way to join a list of strings into a combined delimited string. I'm mainly concerned about when to stop adding the delimiter. I'll use C# for my examples but I would like this to be language agnostic. EDIT: I have not used StringBuilder to make the code slightly simpler. Use a For Loop for(int i=0; i < list.Length; ...

When does it make sense to return this-reference?

Currently I can think of only three good reasons to return this in a (public) method, namely: (mmyers) when implementing fluent interfaces, e.g. public class X { ... public X enableValidation() { setValidation(true); return this; } ... } (Jon Skeet) for identity conversions, e.g. public class X { ... public X t...

How to start recognizing design patterns as you are programming?

I have general academic knowledge of the various design patterns that are discussed in GoF and Head First Design Patterns, but I have a difficult time applying them to the code that I am writing. A goal for me this year is to be able to recognize design patterns that are emerging from the code that I write. Obviously this comes with exp...

Is this a safe version of double-checked locking?

Slightly modified version of canonical broken double-checked locking from Wikipedia: class Foo { private Helper helper = null; public Helper getHelper() { if (helper == null) { synchronized(this) { if (helper == null) { // Create new Helper instance and store reference on ...

How do you refactor a class that is constantly being edited?

Over the course of time, my team has created a central class that handles an agglomeration of responsibilities and runs to over 8,000 lines, all of it hand-written, not auto-generated. The mandate has come down. We need to refactor the monster class. The biggest part of the plan is to define categories of functionality into their own cl...

How should source code files be organized? By function, or type?

In my early coding days, I would tend to group classes that functioned in a similar way. For example: Data transfer objects Object A Object B Dialogs Dialog A Dialog B After a while, it started to frustrate me that when I was working on a particular part of the application, I would have to jump all around to piece it together. I...

What is the purpose of null?

I am in a compilers class and we are tasked with creating our own language, from scratch. Currently our dilemma is whether to include a 'null' type or not. What purpose does null provide? Some of our team is arguing that it is not strictly necessary, while others are pro-null just for the extra flexibility it can provide. Do you have an...

Breaking an interface

What are the most important guidelines to follow if you need to break an interface in a .NET application? How do these guidelines change before and after your application has been deployed? I know there are other questions that debate when/where interfaces should be used, however I don't want to get into that. I just want to know some ...

Process for copy-editing text on your software products

Do you have a process within your company for the approval and copy-editing of text on your software products? If so, do you employ a professional copy-editor, or does a nominated person within the organisation take responsibility for this? Edit I know that this is not exactly programming-related, but it does have a strong bearing on ...