Web/Tech

July 06, 2009

Camera Lens Calculators are back in action!

A long, long time ago I had written two on-line calculators to help photographers answer the following questions:

  1. How far away from my photographic subject can I be and still fill up the frame of the photo with that subject?

    This question gets at how large a focal length your lens needs to be in order to photograph a distant object without it appearing the size of a pin-prick in the resulting image. If you find yourself wondering whether you need that 300mm lens in order to capture a water buffalo at 500 meters, this calculator will be very useful to you.
  2. When doing macro photography, how much of my camera sensor area will be covered by the subject at a given distance?

    This is for photographers working on extreme close-ups who want to fill the entire area of the camera's image sensor with the subject of their photograph (a flower, an insect, etc.). This calculation will tell you whether or not you have to have a 'true macro' lens (one that has a macro ratio of 1:1) in order to pull it off.

The calculators are available here. Enjoy!

PS This would not have been possible (or at least as easy as it was) were it not for the Internet Archives. The old version of my calculator page had been lost when I migrated to TypePad as my new weblog platform of choice, but luckily a snapshot of my website from April of 2005 was available, allowing me to pull the original formulas out of the digital dust bin.

June 12, 2009

HOWTO: Remove auto-complete entries from Firefox form fields

After submitted this feature enhancement request to the Mozilla bug database, I received a comment on the bug informing me that the feature already (more or less) exists.

