UKOLN Dev » Emma Tonkin http://blogs.ukoln.ac.uk/ukolndev Developer Labs Mon, 16 Dec 2013 00:09:02 +0000 en-US hourly 1 http://wordpress.org/?v=3.5.2 All change http://blogs.ukoln.ac.uk/ukolndev/2013/12/16/all-change/?utm_source=rss&utm_medium=rss&utm_campaign=all-change http://blogs.ukoln.ac.uk/ukolndev/2013/12/16/all-change/#comments Sun, 15 Dec 2013 23:58:41 +0000 Emma Tonkin http://blogs.ukoln.ac.uk/ukolndev/?p=1792 This blog and most other UKOLN sites have been flatfiled – reduced to plain old HTML+CSS+a bit of JavaScript. This is an intentional move to reduce the cost and complexity to the University of Bath of keeping the sites online after cessation of funding.

See emmatonkin.com for future updates and for a searchable version of this blog.

It remains only for me to thank the many talented students who have worked here over the years whilst studying for undergraduate degrees, masters’ degrees or PhDs. It has been a pleasure and an honour.

Image credit: http://www.flickr.com/photos/kclama/5440382102/

]]>
http://blogs.ukoln.ac.uk/ukolndev/2013/12/16/all-change/feed/ 0
Getting MTP devices to work on Linux: Nook HD(+) http://blogs.ukoln.ac.uk/ukolndev/2013/06/05/getting-mtp-devices-to-work-on-linux-nook-hd/?utm_source=rss&utm_medium=rss&utm_campaign=getting-mtp-devices-to-work-on-linux-nook-hd http://blogs.ukoln.ac.uk/ukolndev/2013/06/05/getting-mtp-devices-to-work-on-linux-nook-hd/#comments Tue, 04 Jun 2013 23:10:43 +0000 Emma Tonkin http://blogs.ukoln.ac.uk/ukolndev/?p=1786 Android devices typically require you to use MTP to read and write files, instead of using USB mass storage. Wondering why? A lot of other people have wondered the same thing. This post (from here, the XDA developer forum) provides an explanation:

“MTP is a big improvement over USB mass storage — for devices with lots of internal memory, a manufacturer no longer needs to come up with some hard partition between the USB mass storage and internal storage. Instead, they are all in one partition, with MTP providing access to the directory of media files that would normally be available through USB mass storage. This means there is no longer a need for apps on SD card for such devices, because what used to be the ‘internal SD card’ is in the same partition as where applications are stored. The storage on your device can be used for either applications or media, depending on what you want to put on it. You aren’t stuck with how much space the manufacturer decided to leave for the two areas.[...Also,] this means that the media storage doesn’t need to be unmounted from Android when it is being accessed through the PC”

Problem is, Linux MTP is a little problematic.  For example, the Nook I bought recently doesn’t work out of the box on my Slackware-current install despite having the latest libmtp – the device turned out to be read-only. Initially I had to use ADB to copy files onto it, but we found a simple solution. If your MTP devices turn out to be read-only on Linux, then there’s a strong possibility that the problem is with libMTP. Specifically, the devices may need to be listed in this file – music-players.h.  For this you need the vendor number and the device ID. To get these, plug the device in via USB and type ‘lsusb’. Find the relevant line:

Bus 001 Device 036: ID 2080:0006 Barnes & Noble

The first of those (2080) is the vendor ID. The second is the device ID. Adding these to libmtp and recompiling resolved the Nook HD issue for me; maybe it will work for you too. Pretty soon libmtp will contain these devices as standard (the HD+ is already in there), but then there’ll be another crop of Android devices with similar MTP problems around in  a minute, so it’s worth remembering the trick anyway.

]]>
http://blogs.ukoln.ac.uk/ukolndev/2013/06/05/getting-mtp-devices-to-work-on-linux-nook-hd/feed/ 0
Installation notes on ipython-notebook http://blogs.ukoln.ac.uk/ukolndev/2013/04/04/installation-notes-on-ipython-notebook/?utm_source=rss&utm_medium=rss&utm_campaign=installation-notes-on-ipython-notebook http://blogs.ukoln.ac.uk/ukolndev/2013/04/04/installation-notes-on-ipython-notebook/#comments Thu, 04 Apr 2013 08:40:11 +0000 Emma Tonkin http://blogs.ukoln.ac.uk/ukolndev/?p=1777 ipython-notebook is a nice piece of kit, a sort of user-friendly pocket web interface slash gui for mucking around with Python. According to the official site, it’s “a web-based interactive computational environment where you can combine code execution, text, mathematics, plots and rich media into a single document”. More introductory information is available here (along with some very pretty screenshots).

I like the idea of it, not so much for development work but for data analysis and worked demonstration. For something to share it certainly beats a command-line session.

