Author Archive

Why is Time Machine backing up gigabytes of data every hour?

This has been bothering me for a while… I hardly change any files on my system, but every hour when Time Machine runs it somehow determines that 7 gigs of data has changed. Time Machine is ok for what it is, it’s biggest strength is probably ease of use. But it gives you no insight into what it’s copying exactly when it’s pushing gigabytes of data to my network backup.
As it turns out, there’s a handy little tool that tells you exactly what’s changed with your latest backup.

Timedog will tell you exactly which directories were backed up and how much data they represented. For me, the culprit turned out to be my Thunderbird mail client. It stores all email for a mailbox into a single flat file, and some of my mailboxes are gigabytes in size. Every new message I receive is causing the entire mailbox to get backed up again, eating up all my available backup storage pretty quickly.

Now that I figured it out, fixing this was pretty easy: simply put an exclude filter in Time Machine preferences to ignore any changes in my Thunderbird folder. All of my email is stored in my Gmail so it’s already in 2 places anyway.


Converting grayscale PNG to RGB PNG

Today I needed to convert a transparent Grayscale PNG image to the same format, but in the RGB color space. (some processing software that we use cannot handle grayscale transparent PNGs for some reason.)

Ultimately this is what worked for me. I was only able to figure this out through several hours of experimenting with ImageMagick options, so I hope this will help someone.

  convert in.png -type TrueColorMatte -define png:color-type=6 out.png

How to win the Mega Millions lottery

I’ve ignored my blog for several years so it’s time for a blog revival… I’m planning on sharing some of the recent lessons I’ve learned in Ruby on Rails development. For today, let’s keep it simple. Here’s my Ruby one-liner that will help you win the Mega Millions lottery:

a=[];until(a.length==5);n=1+rand(56);a<<n if(!a.include?(n));end;puts "your numbers are #{a.sort*','} and Mega Ball #{1+rand(46)}"

Pixel Peeper

If you’re like me and somewhat serious about photography, you probably research your lenses and cameras before you buy them. While I’m eagerly waiting for my new Panasonic LX3 to arrive, I was browsing around a bit to see what other LX3 owners have been able to produce with that camera. Not so surprisingly, I found a lot of great photos. But I also found a cool website that I wasn’t aware of until now: pixel-peeper.com. It uses the Flickr API to let you search for photos made by pretty much any kind of camera or lens.
Have a look and judge picture quality for yourself. Of course it’s true that a $6000 lens also typically has a better photographer behind it so comparing its photos to other random photos taken with a $100 piece of glass probably isn’t entirely fair. But it’s fun comparing anyhow.


Running the Glassfish updatetool on a remote server

I’ve been playing around with JRuby on Rails and Glassfish and really like the simplicity of deploying simple WAR files to a Glassfish server. Messing around with Apache configurations and managing a bunch of mongrel processes is just not my favorite pastime, plus I like to have the option of running other J2EE webapps on the same server, and interface my RoR app with existing Java libraries.

I ran into some problems trying to get the updatetool for Glassfish working on my VPS (at Rimuhosting) though. The updatetool is a Java Swing app and I’ve never run any GUI apps on this remote host before. It doesn’t have Gnome or KDE running so VNC was not an option. The trick is mostly just to set up your systems for running remote X11 applications over a SSH tunnel. Here’s how I got it to work…. I should say this server runs Ubuntu Hardy and locally I’m on Mac OS X so the X11 install from the Mac OS installation disks was the easy part.

Here’s what I had to do on the remote host:

(continue reading…)


new Trendnet TV-IP400W controller for Zoneminder 1.23.x

I’ve finally gotten around to rewriting my old Trendnet PTZ controller for Zoneminder 1.22.x to support the new API for Zoneminder 1.23.x. It includes all the old features (moving the camera in horizontally, vertically, diagonally, and going to preset and home position) as well as a new bonus feature: move the camera simply by clicking a point in the live video that you want the camera to recenter on. This is not extremely accurate, but good enough for most uses, and faster than having to click an arrow 20 times.

Here’s the basic steps on how to get this Trendnet TV-IP400 / IV-IP400W driver to work in ZoneMinder: (continue reading…)


jQuery plugin for communication between browser windows

Ajax is great for sending data back and forth between a browser window and the server, but when it comes to communication between two browser windows, there are few libraries that can help you out there.

