Udo's Techblog http://creativepark.net/ en-us HTML 5 SQL Tutorial - The Basics http://creativepark.net/http://creativepark.net/blog/entry/id/1191
Now, besides Cookies, there are three new offline capabilities of note: an application caching mechanism (including the option of declaring a self-contained applet using the manifest attribute), local object storage and local SQL databases. We're gonna be talking about the latter. Offline SQL is currently available in Safari, Google Chrome, on the iPhone and Palm's WebOS (both for its applications and browser-based content). As of now, Firefox 3.51 seems to have basic support, but its implementation is either nonstandard or so buggy as to be unusable.

Speaking of standards, there is no clear spec on the actual SQL dialect used for HTML 5. Instead SQLite is considered the reference implementation. That means if you got any questions about your actual SQL code, head on over to the SQLite site.

Accessing the local database

There is an easy way to test whether your environment supports HTML5 database:
if (window.openDatabase)
db = window.openDatabase("app", "", "my app db name", 1024*1024);
Now you can simply test if db is an object or not after this operation. If you got a database object back that means your browser has support built in and it successfully accessed your app's storage. Here's how it works:
window.openDatabase( DatabaseName, DatabaseVersion, DisplayName, EstimatedSize )
Be careful with the DatabaseVersion parameter though. If it's set and it doesn't match, the operation will fail. This gives you the opportunity to implement an upgrade mechanism but it can obviously also cause a lot of headache.

Executing queries

The database interface provides asynchronous access through a transaction paradigm:
transaction.executeSQL( SQLStatement, SQLParameters, ResultsetCallback, ErrorCallback )
...and this is how it looks in action:
db.transaction(function(tx) 
{
tx.executeSql('SELECT * FROM MyTable WHERE CategoryField = ?',
[ selectedCategory ],
function (tx, rs) { displayMyResult(rs); },
function (tx, err) { displayMyError(err); } );
});
This fetching example shows how to get data from the DB, or more generally: how to execute arbitrary SQL statements. In this example displayMyResult(rs) and displayMyError(err) are just placeholders for whatever you want to do with the result once it arrives.

That's pretty much it for the basics, now you can write your own offline app!]]>
Wed, 08 Sep 2010 10:35:42 America/Los_Angeles http://creativepark.net/blog/entry/id/1191
At the Apple store, wearing an "I'm a PC" shirt http://creativepark.net/http://creativepark.net/blog/entry/id/1190 A few days ago, when I came home I found that Nick Hodge from Microsoft Australia had sent me an "I'm a PC" t-shirt! Because I love geek clothing, and also because I had promised to actually wear it, next day I went to work purporting to be a PC. You know, the "I'm a PC" slogan is of course completely unknown in Germany, but at least I got a few smiles from nerdy tourists in downtown Frankfurt...

Anyway, my very very old G5 at work died that day. It had been on life support for a while, but after the power supply blew out, it was decided I should get a new workstation. Accounting said I could either order online or head over to the (Gravis) Apple store and get one right away. The store is just a few hundred meters down the pedestrian zone from our office and I always opt for instant gratification...

And thus it came to pass that Udo went to the Apple store wearing a Microsoft fan shirt! The Gravis store is completely staffed with 20-something geeks, and within minutes my shirt had drawn quite a following. Everybody was super nice and we exchanged friendly Microsoft- and Apple-related quips for quite a while as I bought my new Mac. Good times! The conversation in all its friendliness was completely ungerman (we're a hateful little country), and I left with warm fuzzy feelings. When it comes right down to it, we're all just software geeks - I like to think that all the zealous fanboys work in marketing ;-)

Any suggestion what I should do next? My immediate plans include wearing Jesus shirts at atheist conventions, ordering Israeli food at Arab restaurants and maybe requesting a new BMW at the Mercedes dealership.]]>
Wed, 08 Sep 2010 10:35:42 America/Los_Angeles http://creativepark.net/blog/entry/id/1190
Current HTML 5 SQL Spec http://creativepark.net/http://creativepark.net/blog/entry/id/1189 WHATWG HTML 5 Spec, looking for the actual implementation details on the SQL offline storage interface? Sure, the doc has an "offline web applications" section, but that's just a vague excursion on caching, leading many - including me - to eventually wonder if the offline storage option has maybe been dumped in favor of some obscure key-mapped depot mechanism? By the way, even Palm's WebOS developer site links to that document, however it doesn't actually contain any mention of that database interface.

Luckily, this part of the spec does exist after all:
w3.org/TR/offline-webapps

Hope that saves some like-minded souls a bit of head-scratching...]]>
Wed, 08 Sep 2010 10:35:42 America/Los_Angeles http://creativepark.net/blog/entry/id/1189
Ten Grand is Buried Here http://creativepark.net/http://creativepark.net/blog/entry/id/1188

