Mono, HttpWebRequest and https/ssl

I just spent the better part of a week tracking down bugs in Mono and a custom application of mine (which I’m porting to Mono). I was having a rough time with some code working against a secure server. After reading this, this, and this, it finally works.

Bottom line: If you’re working with HttpWebRequest and trying to connect via SSL, you need to make sure that you tell System.Net to trust all certificates, especially if you’re developing a non-interactive daemon. There’s nothing more frustrating then spending hour upon hour tracking down why your code won’t work like it did under .NET, only to find out a few lines of code fixes it straightaway.

My first Mono patch

I’ve been working on porting some of my code over to run under Mono and Linux. Yesterday, in the middle of a particularly scary class library, I started to encounter some strange behavior I hadn’t seen before. Cookies that should have been returning simply weren’t. After a little digging (and with the help of tcpdump) I was able to isolate it to a problem in the Mono runtime.

After several hours of hacking and debugging, I was able to file a bug report, including patches to solve the problem.

Who knows, maybe I’ll get to see my name in the Changelog. That would be kind of neat.

Posted in Uncategorized | 1 Reply

prj2make-sharp

I went looking for Jackson Harper’s original Visual Studio project converter, proj2make. I remember bugging him about it at one point long ago, and even sending in a little patch for it. It looks like it’s now been superseded by proj2make-sharp.

I’ve been recently converting some of my projects over to Mono. Writing the Makefile to build my projects is easy, but I couldn’t find any example of how to consume a web service, which I need to be able to do. It looks like prj2make-sharp does the trick, or at least gives me an idea of how to do it.

Cool stuff.

Posted in Uncategorized | 1 Reply

Rhythmbox w/iPod progress

I took a week or so off of iPod work to take care of other pressing issues. Now that things are finally settling down, I sat down to finish what I started, namely, support for the iPod name in Rhythmbox.

screenshot

Nothing fancy. It reads the DeviceName off of the iPod and sets it as the name of the iPod in the sources list. This officially becomes my first patch to Rhythmbox. Wee, I’m so excited. I have more iPod-related work I want to do, including:

    Make iPod name editable
    Drag and drop files to the iPod
    Syncronize the iPod
    Playlist support
    Whatever else sounds like a good idea

It’s a start. I wanted to start with a small change, so that I could get comfortable with the internals of Rhythmbox. I’m feeling pretty good about it now. It’s going to be a happy day when I plug in my iPod and sync with my music library with Rhythmbox.

On the road

We had originally planned a trip up to Wisconsin this weekend to visit the House on the Rock. Instead, we jumped in the jeep and headed east, first to Detroit and then to Niagra Falls. We’re in Toledo, Ohio now and in the morning we’ll make the last leg of the return trip. I have bunches of photos to post and tales of a refreshing impromptu vacation that gave me a bit of a revitalization and woke up an old story idea that I now feel inclined to explore.

libipod, or what motivates me

I started playing with ipod support in Rhythmbox a while back. I mocked up a little bit of the GUI, but then I made the mistake of looking at the libraries that interfaced with the ipod. There have been some efforts at getting ipod support under Linux, most notably gtkpod. There are a handful of various efforts at making GUI to interface with the ipod, but I found very little effort going into making a stand-alone library to access it.

Following the Open Source tradition, I decided to write my own library to interface with the ipod. I did this with sound reasoning. First, the existing projects that I did find all seemed to be trying to do their own thing (nothing wrong with that), each implementing their own version to accomplish a similar task. While there’s nothing necessarily wrong with that, it feels more `right` to me to create a more generic, independant shared library to interface with the ipod (and specifically, iTunesDB, which is the heart and soul of the ipod). With a shared library, I can integrate ipod support into any number of applications (xmms, Rhythmbox, gnome-vfs, etc) without having to worry about rewriting the same code over and over again, which gtkpod and others seem to be doing.

I talked to a few developers involved in other ipod-related efforts and met some resistance to my idea. Again, the efforts I witnessed seemed to focus on building application-specific support. On that vein, I took a look at my own motivations compared with that of other developers that I know and I came across some interesting bits of information.

Reading through a presentation [3.4M] given by Nat Friedman at GUADEC recently, I found and have shamelessly ripped out the pyramid of usability.

pyramid of usability

