So I have a Raspberry Pi hooked up to my TV, and despite dropping more on power supplies and USB hubs than I did on the actual computer (actually not hard considering that it was a gift, but whatever) - I've still been having freezing issues. I eventually figured out that the problem was xbmc, the media player frontend. Essentially, it's a pretty chunky bit of software which was putting the CPU under a constant load of between 60 and 80 percent, which was probably doing bad things to it both temperature and power-draw wise. Anyway, since disabling the xbmc service at boot, it's been up for two days and counting.
This leaves me with a bit of a conundrum though, because I do actually want xbmc to run so that I can watch movies and stuff. The neatest solution is to start xbmc when the TV powers on, and because HDMI is a nifty next-gen standard, it actually signals that kind of thing. More importantly, because the Raspberry Pi is a wonderful bit of hardware with undocumented features coming out of its ears, it actually has very good support for reading these signals. It even comes with a little bit of software to work with them, called tvservice.
So, it's a pretty simple matter to write a bit of glue to watch the output of tvservice, and startup xbmc when the TV powers on. The result is something like this:
#!/usr/bin/python import subprocess tvservice = subprocess.Popen(['/opt/vc/bin/tvservice','-M'], stdout=subprocess.PIPE, stderr=subprocess.STDOUT) xbmc = 0 while True: status = tvservice.stdout.readline() # print(status) if tvservice.poll() is not None: tvservice = subprocess.Popen(['/opt/vc/bin/tvservice','-M'], stdout=subprocess.PIPE, stderr=subprocess.STDOUT) if status == b'[I] HDMI is attached\n': xbmc = subprocess.Popen(['/usr/lib/xbmc/xbmc.bin','-l','/run/lirc/lircd']) print('HDMI connected. Starting XBMC...', end=" ") print('done.') if status == b'[I] HDMI cable is unplugged\n' and type(xbmc) == subprocess.Popen: print('HDMI disconnected. Stopping XBMC...', end=" ") xbmc.terminate() print('done.')
A couple of notes. First, it assumes that you'll start the daemon with the TV off, although it shouldn't freak out if you start with it on - it should hopefully detect that and not try to kill something that isn't running. It also should detect if tvservice dies and restart it, though I haven't actually tested that yet.
It's been tested with a grand total of one TV, so the signals that tvservice is generating might need to be modified for different brands.
Also, xbmc apparently usually starts from a useless little shell script which does some logging stuff and some very rudimentary restarting stuff but then just forks off xbmc.bin. This was causing Python to lose track of which process was actually xbmc, so I bypassed it and started xbmc.bin directly. This doesn't seem to have any adverse effects, but if you do need logging you're on your own.
It should be pretty stable, but just in case I recommend running it at startup and with some kind of service management. If you're using systemd, you can use this unit file here, modified from the xbmc one. This also means that you can see when your TV is turned on using the system journal, which is neat, if not especially useful.
[Unit] Description = Watches for HDMI connection and starts xbmc. After = remote-fs.target [Service] User = xbmc Group = xbmc Type = simple ExecStart = /usr/bin/python /var/lib/xbmc/watchtv.py Restart = on-failure [Install] WantedBy = multi-user.target
On a personal note, this is the first time I've ever written anything which has processes talking to each other, and I'm quite chuffed with how well it works. It's also the first time I've written anything in Python 3 - totally by accident, actually, it's just the version that's included in the version of Linux I use on the Pi. Which I guess is just proof that I should suck it up and convert all my stuff, because apparently the differences aren't all that intimidating. Who knew?
(I went rock climbing today for the first time in a few years, and my forearms hurt so much that typing is a wee bit painful. Sorry if this is a bit terse as a result.)1 comments
Nothing makes you appreciate a fantastic day like only experiencing the last few moments of it because you've been inside at work all day.
Don't get me wrong, my job is awesome, but it's also undeniably... well, on the converted top floor of a shopping mall. Wistful stares out the balcony windows during briefings on days like today are not at all uncommon.
So here's my proposal: why not an outdoor science centre?
Obviously you can't install a Tesla coil in a park (or could you?), but there's no reason that a about half of the stuff on the floor at work couldn't be just put straight outside, and probably even more of it with a little weather-hardening.
You could do a pretty mean giant Newton's Cradle. A jumbo size version of Air Mail would be awesome. We've got this whole section of maths problems for solving, stuff like the Towers of Hanoi and the Dog/cat/bird puzzle which could be done - again jumbo large - using pretty standard playground construction techniques. Maybe a harmonograph that you load up with sand and watch it pour out on the ground?
It opens up loads of possibilities you can't do inside too. You could do a whole thing on fluid dynamics with rainwater, and a thing on efficiency of solar panels - maybe with ruggedised weatherproofed components to plug 'em into to compare energy usage. And bring back that thing with the plants growing under different coloured filters to demonstrate how chlorophyll works, only you can just stick some biggish filters over regular plants in the ground. And obviously, as you can probably see, the scale of everything can be much bigger.
The only things you couldn't really do is anything with consumables, like paper planes now, and anything requiring sort of precision electronics.
You wouldn't even have to lose the demonstration stage. Imagine the kind of explosions you could do without having to isolate the fire alarms...
Anyway, just food for thought.
The contents of this post, obviously I'd hope, don't reflect the official opinions of Scitech in any way.0 comments
I think it's time I properly defined my relationship with alcohol. For myself, and for other people. Mostly for myself though.
Probably the best place to start is history. I didn't drink through high school. This is partly out of a possibly misplaced desire to follow the rules, partly out of a desire to differentiate myself from the kids who did drink, who were kind of douchey about it, and partly because I was part of a group which, for whatever infintely nested other reasons, didn't drink much themselves.
Then, instead of going on leavers after graduating, I went travelling through Egypt and Europe and picked up some Hepatitis A, which meant I not only missed everyone's customary introduction to total inebriation at leavers, but I also spent the next twelve months not allowed to drink under the threat of permanently damaging my poor, recovering liver. This meant that I spent the first year of uni, again a customary introduction ground for drinking, avoiding precisely the kind of camps that PerthNow likes to write about.
The few parties that I did go to, I was one of the token sober guys. This meant either pretending to be drunk in order to socialise with other drunk people, or standing uncomfortably in the corner. Usually the latter. I think the stereotype is pretty clear that drunk people are not fun to be with when you're sober, and my experiences back that up.
And I guess as a corollary to that, drunk people don't particularly like a sober person around "judging them". This led to quite a few instances of people 'trying to get Rocky drunk' which as a stubborn bastard I was having none of.
So here's basically what that means. A combination of unfamiliarity and medical reasons both left me isolated from drinking culture and occasionally cast as the one sober guy around drunk people. This left me pretty uncomfortable with alcohol, and when my medically required one year was up, I kept avoiding the stuff for a while out of sheer force of habit.
By my reckoning these are the reasons behind my gut dislike for alcohol. To go along with those I have some rationalisations, which I more or less agree with - but they are just that, rationalisations. My usual ones are something like these:
In the interests of balance, here are some reasons I do drink:
So now I am going to talk very emphatically about some things which are not in this manifesto:
This stuff has sort of come to a head recently. I think a lot of my friends get the impression that I judge them for drinking. I need to say this as emphatically as I can: I don't. I don't think alcohol is an evil thing that should go away. I don't respect anyone any less because they drink. And I don't want to force, or push, or suggest what are ultimately my choices about my actions onto anybody else. Do what makes you happy. Choose for yourself, not for the people around you.
I know writing this down has helped me figure out where I stand, and I hope that articulating this helps clear some stuff up.
Back, and better than ever. And not just back from Europe, either.
If you've tried to visit the site in the last, oh, 24 hours or so, you were probably greeted with this:
That's because I've been in the process of upgrading this site to blogtools 2, my self-written blog engine that's so crap that it doesn't even deserve a capital letter.
There are relatively few front-facing improvements in this version - just about the only one that you'll notice is that comment boxes now support Markdown for your formatting pleasure. On my end, though, it's much easier to maintain and extend.
The code is available under the MIT license - that means you can not just look at it, but build your own stuff with it too - and you can find it at http://code.google.com/p/blogtoolsdotpy/.
Thanks for your patience and attention!1 comments
Well, this is awkward. Been back for almost a month, and still haven't finished the travel blog. Oops. Okay. Let's do this.
Paris is built on a series of tunnels. Actually, since they were originally quarries, I guess you could say that it's technically also built from those tunnels. In about the
So we did. We had to get up ridiculously early and catch the Metro with all the commuters and get there an hour before it opened so that we were reasonably near the front of a queue that would eventually stretch around the block and back past the entrance again, but we did.
I'm not actually sure I'd seen a real human skull before this. Especially not from a human who lived in the last few hundred years, and I'd certainly never walked down a corridor made of them before. The effect was eerie.
I think a huge amount of that is intentional. The catacombs were at one point just a big ol' tunnel full of bones, but at some point a French bloke decided to romanticise them a bit, and set about carefully tiling them and insetting them with pillars and altars and slabs inscribed with memento mori style poetry. It's the difference between an essentially hygiene-driven disposal of bodies, and a temple to the concept of death. Or, I guess, a bit like the difference between a morgue and a graveyard. Between, for want of more sophisticated words, creepy and spooky.
I thoroughly enjoyed it. Pretty much the only downside was the audioguides. Nothing against these particular ones - they were very well-produced and informative. I just almost wish that I hadn't known quite so much about what I was looking at. There's a certain pleasure in stumbling on something and wondering first, then understanding, rather than having understanding injected into your earholes as you walk.
We spent the afternoon after that in Montmartre, the famously artsy part of town. If the 'mont' didn't clue you in, Montmartre is on a hill, and it meant quite a lot of walking was involed to get there. The result, however, was worth it. Wait, no, not the view. I meant this:
Because you gotta have a charicature done in Montmartre, right?
Jess and Morgan took themselves off to a date at this point, while Grace and I took Ben to see the Eiffel tower. Somehow he had made it an entire week in Paris without seeing the tower up close, merely as a tower-y smear on the horizon.
Despite what the signs in the metro say, the best station to get off at for the Eiffel Tower is Trocadero. This is because when you get off, you can't actually see it - you're behind some impressive-looking building, and there's nary a tower in sight. And then you walk around the corner, and there it is towering over you.
This accident of architecture prompted the following response from Ben:
Ben: "Holy butts! That's an Eiffel Tower!"
Which just by itself I think was worth the wait.
We did the thing that everyone does when you see the Eiffel tower. You wander down, sort of gawking up at it, until you're right underneath, and suddenly this world-famous monument turns into a really intricate bit of engineering surrounded by street vendors selling copies of it on a keychain. Then you wander back a bit, and find a crepe stand, and buy very overpriced nutella crepes while every so often turning around to look at the tower again, because it's something that's so famous, and so surprisingly big, and, well, holy butts, it's the Eiffel Tower, right?
(I'm not sure that that's actually the canonical way to see the Tower, but it sure seems like it should be.)
I had a bit of a moment walking back up the stairs. We were coming to the end of the trip, and there's something about seeing something so iconic, not for the first time, but possibly the last time (at least for a while), and I was suddenly very conscious of it. I don't usually get sentimental about views, but just this once, I stood there and for a bit and just drank it in.
Friday was our last day in France, and we pretty much spent it at Versailles. I've learned on this trip that I get a bit crabby if I don't have breakfast, and I think it's fair to extrapolate that to everyone else too. Especially coupled with a very early morning and a train trip that made us woozy but wasn't quite enough to send us to sleep, and a queue that seemed to stretch forever to actually get inside.
What we ended up doing was taking a walk through the gardens, grabbing a bite to eat, and spending a couple of hours relaxing and napping next to the lake. I got wonderfully, gloriously sunburnt, in a way that no weaksauce winter sunshine in Perth could possibly match, and hired a rowboat for a while.
(There's a story about how I went up to the rowboat hire guy and, after opening with a perfectly accented French 'bonjour', blanked on the word for 'boat' and then said in perfectly accented Australian English, "One boat please", much to the dismay of the Frenchman at the counter. But Grace tells it better, you should ask her.)
As for the palace, it was... opulent. In a way that only aristocracy can manage. I'm not actually a huge fan of having every surface covered in ornately carved ostentatiously gold-leafed squiggles and, if I'm honest, I got pretty tired of being pulled along with a current of other tourists. With the exception of the Hall of Mirrors, which was amazing, and has 'x was here' graffiti from before I was born (which I think is pretty cool), the inside of the palace was a bit of a wash for me, I think. I would rather have spent more time exploring the gardens, which were just as fascinating, but much less crowded and much less expensive.
That evening, Jess took us out to dinner at possibly the Frenchest French restaurant in Paris. It was delicious - 'specially the foie gras, which I know is bad but oh my gosh - and gave us all a bit of a chance to look back on the trip. We played favourites (I believe a list exists somewhere, which I'll stick in a comment) and aired some greivances, and it was a really pleasant way to wrap up the trip.
So what did I think?
I now know that I have the basic competence to travel, on my own, for five weeks, on the other side of the world, on my own dime. Not that I didn't think I could, but having the experience to back that up is satisfying.
I learned that holidaying with mates is just as much of an exercise in compromise as holidaying with your dad. And that's okay, as long as everyone knows that going in.
I discovered that you can get a decent impression of a country in just a couple of days, but if that impression makes you want to stay then you'll never want to leave.
I got properly, properly drunk, for the first time in my life, and while I have no particular desire to do it again, I can't think of a better place to have done it than Dublin.
I also saw a musical for the first time in my life, and while I have no particular desire to do it again, I can't think of a better place to have done it than London.
I travelled lighter than last time, and had a much easier time dealing with my luggage, and next time I'll probably take even less. That said;
I really, really enjoy writing - and publishing - about where I go. It roots me in the place I am, and makes me notice details, and gets me thinking about my experience, and then forges all of that into a narrative rather than a series of disparate memories. And doing all that on a smartphone, as gratifying as it is to travel light, is really bloody difficult. Next time I'm taking a laptop.
I found a part of myself that really enjoys just shamelessly being a tourist, despite the rest of me's utter disdain for it, and I actually don't think it's that incompatible with also wanting an authentic experience.
I learned a lot about how I think about art, and culture, and history, and where it is that the roots of the society I grew up in actually came from.
I discovered that visiting places you've already been with new people can be just as interesting as visiting new places. And that places you never thought you'd enjoy, or that you thought you already knew, can be transformed by someone else's perspective. And that having other people's plans differ from your own can take you places you'd never even think to go on your own.
And that sometimes, it's not where you go that matters. It's who goes there with you.
Thanks for reading.
Archives© Rockwell McGellin