Archive for the 'Geek Stuff' Category
This is a handy source for .NET Regular Expressions reference information and samples, as well as a handy test tool.
RegExLib.com (Regular Expression Library)
RegExLib.com Regular Expression Cheat Sheet (.NET RegEx)
March 25 2005 | Geek Stuff | No Comments »
Nothing terribly deep here, but after a long time without writing new code using COM, I had to remember that there’s a GetErrorInfo method. Here’s a quick reminder of how to get more information on a COM method failure.
{
// Snippit… Assume you’ve got a pointer pCOMObject with
// method Foo and that COM is happily initialized, etc…
// The FAILED macro returns true if the HRESULT returned
// by the operation is negative, indicating a failure
if FAILED(pCOMObject->Foo())
DisplayError();
// Don’t forget to clean up
pCOMObject->Release();
CoUninitialize ();
}
DisplayError()
{
LPERRORINFO pErrorInfo=NULL;
// GetErrorInfo returns a pointer to the most recently set
// IErrorInfo pointer in the current logical thread. It also
// transfers ownership of the error object to the caller,
// and clears the error state for the thread.
GetErrorInfo(0,&pErrorInfo);
BSTR strDescription, strSource;
pErrorInfo->GetDescription (&strDescription);
pErrorInfo->GetSource(&strSource);
// Display or log error appropriately, not this way
_tprintf(TEXT(“%s\n”),strDescription);
_tprintf(TEXT(“%s\n”),strSource);
// Clean up
pErrorInfo->Release();
SysFreeString(strDescription);
SysFreeString(strSource);
}
http://blogs.msdn.com/greggm/archive/2004/11/24/269378.aspx – Debugging tips
http://blogs.msdn.com/adam_nathan/archive/2003/06/13/56713.aspx – Gotchas
http://blogs.gotdotnet.com/anathan/PermaLink.aspx/6d021f27-72c8-4420-b6ad-1c5f0690bde8 – Win32/.NET Interop tips
March 25 2005 | Geek Stuff | No Comments »
Once in a while, you’ve just gotta crash to see what’s going on in memory. Somehow, I managed not to know about this handy setting, so I thought I’d pass it along now that I do.
First, ensure that your system is set to create a complete memory dump in the Startup and Recovery (Open Properties on My Computer, Click Advanced, Click Settings in Startup and Recovery, then select “Complete memory dump” in the “Write debugging information” dropdown list).
Then, add the following to your registry (assuming you know what you’re doing in the registry and aren’t going to blame me if you blow things up…this is, after all, about crashing your system).
HKEY_LOCAL_MACHINE\
System\
CurrentControlSet\
Services\
i8042prt\
Parameters
REG_DWORD CrashOnCtrlScroll = 0×1
Then, to force a system crash and memory dump, hold down the right CTRL key and press the ScrLk key twice.
Ta-da, you’ve got a dump and can load up your favorite debugger and see what’s going on.
Happy crashing.
March 22 2005 | Geek Stuff | No Comments »
Euphemos (yoo’-fay-mos);
Word Origin: Greek, Adjective, Strong #: 2163
- sounding well
- uttering words of good omen, speaking auspiciously
Philippians 4:8 Finally, brethren, whatsoever things are true, whatsoever things are honorable, whatsoever things are just, whatsoever things are pure, whatsoever things are lovely, whatsoever things are of good report; if there be any virtue, and if there be any praise, think on these things.
This site is dedicated to those things.
March 20 2005 | Euphemos Blog and Geek Stuff and Jesus Stuff | No Comments »
« Prev