Setting up my new Dev Rig and solving the DPC_WATCHDOG_VIOLATION error

Last month I finally setup my new dev-rig. Yes, I still prefer desktops for development (call me old school)! The configuration is as follows:

  1. Processor: Intel Core i5 4570
  2. Motherboard: Gigabyte H87-HD3
  3. RAM: Crucial Ballistix Tactical (8GBx2) 16GB @1600MHz  
  4. Power Supply: Corsair CX500
  5. Case: Aerocool GT Advance Mid Tower Interior USB3 12cm Red LED Fan Screwless – Black
  6. SSD: Kingston 240GB V300 (Recycled from my MBP)

Here’s the Amazon (co.uk) Wishlist with all the items – My Haswell Build

2014-04-12T21-54-17_0

Putting it together

Having assembled quite a few machines in my past, this was my first LGA processor. So after a few videos on YouTube on how to put one in, I had the confidence to do it. The processor installation went without hiccup. The Heat Sink and Fan gave a few anxious moments with the amount of pressure required to bolt all the four corners down, but I did it without damaging anything.

Rest was reasonably easy. When installing RAM (if installing 2 sticks) follow the color coding on the slots and check your M/B instruction manual to confirm which set you should use first. If you are putting in 4 sticks, hopefully they are all evenly matched so color coding doesn’t matter.

Key to getting a nicely matched Case was evident when I was able to use the USB3 header on the M/B for plugging in the USB3 port in the front.

The front panel Audio headers work, but sound from the built in Sound Card is pathetic. I can hear the hissing of the fan, whining of the PSU and even moving the (wireless mouse) results in funny squeaking sounds. I use my Blue Yeti (microphone) as an external soundcard, it has very neutral sound and I can use headphones without the annoyances of the internal soundcard.

This case has two fans built in, both come with 3 pin cables that you can plug on to the motherboard, allowing finer control of Fan speed from OS/Additional Software.

The Power Supply goes at the bottom of this case. One suggestion, before putting in the power supply, put the SSD in. Once the P/S is in, there are way too many cables to get out of the way, unless you are using a fully modular P/S, in which case sequence doesn’t matter). The SSD sits just above the 3.5” bays (there place to put only one SSD. For more than one, you’ll need a 3.5” to 2.5” converter). The case comes with a pamphlet that suggests you bolt it to the grill (above the 3.5” bays), but if you do so, it’s difficult (if not impossible) to plug in the SATA and power cables.

This case doesn’t have a power or ‘HDD’ light header, it does have a molex connector for the Red LEDs  that serve as the ‘power’ lights. Plug it into any of the molex power connectors from the P/S.

Given that we don’t have HDDs any more, the ‘HDD’ light doesn’t really make much sense.

The 5.25” drive bay covers can be pinched out, but don’t press too hard, you’ll snap something. I snapped a hook and had to superglue it back.

BIOS Defaults

The default BIOS settings are by default pretty good. Just make sure you set the Disk Controller to AHCI (don’t remember what the default was). This is important from getting the best out of your SSD and you can’t change it after OS is installed.

I also turned on the XMP memory profile, this makes full use of the 1600MHz Memory Bandwidth, else your RAM will run at 1333MHz.

The CX500 and Haswell

After I purchased the CX500 I found various articles saying the CX500 was still not Haswell Compliant. Haswell processors have a special power save mode that draws even less power than the ATX standards. I thinks it’s called S7 or something. This results in system not coming out of Power Save mode. However, I have not encountered any issues with the P/S. I put my machine to Sleep overnight regularly and it comes back without fail. So newer versions of CX500 should be fine. There is an ‘official’ CX500 V2 also but mine doesn’t say V2. Either ways, it works fine for me. I’ll update on longevity later.

Windows Phone 8 SDK Installation and DPC_WATCHDOG_VIOLATION

