May 7th, 2007
linux
Some special characters like ~ (tilde) cannot be typed by simply pressing the key combination. This is true at least for german keyboard layouts and Ubuntu 6.10 (Edgy Eft) and 7.04 (Feisty Fawn).
To prevent this behaviour and display the character upon the first stroke add the following to you /etc/X11/xorg.conf under the section Input Device for identifier Generic Keyboard:
Option "XkbVariant" "nodeadkeys"
My section looks like this:
Section "InputDevice"
Identifier "Generic Keyboard"
Driver "kbd"
Option "CoreKeyboard"
Option "XkbRules" "xorg"
Option "XkbModel" "pc105"
Option "XkbLayout" "de"
Option "XkbVariant" "nodeadkeys"
EndSection
May 6th, 2007
encoding, linux
Another chapter of the book “Encoding is hell”
Today I noticed that some files in one of our projects suddenly have been converted to UTF-8 where they should have been in ISO-8859-1. Ok, short question: How to convert it back?
Short Answer
Use iconv like this:
iconv –from-code=UTF-8 –to-code=ISO-8859-1 inputfile.txt > outputfile.txt
March 15th, 2007
mysql
Today I had a hard time dealing with mysql and transactions. Somehow my transaction has been committed in the middle of the statements. A short look into the manual revealed that there are SQL command that implicit commit a transaction. While I do understand that CREATE TABLE commits a transaction, I was surprised that LOAD DATA INFILE does it too!
And since I use the nice REPLACE INTO SELECT ... workaround found on mysqlperformanceblog (Hint: Always a great resource!) I had to upgrade my development mysql server because since version 5.0.28 LOAD DATA INFILE does not commit a transaction.
MySQL manual
February 27th, 2007
apache, security
A neat tool to scan you apache server for “some” (more than 3.000) known security problems including general configuration problems (directory indexing) and wide spread scripts vulnerabilities.
Remember to verify each problem reported though!
Visit the Homepage for further information.
February 22nd, 2007
mysql
I recently found a great article on mysql performance blog giving you a short and precise description of what to tune in the first place.
This is a must!
February 21st, 2007
blogging, wordpress
After migrating from wordpress 2.1 to wordpress-mu 1.0 I was not able to write source code like XML inside <code> tags. I searched the web and tried some plugins - to no avail
Finally I decided to go the brute force way by editing wp-includes/kses.php and removing the whole code. Therefor I changed the wp_kses method to:
function wp_kses
($string,
$allowed_html,
$allowed_protocols =
array (‘http’,
‘https’,
‘ftp’,
‘news’,
‘nntp’,
‘telnet’,
‘feed’,
‘gopher’,
‘mailto’))
# Don’t do anything
# just return the string untouched
return $string;
}
It is really ugly though…
February 20th, 2007
xml
Using CDATA to embed raw data within XML is a quite convinient feature. But the XML spec lacks the possibility to have a CDATA containing another CDATA or even the string ]]>.
So what happens if you put content like this within a CDATA section?
<![CDATA[
Just a ]]> test
]]>
Your XML writer or at least any descent parser will complain it is not valid XML! Even the color coding on this page reveals that
What to do?
The easiest (and IMHO most compatible) way of handling this is to build multiple CDATA sections, like this:
<![CDATA[
Just a ]]>]]><![CDATA[test
]]>
February 17th, 2007
crossbrowser, java, jsp
I guess almost everybody has been hit by the “IE shows only a blank page” issue while experimenting with XHTML back then. It is because IE requires a closing tag. The following fragment will not work in IE:
<script type="text/javascript" src="…" />
But this works:
<script type="text/javascript" src="…"></script/>
Ok, we learned that.
Today I had a hard time with IE showing a white page and all I had done was converting an old .jsp into a .jspx file.
What happened?
After hitting google with every type of phrase I could imagine describing my problem, I finally found it out: The servlet container (Tomcat 5.5.12) removed the closing script tag because the content of the script tag was empty. DOH!
What did the trick?
For now I do the following:
<script type="text/javascript" src="…"><– –></script/>
Wow. If you love surprises - do web development. 