Categories
Programming

On designing libraries

I recently finished up a big project at IOLA which used two major components: Javascript and c# (.NET). It was interesting for me to see the big difference in the libraries for these platforms. For Javascript we used the excellent jQuery library. For .NET we used the very buggy Devexpress library. jQuery, like Javascript, is very simple. .NET on the other hand is overload with interfaces and concepts. What is interesting of course is that this philosophy shines through in libraries build on top of both platforms.

Devexpress is overloaded with concepts and the size of the library is just insane, the latest release is 221MB excluding kitching sink. Compared to jQueries 19KB. jQuery on the other hand focuses on a simple core with just the right amount of abstractions (very lispy), and delegates specific functionality to plugins, such as flot. The difference of course in part comes from the fact that jQuery is an open source project, while devexpress is a commercial project.

You just have to look at the release notes for each of these projects in order to see the difference. jQuery focused on making their already working code faster and fixing bugs. While devexpress spend most of their time added a number of new features. The problem is that in a commercial project fixing bugs doesn’t pay up as well as implementing new features. Or at least that used to be the case. In the era of google that simply is not true. Anyone can put in devexpress and find out if the library sucks (which it to a large degree does) or if it rocks. The sooner they realise that small is the new big, the sooner we will start getting better libraries.

Categories
Blog

Generators and decorators in Python

Was reading through some old blog posts today and found an interesting talk about Coroutines and Concurrency. The talk is pretty long but presents some nice ideas about how to split a problem up and making it more modular using yielding. It seems like python has extended this a little so that you can actually use generators to consume messages also. What I found particular interesting though in the talk, was when he briefly showed a decorator. Decorators are really powerful and seems to bring about the best of lisps macro extensability to Python without loosing the excellent syntax ๐Ÿ™‚ I googled a bit and found the following list of patterns that you can do with decorators.

Categories
My Media System

My Media System 1.1.1 released

A minor bugfix release for the 1.1.0 series was released today. Special thanks to the many contributors.

Categories
Blog

Streaming media between two linux boxes

I was wondering why it wasn’t possible to playback a movie over a ssh connection using remote X11 forwarding and mplayer. It seems that the latency is simply just too high. I’m not exactly sure if it’s a ssh or a X problem. This was on a wireless link, which might be part of the problem. While researching the problem I found this pretty cool patch for openssh that should give better transfer speeds. It’s in gentoo as the hpn use flag (even a patch for openssh 5.2). Sadly it did not seem to solve the problem. The movie was still very laggy. Then I tried adding a -C to add compression. This help a bit, but it was still painfully slow and uses quite a bit more cpu on the server side. Also the sounds will come out on the server end, so this might not work very well if you’re not in the same machine as the server ๐Ÿ™‚

Back to the drawing board it seems… I found this excellent post on how to stream movies from a server to a Nokia 800 tablet with size conversion done on the fly at the server end. This script is pretty clever and truly UNIX style. It uses netcat to pipe the data from the server to the client, and just sticks a ffmpeg in front to scale the movie first. What is perfect about this solution is that it uses very little cpu (very good for small devices like the Nokia tablets) and it streams the sound to the client. The only downside seems to be that the data is not encrypted. But of course there are ways around that too if you really care.

On the client (mine is 192.168.0.2) do this:

nc -l -p 5000 | mplayer –

And on the server side to this:

cat /movies/nice-movie.avi | nc 192.168.0.2 5000

Categories
Blog

Ginger cookies

My lovely girlfriend Milda made ginger cookies again today ๐Ÿ™‚ The last batch of cookies went so fast that this time she made 3 plates full of goodies. The recipe needs the following ingredients:

100g butter
100g sugar, recommended brown
150g honey
1 egg
400g flour
a bit of salt
1 tee spoon of baking soda
2 tee spoons of blended ginger
1 tee spoon of cinnamon
1 tee spoon of hot wine spices
2 table spoons of sour cream

Put together as:

Mix well butter and sugar.
Peel off ginger and blend it together with an egg. Put it together with butter and sugar.
Mix baking soda with sour cream and put to the bowl for pastry (there should be butter, sugar, egg and ginger by now :)).
Add honey and spices and mix all the ingredients well.
Add flour to make pastry of a consistence for cookies. Put it in the fridge for half an hour.

Flatten the pastry, and form the cookies (I do that by cutting it to squares with a pizza knife :)). Heat the oven up to 180 degrees and bake the cookies for 10 รขโ‚ฌโ€œ 15 minutes. Velbekomme.

OMG so many cookies!

Categories
My Media System

My Media System 1.1.0 released

Finally the day has arrived when mms 1.1.0 has been released. After 9 release candidates the release is finally here. The last couple of months of only focusing on bugs has really payed off. Everyone was only fixing bugs which means that we where able to squaze in 67 bug fixes in 2 and a half month.

See photos of mms running in the flickr group.

Categories
On the web

Spank my monkey part 2

This is a list of scripts that I have been collecting over a long period of greasemonkey use. The extension to firefox just keeps getting better and better all the time.

Flickr

  • Allsizes+ – Now with nag screen galore, but still very nice to snatch bigger resolution pictures.
  • Cross recommendations – This really makes browsing random pictures on flickr much more interesting.

Last.fm

IMDB

Google/Gmail

Categories
Blog

DRM

Now if only they would sell their music in flac instead of mp3 ๐Ÿ™‚

Categories
Blog

Bridging the gap between web applications and desktop applications

Google gears has been touted as the answer to offline web applications, but so far very few sites have adopted it. Maybe its because exactly what makes web applications great is the fact that you can communicate with people in real time, or maybe its because adopting a non-trivial web site to work with gears is a very significant task, or maybe its because gears was never bundled with a browser by default (until now).

One area where it really makes sense is for email. Google of course realized this, but it took them a complete phone stack before they actually did it ๐Ÿ™‚ The only other thing that I use geagle for wordpress, but that’s only speeding it up. So contrary to the gmail integration it doesn’t allow you to read, modify and post while offline.

Even with the ubiquity of fast wireless 3G connections coupled with netbooks, the offline support is a welcome change to gmail and only adds to the already long list of reasons for using gmail. It still amazes me that google was able to deliver a new email client at a time when at least I thought the webmail race was over. It really just goes to show that building rock-solid products is still king. Not just time to marked. And that is really good news for the ones of us that still care about that ๐Ÿ™‚

Categories
Blog

Vdpau without tearing

Acmelabs made a great blog post about how to install the latest nvidia drivers (180.29) and set them up to avoid annoying tearing. I installed it on my system and it A/V sync has also been much better so far. Upgrading heavily recommended ๐Ÿ™‚