I installed Windows 8 on it first and then upgraded to 8.1 (complete overwrite). After running updates repeatedly, till all updates were in place, I installed Windows Phone 8 SDK. As soon as it re-booted, I got a BSOD saying DPC_WATCHDOG_VIOLATION. I ignored it initially and updated the latest Visual Studio 2012 service pack (without which WP emulator doesn’t work on Windows 8.1). After that the WP Emulator worked but every reboot would result in a watchdog violation. This upset me terribly. No amount of Driver install from the Driver disk/Manufacturer’s site etc. helped. Ultimately uninstalling Hyper V (and effectively killing any chance of WP development) I was able to ‘fix’ the reboot issue.

After a lot of Ducking around and posting on Eight Forums, I did a Windows 8.1 Reset. However, after reset as soon as I installed WP 8 SDK, the BSOD returned. This time I installed Gigabyte’s APP Center app from the CD that accompanies the Motherboard. Using the APP Center, I updated all the drivers and then updated the BIOS. The motherboard came with V5, I updated it to V6 (latest available). The APP Center is really cool way to update BIOS updates. Just point to the one of the servers offered, wait for download to complete and hit OK. Thanks to the dual BIOS scheme, the App can flash the BIOS on the fly. Once done, it reboots.

After the reboot the DPC_WATCHDOG_VIOLATION was resolved. Phew!

Side Note

If you have a Office 365 for Business account, don’t setup Mail or pay very close attention to the warning that Mail gives about changing security settings. Once the security settings are applied I lost Admin rights. I couldn’t install SQL Express/Create new User Account and in general had permission issues all around. This is why I actually did the reset. I haven’t reapplied the security settings. Not sure if this is the root cause, but for now I don’t have the permissions I had earlier, so I intend to keep things that way.

SSD Performance

I had high hopes from my Kingston V300, but was surprised to see it’s result compared to my V200 back in India.

as-ssd-bench KINGSTON SV300S3 3.22.2014 5-22-56 PM

As you can see the V300 outpaces the V200 overall but 4K read/write speed is actually lower than the V200. Wonder why! Maybe last six months playing second fiddle in my MBP took it’s toll.

Conclusion

I built this rig on a tight budget, but it’s a decent performing setup thanks to the ample RAM and SSD. Honestly, once you go SSD you just can’t go back to an HDD. Maybe I’ll add a Crossfire someday to it (unlikely), but it is likely to get more RAM and bigger SSDs in the future.

Tagged , ,

Installing and Configuring Service Bus for Windows Server (on Windows 8.1 + VS2013)

I was goofing around with the idea of Messaging Queue technologies on MS platform when I came across Service Bus for Windows Server. It’s an on-premise version of the Azure Service Bus. It has been around officially since October 2012 (coinciding with Office 365 launch). Basically SharePoint/O365 needed a Service Bus functionality so Microsoft extracted the Azure Service Bus implementation and made it available as a runtime on Windows 8 Servers.

Message Bus for Windows Server follows a yearly release cadence where features released for Azure Service Bus in the last 12 months are released coinciding with Windows Server releases.

Since Azure Service Bus is a very fast evolving platform, I found documentation on Service Bus for Windows Server (I’ll just refer it to as SBWS going forth), either dated or difficult to find. So I decided to record my steps of installation and building a small sample. Here goes:

Installation

Obviously there are two parts to installing any ‘server’ API, the ‘Server’ and the ‘Client’. Fortunately you don’t need a ‘Server’ to play with Service Bus on your machine. All you need is a Windows or Windows 8.1 system to install both Server and Client and play around. The only other pre-requisite is to have SQL Express and we can get started.

Server Installation

1. I usually avoid Web Platform Installer over unpredictable internet, but it seems to be the best way to get started with SBWS. So install the latest Web PI (v4.6 at the time of writing) from here http://www.microsoft.com/web/downloads/platform.aspx (or cinst webpi if you use Chocolatey)

2. Go to Products, Select Azure, then Add and Install “Windows Azure Pack: Service Bus 1.1”

image

3. This is the prerequisites list I got, your mileage may vary. Accept the license and let the installation proceed.

image

4. You should end up with a Success screen highlighting the components installed.

image

Configuring Service Bus

Web PI installs two items:

a. Service Bus Configuration and

b. Service Bus PowerShell

image

1. Start off with the Service Bus Configuration. Select “Create a New Farm” –> “Using  Default Settings”.

image

