ReferenceError: java is not defined - Mac OS X - Firefox 4, 5, 6, 7+

For grabbing screenshots we often use iOpus' wonderful Firefox plugin iMacros. Today I opened an old macro and it failed to run. It turns out that it uses the global java object (via LiveConnect) to read and write files, and the global java object was no longer available.

Other error message you may see include, "ReferenceError: java is not defined (Error code: 991)" from iMacros, or simply "ReferenceError: java is not defined" from Firebug or the browser itself.

The simple solution is to check "Enable applet plug-in and Web Start applications" in the Java Preferences app. Use spotlight to find it.

Screen_shot_2011-10-25_at_2
Then restart Firefox and try to run the macro again and it should work. If you're using Firebug, you can easily test to see if it's installed correctly by typing "java" into the console. If installed you should see "[Java Package "java"]" as output.

Screen_shot_2011-10-25_at_2

Theories why this happened? Most likely it's because Java for browsers is disabled by default in Mac OS X Lion, so I only noticed this after I upgrade from Snow Leopard.

Another source that confirms my suspicion:

http://sniptools.com/mac-osx/making-java-work-in-browsers-on-mac-osx-lion

Turn Off New Facebook Chat

Update: The old method won't work. Here's the new method to kill Facebook chat. The solution is to...

First, Click on "Try It Now" in the chat area.

Screen-shot-2011-07-10-at-9

Second, In the options drop down unselect "Available to Chat".

Screen_shot_2011-07-10_at_9

 

Original post:

I logged in to my Facebook account tonight and found that I was also logged into chat. I really hate chat, so I searched how to turn off the new Facebook chat. It's really simple, so I hope that Facebook doesn't kill this link. Also, all your chat messages are stored in your inbox.


First, click on this link:
http://www.facebook.com/presence/popout.php

Second, click on the options drop down and go offline!

Screen_shot_2011-07-10_at_9

Bye Bye FB Chat!

Whatever you do...

Do not click on the chat area at the bottom of the screen or you'll be logged in again!

Screen_shot_2011-07-10_at_9

3 Options for Upgrading to the Asynchronous Google Analytics Tracker Code from the old pageTracker

I ran into an issue last night when I went to upgrade to the new Google Analytics asynchronous tracking code. It turns out that the pageTracker object no longer exists as a global variable.

Instead of using pageTracker._trackEvent(...) to track events, you must instead use _gaq.push(['_trackEvent', ...]).

There are three different options I could have chosen. I ended up choosing the last option.

1. Rewrite all my old pageTracker code to use the new syntax. I.e., change pageTracker._trackEvent(...) calls to _gaq.push(['_trackEvent', ...]);

2. Recreate the pageTracker (which I never verified if this code actually worked)

3. Create a wrapper.

This is the option I went with for one simple reason. I already use a variation of this code for logging tracking events when I debug on my localhost. Here is my full version.

Job Posting on Craigslist is a Waste of Time

Craigslist is no longer an essential stop in my hiring process. I've been using it over the last few years with a few different companies, and have seen it get progressively worse. Just recently, I posted a job on Craigslist to fill a need for a web engineer position at AD:60. Over a week later and we have 19+ companies (on and off shore) and 1 woefully under-qualified applicant.

Hiring managers, does this look familiar?

Junkmail

What part of "Please do not contact job poster about other services, products or commercial interests." don't these spammers understand? Ok, so I've accepted the fact that I'll get spam from job posts on Craigslist. And, yes, hiring is hard. I accept that also. But all spam, and no one qualified?!

The worst part is that craigslist implies that it's much better than Monster and Career Builder for the price. I'd have more faith in that assertion if the studies they cite weren't from 2000 and 2006.

Are there solutions? Does Craigslist care enough?

I will admit one little secret though, I've got the best candidates from an impromptu post on Hacker News.

Wordpress code: Find parent category of blog post

On MyBankTracker.com we introduced a new category structure. For reasons I won't get into, I needed to find the parent category of the current post's category. But, finding the parent category was surprisingly difficult using standard Wordpress functions. Anyways, this code is based on get_category_parents() which can be found in wp-includes/category-template.php. Note: this is tail recursive, so it could be rewritten to be iterative. Feel free to copy and redistribute.

Usage:

As expected, use this code at your own discretion. No support or liability implied by sharing this.

Yojimbo + Dropbox + sleepwatcher

There is a great post on the Yojimbo google group about how to get Yojimbo working on Dropbox. This allows you to synchronize your notes/passwords/etc over more than one computer.

http://groups.google.com/group/yojimbo-talk/msg/9465b1c53650a2b9

The one snag is that you can only have Yojimbo running on one machine at a time. In order to work around this limitation, I've used the command line tool sleepwatcher to monitor when a computer goes idle. I modified the example plist to configure sleepwatcher to run a script that tells Yojimbo to quit after 10 minutes of idling. 

Download sleepwatcher http://www.bernhard-baehr.de/ and follow the basic instructions in the readme.

Here are the scripts to do it.

The AppleScript code to quit Yojimbo: (place in your home directory ~/)

After installing sleepwatcher according to the readme, and creating the above script, we test to see if sleepwatcher is working correctly by issuing the following command. Make sure Yojimbo is open, otherwise it won't close.

$ /usr/local/sbin/sleepwatcher --verbose --idle ~/quit_yojimbo.sh -t 100

This should quit Yojimbo after 10 seconds. Next on to the launch agent.

The launchctl plist to run sleepwatcher on launch. (place in ~/Library/LaunchAgents/)

Note: -t is for time, which is in units of 0.1 seconds; meaning 10 minutes is 6000, not 600. To install the launch agent, run this command (note: no sudo).

$ launchctl load ~/Library/LaunchAgents/de.bernhard-baehr.sleepwatcher-20compatibility-localuser.plist

Update: one additional side note.

If you have OS X 10.6 and Adobe products on your machine, you may see an error when running osascript for the ~/quit_yojimbo.sh script. If that's the case you can ignore the error, or follow the instructions here: http://kb2.adobe.com/cps/516/cpsid_51615.html

It shouldn't matter either way.