31 December 2016
What I did in 2016:
What I can do to improve in 2017:
Happy New Year!Read More...
29 November 2016
This blog post is my journey on creating, debugging and deleting a unit test.
A frequent choice every programmer faces is whether a piece of code belongs in a program. I was working on a hobby project recently where I faced this choice. I had written a number of unit tests and after some reflection deleted one of the test to improve my code quality. At first read this sounds counter-intuitive. Don’t unit tests improve code quality? Generally, yes they do. But good unit tests need to be repeatable, maintainable and quick to run.
In my case I had created a Trie and some unit tests to validate it. In my test code I created a small Trie which contained 11 entries. However, I wanted to test against a larger set. So, I decided to use the dictionary file in
I created the following unit test:Read More...
24 October 2016
When developing a website, I like to run it locally on my computer. This allows me to quickly see the changes I have made. But running the web server locally means I cannot view it on my mobile. How do I solve this? By setting the web server to listen on 0.0.0.0 instead. Now I can see my work from my mobile! But what is 0.0.0.0? Let’s explore.Read More...
29 September 2016
One of the things I use my Raspberry Pi for is to run a twitter bot. I want this bot to run without much manual intervention. So, I want to be notified if it encounters any errors or is not running. To do this I use Papertrail and Dead Man’s Snitch. I use the free tier plan for both services.Read More...
20 August 2016
Comparing two files is a common task. On my MacBook I use the FileMerge (opendiff) app, which is part of the XCode tool-set. However, there are times when I am at the Linux command line and need to compare two files. In this blog post I will show how to compare files at the command line and with the emacs and vim editors.Read More...
17 July 2016
On my Raspberry Pi 3 I would get locale warnings when using Perl commands. This blog post explains the steps I took to fix these warnings.Read More...
11 July 2016
I installed a beta version of a Debian package on my Raspberry Pi 3 and received the following error:
dpkg: error processing archive remote-syslog2_0.18_arm.deb (--install): package architecture (arm) does not match system (armhf) Errors were encountered while processing: remote-syslog2_0.18_arm.deb
The suggested solution was to add the
arm architecture as follows:
dpkg --add-architecture arm
and then re-run the install command:
dpkg -i remote-syslog2_0.18_arm.deb
I did so and the package installed and worked as expected. However, this made me wonder:
dpkg --add-architecture armcommand do?
After several hours of reading, experimenting and writing this blog post, I think I know. I’ll start by breaking the command down.Read More...
02 June 2016
I have been playing around with hubot and slack. This post describes the steps I used to setup a hubot that uses the slack adapter.Read More...
15 May 2016
The twitter documentation indicates that t.co lengths can be obtained from the help/configuration API. This post gives an example of how to use the Tweepy Python library to obtain those values.Read More...
20 April 2016
I created a simple twitter bot that consumes data from a REST API and tweets on certain conditions. The data from the REST API changes infrequently so the bot is set to run every half hour. The bot is written in python and uses a virtualenv so the crontab entry needs to use that virtualenv as well. This post describes what I did to achieve that.Read More...