install Sun Java on Ubuntu

add-apt-repository "deb http://archive.canonical.com/ lucid partner"
apt-get update
apt-get install sun-java6-jdk
update-alternatives --config java

new Java Decompiler

Everybody working with Java has met JAD some time sooner or later.
Unfortunately JAD is pretty old, has no GUI and cannot handle Java 5/6 bytecode.

Now there’s a new player in town – you can directly open JAR archives in its nice GUI:
http://java.decompiler.free.fr/?q=jdgui

Audi/e.solutions on CES 2011, Las Vegas

There are many articles about Audi on CES, I think this is one of the best:
http://www.golem.de/1101/80597.html (german)

By the way: e.solutions is Audi’s joint venture to develop the new MMI infotainment system for the next A3 in 2012.

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.

PowerNap screenshot
featuring a design of 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.";
}
else
{
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)


SWAPFILE=/home/swap.file
SWAPMEGABYTES=4096

#create the new file
BLOCKCOUNT=$(($SWAPMEGABYTES * 1024))
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:
free

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"'

ramdisk

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

free vectors and stuff

http://www.bittbox.com/category/freebies/