- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
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.
Admin
That's not a good prize!
Admin
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.
Admin
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.
Admin
captcha: appellatio - English for where that pink salt comes from.
Admin
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.
Admin
No DangerMouse, you need to paste it into a word document and convert it to helvetica italic.
Admin
That is wrong on so many levels! But it's still funny. :)
Admin
I starting to write a comment but deciding to make fun of grammar instead.
Admin
I didn't realize that the two were mutually exclusive...
Admin
Admin
I meant making fun of grammar as opposed to writing a comment about the WTF.
Admin
How do you pronounce "f*ck?"
Admin
fuh-star-kuh
Admin
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.
Admin
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.
Admin
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.
Admin
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...
Admin
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.)
Admin
"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.
Admin
That's what lex would do for you. But only if you know regular expressions ;)
Admin
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...
Admin
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).
Admin
Admin
It gives me a new motto for the day: Just Say No to Andy.
Admin
They were using BASIC. What's the point of your question?
Admin
Admin
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).
Admin
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.
Admin
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.)
Admin
Me, I'm not sure if I want to punch them or hit them.
What The Nibh Indeed!
Admin
Side note: What's the matter with having this article in new (?) section named Representative Line, but which is not present in "Content" sidebar?
Admin
Admin
I dunno, I seem to process this ok in English. What's the ambiguity?
thx
Admin
Got my vote for best thread of the day.
Admin
If A equals true or false then format drive.
Is this (a == true) || (false) Or (a == true) || (a == false) ?
Admin
25000 could be interpreted as boolean True, so it always executes.
Admin
New. Best. Comment. Ever.
You, sir, made my day.
Admin
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
Admin
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!
Admin
Admin
With frequent irrigation.
Admin
(a == (true || false))
Admin
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:
He deobfuscated the code quickly and wasn't needed anymore?
He gave up because the problem was too hard?
He gave up because the problem was too boring?
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.
Admin
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.
Admin
Admin
Typing "REMEMBER THE ALAMO" does nothing in applesoft.
Admin
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..
Admin
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"
Admin