• (cs) in reply to Schol-R-LEA

    Schol-R-LEA:
    All these flames, and no light being shed at all...

    I agree the correct way to do this in C would be:

    int days(int h) {

        d--;d--;d--;d--;d--;d--;d--;d--;d--;d--;d--;d--;d--;d--;d--;d--;d--;d--;d--;d--;d--;d--;d--;d--; return d ? days(d + 'D'-'-') + 1 : 1; }

    float HtoHAD(int d) { return days(d) / 100.f + h - d * 24; }

    The real WTF is why nobody else gave an answer in a real language :/

  • Mike (unregistered)

    ElseIf totalHours <= 24 Then
      dayCount = 1
      hourCount = 0
    ElseIf totalHours <= 36 Then
      dayCount = 1
      hourCount = 12
    ElseIf totalHours <= 48 Then
      dayCount = 2
      hourCount = 0

    You should write a macro:

    for i = 24 to 9999 step 12
       Print "ElseIf  totalHours <=" + i
       ...
    next

    So you don't need thousand coders!

  • MyName? (unregistered) in reply to Mike

    The only thing I'd ever have against simply going ahead and re-coding this bit to be more 'granular' is that you usually find that it then breaks something even more horrible further down the line ...

  • nik (unregistered) in reply to R.Flowers

    I preferred R Flowers' old avatar. It was sexy.

  • (cs) in reply to Djinn
    Djinn:
    Secondly, what's up with all you PHP haters? PHP is an awesome language.

    PHP is awesome in the sense that driving nails through your penis is awesome.

    The world isn't split between either crappy PHP pages or full J2EE stack and *shudder* Struts, there's stuff in between.

  • (cs) in reply to Djinn

    Djinn,

    YOU DA' MAN!!

     

  • (cs) in reply to jsmith
    jsmith:

    Gene Wirchenko:
    Anonymous:
    I would agree with you about VB having limitations, but I wouldn't say it sucked.  In capable hands the language is powerfull, but that goes for any language.  VB does do a lot of handholding and for an experianced developer this often got in the way, but sucking?  I think not.


    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

    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.

    VB6 (and if I remember correctly VB5 too) didn't steal the focus either if you'd taken the time to configure it correctly. Which is a breeze: Menu tools -> Options -> Uncheck "Auto Syntax Check". Voila.

    Ok, so no "cool blue wavy underline", but it DID (does) color the line red if an error was (is) found.

  • JarFil (unregistered) in reply to Runtime Error
    Anonymous:

    While using VB does not make you a dumb programmer, being a dumb programmer does make VB your weapon of choice.  That is unless you really don't know what the fuck you are doing, then its PHP all the way.


    Oh, come on. Neither VB nor PHP are anybody's "weapon of chice". The only reason there are sooo many dumb programmers going on with VB it's because of the IDE. Or what button do you bind all that PHP stuff to, huh? huh?!? There's nowhere, that's where :D
  • (cs) in reply to makomk
    makomk:

    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?!).

    I don't know. One less than did make it through just fine, while some semicolons did not. Even in your corrected version some lines are missing, and the less than that made it through in my version didn't in yours. Truely WTF.

    Thanks for trying though.

  • Machiavelli (unregistered) in reply to anonyMouse

    thats the name of a band in England 8-|

  • IngisKahn (unregistered) in reply to Nyne
    Anonymous:
    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

    ::sigh:: 23 \ 24 = 0 47 \ 24 = 1

  • IngisKahn (unregistered) in reply to IngisKahn

    OK, how in the hell do you quote someone?

  • (cs) in reply to RoKe

    RoKe:
    Mung Kee:
    Who the hell is monitoring these developers?  How do they get away with this?


    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.

    Most of the "programmers" in such companies are people who've had some programming at school (likely QBasic) and therefore know more about it than the rest.
    They therefore get given the job by default.
    This is true of most software companies as well...

  • (cs) in reply to IngisKahn
    Anonymous:
    OK, how in the hell do you quote someone?

    I've done it two times, this is the third... The two first times I just pressed the 'Quote' button and wrote after the quoted message, that seemed to work. This 3rd time I do the same, no idea if it will work... Did it?
  • (cs) in reply to impslayer
    impslayer:
    Anonymous:
    OK, how in the hell do you quote someone?

    I've done it two times, this is the third... The two first times I just pressed the 'Quote' button and wrote after the quoted message, that seemed to work. This 3rd time I do the same, no idea if it will work... Did it?

    Yepp, it worked... Can't say it seems too difficult ;)

    (Is it browser-dependent?)
  • (cs) in reply to impslayer
    impslayer:
    (Is it browser-dependent?)

    Not really, more like Heisenberg-dependant.

  • Nyne (unregistered) in reply to impslayer
    impslayer:
    Anonymous:
    OK, how in the hell do you quote someone?

    I've done it two times, this is the third... The two first times I just pressed the 'Quote' button and wrote after the quoted message, that seemed to work. This 3rd time I do the same, no idea if it will work... Did it?

    lol :D
    I love you guys I am joining!

  • (cs) in reply to Nyne

    Here is a tuffy can anyone right that in one line?

  • (cs)

    &lt;warning&gt;Another "THIS IS WHAT IS WRONG WITH THE WORLD TODAY! rant...."&lt;/warning&gt;

    sigh
    I'm starting to lose hope in humanity.
    Any programmer that produces code like this should be taken out back and shot. Seriously though, someone who produces code like this has such a lack of fundamental programming skills that they should be looking for a different career. I could go on and on how it's because of VB that stuff like this exists, but I won't. I will however point out that lots of code like this exists. I'll bet Windows has some code in it's codebase that looks like this. I'll also bet that it's one of the main reasons MS will never open up all of the Windows source. If they did, we could have a Daily Windows Coding WTF.
    sigh

  • (cs)

    Seriously how can a "professional" programmer code something this bad.  A person without any programming experience could look at that and see what crap it is. Any where you have hard coded number, not to mention rounding up using a hard coded number has to be wrong. expecially if there are more then like 2 if statments. There are many ways he could have fixed this.

    Anyone who knows a little math should realize that you can get the number of days by dividing the hours by 24. and the remaining hours are simply the remainder of the division.

  • (cs) in reply to masklinn
    masklinn:
    impslayer:
    (Is it browser-dependent?)

    Not really, more like Heisenberg-dependant.

    Actually, in a sense it is; there are some browsers it never works in (i.e. Konqueror, unless it's imitating IE), and the rest it sometimes works in (probably depending on the phase of the moon, the timce since most recent goat-sacrifice, etc.) Or should it be the other way round?

  • (cs) in reply to Runtime Error

    Anonymous:


    VB, much like generic beer and America's Funniest Home Videos is an enabling technology for stupid people.  It allows stupid people to do stupid things on scale that they couldn't accomplish on their own.  While using VB does not make you a dumb programmer, being a dumb programmer does make VB your weapon of choice.  That is unless you really don't know what the fuck you are doing, then its PHP all the way.


    Correction: using PHP rather than VB is only a tertiary indicator of cluelessness. The choice of PHP over VB is a much better predictor of having no money; having no money is a fair predictor of being non-serious; being non-serious is a good predictor of being stupid.

    I feel compelled to say this being a fairly serious guy who was forced to work as a one-man development shop with zero budget, and using less than a quarter of my available time. PHP was the path of least resistsance, and I used it to write some pretty nasty stuff (nothing as bad as what I've seen here), but I at least understood that what I was doing was bad and wrong and full of bad wrongness. So - no money, fairly serious, but not stupid.

  • (cs) in reply to Runtime Error
    Anonymous:
    Anonymous:
    Anonymous:
    Manni:

    Anonymous:
    Well, it's Visual Basic (QBasic?), what do you expect? :P

    I was wondering where the VB haters were. Thanks for showing up guys. And you're absolutely right, VB has absolutely no constructs for dealing with this problem in a simplified way. Thank God all other languages automatically de-stupid your code when you try to do stuff like this. Because after all, this would NEVER happen in C#.

    Or...could it? Hrm, I guess it's possible that the problem is the "programmer", and not the language. Nah, that's just crazy talk.



    VB, much like generic beer and America's Funniest Home Videos is an enabling technology for stupid people.  It allows stupid people to do stupid things on scale that they couldn't accomplish on their own.  While using VB does not make you a dumb programmer, being a dumb programmer does make VB your weapon of choice.  That is unless you really don't know what the fuck you are doing, then its PHP all the way.


     

    You forgot to put your flame suit on.



    I figured most of the PHP guys wouldn't figure out how to get past the captcha thing.


    I had a scathing reply ready, but I can't figure out how to get it posted...

  • (cs) in reply to IngisKahn
    Anonymous:
    OK, how in the hell do you quote someone?


    I have no idea.
  • Shakespeare (unregistered) in reply to IngisKahn
    Anonymous:
    OK, how in the hell do you quote someone?



    Easy.   Ask Sly Stallone. . .


    "To be. . .  or what. . ."
  • Valdis (unregistered) in reply to Runtime Error
    Manni:


    VB, much like generic beer and America's Funniest Home Videos is an enabling technology for stupid people.



    Definite .sig fodder.  Maybe even bumper sticker or t-shirt.

    And BTW,  the monitor needed cleaning anyhow, so the caffeine spray is no big deal....


  • ChiefCrazyTalk (unregistered) in reply to eddieboston
    eddieboston:
    Anonymous:
    OK, how in the hell do you quote someone?


    I have no idea.

    Works for me about 50% of the time, using Safari. Let's see if this time is one of them...

  • ChiefCrazyTalk (unregistered) in reply to ChiefCrazyTalk
    Anonymous:
    eddieboston:
    Anonymous:
    OK, how in the hell do you quote someone?


    I have no idea.

    Works for me about 50% of the time, using Safari. Let's see if this time is one of them...

    Dang, I guess not. Maybe this time...

  • ChiefCrazyTalk (unregistered) in reply to ChiefCrazyTalk
    Anonymous:
    Anonymous:
    eddieboston:
    Anonymous:
    OK, how in the hell do you quote someone?


    I have no idea.

    Works for me about 50% of the time, using Safari. Let's see if this time is one of them...

    Dang, I guess not. Maybe this time...

    OK I give up.

    Sincerely, Paula

  • NZ'er (unregistered) in reply to John YaYa
    John YaYa:
    Manni:

    Manni:

    True that.

    <font color="#000000" size="6"><font color="#0000ff">D</font> <font color="#ff0000">o <font color="#ffff00">u</font> </font><font color="#0000ff">b</font> <font color="#008000">l</font> <font color="#ff0000">e</font>   <font color="#ffff00">T</font> <font color="#0000ff">r</font> <font color="#008000">u</font> <font color="#ff0000">e</font></font>

    Damn forum software didn't color the text right. If you quote my response, you'll see it's correct. You know what the real WTF is here right? Flightless birds. Seriously, does that make any sense?


    Along with non-alcoholic beer and vegetarian hamburgers...

    And yeah, ostrich is pretty tasty.  I hear the birds are pretty mean, though.


    Not to mention caffeine free diet Coke there is a true WTF
  • (cs) in reply to masklinn
    masklinn:
    impslayer:
    (Is it browser-dependent?)

    Not really, more like Heisenberg-dependant.



    I also think that the position of Jupiter relative to Venus when Mercury is in the ascendant may come into consideration.

    That and how you hold your tongue.
  • (cs) in reply to ChiefCrazyTalk
    Anonymous:
    Anonymous:
    Anonymous:
    eddieboston:
    Anonymous:
    OK, how in the hell do you quote someone?


    I have no idea.

    Works for me about 50% of the time, using Safari. Let's see if this time is one of them...

    Dang, I guess not. Maybe this time...

    OK I give up.

    Sincerely, Paula

    Worked for me about 0% of the time in Konqueror, until I told it to pretend to be IE. Had a 100% success rate so far since. Maybe if I set it to imitate Safari, I can make every quoted reply a gamble too... nah, can't be asked.

  • IronLizard (unregistered) in reply to GoatCheez

    Really, I'm shocked. Has no one here read the Bastard Operator from Hell series? I just wonder how long the guy laughed over this before dissapearing. Probably left citing recent sunspot activity as a factor...... right after redirecting his boss's email to /dev/null.

  • (cs) in reply to masklinn
    masklinn:
    Djinn:
    Secondly, what's up with all you PHP haters? PHP is an awesome language.

    PHP is awesome in the sense that driving nails through your penis is awesome.

    The world isn't split between either crappy PHP pages or full J2EE stack and *shudder* Struts, there's stuff in between.

    You typed a lot of words, but you haven't said anything. What, besides lexical scoping, does your holiness not approve of? What's this stuff in between? Ruby (loser)? Python (quiche eater)? I expect you'd go for CGI.

    Don't mess with the bull - you'll get the horns.

  • John Hensley (unregistered)

    After seeing this I might just join a monastery.

  • jerith (unregistered) in reply to pmagill
    Anonymous:

    I would agree with you about VB having limitations, but I wouldn't say it sucked.  In capable hands the language is powerfull, but that goes for any language.  VB does do a lot of handholding and for an experianced developer this often got in the way, but sucking?  I think not.


    In my experience (which involves tutoring VB as well as having to use it) the handholding is less of a problem than the inconsistencies and horrendous unhelp system.  The students get into a cargo-cult programming mindset that is difficult to break when they learn a different language in the following semester.
  • Omnilord (unregistered)

    That looks like something written by a 11 year old in their first week of learning VB... So Script-kiddieish

    CAPTCHA: unreal

  • (cs) in reply to ChiefCrazyTalk
    Anonymous:
    Anonymous:
    Anonymous:
    eddieboston:
    Anonymous:
    OK, how in the hell do you quote someone?


    I have no idea.

    Works for me about 50% of the time, using Safari. Let's see if this time is one of them...

    Dang, I guess not. Maybe this time...

    OK I give up.

    Sincerely, Paula


    Hmmm... Will me quoting your garbled posts make them suddenly look good???

  • (cs) in reply to impslayer

    impslayer:
    Anonymous:
    Anonymous:
    Anonymous:
    eddieboston:
    Anonymous:
    OK, how in the hell do you quote someone?


    I have no idea.
    Works for me about 50% of the time, using Safari. Let's see if this time is one of them...
    Dang, I guess not. Maybe this time...
    OK I give up. Sincerely, Paula

    Hmmm... Will me quoting your garbled posts make them suddenly look good???

     

    That is just freaky in a curius IT pervertion way..

  • java dork (unregistered) in reply to Nyne
    Nyne:
    Here is a tuffy can anyone right that in one line?



    in java:

    dayCount = (totalHours - (hourCount = totalHours % 24)) / 24;



    captcha: hamburger
  • Anonymouse (unregistered) in reply to Runtime Error

    Yeah but try finding cheap hosting for web-based applications that offers anything other than PHP / MySQL, is not Windows / IIS / ASP based (security and reliability are problematic) and doesn't lock you in to just a few providers...

  • (cs) in reply to Anonymouse
    Anonymous:
    Yeah but try finding cheap hosting for web-based applications that offers anything other than PHP / MySQL, is not Windows / IIS / ASP based (security and reliability are problematic) and doesn't lock you in to just a few providers...

    As long as you don't want free hosting it's actually not that hard to find CGI/Perl, CGI/Python and more and more CGI/Ruby due to RoR gaining ground, often with FastCGI option (rarely mods though).

  • (cs) in reply to Nyne

    Nyne:
    Here is a tuffy can anyone right that in one line?

    Sure.

    that

    Awrighty then.

    CAPTCHA: uh, never mind, I bothered to register ... dweeb me

  • silverpie (unregistered) in reply to The Mad Mullah
    Anonymous:

    Also, IIRC / doesn't round up, it rounds to the nearest even integer. Something about being more statistically correct...

    True iff the rounding is at an exact .5 mark. Anything else, it rounds to the nearer side. That's called "bankers' rounding," and has usefulness (in particular, it does not introduce biases in rounding off large numbers of items).

  • Loren Pechtel (unregistered)

    The problem is simple--division is one of those new-fangled unreliable things!

  • (cs)

    this saved my day.

  • (cs) in reply to masklinn
    masklinn:
    Anonymous:
    Yeah but try finding cheap hosting for web-based applications that offers anything other than PHP / MySQL, is not Windows / IIS / ASP based (security and reliability are problematic) and doesn't lock you in to just a few providers...

    As long as you don't want free hosting it's actually not that hard to find CGI/Perl, CGI/Python and more and more CGI/Ruby due to RoR gaining ground, often with FastCGI option (rarely mods though).



    I just can't resist throwing in a plug for the web host I'm using, Dreamhost.  They've currently got Perl 5.8.4, Python 2.4.1, Ruby 1.8.2, Ocaml 3.08.3, Ruby on Rails.  And gcc 3.3.5 if you feel like compiling and using something else.  I haven't actually written any CGI scripts in Ocaml ... yet.  Let's see, what else?  Linux 2.4, fcgi, mod_rewrite, PHP, MySQL, ssh access, easy installs of MediaWiki or WordPress on your site, good prices, excellent support.

    Sorry for the blatant commercialism.  I don't work for them, I'm just a very satisfied customer.
  • (cs) in reply to DrCode
    DrCode:
    Sorry for the blatant commercialism.  I don't work for them, I'm just a very satisfied customer.

    Well, also being a (satisfied) DH customer, I don't have any issue with your (shameless) plug myself, but others may feel otherwise ;)

    (you forgot to say that they have an ass-kicking admin panel, too)
  • Merlin (unregistered)
    Alex Papadimoulis:
    'Calculate days/hours based on total
    '  Hopefully, we wont need to go
    '  more granular than 12h
    If totalHours <= 12 Then
      dayCount = 0
      hourCount = 12
    ElseIf totalHours <= 24 Then
      dayCount = 1
      hourCount = 0

    (snip...)


    Honestly, when I look at that, I just wanna cry.

    Then I think that I'm not really afraid of indian and chinese people "taking our jobs" because of all the outsourcing.
    I become afraid of *this* kind of people (such as the author of this tasty piece) taking our jobs.

    Then again, maybe it was outsourced work after all.
  • ~~ (unregistered) in reply to Merlin

    Or maybe indians or chinese ppl are "taking your jobs" because some of you do code like this? Not that the indian/chinese would be any better :))

Leave a comment on “Got Time?”

Log In or post as a guest

Replying to comment #:

« Return to Article