I have a number of cuboids whose positions and sizes are given with minimum and maximum x, y and z co-ordinates (so they are parallel to the main axes).
e.g. I might have the following 3 cuboids:
10.5 <= x <= 39.4, 90.73 <= y <= 110.2, 90.23 <= z <= 95.87
20.1 <= x <= 30.05, 9.4 <= y <= 37.6, 0.1 <= z <= 91.2
10.2 <= x <= 10.3, ...
EngineYard is holding a constest here, where given a phrase and a dictionary of words, come up with a 12 word phrase whose SHA1 hash has the smallest hamming distance from the SHA1 hash of the given phrase.
A couple of sites are using cloud/crowd-sourcing to try to bruteforce it, while others are using CUDA and GPUs. Some reports hav...
Possible Duplicate:
How do you calculate the average of a set of angles?
I have two angles, a=20 degrees and b=350 degrees. The average of those two angles are 185 degrees. However, if we consider that the maximum angle is 360 degrees and allows for wrap around, one could see that 5 degrees is a closer average.
I'm having trou...
I started my college two years ago, and since then I keep hearing "design your classes first". I really ask myself sometimes, should my solution to be a bunch of objects in the first place! Some say that you don't see its benefits because your codebase is very small - university projects. The project size excuse just don't go down my thr...
It is not exactly the programming question, per se, but I couldn't find a more appropriate stackoverflow family site to post the following:
I am sick and tired of writing (and reading, as I regularly interview candidates) a generic thank you letter indicating,
It was nice meeting you, all of you are awesome, smart, and cool
I am the ...
The Problem
I was recently asked to calculate the money owed amongst a group of people who went on a trip together and came upon an interesting problem: given that you know the amounts that each person owes another, what is a general algorithm to consolidate the debts between people so that only the minimum number of payments needs to b...
Obviously, "Hello World" doesn't require a separated, modular front-end and back-end. But any sort of Enterprise-grade project does.
Assuming some sort of spectrum between these points, at which stage should an application be (conceptually, or at a design level) multi-layered? When a database, or some external resource is introduced? Wh...
I think of this as broken OOP. It's starting to grow like mold in our code base and I need to start talking with people about cleaning it up. Is there a common name for it?
public void eat(Fruit fruit) {
if (fruit instanceof Banana) {
((Banana) fruit).peel();
}
else if (fruit instanceof Pineapple) {
((Pinea...
While trying to cleanup an application's API, I found myself scratching my head...
What should I call the variable for a user's name "username", or "userName"?
...
I am a c++ programmer and occasionally I'll come across some code that is using bitwise operators to manipulate things at the bit level, but I have no real understanding of those concepts. So I would like a resource to help me learn it so well that it becomes second nature. Does anyone know of good resources for this? A google search did...
So regards logging from SO and other sites on the Internet the best response seems to be:
void DoSomething() {
Logger.Log("Doing something!");
// Code...
}
Now generally you'd avoid static methods but in the case of logging (a special case) this is the easiest and cleaniest route. Within the static class you can easily inject ...
For what purposes would you want to obfuscate your code? I have not run into any real purposes other than participating in contests, but I am sure there must be some intelligent and useful reasons for obfuscating source code.
Why, in general, do you want or need to obfuscate your code?
What real-life applications does obfuscation hav...
My gut tells me that putting one format in another is wrong, but I can't seem to come up with concrete reasons.
<root>
<stuff>
thing
</stuff>
<more>
<[!CDATA[{"a":["b","c"]}]]>
</more>
</root>
versus just putting it in the xml
<root>
<stuff>
thing
</stuff>
<more>
<a>
b
</a>
<a>
c
</a>
</more>
</root>
Th...
It seems to me as if there are a higher proportion of musicians in the programming field than in the general public. Maybe it's just an illusion caused by the fact that I'm an amateur guitarist myself, so I tend to notice coding musicians (or musical coders?) more.
But I wonder if there really is some connection. Perhaps a shared set ...
I'm reviewing some jQuery plugins for distribution with closed source (on the server, anyhow) commercial applications. One thing I'm noticing is that there isn't any standard license that covers all plugins.
After reading through the legal BS of a couple licenses, I'm feeling very glad I didn't go through with getting a law degree.
...
I'm considering using a jQuery plugin in a commercial project. The plugin (datepicker) is "dual licensed":
Dual licensed under the MIT
(http://www.opensource.org/licenses/mit-license.php)
and GPL
(http://www.opensource.org/licenses/gpl-license.php)
licenses.
Now the MIT license is pretty permissive license, allowing me to ...
When I was in college we had a guest lecture from David Parnas. In it he mentioned a mechanism that is used to guarantee that a loop (while loop, for loop, etc.) exits safely at some point. He scoffed at the fact that nobody knew what it was....the sad thing is that years later I dont know either. Does anyone know what this mechanism is ...
I have a two dimensional grid of cells. In this simulation, cells may request to switch position with another cell. The request also has a priority.
The problem is that Im having a hard time coming up with a good way to structure this. If A wants to switch with B, and B also wants to switch with A, they currently can be switched and swi...
I wrote a program for retrieving mail from POP3 servers. One of its users encounters the following problem...
His mail server when my program connects to it issues a greeting:
+OK Lotus Notes POP3 server version X2.0 ready <PrintableCharacters.UnprintableCharacters>
The part in angle brackets is a so-called challenge for the APOP aut...
Jimmy Bogard, wrote an article: Getting value out of your unit tests, where he gives four rules:
Test names should describe the what and the why, from the user’s perspective
Tests are code too, give them some love
Don’t settle on one fixture pattern/organizational style
One Setup, Execute and Verify per Test
In your opinion these gui...