Calculating Dell Power Consumption for Servers

We are in the process of building out a new data center. One of the items I needed to know was a rough estimate of our new, monthly electrical bill. In some cases, you may need to show a return on investment (ROI) for going to a virtualized environment using VMWare or Microsoft Hyper-V. You can calculate the number of watts your devices use by visiting

If you need to calculate cost of power, you can convert watts to kilowatts (watts / 1000), then multiply that by 24 hours, 30 days, and the cost per kwh. So, if you live in an area that has a cost per kilowatt hour at 9.5 cents and your equipment uses 2500 watts, your total cost per month would be $171 per month.

Port your Android or iPhone apps to Windows Phone 7

Did you know that your current Android or iPhone apps can be ported to Windows Phone 7? Now, there’s no “easy” button that will automagically convert the apps for you. However, in a post on June 9th, 2011, the Windows Phone team explained how Android apps can be converted. Microsoft has provided an easy package for Android developers. The package includes:

In April, the team released an initial post explaining how iPhone apps can be ported to WP7. This package includes:

More information about converting existing apps to Windows Phone 7 can be found at

If you plan on converting an Android or iPhone app, be sure to respond to this and let me know how things are going.

Changing the Title in the Tile Icon of a Windows Phone 7 Application

If you’ve built a Windows Phone 7 application, you may have noticed that if you pin your application to the Start menu, the name of your application appears in the lower, left-hand side of the tile. You can change the text in this tile, by right-clicking on the application and going to properties. On the Application menu, modify the Tile title properties. A sample of this area is displayed below:


You’ll notice that the title text is blank in my screenshot. To accomplish this, you’ll need to perform a little magic. If you wipe this out in Visual Studio 2010, you’ll receive the error message stating “An empty string is not allowed for Title” like the following:


However, you can blank out this field my modifying the WMAppManifest.xml file located in your project’s properties folder. Modify the section of this file that is highlighted below:

<?xml version="1.0" encoding="utf-8"?>
<Deployment xmlns="" AppPlatformVersion="7.0">
      <PrimaryToken TokenID="BarefootToken" TaskName="_default">
          <BackgroundImageURI IsRelative="true" IsResource="false">Application_TileImage_173x173.png</BackgroundImageURI>

This will allow your title to be blank and also allow your tile to appear on your device without the title.

Using Web.config Transforms in ASP.NET

One of my team members was working on an issue today within an application. The application is setup to use web.config transformations. Web.config transforms are a great way to create multiple build configurations (including, but not limited to, the debug and release build configuration that are built-in) and allow different configuration settings based on the build. For instance, you may have a database connection set to your localhost when you are debugging locally. However, you can use web.config transforms to change the server name when you publish the application using the release build configuration. This can also be used to ensure that every time you publish an application as a release, debug and trace are disabled for your application.

Our application is setup so that we use transforms to set the connectionString attribute of each SQL connection in the configuration. We have multiple connection strings in this area.. We had multiple connection strings such as:

    <add name="DefaultSqlServer" connectionString="metadata=res://*/Data.Sql.SqlEntities.csdl|res://*/Data.Sql.SqlEntities.ssdl|res://*/Data.Sql.SqlEntities.msl;provider=System.Data.SqlClient;provider connection string=&quot;Data Source=localhost;Initial Catalog=Test;User ID=sa;Password=password;MultipleActiveResultSets=True&quot;" providerName="System.Data.EntityClient"/>
    <add name="DefaultProviderConnectionString" connectionString="Data Source=localhost;Initial Catalog=Test;User ID=sa;Password=password;" providerName="System.Data.SqlClient"/>

In other words, one connection is used for connecting to the SQL database using Entity Framework while the other is used to connect to the database using the built-in providers. When we published the application using the release build configuration, both connectionString values were set to the same. After digging around for some time we forgot a simple part of the transform.

When performing web.config transforms on a Key/Value dictionary pair in the web.config file, make sure that use also include an xdt:Locator attribute that contains the method Match. This allows you to pair up the specific value to a particular key.

So, your connection strings should resemble something like the following in your web.release.config file:

<add name="DefaultSqlServer" connectionString="..." xdt:Transform="SetAttributes(connectionString)" xdt:Locator="Match(name)" />

In my case, I’m replacing the DefaultSqlServer value with the value defined in the connectionString above. I can replace other attributes by separating the attribute names in the SetAttributes method with a comma.

