Thursday, November 12, 2009

Davide Pasca Ph.P.

I've been doing quite a bit of web development recently (and sleeping 5 hours per night 8).

It's actually a mix between developing, setting things up and scavenging plug-ins of sort.
For example, for I use WordPress as a base platform. It's for blogging, but it has so many plug-ins, themes, widgets.. that one can spend hours and hours just trying to pick what seems useful.

For example, I get daily updates of upcoming club events from This is in a form of RSS feed which I give to to get a feed translated in English to display on my site ( actually uses Google Translate, and perhaps I should do this directly myself since seems to have quite a bit of downtime 8( ).
When works, the feeds translated that are coming are very slow (possibly because it translates them every time ?).
For this reason I wrote a simple cache system that gets the actual translated feed only 3 hours or so, and for the rest of the time, a local cache of the feed is used to render the page.

Another site I've been working on is (Under Construction !!) ..this is for an actual family business 8)
The pages ar emostly static, so I did this from scratch (aside from the base CSS template, done by some good soul that put it on-line for everyone to use).
More caching happening for this site. Pictures used in the page are kept at original resolution on the server and are used as a based to produce resized images for the actual page rendering.
Because images don't change, practically they only need to be resized once. This could be done offline, but I find it easier to do it in PHP on demand when developing.. this way, if decide that an image shoudl be 200 pixels wide instead of 220 pixels, I can change a parameter in the PHP of the page without having to open Paint.NET or run ImageMagick to resize that image once again.

The PHP code to display an image becomes something like this (1mg == img ..blogger goes crazy otherwise (^^;)):


IMG_GetResized() is my function that generates a resized image to the desired new size.. if that size doesn't exist. Otherwise simply gives the name of the resized image.
In this case I want the new image to be 120 pixels in width and 0 for height stands for "don't care, keep aspect ratio". Resizing images has always been a pain on the web.. I wish that there was a standard for that !

All this PHP coding.. but, still, PHP doesn't seem too much like "coding" to me 8)
These web applications is where most of the programming effort seems to go nowadays.. but it's a world of scripts, where variables aren't scrictly typed, where one doesn't touch bits, doesn't worry about low level performance and one can't possibly worry about the concept of memory allocation, multiple cores.. etc etc.

In a sense, to me, real programming is what can be defined as system programming. On the other hand, efforts of the size of WordPress are really impessive.. and if one had to write a traditional application in C++ to do the things that WordPress does.. that would probably be much harder.
GUI and high level is probably going to be more the PHP/Python + browser way.. and possibly, programmers like me won't have to fight with things like MFC or wxWidgets to get some GUI that a PHP or JavaScript programmer can get up no time 8)

zzzzzzzzzzzzzz !