language-agnostic

What is an efficient way to find a non-colliding rectangle nearest to a location

For a 2D game I am working on, I am using y axis sorting in a simple rectangle-based collision detection. This is working fine, and now I want to find the nearest empty rectangle at a given location with a given size, efficiently. How can I do this? Is there an algorithm? I could think of a simple brute force grid test (with each grid t...

What techniques exist for the software-driven locomotion of a bipedal robot?

I'm programming a software agent to control a robot player in a simulated game of soccer. Ultimately I hope to enter it in the RoboCup competition. Amongst the various challenges involved in creating such an agent, the motion of it's body is one of the first I'm facing. The simulation I'm targeting uses a Nao robot body with 22 hinge...

Choosing a method for a webservice

I'm asked to set up a new webservice which should be easily usable in whatever language (php, .NET, Java, etc.) possible. Of course rolling my own can be done, accepting different content-types (xml / x-www-form-urlencoded (normal post) / json / etc.), but an existing method or mechanism would of course be prefered, cutting down time spe...

how does a non-blocking event loop work?

Twisted has a "non-blocking" event loop. I understand what a blocking event loop does (sort of, from the Wikipedia page) but can't figure out how a non-blocking one does. ...

Is there a standard for "???", "!!!", "TODO" etc. tags in comments?

I'm talking about special words/tokens used in the beginning of comments, to facilitate grepping or otherwise to attach some special meaning to the comment, like // TODO: Find out what to do about this error. The meaning of some tags are obvious, like TODO and FIXME, but what about ??? and !!!? Are there others? I'm asking because I've ...

Algorithm - find the smallest subset of cells representing all the rows

I have several lists, that you can consider as rows of integers. For example : [1 3 5] [3 7] [3 5 7] [1 5 9] [3 9] [1 7] [5 9 11] I wish to find the smallest possible set of integers represented on these rows, so that : each row has at least one of the selected integers, in case of cardinality ties, select the set having the highest...

What is a good quick pathfinding algorithm?

What is a good path finding algorithm when you care the amount of time it takes but not how long the path is. Also is there a faster algorithm if you don't care about the path at all but just want to check reachability. (Is Flood Fill a good algorithm for this sort of stuff?) ...

How to consolidate documentation across different languages/environments?

I am designing a class library designed to solve a wide scope of problems. One thing about this library is that it will be usable by several different languages and environments natively. For example, there will be a C++ version written entirely in C++, a .NET version written in C# and a Java version written in Java, without any dependen...

What problems have you solved using bloom filters?

I'd like to know about specific problems you - the SO reader - have solved using bloom filters and what libraries/frameworks you used if you didn't roll your own. Questions: What problems have you used bloom filters to solve? What libraries/frameworks did you use? I'm looking for first-hand experiences, so please do not answer unles...

Dependency injection - best practice for fully decoupled components?

I want to use dependency injection (Unity) and at the moment I'm thinking about how to setup my project (it's a fancy demo I'm working on). So, to fully decouple all components and have no more assembly dependencies, is it advisable to create an assembly ".Contracts" or something similar and put all interfaces and shared data structures...

Deterministic initialization and dependency injection (constructor based)

My demo application I'm working on has a very long startup routine. The application I'm trying to replace with the new ideas log a lot to the console during that (imagine: "now loading data... reticulating splines... login to third party service..."). After spending the whole day learning DI basically from scratch, I create the whole (!...

Is there is some mathematical "optimum" base that would speed up factorial calculation?

Is there is some mathematical "optimum" base that would speed up factorial calculation? Background: Just for fun, I'm implementing my own bignum library. (-: Is this my first mistake? :-). I'm experimenting with various bases used in the internal representation and regression testing by printing out exact values (in decimal) for n facto...

What is the term for exposing members (of members, of...) to provide their functionality in a class using composition?

UPDATE: My original question wasn't quite clear. I'm looking for the name of the principle that code like the example below violates. (I've updated the code example to better resemble the scenario I'm talking about. The original code example I included can be found at the bottom. This was a poorly chosen example because it illustrated a...

what's the advantage of using put and delete as opposed to just get and post

Especially for the majority of browsers that don't support it, is there anything aside from just strict standards compliance that justifies the extra development time? ...

A naming convention for the column intended exclusively for ordering

Say, we have a set of records that should be ordered with a non-trivial ordering method, e. g. natural sort or just in some specific sequence, defined by a user. We have to introduce a special column intended just for ordering. Is there a more or less common convention for naming such columns? What names do you use? ...

Implementation techniques for FSM states

How do you go about implementing FSM(EDIT:Finite State Machine) states? I usually think about an FSM like a set of functions, a dispatcher, and a thread as to indicate the current running state. Meaning, I do blocking calls to functions/functors representing states. Just now I have implemented one in a different style, where I still rep...

What is a "predicate based search"?

I overheard this at a coffee table conversation and i wasnt able to fathom what this was about. A bit of googling didnt throwup anything useful... Clarification: Thanks guys for the initial take on it... but it appeared that the conversation was about "searching" through databses / internet, etc.... ...

What is the structure of a MIDI file?

Hello! I want to manually have a function that creates a MIDI file according to users demands, for example. User write 2 patches that contain 8 bars of 4 quarters of A4 (Concert A - 440hz) and C4 (each as a seperated channel) on 120 speed, at velocity 100, instrument piano (01) and patch 49 or whatever. How should the MIDI file look l...

testing command line utilities

I'm looking for a way to run tests on command-line utilities written in bash, or any other language. I'd like to find a testing framework that would have statements like setup: command = 'do_awesome_thing' filename = 'testfile' args = ['--with', 'extra_win', '--file', filename] run_command command args test_output_was_...

Any good threads related job-interview question?

When interviewing graduates I usually ask them questions about data structures, algorithms and complexity theory. I would really like to ask a question that will enable them to show their familiarity with multi-threaded concepts, without dwelling into language specific issues. Any good questions? The only question I could think of is ho...