Thoughts of a geek

4 November 2009

Rubgy, a safe technical topic, and baking

Filed under: Computers, Me, Recipes — Tags: , , , , , , — qwandor @ 10:33 pm

Continuing on from my last post taking suggestions from Twitter, today I will be blogging about topics suggested by people on Facebook.

Allan Chesswas: Rugby

Here in New Zealand, and elsewhere I hear, some people like to run around a field jumping on each other and chasing an oddly-shaped ball. This activity seems to be more popular among boys than girls. Many other people like to watch them do so. Several of my flatmates are in the latter set, and one in the former. I have never seen the attraction of either activity. The running around does at least provide decent exercise, but at significant risk of injury. Watching seems even more pointless, and frequently people do so (via television) instead of partaking in more interesting and productive pastimes such as good conversation, programming, baking, listening to music or even reading. This can be something of a frustration.

Donald Gordon: Safe technical topics which no one will be offended by.

Well. Most of my ‘recreational’ programming of late has been on Fridge. Fridge is a co-operative honesty system for snackfood which originated in Memphis. The Memphis Fridge is something of an open secret, used by graduate students and their friends. The basic idea is that certain people buy pre-packaged food and drink in bulk. Everyone who uses fridge has an prepay account which they can put money into by putting cash in a drawer and crediting their account, and then they can use this balance to buy the food and drink. The software keeps track of users, money, the various items stocked, markups to make up for lost or damaged stock, various statistics, and so on.

I have made a few minor contributions to the Fridge software in the past (such as adding a QIF export feature to allow users to import their transaction history into their personal accounting software), but my substantial work on it now began with interfridge. Interfridge was an idea that I and others had some time ago, last year I think, to allow users on one fridge to use that account on another fridge. This was motivated by the fact that both Memphis and Innaworks (where I currently work) run the Fridge software, and several of us use both fridges from time to time. The idea of interfridge was that I could visit Memphis, login to their fridge with my Innaworks fridge account, and purchase items from Memphis just like any Memphis user.

At some point Donald wrote some notes on his ideas of how interfridge should be designed. I finally got around to implementing this (the server side in PHP as part of fridgeweb, the client side integrated into the Java fridge client) using a protocol on top of HTTP. After much discussion with lorne, Chris Andreae and Stephen Nelson and several iterations changing the protocol to fix potential security holes pointed out, we came up with the interfridge protocol that is now in use between Memphis and Innaworks.

However, we realised along the way that fridge really could do with being improved in other respects. Currently, the Java client talks directly to a PostgreSQL database which holds all the user, stock and transaction data. This means that the client must include the database password, which is really not a good thing to be giving out to all and sundry. A much better design would be to have a trusted fridge server which talks to the database, and then have the client perform all operations via the server. With an appropriately-designed protocol, this means that the client need not be trusted, and so anyone can write their own client to use with the fridge. I have thus begun to design and implement a fridge protocol based on the interfridge protocol (it can do everything the interfridge protocol can do and more, so will replace it when it is done). For this I scrapped the custom RPC protocol which I had been implementing for myself on top of HTTP, and went with XMLRPC to take care of all the details of procedure calls, encoding and decoding in a standard way. There are various implementation of XMLRPC available for many programming languages. I should note that the documentation linked above does not include all of the API currently implemented in the code, though it will eventually. I am currently still in the middle of designing it, implementing and documenting it at the same time.

As it currently stands, the fridge server has methods to login, check a user’s balance, transfer an amount to a local or remote (i.e. interfridge) user, make a purchase at the local fridge (I still have not yet decided the best way to handle interfridge purchases in the new scheme), list the current stock, and list other fridges with which the fridge is peered. I am writing a client library and simple command-line client in Ruby to test this as I go. The command-line client implements all the features just mentioned. I have not yet done much on the Java client, but that will come at some point. lorne has just started work on an iPhone client, which should be cool.

Felix Shi: You can always blog about cooking weird and wonderful dishes :D

Weird and wonderful? Not sure about that. I made a batch of muesli and a chocolate cake on Sunday, as I mentioned. The weekend before I baked two batches of muffins (apple and sultana for the Skyline walk on Saturday, banana chocolate chip or something for a picnic on Labour Day with gringer, ja and xyzzy).

I am afraid my cooking of late has not been terribly interesting. Suggestions are welcomed, as are visitors interested in consuming baking. As always.

Fixing VMware mouse grab bug on Ubuntu Karmic

Filed under: Computers — Tags: , , , — qwandor @ 9:23 am

