Catharsis and Humanity

This is a rare non-tech-related blog post, and I hope you'll forgive me for it. It's also possible you may find it controversial, so I'd ask your patience in reading the entire thing before jumping to conclusions. There will likely be another non-tech post soon, since the Canadian Federal Election is wrapping up, but I needed to get this post out before then.

As everyone who isn't living under a rock knows, on Monday, President Obama announced that US Special Forces had located and killed Osama Bin Laden. My girlfriend (who has posted something about this herself) brought up a quotation (attributed to either Mark Twain or Clarence Darrow depending on who you ask) which I think accurately sums up my feelings: "I've never wished a man dead, but I have read some obituaries with great pleasure". There's no question in my mind that Osama Bin Laden was responsible for terrible things, and his death has brought closure to many people. I certainly don't fault the people in Washington DC and New York City for feeling a sudden urge to celebrate out of catharsis. One of the people I follow on Twitter, Stephen Toulouse, tweeted that "catharsis doesn't choose a time to be appropriate" which really makes a lot of sense to me.

Despite all that, I feel? uneasy (for a significant lack of a better term)? about the way we are celebrating the death of another human being, as evil as he was (whatever "evil" truly is). I know that on September 11, 2001, there were people cheering in the streets for the death of human beings too, and I think it's important to remember that as we go through this catharsis. Please do NOT get me wrong, I can fully understand the need to celebrate, it is human to have such a strong outpouring of relief and emotion when closure is found. For the people around the world who were directly affected by the events of 9/11, this will most definitely be an almost happy occasion, and I would not fault them for feeling that way. As I noted earlier, I myself am certainly not upset that Bin Laden is dead or even that people are celebrating that fact.

I think it is entirely natural to feel relieved and to want to express that relief, but now that the catharsis is over, we should rise above our enemies and remember that we respect all life, even those who feel so oppressed as to need to strike out violently. What Osama Bin Laden and al-Qaeda did 10 years ago was WRONG, full stop. However my moral code also tells me that any time a human being is killed by another, it is because of a failure in our society. I am still struggling to figure out what that means, since I too feel a lot of relief over the closing of this chapter in our history, but I think what's most important is that we recognize this event for what it truly is: A purge of our emotions and frustrations which have been building up since 9/11, not a victory for humanity as a whole. There's nothing wrong with celebrating the former, as long as you keep the latter in mind and reflect on what we need to do in order to achieve true peace.

Please don't hesitate to post legitimate responses and discussions to this post below. I welcome disagreements. However, I will not hesitate to remove hurtful or hateful comments. Above all else, RESPECT each other, because that is how we rise above.

P.S. Apparently "catharsis" is my word of the day Winking smile

Posted on 02 May 2011

Meme Helper for ASP.Net WebPages

We're working hard on the next versions of ASP.Net WebPages, MVC and Razor, but in the mean time, we wanted to preview some of the work we're doing for the next version. So, I'm releasing one of the new helpers we're working on as an early preview via NuGet.

Have you ever felt that your site was missing an important aspect of web culture? Like an image of a cat, or an embedded 1980s music video? That's what we're hoping to solve with this new helper for ASP.Net WebPages.

The Meme Helper is a simple helper which allows you to easily inject pure unfiltered AWESOME into your site with a single line of code. For example, let's say you want to embed a certain newly released music video that's garnered a lot of interest recently. You could go find the video and add a bunch of HTML embed code from your favorite video sharing site. Or you could use HTML5. Or even better, you could use the MemeHelpers and do it in one line:

@Friday.Embed(type: Friday.FridayType.Normal)

Or maybe you want to reference a certain weather phenomenon which occurs not once, but TWICE in the sky at the same time:

@Rainbow.Embed(type: Rainbow.RainbowType.Double)

Or perhaps you've tired of this whole Meme phenomenon and want to express your exhaustion:

@Facepalm.GetHtml(type: Facepalm.FacepalmType.Picard, height: 200)

If there's a meme, there's probably a helper for it. And if not, you can contribute your own by forking the BitBucket repository!

You can get the MemeHelpers using NuGet (PackageId: FourOne.Memes). Plus, I've attached a Sample Website to this post. Install the package and explore the Memes!!

Oh and remember: Yesterday was Thursday! Thursday! Today it is Friday! Friday! Fun! Fun! Fun! Fun!

DISCLAIMER: This is not actually related to Microsoft in any way. Microsoft does not endorse any of these Memes. This is just the idle rambling of a developer who likes Memes and a certain day in April ;)

Posted on 01 Apr 2011

New Blog Design and Hoster!

