Thursday, 24 May 2012

Life with Pi

    My Raspberry Pi single board computer arrived just over a week ago after a long wait for my ordered unit to be manufactured and shipped. I wrote back in early March about my thoughts on the product launch and I outlined my plans for the device a couple of weeks ago, now I've had it in my possession for a week here are my thoughts about the board itself.
    On first unboxing the unit my reaction echoed those of other reviewers, this is a small device. Of course we all knew it would be credit card sized, but having the board in front of you really brings that home. We've become so conditioned to computers requiring significant space for peripherals and heat management that one without that need is something of a shock.
    Gathering together the required peripherals was an easy task. I already had network and audio cables, as well as a micro-USB phone charger and my venerable Logitech wireless keyboard and mouse combo. I had to buy an HDMI to DVI cable because my TV is in reality an Acer monitor hooked up to a PVR and doesn't have HDMI. Thankfully the days of crazy pricing for DVI or HDMI cables are behind us.
    Similarly, downloading the Debian Squeeze reference distribution from the Raspberry Pi website and installing it on an SD card was very straightforward. Some SD cards have been reported as having problems with the Pi, I can confirm that my Lexar 8Gb SDHC card has no such issues.
    So with all peripherals and software in place and connected, I turned on the telly and plugged in the phone charger. Without fuss, the LEDs on the Pi lit up, and the Linux boot screen appeared on the TV. Success!
    Success, that is, until it hung during the boot process. But a very helpful message explained that this can happen at first boot and simply rebooting the device would fix matters. A further reboot and login process, and I had a bash prompt. My £25 Linux PC was a reality.
    Given a working computer with a Linux command line, the world is your oyster. I am reviewing the hardware for this piece rather than the software because I feel every Pi owner will have their own plans for the device and simply describing a Linux distribution will be of little interest. So the software is only described in this piece in scant detail, and to give an idea of the speed of a Raspberry Pi compared to a more familiar computer.
    So I typed startx at my prompt, and was rewarded with the LXDE desktop. As a simple first task, I loaded the BBC Weather site and then GMail in the bundled Midori browser. Hardly heavy stuff, but it gives a good idea of the speed involved.
    I have heard the Pi described as having performance similar to a Pentium II with a very fast graphics adaptor. By coincidence one of my desktop PCs is a Pentium II 266 running Lubuntu, so given that the Pi's Debian does not yet have driver support for the graphical acceleration I would say that the performance of both machines is very similar indeed. Browsing is a usable experience, but a slow one. A typical web page will take over ten seconds to render, but in-page Javascript features are usable in real time once the page has loaded. Services like GMail for instance are a bit slow-feeling, but not so slow as to be impossible to use. Having used the Pentium II as my main development platform for several years before moving to my laptop I do not expect a Pi with similar performance to struggle with the kind of scripts I am likely to use it for. On that note, I installed the Python Natural Language Toolkit package which will be a significant plank of the project I plan on using my device for.
    If I have any software gripes, they are minor and will I am sure be fixed in future distributions. The image is for a 2Gb SD card, and though instructions are readily available online for extending the partition onto a larger card they are not for the faint hearted and would benefit from being made easier as part of the Pi distribution. GPartEd is bundled and might perform this task but trying to use it revealed a further gripe; the administrator password doesn't seem to be available. Of course I could use sudo from the command line to achieve this aim by other means, but to someone with little knowledge of Linux this would be a show-stopper.
    I would like my Pi to run full-time next to my router, processing keyword data. To this end my interest in the Pi centres on its low power consumption and heat dissipation, I do not want a traditional PC with all its heat issues running full-time in my home. I put the Pi to the test on this front by constantly reloading the BBC website for several minutes in Midori, causing the CPU graph to show as maxed-out. If the Pi had a traditional Intel processor then merely running LXDE would cause it to be too hot to touch, as it was I could put my finger on the Pi's memory/processor combo and feel that it was merely discernibly a bit warmer than its surroundings.
    The Pi's small size means that there is plenty of space behind my telly for it next to the router. But with a bulky HDMI cable plugged into it there was something of a feeling of the tail wagging the dog as the weight of the cable threatened to pull the board with it. Also the board layout with cables on all sides meant that positioning it was slightly difficult. But that is an acceptable compromise as has been explained by the Raspberry Pi team, for reasons of size and cost. My solution to the mechanical issues of a small board held only by a selection of cables was to make a simple case from a surplus business card box, a speedy procedure involving a set of nail scissors. This case does not seem to result in the Pi becoming too warm, and will probably end up being fixed to the router using sticky Velcro pads.
    In conclusion, after a chance to play with my Pi I am still extremely impressed by it. Sure, the software distribution has a few very minor gripes, but this is very much still a product in development by a volunteer organisation. Some care is needed in mounting or enclosing a Pi to protect it from damage, but that is no more than would be expected for any printed circuit board. Otherwise it is an extremely powerful computer for its exceptionally low price and with a low power consumption, so I look forward to it spawning the same diversity of creative computing that its 8-bit forebears did. If you haven't ordered one, do so now!

