Thursday, July 06, 2006

Tutorial - NHibernate and VS2005 - Part 0

Ok, maybe I'm just dumber than the average bear, but I just couldn't get NHibernate working.

I tried several beginner level tutorials, but still nothing.

Mind you I was trying the lastest alpha release (1.2.0 alpha 1).

And I was trying to hook up to Access 2003 as a back end which adds it's own complexity.

So, I figured I'd go back to First Principles. All of the tutorials use SQL Server 2005 which I have as part of Visual Studio 2005 Standard.

I still wanted to stick with the alpha, not sure why, but hey, I am a geek afterall. Fortunately I found a link with some of the magic.

Next, I figured I'd dumb it right down. 1 table, 2 columns. If I can't get that working then I probably should've gone into a different line of work.

That's enough for the preamble. Next, I'll actually start cutting some code.

[Listening to (via Pandora): Garbage - When I Grow Up]

Wednesday, April 26, 2006

Checking file contents using Subversion Hooks

I found lots of examples of verifying checkin comments using Subversion commit hooks but nothing which showed me how to validate the contents of the file.

In my case I want to make sure that I'm not checking in any unit test files that have classes decorated with [CurrentFixture]. FYI I use MbUnit for my unit tests.

Using perl or shell scripts would be relatively easy but I wanted to do things the batch file way. Not sure why. Something repressed from my childhood no doubt.

I'm "sure" there's an easier way even using batch files but here's what I came up with. In the hooks directory in your Subversion repository edit the pre-commit.bat file like so:

set REPOS=%1
set TXN=%2
set FIXQUOTES=c:\util\FixQuotes
set PROJECTROOT=G:\Projects\VolMan

for /F "usebackq tokens=2" %%f in (`svnlook changed -t "%TXN%" "%REPOS%"`) do (
for /F "usebackq" %%x in (`%FIXQUOTES% %%f`) do (
for /F "usebackq" %%g in (`findstr /LM "[CurrentFixture]" %PROJECTROOT%\%%x`) do (
if not x%%g==x (
echo Cannot check in a file containing a class decorated with [CurrentFixture] 1>&2
exit 1
)
)
)
)


* - the output of svnlook has forward slashes '/' instead of the dos-friendly backslashes '\' which caused findstr to puke. I needed to create a cheeseball little app FixQuotes to flip all forward slashes to backslashes. Here's where perl/shell script would've made things trivial.

It's sooo yucky to hardcode the path to FixQuotes and the root of the project too. But c'est la vie.

If anyone has an easier way pleeease tell me.

[Listening to: Staple - The Day the Blind Revolted]

del.icio.us killed my blog!

Ever since I "found" del.icio.us I have had nothing to blog about. Well, that and my never before heights of laziness.

All of my old "ditto" blog entries ended up just getting tagged instead of blogged about. Not that there's really anyone who reads this (at least yet [fingers crossed]).

I have however recently dusted off my compiler and fired up my last project. Naturally it has nothing to do with Hookup as I'm pretty sure that Windows Workflow Foundation has put an end to my aspirations.

No, I'm heading along a much more reasonable path to world domination (I'd settle for domination of my basement mind you.)

I'm writing a simple app to maintain volunteer information for a race since I know a bit about that.

Hopefully this lasts.

Damn you del.icio.us

[Listening to (via Pandora): Pantera - It Makes Them Disappear]

Monday, October 03, 2005

Rude AppDomain unloads

Joe Duffy has a post on avoiding and surviving rude AppDomain unloads. This is a useful post and all, but the highpoints are the following 2 quotes:

... if you piss SQL Server off by taking too long in one of your finally blocks (for example), it will get a tad snippy
and:
It uses a great method RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup located in the System.Runtime.CompilerServices namespace. We call it SRCSRHECWGC—pronounced “shreek shreck woogy-cuck”—for short around here.
Mmmm shreek shreck woogy-cuck.

[Listening to: Eminem - Kids]

Friday, September 23, 2005

Sizing memory for virtual machines appropriately

The Virtual PC Guy doles out some guidelines for appropriately sizing memory of virtual machines

I had always (mistakenly) believed that I should be throwing as much memory at my VPC as possible. I have 1.5GB of which I have 1GB given to VPC. Prior to that I had 512MB with 256MB for VPC which was quite slow. Even with more memory I haven't noticed a huge performance gain. Perhaps I've just been starving out my host system.

Good thing the memory was cheap.

[Listening to: Powerman 5000 - Son of X-51]

Monday, September 12, 2005

Shared Services

From Larry Osterman - a description of
Shared Services and why they're important.

I gotta play with this some day.

Updated: Larry posted a second entry on a clever trick to debug shared services. In a nutshell:

Split a shared service into it's own:
C:\>sc config type= own
And put it back again:
C:\>sc config type= share
[Listening to: Black Sabbath - Trashed]

Wednesday, September 07, 2005

On Threads and WinDBG|SOS

Yun Jin posted a series of articles on Thread, System.Threading.Thread, and !Threads that you can find here:


[Listening to Sister Sledge - He's the Greatest Dancer]

[Ed: 7-Aug-2006 - Finally fixed goofy list formatting]

Tuesday, September 06, 2005

Thank you Scott for getting rid of those #$@#$! binding logs

For months now I kept getting assembly binding info being dumped into my c:\temp directory for every .NET executable on my machine. As I use c:\temp for (surprisingly enough) temporary files it was getting quite aggrevating having to constantly delete all those .exe directories.

I vaguely remember enabling this but I couldn't remember/find what I had done so I could shut it off.

Fortunately, I happened across this blog entry from Scott Hanselman about assembly binding redirects which pointed me to the right place:

Change the registry value HKLM\Software\Microsoft\Fusion\ForceLog to 0.

Soooo much quieter. Ahhh.

[Listening to: Kiss - Cold Gin]

Monday, August 22, 2005

Wednesday, August 17, 2005

Magic Numbers for Debugging Memory troubles

I got tired of searching for this each time I needed to so here it is -- the magic memory values when using the debug heap in Microsoft Visual C++ 6.0, 2003 and presumably 2005.

Culled from here and here.

0xBAADF00D -- Allocated by HeapAlloc, not yet used by malloc
0xCDCDCDCD -- Allocated but uninitialized
0xFDFDFDFD -- No mans land. Surrounds allocated block
0xABABABAB -- 2 words following allocated block's no mans land
0xDDDDDDDD -- In the process of being freed.
0xFEEEFEEE -- Freed

[Listening to: Kittie - Suck (Live)]