Android AIDL regeneration

I’m working on a couple of Android projects; one has an Android IDL file (.aidl) for a service, and for some reason, the development environment didn’t automatically generate the corresponding .java file from it. I wasn’t able to figure out what caused this, and recreating the .aidl file didn’t fool the IDE into doing it, nor was I able to find a solution to this with the usual Googling.

I did find that right-clicking the project in the hierarchy and choosing “Android Tools” -> “Fix Project Properties” fixed this. Subsequent changes to the .aidl file automatically regenerated the .java file, too, so that’s nice.

12:37 pm — GeekeryComments (0)

Clearing apt-cacher’s cache

I frequently reinstall Ubuntu from scratch, so I’ve set up apt-cacher on my fileserver to cache the packages I install - this not only reduces my impact on the mirrors, but also speeds up my installs.

Occasionally, though, I see strange problems during installs: apt-get install retrying the download of an apparently-cached package. I haven’t figured out what’s wrong, and frequently I just want to get the reinstall going again. In these situations, it seems optimal to just dump the cache and start over; I haven’t found clear documentation of how to do this, but in case it isn’t obvious, this works for me (my cache is in /var/cache/apt-cacher, and I run it as www-data):

# Stop the service
sudo /etc/init.d/apt-cacher stop
# Move the old cache out of the way, so we can delete it 
# in the background (it can take a while)
sudo mv /var/cache/apt-cacher /var/cache/apt-cacher.old
sudo rm -rf /var/cache/apt-cacher.old &
# Make the new cache hierarchy, and set its ownership properly
sudo mkdir -p /var/cache/apt-cacher/{headers,import,packages,private,temp}
sudo chown -R www-data:www-data /var/cache/apt-cacher
# Restart the service
sudo /etc/init.d/apt-cacher start

Update: I found this blog post helpful for manually removing troublesome packages from the cache.

11:25 am — GeekeryComments (0)

Rails script/performance/request needed a little help

While following another great Ryan Bates Railscast, I had a couple of problems on my Ubuntu 8.04 development machine:

  • Rails 2.1.0’s ActionController wants version 0.6.1 or later of the ruby-prof gem, but the usual gem repositories only have 0.6.0 now. I found suggestions to install Jeremy Kemper’s fork on Github, but though I’d added GitHub as a gem source, installing jeremy-ruby-prof didn’t work because that installed his version with that name, which didn’t help ActionController. What worked was:
    sudo gem uninstall jeremy-ruby-prof # be sure to uninstall old attempts!
    git clone git://github.com/jeremy/ruby-prof.git
    cd ruby-prof
    rake gem
    sudo gem install pkg/ruby-prof-0.6.1.gem
  • Then, script/performance/request ran, but generated several strange error messages instead of producing results:
    Couldnt get a file descriptor referring to the console
    Could not get a file descriptor referring to the console
    Couldnt get a file descriptor referring to the console
    Could not get a file descriptor referring to the console
    

    This turned out to be because script/performance/request wants to use ‘open’ to open its output files (a text file and an HTML document), but on Ubuntu, /usr/bin/open is a link to /usr/bin/openvt, which didn’t do what we want (and generated those error messages). I’m not sure what else uses ‘open’, but this did the right thing: it lets Firefox open the files:

    sudo ln -sf /usr/bin/firefox /usr/bin/open
10:29 am — GeekeryComments (0)

named_scope, joins, & includes

I used Rails 2.1’s named_scope to implement various ways to sort things on OsoEco. When I implemented “most discussed” on the Question model (questions have many comments), it involved joining in the comments table to count comments for each question. Initially, it looked something like:
named_scope :most_active, :joins => :comments, :group => "questions.id", order => "count(questions.id) desc"

That caused a problem, which the Pivotal Labs folks also commented on today:

When using named_scope, adding a :joins option will “mix-in” all of the attributes from that join table into your retrieved object, potentially overwriting any colliding attributes (including id … ouch!). There was consensus that this was a valuable feature, when used “properly”. Adding :select option can avoid this, or use :include.

Like they said, I fixed this with :select — the second try looked like this
named_scope :most_active, :select => "questions.*", :joins => :comments, :group => "questions.id", order => "count(questions.id) desc"

That worked (and fixed that problem), but it occurred to me that if my controller wanted to :include additional tables to add onto this scope (and that’s one of the cool things that named_scope enables), it wouldn’t work: Question.most_active.scoped(:include => :comments) raises a bad-SQL exception.

Fixing this required a bit of table aliasing, and led to this:
named_scope :most_active, :select => "questions.*", :joins => "left join comments as comments_for_count on comments_for_count.question_id = questions.id", :group => "questions.id", order => "count(questions.id) desc"

This worked, even with the :include added in a subsequent (anonymous) scope.

