Month: November 2007

Here you are…

… the much awaited [https://www.maxpagani.org/photoalbum-usa2007.html|pictures from the last summer vacation]. Most of them have been shot by my nephew Matteo, kudos to him. USA parks in Utah are the among the best place we have ever been, look at the photos a judge yourselves. This new kind of photoalbum is a little different, a bit more tricky to handle behind the scene. Let me know if you find any quirk.

Galactica

Arthur Clarke has been reported to say that Politicians should read science fiction, not westerns and detective stories. I find that in most sci-fi works there are lot of food for thought, be it the message given by Star Trek back in the 60s about common values of the mankind going beyond the exterior differences in race or sex, or be the capital letters warnings issued by Blade Runner in the 80s about a looming dark future.I just bought the first season of Battlestar Galactica and started watching episodes. The background is about a robot rebellion and the attempt of a bunch of survivors to seek for a new home while escaping the continuous attempt of the machines to destroy them.
So the scenario is this, the humanity has been mostly wiped out, billions are dead, there are just 50 thousands, grouping and recovering. The freshly named president is trying to figure out what are the best chances for surviving. Time for harsh choices, she has just opted to leave behind those aboard of starships not able to perform faster than light travel.
In the fleet there is a prison ship with 1500 convicts on board. Supplies are scarce and rationed, so the commander of the prison ship is asking what to do about his passengers. There could be plenty of good reason to save food, air, water and fuel. The president reads the requests, seems to ponder it for just a split second, and promptly dismisses by stating – No. We’re not going to start doing that. They’re still human beings. Tell the captain I expect daily reports on his prisoners’ well-being and if there are any “mysterious” deaths, the Astral Queen may find herself on her own and without the Galactica’s protection..
I think this is a profound message, we are all humans and we all deserves the same rights and duties. It is just sad to split humanity in those better and those worse purporting that the first has more rights than the latter.

Bioshocked

Last Saturday I completed Bioshock. I think this is the last horror game I am going to play on this and next hardware generation. It is becoming way too scaring. This game is rated 18 and it really is – the second level, set in a hospital, is also quite disturbing. The overall atmosphere is dark and chilling.Despite this, the game is great, immersive and thought provoking. That’s quite odd for a game especially if you consider that I wrote that not meaning the alienation you get after too many hours spent on Tetris, when you start thinking in boxes and shape pluggings.
The game has been widely reviewed and advertised, so I think that the scenario of the game is no surprise for you. Bioshock is set in an underwater city – Rapture. Built here by a (filthy) rich scientist and ideologist, Ryan, upholding the principle of extreme freedom, so that the great is not limited by the small, the scientist is not withdrawn by moral or religion. It is a great vision, then something went wrong, terribly wrong. It is interesting what a FPS videogame can move, whether is necessary or not that such unlimited and unconstrained utopia had to fail; what is the extent for those premises.
The player himself (or herself) is faced with strong questions. You have the chance of saving an innocent children or killing a terrible monster, you just don’t have enough clues to determine whether the small girl is one or another. You have to take a choice.
The story is good, the player is tied to the game not just by the game itself, but for the compelling story, to discover what’s next. Will the player be able to help Atlas to save his family? What will happen when the player will face Ryan? Is Mrs Tanenbaum really redeemed?
From the technical viewpoint the game is based on the Unreal Engine, the same used by Gears of War. This engine is capable of delivering complex sceneries to an outstanding level of detail. For this very reason artifacts of artificial behaviors clashes hardly on the suspension of disbelief. This seldom happens, just don’t look for your body, you have just a disembodied arm. Occasionally you may find a lighting problem or some iterations of the physic looking for the right place where you have to be positioned. But these are just minor flaws. This is a great game.

Memories

This is not completely an idea of mine, I read somewhere articles about how the pyramids kept a pretty good shape so that everyone could enjoy their sight after thousands years of peacefully standing in the desert, while we lost the first email message that dates back just some decades from now. So some days ago my wife and I were guests of my mother in law. At a given point my wife dug out from a cabinet an old metal box, something long gone these days of disposable wrappers, full of old photos.
Some photos turned reddish, some were crumpled or wrinkled, but all were fine from the comprehension point of view. So we spent a good time looking back at my wife and her family in the 70s and back to her ancestors, maybe going back 50 or even 60 years.
Comparing this with my sister losing all the pictures of her baby stored on an unlucky hard disk, makes me feel like we are storing our memories on the water. Despite of what it seems the photographic paper has a lot of advantages when you look at it in the perspective of decades. First it is resistant, just store it somewhere not to wet, it doesn’t even fear the sudden deceleration. Second it is instantly accessible, you don’t need a power outlet, nor to wait for a startup time, when you have enough, just put it back, no need for a proper shutdown.
Third the media is human-accessible, you don’t need any layer of techno-stuff that transforms evanescent physical properties in electrical signals and then applies advanced mathematics to recompose those signals into an information pattern that needs to be processed again into some matter properties so that we can glance at a recognizable image.
How many digital camera images shot today do you think you’ll be able to watch in 10 – 20 – 30 – 50 years?

Lighttpd Version Switch Howto (1.4->1.5)

Lighttpd is a neat web server, small footprint’ed yet full-featured is suitable for use in embedded system. There are two interesting features that make it an ideal choice for a large number of applications – the fastcgi (for php and python server side scripting) and SSL support. Current stable version is 1.4.18 while latest unstable version is 1.5.0-r1992 (things keep changing everyday so you may want to check their site for latest updates). Unfortunately the new version is not fully compatible at configuration level with the previous one. I’ll describe how to adapt the old configuration file for the new version.
In my experience (if a morning of sweating at the bast*rd could be called “experience”) there are two sources of troubles – fastcgi and cgi. Maybe there are more, but solving those two was enough for my needs.
First CGI. There isn’t anything new, but the configuration file. If you look into your old lighttpd.conf you are likely to find something like:

  $HTTP[["url"] =~ "^/cgi-bin" {
    cgi.assign = ( "" => "" )
  }

That syntax is no longer supported, just remove (or comment out) those lines and insert:

  $PHYSICAL[["existing-path"] =~ "^/var/www/myvhost/cgi-bin/" {
    cgi.execute-all = "enable"
  }

Note that before you had just the path in the URL, while now you have to specify the file system path. Also note that “existing-path” is literally that string, do not substitute it, just change the “/var/www/myvhost/cgi-bin/” with the proper value for your system.
The fastcgi is a bit more convoluted because they changed entirely the underlying model. The idea of fastcgi is to keep the CGI processor running so that both startup and shutdown time for the processor are avoided at all. That means big gains for the average http server where lot of shot transactions could ignite one or more invocation for the CGI processor.
Lighttpd 1.5 choses to keep the burden of managing a pool of CGI processors out of the web server itself. In this way managing fastcgi is not that different from behaving like a proxy – a request is received, rewritten and sent to another entity which in turn is expected to answer and the answer is sent back to the original requester.
Anyway this means that you have some external mean to spawn and manage all those pesky php instances. So the action is twofold – first modify the lighttpd configuration, then modify the way lighttpd fires up so to start the pool manager, too.
First the configuration file. You have to remove the old mod_fastcgi from the server.modules list and replace it with the new list:

server.modules = (
  #...
  "mod_proxy_core",
  "mod_proxy_backend_http",
  "mod_proxy_backend_fastcgi",
  # ...
)

Then remove the section that talks about fastcgi.server and may look like this:

# for php
  fastcgi.server = ( ".php" => ((
  "bin-path" => "/usr/sbin/php-cgi",
  "socket" => "/tmp/php.socket",
)))

Replace with:

$PHYSICAL[[ "existing-path" ] =~ ".php$" {
  proxy-core.balancer = "round-robin"
  proxy-core.protocol = "fastcgi"
  proxy-core.allow-x-sendfile = "enable"
  proxy-core.backends = ( "unix:/tmp/php-fastcgi.sock" )
  proxy-core.max-pool-size = 16
  proxy-core.rewrite-request = ( "_pathinfo" => (".php(/.*)" => "$1" ))
}

Here also the “existing-path” string is literally that string, do not substitute.
Now you can close the lighttpd.conf and turn your attention to the launching script. It could be somewhere in /etc/init.d or /etc/rc.d/init.d according to your flavour of linux. Anyway, down there is a lighttpd shell script that accepts one argument such as start, stop, reload or restart. You have to modify it so that before launching the lighttpd deamon a line like the one below is executed:

  /usr/bin/spawn-fcgi -s /tmp/php-fastcgi.sock -f /usr/bin/php-cgi -u webuser -g webgroup -C 5 -P /var/run/spawn-fcgi.pid

spawn-fcgi is the spool manager and is distributed with lighttpd, so you should look for it in the path where lighttpd itself is installed. php-cgi could be located elsewhere, just check your file system and modify accordingly. webuser and webgroup are respectively the user and the group used to run the web server. They are very distribution dependent, you can find them likely in the lighttpd.conf file, just look for the strings after server.username and server.groupserver.
Last, you have to shutdown the spawn-fcgi daemon right after the lighttpd is stopped. You can simply do:

  killall php-cgi

But this could be overkilling if there are other services on the computer that rely on php-cgi for their work. I suspect you can safely look in the /var/run/spawn-fcgi.pid file a kill that pid, but I haven’t tried yet.
I have to credit this FreeBSD related article for cutting through the most obscure aspect of the fastcgi stuff and the lighttpd documentation for the cgi matter.
Enjoy!