My Raspberry Pi 2 Model B setup

I recently purchased a Raspberry Pi 2 in preparation for installation of Windows 10 (and more) (when there’s a version that’s compatible). In the mean time, I installed the current version of Raspbian.

I bought a simple case via Amazon. Nothing too fancy … extremely functional (it allows the LEDs to still display which is nice).  For storage, I went overboard and splurged on a $29 MicroSD card from SanDisk. While it’s definitely oversized for my Linux needs, when I install Windows on the Pi 2, I wanted to have sufficient extra space for whatever tinkering I would do … and not need to worry about buying a larger card then.

imageI also purchased a cable that permits toggling the power to the Pi. The Pi doesn’t have a power switch on it, but now the cable I use does instead. I suppose I could have just unplugged it, but this seemed handier.

I also bought a 2A USB charger/power for it. This power supply apparently is great for preventing what might be considered a brown-out to the PI when there are many devices connected (as it will hold the voltage much closer to the required 5V). As that seemed Like a Good Thing™, I splurged (an extra $4) and bought it. If you don’t have peripherals connected, this isn’t necessary from what I’ve read. Most any 1.0A USB charger should work. Again, as I didn’t want to rebuy down the road, I spent a tiny bit extra. There are dedicated wall transformers that “are designed” for the Raspberry Pi, but I selected something generic that could be reused for other tasks, so the USB cable is removable (there are a lot that are hardwired to the transformer). The dedicated transformers are $4-6 cheaper.

I also picked up a tiny keyboard from MCM (where I bought the Pi from as well) for when VNC doesn’t make sense. (I’d be shocked if the Windows on ARM for the Pi will support Remote Desktop).

I already had a OK USB mouse, so I skipped that.

image of Raspberry Pi desktop

Node (Current)

Node v0.12.0 from Node-Arm.

sudo dpkg -i node_latest_armhf.deb

VNC Server

I couldn’t get the scripts on to run the vncserver correctly upon startup. So, I found a combination that works.

sudo apt-get install tightvncserver
then run:


Log into a terminal on the Pi as root:

sudo su

Navigate to the directory /etc/init.d/:
cd /etc/init.d/

Create a new file here containing the following script:

# First configure the user you want to run this under - this will generally
be pi, unless you've created your own users
export USER='
eval cd
# Check the state of the command - this'
ll either be start or stop
"$1" in
# if it's start, then start
vncserver using the details below
su $USER -c
'/usr/bin/vncserver :1 -geometry 1920x1080 -depth 24'
"Starting vncserver for $USER "

# if it's stop, then just kill the
pkill Xtightvnc
"vncserver stopped"

echo "Usage: /etc/init.d/vncserver {start|stop}"
exit 0

Save this file as vncboot (for example)

Make this file executable:

chmod 755 vncboot

Enable dependency-based boot sequencing:

update-rc.d /etc/init.d/vncboot defaults

If enabling dependency-based boot sequencing was successful, you will see this:

update-rc.d: using dependency based boot sequencing

But if you see this:

update-rc.d: error: unable to read /etc/init.d//etc/init.d/vncboot

then try the following command:

update-rc.d vncboot defaults

Reboot your Raspberry Pi and you should find a VNC server already started.

sudo reboot


.NET/Mono (current)

sudo apt-key adv --keyserver --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
echo "deb wheezy main" | sudo tee /etc/apt/sources.list.d/mono-xamarin.list
sudo apt-get update && apt-get upgrade
sudo apt-get install mono-complete

Then to test:


With HelloWorld.cs:


By installing the current Mono as shown above, you’ll have access to mscorlib 4.0 by using dmcs for C# compilation.

Kenu Airframe Portable Car Mount

Ever travel and want to use your mobile phone as a navigation device safely and securely? Our cars have built in navigation systems that we rely on normally, but when we rent a car, that’s rarely an option.