I just upgraded my work machine from Ubuntu 9.04 (Jaunty) to 9.10 (Karmic) and came across a couple of problems with VMware Player (version 2.5.3 build-185404). It seemed wise to document the fixes I found here so that other people experiencing the same problems might find these solutions when they Google for it.

The first was an error when it tried to launch my VM complaining that the virtualisation extensions of my CPU were already in use, saying “The virtualization capability of your processor is already in use. Disable any other running hypervisors before running VMware Player.” and then a number of other errors. This was fixed by removing the KVM kernel modules:
$ rmmod kvm_intel kvm

The second problem was that the VMware window would lose its mouse capture whenever I moved the mouse pointer outside the top-left of the VM screen (apparently a 640×480 region), unless I had a mouse button held down. This made it impossible to actually use the VM. This was eventually fixed by adding the following line to /etc/vmware/bootstrap:
export VMWARE_USE_SHIPPED_GTK=yes
This forces VMware Player to use its own version of the GTK library rather than the Ubuntu one, which apparently avoids the mouse grab bug.

1 November 2009

Walks, muesli and sheep

Filed under: Me, Recipes — Tags: , , , , , — qwandor @ 11:12 pm

Well I asked the Twittersphere for suggestions of what I should blog about, and sure enough the Twittersphere obliged. So here goes.

fibby17: some of your more interesting recent walks?

Well, let me see. The most recent walk to speak of was the Skyline walkway. This is a walk I had been meaning to do ever since a group of us walked up to Mount Kaukau early last year and some passer-by pointed out and recommended to us the Skyline Walkway. I finally organised it for Saturday 24th October 2009.

Charlotte, Frith, Chris Nimmo and Hannah came. I was hoping to have more people, but they were otherwise occupied or pulled out or did not turn up. We (except Chris) took the train out to Johnsonville to start the walk, except that the train was really a bus. We were amused when the driver offered a lady a free ride near the end of the route and she asked him how the buses were that day, to which he replied something along the lines of “Good, but I am a train today.” Chris was to meet us at the start of the track but after looking up his cellphone number on Facebook and a few SMSes and calls back and forth he said that he would meet us up Mount Kaukau instead. We made a start, with a little initial confusion about where the track actually went.

After a little while we made it up Mount Kaukau but found no sign of Chris, and he was not responding to SMSes or phone calls. We waited and ate a little, and finally made contact with Chris and he turned up about an hour after we got there, with wet hair and shoes and a number of scratches. Apparently he had somehow taken a wrong turn and decided that the best solution would be to bush-bash his way up another side, via much gorse and a stream. After a little while longer for him to recover we raced onwards down the other side, shortly to detour off the track to climb a little rocky knoll, admire the view and take photos. We came across a full possum trap beside the fence, into which Hannah insisted on looking, only to be predictably disgusted at the possum’s head inside. There was also another older dead possum to the left. The detour completed we continued on along the proper track, talking a little about possum shooting for fun and profit.

At around 1:00 pm we stopped for lunch (people’s own packed lunches plus the apple muffins I made, chips and scroggin brought by Charlotte and Frith respectively). Lunch was followed by a lovely lie down in the sun, enjoying the view and watching two people bike past in opposite directions. I did not envy them.

By and by we continued on, narrowly avoiding the wide road down to a certain suburb (Or was that before lunch? My memory fails.), and taking turns to flick the track markers as we passed them. We later stopped at the remains (just a chimney) of an old house, and discussed windfarms. After a while more walking we reached the end of the track at Makara Hill Road, and headed down to Karori Park to lie in the sun and rest for a little while. Our plans to play in the playground were thwarted by the large number of small children already doing so. Children really should be banned from playgrounds, it seems quite unfair to the rest of us. We wandered back along Karori Road, some buying icecreams and such, and people went their separate ways one by one.

All in all, good fun and good company. The weather turned out really well too, overcast to start with and sunny later, but a nice breeze so as not to be too hot. Photos can be found on Facebook.

There are more walks I could talk about, less recent. Walking around the outside of the Karori Sancuary in the rain comes to mind. Oh, I guess the Interface geocaching trip could count too. Those were both a while ago though. There have not been enough walks lately. Come walking with me!

Anyway, it is late and I should attempt to sleep, so I will not say more about these walks just now. If you want to hear, talk to me. Not that I expect to sleep much even when I do try; sleep has proven particularly hand to find lately. This is most unsatisfactory.

yomcat: Burnt Muesli.

