Browsing Posts published by james

Since Hamilton called me out, I thought I should comment on my recent tribulations around a new laptop. (For those of you wondering, Twitter is unlike Las Vegas. What you say on Twitter doesn’t stay in Twitter.) 🙂 I’m in the market for a new laptop as my Dell D820 is giving me problems. The battery life is currently around 2 minutes. (The 9-cell battery, which initially got 8 hours run-time, is quite near death after only 2-1/2 years of use – mostly plugged in.) The replacement battery was going to cost over $300, but wouldn’t solve the lack of hard drive space, the need for more memory, or the slow processor. (The system is 2-1/2 years old, which is ancient for a developer laptop.) Heck, a new D830 with similar specs to my D820 would have cost less than $1000, which isn’t that much more than the battery!

I was seriously considering a MacBook Pro, likely running Vista. (I know. Blasphemy!) The MBP was very tempting, but the price was steep for something I would consider developer-grade. As Hamilton noted, over $3000 for decent, but not stellar components. I was close to buying the Dell E6500, but the poorly-rated NVidia Quadro 160M put me off. (I’ve had Quadro chips before. They are awful for anything other than CAD/CAM. Want to flake out with the occasional game while on the road? Forget it with a Quadro chip.) Another serious contender was an Alienware m15x, but loaded with developer-grade goodies pushed the price well above $3200 CAD. The systems are built in Miami, FL and I didn’t get the warm fuzzies when I talked to their sales department. I got the distinct impression that any serious problem would require return to Miami for service, which isn’t acceptable for a business laptop, IMHO. Still there is a coolness factor to the Alienware systems.

I’ve never considered myself a “ThinkPad” guy, but when I saw the specs of the T500 plus the price, I jumped at it. For $2K CAD (including tax and shipping), I got a 2.8GHz Core 2, 4GB RAM, Radeon 3650, and a bunch of other goodies. The one downside is that the largest 7200rpm hard drive available on this model is 160 GB. I can always replace it later if needed. One great feature is the dual video cards – an integrated Intel X4500 and the ATI Mobility Radeon 3650. You can switch between the cards without rebooting and reviews indicate that going to integrated adds about 1.5 hours to your battery life, which is already around 4.5 hours. The screen is 15.4″ widescreen at 1680×1050 – same as the Dell D820 that I’m replacing. (I’ve had a 15.4″ 1920×1200 and it hurt my eyes. I run my 24″ Acer X243W monitors at 1920×1200, which is awesome.) I considered laptops with 17″ screens, but they’re quite heavy and unusable in airplanes. (My friend, John Bristowe, told me, “Sure, you can use a 17″ in an airplane. You just kind of angle it right and type on your chest.” Uh, yeah…) Hamilton’s description of “a hundred LEDs blinking in your face” worries me, but it’s already ordered. I await the T500 with expectation and trepidation. I’ll let you know my impressions once I receive it.

Alright, alright. I give in. I’m finally twittering along with the rest of the planet. You can find me here:

http://twitter.com/JamesKovacs

You can expect witty banter, scintillating insights, and breathtaking news bites… 140 characters at a time.

If you’re looking for a good Twitter client and you’re running Windows, I would recommend Witty, a free WPF-based Twitter client. Very pretty, very functional, and very non-intrusive. Highly recommended. There is even a ClickOnce installer.

image A big thank you to everyone who completed the ORM with NHibernate survey. The results have provided me with a lot of food for thought with respect to organizing future courses. Some answers were expected while others were surprising. Rather than bore you with the details, let me get to what you really want to know… Who won the JetBrains ReSharper license? Using an advanced combination of digital and analog randomization technologies (e.g. I printed out the list and pulled one out of a hat), the winner is Brett Baggott of Nashville, TN. Congratulations, Brett. In the words of Obi-Wan Kenobi, “Use it wisely…”

In other news… The Castle Project PMC has selected its winner for The Great NHibernate/Castle Giveaway. Drum roll please… The winner is Markus Zywitza of Aarbergen, Germany. Markus has received Visual Studio Team Suite with MSDN Premium. Asked why he was chosen, he humbly suggested many other project contributors more deserving than himself, but added this explanation.

My involvement of Castle began some 18 month ago as a user. My main involvement with Castle is documentation and small enhancements and bug fixes. Writing docs is a structured approach to learning for me, and I am willing to share what I create through learning. I guess that was the reason for the PMC to select me, as the documentation has been neglected lately.

— Markus

The NHibernate team is still debating the most deserving recipient. (I’ll remind them again in another week or two…) Fabio Maulo – the current project lead – has received his subscription after a bit of work on my part. (I unilaterally decided that the third should go to Fabio, as I mentioned in the original announcement.) I would like to offer a huge thanks to an unexpected person. First let me give you a bit of background. I sent Fabio his license activation code, but it didn’t work as the code turned out to be valid only in Canada/USA. (Fabio lives in Buenos Aires, Argentina.) I contacted MANY people at Microsoft to see what could be done. No one could solve the problem of getting Fabio a license key. As a last resort, I emailed S. Somasegar, Senior VP of DevDiv, himself asking for his assistance to solve the problem. That was on a Thursday. I didn’t expect an answer. The guy is a senior VP and I’m a lowly MVP. Plus I was giving the license to the project lead of NHibernate and DevDiv was in the midst of finalizing Entity Framework v1. (I didn’t expect that to have any bearing, but you never know. Conspiracy theorists eat up this type of stuff.) On Monday – just two business days later – I received a personal email from Soma himself informing me that he was getting the issue resolved and apologizing for the confusion around the licenses! Sure enough, James Rice and Manuel Hernandez contacted me and Fabio. They got the license sorted out in short order. So a huge thanks to Soma for his responsiveness and his support of the .NET community.

ALT.NET Canada kicked off last night and was great fun. Bil has some initial coverage here complete with video. Mo Khan discusses his take on the fishbowl topic, “Why are fundamentals important?” I wanted to take a few paragraphs and give my two cents on the topic.

The fishbowl last night got too hung up on the particulars. The point that I personally wanted to make was that fundamentals are more important than APIs/technologies because fundamentals give you a framework within which to understand any API or technology. That’s not to say that specific technologies aren’t important. You won’t get too far in the .NET world not knowing the BCL. 🙂

I’m not a crotchety old programmer who is going to insist that you learn everything that I know about software “because I had to walk 2 km to school every day through blowing snow uphill – both ways!” I don’t expect you to (and wouldn’t want you to) spend years writing C++ code to understand just how bloody hard it is to get pointers right or manage memory. (Do I need a *& or an &* here? And is that one * or two **? If you don’t know what I’m talking about be thankful. Waste of brain cycles.)

As far as what I consider fundamental… OO and design patterns, definitely. But also high level knowledge of CPUs, memory, disk, and network. The fundamental building blocks upon which all software and hardware is created. (Working at a high level of abstraction is fantastic and much more productive, but even when working at such a high level, you need to understand – to pick an arbitrary example – that durable transactions require disk I/O and that disk I/O is an eternity in processor cycles.) You should also be familiar with Big-O notation, data structures, and algorithms. You should understand the services provided by a managed runtime (.NET, Java, etc.).

Are you a bad programmer because you don’t know how to implement a red-black tree from memory? Absolutely not. (I don’t personally remember either!) But you’re a good programmer for knowing that there are more data structures out there than an array. You have the fundamental knowledge to try solving problems in a myriad different ways.

Programming languages, runtimes, and APIs come and go. If you only understand those, you have a steep learning curve to climb every time technology changes – and it does. The fundamentals will always serve you well regardless of the technologies involved.

I’m doing some WCF work for a client, specifically around WS-Security. I stumbled upon the System.ServiceModel.MessageSecurityVersion class today. Its static properties alone should explain why developers are craving simpler technologies like REST…

