Blog fail

Well, I just cannot seem to keep the whole blog thing going. I guess I’ll try to check in once a year or so just so it doesn’t look too stale around here.

Last year(ish) in a nutshell:

  1. Axed from Disney contract
  2. New contract position with McGraw Hill
  3. Hired on at Disney FTE (FTW!)

All of that pales in comparison to my true job: Daddy.

Haven, you are the best thing I have ever done. Daddy loves you!
😍😘

Ch-ch-ch-ch-changes! v2.0

Well, almost a year to the day. Pretty bad…

BUT, at least I have a decent excuse. My wife and I had a beautiful baby girl, Haven, on Christmas Day. Shortly after I got the new job we found out about the pregnancy, and then it was doctor visits galore. For the past 5 months now it has been “Daddy time”, so, yeah.

A funny thing about this post and the last – they both have to do with changes. While there are the obvious ones (fatherhood), I mean career changes. You see, I have been on my contract this past year with Walt Disney Parks and Resorts Digital (WDPRD) and I have been kicking some ass (if I may say so myself). I have been working hard to gain FTE there, and it has always been a bit like a carrot on a stick – just out of reach. Well, now I am coming up on my final day tomorrow.

A couple weeks back the axe fell and all contractors were cut. We lost some really good guys in Argentina, and now those of us in Seattle are gone too. Like the last time this happened, I have some options, so I am not too worried, but the whole “Daddy” thing is my priority, and I have been lucky enough to WFH 4 days a week, so I need to look for something matching that. Good luck to me…

As far as code goes, I don’t have a bunch new. The most recent stuff I did was just some JS sandbox stuff to play around. Here are some links:

JS “Hydra” – an interview test:
https://jsbin.com/wujaxob

Apple basket – add and eat apples from your “basket”:
https://jsbin.com/piruqa

Simple inheritance demo:
https://jsbin.com/vagoyu

Another simple inheritance demo:
https://jsbin.com/rubunu

Sandbox play-around:
https://jsbin.com/yejari

I have a couple of code tests from a recent interview that I will hopefully share soon. Or maybe next year. 🙂

Ch-ch-ch-ch-changes!

I have neglected my blog for some time, and it is time I gave it a little love.

I recently went through a major career change. I received news that my employer of over 10 years was going through some financial hardship and that my hours were no longer guaranteed. I have been telecommuting for the past 5 years, so the news came as quite a shock. I knew I wasn’t going to be able to continue to telecommute, and the best I could hope for was a couple of days a week working from home.

Luckily I have been a developer for some time. I get a lot of recruiter emails, so I started replying and reaching out to previous recruiters I had spoken to. It did not take long for phone interviews to roll in, and then face-to-face interviews. I have always put way too much pressure on myself in interviews, and I was dreading going in to “code in ten minutes” or whiteboard or whatever.

The funniest part of this whole process is most of the employers I interviewed with were not actually on the MS stack – which has been my focus for most of my career as a developer. Most were on some sort of PHP codebase server side (eww…) but the majority of focus was on client-side. I am thankful for taking the leap into js frameworks!

So, I now have a new job in Seattle. I have to commute about 1.5 hrs each way, but it could be worse. I drive maybe 1.5 miles to the marina, park, hop on the foot ferry, then transfer onto the “big” ferry in to Seattle. Here are some pics from the ferry:

IMG_20150527_055839

IMG_20150529_060339

IMG_20150529_164745

If you gotta commute, commute in style

Anyway, to give some examples of some client-side code, I added some new gists and repos. Check them out if you like.

scroblr

I used to listen to my Last.fm station a lot, but lately I have been stream my local radio station (107.7 The End, Seattle). I like the variety and even some of the DJ banter while I work. I work from home and it makes it seem a little less like I am sitting at home in my office by myself.

The one downside was no scrobbling. I had another Chrome plugin but it did not work with Abacast (the platform 107.7 uses to stream their broadcast). I looked into making the plugin work with Abacast, but to be honest the docs were kinda poor and the API was a little “scattered”. I looked at more open-source plugins and found scroblr. It isn’t anything fancy, but the API made it a snap to create a new plugin for Abacast. I forked the code, whipped up a plugin, tested and submitted a pull request in under an hour. Now I am happily scrobbling from the 107.7 stream.

Azure table to json with jQuery

