Twitter And Other Updates

Good news everyone, I’m now on Twitter. This means I can spam now in 140-character chunks, hooray. The latest tweets are also visible on this blog on the right side bar.

Tweet tweet tweet

*tweet tweet tweet*

Furthermore I’ve reorganized some small things on this site. For example I splitted nearly everything in two main categories. The Media Zap Oh Snap-category for everything media-related like TV-series, music and movies. Then there’s the ‘Technical Wibbly Wobbly‘-category for everything technical.

I’ve also updated and extended the Blogroll and Link section. (Thx @ GedankenDeponie)

That’s it for now. Next time it’s going to be a more useful post =)

,

No Comments

Black Books

Black Books

Black Books

- Why can’t they leave me alone? I mean, what do they want from me?
- They want to buy books!
- Yeah but why me? Why do they come to me?
- Well, because you sell books.
- Yeah, I know… but…

Bernard is a mean, unpleasant, cynical and egoistic bastard who’s running the dirtiest and most unfriendly book shop in London. Basically he spends all day in his book shop smoking, complaining and drinking cheap booze. Most of the time he’s miserable or angry, shouts a costumer and he’s friends. Well one day he employs Manny, who’s unable to defend himself and gets bullied by Bernard. And then there’s Fran, a friend of Bernard who’s spending also quite some time in the bookshop smoking and drinking. And so we follow the three how they waste time.

Black Books (IMDb, Wikipedia) is a wonderful sitcom with the great Bill Bailey as Manny and Dylan Moran as Bernard. It’s a mix of simple straight forward jokes with a pinch of black black humor and really bizarre events. Besides obsessive drinking and treating costumer like crap we can also watch how books get absorbed, how walls move and how hot weather can trigger dangerous illnesses. Have fun watching it =)

Star-O-Meter: starstarstarstarempty-star (4/5)

Now a few clips from the show. Once again, embedding is disallowed.

Black Books, Business (Guess what the thing is =) )

Black Books, Costumer Service

Black Books, Advices

, , , ,

No Comments

Lookup Logic For Native Libraries in Java

If you want to do something in Java, there’s certainly Java library which helps you with to achieve your goal. However, for some stuff (3D rendering, accessing I/O devices) the Java API’s are not enough and you need to interact directly with the target platform.  In such cases, you need to use the Java Native Interface and provide a native library. This also means that you need to ship your application with additional native libraries. Here’s where the issues start.

Java and Native Libraries

Java and Native Libraries

When you use native-libraries, the JVM needs to load those. By default the JVM loads those libraries from a few standard system paths. Of course you don’t want to touch those. The other alternative is to specify an look-up path with the JVM-argument ‘java.library.path’. This works most of the time, but still has its issues! First, it doesn’t work with a simple jar-launcher! In order to specify this JVM-argument, you need to add a launch-script. The second issue has to with packaging your application. Imagine that you ship your application for different OS, like Linux, Windows 32- and 64-Bit etc. The native binaries are named the same, but are actually for different versions. For example there are two versions of ‘coolLibrary.dll’ one for 32-Bit, one for 64-Bit. You cannot have both in the same directory. You somehow need to decide at runtime which one you pick.

So what you want is to be more flexible how to resolve a native library. And you can! Thanks to our friend ClassLoader. Basically you can overwrite the ClassLoader.findLibrary()-method and implement you own resolving strategy. For example:

Source-Link for RSS

Of course, this class-loader should be the ‘root’ class loader of your application. This means this class loader should be responsible for loading all application-classes. To do this, I usually create a small ‘boot’-application, which starts the real application. Basically what it does is to instantiate the NativeLibPathClassLoader, pass it the location of the application with dependencies and then load the real application. Not that your ‘real’ application shouldn’t be on the regular class-path. Otherwise everything is loaded by the system class loader:
Source-Link for RSS

This is how I start up Java Desktop Applications which need native libraries. It works wonderful and it solves the annoying ‘java.library.path’-path issue.

No Comments

Analyzing Dependencies Java

As software developers, we use daily some nice libraries to archive our goals. Of course, the libraries authors also use libraries to get the job done. In practice libraries have a some transitive dependencies. Just take a look a Hibernate, which is brings tons of libraries.

Dependencies

Dependencies

Normally the dependencies are documented somewhere, so that you can include the right one in your project. Also tools like Maven or Ivy help to include the right bits. But what if you have downloaded a project, which brings tons of required and optimal libraries with it and you want to find out the relations-ships?

A small tool called Jar Jar Links can help. Normally this tool is used to merge different jar-files. But it can also scan through jar-files and find out the dependencies.  The command for this is this: java –jar jarjar.jar find jar <list of jars>. For example I analyzed the some parts of Hibernate: java –jar jarjar.jar find jar  hibernate3.jar;./lib/required. The output looks like this:

C:\temp\hibernate\hibernate3.jar -> C:\temp\hibernate\lib\required\slf4j-api-1.5.8.jar
C:\temp\hibernate\hibernate3.jar -> C:\temp\hibernate\lib\required\commons-collections-3.1.jar
C:\temp\hibernate\hibernate3.jar -> C:\temp\hibernate\lib\required\dom4j-1.6.1.jar
C:\temp\hibernate\hibernate3.jar -> C:\temp\hibernate\lib\required\jta-1.1.jar
C:\temp\hibernate\hibernate3.jar -> C:\temp\hibernate\lib\required\javassist-3.9.0.GA.jar
C:\temp\hibernate\hibernate3.jar -> C:\temp\hibernate\lib\required\antlr-2.7.6.jar
C:\temp\hibernate\hibernate3.jar -> C:\temp\hibernate\lib\jpa\hibernate-jpa-2.0-api-1.0.0.Final.jar

You even can list all dependencies of classes to each other, by using: java –jar jarjar.jar find class <list of jars>.

Anyway it’s a small and useful tool. Of course, it only finds dependencies which are compiled into the classes. Stuff which is loaded via reflection cannot be detected.

No Comments

Doctor Who Series 5 *Spoilers*

A new producer and head writer (Steven Moffat), a new Doctor (Matt Smith), a new companion (Karen Gillan) and a new shiny TARDIS-decoration. Tons of changes for the latest Doctor Who season. Let’s take a look.

Doctor Who, Series 5

Doctor Who, Series 5

The Eleventh Hour (S05E01)

There’s a crack in the wall in Amelia’s room  and she’s afraid of it. Just as she ask Santa Clause for help, the Doctor appears and helps her. However he has problems to land the TARDIS at the right time. That’s why he arrives 12 years to late to help Amelia. Meanwhile Amelia has grown up and calls herself Amy. Now the Doctor and Amy try to catch a dangerous Alien prisoner which hides on earth. The timing-issues,  meeting Amy at different ages combined with a quite typical Doctor Who story makes it the perfect companion-introduction.

Doctor Who 5, Eleventh Hour

Doctor Who 5, Eleventh Hour

The Beast Below (S05E02)

Amy and the Doctor land on Starship UK, a giant space-ship which contains the whole British population. The ship was build because the earth has become uninhabitable. However something is wrong with the ship. All people are afraid of the ‘Smiler’-robots, which ensure safety and order. It looks like there’s terrible secret to be discovered.

Doctor Who 6 The Beast Below

Doctor Who 6 The Beast Below

Victory of the Daleks (S05E03)

Second World war, London is under attack. Luckily the military has a new secret weapon. To the Doctors surprise this weapon are Daleks, which are friendly and help the people. But of course, the Daleks have yet another genius plan to rule the universe.

Doctor Who 5 Victory of the Daleks

Doctor Who 5 Victory of the Daleks

The Time of Angels (S05E04) / Flesh and Stone (S05E05)

The Doctor finds a message from River Song. He meets River and lands of a crash-site of a spaceship, which contains one of the deadliest creatures, a Weeping Angel. And of course, instead of leaving this dangerous place, the Doctor starts to wonder around and brings himself into trouble. River Song is back! The Weeping Angels are back! What else can you ask for?

Doctor Who 5 Time Of The Angels

Doctor Who 5 Time Of The Angels

Amy’s Choice (S05E07)

Rory, Amy’s fiance and the Doctor keep dreaming the same dream. Or is it really a dream? Which one is the dream and which what’s reality? In both they fear a deadly thread. But how can they find out which one is real?

Doctor Who 5 Amy's Choice

Doctor Who 5 Amy's Choice

The Hungry Earth (S05E08) / Cold Blood (S05E09)

As a science team drills down into the earth, they disturb a Silurian colony which is living deep down under the earth. Of course the Silurians get pissed of and some of them try to start a war against humans. Once again the Doctor helps to keep the peace.

Doctor Who 5 Hungry Earth

Doctor Who 5 Hungry Earth

Vincent and the Doctor (S05E10)

The Doctor discovers a monster in one of Vincent van Gogh paintings. He travels back in time to take a look himself. Unfortunately the monster is invisible and only Vincent can see it. Quite tricky to kill a monster you cannot see, especially when you have to deal additionally with a depressed painter.

Doctor Who 5 Vincent and the Doctor

Doctor Who 5 Vincent and the Doctor

The Lodger (S05E11)

The TARDIS is disturbed by a strange force, which’s origin seams to be a flat. Meanwhile people keep disappearing in the very same flat. The Doctor decides to move in to find out what’s wrong with it.

Doctor Who 5 The Lodger

Doctor Who 5 The Lodger