2. The New Farm Configuration window is used for providing the following information

a. SQL Server Instance: I’ve set it up to use Windows Authentication (to change, click on Advanced Options)

image

b. Configure Service Account: This is usually an Admin account (on the machine or domain). If you don’t have a domain controller you can use your Windows Account. If you are using an Outlook/MS Live account, only the name will be shown, don’t try to add @outlook.com to the ‘User ID’. Keep the ‘User ID’ and provide the password that you use to log in to windows/Outlook.

c. Certification Generation Key: This key is used as the seed to generate a Certificate. Save the value you enter it, it so that you can add nodes to the farm later. Check the ‘Enable firewall rules on this computer’ so that the firewall rules are setup automatically.

image

d. Configure Service Bus Namespace: The service bus namespace is used for identifying the bus and connecting to it. Provide an appropriate string. I’ve stuck to the default below.

e. Service Bus Management Portal: This section is relevant if you want to manage the service bus setup via a Azure Management like portal that can be installed on premises as well. We’ll cover the portal in a different article. For now provide a user name/password pair for Administrator and Tenant User. These are forms authentication settings so save these details for use later.

image

Once done, click on the ‘Next’ button (the right arrow button). It will show a progress bar until it’s done. At this point it will show a summary. At the bottom there are two links, Copy and Get PowerShell Commands. You can extract the PowerShell Commands and save them for later if you want to re-setup the system.

image

Click on the Complete button, this actually executes the Power Shell commands that were generated.

image

This completes the Service Bus setup. You can open the Service Bus PowerShell and review the status of the farm using the Get-SBFarmStatus command. It should return something like the following

image

With that we have successfully setup SBWS. In the next post we’ll see how we can use the service bus.

Tagged , , ,

QuickBytes: ASP.NET InProc Session and Multiple Workers (don’t go well together)

Last week I hit an unusual roadblock while testing an ASP.NET MVC application. The application started behaving unpredictably and session state went haywire (returned null, flipped values etc. etc.).

Since it was happening after deployment, it was a bit of a bother to debug, but I realized it was a configuration issue more than anything else. So while digging through the web.config I discovered state management was set to InProc. This of course implies your session is alive as long as AppPool is alive and as soon as it is recycled your session is gone.

Still unable to see what’s wrong with InProc and what was possibly recycling the app pool, I decided to redeploy the same application in a new website on the same machine using a new Application Pool. Voila! Everything started working. Couldn’t repro the state corruption (state variables were going null) issue anymore.

Next we assigned the new site the existing AppPool (that was being used by the site where things were getting corrupted). The issues came back. This narrowed it down to AppPool settings issue. After a side by side comparison of the settings, we found that the Number of Workers was 5 for the site where things were goofing up, while the new deployment’s AppPool has the value set to 1. That’s when we struck gold.

At this point a quick search revealed how Number of Workers work and it was amply clear why things were going south.

Multiple Workers, Web Garden and InProc State management

Number of Workers > 1 basically creates a ‘Web Garden’ scenario on your server where there are multiple worker processes handling requests for your site. Each worker process is essentially an instance of the same executable with independent static references and also obviously, independent state management (when state management is InProc). As a result of this two requests to the same server may or may not be served by the same worker process. Since state is not shared between the worker processes you are going to get unpredictable behavior when the second request goes to a different worker as compared to the first request.

This is actually correct behavior because Web Garden setup of a Web Server implies that you are managing state out of process via a reliable backing store like SQL Server. So if you don’t have an out of Proc state manager, don’t use more than one Worker Processes in your App Pool. Alternatively if you want multiple worker processes (better scaling) you have to use out of process state management.

Reference

http://stackoverflow.com/a/14105747/710962

Tagged , , ,

QuickBytes: Decimal to Indian Numeric formatting

image

Recently I came across the need to format Decimal as Currency, but force it down to Indian/Vedic/South Asian numeric formatting (thousands, lacs, crores etc.) instead of the standard Arabic/Metric system (thousands, hundred thousands, million, billion etc.).

The answer was easily found in this StackOverflow thread. The code snippet is reproduced here:

string fare = “123000.0000″;
decimal parsed = decimal.Parse(fare,
CultureInfo.InvariantCulture);
CultureInfo hindi = new CultureInfo(“hi-IN”);
string text = string.Format(hindi, “{0:c}”, parsed);

The above code gives us the following string

₹ 1,23,000.00

However, the next requirement was to keep the decimals and formatting but remove the Currency symbol. Another quick search gave us this little gem from Jon Skeet on StackOverflow. Essentially he extracted the NumberFormatInfo from the CultureInfo and reset the Currency Symbol to an empty string. Then use the NumberFormatInfo instance to format the decimal value. So the above code can be modified as follows:

string fare = “123000.0000″;
decimal parsed = decimal.Parse(fare,
    CultureInfo.InvariantCulture);
CultureInfo hindi = new CultureInfo(“hi-IN”);
NumberFormatInfo hindiNFO =
    (NumberFormatInfo)hindi.NumberFormat.Clone();
hindiNFO.CurrencySymbol = string.Empty;

string text = string.Format(hindiNFO, “{0:c}”, parsed);

This gives us the following string. It’s difficult to see here but there is a leading space that you might want to trim if you need to.

1,23,000.00

A Sample Application

I thought it would be a fun project to write some code that gives you the above code for any Culture Code you want, so I setup a basic ASP.NET project and deployed it for free on the AzureWebsites. You can see it in action here – Currency Formatter on Azure WebSites

  • I spun up Visual Studio 2013 and setup a default MVC project.
  • Next I updated KnockoutJS to the latest version

PM> update-package KnockoutJS

  • Added an Entity to encapsulate the culture information. I referred to this list on MSDN as my source.

public class IsoCultureInfo
{
    public int Id { get; set; }
    public string LanguageCultureName { get; set; }
    public string DisplayName { get; set; }
    public string CultureCode { get; set; }
    public string ISO639xValue { get; set; }
}

  • Scaffolded up an EntityFramwork controller: CultureInfoController
  • Added two methods to the CultureInfoController that return JsonResults
  • The first one simply returns the entire list of IsoCultureInfo objects in the DB

public JsonResult List()
{
    return Json(db.IsoCultureInfoes.ToList(), JsonRequestBehavior.AllowGet);
}

  • The second one formats the predefined text based on the incoming Culture Name and returns the formatted text as a JSON object.

public JsonResult FormattedText(string id)
{
     try
     {
         string fare = "123000.0000";
         decimal parsed = decimal.Parse(fare, CultureInfo.InvariantCulture);
         CultureInfo cultureInfo = new CultureInfo(id);
         NumberFormatInfo cultureNFO = (NumberFormatInfo)
cultureInfo.NumberFormat.Clone();
         //cultureNFO.CurrencySymbol = string.Empty;
         string text = string.Format(cultureNFO, "{0:c}", parsed);
         return Json(new { formattedCurrency = text });
      }
      catch (Exception ex)
      {
          return Json(new { formattedCurrency = "N/A" });
      }
}

  • Both these methods are invoked from the Index HTML. The UI is databound to a Knockout ViewModel. This is defined in the script formatCurrency.js

/// <reference path="_references.js" />

var isoCultureInfo = {
    LanguageCultureName : ko.observable(“”)
};

var viewModel = {
    dataList: ko.observableArray([]),
    formattedString: ko.observable(“Test”),
    selectedCulture: ko.observable(isoCultureInfo)
};

$(document).ready(function () {
    $.ajax(“/CultureInfo/List”,
        {
            type: “GET”,
            contentType: “text/json”
        }).done(function (data) {
            viewModel.dataList = ko.mapping.fromJS(data);
            ko.applyBindings(viewModel);

            viewModel.selectedCulture.subscribe(function(newValue){
                if (newValue.LanguageCultureName() != ”) {
                    var data = { “id”: newValue.LanguageCultureName() };
                    $.ajax(“/CultureInfo/FormattedText”,
                        {
                            type: “POST”,
                            contentType: “application/json”,
                            data: JSON.stringify(data)
                        }).done(function (data) {
                            viewModel.formattedString(data.formattedCurrency);
                        }).error(function (args) {
                            alert(“”);
                        });;
                };
            });
        }).error(function () {

        });
});

  • Finally I updated the Index.cshtml of the Home Controller to show the dropdown with the list of culture info.

        Select Culture: <select id="cultureOptions"
                                class="form-control"
                                data-bind="options: dataList(), optionsText: 'LanguageCultureName', value: selectedCulture, optionsCaption: 'Choose...'"></select>

  • Added a <ul> to show all the property values of the selected Culture