It looks rather like this:

python-notebook

I encountered it during an e-Humanities workshop yesterday and I’m already itching to play with it again.

Getting it to install on Slackware involved a few steps. There are probably better ways, but here’s how I did it, based more or less on http://raj.blog.archive.org/2012/02/02/installing-ipython-notebook-to-replace-matlab/:

Step 0: optional. Open sbopkg as root. Search for and install python3. Version 2.6 works with the ipython-notebook but 3 likes sets and UTF8 better.
Step 1: curl -O http://python-distribute.org/distribute_setup.py
Step 2: sudo python distribute_setup.py
Step 3: easy_install pip
Step 4: Now that you have pip, you can follow the latter part of the blog post above:

Open sbopkg as root. Search for and install zeromq.

For the moment, install libpgm-5.1.116~dfsg from source (tar xvfz libpgm-5.1.116~dfsg.tar.gz; ./configure; make; make install).

pip install ipython
pip install pyzmq
pip install tornado
pip install --upgrade ipython
pip install numpy
pip install matplotlib
Follow the configuration instructions described in the blog post.
]]>
http://blogs.ukoln.ac.uk/ukolndev/2013/04/04/installation-notes-on-ipython-notebook/feed/ 0
PIMMS workshop, Bristol: Web engineering for research data management http://blogs.ukoln.ac.uk/ukolndev/2013/02/14/pimms-workshop-bristol/?utm_source=rss&utm_medium=rss&utm_campaign=pimms-workshop-bristol http://blogs.ukoln.ac.uk/ukolndev/2013/02/14/pimms-workshop-bristol/#comments Thu, 14 Feb 2013 17:12:01 +0000 Emma Tonkin http://blogs.ukoln.ac.uk/ukolndev/?p=1762 I’m attending the PIMMS (Portable Infrastructure for Metafor Metadata System) workshop today, in an anonymous office off Bristol’s Berkeley Square where, unusually, the sun is shining and the room is warm. The Metafor project referenced in the PIMMS acronym is all about metadata for climate data, so the weather is on everybody’s minds today. It’s a slightly cosier meeting than expected, because it turns out that there’s a huge conference on climate science simulation currently taking place somewhere in India and relatively few people have been able to resist its siren call.

PIMMS is a software stack designed to support the development and collection of metadata. Initially, it was developed to “document the provenance of computer simulations of real world earth system processes”[*], but as is traditional for almost any infrastructure designed to support different types of experiment, the thought has occurred that the approach may be more broadly generalisable. It’s designed to allow for direct user (=scientist) involvement and the platform consists of, essentially, a sequence of stages of form-filling and design  processes, each of which fulfil a purpose:

  • ‘experiment’-level description documents (at a high level, describing an overall scientific investigation in an area) – these include information such as description, author, rationale and so on and are encoded into CIM documents
  • ensemble-level descriptions (datasets, versus individual data files, although as is so often true with collection-level metadata, opinions may vary on how this works in any given context).
  • run-level descriptions: detailed component – based descriptions of individual experimental runs or even sessions.

Unusually and rather charmingly, PIMMS uses mindmapping as a design tool, viewing it as accessible to users. Whilst PIMMS clearly contains elements of the thinking that underlies UML-based design and uses UML vocabulary and tools in places, UML is ‘useful within a development team’, says Charlotte Pascoe, the PIMMS project manager, but it is not meant for end-users.

PIMMS counts among its potential benefits an increase in sheer quantity, quality and consistency of metadata provided. The underlying methods and processes can, in theory at least, also be generalised. A mindmap could be built for any domain, parsed into a formal data structure, automagically built or compiled into a web form and applied on your metadata. The process for building a PIMMS form goes more or less as follows.

  1. Get someone to install a copy of the PIMMS infrastructure (software stack) for you, or indeed do it yourself.
  2. Work out what you are trying to achieve. Write an introductory explanation, and export it to XML.
  3. Identify and invite along stakeholders.
  4. Invite them to build a visual representation (a mindmap) of a domain with you.
  5. Press ‘Go’ and generate a web form suitable for input of metadata.

If this sounds somewhat familiar, folks, it is because the concepts underlying PIMMS have a long and honourable background in software engineering. Check out the Web Semantics Design Method (De Troyer et al, 2008), which specifies the following process for engineering a web application – my own comments in parentheses to the right:

  1. Mission statement (what, when you get down to it, are you trying to achieve?)
  2. Audience modeling (for whom?)
  3. Conceptual design (with what? about what? doing what?)
  4. Implementation design (using what?)
  5. Implementation (Well, what are you waiting for? Go on, do it.)

