All posts in 'English posts'

Linux: Persistent wake-on-lan

03-Mar-10

Just a quick reminder for myself: You need to enable wake-on-lan on the nic in most linux distributions via ethtool. If your nic supports WOL, it probably needs to be enabled in your computers BIOS first. Most WOL tools use the “MagicPacket(tm)” method, so the right command to enable it on the nic “eth0” would […]

Read the complete article »

Oracle: Drop table if exists replacement

16-Feb-10

Mysql has a nice “if exists” addition to the drop table statement. If the table to be dropped does not exists, it doesn’t raise an exception but only creates a warning. In Oracle RDMBS you can emulate this behavior like so: BEGIN EXECUTE immediate ‘drop table INSERT_TABLE_NAME_HERE’; EXCEPTION WHEN others THEN IF SQLCODE != -942 […]

Read the complete article »

An iterable array

12-Jan-10

Java has the nice Iterable interface (since Java 5, i guess) that allows object oriented loops like List<String> strings = new ArrayList<String>(); for(String string : strings) System.out.println(string);List<String> strings = new ArrayList<String>(); for(String string : strings) System.out.println(string); but guess what, a simple array is not iterable… In case you need one, feel free to use this […]

Read the complete article »

Today: Fun with Unicode, Regex and Java.

03-Nov-09

Some would say, i have 3 problems 😉 private final static Pattern placeholder = Pattern.compile("#\\{(\\w+?)\\}");private final static Pattern placeholder = Pattern.compile("#\\{(\\w+?)\\}"); won’t match “Mot#{ö}rhead” for example. To replace the word character \w you either need the list of possible unicodeblocks like [\p{InLatin}|\p{InEtc}] (you get the codes for the blocks through “Character.UnicodeBlock.forName” or you’re lazy like […]

Read the complete article »