Blog

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!

Behind schedule

I know, I tend to live faster than my blog updates. So there are a number of things I haven’t posted about. For example I read several books, I had some interesting experiences with shell script programming and I found some clever sites I’d like to share with you.Moreover the whole site needs some freshening and I discovered that the gallery page of Naxos island is not correctly displayed.
Don’t worry, I am here to get back on track. One of the blog I’m reading this day is Coding Horror. I found it very insightful and worth. You can have it served via RSS feed. I feel really attuned with the writer, at a point that I myself could have written something like this. So today he wrote about how defining a sustainable schedule and attaining to it is a key factor for success (and, more specifically for a successful blog).
Well my schedule is something like – fill the slack time, and I precisely attain to it. Maybe that’s why I have a few selected high quality readers that keep reading my rants. Thank you.
So here is a list of books I should write the review: Yourdon’s Death March, Rowling’s Harry Potter and the Deathly Hollows, Pratchett’s Good Omens: The Nice and Accurate Prophecies of Agnes Nutter, Witch, Zattoni Gillini’s Paquito’s story, Chistolini’s School and Adoption.
If you are involved on a understaffed, under budget project with tight deadlines, just don’t wait for my review of Death March, grab your copy now. Although most of it could be considered just common sense, it is nonetheless a well organized, well written common sense. And when you are under the pressure of a Death March kind of project, common sense has been usually left behind.

Out of the way

It is a few day I have this thought in and out my head. There is no particular fact that triggered this off, I think it’s just some random observations.We programmers like computers and software. That’s obvious – we find them entertaining, funny, sometimes even a sort of lifestyle. Wouldn’t it be the case we would have chosen something different, more economical rewarding (such as the plumber), more socially oriented (e.g. the plumber) or even more funny (water’n’pipes are fun, aren’t they?).
I find than more than often our programs have features and behaviors just to amuse the other programmers or even ourselves, forgetting that real users, those who will use our program to do some actual work, aren’t so fond of computers beside having some actual work to do.
I think we should enforce a new paradigm for program development: the computer is actually an obstacle, a barrier between the user and her goal. The software has to clean the road and keep off the way.
Just ask yourself if that “Error Blah blah” dialog box you are coding is something that helps the user to reach his goal and perform his task, or is just something that will annoy him. Is really a user fault if the file has the wrong name? Are we really sure that the user has to know what a file is?
For another example consider the need of a user to deliver an amount of data (files) to another user. The obvious choice, since everyone has an email account, is to use it. That is the need for the user and the clear, logical solution she sees.
So, the size limit for attachments is just an obstacle to the activity she has to perform. But the real solution is not to grow the limit, but to take the limit off. If the mail protocol is not suitable for bulk transfers, then the software has to use other means. Why can’t it arrange an ftp transfer? Sure it’s not as easy as I put it, but it definitively can be done.
On the same issue, there are users that fall in love with technology and forget any other sensible way of doing things. So their activities could become extremely time wasting. I needed a reference on how to attach cables to an electronic board for testing. I looked in the usual repository just to find every kind of documentation but the one I was looking for. I asked the guy who was supposed to provide that kind of information and he told me that he was unable to provide the board layout because the software is not yet able to do it and that we need another module for … and so on. I took paper and pen and sketched the layout on a sheet of paper, then scanned it and put on-line on the server. It took me about 20 minutes because I had to look up the schematics. The document I produced is not polished, but… who cares?

Some Links

I’d like to bring the links below to your attention.First I found Steve McConnell’s blog. Steve wrote a bunch of very interesting stuff for programmers and project managers. I really enjoyed his Code Complete and Software Project Survival Guide, I read his very insightful slides on the matter he dealt with in Rapid Development. His Software Estimation: Demystifying the Black Art is in my reading queue, I’ll get to it, soon or later. A quick glimpse at amazon revealed the other two books: After the Gold Rush: Creating a True Profession of Software Engineering and Professional Software Development: Shorter Schedules, Higher Quality Products, More Successful Projects, Enhanced Careers. That’s to say that you can find his thoughts very interesting. Just take for example:
“[[…] people often have an oversimplified view of other engineering disciplines when they make comparisons to software. I talked about that back in June in my post about “Rumors of Software Engineering’s Death are Greatly Exaggerated”

The other blog is the one that pointed me to McConnell’s is Coding Horror. It is a low traffic (2-3 post a day), collective blog about bad programmer experiences or braindead code behavior, sometimes funny, sometimes insightful.

Last, but not least, I found Artima blog, another low traffic and collective blog that deals with software technology from the programmers point of view. The last post, for example, explores the question why most of the largest websites are not written in Java.

Hope you find something useful there.

Putting captcha to work

Quite a long ago, an unfriendly Mr. Spam exploited my blog system to put his (maybe her) unwanted advertising into my website. I resorted to a CAPTCHA (Completely Automated Public Turing test to tell Computers and Humans Apart), but also found that the test was harmless for the clever and determined spammer.In fact such a guy could forward the CAPTCHA test to another website so that clueless users could put their brainpower to unlock the test. Let’s rephrase that. A clever spammer could set up an high traffic website (such as something with pictures… you guess which) where users are requested to solve the CAPTCHA in order to access the content. This website doesn’t forge CAPTCHA tests, rather it forwards the tests from a target site that the spammer want to access. Once the CAPTCHA is solved by the unaware gif-watcher, the spammer’s system is able to spam the target site.
Fortunately this solution is limited by the number of people willing to solve CAPTCHA to access a content that has as a stringent requirement to be cheaply collectible. I guess that that constraint limits the application of this solution just to a few, high traffic, blogs or websites.
I read today on slashdot that not only spammers are that clever. At Carnegie Mellon University researchers have found a way to exploit CAPTCHA to data-entry large volume of ancient manuscripts. The CAPTCHA proposes two handwritten words. The first is already decoded and is the real locking system, the second is a word to decode. The result, if confirmed by other users of the system, is then turned into the manuscript digital translation.

Split

Yesterday morning I felt somewhat split, as I would be in two places at the same time. I reckon that one of me in the multiverse went down one leg, while the other me went down the other leg of the Trousers of Time. One of me decided to change work and yesterday started his new job working on the next chart-busting video-game for mobile phones; the other one of me decided to keep the old job and now he is working with home automation appliances.
This leg of the Trousers is the latter, the other me is writing something very similar on his blog in his Universe.
Unfortunately I have no imp-powered dis-organizer to check what’s happening to the other one and to ultimately tell what has been the Right Decision.