WSDM, as described here, owes much to the waterfall model of software engineering (although, one would assume, there is nothing stopping subsequent iteration through phases) – see for example Ochoa et al (2006). To my eyes, the PIMMS metadata development process would appear to implement about half of WSDM in a less analytical and more user-centric model, encouraging direct input from the scientists likely to use the data.

The distinction, primarily, is in the implementation design and implementation phase; the PIMMS infrastructure compiles your conceptual design/structure, as represented in the mind map you have developed, into an XML structure from which PIMMS can build user-facing forms. After that compilation phase, further implementation work is essentially cosmetic, presentational work such as skinning the form. PIMMS removes the majority of implementation decisions from the user by making them in advance. Much as SurveyMonkey consciously limits the user’s design vocabulary to elements that may be useful for your average survey, PIMMS essentially offers a constrained vocabulary of information types and widgets.

I don’t make the comparison between PIMMS and SurveyMonkey lightly. The PIMMS project itself uses the terminology of ‘questionnaires’. PIMMS-based forms have a lot in common with SurveyMonkey, too;  incrementally developing the form whilst still retaining your previously collected data is not a straightforward operation. That may be a good thing – that way, you know which version of the input questionnaire your data came from – but on the other hand, incremental tinkering can sometimes be a useful design approach too…

The day continues. The sun subsides and the room is cooling fast. The geographers in the room, climate modellers of anything from the Jurassic to the Quaternary, go through a worked example of developing a PIMMS questionnaire. They discover a minor problem: the dates in the PIMMS forms don’t represent the usage of dates in palaeoclimate research, which are measured in ‘ka’ – thousands of years. This is a problem inherited from the UM, the Met. Office Unified Model [numerical modelling system].

Faster than you could say ‘Precambrian’, we are out of time. There has not been a chance to view the generated metadata collection form in use, which I regret slightly as it is the most common scenario in which the attendees will work with the system. Still, it was a worthwhile day. Workshop attendees  have voiced an interest in working with the software in future. As for me, after this glimpse into the future of palaeoclimate data management, I find myself thinking back to my past life in web engineering. I wonder whether, like  palaeoclimatologists, research data managers  could develop their expectations of the future by exploring the literature of times past…

De Troyer, O.,  Casteleyn, S.  and Plessers, P. (2008). WSDM: Web Semantics Design Method. In: Rossi et al (eds.), Web Engineering: Modeling and Implementing Web Applications. [see http://wise.vub.ac.be/Downloads/Courses/DesignMethods/WSDMChapter.pdf]

Sergio F. Ochoa, José A. Pino, Luis A. Guerrero, César A. Collazos (2006). SSP: A Simple Software Process for Small-Size Software Development Projects. IFIP Workshop on Advanced Software Engineering 2006: 94-107

 

]]>
http://blogs.ukoln.ac.uk/ukolndev/2013/02/14/pimms-workshop-bristol/feed/ 0
Streaming video with VLC http://blogs.ukoln.ac.uk/ukolndev/2012/07/12/streaming-video-with-vlc/?utm_source=rss&utm_medium=rss&utm_campaign=streaming-video-with-vlc http://blogs.ukoln.ac.uk/ukolndev/2012/07/12/streaming-video-with-vlc/#comments Thu, 12 Jul 2012 16:48:26 +0000 Emma Tonkin http://blogs.ukoln.ac.uk/ukolndev/?p=1722 Occasionally one wants to stream video for various reasons, whether it’s within the institutional network or a live feed from a conference venue. A few years ago Greg Tourte and I wrote a paper about the process of streaming video from a DV camera using FireWire, encoding into Ogg Theora/Vorbis, and transmitting the result to an audience via IceCast. For no adequately explored reason I have found myself playing with VLC’s inbuilt streaming methods for various purposes over the last week or so, and since VLC isn’t especially well documented, I’ve put the results up here.

 

1)  Streaming video to an icecast server.

Once you have the icecast server set up this is actually shockingly easy to do. Set up a mountpoint on the server side, in your icecast.xml setup (/usr/local/etc/icecast.xml by default):

<mount>
<mount-name>/test.ogg</mount-name>
<username>myusername</username>
<password>mypassword</password>
<max-listeners>10</max-listeners>
<burst-size>65536</burst-size>
</mount>

for example.

Now, on the client side (which could be anything from Windows to Linux to MacOS, because VLC is cross-platform, but this example is Windows), try

C:\Users\Em>”c:\Program Files (x86)\VideoLAN\VLC\vlc.exe” “C:\Users\Public\Videos\My Video.wmv” –sout=#transcode{vcodec=theo,vb=800,scale=1,acodec=vorb,ab=128,channels=2,samplerate=44100}: std{access=shout,mux=ogg,dst=myusername:mypassword@myicecastserver.domain.com:port/test.ogg}

