How to step into NHibernate code

Posted on June 29th, 2007 in .NET, NHibernate by Jon Kruger

In 10 minutes you can be stepping into NHibernate code to see exactly what’s it’s doing with your project. Here’s how to do it:

1) Go download the NHibernate source code from here. As I’m writing this, the latest release version is 1.2.0.GA. (I’m assuming here that you already have NHibernate set up to work with your application.)
2) Unzip the source to a location on your machine.
3) Open the NHibernate.sln file in Visual Studio that corresponds to the version of the .NET framework that you are using (1.1 or 2.0). If you really want to build everything, including the Iesi.Collections assemblies and all the unit tests, then open the NHibernate-Everything.sln file, but for me this is overkill because I usually only want to step into the NHibernate code. If you build NHibernate-Everything.sln, you’ll have to have NUnit 2.2.8 installed to build the unit test projects.
4) Make sure the Debug configuration is selected and build the entire solution.
5) If you open the \src\NHibernate\bin\Debug-2.0 (or Debug-1.1) folder, you will see all of the assemblies along with the .pdb files (if you just build the NHibernate-1.1/-2.0.sln file, you will only see one .pdb — NHibernate.pdb). Copy all of the .dll and .pdb files to the location where you currently have your NHibernate .dll files in your project.

Now when you debug your project, you should be able to step into NHibernate code!

Obvious caveat: we’re assuming that the source code that you downloaded is the exact same code that they used to build the release assemblies. I don’t see any reason why this wouldn’t be the case, but I’ve run into this problem before with other third party packages (like Infragistics NetAdvantage controls). So it might not be a bad idea to remove the debug NHibernate dlls when you’re done stepping into them and put the release dlls back in so that you don’t get burned.

Hope this helps! If you encounter any problems with this process, please let me know.

Winamp’s equalizer no longer works on DRM music files

Posted on June 29th, 2007 in Uncategorized by Jon Kruger

Winamp has been my media player of choice for years, and for two very simple reasons — global hotkeys that allow me to change what’s playing without opening up the app, and the Classic Skin which is really really small so that it doesn’t take up lots space on my desktop with some gaudy looking interface. No other media player has these things (even though someone could probably code something like this in a day or two).

I installed Winamp the other day (I had just been listening to music on my mp3 player for awhile) and I discovered that the equalizer no longer works on DRM tracks! I thought, there has to be some mistake. Without the equalizer your music doesn’t sound right at all.

Apparently there is no mistake. It sounds like AOL (which now owns Winamp) was in danger because it was fairly easy to create Winamp plugins that would allow you to strip DRM out of your music files. Because of this, AOL was getting pressure, so they first completely took away the ability to play WMA files in Winamp and eventually fixed so that you could play WMA again — but now the equalizer doesn’t work.

So now because Winamp was a little too user-friendly, Microsoft and the music industry are playing hardball and are forcing us to use their inferior media players. I never really minded DRM because DRM helped bring about iTunes and other online music stores without the mass piracy of the last 90’s, but when something like this happens, it’s really frustrating.

My First WPF App

Posted on June 19th, 2007 in .NET, WPF by Jon Kruger

12 hours in the car coming back from the Outer Banks means that I finally had time to delve into WPF. It seems like every other week Microsoft is telling us about some new technology that is coming out. I figured that rather than try and learn them all at once, I’ll concentrate on just one. I picked WPF because WPF will be used extensively in Silverlight and because all of the WPF apps I’ve seen so far look awesome.

WPF is a big change from any desktop application platform in the past in that it encourages you to design a rich user experience. WinForms apps almost always have the same look and feel — buttons look the same in every app, everyone uses the same menus, the same toolbars, etc., and it’s really difficult to change the look and feel of them. Now Microsoft is pushing you to use your imagination and creativity to do whatever you want, while giving you the tools you need to do so.

This is both exciting and challenging. It’s really hard to try and put aside all of the UI concepts, layouts, colors, etc. and try and think outside the box. With WPF, you can do stuff that you would’ve never dreamed of attemping in Windows Forms, and it’s not that hard to do. Coming up with the ideas is the hard part!

Here’s what you need to get started:

These installs all take a long time, so allow plenty of time. :)

Here’s where I learned everything that I know:

  • Reading Windows Presentation Foundation Unleashed, by Adam Nathan. I’m only about halfway through, but this book does an excellent job of walking you through everything. Normally I don’t buy dead tree books, but when you are learning something completely new, it’s nice to have someone walk you through everything in the correct order.
  • Downloaded the Family.Show app. This app was written in WPF as an example application that contained examples of everything that you might want to do in a WPF app.
  • Watched the Family.Show guys talk about their app in this video.
  • Watched this video on designing rich client experiences with Expression Blend and WPF.

For my application I chose to solve a problem that I have — I can’t keep track of car repairs and when they need to be done. So I’m going to create a simple application that will allow me to record car repairs that I do and let me know when I’m due to have the repairs done again.

Most WPF apps that you’ve seen out there do lots crazy animation and 3D rotating of panels. I tried to stay away from that for now and just do the basic stuff that I would do in a normal application. In WPF, the basic stuff actually is in some cases a lot harder than the animation and 3D rotations.

Some thoughts so far:

  • I did more work in Expression Blend than I did in Visual Studio. Anyone doing WPF will almost always use Blend and Visual Studio side by side. You can even compile and run in Blend.
  • Blend is a really powerful tool and it allows you do to all the styling, layout, and animation. Timelines and event handling make it easy to make your controls react to button clicks, hovering over something with the mouse, etc. The use of data binding is really encouraged in WPF, more than it was in Windows Forms, and Blend makes it easy to use data binding in all kinds of places.
  • The learning curve of Blend wasn’t as bad as I expected it to be. Watching the MIX videos that I mentioned earlier really helped me learn all of the basic stuff. When you do get stuck and can’t find something in Blend, you can go edit the XAML directly and then go back into Blend and see what changed.
  • The Visual Studio Extensions are supposed to install the “Cider” designer (which is still in CTP). I couldn’t get anything to show up at all in the designer. I don’t know if this was a problem with my environment or a bug, but it doesn’t really matter because there’s no reason to do anything in the VS designer when you have Blend.
  • There is also Expression Design, which is essentially MS’s version of Adobe Illustrator. I haven’t really used either, but the nice thing about Design is that it also outputs XAML, so you can bring stuff from Design right into Blend. You can import all of your Illustrator files into Design.
  • Right now it’s taking me a long time to do relatively simple stuff, like figuring out how to get stuff laid out inside a list box item. Then again, I was in the car doing this so I was sans-Internet, and I’m sure there are lots of examples out there by now of how to do certain things.

I’ll try and post more updates and I continue to try and figure this all out.