Untar to a specific target directory

tar xvf /opt/metricbeat.tar.gz -C /opt/metricbeat --strip-components=1
If the tar-file already contains a directory, you have to add –strip-components=1. Otherwise the directory contained in the tar files is created. Also mind that the directory used for -C has to exist beforehand.

Install node.js and npm on Windows without admin permissions

See the following links:

  • http://abdelraoof.com/blog/2014/11/11/install-nodejs-without-admin-rights/
  • http://theshravan.net/blog/how-to-use-node-and-npm-without-installation-or-admin-rights/

Based on that perform the following steps, if you cannot use the Windows installer provided by nodejs.org

  1. Download node.js from https://nodejs.org/en/download
  2. Put it in a separate folder and add the folder to your „path“ environment variable. Shortcut: CMD+R and enter: rundll32 sysdm.cpl,EditEnvironmentVariablesOpen a new command window (CMD+R) and type node -v. This should show the current version.
  3. Download npm from github.  https://github.com/npm/npm
  4. Extract the zip folder and put it into your node.js folder
  5. For convenience put the npm.cmd aside to the node.exe
  6. Add the npm-folder to the path env variable (see step 3)
  7. Edit the npm.cmd file and change the following line SET "NPM_CLI_JS=%~dp0\npm\bin\npm-cli.js" to match the path to bin\npm-cli.js. Mind: %~dp0 expands to the path where npm.cmd resides
  8. Type npm -v to verify the installation
  9. In case your behind a proxy set the npm proxy by npm config set proxy http://user:pwd@proxy-server:port

Using Magic Keyboard with Mac and Windows Computer

It is no problem to use an Apple Bluetooth Magic Keyboard with a Mac and an Windows computer. The following steps should be taken into account:

1. If the Magic Keyboard was first paired with the Mac, you have to unpair it before you pair it with Windows computer.
2. Afterwards pair the keyboard again with your Mac.
3. Obviously 🙂 Disable Bluetooth on the computer you’re not using. if you’re using them side by side.

Apache Spark 2.0: select * from

How to query a „regular“ databases (DB2 in this example) via JDBC in Apache Spark 2.0.

final Dataset result = this.sparkSession.read().format("jdbc").options(this.options).load();

Where „this.options“ is filled like

this.options.put("driver", "com.ibm.db2.jcc.DB2Driver");
this.options.put("url", "jdbc:db2://host:port/db2_database");
this.options.put("dbtable", sql_statement");

Important to notice is to wrap sql_statement like this:
(select * from table) as tmp_table

because Spark converts this to

select * from (select * from table) as tmp_table

Using the select without brackets does not work.

New note taking app: Buno

There’s a new note taking app around the the corner: Buno

The most interesting features are

  • end-2-end encryption
  • a very stylish, minimalistic design

Up to now, only an iOS and an Android app is available. As soon as there is a web client or a native Mac app available, I’ll definitely give it a shot, even though I’m a loyal Evernote user since 2008.

Linux: issues with partially installed packages

I had issues with partially installed packages on my Ubuntu 15.04. This helped

sudo rm -rf /var/lib/dpkg/updates/*
sudo rm -rf /var/lib/apt/lists/*
sudo rm /var/cache/apt/*.bin
sudo apt-get clean
sudo apt-get autoremove
sudo apt-get update
sudo dpkg --configure -a

sudo apt-get install -f
or refer to https://wiki.ubuntuusers.de/Paketverwaltung/Problembehebung/#Die-Installation-Deinstallation-von-Paketen-endet-mit-Fehlermeldungen (in German)