• Patrick (unregistered) in reply to mrsticks1982

    Regardless as to weather or not the object is by reference, or by value it should still behave the same way if SendItemToTransmitter doesnt' modify the object.  When the object is passed into the SendItemToTransmitter() call it should have a marker (or something) indicating what row it's currently on, and then the function processes that row.  I'm assuming that by virtue of the fact that the call to the rsStock.MoveNext is made to iterate the object.

     

    If it's by reference...the object itself is passed...if it's by value the copy constructor is invoked...oops thsi isn't C++ 

  • Franz Kafka (unregistered) in reply to elKodos

    Anonymous:
    The contractor got what he deserved, it seems to me.  The problem appeared to be caused by a last-minute untested change, but he thinks his own ad-hoc change is infallible.  Fixing code in emergency mode is risky, fixing someone else's code even more so.  He should have got the warehouse going in as conservative a way as possible.

    IMO, minimum risk would be to (1) do an inquiry (using SQL admin tools if necessary) to find the part, (2) advise the warehouse to pick it and ship it without system involvement, if necessary -- there's always a way, (3) advise the warehouse to do whatever inventory and billing adjustments were necessary the following day once authorized coders knew of the work-around, and (4) write up a quick summary of this work-around to submit to the boss the next day.

    Some adjustment to this 4-step program might be needed if it seemed that the system would be hanging repeatedly through the night on other parts, but in this particular emergency situation, the principle of minimizing risk seems to trump the principle of minimizing work.

    If he plays it that way, likely he doesn't even get reamed for unauthorized hours.

    Sounds like maximum arse covering to me. The fix here looks like it works just fine, and all your talk about risk falls flat when you consider that the cousin deployed this change and then just left. This was an emergency, it would have repeated in short order if the problem hadn't been resolved, and this is just the sort of thing emergency code fixes are designed for. Seriously, this is an isolated change, and i find it incredible that brother cousin was doing this horrible query for some subtle reason 

  • Eric (unregistered) in reply to Jeff S

    You can't be sure it's pre .NET, it's just wtfy enough where they might have added a reference to the ADODB Interop assembly and accessed the recordset class.

     

  • (cs)

    Two years ago, we had a software install issue where we needed to deploy a new version of a scripting engine across our dev/staging/production web servers.  At the time, I was working for a behemoth of a company -- SOX compliance had just landed and all servers were controlled by an on-site third party vendor/partner.  That's right -- ALL of them.  We didn't even have root access to our dev box.  Those of you who can relate know that this means a lot of time spent coordinating change management controls against the development timeline for even the most minute of changes.

    To compensate, we had our own dev/staging environments hiding out in some SA's cube so that way we could tell these contractors what needed to be done...and often times, how to accomplish it.  Same version of Solaris, slightly different disk and memory specs, same software packages as what we had on the untouchable "real" boxes.  Now, I'm not a sysadmin and it took me some time and a few tries, but I had performed the software update on both of our machines, chronicled step by step instructions of the commands to execute to accomplish the upgrade on the "real" machines, and sent them off to the "expert" [cough] 3rd party SA.  I assumed it would take a week for all three boxes, so I submitted the instructions two weeks ahead of the desired deadline just to make sure there wouldn't be any delays.

     A week and a half goes by, and I finally hear from the SA: the upgrade build is failing on dev.  He emails me the error messages, I check the log files using my handicapped user account, and tell him what he's doing wrong.  Finally, the Friday before the Monday @ 8:00 AM deadline, he tells me he got the dev box built but couldn't get the staging box upgraded and that's where he's stuck.  The project manager was freaking out because if we miss the deadline, the project couldn't be capitalized and we'd essentially lose the project.  He convinces the SA to give me root on all three boxes for the weekend so I can meet the deadline.  It was a 30-hour work weekend for me to fix all of this guy's mistakes and perform the upgrades, but I met the deadline and our project was saved from the depths of expense-hell.  Big hero, right?  Saved the project and 20+ people's jobs, right?

    The kicker:  I was, under NO circumstances, to let anyone know that I was given root, nor to admit that I had solved the issues myself.  Gotta love compliance.
     

  • audiedog (unregistered) in reply to not you

    This looks like VBScript, and if that's the case, then the entire recordset is not passed as a parameter, because rsStock is actually a cursor with only a single row represented.

  • Divy (unregistered)

    This actually is not a WTF but security feature. The DB should not know which screw the warehouse workers are looking for.

  • kswanton (unregistered) in reply to mrsticks1982
    mrsticks1982:
    Jeff S:
    Anonymous:
    Sgt. Zim:
    Alex Papadimoulis:

    Set rsStock = objConn.Execute("SELECT * FROM [Inventory]")
    While Not rsStock.EOF
      If rsStock("ItemId") = intItemId Then
        Call SendItemToTransmitter(rsStock)
      End If
      rsStock.MoveNext
    Wend

    And if I'm reading this correctly, after pulling down millions of rows, and iterating through them, finding the target on, say the 12,384th pass through the loop, doing whatever SendItemToTransmitter does ... It keeps going the rest of the way through the millions of rows.  Or was that just a feature of the anonymo ... anonymiz .... the process of making it anonymous? 

     

    [Note from Alex: Good obvservation. The code is more of a representation/simplification of what it would have looked liked (Ivan didn't save the original) -- but perhaps that's why the nephew didn't notice the bug? He looked for Item 0000001, while the screw is Item 9999901?]

    The WTF goes deeper than that, my friend. After looping through the recordset and finding the record with the correct item ID, THE ENTIRE RECORDSET is passed into the function. No global variable is set and no other parameter is passed to let that function know which record to use. Presumably, SendItemToTransmitter loops through the entire recordset AGAIN.

    WTF indeed.

    Aparently, you are not familiar with passing by reference, are you?  the entire recordset is not sent anywhere, just a pointer.  And a recordset has a "currentRecord" concept, so the current record is available to the function.  Passing a recordset object to a function is very, very common and much preferable to using global variables, which is generally considered poor programming style.

    Not understanding basic concepts like this is often how many WTF's are born ... 

    (edited to fix some typos) 

    You don't see the calling function so you cannot assume that they where smart enough to use byref. Visual basic defaults to byval passing.

    also, upgrade to Firefox 2.0 it has built in spell checking, cause you still have that word spelled wrong.

     
    Who really cares if it was ByVal or ByRef in this case?  Passing an object ByVal does not copy the object itself, only the pointer to it.  Do you think passing a recordset object with a million rows in it to a function ByVal is going to put the entire object on the stack??

     

  • (cs) in reply to dunnomattic
    dunnomattic:

    The kicker:  I was, under NO circumstances, to let anyone know that I was given root, nor to admit that I had solved the issues myself.  Gotta love compliance.

    Looks like you failed. :P 

  • Cheong (unregistered) in reply to kswanton
    Anonymous:

    Who really cares if it was ByVal or ByRef in this case?  Passing an object ByVal does not copy the object itself, only the pointer to it.  Do you think passing a recordset object with a million rows in it to a function ByVal is going to put the entire object on the stack??

    No. But passing ByVal means to copy the whole object to another memory location(so the function cannot modify the origional one) then pass the new generate pointer to the function.

     Copy a recordset contains millions of row means a lot of time and memory is required.
     

  • (cs) in reply to themagni
    themagni:
    dunnomattic:

    The kicker:  I was, under NO circumstances, to let anyone know that I was given root, nor to admit that I had solved the issues myself.  Gotta love compliance.

    Looks like you failed. :P 



    Sadly, this isn't too far off the mark from my place of work. We've got 2 full time MSCE guys doing what our one dev should be doing as his part-time job, for "Compliance" reasons. Sigh. It'd be fucking fantastic if we could just configure a real mail setup instead of using exchange (which requires its own box, which needs to be rebooted four times a day...), for example. But, heavens no, then we might loose that fantastic calendering app built in! Likewise, if the dev database box has a problem, we end up waiting for our DBA to stand over the shoulder of an IT guy to tell him what to type, because we're not allowed to touch the keyboard ourselves.

    Oh look. The fucking forum software decided to replace all of my spaces with   from "shoulder" forward. Great job picking a real winner there, Alex.
  • Steve (unregistered) in reply to shaggz

    I wouldn't bet my paycheck that this was tested at all...

  • (cs) in reply to Cheong
    Anonymous:
    Anonymous:

    Who really cares if it was ByVal or ByRef in this case?  Passing an object ByVal does not copy the object itself, only the pointer to it.  Do you think passing a recordset object with a million rows in it to a function ByVal is going to put the entire object on the stack??

    No. But passing ByVal means to copy the whole object to another memory location(so the function cannot modify the origional one) then pass the new generate pointer to the function.

     Copy a recordset contains millions of row means a lot of time and memory is required.
     

    It's people like you who give VB developers a bad name. For the nth time, this is how it works.

    Objects/ByVal: Pass a copy of the pointer.

    Objects/ByRef: Pass a pointer to the pointer.

    Primatives and Structures/ByVal: Pass a copy of the Structure

    Primatives and Structures/ByVal: Pass a pointer the Structure

    You never, ever copy get a copy of an object in VB just by passing it to a function. Unless the object has a Copy() or Clone() method, you are always working on the original.

     

     

     

  • (cs) in reply to Grauenwolf

    The real WTF here is people arguing over anonymized code rather than providing more humorous examples of nepotistic cretins in techology management situations.

  • Yorinaga (unregistered) in reply to Joel

    The real WTF in your case is that you don't do anything to <em>make</em> SQL available for your data, such as reading it into a real database system.

  • (cs) in reply to Grauenwolf
    Grauenwolf:
    Anonymous:
    Anonymous:

    Who really cares if it was ByVal or ByRef in this case?  Passing an object ByVal does not copy the object itself, only the pointer to it.  Do you think passing a recordset object with a million rows in it to a function ByVal is going to put the entire object on the stack??

    No. But passing ByVal means to copy the whole object to another memory location(so the function cannot modify the origional one) then pass the new generate pointer to the function.

     Copy a recordset contains millions of row means a lot of time and memory is required.
     

    It's people like you who give VB developers a bad name. For the nth time, this is how it works.

    Objects/ByVal: Pass a copy of the pointer.

    Objects/ByRef: Pass a pointer to the pointer.

    Primatives and Structures/ByVal: Pass a copy of the Structure

    Primatives and Structures/ByVal: Pass a pointer the Structure

    You never, ever copy get a copy of an object in VB just by passing it to a function. Unless the object has a Copy() or Clone() method, you are always working on the original.

     Goddamn thank you. I was worried I was going to have to start spelling it out for people as well....

     This is why people should not be allowed to pick up VB6 as a first language without understanding how the magical stuff you type gets (roughly) turned into magic that makes more magic smoke move around the silicon in morse code or whateverthefuck. Number of arguments I've had with co-workers over how "less lines of code may not be faster" - especially crap invoving "redim preserve" every time you add an item to an array.

     Cos y'know linked lists are a lot heavier weight than an array - and redim preserve is a "built in instruction" so it _must_ go quicker. (/sarcasm)

  • (cs) in reply to shaggz

    Anonymous:
    I would bet my paycheck that he tested versus a developmental database that had 100 or so rows in it.  Since it worked fine there, roll it out and roll on out of there.

     

    I ran into precisely that situation once at my old job.  (The offender was part of an outsourced team - early evidence that Sturgeon's Law applies to them as well.)  At least I didn't get any flak for the fix.

     

  • (cs) in reply to Griz
    Anonymous:

    DigitalLogic:
    Alex Papadimoulis:
    the boss went off on him, criticizing him for coming in at an unauthorized time, making an unauthorized software change, and for compromising the integrity of the warehouse system. Ah well, so is the life of a contractor


    Sounds like its time to find a new contract.

    Nah, just charge the 1D-10-T tax.

    I prefer the FUINTHEA fee.

    (please ignore my previous post, quoted the wrong post, this forum software really sucks) 

  • ChiefCrazyTalk (unregistered) in reply to reptar

    The real WTF is that the contractors are more capable than the full time employees (no offense to any good contractors out there).  In my experience, its been the opposite - contractors come in and F up the system.

  • (cs) in reply to KattMan
    KattMan:

    Remember the first rule of contracting, you are the disposible one.

     
    Um no.   That's not how it works.  I choose my contracts.  I can also fire my customer.   Good customers may be hard to come by, but that doesn't mean I'm going to waste time on a bad customer and miss the good customer.

  • Me (unregistered) in reply to Cheong
    Cheong:
    Anonymous:

    Who really cares if it was ByVal or ByRef in this case?  Passing an object ByVal does not copy the object itself, only the pointer to it.  Do you think passing a recordset object with a million rows in it to a function ByVal is going to put the entire object on the stack??

    No. But passing ByVal means to copy the whole object to another memory location(so the function cannot modify the origional one) then pass the new generate pointer to the function.

     Copy a recordset contains millions of row means a lot of time and memory is required.
     

     

    You guys really are funny. 

     

    I truly enjoy this site. 

  • (cs) in reply to elKodos

    Anonymous:
    The contractor got what he deserved, it seems to me.  The problem appeared to be caused by a last-minute untested change, but he thinks his own ad-hoc change is infallible.  Fixing code in emergency mode is risky, fixing someone else's code even more so.  He should have got the warehouse going in as conservative a way as possible.

    IMO, minimum risk would be to (1) do an inquiry (using SQL admin tools if necessary) to find the part, (2) advise the warehouse to pick it and ship it without system involvement, if necessary -- there's always a way, (3) advise the warehouse to do whatever inventory and billing adjustments were necessary the following day once authorized coders knew of the work-around, and (4) write up a quick summary of this work-around to submit to the boss the next day.

    Some adjustment to this 4-step program might be needed if it seemed that the system would be hanging repeatedly through the night on other parts, but in this particular emergency situation, the principle of minimizing risk seems to trump the principle of minimizing work.

    If he plays it that way, likely he doesn't even get reamed for unauthorized hours.

    Since I have made a dozen or so warehouse management system projects during the last decade, I can assure you that ad-hoc hacks to solve some problems are normal in such projects. Because warehouse management invariably involves the movement of physical goods; in most cases, the capacity of the workforce is just enough for the daily job. In other words, if they lose e.g. 6 hours because of a system failure, it may take a week or longer to recover the lost time; till then, many customers will receive their ordered goods too late.

    For that reason, every problem is fixed as soon as possible; if the fix doesn't work, it's fixed again; if it becomes much worse than before, the old version is re-installed. Obviously, it pays very soon to write (mostly) bug-free, maintainable, robust software with a lot of sanity checks and logging.

  • clippy (unregistered) in reply to phx

    phx:
    Number of arguments I've had with co-workers over how "less lines of code may not be faster"

    I don't have arguments with my coworkers; I have parameters!

  • AdT (unregistered) in reply to Volmarias
    Volmarias:
    It'd be fucking fantastic if we could just configure a real mail setup instead of using exchange (which requires its own box, which needs to be rebooted four times a day...), for example.

    Wow, that sounds even worse than Novell GroupWise. At least our heroic mail admin successfully insisted that the GroupWise server will not be reachable via the Internet (all external mail traffic is proxied through qmail).

  • wcw (unregistered) in reply to Sam Thornton
    Anonymous:

    Working as a contractor, got called in to fix a little problem with a VB app that a software vendor had sold to a major online brokerage firm.



    Hey, you can tell us -- did said firm's name rhyme with 'be-trayed'?

    I hope you reamed them good.  Those @#%!wits bought my accounts with one of their acquisitions, and I literally cannot believe any of their clients is not, like me, valiantly trying to fire them.  I've transferred most of my assets out due to their preternatural incompetence and their customer service's dogmatic insistence on replying to any and all queries with unrelated boilerplate, but out of vindictiveness kept one position there (they "can't" sell it -- a naked admission of failure for a brokerage firm).

    They called me today because one of my recent replies to their boilerplate was perhaps a hint unkind ("..your firm is so incompetent it boggles my mind. I can't fire you fast enough.")  Checking back today, their response was so preposterous I read it out loud to my wife ("We block selling of bonds online because they act differently than stocks. It's a little more technical.")  She is a political scientist, and could have written that herself.  I got my CFA charter some years back, so perhaps my response ("Your comedy act should be on stage and screen in no time.") could have been a little more technical.

    Still, I doubt it.

    Man, they're bad.  Why aren't they bankrupt?  Who hires these jokers and doesn't despise them?

     

  • Mark (unregistered)

    "...the boss went off on him, criticizing him for coming in at an unauthorized time, making an unauthorized software change, and for compromising the integrity of the warehouse system."


    I've been there a few times. The one that sticks out the most is many many years ago when I spent the night babysitting a backup, tweaking things all night long. (this was way back in the days of tape drives) I was still there when my manager came in the next morning. I got REAMED for having been there all night 'cause (in his words) I was now worthless for the day. Hmm, he didn't know me too well... I did my normal work - and I was "fine". Even my cohorts were impressed.

  • (cs) in reply to John Bigboote
    John Bigboote:
    mrsticks1982:

    You don't see the calling function so you cannot assume that they where smart enough to use byref. Visual basic defaults to byval passing.

    also, upgrade to Firefox 2.0 it has built in spell checking, cause you still have that word spelled wrong.

     

    Are you sure you want to be the spelling police, there, chief? :)

    lol. Thank you so much for writing that.  Spellchecker doesn't help worth a sh*t if you use the wrong word.

  • (cs) in reply to Volmarias
    Volmarias:
    just configure a real mail setup instead of using exchange (which requires its own box, which needs to be rebooted four times a day...), for example. But, heavens no, then we might loose that fantastic calendering app built in!

    Yeah. I contract to a place like that. They do actually use a real mail server (Debian box with Exim and Dovecot), but they continue using Outlook, complaining to me, and then saying they want to keep using Outlook because of the calendar. They are just using it with individual calendars since there's no Exchange server too. One time I found a web based system that had mail, calendar and other such things, but they decided that was too hard too.

  • Saemus (unregistered) in reply to jspenguin

    jspenguin:
    If the site seems slow, it's because it's being farked:

    http://forums.fark.com/cgi/fark/comments.pl?IDLink=2479038

     

     

    Don't worry, I see TDWTF posts on Digg and other sites quite commonly anyway! 

  • ReedzReelGud (unregistered) in reply to elKodos

    So fire the contractor.  You don't need someone who is willing to come in on their own time and clean up other people's messes on their own initiative (without prior authorization).  And why would a contractor want to work at a shop with such a WTF'ed up situation?
     

    But,... you forgot steps 1.56)  3.66) and 5.5) from the "Fixing Problems Conservatively - Methods and Methodology Manual (5th ed.)" (available on Amazon for $119.95).  If you're going to fix things conservatively and in a thorough step-by-step manner, you must go through ALL steps in order and then and only then are you guaranteed to have a complete fix.

    OR

    You could look at the code, use your brain, and as in this case, fix the problem, especially since none of the full timers could be bothered to respond.  The way the code was deployed (check in code, check out on timecard) shows that there wasn't much methodology to how new check in's were handled.  The code presented, anonimized as it was, was fairly atomic.  If you can't look at the code and see that, then maybe you should hire someone who is skilled in such analyses to do it for you.  All I hear is armchair quarter backing and 6 sigma quoting.

    And just because you're a contractor, that doesn't mean you're not a human who deserves respect.  I would never apologize for completing such a fix.  I also would never deploy code in a situation where I didn't judge my changes would be better that the current situation.  But that's the skill I bring as a programmer and no amount of processes will ever guarantee a successful fix nor will they prevent a WTF programmer from screwing things up.

     

     

     

     

  • (cs) in reply to ReedzReelGud
    Anonymous:

    You could look at the code, use your brain, and as in this case, fix the problem, especially since none of the full timers could be bothered to respond.  The way the code was deployed (check in code, check out on timecard) shows that there wasn't much methodology to how new check in's were handled.  The code presented, anonimized as it was, was fairly atomic.  If you can't look at the code and see that, then maybe you should hire someone who is skilled in such analyses to do it for you.  All I hear is armchair quarter backing and 6 sigma quoting.

    And just because you're a contractor, that doesn't mean you're not a human who deserves respect.  I would never apologize for completing such a fix.  I also would never deploy code in a situation where I didn't judge my changes would be better that the current situation.  But that's the skill I bring as a programmer and no amount of processes will ever guarantee a successful fix nor will they prevent a WTF programmer from screwing things up.

     

     Hear, hear!

     The was called in when nobody else was available to fix a major fuckup. He used his skill and judgement and fixed the problem. The manager should have thanked him.

     

  • Mr. Sweetness & Light (unregistered) in reply to notromda

    Exactly. It does work both ways. I've been trying to get the folks who run the change control to fix a farkup that their high priced Big 4 gang put in that forces things to run 5 times slower. This has been going on for several months despite full documentation of the problem including detailed explanations, baselines and actual timings. Of course they didn't read the summary, let alone the detailed proofs.

    They told me that contractors have to have it tested by the employees. So it's been sitting in test for 2 months with no sign that the person assigned the testing even knows about it let alone knows how to test it. They were more concerned that I changed a test system that is overwritten every two weeks (it's not the repository) to do the baseline.

    Go figure.
     

  • Ivan D. (unregistered) in reply to Sgt. Zim

    It actually was like that more or less!!! It avoided a WHERE clause and it forgot an Exit Do!!

    You might ask me why!!! Well, if I really could use my magnifying glass and break their heads open, I would find out that it was just hot air inside!!

    My gut feeling was that they tested the whole stuff on a test database with no more than a handful of records!!

  • (cs) in reply to shadowman

    Anonymous:

    [image] ResidentialEvil:

     Translation: "Don't EVER make me look bad again by going in and fixing code only a moron like myself would write! My appearance as a great developer is much more important than actually getting things accomplished!"

    Nah, it wasn't him that wrote the code.. It was the other cousin. Remember ... two cousins.. Yeah.

    Or they may have even been brothers.  We only know that they were both nephews of the CTO.
     

     

     

    ...or they sing "my father is my uncle..." when they ride their little ponys...

     (f$§% quoting didn't work...)
     

  • (cs) in reply to wcw
    Anonymous:
    Anonymous:

    Working as a contractor, got called in to fix a little problem with a VB app that a software vendor had sold to a major online brokerage firm.



    Hey, you can tell us -- did said firm's name rhyme with 'be-trayed'?

    I hope you reamed them good.  Those @#%!wits bought my accounts with one of their acquisitions, and I literally cannot believe any of their clients is not, like me, valiantly trying to fire them.  I've transferred most of my assets out due to their preternatural incompetence and their customer service's dogmatic insistence on replying to any and all queries with unrelated boilerplate, but out of vindictiveness kept one position there (they "can't" sell it -- a naked admission of failure for a brokerage firm).

    They called me today because one of my recent replies to their boilerplate was perhaps a hint unkind ("..your firm is so incompetent it boggles my mind. I can't fire you fast enough.")  Checking back today, their response was so preposterous I read it out loud to my wife ("We block selling of bonds online because they act differently than stocks. It's a little more technical.")  She is a political scientist, and could have written that herself.  I got my CFA charter some years back, so perhaps my response ("Your comedy act should be on stage and screen in no time.") could have been a little more technical.

    Still, I doubt it.

    Man, they're bad.  Why aren't they bankrupt?  Who hires these jokers and doesn't despise them?

     

    I think we've just found the company that bought the water control neural net.

  • (cs) in reply to ChiefCrazyTalk

    Anonymous:
    The real WTF is that the contractors are more capable than the full time employees (no offense to any good contractors out there).  In my experience, its been the opposite - contractors come in and F up the system.

    In my experience as a contractor, the most likely errors we make are logic errors, i.e. we don't know exactly what the program is supposed to do because we are never actually given a proper specification, often because there isn't one.

    My experience is also that most companies have biased opinions about contractors or those who have spent many years in contracting. There is also a lot of disillusion among employers about what a contractor really wants if he applies for a permanent role. Incredible how often they are telling you what they think you want.

     

     

  • Sysin (unregistered)

    I don't understand...

    1) What is a "Change Log". We don't have those around here...

    2) How could Ivan open up the project? Around here, the only copy of the source code would be the one on the developer's desktop or, worse, laptop...

    3) Finally this "Module" thing... please explain... The MO around here is to put all 27134 lines of code in main() 

    Ivan D. should feel lucky! 

     

  • (cs) in reply to IQpierce

    Anonymous:
    Aside from this website, which is more and more becoming a WTF. Why the crap don't you use some standard blog technology instead of this weird hacked-up forum with captchas and ads shoehorned in?

    My favorite WTF here is people like you, who spend all their time complaining about the forum software.

    If you find the software here so hard to use, don't bother posting. It'll save you all that aggravation. :-)

     
    Ken
     

  • LoveGoblin (unregistered) in reply to campkev

    It's not the wrong word - he just left out the apostrophe. You know, 'cause "'cause" is short for "because"? :) What did you think it's supposed to be - "cuz"? :P

  • Uber dev (unregistered)

    This is when you smile and say, thank you.  And then laugh all the way to the bank to cash your $150 / hour paycheck.

  • Joel (unregistered) in reply to ammoQ

    True, but there's a lot less network traffic if the SQL engine is dealing with it.  Pulling the entire table across the network is a real WTF.

  • (cs) in reply to bradley.holt
    bradley.holt:
    Anonymous:

    DigitalLogic:
    Alex Papadimoulis:
    the boss went off on him, criticizing him for coming in at an unauthorized time, making an unauthorized software change, and for compromising the integrity of the warehouse system. Ah well, so is the life of a contractor


    Sounds like its time to find a new contract.

    Nah, just charge the 1D-10-T tax.

    I prefer the FUINTHEA fee.

    (please ignore my previous post, quoted the wrong post, this forum software really sucks) 

    The REAL WTF is people blaming the forum software when they are not paying attention to what they are doing.

  • (cs)

    I agree - time to say "take a flying leap" and find an new contract.

  • Erik (unregistered) in reply to Mark

    Anonymous:
    I was still there when my manager came in the next morning. I got REAMED for having been there all night 'cause (in his words) I was now worthless for the day. Hmm, he didn't know me too well... I did my normal work - and I was "fine".

    "Gee, boss, that doesn't seem fair.... You're worthless every day, but you still come in."

  • anony-mouse (unregistered) in reply to phx
    phx:
    Grauenwolf:
    Anonymous:
    Anonymous:

    Who really cares if it was ByVal or ByRef in this case?  Passing an object ByVal does not copy the object itself, only the pointer to it.  Do you think passing a recordset object with a million rows in it to a function ByVal is going to put the entire object on the stack??

    No. But passing ByVal means to copy the whole object to another memory location(so the function cannot modify the origional one) then pass the new generate pointer to the function.

     Copy a recordset contains millions of row means a lot of time and memory is required.
     

    It's people like you who give VB developers a bad name. For the nth time, this is how it works.

    Objects/ByVal: Pass a copy of the pointer.

    Objects/ByRef: Pass a pointer to the pointer.

    Primatives and Structures/ByVal: Pass a copy of the Structure

    Primatives and Structures/ByVal: Pass a pointer the Structure

    You never, ever copy get a copy of an object in VB just by passing it to a function. Unless the object has a Copy() or Clone() method, you are always working on the original.

     Goddamn thank you. I was worried I was going to have to start spelling it out for people as well....

     This is why people should not be allowed to pick up VB6 as a first language without understanding how the magical stuff you type gets (roughly) turned into magic that makes more magic smoke move around the silicon in morse code or whateverthefuck. Number of arguments I've had with co-workers over how "less lines of code may not be faster" - especially crap invoving "redim preserve" every time you add an item to an array.

     Cos y'know linked lists are a lot heavier weight than an array - and redim preserve is a "built in instruction" so it _must_ go quicker. (/sarcasm)

     Haha, I'm glad I wasn't the only one thinking this.... jesus...
     

  • KG (unregistered)

    SELECT * should be banned!!

    I've threatened grads with castration for using this syntax. I was once a contractor at the state gas supplier (we only have the one) and was alotted the task of "technical supervision and team co-cordination for graduates" when one of the numb-nuts typed in "SELECT * from tlb_Customers".

    the table was 102 columns and contained over a million rows... 

    He never came back to work after I yelled at him and the network admin and the DBA chased him out of the building..serves the little bastard right I say.

     

  • KG (unregistered) in reply to Earl Purple

    Bitchy Bitchy Bitchy....I've been a contractor for more years than I care to remember and I ALWAYS get to fix the crap that employees have created...and I cry all the way to the bank!

  • Gnudiff (unregistered) in reply to KG

    It seems this might be a pretty common error, which indicates absolute lack of understanding of SQL, is all.

    I stumbled upon the same (and numerous others of course) kind of wierd logic in a World of Warcraft raiding helper tool PHPRaid ( http://www.wowguru.com/ui/151/phpraid/ ):

     

    $sql = "SELECT * FROM " . DB_PREFIX . "profile";
    $result = $db_raid->sql_query($sql);
    while($data = $db_raid->sql_fetchrow($result))
    {
        if($username == $data['username'] && $password == $data['password'])
        {
           // tons of rows of code doing this and that...
           return 1;
        }
    }
    return 0;
    

     

  • (cs) in reply to KG

    Hmmm. I think the correct response would be :
    1) Apologise to the boss ( keep fingers crossed behind back if that helps );
    2) Put code back to WTF state, preferably just before leaving work at 6pm. Do NOT comment out your corrections - erase them. Delete any working versions permanently;
    3) Send email to foreman saying that it has been explained to you that your actions could have jeopardised everything, you will never do this again, apologies, blah blah. And here's the boss' home and mobile phone numbers for "correct" support in the future;
    4) Resign;
    5) Keep in touch with sympathetic IT person, so that you can hear about the fall-out, and gloat spitefully.

  • (cs) in reply to Gnudiff

    It seems this might be a pretty common error, which indicates absolute lack of understanding of SQL, is all.

    Argh, stupidity abounds! "SELECT * FROM table" (no where clause) should be banned. It's a major WTF that people who know this little about queries (seriously, I consider myself to know nothing about SQL, but even I would never do this) are writing production code in it.

  • Imposter, indeed! (unregistered) in reply to mrsticks1982
    mrsticks1982:
    Jeff S:
    Anonymous:
    Sgt. Zim:
    Alex Papadimoulis:

    Set rsStock = objConn.Execute("SELECT * FROM [Inventory]")
    While Not rsStock.EOF
      If rsStock("ItemId") = intItemId Then
        Call SendItemToTransmitter(rsStock)
      End If
      rsStock.MoveNext
    Wend

    And if I'm reading this correctly, after pulling down millions of rows, and iterating through them, finding the target on, say the 12,384th pass through the loop, doing whatever SendItemToTransmitter does ... It keeps going the rest of the way through the millions of rows.  Or was that just a feature of the anonymo ... anonymiz .... the process of making it anonymous? 

     

    [Note from Alex: Good obvservation. The code is more of a representation/simplification of what it would have looked liked (Ivan didn't save the original) -- but perhaps that's why the nephew didn't notice the bug? He looked for Item 0000001, while the screw is Item 9999901?]

    The WTF goes deeper than that, my friend. After looping through the recordset and finding the record with the correct item ID, THE ENTIRE RECORDSET is passed into the function. No global variable is set and no other parameter is passed to let that function know which record to use. Presumably, SendItemToTransmitter loops through the entire recordset AGAIN.

    WTF indeed.

    Aparently, you are not familiar with passing by reference, are you?  the entire recordset is not sent anywhere, just a pointer.  And a recordset has a "currentRecord" concept, so the current record is available to the function.  Passing a recordset object to a function is very, very common and much preferable to using global variables, which is generally considered poor programming style.

    Not understanding basic concepts like this is often how many WTF's are born ... 

    (edited to fix some typos) 

    You don't see the calling function so you cannot assume that they where smart enough to use byref. Visual basic defaults to byval passing.

    also, upgrade to Firefox 2.0 it has built in spell checking, cause you still have that word spelled wrong.

     

    Okay, so the VB* function could've passed the recordset object "by value" instead of "by reference"?  This means that the object "pointer" was passed "by value", not the entire object itself.  Also, even though the object was passed "by value", the object's properties can still be changed.  Isn't OOP grand?

    * Alex possibly anonymized the language used.
     

Leave a comment on “The Mystery of the Missing Screw ”

Log In or post as a guest

Replying to comment #:

« Return to Article