<ul>
    <li>Language Culture Name: <b><span data-bind="text: LanguageCultureName"></span></b></li>
    <li>Display Name: <b><span data-bind="text: DisplayName"></span></b></li>
    <li>Culture Code: <b><span data-bind="text: CultureCode"></span></b></li>
    <li>ISO 639x Value: <b><span data-bind="text: ISO639xValue"></span></b></li>
</ul>

  • Next we have a <pre> section which contains the code that changes as per the selected Culture.

<pre>
string fare = “123000.0000″;
decimal parsed = decimal.Parse(fare, CultureInfo.InvariantCulture);
CultureInfo cultureInfo = new CultureInfo(<b><span id=”currentCulture” data-bind=”text: LanguageCultureName”></span></b>);
NumberFormatInfo cultureNFO = (NumberFormatInfo)cultureInfo.NumberFormat.Clone();
// If you don’t want the CurrencySymbol, uncomment the following line
// cultureNFO.CurrencySymbol = string.Empty;
string text = string.Format(cultureNFO, “{0:c}”, parsed);
</pre>

  • Finally we have a span to show the formatted string returned after we have selected the Culture Info

Formatted String: <b><span data-bind="text: $parent.formattedString"></span></b>


Conclusion

The code snippet changes as you select the Culture Info in the dropdown and you can copy paste it directly. I deployed it on a free Azure Website, how? That’s for another day Smile.

Tagged , ,

Nokia X: The illegitimate lovechild of AOSP and MS Services

So Nokia finally released the Nokia X series of Android phones, and at MWC no less. First up I have to own up that Ben Thompson was right about Nokia’s Android intentions, and I was wrong. Though I still believe the deal does make sense from MS’ perspective. Without Lumia brand WP is dead in the water. Whether MS should abandon Windows Phone is different topic (and if you must ask, I would say NO).

After my initial indignation was over I have come to conclusion that X is pretty much the lever that Nokia used to sell its Windows Phone business to Microsoft. If we trace the timeline of when Nokia may have started working on X (Android Jellybean code base), we’ll see that having jumped off the burning platform Nokia found itself entangled in the Windows Phone parachute and the rescue boats (WP updates) were taking way too long to come by for it to stay afloat. It thus started project X as a life boat (I speculate it was a code name to start with, fact that it is still called the same shows the bastardized nature of the project, they didn’t bother with a marketing name) till the end. But building a lifeboat when you are in water already seems rather stupid and yet we have Nokia X series now 😐.

Android Open Source Project (AOSP) is the publicly available kernel + services that form the core of Android OS. This is free and Nokia X builds on top of it. Most Android devices however bundle GMS or Google Mobile Services that device manufacturers have to pay to use and get permission from Google. You can read up why GMS is the heart of Android ecosystem in Peter Bright’s write up at ARS Technica.

Why launch it after it has served its purpose?

This was the question that made me most angry. I am fine with the lever, everyone does it (Motorola had threatened to sue other Android OEMs on patent issues before Google bought it for a whopping load of money). Only a few reasons come to mind so my rant begins here:

A desperate stab at leveraging the success of Android

Given that they had spent considerable effort with the phone before MS began acquisition negotiations, Nokia was desperate to achieve success on its own in a vain attempt to prove (to itself?) that it still had the chops for runaway hits. This seems a little childish and vain to me and launching it at MWC seems a little over the top, there has to be a better reason. But then, spare a thought for the team working on the project. For them release is a kind of closure. As a dev I certainly understand that.

Also the Symbian based Pureview launch happened after the WP deal was struck, probably because the project was initiated earlier and had to reach a closure. Though I see the point of the hardware (41MP camera) release and its subsequent adoption into 1020, but I see no such path for project X.

