0 comments

So I’m working on setting up a small presentation for work and really like the simplicity of reveal.js. I’ve toyed around with some of the node-js plugins before and really like the “Server side speaker notes” plugin, which lets me view my speaker notes on a different device than the one running the presentation. I’ve used my Surface 2 for this purpose before with great success.

Anyway, for this presentation I decided it would be fun to host it on the web so I could just give people the URL later on, instead of distributing the slides via PDF or PowerPoint or the like.

So, why not host the presentation in an Azure Website?

Prerequisites:

 

First of all I clone the reveal.js repo from Github.

image

Then, to be able to run the speaker notes server extension on Azure, I need to modify it slightly. So, in the plugin\notes-server directory, open index.js in your favourite editor.
Around line 13 you should find the server port definition (set to 1947). Change this to process.env.PORT:

image

That’s all you need to change in this file. Remember to commit your changes to the local git repo.

image

There’s one more change you need to make, and that is to enable the speaker notes extension in your presentation. Follow the short guide here for instructions. It’s basically a question of adding two lines inside the dependencies section at the bottom of the presentation html page.

Now, to run on Azure you need to tell IIS to run the iisnode extension for your site. To do this, drop a web.config file in the root of the site, with the following settings:

<configuration>
	<system.webServer>
		<handlers>
			<!-- indicates that the app.js file is a node.js application to be handled by the iisnode module -->
			<add name="iisnode" path="plugin/notes-server/index.js" verb="*" modules="iisnode"/>
		</handlers>
		<rewrite>
			<rules>
				<!-- Don't interfere with requests for logs -->
				<rule name="LogFile" patternSyntax="ECMAScript" stopProcessing="true">
					<match url="^[a-zA-Z0-9_\-]+\.js\.logs\/\d+\.txt$"/>
				</rule>
				<!-- Don't interfere with requests for node-inspector debugging -->
				<rule name="NodeInspector" patternSyntax="ECMAScript" stopProcessing="true">
					<match url="server.js\/debug[\/]?"/>
				</rule>
				<!-- First we consider whether the incoming URL matches a physical file in the /public folder -->
				<rule name="StaticContent">
					<action type="Rewrite" url="public{REQUEST_URI}"/>
				</rule>
				<!-- All other URLs are mapped to the Node.js application entry point -->
				<rule name="DynamicContent">
					<conditions>
						<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="True"/>
					</conditions>
					<action type="Rewrite" url="plugin/notes-server/index.js"/>
				</rule>
			</rules>
		</rewrite>
	</system.webServer>
	<system.web>
		<compilation debug="true"/>
	</system.web>
</configuration>

Notice that the iisnode handler gets configured to point to the notes-server plugin and that all dynamic URLs are also mapped there. This ensures that the main entry point to our application is through that handler.

Save the file as web.config and add & commit it to the git repo.

image

Now we’re basically ready to push our presentation to Azure. After running the cmdlet Add-AzureAccount, you’re ready to create an Azure Website:

New-AzureWebsite testpresentation -Git

After a few seconds, Azure will have set up your website for you as well as add a remote to your local git repo, named “azure” (That’s what the –Git part does).

You also want to enable websockets on your new website. Run the following command:

Set-AzureWebSite -WebSocketsEnabled 1

All that’s left to do now is to push your presentation up to your newly created website:

git push azure master

The deployment will now run and set up your site for you in Azure, including installing all the required node.js modules. 10-15 seconds later, you should see a "Deployment Successful" message.

If you go to the URL you created above, in this case http://testpresentation.azurewebsites.net*, your presentation should appear, including a popup with your speaker notes. The URL in the popup window can be opened on any other device to give you speaker notes "disconnected" from your main presentation. This is extremely handy when presenting in a place where you don't necessarily have a dual-monitor setup. Instead, you can simply view your notes on your phone or tablet.

Awesome, right?

* Disclaimer: I won’t promise to keep this site online forever

0 comments

I'm really happy with Visual Studio 2012, and I do think it's by far the biggest leap forward for any iteration of VS. However, one new feature that bugs me is the "Auto Preview" where any file I click on in the Solution Explorer is opened for me in a special preview tab. 

