03 December 2016

Elixir and Phoenix on MacOS for the First Time: install to first project

Let's install Elixir and Phoenix on MacOS, and create our first web app project.

I looked through 3 separate web pages to figure it out (it was relatively easy), and thought it'd help to gather it into a single page of 10 steps.

What's Elixir?  Elixir is a programming language that superficially looks a little like Ruby, but more importantly is designed to be dynamic, functional, and capable of building concurrent, distributed, low-latency and fault-tolerant systems (perfect for the web!).

It does that by running on the Erlang VM (like a Java VM, not like a VirtualBox VM), and that also gives developers access to Erlang’s ecosystem (this reminds me of how Clojure runs on the JVM, providing access to Java's ecosystem).

What's Phoenix?   Phoenix is an Elixir framework implementing the server side of a web framework for modern web applications.  Like Ruby on Rails or Python's Django, but Phoenix is written in Elixir and derives benefits from that (in addition to whatever other advantages it may have as a framework - we're not comparing frameworks today).


(1) Install Homebrew

To begin, you need Homebrew installed on your MacOS.  Homebrew is a package management system that makes installing lots of developer software much easier on Macs.

Once installed, especially if it's been a while since you've last used Homebrew, make sure to update it (commands after "$" are to be typed in your terminal window):

$ brew update

Do a self diagnostic to make sure it's all okay, carefully read the instructions it provides:

$ brew doctor


(2) Install Elixir

Elixir requires Erlang to be installed.  Fortunately, the Homebrew package will automatically make sure of that.

27 November 2016

Sharing TrueCrypt USB volume on 3 platforms: Mac, Windows, Linux

I've tried to find a solution to sharing a TrueCrypt encrypted volume on a USB memory stick between three platforms: Mac, Windows, Linux.  It's been tough to find something modern and reliable, as I tried HFS+, Ext2/Ext3/Ext4 on USB and in a TrueCrypt volume.

Modern means that it'll properly deal with big files (over 4 GB), and long international file names (over 8.3 UTF characters).

The best solution I've found so far is a TrueCrypt exFAT volume on an exFAT USB stick.

It's modern, and okay but not great in reliability.  There's some caveats and things to watch out for though to make this work well for you.

19 November 2016

Clojure Programming Cookbook - a Book Review

It's been a while since I've looked into programming Clojure again, having been preoccupied with C++ lately.  With the new Clojure Programming Cookbook, I've gotten to see a number of new developments in the Clojure ecosystem that is quite exciting.


The book is very example oriented, basically being a collection of code recipes for accomplishing common programming tasks with Clojure.  I like how it starts from very basic interactive programming and macro usage (this is a Lisp after all), all the way to talking about concurrency, parallel processing, and cloud-based tasks.  Each recipe is accompanied by brief explanations, preambles, and some cross references to related recipes in the book.

Each recipe is basically self-contained, so I wouldn't necessarily recommend reading the book like a book, but instead to use it as a "random access" set of references.  The ebook version is probably best in terms of allowing for full-text searching for key terms, and for clicking on relevant topics in the table of contents to look up useful recipes.  I'd personally prefer having the PDF ebook, but that's just me.

As a reference book, it's great if you already have familiarity with Clojure, but this book is probably okay for those of you programmers who don't yet know Clojure and want to learn it.  I'm not sure it's that great if you just don't know how to program and want to learn programming starting from nothing.  On the other hand, I could imagine a course instructor might be able to bootstrap the book with additional content to help absolute beginners get started, then point out recipes in the book to try out from time to time.

What's neat about this book for me is that as I've been away from Clojure for a few years, looking at this book I see recipes for topics I'd like to try out.  Topics I've heard of but just haven't followed along with over the years.  Like Transducers, and Om.Next.  So it's nice to see some self-contained examples of these exciting new developments in the Clojure ecosystem.  But given that it is just a cookbook, it doesn't seem to get deep enough into any specific particular topic for me to feel like I really know what's going on.  For that, I'd need to look to additional resources.

So there's definitely some caveats, but it is a pretty decent and easy going kind of book.  For a lower intermediate Clojure programmer, it's definitely a good resource to look into, maybe to help get you from programming on a single machine to programming for the cloud (AWS, etc.).  For upper intermediate programmers who's been away from Clojure for a while and want to see some new Clojure developments, I'd definitely see about getting it if you chance upon a sale.  The book lives up to its name as a cookbook.

23 September 2016

Ubuntu 16.04 guest + VirtualBox 5 + Windows: major version coordination bugs

Trying to run the latest Lubuntu (and I presume Ubuntu) 16.04 as the guest within a recent VirtualBox version (e.g. 5.0.22) on a Windows 7 host with anti-virus installed requires a certain amount of ... version coordination dancing, because of a series of unfortunate bugs.

The main problem is that the recent VirtualBox 5.x series has some major compatibility problems with Windows and/or the anti-virus installed with it.  Launching a VirtualBox image could result in a pretty scary error message like:
Error relaunching VirtualBox VM process: 5
Command line: ...............
(rc=-104)
And it's a "hard" error, blocking the VirtualBox image from even attempting to boot the guest OS.  Apparently it's something to do with "Hardened Security" [1].  There's some proposed workarounds but none of the proposed solutions worked for me.

Worse yet, after installation of VirtualBox 5.x (on a Windows 7 host) and successfully testing my Lubuntu guest image, my TrendMicro anti-virus updated overnight which created the above "Hardened Security" problem --- literally overnight!

The only reliable workaround is to downgrade VirtualBox back to the version 4.3.x series.  That's a workaround for the VirtualBox "Hardened Security" problem, but it creates new version compatibility problems between the guest OS and VirtualBox...  argh

But I found working workarounds.

15 September 2016

VeraCrypt: how to verify its GPG signature

I'm not sure why the steps to verify a VeraCrypt download isn't more prominently displayed on their website, so I pieced it together myself here:

Downloaded latest stable release and PGP signature here:
https://veracrypt.codeplex.com/wikipage?title=Downloads

On a Mac, make sure Homebrew is installed (or else you can install these yourself from source).

brew install gnupg
brew install gpg2

Get VeraCrypt PGP key ID from:
https://www.idrix.fr/Root/content/category/7/32/60/

In the terminal, run the following with the VeraCrypt PGP Key ID you got above:

gpg --recv-keys 0x54DDD393
gpg --fingerprint 0x54DDD393

That should display the key fingerprint, which you should compare with the key fingerprint that's posted on:
https://www.idrix.fr/Root/content/category/7/32/60/
and on:
https://veracrypt.codeplex.com/

Now to verify your download, run the following in Terminal for your downloaded version of the files:


gpg --verify VeraCrypt_1.18.dmg{.sig*,}


The message displayed should say the signature used key ID 54DDD393 (make sure it's the key ID found from above!) and is good and from VeraCrypt Team .

Similar instructions apply for Linux, but install GnuPG and GPG from your system's package management system instead.

Similarly for Windows, but you'll have to figure out how to install GPG yourself --- see the Tor project's manual on doing that (that's what helped me piece together the above):
https://www.torproject.org/docs/verifying-signatures.html.en


After all was written above and done, I found VeraCrypt's instructions hidden away at the bottom of a page without mention of what to install and such, but here it is anyway:
https://veracrypt.codeplex.com/wikipage?title=Digital%20Signatures