Jayson's profileJayson GoPhotosBlogListsMore Tools Help

Jayson Go

Challenging height since 1978

Jayson Go

Occupation
Location
Interests
Captive only to my own boundaries, this life is a journey.
Bound by the everchanging, these ideas become restraints.
I device not for a break, but a sweet escape beyond.
No list items have been added yet.
A list of different noteable milestones in my pathetic running career :)

Questions I've Asked

This user currently is not registered with Windows Live QnA account. Click here to learn more and get started.
There are no photo albums.

Teamballz @ Quakecon 2005

 
December 11

Need to know the size of your .NET object?

I was doing some research on a question posted on an MSDN Forum [1] about how to determine the size of an object and I was able to find out how to do it.  This method will allow you to determine the size of your object while debugging your application with Visual Studio.
 
Enter the SOS Debugging Extension [2].  This library will allow you to determine the size of your managed object (among many other things).
So how do you do it?  Here are a few steps on how to do it:
 
1. Load your project into Visual Studio and ensure that 'Enabled unmanaged code debugging' is checked (see Project Settings, Debug tab).  This is unchecked by default and my guess is, there's a reason for it, so I would suggest turning it back off when you're finished.
 
2. Load the SOS Debugging Extension by opening your Immediate Window and typing .load sos.dll.  I did not have any problems doing this but if for some reason or another you don't have the sos.dll on your machine, you may need to download and install the Debugging Tools [3].
 
3. Place appropriate breakpoint(s) in your application and debug it.  Once you hit a breakpoint, determine the memory location of your object.  To do this, open a Memory window by going to Debug->Windows->Memory->Memory 1.  Highlight the variable for your object and drag it into the memory window.  When you do so, the Address should be available.  Copy it to your clipboard (unless you like to typing).
 
4. In your immediate window, type !ObjSize <address>, where <address> is the address of your object you got from step 3.  The command should output something like:
 
!ObjSize 0x013689e0
sizeof(013689e0) = 16 ( 0x10) bytes (System.Object[])

 

And that should give you the information you wanted.

Credits:
- Channel9 thread [4]
- Links posted by TommyCarlier [5][6]

Hope this helps!

 

December 09

Exceptions

Here's a very interesting read on how to approach exception handling for an application:
 
 
I especially love the section about Vexing Exceptions:

Vexing exceptions are the result of unfortunate design decisions. Vexing exceptions are thrown in a completely non-exceptional circumstance, and therefore must be caught and handled all the time.

The classic example of a vexing exception is Int32.Parse, which throws if you give it a string that cannot be parsed as an integer. But the 99% use case for this method is transforming strings input by the user, which could be any old thing, and therefore it is in no way exceptional for the parse to fail. Worse, there is no way for the caller to determine ahead of time whether their argument is bad without implementing the entire method themselves, in which case they wouldn't need to be calling it in the first place.

This unfortunate design decision was so vexing that of course the frameworks team implemented TryParse shortly thereafter which does the right thing.

You have to catch vexing exceptions, but doing so is vexing.

Try to never write a library yourself that throws a vexing exception.

 
August 12

Command Prompt from Windows Explorer

Have you ever wanted to launch the Command Prompt from a specific folder in Windows Explorer?  Working with more command-line type of tools with my current company has prompted more of this behavior in my day to day tasks.
 
There may be a number of ways to do this, for example, PowerToys DosHere (do a search for it).
However, if you want to do it manually, you can perform these few steps.
 
1. Launch Windows Explorer.
2. On the main menu, go to 'Tools->Folder Options' and then navigate to the 'File Types' tab.
3. The list of file types you see have two columns: 'Extensions' and 'File Types'.  Look for an extension of "(NONE)" and a File Type of "Folder" and select that entry.
4. Click the 'Advanced' button.  An 'Edit File Type' dialog will pop up.
5. Click 'New...' and a 'New Action' dialog will pop up.
6. Under 'Action', call it what you want.  For example, "Command Prompt" (w/o the quotes).
7. Under 'Application used to perform action', enter in "C:\Windows\System32\Cmd.exe /k cd" (w/o the quotes).
8. Click OK to get out of all the dialogs.
9. Done.  Now, when you right click any folder, you should see your new action.  In these steps, I used "Command Prompt".  Clicking the new action will open Cmd.exe with a default directory of the folder you clicked from Windows Explorer.
 
CommandPrompt
 
 
Final Note:
If you ever need to remove this or modify the settings, you will have to delete the appropriate key from the Registry.  Typical "Registry Disclaimer" applies here so don't try this if you're not comfortable messing with the Registry.
 
The registry location is:
HKCR/Folder/shell/<action name>
where <action name> is the Action Name you gave it from step #6.
 
To remove, delete the <action name> key.
To rename, rename the <action name> key.
To modify the command, go to <action name>/command and modify the (Default) String value.
July 24

Am I Back?

Well, I've been away from Spaces for a while, but I think I will start getting on here a bit more.  Why?  I have no clue.  Call it build up and a need to release.  Call it a life with things happening and this being a the medium of choice.  Call it what you may but I think I'm back.
October 31

Windows Media Player 11 Released

Wow, I'm getting tired blogging about all these newly released apps from Microsoft... should I even keep doing this?  Well, I only blog about apps that I like ;)
 
Anyways, I've been using MP11 Beta1 and 2 and they have been okay.  I definitely saw some quirkiness with Beta2 but I think it was an isolated case and haven't seen it occur since.  Well, without further ado, Microsoft has released Media Player 11.  Go get your copy!
 
 
 

Hey everyone!  Come sign my guest book!

Please wait...
Sorry, the comment you entered is too long. Please shorten it.
You didn't enter anything. Please try again.
Sorry, we can't add your comment right now. Please try again later.
To add a comment, you need permission from your parent. Ask for permission
Your parent has turned off comments.
Sorry, we can't delete your comment right now. Please try again later.
You've exceeded the maximum number of comments that can be left in one day. Please try again in 24 hours.
Your account has had the ability to leave comments disabled because our systems indicate that you may be spamming other users. If you believe that your account has been disabled in error please contact Windows Live support.
Complete the security check below to finish leaving your comment.
The characters you type in the security check must match the characters in the picture or audio.