Sunday, June 27, 2010

Ultimate Windows Mac - Part 2

This is Part 2 in a series on configure a MacBook for Windows power users.

When I left off in Part 1 I was debating on which SSD to use. I decided on a OCZ Vertex 2 after reading about some issues the RealSSD's were having. I also purchased an MCE ObtiBay. So let's get to installing these parts. UPDATE: I'm having issues getting full performance from the Vertex 2 using Windows (seems to be limited to SATA I speeds). You may be better offer getting a lower ended SSD if your hardware/software combo is the bottle neck. More info will come as I work my way through the issue.

I'm not going to go into great detail on installing the hardware since others have already done it way better then I could. I left the OEM drive where it is and just installed the new SSD using the ObtiBay. The instructions from MCE where excellent. If you still need help with installation Other World Computing is a great resource.

Now that the drive is installed it's time to install Windows. I'll be installing Windows 7 Enterprise N 64bit edition. Since I'm not installing Windows to the same hard drive as OS X, I didn't run Boot Camp to prepare the drive. Instead I just booted from the Windows 7 DVD and installed Windows to the second hard drive (in my case the SSD one since I'll primarily being using Windows). Be careful which drive you install to. If you're paranoid then remove the OEM disk with OS X installed on it before beginning the Windows install.

Once Windows is installed you need to install the Boot Camp software. Put in your OS X installation disc and run setup. If you get the following error "Boot Camp x64 is unsupported on this computer model" which may happen if you use a retail disk of OS X, open a Command Prompt in Windows as Administrator and type the following:
cd /d D:
cd "Boot Camp\Drivers\Apple"

Run through the installer and most if not all your MacBook hardware should have the correct drivers installed. In my case the Light Sensor gives me a "This device cannot start" error but considering I'll have my laptop hooked up to an external monitor and keyboard 90% of the time I didn't bother fixing it. I'll make an update if I ever spend time looking for a solution.

The next step I do is to configure the keyboard so it's uses a PC style keyboard layout. There are a couple solutions but Sharp Keys is my favorite.

Map the keys as follows. Older MacBooks have an "Enter" to the left of the directional errors. New MacBooks have a "Right Alt/Option" key. The screen shot and direction handle both versions.
Num: Enter (E0_1C)             = Special: Right Ctrl (E0_1D
Special: Left Alt (00_38)      = Special: Left Windows (E0_5B)
Special: Left Windows (E0_5B)  = Special: Left Alt (00_38)
Special: Right Alt (E0_38)     = Special: Right Ctrl (E0_1D)
Special: Right Windows (E0_5C) = Special: Right Alt (E0_38)

This works great if you don't plan to use an external PC style keyboard. I use a Microsoft Natural Ergonic Keyboard 4000 at home and at work. These key mappings will cause the external keyboard to work different so I need to be able to toggle back and forth. Unfortunately Windows needs to be restarted (or at least logged off) for keyboard mapping changes to take effect. The best solution I came up with is to script this. Our custom keyboard mapping is stored in the registry so I've created two registry export files and 2 batch files to either Enable or Disable the custom mapping. As soon as I log into Windows I run the batch file I need and it will immediately log me off and then I'll log back in and the keyboard will be in the configuration I need. I also add 3 registry settings for the mouse. I like the MacBook Pro's trackpad to be "slower" then my external mouse and I also find scrolling 1 line at a time is better with the trackpad versus 3 lines for the external mouse.

You can create the 6 files you need as follows or download them from here.

MacKeyboard-Enable.reg :
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout]
"Scancode Map"=hex:00,00,00,00,00,00,00,00,06,00,00,00,1d,e0,1c,e0,5b,e0,38,00,\

MacKeyboard-Disable.reg :
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout]
"Scancode Map"=-

MacMouse-Enable.reg :
Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Control Panel\Desktop]

[HKEY_CURRENT_USER\Control Panel\Mouse]

