Visual Studio 2008 XAML Editor Poor Performance Under Windows 7

Posted in Computing with tags , , , , on November 11, 2009 by pudchuck

The XAML editor in Visual Studio 2008 has gotten a bad rap, and for good reason; it’s garbage. After upgrading to Windows 7, the XAML editor would occasionally hang VS 2008 for several minutes, sometimes indefinitely. I tried several of the recommended fixes on the Internet, but nothing seemed to help. Just by chance I ran VS2008 as an Administrator and everything started working again.

I am not certain this is specific to Windows 7, but I started noticing the problem when I upgraded.

I hope this helps you. This bug was driving me insane!

Exception from Entity Query: _COMPlusExceptionCode = -532459699

Posted in Computing with tags , , , on November 5, 2009 by pudchuck

I am creating a Silverlight 3 application using RIA to query an Entity Data Model. Most queries are working fine; however, one query overload is failing with a System.Exception, “_COMPlusExceptionCode = -532459699″ when I attempt to query the data context.

 The problematic query looks like this:

 this.Context.Unit.Single(s => s.Id == id);

 The same error occurs when I use SingleOrDefault in place of Single. Changing the query to the following works just fine:  

this.Context.Unit.Where(s => s.Id == id).First();

Both queries give you the same results, but the later is a hack. What I have solves the problem but is not the real solution. The search engines have not been very helpful in locating a solution either.

 

X10 Interface for .NET

Posted in Computing with tags , , , , on June 28, 2009 by pudchuck
A few months ago I received some old X10 devices from a friend; this started my curiosity in home automation. Being able to turn lights on and off from a remote was great loads of geeky fun. After a little while I grew tired of the remote and wanted to write software to interface with the X10 devices directly. I looked around and found several intriguing open-source projects such as Mister House. Mister House looks great but it is written in Perl and I had a difficult time getting it to run on my Linux machines. I could dust off my old Perl skills to figure out what was wrong, or I could look a little further in to the .NET offerings (I’m a .NET developer and enjoy working with .NET for many of my hobbies). I found a few X10 interfaces for .NET, but they were all unreliable and buggy. Eventually, I started looking in to creating my own X10 interface for .NET. That journey ended with me writing my own interface from scratch and creating a new open source project, X10d.

X10d (pronounced Extend) currently only works with the CM11A X10 device. This device plugs in to a standard outlet and then communicates with a PC via a COM port. There are other devices such as the Firecracker, but I chose not to support it in the initial beta release. Once plugged in to the electrical system of the house the device is effectively a new node on the X10 network, able to send and receive messages. I found a whitepaper that described the X10 and CM11A protocol in great detail. This document was invaluable in creating the .NET classes.

During implementation, I used the state design pattern to model the X10 protocol. This implementation seemed to work out rather well, providing a lot of flexibility and making the code much more manageable than a monolithic design. An diagram of the Finite State Automaton (FSA) is shown below:

X10d FSA

X10d FSA

As you can see, the X10 interface transitions through several states while sending the command to a device, such as a lamp module. Moreover, the interface may send interrupts to the PC regardless if a command is active. These interrupts must be serviced before the X10 interface will continue processing commands. Once the interrupt is serviced then the PC must restart the command sequence. Much of the existing open source NET projects did not handle interrupts correctly, leaving the software in an unusable state.

I hope X10 hobbyists, and maybe even some professionals, find this code useful. If you have any comments or suggestions, please send them my way!

X10 for .NET

Posted in Computing with tags , , on March 25, 2009 by pudchuck

I’m starting to write my own X10 library in .NET. I realize that there are a few existing .NET libraries for X10, but in my experience they are not very robust or complete. There are other open-source projects like MisterHouse that interface with X10 but they are not written in .NET and my Perl is a little rusty. Moreover, it’s just fun to tinker.

If you know of any good X10 libraries for .NET, let me know; otherwise, I will continue down this path. I will post updates as they are available. If this project turns out how I hope, I will create an open-source project for it.

X10 is a lot of fun. It is even more fun to create .NET applications for all of your X10-enabled devices!

Reverse merging with Subversion

Posted in Computing with tags , , , , on March 5, 2009 by pudchuck

My company adopted a new process that included modifying the contents of 6000+ files and committing the changes to Subversion. The original programming that automatically performed the update messed up and we had to modify the 6000+ with another program and commit those modifications to Subversion.

Eventually, it occurred to everyone that the entire process was flawed and we had to undo all of the changes. What made this even more challenging was that developers across the company had modified the 6000+ files with their individual changes; we could not blindly remove the updates to all of the files.