I have been working with Azure quite a bit lately. We are looking to move all our hosted servers “into the cloud” – wherever that may be… Anyway, I have been working on a simple asset management system and I just started to implement the Azure Search API. I wanted to seed the index with existing data about the assets but I couldn’t see any easy way to export a list of the files in the container. Google to the rescue!

My search found a great post by Dave Ward on extracting data from an HTML table using jQuery. It is a pretty simple little snippet but it works quite well:

var data = $('#__fx-grid3 tbody tr').map(function() {
  // $(this) is used more than once; cache it for performance.
  var $row = $(this);

  return {
    name: $row.find('td:nth-child(1)').text(),
    url: $row.find('td:nth-child(2) .fxs-copybutton-value').text(),
    creationTime: $row.find('td:nth-child(3)').text(),
    size: $row.find('td:nth-child(4)').text(),
  };
}).get();

Use the snippet in the container details page and it will pull the name, url, etc. from the table. Now you’ve got the table data stored nicely in a local variable named data – but how to easily get at it? A little more googling found another simple little trick:

copy(data);

This will copy the data variable value to the clipboard. Now it is a simple paste into whatever text editor you favor. The above may be Chrome-specific, but if you are a web dev then you are likely using Chrome anyway – or at least have it at your disposal…

Insert? Update? Nope, it’s MERGE!

I needed to track changes when updating a table, but I wasn’t really sure what would be the most perf-friendly method. Luckily I stumbled on a great post about T-SQL MERGE. The post described almost to a “T” what I needed to do: some records would stay the same, some would drop off, and others would change.

MERGE is pretty slick. I was able to easily take the 3 queries I had in place for insert, update and delete (well, soft delete anyway) and basically cut/paste them right into the merge command. It is nice that the syntax matches up so well and makes sense (unlike things like ROW_NUMBER() – yuck). It was really a nice, concise way to get exactly what I needed, and it performs very well.

Better Cassette Bundling

We use Cassette v1 for our company site mainly because that’s what there was for bundling back in those days. Since then v2 has been released and MS has bundling and minification baked in to MVC now. But, as a wise man once said:

“If it ain’t broke, don’t fix it!

Mostly I follow that logic when I am being lazy – and since the whole bundling thing is gonna boil down to a different syntax to do the same thing, I figured why bother. Heck, I did not even want to bother going to v2!

I just decided to add the slick Select2 list to an admin page, and it made me push on an edge of Cassette that I had not run into before: how to easily exclude a folder. In short, there is no built-in easy way. However, I found a great post about using Cassette for semi-complicated scenarios. There is an excellent snippet of code in there that extends the FileSearch class and makes excluding folders as easy as this:

bundles.Add<StylesheetBundle>("Administration/Content",
    new ExcludeDirectorySearch("*.css", new [] { "ckeditor", "ckfinder" }));

SVN woes

I recently found out that our repository holding the code of multiple projects for the past 8+ years wasn’t being backed up properly. What’s worse, the reason it isn’t being backed up properly isn’t because we have no backup in place, no, it is because the repo is corrupt. HOORAY!

This revelation has led me on a long, strange trip, and I have tried many things so far in an attempt to save some of our history (though it is not looking good). One of the interesting things I read was an idea to use svnsync:

Another approach I forgot to recommend before is to setup a user in the original repository that has read permission only to your branch, and then use that user to create a mirror of the repository using svnsync. svnsync will honor the permissions in your access file, and will simply omit the stuff that user can’t read, leaving you with a repository that has a bunch of empty revisions but contains all the changes made to your branch only.

I found a great post on using svnsync and had a go. While this is a pretty slick trick, it unfortunately did not work. You, long ago when the repo was corrupted, I was tasked with “fixing” the repo. My “fix” allowed us to keep on using the repo, but it effectively made the repo worthless since my “fix” was to remove the corrupt db rev file – not a good idea…

Anyway, now we are stuck with a repo that is full of work and no way to export it easily with history. Luckily 3 years in code is like dog years, so much of the code from before the corruption occurred is not really used. My latest trick to attempt is dumping a range after the corruption, then use svndumpfilter to try and save history for relevant projects. This post gives a nice outline of the steps involved to perform a task like this.

Unforunately, some stuff is just going to have to get added to the new repo and we are going to lose history, but we can keep the current repo running in a read-only state for that. In the end, it turns out this is all for the better – we made the mistake of putting binaries into the repo, and it is out of control at over 14GB. Time to prune that sucker…