Tuesday 19 November 2013

Convert .vhd to VMWare image (.vmdk) on Mac OSX

In order to convert a Microsoft Virtual PC hard drive image (type .vhd) to a VMWare Fusion image (type .vmdk) on OSX you can use Qemu. While other articles mention using the Mac port of qemu called simply "Q", using Macports you can use Qemu directly.

Using Macports:
sudo ports install qemu
Then using the qemu-img command:
qemu-img convert -f vpc -O vmdk Win7_IE8.vhd win7-ie8.vmdk

...for example will output the desired image!

Friday 6 September 2013

Using Grunt-phonegap-build: depricating grunt-zipstream and buiding on other platforms

If you use Grunt and want to automate builds in build.phonegap.com you may have noticed the Grunt-Phonegap-Build plugin. However the documentation is a little bit outdated. For one, Grunt-zipstream doesn't work with newer versions of Node.js (as of the writing here), so we will substitute in Grunt-contrib-compress. Then there is the fact that iOS uses certs now, and there is a key/password example in the documentation? It turns out that you can simply omit this line and build with iOS no problem! Finally there are the missing examples for Blackberry and Windows Phones builds. Yes, you can do them, and I will show you how:

Replacing Grunt-zipstream

We will use Grunt-contrib-compress instead with the following configuration:
var compressConfig = {
        main: {
            options: {
                archive: 'app.zip'
            },
            expand: true,
            src: ['*.html', 'styles/**/*.css', 'srcipts/**/*.js', 'favicon.ico', 'images/**/*'],
        }
    };
and with a sub-directory using a variable for Yeoman
var compressConfig = {
        main: {
            options: {
                archive: 'app.zip'
            },
            expand: true,
            cwd: '<%= yeoman.app %>/',
            src: ['*.html', 'styles/**/*.css', 'srcipts/**/*.js', 'favicon.ico', 'images/**/*'],
        }
    };
 You can replace "zip" with "compress" in the documentation, or make a separate task like I did:
grunt.registerTask('remote_build', [
        'compress',
        'phonegap-build:debug'
    ]);

Blackberry and Windows Phone builds

Wondering how to make Windows Phone Builds with Grunt-phonegap-build? To build out for iOS, Android, Blackberry, and Windows Phone you can do your setup this way:

var phonegapBuildConfig = {
        debug: {
            options: {
                archive: 'app.zip',
                'appId': 'XXXXXX',
                'user': {
                    'email': 'myemail@server.com',
                    'password': 'password1234'
                },
                keys: {
                    //ios: { 'password': password1234' },
                    android: { 'key_pw': 'password1234', 'keystore_pw': 'password1234' },
                    blackberry: { 'password': 'password1234'}
                },
                download: {
                    ios: 'dist/ios.ipa',
                    android: 'dist/android.apk',
                    blackberry: 'dist/blackberry.ota',
                    winphone: 'dist/winphone.xap'
                }
            }
        }

};

No need for the iOS password anymore, see how to specify the key for Blackberry, and the attribute name for Windows Phone is "winphone"!

