• Mickey (unregistered)

    Nice 'Creative' idea I suppose.

  • (cs)

    What? No SQL query sent by the client that the server blindly executes for the arithmetics.

    I can't wait to see a calculator with "MSSQL or Oracle" as a requirement.

  • john (unregistered)

    the real WFT is the web browser is bon echo... someone needs to upgrade to a stable version :)

  • anonymous (unregistered) in reply to john
    john:
    the real WFT is the web browser is bon echo... someone needs to upgrade to a stable version :)
    It's called 'Bon Echo' if it's not an official Mozilla build.
  • Dynamically Generated Javascript Executed? (unregistered)

    I was trying to do this just the other day. I didn't know it was possible. It is possible to send an ajax request, and have that request return javascript, that is then executed?

    I lose for seeking support here.

    Anyways, keep the wtfcalcs coming, very entertaining.

  • (cs) in reply to Dynamically Generated Javascript Executed?

    you can use eval() to execute a string as JS.

    http://www.devguru.com/technologies/javascript/11460.asp

  • Pasotaman (unregistered)

    The real WTF is that it uses port 12345, which is also the Netbus port. I hope muy vict... errr friends don't start using this calculator...

  • aeternus (unregistered)

    Wow. This is truly an OMG code but, unfortunately, not WTF code.

    A webserver (with content !) in 10KB of C? With Ajax? Most people rarely touch Ajax without js libraries, and jQuery is 19KB compressed (!). This calculator even has error handling ("Check Internet connection") and sensible comments!

    I think that the author would have better chances if he spent more time WTFing the code rather than improving it.

    Nonetheless, I'm truly impressed at the author's skills, I haven't seen something like this in a while.

  • dkf (unregistered) in reply to Pasotaman
    Pasotaman:
    The real WTF is that it uses port 12345, which is also the Netbus port. I hope muy vict... errr friends don't start using this calculator...
    Hey! Netbus uses the same port number as my luggage!
  • (cs) in reply to Mickey
    Mickey:
    Nice 'Creative' idea I suppose.

    At first I wasn't impressed, but this is actually kind of cool. Its a web app with NO web code. There are no JS files, no JSP, no ASP, no PHP, no nuthin'. (Not counting JS hardcoded in the server itself, of course.)

  • mathew (unregistered)

    Anyone had a look for obvious buffer overflows?

  • dkf (unregistered) in reply to aeternus
    aeternus:
    Wow. This is truly an OMG code but, unfortunately, not WTF code.
    Oh I don't know. It's such a totally bonkers way of tackling the challenge, that it is worth an honourable mention. OTOH, it is technically against the rules so I hope it doesn't win. I suppose we could send the author a consolation prize of a low res photo of the high res photo prize.
  • dkf (unregistered) in reply to mathew
    mathew:
    Anyone had a look for obvious buffer overflows?
    It's got them. Naturally. (Hint: look in
    calc_server
    and think what happens when you start sending very long requests.)
  • BillyBob (unregistered)

    Give this person the laptop :-D :-p

    This, to me, is a WTF in the truest sense of the expression. It works, it's nice code, it's efficient, infact it's quite brilliant but deep underneath the covers there is a nasty piece of work no one could possibly expect.

    It's not until you delve deeper that you truly start to understand the horror of this snippet. I'm concerned that I have been reading comments such as this isn't a WTF. So let's revisit what this is doing... It is a calculator making requests on google for the answers to simple maths expressions and people don't see the WTF in that?

    This is a prime example of WorseThatFailure and goes far beyond silly true/false/maybe sort of stuff we've been seeing of late.

  • Cowbert (unregistered)

    wtf does wtf have "marital aid" ads? doesn't seem very worksafe to me:

    http://pics.livejournal.com/cowbert/pic/00001s2t

  • espinafre (unregistered)

    TWM for teh win! How long it's been since I've seen one of these... I must be getting old

  • (cs) in reply to Cowbert
    Cowbert:
    wtf does wtf have "marital aid" ads? doesn't seem very worksafe to me:

    http://pics.livejournal.com/cowbert/pic/00001s2t

    It's actually a bizarre ad for the TV series "The 4400". How odd...

  • Rudolf (unregistered)

    Nicely done. I heard about the google query calculator, and was wondering if anyone would pull it off. A very ineffective approach, but the code itself very much devoid of wtfiness, which is kinda a shame.

    Keep 'em coming, I wonder who gets the nice wallpaper and such (and if he perhaps is willing to share it by parsing each byte as ints through his calculator to us :o)

  • Jeff Brown (unregistered)

    BASIC on a TI-99/4A at six and then C on the Amiga. Sounds like Dave and I have a lot in common.

    My first few BASIC programs made starships fly off the top of the screen...

  • Mike (unregistered) in reply to Jeff Brown

    I can credit my TI for drilling me in binary-to-hexadecimal. After all, Bill Cosby knows computers.

    10 CALL CHAR(128, "3C42A581A599423C") 20 CALL CLEAR 30 FOR I=1 TO 24 40 CALL HCHAR(I, 1, 128, 32) 50 NEXT I 60 GOTO 60

    Memories... ^_^

  • (cs)

    It has no rounded corners though. Clearly not "AJAXy" enough.

  • Gareth (unregistered)
    When the user presses a calculator button, an AJAX call (XmlHttpRequest) is sent to the web server [...] Dynamically generated Javascript is returned to the client and then executed to update the display.

    Unfortunately a lot of 'Web 2.0' sites use exactly this methodology without realising what a WTF it actually is

  • Tinkerghost (unregistered) in reply to Dynamically Generated Javascript Executed?

    You return the javascript & then eval it. I can't find it now, but yesterday I found one that was using httprequest to dynamicly import javascript functions, eval them, then add them to the window.function list.

  • NTM (unregistered)

    for pure creativity, this submission, while bending or liberally interpreting the guidelines, is a winner!

  • whicker (unregistered) in reply to Mike
    Mike:
    I can credit my TI for drilling me in binary-to-hexadecimal. After all, Bill Cosby knows computers.

    10 CALL CHAR(128, "3C42A581A599423C") 20 CALL CLEAR 30 FOR I=1 TO 24 40 CALL HCHAR(I, 1, 128, 32) 50 NEXT I 60 GOTO 60

    Memories... ^_^

    Ahh yes, and that only took about 12 seconds to execute.

    Granted couldn't you do CALL HCHAR(1, 1, 128, 768)?

    Also, I am insulted about the "six year old" comment of the writeup. A six year old can write a random snowflake program, or a fill the screen with random garbage program. Or mess with plotting SIN( ) on a really coarse 32x24 text display.

    I can't say I'd ever even thought of something as mundane as a 10 PRINT "CRAP" 20 GOTO 10 program. Its results would be obvious, and you learn very quickly about the FCTN-F4 (Clear) or C= RUN/STOP key.

  • Csaboka (unregistered)

    Could anyone make it work correctly on browsers other than Firefox? I've tried it on Opera and IE7, and the number entry was broken on both. Or is the dependency on a single browser part of the WTF?

  • (cs) in reply to Csaboka
    Csaboka:
    Could anyone make it work correctly on browsers other than Firefox? I've tried it on Opera and IE7, and the number entry was broken on both. Or is the dependency on a single browser part of the WTF?

    It's a WTF that it's dependant on a single browser that ISN'T IE.

  • Nyuserre (unregistered)
    ...job was for an Internet provider in the early 90’s, where he developed a text editor in VAX/VMS BASIC,

    WTF?

  • (cs) in reply to Nyuserre

    I think the article could do more to emphasize that the "server" in this submission actually sends the calculation to GOOGLE through http and parses the response from html before sending it back to the Javascript Ajax call.

    I didn't notice it until I downloaded the source and read it.

  • Steve (unregistered)

    That's not Web 2.0-ish at all. Look, the name at the top is in a serif font, the buttons' corners aren't rounded, and there's not a shade of greyish-blue or bluegreen anywhere.

  • js (unregistered)

    Ah yes, CALL CHAR...

        @ @ @ @  
      @         @
    @   @     @   @
    @             @
    @   @     @   @
    @     @ @     @
      @         @ 
        @ @ @ @
    

    ...taught me how to count in binary when I was 6 years old.

    I remember for no good reason, I defined actual lowercase letters just for the sake of doing it.

  • JMP $FCE2 (unregistered)
    Dave has been programming since age six, starting with BASIC on a TI99/4A. Not quite sure what kind of program one would write at six, but surely it would be less advanced than my first program, circa ten years old:
    Well, there are the rare few of us who were a little more advanced at that age. We certainly got teased a lot while writing out 65xx machine language opcodes on quadrille paper, or talking to folks two generations older at Users' Group meetings, or slashing away at copy protection schemes that took three months to design by programmers five times our age... but where do you think the script-kiddie and PFY stereotypes came from in the first place!? <g>

    (Yes, Adam, I am who you think I am.)

  • Houdini (unregistered)

    Dave, you're my hero.

  • HateSqueak (unregistered)

    Oh god, I'm having flashbacks to my group project for a class where we had to use Squeak.

    We figured we didn't have time to write the fuzzy string comparison method that would tell you how similar two last names were (it was a genealogy program), so instead we took the arguments to the function, plugged them into a CGI script on some genealogy website, parsed the resulting HTML, and returned the result. Our program would fail if they changed the layout of their website.

    We weren't slackers either, we had just spent most of our time fighting with that stupid, ugly, undocumented bastard of a language. Hate Squeak SO much... It makes me cry that they're putting it on the OLPCs.

  • NiceWTF (unregistered)

    OK, I did actually come up with the idea to use Google to do the actual calculations as well. Guessed I wouldn't be the only one and besides, I couldn't be arsed to actually write it ;)

    However, this solution adds several more fine layers of exploitable web 2.0 AJAXy goodness. I would call it a winner :)

  • Woosta (unregistered)

    WPI FTW!

    After reading some of the finalists, I thought it would be funny to wrap Google, and lo, someone did. The code sounds clean, which means it probably won't win.

  • someone (unregistered)

    The code isn't that clean!

    It is littered with potential buffer overflows, poor error checking, and gross inefficiencies.

    Then again, so is most code.

    LOl

  • (cs)

    ...so I didn't have to.

    I was "this" close to going through with it... I had actually written a[n] (obscenely complex) regex for parsing Google'c calc output.

    Then I promptly shoved everything into a wastebasket, lit it on fire, and downed two fifths of vodka.

    Enjoy your laptop.

  • hkgjc (unregistered)

    http://www.forex.co.ir http://www.meta-fx.com forex فارکس

Leave a comment on “OMGWTF Finalist #05: WTF Web Calc”

Log In or post as a guest

Replying to comment #:

« Return to Article