Google Music Canceled, Panic and Resolution

I love Google Music. I’ve been using it since the day (or the month) it came out and I will most likely be using it until it goes away (or I die, one of the two). I’ve built up a large number of playlists and a library. I have go to playlists for when I’m down or when I need to get into that “Work” mode. I have never canceled the service and I still get the promotional price.

And then Google Music was canceled

Imagine my surprised panic this morning when I found the following in my inbox:

Google Music Subscription has been canceled.
WHAT?!!!! NOOOOOOOOOOoooooooo!!!!

Egagh! Wha? Panic panic panic panic… what? Why has this happened to me?! WHY?!!!!

If they canceled my order, did they kill my promotional price?

Still panicking I went and searched through my emails from the last several days. I found the following email regarding my payment method not working (those credit cards, always expiring).

Google Music Order is on Hold Email
My order is on hold and will be canceled. Thank goodness for this Fix button.

They gave me a whole day to update my payment method. Why hadn’t I done it? Oh, yeah, the day that they gave me was Thanksgiving. Thanksgiving is quite possibly one of the busiest days of the year (besides Christmas).

Excellent! The email that Google sent me includes a “Fix or Retry now” button. This should be able to “Fix” the issue! Unfortunately, no. There was no information on the resulting page that indicated or alluded to how to fix the issue.

So I did what any other normal extremely panicked person would do. I started up a support chat with Googles Customer Service.

The Customer Service Representative was very nice. They told me that I should be able to “Resubscribe” to Google Music and that I should be able to maintain my promotional price.

So that’s what I did. I visited There was a friendly banner right at the top asking me if I wanted to resubscribe. So I resubscribed and everything is great – panic subsided.

That said I do have a couple of suggestions based on this experience.

  1. If you are going to provide a “Fix” button… then at the very least it should point the user to how to fix the problem. A simple “Order Canceled by mistake?” would’ve done wonders in my situation.
  2. Maybe give the user more than a day to fix the issue? Especially if the day you give them just happens to be a national holiday.

MailTo Links Not Working Correctly


Once upon a time there was a person named Jeremy. He used Google Chrome as a browser. He was very happy. One day Jeremy clicked on a mailto: link. Some program (Google Chrome or Windows) helpfully asked how it could handle that action. Jeremy, who hates modal windows and was not paying attention, hastily clicked on the first thing that looked like it would close the modal. He soon found that his hasty actions lead to a larger problem. Now, mailto: links did not do anything when clicked on within Google Chrome.

Present Day

(Spoiler: Jeremy is me.)
Today I got fed up with mailto: links not working as they should in Google Chrome. So I went looking for a solution. I found several different potential solutions. My goal was to get mailto: links to open in Mozilla Thunderbird.

  1. Remove the mailto: handler from chrome://settings/handlers.

    I tried this, unfortunately there were no handlers listed under: chrome://settings/handlers.

  2. Register a new setting with registerProtocolHandler

    I stumbled upon this Paul Irish post. However, it seemed hacky to use a handler to open Thunderbird.

  3. Finally

    I decided to take a look at my Windows settings. I’m using Windows 10 so I brought up the Start Menu and searched for “Default Programs”. I found Control Panel\Programs\Default Programs. From there I saw an option to “Associate a file type or protocol with a specific program”. This led me to Control Panel\Programs\Default Programs\Set Associations which displays a LONG list of associations, and unfortunately no intuitive way to search through them. So I scrolled and scrolled and eventually found an option named “MAILTO”.

Mail To Default Association
The Current Default is now Thunderbird

Lo and behold the Current Default for this option was set to “Google Chrome”. That looked suspicious. So… I changed the Current Default to “Thunderbird”. Saved the setting, restarted Google Chrome, and BOOM, mailto: links started working correctly.

Meld rocks for Merging Code Conflicts

I’ve tried a number of different merge/differencing tools in the past. BeyondCompare, TortoiseMerge, WinMerge, etc…

I’ve never found one that’s as easy to use and as understandable as Meld is. Do yourself a favor and head over to and grab yourself a copy. It’s great.

When you’ve got it go ahead and throw this in your git config. (Psst, the command for that is: git config --global --edit)

