Thursday
Oct282010

The Daily WTF Submit Automator Service

The guys at TDWTF created a Visual Studio plugin for submitting WTF articles

I thought a Mac OS X Automator Service would cover pretty much all bases on Mac, so here it is. 

The Automator service is callable from (almost*) any app that lets you select text :)

 *some non Cocoa apps (e.g. Java) such as IntelliJ do not support Services.

 

To install: Unzip the download into your ~/Library/Services folder.

To use:

  1. Select some text in and app. 
  2. Goto the 'Services' menu - this depends on the app, either right click the selected text, or goto the Apple in the menu
  3. Once in the Services Menu navigate to select Service -> SubmitWTF
  4. Follow the on-screen prompts

 

Some minus points:

 

  • Java apps do not tend to support Services at all
  • The Service UI is a series of single field dialog boxes - if anyone knows how to create single page input form in Automator please let me know.
  • It is always set to publish - easily fixed, but with /another/ dialog box

 

 

 

Terminal Screenshot

TextEdit Screenshot

Firefox Screenshot

Note that Firefox does not support 'Service' in the page context menu so the 'Services' are accessed from the main menu

XCode Screenshot

 

 

Saturday
Dec052009

TwitterBot Construction Kit

I pulled the Zork Twitter bot apart and rebuilt it using more sensible means.   HTMLUnit for scraping the actual WebZork game and Apache Commons Config for configuration reading.  The code was also restructured to support Twiiter Bot plugins. 

It is a failry simple interface constisting of 4 callbacks that are invoked on interesting Twitter events.
The methods are passed a Twitter client object that allows the bot to send tweets. 

The default example that simple echos any tweet sent to it is:

package com.glulogic.twitter.bot

public class DefaultTweetHandler {

// Each method called is passed a 'context' hashmap
// containing the following keys:
//
// from - the shortname (login) of the user who sent the Tweet
// body - the contents of the Tweet (@... removed)
// twitter - an object that can send tweets to Twitter users

// called when someone sends an metion (e.g. '@...')
def mention(context) {
context.twitter.mention('to': context.from, 'message': "You said ${context.body}")
}

// called when someone sends a direct message (e.g. 'd ...')
def direct(context) {
context.twitter.direct('to': context.from, 'message': "You said ${context.body}")
}

// called when a user begins following
def follow(context) {
}

// called when a user stops following
def unfollow(context) {
}
}

Tuesday
Sep082009

Air Drum Machine - "DrumAnimal"

It's time to start the music, it's time to light the lights....  Dedicated to Animal.

A while ago I responded to a call on the 'b3ta' mailing list which asked to able to play the air drums.  So, I created a Flash application that does movement detection using a webcam and plays drum kit sounds when certain parts of the screen/camera detect movement. You have in your kit: a snare, bass, kick,  symbols and a hi-hat.

I originally envisaged people just using their hands to tap a rhythm, but I discovered some people posted about using their tongues! Which is up close and personal!

You could also stand at a distance and dance to the beat of your own drum.

SWF

put your alternate content here to show if Flash does not load.



Note:

On Mac OS X the default webcam selected by Flash may not be appropriate, so you may have to open the Flash settings to change it to the built-in iSight.  For example:

Right Click on the Flash App:  Settings->[WebCam Icon]->[Camera DropDown]-> [ Select: USB Video Class Video]

 

Sunday
Sep062009

Portable 3G WiFi Access point

Back in June I obtained a USB 3G Dongle and thought it would be great if the device could be shared by more than 1 PC/Mac device. I dubbed it 'CloudSpot'

This sort of devices allows a number of benefits & usage scenarios:

  1. Macs/PCs not requiring drivers (as I have since found out the 3 ZTE dongle drivers do not work with Snow Leopard)

  2. Project teams onsite at customer locations have a private WiFi, thus avoiding restrictive customer site firewalls

  3. Games consoles such as PSP and Nintedo DS could use it (e.g. multiplayer action/web browsing on camping trips)

  4. The dataplan tarrif for the dongle might be better than the dataplan tarrif for a WiFi enabled Mobile Phone


Todo this I thought that it should be possible to present a software WiFi Access point by an embeded system and bridge the WLAN to the 3G dongle.

Initial investigation showed that this has been done before on embedded 486 and PCMCIA, called Stompbox.  But I thought what the hell...

I have experience of embedded systems, more recently the Calao USB9263, so I created a emebeded dev env in a Debian 5.0 VM and made progress into getting the software installed on the device.

The hardware setup looks as follows:

HardwareLayout

Components are:

ARM System on a Chip - A Calao USB9263 device (ARM9, 256Mb flash, 64Mb RAM)

USB Battery Pack - A rechargable module used to suply power to the device

BlueTooth Dongle - A DLink BT device

3G Dongle - THe Hutchinson 3G ZTE USB Dongle.

WiFi Dongle - An Edimax WiFi Dongle

BAterry Powered USB Hub - Gives more ampage to the wireless devices and saves on main device USB batter pack power.



The software development environemnt was based on Debian Lenny (5.0) -avoiding Ubuntu issues

I setup the project structure based on the book Building Embedded Systems

I used crosstools to create the Cross Compiler - avoiding BuildRoot issues

I used Linux kernel 2.6.30 - which contain Calao Device support as part of the mainline

I used emdebian to create the Root filesystem - avoiding Buildroot issues

The drivers for the Dongle's are either part of the kernel tree or can be downloaded - there are numerous places that document how to get them to work with a Linux system.

I got to the point of having an (em)Debian Lenny with Java (JamVM) running on the device and part way device driver config.

Things left remaining:

  1. Configure 3g Dongle

  2. Configure WiFI dongle

  3. Configure bridging

  4. Support scripts

  5. Optionally addition of secondary services, e.g. support of local rsych backups for laptops via additional USB memory key.


Previous projects

During initial development I came across an old, and somewhat physically larger, project called Stompbox

Since I mothballed this projected a couple of decent looking commercial products have been release:

  1. Thje Hutchinson 3 MiFi

  2. An credit card sized (can't remember the maker)


There are also a number of software solutions for a few (smart) phones that turn the phone into an AP.

Perhaps the fact that my CloudSpot could, in theory, support any manufacturers 3G dongle and also provide secondary services: small intranet for local workgroups,  backup and could be wired into a LAN; might make it worth continuing.  But one things for sure, it needs a decent box so it doesn't look like a blaster from Starwars.
Wednesday
Aug192009

Open GeoCode API for Postcodes

These guys have done something interesting and useful by offering a free to use Geocode API for UK postcodes at

http://ernestmarples.com/

To support the cause I created a Groovy client lib over lunchtime.