• MRAB (unregistered) in reply to FORK=ATOM

    I thought it was FORD=STOP...

    The spaces might have been stripped out by a program after the source had been tokenised so that it would not be possible to convert it to text and then back again.

  • (cs) in reply to Andy Goth
    Andy Goth:
    COMPUTER OVER.
    ANDY = VERY YES.

    That's not a good prize!

  • (cs) in reply to Throknor
    Throknor:
    And as I recall AppleBASIC would pre-tokenize so in the stored file AND would actually be a single character.

    I have no idea what this interpreter would do with GEORGE, but it should be easy to test and design a pseudo-parser that works the same way and inserts spaces.

    I can't remember, but I have a feeling AppleSoft would have broken GEORGE into GE OR GE and give you a ?SYNTAX ERROR. The solution would simply be to not have variable names that contain reserved keywords.

  • Daniel (unregistered)

    I don't know, it seemed obvious to me. I found it fun that it looked like "Andy", but from the first read it meant "AND Y=NO" to me.

  • Confused (unregistered) in reply to Loren Pechtel
    Loren Pechtel:
    LAWSUIT=YES
    And just what is LAWSUIES anyway?

    captcha: appellatio - English for where that pink salt comes from.

  • (cs)

    My comment about pasting it into a text editor was just to read the code, not as a way to fix the spacing issues then put it back.

    Or would the spacing between them stay the exact same no matter what?

    I wasn't implying pasting it into a text editor and then back into the compiler would fix the spacing.

    I was just figuring on a different way to read the code if there was some confusion. I've seen text editors and the like where a space may be half the space of an actual character, but if it were pasted into a different text editor wouldn't it use its own formatting instead of that of the previous source?

    Addendum (2009-01-16 14:03): Or was the issue that you were disallowed to use any reserved word as a variable name?

    If that was the case, a simple search for the reserved word replace a space on either side would solve a lot of the issues.

  • Dan (unregistered)

    No DangerMouse, you need to paste it into a word document and convert it to helvetica italic.

  • Dredge Slug (unregistered) in reply to Code Slave
    Code Slave:
    Andy walks with me, Andy talks with me

    That is wrong on so many levels! But it's still funny. :)

  • ThomasP (unregistered)

    I starting to write a comment but deciding to make fun of grammar instead.

  • (cs) in reply to ThomasP
    ThomasP:
    I starting to write a comment but deciding to make fun of grammar instead.

    I didn't realize that the two were mutually exclusive...

  • (cs) in reply to Anonym
    Anonym:
    ML:
    Commodore BASIC lines did not need any spaces except where omitting one would be ambiguous, and in fact most Commodore BASIC programs were written with no spaces, e.g., 100IFA=5THENPRINT"YES":GOTO160 . Omitting spaces as such would lead to a more compact program, since the tokenizer never removes any space inserted between keywords: the presence of spaces results in extra 0x20 bytes in the tokenized program which are merely skipped during execution.
    The abbreviations are automatically expanded, the same thing is stored in memory if you enter "GO♥" or "GOSUB". Also, commands can't span multiple lines in Commodore BASIC.
    I don't recall with the C64, but the VIC allowed 88 characters per BASIC line (which appeared as four screen lines due to the wacky VIC-I chip) which included tokenized commands. So if you used "?" for PRINT and RshiftE for RETURN a lot, you could save a lot of RAM.
  • ThomasP (unregistered) in reply to Voodoo Coder
    Voodoo Coder:
    ThomasP:
    I starting to write a comment but deciding to make fun of grammar instead.

    I didn't realize that the two were mutually exclusive...

    I meant making fun of grammar as opposed to writing a comment about the WTF.

  • (cs)

    How do you pronounce "f*ck?"

  • ThomasP (unregistered) in reply to ContraCorners
    ContraCorners:
    How do you pronounce "f*ck?"

    fuh-star-kuh

  • Andrew (unregistered) in reply to Ken B
    Ken B:
    IFC=ZTH ("if (c==z) then")
    Given that THEN/TH is optional (according to the post), what if you have a "ZTH" variable? Is that "if ( c == z ) then" or "if (c == zth)"? Eww.

    My favorite is COBOL's "Either OR" syntax. I still don't know how they parse that!

    IF SALARY IS EQUAL TO 15005 OR 25000 THEN

    This means "Salary is equal to $15,005, or salary is equal to $25,000". Also, IS and TO are optional. It gets uglier with longer boolean expressions.

  • (cs)

    Just because a firm exists to service one client does not mean that client will hire the firm. Hence why they hired other developers.

    And sure, Mark could have just reparsed it automatically. But what he should have done is reparsed it automatically, and saved that as a copy. That way if anyone came around he could ALT-TAB from Doom back to ANDY, and about once or twice a week magically decipher one or two bug's worth of code.

  • (cs) in reply to operagost
    operagost:
    I don't recall with the C64, but the VIC allowed 88 characters per BASIC line (which appeared as four screen lines due to the wacky VIC-I chip) which included tokenized commands. So if you used "?" for PRINT and RshiftE for RETURN a lot, you could save a lot of RAM.

    Since the token was saved in memory typing ? or PRINT would use up the exact same amount of ram. The only time you save on ram is when you cram multiple stuff on one line. Each line of basic has 5 bytes of overhead, two bytes for a line number, 0 for end of line, and 2 bytes for the address of the next line. But if you put two statements on one line you only need the extra character : as the statement separator.

    As for this WTF, are you sure the guy obfuscated the code? As opposed to just writing it that way? Replace variable names would be difficult (are you sure you did it properly?), but adding in spaces should have been fairly easy. I think I might have stuck around if the pay was good enough.

  • (cs)

    The trick I learned was if you had a line like:

    IFTANDSTHEN?"Hello World" rewrite it with spaces between each character I F T A N D S T H E N .... and the list the program to see what BASIC thought you wanted. In this case (on that particular interpreter) it was the equivilent of

    IF TAN(DS) then...

  • (cs) in reply to operagost
    operagost:
    Anonym:
    ML:
    Commodore BASIC lines did not need any spaces except where omitting one would be ambiguous, and in fact most Commodore BASIC programs were written with no spaces, e.g., 100IFA=5THENPRINT"YES":GOTO160 . Omitting spaces as such would lead to a more compact program, since the tokenizer never removes any space inserted between keywords: the presence of spaces results in extra 0x20 bytes in the tokenized program which are merely skipped during execution.
    The abbreviations are automatically expanded, the same thing is stored in memory if you enter "GO♥" or "GOSUB". Also, commands can't span multiple lines in Commodore BASIC.
    I don't recall with the C64, but the VIC allowed 88 characters per BASIC line (which appeared as four screen lines due to the wacky VIC-I chip) which included tokenized commands. So if you used "?" for PRINT and RshiftE for RETURN a lot, you could save a lot of RAM.

    Actually, all that did would be to get you around the four-line-cutoff when entering. The tokens were translated before being stored into memory. As I recall (and this is back to grade school, mind you) doing so would be legal but make the line impossible to edit, since when it was displayed it wrap more than four lines. If I recall the VIC-20 correctly, you could list a line and use the arrows to go back and edit it but the same four-line limit would apply.

    To be clear, when you type 10 ? "ABC" it might be saved like 0010FA22414243FA00 so would list as 10 PRINT "ABC"

    Also, I don't think it saved the spaces - once the commands are tokenized, spaces are not just pointless but with 3.5K of RAM downright wasteful. I might be thinking of AppleSoft again though. (BTW, I'm not trying to be pedantic - just nostalgic. Much more of this and I might just dig out my //c.)

  • bramster (unregistered)

    "That kind of system is best resolved by rewriting the whole thing in a better language.

    You don't always need the source code of a piece of software - sometimes it's better to analyze what it does. "

    I agree. Who wants to be maintenance programmer anyway?

    And Basic. WTF Basic? I wrote my last Basic program in 1982, just before I wrote the same program in C and realized it was 10,000 times faster.

  • RegEx fan (unregistered) in reply to biziclop
    biziclop:
    Throknor:
    Do they not teach BASIC anymore? The old ones I used were simple left to right tokenizers. While they required spaces, their symbols could not be used as variables. And as I recall AppleBASIC would pre-tokenize so in the stored file AND would actually be a single character.

    I have no idea what this interpreter would do with GEORGE, but it should be easy to test and design a pseudo-parser that works the same way and inserts spaces.

    If you have the language set, it should be a straightforward matter. Read a file straight through and throw spaces around keywords. Test if the program still works. Repeat on code as you need to interact with it.

    Straightforward - not easy.

    This.

    It does my head in how people can't think in anything other than regular expressions anymore. You don't need anything like that for a BASIC interpreter, let alone yacc or lex and friends. All you need is to read character after character into a buffer and check if you have a valid token or not. Even a ten year old kid should be able to do it.

    That's what lex would do for you. But only if you know regular expressions ;)

  • Crash Magnet (unregistered)

    So, the TRWTF is somebody was running a company with empolyes and everything on VIC-20 with 3.5K of memory?

    I just don't...

  • david (unregistered)

    Anyone old enough to have used FORTRAN IV should remember these: DO10I=1 is an assignment to the variable DO10I, whereas: DO10I=1,10 is the top of a loop where I iterates from 1 to 10. Of course, there can be continuation lines before the ','.

    10 FORMAT(I4, A4) looks like a format statement, until you see the continuation line *= 1 when it becomes an assignemnt to the two dimensional array FORMAT. (And neither of these variables need be declared any earlier).

  • (cs) in reply to david
    david:
    Anyone old enough to have used FORTRAN IV should remember these: DO10I=1 is an assignment to the variable DO10I, whereas: DO10I=1,10 is the top of a loop where I iterates from 1 to 10. Of course, there can be continuation lines before the ','.

    10 FORMAT(I4, A4) looks like a format statement, until you see the continuation line *= 1 when it becomes an assignemnt to the two dimensional array FORMAT. (And neither of these variables need be declared any earlier).

    Oh did this bring back memories... Thank you

  • Cheech (unregistered)

    It gives me a new motto for the day: Just Say No to Andy.

  • st0815 (unregistered) in reply to NiceWTF
    NiceWTF:
    2. Apparently they didn't have CVS/SVN logs nor even backups to revert the obfuscation?

    They were using BASIC. What's the point of your question?

  • ML (unregistered) in reply to bramster
    bramster:
    And Basic. WTF Basic? I wrote my last Basic program in 1982, just before I wrote the same program in C and realized it was 10,000 times faster.
    The article said:
    the original article:
    "Years ago," Mark wrote, "and long before I had started working there...
    As far as we know, "years ago" means *30* years ago.
  • rcw (unregistered) in reply to Anonym

    Commodore BASIC even wound up encouraging this, since you weren't allowed to enter a line of code longer than 80 characters. The line could expand to longer than 80 characters once entered, though (and anyone else who wanted to re-enter that line with a small change would have to figure out the abbreviation trick to do it).

  • (cs)

    Applesoft stored programs as tokens. You typed them in however you wanted, but it converted it on the fly to tokens. You didn't need spaces, which I thought was super cool, but it didn't save memory or disk space, only typing.

    If you typed

    10 ?"HELLO WORLD"; 20 FORX=1TO1000:NEXT 30 GOTO 10

    and then did LIST you would get

    10 PRINT "HELLO WORLD"; 20 FOR X = 1 TO 1000 : NEXT 30 GOTO 10

    and it would save on disk (and in memory) as:

    <line number:10> <token: PRINT> <string: HELLO WORLD;> <next-line: 20> <line number:20> <token: FOR> <number: 1> <token: TO> <number: 1000> <colon> <token: NEXT> <next-line: 30> <line number:30> <token: GOTO> <number: 10> <next-line: NULL>

    More or less. I'm sure I've forgotten some details. I'm not sure how the COLON was handled, for one.

  • (cs) in reply to WhiskeyJack
    WhiskeyJack:
    I can't remember, but I have a feeling AppleSoft would have broken GEORGE into GE OR GE and give you a ?SYNTAX ERROR. The solution would simply be to not have variable names that contain reserved keywords.
    Yep. AppleSoft only distinguished variables by their first two characters, anyway, so long variable names were discouraged in more ways than one. (You could have VARIABLE1 and VARIABLE2 but they would be the same internally. What fun!)

    In ProDOS you could type "NO MONSTERS ALLOWED" and it wouldn't give an error. (Although that was a trick of DOS and "NO MON C,I,O", not the BASIC interpreter.)

  • RBoy (unregistered) in reply to gurhall
    gurhall:
    DangerMouse9:
    Wouldn't copying it all and pasting it into a text document fix the spacing issues while trying to read through it?

    that way if a space on the compiler were say 1 pixel, but would be the full character size in a text editor you'd be able to read it and not wonder who the fuck Andy was.

    I honestly don't know whether to explain it to you or punch you.

    Me, I'm not sure if I want to punch them or hit them.

    What The Nibh Indeed!

  • (cs)

    Side note: What's the matter with having this article in new (?) section named Representative Line, but which is not present in "Content" sidebar?

  • (cs) in reply to DangerMouse9
    DangerMouse9:
    Snip fun stuff I wasn't implying pasting it into a text editor and then back into the compiler would fix the spacing. Snip more lol
    PLEASE let me know when you figure out how to paste text into the compiler, I need it for a project!
  • Inquiring Mind (unregistered) in reply to Andrew
    Andrew:
    Ken B:
    IFC=ZTH ("if (c==z) then")
    Given that THEN/TH is optional (according to the post), what if you have a "ZTH" variable? Is that "if ( c == z ) then" or "if (c == zth)"? Eww.

    My favorite is COBOL's "Either OR" syntax. I still don't know how they parse that!

    IF SALARY IS EQUAL TO 15005 OR 25000 THEN

    This means "Salary is equal to $15,005, or salary is equal to $25,000". Also, IS and TO are optional. It gets uglier with longer boolean expressions.

    I dunno, I seem to process this ok in English. What's the ambiguity?

    thx

  • Dr. Phil (unregistered) in reply to gurhall
    gurhall:
    DangerMouse9:
    Wouldn't copying it all and pasting it into a text document fix the spacing issues while trying to read through it?

    that way if a space on the compiler were say 1 pixel, but would be the full character size in a text editor you'd be able to read it and not wonder who the fuck Andy was.

    I honestly don't know whether to explain it to you or punch you.

    Got my vote for best thread of the day.

  • (cs) in reply to Inquiring Mind
    Inquiring Mind:
    Andrew:
    IF SALARY IS EQUAL TO 15005 OR 25000 THEN

    This means "Salary is equal to $15,005, or salary is equal to $25,000". Also, IS and TO are optional. It gets uglier with longer boolean expressions.

    I dunno, I seem to process this ok in English. What's the ambiguity?

    If A equals true or false then format drive.

    Is this (a == true) || (false) Or (a == true) || (a == false) ?

  • Bob (unregistered) in reply to Inquiring Mind
    Inquiring Mind:
    Andrew:
    Ken B:
    IFC=ZTH ("if (c==z) then")
    Given that THEN/TH is optional (according to the post), what if you have a "ZTH" variable? Is that "if ( c == z ) then" or "if (c == zth)"? Eww.

    My favorite is COBOL's "Either OR" syntax. I still don't know how they parse that!

    IF SALARY IS EQUAL TO 15005 OR 25000 THEN

    This means "Salary is equal to $15,005, or salary is equal to $25,000". Also, IS and TO are optional. It gets uglier with longer boolean expressions.

    I dunno, I seem to process this ok in English. What's the ambiguity?

    thx

    25000 could be interpreted as boolean True, so it always executes.

  • Stiggy (unregistered) in reply to Grimoire
    Grimoire:
    gurhall:
    DangerMouse9:
    Wouldn't copying it all and pasting it into a text document fix the spacing issues while trying to read through it?

    that way if a space on the compiler were say 1 pixel, but would be the full character size in a text editor you'd be able to read it and not wonder who the fuck Andy was.

    I honestly don't know whether to explain it to you or punch you.

    To avoid the hassle of a debate, I recommend you explain it to him while you punch him.

    New. Best. Comment. Ever.

    You, sir, made my day.

  • Dr. Phil (unregistered) in reply to Bob
    Bob:
    Inquiring Mind:
    Andrew:
    Ken B:
    IFC=ZTH ("if (c==z) then")
    Given that THEN/TH is optional (according to the post), what if you have a "ZTH" variable? Is that "if ( c == z ) then" or "if (c == zth)"? Eww.

    My favorite is COBOL's "Either OR" syntax. I still don't know how they parse that!

    IF SALARY IS EQUAL TO 15005 OR 25000 THEN

    This means "Salary is equal to $15,005, or salary is equal to $25,000". Also, IS and TO are optional. It gets uglier with longer boolean expressions.

    I dunno, I seem to process this ok in English. What's the ambiguity?

    thx

    25000 could be interpreted as boolean True, so it always executes.

    Gotcha.

    I couldn't remember anyone using a boolean keyword waybackwhen, so I looked it up on wiki and found that it was finally added to the language in 2002 or so. To be backward compatable, I imagine that you'd have to explicitly define a variable "25000" as boolean (or have a keyword) to allow logical operations as in the example...and I'll further imagine that the compiler will choke on trying to redefine a number.

    One of the design goals of COBOL was to make it as much like a natural language as possible, so it dragged along some of the assumptions from English. Along that line, I maintain that most people, presented with "IF SALARY IS EQUAL TO 15005 OR 25000", will do the appropriate mental conversion and realize we're talking arithmetic here.

    And, since it was also designed as a business language, the emphasis was on shlepping numbers back and forth. We did boolean operations, of course, but we had to roll our own, so to speak. We called them "flags" and a well-chosen var name made it obvious that the var was for logical operations, and not math.

    thx

  • Herby (unregistered) in reply to snoofle
    snoofle:
    david:
    Anyone old enough to have used FORTRAN IV should remember these: DO10I=1 is an assignment to the variable DO10I, whereas: DO10I=1,10 is the top of a loop where I iterates from 1 to 10. Of course, there can be continuation lines before the ','.

    10 FORMAT(I4, A4) looks like a format statement, until you see the continuation line *= 1 when it becomes an assignemnt to the two dimensional array FORMAT. (And neither of these variables need be declared any earlier).

    Oh did this bring back memories... Thank you
    While this is quite true, there were some versions of Fortran (WATFOR comes to mind) that treated the word 'FORMAT' as a reserved word (contrary to Fortran specifications!). In that case you couldn't get away with an array called 'FORMAT'.

    The fun begins when you have a statement like: if (1 .le. 0)END And the compiler stops. WTF's were common in Fortran shops!

  • Random832 (unregistered) in reply to Bob
    Bob:
    Inquiring Mind:
    Andrew:
    IF SALARY IS EQUAL TO 15005 OR 25000 THEN
    25000 could be interpreted as boolean True, so it always executes.
    Or it could be interpreted as 15005 bitwise or 25000: 31667
  • Michael (unregistered) in reply to Technical Thug
    Technical Thug:
    Applesoft stored programs as tokens. More or less. I'm sure I've forgotten some details. I'm not sure how the COLON was handled, for one.

    With frequent irrigation.

  • Tempura (unregistered) in reply to Technical Thug
    Technical Thug:
    Inquiring Mind:
    Andrew:
    IF SALARY IS EQUAL TO 15005 OR 25000 THEN

    This means "Salary is equal to $15,005, or salary is equal to $25,000". Also, IS and TO are optional. It gets uglier with longer boolean expressions.

    I dunno, I seem to process this ok in English. What's the ambiguity?

    If A equals true or false then format drive.

    Is this (a == true) || (false) Or (a == true) || (a == false) ?

    (a == (true || false))

  • (cs)

    I guess I do not possess the required context to understand this story properly so I'll just ask. Did Mark's job end quickly because:

    1. He deobfuscated the code quickly and wasn't needed anymore?

    2. He gave up because the problem was too hard?

    3. He gave up because the problem was too boring?

    4. He said f*ck in the office?

    I wouldn't have given up. I have to believe there are tools that would allow him to rewrite the code with modern styles. That is what he signed up for right?

    I would have fixed the program and also set a trap for the consultant to fall into fraud charges.

  • (cs)

    Well, I'm a Commodore 64 monkey, so obviously I immediately saw what the hell ANDY=NO meant.

    My own first encounter with this same problem was when I was trying to port some program that was written for some weird microcomputer. The code said "PISTEP..." and since the program was written in Finland ("piste" = "point" in Finnish) and it was doing something related to graphics, I assumed it was correct as it was.

    Obviously, it was wrong and was meant to be [FOR something TO] PI STEP... and it was failing because the original computer had "PI" and Spectravideo SVI-318 (to which I was porting this program to) had "π".

    In short, microcomputer BASICs were fun.

  • (cs) in reply to Tempura
    Tempura:
    Technical Thug:
    Andrew:
    IF SALARY IS EQUAL TO 15005 OR 25000 THEN

    This means "Salary is equal to $15,005, or salary is equal to $25,000".

    Is this (a == true) || (false) Or (a == true) || (a == false) ?
    (a == (true || false))
    Andrew clearly states what it means, i.e. how the COBOL compiler interprets it. What's the problem ?

  • (cs)

    Typing "REMEMBER THE ALAMO" does nothing in applesoft.

  • You-do-not-want-to-know (unregistered) in reply to DemonWasp
    DemonWasp:
    biziclop:
    ...Even a ten year old kid should be able to do it.

    Along that same line of thinking, you could just hire dozens of 10-year-olds at a low hourly wage to fix the code for you.

    Not a chance. They're all busy hacking the Pentagon or breaking content protection systems. They won't have time for a problem in BASIC.. You might get lucky with 8 year olds as they haven't touched any real programming language yet..

  • (cs) in reply to JamesQMurphy
    JamesQMurphy:
    masonreloaded:
    The real WTF is that they "retained" the old developer's services after he intentionally sabotaged their code...
    Agreed. The companies I worked for had me sign an agreement that says I wouldn't do this kind of stuff.

    Besides, doesn't the IRS frown on this type of arrangement? If you are a consultant but working for your former employer, I think they may still consider you "employed" for tax reasons. (I am not an accountant or tax specialist.)

    An agreement is really not needed. What the previous developer did was either directly illegal or, at the very least, asking for a lawsuit.

    And regarding tax reasons I don't think that would be the previous developers motivation. His motivation was like you go from making $x/hour as a developer for the company to making 5 times that as a "consultant"

  • (cs) in reply to WWWWolf
    WWWWolf:
    "π"
    Aargh! Look out! It's a charging rhinoceros!
    WWWWolf:
    In short, microcomputer BASICs were fun.
    Oh yes :)

Leave a comment on “ANDY=NO”

Log In or post as a guest

Replying to comment #:

« Return to Article