Category Archives: General

Store a Semantic Versioning String in a 32-Bit Integer

Semantic Versioning is a specification, which describes how version strings should be handled. It works by having MAJOR, MINOR and PATCH versions in a dot-separated string. Example:

MAJOR.MINOR.PATCH

2.5.3

I needed to store this string in a single 32-bit integer due to system limitations, so I wrote two handy, well-documented functions in ES6. Let’s convert the version string “2.5.3” into an integer:

let numericVersion = convertVersionToInt32('2.5.3'); // 3150850
let version = convertInt32VersionToString(numericVersion); // "2.5.3"

Warum ich @PokeListener abstelle

TL;DR for English readers: I am shutting down a Twitter bot which was tweeting the location of rare Pokémon on Pokémon Go because of a cease and desist order from Niantic.

 

Ich habe im August 2016 einen Twitter Bot programmiert, der seltene Pokémon der App Pokémon Go in der Stadt Luzern ankündet. Der Bot verstösst gegen die Nutzungsbedingungen von Niantic, da er inoffizielle API-Anfragen an deren Server schickt, um so die seltenen Monster zu finden. Nun habe ich eine Abmahnung von Niantic erhalten und mich entschieden zu kooperieren. Ab sofort wird @pokelistener keine Tweets mehr von sich geben und der Code hinter dem Account wird gelöscht.

Ich danke allen ~840 Follower für ihr Verständnis und positives Feedback über die letzten Wochen. Ebenfalls ein Danke an die Facebook-Seite Pokémon Go Luzern und Sandro Bucher von 20 Minuten für ihre jeweiligen Beiträge, welche den Bot unter Pokémon Go Spielern in Luzern berühmt gemacht haben.

– Patrick Muff

How to Programmatically Print Labels/Barcodes on a Zebra Printer

Here are a few things you need to know for when you want to print labels/barcodes using a Zebra Technologies printer.

Once you’ve figured this stuff out it’s actually pretty easy to embed a Zebra printer into your environment. I hope this has saved you some time.

Accessing JavaScript Properties via a Dot Notation String at Runtime

Problem

You have something like the following object and a string which you would like to use to access a property on said object:

{
  common: {
    de: {
      library: 'Bibliothek',
      manufacturer: 'Hersteller'
    }
  }
}
"common.de.library"

Solution

var accessPropertyViaString = function(object, keys) {
  try {
    return keys.split('.').reduce((prev, curr) => prev[curr], object) || keys;
  } catch (ex) {
    return keys;
  }
};

This function returns the value of the wanted property. If it can’t find the property it will return the input string. Please do not try to solve this problem using eval() for reasons explained in this answer on StackOverflow.

NVIDIA Web Driver Broken After OS X Update

NVIDIAs alternate drivers for OS X usually break after a minor system update. You can fix this most of the time by modifying the following file:

/System/Library/Extensions/NVDAStartup.kext/Contents/Info.plist

Change the NVDIARequiredOS to your current system version which can be found in the app System Information. The version number should look something like this:

14F1021

Write it into the file and save it (sudo access is needed).

Bildschirmfoto 2015-10-23 um 07.54.24 Kopie

You should now rebuild your kext cache:

sudo kextcache -system-prelinked-kernel
sudo kextcache -system-caches

Reboot. Select the NVIDIA web drivers in your system settings and reboot once more. Done.

Smoother/Faster CSS Animations

If you have ever experienced slow/”buffering” CSS animations then it’s probably because you don’t know about this article. Basically, instead of animating the position properties “top”, “right”, “bottom” and “left”, you animate “transform: translate”. On most browsers this activates hardware acceleration, meaning it will use the computers graphic chip instead of the CPU and will therefore produce smoother animations.