June 20, 2008
· Filed under Python, Technology

These days I’ve been working with SMS messages. Due to the fact that I work in a Greek company, the character set of these messages should be Greek (or able to contain greek letters). As far as I know there are 3 options to accomplish this:
- Use unicode (UCS2, it’s like UTF-16). But you’ll get only 70 characters per SMS.
- Use GSM 03.38 encoding. You get 160 characters per SMS, but a reduced set of characters.
- 8 bit encoding. I wasn’t able to figure how this work with the Greek charset (yet).
So for our new SMS delivery system we decided to go with the almost universal GSM 03.38 encoding. Also we changed our hacked java
SMPP client to
pythomnic and it’s SMPP library.
That works great but the library doesn’t know anything about encoding. Using iso-8859-1 works, but for Greek we need some kind of “automatic conversion”. This was done using a python encoding module (for python 2.4).
From Greek to GSM 03.38 you have to understand that gsm supports only a few greek letters, they’re in uppercase and without tones. Therefore:
- All lowercase greek letters are transformed to uppercase.
- Tones and diaeresises are removed.
- For some upper case letters, latin ones are used instead. Example: rho: ρΡ -> P (Even in a web browser is difficult to see the subtle difference).
Example:
>>> import gsm0338
>>> msg = u”Αναταράξεις στο πολιτικό σκηνικό προκαλεί η υπόθεση Siemens”
>>> msg.encode(”gsm0338″)
‘ANATAPA\x1aEI\x18 \x18TO \x16O\x14ITIKO \x18KHNIKO \x16POKA\x14EI H Y\x16O\x19E\x18H Siemens’
ANATAPAEI TO OITIKO KHNIKO POKAEI H YOEH Siemens
>>> print msg.encode(”gsm0338″).decode(”gsm0338″)
ΑΝΑΤΑΡΑΞΕΙΣ ΣΤΟ ΠΟΛΙΤΙΚΟ ΣΚΗΝΙΚΟ ΠΡΟΚΑΛΕΙ Η YΠΟΘΕΣΗ Siemens
If what you see is useful for you, here is the gsm0338.py encoding module for python 2.4.
Tags:encoding, gsm 03.38, python, python 2.4 »
June 8, 2008
· Filed under Friends, Greece, Personal, Places

After long Friday and Saturday finishing some java and xhtml jobs, Sunday was the perfect day to take things easy and spend the day with friends. We (Sascha and me) decided to go to Markopoulo, Panos base camp, and try to relax.
Panos was repairing his iBook. The harddrive of that beautiful piece of technology broke, and he got a new one. But disassembling a laptop is not easy: lots of screws around, manuals, drafts and of course the uncertainty of “will it work? or I’ll break it?”. So that was the reason we decided to give him some company and support.
But panos is very capable of doing that job. What will we do meanwhile? Well, I wanted to learn about Zope, and he works with Zope: perfect combination (no, not a “secret combination“). So Sascha prepared a tutorial on how to install Zope, and some examples. Also he introduced me to Darcs (code management system), and we were playing a bit with that and the local area.
Also I introduced him to Git (another code management system). But I’m not so expert on git, and also Git installation on Mac OS requieres patience and be able to stand MacPorts installing everything on your system (even if you had it). Anyway, you should check this video about Git with Linus Torvalds talking in Google. It’s about git, but it can be about any distributed source control system.
We did a stop for lunch, and perhaps because the planet was bored (it happens from time to time), an earthquake happened. I didn’t feel it, perhaps the two pizzas we ordered left me a bit numb (I fixed that with a fresh frape).
After the iBook surgery was complete, we went to the nearest beach (Markopoulo has no sea, but it’s near) on “Porto Rafti” for a quick and fresh swim. The water was a bit cold, but at 6 in the afternoon, there was no one there
We were talking about how would be life doing the same job we do, but doing it in a small island in the Aegean sea. A VPN to the main office, no traffic jams, living near the beach, good food and cheap coffees.
Nice things to note from today.
- Zope seems a powerful web application server for python. I have to give it some time.
- Darcs also seems good. I’ll continue my experiments with Git, but now I know that I can work with Sascha really easily using Darcs.
- MacPorts behaves in a silly way when he wants to install software that it’s in your system. (The next step is to compile the Darwin kernel in order to install bash).
- I do not feel earthquakes when I’m sleepy.
- Love to have a swim late in the afternoon.
Now we continue slacking off while Panos installs Tiger in his iBook. I guess it’s time to return I still have to clean the dishes from yesterday and prepare dinner
(Well, breaking news, we will have dinner here). Tomorrow more boring office job not doing much, just a bit here and there and waiting for the typical “We have to fix this for today” at 5:30 in the afternoon.
Tags:Darcs, Git, markopoulo, Panos, python, Sascha, Sea, Zope »
May 24, 2008
· Filed under Music
In a month Linkin Park will come to Athens. Talking about this with a friend and looking for more information I found some Linkin Park covers. They are with piano, violin and a new voice. I did like them. I hope you enjoy
Tags:cover, Linkin Park, piano, violin, vocals »
May 23, 2008
· Filed under Technology

I’ve chosen Hostmonster as a shared hosting provider for one my projects using Django. I’ve been using hostmonster for this blog so I wanted to give it a try for more professional matters. The problem is that hostmonster is not django/python friendly. I’ve found the following problems:
As you can see:
$ python -V
Python 2.3.4
$ svn
-bash: svn: command not found
But not supported doesn’t mean impossible. You can have your python 2.5 and Django from subversion (And everything you want to install). You only need to install the software we need from scratch. If you want to know how, just read the rest of this entry.
Read the rest of this entry »
Tags:.htaccess, django, easy_install, Hostmonster, mysqldb, python, shared hosting, subversion »
May 15, 2008
· Filed under Technology

Are you one of those who uses Internet Explorer 6? This post is dedicated to you, fellow visitor who enjoys the web using a great piece of software. For you it’s time to Stop IE6.
Thanks to you, the development of the web is slower. And because you continue using IE6, web developers from all around the world have to implement fixes for you to enjoy the web. So please, make the world a favor: Update to Internet Explorer 7 (or Internet Explorer 8). Or even better: use other browsers like: Firefox, Opera or even Safari. IE6 was a great piece of software time ago, in 2001 when it was launched. But 6 years have passed and it’s time to move on.
For all the rest. I’ve been analyzing the support of some WEB standards on IE6, and it’s hell. It lacks the support of modern standards that makes life easier and web styles compact and easy to read (I won’t talk about bugs). So if you want to develop a webpage you have to spend extra time (and time is money) developing hacks for IE6. Some of those patches are available on the internet, but you still spend time taking care of an old museum piece.
So now I have to work with web development and then, when everything is finished, work to attach available hacks and implements what the hacks cannot patch.
And you, web developer who develops only for Internet Explorer (like eurobank e-banking). You, will be next.
Meanwhile, update your browser and try the alternatives 
Tags:Browser, Firefox, IE6, IE7, IE8, Internet Explorer, Opera, Safari, Web »
May 11, 2008
· Filed under Apple, Technology

Installing the python library for MySQL in Leopard can be a bit tricky. If you’re an easy_install lover, the first thing to try would be:
$ sudo easy_install MySQL-python
But the results you’ll obtain will be not very encouraging.
Searching for MySQL-python
Reading http://pypi.python.org/simple/MySQL-python/
Reading http://sourceforge.net/projects/mysql-python
Reading http://sourceforge.net/projects/mysql-python/
Best match: MySQL-python 1.2.2
Downloading http://downloads.sourceforge.net/mysql-python/MySQL-python-1.2.2.tar.gz
Processing MySQL-python-1.2.2.tar.gz
Running MySQL-python-1.2.2/setup.py -q bdist_egg –dist-dir /tmp/easy_install-07GTpt/MySQL-python-1.2.2/egg-dist-tmp-t78bko
In file included from /opt/local/include/mysql5/mysql/mysql.h:47,
from _mysql.c:40:
/usr/include/sys/types.h:92: error: duplicate ‘unsigned’
/usr/include/sys/types.h:92: error: two or more data types in declaration specifiers
In file included from /opt/local/include/mysql5/mysql/mysql.h:47,
from _mysql.c:40:
/usr/include/sys/types.h:92: error: duplicate ‘unsigned’
/usr/include/sys/types.h:92: error: two or more data types in declaration specifiers
lipo: can’t open input file: /var/tmp//cczla7iC.out (No such file or directory)
error: Setup script exited with error: command ‘gcc’ failed with exit status 1
But the solution is there. As you can see, the command talks about an error in line 40 for some file called _mysql.c. We’re going to get to that file and remove one line.
First we need to download the package. We will use easy_install, but later. So now grab your wget or your browser to here. And when you have the file, uncompress it (terminal or through finder).
$ wget http://downloads.sourceforge.net/mysql-python/MySQL-python-1.2.2.tar.gz
…
$ tar xzf MySQL-python-1.2.2.tar.gz
Now go to the directory that has just been created and open the file _mysql.c. Go to the line number 38.
35 #include “my_config.h”
36 #endif
37 #ifndef uint
38 #define uint unsigned int
39 #endif
40 #include “mysql.h”
Delete line 38, save and install your modified egg from the parent directory with:
$ easy_install MySQL-python-1.2.2
Processing MySQL-python-1.2.2
Running setup.py -q bdist_egg –dist-dir /Users/alff/tmp/MySQL-python-1.2.2/egg-dist-tmp-S4uIM7
ld: warning in /opt/local/lib/mysql5/mysql/libmysqlclient_r.dylib, file is not of required architecture
ld: warning in /opt/local/lib/libz.dylib, file is not of required architecture
ld: warning in /opt/local/lib/libssl.dylib, file is not of required architecture
ld: warning in /opt/local/lib/libcrypto.dylib, file is not of required architecture
zip_safe flag not set; analyzing archive contents…
Adding MySQL-python 1.2.2 to easy-install.pth file
.
Installed /Library/Python/2.5/site-packages/MySQL_python-1.2.2-py2.5-macosx-10.5-i386.egg
Processing dependencies for MySQL-python==1.2.2
Finished processing dependencies for MySQL-python==1.2.2
The problem was that _mysql.c defined the type unit and that type is defined again when it includes the file mysql.h. We remove the duplicate, the compiler is happy
Edit: If you installed mysql5 with MacPorts, and you get the error EnvironmentError: mysql_config not found when installing the egg. Just add a link from mysql_config to mysql_config5.
# which mysql_config5
/opt/local/bin/mysql_config5
# cd /opt/local/bin/
# ln -s mysql_config5 mysql_config
Tags:easy_install, leopard, Mac, mysql, mysqldb, python »
May 8, 2008
· Filed under Greece, Personal

Easter holidays are totally over. They started (for me) on April 23th, but using the official calendar on April 25th (my birthday). I decided to stay away from the office, starting on 23 till 29th, and go to a small village in the north. A nice green place where you can sit outside in the morning and see green hills. Also you eat fresh food and some times vegetables from the house garden. In there I found myself again. I also found a turtle eating a whole lettuce in the garden. I guess it found itself too, eating healthy food.
These holidays are mainly used by people to return to their home places. Reunite again the family and have some relaxing time. I shared my time with Stella’s family. Mostly they get on really well, and all the family is like a group. I enjoyed a lot going with the “young” generation for coffee or for a walk.
But in order to reunite the lovely family… a long trip. Usually everybody travels, and in a big place like Athens, is an exodus. There are not so many highways in Greece, and the 1 lane per way national roads don’t help much during Eastern. I left early (in the week) so I arrived safe and on time
The traditions here are a bit different from Spain. There are no religious parades carrying huge sacred figures. But there are important events where people gather. One is the “death of Jesus Christ” where in the end there is a small parade around the church.
The other is “The holy light” after sundown on Holy Saturday. Here after mass, the priest lights a candle that is supposed to carry the holy light. Then, people lights their candles using that one or other people’s. After that you get one boiled egg painted in red and “play” with other people to break it. If your egg survives you’re supposed to have good luck.
And on Sunday after the Holy Saturday: meat. Meat in huge quantities. The tradition is to roast a goat, and prepare other meals with parts of the goat. The bad it’s that i don’t like liver, and some of these foods are based on it
But tzatziki can fix almost everything
Appart from that, only relaxing in a small village. About the village I’d like to point that a lot of people returned there, so it was quite full. Full of people and cars, but not only normal cars also expensive ones. The most expensive was an Aston Martin parked in the Kafenio (sorry no pic, I was so astonished I forgot to take one). But others where:
Do people spend all their money in cars? Or in petrol for their cars? 
Tags:Cars, County, Easter, Greece, Holidays, Turtle »
April 24, 2008
· Filed under Greece, Personal, Places

Is Eastern in Greece these days. It means: a lot of religious stuff, a huge amount of people returning to their home villages and food lots of food. I don’t have a place I can call “my village” here in but I “inherited” one from Stella
(one in Arta).
So these days I’ll be eating a lot and having coffee and not worrying about many things (only about people I care about). No office, no 2nd job, no pollution (Internet via GPRS). Just fresh air and natural food.
When we arrived to the village we were received with fresh cuttlefish (it melted in my mouth) and some fresh vegetables. I wasn’t hungry but I had dinner (I couldn’t avoid it).
Now it smells to…. Χοριό/Village/Pueblo.
Tags:arta, eastern, pueblo, vacations, village »
April 9, 2008
· Filed under Meme, Personal
7 quirks.
I got tagged for this meme by the greek cat who saunters along Athens streets. But I was looking for a meme, so “thank you” for making my life easier choosing one
Rules.
- If you get tagged, you have to tell who tagged you and link to your tagger form your post in your blog.
- Post these rules.
- Write 7 non-important things/habits/quirks about yourself.
- Name 7 of your favourite blogs.
- Send an email/comment/trackback/pingback on their blog letting them know they have been tagged.
My 7 non-important things/habits/quirks.
- I like Mechs and derivates.
- Every time I cook something with a stock cube, I eat a bit of the cube.
- I play with my eyebrows when I think.
- I can sleep everywhere, from a bus in Athens to a disco pub.
- I’m a hidden fan of Pitchshifter.
- Music with multiple voices in different tones gives me goosebumps.
- I love colorful underwear.
My 7 favourite blogs.
- Nazgul - Diario de un indecente..
- Sascha - ch-athens.
- Kat - An American in Athens.
- Lynn - Business Writing.
- Guyunusita - El rincón de Guyunusita.
- Jordi - Sin Proyecto.
- EllasDevil - Μιλάτε, σας Ακούμε.
Also I’d like to slap reydelamirienda for having us without any light about his life in Netherlands.
Tags:April, blog, Meme, Personal »
April 5, 2008
· Filed under Apple, Personal

Sometimes you walk in the street and you don’t pay attention to the multiple details the objects placed in your way offer to you. But also you have to stop form time to time to see what’s around you. And you can find hidden Mac fans like the one in the picture.
I went to pick money from ATM and I don’t know why, I walked around the area and found this Apple labeled scooter. As you know there are multiple places where to put that sticker.
Tags:Apple, mac logo, scooter, sticker »