Scott Hanselman

How to enable Google Now for iOS devices (iPhone, iPad) with Google Apps for Business Accounts

April 29, '13 Comments [23] Posted in Musings
Sponsored By

Google Now for iOS

I've got GAFYD (Google Apps for your Domain) running mail for and managing Google logins for the family. (There's 14 of us.)

Google Now (that's the fancy cards and predictive assistant) for iOS was just released (you can download Google Now here) and integrated into the Google Search app for iPhone and iPad.

If you install it and log in with your Google Apps account, you'll get an error that "your administrator hasn't enabled Google Now for your domain."

You'll need to (or your admin will need to) turn it on for your Google Apps Domain. It just takes a moment.

Note that you're changing this setting under Android but it affects iOS as well, which is why it's so unintuitive.

Google Apps for Business, Education, and Government: Google Now needs to be turned on by an administrator before it can be used.

If you are an administrator, you can enable Google Now for users in your organization by following these steps:

  1. Sign in to your Google Apps control panel.
  2. Go to Settings > Mobile > Org Settings > Android settings.
  3. Click the checkbox next to Enable Google Now to turn on Google Now.
  4. Click Save.

Here's a screenshot describing the flow, as it's not obvious.

Click Settings, Mobile, Enable Google Now

It took about 10 minutes for the setting to propagate. You may also need to force-quit the Google app for it to pick up the new setting. Your mileage may vary, but this IS how you enable Google Now, regardless of device.

I hope this saves you time and frustration. Pass it on.

UPDATE: If you've updated to the new console, the location in the new console is:

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb

Review: The Lenovo X1 Carbon Touch is my new laptop

April 27, '13 Comments [108] Posted in Hardware | Reviews
Sponsored By


I have a new primary laptop and it's the Lenovo X1 Carbon Touch. It's an Intel Core i7 3667U running at 2 GHz. I got 8 GB of RAM and a 240 GB SSD. The integrated graphics are the Intel HD Graphics 4000 running a 14 Inch screen. It also has Bluetooth 4.0 (nice!) as well as Intel a/b/g/n WiFi.

The X1 Carbon Touch is super thin


First, it feels pro. It feels like a Lenovo, and I've always been a fan. You either love them or not. I do. Since my first T60p they've never done me wrong, and this one is no different. If you like Lenovo, you'll like this machine. If you're a discriminating business user who wants power and portability, you'll appreciate this Ultrabook.

The Lenovo X1 Carbon Touch Keyboard

The keyboard initially looks weird and a little "chiclet-y" and I assumed it would be uncomfortable to use and very much unlike the Lenovo keyboards of legend. You're likely familiar with the classic look and feel of ThinkPad keyboards. Once you're competent on a ThinkPad keyboard you expect to be good on any of them.

While it's different, with its ever-so-slightly concave "smile" keys, they have the same travel and quality feel of any Lenovo. I have had no trouble getting used to the keyboard. I'd say now after some weeks I prefer this keyboard to the previous version.

Ultrabook Size and Weight

Stacked from thin to not: Lenovo X1 Carbon Touch, MacBook Pro, Lenovo W520

That's the X1 Carbon Touch on the top there, then a 2011 MacBook Pro, and finally a Lenovo W520 on the bottom.

The W520 is 1.5" thick and weighs 5.75 lbs with the 9 cell battery. While the 1080p screen was nice, carrying this beast all over the world DID tire me out. Add a few more pounds for an AC adapter that weight a pound itself, your phone and accessories, and you had a 10lb backpack pretty quickly.

The MacBook Pro weighs 5.6 lbs with a native 1400x900 screen. I tried using this as my primary for a few months and while the hardware build quality is top-notch, I found myself pawing at the screen unconsciously. More on this later, but once you really add touch as a complementary input option, you'd be surprised how often your brain assumes every machine has touch.

The X1 Carbon is super thin (slightly less than 3/4 of an inch), and light enough (just 3.4 lbs) to hold comfortably with one hand and faster than the W520. Sold. The major trade-off was 1600x900 resolution (rather than a full 1080p) and the lack of a third USB port, but its light weight is a daily joy. It's not quite half, but FEELS half as light as the W520 and MacBook Pro. It's only a 13.5" screen, but I have quickly adapted to it. Plus, I can run a large monitor (or they say, 3 with the USB Dock when it shows up) without trouble.

Out and About

Seriously, all laptops should be this thin and light. There's just no reason anymore for a 6 to 10 lb laptop and I said as much in my post "My next PC will be an Ultrabook."

I can truly see why MacBook Air folks are so enthusiastic. All Ultrabooks have an "Air" about them. When you can throw your 3lb Ultrabook in a Messenger Bag and it's no heavier than a few magazines, you're much more likely to carry it around. Add in 6(ish) hours of battery and you can comfortably move around before you have to plug in. Even better, somehow this thing charges FAST. Just 30 minutes of charging has topped me up 50-70%. I had a 20% low battery after a flight, plugged in while eating at the airport for a half hour, then ran to the next flight and I was more than 70% and able to work the next flight too. I'm getting >4 hours working hard, and have gotten as much as 6 with low brightness and just browsing or watching movies.

One of the USB ports will provide power to one device so you can charge your phone while the laptop is off. I love laptops with this feature. It saved me just last week while travelling. You can also charge the laptop with a phone connected so everyone gets charged.

The X1 also has a SIM slot for a 3G connection, although I've never met someone who used this. It worked fine with my AT&T 3G SIM but considering that I can tether from almost any device including my phone, plus the wide availability of sharing devices using 4G or LTE, this is a slot on this laptop you'll never fill.


Let's get real about touch a minute. Here's what I said before:

Don't knock a touchscreen until you've used one. Every laptop should (and will) have a touch screen in a year. Mark my words. This nonsense about how your arm will hurt assumes that you're only using it. A touchscreen is complementary not primary. I use it for pinching, for scrolling web pages, and for launching apps. It's much faster to just touch the icon than to mouse over to click one.

This X1 Carbon isn't a tablet, nor is it trying to be a tablet. It's a fantastic fast and light Ultrabook with a touch screen. Say what you will about Windows 8 and it's fullscreen interface, but I maintain that the addition of a touchscreen is as significant as the addition of a mouse. Similarly, when voice input is 100% reliable, adding voice will be equally as significant.

Three great input methods are better than two. I move from keyboard to mouse to touch smoothly.

Type type, mouse, swipe, type type, touch, click.

Sorting slides, moving files, swiping to the previous app, but most of all, scrolling around. Sometimes I use the two-finger scroll down gesture via the touchpad to scroll but often I hold my right hand around the screen and scroll down with my thumb. Often I'll pinch to zoom. It's extremely comfortable.

Reviewers and journalists need to understand that these computers aren't made for them. They are made for my kids and the touch generation. Touch screen MacBooks are inevitable. It will happen. Touchless is next after that.

If you do mobile device development, running these emulators with a touch laptop is a joy. Let me rephrase. Get a freaking touch screen, mobile developers. Touch on your laptop will make you happy every single day.

Learn to integrate touch into your existing keyboard and mousing style and you'll be faster and more effective than ever. If you use just one input method, you are missing out.

Dongles Galore

I also bought the requisite dongles including a Mini DisplayPort to VGA Adapter and Mini DisplayPort DVI. If you like wired network access, you'll also need the USB 2.0 Ethernet Adapter. Other than having to carry them around in my bag, dongle life is what it is. I'd rather have a slim laptop on a few adapters than continue to carry the Lenovo W520 I've been carrying.

I have ordered the Lenovo Think Pad USB 3.0 Docking Station but it hasn't arrived yet. I will update this review once it arrives. The docking station adds 5 USB 2.0 ports and an additional USB 3.0 port. It also includes Gigabit Ethernet.

This Docking Station also includes two (2) DVI ports which brings the number of monitors this laptop can run up to four. Well, three external (two DVI, one DisplayPort) and the built in LCD. It runs my 24" LCD over DVI today famously and without any trouble at all. I've also presented with this laptop using the VGA adapter and had exactly ZERO problems. The Display Drivers and adapters are rock solid.


There's been a lot of discussion about the screen on the X1 Carbon Touch. There's a protective film later over the screen and it really bothers some people. Some folks have successfully pried it off with some patience. Honestly, I noticed it for a day and then I stopped caring. I've spoken to folks who have said it was irritating enough that they sent the laptop back. Others just don't care. It's a clear, clean, bright screen and I'm happy with it.

X1 Carbon Touch Screen

X1 Carbon Touch Screen

It's not retina, but it's a great clear screen with great brightness and excellent horizontal viewing angles. It's a solid 14". I am surprised at the size of the W520 now that I've adapted to the X1.

Phrasing it differently, the X1 is a great mobile workstation. The W520 is a great workstation that can be moved occasionally.

The Good

It's really fast. I got the i7 processor version and it's fast. The 240gig SSD is lovely and devoid of hiccups. Visual Studio starts in 5 seconds cold, and 2 seconds warm. It runs Hyper-V nicely, and I've also run the x86 Android Emulator full speed as well as the Windows Phone emulator.

If you look at the WEI (Windows Experience Index) you'll be disappointed by the 5.5 Desktop Graphics performance, but I'm starting to think that this score should be thrown out. 2D graphics performance, while measureable, just isn't easily noticeable in day to day business use. We care about scrolling around in large documents, Excel, big PDFs, long web pages. The Intel integrated video in the X1 Carbon Touch is more than adequate. It's even pretty good in 3D games, handling games like TorchLight II very nicely if you turn antialiasing down just a smidge.

WEI for the Lenovo X1 Carbon Touch - 7.1, 7.4, 5.5, 6.4, 8.1

Tiny Happy Features

There some other nice features that are small but important that make this a great business machine.

  • A decent 720p HD integrated Webcam. I've used it with Skype and Lync and it works great. I wish it was angled slightly higher but that's a nit.
  • It has not only hardware volume buttons (which we expect) but also a hardware microphone mute button with an LED indicator which is great for long conference calls.
  • It boots up fast and sleeps very reliably. It reboots only when a Windows update requires it. I can close it and put it in my bag without concern.
  • A hardware Airplane Mode switch. This is not just a "turn off devices hard" button but it's integrated with Windows 8 and turns off all radios with a hardware switch. Also nice for saving batteries.
  • Good quality mics. I don't like doing conference calls or video conferencing with just a laptop's microphone but this one is better than usual.
  • Integrated TPM (Trusted Platform Module) so I can BitLocker my C: drive easily, and I have. I also get DirectAccess and a virtual Smart Card so I don't need to use VPN and am always logged into work. Super convenient.
  • Integrated Fingerprint login. I used to use this all the time on my W520 but for some reason I've been using the Virtual Smart Card lately. Still it's a nice login feature and I've had good experiences with it before.
  • One combination headphone/mic plug. Most good laptops have this now. You can use a good pair of headphones (or your iPhone headphones) and get mic and headphones in one. This detection is integfrated with the audio system.
  • Integrated SD card slot.
  • It's SO quiet. I sometimes wish it wasn't silent so I could know what it was doing.

And finally, one piece of software that came with it that I thought would suck but didn't - the Dolby Home Theater software. It actually has some nice presets for movies, VOIP, and music that definitely improve the output (or perception of output) of the speakers.

The Bad

The touchpad is the worse part of this device. Initially I hated it. They've removed the small textured touchpad I love from the W520 with it's buttons on the bottom, and replaced it with a new glossy glass touchpad. It's the lack of buttons on the bottom that's killing me. I keep bumping the touchpad while I'm using it and the cursor jumps.

It took me a few days to realize why this was happening, then I realized that I historically cursor with my index finger and rest my thumb on the bottom of the touchpad. With other ThinkPads there are buttons at the bottom that my thumb rested on. With the X1, I was resting on the touchpad itself. This just took a week of conscious thought and it's cool now, but be prepared for that "changeover" time as you teach yourself where to place your fingers while mousing. I'm interested in other X1 Carbon owners' thoughts on the touchpad in the comments.

The Carbon Touch has a much larger touchpad than the W520

I had to fiddle with the touch settings a little as well, as I move fast. I recommend power users turn down the duration you need to press and hold in order to activate a Right Click action. I also turn on the "Touch Feedback" so you can actually see the results of your touch. It's meant for presenters, but it's really nice to get the visual feedback that the system has recorded your touch.

Modify the Touch Settings to optimize your X1 Carbon Touch

The X1 Carbon Touch can also get a little hot. You'll only notice this if you are really a LAP-top person (and I'm not) but even now as I write this I'm running two instances of VS, PhotoShop and a Virtual Machine in Hyper-V doing Windows Update within a Windows 7 VM. It's not going to burn me, but it is definitely hot.