It should transcode on the fly into Ogg Vorbis/Theora and throw it at your icecast server. Viewers who go to myicecastserver.domain.com:port should be able to view it from there. Note that you can change various settings on the transcode process (for example scale=0.5, vb=400), so you can reduce the network bandwidth required, for example, but that paradoxically reducing some of these settings will actually increase the time taken for the transcoding process, so it can result in the transcode getting laggier than it was already.

Why transcode? Well, icecast only handles a limited format set. It’s really designed for audio data, not audiovisual. It’ll handle pretty well anything in an Ogg wrapper, though, and it is free. So if you want to stream video with Icecast, transcoding will probably be involved somewhere.

2)  Streaming from a DVD (previously recorded event)

One would expect this to be as simple as

“c:\Program Files (x86)\VideoLAN\VLC\vlc.exe” dvdsimple:///E:/#1

but as it happens this seldom works, and the reason is the reaction time. Icecast is contacted with a header as soon as the streaming process begins. If it takes too long to get the DVD spun up and begin the process of streaming, icecast simply times out on you, leaving an error message along the lines of ‘ WARN source/get_next_buffer Disconnecting source due to socket timeout’.

Having tested this on various platforms, I find that the following string: “vlc dvdsimple:///dev/dvd –sout=’#transcode{vcodec=theo,vb=200,scale=0.4,theora-quality=10,fps=12,acodec=vorb,ab=48,channels=2}:std{access=shout,mux=ogg,dst=username:password@myicecastserver.domain.com:port/destination.ogg}’ –sout-transcode-audio-sync –sout-transcode-deinterlace” works very well in some cases. Apparently the DVD drive I first tested this with is just unusually slow. This DVD, being homegrown, doesn’t require libdvdcss to view/transcode.

3) Streaming with ffmpeg2theora

Bit of a Linux solution, this one. Install libvpx, libkate, scons and ffmpeg (all available as Slackbuilds for those who are that way inclined).  Install ffmpeg2theora. Install libshout and oggfwd.

Then: try a command line along the lines of the following:

ffmpeg2theora /source/material/in/ffmpeg/readable/format.ext -F 16 -x 240 -c 1 -A 32 –speedlevel 2 -o /dev/stdout -  | oggfwd myicecastserver.domain.com server_port password /test2.ogg

Obviously the output of this is not exactly high-quality; it’s been resized to a width of 240 pixels, audio has been reduced in quality, framerate’s been reduced to 16. But all these configuration options can be played with. Here’s a useful help page: http://commons.wikimedia.org/wiki/Help:Converting_video/ffmpeg2theora

Having called this a Linux solution, it’s worth pointing out that ffmpeg2theora is available for Windows (http://v2v.cc/~j/ffmpeg2theora/download.html) and that oggfwd/ezstream (http://www.icecast.org/ezstream.php/) have been used successfully on Windows as well. It’s also worth noting that, again, VLC can do the ogg/theora encoding too (and has done since 2006)- it’s just a question of seeing what’s better optimised for your purpose on your platform.

Note also that in this instance no username is needed, and the password used in this case is that set in the ‘<source-password>’ directive in icecast.xml.

4)  Streaming without icecast

Icecast is a useful default solution if you want to broadcast your event/recording to multiple people across the web. It’s also useful because, operating via HTTP, it doesn’t suffer from the sort of firewall/router problems that UDP-based video streaming, for example, typically encounters. On the other hand, if you’re streaming across a local LAN (for example, into the next room), there’s (usually) no network border police to get in your way — and VLC does also offer a direct VLC-to-VLC HTTP-based streaming solution. Unlike Icecast, though, it’s not ideal for one-to-many broadcast.

The Videolan documentation has a graphical explanation of this setup: http://www.videolan.org/doc/streaming-howto/en/ch02.html

 

5) Mixing video for streaming

An obvious application to test in this context is FreeJ. Sadly it’s a bit of a pain to compile as it doesn’t seem to have been touched for a while. You’ll need to use the following approach for configuring the code:

CXXFLAGS=-D__STDC_CONSTANT_MACROS  ./configure –enable-python –enable-perl –enable-java –disable-qt-ui

Typing ‘make’ will result in : error: ‘snprintf’ was not declared in this scope. Add #include <stdio.h> to any files afflicted in this way.

You then come across a crop of errors resulting from changes in recent ffmpeg. Some of these can be resolved with a patch, the rest, you’re better off going to the git repository rather than trying a stable version.

In principle you probably want to enable-qt-gui, but since it doesn’t currently compile I have left it as an exercise for some other day.

