All in all, I was very pleased with the inaugural meeting of the Milwaukee ALT.NET group. We had a turnout of 10 people, which exceeded my expectation in quantity, and the quality was quite good, too. We talked about general architecture topics for about 45 minutes, and then Todd Penland led the group in discussion on persistence and the Unit of Work pattern. We talked about various alternatives to building this yourself (e.g. NHibernate), and talked about the pros and cons of this approach (i.e. requiring a topological sort to deal with database changes properly (something near and dear to my heart from when I was writing code for MIDAS/DataSnap and BDP), handling object graphs, requiring a MarkDirty() call in the property setters, etc.). It was a very engaging discussion. Thanks to everyone who showed up, and to SpiderLogic for providing the refreshments. Here are the details for next month: When: Wednesday, April 9, 2008 @ 7pm Where: 10000 Innovation Drive, Suite 260 (SpiderLogic office) What: Dan Piessens (who is on the advisory panel for Unity and EntLib 4.0) will cover Unity and EntLib 4.0 I'm looking forward to it, and hope you are, too. If you're planning on being there, please send me an email to dmiser@distribucon.com, or leave a comment here. That way I can plan the food and refreshments accordingly. Feel free to drop me a line on topics you'd like to see covered, too.
Updated to change the date to April 9th. This date change will allow us to hopefully get more exposure thanks to Scott Isaacs and the WI .NET User Group. Thanks, Scott!
A co-worker of mine, Brian Kapellusch, is working on a web framework to give us a garden path for ASP.NET applications. The code that he's writing (and the code to use it) is trés elegant. One of the underpinnings of this framework is his use of the ObjectDataSource class (ODS). I am making heavy use of NHibernate and Spring.NET in this application as well. My understanding of the ODS told me that if I wanted to control how the source object was created, that I simply needed to handle the ObejctCreating event and assign the desired object instance in that event to e.ObjectInstance (see here for some more usage examples). However, it turns out that is not enough to fully control when an object gets created. If you set the TypeName property to a concrete class, ODS will also create a new object behind the scenes - even if you have handled the ObjectCreating event. This becomes very problematic when using an IoC container to automatically build up and inject properties into your class. The bottom line is this: If you see one version of your object that has things built up properly (because the IoC container was used properly), and one version that has null properties (because, in essence, ODS called "new MyClass()" for you, which doesn't let the IoC container do it's job), you should change the TypeName to point to the interface type instead of the concrete class type. Much thanks to Brian for this one.
On my desktop machine, I have a dual monitor setup with 2 19" monitors and an ATI Radeon graphic card running each monitor at 1152x864. This setup has worked flawlessly for me for a couple of years. Recently, though, my primary monitor has been acting up. When I first boot up, I need to move my mouse, which then "scrolls" the viewable area. It's like I have a virtual desktop with the size of my monitor set too small for the resolution at which I'm running. I dug around on the Display Properties' Advanced setup and went to my video card's control center. There, I noticed the EDID settings were claiming the maximum resolution of the monitor was 1024x768. That would explain this behavior. I disabled EDID for the problem monitor and set the value to the proper resolution (1600x1200). Everything is working great again.
I'm returning to the Team in Training program this year - a little healthier, a little lighter, and a whole lot happier knowing that we all helped make a difference for the Leukemia & Lymphoma Society last year. (See here for a picture of me at the top of the last major climb last year.) I feel very blessed to have made a lot of good friends last year, all of whom have a shared passion to help out such an important cause. It must have been worthwhile, because here I go again! I've committed to raise a minimum of $4,200 for the Leukemia Society. By donating your money, you get a tax deductible donation, and also help an organization provide support to patients and research a cure. The easiest way to donate is to donate online by going to my fund-raising web page at http://www.active.com/donate/tntwi/tntwiDMiser1. Many strides have been made - partly as a result of the nearly $1 billion raised by Team In Training - but there is more to be done. I am riding in honor of this year's beneficiary, Jesus Vega Ramos. I am also riding in memory of Lewis Challoner. Lewis was the father of my best friend, Steve, and he took us on some century rides (the Rock 100) when we were in high school. He continued to be heavily involved in the biking community, with patents granted on bikes to help the disabled, in addition to being an avid and hard-core rider of long distances into his 60s. Lewis was like a second father to me. If you want/need to send a check, or have any other questions, please feel free to email me. Thanks for your time, and I look forward to your donation. If you know of anyone else that might like to help, please pass this on. Every little bit helps!
I'm using NHibernate a lot more lately, and it's been working great. One of the downsides, though, is the fact that you need to build up the mapping files by hand. Well, no more. I stumbled upon the open source project, active-record-gen, on Google Code. One of the templates that it provides is one that will generate NHibernate mapping files for tables in an MSSQL database. I tried this on a couple of databases and it works rather well. A few small suggestions: - Implement a better pluralization/singularization strategy by using Inflector.NET.
- Work with more databases than just MSSQL.
- Allow for the connection string to be built up with more options. Right now, it requires SSPI integration, and attached databases don't work as well as they should. See here for more details.
This link explains the unit testing tools available in VS.NET 2008 Professional. My take after reading that section is that Microsoft doesn't get it. Here is my list of observations about this section. Feel free to leave a comment to tell me where I'm wrong. - I feel like this is nothing more than an upsell to get me to go and buy VS.NET TeamSystem. Sorry, that's not going to happen. TeamSystem is way too expensive (both initially and in setup/maintenance time for a TFS server). Besides, we have an existing development infrastructure setup since we use multiple (non-MS) languages/platforms here.
- It looks like MS wants to ignore the thriving and long-standing community of open source unit testing tools. I'm willing to bet that NUnit (and MbUnit, etc.) has more code using it than Microsoft.VisualStudio.TestTools.UnitTesting. Yet, if I want to use the integrated Test menu in VS.NET, I need to rewrite my unit test code to use near-identical attributes for my unit tests (e.g. [TestMethod()] vs. [Test]).
- Code coverage is not available in VS.NET Pro. I guess code coverage isn't something that developers should be doing - well, unless they shell out tons of money to get it done. Thankfully, there are free alternatives, with cheap upgrades to the latest version.
- I want to easily run and debug my unit tests. I know Resharper can do this, but I haven't installed that in VS.NET 2008 due to the number of issues I had with it. (Yes, I know an EAP is coming out soon, but I also have CodeRush and Refactor, which work fine with 2008.) I like TestDriven.net, but I'd like to be sure that it doesn't go away.
- The documentation is too cluttered. If you're going to give me a list of what's included and what's not included in the Pro version, then why not just separate the documentation to make it easier for me to see what capabilities I have (and what I don't).
In short, it's disappointing that MS has chosen to force people to one specific way of writing unit tests that is against industry norms. ASP.NET has shown me that they do understand the provider model, so why not use it here to allow me to run and debug my unit tests using whatever tools I want.
I would like to take it upon myself to announce the formation of the Milwaukee chapter of the ALT.NET UserGroup. It will meet the first Wednesday of every month, with the first meeting to take place on 3/5/08 @ 7pm at 10000 Innovation Drive, Milwaukee, WI. Pizza and drinks will be served, and the event will be free to attend. Thanks to SpiderLogic for sponsoring the first meeting. This group will cover agile development tools and techniques with .NET, best practices for architecture and coding, emerging technologies, and anything else the group decides to cover. For more backstory on ALT.NET, read this post. The use group will be a very participant-driven group. I will not look to lead this group in any significant way, other than to call this group to order, and get people involved in sustaining it. I've learned from other user groups that if a group is too dependent upon one person, it is a matter of time before it fails. For the first meeting's agenda, I propose we get some volunteers to take on some minimum responsibilities and then break into an OpenSpaces format, where technical topics will be presented by anyone who wants to present. I don't want this to be yet another 1-way presentation medium for 1-2 hour topics, so be prepared to be engaged, discuss, and share (bring your laptop to showcase code and/or slides). I'll take a swipe at talking about ASP.NET MVC this first meeting. If you have something you want to see covered, or especially if you want to cover something, post a comment, and we'll get it on the agenda. Please pass this notice around to anyone you think will be interested! If you plan on attending, I would appreciate either a comment on this blog or email to dmiser@distribucon.com, just so we can gauge how much food and drink to have on hand. I am really excited about this, and look forward to seeing everyone there!!
I have a .NET application that generates an XML file via serialization (through XmlTextWriter) and submits the data via https. Recently, they changed something on their end to only accept an upper cased UTF-8 encoding, like this:
<?xml version="1.0" encoding="UTF-8"?>
Unfortunately, using the .NET classes mentioned above, it generates the encoding string in lower case. I could find one mention of this on google, and they said to have the other company change (not an option here), or override XmlTextWriter. I went with that approach, making heavy use of Reflector along the way. I started by looking at the WriteStartDocument method, but realized that the private StartDocument is the thing that generates the output. It also gets called by the overloaded WriteStartDocument, so I'd need to override that method, too. However, in the private StartDocument method, it uses a bunch of private variables and generates output via another private method, InternalWriteProcessingInstructions. Ugly. At this point I realize that XmlTextWriter is not a class made for inheriting.
Back to Reflector, and I notice that the Encoding.WebName is the property used to write out the encoding string. I now create a descendant class of UTF8Encoding. The class is listed below. Now I just call XmlTextWriter, passing in UpperCaseUTF8Encoding.UpperCaseUTF8 for the Encoding type, and everything works perfectly. public class UpperCaseUTF8Encoding : UTF8Encoding
{
public override string WebName
{
get { return base.WebName.ToUpper(); }
}
public static UpperCaseUTF8Encoding UpperCaseUTF8
{
get
{
if (upperCaseUtf8Encoding == null)
upperCaseUtf8Encoding = new UpperCaseUTF8Encoding();
return upperCaseUtf8Encoding;
}
}
private static UpperCaseUTF8Encoding upperCaseUtf8Encoding = null;
}
|