| « Prev | Page 1 | Page 2 | Page 3 | Page 4 | Next » |
|
Easy to fix. Just do a search and replace. Changing every 10 in the result to A, no need to change the array.
|
|
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!
|
|
What? You never learnt heptadecimal??!
|
|
Wow, that's Unicode hex! Multi-byte hex characters!
|
|
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...
|
|
For some crazy reason this comment has 10 words, which doesn't make any sense to me.
|
|
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? |
|
Ah, good old Base 16-and-a-bit
|
Re: Some Crazy Reason
2009-02-16 09:16
•
by
Westbury
(unregistered)
|
|
I only use heptadecimal when I have a lot of "two" bits come back from my BitVerifier
|
|
The goggles, they do nothing!
|
Re: Some Crazy Reason
2009-02-16 09:19
•
by
Mike
(unregistered)
|
Is this the MacGyver approach to coding? Wouldn't you need a paper clip and a rubber band then too? |
|
> One time, out of boredom, I wrote a little utility
> called BitVerifier. It would loop over a folder and > check every bit of each file. I'd question it did. The smallest addressable space is the byte. |
So? Read a byte and check every bit. What's the problem? |
|
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.
|
Re: Some Crazy Reason
2009-02-16 09:29
•
by
blub
(unregistered)
|
No way!?!?!?!?!?1111111 |
If a byte was made out of cream-cheese, I'd agree with you. Unfortunately, it's usually made out of bits. |
|
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? |
Yes, you are missing something. |
Re: Some Crazy Reason
2009-02-16 09:36
•
by
Harry Carey
(unregistered)
|
But what if it was made of spare ribs? Would ya eat it? |
Did you hear the whooosh, Someone? |
|
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.
|
Attention! CommentVerifier discovered that your comment does not. Please correct. |
|
The code is fun, but WTF kind of application would require a random colour generator anyway?
|
Re: Some Crazy Reason
2009-02-16 09:44
•
by
FinnGamble
(unregistered)
|
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. |
Don't forget the satanic rituals and goat's blood. You will after all need some thrall's to maintain that hellish nightmare. |
If your irony detector hasn't been calibrated for some time, count until 0x10 before replying to this comment... |
Re: Some Crazy Reason
2009-02-16 09:53
•
by
some crazy chap
(unregistered)
|
[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) |
|
That one I can agree. Definetely a wtf.
|
|
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. |
|
omg! someone found out how scandisk is implemented!
|
Re: Some Crazy Reason
2009-02-16 10:04
•
by
Blackice
(unregistered)
|
|
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); } |
Re: Some Crazy Reason
2009-02-16 10:06
•
by
Blackice
(unregistered)
|
|
Err...don't reply before coffee...
if(bit!=0 && bit!=1) // should be if(bit!=0 && bit!=mask) |
Re: Some Crazy Reason
2009-02-16 10:13
•
by
My name
(unregistered)
|
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. |
|
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). |
Of course not. The set of possible values for a bit is {0, 1, FILE_NOT_FOUND}. |
Re: Some Crazy Reason
2009-02-16 10:18
•
by
FinnGamble
(unregistered)
|
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. |
Obviously this has never been encountered in the real world as he *clearly* stated he had never run into a '2' bit. |
Re: Some Crazy Reason
2009-02-16 10:22
•
by
Lennart
(unregistered)
|
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. |
|
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.
|
Re: Some Crazy Reason
2009-02-16 10:33
•
by
My name
(unregistered)
|
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]. |
|
Why would a bit be something other than 0 or 1?
|
|
Are there really this many people on the site who don't get the bit joke?
|
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. |
Re: Some Crazy Reason
2009-02-16 10:40
•
by
MainCoder
(unregistered)
|
You are not the sharpest knife in the drawer are you? |
Re: Some Crazy Reason
2009-02-16 10:42
•
by
JimmyVile
(unregistered)
|
|
Re: Some Crazy Reason
2009-02-16 10:43
•
by
JimmyVile
(unregistered)
|
|
Yes I got the joke, I'm just bored waiting for a large compile job.
|
Re: Some Crazy Reason
2009-02-16 10:45
•
by
Anonymous
(unregistered)
|
Yeah, sure, whatever you say (I'm sure you have to do loads of compiling in the data entry office)... |
Re: Some Crazy Reason
2009-02-16 10:48
•
by
DivineGod
(unregistered)
|
This has 10 words too. |
No. This. |
| « Prev | Page 1 | Page 2 | Page 3 | Page 4 | Next » |