MacMouse-Disable.reg :
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Control Panel\Desktop]

[HKEY_CURRENT_USER\Control Panel\Mouse]

~MacHardware-Enable.bat (I use the tilde to force the file to the top in the list)
REGEDIT.EXE  /S  "MacKeyboard-Enable.reg"
REGEDIT.EXE  /S  "MacMouse-Enable.reg"
shutdown -l

REGEDIT.EXE  /S  "MacKeyboard-Disable.reg"
REGEDIT.EXE  /S  "MacMouse-Disable.reg"
shutdown -l

The next part is specific to my dual hard drive configuration and it's your call if you want to do it. Since I didn't buy a monster sized SSD I want to store any data that is large and relatively static on the regular hard drive we're running OS X off of. The first step is to boot into OS X and use BootCamp assistant to partition your hard drive. Of the 320GB on the hard drive my MacBook came with I gave OS X 60GB and I'll use the other 260GB as a "data" partition. After partitioning with BootCamp choose to "not install windows" at this time and then boot back into Windows to format the drive using NTFS. The drive should now be available as drive D: (drive letter may vary but I'll assume it's D for the rest of this article). You could choose to move the entire "User" folder to the new drive. Since this would include various application temp and setting folders that may be altered often and may benefit from being on an SSD I opted to just move the individual "Documents", "Downloads", "Music", "Pictures", and "Videos" folders.

You could do it the "easy way" built into Windows 7 but I chose a more transparent way since some Windows programs don't seem to default to the correct folder when using the "easy way". I'm going to use the command line program MKLINK to create a "symlink" similar to what Unix has had for ever.

First I create individual "Documents", "Downloads", "Music", "Pictures", and "Videos" folders on the D drive. If you have a lot of data already in these folders on the C drive then use this guide to move the data. My folders are still pretty much empty so I just deleted the folders on the C drive and then opened a command prompt and typed the following from your User Profile directory (ex. C:\Users\CDEUTSCH):
MKLINK /J Downloads D:\Downloads
MKLINK /J Documents D:\Documents
MKLINK /J Music D:\Music
MKLINK /J Pictures D:\Pictures
MKLINK /J Videos D:\Videos

Another optional step is to purchase and install MacDrive if you want the ability to write to the partition with OS X on it.

On my first MacBook Pro I tired to "share iTunes" between OS X and Windows. I stored the files in the default Music folder in OS X, then used MacDrive on Windows to read and write to this location. You can have iTunes open an alternative iTunes library by holding the "Shift" key while opening iTunes. This worked Ok, except iTunes always update the file paths every time you switched from Windows to OS X. This process took way too long sometimes, so after Windows 7 came out I moved iTunes to my Windows partition and now only use iTunes under Windows. I currently mostly use OS X for MonoTouch iPhone development and for casual web browsing. If you're into hooking up your laptop to your TV I highly recommend Boxee, Remote Buddy, and Hulu Desktop (I use a dedicated MacMini for this instead of my laptop). Another thing OS X is great at is backing up your Windows partition. Winclone is excellent but I believe it only works for GPT formated drives. So unless you're running Windows on the same drive as OS X I would find another program for doing a bare metal backup. I may explore this more in a future blog post.

Saturday, June 19, 2010

Ultimate Windows Mac - Part 1

This is my first post in a series on configure a MacBook for Windows power users.

