language-agnostic

Sorted list difference

Hello. I have the following problem. I have a set of elements that I can sort by a certain algorithm A . The sorting is good, but very expensive. There is also an algorithm B that can approximate the result of A. It is much faster, but the ordering will not be exactly the same. Taking the output of A as a 'golden standard' I need to ...

Best Practices for version control with multiple projects

I have several projects with a very large over-lapping code-base. We've just recently started using SVN so I'm trying to figure out how I should be using it. The problem is that as I'm finishing a task on one project, I'm starting a task on another, with some overlap. Often there's a lot of interrupt driven development as well. So, my c...

How do you document your application?

I never know how to document a system in a way that other developers will find it easy to use and/or maintain it. Documentating the source code is good and required for that, but I don't think it is enough to give a good overview of the application itself. Java seems to keep most of its documentation in the source code, which describes ...

Implementing shuffle on the celestial jukebox

How would one implement shuffle for the "Celestial Jukebox"? More precisely, at each time t, return an uniform random number between 0..n(t), such that there are no repeats in the entire sequence, with n() increasing over time. For the concrete example, assume a flat-rate music service which allows playing any song in the catalog by ...

Are the first 32 bits of an md5 hash just as "random" as any other substring?

I'm looking to create a 32-bit hash of some data objects. Since I don't feel like writing my own hash function and md5 is available, my current approach is to use the first 32 bits (i.e. first 8 hex digits) from an md5 hash. Is this acceptable? In other words, are the first 32 bits of an md5 hash just as "random" as any other substrin...

How do I assess the hash collision probability?

I'm developing a back-end application for a search system. The search system copies files to a temporary directory and gives them random names. Then it passes the temporary files' names to my application. My application must process each file within a limited period of time, otherwise it is shut down - that's a watchdog-like security mea...

how can I get the path of a context menu selection ?

I have a custom entry on the Internet Explorer's context menu. I would like to do something with the selected item, for example, run a program that receives that selection as ARGV[1]. For example, if I right click on a file named whatever.zip that is located on my desktop, the following thing should run : my_binary path\to\desktop\w...

What are Boolean Networks?

I was reading this SO question and I got intrigued by what are Boolean Networks, I've looked it up in Wikipedia but the explanation is too vague IMO. Can anyone explain me what Boolean Networks are? And if possible with some examples too? ...

Manipulating multi-track ogg files programatically

I'm planning to create a program for manipulating multi-track OGG files, but I don't have any experience with the relevant libraries, so I'm looking for recommendations about which language/library to use for this. I don't really have any preference for the language, I'll happily code it in C, C#, Python, whatever makes things the easies...

What does 'rich user interface' mean?

What exactly is meant by the term "rich user interface"? Does it mean the same thing when referring to user-interfaces as it does when referring to, say, communications frameworks? Does it imply that a user-interface can be "poor"? (as in the opposite of rich, not as in poorly designed) ...

Re-sort orders to improve warehouse efficiency

I am trying to optimize how orders are filled at my work. Right now, an employee just grabs the latest 16 orders(sometimes 14 or 18) and fills them. I am trying to change it so that instead of simply going by the latest list of orders, that it orders them so each batch has order in similar locations. But I can't figure out how I should...

Convert frames to NTSC Drop Frame Timecode

I'm looking for a function that converts an integer value in frames to NTSC Drop Frame Timecode (hh:mm:ss.ff). I'm using Delphi, but could be in any language. Thanks ...

What are best practices for extracting a framework from an application?

I've been working on an application for a little over two years and have developed a lot of useful helpers, utilities, features, setup conventions, etc. I want to start building a similar application and think I could reuse a lot of the functionality built into the existing application with the new application. I've always heard is it...

Problem on Tag "Filesystem"

For recreational reasons I wrote a PHP class that classifies files with tags instead of in a hierarchical way, the tags are stored in the filename itself in the form of +tag1+tag2+tagN+MD5.EXTENSION and thus I'm stucked with the chars limit (255) imposed by the FS/OS. Here is the class: <?php class TagFS { public $FS = null; f...

What char should I use to replace illegal characters in a url slug

I noticed that various systems use various characters as the replacent for illegal ones in urls. Is there a reason to use one or the other or should I just pick the one that looks best to me The options I have seen so far include: - _ + and simply removing all illegal characters. ...

What algorithm to use to determine minimum number of actions required to get the system to "Zero" state?

This is kind of more generic question, isn't language-specific. More about idea and algorithm to use. The system is as follows: It registers small loans between groups of friends. Alice and Bill are going to lunch, Bill's card isn't working, so Alice pays for his meal, $10. The next day Bill and Charles meet each other on a railway sta...

Is there an edit distance algorithm that takes "chunk transposition" into account?

I put "chunk transposition" in quotes because I don't know whether or what the technical term should be. Just knowing if there is a technical term for the process would be very helpful. The Wikipedia article on edit distance gives some good background on the concept. By taking "chunk transposition" into account, I mean that Turing, Al...

Where to start programming?

Once you have your first set of requirements and design done where do you start programming? (Assume tests will be written in the same order, but before the code). The entry point Framework/Support classes Entity Classes Easiest thing first Hardest thing first What do you suggest? ...

Interface inheritance - a good thing?

I've just used it for the first time - consider: IGameObject void Update() IDrawableGameObject : IGameObject void Draw() I had a level class which used DrawableGameObjects - I switched this to be IDrawableGameObject's instead to reduce coupling and aid in TDD. However I of course lose the ability to call Update(..) without c...

How can I capitalize the first letter of each word?

I need a script in any language to capitalize the first letter of every word in a file. Thanks for all the answers. Stackoverflow rocks! ...