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 […]
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 […]
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 […]
It is harder than i thought to create a simple Zip Archive from within Java that contains entries with unicode names in it. I’m actually to lazy to read all the specs, but it says something that the entries in a zip archive are encoded using “Cp437”. The buildin Java compressing api has nothing to […]
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 […]