I was tasked with removing the two bad commits while saving all of the individual developer edits. Luckily, Subversion provides the ability to perform reverse merging to remove bad revisions.

During the reverse merge I encountered 1000+ conflicts. This makes sense considering the type of modification; the same line was changed by the two autonomous processes and the developers. I did not feel like resolving these changes manually–after all, management wanted this done in a few hours–so I discovered a way to “auto accept” changes to resolve conflicts.

Step one: Lock out all developers during the update process. If I didn’t do this, I would never get my commit pushed through. I would need to constantly update my local copy and resolve conflicts prior to my massive commit. I set the appropriate permissions in the authz file to r from rw.

Step two: Refresh my local repository with the newest (head) revision and remove any of my local changes.

svn update
svn revert .\ -R

Step three: Remove revision 16044 from my working copy.

svn merge -r 16044:16043 svn://server/path --accept 'mine-full'

There are a few interesting things going on in the above statement. First, notice that the revision range goes backwards from 16044 to 16043. This is a reverse merge and instructs Subversion to remove revision 16044. The second interesting point is the use of –accept ‘mine-full’. This effectively tells Subversion to use the local version of the file (from head revision) if there are any conflicts. This preserves the manual updates made by developers since revision 16044.

I then removed the the other problematic revision, 16004.

svn merge -r 16004:16003 svn://server/path --accept 'mine-full'

Again, this preserves any manual changes made after revision 16004. Since I already removed 16044 from the working copy, only the developer edits remained. Obviously, you need to remove the higher revisions first and work your way to the lower revisions if you need to reverse merge more than one revision.

Step four: Commit working copy and re-enable Subversion for the other developers.

I hope this helps someone else out there. It took me a few hours to get the results I needed. BTW, I’m using version Subversion version 1.5. Happy SVN’ing!

VMWare Server Error 0×40000015

Posted in Computing with tags , on February 19, 2009 by pudchuck

What I did is probably not a recommended practice, some may call it just plain stupid. Maybe so, but it was a fun problem to fix. This is not a production environment so I can risk the entire environment going tits-up; only my wife will get mad when she can’t read her email or check Facebook.

I installed VMWare Server on an XP Pro SP3 box (VMHOST) which was connected to DOMAIN_A. I then create a new virtual machine and installed a new domain controller on that machine for DOMAIN_B. I then shutdown the old domain controller for DOMAIN_A. For the hell of it, I changed the VMWare Server host (VMHOST) to be a member of the new domain, DOMAIN_B.

Original:             VMHOST   ---member of domain--->   DOMAIN_A
New configuration:    VMHOST   ---member of domain--->   DOMAIN_B (VM image hosted on VMHOST)

When you think about this, it’s kind of a chicken-and-egg problem. The VMHost is a member of the active directory whose domain server is a VM image on the same machine. I configured VMWare to start the virtual domain controller when VMHOST rebooted. I held my breath and rebooted VMHOST. I held my breath for a long time.

Of course, this did not work. I received a useless 0×400000015 error from VMWare when VMHOST restarted. I also found messages in my event log informing me that VMWare (vmauthd) could not connect to the VMX (virtual machine image). It felt like a permission problem but the permissions on the VMX directory were wide-open. I Googled this for a while and did not find any information that would help me with my problem, hence, this post.

I finally booted in to VMHOST using the local administrator account. I poked around for a while until I found a the authorization.xml file in c:documents and settingsall usersapplication datavmwarevmware serverhostd. In this file, I found a line that looked liked this:

<ACEDataUser>DOMAIN_Abill</ACEDataUser>

That was the original account I used to install VMWARE, but the domain controller for DOMAIN_A was now toast. I updated this line to use the local administrator account:

<ACEDataUser>VMHOSTadministrator</ACEDataUser>

VMWare finally started after this change! I rebooted VMHOST and VMWare performed beautifully, starting the virtual active directory server during boot. When I got the log-in prompt I was able to log in using my domain credentials.

I hope this helps someone else out there. I don’t know how many people are going to try this configuration.

Linksys WRT54G Wireless Bridge

Posted in Computing with tags , , , on February 14, 2009 by pudchuck

This is a very basic introduction to wireless bridges. If you are a network guru, you won’t learn anything from this post. I make no guarantees about this process. If you are not careful, you could ruin your router. Just pay attention to the details and you’ll be fine.

Connecting your home network to your neighbor’s network using wireless routers is a popular use for wireless bridges. Once connected, you can view their network resources and even use their Internet connection. Of course, your neighbor acknowledges and approves of this activity.  :) Local laws govern what you can and cannot do without the host’s consent. I am not encouraging you to do anything illegal. Please be a good neighbor. If your neighbor has enabled wireless security then you’ll need to ask them for their security keys.