Yesterday afternoon I baked a cake for my flatmate Stevie (who turns old today), and also some muesli for myself. As the cake was on the middle of the oven I put the muesli on a shelf below it, almost at the bottom of the oven. I normally cook the muesli on the middle shelf. I was surprised to find that the muesli seemed to get more burnt on the top than usual (not badly, but noticeably); I had expected that it might get burnt on the bottom, being closer to the bottom element and all. A little discussion on Facebook ensued:

Matthew Kiernan: is there an element near the bottom?
Andrew Walbran: Yes. But I would expect it to get burnt on the bottom if it is near the bottom, not on the top.
Matthew Kiernan: maybe the tray isn’t absorbing heat very well, and convection is carrying the hot air over the top of the tray.
Andrew Walbran: It still surprises me; I would expect the radiant heat to be more of a factor in burning the top, and that would surely be stronger when it is higher up in the oven.
Matthew Kiernan: sounds right, I suppose it would depend on the oven setting – grill vs bake, and I suppose fan forced air is always a factor
Andrew Walbran: Yeah, it was on fan bake. I should also note that it is an electric oven.

Clearly I have an exciting life.

simon_w: sheep.

Well, there were no sheep on the walk mentioned earlier in this post, but there were some cows. We walked right past a couple of them. Oh, my flatmates were watching TV a short time ago and there was an advertisement for sheep. For this place I think, a (live)stock market. Apparently wild venison mince is marginally cheaper (or was it marginally more expensive?) at Moore Wilsons than lamb. Richard is planning to make us some venison burgers sometime soon. I hope that it will be on a night when I am home for dinner (hint hint). Oh, and electric sheep is a very cool screensaver. If somewhat addictive. It is named after the Philip K. Dick novella, of course. I do not think I have read it, though I have seen Blade Runner. Perhaps I should get back into reading books. shoeshine was recommending a certain novel to me the other day (I do not have the name in front of me on this machine yet, and it escapes my mind; apparently character-driven sci-fi set in some sort of post-apocalyptic future from memory).

Tibi placet?

20 September 2009

Faith, God and all that jazz

Filed under: Christianity, Me — Tags: , , , , , , , , , , , — qwandor @ 11:10 pm

I have been meaning to write this post for quite some time now, a couple of months I guess, following a few conversations with a couple of people.

I guess I will start off with where I stand. I consider myself a Christian. Certainly I have all the obvious trappings: I go to church every Sunday, read the bible daily, go to a bible study with people from church most weeks, try to pray. I try to live my life, make decisions, from a Christian worldview. I try to be open to discussing my beliefs, ‘faith’ if you will, with others, as this is interesting, worthwhile and indeed a vital part of a Christian life (I Peter 3:15, Mark 16:15).

However, I do find it difficult to explain, and I think this largely comes down to not having a very clear idea in my own mind. On that note I would like to post a few questions, and list (my interpretations of) some people’s answers to them so far. I also include my own in some cases.

I would be interested to hear your thoughts (different answers to the questions, comments on the existing answers) and discuss further, either here or — better — in person. I have been particularly frustrated over these things over the last two or three months, and have found it difficult to talk to people, so this is an attempt to get some of my thoughts out in the hope of being able discuss them further. This is mainly aimed at Christians, but extends to anyone.

What is faith?

  • Blind belief, in the absence of evidence — obviously, I find this an unsatisfactory definition. There needs to be some way to discriminate between things in which you should have faith and things in which you should not.
  • Belief that something is a certain way, or that something will happen, based on past experience and testimony (direct or indirect) of people whom I trust. ‘Faith’ then is very closely related to ‘trust’, perhaps even the same thing. This is my current working definition, but some people I have talked to find it unsatisfactory. I do not really understand why; apparently it is insufficient in some way?

What is the basis of Christian faith?

  • The Bible — this requires first an argument for the historical accuracy of the bible, and then trust in the people whose witness is recorded in it (for example in the gospels). This is difficult due to the lack of a personal relationship, so it becomes a rather indirect thing.
  • Other people’s testimony — friends, family. Again this comes down to accepting what people say based on personal trust in them, which in turn comes from knowing them, observing their words and actions and judging their trustworthiness from that.
  • Supernatural experience — some sort of experience beyond the usual which provokes or confirms a belief in the God conceived by Christianity and described in the Bible. Some people certainly describe such an experience, to greater or lesser extent, or even it being a regular thing.

How does God talk to you?

  • The written word of the Bible is God talking to you — but, it is hardly personal then.
  • While reading the Bible — how?
  • Through other people — He sends people to say things to you, and so what they say is in a sense God talking to you. But then, how does He tell them what to say?
  • Just talking directly to you — again, how? What does this mean, how is it experienced?

