<?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>funkjedi &#187; javascript</title>
	<atom:link href="http://funkjedi.com/tags/javascript/feed/" rel="self" type="application/rss+xml" />
	<link>http://funkjedi.com</link>
	<description>Making government official breath harder than Darth Vader</description>
	<lastBuildDate>Fri, 23 Mar 2012 15:40:47 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Automatically Format Any Javascript Code</title>
		<link>http://funkjedi.com/technology/225-automatically-format-any-javascript-code/</link>
		<comments>http://funkjedi.com/technology/225-automatically-format-any-javascript-code/#comments</comments>
		<pubDate>Sun, 21 Jun 2009 16:07:16 +0000</pubDate>
		<dc:creator>funkjedi</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://funkjedi.com/?p=225</guid>
		<description><![CDATA[Every javascript programmer at somepoint finds themself in a situation where they need to undo the effects of a packer or minifier on their code. Javascript Beautifier to the rescue. It lets you cleanup the super scrunched up code into something more readable. This enables you to recover your source files if you lost your originals [...]]]></description>
			<content:encoded><![CDATA[<p>Every javascript programmer at somepoint finds themself in a situation where they need to undo the effects of a packer or minifier on their code. <a href="http://jsbeautifier.org/">Javascript Beautifier</a> to the rescue.</p>
<p><img class="alignnone size-full wp-image-226" title="Javascript Beautifier" src="http://funkjedi.com/wp-content/uploads/2009/06/javascript-beautifier.png" alt="Javascript Beautifier" width="719" height="187" /></p>
<p>It lets you cleanup the super scrunched up code into something more readable. This enables you to recover your source files if you lost your originals or dig through someone elses code and get a better idea of how other people in the real world are coding.</p>
]]></content:encoded>
			<wfw:commentRss>http://funkjedi.com/technology/225-automatically-format-any-javascript-code/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Passpack + Chrome = Frustration</title>
		<link>http://funkjedi.com/technology/217-passpack-chrome-frustration/</link>
		<comments>http://funkjedi.com/technology/217-passpack-chrome-frustration/#comments</comments>
		<pubDate>Sat, 20 Jun 2009 06:40:09 +0000</pubDate>
		<dc:creator>funkjedi</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[chrome]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[passpack]]></category>

		<guid isPermaLink="false">http://funkjedi.com/?p=217</guid>
		<description><![CDATA[Everyday I log into Passpack and leave it open all day. So here&#8217;s the problem after having Passpack open for a while I get the following message (it is extremely annoying as it interupts whatever else your up to on the net). This only happens for me in Chrome. It works like butter in Firefox [...]]]></description>
			<content:encoded><![CDATA[<p>Everyday I log into Passpack and leave it open all day. So here&#8217;s the problem after having Passpack open for a while I get the following message (it is extremely annoying as it interupts whatever else your up to on the net). This only happens for me in Chrome. It works like butter in Firefox and I can&#8217;t speak for IE.</p>
<p><img class="alignnone size-full wp-image-184" title="Passpack History Problem" src="http://funkjedi.com/wp-content/uploads/2009/06/Untitled.png" alt="Passpack History Problem" width="362" height="154" /></p>
<p>The initial trigger for the message seems to be random. But after it initial message is seems to come back around every 3 minutes. So I did some digging. After poking around in the source I discovered that they&#8217;re using an older version of Tako Sano&#8217;s <a href="http://www.mikage.to/jquery/jquery_history.html">jQuery history plugin</a>.</p>
<p>So I added some code to the historyCallback do some logging so I could get a better feel for what was going on.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;">errorOccurred <span style="color: #339933;">=</span> lastErrorOccurred <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> Date<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">getTime</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
_back <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>h<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>_backOk<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>_backCallback<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            _backCallback<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            _backCallback <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">null</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
        <span style="color: #003366; font-weight: bold;">var</span> hh <span style="color: #339933;">=</span> parseInt<span style="color: #009900;">&#40;</span>h<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #003366; font-weight: bold;">var</span> m <span style="color: #339933;">=</span> $.<span style="color: #660066;">browser</span>.<span style="color: #660066;">netscape</span> <span style="color: #339933;">?</span> <span style="color: #CC0000;">2</span> <span style="color: #339933;">:</span> $.<span style="color: #660066;">browser</span>.<span style="color: #660066;">msie</span> <span style="color: #339933;">?</span> <span style="color: #CC0000;">3</span> <span style="color: #339933;">:</span> <span style="color: #CC0000;">7</span><span style="color: #339933;">;</span>
        <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>hh <span style="color: #339933;">&gt;</span> m<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            errorOccurred <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> Date<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">getTime</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            console.<span style="color: #660066;">log</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;hh: &quot;</span><span style="color: #339933;">+</span> hh <span style="color: #339933;">+</span><span style="color: #3366CC;">&quot;, m: &quot;</span><span style="color: #339933;">+</span> m <span style="color: #339933;">+</span><span style="color: #3366CC;">&quot;, delta: &quot;</span><span style="color: #339933;">+</span> <span style="color: #009900;">&#40;</span>errorOccurred <span style="color: #339933;">-</span> lastErrorOccurred<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            lastErrorOccurred <span style="color: #339933;">=</span> errorOccurred<span style="color: #339933;">;</span>
            <span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span>PP.<span style="color: #660066;">msg</span>.<span style="color: #660066;">man</span>.<span style="color: #660066;">bac</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;">&#125;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>After letting this run for a while I started to see a pattern. Here&#8217;s an excerpt of the results.</p>
<ul>
<li>hh: 8, m: 7, delta: 209901 (~3.4 minutes)</li>
<li>hh: 8, m: 7, delta: 200888 (~3.3 minutes)</li>
<li>hh: 8, m: 7, delta: 190944 (~3.2 minutes)</li>
<li>hh: 8, m: 7, delta: 183514 (~3.0 minutes)</li>
<li>hh: 8, m: 7, delta: 197517 (~3.3 minutes)</li>
</ul>
<p>For webkit (Chrome/Safari) based browsers the <a href="http://www.mikage.to/jquery/jquery_history.html">jQuery history plugin</a> manually creates a stack to keep track of the history. So this is where I believe we are encountering the problem. If you look at line 4426 you can see that we create a history with a stack length of 9.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;">_back <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>h<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>_backOk<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>_backCallback<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            _backCallback<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            _backCallback <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">null</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
        <span style="color: #003366; font-weight: bold;">var</span> hh <span style="color: #339933;">=</span> parseInt<span style="color: #009900;">&#40;</span>h<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #003366; font-weight: bold;">var</span> m <span style="color: #339933;">=</span> $.<span style="color: #660066;">browser</span>.<span style="color: #660066;">netscape</span> <span style="color: #339933;">?</span> <span style="color: #CC0000;">2</span> <span style="color: #339933;">:</span> $.<span style="color: #660066;">browser</span>.<span style="color: #660066;">msie</span> <span style="color: #339933;">?</span> <span style="color: #CC0000;">3</span> <span style="color: #339933;">:</span> <span style="color: #CC0000;">7</span><span style="color: #339933;">;</span>
        <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>hh <span style="color: #339933;">&gt;</span> m<span style="color: #009900;">&#41;</span> <span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span>PP.<span style="color: #660066;">msg</span>.<span style="color: #660066;">man</span>.<span style="color: #660066;">bac</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: #339933;">;</span>
runHistory <span style="color: #339933;">=</span> <span style="color: #003366; 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;">historyInit</span><span style="color: #009900;">&#40;</span>_back<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    z <span style="color: #339933;">=</span> $.<span style="color: #660066;">browser</span>.<span style="color: #660066;">netscape</span> <span style="color: #339933;">?</span> <span style="color: #CC0000;">2</span> <span style="color: #339933;">:</span> $.<span style="color: #660066;">browser</span>.<span style="color: #660066;">msie</span> <span style="color: #339933;">?</span> <span style="color: #CC0000;">4</span> <span style="color: #339933;">:</span> <span style="color: #CC0000;">8</span><span style="color: #339933;">;</span>
    <span style="color: #000066; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">var</span> j <span style="color: #339933;">=</span> z<span style="color: #339933;">;</span> j <span style="color: #339933;">&gt;=</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">;</span> j<span style="color: #339933;">--</span><span style="color: #009900;">&#41;</span> $.<span style="color: #660066;">historyLoad</span><span style="color: #009900;">&#40;</span>j<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    _SetTimeout<span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        _backOk <span style="color: #339933;">=</span> <span style="color: #CC0000;">1</span>
    <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
    <span style="color: #CC0000;">3000</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>But on line 4419 we are working with a stack with a length of 8.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>4419
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;">        <span style="color: #003366; font-weight: bold;">var</span> m <span style="color: #339933;">=</span> $.<span style="color: #660066;">browser</span>.<span style="color: #660066;">netscape</span> <span style="color: #339933;">?</span> <span style="color: #CC0000;">2</span> <span style="color: #339933;">:</span> $.<span style="color: #660066;">browser</span>.<span style="color: #660066;">msie</span> <span style="color: #339933;">?</span> <span style="color: #CC0000;">3</span> <span style="color: #339933;">:</span> <span style="color: #CC0000;">7</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>Shouldn&#8217;t this read as follows?</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>4419
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;">        <span style="color: #003366; font-weight: bold;">var</span> m <span style="color: #339933;">=</span> $.<span style="color: #660066;">browser</span>.<span style="color: #660066;">netscape</span> <span style="color: #339933;">?</span> <span style="color: #CC0000;">2</span> <span style="color: #339933;">:</span> $.<span style="color: #660066;">browser</span>.<span style="color: #660066;">msie</span> <span style="color: #339933;">?</span> <span style="color: #CC0000;">4</span> <span style="color: #339933;">:</span> <span style="color: #CC0000;">8</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://funkjedi.com/technology/217-passpack-chrome-frustration/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
	</channel>
</rss>

