Treat with Jermolene

protective, soothing, anti-bacterial

Archive for the ‘development’ Category

Hacking VLC Media Player

with 2 comments

So, I’m at a Hothouse at BT’s Adastral Park campus, doing some work involving remote control of the VideoLan Media Player (aka VLC). VLC is an open source media player with support for a wide range of codecs, and with some fairly sophisticated features like stranscoding, streaming, and remote control via the integrated HTTP server. To use the latter, you need to start VLC with a special switch from the command line:

"/Applications/VLC.app/Contents/MacOS/VLC" --extraintf=http

Once you’ve done that, you’ll be able to interact with the player through this web interface:

http://localhost:8080/index.html

VLC Web Interface

The HTTP interface also permits VLC to be controlled with simple HTTP requests. For example:

curl -g "http://localhost:8080/requests/status.xml?command=pl_stop"
curl -g "http://localhost:8080/requests/status.xml?command=pl_play"

The HTTP interface also serves static web pages, and includes a fairly rich-but-unusual macro/templating system for creating dynamic pages like the remote control interface above.

UPDATE: More useful URIs

/requests/playlist.xml - Retrieve current playlist in XML format
/requests/status.xml?command=pl_empty - Clear current playlist
/requests/status.xml?command=in_enqueue&input=<uri> - Add URI to playlist (example)
/requests/status.xml?command=in_play&input=<uri> - Add URI to playlist and start playing

Written by jermolene

July 8, 2009 at 4:45 pm

Posted in bt, development, opensource

TabbedSinglePageMode for TiddlyWiki

with 6 comments

SinglePageMode” is a typically neat little TiddlyWiki plugin created by Eric Shulman. It restores the more conventional wiki behaviour of having a single page open at once, so that clicking on a link replaces the current page, rather than inserting it below, as TiddlyWiki usually does.

Eric’s plugin has been deservedly highly popular. It seems that for a significant proportion of situations/users, the default TiddlyWiki behaviour of having multiple tiddlers at once is just too complicated. Having a community plugin to ‘fix’ this is a great solution, allowing TiddlyWiki users to choose which behaviour they prefer.

But, from an interface perspective, one of the things I find troubling about the current implementation of SinglePageMode is that it rather takes away the whole point of TiddlyWiki: after all, it started out as an experiment in having multiple wiki pages at once, with a view to making it easier to refactor content between pages. It’s also frustrating to have to have two separate modes of operation, with slightly inconsistent behaviour.

I’ve given quite a lot of thought to how one might somehow unify these two modes, to give the clarity of single page mode without giving up on the ability to quickly flick between multiple open tiddlers. I just came across some sketches buried in an old virtual machine from 2006 that show one approach that still looks like it might be interesting.

When a single tiddler is displayed, it looks much like an ordinary TiddlyWiki screen:

with a single tiddler open

When a tiddler link is clicked on, the new tiddler opens in front of the previous one, building up breadcrumbs as a sort of rolodex of tabs:

withbreadcrumbs

Then the idea was that by riffling the mouse over the breadcrumbs you’d get a popup that allowed you flick back and refer to an earlier tiddler:

hoverbreadcrumbs

I’m not sure why I drew the popup at a reduced size, I’m not sure that that’s a good idea. I’d also intended to draw a frame showing a similar popup when hovering over any tiddler link.

I took some care to try to make it possible to implement this design with minimal changes to the TiddlyWiki internal Story object, it should be possible to do most of the work with CSS. I was imagining that there might be an ‘expand’ button over near the breadcrumbs that floops the various tiddlers out to their fully expanded size, looking like an ordinary TiddlyWiki.

Although I never implemented this design, I’ve not stopped thinking about these issues, and am exploring some of them in Project Cecily.

UPDATE: There’s some further discussion on the TiddlyWiki developers group.

Written by jermolene

November 14, 2008 at 12:57 pm

Posted in development, tiddlywiki

iPhoneTiddlyWiki: Working Offline

with 3 comments

