Saturday, April 29, 2006
For the love of code
A lot of programming is CRUD, create/read/update/delete -- the usual operations for business applications. A lot of programming is also crud -- ugly.
However, some programming is beautiful.
However, some programming is beautiful.
- Quines
- The Medium is the Message
- Spam Filtering
- Freedom of Speech
A quine is a source code listing which, when compiled and run, outputs... itself. Its self-referential aspect and the intellectual challenge of creating such a beast makes it a joy to create.
e.g., try the following LISP quine out at this online interpreter:
((lambda (x)
(list x (list (quote quote) x)))
(quote
(lambda (x)
(list x (list (quote quote) x)))))
Sometimes, programmers take the idea of programming as an artform too literally. Can you guess what code to display and allow a user to interact with a maze might look like? If you guessed something like this, you're right!
For years programmers tried to deal with spam filtering with a HUGE set of hand-crafted rules based on trial-and-error. These engines would run into the thousands of lines of code. In 2002, Paul Graham proposed a statistical approach to spam filtering.
Its engine? Included below.
(let ((prod (apply #'* probs))) (/ prod (+ prod (apply #'* (mapcar #'(lambda (x) (- 1 x)) probs)))))
There was a little bit of a kerfluffle in the world of computers in 2000. A Norwegian man wrote some code that broke the encryption of DVD videos, allowing them to be freely playable on non-licensed computers (e.g., computers with alternative operating systems). This also allowed people to make non-encrypted copies for backup and stealing to give away to their friends.
The small chunk of code, known as DeCSS, flew around the world. The United States of America moved to quash the reproduction and sharing of this code as it violated the Digital Millennium Copyright Act's provisions that no one should try to circumvent copyright systems. Surprisingly, hackers obeyed -- they didn't share the original source code. Instead, they shared this version, this version, this version, and this version.
To be fair, these last four links are still all code. Surely, they too must be in violation of the DMCA?
But what about this -- a haiku which intermingles a poetic description of the decryption procedure with analysis of the ongoing legal problems?
What about a song describing the procedure?
What about a melody, created by mapping the characters of the decrypt function onto musical notes?
(All resources shamelessly stolen from here.)
Isn't this one good looking llama?
He just looks so damned content. Clearly, he's a worldly llama, too -- this is the standard tourist-in-front-of-impressive-landmark picture seen everywhere. If he were in Maui, he'd have a gorgeous lei on his neck and a pina colada nestled between his forelegs.
Click for larger version.
Click for larger version.
Wednesday, April 26, 2006
WatPubs
Waterloo people heading out of town for the summer: Sign up for WatPubs!
It's basically a convenient way for someone to organize social opportunities for interested students. I'm the WatPub co-ordinator (I think...) for Redmond for summer 2006 - so especially if you're working for MS or Amazon, sign up!
It's basically a convenient way for someone to organize social opportunities for interested students. I'm the WatPub co-ordinator (I think...) for Redmond for summer 2006 - so especially if you're working for MS or Amazon, sign up!
Thursday, April 20, 2006
3A is over!
Yay! With CS457's exam done, 3A is finally over and it's time to pack up and head for home.
Note - a course where 1/3 of the students fail the midterm is a good course. It means the final exam has questions like: "For 16%, is 10 less than 14?"
Note - a course where 1/3 of the students fail the midterm is a good course. It means the final exam has questions like: "For 16%, is 10 less than 14?"
Tuesday, April 18, 2006
Immigration papers
My immigration papers came today.
I was relieved to see the USA possesses the full complement of alphabetic bureaucratic crap. I'm the proud owner of a J-1 visa, complete with the DS-2019, G-28, I-94 and I-901 forms to prove it.
I was relieved to see the USA possesses the full complement of alphabetic bureaucratic crap. I'm the proud owner of a J-1 visa, complete with the DS-2019, G-28, I-94 and I-901 forms to prove it.
Tuesday, April 04, 2006
Microsoft internship
So I'll be working in the Office Shared Services group. Part of this group's mandate is the Error Reporting features you see in Microsoft products (Oops -- your computer crapped itself! Shall we yell at people at Microsoft for you?)
I sure hope I'm not working on testing the new Error Reporting features: http://www.metacafe.com/watch/88657/share_the_pain/
I sure hope I'm not working on testing the new Error Reporting features: http://www.metacafe.com/watch/88657/share_the_pain/
User interfaces -- making Windows suck less
Windows sucks. Don't get me wrong, all the other OSes suck, too.
Why? Let's talk about MOOs. They were invented 16 years ago by Pavel Curtis in a research laboratory. To give you some historical context, this was just before Windows 3.0 was released. Linux was yet to be created; MacOS was sitting at System 7. MacOS 7 and Windows 3.0 sucked - they were largely static beasts with little ability to configure them and make them react intelligently to the user.
MOOs, on the other hand, were amazing beasts. A MOO is a virtual world on the Internet, divided into rooms and populated with people and the objects they create. Forget MSN Messenger -- just use the in-MOO paging system. Forget e-mail and mailing lists -- just use the in-MOO mailing system.
But what I think was truly the drawing point of MOOs for many of us was the control over your environment that they offered.
Want to be in more than one place at once? Code up some minions to park themselves in other rooms and provide a two-way communications link. Need discretion? Code up some detection countermeasures -- but don't get caught, as "bugging" rooms is usually grounds for excommunication from the virtual society.
Do you find yourself frequently chatting to the same people? Screw typing repetitive commands over and over again -- bang out some code to have the system remember your last contacts and redirect conversations accordingly. Not interested in hearing what one person has to say? Rewrite your communications code to throw everything they send your way into the garbage can.
So what does this have to do with user interfaces in the context of Windows and its friends? Well, as I've said, MOOs let you mediate your reality and pretty much every MOOer with a programmer flag had custom routines to interact with their virtual world. They could do this because they had the confidence that when they logged in, regardless of whether or not they came from school, home or an Internet cafe, they would have the same commands available to them. The benefits of customizing your reality are limited if you can't get consistency -- indeed, one of the punishments of the virtual society was not banishment from the realm, but rather temporary banishment from your character and its customizations.
Windows, 16 years later, can't offer me this. When I'm working on code and need to switch computers, not only do I lose the environment I have customized and launched, but sometimes I lose access to the underlying tools themselves!
Why can't I take a snapshot of my computer -- including what applications are open, where windows are positioned -- and then transfer it to another computer? Hell, why can't I define certain contexts, and switch amongst them while working? e.g. a banking context (launch Firefox and log in to TD and RBC); a CS assignment context (load up my editors, connect to the UNIX terminal servers, load up any reference docs I had open).
Hey, why can't I define contexts on the fly as tasks come to me? Relevant examples lately in my life:
Within this context, I can track my ongoing tasks very easily and switch between them effortlessly by calling up their contexts. When there's no work left to be done in a context, delete it. Simple as that!
I'm currently coding up a set up programs that provide this basic functionality -- and that can reside on a USB key, thus allowing me to have my contexts accessible to me on any Windows XP computer.
Why? Let's talk about MOOs. They were invented 16 years ago by Pavel Curtis in a research laboratory. To give you some historical context, this was just before Windows 3.0 was released. Linux was yet to be created; MacOS was sitting at System 7. MacOS 7 and Windows 3.0 sucked - they were largely static beasts with little ability to configure them and make them react intelligently to the user.
MOOs, on the other hand, were amazing beasts. A MOO is a virtual world on the Internet, divided into rooms and populated with people and the objects they create. Forget MSN Messenger -- just use the in-MOO paging system. Forget e-mail and mailing lists -- just use the in-MOO mailing system.
But what I think was truly the drawing point of MOOs for many of us was the control over your environment that they offered.
Want to be in more than one place at once? Code up some minions to park themselves in other rooms and provide a two-way communications link. Need discretion? Code up some detection countermeasures -- but don't get caught, as "bugging" rooms is usually grounds for excommunication from the virtual society.
Do you find yourself frequently chatting to the same people? Screw typing repetitive commands over and over again -- bang out some code to have the system remember your last contacts and redirect conversations accordingly. Not interested in hearing what one person has to say? Rewrite your communications code to throw everything they send your way into the garbage can.
So what does this have to do with user interfaces in the context of Windows and its friends? Well, as I've said, MOOs let you mediate your reality and pretty much every MOOer with a programmer flag had custom routines to interact with their virtual world. They could do this because they had the confidence that when they logged in, regardless of whether or not they came from school, home or an Internet cafe, they would have the same commands available to them. The benefits of customizing your reality are limited if you can't get consistency -- indeed, one of the punishments of the virtual society was not banishment from the realm, but rather temporary banishment from your character and its customizations.
Windows, 16 years later, can't offer me this. When I'm working on code and need to switch computers, not only do I lose the environment I have customized and launched, but sometimes I lose access to the underlying tools themselves!
Why can't I take a snapshot of my computer -- including what applications are open, where windows are positioned -- and then transfer it to another computer? Hell, why can't I define certain contexts, and switch amongst them while working? e.g. a banking context (launch Firefox and log in to TD and RBC); a CS assignment context (load up my editors, connect to the UNIX terminal servers, load up any reference docs I had open).
Hey, why can't I define contexts on the fly as tasks come to me? Relevant examples lately in my life:
- Apartment search in Redmond - including websites about Microsoft housing benefits, apartment complexes in Redmond, Gmail virtual folder including all correspondence, notepad with notes about deadlines and next steps
- Finalizing Microsoft intern contracts - documents to be filled out and faxed, important contacts at Microsoft, receipts that I will need to get reimbursed in a month's time
Within this context, I can track my ongoing tasks very easily and switch between them effortlessly by calling up their contexts. When there's no work left to be done in a context, delete it. Simple as that!
I'm currently coding up a set up programs that provide this basic functionality -- and that can reside on a USB key, thus allowing me to have my contexts accessible to me on any Windows XP computer.