For additional config transform options, be sure to visit the MSDN page at

Orchard CMS Command Line Exception

Late last week when I was at CodeStock 2011, I ran into an error with the orchard.exe command line utility. The exception generated looked similar to the following:

c:\inetpub\wwwroot\Orchard\Modules\Orchard.Packaging\Services\FileBaseProjectSystem.cs(33): error CS0246: The type or namespace name 'FrameworkName' could not be found (are you missing a using directive or an assembly reference?)

Exception Details: System.Web.HttpCompileException: c:\inetpub\wwwroot\Orchard\Modules\Orchard.Packaging\Services\FileBaseProjectSystem.cs(33): error CS0246: The type or namespace name 'FrameworkName' could not be found (are you missing a using directive or an assembly reference?)

After talking with individuals on the Orchard team, this appears to be an open item that they hope to solve for Orchard 1.2. If you run into this, please contact me directly by responding with a comment or messaging me on Twitter so I can pass on a potential resolution. I’m hoping that we can track whether or not the supposed solution does actually solve this issue.

Since, this is a random exception, we can use your help.

Disneyland Adventures due out November 15th

Earlier today at the E3 Expo, Microsoft unveiled several new features to Xbox Live, Kinect, and announced several new games including Halo 4, Kinect Sports Season Two, and Kinect Disneyland Adventures. Kinect Disneyland Adventures is pegged to be the first Kinect game including Disney characters. I stumbled across a screenshot that appears the game will be released on November 15th this year.


While additional specifics cannot be confirmed, this definitely looks to be in line for the holiday season.

The WeatherDotCom Widget for Orchard CMS

If you’ve checked out my new website recently, you may have noticed that I have included the weather on the site. Mouse over on the right-hand side and you’ll notice a “bing-like” box that will appear. I’ll talk about this a bit more in a bit, but you’ll notice that the weather pulls for my local zip code. These are the results from the Weather Channel’s

To take advantage of this service, you must first register on their website at During this process, you’ll be provided with a Partner ID and a License Key. Be sure to take note of these as you’ll need them at a later point.

Note: If you are not a programmer or web developer, you may want to skip past the next two sections and go to Adding the Widget to Orchard.

Weather Data from the Web Service

I wanted to take advantage of all of the data being returned from the Weather Channel’s current conditions web service. So, I converted the result into two strongly-typed class objects. The first class object is called LocationInfo and is defined as:

public class LocationInfo
    public string LocationName { get; set; }
    public string Latitude { get; set; }
    public string Longitude { get; set; }
    public string Sunrise { get; set; }
    public string Sunset { get; set; }
    public string TimeZone { get; set; }

The second class object is called CurrentConditions and is defined as:

public class CurrentConditions
    public string Temperature { get; set; }
    public string FeelsLike { get; set; }
    public string Description { get; set; }
    public string DescriptionIconNumber { get; set; }
    public string BarometricPressure { get; set; }
    public string BarometricPressureDirection { get; set; }
    public string WindSpeed { get; set; }
    public string WindDirection { get; set; }
    public string WindGust { get; set; }
    public string Humidity { get; set; }
    public string Visibility { get; set; }
    public string UvIndex { get; set; }
    public string UvDescription { get; set; }
    public string Dewpoint { get; set; }
    public string MoonIconNumber { get; set; }
    public string MoonType { get; set; }

In both of these instances, these are the properties that will be exposed to any custom views being rendered. I’ve included both of these class objects in another class object that is returned when the call is made to obtain the current weather. This class object is called Weather and is defined as:

public class Weather
    public LocationInfo LocationInfo { get; set; }
    public CurrentConditions CurrentConditions { get; set; }
    public DateTime TimeCached { get; set; }
    public String ApiStatus { get; set; }

Customizing the Weather View

In my particular instance, I wanted to be able to cache the weather every 15 minutes. I also wanted to show a current weather image in the background and hide the text details for the weather. Then, I would show the text details in a div. To get this to work, I decided to add some custom JavaScript.

The first step in this task was to randomly generate where my first “bing-like” box would appear hinting that a mouseover was needed. To do this, I randomly calculated the location from the top and left and subtracted the size of the details box. This helped me to better place the boxes while staying within the background image location.

