see whatever…

jump to menu

April 23, 2006

Python on Series 60

Filed under: Series 60 — see @ 7:17 pm

Finally decided on my new phone and got a Nokia 6680 instead of the N70 I was originally interested in (better camera but keys too small and still not available at my phone provider…). Great phone at first sight and much better than the Motorola L6 I got at work this month which is slimmer and lighter (and cheaper of course ;) though.

So of course I installed Python for Series 60 first thing which was the main reason I got a Series 60 in the first place. 6680 is still quite expensive (for my taste) and physically quite big too but is one of the best Series 60 phones currenty available.

I looked into various scripts and even tried the interactive console on the phone which of course is a bit of pain to work with on the phone keyboard. I guess I need to get a bluetooth adapter for my desktop PC or maybe even the Nokia keyboard.

The ones I tried this far are a simple mandelbrot set script and a few from including a simple speed test which needs the miso module. The 6680 has a speed of 220800 and seems (seen naively) to be twice as fast as a 6600.
I have a few days off in the next week and maybe I find some time to try a bit more. Well, a new toy again :)

April 12, 2006

google 2nd

Filed under: Uncategorized — see @ 10:26 pm

when googling for “buy mephisto copy pencils” this blog comes out on the 2nd place, really strange… (found that out by checking my server statistics)

UPDATE: just clicked the link above and now its the 1st place…

Using the same data in Python and Jython

Filed under: Jython,Programming,Python,RelaxNG — see @ 9:26 pm

I had the problem of needing the same data for some related tasks for which I wrote

  1. a (C)Python script because I used the really great Lingfo – a library to read Excel data with Python together with this Cookbook recipe
  2. a Jython script as I used Jing to validate some XML files with a RelaxNG schema

I may have used other libs which may be available for only one taste of P/J-ython but found these the easiest to use and actually used them for other stuff before so did know how to use them. I could have used Pythons’s lxml but do not know if it validates with the RNC compact syntax or could have used something like Java’s POI to read the Excel but I actually try to minimize the Jython usage as I almost always prefer Python (being faster, 2.4. being much more convenient than Jython’s 2.1 implementation [2.2. still being alpha] etc etc)…

Aynway, so I read data from an Excel sheet with the Python script, read some XML files with the obtained data but needed the same data to do the validation of the XML files with Jython. The XML files themselves are on disk so no problem, the data on the other hand was a bit more complex list of dicts with quite a few information atoms.The solution turned out to be quite simple actually. As for the problem at hand I am able to start both scripts independently (or maybe writing a third shell script which calls both) I put a simple pickle in the Python script and read the same data with pickle in Jython.

Maybe a bit too trivial to actually blog about at all but as I never needed anything like the pickle (shelve, marshall etc) modules and never really saw a use case for them it was actually quite enlightening. I was wondering for some time now how to best integrate Python and Jythons tasks into the same app and this seems like a possibility at least for some cases. And I tried out another module of the very nice and comprehensive stdlib. (Which I missed by the way while doing some other work in PHP ;)

April 10, 2006

Good Night and Good Luck

Filed under: Film,Music — see @ 9:26 pm

saw the very stylish new film by George Clooney yesterday. I never realized how much I do NOT know about the McCarthy era. Good film but I would like to see a film about the whole history of the events. The only thing I recently saw was a small excerpt of hearings by the McCarthy committee with some people of the film industry on a DVD making of – I forgot which film but kind of remember it may have been a hitchcock movie?

Great music score by the way, instantly got the CD today…

April 6, 2006

CSS adaptive layouts

Filed under: Web — see @ 10:04 pm

Adaptive layouts are hard – but not that hard. We did curse quite a lot today about how IE (who else) screwed up again. But in the end a solution was almost always possible and during the development we even discovered some unexpected possibilities. Doing complex layouts in CSS always seems very difficult but sometimes just needs a fresh eye or a different angle to find a solution that works.

I guess a few basic rules do help:

  • always try the simplest HTML possible
  • always try the simplest CSS possible
  • start working in Firefox (or similar) which has better debugging possibilities, is more standards compliant and simple seems to have fewer (unexpected) behaviours and fewer bugs
  • then try the same layout in IE, a few tweaks here and there or sometimes just a different way mostly gives a similar endresult
  • adjusting to IE work on all currently relevant versions (5.5 and 6.0) a the same time, they mostly work very similar (mostly box model hacks are needed)
  • build up a knowledge about problematic parts of CSS and try to avoid them
    • lists
    • floating (but there mostly are solutions)
    • negative margins, complex positioning including relative positioning
  • if you find an IE problem often a “position: relative;” here and there helps ;)
  • put a background-color on elements you are unsure with to see where they actually are and to see their boundaries

Maybe it is just me but most of the time I look at other peoples stylesheets I find them very complicated, lots of definitions which are simply not needed, a bad structure and the code is most often not readable. When removing all unneeded definitions, simplifying styles and properly indenting (!) stylesheets makes them much more readable and in the end easier to work with.
Also simplifying the HTML – or in some cases even complicating the HTML with semantically more appropriate markup – seems to help properly working CSS a lot.

Even I – after working for years with complex CSS (in this case not being too modest ;) – was a bit surprised to find an unordered list of links working which did not do what they should without the surrounding list.

So a bit stressful but in the end rewarding…

work time

Filed under: Death,Life,Programming — see @ 9:43 pm

I have some theories about working efficiently, one would be: Never work too much on one project, at least not in “one piece” meaning in one continous time span. And I guess my theory got another proof today of being not quite wrong.

A project being late “forced” people on the project to work overtime and also through the whole weekend. The result of this tour de force showed today in one being ill and the others of course being a bit tired and not at the peek of their normally very high programming ability.

I guess the time “pre-done” on the weekend will be caught in during this week and (after another work-through weekend) even more in the next meaning in the end, no time saved at all but just more time used for maybe even less quality.

This is not the fault of the people themselves who just tried to do good. It is probably no ones fault but nevertheless some thinking beforehand and better planning would have saved some time before. Also a more concentrated work (which in this case was also hindered by a difficult working environment) would have saved more time and resulted in better quality than doing lots of overtime work with additional work over the weekend.

Doing a step back and looking at the problems at hand with a fresh eye normally saves more time and results in better work than doing loads of additional hours. I guess that’s what XP (extreme programming) means by 40hours/week should be normal…

April 5, 2006

file permissions

Filed under: PHP,Programming — see @ 8:36 pm

I guess I have been a bit ignorant regarding file permissions in Unix/Linux. I am developing on Windows only so this only bites me when I put something on a webserver which for my current needs almost never runs on Windows meaning it is most of the time an Apache or maybe Tomcat (no issue there of course) running on a Linux machine.

Today again I had some difficulties with the small CMS-like system I am developing (mostly as I want to learn a bit more from the ground up). Images uploaded from the media component of the system had a strange 0200 permission but needed a 0777 (or maybe not?) permission to show up on the resulting website at all. Until now I always worked with a simple FTP tool (SmartFTP, really nice BTW and free for noncommercial work) to change file permissions. But the upload tool written in PHP did set the permission that I was not allowed to even change it via FTP.

In the end I found a way but alltogether it showed me that I never really looked into the whole thing. Guess not that important for the kind of work I am doing for living and even privately but nevertheless I should look a bit more into it.

April 3, 2006

self.bookmark: read unicode with csv module

Filed under: Python — see @ 9:02 pm

I think I read that one (or better the one referred to) before but wether I forgot or had a déjà vu… anyway as a bookmark to myself in need of a better facility (or maybe to lazy to set up even another thing on a bookmarking service.

Powered by WordPress