And once you have FreeJ working, you need to read the tutorial. Note this advice regarding addition of an audio track to FreeJ output.

 

 

]]>
http://blogs.ukoln.ac.uk/ukolndev/2012/07/12/streaming-video-with-vlc/feed/ 0
HCI in the Chemistry Lab http://blogs.ukoln.ac.uk/ukolndev/2012/03/01/hci-in-the-chemistry-lab/?utm_source=rss&utm_medium=rss&utm_campaign=hci-in-the-chemistry-lab http://blogs.ukoln.ac.uk/ukolndev/2012/03/01/hci-in-the-chemistry-lab/#comments Thu, 01 Mar 2012 13:53:50 +0000 Emma Tonkin http://blogs.ukoln.ac.uk/ukolndev/?p=1603 As part of the Smart Online Framework (SRF) project, today saw the first of several sessions geared to usability analysis of Southampton’s LabTrove software in the laboratory.

 

]]>
http://blogs.ukoln.ac.uk/ukolndev/2012/03/01/hci-in-the-chemistry-lab/feed/ 0
Detecting motion: DLP-TILT 2-axis accelerometer http://blogs.ukoln.ac.uk/ukolndev/2011/12/15/detecting-motion-dlp-tilt-2-axis-accelerometer/?utm_source=rss&utm_medium=rss&utm_campaign=detecting-motion-dlp-tilt-2-axis-accelerometer http://blogs.ukoln.ac.uk/ukolndev/2011/12/15/detecting-motion-dlp-tilt-2-axis-accelerometer/#comments Thu, 15 Dec 2011 18:04:35 +0000 Emma Tonkin http://blogs.ukoln.ac.uk/ukolndev/?p=1266 Using an accelerometer to assess musculoskeletal stresses

Accelerometers are helpful for characterising device usage and detecting the mode of use. Most of these devices have an internal accelerometer, but it is convenient for our purposes to use an external device (requires less programming and does not require a jailbroken device).

Setup

In order to use this device, you must first set up the serial port with a line like the following:

stty -F /dev/ttyUSB0 raw ispeed 38400 ospeed 38400 cs8 -ignpar -cstopb -echo

Code

The code probably won’t tell you all that much, but here’s one way to make your life much easier: assuming you’re running this on Linux, set your device ID as /dev/dlptilt, then change the line ‘/dev/ttyUSB0′ to read ‘/dev/dlptilt’ in the code before compiling.

#include
#include
#include
#include
#include
#include
#include
#include 

#define BAUDRATE B38400
#define MODEMDEVICE "/dev/ttyS1"
#define _POSIX_SOURCE 1         //POSIX compliant source
#define FALSE 0
#define TRUE 1
#define DEBUG 0

volatile int STOP=FALSE;

void signal_handler_IO (int status);    //definition of signal handler
int wait_flag=TRUE;                     //TRUE while no signal received
char devicename[80];
long Baud_Rate = 38400;         // default Baud Rate (110 through 38400)
long BAUD;                      // derived baud rate from command line
long DATABITS;
long STOPBITS;
long PARITYON;
long PARITY;
int Data_Bits = 8;              // Number of data bits
int Stop_Bits = 1;              // Number of stop bits
int Parity = 0;                 // Parity as follows:
                  // 00 = NONE, 01 = Odd, 02 = Even, 03 = Mark, 04 = Space
int Format = 4;
FILE *input;
FILE *output;
int status;

