<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>

<channel>
	<title>Lars-Erik Kindblad</title>
	<atom:link href="http://www.kindblad.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.kindblad.com</link>
	<description>Writing about programming, Buddhism &#38; life</description>
	<pubDate>Sat, 06 Mar 2010 07:42:39 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5.1</generator>
	<language>en</language>
			<item>
		<title>How to get Fiddler to work under Windows 7</title>
		<link>http://www.kindblad.com/2010/02/28/how-to-get-fiddler-to-work-under-windows-7/</link>
		<comments>http://www.kindblad.com/2010/02/28/how-to-get-fiddler-to-work-under-windows-7/#comments</comments>
		<pubDate>Sun, 28 Feb 2010 10:05:54 +0000</pubDate>
		<dc:creator>Lars-Erik Kindblad</dc:creator>
		
		<category><![CDATA[Other software]]></category>

		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://www.kindblad.com/?p=75</guid>
		<description><![CDATA[If you try to trace your web applications using Fiddler with default settings under Windows 7, you will get the following error in your browser:
[Fiddler] Connection to localhost. failed.
Exception Text: No connection could be made because the target machine actively refused it ::1:80
This can be fixed by disabling IPv6 in Fiddler:
1. Go to Fiddler, then [...]]]></description>
			<content:encoded><![CDATA[<p>If you try to trace your web applications using <a href="http://www.fiddlertool.com/" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://www.fiddlertool.com/');">Fiddler</a> with default settings under Windows 7, you will get the following error in your browser:</p>
<pre><code>[Fiddler] Connection to localhost. failed.
Exception Text: No connection could be made because the target machine actively refused it ::1:80</code></pre>
<p>This can be fixed by disabling IPv6 in Fiddler:</p>
<pre><code>1. Go to Fiddler, then Tools &gt; Fiddler Options.
2. Uncheck "Enable IPv6 (if available)".</code></pre>
<p>Tracing should now work.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.kindblad.com/2010/02/28/how-to-get-fiddler-to-work-under-windows-7/feed/</wfw:commentRss>
		</item>
		<item>
		<title>How to get Fiddler to trace localhost traffic</title>
		<link>http://www.kindblad.com/2010/02/28/how-to-get-fiddler-to-trace-localhost-traffic/</link>
		<comments>http://www.kindblad.com/2010/02/28/how-to-get-fiddler-to-trace-localhost-traffic/#comments</comments>
		<pubDate>Sun, 28 Feb 2010 09:40:46 +0000</pubDate>
		<dc:creator>Lars-Erik Kindblad</dc:creator>
		
		<category><![CDATA[Other software]]></category>

		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://www.kindblad.com/?p=73</guid>
		<description><![CDATA[Fiddler is a great tool for tracing the HTTP traffic for your web applications. However, if you try to trace http://localhost/ you will see that it does not work. This can be fixed by either using the machine name or adding a dot at the end of the localhost address:
http://mycomputername/
or
http://localhost./
]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.fiddlertool.com/" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://www.fiddlertool.com/');">Fiddler</a> is a great tool for tracing the HTTP traffic for your web applications. However, if you try to trace http://localhost/ you will see that it does not work. This can be fixed by either using the machine name or adding a dot at the end of the localhost address:</p>
<pre><code>http://mycomputername/</code></pre>
<p>or</p>
<pre><code>http://localhost./</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://www.kindblad.com/2010/02/28/how-to-get-fiddler-to-trace-localhost-traffic/feed/</wfw:commentRss>
		</item>
		<item>
		<title>A generic FindControl extension method</title>
		<link>http://www.kindblad.com/2010/02/10/a-generic-findcontrol-extension-method/</link>
		<comments>http://www.kindblad.com/2010/02/10/a-generic-findcontrol-extension-method/#comments</comments>
		<pubDate>Wed, 10 Feb 2010 00:01:26 +0000</pubDate>
		<dc:creator>Lars-Erik Kindblad</dc:creator>
		
		<category><![CDATA[ASP.NET]]></category>

		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://www.kindblad.com/?p=70</guid>
		<description><![CDATA[In order to clean up and make our code more readable, generics and extension methods comes in very handy. In ASP.NET, the Control class has a FindControl method which is used as follows:
((TextBox) Page.FindControl("TxtName")).Text = "Some name";
Since this method returns a Control type, we must cast it to it&#8217;s actual type before we can access [...]]]></description>
			<content:encoded><![CDATA[<p>In order to clean up and make our code more readable, generics and extension methods comes in very handy. In ASP.NET, the Control class has a FindControl method which is used as follows:</p>
<pre><code>((TextBox) Page.FindControl("TxtName")).Text = "Some name";</code></pre>
<p>Since this method returns a Control type, we must cast it to it&#8217;s actual type before we can access any of it&#8217;s members. A way to improve this code, is to create a new generic FindControl method. Since all the controls in ASP.NET such as Page, Button, TextBox, inherits from the Control class, we can make this method an extension method. By doing this, our method can be accessed the same way as the non-generic FindControl method:</p>
<pre><code>Page.FindControl&lt;TextBox&gt;("TxtName").Text = "Some name";</code></pre>
<p>This code is tidier and easier to read. Here is the code for the extension method:</p>
<pre><code>public static class ControlExtensions
{
	public static T FindControl&lt;T&gt;(this System.Web.UI.Control control, string id)
		where T : System.Web.UI.Control
	{
		return (T) control.FindControl(id);
	}
}</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://www.kindblad.com/2010/02/10/a-generic-findcontrol-extension-method/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Always wire your events in the code behind, NOT in the aspx/ascx template file</title>
		<link>http://www.kindblad.com/2010/02/09/always-wire-your-events-in-the-code-behind-not-in-the-aspxascx-template-file/</link>
		<comments>http://www.kindblad.com/2010/02/09/always-wire-your-events-in-the-code-behind-not-in-the-aspxascx-template-file/#comments</comments>
		<pubDate>Tue, 09 Feb 2010 22:18:17 +0000</pubDate>
		<dc:creator>Lars-Erik Kindblad</dc:creator>
		
		<category><![CDATA[ASP.NET]]></category>

		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://www.kindblad.com/?p=71</guid>
		<description><![CDATA[With ASP.NET you can wire your events in the aspx/ascx template file or in the code behind file. If you wire your events in the template file, you will not get compile time support. This means that if a method is renamed or removed without updating the template file, the compiler will not throw an [...]]]></description>
			<content:encoded><![CDATA[<p>With ASP.NET you can wire your events in the aspx/ascx template file or in the code behind file. If you wire your events in the template file, you will not get compile time support. This means that if a method is renamed or removed without updating the template file, the compiler will not throw an error. However, if the event is wired in the code behind, an error will be thrown. Events should therefore always be wired in the code behind.</p>
<p>Template file event wiring - not recommended:</p>
<pre><code>&lt;asp:Button runat="server" ID="BtnSave" OnClick="Save" Text="Save" /&gt;</code></pre>
<p>Code behind event wiring - recommended:</p>
<pre><code>protected override void OnInit(EventArgs e)
{
	base.OnInit(e);

	BtnSave.Click += new EventHandler(Save);
}</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://www.kindblad.com/2010/02/09/always-wire-your-events-in-the-code-behind-not-in-the-aspxascx-template-file/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Goals for 2010</title>
		<link>http://www.kindblad.com/2010/01/01/goals-for-2010/</link>
		<comments>http://www.kindblad.com/2010/01/01/goals-for-2010/#comments</comments>
		<pubDate>Fri, 01 Jan 2010 14:00:53 +0000</pubDate>
		<dc:creator>Lars-Erik Kindblad</dc:creator>
		
		<category><![CDATA[Personal]]></category>

		<guid isPermaLink="false">http://www.kindblad.com/?p=69</guid>
		<description><![CDATA[2009 achievements:

In 2002 I was offered a job as a developer just before finishing a college degree in computer science. I finished the college degree, but later regretted that I didn&#8217;t finish at least a Bachelor degree. 1,5 years ago I decided it was time to get the degree. I took the subjects needed part [...]]]></description>
			<content:encoded><![CDATA[<p><b>2009 achievements:</b></p>
<ul>
<li>In 2002 I was offered a job as a developer just before finishing a college degree in computer science. I finished the college degree, but later regretted that I didn&#8217;t finish at least a Bachelor degree. 1,5 years ago I decided it was time to get the degree. I took the subjects needed part time, as I still had my full time job. My last exam was finished in December. Feels great!</li>
<li>Learned and worked intensively with Windows Communication Foundation (WCF) and SOA architecture both at my full time job and as part of my Bachelor thesis.</li>
<li>Learned and used Test Driven Development (TDD) together with principles and design patterns optimized for this such as SOLID principles with dependency injection (DI) and dependency injection containers (IOC). My preferable IOC so far has been Castle Windsor.</li>
<li>Slowly started with jQuery.</li>
</ul>
<p><b>Goals for 2010:</b></p>
<ul>
<li>Learn ASP.NET MVC.</li>
<li>Learn object oriented JavaScript, Microsoft AJAX and jQuery.</li>
<li>Learn the basics of Silverlight.</li>
<li>Get up to date on the ADO.NET Entity Framework and NHibernate.</li>
<li>Write two blog posts per month.</li>
<li>Read a new technology book every 3 months.</li>
<li>Improve on creating loosely coupled architecture.</li>
<li>Create 3 new open source projects and contribute to 1 existing open source project.</li>
<li>Become a Microsoft Certified Professional Developer (MCPD).</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.kindblad.com/2010/01/01/goals-for-2010/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Placing HTML elements on top of the ModalPopupExtender control</title>
		<link>http://www.kindblad.com/2009/12/14/placing-html-elements-on-top-of-the-modalpopupextender-control/</link>
		<comments>http://www.kindblad.com/2009/12/14/placing-html-elements-on-top-of-the-modalpopupextender-control/#comments</comments>
		<pubDate>Mon, 14 Dec 2009 22:10:34 +0000</pubDate>
		<dc:creator>Lars-Erik Kindblad</dc:creator>
		
		<category><![CDATA[ASP.NET]]></category>

		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://www.kindblad.com/?p=68</guid>
		<description><![CDATA[If you want a HTML element to always be on top of the ModalPopupExtender control, give the element the CSS z-index value 99999998.
]]></description>
			<content:encoded><![CDATA[<p>If you want a HTML element to always be on top of the ModalPopupExtender control, give the element the CSS z-index value 99999998.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.kindblad.com/2009/12/14/placing-html-elements-on-top-of-the-modalpopupextender-control/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Find the mouse x, y position with JavaScript using jQuery</title>
		<link>http://www.kindblad.com/2009/12/14/find-the-mouse-x-y-position-with-javascript-using-jquery/</link>
		<comments>http://www.kindblad.com/2009/12/14/find-the-mouse-x-y-position-with-javascript-using-jquery/#comments</comments>
		<pubDate>Mon, 14 Dec 2009 21:39:16 +0000</pubDate>
		<dc:creator>Lars-Erik Kindblad</dc:creator>
		
		<category><![CDATA[JavaScript]]></category>

		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://www.kindblad.com/?p=67</guid>
		<description><![CDATA[This is how you find the mouse x, y position with JavaScript using jQuery:
var _mouseX = 0;
var _mouseY = 0;

jQuery(document).ready(function()
{
	$().mousemove(function(e)
	{
		_mouseX = e.pageX;
		_mouseY = e.pageY;
	});
})
The variables _mouseX and _mouseY will at all times have the updated mouse coordinates.
]]></description>
			<content:encoded><![CDATA[<p>This is how you find the mouse x, y position with JavaScript using jQuery:</p>
<pre><code>var _mouseX = 0;
var _mouseY = 0;

jQuery(document).ready(function()
{
	$().mousemove(function(e)
	{
		_mouseX = e.pageX;
		_mouseY = e.pageY;
	});
})</code></pre>
<p>The variables _mouseX and _mouseY will at all times have the updated mouse coordinates.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.kindblad.com/2009/12/14/find-the-mouse-x-y-position-with-javascript-using-jquery/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Test your WCF services using the WCF Test Client</title>
		<link>http://www.kindblad.com/2009/10/18/test-your-wcf-services-using-the-wcf-test-client/</link>
		<comments>http://www.kindblad.com/2009/10/18/test-your-wcf-services-using-the-wcf-test-client/#comments</comments>
		<pubDate>Sun, 18 Oct 2009 20:10:14 +0000</pubDate>
		<dc:creator>Lars-Erik Kindblad</dc:creator>
		
		<category><![CDATA[Technology]]></category>

		<category><![CDATA[WCF]]></category>

		<guid isPermaLink="false">http://www.kindblad.com/?p=65</guid>
		<description><![CDATA[Shipped with Microsoft Visual Studio is an application called the WCF Test Client (C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\WcfTestClient.exe). This application can be used to test the methods/operations of any WCF service.
In the application, do File > Add Service, enter the service URL and click OK. You will now see the available service operations. Click on [...]]]></description>
			<content:encoded><![CDATA[<p>Shipped with Microsoft Visual Studio is an application called the WCF Test Client (C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\WcfTestClient.exe). This application can be used to test the methods/operations of any WCF service.</p>
<p>In the application, do File > Add Service, enter the service URL and click OK. You will now see the available service operations. Click on any operation, enter a value for each parameter and click Invoke. The result will be displayed in the response frame.</p>
<p><img src="http://www.kindblad.com/wp-content/uploads/2009/10/wcftestclient.png" alt="WCF Test Client" title="WCF Test Client" width="550" class="alignnone size-full wp-image-66" /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.kindblad.com/2009/10/18/test-your-wcf-services-using-the-wcf-test-client/feed/</wfw:commentRss>
		</item>
		<item>
		<title>A recursive FindControl extension method</title>
		<link>http://www.kindblad.com/2009/10/04/a-recursive-findcontrol-extension-method/</link>
		<comments>http://www.kindblad.com/2009/10/04/a-recursive-findcontrol-extension-method/#comments</comments>
		<pubDate>Sun, 04 Oct 2009 08:50:49 +0000</pubDate>
		<dc:creator>Lars-Erik Kindblad</dc:creator>
		
		<category><![CDATA[ASP.NET]]></category>

		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://www.kindblad.com/?p=64</guid>
		<description><![CDATA[The System.Web.UI.Control class has a FindControl method for finding a control by its ID. This method searches for a given control in the first level child controls, and not in any child controls of a child. In order to do the latter, a custom method must be implemented. Below is a generic, recursive, extension method [...]]]></description>
			<content:encoded><![CDATA[<p>The System.Web.UI.Control class has a FindControl method for finding a control by its ID. This method searches for a given control in the first level child controls, and not in any child controls of a child. In order to do the latter, a custom method must be implemented. Below is a generic, recursive, extension method that does this:</p>
<pre><code>public static class ControlExtension
{
	public static T FindControlRecursive&lt;T&gt;(this Control container, string id)
			where T : Control
	{
		if (container.HasControls())
		{
			T foundControl = null;

			foreach (Control control in container.Controls)
			{
				if (control.ID == id &amp;&amp; control is T)
					foundControl = (T) control;
				else
					foundControl = FindControlRecursive&lt;T&gt;(control, id);

				if (foundControl != null)
					return foundControl;
			}
		}

		return null;
	}
}</code></pre>
<p>Usage:</p>
<pre><code>var control = Page.FindControlRecursive&lt;TextBox&gt;("TxtName");</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://www.kindblad.com/2009/10/04/a-recursive-findcontrol-extension-method/feed/</wfw:commentRss>
		</item>
		<item>
		<title>CSV export to MS Excel, SYLK file error</title>
		<link>http://www.kindblad.com/2009/08/02/csv-export-to-ms-excel-sylk-file-error/</link>
		<comments>http://www.kindblad.com/2009/08/02/csv-export-to-ms-excel-sylk-file-error/#comments</comments>
		<pubDate>Sun, 02 Aug 2009 13:26:24 +0000</pubDate>
		<dc:creator>Lars-Erik Kindblad</dc:creator>
		
		<category><![CDATA[.NET]]></category>

		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://www.kindblad.com/?p=62</guid>
		<description><![CDATA[I just received the following error when creating a CSV formatted file of some report data, and opening it in Microsoft Excel:
Excel has detected that 'xxx.xls', is a SYLK file. Either the file has errors or it is not a SYLK file format. Click OK to try to open the file in a different format.
After [...]]]></description>
			<content:encoded><![CDATA[<p>I just received the following error when creating a CSV formatted file of some report data, and opening it in Microsoft Excel:</p>
<pre><code>Excel has detected that 'xxx.xls', is a SYLK file. Either the file has errors or it is not a SYLK file format. Click OK to try to open the file in a different format.</code></pre>
<p>After some research it turns out this problem occurs if the first two letters in the file content is ID (in uppercase). The only way to get rid of this error message is therefore to not use ID in uppercase (Id, id is ok), or change it to something else.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.kindblad.com/2009/08/02/csv-export-to-ms-excel-sylk-file-error/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
