- 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
Noah strikes me as the type of person who insists that the Nile river couldn't possilby flood into the Mediteranian sea every spring because if you look at in on a map or globe, that way is up, and water NEVER runs up hill.
<sigh> Yes, I actually went to school with someone stupid enough to waste 2 days of class time arguing that point. Worse, the teacher took part in the argument for both days instead of teaching. Even worse, the person knew they were full of it and just wanted to waste time instead of learning. To this day, I can't figure out which part of that chain was the stupidest. No matter how you work it out, Noah would fit right in there somewhere.
Admin
If only you could see the ingenious script he wrote to generate this.
Admin
Well, we could always write it in C
switch (totalHours)
case 1:
case 2:
...
case 12:
dayCount = 0;
hourCount = 12;
break;
case 13:
...
case 24:
dayCount = 1;
hourCount = 0;
break;
More insanity can follow.
Admin
I wish VB6 had a few more features, but it was livable.
What got in the way for me was VB6 insisting on syntax checking each line. This is a bother if you want to change another line while the line you are on is not syntactically correct. The checking can be turned off though.
It was nothing compared to the travails of VC++6. Add a class. Sometimes, it would not show up. Try adding it again: error that it already exists. It could not be deleted either. Welcome to the Twilight Zone.
Sincerely,
Gene Wirchenko
Admin
"I would marry you if we lived in Vermont."
Brokeback Office Cubicle.
Admin
O h m y f r i g g i n ' G o d
It has been a while since Alex has posted an instant classic such as this. This one is up there with IsTrue(). When I read this, I almost sprayed thousands of urines in my pants.
Admin
If you're wanting dayCount to be an integer, if I remember correctly (I've gone 5 years without doing anything in VB), you'd have to do:
dayCount = totalHours \ 24
Note that it's a backslash, not a forward slash, for integer division (otherwise dayCount would probably be a floating point number).
That being said, don't code in VB if you can avoid it. :)
Admin
riveting, mr.wirchenko. simply riveting.
sincerely,
A. Nonymous
Admin
I dunno... If I was Peter, I would have charged $10 per additional "day". He missed out on a golden opportunity here >:-)
--YY
Admin
effing funny!
Admin
You are to bring into the ark two of all half-days, morning and evening, to keep them alive with you.
Genesis 6:19, as interpreted by this Noah.
Admin
What The Fuck?
(captcha: DOOM .. is Zim in this forum software?)
Admin
First off, please stop all the Noah jokes. They aren't funny and you're upsetting Jesus.
Secondly, what's up with all you PHP haters? PHP is an awesome language. You have complete control over mixing up the code/html in a sexy marriage, or going MVC on its ass. Why should we complicate web pages with "applications" and shizzle like that? Having a web.config, and all the xml stuff taking care of, and controlling the application, only to write code for specific parts or "custom" portions of the "application" is really overkill.
I'm not saying there is not a threshold that once met, actually makes it easier to write and maintain a web site or web application in this manner, but for simple stuff like login, get/set data, it's WAY overkill. This is where PHP shines. Get the values from the db in xls or csv. PHP: easy. Java/.NET: overkill.
Bring it.
Admin
Along with non-alcoholic beer and vegetarian hamburgers...
And yeah, ostrich is pretty tasty. I hear the birds are pretty mean, though.
Admin
I agree, and I'm going to burn down my office in protest...just as soon as I finish my coffee.
Admin
The backslash? It has been in Microsoft BASICs since at least MBASIC 5. That was released about a quarter of a century ago. Are you a bit behind in your reading?
Sincerely,
Gene Wirchenko
Admin
No one is monitoring them. They work for people who know less about writing software than they do, often the only developer in a non-software buisness working for a boss who has no idea how software development is done. Trust me, I'm living the "dream". I started my new job a few months ago working for a big company, but it's not a software company. The software I write is used only here. I'm the first coder with any real experience they've ever hired. I've found some pretty nasty code. I think a lot of it comes from college kids and fresh-outs who don't have much experience and no one to guide them. We really need a software development guild.
Admin
It annoys me whenever I transition back to a C-like language from a VB project, that \ is not integer division. Mostly because I can never keep straight which languages perform idiv, which promote everything to doubles, and which perform some bizarre bullshit operation vaguely related to division.
Admin
Who the crap is monitoring us! You guys act like we are gods I have watched yall all day talk about this and get the code wrong you are trying to type like you know every language.
THE FOLLOWING IS WRONG!!!! WTF
THE ABOVE IS WRONG!!!! WTF
LOL,
Yeah infact you should just create a application that will all run external code that way you never have to worry about needing to fix bugs or change fields.
THE FOLLOWING CODE IS HOW YOU WOULD DO IT. SHEESH!!!
In VB the integer actually auto rounds up so you need to do it this way so you get the correct days
dayCount = totalHours / 24 - 0.49
hourCount = totalHours Mod 24
Admin
What's that I hear? Someone's ox getting gored...
Admin
I would think that taking the floor function would be more appropriate. In VB, dayCount = Int(totalHours / 24) should do the trick.
Admin
YEP!! Same thing basically but I was showing why.
Admin
Oh sorry was right int(expresion) reminded me that you can do this for short dayCount = totalHours <font size="6"></font> 24
<font size="6">\ does do that my bad</font>
Admin
But who wants job security at a job where you actually have to work? Copying and pasting is such a drag compared to doing "graphics card performance research."
Const MaxHours = 765
Const Granularity = 12
...
If totalHours > MaxHours Then
dayCount = 99999
hourCount = 99999
Exit Sub
End If
dayCount = Int(totalHours / 24)
hourCount = totalHours Mod 24
hourCount = hourCount + ((Granularity - (hourCount Mod Granularity)) Mod Granularity)
What? You want another 3 days added? Why, that'll take the entire afternoon! Six hour granularity?? All week!!
--Rank
Admin
My comment will probably be lost in all the noise, but does anyone know a good reference to answer "can this language to [x]?" questions? Might come in handy when we start playing what-if with the with the WTF.
For the record (and I'm too lazy to read the rest of the thread to see if I'm being redundant) Yes, VB/QBasic does and always had supported "a % b" meaning "a mod b".
Admin
Also, IIRC / doesn't round up, it rounds to the nearest even integer. Something about being more statistically correct...
Admin
Wow. Was all that heat really necessary for showing us another reason why you shouldn't be using VB?
Admin
And what specifically is your problem with PHP developers like me? Generalizing makes you look really, really dumb.
Admin
And what specifically is your problem with PHP developers like me? Generalizing makes you look really, really dumb.
Admin
I think someone read all about Duff's device, and decided to try it. Unfortunately they (in typical WTF fashion) didn't understand either how it worked, or what the point was.
Personally I'd do it like this (in C, because so far I've managed to avoid VB)
int dayCount = 0; for (;hourCount < 13;++dayCount) { hourCount -=12; }
hourCount = (dayCount & 0x01) ? 12:0; dayCount = dayCount >> 1;
Which has a much great job security advantage - any id10t can maintain Noah's version, it is just tedious. I'm not sure that I can maintain my version, so I know only the best programmers could replace me - if you could get them
Admin
Sigh, isn't the forum wonderful?
I'm not going to try again, so I leave it up to your imaginations what line noise I can come up with to do this in such a way that only the smartest programmers could dare touch my code - and then only with a 10 foot pole. (or is it a 10 foot cattle prod?)
Admin
I wish he was making this up. Presumably, they figured integer division was too hard for most people to grasp (not sure who "they" was; I know BBC Basic used "Div" for integer division rather than ). On the plus side, it means that the division operator behaves in the same way no matter the type of the operands (which is arguably a good thing).
Admin
Fixed. (You need to use > and < in HTML - the WYSIWYG view isn't, BTW).
Admin
Well, almost. (The forum software is a real WTF - it was treating it as plaintext as far as inserting newlines is concerned, but HTML otherwise - not a combination I've seen it do before. Or possbily it was just stripping < and > Either way - WTF?!).
Admin
Of course, you could just avoid the whole issue of "whether" daycount is an integer by making sure it's one.
hourCount = totalHours % 24
dayCount = ( totalHours - hourCount) / 24
Admin
Actually, VB is starting to suck less these days. Now VB has short circuiting (OrElse, AndAlso), Continue, Shared, etc. Break was always there as "Exit Do", "Exit For", etc. It even has += and -= like "real" languages. Too bad it only took 15 years.
Admin
I seriously ROFLd over this. As did all my coworkers, and all my friends on IRC.
Sincerely,
Not Gene Wirchenko
Admin
"thousands of codes"
lol. bit like all those idiots that think the plural of "Lego Brink" is "Legos".
Admin
<FONT face=Georgia>Not only would it take Noah thousands of codes to fix it, it would also take him thousands of times to finish the job. The company would have to pay him thousands of monies in compensation.</FONT>
Admin
Simple and easy to read.
I <3 recursion.
Admin
Nice :] That first sentence is the now the text of my screensaver. However I did have to modify it a bit because here in Australia "VB" is a type of generic beer and America's Funniest Home Videos has been renamed Australia's Funniest Home Videos and is hosted by a local idiot bimbo.
Admin
It's called "Banker's Rounding" and actually documented. Fix() and Int() don't use it, CInt does.
Admin
Dang forum...
Link disappeared....
Second try: http://en.wikipedia.org/wiki/Banker%27s_rounding
Admin
And to be complete:
http://support.microsoft.com/default.aspx?scid=kb;en-us;196652
Don't you just love the "Edit post" button of this forum? [pi]
Admin
VB.Net fixed that in 2001. Now, the line gets underlined in blue and an indicator shows up in the task list -- focus does not get pulled back to the line you just left. For me, it was one of the most welcome enhancements to the development environment.
Admin
Feh!
Nothing to do with VB (or PHP) - the blame here lies squarely with the intellectual giant doing the coding...
Admin
Admin
All these flames, and no light being shed at all...
While I have my issues with VB, especially older versions of VB, I would never say that the language was completely without redeeming features. Hell, not even COBOL is completely devoid of interest. For setting up a data gather forms or several other types of Windows programs (esp. ones that are mostly front ends on existing functionality), VB is often the fastest and easiest way to put the program together. It also makes an excellent UI prototyping tool.
Most of my real problems have to do with Microsoft's habit of changing the language for marketing reasons; the rather misleading 'simplicity' of the basic syntax (the language is actually quite complex, and in big projects it is easier; the way the development environment IME encourages careless coding habits, especially in novices; the lack of a shell programming (especially since it means throwing the movices into GUI programming from the start); the poor exception handling mechanisms; and the code-under-form mess. Several of these were addressed in VB.Net, though in ways that broke a lot of legacy code; while I don't think porting most VB6 code to .Net is feasible, I would consider VB.Net to be the better choice for any new projects, even given the problems which I perceive in .Net Framework.
I might add that, apropos the quote in my .sig, while I think VB is particularly bad for teaching, I don't consider C/C++/C#, Java or Perl to be much better; they all have serious complications that a novice shoudn't have to deal with. It is my experience that most new coders can learn the sequence of HTML ->Python (or Ruby or Smalltalk or Scheme) ->assembly language (yes, assembly - it is very useful in understanding the way the computer really works) ->C++ in less time than it would take them to learn C++ alone, and they would have a better understanding of C++ than those who studied just the one language.
As for PHP, I simply don't know enough about it to judge it effectively, but from what I've heard, it's an excellent tool light web work - and not much more. I may be mistaken on this, and my definition of 'light' may be a good deal heavier than most other peoples, but that's the impression I currently have. C&CW.
In summation: Horses for courses, folks. Most tools have some place in one's toolkit, and knowing how to pick the right one is as important as knowing how to use each of them well.
Admin
"I want more life!!!" - Replicant Roy Batty, Blade Runner
Admin
Isn't this called "arithmetics unrolling"?