Spotify on Debian GNU/Linux in Canada

Today I decided to try out the free ad-sponsored Spotify music streaming service. It has been available in Canada since September 2014.

After signing up you can immediately use the flash-based web player at play.spotify.com.

Installing the client app

Alternatively you can download and install the Spotify client app. I cannot say yet what the advantages or disadvantages are, maybe reading this article can be helpful.

Anyway, if you want to try the client app, for Debian (or Ubuntu) users it works like this:

  1. Add the repo key (to verify downloaded packages)
  2. Add the spotify repo to apt sources
  3. Update apt caches
  4. Install the spotify client

Here are the shell commands (requires sudo):

sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys BBEBDCB318AD50EC6865090613B00F1FD2C19886
echo deb http://repository.spotify.com stable non-free | sudo tee /etc/apt/sources.list.d/spotify.list
sudo apt-get update
sudo apt-get install spotify-client

After successful installation you will find a “Spotify” entry in the “Multimedia” section of your start menu.

Using your Facebook login

If you use your Facebook account to sign into Spotify you will probably see this question:

Spotify would like to post to Facebook for you.
Who do you want to share these posts with?

It is safe to choose “Not Now” which prevents Spotify from posting to your timeline. The login will still work.

If your are using the downloaded stand-alone client app and the Facebook login fails with an error page, then simply enter the email address and password from your Facebook account into the login fields of the Spotify client app.

Spotify says that it only uses these credentials to pass through to the Facebook authentication and won’t store your password anywhere. I hope that’s true.

Decorate your thoughts my dear : Unicode 8 supports 1051 Emojis

unicode-monkey-face Have you noticed how email subjects, chat messages and other traditional “plain text” content more and more often contains smileys, ideograms, pictograms and other funny symbols?

For example, you can probably see the faces of mouse, bull, cat and monkey right here: 🐭 🐮 🐱 🐵

These expressive tiny pictures are also known as Emojis and can be seamlessly mixed into the letters, numbers, punctuation marks and few traditional “special characters” that most of us know from the computer (or even typewriter?) keyboard.

This is possible because on todays digital devices all of us, whether we know it or not, use an international standard called Unicode that supports all letters and symbols from all official languages and writing systems on our planet (and even Klingon, by the way). And as an extensible standard, Unicode keeps growing and recent versions have increasingly incorporated non-alphanumeric symbols.

For example, there is a whole Unicode block of smileys and cat faces that was added in Unicode version 8 to incorporate a set of symbols that Japanese mobile carriers had already added to the Shift JIS character encoding: 😀 😁 😂 😃 😄 😅 😆 😇 😈 😉 😊 😋 😌 😍 😎 😏 😐 😑 😒 😓 😔 😕 😖 😗 😘 😙 😚 😛 😜 😝 😞 😟 😠 😡 😢 😣 😥 😦 😧 😨 😩 😪 😫 😭 😮 😯 😰 😱 😲 😳 😴 😵 😶 😷 😸 😹 😺 😻 😼 😽 😾 😿 🙀

With the now ubiquituous support of Unicode by computer operating systems, internet services and mobile devices, we are no longer limited to the 90° tilted “ASCII emoticons” using character sequences like :^). With Unicode we can use emojis as single symbols of their own right.

This leads to the question how to enter emojis using your keyboard, be it a physical computer keyboard or through the on-screen touch keyboards on your modern mobile devices. It is possible, with varying degrees of convenience on Apple, Android, Windows or Mac computers and many other devices.

Unfortunately, UI level emoji support on GNU/Linux systems is practically non-existent which effectively limits Linux users to copy/paste from “cheatsheets” or the official Unicode 8 charts with their 1051 emoji and symbol codepoints.

One tip for Debian based systems: Make sure to have the Droid and Symbola fonts installed:

sudo apt-get install ttf-ancient-fonts fonts-droid

Then you can write a chess game for the text console using these Unicode glyphs from the “Miscellaneous Symbols” Unicode block: ♔ ♕ ♖ ♗ ♘ ♙ ♚ ♛ ♜ ♝ ♞ ♟

Or roll the dice: ⚀ ⚁ ⚂ ⚃ ⚄ ⚅

PS: All characters in this blog post are ok to recycle ☺ : ♲ ♳ ♴ ♵ ♶ ♷ ♸ ♹ ♺ ♻ ♼ ♽

As always, please feel free to respond in the comments section below.

JVM tips – The G1 Garbage Collector

An old wisdom says that Software can be optimized for latency, throughput or footprint. The same is true for the JVM and its Garbage Collector(s).

Roughly speaking, the classic GC implementations each optimize for one aspect: Serial GC optimizes footprint, Parallel GC optimizes throughput and Concurrent Mark and Sweep (CMS) optimizes for response times and minimal GC induced latency.

But since JDK7u4, we officially have the “Garbage First” (G1) GC. It is still new enough to not even have its own Wikipedia article, but there are good introductory tutorials, articles and tuning guides.

In several ways, G1 is a step up from the conventional GC approaches: It uses non-contiguous heap regions instead of contiguous young and old generations and does most of its reclamation through copying of the live data, thus achieving compaction.

It is based on the principle of collecting the most garbage first and designed with scalability in mind, without compromising throughput.

The benefits of G1 have lead to a proposal and lively debate about Defaulting to G1 Garbage Collector in Java 9.

In conclusion, you can either take the easy path and use the default JVM settings or take some time to learn about modern GC choices and tuning options.

And if you get it all right you might be rewarded with your Java based services performing better than ever before … :)