I'm not a Microsoft hater, on the contrary. Though I'm a Mac user, I have profound respect for the accomplishments of Microsoft's developers and other staff. However, it also seems obvious to me that the blazing incompetence, arrogance and hostility of MS' management and marketing departments make it very hard to maintain a certain level of goodwill and objectivity towards the company I still consider one of the core innovators on this planet.

Case in point, the IE 8 marketing campaign which does away with the subtle grassroots technique of the Bing marketing effort, in favor of a more "direct" approach. Here's the deal: ditch your current browser and get the chance to win $10,000. And it's every bit as sleazy and stupid as it sounds, but hey, I'm giving you free buzz anyway, Microsoft Australia (not that you needed it).

The boilerplate text probably speaks for itself: "Tell your friends. It's not as stupid as it sounds. With all the stuff you have on, you won't be able to keep an eye out for all the clues 24/7. So team up with your friends to catch all the clues on Twitter. Share the clues and share the big prize."

I'm not even annoyed that it tells me "We've buried $10,000 somewhere on the Internet and if you're the first one to find it, you get to keep it. But you'll never find it using old Firefox. So get rid of it, or get lost." where I'm apparently prompted to wipe OS X from my machine just to have an infinitesimal chance of winning that money - but only if I was an Australian citizen who'd have to dedicate the next two weeks to hunting down ridiculous clues while resisting the increasing temptation to kill myself.

No, what really gets me is that the team who put out the slowest, most horrible browser on earth considers it a greater priority to run a hostile and no doubt stupidly costly campaign, instead of fixing the abomination that is the Internet Explorer's CSS code or, say, rewriting the slowest and most awkward ECMA implementation known to humankind.

Those ten grand were buried there, indeed.]]>
Wed, 08 Sep 2010 10:35:42 America/Los_Angeles http://creativepark.net/blog/entry/id/1188
Mac Neophyte Tips: Using .TOD Files with iMovie or Final Cut http://creativepark.net/http://creativepark.net/blog/entry/id/1187 Whatever you do, don't listen to the people who are trying to sell you shady converter software. Here's how you can make it work:

Try this before anything else

So here is a list of things you should try in order before you actually use the solution below. First, try to install the QuickTime component on the JVC driver CD, it's called something like "QuickTime Component for Everio.pkg". In some cases that seems to enable iMovie support (though I can't for the life of me see how since iMovie wouldn't recognize the .TOD extension even if it would know how to interpret the content).

If that doesn't work, try giving the video file the extension .MPEG or .MPG instead of .TOD - that might work since .TOD is technically an MPEG-2 transport stream container. Then again, it might not.

Forcing it

OK if the previous measures did as much for you as they did for me (=nothing), there is an open source command line tool that will rescue you, it's called ffmpeg and it will transform pretty much any video file for you. ffmpeg is only distributed in source code, which means you have to compile it yourself, instructions on how to do so can be found on the ffmpeg website. But if you do, it is very important that you enable fAAC support during compilation. This is a major hassle as you have to get the AAC library separately and then pray that it compiles. You can also get a decent ffmpeg binary from within the shareware tool ffmpegX. Whatever you do, once ffmpeg is installed, you can start converting your .TOD files.

In order to convert your uncooperative .TOD files, you have to open the Terminal and go to the directory where the file is located. ffmpeg can support a large number of different formats, try this one first and type
ffmpeg -i MOV001.TOD -acodec copy -vcodec copy MOV001.mpeg
This will transform a file MOV001.TOD (replace with whatever name yours has) into a standard MPEG file that has the same name.

Now, for me that didn't quite work so well, even though it's the preferred option. If you can make it work, you should use it, because in this mode your actual video is not re-encoded but instead re-packaged, which has clear benefits when it comes to quality and speed. But if you're getting a lot of "buffer underrun"-type error messages and a zombie MPEG file at the end, it's time to actually transcode this .TOD abomination into submission:
ffmpeg -i MOV001.TOD -sameq -vcodec mpeg4 -acodec aac MOV001.mp4
This will create an MPEG 4 file iMovie can actually understand, but it has to use AAC for its audio encoding.

