Monday Feb 02, 2009

About planet and some Python lessons

I have some exciting plans for using the planet feed aggregator and have over the last couple of weeks using the “Venus” code line. I can now install on Ubuntu and the install passes all its tests. I want to be able to write a filter for the my plazes and also see how the foaf output might be used. I met up with my colleague, Dave Edmondson and we discussed the strengths and weaknesses of Python and planet.

The script planet.py runs two other python programs called spider and splice.

Spider gets the feeds defined in config.ini and creates a local cahce version, splice, reads the cache and generates the new formats from templates. The diagram below does not illustrate the template source files for the output formats and I shall probably need to dig further into the code in order to understand what needs to be done.

The diagram also indicates the location of Venus' plugin, where the plazes filter should be located.

We also discussed Python. I have been trying to write a game theory solver for a 2x2 formal game. I was representing the game as a dictionary so that I could retreive game scores using the strategy names. One problem is that two dimensional dictionaries get syntactically combersome. I had ended up with a list as the key. In theory it should make the programming easier, where game is a dictionary attached to class instance g.

i.e. score = g.game[('decoy', 'defend')]

makes great sense where decoy and defend are blue and red strategies, however, I have usually placed the evaluation of a score in an interation, and so coding the strategy names is rare e.g.

strategies=['heads', 'tails'];
for s in strategies:
   # some iterated code

It is probably simpler to represent the game as a 2x2 matrix held in a list and to use the classic technique of holding the names of the strategies in an ordered list so we can translate the matrix cell location such as n(1,1) into n(tails,tails) by looking co-ordinates up in one, or two name lists.

strategies=['heads','tails']
score=matrix(strategies.index('heads'), strategies.index('heads'))

This would also have the advantage that I could look for and use the matrix manipulation packages that exist to avoid writing a lot of code. The code would look a lot simpler, and not just because I have put a lot of it in an external package; this is usually a good clue that the answer is correct.

Lesson 1: Be careful when using dictionaries.

tags:

Thursday Feb 21, 2008

Organisation and Communication

Just trying to sort myself out from my last trip abroad.

Firstly, I have sorted out my twitter so that I am now receiving on the phone from all my correspondents. I have looked at forwarding my twits onto my personal planet, but wget fails for some reason. I need to investigate further, although twitter's FAQ talks about a configuration feature. I shall only be using it occasionally, probably in emergencies to let people know that facebook/e-mail is not available to me, and to use other means to contact me.

It might be sensible to ensure that really important people subscribe and follow me, although they might expect a personal message, and also don't care about my internet connectivity.

I have also revised the my flickr application on facebook so that it forwards everything, not just the London pictures, and my facebook correspondents can now see the pictures as I upload them. I am not sure if it auto-updates, but I can force it to write into my mini-feed, so hopefully people get notified when new pictures go up. Now I just have to find time to upload them. The most recent uploads are from Spain and my Madrid trip, the most recent pictures are from Dubai. This will hopefully improve the quality of my facebook feed for those who follow me there.

Its a shame that I am trapped on such an old version of planet-planet, there's a couple of things that don't work as well as I'd hope. The slynkr posts are still broken, they don't display the description, but a generated comment, I have never got round to including either this blog, nor the flickr pictures. The plazes feed My Plazes - Atom feed is also mis-mapped, but  I am working my way through the O'Reilly python book to see if this helps me build a personal feed that does what I want.

tags:

About

DaveLevy

Search

Archives
« July 2014
MonTueWedThuFriSatSun
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
   
       
Today