Tuesday, July 20, 2010

To model or not to model?

How not to model autonomus behavior: "Models and instantiations are very different things. An instantiation is supposed to be a proper member of the class of phenomena under study. By contrast, a model need not be; it can be crude – almost ignoring the majority of interested aspects of the phenomenon of interest – and yet be extremely useful. In general, simple models tend to be scientifically very powerful. This is because the purpose of a model is not to replicate a phenomenon, but to help explain it. There are lots of ways in which this can happen that do not involve producing an instantiation: models can show us the mistake in our assumptions, they can be explanatory rich in the way they actually fail to capture the phenomenon of interest, they can act as proofs of concept, they can generate novel hypotheses, and generally they can help re-organize complex ideas by exercising and questioning our intuitions."
[...]
"Evolutionary robotics (ER) is still proving a useful and open-ended method for exploring this increasingly less constraining role of the designer that may be required to achieve strong artificial autonomy. ER hands in the task of filling in design specifications pertaining to mechanisms, morphology, structural and functional organization to an automatic process of artificial evolution (Harvey et al. 1997, Nolfi & Floreano, 2000). Thus, instead of designing a robot that must explore the environment but should go to the green light when the battery is down, one can attempt to design a robot that more generally must keep the battery up during its explorations, or more implicitly, a robot that explores indefinitely."

Monday, July 19, 2010

The command line as administrator

To use the comand line as an administrator in windows, you can go the the C:\WINDOWS\system32 folder and click on "run as". Here is a screenshot:

Wednesday, July 14, 2010

Django running

I wanted to test one of the python web frameworks. I installed Django on Ubuntu. Here is the Django server running on my machine:


Now I'd like to know how I can use it to show the extracts of a table of metadata ! :-)

I don't know weather this was a stand-alone server or not. It's also possible to use Django on a standalone server. django-wsgiserver installs a web server for Django using CherryPy's WSGI server.

Python scripts as CGI on a web server

Today I wanted to run python scripts on a server. I have already Apache installed on my Ubuntu machine at home.
I dropped a python script (called rubbish.py) at /usr/lib/cgi-bin/rubbish.py But I couldn't see the output in my browser at: localhost/cgi-bin/rubbish.py (there was an error).
So I looked for help from the python cgi-script documentation. And their sample script works, it gives an html output that I can see in my browser. The main thing I had forgotten seems to be the need for the comment #!/usr/bin/env python as a first line of the file.
Here is what I see at the address http://localhost/cgi-bin/rubbish.py :


I wanted to run the script without cgi-bin, so i installed modwsgi.
Then restarted the Apache with sudo /etc/init.d/apache2 restart
I added a little python script into the /var/www/ folder. But it doesn't execute. Instead it loads the file. I saw somewhere that I have to change the .htaccess file. To tell the server that this is not just a file but a script the line AddHandler python-program .py does this. Well somehow it doesn't word. And the Apache doc says: "In general, you should never use .htaccess files unless you don't have access to the main server configuration file." I should change the httpd.conf file located at /etc/apache2/ on my computer. Pffffiou, :-) I'll do this another time, I already spent the whole afternoon on it.
  • I got inspiration from this forum (first result on google for "LAMP server python"), but then needed more help to get to the correct cgi script formatting (the first line with #!/usr/bin/env python).