Friday, January 27, 2012

Parallels Desktop for Mac Rocks


I setup a Windows Server 2008 R2 VM last night on my Mac using Parallels, and it completely rocks. It is the _best_ VM experience I've ever had.  Parallels has a ton of great features that make working between the host and guest OS seamless.

The install experience is also very easy, you just point it an ISO image and it attempts to automate the Windows install with an unattended script it generates internally. I did have one problem, Windows didn't like my product key for some reason, so I opted for the manual install and entered the key when I "authorized" my copy of Windows.

When I installed I opted for the seamless desktop, and indeed it is seamless. It's so seamless in fact, it's like running native Windows apps directly from OS X. The launcher has all your Windows apps, you can get at your start menu, the guest and host share the same home folder, and you can drag and drop files between OS X and Windows.  It just freakin works!

I did have one issue during the installation of Windows apps, I found that mounting the ISO image from my Mac and trying to install from the mounted drive that would show up in Windows didn't work correctly. I would get all sorts of odd errors trying to run the installer. I ended up copying the ISO to the guest and extracting it using 7-Zip so that the actual install process would run from the local C: drive in Windows.

All in all, Parallels is definitely worth the money for anyone that needs to regularly run a VM on OS X.

Upgrading SenchaTouch2 PR3 to PR4

I upgraded from SenchaTouch2 PR3 to PR4 today without much of a problem. I only ran into one issue, and it was a pretty small one. For the most part they've done an excellent job of moving the framework forward without completely breaking early adopters by slowly phasing out deprecated APIs.

There was only one instance where I had to change code now. In the controllers I was hooking up application event listeners. Apparently in PR4 they changed the name of the application from 'application' to '_application', e.g. I needed to add an underscore:


    init: function() {
        this._application.on({
            showView: this.onShowView,
            scope: this
        });
    },


There were a few other warnings about having refs defined in the controllers, but for now I'm not going to do anything about that. The application still works. I'm going to completely rewrite it all again in the next few days to take advantage of the routing they've added in PR4, so the fixing of the warnings can wait.

Tuesday, January 24, 2012

Layout Problems in SenchaTouch 2

I've been learning the SenchTouch2 (ST2) framework over the past week using the PR3 release. ST2 is a powerful framework for building mobile application using HTML5 and JavaScript. While powerful, its rather easy to shoot yourself in the foot without even realizing you are the one holding the gun. For instance I've had two different instances where UI components wouldn't display.

The first instance I encountered was that I didn't add a flex attribute on my two view items in a card view. Without the flex attribute set the views would never show up.