Finally, I did have one day with a really lousy Wi-Fi driver while I was travelling. The MGM Grand Hotel in Las Vegas had a wireless network that this Intel Wi-Fi card just hated. I was getting lockups and it was generally bad. However, I switched to using a 4G hotspot and updated the driver and never saw the issue again. Moral - Make sure you're using tested and reliable "out of the box" drivers. I am sticking with the drivers from Windows Update for important things and Lenovo System Update for non-essential drivers. I'm also finding the SD card (Ricoh) driver to be a little suspicious so I'm keeping it disabled in Device Manager when I'm not using it.

I recommend you uninstall ALL random software (there's not too much) that Lenovo puts on it except the Lenovo System Update. I use this for only for drivers and small utilities that give you things like on-screen caps lock notifiers.

The only other thing I really wish this laptop had was an extra USB port. There's one USB 3.0 and one USB 2 port and I really needed a third USB port recently while presenting. I used the USB to Ethernet adapter along with my USB Arc Touch Mouse and was stuck. I needed a third post for a the presenter remote. This is a small irritant, but I noticed it.


This is a very solid touch Ultrabook that I'm currently using as my main machine. The Lenovo X1 Carbon Touch has replaced my Intel Ultrabook which has been passed on to my wife. My Lenovo W520 is currently my emergency backup machine and is weighing down my bookshelf. I'm taking this device everywhere I go and when I'm not at home it's my primary development machine.

Sponsor: The Windows Azure Developer Challenge is on.  Complete 5 programming challenges for a chance at spot prizes, Stage prizes and the Grand Prize. Over $16,000 is up for grabs with 65 chances to win!

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb

Penny Pinching in the Cloud: How to run a two day Virtual Conference for $10

April 26, '13 Comments [28] Posted in Azure | Open Source | SignalR
Sponsored By
DotNetConf Logo

We've just finished Day One of "DotNetConf" our community-run free online conference for developers who love the .NET development platform and open source!

UPDATE: All the Videos from both days of DotNetConf are now online and available for on-demand viewing!

The Conference Platform

It seems funny to call the software our conference runs on a "platform" as that sounds very "enterprisey" and official. In the past we've done aspConf and mvcConf with sponsors who helped pay for things. We used Channel 9 and had a studio and streamed either from Seattle or using Live Meeting.

However, this year we wanted to do it on the cheap and more distributed. We wanted speakers from ALL over in all time zones. How cheap? About USD$10ish we figure. I'll get a complete bill later, but we basically wanted to scale up, do the talks and scale down.

Video Broadcasting and Screen-sharing

  • This year we are using Google Hangouts with their "Hangouts On Air" feature. A "dotnetconf" Google Account invites the presenter to a Hang Out and check the "on air" box before start the hangout. Then we use the Hangout Toolbox to dynamically add on screen graphics and speaker labels. Everyone sets their resolution to 1280x768 and the live stream ends scaling down to 480p.
  • Once you hit "Start Broadcast" you're given a YouTube link to the live stream. When you hit End Broadcast, the resulting video is ready to go on your YouTube page within minutes. The hangout owner (me or Javier) then clicks "Hide in Broadcast" and fades away. You can see I'm faded away in the below screenshot. I'm there, but only if I need to be. When there's only one active presenter the Hangout turns into a full screen affair, which is what we want.
  • Important Note: Rather than an 8 hour Hangout, we started and stopped as each speaker did their talk. This means that our talks are already discrete on the YouTube page. The YouTube videos can have their start and end times trimmed so the start isn't so rough.

Google Hangouts On Air

The Database

Surprise! There is no database. There is no need for one. We're running a two page site using ASP.NET Web Pages written in WebMatrix. It runs in the Azure cloud but since our dataset (speakers, schedule, the video stream location, etc) isn't changing a lot, we put all the data in XML files. It's data, sure, but it's a poor man's database. Why pay for more than we need?

How do we update the "database" during the talk? Get ready to have an opinion. The data is in Dropbox. (Yes, it could have been SkyDrive, or another URL, but we used DropBox)

Our Web App pulls the data from Dropbox URLs and caches it. Works pretty nice.

<add key="url.playerUrl" value="" />
<add key="url.scheduleUrl" value="" />
<add key="url.speakerUrl" value="" />
<add key="Microsoft.ServiceBus.ConnectionString" value="Endpoint=sb://[your namespace];SharedSecretIssuer=owner;SharedSecretValue=[your secret]" />

The code is simple, as code should be. Wanna show the schedule? And yes , it's a TABLE. It's a table of the schedule. Nyah.

@foreach(var session in schedule) {
var confTime = session.Time;
var pstZone = TimeZoneInfo.FindSystemTimeZoneById("Pacific Standard Time");
var attendeeTime = TimeZoneInfo.ConvertTimeToUtc(confTime, pstZone);
<p>@confTime.ToShortTimeString() (PDT)</p>
<p>@attendeeTime.ToShortTimeString() (GMT)</p>
<div class="speaker-info">
<span class="company-name"><a class="speaker-website" href="/speakers.cshtml?speaker=@session.Twitter">@session.Name</a></span>

Scaling Out

Scaling DotNetConfWe've been on an extra small Azure Website and then switched to two large (and finally, two medium as large was totally overkill) web sites. 

We scale up (and hence, pay) only during the conference and turn it down to Small when we're done. No need to spend money if we don't need to.

Scaling DotNetConf to Large

Updating the Site in Real-time with SignalR

Because the YouTube link changes with each Hangout, we had the problem that attendees of the conference would have to hit refresh themselves to get the new URL. There's a number of solutions to this that I'm sure you're already thinking about. We could meta refresh, refresh on a timer, but these aren't on demand. We also wanted to show a few videos during the downtime. One of us preps the next speaker while the other queues up videos to watch.

We realized this was a problem at about 10pm PST last night. Javier and I got on Skype and came up with this late night hack.

What if everyone had SignalR running while their were watching the videos? Then we could push out the next YouTube video from an admin console.

So visualize this. There's the watcher (you), there's a admin (me) and there's the server (the Hub).

The watcher has this on their main page after including the /signalr/hub JavaScript:

$(function () {
var youtube = $.connection.youTubeHub;
$.connection.hub.logging = true;

youtube.client.updateYouTube = function (message, password) {
$("#youtube").attr("src", "" + message + "?autoplay=1");

$.connection.hub.disconnected(function () {
setTimeout(function () {
}, 5000);

The watcher is listening, er, watching, for a SignalR message from the server with the YouTube video short code. When we get it, we swap out the iFrame. Simple and it works.

Here's the admin console where we put in the next YouTube code (I'm using Razor in ASP.NET Web Pages in WebMatrix, so this is mixed HTML/JS):

<div id="container">
<input type="text" id="videoId" name="videoId"><br/>
<input type="text" id="password" name="passsword" placeholder="password"><br/>
<button id="playerUpdate" name="playerUpdate">Update Player</button>

@section SignalR {
$(function () {
var youtube = $.connection.youTubeHub;
$.connection.hub.logging = true;

$.connection.hub.start().done(function () {
$('#playerUpdate').click(function () {
youtube.server.update($('#videoId').val(), $('#password').val());
$.connection.hub.disconnected(function() {
setTimeout(function() {
}, 5000);

We put in the short code, the password and update. All this must be complex eh? What's the powerful SignalR backend up running in the cloud backed by the power of Azure and Service Bus look like? Surely that code must be too complex to show on a simple blog, eh? Strap in, friends.

public class YouTubeHub : Microsoft.AspNet.SignalR.Hub
public void update(string message, string password)
if (password.ToLowerInvariant() == "itisasecret")

This is either a purist's nightmare or a pragmatists dream. Either way, we've been running it all day and it works. Between talks we pushed in pre-recorded talks and messages, then finally when the live talk started we pushed that one as well.

We also updated the DropBox links with the current Video Stream so that new visitors showing up would get the latest video, as new site visitors wouldn't have been connected when the video "push" message went out.


What about scale out? We sometimes have two machines in the farm so we need the SignalR "push updated youtube video message" to travel across a scale-out backplane. That took another 10 minutes.

Scaling out with SignalR using the Azure Service Bus

We used the SignalR 1.1 Beta plus Azure Service Bus Topics for scale out and added an Azure Service Bus to our account. Our app startup changed, adding this call to UseServiceBus():

string poo = "Endpoint=sb://;SharedSecretIssuer=owner;SharedSecretValue=g57totalsecrets=";   

Now SignalR uses the Service Bus Topics for "Pub/Sub" to pass notifications between the two web servers. I can push a new video from Web 1 and it is sent to everyone on Web 1 and Web 2 (or Web N) via SignalR's realtime persistent connection.


We'll delete this Service Bus Topic as soon as we are done. I would hate for the bill to get up into the nickels. ;) Here's example pricing from the Azure site:

432,000 Service Bus messages cost 432,000/10,000 * $0.01 = 44 * $0.01 = $0.44 per day.

I'm not sure how many messages we've done, but I can rest assured it won't cost a pile, so that's a relief.

Thank you to the Community!

  • Big thanks to designer Jin Yang who created the dotnetConf logo and design. Tweet @jzy and tell him you think he is special. Thanks to Dave Ward for converting Jzy's design into HTML!
  • Kudos and thanks to Javier Lozano for his coding, his organizing, his brainstorming and his tireless hard work. It was also cool for him to sit with me for hours last night while we hacked on SignalR and the site.
  • Thanks to David Fowler for saying "it'll just take 10 minutes to add Service Bus." 
  • Thanks to Eric Hexter and Jon Galloway for their organizational abilities and generous gifts of time on all the *conf events!
  • But mostly, thanks to the speakers who volunteered their time and presented and the community who showed up to watch, interact and play with us!

Sponsor: The Windows Azure Developer Challenge is on.  Complete 5 programming challenges for a chance at spot prizes, Stage prizes and the Grand Prize. Over $16,000 is up for grabs with 65 chances to win!

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb

Project-less scripted C# with ScriptCS and Roslyn

April 24, '13 Comments [31] Posted in NuGet | NuGetPOW | Open Source | VS2012
Sponsored By
ScriptCS inside of SublimeText2 with the ScriptCS package giving SyntaxHighlighting

Glenn Block is working on something interesting that combines C#, NuGet, Roslyn (the new "compiler as a service") and his love of text editors and scripts. Now, with help from Justin Rusbatch (@jrusbatch) and Filip Wojcieszyn (@filip_woj) they are having all kinds of fun...using C# as a scripting language.

Every few years someone tries to turn C# into a competent scripting world, myself included. Often this has included batch files and MacGyver magic, file associations and hacks. Clearly the .NET community wants something like this, but we are collectively still trying to figure out what it should look like. PowerShell aficionados - and I count myself amongst them - might look at such efforts as a threat or a pale reinvention of PowerShell, but the fact remains that C# at the command line, be it as a script or a REPL, is an attractive concept.

Simply put by example, ScriptCS lets me do this:

C:\temp>copy con hello.csx
1 file(s) copied.

C:\temp>scriptcs hello.csx

That's Hello World. There's no namespace, no class, just some C# in a .csx file. Roslyn takes care of the compilation and the resulting code and .exe never hits the disk.

Self-hosting Web APIs

So that's interesting, but what about bootstrapping a web server using NancyFX to host a Web API?

Go and clone this repo:

git clone

Look in the Nancy folder. There's a packages.config. Just like a node.js application has a packages.json file with the dependencies in has, a .NET app usually has a packages.config with the name. In node, you type npm install to restore those packages from the main repository. Here I'll type scriptcs -install...

C:\temp\scriptcs-samples\nancy>scriptcs -install
Installing packages...
Installed: Nancy.Hosting.Self
Installed: Nancy.Bootstrappers.Autofac
Installed: Autofac
Installation successful.

Now, running start.csx fires up an instance of Nancy listening on localhost:1234. There's no IIS, no ASP.NET.

C:\temp\scriptcs-samples\nancy>scriptcs start.csx
Found assembly reference: Autofac.Configuration.dll
Found assembly reference: Autofac.dll
Found assembly reference: Nancy.Bootstrappers.Autofac.dll
Found assembly reference: Nancy.dll
Found assembly reference: Nancy.Hosting.Self.dll
Nancy is running at http://localhost:1234/
Press any key to end

There is also the notion of a "ScriptPack" such that you can Require<T> a library and hide a lot of the bootstrapping and complexity. For example, I could start up WebAPI after installing a Web API package that includes some starter code. Note this is all from the command line. I'm using "copy con file" to get started.

C:\temp\foo>scriptcs -install ScriptCs.WebApi
Installing packages...
Installed: ScriptCs.WebApi
Installation completed successfully.
Added ScriptCs.WebApi, Version 0.1.0, .NET 4.5
Packages.config successfully created!

C:\temp\foo>copy con start.csx
public class TestController : ApiController {
public string Get() {
return "Hello world!";

var webApi = Require<WebApi>();
var server = webApi.CreateServer("http://localhost:8080");

1 file(s) copied.

C:\temp\foo>scriptcs start.csx
Found assembly reference: Newtonsoft.Json.dll

Pretty slick. Add in a little Live Reload-style action and we could have a very node-ish experience, all from the command line and from within your text editor of choice, except using C#.

Note that this is all using the same CLR and .NET that you've already got, running at full speed. Only the compilation is handled differently to give this script-like feel.

Installing ScriptCS

The easiest way to install and use ScriptCS is to use Chocolatey (a system-wide NuGet-based application/component installer. "Chocolatey NuGet," get it?) And yes, it's Chocolatey spelled incorrectly with an "-ey."

You can use Chocolatey to do things like "cinst 7zip" or "cinst git" but we'll be using it just to get ScriptCS set up. It's also easily removed if it freaks you out and it installs no services and won't change anything major up save your PATH.

First paste this into a cmd.exe prompt:

@powershell -NoProfile -ExecutionPolicy unrestricted -Command "iex ((new-object net.webclient).DownloadString(''))" && SET PATH=%PATH%;%systemdrive%\chocolatey\bin

This will PowerShell, run and add Chocolatey to your path.

Then, run

cinst ScriptCS

Which will put ScriptCS in a path like C:\Chocolatey\lib\ScriptCs.0.0.0 while Chocolatey makes it available in your PATH.

Sublime Text or Visual Studio

You can get syntax highlighting for your CSX files inside of Sublime Text 2 with the "ScriptCS" package you can install from package control. If you're using Visual Studio you can get the Roslyn CTP to turn on CSX syntax highlighting.

You can use PackageControl in SublimeText2 and install the ScriptCS package

You can even debug your running ScriptCS projects by opening the ScriptCS.exe as a project. (Did you know you can open an EXE as a project?) Add the .csx script to the command line via Project Properties, drag in the scripts you're working on and debug away.

Debugging requires the Roslyn SDK, although personally, I've been doing just fine with scripts at the command line which requires nothing more than the basic install and a text editor.

It's not clear where ScriptCS is going, but it'll be interesting to see! Go get involved at This kind of stuff gets me excited about the prospect of a compiler as a service, and also cements my appreciation of C# as my enabling language of choice. Between C# and JavaScript, you can really get a lot done, pretty much anywhere.

I'll have a video walkthrough on how this works as I explain it to Rob Conery up on TekPub soon! (Here's a referral coupon for 20% off of Tekpub!)

What do you think?

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb

Exposed: A Blog Comment Spammer's Source Template

April 22, '13 Comments [53] Posted in Musings
Sponsored By

I've been getting a LOT of Blog Comment Spam lately, just in the at two weeks. I run all my comments through the Akismet Service, and I pay for it. However, this particular flavor of spam has been making it through consistently. It has a pattern, through, and I'd been trying to figure it out when this LARGE comment showed up.

Apparently while they were messing about trying to spam me, they posted their entire source template.

I'm embedding it below as a Gist, rather than copy/pasting it into my blog engine. It's so spammy, I'd hate to get delisted from Google looking rather like a splog.

Note the comments for the Gist as well.

One fellow says

"I used to do comment spam and this is not the most advanced one."

Really? Does one put Comment Spammer on their resume?

Another comment says that we're hating on spammers. We should embrace them because:

"Sure for the 1% of super popular blogs out there this might be unnecessary, but in a world filled with bloggers blogging blogs most people never read, the fake recognition and pleasantry might be just what these writers need."

I'm pretty sure that fake comment spam isn't as emotionally uplifting as you think.

Start scrolling down! If you are viewing this in an RSS reader, you MAY need to visit this post directly to see it.

Your comments, Dear Reader? Cue spam comment-related

Sponsor: The Windows Azure Developer Challenge is on.  Complete 5 programming challenges for a chance at spot prizes, Stage prizes and the Grand Prize. Over $16,000 is up for grabs with 65 chances to win!

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb

Disclaimer: The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.