<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Lawrence Barsanti&#039;s Blog</title>
	<atom:link href="http://lawrencebarsanti.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://lawrencebarsanti.wordpress.com</link>
	<description>My thoughts on code.</description>
	<lastBuildDate>Tue, 24 Jan 2012 02:04:13 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='lawrencebarsanti.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Lawrence Barsanti&#039;s Blog</title>
		<link>http://lawrencebarsanti.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://lawrencebarsanti.wordpress.com/osd.xml" title="Lawrence Barsanti&#039;s Blog" />
	<atom:link rel='hub' href='http://lawrencebarsanti.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Easy to Follow JavaScript Closure Example</title>
		<link>http://lawrencebarsanti.wordpress.com/2010/11/09/easy-to-follow-javascript-closure-example/</link>
		<comments>http://lawrencebarsanti.wordpress.com/2010/11/09/easy-to-follow-javascript-closure-example/#comments</comments>
		<pubDate>Tue, 09 Nov 2010 16:36:28 +0000</pubDate>
		<dc:creator>lawrencebarsanti</dc:creator>
				<category><![CDATA[my posts]]></category>
		<category><![CDATA[closures]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://lawrencebarsanti.wordpress.com/?p=105</guid>
		<description><![CDATA[The following example uses a closure &#8211; on the local variable value &#8211; to mimic a private variable. The functions add, sub, and val are created and returned every time the createCounter function is executed. When they are created, the local variable value is in scope meaning it can be used by those functions.  Normally, [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=lawrencebarsanti.wordpress.com&amp;blog=10682182&amp;post=105&amp;subd=lawrencebarsanti&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>The following example uses a closure &#8211; on the local variable <strong>value</strong> &#8211; to mimic a private variable.</p>
<p><pre class="brush: jscript;">
// returns counter object
function createCounter() {
  var value = 0; // used by add, sub, val
  return {
    add: function(x) { value += x; },
    sub: function(x) { value -= x; },
    val: function() { return value;}
  };
}

// create two counters
counter1 = createCounter();
counter2 = createCounter();

// use the counters
counter1.add(14);
counter2.add(32);
var val1 = counter1.val();
var val2 = counter2.val();
counter1.sub(4);
var val3 = counter1.val();

// the result: val1 is 14, val2 is 32, val3 is 10
</pre></p>
<p>The functions <strong>add</strong>, <strong>sub</strong>, and <strong>val</strong> are created and returned every time the <strong>createCounter</strong> function is executed. When they are created, the local variable <strong>value</strong> is in scope meaning it can be used by those functions.  Normally, when <strong>createCounter</strong> returns, the variable <strong>value</strong> would fall out of scope and be destroyed.  However, because <strong>value</strong> is used by the functions <strong>add</strong>, <strong>sub</strong>, and <strong>val</strong> it is not destroyed.  Instead, <strong>value</strong> remains available to those functions &#8211; this is a closure.</p>
<p>The functions <strong>add</strong>, <strong>sub</strong>, and <strong>val</strong> all have access to the same instance of <strong>value </strong>meaning changes to <strong>value</strong> are seen by all three functions. That is why <strong>val1</strong> is 14 and <strong>val3</strong> is 10.  If each function had its own private copy of <strong>value</strong>, the code would be useless because <strong>val</strong> would always return 0.</p>
<p>Each time <strong>createCounter</strong> is executed a new closure is created with its own instance of <strong>value</strong>. Because of this, calls to the functions in <strong>counter1</strong> and <strong>counter2</strong> do not interfere with each other. That is why <strong>val1</strong> is 14 and <strong>val2</strong> is 32.  This is powerful technique for controlling the scope of variables &#8211; try writing similar code without using a closure.</p>
<p>Once you understand this example, check out this <a href="https://developer.mozilla.org/en/JavaScript/Guide/Closures">detailed explanation</a> provided at the Mozilla Developer Center.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/lawrencebarsanti.wordpress.com/105/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/lawrencebarsanti.wordpress.com/105/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/lawrencebarsanti.wordpress.com/105/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/lawrencebarsanti.wordpress.com/105/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/lawrencebarsanti.wordpress.com/105/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/lawrencebarsanti.wordpress.com/105/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/lawrencebarsanti.wordpress.com/105/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/lawrencebarsanti.wordpress.com/105/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/lawrencebarsanti.wordpress.com/105/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/lawrencebarsanti.wordpress.com/105/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/lawrencebarsanti.wordpress.com/105/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/lawrencebarsanti.wordpress.com/105/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/lawrencebarsanti.wordpress.com/105/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/lawrencebarsanti.wordpress.com/105/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=lawrencebarsanti.wordpress.com&amp;blog=10682182&amp;post=105&amp;subd=lawrencebarsanti&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://lawrencebarsanti.wordpress.com/2010/11/09/easy-to-follow-javascript-closure-example/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/0308282a565f3fce9a791022791536f6?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">lawrencebarsanti</media:title>
		</media:content>
	</item>
		<item>
		<title>Missing functions in Google Maps API V3</title>
		<link>http://lawrencebarsanti.wordpress.com/2010/10/21/missing-functions-in-google-maps-api-v3/</link>
		<comments>http://lawrencebarsanti.wordpress.com/2010/10/21/missing-functions-in-google-maps-api-v3/#comments</comments>
		<pubDate>Fri, 22 Oct 2010 04:39:00 +0000</pubDate>
		<dc:creator>lawrencebarsanti</dc:creator>
				<category><![CDATA[my posts]]></category>
		<category><![CDATA[google maps api]]></category>
		<category><![CDATA[google maps api v3]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[web applications]]></category>

		<guid isPermaLink="false">http://lawrencebarsanti.wordpress.com/?p=100</guid>
		<description><![CDATA[I am upgrading trackyourruns.com from Google Maps API version 2 to version 3. The process has been fairly painless but I have discovered that a few key functions are missing. For example I was using the getLength() method of GPolyLine (PolyLine if V3) to determine a line&#8217;s length in meters.  Currently, there is no way [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=lawrencebarsanti.wordpress.com&amp;blog=10682182&amp;post=100&amp;subd=lawrencebarsanti&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I am upgrading <a href="http://trackyourruns.com">trackyourruns.com</a> from Google Maps API version 2 to version 3.  The process has been fairly painless but I have discovered that a few key functions are missing.  For example I was using the getLength() method of GPolyLine (PolyLine if V3) to determine a line&#8217;s length in meters.  Currently, there is no way to do this using version 3 of the Maps API.  Fortunately, José Fernando Calcerrada created <a href="http://www.basicslabs.com/Projects/extendedApi/">extendedApi</a> which adds functions to LatLng, Marker, Polyline, Polygon that are missing in V3.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/lawrencebarsanti.wordpress.com/100/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/lawrencebarsanti.wordpress.com/100/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/lawrencebarsanti.wordpress.com/100/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/lawrencebarsanti.wordpress.com/100/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/lawrencebarsanti.wordpress.com/100/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/lawrencebarsanti.wordpress.com/100/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/lawrencebarsanti.wordpress.com/100/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/lawrencebarsanti.wordpress.com/100/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/lawrencebarsanti.wordpress.com/100/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/lawrencebarsanti.wordpress.com/100/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/lawrencebarsanti.wordpress.com/100/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/lawrencebarsanti.wordpress.com/100/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/lawrencebarsanti.wordpress.com/100/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/lawrencebarsanti.wordpress.com/100/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=lawrencebarsanti.wordpress.com&amp;blog=10682182&amp;post=100&amp;subd=lawrencebarsanti&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://lawrencebarsanti.wordpress.com/2010/10/21/missing-functions-in-google-maps-api-v3/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/0308282a565f3fce9a791022791536f6?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">lawrencebarsanti</media:title>
		</media:content>
	</item>
		<item>
		<title>TrackYourRuns V0.2 is live</title>
		<link>http://lawrencebarsanti.wordpress.com/2010/10/13/trackyourruns-v0-2-is-live/</link>
		<comments>http://lawrencebarsanti.wordpress.com/2010/10/13/trackyourruns-v0-2-is-live/#comments</comments>
		<pubDate>Wed, 13 Oct 2010 20:40:24 +0000</pubDate>
		<dc:creator>lawrencebarsanti</dc:creator>
				<category><![CDATA[my posts]]></category>
		<category><![CDATA[google maps api]]></category>
		<category><![CDATA[jogging]]></category>
		<category><![CDATA[running]]></category>
		<category><![CDATA[web applications]]></category>

		<guid isPermaLink="false">http://lawrencebarsanti.wordpress.com/?p=96</guid>
		<description><![CDATA[trackyourruns.com allows you to figure out how far you ran (or plan to run) using Google Maps. A few different websites can already do this but I think they are a little user-unfriendly. Some improvements trackyourruns.com provides over the other websites include: Large map that is not covered in advertisements Intuitive handling of mouse events [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=lawrencebarsanti.wordpress.com&amp;blog=10682182&amp;post=96&amp;subd=lawrencebarsanti&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><a href="http://trackyourruns.com">trackyourruns.com</a> allows you to figure out how far you ran (or plan to run) using Google Maps.  A few different websites can already do this but I think they are a little user-unfriendly.  Some improvements <a href="http://trackyourruns.com">trackyourruns.com</a> provides over the other websites include:</p>
<ul>
<li> Large map that is not covered in advertisements</li>
<li>Intuitive handling of mouse events (like zoom with the scroll-wheel)</li>
<li>Map controls that are self-describing</li>
</ul>
<p>I have many more convenient features planed. I will post updates here as they are developed.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/lawrencebarsanti.wordpress.com/96/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/lawrencebarsanti.wordpress.com/96/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/lawrencebarsanti.wordpress.com/96/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/lawrencebarsanti.wordpress.com/96/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/lawrencebarsanti.wordpress.com/96/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/lawrencebarsanti.wordpress.com/96/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/lawrencebarsanti.wordpress.com/96/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/lawrencebarsanti.wordpress.com/96/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/lawrencebarsanti.wordpress.com/96/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/lawrencebarsanti.wordpress.com/96/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/lawrencebarsanti.wordpress.com/96/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/lawrencebarsanti.wordpress.com/96/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/lawrencebarsanti.wordpress.com/96/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/lawrencebarsanti.wordpress.com/96/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=lawrencebarsanti.wordpress.com&amp;blog=10682182&amp;post=96&amp;subd=lawrencebarsanti&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://lawrencebarsanti.wordpress.com/2010/10/13/trackyourruns-v0-2-is-live/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/0308282a565f3fce9a791022791536f6?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">lawrencebarsanti</media:title>
		</media:content>
	</item>
		<item>
		<title>Joomla Installation Failure</title>
		<link>http://lawrencebarsanti.wordpress.com/2010/09/06/joomla-installation-failure/</link>
		<comments>http://lawrencebarsanti.wordpress.com/2010/09/06/joomla-installation-failure/#comments</comments>
		<pubDate>Mon, 06 Sep 2010 15:08:20 +0000</pubDate>
		<dc:creator>lawrencebarsanti</dc:creator>
				<category><![CDATA[my posts]]></category>
		<category><![CDATA[Joomla]]></category>
		<category><![CDATA[MySql]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://lawrencebarsanti.wordpress.com/?p=91</guid>
		<description><![CDATA[Recently I encountered a very frustrating error while installing Joomla! 1.5 on my development machine (Windows 7 / Apache 2.0 / PHP 5.3 / MySQL 5.1). I followed the easy to use installation wizard but when I reached the database configuration step (step 4 I believe) things got ugly. I entered the database information (host, [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=lawrencebarsanti.wordpress.com&amp;blog=10682182&amp;post=91&amp;subd=lawrencebarsanti&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Recently I encountered a very frustrating error while installing Joomla! 1.5 on my development machine (Windows 7 / Apache 2.0 / PHP 5.3 / MySQL 5.1).  I followed the easy to use installation wizard but when I reached the database configuration step (step 4 I believe) things got ugly.</p>
<p>I entered the database information (host, user name, password, and database name) and then click next.  After about 30 seconds I saw a blank screen.  A quick look at the logs returned very little information; all I found was an error 500 in Apache&#8217;s access log.  After some digging around I came to the conclusion that is must be a problem between PHP and MySQL.  </p>
<p>I whipped up a quick test would help me diagnose the problem.<br />
<pre class="brush: php;">
mysql_connect(&quot;localhost&quot;, &quot;root&quot;, &quot;mypassword&quot;)
  or die(&quot;Could not connect to database.&quot;);
print &quot;Connected to database.&quot;;
</pre><br />
I was expecting to see &#8216;Could not connect to database.&#8217; and to have some useful info dumped into the logs.  Instead I received a blank screen after about 30 seconds&#8230; Eureka!  This is the exact same problem I had with the Joomla! install. </p>
<p>After reading through the mysql_connect docs, I discovered that connecting to &#8216;localhost&#8217; actually attempts to use a socket (named pipe on Window) but connecting to &#8217;127.0.0.1&#8242; will use TCP/IP.  </p>
<p>Apparently, I configured MySQL to accept connections from TCP/IP but not sockets/pipes. When mysql_connect attempted to connect to MySQL it did not receive a response and after about 30 seconds PHP timed-out the request resulting in a 500 error response.  </p>
<p><strong>I fixed this problem by simply changing my host parameter from &#8216;localhost&#8217; to &#8217;127.0.0.1&#8242;.</strong></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/lawrencebarsanti.wordpress.com/91/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/lawrencebarsanti.wordpress.com/91/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/lawrencebarsanti.wordpress.com/91/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/lawrencebarsanti.wordpress.com/91/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/lawrencebarsanti.wordpress.com/91/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/lawrencebarsanti.wordpress.com/91/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/lawrencebarsanti.wordpress.com/91/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/lawrencebarsanti.wordpress.com/91/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/lawrencebarsanti.wordpress.com/91/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/lawrencebarsanti.wordpress.com/91/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/lawrencebarsanti.wordpress.com/91/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/lawrencebarsanti.wordpress.com/91/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/lawrencebarsanti.wordpress.com/91/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/lawrencebarsanti.wordpress.com/91/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=lawrencebarsanti.wordpress.com&amp;blog=10682182&amp;post=91&amp;subd=lawrencebarsanti&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://lawrencebarsanti.wordpress.com/2010/09/06/joomla-installation-failure/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/0308282a565f3fce9a791022791536f6?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">lawrencebarsanti</media:title>
		</media:content>
	</item>
		<item>
		<title>ColdFusion sanitize HTML</title>
		<link>http://lawrencebarsanti.wordpress.com/2010/08/12/coldfusion-sanitize-html/</link>
		<comments>http://lawrencebarsanti.wordpress.com/2010/08/12/coldfusion-sanitize-html/#comments</comments>
		<pubDate>Thu, 12 Aug 2010 18:51:28 +0000</pubDate>
		<dc:creator>lawrencebarsanti</dc:creator>
				<category><![CDATA[my posts]]></category>
		<category><![CDATA[coldfusion]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[security]]></category>

		<guid isPermaLink="false">http://lawrencebarsanti.wordpress.com/?p=82</guid>
		<description><![CDATA[Jeff Atwood posted a white-list approach to sanitizing HTML output on RefactorMyCode (http://refactormycode.com/codes/333-sanitize-html). I ported the code to ColdFusion and decided to share it with the community.<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=lawrencebarsanti.wordpress.com&amp;blog=10682182&amp;post=82&amp;subd=lawrencebarsanti&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Jeff Atwood posted a white-list approach to sanitizing HTML output on RefactorMyCode (<a href="http://refactormycode.com/codes/333-sanitize-html">http://refactormycode.com/codes/333-sanitize-html</a>).  I ported the code to ColdFusion and decided to share it with the community.</p>
<p><pre class="brush: coldfusion; wrap-lines: false;">
&lt;!--- ORIGINAL CODESNIPPET:4100A61A-1711-4366-B0B0-144D1179A937 ---&gt;
&lt;cfcomponent&gt;
	&lt;cfset variables.reTags = '&lt;[^&gt;]*(&gt;|$)'&gt;
	&lt;cfset variables.reWhitelist = '(?x) ^&lt;/?(b(lockquote)?|code|d(d|t|l|el)|em|h(1|2|3)|i|kbd|li|ol|p(re)?|s(ub|up|trong|trike)?|ul)&gt;$ | ^&lt;(b|h)r\s?/?&gt;$'&gt;
	&lt;cfset variables.reWhitelistLinks = '(?x) ^&lt;a\s href=&quot;(\##\d+|(https?|ftp)://[-a-z0-9+&amp;@##/%?=~_|!:,.;\(\)]+)&quot; (\stitle=&quot;[^&quot;&lt;&gt;]+&quot;)?\s?&gt;$ | ^&lt;/a&gt;$'&gt;
	&lt;cfset variables.reWhitelistImages = '(?x) ^&lt;img\s src=&quot;https?://[-a-z0-9+&amp;@##/%?=~_|!:,.;\(\)]+&quot; (\swidth=&quot;\d{1,3}&quot;)? (\sheight=&quot;\d{1,3}&quot;)? (\salt=&quot;[^&quot;&lt;&gt;]*&quot;)? (\stitle=&quot;[^&quot;&lt;&gt;]*&quot;)? \s?/?&gt;$'&gt;
		
	&lt;cffunction name=&quot;findAll&quot; returntype=&quot;array&quot; output=&quot;no&quot; access=&quot;private&quot;&gt;
		&lt;cfargument name=&quot;regex&quot; type=&quot;string&quot; required=&quot;yes&quot;&gt;
		&lt;cfargument name=&quot;text&quot; type=&quot;string&quot; required=&quot;yes&quot;&gt;

		&lt;cfset var L = structNew()&gt;
		&lt;cfset L.result = []&gt;
		&lt;cfset L.offset = 1&gt;		
		&lt;cfloop condition=&quot;true&quot;&gt;
			&lt;cfset L.match = reFind(arguments.regex, arguments.text, L.offset, true)&gt;

			&lt;cfif L.match.len[1] GT 0&gt;
				&lt;cfset L.details = {
					text = Mid(arguments.text, L.match.pos[1], L.match.len[1]),
					index = L.match.pos[1],
					length = L.match.len[1]
				}&gt;		
				&lt;cfset arrayAppend(L.result, L.details)&gt;
				&lt;cfset L.offset = L.details.index + L.details.length&gt;
			&lt;cfelse&gt;
				&lt;cfbreak&gt;
			&lt;/cfif&gt;
		&lt;/cfloop&gt;
		&lt;cfreturn L.result&gt;
	&lt;/cffunction&gt;
	
	&lt;cffunction name=&quot;sanatize&quot; output=&quot;no&quot; returntype=&quot;string&quot; access=&quot;public&quot;&gt;
		&lt;cfargument name=&quot;html&quot; required=&quot;yes&quot; type=&quot;string&quot;&gt;
		&lt;cfset var L = structNew()&gt;
		&lt;cfset L.result = arguments.html&gt;		
		&lt;cfif len(arguments.html) GT 0&gt;
			&lt;cfset L.tags = findAll(variables.reTags, arguments.html)&gt;
			&lt;cfloop from='#ArrayLen(L.tags)#' to='1' index='L.i' step='-1'&gt;
				&lt;cfset L.tagname = lcase(L.tags[L.i].text)&gt;
				&lt;cfset L.allowTag = reFind(variables.reWhitelist, L.tagname) GT 0
												OR reFind(variables.reWhitelistLinks, L.tagname) GT 0
												OR reFind(variables.reWhitelistImages, L.tagname) GT 0&gt;
				&lt;cfif NOT L.allowTag&gt;
					&lt;cfset L.result = RemoveChars(L.result, L.tags[L.i].index, L.tags[L.i].length)&gt;
				&lt;/cfif&gt;
			&lt;/cfloop&gt;
		&lt;/cfif&gt;
		&lt;cfreturn L.result&gt;
	&lt;/cffunction&gt;
&lt;/cfcomponent&gt;
</pre></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/lawrencebarsanti.wordpress.com/82/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/lawrencebarsanti.wordpress.com/82/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/lawrencebarsanti.wordpress.com/82/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/lawrencebarsanti.wordpress.com/82/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/lawrencebarsanti.wordpress.com/82/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/lawrencebarsanti.wordpress.com/82/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/lawrencebarsanti.wordpress.com/82/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/lawrencebarsanti.wordpress.com/82/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/lawrencebarsanti.wordpress.com/82/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/lawrencebarsanti.wordpress.com/82/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/lawrencebarsanti.wordpress.com/82/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/lawrencebarsanti.wordpress.com/82/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/lawrencebarsanti.wordpress.com/82/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/lawrencebarsanti.wordpress.com/82/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=lawrencebarsanti.wordpress.com&amp;blog=10682182&amp;post=82&amp;subd=lawrencebarsanti&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://lawrencebarsanti.wordpress.com/2010/08/12/coldfusion-sanitize-html/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/0308282a565f3fce9a791022791536f6?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">lawrencebarsanti</media:title>
		</media:content>
	</item>
		<item>
		<title>Lighten colors programmatically with Delphi</title>
		<link>http://lawrencebarsanti.wordpress.com/2010/01/03/lighten-colors-programmatically-with-delphi/</link>
		<comments>http://lawrencebarsanti.wordpress.com/2010/01/03/lighten-colors-programmatically-with-delphi/#comments</comments>
		<pubDate>Sun, 03 Jan 2010 14:45:49 +0000</pubDate>
		<dc:creator>lawrencebarsanti</dc:creator>
				<category><![CDATA[my posts]]></category>
		<category><![CDATA[delphi]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://lawrencebarsanti.wordpress.com/2010/01/03/brighten-colors-programmatically-with-delphi/</guid>
		<description><![CDATA[Many people understand that computers store colors as RGB values and that a value like 770000 represents a dark shade of red.  However, RGB values are hard to manipulate in a meaningful way (like brightening a color).  That is where the HSL color space comes in handy.  In the HSL color space, colors are represented [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=lawrencebarsanti.wordpress.com&amp;blog=10682182&amp;post=76&amp;subd=lawrencebarsanti&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Many people understand that computers store colors as RGB values and that a value like 770000 represents a dark shade of red.  However, RGB values are hard to manipulate in a meaningful way (like brightening a color).  That is where the HSL color space comes in handy.  In the HSL color space, colors are represented by there Hue, Saturation, and Luminance.  The image below shows the full range of Saturation (horizontal axis) and Luminance (vertical axis) when the Hue is fixed at an arbitrary blue value.<a href="http://lawrencebarsanti.files.wordpress.com/2010/01/blue.png"><img style="display:block;float:none;margin-left:auto;margin-right:auto;border-width:0;" title="blue" src="http://lawrencebarsanti.files.wordpress.com/2010/01/blue_thumb.png?w=123&#038;h=123" border="0" alt="blue" width="123" height="123" /></a>Once you understand how saturation and luminance affect a hue, you can manipulate these values to produce colors that work well together.  For example, the background of the interior boxes in the simple counters shown below were created by adjusting the luminance of the outer box.</p>
<p><a href="http://lawrencebarsanti.files.wordpress.com/2010/01/counters2.png"><img style="display:block;float:none;margin-left:auto;margin-right:auto;border-width:0;" title="counters2" src="http://lawrencebarsanti.files.wordpress.com/2010/01/counters2_thumb.png?w=391&#038;h=75" border="0" alt="counters2" width="391" height="75" /></a></p>
<p>The following code was used to do brighten the main color.  The functions  <strong>ColorHLSToRGB</strong> and <strong>ColorRGBToHSL</strong> are defined in the unit <strong>GraphUtil</strong>.</p>
<p><pre class="brush: delphi;"> 
function Brighten(AColor: TColor): TColor; 
var 
  H, S, L: Word; 
begin 
  ColorRGBToHLS(AColor, H, L, S); 
  Result := ColorHLSToRGB(H, 225, S); 
end; 
</pre></p>
<p><strong>Warning</strong>: this code assumes AColor will have a low luminance value.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/lawrencebarsanti.wordpress.com/76/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/lawrencebarsanti.wordpress.com/76/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/lawrencebarsanti.wordpress.com/76/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/lawrencebarsanti.wordpress.com/76/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/lawrencebarsanti.wordpress.com/76/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/lawrencebarsanti.wordpress.com/76/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/lawrencebarsanti.wordpress.com/76/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/lawrencebarsanti.wordpress.com/76/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/lawrencebarsanti.wordpress.com/76/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/lawrencebarsanti.wordpress.com/76/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/lawrencebarsanti.wordpress.com/76/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/lawrencebarsanti.wordpress.com/76/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/lawrencebarsanti.wordpress.com/76/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/lawrencebarsanti.wordpress.com/76/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=lawrencebarsanti.wordpress.com&amp;blog=10682182&amp;post=76&amp;subd=lawrencebarsanti&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://lawrencebarsanti.wordpress.com/2010/01/03/lighten-colors-programmatically-with-delphi/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/0308282a565f3fce9a791022791536f6?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">lawrencebarsanti</media:title>
		</media:content>

		<media:content url="http://lawrencebarsanti.files.wordpress.com/2010/01/blue_thumb.png" medium="image">
			<media:title type="html">blue</media:title>
		</media:content>

		<media:content url="http://lawrencebarsanti.files.wordpress.com/2010/01/counters2_thumb.png" medium="image">
			<media:title type="html">counters2</media:title>
		</media:content>
	</item>
		<item>
		<title>6 Reasons to &#8216;Release Early, Release Often&#8217;</title>
		<link>http://lawrencebarsanti.wordpress.com/2009/12/27/6-reasons-to-release-early-release-often/</link>
		<comments>http://lawrencebarsanti.wordpress.com/2009/12/27/6-reasons-to-release-early-release-often/#comments</comments>
		<pubDate>Mon, 28 Dec 2009 01:38:41 +0000</pubDate>
		<dc:creator>lawrencebarsanti</dc:creator>
				<category><![CDATA[my posts]]></category>
		<category><![CDATA[best-practices]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[software]]></category>

		<guid isPermaLink="false">http://lawrencebarsanti.wordpress.com/2009/12/27/6-reasons-to-release-early-release-often/</guid>
		<description><![CDATA[&#160; Agile methods teach that software should be released as early as possible and updated as often as possible.&#160; This allows users to work with the software so they can provide meaningful feedback that guides future development.&#160; I recently tried this with a plugin that I’m working on and it was quite effective.&#160; The following [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=lawrencebarsanti.wordpress.com&amp;blog=10682182&amp;post=71&amp;subd=lawrencebarsanti&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>&#160;</p>
<p>Agile methods teach that software should be released as early as possible and updated as often as possible.&#160; This allows users to work with the software so they can provide meaningful feedback that guides future development.&#160; I recently tried this with a <a href="http://lawrencebarsanti.wordpress.com/2009/12/22/my-first-open-source-contribution/">plugin</a> that I’m working on and it was quite effective.&#160; The following six responses provided me with several ideas for new features (and one bug) that I would not have come up with on my own.&#160; </p>
<p><u>Response 1</u></p>
<blockquote><p>Works nicely! </p>
<p>You could extend this to include replace, find next etc, and then it would become full regex support within N++ (which is wanted anyway, and will probably happen sometime soon, so not sure how much effort should be put into that). </p>
<p>I like the idea though, I use something similar to test regex&#8217;s, doing it in N++ is even better. Not sure what you get access to, but it&#8217;d be really nice to show the replacement groups &#8211; I often need to see not only that a particular regex matches, but also what \1 and \2 (and maybe \17!!) relate to.</p>
<p>Good job &#8211; I&#8217;ll try to add it to the plugin manager as soon as I can.</p>
<p>Cheers,      <br />Dave.</p>
</blockquote>
<p><u>Response 2</u></p>
<blockquote><p>Yea, nice one! And I wanna second davegb3 regarding the replacement groups.. that would be useful to see them. Also can&#8217;t you just name the buttons &quot;&amp;Match&quot; and &quot;&amp;Clear&quot; for having shortcuts ? Or wouldn&#8217;t they work in your dialog anyway ? What&#8217;s the regex engine behind ? The one of scintilla ?</p>
</blockquote>
<p><u>Response 3</u></p>
<blockquote><p>Hi lbarsanti      <br />Your work is really appreciating one.       <br />I found that Notepad++ is going &quot;Out of Memory&quot; when &quot;*&quot; or &quot;?&quot; is applied.       <br />But it works fine in case of &quot;+&quot;.</p>
</blockquote>
<p><u>Response 4</u></p>
<blockquote><p>A further suggestion: Make the Matches in the Details-Area clickable (go to them)</p>
<p>And also scroll-bars, that appears in the dialog if necessary? <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
</blockquote>
<p><u>Response 5</u></p>
<blockquote><p>Is there a chance for the ANSI version?. I use my own private plugin AutomationPHP only the ANSI version because I only have Delphi compiler in this version. Therefore, I would be happy to try your plugin but the ANSI version. regards AK</p>
</blockquote>
<p><u>Response 6</u></p>
<blockquote><p>Looks very nice to me now! Regarding N++ eating shortcuts, I think you could simply catch WM_KEYDOWN in your dialog, but your CTRL shortcuts sound even better imho. Also maybe add a helping link or something&#8230;</p>
</blockquote>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/lawrencebarsanti.wordpress.com/71/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/lawrencebarsanti.wordpress.com/71/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/lawrencebarsanti.wordpress.com/71/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/lawrencebarsanti.wordpress.com/71/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/lawrencebarsanti.wordpress.com/71/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/lawrencebarsanti.wordpress.com/71/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/lawrencebarsanti.wordpress.com/71/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/lawrencebarsanti.wordpress.com/71/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/lawrencebarsanti.wordpress.com/71/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/lawrencebarsanti.wordpress.com/71/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/lawrencebarsanti.wordpress.com/71/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/lawrencebarsanti.wordpress.com/71/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/lawrencebarsanti.wordpress.com/71/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/lawrencebarsanti.wordpress.com/71/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=lawrencebarsanti.wordpress.com&amp;blog=10682182&amp;post=71&amp;subd=lawrencebarsanti&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://lawrencebarsanti.wordpress.com/2009/12/27/6-reasons-to-release-early-release-often/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/0308282a565f3fce9a791022791536f6?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">lawrencebarsanti</media:title>
		</media:content>
	</item>
		<item>
		<title>My First Open Source Contribution</title>
		<link>http://lawrencebarsanti.wordpress.com/2009/12/22/my-first-open-source-contribution/</link>
		<comments>http://lawrencebarsanti.wordpress.com/2009/12/22/my-first-open-source-contribution/#comments</comments>
		<pubDate>Wed, 23 Dec 2009 00:47:00 +0000</pubDate>
		<dc:creator>lawrencebarsanti</dc:creator>
				<category><![CDATA[my posts]]></category>
		<category><![CDATA[notepad++]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[regex]]></category>
		<category><![CDATA[regular-expressions]]></category>

		<guid isPermaLink="false">http://lawrencebarsanti.wordpress.com/2009/12/22/my-first-open-source-contribution/</guid>
		<description><![CDATA[I have been a professional software developer for close to five years now and have been able to code for close to ten.&#160; In all this time I haven’t bothered to contribute a single line of code to any open source project.&#160; That changed Monday December 21st 2009 at 03:43:29 UTC when I committed the [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=lawrencebarsanti.wordpress.com&amp;blog=10682182&amp;post=69&amp;subd=lawrencebarsanti&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I have been a professional software developer for close to five years now and have been able to code for close to ten.&#160; In all this time I haven’t bothered to contribute a single line of code to any open source project.&#160; That changed Monday December 21st 2009 at 03:43:29 UTC when I committed the code for a <a href="http://notepad-plus.sourceforge.net/uk/site.htm">Notepad++</a> plugin that I wrote.&#160; The plugin is called RegEx Helper and it provides you with a convenient way to test regular expression against open documents.&#160; I created a project for the plugin on <a href="http://nppregexhelper.sourceforge.net/">sourceforge</a>.&#160; Lastly, if you have not tried <a href="http://notepad-plus.sourceforge.net/uk/site.htm">Notepad++</a> go download a copy and try it out.&#160; I use it whenever I work with code outside of an IDE.&#160; <img style="border-bottom:0;border-left:0;display:block;float:none;margin-left:auto;border-top:0;margin-right:auto;border-right:0;" border="0" src="http://sourceforge.net/dbimage.php?id=244790" width="450" height="349" /></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/lawrencebarsanti.wordpress.com/69/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/lawrencebarsanti.wordpress.com/69/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/lawrencebarsanti.wordpress.com/69/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/lawrencebarsanti.wordpress.com/69/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/lawrencebarsanti.wordpress.com/69/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/lawrencebarsanti.wordpress.com/69/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/lawrencebarsanti.wordpress.com/69/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/lawrencebarsanti.wordpress.com/69/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/lawrencebarsanti.wordpress.com/69/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/lawrencebarsanti.wordpress.com/69/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/lawrencebarsanti.wordpress.com/69/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/lawrencebarsanti.wordpress.com/69/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/lawrencebarsanti.wordpress.com/69/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/lawrencebarsanti.wordpress.com/69/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=lawrencebarsanti.wordpress.com&amp;blog=10682182&amp;post=69&amp;subd=lawrencebarsanti&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://lawrencebarsanti.wordpress.com/2009/12/22/my-first-open-source-contribution/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/0308282a565f3fce9a791022791536f6?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">lawrencebarsanti</media:title>
		</media:content>

		<media:content url="http://sourceforge.net/dbimage.php?id=244790" medium="image" />
	</item>
		<item>
		<title>Display error messages with TBalloonHint</title>
		<link>http://lawrencebarsanti.wordpress.com/2009/12/16/display-error-messages-with-tballoonhint/</link>
		<comments>http://lawrencebarsanti.wordpress.com/2009/12/16/display-error-messages-with-tballoonhint/#comments</comments>
		<pubDate>Thu, 17 Dec 2009 01:56:45 +0000</pubDate>
		<dc:creator>lawrencebarsanti</dc:creator>
				<category><![CDATA[my posts]]></category>
		<category><![CDATA[delphi]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[usability]]></category>
		<category><![CDATA[user interface]]></category>

		<guid isPermaLink="false">http://lawrencebarsanti.wordpress.com/?p=66</guid>
		<description><![CDATA[This post will explain how to display messages using the TBalloonHint component that was added in Delphi 2009.  This approach is much less intrusive than traditional modal dialog boxes that steal focus and require user interaction.  Balloon hints simply display a message then disappear after a short period of time.  TBalloonHint is easy to use [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=lawrencebarsanti.wordpress.com&amp;blog=10682182&amp;post=66&amp;subd=lawrencebarsanti&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>This post will explain how to display messages using the TBalloonHint component that was added in Delphi 2009.  This approach is much less intrusive than traditional modal dialog boxes that steal focus and require user interaction.  Balloon hints simply display a message then disappear after a short period of time.  <img style="display:block;float:none;margin-left:auto;margin-right:auto;border-width:0;" title="ScreenShot" src="http://lawrencebarsanti.files.wordpress.com/2009/12/screenshot_thumb.png?w=302&#038;h=132" border="0" alt="ScreenShot" width="302" height="132" /></p>
<p>TBalloonHint is easy to use but there are a few subtleties that I will go over.  Controls, like TButton, have a Hint and a ShowHint property which can be used to popup text near the cursor when it is over a control;  TBalloonHint is a just a prettier and more flexible hint.  Hints are automatically displayed when the cursor is over a control so it is hard to find documentation that explains how to display a balloon hint programmatically.  That is what I will do here.</p>
<p><span style="text-decoration:underline;">Create and Configure</span></p>
<p>TBalloonHint is found in the ‘Additional’ section of the tool panel so it can be added to a form at design time.  Since the balloon hint is not being linked to any controls, I create and configure it in the OnCreate method instead.  The HideAfter property allows you to specify, in ms, how long the balloon will be shown before it is automatically hidden.  The Delay property allows you to specify, in ms, how long the hint should wait before appearing; the default this value is 500.<br />
<pre class="brush: delphi;">
procedure TForm1.FormCreate(Sender: TObject);
begin
  FBalloonHint := TBalloonHint.Create(Self);
  FBalloonHint.HideAfter := 5000;
  FBalloonHint.Delay := 0;
end;
</pre><br />
<span style="text-decoration:underline;">Show and Position</span></p>
<p>Before showing a balloon hint, the <strong>Title</strong> and <strong>Description</strong> properties can be used to specify its contents.  Once the contents are set, the <strong>ShowHint</strong> method can be used to display the hint.  Since the hint is not attached to a specific control, we need to pass some position information, using screen coordinates, to <strong>ShowHint. </strong></p>
<p>The orientation of the balloon depends on its screen location.  If the balloon is displayed in the bottom-half of the screen it looks like the image at the beginning and if it is displayed in the top-half of the screen it will look like the image below.   Thus telling a balloon to pop-up at the TopLeft or BottomRight corner of a control does not work well because one of the balloon orientations will cause it to cover the  control .<a href="http://lawrencebarsanti.files.wordpress.com/2009/12/screenshotbelow.png"><img style="display:block;float:none;margin-left:auto;margin-right:auto;border-width:0;" title="ScreenShotBelow" src="http://lawrencebarsanti.files.wordpress.com/2009/12/screenshotbelow_thumb.png?w=240&#038;h=105" border="0" alt="ScreenShotBelow" width="240" height="105" /></a>This problem can be solved by passing a rectangle to ShowHint instead of a point.  When a rectangle is passed to ShowHint it will make sure that the region inside the rectangle remains visible when the hint is shown.</p>
<p><pre class="brush: delphi;">
procedure TForm1.Button1Click(Sender: TObject);
var
  R: TRect;
begin
  FBalloonHint.Description := 'You pressed ' + Button1.Caption;
  R := Button1.BoundsRect;
  R.TopLeft := ClientToScreen(R.TopLeft);
  R.BottomRight := ClientToScreen(R.BottomRight);
  FBalloonHint.ShowHint(R);
end;
</pre></p>
<p><span style="text-decoration:underline;">When to Hide</span></p>
<p>Balloon hints are created in their own window so it is important to hide them when your application is moved, minimized, resized or covered by another application.  The image below shows what happens when you move the form without hiding the hint.<a href="http://lawrencebarsanti.files.wordpress.com/2009/12/screenshotmoved.png"><img style="display:block;float:none;margin-left:auto;margin-right:auto;border-width:0;" title="ScreenShotMoved" src="http://lawrencebarsanti.files.wordpress.com/2009/12/screenshotmoved_thumb.png?w=240&#038;h=105" border="0" alt="ScreenShotMoved" width="240" height="105" /></a>You only have to process two Windows messages (WM_ACTIVATEAPP and WM_WINDOWPOSCHANGED) to cover all of these situations.  To process these messages, define the following message handling functions in the protected section of the form.<br />
<pre class="brush: delphi;">
protected
  procedure WMWindowPosChanged(var AMessage:TMessage); message WM_WINDOWPOSCHANGED;
  procedure WMActivateApp(var AMessage: TMessage); message WM_ACTIVATEAPP;
</pre></p>
<p>When you implement the functions make sure to call inherited to run the form’s message handlers.  It is possible for these message to come before the TBalloonHint object has been created so do not forget to check if it has been assigned.<br />
<pre class="brush: delphi;">
procedure TForm1.WMActivateApp(var AMessage: TMessage);
begin
  if Assigned(FBalloonHint) then FBalloonHint.HideHint;
  inherited;
end;
procedure TForm1.WMWindowPosChanged(var AMessage: TMessage);
begin
  if Assigned(FBalloonHint) then FBalloonHint.HideHint;
  inherited;
end;
</pre></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/lawrencebarsanti.wordpress.com/66/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/lawrencebarsanti.wordpress.com/66/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/lawrencebarsanti.wordpress.com/66/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/lawrencebarsanti.wordpress.com/66/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/lawrencebarsanti.wordpress.com/66/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/lawrencebarsanti.wordpress.com/66/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/lawrencebarsanti.wordpress.com/66/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/lawrencebarsanti.wordpress.com/66/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/lawrencebarsanti.wordpress.com/66/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/lawrencebarsanti.wordpress.com/66/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/lawrencebarsanti.wordpress.com/66/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/lawrencebarsanti.wordpress.com/66/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/lawrencebarsanti.wordpress.com/66/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/lawrencebarsanti.wordpress.com/66/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=lawrencebarsanti.wordpress.com&amp;blog=10682182&amp;post=66&amp;subd=lawrencebarsanti&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://lawrencebarsanti.wordpress.com/2009/12/16/display-error-messages-with-tballoonhint/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/0308282a565f3fce9a791022791536f6?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">lawrencebarsanti</media:title>
		</media:content>

		<media:content url="http://lawrencebarsanti.files.wordpress.com/2009/12/screenshot_thumb.png" medium="image">
			<media:title type="html">ScreenShot</media:title>
		</media:content>

		<media:content url="http://lawrencebarsanti.files.wordpress.com/2009/12/screenshotbelow_thumb.png" medium="image">
			<media:title type="html">ScreenShotBelow</media:title>
		</media:content>

		<media:content url="http://lawrencebarsanti.files.wordpress.com/2009/12/screenshotmoved_thumb.png" medium="image">
			<media:title type="html">ScreenShotMoved</media:title>
		</media:content>
	</item>
		<item>
		<title>Is your app really that important?</title>
		<link>http://lawrencebarsanti.wordpress.com/2009/12/11/is-your-app-really-that-important/</link>
		<comments>http://lawrencebarsanti.wordpress.com/2009/12/11/is-your-app-really-that-important/#comments</comments>
		<pubDate>Fri, 11 Dec 2009 15:00:20 +0000</pubDate>
		<dc:creator>lawrencebarsanti</dc:creator>
				<category><![CDATA[my posts]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://lawrencebarsanti.wordpress.com/?p=57</guid>
		<description><![CDATA[I recently bought an HP laptop that came loaded with its fair share of bloatware.  Over the years, I have managed to shake my OCD dreams of a ‘clean’ system so when I brought my shiny new laptop home I just started using it.  I started installing all my development tools, some handy apps (see [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=lawrencebarsanti.wordpress.com&amp;blog=10682182&amp;post=57&amp;subd=lawrencebarsanti&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I recently bought an HP laptop that came loaded with its fair share of bloatware.  Over the years, I have managed to shake my OCD dreams of a ‘clean’ system so when I brought my shiny new laptop home I just started using it.  I started installing all my development tools, some handy apps (see <a href="http://bluemars.org/clipx/">clipx</a>, <a href="http://notepad-plus.sourceforge.net/uk/site.htm">notepad++</a>), ect…</p>
<p>Once my system was setup the way I like it, I sat down to write some code.  I fired up Delphi, typed in a new function definition, then used one of my favourite shortcuts, Shift+Ctrl+C, to generate corresponding code in the implementation section.  Hmmm… this is taking longer than usual… HP Health Check… WTF?  Maybe it’s just a coincidence?  Shift+Ctrl+C …. HP Health Check … Dammit!</p>
<p>That right, someone at HP thought that HP Health Check was important enough to warrant the use of a system wide hot key that supersedes any application hot keys (accelerator keys).  News Flash… it isn’t.</p>
<p>In their defence, they probably have a semi-legitimate reason for doings this (make life easier for tech support?) and they did pick a lesser used combination.  Unfortunately, this seemingly harmless convenience actually breaks any application which uses that accelerator key combination.  A quick search for Shift+Ctrl+C revealed several post requesting help because Shift+Ctrl+C is not working in their version of:</p>
<ul>
<li>Photoshop</li>
<li>The Sims</li>
<li>Spore</li>
<li>etc&#8230;</li>
</ul>
<p>Before you plan on adding any global hooks to your application please consider the following:  <em>It is unlikely that a user intends to do anything with your application unless they are actually using it.</em></p>
<p><strong> </strong></p>
<p><strong>Are you the victim of Accelerator Key theft? </strong></p>
<p>To get rid of unwanted system wide hotkeys you can use this approach:</p>
<ol>
<li>delete the executable that is launched by the hotkey</li>
<li>use the hotkey sequence</li>
<li>a window will pop up stating that there is a problem with the shortcut</li>
<li>choose to delete the shortcut</li>
<li>restore the executable</li>
</ol>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/lawrencebarsanti.wordpress.com/57/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/lawrencebarsanti.wordpress.com/57/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/lawrencebarsanti.wordpress.com/57/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/lawrencebarsanti.wordpress.com/57/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/lawrencebarsanti.wordpress.com/57/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/lawrencebarsanti.wordpress.com/57/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/lawrencebarsanti.wordpress.com/57/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/lawrencebarsanti.wordpress.com/57/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/lawrencebarsanti.wordpress.com/57/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/lawrencebarsanti.wordpress.com/57/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/lawrencebarsanti.wordpress.com/57/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/lawrencebarsanti.wordpress.com/57/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/lawrencebarsanti.wordpress.com/57/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/lawrencebarsanti.wordpress.com/57/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=lawrencebarsanti.wordpress.com&amp;blog=10682182&amp;post=57&amp;subd=lawrencebarsanti&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://lawrencebarsanti.wordpress.com/2009/12/11/is-your-app-really-that-important/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/0308282a565f3fce9a791022791536f6?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">lawrencebarsanti</media:title>
		</media:content>
	</item>
	</channel>
</rss>
