blag dot rockym93 dot net

archive · tags · feed

Rocky's Blag

Wednesday, 17 December 2014

Posted at 11:35AM under Rants,.

How Triple J Sold Me A Spotify

So I was driving home yesterday, and I put Triple J on. Normally I wouldn't - I've got one of those tape thingies that turns your tape player into a line in - but I figured the occasional punctuation of updates on what was happening in Sydney couldn't hurt.

I forget the presenter, and the program, and the time, otherwise I'd plug them - but someone at some point played this by some guys I've never heard of called sleepmakeswaves and - I don't know, for some reason it just grabbed me.

I don't generally write or talk about music much because historically my taste has been a little bit embarrassing, but I'm going to make an exception for this because I think it's really cool. It probably has some label like 'new' or 'alt' that will make me sound like a wanker if I try to talk about it (Google confirms: 'post-rock'.) But I like it. More than that, it feels like someone reached into my brain and found all the things I like in music and smashed them together.

So at this point I'm faced with a choice. I can wait until I get home in several hours time after rock climbing, text my brother to find out where The Pirate Bay is hiding, and muck around for half an hour trying to remember how to get my computer to talk to my phone.

Option two is to click the very convenient button next to the tag on my phone screen, taking me to Xbox Music to buy the album for $12.

Here is where it gets interesting. Because option three also costs $12. Option three is to take advantage of the Spotify Decemberween special, and get myself three months of premium, and then stream the album.

As is probably obvious by the title, option three is the one I took. I've taken two in the past (an instance of needing the Guardians of the Galaxy soundtrack right now comes to mind), but I have this data plan I'm not using, and... well, it's something I've never tried before. Never underestimate the power of novelty.

Anyway, the point I'm trying to get at - yes, there is a point - is one that's been made many times before. Heck, I think I've heard it before, but never understood what it meant until now. The point is this: Piracy is not the entertainment industry's enemy, in the legal sense. It's an economic competitor. They are competing not just on monetary cost, but on time cost. Most people have no ideological allegiance to piracy, and the instant that paying for content becomes a good enough value proposition on the time/money/effort scale, people will do it. Well, I'll do it, apparently. I'm just extrapolating to people in general, but I think the success of services like Spotify and Netflix and stuff is proof that that extrapolation holds some merit.

So here's a postscript for you: Does the entertainment industry realise this? Are they the lumbering, decrepit relics the internet likes to make them out to be? Or have they discovered that throwing their legal weight around, shutting down websites, sending cease and desist letters, and throwing lawsuits at my ISP, is a means to tilt that value proposition in their favour, rather than an end in itself? That they can use the justice system as a tool to generate profit instead of a way to settle grievances? I suspect they probably have, which to me is even scarier.

...

Anyway, go listen to Love of Cartography. It's rad, and you will enjoy it.

3 comments

Monday, 17 November 2014

Posted at 12:59PM under DnD,.

Blue Fan

Blue Fan is a trainee samurai who lives inside my head. He inhabits a virtual universe whose computing substrate is James' brain and a lot of graph paper. But Blue Fan doesn't know or care about this.

Blue fan likes protecting and serving his Emperor, and spending time with his horse Solo. He dislikes men who are without honour, and raw fish. In his spare time, he enjoys writing haikus.

Last night Blue Fan's master sent him to complete a task. Afterwards, he wrote these haikus about it.

1
a hole in the heart
the presence of an absence
waves crashing on reef

2
fractured hull bent mast
kelp fronds waving in the tide
cold grips one's ankles

3
far too many legs
sashimi falling softly
on sloping deck

4
time slows to a crawl
sword flowing like steel waterfall
crab meat slides down walls

5
perhaps it is i
who should not be fishing
in pools of gnashing teeth

0 comments

Saturday, 15 November 2014

Posted at 04:00PM under SCIENCE,.

Something about clouds

