February 2012

You are browsing the site archives for February 2012.

Sometimes you want to step into Source Code which comes from the core components of Microsoft. You can either decompile the .Net Libraries with .Net Reflector or ILSpy or use the Microsoft Reference Source Code Packages.

The Reference Source Code allows you to directly lookup the source or even debug into the core components of Microsoft. Just download the Packages you want, install them and you’re done. You now can Debug into (F11) the source or look it up (F12).

Alternative for Visual Studio 2010
Setting up Visual Studio 2010 to step into Microsoft .NET Source Code

Those tags are evaluated during the Render part of the page’s load cycle. See here for more information.

Displaying (<%= … %>)

Displays the given value as a string.

http://msdn.microsoft.com/en-us/library/6dwsdcf5(v=vs.100).aspx

Displaying with Encoding (<%: … %>)

Displays the given value as string but HTML-Encodes it before.

If you’re sure that the given string is already html-encoded, use it like this:
<%: new HtmlString("<strong>HTML that is not encoded</strong>") %>
http://weblogs.asp.net/scottgu/archive/2010/04/06/new-lt-gt-syntax-for-html-encoding-output-in-asp-net-4-and-asp-net-mvc-2.aspx

Data-Binding (<%# … %>)

Those are resolved when the DataBind method of the control or the page is called.

http://msdn.microsoft.com/en-us/library/ms178366.aspx

Server-Side Comments (<%– … –%>)

Used to comment out code/controls which then won’t be processed.

http://msdn.microsoft.com/en-us/library/3207d0e3.aspx

Server-Side Includes (<!– #include file|virtual=”filename” –>)

Used to insert to content of a given file within the current position.

http://msdn.microsoft.com/en-us/library/4acf8afk.aspx

Embedded Code Blocks (<% … %>)

Used to run some code without returning anything.

http://msdn.microsoft.com/en-us/library/ms178135(v=vs.100).aspx

Expressions (<%$ … %>)

Used for expressions instead of code.

http://msdn.microsoft.com/en-us/library/d5bd1tad.aspx

Directives (<%@ … %>)

Specifies settings for the page or imports and such.

http://msdn.microsoft.com/en-us/library/xz702w3e(v=vs.100).aspx

I do need some delegates from time to time (like when using threads in a WinForms App). But I’m too lazy to declare all needed delegates, especially if they have none or only very few parameters.

Luckily, there are some predefined delegates which can be used for that.

Here’s a list of some of those:

EventHandler // Default event callbacks
EventHandler<T> // Default event callbacks with custom parameter (inheriting from EventArgs)
Action<T1, T2, T3, T4> // Function without return value and 0-4 parameters
Func<T1, T2, T3, T4, TResult> // Methos with 0-4 parameters and one result type
Predicate<T> // equivalent to Func<T, bool>

And here’s a very simple example:

private void InvokedClose()
{
	if (InvokeRequired)
	{
		Invoke(new Action(InvokedClose));
	}
	else
	{
		this.Close();
	}
}

I have an (old) Popcorn Hour as my Media Center and I got several Issues from time to time if I try to access my Shares on my pc like “Out of Memory” and such.

It’s actually easy to fix those issues (more or less). Just modify the following keys in the registry on your PC:

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\LanmanServer\Parameters]
"IRPStackSize"=dword:00000039

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\LanmanServer\Parameters]
"MaxNonPagedMemoryUsage"=dword:2000000