OK, prepare for a rant.

I’ve been looking at ways to sync data across multiple systems. Basically I’m looking for something that can sync contacts, calendars and tasks across multiple devices. Ideally, this would be between a couple of desktop systems and my Android phone (preferably with a web interface for the rare occasions I’m without either). I don’t need to sync email due to using IMAP and the excellent clients available for it nowadays (personally I use Thunderbird 3.1 and K9 Mail).

Now I bet you’re screaming at me: “Why don’t you just use Google Contacts/Calendar/Tasks?”. Well currently I am, but in my ongoing quest to replace as many of these things with Free Software implementations, I was wondering what else I could use. Basically, the answer is that there isn’t anything that satisfies my requirements. There are lots of solutions which will do part of this, but nothing that will do everything. Having said that, I’m not against putting multiple components together to make a system that suits me better – in fact this is probably the best way to go about it. Probably the best project I’ve looked into is Davical, which seems to have the calendaring down, but web interfaces and Android support are a problem.

I guess what I’m really wondering is why isnt’ there some nice web application I can install that does all of the above, has connectors for popular platforms (i.e. Thunderbird and Android) and is Open Source? I mean really? I don’t know why this isn’t solved yet! How difficult is it, compared to say web apps like WordPress or Drupal? (I’m kinda hoping that I’ve missed something like this and some helpful person will step out of the Internet woodwork and point me in the right direction).

Of course if I come up with a solution I’ll be happy to share it. If anyone has any tips, please comment below.

Tagged with:
 

Welcome to our third instalment of interesting Python modules. Unfortunately I’m a bit late with this section this week – in fact its next week already! The fourth instalment should be along towards the end of the week thus catching me up.

Today we’re going to cover something which isn’t in the standard library, but is nonetheless very useful. The module is configobj which is used for reading from and writing to INI style configuration files files. A simple INI file is shown below:

item1 = value
item2 = value2
 
[ section1 ]
item1 = value
 
[[ subsection ]]
item1 = value

In the above we can see the simple use of items, values sections and subsection. Subsections can be nested down as far a you want, but I don’t think most applications will need many more than two or three levels.

Installation

As this module isn’t in the standard library, we need to install it. On most Linux distros it should be in the package repositories, for example on Fedora 14:

$ sudo yum install python-configobj

Windows and Mac users can install from PyPi by following the instructions on the homepage.

Basic Usage

Reading from a configuration file with configobj couldn’t really be any simpler:

import configobj
config = configob.ConfigObj(filename)
myoption = config['item1']
mysectionoption = config['section1']['item1']
mysubsectionoption = config['section1']['subsection']['item1']

Basically, all you need to do is open a ConfigObj object by passing it a filename, then you just read from it as if its a dictionary object. Sections and subsections appear as nested dictionaries. Writing to the file is just as simple:

import configobj
config = configob.ConfigObj(filename)
config['newoption'] = 'new stuff'
config.write()

No surprises here, you just write to it as if it were a dictionary. All you have to do it call the write() method when you’ve finished, in order to sync everything to disk.

That’s pretty much it for basic usage. There is much more you can do with configobj, including advanced stuff like validation of configuration files. Check out the documentation for more info.

Tagged with:
 

Seen as its the start of a new month I thought I’d post a follow up to my post on the site overhaul. It hasn’t actually been a month yet, but the tracking statistics are based on calendar months. The short story is that visitor numbers are up, with 446 visitors recorded since the Piwik instance went live (13th Jan) until the end of the month. This beats all my previous records and is only for part of a month. My old GA figures were putting me at around 300 visits per month, though this had slipped recently. So, either there is a large difference in the way the two systems measure visitors or my push to actually put up some content is working! The fact that roughly half my visits are coming from search engines and are coming to newer posts on the site supports my theory that the push is working.

Having said that I’ve slacked off a bit recently (this is only my second post this week). This is mainly because I’ve been putting a lot of work into SwallowCatcher, managing to get a release out earlier this week. Hopefully, in the coming weeks I’ll be able to balance both projects.

