Monday, October 28, 2013

Disable Java 7 and 8 in the Browser Manually on Mac

To disable Java 7 and up in the browser on Mac open Terminal and run the following three commands: 1. Change directories to the Oracle Application support directory.

cd /Library/Application\ Support/Oracle/Java
2. Remove the Info.plist (ls -al should show that it points to the Enabled.plist)
sudo rm -r -f Info.plist
3. Create a new Info.plist that points to the Disabled.plist
sudo ln -s /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin/Contents/Disabled.plist Info.plist
This will completely disable the Java plugin from running from within the browser. You can also do this from the Java Control Panel, but there are times when this is preferred. Note that this change will be remembered after upgrades because of how the installer works it will not modify this symlink, it will only create it if it does not exist and point it to the Enabled.plist.

Tuesday, May 21, 2013


This last weekend I went to the Maker's Fair and got a free breadboard Arduino. What a swag score After making a blinky light I decided to order a few parts from SparkFun Electronics and decided to toy around with a 7-segment display (I now wished I had gotten something a bit more challenging, but hey, I haven't done electronics in a long time). I followed the tutorial here and noticed many Arduino examples don't use objects. So, here is a version of the SparkFun 7-segment display example using objects.

/* Serial 7-Segment Display Example Code
    Serial Mode Stopwatch
   by: Jim Lindblom
     SparkFun Electronics
   date: November 27, 2012
   license: This code is public domain.
   This example code shows how you could use software serial
   Arduino library to interface with a Serial 7-Segment Display.
   There are example functions for setting the display's
   brightness, decimals and clearing the display.
   The print function is used with the SoftwareSerial library
   to send display data to the S7S.
   Arduino -------------- Serial 7-Segment
     5V   --------------------  VCC
     GND  --------------------  GND
      8   --------------------  RX

class LED
    // These are the Arduino pins required to create a software seiral
    //  instance. We'll actually only use the TX pin.
    int softwareTx;
    int softwareRx;
    SoftwareSerial *s7s;
      s7s = NULL;
    void initialize()
        softwareTx = 8;
        softwareRx = 7;
        s7s = new SoftwareSerial(softwareRx, softwareTx);
        // Must begin s7s software serial at the correct baud rate.
        //  The default of the s7s is 9600.
        // Clear the display, and then turn on all segments and decimals
        clearDisplay();  // Clears display, resets cursor
        s7s->print("-HI-");  // Displays -HI- on all digits
        setDecimals(0b111111);  // Turn on all decimals, colon, apos
        // Flash brightness values at the beginning
        setBrightness(0);  // Lowest brightness
        setBrightness(127);  // Medium brightness
        setBrightness(255);  // High brightness
        // Clear the display before jumping into loop
      if (s7s != NULL)
        delete s7s;
    void printDisplay(int value)
        char tempString[10];  // Will be used with sprintf to create strings
        // Magical sprintf creates a string for us to send to the s7s.
        //  The %4d option creates a 4-digit integer.
        sprintf(tempString, "%4d", value);
        // This will output the tempString to the S7S
    // Send the clear display command (0x76)
    //  This will clear the display and reset the cursor
    void clearDisplay()
      s7s->write(0x76);  // Clear display command
    // Set the displays brightness. Should receive byte with the value
    //  to set the brightness to
    //  dimmest------------->brightest
    //     0--------127--------255
    void setBrightness(byte value)
      s7s->write(0x7A);  // Set brightness command byte
      s7s->write(value);  // brightness data byte
    // Turn on any, none, or all of the decimals.
    //  The six lowest bits in the decimals parameter sets a decimal 
    //  (or colon, or apostrophe) on or off. A 1 indicates on, 0 off.
    //  [MSB] (X)(X)(Apos)(Colon)(Digit 4)(Digit 3)(Digit2)(Digit1)
    // Example: setDecimals(0b00000100);  // Sets digit 3 decimal on
    void setDecimals(byte decimals)

unsigned int counter = 0;  // This variable will count up to 65k
LED Led;

void setup()

void loop()
  Led.setDecimals(0b00000100);  // Sets digit 3 decimal on
  counter++;  // Increment the counter
  delay(100);  // This will make the display update at 10Hz.

Sunday, September 30, 2012

JavaOne 2012

I'll be at the JavaFX booth and the talks about Java on the Mac so come up and say "hi!" if you're around!

Thursday, July 26, 2012

Make the Apple Magic Trackpad Ergonomic

I've been using the Apple Magic Trackpad and found that it is not terribly ergonomic because it slants up to match the keyboard angle which forces the wrist to slant upwards. The Magic Trackpad can be made much more ergonomic by simply turning it around (I got my directions from here). In order to turn it around the coordinate system must be reoriented. To do that, type this into the terminal:

defaults write TrackpadOrientationMode 1

sudo defaults write ForceAutoOrientation YES
NOTE: Both commands might not be required but I couldn't get it to work otherwise on Lion or Mountain Lion. Then disconnect the Magic Trackpad, shut it off, reboot the Mac, reorient the Magic Trackpad and until the system is booted. Then turn on the Magic Trackpad and rest 5 finger tips spread out (like you are playing piano) on the Magic Trackpad and move them away from you. Viola! I have also found the settings tap-to-click and 3-finger drag to be useful and can be enabled in the trackpad control panel. To Remove the settings type:
defaults remove TrackpadOrientationMode
sudo defaults write ForceAutoOrientation NO

Monday, June 25, 2012

Virtual Box VM to VMWare

I prefer either Parallels or VMWare over Virtual Box. Virtual Box is free though. But at 50 bucks, video acceleration is nice to have when working with graphics. So here are steps that work as of today to convert a Virtual Box VM to a VMWare VM. These steps are out there on the interwebs and they aren't difficult but I didn't find them in one place so hopefully this will help someone.

1. From Virtual Box select your VM and choose File | Export Appliance...
2. Download and install VMWare OVF Tool from
3. Run the OVF Tool on you .ova file (I'm on a Mac):

"/Applications/VMware OVF Tool/ovftool" --lax image.ova /Users/[username]/Downloads
NOTE: Use the --lax option to get past some errors that will stop the conversion in their tracks. 4. Drag and drop into VMWare and before you do anything increase the available RAM and processor to at least 2 if you can. Otherwise the Vm will be super sluggish. 5. Run in VMWare!

Monday, June 18, 2012

JavaFX Native Packaging

One of the benefits of native programming languages has been fairly easy deployment and bundling. In many cases static libraries one single EXE. Programming languages that depend on a run-time such as C#, Java, Python, Perl, etc, all require that run-time to be pre installed and the total size (Application + run-time) is typically larger than a native application. Well, I think much of that is over with JDK 7u6 currently in beta. Rich client JavaFX applications can bundle the JRE and your application and provide a very easy installation. So easy in fact it's silly. I love making complicated things super easy! Check out this blog post by one of my colleagues for all the nitty gritty details:

Monday, May 14, 2012

JDK 7 Beans.setDesignTime/Beans.isDesignTime

JDK 7 introduces a change to Beans.setDesignTime(bool value) and Beans.isDesignTime() where the design-time state instead of application global is now a thread group local variable. It's so multiple frameworks can be used simultaneously and they can be either design-time or run-time as needed. Basically it is an IDE requirement. Needless to say this change is a bit unorthodox with a bizarre side effect and most will want to bring back the old behavior. The simplest way of doing this is to iterate over each thread group and set the design-time state.

  Runnable runnable = new Runnable()
    public void run()

  ThreadGroup root = Thread.currentThread().getThreadGroup();
  while (root.getParent() != null)
    root = root.getParent();

  ThreadGroup[] threadGroups = new ThreadGroup[root.activeGroupCount()];
  // ThreadGroup.enumerate copies all ThreadGroup subgroups, not including the root ThreadGroup.
  root.enumerate(threadGroups, true);

  new Thread(root, runnable).start();

  for (ThreadGroup group : threadGroups)
    new Thread(group, runnable).start();
If any thread groups are created after this code is run then design-time will not be set. So the best practices are all thread groups need to have design-time set, or any calls to Beans.isDesignTime() need to be synchronized to the EDT.

Tuesday, April 3, 2012


My group is hiring a couple C/C++ and Java developers focused on security based in Santa Clara CA. If interested contact me via the "Contact Me" link on the right.

Monday, March 26, 2012

You can X...if you X

A friend posted the blog post You can draw...if you draw and I think it is so good I'm going to talk about it!

Replace X in the title with anything you want to do. The Missus and I are in the process of teaching this to our 5 year old using the violin. 3 minutes a day for the last 6 months and she can now play at talent shows at school. She didn't believe us at first. But now she is well on her way to being able to play the violin as good as her Grandpa; with lots of practice. Practice practice practice.

I learned how to ride a unicycle 2 years ago. Now I mountain unicycle all over the Santa Cruz mountains. I hear from people all the time "I could never do that". It turned out to be such a good workout the Missus picked it up, my sister became addicted and our 5 year old is learning as well.

I do think some people are inherently more skilled at certain things, but that doesn't mean with practice and perseverance one can't do anything they set their mind to. Honestly that's one of the reasons I get so annoyed at the current hiring practices for software engineers and alluded to in this post. I've interviewed countless people who I think could do the job. And the question usually isn't "are they smart", the quest that should be answered is "are they a team player". I'd rather have a whole bunch of average people that can learn and work as a team than a couple rock stars with a complex.

So what is it that you want to learn to do?

Thursday, March 8, 2012

New iPad

My take on this is the resolution is pretty awesome, but other than that I see no reason for original iPad or iPad 2 owners to upgrade. Especially since the weight has increased. As far as I'm concerned the size of the battery should have been reduced to decrease the weight. However, if I were buying an iPad today I'd have to go for the new iPad 32GB because 16 fills up rather fast, but that makes it a $200 price increase which is pricy.

By the way, I picked up the "YOOBAO Red Genuine Leather Slim Case Portfolio Case For Apple iPad 2" and it's really nice.

Monday, March 5, 2012


It seems that dual monitors has finally hit the mainstream. Article after article comments on research that people are more productive with dual monitors than with one monitor. I really dislike dual monitors. Sure, it's more productive, but nobody ever mentions the whiplash one can get from using the off center monitor too often. No, I prefer one big monitor with a high resolution for most tasks. 24", 27" or 30". I think if they went back and did their research with everyone running a 30" monitor they'd find people are even more productive than with dual monitors. The advantage is price. Small monitors can be picked up for a few hundred bucks while a very large high resolution display is considerably more. But once you factor in the chiropractic bill I'm sure the savings would more than justify the large monitor.

Note: I am in no way benefiting from you buying a large display from the likes of Dell, Viewsonic, Samsug, LG, etc.

Tuesday, February 28, 2012

Bret Victor - Inventing on Principle

Yesterday I posted a little bit about what our ideas of a software developer are. Here is a video that is along those same lines. I warn you, the video is a little long, the concept and analogies are a bit odd but it's still worth watching: