2008-02-25

Blending scripting languages in modern enterprise environment

Is your company using "enterprisey" technologies like Java or .NET? Do you want to use flexible scripting languages like Python or Ruby?
There are interesting possibilities for popular and "mature" programming languages like those above. Many popular languages has implementations that work under Java or .NET environment, like Jython, JRuby, IronPython, IronRuby and others. It's quite old thing but it still worth mentioning it. The main problem with such solutions is their maturity and completeness, so checking and quick research is needed before doing decision.

You can also find implementations of old veterans like COBOL and REXX for new platforms. There are also single platform languages that have cool features of scripting languages like Groovy or beanshell for JVM.

Additional languages are primarily used in configuration, defining custom and complex business rules, adding Domain Specific Language features etc. Word of warn - do not create local Babel Tower by multiplying number of existing languages in single project. But it's nice to have to have one scripting language blended into main project platform.

Other case is porting applications from scripting to target platform. Constraints are narrow - all used third party libraries have to work on both platforms, so additional work is needed often. Practical example - here is interesting tutorial how to deploy web.py python application under Jython and JVM.

2008-02-18

Polyphasic sleep - sleeping less and better - update 1


Photo author: agoode
I mentioned before that I started polyphasic sleep schedule experiment After few weeks I can say it's quite difficult, but somehow working.
I had one week for trying it without family, but now they are back and are very important part of that experiment.

After transition phase I experimented with two different sleep schedules versions: 3 hours and 4.5 of core sleep version. I must say that best schedule that works for me is 4.5h of core sleep and 3 naps: one before work, one after dinner and additional one at evening. It works probably because of quite long core sleep time only 1.5h shorter than my usual 6h sleep. I maintained that sleep cycle for most all days with some exceptions:
- sometimes I was too tired after whole day or not slept good last night- in that circumstances its possible to miss even an alarm clock
- weekends when my lazy part demands full night sleep
- nightly interruptions caused by my toddler needing nursing

The first two obstacles probably will be gone after better adaptation. Kid is the bigger problem. I managed that by tweaking my sleeping hours and synchronizing with my kid's sleeping cycle. It's still not ideal but seems working. And know I'm logging sleep times for two.

My core sleep isn't equal for every night. Sometimes it fits better my natural rhythm the other time worse. I use precalculated cycle length of about 1.5h. So 4.5 core sleep takes about 3 cycles. If my waking time differs by more than half an hour earlier or later, I feel after that really bad. Grogginess, jet lag effect cumulates together into zombie like state - I need slow warm up to function normally. After first nap things go better. Every nap is crucial for reducing short sleep time effects and I'm usually more energized at the morning. After 2 pm I start to feel worse and I'm slowing till I get next nap after dinner.

But If my sleeping times are in schedule I feel normal, sometimes after naps even more energized than usual . So the key to success is to tune in to natural body rhythm and holding schedule times. As I mentioned before, naps are crucial- every nap missed makes me feel worse till next sleep.

Somebody may ask- is it worth to take such sacrifices? My total sleeping time is shortened from 6.5 to 5.5 hours- so 1 hour gained. It's a small reward if any. My main goal was to redefine my daily sleep cycle to get my works done and have time for my family after work. My family helps me a little so I can get two 20 minutes naps at late afternoon and evening. Everybody gets its goals and is happy. I think its worth to try it making better. Maybe it's weird method, but that's the way I like to try.

2008-02-11

Estimated car expenses - verified

Last week I had some serious car servicing and insurance expenses. I decided to check my total cost of car ownership estimates.

I'm 99% city commuter so before I bought a car, besides well visible costs like car price, insurance etc., I had checked couple of factors like fuel consumption and estimated car servicing cost.After spreading all cost for next 5 years my calculated total was about 2650 euro per year (about 3850 $).

Two years later I have more precise data, like servicing invoices, fuel consumption history etc., excluding occasional fees like parking and other. Simple recalculation in spreadsheet and it looks like my average cost of car ownership will be about 2500 euro/year during last 2 and for next 3 years. It looks like my estimate was quite good. I should include predicted car selling price for example after 5 years, but it's not the point for now.

Here are biggest and most important chunks to consider in calculating car TCO:
- initial car value 47%
- insurance 24%
- fuel 20%

Maybe I should think about rolling car cost calculator based on that experiences. I wish all my budgeting estimates will work with that accuracy.

2008-02-04

Rolling my own simple python chart library

Two weeks ago I started looking for simple python chart library. There are interesting solutions based on cairo, GD and alike libraries. I was surprised there is no simple chart drawing library using "core" python installation environment. I found of course nice working PyCha using cairo, but there were problems on one testing servers with cairo library installation.

Portability is one of my priorities so I've been trying to find more flexible solution. So I've found SPING (Simple Platform INdependent Graphics former now as PIDDLE). It supports numerous backends like PDF, PIL, QuickDraw, PostScript, Illustrator, piddleVCR, OpenGL, Tk, wxWindows and support for others is in development. Looks promising. Ok so it gives me basic drawing capabilities. What about beatiful charts? After online research, I decided that something like PyCha would be enough. But PyCha uses cairo ... . Then idea has come- rewrite PyCha to use SPING. Idea is not so stupid- PyCha library is quite small and porting should be doable.

So I started rewriting PyCha fo SPING (codename SpingCha). The biggest part of work is porting calls typical for cairo interface to more generic SPING. I used Interface pattern with simple cairo like API. After two days I have almost working implementation, tested on original PyCha examples. By saying almost - I mean it needs better color, fonts and antialiasing handling to produce more beautiful charts.

After finishing and cleaning up code I'm planning to publish it under derived GNU Lesser General Public License. Maybe I will talk with author of PyCha to just include my ideas in main project. Meanwhile if you are interested to get SpingCha just add your comment, I will know if I need to speed up things, and release it.

UPDATE: About further story you can read new post