<?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"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>James Boelen</title>
	<atom:link href="http://james.boelen.ca/feed/" rel="self" type="application/rss+xml" />
	<link>http://james.boelen.ca</link>
	<description>Software Developer</description>
	<lastBuildDate>Thu, 09 May 2013 22:02:35 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5</generator>
		<item>
		<title>Simple Log4Net Manager</title>
		<link>http://james.boelen.ca/programming/simple-log4net-manager/</link>
		<comments>http://james.boelen.ca/programming/simple-log4net-manager/#comments</comments>
		<pubDate>Thu, 09 May 2013 22:02:35 +0000</pubDate>
		<dc:creator>James Boelen</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[asp.net]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[log4net]]></category>
		<category><![CDATA[static]]></category>

		<guid isPermaLink="false">http://james.boelen.ca/?p=1404</guid>
		<description><![CDATA[The other day I wanted to use log4net in one of my development applications but didn&#8217;t want to have to create an instance in every class. This little class will do all of the heavy lifting for you. public class LogManager &#123; static LogManager&#40;&#41; &#123; var layout = new PatternLayout&#40;&#34;%date [%level] %logger :: %message%newline&#34;&#41;; var [...]]]></description>
				<content:encoded><![CDATA[<p>The other day I wanted to use log4net in one of my development applications but didn&#8217;t want to have to create an instance in every class. This little class will do all of the heavy lifting for you.</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">class</span> LogManager
    <span style="color: #008000;">&#123;</span>
        <span style="color: #0600FF; font-weight: bold;">static</span> LogManager<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>
        <span style="color: #008000;">&#123;</span>
            <span style="color: #0600FF; font-weight: bold;">var</span> layout <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> PatternLayout<span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;%date [%level] %logger :: %message%newline&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
            <span style="color: #0600FF; font-weight: bold;">var</span> appender <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> RollingFileAppender
            <span style="color: #008000;">&#123;</span>
                File <span style="color: #008000;">=</span> ConfigurationManager<span style="color: #008000;">.</span><span style="color: #0000FF;">AppSettings</span><span style="color: #008000;">&#91;</span><span style="color: #666666;">&quot;Settings.Logging.Path&quot;</span><span style="color: #008000;">&#93;</span>,
                Layout <span style="color: #008000;">=</span> layout
&nbsp;
            <span style="color: #008000;">&#125;</span><span style="color: #008000;">;</span>
            layout<span style="color: #008000;">.</span><span style="color: #0000FF;">ActivateOptions</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
            appender<span style="color: #008000;">.</span><span style="color: #0000FF;">ActivateOptions</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
            log4net<span style="color: #008000;">.</span><span style="color: #0000FF;">LogManager</span><span style="color: #008000;">.</span><span style="color: #0000FF;">GetRepository</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Threshold</span> <span style="color: #008000;">=</span> Level<span style="color: #008000;">.</span><span style="color: #0000FF;">Debug</span><span style="color: #008000;">;</span>
&nbsp;
            BasicConfigurator<span style="color: #008000;">.</span><span style="color: #0000FF;">Configure</span><span style="color: #008000;">&#40;</span>appender<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
        <span style="color: #008000;">&#125;</span>
&nbsp;
        <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #0600FF; font-weight: bold;">static</span> ILog Log 
        <span style="color: #008000;">&#123;</span>
            <span style="color: #0600FF; font-weight: bold;">get</span> <span style="color: #008000;">&#123;</span>
                <span style="color: #0600FF; font-weight: bold;">return</span> log4net<span style="color: #008000;">.</span><span style="color: #0000FF;">LogManager</span><span style="color: #008000;">.</span><span style="color: #0000FF;">GetLogger</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">new</span> StackTrace<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">.</span><span style="color: #0000FF;">GetFrame</span><span style="color: #008000;">&#40;</span><span style="color: #FF0000;">1</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">.</span><span style="color: #0000FF;">GetMethod</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">.</span><span style="color: #0000FF;">DeclaringType</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
            <span style="color: #008000;">&#125;</span>
        <span style="color: #008000;">&#125;</span>
    <span style="color: #008000;">&#125;</span></pre></td></tr></table></div>

<p>Usage:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="csharp" style="font-family:monospace;">LogManager<span style="color: #008000;">.</span><span style="color: #0000FF;">Log</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Info</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;This is an Info message&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span></pre></td></tr></table></div>

<p>My understanding is that the reflection method is not lightweight, so you might want to consider not using this in a production environment.</p>
]]></content:encoded>
			<wfw:commentRss>http://james.boelen.ca/programming/simple-log4net-manager/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WebApi Routes, Optional Parameters &amp; Constraints</title>
		<link>http://james.boelen.ca/programming/webapi-routes-optional-parameters-constraints/</link>
		<comments>http://james.boelen.ca/programming/webapi-routes-optional-parameters-constraints/#comments</comments>
		<pubDate>Mon, 06 May 2013 16:22:14 +0000</pubDate>
		<dc:creator>James Boelen</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[apicontroller]]></category>
		<category><![CDATA[asp.net]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[constraints]]></category>
		<category><![CDATA[optional]]></category>
		<category><![CDATA[parameters]]></category>
		<category><![CDATA[webapi]]></category>

		<guid isPermaLink="false">http://james.boelen.ca/?p=1396</guid>
		<description><![CDATA[Recently while wiring up some Web Api routes for a asp.net MVC application, I learnt that by adding constraints to optional parameters, they no longer are optional.]]></description>
				<content:encoded><![CDATA[<p>Recently while wiring up some Web Api routes for a asp.net MVC application, I learnt that by adding constraints to optional parameters, they no longer are optional.</p>
<p>If I wanted to capture &#8220;api/{controller}/{id}&#8221; I would set up the following route:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="csharp" style="font-family:monospace;">config<span style="color: #008000;">.</span><span style="color: #0000FF;">Routes</span><span style="color: #008000;">.</span><span style="color: #0000FF;">MapHttpRoute</span><span style="color: #008000;">&#40;</span>
        name<span style="color: #008000;">:</span> <span style="color: #666666;">&quot;DefaultApi&quot;</span>,
        routeTemplate<span style="color: #008000;">:</span> <span style="color: #666666;">&quot;api/{controller}/{id}&quot;</span>,
        defaults<span style="color: #008000;">:</span> <span style="color: #008000;">new</span> <span style="color: #008000;">&#123;</span>id <span style="color: #008000;">=</span> RouteParameter<span style="color: #008000;">.</span><span style="color: #0000FF;">Optional</span><span style="color: #008000;">&#125;</span>
    <span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span></pre></td></tr></table></div>

<p>This will capture &#8220;api/dogs&#8221; and &#8220;api/dogs/1&#8243;.</p>
<p>But my co-worker wants to make sure that id&#8217;s are always an integer to keep away pesky internet savvy folks that try to break the application and he doesn&#8217;t trust my controller to do this for us. So he changes the route to:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="csharp" style="font-family:monospace;">config<span style="color: #008000;">.</span><span style="color: #0000FF;">Routes</span><span style="color: #008000;">.</span><span style="color: #0000FF;">MapHttpRoute</span><span style="color: #008000;">&#40;</span>
        name<span style="color: #008000;">:</span> <span style="color: #666666;">&quot;DefaultApi&quot;</span>,
        routeTemplate<span style="color: #008000;">:</span> <span style="color: #666666;">&quot;api/{controller}/{id}&quot;</span>,
        defaults<span style="color: #008000;">:</span> <span style="color: #008000;">new</span> <span style="color: #008000;">&#123;</span>id <span style="color: #008000;">=</span> RouteParameter<span style="color: #008000;">.</span><span style="color: #0000FF;">Optional</span><span style="color: #008000;">&#125;</span>,
        constraints<span style="color: #008000;">:</span> <span style="color: #008000;">new</span> <span style="color: #008000;">&#123;</span>id <span style="color: #008000;">=</span> <span style="color: #666666;">@&quot;\d+&quot;</span><span style="color: #008000;">&#125;</span>
    <span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span></pre></td></tr></table></div>

<p>Suddenly, the route now only captures &#8220;api/dogs/1&#8243; and not &#8220;api/dogs&#8221;. The constraint has overwritten the RoutParameter.Optional on id. While I&#8217;m not sure why the two options conflict, to avoid this, keep constraints off the route config and let the controller do its thing. It&#8217;s pretty good at it.</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #008000;">&#91;</span>HttpGet<span style="color: #008000;">&#93;</span>
    <span style="color: #0600FF; font-weight: bold;">public</span> HttpResponseMessage GetDogs<span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">int</span><span style="color: #008000;">?</span> id <span style="color: #008000;">=</span> <span style="color: #0600FF; font-weight: bold;">null</span><span style="color: #008000;">&#41;</span>
    <span style="color: #008000;">&#123;</span>
        <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span>id<span style="color: #008000;">.</span><span style="color: #0000FF;">HasValue</span><span style="color: #008000;">&#41;</span>
            <span style="color: #0600FF; font-weight: bold;">return</span> JsonNetResult<span style="color: #008000;">.</span><span style="color: #0000FF;">CreateResult</span><span style="color: #008000;">&#40;</span>DogManager<span style="color: #008000;">.</span><span style="color: #0000FF;">GetById</span><span style="color: #008000;">&#40;</span>id<span style="color: #008000;">.</span><span style="color: #0600FF; font-weight: bold;">Value</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
        <span style="color: #0600FF; font-weight: bold;">else</span>
            <span style="color: #0600FF; font-weight: bold;">return</span> JsonNetResult<span style="color: #008000;">.</span><span style="color: #0000FF;">CreateResult</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">new</span> Dog<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>           
    <span style="color: #008000;">&#125;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://james.boelen.ca/programming/webapi-routes-optional-parameters-constraints/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ApiControllers and Binding JSON Data to a Serializable Model</title>
		<link>http://james.boelen.ca/programming/apicontroller-and-ingesting-json-data/</link>
		<comments>http://james.boelen.ca/programming/apicontroller-and-ingesting-json-data/#comments</comments>
		<pubDate>Thu, 18 Apr 2013 15:10:14 +0000</pubDate>
		<dc:creator>James Boelen</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[apicontroller]]></category>
		<category><![CDATA[asp.net]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[httppost]]></category>
		<category><![CDATA[json]]></category>
		<category><![CDATA[serializable]]></category>

		<guid isPermaLink="false">http://james.boelen.ca/?p=1391</guid>
		<description><![CDATA[Not sure why this is, but today I came across an issue with an ApiController ingesting data from an HttpPost method. Apparently, if your model class is marked with the [Serializable] attribute, the method will not bind the post data to the model. If I figure out the reasoning for this. I&#8217;ll update this post. [...]]]></description>
				<content:encoded><![CDATA[<p>Not sure why this is, but today I came across an issue with an ApiController ingesting data from an HttpPost method. Apparently, if your model class is marked with the [Serializable] attribute, the method will not bind the post data to the model. If I figure out the reasoning for this. I&#8217;ll update this post.</p>
<p>Until I can figure out what causes this, the workaround is to create a new model class without that attribute. All of the other class properties can be the same&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://james.boelen.ca/programming/apicontroller-and-ingesting-json-data/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Api Controllers &amp; Query Strings</title>
		<link>http://james.boelen.ca/programming/api-controllers-query-strings/</link>
		<comments>http://james.boelen.ca/programming/api-controllers-query-strings/#comments</comments>
		<pubDate>Wed, 27 Mar 2013 15:27:56 +0000</pubDate>
		<dc:creator>James Boelen</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[apicontroller]]></category>
		<category><![CDATA[asp.net]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[fromuri]]></category>
		<category><![CDATA[httpget]]></category>
		<category><![CDATA[null]]></category>
		<category><![CDATA[query string]]></category>

		<guid isPermaLink="false">http://james.boelen.ca/?p=1379</guid>
		<description><![CDATA[I was recently working with ApiControllers in ASP.NET&#8217;s MVC framework and found myself trying to pass in a query string to my HttpGet action. Things were going smoothly until my parameter model was coming back as null. public class InputModel &#123; public string value1 &#123; get; set; &#125; public string value2 &#123; get; set; &#125; [...]]]></description>
				<content:encoded><![CDATA[<p>I was recently working with ApiControllers in ASP.NET&#8217;s MVC framework and found myself trying to pass in a query string to my HttpGet action. Things were going smoothly until my parameter model was coming back as null.</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">class</span> InputModel
<span style="color: #008000;">&#123;</span>
<span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">string</span> value1 <span style="color: #008000;">&#123;</span> <span style="color: #0600FF; font-weight: bold;">get</span><span style="color: #008000;">;</span> <span style="color: #0600FF; font-weight: bold;">set</span><span style="color: #008000;">;</span> <span style="color: #008000;">&#125;</span>
<span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">string</span> value2 <span style="color: #008000;">&#123;</span> <span style="color: #0600FF; font-weight: bold;">get</span><span style="color: #008000;">;</span> <span style="color: #0600FF; font-weight: bold;">set</span><span style="color: #008000;">;</span> <span style="color: #008000;">&#125;</span>
<span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">string</span> value3 <span style="color: #008000;">&#123;</span> <span style="color: #0600FF; font-weight: bold;">get</span><span style="color: #008000;">;</span> <span style="color: #0600FF; font-weight: bold;">set</span><span style="color: #008000;">;</span> <span style="color: #008000;">&#125;</span>
<span style="color: #008000;">&#125;</span>
&nbsp;
<span style="color: #008000;">&#91;</span>HttpGet<span style="color: #008000;">&#93;</span>
<span style="color: #0600FF; font-weight: bold;">public</span> HttpResponseMessage MyApiMethod<span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">int</span> id, InputModel model<span style="color: #008000;">&#41;</span>
<span style="color: #008000;">&#123;</span>
<span style="color: #008000;">....</span>
<span style="color: #0600FF; font-weight: bold;">do</span> stuff
<span style="color: #008000;">....</span>
<span style="color: #0600FF; font-weight: bold;">return</span> <span style="color: #008000;">new</span> HttpResponseMessage<span style="color: #008000;">&#40;</span>HttpStatusCode<span style="color: #008000;">.</span><span style="color: #0000FF;">OK</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
<span style="color: #008000;">&#125;</span></pre></td></tr></table></div>

<p>As mentioned above, everytime, my input model would be null! After doing some googling, I found out about a little ditty named &#8220;FromUri&#8221;. Placing this before a parameter would tell the controller to hydrate the model from Uri variables.</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF; font-weight: bold;">public</span> HttpResponseMessage MyApiMethod<span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">int</span> id, <span style="color: #008000;">&#91;</span>FromUri<span style="color: #008000;">&#93;</span> InputModel model<span style="color: #008000;">&#41;</span></pre></td></tr></table></div>

<p>It works! My model is no longer null and has the expected values from my query string (api/controller/action/id?value1=1&#038;value2=2&#038;value3=3)! </p>
]]></content:encoded>
			<wfw:commentRss>http://james.boelen.ca/programming/api-controllers-query-strings/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Visual Event 2</title>
		<link>http://james.boelen.ca/programming/visual-event-2/</link>
		<comments>http://james.boelen.ca/programming/visual-event-2/#comments</comments>
		<pubDate>Tue, 22 Jan 2013 15:10:29 +0000</pubDate>
		<dc:creator>James Boelen</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[GitHub]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[visual event 2]]></category>

		<guid isPermaLink="false">http://james.boelen.ca/?p=1366</guid>
		<description><![CDATA[This could possibly one of my greatest finds recently. The other day I was going through some code that someone else had written and was having trouble finding the script that was being fired when a DOM element was being clicked. I do my development in chrome, so the first place I looked was their [...]]]></description>
				<content:encoded><![CDATA[<p>This could possibly one of my greatest finds recently. The other day I was going through some code that someone else had written and was having trouble finding the script that was being fired when a DOM element was being clicked. I do my development in chrome, so the first place I looked was their Extensions library. The only plug-in I could find, unfortunately, only showed the jquery scripts that were being called when events occurred. This clearly wasn&#8217;t helping.</p>
<p>I then stumbled upon a <a title="StackOverflow" href="http://stackoverflow.com/questions/446892/how-to-find-event-listeners-on-a-dom-node">stackoverflow</a> question in which someone was having a similar issue.</p>
<p>Enter Visual Event 2. VE2 is an open source bookmarklet that, when loaded, will highlight all of the objects with events on a page and show you what scripts will be called when they are clicked. This thing is absolutely brilliant. I was instantly able to see what script was being called and found it in seconds. Better still, since it&#8217;s a bookmarklet, it should work in most modern browsers too!</p>
<p>This thing will permanently live in my developer toolbox. I highly suggest it for developers working on sites that are js intense.</p>
<p><a title="Visual Event 2 Website" href="http://www.sprymedia.co.uk/article/Visual+Event+2" target="_blank">Visual Event 2 Website</a></p>
]]></content:encoded>
			<wfw:commentRss>http://james.boelen.ca/programming/visual-event-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>IE7 inline-block Fix</title>
		<link>http://james.boelen.ca/programming/ie7-inline-block-fix/</link>
		<comments>http://james.boelen.ca/programming/ie7-inline-block-fix/#comments</comments>
		<pubDate>Wed, 16 Jan 2013 18:24:51 +0000</pubDate>
		<dc:creator>James Boelen</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[ie]]></category>

		<guid isPermaLink="false">http://james.boelen.ca/?p=1364</guid>
		<description><![CDATA[Oh IE, how I loath thee&#8230; IE9 is getting better, but the legacy that it left and that we developers have to deal with is cringe-worthy. One of my often used layout CSS bits is display:inline-block Unfortunately, this does not degrade gracefully in IE &#60; 8. I usually have to look this up everytime I [...]]]></description>
				<content:encoded><![CDATA[<p>Oh IE, how I loath thee&#8230;</p>
<p>IE9 is getting better, but the legacy that it left and that we developers have to deal with is cringe-worthy. One of my often used layout CSS bits is <strong>display:inline-block</strong></p>
<p>Unfortunately, this does not degrade gracefully in IE &lt; 8. I usually have to look this up everytime I view a page in IE, so I figured I&#8217;d pen it here so that I can find it more easily. The trick, as many of you might know, is to add the following in the CSS:</p>
<p><code>zoom: 1;<br />
*display: inline;</code></p>
<p>Source: <a href="http://uncorkedstudios.com/2011/12/12/how-to-fix-the-ie7-and-inline-block-css-bug/">How to fix the IE7 and inline-block CSS bug</a> </p>
]]></content:encoded>
			<wfw:commentRss>http://james.boelen.ca/programming/ie7-inline-block-fix/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Bringing Thickbox Into The Present</title>
		<link>http://james.boelen.ca/open_source/bringing-thickbox-into-the-present/</link>
		<comments>http://james.boelen.ca/open_source/bringing-thickbox-into-the-present/#comments</comments>
		<pubDate>Fri, 11 May 2012 13:21:33 +0000</pubDate>
		<dc:creator>James Boelen</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[bind]]></category>
		<category><![CDATA[each]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[onclick]]></category>
		<category><![CDATA[row]]></category>
		<category><![CDATA[thickbox]]></category>

		<guid isPermaLink="false">http://james.boelen.ca/?p=224</guid>
		<description><![CDATA[Yesterday I had to work with the Thickbox jquery plugin that has not been updated since 2007.]]></description>
				<content:encoded><![CDATA[<p>Yesterday I had to work with the <a title="Thickbox" href="http://jquery.com/demo/thickbox/" target="_blank">Thickbox</a> jquery plugin that has not been updated since 2007. Much to my dismay, the format and usage of the plugin was not what I&#8217;m used to or in the standard jQuery plugin form of $(element).plugin. Thickbox, in its original form, scours your page for special anchor tags and allows them to open a lightbox. The code that this was to be used in already had usage of this for links, but I wanted to add it to a table row, so I had to update the plugin without breaking existing functionality. What follows is a quick and dirty little snippet that can be dropped into the thickbox.js file to allow proper jQuery usage.</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>$<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
  $.<span style="color: #660066;">fn</span>.<span style="color: #660066;">thickbox</span> <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span> options <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>  
	  <span style="color: #000066; font-weight: bold;">var</span> settings <span style="color: #339933;">=</span> $.<span style="color: #660066;">extend</span><span style="color: #009900;">&#40;</span> <span style="color: #009900;">&#123;</span>
		  <span style="color: #3366CC;">'title'</span> <span style="color: #339933;">:</span> <span style="color: #3366CC;">''</span><span style="color: #339933;">,</span>
		  <span style="color: #3366CC;">'href'</span> <span style="color: #339933;">:</span> <span style="color: #3366CC;">''</span><span style="color: #339933;">,</span>
		  <span style="color: #3366CC;">'group'</span> <span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">,</span>
		<span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span> options<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">each</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>$<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">hasClass</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'hasThickbox'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #000066; font-weight: bold;">var</span> $elem <span style="color: #339933;">=</span> $<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            $elem.<span style="color: #660066;">click</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">function</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                <span style="color: #000066; font-weight: bold;">var</span> t <span style="color: #339933;">=</span> settings.<span style="color: #660066;">title</span>
                <span style="color: #000066; font-weight: bold;">var</span> a <span style="color: #339933;">=</span> settings.<span style="color: #660066;">href</span><span style="color: #339933;">;</span>
                <span style="color: #000066; font-weight: bold;">var</span> g <span style="color: #339933;">=</span> settings.<span style="color: #660066;">group</span><span style="color: #339933;">;</span>
                tb_show<span style="color: #009900;">&#40;</span>t<span style="color: #339933;">,</span> a<span style="color: #339933;">,</span> g<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">blur</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">;</span>
            <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            $elem.<span style="color: #660066;">addClass</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'hasThickbox'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#40;</span> jQuery <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>I&#8217;ve kept it largely the same as it was in its original form so that others can easily see how it works and so that there aren&#8217;t too many modifications to the original logic. The function expects the options: Title, href, and group. All 3 work the same way as they did with the original plugin, and the options for Thickbox are still supplied as a query string through the href option value (see <a title="Thickbox" href="http://jquery.com/demo/thickbox/" target="_blank">here</a>for an explanation of the query string options).</p>
<p>There are still many things that I&#8217;m not particularly fond of with Thickbox, but if you&#8217;re being forced to use it, this will at least provide you with a little bit less of a hassle.</p>
]]></content:encoded>
			<wfw:commentRss>http://james.boelen.ca/open_source/bringing-thickbox-into-the-present/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Nesting Files in Visual Studio</title>
		<link>http://james.boelen.ca/programming/nesting-files-in-visual-studio/</link>
		<comments>http://james.boelen.ca/programming/nesting-files-in-visual-studio/#comments</comments>
		<pubDate>Tue, 08 May 2012 17:28:27 +0000</pubDate>
		<dc:creator>James Boelen</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[nestin]]></category>
		<category><![CDATA[visual studio]]></category>

		<guid isPermaLink="false">http://james.boelen.ca/?p=220</guid>
		<description><![CDATA[Found a neat extension for Visual Studio that allows you to nest files in the solution explorer. NestIn written by José F. Romaniello, allows you to easily and quickly nest files from the context menu. I have found this very useful when grouping related resources to their parent files (like javascript to the parent user [...]]]></description>
				<content:encoded><![CDATA[<p>Found a neat extension for Visual Studio that allows you to nest files in the solution explorer. <a href="http://visualstudiogallery.msdn.microsoft.com/9d6ef0ce-2bef-4a82-9a84-7718caa5bb45/">NestIn</a> written by <span class="profile-usercard-hover">José F. Romaniello</span>, allows you to easily and quickly nest files from the context menu. I have found this very useful when grouping related resources to their parent files (like javascript to the parent user control).</p>
]]></content:encoded>
			<wfw:commentRss>http://james.boelen.ca/programming/nesting-files-in-visual-studio/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ice Cream Sandwich to Mac File Transfer</title>
		<link>http://james.boelen.ca/general/ice-cream-sandwich-to-mac-file-transfer/</link>
		<comments>http://james.boelen.ca/general/ice-cream-sandwich-to-mac-file-transfer/#comments</comments>
		<pubDate>Sun, 08 Apr 2012 12:45:37 +0000</pubDate>
		<dc:creator>James Boelen</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[android]]></category>
		<category><![CDATA[android file transfer]]></category>
		<category><![CDATA[file transfer]]></category>
		<category><![CDATA[ics]]></category>
		<category><![CDATA[mac]]></category>
		<category><![CDATA[mtp]]></category>
		<category><![CDATA[osx]]></category>
		<category><![CDATA[usb]]></category>

		<guid isPermaLink="false">http://james.boelen.ca/?p=216</guid>
		<description><![CDATA[So I recently updated my Samsung Galaxy S II and found that I could no longer connect it to my OSX Lion Mac. As it turns out, ICS now uses the MTP (Media Transfer Protocol) protocol which OSX does not support. Up until now, it has use the UMS (USB Mass Storage) protocol. Though this [...]]]></description>
				<content:encoded><![CDATA[<p>So I recently updated my Samsung Galaxy S II and found that I could no longer connect it to my OSX Lion Mac. As it turns out, ICS now uses the MTP (Media Transfer Protocol) protocol which OSX does not support. Up until now, it has use the UMS (USB Mass Storage) protocol. Though this move is a step forward, it can be a bit confusing. Luckily, there&#8217;s a free fix from google. <a title="Android File Transfer" href="http://www.android.com/filetransfer/">Android File Transfer</a> is a free application that mac users can install to get MTP support on their Mac computer and continue to manage their files.</p>
<blockquote><p>Android File Transfer is an application for Macintosh computers (running Mac OS X 10.5 or later) you can use to view and transfer files between your Mac and an Android device (running Android 3.0 or later).</p></blockquote>
<p>Even though Android phones are a direct competitor to Apple&#8217;s iPhone, hopefully Apple will smarten up in the near future and build this in to their operating system. There are many other devices that use this protocol and to not include it would be plain silly.</p>
]]></content:encoded>
			<wfw:commentRss>http://james.boelen.ca/general/ice-cream-sandwich-to-mac-file-transfer/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Firefox Range Bug</title>
		<link>http://james.boelen.ca/programming/firefox-range-bug/</link>
		<comments>http://james.boelen.ca/programming/firefox-range-bug/#comments</comments>
		<pubDate>Tue, 13 Mar 2012 20:37:18 +0000</pubDate>
		<dc:creator>James Boelen</dc:creator>
				<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://james.boelen.ca/?p=202</guid>
		<description><![CDATA[Today I came across an odd Firefox javascript bug. While trying to manipulate a range object, I ran into a wall that was preventing me from changing it a second time. On my page, I have a script that runs when a user selects text. I then delete the contents and replace it with the [...]]]></description>
				<content:encoded><![CDATA[<p>Today I came across an odd Firefox javascript bug. While trying to manipulate a range object, I ran into a wall that was preventing me from changing it a second time. On my page, I have a script that runs when a user selects text. I then delete the contents and replace it with the same text with a span tag around it. I noticed however, that if I brought up the range object again, it said it had no content. My syntax was simple:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="javascript" style="font-family:monospace;">range.<span style="color: #660066;">deleteContents</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
range.<span style="color: #660066;">insertNode</span><span style="color: #009900;">&#40;</span>newContents<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>newContents was simply a span element with some text that I had created using the <em>document.createElement</em> method.</p>
<p>This code works exactly as expected in chrome. If I look into the range object, I  correctly have the new contents. In firefox however, the range object was missing all of its delicious contenty goodness. After doing a bit of re-working, I came up with the following solution:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="javascript" style="font-family:monospace;">range.<span style="color: #660066;">deleteContents</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
range.<span style="color: #660066;">insertNode</span><span style="color: #009900;">&#40;</span>newContents<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
range <span style="color: #339933;">=</span> document.<span style="color: #660066;">createRange</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
range.<span style="color: #660066;">selectNode</span><span style="color: #009900;">&#40;</span>newContents<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>The additional 2 lines make it work and it still functions properly in Chrome. Now when I bring up the range object, it has the new content for me to mess around with again.</p>
<p><em>Using firefox 10.0.2</em></p>
]]></content:encoded>
			<wfw:commentRss>http://james.boelen.ca/programming/firefox-range-bug/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
