On altruism part 2

In the spirit of holidays and sharing is caring, an update to my other post with some more interesting organizations to support:

1) Electronic Frontier Foundation. If you havn’t watched this then do it now. Then you’ll know why they are important, more now than ever.

2) Mozilla. I can’t think of another program I have spend so much time using over the last many years. Their support is important in order to remain independent and make the web a better place.

3) Randers regnskov  This is a Danish one, but a rather important one I think. They pay for school to an indian tribe in Ecuador, and in response the families will not sell their rain forest land to big international companies. What a great idea and really worth spreading.

On altruism

Some years ago I became an apostate by leaving the church and became a “real” atheist. In Denmark the church and the state are still quite heavily intertwined. Luckily the biggest portion of the money the church receives are from believers who pay about 1% of their annual salary through a special church tax. Many of these never go to church, except for Christmas, when they get married or when they get children and need to get them baptized. What would happen if they spend that money on charity instead?

I have been thinking about ways to spend some of the money I don’t have to pay the church for altruistic purposes. So far I have donated to three different causes that I think makes the world a better place.

1) Wikipedia

We need to nurture and make sure that information in the public domain stays there and are available to anyone with an internet connection free of charge.

2) Khan Academy

I have always been interested in how we can improve the education system and now being a father certainly helps me appreciate any progress being done in this area. Salman Khan tells their story in this TED talk much better than I can do.

3) Global Witness

There are a wealth of different organization trying to help the poor in need, but I always find them lacking in that they seem to focus on individuals rather than looking at the bigger picture. When I watched Charmian Gooch talk about global corruption I instantly felt that this was finally something worth supported and something I could see really make a difference in the long run.

Hashtables in javascript

I was looking into some performance problems with knockout yesterday and starting digging into the code. In particular I was wondering why it would take their mapping plugin several seconds to wrap an array of 500 objects. Profiling lead me to look deeper into the code, and the following code stroke me as very strange:

Basically this is a hash implementation of only put and get operations using two arrays. I don’t think I need to tell you how bad the performance of this will be once you start adding lots of items 🙂

The reason why they didn’t just use an ordinary object to store their values, was that their keys were objects and not just simple strings or integers. I started wondering what other people did with this problem. There must be a library for this. And low an behold there was.

Then I started thinking, why don’t you just jsonize the object and then store that as the key in a plain js object. Both things should be really fast, since every new browser nowadays has a very fast JSON implementation.

With the 3 implementations in hand I did a simple benchmark. Generate 10.000 objects, store them in the hashtable with the object as a key. Followed by getting all the objects again.

Using Firefox 12: naive double array: 1370ms, json: 77ms, jshashtable: 170. Using Chrome 19 and IE9 the performance gap is very similar. Chrome is of course a tad faster.

Update: reran the benchmark using suggestions from Tim.


Code is available here.

Time in a database

For some applications, the ability to be able to trace the different states during the lifetime of data can be very important. Especially when it comes to debugging. This is mostly relevant for data stored in a database, but could potentially also be interesting for in memory data structures. Luckily many databases today support this as change data capture. I would add to the article that the capturing the user as part of the change can be very effective.

I have recently been involved in the development of two systems where this pattern has been employed to great success. One where this was implemented in hand, and one where CDC in SQL server was used. The hand implemented solution had some special requirements that meant we did this in hand, and it also doesn’t tie us to a particular db. While not free at all, once it is up and running, it provides an invaluable tool for reasoning about the data.

I was very pleasantly surprised when datomic was announced with a time model as one of the core concepts. I really think that in this age where storage is so cheap, that we can’t afford to threat data as mutable.

Donation links

I really love the kickstarter concept, flattr and in general other great free projects, such as wikipedia and wikileaks. Then there are smaller projects such as The Project Hate MCMXCIX trying to fund the recording of their latest album. Or the interesting, but maybe a bit top low budget TV series Pioneer One. Or the excellent free android mod cyanogen.

I donated to the recording of Obscura’s demo collection this month, what did you donate to?

A digital dictionary

One of the nice things about reading is that it enhances ones vocabulary, but only if one can learn the new words that one meets. I’ve always dreaded using a dictionary because one has to manually find the right page, and for them to contain all relevant words they need to be huge. When one is used to computers, this just seems terribly inefficient. Luckily now there are many online dictionaries. Sadly they don’t help very much when one is lying on the sofa or in bed and reading. This is where I think the kindle really shines. When reading a book on the kindle, one can instantly look up a new word without leaving the page. This alone is often compelling reason enough to buy it as an ebook than to buy it in paperback.

And if the book you’re reading is a physical book, you can still use the Oxford dictionary that comes with the device to look up words just by typing them in. And because the device is very power efficient, one never has to worry about it running out of power any time soon.

Read my review of the kindle for more information on the device.

Learning from the web

While Paul Graham and many others have pointed out the virtues of web compared to normal desktop software. For Nemo Documents, working as a file manager for local files, it was quite clear that we needed a desktop application. Given this how could we then apply as much of the good things about the web into developing a Windows application?

We quickly decided on WPF as it allows one much greater freedom in designing the application. We wanted something visually appealing and in this I think we succeeded (whether that is the case, is of course not up to me to decide :-)). But at least it is not the ordinary ugly grey programs that are so common in the Windows world. As for WPF as a framework I’m quite torn. On one side, it allows one to do a lot of fancy stuff, but on the other side there is way too-much architecture astronauting in the framework and that really hurts when you’re just trying to get something done. jQuery is a good example of how to do this right.

Another thing to learn from the web is to watch the error log and quickly fix problems people are seeing. There is nothing more frustrating as a user than software that is not working, so we made it virtue to respond quickly to errors and to get new versions into the hands of people. With the build-in auto-update feature of Visual Studio, it’s quite easy to keep already installed versions updated. It’s not quite as smooth as updated code on a server, but it goes a long way. And I really think that providing excellent customer support is key these days. When it’s so easy to go “next-door” one has to provide exceptional service to retain users.

The last point also goes hand-in-hand with agile. Getting software out and into the hands of people to get early feedback and use that to better shape the software to fit real needs. We try to release new features when we consider them stable enough for ourselves to use. And that doesn’t have to be every half year 🙂 We recently did this with the google calendar and google docs integration. A feature we coded and rolled out a month after the initial release.

A messy desktop

Earlier this week we released a new version of Nemo Documents, the biggest addition is that we integrated google into the desktop. How this improves things have been documented on the official nemo documents blog, so instead of writing more about that I want to focus on a more personal angle, namely the subject of a messy desktop versus an organized one.

My windows desktop is quite messy. You can see how it looks below. Then again, it’s mostly used to store temporary stuff. Projects we are working on always go into a neat folder structure inside our version control system.

Finding stuff in a messy desktop can sometimes be a bit tedious, but on the other hand so is cleaning up. Furthermore it might not even be a good idea to clean up too much. No matter what your mother tells you 😛 Another thing is that the urge to clean up is lessoned by the fact that you know 90% of the stuff are most likely not to be used again. But you keep it around just in case. This is where I think Nemo Documents really shines. It gives you a structured view of your files based on time and allows one to organize as much or little as needed using labels, while still maintaining the folder structure already in place. I map both my structured folders and my desktop into this view.

While talking to people about how they organize their files and documents I tend to meet two types of persons: people, like me with a messy or semi-messy structure and people in the other end with a big folder hierarchy to structure their files. The question then becomes, if Nemo Documents is only for messy people? After releasing the software we have gotten feedback from a lot of people, including the same people that are big on organizing, and from what we are hearing they are very fond of the system as well. The thing is they love structure, and this is exactly what Nemo Documents gives them. Free file organizing is always welcome I guess 🙂

Amazon Kindle review

I’ve recently bit the bullet and bought a kindle. I’ve been wanting to see the display of an ebook reader for a while but never had the chance, but the reviews of the display were all very good so I wasn’t too worried about that. With the recently announced 3rd generation kindles at a much more reasonable price I decided that it was time to see what all the fuss was about.

I have been using the device for about two weeks and so far the overall impression is very positive. I haven’t recharged the device yet and it’s still about half full. I usually read at night before going to sleep. I’ve also used the built-in Oxford dictionary the first week. This was while I was finishing off a “normal” book, The Day Of the Triffids (excellent book btw). Even just as a dictionary it also works very well because of the keyboard, the screen and the fact that you don’t need to think about charging.

I have started reading Cory Doctorow’s latest novel for the win. The book can be downloaded for free in kindle format (DRM free). It’s wonderful to see Doctorow standing by his principles and embracing the future. In the past I would download his latest work and read it on my computer, waiting for the physical book to arrive in the mail. Now I can just download it right away, read it on a very nice screen, and donate if I like the book.

Living in Denmark I must confess that I haven’t given much thought about using it to read Danish books. I mostly read books in English anyway, but at some point I’ll have to check out if and how one can borrow ebooks from the library. But that is a subject for another blog post 🙂

The good:

  • The screen. It’s better than paperback. Yes it’s that good.
  • The dictionary (I’m quite surprised of how much I’m using it)
  • Battery life
  • Very light and can fit in a ton of books

The bad:

  • Ebook prices. Why are a paperback version sometimes cheaper than the digital version?
  • DRM on books
  • PDF files can be viewed, but one really needs a bigger version as the kindle will not format the text to fit the screen properly. Hopefully this will be fixed in a firmware update sometime in the future.

And the ugly:

  • It’s not too shabby looking with the graphite 🙂