Tuesday, March 23, 2010

Cannot Load ...global.asax

Ok, this may not cover every situation where the global.asax file is not able to load, but one thing to check, if annoying and persistent, runtime, global.asax errors are popping up is the build output directory. I had mine set to \bin\Development where it should have been \bin

Nuff said.

Wednesday, March 10, 2010

Easy Reflection

Reflection in .NET, as in Java, is pretty easy (and fun.) It is worth taking an amble down the many classes and tutorials in, and relating to, the System.Reflection namespace.

It is vitally important not to over-use reflection and to be aware that any reflection code probably has a better, non-reflection API somewhere to get the job done.

That said, there are easy mechanisms to get some basic reflection, like calling an empty argument constructor:
Hopefully, I'll flesh this out with some examples and more links to other places, but for now, this will have to do.

Hashing Passwords For Commerce Server

This post generally applies to Commerce Server 2007.

Initially labouring under the impression that CS2k7 used SHA1 or SHA256 (depending on which version is installed)...
I then learnt that we were, in fact, using MD5...
For those who want to know, MD5 is old, SHAn is newer. I believe CNG is the newest mechanism, but is not yet used by CS...

Tuesday, March 09, 2010

The Right Or Wrong Level Of Abstraction

I just have to post this:
I'm doing some encryption-involved work atm and this is particularly relevant.

It's also relevant because I often find myself, usually at the beginning of a project (like, right now), asking me, "What level should I be working and is there an API to do this for me?"

Usually, the answers are, "Don't know" and "No", in that order. Which is annoying but also called, "Life."

Anyway, read that article, the articles linked from it. It be good. Here it is again...

Drive Space Disappearing Captain!

Being very mystified recently that my drive apparently kept filling up, no matter how much space I freed by file deletions, I went on the hunt for any directory et al that might be growing, uncontrolled.

My journey took me to the directory:
  • C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data
Where I found a "nnn_log.ldf" file which was over 50% of my total drive capacity.

Upon opening "SQL Server Management Studio" I found the database in question, opened the Properties dialog and clicked on Files, in the left-hand list of panels. There, under the "Autogrowth" field of the "Database files:" display was a happily chugging "By 10 percent, unrestricted growth".

Simply changing the restricted size to something sensible did not work as hitting Ok threw an error dialog up.

A quick Googling later and this showed up:
So, to get rid of an overly large log file attached to the DB, the process is thus:
  • Take DB offline
  • Detach DB (Untick "Keep Full Text Catalogs", if that is the problem part)
  • Delete the overly large file
  • Re-attach DB, removing the LDF file from the "database details" gridview
  • Click "No" to skip re-attaching the log files/full text catalog (you've deleted it)
  • Open the DB's "Properties -> Files" dialog
  • Under "Autogrowth" click "..."
  • Untick "Enable Autogrowth"
  • Click Ok
For your DB, you should now have removed any overly large files and stopped any existing files from getting any bigger. Of course, if you do need them to grow, just keep an eye on the Autogrowth properties.

Thursday, March 04, 2010

T-SQL InformationSchema.Columns

A handy bit of T-SQL was passed to me today (by @jaminadey) which returns all the fields in a given table which are non-null...
  • SELECT * FROM INFORMATION_SCHEMA.Columns where TABLE_NAME = '' and is_nullable = 'NO'
Of course, you'll see there are lots of other fields which can be inspected, so play around and introspect that DB!