Teleman – Leeds Wardrobe 2nd April 2016

First up support band NZCA Lines.  Not a bad slab of electro pop.  Every song seemed to start off pretty interesting and showed promised but then it just washed over me.  I need to give them another go I think.  Also, I thought Charlotte Hatherley was in this band but she was no where to be seen.

Teleman take to the stage just after 9.30.  It’s an almost sold out venue and the crowd are pretty vocal.  There’s some people near me that won’t shut up.  I’m about to lean in and remind them that we’re here to see a gig and not to listen to them when they seem to settle down.  This is the second time I’ve seen Teleman (first being at Leeds Brudenell a couple of years back) and this seems to be a recurring issue for their crowds (never noticed this with the Pete and The Pirates gigs).   Oh well, Teleman put in a strong performance this evening the few songs they play from their forthcoming album sound great and it’s all wrapped up at the end with the classic “I’m not in control”.

The Stranglers – Leeds 25th March 2016

I was at this gig – Don’t remember much about it thanks to my good friend alcohol!

It was good- they played Black and White for the first half of the gig then followed it up with hits and bits.

Raspberry Pi Web Scraping and Push Notifications

Had the Raspberry Pi for a while now and haven’t really done much with it so I decided to build something semi-useful. Basically we’ll be scraping the web using:-
Python (programming language)
BeautifulSoup (Python library to assist with screen scraping).
Pushbullet (allow for notifications to Android phone – both SMS and push notifications)
Firstly, lets get the web page we’re interested in the live departure table.

requests.get(‘http://ojp.nationalrail.co.uk/service/ldbboard/dep/LDS/MLY/To’)

Live Departure Boards - National Rail Enquiries - Google Chrome

Using BeautifulSoup we can get a handle on the td elements for “Due, Destination, Status, Platform and Details”and as there’s 5 on a row (but we don’t know how many rows will be present) we can divide the tds returned by 5 to get us reach of the rows elements. So if there’s 6 rows we’ll have 30 elements.

play.py - CDevPythonpython_projplay.py (3.5.1)_7

We only care about the 3 element in each row (the “Status”) and if it’s not on time.  Again each row comprises of 5 elements so we can (crudely?) use the use a condition on the modulus operator and check that if it’s text isn’t “On time”.  If it’s not then send a PushBullet notification to my phone with the train’s original time (back 2 elements and the status that’s not “On time” (i.e late again thanks Northern Rail!).  Notifications to the Android phone of late trains…..

58f4ef23-230a-43eb-b5d1-04d7e6de115d

All that remains now is to set a cron job on the Raspberry Pi so that the script kicks in at the times I want it (7am and 4.30).  Stick a condition on the code so that it checks the right journey depending on the time and away you go.

play.py - CDevPythonpython_projplay.py (3.5.1)_6

Nunit [ExpectedException] attribute no longer in use 3.0 onwards.

Was converting a series of unit tests from MsTest to Nunit (due to TeamCity constraints with MsTest).  Was scratching my head for a while – Coulda sworn Nunit supports the ExpectedException attribute.  Quick google and it does – Look! there in the official Nunit documentation  Further digging gets me to this  .  Ok.

Messing about with the PushBullet API

Stumbled across the PushBullet API and Android App.  Spent 10 mins and managed to send push notification to my phone using curl as follows:-

You’ll need to signup and PushBullet to gain access token.

curl -k –header “Access-Token: <your access token>” https://api.pushbullet.com/v2/pushes -X POST –header “Content-Type: application/json” –data-binary “{\”type\”: \”note\”, \”title\”:\”Note Title\”, \”body\”: \”Note Body\”}”