language-agnostic

Graph Algorithm To Find All Connections Between Two Arbitrary Vertices

I am trying to find out what is the best (time efficient) algorithm to accomplish the task described below. I have a set of records. For this set of records I have connection data which indicates how pairs of records from this set connect to one another (basically a graph, the records being the vertices and the connection data the edges...

Algorithm for joining e.g. an array of strings

I have wondered for some time, what a nice, clean solution for joining an array of strings might look like. Example: I have ["Alpha, "Beta", "Gamma"] and want to join the strings into one, separated by commas – "Alpha, Beta, Gamma". Now I know that most programming languages offer some kind of join method for this. I just wonder how the...

Are you fluent in Unicode yet?

Almost 5 years ago Joel Spolsky wrote this article, "The Absolute Minimum Every Software Developer Absolutely, Positively Must Know About Unicode and Character Sets (No Excuses!)". Like many, I read it carefully, realizing it was high-time I got to grips with this "replacement for ASCII". Unfortunately, 5 years later I feel I have slip...

Program entry points..

What are the entry points in different languages? Like in C, main() is the entry point. ...

Self Testing Systems.

I had an idea I was mulling over with some colleagues. None of us knew whether or not it exists currently. The Basic Premise is to have a system that has 100% uptime but can become more efficient dynamically. Here is the scenario: * So we hash out a system quickly to a specified set of interfaces, it has zero optimizations, yet...

Is help file (or user manual) dead?

Back in the days of Unix, you couldn't even close a software without reading the man page first. Then came Mac and Windows with consistent menu layout and keyboard shortcuts, but you still saw paper user manuals shipped in the shrinkwrap box, which described each and every single operation possible in the app. After the Internet, help fi...

Threads or asynch ?

How do you make your application multithreaded ? Do you use asynch functions ? or do you spawn a new thread ? I think that asynch functions are already spawning a thread so if your job is doing just some file reading, being lazy and just spawning your job on a thread would just "waste" ressources... So is there some kind of design when u...

What Makes a Good Unit Test?

I'm sure most of you are writing lots of automated tests and that you also have run into some common pitfalls when unit testing. My question is do you follow any rules of conduct for writing tests in order to avoid problems in the future? To be more specific: What are the properties of good unit tests or how do you write your tests? L...

api documentation and "value limits": do they match ?

Do you often see in API documentation (as in 'javadoc of public functions' for example) the description of "value limits" as well as the classic documentation ? Note: I am not talking about comments within the code By "value limits", I mean: does a parameter can support a null value (or an empty String, or...) ? does a 'return value'...

Rosetta Stone - Sorting Arrays

I thought I would pose a question I'm describing as a "Rosetta Stone". That is to say, I am posing a question, and would like to see answers given for a number of different languages so that someone moving from one language to another can see how some typical operation is done. I have always found these types of comparisons to be very ...

Stack overflow code golf

To commemorate the public launch of Stack Overflow, what's the shortest code to cause a stack overflow? Any language welcome. ETA: Just to be clear on this question, seeing as I'm an occasional Scheme user: tail-call "recursion" is really iteration, and any solution which can be converted to an iterative solution relatively trivially by...

APIs and Datasets for Natural Languages?

Are there any good APIs and public datasets (dictionaries, phrases) for working w/ natural languages? Specifically, do any good ones exist for working on translation between English and Korean? ...

Does generated code need to be human readable?

I'm working on a tool that will output an interface and a couple classes implementing that interface. My output isn't particularly complicated, so it's not going to be hard to make the output conform to our normal code formatting standards. But this got me thinking: how human-readable does auto-generated code need to be? When should e...

What is the best implementation of an exception mechanism ?

Most program languages have some kind of exception handling; some languages have return codes, others have try/catch, or rescue/retry, etc., each with its own pecularities in readability, robustness, and practical effectiveness in a large group development effort. Which one is the best and why ? ...

What are the first tasks for implementing Unit Testing in Brownfield Applications?

Do you refactor your SQL first? Your architecture? or your code base? Do you change languages? Do you throw everything away and start from scratch? [Not refactoring] ...

best library to do web-scraping

I would like to get data from from different webpages such as addresses of restaurants or dates of different events for a given location and so on. What is the best library I can use for extracting this data from a given set of sites? ...

Do fluent interfaces violate the Law of Demeter?

The wikipedia article about Law of Demeter says: The law can be stated simply as "use only one dot". However a simple example of a fluent interface may look like this: static void Main(string[] args) { new ZRLabs.Yael.Pipeline("cat.jpg") .Rotate(90) .Watermark("Monkey") .RoundCorners(100, Color.Bisque) ...

How do you quantify the advantages of programming environments?

I'm looking at starting a project with a team of really smart people with backgrounds in various assorted languages and programming environments. The developers are all comfortable with different environments, and the only constraint is that it's "web-based." In this situation, how would you decide what technology to base your project o...

Good ways to test a unit that communicates via HTTP

Often, I find myself wanting to write a unit test for a portion of code that accesses HTTP resources as part of its normal function. Have you found any good ways to write these kinds of tests? ...

How to read values from numbers written as words?

As we all know numbers can be written either in numerics, or called by their names. While there are a lot of examples to be found that convert 123 into one hundred twenty three, I could not find good examples of how to convert it the other way around. Some of the caveats: cardinal/nominal or ordinal: "one" and "first" common spelling ...