# My Move to Improving Enterprises, Part 1

This blog article has turned into a ridiculously long posting that I’m splitting into 2, possibly 3 parts. The series pretty much recaps what I did at the College of Architecture and what I’m doing at Improving Enterprises. Enjoy!

I setup my first EC2 instance about 9 months ago when I was moving all of my Atlassian instances for Cerberus from a server I recently moved out of our Colo4Dallas Datacenter. It was nice to have around and did me good when I needed to access the instances only on occasion - saving me money. The problem I encountered today was I had moved between a couple of desktops and failed to take an (adequate) backup of the KeyPair used to connect to the instance. I tried re-downloading the KeyPair from the Amazon site, only to find that it cannot be downloaded. Thus, I had no way to access my virtual machine…easily.

## Instructions

1. Stop your EC2 instance (but don't terminate it).
2. Create a new KeyPair (and backup the key this time!).
3. Create a new EC2 instance, but use the new keypair. (ec2-run-instances ami-abc01234 -k new-keypair-name -g old-security-group)
4. Detach the volume from the existing instance.
5. Create a snapshot of that volume.
6. Spawn a new instance of the volume in the same Availability Zone as your new EC2 instance.
7. Attach the new volume to your new EC2 instance, using the mountpoint /dev/sdb1.
8. Login to your new EC2 instance using the newly generated security key.
9. Mount the additional volume somewhere (e.g. /mnt/existing).
10. Append the output of /root/.ssh/authorized_keys to /mnt/existing/root/.ssh/authorized_keys.
11. Append the output of /home/ubuntu/.ssh/authorized_keys to /mnt/existing/home/ubuntu/.ssh/authorized_keys.
12. Umount the additional volume (umount /mnt/existing).
13. Detach the volume from the new EC2 instance.
14. Create a new snapshot of the volume.
15. Spawn a new instance of the volume in the original Availability Zone as the original EC2 instance.
16. Attach the new volume to the existing EC2 instance using the mountpoint /dev/sda1.
17. Start the existing instance again. Once started, you should be able to connect as the root (or ubuntu) user with the new keypair you generated.

# Nessus Scans FTW

Isn’t this the most worthless result from a vulnerability scan:

# Merge is out of date?

So, I encountered a weird problem earlier tonight while trying to merge changes from our trunk back into a branch I’ve been working on. The merge went successfully and I could see all the changes locally. However, when I attempted to check in the changes, I got the following error message:

# MyServiceHostFactory could not be loaded during host compilation

Last Friday and this morning I had been trying to deploy the latest changes to my WCF application. As I started doing this the manual way (e.g. copying all DLLs, configs, and service endpoints into a directory to zip and send up to my web server), I took a step back and realized I needed a NAnt build target because I’m going to be doing this over-and-over again. However, after creating the build target and deploying the resulting Zip to my web server, I received a strange error message when trying to invoke my services. The specific error message can be seen below. In a nutshell, rather than relying on the standard WCF ServiceHost to invoke my service contracts, I have custom defined a factory (dubbed MyServiceHostFactory) for building out my ServiceHost. However, WCF was unable to find the factory. I checked the bin/ directory and the assembly was present (Coa.Accounts.Services.Host.dll). I spent a good deal of time trying to figure out why this error message was being caused. The various recommendations from Google didn’t work, and recompiling half a dozen times also didn’t fix the problem.

# NetApp vSphere Virtual Storage Console Woes

As I was looking for ways to better interact with our NetApp FAS2050, I came across an article detailing the Virtual Storage Console. Being intrigued, I decided to install it on our vCenter Server. The install went fine and the application registered fine per documentation. However, the problem came when entering the credentials under the NetApp tab. I was stuck in an infinite loop that stated SSL is not configured.. No matter what I did (whether that was use the root user, the vcenter user I created, checking or unchecking Use SSL, I got the same error message - SSL is not configured.

# PHP Developers Beware - PHPUnit isn't gonna be on Subversion for Much Longer

Sebastian Bergmann, lead developer of the PHPUnit testing framework, has decided to switch PHPUnit from subversion to Git. I wouldn’t normally have a problem with this, especially if he were to follow all of the other mainstream projects that choose to keep backwards-compatibility with Subversion by keeping Subversion and Git in sync. However, he’s chosen to go strictly the route of Git and not bother keeping a subversion repository in sync.

# JavaScript OO Function Encapsulation

I’ll admit, I’m a bit of a JavaScript n00b when it comes to doing UI development. One of the outside consulting projects that I’m working on is asking me to push the limits of my JavaScript knowledge, and I can definitely say the past couple of days have given me a sad realization that there are some strange oddities to JavaScript development. Once you understand that Prototyping is much like Extension Methods in .Net, that part’s pretty easy. What’s not easy is trying to figure out how to do event handing with Object Oriented classes. Here it is in a nutshell. I have a function (keystrokeListener) defined for a class (KeystrokeHandler). The idea is I want to addEventListener the keydown event for a particular object using the keystrokeListener method in my object. No matter what I was doing (whether that be declaring the method as a static method, registering the event within the class constructor, or declaring the method name on an instance of the KeystrokeHandler) yielded the following error for a call within keystrokeListener:

# HTML5 Audio Elements

One of the side projects I’m working on involves having users listen to audio files and fill out information in response to the audio files they listen to. Some audio files will be short (e.g. 5 seconds or less), but others may be long, say a few minutes to an hour or longer. These audio files are typically voicemails or ditcations, so people can have a tendency to leave long breaks between words, will talk slowly, etc., thus slowing down the listening process. The goal: figure out a way to allow the users to speed up (or slow down) the audio files as much as they would like without having to process the audio files on the server ahead of time. The possible solution? HTML5 I figured the solution here would be HTML5! The HTML5 Spec supports <audio> and <video> elements. Furthermore, it calls for the support of varying the playback speeds through a nice little object property called playbackRate. This object allows audio to be played back in multiples of speeds either faster (or slower) than the original audio file speed (which is governed by the defaultPlaybackRate property). The specification even states that browser should support a negative playbackRate to allow audio and video files to be played in reverse. Really cool stuff!

# pg_service.conf Syntax

I am setting up monitoring for my PostgreSQL database server, and ran across a cool way to get around specifying the username/password via the command-line every time the checks are run: pg_service.conf. Unfortunately, there is very little documentation on the config file. As best as I can figure out, if you are connecting to a remote host, your definitions should look as follows: