• Frank (unregistered) in reply to snoofle

    No one said anything about BASIC or assembly code, this was Perl!

  • TNiemi (unregistered) in reply to Nagesh

    Sorry, I am from Finland and I have never quite understood this whole Nagesh meme thingie.

    In Nagesh meme there is always this "lolcat-n00b" comment written in broken English that is sometimes companied with a picture from a third world country.

    The "n00b" humor part is understandable; this is The Daily WTF. It is the third world part that is strange to me, because that is how majority of people (you could say, the middle class of this planet) lives. Where is the joke? I am unable to see it.

    Is this Nagesh thingie some unconscious way for a person from an old economy to mock the new emerging markets? Or is there a conscious and real joke here, which I am unable to understand?

    I am not trying to mock anybody, or pulling any racist cards, or anything like that. I am just trying to understand the joke!

  • Not Gesh (unregistered) in reply to TNiemi
    TNiemi:
    Sorry, I am from Finland and I have never quite understood this whole Nagesh meme thingie.
    Well first you've got real Nagesh and fake Nagesh. Real Nagesh started the mangled english posts and others are copying.

    Anyone can post as fake Nagesh, and most of the photos I've seen are in this group.

    The joke, if there is one, is often that Nagesh (real or fake) is bragging about how advanced things are in his country, while -- apparently without realizing it -- revealing by his illiteracy or in the pictures how dismal it really is.

    I would guess it is an attempt to poke fun at Indian programmers, who, for many of us, "stole our jobs" by drastically underbidding and then producing very shoddy work.

  • tester (unregistered) in reply to josefx
    josefx:
    AFAIK there are two reasons to believe this.
    1. He mixed up socket and file handling, at least windows "locks" sockets for some time after they are closed to avoid stray packages.

    2. They use some broken maleware scanner which would check the files after they where changed (blocking access while doing so), leading to an error if the program tried to access the file again at the same time.

    Or any kind of modern locking network file system, where the files, and locks, are cached.

    Three alternativs are (1) to use an antique file system without caching, (2) to use one of the unix-style network file systems, which are 'designed' for single-user and read-only access, or (3) to properly tune your transactional file server/network system for single-user or read-only access, so that locks are not cached.

    None of these alternatives are suitable for systems where you can not specify the file system.

  • Iman (unregistered)

    Perl has the sleep() function to facilitate The Speed-up Loop.

  • Tom Harrison (unregistered)

    Apparently, Dave was the 6th person to review Alvin's code. Classic defensive programming requires that subsequent to all code reviews, code must executes more slowly. (While some understand the term "defensive programming" to mean that the code protects itself from failure, the true meaning is that it protects its creator from failure.

    Alvin should consider the base of his self-defense function though. After the previous review, sleep time was increased from 4 to 5 and code executed 20% more slowly, whereas in this one, code executed only 18% more slowly. Were he to use base 2, he would have true job security.

    This is only the kind of thing that causes people that manage people like Alvin to hire more people like Dave, and indeed, at an increasing rate.

  • Agention (unregistered) in reply to Not Gesh
    Not Gesh:
    TNiemi:
    Sorry, I am from Finland and I have never quite understood this whole Nagesh meme thingie.
    Well first you've got real Nagesh and fake Nagesh. Real Nagesh started the mangled english posts and others are copying.

    Anyone can post as fake Nagesh, and most of the photos I've seen are in this group.

    The joke, if there is one, is often that Nagesh (real or fake) is bragging about how advanced things are in his country, while -- apparently without realizing it -- revealing by his illiteracy or in the pictures how dismal it really is.

    I would guess it is an attempt to poke fun at Indian programmers, who, for many of us, "stole our jobs" by drastically underbidding and then producing very shoddy work.

    "Boom!" It's no longer funny. Never really was, I guess.

  • Therac-25 (unregistered)

    This has nothing particular to do with Perl. People have been sprinkling random sleeps everywhere since time began (i.e. Jan 1 1970 GMT).

    Perl written with the modern facilities and features is beautiful.

    There are some wonderful things in there now:

    http://www.modernperlbooks.com/mt/2012/02/the-memoization-of-lazy-attributes.html

    If anyone does need to get up to speed, and they're not stuck on Perl 5.8.8 (can RHEL5 die already?), you need to give this book a read:

    http://www.onyxneon.com/books/modern_perl/index.html

    (Free PDF).

  • rok (unregistered) in reply to pjt33

    That's something that points to a file with japanese content in it

  • BR (unregistered) in reply to Ralph
    Ralph:
    BR:
    The guy who was here before me used the file system as his version control system
    Oh, yeah, I know him. Although he had plenty of criticism for the lack of discipline among the development team, his own work was periodically "snapshotted" by tarring up his entire project and untarring it into another directory, named (badly) with the current date.

    ...

    And now, years later, the project is still nowhere. Turns out we didn't need it at all.

    My predecessor would have a directory named after a client, and sometimes the date, and/or something else resembling a version number, and then files named 'parselogs.1.pl' through 'parselogs.36.pl'. In most cases, the file a few "revisions" before the final number would be the working one. So I'd see 1 - 36 and give 32 a try. This was an iffy thing to divine, because there might be a couple files called 'logparse.pl' with a few numbers in them. And I saw a few symlinks as well here and there. Further complicating matters, file mod times were all over the map. Sometimes every file had the same ctime.

    Among all this, he'd have "backups", which were like your guy's snapshots. They may or may not have been named descriptively, and may or may not have contained any actual files relating to the contents of the directory they lived in.

    I actually submitted some of his code to this site. I figured since I was trashing it all anyway, at least someone could get a laugh (or a lesson).

    He re-used things like $a, never checked system calls, file handles re-used the same name but never got checked on open, etc. He'd declare a variable right when he needed it, and then re-use that same name elsewhere. Indentation was in tabs and/or spaces, and varied wildly from 2 columns to 8. The most WTFy code I saw was a recursive function that modified global variables, including a hash that almost certainly grew very large. It used labels and gotos in order to stop the recursion.

    The sad part was the owner of the place paid this guy for almost three years, and though the guy was somewhat slow, the owner thought that there'd at least be some value in what he had paid the coder to write, that perhaps it could all be re-used elsewhere.

    After a couple weeks of "Well, I know we came across this sort of thing before. See if M has any code or scripts that might work..." I finally had to break it to him that he'd been throwing money down a hole and all the last guy was good for was keeping a chair warm.

  • Jeremy Friesner (unregistered) in reply to Mark
    Mark:
    As stated above, this guy is just your garden-variety ass, and we'll never truly understand his motivation.

    Dunno if it applies to Perl, but in C/C++ land this sort of neurotic behavior is often caused by a new programmer's first encounters with multi-threaded programming, where faults caused by race conditions can often be "cured" (i.e. made harder to reproduce) by inserting sleep() calls at various places in the code.

  • (cs) in reply to PiisAWheeL
    PiisAWheeL:
    Tom:
    Among other things, I have to create output forms in Español, so I use the ES layout or the US-International layout (depending on which VM I happen to be working in.)

    Drives people nuts when they try to use my computer.

    You should try dvorak. Nobody uses my computer for SHIT!

    It is extremely humorous when a qwerty tries to use a dvorak.

    The reactions have been varied over the years, some people take it as a challenge and start mapping the keys by trial and error, but most just complain, and ask how to "fix" it.

  • Someone (unregistered)

    So why is it Perl's fault if this so-called veteran is a dumbass?

  • (cs) in reply to Tom
    Tom:
    Join the club... I had to modify an internal tool recently, and I came up against a similar issue. I had to add a new service to the "Start/Stop Services" page, and when I got there, I found around 1000 lines of copied and pasted code, rather than what I would have expected: single function that would be called from the Click events of the 10 buttons on the page.

    Yes, the previous guy had copied and pasted 60 lines of code 8 times, modifying the service names as he went.

    Then he copied ALL OF THOSE in to one giant "Start All" and "Stop All" function.

    o.O

    At some point these people learn that copy/paste/modify isn't as fast as they think it is, that it causes more deficits than benefits. Very often it just can't be taught to someone. It has to bite them in the ass before they learn; they have to learn it the hard way.

  • (cs) in reply to PiisAWheeL
    PiisAWheeL:
    Tom:
    Among other things, I have to create output forms in Español, so I use the ES layout or the US-International layout (depending on which VM I happen to be working in.)

    Drives people nuts when they try to use my computer.

    You should try dvorak. Nobody uses my computer for SHIT!

    I have my keyboard mapped as colemak, but it's a qwerty keyboard. It's close enough that people think it's just broken, rather than completely different. Much hilarity ensues.

    At another job of mine, I had a blank keyboard. The IT help tried to sort out a problem on it and got very confused trying to get copy/paste to work :)

  • Soske (unregistered) in reply to pjt33

    It's a file handle in japanese ;)

  • ca (unregistered) in reply to onitake
    onitake:
    frits:
    "You have to love languages that require at least two keystrokes to make a comment." -Some VB programmer
    Looks like someone has never worked with a non-US keyboard. :)
    ' Ignoring the horribleness of having an unmatched single quote as a comment, ' and the lack of multi-line comments (though I assume that was part of the joke), ' British keyboards at least can also do them in one keystroke.
  • L. (unregistered) in reply to Earl Colby Pottinger
    Earl Colby Pottinger:
    First, I am glad to see that the new guy insisted on testing his changes before assuming he knew a better way to write the code.

    Too often people try to prove they have a better way and want others to use without finding out if there is a real valid reason why the code is written the way it was.

    However, I am writing some kernel code for an OS still in alpha-state (Haiku-OS) and I find if I write a number of larger files (16MB+) in a row that the files end up corrupting each other.

    Use of SYNC() does not fix the problem. Use of SLEEP(9999) does. Use of SLEEP(999) usually does but on rare occasions the corruption still happens. Note SLEEP() is in microseconds.

    Bet the environment has changed and in the past the sleep function was needed, but now things have changed the old-timer is sticking to the "old and true" despite tests showing it is no longer needed.

    Mhh . so you say you write broken code for a broken OS ? Please post the root cause of the behavior you're describing, I'm pretty sure it's good quality WTF.

  • L. (unregistered) in reply to TheJonB
    TheJonB:
    Spider Flyer:
    Gazzonyx:
    BOFH:
    What version of perl do you have, that has a sync() function?
    I haven't written a line of Perl in years, but can't you shell out to call sync()?

    This is PERL, there's a module for anything!

    http://search.cpan.org/~brianski/File-Sync-0.11/Sync.pm

    Civilised perlmongers use FileHandle anwyay, which also has sync.

    Civilised perlmongers don't use Perl outside of its area of shinyness, i.e. regex.
  • L. (unregistered) in reply to J-L
    J-L:
    Like Alvin in the story, I knew a guy who would put
    sleep(1)
    after
    unlink()
    calls in C++ and Perl code, because he didn't want the next line of code to execute until the file being unlinked was guaranteed to be deleted.

    He even put this sleep(1) statement in tight loops, causing the programs to process 3,600 files in about an hour (when, without it, the programs would process the same amount in about a minute).

    Ironically, this was the same person who would change lines of code like

    n++;
    to
    ++n;
    because it would make the programs run "blindingly fast" in tight loops. (A claim which, through benchmarking, I've never been able to prove.) It's as if that he never stopped to think that sleeping for one second in a tight loop would bog your program enough to make it look like it was unresponsive.

    Well ... --n; would've done it of course (loop TO 0) .. but then as you pointed out, the guy was an idiot.

  • L. (unregistered) in reply to Miroslav
    Miroslav:
    Well, hard drive is a physical device. Those 16 Mb will not just magically appear on the drive. Read/write head must have time to record every single byte. HD memory cache will help, but if smaller than your total file size(s)...

    I'm actually somewhat surprised that you don't need longer than 1 ms between writes. I guess HDs are a lot faster nowadays.

    You DO realize there is an OS and drivers between you and the hard drive and you don't just write from perl into the harddrive right ?

  • TheJonB (unregistered) in reply to Someone
    Someone:
    So why is it Perl's fault if this so-called veteran is a dumbass?
    If you are a dumbass perl will help you become even more of a dumbass.

    It's a kind of dumbass force multiplier.

  • L. (unregistered) in reply to LK
    LK:
    Rootbeer:
    bcs:
    s/sleep([0-9]*)/sync()/ ??

    You need to escape your parentheses.

    Or maybe you did, and the comment system ate it.

    Well, he would need to escape them if he was using perl to do the replacement in his perl script. I would have used sed, and in BREs (Basic Regular Expressions) parentheses are not special. Except in GNU BREs, but then you must escape them for them to be special!

    Capcha: enim. Perl and Latin have things in common . . .

    Mostly every language has a PCRE extension . I don't think most languages have a SED compatible RE extension ;) - might have at some point or whatever, but that's long gone.

    And no, the world is not made from shell scripts.

  • L. (unregistered) in reply to Matt Westwood
    Matt Westwood:
    SomeCoder:
    Nagesh:
    Read #6.

    Higher quality is reason India is ading job and US is losing them.

    Hahahahahahaha!

    As someone who deals with outsourcing in India on a daily basis, this is hilarious; thanks for the laugh :) The reason India is adding jobs and the US is losing them isn't because of quality. It is happening because you pay literally pennies on the dollar for Indian engineers to crap out some code that is brittle, hard to use, and only sort of works.

    Indian engineers that know what they are doing come to America where they can make actual money. I've worked with lots of intelligent people like this. But I've never worked with any outsourced "talent" that could pass Programming 101. The old saying "you get what you pay for" is especially true in this case.

    I've been working with some outsourced talent which is fucking mustard mate, you must be a racist arsehole who doesn't know fucking shit.

    And you must be Matt Westwood, resident troll and patented asshole.

    Most outsourcers make sure their 'outsourced talent' is as cheap as it gets (i.e. get them from the street, send them to JCC (java concentration camp), sell to client) so if by mistake one of the good programmers accepted to work for them, you should help him change employers.

  • TheJonB (unregistered) in reply to L.
    L.:
    And no, the world is not made from shell scripts.
    Maybe not, but the world wouldn't reboot without them.

    TRWTF though, is that TDWTF's recover password/registration thing doesn't work.

  • Cipher (unregistered) in reply to snoofle

    No, a Perl ass. BASIC didn't have a native sleep() command so he's use ping 127.0.0.1 - n 11 >NUL instead.

  • Shinobu (unregistered) in reply to Cipher
    Cipher:
    No, a Perl ass. BASIC didn't have a native sleep() command so he's use ping 127.0.0.1 - n 11 >NUL instead.
    Q[uick]Basic had a SLEEP statement. It didn't exist in GW-BASIC though and they removed it in Visual Basic, for obvious reasons.
  • Meep (unregistered) in reply to BOFH

    The one with the IO::Handle module. http://perldoc.perl.org/IO/Handle.html

  • vic (unregistered)

    I think that whenever an intern checks in code, Alvin adds one second of sleep to demonstrate to management how bad newbie code is and how it dangerously slows the application. Later, he can lower the sleep by one or two seconds and be praised for his expertise and optimisation hard work.

  • ClaudeSuck.de (unregistered)

    TRWTF is the article.

  • bad_management (unregistered) in reply to Matt Westwood
    Matt Westwood:
    The moral of this story is: Perl's great. It's easy to learn and write stuff in, for certain specialised tasks. This little program sits there in an Ant script, between a QF-Test script and a selenium script. Enter the appropriate Ant command and hey presto! instant regression test. Couldn't have achieved that with any kind of consistency without the delights of Perl.

    Facepalm.

  • davee123 (unregistered)

    Wow, I think I submitted that one back a couple years ago when I first started reading TDWTF! I had given up on it ever making it into an article!

    For the record, we were on a SUN system, and his sleeps were in various places around the code-- but most notably always after a filehandle close. And, if it had been things like "sleep 1", I... guess... I could see some sort of bizarro explanation with NFS not writing the file or something. But... 99% of the time, it wouldn't have mattered anyway.

    His program (in this case) would wake up every MINUTE, check some statuses, and then write them to the log file. And then sleep for 1-3 seconds. Always between 1 and 3. No more, no less. So... speed wasn't an issue. And parallel writes weren't an issue. It was just a log file. Or a status file, I forget which.

    Anyway, his code was chock full of minor WTF's. If I knew more at the time (and if we still had it lying around), I'm sure I could have found tons of blog-worthy snippits. But alas, it's gone.

    The story has a satisfying conclusion though: he had been there as a summer intern for at least one summer, and had a full year of working there full time, until I came in with just about zero Perl experience. But after I was there 6 months, I knew more Perl than he did, and was making him look bad (I learned a lot of Perl via my actual Perl guru buddy from college, often while on the job!).

    Finally, he was put on probation. And then quit, giving 2 weeks notice to go work at some fancy new sure-to-be-successful internet startup company. The 2nd week of his 2 weeks, he called in "sick", while actually having already started at his new job-- at which point our boss just fired him.

    Turns out he also invested a bunch of his own money in his new company, because it was SURE to be a great investment. ... BUT ... they went belly up about a year after he joined.

    DaveE

  • Department of More Money (unregistered) in reply to Nagesh

    It's a Job... Try one.

    If the boss requests a new feature that is unethical, you can put up the penny objections on the ethics grounds, but at the end of the day you're going to either do it or find yourself looking for new work (Right to Work/At-will employment state)

  • japh (unregistered) in reply to L.
    L.:
    TheJonB:
    Spider Flyer:
    Gazzonyx:
    BOFH:
    What version of perl do you have, that has a sync() function?
    I haven't written a line of Perl in years, but can't you shell out to call sync()?

    This is PERL, there's a module for anything!

    http://search.cpan.org/~brianski/File-Sync-0.11/Sync.pm

    Civilised perlmongers use FileHandle anwyay, which also has sync.

    Civilised perlmongers don't use Perl outside of its area of shinyness, i.e. regex.
    Must be a pretty primitive civilization, if your "civilised perlmongers" think that Perl is just good for regexes.
  • L. (unregistered) in reply to japh
    japh:
    L.:
    TheJonB:
    Spider Flyer:
    Gazzonyx:
    BOFH:
    What version of perl do you have, that has a sync() function?
    I haven't written a line of Perl in years, but can't you shell out to call sync()?

    This is PERL, there's a module for anything!

    http://search.cpan.org/~brianski/File-Sync-0.11/Sync.pm

    Civilised perlmongers use FileHandle anwyay, which also has sync.

    Civilised perlmongers don't use Perl outside of its area of shinyness, i.e. regex.
    Must be a pretty primitive civilization, if your "civilised perlmongers" think that Perl is just good for regexes.
    Would you care to point out for what else exactly Perl is the *best* choice ?

    I'm not saying it can't be done in Perl, everything can be done in VB I hear --

  • TheJonB (unregistered) in reply to L.
    L.:
    japh:
    L.:
    TheJonB:
    Spider Flyer:
    Gazzonyx:
    BOFH:
    What version of perl do you have, that has a sync() function?
    I haven't written a line of Perl in years, but can't you shell out to call sync()?

    This is PERL, there's a module for anything!

    http://search.cpan.org/~brianski/File-Sync-0.11/Sync.pm

    Civilised perlmongers use FileHandle anwyay, which also has sync.

    Civilised perlmongers don't use Perl outside of its area of shinyness, i.e. regex.
    Must be a pretty primitive civilization, if your "civilised perlmongers" think that Perl is just good for regexes.
    Would you care to point out for what else exactly Perl is the *best* choice ?

    I'm not saying it can't be done in Perl, everything can be done in VB I hear --

    It'd be done better in Perl though.

  • (cs) in reply to Therac-25

    "Modern Perl" ? Is that the one where they took the concatenation operator '.' and made it mean something completely different ?

  • TNiemi (unregistered) in reply to Agention
    Agention:
    "Boom!" It's no longer funny.
    Always glad to help. No hard feelings, I hope.

    I once read an excellent essay about similarities between modern Internet memes and early 20th century postcards. Unfortunately, I am now unable to find it.

    To get the idea, here are some early "lolcats": http://www.onemoreriver.org/11267/11632.html

    The 20th century "Dam" meme: http://ephemera.ning.com/photo/the-end-of-the-whole-dam

    There were also series of these: http://www.rubylane.com/item/429-col6942/Black-Kids-fighting-for-Nickels Photograph postcards from exotic non-christian locations showing how different and horrible life there was.

    You can probably see how those "Nagesh" pictures quite nicely match the last one.

    (Also, there were series what you could call "lol-negro-babys". Cartoon postcards of black kids talking broken English and looking silly.)

  • BR (unregistered) in reply to L.
    L.:
    Would you care to point out for what else exactly Perl is the *best* choice?

    In our case, it's when we already have a ton of it, and it works.

    But it's also very good for text processing (a part of which you pointed out), acting as a glue language, basic networking stuff (web scraping, Nagios stuff, etc), administration scripts, etc. It's also good when you need to get a lot done fast. But I do agree that unless you're careful, that can lead to the "write-once" pejorative everyone is so fond of throwing around.

    Would you use it to write a GUI desktop app? No. Grabbing the output of apache's /server-status and throwing the info into an in-house monitoring app? Sure.

  • AllThatJazz (unregistered) in reply to NickS

    Conversely, by increasing the sleep to 6, Alvin can now exact his revenge on the upstart n00b by claiming that 'The new guy' flubbed the code and it's now running 15% slower...

  • Barfo Rama (unregistered) in reply to Uncle Al

    Funny, I remember sync;sync;sync before shutdown now

    Word: appellatio verb; to suck off your phone

  • Barfo Rama (unregistered) in reply to Nagesh
    Nagesh:
    pjt33:
    What's a fire handle?

    A place where fire brigade work

    You mean, a place where working girls handle the firemen.

    word: capio to slow down non-paying customers

  • gnasher729 (unregistered) in reply to Mihai Limbasan
    Mihai Limbasan:
    Ellen was parodying Meat Loaf's song "Paradise by the Dashboard Light", where part of the dialogue runs along the lines of

    Girl: "Will you love me forever?"

    Boy: "Oh baby, baby, let me sleep on it"

    Girl: "I gotta know right now!"

    And guess the name of the female singer.

  • anand jeyahar (unregistered) in reply to PiisAWheeL

    +1 on the Dvorak comment. It works brilliantly and keeps people from coming to your desk distracting your flow.
    But that's just a side-effect. The real reason you should use Dvorak is that typing becomes like a dance. As in, if Qwerty were the hiphop style, Dvorak would be Foxtrot:-)

  • anand jeyahar (unregistered) in reply to L.

    +1
    I can vouch for the Outsourcing recruiters attitude. cutting costs + increasing profit margins. Whatever gets that done is what gets through.

  • anand jeyahar (unregistered) in reply to Agention

    Just to add. Nagesh is also a old(think 70s) actor in Tamil(https://en.wikipedia.org/wiki/Nagesh_(actor) movies. He was famous for his comedy antics a lot.

  • Someone (unregistered) in reply to TheJonB
    TheJonB:
    Someone:
    So why is it Perl's fault if this so-called veteran is a dumbass?
    If you are a dumbass perl will help you become even more of a dumbass.

    It's a kind of dumbass force multiplier.

    A bad workman blames his tools, or rather, in this case, a bad workman's colleague blames the tool, and of course, Alex Papadumbass makes it public, adding his own insults, of course.

  • Piskvor (unregistered) in reply to Uncle Al
    Uncle Al:
    mystery meat:
    Try sync(); sync();

    On some systems, the sync() system call is non-blocking, but also non-reentrant, so the way to ensure that all i/o is complete is to call sync() twice.

    Look, a future Daily WTF article!

    Quite so. Everyone knows that you're supposed to sync() three times, for luck.

  • TheJonB (unregistered) in reply to Piskvor
    Piskvor:
    Uncle Al:
    mystery meat:
    Try sync(); sync();

    On some systems, the sync() system call is non-blocking, but also non-reentrant, so the way to ensure that all i/o is complete is to call sync() twice.

    Look, a future Daily WTF article!

    Quite so. Everyone knows that you're supposed to sync() three times, for luck.

    I thought it was one for sorrow, two for joy...?

  • Mathew (unregistered) in reply to SomeCoder
    SomeCoder:
    Nagesh:
    Read #6.

    Higher quality is reason India is ading job and US is losing them.

    Hahahahahahaha!

    As someone who deals with outsourcing in India on a daily basis, this is hilarious; thanks for the laugh :) The reason India is adding jobs and the US is losing them isn't because of quality. It is happening because you pay literally pennies on the dollar for Indian engineers to crap out some code that is brittle, hard to use, and only sort of works.

    Indian engineers that know what they are doing come to America where they can make actual money. I've worked with lots of intelligent people like this. But I've never worked with any outsourced "talent" that could pass Programming 101. The old saying "you get what you pay for" is especially true in this case.

    Thanks for the laugh :) but please get your facts straight. Back when USA had the highest Wages in the world, there was almost no outsourcing.

Leave a comment on “Let Me Sleep on It”

Log In or post as a guest

Replying to comment #:

« Return to Article