Monday, December 31, 2007

Posting from New Account

I'm testing posting from another Google account.

Your U.N.C.L.E. on DVD!!!!!


Outstanding news!! Time Life now has the first season of The Man from U.N.C.L.E. (1964--65) on DVD!

The first season includes the Project Strigas Affair, which featured guest stars William Shatner and Leonard Nimoy!

Friday, December 14, 2007

SimpleDB

Noted in Michael's Google Chat status: SimpleDB.

Very interesting.

Tuesday, December 04, 2007

Spam Trap

Fascinating! From Slashdot, an article on a new type of spam detection in
Abaca's new filtering techology that bases detection on a computed reputation of recipients rather than email content or the sender.

Monday, December 03, 2007

Python Differences

Okay, here's a list of things that are different in Python that one may as well get used to. I think that most of these weren't immediately obvious to me, rather, I had to pick up on them after a bit of time.

Everything is by reference

All variable assignments are by reference, i.e., they copy the address and never copy the values. If a and b are arrays, a = b, does not copy the array as in Perl. Now a is a reference to the same array as b. Of course for scalar values, this does copy the value so to state things more precisely (i.e., correctly): Every variable is a scalar which is a simple scalar value or a reference to anything more complex than a scalar.

When you do want to make copies of something like an array, you need to import copy and use that module.

Learn the way of the %

Gone are the days of simple print statements and simple comma separated lists in print statements. Python brings us back to the days of printf for everything.

The format is something like '%, %s!' % ('Hello', 'World') or 'The answer is: %d' % x. Okay, granted no printf-like function is required, but % is an infix operator. (That in itself is an interesting departure for a language that uses functions and methods for a lot of operations). I didn't realize this at first, but simply plan to use this feature all the time! That means any time you deal with building strings. However, you can use the + to concatenate strings.

This is a side-effect of Python not having an indicator on variables such as $var in Perl. You can't simply say print "Hello $place!" in Python, because there's no $ to say that place is a variable, so you have to say print 'Hello %s!' % place. If you try print 'Hello ', place, '!' it won't be quite what you expect because Python adds an annoying space for every comma in a print statement.

Does this meet Python's goal of being “clean?” Hmm...

The main point here is that I had to make the shift from thinking % was a way to do things to realizing it is the way.

Quoting

The first thing you realize is that, because there are no variables like $var, there's no real difference between single and double quotes. The typical reason for using one is that you want to have literal instances of the other inside. For example, "Now here's a string." or 'Add the word "please" to your request.'

Then, later you realize that symbols like \n really are interpreted in both types of quotes and, in fact, you have to use the raw indication by prepending a letter r, r'print this \n literally.', to not interpret special symbols.

Everything has to be initialized

I can't complain about this one, but there's no automatic initialization of anything. The Pyton dict is the equivalent of a Perl hash. In Python, you can't access an element of a dict unless it's been initialized, even if to the value None (which is Python's equivalent to NULL or undef). This means that, in what should be a relatively simple loop, you always have to test for existence and add a clause to initialize if necessary.

Similarly, you can't use a simple variable before initialzing it.

The end result is that Python always forces you to be rather serious about programming and doesn't allow the same ability to dash of a useful expression the way Perl does. It's a philosophical difference that I can't argue about either way, however I do miss the latter sometimes. Well, okay, one doesn't really miss the latter, one simply switches back to Perl.

Saturday, December 01, 2007

Colleges Outsourcing Email to Gmail, MS

This Slashdot article on college oursourcing to Gmail and MS Live hits the topic spot on and covers it well. It's a highly-recommended read!

I have a couple of comments.

Worrying about privacy in the realm of email is nuts. People just don't get what email is. It's probably already crossed the Internet in the clear! For real ways to address these issues see my discussion of alternative email ideas.

Too late! I've already forgotten the second comment.

Blackberry Curve

Okay I have a Blackberry Curve 8320 and I'm now fully on the bandwagon. Blast it all…

P.S. I use the downloaded Gmail client for email.