<?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>CAIH.org &#187; Open Source Software</title>
	<atom:link href="http://caih.org/category/open-source-software/feed/" rel="self" type="application/rss+xml" />
	<link>http://caih.org</link>
	<description>Movies, life and python</description>
	<lastBuildDate>Thu, 29 Jul 2010 17:23:55 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>CSS3 the easy way</title>
		<link>http://caih.org/open-source-software/css3-the-easy-way/</link>
		<comments>http://caih.org/open-source-software/css3-the-easy-way/#comments</comments>
		<pubDate>Thu, 29 Jul 2010 17:18:53 +0000</pubDate>
		<dc:creator>César Izurieta</dc:creator>
				<category><![CDATA[Open Source Software]]></category>
		<category><![CDATA[css3hacks]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[css3]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://caih.org/?p=219</guid>
		<description><![CDATA[I just found out about PIE.htc, a javascript behavior file for IE that enables a lot of CSS3 on IE6+. I though of integrating it with my own css3hacks library to do all the work for ie. So today I just commited the library to google code. It is really simple to use. Just add [...]


No related posts.]]></description>
			<content:encoded><![CDATA[<p>I just found out about <a href="http://css3pie.com" target="_blank">PIE.htc</a>, a javascript behavior file for IE that enables a lot of CSS3 on IE6+. I though of integrating it with my own <a href="css3hacks.googlecode.com" target="_blank">css3hacks library</a> to do all the work for ie. So today I just commited the library to google code. It is really simple to use. Just add a javascript file to your html:</p>
<div class="codecolorer-container html4strict default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="html4strict codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/script.html"><span style="color: #000000; font-weight: bold;">script</span></a> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/javascript&quot;</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;css3hacks.js&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/script.html"><span style="color: #000000; font-weight: bold;">script</span></a>&gt;</span><br />
<span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/script.html"><span style="color: #000000; font-weight: bold;">script</span></a> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/javascript&quot;</span>&gt;</span>CSS3Hacks.init()<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/script.html"><span style="color: #000000; font-weight: bold;">script</span></a>&gt;</span></div></div>
<p>Then write normal css3 like:</p>
<div class="codecolorer-container css default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="css codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #cc00cc;">#my-box</span> <span style="color: #00AA00;">&#123;</span><br />
&nbsp; &nbsp; border-radius<span style="color: #00AA00;">:</span> <span style="color: #933;">5px</span><span style="color: #00AA00;">;</span><br />
<span style="color: #00AA00;">&#125;</span></div></div>
<p>This will enable rounded borders on all browsers I could test: IE6, IE7, Firefox 3, 4, Chrome, Chromium, Opera various versions. Right now it supports just border-radius-* and variable definitions but I&#8217;m planning on adding support for more css3 rules in the future. You&#8217;re welcome to give suggestions, <a href="http://code.google.com/p/css3hacks/issues/list" target="_blank">report problems</a> or <a href="http://code.google.com/p/css3hacks/source/browse/" target="_blank">contribute code</a<.</p>


<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://caih.org/open-source-software/css3-the-easy-way/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Notifiy in the App Store</title>
		<link>http://caih.org/open-source-software/notifiy-in-the-app-store/</link>
		<comments>http://caih.org/open-source-software/notifiy-in-the-app-store/#comments</comments>
		<pubDate>Wed, 16 Jun 2010 15:02:11 +0000</pubDate>
		<dc:creator>César Izurieta</dc:creator>
				<category><![CDATA[Open Source Software]]></category>
		<category><![CDATA[wave-email-notifications]]></category>
		<category><![CDATA[apple]]></category>
		<category><![CDATA[ipad]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[ipod touch]]></category>

		<guid isPermaLink="false">http://caih.org/?p=213</guid>
		<description><![CDATA[If you want to get notifications of changes in google wave in your iPhone, iPad or iPod touch check out the Notifiy app at the App Store. Related posts:Google Wave Notifications in your iPhone Google Wave Google Wave Email Notifications


Related posts:<ol><li><a href='http://caih.org/open-source-software/google-wave-notifications-in-your-iphone/' rel='bookmark' title='Permanent Link: Google Wave Notifications in your iPhone'>Google Wave Notifications in your iPhone</a></li>
<li><a href='http://caih.org/movies/139/' rel='bookmark' title='Permanent Link: Google Wave'>Google Wave</a></li>
<li><a href='http://caih.org/open-source-software/wave-email-notifications/google-wave-email-notifications/' rel='bookmark' title='Permanent Link: Google Wave Email Notifications'>Google Wave Email Notifications</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p><div id="attachment_214" class="wp-caption aligncenter" style="width: 330px"><a href="http://itunes.apple.com/us/app/notifiy/id359511262?mt=8"><img src="http://caih.org/wp-content/uploads/2010/06/notifiy-iphone-registration-01.png" alt="Notifiy for iPhone, iPod touch and iPad" title="notifiy-iphone-registration-01" width="320" height="480" class="size-full wp-image-214" /></a><p class="wp-caption-text">Home screen for the Notifiy application.</p></div><br />
If you want to get notifications of changes in google wave in your iPhone, iPad or iPod touch check out the <a href="http://itunes.apple.com/us/app/notifiy/id359511262?mt=8">Notifiy</a> app at the App Store.</p>


<p>Related posts:<ol><li><a href='http://caih.org/open-source-software/google-wave-notifications-in-your-iphone/' rel='bookmark' title='Permanent Link: Google Wave Notifications in your iPhone'>Google Wave Notifications in your iPhone</a></li>
<li><a href='http://caih.org/movies/139/' rel='bookmark' title='Permanent Link: Google Wave'>Google Wave</a></li>
<li><a href='http://caih.org/open-source-software/wave-email-notifications/google-wave-email-notifications/' rel='bookmark' title='Permanent Link: Google Wave Email Notifications'>Google Wave Email Notifications</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://caih.org/open-source-software/notifiy-in-the-app-store/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MS Office 2007 on Ubuntu 9.10 using wine</title>
		<link>http://caih.org/open-source-software/ms-office-2007-on-ubuntu-9-10-using-wine/</link>
		<comments>http://caih.org/open-source-software/ms-office-2007-on-ubuntu-9-10-using-wine/#comments</comments>
		<pubDate>Sun, 11 Apr 2010 15:05:52 +0000</pubDate>
		<dc:creator>César Izurieta</dc:creator>
				<category><![CDATA[Open Source Software]]></category>

		<guid isPermaLink="false">http://caih.org/?p=202</guid>
		<description><![CDATA[For those of you that *REALLY* need MS Office and Open Office is not enough, then install wine just run this two commands on a terminal: wget http://www.kegel.com/wine/winetricks sh winetricks msxml3 dotnet20 gdiplus riched20 riched30\ &#160; &#160; &#160; &#160; &#160; &#160; &#160; vcrun2005sp1 allfonts &#160;wsh56js And then install using your installation CD. UPDATE: If you [...]


No related posts.]]></description>
			<content:encoded><![CDATA[<p>For those of you that *REALLY* need MS Office and Open Office is not enough, then install <a href="http://www.winehq.org">wine</a> just run this two commands on a terminal:</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #c20cb9; font-weight: bold;">wget</span> http:<span style="color: #000000; font-weight: bold;">//</span>www.kegel.com<span style="color: #000000; font-weight: bold;">/</span>wine<span style="color: #000000; font-weight: bold;">/</span>winetricks<br />
<span style="color: #c20cb9; font-weight: bold;">sh</span> winetricks msxml3 dotnet20 gdiplus riched20 riched30\<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; vcrun2005sp1 allfonts &nbsp;wsh56js</div></div>
<p>And then install using your installation CD.</p>
<p><strong>UPDATE:</strong> If you are using a non-english locale the second command has to be:</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #007800;">LANG</span>=<span style="color: #ff0000;">&quot;en_US.UTF-8&quot;</span> <span style="color: #c20cb9; font-weight: bold;">sh</span> winetricks msxml3 dotnet20 gdiplus riched20\<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; riched30 vcrun2005sp1 allfonts &nbsp;wsh56js</div></div>


<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://caih.org/open-source-software/ms-office-2007-on-ubuntu-9-10-using-wine/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Google Wave Notifications in your iPhone</title>
		<link>http://caih.org/open-source-software/google-wave-notifications-in-your-iphone/</link>
		<comments>http://caih.org/open-source-software/google-wave-notifications-in-your-iphone/#comments</comments>
		<pubDate>Mon, 14 Dec 2009 00:31:52 +0000</pubDate>
		<dc:creator>César Izurieta</dc:creator>
				<category><![CDATA[Open Source Software]]></category>
		<category><![CDATA[wave-email-notifications]]></category>

		<guid isPermaLink="false">http://caih.org/?p=192</guid>
		<description><![CDATA[I have some news about the Notifiy robot (wave-email-notifications@googlewave.com). It can now send notifications to your iPhone when a wave is updated. The application will be available at the App Store very soon. Related posts:Google Wave Email Notifications Google Wave Notifiy in the App Store


Related posts:<ol><li><a href='http://caih.org/open-source-software/wave-email-notifications/google-wave-email-notifications/' rel='bookmark' title='Permanent Link: Google Wave Email Notifications'>Google Wave Email Notifications</a></li>
<li><a href='http://caih.org/movies/139/' rel='bookmark' title='Permanent Link: Google Wave'>Google Wave</a></li>
<li><a href='http://caih.org/open-source-software/notifiy-in-the-app-store/' rel='bookmark' title='Permanent Link: Notifiy in the App Store'>Notifiy in the App Store</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<div id="attachment_193" class="wp-caption aligncenter" style="width: 330px"><a href="http://caih.org/wp-content/uploads/2009/12/iphone-notifiy.png" rel="shadowbox[post-192];player=img;"><img src="http://caih.org/wp-content/uploads/2009/12/iphone-notifiy.png" alt="Wave Notifications on the iPhone" title="iphone-notifiy" width="320" height="480" class="size-full wp-image-193" /></a><p class="wp-caption-text">Wave Notifications on the iPhone</p></div>
<p>I have some news about the Notifiy robot (wave-email-notifications@googlewave.com). It can now send notifications to your iPhone when a wave is updated. The application will be available at the App Store very soon.</p>


<p>Related posts:<ol><li><a href='http://caih.org/open-source-software/wave-email-notifications/google-wave-email-notifications/' rel='bookmark' title='Permanent Link: Google Wave Email Notifications'>Google Wave Email Notifications</a></li>
<li><a href='http://caih.org/movies/139/' rel='bookmark' title='Permanent Link: Google Wave'>Google Wave</a></li>
<li><a href='http://caih.org/open-source-software/notifiy-in-the-app-store/' rel='bookmark' title='Permanent Link: Notifiy in the App Store'>Notifiy in the App Store</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://caih.org/open-source-software/google-wave-notifications-in-your-iphone/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Google Wave Email Notifications</title>
		<link>http://caih.org/open-source-software/wave-email-notifications/google-wave-email-notifications/</link>
		<comments>http://caih.org/open-source-software/wave-email-notifications/google-wave-email-notifications/#comments</comments>
		<pubDate>Mon, 12 Oct 2009 17:02:03 +0000</pubDate>
		<dc:creator>César Izurieta</dc:creator>
				<category><![CDATA[wave-email-notifications]]></category>
		<category><![CDATA[beta]]></category>
		<category><![CDATA[collaboration]]></category>
		<category><![CDATA[email]]></category>
		<category><![CDATA[notifications]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://caih.org/?p=182</guid>
		<description><![CDATA[I just created a google wave robot that sends email notifications when a wave is updated. To try it out just add: wave-email-notifications@appspot.com to the wave and that&#8217;s it. It&#8217;s currently in a beta stage so there are no guarantees. Visit the project home page at: http://wave-email-notifications.googlecode.com/ Related posts:Google Wave Notifications in your iPhone Google [...]


Related posts:<ol><li><a href='http://caih.org/open-source-software/google-wave-notifications-in-your-iphone/' rel='bookmark' title='Permanent Link: Google Wave Notifications in your iPhone'>Google Wave Notifications in your iPhone</a></li>
<li><a href='http://caih.org/movies/139/' rel='bookmark' title='Permanent Link: Google Wave'>Google Wave</a></li>
<li><a href='http://caih.org/uncategorized/is-there-any-way-to-reliably-parse-email-messages/' rel='bookmark' title='Permanent Link: Is there any way to reliably parse email messages?'>Is there any way to reliably parse email messages?</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>I just created a google wave robot that sends email notifications when a wave is updated. To try it out just add: wave-email-notifications@appspot.com to the wave and that&#8217;s it. It&#8217;s currently in a beta stage so there are no guarantees. Visit the project home page at:</p>
<p><a href="http://wave-email-notifications.googlecode.com/">http://wave-email-notifications.googlecode.com/</a></p>


<p>Related posts:<ol><li><a href='http://caih.org/open-source-software/google-wave-notifications-in-your-iphone/' rel='bookmark' title='Permanent Link: Google Wave Notifications in your iPhone'>Google Wave Notifications in your iPhone</a></li>
<li><a href='http://caih.org/movies/139/' rel='bookmark' title='Permanent Link: Google Wave'>Google Wave</a></li>
<li><a href='http://caih.org/uncategorized/is-there-any-way-to-reliably-parse-email-messages/' rel='bookmark' title='Permanent Link: Is there any way to reliably parse email messages?'>Is there any way to reliably parse email messages?</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://caih.org/open-source-software/wave-email-notifications/google-wave-email-notifications/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Tri-state checkbox in JavaScript</title>
		<link>http://caih.org/open-source-software/tri-state-checkbox-in-javascript/</link>
		<comments>http://caih.org/open-source-software/tri-state-checkbox-in-javascript/#comments</comments>
		<pubDate>Fri, 11 Sep 2009 00:52:28 +0000</pubDate>
		<dc:creator>César Izurieta</dc:creator>
				<category><![CDATA[Open Source Software]]></category>
		<category><![CDATA[alpha]]></category>
		<category><![CDATA[checkbox]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[tri-state]]></category>

		<guid isPermaLink="false">http://caih.org/?p=155</guid>
		<description><![CDATA[I found myself needing to implement a tri-state checkbox in javascript. A checkbox has initially 2 states: on or off. From the html perspective if the checkbox is checked then the value is submitted, if it is not then the value is not submitted. From the javascript perspective you can use: if &#40;checkbox.checked&#41; &#123; &#160; [...]


No related posts.]]></description>
			<content:encoded><![CDATA[<p>I found myself needing to implement a tri-state checkbox in javascript. A checkbox has initially 2 states: on or off. From the html perspective if the checkbox is checked then the value is submitted, if it is not then the value is not submitted. From the javascript perspective you can use:</p>
<div class="codecolorer-container javascript default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>checkbox.<span style="color: #660066;">checked</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;This checkbox is checked&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span></div></div>
<p>Some times a true or false is not enough. Other development platforms have tri-state checkboxes that can have either a true, false or null value. The following snippet adds a &#8220;greyable&#8221; functionality to checkboxes:</p>
<div class="codecolorer-container javascript default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:400px;"><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">Element.<span style="color: #660066;">addMethods</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;INPUT&quot;</span><span style="color: #339933;">,</span> <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><br />
&nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">var</span> changeHandler <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>e<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">greyed</span> <span style="color: #339933;">||</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">checked</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">setGreyed</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">greyed</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">greyed</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">checked</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">function</span> setGreyed<span style="color: #009900;">&#40;</span>checkbox<span style="color: #339933;">,</span> greyed<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; checkbox.<span style="color: #660066;">greyed</span> <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">typeof</span> greyed <span style="color: #339933;">==</span> <span style="color: #3366CC;">&quot;undefined&quot;</span> <span style="color: #339933;">?</span> <span style="color: #003366; font-weight: bold;">true</span> <span style="color: #339933;">:</span> <span style="color: #339933;">!!</span>greyed<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; checkbox.<span style="color: #660066;">setOpacity</span><span style="color: #009900;">&#40;</span>checkbox.<span style="color: #660066;">greyed</span> <span style="color: #339933;">?</span> <span style="color: #CC0000;">0.33</span> <span style="color: #339933;">:</span> <span style="color: #CC0000;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>checkbox.<span style="color: #660066;">greyed</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; checkbox.<span style="color: #660066;">checked</span> <span style="color: #339933;">=</span> checkbox.<span style="color: #660066;">greyedState</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">function</span> setGreyable<span style="color: #009900;">&#40;</span>element<span style="color: #339933;">,</span> enable<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #009900;">&#40;</span>element <span style="color: #339933;">=</span> $<span style="color: #009900;">&#40;</span>element<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #000066; font-weight: bold;">return</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #009900;">&#40;</span><span style="color: #009966; font-style: italic;">/checkbox|radiobutton/i</span>.<span style="color: #660066;">test</span><span style="color: #009900;">&#40;</span>element.<span style="color: #660066;">type</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">return</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">typeof</span> element.<span style="color: #660066;">greyedState</span> <span style="color: #339933;">==</span> <span style="color: #3366CC;">&quot;undefined&quot;</span> <span style="color: #339933;">||</span> enable<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; element.<span style="color: #660066;">observe</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;change&quot;</span><span style="color: #339933;">,</span> changeHandler<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; element.<span style="color: #660066;">setGreyState</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; element.<span style="color: #660066;">setGreyed</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span> <span style="color: #000066; font-weight: bold;">else</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; element.<span style="color: #660066;">stopObserving</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;change&quot;</span><span style="color: #339933;">,</span> changeHandler<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; element.<span style="color: #660066;">setGreyed</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; element.<span style="color: #660066;">checked</span> <span style="color: #339933;">=</span> element.<span style="color: #660066;">greyedState</span><span style="color: #339933;">;</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; element.<span style="color: #660066;">greyedState</span> <span style="color: #339933;">=</span> undefined<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; element.<span style="color: #660066;">greyed</span> <span style="color: #339933;">=</span> undefined<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">function</span> setGreyState<span style="color: #009900;">&#40;</span>element<span style="color: #339933;">,</span> greyedState<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #009900;">&#40;</span>element <span style="color: #339933;">=</span> $<span style="color: #009900;">&#40;</span>element<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #000066; font-weight: bold;">return</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #009900;">&#40;</span><span style="color: #009966; font-style: italic;">/checkbox|radiobutton/i</span>.<span style="color: #660066;">test</span><span style="color: #009900;">&#40;</span>element.<span style="color: #660066;">type</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">return</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; element.<span style="color: #660066;">greyedState</span> <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">typeof</span> greyedState <span style="color: #339933;">==</span> <span style="color: #3366CC;">&quot;undefined&quot;</span> <span style="color: #339933;">?</span> <span style="color: #003366; font-weight: bold;">true</span> <span style="color: #339933;">:</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #339933;">!!</span>greyedState<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; setGreyed<span style="color: #339933;">:</span> setGreyed<span style="color: #339933;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; setGreyable<span style="color: #339933;">:</span> setGreyable<span style="color: #339933;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; setGreyState<span style="color: #339933;">:</span> setGreyState<br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></div>
<p>This currently requires <a href="http://www.prototypejs.org" target="_blank">prototypejs</a> but could be easily modified to not depend on it. To enable it on some element do something like this:</p>
<div class="codecolorer-container javascript default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">checkbox.<span style="color: #660066;">setGreyable</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></div>
<p>To check if it is greyed or not:</p>
<div class="codecolorer-container javascript default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>checkbox.<span style="color: #660066;">greyed</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;This checkbox is greyed&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span></div></div>
<p>You can also change the state of the checkbox when it is greyed. To set this use the following:</p>
<div class="codecolorer-container javascript default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">checkbox.<span style="color: #660066;">setGreyState</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></div>
<p>The parameter indicates whether the checkbox is checked when grey. Clicking on the checkbox (or changing the state by keyboard) loops through 3 states: checked, not checked and greyed.</p>


<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://caih.org/open-source-software/tri-state-checkbox-in-javascript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Checking for updates in subversion</title>
		<link>http://caih.org/open-source-software/checking-for-updates-in-subversion/</link>
		<comments>http://caih.org/open-source-software/checking-for-updates-in-subversion/#comments</comments>
		<pubDate>Mon, 17 Aug 2009 19:04:44 +0000</pubDate>
		<dc:creator>César Izurieta</dc:creator>
				<category><![CDATA[Open Source Software]]></category>

		<guid isPermaLink="false">http://caih.org/?p=142</guid>
		<description><![CDATA[If you are constantly running &#8220;svn up&#8221; or &#8220;svn status -u&#8221; or maybe &#8220;svn log -rBASE:HEAD&#8221; then you might find this piece of code useful: #!/bin/sh &#160; &#160; dir=&#34;$1&#34; cd $dir &#160; updated=`svn st -u &#124; grep '*'` if &#91; &#34;$updated&#34; &#93;; then &#160; &#160; notify-send SVN &#34;$updated&#34; fi What id does is check for [...]


No related posts.]]></description>
			<content:encoded><![CDATA[<p>If you are constantly running &#8220;svn up&#8221; or &#8220;svn status -u&#8221; or maybe &#8220;svn log -rBASE:HEAD&#8221; then you might find this piece of code useful:</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666; font-style: italic;">#!/bin/sh &nbsp;</span><br />
&nbsp; <br />
<span style="color: #007800;">dir</span>=<span style="color: #ff0000;">&quot;$1&quot;</span><br />
<br />
<span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #007800;">$dir</span><br />
&nbsp; <br />
<span style="color: #007800;">updated</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">svn</span> st <span style="color: #660033;">-u</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #ff0000;">'*'</span><span style="color: #000000; font-weight: bold;">`</span> <br />
<br />
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$updated</span>&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span><br />
&nbsp; &nbsp; notify-send SVN <span style="color: #ff0000;">&quot;<span style="color: #007800;">$updated</span>&quot;</span><br />
<span style="color: #000000; font-weight: bold;">fi</span></div></div>
<p>What id does is check for updates in subversion and if it finds any then shows a notification using notify-send. Tested on openSUSE 11.1 with subversion 1.6. Add a crontab entry and you are done.</p>


<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://caih.org/open-source-software/checking-for-updates-in-subversion/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Google Wave</title>
		<link>http://caih.org/movies/139/</link>
		<comments>http://caih.org/movies/139/#comments</comments>
		<pubDate>Sat, 08 Aug 2009 23:03:51 +0000</pubDate>
		<dc:creator>César Izurieta</dc:creator>
				<category><![CDATA[Movies]]></category>
		<category><![CDATA[Open Source Software]]></category>
		<category><![CDATA[collaboration]]></category>
		<category><![CDATA[scripts]]></category>

		<guid isPermaLink="false">http://caih.org/uncategorized/139/</guid>
		<description><![CDATA[Google Wave Developer Preview at Google I/O 2009 After watching this video many ideas came to my mind! I&#8217;ve always wanted to have some sort of a system where you could collaboratively construct stories, movie scripts, etc. When I get my hands on an invitation for wave that&#8217;s the first thing I&#8217;m going to do. [...]


Related posts:<ol><li><a href='http://caih.org/open-source-software/wave-email-notifications/google-wave-email-notifications/' rel='bookmark' title='Permanent Link: Google Wave Email Notifications'>Google Wave Email Notifications</a></li>
<li><a href='http://caih.org/open-source-software/google-wave-notifications-in-your-iphone/' rel='bookmark' title='Permanent Link: Google Wave Notifications in your iPhone'>Google Wave Notifications in your iPhone</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p><b>Google Wave Developer Preview at Google I/O 2009</b><br />
<object width="425" height="350"><param name="movie" value="http://youtube.com/v/v_UyVmITiYQ"></param><embed src="http://youtube.com/v/v_UyVmITiYQ" type="application/x-shockwave-flash" width="425" height="350"></embed></object>
<p>After watching this video many ideas came to my mind! I&#8217;ve always wanted to have some sort of a system where you could collaboratively construct stories, movie scripts, etc. When I get my hands on an invitation for wave that&#8217;s the first thing I&#8217;m going to do. Would make celtx look so old fashioned!</p>


<p>Related posts:<ol><li><a href='http://caih.org/open-source-software/wave-email-notifications/google-wave-email-notifications/' rel='bookmark' title='Permanent Link: Google Wave Email Notifications'>Google Wave Email Notifications</a></li>
<li><a href='http://caih.org/open-source-software/google-wave-notifications-in-your-iphone/' rel='bookmark' title='Permanent Link: Google Wave Notifications in your iPhone'>Google Wave Notifications in your iPhone</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://caih.org/movies/139/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>B# tree and Array intersection in javascript</title>
		<link>http://caih.org/open-source-software/b-tree-and-array-intersection-in-javascript/</link>
		<comments>http://caih.org/open-source-software/b-tree-and-array-intersection-in-javascript/#comments</comments>
		<pubDate>Wed, 20 May 2009 23:16:16 +0000</pubDate>
		<dc:creator>César Izurieta</dc:creator>
				<category><![CDATA[Open Source Software]]></category>

		<guid isPermaLink="false">http://caih.org/?p=125</guid>
		<description><![CDATA[I was in need for a solution to search a very large set of data in a javascript application. I thought of a b+ tree. Looking for a javascript implementation of it, google didn&#8217;t help much. So, I just gave up and decided to implement it myself. This is the result: not really a B+ [...]


No related posts.]]></description>
			<content:encoded><![CDATA[<p>I was in need for a solution to search a very large set of data in a javascript application. I thought of a <a href="http://en.wikipedia.org/wiki/B%2B_tree" target="_blank">b+ tree</a>. Looking for a javascript implementation of it, google didn&#8217;t help much. So, I just gave up and decided to implement it myself. This is the result: not really a B+ tree but a variation that works better in this case. I call it a B# tree. It depends on the <a href="http://www.prototypejs.org/" target="_blank">prototype framework</a> but I&#8217;m planning on making some changes to it so it would work stand-alone.</p>
<div class="codecolorer-container javascript default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:400px;"><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #003366; font-weight: bold;">var</span> BSharpTree <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">Class</span>.<span style="color: #660066;">create</span><span style="color: #009900;">&#40;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; root<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">null</span><span style="color: #339933;">,</span><br />
<br />
&nbsp; &nbsp; initialize<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>comparator<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">root</span> <span style="color: #339933;">=</span> $A<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">comparator</span> <span style="color: #339933;">=</span> comparator <span style="color: #339933;">||</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>x<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">return</span> x<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span><br />
<br />
&nbsp; &nbsp; add<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>text<span style="color: #339933;">,</span> object<span style="color: #339933;">,</span> node<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">var</span> node <span style="color: #339933;">=</span> node <span style="color: #339933;">||</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">root</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; node.<span style="color: #660066;">objects</span> <span style="color: #339933;">=</span> node.<span style="color: #660066;">objects</span> <span style="color: #339933;">||</span> $A<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>node <span style="color: #339933;">!=</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">root</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; node.<span style="color: #660066;">objects</span>.<span style="color: #660066;">push</span><span style="color: #009900;">&#40;</span>object<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>text.<span style="color: #660066;">length</span> <span style="color: #339933;">&gt;</span> <span style="color: #CC0000;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">var</span> chr <span style="color: #339933;">=</span> text.<span style="color: #660066;">charCodeAt</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">-</span> <span style="color: #CC0000;">32</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">var</span> next <span style="color: #339933;">=</span> node<span style="color: #009900;">&#91;</span>chr<span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> chr <span style="color: #339933;">==</span> <span style="color: #CC0000;">0</span> <span style="color: #339933;">?</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">root</span> <span style="color: #339933;">:</span> node<span style="color: #009900;">&#91;</span>chr<span style="color: #009900;">&#93;</span> <span style="color: #339933;">||</span> $A<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">add</span><span style="color: #009900;">&#40;</span>text.<span style="color: #660066;">substring</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> object<span style="color: #339933;">,</span> next<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span><br />
<br />
&nbsp; &nbsp; search<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>text<span style="color: #339933;">,</span> objects<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">var</span> node <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">root</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">var</span> result <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">null</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">while</span> <span style="color: #009900;">&#40;</span>text.<span style="color: #660066;">length</span> <span style="color: #339933;">&gt;</span> <span style="color: #CC0000;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">var</span> chr <span style="color: #339933;">=</span> text.<span style="color: #660066;">charCodeAt</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">-</span> <span style="color: #CC0000;">32</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; text <span style="color: #339933;">=</span> text.<span style="color: #660066;">substring</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>char <span style="color: #339933;">==</span> <span style="color: #CC0000;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; result <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">search</span><span style="color: #009900;">&#40;</span>text<span style="color: #339933;">,</span> result<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">break</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span> <span style="color: #000066; font-weight: bold;">else</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; node <span style="color: #339933;">=</span> node<span style="color: #009900;">&#91;</span>chr<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>node<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">return</span> $A<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; result <span style="color: #339933;">=</span> node.<span style="color: #660066;">objects</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>objects<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>node <span style="color: #339933;">==</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">root</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">return</span> objects<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span> <span style="color: #000066; font-weight: bold;">else</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">intersect</span><span style="color: #009900;">&#40;</span>result<span style="color: #339933;">,</span> objects<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span> <span style="color: #000066; font-weight: bold;">else</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>node <span style="color: #339933;">==</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">root</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">return</span> $A<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span> <span style="color: #000066; font-weight: bold;">else</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">return</span> result<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span><br />
<br />
&nbsp; &nbsp; intersect<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>a<span style="color: #339933;">,</span> b<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <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><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">var</span> j <span style="color: #339933;">=</span> <span style="color: #CC0000;">0</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">var</span> intersect <span style="color: #339933;">=</span> $A<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; a <span style="color: #339933;">=</span> a.<span style="color: #660066;">sortBy</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">comparator</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; b <span style="color: #339933;">=</span> b.<span style="color: #660066;">sortBy</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">comparator</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">while</span> <span style="color: #009900;">&#40;</span>i <span style="color: #339933;">&lt;</span> a.<span style="color: #660066;">length</span> <span style="color: #339933;">&amp;&amp;</span> j <span style="color: #339933;">&lt;</span> b.<span style="color: #660066;">length</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">comparator</span><span style="color: #009900;">&#40;</span>a<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">comparator</span><span style="color: #009900;">&#40;</span>b<span style="color: #009900;">&#91;</span>j<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; intersect.<span style="color: #660066;">push</span><span style="color: #009900;">&#40;</span>a<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; i<span style="color: #339933;">++;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; j<span style="color: #339933;">++;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span> <span style="color: #000066; font-weight: bold;">else</span> <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">comparator</span><span style="color: #009900;">&#40;</span>a<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&gt;</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">comparator</span><span style="color: #009900;">&#40;</span>b<span style="color: #009900;">&#91;</span>j<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; j<span style="color: #339933;">++;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span> <span style="color: #000066; font-weight: bold;">else</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; i<span style="color: #339933;">++;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">return</span> intersect<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></div>
<p>It contains a very efficient intersect method. To use it just do something like this:</p>
<div class="codecolorer-container javascript default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #003366; font-weight: bold;">var</span> bst <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> BSharpTree<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
bst.<span style="color: #660066;">add</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;some string&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;my object&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
bst.<span style="color: #660066;">add</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;some other string&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;other object&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
bst.<span style="color: #660066;">add</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;last string&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;last object&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
bst.<span style="color: #660066;">search</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;string&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">// returns [&quot;my object&quot;, &quot;other object&quot;, &quot;last object&quot;]</span><br />
bst.<span style="color: #660066;">search</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;some string&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">// returns [&quot;my object&quot;, &quot;other object&quot;]</span></div></div>
<p>You can set any object as the second parameter to the BSharpTree#add method but then you might need to pass a comparator function to the BSharpTree constructor. Use it as you may see fit! </p>


<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://caih.org/open-source-software/b-tree-and-array-intersection-in-javascript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Loading javascript: execScript and testing</title>
		<link>http://caih.org/open-source-software/loading-javascript-execscript-and-testing/</link>
		<comments>http://caih.org/open-source-software/loading-javascript-execscript-and-testing/#comments</comments>
		<pubDate>Thu, 14 May 2009 12:14:33 +0000</pubDate>
		<dc:creator>César Izurieta</dc:creator>
				<category><![CDATA[Open Source Software]]></category>
		<category><![CDATA[modularjs]]></category>

		<guid isPermaLink="false">http://caih.org/?p=113</guid>
		<description><![CDATA[After a lot of time of searching what is the best way to synchronously load javascript from javascript I finally found a way to do it that works in almost any browser. The hardest part of it all is not loading and eval&#8217;ing the script, but allowing the script to set new variables in the [...]


Related posts:<ol><li><a href='http://caih.org/open-source-software/tri-state-checkbox-in-javascript/' rel='bookmark' title='Permanent Link: Tri-state checkbox in JavaScript'>Tri-state checkbox in JavaScript</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>After a lot of time of searching what is the best way to synchronously load javascript from javascript I finally found a way to do it that works in almost any browser. The hardest part of it all is not loading and eval&#8217;ing the script, but allowing the script to set new variables in the global scope.</p>
<div class="codecolorer-container javascript default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>window.<span style="color: #660066;">execScript</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; window.<span style="color: #660066;">execScript</span><span style="color: #009900;">&#40;</span>contents<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span> <span style="color: #000066; font-weight: bold;">else</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">with</span> <span style="color: #009900;">&#40;</span>window<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; window.<span style="color: #000066; font-weight: bold;">eval</span><span style="color: #009900;">&#40;</span>contents<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<span style="color: #009900;">&#125;</span></div></div>
<p>This is what I&#8217;m finally using on my <a href="http://modularjs.googlecode.com">open source modular javascript project</a>. To test it out I also found <a href="http://browsershots.com" rel="nofollow">this website</a> very useful. What I did was to create a test page that loaded a script, declared some global variables in different ways:</p>
<div class="codecolorer-container javascript default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #003366; font-weight: bold;">var</span> someVariable <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #339933;">;</span><br />
someVariableWithoutVar <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #339933;">;</span><br />
<span style="color: #000066; font-weight: bold;">eval</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;var someVariableWithEval = true&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #000066; font-weight: bold;">eval</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;someVariableWithEvalWithoutVar = true&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></div>
<p>Then loaded the website through browsershots and the results came in a few minutes. The <a href="http://browsershots.org/http://modularjs.googlecode.com/svn/trunk/test/index.html" target="_blank">tests passed</a> on a lot of browsers including all versions I could test of Firefox, Opera, MSIE, Safari, with some minor exceptions: Safari 3.2.1 on Windows XP and OS X 10.5, Opera 7.54 on Windows XP, Konqueror 4.2 on Ubuntu 9.04.</p>
<p>The case with Safari 3.2.1 is that it cannot set global variables declared with <em>var</em> inside a eval&#8217;ed script. There&#8217;s a newer 3.2.3 version that I would like to test on to see if there is any difference. As for Opera, it&#8217;s an old version that nobody is probably using anymore. But for Konqueror I really don&#8217;t know the source of the error.</p>
<p>Take the <a href="http://modularjs.googlecode.com/svn/trunk/test/index.html">test</a> yourself. If you would like to see how the tests were done take a look at the sources <a href="http://code.google.com/p/modularjs/source/browse/#svn/trunk/test">here</a>.</p>
<p><strong>Update:</strong> The test suite now passes in almost every browser with the exception of some older versions of opera <img src='http://caih.org/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> .</p>


<p>Related posts:<ol><li><a href='http://caih.org/open-source-software/tri-state-checkbox-in-javascript/' rel='bookmark' title='Permanent Link: Tri-state checkbox in JavaScript'>Tri-state checkbox in JavaScript</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://caih.org/open-source-software/loading-javascript-execscript-and-testing/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
