• (cs)

    As I looked into the content, my first thought was that this is from one of our system, but not.

  • (cs)

    You've got to love when people hard code the same values throughout multiple classes and methods.

  • charles (unregistered)

    And I love when people are connecting with every call of the function, instead of connecting once for all ...

  • Charles (unregistered) in reply to charles
    charles:
    And I love when people are connecting with every call of the function, instead of connecting once for all ...

    ==> Database connection (of course) ... could have used connexion pool also.

  • Bernie The Bernie (unregistered)

    Wow, isn't that a Micorsoft Access database? They use simple question marks for the parameters. If it were Oracle, it would break down under the load of the many connections, because Oracle is too stupid to re-use them in a timely fashion. Great job!

  • Anon (unregistered) in reply to Charles
    Charles:
    charles:
    And I love when people are connecting with every call of the function, instead of connecting once for all ...

    ==> Database connection (of course) ... could have used connexion pool also.

    Well, not such a big deal IF the database interface has its own connection pooling mechanism. Doesn't take away from the utter wtf of the code.

    I love the way that the variables have the words 'regularexpression' in them, even though the code doesn't actually USE regular expressions anyway

  • (cs)

    I cannot fault Rahul. Most offshore people, especially the ones from a particular Eastern country known for its spicy foods and IT "talent", will do just what it asked and nothing more, nothing less. I heard a story somewhere, I'm not sure where, about someone who had Indian contractors install a fan for his mother (it might have BEEN in India, so it's not a "dey tuk ur jerbs" kind of thing). The instructions said that she needed a way to turn the fan on. Later, they found there was no way to turn it off. When asked the contractor stated that "an OFF switch wasn't in the requirements, so it wasn't implemented". They will do EXACTLY what you state, and not apply any critical thinking or thought.

    As I understand it, it's a cultural thing. Book knowledge and following instructions is looked highly up, while out-of-the-box thinking and doing things on your own is not. Many years ago on a WTF that I can't remember there was a comment from an Indian national living in India who explained this notion, that looking for exact solutions to problems is good, but doing your own research or looking at documentation to find the answer is not considered acceptable.

  • SoftMan (unregistered)

    Send it back to the Offshore office... oops sorry: Officeshore Officeice

  • usitas (unregistered)

    FInternal Revenue Servicest!

  • (cs)

    I guess they should have gotten a few unsuspected surprises at fInternal Revenue Servicet. Like Doctorastically changing the meaning of many other comments. Hope they turned it Office really quick.

    EDIT : Too late. :(

  • moz (unregistered) in reply to Anon
    Anon:
    I love the way that the variables have the words 'regularexpression' in them, even though the code doesn't actually USE regular expressions anyway
    The "like" call uses it as a regular expression of sorts.

    I'm just left wondering how much faster it would be if it was implemented as a stored procedure, especially one on a database linked to the spreadsheet which underpins the process.

  • Guestimate (unregistered)

    the so-called "clbuttic" effects of dumbly replacing substrings with other strings.

    Funny though: sometimes the search string is actually enclosed in spaces (even more funny: something like "FBI" supersedes " FBI "), so the company must have alread had dealings with faulty search-and-replace effects.

  • (cs) in reply to Bernie The Bernie
    Bernie The Bernie:
    Wow, isn't that a Micorsoft Access database? They use simple question marks for the parameters. If it were Oracle, it would break down under the load of the many connections, because Oracle is too stupid to re-use them in a timely fashion. Great job!

    Don't think so. Wildcards are %, Access uses *. More likely MSSQL

  • faoileag (unregistered) in reply to Anon
    Anon:
    I love the way that the variables have the words 'regularexpression' in them, even though the code doesn't actually USE regular expressions anyway
    It does - at least as long as this is Java. See http://www.tutorialspoint.com/java/java_string_replaceall.htm on the "replaceAll" method.
  • Sockatume (unregistered) in reply to ObiWayneKenobi

    If you paid me a pittance to do technical work, you'd get the specification. No more, no less. Can't blame Rahul in this case.

  • O. Contraire (unregistered)

    Trivially speaking these are regular expressions. Most of us do not think of strings without alternatives or closures as regular expressions, any more than we think of them as context-free languages.

    Perhaps the manager thought that brute force string matching was the be-all and end-all?

  • YetAnotherGuy (unregistered)

    Again and again people try to do data mining on unstructured data. Again and again people come up with the idea "let's structure it!". And again and again no one wants to do the nasty job. "Why not let a computer do it?" is the answer of it. Result: a very frustrated developer tries to teach the computer to think smart and ends up doing the thing with three times the effort instead of hiring a whorde of interns (or monkey, or whatever) and teach them. The way technology is, they still outsmart the computer by a long shot.

  • Glen (unregistered)

    At least he used parameterized queries...

  • Anon (unregistered) in reply to ObiWayneKenobi
    ObiWayneKenobi:
    I cannot fault Rahul. Most offshore people, especially the ones from a particular Eastern country known for its spicy foods and IT "talent", will do just what it asked and nothing more, nothing less. I heard a story somewhere, I'm not sure where, about someone who had Indian contractors install a fan for his mother (it might have BEEN in India, so it's not a "dey tuk ur jerbs" kind of thing). The instructions said that she needed a way to turn the fan on. Later, they found there was no way to turn it off. When asked the contractor stated that "an OFF switch wasn't in the requirements, so it wasn't implemented". They will do EXACTLY what you state, and not apply any critical thinking or thought.

    As I understand it, it's a cultural thing. Book knowledge and following instructions is looked highly up, while out-of-the-box thinking and doing things on your own is not. Many years ago on a WTF that I can't remember there was a comment from an Indian national living in India who explained this notion, that looking for exact solutions to problems is good, but doing your own research or looking at documentation to find the answer is not considered acceptable.

    When you pay $1/hr for work, you get back $1/hr work.

  • Jim the Tool (unregistered)

    If I was working at that place, and then I saw that code, I too might have got my first drink driving offence.

    Crazy world.

    captcha amet. As Ah was going to St Ives, Ah met a man with seven wives (who was also going to St Ives)...

  • (cs)

    This is absolutely true. You just need to select your offshore resources carefully, not simply sell the contract to some company who picks your team and insists on managing them.

  • Botia (unregistered)

    Hate to think of "Office" comments. Office Officeice Officeiceice Officeiceiceice Officeiceiceiceice Officeiceiceiceiceice Officeiceiceiceiceiceice Officeiceiceiceiceiceiceice Officeiceiceiceiceiceiceiceice Officeiceiceiceiceiceiceiceiceice Officeiceiceiceiceiceiceiceiceiceice

  • (cs)

    It it really regex though?

  • (cs) in reply to usitas
    usitas:
    FInternal Revenue Servicest!
    Oh, bugger office.
  • (cs) in reply to Guestimate
    Guestimate:
    the so-called "clbuttic" effects of dumbly replacing substrings with other strings.
    Like our very 'smart' web proxy. We recently moved to using Maven, but web applications kept failing to build. And why? Because Netbeans uses the maven-dependency-analyzer plugin, which the proxy refused to download. Took me a while to recognise the 'naughty' word.
  • Anonymous (unregistered)

    TRWTF is that SQL is the supreme programming language and the problem could be easily solved by writting everything in SQL, without regex, wich wasn't used anyway.

  • (cs)

    This is why I'm not really afraid of privacy on the internet because no software is capable of doing any meaningful analysis with all the data.

  • Cant remember my damn login (unregistered)

    An instant Clbuttic!

  • (cs)
  • ¯\(°_o)/¯ I DUNNO LOL (unregistered) in reply to Severity One
    Severity One:
    Like our very 'smart' web proxy. We recently moved to using Maven, but web applications kept failing to build. And why? Because Netbeans uses the maven-dependency-analyzer plugin, which the proxy refused to download. Took me a while to recognise the 'naughty' word.
    I've got a web poxy here with a rule that triggers when the word t-w-i-t-t-e-r is anywhere in the URL. Anywhere. Got a Slashdot article bitching about stupid twits? Tough twitties.
  • (cs) in reply to ObiWayneKenobi
    ObiWayneKenobi:
    I cannot fault Rahul. Most offshore people, especially the ones from a particular Eastern country known for its spicy foods and IT "talent", will do just what it asked and nothing more, nothing less. I heard a story somewhere, I'm not sure where, about someone who had Indian contractors install a fan for his mother (it might have BEEN in India, so it's not a "dey tuk ur jerbs" kind of thing). The instructions said that she needed a way to turn the fan on. Later, they found there was no way to turn it off. When asked the contractor stated that "an OFF switch wasn't in the requirements, so it wasn't implemented".
    You would actually have to go out of your way to make a "switch" that only turns something on. It's kind of like a "write-only" database.
  • JAPH (unregistered) in reply to Severity One
    Severity One:
    Guestimate:
    the so-called "clbuttic" effects of dumbly replacing substrings with other strings.
    Like our very 'smart' web proxy. We recently moved to using Maven, but web applications kept failing to build. And why? Because Netbeans uses the maven-dependency-analyzer plugin, which the proxy refused to download. Took me a while to recognise the 'naughty' word.

    Let me analyze that to find the forbidden word.

  • (cs) in reply to YetAnotherGuy
    YetAnotherGuy:
    ...a whorde of interns
    Sexy!
  • (cs) in reply to operagost
    operagost:
    ObiWayneKenobi:
    I cannot fault Rahul. Most offshore people, especially the ones from a particular Eastern country known for its spicy foods and IT "talent", will do just what it asked and nothing more, nothing less. I heard a story somewhere, I'm not sure where, about someone who had Indian contractors install a fan for his mother (it might have BEEN in India, so it's not a "dey tuk ur jerbs" kind of thing). The instructions said that she needed a way to turn the fan on. Later, they found there was no way to turn it off. When asked the contractor stated that "an OFF switch wasn't in the requirements, so it wasn't implemented".
    You would actually have to go out of your way to make a "switch" that only turns something on. It's kind of like a "write-only" database.

    Right, I think that was part of the joke. The specs didn't say they needed a way to turn the fan OFF, just turn it ON, so the guy only gave it a way to turn on. Following the specs without applying any thought and resulting in "going out of your way" to do it, instead of risk doing the easier thing but have it not be specified.

  • Stormy (unregistered)

    Genius, when it comes to getting paid choose the easiest solution that meets their demands. Not his fault they didn't ask for a performant solution, if so his quote probably would have been a bit higher.

  • James (unregistered)

    All the comments about the code aside, it seems the boss has sent his employees on a fool's errand. The ways to say Internal Revenue Service are as varied as the creativity/stupidity of the users. The true WTF is the boss. The real solution to this problem homicide.

  • James (unregistered)

    All the comments about the code aside, it seems the boss has sent his employees on a fool's errand. The ways to say Internal Revenue Service are as varied as the creativity/stupidity of the users. The true WTF is the boss. The real solution to this problem is homicide.

  • Explanation (unregistered)

    I recognize this code, it was done by my colleague Nagesh from HyperaBad ... It was his final year of college and he needed some money, so, he bid crazy low on some projects offered by the yankees .... I think it was like, a thousandth of a cent per line of code.

    see, no WTF here anymore ....

  • iWantToKeepAnon (unregistered)

    FInternal Revenue ServiceT =~ s!Internal Revenue Service!IRS!gi;

  • Andrew (unregistered)

    It could be that the contractor was given specific instructions about how the solution was to be developed and told not to stray from them. I had a job (contract) like that once.

    An engineering firm gave me the spec for a roadway construction delay calculator in a simple Word doc. When I raised some concerns I was told that it was put together by their best minds and to produce the solution exactly as described and not to stray from it. So I did. Then after it didn't work, I explained to them why and got another contract to come up with a solution that would work and then implement it. It turned out to be a good gig.

  • hank (unregistered) in reply to ObiWayneKenobi
    ObiWayneKenobi:
    I cannot fault Rahul. Most offshore people, especially the ones from a particular Eastern country known for its spicy foods and IT "talent", will do just what it asked and nothing more, nothing less. I heard a story somewhere, I'm not sure where, about someone who had Indian contractors install a fan for his mother (it might have BEEN in India, so it's not a "dey tuk ur jerbs" kind of thing). The instructions said that she needed a way to turn the fan on. Later, they found there was no way to turn it off. When asked the contractor stated that "an OFF switch wasn't in the requirements, so it wasn't implemented". They will do EXACTLY what you state, and not apply any critical thinking or thought.

    As I understand it, it's a cultural thing. Book knowledge and following instructions is looked highly up, while out-of-the-box thinking and doing things on your own is not. Many years ago on a WTF that I can't remember there was a comment from an Indian national living in India who explained this notion, that looking for exact solutions to problems is good, but doing your own research or looking at documentation to find the answer is not considered acceptable.

    This is the point where all those people who were offended by the silly Scottish stereotype from a couple weeks ago jump in and denounce a rather racist portrayal of, what, only the 2nd most populous country on the planet specifically, and more generally everybody outside of Western Europe and North America, right?

  • Robert B (unregistered) in reply to Sockatume

    But they are not paid a pittance by Indian standards. In fact, they're amongst the top-earning professionals in the country.

  • (cs) in reply to operagost
    operagost:
    ObiWayneKenobi:
    I cannot fault Rahul. Most offshore people, especially the ones from a particular Eastern country known for its spicy foods and IT "talent", will do just what it asked and nothing more, nothing less. I heard a story somewhere, I'm not sure where, about someone who had Indian contractors install a fan for his mother (it might have BEEN in India, so it's not a "dey tuk ur jerbs" kind of thing). The instructions said that she needed a way to turn the fan on. Later, they found there was no way to turn it off. When asked the contractor stated that "an OFF switch wasn't in the requirements, so it wasn't implemented".
    You would actually have to go out of your way to make a "switch" that only turns something on. It's kind of like a "write-only" database.

    India power-fail many time so fan get auto-shut off. Silly story insult to me and my country.

  • (cs) in reply to Robert B
    Robert B:
    But they are not paid a pittance by Indian standards. In fact, they're amongst the top-earning professionals in the country.

    That is plain false. In india, investment banker and fund manager are paid highest salaries.

  • (cs) in reply to Nagesh

    Does the fact that bin men and cleaners are paid less than nurses mean nurses aren't underpaid?

    among the highest != highest.

    you will have to think of a lot more professions to make that statement "plain false"

  • Sir Robin The Not So Brave (unregistered) in reply to hank
    hank:
    ObiWayneKenobi:
    I cannot fault Rahul. Most offshore people, especially the ones from a particular Eastern country known for its spicy foods and IT "talent", will do just what it asked and nothing more, nothing less. I heard a story somewhere, I'm not sure where, about someone who had Indian contractors install a fan for his mother (it might have BEEN in India, so it's not a "dey tuk ur jerbs" kind of thing). The instructions said that she needed a way to turn the fan on. Later, they found there was no way to turn it off. When asked the contractor stated that "an OFF switch wasn't in the requirements, so it wasn't implemented". They will do EXACTLY what you state, and not apply any critical thinking or thought.

    As I understand it, it's a cultural thing. Book knowledge and following instructions is looked highly up, while out-of-the-box thinking and doing things on your own is not. Many years ago on a WTF that I can't remember there was a comment from an Indian national living in India who explained this notion, that looking for exact solutions to problems is good, but doing your own research or looking at documentation to find the answer is not considered acceptable.

    This is the point where all those people who were offended by the silly Scottish stereotype from a couple weeks ago jump in and denounce a rather racist portrayal of, what, only the 2nd most populous country on the planet specifically, and more generally everybody outside of Western Europe and North America, right?

    Yeah well the first paragraph is a bit racist, but the second paragraph raises some valid arguments. As I was lead to understand it, it may have something to do with the educational system in former British colonies. Yes, still after more than half a century.

    It's also a matter of simple statistics. The percentage of good and bad Indian devs is probably comparable to that over here in Europe, but because the population is so much bigger, there are simply more bad coders in absolute numbers. And if you happen to find a rare gem, he'll soon move to a project with a "more important" customer. Happened to us. Our team in India was rather ok, until the team lead over there resigned and started working for Ericsson. From then on everything went downhill.

  • F (unregistered) in reply to tharpa
    tharpa:

    You can say that again.

  • (cs) in reply to F
    F:
    tharpa:

    You can say that again.

    Technically, he/she already did. An infinite number of times.
  • (cs) in reply to F
    F:
    tharpa:

    You can say that again.

    Once was enough. I made a comment that i realized was stupid (surprise, surprise), and then the delete button didn't work. But the edit button did. But I couldn't think of a smart comment. So, as my grandmother used to say, if you can't say anything not stupid, don't say anything. Or, in this case, say nothing.

  • Welch (unregistered) in reply to TheEgg
    TheEgg:
    It it really regex though?

    No, and ironically, this is actually one example of something regexes could have done well.

Leave a comment on “Irregular Regular Expressions”

Log In or post as a guest

Replying to comment #:

« Return to Article