Thursday, January 28, 2010

US department of defence advocates Open Source

US Department of Defence: "To effectively achieve its missions, the Department of Defense must develop and update its software-based capabilities faster than ever, to anticipate new threats and respond to continuously changing requirements. The use of Open Source Software (OSS) can provide advantages in this regard." (pdf on the website of David A. Wheeler)

Basic web server on a microcontroler

Web Xweb32 Lite is a web server that runs on a microcontroler ATMEGA32. With that you can visualise variables within a webbrowser. This is even smaller than any barebone computer.

A PC in the keyboard

A PC that fits in the keyboard for 99 EUR with linux: Northteck Gecko Surboard (article on Linux Devices.com)
Xcore is the manufacturer.

Géolocalisation par wifi

Le service de géolocalisation est assuré par la technologie Wi-Fi Positioning System (WPS). Grâce au Wi-Fi intégré, les cartes Eye-Fi détectent les réseaux Wi-Fi environnants pendant que vous prenez des photos. Une fois que les photos ont été transférées, le service Eye-Fi leur associe des données géographiques.

Wednesday, January 27, 2010

Connect to a SQLite database using python

SQLite is included since python 2.5 I connected to a SQLite database created from zotero that way:

import sqlite3 as sqlite
con = sqlite.connect('zotero.sqlite')
cur = con.cursor()
cur.execute('CREATE TABLE foo (o_id INTEGER PRIMARY KEY, fruit VARCHAR(20), veges VARCHAR(30))')
con.commit()
cur.execute('INSERT INTO foo (o_id, fruit, veges) VALUES(NULL, "apple", "broccoli")')
con.commit()
print cur.lastrowid

cur.execute('SELECT * FROM foo')
print cur.fetchall()

Here is the output:
>pythonw -u "test_sqlite.py"
1
[(1, u'apple', u'broccoli')]
2

With help from DZone snippets and devshed. However devsched's information about downloading and building the sqlite library is outdated as it is now included in python.


Edit:
In a later post, I explain how to connect do an SQLite database with the R statistical software and a package called dplyr.

Visualise the history of python development

In this blog I found a link to this video of the history of python development from the release date in 1991 to the time when Gido Van Rossum was hired by google in dec. 2005.

First plot with python (x,y)

Showing a plot with pylab module from the python (x,y) package that I just installed on windows.

from pylab import *
test_list = [1,2,6,123,51,32]
plot(test_list)
title('Test plot of a list of numbers')
show()

Monday, January 25, 2010

Metaprogramming

Metaprogramming " is the writing of computer programs that write or manipulate other programs (or themselves) as their data."

Python at google, quotes

In February 2006 Greg Stein spoke about Python at google. I liked this quote: "Greg mentioned that to create code.google.com took about 100 lines of python code. But since it has so many dependencies, the build system generated a 3 megabyte makefile for it!" That gave me an idea of what a *glue* language means!

On the same blog there is another quote from Guido Van Rossum: "Guido uses print statements for 90% of his debugging and a debugger for the times when his brain stops working or he has to debug some wierd code that someone else wrote. "