Sunday, October 30, 2005

Ohio User Group Speakers List

James and I (OK, mostly him!) have put together a neat concept: the Ohio Speakers List.  This is a Wiki meant to connect speakers in, or willing to travel to, Ohio, and folks who are organizing events here.

We’re not limiting the content to .NET; it’s a resource for whoever wants to make use of it.

Add yourself in if you’re interested!

Now Playing: Wire — Rhapsody Sampler.  Lean punk with some electro tones.  Good vocals, not some screaming gunk.  Pretty good stuff.

Saturday, October 29, 2005

NUnit TestFixture Errors

Ever run across a funky situation where all unit tests in a fixture pass, but you’ve got a red light on the fixture?  Additionally, there aren’t any errors shown on the “Errors and Failures” tab, nor is there any text displayed on the Console.Out tab.  What’s up with that?

You may have an exception occuring in methods you’ve marked as TestFixtureSetup or TestFixtureTeardown.  I ran across this while refactoring a fixture I’m using to check NHibernate actions.  I was using my TestFixtureTeardown method to delete member entities I’d stored in the setup method — and I goofed on how that was implemented.

I figured out right away what the problem, but was puzzled why there wasn’t any help from NUnit’s GUI.  Actually, you can find out info about the exception, it’s just not immediately clear how.  Right-click on the TestFixture in the “Tests” pane and select “Properties.”  A message box will appear.  Click the “Result” tab and you’ll see all the nifty error stuff.

(I had to hack up the graphic because I’d moved past the error before I thought it would be cool to blog about.  You get the idea.)

Now Playing: The Who — Who’s Next.  Great stuff.  Killer stuff.  I likes it.

NHibernate & Hibernate Dox

I’ve said it before: NHibernate’s documentation sucks.  It’s written in a confusing fashion and there are numerous sections still unwritten.

Make sure to check out the Hibernate documentation page here.  It’s very clearly written, has a consistent example carried through the sections (so far, at least), and most importantly, discusses all the schema elements and attributes.  There are also very good explanations of the various relationship types (one-to-one, one-to-many, many-to-many, etc.) and how to implement them.

Sure, the documentation is Java-centric, but the concepts are explained so clearly that it’s easy to mentally translate over to C#.

Now Playing: The Who — Face Dances. This is somewhat popish, especially when you compare it to their older work, but I love it for one reason: Townsend’s amazing guitar work, especially the simple, clear riffs on Don’t Let Go the Coat.  Another Tricky Day is full of more great stuff, too.  Something else has amazed me over The Who’s long career: the utterly crisp clarity of the recordings of theirs I’ve heard.  The coin dropping and footsteps in The Music Must Change (Who Are You) has stuck with me since I first heard that albumn when it was first released way back when.

NHibernate PropertyAccesException

Like many things in NHibernate, causes of the PropertyAccessException aren’t particularly well documented.  (Well, they may be documented somewhere, but dang if I can find much on it.)  My NUnit tests were throwing this error during relationship tests with the “amplifying” message that the properties I was using for ID values weren’t the correct type. 

Huh?  Single entity stores were working just ducky, but trying to work with many-to-many relationships was failing.  The many-to-many definitions in the hbm.xml map files were all fine — trust me, I double-checked them about eight million times last night between 11pm and 1am when I finally quit last night.

This morning I finally found a Google hit that pointed me in the right direction: incorrect storage of the referenced entity, causing a null value in a member of type “Int32”.  You have to be sure you correctly set your collection properties in both sides of a relationship you’re trying to store via NHibernate.  It turns out I was incorrectly setting a collection on one side of my relationship.

Here’s the working (but not optimized) code:

[Test]

public void CheckAddPersonWithOneType()

{

PersonEntity personToDB = tep.MakeDefaultPersonEntity();

//Add the Person to the PersonType object's collection

speakerType.Persons.Add(personToDB);

//Add the PersonType to the Person object's collection

personToDB.PersonTypes.Add(speakerType);

IDal<PersonEntity> pda = new PersonDA();

int storedID = (int)pda.AddEntity(personToDB);

PersonEntity fromDB = pda.GetEntity(storedID);

IList retTypes = new ArrayList(fromDB.PersonTypes);

foreach (PersonTypeEntity type in personToDB.PersonTypes)

{

Assert.IsTrue(retTypes.Contains(type));

}

//clean up list

speakerType.Persons.Remove(personToDB);

}

 The all important lines are here:

