Technical blog discussing various programming languages, frameworks and paradigms. Code snippets and projects are also provided.
Thursday, 19 November 2009
DIV Layout with CSS (Table vs. DIV Layout)
http://www.devarticles.com/c/a/Web-Style-Sheets/DIV-Based-Layout-with-CSS/
Add User Controls to an ASP.NET page
http://msdn.microsoft.com/en-us/library/5d0t5fak(VS.71).aspx
Friday, 13 November 2009
onclick vs. onmousedown and onmouseup
Thursday, 29 October 2009
WPF - StaticResource vs. DynamicResource
Static resources are resolved at compile time, whereas dynamic resources are resolved at runtime.
Use DynamicResources when the value of the resource could change during the lifetime of the Application.
Use StaticResources when it’s clear that you don’t need your resource re-evaluated when fetching it – static resources perform better than dynamic resources.
Monday, 14 September 2009
ASP.NET - VIEWASTEXT Attribute
Example:
<object id=factory style="display:none"
classid="clsid:1663ed61-23eb-11d2-b92f-008048fdd814"
codebase="smsx.cab#Version=6,5,439,30 VIEWASTEXT>
<param name="template" value="MeadCo://IE7" />
</object>
Friday, 11 September 2009
Error MSB4019: The imported project "C:\Microsoft.CSharp.targets" was not found.
I usually receive this error when attempting to import a .NET 3.5 project into a .NET 2.0 solution.
To tackle this particular scenario, you will need to open the project file (.csproj).... and if you wish to make the project .NET 2.0 ready, you will need to find the following line (specific to 3.0/3.5)...
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />and replace with...
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />Thursday, 10 September 2009
Visual Studio Debug Problem (Debugger Detaching)
This is usually because VS gets confused regarding which isntance of IE to detach itself to... goto into Task Manager and see if there are any iexplore processes running that do not have a window handle. If so, end them and re-try...
If not, take a look at this post regarding new features introduced with IE8 that can cause this issue...
http://weblogs.asp.net/abdullaabdelhaq/archive/2009/06/01/VS-Debug-Problem-with-IE8.aspx
Friday, 4 September 2009
C# Conditional Operator ( ?: ) and Null-Coalescing Operator ( ?? )
Often times in code you want to assign one variable to another, but only if the variable is not null. If it is null, you want to populate the target variable with another ( perhaps default ) value. The code normally may look like this using the C# Conditional Operator:
string fileName = tempFileName !=null ? tempFileName : "Untitled;
If tempFileName is not null, fileName = tempFileName, else fileName = “Untitled“.
This can now be abbreviated as follows using the Null-Coalescing Operator:
string fileName = tempFileName ??"Untitled";
The logic is the same. If tempFileName is not null, fileName = tempFileName, else fileName = “Untitled“.
The Null-Coalescing Operator comes up a lot with nullable types, particular when converting from a nullable type to its value type:
int? count = null;
int amount = count ?? default(int);
Since count is null, amount will now be the default value of an integer type ( zero ).
These Conditional and Null-Coalescing Operators aren't the most self-describing operators :), but I do love programming in C#!
Thursday, 3 September 2009
C# - Difference between 'out' and 'ref'
private void ModifyByFive(ref int number)
{number += 5;
}
private void ModifyByFive(out int number)
{number += 5;
}
Tuesday, 1 September 2009
Registering a DLL as an MSI Custom Action
Dim WshShell
Set WshShell = CreateObject("Wscript.Shell")WshShell.run "regsvr32 /s DLLFILENAME.dll" Set WshShell = nothing
Dim WshShell
Set WshShell = CreateObject("Wscript.Shell")WshShell.run "regsvr32 /u/s DLLFILENAME.dll Set WshShell = nothing