Janelle Monae - Tightrope
Mr Deity and the Woman
Lucky Louie - Ass (Audio NSFW)
Louis CK learns about the Catholic Church (Audio NSFW)
Tim Minchin - Storm (Audio NSFW)
Tim Minchin - Pope Song (NSFW. May offend you if you're Catholic)
Old Spice | The Man Your Man Could Smell Like
Sesame Street: Smell Like A Monster
The Western Nostril
Яolcats
http://devour.com
The Trachtenburg Family Slideshow Players - Mountain Trip
Charlie and the Swiss Chocolate Factory
XKCD Sys Admin
Sunday, 28 November 2010
Saturday, 27 November 2010
Writing UTF-8 files from Python
As always, there may be better ways to do this (using XML libraries, for example), but it took far too long to figure this out, given that there's so little to do to fix the problem. I found a lot of the examples found on Google didn't answer this specifically, but just added to the confusion.
The problem:
gives this error:
The proper way to define a unicode string is this:
which yields:
In my search, though, there was lots of talk of how to convert strings to UTF-8, and this is *not* what you do if you want to write to a UTF-8 file. If you convert to UTF-8 before writing, you'll probably get errors becasue it'll contain values >=127.
This is how you do it...
The only difference here is that you must use 'u' when defining literals, and you need to used codecs.open, with the encoding specified, when opening the file.
If, when you read the file, it appears to have 2 strange characters rather than the one unicode character you expect, the file is probably OK, it's the viewer that isn't reading UTF-8 properly.
The problem:
a = 'âêîôŷ'
print a
gives this error:
UnicodeDecodeError: 'ascii', '\xc3\xa2\xc3\xaa\xc3\xae\xc3\xb4\xc5\xb7', 0, 1, 'ordinal not in range(128)'
The proper way to define a unicode string is this:
a = u'âêîôŷ'
print a
which yields:
âêîôŷ'
In my search, though, there was lots of talk of how to convert strings to UTF-8, and this is *not* what you do if you want to write to a UTF-8 file. If you convert to UTF-8 before writing, you'll probably get errors becasue it'll contain values >=127.
This is how you do it...
ascii='abcdef'
uni = u'⢸ðêƒ'
file=codecs.open('utf-8.xml', mode='w', encoding='utf-8')
file.write(ascii)
file.write(uni)
file.close()
The only difference here is that you must use 'u' when defining literals, and you need to used codecs.open, with the encoding specified, when opening the file.
If, when you read the file, it appears to have 2 strange characters rather than the one unicode character you expect, the file is probably OK, it's the viewer that isn't reading UTF-8 properly.
Friday, 26 November 2010
More fun with Python
I'd recently written a little Python app to create a load of test data. The test data is XML, and should be UTF-8. I'd not really considered this properly, and for my original purposes, it's irrelevant. For a bit of fun/experimentation/learning, I put a tk front end on it, and email ed the project team to let them know, just in case it was useful.
Coincidentally, the vendor of the external product that would be producing these XML files in the real world was going to be late by several months, meaning that the XML files would need to be hand-crafted, the test data generator turned into a deliverable, and I briefly turned from tester into nightCoder.
There were a number of feature requests. My testing colleague started testing and raising defects against my code. Testing revealed areas in which i could be improved. I added a log file, properties files, some exception handling and error reporting dialogs. I had a real developer moment when it was deployed, went wrong and said (with a tester's smile on my face), "well that doesn't happen on my machine!".
While trying to figure out that problem, using a Swiss keyboard, typing garbage into some mandatory field, committing yielded another error as a result of non ASCII characters. As the client is Swiss, and these fields will probably included non ASCII, a fix was definitely required. Had this been just a learning exercise, I may not have been too worried, As I was now delivering this software, I had no option other than to figure it out. This highlights my main problem with self-teaching: I really struggle to find projects, and often abandon them in an unfinished state because nobody is relying on the solution.
Coincidentally, the vendor of the external product that would be producing these XML files in the real world was going to be late by several months, meaning that the XML files would need to be hand-crafted, the test data generator turned into a deliverable, and I briefly turned from tester into nightCoder.
There were a number of feature requests. My testing colleague started testing and raising defects against my code. Testing revealed areas in which i could be improved. I added a log file, properties files, some exception handling and error reporting dialogs. I had a real developer moment when it was deployed, went wrong and said (with a tester's smile on my face), "well that doesn't happen on my machine!".
While trying to figure out that problem, using a Swiss keyboard, typing garbage into some mandatory field, committing yielded another error as a result of non ASCII characters. As the client is Swiss, and these fields will probably included non ASCII, a fix was definitely required. Had this been just a learning exercise, I may not have been too worried, As I was now delivering this software, I had no option other than to figure it out. This highlights my main problem with self-teaching: I really struggle to find projects, and often abandon them in an unfinished state because nobody is relying on the solution.
Monday, 18 October 2010
The Henry Spink Foundation
I'd never heard of The Henry Spink Foundation, but John L Dixon retweeted this from Alan Henness, and now I have:
I set off to find out a little more. I read a little. I came across a list of therapies*. I ticked off Homeopathy, Chiropractic, and one of my favourites, Craniosacral Osteopathy from a mental list of quackery. I haven't and don't intend to read all of it. There may be some good and useful information about some good and useful therapies in amongst the bullshit. The trouble is that I already know from just five minutes perusing, that I can't trust it.
I picked something I'd never heard of from the list that they call the 'information centre'. I chose The Tomatis Method. In the second paragraph. I read:
Hang on, I thought. Muscles of the inner ear ? My anatomical knowledge comes from what I've picked up from watching Your Life In Their Hands, going to Body Worlds, playing Bones Lite, being slightly in love with Dr Alice Roberts and doing a 60 point level 2 Technology of Music unit with the Open University.
The OU course had a bit about the ear, but I didn't recall anything about muscles of the inner ear. It seemed a bit unlikely. I can wiggle my pinnae a bit, so I know we have vestigial muscles associated with the outer ear. I know we can attenuate our hearing by manipulating the ossicles, which sounds as though muscles are involved. Muscles in the cochlear seem a bit unlikely though.
So I googled. I found this kind of thing : EAR. Intra-inner-ear-musculature was conspicuous by its absence.
Next step, look up The Tomatis Method. The Official site says something different:
I don't want to go into the Tomatis Method in any detail. The rest of the information given by The Henry Spink Foundation suggests that it's nonsense. The point I'm trying to make is that if someone like me, a half-arsed lay anatomist with really quite rudimentary knowledge can spot a mistake like this in about 5 minutes, proper smart qualified people should be able to rip it to shreds. More worrying though is that gullible, desperate, less inquisitive people might buy into this kind of nonsense and line the pockets of these charlatans.
[Note: if there's actual evidence of the efficacy of the Tomatis Method, that would pass the scrutiny of a proper professional, like Ben Goldacre, say, I'll happily write another post singing its praises]
[* John has since called the lista real "Woo's Woo" of AltMed treatments". Genius!]
NOOOOOOOOO!!!!!! NOT FELICITY KENDALL!!!! http://bit.ly/9X9rJW #dreamsshattered
I set off to find out a little more. I read a little. I came across a list of therapies*. I ticked off Homeopathy, Chiropractic, and one of my favourites, Craniosacral Osteopathy from a mental list of quackery. I haven't and don't intend to read all of it. There may be some good and useful information about some good and useful therapies in amongst the bullshit. The trouble is that I already know from just five minutes perusing, that I can't trust it.
I picked something I'd never heard of from the list that they call the 'information centre'. I chose The Tomatis Method. In the second paragraph. I read:
According to Dr Tomatis this happens when muscles are not working properly and through auditory stimulation it is possible to retrain the muscles of the inner ear so that it can function without distortion.
Hang on, I thought. Muscles of the inner ear ? My anatomical knowledge comes from what I've picked up from watching Your Life In Their Hands, going to Body Worlds, playing Bones Lite, being slightly in love with Dr Alice Roberts and doing a 60 point level 2 Technology of Music unit with the Open University.
The OU course had a bit about the ear, but I didn't recall anything about muscles of the inner ear. It seemed a bit unlikely. I can wiggle my pinnae a bit, so I know we have vestigial muscles associated with the outer ear. I know we can attenuate our hearing by manipulating the ossicles, which sounds as though muscles are involved. Muscles in the cochlear seem a bit unlikely though.
So I googled. I found this kind of thing : EAR. Intra-inner-ear-musculature was conspicuous by its absence.
Next step, look up The Tomatis Method. The Official site says something different:
…listening will be disturbed when there is a dysfunction of the two muscles located in the middle ear whose role is to enable the precise and harmonious integration of acoustic information into the inner ear, and from there to the brain…
I don't want to go into the Tomatis Method in any detail. The rest of the information given by The Henry Spink Foundation suggests that it's nonsense. The point I'm trying to make is that if someone like me, a half-arsed lay anatomist with really quite rudimentary knowledge can spot a mistake like this in about 5 minutes, proper smart qualified people should be able to rip it to shreds. More worrying though is that gullible, desperate, less inquisitive people might buy into this kind of nonsense and line the pockets of these charlatans.
[Note: if there's actual evidence of the efficacy of the Tomatis Method, that would pass the scrutiny of a proper professional, like Ben Goldacre, say, I'll happily write another post singing its praises]
[* John has since called the lista real "Woo's Woo" of AltMed treatments". Genius!]
Saturday, 2 October 2010
Wireless Audio done right.
With an open mind, I introduced the Sony wireless speakers to my wife. I explained that they were a complete bargain, and that if we didn't want them, I could probably re-sell them to someone at work. She was quite keen to get some music back into the living room. Our DVD player, which was used to play CDs, has migrated to another room, and music on a MacBook's speakers is obviously compromised.
After a quick demo, while she was out of the house earlier, I started to set them up properly. As I was setting them up, I discovered that our Airport Express, which I'd bought to augment a dead spot right where my wife sits on the couch, was now very close to our AV cupboard. My son had moved it a little while back.
Rather than plug in the Sony kit, I figured I might be able to hook up the Airport Express. We've a bit of an unconventional setup. Virgin V+ and Sky boxes hooked up to an old Phillips video sender, which is routed to Aego-M 2.1 speakers (fantastic) and an NEC projector (feeling its age now), which projects straight onto the living room wall, giving us a 70" picture. If the video sender is transmitting, it kills WiFi, so it's just used to switch sources. it has 4 in and 1 out, so here were 2 spare inputs.
A quick nose through my boxes of cables and connectors yielded a SCART to Phono converter (the kind you get with a PS2 or a Wii) and a 3.5mm jack to Phono cable. Perfect. I hooked it up, fired up iTunes on my MacBook Pro, the Remote App on my iPod Touch, paired them, and had audio out of the Aegos straight away.
I did briefly have a problem with Remote losing the ability to connect to iTunes. The settings were correct. The interwebs suggested a firewall problem. My firewall settings were fine, but something was screwing up with it. I switched the firewall off, reconnected, and turned the firewall on again, and it's been fine ever since.
The Remote app is brilliant. Fantastic. It can switch between multiple libraries, and it can re-route audio to either the Mac's speakers or the Airport connected speakers (or both). It's also far faster than I'd expect. I have a fairly large library (12,000+ songs), and it takes seconds to connect, seearch etc. It's as though the library is on the iPod.
This is how it's meant to be. The Sony system goes back on Monday. Turns out an 83% discount doesn't matter if the product is fundamentally flawed. Docking an iPod touch or an iPhone takes it out of your hand, and that's just wrong.
People accuse me of fanboyism, but it's only partly true. Apple generally make stuff that's better than everyone else, but often it's just because it sucks less than everyone else rather than being phenomenally good. iTunes + Airport Express + Remote is an example of phenomenally good.
but they absolutely nailed this.
With Airplay coming to third party devices, this is only going to get better.
After a quick demo, while she was out of the house earlier, I started to set them up properly. As I was setting them up, I discovered that our Airport Express, which I'd bought to augment a dead spot right where my wife sits on the couch, was now very close to our AV cupboard. My son had moved it a little while back.
Rather than plug in the Sony kit, I figured I might be able to hook up the Airport Express. We've a bit of an unconventional setup. Virgin V+ and Sky boxes hooked up to an old Phillips video sender, which is routed to Aego-M 2.1 speakers (fantastic) and an NEC projector (feeling its age now), which projects straight onto the living room wall, giving us a 70" picture. If the video sender is transmitting, it kills WiFi, so it's just used to switch sources. it has 4 in and 1 out, so here were 2 spare inputs.
A quick nose through my boxes of cables and connectors yielded a SCART to Phono converter (the kind you get with a PS2 or a Wii) and a 3.5mm jack to Phono cable. Perfect. I hooked it up, fired up iTunes on my MacBook Pro, the Remote App on my iPod Touch, paired them, and had audio out of the Aegos straight away.
I did briefly have a problem with Remote losing the ability to connect to iTunes. The settings were correct. The interwebs suggested a firewall problem. My firewall settings were fine, but something was screwing up with it. I switched the firewall off, reconnected, and turned the firewall on again, and it's been fine ever since.
The Remote app is brilliant. Fantastic. It can switch between multiple libraries, and it can re-route audio to either the Mac's speakers or the Airport connected speakers (or both). It's also far faster than I'd expect. I have a fairly large library (12,000+ songs), and it takes seconds to connect, seearch etc. It's as though the library is on the iPod.
This is how it's meant to be. The Sony system goes back on Monday. Turns out an 83% discount doesn't matter if the product is fundamentally flawed. Docking an iPod touch or an iPhone takes it out of your hand, and that's just wrong.
People accuse me of fanboyism, but it's only partly true. Apple generally make stuff that's better than everyone else, but often it's just because it sucks less than everyone else rather than being phenomenally good. iTunes + Airport Express + Remote is an example of phenomenally good.
but they absolutely nailed this.
With Airplay coming to third party devices, this is only going to get better.
Thursday, 30 September 2010
A disappointing bargain

Yesterday I bought a Sony AIR-SA20PK Multi-Room Wireless speaker system. I got it back to my mid-week digs, unboxed it, and gave it a quick trial. Maybe 10 minutes. It has such significant flaws that I'm currently considering the purchase a mistake.
When you buy a £300 gadget for £50, and it still disappoints, it's no surprise to discover that it's discontinued product.
Brief explanation of the system. There are three boxes. Two are remote speakers, the other is a base unit, which is a combined iPod Dock, FM Radio and Digital Audio Transmitter. Each speaker can play they audio of the iPod or radio independently. The base unit can also be connected to an amplifier or TV with phono connectors for L/R audio and composite video. Think of it as Sonos Lite.
Before I explain what's wrong with it, reasons to be cheerful:
I'd been looking for a simple iPod Dock that would connect to my amp and would charge the iPod from the mains. The Apple Universal Dock is £39. It needs USB power, so is dead to me, but it gives me a reference price. The Dock/Transmitter part of the Sony Air system plugs into the mains (with a ludicrously big tethered wall wart) and has phono connectors for some iPod-to-amp goodness.
I probably wouldn't have paid £50 just for something that only did this, but nevertheless, it solves my problem.
In a quick test, in one room, with one receiver about 3 foot from the dock and the other about 20ft from the dock, everything paired quickly and sounded good. Not enough bass said fellow lodger, but I'm middle aged and urbane and he's young and urban. It sounded well rounded considering the size of the units. They're about the size of a kitchen radio, but twice as deep.
And now the bad…
The FM radio audio cannot be routed to the L/R phono output of the base unit. There's no switch, those outputs are hard-wired for the iPod only. The radio can only play through the bundled speakers.
I've tested briefly with an iPhone. It doesn't work. My hypothesis is that the base unit's wireless signal and the 3G of an iPhone interfere with each other, or perhaps getting approval for connectivity with an iPhone is harder and more expensive than for a mere iPod.
I've also read that the new retina display iPods aren't compatible for some reason, but can't confirm.
Setting up was really easy, but actually putting the iPod into the dock and picking up the Sony remote was an "Oh Noes!" moment. It just immediately felt all wrong. "What have I done?", I thought, as a superb visual interface was replaced with a play/pause/prev/next remote. The fact that the iPod needs to be in the dock while it's in use is a bit of a disaster. While charging overnight is fair enough, (REMINDER:Check that the iPod charges while the base unit is in standby mode), but not using the iPod's interface for navigation is simply an epic fail.
I've yet to test the range or whether WiFi suffers while the base unit is on. Experience with an analogue video sender was that it totally screwed with our WiFi, no matter what channels were in use. The Sony may turn out to be fine in this respect, but the proper solution is to use Wifi or Bluetooth. Proprietary wireless is really just asking for trouble.
There are no auxiliary inputs on the base unit. This is madness. It means that no audio, other than from a supported iPod, can be used with the system. If the 4th generation iPod Touch incompatibility is true, it means that this system became obsolete inside about 2 years. Break/Lose your iPod and your multi-room audio just broke forever.
There are no auxiliary inputs on the remote speakers. This is also madness. There should be a line in on both of the remote speakers so that any other source can be used with them. Currently, if the transmitter breaks, the remote speakers die with it.
Note: A colleague has pointed out that other S-Air transmitters are available, even if this one is discontinued. He also suggested that the reason for not having aux inputs is that it obviates the need for A/D converters, making the units cheaper to produce.
It's really doesn't feel like a £300 product. Amp plus speakers plus Apple Remote on the iPod plus iTunes plus Airport Express. That's a better solution. I'd still need that dock though, and all of that would be a lot more than £50.
Friday, 17 September 2010
Obama's religion
I can't remember what I was discussing with a friend of mine last night, but it led me to say "Obama probably isn't a Christian".
My friend looked at me as though I was mad. As though I'd said something deeply offensive.
"What do you mean ?", he demanded.
I looked puzzled at his reaction, and replied, "Well, he's an intelligent man. He's more likely to be a closet atheist. He'd be unelectable if he didn't do the whole Christian thing"
He relaxed.
"Oh. Thank fuck for that! For a moment I thought you'd gone mad and that you thought he was a Muslim!"
Oh how we laughed. For quite a long time.
Interestingly, I read this today. I may have to revise my opinion, but my experience suggests that most Christians are either non-practising believers, or practising-non-believers.
My friend looked at me as though I was mad. As though I'd said something deeply offensive.
"What do you mean ?", he demanded.
I looked puzzled at his reaction, and replied, "Well, he's an intelligent man. He's more likely to be a closet atheist. He'd be unelectable if he didn't do the whole Christian thing"
He relaxed.
"Oh. Thank fuck for that! For a moment I thought you'd gone mad and that you thought he was a Muslim!"
Oh how we laughed. For quite a long time.
Interestingly, I read this today. I may have to revise my opinion, but my experience suggests that most Christians are either non-practising believers, or practising-non-believers.
Subscribe to:
Posts (Atom)