//Add the Person to the PersonType object's collection

speakerType.Persons.Add(personToDB);

//Add the PersonType to the Person object's collection

personToDB.PersonTypes.Add(speakerType);

speakerType is one end of the relationship, persontoDB is the other.  Persons and PersonTypes are the collections holding the other end of the relationship.

Remeber that this is a many-to-many relationship?  Remember that m-m relationships need a link table between the two entities?  What’s cool about NHibernate is that I don’t have to fool at all with storing stuff in that link table.  NHibernate handles all that for me when I store the entities with one statement:

int storedID = (int)pda.AddEntity(personToDB);

Way cool.

NHibernate’s learning curve (and #%*@!! documentation) is tough going, but I think I’m going to like things once I get up to the next plateau.  I’m also weary of trying to wade through examples which aren’t much help.  Hopefully I’ll be able to put up some clear examples once I get things working well and refactored for clarity.

Now Playing: Guster — Lost and Gone Forever.  I’ve been playing a lot of Guster and Coldplay lately.  Well, a lot of other stuff, too, plus Springsteen’s The Rising seems to be stuck in my audio stream for some reason.  In any case, I really dig the cool harmonies and melodies.  Plus the lyrics are pretty thoughtful.  (Unlike The Mavericks, who I love but seem to be of the Gene Autry school of  All My Songs Have Five Words.)

Thursday, October 27, 2005

Life Is Not Just Coding

Check out Eric Sink's blog on how folks at his company blow off a bit of tension and relax. His article works on a couple levels. First off, it's very important to occasionally take a break from coding and do something fun to recharge your brain cells. Secondly, his description of boiling a frog (read the article for that to make sense, please!) is really pretty apt. Lastly, there's some serious gold in his remarks about the end of an era and how important it is for folks to see each other and avoid writing code non-stop for eight hours each day. Now Playing: Sublime -- various (Rhapsody sampler). I know nothing about Ska, so I thought I'd try this sampler stream from Rhapsody. I like the melodies, and the singer's got a cool voice, but I don't care for the constant references to drugs and profanity. I'm far from a prude, I just don't care for non-stop crap in my music.

Wednesday, October 26, 2005

Dayton-Cincinnati Code Camp Update

I've finally got a Code Camp page up at the group's website for our big event on January 21st, 2006. I'll continue blogging about the Camp here, but be sure to stop by the DevGroup's website for The Official Word. Check James's blog occasionally for news too. Now Playing: Maroon 5 -- Songs About Jane. Wow, great vocals! The lead singer's voice reminds me a whole lot of the guy from Simply Red, and it's a very pleasant recollection. The music's sweet, too.

The End of an Era

Since June 13th, 1985, the Wine Forum on CompuServe has been a neat corner of cyberspace where folks could meet, hang out, and gab about good wine, beer, spirits, coffee, food, and anything that came to mind.  I stumbled across it not long after Pam and I were married in 1993, and eventually ended up as one of their Section Leaders managing the Food and Beverages section where folks gabbed about good cooking and pairing food with beer, wine, or whatever.  For a number of years wrote an online column called “Jim’s Kitchen” where I explored pairing good food and wine.

Sadly, Jim Kronman, the forum’s founder and leader for the last 20 years, was just notified that AOL/Netscape is closing the forum come 3 November.  AOL, a clueless bunch of feckless, stupid idiots, bought out CompuServe somewhere back in ‘96 and promptly set about running CompuServe into the ground.  Yet another reason why AOL is the premiere case study in How Not To Run Things.  It’s another sad milestone that most all CompuServe communities, some of the first anywhere in cyberspace, have all been shut down by now.

The Wine Forum was instrumental in kicking off my interest in good food and wine.  I made several close, life-long friends there, and met folks who were incredibly generous with their knowledge, time, and yes, wine.  I’ve been fortunate enough to have tasted some amazing juice that I never would have had access to on my own.  Elliot Apter had us to a party where I had several different vintages of d’Yquem, a 1935 Graham’s Port, and some amazing Bordeaux.  Michael Straus had Pam and I over for a number of dinners, sharing his amazing cooking and some amazing gems from his cellar.  His passion about food, wine, and good coffee reinvigorated me, and his attitude toward things gave me the boost in confidence to be able to speak up about my preferences for various things, regardless of the opinions of others. Dave Sit held wine for us during our nomadic stint, cooked us great food, served us staggering wines, and steered us to some amazing restaurants in the DC area.  The list could go on for some time, but maybe you get the idea.

It’s too bad that such a neat corner of cyberspace is gone, but I suppose that’s just part of evolution.  It’s a sad day and I’m bummed, but it’s also a neat time to reflect on the many fine relationships and experiences I had through the forum.

 

Monday, October 24, 2005

Dayton-Cincinnati Code Camp Registration Live!!

We've got a live registration link for the Dayton-Cincinnati Code Camp on January 21st, 2006! Check out my earlier posts on the Code Camp here and here, then go sign up if you're in the area and interested in attending! Are you a speaker interested in presenting? Please check out the submission guidelines on the first post and get your topics in! Now Playing: Santana -- The Essential Santana Two disks, 32 songs, loads of Santana goodness. Amazing that the guy's put out nearly 40 albumns!

Great Online Sci-Fi Resource

Baen books, home of books by incredible authors like Kieth Laumer, Larry Niven, Jerry Pournelle, David Drake, and 15 or 20 other wonderful scribes, has a passle of their classic books available online for FREE. 

Check out their library here, and be sure to read Eric Flint’s thoughts about online piracy and why Baen has put so many great titles up.  The draconian fools in the recording industry ought to pay attention to Flint’s thoughts that “ Any cure which relies on tighter regulation of the market — especially the kind of extreme measures being advocated by some people — is far worse than the disease.”  Maybe they’d stop prosecuting 12 year olds for downloading music and open up a better economic model.  And maybe monkeys will fly out … 

Nevermind.

In any case, check out the library.  They’ve also got downloads for various readers, which makes it even better!

I’d run across this some years ago, but had forgotten about it until I saw a reference on Instapundit today.

Thursday, October 20, 2005

Political Blogging: The Coburn Anti-Pork Amendment

Warning: incandescent, searing rant against my Republican party. Keep small children away from the screen. Both my Senators here in Ohio voted today against the Coburm amendment. The Coburn amendment would have moved some of the rediculous amounts of pork in the budget over to paying for hurricane Katrina reconstruction costs. (Some of the best commentary on the Coburn amendment is at Instapundit. Just keep scrolling through and checking the links.) Only 13 Senators had enough brass tacks to vote against pork in order to help pay for reconstruction in Lousiana. There's a complete list of how the votes fell here. I am absolutely disgusted that my Republican senatorial representatives care less about fiscal sanity than idiotic, bloated, asinine earmarks. In fighting the war on terror, my President has shown great courage and leadership in standing up to the most difficult, unpopular effort faced by a leader in a long time. I wish he would show some of that same courage and leadership in domestic matters, but he's abdicated everything to the irresponsible children on Capitol Hill. Tomorrow I'm calling the offices of both Senators DeWine and Voinovich to let them know they won't see one red cent of campaign contributions from me. I'm not a huge contributor, but I refuse to spend my money to re-elect either one of them. I will also most likely vote for whaterver Democrat is running against them when they next come up for reelection, and I'm going to make that clear to their offices. Neither Senator has shown an ounce of fiscal leadership. Right now I think the only way to fix this domestic insanity in Washington is a return to divided government where the Presidency and Congress are controlled by different parties. My Republican party, supposedly for small government and less spending, has shown itself completely incapable of having control over the reins. At least a divided government will somewhat limit this madness.

Now Playing: Dire Straits -- Alchemy

I'm hoping Mark Knopfler's amazing guitar can somewhat calm my rage.

More on NHibernate and Nullables

NHibernate has their v1.0 release out.  Incorporating that with James’s Nullables2 (for support of native .NET 2.0 C# Nullable types) is a snap.  Download the 1.0 release files, drop the DLLs from the project’s bin directory into NHibernate.Nullables2\NHibernate Files\ and rebuild the Nullables2 solution.  Move the NHibernate.Nullables2.dll and the regular NHibernate DLLs wherever you need them in your projects.

By the way, to get green lights in NUnit, you’ll need to reference Nullables2 in both the project where you’re doing your data access and the project holding your unit tests.  Otherwise you’ll end up with NHibernate.MappingException errors stating that “could not interpret type” with the specific NullableType called out.

Now Playing: Off Kilter — Celtic Armadillo.  Five guys in combat boots and kilts mix bagpipes, drums, bass, guitar and keyboards.  We saw these guys at Disney World’s Epcot center where they put on a terrific show.  They do plenty of traditional Irish music, but they’ve got some contemporary things too.  Alive is an absolutely killer track.  The only downer on this CD is that it seems like a pretty amaturish production — there are a couple tracks which run over each other.  That really pisses me off because I had to shell out $20 for the disk.  Bah!

Wednesday, October 19, 2005

NHibernate Associations

Looking for good documentation in NHibernate’s help files on associations (relationships between objects) ?  Here’s what you’ll find in the 1.0.0.0 NHibernate Documentation file, right after the text that says “Association mappings are often the most difficult thing to get right. In this section we'll go through the canonical cases one by one, starting with unidirectional mappings…”

Nice, huh?  Check out the Hibernate dox, even though Hibernate’s a Java project.  The concepts seem to be pretty clear and I’m hoping I’ll be able to translate things to NHibernate without too much trouble.

Now Playing: The Corrs — In Blue.  I was looking for Celtic pop.  This may be a little too dance music-ish for me, but the harmonies seem nice.

NHibernate Tricks: Locating the Mapping Files

The various examples I’ve seen of NHibernate all had the mapping files (*.hbm.xml) in the same location as the business entities (BEs) they map.

That kind of sucks for trying to abstract out your data access.  Storage-specific stuff shouldn’t be co-located with your BEs, it should be in a storage-specific project.  Like a Data Access Layer project.

No problem.  Create or move your map files in your DAL project.  Make sure the map files are embedded resources, not content.  (Check the “Build Action” field in the file’s properties.)  Ensure the DAL project references NHibernate.dll — but you figured that out already since you’d have had beaucoup problemos with your “using” statements, so why am I beating a dead horse?

Now mod the constructor of the class you’re using to do all your data access, adding in a statement to add the DAL assembly to NHibernate’s Configuration.  Here’s what I’ve got for my PersonTypeDA class:

public PersonTypeDA()

{

   Configuration cfg = new Configuration();

   cfg.AddAssembly("nUGSoft.DAL");

   factory = cfg.BuildSessionFactory();

}

You’re now telling NHibernate to look at the current assembly where you’ve embedded the mapping files for your BEs.  The single statement cfg.AddAssembly("nUGSoft.DAL");  loads all maps in the assembly, so you don’t need to worry about trying to keep straight which BEs are referencing which others are referencing which others are referencing which others… Nevermind.  You get the picture.

Poof!  Everything’s happy, and you’ve got your persistence-specific stuff separated out where it belongs.

Shiny.

Now Playing: Neutral Milk Hotel — In the Aeroplane Over The Sea Nifty stuff with lots of very different musical instruments (flugelhorns!), odd lyrics.  Lots of fun.  I told James it was kind of like goat meat.  Interesting once, but I’m not sure how often I’ll eat it.  Wait, that was either Rage Against The Machine or System of a Down.  Nevermind.  But it was a cool analogy all the same.

Tuesday, October 18, 2005

Rhapsody: Terrific Music Service!

I’ve been griping about all the money James has been costing me via his music recommendations.  Now he’s gone and made a recco which will not only save me significant bucks, but allows me to check out scads music I haven’t had the opportunity to before: Rhapsody online music.

Rhapsody’s “Unlimited” service costs $10 per month, but gives you unlimited browsing of their huge online library — something like over 1 million songs.  I think their UI is a bit sucky, and it’s a performance hog on my older, slower PC (1.3Ghz, 512MB RAM), but the service itself is incredible.

In the three days since I signed up I’ve been scattered all over the music dartboard: Springsteen’s Born to Run and The Rising, The Who’s Quadrophenia and The Kids Are Alright, Dengue Fever (Cambodian rock), The Clash’s Give ‘em Enough Rope, Knickelback, Sigur Ros, The Kinks, Drive By Truckers, Coldplay, and about 20 other interesting things I can’t remember.  (One of my gripes is the lack of a useful history indicator in Rhapsody’s UI.)

This really is great stuff, because for $10 per month I’m able to chase down all kinds of stuff I never would have looked at before.

The final drag is that they’ve got nada, zilch, zero Tubes in their library.

Philistines.

<disclaimer>I get no money or any comp from these folks.  They’ve no clue who I am. I just like the service!</disclaimer>

Wednesday, October 12, 2005

Manly Man Blogging: Burley New Mower

Being a stay at home Dad who takes care of the vast majority of cooking, kid transportation, diapers, and laundry, I fight for every instance where I can assert (defend) my Male Role Modelness.  Today is just such a glorious day.

I now have in my shed one of these beauties. It’s actually a used older model, but still basically the same masculinity-loaded piece of machinery.  9.5 horsepower motor.  Enough noise to require ear protectors.  (Which is a bummer, since I normally listen to my iPod while mowing.)  A real gearbox with four forward and one reverse speeds.

It will also cut much higher than my soon to be retired mower.  This is nice because I try to keep my lawn fairly long as part of my mostly-organic lawn program.

Best of all?  A 33” cutting path via two, count ‘em, two blades.  My lawn usually takes me 65 – 75 minutes to mow with the old mower, and I pushed that thing fast as a workout.  Using my new toy today it took me 30 minutes.  30 friggin minutes!  And that was with having to figure out how to efficiently get this monster around the flowerbeds and trees throughout the yard, plus the usual distractions of my daughter showing me how well she’s learning her cartwheels.  (A distraction, but what a good one!)

There are a couple downsides to this.  First, it’s a monster to get around corners and curves in the yard, but mowing the lawn’s one of the few regular exercise events I get, so that’s not a bad thing.  Secondly, because it’s such a monster, I won’t be able to shovel off mowing to my kids until they’re a few years older than I was planning on.  (Six isn’t too young for my daughter to use a mower, is it?)

Now Playing: Franz Ferdinand — Franz Ferdinand.  Another great recommendation from James. He’s really starting to annoy me with his recommendations for music.  I’m blowing much of my discretionary budget (fun money) on stuff he’s pointing me to, curse him.

NHibernate Update

Still slogging away at NHibernate, still learning many good lessons.

First off, start with a small data model.  Get that working, then add in other related chunks. This will save you many headaches while you get NHibernate’s complex mapping properly created.

The project I’m working on has a moderately complex data model:

12 tables, 11 of which have various relationships.  NHibernate requires that you have all dependent relationships mapped out before it will work properly.  This means you can’t just wire up a few of these entities, say Person, PersonType, and PersonTypeLink, and press on.  You need to get <bag> or <set> elements defined in your maps for all relationships, not just the ones you’re interested in.

I’m most of the way through getting all entities mapped; however, if I had to do it over again, I’d literally drop tables I wasn’t concerned with, get maps and tests running on a subset, then proceed with wiring in other related tables.  For example, following on the group I listed above (Person, PersonType, and PersonTypeLink), I’d drop everything else, get maps and tests working on those three.  Then I might add in Post and PostType, followed by Subscription, SubscriptionLink, and SubscriptionFormat.  Next would come Location, Event, and Attendance.  Then I’d have Newsletter as the last table — an easy one with no links as dessert.

In one sense, this is sort of what I’ve done.  I went so far as to create another database and built in tables one by one with the appropriate references (but none of the “fluff” fields), then I used ObjectMapper to generate classes and NHibernate’s mapping XML.  This let me check what I was getting from ObjectMapper when reverse-engineering my existing table and classes.  (ObjectMapper calls that “syncronization.”)

Two more semi-major modifications have to happen to my business entities:

1) I have to add members to store other business entities for tracking relationships (one-to-many, many-to-many).  NHibernate works with both a Parent and Child object at the same time, so it gets/sets them via a Property.  I really didn’t want to add this weight to my business entities, plus this ties the entities somewhat to NHibernate’s concept of operations.

2) I have to implement GetHashCode() for all my business entities, or at least any entity based on a link table with composite IDs.  NHibernate needs GetHashCode() for its various Dictionary and List functions.  Implementing GetHashCode() is fraught with peril, and I’ll have to carefully think how to get this done correctly.  (Read Wagner’s Effective C# for problems with GetHashCode().)  I’m not looking forward to this because it’s a difficult piece of work and it looks like it’s a showstopper until I get it done right.  Bother.

One of the most irritating things about NHibernate has been some less than clear error messages.  I beat my head on the table for a few hours trying to figure out why a completely sane map file was generating schema errors telling me that the <id> element wasn’t a valid child of the <class> element, and that a <discriminator> element was expected.  (Discriminator elements let NHibernate, well, discriminate between different types of an entity, such as when you’ve got a Person table which holds Professor and Student entities, but is keyed off of a PersonType field.  See Justin Gehtland’s article on the ServerSide for details.) My Person table didn’t store different types of Person entities, it just referenced a link table to store that information — and I’d already mapped that table.  Those schema errors finally cleared up when I got all inter-related tables mapped, so it wasn’t really a schema issue, it was one entity missing dependent relationships.  Arrggghhh.

I like NHibernate’s concept, and I like the clarity of its use once you’re past the initial stages.  Setup and knowledge building stinks, though.  I’m nearly done with this mapping (finally!), and I’m looking forward to pressing on with getting some actual implementation done on my system.

Now Playing: The Killers — Hot Fuss.  Nice stuff, funky sound, good beat.  No clue what they’re singing half the time, though.  Hopefully they’re not singing the praises of Howard Dean, Ann Coulter, or some similar idiot.  <shudder>

Tuesday, October 11, 2005

SiteMeter Global Map: Cool Stuff

I use SiteMeter for stats on this blog.  I’ve always joked that my blog’s read only my Mom and some guy in Pakistan who accidentally subscribed to my feed.  SiteMeter’s statistics are a great way to prove/disprove that assertion.

One absolutely shiny thing about SiteMeter: their global map.  The map shows you where in the world folks are hitting your site/blog/whatever from.  The map below shows more folks than my Mom are indeed visiting my blog — unless Mom’s doing a Where In The World Is Matt Lauer or similar gig.

Clicking on any dot will bring up a page showing all kinds of cool info on who stopped by your site.  You get referring URLs, browser specifics, lots of cool stuff.

SiteMeter’s basic stats (which I use) are free.

<disclaimer>I don’t get any bucks from SiteMeter.  I just think their service is cool.  Amazing what powerful stuff is available on the web for free.</disclaimer>

 

Now Playing: Screaming Future Axe Murderers — Xylophone and Pennywhistle Insanity.  Good thing it’s nearly bedtime for my kids.  Then this music will stop and I can relax with a cup of this and get some more work done on NHibernate.

Dayton-Cincy Code Camp

As I announced earlier, James and I are putting on a Code Camp for the Dayton-Cincinnati area on 1/21/06. We've already had some good news on various points. We've had five or six folks express interest in presenting, and we've got two large sponsors lined up already. One's even paying for breakfast and lunch, which is pretty much the highlight of my day. We're still working on a venue, but we've got a lot of good options in the West Chester area just north of Cincy. Check out the post noted above if you're interested in presenting. Now Playing: The Tubes -- The Best of the Tubes. It doesn't have Malagueña Salerosa, White Punks on Dope, or Mr. Hate, but there's still a lot of good tunes on this. Hey, it's got Attack of the Fifty Foot Woman and Sushi Girl, so it can't be all bad. (Plus I got it on sale for like five bucks. Heh.)

NHibernate Tools: ObjectMapper

I’ve been mostly asleep since Saturday evening trying to get over some grunge my son brought home from Sunday school daycare last week.  Ugh.  Thankfully I got mostly over it before my wife had to leave on her regular biz travels, so I’m semi-coherent and able to try and knock off some more things with NHibernate and the project I’m working on.  (Dude, you’re not coherent when you’re in good health! — ed.)

James pointed me to ObjectMapper as a tool which might help me resolve some NHibernate mapping issues I’ve run into with many-to-many relationships.  ObjectMapper gives you the power to do various reverse-engineering tasks: from database to model, from assembly to classes, from classes to tables. All of that, in either direction.  Pretty slick.

ObjectMapper won’t let you work backwards from existing .NET 2.0 assemblies, but that’s not a show-stopper.  I’ve been working from my existing database model, generating up to classes and then having ObjectMapper generate mapping files for NHibernate.  One hitch to using NHibernate and ObjectMapper is that you need to get all the relationships done at once before you start using any access points.  I’m working on a DB schema with 12 inter-related tables.  (No, they don’t all tie to each other in a spaghetti-like mess!)

I think you can get around this by leaving out the <bag> or <set> elements you use to define inter-entity relationships; however, now I’m running into odd schema errors with <id> elements being out of place.  I’ll blog on that solution once I figure it out.

NHibernate seems like a great thing, but it’s certainly a huge PITA to get up and running.  Unclear documentation and rudimentary examples aren’t a big help.

Now Playing: Sheryl Crow — Steve McQueen.  It’s only three songs, but Steve McQueen has a killer beat to it.  I first heard this at a 3D remote control helicopter competition at the National Remote Control Modeler’s Museum in Muncie, IN.  A female pilot fired up this music, launched her ‘copter, and did amazing tricks for about five minutes — with the ‘copter rarely climbing more than five or ten feet above the ground.  I was there with my Dad and daughter, so this short disc brings back great memories.

Friday, October 07, 2005

More on NHibernate: Good Explanatory Article

NHibernate’s documentation, as politely as I can put it, leaves a lot to be desired.  Maybe folks who are more smarter than I am can decypher the information, but I’m finding it nearly useless for figuring out how to get some functionality working.

Justin Gehtland wrote a great NHibernate article on TheServerSide.NET.  Good diagrams, pretty clear explanations.  This article cleared up the discriminator element’s function — the NHibernate dox were useless blabber.  The discussion of one-to-many and many-to-one relationships is also good.

Now Playing: The Fabulous Thunderbirds — Walk That Walk, Talk That Talk.  I really dig whatever label you want to put on this genre.  Rockabilly, Texas Rock, Just Plain Good Tunes.  I’ll count The Mavericks in this same arena, although their lyrics are usually just a couple short bits repeated over and over.  In any case, the T-Birds are good stuff.

More on NUnit Config Files

Charlie Poole, the Master of All Things NUnit, gives the Real Truth on how NUnit finds config files for tests. Clear and concise. Read and understand it if you're using NUnit. His trick for checking whether or not you're reading config files is a great one.

Now Playing: Warren Zevon -- The Best of Warren Zevon: A Quiet Normal Life. Werewolves of London, Send Lawyers, Guns and Money, and Roland the Headless Thompson Gunner, all on one album. What more could you ask for?

Thursday, October 06, 2005

Byte Array Indexers and Properties

I ran into a neat problem this afternoon while trying to use a byte array indexer to set an array cell to a particular value via a business entity property.  I say it was a “neat problem” because things didn’t work like I’d expected, but I was able to quickly figure out what the issue was.  It would have been a “#@%">“#@%*&!!! problem” if the lightbulb wouldn’t have turned on quickly.

My biz entity has a byte array for storing photos, with a few checks on the setter to ensure we’re not trying to store too large an image:

private byte[] _photo = null;
public byte[] Photo        
{            
   get { return _photo; }            
   set            
   {                
      if (value != null)                
      {                    
         if (value.Length > NS_MAX_IMAGE_SIZE)                    
         {                        
            throw new ArgumentOutOfRangeException("value", value, "Image size too large");                    
          }                
      }                //Clone array, not assign since Arrays are reference types                
      _photo = (byte[])value.Clone();                
      _isModified = true;            
    }       
}

The “neat problem” popped up as I was writing a test to check the Equals() method when one of the two entities being compared had its Photo property as null.  I create one BE with Photo as null, then set the other to a non-null by storing in a single byte:

right.Photo[0] = 0xF;

Well, that got me a NullException error, so I stepped through trying to figure out why the null checks in the property’s setter weren’t behaving as I expected.  Stepping into the assignment above ( right.Photo[0] = 0xF; ) jumped me into the Property’s getter, not the setter.

‘Tis a puzzlement, to quote King Mongkut.

Wait.  Slap forehead.  I’m using an indexer to set a cell of the byte array.  That means the statement needs to work on the actual byte array, so of course the getter is used to return the array before the value’s set.  Duh.

Now I’m creating a new byte array with the appropriate value and using the property’s setter.  Works much better and it was a “neat” problem to work through.  (Quickly, thankfully!)

Now Playing: Guster — Lost and Gone Forever.  Maybe even better than Keep it Together, an album which I love.

Wednesday, October 05, 2005

Setting up a Non-Profit Organization

We’re moving the Dayton .NET Developers Group to non-profit status to make it a bit more attractive for other organizations, individuals, and companies to donate goods or services to us.  (Most straight cash support can be written off a business’s marketing effort expenses.)  Bob Sledge, our group’s new Treasurer, has been finding lots of great reference links.

Here, in no particular order, are some great helpful links:

I’ll post up other bits and pieces as we continue down this road.

Now Playing: Beck — Odelay.  I saw these guys on Letterman the other night and thought they were pretty cool.  I also nabbed “Black Tambourine” which they played on Letterman.  Pretty funny to have found these folks on that show — I never, and I mean never watch Letterman since I’m either at my computer working or heading for much needed sleep.  Dunno if I’ll like this music in a month or so, but it’s different and cool right now.

Sunday, October 02, 2005

Technorati -- Maybe I Just Don't Get It

I’ve had a link on my blog to Technorati for nearly the entire (short) period my blog’s been alive.  A couple months ago, my Technorati listing finally got over one page length of sites linking to my blog.  Unfortunately, I’ve never been able to see more than the first page of links. 

I get this lame error “Sorry, we couldn't complete your search because we're experiencing a high volume of requests right now. Please try again in a minute or add this search to your watchlist to track conversation”  every time I try to go to the second or third page of links.  Every time.  No matter when I try it, no matter how many times.

Maybe I’m just lame (highly possible), but what’s the big deal about Technorati if their basic searches won’t get you a decent result set?

More on NHibernate and Nullables

James Avery got a slick solution set up for using true .NET 2.0 Nullables in NHibernate. Check out his blog post, grab the code, and have at it. The only limitation I've found so far is that the generator class for ID values won't support Nullables. Hopefully he or I will get a fix for that soon.

Dayton - Cincinnati Code Camp!

James Avery and I are planning a Code Camp for Saturday, January 21st, 2006.  We’re still working on a venue, but it will be in the Union Centre area of West Chester, Ohio.  We’re still working out details, but we’re looking at a one day Camp running from 9am to 6pm, maybe a bit later.  Sessions will be 60 minutes long and will be code-centric.  We’re not looking for marketing folks to come in and show us a bunch of Powerpoint slides.

Here’s the cool thing: YOU get to decide what’s on the agenda.  We’ll get submissions from various presenters, consolidate the list, and pass it on to folks who might attend.  Attendees will vote on the sessions they’d like to see and we’ll assemble a final agenda from the winners.

We’re looking for presentations on a wide range of topics, even outside the .NET arena.  Topics folks from Dayton have expressed interest in include:

  • XP/Agile development
  • Enterprise Architect / Data Modelling and UML
  • Security in .NET
  • C#/VB.NET Essentials
  • Multi-Tier Architecture
  • Web services fundamentals / in-depth
  • Win forms vs ASP.NET
  • Sharepoint/biz talk
  • Enterprise library
  • Compact Framework/mobile
  • .NET & Active directory
  • Using SQL DBs
  • Source control
  • Productive use of VS and other tools
  • XML

Other areas which would be of interest:

  • Development in Ruby
  • Mono
  • Toss something in and we’ll consider it!

Be sure to check James’s blog for topics the Cincy folks are interested in.

Interested in attending?  Monitor my blog or James’s for more details.

Interested in submitting some presentations?  E-mail me at jim-A.T-IterativeRose-D.O.T-com-REMOVEME with the following information:

  • Topic Name
  • Description (Abstract)
  • Target Audience

Presenters may submit a maximum of five sessions and will be limited to a maximum of two actual presentations.  Yes, yes, I said the attendees get to select what topics they want, but we’re shooting for a nice diverse agenda.

Be sure to monitor our blogs for more details.  James and I are both pretty excited about putting this together!

Saturday, October 01, 2005

Recipe Blogging: Fall Tomato Salad

We’ve got an abundance of wonderful cherry tomatoes in our tomato thicket.  (Mexican Midget tomatos from Seed Savers.) Yes, I wrote that correctly.  We have a thicket of tomatoes courtesy of a large number of volunteer plants which took off.  I just sort of point them to the fence and over a few poles I had up for our beans and peas.  They go nuts and give us billions of wonderful cherry tomatoes.

I love tossing these tomatoes in with some just-cooked orzo pasta, a bit of minced garlic, some parsley, and some top-notch extra virgin olive oil.  It’s a killer dish, plus it’s quick and easy to make.

Fall Tomato Orzo Salad

1.5 c. cherry tomatoes

1 c. orzo pasta

1 small clove garlic, minced

3 – 6 Tbs best-quality extra virgin olive oil

2 Tbs minced parsley

Parmesan cheese

  • Bring a fairly large pot of water to boil.  Add a good pinch of salt to the water, then boil the orzo until just cooked, about five minutes.
  • While the orzo’s cooking, mince the garlic using a bit of salt (helps get the oils out).  Scrape into a nice serving bowl and add the olive oil, parsley, and tomatoes.
  • When the orzo’s done, drain it well and stir into the bowl while still piping hot.  Dust with parmesan cheese.

Notes: 

I love garlic, but don’t get carried away with it in this salad.  You want just a hint of it, not a 2x4 in the chops.

Subscribe (RSS)

The Leadership Journey