Tagged: open source

Controlling Android Using A MakeyMakey

I recently got a MakeyMakey. It's a sort of ersatz USB keyboard that can be plugged into anything electrically conductive. I blogged about using it to control my Raspberry Pi using fruit and veg.

I also blogged about controlling Android using a USB keyboard and mouse via a USB OTG cable.

Hang on... the MakeyMakey is USB... Android can be controlled via USB... CAN I CONTROL MY ANDROID WITH FRUIT?!?!?!?

Why yes! Yes I can. Watch and learn, young grasshopper.

I couldn't find any games which said they could be controlled by a USB keyboard. Luckily, the mouse click on Android is interpreted as a tap on the screen - so any single tap games work well. I used the delightful Whale Trail, but other endless running games like the popular Canabalt also work well.

If you know of any Android games which can be controlled with just the arrow keys and spacebar - please let me know in the comments. I'd love to build a banana joystick!

Instagram Got You Down? Don't Be Fooled By Flickr.

Man! Instagram sucks! Let's all move to Flickr!
The Internet - December 2012

The same flickr which capriciously deletes the photos of paying customers? The same flickr which has catastrophic accidents? The same flickr who bans paying customers for commenting on political issues? The same flickr which one day decided that paintings and drawings weren't suitable for its site?

Yeah. I'm not ok with that. If you're "liberating" your Instagram photos to Flickr, you're merely trading one jail cell for another.

As I've mentioned before, we're moving to an era where people control their own content. They don't need to cede it to some 3rd party and hope that the terms and conditions don't change from under their feet.

So, what's the solution? People are saying "what did we do before Instagram? Oh yes, Flickr!"
What they should be doing is saying "What did we do before Flickr? Oh yes, self hosting."

That's where OpenPhoto.me comes in. The premise is simple. You store your photos on your own storage system. That could be your DropBox account (500 MB free), your Box.com account (5GB free), or Amazon S3 (5GB free), or CX.com, or DreamHost's DreamObjects - or, finally, on your own server.

They're your photos - so you get control of them. You can easily back them up, move to a different hosting provider, or delete them forever.

You get a nice front end for your photos - with commenting, tagging, albums, privacy settings, mobile viewing and uploads etc.

openphoto example

You can change the look and feel of the theme to suit your preferences.

With a single click you can import your images, tags, comments, and metadata from Instagram, Flickr and Facebook. No doubt more services will be arriving soon - or you can manually upload your photos.

As I've mentioned, if you really don't trust any of the above storage providers, you can use the Open Source OpenPhoto to run everything on your own server.

Why on Earth would you want your photos to be held hostage by some nebulous third party? Even if you have a billing relationship with them, it won't stop them changing their terms and conditions, or "mistakenly" deleting your work.

Want to liberate your photos from the evil Instagram? Tired of Facebook's stranglehold on your images? Remembering why you left Flickr in the first place?

Here's the button you need to press.
openphoto logo

A UTF-8 Aware substr_replace (for use in App.net)

So, I stayed up bashing my head against a brick wall all last night! PHP's string functions aren't (yet) UTF-8 aware.

This is a replacement for subtr_replace which should work on UTF-8 Strings:

  1. function utf8_substr_replace($original, $replacement, $position, $length)
  2. {
  3.  $startString = mb_substr($original, 0, $position, "UTF-8");
  4.  $endString = mb_substr($original, $position + $length, mb_strlen($original), "UTF-8");
  5.  
  6.  $out = $startString . $replacement . $endString;
  7.  
  8.  return $out;
  9. }

Take this typical string from App.net

» Hello @bob how are you?

According to App.net's entities, @bob occurs at position 9 and has length of 3.

Normally, we would just use substr_replace.

However, PHP will count any unicode character like "»" as two characters. So it thinks that the position of @bob is 10.

Arse.

So, given we have the position of the substring, and its length, we can use PHP's multibyte functions to split the string in two.

First,

  1. $startString = mb_substr($originalString, 0, $position, "UTF-8");

Gives us:

» Hello @

Secondly,

  1. $endString = mb_substr($originalString, $position + $length, mb_strlen($originalString), "UTF-8");

Gives us

 how are you?

Finally, we stitch them back together

  1. $newString = $startString . $replacement . $endString;

Visualising Conversation Threads In Hyperbolic Space

In 2009, Kosso and I petitioned Twitter to allow us to search for Tweets by their "in reply to" ID.

The idea was that developers could created a properly threaded view of conversations.

Of course, Twitter being ultra-responsive to developers, did absolutely nothing.

Skip three years into the future, and App.net is providing all the API goodness that Twitter doesn't. This means that we can easily create new ways to view conversations.

So that is exactly what I've done.

You can play with HyperThread yourself at http://shkspr.mobi/hyper/.

This is a hypertree visualisation of a simple conversation. The centre node is the start of the conversation. Each reply goes off in its own thread. Clicking on a node, re-centres the tree.
Simple Conversation Thread

As a conversation grows in complexity, the conversation fades out at the edges. Clicking down a conversation thread allows you to easily follow a thread.
Conversation Thread

Of course, with extremely long and complex threads, the tree becomes more difficult to navigate. This is something I hope to fix in future versions.
Complex Conversation Thread

Here is a video exaplaining how it all works.

You can play with HyperThread yourself at http://shkspr.mobi/hyper/.

The visualisation uses The JavaScript InfoVis Toolkit.

The tree sorting algorithm is courtesy of the good folk at StackOverflow.

A few points to make here:

  • This is a prototype. Some things may not work. Some essential functionality is missing.
  • The layout algorithm is wonky. Sometimes the threaded layout looks really weird.
  • The longer the conversation, the more complex and slower the visualisation.
  • This only retrieves the first two hundred posts of any conversation.
  • If posts have been deleted, the entire view may not work.
  • Some threads just don't work.

Inspired in part by Lucy Pepper's Monkey.deck
Lots more conversation about threading at adndev.

Authentec Fingerprint Scanners - Full Specifications (AES2810 & AES2550)

Last year, I wrote about how Authentec wouldn't support their fingerprint readers on Linux. I've been chatting to the good folk at Authentec, and they've agreed to release the specification documents!

So if you want to code up an interface for the AES2810 or AES2550 you can!

A word of note, the best way to get the latest version of these documents is to register for the Authentec Developer Program. You then need to drop the team a note asking to get access to these specific documents - devportal AT authentec.com

That way you will get informed when there is a new release of other sensor's specs or updates.

So, here are the documents :-)

NB, I specifically asked the development team about sharing these files. They said:

Since we have released the documents without requiring any NDA or other such agreement signing we can't prevent you from sharing them.