So, here at Osmosoft been lucky enough to have access to an iPhone to play with for the last few weeks. Our first discovery was that TiddlyWiki works just fine on the iPhone – apart from being excruciatingly slow. TiddlyWiki is so meaty you really feel the 20x speed difference between a MacBook Pro and an iPhone. Anyhow, I’m confident that we can slim TiddlyWiki down to the extent that it runs at a reasonable speed on these new portable slow AJAX devices. (If you try the leaner and meaner first version of TiddlyWiki on an iPhone, it’s a good deal snappier).

The other problem is that saving doesn’t work properly because the TiddlyWiki is being accessed via http. We can expect that TiddlyWiki adaptations that support serverside saving (like TiddlySpot) will work, but that doesn’t really speak to the TiddlyWiki vision of untethered access to the information that you need.

I quickly discovered a potential solution: the iPhone supports bookmarks whose URL is a data URI. The procedure is to use something like Hixie’s data: URI kitchen to encode a file (HTML, images or PDFs all seem to work fine; possibly Word and Excel Documents too) into a data: link. Then right-click on the link and select “add to bookmarks”. You’ll end up with a bookmark that starts something like this:

 data:text/html;base64,PCFET0NUWVBFIGh0bWwgUFVCTElDICItLy9XM0MvL0RURCBY....

When that bookmark is invoked, the base64 data is converted back into a binary file, which is then displayed by the browser – all without recourse to the Internet.

The really interesting thing is that Safari/iPhone support bookmarks of up to 32 megabytes or so, which suggested the possibility of embedding an entire TiddlyWiki in a bookmark. And, it turns out that it works — giving you offline read-only access to TiddlyWiki files on an iPhone.

Here are the steps to convert any TiddlyWiki to use offline on the iPhone

1. Locate the TiddlyWiki file you want to convert (it can be stored locally or on the internet)

2. Go to Hixie’s data: URI kitchen in Safari

3. Make sure the ‘base64’ checkbox is enabled

4. Either enter the URL of the TiddlyWiki file in the text box, or use the ‘Choose file’ button to select a local file

5. Click ‘Generate’

6. Wait; it can be quite slow to do the conversion with a big TiddlyWiki file

7. Right click on the resulting link and select ‘Add Link to Bookmarks…’

8. Go to iTunes and make sure that you’ve selected to sync your Safari bookmarks with the iPhone

9. Sync the iPhone

10. On the iPhone, select the bookmark

This is all still quite rough and ready; there’s still a bunch of work to do to get a first-class TiddlyWiki experience on the iPhone. In my next post I’ll be looking at optimising the TiddlyWiki user interface for the iPhone, to make it look and feel more like a native application.

Written by jermolene

September 13, 2007 at 1:38 pm

TiddlyWiki on IRC

with one comment

I’ve started regularly hanging out in the TiddlyWiki IRC channel. It’s an open chatroom that anyone can join; there’s half a dozen or so regulars, including FND and Saq, and several of my colleagues at Osmosoft.

The channel is called #tiddlywiki and it lives on the server irc.freenode.net.

IRC is quite old-school; there’s a bunch of different clients available for various platforms. I’m using something called Conversation for the Mac.

Written by jermolene

August 31, 2007 at 10:53 am

TiddlyGears

with one comment

So, Google have finally stopped hinting and gone and launched Gears:

Google Gears (BETA) is an open source browser extension that enables web applications to provide offline functionality using following JavaScript APIs:

  • Store and serve application resources locally
  • Store data locally in a fully-searchable relational database
  • Run asynchronous Javascript to improve application responsiveness

Which is marvellous stuff. Several people have pointed out that the requirement for a client side installation will slow down adoption. I’m not so sure; for quite a few people, the ability to work offline is plenty valuable enough to prompt them to install. And don’t underestimate the lengths that Google will go to to try to get their Google Pack on as many PCs as possible.

I’d very much like to experiment with using Gears as backend for TiddlyWiki; one thing I’m particularly curious about is whether offline applications are tied to the browser on which they were last used online.