Have you tried a bunch of tricks and found that there generally speaking isn’t a good place to put your phone in many vehicles that is safe and effective? I’ve personally resorted to a cup holder on more than one occasion unfortunately.

Enter the Kenu Airframe Portable Car Mount!


imageI used it all last week while traveling for business and it was extremely useful. Using a rubber-like pincher-like back, it grips onto the vents in most cars. Unlike some vent mounts, it’s just using a friction grip and isn’t the type where it’s physically snapping on to the vent.

It takes only a few seconds to install and remove from a vent.

The front portion expands horizontally to allow a variety of sizes of devices to be held. For the first time on a trip, my phone was held perfectly in place and was easily viewable without taking my eyes off the road any more often that you might with a normal dash or window mounted GPS. It held in place and at no point slid off the dash or tumbled into the seat or onto the floor like often has happened with my previous solutions to this problem.

It shouldn’t block power/cables in most modern mobile phones, so I had my phone charging while in the mount.


Available on Amazon for around $25 USD.


(I also used SyncStop on the trip to prevent the car’s USB plug from doing the nasty with my phone; SyncStop was formerly called the USB Condom… :-) ).

Attaching a GoPro Hero with Aero Bars from RedShift

I recently purchased a set of aero bars for my Trek road bike.  After a lot of research, I decided the best fit for my bike and requirements were aero bars from Redshift:IMG_1161

Redshift Quick-Release Clip-On Aerobars – Carbon Extensions – L-bend

I picked these aero bars for a few reasons:

  1. They had decent reviews around the web
  2. There was a carbon mount available (my bike frame and seat post is carbon, so for a few extra bucks, so are the aero bars)
  3. They were easily removed if I didn’t want to always ride with them (a tool free removal)
  4. With an extra purchase, I could get a computer mount (which later turned out to be not so worthwhile)
  5. In about 5 seconds, you can remove a single bar. This may be important to you as it was to me.

While the instructions for the aero bar are unnecessarily and unfortunately terse, they’re relatively easy to install.

Once I installed the aero bars per the instructions I couldn’t initially find a satisfactory location for my GoPro. I like riding with the GoPro set to 1 second time-lapse … then put to video (the results are often mesmerizing!).

A few months ago, I purchased a non-GoPro Hero mount for my bicycle, the K-EDGE GO BIG Pro HandleBar Mount. I bought this to reduce the vibrations and also better secure the Hero to the bicycle. Before the K-EDGE, I simply could not get the mount to stay consistently secure on my semi-bumpy rides. It would slowly change positions and ruin a large segment of the captures if I didn’t notice it quickly. The K-EDGE is certainly a premium product (but made in the USA!).

The K-EDGE is ROCK SOLID. I couldn’t believe how much better the results were when the camera would stay firmly in position. While it can’t solve the problem of a bumpy ride, the camera shakes less on it’s own (reducing secondary vibrations).


With the K-EDGE, the mount takes up very little space on the handlebars, unlike the original GoPro bicycle mount. So, by orienting the K-EDGE down and flipping the Hero, the image nicely captures the scene in front of the bicycle without being obscured by the aero bars.

I also own the Annex Quad Lock Bike Mount Kit for iPhone 5/5S – Black. At first I was concerned that the combination of the aero bars, and the phone would be a disaster (and that there wouldn’t be enough room to properly snap and lock the quad lock case onto the bicycle mount). In fact, there isn’t room. But, in about 5 seconds, you can release the tension on one of the aero bars, flip the small catch, and remove the bar completely. Snap the phone onto the Quad Lock, and replace the bar. It’s a really nice setup.IMG_1160

What didn’t work out was the Redshift Computer Mount for Quick-Release Aerobars. I didn’t realize that the mount was not the same diameter as my road bike handle bars. In fact, it’s small enough that I don’t have a single thing that would attach to it. I had a wonderful steel bicycle bell I’d bought via a Kickstarter that unfortunately doesn’t have a home on my bike anymore. I thought it would attach to the computer mount, but it’s much too large as is. I’ll probably need to rig up some extra padding for it to make up the difference, but I’d hate to loose the bell to my faulty contraption.


