The Daily Parker

Politics, Weather, Photography, and the Dog

Dual Microsoft Azure deployment, part 1

(This is cross-posted on the 10th Magnitude blog.)

In my last post, I talked about using Azure web sites to save beaucoup bucks over Azure Cloud Services web roles on nonessential, internal, and development web applications. In this post I'll go over a couple of things that bit me in the course of deploying a bunch of applications to Azure web sites in the last two weeks.

First, let me acknowledge that engineering a .NET application to support both types of deployment is a pain. Azure web sites can't use Cloud Storage, including tables, blobs, and queues. You'll need to architect (or refactor) your application to get its data from different sources based on whether it's running inside Cloud Services or not.

Once you've done all that (simple, right?), one line of code will let the application know where it is:

if (RoleEnvironment.IsAvailable) { DoCloudServicesStuff(); }

But here's the catch. Azure web sites don't have access to the RoleEnvironment class by default. The class lives in the Microsoft.WindowsAzure.ServiceRuntime assembly, which Cloud Services applications get through their VM's GAC and which website applications do not.

So even for your application to determine whether it's running in Cloud Services or not, you'll have to add two assemblies to the website project file: Microsoft.WindowsAzure.ServiceRuntime.dll and msshrtmi.dll. If you don't, you'll get one of these runtime errors:

Could not load file or assembly 'Microsoft.WindowsAzure.ServiceRuntime, Version=1.7.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.

Could not load file or assembly 'msshrtmi, Version=1.7.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.

