• KattMan (cs)

    I'll see your fist and raise it...err never mind.

    If I had a dollar for every project I got placed on that was developed like this I'd be retired by now. This is the type of stuff that makes me want to go flip burgers for a living.

  • SoonerMatt (unregistered)

    I have seen the same problem with incrementing primary keys using "MAX(intuserid) + 1".

    Can't really disclose the problem that it caused, but it was very bad.

  • Uber (cs)

    I was wondering why my gym was spamming me with male enhancement emails.

  • Ant (unregistered)
    The Architect showed up later that day. He was tall, very slender, with a thin mustache. If he had a cap with a "W" on it he'd look like Waluigi.

    No he wouldn't - Waluigi has an inverted "L" on his cap.

    </pedantry>
  • Neil (unregistered) in reply to Uber
    Uber:
    I was wondering why my gym was spamming me with male enhancement emails.
    Perhaps its just that guess they have genital size recognition software on the cameras in the locker room.
  • Anonymous (unregistered)

    And then they wanted to sell their services to other "Gyms" so it was requested that the other "Gyms" be allowed to send "membership" information to it.

    Jory's boss said, "Well since we can send information to it, what's so hard about allowing other gyms to send information to it?"

    At which point and time Jory began a 3 month journey down the road of educating his superiors and letting them know why direct database access is a bad thing.

    Next they decided that since they have these email addresses for members, they should send mass emails out to these users as well. To do this we weren't allowed to use a mass emailing service. Also, you can't use the same servers or ip addresses that the original servers are hosted under in case we get blacklisted. Solution: let's use the ip addresses from a different company that we own. Nevermind that the two systems are nowhere near each other physically. Nevermind that it would require a process to be setup that pulls down all 700,000+ email addresses, and separate email templates for each location (that were setup in the aggregator) to this new server. Nevermind that there are people that spend their lives figuring out how to get spam through email filters and now Jory was required to figure that out as well. Oh, and lastly nevermind that they didn't actually want to pay for a server, or software, so a glorified workstation was used and mercury mail server sent the emails.

  • the real wtf fool (cs) in reply to Ant
    Ant:
    No he wouldn't - Waluigi has an inverted "L" on his cap. </pedantry>

    Just wasted half an hour of my life looking at the super mario wiki - thanks to you...

  • D. Travis North (unregistered) in reply to the real wtf fool
    Comment held for moderation.
  • Charles Manson (unregistered) in reply to the real wtf fool
    Comment held for moderation.
  • Steve H (unregistered) in reply to SoonerMatt
    SoonerMatt:
    Can't really disclose the problem that it caused

    Well, that post was worthwhile then.

  • Daniel (unregistered)

    Frankly, the solution is correct for what passes for the architecture.

  • I'm not tellin' you (unregistered)

    I'm missing something here....what then happens (more specifically than a bunch of emails go out).

  • Fred Burns (unregistered)

    Completely irrelevant to the article, I really enjoy the new Irish Girl ad. Improves the site aesthetics immeasurably.

  • Crash Magnet (unregistered)

    I was expecting a variation on:

    1. Each gym would print out a copy of the application and mail it to the mother ship.

    2. The applications would arrive by mail, be opened, then put on a wooden table and photographed.

    3. The photograph would be scaned into the computer then OCR'ed.

    4. The resulting document(s) would then be compiled and a list created for pig boss.

  • durnurd (cs)

    I'm just curious, how can max(x) + 1 make a duplicate key?

  • Charles400 (cs) in reply to Fred Burns

    Oh damn. If it is one thing that will make me turn on NoScript for this site, it is seeing Irish Girl.

  • AMerrickanGirl (cs) in reply to durnurd
    durnurd:
    I'm just curious, how can max(x) + 1 make a duplicate key?

    Two requests go in at about the same time. Both read the current value of the key and get the same value.

    With no constraints this is entirely possible.

  • suzilou (cs) in reply to durnurd
    I'm just curious, how can max(x) + 1 make a duplicate key?

    if you do a "max(x)+1", and then do it again, and then do your inserts, you get dups. it's a classic race condition that needs some sort of semaphore or other synchronization mechanism around it.

  • IT Girl (unregistered) in reply to D. Travis North
    Comment held for moderation.
  • Anon (unregistered) in reply to durnurd
    durnurd:
    I'm just curious, how can max(x) + 1 make a duplicate key?

    Oh dear....

  • Franz Kafka (unregistered) in reply to suzilou
    suzilou:
    I'm just curious, how can max(x) + 1 make a duplicate key?

    if you do a "max(x)+1", and then do it again, and then do your inserts, you get dups. it's a classic race condition that needs some sort of semaphore or other synchronization mechanism around it.

    which is why sequences are so handy.

  • WC (unregistered)

    Um, the real WTF is that the kid didn't automatically see that the code would be handled like that. In a coding environment that badly done, you don't try to fix everything first day or say to the boss 'I can't see how it could be done' simply because it can't be done the ideal way. You work on the problem, fixing what you can when you can. At the end, you end up with better code. For now, you end up with a job and a boss that doesn't think you are incompetent.

  • Anonymous (unregistered) in reply to durnurd

    They weren't autonomous calls to the database. So instead of making it part of one big transaction the code went out grabbed the next id number and then returned that back to the code and then it inserted the new record into the DB.

  • kmactane (cs) in reply to Anonymous
    Anonymous:
    At which point and time Jory began a 3 month journey...
    Did you perhaps mean "point in time"? Because that would actually make sense and have some semantic meaning, instead of being a weird malapropism.
  • Anonymous (unregistered) in reply to kmactane

    Congratulations you found an error in a poster's grammar!

  • jimlangrunner (cs) in reply to Fred Burns
    Fred Burns:
    Completely irrelevant to the article, I really enjoy the new Irish Girl ad. Improves the site aesthetics immeasurably.

    Yeah. I noticed her to.

    Hip-hip-hoooray! Hip-hip-hoooray! Hip-hip-hoooray!

    Irish I were really Irish!

  • wee (cs) in reply to Charles Manson
    Charles Manson:
    the real wtf fool:
    Ant:
    No he wouldn't - Waluigi has an inverted "L" on his cap. </pedantry>

    Just wasted half an hour of my life looking at the super mario wiki - thanks to you...

    Get back to work slacker.

    Compiling!

  • the real wtf fool (cs) in reply to IT Girl
    IT Girl:
    D. Travis North:
    the real wtf fool:
    Ant:
    No he wouldn't - Waluigi has an inverted "L" on his cap. </pedantry>

    Just wasted half an hour of my life looking at the super mario wiki - thanks to you...

    And I'll be spending the next half hour there, thanks to you...

    You don't have google? First hit is a picture. Very clear.

    You've never wandered off on a linky voyage of discovery after finding the information you wanted? WTF??

  • the real wtf fool (cs) in reply to wee
    wee:
    Charles Manson:
    the real wtf fool:
    Ant:
    No he wouldn't - Waluigi has an inverted "L" on his cap. </pedantry>

    Just wasted half an hour of my life looking at the super mario wiki - thanks to you...

    Get back to work slacker.

    Compiling!

    nicely put. Unfortunately play fighting in the corridor is somewhat frowned upon where I am so daily wtf has to suffice.

  • I'm not tellin' you (unregistered) in reply to IT Girl

    I think that it's because they came for the pic and stayed for the nostalgia.

  • Vic Tim (unregistered)

    Waluigi is retarded, and so am I since I don't know anything about OOP but it seems:

    Mario = subclass of player Luigi = subclass of Mario Wario = subclass of mario? or should be also subclass of player? Waluigi = wtf???

  • Nathan (unregistered) in reply to WC
    Um, the real WTF is that the kid didn't automatically see that the code would be handled like that. In a coding environment that badly done, you don't try to fix everything first day or say to the boss 'I can't see how it could be done' simply because it can't be done the ideal way. You work on the problem, fixing what you can when you can. At the end, you end up with better code. For now, you end up with a job and a boss that doesn't think you are incompetent.
    I agree entirely -- does he plan on staying employed?

    Occasionally software sucks that you have to work on. The trick is to suffer through the painful code until you have learned how it works, and shown your superiors that you are capable, intelligent, and get stuff done right. THEN you worry about overhauling it.

    I wouldn't want to hire someone that was afraid to touch badly written code -- EVERY company has its share of crusty, nasty code, and somebody has to maintain it. An "I can't figure it out" just means you are incompetent.

  • KattMan (cs) in reply to Franz Kafka
    Franz Kafka:
    suzilou:
    I'm just curious, how can max(x) + 1 make a duplicate key?

    if you do a "max(x)+1", and then do it again, and then do your inserts, you get dups. it's a classic race condition that needs some sort of semaphore or other synchronization mechanism around it.

    which is why sequences are so handy.

    and use of Scope_Identity() or the equivilent in your database of choice. If there is no equivilent, choose a real database next time.

  • Kermos (cs) in reply to Nathan
    Nathan:
    Um, the real WTF is that the kid didn't automatically see that the code would be handled like that. In a coding environment that badly done, you don't try to fix everything first day or say to the boss 'I can't see how it could be done' simply because it can't be done the ideal way. You work on the problem, fixing what you can when you can. At the end, you end up with better code. For now, you end up with a job and a boss that doesn't think you are incompetent.
    I agree entirely -- does he plan on staying employed?

    Occasionally software sucks that you have to work on. The trick is to suffer through the painful code until you have learned how it works, and shown your superiors that you are capable, intelligent, and get stuff done right. THEN you worry about overhauling it.

    I wouldn't want to hire someone that was afraid to touch badly written code -- EVERY company has its share of crusty, nasty code, and somebody has to maintain it. An "I can't figure it out" just means you are incompetent.

    Depends a bit on the situation though. I've had cases so bad that no amount of maintaining would really have made any long term sense and we were just better off creating something new from scratch.

  • Anonymous (unregistered) in reply to durnurd

    "I'm just curious, how can max(x) + 1 make a duplicate key?"

    If you remove some entries.

    Say you have 50 entries max(x) + 1 will be 51.

    Say you remove entries 12 and 13, max(x) + 1 is now 49, but 49 still exists unless you renumber the whole table.

  • Charles Manson (unregistered) in reply to Anonymous
    Anonymous:
    "I'm just curious, how can max(x) + 1 make a duplicate key?"

    If you remove some entries.

    Say you have 50 entries max(x) + 1 will be 51.

    Say you remove entries 12 and 13, max(x) + 1 is now 49, but 49 still exists unless you renumber the whole table.

    Not correct.
  • Spoon (unregistered) in reply to Anonymous

    max not count.

  • Tama (unregistered) in reply to Anonymous
    Anonymous:
    They weren't autonomous calls to the database. So instead of making it part of one big transaction the code went out grabbed the next id number and then returned that back to the code and then it inserted the new record into the DB.

    That still wouldn't solve your problem. Even with a transaction at the serializable level, there is a possible ordering of reads and writes between two concurrent transactions that would result in duplicate keys.

  • Bill (unregistered) in reply to Anonymous
    Anonymous:
    "I'm just curious, how can max(x) + 1 make a duplicate key?"

    If you remove some entries.

    Say you have 50 entries max(x) + 1 will be 51.

    Say you remove entries 12 and 13, max(x) + 1 is now 49, but 49 still exists unless you renumber the whole table.

    No... If max(x) = 50, then removing anything other then x=50 will not change max(x) = 50 (it's max, not count).

    The problem is more (as many have said before me) that if multiple processes access this concurrently, they both take max(x) = 50 (because nothing higher has been committed), and both set x = 51...DUPLICATE

  • Bill (unregistered) in reply to Bill
    Bill:
    Anonymous:
    "I'm just curious, how can max(x) + 1 make a duplicate key?"

    If you remove some entries.

    Say you have 50 entries max(x) + 1 will be 51.

    Say you remove entries 12 and 13, max(x) + 1 is now 49, but 49 still exists unless you renumber the whole table.

    No... If max(x) = 50, then removing anything other then x=50 will not change max(x) = 50 (it's max, not count).

    The problem is more (as many have said before me) that if multiple processes access this concurrently, they both take max(x) = 50 (because nothing higher has been committed), and both set x = 51...DUPLICATE

    In fact I notice that many others have said while I was writing....OOPS - Apologies....

  • Anonyblort (unregistered) in reply to Anonymous
    Anonymous:
    "I'm just curious, how can max(x) + 1 make a duplicate key?"

    If you remove some entries.

    Say you have 50 entries max(x) + 1 will be 51.

    Say you remove entries 12 and 13, max(x) + 1 is now 49, but 49 still exists unless you renumber the whole table.

    You're thinking count(*) + 1

  • SwedishChef (unregistered)

    Or you could just, you know, auto increment and move on

    /party pooping

    // yes, I said poo

    /// and poop

  • Sum egghead (unregistered) in reply to durnurd
    durnurd:
    I'm just curious, how can max(x) + 1 make a duplicate key?

    racist condition.

  • DeepThought (unregistered) in reply to WC

    Um, the real WTF is that the kid didn't automatically see that the code would be handled like that. In a coding environment that badly done, you don't try to fix everything first day or say to the boss 'I can't see how it could be done' simply because it can't be done the ideal way. You work on the problem, fixing what you can when you can.
    At the end, you end up with better code. For now, you end up with a job and a boss that doesn't think you are incompetent.

    I agree. An experienced developer would have leveled with the boss and told him that while it can be done, the quickest solution is not the ideal one. He should have also spelled out the deficiencies he found and given the boss some idea of the amount of effort required to set things right or at least requested permission to do a thorough review and analysis of the code in order to come up with a more accurate estimate.

    TRWTF was simply telling the boss that he couldn't do it.

  • randomo (unregistered) in reply to Nathan
    Nathan:
    Occasionally software sucks that you have to work on.

    Occasionally? Occasionally I get to work on a codebase that does not suck. Lesson for the kid to learn: Nearly all the code you get to work on in your life will be fubar. Including your own. Get used to it.

  • chrismcb (cs) in reply to Vic Tim
    Vic Tim:
    Waluigi is retarded, and so am I since I don't know anything about OOP but it seems:

    Mario = subclass of player Luigi = subclass of Mario Wario = subclass of mario? or should be also subclass of player? Waluigi = wtf???

    It is obvious that you don't know anything about OOP. But Mario and Luigi are brothers, so Luigi isn't a subclass of Mario. Wario is an evil Mario, and Waluigi is an evil Luigi (and possibly Wario's brother?) You can make Wario a subclass of Mario with the evil bit set.

  • Prosthetic Lips (unregistered) in reply to Fred Burns
    Comment held for moderation.
  • Commatator (unregistered) in reply to Anonymous
    Anonymous:
    Congratulations you found an error in a poster's grammar!

    I found one too.

  • Yoshi (unregistered) in reply to chrismcb
    chrismcb:
    Vic Tim:
    Waluigi is retarded, and so am I since I don't know anything about OOP but it seems:

    Mario = subclass of player Luigi = subclass of Mario Wario = subclass of mario? or should be also subclass of player? Waluigi = wtf???

    It is obvious that you don't know anything about OOP. But Mario and Luigi are brothers, so Luigi isn't a subclass of Mario. Wario is an evil Mario, and Waluigi is an evil Luigi (and possibly Wario's brother?) You can make Wario a subclass of Mario with the evil bit set.

    But if Wario is a subclass of Mario, and Waluigi is a subclass of Luigi then Wario and Waluigi would almost certainly NOT be brothers....

    Furthermore, if Mario is a subclass of player, then Wario cannot be a subclass of Mario (excepting in the games where you can play as Wario)....

  • Jimbo (unregistered) in reply to Commatator
    Commatator:
    Anonymous:
    Congratulations you found an error in a poster's grammar!

    I found one too.

    I see lots of Posters every day. Many of them have Grammatical errors.

    (It all reminds me of "Bill Posters will be prosecuted"....)

Leave a comment on “Feeling Aggregated”

Log In or post as a guest

Replying to comment #:

« Return to Article