One of Basware’s products I work for uses CDN to deliver content for end users. CDN provider is Edgecast, and primary & secondary origins are Azure Blob storage accounts. So far we have not needed any cross domain access to the CDN, but now a new feature required Javascript requests from our application domain to the CDN domain… and browsers naturally block this nowadays.

I knew right away that I need to set the Cross Origin Resource Sharing (CORS) headers to our origin servers, but setting this up was harder than it is supposed to be: Azure’s Powershell SDK does not have support to alter this value, and there is no UI to set it in the management portal. There is of course the management REST API you can use to do anything, but calling it with curl is hard due to the authentication scheme. Setting the DefaultServiceVersion property proved to be as complex before, so I knew what to expect.

I checked Github and there were a couple of projects that matched my problem. Still I found none of them immediately useful; this kind of tool that you use only once should have a very low barrier of entry: git clone and run. So I decided to try to create one myself. With some help from blog posts like Bill Wilders post on the subject I was able to create a working version in an hour. My tech stack for this is ScriptCS, as it supports Nuget references out of the box. I referenced the WindowsAzure.Storage package that had the methods I needed.

The end result is a tool that (given you have ScriptCS installed) you can just clone and run - ScriptCS takes care of the package restoration automatically. Tool supports dumping current values to console, adding CORS rules, and clearing rules. And the syntax is easy enough for anyone to use:

scriptcs addCors.csx -- [storageAccount] [storageAccountKey] [origins]

ScriptCS runs also on Mono, so you could even say this is cross platform. Not as good as Node or Go based solution would have been, but still good enough.

Naming is the hardest part… this tool turned out to be just “AzureCorsSetter”.

At the beginning of October Microsoft Finland held the yearly developer conference, this time with name Devdays. This year’s conference felt slightly smaller than previously.

As there is is lots of churn around the ASP.NET right now and I have a history with that framework, I proposed a presentation about ASP.NET vNext. Gladly it got accepted, and I had to dig deeper into what’s coming from the ASP.NET team. I played with the framework, watched every video and and read every blogpost about it from Scott Hanselman, David Fowler and others. I also prepared some demos, even a Linux demo which I had to scrap on last minute because I had only 45 minutes time to present. I tried to give the audience some guidelines how they can prepare to what’s coming, in order for the upgrade from current ASP.NET to be as easy as possible. It was nice to prepare and present, I hope it helped someone.

P.s. I waited for Microsoft to release the video recordings before posting this, but still after two months there is only a couple of videos available, and they are on strangely named Youtube channel, different from previous years. I do not know what happened as I have not seen any communication from MS about the recordings, and I have yet received no answer to my question. So I have to say this aspect of the conference was poorly executed this year. Also, there was no common feedback collection, which means that presenters did not get any proper feedback. For me it is important to see the video and get some feedback to be able to do better next year.

I changed some of my websites deployment to use different deployment slots on a single Azure web site instead of having different web sites for different staging areas. I deploy all my staging areas automatically from TFS (using the GitContinuousDeploymentTemplate.12.xaml process), each area from different Git branch. Works for my setup.

What did not work was deploying to other slots than the main slot. On Azure portal different slots have name and address scheme like mywebsite-slotname. I tried to use this name as deployment target:

Failing configuration.
Failing configuration.

…and got failed build with error like:

An attempted http request against URI returned an error: (404) Not Found.

So clearly mywebsite-slotname is not the correct scheme. And there is no documentation available, thus this blog post.

I went on and downloaded publishing profile for the site slot. It had double underscore naming mywebsite__slotname, but that did not work either. Nor did single underscore. What finally worked, was the name the old Azure portal used: mywebsite(slotname). This is how my build process deployment target looks now, and deployment to the slot works.

Working configuration.
Working configuration.

I hope this gets better documented. Luckily one can create pull request for Azure documentation nowadays; I might document this myself.

Since Office 2013 was launched, I’ve had some problems with Outlook and account settings: I can set up all the accounts, but Outlook refuses to display my default Exchange calendar on the todo-pane, and instead shows an empty calendar from one of the other accounts that I use for email only. I like the todo-pane as its easy to glance whats coming with it. I’ve searched for resolution a couple of times, and most Microsoft community answers suggest to change the default data file on via Outlook > Account Settings:

Outlook default data file settings

Unfortunately changing that setting back and forth does not affect what’s shown on the todo-pane; I already had my Exchange account as default. Next suggestion I found was to change the same setting via Windows Control Panel’s mail section:

Control panel mail settings

…but that was exactly the same setup than the previous one done via Outlook, nothing changed. Out of curiosity I decided to check what’s under the mail profiles section.

Control panel mail profiles

And from there I hit properties, and under properties you can find yet another data file selection dialog. Changing this data file under the profile finally changed my Outlook’s default calendar. Shouldn’t be this hard.

Control panel mail setup for a profile Default data file for a profile
Yet another place to set the default Outlook data file.
What has pharmacy to do with programming?

I visited my local pharmacy last Friday to get some prescription drug. I sat in front of the pharmacist, who gave me very thorough guidance about the usage. At the time of payment - before she handed me the boxes - she suddenly said:

Excuse me, but I need to get a signature from someone else, as I am a trainee.

Immediately another pharmacist came by, put her smart card into the computer, checked the boxes against the electronic prescription, and then signed the delivery. The whole process took maybe 20 seconds, and I’m certain trainee felt safer as her work is checked against mistakes. And myself - as a client - I felt like they care.

With the risk of sounding like Uncle Bob: this episode reminded me about how one should act if you really care about quality. This model of signing other people’s work is built into some software development processes, like the Github flow. If you are not using pull requests, you can still simulate this kind of apprenticeship model with strict use of code reviews before merging into your trunk. Remember, that this must not be for all your codebase; you can be very strict on important, core modules, and let others evolve freely.