Archive for the ‘Monologue’ Category.

Mission Accomplished

So, I was home tonight and I got my little script working in Squeak this evening.

Two things:

  1. I didn’t need to do authentication. I misread the API docs. Also, an MD5 class is available in the Cryptography package
  2. Mark Baker is right, the Flickr API could be improved. In particular, it would be a lot simpler if flickr.photoset.getPhotos returns the URLs to the photos, instead of a PhotoID.

The reason why an intermediate PhotoID step is required is because each photo can be in many different sizes. So a subsequent call to is needed to get the URLs. I think it wouldn’t be a bad idea to add an optional argument to photoset.getPhotos to specify the desired photo size. That way, I only need to do 1 call instead of n + 1 calls, which takes quite a long time to run.

One thing that is really nice when working with Squeak is the automatic object persistence. As I was running my script, my home network had a hiccup and somehow the script stopped. Instead of restarting the download scratch, I was able to inspect the state of the download and add a new method to resume it.

The code is pretty crufty right now, but I might spend a little time to clean it up. Ideally, I’ll be aiming for an API like this:

FlickrClient new

  downloadSet: setID

  key: apiKey

  to: directoryName.

REST is not so easy either

This afternoon, I was browsing through some photosets on Flickr, but the photos weren’t loading quickly. I thought to myself, why don’t I download them now and go through them later?

, but I couldn’t find a link to download a photoset.

I remembered that Flickr has an API, so I can write something myself to do it. It shouldn’t take long, maybe an hour, max. From their services page, I saw Ruby implementations. Even better, I thought, I’ll use that.

I started with flickr.rb, but immediately I hit my first setback.

It offered me a gems file. Flipping through my Pickaxe book, I see that RubyGems is the preferred way for installing Ruby modules. Sounds good, but Ubuntu doesn’t come with RubyGems, probably because it “clashes” with apt. After 10 minutes of looking around, I gave up on using Gems and downloaded the source directly.

I went back to my book to make sure I was including the library correctly and hit another setback. Flickr.rb requires xmlsimple, something akin to Perl’s XML::Simple module. I searched Ubuntu’s repos, but they don’t have it. I downloaded the tarball, built and installed it. That took another 10 minutes.

Let’s start cooking. But before that, I needed to get an API key to use the service. Ten minutes later, I got the magic key.

I got back into emacs and started reading the included samples. It looks pretty easy. I wrote something simple to test it:

f =
user = f.users('some user') do |photo|

puts photo.url

It was slow and the URL is wrong, but I got something back. I wrote more code for going filtering through the photos from a user’s photoset. I ran it again, but I got nothing. I added some more lines for debugging and saw that it wasn’t returning any of the photos at all. In fact, the binding to flickr.photosets.getPhotos is actually marked as incomplete. Sigh. I tried to see if I can implement it myself. I tried to switch to the other Ruby implementation but the docs are even thinner. I took a brief look at the Python ones and they didn’t seem so hot either.

However, the API Explorer did work and the URL requests really are quite simple. So I decided to write my own implementation in Squeak, because I know Smalltalk better than I do Python or Ruby. I defined a class and started writing methods. I noticed I need to authenticate before I can make any calls. I followed the instructions and began to write a method to handle it.

Except I couldn’t find a method for doing MD5 sums. I asked on the IRC channel, they (basically) told me to file a bug.

By now, I was pretty pissed off. What was supposed to take 30 mins ended up taking an afternoon, and I still didn’t have anything usable. I really didn’t care much about the photos at this point.

Lately, I have been going back to the SOAP and WS-* specs and re-reading them. The last time I read WS-Addressing was before it got accepted into the W3c. Of course, SOAP is complicated and the discussions on EndpointReferences vs. URIs go on endlessly, but I just can’t help but think that grabbing a WSDL of a service and pumping it through ASP.NET Web Services (or better yet, Indigo) is easier than what I had (not) achieved this afternoon in trying to use the Flickr API.

Someone told me there’s a Flickr.NET. I’ll try it when I feel less pissed off about this whole thing. Heck, it might even work.

Visual Studio Beta2 fixed

Trying to fix my Visual Studio installation

Roberto Garza posted a comment on my earlier post with possible solutions to the bugs I’m experiencing with my Beta-2 install. He said,

  1. What you need to do is reset the vc# user settings. Just go to tools->import export options and check reset all settings.
  2. About the designer package, try repairing the .net framework install from add remove programs, that worked for me.

I followed those two advices, but things are still broken for me. In particular, I couldn’t reset my settings, when I try to load that dialog, I get a error message stating: “Package ‘Visual Studio VsSettings Package’ has failed to load properly.”

But, maybe they will work for some other people. Feedback welcome.

