Presentations with code that actually works

I don’t do presentations that often these days. And if I do, more often than not, they contain some form of source code. With most things you write, you refine it over and over. This is especially true with stuff that you present. Applied to code snippets, that can mean you test it initially, but once it is in the presentation it is a burden to copy it back and forth to verify every change, and then start over again with the formatting. So you often end up changing your code snippets in the presentation, without verifying if the code is still valid. Sometimes you find these errors during proof reading, but even famous presenters caught compile errors during the presentation. That’s how it works when you use the traditional PowerPoint style of products. As I expressed earlier, the Office suite and their opaque file formats doesn’t belong to my favourite tools.

Thus after I recently learned LaTex, I wondered if presentations could be done with it. Sure enough TexMaker offers a good set of templates for just that.

Next I wanted to see if I could link in code from external files, and sure enough, there is the listings package for LaTex. Now that enables me to have the code in files that I can actually compile.

But wouldn’t it be cool, if I could compile the code snippets for verification and generate a pdf file from the tex source all at one go? Sure enough there is a cmake UseLATEX package.

Now wouldn’t it be even cooler, if I could edit and generate all from within the same console window, without having to exit the editor, start the editor from a specific directory, or type complicated commands? Sure enough I found out how to write project specific .vimrc files. With everything prepared, I just have to type :make in vim to trigger the process, to get a new pdf file with all code snippets verifyed.

A small project to demonstrate the technique is at: https://github.com/ulrichard/experiments/tree/master/initializerlists

And you can find the resulting pdf file at: https://github.com/ulrichard/experiments/releases/download/initlist_0.1/initializerlists.pdf

The phone book of the internet age

When I was a kid, the main means of communication with remote friends was using telephones. If I didn’t know the phone number of their parents, I looked them up in the phone book. The phone books also contained the postal address. So if I wanted to send a letter or a packet, I could also consult the same source for where exactly to send it.

Nowadays we have many more means of communication (mobile phones, email, xmpp, IRC, BitMessage, Twitter, Skype, WhatsApp, ICQ, FaceBook, Hangout, Forums…), but in this plethora of options, discovery is sometimes more difficult. On some services you just search for name, on others you have to know the user handle beforehand. But most important, you need to know on which service to look in the first place. In addition, an increasing number of people choose not to be listed in the phone book, or their online counterparts any more. So when I recently wanted to send a package to a friend who just received a child, I couldn’t find his postal address anywhere and had thus to ask him.

I’m sure in addition to the online versions of the regular phone books, there are lots of registry services where people can sign up to be listed. The problem is though that they are scattered all over the place, and mostly for local communities. There is one notable global directory, but that is for domain names rather than for people. DNS has problems of its own. As I experienced recently first hand, you’re at the mercy of the registrars if something unusual happens. And if you forget to renew, or lost access to the account your friend registered your domain (don’t get me started on passwords), some troll may catch your domain and use it for blackmailing.

Namecoin is here to solve both problems. It is a descendant of BitCoin, the famous cryptocurrency. Namecoin is a decentralized store of information such as domain name registrations, personal information… you name it. As it uses a block-chain it is completely tamper- and censorship-resistant. The rules are very clear. The first one to grab a name gets it. When a name expires it is available again. Registration or update is very cheap, in the range of a few cents. Since it is merge-mined with bitcoin itself, it inherits the protection against 51% attacks.

All you need is an installation of a namecoin full node (I’m not aware of any thin clients). The block chain is a lot smaller than that of bitcoin, so it is no problem to run it on your notebook. Once installed, you can register your domain. The GUI has fields for the required information. If you have a static IP address, you can just use that for registering and skip all the DNS stuff. The client side is a bit harder at the moment. To get the full security the system offers, you need to install a browser plugin, that is still a bit clunky. But there are already DNS providers that resolve .bit domains. That can be a lot more convenient at the cost of some security.

But the reason I’m writing about namecoin is an alternative usage, namely as a kind of modern phone book. I can’t remember how I found the site  nameid.org. I think it was from some guy writing about integrating it with the BitMessage client. As BitMessage addresses are hard to remember, that makes a lot of sense. Using namecoin for OpenID is also a nice idea, but I don’t use that part. I’m still looking for an OpenID solution based on OpenPGP where I can use my OpenGPG Smartcard. There was a great project started in this direction called EnigForm, too bad it has been stalled for some time. But I’m diverting again.

So, you can pick a short name (“ulrichard” in my case), and register selected information about you (email, blog, phone number, postal address…) with namecoin. The process is not as straight forward as with domain names, as the GUI has no fields for that yet. So you have to construct the json string yourself. The wiki documents the various fields and their types. You then only have to provide your short name as kind of digital, updateable business card. Yes, and updateable business card, isn’t that cool? Since not all people have namecoin installed, instead of the short name alone, you can provide a link to a website that nicely formats the information : https://nameid.org/?name=ulrichard . Once namecoin is integrated with other services, you no longer need to send mass-messages to all your friends when you change your eMail-address or phone number, you just update your namecoin id record.