Wednesday, November 11, 2009
SQL Server XML - Replacing the value of an attribute with a column from the same row
UPDATE myTable
SET xmlColumn.modify('replace value of (/x/y/@a)[1] with sql:column("columnName")')
WHERE ...
When I tried wrapping the call to sql:column with braces (ex. {sql:column("columnName")}, I received error 2224 - An expression was expected.
When I tried enclosing the whole thing in double-quotes (ex. "sql:column("columnName")", I received error 2370 - No more tokens expected at the end of the XQuery expression. Found 'columnName'
Tuesday, November 10, 2009
Home Server, Part 3 – Creating a VM for Windows Home Server
This is the third post of a series where I discuss the steps I went through to stand up a server for my home network
One of my primary goals was to stand up a Windows Home Server (WHS). This post made it clear that it was possible. Now, was it practical and would it perform on Hyper-V Server? Both valid question that I would eventually find the answer to.
I’m not going to go into the details of installing Windows Home Server. There are many articles on the web that cover that. I’m really going to concentrate on the Hyper-V aspect of the install. With that in mind, I will say that I found this WHS whitepaper helpful.
I created the VHD first. Originally I wanted to create a small drive for the system and a larger one for the data. Then I saw a couple of articles that suggested that you use your largest HD as the primary. Something about the way that WHS allocates space? I should have kept the URL of the article. (Please let me know if you find an article that explains this – thanks.). To make things simple, I created a single 500GB fixed disk. Why a fixed disk? According to this whitepaper, fixed drives offer better performance. Also, one of my main goal for WHS is to have it backup all the computers in the house. So I went big.
Next I created the VM. I walked through the wizard. Windows Home Server doesn’t require a lot of memory. I’ve seen some articles that say you can get by with as little as 512M. I allocated 1GB RAM to the VM. I also allocated one processor. I ended up with two IDE controllers and one SCSI controller. I assigned the 500GB VHD to the SCSI controller because it performs better than the IDE controllers (see the performance whitepaper). I also configured the DVD drive to reference the physical DVD, which contained the Windows Home Server Install DVD.
With that completed, I started the VM which started the WHS install.
After a couple of minutes, I was greeted with the message “Hard disk capable of hosting Windows Home Server was not found. Would you like to load additional storage drivers?” What the hell? How could the install not find the drive? I had no idea what driver to load. I wasn’t sure what the problem was.
I started searching the Internet for clues (Where would we be today without the Internet?) . I hit one article that discussed this very issue. According to the article, the issue is that the Windows Home Server install does not have the drivers for a SCSI drive but you can install them from a virtual floppy drive image called SCSI Shunt Driver.vfd. Unfortunately I couldn’t find it. It wasn’t on the Hyper-V Server host anywhere.
After more searching I bumped into this article. It turns out that Hyper-V Server 2008 R2 cannot boot a guest OS from a SCSI drive. The guest OS boot drive must be an IDE drive. I changed the configuration to move the VHD to the first IDE controller and restarted the VM.
The install proceeded without any more problems.
There was only one more step once the install had completed. I had to install Hyper-V Integration Services. Integration Services is installed on the guest OS and provides an interface to a set of services offered by Hyper-V Server. To install Integration Services, I connected to the VM from the Hyper-V Manager.
This brought up a window that is very similar to Remote Desktop.
After logging in, I was greeted with a very nice warning message of the damage that I could do by managing WHS this way. In this case, it’s safe to close the instance of Internet Explorer to expose the desktop. From the Virtual Machine Connection’s Action menu I selected Insert Integration Services Setup Disk. This loaded the virtual DVD drive with a CD image. Autoplay didn’t kick in so I had to go manually navigate to the DVD and find the setup program. In this case, I needed the version that was in the Support\x86 folder.
Integration with the guest is much smoother once Integrations Services is installed.
With the server install, I followed the the remainder of the Getting Started whitepaper to complete the install. I now have a Window Home Server running very smoothly and it is successfully backing up the other machines in the house. The next thing that I want to do is see how well it will stream media to the PS3.
Friday, November 6, 2009
Home Server, Part 2 – Installing Hyper-V Server 2008 R2
This post is one of a series where I discuss the steps I went through to stand up a server for my home network
I’m going to be honest: I’ve a huge fan of VMWare Workstation. I tried Microsoft’s Virtual PC when it first came out but the performance was really lacking. A co-worker convinced me to try VMWare and I’ve been loyal since.
So I bet you’re wondering why the title contains Hyper-V Server and not something like VMWare Server or ESXi. I’ve been intrigued by Hyper-V since Microsoft announced that the Azure Fabric is based on it. This was an opportunity to give it a try, especially with the R2 release.
Hyper-V Server 2008 R2 is a free download from Microsoft. It is installed on the bare iron and provides a hypervisor for running virtualized servers. Pull down the configuration guide also. It’s not for R2 but I found it to be very helpful.
I’m going to tell you now that installing Hyper-V Server 2008 R2 was dead simple. I burned the iso to a DVD, popped it into the drive and bounced the machine. Soon the setup was running. After a couple of restarts I was logged in and greeted with the configuration tool – Server Configuration.
Using the information in the configuration guide, I setup the server to be in a Workgroup and enabled all of the remote management options. This is important since you will mainly be managing Hyper-V remotely. Also, enable Remote Desktop (RDP), you’re going to need it.
Hard Drives
When I installed Hyper-V Server 2008 R2, it formatted the partition that I installed it to. It did nothing with the other drives in the machine. I had to use the DISKPART command-line utility to bring the other hard drive online.
Remote Administration
Hyper-V Server 2008 R2 is supposed to be managed remotely. To do that I installed the Hyper-V Manager from the Remote Server Administration Toolkit (RSAT). Unfortunately there are different deployment packages for Vista and Windows 7.
After I installed the toolkit, I had to use the Turn Windows Features On or Off option in the Control Panel to enable the Hyper-V Manager.
Things were going really smoothly at this point. By now the hardest thing that I had to do was locate the RSAT deployment package for Windows 7. But what kind of project goes smoothly? Not this one. Keep reading.
The “Fun” Starts
The first VM that I want to create will be hosting Windows Home Server so I fired up the Hyper-V Manager to create the VM. I was greeted with the error message “You do not have the required permission to complete this task. Contact the administrator of the authorization policy for the computer <computer name>.” I started doing what all computer professionals do – searching the web.
I came across John Howard’s blog and specifically this post. John is a PM on the Hyper-V team at Microsoft. This post is part 1 in a series that addresses this issue. He’s even created a tool, HVRemote, to simplify the steps.
As I did more reading, it seems that R2 now takes care of a lot of the configuration that John lists in that post. This would be the Configure Remote Management option in the Server Configuration tool (sconfig). Unfortunately I still couldn’t connect.
I started looking at the HVRemote utility again. There’s a 10-second Guide on the site that addresses a variety of configurations. Mine is the first one: Client and Server both workgroup. Using the Server Configuration tool, I created an account on the Hyper-V server with the same name and password as my account on my laptop. Like magic the permission error disappeared and I was able to connect to the server.
“Ha! Home free!” I started to build the VHDs for the new VM.
Until I was greeted by another error message: “Cannot connect to the RPC service on computer <computer name>. Make sure your RPC service is running.”
This had me stumped for a while. I used the Server Configuration utility to install the most recent updates and bounced the server. I was able to connect again – for about 10 minutes. Then the RPC service error popped up again.
I stopped the firewall on my client to see if it was the issue. Nope. Not it. I pinged my laptop from the server and the error went away – for about 10 minutes. That was interesting. I was actually able to do some of the configuration, like creating a Virtual Network and one of the VHDs. All I had to do was periodically ping my laptop from the server.
Obviously this was not an acceptable solution.
While searching I came across this thread in the Technet forums. The poster had solved a problem similar to mine by doing the following:
From a command window on the server, issue the following command:
netsh advfirewall set allprofiles state off
This disables the firewall on the server. While I really don’t want the firewall disabled, I ran the command anyway.
On the client:
- run dcomcnfg
- Under Component Services, navigate down to My Computer
- Bring up the Property Dialog for My Computer and select the COM Security tab
- Click the Edit Limits in the Access Permissions section
- Enable Remote Access for Anonymous Logon
Doing these two steps did seem to correct the RPC problem. I’ve not seen it since. I’ve also gone back and enabled the firewall on the server.
Update – I usually sit on a post for a day and re-read it prior to posting. I came back to the Hyper-V Manager after 24 hours and was meet by the “RPC service” error message. I stopped the firewall on the server and I’m now able to connect to the server as expected. I’m not happy about having to run without a firewall. I’m going to start a thread in the forums to find out the exact firewall configuration.
After getting all of this taken care of, I was able to create the two VHDs that I need for my Windows Home Server VM. That will be the topic for the next post in this series.
Next: Installing Windows Home Server
Home Server, Part 1 - Hardware
So begins another saga of large projects. This time, though, I’m in the domain of computers – something that I know a little more about.
I’ve wanted a server for the house for a while now. I periodically scan the Dell site looking for a good deal. A couple of weeks ago I stumbled into the PowerEdge T110 Tower Server. I picked one up with a quad-core 2.4 GHz proc, 2GB RAM (single DIMM) and one 160GB SATA hard drive. I typically purchase the minimum amount of RAM and hard drive that I can get. I’ve found that I can purchase them much cheaper after-market.
What I didn’t realize was that this machine used a Dual-Channel architecture and, as I understand it, operates optimally with matched-pairs of memory modules. The invoice from Dell didn’t say much about the configuration of the DIMM that I purchased, but between the user’s guide for the machine (yes, I read the manual) and Crucial, I was able to identify the configuration that I needed.
With that information, it was just a matter of checking all the usual online sites. I ended up a Newegg.com (I know – shocking isn’t it!). Newegg had a really good deal on a 6GB Tri-channel kit from Mushkin that was the correct configuration. I hadn’t heard of them so I checked out their forums. The moderator was really helpful. I gave him all the information that I had and he felt that the memory would work. He also offered to verify it with the engineering team. I like good service so I gambled and made the purchase.
The hardware arrived after a week and a half. After unpacking the server, I fired it up to verify that things seemed OK. I shut it down after a couple of hours and installed the new memory. Then fired it back up. The server recognized the memory and everything seemed OK. After a couple more hours, I shut it down and installed the new hard drive.
Now I had a new server, eating electricity and doing nothing.
Next: Installing Hyper-V Server 2008 R2
Thursday, October 1, 2009
VMware Workstation and Resharper
I’m a huge fan of both VMware Workstation and Resharper. I do all my various software development tasks within a virtual machine. Each client or project gets their own VM. It really lessens the chance of an environmental changes for one client affecting another client or project. If that’s never happen to you, consider yourself lucky.
I have Resharper configured to use the IntelliJ IDEA keyboard shortcuts. I started using Resharper back with version 2.? and those were the shortcuts in place at the time. So those are the ones that I’m used to. One of my most used navigation shortcuts is Ctrl+Alt+F7, which is Find Usages. The shortcut never worked in the VMs. Well, today I realized that VMware was intercepting Ctrl+Alt as the hot key to release the mouse back to the host computer.
Luckily VMware has an option to change the hot key combination. Under Edit | Preferences and then select the Hot Keys tab in the Preferences dialog. I’m now using a custom combination of Ctrl+Alt+Win.
Saturday, September 12, 2009
The Bass Guitar Build – Part 4
This is the fourth post in a series describing the construction of a bass guitar. This is a project that my son and I took on when he stumbled into the opportunity to purchase a Jackson Bass Guitar body and neck for a pretty good price.
At this point, all the construction tasks had been completed.
We strung up the guitar using the strings that I had purchased from one of the Sam Ash trips. Actually, putting the strings on the bass is easier than stringing the other guitars. Probably because bass strings are thicker and easier to handle.
The first thing that we noticed was a terrible buzz on every string. No surprise really. I suspected that we’d have to adjust the relief of the neck. If you’re not familiar with what I’m talking about, most guitar necks are not straight. They have a little bow in them and this is called the relief. If you hold the guitar in playing position and sight down the neck, you’ll typically see bowing one way or another. In our case, the neck had a sever back-bow which was causing the strings to not have enough clearance above the frets. So when the strings were struck, they bounced off the frets causing a buzzing noise.
The obvious solution was to correct the bowing and most guitars have a metal rod, called the truss rod, through the neck that is used to make this adjustment. This is where the next trouble-spot of this project occurred. The truss-rod nut on this guitar was sitting in a little pocket that was cut into the head stock.
None of my sockets would fit within the pocket so that I could adjust the nut. I went to Lowes and bought a socket and extension that I thought would work. You can probably guess that it didn’t. I even removed the neck and took it to Lowes. Still no luck.
I knew we really needed a 9/32 inch barrel wrench so we went to Guitar Center. They didn’t have anything. We were close at Sam Ash. They had a 5/16 inch one. So we ended up ordering one from Stewart-MacDonald.
Once we received the wrench, I was able to adjust the relief to remove the back-bow and get the action (the height of the strings above the frets) where it was comfortable for my son to play. We went from this
to this (sorry about the blurry picture).
Hopefully you can see the increase in height of the string about the fret. In our case, I used the recommendation from the Fender support site. You can find them here.
With the action set, we moved on to adjusting the intonation. The intonation affects the tuning of the guitar all along the neck. The way that the neck is laid out, the open sixth string will typically be tuned to an E and fretting the sixth string at the 12th fret will also produce an E but one octave higher. Setting the intonation requires that you tune the open string, fret the string at the 12th fret and hope that you get the same note. If you don’t, you adjust the string’s saddle forward or back, depending on whether the note was sharp or flat. Moving the saddle causes the string’s length to change. You then have to retune the open string and check the tuning at the 12th fret again. You repeat this procedure for each string and it will take a long time.
The last step was to adjust the height of the pickups. Again we used the recommendation from the Fender site. This procedure was made easier by the fact that we had mounted the pickups on springs.
Finally we removed the protective wrapping from the control-cavity cover and installed the knobs on the volume and tone controls. And with that, we were done.
This was a great little project that I really enjoyed because it allowed me to spend some quality time with my son working on something that was important to him.