Installing Jenkins and Docker in an AWS EC2 Instance

In order to do efficient, modern software development, especially for web applications, it is absolutely necessary to have a system for continuous integration (CI) and continuous delivery (CD). The idea with CI is to continuously integrate working code to the repository so that it can continuously be checked for errors. So, a prerequisite is to be using some sort of test driven development (TDD) method or at least some unit test framework; otherwise there is chance to automatically test for errors when the code is committed to the repository. The best CI systems automate everything after the commit. A developer pushes her code, then the CI systems notices the change and automatically runs the tests. When the application passes all of its test, a continuous delivery system should then automatically put the code into the QA, staging, or testing environment. There can be a lot of steps required to get a decent CI/CD system working, and it can be especially daunting when there is no dedicated DevOps team. So, I created a cheat-sheet for quickly setting up a simple Jenkins CI/CD system on an AWS EC2 instance.

Before proceeding you must have an Amazon Web Services account and be somewhat familiar with AWS.

Ncurses based System Performance Monitor for Mac

Ncurses based System Performance Monitor for Mac

Nmond is a Ncurses based system performance monitor for Darwin (Mac OS X terminal) written in pure C. It was “forked” from nmon. The original nmon gathered system statistics by looking at /proc, which is not available on Darwin, so system calls had to be implemented for all the statistics. The original program was monolithic and used global state a lot; it was modularized during the rewrite. It’s still a work in progress.

Position Paper: Tabs Versus Spaces

Most people would not understand why anyone would even have a preference on how many spaces a text file should be indented, but for people who interact with text files all day this can be a big deal. Seriously. People like to feel comfortable in their work places, and for software developers, or coders, their work place is their source files. Consider this analogy. It should not matter which side of my desk the phone is on, yet I prefer to have my phone on the left. The reason for my preference is that I often need to use my mouse while I am on the phone, so it is more convinient for me to reach over with my left hand and pick up the phone while leaving my right had free. I would expect a leftie to have the exact opposite preference.

Minimum Functions in Swift Compared

So, Apple has just released a new programming language called Swift, and naturally I wanted to check it out. I started by writing example programs in the playground as I read through the Swift iBook. That was fun and all, but I wanted to compile something and create an actual program. Apple said that Swift was fast, so I also wanted to benchmark it against C, which is my de facto point of reference for fast. I recently wrote a post where I compared minimum functions in C, so I though it should be trivial to port that code to Swift and test it out. The porting was easy, and the functions ran about 20 times slower than the C equivalents (which is actually not bad, in almost all cases it’s a good trade-off to decrease development time), but I found something else that surprised me. The built-in min function was insanely slower than the ones I hand coded. Whereas the test function using my hand-coded min3a() function took, on average, 3446 microsecond in C and 68,085 microseconds in Swift, the test function using the built-in min() function took 16.87 seconds to run.

Minimum Functions in C Compared

Anyone who has written C code has probably at one point or another had to write a small function to find the minimum value in a set of integers. When the set contains only two numbers, a macro like #define min(a,b) ((a) < (b) ? (a) : (b)) is frequently used. When the set is expanded to three it is possible to add to that macro, but I generally prefer to err on the side of code readability whenever possible, so I just write a little function to do it. Recently, as I was performing research for my master’s thesis, I saw some C++ code which implemented the minimum_of_three function slightly differently than my standard naïve approach. The comment said something to the effect of, “spend a register to reduce the number of branches and increase performance.” I’m always looking for ways to improve my code, so I thought that I would try out this better way. However, I am not one to just blindly believe stuff I read in code comments, so I had to test it out for myself. Below are the results of my analysis.

JavaScript Simple-12 Simulator

The other day I posted the simple microporcessor design that I created as an undergraduate. As a part of that project I also had to write an assembler and simulator for the processor. Way back in 2011, when I was working on this project, the Hipster movement was nearing its peak in the US, and I had to find a nerdy way to get some irony. I decided it would be awesome to write the assembler and simulator in JavaScript. So, for those of you who want to run some Simple-12 programs online, check out my web-based Simple-12 simulator. Below are some sample programs.

Simple Microprocessor Design

Simple Microprocessor Design

This details the hardware design for a simple 12-bit microporcessor. I created it for an undergraduate class which I took a few years ago. It is not really usefull for anything besides learning how computer hardware works, but I still think that it is pretty cool. I found the documentation for it on my hard drive and remebered how proud I was to have actually completed it; I am a computer scientist, not a computer engineer. Simple logic gates are used as the basis for the creation of more complex digital electronic circuits; those circuits, including a control unit, are in turn connected via a datapath to form a completed processor. The processor datapath is designed to implement the Simple-12 instruction set.

fuzziac.js : Approximate String Matching in JavaScript

Fuzziac.js is JavaScript class for on-line approximate string matching. It was originally intended for use with auto-complete, such as that provided by jQuery UI. This is started as a research project for an undergraduate algorithms class which I took way back in 2011. We had to complete a term project on an algorithm, and Dr. Duan made dynamic programming look cool, so I though I would look for an application of dynamic programming outside the realm of DNA sequencing.

Where I was working at the time I had been updating web-based intranet applications to use RESTful services and shared JavaScript libraries; one of the most popular updates I made was to add auto-complete (thank you jQuery UI) to all the person name fields across the various applications. I worked for a multi-national and culturally diverse company, so spelling people’s names right was a big problem (e.g. Is it Lucy Lu or Lucy Liu? How do you spell Lakshmi Yaragudipati? Jake Bruder’s real name is Joachim Bruder; who knew? etc., etc.). Previous attempts to provide normalized person name data relied upon entering employee IDs, but no one knows anyone else’s employee ID, so they would always have to look it up. Or, if there was no penalty for entering the wrong employee ID, people would just enter their own, which made the results of data analysis faulty. I knew that in order for the data to be correct it would have to be easy for users to enter it correctly, and this problem seemed to be a good fit for a dynamic programming approach.