tool = meld
[mergetool "meld"]
cmd = 'C:/Program Files (x86)/Meld/meld.exe' $REMOTE $MERGED $LOCAL

You’ll probs want to update the path to your Meld exe.


Luke Skywalker, Jedi Knight

In response to:

Not sure I can get on board with the description in that article. It’s interesting, and it could be possible, but the optimistic/skeptic inside of me doubts it.

First we’ve got the Emperors words.

Take your weapon. Strike me down with all of your hatred and your journey towards the dark side will be complete

So let’s distill that into an if statement

var lukesSide = light;
if(takesWeapon && strikesEmperorDownWithHatred){
    lukesSide = darkSide;
    // Lukes side is ?

So… we know that Luke didn’t both take the weapon AND kill the Emperor so we have to jump into the else block. Assuming that Luke’s side did not change, and he started out Light, then he would still be light.

Then the next thing: the false assumption that hate makes you powerful. This claim is not substantiated. Luke asks Yoda about this straight up in the Empire Strikes Back.


Luke: (…) Is the dark side stronger?
Yoda: No, no, no. Quicker, easier, more seductive.
Luke: But how am I to know the good side from the bad?
Yoda: You will know… when you are calm, at peace, passive. A Jedi uses the Force for knowledge and defense, NEVER for attack.

The author tries to make the claim (as does the Emperor) that hatred leads to power and that Luke feels it coarsing through him. However, we know, as did Luke, that the dark side is not stronger.

I’d like to think that Luke is having an internal struggle between both sides. It is at this crucial point that he remembers his conversation with Yoda back on Dagobah. When it comes down to it, how will he know the good side from the bad side? The answer, as you read above, is that you will know when you are calm, at peace, and passive.

The author of this article carefully leaves out the bit just after Luke stares at his hand and supposedly claims power. Let me fill it in. Luke calmly collects himself, turns off his Lightsaber, throws it away, and then addresses the Emperor.

So… the very last actions that Luke takes are ones that a “good” Jedi would take, given our definition of what makes a “good” Jedi.

Here, Luke clearly chooses to be calm, peaceful, and passive – the Emperors plans to turn him have failed. Obviously, the Emperor would then be a bit miffed, but to say that he now viewed Luke as a rival is taking it a bit too far. If Luke had truly turned, do you honestly think he would’ve turned off his lightsaber? No… he would’ve used the force to attack the Emperor and strike him down.

Remember: Luke does not strike the Emperor down, so his journey to the darkside is not complete. Here, in the moment where he could’ve claimed evil victory he chooses not to.

In the moment of his greatest temptation Luke chose Light side qualities. Thus, I can say with confidence, that Luke Skywalker is a Jedi Knight.

Password Protect a WordPress Subdirectory with .htaccess

There are questions all over the internet regarding how to password protect a sub-directory when you are using WordPress.

I just spent a long time fighting a frustrating battle with this as well. So I’m documenting the resolution here for my (and anyone’s) benefit.

 In short

  1. WordPress does not mess with requests to actual directories or files.
  2. If WordPress is messing with your request then you aren’t requesting an actual directory or file.
  3. It’s likely your Error codes aren’t setup to return actual files.
  4. Make sure your .htaccess file isn’t generating 500 errors (i.e. ensure the path to your .htpasswd file is correct).


I’ve added a .htaccess and .htpasswd file but all I see is a WordPress 404 page. I can’t stop crying because it’s not working and my brain hurts.

Yep. That happens. WordPress comes with the following .htaccess file by default:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
# END WordPress

Let’s break this down.  First we are checking if the mod_rewrite module is even installed. If it is then we are turning the RewriteEngine on. That’s all great. We wouldn’t want to use the engine if it didn’t exist… right?

RewriteBase / – This sets the base of every subsequent Rule and Condition to the root `/`.  This way we don’t have to include the root directory at the beginning of any of our rules.

RewriteRule ^index\.php$ - [L] – This rewrite rule checks to see if we are on the index.php page already. The dash in the rule means do nothing. So… if we are already on index.php don’t do anything. The [L] option means that we should stop processing rules now. Don’t do anything else, we’ve got what we wanted. Quite literally this is the [L]ast rule that should be processed.

RewriteCond %{REQUEST_FILENAME} !-f – This condition makes sure that if the current request is hitting an actual existing file then we should do nothing. So WordPress won’t mess with your requests if you try to link to an actual file.

RewriteCond %{REQUEST_FILENAME} !-d – This condition makes sure that if the current request is hitting an actual existing directory that we should do nothing. So WordPress won’t mess with your requests if you try to link to an actual directory.

RewriteRule . /index.php [L] – Finally, if our request passed the above two conditions (it’s not an actual file and not an actual directory) then map the request to index.php. Now the request is mapped and WordPress can do its thing!

That’s Great But…

I know what you are thinking. You are thinking:

If what you are saying is true, then I shouldn’t be seeing a 404 page. My password protected directory actually exists!

Yes. You are correct, your directory does exist.


When you password protect a directory with .htaccess you are telling the server to return a certain response code. The 401 response code meaning the user is unauthorized, to be precise. When the browser received this response code it triggers a username and password prompt. However, and here is the problem, the browser is never receiving the response code.

Why is the browser not receiving the response code?

Good question. If you remember the WordPress .htaccess checks if the requested url points an actual file or directory. It only rewrites you to the index.php file if you aren’t actually requesting a file or directory. When you throw the 401 response code you aren’t actually requesting a file or directory. You are essentially requesting nothing (because you are unauthorized). So the WordPress .htaccess file is behaving correctly – it’s rewriting you to the index.php page and giving you a 404 (because more than likely your password protected directory does not match a permalink on your WordPress blog).

So… if WordPress is making sure that you actually requested a file then… you need to make sure that you are actually getting a file! You can do this by adding the following line to the top of your WordPress .htaccess file:

ErrorDocument 401 default

What you are doing is telling the server to return the default 401 file when it encounters a 401 response code. Once you are returning an actual file WordPress won’t try to grab your request.

Ok. I added that and I’m still having issues. What gives?

If you are like me, then the 401 response code fix wasn’t enough. You are still having the same issue and by now you are wanting to… oh gosh I can’t even think of anything to describe this type of pain.

Let’s look at our .htaccess file we are using to password protect our sub-directory. If you are anything like me your file might’ve looked something like this.

AuthType Basic
AuthName "Password Protected Area"
AuthUserFile /public_html/
Require valid-user

This looks perfectly valid to me. However, it turns out this file is generating Internal Server Errors!  (I know because I added a ErrorDocument 500 default line to my WordPress .htaccess file just for kicks.) But this shouldn’t be generating a 500 error unless I’m doing something wrong.

Turns out. I was.

The AuthUserFile argument needs to be the full server path to your .htpasswd file. Turns out, /public_html wasn’t actually the beginning of my server path. As a result the server was throwing a 500 error. Once I figured out what my entire full server path was, and added that to my .htaccess file, everything started working.

To Recap

  1. WordPress does not mess with requests to actual directories or files.
  2. If WordPress is messing with your request then you aren’t requesting an actual directory or file.
  3. It’s likely your Error codes aren’t setup to return actual files.
  4. Make sure your .htaccess file isn’t generating 500 errors (i.e. ensure the path to your .htpasswd file is correct).

Whew! Thank goodness that’s over. Happy Blogging :)

