Category Archives: Software

Fixing Ubuntu SSD Encryption Speed

TL;DR: A default install of Ubuntu 12.04 LTS with an encrypted filesystem will not use the AES-NI features of your Intel CPU for hardware accelerated encryption. I recently found a two year old bug after searching on and off since I started using Ubuntu 12.04 LTS that reports slow SSD speeds when using dm-crypt, even though with AES-NI speeds should be close to unencrypted. Turns out its a simple kernel configuration issue, which the Ubuntu devs have seemingly declined to … Continue reading

Posted in Software | Leave a comment

Understanding Memory: Part 2

In Part 1, we demonstrated a basic memory model and how in order to modify variables, one must know the variable’s address. In this section, we will talk about pointers vs arrays, and introduce the heap and stack. Pointers vs Arrays You may have heard already that pointers are arrays and arrays are pointers. First, consider the difference between value arithmetic and pointer arithmetic: int var = 5; // var is 4 bytes starting at 0x10 var = var + … Continue reading

Posted in Software | Leave a comment

Understanding Memory: Part 1

This article is meant for programmers who have some familiarity with writing and compiling simple code in C/C++. It assumes the reader knows basic data types like int and double and how to define and use variables and functions. This article will then expose the reader to a basic memory model, explain how the use of variables interacts with this memory, and introduce addresses and pointers. On a modern platform, memory is presented to a program as byte-addressable blocks. Each … Continue reading

Posted in Software | Tagged , | Leave a comment

Enable WordPress Automatic Updates on a Debian Server

I attempted to get WordPress to update plugins automatically on my Debian server today, and found it a bit less than trivial due to the number of configuration gotchas. [Update August 2014: Please create the ftpsecure user with -s /usr/sbin/nologin, otherwise it can log in over ssh!] Assuming you’re running a Debian server (I have 6.0 Squeeze), on which WordPress is installed in /var/www/site/public_html: 1) Install required packages. I used vsftpd. sudo apt-get install vsftpd openssl 2) Configure vsftpd. I … Continue reading

Posted in Software | Tagged , | 9 Comments

When you need std::remove_const

I ran across an interesting case where I needed to use std::remove_const to ensure a template parameter wasn’t const by default. I had something like this: const Matrix<4> m4 = Identity; Vector<3> v3 = project(m4[3]); With the library I was using, TooN 2.0.0 beta8, this resulted in a compile error. The error stated that when the vector returned from project() was being created, the compiler couldn’t invoke assign to a read only location. A simplified declaration of project() looks as … Continue reading

Posted in Software | Tagged , | Leave a comment

Cubic Spline Interpolation

Cubic spline interpolation is a simple way to obtain a smooth curve from a set of discrete points (knots). It has both C1 (first derivative) and C2 (second derivative) continuity, enabling it to produce a continuous piecewise function given a set of data points. From the algorithm detailed here I have implemented a clamped cubic spline class in C++. It is templated on the type of X and Y, allowing for use of scalar or vector types. It requires only … Continue reading

Posted in Computer Vision, Software | Tagged , , , , | 12 Comments

Time Machine Exclusions – Snow Leopard

A bit late, but here’s an update of the Time Machine exclusion list for Snow Leopard.

Posted in Software | Tagged , | Leave a comment

NSCopying and Mutability

In the Cocoa frameworks, it is common to find mutable and immutable versions of classes that store data, such as strings, dictionaries, and arrays. Most of these classes also implement the NSCopying informal protocol, and those with mutable variants implement the NSMutableCopying protocol. These protocols specify methods for obtaining immutable and mutable copies of an object. These copying methods should be implemented such that the copy can return an instance of a subclass, to allow for subclasses to copy their … Continue reading

Posted in Software | Tagged , , , | 1 Comment

Readable If Statements

To kick of the Coding Yups and Nopes section, I’ll start with something simple. There are a set of things to do, and a set of things to avoid. For each thing, there are one or more reasons justifying its classification. These reasons are ordered by descending importance and increasing subjectivity. – Nope: if (condition) doWork(); else doOtherWork(); If you’re stepping through with a debugger (I used gdb), it is difficult to tell when stepping over the line if the … Continue reading

Posted in Software | Tagged , , , , | Leave a comment

Window Resizing on Resolution Change

This post kicks off the “App Yups and Nopes” section in which I’ll post both good and bad things I see applications doing. This differs from the other Yups and Nopes sections in that it talkes specifically about observed application behavior. My intent is to show why a specific behavior is undesirable, then present a solution. In this situation, I connect my laptop to a projector to watch a movie. My screen resolution changes to match that of the projector. … Continue reading

Posted in Software | Leave a comment