From the back …


On my first ride with the aero bars I noticed they’d rattle a tiny bit when riding. After stopping and over-analyzing the situation, I noticed that I simply had not tightened the quick release bolt well enough. An extra turn on both made them both rattle-free.

I also didn’t care for the raw feel of the bars, so I added handle-bar tape to the end where I rest my hands. The Comfort cork is very nice: Planet Bike Comfort GEL Road Bike Handlebar Tape with Reflective Bar Plugs (Orange Cork).

IHTMLDocument5 and IHTMLDocument6 in C#

Unexpectedly, I found myself needing to use IHTMLDocument5/6 last evening to fetch a few properties that aren’t directly exposed via any of the Web Browser options in classic .NET programming (like WinForms/WPF). I couldn’t find them anywhere, so I whipped up something simple/quick/dirty:

internal interface IHTMLDocument5
    void SetOnmousewheel(object p);
    object GetOnmousewheel();
    object docType { get; }
    object implementation { get; }
    object createAttribute([In] string attrName);
    object createComment([In] string comment);
    void SetOnfocusin(object p);
    object GetOnfocusin();
    void SetOnfocusout(object p);
    object GetOnfocusout();
    void SetOnactivate(object p);
    object GetOnactivate();
    void SetOndeactivate(object p);
    object GetOndeactivate();
    void SetOnbeforeactivate(object p);
    object GetOnbeforeactivate();
    void SetOnbeforedeactivate(object p);
    object GetOnbeforedeactivate();
    string compatMode { get; }

internal interface IHTMLDocument6
    object compatible { get; }
    object documentMode { get; }
    void SetOnStorage([In] object p);
    object GetOnStorage();
    void SetOnStorageCommit([In] object p);
    object GetOnStorageCommit();
    object getElementById([In] string id);
    void updateSettings();

As you can see, I didn’t spend a lot of time with the details, but it was enough to make progress (in particular I wanted compatMode and documentMode).

Animating an element’s visibility using AngularJS

There was a question on StackOverflow about animating an element and I wanted to give it a shot, so here goes:



Imagine nearly the simplest Angular JS application possible:

<div ng-app="App">
    <div ng-init="checked=true">
                <input type="checkbox" ng-model="checked" />Is Visible...</label>
        <div class="sample" ng-class="{ hidden: !checked }">Visible...</div>

There is only a single property called checked as part of the data model. There’s a checkbox that when unchecked, will cause the text “Visible” to be hidden.

I’m going to use jQuery as the simple animation engine, but you could use what ever you’d like. The latest versions of jQuery, angular, and angular-animate are needed:

<script src=""></script>
<script src=""></script>
<script src=""></script>

Using the ng-class directive (reference), a CSS class named hidden is added when the checkbox is not checked.

The application module and animation API are defined:

angular.module('App', ['ngAnimate']).animation('.sample', function () {
    return {
        addClass: function (element, className, done) {
            if (className === 'hidden') {
                    opacity: 1
                    opacity: 0
                }, 500, done);
            } else {
        removeClass: function (element, className, done) {
            if (className === 'hidden') {
                    opacity: 0
                    opacity: 1
                }, 500, done);
            } else {


The only element animated on the page is using a CSS class name of sample. Whenever Angular adds or removes a CSS class from a matching HTML element, the corresponding code is executed. As it’s possible for multiple class names to be passed to the functions, per the guidelines, I’ve made sure that the code only executes when appropriate by filtering on the class name of hidden. As it’s toggling the state, the first action taken is to fully make opaque or transparent, then animate to zero or one depending on whether the class is being added or removed.

And that’s it! Of course, the code could have been more sophisticated, but it was all I needed.

By the way, there’s no need for a CSS class named hidden that has any CSS properties (it can be undefined completely). The animation code handles the visibility properly.