Category: Dev Tools


Apt-Get has come to Windows. Just as the Greek gods were renamed when they were adopted by the Romans, Linux’s apt-get on Windows is known as “Chocolatey”.

If you are a developer, you can think of Chocolatey as Nuget for your machine. If you are unfamiliar with nuget or apt-get, Chocolatey is simply an independent repository of software installation scripts, allowing you to install apps such as Firefox, Visual Studio, or Resharper on your machine with a single command line. Even better, you can create your own powershell scripts that can install a multitude of apps in unattended bliss.

For example, if you wanted to setup a new development workstation, a script like the one shown below would eliminate a lot of boring desktop admin work, installing all your favorite development tools automatically. It even installs Chocolatey for you. Checkout chocolatey.org for the full list of apps available and their command lines.

NOTE: the command “cinstm” means “install if it isn’t already installed”

NOTE: don’t forget to set your script execution policy to Unrestricted before you run this powershell script
(from a command line run in Admin mode)

Set-ExecutionPolicy Unrestricted

Here is the powershell script, which you can save as “SetupDevEnviron.ps1″:

# This script was based off these samples: https://github.com/chocolatey/chocolatey/wiki/DevelopmentEnvironmentSetup

function Install-NeededFor {
param(
   [string] $packageName = ''
  ,[bool] $defaultAnswer = $true
)
  if ($packageName -eq '') {return $false}
  
  $yes = '6'
  $no = '7'
  $msgBoxTimeout='-1'
  $defaultAnswerDisplay = 'Yes'
  $buttonType = 0x4;
  if (!$defaultAnswer) { $defaultAnswerDisplay = 'No'; $buttonType= 0x104;}
  
  $answer = $msgBoxTimeout
  try {
    $timeout = 10
    $question = "Do you need to install $($packageName)? Defaults to `'$defaultAnswerDisplay`' after $timeout seconds"
    $msgBox = New-Object -ComObject WScript.Shell
    $answer = $msgBox.Popup($question, $timeout, "Install $packageName", $buttonType)
  }
  catch {
  }
  
  if ($answer -eq $yes -or ($answer -eq $msgBoxTimeout -and $defaultAnswer -eq $true)) {
    write-host "Installing $packageName"
    return $true
  }
  
  write-host "Not installing $packageName"
  return $false
}

#install chocolatey
if (Install-NeededFor 'chocolatey') {
  $downloadUrl = 'http://chocolatey.org/install.ps1';
  $webclient = new-object net.webclient;
  $webclient.proxy.credentials = [system.net.credentialcache]::DefaultNetworkCredentials;
  $webclient.downloadstring('http://chocolatey.org/install.ps1') | iex;
}

Write-Host 'Installing utilities...'
cinstm Firefox
cinstm GoogleChrome
cinstm 7zip.install
cinstm Console2
cinstm fiddler

Write-Host 'Installing Visual Studio...'
cinstm VisualStudio2012Ultimate

Write-Host 'Installing Visual Studio packages...'
if (Install-NeededFor 'VS2012 Update 2', $false) {
	cinstm Dogtail.VS2012.2
}
cinstm resharper
cinstm NugetPackageManager
cinstm nuget.commandline
cinstm tfs2012powertools
cinstm tfsSidekicks2012

Every programmer has heard of the SOLID programming principles (+10pts if you can regurgitate all 5, verbatim, on a job interview in under 60 seconds), but  despite being neatly wrapped up in a marketable acronym that would make Ian Fleming proud, the mnemonic benefits of SOLID are still questionable.  I mean, what part of “Liskov substitution principle” is not clear to you?

Ignoring the marketing gimmick, the implementation of these principles is often a point of contention.  One of the principles in particular is often hotly argued over in forums, blogs, and yes, even job interviews.  I’m talking about the Open-Closed Principle, which states “software entities (classes, modules, functions, etc.) should be open for extension, but closed for modification” (as per Bertrand Meyer via Wikipedia).  I’ve heard a range of answers to how this principle should be practiced in code projects.  I’ve worked with people who insist that under the Open-Closed Principle, the source code itself should never be changed except for bug fixes, basically using class inheritance as a substitution for source control.  The class structure that way of thinking produces a huge mess, as you can probably imagine, with classes named like XYZ, XYZWithABC, XYZWithDEF, XYZWithABCAndDEF, etc. and without multiple inheritance, code duplication was common, almost inevitable really.

Jon Skeet has a refreshingly sober view of the Open-Closed Principle on his blog.  He quotes Craig Larman and Alistair Cockburn regarding a more clearly defined principle, Protected Variation, in which we identify points of predicted variation and create a stable interface which is neither too constrictive for implementations nor too hairy for clients.   This allows many different concrete subclasses, and code which only depends on the parent class doesn’t need to know about the subclasses in order to use them when they are presented as the parent class.  Furthermore, no existing functions can be removed (as they may be relied on by existing clients) and no new pure virtual functions can be added (as they will not be implemented by existing subclasses).

Phil Haack, being a Microsoft veteran, astutely retorted that ”SPLID” just doesn’t have that same marketable ring to it.

NoSQL Primer

Here are some notes on the different flavors of NoSQL databases:

View full article »

The next generation Kinect, code-named Capri, is 1/10th the size of the current Kinect and is as small as a stick of gum.

Capri size of a stick of gum

It has a range of 0.8m to 3.5m letting you control your smartphone or tablet with a wave of the hand or scan a room in 3D (and possibly even record movies in 3D).  PrimeSense is planning on releasing it at the end of the year and it should be in phones and tablets next year.

Capri prototype

 

http://ces.cnet.com/8301-34435_1-57563350/the-3d-sensor-that-could-change-our-mobile-lives/

http://www.primesense.com/news/you-asked-for-it/

 

How to fix the Visual Studio 2012 skin

The Visual Studio 2012 default skin is just awful. To fix it, here are the shortcuts.

To use this nice dark theme, import this VSSettings file:

Run this powershell command to turn off the ALL CAPS menu (if in Visual Studio full version):

Set-ItemProperty -Path HKCU:\Software\Microsoft\VisualStudio\11.0\General -Name SuppressUppercaseConversion -Type DWord -Value 1

(or if in Visual Studio Express Web):

Set-ItemProperty -Path HKCU:\Software\Microsoft\VWDExpress\11.0\General -Name SuppressUppercaseConversion -Type DWord -Value 1
© 2013 Robert Corvus