- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
I've got a wheel that wants reinventing. Any takers? ;)
Admin
Unless you're using the alternate style from The Chicago Manual of Style (which is indisputably American).
Admin
Admin
I know i only work with nondeterministic machines. Turing and Neuman were nubs.
Admin
Ah, sorry, I'm not a Java programmer. I'd guessed the system properties included some constantly-changing stuff. Never mind then, please go ahead and resume normal WTFery.
Admin
AGH
when you see this type of code you wonder what were they thinking? it makes sense to use the KISS principle.
btw the 5 lines of code that is the *most correct* solution should work just fine....
:P
Admin
It is not. A comma splice is when two independent clauses are joined with a comma and no coordinating conjunction. There are two independent clauses in that sentence, and they're joined with a comma and "but", which is a coordinating conjunction.
The phrase "talking about spelling" is a participial phrase (most likely read as acting as an adverb modifying either "would suggest" or the entire following clause, though it could be read as an adjective modifying "I"), and not a clause, independent or otherwise.
Setting off an introductory adverbial phrase with a comma is both common and preferred usage.
--
Michael Wojcik
Admin
Steve, you just have to do a:
try
{
Steve.read(post)
}
catch(e as spelling_grammerError)
{
Steve.Post(Retort.against(e.poster));
}
Admin
In VB you don't have to comment the i... just type "Next i" VB knows what you're doing.
I just improved your productivity and increased the life of your keyboard.
Admin
You know his first name isn't "Von" right?
Admin
Can you show me how to do it in Cobol on 1 line please?
Admin
Damn, you mean my childhood friend from Wolverhampton who claimed to be descended from Mr Chicago was lying to me...?
Admin
No, the WTF is people who evaluate code by assuming they know what its requirements are, rather than actually finding out.
Admin
Of course, the size of the seed is not necessarily the same as the size of the output, which was part of the original poster's assumption. One can generate booleans with Mersenne Twister or Blum-Blum-Shub, in which case the "for(int i=0,v=0;i<100;i++) v+=rand()%2;" method would be perfectly reasonable.
Admin
Of course. That only means he was some dude von the town of Neumann, silly. I'm surprised you knew who I was talking about, as there are probably a lot of people from the town of Neumann.
Admin
I think making fun of the comments is a wtf in and of itself. At least they're A) there, and B) kind of useful in this case.
Admin
gb2/b/ tard
Admin
Admin
This reminds me of something similar which happened a few years ago in a project I was in.
We needed to have some very random numbers (most random number generators have a bias) in order to do something with share allocation. The algorithm for this random number generator was specified by the local financial authority and was an example of "mathemagic"; didn't know why it worked, but it did. I know this because we had been using the code for years in a COBOL implementation, we just needed to implement it in PL/1 (four years later and everything's back to COBOL again). I made the "translation" and it worked just as the original did. For some reason, however, a collegue of mine decided that the legally required algorithm wasn't good enough and somehow managed to get budget to do so. In the end, his algorithm was based on a microsecond timestamp, some rounding and, well, that's pretty much it. No matter the fact it was called multiple times per microsecond. The code was heavily biased towards some numbers (this is due to the fact the OS had more to do than just running this little program) and the number 0 was never generated due to the rounding. Oh, and did I mention his algorithm wasn't legal to use due to regulations? It was shot before ever being integrated, luckily this seems the way most WTF's are handled around here; they do happen, they just don't get through to the end.
Admin
i like these in particular
} // end for
} // end if hash_bytes
} // end if val non null
} // end if key non null
} // end while e.hasMoreElements
so THAT's what }'s do...!
Actually - I do some similar myself as it often helps my overview of the indentation, rather then having to trace an ending scope up to the starting point.
You could just use a real IDE like Visual Studio. Intellisense anyone? I worry about Java Developers. They must get paid by the amount of pain.
Admin
Err... added the b, but there's still the notion of whether it's bits, bytes or bites that you really want for those 3!! I'm guessing bits.
Admin
Um... our Visual Studio is called eclipse. Does largely the same things in the same way, except it's not called "intellisense" because that's a Microsoft trademark.
But the real point is that if you need comments to match braces, then your blocks are either not properly indented, or too long.
Admin
This always strikes me as a strange point of view. The correct answer to my mind to 'my code is hard to read because my scope blocks are too big' is not 'let's use an IDE to navigate my unreadable code' but 'let's reorganise the code to the scope blocks aren't so big'.
Code completion and the like are handy time savers, but I would never want to be in the position where I couldn't load up a text editor and read my code if necessary because I could only navigate around it with a special piece of software.
Admin
I also strongly disagree with how you part your hair. The part on the far right side of the head made sense in the days when we had hair slick, but nowadays it just doesn't make any sense! Do yourself a favor and part your hair on the left like a sane human being!
Admin
I also strongly disagree with how you part your hair. The part on the far right side of the head made sense in the days when we had hair slick, but nowadays it just doesn't make any sense! Do yourself a favor and part your hair on the left like a sane human being!
gah why cant you edit your comments??
Admin
Hey, could you solve these graph problems for me real quick? I've got a team of nationwide door-to-door traveling salesman that I really need to get out the door as quickly as possible.
Admin
First post and a contribution:
Admin
Admin
The purpose of this supposed WTF code, presuming it's being properly used, is NOT a replacement for the Random class. It is NOT supposed to be an algorithmic PRNG. It is an attempt to get random seed bits. This is something that has to be done ONCE per JVM execution. After that, you can use something like SecureRandom, seeded by this, to produce whatever further random bits you want. The SecureRandom class claims to "attempt" to completely randomize its initial state, but it doesn't explain how, and I seriously doubt it's done in anything close to a "cryptographically secure" way. The only thing it claims to be secure are the ALGORITHMS it encapsulates. Anyway, the Random class definitely seeds itself with only a (non-secure) hash of the system clock, so the suggested "correct" sollution is certainly a bigger WTF than the supposed WTF.
Admin
Admin
You don't need to wonder. It uses an 48-bit linear congruential PRNG, according to the docs. The source code is available, and has been since before Sun open sourced Java. (All the source for all the Java classes always has been, but the JVM source wasn't always available.)
Although, you can't actually call Random.nextBytes(). It isn't a class method. You have to instantiate a Random.
For what the coder was trying to do, a java.security.SecureRandom might have been a better way to go. It's hard to tell what his or her intentions were, though. Security, or just making it "really, really random"?
Admin
What's a static instance? Is that like a constant variable?Never mind, it was being used in a static method. I should have thought before I posted.
Admin
I don't understand what goes on in the head of someone who insists on this. Do you look at a closing brace, look up at the same level of indentation, find a "for" (or an "if" or a "while" or whatever), and get confused?
If the closing brace matches up with a for, then I know it ends the for loop. An opening brace that lines up would add no additional information. Unless I was worried that someone had checked in code that had blocks with closing braces, but no opening braces. In which case the solution to the problem would not involve reformatting the code.
And what do printed listings have to do with anything? Is concision not valuable on-screen?
As to putting the closing brace at the end of a line, that's not consistency, that's OCD. "A foolish consistency etc."
Admin
THANK YOU! I've been thinking the same exact thing reading these comments.
Admin
That would be great.
Perhaps you and 1000 other WTF readers could write up one example each in, say, Wikibooks: Java ?
Admin
Obviously you never had to program in Fortran IV using punch cards.
Admin
Umm, the % key in vi. Use it. Love it.
Admin
You're a moron. How many bytes do you need to hold nbits bits? It's (nbits + 7) / 8.
8 bits = (8 + 7) / 8 = 1 byte.
9 bits = (9 + 7) / 8 = 2 bytes.
Admin
https://cialiswithdapoxetine.com/ cheap cialis