Category Archives: Posts - Page 7

ctrlSwitcher, A Safari 5 Extension


View All My Safari Extensions

On the Ars Technica forums someone mentioned that they’d like to be able to switch between tabs using command + numbers to choose tabs. I took a look at the Safari extension system, and while you can’t override the shortcuts bound to cmd 1-91 for some reason, control is available. An hour or so later and ctrlSwitcher was born.

Features

  • Use a modifier (ctrl by default) + the number keys to instantly jump to a tab. Keys 1 through 0 will go to tabs 1-10, and keys q through p will go to tabs 11-19.
  • Configurable modifier key
  • Configurable “go to last tab” key

Download and Use

  • Download the signed extension and double click to install
  • Pick if you want to use ctrl, opt, or ctrl+opt as your meta keys (default ctrl) in the prefs
  • Now close all tabs or restart your browser. ctrlSwitcher has to load a small script in each loaded tab (empty tabs cannot be switched to/from due to limitations on extensions)
  • Note for Windows users: You will need to switch your default modifier key from ctrl to alt or ctrl+alt to have this tool work.

v1.6:

  • Adds cmd+opt as a choice for key combo (see the commit)

You can view the source on GitHub as well! If you have suggestions for improvements let me know! Bug reports should be directed to the issues page.

  1. cmd-1 through 9 are assigned to bookmarks on your bookmarks bar in Safari

SNI in iOS 4.0

iOS 4.0 supports SNI, which makes it the first mobile OS to support the server_name TLS extension. Hopefully Android, WebOS, WM7, et al follow suit!

(Oh, and I’m not dead. WP 3.0 comes out shortly so expect a major CDN Tools update as well as a brand new plugin!)

jqGrid Local Data Live Search

jqGrid is an incredibly powerful and flexible plugin for jQuery that allows you to build data grids using nothing but Javascript, HTML, and CSS. I recently wanted to allow live filtering of local results (no AJAX queries, just parsing local data) based on a search string. View the demo and then follow along below.

Basic HTML Structure

Below is some very basic HTML that you can use to build a jqGrid.

<html>
  <head>
    <!--snipped necessary JS and CSS includes here-->
    <title>jqGrid Live Search Demo</title>
  </head>
  <body>
    <h2>jqGrid Live Search Demo</h2>
    <table id="list"></table>
  </body>
</html>

Create A Grid

This snippet will create a grid using the “smoothness” jQuery-UI theme. This grid has 3 columns and obtains its data in JSON format from “data.php”. Notice the global declaration of searchColumn and the call to fetch an array of all the data from the name column when the gridComplete event fires. You could grab the other columns as well, but for this example we’re only going to search on name.

var gridimgpath = 'css/smoothness/images';
var grid = jQuery('#list');
var searchColumn;
 
grid.jqGrid({
	url:'data.php',
	datatype: 'json',
	mtype: 'POST',
	colNames: ['Name','Data','Date'],
	colModel :[ 
	  {name:'name', index:'name', width:140}, 
	  {name:'data', index:'data', width:200},
	  {name:'date', index:'date', width:200},
	],
	sortname: 'date',
	sortorder: 'asc',
	caption:'Search: <input type="search" id="gridsearch" placeholder="Search" results="0" class="gridsearch" />',
	viewrecords: true,
	loadonce: true,
	width: 750,
	forceFit: true,
	height:130,
	gridComplete: function() {
		searchColumn = grid.jqGrid('getCol','name',true) //needed for live filtering search
	}
  });

Live Filtering

This is the simple code that allows us to live filter on the grid. It will hide any id that doesn’t match the string you’re entering. The search is case insensitive.

//for live filtering search
jQuery('#gridsearch').keyup(function () {
	var searchString = jQuery(this).val().toLowerCase()
	jQuery.each(searchColumn,function() {
		if(this.value.toLowerCase().indexOf(searchString) == -1) {
			jQuery('#'+this.id).hide()
		} else {
			jQuery('#'+this.id).show()
		}
	})
})

Known Issues

At the moment if the first row is hidden the grid becomes unaligned from its headers (and live resizing of the columns does not work). This issue can be hidden by making all the headers the same width, but if a user resizes the problem will be visible again. There is a bug open on github to correct the issue.

Ubuntu 10.04 in VMWare Fusion

I installed the 10.04 LTS (Lucid Lynx) 64-bit alpha 3 this morning to check out some of the new features. And since I’ve done a few other articles about running Ubuntu in a VM I thought I’d share the experience yet again.

If you’re running VMWare Fusion 3.0+ (or the current release of Workstation 7) then the version of VMWare Tools you have with your software can successfully install with no manual intervention. Simply pick easy install and let VMWare do all the work.

If you’re running an older version you will want to take a look at my Ubuntu 9.10 instructions for help with getting open-vm-tools running for you in 10.04.

I’ll update this article if anything changes (the kernel freeze for Lucid Lynx is not until March 11).

SNI Support in Chromium OS X

As of r39934 Chromium now supports the server_name TLS extension (server name indication) in OS X (latest build). This support requires OS X 10.5.7 or later. Hopefully it’ll make its way into a dev/beta/stable release of Google Chrome itself soon.

For those who are more curious than they ought to be about how I wrote this patch… Apple added support in their Secure Transport library for the server_name TLS extension, but has not updated their documentation. As of 10.5.7 (or possibly 10.5.6) the SSLSetPeerDomainName function — which is ostensibly used for OS level certificate verification — causes OS X to send the server_name extension in the TLS client hello. However, since Chromium doesn’t use OS X’s built-in verification it wasn’t passing this data through prior to the patch.

To test you can hit up my IDN SNI site https://☣.ws/ or https://alice.sni.velox.ch/. The former will throw a certificate error if you are on a non-SNI enabled browser and the latter will have text stating that the SNI extension is missing.

5D Mark II Video – One Year In

When I purchased my 5D I told myself I’d try my hand at a video. Well, one year later I’ve finally worked up the ambition to learn some video editing and publish something This video represents the past year of owning this camera. I learned a great deal in the process (mostly about how to shoot better source footage for the future), but I hope you all enjoy it. Click here to go to the Vimeo page to view in HD or download the original 1080p source. The non-HD (bleh) version appears below1.

5D Mark II One Year from Paul Kehrer on Vimeo.

  1. Hopefully a decent embeddable HTML5 player will come along soon so I can scrub the Flash from this blog.