main(int Parm_Count, char *Parms[])
{

   int fd, tty, c, res, i, error;
   char In1, Key;
   struct termios oldtio, newtio;
   struct termios oldkey, newkey;
   struct sigaction saio;
   char buf[255];
   char message[90];

   // set device name here
   strcpy(devicename,"/dev/ttyUSB0"); 

   newkey.c_cflag = BAUDRATE | CRTSCTS | CS8 | CLOCAL | CREAD;
   newkey.c_iflag = IGNPAR;
   newkey.c_oflag = 0;
   newkey.c_lflag = 0;
   newkey.c_cc[VMIN]=1;
   newkey.c_cc[VTIME]=0;
   BAUD=38400;
   DATABITS=CS8;
   STOPBITS=CSTOPB;
   PARITYON=0;
   PARITY=0;
   fd = open(devicename, O_RDWR | O_NOCTTY | O_NONBLOCK);
   if (fd < 0)
   {
   	perror(devicename);
   	exit(-1);
   }

   saio.sa_handler = signal_handler_IO;
   sigemptyset(&saio.sa_mask);
   saio.sa_flags = 0;
   saio.sa_restorer = NULL;
   sigaction(SIGIO,&saio,NULL);

   fcntl(fd, F_SETOWN, getpid());
   fcntl(fd, F_SETFL, FASYNC);

   tcgetattr(fd,&oldtio);
   newtio.c_cflag = BAUD | CRTSCTS | DATABITS | STOPBITS | PARITYON | PARITY | CLOCAL | CREAD;
   newtio.c_iflag = IGNPAR;
   newtio.c_oflag = 0;
   newtio.c_lflag = 0;
   newtio.c_cc[VMIN]=1;
   newtio.c_cc[VTIME]=0;
   tcflush(fd, TCIFLUSH);
   tcsetattr(fd,TCSANOW,&newtio);
   write(fd,"T",1);
   while (STOP==FALSE) {
       status=1;
       if (status==1) // so redundant...
		{
	if(DEBUG){
   		write(fd,"P",1);
		printf("Printed P\n");
	} else {
		// 7 - single a d conversion to host on current settings
		// z 3 bytes (both channels x and y of accelerometer)
		// s - 7 bytes (all 7 channels)
		// 8 - streaming a/d conversion data using current settings
   		write(fd,"z",1);
	}
	} 

         if (wait_flag==FALSE)  //if output is available
	{
		res = read(fd,buf,255);
		if (res>0)
		{

			// Print serial output
			for (i=0; i
]]>
http://blogs.ukoln.ac.uk/ukolndev/2011/12/15/detecting-motion-dlp-tilt-2-axis-accelerometer/feed/ 0
Blink detection and attention evaluation: the NeuroSky MindWave http://blogs.ukoln.ac.uk/ukolndev/2011/12/14/blink-detection-and-attention-evaluation-the-neurosky-mindwave/?utm_source=rss&utm_medium=rss&utm_campaign=blink-detection-and-attention-evaluation-the-neurosky-mindwave http://blogs.ukoln.ac.uk/ukolndev/2011/12/14/blink-detection-and-attention-evaluation-the-neurosky-mindwave/#comments Tue, 13 Dec 2011 23:00:13 +0000 Emma Tonkin http://blogs.ukoln.ac.uk/ukolndev/?p=1238 Hardware for UX evaluation

As part of Project Sunflower, we took various approaches to interface evaluation. Alongside heuristic evaluation, walkthroughs and so forth, we also used various bits of hardware to support trials. This post describes setup and sample code for the NeuroSky MindWave, an inexpensive BCI (brain-computer interface – think ‘electroencephalogram’, or ‘brain wave monitoring’) that uses a single sensor placed on the forehead to measure eye blinks, ‘attention’ and ‘meditation’. These two latter variables shouldn’t be taken at (scuse the pun) face value; according to a report by Travis Ross, they’re based on a proprietary algorithm, with attention reported to relate to beta waves, hence linked to wakefulness/focus, and meditation linked to alpha waves – level of calm. Vague, admittedly, but then these devices are priced for and in large part targeted at the consumer market. If you’ve ever seen those Mattel Jedi force-trainer toys, those are based around the same technology.

Setup

Having installed the software prerequisites and drivers, the next thing is to run the Thinkgear Connector. This is an extremely helpful little piece of kit, which listens to the USB radio link and makes the sensor data available to applications. This reduces the connection step to a couple of lines of code. Since the Thinkgear Connector will return JSON upon request, the data packets are easy to parse.

Code

import sys
import json
import time
from telnetlib import Telnet

tn=Telnet('localhost',13854);
start=time.clock();

i=0;
# app registration step (in this instance unnecessary)
# tn.write('{"appName": "Example", "appKey": "9f54141b4b4c567c558d3a76cb8d715cbde03096"}');
tn.write('{"enableRawOutput": true, "format": "Json"}');

outfile="null";
if len(sys.argv)>1:
        outfile=sys.argv[len(sys.argv)-1];
        outfptr=open(outfile,'w');

# default values
eSenseDict={'attention':0, 'meditation':0};
waveDict={'lowGamma':0, 'highGamma':0, 'highAlpha':0, 'delta':0, 'highBeta':0, 'lowAlpha':0, 'lowBeta':0, 'theta':0};
signalLevel=0;

while i

Example output

The code as written above produces very simple CSV output, which has the benefit of being very easy to plot using something like Gnuplot:

plot "test-output.log" using 1:3 with lines, "" using 1:4 with lines, "" using 1:5 with lines

Graph of three variables: working on a language problem.

Some sensor data captured: subject was working on a language problem. Red

Sensor data. Activity: Watching TV

Sensor data captured: individual was watching TV. Red

Note: the number of blinks captured is low enough that the chances are that the MindWave is not picking up all blink events.

]]>
http://blogs.ukoln.ac.uk/ukolndev/2011/12/14/blink-detection-and-attention-evaluation-the-neurosky-mindwave/feed/ 0
Ebook reader basics: file transfer via USB http://blogs.ukoln.ac.uk/ukolndev/2011/12/03/the-basics-does-it-work-when-you-plug-it-in/?utm_source=rss&utm_medium=rss&utm_campaign=the-basics-does-it-work-when-you-plug-it-in http://blogs.ukoln.ac.uk/ukolndev/2011/12/03/the-basics-does-it-work-when-you-plug-it-in/#comments Sat, 03 Dec 2011 20:18:29 +0000 Emma Tonkin http://blogs.ukoln.ac.uk/ukolndev/?p=1214 We covered some of the basics of these devices in an earlier series of posts, but it might be worth taking a few minutes to focus on the most basic behaviour of the lot: getting data onto the devices from a laptop. One might expect that all of these devices would operate as USB mass storage devices (plug it in and copy files on). As anybody who’s ever tried to copy data off an iPod knows, nothing could be further from the truth.

Assumptions used here: the task is to copy non-DRM’d ebook files onto an ebook reader.

Sony PRS-600, Hanvon n510, etc.

Like most of your basic e-Ink devices the Sony and its type are ridiculously straightforward to use, if a little slow, as long as you are familiar with copying files using a file manager. These devices function as USB mass storage devices. Plug it in, copy files, unplug it and (in the case of the Sony) wait for it to reindex pretty much the entire filesystem, including files that have been on the ebook reader for months. Don’t keep too many files on the Sony, or you’ll run out of battery life before you ever read a page – the indexing is the most power-hungry step it takes. The Hanvon doesn’t bother with exhaustive indexing, which saves time and battery life here but means that it doesn’t offer the same search functionality.

Filesystem speed stats were generated using:

rsync -auvh --progress --stats --no-o --no-g --no-p /some/files .

We ran this on Linux in each case, in order to ensure that there weren’t any confounding factors such as Spotlight indexing.

Results:  Hanvon N510: 2.34M bytes/sec

Kindle

The Mac recognises the Kindle as a USB drive, and allows you to copy items directly onto it (.pdf or .mobi – convert using Calibre if required). It’s not all plain sailing, though; the Kindle tends to place items imported in this way into a menu section entitled ‘items not yet indexed’. When this happens, it seems that you may need to reset the Kindle (hold the sleep button for 20 seconds), at which point it will reindex on startup.

File transfer rates: 1.87M bytes/sec
We found the Kindle’s file transfer rates to be unusually slow.

Xoom

The Xoom is a somewhat frustrating device. It’s using a driver called MPT (Motorola Phone Tools). Seems this is standard to Android devices, instead of SCSI-like hard drive/mass storage, so we’ll all have to get used to it… Google’s explanation for this decision may be found on this blog post: in short, MPT is seen as an improvement on USB mass storage because

‘for devices with lots of internal memory, a manufacturer no longer needs to come up with some hard partition between the USB mass storage and internal storage. Instead, they are all in one partition, with MTP providing access to the directory of media files that would normally be available through USB mass storage. This means there is no longer a need for apps on SD card for such devices, because what used to be the ‘internal SD card’ is in the same partition as where applications are stored. The storage on your device can be used for either applications or media, depending on what you want to put on it. You aren’t stuck with how much space the manufacturer decided to leave for the two areas. Also, this means that the media storage doesn’t need to be unmounted from Android when it is being access[ed] through the PC.’

On Windows, once the appropriate drivers are installed, it can be treated like a standard storage device – you can simply drag and drop files. On the Mac you’ll need to download the Android File Transfer software, which will allow you to drag and drop files in either direction, plus or minus the occasional bug.  On Linux, you can mount it through MPT using mptfs, a fusion driver for MPT drives. GNOME users will probably find that this happens automatically. The rest of us just do mptfs -o allow_other mountpoint. Android File Transfer on a Mac feels rather slow, but our test on Linux (see data below) suggests that mptfs is not unreasonably slow.

File transfer rates:
mptfs on Linux (calculated as above): 4.59M bytes/sec
Compare this to a similar test of an HP USB2 16GB USB drive: 7.66M bytes/sec

iPad

The iPad was clear winner of the ‘least cooperative’ award in this category. iDevices don’t show up in the filesystem by default. The traditional mechanism used to get files onto the device involves iTunes. This music software has been adapted after the fact for use as an ebook organiser, and its origins are still clearly visible. The results are indifferent: the right-click context menu in the ‘Books’ pane, for example, invites you to ‘download album artwork’. Using this approach, getting files onto your iPad is a multi-step process; download files, import them into iTunes, sync with iPad.

Right-click context menu for ebooks (iTunes screenshot)

Right-click context menu for ebooks (iTunes)

iTunes is the Vegemite of the tablet user; you either love it or hate it. Unless iTunes is a big part of your ebook-reading life already, it becomes an irritant, dragging out the file copy process unnecessarily. The OPDS approach is simpler, if all you want to do is get your files onto the iPad: just download them directly onto the iPad itself.

File transfer rates:
cannot be compared directly.

]]>
http://blogs.ukoln.ac.uk/ukolndev/2011/12/03/the-basics-does-it-work-when-you-plug-it-in/feed/ 0
OPDS: building an ebook catalogue http://blogs.ukoln.ac.uk/ukolndev/2011/12/03/opds-building-an-ebook-catalogue/?utm_source=rss&utm_medium=rss&utm_campaign=opds-building-an-ebook-catalogue http://blogs.ukoln.ac.uk/ukolndev/2011/12/03/opds-building-an-ebook-catalogue/#comments Sat, 03 Dec 2011 20:00:08 +0000 Emma Tonkin http://blogs.ukoln.ac.uk/ukolndev/?p=1195 This is part of a series wrapping up (belatedly, alas) the findings from Project Sunflower. As the protagonists of the Project have moved on to pastures new, leaving their notes behind, editorial duty has fallen to yours truly.

In this post, we look at OPDS, otherwise known as ‘Open Publication Distribution System’, and why it’s worth a look for anybody intending to integrate ebook platforms into the student experience. For anybody who’d rather skip ahead, version 1.1 of the standard can be found right here.

OPDS is, according to the specification, designed as

a syndication format for electronic publications based on Atom and HTTP

and can

enable the aggregation, distribution, discovery, and acquisition of electronic publications

using

existing or emergent open standards and conventions, with a priority on simplicity.

Now, as we will see from reviewing the performance of typical embedded ebook search/indexing functions and interfaces, most ebook readers aren’t designed to contain huge numbers of ebooks. At 7.99 an ebook, most readers will be cautious in their acquisitions, so perhaps the perception from some manufacturers is that it is pointless to create readers that specialise in navigating across hundreds of thousands of files. Many portable media devices suffer from similar difficulties – the classic ‘clickwheel’ interface on iPods, as applied to a large number of files, became the subject of a 2009 satirical report by The Onion.

The relevance of OPDS is the following: OPDS allows you to search and browse across extensive collections of documents. They don’t need to be books; an OPDS frontend on an institutional repository is perfectly achievable, format conversion notwithstanding. The obvious use case is searching or browsing for a single file, but part of the relevance of OPDS is the fact that it also allows for batch mode: a student downloading the full reading list for the semester, for example. Wouldn’t that be convenient?

