lundi 25 mai 2009

SQLite and CSV files

SQLite is really great !
I use it now in almost every application I do :-)

My way to work is to combine the shell script with it,
the result is amazingly fast and clean :-)

but I "recently" solved what I imagined as the weakness of the Sqlite command line:
it is the CSV import !

in real work life, we need to treat CSV files like:
my field 1,"my opinion, my view on it", my field 3

or simply a field on multiple lines like
"my
multi-lines
field",...

the .import does not manage this kind of CSV file....

I wrote a state machine (a big switch/case) to parse the CSV file.
I progress in my state machine by getting the next character until the end of the file.

The funny thing is that I always try to rely on ".import" when I know I am using simple files,
but I had to change it for one file, the day after I wrote my own parser :-)
funny isn't it?

long life to SQLite !













Linux in the VMWare fusion (macosx)

I am since 3 years converted to the macosx... it gives me the power and freedom of unix (shell script, all gnu softwares, etc) and a superb interface with "must-have" softwares like photoshop, dreamweaver, flash, etc

... on another hand, it is good to continue to learn on linux as 99% of hosting providers are on linux. I recently had a look on a dedicated server ... linux!

then I installed the gentoo first (the one I know and I prefered few years ago), spent 2 days on it, and honestly disappointed of the long compile time...
then I installed (...just to see) a fedora 11 (preview) and a suse 11.1.
it was so fast, with a working KDE in 20 minutes !

then I tried to install the vmware-tools... a nightmare ! it doesn't compile on fedora 11, neither on suse 11.1 :-/

then I tried the fedora 10, and it worked perfectly in 2 minutes (d&d, resizable, shared folders) ... then I stay with the fedora.
-> It seems easier than the suse, I like the "yum" program.

The most funny thing is I installed KDE and gnome to compare, but gnome is better.
I am a unconditional fan of Qt and with a certain extent of KDE, but I should say that the KDE 4.1.2 is not really usable.
.... then I will stay with Gnome for now... waiting a good release of KDE :-)

Also I found that Linux in a VM is really excellent,
-> I can try without breaking anything -> snapshot / restore :-)

good work for redhat ! I was really amazed of the simplicity for installing their distribution.
(I probably become too old and go straight to the simplicity)

Good night!

Cheers