Monday, 14 May 2012

What I'm going to do with my Raspberry Pi

    That magic email from Farnell came on Saturday, my Raspberry Pi is in the post!
    So, what am I going to do with it?
    Like loads of other geeks I expect I'll plug it into my telly, connect it to my router and use it as a web terminal and media centre with geek bragging rights. There it'll sit for however many years it takes until I get a new telly or a Raspberry Pi 2, unseen and uncomplaining. But rather wasted, don't you think.

    Somewhere, the Flying Spaghetti Monster has just killed a kitten.

    So what do I really want it to do? I will have a very small and moderately powerful computer - insanely powerful by the standards of a few years ago -  that uses negligible electrical power and can be left on all the time. I'm still going to plug it into my router and telly, but to make it earn its keep I'm going to have it run my keyword analysis tool.
    Events have moved on a little since my blog post describing the tool, but the principle is still the same. I take new posts every day from a big list of RSS feeds and process them for keyword phrases which I store in a database. I can then extract frequencies and collocates over time, which gives me a picture of the interrelationship between the language and terms in the news over any given period. It not only fulfils my original aim of having a tool that would generate keywords and phrases for previously unseen search terms, but also allows any newsworthy subject to be examined in a way that is not possible by any other means.
    The original tool runs in PHP on my Windows laptop. Its MySQL database is pushed well beyond its limit, and I have been working on a version that uses a large directory tree of precomputed JSON files instead. It's an approach I've since also used in my work, relying on the principle that disk space is cheap and quick while complex joins on monster MySQL databases are expensive and slow.
    I could of course compile PHP for my Pi. It's probably already available precompiled anyway. But the Pi's a Python platform (Try saying that after five pints of real cider!) and that offers me a unique opportunity. My PHP code does the job, but it relies on my own language processing libraries which I built myself as a search engine specialist. I'm not a computational linguist so I'd be the first to say that they aren't as good as they could be.
    Python has the incredibly useful Natural Language Toolkit libraries which allow me to do so much more with my source texts, and so much more quickly than my PHP code. So my first effort with my Pi will be to port my keyword tool to Python, using the NLTK instead of my own library. The Pi will still sit behind my telly and be used for the occasional bit of web surfing, but for the rest of the time it'll be crunching keywords and giving me lots of lovely language data that I can work with in real time rather than with enough time to make a cup of tea every time I make a MySQL query.
    In a way I'm not taking advantage of everything the Pi can do. Almost any internet connected computer could do this job, I'm only using a Pi because it's cheap and low power, and I've lusted for one ever since I read their early press releases. Other people will use the Pi's hardware capabilities to do much more eye-catching things. But my Pi, quietly crunching words all day and night behind my telly, will still be earning its keep. It will allow me to learn new things and since its data is likely to end up in some of my work stuff it may even in its own small way make a contribution to the wider understanding of language.
    So that's what I'll be doing with my Pi, what'll you be doing with yours?

Sunday, 6 May 2012