How do you know that God is talking to you, and how do you know what He is saying?

  • You hear distinct words
  • It is more of a general feeling of some sort — but then how do you know that it is from God?
  • A ‘prompting’, you just think of doing something — but we often think of doing things. How is this ‘prompt’ different? ‘Prompting’ is a vague term. Perhaps this is the same as or similar to the previous answer.

What does it mean to ‘believe’?

  • A belief is a theorem (in the sense used in mathematics). That is, a statement is ‘believed’ if it there is a proof for it. I know that Peirce’s law holds in classical logic because I can write a proof using only the axioms of that logic, so I can say “I believe that Peirce’s law holds in classical logic”. Nothing can be believed beyond what can be proven, so belief is limited to the formalisms of mathematics. This does not include any of the sciences, as even physics is just a matter of attempting to find a consistent model which fits observed phenomena; no proof is possible as physical laws are only guesses which happen to match reality in a few observations.
  • A belief is a working assumption. I ‘believe’ that the sun will rise tomorrow insofar as I assume it will based on past experience, and so I base my decisions and plans on that assumption. Beliefs then are not certain, cannot be proven, but are necessary for decision-making and, well, life.

Note that the first and last questions are of definition, so it is more a matter of how you choose to define faith and belief than any intrinsic reality. Consistent and agreed-upon definitions are, however, vital to any meaningful communication.

8 September 2009

An idea for songfighting

Filed under: Computers, music — Tags: , , , , , — qwandor @ 11:14 pm

I was working to work the yesterday, and I had an idea.

Perhaps you have heard of SONG FIGHT. If not, the idea is fairly simple: each week, a song title is given. Competitors then have a week to write the words and music for a song fitting that title, record it, and submit it. Anyone can then download the songs, listen to them and vote for which they think are best. I guess the main point is to motivate musicians to write more songs, to improve their skills and whatnot.

Anyway, my idea is to automate the process. I want to write some software that, given a title, can produce a half-plausible sounding song matching it. The first step would be to generate the lyrics, which I guess could be handled by an approach based on Markov chains trained on a range of existing song lyrics, probably combined with some sort of syllable and rhyming dictionaries to produce lines with some sort of rhythmic structure. Hmm, perhaps the rhythm should be generated first and then the lyrics made to fit it. The title would be included in one of the lines, probably near the beginning or end, or even several times in the chorus.

Next (or perhaps first), it would be necessary to generate some sort of plausible tune for the verse and chorus, and any other bits in-between (bridge? intro? instrumental bit in the middle?). I am not sure how to approach this, perhaps there is some literature on the subject. Maybe more Markov chains, or some sort of recombination of existing tunes, or some other method. I could really do with some advice from musicians here: how do you put together a tune that actually sounds tuneful, rather than just a list of random notes?

I assume that once the basic melody is generated, generating a passable accompaniment would be relatively straightforward, though again I will need to talk to some musicians.

Once the music and lyrics are sorted, along with an arrangement for the song, producing the final product would be a matter of running the lyrics and melody through Festival’s singing mode (as I have played with before), synthesise a few instruments and some drums for the rest of it, and mix it all together, ready to submit. Simple?

Anyway, reactions? Does this sound plausible? Has it all been done before? Can you offer any advice, especially for the musical side of it?

23 August 2009

Beard no more

Filed under: Me — Tags: , , , — qwandor @ 12:02 am

11 people voted. Of males not in my family, 2 voted each way; of females not in my family, 1 each way; and of people in my family (male or female), 1 voted for me to keep the beard and 4 to shave it off. So, I did so yesterday afternoon. I now have nothing to tug on or through which to run my fingers.

17 August 2009

An interesting tale of filehandles

Filed under: Computers — Tags: , , , , , , , , , , — qwandor @ 10:25 pm

I just found an interesting bug, so I thought it might be worthwhile to share it with these intertubes to prevent other people from making the same mistake.

I was just transferring some more music onto my iPhone with Amarok while at the same time listening to music. I wanted to listen to a particular track (from a Moby album I bought recently), so stopped and switched to that, but Amarok would not play it and complained about the sound device being busy. This seemed rather odd as it had just been playing fine until I tried to change tracks. Wanting to get to the bottom of this, I checked who had what open:

