Showing posts with label tools. Show all posts
Showing posts with label tools. Show all posts

Monday, April 11, 2016

Rapidly Setting Up an Azure PC with Chocolatey

Azure is a great platform.  It is easy to spin up developer and test machines.  Microsoft has default installs of Visual Studio but there is currently no way to select other software.  Silent installs are nothing new but Chocolatey takes it a step further to be a distribution point of installers.  Think of Chocolatey as NuGet but with applications instead.  With Chocolatey and Azure you can rapidly install the software that you need to work effectively.  This also works great if you purchase a new PC or laptop or decide to Nuke and Pave a machine.   
    

To install Chocolatey open an admin command window and execute this statement:

@powershell -NoProfile -ExecutionPolicy Bypass -Command "iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))" && SET PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin


To make installing applications easier with Chocolately, I created a batch file to be called by a parent batch file called InstallApp.bat.  It has standard parameters of -y which is to accept all defaults.

cinst %1 -y --allow-empty-checksums


I then created the parent batch file with a list of the applications I wanted to install before installing Visual Studio.  If Visual Studio is already pre-installed on an Azure machine you can simply create one big batch file.

REM Media
call InstallApp paint.net
call InstallApp foxitreader
call InstallApp cutepdf
call InstallApp evernote
call InstallApp imgburn
call InstallApp zim
call InstallApp anyvideoconverter
call InstallApp notepadplusplus.install
call InstallApp picpick.portable
call InstallApp todoist

REM Web
call InstallApp firefox
call InstallApp googlechrome
call InstallApp flashplayerplugin
call InstallApp skype
call InstallApp teamviewer

REM Utilities
call InstallApp 7zip.install
call InstallApp filezilla
call InstallApp chocolateygui
call InstallApp winmerge
call InstallApp virtualclonedrive
call InstallApp beyondcompare
call InstallApp roboform
call InstallApp javaruntime
call InstallApp truecrypt
call InstallApp windirstat

REM Developer Tools before Visual Studio
call InstallApp tortoisesvn
call InstallApp expresso
call InstallApp ilspy
call InstallApp sliksvn
call InstallApp git.install
call InstallApp tortoisegit
call InstallApp visualstudiocode
call InstallApp baretail
call InstallApp nunit
call InstallApp httrack
call InstallApp xenulinksleuth
After installing Visual Studio I have a set of applications that I like to install:

REM Install After Visual Studio is Installed
call InstallApp visualsvn
call InstallApp resharper-platform
call InstallApp mono


That’s it.  Simply run the batch file and all the software that you need will be downloaded and installed without intervention.  Come back later and your PC will be ready.

Friday, February 13, 2015

Using Jasmine with Visual Studio

Jasmine Overview

Jasmine is a JavaScript unit testing framework similar to MS Test or NUnit.  Jasmine requires four references to get it to work:
  • Jasmine.js
  • Jasmine-html.js
  • Jasmine.css
  • boot.js
Let's test the following JavaScript:

function ExtractNumbers(text) {
    if (!text)
        return text;
    
    return text.replace( /\D+/g, '');
}

Here is the test that you would write in Jasmine:

describe("Common tests", function() {

    it("ExtractNumbers method should extract numbers from a string", function () {
        expect(ExtractNumbers("Logan 5, Francis 7")).toBe("57");
    });

});

I have created a JSFiddle to demonstrate:

Using Jasmine with Visual Studio and MS Test


Follow these steps to create a Jasmine project with Visual Studio:
1.  Create a blank web project (not a class library like you would do for MS Test or NUnit)
2.  Create a similar folder structure for the JavaScript files you wish to test.
3.  Add the JavaScript files as links in your project
4.  You will need to manually download Jasmine from GitHub and put the files in the Scripts folder since there is no recent Nuget package.
5.  Under Tools -> Extensions and updates, Visual Studio Gallery.  Search and Install Chutzpah Test Adapter for the Test Explorer which is a JavaScript test runner for Visual Studio.  Also install Chutzpah Test Runner Context Menu Extension.  Chutzpah works with QUnit, Jasmine, and Mocha testing frameworks.
6.  Add a JavaScript file that will be used for the tests.  Add a reference at the top to the JavaScript file you wish to test by simply dragging and dropping the file to the top.  Here is an example:

/// <reference path="../../UI/Scripts/Common.js" />

describe("Common tests", function() {

    it("ExtractNumbers method should extract numbers from a string", function () {
        expect(ExtractNumbers("Logan 5, Francis 7")).toBe("57");
    });

});

Using Jasmine with Resharper

Follow the same steps above for Resharper except Chutzpah is not required for Resharper.  Resharper works out of the box with QUnit and Jasmine to run JavaScript tests.

Wednesday, February 11, 2015

Using QUnit with Visual Studio

QUnit Overview


QUnit is a JavaScript unit testing framework similar to MS Test or NUnit.  In order for QUnit to work, you need a reference to QUnit.js and also a QUnit.css file.

Given the following JavaScript:

function ExtractNumbers(text) {
    if (!text)
        return text;
    
    return text.replace( /\D+/g, '');
}

Here is a corresponding QUnit test:

QUnit.test( "ExtractNumbers", function( assert ) {
  assert.equal( ExtractNumbers("Logan 5, Francis 7"), "57", "Passed!" );
});

I have created a JSFiddle to demonstrate:
http://jsfiddle.net/gfinzer/tmdn2nfj/6/


Using QUnit with Visual Studio and MS Test

Follow these steps to create a QUnit project with Visual Studio:
1.  Create a blank web project (not a class library like you would do for MS Test or NUnit)
2.  Create a similar folder structure for the JavaScript files you wish to test.
3.  Add the JavaScript files as links in your project
4.  Add a NuGet package reference to QUnit
5.  Under Tools -> Extensions and updates, Visual Studio Gallery.  Search and Install Chutzpah Test Adapter for the Test Explorer which is a JavaScript test runner for Visual Studio.  Also install Chutzpah Test Runner Context Menu Extension.  Chutzpah works with QUnit, Jasmine, and Mocha testing frameworks.
6.  Add a JavaScript file that will be used for the tests.  Add a reference at the top to the JavaScript file you wish to test by simply dragging and dropping the file to the top.  Here is an example:

/// <reference path="../../UI/Scripts/Common.js" />

QUnit.test("ExtractNumbers", function (assert) {
    assert.equal(ExtractNumbers("Logan 5, Francis 7"), "57", "Passed!");

});

Using QUnit with Resharper

Follow the same steps above for Resharper except Chutzpah is not required for Resharper.  Resharper works out of the box with QUnit and Jasmine to run JavaScript tests.


Wednesday, August 13, 2014

Running Software with No Admin Rights

Sometimes you are given a machine where you don't have local admin rights.  While it is understandable to lock down PCs to prevent viruses and licensing issues it can greatly hinder work.  The PortableApps platform gives you the ability to run the applications that you need without installing anything or violating any license agreements.  All the programs are free. 

Here are some great free developer tools that run on the Portable Apps Platform
Notepad++
SharpDevelop
Paint.Net
PicPick (This is like Snag It)
Filezilla
Chrome
Firefox
Zim Desktop Wiki
Expresso
WinMerge
Database Browser
Baretail
Skype
TweetDeck
ILSpy
ImgBurn
CamStudio
7Zip
Team Viewer

These are commercial programs that have Portable App Versions or can be run from the Portable Apps menu.
Beyond Compare
Directory Opus
RazorSQL
RoboForm