How We Deal with the Homeless Problem in Oxfordshire

    If you were given a heap of money and told you had to spend it deal with some homeless people living in Oxford, how might you proceed? Go on, you can spend it how you'd like.
    Perhaps you'd invest it in some kind of housing, maybe a subsidised rent scheme or something. I'm not a housing expert, but you'd kinda expect the solution to have something to so with housing, wouldn't you.
    In the past few weeks I've seen the authorities spend a considerable amount of money and effort on some homeless people here in Oxford. What they did with their money, and how incredibly useless and damaging the result of it all has been, is such a disaster that I feel it has to be disseminated more widely.
    If you wander round Oxford's more overgrown corners, you'll encounter a homeless community that lives full-time outdoors somewhat unseen in tents and rudimentary shelters. Being a natural explorer and chasing random wildlife I've encountered people living in this way all around the edges of our city, in City of Oxford, West Oxfordshire and Cherwell council districts. These aren't the people you'll see sleeping rough in doorways and they aren't the people who visit the homeless shelters. They are spread about such that they aren't more noticeable in any one place (with notable exceptions of the floating community on the Thames backwaters and that encampment a few years ago where Osney Mead meets the railway) so we don't talk of favelas, barrios or shanty towns. I have no idea how  many of them there are, but since I keep encountering them there must be quite a few people living in this way.
    A few months ago I got to know a pair of tent-dwelling homeless people. They are friends of a friend of mine, and their tent was pitched in some bushes on land owned by an Oxford college.
    I had better make this very clear, they did not choose to live in a tent. They would do anything to find accommodation, but time and time again the system has failed them. They do not seem to fit any of the categories required to advance their case for housing, so they are among the city's long-term homeless.
    I'd also better make something else very clear indeed: They aren't dodgy. The police all know them, and despite their situation, they are not "known to the police". I've seen their interactions with police officers, and there was none of the attitude you get from police when they think they are dealing with a criminal. Neither of them has a criminal record and neither of them has ever been arrested for anything. They were at pains to minimise their impact of the field because they knew to do otherwise would only invite trouble.
    Earlier this year, eviction proceedings were started against them. The owners of the field wanted them out. Which is fair enough, it's their field. So lawyers and courts and enforcement officers and God knows what other legal machinery was brought to bear against them. Without a fuss, at the last possible moment, they moved out. No sense in falling foul of the law when you are as vulnerable as they are.
    What does a homeless person kicked out of one pitch do? They look for another one. Our city has no shortage of forgotten corners, so their tent was pitched once more somewhere else before too long.
    Unfortunately though we then had the wettest April for many years. Their new pitch was flooded, ruining their tent and all their belongings. From camping on someone else's land with semidecent shelter, they're now camping on someone else's land with very inadequate shelter.
    So to summarise the last few paragraphs: a lot of money was spent by both the landowner and the Authorities to evict from a field a pair who really didn't want to be there anyway, and because of that eviction they're now in a much worse state, yet still camping on someone else's land. So nothing much has changed overall, except a lot of money has gone to a load of lawyers, and the two homeless people in question have had their lives made a whole load worse. No doubt in a few months a fresh set of lawyers will be expending billable time to ensure they are moved on again.
    Homeless people like these two do not want to cause problems. They simply want somewhere to live, to get out of the cold and damp. If they represent any kind of problem and any cash is going to be chucked around, it does not take any kind of genius to reach the conclusion that perhaps the problem would go away if the cash was spent on housing them rather than on legal manoeuvres which as I hope I've demonstrated above are pretty pointless. That this doesn't happen does not reflect well upon those authorities responsible for the provision of services to homeless people and is a sad indictment of our society.
    All I can do is write about it here, I'm not some philanthropist or power-broker so I can't put anything right. So my tech blog has been subsumed by a bit of minor political ranting for a while. I think that the above represents such a cock-up that people of most political persuasions should find it as annoying as I do, if you agree with me please share it. Maybe then something positive can happen.

Tuesday, 1 May 2012

A simple question for SEO practitioners everywhere

    My friends ask me for advice when they are looking at search engine marketing services for their websites. They've usually got some pushy SEO salesman giving them the hard-sell. "We can put you on the top of Google searches!".
    I tell them to ask this simple question of SEO sales people who make that particular promise.

    "What's your name?".

    If the answer ain't "Larry Page" or "Sergey Brin", my excedingly distant ex-employers from my Google Rater days, they're lying.