Wireless bridge

Wireless bridge

Many off-the-shelf routers can be updated to become wireless bridges. I am using an old Linksys WRT54G version 2 router. I have another WRT54G version 5, but it is not as capable. Pay particular attention to the version number with these Linksys routers. The newer versions of this router have less memory and you can destroy (a.k.a. “brick”) your router if you are not careful. If your router is version 5 or above, I wouldn’t try any of this! Wikipedia lists the various WRT54G routers and their capabilities. I recommend you browse through this information now.

The routers are really just computers running the Linux operating system. To make a long story short, Linksys has to expose their source code for these routers. Many people on the Internet have seized this opportunity to expand the default capabilities of these routers making them quite powerful. Updating the internal software is known as updating the router’s firmware. To expand the functionality of your Linksys router, you’ll be updating the firmware.

There are several firmware update options available to you. I’ve used DD-WRT for years, but just recently switched to the Tomato firmware.  I’ve been quite happy with Tomato and I’m using a Tomato-enabled wireless bridge to post this blog.

I’ll walk you through the Tomato installation and then point you to the Tomato tutorial videos so you can complete the configuration. You must have a wired connection to your wireless router. There are ways around this requirement, but I don’t feel like discussing them here.

  1. Download the Tomato software from the Tomato site (there are a few links towards the middle of the page). You can choose what’s known as “7z” or “zip”. Unless you know what “7z” is, choose the “zip” download option. It’s bigger, but simpler.
  2. Unzip the package to your hard drive
  3. Make sure your computer is physically wired to one of the four LAN ports on your wireless router. Don’t connect the cable to the WAN port and do not use a wireless connection.
  4. Connect to your router using the web browser interface. If you’ve never messed with your router before, you can probably just connect using the address http://192.168.1.1.
  5. You may be prompted for the default Linksys username and password. Try “admin” for the username and password. If that doesn’t work then Google it.
  6. Once you connect to the router via the web interface, click on the Administration tab. Under this tab are several child tabs. Choose Firmware Upgrade
  7. This is kind of a scary screen with a bunch of warnings in red text. Heed these warnings my friend.
  8. Click the Browse button and search for the directory where you unzipped the Tomato software. In this directory, you’ll find the WRT54G_WRT54GL.bin file. Select this file.
  9. Now click the Upgrade button in the lower right. The upgrade can take a few minutes so don’t panic. I’d recommend you don’t touch anything during this process. Just walk away until it’s done.

That was the scary part. If you made it this far then you’re golden. Now comes the fun part; configuring your new, all-powerful router!

Connect to the router web interface again (usually http://192.168.1.1). When you connect, you’ll be prompted for the Tomato username and password. Use “admin” for both. When you log in, you’ll see a new red interface instead of the default blue interface from Linksys. It will look something like this:

Tomato status screen

Tomato status screen

 Almost done. Locate “Tools” on the Tomato side menu. Click it and then choose “Wireless Survey”. Click the “Refresh” button and find the name of the wireless network you want to connect to. Save the name and the channel, you’ll need them later. I could explain how to finalize the configuration; instead, I’ll point you to the Tomato video that demonstrates this final process. You’ll want to enter your neighbor’s wireless network name in the “SSID” textbox and set the correct channel. If your neighbor has enabled wireless security then you’ll have to enter those credentials in the “Security” section as shown in the video. If your neighbor has not enabled wireless security then leave the “Security” drop-down at “Disabled”.

That’s it!

I’d like to thank the creators of Tomato. It’s a great piece of software.

Microsoft’s Azure Services Platform

Posted in Computing with tags on February 13, 2009 by pudchuck

A presenter at our .NET Users Group discussed Azure last night. Azure is Microsoft’s answer to Amazon’s EC2 and Google’s cloud services. Honestly, I was unimpressed. I understand that Microsoft wants to bring cloud computing to its .NET masses, but this immature, clunky product is a discouraging introduction. Additionally, I do not see how this service–or any other cloud service–will benefit my organization. We deal with personal medical information, and our customer’s stakeholders would never allow them to host this information outside their firewalls. Further, cloud computing is supposed to reduce infrastructure costs; however, I believe this reduction is offset by the complexity of the software. I’d rather hire a bright IT guy and give him $100,000 in hardware than employ N additional developers to create and maintain overly complex, distributed software architectures.

Service platforms (clouds) are the latest buzz in our industry, and I do believe they have their benefits, but I think a lot of businesses may be surprised by the constraints and costs of this paradigm. Speaking of costs, Microsoft has yet to announce their pricing structure for Azure. That’s obviously a huge risk to any company looking to use Azure.