fettig.net

Ubiquity

Posted by Abe on Wednesday, August 27, 2008 @ 5:53 pm

This afternoon I spent a little time playing with Aza Raskin’s new mega-meta-extension for Firefox, Ubiquity. (If you’re not up to speed on Ubiquity yet, imagine bookmarklets, extended with power similar to Greasemonkey (including the ability to control your entire browser window) and controlled with a lovely command line interface in the model of enso/Quicksilver). Unsurprisingly, I love it. Ubiquity makes the web more scriptable then ever before, and the current implementation combines several of my favorite interesting UI ideas (context sensitivity, command lines, and hidden UIs that spring into view when you need them).

As a learning exercise I wrote my first command, status-in-gmail, which you can subscribe to on this Ubiquity Commands page. The status-in-gmail command will update your Google Talk status message in any Gmail tabs you currently have open. You can supply an arbitrary string for your status message, or have it use the selected text on the current page.

I chose this for my first command because I’d written a similar command for Quicksilver and Adium a while ago using AppleScript, and I’ve missed it since I switched to using web-based chat in Gmail. The Ubiquity side of things was really easy to implement - they’ve done a great job providing simple APIs. The only hard part was figuring out how to script Gmail to do what I wanted.

The current code is alpha, of course, and still has some limitations - you can only change your status message, not your available/busy status, and it will throw an error if you try to use it without being signed into chat. But feel free to give it a try and let me know what you think.

Now, who’s going to write the first Quicksilver-to-Ubiquity bridge? :)

iPhone sync problem and solution

Posted by Abe on Monday, February 18, 2008 @ 11:30 pm

A few days ago my iPhone stopped syncing correctly. When I tried to sync I would get a message that contact syncing had failed because “the sync server failed to sync the iphone”. If I disabled contact syncing, calendar synching would fail with the same error message, and if I disabled calendar syncing too, bookmarking synching would fail. I found a few people talking about the problem, but none of the suggested solutions (including restoring my iPhone) worked for me.

Finally I came across a weblog entry that mentioned looking at the console to see the sync log. I opened /Applications/Console and saw this message:


2008-02-18 22:57:38.111 AppleMobileSync[652] CFLog (0):
CFPropertyListCreateFromXMLData(): plist parse failed; the data is not proper UTF-8. The file name for this data could be:
/Users/abe/Library/Application Support/SyncServices/Local/clientdata/[really long numerical directory]/[really long numerical file name]

Apparently that file with the really long name was causing the problem. So I went ahead and moved it out of the way (I put it on my desktop so I could restore it if it turned out to be important). Then I tried to sync again… and it worked! I did get a couple of messages about resolving sync conflicts, but they were easily resolved and now everything appears to be working fine.

Take this for what it’s worth; I don’t know if this will work for you, or make matters worse. I have no idea what that file was supposed to do, and randomly removing application files from your computer is generally a bad idea. But if you’ve got a similar iPhone syncing problem, and nothing else works, you might want to check your Console log and see if there’s a similar file causing your problem.

Copies of Twisted book available

Posted by Abe on Thursday, February 14, 2008 @ 1:06 am

Update, 2/18/08: Thanks to those who have taken me up on this offer so far. I still have a few copies available. I’ll update this post when I run out of author copies, so if you’re reading this that means the offer is still good. Also, I’ve been asked if I would consider trading for other things besides the items on my Amazon wish list. Sure! Just send me an email describing what you’d like to trade.

I was thinking today about what to do with my remaining author’s copies of Twisted Network Programming Essensials. I’ve given most of them away, but I have a few left, and I’d like to see them get into the hands of people who will read them before they become obsolete. So I decided to try offering the following deal to anybody who’s interested:

  1. Buy me something from this Amazon wishlist. To make it a good deal for you, pick something less expensive than my book.
  2. Send me an email (abe at this domain) with your mailing address.
  3. I’ll mail you an autographed copy of Twisted Network Programming Essentials.

Sound good? Gift away. Or email me if you have questions. I currently have 10 extra copies, first come first serve.

1 TB

Posted by Abe on Tuesday, October 16, 2007 @ 11:07 am

I recently started running MythTV on a Linux box I have sitting in my basement. This machine also acts as a home file, web, and print server, and it had a couple of internal hard drives in it already, plus an external USB drive for backup. MythTV soon ate up all the available space on my /home partition, so I went shopping for another drive to use for dedicated video storage. It’s amazing how cheap hard drives have become: I ended up getting a 500GB drive (which seems to be the current sweet spot for bytes-per-dollar) for $100 plus tax. After installing and formatting it, I took a look at the available disks in my system, and suddenly realized how much total storage there was:

$ df -H -t ext3
Filesystem             Size   Used  Avail Use% Mounted on
/dev/hda1               28G   4.3G    23G  16% /
/dev/hda2              216G   142G    63G  70% /home
/dev/sda1              316G   143G   158G  48% /mnt/bigboy
/dev/hdc1              493G   115G   353G  25% /mnt/video

That’s just about a terabyte! A few years ago I would never have imagined setting up a machine for personal use with a terabyte of storage. And now I have one, almost accidentally. Amazing.

View Source for Safari on iPhone

Posted by Abe on Monday, July 2, 2007 @ 8:40 pm