In terms of the other action points I had for the site:

  • Google Ads are still here. This is primarily because AdBard have not approved my account yet. I’ve even queried this via their support address and had no response, so I don’t know what’s going on there.
  • Flattr is here! And its actually making me some money, with a total of three flattrs last month. Please, if you like my stuff consider flattring me, it’ll help pay for the site and encourage me to produce more content and software.
  • I have a new theme! Although its just an off the shelf one for now, I haven’t modified it.
  • More pages: well, I’ve posted the project section and a project page for SwallowCatcher. There’s still more I want to do and I haven’t got around to doing a proper profile page or online CV yet.
  • More content: well that speaks for itself. The last month has been a time of unprecedented blogging activity for me. I’m really quite enjoying it and its made its way into my mental todo list for each week, which is a good sign.

That’s just about all there is to it. For those that are interested in SwallowCatcher, since I released on Tuesday I’ve been working fixing some of the issues identified in the release notes and those that people have reported to me. I’ve also been using it day to day to download my podcasts and fixing any issues I encounter. In fact, tonight was the first time I’ve opened my laptop in the last two days. The laptop’s primary use for the last few months has been downloading podcasts when I’m at uni. Now SwallowCatcher is just about filling that niche! I’ll hopefully post an officially updated version sometime over the weekend, with the announcement again going out here.

Tagged with:
 
Download SwallowCatcher 0.0.1

Download SwallowCatcher 0.0.1

I’m very proud to announce the first release of my project SwallowCatcher. This is a project I’ve been working on for some time, but I haven’t blogged about it because I wanted to have something to show for it before I did. To quote the project page, SwallowCatcher is…

A FOSS Podcatcher for Android. SwallowCatcher wishes it was written in Python, but it isn’t. No coconuts were harmed in the making of this Podcatcher.

The naming and general theme is inspired by Monty Python and the Holy Grail, with the release codename for the 0.1.x series being “Bravely Bold Sir Robin”. Subsequent releases will follow with names of other characters from the film.

Right now it’s very rough, as the obligatory release notes state:

Features:

* Import Podcasts from OPML;
* Download Podcast feeds;
* List newly found Episodes;
* List Subscriptions and Episodes;
* Download Podcasts;
* Share via intent (and thence via email, mustard, etc.).

Known Issues:

* The new episodes screen has issues marking multiple episodes as old;
* Can’t add a podcast directly by feed URL yet;
* Can’t play from inside app (need to use external media player app);
* Downloads list is ugly and can’t be cleared;
* Podcasts list doesn’t remember scroll position;
* Downloads aren’t pausable/resumable;
* The text on the first run dialogues is too big;
* The GUI sucks and there really aren’t any options for anything;
* I need some icons!

Future Plans:

The 0.1.x series will focus on addressing the known issues above. The next main
release will start adding new features such as cover art and show notes support.

Anyway, if you have an Android phone then please give it a try. Right now it’s built for Android 2.2 and above, because that’s what I’ve tested it on. Currently its not on the Marketplace due to lack of icons. Also, check out the project page and the gitorious page where you can download the source code. Feedback and bug reports can be submitted via identi.ca, email or via the comments on this post. Enjoy!

Tagged with:
 

Here we are, the second Unofficial Python Module of the Week. Yes, the second – we started from zero (obviously!). This week we are covering the shelve module. Shelve provides you with a very simple Python object store. You can use it where you need quick persistent storage of objects between program runs, it’s much less overhead than using a database – even SQLite. Anyway, lets dive straight into it:

>>> import shelve
>>> shelf = shelve.open("myshelf.db", writeback=True)

Here we import the shelve module (its in the standard library, so there’s no installation required). Then we open our persistent object store, supplying the filename that we want to store the objects in and the writeback parameter, which allows mutable objects to be stored more conveniently (otherwise they are only written when an assignment is performed). The writeback parameter also causes data to be cached in memory, which can be quite memory intensive, so you should call shelf.sync() every so on to flush everything to disk.

You can store anything that can be handled by the Python pickle module in a shelf:

>>> shelf['thedict'] = {'one': 1, 'two': 2, 'three': 3}
>>> shelf.sync()

As you can see, using a shelf is just like using a dictionary. The only real limit is that the keys must be strings. You can also read back values from the shelf as with a dictionary:

>>> print(shelf['thedict'])
{'one': 1, 'two': 2, 'three': 3}

That’s just about it, just remember to close the shelf when you’re finished with it:

>>> shelf.close()

If you want to find out more have a look at the official Python docs for shelve and Doug Hellmann’s PyMOTW posting on the subject.

Tagged with:
 
Set your Twitter account name in your settings to use the TwitterBar Section.

Bad Behavior has blocked 309 access attempts in the last 7 days.