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.

TiddlyWiki on IRC

August 31, 2007

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.

TiddlyGears

June 1, 2007

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.

TiddlyBookmarklets

May 5, 2007

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…

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…

I was kind of surprised and pleased to read that Silverlight is being launched on both Windows and OS X; it seemed like an excessively generous olive branch to the MacBook Pro-toting webdev cadre. Because in every other field Microsoft is happy to blithely presume that Mac users are a rounding error on their Windows-led cash cows.

And Silverlight does look well thought through. The video performance looks terrific, and the fact that it installs on IE without even requiring the browser to be restarted is undeniably attractive.

Cramming in an implementation of the .NET CLR is genius and yet defiantly 1996-era Microsoft; if you remember that far back, the first rollout of ActiveX controls in Internet Explorer 4 and Visual Basic 5 offered very similar functionality in terms of building rich applications within the browser. It was excellent fun building demos with that stuff, and I’m sure it’ll be even more thrilling with the benefit of Silverlight’s several orders of magnitude increased complexity.

But the brightest bit of Silverlight is still the video delivery, and I think it’s what will drive the adoption of the plugin. I’m wondering if Silverlight supports DRM; if so, perhaps it’s a way for the BBC’s iPlayer to make the leap to OS X quicker than we might otherwise expect.

Oh, and I wonder if Silverlight will work on the iPhone, too.

This is nice, potentially very nice indeed:

ADO.NET team blog : Project Codename “Astoria” - Announced at Mix 07

The goal of Microsoft Codename “Astoria” is to enable applications to expose data as a data service that can be consumed by web clients within a corporate network and across the internet. The data service is reachable over HTTP, and URIs are used to identify the various pieces of information available through the service. Interactions with the data service happens in terms of HTTP verbs such as GET, POST, PUT and DELETE, and the data exchanged in those interactions is represented in simple formats such as XML and JSON.

What I don’t get is why they don’t just say:

The goal of Microsoft “Astoria” is to expose ADO.NET data sources via a RESTful interface.

Anyhow, assuming that interpretation is correct, Astoria will make a nice bridge between TiddlyWiki, with it’s REST-friendly server adaptor architecture, and all that corporate data locked up in Microsoft Access and Microsoft SQL Server. More power to our corporate/public mashup elbows.