Uhh, is it just me or is the "@cmp.nl00.net" e-mail address fishy?
I think it was a scam, Alex.
danielpitts
@danielpitts
Best posts made by danielpitts
-
RE: Already Expired
-
Penny-Arcade puts the picture on a wooden table, takes a digital photograph...
Definately made me think of TDWTF, http://www.penny-arcade.com/comic/2006/11/29
Although, in their defense, they give a good reason for it. Apparently being stuck somewhere without a scanner. I kinda like the effect anyway. The content itself is a little WTFy, I think Tycho might enjoy reading some of the less "intense geek" stories we have here. :-)
Latest posts made by danielpitts
-
RE: Best Linked List Ever
@pacohope said:
@asuffield said:
@tster said:
One thing I think of though. I don't know of any languages that allow this....snip...
It's a historical trick, from back when memory was measured in kilobytes and rented by the month from IBM. You can assume that if you have enough memory to operate a garbage collector, then you have enough memory to use a double-linked list like any sane person.
I can't imagine there being a use for it in modern software.
Again another sad detail from the actual situation. This ran on a 900MHz Pentium III with 512M of RAM. I don't think the memory situation was that dire. This queue, on the other hand, was a core part of their event loop and needed to execute fast. I'm not implying that some of the various suggestions here don't run fast enough. I'm just saying that if you had to pick space versus time on this system, time would win. Which is all the more reason we wanted to dope slap the developer who shaved a few bytes off the queue and got it wrong. He could have done a simple doubly-linked list and it would have been exactly what was called for.
Hmm, priority queue implemented as a linked list... Anyone heard of this new-fangled "Heap" data-structure. Perhaps I should patent it, since I know its more advanced than the recently patented Linked List.
If its NOT a priority queue, then an array list certainly would be more effecient than a linked list.
-
RE: Difference of two angles without branching
[quote user="Tweenk"]
I am writing a simple mechanical simulation program in C(++). The problem is as follows: given two vectors, compute the angle between those vectors AND make sure it is within the allowed range of results: (-M_PI; M_PI). For now, I am using a rather obvious solution:
angle = atan2(ay, ax) - atan2(by, bx);
if(angle < -M_PI) angle += 2*M_PI;
if(angle > M_PI) angle -= 2*M_PI;However, I have to do this three times, which means six totally unpredictable branch instructions in the innermost loop of the program, that's a Bad Thing. I wonder if it is possible to somehow reduce the number of branches. I've seen an assembler trick that allows to store the bigger one of two integers without branching, but I don't know if a similar feat can be achieved using the FPU.
[/quote]
Are you sure you need to optimize this? Profile before guessing. Guessing leads to wasted time and unnecessarily ugly code.
As a side offer, your going to waste more time with the atan2 calls than with the branches. Are you sure you need to compute the distance between the two angles? You might be better off using vector math instead. It depends on why you're calculating the difference between angles.
Alternatively, maybe you should keep track of the angles and magnitudes, rather than the coordinates, depending on your uses.
Well, good luck,
Daniel.
-
Ridiculus patents.
http://www.patentstorm.us/patents/5950191.html
I think the owner of this patent missed the point of linked lists.There are plent of other interesting patents on linked lists. There is one for a technique to find the "head" of a linked list.
I thought that one of the requirements for a patent is that your process couldn't be self-evident.
-
RE: (Li|U)n[iu]x admins collected and own WTFs
cd /
cd stufff
rm -r *Doesn't seem bad? here was the output:
$ cd /
$ cd stufff
stufff: No such file or directory
$ rm -r *
$Or, there was the time I hooked up my friends harddrive to my computer (without mounting it in the case.). Normally not a bad thing, unless you lay it on some uninsulated metal.
What about the time I wrote a program that writes to ports 70 and 71? Overwriting much of my CMOS configuration (and somehow damaging the FAT table of the boot harddrive).
Although, I've managed to fix problems too. My girlfriend-at-the-time had a harddrive starting to fail. One day the computer won't boot normally, so I add my hdd to her system, write a program that does a raw image dump of the disk.
I found out two things: The first FAT table (DOS stores two) was wiped out, and the second FAT table doesn't have all the right offsets.
I wrote another program that goes through the disk image, and look for sub directories (DOS starts all subdirectories with entries for . and ..). I was able to reconstruct the directory tree and extract most of her files from the image.
-
Legacy code. Or: If they are both null, only one is null, or neither is null...
Direct copy-paste:
if ((tag == null && externalURL == null) || (tag == null && externalURL != null) || (tag != null && externalURL == null) ||
(tag != null && externalURL != null)){
replace_tag.append("\"");
}
Ah, I love diving into our legacy code in order to find out how to implement the same thing in a new system. Makes me feel smart. -
Penny-Arcade puts the picture on a wooden table, takes a digital photograph...
Definately made me think of TDWTF, http://www.penny-arcade.com/comic/2006/11/29
Although, in their defense, they give a good reason for it. Apparently being stuck somewhere without a scanner. I kinda like the effect anyway. The content itself is a little WTFy, I think Tycho might enjoy reading some of the less "intense geek" stories we have here. :-)
-
RE: Laying cable in my home.
[quote user="Whiskey Tango Foxtrot? Over."]You know, it's possible to get some pretty decent performance from wireless these days.[/quote]
You know, it's possible to get gigabit performance of wires these days :-).
-
RE: Java Calendar usage
[quote user="Zigo"]
OK, understood!
THX a lot guys!
[/quote]
calendar.set(2006, Calendar.JANUARY, 0);
-
RE: Thou shalt not use any other loop-var than "i"!
[quote user="GoatCheez"]
unless i is being used later this should be:
for (int i = ((this.morePages)?this.nextRow:0); i < rows; i++)
{
...
}[/quote]
Actually, I think it is clearer to do this.
final int startRow;
if (morePages) {
startRow = nextRow;
} else {
startRow = 0;
}for (int i = startRow; i < rows; ++i) {
...
}Although, from looking at just this snippet, I would probably find plenty of ways to refactor this , like nextRow is probably 0 if not morePages, so you could probably always just have i in [nextRow, rows).
-
RE: Not Willing to Type
This isn't necessarily uncommon. A writers job is to create content, the editors job is to make sure it is suitable for the ending medium.