Apple Wireless Keyboard functionality on Windows

So with some help from some online forums, I’ve managed to compile an AutoHotkey script which will allow you to get more functionality out of your Apple Bluetooth Keyboard.

Functionality Includes:

  • Eject => Delete
  • Fn+F3 => Alt+PrtScrn
  • Fn+Alt+F3 => Alt+PrtScrn
  • Fn+F7 => Previous Media Track
  • Fn+F8 => Play/Pause Media Track
  • Fn+F9 => Next Media Track
  • Fn+F10 => Mute Volume
  • Fn+F11 => Volume Down
  • Fn+F12 => Volume Up
  • Fn+Up => PgUp
  • Fn+Down => PgDown
  • Fn+Left => Home
  • Fn+Right => End
  • Fn+F4 => Task Manager

You can download the AutoHotkey script here.

Deleting files and folders when ‘File or path name too long’

Aside

At Deepend, we’ve recently come across some issues with Node.JS modules that have stupidly deep dependency trees.

Once Node was done, we then encountered issues deleting the stupidly deep dependency trees.

As a quick work-around, I discovered the following solution:

mkdir \empty
robocopy \empty node_modules /MIR
rmdir \empty

Integrating Node.JS, NPM and RequireJS into Visual Studio / MSBuild

Working at Deepend has exposed me to many new technologies which were out-of-scope for the projects I was involved in in my previous jobs.

In my current project, we’re using RequireJS, along with their supplied optimizer to minify, and uglify our solution. To achieve this, we are required to execute the compiler via node.js.

In an attempt to streamline this process, I’ve built upon the NuGet package manager’s solution for automatic download and installation of packages, and have it running successfully with Node.

Here’s a brief rundown of the steps involved:

  1. Create a .node folder in your solution root
  2. Place my custom node.targets file inside the .node folder
  3. Open your project file in a text-editor and add the following lines:
    <Import Project="$(SolutionDir)\.node\Node.targets" Condition="Exists('$(SolutionDir)\.node\Node.targets')" />
    <Target Name="BeforeBuild">
      <CallTarget Targets="CheckNodePrerequisites;RestoreNodePackages" />
    </Target>
  4. Download the latest npm package
  5. Extract the node_modules folder to your solution root
  6. Check files into source control, and optionally create any .gitignore or similar files to ignore all other packages placed inside node_modules folders
  7. When you build, your project should now automatically download node.exe into your .node folder

You are now free to use NPM to install packages into your project as normal, e.g.

npm init
npm install requirejs --save

If you need to execute any packages explicitly, you can add pre and post-build events to your project configuration, e.g.

"$(SolutionDir).node\node.exe" "$(ProjectDir)node_modules\requirejs\bin\r.js" -o "$(ProjectDir)\static\js\main.build.js"
"$(ProjectDir)\Deepend.ProjectSync.exe" $(ProjectDir)

These instructions should work for both packaged, and shrink-wrapped installs. I’ve only tested on packaged installations myself so far.

Next I’ll be working on getting NPM to come down automatically with node, and updating my ProjectSync tool to support insertion of node and other additional targets into project files, so this whole process will become automatic once you run ProjectSync once.

This of course is just the tip of the iceberg. I’ve now cloned the nuget project, and plan to modify and distribute a version that adds node package manager support direct to visual studio as a proper extension.

Project Reference Disappears After Build

A few times now, I’ve added new projects to legacy solutions in Visual Studio, only to find that they have issues when it comes time to build.

Normally I sit there pulling my hair out checking references for 5 minutes before I remember my old foe: The .Net 4.0 Client Profile!

Updating the project’s framework from .Net 4.0 Client Profile, back to standard .Net 4.0 (or 3.5 or whatever flavour of Framework you desire) will fix the problem.

Drag’n’Drop it like it’s hot

In my work on the proprietary Ripple™ CMS, I developed a Drag and Drop interface for our “Application Builder”, which provided quite a nice user experience.

Drag'n'Drop

Adding custom properties to TFS build templates

To add custom fields into a TFS build template, you need to merge in the following sections:

<Activity>
  <x:Members>
    <x:Property Name="YourProperty" Type="InArgument(x:String)" />
  </x:Members>
 
  <this:Process.Metadata>
    <mtbw:ProcessParameterMetadataCollection>
      <mtbw:ProcessParameterMetadata Category="#400 GroupName" Description="Property Description" DisplayName="Display Name" ParameterName="Parameter Name" />
    </mtbw:ProcessParameterMetadataCollection>
  </this:Process.Metadata>
 
  <Sequence.Variables>
    <Variable x:TypeArguments="x:String" Name="MSBuildProperties" />
  </Sequence.Variables>
  <Sequence DisplayName="Update Build Arguments" mtbwt:BuildTrackingParticipant.Importance="Low">
    <Assign x:TypeArguments="x:String" mtbwt:BuildTrackingParticipant.Importance="None" To="[MSBuildProperties]" Value="[String.Format(&quot;{0} /p:YourProperty=&quot;&quot;{0}&quot;&quot;&quot;, MSBuildProperties, YourProperty.Replace(&quot;\&quot;, &quot;\\&quot;))]" />
  </Sequence>
 
</Activity>

Then update all instances of the <mtbwa:MSBuild /> tags to reference this additional variable, e.g.

<mtbwa:MSBuild CommandLineArguments="[String.Format(&quot;/p:SkipInvalidConfigurations=true {0} {1} &quot;, MSBuildArguments, MSBuildProperties)]" Configuration="[platformConfiguration.Configuration]" DisplayName="Run MSBuild for Project" GenerateVSPropsFile="[True]" MaxProcesses="[If (MSBuildMultiProc, 0, 1)]" OutDir="[BinariesDirectory]" Platform="[platformConfiguration.Platform]" Project="[localBuildProjectItem]" mva:VisualBasic.Settings="Assembly references and imported namespaces serialized as XML namespaces" Targets="[New String() { &quot;Clean&quot; }]" TargetsNotLogged="[New String() {&quot;GetNativeManifest&quot;, &quot;GetCopyToOutputDirectoryItems&quot;, &quot;GetTargetPath&quot;}]" ToolPlatform="[MSBuildPlatform]" Verbosity="[Verbosity]" />
 
<mtbwa:MSBuild CommandLineArguments="[String.Format(&quot;/p:SkipInvalidConfigurations=true {0} {1} &quot;, MSBuildArguments, MSBuildProperties)]" Configuration="[platformConfiguration.Configuration]" DisplayName="Run MSBuild for Project" GenerateVSPropsFile="[True]" LogFileDropLocation="[logFileDropLocation]" MaxProcesses="[If (MSBuildMultiProc, 0, 1)]" OutDir="[outputDirectoryPerProject]" Platform="[platformConfiguration.Platform]" Project="[localProject]" RunCodeAnalysis="[RunCodeAnalysis]" mva:VisualBasic.Settings="Assembly references and imported namespaces serialized as XML namespaces" TargetsNotLogged="[New String() {&quot;GetNativeManifest&quot;, &quot;GetCopyToOutputDirectoryItems&quot;, &quot;GetTargetPath&quot;}]" ToolPlatform="[MSBuildPlatform]" Verbosity="[Verbosity]" />

The results look something like this:

Example of a customized build template

Example of a customized build template

Whilst the replace isn’t strictly necessary, it’s a good habit to get into to avoid getting stung by common things like file-paths later.

Enabling Secure Sockets Layer (SSL) on Team Foundation Server 2010

I recently attempted to enable HTTPS on my Team Foundation Server.

Easy right? Just add a HTTPS binding to the tfs website.

Actually, it’s a bit trickier than that, you see, TFS2010 likes to use your local machine name for internal communications by default. In order to get the web UI to play nicely, you have 2 options.

  1. Add a HTTPS binding for the machine name to the TFS Website too (e.g. https://tfsbox)
  2. Add the tfs binding into the web config (e.g. https://tfs.mydomain.com)

After I got #1 working, I pursued the ideal solution, which was option #2.

To do this, follow these steps:

  1. Open “Application Tier/Web Access/Web/web.config” in the TFS directory
  2. Find the <tfsServers> block
  3. Add in a <clear /> tag to prevent any incorrect or old bindings from being included
  4. Add in your server like so <add name=”https://tfs.mydomain.com/tfs” />

At the end, you should end up with something that looks like this:

1
2
3
4
<tfServers>
    <clear />
    <add name="https://tfs.mydomain.com/tfs" />
</tfServers>

Without this, you’ll keep on getting the error “TFS30063: You are not authorized to access ‘tfs.mydomain.com'” and similar errors everywhere from the Web UI, all the way through to the Change URL screen in the Team Foundation Server Administration Console.

IMPORTANT NOTE: You’ll notice that there was already a commented sample server in the web.config. It’s important that you either ignore this line, or correct it, as it will be missing the trailing /tfs that is required to get everything working.

The Un-Official Faculty of The Mind Visual Studio Theme

After setting up the Faculty of the Mind settings and customizing them for Visual Studio 2010 again for the millionth time, I’ve decided to actually archive the slight tweaks that I make, so I don’t have to spend 15 minutes setting up custom colours every time I flash my machine/s.

Just to make it clear, this theme is based on the awesome work by Fredrik Kalseth

It also relies on the Envy Code font made by Damien Guard

Download it here

C# Preview

C# Preview

Javascript Preview

Javascript Preview