I decided I was tired of running my blog off of my own server, so I've moved to a hosted blog platform, and redesigned by blog a little as well Smile. The new blog is, well, right here! It's hosted on SquareSpace which is a high-scale blog hosting platform. You might ask why I'm not using an ASP.Net blog system, well the answer is simple: I'm not in the business of running a blog. I hope you enjoy my blog, but I don't feel a need to invest a lot of time and effort into running a blog myself when I can pay someone else to do it! After some review of the options, this ended up being the best one of those I reviewed. You'll notice there's a new design, which is one of the reasons I chose SquareSpace, they have a bunch of really nice templates but more than that, they provide easy customization tools! With only a little bit of CSS, I converted one of their stock themes into something that suited me a little more. All of my previous post should be here, but there were little content glitches during the transfer process. Everything should be there, but some of the older posts might not look as nice Smile

In the same vein, I ported all of the comments over to Disqus, and all future comments will be handled through that service. Again, all the comments should be there, but don't take it personally if your comment has disappeared! If you encounter any content problems in the blog or comments please let me know!

I've also normalized everything to point at the same domain name: http://vibrantcode.com. All the old links should work, but again, let me know if you encounter one that doesn't.

The new blog also uses jQuery Lightbox and the latest version of SyntaxHighlighter.js to give it a little more pop. I hope you like it!

Posted on 12 Mar 2011

PsGet v0.2 - Now with more awesome! (and fewer version numbers)

I've just pushed a new version of PsGet out and it has a number of cool new features!

No more version numbers in Module names!

