Monday, September 06, 2010

Google Map competitor

Map24 Looks very similar to google maps. The interface makes it possible to move the point of view, much like in Google earth.

The same company also has a different interface on the website Navteq.com in my region it shows traffic data for a lot more roads than google map does. I wonder how this is possible.

Wednesday, August 25, 2010

Make the Tab bar visible in FIrefox full screen mode

According to Tweak Firefox 3 full screen mode • Mozilla Links, in about:config, you need to change the value of browser.fullscreen.autohide to "False".

Pour afficher la barre des tabs en mode plein écran, d'après Tweak Firefox 3 full screen mode, vous devez changer un réglage en entrant about:config dans la barre d'adresse, puis modifier la valeur de browser.fullscreen.autohide à "False".

Tuesday, August 17, 2010

When software patents become conter-productive

Oracle attacks Google and Android developers
The way the US patent system is currently set up, it’s difficult if not impossible to write a sizable body of code without unknowingly infringing on somebody’s patent. Your best hope seems to be to waste a lot of time filing as many patents as you can of your own, and hoping that anybody who sues you is unknowingly infringing on one of yours. That gives you a bargaining chip so you can do some kind of cross licensing deal. It’s a stupid, wasteful, unproductive government-created system that achieves the exact opposite of what was intended when it was first started. But, what can you do.

Friday, August 06, 2010

Python CGI scripts under wamp

If you want to run cgi script using wamp server on windows, you need to edit the Apache configuration file httpd.conf. Use the command line as administrator and run
C:\wamp\bin\apache\Apache2.2.11\conf>notepad httpd.conf
Then search for the line containing "addhandler" and write:
AddHandler cgi-script .py
For python scripts (for any other scripting language, just use the relevant extension).
Then the first line of your script should contain the path to the python program:
#!c:/Python26/python.exe -u
According to python cgi on windows.
Place your script in C:\wamp\bin\apache\Apache2.2.11\cgi-bin\myscript.py and you're done.
The output of the script can be accessed at
http://localhost/cgi-bin/myscript.py

The script works but there are restrictions on the modules I can import. I can import native python modules, but not the module I made myself in other places outside the cgi-bin folder. I don't know how to solve that yet. (This is probably a security restriction)

pyodbcs connection strings

Pyodbc conncetion strings gives a useful piece of advice concerning ODBC connection to Excel.
The Excel driver does not support transactions, so you will need to use the autocommit keyword:
cnxn = pyodbc.connect('DSN=test', autocommit=True)

DSN (Data Source Names) are defined in the ODBC data source administrator of the control pannel in windows (in the section administrative tools).

I wasn't able to establish a DSN-less connection.

Tuesday, August 03, 2010

Link to a specific part of a YouTube video

Matt cuts blog
If you want to link to a specific part of a video on YouTube, you can. For example, http://www.youtube.com/watch?v=PjDw3azfZWI#t=31m08s
Notice the “#t=31m08s” on the end of the url? That link will take you 31 minutes and 8 seconds into that video.

Monday, August 02, 2010

Write tests in programming

In this lecture, Richard Buckland says that tests should be written before the functions.

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).

Friday, June 11, 2010

Crop pages in a PDF

It's possible to crop pages in Adobe Acrobat:

That's usefull if you have a document that has increadibly wide margines and you'd like to print 2 pages per sheet.

Undo close tab in Firefox

I was looking for a way to undo close tab in firefox an I have found an extenssion for it.
But a comment on the page says: " Useless Press Ctrl. Shift T instead of installing an add on for it." And that's quite true! :)

You can also view the recently closed tabs in the history menu.

Thursday, June 03, 2010

Turn off auto notifiers to increase your productivity

Process your email in batches:

A simple way to increase your productivity is to turn off auto notifiers. It’s simply not necessary to check email constantly throughout the day, and doing so will regularly interrupt more important tasks. After receiving thousands of emails I can safely say that I’ve never received one that couldn’t wait 12 hours or so.

Process your inbox in batches. Make it once or twice a day, and try to get your inbox down to zero. This will allow you to plow through the rest of your productive tasks without constant interruption.


I'm sad to say I use outlook at work. Turning off auto notification is called: "Turn Desktop Alerts on or off" in the outlook help page:
On the Tools menu, click Options.
On the Preferences tab, click E-mail Options, and then click Advanced E-mail Options.
Under When new items arrive in my Inbox, clear the Display a New Mail Desktop Alert (default Inbox only) check box.

Tuesday, June 01, 2010

Why Python

Python Experts - Why They Do Python

Matthew: """Python syntax encourages programmers to write easy-to-read programs . [...]  A well-written python program reads like a book. """
The homogenization of scientific computing, or why Python is steadily eating other languages’ lunch
Tad: """A few years ago, you couldn’t really do statistics in Python unless you wanted to spend most of your time pulling your hair out and wishing Python were more like R (which, is a pretty remarkable confession considering what R is like)."""
Paypal engineering: 10 myths of enterprise python:
Myth #7: Python does not scale
"""Scale has many definitions, but by any definition, YouTube is a web site at scale. More than 1 billion unique visitors per month, over 100 hours of uploaded video per minute, and going on 20 pecent of peak Internet bandwidth, all with Python as a core technology. Dropbox, Disqus, Eventbrite, Reddit, Twilio, Instagram, Yelp, EVE Online, Second Life, and, yes, eBay and PayPal all have Python scaling stories that prove scale is more than just possible: it’s a pattern."""
Astronomers switch from IDL to Python. IDL is a vector oriented programming language. A wiki version of the IDL vs Python comparison, comment from the blog IDL vs. Python:
"Lately I’ve gotten increasingly frustrated with programming in IDL: [...] I find myself spending more and more time on “stupid stuff” like wrestling with the ancient and limited plotting system, building very ugly GUIs which nonetheless take vast amounts of cumbersome code to build, and dealing with namespace conflicts between routines with identical names in different libraries. Python is not perfect, but it’s a heck of a lot better than IDL in all of these aspects. Like I said, I’m only halfway switched (and certain collaborations are going to keep me in IDL for years, as will all my legacy code) but for new stuff Python seems like it’s got the wind behind its sails."

Interesting modules


xlrd and xlwt

Have a look at those python tools to read and write Excel files:
Maybe have a look at this discussion group: python-excel.

Friday, May 21, 2010

Battery sizes

I needed a 23A battery for a key-fob style car opener. I wasn't sure about the number and I think I found a List of Battery sizes, with a correct description of the battery I'm looking for: 12 V, length 29mm Diameter 10mm.

Thursday, May 13, 2010

Using synaptic on the eeePC

Using synaptic on the eeepc:

OK, it turns out there's an easy way to install Audacity[...]. I showed you the hard way already. Now let's take a look at the easy way.

  1. Go ahead and open a terminal by starting the file manager (located under the Work tab) and selecting "Open Console Window" from the Tools menu.
  2. Now type "konqueror" to bring up the KDE file manager/web browser. If you want to avoid entering your password down the line, try typing "sudo konqueror."
  3. Select Applications
  4. Select System
  5. Select Synaptic Package Manager
  6. Under Settings, select Repositories
  7. Click add and enter "deb http://http.us.debian.org/debian/ stable main"
  8. Click the Search button and enter Audacity, GIMP, or any other program you're looking for.
  9. Click on the check box next to the program you want to install and select Mark for installation
  10. Click Apply and you're all set.