- 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'm sorry, i forgot that Gray code may be better for the state encoding, please accept my corrected version and consider changing the original also to use gray code. This will reduce some of the power consumed by switching less bits.
module wtf(clk, rst, c); output [7:0] c; reg [7:0] c; input clk; input rst; reg [1:0] s;
always @ (posedge clk or posedge rst) begin if (rst) c[7:0] <= 8'b0; else case (s[1:0]) 2'b00 : c[7:0] <= 8'd87; // 'W' 2'b01 : c[7:0] <= 8'd84; // 'T'; 2'b11 : c[7:0] <= 8'd70; // 'F'; 2'b10 : c[7:0] <= 8'd33; // '!'; endcase end
always @ (posedge clk or posedge rst) begin if (rst) s[1:0] <= 2'b0; else s[1:0] <= {s[0], ~s[1]}; end
endmodule
Admin
Admin
Admin
eider is swedish? Sure dont look like it and I cant remember seeing it. Ejder otoh is a swedish word. ;)
Admin
My first code review comment for this would be:
Case 4 is inconsistant, all the other cases append only one character, where as this appends 2. Please seperate into 2 cases.
Andy
Admin
Admin
[quote user="pscs"][quote user="ContraCorners"] No, someone came up with "I could have gone", it just isn't right.[/quote] I have gone.[/quote]
That's not right either.
I could have gone might be past tense or might be conditional. So it might have been right. I might have gone is also possibly conditional.
"I was able to go" is right, also "I had been able to go". You have to convert the modal verb 'can' to the 'to be able to' form. You have difficulty converting modal verbs (verbs which change the 'mode' of another verb) to past tense.
[/quote]
"I could go" is a perfectly valid past tense of "I can go".
Today, I can go to the store. Three years ago, I could go to the store.
Or to do it your way:
Today, I am able to go to the store. Three years ago, I was able to go to the store.
They both mean the same thing, and they are both perfectly correct.
Admin
[quote user="needless complexity"][quote user="pscs"][quote user="ContraCorners"] No, someone came up with "I could have gone", it just isn't right.[/quote] I have gone.[/quote]
That's not right either.
I could have gone might be past tense or might be conditional. So it might have been right. I might have gone is also possibly conditional.
"I was able to go" is right, also "I had been able to go". You have to convert the modal verb 'can' to the 'to be able to' form. You have difficulty converting modal verbs (verbs which change the 'mode' of another verb) to past tense.
[/quote]
"I could go" is a perfectly valid past tense of "I can go".
Today, I can go to the store. Three years ago, I could go to the store.
Or to do it your way:
Today, I am able to go to the store. Three years ago, I was able to go to the store.
They both mean the same thing, and they are both perfectly correct.[/quote]
It looks like I was wrong and that "I could go" is correct, but I've almost always heard it used in a way that implies that you are no longer able to.
Which just adds more support to my supposition on the difficulty of English.
Admin
At some point last night I realized I had forgotten how the hell this "I could go"/"I could have gone" debate started, and at that point I realized I needed to stop thinking about it and go kill some zombies. Left 4 Dead FTW!
Admin
Well, since everyone else is doing it, Ruby!
cleanNumber.each do { |n| formattedNumber.push(n) } formattedNumber.insert(0,"(").insert(-5,"-").insert(4,")").join
Admin
You're my friend!
Admin
No. But i wouldn't say 'i was able to go' either. I'd say I WENT, for fuck's sake. Either way of phrasing it implies that you'll follow with 'but I didn't', and sounds dumb if you don't.
Admin
Admin
LOL, that's what it's all about! It truly makes you say WTF.
Admin
??? "Hey, did you make it to the concert Friday?" "Yeah, my boss let me off early, so I was able to go."
Admin
phone "" 0 = "" phone s n = case n of { 12 -> "(" ++ phone s 11; 11 -> head s : phone (tail s) 10; 10 -> head s : phone (tail s) 9; 9 -> head s : phone (tail s) 8; 8 -> ") " ++ phone s 7; 7 -> head s : phone (tail s) 6; 6 -> head s : phone (tail s) 5; 5 -> head s : phone (tail s) 4; 4 -> "-" ++ phone s 3; 3 -> head s : phone (tail s) 2; 2 -> head s : phone (tail s) 1; 1 -> head s : phone (tail s) 0; _ -> ""}
Admin
Admin
I find this type of code in our legacy system on a daily basis :-(
Admin
Oh, and...
The past simple tense of "I can go" is "I could go." "I could have gone" is past perfect.
Don't confuse syntax with semantics here. "I could go" can be interpreted as past indicative (I was able to do it yesterday, but now I can't) or second conditional (I could do it now, if i wanted to.) In both cases, the tense of the modal verb is the same.
Admin
Might be a little out of practice (15 years), but I think this works:
out(['W' | [ 'T' | [ 'F' | [ '?' | [] ] ] ] ] );
P.s. Did I really read all of those comments and language discussions?
Admin
Admin
muzukashii sugiru ja nai no?
Admin
8-'
Admin
Au contraire. It makes no representation whether he is currently able to or not. (I'm speaking only of the language now, and not of whatever facial expressions or mannerisms the actor was employing as I only vaguely remember that episode.)
Furthermore, it is different from the example, which would be "I used to be able to put away three like you before breakfast." Clearly meaning that he no longer can.
Admin
Admin
Well, if its a bird, then Im pretty sure its a swedish word. Otherwise, you've got another word that is spelled the exact same way. ;) And the fact that you also have a word spelled the exact same way doesnt really prevent the existance of a word with a completely different meaning being spelled the same way in a completely different language.
And I just pointed out that eider is not a swedish word. The only correct use I can find of that spelling in swedish is the name of a german river. And I bet that its spelled the same way in german, so thus, its not swedish at all. ;)
Admin
Common Lisp
Admin
I'm not a computer programmer. I'm a controls engineer and I program in ladder logic. Sometimes I write crummy VB macros to do simple tasks for me.
I don't usually get much out of the code snippets posted here because they tend to go over my head. This one made me chuckle!
Admin
I'd hate to see what this does with an international phone number.
Admin
Right! The real way to validate a string is of course a Regex.
Wait a minute...
Admin
Ok, this is really horrible code, but at least you can read it and figure out what it's supposed to do.
Also, it looks to me like it will actually achieve the correct result. If so, then it's on par with bubble sort--except that bubble sort is obvious and wtf is only obvious if you're in the middle of stroke.
-- Furry cows moo and decompress.
Admin
I read the code. I burst in tears. Literally.
Admin
I want to see a haskell implementation
Admin
Admin
It's probably the work of an average programmer that was not used with Visual Basic. Guessing functions like MID$ and such from the first time is not obvious. However, "for" and "case" are written this way in many different languages. With the help of the auto-completion, this could explain a weird choice.
Admin
Someone indulge a newbie and explain exactly what's wrong and what the better alternative is.
Please?
As far as I see, it loops through each position and assigns appends the character relating to that position. What's wrong with a for case loop?
Admin
if its a fixed length state machine, why even run it in a loop at all? he could just code all 12 statements sequentially with no for and no select case.
Admin
I think I misunderstood it.
The case statement and for loop could just be removed and it would execute just the same, yes?
I was thinking of where the condition for the case was dynamic, rather than just going 1, 2, 3
Admin
Except there's no fall-thru in vb
Admin
I think this is simply supposed to be the "set next statement" in a crude IDE that offers only variable value watching and changing...
Admin
i get your point. but i don't think i would ever spell 'seeing' as 'seieing' or would that be 'sieeing'. no wait 'siieeng'...