Udo's Techblog

Feed Rss

Rolz App

12.09.2011, No Comments, Tech, by .

Rolz App is now in the Apple App Store. Essentially, this app is an offline version of my semi-popular online dice roller for roleplayers and I’ve been working on it for a while. As such, it takes all the familiar dice codes supported by rolz.org (with the exception of DSA-style talent rolls) and even has a plain dice mode where you can just click on a die and have the result appear on screen.

This will be a very cool tool in the arsenal of players and GMs alike, especially when they’re playing in places with a spotty online connection.

> Get Rolz App via iTunes

Calcumator 1.1

12.09.2011, No Comments, Tech, by .

This is the new version of Calcumator. As you can see, there has been a subtle but important change in its user interface: the top navigation bar is now on the bottom and it doesn’t scroll with the other page content. In the previous version, we had quite a bit of trouble with the limited screen real estate (especially when the virtual keyboard was visible) that lead to Calcumator hiding the nav bar in landscape mode. By moving the bar to the bottom, we make a lot better use of screen that real estate now by maximizing the area available for displaying calculations.

Beautiful Conversions!

But of course the most awesome change is the shiny new converter. Calcumator now allows you to convert between lots of unit systems wherever you need it: distances, masses, areas, energies, pressures, speeds, and temperatures at the tip of your finger. True to the Calcumator concept, the results of conversions are kept in a visual log history where you can access and reload them.

Dropping Android Support

As of version 1.1, I have decided to go iOS only for now. There are several reasons for this. Foremost, the Android version never got any significant traction. I never felt comfortable with the Android Calcumator (that’s why it was available for free to begin with), there are just too many different handsets and I’m certain that the app doesn’t work correctly on a lot of them. Lastly, making a separate Android version takes a lot of time and effort – effort that I right now think is more wisely spent on making the iOS versions rock even more.

What’s In The Future?

I’m certain that future versions of Calcumator will include graphing and formula solving capabilities. Not certain when they’ll be out, but I’m working on it :-)

> Get Calcumator 1.1 on the Apple App Store

I’m hosting all my stuff on a single EC2 instance (a Micro, to be precise) and so far it’s been working out great. People are complaining about EC2 performance, particularly when combined with EBS volumes, but I have to say that even this ridiculously small server beats every single shared hosting provider I had before. NginX + PHP + APC + Memcached = awesome!

However, I did manage to cause a significant outage for a few yours yesterday. See, my backup strategy is somewhat cowboy-style. While there are offsite backups, those are few and far between. So if anything goes wrong, there is a huge incentive to not restore from backup if at all possible. And yesterday, something finally did go wrong. After a routine upgrade of the Linux distro powering my t1.micro instance, the machine simply refused to come back up after reboot.

There is little one can do in this case, when an instance simply refuses to boot into an SSH-able state. In the end, I rebuilt the server from a blank new t1.micro instance and copied over just the data from the old system volume. This is where EC2 is amazing: it allows you to attach any EBS volume to any instance, even while it’s running. Thus, the need to restore from a well-aged backup was once again averted. But the length of this outage was completely avoidable. Things to consider when you have a setup similar to mine:

  • Keep a spare bootable instance ready, in case your primary fails. EC2 instances only cost money when they run, so you should be fine keeping a deactivated spare around.
  • Always resync your backup before upgrading your distro. (duh!)
  • You can always attach your IP addresses to a spare instance in seconds.
  • A two-server setup with failover is probably a good idea.

All these years, the FreeBSD logo was generally accepted. But maybe as a sign of the changing times, even computer nerds are beginning to be offended by the continued existence of the beloved demon mascot. What started with Texan rednecks has now progressed to a general publicity problem up to the point where people on the BSD mailing list are discussing how best to stop offending religious idiots:

Attempts at misguided religious censorship notwithstanding, I don’t want to see one of my ISP’s customers lose business. And I’d like to keep a FreeBSD logo on our hotspot page. Is there artwork that doesn’t include horned creatures that might offend the ignorant or superstitious?

What I find more disappointing than anything is the support those being offended apparently have inside the IT community, an observation that was fueled by the HN thread on the subject. Until I read these comments I had no idea that a lot of these people are now fundamentalists or at least sympathizers. It’s really sad to see that ignorance is winning.

Of course, nobody is complaining about the New Jersey Devils though. There must be something inherently god-compliant about sports.

Hey, my first venture into mobile apps has gone live. Calcumator, a very simple but powerful programmable scientific calculator, has just been green-lighted in the Apple App store for iPhones and iPads. It’s also been available in the Android App Store for a few days.

> Calcumator for iOS (3 or newer)
> Calcumator for Android (2.3.3 or newer)

It’s been fun assembling the app. As simple as it seems, I wanted to create something that could be used for a wide variety of calculations, and in the end I made something I myself would have liked to have a lot of times. The actual app just took about a day to put together, it was getting to know the intricacies of the Android and Apple App stores that took a little bit longer.

My next app will be an offline version of my Rolz.org website, a dice roller for people who play roleplaying games. Looking forward to it!

It’s been two years since I last posted here, maybe it’s time to start it up again – what do you think?

I’ve been pretty busy recently, mainly because I decided to start working on Hubbub (the open source federated social network) again. Even though the Hubbub prototype came out before Diaspora did, I was actually quite discouraged when I heard of them for the first time. I’m not quite sure what the status of Diaspora is right now (I’m sure it has a thriving community somewhere) but since it hasn’t taken over the world already I figured I might give this another try.

Fun fact: testers of the prototype hated the project name “Hubbub”, one of them even suggested to name it Diaspora. True story! I’m so glad I didn’t go with that! :-D

Other things going on right now include mobile apps. I decided to give Android and iOS a whirl. So far I haven’t heard back from Apple for my dev account registration (it’s been a week since I paid up), but the Android registration took about one minute to go through!

So the first mobile app I’m releasing is Calcumator (a scientific calculator app) for Android.
Check it out, it’s free:
https://market.android.com/details?id=com.openfu.calcumator

 

So you’re trying to hack together some offline capability for your browser-based app, good for you! Until HTML 5 came along, there were basically two options to accomplish this: you could either require your users to install Google Gears or you could distribute a local server stack. Enter HTML 5′s offline capabilities!

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!

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.

Perhaps you spent some time browsing through the 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…

I hadn’t used my JVC camcorder in ages, now I reconnected it and discovered that I can’t use the camera’s raw video files (which have a .TOD filename extension) on the Mac. Uselessly, JVC has included an import filter on the driver CD, but all it’s good for seems to be viewing the files in QuickTime. Now, there are several reports on the net about this and people seem to have experienced different outcomes, probably based on the actual camera model. 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 ;-)