Bugs in Whidbey Beta2

I woke up this morning and saw that Whidbey beta2 finally came out. Got out of bed, brushed my teeth and started a download on my Windows box. It started off slow enough, at 2 KB / sec, but I got Visual C# Express downloaded by the time I came home from brunch.

Update: Before installing Beta-2, I did have Beta-1 installed. I removed Beta-1 (Fx framework, Visual C# Express and MSDN Library Express), but didn’t restart my machine before installing Beta-2.

So far, the release seems a little rough. I think my recollection of beta-1 is that beta-1 felt more polished than this.

Here are the bugs that I’ve encountered so far:

  1. The start page didn’t get distributed. Instead of the welcome screen, the usual IE 404 screen comes up.
  2. There is some loading bug with the “Visual Studio Explorers and Designers Package”. It gets triggered when I try to change my default font.

Screenshot of Visual C# Express

I’ll add more to this list if I find more problems. I’ll also add links to fixes when I see them.

A nice quote from Guy Steele

Maybe Bluetooth could be useful afterall…

I have been using Synergy to share the keyboard and mouse between my Linux desktop and Windows laptop for quite a while. Occasionally, I bring my Linux laptop over and I want to use the shared keyboard with my Linux laptop as well.

I wrote a little ruby script (cuz I can’t really write shell scripts) and bound it to a panel launcher, to use for toggling whether to turn on synergy or not. If I have more time and energy, I guess I can install the Ruby-GNOME bindings and make a little panel applet or tray icon.

But then this idea just hit me.

If I have bluetooth on all my machines, then I can use bluetooth to find out the proximity of my laptop from other devices. If everything is all setup to go, then I should be able to write an event handler to automatically turn on keyboard sharing whenever the machine is n units

away from my desktop and automatically turn it off when I bring my laptop elsewhere.

Wouldn’t that be grand?

Books I am reading

I got a lot

of new books recently. I’m trying to read:

So far, I have only finished Blink (it was an audiobook, too). I’ve read bits of Beck’s book, and it’s awesome

. I’ve also been flipping through Programming Ruby, which is going okay. I started using ruby to write some scripts for work. I am also 2 chapters in Gelernter’s HtWPP.

Next on my queue is Brad Cox’s OOP book, as well as Transaction Processing by Newcomer.

For fun, I hope to read The Curious Incident of the Dog in the Night-Time, they say it’s great fun. I heard an interview with the author sometime last semester, and got the book before Christmas, I really ought to read it now.

Tomorrow is the last day of Spring Break.

An Update from Me

Haven’t been writing for quite a while. I just upgraded my installation of WordPress to the new and spiffy 1.5, so I figured I should write an update.

I have been pretty busy at school lately. On top of normal school stuff , tutoring (and grading) CSU 213, I’ve been also teaching my twice a week class on XML. I also did a guest appearance in Prof. Lorenz’s Object-Oriented Design class last week, so that got me to download a new Squeak image and brush up my Smalltalkin’


On the Mono front, I plan on tackling Bug 63360 this weekend (hopefully), after talking to Carl (at XDevConf) and Prof. Rasala from school. It will also be nice to finish up the work on 68711 that has been lingering since Christmas as well.

I had dinner with Anthony last night at my favorite Thai place in Coolidge Corner , it’s good to see him. I wish him good luck in SoCal.

The week before Thanksgiving

Two weekends ago, I started porting BitTorrent to .NET using Azureus as a guide with my friend Pete. We got the different message types mostly sorted out and started working on the BEncoder. The hacking came to a halt when I found out that Pete is going LISA for a week. Now that LISA is over and Pete is back in Boston, hopefully we’ll be able to get some more done before the Thanksgiving holiday.

Last week I decided to buy my first desktop computer, because I’m sick of endlessly shuffling files around to come up with some free disk space. With my iPod half full, the My Music

directory on the Windows laptop filled up a third of the Windows laptop’s disk immediately. After hearing from Miguel about how nice it is to have a file server at home, I decided to get in the game as well.

I have no idea how Dell stays in business, well actually, how others can compete with Dell. I spent $600 last week and I’ll be getting a P4 desktop with a 17" LCD screen delivered this week. When computers are this cheap (the low-end models start from $350 or so), companies like TiVo and others selling specialty hardware will have to work extra hard to compete.

A little secret: the key to getting a good deal at is to keep track of Just keep track of when the sales start and end, clip a few coupons, and suddenly, everything is much cheaper.

I updated my blog’s to use the awesome Kubrick theme. I’d like to customize it a bit, and will probably start with making my own banner instead of using the default blue.

After seeing how well the blogspot editor works, I also got htmlarea working in my WordPress post interface. It sure is pretty, but it’s not working as well as the one offered by blogspot.