Written by jermolene

June 1, 2007 at 8:37 am

Posted in development, tiddlywiki, web

TiddlyBookmarklets

with 6 comments

UPDATE: I’ve now published these bookmarklets to http://www.tiddlywiki.com/#TiddlyBookmarklets

So, I’ve been preparing for the release of TiddlyWiki 2.2 and have just run into a niggling little problem that’s ended up triggering something quite fun.

I’m at the point where I’m preparing the content for the new release, taking the existing tiddlywiki.com content, folding in the new beta documentation and making sure that everything is up to date and cross-references. The problem arises because the new release adds a “changecount” extended field to each tiddler. It tracks how many times that tiddler has been modified since it was created or received from a server. Our current build process will propagate an extended attribute like that all the way from me making some minor edit in my local copy of tiddlywiki.com up to publication on the internet. That’s a problem, because we should be distributing tiddlywiki.com with clean content, with no “changecount” field.

Various more or less terrible solutions occurred to me immediately:

  • Doing a search and replace in the final index.html file to remove all the “changecount” attributes just before publication
  • Modifying the build process to clear out the “changecount” attribute
  • Writing a new macro that presents a button that scrubs “changecount” attributes from every tiddler

The problems with these solutions being “tedium”, “not knowing Ruby” and “inappropriateness” respectively. Inappropriateness being that such a macro would have to form part of the standard distribution/build process, and yet it seems rather a hack that shouldn’t really be needed.

All of which led to the idea of using bookmarklets – the ultimate platform for hacks. A bookmarklet is a browser favourite or bookmark that has a “javascript:” URL containing executable code, instead of a normal “http:” URL. So, when you click on it, rather than navigating to a new page, it executes the JavaScript code – as if it were on the current page. That means that bookmarklets can reach into the internal structure of a page and do almost anything – including things like stripping “changecount” attributes. With most browsers you can pack enough code into the URL to do some quite useful things.

I knocked up a couple of proof of concept TiddlyBookmarklets to explore what can be done:

  • ScrubTiddlyFields – Strips out all the extended fields from a TiddlyWiki document, including that pesky “changecount” field
  • ScrubTiddlyShadows -Restores any overridden shadow tiddlers in the current TiddlyWiki document. Handy when you’ve gone mad with PageTemplate customisations and your TiddlyWiki document won’t display properly
  • TiddlyRescue – Strips out the raw content of a TiddlyWiki document and displays it in a new window. Handy when you’ve inadvertently been editing an online version of TiddlyWiki that isn’t letting you save changes in the usual way.

Here’s how to use them:

  1. Drag one of the links above straight into your browser links bar
  2. Alternatively, right-click on the links and select “Create favourite” or “Create bookmark”
  3. Navigate to a TiddlyWiki document such as http://www.tiddlywiki.com/
  4. Select your new bookmarklet to execute it

PS If you’re interested in writing your own bookmarklets, check out this excellent bookmarklet editor that simplifies packing in all that JavaScript, and some useful tips.

UPDATE: Looks like I don’t know enough about WordPress to make the bookmarklet links work properly (thanks Ace_NoOne). I’m fiddling about to try to get them working…

Written by jermolene

May 5, 2007 at 9:07 am

Posted in development, tiddlywiki

MiniWeb Rocks Hierarchically

with 2 comments

I’m late with this, but Dean Edwards: MiniWeb

MiniWeb models an entire web site in a single HTML page. All of the site files are stored in a JSON object which you can navigate with a UNIX-like shell or the system browser. It has a built-in templating system and has an approximate separation of client and server. It is in its infancy but is still kind of fun to play with. Parts of it are clearly unfinished but you will be able to get the idea.

This is rather glorious. Similar to TiddlyWiki, it’s an entire website in a single HTML page, but it takes a very different approach, packing a more or less conventional Unix file structure. Naturally I love anything that subverts the mainframe-isation of the web…

Written by jermolene

May 4, 2007 at 2:28 pm

Posted in development, web