• (unregistered)

    AHH!  I'm blind!
    Oh, sorry, I looked at it directly.

    Let me start by asking: why is each of those scalar variables taking an array slice as a value?

    Actually, I think I'll end with that too.  I keep scrolling up out of fascination, but I'm afraid if I do it again I'll be scarred for life.

  • (unregistered)

    Aagghh! It burns!

  • (cs)

    Finally, hard evidence that you can be at two different places (states) at one time.

  • (unregistered) in reply to

    I ...............can't...................see.......................why

  • (unregistered)

    I don't see any WTF here.

    The data from the states array/scalar was probably unreliable, and the only way to ensure absolutely that the correct states were printed out was to type them in by hand for each option box.  

  • (cs)

    Shouldn't all the
    $statename = @data[n];

    be
    $statename = $data[n];
     [^o)]

  • (cs) in reply to sas
    sas:
    Shouldn't all the
    $statename = @data[n];

    be
    $statename = $data[n];
     [^o)]

    I think it's a tcl application, and as far as I remember, arrays are indicated with an @...

  • (cs) in reply to KoFFiE

    It looks like a lame attempt at Perl to me, but I don't know what tcl looks like.  In Perl, arrays are referred to with @ prefix, but only for the entire array.  Element references use the $ (scalar) prefix.

  • (unregistered) in reply to sas

    sas:
    Shouldn't all the
    $statename = @data[n];

    be
    $statename = $data[n];
     [^o)]

    This is perl and the person who wrote it used @data[0] instead of $data[0].  It only throws a warning, but still runs.

    And, no, the application did NOT have a database behind it.

    --Kurt

  • (unregistered) in reply to sas

    sas:

    Shouldn't all the
    $statename = @data[n];

    be
    $statename = $data[n];

    <!--StartFragment -->Yes, you're right.  This code happens to work in this situation, but it is wrong.  The former is a an array slice of length 1, the latter is an array element.  Arrays provide a list context, and elements provide a scalar context.  Since Perl is context sensitive, you can get different results depending on which context you provide.  This is explained in the Perl FAQ, part 4, section Arrays.

  • (cs)

    How do people get away with writing crap like this?

    I'm beginning to believe I've met trained cockroaches that can code better than some of these examples. Of course, I've seen my fair share of "programmers" like this in the real world, somehow they retain their jobs, while the ones that actually wrote decent code get laid off. Maybe it's PHB syndrome... Maybe it's the high corporate execs looking at the staff list going.. "This one is making 54% more than his peers, he needs to go. Send him the axe" ...

  • (cs)

    FWIW, this looks very little like Tcl.  You can tell Tcl code because it looks like this:

    set var "value"
    for { set i 1 } { i < 100 } { incr i } {
        puts "i = $i"
    }

    Also, Tcl's syntax is extremely basic which makes it so that you can't format brackets the way you want to; for example, you can't say

    for { set i 1 } { i < 100 } { incr i }
    {
        puts "i = $i"
    }

    because that would make the puts block evaluate separately from the for command.  (And not surrounding it by brackets would be right out!)

    Basically, in a for loop, if statement, etc., the subordinate pieces of code are passed in as parameters to the for/if/etc. functions.  It's a fascinating language from the design and theory standpoint (it's basically LISP with variable side-effects and a sequence operator, and writing a Tcl parser/interpreter is extremely simple), though not very useful for real-world apps programming.  Personally, I only use Tcl when I need to write a quick script which does more numerical processing than is convenient in bash.

    But this is all besides the point.  My eyeballs nearly exploded when I looked at today's WTF.  I seriously hope that whatever "programmer" wrote that  used copy-paste.

  • (unregistered)

    I just love how people try to jump in and justify code, no matter how bad it is.

    You can't justify this one folks, the code is just plain stupid.

  • (cs)

    My fingers fall off just from looking at it.

    Man, am I glad that Austria only has 9 counties.

  • (unregistered)

    Argh!  What about Puerto Rico?  What about Guam or American Samoa?  What about (horrors) an actual foreign country?

  • (unregistered)

    What aggravates me is that I have spent most of my career fixing shtuff like this while the knuckle-head that wrote it is creating new shtuff for me to fix.

  • (cs)

    So is this code at least used in situations where you don't want all of the states?  Please say that there is at least some point to this code.

  • (unregistered)

    WTF? Why does a blog software search smileys inside of <PRE>-Tags?

  • (unregistered) in reply to Scott

    Scott:
    So is this code at least used in situations where you don't want all of the states?  Please say that there is at least some point to this code.

    Yes.  This code was used to generate forms for a website and each form had different states that it applied for.  For example, the website may sell a product, but only to particular states.  For another website, run by the same software, they may sell a product to a different set of states.

    Because of the nature of the beast (US laws and regulations pertaining to the product / services these websites offer), these sites would never do business outside of the 50 states or Washington D.C.  So it doesn't have to account for any territories / protectorates / foreign countries / etc.

    --Kurt

  • (unregistered)

    May I please recommend folks use the FIPS standards?

    http://www.census.gov/geo/www/fips/fips.html

     

  • (unregistered)

    the redundancy ... hurts me poor brain. Clueless perl, wrong on so many levels that I don't want to even start.

    I'm part of the company interview process, and we get perl fragments every now and then from potential employees. You can guess what sort of stuff I have to wade. This, is however, even worse than the typical stuff.[*-)]

  • (unregistered) in reply to Scott

    The true WTF is reading the posts from people saying "This code isn't that bad..."

  • (unregistered) in reply to

    Wow! You have to be a special kind of stupid to write something like that.

    Skip.

  • (unregistered)

    I don't see any wtf here. It's beautiful clean code, and much similiar to the code i usually write. Futhermore it's easy to understand and does excatly what it should.

  • (unregistered)

    When you have a loop with a known number of iterations, it's faster to expand it, since you don't have to do the checking for the loop condition each time (this is called "loop unrolling"). So this is much more efficient.

  • (unregistered) in reply to

    So tell me, what is the limit of loop unrolls? When will you stop unrolling loops? At 100? At 1000?

  • (cs) in reply to

    I'm getting RSI (or whatever it is called these days) just by looking at this code. My pooooooor hands [:(]

    Drak

  • (unregistered) in reply to

    <FONT style="BACKGROUND-COLOR: #efefef">Usually the compiler in use decides when to do loop optimizations. Size vs speed is one factor which needs to be considered...</FONT>

    But there are two special cases:

    1. Developer who have profiled the system and detected that some loop is a bottleneck and manually unrolls the loop.
    2. Some wannabe übersmart developer unrolls the loop for some nogood reason. Usually (s)he also often finds bugs in the compiler when trying to compile his/her code too [;)].
  • (unregistered) in reply to
    :
    When you have a loop with a known number of iterations, it's faster to expand it, since you don't have to do the checking for the loop condition each time (this is called "loop unrolling"). So this is much more efficient.


    No! No no no no no no no! Now crawl back under the rock before I smack you!

    Code like this is simply too horrible to be justified in any way. Leave loop-unrolling to the compiler.
  • (unregistered) in reply to

    yes, in this case loop-unrolling truely is irrelevant.

    (but it should not allways be left to the compiler (unless the compiler has a way to specify which loops should be unrolled) - on critical algorithms or old computers loop unrolling will roxX0rz.)

  • (cs)

    Well at least there in alphabetical order, you've got to give the guy credit for that.

    I'd love to see the code from this guy when he is capturing someones title though!

  • (unregistered) in reply to fluffy

    fluffy:
    FWIW, this looks very little like Tcl.  You can tell Tcl code because it looks like this:
    [snip]

    That was a joke, right?  Please?

  • (unregistered) in reply to

    Are you guys hiring? [:)]

  • (unregistered)

    Did the author of this code work for Anderson/Accenture consulting? I've only seen perl that bad in one place... and it was written by someone from Accenture.

    Ok, so the company that the app is written for can only sell in the 50 states... what if texas is divided into it's 5 proposed states?


  • (unregistered)

    Hey everybody! I'm here to justify this code!

    Here goes...wait a sec...WHAT WAS I THINKING?!? [:$]

  • (unregistered)

    I think we're all missing the point here. The guy who wrote this code is probably making 120K/yr. at some Fortune 500 company. Management probably hangs on his ever word and suggestion.

    <FONT style="BACKGROUND-COLOR: #efefef">And he continues writing the same sort of code...</FONT>

    <FONT style="BACKGROUND-COLOR: #efefef">Dude, that hurts.</FONT>

  • (unregistered) in reply to
    :

    I think we're all missing the point here. The guy who wrote this code is probably making 120K/yr. at some Fortune 500 company. Management probably hangs on his ever word and suggestion.

    <FONT style="BACKGROUND-COLOR: #efefef">And he continues writing the same sort of code...</FONT>

    <FONT style="BACKGROUND-COLOR: #efefef">Dude, that hurts.</FONT>

    Nah, it was either my boss or another developer who doesn't work here anymore.  It wasn't a highly paid consultant, it was someone who was a great programmer -- of DOS apps -- and who shouldn't be writing perl.

    --Kurt

  • (unregistered) in reply to

    :
    What about (horrors) an actual foreign country?

    No No No, If its all right with you guys Stateside, please keep such programmers, and the systems they spawn to yourself.....

  • (cs)

    I don't know what you guys are talking about.  This is the first time I've ever actually been able to read Perl.

  • (unregistered) in reply to

    I'd hate to see you architect a large building, much less a dynamic Web site.

  • (unregistered)

    Yeah, exactly. It's clean and elegant code.

    You people are probably just jelus because you cant write so beutiful code.

  • (cs)

    <FONT style="BACKGROUND-COLOR: #efefef">And you're probably just jelious for your beautiful spelling mistakes. But never mind.[8-|]</FONT>

  • (unregistered) in reply to
    :
    Argh!  What about Puerto Rico?  What about Guam or American Samoa?  What about (horrors) an actual foreign country?

    Brace yourself, Romania actually has 42 (count'em) counties. And I've seen just this kind of crap in a FoxPro application, which, actually and by definition, was backed by a database (however primitive). The guy who wrote it seemed overly concerned about fitting the county-related code in a single file. Maybe it's the same thing here.

    As for Perl, when I first tried it and decided it was too much for my poor little human brain, I just gave up on in and went for PHP. WTF, is that such a hard thing to do?

  • (unregistered) in reply to

    I do hope whoever wrote that was doing their first day on the job.

  • M4 (unregistered) in reply to
    :
    I do hope whoever wrote that was doing their first day on the job.

    I do hope whoever wrote that was doing their LAST day on the job.

  • Anthony Gatlin (unregistered) in reply to M4

    As untalented as this developer is, there are organizations where he could still be their best. Note to developer: The State of Texas is hiring.

  • (cs)

    I'm no native of the USA, but do I count 51 states? (Indices 4 through 54.)

  • (cs) in reply to Hand-E-Food
    Hand-E-Food:
    I'm no native of the USA, but do I count 51 states? (Indices 4 through 54.)
    The District of Columbia is not a state, but it is considered as a state for many purposes. (Writing this from DC.)
  • Glennnek (unregistered)

    Кроме того, мы предлагаем услуги профессиональных консультантов, которые помогут выбрать подходящий товар и ответят на все вопросы по его эксплуатации https://акваторг24.рф/product/vysota-v-mm/160/

    доставку заказов с подъемом сантехники до квартиры покупателя; индивидуальный подбор оборудования с учетом дизайна и функционала помещения https://акваторг24.рф/product/vysota-v-mm/140/

    В каталоге магазина можно подобрать необходимую продукцию для квартиры или коттеджа любых размеров и стилистик https://акваторг24.рф/armatura-zapornaya/krany-sharovye-dlya-vody/krany-sharovye-mvi/kran-sharovoy-uglovoy-polnoprohodnoy-mvi-3-4-s-amerikankoy-nar-vn-rezboy-ruchka-babochka-krasnaya-art-bv-522-05/ Удобный и подробный фильтр поможет оставить на странице товары только с необходимыми параметрами https://акваторг24.рф/fitingi-dlya-trub/fitingi-ppr-tim/ppr-amerikanka-vr-40-11-4f-tim-art-tpp3041-0-04005/ Представлена продукция от эконом класса до элитной дизайнерской сантехники класса люкс https://акваторг24.рф/zapornaya-radiatornaya-kotelnaya-armatura/kran-sharovoy-tim-rychag-3-4-g-sh-art-de1204/

    Магазин предоставляет услуги по доставке заказов с подъемом купленной сантехники на нужный этаж https://акваторг24.рф/kollektory-shkafy-komplektuyuschie/kollektornye-gruppy-dlya-tyoplyh-polov/kollektor-iz-nerzhaveyuschey-stali-mvi-s-rashodomerami-drenazhnym-kranom-i-vozduhootvodchikom-8-vyh-art-ms-708-06/ Собственная курьерская служба действует внутри МКАД https://акваторг24.рф/slt-aqua1/perehodnoy-troynik-slt-aqua-pp-r-20h25h20-mm-sltft2202520/ Клиент может заказать несколько видов доставки, в том числе вечером после 22:00 и в выходные дни https://акваторг24.рф/protivopozharnye-truby-i-fitingi/protivopozharnye-fitingi-red/vvarnoe-sedlo-ppr-o110x40-slt-blockfire/

    Интернет-магазин сантехники dushevoi https://акваторг24.рф/zapornaya-radiatornaya-kotelnaya-armatura/filtr-samopromyvnoy-s-reduktorom-davleniya-s-manometrom-amerikankami-i-slivnym-kranom-tim-3-4-nar-nar-steklyannyy-korpus-art-jh-2008y2/ ru https://акв

  • Bennyhauff (unregistered)

    Ремонт прокола: от 1900 https://24shina.moscow/

    В компании клиентам предлагают самые доступный по цене мобильный шиномонтаж в Москве, оперативно реагирующий на вызовы клиентов https://24shina.moscow/kievskoe-shosse?screen=kievskoe-shosse Для устранения любых поломок колес мастера используют: Снятие секреток с колёс https://24shina.moscow/prikurka-avto

    Ремонт лобовых стекол https://24shina.moscow/motoshinomontazh

    Комплектность https://24shina.moscow/snyatie-sekretok

    Мобильный выездной шиномонтаж https://24shina.moscow/services

Leave a comment on “Now *That* is a Way to do States”

Log In or post as a guest

Replying to comment #:

« Return to Article