Convert DOS to UNIX (and UNIX to DOS) in VIM

March 18, 2013

Once upon a time I knew a vi mantra for removing carriage returns from a DOS-formatted text file, thus transforming it into a UNIX file.It was something like :%s/^V^M//g. It has become such an ingrained habit that I can still type it without even thinking about it. Muscle memory.

But VIM knows more...

How to use Ubuntu's Upstart to Control Node.js Forever

March 6, 2013

Recently I needed to start a server written in Node.js. This server was deployed on Ubuntu 12.04, and I wanted it to be started using the system's init system. Yet I also wanted the safety of Forever, a script manager for Node.js.

Ubuntu still supports the classic SysV init style, but it also now...

Installing GlusterFS on HP Cloud

February 27, 2013

Gluster is a distributed filesystem that works well in the cloud. This post explains how to configure GlusterFS on an Ubuntu 12.04 image running in HP's cloud.

Using this setup, I gain all the benefits of a distributed and replicated (redundant) filesystem for my in-cloud services, and can back these...

PHP SPLObjectStorage v. Arrays: Redux

January 4, 2013

A few years ago, I tested SPLObjectStorage and Arrays to see which performed better. My conclusion at the time was that SPLObjectStorage is the better performer.

One thing I did not examine there was the implications of size. I ran tests with a fixed size of 10,000 elements. The test was also run...

It's always fun to see your project get news coverage

December 18, 2012

Forbes covered HP Cloud's announcement of the new Platform as a Service (PaaS) project.

This is my favorite quote from the article: With this announcement HP’s Cloud grabs a potentially big technological advantage. Expect other cloud providers to do the same by quickly following HP’s lead of an...

Run Node.js apps on low ports without running as root

December 17, 2012

On Linux (and UNIX), to open a port with a number less than or equal to 1024, traditionally a program must run as the root user. This impacts web applications, which use ort 80 (HTTP) and port 443 (HTTPS) to do business. Many programs (Apache being a great example) use this by running a master process...

Using the Go Syntax for Janus VIM

December 10, 2012

To add the Go language (golang) plugins to Janus-flavored VIM, it's not enough to install the VIM plugins into your system's default location. So using, for example, Ubuntu's vim-syntax-go package will not work.

The best way to install all of the Go VIM plugins is to do the following:

  • Create a...

PHP and curl_multi_exec

October 26, 2012

This post explain how to get data off of a curl_multi handle. Some time back I posted this snippet of code inside of a larger sample of code:

<?php
  $active = NULL;
  do {
    $ret = curl_multi_exec($multi, $active);
  } while ($ret == CURLM_CALL_MULTI_PERFORM);

  while ($active && $ret == CURLM_OK

Using a String as a Stream (Reader) in Node.js

October 19, 2012

In its minimalism, Node.js does not have libraries to perform some common tasks. One such task is taking a string (or Buffer) of data and interacting with it as if it were a Stream. Here is a simple StringReader implementation that illustrates a no-nonsense way of exposing a string as if it were a...

Pronto 0.3.9 Features

October 5, 2012

The new pre-1.0 version of Pronto.js has been released. This is the first release of the 0.3 branch.

Pronto is a high-performance asynchronous framework for Node.js.

Here are the big new changes:

  • Pronto.js now has an HTTPS server.
  • The Pronto logger is considerably more sophisticated. While cxt...