Duplicating a tab in Safari

If you are a Safari user on Mac OS X, you may have noticed that it lacks a duplicate tab feature (such as the one in Google Chrome, when you right click a tab area).

While it would be nice to have this added directly into Safari, you can use the following key combination to duplicate tabs currently:

  1. Open/Visit the tab you want to duplicate
  2. Hit the combos: Command + L and then Command + Return (or Enter)

The first combo selects the location bar in Safari, whose default behaviour is to select the fully available link. The second combo asks Safari to open the selected link in a new tab. Together, these help you duplicate an open tab’s link into another new tab.

P.s. This technique will not result in the duplicated tab carrying the history of previous pages as it does in Google Chrome. It merely opens the current page in a new tab.

OS X El Capitan Upgrade Hangs

Just like it did when I upgraded from OS X Mavericks to OS X Yosemite a year ago, attempting an upgrade from OSX Yosemite to OSX El Capitan hung again in the same nondescript manner – a blank/empty screen with the pointer, for seemingly infinite period.

I tried to wait it out for a few hours (surely a 30% filled SSD shouldn’t make it need longer?), but that made no difference. The good bit is that this state is easy to recover from – just hold your power button down until the machine powers off, and then restart it (it will go back into OSX Yosemite or whatever old OS state you had running, without issues)

I ended up recalling the fix I did the last time, i.e. moving /usr/local out of the way, given I’m a heavy Homebrew user, and gave it a try again and the upgrade succeeded in under 20 minutes in the subsequent attempt.

Before the upgrade, I ran in the Terminal.app:

sudo mv /usr/local ~/local

And after the upgrade (with a brew update command just to be sure it is not broken after the move-back):

sudo rmdir /usr/local && sudo mv ~/local /usr/
brew update

Writing a simple Kudu Java API Program

This post is about using Cloudera’s new Kudu service, via its Java API interface, in a Maven-based Java program.

Kudu ships with a Java client library that is ready to use, and also publishes the Java library jars on Cloudera’s Maven repositories. To use within your Maven project pom.xml, add the below to the appropriate areas:

The Repository:

        <name>Cloudera Repositories</name>

The Library:


To start off, you will need to create a KuduClient object, like such:

KuduClient kuduClient =
   new KuduClientBuilder("kudu-master-hostname").build();

To create a table, a schema needs to be built first, and then created via the client. If say we have a simple schema for table “users“, with columns “username(string, key) and “age(8-bit signed int, value), then we can create it as shown below, utilising ColumnSchema and Schema objects over the previously created kuduClient object:

ColumnSchema usernameCol =
    new ColumnSchemaBuilder("username", Type.STRING)
ColumnSchema ageCol =
    new ColumnSchemaBuilder("age", Type.INT8)

List<ColumnSchema> columns = new ArrayList<ColumnSchema>();

Schema schema = new Schema(columns);
String tableName = "users";

if ( ! kuduClient.tableExists(tableName) ) {
    client.createTable(tableName, schema);

Data work (such as inserts, updates or deletes) in Kudu are done within Sessions. The below continuance shows how to insert a row, after creating a Session and a KuduTable for the table “users” and applying the insert object over it:

KuduSession session = kuduClient.newSession();
KuduTable table = kuduClient.openTable(tableName);

Insert insert = table.newInsert();
insert.getRow().addString("username", "harshj");
insert.getRow().addInt("age", 25);


Likewise, you can update existing rows:

Update update = table.newUpdate();
update.getRow().addString("username", "harshj");
// Change from 25 previously written
update.getRow().addInt("age", 26);


Or even delete them by key column (“username”):

Delete delete = table.newDelete();
delete.getRow().addString("username", "harshj");


Reading rows can be done via the KuduScanner class. The below example shows how to fetch only the key column data (all of it):

List<String> columnNames = new ArrayList<String>();

KuduScanner scanner =

while (scanner.hasMoreRows()) {
    for (RowResult row : scanner.nextRows()) {

A fully runnable example can be found also on Kudu’s kudu-examples repository.