Xmas holiday project: PowerNap

I’ve wanted to implement a fully integrated Java based OSX tool for a while, during Xmas holidays I finally got to it: PowerNap.

PowerNap puts your computer to sleep after a given amount of time. Available for OSX and Windows.

featuring a design from my favourite web specialist :*

Sourcecode also available via GoogleCode.

Snap/Align windows on OSX (like Win7 does)

If you miss the Win7 way of aligning windows by pushing WinKey + ArrowKey on OSX, there’s help: https://github.com/fikovnik/ShiftIt

Just press ctrl+alt+cmd and a Arrow key and your windows will be arranged as you are used to.

Best of all: It’s free.

php :: check if person is adult

function isAdult($birthyear, $birthmonth, $birthday)
$birthdayTime = mktime(0, 0, 0, $birthmonth, $birthday, $birthyear);
$now = time();

$ageSeconds = $now - $birthdayTime;
$years = $ageSeconds / 3600 / 24 / 365.25;

return $years >=18;

if(isAdult($year, $month, $day))
echo "your adult! feel free to buy guns.";
echo "goto kindergarden!";

Ubuntu: Add a new swap file

create the new file with your desired size (usually swap file is as big as RAM)
Attention: dd count parameter means number of blocks (thus 4GB = 4 million blocks with blocksize 1K)


#create the new file
dd if=/dev/zero of=${SWAPFILE} bs=1024 count=${BLOCKCOUNT}

#format the file with swap file system:
mkswap ${SWAPFILE}

add the new file with type swap to fstab:
vi /etc/fstab

add new entry for swap file:
/path/to/swap.file       none            swap    sw              0       0

remount fstab:
mount -a

activate swap for all entries in fstab:
swapon -a

show if everything worked well and swap space has changed:

ssh access without password

client —–> server

create the client’s ssh key (if not existing already)

ssh-keygen -t rsa

if you’re adding the first key, just copy the public key ~/.ssh/id.rsa_pub to the server

scp ~/.ssh/id_rsa.pub user@server:.ssh/authorized_keys2

to append another key, use:

cat ~/.ssh/id_rsa.pub | ssh user@server 'sh -c "cat - >>~/.ssh/authorized_keys2"'


sudo mkdir /media/ramdisk
sudo mount -t ramfs ramfs /media/ramdisk

free vectors and stuff


PHP remote debugging in Eclipse PDT

in order to start remote debugging your php scripts right from your development server, you’ll need the Zend debugger for your server’s platform from here:


Chose the right ZendDebugger shared library for your PHP version (e.g. 5_2_x_comp/ZendDebugger.so) and copy it to your server – most likely where your other PHP extensions reside (in my case a turnkey LAMP stack —> directory /usr/lib/php5/20060613+lfs)

Now add a little information to the end of your php.ini. Make sure, you use the right php.ini file (if you’re unsure: consult phpinfo() under the key “Loaded Configuration File”)

zend_extension = "/usr/lib/php5/20060613+lfs/ZendDebugger.so"
zend_debugger.allow_hosts =

Of course adjust the first to lines accordingly. Allowed host is the IP address of the PC that’s running your Eclipse IDE. For more information on these directives, consult TFM 😉
Just a small notice on ‘allowed_hosts’: You can define full netmasks here, such as – that means every IP in 192.168.*.*  – perfect for home DHCP or teamwork.

If your installation work was succesful, you’ll see a new paragraph in phpinfo() output that refers to as “Zend Debugger”

nokia pc suite – force a full sync

simply delete the cached data stored in a folder like:

recover data notes

recovering data from an sdcard is possible with oss:

create an image of your drive using dd:

dd if=/dev/disk1 of=/path/to/my/image.img

get foremost at
then extract and make it

you can specify a type, e.g. MOV

./foremost -t mov -i /path/to/my/image.img -o /path/to/my/recovered/files