This is a friendly public service announcement that seats are still available for my Object-Relational Mapping with NHibernate course. The three-day course is being offered in Calgary running from Tuesday, August 26, 2008 to Thursday, August 28, 2008. You can find the full course announcement here with instructions on how to register. If you are a company or group of individuals, please contact me directly at jkovacs@post.harvard.edu about a group discount.

I am currently planning future public offerings of the course and would like your feedback on where, when, how much, … I would appreciate it if you could take a few minutes to complete a short survey. As a thank you for your time, I will randomly pick one respondent to receive a copy of JetBrains ReSharper 4.0 Personal Edition. (N.B. The survey is limited to the first 100 respondents.)

The survey is now closed. The winner of the JetBrains ReSharper license has been contacted. Thank you to everyone who participated.

I had the pleasure of appearing on .NET Rocks #362. I talked to Carl and Richard about dependency inversion, dependency injection, and inversion of control. A lot of what we talked about I also wrote about in my MSDN article, Loosen Up: Tame Your Software Dependencies for More Flexible Apps. Here’s the summary of the show, which I had absolutely no input into whatsoever:

James Kovacs talks about the Castle Windsor project, and gives the clearest definitions of Inversion of Control (IOC) containers, Dependency Injection, and the reasons why we need to think about these techniques. Critical listening for all .NET developers.

I believe that I owe them both a beer next time I see them for such flattering remarks. smile_embaressed

Given the number of developers using Subversion, I’m surprised that no one on my blogroll has mentioned the new Subversion clients released in the last few weeks. Subversion, TortoiseSVN, and VisualSVN have all synchronized their version numbers on v1.5. I’ll talk about TortoiseSVN and Subversion changes. VisualSVN has some minor enhancements that basically expose the features introduced by Subversion 1.5. I’ll leave you to investigate them yourself.

TortoiseSVN

Let’s talk TortoiseSVN… You can get the new client from here. N.B. If you’re running 64-bit Windows (XP, Vista, or Server 2003/2008), make sure you grab the 64-bit installer. Shell extensions run directly inside Windows Explorer, which on 64-bit Windows is a 64-bit process. So you don’t get any WoW (Windows-on-Windows) goodness that allows 32-bit executables to run on 64-bit Windows.

New Overlays

The most noticeable change is the new overlay icons.

image

Unversioned and ignored files now have their own overlays, which I find especially useful.  The problem in the past was that Windows only has 12 overlay slots available.  These slots could be easily exhausted if you had multiple shell extensions installed, such as TortoiseSVN and TortoiseCVS.  Tortoise clients now have a common overlay handler, which somewhat mitigates this problem.

image

Delete Unversioned Files

Over time, working copies tend to get crufty – at least mine do. I end up having extra unversioned files and directories – from tools, builds, half-implemented refactorings that you think better of – littering your working copy. Every once in awhile, I would just grab a clean working copy and delete the old. I then went to the trouble of creating PowerShell script to clean up my working copy. Now TortoiseSVN 1.5 includes this feature. Simply SHIFT-right click in your working copy and select “Delete unversioned items” from the context menu.  N.B. This option only appears if you hold down SHIFT.

image

Other Improvements

The repository browser has also been completely reworked.  It now shows a two pane view similar to Windows Explorer.

image

The revision graph has also been rewritten and is much easier to use.

image

Client-side caching has been improved, making TortoiseSVN more responsive. Merging has improved. Changelists have been added. Lots of new features. You can read the release notes for more information.

Subversion

