Wednesday, April 16, 2014

Javascript Prototypical Inheritance Done Right

This post has moved! Click here to view the new home of this post.

There are a lot of confusing, misleading or outright incorrect tutorials on how to do prototypical inheritance in ECMAScript (commonly known as Javascript). In this post I will explain how to perform inheritance in a memory-efficient and fast manor, while making all of the language tools work correctly.

Friday, October 18, 2013

Versioning For Dummies

This post has moved! Click here to view the new home of this post.

If you are writing a library you need to understand version numbers, otherwise you will create hell for everyone who every wants to use it. There is a formal writeup for this approach on semver.org which I recommend you read, but I am going to go into depth about making your software future proof for you and everyone who uses it.

Why Language Specific Package Managers Exist

This post has moved! Click here to view the new home of this post.

If you are a developer for any language but C, you have probably seen language specific package managers; pip, luarocks, gem, easy_install, the list goes on. But while they may be convenient in the short term I will explain why they suck, and why they are necessary.

Friday, August 23, 2013

Using Systemd to Manage User Sessions

WARNING: This process doesn't work any more. Systemd user sessions are still experimental and volatile and this method no longer works.

If you haven't heard of systemd you should take a look. Basically it is a new /sbin/init process (PID 1). But systemd doesn't stop there, it can also be run as a user to manage arbitrary processes. This article is about replacing the session-manager that comes with your desktop environment (gnome-session, xfce4-session...) with a full-featured process manager.

Friday, August 9, 2013

File Renaming Trick

This post has moved! Click here to view the new home of this post.

For a lot of you it may be pretty obvious but I want to share a quick trick I thought of just now. Often I find myself renaming a file in a sub-directory and find it a pain to type the whole path twice.

mv my/long/path/file.txt my/long/path/newname.txt

However you can use shell expansion to make this easier.

mv my/long/path/{file,newname}.txt

I never thought of it earlier because I think of expansions like when creating multiple arguments of they same type (soruce files, packages to install...), but since the order is predictable it works well for specifying the from and to arguments for the mv and cp commands.