Monthly Archives: September 2012

Dual-boot Win8/Win7 Environment

My 256 Gb (nominal) Samsung SSD arrived yesterday. It didn’t take long to install. But it did take a while to get Windows 8 RTM and my development environment set up. In short, the culprit turned out to be USB 3.0 on my Gigabyte motherboard. Once it was disabled, everything worked fine.

Prior to the install, my current setup was Windows 7 running on a 500Gb RAID1. I was a little nervous about impacting this, since it’s my bread-and-butter workstation. But changing over to either AHCI or RAID/IDE had no adverse affects. The reason I needed to get Windows 8 running on bare metal instead of inside a VM was so I could use Hyper-V. Without it, the Windows Phone 8 emulator can’t run.

Booting up from my Windows 8 installer DVD went fine and installation was basically without problems. I was pleasantly surprised to see that one of my two monitors displayed the classic Desktop and the other the Start Screen. This is perfect for development. I dutifully installed Visual Studio 2012 and then the Windows Phone 8 SDK. After that, I enabled Hyper-V and was prompted to restart.

That’s when the machine hung on the loverly new Windows 8 logo. I did a hard restart and Windows 8 ran a diagnostic (quicker than any version of Windows ever has) and prompted me to revert to the last working version of the system. That got me back into Windows. However, I lost my installs of Visual Studio and the SDK. I got them started on re-installing.

Meanwhile, I did some research into the issue with Hyper-V and discovered that with certain Gigabyte motherboards (mine is the GA-P55-USB3) the USB 3.0 driver is the problem. I went into BIOS after enabling Hyper-V again and disabled USB 3.0. I really don’t need it and won’t miss it. After that, everything is working, including the Windows Phone 8 emulator. I’m going to need to boot into Windows 8 to develop for the Windows Store and Windows Phone 8 for a couple months. But that’s fine since I tend to set aside dedicated blocks of time for that. I expect in a couple months I’ll find some time to migrate my current Win7 system over to Windows 8 (after creating either a Ghost backup or a disk2vhd image).

Getting percentage graphics right

A friend forwarded me a link to an interactive on water (http://www.texastribune.org/library/data/cheap-water-in-texas/). It is one of the best I’ve seen. I really like the way you can click on a column and see the data resorted in the table and redrawn on the map. However, one thing caught my eye. When you click on the drought column, for example, the percentages represented by the circular areas are not proportional.

There is no way that the circle size representing 5% should be that large in relation the circle representing 83%. Here they are enlarged for clarity:

In order to see what the correct size for the smaller circle should be I first had to extrapolate from the larger circle to find out the area of a circle that would represent 100%. To do this, I calculated the area of the 83% circle. Then I multiplied that amount by 1.205 (1 / .83) to get the area of the larger circle. Dividing the area by pi, then getting the square root of the result yielded the radius of the 100% circle.

Multiplying the area of the 100% circle by .05 to get area of the 5% circle, I performed a similar calculation to get its radius as well. That allowed me to draw this graphic:

As you can see, the 5% area would be quite a bit smaller it done proportionally. One might argue that it doesn’t really matter, but try visualizing these same percentages in some other ways. For instance, on a linear graph:

You wouldn’t expect to see 5% to be shifted to the right on this line. Likewise, why would anyone expect to see it shifted in an areal graph? The principle is the same:

The second part of that example shows the data being taken back into a non-linear form. And that leads to another visual proof that is closer to the circular area. In this case, there are 400 grid squares approximating a circle. Twenty of those squares have been colored orange to represent 5%. The area in blue + orange is 328 squares or 82%, which is as close as I could come to 83% and maintain a roughly circular shape. If we went to 1600 squares the circles would be, well, more circular. But for purposes of this demonstration, this will do:

Now, compare it with the true circular areas juxtaposed over it and you can see why it’s important to get proportions right when using areas to depict percentages:

I’d be remiss if I didn’t include the math to calculate graphics like these. If you want to use circles to depict percentages, then:

  1. Calculate the area of the 100% circle, e.g. if the circle is 100px in diameter, then the area is 50^2 * pi or 7853.98
  2. Multiply the 100% area by the percentage desired, e.g. 7853.98 * .83 = 6518.8
  3. Divide this number by pi, then get its square root, e.g. SQRT(6518.8/pi) = 45.55, to get the radius
  4. Multiply times 2 to get the diameter, e.g. 91.1 pixels.

Computed, int, not null…what does that mean?

I didn’t even know this was possible, but noticed a column in Microsoft’s AdventureWorks sample DB Workorders table with the attributes of “Computed, int, not null” while other similar columns just had “int, not null”. A peek at the CREATE TABLE code:

CREATE TABLE [Production].[WorkOrder](

[WorkOrderID] [int] IDENTITY(1,1) NOT NULL,

[ProductID] [int] NOT NULL,

[OrderQty] [int] NOT NULL,

[StockedQty]  AS (isnull([OrderQty]-[ScrappedQty],(0))),

[ScrappedQty] [smallint] NOT NULL,

[StartDate] [datetime] NOT NULL,

[EndDate] [datetime] NULL,

[DueDate] [datetime] NOT NULL,

[ScrapReasonID] [smallint] NULL,

[ModifiedDate] [datetime] NOT NULL,

CONSTRAINT [PK_WorkOrder_WorkOrderID] PRIMARY KEY CLUSTERED

(

[WorkOrderID] ASC

)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]

) ON [PRIMARY]

GO

Some random notes on Adobe Edge, SSDs and Win8/Win Phone 8

http://arstechnica.com/information-technology/2012/09/adobes-continuing-revolution-pushes-the-cutting-edge-of-html5-development/

Does look interesting. I had a brief glance at the article this morning. But too busy going native…as in code. Isn’t it free for a bit? If so will pause long enough to snag a copy…to further clog my hard drive.

Speaking of drives, I’ve long run a dual 500 Gb setup, using RAID1. But I recently ran into a snag. As a published developer I was able to get the Windows Phone 8 SDK. Yet (understandably) the Windows Phone emulator – being a virtual machine – won’t run inside another VM, which is how I’ve been running Windows 8. I thought about getting a couple new drives. A look through Newegg’s selection showed that a 2 or even 3 Tb RAID array would only set me back $300. However, the main reason I was looking at those was speed. That’s when it occurred to me if this isn’t about capacity it’s time to bite the bullet and get an SSD. So a 256 Gb Samsung is on its way, which ran me $219.

My plan is to create a dual-boot system with Win8 on the SSD drive and leave my Win7 setup with all the apps and configuration info alone. One thing I’m going to try first though is cloning the current boot drive to see if I can run it inside a VM on Win 8. In theory, since Win8 on an SSD should boot up in 8-15 seconds, it would make sense. I have 16 Gb of RAM so no limitations there.