1:51 pm — GeekeryComments (1)

I drink your milkshake

I like chocolate milkshakes, in ways that the HTML “<strong>” tag can’t really convey.

So a couple of years ago, to keep myself from going all Elvis in my senectitude, I adopted a rule: I’d only have a milkshake as we reached each thermometer milestone of 10 degrees Fahrenheit: I’d have one on the first day we hit 80°, one when we hit 90°, another at 100°, and should we hit 110°, I’d still be able to celebrate.

Unfortunately, I was cheated: I was out of town for the first two 90° days, then we went straight to 100°. (And no 110°, boo hoo.)

This year, I’m not taking any chances: I’m starting at 70°. I deserve it, too: we haven’t hit 70° yet this year, and we’re almost halfway through April already. I further deserve it because Cool Moon has been open since last November, just across the park, and I’ve been able to resist.

Tomorrow, however, the forecast is for 75° - Cool Moon, I’m coming for you.

11:16 am — GeneralComments (0)

And before that, I did this

Five other jobs that have fallen off the end of my resume:

  1. Made salads & bread baskets, & worked the snack bar; Sandcastle restaurant, Malibu, 1978-1979
  2. Parking attendant, Paradise Cove, Malibu, 1978-1979
  3. Census taker, United States of America, 1980
  4. Shipping/receiving & answering the phones, The Computer Store, 1979-1981
  5. (Turned down by McDonald’s, 1978: hair too long.*)

* I know, doesn’t count, but I needed a fifth to honor my inspiration for this post.

11:15 am — WorkComments (0)

Basking in benefits of connectedness

While working on setting up FestivalFanatic.com, I realized that some of its features would be useful to conference attendees as well… and since the obvious domain name was available, I registered it.

Cut to yesterday evening: when I actually finished the work setting up ConferenceFanatic.com, I twittered about it (and mentioned that FestivalFanatic.com has Amazon DVD links now - hint, hint)… and as it happens, someone I follow (and who follows me) is presenting at the PostgreSQL East conference this weekend - she registered and told me about it using the feedback mechanism.

I also noticed that LinkedIn now has a Twitter-like mechanism, so I added a note there about my two sites.

Cut back to the present, 24 hours later: The PostgreSQL East schedule’s up, and half a dozen new people have signed up to use it. Also, I got a terrific email message from another ex-Apple-ite who’d seen the LinkedIn message, saying great things about ConferenceFanatic.com and what it can become - very encouraging.

(I also got feedback via this site’s mechanism, from someone about a startup opportunity - that was encouraging too; Derrek, I’ll be in touch.)

7:23 pm — GeneralComments (0)

Today’s my day

…on Portland On Fire.

Hiding in plain sight

In writing my bio for Portland on Fire, I mentioned that I’d hidden my first name upside down in the “Read Me” file icon used on Macintosh during the late 1980’s: millions of people clicked on this icon to get help, and as far as I know, none of them noticed my name. The Wikipedia page for TeachText (the application I’d written which provides this icon) doesn’t mention this trivia (nor that I wrote it!).

After several years, TeachText was replaced by SimpleText, written by Tom Dowdy; Tom rightfully replaced my name with his; I’m just happy he kept the same style of icon. (I do rib Tom that TeachText was only 19K, where SimpleText was several times that in size.)

UPDATE: Sadly, I learned recently that Tom passed away. I’ll miss him: like many people I got to work with at Apple back then, he was smart and fun. I looked forward to seeing him every year at Apple’s developer conference, where we shared the distinction of being the only “Stump the Experts” experts who’d attended every session of that panel over the years.

1:43 pm — GeekeryComments (4)

Finished with PIFF ‘08

The Portland International Film Festival is finally over, and though I’m exhausted from the arduous schedule I kept (I saw every film I could - 70 features and 4 collections of shorts), I had a great time — even better than last year, largely because of the wonderful collection of people I met during the festival.

One of the best perks of Silver Screen membership at the Northwest Film Center (which puts on PIFF) is the ability to attend the press screenings that begin a couple of weeks before the festival’s official start: seeing the two press screenings each day opened up a lot of slots during the official festival. A nice side effect was that there were a bunch of other die-hards who attended most of the press screenings too, and since we’d all seen the same things already, we tended to make the same choices of festival screenings as well.

I also met several people who introduced themselves as users of FestivalFanatic.com, the site I created to manage my own schedule. It was also nice to see strangers carrying printed schedules produced by Festival Fanatic (note to those folks: improving schedule printing is near the top of my to-do list!).

Incidentally, the schedule for San Jose’s Cinequest festival is up on FestivalFanatic.com now, for my Bay Area friends who’ll be attending.

2:01 pm — GeneralComments (0)
Next Page »