<?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>ReadyState4</title>
	<atom:link href="http://readystate4.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://readystate4.com</link>
	<description>JavaScript, Web Development, Ruby, and Technology.</description>
	<lastBuildDate>Fri, 04 Jun 2010 19:42:44 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Great article for learning JavaScript for existing programmers</title>
		<link>http://readystate4.com/2010/06/04/great-article-for-learning-javascript-for-existing-programmers/</link>
		<comments>http://readystate4.com/2010/06/04/great-article-for-learning-javascript-for-existing-programmers/#comments</comments>
		<pubDate>Fri, 04 Jun 2010 19:36:39 +0000</pubDate>
		<dc:creator>Mauvis</dc:creator>
				<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://readystate4.com/?p=67</guid>
		<description><![CDATA[I&#8217;ve been teaching JavaScript to a person with no programming experience and one with lots of programming experience in other languages. Both situations can be tough as one has to learn certain programing concepts (as well as how the web generally works) and the other must unlearn some that don&#8217;t apply here (like getting out [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been teaching JavaScript to a person with no programming experience and one with lots of programming experience in other languages. Both situations can be tough as one has to learn certain programing concepts (as well as how the web generally works) and the other must unlearn some that don&#8217;t apply here (like getting out of the strongly-typed world and appreciating the benefits of duck-typing).</p>
<p>Explaining various concepts in JS such as prototypes, closures, and even &#8220;literal&#8221; shorthand is interesting. I find the questions from both ends  great—sometimes even challenging to explain which actually strengthens me as a JS developer. Still some concepts are hard to explain and the JavaScript Rhino book is too large and boring to dish out as homework. Then I stumbled across this page by Simon Willison which was written as a re-introduction to JavaScript but also makes a perfect condensed overview of what JS is for existing programmers: <a href="https://developer.mozilla.org/en/A_re-introduction_to_JavaScript">https://developer.mozilla.org/en/A_re-introduction_to_JavaScript</a>. It even goes over a little history of the language and how to avoid nasty memory leaks in IE (circular references). Saves us a lot of time and explaining so that we can continue with more complex topics.</p>
]]></content:encoded>
			<wfw:commentRss>http://readystate4.com/2010/06/04/great-article-for-learning-javascript-for-existing-programmers/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>TeamViewer constantly crashing?</title>
		<link>http://readystate4.com/2010/01/08/teamviewer-constantly-crashing/</link>
		<comments>http://readystate4.com/2010/01/08/teamviewer-constantly-crashing/#comments</comments>
		<pubDate>Fri, 08 Jan 2010 20:09:47 +0000</pubDate>
		<dc:creator>Mauvis</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://readystate4.com/?p=64</guid>
		<description><![CDATA[If you suddendly find your TeamViewer crashing every time you open it simply delete it&#8217;s plist file and you&#8217;re good to go: 
/Users/&#60;YourName&#62;/Library/Preferences/com.TeamViewer.settings.plist
Thanks to Christian Hägele (of TeamViewer) for the fix.
]]></description>
			<content:encoded><![CDATA[<p>If you suddendly find your TeamViewer crashing every time you open it simply delete it&#8217;s plist file and you&#8217;re good to go: </p>
<pre>/Users/&lt;YourName&gt;/Library/Preferences/com.TeamViewer.settings.plist</pre>
<p>Thanks to Christian Hägele (of TeamViewer) for the fix.</p>
]]></content:encoded>
			<wfw:commentRss>http://readystate4.com/2010/01/08/teamviewer-constantly-crashing/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Bash argument unpacking</title>
		<link>http://readystate4.com/2009/09/10/bash-argument-unpacking/</link>
		<comments>http://readystate4.com/2009/09/10/bash-argument-unpacking/#comments</comments>
		<pubDate>Thu, 10 Sep 2009 19:31:14 +0000</pubDate>
		<dc:creator>Mauvis</dc:creator>
				<category><![CDATA[bash]]></category>

		<guid isPermaLink="false">http://readystate4.com/2009/09/10/bash-argument-unpacking/</guid>
		<description><![CDATA[I&#8217;m not a bash expert but my .bash_profile is packed with shortcut goodness to do all kinds of things on the quick. Most recently, I wondered how to fix up some of my function shortcuts to take any number of arguments (similar to this argument unpacking entry on how to do it in JavaScript and [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m not a bash expert but my <code>.bash_profile</code> is packed with shortcut goodness to do all kinds of things on the quick. Most recently, I wondered how to fix up some of my function shortcuts to take any number of arguments (similar to this <a href="http://readystate4.com/2008/08/17/javascript-argument-unpacking-converting-an-array-into-a-list-of-arguments/">argument unpacking entry</a> on how to do it in JavaScript and Ruby).</p>
<p>With a little Googling and IM&#8217;ing around to friends (thanks <a href="http://deserialized.com/">Bryan</a>), my limited argument functions:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> sc <span style="color: #7a0874; font-weight: bold;">&#123;</span>
        <span style="color: #c20cb9; font-weight: bold;">svn</span> commit $<span style="color: #000000;">1</span> $<span style="color: #000000;">2</span> $<span style="color: #000000;">3</span> $<span style="color: #000000;">4</span> $<span style="color: #000000;">5</span> $<span style="color: #000000;">6</span>               
<span style="color: #7a0874; font-weight: bold;">&#125;</span></pre></div></div>

<p>now take an unlimited number of arguments:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> sc <span style="color: #7a0874; font-weight: bold;">&#123;</span>
        <span style="color: #c20cb9; font-weight: bold;">svn</span> commit $<span style="color: #000000; font-weight: bold;">@</span>               
<span style="color: #7a0874; font-weight: bold;">&#125;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://readystate4.com/2009/09/10/bash-argument-unpacking/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Google Voice, Skype, the unrelenting phone industry, and a cool iPhone tip</title>
		<link>http://readystate4.com/2009/07/31/google-voice-skype-the-unrelenting-phone-industry-and-a-cool-iphone-tip/</link>
		<comments>http://readystate4.com/2009/07/31/google-voice-skype-the-unrelenting-phone-industry-and-a-cool-iphone-tip/#comments</comments>
		<pubDate>Sat, 01 Aug 2009 03:03:10 +0000</pubDate>
		<dc:creator>Mauvis</dc:creator>
				<category><![CDATA[iPhone]]></category>

		<guid isPermaLink="false">http://readystate4.com/2009/07/31/google-voice-skype-the-unrelenting-phone-industry-and-a-cool-iphone-tip/</guid>
		<description><![CDATA[A new toy
Yesterday I finally got my free Google Voice account and honestly, I didn&#8217;t know much about it until I finally started using it except the fact that you get one phone number to rule them all™ (also known as one number that rings all your phones.)

Turns out there&#8217;s a smorgasbord of features including, [...]]]></description>
			<content:encoded><![CDATA[<h3>A new toy</h3>
<p>Yesterday I finally got my free <a href="http://en.wikipedia.org/wiki/Google_Voice">Google Voice</a> account and honestly, I didn&#8217;t know much about it until I finally started using it except the fact that you get one phone number to rule them all™ (also known as one number that rings all your phones.)</p>
<p><img src="http://readystate4.com/images/blog/google_voice_logo.gif" style="float: left; padding: 0 15px 5px 0;" /></p>
<p>Turns out there&#8217;s a <a href="http://www.google.com/googlevoice/about.html">smorgasbord</a> of features including, automatic voicemail transcription, call recording, conferencing, per person / group personalized greetings, call blocking, and lastly, cheap international calling &#8211; all of which (besides the last feature) comes completely free. It&#8217;s such a future-thinking product that straps itself on our current outdated telephony architecture &#8211; with similar ideas having shifted whole industries in the past &#8211; that no wonder <a href="http://www.techcrunch.com/2009/07/27/apple-is-growing-rotten-to-the-core-and-its-likely-atts-fault/">AT&#038;T and Apple blocked it&#8217;s existence in the iPhone store</a> &#8211; a greedy decision that reflects both the industry&#8217;s avarice and unwillingness to get with the times. I mean, how long can $.10 text messages really last?</p>
<p>But I digress. I have some friends and relatives in South Korea that I like to call and have been using <a href="http://www.skype.com/allfeatures/callphones/">Skype</a> to be able to place international calls on the cheap. For $12.95 a month they offer unlimited calling to most of the world &#8211; unfortunately this doesn&#8217;t include mobiles (who uses land line these days, honestly?) Calling mobiles however, is still pretty cheap at $0.07 a minute (<a href="http://www.skype.com/prices/callrates/#allRatesTab">check your rates here</a>) and using the handy dandy Skype iPhone app I can still place calls using my phone instead of being tied to a computer.</p>
<p>The downside (again because of contractual obligation probably forced on Apple by AT&#038;T): you can only use Skype on the iPhone while connected to a wireless point, making it&#8217;s use limited to home, work, and the occasional wifi hotspot. Real big bummer. Additionally, you may deal with other annoyances such as a real call, text message, alert, or other process knocking you off the Skype app, and people sending you skype IM&#8217;s because they think you&#8217;re &#8220;online&#8221; when actually you just want to make a call. </p>
<h3>A new solution</h3>
<p>I&#8217;ve settled with these drawbacks and limitations for now (the proximity limitations being the biggest), hoping something will give eventually (and you know it has to because it&#8217;s 2009). Today for me it just did. Out comes Google Voice with so many new-fangled features you&#8217;ll feel like a VIP &#8211; the most important one for me: to place international calls on the cheap (0.6 cents for South Korean mobiles, <a href="http://www.google.com/support/voice/bin/answer.py?hl=en&#038;answer=141925">check your rates</a>.) </p>
<h3>A slight problem</h3>
<p>It&#8217;s interesting with all of Google&#8217;s technology and Google Voice&#8217;s ability to automatically transcribe your voicemails that there&#8217;s no audible method for dialing your friends. For example you can&#8217;t ring up your GV number and say &#8220;Dial Maria&#8217;s mobile&#8221; &#8211; you have to manually key in the 15+ digit international number and, considering most people&#8217;s short term memory capacity of <a href="http://en.wikipedia.org/wiki/The_Magical_Number_Seven,_Plus_or_Minus_Two">seven, plus or minus two</a>, you probably won&#8217;t know it either without referencing it. Now I&#8217;m almost 100% sure that this feature is coming and in the meantime you might be able to do the phone-app-to-contacts-app-switcheroony a couple times to key it in, but I propose an easier solution. </p>
<p>While the process isn&#8217;t as easy as two-clicks on an iPhone app, I&#8217;ve streamlined it so you might even say it&#8217;s easier than Skype app (at least more natural) after setting it up (providing you have a Google Voice account &#8211; you did request an <a href="https://services.google.com/fb/forms/googlevoiceinvite/">invite</a> didn&#8217;t you?) and you get the benefit of using it everywhere, not just when you&#8217;re connected to a wifi point.</p>
<div class="thumb_left" style="width: 330px; padding-bottom: 5px;">
<img src="http://readystate4.com/images/blog/minsocontact.gif" /></p>
<div style="text-align: center;">Easy cheesy one click calling!</div>
</div>
<h3>One click international calling with Google Voice on the iPhone</h3>
<p>At work, I occasionally have to call in meetings which involves dialing a conference number and a long pin number to enter the &#8220;room&#8221;. I instantly wanted to automate this process so I only had to click one button to call the number, wait, and enter the pin. What&#8217;s  more is that these meetings can go on for long amounts of time and considering I don&#8217;t have an unlimited phone plan, I wanted to use Skype, my laptop, and <a href="http://www.amazon.com/Sennheiser-PC-166-Multimedia-Headset/dp/B000H0IDUW/ref=sr_1_1?ie=UTF8&#038;qid=1249092311&#038;sr=8-1">a very nice headset</a>. After various attempts and endless minutes of online searching I found that this <a href="http://forum.skype.com/index.php?showtopic=93836">just</a> <a href="http://forum.skype.com/index.php?showtopic=61488">wasn&#8217;t</a> <a href="http://forum.skype.com/lofiversion/index.php/t58842.html">possible</a>. <a href="http://forum.skype.com/index.php?showtopic=142571">Really</a>. There is no pause option in Skype (some think it&#8217;s intentional.) Lucky for us the iPhone can. So some tinkering and a new address book entry later I have one click conferencing, my AT&#038;T bill be damned:</p>
<p><code style="color: black; font-weight: bold">1 (555) 555-5555 , 1234567#</code> <br />(Note: the comma creates a two second delay.)</p>
<p>To place a call using your Google Voice account you call your Google Voice number via your phone. From there, after entering your four digit pin, you can access the menu where you can access Google information (GOOG411), check voicemail, place a call, or change your settings.  After messing around with the timing I came up with this which works great.</p>
<h3 style="padding-bottom: 10px;">The master equation:</h3>
<p><code style="color: black; font-weight: bold; font-size: 24px;">(aaa) aaa-aaaa , pppp, 2, 011 bb cccccccccc#</code> </p>
<p>Where:<br />
a = your Google Voice number<br />
p = your Google Voice pin number</br /><br />
b = country code of the number you&#8217;re dialing<br />
c = local number of the number you&#8217;re dialing</p>
<p>Create a new entry under your contacts, save it under your favorites, and prepare to burn money at pennies a minute from anywhere (in the US at least).</p>
<p>Sure beats ATT&#038;T&#8217;s <a href="http://www.wireless.att.com/travelguide/coverage/product_rates_compare.jsp?PIDL=IRSD|IRWT">$2.29 a minute</a>.</p>
<h3>Additional benefits:</h3>
<ul>
<li>It&#8217;s a regular phone call but you gain all the benefits of GV! Press *4 for example to start recording your conversation and *4 to stop. Your recording will be in your Google Voice web account.</li>
<li>If you have a 3Gs, the numbers you save can be dialed via Voice Control. I created custom phone labels &#8220;goog mobile&#8221; and &#8220;goog home&#8221;. To dial a person via Voice Control I say &#8220;Call Sara google mobile&#8221; (even though I say the extra &#8216;le&#8217; it&#8217;s still a close enough match and works everytime.)</li>
<li>Because you&#8217;re making a real phone call you can use third party devices such as a bluetooth headset (something you can&#8217;t currently do with the Skype app) and you won&#8217;t be knocked off of your call by other processes.</li>
<li>I believe the sound quality is better than Skype and a fellow friend who uses GV agrees.</li>
</ul>
<h3>Drawbacks:</h3>
<ul>
<li>Even though it&#8217;s automated the whole dialing and connecting process takes about 30 seconds.</li>
<li>Because you&#8217;re making a real local call you&#8217;re using your regular minutes compared to Skype where you&#8217;re using none. If you&#8217;re like me though you have a ton including a dwindling number of roll over minutes that drop off after 12 months. Us&#8217;em before you lose&#8217;em!</li>
<li>Since you&#8217;re essentially storing your GV pin in your address book there are some security issues around that (don&#8217;t worry, no one you call can see your pin when you call them). In order for someone to actually access your voicemail they would need to be using your phone (or know how to spoof it&#8217;s number.) No one can access your GV homepage without knowing your Google password even if they knew your pin. I auto-lock my phone so it&#8217;s slightly less of an issue but just be sure not to use the same PIN for your phone, ATM, or other passwords. You&#8217;ve been warned!</li>
</ul>
<h3>Additional notes:</h3>
<ul>
<li>If you don&#8217;t know the country code <a href="http://www.countrycodes.com/">check here</a>.</li>
<li>Remember that you can always sync over changes from your computer&#8217;s address book if you don&#8217;t want to type so much on your phone or have a lot of new numbers to input.</li>
<li>There&#8217;s no easy way to add a space in a phone number field on the iPhone (except maybe through copy / paste) so if you want pretty numbers use your computer&#8217;s address book.</li>
</ul>
<p>So that&#8217;s it, I hope it helps someone out!</p>
]]></content:encoded>
			<wfw:commentRss>http://readystate4.com/2009/07/31/google-voice-skype-the-unrelenting-phone-industry-and-a-cool-iphone-tip/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Git: Ignore changes in a working tree file</title>
		<link>http://readystate4.com/2009/05/21/git-ignore-changes-in-a-working-tree-file/</link>
		<comments>http://readystate4.com/2009/05/21/git-ignore-changes-in-a-working-tree-file/#comments</comments>
		<pubDate>Thu, 21 May 2009 20:36:12 +0000</pubDate>
		<dc:creator>Mauvis</dc:creator>
				<category><![CDATA[git]]></category>

		<guid isPermaLink="false">http://readystate4.com/2009/05/21/git-ignore-changes-in-a-working-tree-file/</guid>
		<description><![CDATA[Lately, I&#8217;ve transferred all my repos over from Subversion to Git and have become familiar enough with the Git SVN bindings to even work on my work projects in Git while still being able to check-in as a regular SVN user. 
I&#8217;ve found that some usual stuff Subversion would ignore in projects Git doesn&#8217;t. The [...]]]></description>
			<content:encoded><![CDATA[<p>Lately, I&#8217;ve transferred all my repos over from Subversion to <a href="http://git-scm.com/">Git</a> and have become familiar enough with the <a href="http://flavio.castelli.name/howto_use_git_with_svn">Git SVN bindings</a> to even work on my work projects in Git while still being able to check-in as a regular SVN user. </p>
<p>I&#8217;ve found that some usual stuff Subversion would ignore in projects Git doesn&#8217;t. The Git exclude file doesn&#8217;t work here since these are files being tracked in the working tree that are just specific to your instance. After digging around, I found the proper command to ignore these files:</p>
<pre>
# ignore changes in a working tree file
git update-index --assume-unchanged .classpath
</pre>
]]></content:encoded>
			<wfw:commentRss>http://readystate4.com/2009/05/21/git-ignore-changes-in-a-working-tree-file/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>TinyMCE: TypeError: t.win.document is null in Firebug Console</title>
		<link>http://readystate4.com/2009/05/15/tinymce-typeerror-twindocument-is-null-in-firebug-console/</link>
		<comments>http://readystate4.com/2009/05/15/tinymce-typeerror-twindocument-is-null-in-firebug-console/#comments</comments>
		<pubDate>Sat, 16 May 2009 02:33:33 +0000</pubDate>
		<dc:creator>Mauvis</dc:creator>
				<category><![CDATA[tinymce]]></category>

		<guid isPermaLink="false">http://readystate4.com/2009/05/15/tinymce-typeerror-twindocument-is-null-in-firebug-console/</guid>
		<description><![CDATA[I came across this error on a site I was helping to troubleshoot today and with a little Googling found it happens when you move the DOM containing a TinyMCE editor to another place in the document: TinyMCE loses it&#8217;s reference to that original element.
To get around this, showing or hiding the editor won&#8217;t work, [...]]]></description>
			<content:encoded><![CDATA[<p>I came across this error on a site I was helping to troubleshoot today and with a little Googling found it happens when you move the DOM containing a TinyMCE editor to another place in the document: TinyMCE loses it&#8217;s reference to that original element.</p>
<p>To get around this, showing or hiding the editor won&#8217;t work, instead destroying the element before you move it and recreating it (same as the previous post) does the trick:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">tinyMCE.<span style="color: #660066;">execCommand</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'mceRemoveControl'</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">'idOfElement'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #006600; font-style: italic;">// move DOM element</span>
tinyMCE.<span style="color: #660066;">execCommand</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'mceAddControl'</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">'idOfElement'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://readystate4.com/2009/05/15/tinymce-typeerror-twindocument-is-null-in-firebug-console/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Removing all TinyMCE editors on the page for reinitializing</title>
		<link>http://readystate4.com/2009/05/06/removing-all-tinymce-editors-on-the-page-for-reinitializing/</link>
		<comments>http://readystate4.com/2009/05/06/removing-all-tinymce-editors-on-the-page-for-reinitializing/#comments</comments>
		<pubDate>Wed, 06 May 2009 16:47:49 +0000</pubDate>
		<dc:creator>Mauvis</dc:creator>
				<category><![CDATA[tinymce]]></category>
		<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://readystate4.com/2009/05/06/removing-all-tinymce-editors-on-the-page-for-reinitializing/</guid>
		<description><![CDATA[Sometimes, one needs to remove (not hide) all TinyMCE editors on the page to run a modified version of the global tinyMCE.init code again. This is the best way I&#8217;ve found to do it so far:

var i, t = tinyMCE.editors;
for &#40;i in t&#41;&#123;
    if &#40;t.hasOwnProperty&#40;i&#41;&#41;&#123;
        [...]]]></description>
			<content:encoded><![CDATA[<p>Sometimes, one needs to remove (not hide) all TinyMCE editors on the page to run a modified version of the global tinyMCE.init code again. This is the best way I&#8217;ve found to do it so far:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">var</span> i<span style="color: #339933;">,</span> t <span style="color: #339933;">=</span> tinyMCE.<span style="color: #660066;">editors</span><span style="color: #339933;">;</span>
<span style="color: #000066; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span>i <span style="color: #000066; font-weight: bold;">in</span> t<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>t.<span style="color: #660066;">hasOwnProperty</span><span style="color: #009900;">&#40;</span>i<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
        t<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">remove</span><span style="color: #009900;">&#40;</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: #006600; font-style: italic;">// new tinyMCE.init code here</span></pre></div></div>

<p>Additionally, you can &#8220;destrory&#8221; and &#8220;recreate&#8221; specific editors via:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">tinyMCE.<span style="color: #660066;">execCommand</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'mceRemoveControl'</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">'idOfElement'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
tinyMCE.<span style="color: #660066;">execCommand</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'mceAddControl'</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">'idOfElement'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>If anyone knows a better way, post in the comments.</p>
]]></content:encoded>
			<wfw:commentRss>http://readystate4.com/2009/05/06/removing-all-tinymce-editors-on-the-page-for-reinitializing/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>JavaScript Memoization</title>
		<link>http://readystate4.com/2009/02/25/javascript-memoization/</link>
		<comments>http://readystate4.com/2009/02/25/javascript-memoization/#comments</comments>
		<pubDate>Wed, 25 Feb 2009 17:18:30 +0000</pubDate>
		<dc:creator>Mauvis</dc:creator>
				<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://readystate4.com/2009/02/25/javascript-memoization/</guid>
		<description><![CDATA[I was taking a look at my friend Takashi&#8217;s JavaScript tweener which isn&#8217;t released yet and noticed he setup his code in a particular way for a few methods that get called dozens of times a second. He explained to me that it was for optimization through memoization. I ran a test case, and indeed [...]]]></description>
			<content:encoded><![CDATA[<p>I was taking a look at my friend Takashi&#8217;s JavaScript tweener which isn&#8217;t released yet and noticed he setup his code in a particular way for a few methods that get called dozens of times a second. He explained to me that it was for optimization through <a href="http://en.wikipedia.org/wiki/Memoization" title="Wikipedia entry">memoization</a>. I ran a test case, and indeed it&#8217;s much faster. Check it out:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">a <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
a.<span style="color: #660066;">deep</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
a.<span style="color: #660066;">deep</span>.<span style="color: #660066;">variable</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span>
    here<span style="color: #339933;">:</span> <span style="color: #CC0000;">3</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #003366; font-weight: bold;">function</span> plain<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
    document.<span style="color: #660066;">body</span>.<span style="color: #660066;">appendChild</span><span style="color: #009900;">&#40;</span>document.<span style="color: #660066;">createTextNode</span><span style="color: #009900;">&#40;</span>a.<span style="color: #660066;">deep</span>.<span style="color: #660066;">variable</span>.<span style="color: #660066;">here</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #003366; font-weight: bold;">function</span> memoized<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
    <span style="color: #003366; font-weight: bold;">var</span> z <span style="color: #339933;">=</span> a.<span style="color: #660066;">deep</span>.<span style="color: #660066;">variable</span>.<span style="color: #660066;">here</span><span style="color: #339933;">;</span>
    <span style="color: #000066; font-weight: bold;">return</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>
        document.<span style="color: #660066;">body</span>.<span style="color: #660066;">appendChild</span><span style="color: #009900;">&#40;</span>document.<span style="color: #660066;">createTextNode</span><span style="color: #009900;">&#40;</span>z<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
&nbsp;
now <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: #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> i <span style="color: #339933;">=</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">,</span> max <span style="color: #339933;">=</span> <span style="color: #CC0000;">5000</span><span style="color: #339933;">;</span> i <span style="color: #339933;">&lt;</span> max<span style="color: #339933;">;</span> i<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
        plain<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</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: #339933;">-</span> now<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
now <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: #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> i <span style="color: #339933;">=</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">,</span> max <span style="color: #339933;">=</span> <span style="color: #CC0000;">5000</span><span style="color: #339933;">;</span> i <span style="color: #339933;">&lt;</span> max<span style="color: #339933;">;</span> i<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
        memoized<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</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: #339933;">-</span> now<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #006600; font-style: italic;">// plain:  759</span>
<span style="color: #006600; font-style: italic;">// memoized: 36</span></pre></div></div>

<p>There&#8217;s a more complex example on the subject posted a month ago on <a href="http://ajaxian.com/archives/speed-up-your-javascript-with-memoization">Ajaxian</a> and an easier to understand one on Oliver Steele&#8217;s <a href="http://osteele.com/archives/2006/04/javascript-memoization">blog</a> written back in 2006.</p>
]]></content:encoded>
			<wfw:commentRss>http://readystate4.com/2009/02/25/javascript-memoization/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>jQuery comes to WhiteHouse.gov</title>
		<link>http://readystate4.com/2009/01/20/jquery-comes-to-whitehousegov/</link>
		<comments>http://readystate4.com/2009/01/20/jquery-comes-to-whitehousegov/#comments</comments>
		<pubDate>Tue, 20 Jan 2009 17:59:52 +0000</pubDate>
		<dc:creator>Mauvis</dc:creator>
				<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://readystate4.com/2009/01/20/jquery-comes-to-whitehousegov/</guid>
		<description><![CDATA[
Today the new WhiteHouse.gov launched and although it isn&#8217;t exactly XHTML compliant it beats the pants off of most government websites and follows along with the new President&#8217;s plans of deploying a modern communications infrastructure (it&#8217;s also using jQuery and jQuery.thickbox as noted above). 
Copy on the new site explains: &#8220;WhiteHouse.gov will be a central [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://readystate4.com/images/blog/whitehouse.gov-large.jpg"><img src="http://readystate4.com/images/blog/whitehouse.gov-small.jpg" /></a><br />
Today the new WhiteHouse.gov launched and although it isn&#8217;t exactly XHTML compliant it beats the pants off of most government websites and follows along with the new President&#8217;s plans of deploying a modern communications infrastructure (it&#8217;s also using jQuery and jQuery.thickbox as noted above). </p>
<p>Copy on the new site explains: &#8220;WhiteHouse.gov will be a central part of President Obama&#8217;s pledge to make his the most transparent and accountable administration in American history.&#8221;</p>
<p>Regarding Technology, Obama has already talked about:</p>
<ul>
<li>protecting the openness of the internet.</li>
<li>supporting the principle of network neutrality to preserve the benefits of open competition on the internet.</li>
<li>deploying a modern communications infrastructure.</li>
<li>getting true broadband to every community in America.</li>
</ul>
<p>Here&#8217;s looking at a tech-positive presidency!</p>
]]></content:encoded>
			<wfw:commentRss>http://readystate4.com/2009/01/20/jquery-comes-to-whitehousegov/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>The difference between != and =!</title>
		<link>http://readystate4.com/2008/12/31/the-difference-between-and/</link>
		<comments>http://readystate4.com/2008/12/31/the-difference-between-and/#comments</comments>
		<pubDate>Wed, 31 Dec 2008 17:38:10 +0000</pubDate>
		<dc:creator>Mauvis</dc:creator>
				<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://readystate4.com/2008/12/31/the-difference-between-and/</guid>
		<description><![CDATA[I was helping a friend troubleshoot some of her code today and found the culprit to be a typo in one of her conditional statements:

// var USERID = 12345;
if &#40;USERID =! null&#41;&#123;
     // code
&#125;

Her expression was always resolving to true because she had inverted her != (&#8220;not-null&#8221;) check which was actually [...]]]></description>
			<content:encoded><![CDATA[<p>I was helping a friend troubleshoot some of her code today and found the culprit to be a typo in one of her conditional statements:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #006600; font-style: italic;">// var USERID = 12345;</span>
<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>USERID <span style="color: #339933;">=!</span> <span style="color: #003366; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
     <span style="color: #006600; font-style: italic;">// code</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Her expression was always resolving to <code>true</code> because she had inverted her <code>!=</code> (&#8220;not-null&#8221;) check which was actually assigning her variable to the return of a statement evaluation. Her mistake would be clearer to understand formatted as such:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #006600; font-style: italic;">// var USERID = 12345;</span>
<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>USERID <span style="color: #339933;">=</span> <span style="color: #339933;">!</span><span style="color: #003366; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
     <span style="color: #006600; font-style: italic;">// code</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Since the inverse of <code>false</code>, <code>null</code>, and <code>NaN</code> is <code>true</code> her conditional statement (also an assignment) would always return <code>true</code>. </p>
<p>Which lead me to thinking, the not operator is a great way to write succinct code. In the right context, using the not operator in the right side of an assignment isn&#8217;t a bad idea.</p>
]]></content:encoded>
			<wfw:commentRss>http://readystate4.com/2008/12/31/the-difference-between-and/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
