- 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
IMO that "something" is simply a bit of laziness and a strong aversion to repetitive, boring tasks. It makes you think "there MUST be a better way to do this" and then find that way.
Admin
It's called ‘dropping you H’s’. There is this nice article about it, called Dropping you Aches, if I remember well, but I couldn’t find it.
captcha = register, nice one.
second try: captcha = ernest (somebody been reading Wilde?)
third try: captcha = register (again)
fourth try: captcha = screen
fifth: real
sixth: fortune
platinum (I'm losing my temper here)
zork
register
ah, damn, It was my name I didn't fill in
Admin
It's "proper" British English only if the word when pronounced tends to lose its non-vowel initial sound. "An Hotel" would sound like "An Otel" since the H is often lost, exposing the O. "An Horrible Day" would sound generally like "An Orrible Day" similarly.
Saying "An Hexadecimal" as "An Exidecimal" does sound a bit common though!
Admin
I would print this code, and carry with me to the indoor sanitation. But I would need to search skinfriendly ink/toner, and a printer could print on a 'very special' paper.[;)] I would read 'from cover to cover', then the already read sections would be...destroyed.[8-|]
Admin
Oh, God... This isn't true. I'm not kidding, I don't believe this is genuine.
Admin
I once heard a mathematician tell this joke: Pi is equal to 3 for sufficiently small values of pi, or sufficiently large values of 3.
I think I prefer pirate jokes.
Admin
Maybe that will only be 2,500 lines long? pi
Admin
You dummy, that's not 3.14, it's THREE. I know it is so because the BIBLE told me so!
Admin
Admin
I'm sure i'm WAY too late to point this out, but hex(10) shouldn't be "10"
-dave-
Admin
And then again, maybe the programmer wrote a very nice, small, elegant code generator to generate thousands of LO such C for him. :-)
Admin
I do know engineers who, when faced with the sensible absurdities (that's only a contradiction if you've never worked in the defense industry) of their day-to-day jobs, will protest against those absurdities with monstrosities like this. Even people who are not paid per SLOC. Even people who are not paid by the hour. It's a form of rebellion. (It doesn't sound as if that was this guy's problem, though.) Annoyed at a coding standard that requires you to comment even the bloody obvious? Comment absolutely everything! Irked that your program's performance is evaluated in terms of SLOC without regard for code complexity or anything like that? Take SLOC to its logical extreme! I could definitely see several people I know writing a beautiful piece of very simple software that produces this huge pile of (nevertheless perfectly functional) crap just because. Add in a boring project without enough challenge, and you start looking for ways to make your job more interesting.
Admin
On the other hand I had people working for me who handed me similar code just because they didn't knew about the proper APIs and on the other hand they didn't want to look stupid and bother asking so they really worked hard to do what they were asked for. I always wonder how people keep using cut-n-paste in cases where writing a simple function would not only simplify their job but also help maintain the code in the future and that's just the beginning of the advantage list.
Here's a piece of code from someone I interviewed and this is what I got when I asked for "code you have written yourself and is part of an actual production system, not your graduation project":
procedure Tfrmobr.Edit58KeyPress(Sender: TObject; var Key: Char);
begin
if not (key in [#8,#44,#48..#57]) then key:=#0;
if key=#46 then Key:=#44;
if key=#44 then
if pos(key,edit58.text)<>0 then key:=#0;
end;
procedure Tfrmobr.Edit59KeyPress(Sender: TObject; var Key: Char);
begin
if not (key in [#8,#44,#48..#57]) then key:=#0;
if key=#46 then Key:=#44;
if key=#44 then
if pos(key,edit59.text)<>0 then key:=#0;
end;
<snip>... + a fiarly large number of other fields with similar event handler, that were actually named like "edkolm3" or "edkolt".
Notice the nice component naming convention "Edit58" or "Edit59". I won't even mention the magical numbers... What really bugs me here is that instead of 100 similar functions it all could be:
procedure Tfrmobr.EditKeyPress(Sender: TObject; var Key: Char);
begin
if not (key in [#8,#44,#48..#57]) then key:=#0;
if key=#46 then Key:=#44;
if key=#44 then
if pos(key,TEdit(Sender).text)<>0 then key:=#0;
end;
Changing something in the behaviour of all these boxes would later cost at least a day of fixing and debugging instead of 5 minutes coding and 5 minutes testing... And I would be paying the salary in this time, am I not?
I admit I'm a bit lazy, but I'm amazed everytime I see this, how is it possible, that people keep working on something like this without stopping at one point to think for a while if there isn't an easier way to do it with less efforts.
Admin
I have to agree about the laziness; some people will do a lot of work to avoid finding out how to do it the easy (and generally better) way.
However, I do take some issue with asking people to provide code they wrote which is part of a production system. I have written a lot of code for production systems, but it is not mine to give away.
Admin
I just want to see something real, I need a couple of functions and I don't even care what they do, all I do care is to see how this person writes code. I am aware about NDAs etc, but so far I didn't have a situation with anyone who's unable to show anything because he/she is bound by contracts etc.
On the other hand I had people working for me asking for permission to show some of the code they actually wrote to other companies during an interview and I had no problem with this either.
Admin
Well, that's okay then. ;-) I know I could get in a lot of trouble if I removed any of my code from the building, so you'd be stuck with examples of personal projects. I guess I ought to come up with some more personal programming projects!
Admin
Funilly enough Java already has a method to convert and int to hex
for a uni student i'm happy, please bag the crap out of this if its WTF worthy!!!
Admin
Minor corrections:
"an hexadecimal" would be part of the modern standard British (imperial) dialect, which was invented around 1750. Still rare, though.
Pirate would be "a f***ing (h)ex! hard a-larboard! aarrrh!". For the modern version of the dialect, check these guys out.
Admin
A lesson on language
The ‘H’ words beginning with the sound of a vowel have are preceded by the article ‘an’.
Example: "It's and honour to comment here" "I saw this an hour ago" "You are an honest person"
As opposed to:
"It is surely a hexadecimal" "Everybody needs a home”"
Cheers
Amit
Admin
The biggest WTF here is that even those commenters who tried to show how it's done missed the point by only giving a way to convert integers to hex strings, while the original request was to convert byte arrays. What if the byte array is bigger than what can fit in Java's int or long?
So, to answer your challenge, here is the Java one liner to convert a byte array to hex string, in all its glory:
String hex = new BigInteger(1, theByteArray).toString(16);
The BigInteger class is in the java.math.* package and can handle arbitrary sized byte arrays, up to the limits of available memory.
P.S. The fact that I'm replying to a nearly 2 year old thread is a WTF in itself, but I was browsing the archives and couldn't resist.
Admin
I one worked on a mainframe computer (I think it was Burroughs) that used three nibble bytes (octal so 3,3,3)
Admin
In the U.S., at least, they used to teach that it was always "an" before an "h." (I don't know what the scholars said, but this was the common teaching.) I realized that this didn't make sense, and so surrreptitiously only used "an" when the "h" was silent. I thought I was a maverick.