A lot of web development knowledge has been gleaned by viewing source. Unfortunately the iPhone’s version of Safari doesn’t have a View Source command. So if you visit a site on the iPhone, and find that they’re serving you up a different, iPhone-optimized version of the site, there’s no easy way to look at the source and see what they’re doing.

To work around this problem, I made myself a little View Source bookmarklet that works on the iPhone. Here it is:

View Source

To use, add the above bookmarklet to your Safari or IE bookmarks, and sync your iPhone. Then visit a web page on your iPhone, pull up your bookmarks and select “View Source”. A new page will open containing the source of the page you were viewing.

Unlike the traditional View Source command, this bookmarklet shows the generated source, not the original source. if the DOM has been modified by script you’ll see the modified version and not the original. Also, you’ll probably have to do lots of zooming and panning, since the lines of source code will be wide. If anybody wants to make a version that has nicer formatting, feel free to expand this code.

Here’s the original un-escaped javascript:

var sourceWindow = window.open('about:blank');
var newDoc = sourceWindow.document;
newDoc.open();
newDoc.write('<html><head>' +
    '<title>Source of ' + document.location.href + '</title>' +
    '</head><body></body></html>');
newDoc.close();
var pre = newDoc.body.appendChild(newDoc.createElement("pre"));
pre.appendChild(newDoc.createTextNode(
    document.documentElement.innerHTML));

A few iPhone Safari notes

Posted by Abe on Friday, June 29, 2007 @ 8:36 pm

Some notes on Safari on the iPhone, from the perspective of a web developer: 

  • Poking around the DOM, I don’t see any special objects, with the possible exception of window.offscreenBuffering (set to true).
  • Bookmarklets work, although you have to go through the bookmarks menu to get to them.
  • The javascript shell bookmarklet is tantalizingly close to working, but doesn’t actually evaluate what you’ve entered when you hit enter - it just goes to a newline. This is probably easy to fix.
  • Update: the problem appears to be the fact that you only get an onkeypress event after you hit enter on the virtual keyboard, and even then the keyCode is equal to 0. I tried modifying the script to execute whenever keyCode is 0, but that made Safari crash! Does that make me the first civilian to crash Safari?
  • Safari crashes are handled gracefully - the main screen fades back in, and you can jump right back into Safari. It will then load page you were visiting when it crashed.
  • Drag and drop, and other behaviors based on picking up mousemove events, don’t work. CSS-based element drag and drop doesn’t work either. Dragging one finger around the iPhone’s version of Safari causes the window to scroll, and that’s it. I assume that scroll events do work. I’m sure somebody is already working on a version of drag and drop based on window scrolling.
  • For documents with no width set, the iPhone uses a default width of 980px.
  • alert() works.

I’ll post more things as I discover them, or feel free to add your own in the comments.

iPhone error correction really works

Posted by Abe on Friday, June 29, 2007 @ 6:53 pm

A useful OS X command: pbcopy

Posted by Abe on Monday, June 25, 2007 @ 11:44 pm

Today I learned about the pbcopy command in OS X. It lets you copy text to your clipboard from the command line. This means you can (among other things) copy the contents of a file on a remote server into your clipboard, ready for pasting:

ssh myserver -x "cat myfile" | pbcopy

Believe it or not, this actually came in very handy for a debugging task I was working on. There’s also a pbpaste command, which prints the current clipboard contents to stdout.

Multitasking

Posted by Abe on Monday, May 21, 2007 @ 11:11 am

Today I was catching up on my RSS feeds in Google Reader when iTunes started playing a song I didn’t feel like hearing. Without taking my eyes off the article I was reading, I typed Cmd-Space-n-e-x-t-Enter (Pull up Quicksilver, run “Next Song” script). I think that’s the first time I’ve done that without looking, and that seems significant.

Yes, there’s no such thing as true multitasking. But this makes me think that good software can dramatically reduce the overhead of switching tasks. When I run a task through Quicksilver, it preserves my foreground window, and keeps my hands on the keyboard. If I’ve memorized the command I want to run, I don’t even have to move my eyes to the Quicksilver dialog. Just think, type, go. And then continue what I was doing.

My one Apple phone prediction

Posted by Abe on Tuesday, January 9, 2007 @ 11:57 am

With Steve Jobs’ MWSF keynote speech just minutes away, I’m going to offer one prediction about the rumored Apple phone: Like the iPod, it will be PC-centric (and by PC, I mean “Mac or PC”). While a true mobile phone, it will also be designed to connect to your computer when you’re at home. You won’t be able to take full advantage of the phone without a computer running Apple software.

The iPod depends on iTunes, and iTunes lets you perform the more complicated tasks of buying, and organizing your music using the more powerful interfaces available on a PC. Moving more of the complexity onto the PC is what allows the iPod itself to be so simple, and appear so powerful despite having limited computational power. I think we’ll see something similar with the Apple phone - your computer will control the data on your phone. Syncing your music, photos, etc. will be almost transparent, easier then it’s ever been before. Unlike the iPod, though, the flow of information will be two-way. You’ll be able to take your songs and photos with you when you leave your computer, but you’ll also be able to record information - names, addresses, pictures - when you’re out and about, and have it all collected back onto your computer when you get home.

That’s how I imagine it, anyway.

Update: Well, the iPhone is pretty amazing, and much more powerful than I would have thought possible. So forget what I said about moving complexity to the PC. I still think there will be some slick two-way synching, though.

Next Page »