Archive for November, 2008

Review: The Descent (2005)

Saturday, November 29th, 2008 | Movies, Reviews | No Comments

It’s been the second time I saw this movie and it still makes me jump! Finally a scary but not a cheesy movie! Sometimes the story is drifting into an artistic angle, the way the characters are presented, camera movement and the more graphic scenes – everything seems to be deliberately exaggerated without becoming a splatter or gore movie.

The story evolves around a couple of women who do outdoor activities for fun, pretty rough stuff like rafting for example. This time they are going to descent into a cave. Only problem is, that someone didn’t want to take the scenic tourist’s route and chose an never before explored cave for their trip. Bad idea! 😛

A fun flick to watch, thrilling, shocking, sometimes even repelling. This is what I expect from a “descent” horror movie!

8.5/10 – Pretty much awesome!

Tags: ,

Scrumming at home

Sunday, November 23rd, 2008 | Misc | No Comments

Inspired by my colleague Rob’s picture of his scrum board, I thought that I’ll share my last weekend’s scrum board as well:

Improvised scrum board

Improvised scrum board

On top I put the backlog, next to the picture the sprint’s things to do, done things went to the bottom area, kept there a few days for the psychological effect (see, you don’t need nicotine to get some dopamine). 😀

It was the first time I scrummed at home (I just became Scrum Master certified attending a training held by Scrum Mastermind Jeff Sutherland and Serge Beaumont from Xebia).

Scrumming I got things done that had been bugging me for weeks, some even months. Scrum really is about getting things done, as long as you have

  • a product backlog, as complete as possible
  • a product owner who has an understanding of what has to be done
  • a scrum master the keeps the team from interruptions while sprinting

Sprint time was Saturday afternoon only, I didn’t want to have anything left for Sunday, my family heavy couching / pizza ordering day. The only thing left was “finish Spring MVC tutorial”, but as I attended the Spring Core training last week I think I can forget about this one for now … or replace it by “prepare for Spring certification” – which will also bug me for weeks to come 😛

Tags: ,

deLight … (I’m sorry to say it) … sucks.

Friday, November 21st, 2008 | (X)HTML/CSS | No Comments

Even though I (still) use this theme (because I like the look of it) I have to say that the impl really sucks. First the image/smiley positioning bug, now this: I enabled the tagcloud
widget yesterday, the outcome being a messed up tagcloud. This is due to the line-height not being adjusted properly. Maybe I’ll fix this later. Damn, designers who want to be coders, it’s just not working.

Cobbler, stick to thy last.

All right, here is the dirty quick fix:

/* line height high enough to harbour *big* tags, tags justified */
div#tag_cloud div.box-right-content {
 line-height: 22pt;
 text-align: justify;
}
/* cloud element's shouldn't be aligned at the baseline IMHO
   tags with white spaces shouldn't wrap at eol */
div#tag_cloud div.box-right-content a {
 vertical-align: middle;
 white-space: nowrap;
}

Tags: , , ,

I just love my mplayer!

Thursday, November 20th, 2008 | Gadgets, Tech-savvy | 1 Comment

mplayer is *the* media player IMHO. It plays everything (without installing *any* codec – it’s all provided!) and it is possible to configure every fricking aspect of your video/audio playback demands imaginable (monitorpixelaspect=1.333 is one of my favorites, my TV is 16:9 using a 1024 XGA resolution 🙄 ) .

Scenario: Media pc connected to an old school Logitech DiNovo Notebook keyboard/mouse combo. Operating distance approx 1.2m – far to less for the TV/couch vicinity. Hooked up a brand new 2.4GHz mouse (hmmm, Logitech V450 Nano), worked smoothly.

Next thing I though was that I don’t really need a keyboard anyway to control my media pc. The windoze on screen keyboard serves me quite well, the main thing happening on my media pc is launching movies anyway. So you double click on a movie file, the movie starts full screen and you are left with no controls except the mouse. Wouldn’t it be nice if for example the left mouse button would play/pause the file, right mouse toggles full screen/windowed playback and the middle one stops (meaning exits) the movie?

As I said, I love my mplayer. This post took me ten times more time than configuring mplayer to serve my needs. Just open up input.conf and add these few lines:

MOUSE_BTN0 pause
MOUSE_BTN1 vo_fullscreen
MOUSE_BTN2 quit

You are all set up for the described scenario. mplayer even supports double click events like MOUSE_BTN0_DBL, for a complete list of binding possibilities launch mplayer -input cmdlist

Tags: , ,

smart way to use the (evil) singleton pattern

Wednesday, November 19th, 2008 | Java | 2 Comments

The usage of singletons is one of the well known GoF design patterns and it’s been said that it’s evil for various reasons (unit testing is difficult, can’t be reused, etc. just google it).

Well, I’ve been ending up with a singleton in one of my apps lately and came across a (German only) hint concerning how to implement the singleton pattern in a smart way. I’ll try to wrap it up in the next couple of lines:

Basic way to create a singleton: make the constructor private and provide a getInstance()-method (please forgive me for not using proper Javadoc, this should stay readable in a blog post, right?):

public class EasySingleton {
 
	// the instance field
	private static EasySingleton instance;
 
	// private constructor
	private EasySingleton() {}
 
	// returns the one and only instance of the class
	public EasySingleton getInstance() {
		if (EasySingleton.instance == null) {
			instance = new EasySingleton();
		}
		return instance;
	}
}

There is one big concern using the pattern this way: it is not thread-safe. Two threads could call getInstance() simultaneously (resp. the instance not yet fully initialized), each successfully testing the current instance for being null ending up with two instances of the EasySingleton object. Bad!

To prevent this synchronize the getInstance()-method:

public class SynchronizedSingleton {
 
	// the instance field
	private static SynchronizedSingleton instance;
 
	// private constructor
	private SynchronizedSingleton() {}
 
	// returns the one and only instance of the class
	// synchronized thus thread-safe
	public synchronized SynchronizedSingleton getInstance() {
		if (SynchronizedSingleton.instance == null) {
			instance = new SynchronizedSingleton();
		}
		return instance;
	}
}

This solves the problem of the singleton not being thread-safe. The let down is the synchronized method only being accessed by one thread at a time, all other getInstance() calls have to wait for the current one to finish. This can easily become a bottleneck in a production environment. Bad.

Now for the smart thread-safe solution:

public class SmartSingleton {
 
	// private constructor
	private SmartSingleton() {}
 
	// returns the one and only instance asking a static final
	// inner class thus thread safe and implicitly synchronized
	public static SmartSingleton getInstance() {
		return InstanceHolder.INSTANCE;
	}
 
	// inner class that provides access to a single instance
	private static final class InstanceHolder {
		// implicitly synchronized by the ClassLoader
		static final SmartSingleton INSTANCE = new SmartSingleton();
	}
}

The private constructor is being called upon the first call to the inner class, whose members are implicitly synchronized by the ClassLoader upon initialization (which is happening exactly once, @see Java Language Specification).

You end up with a thread-safe non-blocking singleton. Pretty cool, eh?

Tags: , , ,

eee box b202, ac3 and 720p x264 playback conclusion: forget it!

Wednesday, November 12th, 2008 | Gadgets, Tech-savvy | 1 Comment

Okay, I try to keep this simple: 720p x264 AC3 is too much for the eee box/pc. The only 720p file that worked fine was the (Stereo only) Resident Evil 5 trailer encoded with the Windows Media Video 9 DMO codec.

720p x264/h264 movies get out of sync quite fast, enabling framedropping just let’s you end up with a slide show of your movie.

I don’t like the idea of ripping blue ray discs anyway, decent rips take approx 4.5 Gig – which is quite some data for a movie backup IMHO.

If you are contended with a 480p only machine you are good to go (assuming that you want the quailty of x264 and digital multichannel sound 480p is the best you can get). Otherwise you have to wait for a faster nettop.

Conclusion: the eee box b202 (resp. an Intel Atom N270 based system) is not suitable for a high definition media center pc. Sorry folks… 😐 <sigh>

Tags: , , , , , , ,

fast firewalling for developers with iptables

Saturday, November 8th, 2008 | Misc, Tech-savvy | 6 Comments

