Dev Diary: Installing ASP.NET vNext with Sublime Text integration

Everyone else on the Internet seems to have posted an article with this title back in August. Well, colour me late to the boat.1

First Steps

  • Using the instructions found here
    • Installed Mono and KVM via Homebrew as per aspnet GitHub
    • Installed Package Control in Sublime Text
    • Installed Kulture via Package Control
    • Installed node/npm via Homebrew
    • Installed yo and generators-aspnet via node
    • Slammed into this error, left a comment asking how to get the fix since, at the time of this writing, nothing’s been committed to the yo repo.
      • Fixed in the RX.js repo a day later, so that’s all good
    • Following the rest of the directions on the Kulture and ASP.NET GitHub pages got me to a point where I can scaffold, build and run a new project with Intellisense!

And Then

  • Turned on error reporting via this SO answer which references one of the vNext sample projects, worth a closer look.
  • Need to learn more of the Razor view conventions: it’s weird that you declare a model’s type with @model but then you apparently must refer to it as Model with a capital M…
  • Used display templates as described here to define an output fragment for a custom type… very cool. I could put a working project together pretty easily with ASP.NET MVC, I think…

TODOs

  • I had to kill kestrel, rebuild the project and restart kestrel to see changes. I seem to recall reading something (maybe in the MSDN blogs about ASP.NET vNext?) about getting livereload-like behaviour…
    • Indeed, there’s a command-line switch, but a bug in mono prevents it from working on non-Windows hosts
  • Explore inline errors and refactorings in OmniSharp
  • Build a simple MVC view with a hard-coded repository layer

Other Links


  1. Protip: Never mix eggnog with metaphors 

Now Would Be a Good Time to Update Git

The latest version of Git, 2.2.1, patches what sounds like a pretty severe vulnerability. If you’re using a GUI Git client like GitHub’s or SourceTree, hopefully they’ll have updates you can install soon (at the time of this writing, SourceTree does not). While I do use SourceTree, I most often use git from the command line, so I wanted to update that client as well.

I’m running OS X 10.10, and when I check my git version in Terminal:

git --version
git version 1.9.3 (Apple Git-50)

I most likely installed that version via Xcode’s build tools. I decided to leave it alone and, since I’ve become a Homebrew fan, grab the latest git with that, instead.

brew install git

Now the first funny thing: which git returned /usr/local/bin/git, as expected (that’s where Homebrew installs packages, which is controversial to some. The Xcode version was at /usr/bin/git), but git --version was still returning the old Apple version. On a hunch, I closed my Terminal session and opened a new one: now git --version returned git 2.1.3. Doing a little searching, you can also check for this caching behaviour and correct it like so.

Now, there’s a further issue: 2.1.3 is not the new version of git I wanted to install! This suggests my Homebrew recipes were out of date. I did this:

brew update

And got permission errors. So, as usual, the hammer:

sudo brew update

Now that spewed a list of Homebrew’s script files, claiming I had made changes to them that would be overwritten by merging the latest version of the recipes. That was odd—I had no recollection of ever editing Homebrew’s files myself. brew doctor suggested I stash and clear the changes, so I did that…

cd /usr/local/Library && git stash && git clear -d -f
brew update

…Oh, right, there’s that permission error again.

sudo brew update

…! I got the same error regarding merging files! But I definitely hadn’t changed anything this ti-

Then it dawned on me: the failing brew update must have changed those files, leaving Homebrew in a half-updated state. I cleared the changes again, and did sudo brew update this time, and boom. Now, running brew upgrade git installed version 2.2.1, as intended.

Hope that helps if you ever trip over this particular crack in the sidewalk. At least it’ll help the next time I do.

All his life has he looked away… to the future, to the horizon. Never his mind on where he was. Hmm? What he was doing.

It’s a real problem.

If you’ve started some work in a local git repo and realize you want it on a separate branch from your current, do this on the command line:

git checkout -b <branch name>

Which will create and check out the new branch. Then, commit your changes. When you’re ready to push:

git push -u <remote name, usually "origin"> <local branch name>:<remote branch name>

If you just specify the local branch name, git will create the remote branch using the same name. Note the -u flag, which sets the local branch to track the remote, letting an unqualified git pull behave sensibly.

Choose Your Weapon

I spend all day writing software on the Microsoft desktop stack, and my toolbox is small: Visual Studio, Resharper, C#/VB, and the .Net Framework. With those I can build pretty much anything. I’ve been playing at web dev on the side, and the best and worst—the bworst1—thing about it is how many things there are to learn. Leave aside the fact that writing a modern website or web app involves at least one programming language, a markup language, and whatever the hell you classify CSS as: I’m talking about the tools. There are so many, and it’s not at all clear at a glance which will suit you and your project best, and so staying productive is a challenge. What if you choose a tool and pour time into learning and using it only to discover it’s ill-suited to your task, or is abandoned by the larger community in a year in favour of another very similar tool?

I haven’t found a good approach to this, a good balance of research and testing versus flipping a coin and getting to work. Discussing the problem with a colleague the other day, though, I did manage to discover the Best Game Ever:

Start typing nouns followed by “js” into Google and see how many in a row turn up a development tool or library.

After amusing ourselves with this for a while we concluded that, as frustrating a problem as this is, we should count ourselves fortunate that it’s our job to play with computers; we could be laying bricks all day.

But that got me thinking, and I found:

Seriously. What is this madness?2


  1. Copyright, me. 
  2. Madness?! THIS IS SPARTAAAAAAA.js!!! 

www. is not deprecated

Tricky: I vastly prefer the look of the “naked domain” to, for example, www.danj.ca. But maybe caring what your URL looks like is ridiculous in this day and age.

Anyrate, I’ve been a proponent of using the naked domain but making sure you redirect www for a while. It’s interesting to know there are actual, technical reasons to prefer the subdomain.

You should use www because today you have a small web site, and tomorrow you want a big web site. Really big.

The technical reasons to use www primarily apply to the largest web sites which receive millions (or more) of page views per day, web sites with a large number of services across several subdomains, and virtually any web site hosted in “the cloud” by an application service provider.

But I’m not switching yet.

(via Zack Tollman's retweet)

Fighting to Stay Creative

Great post by Shawn Blanc:

These are things that will whisper in our ear that our idea is pathetic and our implementation of it even worse. They urge us to give up, to move on, to quit, and to pacify our minds. They tell us that we have nothing unique to offer, that we have no value, and that everything will come crashing down any minute, so why even bother.

And,

You have to trust your skills, trust your gut, and trust your value as a contributor. You’re not an impostor. And the more you learn and the more experience you gain, the more your skills will grow. But if you wait until you’ve “arrived” to begin your journey, it’s a logical impossibility that you will ever actually arrive. You have to step out the front door and start walking.

I could stand to spend less time, I’m sure, reading things on the internet. But I won’t feel too bad about reading something like this, something that makes me want to rush home and make things.

Exponent Postcast 002: The Missing Episode

Ben Thompson became one of my internet heroes pretty much as soon as I found him (linked from Daring Fireball, probably, I can’t even remember now). I was sad when he vanished from the Cubed podcast, and pleased when he started his own as part of a push to turn his website into more of a career. He’s now switched it up again, but who cares: Ben is brilliant, and in this episode he and co-host James Allworth eloquently describe where Silicon Valley’s often-frustrating attitude comes from, and what that means for the future.

They focus more on what effect privilege has on the problems tech aims to solve, rather than on the plight of the many groups it fails to serve—women, people of colour, etc.—but their insight is nonetheless valuable in deconstructing the Problem With Tech. Have a listen.