An OPDS catalogue is fairly straightforward to set up. For prototyping purposes, the well-known ebook software Calibre can be used to experiment with the concept; it can be found in the Calibre software under Preferences->Network->Sharing over the net, and is referred to as a ‘Content Server’. If you’d rather experiment with a static OPDS catalogue — providing no search function, but with browse functions that make full use of your metadata — consider trying calibre2opds, a Java application that renders your Calibre catalogue as a set of static HTML pages and, being simpler and more secure (by dint of having very few moving parts), may be considered a relatively secure way of deploying a prototype. A comparison of these alternatives may be found here.

Cross-platform compatibility: Limited.

Android and the iPad approach this on a per-application basis, and a good implementation is available for both. iBooks won’t handle the catalogue functionality, but you can manually type the address into Safari; then, when you click on an ePub file, iBooks can handle the download. Alternatively, you can use Stanza, which works well – but when iOS 5 came out, we discovered that Stanza ceased to work until we updated the iPad to the latest version, so be prepared for sudden failures around the time of iOS upgrades.

The Kindle is able to use OPDS catalogues, but requires them to run on port 80 (the usual port for a web server, admittedly, but not Calibre’s preferred choice for practical reasons). Simpler e-Ink devices mostly still do not have any mechanism for connecting to the Web, and therefore this sort of functionality is not available on the platform itself, so desktop software must be used instead.

Ease of setup: Moderate.

Getting a Calibre content-server running on a home network is relatively easy provided that the user is familiar with terms like ‘IP address’. However, practical implementation on a larger scale requires significantly more thought; not only are there security and sustainability issues around the software, but the usability of the resulting catalogue is very dependent on good metadata.

Benefits

Standard, relatively simple to set up, and extremely liberating – a convenient distribution channel, bypassing the need to centralise via a commercial vendor, what’s not to like?

Disadvantages

Support for OPDS is patchy and the standard is still relatively recent. Many popular ebook reader applications do not support it explicitly. Fortunately, it’s so near to popular standards that all you really need is a web browser and an ebook reader to get some benefit from an OPDS.

Sample screenshots

Browse by tag screenshot

Browsing the Calibre content server by tag

 

Browse by author screenshot

Browse by author

]]>
http://blogs.ukoln.ac.uk/ukolndev/2011/12/03/opds-building-an-ebook-catalogue/feed/ 0