Here is my complaint: After using Firefox for several months, form fields with common names - email, address - tend to accumulate a very long list of auto-complete values. Most of them are not very useful and just slow me down. For example, see this street address field (from Senator Barbara Boxer's message submission form):

Greenshot_2009-06-12_08-58-46

What I learned after submitting my enhancement request that it is possible to remove entries from this auto-complete list using a (in my opinion) completely undocumented feature:

Use the arrow keys or mouse to highlight an entry in the auto-complete menu, then press the 'Delete' key. That value will then be removed from the list of retained/suggested values! I would prefer to have an entry at the bottom of the list 'Remove all suggestions for this field' to completely clear the auto-complete list, but one at a time will work in a pinch.

This is particularly useful for those times when your credit card number seems to have been remembered by Firefox when it probably shouldn't!

June 11, 2009

HOWTO: Resolve nxserver error "Wrong version or invalid session authentication cookie."

After a few too many minutes spent digging into this error message and not finding any applicable answers, I looked into the NX session log file in my user home directly to see:

/usr/NX/bin/nxagent: error while loading shared libraries: libXpm.so.4: cannot open shared object file: No such file or directory

Because this is a newly installed server (RedHat/CentOS 5.3), and even though I had installed the 'xorg-x11-xauth' and 'gnome-desktop' packages, this required library somehow got missed. To install this missing library, you need to install the 'libxpm' package. In my case, using yum:

yum install libXpm

And while you're at it, make sure that the full Xorg x11 server is installed. Oddly, 'gnome-desktop' does not depend on this package:

yum install xorg-x11-server-Xorg

March 05, 2009

HOWTO: Run ant in the background

A problem that I'd long since given up trying to fix a while back: Trying to launch a long running ant command in the background. For various reasons, I use ant to launch several long-running tasks (4+ hours). Most of the time, I want these tasks to run in the background. But pressing Ctrl-Z or appending the ampersand character ('&') to the end of the command would result in the process going into the stopped or suspended state on most Linuxes:

> ant run.fetch &
Job 1, 'ant run.fetch ' has stopped

After looking around a bit, and a bit of strace running, I discovered that the ant wrapper script really does not like being disconnected from standard-in, -out, and -error. So instead try redirecting all three:

> nohup ant run.fetch </dev/null 1>/tmp/stdout.log 2>/tmp/stderr.log &

This did the trick - allowing the ant command and subsequent java sub-processes to run unhindered in the background.

Hope this helps.

February 25, 2009

HOWTO: Get Juice Podcast client working on Vista

Just in case someone else runs into this problem: After installing and launching the Juice podcast client on Windows Vista, an error dialog was displayed telling me that I should look for the application error logfile 'juice.exe.log' in the installation directory.

Sure enough, the file was there with the following cryptic contents:

Traceback (most recent call last):
  File "gui.py", line 4, in ?
  File "iPodderGui.pyc", line 3621, in main
  File "iPodderGui.pyc", line 707, in __init__
  File "wx\_core.pyc", line 5301, in __init__
  File "wx\_core.pyc", line 4980, in _BootstrapApp
  File "iPodderGui.pyc", line 1472, in OnInit
  File "iPodderGui.pyc", line 934, in SetLanguages
AttributeError: 'iPodderGui' object has no attribute 'menu'

After a bit of Googling, I discovered that the problem could be fixed by right-clicking on the Juice.exe application, selecting 'Properties' then 'Compatibility'. Check the 'Run this program in compatibility mode for' checkbox and select 'Windows XP (Service Pack 2)' option from the pulldown menu. Press 'OK' and the next time you launch the application, the error should not occur.

Hope this helps someone out there.

February 16, 2009

HOWTO: Determine LivePerson Status using Java

A recent feature addition that I've been working on for Altos Research requires that our server-side application be aware of our LivePerson on-line support status. Although LivePerson provides sample client-side javascript utilities for this purpose, there are times when your sever app just needs to know if your support representatives are online, busy, or offline.

My solution to this comes from a bit of reverse engineering of the javascript library that LivePerson makes available and is described in one of their help documents.

The solution consists of three classes - one of which is a public domain utility named ImageInfo, which is available for download. The first of the new classes written for this is a simple enum type to hold the possible status values:

public enum LivePersonStatus {
    offline, online, unknown, occupied
}

The work is done using a simple class with a single static method - getStatus - which takes your LivePerson account number as input:

   public static LivePersonStatus getStatus(Integer lpNum) {
        if ( lpNum == null ) return LivePersonStatus.unknown;

        URL u = null;
        try {
            u = new URL("http://server.iad.liveperson.net/hc/"+lpNum.toString() + "/?cmd=repstate&site="+lpNum.toString()+"&useSize=true&d="+ System.currentTimeMillis());
            ImageInfo i = new ImageInfo();
            i.setInput(u.openStream());
            if ( i.check()) {
                int width = i.getWidth();
                if ( width == 40 ) return LivePersonStatus.online;
                else if ( width == 50 ) return LivePersonStatus.offline;
                else if ( width == 60 ) return LivePersonStatus.occupied;
                else return LivePersonStatus.unknown;
            }

        } catch (MalformedURLException e) {
            //LOGGER.warn("URL problem with u: " + u);
            return LivePersonStatus.unknown;

        } catch (IOException e) {
            //LOGGER.warn("URL problem with u: " + u);
            return LivePersonStatus.unknown;
        }
        return LivePersonStatus.unknown;
    }

Once the method returns the current status, you are free to take appropriate action. Enjoy.

October 08, 2008

HOWTO: Selectively silence telemarketer phone calls on Windows Mobile phones

With the campaign season in high gear, I find myself the recipient of frequent fund-raising phone calls placed to my mobile phone. Of course, the government Do-Not-Call list exempts political organizations, so that is no help. In order to reduce the irritation from these calls, I decided to take advantage of the 'Custom Ring Tone' feature of Windows Mobile SmartPhone edition. The number I wanted to silence was 805-897-1183 and is from a company called TeleFund.

Note: I am using a Motorola Q, equipped with WMSPv5. I assume this feature exists on newer versions of WM and is almost surely supported on other platforms. All you need is the ability to associate a custom ring tone to a particular phone number for this to work.

Using a nice little sound generator script that I found here, I was able to create a WAV file containing one second of silence. I then used the handy SoundCoverter on Ubuntu to convert this to an MP3. As it turns out, WMSP supports both MP3 and WAV formatted files for custom ring tones.

You can download the files here:

Download silence.wav

Download silence.mp3

Once you have these files transferred to your phone (I did this using an external MicroSD card that I use for storing podcasts and audio books), you then just need to associate this file as the ring tone for the phone number you want to ignore. Where the file should go may depend on your phone operating system. On WMSPv5 any MP3 or WAV file found on the Storage Card will be made available as a custom ring tone, for example.

To silence the number on WMSPv5 the process looks something like this: After you receive the unwanted call, press Ignore to send them to voicemail. Once the connection has been terminated, open your Call History application. From there, select the phone number (assuming Caller ID was provided) and then select 'Save to Contacts' from the right-side menu. Create a new contact record, give it a name, and insert the number. Scroll down a bit until you see the 'Custom Ring Tone' menu, which by default will display 'None'. Select that menu item and scroll down until you see the entry named 'Silence'. Select that sound file.

Now the next time that phone number calls your phone, the 'silent' ring tone will be played, you will not be interrupted, and life will be just a wee bit more pleasant.

August 04, 2008

Moving up in the Aptera line

This just arrived in my inbox from Aptera:

Jason Buberel,

Thank you for being a part of the Aptera Family! We have successfully separated the list into separate hybrid and all electric lists.

Here is your new reservation number: 838

Regards,
The Aptera Motors Team

I had previously been #2506 - so separating out the hybrid orders moved me up 1668 places in line! This hopefully increases the chances of getting my Typ1 before the end of 2009.

Listening To

Real Estate Stats

  • Price Trend for Sunnyvale 94086
  • Median Price for All Sunnyvale
  • Median Price for Sunnyvale 94086

GA