Here is everything in total:
module.exports = function (grunt) {
    // show elapsed time at the end
    require('time-grunt')(grunt);
    // load all grunt tasks
    require('load-grunt-tasks')(grunt);

    //REMOTE (build.phonegap.com) phonegap (for devices) builds
    grunt.loadNpmTasks('grunt-contrib-compress');
    grunt.loadNpmTasks('grunt-phonegap-build');

    // configurable paths
    var yeomanConfig = {
        app: 'app',
        dist: 'dist'
    };

    var phonegapBuildConfig = {
        debug: {
            options: {
                archive: 'app.zip',
                'appId': 'XXXXXX',
                'user': {
                    'email': 'myemail@server.com',
                    'password': 'password1234'
                },
                keys: {
                    //ios: { 'password': password1234' },
                    android: { 'key_pw': 'password1234', 'keystore_pw': 'password1234' },
                    blackberry: { 'password': 'password1234'}
                },
                download: {
                    ios: 'dist/ios.ipa',
                    android: 'dist/android.apk',
                    blackberry: 'dist/blackberry.ota',
                    winphone: 'dist/winphone.xap'
                }
            }
        };

    var compressConfig = {
        main: {
            options: {
                archive: 'app.zip'
            },
            expand: true,
            cwd: '<%= yeoman.app %>/',
            src: ['*.html', 'styles/**/*.css', 'srcipts/**/*.js', 'favicon.ico', 'images/**/*'],
        }
    };

    grunt.initConfig({
        'phonegap-build': phonegapBuildConfig,
        compress: compressConfig
    });

    grunt.registerTask('remote_build', [
        'compress',
        'phonegap-build:debug'
    ]);
};

Registration (key) pages for various version of Visual Studio Express


If you are looking for the link to a version of Visual Studio Express Registration, here is what I have found so far:

Microsoft® Visual Web Developer® 2008  Express Edition: https://profile.microsoft.com/RegSysProfileCenter/wizard.aspx?fu=http%3a%2f%2fmsdn.microsoft.com%2fen-us%2fvsreg%2fdefault.aspx%3frel%3dvs2008%26h%3dd9eac95a73d80105%26pid%3d91911-152-0000077-60782%26bn%3d030729.01%26r%3dy%26lcid%3d1033&wizid=bbcd9486-83de-4770-9541-708db0f37792&lcid=1033

Microsoft® Visual Web Developer® 2010  Express: https://profile.microsoft.com/RegSysProfileCenter/wizard.aspx?wizid=345281f9-6588-4888-820f-2695af056d4f

Visual Studio Express 2012 for Web: https://profile.microsoft.com/RegSysProfileCenter/wizard.aspx?wizid=C7497E1F-ADA8-4302-9B50-B01855369B2A

Visual Studio Express 2012 for Windows Desktop: https://profile.microsoft.com/RegSysProfileCenter/wizard.aspx?wizid=2525f0ba-d85f-4730-bd75-e1299f83e666&lcid=1033

Hope it helps!

Thursday 15 August 2013

The TBK Wii-link RF600 PRO 2.4 GHz Wi-Fi Booster.

I've been looking at 2.4 GHz Wi-Fi signal boosters lately, and one (reportedly) powerful (4 Watt) and cost effective (~$100) amplifier is the TBK Wii-link RF600 PRO.

Time for research!

It seems to be manufactured by ShenZhen TBK Electronic Co., Ltd

The most official listing I could find is: http://tbkchina.en.alibaba.com/product/922769231-218833311/2_4G_4W_Waterproof_RF600_Pro_0utdoor_Wi_Fi_Booster.html

As you can see their Alibaba page is: http://tbkchina.en.alibaba.com

Here is the circuit board diagram (Clean version):
And a higher resolution version:





The rest of the images are the highest resolution I could find.

The board, top half:


The bottom half (upside down):



 Close up of the switch:


In the box:


Hey look! Other models (RF600-AP, RF600N, RF600N-AP, RF606):










Saturday 23 March 2013

Why are there stars?

For anyone who can remember the old projector at Lollipop, you will probably also remember what has lovingly been referred to as the "startfield" which appeared in the conference room. This pattern of a mixture of flickering and static white dots were, as you might have already guessed, dead pixels. Or more accurately stuck pixels.

Our DLP projector uses an array of tiny mirrors to reflect light at just the right time as each color filter on a spinning wheel moves in front of the lamp to produce a recognizable image. These mirrors are stuck, reflecting the light constantly. Why? My guess is that since the projector sat so low and at an angle on the conference table that it needed the keystone to be highly adjusted to make it seem straight. This cut off a large section of the DMD and these mirrors were kept off, I think they just got tired out.

So, where did these stars come from exactly? Well I tore down the projector and got an "inside look."
Here are some images of the DMD:

Here we see the tell-tale "burn" of where the keystone was focused.


A closer version with outlines highlight the keystone "burn." A blue line shows where the Macintosh menu bar has left its print.
And here, the origin of our star field.



"All that glitters is not gold." It's true, it's aluminum.

Friday 1 February 2013

Websockets in Bugzilla

During a recent project a co-worker and I were trying to diagnose some issues with a Websocket implementation. We were testing in Firefox and brought up Firebug to see what was going on. To our surprise while we could see the UPGRADE request to create the Websocket, but we couldn't see the Websocket data itself. We ended up, at first, resorting to using Google Chrome and using its Websocket monitoring "functionality" (horrible, horrible, horrible!) to try and debug. We later settled into using Charles to monitor the Websocket data, this was pretty nice and had the added benefit of being able to easily test from a mobile divice as well. Even with that okay solution I feel that there should be a quick easy way to view any and all data passing to/from the browser by default, and that an implementation should be neat and clean, much like the rest of Firebug but unlike Google Chrome's attempt.

What has been done so far:

Firefox Bugzilla

https://bugzilla.mozilla.org/buglist.cgi?quicksearch=websocket+bugzilla

-0 results

Firebug Google Issues

code.google.com/p/fbug/issues/list?q=Websockets

-0 results

So... nothing.

Has anyone else noticed this lacking?

MrEcho has: 
https://groups.google.com/forum/?fromgroups=#!topic/firebug/Z4f0UON_ebk
but he never got a response. :(

enq... did, and even got a good response!
https://groups.google.com/forum/?fromgroups=#!topic/firebug/DXF5KjionVQ
and then never followed up!

Yes, others have notice, but there doesn't seem to be much of a drive to get the functionality.

Quick fixes (in order from cleanest/easiest to most problematic)

  1. Use Charles
  2. Use Google Chrome
  3. Intercept all websocket data (with console messages for example) in your implementation
  4. Bind to the "message" callback
Number four was of particular interest to me. While I was looking in to a way to capture data from the websocket implementation in Firefox I ended up following the actual notifications all the way up to the Javascript level. This was interesting because it could be done without modifying the Mozilla code base, and at a very high level. As a matter of fact I created a Scriptmonkey script that would bind to the Websocket object in the project we were working on. The problem was that it is difficult to have it detect any Websocket being created and binding to it. An idea as to why this is difficult is that the the MutationObserver doesn't seem to trigger on mutations (such as the creation of a Websocket) as high as the window object, which is where it would be happening.

What to do about it

Firebug has awesome extension capabilities, which is great, but alone isn't enough. Looking at the HTTPobserver usage in Firebug gives us an example of just how much it is dependent on observer implementation deep in the Necko framework.

We will first have to modify the Websocket implementation in Necko to allow Firebug to hook into it as an observer. Then give Firebug the ability to hook in and display the data, either as an extension or built in. Though hopefully in the case of the former, creating it in such a way that  it could easily be ported as built in to Firebug.

Tuesday 22 January 2013

Multiple version of gcc on Mac OSX

Sometimes you might find yourself in a situation where you want to run one version of gcc on your Mac while maintaining a previous version, instead of simply upgrading via overwrite. For instance, I have XCode installed (with gcc4.2) but want to compile with gcc4.7. However, if I have problems with XCode using gcc4.7 I want to be able to switch to gcc4.2 on the fly.

First thing to do is install gcc4.7, I will be using MacPorts.


If you want to see what versions of gcc you have at your disposal you can run:
$sudo port search gcc
If you are interested in gaining C++0x/ C++11 functionality you might want to consult http://gcc.gnu.org/projects/cxx0x.html to select a version that suites your needs.

Now to install the new/other version:

$sudo port install gcc47
If I were to see what version of gcc I was running by executing:
$gcc -v
I would see that it still points to a 4.2 version of gcc. What you need to do is "select" the version of gcc you wish to use. You may need to install gcc_select first, but it might already be installed:

$sudo port install gcc_select
To actually select the working version of gcc[1], first see what you have to choose from:
$port select --list gcc
Then make the choice:
$sudo port select --set gcc mp-gcc47 
At this point running gcc (even to display the version number) may result in an error message as such:
gcc-mp-4.7: error trying to exec '/opt/local/bin/i686-apple-darwin10-llvm-gcc-4.2': execvp: No such file or directory
In which case you have to rehash your links[2]. To see if gcc is indeed hashed run:
$hash
You will probably see gcc listed in there, rehash gcc's link:
$hash gcc 
Checking the version number of gcc you should see the version you selected as working! In my case gcc4.7 is now working!

[1] http://stackoverflow.com/questions/837992/update-gcc-on-osx 
[2] http://superuser.com/questions/423254/macports-gcc-select-error-trying-to-exec-i686-apple-darwin11-llvm-gcc-4-2