language-agnostic

Efficient Out-Of-Core Sorting

I'm trying to work out how to efficiently sort a huge dataset that won't fit in memory. The obvious answer at a high level is to sort a whole bunch of chunks that do fit in memory using some standard algorithm, write these out to disk, and then merge them. Merging them is the problem. Let's say the data divides up into C chunks, so I ...

Code Golf: Spider webs

The challenge The shortest code by character count to output a spider web with rings equal to user's input. A spider web is started by reconstructing the center ring: \_|_/ _/ \_ \___/ / | \ Then adding rings equal to the amount entered by the user. A ring is another level of a "spider circles" made from \ / | and _, an...

Why don't development practices reflect research evidence?

This was the main question posed by Greg Wilson's "bits of evidence" presentation. I'm paraphrasing in my question here so please read the presentation for all the details. I'd also like to know if you disagree with the premise of the question i.e. you think that current development practices actually do reflect evidence. ...

Layout many irregular boxes so they fit on screen

I've got a list of images with dimensions for each image. I need to select and layout a group of images from that list so they fit on screen with slight overlaps, and no gaps. (gradient in the overlap to avoid a sharp transition) I've researched 2d box packing algorithms, but they all assume that you need to use all the items, and, of c...

Are there resources about logistics?

I couldn't find any complex resources in Google. Maybe the key words that I used were wrong. I am interested in web-sites, book titles, book authors etc.. I'm looking general theory. UPD: Previous title of the question was: "Are there resources about transport scheduling?". ...

Something like xslt for presenting plain-text EDI messages?

I often encounter EDI messages in various plain text formats, for example the format: HEAD[customer,8][date,8][reference,10] [lineno, 3][product, 8][quantity, 3][currency, 3][price, 10]... ..resulting in messages like this: HEAD1122334420091031 LINDAHL 00100004711010USD0000234055 00200004712005USD0000004543 ... Reading the above ...

Printing code with syntax highlighting?

I have occasion to need to print code (Horrors!!! ;) ), and i was wondering what editor or tool would i use to print that code out with proper formatting and syntax highlighting? If it's important, it will be c# code but ideally the tool will work for as many languages as possible. Can Notepad++ or something handle this? ...

Debugging: High-level versus low-level bugs

What is the approximate ratio of time you typically spend debugging high-level versus low-level bugs? For the purposes of this discussion, high-level bugs are things like incorrect algorithms, bad assumptions about input data and/or operating environment, cases that were overlooked in the initial implementation of something, forgetting ...

Address verification

A friend just brought by 1,000 lines of USA shipping addresses. (Excel.) I've read this into a Ruby program via CSV::. Now I would like to check the mailing addresses for sanity. It doesn't have to be a perfect check. Her shipping contractor will be using a UPS program of some sort and we are just trying to minimize the number of addres...

How to display common information in multiple views in an MVC application?

What is the best way to share common objects between multiple views in an MVC application? Say I have a LoginController that takes a user name and password and authenticates the user and loads their data (account info, full name, etc.). I want to display this on each page - something like a header with "Welcome <user name>, you have <a...

How do you stay user-oriented when it comes to your long-term project?

I've been working on a long-term project for over a year now and love every minute of it. However, I find myself getting increasingly out-of-touch with my users as my perspective of the same project is drastically different. In my case, I know how to get from A-B very quickly in 5 different ways. But, if a typical user and I were place...

Should null == null be true when comparing objects?

I'm curious what everyone thinks. In SQL (at least in oracle) NULL translates conceptually to "I don't know the value" so NULL = NULL is false. (Maybe it actually results in a NULL which then gets cast to false or something like that...) This makes sense to me, but in most OO languages null means "no reference" so null==null should pr...

Doesn't Passing in Parameters that Should Be Known Implicitly Violate Encapsulation?

I often hear around here from test driven development people that having a function get large amounts of information implicitly is a bad thing. I can see were this would be bad from a testing perspective, but isn't it sometimes necessary from an encapsulation perspective? The following question comes to mind: http://stackoverflow.com/...

Is there a standard for code margins?

Similar Questions While coding, how many columns do you format for? What is a sensible maximum number of characters per line of code? Do people still live by the 80 column rule? The 80 column limit, still useful? By code margins I am referring to the lines that guide how long a particular line of code is. Different IDEs hav...

Acceptable types to use as keys in a HashTable

I must admit to having only a rudimentary understanding of how HashTables work, although from what little I do know it seems fairly straightforward. My question is just this: it seems that the conventional wisdom is to use simple, basic value types such as integers for the keys in a HashTable. However, strings are also often used, even t...

Scheduling periodic tasks to minimize clustering

A large number of clients want to check in with a server about once an hour, and don't care exactly when. The server wants to talk to all of the clients, but doesn't want to get overloaded if too many clients check in at the same time. How should the clients schedule their checkins to keep an even load on the server? If there's been di...

Using handled exceptions as an intended trigger?

Occasionally in my code I will intentionally use a thrown exception as an event trigger. For instance, I will loop UNTIL an exception is thrown and then break; in the catch clause. Is this bad practice? Would it be more efficient (or cleaner) to query some attribute of what I am looping to predetermine the indices (i.e. predetermine w...

Algorithm for computing the last time a cron expression should have triggered?

I ran into this date and time constraint problem earlier this week, and haven't really found any good approach for an algorithm. Each idea I get grinds to a halt with something like what if this is a leap year? or what if this is run on the night when we change to/from DST Input: A crontab expression (wikipedia on CRON format,Cron). F...

Is there a programming language where the static data type is optional?

I'm thinking something where the following two are equivalent: int [] array = { 1,2,3,4 } foreach( int i in array ) { print i } array = { 1,2,3,4 } foreach( i in array ) { print i } ...

Best algorithm for matching colours.

Hi, I got array of some (about 200) colours in RGB format. I want to write program that taking any RGB colour and trying to match colour from my array that is most "similar". Of course I need better definition for "similar". Unfortunately I don't have any. It want it to act like a parson asked the same question. I want to show some inf...