Skip to main content

Posts

"How Do I Test It?" Proof Key for Code Exchange by OAuth2 Public Clients

Having adapted an example OpenID Connect server (built in Rails) to a production system, I need to add PKCE support so that it could be used securely to allow mobile systems to log in. OAuth2 (and therefore OpenID-Connect) isn't considered as secure on mobile devices because rogue applications on the mobile device can hijack the authorization code. Here I'll try to describe the thought process that goes into not the implementation, but the interpretation of the spec into a set of tests that will allow us to be reasonably confident that mobile clients will be able to connect. (Pleasingly, the first time the mobile integrators tried to connect with PKCE it worked perfectly, both with errors and successful paths). My implementation is in Ruby, of course, and my tests will be in RSpec with expectations, so some of the language might not be generic but the concepts should map to other languages / frameworks. I've marked the actual tests I needed in yellow with the word TEST:...
Recent posts

Internet Explorer - the bane of bank holidays

I'm pretty sure that my last bank holiday was ruined by Internet Explorer 8, and now that our clients have dropped that from their supported version list, its younger brother has stepped up to the plate to try to ruin this bank holiday for me. A stylesheet which works fine on Firefox, Safari, and Chrome (and even works tolerably on IE8, incidentally), inexplicably fails to apply a huge number of styles on IE9. This is a delightful thing to find out essentially 1 working day before a planned release. We can of course go into some life lessons learnt, but they might come out a bit on the grim side (i.e. never trust anyone else to check anything, you will always have to fix everything yourself). So nuts to that. This is about technical lessons learned. Here are some things I've found so far: This project has some pretty terrible CSS, a product of stuff being layered on top of other stuff forever. Code decays, and CSS decays particularly fast, it seems. When you look at the...

Recording MIDI Sessions Automatically - Part 2

Now I need to write the notes to a file, and determine when sessions start and end. This is pretty easy - I just see if any notes have been played in two minutes. If none, it's the end of a session and I can flush to disk. PyGame.midi input events are arrays with two values: another data array, and a timestamp. I normalise the timestamps by subtracting the first timestamp from each subsequent one. The data array is: status, data1, data2, data3. For a note on, this is 144, pitch, velocity, channel. For a note off, my piano is sending 144, pitch, 0, channel. MIDIUtil looked promising for saving this, but it handles the low level note-on/note-off business - data I already have, so I'd have to do complicated stuff to reverse that, pass it to the library which would then undo it. Something simpler is needed: mxm's midi writer .

Recording MIDI Sessions automatically - Part 1

For Christmas I have been given (very kindly!) a Kawai CL26 Digital Piano. In order to feel more deserving of this amazing instrument I've been planning to record my practise session times in order to amortize the cost (in a sense). But why not simply record everything ? My USB/MIDI converter works with raspbian without any extra plugins. Then, using Pygame.midi I can see incoming MIDI information in a polling loop: import pygame.midi import time pygame.midi.init() inputKeyboard = pygame.midi.Input(3) # this is the device id for the midi input, worked out by doing # pygame.midi.get_device_info(1-n) while 1 == 1: while inputKeyboard.poll() == True: print(inputKeyboard.read(1)) time.sleep(0.001) inputKeyboard.close() pygame.midi.quit()

4Store with Snorql on Raspberry Pi

Problem I need to access triple-store data for a work thing, but the data I have to test with isn't in their (sesame) triple store yet. There are RDF files, though. Solution Install 4Store on a pi (I had one with a default Raspbian running because it's the mumble server). sudo apt-get install 4store ...then I set up the 4store with instructions from here : sudo 4s-backend-setup saws sudo 4s-backend saws 4s-httpd saws then import the RDF files with a convoluted command: curl --verbose --header 'Content-type: application/rdf+xml' --upload-file MSH_Thales_Trans.rdf --url 'http://localhost:8080/data/http%3A%2F%2Fwww.purl.org%2Fsaws%2Fontology%23' (for each file - the url is the saws url encoded, the .rdf bit was done for each file). Then fix the RDF, because rapper rejects it all. To validate the RDF I used this: http://www.rdfabout.com/demo/validator/ Okay, now I can see things on the pi: http:// <pi ip address...

Mumble and Murmur on Raspberry Pi

Problem:  Skype kind of sucks for games night things. Potential Solution: People have suggested ventrilo, etc., but murmur (the mumble server) will run on a raspberry pi. As I have a few of them, I reimaged an SD card with the newest raspbian, then followed the instructions here: http://www.raspberrypi.org/phpBB3/viewtopic.php?f=36&t=8615 If I put it in the DMZ, hopefully people from outside Nerdvana should be able to connect to it. It supports positional audio for games - I wonder if I could make a plugin that would just allow you to set your position, so that we could be around a virtual table with positional audio? ...Looks like there is: Mumble comes with a plugin for manually positioning audio. http://mumble.sourceforge.net/Games#Manual_Positional_Audio_Plugin

Chrome Extension: iPlayer to XMBC

There's a Chrome extension called Play To XBMC which adds a little button that will send a YouTube, Vimeo, or CollegeHumor video to XBMC - provided you have the YouTube plugin installed. This is a lot more convenient that using XBMC to search directly, if you don't have a keyboard plugged into the XBMC box. The XBMC iPlayer plugin suffers from the same problem that browsing/searching aren't easy without a keyboard, so I wondered if I could make a chrome extension that would do the same for iPlayer. Chrome extensions are packages of javascript, html, and image files that get unpacked by Chrome when they're installed. You make a Manifest file (which is a JSON file) that tells Chrome what icons to include, what sort of package it is, etc. The Play To XBMC extension is a browser one - the button is always there. I made mine page specific - it only appears on valid iPlayer episode pages. You do this by putting in a javascript page that runs in the background every time ...