GFX::Monk Home

- page 16

Scala on Android

As an addition to my last post, I’d like to point out a great resource for getting started with android programming in scala. This article gives you a nice template to go from, and a brief rundown of the sbt build tool you can use to build and deploy your scala-based android app. Good stuff!

(view link)

Pagefeed Android App

After getting an android phone about a month ago, I finally got around to writing a workable pagefeed sync app. This app can handle share intents from any app (I use NewsRob mostly), and save that link to pagefeed on next sync.

It also downloads the links (not the content, this is a lightweight app) so you can delete links from the app and have them deleted from the webapp as well.

You can download the apk here (I haven’t signed up for the market yet). The source is also up on github.

Android as a platform

Overall, I found android frustrating to learn when dealing with some of the newer and less-documented parts (like SyncAdapters and how they interact with ContentProviders, for example), but overall I’m finding it to be a very well-designed system that is easy to write for.

For comparison (because I’ve written an iPhone app or two), this app could not exist on the iPhone because interaction with other apps (via intents) is crucial, as is background operation (which has only just arrived in OS4). It would also be a royal pain in the ass to obtain, store and validate user credentials - all of which android makes general and reusable (I am happily reusing the google-provided authenticators).

Oh yeah, and it’s written in scala! I seem to have an aversion to platform-specified languages, having used python for my biggest iPhone app. Of course, that meant that I had to void my warranty and only run on jailbroken iPhones. Android doesn’t care how you write your app, and that’s the way it should be.

zero install is great

Zero install is a marvellous system that I’ve known about for a little while, but only just started to use. It’s a package manager (like apt or yum), with two important differences:

  1. Packages are distributed and named by URL - there is no single repository, just the internet. This makes for potential trust issues, but it’s far better than (for example) launchpad PPAs, because…
  2. Packages are installed and run as regular users. No root access required.

It also has some additional perks:

  • Cleanup is trivial - just clean out your zero-install cache.
  • Making packages is pretty simple.

For its convenience, using zero-install puts some restraints on you:

  1. No triggers. You can’t run a script on install / uninstall, because there are no such events - merely “run”. That means your program has to be self-contained, and must deal with any first-run issues in the code itself. Probably not a bad idea though.
  2. No arbitrary placement of files. I’ve got a bunch of customisations that (for example) put things in /etc/profile.d. You can’t do that sort of thing with zero-install, not even in the user’s home directory (e.g ~/.config). This means it’s not a great solution for configuration-based packages that coexist on the filesystem in well-known directories, so I certainly don’t see it replacing APT for that sort of stuff any time soon. But it’s certainly an excellent tool for delivering both programs and libraries.

I’ve put together my first 3 zero-install packages, and hopefully there will be more to come. You can find them here: http://gfxmonk.net/dist/0install/

Two of them are existing software, and the third is a tiny utility for working with zero-install itself. You can click on the xml files in that directory listing for an overview of what each package does.

Steve Jobs on Flash

I don’t even like flash, but this argument made by Steve Jobs makes me mad:

By almost any definition, Flash is a closed system.

Excepting, apparently, the definition that makes Flash open because swf is a publicly documented format which anyone is free to implement a compiler or viewer for. Having produced a new compiler (for example), one is then free to distribute swf files compiled with this third-party compiler to anyone with a flash player, who may then run them by any means they choose (including using an official Flash player or plugin from Adobe).

Compare that again to people who want to write iPhone apps using any tool other than Apple’s, and who want to distribute their creations to end-users to use without Apple’s endorsement (i.e the App Store).

And then please, continue to regale me with Apple’s astounding openness on this matter compared to the Big Bad Adobe.

Please note that I’m talking about the swf format here, not Adobe’s Flash creation program. Flash is to swf as XCode is to compiled iPhone Apps - any other comparison is disingenuous as I’m sure Steve knows.

The metaphysical angle against apple's new developer agreement clause

A really nerdy joke, but also a perfectly arguable stance within the language of the agreement. I love it.

Personally, I can’t believe the nerve of Apple these days. It’ll be interesting to see what fallout (or depressing lack thereof) comes from their ever-increasing paranoia.

(view link)

Save My Text

savemytext is a tiny app engine webapp I wrote last night.

When you write text in it, it will save your text. When you come back, your text will still be there. You can have multiple text boxes. Since it’s an appengine app, you’ll need a google account to use it.

A trivial app, to be sure. But all too often I find myself writing gmail drafts just in order to get a persistent text box between computers. I figured, why not do it properly?

(I was going to just call it “textarea”, but someone already stole that name (and tens of similar ones, without actually having an app to put up. How rude))