- 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
First!
Admin
Easy to fix. Just do a search and replace. Changing every 10 in the result to A, no need to change the array.
Admin
Wow. I find this site entertaining, but often can't follow the coding stuff, as I'm a drafter, not a programmer. When it's immediately obvious to me what's wrong in a code example, you've F'd up big-time!
Admin
What? You never learnt heptadecimal??!
Admin
Wow, that's Unicode hex! Multi-byte hex characters!
Admin
Just need to make sure "10" == "A". You could probably do this with another base class, a few interfaces, some operator overloading, some preprocessor commands, a banana...
Admin
For some crazy reason this comment has 10 words, which doesn't make any sense to me.
Admin
creating a random number using the stringbuilder? WTF?
Setting a visible color (okay, buttumption based on naming) using a random? Sure this wasn't some kind of a college exercise?
Admin
Ah, good old Base 16-and-a-bit
Admin
I only use heptadecimal when I have a lot of "two" bits come back from my BitVerifier
Admin
The goggles, they do nothing!
Admin
Is this the MacGyver approach to coding? Wouldn't you need a paper clip and a rubber band then too?
Admin
I'd question it did. The smallest addressable space is the byte.
Admin
So? Read a byte and check every bit. What's the problem?
Admin
making "10" == "A" doesn't solve the problem, because "10" can occur independently (out of "1" + "0") thus creating a "5" char long number. Also, and doing this would also increase the weight of "A" in the random string generation.
Admin
No way!?!?!?!?!?1111111
Admin
If a byte was made out of cream-cheese, I'd agree with you. Unfortunately, it's usually made out of bits.
Admin
The real WTF here is that you wrote a utility that looped though files checking if each Bit is a 1 or 0...
Am I missing something or is that kind of redundant?
Admin
Yes, you are missing something.
Admin
But what if it was made of spare ribs? Would ya eat it?
Admin
Did you hear the whooosh, Someone?
Admin
I think that there is a Spinal Tap reference lurking in here somewhere. It's better than ordinary hexadecimal it goes to 17. Sort of.
Admin
Attention! CommentVerifier discovered that your comment does not. Please correct.
Admin
The code is fun, but WTF kind of application would require a random colour generator anyway?
Admin
Lol n00b.
That's, afaik, the shortest, easiest and most efficient way to get to the integer values of bits in the C programming language.
Admin
Admin
Admin
[pseudo] if bit_value == 1 return TRUE elif bit_value == 0 return TRUE [/pseudo]
CAPTCHA 'nobis', latin for that guy no one much likes (me)
Admin
That one I can agree. Definetely a wtf.
Admin
Seems like a junior programmer, which made a small error and blind stared on it for a while and finally giving up. Can happen. His mentor should help him and both move along.
Don't tell me nothing like this ever happened to you people.
Admin
omg! someone found out how scandisk is implemented!
Admin
Have you never heard of a loop??
int c=fgetc(infile);
for(int mask = 1; i <= 128; i *= 2) { bit = c & mask;
if(bit!=0 && bit!=1) printf("Error! Bit=%d\n",bit); }
Admin
Err...don't reply before coffee...
if(bit!=0 && bit!=1)
// should be
if(bit!=0 && bit!=mask)
Admin
No a problem per se. But it may as well be stored in ternary on the disk for all you'd know. When you say "check the bits", you don't check physical bits on your physical drive. Nor on any physical memory. Your program semantics include operators that yield ones or zeros. Not the same thing.
But quite some hair-splitting.
Alright, I'll get my coat.
Admin
I love it when people can laugh at themselves and even share the joke... I wrote my share of code like that during my early years... code that just doesn't make sense (although I don't think I every tried to find a bit that wasn't 0 or 1).
Admin
Admin
AH, but by using the AND operation you will lose data. You are, essentially, forcing the bits to be one or zero.
Besides, I like the aesthetics of my code better. Each section between the printfs gets progressively longer in an eye-pleasing way.
Admin
Obviously this has never been encountered in the real world as he clearly stated he had never run into a '2' bit.
Admin
Indeed. When I look back at the first project I wrote, I kinda have to smile as well. If this was a person with years of experience I'd say it's ok to get him from the project. In this case, where I assume that it's a new kid's mistake, it's silly to keep him away from a project.
Admin
Aww, that's the cutest WTF I've seen in a long time. I get annoyed when I see good coders makes stupid mistakes but when you see something like this you realise that the coder didn't even understand a fundamental concept of computer science. It just makes me want to give them a big hug as I tell them that software development is not the right career path for them and kick them out the door.
Admin
Well, that's another problem with Jake's report. Obviously in the real world, you'd never run into a '2'. No, you'd simply step on it without noticing. For they are really really tiny wee bits. Even smaller than their cousins bit 1 and bit 0, as the Unified String Theory (at least its UTF-8 variant) teaches us [citation needed].
Admin
Why would a bit be something other than 0 or 1?
Admin
Are there really this many people on the site who don't get the bit joke?
Admin
Maybe you're just not sure. As Heisenberg's Uncertainty Principle of Computer Science teaches, the more sure you are of the value of a bit the less sure you are of it's position on the disk
This was just built to verify that someone didn't get overzealous in finding out exactly where a bit was and force it to abandon a value of 1 or 0 since 50% is too high a chance to know the value of a bit if you're absolutely sure of its position.
Admin
You are not the sharpest knife in the drawer are you?
Admin
Admin
Yes I got the joke, I'm just bored waiting for a large compile job.
Admin
Admin
This has 10 words too.
Admin