This can be prevented if you hold down the ALT-key while clicking around the Solution Explorer, but IMO it should have been the other way round (i.e. don't preview unless you ALT-click).

Luckily this can be easily turned off by going to Tools -> Options -> Tabs and Windows and de-selecting the Solution Explorer under 'Preview Tab'

 

0 comments

I've been invited to participate as a blogger at the GOTO Conference in Aarhus this October. Yay, that means more activity on this blog in the coming weeks/months!

Since I will be there "as a blogger", my main task will of course be to blog about the conference and about topics I find interesting or controversial. 

When attending conferences like this, one can chose to attend talks that are completely related to one's day-to-day work, or one can chose to attend talks that are a long way out of one's comfort zone. I haven't yet decided exactly which conference strategy I will be going for, but one thing is for sure: I'm definitely going for the chance to hang out (maybe have a beer?) with brilliant minds; to become inspired; to become wiser.

Stay tuned for more, I'll be writing another post or two before the conference, as soon the programme is finalized and I know more about which sessions I'm going to attend.

Feel free to check out the awesome speakers list on the website linked above and if you aren't going yourself but have a question you want answered, maybe I can be your proxy. Use the comments field below or send me an email (or Twitter) and I'll see what I can do.

0 comments

 

All good things, as they say, come to an end. This unfortunately also includes my free SVN hosting service, svn.graffen.dk, that has been running almost non-stop since some time in 2006.

I started svn.graffen.dk as a free hosting service, mostly because no others really existed at the time, and I needed a place to host my own private repositories. It was one of the first services I put online and has by far been the most popular (with more than 1000 registered users, of which about 300 have used it within the past 3 months).

But running a server costs money, bandwidth and time and since I myself have moved on to use other version control systems and haven't used my own service for quite some time, I have decided that it is time to put it to rest. I simply don't have the time or resources to keep it alive any more. 

So that's it. I'll be shutting down the server in about a week's time (end of next week) so if you have anything important on there, please make sure you get it off and put it somewhere else. I can recommend switching to some of the other awesome free services out there, like BitBucket or GitHub. SubVersion is an inferior VCS nowadays anyway ;-)

I'd like to thank you all for using my service - it's been fun watching something I built for fun actually be used by quite a number of people.

So long and thanks for all the fish!

 

0 comments

For us .NET/Visual Studio developers, NuGet is definitely the best thing since sliced bread (okay, maybe not, but it sure is great!). If you don’t yet know what NuGet is, it’s basically a package- and dependency manager for Visual Studio and .NET. And if you haven’t started using it yet, you’re doing something wrong Winking smile

One thing that kind of always bothered me about dependencies is that it’s always been best-practice to have all your libraries checked in to SCM along with your solution. Typically by dumping them in a \Libs folder and referencing them from there.

But source control systems are generally not very optimized for handling binary files, and the size of your repository (and thereby performance) is negatively impacted by dragging around all these DLL files.

With NuGet this is a thing of the past! Using the command line NuGet.exe tool, you can point it at a local config file that tells it which packages to download for you (those of you who already use NuGet are probably already familiar with the packages.config file that lives under each project in your solution).

The only executable file I now have as part of my solution is the latest-and-greatest NuGet.exe which I place in a Tools folder in the root of my solution.

So, to get all this set up in your project, your first step is to create a Tools folder at the solution level of your project. Next, go ahead and grab the latest NuGet.exe from here and put it in your newly created folder.

Now, to each of the projects in your solution, add the following pre-build command:

$(SolutionDir)Tools\Nuget.exe install $(ProjectDir)packages.config -o $(SolutionDir)Packages

Also make sure that the \Packages folder is ignored by yout SCM system of choice (mine is Mercurial) in the same way that you always ignore the Bin and Obj folders.

To test, just delete the \Packages folder from your solution directory and try to do a build. NuGet should now automatically download all the dependencies you have and place them back in \Packages. It takes a little while to run the first time, so don’t panic if nothing happens for a few seconds. If it works and the build succeeds, go ahead and commit everything to source control. You can now continue working without the burden of large unsightly DLLs littering your source repository.