andrew@rata:~$ sudo lsof /dev/snd/*
lsof: WARNING: can't stat() fuse.sshfs file system /media/iphone
Output information may be incomplete.
COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME
timidity 4162 root 6u CHR 116,1 4973 /dev/snd/seq
kmix 4511 andrew 10u CHR 116,0 5260 /dev/snd/controlC0
ssh 5605 andrew 16u CHR 116,0 5260 /dev/snd/controlC0
ssh 5605 andrew 33r CHR 116,33 4954 /dev/snd/timer
ssh 5605 andrew 39u CHR 116,16 5236 /dev/snd/pcmC0D0p
ssh 5605 andrew 41u CHR 116,0 5260 /dev/snd/controlC0
sshfs 5609 andrew 16u CHR 116,0 5260 /dev/snd/controlC0
sshfs 5609 andrew 33r CHR 116,33 4954 /dev/snd/timer
sshfs 5609 andrew 39u CHR 116,16 5236 /dev/snd/pcmC0D0p
sshfs 5609 andrew 41u CHR 116,0 5260 /dev/snd/controlC0

I should point out at this point that the way I get Amarok to sync music to my (jailbroken) iPhone is to FUSE-mount the iPhone via SFTP over the network, so that is why SSH was running. But on with the story.

SSH had my sound device open‽ What? That seemed very odd. I wondered whether perhaps there was some new SSH feature I had not heard about to forward sound over the network connection (as it can do for GUI applications using X11), but there I could find no mention of such a feature in the manpage or via Google, nor any possible reason why it might want to open a sound device. I asked lorne, and he was equally confused, but suggested a few things to check.

After a bit of poking around I discovered that I could not replicate this behaviour by mounting the filesystem myself, only when Amarok did it. This prompted a realisation of what must be happening: when Amarok launches sshfs to mount the iPhone filesystem, it presumably does a fork and exec to start the new process. But when you do this, the new process inherits all the open file handles of the parent process. Amarok of course had the sound device open to play the music I was listening to originally, so sshfs and subsequently ssh ended up with the same device file open. Amarok must then have closed it and tried to reopen it when I switched tracks, and this failed because the other processes it had launched still had it open. Of course.

So, lesson of the day: when you fork, remember to close any excess files before you exec. Especially if they are device files or other special files.

I should probably file a bug report for Amarok, but I am not sure that I can be bothered.

14 August 2009

Things I should do

Filed under: Lists, Me — Tags: , , , , , , — qwandor @ 10:59 pm

I have been a bit slack lately about getting much done. I keep thinking of things which I should do, but mostly do not get around to doing them. In the hope of improving this I list here some things which I should do:

  • Implement mDNS abstraction layer for stereo using Avahi DBUS bindings, sort out ant script, and get stereo head to a usable state on Linux. (Or, bug Stephen to do it.)
  • Write various blog posts I have been thinking about (last.fm client, friends, childhood memories, more to life, questions).
  • Work on theQuotebook, maybe look into Facebook integration.
  • Do more baking.
  • Catch up with various people I have not seen for ages.
  • Work out what to do for a chassis for the robot I am building, add the remaining wires for the motor controller, and filter capacitors.
  • Talk more to people about conceptions of God (relationship, hearing from God, basis of faith…), and maybe blog some thoughts and questions.
  • Organise a group of people to do the Skyline Walkway some Saturday.
  • Work out what I am doing with my life, what I want to do and what God wants me to do, where I am going in the mid- to long-term, what to do next year…

Feel free to bug me about doing any of these things. Or maybe other things.

13 August 2009

Beard or not

Filed under: Me — Tags: , — qwandor @ 9:39 pm

I have had a beard for quite a few years now, and I am wondering whether to keep it or get rid of it. So, I thought I would take a poll of your opinions, dear readers. Which do you prefer: Andrew with beard, or Andrew without beard? To illustrate:

Andrew with beard

Andrew with beard


Andrew with no beard (and, uh, no chin)

Andrew with no beard (and, uh, no chin)

Please vote by commenting here (on the original post please, not on Facebook, so as to keep everything in one place), and I may or may not pay attention to what you have to say.

(And back to your regularly scheduled programme…)

10 August 2009

Tweet your quotes

Filed under: thequotebook — Tags: , , — qwandor @ 6:48 pm

I have not done all that much on theQuotebook lately, but I did add a minor new feature a few days ago. (Perhaps you have noticed? Probably not.) There is now a link on each individual quote page to post the quote to Twitter. So, if you add a particularly funny quote of you friend and want to share it further afield, try tweeting it!

As always, feedback is welcome and appreciated.

Older Posts »

Blog at WordPress.com.