Subversion has made a lot improvements, which can be found in the release notes. If you’re just running TortoiseSVN, you don’t need to install the Subversion binaries. TortoiseSVN includes the SVN libraries. You only need the Subversion client and/or server if:

  1. You want to use Subversion from the command line via svn.exe and/or svnadmin.exe either directly or in scripts.
  2. You are running a server using svnserve (svn://) or Apache (http:// or https://).

You can download the Windows client and/or server from a few different places, each with advantages and disadvantages:

  • CollabNet – On the positive side, the MSI installer is quick to get you up and running. It adds svn.exe to your path and, if you install the server, you can select between svnserve.exe (svn://) and Apache (http:// or https://) easily. On the downside, you have to register on the CollabNet site and the downloaded binaries do not include support for Berkley DB, only FSFS. FSFS is the default for new repositories, but if you’ve got some older repositories around, they’re probably BDB. The CollabNet binaries complain bitterly about BDB repositories: “svnadmin: Failed to load module for FS type ‘bdb'”. Honestly I would recommend staying away from this package.
  • Tigris – Scroll down to svn-win32-1.5.0.zip and grab that. It includes both FSFS and BDB support, but you’re on your own configuring svnserve.exe. It’s not that hard and I document the steps here. This package is great if you just want to run svnserve.exe to access your repositories via svn://. If you want to run Apache to enable access your repositories over http:// and https://, you’re on your own to download and configure Apache. If you want to do that, then I recommend…
  • VisualSVN Server – Although VisualSVN (the Visual Studio add-in) is a commercial product, VisualSVN Server is completely free. This is the easiest way to get a Subversion server up and running with Apache. You can go from a clean Windows box to a working Subversion server in under 10 minutes. As an added bonus, it includes a MMC management console.

Upgrading the Repository Format (optional)

Although Subversion 1.5 can work with older repository formats, some of the new features, such as merge tracking, require you to upgrade your repository to the latest format. (See “Compatbility Concerns” in the release notes for full information regarding required client, server, and repository versions for various features.) Subversion will not upgrade your repository automatically. If you want to use the new features requiring a repository upgrade, you must run the following command:

svnadmin upgrade <PATH_TO_REPO>

where <PATH_TO_REPO> is the physical path and not a URL.

If you need to upgrade a lot of repositories and you’ve got PowerShell installed, you can do the following (assuming your repository root is c:\SrcRepos):

cd \SrcRepos
dir -name | foreach { svnadmin upgrade $_ }

Cyrus SASL and NTLM

TortoiseSVN and svnserve now include Cyrus SASL (Simple Authentication and Security Layer) support, which allows you to use a variety of authentication/encryption mechanisms, most importantly for Windows users – NTLM and Kerberos. Subversion clients and servers prior to 1.5 only support ANONYMOUS and CRAM-MD5. You’ll need to be running v1.5 on both sides of the wire to use the other protocols. The ZIP package from Tigris includes NTLM, but not Kerberos. If you want to use Kerberos, you’ll have to download saslGSSAPI.dll and add it to your sasl-plugins directory.

WARNING: I spent the better part of an afternoon trying to get svnserve.exe authenticating against the local Security Account Metabase (SAM) without success. (i.e. Using local Windows accounts to authenticate Subversion users.) The documentation is sparse to non-existent. I was able to get SASL to read its configuration and load the NTLM plug-in, but I could never successfully authenticate. Even with the correct username/password, it just prompted me again. It could be a problem with SASL defaulting to NTLMv1, which Vista disables by default for security reasons. If I figure out how to make this work, I’ll post a solution…

Canada_flag_halifax_9_-04What better way to celebrate Canada Day than to announce that registration is now open for the ALT.NET Canada Open Spaces? The event is happening in Calgary, Alberta on August 15 to 17, 2008 at the University of Calgary‘s MacEwan Conference Centre.

ALT.NET is not about being alternative, but about considering alternatives and choosing the best approach for your project – be that a product from Redmond, open source software, or a commercial third-party library. The conference brings together bright minds in our industry to discuss more effective ways to develop software and solve real business problems.

We’re honoured to have Steven “Doc” List facilitating the Open Space. (Doc facilitated both the Austin and Seattle ALT.NET Open Space events.) If you’re not familiar with the Open Spaces concept, you can read about How Open Spaces Works. It’s not your typical conference. Prepare to be surprised.

The event is being organized by Kyle “Living in the Bahamas is Tough” Baley, James “That’s Godfather to You” Kovacs, Dave “Goats are Cool” Woods, Donald “Where’s My Scotch” Belcham, Terry “Best Hair in Canada” Thibodeau, Bil “Microsoft Vice President” Simser, Greg “Three D’s Ain’t Enough” Young, and Justice “Metrosexual Developers are Hot” Gray.

Space is limited! REGISTER NOW and join the conversation!

American_Beaver Eland-02

* No beavers or moose were harmed in the production of this blog post. (The egos of organizers are another matter entirely.)

Many people have asked over the past few months whether I will be offering a public course on NHibernate. The answer is now “Yes!” and it will be debuting in Calgary in August.

If you’re interested in OR/M with NHibernate and can’t come to Calgary, then maybe the course can come to you! Email me for more information on bringing the course to your city. I also offer this course privately if your company prefers that format. Once again, email me for more information.

If you’re interested, you can register for the Calgary course here (credit card). Please email me directly if you wish to pay via purchase order.

Object-Relational Mapping with NHibernate

Location The Westin Calgary
320 4th Avenue SW
Calgary, AB T2P 2S6
(map)
Dates Tuesday, August 26, 2008 to Thursday, August 28, 2008

Overview

Object-relational Mapping with NHibernate is an intensive 3-day course designed to introduce students to the core concepts of object-relational mapping (OR/M), such as querying and persisting objects to a relational database and mapping objects, collections, and inheritance relationships. The course will cover querying with the Hibernate Query Language (HQL) and the Criteria API. Students will learn how NHibernate encapsulates data access using the identity map and unit of work patterns, lazy loading, persistence by reachability, and automatic dirty checking. Advanced topics will be covered as student interest and time permit, including how and when to use the NHibernate’s 2nd level cache, building a persistence layer using the repository pattern, batching operations with multicriteria and multiqueries, and querying with LINQ to NHibernate.

Topics

  • Introduction to O/RM
  • Configuring NHibernate
  • Mapping Basics
    • Mapping primary keys
      • PK Types – Native, Identity, Guid, GuidComb, Sequence, HiLo
      • Composite Keys and why you shouldn’t use them
    • Mapping Fields and Properties
  • Querying Basics
    • ISession.Load/Get
    • hibernate.show_sql
  • Mapping Components
  • Schema generation
    • Using SchemaExport to create/update your database schema
    • Adding additional mapping attributes
  • The CUD in CRUD
    • Persistence by reachability
    • ITransaction
  • Mapping Relationships and Collections
    • One-to-one, one-to-many, and many-to-many
    • Handling cascades
    • Understanding Inverse=true
    • Lazy loading
    • Avoiding the N+1 SELECT problem
  • Mapping Inheritance hierarchies
    • Concrete table inheritance (table per concrete class with complete columns)
    • Single table inheritance (uses descriminator column and all possible columns)
    • Class table inheritance (aka table per class with diff of columns)
  • Advanced Querying
    • Querying with Hibernate Query Language (HQL)
    • Querying with the Criteria API
    • Projections
  • Optional Advanced Topics
    • Multicriteria and multiqueries
    • Future queries
    • Advanced querying with native SQL
    • NHibernate with sprocs
    • LINQ to NHibernate
    • Implementing a query govenor
    • Abstracting the persistence layer with unit of work
    • Optimizing database access with the level 2 cache

Requirements

  • Familiarity with C# and .NET Framework
  • Laptop with Visual Studio 2005 or 2008 and SQL Server 2005 Developer or Express installed

Included in the cost is:

  • 3-days of intensive training on NHibernate
  • Screencasts recorded during the course for easy review
  • NHibernate in Action by Kuate, et al. (ebook)
  • ReSharper 4.0 Personal License
  • All code examples created throughout the course