Oh no, not another iptables tutorial! Skip this if you are an experienced linux bofh, read this if you don’t want to bother too much with configuring your system but still keeping doors shut and playing around with it. In my case I am using a VPS Linux box for Subversion, Apache, Tomcat and Confluence access. A developer’s machine, as you can tell 🙂

I think it’s irresponsible to have a system online and not shutting all possible vulnerabilities down. As long as I am playing with the machine (and don’t have the expertise of a top notch sysadmin) I want it inaccessible almost completely. It’s not that I am paranoid about somebody accessing my stuff, I don’t like the thought of somebody hijacking *my* system doing *their* stuff 👿 ! So what I wanted to do was to shut everything down except Secure Shell – that’s the only service I trust (using key only authentication), everything else is tunneled.

Okay, enough talking, this is how you get your machine inaccessible except for ssh:

iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A INPUT -i lo -j ACCEPT
iptables -A INPUT -p tcp --dport 22 --sport 1024:65535 -j ACCEPT
iptables -A INPUT -m limit --limit 100/second -j LOG --log-prefix "iptables:"
iptables -P INPUT DROP
iptables -P FORWARD DROP
iptables -P OUTPUT ACCEPT

You won’t kick yourself from your server entering these commands! 😉 These commands should be quite self-explanatory, for a detailed explanation please refer to the iptables man pages.

Next thing is to make sure that a reboot won’t make your system vulnerable once again. The firewall rules are kept in memory only. I didn’t bother the first time I configured my system, now that my provider had to reboot their VPS’ I had to reconfigured it and wanted it to be the last time!

There are two iptable commands that will save and load firewall rules. Dump you current rules with

sudo iptables-save

Save this output in a file:

sudo iptables-save > /etc/iptables-save

Next tell your rc scripts (like /etc/rc.local for each multiuser runlevel) to execute the following line, using iptables-restore to restore your previously saves configuration:

cat /etc/iptables-save | iptables-restore -c

That’s it, you’re all set up with a machine that is inaccessible except for Secure Shell. Happy bashing!

Tags: , , , ,

… seems I am accommodating an animal rarely seen in Europe …

Saturday, November 8th, 2008 | Misc | 1 Comment

Jack? Lily? Tiger!

Tags: , , ,

eee box b202, ac3 and 720p x264 playback final audio chapter (for now)

Friday, November 7th, 2008 | Gadgets, Tech-savvy | No Comments

Seems that I managed to get the eee box to be my new media center. I did a mistake in my last post, writing that the container also influences the delay, a closer look revealed that the file I was playing back wasn’t AC3 but AAC. AFAICT you just have to configure the proper delay for each audio file format once and you’re done.

Next steps will be a few video format tests, I already had problems with a 720p Cars trailer. Next will be a 720p Resident Evil 5 trailer that plays smoothly on my eee pc 901. So it should also work on the eee box. I also want to give Media Portal another chance, my old VIA C7 1GHz machine was overstrained with it. I just don’t know whether I’ll have that much time on the week end. 😉

Tags: , , , , , ,

eee box b202, ac3 and 720p x264 playback third try

Thursday, November 6th, 2008 | Gadgets, Tech-savvy | No Comments

I finally got mplayer to work. I just had to use another switch. The mplayer package I was using (MuldeR) had

-ac hwac3

as the default pass through switch.

Using (the original mplayer package and)

-afm hwac3

solved the problem. I did not really get the difference yet, this is what the man page says:

-ac

Specify a priority list of audio codecs to be used, according to their codec name in codecs.conf.

-afm

Specify a priority list of audio codec families to be used, according to their codec name in codecs.conf.

Next challenge was (and still is) av-synchronization. I had to configure a constant delay for ac3 files to be lip-sync AFAICT, after that I tried a POMA (Plain Old Mp3 Avi 😀 ), realizing the delay was different for mp3. So I started to use mplayer profiles and different short cuts on my desktop, dragging the files on the desired icon instead of just launching them according to their file extension. This really is a drag… even worse: after trying an x264 ac3 mkv I once again had to adjust the delay. Wow, now this really sucks, having to adjust the delay for every fricking container and audio format. I think that’s the price to pay to have a top notch home cinema system.

Tags: , , , , ,

Search

Categories