Now a word on JVC marketing. Maybe your camera, like mine, has a 1080p sticker on its case, meaning that it should be able to record non-interlaced 1080 HD video, otherwise known as Full HD. Yet, when you open the resulting files on the cam's disk, you'll notice that the video "inexplicably" has interlacing going on. Those scanlines should be removed from the video before you do anything with it since iMovie or Final Cut will take the choppy lines and make them even worse. To remove the lines, add the option "-deinterlace" to the ffmpeg command line:
ffmpeg -i MOV001.TOD -sameq -vcodec mpeg4 -acodec aac -deinterlace MOV001.mp4
And yes, this was the part where you just discovered that your camera actually has half the resolution as advertised. But hey, at least it's better than SD. Speaking of which, if you can't get ffmpeg to work with AAC or you don't care about preserving high definition in your iMovie project, you can create a .DV file out of your .TOD like this
ffmpeg -i MOV001.TOD -sameq -target dv MOV001.dv
Anyway, once you have figured out what works best for you, Folder Actions are your friend, because now you can automate this process and finally forget this whole nightmare of how you got here in the first place.

Good luck. We're counting on you ;-)]]>
Wed, 08 Sep 2010 10:35:42 America/Los_Angeles http://creativepark.net/blog/entry/id/1187
Twitw.at shortens URLs only when necessary http://creativepark.net/http://creativepark.net/blog/entry/id/1186 Many people have argued about the evilness of URL shorteners. Among the many points of concern was the general practice that URLs get compressed even if there are enough characters left in your Tweet to display it fully and uncorrupted.

Twitw.at is a Twitter-based URL tool that takes this to heart: if you still got room in your 140 characters, twitw.at will insert the full, original URL instead of the shortened one. Twitw.at also does a lot of other things, because it allows users to publish content pages under the short URLs it creates and people can even have a discussion on these pages!]]>
Wed, 08 Sep 2010 10:35:42 America/Los_Angeles http://creativepark.net/blog/entry/id/1186
Germany moves to outlaw paintball. Yes. Paintball. http://creativepark.net/http://creativepark.net/blog/entry/id/1185 paintball, ostensibly because it's only a sport for psychopaths where they can learn to kill people.

You have to know something special about German culture here to get the full picture. In Germany, gun clubs are hugely popular, especially among arch-conservative (to put it mildly) people. Germany has a huge corps of "hunters" that is seemingly necessary to keep the extremely dangerous local wildlife populations in check (hint: they're really just thugs who love to kill things mostly). But neither of these activities gets to be officially related to psychopathic killers. On the other hand, paintball, laser tag and computer games are perceived as barbaric and bloody activities by an increasingly clueless and reactionary public. And I can guarantee you that LARPers will be targeted next (they are people who play out LotR-style adventure games in remote locations with plastic swords and hand-crafted costumes).

What happened here is pretty simple, actually. You see, shooting things with real guns is something that respectable Germans do, so nobody is going to say anything against that. Laser tag and paint ball on the other hand is for geeks and misfits, it definitely has no political cost associated with it when it's forbidden by our increasingly authoritarian regime. Because geeks don't have clout, especially not in Germany.

On a final note, I dare you to visit the government news agency Tagesschau's website, they have an article on the subject, it's in German of course. But one thing you'll notice is the usage of imagery designed to look scary to respectable Germans, especially the first one where they show a black skinned paintball player who's in the process of looking menacing and psychopathic.]]>
Wed, 08 Sep 2010 10:35:42 America/Los_Angeles http://creativepark.net/blog/entry/id/1185
Goodbye Foxmarks, Hello Weave http://creativepark.net/http://creativepark.net/blog/entry/id/1184 modified pages like search results and cluttered the addressbar with useless self-promoting icons, it was also quite clearly monitoring my internet use.

Enter Mozilla Labs' Weave project. It's been around for about two years at this point, but practically nobody has heard of it. It essentially does the same job, namely syncing your browser settings in a secure environment.

What really caught my attention is the fact that they're working on incorporating OpenID-like identity authentication into the framework which is going to be excessively cool. Both as a user and as a developer I've been frustrated by OpenID's complexity and disruptive user experience, I'm really stoked to see how Weave turns out in this regard!]]>
Wed, 08 Sep 2010 10:35:42 America/Los_Angeles http://creativepark.net/blog/entry/id/1184
How to *make* add-ons compatible with your favorite Firefox version http://creativepark.net/http://creativepark.net/blog/entry/id/1183
The screwed-up mechanism here is in Firefox' add-on manager which refuses to let your plugin run, even if you really really want it to. For your own protection, of course. You're not allowed to override this decision, even if you're using an add-on that is no longer being maintained by its developer. I can only assume this fine piece of UI philosophy is - like so many bad ideas in the world - somehow inspired by Java, or possibly by one of its even more authoritarian frameworks, but I digress.

Anyway, here's how you can fix it yourself. But first consider yourself warned: your plugin may very well not work or if it does, there may be some hidden malfunction just waiting for the right moment to erase your hard drive, melt down your computer into a puddle of toxic waste and then implode the entire internet which could make you liable for billions of dollars in damages. Having said that, let's move on:

