Logging all SQL from nHibernate

April 16th, 2015

There are several ways to see what queries are used by Nhibernate.

If you are doing serious development I recommend Nhprof. It costs some but it is second to none regarding overview and ease of use. One bug caught and it is paid for. The GUI is a bit clicky but does a good job of providing good S/N ratio.

Sniff the traffic. I have not done this seriously but once wrote an ADO sniffer since there wasn’t any profiler for MsAccess.

There there is tracing the RDB. Possibly gratis or even free, depending on database (I haven’t checked them all, only Microsoft’s one). In my experience it is too noisy to have running during the whole development cycle like one can do with Nhprof.

Then one can use Nhibernate itself to log. Check Nhibernate succinctly, chapter 12, for how to setup Nhibernate with Log4net. If you want to log through another framework the same author wrote an article.

Wrap the logging framework

April 15th, 2015

If you haven’t decided whether to use Log4Net, EnterpriseLibrary, nLog, home baked or any of the other logging frameworks – wrap it or abstract it.

Common.Logging is an “ordinary compiled lib”. It is strongly named with its pros and cons.

LibLog on the other hand is just a file (like Dapper). When developing a lib for public use this might be good to keep fewer dependencies.
The author of LibLog mentioned some pros for LibLog (vs Common.Logging) here. It uses dynamic and Tuple so it is Dotnet4+.

Simple Logging Façade is a compile lib, like Common.Logging.

Keyboard, keyboards, keyboards

March 24th, 2015

I develop programs. I touch type. I use a keyboard extensively.

I don’t take light on keyboards and don’t understand other keyboard jockeys that just use whatever comes with the machine.

I’d love to make my own keyboard.

Here is a the Geekhack forum for DIY and buy.

Software:

I have made my own 1337 keyboard layout that mixes the layout of Us-En (good for programming languages), Swedish (my language of birth) and Azerty (switched numbers/characters in top row).

Hardware:

But until then I keep track of existing. Both ergonomic for extensive use and portable for mobile use.

Waytools Textblade. For mobile use. Blue tooth. Qwerty layout but not totally touch type. From about 100€. Might work.
Id love to get my hands on one to test and review.

Atreus. DIY or order. Ergonomic. Open source. Looks wireless. Looks awesome for typing and hacking. Me want.

Keyboardio home page. is open source and ergonomic. A bit ugly but triggers my want-hormones.

How to open and edit an erx / ER diagram file in Toad

October 21st, 2014

Creating an ER diagram in Toad is simple. Opening is not. Searching the intertoobs gives the result, mostly, to use Toad data modeler. My Toad data modeler version 5.1.1.12 simply refuses to let me add new tables to a diagram.

So here is my solution.
First ditch Toad data modeler.

Create the ER diagram in Toad->menu->Database->Report->ErDiagram.
Manipulate.
Save.

ER diagram menu in Toad.

Open an existing ER diagram through Toad->menu->Database->Report->ErDiagram as above.
But instead of editing look on the ugly toolbar for Open file.
Now one can edit the ER diagram.

Open file button in numerous tool bars in Toad.

How to set up IIS 7.5 to use an Apppool user to connect to Sqlserver

October 6th, 2014

Honor those who should.

Setting up a new Web site and then connecting it to Sqlserver is a breeze if one uses the development web server.
But if one wants to use the real McCoy, i.e. IIS, there is more work.

iis apppool: http://www.selfelected.com/iis-7-iisapppool-lightly-explained/

 

Why use the real IIS when it is so cumbersome?  Because it looks more like the real production environment.

How do I debug?  Like this:

Start Visual studio i in administrator mode. (if one doesn’t, VS is helpful with this)
Then ctrl-alt-p (menu:debug:attach to process) and choose the w3wp.exe process, with the right user name. Attach. Debug.

Copying a virtual machine in hyper-V

October 6th, 2014

Here is some short info. Hyper-Vmanager 2008 I believe.
I also believe one must not have snapshots. The programming here really sucks – having a snapshot stops you from handing the VM.

Stop the source VM machine.

Export source machine. One has to select a folder “one step up” since Server manager will create a folder with the name of the source VM.
Depending on VM size this might take a while and there is no visual clue about how far the copying has come.

If needed: Change the name of the folder of the target files just created. Don’t change anything within the folder structure, just the top folder. This is done in Explorer.
(I really should create a visual example here on which folder goes where. Not hard but easy to miss a step.)

Back to Server manager and Import virtual machine. Set the radio button to Copy the virtual machine. This takes care of syspreping. Don’t bother about duplicate all files; It should be used when many machines are created, not just one extra as in this example.

Importing has a visual clue. It is in its own window, without task bar presence, so if it disappears you might have to minify everything to make it visible.

Now you have to machines with identical names. Not good.
Select and then choose Settings and typically IDEController0 for the one or other to find out which resides in your newly created folder. This is our target VM.
Change the name of this machine.

Now find the folder for the target VM again. Locate the vhd file. Make a copy of it with the right name.

Back to Server manager. Go for Settings and (typically) IdeController0->Virtual hard disk->Browse. Locate the copy you just made. Press ok. Wait.

Now the machine should be startable. Try it.

If ok. Delete the old vhd file.

Get more windows themes online

October 6th, 2014

To spice up the windows desktop background Microsoft has provided an easy way to import new pictures that can be changed every 30 minutes or so. Either search (write) Get more themes online on the start menu or go here in your web browser.

tags: , | categories: Miscellaneous | no comments »

Step recorder

October 6th, 2014

If you want to record what you are doing on your Windows(8?) there is a little program called “Step recorder” that does just this.

With a magical formula it takes snap shots of your screen and saves as a .mht file which can then be opened in a web browser (ie only?).

I use it for instance when manipulating servers and other hairy stuff to record what I was doing. If I need to I can then look for clues why an update didn’t work.

It can also be used for aiding you mom who complains about whatever icon that doesn’t show up when it should. Start Step recorder, let her do her stuff, stop/save Step recorder and then email the resulting file. YMMV

Here is another usage: You have a bug that shows only sometimes. Record what you are doing and wait for the bug to show its face. Look at how you got there in the mht file.

Xpath axes explained

September 15th, 2014

The original article at explains it best.

If the original article goes missing I have copied it here as a web archive.

All kudos goes to the original author, not me.

The following picture from Crane Softwrights demonstrates the axes graphically.

 

What the Hyper-V menus mean

September 15th, 2014

The Microsoft Hyper-V user interface is quite good but the menus are not self explaining when it comes to branching and making snapshots.

Thankfully someone has written down an explanation here. All gratitude should go to the original author.

If the original article goes missing I have copied a web archive here.