Pete Ryland's Web Log
I didn't want a blog but they made me do it.Sun, 23 Dec 2007
Well, I'm not sure how many people will read this, but for what it's worth, I just want to wish everyone a very happy Christmas and very merry new year! I'm off to Morocco tomorrow for two weeks, capping a very travely year, with trips to Portugal, Spain, Australia (twice!), and Japan happening all this year. Next year, I've already booked for a trip to Hong Kong in January and there's a Spring Canada trip on the cards too. I was thinking of heading to Turkey for summer too for two weeks to catch up with Nix again, but we'll see how that pans out.
Congratulations must go to Chizuko and Horms and Susan and Nigga for tying the knot this year! May this be the first of many great years to come for both couples!
Work is going well, and I'm still a Technical Consultant at Tideway Systems as I have been for the last 15 months. It's great fun and I'm visiting many interesting clients in all industries, mostly banking and government.
Anyway, greetings to all, and I hope you all have a fantastic Christmas holiday and a fantabulous new year. I do hope to see you all in 2008. >
Wed, 29 Aug 2007
Last night I attended a quite memorable event entitled An Evening with William Gibson. The author of classics Neuromancer and Pattern Recognition, Mr Gibson read from chapter two of his new book Spook Country, which he indicated was orignially intended to be the primary chapter. To be honest, his oratory skills pale in comparison to his story-writing ability, but it was great to be read to by the author himself.
The reading was followed by an interview on stage with John Sutherland, with questions from the floor after that. There was also the obligatory signing once the formal part was over.
Many topics were discussed but a few topics recurred and stuck with me. One was the political nature of the new book compared with the previous books to which he stated that he wouldn't be offended if someone considered Neuromancer (which was set some time in the future) anti-Regan, and in the same way, Spook Country (which I haven't yet read, but is set in the very near future) could be called by someone anti-Bush without causing offence to the author. I liked the way he phrased the sentiment, but his thinking is that all his books have some political angle, and the time of the setting makes little difference.
Reference was also repeatedly made to Node Magazine and the interactiveness of modern fiction. He considers that we are already in a world of interactive fiction and that he planted many pages on the internet for people to find when reading his books and performing web searches on the characters and other things mentioned in the narrative. This was very much the case with Spook Country but was also the case with Pattern Recognition but to a much smaller degree, and with less community involvement.
He mentioned he'd been working that day on the Wikipedia entry for the Bigend character in the book, which raised a chuckle from Prof Sutherland and he offered a more French-like pronounciation to replace Mr Gibson's overtly Engligh-based take on the fictional name.
See also:
- the official William Gibson Books site,
- the (unofficial) Spook Country UK Blog, which has a brief write-up of the evening,
- the (unofficial) William Gibson Board whose members were out in force and in style,
- Flickr's collection of photos of the evening.
Wed, 29 Nov 2006
I am quite fond of the Loop The Loop (aka Slither Link) puzzles so I decided to write a solver in python for them. It reads in files like this example puzzle file. It wasn't very quick, so I ported it to this C version which is much much quicker.
>Mon, 30 Oct 2006
I was playing with GWT the other day, and with RRDtool as well, and made a little stats generation thing for my computers at home:
You can see it live too at http://pdr.cx/dstats/ but note that it will come up with a broken image the first time you load it (I have fixed that now, but it's not in a version ready for the live site) so just click on the broken image to select the server, statistic and time period.
I don't have exactly oodles of outgoing bandwidth, but locally it is very quick to load. It updates every minute, and the stats are acurate to the minute with no real lag involved. It can actually be quite difficult to see the graph moving but believe me, it actually is - no more refresh meta tags for updating stats pages!
>Wed, 18 Oct 2006
And here it is: egg20061018.tar.gz complete with two example applications as described below.
A week on from last week's release and it has really moved on in leaps and bounds. The following is a list of the recent improvements:
- The variety of decorators has been replaced with one,
egg.eggify, which intelligently decides how to wrap the method - Toolbar support has been added
- Statusbar support has been added
getwidget() et
al calls.
Anyway, on with an example:
#!/usr/bin/python
import egg, gtk
class EGGFileView(egg.App):
"""A file viewer example application for EGG."""
# Set up filename as a context since some functions require an open file.
# When set to None, 0 or False, it will disable widgets needing this context.
filename = egg.context(None)
# The egg.eggify() decorator wraps all our callback methods in order to
# provide necessary widgets automatically
@egg.eggify()
def open(self, filename):
# Note that method docstrings are in the imperative
"""Open a file (read-only)"""
# Pretty rough code: just read the *whole* file into a gtk TextBuffer
file = open(filename)
mytext = "".join(file.readlines())
file.close()
self.textbuffer.set_text(mytext)
self.textbuffer.apply_tag(self.mytexttag, self.textbuffer.get_start_iter(), self.textbuffer.get_end_iter())
# Tell the user what we've done
self.feedback(filename + " opened.")
# Provide the filename context, enabling appropriate widgets
self.filename = filename
# We provide the filename as our context to the eggify decorator function,
# since we can't perform a close() without a non-None filename
@egg.eggify(context=filename)
def close(self):
"""Close the current file"""
self.textbuffer.set_text("")
# Tell the user what we've done
self.feedback(self.filename + " closed.")
# Remove the filename context, disabling functions requiring an open file
self.filename = None
def __init__(self):
egg.App.__init__(self,
menu=[["_File", self.open, self.close, None, self.quit],
["_Help", self.about]],
tools=[self.open, self.close, self.quit],
version="1.0",
authors=["Pete Ryland "],
copyright="Copyright (c) 2006 Pete Ryland",
license=egg.GPL
)
# The below is standard gtk-type code. This gives you an idea of what
# we're saving ourselves from by using EGG. Of course, EGG will eventually
# provide TextView setup stuff somehow. Please let me know if you have any
# good ideas about this or other unprovided stuff like layouts.
self.mytexttag = gtk.TextTag()
self.mytexttag.props.family = "Monospace"
self.textbuffer = gtk.TextBuffer()
self.textbuffer.get_tag_table().add(self.mytexttag)
textview = gtk.TextView(self.textbuffer)
scrolltextview = gtk.ScrolledWindow()
scrolltextview.add(textview)
scrolltextview.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
self.set_contents(scrolltextview)
if __name__ == "__main__":
a=EGGFileView()
a()
Here's a few things to note:
- The menu and toolbar are set up in the egg.App.__init__ call with lists of methods. The About information is set there too.
- The methods are called
openandclosewhich happen to resemble the names of gtk stock items, and so those items along with their standard shortcuts and pretty icons are used. - Because
opentakes a single argument calledfilename, eggify automatically knows to launch a file selection dialog first, and send it the filename. The method name and its argument are used to determine whether the file selection with be an "open" or "save" one, work on directories, and/or allow multiple selections. - The inherited
feedbackmethod sets the statusbar message, but it's still very early days for this part of the API.
Well, please do try it out, the tarball is linked at the top. And don't hesitate to send me an email with any feedback you may have (whether positive or negative!).
>Wed, 11 Oct 2006
As promised, I have started on a higher-level pythonic API for gtk/gnome, built on top of pygtk/pygnome. As I'm too busy right now to package it properly, the prototype is available as a single file called egg20061011.py so if you want to try it out with the following examples, please rename it egg.py.
Well, after a brief amount of hacking about, egg now supports menus, buttons, the about dialog and the start of file selection support. On to the first example:
#!/usr/bin/python
import egg
class ButtonExample(egg.App):
"""A button example for EGG."""
@egg.button()
def clickMe(self):
"""Prints a message to standard ouput"""
print "You pressed my button!"
def __init__(self):
egg.App.__init__(self, version="1.0")
mybutton = self.clickMe.getbutton(self)
self.set_contents(mybutton)
if __name__ == "__main__":
a=ButtonExample()
a()
This example shows the general feel of what I'm aiming at. Notice a few
time-saving features:
- Default menus are provided, with File->Quit and Help->About
- A default About dialog is provided automatically
- A button factory (clickMe.getbutton) is created automatically by the egg.button() decorator, and connects the button to the callback
- The callback doesn't need to receive the widget that caused it as an argument
- The docstring for the button is used for the tooltip and the callback method's name is used for the button's label string
- The docstring for the App is used as the AboutDialog comment, and the class's name is used for the application name by default
#!/usr/bin/python
import egg
class MenuExample(egg.App):
"""A simple example of how to do menus in EGG!"""
@egg.menuitem(accel=ord('n'))
def newWindow(self):
"""Creates a new window"""
print "My callback was called!"
@egg.stockmenuitem(stock_id=egg.STOCK_OPEN)
@egg.fileselector()
def open(self, filename):
print "Opening:", filename
def __init__(self):
egg.App.__init__(self, version="1.0",
menu=[["_File", self.newWindow, self.open, None, self.quit],
["_Help", self.about]]
)
if __name__ == "__main__":
a=MenuExample()
a()
This shows how to set up menus with egg. Simply create the appropriate
methods, decorate them with one of the menuitem decorators, then specify them
in the menu parameter of the constructor to egg.App, which takes a special
format. Each menu is represented as a list, with the first item being its
title, and the following items being either a menuitem method, a submenu array
or None for a separator. The top-level menubar is different only in that it
doesn't contain a title. There are also decorators for RadioMenuItems and
CheckMenuItems. Notice how two decorators have been used on the open method;
one creates an intermediate callback that creates a file open dialog and then
calls back the open method with the filename if the operation was not
cancelled. Notice how the open menu item's label has "..." appended? Egg
knows the menuitem will be opening a dialog, so does this automatically. Don't
be too scared, though, you can specify a label yourself too!
>
Tue, 10 Oct 2006
Well, I've not done any major gtk programming for some time, and certainly not much gtk stuff in python, so I thought I'd see where that was at, and was quite dissappointed. Last time I looked, the documentation was pretty sparse, and pygtk was not much more than a swigging of libgtk. Now, well, it hasn't really improved a lot. It's up to date with the latest gtk and gnome versions at least and has improved the way gtk objects are mapped, but the documentation is still pretty lame, and the few tutorials I've found have been more about using glade than getting dirty with pygtk and pygnome. And quite right, too, it really does feel like a C API, which basically defeats the purpose of using python -- I may as well just code in C! The #gnome channel on gimpnet wasn't much help either, unfortunately, suggesting that people were moving away from this API.
So, I've decided to take on the challange of writing a more pythonic higher-level API for gtk, building on pygtk and pygnome (and their hard work) using more pythonesque features, including some newer ones such as decorators. The intention is to create an API that is primarily easy to use, so will do things like allow gui objects to be provided automatically by simply decorating a method with the appropriate wrapper, and provide sensible, working defaults to enable users to get something working quickly, a bit like scaffolding in RoR.
First things first then, the name. After not too much thought, I came up with EGG, Easy Gnome Gubbins. So there we have it. Expect to see some more about this in the very near future!
>Thu, 11 May 2006
I interviewed with Google recently, for a job in their SRE department, and this blog entry is mostly to provide a quick heads up for anyone else seeking to do the same and wishing to be more successful than me. ;-)
Update: I've removed this entry now upon (polite) request from their recruitment department, but feel free to email me if you want any (general) details of their recruitment process. >
Sun, 09 Apr 2006
Hmm.. well, nothing to do with XOR at all. I should have realised sooner,
and it's still a nice but thoroughly unobvious trick, but x &
(x-1) does the job nicely.
Anyway, I've been happily working for the last three weeks for a wholly-owned subsidiary of Banque Société Générale called Squaregain but soon to be united with Selftrade after both were bought by Boursorama. This makes us the second-biggest retail trading player in the UK. Anyway, the people are great, the commute is nice - they're Docklands-based (about 2 miles away) - and the work is good. I've been getting my teeth into an updating of the web servers at the moment. They've been running Websphere on AIX and my first main project is to get us using apache and tomcat on Linux on Power5. I've set this up nicely now with separate tomcat processes for each brand and apache doing the SSL. Extracting the SSL keys and certificates from IBM's tools and converting them to PEM format proved quite a fun learning experience. Other than that, it's been pretty straight forward, writing lots of scripts and infrastructure stuff to automatically configure a server from scratch and deploy all the latest webapp builds. And last week, I got to test it all out by rebuilding the UAT machine which went very smoothly. It went about half and hour past my window because of a few issues regarding the network cards and the webapp configuration but all in all I was quite pleased.
There is only actually one tiny thing I don't like about the new job though, and that is the proxy server. At Create I got very used to having a direct connection to the Internet, one of the rare benefits that Unix Admins usually take for granted and one of the reasons I prefer it to development work (the other reasons I'll leave to another day). At Squaregain, however, the department's internal infrastructure is run by IT Support next door, and not by us; we only look after the external-facing infrastructure. Anyway, I think this is actually the first time I've worked somewhere that uses a Microsoft solution for most of the internal infrastructure and certainly the first place that has enforced on me the use of an ISA Proxy Server. Now I've heard of these before, and nothing good. I thought people were just whinging about being behind a proxy server at all, but seriously, this thing has some horrible bugs. Firstly, it requires NTLM authentication, which in itself isn't a huge problem, but if you have applications that first try basic authentication it will actually accept the request, then hang for about 5 minutes before finally passing on the data. It would be preferable not to accept the request in the first place rather than keep the user waiting, as the application will then hopefully get an NTLM authentication request back. To make matters worse, when downloading files with it, instead of passing on the data as it comes, it actually waits for the whole file to be downloaded before passing any of it on. Fortunately we have a fast connection so this is not that noticable. But really, this product really stands out as one of the shoddiest pieces of software I've ever had to use. Ok, rant over. Sorry. And "Yay" for ntlmaps! >
Thu, 30 Mar 2006
Mon, 20 Feb 2006
Further to the last post, Mark has put his, Adam's and Jon's photos up. >
Thu, 16 Feb 2006
Just got back from a great ski trip last week. I went with Rich, Paul and Dave and some of their many Manchester mates to France for a supurb week of fun. Mark did an excellent job of organising the week in the Three Valleys of Méribel, Les Menuires/Val Thorens and Courchevel. We stayed in Les Allues, a short "bubble" ride from the slopes.
The place was massive. It is the world's largest skiing area with over 600km of groomed runs. The lack of a decent snowfall and the bright sunny days, however, made for a distinct lack of snow on the mountain. In fact, it was mostly quite icy, with only the dustings of artificial snow from the machines creating a carvable surface.
Enough about the snow - the social life of this place more than made up for it. In this English-dominated resort, the locals were all pretty laid back and friendly. The Covie Chalet reps and caterers, Benno and Kaz, not only provided us with great food and all the information we needed, but helped us make the place feel like home too. We also befriended the lads of Jack's Bar and its neighbour, Evolution Bar and Restaurant. We sang with the band on both the Wednesday night and the Friday night, earning ourselves very-much-unneeded free drinks. Every night, Sarah or Roddy would come by the bar to give us a lift home for dinner. What a great setup!
See also:
- Méribel's aweful website
- My photos
- Jenn's photos
- Rich's photos (when they're up)
- Dave's photos (when they're up)
Wed, 13 Jul 2005
After a mammoth 650 km drive, we arrive in Chobe just in time for a game cruise. This was the most amazing experience to date, with sightings of numerous hippos, elephants big and small, some kudu, impala and other antelope. At the camp there was also plenty of mongeese and some spotted jenets. This river is on the border of Botswana and Namibia, but with little stopping people or animals from crossing.
From Chobe we headed for Vic Falls, a massive set of waterfalls on the corner of Zambia, Zimbabwe, Botswana and Namibia. We stayed for four nights, half on the Zim side, and the rest on the Zam side. All sorts of activities were on offer, but I opted for the slightly less brave horse ride where we did a few water crossings, saw lots of wildlife up close (they don't run away when you're on a horse) but ended up getting mock charged by an elephant who wasn't happy with our proximity. It was lucky we had one more water crossing since some of the girls had wet themselves.
The sad part of Vic Falls was a parting of company as some of the crew were going home from there, some were going to Mozambique through Zimbabwe and others like me were looking to avoid Zimbabwe and go on through to Nairobi. Still, there were some starting from there going north, and some coming from Capetown so there was plenty of new friends to make and more people to have a few beers and swap stories with in the coming weeks.
The next day we had to get some clicks behind us and fuel is expensive in Zambia, so we stopped only overnight to sleep and feed before heading onto Lilongwe, the capital of Malawi for a spot of lunch. From there, we drove along the 365x52km Lake Malawi until nightfall when we stopped in Mbamba on Kande Beach where we spent a few nights. This was a great spot with lots of friendly locals near the campsite and many a souvenir was bought from the market just outside the campsite gates. I was running out of local currency, so ended up swapping unneeded clothes for some nice curios. The local lads there all had strange names, like King David, Captain Morgan, Black William, Mario, Julius Caeser, Banjo Patterson, Jonnie Howard, Soft Touch, Ande from Kande, etc. They were all full-on pot-heads, so haggling with them was an interesting experience. They showed us around town on the first day and then the night before we left they made us a meal of yam soup, chicken, rice and casaba which I thought was fantastic but turned out not to be to the liking of some of my companions. I was going to do some diving there, but the weather was not so generous. It did make for fun surf and challenging volleyball on the beach though.
Driving in eastern Africa is interesting. There are few other vehicles on the road outside the largest towns and those are made up of trucks, buses and hired Toyota Hiluxes and Landcruisers. In towns, there are Corollas aplenty and the taxis are usually Hiaces. I'm not sure how it happened, but Toyota seems to have the whole of the African market cornered, or at least what I've seen of it so far. There are a handful of "motorways" that connect up eastern Africa that range from bad to drivable, but at least they're tarred unlike all other roads. These motorways are a lifeline to most of the continent's people, with a large percentage of people living close to one of these roads. At any time of day, anywhere along these roads, even hundreds of kilometres from a town or village, there will be people walking, carrying things on their heads, riding heavily-overloaded bicycles or just sitting there watching and waving as you go past. Everywhere we go, people wave and smile, especially the children. All this said, driving here is still very dangerous. It's not just the other vehicles driven with little consideration for safety, but it's the people crowding around the markets in towns and cyclists getting in your way when trying to overtake and trucks stopped in the middle of the road and crossing animals. The latter is especially potent at night so we've been getting up before dawn most of the driving days to ensure we get to the next campsite before sunset.
>Thu, 30 Jun 2005
From our camp at Palapye, just inside the border of Botswana, we set off on another long day on the road. Another several hundred clicks behind us and we had made it to Maun, where we did some shopping before setting up at at our camp just outside town. It was another beautiful camping spot with plenty of creature comforts, including a bar with an enviable shot list.
The next day, we set off for the Okavango Delta which is a river delta in the middle of the Kalahari Desert. We get there from Maun firstly by truck, and then by Mokoro. These are a type of dug-out canoe, powered by a "poler" in a method similar to punting. We spent two nights and almost three days at our campsite there, going for guided walks in the "Big 5"-filled environment, riding the Mokoros and swimming in the water which has been purified by a journey through sand and reeds of thousands of kilometres. The term "Big 5" refers to the five large dangerous animals which inhabit Africa. Of these, we saw track evidence and even the occasional roar of lions, a couple of elephants and a metric shit-load of their dung and footprints. There were countless birds to see, including many varieties of hornbill -- even a trio of the endangered ground hornbill. We also saw a very fast warthog, some giraffes, a family or two of monkeys and a treeful of baboons. There were plenty of other tracks, dung, termite mounds, other hideaways and a few animals to behold, from different types of antelope, cudu to stinbo to springbok to daika, hyenas, and others.
Today we left the delta after another dawn guided walk. After lunch we left via the two-hour Mokoro ride and half hour drive back to Maun Airport where we set off in some six-seater Cessna prop planes for a flight over the delta. It was absolutely amazing. On this flight we saw hundreds upon hundreds of animals all over the beautiful delta, mostly elephants and giraffes, but also a number of hippos and antelopes. I could go on for hours about this flight, but dinner is almost ready, so I'll leave it to the many photos to tell the rest of the story. A long drive is ahead tomorrow, almost one thousand kilometres, to Victoria Falls, on the border of Botswana, Zim and Zam.
>Sun, 26 Jun 2005
Got to Jo'burg ok, flight was terrible. Landing rough as guts. Hooked up with Vince's mates Ross and Caroline, went to a birthday party at a cocktail bar in Jo'burg which rocked. Met some awesome people. After a few hours sleep got in the truck and we were off. Lunch on the side of the road. 600 clicks and we were at our camp in Botswana. All is good. Great bunch of people, great tour leader and driver. This should be a lot of fun. Time for sleep now.
>Thu, 23 Jun 2005
As some of you already know, I have been getting my bathroom redone. Well, after almost a month, it was finally complete last weekend. So without further ado, here are some photos!
It was a mammoth job, entailing a complete replacement of the whole bathroom, including removing the boiler and the cupboard that contained it, putting in a new boiler in the loft, replacing the floor, most of the walls and some of the ceiling, concealing the piping in the walls and floor, re-tiling, and installing a new shower, sink and toilet. All in all, it has turned out looking quite impressive, perhaps luxurious even.
>Wed, 22 Jun 2005
A lot of us are getting made redundant. I had my jabs (vaccinations) yesterday at 4pm, then literally had to run back to the office, from Fleet Street to Shaftesbury Avenue, to get back in time for the company meeting in the Blue Room (of Death) where they seem to like holding redundo meetings. Fifteen minutes late, I walked into a room full of very drawn faces, all of which told the story as plain as day. I could only smile as I looked around the room, remembering the times I'd shared over the past two years with my collegues and friends at Accucard/CSL/Lloyds TSB. Two out of four of us sysadmins will be going, so today I'm going to have to campaign for my redundancy since only one of us actually wants to stay, but I am going to propose to them an alternative solution as well which should mean all three of us get to go. About half of the rest of the technology department are going, but the test team will be offered positions in other parts of "Group".
So from here, my plans have changed a little. I'm still heading off to Africa on Friday, but when I get back, Golly will be around, with Nig and Plug to follow four weeks later, and so it looks likely that I can then go with them on their trip around Eruope! That is certain to be a lot of fun, and you can rest assured that pictures will be taken and blog entries will be written.
>Tue, 21 Jun 2005
Well, my new camera arrived today, a new Canon Ixus 700 with underwater case and everything, so you can expect a few photos here soon.
I'm very excited about heading to Africa on Friday. First stop is Jo'burg! I get vaccinations this afternoon at 4:00pm.
Then at 4:30pm, there's a company meeting "regarding the re-alignment of CSL technology with Group IT" so I hope I make it back in time or can at least conference in. We will probably (hopefully) be getting made redundant.
>