Petter Reinholdtsen

Entries from December 2012.

Ledger - double-entry accounting using text based storage format
18th December 2012

A few days ago I came across a blog post from Joey Hess describing ledger and hledger, a text based system for double-entry accounting. I found it interesting, as I am involved with several organizations where accounting is an issue, and I have not really become too friendly with the different web based systems we use. I find it hard to find what I look for in the menus and even harder try to get sensible data out of the systems. Ledger seem different. The accounting data is kept in text files that can be stored in a version control system, and there are at least five different implementations able to read the format. An example entry look like this, and is simple enough that it will be trivial to generate entries based on CVS files fetched from the bank:

2004-05-27 Book Store
      Expenses:Books                 $20.00
      Liabilities:Visa

The concept seemed interesting enough for me to check it out and look for others using it. I found blog posts from Christine Spang, Pete Keen, Andrew Cantino and Ronald Ip describing how they use it, as well as a post from Bradley M. Kuhn at the Software Freedom Conservancy. All seemed like good recommendations fitting my need.

The ledger package is available in Debian Squeeze, while the hledger package only is available in Debian Sid. As I use Squeeze, ledger seemed the best choice to get started.

To get some real data to test on, I wrote a web scraper for LODO, the accounting system used by the NUUG association, and started to play with the data set. I'm not really deeply into accounting, but I am able to get a simple balance and accounting status for example using the "ledger balance" command. But I will have to gather more experience before I know if the ledger way is a good fit for the organisations I am involved in.

Tags: debian edu, english, nuug.
61 kommuner lenker nå til FiksGataMi fra sine nettsider
11th December 2012

For noen dager siden omfavnet nok en kommune NUUGs FiksGataMi. Med 61 kommuner som lenker til FiksGataMi fra sine hjemmesider er «markedsandelen» 14% (av 429 kommuner). Siden siste oppdatering i november har kommunene Re og Vågsøy kommet til og slår følge med kommunene Askim, Askøy, Audnedal, Aure, Balestrand, Bærum, Eide, Farsund, Flekkefjord, Folldal, Gran, Grue, Hadsel, Halden, Halsa, Hamar, Hobøl, Holtålen, Hægebostad, Høyanger, Kongsberg, Kristiansund, Kvinesdal, Kviteseid, Levanger, Lindesnes, Luster, Lyngdal, Løten, Mandal, Marnardal, Moss, Namsos, Nissedal, Nordreisa, Randaberg, Rindal, Sel, Sirdal, Skiptvet, Sortland, Spydeberg, Stange, Stjørdal, Stord, Søgne, Sør-Odal, Tolga, Trysil, Tynset, Tysvær, Ullensvang Herad, Utsira, Vennesla, Verdal, Vågan, Vågå, Våler og Åseral. Oppdatert liste er tilgjengelig fra NUUGs wiki. Kartet er dog ikke oppdatert med de siste kommunene.

Kanskje du bør høre med din kommune om de vil bli mer aktive brukere av FiksGataMi? Se en tidligere bloggpost med tips om hvordan det kan gjøres.

I snitt rapporteres det nå via FiksGataMi ca. 60 meldinger fra innbyggerne i uka om feil på offentlig infrastruktur.

Tags: fiksgatami, norsk.
Scripting the Cerebrum/bofhd user administration system using XML-RPC
6th December 2012

Where I work at the University of Oslo, we use the Cerebrum user administration system to maintain users, groups, DNS, DHCP, etc. I've known since the system was written that the server is providing an XML-RPC API, but I have never spent time to try to figure out how to use it, as we always use the bofh command line client at work. Until today. I want to script the updating of DNS and DHCP to make it easier to set up virtual machines. Here are a few notes on how to use it with Python.

I started by looking at the source of the Java bofh client, to figure out how it connected to the API server. I also googled for python examples on how to use XML-RPC, and found a simple example in the XML-RPC howto.

This simple example code show how to connect, get the list of commands (as a JSON dump), and how to get the information about the user currently logged in:

#!/usr/bin/env python
import getpass
import xmlrpclib
server_url = 'https://cerebrum-uio.uio.no:8000';
username = getpass.getuser()
password = getpass.getpass()
server = xmlrpclib.Server(server_url);
#print server.get_commands(sessionid)
sessionid = server.login(username, password)
print server.run_command(sessionid, "user_info", username)
result = server.logout(sessionid)
print result

Armed with this knowledge I can now move forward and script the DNS and DHCP updates I wanted to do.

Tags: english, sysadmin.

RSS Feed

Created by Chronicle v4.4