language-agnostic

Are digits represented in sequence in all text encodings?

This question is language agnostic but is inspired by these c/c++ questions. How to convert a single char into an int Char to int conversion in C Is it safe to assume that the characters for digits (0123456789) appear contigiously in all text encodings? i.e. is it safe to assume that '9'-'8' = 1 '9'-'7' = 2 ... '9'-'0' = 9 in all...

What's an example of a well designed network server?

I'm interested in looking at architectures for extensible network serving applications. I'm not too interested in the protocol, or the language used, more in the elegance and extensibility of the design. Of course Apache comes to mind, but I was wondering if anyone had any other examples that they find a pleasure to work with. EDIT: j...

What is the fastest way to check if files are identical?

If you have 1,000,0000 source files, you suspect they are all the same, and you want to compare them what is the current fasted method to compare those files? Assume they are Java files and platform where the comparison is done is not important. cksum is making me cry. When I mean identical I mean ALL identical. Update: I know about ...

Does pair programming work when there is a skills impedance mismatch?

For example, can an experienced coder with limited C#.NET experience be successfully paired with an experienced C#.NET coder with the secondary aim of getting the former up to speed with C#.NET? ...

Verb for what you do when you have A and do A AND B

Ok, this may seem like a silly question, but it is seriously bugging me. Hoping some fellow programmer has a good word for it! Thing is, I am making an ExpressionBuilder class to help me build up expressions to use with LinqToSQL. And my problem is about how word myself when describing what two methods. And it kind of is a problem in ge...

Unique identifier for user profiles in Windows

For a client/server application I need to centrally store parts of the configuration information that usually goes into the users profile directory. The client application would on first use write a file or registry entry with a GUID into the current profile. This GUID would subsequently be used as a key in the configuration database on...

Expressing an integer as a series of multipliers

Scroll down to see latest edit, I left all this text here just so that I don't invalidate the replies this question has received so far! I have the following brain teaser I'd like to get a solution for, I have tried to solve this but since I'm not mathematically that much above average (that is, I think I'm very close to average) I ca...

C++ Design Pattern for a Messaging System?

I'm tasked with implementing a messaging system for a real-time simulation. There are several different kinds of messaging objects that need to exist in this system, and more might be added in the future. These objects represent the primary means of communication between the players in the sim. Assuming I fully understand my requireme...

method for specialized pathfinding?

I am working on a roguelike in my (very little) free time. Each level will basically be a few rectangular rooms connected together by paths. I want the paths between rooms to be natural-looking and windy, however. For example, I would not consider the following natural-looking: B X X X ...

How to implement a single sign-on authentication server?

Hi all, I want to implement a discrete remote authentication server that handles login for many sites. Somewhat similar to OpenID. Basically, I have site-1 and site-2 and they're both reliant on the same user database, which is on a separate auth-site. So, auth-site handles user authentication for them, and during this process, makes i...

Tricks to refactor a piece of code with many branches (if/then/else)

I'm having a hard time trying to refactor some pieces of code with many branches. There are many if/then/else blocks, some of them are nested. Are there any tricks that can be used to refactor the code without wasting a lot of time trying to understand every minor aspect of the functionality first? For now I'm basically using boolean a...

Iterating over a Binary Tree with O(1) Auxiliary Space

Is it possible to iterate over a binary tree in O(1) auxiliary space (w/o using a stack, queue, etc.), or has this been proven impossible? If it is possible, how can it be done? Edit: The responses I've gotten about this being possible if there are pointers to parent nodes are interesting and I didn't know that this could be done, but...

cross-language configuration for java/.Net

I found this question, but didn't see a good answer. I'm interested specifically in configuration files, say in XML. Are there cross-language standard/tools for reading config files? XML itself is just a medium, but I want tools and libraries and standards, like those existing in .Net's ConfigurationSection class. My main targets are ja...

What kind of jobs are out there for someone who is interested in language design?

Im currently implementing an interpreter for Scheme, and plan on reading Elements of Programming Languages and design a toy language for learning purpose. What kind of jobs are out there that require language design skills? ...

How to round floats to integers while preserving their sum?

Let's say I have an array of floating point numbers, in sorted (let's say ascending) order, whose sum is known to be an integer N. I want to "round" these numbers to integers while leaving their sum unchanged. In other words, I'm looking for an algorithm that converts the array of floating-point numbers (call it fn) to an array of integ...

Text message (SMS) verification for signups

I have seen a disturbing trend where websites are starting to require verification sent to cellphones by text message (SMS). Gmail and Facebook are two of them. What I want to know are the following: Is it a good idea to start requiring cellphones instead of emails now? How do I do it on my own website? Edit Here are some of my new ...

Best graphical source code diff viewer/editor for code comparison and merging?

The options for source code diff viewing/editing/merging seem to be: Free: Tortoise Merge Meld * WinDiff WinMerge * DiffMerge * KDiff AJC Diff Diffuse Commercial: Total Commander's Diff viewer * Beyond Compare * Delta Walker * Araxis Merge * Are there any other options? (Wikipedia suggests a few) What's your favorite tools fo...

What is this pattern called (helps avoid type casting)?

Found myself trying to find a link to an official definition of this design pattern which I believe I saw in Go4 but can't seem to find it anywhere. class Processor{ ProcessParameter(AbstractParameter x){ x.Process(this); } ProcessParameter(ParameterA x){ ... A-specific logic... } ProcessParameter(Paramet...

Possible to implement a manual increment with just simple SQL INSERT?

I have a primary key that I don't want to auto increment (for various reasons) and so I'm looking for a way to simply increment that field when I INSERT. By simply, I mean without stored procedures and without triggers, so just a series of SQL commands (preferably one command). Here is what I have tried thus far: BEGIN TRAN INSERT INT...

Generating a set of random events at a predefined frequency

I have a set of events that must occur randomly, but in a predefined frequency. i.e over a course of (totally) infinite events, event A should have occured 10% of the times, event B should have occured 3%, and so on... Of course the total sum of the percentages of the event list will add upto 100. I want to achieve this programmaticall...