$(document).ready(function () {
    /* Randomize Divs */
    var ranHeight = Math.ceil(Math.random() * 115) + 5; /* Always 85 less than height */
    var ranIndent = Math.ceil(Math.random() * 120) + 5; /* Always 180 less than height */

    /* Get the Divs */
    var spot = $('#weatherSpot');
    var details = $('#weatherDetails');

    /* Add the new positions */
    spot.css("top", ranHeight + "px");
    details.css("top", ranHeight + "px");
    spot.css("right", ranIndent + 155 + "px");
    details.css("right", ranIndent + "px");

The next step in the process was to use jQuery to fade in and out the boxes.

$('#weatherBlock').mouseenter(function () {
    $('#weatherSpot').fadeIn('slow', function () {
        // Nothing happens when animation completes
}).mouseleave(function () {
    $('#weatherSpot').fadeOut('slow', function () {
        // Nothing happens when animation completes

$('#weatherSpot').mouseenter(function () {
    $('#weatherDetails').fadeIn('slow', function () {
        // Nothing happens when animation completes
}).mouseleave(function () {
    $('#weatherDetails').fadeOut('slow', function () {
        // Nothing happens when animation completes

Finally, I needed to layout my view. Since it’s a custom view, I had complete control over the rendering and decision of the data. I choose to use many of the default fields.

@using System.Web.Hosting
    var imgPath = "~/Themes/MyTheme/Content/weathericons/";
    var weathericon = "";

    weathericon = Url.Content(imgPath + Model.WeatherResults.CurrentConditions.DescriptionIconNumber + ".png");

<div id="weatherBlock" class="weatherBlock" style="background: url('@weathericon') no-repeat;">
    <div id="weatherSpot" class="weatherSpot">
    <div id="weatherDetails" class="weatherDetails">
        <span class="weatherTemp">@Model.WeatherResults.CurrentConditions.Temperature&deg;F</span><br />
        @Model.WeatherResults.CurrentConditions.Description<br />
        Feels Like: @Model.WeatherResults.CurrentConditions.FeelsLike&deg;<br />
        Wind: From @Model.WeatherResults.CurrentConditions.WindDirection at @Model.WeatherResults.CurrentConditions.WindSpeed mph

I created custom weather icons for each of the potential weather patterns. The Weather Channel includes default images with your connection to their service.

You may customize the widget as I have shown above or use the default view which is provided.

Adding the Widget to Orchard

To install the widget, you can log into your Orchard CMS version 1.1 dashboard and go to Modules (If you are running Orchard version 1.0, I’d strongly urge you to upgrade your instance as this instance is much more stable and more user friendly). In the Modules section, choose Gallery and type in Weather in the search box. Choose the WeatherDotCom widget and click Install. After its finished installing, you’ll be prompted to enable this feature.

If you’d like to install the widget offline, you can download it directly from the Orchard Gallery website.

Once it’s enabled, it’s now a new part that can be added to a page, a blog post, or as a widget. In most cases, you’ll want to add it as a widget. To add it as a Widget, choose Widgets in the dashboard. In the appropriate zone click the Add button. I’d recommend using it in AsideFirst, AsideSecond, or one of the zones found AfterMain. On the next screen, choose Web Part Record.

When it’s added, you’ll have a property window screen that allows you to specify the properties for the widget. The screen looks like the following:



The source code and the widget can be downloaded by using the links below. If you find any bugs or have any suggestions, be sure to enter them on the CodePlex site, not the Orchard Gallery website, by using the Issue page or Discussion page respectively.

Module Package for Orchard CMS

Full Source Code

Grow Your Website using Orchard

I’m just wrapping up a trip to Eastern Tennessee’s CodeStock 2011 (in Knoxville to be precise). While I was down here, I presented on the Orchard CMS. Both the conference and talk were great and while I’m never really satisfied with any of my talks, I have recorded it. It will soon be available on the CodeStock website for all to view at a later date and time. However, I know that Michael Neel is quite busy and it may take him another day (or week) to get everything up there. So, I’ve jumped the gun and published it up myself. Be sure to check it out:

Grow Your Website Using Orchard from Jason Gaylord on Vimeo.

By now you probably have heard of a new content management system called Orchard. You may already have a CMS, but this one that’s been released by The Outercurve Foundation is different. We’ll discuss some of the features and benefits to using Orchard. We’ll also see some tips and tricks. By the end of this session, you’ll not only have an understanding of how to use Orchard, but will have a fully functional website as an added bonus.