- RT @Danny_DeVito http://twitpic.com/1159g9 – "Ich weiss auch nicht was es ist meine Dame, aber es isst mein Popcorn #
- RT @THEsaragilbert Someone on American idol just said they were born in 1993. What? #
- RT @HannoSettele Die orchesterierte Toyota-Vernichtung geht weiter. [.] nie gesehen, das ist neu. 7 Jahre in USA, [.] eine neue Qualität. #
Sunday, February 7, 2010 at 8:00 am
Twitter Weekly for Week 2010-02-07
Sunday, January 31, 2010 at 8:00 am
Twitter Weekly for Week 2010-01-31
- RT @tweetmeme RainyMood.com http://bit.ly/1pEoI #
- RT @Serienjunkies Lost: Der Absturz von Oceanic 815 in Realtime http://tinyurl.com/ydjas4j #
- RT @HannoSettele 3 Jahre alt, aber gut, sehr gut: http://bit.ly/FSAu6 — really good, so sad. #
at 1:44 am
Perl: Net::MySQL “packets out of order”
Found another issue with Net::MySQL (after this one). Why are we using that again? Ah yes, it’s pure Perl and we hate compiling modules. Well, you get what you pay for.
When inserting a lot of data it is better to create one huge insert statement then thousands of small ones. When you do that you have to make sure that your server accepts huge amounts of data by setting an appropriate value for max_allowed_packet.
Furthermore the MySQL protocol defines a “MySQL packet” to have a header of three bytes for the length followed by a one byte counter. The packet body starts with one byte command followed by data (a SQL query or response). With three bytes you can count up to around 16 million or in other words a MySQL packet can only be 16MB long (plus four header bytes), because that is the maximum value for the length field.
What Net::MySQL does in this case is: nothing. It sets a length value that is too big for three bytes, ignores the need for a counter and just keeps pouring data into the socket like there is no tomorrow without splitting into packets. The server reacts with a connection reset and “packets out of order” error. At least that is what we have observed.
I’ve sent a bug report and patch to Net::MySQL’s bug tracker.
Thursday, January 28, 2010 at 12:01 am
cx_Oracle: Error after setting NLS_LANG
I am working with a database containing Unicode data in NVARCHAR2 fields. Selecting rows that contain those fields just works with current cx_Oracle and SQLAlchemy as long as I don’t actually try to limit my result set by one of those in the query (like '%ü%'). I tried it with PL/SQL Developer and like unistr('%\00fc%') worked.
The SQLAlchemy documentation says that with cx_Oracle >= 5 everything should just work, but earlier versions needed NLS_LANG set in the environment. Unfortunately they do not tell you anywhere near that paragraph that SQLALchemy <= 0.5.x needs it too. It took me another hour to find that information here. So set NLS_LANG to something like this and go selecting:
export NLS_LANG='AMERICAN_AMERICA.UTF8'
There is one trap however. Do not set ‘AL32UTF8′! Reading Oracle docs lead me to believe ‘UTF8′ or ‘AL32UTF8′ were valid values for NLS_LANG. They are not (so it seems) and setting them caused my app to crash with the following when connecting (which is not a very helpful message, if you do have ORACLE_HOME set properly):
sqlalchemy.exc.InterfaceError: (InterfaceError) Unable to acquire Oracle environment handle None None
More about valid values here.
Monday, January 25, 2010 at 12:33 pm
Flickr: Sonnwendstein in Winter
Sunday, January 24, 2010 at 8:00 am
Twitter Weekly for Week 03
- face detection in #picasa 3.6 is creepy. it just scanned my old photos from the Euro 2008: hundreds of people identified. #fb #
- Interesting: The Source of Europe's Mild Climate, American Scientist http://bit.ly/5T9rNS #fb #
- rubber duck debugging: http://bit.ly/7HO2oK (works also for non-code issues!) #fb #
- RT @muesli Bitte helft mir, Projekte für den Prix Ars Electronica zu nominieren: http://bit.ly/7J6VtH #digitalcommunities #
- RT @tomhanks Look out! Going on CoCo on Tuesday. That’s the plan, anyway. Hanx #
- #coco livin' large http://bit.ly/5z3BvQ #
- things the world does not need: RT @NextGenCom Twitter Expands Its Horizons http://bit.ly/70h9LF #
- teeworlds: a really fun, fast, cute, multiplayer 2D shooter http://www.teeworlds.com #fb #linux #
Saturday, January 23, 2010 at 9:50 am
flot: Javascript plotting for jQuery
When eye-candy and function meet, you get perfection. Now add ease of use and offloading of a few CPU cycles to the client and you get flot. It’s a JavaScript library for jQuery that creates beautiful diagrams from your raw data… just like that. It just works.
Take a look at this… awesome!
This picture was generated from data collected from plain text logfiles inserted into MySQL using Perl, queried using Python/SQLAlchemy, served using a Python/WSGI application through SCGI using flup and Apache2 and plotted using JavaScript on Mozilla Firefox… and I get paid to do that!
Sunday, January 17, 2010 at 5:00 pm
Twitter Weekly for Week 02
- RT @SciFiHeaven Firefly to live on in new book of short stories http://bit.ly/8JKUUK #
- RT @ZacharyQuinto the flag has been planted. june 29th, 2012. sequel. trek it out. #
- 300+ Easily Installed Free Fonts for #Ubuntu http://ow.ly/SPZ3 #
- feature rich screenshot tool for gnome http://shutter-project.org #shutter #
- Sooo, nobody cares about Google Wave, right? http://yfrog.com/09screenshot003cmp #fb #
- RT @ginatrapani: "Facebook employees can 'query the database' to read yr private messages." Unsurprising but alarming. http://bit.ly/6nvGdy #
- Python Code snippets https://wiki.ubuntu.com/Quickly/Snippets #
- Coco is done with it… http://bit.ly/4zYhps #teamconan #
- sqlalchemy 0.6 will support the pure python module mysqlconnector: http://bit.ly/6GqAsL yay! #
- RT @scsmith41 Craig's Spanish word of the day: albondigas. Good to know! I shall memorize it. #craigferguson #
- RT @simonpegg I can't abide slush. Snow always arrives with a magical hello and leaves with a gigantic fuck you. #
- RT @Alyssa_Milano #Haiti sometimes even the most veteran of news correspondents break down: http://bit.ly/707JsR (via @MailOurMilitary) #
- Asus P5B mainboard only supports more than 3G RAM when "memory remapping" is enabled in the BIOS setup. #
- Why I didn't Buy You a Drink. Etiquette of intersexual drink-buying. http://www.reddit.com/tb/aqjc1 #reddit #craigslist #
- RT @alyankovic Ah, I get it now. Jay’s been doing a 5-year-long Andy Kaufman-esque prank. Hilarious! http://bit.ly/8WNp5V #teamconan #
at 3:59 pm
Ubuntu: More Fonts
In the dawn of the second century of the third millennium I thought the time was now finally right to switch to a 64-bit operating system on my desktop, so I installed Karmic AMD64.
After every re-install you have missing applications or packages and this is a good cleaning process. You just do not reinstall the crap you don’t need anyway and think about what things you actually need. So I was thinking about fonts this morning.
The absolute non-Ubuntu-default minimum for me is:
apt-get install ttf-inconsolata sun-java6-fonts
This installs Raph Levien’s Inconsolata and the Lucida fonts. Both make coding a lot nicer. If interested in a lot more fancy fonts I can recommend this great article for 300+ free fonts.
In case that is still not enough for you, you can also quite easily install the new Vista fonts by Microsoft (Consolas, Calibri, etc), as described here or manually like this:
- download the Office 2007 Comparability Pack
- make sure you have cabextract installed
- extract the *.ttf files and put hem in ~/.fonts
Microsoft should consider making it legal to add those to the mscorefonts package, they look really good.
Here’s a nice “top 10″ list of programming fonts: http://www.hivelogic.com
Finally, for webdesign I want to recommend this site: http://www.typechart.com
Thursday, January 14, 2010 at 1:23 pm
Python: Building MySQL-python 1.2.3c1 on Solaris 10 with MySQL 5.1.42
Trying to build MySQL-python from source on Solaris 10 when using MySQL 5.1.42 (pkg from mysql.com) may fail with something like this:
gcc -fno-strict-aliasing -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -Dversion_info=(1,2,3,'gamma',1) -D__version__=1.2.3c1 -I/opt/mysql/mysql/include -I/opt/alcatel/logger/include/python2.6 -c _mysql.c -o build/temp.solaris-2.10-sun4u-2.6/_mysql.o -g -mt -m32 -xarch=sparc -DHAVE_RWLOCK_T -DUNIV_SOLARIS -DUNIV_SOLARIS gcc: warning: `-x arch=sparc' after last input file has no effect cc1: error: invalid option `t' error: command 'gcc' failed with exit status 1
It happened to me on a Sun Fire V240 (sparc), but may also happen on i386.
The problem here is the “-mt” option. As mentioned in this forum post the “-mt” option is targeted at IA-64 platforms. This option is used because it is also used in MySQLs “–cflags” and setup.py uses mysql_config to determine build options. If you run mysql_config you probably get something like this:
# /opt/mysql/mysql/bin/mysql_config --cflags -I/opt/mysql/mysql/include -g -mt -m32 -xarch=sparc -DHAVE_RWLOCK_T -DUNIV_SOLARIS -DUNIV_SOLARIS
To overcome this I added “m” to the compiler options to ignore in setup_posix.py in line 55:
removable_compile_args = [ compiler_flag(f) for f in "ILlm" ]
This makes it not use the “-mt -m32″ options from mysql_config. The “-m32″ option makes gcc generate code for 32-bit systems and regarding the “-x arch=sparc”: gcc ignores it anyway:
gcc: warning: `-x arch=sparc' after last input file has no effect
Furthermore there is a bug in the setup.py that seems to link dynamically even if you configure it to link statically in site.cfg. There is a patch attached to this ticket.