I’ve been working with jQuery for over a year now and have always wanted to give something back to the user community by releasing my own plugin. Unfortunately it seemed like every type of generic functionality I might ever need had already been developed by others. Until last night.

I was working on a webapp in which my main browser window had to open a popup window, and the user would then perform an action in this window. Upon completion of that action the main (parent) browser window needed to be notified.
Though parent and child window can easily access eachother’s DOM, a common way to get a value from one window to another is by setting a value on a hidden input field of a form in the other window. This requires you to add form markup to your page, which is clunky. A second issue is that if you have several types of events or data to send to the other window, you’ll need to add an input field for each type. And a third issue I ran into is that ‘change’ events do not seem to fire for an input field if that field was updated by another window. ‘change’ or custom events using jQuery didn’t work either this way. ‘click’ events on links or buttons do work, but they would need to be hidden, otherwise the user could click on them too. I got it all working but this all started to look like an ugly hack, cluttering my pages with messy javascript and markup code.

(continue reading…)


Ruby controller for the Trendnet TV-IP400W PTZ camera

I thought I’d follow up on my post of a little while ago about the drivers for the Trendnet TV-IP400W Pan-Tilt-Zoom camera. I wrote a ruby driver for this thing, which makes it trivial to control the camera from any Ruby application. It’s just a single Ruby file, and though I’ve entertained the thought of figuring out how to pour it into a gem and publish it to the plugin repository, I’d probably only do that if there are a significant amount of people interested in using it and/or contributing to it.

As with the old Perl driver for Zoneminder (which I’ve been told doesn’t work anymore with the latest version of ZM, since the interfaces for the PTZ drivers have completely changed), this driver only controls the pan and tilt functions of the camera. Actually, you can also put it in swing mode and store or access preset positions, but none of the available functions actually do anything with the video stream. The video can simply be accessed at:

http://yourcam/image.jpg to grab a single frame of the current camera view
http://yourcam/video.cgi to get the mjpeg stream from the camera

There’s no real zoom control since the cam only has a digital zoom, which I believe is implemented in the client software only (so there’s no way to actually have it stream a zoomed image to your client).

(continue reading…)


A day in the SF eastbay

I love outdoor webcams, because they can give you an instant and live view of what the weather and/or a location looks like in places all around the world. Two sites that are great for exploring these live views all around the world are earthcam and cammap.net (though the latter appears to show only US based cams). They are simple services that simply put a database of webcams around the world on top of interactive maps. It’s the kind of site I’ve always wanted to build myself… It’s been done now but that’s ok because I plenty of ideas for other types of web sites left.
As I was browing our local webcams I came across an interesting one though… The Lawrence Hall of Science in Berkeley has a fixed cam pointed towards the bay of San Francisco, and records a snapshot of the view every minute of every day. Every day they automatically generate a little movie out of that, which you can view online. I’ve embedded the video here too, so what you’re seeing here is what yesterday looked like over here. Depending on what day you look at this video, you may catch some of our fantastic sunsets over the bay, the beautiful fog rolling in or out, or all kinds of other weather patterns moving over the East Bay. For the real weather enthousiast, check out the timelaps movie archive with some of the most stunning days caught on video.


The above image of the view from the East Bay hills is at most a couple of minutes old (unless the camera is down). Click to view yesterday’s timelapse movie.


Saint Nicholas in the Netherlands

It’s that time of year again… Saint Nicholas (aka Sinterklaas) has arrived (or is about to arrive) in the Netherlands, on his boat from Spain. He will be riding his white horse around Holland, getting ready to celebrate his birthday on December 5th and hand out presents to the kids. Actually his birthday is on December 6th but many decades or so ago he must have decided that the 5th would be a better day to celebrate it. Anyway, it’s complicated. In the US I have always had a hard time explaining the tradition of Sinterklaas without being laughed at, or without people bringing up the (to them) obvious references to slavery in the Saint Nicholas tradition. Granted, I wouldn’t paint my face black, dress up like a Black Pete (Zwarte Piet) and go wander around Oakland like that, as people who are less aware of the Dutch tradition might misinterpret what they’re seeing.

I came across a hilarious essay by David Sedaris on youtube that (fairly accurately) describes the Saint Nicholas tradition in Holland. You can view it right here – highly recommended. (it’s in 3 parts, make sure to watch all three of them…)


Copyright © 1996-2010 sfpeter.com. All rights reserved.
iDream theme by Templates Next | Powered by WordPress