First Python Steps 
Today I completed my first completely useless python script.

All it does it look at a string, and tell you how many times a word occurs. Thats it.

It took me 2 days, and I'm sure it could be done another way, and better. Still I am very proud.

Here it is. Enjoy.


#! /usr/bin/python

def wordcount(a):
memory = [] # create memory
a = a.lower()
a = a.split()


for i in a:
if memorylength == 0:
print i
print a.count(i)
memory.append(i)

elif i not in memory:
print i
print a.count(i)
memory.append(i)



[ 3 comments ] ( 13 views )   |  permalink
Soda Bread 
Soda bread is very easy to make, and tastes great covered in butter, with a cup of tea.

It has taken me a while to find a decent simple recipe, but my housemate gave me hers not long ago. She inherited it from her grandmother, and I have made my own (very slight variation) on it.

Ingredients

1 lb Wholemeal Bread Flour
8 oz Plain Flour
1 tsp Salt
1 tsp Bicarbonate of Soda
1 tsp Cream of Tartar
1 tsp Sugar
0.5 pint Milk
5 oz Natural (Plain) Yogurt

Method

Mix all the dry ingredients together well.
Add yogurt.
Slowly add milk whilst stirring.
Make dough into a 1.5 inch thick round, and cut a deep cross.
Put into a pre-heated oven at gas mark 5 for 40mins.
Remove from oven, and leave on a rack to cool.

Done!

Enjoy the soda by dipping in stew, or buttered with jam.

[ 2 comments ] ( 14 views )   |  permalink
Image Tricks 
Problem
Having a large collection of images that need resizing or rotating.

Old solution
Open Gimp, re-size, re-save. A very slow method.

New solution
Gnome Nautilus plugin. Here you highlight all the photos you want to resize and an option comes up in the right-click menu for "Resize Images..." and "Rotate Images...."

How to install

On Ubuntu it's very easy.


sudo apt-get install nautilus-image-converter

nautilus -q


The "nautilus -q" command should quit nautilus, and Gnome should restart it. If that doesn't happen, just log out and log back in again. Then you should have the new plugin installed.

[ 1 comment ] ( 5 views )   |  permalink
Branding, the marking of the beast 
I recently became interested in the OpenStreetMap project, and did some mapping for them. I was fortunate enough to be able to borrow a GPS device, but to do mapping on my own I needed to find my own.

Being eternally short of cash my planned solution was to use a "smartphone" and bluetooth GPS device borrowed from my mum, that I could install a piece of software and record my GPS tracks. The software exists, and is called TrekBuddy. Unfortunately my use of Ubuntu and free software in general has made me compliant with the ideal that when I install something on a device, I expect it to work as long as I have fulfilled the technical requirements. As far as I could see I had a compatible phone, GPS device, and java virtual machine installed, but the software would not work correctly. All because of the arbitrary will of a company.

Now the sense of confusion I have when it comes to mobile phones is what I imagine it is like for those who are unfamiliar with computers. There are a myriad of acronyms companies and products that overwhelm the novice user. Hence why I stick to my trusty Nokia 1100. So finding a solution was frustrating, only to be confronted with the problem of "Branding".

Now many people are familiar with the concept of "unlocking" where you can remove the software block that only allows one companies sim cards to be used in the phone. Unlocking is ubiquitous in the UK, the service is provided by many outlets and and can be done in a matter of minutes. Usually for around a tenner. I have had this done to all the phones that I ever inherited from contracts. It is much more useful to have a phone that can be swapped between networks, that it is to have one crippled and limping due to one provider.

"Branding" is a different matter entirely. "Branding" on mobile phones goes beyond painting your companies logo on the outside of the case, it now goes to the very core of the phone itself. Smartphones run full blown operating systems, this is what allows them to be "smart". But mobile telecommunications companies however are not, they will request that a manufacturer add extra customisations to the phones software. Superficially this is making the secondary button on the front go to your iTunes-a-like service or load up a browser pointing at your website. But it goes deeper, in my case the Java virtual machine would not allow java apps to write or read to memory unless they had been signed by the appropriate certificate authority. As far as I could see TrekBuddy had been signed, and the certificate was installed, but the certificate was not trusted enough to allow programs access to phone memory. A frustrating experience. This is all due to mobile manufacturers being paranoid about malware etc, but this seems to be to the detriment of users, and profit of certification companies.