I place myself somewhere between core hacker and geek. I’m more than happy to hack away at code but I don’t find as much satisfaction in something that only I can use. I guess I prefer to look at things from an end-user perspective. They don’t care how complicated it is to write code or what effort went into it. They just want it to work. At least I’m not alone in this.

I know where I stand, but what about the community at large? Jorge pointed me to this study on the motivation and effort in Open Source software projects, conducted with a pool of 684 developers across 287 sourceforge.net-hosted projects. They concluded with some interesting results.

44.9% write code because it’s intellectually stimulating.
41.8% write code to improve their skills
33.8% write code because it is needed for work-related projects
29.7% write code for non-work-related projects
11.3% write code to spite closed-source projects
11.0% write code to enhance their reputation in the Open Source community

I can relate to these motivations but I can’t help feeling that something is missing. I don’t expect the code I write to save the world but I would like it to contribute to making Linux more usable to the end user. If I sync my ipod with Linux, it should work the same no matter what frontend I use. I should even be able to sync between whatever application I use in Linux and iTunes on Windows or OSX. It shouldn’t matter what application I use on which platform. It should just work.

So that’s my goal with libipod in a nutshell, as lofty as it may be. It should provide a seamless interface between any application using it and iTunesDB and allow the ipod to work with iTunes or any other compatible software.

Making firefox your default browser (and open URLs in a new tab) in Gnome

Okay, that was a wordy title but what can I say, it fits the bill. I wanted to use Firefox as my default browser, yet open new links in a new tab. This is how I managed to make it work.

I created firefox-tab.sh in my ~/bin. In it, I put in one line:

firefox -remote “openurl($@, new-tab)” || firefox “$@”

What this does is tell firefox to open the url in a new tab, or if firefox isn’t running, launch firefox and open the url.

Next, I told GNOME to use `~/bin/firefox-tab.sh %s` as my default browser (vary as necessary for your window manager). Now, whenever I click on a link, it opens in firefox. It’s quick, simple, and does what it needs to do. I’d prefer to make it open the tab in the background, but I haven’t found anything in the remote documentation that indicates this is possible.

Cheese is my twinkie

Dena and I went with my cousin, Annie, to the midnight premier of Harry Potter and the Prisoner of Azkaban last week. Afterwords, we were all a bit wired and decided to stop at Steak and Shake for some breakfast. It was 2:30am, after all.

We were too early for breakfast, so we ordered some dinner instead. I ordered a Frisco Melt and Dena got something with cheese fries (this is important to the story). After I finished my sandwich, I started picking at the cheese fries. At one point, I held up one cheese-smothered fry and thought, “I like cheese. Cheese is good. Cheese is to me like spinach to Popeye, and like twinkies to the neurotic Rifts character I played once, who gained his superpowers only by consuming the sponge-like treat en masse”. What I said, though, was quite different: “Cheese is my twinkie”.

The train of thought was perfectly logical but had absolutely no context to the discussion going on at the table. Annie and Dena both looked at me like I had turned into a rabid 7ft tall bunny rabbit. I can’t help it if they can’t follow my thought process. It made perfect sense to me.

Rhythmbox rockin’

So Jorge bribed me with the possibility of a bounty for completing iPod support in rhythmbox, the music application we both use. It took me a few hours to get productive, mostly because I had to learn enough about arch, the source control versioning system that the rhythmbox developers use, to check out and create my own working source tree. Then I realized my iPod was HFS+ formatted, so I had to recompile my kernel to add support for that file system, so I could copy off the boot sector and reformat the drive with fat.

I’m still learning what all glib has to offer, so this was a good place to jump in. I managed to load a custom popup menu based on the source (in this case, the iPod). I also almost have it reading the actual name of the iPod, instead of just calling it “iPod”.

I know I’m not the only one hacking on the rhythmbox code to add iPod support and features. I’m still not used to this arch system, but from what I’ve read merging changes is fairly seamless. I figure I’ll follow the rhythmbox-devel mailing list and quietly hack away at my own little tree until I have it working reasonably well. I’m sure I can get Jorge and a few other of the #linux guys to test things out for me.

Tomorrow is Memorial Day, which means another day off of work for me. Four days in a row. I sure needed the time away from the office. The last two weeks at work have been stressful. It was nice to forget about that for a few days and work on my own stuff.

Posted in Uncategorized | 1 Reply