Mac RAM File Cache & VMWare Fusion

I have 16GB RAM in my Mac Mini; maxed out! I’ve been using all of it lately. I’ve even crashed the Mini because it used 100% of the RAM. Never done that before.

After some experimentation I’ve found that rebooting the Windows 7 virtual machine, running in VMWare Fusion 5.0.4, does not release RAM retained for File Cache. No idea why; I didn’t take the time to wait between reboots to see if the RAM would eventually be released.

The “fix” I’ve found is to purge the memory. Basically, it’s a manual release of the RAM allocated to File Cache.

sudo purge

Simple Traffic Splitting on Macs

At the office we have two separate data connections. One is used for business traffic via Ethernet and secure Wifi. The other is open Wifi only and meant for guests who visit; it does not allow access to our domain controlled business network.

Lately, we’ve had several high bandwidth Mac users who’ve been saturating our business network with artwork uploads / downloads. The solution I’ve just implemented is pretty straightforward.

  1. Open System Preferences > Network and turn on Wifi
  2. Connect Wifi to the guest network
  3. Click the cog icon under the network connections list and select Set Service Order
  4. Drag Wifi above Ethernet in the list and apply

Now, when one browses about the interwebs the Mac will attempt to connect via the Wifi connection, which happens to be connected to the guest internet connection. Any traffic to local, business network, locations will fail to resolve and the Mac will attempt to connect over the Ethernet connection. Whalla! Network splitting without having to look at routing tables.

De-Duplicating JavaScript Array of Objects

Yesterday I found I needed to de-duplicate an array of objects. The problem is, I needed to compare the objects in their entirety, not just by an individual key. I was quite surprised to find something was not already written up, and shared, on the interwebs.

Maybe it’s rare that one needs to get a unique array of objects by comparing the entire object. Or maybe it’s not very performant so folks don’t bother. Either way, here’s what I came up with. I hope you find it helpful. If you come up with a better method, please do let me know.

JS Bin

Using Yeoman on Windows 7

Quick intro for those new to Yo.

Yeoman is an application and work-flow that simplifies many tasks espoused by the modern web development community. Such tasks like, automated application testing, live reload in browser, CSS pre-processing, and CSS and JS minification / concatenation, etc.

When you install Yeoman, you end up with three main apps in your workflow,

  • Yo – The Yeoman app which facilitates scaffolding out applications and pre-configuring Grunt,
  • Grunt – is a build tool used to preview, test and build the final production version of your application,
  • and Bower – is a dependency manager.

You can learn more about Yeoman and it’s associated work-flow at

Installing Yeoman & Dependencies

When Yeoman was first released there was no Windows support, you had to have a Mac or Linux development environment. That’s changed thankfully and the rest of this article is about installing Yeoman, and it’s dependencies, in a Windows environment.

Yeoman’s dependencies include NodeJS and Git. If you plan on using pre-processing on your CSS you’ll want Ruby and Compass as well.

Step 1: Installing NodeJS

nodejsNode is a Javascript based server you run on your local system. You can use Node to serve entire websites, manage web-socket connections and so much more. For our purposes though, Yeoman uses Node to install components via a package registry called NPM and serve live-reload pages of your app while you’re developing.

1. Visit and click the “Install” button to download a Windows MSI installer.
2. Run the installer like you would any other Windows installer.

There’s so much more you can do with Node. In your spare time you should checkout these links:

Step 2: Installing Git

This workflow uses Git to manage downloads from NPM and Bower. You need Git installed even if you’re not using it for your project. If you already have Git installed, just skip this step.

1. Download Git from
2. Run the Git exe and keep the defaults.
3. When asked about “Adjusting your PATH environment” choose “Run Git form the Windows Command Prompt
4. On the next screen, “Choosing the SSH executable“, choose “Use OpenSSH
5. On the next screen, “Configuring the line ending conversions“, choose “Checkout Windows-style, commit Unix-style line endings
6. Clicking next will start the install process, just let it run.
7. When the installer completes, just click the “Finish” button.

Step 3: Installing Ruby

This is by far the most confusing… But not once you figure it out. If you’ve never at least heard of Ruby, you’re probably not a legit web developer. I don’t use Ruby myself, but it’s the language needed to run Compass, which I do use.
The install of Ruby on Windows is made easier by the RubyInstaller for Windows.

1. Download RubyInstaller – As of this writing 1.9.3 is the stable version, choose that.
2. Run the installer like you would any other Windows Installer.

Step 4: Installing Compass

Compass is a pre-processor for CSS which means you can write CSS the way you always wanted to, using variables, calculations, hierarchical structure, etc. Compass parses your files and outputs syntacticly correct CSS. You can learn more about Compass at

Compass is a Ruby Gem, a self-contained Ruby application, and as such you must install Ruby first (see step 3). In your command line, use the following commands:

$ gem update --system
$ gem install compass

Note: You must run your command line as Administrator or you’ll get errors.

Step 5: Installing Yeoman, Grunt & Bower

As long as you have installed the latest Node version, you’ll have the latest version of NPM and installing all three tools requires just one command line command:

$ npm install -g yo

If you have an NPM version 1.2.10 or older, then you’ll need to install Grunt and Bower separately using:

$ npm install -g grunt-cli bower

Next, let’s install a Yeoman generator. A generator is a preset project scaffold which when run will build out the files on your system for your use. Consider it a jump start on your project.
We’ll install the general “webapp” generator which will scaffold out a project containing HTML 5 Boilerplate, jQuery, Modernizr and Twitter Bootstrap.

$ npm install -g generator-webapp

Using Yeoman

Let’s run the generator! In your command line navigate to the directory you’d like to work on your project in. I often end up using something like: C:\\Users\ryanm\Documents\Projects\{myprojectname}. Now run:

$ yo webapp

yo_1Yeoman will run in interactive mode allowing you to confirm the scaffolding options for this project, just follow the prompts. Once all prompts are completed, yo will build out the files for the project. During the build out you’ll see lots of npm http requests as yo downloads the needed components.

I’m not going into details on using Yeoman, Grunt and Bower in this article, there are plenty of resources out there on that subject (see below links). If you have any unanswered questions, or suggestions, about the install though please leave a comment.

Yeoman Resources

SQL, First and Last Days of Week

I needed to find the first and last days of the last week. Sunday being the first, Saturday being the last.

SELECT DATEADD(wk, DATEDIFF(wk, 6, '2013-08-11'), 6) AS START_OF_WEEK
SELECT DATEADD(wk, DATEDIFF(wk, 6, '2013-08-11'), 6 + 6) AS END_OF_WEEK