October 2007 Archives

Windows Keyboard Shortcuts

October 23, 2007

I've always been a fan of keyboard shortcuts, using them whenever possible. Today I accidentally pressed the Windows key and D at the same time — and suddenly found that my whole desktop was revealed. How did I not know about this? A quick search led me to a great page with another 8-10 shortcuts I didn't previously know. Now you too can be enlightened about the many uses of the Windows key.

Sanitize Your Database Inputs!

October 10, 2007


From www.xkcd.org

That's reason number 1 to use stored procedures in your application code — they automatically sanitize your SQL (assuming you aren't dynamically executing statements inside the procedure).

Stephen's top 4 reasons for using stored procedures rather than inline SQL:

Passing Objects Does Not Require 'ref'

October 2, 2007

I'm willing to admit that I made a mistake, and I share this now for your reference (no pun intended): in C#, your basic data types (int, string, short, bool) are value-types. If you want to pass them to a method and have the original value updated, instead of a copy, then you must pass them with the ref or out keywords. But not so with reference-types (hence the name!), which includes classes.

One gray area: what to with structs. That last link says: "when a struct is passed to a method, a copy of the struct is passed, but when a class instance is passed, a reference is passed." So there you have it. Definitely pays to know the differences between C# and C++!