ExpressJS, AngularJS, and pretty URLs

We added a new web interface to a set of internal developer APIs so our developers would no longer have to manage unruly postman collections and I kept running into problems where the catch-all express route was catching too much or other routes were no longer behaving correctly.
If you’re having problems with


Here are all the steps I took to resolve our issues:

  1. Add a base tag of <base href=”/”> to your angular index file.
  2. Make sure all of your static routes are defined first in your express app.
  3. After all of your app’s routes, make sure your catch all route is absolutely last
    app.all('/*', function(req, res, next) {
      res.sendfile('index.html', { root: 'myWebRoot' });
  4. That’s it.

I kept running into so many issues and they all boiled down to the static routes not being defined absolutely first. Hopefully with this post you don’t have to make the same mistake.

Possible Fix for Hosted Git ( Timeout Issues

When installing packages using your language or framework of choice, you’re often required to have git installed when the packages are hosted remotely and versioning is done using git tags or branches. This is great usually, but occasionally you’ll come across a dreaded timeout error like this:

ECMDERR Failed to execute "git ls-remote --tags --heads git://", exit code of #128

Additional error details:

fatal: unable to connect to[0:]: errno=Operation timed out

When this occurs, often it’s just an issue with Github handling git commands. To bypass git using git:// addresses, force them to use https:

git config --global url."https://".insteadOf git://

This isn’t a solution for everyone, especially if you have locally hosted git repositories that are only accessible via git:// , but it might resolve your Github or Bitbucket issues temporarily. To revert this change, simply run the following:

git config --global --unset url."https://".insteadOf

Windows 10 Technical Preview – Finally, virtual desktops.

I made a quick video highlighting my experience with Microsoft’s Virtual Desktop solution inside the new Windows 10 Technical Preview. So far, I’m extremely thrilled that Microsoft added virtual desktops, as it was something sorely lacking in Windows and yet was available on most other popular operating systems. Also included is a remapping of the old Windows Aero Flip 3d (Windows Key + Tab) to the new Windows 10 Task View – which is basically OS X’s Mission Control – a method for managing, switching to, and viewing virtual desktops. Here are some other useful shortcuts that are new or changed from previous versions of Windows (from here on out I’ll refer to Windows Key as WinKey):

Alt + Tab is basically unchanged and properly switches to the correct desktop when an app is selected that isn’t on the current desktop.

WinKey + Ctrl + D is the shortcut to create a new virtual desktop.

WinKey + Ctrl + F4 is the shortcut to close a virtual desktop. Closing a virtual desktop will move all open applications and windows on that desktop to the next available desktop – so don’t fret about losing all of your work by closing a desktop.

WinKey + Ctrl + Left (or Right) Arrow switches you to the left or right virtual desktop you have open. If you’re currently switched to a virtual desktop on one of the ends, it does not loop you back around if you try to continue in that direction.

The only downside to the new virtual desktop setup in Windows 10 is that you currently cannot move applications or windows from one virtual desktop to the next while in Task View. This is a major selling point of Mission Control for me, as it allows me to easily manage all of my open applications and regroup them under current or new virtual desktops as necessary to fit my current task. Other than my hopes that Microsoft implements better application and virtual desktop management into Task View before launch, I’m excited to upgrade all of my Windows 8.1 desktops and virtual machines to Windows 10 when it’s launched. The new Start menu (with integrated Start Screen) is really what Windows 8 should have shipped with; Microsoft’s new Windows 10 operating system is finally aware of its place when installed on a computer with a mouse.

Jet – A Costco for the Web

Jet is launching in the next month or so and it’s going to be something I’ll keep an eye on. The founder, Marc Lore, announced on his blog that they’ve closed a round of Series A funding so it’ll be interesting to see if they make it to IPO. Jet, founded by the same guy who started and, is setting out to take the proven idea of a “members only” warehouse club in a more modern and tech savvy direction.

Costco, as a concept, has worked very well but their website and online inventory system are lacking. Amazon’s website and logistics are great, but their Prime membership is pricy and is far more than the cheap membership for fast, free shipping that it started as. Now that Prime is roughly $80 and includes streaming video (which most already have netflix for) and streaming music (with a pretty abysmal selection compared to any other paid streaming service), I feel like it’s approaching a “jack of all, master of none” situation. $80 for discounted shipping and two streaming services (one very mediocre, the other largely duplicated by Netflix) is likely pricing itself out of the normal $50 per year membership price most consumers have in their minds already thanks to Sam’s club and Costco. While most of my peers have Amazon Prime, my parents have Netflix and Costco memberships and I don’t think it’d be easy to convince them to get an $80 Prime membership as long as they hold on to the others. Even then, with a shiny new Prime membership, prices are almost always better at Costco for items carried by both Amazon and Costco.

Jet will likely be looking for the Costco/Sam’s member as well as bargain hunters who crawl through Slickdeals, Fatwallet, and Saviry as their potential customer base. If Jet comes out of the gate with a $50 or lower membership price, free “standard” shipping, and prices akin to most members-only clubs my parents would surely buy in to that, and so would I. It’s much easier to swallow a membership price if you can easily see the value. Costco’s value is the physical store itself whether it be for buying tires or trips to the brick and mortar store on a Saturday. Jet could easily put itself in a position to be an online Costco for the weekdays or nights when going to Costco is out of the question.

Connecting to an Azure SQL Database with FreeTDS (on a Mac even)

Connecting to an Azure database on your Mac can be more convenient than opening a virtual machine at times, especially when you’re working with a 128gb SSD and your Windows VM isn’t on said SSD. FreeTDS to the rescue!

While it would be nice if Microsoft would opensource the Microsoft SQL Server driver for Linux, FreeTDS seems to work for my situations just fine. In order to get FreeTDS installed and connecting to Azure, you’ll need Homebrew. After you get that sorted out, open up your favorite terminal emulator and run the following:

brew install --enable-msdblib --with-unixodbc freetds

Once this is completed and freetds is compiled, you’ll want to make some changes to your odbcinst.ini file possibly located at /usr/local/Cellar/unixodbc/2.3.2/etc/, but the best way to be certain about where your unixodbc installation assumes its files are is to run odbcinst -j from the terminal to check.

Once you have your odbcinst.ini opened in your favorite text editor, add the following:

Trace = No
TraceFile = /tmp/odbc.log

Driver = /usr/local/lib/
UsageCount = 1

If something goes awry, you can try debugging the situation with Trace = Yes later.

At this point, you have a driver installed named FreeTDS but no data sources configured. Go back to your text editor and open up the file ~/.odbc.ini or use the SYSTEM DATA SOURCES file that was given when you ran odbcinst -j. Add the following to the file you just opened:

Description = My MS SQL server on Azure
Driver = FreeTDS
Server =
Database = XXXXXXX
Port = 1433
TDS_Version = 7.2

Change the Server and Database options to match your own. Notice the TDS_VERSION, this option is key to connecting to Azure SQL Server instances since Azure doesn’t seem to accept connections for any protocol versions 7.0 or less.

At this point, you should be able to connect to your database via the isql tool:


If something isn’t working, make sure to enable the ODBC Tracing and check that log. Also, verify you’ve added your ip to the Allowed IP Addresses section under the Configure tab once you’ve selected your SQL Database Server in the Azure management portal.

PHP 5.6 x86 (nts) Windows SQLSRV and PDO_SQLSRV Extensions

UPDATE: check out Rob’s additions and compiled extensions here. They have added patches and he’s done an excellent job keeping up to date with them. I initially compiled because there weren’t any sqlsrv extensions compiled for PHP 5.6

I compiled some pdo_sqlsrv and sqlsrv extensions for php 5.6 because who the heck knows when Microsoft will do another official release.
The sqlsrv source code does need a small patch to successfully compile which usually puts a lot of people off when compiling things on their own so I figured I should make them available to the public.

Here’s sqlsrv.dll and pdo_sqlsrv.dll for Windows PHP 5.6 x86 NTS:


SQL Management Studio Jr.

It’s almost inarguable that Microsoft’s IntelliSense is either the top dog, or in the top three at syntax suggestion/completion. What bothers me is that with standard Visual Studio installs (as recent as VS 2013), you don’t get the full SQL Management Studio package. Instead you have to go download SQL Management Studio Jr., with a severely reduced feature set, from Microsoft. Why should you care?

How many developers of relational database-backed applications are there in 2014 that don’t have to think about database performance or troubleshooting ever?
I hope that answer is close to zero.
Even if you’re fortunate enough to have an experienced database administrator, as a developer it would be in everyone’s best interest if you tried to make their job easier and not harder.

As a developer that’s using Microsoft’s database platform, even if you’re not necessarily using Microsoft’s languages (Python, PHP, Ruby, and Node are all supported on Windows Servers), you should be able to do some simple query plan analysis, reporting, and troubleshooting. Yet, the tools required to do these simple tasks are mysteriously left out of the “free” version of Management Studio.

Have a query that’s running long for no apparent reason? Have fun; you’re on your own – unless of course you have access to a Microsoft SQL Server license key and supporting disk image.
In order to have access to the latest SQL Server Profiler, Integration Tools, and Database Engine Tuning Advisor, you’ll either need a better MSDN account (the MSDN account included with Visual Studio didn’t include SQL Server for me) or a full-on SQL Server license.


Luckily, my workplace has an MSDN account for us and I was able to use that. Had I been on my own, I would’ve been shelling out some serious dollars (SQL Server licensing is hilariously expensive) to have very basic tools that should be bundled with Visual Studio by default.

While some might view Visual Studio as the best IDE currently available, I still believe it has a ways to go in terms of developer friendly enhancements and decoupling from Microsoft as an avenue for revenue and instead using it as an incentive (reduced cost, free, etc.) to bring more developers to their platform. The full version of SQL Server Management Studio is a developer tool and should be included with every Visual Studio install.

Best new iOS game – Monument Valley

I normally don’t link to apps and games unless they’re relevant to an article, but Monument Valley is truly quite great and deserves it.

Monument Valley really is the perfect mobile game for me. I cannot recommend it highly enough for those that like fun puzzle games that are perfectly designed and suited for the mobile platform. It’s simple enough to play through a level or two in the time I have available, yet that sense of adventure is there so I never quite get bored and end up wishing I had more time to spend with it by the time I have to put my phone down.

To elaborate on “perfect mobile game,” I’m simply stating that many games are not designed to be played in short bursts of available free time that one might have while waiting for a cashier in the grocery store or for someone to arrive at a restaurant. Monument Valley is my new favorite game to fill these small voids in my life, so twitter will have to take the back seat once more.

Delivery, From The Internet

There are a lot of things that I dreamt up as a child:

I really liked drawing fantastical cars with my fancy colored pencils my mom would buy me.
I liked imagining what computers would be like.
All games would be virtual reality  and amazing (I was roughly five years old).

Once the internet came around and we had CompuServe (we had others but CompuServe made it more “real” to me as a child), I was certain that “everything” would be on and done through the internet. I was young and didn’t quite have a concept of the logistics involved in ordering a house on the internet and having it delivered – but I was certain these sort of things would take place soon.

When computer shopping around the year 2000, we ended up going with a Gateway, and when it was delivered (after ordering online) it felt like my imaginative dreams were finally coming true. It was amazing to me that a 50+ pound package could be delivered for for such a low price (I think delivery was $50-$99?). My mom and I were both very relieved to have not had to deal with the pressuring sales people at CompUSA, Best Buy, or Computer Builders Warehouse and we were further astounded that our custom computer was delivered within a month.

This week we’re getting our new bed delivered and it’s coming from somewhere near Topeka, Kansas…from “the internet”.

It’s an entire bed, and it weighs at least 100 lbs; delivery was free.
While a bed isn’t quite a house, it is just an odd moment that has triggered me to reflect on the progression of my own technology usage in my lifetime.