Thanks to both a private patched build of NuGet.exe (this is a temporary fix) and a patch to the main version of NuGet (http://nuget.codeplex.com/SourceControl/changeset/changes/81c1815fd452 - this is the more permanent fix), PsGet's Install-PSPackage script no longer adds the version number to the end of the Module name. So you can name your package files "Foo.psd1" instead of "Foo.0.1.0.0.psd1".

No more nested module path

PsGet no longer uses it's own nested module path (the packages folder under the PsGet install path). It now installs modules to the same place PsGet itself was installed. The plan for the future is to make install destination settable via a parameter to Install-PSPackage, but for now this seemed like a better default.

Totally Self-Hosted

This version of PsGet, unlike the previous version, has no bootstrapper module and is actually a PsGet package itself (it's even on the NuGet gallery: http://nuget.org/Packages/Packages/Details/PS-Get-0-2-0-0). The install script (see next section) handles install it though, so there should be no need to download it yourself.

Install Script

PsGet now has a bootstrapper install script. Unfortunately there are still more hoops to jump through than I'd like, but it's easier to use than the first version. If you're upgrading from v0.1, go ahead and delete your PsGetBoot folder, it's the easiest way to upgrade. From v0.2 on, upgrades will be handled through PsGet itself!

Here's how to install PsGet v0.2. First, go to our download site and download Install-PsGet.ps1:

image

Once downloaded, you need to temporarily allow PowerShell to run unsigned remote scripts. Open an Admin PowerShell prompt and type the following command:

Set-ExecutionPolicy Unrestricted

Then, run the Install-PsGet.ps1 script you just downloaded. You may get a security prompt, go ahead and accept it. Feel free to skim the contents of the file before you run it. The script will download some files, but it will clean them up when it's finished.' You will be prompted to choose where to install PsGet. The installer scans your PSModulePath environment variable and finds all the possible entries. Pick one of these entries using a number in the list:

image

The script will download a version of NuGet.exe from my site and then use it to install PS-Get. Since PS-Get includes it's own copy of NuGet.exe, the script will then delete this temporary version when it's finished. 

image

When the script completes, unless you really want to walk on the wild side, make sure you set your execution policy back to the default! If you've never modified it before, that means you should run the following command to get it back to normal: 

Set-ExecutionPolicy Restricted

You've now installed PS-Get 0.2! Now, you still have to add it to your profile, just as before (though it has a slightly different name now):

image

And you're done! Enjoy and please let me know if you have comments!

Posted on 17 Feb 2011

NuGet + PowerShell = (also) Crazy Delicious

First off, I should note that I'm kinda paraphrasing this title from Scott Hanselman's excellent PDC 2010 talk, but I'm sure he's ok with thatSmile. By now, if you've been following the news coming out of the Microsoft Web Platform and Tools team, you've probably heard about our latest open-source project: NuGet. I'll let Scott Guthrie fill you in if you haven't heard about it already. Well, since shipping Web Pages v1/MVC v3, we've been working on general clean-up of both our code and our processes. For me, part of that entailed wiping all my dev machines and re-installing from scratch (there's a certain level of happiness provided by a nice fresh machine Smile). As part of that, I was organizing my little PowerShell utility scripts into Modules. I've also been thinking of organizing them a bit so that they could be released, but I ran in to a problem: There isn't really a great way to distribute PowerShell Modules!

In PowerShell, a Module is really just a script within a special folder. When you "Import" the module, the script is run and the functions/variables/etc. it exports are added to the shell environment. There's much more to it, but I'll leave it to MSDN to explain the rest if you're interested.

Deploying a Module is as simple as dropping a folder in C:\Users\[user name]\Documents\WindowsPowerShell\Modules. But in order to get a Module from the Web, like say the very useful PowerShell Community Extensions package, you have to download a ZIP and extract it to the right place. Earlier this week I had a brainwave: "Isn't this _exactly_ what NuGet is designed to do?"

So, I spent a bit of spare time working on something I call "PsGet", which I'm releasing a very early version of right now. PsGet is a PowerShell Module that uses NuGet to deploy other PowerShell Modules. Right now, you do have to manually install PsGet, but I'm hoping to set up a single bootstrapping script that you can download and run to install it automatically. Let's walk through how it works:

First, download the PsGetBoot module from the BitBucket site I've set up. Here's a direct link to the ZIP file. Then, make sure the ZIP is unblocked in Explorer:

image

Now, open/create your PowerShell Modules folder in Explorer. It needs to go in "C:\Users\[username]\Documents\WindowsPowerShell\Modules". If you have moved your My Documents folder (like I have, to the D: drive in this case), you should update the path accordingly. Open the ZIP file in Explorer and copy the PsGetBoot folder into your Modules folder:

image

Next, you need to ensure you've enabled the execution of unsigned scripts. If you've already done this, skip this step. Start a PowerShell window as Administrator and run the following command: "Set-ExecutionPolicy RemoteSigned". Enter "Y" at the confirmation prompt.

image

Ok, if you skipped the last step, open a PowerShell window. Otherwise, you've already got one open Smile. Now we need to open your profile script and add a line to activate PsGet. The profile script is the script that runs every time you open PowerShell. First, let's make sure all the necessary folders exist by running:

mkdir (Split-Path -Parent $profile)

If you get an error saying the item already exists, don't worry, it just means you didn't need to do this step Smile. Next, open your profile script up in notepad (or your favorite text editor) and make sure to create it if it doesn't already exist:

notepad $profile

Type the following somewhere in the main body of your profile. It can go at the end, the beginning, or the middle, but not within a function:

Import-Module PsGetBoot

Then save the file, shutdown your PowerShell windows and open up a new one (Admin privileges are NOT required this time). The line we added to the PowerShell Profile will load in the PsGet "Bootstrapper" module. This is a module which just imports the "PS-Get" module and starts up PsGet. The purpose of this bootstrapper is to allow PsGet to update itself using PsGet Smile.

Once you've started PowerShell back up, you're all done! You now have two new commands. The first is "Get-PSPackage". I should warn you that this command is extremely simple right now and just lists every NuGet package from the main nuget.org feed, so be prepared for it to take a few minutes when you run it. PsGet automatically works against the main NuGet feed at nuget.org, but it doesn't really make sense to install packages like Entity Framework in to PowerShell. So, as a convention for now, packages on nuget.org which are PowerShell modules should have names which start "PS-". For example, I've already posted a very very simple package called PS-Bitz which is a library of useful functions (and by library, I mean a single function, for now Winking smile). To find all the PowerShell packages, just go to nuget.org and search for "PS-", or just click here. Once you've found a package, just use the "Install-PSPackage" command to install it:

Install-PSPackage PS-Bitz

image

Once the package is installed, you should be able to see it when you get the list of available PowerShell Modules:

image

(I'm not entirely sure why multiple entries show up, please let me know if you know why Smile).

Now that it's installed, you can add it to your CURRENT shell by running Import-Module:

Import-Module PS-Bitz.0.1.0.0

You can then use all the functions provided by it. In this package, there's a single function used to get the path of special folders like MyDocuments:

image

If you want to make it available every time you launch PowerShell, just add an "Import-Module" line for it to your Profile, just as we did with PsGetBoot.

As you can probably see, PsGet is pretty rough around the edges right now, but I'm hoping to improve it over time. I've set up a BitBucket repository here, so feel free to fork it and hack away. I'm licensing it under the Apache Public License, which matches NuGet's license. Let me know what you think! And start posting PowerShell module packages to NuGet.org!

Posted on 11 Feb 2011