Change default VPN host in Cisco AnyConnect Mobility Client for OSX

I was constantly annoyed at changing the hostname in my Cisco VPN client. I found a few resources on how to change the default host to connect to on Windows but OSX proved harder. So hopefully, this will help somebody else. It’s actually pretty simple when you know where to look:

vi ~/.anyconnect # Then edit the XML entry for DefaultHostName

If you are a consultant who works with multiple companies and VPNs then you’ll probably find this useful one day too.

Advertisements

2010 13″ MacBook Air cannot create bootable USB stick

After hours of banging my head against the wall trying to create bootable USB sticks on my laptop, I stumbled across this useful titbit of information:

Please notice: While all of the info and above commands are executed properly on a MacBook Air 3,2 (that is the 2010 version 13″ version of the Air) the end result will not produce a bootable USB device, at least not with the image for Ubuntu 10.10 64-bit. When booting of the USB device the following message or something similar will appear: “Missing operating system” and the process is auto-magically halted.

May be useful to somebody. They have a series of steps on the How to install Ubuntu on MacBook using USB Stick page to workaround this but it’s much easier to just find and use another Mac.

Sublime Text / Package Control: error executing: /usr/bin/security dump-trust-settings -d

I received this error when starting Sublime Text after upgrading to El Capitan. The author of package control is aware of the issue (https://github.com/wbond/package_control/issues/1002) and is working on it but if it annoys you enough to do a workaround, here it is.  Remove all of the certificates from your Keychain that are shown when you run the same command: `/usr/bin/security dump-trust-settings -d`

My output looked something like this:

Number of trusted certs = 5
Cert 0: stuff.co
Number of trust settings : 1
Trust Setting 0:
Policy OID : Apple X509 Basic
Allowed Error : CSSMERR_TP_CERT_EXPIRED
Result Type : kSecTrustSettingsResultTrustRoot
Cert 1: GTE CyberTrust Global Root
SecTrustSettingsCopyTrustSettings: The specified item could not be found in the keychain.
Cert 2: Class 3 Public Primary Certification Authority
SecTrustSettingsCopyTrustSettings: The specified item could not be found in the keychain.
  1. Open Keychain
  2. click on your login keychain
  3. Go to the search box
  4. Type in the name shown in the Cert <n>: field (in this case stuff.co)
  5. Select the Certificate entry that is shown in the results
  6. Right-click -> Delete “…”
  7. Enter your password (twice for me)

Continue until you run the dump-trust-settings command and get

SecTrustSettingsCopyCertificates: No Trust Settings were found.

Down to one remote with HDMI-ARC and HDMI-CEC functionality

One of my biggest complaints about getting a home theatre system was the need for multiple remotes.  I know you can buy an all-in-one remote that will manage everything for you but for whatever reason I didn’t do that. I just bought a Samsung Smart TV and decided to look into the state of TV remotes again.

228550581

Last night I learned that I was just ignorant of some progress that had been made in this area by two standards: HDMI Audio Return Channel (HDMI-ARC) and HDMI Consumer Electronics Control (HDMI-CEC).  Using these two technologies, I have tied all of my devices together under one remote control.  I push one power button and everything turns on. I push the volume up button on the TV remote and my receiver volume increases.  I want to go to bed and I hit the power button on the TV and both the TV and receiver turn off.  This is the way things always should have been.

Let’s start with HDMI-ARC.  This is quite simple in concept but solves the persistent issue of how do you get audio from the TV back to your receiver.  Most setups I have done and seen involve Blu-ray players, cable STBs and PS3s sending their video and audio to your home cinema receiver then the receiver sends the video to the TV.  Basically, your TV is a dumb monitor.  This all changed when I got my Samsung Smart TV and tried to watch Netflix on it for the first time.  My picture quality was fine but all the audio was coming from my TV!  Enabling the HDMI-ARC on the TV and my Onkyo receiver solved that problem and now it makes no difference where the audio comes from, my receiver can find it.

Next is HDMI-CEC.  You will find this under various brand names like VIERA Link or Anynet+ but they are mostly compliant with the HDMI-CEC standard.  What it allows you to do is send commands over the HDMI cable so when your TV powers up and it’s on the cable input, it tells your cable box to power up too.  When you switch to Blu-ray, it turns that on for you.  My TV also automatically tied into my receiver’s volume control so when you change the volume on the TV it is actually changing the volume on my home cinema receiver.

Sounds like paradise, right?  Well, I have managed to get things gummed up a couple of times and had to reboot everything a couple of times already but I’m hoping that it’s because I don’t have it all hooked up correctly yet.  Also, you’ll probably still need your Tivo remote to do some Tivo things and your Blu-ray remote to do some BD things.  But I’m okay with that.  If I can use one remote 90% of the time then I’m happy.

Managing window.onbeforeunload in Javascript

I struggled with this quite a bit because there is a lot of information on the web that is conflicting. I wanted a way to tell the user that they had unsaved changes when they tried to leave an editing page but not get the warning when they hit the save button. This seems like a logical user experience to me!  The trick I found was to create a flag that the event handler checks to know whether you are in the middle of a save or not. To be slightly more generic, I called it showUnsavedChangesWarning and defaulted it to true. Here is the code I ended up with:


top.showUnsavedChangesWarning = true;
window.onbeforeunload = function (event)
{
if (top.showUnsavedChangesWarning) {
var e = event || window.event;

// If we have unsaved changes, tell the browser to show a confirmation window
var message = null;
var document = Editor.getActiveDocument();
if (document != null && document.hasUnsavedChanges()) {
message = 'You have not saved changes in your file.';
// Firefox 4 doesn't let you specify the text but does popup a warning.
// For IE and Firefox prior to version 4
if (e) {
e.returnValue = message;
}
// For Safari
return message;
}
}

// otherwise just fall through and return nothing
};

You won’t have the Editor object unless you’re also working with Xopus but you get the idea. The interesting details here are:

  1. Don’t return anything if you want the browser to just continue on. Some sites recommended null, some the empty string. The only thing that works consistently for me is not returning anything.
  2. Safari seems to have different handling from everyone else
  3. Firefox4 doesn’t let you display a custom message anymore. You can of course display your own confirm dialogue but they’ve removed the ability for you to stick custom text into a Firefox application dialogue. I think this is a good decision.

Hopefully this helps you too.