Ext.define('MyApp.view.Viewport', {
        extend: 'Ext.Container',
        xtype: 'myviewport',
        config: {
        fullscreen: true,
            layout: {
            type: 'card',
            align: 'stretch'
        },
        items: [
            {
                xtype: 'widget-home',
                flex: 1 // remove this and the widget never shows
            },
            {
                xtype: 'widget-login',
                flex: 1
            }
        ]
    }
}

Secondly I couldn't get a list to show any data inside a panel. It turned out that my panel layout was breaking the list.


Ext.define('MyApp.view.TaskList', {
    extend: 'Ext.form.Panel',
    scrollable: 'vertical',
    config: {
        /*
        // this layout broke the below list
        layout: {
            type: 'vbox',
            align: 'left'
        },
        */
        items: [
            {
                xtype: 'list',
                store: {
                    fields: ['title'],
                    data:[{title: 'Task1'}]
                },
                height: 200,
                itemTpl: '<div>{title}</div>',
                flex: 1
            }
        ]
    }
}


I assume its my fault since I'm unfamiliar with the framework, yet at the same time its frustrating because there's absolutely no easy way to tell where things are going wrong. There's no errors, no warnings, the UI component just doesn't show up.

Thursday, January 19, 2012

Git Error "No supported authentication methods available"

After installing msysgit on my Windows 7 box and setting up my SSH keys I received an error trying to clone a repository from GitHub. It turns out I already installed TortoiseGit a long time ago and for got all about it, so my SSH configuration was not working correctly.

To fix the problem I uninstalled TortoiseGit and then reinstalled msysgit one more time.

Wednesday, January 18, 2012

Silently Installing Google Chrome in Bulk

I found myself in a situation where I needed to install Google Chrome on all 20 of our TeamCity build agents. Doing this manually is a PITA. That's 20 log ins and downloads. Meh.

The first step is to be able to install Chrome in silent or unattended mode. By default the download you get from Google's site is just a bootstrapper for the real download. The real installer which you need in order to silently install it is not published, but you can find it. It's basically http://dl.google.com/chrome/install/xxx.xx/chrome_installer.exe where xxx.xx is the version number of the latest browser. In the about dialog of my Chrome install it displays the version as: 16.0.912.75 m, which means the download link would be: http://dl.google.com/chrome/install/912.75/chrome_installer.exe

Once you have the real installer you need to install it. Fortunately we have PsExec installed on all our build agents, so I can remotely execute commands. In this situation I just logged into one build agent, got the Chrome installer and then ran:

psexec \\tc-buildagent1,tc-buildagent2,... -c chrome_installer.exe /s

A few minutes later I had installed Chrome on all 20 agents. Much faster!


Saturday, January 7, 2012

3rd party JS libs and CDNs

While its probably better to use publicly available CDNs for delivery of 3rd party JavaScript libaries, like JQuery, I realized that is not an option for Daptiv. More than a few of our customers restrict external internet traffic to specific IP addresses, i.e. daptiv.com. That means any 3rd party libraries we use need to come from a domain we control, otherwise firewall rules become increasingly complex for our customers to manage.

We currently use Akamai for content delivery via our singular domain, but with recent work its possible for us to host static content on a separate domain to allow for parallel downloads from more than one domain. We would have more efficient requests with a separate domain since our standard daptiv.com cookies wouldn't need to be sent with every static resource request.

Perhaps we'll just push content off to cloudfront.net in the future, or we could keep using Akami but with a separate domain. Something to think about.

Friday, September 9, 2011

.NET BDD acceptance test frameworks

We've been spending a lot of time gathering requirements and really just trying to understand our problem domain this week.  What happens when I have an effort driven task with fixed duration and I add a resource?  Things like that.

While we could just write it all down into a word document, we figured it would be a better use of our developer time to write code that describes the requirements.  In other words we plan on using a BDD approach to the problem.

In the past we've used SpecFlow but found it too difficult to maintain, it probably would have been a better use of time to teach the STE writing the specs how to code in C#.  Mapping plain text to code using regex is not my idea of being productive.  I know I'd rather use C# to write tests, so what else is there?

NSpec looks like a pretty decent BDD framework, allowing you to easily build up contexts without using inheritance, but it relies on magic strings all too much.  NSpec does have some newer support for delegates, but...

We're trying out MSpec (with an 'M' not an 'N' as in the previous paragraph) which seems to be a nice middle ground between NUnit and SpecFlow. You end up writing a lot of small classes that have lots of delegates in them. What would be one test method in a traditional xUnit framework turns into an entire class. Notice how my assertion is just an 'It' delegate field.
[Subject(typeof(Task))]
public class DurationSpecs : duration_base
{
	Because of = () => _task.FinishDate = Dates.Monday;
	It should = () =>_task.Duration.ShouldEqual(Durations.OneWorkDay);
}
Maybe I'm just not doing things right, but even their samples on GitHub seem follow this pattern.  I like the strong typing compared to SpecFlow or even NSpec, but context build up is a little awkward requiring you to use inheritance.

I'm also unsure how to properly group tests together.  Should a file contain a bunch of tests around a subject or should they contain a scenario or something else entirely?  For our situation I could see us using scenarios because I know we'll likely have thousands of tests which center around the Task subject.

Update

Apparently I am structuring things wrong.  I really should be establishing my context within the spec itself and not within the base class.  I found this Stackoverflow response from the MSpec maintainer very helpful.