Kick Microsoft in the balls to get ‘Engineering brownie points’ post-merger

Microsoft has dug itself into a hole with the separate paths for Windows RT and Windows Phone 8. While it is still plugging away at Windows Phone 8.1, Nokia took project X to completion to show off its engineering prowess that might come in handy post-merger when there will be two system engineering teams who between them have developed at least a dozen OSes. That would explain the old Android code base, as in, once the project was released, it would have served its purpose. But the confidence of building a complete ecosystem experience would have stayed on.

Clean slate reboot and future ambitions

Nokia may not have the Asha and Lumia names post-merger, but remember Vertu, high end Nokia phones that went Android? Project X could be easily re-released as a new line sans Nokia/Lumia/Asha brand name. This would add to reasons for the high profile launch which could be leveraged later. The X+ and XL models hint at these ambitions.

Whatever their reason it was a tacit acknowledgement of a few telling things:

  1. MS’ Windows Phone adventure is horribly off track.
  2. MS’ WP ecosystem is ‘different’ enough to put it in ‘good to have’ category and not consider it for launch of a new Application/Service/Startup. In other words, might as well have Android sans Google Mobile Services so that one can coax devs into recompiling (against MS services), instead of hoping that dev will eventually build a WP version. Can’t fault Nokia for feeling that way, given the hard time Instagram gave it before launching a half assed WP version of their app.
  3. MS’ WP developer ecosystem is not growing as expected. This is tied to number 2 above. WP is a third choice at best for app developers. The dedicated hoard of WP dev are jaded from the WP7 to WP8 experience where they had to nearly do everything from scratch. There is a healthy dose of skepticism around what WP 8.1 will bring amongst outsiders like me. However 8.1 technically is MS’ third major WP release and MS is ‘famous’ for getting it right the third time (at a minimum). So there are high hopes.

Microsoft supported outside attempt to gain quick traction in name of Android

This is the scariest of all thoughts. If this was paid for by MS then it shows a serious lack of commitment or confusion or both on MS’ part with respect to their own WP platform. If that happens to be the case, MS is in way bigger trouble than it cares to think about and will definitely face Dev community revolt when this happens. I am scared to think or write about it anymore.

It is not meant to be a vehicle for MS services.

Unlike what’s claimed by many, project X isn’t meant to bring hordes of users to Microsoft services. Given that Lumia low end platform performs better than X based devices, why would anyone buy this Frankenstein device? Why not just buy into MS ecosystem directly? People who buy Android make a conscious choice most of the time. Ignore the knowledge and ability of your customers at your own peril. A dual SIM option doesn’t automatically open doors for a half assed device experience. If anything, Android’s association with Google is well known enough and not having Google will be a constant source of negative word-of-the mouth publicity.

The services part was probably the last piece that Nokia attempted and MS services served two purposes,

  1. Placate MS, who I am sure is hopping mad at the release inspite of putting forth a brave face at the moment
  2. MS services provide a near perfect feature replacement for Google services and were easy to integrate rather than build from scratch.

Future of Windows Phone?

Initially I felt this marked the beginning of the end for Windows phone OS. If MS keeps this project alive this will be true. However, I now see WP moving to a respectable third position by solidly replacing BlackBerry. In other words WP is set to become the Linux of the desktop world. Meaning that it will be a solid, dependable platform restricted to a niche user base of enthusiasts and business users most of whom carry two phones, the other one being an Android or iPhone.

Android meanwhile is equivalent to Windows of the desktop world. It has reached a level of ubiquity in terms of a mobile platform. However, the name itself is supposed to sell the device is a rather naïve thought process given that there is going to be a boatload of competition offering the ‘real’ Android as opposed to AOSP based device. So end users when faced with the choice are likely to opt for the ‘real’ thing. (Treating your users as a bunch of n00bs is a bad idea). Microsoft has every reason to kill project X post-merger, and I hope it does and at the same time I hope it also addresses the concerns that led to project X in the first place.

Follow

Get every new post delivered to your Inbox.

Join 1,038 other followers

%d bloggers like this: