Hibernate and auto-generated timestamps

| No Comments | No TrackBacks

I've started using the object-relational mapper Hibernate recently. After studying the book "Introduction to Hibernate" by Minter/Linwood for a couple of days (not the most entertaining and inspring programming book I've read...) and trying examples, I felt ready to put my new knowledge to use. My first project was to convert an existing web application from using my own custom/proprietary O/R mapping to Hibernate, so it could be extended more easily and to be able to use one of the ready-made caches that come with Hibernate. It worked out well - even though creating the mappings caused me some headaches at times - and once you know Hibernate you  absolutely don't wanna go back to the "manual" way.

ShareThis button in MovableType 4

| No Comments | No TrackBacks
share-icon-128x128_normal.pngShareThis is a nice addition to any web page. Instead of adding links for Digg, Delicious, Reddit, Myspace, Facebook, etc etc to your page and and coding a "send this article to a friend" function yourself, you can add the ShareThis button, which does all of the above (and more). When a user clicks on the button, a window is opened that lets you choose how you want to share this page: Via social web, blog post or sending email/IM/SMS.


To add this button, you just have to insert some Javascript code into your web page. The URL is detected by the script and sent to the ShareThis server. This is fine as long as you want to share this exact page. But it's not ok if you want to share a specific part of a page, for example on a blog. Your blog always has the same URL, but the posts are changing constantly. Fortunately, every post has a unique URL, by which it can be reached directly. And ShareThis has a pretty flexible API that lets you set the URL you want to share.

Here's how to add the ShareThis button to a MovableType 4 blog:

Hard disk crash and Time Machine

| No Comments | No TrackBacks
Harddiskcheck.pngIt happened shortly before christmas. I was working with my MacBook (on the sofa) and all of a sudden I could only move windows around. Couldn't switch to another program, couldn't actually work with the program I had open. Very strange, I thought, this never happened before with my trusty OS X. The only thing I could do was to turn off the machine. Then it didn't want to reboot any more. On closer inspection, I realized that the disk was making a strange repetitive clicking noise and was constantly changing its rpm. Great, broken disk!
I had been working for 4 days since my last backup. Lucky guy, you might think, but NO! 4 full days of coding work were lost, and of course in those days I managed to solve a lot of important problems. Later when I made up the lost work, I realized that I remembered quite well what it was, so I was finished in less than half the time, and it might even be better than the first version. But we will never be able to tell.

So I had to get a new disk. Top priorities for me are energy efficiency (especially in a notebook), low noise, and great performance/price ratio. This meant the very large disks and the very fast disks were out of the question. I settled with a Samsung HM320JI with 320 GB, which is a 5400 rpm model, so it runs cooler and quieter than the faster 7200 rpm drives. The speed is great, too, compared to my previous 120 GB drive.

Here's what I did to be able to work again:

Linux server management and SysCP

| No Comments | No TrackBacks
Since a couple years I'm hosting websites on a my own dedicated server. This gives a lot of freedom and flexibility, you can install whatever daemons you like, you have plenty of disk space and you can amortize some of the cost by hosting other (customer) sites on your server or even make a business this way.

MacBook and Kensington Lock

| No Comments | No TrackBacks
What did I read this morning... Kensington locks don't work with the new MacBooks! Bummer. Could Apple really design the Kensington lock slot in a way that it doesn't fit a Kensington lock? I couldn't believe it, so I tried for myself:


Alien technology - the new MacBook

| No Comments | No TrackBacks
It arrived here yesterday: The brick, aka Apple MacBook Aluminum or Unibody MacBook. I'm sure you've read about it somewhere. Isn't it amazing how much press this company gets when they introduce a new product? I mean in relation to their market share. But that's only surprising at first sight, because Apple has been and still is a pioneer when it comes to computers and user interfaces. Even if only few people buy Apple's products, they have a huge influence on other manufacturers' products.

Apple's switch from PowerPC to Intel in 2006 was exciting in that their computers got a nice speed-bump and were more competitively priced. But it also made the computers somewhat more PC-like. Not that they got that bad, not at all, but some of the charme of the old times was lost. For example, ventilator noise or waiting for the system to wake up from (hibernation) sleep mode was something hardly known to Mac users until then. But they really made up for this with the great Mac OS X and the beautiful designs of their machines. But Macs and PCs are since then apparently easier to compare.

Since the competition is not sleeping, PCs have improved, too. It was time for Apple to come up with something to set themselves apart from the rest again, and the new Aluminum MacBooks are exactly that. Here's my review.

I got a blog!

| No Comments | No TrackBacks
Here it is, my blog. Who would have thought this day would come. Since a while now I have been playing with the thought of starting a blog, but never did. Some things that have stopped me until now (and you might recognize some):

  1. Not enough time
    I guess this is a common problem and I haven't found a solution for it yet, besides slowing down the rotation of the earth. That would make the days longer and probably add the missing hour to the day we need for blogging (or other things?). But in a time when everyone is so concerned about the well-being of our planet, this would be hard to get global consensus on.

  2. Not sure which language to use
    I am German, so German is my mother tongue and it is the language I prefer for expressing myself. Even though there are over 100 million native German speakers (mostly in Germany, Austria, Switzerland), and probably also that many that have learned German as a foreign language, what is that compared to the 1000 million that speak English? The bigger your audience, the better, especially if the topics are of interest to anyone in the world. On the other hand, Germans would probably not read my blog if it was in English and if they can get similar information in their own language. What a dilemma!

  3. Who's gonna care?
    Why should anyone read my blog? It's one in millions (even though most of them were started and then died after a couple of entries - is that gonna happen to me?).
    Can I make it interesting enough? Can I write well enough?
So then why did I start now? Good question and I'm still not really sure myself. But more and more often I have the urge to say my opinion, after reading certain news articles in the mass media, be they of technical or political nature. And more and more often I feel that I should share some information with others that might be useful to them.

The technical side of blogging was pretty clear to me since a couple of years, when I started developing my mobile blog client BlogPlanet. Believe it or not, I had this nice tool available to me and most of the time a state-of-the-art mobile phone, but didn't use it beyond test posts. As a publishing system I'll use MovableType, which I've always been a fan of, even if that goes against the global trend to Wordpress.

Even though I'm usually of few words, I'll try to be more verbose in my blog and I'll try to enjoy it. It might be a good compensation to coding. If I'm boring you, say so, the comments feature will be available. But of course I'll be very happy to receive your positive feedback as well.