Thursday, November 30, 2006
Bjarne Stroustrup interview
Why's this article interesting? From the subtitle: "the inventor of the C++ programming language, defends his legacy and examines what's wrong with most software code."
Every few weeks there'll be a flare up of the old C/C++-vs-Managed-Code argument on the programming lists at work. It's certainly true that C and C++ both let you shoot yourself in the foot easily (and have nice exploitable security bugs in your code, such as buffer-overflows), but C++ also has the added tendency to introduce really nasty, hard-to-track-down bugs when you don't really understand what's happening under the covers. As long as you know exactly what you and the compiler, and the standard libraries (if you use them) are doing, you'll be fine.
C#/managed code generally isolate you from the nasty details of what's happening under the covers (at least, if you just use managed code and don't need to interoperate with native code). You don't need to worry about the difference between a container of objects and a container of pointers. No smart pointers to use or not use. And generally great built-in standard libraries.
Although I am not a C# and managed code expert, my take (and most other peoples) is that they're definitely a move in the right direction in terms of preventing stupid bugs from having security impacts. No more BO's and memory-management woes. Managed code is not automatically free from security bugs though...
Just 'coz it's green, doesn't make it guacamole
Shocked! Shocked, I am!http://seattletimes.nwsource.com/html/nationworld/2003454425_guacamole30.html Kraft guacamole is essentially a whipped paste made from partially hydrogenated soybean and coconut oils, corn syrup, whey, and food starch. Yellow and blue dyes give it the guacamole green color.
If you've ever tasted Kraft guacamole and real guacamole (or even just real avocado), you'd know it has barely a passing resemblance to the real thing. More like green cream-cheesey-type-stuff. The lawsuit is silly, but hopefully this will encourage more people to RTFIL (Read The Flaming Ingredients List).
For better pre-made guac, I heart Trader Joe's. As usual, they had some fun naming their's and called it Avocado's Number. From this article:
This dip pays homage to you mathe-magicians out there; the name is a play on Avogadro's number. As the label says, "Admittedly, there aren't 6.0221367 x 10^23 avocados in here, but 5 plus avo's isn't bad!" At $2.99 apiece, this godsend of modern grocery goodness costs less than if you bought the five avocados fresh.
My favourite guac from TJ's, though, is the one with fire-roasted tomatoes on top.
Tuesday, November 28, 2006
Darn, Steph got the easy test!
See how well you do on questions from the current test here. (Uh-oh... I only got 35%)
Disposable email addresses
As the name indicates, your 10-Minute-Mail account is only valid for 10 minutes (you can extend this if needed). That is normally plenty time to validate the address. There are two big disadvantages with this system, though:
- Sometimes you may actually want to get email from the online service, for example if you forget your password and they email you a new one. I don't know if 10-Minute-Mail lets you re-activate an email address when you know it is about to receive email you want to read?
- The email address generated is not very easy to remember (e.g. mail44901@10minutemail.com). If your email address is your sign-in/account name, you're stuck remembering a seperate, cryptic email for each service.
An alternative is http://www.dodgeit.com/, which provides free, receive-only email accounts. You can choose the address (good), and subscribe to a RSS feed to get notified when new mail arrives (nice). A slight downside is that since everyone shares the @dodgeit.com domain, you probably won't be able to get bob@dodgeit.com or amazon@dodgeit.com.
A solution that myself and a few friends use requires having your own domain (quite cheap), and having the domain set up to allow "catch-all" email forwarding. The way this works is that any email received by you domain that doesn't match a real account is forwarded to a real email address you specify (and that no-one can see publicly).
So, if you are signing up with CoolNewStuff.com, you could use an email address of CoolNewStuff@mydomain.com. Then, the few initial emails you get from CoolNewStuff.com would be sent to your real address. If at some point you start getting spam sent to this email address, you can filter it out easily.
Why not just use a single fake email address for all your online services? So that you can figure out who to blame if your account starts getting spam (usually this means the company sold your information, is spamming themselves, or has been hacked).
Winter is here!
First we had record rainfalls and flooding, now an arctic storm has dumped several inches of snow around the Puget Sound and left the streets treacherously icy. I worked from home today and took a stroll at lunch-time to enjoy the sunshine. Despite being clear and sunny, the peak temperature today was in the low 20's F.
Here are some pics:
A patch of thick ice that had been broken up into chunks by a car
A snow-covered tree
The outside of our house
It looks like it we're in one or two more nights of below-freezing temperatures (which should make the morning commutes interesting), and maybe even more snow tomorrow night.
In the meantime, my mostly-snow-capable car (a Subaru) is stuck in the garage with a smashed rear windshield*, so I've been taking the bus to work for the past few days. With a bit of luck the windshield will be replaced on Thursday and I will be more mobile come rain, sleet or snow.
(* I parked outside a house near Cafe Flora and got a rock thrown through the window by a lawnmower... Lucky me!)
Thursday, November 23, 2006
Lillet, Kina Lillet...
From this article on IOL, it looks like the new James Bond film has caused increased interest in Lillet.
On-screen Bonds have usually ordered a "vodka martini - shaken, not stirred". But in Casino Royale, which premiered earlier this month, actor Daniel Craig lists Bordeaux aperitif Lillet as an ingredient of the spy's favourite tipple."Three measures of Gordon's (gin), one of vodka, half a measure of Kina Lillet, shake it over ice then add a thin slice of lemon peel," Bond asks a waiter as he duels with his adversary in a high-stakes game of poker.
That repeat of the recipe from Ian Fleming's first Bond novel has prompted viewers to contact the firm, which has just seven staff and has dropped the word Kina from its name.
Wednesday, November 22, 2006
More on Allegro
It turns out that the creator of Allegro, Shawn Hargreaves, is now at Microsoft and has a blog.
He works on XNA Game Studio Express which looks quite interesting. Read his introductory blog post here, and there's lots more info on XNA on his blog.
Bits and bobs
From the girls-you-ought-to-know-about department:
- CNet has published a list of the top 10 girl geeks throughout history. Someone must have been sitting on their brains when they compiled the list, since Paris Hilton is included. I was also surprised to see Daryl Hannah, but she actually sounds far geekier than I gave her creditfor. (Liebrary, a game she co-created, sounds like fun). Who would you like to see on this list?
From the I-can't-believe-I-missed-this department:
- The Decemberists played at the Paramount on the 17th of November. The Seattle Times has a glowing review. I need to hear/purchase their new album, The Crane Wife. Got that, Santa?
- Prime Suspect 7 was recently aired on PBS. Now I need to wait for the DVD to be released (or pray for a repeat broadcast).
From the funny-stuff-that-will-offend-someone department:
- Wolverine_nun had a link to this Harry Enfield video on YouTube: "Women, Know Your Limits". There's a lot of other good stuff from him on YouTube - all of it new to me. I'd heard of Spitting Image (which he did voices for), but otherwise not seen him before. Other triva from his Wikipedia entry: He was the first guest on BBC's Top Gear in 2002.
From the penny-stocks-and-sexy-pills department:
- EWeek has a good article describing the link between botnets and the recent surge in spam. It's sobering to see that almost 50% of the infected hosts are running XP SP2 - despite all the security improvements Microsoft made. Vista will fare much better, I'm sure, but it will take a good many years to get those SP2 machines retired/upgraded.
Monday, November 20, 2006
New RSS feed
http://beta.blogger.com/feeds/11494708/posts/default?alt=rss
If you notice bogus dates (1/1/2006) for all new posts, then please switch to the above feed.
Best use of a "Tears for Fears" song in advertising
PS: The game's website is pretty cool - scary, though.
The song is "Mad World", Tears for Fears' debut single. The version used in the advert is a cover by Gary Jules. It originally appeared at the end of the movie Donnie Darko. (Which I still need to see).
I was a huge Tears for Fears fan growing up - the first album of theirs I bought was "The Seeds of Love" and I loved listening to the "set" of 4 songs that flow together. After their breakup, they disappeared until "Tears Roll Down" came out in '92 (Orzabal was basically a solo artist using the Tears for Fears name still).
The next two albums ("Elemental" and "Raoul and the Kings of Spain") didn't make much of an impression on me. Orzabal and Smith finally reunited and released a new album in 2004 ("Everybody Loves a Happy Ending") which I've listened to a few times but didn't really love. Perhaps I've just outgrown my earlier tastes?
Saturday, November 18, 2006
Scrabble: Man vs. Machine
Jim said:
...it was a victory that he wouldn't expect five years from now. The computer programs will be much more sophisticated, he said. "They'll just have much more brute force."
I'm not sure how much stronger Scrabble games will be in 5 years - Scrabble is a fairly simple game for computers to play (unlike, say, Go). The mechanics of the game have documented algorithms that can be used (Appel & Jacobson's "The world's fastest Scrabble program", for example). The tricky bit is the strategy - often playing the highest-scoring move will not ensure a win against a strong human opponent.
This is the algorithm I implemented for fun many years back when I was in university (as a hobby). The project was really fun and had some interesting challenges, the first of which was filling in the few gaps in the above paper so that the algorithm was clear. Other fun things (at least they seemed fun to me at the time):
- Where to get words from? The most essential part of a Scrabble game is having a good list of words - they should be legal Scrabble words of course. I found a few free word lists online and used them, but had to try to prune out invalid words (proper nouns, acronyms). Eventually I found a nice OWL/OSW word list (I think it was 2-8 letter words) and augmented that with some longer words from my other source. I think in the end I had 130,000+ words.
- Storing the dictionary in a file. The naive solution is to use a big text file. The program would then read this in and build a DAWG ("directed acyclic word graph" incase you care) for use when searching for words. However this was slow, and the file was huge. So, I started playing with ways to build the DAWG once, and save it as a binary file that was smaller and could be loaded quickly.
- Compressing the dictionary. It turns out that there is a lot of redundancy in English words, and the DAWG has lots of sub-graphs that are redundant. This means wasted space on the disk (not such a big deal) and wasted memory (more of a big deal). I was coding all this in C/C++ and DJGPP (a free 32-bit compiler and port of the GNU C libraries). This meant I could use more than 640kb in DOS/Windows, but my home machine was not that beefy. (It was a 486SX with 4MB of RAM if I remember right). So, the huge dictionary I was using actually had problems fitting into memory unless I reduced it's size somehow. The solution was to look for the redundant parts of the DAWG and "fold them" onto themselves. Finding matches for sub-graphs was fun, and I had many iterations of my "dictionary builder and packer" tool. Initially it would take an overnight run for it to produce the final output file, but in the end it did its job in an hour or so! :)
- Graphics. Since the DJGPP compiler and libraries I was using were pretty basic, I didn't have fancy Windows-style graphics I could use (no menus, windows, etc.) I used the fantastic free graphics library Allegro instead. This still meant I had to cobble together my own menus and code to handle the placement of Scrabble tiles. I also had a feature that would let you ask the computer for "hints". It would basically figure out all the possible moves you could make, and sort them in descending score. You could then drag a scrollbar and flip through all the possible words - really quickly.
- Strategy. I left this to last and never really did anything wonderful (by this stage I was ready to move on to something else...) My game simply chose the highest-scoring move it could find and played that... It was still pretty hard to beat.
Sadly, the code to my Scrabble game disappeared when I upgraded to a new machine (stupid me for not having enough backups)!
Thursday, November 16, 2006
New York trip
We managed to fit in most of the big touristy attractions - Times Square, a ferry ride to Staten Island to see the Statue of Liberty, Grand Central Station, Central Park, Wall Street, Chinatown, Little Italy, SOHO, and even a bit of Harlem. We did a LOT of walking, which was actually great (I'm always amazed at how good I feel after a "walking vacation" - like when we visited San Francisco). This is probably more a sad testament to the lack of exercise I get normally, but my legs feel noticeably stronger and fitter after a few days walking around a new city.
We rode the metro a fair deal - the $7 day use passes are great if you know you'll be doing a few trips on the subway, and the stations are sprinkled around pretty regularly so that you can easily pop around and see the whole Island easily. The subways itself is defintely a little old and funky - bad smells, vagrants and the odd loonie are not out of place. It's also HOT - even in November. (We were were blessed with mostly good weather during our trip and only had rain for one day). I wonder what the subway will look like in 50 year's time - it will probably need a major overhaul at some point.
Sadly we didn't get to do some things I would have liked (plenty to do next time we visit). Some items still on the to-do list are: Visit Ellis Island's museum, the Metropolitan Museum of Art, Bronx Zoo, Brooklyn, go up the Empire State building, see a taping of The Daily Show (hey - it would be cool!), see a show or two, go inside the public library, do more window shopping in the insanely expensive fashion, jewellery, etc. stores, eat out in some of veg*n restaurants in the city (and maybe try Nobu or some of the other famous fancy restaurants).
Phew, that's a long list. So, what sticks out as a the best bit of our past trip?
- The Staten Island ferry ride. The view of the Statue of Liberty (SoL) is great, the ferry moves like a NY taxi cab (ZOOM out of the ferry terminal). The SoL actually looked smaller than I imagined it would - it's not terribly tall, and its fame and reputation as an icon of freedom make you think it will on the scale of Mt Rainier :)
- A great food find. After roaming around, we ended up in NOHO outside the Corner Shop (Citysearch). This is funky little bistro/cafe with a modern flair. They serve brunch, lunch and dinner, and the service was great. Their food is also very nice - nothing too fancy and pretentious, but all interesting, often organic, and nicely prepared. I had steamed mussels with crusty bread, Belgian beer, and a tuna burger with "provençal fries" (Mmm... Garlic!) They had lots of veg*n options for A and the rest of the group. They advertise the "best cookies in NYC" on their menu - something to try next time - we'll defintely be back!
- Yummy cannoli. Billed as the best on Little Italy, I'd believe it! (Sadly I don't remember the name of the place, with some sleuthing I might be able to figure it out...)
Lowlight:
- Diva (Citysearch) missed the mark with their crappy service and by trying to rip us off. (See A's review on Citysearch for details). Avoid!
Wednesday, November 15, 2006
Coco La Ti Da
I heard a teaser for the local radio show The Works which aired last night, and features a segment on Sue's new restaurant. You can listen to it here, skip to around 14:45 to hear the bit about Coco La Ti Da.
Harvey Manning
I was sad to hear that Harvey Manning died on Sunday, aged 81. He was the Seattle hiking and nature conservation hero. He wrote loads of hiking books along with Ira Spring, and I quickly discovered their books after coming here seven years ago. I've relied on these books so often I can't imagine life here without them, and am deeply grateful for the forests and trails that have been preserved as a result of his hard work.
From his Wikipedia entry I see that he did a 2-year hike around the shoreline of the Puget Sound and wrote an autobiography detailing the trip. Something to get out of the library for sure...
Tuesday, November 14, 2006
Back from NY
In other news, I am tickled pink to see that CookSister linked to me! Woohoo! Now I feel pressured to write more often (and write more creatively, as she has done so often).
I've also moved to the new Blogger Beta, which (finally!) includes tag support - hopefuuly from now on you can search for food, wine, beer or other topics that interest you. (I used Technorati tags for a while, but got tired of manually entering them).
Friday, November 03, 2006
Is your moustache or beard stealing your beer?
Are stout drinkers more inclined to grow a moustache than non-stout drinkers? What about beards? Are long-bearded predisposed to drink stout than others? I ask as apparently 162,719 pints of Guinness are lost in stout drinker's moustaches and beards every year. Seems an awfully exact number
Thursday, November 02, 2006
Sê "tata" vir die Groot Krokodil
(= The Big Crocodile, one of PW Botha's nicknames).
The Independant Online has an excellent article detailing PW Botha's life:
A leader who was ruled by his fearsome temper
People in SA are divided over his legacy and whether to give him a state funeral.