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
















mercredi 22 avril 2009

Unicode CString and Qt QString

arg!

with Visual Studio, if you don't define UNICODE in the PREPROCESSOR
then it is straightforward:
CString a("hello");
QString qtstring (a);

but if you define UNICODE then this code does not compile anymore :-/
you should do then:
CString a("hello");
QString qtstring = QString::fromUtf16( a.GetBuffer(), a.GetLength() );

an advise? yes, be careful to encapsulate this sort of transformation in those bloody MFC programs!

Yes I know, I should have spoken about CSV files and SQLite :-)
I will do it soon !

Bye

dimanche 19 avril 2009

My first blog

Waooo My first entry in my blog...
I am so impatient to share some technical point of views et some solutions I have found for helping myself...

stay tuned !!!