Talk on Python by Svenne Krap in DKUUG

Python
Last night I attended a talk on Python by Svenne Krap in DKUUG (Danish Unix User Group). The video, slides and examples can be found here: video.dkuug.dk/2008-03-25-python/

The talk was just what I wanted – a hands on example-based introduction to various cool uses of Python. I already have experience with Python so I wasn’t interested in a very basic lecture – I just wanted to be inspired to use Python in new ways.

The following is just my random notes from the talk – perhaps someone will find it interesting and be inspired to watch video of talk which can be found on the page above.

Introduction
For those who haven’t got any experince with python I can recommend the following two (free) books:
How to Think Like a (Python) Programmer
Dive Into Python

Notes from the night
The styleguide PEP-8 should be read as it gives the coding conventions for python.

  • A indentation level should only be 4 spaces, not a tab.
  • Tabs and spaces shouldn’t be mixed.
  • A line should only be 79 characters
  • 2 blank lines should be used to seperate functions and classes, 1 blank line otherwise

Getting help
The most important commands are:

  • help() — help(modulname) searches help on the module.
  • dir() — return an alphabetized list of names comprising (some of) the attributes of the given object, and of attributes reachable from it.

So when you are programming having a shell open with python running you can get help on how to use a module by using help(modulename) and to see the methods and options for a object or module try dir(object). help(modulename) is the most help IMO.

Continue reading Talk on Python by Svenne Krap in DKUUG

Setting up a subversion repository in 5 min.

I am currently working on some python coding and since the number of files is getting quite large and being more than one developer on the project it became clear that I need to do some revision control. Eventhough de-centralised revison control is the new black I wanted a centralised solution so everybody could check out agains the server.

Setting up the subversion
First I create the repository

tjansson@ikos:~$ svnadmin create subversion --fs-type fsfs

Then I import the files residing the folder ~/dpy into the repository.

tjansson@ikos:~$ svn import dpy/ file:///home/gfy-1/tjansson/subversion/dpy -m "Initial import"

Now the folder ~/dpy isn’t used anymore as all the files are inside the repository in a database.

Continue reading Setting up a subversion repository in 5 min.

Postkort: Skitur i Härjedalen

En af den digitale tidsalders frugter jeg nyder godt af, er digitale postkort. Det giver muligheden for at skrive en lidt længere tekst, illustrere med den egne billeder og formidle den til så mange som muligt. I uge 10 var jeg med Pernille, hendes forældre Finn og Anette, søster, Signe og Signes kæreste, Kåre på skiferie på Ramundbjerget i Härjedalen i Sverige, se dette kort.

Vi ankom klokken 23, efter en lang bustur der var startet klokken 05, midt i en god gang snevejr.


sverige

Continue reading Postkort: Skitur i Härjedalen