Today in inappropriate use of Scitech's IT equipment: Blogging. For those keeping track at home, last week was coding.

There's something pretty cool going on here. And maybe it's a little bit obvious, and maybe this is one of those realisations that is only interesting to me, but I figured I'd share it anyway.

cloud panorama

This was taken at about half past six, and it looks like a pretty standard sunset, right? There's some nice contrast going on, maybe we could go down and take photos of it if that was our thing. We've got a couple of different types of clouds up there - some grey ones and some white ones - and the sun is setting behind them, right?

Well, no.

For starters, there's actually no such thing as a grey cloud. No, not even those big bad rainclouds. Dig through all the satellite photos you can find - or, more entertainingly, dig through a bunch of astronauts' Twitter feeds. Every cloud you see will be perfect, bleached-flour, tooth-whitening-agent white.

So, what's going on then? They sure look grey.

They, like many other grey things - are just white things that are really badly lit. A gigantic grey thundercloud only looks grey because there's no light hitting it when it's over your head - and also they have a tendency to be thicker.

What about these guys then? Why are they grey?

The thing that lights up clouds when they're in the sky - barring, like, lasers, is the sun, and obviously by about half past six the sun had dropped below the horizon.

Then how come there are still white clouds behind it?

Ah.Nnow that's the nifty part, and the part where my cloud geek gets to come out to play. Those clouds are textbook cirrus clouds, whereas the grey ones have a pretty typical fluffy cumulus shape. Cirrus are formed from falling ice crystals in the freezing upper atmosphere, whereas cumulus are basically the foamy condensing tops of thermal currents radiating from the warm, moist ground. Both created by warm air and cold air crashing into each other, but sort of from opposite directions.

But the white ones aren't white just because they're made of ice - I mean, a fluffy cumulus and a streaky cirrus are roughly the same colour at midday, right? They're white becausethe white(-y-yellow) ones are still lit because much like a man in a scissor lift can demonstrate, the sun sets at different times at different altitudes. And cirrus clouds are much, much higher.

cloud diagram

So for those clouds - despite being in exactly the same timezone - sunset hasn't happened yet! Up there in the very top of the troposphere, today is still happening.

And if we had enough types of clouds in enough different layers, we could watch the sun set in each one, one after the other, over and over until we ran out of atmosphere.

This is both a neat reminder that we're living on the surface of a sphere, and a neat bit of proof that clouds like to live at different altitudes. And if I can get a bit philosophical, it's also a reminder that mystery and wonder are not necessarily as strongly correlated as we like to think. What's cooler - thinking this is just different coloured clouds, like a thunderstorm, or looking up and seeing the clouds basking in same sunset you just watched just a few short minutes ago?

I mean, One of those is definitely cooler. I know which one I'd choose.

0 comments

Thursday, 13 November 2014

Posted at 10:45PM under IRL,.

I've been wearing the same shirt since Tuesday...

...and the same socks since yesterday. But that's okay, it's a pretty cool shirt.

It feels like the end of a weekend, even though it's Thursday.

I had a picnic with cheese and cider by the river and then was driven in the back seat of my own car for the first time. I mentally rearranged someone else's front room. I got a haircut. I spent four hours fretting about a one-hour tutoring session, which I actually totally nailed - turns out I can teach maths after all. I stayed up until four in the morning playing Kerbal Space Program and watching ESA land on a comet, and slept on a couch. Man, I can't even remember the last time I stayed up until four playing video games and then slept on a couch. I made pancakes and bought James maple syrup for his birthday and solved Haydn's rocketry problem with a pencil lead and then napped on the couch for about four hours and cooked green chicken curry for dinner.

Screw it - I don't care that it didn't happen over Saturday and Sunday, this is the most interesting weekend I've had in a very long time.

0 comments

Friday, 31 October 2014

Posted at 12:54AM under Code?,.

Starting XBMC when a Raspberry Pi's HDMI is connected

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.)

3 comments

< Previous

Archives