Finding the "extensions" directory
On OS X, Firefox add-ons are kept in your user directory, the path would be something along these lines:
/Users/(your username)/Application Support/Firefox/Profiles/
Now, in this folder, you'll see a cryptic folder that's called something like "3245hjg.default". Open it.

Here you'll find a file called "extensions.rdf", open it with a text editor and keep it open for later. Inside the same folder you'll find another folder called "extensions", open it.

Find the appropriate add-on
You have now reached the stage where the fun really starts. See, most plugins don't use a human-readable folder name, but instead are called something ridiculous like
{a7c6cf7f-112c-4500-a7ea-39801a327e5f}
That's called a GUID, or globally unique identifier; if you're interested in this number, ask your local COM or Java developer for a more in-depth, undoubtedly fascinating diatribe, but let's move on for now. To see what GUID your favorite add-on has, go to the text editor window containing the "extensions.rdf" file from the previous paragraph. Do a text search for the name of your plugin. You should find something like this:
<RDF:Description RDF:about="urn:mozilla:item:{a7c6cf7f-112c-4500-a7ea-39801a327e5f}"
NS1:installLocation="app-profile"
NS1:version="1.0.4"
NS1:optionsURL="chrome://fireftp/content/preferences.xul"
NS1:iconURL="chrome://fireftp/skin/icons/logo32.png"
NS1:name="FireFTP"
I have marked the GUID associated with FireFTP in bold here, you'll just do a search on your own and find your add-on's GUID. Now go to the Finder window with the "extensions" folder and navigate to the directory of the same name as the GUID you found. Open it.

Cracking the version barrier
You should now be inside the extension's folder. There is a file in there called
install.rdf
Open it. Inside you'll find a passage that looks like this:
        <em:minVersion>3.0</em:minVersion>
<em:maxVersion>3.5b2</em:maxVersion>
Change the value of maxVersion to (or beyond) your current Firefox version. Save the file, restart the Fox. You should now be able to open the add-on manager and re-enable the plugin.]]>
Wed, 08 Sep 2010 10:35:42 America/Los_Angeles http://creativepark.net/blog/entry/id/1183
How anonymizing routers actually work http://creativepark.net/http://creativepark.net/blog/entry/id/1182 someone on the internet is wrong. :-P

Even among Slashdot readers, there is still a tremendous amount of confusion as to what anonymizing onion-type P2P routers are actually doing (and not doing) to protect you. So here's a very short introduction to the technicalities of anonymized internet traffic, explained as non-technical as possible:

1) The usual way
When you (and your ISP) are not using any special software, data comes from the internet to your browser like this:
  • you click on a link
  • your browser creates a piece of data specifying the target address you are contacting as well as some additional context information
  • your browser sends the piece of data to a router/gateway
  • the router analyzes the piece of data and passes it along
  • repeat the previous step, until the packet arrives at the target server
  • server analyzes request, sends piece of data back along the chain of routers
  • back to your browser

Pros:
  • it's really fast
Cons:
  • any node on the way can read (and manipulate) any piece of the data stream
  • censorship software at the ISP level can block your access to certain sites by refusing to pass the packets along

2) The SSL way
SSL adds another layer to the whole process:
  • you click on an SSL link
  • your browser creates an encrypted piece of data that is completely opaque except for the target address
  • routers pass the data along to the server but cannot read the content
  • server passes encrypted data back to you the same way

Pros:
  • nobody can read or manipulate your data stream
Cons:
  • censorship software still works (because the destination address of both ends of this exchange is still readable)
  • any node on the way can still see who you are contacting

3) Anonymizing P2P networks
P2P networks form a mesh of nodes that route encrypted traffic through several stations before (most of the time) exiting to the public internet:
  • browser forms request
  • local P2P software encrypts request, sends it to a P2P partner node
  • P2P anonymizing node has no idea what data it is routing, but it passes it along to another P2P node
  • repeat the above step several times, for good measure
  • data reaches a P2P exit node, which decrypts the request
  • P2P exit node makes the request to the destination server
  • at which point the rest of the transmission either goes like 1) or 2) as described above

Pros:
  • you can now circumvent censoring measures since your ISP only "sees" the connection to the first P2P node
  • nobody knows where you are going (except the operator of the exit node)
  • the webserver operator has no way of knowing where you actually are
Cons:
  • if you're not using SSL, the traffic between the exit node and the server is still unprotected from the dangers as stated in the first paragraph, including the possibility of encountering a rogue exit node that protocols your entire data stream for nefarious purposes (e.g. to sniff your passwords)
  • it's slow
]]>
Wed, 08 Sep 2010 10:35:42 America/Los_Angeles http://creativepark.net/blog/entry/id/1182