How to enable telnet in Windows 10

Turns out it’s not only Windows 8 that has its telnet client disabled, Windows 10 is in the same boat. I’ve been using Windows 10 for quite a while now and just discovered this issue. Anyway, the way to enable is as follows:

  • Right click on the start button
  • Select “Programs and Features”
  • “Turn Windows features On or Off”
  • Select ‘Telnet client’ in the dialog box that appears, like here:Job done.

Lisp like filtered container views in C++

Lisp dialects like Clojure have a very rich set of algorithms that can present altered views on containers without modifying data in the underlying container. This is very important in functional languages as data is immutable and returning copies of containers is costly despite the containers being optimised for copy-on-write. Having these algorithms available prevents unnecessary data copies. While I am not going into mutating algorithms in this post, the tradition of non-modifying alghorithms that work on containers leads to an expressiveness that I often miss in multi-paradigm languages like C++. As an example I will show you how to use a filtered container view in C++ like you would in Clojure.

Read More

Cherry pick and merge revisions in Mercurial

I’ve mentioned before that I prefer Mercurial to Git, at least for my own work. That said, git has a nice feature that allows you to cherry pick revisions to merge between branches. That’s extremely useful if you want to move a single change between branches and not do a full branch merge. Turns out mercurial has that ability, too, but it goes by a slightly different name.

There are actually two options in Mercurial – the older transplant extension and from Mercurial 2.0 onwards, the built-in graft command. I prefer to use the graft command, mainly because it is built into base mercurial and thus is available everywhere as long as one is running Mercurial 2.0 or up. Given that the current release is 4.0.1 as of the time of writing, you should really run something newer than 2.0. Also, graft uses mercurial’s merge abilities to cherry pick the change, you have a somewhat better chance of the change applying cleanly. Transplant uses the patch mechanism with works reasonably well, but in my opinion the merge system works better especially if you’re dealing with something that turns into a three way merge.

Usage is pretty simple – switch to the branch that you want to graft a change onto (the destination branch) and then graft away using the revision number of the change you want to use. Say, you want to graft a change 9534 to the release_356 branch:

hg co release_356
hg graft 9534

Note that hg graft does a merge and commit of the specific revision in one step as long as you don’t encounter a merge conflict. If you do encounter a merge conflict you’ll have to resolve it like you would resolve any other merge conflict, followed by a manual commit.

hg graft has additional functionality over and above simple cherry picking of one revision. For example, you can graft a range of revisions onto another branch. Have look at the documentation for hg graft for more information.

Mutt regex pattern modifiers

I still use the mutt email client when I’m remoted into some of my FreeBSD servers. It might not be the most eye pleasing email client ever, but it’s powerful, lightweight and fast.

Mutt has a very powerful feature that allows you to tag messages via regular expressions. It has a couple of special pattern modifiers that allow you to apply the regex to certain mail headers only. I can never remember so I’m starting a list of the ones I tend to use most in the hope that I’ll either remember them eventually or can refer back to this post. The full documentation can be found here, so this is only a cheat sheet that reflects my personal usage of the mutt regex pattern modifiers.

~f – match from
~t – match to
~c – match cc
~C – match to or cc
~e – match sender

What happened to XEmacs?

I used XEmacs quite a lot in the 2000s before I switched back to the more stable GNU Emacs. That was back then before GNU Emacs offered a stable official Windows build when XEmacs did, and at the time I was doing a lot of Windows development.

Out of curiosity and for some research I tried to look into the current state of the project and found that the www.xemacs.org appears to be unreachable. The domain still exists and according to whois was last updated in September 2015. The XEmacs Sourceforge page is still around, but appears to have received its last set of updates in 2009. Obviously a lot of links to the bug tracker, mailing list hosts etc are dead as they’re point to subdomains of xemacs.org.

Anybody know what happened to the project? The only reference I found was a post from January 2016 on a website I’ve never heard of (8ch.net) referencing a post on the XEmacs development that I can’t get at anymore (becauses lists.xemacs.org is dead) that suggests XEmacs development is officially dead now.

Picture showing "About This Mac" after I upgraded the CPU

Bit the bullet and upgraded my Mac Pro’s CPU

I’ve been an unashamed fan of the old “cheese grater” Mac Pro due to its sturdiness and expandability. Yes, they’re not the most elegant bit of kit out there but they are well built. And most importantly for me, they are expandable by plugging things inside the case, not by creating a Gordian Knot of hubs, Thunderbolt cables, USB cables and stacks of external disks all evenly scattered around a trash can. Oh, and they’re designed to go under a desk. Where mine happens to live, right next to my dual boot Linux/Windows development box.

Read More

Switching to Manjaro Linux and getting an AMD RX 470 to work

I’ve been a Xubuntu user for years after switching from OpenSuse. I liked its simplicity and the fact that it just worked out of the box, but I was getting more and more disappointed with Ubuntu packages being out of date, sorry, stable. Having to rebuild a bunch of packages on every install was getting a little old. Well, they did provide material for all those “build XXX on Ubuntu” posts. Recently I’ve been playing with Manjaro Linux in a VM as I had been looking for an Arch Linux based distribution that gave me the right balance between DIY and convenience. I ended up liking it so much that I did a proper bare metal install on my main desktop. The install was pretty smooth apart from a issue with getting my AMD RX 470 graphics card to work.

Read More

Take the 10% code reduction challenge!

It might sound paradoxical, but in general, writing more code is easier than writing less code that accomplishes the same goals. Even if your code starts out clean, compact and beautiful, the code that is added later to cover the corner cases nobody thought of usually takes care of the code being well designed, elegant and beautiful. Agile programming offers a solution, namely constant refactoring, but who has time for that? That’s why I occasionally give myself the 10% code reduction challenge and I encourage you to do the same.

Read More

Building Emacs 25.1 on Ubuntu 16.10

A reader of this blog kindly pointed out that my instructions for building Emacs 25.1 on Ubuntu 16.10 result in a core dump when the build process bootstraps emacs. I only tested the instructions on 16.04 so I hadn’t run into this issue yet.

The core dump on 16.10 appears to be a known issue and there is a workaround. Instead of running configure with just the prefix argument, run it as follows:

./configure CFLAGS=-no-pie --prefix=$HOME/local

The in-depth bug description is here in message #38. The short version is that gcc in Ubuntu 16.10 defaults to building code with -pie and this breaks Emacs. Turning off -pie results in a working executable.