Posts for English posts
Some useful text manipulation commands
In one of our works we have to import several csv files into Postgresql. Unfortunately, the files can't be imported without tweaking. For example we have the following csv (but with dozens of columns): Col1-bool;Col1-string;Col3-string;Col4-integer;Col5-float;... False;Hello;;NULL;5,6;... Several things can be noted about this small csv snippet: * As you can see, the csv file doesn't contain an id column. Actually, there might be no primary key columns at all. * Second, the strings are unescaped. Thankfully, there are no line breaks! * Third Col3 string column can't contain a NULL value * Fourth, the NULL string doesn't mean a NULL value, but a NULL string, this it will cause an error * Fifth, the float separator is , instead of. So, how to correct all these problems easily? It's still a tedious task, but works out relatively easy with vim/sed and awk. Here comes a collection of the commands used.
Integrating WYMEditor with django
There are several possibilities to integrate a WYSIWYG editor under the admin. But what to do if you want a general solution? For our eKE Translation Project Management we opted to use WYMEditor, and wrote a couple of snippets to get it properly working.