GFX::Monk Home

- page 19

PastryKit

John Gruber discusses PastryKit, Apple’s fancy webkit library for making surprisingly native-looking apps in the MobileSafari browser. I’m uneasy:

Everything related to scrolling is implemented within the app itself, in JavaScript.

Ugh… Is that sort of thing really what we want to encourage in app development? For particularly well-thought out examples, like picasa’s, it makes some sense. But for a mobile device, with limited resources, handling low-level UI events in Javascipt? Come on…

(view link)

…

Zenity: for the user-friendly scripter

I just discovered zenity, which is a great tool for simple gtk+ interactions with a script.

It has the following types of interactions:

  • calendar (date picker)
  • file / directory selection
  • error / info message
  • list picker
  • question (yes/no)
  • progress dialog
  • systray notification
  • and more… ( see the man page )

The usage is brilliantly simple, and it’s very unixy despite being a GUI tool. I just wrote a pygtk+ app to do some photo importing stuff, but doing it with zenity would have been far simpler.

Well worth keeping in mind for your next user-friendly shell scripts (particularly for the more advanced progress, calendar and list picker dialogs).

…

Site do-over

I’ve re-done the site slightly, so hopefully there aren’t too many broken things left lying about the place. I’ve now moved to using Jekyll, which is a “blog-aware static site generator”.

Basically, it allows me to keep my posts on disk (in git, of course) as a series of markdown files - one per post. I can also prefix each file with some yaml metadata, such as tags. This all means I can just write my posts offline, in my editor of choice. It seems to me a much cleaner approach than the unwieldy php4/mysql site I was using before - every time I had to fix an issue, I winced at PHP and the fact that I couldn’t always reproduce the issues my server was having, leading me into the stressful land of debugging and modifying a live site.

Plus, in the unlikely event that I get slashdotted, I’ll be ready ;).

Fixing Jekyll

It hasn’t been all rosy though. I’ve had to fix a number of issues or omissions I’ve found in jekyll, and that is already on top of an unofficial branch to better support tagging - not the most stable environment. The fact that there are almost 250 forks on github alone worries me though - either nobody is sending patches upstream, or upstream is not very receptive to said patches. It makes for a fairly hectic landscape.

FTP Sync - not as simple as you might expect

Oh, and the fairly awful state of FTP synchronisers for linux is surprising. I eventually got the sitecopy program to work for me, but not without a lot of complaining on its part. And this was after trying 3 other FTP syncing programs, none of which could even complete a single update before dying of various causes. Admittedly, this is mostly a problem because I don’t have SSH access. rsync would work wonderfully, otherwise…

…

Bash trick: indicate whether a session is running under SSH

It’s worrying how often I execute a command on the wrong machine because I don’t notice the hostname in my bash prompt. So I eventually figured out a way to make it more obvious. This is the relevant part of my ~/.bashrc:

# colours
RED=`tput setaf 1`
GREEN=`tput setaf 2`
YELLOW=`tput setaf 3`
BLUE=`tput setaf 4`
MAGENTA=`tput setaf 5`
CYAN=`tput setaf 6`
WHITE=`tput setaf 7`
LIGHT=`tput setaf 9`
GREY=`tput setaf 0`

# make remote sessions stand out
HOSTNAME_COLOR="$YELLOW"
[ "$SSH_CLIENT" ] && HOSTNAME_COLOR="$RED"

# string it all together:
PS1='\[$GREEN\]\u\[$HOSTNAME_COLOR\]@\h \[$CYAN\]\w\[$GREEN\] \$\[$LIGHT\] '

The colours stuff is pretty standard, the crucial part is [ "$SSH_CLIENT" ] && HOSTNAME_COLOR="$RED". You can do anything in here to make a remote session stand out.

…

One Book, Many Readings

Christian Swinehart’s beautiful infographics and interesting analysis of choose your own adventure books.

(view link)

…

Lauren McCarthy's Happiness Hat

It measures your smile and stabs you if you’re not smiling sufficiently [via waxy.org]

(view link)