Thursday, June 25, 2009

Turn on English locale in psql PostgreSql client

Problem with encoding (unicode PSQL and cp1251 terminal)

That's kinda strange.
When you run the psql - PostgreSQL RDBMS console client - it picks up your current language (the one set up in your system). That's really cool, but it works in unicode, and if your terminal is not unicode (for example, cmd.exe on windows), you'll see something weird.
That's the example. (take a look at weird symbols after the 'count' results. I really think this is analog of 'row' in Russian)
The easiest solution of psql/terminal encoding problem you'd think of ever
Just type in
set LC_MESSAGES=en
in windows, or
export LC_MESSAGES=en
in UNIX, and you'll get it working. The cool thing is that it is written in psql documentation, but kinda not-that-easily-found. :)

Enjoy!

Tuesday, June 23, 2009

News from python struggle field

Decided not to use templating yet, but generate the html imperatively with the custom module, based on the JAxml.
Module should have simple notions of:
  • Atomic elements - paragraphs, links, text, &c
  • Grids (customizable and agile)
  • Automatic resolution of the attached pictures (through href="cid:picture1")
Don't have much time now really, hope to get on this after we release on the work :)

Friday, June 19, 2009

Searching for a good email/html....

Well. I'm searching for a good templating engine for python. For filling data (such as reports).
May be not only html, but full reporting library/set of routines.

If anyone knows - let me know.

Once I find it - I'll post results here :)

Learning python

I think I like Python very much...

I spent several days reading book about 2hrs a day, and wrote small script which reads database, prepares report, generates html content and sends this content as an email message (both html and text version, for old/specific clients).

The script is scheduled with the CRON and it just worked. So, i think this is really good result for the language you don't know.
  1. understand execution model
  2. incorporate database querying support (with named parameters, yeah :)
  3. understand how to generate html (I'm using jaxml module, it's kinda cool. creating html document just looks like doc.html().body(color="red").p(string, align="center") )
  4. understand how to send e-mail message (yes, mime knowledge gives good help, but neretheless. I'm sending this through GMAIL - so, SSL support is also here)
  5. understand how to work with dates (that's a bit ugly now, I'm sure there's better way of obtaining today timestamp than time.mktime(datetime.date.today().timetuple()) )
All this, resulting in a working solution, took for me about 6-7 hrs from the start. Without language knowledge at all :) : )

Learn python!

Tuesday, June 16, 2009

What's up with me

One may be interested in what's really going on...
I'm working. Working really hard, and have no minute of free time to drop something to blog :(

So, just as there is free second, I'll continue on this.

Btw, this message should better go to Twitter. Maybe, need to create an account there...