First a little history (skip next 2 paragraphs if you're in a hurry). I grew up with PC's. My dad's business Agvise used computers for data acquisition in addition to regular office use and they tended to build their own computers most of the time. Therefore the first PC he purchased for me before college in 1996 was one I got to build. It was a Cyrix 6x86 which was the budget way to get a faster chip at a lower price then what Intel had to offer. In addition to PC hardware I grew up using DOS and spent plenty of time using Windows 3.1 before Windows 95 came along. I built every desktop I ever owned and then in December of 2000 the company I had just started at, MediaDVX, bought me a laptop and then a year or so later upgraded it to a business class Compaq M500. That thing was so rock solid I never had any desire to go back to tinkering with building my own computers and continued using HP/Compaq up until fall of 2007 when my trusty beaten up NC6000 finally died. So it's September 2007 and I have never owned ANY Apple product so far (I miss you RIO MP3 players!) and for the most part I'm really not an Apple fan but a couple of co-workers began showing off their personal MacBook Pros and introduced me to Bootcamp. I thought the hardware had interesting features, I was open to exploring OS X, and being able to boot into Windows or run the same instance of Windows in VMWare sold me on purchasing a 15" MacBook Pro and it's been downhill from there. Since late 2007 I've purchased the following: iPod Touch, iPod Classic, iPhone 3G (waited in line), Apple TV, MacMini, iPhone 3GS (for Fiance), and an iPad (waited in line). The one thing about my MacBook Pro I couldn't get over is the keyboard and the lack of some features Apple is/was behind on adding like eSata, HDMI, and a swappable media bay like HP, Lenovo, and others have. Once Windows 7 came out I had pretty much stopped using OS X all together on my MacBook Pro so I was ready to switch back to a PC.

I picked out an awesome combo of power and portability in the Lenovo T410S. I had it custom built, waited a few weeks for it to show up, and began using it. It took me many hours spanned across a week or two to get all the software I need to do development installed and configured on it. Then the big day came, it was time to start using it as my primary machine. Boy was I in for disappointment. The wired NIC lost connectivity every hour. The Display Port connection seemed to have interference issues and on top of that would "black out" the screen for a second every couple minutes. I found other people on the internet who had experienced both of these issues and I decided I didn't have time to work through these bugs. (Sidebar: The T410s has a multi-touch trackpad. I hoped it was as good as Apple's. With a ton of tweaking I got it to work "better", but even then it is not even close to as polished as Apple's, contrary to what some reviewers said) This was a $1700 laptop and it shouldn't have these issues so the laptop has been RMA'd much to my disappointment. Now I needed a replacement and since Apple had stood behind their products for me in the past (my MBP died and they replaced the screen, logic board, hard drive, and some fans, all for FREE! since the root issue was a manufacturing defect) and considering I'd just started getting into doing iPhone development using MonoTouch I decided I'd once again go back to Apple and I'm now typing this on my new 13" MacBook Pro!!! Thanks to Mitch Coopet for convining me I didn't need the i5 in the 15" since I really wanted a smaller notebook.

On to the good stuff.

Here is the list of System Preferences I tweak out of the box:
  1. Add right click if your MacBook trackpad supports it:
    • Trackpad -> One Finger -> check "Secondary Click" -> Bottom Right Corner
  2. Configure Expose (probably my favorite OS X feature)
    • Expose & Spaces -> Expose -> Active Screen Corners
    • Set Bottom Left corner to "All Windows"
    • Set Bottom Right corder to "Desktop"
  3. Shrink size of dock since I won't be using the laptop from 500ft away.
    • Dock -> Size -> adjust to your comfort level
  4. While you're at it remove Dock Items you probably won't use. I remove:
    • Mail
    • iCal
    • Address Book
    • Photo Booth
    • GarageBand
    • Time Machine (I'll be using CrashPlan thank you)
  5. Configure OS X so you can tab to checkboxes and drop downs in web browser.
    • Keyboard -> Full Keyboard Access -> All controls

Here is the list of software I immediately load onto my MacBook (first two will help OS X behave more like Windows):

Configure Double Command - I check the following to make the Mac keyboard more like a PC:
  • Command Key acts as Option Key
  • Option Key acts as Command Key
  • Control Key acts as Command Key (you won't have a Control key, but as far as I can tell the Control Key is only there because Steve Jobs doesn't like mouse buttons)
  • PC style Home and End Keys

Configure Quicksilver - since we don't have a control key we need to change the hot key. I use "Option Key - Space bar". Note if you configured Double Command like above my "Option Key" is actually the "Command Key" on the physical keyboard. If you want to use the physical "Control Key" then you'll need to configure Spotlight to not use that Hot Key first under "System Preferences -> Keyboard -> Keyboard Shortcuts -> Spotlight"

This should get you by until we install Windows using Bootcamp in Part 2. In preparation for Part 2 I've decided to immediately void my warranty and do the following:
  1. Add a SSD drive. Currently debating between Intel X25-M and Crucial's RealSSD C300 due to the recommendation by The Tech Report
  2. Add the SSD drive in place of the DVD drive using a MCE OptiBay

I opted not to use Apple's SSD offering and instead save money by adding it myself. Since I'll be using 2 hard drives I plan to purchase a smaller SSD and then store most of my data (music, movies, etc) on the regular hard drive which will save even more money since SSDs are still relatively expensive.

Note, I'll be updating the software list above as I continue my build.

Thursday, June 3, 2010

Move Google Apps Domain To DiscountASP.NET

Tonight I signed up for web site hosting plan with DiscountASP.NET. Partially forced to because Google was indexing by blog at as (due to the way I had Google Apps configured, D'oh!), but I also want to do some experimenting with ASP.NET MVC 2 and play around with some custom iPhone web services.

DiscountASP.NET wants you to point your domain at their nameservers for their hosting to work. This is kind of a bummer since I was happy with Google Apps handling that. The good news though is this CAN be done! I figured out how to do the CNAMES myself and had been smart enough to write down the info I needed before switching nameservers. Unfortunately I didn't write down the MX Records but with help from Steve Trefethen's blog I was able to fix them. My settings are below:

CNAME Record Manager
Canonical Name Record: Creates an alias from one hostname to another.
Use of CNAME is generally not recommended.
Domain NameDestination TTL







MX Record Manager 
Mail Exchanger Record: Identifies the email server that handles email for a domain.
Domain NameDestination DistanceTTL






















The second part of my mission was to redirect to just Due to DiscountASP.NET's awesomeness they support II7 and the IIS Rewrite extension so this is super easy. Just update your web.config with the following:

   <rule name="Canonical Host Name" stopProcessing="true">
    <match url="(.*)" />
     <add input="{HTTP_HOST}" negate="true" pattern="^cdeutsch\.com$" />
    <action type="Redirect" url="{R:1}" redirectType="Permanent" />

Or if you want to do the reverse ( to :

   <rule name="Redirect to WWW" stopProcessing="true">
    <match url=".*" />
     <add input="{HTTP_HOST}" pattern="^$" />
    <action type="Redirect" url="{R:0}" redirectType="Permanent" />

Now that I had that working I needed some content. What better way to start then with a fresh ASP.NET MVC 2 website. I started with the basic template built-in to Visual Studio 2010. You'll need to go to your project's References and click "Properties" on the "System.Web.Mvc.dll" and change "Copy Local" to "True" to get MVC to work on DiscoutASP.NET's servers. More info here. You'll also want to make sure you configured your web application to run using the .NET Framework 4.0. Framework 3.5 will work for MVC 2, but in my control panel it defaulted to Framework 2.0 and was throwing errors. When I went to fix it the only other option I saw was 4.0, it's possible there is a 3.5 settings somewhere, if there is feel free to try that too:  UPDATE: after talking to Michael Maddox I realized the errors I got were probably because I had my solution/project targeting 4.0. So you can either do the steps below if your project is for 4.0, or change your project to target 3.5 and then you can skip this step.
  • In your Control Panel go to "IIS Tools"
  • Under the "ASP.NET Version" tab set the version to "4.0".
  • Make sure after you hit "Update" you read the warning and click "Update" (or whatever it says) again.
If you found this helpful and you're going to sign up for DiscountASP.NET, please use my referral code: CDEUTSCH