JavaScript Scoping. Callbacks and Loops

I just ran into this issue last night. The problem: I had a loop that was adding a callback to a method. Something like this:

for(var i=0;i<10;i++){
    $myElement.on('some-event', function(){

What I expected was that the value of the i variable at the time it was called would be used in my callback method. However, this was not the case… the i variable was the same in every single callback.

See this JSFiddle for an example.

The reason for this? JavaScript variable hoisting.  Before your code is executed it is scanned and the variables are processed. This has the effect of moving your variables to the top of the current function regardless of where in the function they are defined. (Except for in cases where you are implicitly declaring global variables).

So, in our situation we’ve defined var i. This is processed before the loop is processed and it is as if we wrote this:

var i;
    $myElement.on('some-event', function(){

Now it becomes a bit more clear why we are running into the issue with i being the same. The reason is because by the time the callback is executed the for loop has already run and the value of the i variable is already 10.

The solution, as far as I can tell, is to use an IIFE to scope the variable correctly in order store the current value for later. It looks ugly and it feels hacky… but it seems to be what is necessary. Update: It appears that you can also use .bind to set the value correctly as well.

var i;
            return function(){

And the JSFiddle to demonstrate.

Example With .bind

var i;
    $myElement.on('some-event', DoSomethingWith.bind(undefined, i));

Building StackOverflow Reputation – One Answer a Day

So. I’m a little low in the reputation department of StackOverflow. I mean, my reputation is ok, but it’s not AWESOME. And I need my rep to be awesome because well it’s all in the name. So, I’ve come to the conclusion that I’m going to answer one StackOverflow question every day  (weekday that is… on the weekends I’ll probably be sleeping or eating pizza or sleeping. So stop expecting so much. Stop it.) How long am I going to do this? I have no idea. I plan on making this into a habitual thing.

So here is my StackOverflow reputation as of right now:
jeremysawesome StackOverflow RepRight here I’ve inserted the flair badge which should be kept up to date with my current rep points.

profile for jeremysawesome at Stack Overflow, Q&A for professional and enthusiast programmers

So we will see how the “answer a day” thing goes.

However, I’m going to try and make my answers as helpful as possible. I don’t want to just “give” an answer, I want to also explain it. I want to explain the problem and what it was I did to fix it. I want to link to relevant articles if necessary… I want my answers to serve as teaching material for anyone else who might eventually have the same question. Answering questions in this way I believe will benefit me as well as the person asking the question.

Why would answering questions benefit me? I think that it helps me personally to be able to communicate better. If I’m able to explain a problem and how I solved it to someone else, every single day, then it’ll help me level up my communication skills. If I’m able to clearly understand a problem, and how to solve it, it will help me with my debugging skills. If I don’t know how to solve a problem, then I will most likely be doing research into how to solve the problem. This, in turn, will help me to continue learning.

So let it begin, the quest to answer a StackOverflow question everyday is underway.

Accessing Direct Messages from Disabled Users in Slack

Slack is awesome. I love it. You love it. Everyone loves it. If you don’t love it than that is probably because you haven’t heard about it. So.. go hear about it. Yep – now you love it too. You’re welcome.

One of the cool things about Slack is that it archives all of your conversations. So you can refer to (and search through) previous conversations you’ve had. This morning I was going to do just that, look up an old conversation I had with a previous team member. However, I couldn’t find his name anywhere via the normal slack interface. Because I couldn’t find his name I figured that he must’ve been deleted and my conversations were lost forever… :sad_panda:

But – don’t despair! As it turns out, you can’t actually delete a user in Slack. You can, however, disable a user. And the cool thing about disabled users is that you can still access the messages you’ve sent to them.

Accessing the messages is simple. First go to your Team Directory page in Slack. The url for that is something like Now find the greyed out Disabled Accounts section. Click on it. Next to each of the users you will see a […] menu. Open that menu and select Open Message Archives.

Boom sauce. You can now view your archived direct messages from previous members of your team.

SQL Server – Search Tables for a Column

You can use the following SQL to find all tables with a specific column name within your SQLServer database.

WHERE COLUMN_NAME = 'YourColumnName'

Or, use the LIKE() method if you don’t know your specific column name. If I use the LIKE() method I try to only throw the wildcard at the end of the string… it performs a bit better that way.


Figured I’d post this here because I’ll probably forget and want to know again in the future.

Specify Name and Port for Website Project in IISExpress

When using IISExpress to develop a Website project it is nice to have a specific machine name and port to refer to.

You can specify the machine name and port by editing the binding in the IISExpress applicationhost.config file. The following information was gleaned from this answer on StackOverflow.

  1. Open your applicationhost.config file. It most probably will be %userprofile%\Documents\IISExpress\config\applicationhost.config, but inspect the output from iisexpress.exe to be sure.
  2. Locate your WebSite entry and add following binding with your machine name.
         <binding protocol="http" bindingInformation=":50333:your-machine-name" />
  3. Restart IIS Express

I actually specified my machine name as well as the local domain.


This seems to be working just fine for me. If you are wanting to actually share that url for others to access (maybe within your own work network) you might have to run this in a administrator command prompt as specified in this StackOverflow answer:

netsh http add urlacl url=http://vaidesg:8080/ user=everyone