The Pandorica Opens (S05E12) / The Big Bang (S05E13)

River Song warns the Doctor that the TARDIS will explode. Additionally they find a mysterious ‘Pandorica’. The ‘Pandorica’ imprisons the deadliest thing in the universe. And it is about to open itself.

Doctor Who 5 The Pandorica Opens

Doctor Who 5 The Pandorica Opens

Conclusion & Opinion

This is it, season 5. In my opinion it is the ‘worst’ season so far. Not that it is bad, it’s still an extraordinary wonderful series. But it isn’t as good the previous seasons. I can’t really tell what’s the difference. So I’m not worried and I can’t wait for the Christmas special and the next season!

Trailer-Time:

, , , ,

No Comments

Exception-Handling: BeginInvoke vs ThreadPool.QueueUserWorkItem

Sometimes small changes make have a large impact. An example is the exception-handling difference of Delegate.BeginInvoke and ThreadPool.QueueUserWorkItem.

I’m working on a WPF-client application, which does quite a lot of work in the background. Most of the background work is handled by a special task coordination class. For a long time this class executed tasks with ThreadPool.QueueUserWorkItem. And it worked well:
As you can imagine, a desktop application crashes sometimes. So there’s a central error-handler, which is invoked when the application crashes:

Everything worked as expected. When a background task crashed, it trigger the error-handler as expected (it triggered also the VisualStudio-debugger).

One rainy day, I improved the task coordination class. Among other changes it exchanged the the ThreadPool.QueueUserWorkItem with a Delegate.BeginInvoke.
My tests and the application worked fine with the changes for quite a while. So I continued to improve the application. After a while, I started to notice some strange behaviors. Sometimes some work just wasn’t executed. Then it notices a lot of first chance exceptions in the debugger-output. I got suspicious and started to investigate. Soon I found out that my change from ThreadPool.QueueUserWorkItem to Delegate.BeginInvoke was the issue. Some exceptions in back-ground tasks weren’t processed.

 

clean exception handling ;)

clean exception handling ;)

 

What’s the difference?

As you know, Delegate.BeginInvoke isn’t just running the code in the background. It brings synchronization-mechanisms and the Delegate.EndInvoke-operation with it. And here also starts my exception issue. When a exception happens while executing the Delegate.BeginInvoke, the exception is caught. As soon as you get the result with Delegate.EndInvoke, the caught exception is thrown. I wasn’t aware of that. And unfortunately I didn’t end all tasks with Delegate.EndInvoke!

My solution was to switch back to the ThreadPool.QueueUserWorkItem. This operation doesn’t do any fancy synchronization for you. It just executes the delegate on the ThreadPool. If something goes wrong, the exception just blows into your face. The passed delegate is responsible to handle exceptions.

For RSS feed readers: I’ve just noticed that the gist-code-examples don’t show up in the feed-view =(. Has someone an idea how to fix that?  Meanwhile you need to read the post on the website.

,

No Comments

Bachelor Thesis Finished \o/

After four months hard work I’ve finished my bachelor thesis. Time to drink beer and relax =)

Bachelor Thesis Finished

Bachelor Thesis Finished

Hell Yeah

Hell Yeah

,

3 Comments

Talks and Short Movies

Yet another collection of interesting talks:

Now to some wonderful short movies:

, ,

No Comments

State of Play

State of Play

State of Play

A young man was murdered, probably a drug dealing related crime. On the same day, Sonia Barker a young researcher commits suicide. Sonia was the researcher for Stephen Collins, a member of the parliament and chairman of the Energy Committee. Cal McAffrey starts to investigate the death of Sonia Barker. Soon he finds out that she was involved in corruption, that she was professionally killed and that the two deaths are probably related to each other. A twisted investigation starts…

State of Play (IMDb, Wikipedia) is a six part political thriller about corruption, love affairs, press- and political-games. The whole serial fast-paced, full of twists and turns. Just when you think to get a grip of all facts, something new happens. The story and screenplay are a extraordinary good. The cast is also excellent with popular British actors such as John Simm, Bill Nighy, David Morrissey, James McAvoy. All thing considered, State of Play a outstanding thriller.

There’s a US movie adaption (IMDb, Wikipedia) of the story, but I haven’t seen it and I’m not particular interested in watching it.

I can recommend State of Play everyone who likes thrillers.

Star-O-Meter:starstarstarstarhalf-star (4.5/5)

Unfortunately there are no good trailers out there =(.

, , , ,

2 Comments

Opera Speed Test

My favorite browser, Opera, is fast, extremely fast. Newest scientific methods are used to measure its speed ;)

World Record Speed Test:

Ok, ok, the Chrome-guys game up first with speed test videos. Here’s the original:

Google Chrome Speed Tests:

Found via irrlicht3d.org, original source Opera-blog.

1 Comment