A phone can be "unbranded" by flashing with the generic firmware of the manufacturer. I had this done, only to find the market stall where I had done it installed an old version of the firmware, and that the only place I could get an up-to-date version was from an official vendor, for even more money! Although this is due to the phone being so buggy it doesn't work with the official Windows updating software. Still there is no easy way to install certificates on the phone without a contract for 3G internet browsing.

Getting a smartphone to do what I wanted didn't seem like it should be difficult, but now its going to start costing me more in time and money to continue. The only conclusion I can come to is that in the future buying a product that supports a sensible development model, and recommend that others stay away from restricted mobiles. Unfortunately there are not many products on the market that fulfil my criteria, although there is hope.

The Neo1973 is based on work done by the OpenMoko project, a GPL mobile OS, and looks very promising. Fingers crossed!

[ add comment ] ( 4 views )   |  permalink
Gone Mappin' 
OpenStreetMap is for geographic data what the Linux kernel is for operating systems. The aim is to eventually have a complete map of the world, this is a monumental effort and one that I believe is worthwhile. For in the UK the only mapping authority available is Ordnance Survey, a government funded body, who own copyright to the maps they produce and charge a fortune to those who wish to use them.

This situation is morally wrong, as this prevents academics and individuals using the data in new and possibly very beneficial ways. Or even the more mundane ways such as publishing a map to your business, without incurring a huge license fee.

The volunteers of OpenStreetMap are very enthusiastic about what they do, and gain a great enjoyment from wandering and discovering places they have never been, or better yet finding nooks and crannies of places they have!

Most data seems to come from individual volunteers working independently, but last weekend (12/13th April) there was a "Mapping Party" for the south Birmingham area. It was organised by Andy Robinson as OSM data for the south of Birmingham city centre consists of only main roads and vast void areas.

This was my first time doing actual mapping for OSM, I had before spent a good hour figuring out how to name some roads in Selly Oak and that's where it ended. The mapping party was due to start around 9:00 at the Kitchen Garden Cafe, and the majority had arrived by 10:00.

As soon as Andy Robinson arrived the event was kick started, with projectors and maps being set up around the small office that had been hired out for our use. Soon we had huge A0 posters of the area on the walls, so that people could mark the area they would like to map.

The OpenStreetMap foundation had even brought around a dozen, compact Gecko 201 Garmins for the volunteers, like me, who did not posses their own GPS equipment. But more importantly they had people who were willing to show me the ropes. So I spent the morning mapping with Brian, whose advice was invaluable. He gave me some basic lessons in mapping, what the do's and don't do's were etc.

The afternoon I took out to Kings Heath by myself, with a Garmin GPS gaffa taped to the handle bars of my bike. It is the common consensus that the best way to map is by bicycle. A bike had the advantage of being allowed pretty much anywhere unlike a car, and you can cover large distances, unlike just walking. It was great fun exploring all the back roads and pathways, but it gets you a few strange looks stopping and writing down road names.

The standard method for collecting road names and other features is to carry a GPS device that logs your position every second, and a pad and pen. That's it! The simple joy of OSM is the very low level of entry. The easy bit is getting the GPS trace, the hard part is making decent notes as later on you will be referring to them to construct the map data. As this is a grassroots project how many notes you make is up to you. Nearly everyone will record roads, but then there are foot paths, canals, and cycle lanes which you could record. Or you could go into more detail such as bus stops, hospitals, crossings, traffic lights, post codes! The list is almost endless.

As you can imagine this can make note taking slow and very messy. Even my simple mapping got complicated very quickly.



But the OSM mappers are an inventive bunch. This is a group of people so dedicated that they wrote their own software to map the planet, and some of the features and plugins for it are very clever. You can carry along a digital camera with you, and take pictures of road names, etc, and then use that as your reference when you return. This is done by taking a photograph of the GPS device showing the current time. Then later the JOSM software will calculate the difference between the first photograph's time stamp and the given GPS time, and then overlay all the subsequent photos on top of your GPS data! There is even a plugin to do the same with audio recordings. Truly an example of "Necessity being the mother of invention"!

There were a few hic-cups during the day, rain being one of them, but also the police and bemused members of the public. To a cynic it was of little surprise that the only asian member of our group was stopped by the police in what appears to be an "Statutory Power or Street Encounter", but the general feeling of the group was to laugh it off. In fact others seems slightly jealous that they had not got one!



All in all a very enjoyable day, and it was unfortunate that I could not attend the second day. And the product of our work can now be seen on the OSM website, in the form of a much more feature rich South Birmingham!

[ add comment ] ( 3 views )   |  permalink  |  related link

<<First <Back | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | Next> Last>>