<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="wordpress/2.3.3" -->
<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/"
	>

<channel>
	<title>Richard Sumilang's Blog</title>
	<link>http://www.richard-sumilang.com/blog</link>
	<description>Just another developer's blog.</description>
	<pubDate>Fri, 22 Aug 2008 22:37:43 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.3.3</generator>
	<language>en</language>
			<item>
		<title>It&#8217;s been a while</title>
		<link>http://www.richard-sumilang.com/blog/2008/08/22/its-been-a-while/</link>
		<comments>http://www.richard-sumilang.com/blog/2008/08/22/its-been-a-while/#comments</comments>
		<pubDate>Fri, 22 Aug 2008 22:37:43 +0000</pubDate>
		<dc:creator>Richard Sumilang</dc:creator>
		
		<category><![CDATA[Richard-Sumilang.com]]></category>

		<guid isPermaLink="false">http://www.richard-sumilang.com/blog/2008/08/22/its-been-a-while/</guid>
		<description><![CDATA[Yup, its been quite a while since I've posted anything. I got sick and also had some minor surgery that made me really weak and maybe a bit unproductive. Its been about a month since then and I'm finally starting to feel my strength again, mentally and physically so I hope to start blogging again [...]]]></description>
			<content:encoded><![CDATA[<p>Yup, its been quite a while since I've posted anything. I got sick and also had some minor surgery that made me really weak and maybe a bit unproductive. Its been about a month since then and I'm finally starting to feel my strength again, mentally and physically so I hope to start blogging again soon <img src='http://www.richard-sumilang.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>- Richard S.</p>
<p class="addtoany_share_save">
    <a name="a2a_dd" onmouseover="a2a_show_dropdown(this)" onmouseout="a2a_onMouseOut_delay()" href="http://www.addtoany.com/bookmark?sitename=Richard%20Sumilang%27s%20Blog&amp;siteurl=http%3A%2F%2Fwww.richard-sumilang.com%2Fblog%2F&amp;linkname=It%E2%80%99s%20been%20a%20while&amp;linkurl=http%3A%2F%2Fwww.richard-sumilang.com%2Fblog%2F2008%2F08%2F22%2Fits-been-a-while%2F"><img src="http://www.richard-sumilang.com/blog/wp-content/plugins/add-to-any/share_save_120_16.gif" width="120" height="16" border="0" alt="Share/Save/Bookmark"/></a>
    <script type="text/javascript">a2a_linkname="It’s been a while";a2a_linkurl="http://www.richard-sumilang.com/blog/2008/08/22/its-been-a-while/";</script>
    <script type="text/javascript" src="http://www.addtoany.com/menu/page.js"></script>

	</p>]]></content:encoded>
			<wfw:commentRss>http://www.richard-sumilang.com/blog/2008/08/22/its-been-a-while/feed/</wfw:commentRss>
		</item>
		<item>
		<title>iPhone Software Upgrade 2.0</title>
		<link>http://www.richard-sumilang.com/blog/2008/07/12/iphone-software-upgrade-20/</link>
		<comments>http://www.richard-sumilang.com/blog/2008/07/12/iphone-software-upgrade-20/#comments</comments>
		<pubDate>Sat, 12 Jul 2008 09:05:29 +0000</pubDate>
		<dc:creator>Richard Sumilang</dc:creator>
		
		<category><![CDATA[iPhone]]></category>

		<guid isPermaLink="false">http://www.richard-sumilang.com/blog/2008/07/12/iphone-software-upgrade-20/</guid>
		<description><![CDATA[I just upgraded my iPhone to the latest system upgrade which is pretty much just like the old one with just a handful of new features. The biggest feature (to me) is the ability to add 3rd party products.
Of course you were able to do this before if you unlocked your phone but not too [...]]]></description>
			<content:encoded><![CDATA[<p>I just upgraded my iPhone to the latest system upgrade which is pretty much just like the old one with just a handful of new features. The biggest feature (to me) is the ability to add 3rd party products.</p>
<p>Of course you were able to do this before if you unlocked your phone but not too many people were making applications for it because unlocking your phone was kinda underground. Nevertheless now we officially got and now we got some cool apps to play with!</p>
<p><strong>Here are my Top 5 Favorite Addons! </strong></p>
<ol>
<li><strong>Remote</strong> - While your iPhone/iPod is connected to your LAN you will be able to use it as a remote control to control your iTunes!</li>
<li><strong>AIM</strong> - Yup thats right! No more need for those annoying web based clients that were always laggy and annoying. AOL has made a decent AIM client for the iPhone for you to use. Its pretty standard and doesn't have features like pictures, voice chat, or etc but its gets job done.</li>
<li><strong>Evernote</strong> - I love to be able to access my data from anywhere, regardless of what it is. Evernote lets you take notes, pictures, voice memos, and more from your phone and syncs them up with their server which you can then access through your browser or through a desktop application (Windows / Mac). The basic free account gives you 40mb a month which should be enough but you have an option to upgrade.</li>
<li><strong>AOL Radio</strong> - Yup! Listen to your favorite online or favorite local radio stations without the need of an FM transmeter! Now I can listen to Frosty, Heidi, and Frank or Tom Lykis literally anywhere I am or listen to some up beat music when I hit the gym! (...yeah right)</li>
<li><strong>Movies</strong> - If the title isn't obvious enough, well this little app makes it very easy and convenient to find movie listings by theater or movie and you can skip the box office and purchase them directly through your iPhone.</li>
</ol>
<p>While all that above is great and all there is one feature I was really looking forward to that doesn't quite work. If you wanted to connect to Outlook Exchange servers well you might be able to depending on your server setup but for some reason it won't work with my works exchange servers.</p>
<p>Anyways that will conclude this blog for now. If you would like to know more about whats new with the iPhone follow the link below. All these new goodies though are seriously making me consider upgrading the hardware as well so I can get on the 3G network.</p>
<p>Oh well enjoy!</p>
<p><a href="http://www.apple.com/iphone/" title="iPhone" target="_blank">Apple iPhone</a></p>
<p>PS: If you are afraid of upgrading your software because you have an unlocked iPhone don't worry about. I unlocked my phone as well and the upgrade process went smooth with no hick-ups as you might have experienced with previous 1.x upgrades. It will take a while but that is normal, just let it sit and go grab a snack or something.</p>
<p class="addtoany_share_save">
    <a name="a2a_dd" onmouseover="a2a_show_dropdown(this)" onmouseout="a2a_onMouseOut_delay()" href="http://www.addtoany.com/bookmark?sitename=Richard%20Sumilang%27s%20Blog&amp;siteurl=http%3A%2F%2Fwww.richard-sumilang.com%2Fblog%2F&amp;linkname=iPhone%20Software%20Upgrade%202.0&amp;linkurl=http%3A%2F%2Fwww.richard-sumilang.com%2Fblog%2F2008%2F07%2F12%2Fiphone-software-upgrade-20%2F"><img src="http://www.richard-sumilang.com/blog/wp-content/plugins/add-to-any/share_save_120_16.gif" width="120" height="16" border="0" alt="Share/Save/Bookmark"/></a>
    <script type="text/javascript">a2a_linkname="iPhone Software Upgrade 2.0";a2a_linkurl="http://www.richard-sumilang.com/blog/2008/07/12/iphone-software-upgrade-20/";</script>
    <script type="text/javascript" src="http://www.addtoany.com/menu/page.js"></script>

	</p>]]></content:encoded>
			<wfw:commentRss>http://www.richard-sumilang.com/blog/2008/07/12/iphone-software-upgrade-20/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Tune-Up Eclipse 3.4 with PDT 2</title>
		<link>http://www.richard-sumilang.com/blog/2008/07/11/tune-up-eclipse-34-with-pdt-2/</link>
		<comments>http://www.richard-sumilang.com/blog/2008/07/11/tune-up-eclipse-34-with-pdt-2/#comments</comments>
		<pubDate>Fri, 11 Jul 2008 23:13:11 +0000</pubDate>
		<dc:creator>Richard Sumilang</dc:creator>
		
		<category><![CDATA[Eclipse]]></category>

		<category><![CDATA[PHP]]></category>

		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://www.richard-sumilang.com/blog/2008/07/11/tune-up-eclipse-34-with-pdt-2/</guid>
		<description><![CDATA[If your one of those people like me who get excited when a new version of software comes out you put everything behind yourself rush right away to download it and install regardless of any new bugs it might bring. At first it was great but then the more you use it the more you [...]]]></description>
			<content:encoded><![CDATA[<p>If your one of those people like me who get excited when a new version of software comes out you put everything behind yourself rush right away to download it and install regardless of any new bugs it might bring. At first it was great but then the more you use it the more you notice things that aren't quite working right and a few gotchas here and there.</p>
<h3>PHP Development Tools</h3>
<p>You'll notice that you cannot open code declarations (<tt>F3</tt>) when any versions of PDT 1.0 - 2.0 Integration Build (as of this witting). However this bug is apparently fixed in the nightly build so go ahead and download that version of PDT to get it working... There is a download link below under <strong>My Setup</strong>...</p>
<p>Next, if you notice your IDE hang almost forever every time you start typing variables you can fix this by going to <tt>Windows -&gt; Preferences -&gt; PHP -&gt; Editor -&gt; Code Assist</tt> and un-checking <tt>Enable auto activation</tt>. This seems to be really laggy and extremely buggy even if you set the <tt>Auto activation delay</tt> higher. Usually you'll get the error below with this:</p>
<p><a href="http://www.richard-sumilang.com/blog/2008/07/11/tune-up-eclipse-34-with-pdt-2/problems-during-content-assist/" rel="attachment wp-att-76" title="Problems During Content Assist"><img src="http://www.richard-sumilang.com/blog/wp-content/uploads/2008/07/org_eclipse_php_ui_hanging.jpg" alt="Problems During Content Assist" /></a></p>
<p>The good news is that you still get your code completion when you hit <tt>Ctrl + Space</tt> and it seems to come up a little faster.</p>
<h3>The Right Runtime for the Job</h3>
<p>During this hateful quest I decided to try out a few different IDEs. BEAs JRockit (now Oracle's) seem to have given me the best performance on Windows. I've heard good reports about IBMs JRE but since I'm not on a IBM platform they won't let me install it! If you're on linux I've also heard good things about IcedTea Java.</p>
<ul>
<li><a href="http://www.oracle.com/technology/software/products/jrockit/index.html" title="Download Oracle JRockit" target="_blank">Oracle JRockit</a></li>
<li><a href="http://www.ibm.com/developerworks/java/jdk/" title="Download IBM Java JDK" target="_blank">IBM Java JDK</a></li>
<li><a href="http://icedtea.classpath.org/download/" title="Download IcedTea Java" target="_blank">IcedTea Java</a></li>
<li><a href="http://java.sun.com/javase/downloads/index.jsp" title="Download the original Sun Java" target="_blank">Sun Java</a></li>
</ul>
<h3>My Setup</h3>
<ul>
<li><a href="http://www.eclipse.org/downloads/" title="Eclipse Downloads" target="_blank">Eclipse 3.4</a></li>
<li><a href="http://download.eclipse.org/tools/pdt/downloads/" title="PDT Downloads" target="_blank">PDT</a>: Specially <a href="http://download.eclipse.org/tools/pdt/downloads/release.php?release=N20080710" title="PDT 2 N2008710" target="_blank">N2008710</a> but the current nightly version can be better than mine</li>
</ul>
<h3>Conclusion</h3>
<p>Aside from what's listed above the only last bug I notice with PDT is the <tt>Path Variables</tt> settings not workgin (<tt>Window -&gt; Preferences -&gt; PHP -&gt; Path Variables</tt>). That was  useful feature for me in previous versions of PDT but it looks like they've got a few other ways not to define external sources for your project that will work for now.</p>
<p>Of course this is also all development so as time progresses these issues may all be resolved but you like to live on the bleeding edge like me then you might get cut as they say <img src='http://www.richard-sumilang.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> Oddly enough I notice much more better results with the same setup on my Mac <img src='http://www.richard-sumilang.com/blog/wp-includes/images/smilies/icon_razz.gif' alt=':-P' class='wp-smiley' /> Mac owns!</p>
<p class="addtoany_share_save">
    <a name="a2a_dd" onmouseover="a2a_show_dropdown(this)" onmouseout="a2a_onMouseOut_delay()" href="http://www.addtoany.com/bookmark?sitename=Richard%20Sumilang%27s%20Blog&amp;siteurl=http%3A%2F%2Fwww.richard-sumilang.com%2Fblog%2F&amp;linkname=Tune-Up%20Eclipse%203.4%20with%20PDT%202&amp;linkurl=http%3A%2F%2Fwww.richard-sumilang.com%2Fblog%2F2008%2F07%2F11%2Ftune-up-eclipse-34-with-pdt-2%2F"><img src="http://www.richard-sumilang.com/blog/wp-content/plugins/add-to-any/share_save_120_16.gif" width="120" height="16" border="0" alt="Share/Save/Bookmark"/></a>
    <script type="text/javascript">a2a_linkname="Tune-Up Eclipse 3.4 with PDT 2";a2a_linkurl="http://www.richard-sumilang.com/blog/2008/07/11/tune-up-eclipse-34-with-pdt-2/";</script>
    <script type="text/javascript" src="http://www.addtoany.com/menu/page.js"></script>

	</p>]]></content:encoded>
			<wfw:commentRss>http://www.richard-sumilang.com/blog/2008/07/11/tune-up-eclipse-34-with-pdt-2/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Cutest dog/bear thing</title>
		<link>http://www.richard-sumilang.com/blog/2008/07/08/cutest-dogbear-thing/</link>
		<comments>http://www.richard-sumilang.com/blog/2008/07/08/cutest-dogbear-thing/#comments</comments>
		<pubDate>Tue, 08 Jul 2008 08:13:26 +0000</pubDate>
		<dc:creator>Richard Sumilang</dc:creator>
		
		<category><![CDATA[Other]]></category>

		<guid isPermaLink="false">http://www.richard-sumilang.com/blog/2008/07/08/cutest-dogbear-thing/</guid>
		<description><![CDATA[I was cleaning up my desktop and found this picture of the cutest little dog I've ever seen. I dunno where I found it from, googling or something but I can't find what's this dog called. It looks kinda like a teddybear but a dog?

If you know what this please add a comment or email [...]]]></description>
			<content:encoded><![CDATA[<p>I was cleaning up my desktop and found this picture of the cutest little dog I've ever seen. I dunno where I found it from, googling or something but I can't find what's this dog called. It looks kinda like a teddybear but a dog?</p>
<p><a href="http://www.richard-sumilang.com/blog/2008/07/08/cutest-dogbear-thing/cutest-dog/" rel="attachment wp-att-70" title="Cutest Dog"><img src="http://www.richard-sumilang.com/blog/wp-content/uploads/2008/07/2559044254_83690deda8.jpg" alt="Cutest Dog" /></a></p>
<p>If you know what this please <a href="http://www.richard-sumilang.com/blog/2008/07/08/cutest-dogbear-thing/#respond" title="add a comment to this cutest dog/bear thing">add a comment</a> or <a href="mailto:richard@richard-sumilang.com?subject=Cutest%20dog/bear%20thing">email me</a>!</p>
<p class="addtoany_share_save">
    <a name="a2a_dd" onmouseover="a2a_show_dropdown(this)" onmouseout="a2a_onMouseOut_delay()" href="http://www.addtoany.com/bookmark?sitename=Richard%20Sumilang%27s%20Blog&amp;siteurl=http%3A%2F%2Fwww.richard-sumilang.com%2Fblog%2F&amp;linkname=Cutest%20dog%2Fbear%20thing&amp;linkurl=http%3A%2F%2Fwww.richard-sumilang.com%2Fblog%2F2008%2F07%2F08%2Fcutest-dogbear-thing%2F"><img src="http://www.richard-sumilang.com/blog/wp-content/plugins/add-to-any/share_save_120_16.gif" width="120" height="16" border="0" alt="Share/Save/Bookmark"/></a>
    <script type="text/javascript">a2a_linkname="Cutest dog/bear thing";a2a_linkurl="http://www.richard-sumilang.com/blog/2008/07/08/cutest-dogbear-thing/";</script>
    <script type="text/javascript" src="http://www.addtoany.com/menu/page.js"></script>

	</p>]]></content:encoded>
			<wfw:commentRss>http://www.richard-sumilang.com/blog/2008/07/08/cutest-dogbear-thing/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Run Ruby Code on Google App Engine!</title>
		<link>http://www.richard-sumilang.com/blog/2008/07/07/run-ruby-code-on-google-app-engine/</link>
		<comments>http://www.richard-sumilang.com/blog/2008/07/07/run-ruby-code-on-google-app-engine/#comments</comments>
		<pubDate>Tue, 08 Jul 2008 06:54:00 +0000</pubDate>
		<dc:creator>Richard Sumilang</dc:creator>
		
		<category><![CDATA[Google App Engine]]></category>

		<category><![CDATA[Python]]></category>

		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://www.richard-sumilang.com/blog/2008/07/07/run-ruby-code-on-google-app-engine/</guid>
		<description><![CDATA[Oh wait what? Google App Engine is for Python you say? Ah yes that is correct but apparently this person named Why (not sure if that's his alias or his real name) has created a byte code decompiler which recompiles your Ruby code into Python code! Is that nutty or what?!?!
Of course this is far [...]]]></description>
			<content:encoded><![CDATA[<p>Oh wait what? Google App Engine is for Python you say? Ah yes that is correct but apparently this person named Why (not sure if that's his alias or his real name) has created a byte code decompiler which recompiles your Ruby code into Python code! Is that nutty or what?!?!</p>
<p>Of course this is far from stable and should only be done for fun but if you want to read about it here it is: <a href="http://hackety.org/2008/05/05/sneakingRubyThroughGoogleAppEngine.html" title="Sneaking Ruby Through Google App Engine (and other Strictly Python Places)" target="_blank">Sneaking Ruby Through Google App Engine (and Other Strictly Python Places)</a></p>
<p>In theory you should be able to do this wherever Python code is ran, right?</p>
<p>Happy Hacking!</p>
<p class="addtoany_share_save">
    <a name="a2a_dd" onmouseover="a2a_show_dropdown(this)" onmouseout="a2a_onMouseOut_delay()" href="http://www.addtoany.com/bookmark?sitename=Richard%20Sumilang%27s%20Blog&amp;siteurl=http%3A%2F%2Fwww.richard-sumilang.com%2Fblog%2F&amp;linkname=Run%20Ruby%20Code%20on%20Google%20App%20Engine%21&amp;linkurl=http%3A%2F%2Fwww.richard-sumilang.com%2Fblog%2F2008%2F07%2F07%2Frun-ruby-code-on-google-app-engine%2F"><img src="http://www.richard-sumilang.com/blog/wp-content/plugins/add-to-any/share_save_120_16.gif" width="120" height="16" border="0" alt="Share/Save/Bookmark"/></a>
    <script type="text/javascript">a2a_linkname="Run Ruby Code on Google App Engine!";a2a_linkurl="http://www.richard-sumilang.com/blog/2008/07/07/run-ruby-code-on-google-app-engine/";</script>
    <script type="text/javascript" src="http://www.addtoany.com/menu/page.js"></script>

	</p>]]></content:encoded>
			<wfw:commentRss>http://www.richard-sumilang.com/blog/2008/07/07/run-ruby-code-on-google-app-engine/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Compressing JavaScript &#8230; TO THE MAX!</title>
		<link>http://www.richard-sumilang.com/blog/2008/07/06/compressing-javascript-to-the-max/</link>
		<comments>http://www.richard-sumilang.com/blog/2008/07/06/compressing-javascript-to-the-max/#comments</comments>
		<pubDate>Sun, 06 Jul 2008 08:50:20 +0000</pubDate>
		<dc:creator>Richard Sumilang</dc:creator>
		
		<category><![CDATA[JavaScript]]></category>

		<category><![CDATA[compression]]></category>

		<category><![CDATA[custom]]></category>

		<category><![CDATA[custom rhino]]></category>

		<category><![CDATA[dojo]]></category>

		<category><![CDATA[how to]]></category>

		<category><![CDATA[howto]]></category>

		<category><![CDATA[javascript compiling]]></category>

		<category><![CDATA[javascript compression]]></category>

		<category><![CDATA[javascript obfuscation]]></category>

		<category><![CDATA[javascript optimization]]></category>

		<category><![CDATA[jsmin]]></category>

		<category><![CDATA[optimization]]></category>

		<category><![CDATA[performance]]></category>

		<category><![CDATA[rhino]]></category>

		<category><![CDATA[richard]]></category>

		<category><![CDATA[richard sumilang]]></category>

		<category><![CDATA[shrink safe]]></category>

		<category><![CDATA[shrinksafe]]></category>

		<category><![CDATA[sumilang]]></category>

		<guid isPermaLink="false">http://www.richard-sumilang.com/blog/2008/07/06/compressing-javascript-to-the-max/</guid>
		<description><![CDATA[Here is the best recipe I've came up with so far to compress JavaScript. The goal here is to get our JavaScript file the smallest possible. In a nutshell, first we will obfuscate and then we "minify" it.
With obfuscation we'll convert all of our meaningless variables to the shortest meaningful variable needed. "Huh?" What I [...]]]></description>
			<content:encoded><![CDATA[<p>Here is the best recipe I've came up with so far to compress JavaScript. The goal here is to get our JavaScript file the smallest possible. In a nutshell, first we will obfuscate and then we "minify" it.</p>
<p>With obfuscation we'll convert all of our meaningless variables to the shortest meaningful variable needed. <em>"Huh?"</em> What I mean by that is basically all of our variables that we don't have access to or need, specifically variables within functions don't really need any meaning as long as they get the job done... per se... When we write code we name variables in a way so that they make sense to us, humans. There's obviously nothing wrong with that but on the computer's side of things they're just a set of instructions where the naming doesn't mean anything. <tt>totalPrice + tax = price</tt> means the same to a computer as <tt>foo + bar = result</tt> which means the same as <tt>_1 + _2 = X</tt>. We're going to use obfuscation to save space of our useless variable names.</p>
<p><em>Clarification: The variables aren't useless, their long names are.</em></p>
<p>After doing what we can with variables we then need to <em>minify</em> our script. This is very simple, just removing all useless white-space and line breaks. It may not sound like much but your web browser would also have an easier time parsing your code if it was all on one line.</p>
<h3>The tools for the job</h3>
<p>And walla! Go ahead and download these tools off their sites. For JSMin just download the C source code for now if you're on Mac or *nix but if you're on Windows they should have a zip file containing an <tt>.exe</tt> on the bottom of the page somewhere. For the prior, simply compile the source like so:</p>
<p><code><br />
$ gcc -o jsmin jsmin.c<br />
</code></p>
<ol>
<li><a href="http://archive.dojotoolkit.org/nightly/checkout/util/shrinksafe/" title="Custom Rhino" target="_blank">Custom Rhino</a>: This is what we'll use to obfuscate our JavaScript code. Custom Rhino is a modified version of Mozilla's Rhino JavaScript interpretor which has an obfuscation feature added to it.</li>
<li><a href="http://www.mozilla.org/rhino/" title="JSMin" target="_blank">JSMin</a>: And this would obviously be our minify tool! There are actually quite a few other tools that do the same thing JSMin does but I chose to use JSMin because its available in many  programming languages. This is a plus for me because I love getting my hands dirty in other languages and it just works.</li>
</ol>
<h3>Doing It!</h3>
<p>Lets get started with our ever so boring <em>Hello World!</em> test but because this project is so exciting it will make up for it! <em>Right?</em> Hehe anyways here goes our little JavaScript code, put this and the programs we've downloaded above all into one directory just for the sake of testing for now (you can organize them into somewhere more meaningful later) and save the JavaScript code as <tt>test.js</tt>:</p>
<pre class="javascript"><span style="color: #003366; font-weight: bold;">var</span> message = <span style="color: #3366CC;">&quot;Hello Richard!&quot;</span>;
&nbsp;
helloWorld = <span style="color: #003366; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span>msg<span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#123;</span>
	<span style="color: #003366; font-weight: bold;">var</span> message = msg.<span style="color: #006600;">toUpperCase</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
	<span style="color: #000066;">alert</span><span style="color: #66cc66;">&#40;</span>message<span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span>
&nbsp;
helloWorld<span style="color: #66cc66;">&#40;</span>message<span style="color: #66cc66;">&#41;</span>;</pre>
<p>Very simple. We got a global variable named <tt>message</tt>, and function named <tt>helloWorld</tt>. Now its time to pack this baby together! Open up a console window and lets do it step by step:</p>
<p><code>$ java -jar custom_rhino.jar -strict -1 -opt -c test.js &gt; tmp.js</code></p>
<p>If you take a peek at <tt>tmp.js</tt> then Rhino should have generated this:</p>
<pre class="javascript"><span style="color: #003366; font-weight: bold;">var</span> message=<span style="color: #3366CC;">&quot;Hello Richard!&quot;</span>;
helloWorld=<span style="color: #003366; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span>_1<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>
<span style="color: #003366; font-weight: bold;">var</span> _2=_1.<span style="color: #006600;">toUpperCase</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #000066;">alert</span><span style="color: #66cc66;">&#40;</span>_2<span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span>;
helloWorld<span style="color: #66cc66;">&#40;</span>message<span style="color: #66cc66;">&#41;</span>;</pre>
<p>What's really important to note here is that our global variable names remained the same and so did our function. The only code that is obfuscated is the code that means nothing to us anyways <img src='http://www.richard-sumilang.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> ... Nothing in that we don't access it anyways.</p>
<p>Next we minify the code with JSMin:</p>
<p><code>$ ./jsmin &lt; tmp.js &gt; test_compressed.js</code></p>
<p>Our code should look like:</p>
<pre class="javascript"><span style="color: #003366; font-weight: bold;">var</span> message=<span style="color: #3366CC;">&quot;Hello Richard!&quot;</span>;helloWorld=<span style="color: #003366; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span>_1<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span><span style="color: #003366; font-weight: bold;">var</span> _2=_1.<span style="color: #006600;">toUpperCase</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;alert<span style="color: #66cc66;">&#40;</span>_2<span style="color: #66cc66;">&#41;</span>;<span style="color: #66cc66;">&#125;</span>;helloWorld<span style="color: #66cc66;">&#40;</span>message<span style="color: #66cc66;">&#41;</span>;</pre>
<p>And walla! Isn't that beautiful! Of  course the space savings isn't tremendous with this small script but I've tested it with <a href="http://prototypejs.org/assets/2008/1/25/prototype-1.6.0.2.js" title="Prototype" target="_blank">Prototype v1.6.0.2</a> and it went from <tt>123kb</tt> to <tt>83kb</tt>! That's about a ~40% save right? Not so bad.</p>
<p>So now we've got our code obfuscated and compressed on the client end as much as possible. This should definitely help with transferring over all your JavaScript much faster and your browser should have an better time rendering it.</p>
<p>We can also eliminate the need for <tt>tmp.js</tt> and perform the above operation with one command:</p>
<p><code>$ java -jar custom_rhino.jar -strict -opt -1 -c test.js | ./jsmin &gt; test_compressed.js</code></p>
<h3>Conclusion</h3>
<p>Well there you have it. Its also good to note to always start and end loops and conditions with opening and closing brackets even if you have those one liners for compatibilities sake. Your code should be packed for distribution when you are sure its at a stable state otherwise debugging can be problem and a headache fast.</p>
<p>If you want to take things further you can optimize your server end by adding gzip compression to Apache or whatever you use and also refactoring your code. The lesser try/catches would help as well.</p>
<p>Here are a few other tools:</p>
<ul>
<li><a href="http://shrinksafe.dojotoolkit.org/" title="Dojo Srinksafe" target="_blank">Dojo Shrinksafe</a>: An online compression tool made with Dojo's custom_rhino.jar.</li>
<li><a href="http://www.mozilla.org/rhino/" title="Mozilla Rhino" target="_blank">Rhino</a>: This is the homepage of the Rhino JavaScript interpreter that the Dojo developers extended to give obfuscation capabilities to.</li>
<li><a href="http://dean.edwards.name/packer/" title="Dean Edwards Packer" target="_blank">Dean Edwards Packer</a>: A pretty popular JavaScript packer. Source also available</li>
<li><a href="http://joliclic.free.fr/php/javascript-packer/en/index.php" title="Packer JavaScript in PHP" target="_blank">Packer JavaScript in PHP</a>: Same as the one above but made in PHP</li>
</ul>
<p class="addtoany_share_save">
    <a name="a2a_dd" onmouseover="a2a_show_dropdown(this)" onmouseout="a2a_onMouseOut_delay()" href="http://www.addtoany.com/bookmark?sitename=Richard%20Sumilang%27s%20Blog&amp;siteurl=http%3A%2F%2Fwww.richard-sumilang.com%2Fblog%2F&amp;linkname=Compressing%20JavaScript%20%E2%80%A6%20TO%20THE%20MAX%21&amp;linkurl=http%3A%2F%2Fwww.richard-sumilang.com%2Fblog%2F2008%2F07%2F06%2Fcompressing-javascript-to-the-max%2F"><img src="http://www.richard-sumilang.com/blog/wp-content/plugins/add-to-any/share_save_120_16.gif" width="120" height="16" border="0" alt="Share/Save/Bookmark"/></a>
    <script type="text/javascript">a2a_linkname="Compressing JavaScript … TO THE MAX!";a2a_linkurl="http://www.richard-sumilang.com/blog/2008/07/06/compressing-javascript-to-the-max/";</script>
    <script type="text/javascript" src="http://www.addtoany.com/menu/page.js"></script>

	</p>]]></content:encoded>
			<wfw:commentRss>http://www.richard-sumilang.com/blog/2008/07/06/compressing-javascript-to-the-max/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Bitwise Configurations - Crash Course</title>
		<link>http://www.richard-sumilang.com/blog/2008/07/03/bitwise-configurations-crash-course/</link>
		<comments>http://www.richard-sumilang.com/blog/2008/07/03/bitwise-configurations-crash-course/#comments</comments>
		<pubDate>Fri, 04 Jul 2008 03:45:04 +0000</pubDate>
		<dc:creator>Richard Sumilang</dc:creator>
		
		<category><![CDATA[Development]]></category>

		<category><![CDATA[Math]]></category>

		<category><![CDATA[Other]]></category>

		<category><![CDATA[binary]]></category>

		<category><![CDATA[bitwise]]></category>

		<category><![CDATA[bitwise configurations]]></category>

		<category><![CDATA[bitwise crash course]]></category>

		<category><![CDATA[programming]]></category>

		<category><![CDATA[richard]]></category>

		<category><![CDATA[richard sumilang]]></category>

		<category><![CDATA[science]]></category>

		<category><![CDATA[sumilang]]></category>

		<guid isPermaLink="false">http://www.richard-sumilang.com/blog/2008/07/03/bitwise-configurations-crash-course/</guid>
		<description><![CDATA[Using bitwise configurations in software can have its advantages when you want to store a multiple configuration values within a single value. The only disadvantage (I see) with this technique is you cannot exactly query for a specific permission in your database if you are storing the configuration there but otherwise if that's not necessary [...]]]></description>
			<content:encoded><![CDATA[<p>Using bitwise configurations in software can have its advantages when you want to store a multiple configuration values within a single value. The only disadvantage (I see) with this technique is you cannot exactly query for a specific permission in your database if you are storing the configuration there but otherwise if that's not necessary it might be an advantage along with the fact of its simplicity.</p>
<p><em>Note: It might help if you have any knowledge of binary numbers but its not necessary.</em></p>
<h3>Jumping Right In!</h3>
<p>That's right! Its a crash course so lets just jump right in! With bitwise configurations each configuration is a number, but not just any number, they go by multiples of <tt>2</tt> starting from <tt>1</tt>. For our example, I'm going to make up five configuration settings to play with that will determine my application's error settings. These can be anything of course. People sometimes use bitwise operations with permissions but anyways here we go...<br />
<code><br />
ERROR_WARNING		=	1<br />
ERROR_CRITICAL		=	2<br />
ERROR_UNSUPPORTED	=	4<br />
ERROR_DEPRECATED		=	8<br />
ERROR_FATAL			=	16<br />
</code><br />
There we have our configuration, as you see each setting starts at <tt>1</tt> and goes up by multiples of <tt>2</tt>.</p>
<p>So now lets say I want to configure my program to report all critical, deprecated, and fatal errors. That would simply be the sum of those configurations:</p>
<p><code>ERROR_SETTINGS = ERROR_CRITICAL[2] + ERROR_DEPRECATED[8] + ERROR_FATAL[16]</code></p>
<p>Usually when you configure *nix programs with something like this you don't use the <tt>+</tt> operator but instead a pipe, <tt>|</tt>:</p>
<p><code>ERROR_SETTINGS = ERROR_CRITICAL | ERROR_DEPRECATED | ERROR_FATAL</code></p>
<p>The above syntax is usually valid in most programming languages. At least Python, Java, C, and PHP off the top of my head. So now we have <tt>ERROR_SETTINGS</tt> equal to <tt>26</tt>.</p>
<p>To check if we have a specific setting configured in <tt>ERROR_SETTINGS</tt>, such as <tt>ERROR_UNSUPPORTED</tt> we could simple do:</p>
<p><code>ERROR_SETTINGS &amp; ERROR_UNSUPPORTED</code></p>
<p>That will return <tt>0</tt> because <tt>ERROR_UNSUPPORTED</tt> has no bits that match <tt>26</tt>. To explain it further lets take our numbers and look at them at as binary numbers:<br />
<code><br />
26	=	11010<br />
4	=	100<br />
</code><br />
As you see the 1st <tt>0</tt> from left needs to be <tt>1</tt> in order for <tt>4</tt> to match <tt>26</tt>. So if our <tt>ERROR_SETTING</tt> included <tt>ERROR_UNSUPPORTED</tt> its value would <tt>30</tt> and its binary number <tt>11110</tt> thus <tt>4</tt> (binary <tt>100</tt>) would match.</p>
<p>When testing if your configuration contains a certain setting using <tt>&amp;</tt>, as long as it returns anything greater than <tt>0</tt> then your good! ... Otherwise its not part of the configuration.</p>
<h3>Conclusion</h3>
<p>I hope this crash course made sense to you. If you are still a little unclear how it works <a href="http://en.wikipedia.org/wiki/Bitwise_operation" title="Wikipedia Bitwise operations" target="_blank">wikipedia</a> has a thorough tutorial explaining how bitwise operations work and a good explanation of <a href="http://en.wikipedia.org/wiki/Binary_numeral_system" title="Binary numeral system" target="_blank">binary</a> numbers.</p>
<p>Also, if you are programmer it sometimes might make sense to use bitwise operations to store configuration values because as we know, computers are mathematical machines and its what they do best. Its by far way less expensive to check if a configuration exists using the bitwise technique as opposed to storing your configurations in a list or dictionary and looping through them to check if what you are looking for exists.</p>
<p class="addtoany_share_save">
    <a name="a2a_dd" onmouseover="a2a_show_dropdown(this)" onmouseout="a2a_onMouseOut_delay()" href="http://www.addtoany.com/bookmark?sitename=Richard%20Sumilang%27s%20Blog&amp;siteurl=http%3A%2F%2Fwww.richard-sumilang.com%2Fblog%2F&amp;linkname=Bitwise%20Configurations%20-%20Crash%20Course&amp;linkurl=http%3A%2F%2Fwww.richard-sumilang.com%2Fblog%2F2008%2F07%2F03%2Fbitwise-configurations-crash-course%2F"><img src="http://www.richard-sumilang.com/blog/wp-content/plugins/add-to-any/share_save_120_16.gif" width="120" height="16" border="0" alt="Share/Save/Bookmark"/></a>
    <script type="text/javascript">a2a_linkname="Bitwise Configurations - Crash Course";a2a_linkurl="http://www.richard-sumilang.com/blog/2008/07/03/bitwise-configurations-crash-course/";</script>
    <script type="text/javascript" src="http://www.addtoany.com/menu/page.js"></script>

	</p>]]></content:encoded>
			<wfw:commentRss>http://www.richard-sumilang.com/blog/2008/07/03/bitwise-configurations-crash-course/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Python and .NET playing together!</title>
		<link>http://www.richard-sumilang.com/blog/2008/06/27/python-and-net-playing-together/</link>
		<comments>http://www.richard-sumilang.com/blog/2008/06/27/python-and-net-playing-together/#comments</comments>
		<pubDate>Sat, 28 Jun 2008 03:27:43 +0000</pubDate>
		<dc:creator>Richard Sumilang</dc:creator>
		
		<category><![CDATA[C#]]></category>

		<category><![CDATA[Linux]]></category>

		<category><![CDATA[MySQL]]></category>

		<category><![CDATA[Python]]></category>

		<category><![CDATA[Unix]]></category>

		<category><![CDATA[Windows]]></category>

		<category><![CDATA[.net]]></category>

		<category><![CDATA[asp]]></category>

		<category><![CDATA[c#]]></category>

		<category><![CDATA[cross platform]]></category>

		<category><![CDATA[iron python]]></category>

		<category><![CDATA[ironpython]]></category>

		<category><![CDATA[Java]]></category>

		<category><![CDATA[jscript]]></category>

		<category><![CDATA[mac]]></category>

		<category><![CDATA[mono]]></category>

		<category><![CDATA[mysql .net]]></category>

		<category><![CDATA[mysql .net connector]]></category>

		<category><![CDATA[mysql connector]]></category>

		<category><![CDATA[mysql connector .net]]></category>

		<category><![CDATA[platforms]]></category>

		<category><![CDATA[richard]]></category>

		<category><![CDATA[richard sumilang]]></category>

		<category><![CDATA[run time]]></category>

		<category><![CDATA[runtime]]></category>

		<category><![CDATA[sumilang]]></category>

		<guid isPermaLink="false">http://www.richard-sumilang.com/blog/2008/06/27/python-and-net-playing-together/</guid>
		<description><![CDATA[Intro
Lately my head has been up in the clouds playing around with a few languages, Python, C#, and Java (we'll get into Java later) as I usually do for fun and I thought how fun would it be to mix them!
Of course this is nothing new. There have been interpreters to mix and match them [...]]]></description>
			<content:encoded><![CDATA[<h3>Intro</h3>
<p>Lately my head has been up in the clouds playing around with a few languages, Python, C#, and Java (we'll get into Java later) as I usually do for fun and I thought how fun would it be to mix them!</p>
<p>Of course this is nothing new. There have been interpreters to mix and match them all you like for some time now and in this blog we'll focus on Python and .NET for now.</p>
<h3>IronPython</h3>
<p><a href="http://www.codeplex.com/IronPython" title="IronPython" target="_blank">IronPython</a> is an implementation of the Python interpreter written completely in .NET. Being that it is written in .NET you can access all the .NET libraries with the interpreter and run it on any platform.</p>
<p>To run IronPython on any other than MS Windows (*nix, Mac, etc) you will need to install <a href="http://www.mono-project.com/" title="Mono">Mono</a>. Mono provides the necessary software to run and develop .NET software on other platforms.</p>
<p>Note: The Mac package of Mono comes with IronPython. If you are on *nix you can probably find a package for your distro or have to compile it for yourself. If you are on MS Windows you can get the latest .NET run time from your <a href="http://windowsupdate.microsoft.com" title="Windows Update" target="_blank">Windows Update</a>.</p>
<h3>It takes two to tangle!</h3>
<p>So after all that babble lets get started! Out of all the .NET languages I am currently most familiar with C# so I'm going to be taking some C# examples and showing you how to do them with Python using the IronPython interpreter which is invoked via the <tt>ipy</tt> command.</p>
<p>We'll start first with the ever so boring "Hello World" program.</p>
<p>In C# we would do something like this:</p>
<pre class="csharp"><span style="color: #0600FF;">using</span> <span style="color: #000000;">System</span>;
&nbsp;
<span style="color: #0600FF;">public</span> <span style="color: #FF0000;">class</span> HelloWorld
<span style="color: #000000;">&#123;</span>
	<span style="color: #0600FF;">public</span> <span style="color: #0600FF;">static</span> <span style="color: #0600FF;">void</span> Main<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
	<span style="color: #000000;">&#123;</span>
		Console.<span style="color: #0000FF;">WriteLine</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">&quot;Hello Richard!&quot;</span><span style="color: #000000;">&#41;</span>;
	<span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre>
<p>The above code should be extremely obvious, if not I suggest some polishing up of your C# skills.</p>
<p>Now with Python, I'm going to write the same exact thing (minus wrapping it in a class since its unnecessary with Python at this point) and I'm going to output "Hello Richard" using the same C# libraries:</p>
<pre class="python"><span style="color: #ff7700;font-weight:bold;">from</span> System <span style="color: #ff7700;font-weight:bold;">import</span> *
&nbsp;
Console.<span style="color: black;">WriteLine</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;Hello Richard&quot;</span><span style="color: black;">&#41;</span></pre>
<p>That's it! An extremely simple 2 lines! Not bad huh? Of course that was cool but not something so useful.</p>
<p>All we've done was imported the <tt>System</tt> library into the current name space. We could have also done <tt>import System</tt> but then we would have had to write the whole <tt>System.Console.WriteLine()</tt> command. In some cases that might be useful if you don't want certain things to conflict.</p>
<p>Now lets do something a little more cool like interacting with a DLL created completely in .NET. If you want to know how to create a DLL file yourself then <em>Google</em> it but for now I'm going to take one already made.</p>
<p>For this example I'm going to use the <a href="http://dev.mysql.com/downloads/connector/net/5.1.html" title="MySQL .NET Connector" target="_blank">MySQL .NET Connector</a> and query some junk from my database.</p>
<p>Here would be the C# way (borrowed from <a href="http://www.mono-project.com/MySQL" title="MySQL Mono" target="_blank">here</a>):</p>
<pre class="csharp"><span style="color: #0600FF;">using</span> <span style="color: #000000;">System</span>;
<span style="color: #0600FF;">using</span> <span style="color: #000000;">System</span>.<span style="color: #0000FF;">Data</span>;
<span style="color: #0600FF;">using</span> MySql.<span style="color: #0000FF;">Data</span>.<span style="color: #0000FF;">MySqlClient</span>;
&nbsp;
<span style="color: #0600FF;">public</span> <span style="color: #FF0000;">class</span> Test
<span style="color: #000000;">&#123;</span>
	<span style="color: #0600FF;">public</span> <span style="color: #0600FF;">static</span> <span style="color: #0600FF;">void</span> Main<span style="color: #000000;">&#40;</span><span style="color: #FF0000;">string</span><span style="color: #000000;">&#91;</span><span style="color: #000000;">&#93;</span> args<span style="color: #000000;">&#41;</span>
	<span style="color: #000000;">&#123;</span>
		<span style="color: #FF0000;">string</span> connectionString =
			<span style="color: #808080;">&quot;Server=localhost;&quot;</span> +
			<span style="color: #808080;">&quot;Database=test;&quot;</span> +
			<span style="color: #808080;">&quot;User ID=myuserid;&quot;</span> +
			<span style="color: #808080;">&quot;Password=mypassword;&quot;</span> +
			<span style="color: #808080;">&quot;Pooling=false&quot;</span>;
&nbsp;
		IDbConnection dbcon;
		dbcon = <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> MySqlConnection<span style="color: #000000;">&#40;</span>connectionString<span style="color: #000000;">&#41;</span>;
		dbcon.<span style="color: #0000FF;">Open</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
		IDbCommand dbcmd = dbcon.<span style="color: #0000FF;">CreateCommand</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
		<span style="color: #008080; font-style: italic;">// requires a table to be created named employee</span>
		<span style="color: #008080; font-style: italic;">// with columns firstname and lastname</span>
		<span style="color: #008080; font-style: italic;">// such as,</span>
		<span style="color: #008080; font-style: italic;">//        CREATE TABLE employee (</span>
		<span style="color: #008080; font-style: italic;">//           firstname varchar(32),</span>
		<span style="color: #008080; font-style: italic;">//           lastname varchar(32));</span>
		<span style="color: #FF0000;">string</span> sql =
			<span style="color: #808080;">&quot;SELECT firstname, lastname &quot;</span> +
			<span style="color: #808080;">&quot;FROM employee&quot;</span>;
		dbcmd.<span style="color: #0000FF;">CommandText</span> = sql;
		IDataReader reader = dbcmd.<span style="color: #0000FF;">ExecuteReader</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
		<span style="color: #0600FF;">while</span><span style="color: #000000;">&#40;</span>reader.<span style="color: #0000FF;">Read</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
			<span style="color: #FF0000;">string</span> FirstName = <span style="color: #000000;">&#40;</span><span style="color: #FF0000;">string</span><span style="color: #000000;">&#41;</span> reader<span style="color: #000000;">&#91;</span><span style="color: #808080;">&quot;firstname&quot;</span><span style="color: #000000;">&#93;</span>;
			<span style="color: #FF0000;">string</span> LastName = <span style="color: #000000;">&#40;</span><span style="color: #FF0000;">string</span><span style="color: #000000;">&#41;</span> reader<span style="color: #000000;">&#91;</span><span style="color: #808080;">&quot;lastname&quot;</span><span style="color: #000000;">&#93;</span>;
			Console.<span style="color: #0000FF;">WriteLine</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">&quot;Name: &quot;</span> +
				FirstName + <span style="color: #808080;">&quot; &quot;</span> + LastName<span style="color: #000000;">&#41;</span>;
		<span style="color: #000000;">&#125;</span>
		<span style="color: #008080; font-style: italic;">// clean up</span>
		reader.<span style="color: #0000FF;">Close</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
		reader = <span style="color: #0600FF;">null</span>;
		dbcmd.<span style="color: #0000FF;">Dispose</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
		dbcmd = <span style="color: #0600FF;">null</span>;
		dbcon.<span style="color: #0000FF;">Close</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
		dbcon = <span style="color: #0600FF;">null</span>;
	<span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre>
<p>Now, lets do this the Python way with the same rules as the last example; using the same C# libraries.</p>
<pre class="python"><span style="color: #ff7700;font-weight:bold;">import</span> clr
clr.<span style="color: black;">AddReferenceToFile</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;MySql.Data.dll&quot;</span><span style="color: black;">&#41;</span> <span style="color: #808080; font-style: italic;"># MySql.Data.dll must be located in the same directory as this script</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">from</span> System <span style="color: #ff7700;font-weight:bold;">import</span> *;
<span style="color: #ff7700;font-weight:bold;">from</span> MySql.<span style="color: black;">Data</span>.<span style="color: black;">MySqlClient</span> <span style="color: #ff7700;font-weight:bold;">import</span> *;
&nbsp;
connStr = <span style="color: black;">&#40;</span>
	<span style="color: #483d8b;">&quot;Server=localhost;&quot;</span>
	<span style="color: #483d8b;">&quot;Database=test;&quot;</span>
	<span style="color: #483d8b;">&quot;User ID=myuserid;&quot;</span>
	<span style="color: #483d8b;">&quot;Password=mypassword;&quot;</span>
	<span style="color: #483d8b;">&quot;Pooling=false&quot;</span>
<span style="color: black;">&#41;</span>
&nbsp;
conn = MySqlConnection<span style="color: black;">&#40;</span>connStr<span style="color: black;">&#41;</span>
conn.<span style="color: black;">Open</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
<span style="color: #dc143c;">cmd</span> = conn.<span style="color: black;">CreateCommand</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
<span style="color: #483d8b;">&quot;&quot;</span><span style="color: #483d8b;">&quot;
requires a table to be created named employee
with columns firstname and lastname
such as,
   CREATE TABLE employee (
      firstname varchar(32),
      lastname varchar(32));
&quot;</span><span style="color: #483d8b;">&quot;&quot;</span>
sql = <span style="color: #483d8b;">&quot;SELECT firstname, lastname FROM employee&quot;</span>
<span style="color: #dc143c;">cmd</span>.<span style="color: black;">CommandText</span> = sql
reader = <span style="color: #dc143c;">cmd</span>.<span style="color: black;">ExecuteReader</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
<span style="color: #ff7700;font-weight:bold;">while</span> reader.<span style="color: black;">Read</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>:
	firstName = reader<span style="color: black;">&#91;</span><span style="color: #483d8b;">&quot;firstname&quot;</span><span style="color: black;">&#93;</span>
	lastName = reader<span style="color: black;">&#91;</span><span style="color: #483d8b;">&quot;lastname&quot;</span><span style="color: black;">&#93;</span>
	Console.<span style="color: black;">WriteLine</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;Name: %s %s&quot;</span> % <span style="color: black;">&#40;</span>firstName, lastName<span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>;
&nbsp;
<span style="color: #808080; font-style: italic;"># clean up</span>
reader.<span style="color: black;">Close</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
reader = <span style="color: #008000;">None</span>
<span style="color: #dc143c;">cmd</span>.<span style="color: black;">Dispose</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
<span style="color: #dc143c;">cmd</span> = <span style="color: #008000;">None</span>
conn.<span style="color: black;">Close</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
conn = <span style="color: #008000;">None</span></pre>
<p>And walla! You have to admit, that is pretty awesome! We've got the power of simplicity from Python along with the power of .NET at our finger tips!</p>
<p>You can also import libs that you've gac'd (installed via gacutil) by replacing line 2 with <tt>clr.AddReference("MySql.Data")</tt> which might be more useful in some cases.</p>
<h3>Conclusion</h3>
<p>There's so much we can do with this such as prototype, making simple test cases, or even utilities for your .NET application. I've found this lots of fun and hope you do too. Stay tuned and keep your eyes peeled for another article on roasting the same blend of code with Jython!</p>
<p>Be sure to also take a look at these other links that might interest you as well!</p>
<ul>
<li><a href="http://lists.ironpython.com/listinfo.cgi/users-ironpython.com" title="IronPython Mailing List" target="_blank">IronPython Mailing List</a></li>
<li><a href="http://www.microsoft.com/silverlight/" title="Silverlight" target="_blank">Sliverlight</a></li>
<li><a href="http://www.asp.net/IronPython/" title="IronPython for ASP.NET" target="_blank">IronPython for ASP.NET</a></li>
<li><a href="http://www.ironpython.info/index.php" title="IronPython Cookbook" target="_blank">IronPython Cookbook</a></li>
<li><a href="http://www.codeplex.com/IronPython/Wiki/View.aspx?title=Samples&amp;referringTitle=Home" title="IronPython Samples" target="_blank">Samples from IronPython</a></li>
<li><a href="http://blogs.msdn.com/ironpython/" title="IronPython Blog" target="_blank">IronPython Blog</a></li>
<li><a href="http://www.codeplex.com/IronPython/Wiki/View.aspx?title=FAQ&amp;referringTitle=Home" title="IronPython FAQ" target="_blank">IronPython FAQ</a></li>
<li><a href="http://www.codeplex.com/IronPythonStudio" title="IronPythonStudio" target="_blank">IronPythonStudio</a></li>
<li><a href="http://www.richard-sumilang.com/blog/wp-admin/Python%20Programming%20Language" title="Python" target="_blank">Python Programming Language</a></li>
</ul>
<p class="addtoany_share_save">
    <a name="a2a_dd" onmouseover="a2a_show_dropdown(this)" onmouseout="a2a_onMouseOut_delay()" href="http://www.addtoany.com/bookmark?sitename=Richard%20Sumilang%27s%20Blog&amp;siteurl=http%3A%2F%2Fwww.richard-sumilang.com%2Fblog%2F&amp;linkname=Python%20and%20.NET%20playing%20together%21&amp;linkurl=http%3A%2F%2Fwww.richard-sumilang.com%2Fblog%2F2008%2F06%2F27%2Fpython-and-net-playing-together%2F"><img src="http://www.richard-sumilang.com/blog/wp-content/plugins/add-to-any/share_save_120_16.gif" width="120" height="16" border="0" alt="Share/Save/Bookmark"/></a>
    <script type="text/javascript">a2a_linkname="Python and .NET playing together!";a2a_linkurl="http://www.richard-sumilang.com/blog/2008/06/27/python-and-net-playing-together/";</script>
    <script type="text/javascript" src="http://www.addtoany.com/menu/page.js"></script>

	</p>]]></content:encoded>
			<wfw:commentRss>http://www.richard-sumilang.com/blog/2008/06/27/python-and-net-playing-together/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Firefox 3! Get it while it&#8217;s hot!</title>
		<link>http://www.richard-sumilang.com/blog/2008/06/17/firefox-3-get-it-while-its-hot/</link>
		<comments>http://www.richard-sumilang.com/blog/2008/06/17/firefox-3-get-it-while-its-hot/#comments</comments>
		<pubDate>Tue, 17 Jun 2008 19:28:43 +0000</pubDate>
		<dc:creator>Richard Sumilang</dc:creator>
		
		<category><![CDATA[Firefox]]></category>

		<category><![CDATA[beta]]></category>

		<category><![CDATA[download]]></category>

		<category><![CDATA[final]]></category>

		<category><![CDATA[firefox 3]]></category>

		<category><![CDATA[firefox is out]]></category>

		<category><![CDATA[get firefox now]]></category>

		<category><![CDATA[new version]]></category>

		<category><![CDATA[nightly tester]]></category>

		<category><![CDATA[plugin]]></category>

		<category><![CDATA[release candidate]]></category>

		<category><![CDATA[richard]]></category>

		<category><![CDATA[richard sumilang]]></category>

		<category><![CDATA[sumilang]]></category>

		<category><![CDATA[upgrade]]></category>

		<guid isPermaLink="false">http://www.richard-sumilang.com/blog/2008/06/17/firefox-3-get-it-while-its-hot/</guid>
		<description><![CDATA[Get it while its hot! ... or at least try  This morning when I woke up and started firefox I noticed it asking if I wanted to update to the latest version. Naturally I agreed but it failed to connect and download. I wonder if this is because a lot of people are trying [...]]]></description>
			<content:encoded><![CDATA[<p>Get it while its hot! ... or at least try <img src='http://www.richard-sumilang.com/blog/wp-includes/images/smilies/icon_razz.gif' alt=':-P' class='wp-smiley' /> This morning when I woke up and started firefox I noticed it asking if I wanted to update to the latest version. Naturally I agreed but it failed to connect and download. I wonder if this is because a lot of people are trying to download or they were in the process of still updating the their links? I tried to update my browser from work as well and had the same issue but fear less you can download it just find from the site <img src='http://www.richard-sumilang.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p><a href="http://www.getfirefox.com" alt="Get firefox now!" target="_blank">www.GetFirefox.com</a></p>
<p>New features include:</p>
<ul>
<li>Noticeable Speed Improvments</li>
<li>Better Security</li>
<li>Enhanced Productivity</li>
<li>More Customization</li>
</ul>
<p>... and more but you'll just have to download to see for yourself <img src='http://www.richard-sumilang.com/blog/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<p>Also for those of you not wanting to upgrade because your favorite plugins aren't compatible yet, well there is a solution... sorta... With the <a href="http://www.oxymoronical.com/web/firefox/nightly" target="_blank">nightly tester plugin</a> you can enable older Firefox plugins you have installed to work with your newer version of Firefox. There is no guarantee and you might experience some quirks since its meant only for development and testing purposes but I've enabled some older plugins for Firefox 2 and haven't noticed any problems but that doesn't mean you won't either. Just depends.</p>
<p>Anyways, Enjoy!</p>
<p class="addtoany_share_save">
    <a name="a2a_dd" onmouseover="a2a_show_dropdown(this)" onmouseout="a2a_onMouseOut_delay()" href="http://www.addtoany.com/bookmark?sitename=Richard%20Sumilang%27s%20Blog&amp;siteurl=http%3A%2F%2Fwww.richard-sumilang.com%2Fblog%2F&amp;linkname=Firefox%203%21%20Get%20it%20while%20it%E2%80%99s%20hot%21&amp;linkurl=http%3A%2F%2Fwww.richard-sumilang.com%2Fblog%2F2008%2F06%2F17%2Ffirefox-3-get-it-while-its-hot%2F"><img src="http://www.richard-sumilang.com/blog/wp-content/plugins/add-to-any/share_save_120_16.gif" width="120" height="16" border="0" alt="Share/Save/Bookmark"/></a>
    <script type="text/javascript">a2a_linkname="Firefox 3! Get it while it’s hot!";a2a_linkurl="http://www.richard-sumilang.com/blog/2008/06/17/firefox-3-get-it-while-its-hot/";</script>
    <script type="text/javascript" src="http://www.addtoany.com/menu/page.js"></script>

	</p>]]></content:encoded>
			<wfw:commentRss>http://www.richard-sumilang.com/blog/2008/06/17/firefox-3-get-it-while-its-hot/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Party at the Playboy Mansion!</title>
		<link>http://www.richard-sumilang.com/blog/2008/06/03/party-at-the-playboy-mansion/</link>
		<comments>http://www.richard-sumilang.com/blog/2008/06/03/party-at-the-playboy-mansion/#comments</comments>
		<pubDate>Wed, 04 Jun 2008 06:09:02 +0000</pubDate>
		<dc:creator>Richard Sumilang</dc:creator>
		
		<category><![CDATA[Other]]></category>

		<category><![CDATA[Richard-Sumilang.com]]></category>

		<category><![CDATA[big tits]]></category>

		<category><![CDATA[big titties]]></category>

		<category><![CDATA[boobs]]></category>

		<category><![CDATA[hot chicks]]></category>

		<category><![CDATA[hot playboy girls]]></category>

		<category><![CDATA[playboy]]></category>

		<category><![CDATA[playboy mansion]]></category>

		<category><![CDATA[richard]]></category>

		<category><![CDATA[richard sumilang]]></category>

		<category><![CDATA[spike.com]]></category>

		<category><![CDATA[spike.com launch party]]></category>

		<category><![CDATA[sumilang]]></category>

		<category><![CDATA[tits]]></category>

		<category><![CDATA[titties]]></category>

		<guid isPermaLink="false">http://www.richard-sumilang.com/blog/2008/06/03/party-at-the-playboy-mansion/</guid>
		<description><![CDATA[ Watcha know about that!?!?

Sorry! Had to brag. I know developer conferences are just as fun  
May 30th, 2008. Spike.com launch party at the Playboy Mansion!

    
    a2a_linkname="Party at the Playboy Mansion!";a2a_linkurl="http://www.richard-sumilang.com/blog/2008/06/03/party-at-the-playboy-mansion/";
    

	]]></description>
			<content:encoded><![CDATA[<p> Watcha know about that!?!?</p>
<p><a href="http://www.richard-sumilang.com/blog/2008/06/03/party-at-the-playboy-mansion/me-at-playboy-mansion-party/" rel="attachment wp-att-43" title="Me at Playboy Mansion party!"><img src="http://www.richard-sumilang.com/blog/wp-content/uploads/2008/06/img_0250.JPG" alt="Me at Playboy Mansion party!" /></a></p>
<p>Sorry! Had to brag. I know developer conferences are just as fun <img src='http://www.richard-sumilang.com/blog/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<p>May 30th, 2008. <a href="http://www.spike.com" target="_blank">Spike.com</a> launch party at the Playboy Mansion!</p>
<p class="addtoany_share_save">
    <a name="a2a_dd" onmouseover="a2a_show_dropdown(this)" onmouseout="a2a_onMouseOut_delay()" href="http://www.addtoany.com/bookmark?sitename=Richard%20Sumilang%27s%20Blog&amp;siteurl=http%3A%2F%2Fwww.richard-sumilang.com%2Fblog%2F&amp;linkname=Party%20at%20the%20Playboy%20Mansion%21&amp;linkurl=http%3A%2F%2Fwww.richard-sumilang.com%2Fblog%2F2008%2F06%2F03%2Fparty-at-the-playboy-mansion%2F"><img src="http://www.richard-sumilang.com/blog/wp-content/plugins/add-to-any/share_save_120_16.gif" width="120" height="16" border="0" alt="Share/Save/Bookmark"/></a>
    <script type="text/javascript">a2a_linkname="Party at the Playboy Mansion!";a2a_linkurl="http://www.richard-sumilang.com/blog/2008/06/03/party-at-the-playboy-mansion/";</script>
    <script type="text/javascript" src="http://www.addtoany.com/menu/page.js"></script>

	</p>]]></content:encoded>
			<wfw:commentRss>http://www.richard-sumilang.com/blog/2008/06/03/party-at-the-playboy-mansion/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
