2008-01-28

Polyphasic sleep - sleeping less and better?

I've been planning to change my sleep schedule. The new year had come and it was good time to incorporate new habits. The first goal is to change sleep pattern to boost my creativity and make better time management through all day.

First step was to become more "early bird", it means getting up at least at 5 am. That part was easy.

So it's time for next step- polyphasic sleep. What is this all about? Instead of one big chunk of time dedicated for sleeping (usually 6-8 hours), polyphasic sleep is to take 4-6 20-30 minutes naps thorough all day.
The outcome is: summarized nap time is much shorter than usual sleeping time. And what is more controversial- you can be still rested and refreshed without health side effects. The biggest sleep time cut has Uberman's sleep schedule. One 20-30 minutes nap replaces one sleep cycle that average takes about 1.5 hour. The simplest form of polyphasic sleep is classic sleeping block plus siesta time.

I'm planning to use Everyman's sleep schedule. I have time to take 4.5 hour sleep, then one nap before leaving to work. Now it will be nice if I can afford short power nap during lunch time. And then one nap after work and dinner.

Sounds simple. I've tried to manage that schedule for few days. My first remarks:
- I didn't know that I can be so lazy to get up from bed at unusual time.
- It's hard so I have to keep more discipline.
- It's important to make most of used "sleep cycles". Keeping schedule and proper timing really makes difference.
- During adaptation I you feel sometimes like zombie at certain time of day.

Last week I caught a cold- so I held this experiment. I'm going to continue that as soon as I get better. So stay in touch and wish me luck.

2008-01-21

Looking for simple python chart library

I'm looking for simple chart library. I need it to draw stock quote and portfolio benchmarking charts.

I'm trying now pycha (python charts). It's simple but ready for most common applications. One drawback- I'm unable to setup needed cairo library on testing system, yet.

I will try to made it, but maybe there is another solution.

Do you know any python chart drawing library with less dependencies?

Update:
It is still one of the simplest and best chart utilities. I'm also using JavaScript generated charts in web browser.

2008-01-14

Mutual funds portfolio monitoring application - stage one finished

I have finished first stage of development of mutual funds portfolio monitoring application. Major bugs are fixed and all needed stats are calculated. I have been checking it on my investment account. Benchmarks don't lie- second half of 2007 was harsh for mutual fund investors :).

I'm working now on adding more visual appealing features like graphs etc. It needs also some refactoring and implementation of storing precalculated values - almost all features are data processing intensive. But more important are interesting portfolio stats, then I will work on scalability. After that I can think about first public alpha release.

I still don't have external python hosting service for development purposes, so if you know cheap one let me know.

2008-01-06

web.py update 5 - DbUtils pooling and apache MPM module

My application using web.py is still growing. One day happened something suprising. After testing on internal WSGI server, I deployed application at testing machine with Apache, and started checking. Login screen appeared and everything was looking ok. But after login I waited very long time and nothing happened. After couple of minutes (long timeout?) application finished request with exception inside DBUtils code. I've checked logs, another browser- still the same.

I googled exception code and found that it's something related with exhausted connection pool. Application grows and communication with database complicates too. I've add additional code closing connections. Still nothing.
Then I have found some interesting posts about DBUtils connection pooling method and problem related to apache MPM module.

Apache MPM modules are directly handling HTTP requests. DBUtils creates pool for application process. My default Apache configuration was MPM prefork. That means every http request is handled by one single threaded MPM process. DBUtils created pool for every apache handler process- that exhausted database connections.

There is simple solution if you use dedicated apache server- using MPM worker that works better with DBUtils multi threaded pooling.
Once again, the day was saved.