<?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>BarelyBlogging &#187; programming</title>
	<atom:link href="http://www.barelyfitz.com/blog/archives/category/programming/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.barelyfitz.com/blog</link>
	<description>Patrick Fitzgerald of BarelyFitz Designs</description>
	<lastBuildDate>Tue, 27 Jul 2010 00:32:53 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>workaround for entity bug (?) in tabber</title>
		<link>http://www.barelyfitz.com/blog/archives/2007/02/06/527/</link>
		<comments>http://www.barelyfitz.com/blog/archives/2007/02/06/527/#comments</comments>
		<pubDate>Tue, 06 Feb 2007 13:25:49 +0000</pubDate>
		<dc:creator>pat</dc:creator>
				<category><![CDATA[DHTML]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[UI]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[tabber]]></category>
		<category><![CDATA[tabbifier]]></category>
		<category><![CDATA[user interface]]></category>
		<category><![CDATA[web design]]></category>
		<category><![CDATA[webdesign]]></category>

		<guid isPermaLink="false">http://www.barelyfitz.com/blog/archives/2007/02/06/527/</guid>
		<description><![CDATA[A user of my tabber script discovered that when his tab headings had an ampersand character like this:
&#60;h2&#62;Me &#38;amp; My Shadow&#60;/h2&#62;
Then the tab control displayed &#8220;&#38;amp;&#8221; instead of a single ampersand character.
It looks like this occurs because the JavaScript DOM function document.createTextNode() does not convert entities. However, it looks like innerHTML does convert entities, so [...]]]></description>
			<content:encoded><![CDATA[<p>A user of my <a href="http://www.barelyfitz.com/projects/tabber/">tabber</a> script discovered that when his tab headings had an ampersand character like this:</p>
<p><code>&lt;h2&gt;Me &amp;amp; My Shadow&lt;/h2&gt;</code></p>
<p>Then the tab control displayed &#8220;&amp;amp;&#8221; instead of a single ampersand character.</p>
<p>It looks like this occurs because the JavaScript DOM function document.createTextNode() does not convert entities. However, it looks like innerHTML does convert entities, so to fix your problem find the following line in <a href="http://www.barelyfitz.com/projects/tabber/tabber.js">tabber.js</a>:</p>
<p><code>DOM_a.appendChild(document.createTextNode(t.headingText));</code></p>
<p>and replace with the following:</p>
<p><code>DOM_a.innerHTML = t.headingText;</code></p>
<p>I&#8217;ll think about this some more and if I can&#8217;t find any bad side effects I&#8217;ll add to the tabber code.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.barelyfitz.com/blog/archives/2007/02/06/527/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>How to beg</title>
		<link>http://www.barelyfitz.com/blog/archives/2006/05/03/357/</link>
		<comments>http://www.barelyfitz.com/blog/archives/2006/05/03/357/#comments</comments>
		<pubDate>Wed, 03 May 2006 16:39:28 +0000</pubDate>
		<dc:creator>pat</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://www.barelyfitz.com/blog/archives/2006/05/03/357/</guid>
		<description><![CDATA[
I provide some free open source software, and to help defray the costs of this website, I usually beg for PayPal donations.
Here&#8217;s a JavaScript function I use, attached to the download link, to annoy people into sending me a donation:
function begForMoney()
{
  if (!arguments.callee.stopBegging) {
    arguments.callee.stopBegging = true;
    alert("Please [...]]]></description>
			<content:encoded><![CDATA[<div class=shadow><img id="image358" src="http://www.barelyfitz.com/blog/upload/beg.jpg" alt="dog begging" /></div>
<p>I provide some free <a href="http://www.barelyfitz.com/projects/">open source software</a>, and to help defray the costs of this website, I usually beg for PayPal donations.</p>
<p>Here&#8217;s a JavaScript function I use, attached to the download link, to annoy people into sending me a donation:</p>
<pre style="clear:both">function begForMoney()
{
  if (!arguments.callee.stopBegging) {
    arguments.callee.stopBegging = true;
    alert("Please donate!");
  }
}</pre>
<p>Here&#8217;s how to attach it to a link. You can attach it to multiple links on the page, and it only triggers an alert the first time it is clicked.</p>
<pre>&lt;a href="" onclick="begForMoney()"&gt;Download&lt;/a&gt;</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.barelyfitz.com/blog/archives/2006/05/03/357/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Three more things you should not do in JavaScript</title>
		<link>http://www.barelyfitz.com/blog/archives/2006/04/11/328/</link>
		<comments>http://www.barelyfitz.com/blog/archives/2006/04/11/328/#comments</comments>
		<pubDate>Tue, 11 Apr 2006 20:11:27 +0000</pubDate>
		<dc:creator>pat</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://www.barelyfitz.com/blog/archives/2006/04/11/328/</guid>
		<description><![CDATA[
On the Yahoo! user interface blog I just saw their post &#8220;with Statement Considered Harmful&#8220;. Good advice.
Here are a few more things that I never do in JavaScript:

 Never use the &#8220;with&#8221; statement (as described above)
 Never use single line &#8220;//&#8221; comments. Use &#8220;/**/&#8221;. One day your code is going to be mangled and the [...]]]></description>
			<content:encoded><![CDATA[<div class=shadow><img id="image329" src="http://www.barelyfitz.com/blog/upload/see-no-evil.jpg" alt="see-no-evil.jpg" /></div>
<p>On the Yahoo! user interface blog I just saw their post &#8220;<a href="http://yuiblog.com/blog/2006/04/11/with-statement-considered-harmful/">with Statement Considered Harmful</a>&#8220;. Good advice.</p>
<p>Here are a few more things that I never do in JavaScript:</p>
<ol>
<li> Never use the &#8220;with&#8221; statement (as described above)</li>
<li> Never use single line &#8220;//&#8221; comments. Use &#8220;/**/&#8221;. One day your code is going to be mangled and the newlines removed (perhaps by a crappy content management system), and suddenly your code will be commented out.
<p>Before:</p>
<pre>// a comment
alert('ping!');</pre>
<p>After: (UH OH!)</p>
<pre>// a comment alert('ping!');</pre>
</li>
<li> Never omit the semi-colon after a statement. Again, this is to protect your code in case the newlines are removed, and to make the code easier to parse (by humans and machines).
<p>Before:</p>
<pre>var t = 'ping!'
alert('ping!')</pre>
<p>After: (ERROR)</p>
<pre>var t = 'ping!' alert('ping!')</pre>
<p>This can be harder than it seems! For example, in the following example you should add a semi-colon after the closing brace:</p>
<pre>var myFunc =
function() {
alert('ping!');
}</pre>
</li>
<li> Never omit the optional brackets { } around a statement. This can prevent some hard-to-debug errors when you add and remove code.
<p>Before: (MISLEADING INDENT!)</p>
<pre>if (true)
    alert('ping!');
    deleteItem();</pre>
<p>Fixed: (UNAMBIGUOUS)</p>
<pre>if (true) {
    alert('ping!');
}
deleteItem();</pre>
</li>
</ol>
<p>To check your code for missing semicolons and brackets, use <a href="http://www.jslint.com">JSLint</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.barelyfitz.com/blog/archives/2006/04/11/328/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Screencast: Diagnose a JavaScript Memory Leak in the Windows IE Browser</title>
		<link>http://www.barelyfitz.com/blog/archives/2006/03/30/289/</link>
		<comments>http://www.barelyfitz.com/blog/archives/2006/03/30/289/#comments</comments>
		<pubDate>Thu, 30 Mar 2006 14:35:13 +0000</pubDate>
		<dc:creator>pat</dc:creator>
				<category><![CDATA[AJAX]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[memory]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[screencast]]></category>

		<guid isPermaLink="false">http://www.barelyfitz.com/blog/archives/2006/03/30/289/</guid>
		<description><![CDATA[
Here&#8217;s a new screencast:
Screencast: JavaScript Memory Leaks in the Windows IE Browser
This screencast by Patrick Fitzgerald of BarelyFitz Designs discusses how he diagnosed and fixed a memory leak in a JavaScript library. It&#8217;s a very simplified example, and the same techniques probably can&#8217;t be used for more complex web applications, but it might shed some [...]]]></description>
			<content:encoded><![CDATA[<div class="shadow"><img alt="microphone" id="image292" src="http://www.barelyfitz.com/blog/upload/microphone.jpg" /></div>
<p>Here&#8217;s a new screencast:</p>
<p><a href="http://www.barelyfitz.com/screencast/javascript/memory-leak/">Screencast: JavaScript Memory Leaks in the Windows IE Browser</a></p>
<blockquote><p>This screencast by <a href="http://www.barelyfitz.com/homepages/patrick.fitzgerald/">Patrick Fitzgerald</a> of <a href="http://www.barelyfitz.com//">BarelyFitz Designs</a> discusses how he diagnosed and fixed a memory leak in a JavaScript library. It&#8217;s a very simplified example, and the same techniques probably can&#8217;t be used for more complex web applications, but it might shed some light on how these memory leaks occur.</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.barelyfitz.com/blog/archives/2006/03/30/289/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>JavaScript-safe string variable</title>
		<link>http://www.barelyfitz.com/blog/archives/2006/03/13/241/</link>
		<comments>http://www.barelyfitz.com/blog/archives/2006/03/13/241/#comments</comments>
		<pubDate>Mon, 13 Mar 2006 16:10:06 +0000</pubDate>
		<dc:creator>pat</dc:creator>
				<category><![CDATA[HTML]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://www.barelyfitz.com/blog/archives/2006/03/13/241/</guid>
		<description><![CDATA[If you have a bunch of funky data to store in a JavaScript string, for example some HTML, you have to be careful to &#8220;escape&#8221; all the special characters so it doesn&#8217;t break your script.
Or you can just use my web data encoder and choose &#8220;JavaScript-safe&#8221; variable:

You can also use other encodings, such as encodeURIComponent [...]]]></description>
			<content:encoded><![CDATA[<p>If you have a bunch of funky data to store in a JavaScript string, for example some HTML, you have to be careful to &#8220;escape&#8221; all the special characters so it doesn&#8217;t break your script.</p>
<p>Or you can just use my web data encoder and choose &#8220;JavaScript-safe&#8221; variable:</p>
<p><a href="http://www.barelyfitz.com/projects/encoder/"><img alt="web data encoder" src="http://www.barelyfitz.com/blog/upload/encoder.gif" /></a></p>
<p>You can also use other encodings, such as <em>encodeURIComponent</em> to make a complex URL safe to pass as a component of another URL.</p>
<p><a href="http://www.barelyfitz.com/projects/encoder/">Web Data Encoder for JavaScript-safe variables</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.barelyfitz.com/blog/archives/2006/03/13/241/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
