Fixing a little VPN annoyance

I’m writing this in a coffee shop, and when I’m using a public wireless network, I like to secure my network traffic using a virtual private network (VPN) that I set up on my server at home. Without this, anyone else close by could spy on what I’m doing (including seeing passwords I’m sending to badly-secured web sites). Unfortunately, the connection appears to go bad after a short while, and it took me weeks to spend the minute it took to find a fix.
(more…)

11:54 am — Geekery, ToysComments (0)

The Android fonts on my desktop are beautiful

Droid family font sampleI’ve been tinkering with developing software for the Android phone platform (and loving my G1 phone that runs it)… the Android folks at Google hired Ascender to create a new font family for the phone, the only family that the phone comes with. Here’s a sample from Ascender’s press release.

It occurred to me that because the fonts were designed for legibility at small point sizes, Droid Mono might be a good replacement for the terminal font I do much of my programming in. It turns out that the whole family makes excellent replacements for the default fonts on my Ubuntu systems: they’re so legible that I’ve been able to reduce the default sizes as well, effectively giving me more screen real estate. Several times in the last couple of days, it’s occurred to me how much more beautiful my working environment is, now that I’m looking at a well-designed font.

You can get the fonts from within the Android SDK, but another helpful blogger has put them up as a separate download. (If you’re installing them on Linux like I did, put them in a folder in /usr/share/fonts, then do “sudo fc-cache -f -v” to get the system to notice them.)

11:15 am — GeekeryComments (0)

As the polls close…

“I find I’m so excited, I can barely sit still or hold a thought in my head. I think it is the excitement only a free man can feel, a free man at the start of a long journey whose conclusion is uncertain. I hope I can make it across the border. I hope to see my friend, and shake his hand. I hope the Pacific is as blue as it has been in my dreams. I hope.”

- Red, “The Shawshank Redemption”

5:50 pm — GeneralComments (1)

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 (1)

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)
Next Page »