(On my computer, the ServiceRuntime assembly is in "C:\Program Files\Microsoft SDKs\Windows Azure\.NET SDK\2012-06\ref" and msshrtmi is in "C:\...\2012-06\bin\runtimes\base\x86\".)

Once you have added those two references to your web project, find them in the References list under the project root, select both, right-click, and open the Properties tab. Then set both of them to Copy Local = true, like this:

Copy msshrtmi local image

This tells the Publisher to include them in the deployment to Azure web sites. Note that you'll have to include these in your web application if any of the satellite assemblies uses the RoleEnvironment class (like our time zone handler, for example).

But now you have a new problem if you have dual deployments: you need two web project files, because the Cloud Services deployment will crash when the web role starts if you have those two assemblies referenced explicitly. And if you have two different web application project files, you'll need two solution files as well.

Of course, it only takes about two minutes to:

  • Make a copy of the solution file (usually "MyApplication-WebRole.sln" or "MyApplication-Website.sln" for the new copy);
  • Make a copy of the Web project file (you don't need different versions of your other assembly projects);
  • Manually edit the new solution file to point to the new project file.

(You could, I suppose, accomplish the same thing with build scripts and lots of conditional compile regions, but I can't call that an improvement. Like I said, this approach has more PITA than a falafel stand.)

We also find it helpful to wait until late in the development cycle to create the second solution/project pair of files, because you'll need to keep the two project files identical except for the two assembly references.

You have to do one more thing, unfortunately. You need to build your website deployment for the x86 platform target:

Visual Studio 2010 example of building as x86

The msshrtmi assembly requires explicitly building the application for x86 or x64 deployments, depending on whether you grab it from "C:\Program Files\Microsoft SDKs\Windows Azure\.NET SDK\2012-06\bin\runtimes\base\x86\" or "...\x64\". But we've run into other problems trying to use the x64 version, so we don't recommend it.

Chicago sunrise chart, 2012-13

I'm a little late getting the semi-annual Chicago sunrise chart out this summer. Sorry. (You can get one for your own location at http://www.wx-now.com/Sunrise/SunriseChart.aspx.)

Date Significance Sunrise Sunset Daylight
2012
2 Jul 8:30pm sunset 05:20 20:30 15:09
16 Jul 5:30am sunrise 05:30 20:24 14:53
8 Aug 8pm sunset 05:53 20:00 14:06
16 Aug 6am sunrise 06:00 19:48 13:48
28 Aug 7:30pm sunset 06:13 19:30 13:16
13 Sep 6:30am sunrise 06:30 19:03 12:33
15 Sep 7pm sunset 06:33 19:00 12:28
22 Sep Equinox, 09:49 CDT 06:39 18:48 12:08
25 Sep 12-hour day 06:42 18:42 12:00
2 Oct 6:30pm sunset 06:50 18:30 11:40
13 Oct 7am sunrise 07:01 18:13 11:10
21 Oct 6pm sunset 07:11 18:00 10:48
3 Nov Latest sunrise until 2 Nov 2013
Latest sunset until Mar 2nd
07:27 17:42 10:15
4 Nov Standard time returns
Earliest sunrise until Feb 28th
06:28 16:41 10:13
6 Nov 6:30 sunrise 06:30 16:39 10:08
15 Nov 4:30pm sunset 06:41 16:30 9:49
1 Dec 7am sunrise 07:00 16:21 9:21
7 Dec Earliest sunset of the year 07:06 16:20 9:14
21 Dec Solstice, 05:12 CST 07:16 16:23 9:07
2013
3 Jan Latest sunrise until Oct 28th 07:19 16:33 9:13
27 Jan 5pm sunset 07:08 17:00 9:52
4 Feb 7am sunrise 07:00 17:10 10:10
20 Feb 5:30pm sunset 06:39 17:31 10:52
26 Feb 6:30am sunrise 06:30 17:38 11:08
9 Mar Earliest sunrise until Apr. 14th
Earliest sunset until Oct. 28th
06:12 17:51 11:38
10 Mar Daylight savings time begins
Latest sunrise until Oct. 22nd
Earliest sunset until Sept. 20th
07:11 18:52 11:41
17 Mar 7am sunrise, 7pm sunset
12-hour day
06:59 19:00 12:01
20 Mar Equinox 06:02 CDT 06:54 19:04 12:10
3 Apr 6:30am sunrise (again) 06:30 19:19 12:49
13 Apr 7:30pm sunset 06:13 19:30 13:16
22 Apr 6am sunrise 06:00 19:39 13:39
10 May 8pm sunset 05:36 20:00 14:24
15 May 5:30am sunrise 05:30 20:05 14:36
14 Jun Earliest sunrise of the year 05:15 20:28 15:12
21 Jun Solstice 00:04 CDT
8:30pm sunset
05:16 20:30 15:14
26 Jun Latest sunset of the year 05:17 20:31 15:13

You can get sunrise information for your location at wx-now.com.

Sing along with Parker

A couple of days ago I discovered a new behavior in Parker. While listening to Martha Berner's song "A Town Called Happiness," which has an extensive harmonica part, Parker started to howl. Not in pain, though: he stayed in the room, and even got closer to the noise, tail wagging.

Apparently this is common dog behavior, and it really does mean he's just singing along.

So I dug out my dad's old harmonica and, yes, he sang along with that, too. In the upper ranges he really put his heart into it, too.

I know the behavior came out of those ancient days when wolves roamed free and men cowered at their howls...but this is Parker, and it's freaking adorable.

Grant me the serenity

Via Sullivan, artist Heather Dewey-Hagborg is creating 3D portraits from random hairs:

Collecting hairs she finds in random public places – bathrooms, libraries, and subway seats – she uses a battery of newly developing technologies to create physical, life-sized portraits of the owners of these hairs. You can see the portrait she’s made from her own hair in the photo below. While the actual likeness is a point of contention, these images bring about some creepy-yet-amazing comments; on genetic identity (how much of “you” really resides in your DNA?); on the possibilities of surveillance (what if your jealous partner started making portraits from hairs they found around your house?); and on the subjectivity inherent in working with “hard” data and computer systems (how much of a role do human assumptions play in this machine made portrait?).

The artist's site is here.

All right. This came a little sooner than I expected, and from a different source. I've long recognize the necessity of adapting to, rather than raging impotently against, the fundamental changes to the security and privacy mores we've had for several thousand years. (As Bruce Schneier has pointed out, "Fifteen years ago, [CCTV cameras] weren't everywhere. Fifteen years from now, they'll be so small we won't be able to see them.") But this project, if it works as hoped, actually freaks me out a little.

I'm going to whistle past this graveyard for the time being...

iOS can't keep you cool, but windows can

Even though the temperature outside tied the record 38°C set 70 years ago, I'm happy to report that Inner Drive Technology World Headquarters has remained tolerably cool:

Those are degrees Celsius vertically and the last 24 hours of time horizontally. The lower temperatures overnight come from me turning the air conditioning to a cooler setting in the evening and back up in the morning.

What you can't see in this snapshot is that during our last hot, hot summer (2008), I had trouble keeping the office below 27.5°C. That's where the server fans spin up, power consumption skyrockets, and the electronics within the servers start crying. So far in the last two months, I've only had about three hours total above that threshold temperature, caused not by inadequate air conditioning but by me not closing the windows and turning the AC on in the first place.

I credit the window replacement completed in December 2010. Since 2011 had neither a particularly harsh summer nor a harsh winter, it was harder to see this data before.

Also, having turned off 40% of my servers probably helped.

Still, I do not want to go outside right now...

A month of 90s

Today marks the 31st time this year Chicago's temperature has exceeded 32°C as another record falls:

The July 17 record high of 38°C for this date has stood 70 years, having been set in 1942 during World War II. Tuesday's heat gives the city a shot at replacing this record. [It was 36°C just before noon.—DB]

New USDA crop report paints bleak picture across much of the Midwest; more than half of Illinois' corn crop is "poor" or "very poor"!

Crops are struggling in many Midwest fields this year. USDA's weekly report on crop conditions released Monday indicates the condition of the corn crop continues to deteriorate. 56 percent of corn in Illinois is rated "poor"or "very poor". That percentage stands at 43 percent in Wisconsin; 27 percent in Iowa; 56 percent in Michigan; and grows to 69 percent in Missouri; and a whopping 71% in Indiana.

The New Yorker's Elizabeth Kolbert points out we made this happen 30 years ago:

One of the most salient—but also, unfortunately, most counterintuitive—aspects of global warming is that it operates on what amounts to a time delay. Behind this summer’s heat are greenhouse gases emitted decades ago. Before many effects of today’s emissions are felt, it will be time for the Summer Olympics of 2048. (Scientists refer to this as the “commitment to warming.”) What’s at stake is where things go from there. It is quite possible that by the end of the century we could, without even really trying, engineer the return of the sort of climate that hasn’t been seen on earth since the Eocene, some fifty million years ago.

Along with the heat and the drought and the super derecho, the country this summer is also enduring a Presidential campaign. So far, the words “climate change” have barely been uttered. This is not an oversight. Both President Obama and Mitt Romney have chosen to remain silent on the issue, presumably because they see it as just too big a bummer.

And so, while farmers wait for rain and this season’s corn crop withers on the stalk, the familiar disconnect continues. There’s no discussion of what could be done to avert the worst effects of climate change, even as the insanity of doing nothing becomes increasingly obvious.

Welcome to the 21st Century.

I want one of these

Some Japanese students have invented a gadget that stops people from talking:

The NoiseJammer works by recording the irritating voices of rude individuals and playing it back to them [a quarter-second] later, overriding their annoying conversations with a flood of their own words. If you want the technical details to build your own jammer, it's all described in this academic paper, which explains the reasoning behind such a device.

Here's a demonstration:

Fall is a long way off

As Chicago temperatures today and tomorrow will likely hit 35°C, I find myself looking forward to October. While temperatures will undoubtedly be lower then, we may not actually have a very interesting leaf season:

Deciduous trees (trees that lose their foliage in the winter) are sensitive to the increasing length of night during the autumn. When the hours of darkness reach a threshold value, fall colors begin to appear. The U.S. National Arboretum says, "Because the starting time of the whole process is dependent on night length, fall colors appear at about the same time each year in a given location, regardless whether temperatures are cooler or warmer than normal." However, drought stress during the growing season can cause leaves to fall before they have a chance to develop fall coloration, and that will be the likely effect of our drought: bland fall colors.

The one, single benefit related to all this heat and drought: we're having the third-sunniest July in history.

Chart of the Day

Via Krugman, Ezra Klein reminds us of the differences between the President's and Romney's tax plans:

Note that the Tax Policy Center could only conduct a partial analysis of Romney’s tax plan. That’s because Romney’s proposal itself is incomplete. He’s said that he wants to scrap various deductions in the tax code, particularly for high earners, in order to broaden the tax base. But he hasn’t offered any details about which deductions he’d scrap or how, so there wasn’t anything for the Tax Policy Center to analyze.

As Krugman says, "[T]he next time someone tut-tuts about 'class warfare,' remember that the class war is already happening, in real policy—with the top .01 percent on offense."