<?xml version="1.0"?>
<rss version="2.0" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:media="http://search.yahoo.com/mrss/" xmlns:yt="http://gdata.youtube.com/schemas/2007">
   <channel>
      <title>Phnom Penh Developers</title>
      <description>Combined feed for developers in Phnom Penh, Cambodia</description>
      <link>http://pipes.yahoo.com/pipes/pipe.info?_id=KPESBeqH3RGbUmNUpgt1Yg</link>
      <pubDate>Sat, 21 Nov 2009 04:38:22 -0800</pubDate>
      <generator>http://pipes.yahoo.com/pipes/</generator>
      <item>
         <title>Solr</title>
         <link>http://samneang-ngeth.blogspot.com/2009/11/solr.html</link>
         <description>&lt;div style=&quot;width:425px;text-align:left;&quot; id=&quot;__ss_1996832&quot;&gt;&lt;a rel=&quot;nofollow&quot; style=&quot;font:14px Helvetica, Arial, Sans-serif;display:block;margin:12px 0 3px 0;text-decoration:underline;&quot; target=&quot;_blank&quot; href=&quot;http://www.slideshare.net/erikhatcher/solr-search-at-the-speed-of-light&quot; title=&quot;Solr: Search at the Speed of Light&quot;&gt;Solr: Search at the Speed of Light&lt;/a&gt;&lt;iframe class=&quot;embeddedvideo&quot; src=&quot;http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=solrspeedoflight-090914144133-phpapp01&amp;stripped_title=solr-search-at-the-speed-of-light&quot; type=&quot;application/x-shockwave-flash&quot; width=&quot;425&quot; height=&quot;355&quot;&gt;&lt;/iframe&gt;&lt;div style=&quot;font-size:11px;font-family:tahoma, arial;height:26px;padding-top:2px;&quot;&gt;View more &lt;a rel=&quot;nofollow&quot; style=&quot;text-decoration:underline;&quot; target=&quot;_blank&quot; href=&quot;http://www.slideshare.net/&quot;&gt;documents&lt;/a&gt; from &lt;a rel=&quot;nofollow&quot; style=&quot;text-decoration:underline;&quot; target=&quot;_blank&quot; href=&quot;http://www.slideshare.net/erikhatcher&quot;&gt;Erik Hatcher&lt;/a&gt;.&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;sudo rake solr:install&lt;br /&gt;&lt;br /&gt;1./ apt-get install tomcat5.5 libtomcat5.5-java tomcat5.5-admin tomcat5.5-webapps&lt;br /&gt;2./apt-get install solr-common solr-tomcat5.5 libxpp3-java&lt;br /&gt;3./ etc/init.d/tomcat5.5 restart&lt;br /&gt;&lt;br /&gt;java -jar start.jar&lt;br /&gt;&lt;br /&gt;Uninstall solr: sudo apt-get remove solr-tomcat5.5&lt;br /&gt;&lt;br /&gt;jar xvf filename to extract .war file&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/228218856178051930-750086823074240111?l=samneang-ngeth.blogspot.com' alt=''/&gt;&lt;/div&gt;</description>
         <author>nsamneang@gmail.com (samneang)</author>
         <guid isPermaLink="false">tag:blogger.com,1999:blog-228218856178051930.post-750086823074240111</guid>
         <pubDate>Tue, 10 Nov 2009 21:44:00 -0800</pubDate>
      </item>
      <item>
         <title>NHibernate + Mono + MySQL Fly by</title>
         <link>http://chornsokun.wordpress.com/2009/11/05/nhibernate-mono-mysql-fly-by/</link>
         <description>I thought about it and I want to see it works for me and there it goes ;) Ubuntu Karmic
Mono 2.4.3
NHibernate (trunk)
MySql connector-net (trunk) Sweet :) next rediscover Castle stack on Mono that should be fun let see how much I stress MonoDevelop 2.2 Tagged: Mono, MySql, NHibernate &lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://stats.wordpress.com/b.gif?host=chornsokun.wordpress.com&amp;blog=3780464&amp;post=566&amp;subd=chornsokun&amp;ref=&amp;feed=1&quot;/&gt;</description>
         <guid isPermaLink="false">http://chornsokun.wordpress.com/?p=566</guid>
         <pubDate>Thu, 05 Nov 2009 02:11:28 -0800</pubDate>
         <content:encoded><![CDATA[<div class='snap_preview'><br /><p>I thought about it and I want to see it works for me and there it goes ;)</p>
<ul>
<li>Ubuntu Karmic</li>
<li>Mono 2.4.3</li>
<li>NHibernate (trunk)</li>
<li>MySql connector-net (trunk)</li>
</ul>
<div id="attachment_567" class="wp-caption alignleft" style="width:710px;"><img class="size-full wp-image-567" title="NH1" src="http://chornsokun.files.wordpress.com/2009/11/nh1.png?w=700&#038;h=586" alt="NH1" width="700" height="586"/><p class="wp-caption-text">rebuild the stack for new home ;)</p></div>
<p>Sweet :) next rediscover Castle stack on Mono that should be fun let see how much I stress <a rel="nofollow" target="_blank" href="http://monodevelop.com/Download/What%27s_new_in_MonoDevelop_2.2">MonoDevelop 2.2</a></p> Tagged: Mono, MySql, NHibernate <a rel="nofollow" target="_blank" href="http://feeds.wordpress.com/1.0/gocomments/chornsokun.wordpress.com/566/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/chornsokun.wordpress.com/566/"/></a> <a rel="nofollow" target="_blank" href="http://feeds.wordpress.com/1.0/godelicious/chornsokun.wordpress.com/566/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/chornsokun.wordpress.com/566/"/></a> <a rel="nofollow" target="_blank" href="http://feeds.wordpress.com/1.0/gostumble/chornsokun.wordpress.com/566/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/chornsokun.wordpress.com/566/"/></a> <a rel="nofollow" target="_blank" href="http://feeds.wordpress.com/1.0/godigg/chornsokun.wordpress.com/566/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/chornsokun.wordpress.com/566/"/></a> <a rel="nofollow" target="_blank" href="http://feeds.wordpress.com/1.0/goreddit/chornsokun.wordpress.com/566/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/chornsokun.wordpress.com/566/"/></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=chornsokun.wordpress.com&blog=3780464&post=566&subd=chornsokun&ref=&feed=1"/></div>]]></content:encoded>
         <media:content url="http://1.gravatar.com/avatar/fc60b386b64b2b05c043d7676dde360e?s=96&amp;amp;d=&amp;amp;r=G" medium="image">
            <media:title>c.sokun</media:title>
         </media:content>
         <media:content url="http://chornsokun.files.wordpress.com/2009/11/nh1.png" medium="image">
            <media:title>NH1</media:title>
         </media:content>
      </item>
      <item>
         <title>Storm the Castle in Action</title>
         <link>http://chornsokun.wordpress.com/2009/10/23/storm-the-castle-in-action/</link>
         <description>felt bore today and decided to tune into studio and record some stuff :D hope you enjoy it. I know, I know the quality is bad but I don&amp;#8217;t know I am not do much with youtube so it the luck I get :) BUT as always orginal video can be download here.
Source code: http://storm-the-castle.googlecode.com/svn/tags/barcamppp Tagged: [...]&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://stats.wordpress.com/b.gif?host=chornsokun.wordpress.com&amp;blog=3780464&amp;post=557&amp;subd=chornsokun&amp;ref=&amp;feed=1&quot;/&gt;</description>
         <guid isPermaLink="false">http://chornsokun.wordpress.com/?p=557</guid>
         <pubDate>Fri, 23 Oct 2009 03:50:35 -0700</pubDate>
         <content:encoded><![CDATA[<div class='snap_preview'><br /><p>felt bore today and decided to tune into studio and record some stuff :D hope you enjoy it.</p>
<p><span style="text-align:center;display:block;"><a rel="nofollow" target="_blank" href="http://chornsokun.wordpress.com/2009/10/23/storm-the-castle-in-action/"><img src="http://img.youtube.com/vi/Tzj8sNUfANo/2.jpg" alt=""/></a></span></p>
<p>I know, I know the quality is bad but I don&#8217;t know I am not do much with youtube so it the luck I get :) BUT as always orginal video can be <a rel="nofollow" target="_blank" href="http://joljet.net/storm-the-castle-work-out.mp4">download here</a>.</p>
<p>Source code: <a rel="nofollow" target="_blank" href="http://storm-the-castle.googlecode.com/svn/tags/barcamppp">http://storm-the-castle.googlecode.com/svn/tags/barcamppp</a></p> Tagged: Screen <a rel="nofollow" target="_blank" href="http://feeds.wordpress.com/1.0/gocomments/chornsokun.wordpress.com/557/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/chornsokun.wordpress.com/557/"/></a> <a rel="nofollow" target="_blank" href="http://feeds.wordpress.com/1.0/godelicious/chornsokun.wordpress.com/557/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/chornsokun.wordpress.com/557/"/></a> <a rel="nofollow" target="_blank" href="http://feeds.wordpress.com/1.0/gostumble/chornsokun.wordpress.com/557/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/chornsokun.wordpress.com/557/"/></a> <a rel="nofollow" target="_blank" href="http://feeds.wordpress.com/1.0/godigg/chornsokun.wordpress.com/557/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/chornsokun.wordpress.com/557/"/></a> <a rel="nofollow" target="_blank" href="http://feeds.wordpress.com/1.0/goreddit/chornsokun.wordpress.com/557/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/chornsokun.wordpress.com/557/"/></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=chornsokun.wordpress.com&blog=3780464&post=557&subd=chornsokun&ref=&feed=1"/></div>]]></content:encoded>
         <media:content url="http://1.gravatar.com/avatar/fc60b386b64b2b05c043d7676dde360e?s=96&amp;amp;d=&amp;amp;r=G" medium="image">
            <media:title>c.sokun</media:title>
         </media:content>
         <media:content url="http://img.youtube.com/vi/Tzj8sNUfANo/2.jpg" medium="image"/>
         <enclosure length="12995519" url="http://joljet.net/storm-the-castle-work-out.mp4" type="video/mp4"/>
      </item>
      <item>
         <title>WIX Free Flash template design</title>
         <link>http://samneang-ngeth.blogspot.com/2009/10/wix-free-flash-template-design.html</link>
         <description>I have seen many free template websites but those are only for the normal webpage generated as HTML. This morning I've played around with &lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;http://www.wix.com&quot;&gt;WIX&lt;/a&gt; which allows me to create my flash website with many pretty templates. It's easy to customize and change everything.&lt;br /&gt;&lt;br /&gt; You can do it by yourself with &lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;http://www.wix.com&quot;&gt;www.wix.com&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Here is mine: &lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;http://www.wix.com/samneang/samneang&quot;&gt;www.wix.com/samneang/samneang&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;http://blog.aisleten.com/2007/04/14/getting-started-with-acts_as_solr/&quot;&gt;flash fly characters&lt;/a&gt; should be checked for it's flash animation.&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/228218856178051930-9021981604780064475?l=samneang-ngeth.blogspot.com' alt=''/&gt;&lt;/div&gt;</description>
         <author>nsamneang@gmail.com (samneang)</author>
         <guid isPermaLink="false">tag:blogger.com,1999:blog-228218856178051930.post-9021981604780064475</guid>
         <pubDate>Sun, 18 Oct 2009 21:01:00 -0700</pubDate>
      </item>
      <item>
         <title>Script Console Tricks</title>
         <link>http://feedproxy.google.com/~r/blogspot/chamnap/~3/bqcq5RV8aPE/script-console-tricks.html</link>
         <description>Script console in rails helps me very much to debug my applications. However, I usually encounter an annoying problem with ActiveRecord. I want to see the generated SQL that has been executed. I never have enough time to figure out this until last week. Just add the following code to your environment.rb, you could see the generated SQL statement.&lt;br /&gt;&lt;br /&gt;&lt;pre class=&quot;rails&quot;&gt;&lt;br /&gt;if &quot;irb&quot; == $0&lt;br /&gt; ActiveRecord::Base.logger = Logger.new(STDOUT) # ActiveRecord&lt;br /&gt; ActiveResource::Base.logger = Logger.new(STDOUT) # ActiveResource&lt;br /&gt;end&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;For more information:&lt;br /&gt;&lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;http://weblog.jamisbuck.org/2007/1/31/more-on-watching-activerecord&quot;&gt;http://weblog.jamisbuck.org/2007/1/31/more-on-watching-activerecord&lt;/a&gt;&lt;br /&gt;&lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;http://railscasts.com/episodes/48-console-tricks&quot;&gt;http://railscasts.com/episodes/48-console-tricks&lt;/a&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6761142148052793737-4360924167161407139?l=chamnapchhorn.blogspot.com' alt=''/&gt;&lt;/div&gt;&lt;img src=&quot;http://feeds.feedburner.com/~r/blogspot/chamnap/~4/bqcq5RV8aPE&quot; height=&quot;1&quot; width=&quot;1&quot;/&gt;</description>
         <author>chamnapchhorn@gmail.com (chamnap)</author>
         <guid isPermaLink="false">tag:blogger.com,1999:blog-6761142148052793737.post-4360924167161407139</guid>
         <pubDate>Wed, 14 Oct 2009 00:16:00 -0700</pubDate>
      </item>
      <item>
         <title>Testing ActiveResource</title>
         <link>http://samneang-ngeth.blogspot.com/2009/10/testing-activeresource.html</link>
         <description>I was suffered at the begining of this testing but later I've found some sample ways to solve it.&lt;br /&gt;&lt;br /&gt;&lt;code&gt; //Testing with mocking object's method&lt;br /&gt; //Sample structure of HttpMock: mock.http_method(path, request_headers = {}, body = nil, status = 200, response_headers = {})&lt;br /&gt;&lt;br /&gt; def setup&lt;br /&gt; @matz = { :id =&amp;gt; 1, :name =&amp;gt; &quot;Matz&quot; }.to_xml(:root =&amp;gt; &quot;person&quot;)&lt;br /&gt; ActiveResource::HttpMock.respond_to do |mock|&lt;br /&gt; mock.post &quot;/people.xml&quot;, {}, @matz, 201, &quot;Location&quot; =&amp;gt; &quot;/people/1.xml&quot;&lt;br /&gt; mock.get &quot;/people/1.xml&quot;, {}, @matz&lt;br /&gt; mock.put &quot;/people/1.xml&quot;, {}, nil, 204&lt;br /&gt; mock.delete &quot;/people/1.xml&quot;, {}, nil, 200&lt;br /&gt; end&lt;br /&gt; end&lt;br /&gt;&lt;br /&gt; def test_get_matz&lt;br /&gt; person = Person.find(1)&lt;br /&gt; assert_equal &quot;Matz&quot;, person.name&lt;br /&gt; end&lt;br /&gt;------------------------------------&lt;br /&gt;&lt;br /&gt; def setup&lt;br /&gt; @matz = { :id =&amp;gt; 1, :name =&amp;gt; &quot;Matz&quot; }.to_xml(:root =&amp;gt; &quot;person&quot;)&lt;br /&gt; ActiveResource::HttpMock.respond_to do |mock|&lt;br /&gt; mock.get &quot;/people/1.xml&quot;, {}, @matz&lt;br /&gt; end&lt;br /&gt; end&lt;br /&gt;&lt;br /&gt; def test_should_request_remote_service&lt;br /&gt; person = Person.find(1) # Call the remote service&lt;br /&gt;&lt;br /&gt; # This request object has the same HTTP method and path as declared by the mock&lt;br /&gt; expected_request = ActiveResource::Request.new(:get, &quot;/people/1.xml&quot;)&lt;br /&gt;&lt;br /&gt; # Assert that the mock received, and responded to, the expected request from the model&lt;br /&gt; assert ActiveResource::HttpMock.requests.include?(expected_request)&lt;br /&gt; end&lt;br /&gt;------------------------------------&lt;br /&gt;&lt;br /&gt; def test_delete&lt;br /&gt; assert Person.delete(1)&lt;br /&gt; ActiveResource::HttpMock.respond_to do |mock|&lt;br /&gt; mock.get &quot;/people/1.xml&quot;, {}, nil, 404&lt;br /&gt; end&lt;br /&gt; assert_raises(ActiveResource::ResourceNotFound) { Person.find(1) }&lt;br /&gt; end&lt;br /&gt;------------------------------------&lt;br /&gt;&lt;br /&gt; @matz = { :id =&amp;gt; 1, :name =&amp;gt; 'Matz' }.to_xml(:root =&amp;gt; 'person')&lt;br /&gt; ActiveResource::HttpMock.respond_to do |mock|&lt;br /&gt; mock.get &quot;/people/1.xml&quot;, {}, @matz&lt;br /&gt; end&lt;br /&gt;&lt;br /&gt; //Testing by deleting the record and return RecordNotFound(404)&lt;br /&gt; def test_delete&lt;br /&gt; assert Person.delete(1)&lt;br /&gt; ActiveResource::HttpMock.respond_to do |mock|&lt;br /&gt; mock.get &quot;/people/1.xml&quot;, {}, nil, 404&lt;br /&gt; end&lt;br /&gt; assert_raises(ActiveResource::ResourceNotFound) { Person.find(1) }&lt;br /&gt; end&lt;br /&gt;&lt;br /&gt;&lt;/code&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/228218856178051930-2644264425737847455?l=samneang-ngeth.blogspot.com' alt=''/&gt;&lt;/div&gt;</description>
         <author>nsamneang@gmail.com (samneang)</author>
         <guid isPermaLink="false">tag:blogger.com,1999:blog-228218856178051930.post-2644264425737847455</guid>
         <pubDate>Thu, 08 Oct 2009 19:09:00 -0700</pubDate>
      </item>
      <item>
         <title>My Presentation at Barcamp Phnom Penh 2009</title>
         <link>http://feedproxy.google.com/~r/blogspot/chamnap/~3/_5pkPuLAdIY/my-presentation-at-barcamp-phnom-penh.html</link>
         <description>I did two presentations at Barcampp in last week. One is for people who starts learning about the web. I talked on many basic concepts, the history, and how the web works. Some of friends complained me that my slide is too much. Anyway, I think I missed several main points. I just feel it is a prime concept of the web, and it drives me really well since I started learning it. The other is about JavaScript in OOP way. It is the same topic but very compact as I used to do presentation in my office. I did fairly good with borey since some of the audiences interest my presentation.&lt;br /&gt;&lt;br /&gt;&lt;div style=&quot;width:425px;text-align:left;&quot; id=&quot;__ss_2046225&quot;&gt;&lt;a rel=&quot;nofollow&quot; style=&quot;font:14px Helvetica, Arial, Sans-serif;display:block;margin:12px 0 3px 0;text-decoration:underline;&quot; target=&quot;_blank&quot; href=&quot;http://www.slideshare.net/cchamnap/introduction-to-web-architecture&quot; title=&quot;Introduction to Web Architecture&quot;&gt;Introduction to Web Architecture&lt;/a&gt;&lt;iframe class=&quot;embeddedvideo&quot; src=&quot;http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=introductiontowebarchitecture-090922221506-phpapp01&amp;stripped_title=introduction-to-web-architecture&quot; type=&quot;application/x-shockwave-flash&quot; width=&quot;425&quot; height=&quot;355&quot;&gt;&lt;/iframe&gt;&lt;div style=&quot;font-size:11px;font-family:tahoma, arial;height:26px;padding-top:2px;&quot;&gt;View more &lt;a rel=&quot;nofollow&quot; style=&quot;text-decoration:underline;&quot; target=&quot;_blank&quot; href=&quot;http://www.slideshare.net/&quot;&gt;presentations&lt;/a&gt; from &lt;a rel=&quot;nofollow&quot; style=&quot;text-decoration:underline;&quot; target=&quot;_blank&quot; href=&quot;http://www.slideshare.net/cchamnap&quot;&gt;cchamnap&lt;/a&gt;.&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6761142148052793737-419767841573897220?l=chamnapchhorn.blogspot.com' alt=''/&gt;&lt;/div&gt;&lt;img src=&quot;http://feeds.feedburner.com/~r/blogspot/chamnap/~4/_5pkPuLAdIY&quot; height=&quot;1&quot; width=&quot;1&quot;/&gt;</description>
         <author>chamnapchhorn@gmail.com (chamnap)</author>
         <guid isPermaLink="false">tag:blogger.com,1999:blog-6761142148052793737.post-419767841573897220</guid>
         <pubDate>Wed, 07 Oct 2009 21:26:00 -0700</pubDate>
         <enclosure length="121655" url="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=introductiontowebarchitecture-090922221506-phpapp01&amp;stripped_title=introduction-to-web-architecture" type="application/x-shockwave-flash"/>
      </item>
      <item>
         <title>HTTParty, Awesome_nested_set, rdoc option(s)</title>
         <link>http://samneang-ngeth.blogspot.com/2009/10/httparty.html</link>
         <description>For those who wanna use HTTParty well with RoR, you can follow this link: &lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;http://rdoc.info/projects/jnunemaker/httparty&quot;&gt;HTTParty&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Talking about listing data as Tree and easy to search, I would like to present you about &lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;http://wiki.github.com/collectiveidea/awesome_nested_set/awesome-nested-set-cheat-sheet&quot;&gt;awesome_nested_set&lt;/a&gt; which is cool.&lt;br /&gt;&lt;br /&gt;It was not bad that some guys don't know how to generate their Rdoc as the whole structure after they generate it first time because they don't delete the doc folder when they wanna generate it as the whole again.&lt;br /&gt;To generate your RDoc without some specific folders or files you need to type as bellow:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;rdoc --exclude folder1 --exclude folder2 --exclude folder3&lt;/code&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/228218856178051930-4379173319569989688?l=samneang-ngeth.blogspot.com' alt=''/&gt;&lt;/div&gt;</description>
         <author>nsamneang@gmail.com (samneang)</author>
         <guid isPermaLink="false">tag:blogger.com,1999:blog-228218856178051930.post-4379173319569989688</guid>
         <pubDate>Wed, 07 Oct 2009 00:37:00 -0700</pubDate>
      </item>
      <item>
         <title>RESTful Pagination with Ruby on Rails</title>
         <link>http://samneang-ngeth.blogspot.com/2009/10/restful-pagination-with-ruby-on-rails.html</link>
         <description>Currently I'm working on RoR project and I've seen one plug-in call Will-paginate but it works well with ActiveRecord. There's one blog posts that it also work with ActiveResource but I'm not quiet clear about it. here is the link: &lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;http://blog.smartlogicsolutions.com/tag/rails-will_paginate-to_xml-activeresource/&quot;&gt;Will-paginate&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;But I've seen another web in &lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;http://stackoverflow.com/questions/776448/pagination-in-a-rest-web-application&quot;&gt;stackoverflow&lt;/a&gt; which also talk about the way to do pagination with REST. I think, I'll try with Stackoverflow first and combine with will-paginate by using ActiveRecord, otherwise I will use Will-paginate with both ActiveRecord and ActiveResource.&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/228218856178051930-1772743892862682740?l=samneang-ngeth.blogspot.com' alt=''/&gt;&lt;/div&gt;</description>
         <author>nsamneang@gmail.com (samneang)</author>
         <guid isPermaLink="false">tag:blogger.com,1999:blog-228218856178051930.post-1772743892862682740</guid>
         <pubDate>Mon, 05 Oct 2009 21:49:00 -0700</pubDate>
      </item>
      <item>
         <title>Gdo, Gazetteer Database Online</title>
         <link>http://chornsokun.wordpress.com/2009/10/02/gdo-gazetteer-database-online/</link>
         <description>There are 3/4 variants of the Cambodia Gazetteer after UNTAC created the list; now it time to put this mess to rest one and for all.
Ministry of Interior, Department of Local Administration currently setup a task force to reconsolidates the master list and make it an only office Gazetteer.
Now my colleague expected to write up a forward [...]&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://stats.wordpress.com/b.gif?host=chornsokun.wordpress.com&amp;blog=3780464&amp;post=538&amp;subd=chornsokun&amp;ref=&amp;feed=1&quot;/&gt;</description>
         <guid isPermaLink="false">http://chornsokun.wordpress.com/?p=538</guid>
         <pubDate>Thu, 01 Oct 2009 11:18:19 -0700</pubDate>
         <content:encoded><![CDATA[<div class='snap_preview'><br /><p><img class="alignleft size-full wp-image-539" title="Gazetteer Database Online" src="http://chornsokun.files.wordpress.com/2009/10/gazetteer.png?w=487&#038;h=575" alt="Gazetteer Database Online" width="487" height="575"/>There are 3/4 variants of the Cambodia Gazetteer after UNTAC created the list; now it time to put this mess to rest one and for all.</p>
<p>Ministry of Interior, Department of Local Administration currently setup a task force to reconsolidates the master list and make it an only office Gazetteer.</p>
<p>Now my colleague expected to write up a forward document about this project; which I&#8217;m not going to discuss here.</p>
<p>What you should know in the near future there is only one set of Cambodia Gazetteer and you can access it online absolutely free, so stay tune &#8230;</p>
<p>And you don&#8217;t have to guess how I built or when it goes live since I had 3 projects developed &amp; maintenance in parallel no doubt I no longer had time to enjoy playing JXII :(</p>
<p><strong><span style="text-decoration:underline;">Feature Highlight</span></strong>:</p>
<p>- Online browsing Province, District, Commune, Village meta data</p>
<p>- Province, District, Commune Map (produced by external consultant)</p>
<p>- Download Gazetteer data in Excel format for offline use.</p>
<p>I love this job ;)</p> Tagged: Cambodia, Gazetteer <a rel="nofollow" target="_blank" href="http://feeds.wordpress.com/1.0/gocomments/chornsokun.wordpress.com/538/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/chornsokun.wordpress.com/538/"/></a> <a rel="nofollow" target="_blank" href="http://feeds.wordpress.com/1.0/godelicious/chornsokun.wordpress.com/538/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/chornsokun.wordpress.com/538/"/></a> <a rel="nofollow" target="_blank" href="http://feeds.wordpress.com/1.0/gostumble/chornsokun.wordpress.com/538/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/chornsokun.wordpress.com/538/"/></a> <a rel="nofollow" target="_blank" href="http://feeds.wordpress.com/1.0/godigg/chornsokun.wordpress.com/538/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/chornsokun.wordpress.com/538/"/></a> <a rel="nofollow" target="_blank" href="http://feeds.wordpress.com/1.0/goreddit/chornsokun.wordpress.com/538/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/chornsokun.wordpress.com/538/"/></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=chornsokun.wordpress.com&blog=3780464&post=538&subd=chornsokun&ref=&feed=1"/></div>]]></content:encoded>
         <media:content url="http://1.gravatar.com/avatar/fc60b386b64b2b05c043d7676dde360e?s=96&amp;amp;d=&amp;amp;r=G" medium="image">
            <media:title>c.sokun</media:title>
         </media:content>
         <media:content url="http://chornsokun.files.wordpress.com/2009/10/gazetteer.png" medium="image">
            <media:title>Gazetteer Database Online</media:title>
         </media:content>
      </item>
      <item>
         <title>Use jQuery to catch and display MR AJAX errors</title>
         <link>http://chornsokun.wordpress.com/2009/10/02/use-jquery-to-catch-and-display-mr-ajax-errors/</link>
         <description>This post influenced Dave Ward&amp;#8217;s post to replicate the behavior that he discussed within MonoRail application. To mimic this behavior I created a method call RenderJsonError(Exception ex) inside my base controller (I want to reuse this method) public abstract class AbstractBaseController: ARSmartDispatcherController{ private void RenderJsonError(Exception ex){ CancelLayout(); [...]&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://stats.wordpress.com/b.gif?host=chornsokun.wordpress.com&amp;blog=3780464&amp;post=541&amp;subd=chornsokun&amp;ref=&amp;feed=1&quot;/&gt;</description>
         <guid isPermaLink="false">http://chornsokun.wordpress.com/?p=541</guid>
         <pubDate>Thu, 01 Oct 2009 10:58:56 -0700</pubDate>
         <content:encoded><![CDATA[<div class='snap_preview'><br /><p>This post influenced <a rel="nofollow" target="_blank" href="http://encosia.com/2009/03/04/use-jquery-to-catch-and-display-aspnet-ajax-service-errors/">Dave Ward&#8217;s post</a> to replicate the behavior that he discussed within MonoRail application. To mimic this behavior I created a method call RenderJsonError(Exception ex) inside my base controller (I want to reuse this method)</p>
<pre>
public abstract class AbstractBaseController: ARSmartDispatcherController{ private void RenderJsonError(Exception ex){ CancelLayout(); Response.StatusCode = 500; Response.ContentType = "application/json; charset=utf-8"; // I love this Framework :) var json = Context.Services.JSONSerializer.Serialize( new ErrorObject(){ Message = e.Message, StackTrace = e.StackTrace }); RenderText(json); }
}
</pre>
<p>From the code above look like I need to create a dummy DTO class ErrorObject and hand it over to JSONSerializer service instead of doing string escape/string concat myself :) MR use <em>Newtonsoft.Json.dll</em> behind the scene.</p>
<pre>
public abstract class AbstractBaseController: ARSmartDispatcherController{ .... internal class ErrorObject{ public string Message { get; set; } public string StackTrace { get; set; } }
}
</pre>
<p>Now let through some booms back to client</p>
<pre>
public class HomeController: AbstractBaseController{ public void Index(){ try{ throw new Exception("Boom ! boom !"); }catch(Exception ex){ RenderJsonError(ex); } }
}
</pre>
<p>That work ! however if you don&#8217;t want to deal with try{..} catch {..} then combine this technique with RescueAttribute describe in my <a rel="nofollow" target="_blank" href="http://chornsokun.wordpress.com/2009/10/01/monorail-irescuecontroller-handle-unexpected-exception/">previous post</a>.</p> Tagged: jQuery, JSON <a rel="nofollow" target="_blank" href="http://feeds.wordpress.com/1.0/gocomments/chornsokun.wordpress.com/541/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/chornsokun.wordpress.com/541/"/></a> <a rel="nofollow" target="_blank" href="http://feeds.wordpress.com/1.0/godelicious/chornsokun.wordpress.com/541/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/chornsokun.wordpress.com/541/"/></a> <a rel="nofollow" target="_blank" href="http://feeds.wordpress.com/1.0/gostumble/chornsokun.wordpress.com/541/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/chornsokun.wordpress.com/541/"/></a> <a rel="nofollow" target="_blank" href="http://feeds.wordpress.com/1.0/godigg/chornsokun.wordpress.com/541/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/chornsokun.wordpress.com/541/"/></a> <a rel="nofollow" target="_blank" href="http://feeds.wordpress.com/1.0/goreddit/chornsokun.wordpress.com/541/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/chornsokun.wordpress.com/541/"/></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=chornsokun.wordpress.com&blog=3780464&post=541&subd=chornsokun&ref=&feed=1"/></div>]]></content:encoded>
         <media:content url="http://1.gravatar.com/avatar/fc60b386b64b2b05c043d7676dde360e?s=96&amp;amp;d=&amp;amp;r=G" medium="image">
            <media:title>c.sokun</media:title>
         </media:content>
      </item>
      <item>
         <title>MonoRail, IRescueController Handle Unexpected Exception</title>
         <link>http://chornsokun.wordpress.com/2009/10/01/monorail-irescuecontroller-handle-unexpected-exception/</link>
         <description>By default you can intercept unexpected exceptional error occur in MonoRail you can opt to render a specific view from Views/Rescues folder or let MR pick standard one such as 404 page not found &amp;#8230;
How how about you want to log the exception then you need to build a custom controller class that implement IRescueController [...]&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://stats.wordpress.com/b.gif?host=chornsokun.wordpress.com&amp;blog=3780464&amp;post=531&amp;subd=chornsokun&amp;ref=&amp;feed=1&quot;/&gt;</description>
         <guid isPermaLink="false">http://chornsokun.wordpress.com/?p=531</guid>
         <pubDate>Wed, 30 Sep 2009 20:38:49 -0700</pubDate>
         <content:encoded><![CDATA[<div class='snap_preview'><br /><p>By default you can intercept unexpected exceptional error occur in MonoRail you can opt to render a specific view from Views/Rescues folder or let MR pick standard one such as 404 page not found &#8230;</p>
<p>How how about you want to log the exception then you need to build a custom controller class that implement IRescueController interface just like this:</p>
<pre>
public class RuntimeExceptionController : SmartDispatcherController, IRescueController
{ public void Rescue(Exception exception, IController controller, IControllerContext controllerContext) { // ... log via log4net ... // ... render &amp; send error back home :) whatever you find helpful }
} // usage: simple
[Rescue(typeof(RuntimeExceptionController))]
public class HomeController: SmartDispatcherController{ public void Index(){ throw new Exception("Boom !"); }
}
</pre> Tagged: IRescueController <a rel="nofollow" target="_blank" href="http://feeds.wordpress.com/1.0/gocomments/chornsokun.wordpress.com/531/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/chornsokun.wordpress.com/531/"/></a> <a rel="nofollow" target="_blank" href="http://feeds.wordpress.com/1.0/godelicious/chornsokun.wordpress.com/531/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/chornsokun.wordpress.com/531/"/></a> <a rel="nofollow" target="_blank" href="http://feeds.wordpress.com/1.0/gostumble/chornsokun.wordpress.com/531/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/chornsokun.wordpress.com/531/"/></a> <a rel="nofollow" target="_blank" href="http://feeds.wordpress.com/1.0/godigg/chornsokun.wordpress.com/531/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/chornsokun.wordpress.com/531/"/></a> <a rel="nofollow" target="_blank" href="http://feeds.wordpress.com/1.0/goreddit/chornsokun.wordpress.com/531/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/chornsokun.wordpress.com/531/"/></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=chornsokun.wordpress.com&blog=3780464&post=531&subd=chornsokun&ref=&feed=1"/></div>]]></content:encoded>
         <media:content url="http://1.gravatar.com/avatar/fc60b386b64b2b05c043d7676dde360e?s=96&amp;amp;d=&amp;amp;r=G" medium="image">
            <media:title>c.sokun</media:title>
         </media:content>
      </item>
      <item>
         <title>Khmer Localization with .NET</title>
         <link>http://chornsokun.wordpress.com/2009/10/01/khmer-localization-with-net/</link>
         <description>Localization in .NET doesn&amp;#8217;t seem to solve a lot of problem in theory but I get no luck to get it work, although I built a custom Culture and having the resource file embedded in the assembly it just WON&amp;#8217;T WORK !
After look around for solution I decided to give up and cheat a bit [...]&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://stats.wordpress.com/b.gif?host=chornsokun.wordpress.com&amp;blog=3780464&amp;post=527&amp;subd=chornsokun&amp;ref=&amp;feed=1&quot;/&gt;</description>
         <guid isPermaLink="false">http://chornsokun.wordpress.com/?p=527</guid>
         <pubDate>Wed, 30 Sep 2009 19:10:24 -0700</pubDate>
         <content:encoded><![CDATA[<div class='snap_preview'><br /><p>Localization in .NET doesn&#8217;t seem to solve a lot of problem in theory but I get no luck to get it work, although I built a custom Culture and having the resource file embedded in the assembly it just WON&#8217;T WORK !</p>
<p>After look around for solution I decided to give up and cheat a bit building localization engine from scratch is not too difficult but I tend not to spend my time on this yet.</p>
<p>So here is my way to have bilingual UI (Khmer &amp; English)<br />
<img class="alignnone size-full wp-image-528" title="resource" src="http://chornsokun.files.wordpress.com/2009/09/resource.jpg?w=220&#038;h=68" alt="resource" width="220" height="68"/></p>
<p>by faking treat fr-FR == km-KH and that work !</p>
<p>Never die with your tool, exercise your brain ;)</p> Tagged: ASP.NET, Localization <a rel="nofollow" target="_blank" href="http://feeds.wordpress.com/1.0/gocomments/chornsokun.wordpress.com/527/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/chornsokun.wordpress.com/527/"/></a> <a rel="nofollow" target="_blank" href="http://feeds.wordpress.com/1.0/godelicious/chornsokun.wordpress.com/527/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/chornsokun.wordpress.com/527/"/></a> <a rel="nofollow" target="_blank" href="http://feeds.wordpress.com/1.0/gostumble/chornsokun.wordpress.com/527/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/chornsokun.wordpress.com/527/"/></a> <a rel="nofollow" target="_blank" href="http://feeds.wordpress.com/1.0/godigg/chornsokun.wordpress.com/527/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/chornsokun.wordpress.com/527/"/></a> <a rel="nofollow" target="_blank" href="http://feeds.wordpress.com/1.0/goreddit/chornsokun.wordpress.com/527/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/chornsokun.wordpress.com/527/"/></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=chornsokun.wordpress.com&blog=3780464&post=527&subd=chornsokun&ref=&feed=1"/></div>]]></content:encoded>
         <media:content url="http://1.gravatar.com/avatar/fc60b386b64b2b05c043d7676dde360e?s=96&amp;amp;d=&amp;amp;r=G" medium="image">
            <media:title>c.sokun</media:title>
         </media:content>
         <media:content url="http://chornsokun.files.wordpress.com/2009/09/resource.jpg" medium="image">
            <media:title>resource</media:title>
         </media:content>
      </item>
      <item>
         <title>Rediscover WinForm, landing Alien base?</title>
         <link>http://chornsokun.wordpress.com/2009/09/29/rediscover-winform-landing-alien-base/</link>
         <description>Simple scenario each time a province change, district, commune &amp;#38; village will reset, not a big deal for me now a day to have this scenario on the web application but hey look it WinForm :( let see I started from Form Load event cbProvince combobox get binded then wire cbProvince with SelectedIndexChanged event handler to load [...]&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://stats.wordpress.com/b.gif?host=chornsokun.wordpress.com&amp;blog=3780464&amp;post=519&amp;subd=chornsokun&amp;ref=&amp;feed=1&quot;/&gt;</description>
         <guid isPermaLink="false">http://chornsokun.wordpress.com/?p=519</guid>
         <pubDate>Tue, 29 Sep 2009 08:50:08 -0700</pubDate>
         <content:encoded><![CDATA[<div class='snap_preview'><br /><p>Simple scenario each time a province change, district, commune &amp; village will reset, not a big deal for me now a day to have this scenario on the web application but hey look it WinForm :( let see</p>
<p><img class="size-full wp-image-520" title="Cascaded ComboBox Data Binding" src="http://chornsokun.files.wordpress.com/2009/09/combobox.jpg"/></p>
<p>I started from Form Load event cbProvince combobox get binded then wire cbProvince with SelectedIndexChanged event handler to load list of district into cbDistrict combobox and so on the code look more or less like this</p>
<pre> public void Form_Load(object sender, System.EventArgs e){ // binding cbProvince
} public void cbProvince_SelectedIndexChanged(object sender, EventArgs e){ //... binding the cbDistrict ComboBox using current selected value from cbProvince
} public void cbDistrict_SelectedIndexChanged(object sender, EventArgs e){ //... binding the cbCommune ComboBox using current selected value from cbDistrict
}
</pre>
<p>Sound good all event wired hit F5 to try out. Guess what happen? it slow &amp; AND finally throw an exception !!! but how? years passed and this behavior didn&#8217;t change a bit</p>
<pre>
// flag state
private bool formReady = false;
public void Form_Load(object sender, System.EventArgs e){ // binding cbProvince formReady = true;
} public void cbProvince_SelectedIndexChanged(object sender, EventArgs e){ if(!formReady) return; // this is the trick don't fire the event formReady = false; //... binding the cbDistrict ComboBox using current selected value from cbProvince formReady = true;
}
public void cbDistrict_SelectedIndexChanged(object sender, EventArgs e){ if(!formReady) return; // this is the trick don't fire the event formReady = false; //... binding the cbCommune ComboBox using current selected value from cbDistrict formReady = true;
}
</pre> Tagged: .NET, Binding, Cascade, ComboBox, WinForm <a rel="nofollow" target="_blank" href="http://feeds.wordpress.com/1.0/gocomments/chornsokun.wordpress.com/519/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/chornsokun.wordpress.com/519/"/></a> <a rel="nofollow" target="_blank" href="http://feeds.wordpress.com/1.0/godelicious/chornsokun.wordpress.com/519/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/chornsokun.wordpress.com/519/"/></a> <a rel="nofollow" target="_blank" href="http://feeds.wordpress.com/1.0/gostumble/chornsokun.wordpress.com/519/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/chornsokun.wordpress.com/519/"/></a> <a rel="nofollow" target="_blank" href="http://feeds.wordpress.com/1.0/godigg/chornsokun.wordpress.com/519/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/chornsokun.wordpress.com/519/"/></a> <a rel="nofollow" target="_blank" href="http://feeds.wordpress.com/1.0/goreddit/chornsokun.wordpress.com/519/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/chornsokun.wordpress.com/519/"/></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=chornsokun.wordpress.com&blog=3780464&post=519&subd=chornsokun&ref=&feed=1"/></div>]]></content:encoded>
         <media:content url="http://1.gravatar.com/avatar/fc60b386b64b2b05c043d7676dde360e?s=96&amp;amp;d=&amp;amp;r=G" medium="image">
            <media:title>c.sokun</media:title>
         </media:content>
         <media:content url="http://chornsokun.files.wordpress.com/2009/09/combobox.jpg" medium="image">
            <media:title>Cascaded ComboBox Data Binding</media:title>
         </media:content>
      </item>
      <item>
         <title>ActiveResource Error response</title>
         <link>http://samneang-ngeth.blogspot.com/2009/09/activeresource-error-response.html</link>
         <description>&lt;code&gt;* 200..399 - Valid response, no exception (other than 301, 302)&lt;br /&gt; * 301, 302 - ActiveResource::Redirection&lt;br /&gt; * 400 - ActiveResource::BadRequest&lt;br /&gt; * 401 - ActiveResource::UnauthorizedAccess&lt;br /&gt; * 403 - ActiveResource::ForbiddenAccess&lt;br /&gt; * 404 - ActiveResource::ResourceNotFound&lt;br /&gt; * 405 - ActiveResource::MethodNotAllowed&lt;br /&gt; * 409 - ActiveResource::ResourceConflict&lt;br /&gt; * 422 - ActiveResource::ResourceInvalid (rescued by save as validation errors)&lt;br /&gt; * 401..499 - ActiveResource::ClientError&lt;br /&gt; * 500..599 - ActiveResource::ServerError&lt;br /&gt; * Other - ActiveResource::ConnectionError&lt;br /&gt;&lt;/code&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/228218856178051930-6820835492625875427?l=samneang-ngeth.blogspot.com' alt=''/&gt;&lt;/div&gt;</description>
         <author>nsamneang@gmail.com (samneang)</author>
         <guid isPermaLink="false">tag:blogger.com,1999:blog-228218856178051930.post-6820835492625875427</guid>
         <pubDate>Mon, 28 Sep 2009 19:51:00 -0700</pubDate>
      </item>
      <item>
         <title>Sacla Function Literal</title>
         <link>http://sareuon.blogspot.com/2009/09/sacla-function-literal.html</link>
         <description>Scala is programming language for who have skill with java and ruby. With Scala you write small script to build larges system. Scala support full Functional Programming and pure OOP.&lt;br /&gt;Scala you can write down functions as unnamed literals and then pass them around as values(runtime).&lt;br /&gt;&lt;br /&gt;(x: Int, y: Int) =&amp;gt; x + y&lt;br /&gt;&lt;br /&gt;The =&amp;gt; designates that this function converts the thing on the left (any integer x,y) to the thing on the right (x + y).&lt;br /&gt;&lt;br /&gt;List(1,2,3).filter(x =&amp;gt; x % 2 == 1)&lt;input id=&quot;gwProxy&quot; type=&quot;hidden&quot;&gt;&lt;input id=&quot;jsProxy&quot; type=&quot;hidden&quot;&gt;&lt;div id=&quot;refHTML&quot;&gt;&lt;/div&gt;&lt;input id=&quot;gwProxy&quot; type=&quot;hidden&quot;&gt;&lt;input id=&quot;jsProxy&quot; type=&quot;hidden&quot;&gt;&lt;div id=&quot;refHTML&quot;&gt;&lt;/div&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2359002249313379007-20485044689730562?l=sareuon.blogspot.com'/&gt;&lt;/div&gt;</description>
         <author>noreply@blogger.com (Sareuon)</author>
         <guid isPermaLink="false">tag:blogger.com,1999:blog-2359002249313379007.post-20485044689730562</guid>
         <pubDate>Tue, 08 Sep 2009 18:18:00 -0700</pubDate>
      </item>
      <item>
         <title>Principles in Refactoring</title>
         <link>http://feedproxy.google.com/~r/blogspot/chamnap/~3/dNH6usJBVPo/principles-in-refactoring.html</link>
         <description>This week, in my office we did a study group, and vorleak and I were moderators in that session. We studied the book from Refactoring the Existing Code by Martin Fowler. Here is the slide I prepared.&lt;br /&gt;&lt;br /&gt;&lt;div style=&quot;width:425px;text-align:left;&quot; id=&quot;__ss_1961578&quot;&gt;&lt;a rel=&quot;nofollow&quot; style=&quot;font:14px Helvetica, Arial, Sans-serif;display:block;margin:12px 0 3px 0;text-decoration:underline;&quot; target=&quot;_blank&quot; href=&quot;http://www.slideshare.net/cchamnap/principles-in-refactoring&quot; title=&quot;Principles in Refactoring&quot;&gt;Principles in Refactoring&lt;/a&gt;&lt;iframe class=&quot;embeddedvideo&quot; src=&quot;http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=principlesinrefactoring-090906230021-phpapp01&amp;stripped_title=principles-in-refactoring&quot; type=&quot;application/x-shockwave-flash&quot; width=&quot;425&quot; height=&quot;355&quot;&gt;&lt;/iframe&gt;&lt;div style=&quot;font-size:11px;font-family:tahoma, arial;height:26px;padding-top:2px;&quot;&gt;View more &lt;a rel=&quot;nofollow&quot; style=&quot;text-decoration:underline;&quot; target=&quot;_blank&quot; href=&quot;http://www.slideshare.net/&quot;&gt;presentations&lt;/a&gt; from &lt;a rel=&quot;nofollow&quot; style=&quot;text-decoration:underline;&quot; target=&quot;_blank&quot; href=&quot;http://www.slideshare.net/cchamnap&quot;&gt;cchamnap&lt;/a&gt;.&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6761142148052793737-7037022000664296624?l=chamnapchhorn.blogspot.com' alt=''/&gt;&lt;/div&gt;&lt;img src=&quot;http://feeds.feedburner.com/~r/blogspot/chamnap/~4/dNH6usJBVPo&quot; height=&quot;1&quot; width=&quot;1&quot;/&gt;</description>
         <author>chamnapchhorn@gmail.com (chamnap)</author>
         <guid isPermaLink="false">tag:blogger.com,1999:blog-6761142148052793737.post-7037022000664296624</guid>
         <pubDate>Fri, 04 Sep 2009 21:33:00 -0700</pubDate>
         <enclosure length="121655" url="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=principlesinrefactoring-090906230021-phpapp01&amp;stripped_title=principles-in-refactoring" type="application/x-shockwave-flash"/>
      </item>
      <item>
         <title>Action Caching</title>
         <link>http://feedproxy.google.com/~r/blogspot/chamnap/~3/D6PVrxPAB2k/action-caching.html</link>
         <description>Recently, I have been working with RESTful web services. I came to a caching stage where I need to cache some requests that map to my actions. The problem is that I have actions with multiple possible routes, therefore those routes should be cached differently. For example:&lt;br /&gt;&lt;br /&gt;&lt;pre class=&quot;rails&quot;&gt;&lt;br /&gt;/people/1?display=details&lt;br /&gt;/people/1?display=summary&lt;br /&gt;/people/1?display=details&amp;format=xml&lt;br /&gt;/people/1?display=summary&amp;format=json&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Fortunately, there is an option inside caches_action called :cache_path. All you need to do is to pass a proc object and return the path you want to cache. It is called with the current controller instance. In this case,&lt;br /&gt;&lt;pre class=&quot;rails&quot;&gt;&lt;br /&gt; caches_action :index, :show, :cache_path =&amp;gt; Proc.new { |c|&lt;br /&gt; request_url = { :controller =&amp;gt; c.params[:controller], :action =&amp;gt; c.params[:action] }.merge(c.request.query_parameters)&lt;br /&gt; c.url_for request_url&lt;br /&gt; }&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;There is another problem when the request is coming without format, the cache returns the result with content-type: text/html. To solve this, add a before_filter inside application controller to assign the headers['Content-type'].&lt;br /&gt;&lt;br /&gt;&lt;pre class=&quot;rails&quot;&gt;&lt;br /&gt; def set_default_response_format&lt;br /&gt; response.headers['Content-type'] = 'application/xml; charset=utf-8' if params[:format].nil?&lt;br /&gt; end&lt;br /&gt;&lt;/pre&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6761142148052793737-5801985646602093655?l=chamnapchhorn.blogspot.com' alt=''/&gt;&lt;/div&gt;&lt;img src=&quot;http://feeds.feedburner.com/~r/blogspot/chamnap/~4/D6PVrxPAB2k&quot; height=&quot;1&quot; width=&quot;1&quot;/&gt;</description>
         <author>chamnapchhorn@gmail.com (chamnap)</author>
         <guid isPermaLink="false">tag:blogger.com,1999:blog-6761142148052793737.post-5801985646602093655</guid>
         <pubDate>Sat, 29 Aug 2009 01:29:00 -0700</pubDate>
      </item>
      <item>
         <title>MVC</title>
         <link>http://feedproxy.google.com/~r/blogspot/chamnap/~3/us9PXi00334/this-is-what-it-means-to-have.html</link>
         <description>Many Rails newcomers, even some people who know MVC quite well, often confuse how to code in the right way. The controller are usually fat, and the logic spreads across the whole application. The views still messy because it contains logic and even worse people often code like a controller (query to db). However, the model are usually skinny. I could say there is no restrictions in the way you code. It is a set of disciplines that every developers must know in order to have a cheaper maintenance.&lt;br /&gt;&lt;br /&gt;MVC has been successful for many reasons, and some of those reasons are “readability”, “maintainability”, “modularity”, and “separation of concerns”. You’d like your code to have those properties, right? The rules of thumb are:&lt;br /&gt;&lt;br /&gt;1. Controller should be skinny. This is what it means to have a controller know what to do without knowing the details of how to do it. &lt;br /&gt;2. Any complexity related to building a business logic will be specified and implemented in the Model.&lt;br /&gt;3. Inside View, access to instance variables that have been defined in Controller. Try not to use if-else condition or loop as much as possible.&lt;br /&gt;&lt;br /&gt;By putting everything in the right place, you would benefit from a lot of MVC pattern.&lt;br /&gt;&lt;br /&gt;Good example can be found on:&lt;br /&gt;&lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;http://www.therailsway.com/2007/6/1/railsconf-recap-skinny-controllers&quot;&gt;http://www.therailsway.com/2007/6/1/railsconf-recap-skinny-controllers&lt;/a&gt;&lt;br /&gt;&lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;http://weblog.jamisbuck.org/2006/10/18/skinny-controller-fat-model&quot;&gt;http://weblog.jamisbuck.org/2006/10/18/skinny-controller-fat-model&lt;/a&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6761142148052793737-1543620890150642532?l=chamnapchhorn.blogspot.com' alt=''/&gt;&lt;/div&gt;&lt;img src=&quot;http://feeds.feedburner.com/~r/blogspot/chamnap/~4/us9PXi00334&quot; height=&quot;1&quot; width=&quot;1&quot;/&gt;</description>
         <author>chamnapchhorn@gmail.com (chamnap)</author>
         <guid isPermaLink="false">tag:blogger.com,1999:blog-6761142148052793737.post-1543620890150642532</guid>
         <pubDate>Fri, 21 Aug 2009 19:30:00 -0700</pubDate>
      </item>
      <item>
         <title>My first time with Rails</title>
         <link>http://samneang-ngeth.blogspot.com/2009/08/my-first-time-with-rails.html</link>
         <description>&lt;code&gt;&lt;br /&gt;---------RSpec red/green/refactor&lt;br /&gt;module AccountExampleHelperMethods&lt;br /&gt; def helper_method&lt;br /&gt; …&lt;br /&gt; end&lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;shared_examples_for &quot;all editions&quot; do&lt;br /&gt; it &quot;should behave like all editions&quot; do&lt;br /&gt; end&lt;br /&gt;end&lt;br /&gt;describe &quot;SmallEdition&quot; do&lt;br /&gt; include AccountExampleHelperMethods&lt;br /&gt;&lt;br /&gt; helper_method&lt;br /&gt; it_should_behave_like &quot;all editions&quot;&lt;br /&gt; it &quot;should also behave like a small edition&quot; do&lt;br /&gt; end&lt;br /&gt;end&lt;br /&gt;---------&lt;br /&gt;rake db:create ..create database&lt;br /&gt;rake db:drop ..drop database&lt;br /&gt;rake db:sessions:clear ..empty sessions table&lt;br /&gt;rake db:migrate ..run db migrations&lt;br /&gt;rake db:migrate VERSION= ..rollback db&lt;br /&gt;rake rails:update:javascripts ..update javascript libraries&lt;br /&gt;rake routes ...list available routes in application&lt;br /&gt;&lt;br /&gt;gem server&lt;br /&gt;script/server&lt;br /&gt;script/console&lt;br /&gt;rake db:migrate&lt;br /&gt;rake db:fixtures:load&lt;br /&gt;rake spec:db:fixtures:load&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;script/generate rspec_model user&lt;br /&gt; -&amp;gt; create data in spec/fixtures/users.yml&lt;br /&gt; -&amp;gt; write our test in spec/models/user_spec.rb&lt;br /&gt;&lt;br /&gt;script/generate rspec_controller users&lt;br /&gt;&lt;/code&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/228218856178051930-5884342299799717317?l=samneang-ngeth.blogspot.com' alt=''/&gt;&lt;/div&gt;</description>
         <author>nsamneang@gmail.com (samneang)</author>
         <guid isPermaLink="false">tag:blogger.com,1999:blog-228218856178051930.post-5884342299799717317</guid>
         <pubDate>Thu, 20 Aug 2009 00:29:00 -0700</pubDate>
      </item>
      <item>
         <title>Install/uninstall rails with specific version</title>
         <link>http://samneang-ngeth.blogspot.com/2009/08/installuninstall-rails-with-specific.html</link>
         <description>&lt;code&gt;sudo gem uninstall rails&lt;br /&gt;sudo gem install -v=2.3.2 rails&lt;br /&gt;&lt;br /&gt;sudo aptitude remove rake&lt;br /&gt;sudo aptitude install git-core&lt;br /&gt;sudo gem install rake&lt;br /&gt;&lt;/code&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/228218856178051930-5665410721263594327?l=samneang-ngeth.blogspot.com' alt=''/&gt;&lt;/div&gt;</description>
         <author>nsamneang@gmail.com (samneang)</author>
         <guid isPermaLink="false">tag:blogger.com,1999:blog-228218856178051930.post-5665410721263594327</guid>
         <pubDate>Wed, 19 Aug 2009 18:38:00 -0700</pubDate>
      </item>
      <item>
         <title>Mulitple inheritance in RUBY</title>
         <link>http://samneang-ngeth.blogspot.com/2009/08/mulitple-inheritance-in-ruby.html</link>
         <description>Normally Ruby is a single inheritance language but you can do multiple inheritance by using Mix-ins which is the module that contains many classes inside or I can separate each classes in each modules as bellow then I include them in to wherever I want.&lt;br /&gt;======================================&lt;br /&gt;&lt;code&gt;module ToolBox&lt;br /&gt; class Ruler&lt;br /&gt; attr_accessor :length&lt;br /&gt; end&lt;br /&gt; def mesure&lt;br /&gt; @length = 10&lt;br /&gt; end&lt;br /&gt; def whatever&lt;br /&gt; ....&lt;br /&gt; end&lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;module Country&lt;br /&gt; class Ruler&lt;br /&gt; attr_accessor :name&lt;br /&gt; end&lt;br /&gt; def unit&lt;br /&gt; @type = 'meter'&lt;br /&gt; end&lt;br /&gt; def whatever&lt;br /&gt; ....&lt;br /&gt; end&lt;br /&gt;end&lt;/code&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/228218856178051930-3696973452681792278?l=samneang-ngeth.blogspot.com' alt=''/&gt;&lt;/div&gt;</description>
         <author>nsamneang@gmail.com (samneang)</author>
         <guid isPermaLink="false">tag:blogger.com,1999:blog-228218856178051930.post-3696973452681792278</guid>
         <pubDate>Wed, 05 Aug 2009 21:50:00 -0700</pubDate>
      </item>
      <item>
         <title>Announcing BarCamp Phnom Penh 2009</title>
         <link>http://groups.google.com/group/ppppkh/browse_thread/thread/d4c3b190151d05d6/70928e0e826bb6a1?show_docid=70928e0e826bb6a1</link>
         <author>Chantra</author>
         <guid isPermaLink="false">http://groups.google.com/group/ppppkh/browse_thread/thread/d4c3b190151d05d6/70928e0e826bb6a1?show_docid=70928e0e826bb6a1</guid>
         <pubDate>Tue, 04 Aug 2009 18:01:33 -0700</pubDate>
      </item>
      <item>
         <title>Sample of Ruby basic</title>
         <link>http://samneang-ngeth.blogspot.com/2009/08/sample-of-ruby-basic_05.html</link>
         <description>&lt;code&gt;stop_words = %w{the a by on for of are with just but and to the my I has some in}&lt;br /&gt;lines = File.readlines(&quot;text.txt&quot;)&lt;br /&gt;line_count = lines.size&lt;br /&gt;text = lines.join&lt;br /&gt;&lt;br /&gt;# Count the characters&lt;br /&gt;character_count = text.length&lt;br /&gt;character_count_nospaces = text.gsub(/&amp;#92;s+/, '').length&lt;br /&gt;&lt;br /&gt;# Count the words, sentences, and paragraphs&lt;br /&gt;word_count = text.split.length&lt;br /&gt;sentence_count = text.split(/&amp;#92;.|&amp;#92;?|!/).length&lt;br /&gt;paragraph_count = text.split(/&amp;#92;n&amp;#92;n/).length&lt;br /&gt;&lt;br /&gt;# Make a list of words in the text that aren't stop words,&lt;br /&gt;# count them, and work out the percentage of non-stop words&lt;br /&gt;# against all words&lt;br /&gt;all_words = text.scan(/&amp;#92;w+/)&lt;br /&gt;good_words = all_words.select{ |word| !stop_words.include?(word) }&lt;br /&gt;good_percentage = ((good_words.length.to_f / all_words.length.to_f) * 100).to_i&lt;br /&gt;&lt;br /&gt;# Summarize the text by cherry picking some choice sentences&lt;br /&gt;sentences = text.gsub(/&amp;#92;s+/, ' ').strip.split(/&amp;#92;.|&amp;#92;?|&amp;#92;!/)&lt;br /&gt;sentences_sorted = sentences.sort_by { |sentence| sentence.length }&lt;br /&gt;one_third = sentences_sorted.length / 3&lt;br /&gt;ideal_sentences = sentences_sorted.slice(one_third, one_third + 1)&lt;br /&gt;ideal_sentences = ideal_sentences.select { |sentence| sentence =~ /is|are/ }&lt;br /&gt;&lt;br /&gt;# Give the analysis back to the user&lt;br /&gt;puts &quot;#{line_count} lines&quot;&lt;br /&gt;puts &quot;#{character_count} characters&quot;&lt;br /&gt;puts &quot;#{character_count_nospaces} characters (excluding spaces)&quot;&lt;br /&gt;puts &quot;#{word_count} words&quot;&lt;br /&gt;puts &quot;#{sentence_count} sentences&quot;&lt;br /&gt;puts &quot;#{paragraph_count} paragraphs&quot;&lt;br /&gt;puts &quot;#{sentence_count / paragraph_count} sentences per paragraph (average)&quot;&lt;br /&gt;puts &quot;#{word_count / sentence_count} words per sentence (average)&quot;&lt;br /&gt;puts &quot;#{good_percentage}% of words are non-fluff words&quot;&lt;br /&gt;puts &quot;Summary:&amp;#92;n&amp;#92;n&quot; + ideal_sentences.join(&quot;. &quot;)&lt;br /&gt;puts &quot;-- End of analysis&quot;&lt;br /&gt;------------------RESULT&lt;br /&gt;121 lines&lt;br /&gt;6165 characters&lt;br /&gt;5055 characters (excluding spaces)&lt;br /&gt;1093 words&lt;br /&gt;18 paragraphs&lt;br /&gt;45 sentences&lt;br /&gt;2 sentences per paragraph (average)&lt;br /&gt;24 words per sentence (average)&lt;br /&gt;76% of words are non-fluff words&lt;br /&gt;Summary:&lt;br /&gt;' The surgeon leaned over the body, and raised the left hand. Think what it is&lt;br /&gt;to be a mother, there's a dear young lamb do. 'The old story,' he said, shaking&lt;br /&gt;his head: 'no wedding-ring, I see. What an excellent example of the power of&lt;br /&gt;dress, young Oliver Twist was. ' Apparently this consolatory perspective of a&lt;br /&gt;mother's prospects failed in producing its due effect. ' The surgeon had been&lt;br /&gt;sitting with his face turned towards the fire: giving the palms of his hands a&lt;br /&gt;warm and a rub alternately. ' 'You needn't mind sending up to me, if the child&lt;br /&gt;cries, nurse,' said the surgeon, putting on his gloves with great deliberation.&lt;br /&gt;She had walked some distance, for her shoes were worn to pieces; but where&lt;br /&gt;she came from, or where she was going to, nobody knows. ' He put on his hat,&lt;br /&gt;and, pausing by the bed-side on his way to the door, added, 'She was a&lt;br /&gt;good-looking girl, too; where did she come from&lt;br /&gt;-- End of analysis&lt;/code&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/228218856178051930-8148664783644016754?l=samneang-ngeth.blogspot.com' alt=''/&gt;&lt;/div&gt;</description>
         <author>nsamneang@gmail.com (samneang)</author>
         <guid isPermaLink="false">tag:blogger.com,1999:blog-228218856178051930.post-8148664783644016754</guid>
         <pubDate>Wed, 05 Aug 2009 00:40:00 -0700</pubDate>
      </item>
      <item>
         <title>Sample of Ruby basic</title>
         <link>http://samneang-ngeth.blogspot.com/2009/08/sample-of-ruby-basic.html</link>
         <description>&lt;code&gt;stop_words = %w{the a by on for of are with just but and to the my I has some in}&lt;br /&gt;lines = File.readlines(&quot;text.txt&quot;)&lt;br /&gt;line_count = lines.size&lt;br /&gt;text = lines.join&lt;br /&gt;&lt;br /&gt;# Count the characters&lt;br /&gt;character_count = text.length&lt;br /&gt;character_count_nospaces = text.gsub(/&amp;#92;s+/, '').length&lt;br /&gt;&lt;br /&gt;# Count the words, sentences, and paragraphs&lt;br /&gt;word_count = text.split.length&lt;br /&gt;sentence_count = text.split(/&amp;#92;.|&amp;#92;?|!/).length&lt;br /&gt;paragraph_count = text.split(/&amp;#92;n&amp;#92;n/).length&lt;br /&gt;&lt;br /&gt;# Make a list of words in the text that aren't stop words,&lt;br /&gt;# count them, and work out the percentage of non-stop words&lt;br /&gt;# against all words&lt;br /&gt;all_words = text.scan(/&amp;#92;w+/)&lt;br /&gt;good_words = all_words.select{ |word| !stop_words.include?(word) }&lt;br /&gt;good_percentage = ((good_words.length.to_f / all_words.length.to_f) * 100).to_i&lt;br /&gt;&lt;br /&gt;# Summarize the text by cherry picking some choice sentences&lt;br /&gt;sentences = text.gsub(/&amp;#92;s+/, ' ').strip.split(/&amp;#92;.|&amp;#92;?|&amp;#92;!/)&lt;br /&gt;sentences_sorted = sentences.sort_by { |sentence| sentence.length }&lt;br /&gt;one_third = sentences_sorted.length / 3&lt;br /&gt;ideal_sentences = sentences_sorted.slice(one_third, one_third + 1)&lt;br /&gt;ideal_sentences = ideal_sentences.select { |sentence| sentence =~ /is|are/ }&lt;br /&gt;&lt;br /&gt;# Give the analysis back to the user&lt;br /&gt;puts &quot;#{line_count} lines&quot;&lt;br /&gt;puts &quot;#{character_count} characters&quot;&lt;br /&gt;puts &quot;#{character_count_nospaces} characters (excluding spaces)&quot;&lt;br /&gt;puts &quot;#{word_count} words&quot;&lt;br /&gt;puts &quot;#{sentence_count} sentences&quot;&lt;br /&gt;puts &quot;#{paragraph_count} paragraphs&quot;&lt;br /&gt;puts &quot;#{sentence_count / paragraph_count} sentences per paragraph (average)&quot;&lt;br /&gt;puts &quot;#{word_count / sentence_count} words per sentence (average)&quot;&lt;br /&gt;puts &quot;#{good_percentage}% of words are non-fluff words&quot;&lt;br /&gt;puts &quot;Summary:&amp;#92;n&amp;#92;n&quot; + ideal_sentences.join(&quot;. &quot;)&lt;br /&gt;puts &quot;-- End of analysis&quot;&lt;br /&gt;------------------RESULT&lt;br /&gt;121 lines&lt;br /&gt;6165 characters&lt;br /&gt;5055 characters (excluding spaces)&lt;br /&gt;1093 words&lt;br /&gt;18 paragraphs&lt;br /&gt;45 sentences&lt;br /&gt;2 sentences per paragraph (average)&lt;br /&gt;24 words per sentence (average)&lt;br /&gt;76% of words are non-fluff words&lt;br /&gt;Summary:&lt;br /&gt;' The surgeon leaned over the body, and raised the left hand. Think what it is&lt;br /&gt;to be a mother, there's a dear young lamb do. 'The old story,' he said, shaking&lt;br /&gt;his head: 'no wedding-ring, I see. What an excellent example of the power of&lt;br /&gt;dress, young Oliver Twist was. ' Apparently this consolatory perspective of a&lt;br /&gt;mother's prospects failed in producing its due effect. ' The surgeon had been&lt;br /&gt;sitting with his face turned towards the fire: giving the palms of his hands a&lt;br /&gt;warm and a rub alternately. ' 'You needn't mind sending up to me, if the child&lt;br /&gt;cries, nurse,' said the surgeon, putting on his gloves with great deliberation.&lt;br /&gt;She had walked some distance, for her shoes were worn to pieces; but where&lt;br /&gt;she came from, or where she was going to, nobody knows. ' He put on his hat,&lt;br /&gt;and, pausing by the bed-side on his way to the door, added, 'She was a&lt;br /&gt;good-looking girl, too; where did she come from&lt;br /&gt;-- End of analysis&lt;/code&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/228218856178051930-4036452723259340608?l=samneang-ngeth.blogspot.com' alt=''/&gt;&lt;/div&gt;</description>
         <author>nsamneang@gmail.com (samneang)</author>
         <guid isPermaLink="false">tag:blogger.com,1999:blog-228218856178051930.post-4036452723259340608</guid>
         <pubDate>Wed, 05 Aug 2009 00:40:00 -0700</pubDate>
      </item>
      <item>
         <title>Ruby scan only useful/key words</title>
         <link>http://samneang-ngeth.blogspot.com/2009/08/ruby-scan-only-useful-words.html</link>
         <description>It maybe useful for me later to develop English testing system.&lt;br /&gt;======================================&lt;br /&gt;&lt;code&gt; text = %q{Los Angeles has some of the nicest weather in the country.}&lt;br /&gt; stop_words = %w{the a by on for of are with just but and to the my I has some}&lt;br /&gt; words = text.scan(/&amp;#92;w+/)&lt;br /&gt; key_words = words.select { |word| !stop_words.include?(word) }&lt;br /&gt; puts key_words.join(' ')&lt;br /&gt;&lt;/code&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/228218856178051930-6249094656446652547?l=samneang-ngeth.blogspot.com' alt=''/&gt;&lt;/div&gt;</description>
         <author>nsamneang@gmail.com (samneang)</author>
         <guid isPermaLink="false">tag:blogger.com,1999:blog-228218856178051930.post-6249094656446652547</guid>
         <pubDate>Tue, 04 Aug 2009 21:52:00 -0700</pubDate>
      </item>
      <item>
         <title>Hashes in Ruby</title>
         <link>http://samneang-ngeth.blogspot.com/2009/08/hashes-in-ruby.html</link>
         <description>It is just only one part of Ruby which I interested in and It is similar to JSON Object in JavaScript.&lt;br /&gt;======================================&lt;br /&gt;&lt;code&gt;people = {&lt;br /&gt; 'fred' =&amp;gt; {&lt;br /&gt; 'name' =&amp;gt; 'Fred Elliott',&lt;br /&gt; 'age' =&amp;gt; 63,&lt;br /&gt; 'gender' =&amp;gt; 'male',&lt;br /&gt; 'favorite painters' =&amp;gt; ['Monet', 'Constable', 'Da Vinci']&lt;br /&gt; },&lt;br /&gt; 'janet' =&amp;gt; {&lt;br /&gt; 'name' =&amp;gt; 'Janet S Porter',&lt;br /&gt; 'age' =&amp;gt; 55,&lt;br /&gt; 'gender' =&amp;gt; 'female'&lt;br /&gt; }&lt;br /&gt;}&lt;br /&gt;puts people['fred']['age']&lt;br /&gt;puts people['janet']['gender']&lt;br /&gt;puts people['janet'].inspect&lt;br /&gt;puts people['fred']['favorite painters'].length&lt;br /&gt;puts people['fred']['favorite painters'].join(&quot;, &quot;)&lt;br /&gt;&lt;br /&gt;-----------------Result&lt;br /&gt;63&lt;br /&gt;female&lt;br /&gt;{&quot;name&quot;=&amp;gt;&quot;Janet S Porter&quot;, &quot;gender&quot;=&amp;gt;&quot;female&quot;, &quot;age&quot;=&amp;gt;55}&lt;br /&gt;3&lt;br /&gt;Monet, Constable, Da Vinci&lt;br /&gt;-----------------&lt;/code&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/228218856178051930-6563766016865615701?l=samneang-ngeth.blogspot.com' alt=''/&gt;&lt;/div&gt;</description>
         <author>nsamneang@gmail.com (samneang)</author>
         <guid isPermaLink="false">tag:blogger.com,1999:blog-228218856178051930.post-6563766016865615701</guid>
         <pubDate>Tue, 04 Aug 2009 19:33:00 -0700</pubDate>
      </item>
      <item>
         <title>Update Ruby to version 1.8.7 in Ubuntu</title>
         <link>http://samneang-ngeth.blogspot.com/2009/08/update-ruby-to-version-187-in-ubuntu.html</link>
         <description>&lt;code&gt;$ sudo apt-get install build-essential libssl-dev libreadline5-dev zlib1g-dev&lt;br /&gt;$ wget ftp://ftp.ruby-lang.org/pub/ruby/1.8/ruby-1.8.7-p22.tar.gz&lt;br /&gt;$ tar zxvf ruby-1.8.7-p22.tar.gz&lt;br /&gt;$ cd ruby-1.8.7-p22&lt;br /&gt;$ ./configure --prefix=/usr/local --with-openssl-dir=/usr --with-readline-dir=/usr --with-zlib-dir=/usr&lt;br /&gt;$ make&lt;br /&gt;$ sudo make install&lt;br /&gt;&lt;br /&gt;$ which ruby&lt;br /&gt;/usr/local/bin/ruby&lt;br /&gt;$ ruby --version&lt;br /&gt;ruby 1.8.7 (2008-06-20 patchlevel 22) [i686-linux]&lt;br /&gt;$ ruby -ropenssl -rzlib -rreadline -e &quot;puts :success&quot;&lt;br /&gt;success&lt;/code&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/228218856178051930-6881970748068965026?l=samneang-ngeth.blogspot.com' alt=''/&gt;&lt;/div&gt;</description>
         <author>nsamneang@gmail.com (samneang)</author>
         <guid isPermaLink="false">tag:blogger.com,1999:blog-228218856178051930.post-6881970748068965026</guid>
         <pubDate>Mon, 03 Aug 2009 19:39:00 -0700</pubDate>
      </item>
      <item>
         <title>JavaScript Custom Event</title>
         <link>http://samneang-ngeth.blogspot.com/2009/07/javascript-custom-event.html</link>
         <description>&lt;code&gt;var CustomEvent = function(){&lt;br /&gt; //name of the event&lt;br /&gt; this.eventName = arguments[0];&lt;br /&gt; var mEventName = this.eventName;&lt;br /&gt;&lt;br /&gt; //function to call on event fire&lt;br /&gt; var eventAction = null;&lt;br /&gt;&lt;br /&gt; //subscribe a function to the event&lt;br /&gt; this.subscribe = function(fn){&lt;br /&gt; eventAction = fn;&lt;br /&gt; };&lt;br /&gt;&lt;br /&gt; //fire the event&lt;br /&gt; this.fire = function(sender, eventArgs){&lt;br /&gt; this.eventName = eventName2;&lt;br /&gt; if(eventAction != null){&lt;br /&gt; eventAction(sender, eventArgs);&lt;br /&gt; }&lt;br /&gt; else {&lt;br /&gt; alert('There was no function subscribed to the ' + mEventName + ' event!');&lt;br /&gt; }&lt;br /&gt; };&lt;br /&gt;};&lt;br /&gt;========= example&lt;br /&gt;var myEvent = new CustomEvent(&quot;my event&quot;);&lt;br /&gt;myEvent.subscribe(function(sender, eventArgs){&lt;br /&gt; alert(eventArgs.message);&lt;br /&gt;});&lt;br /&gt;========= Fire the event&lt;br /&gt;myEvent.fire(null, {&lt;br /&gt; message: 'you just witnessed the firing of a custom event called ' + this.eventName + '!'&lt;br /&gt;});&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;http://www.geekdaily.net/2008/04/02/javascript-defining-and-using-custom-events/&quot;&gt;Reference&lt;/a&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/228218856178051930-3401203239127632430?l=samneang-ngeth.blogspot.com' alt=''/&gt;&lt;/div&gt;</description>
         <author>nsamneang@gmail.com (samneang)</author>
         <guid isPermaLink="false">tag:blogger.com,1999:blog-228218856178051930.post-3401203239127632430</guid>
         <pubDate>Thu, 30 Jul 2009 20:47:00 -0700</pubDate>
      </item>
      <item>
         <title>jQuery.selectboxes removeOption()</title>
         <link>http://chornsokun.wordpress.com/2009/07/28/jquery-selectboxes-removeoption/</link>
         <description>Base on the doc page located here http://www.texotela.co.uk/code/jquery/select/ if I wanted to remove (clear) items from a select box all I need to do is call: $('#select_box').removeOption(/./); But in my case I had a select box like this: &amp;#60;select name=&amp;#34;select_box&amp;#34; id=&amp;#34;select_box&amp;#34;&amp;#62; &amp;#60;option value=&amp;#34;&amp;#34;&amp;#62;N/A&amp;#60;/option&amp;#62; &amp;#60;option value=&amp;#34;1&amp;#34;&amp;#62;Low&amp;#60;/option&amp;#62; &amp;#60;option value=&amp;#34;2&amp;#34;&amp;#62;Meduim&amp;#60;/option&amp;#62; [...]&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://stats.wordpress.com/b.gif?host=chornsokun.wordpress.com&amp;blog=3780464&amp;post=506&amp;subd=chornsokun&amp;ref=&amp;feed=1&quot;/&gt;</description>
         <guid isPermaLink="false">http://chornsokun.wordpress.com/?p=506</guid>
         <pubDate>Tue, 28 Jul 2009 01:58:46 -0700</pubDate>
         <content:encoded><![CDATA[<div class='snap_preview'><br /><p>Base on the doc page located here <a rel="nofollow" target="_blank" href="http://www.texotela.co.uk/code/jquery/select/">http://www.texotela.co.uk/code/jquery/select/</a> if I wanted to remove (clear) items from a select box all I need to do is call:</p>
<pre>
$('#select_box').removeOption(/./);
</pre>
<p>But in my case I had a select box like this:</p>
<pre>
&lt;select name="select_box" id="select_box"&gt; &lt;option value=""&gt;N/A&lt;/option&gt; &lt;option value="1"&gt;Low&lt;/option&gt; &lt;option value="2"&gt;Meduim&lt;/option&gt; &lt;option value="3"&gt;High&lt;/option&gt;
&lt;/select&gt;
</pre>
<p>and of cause the syntax specified above doesn&#8217;t do the trick; this is how I fix it:</p>
<pre>
$('#select_box').removeOption(/(.?)/);
</pre>
<p>Was that how it should be done? oh ! by the way the shorter way</p>
<pre>
$('#select_box').empty();
</pre> Tagged: jquery; selectboxes <a rel="nofollow" target="_blank" href="http://feeds.wordpress.com/1.0/gocomments/chornsokun.wordpress.com/506/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/chornsokun.wordpress.com/506/"/></a> <a rel="nofollow" target="_blank" href="http://feeds.wordpress.com/1.0/godelicious/chornsokun.wordpress.com/506/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/chornsokun.wordpress.com/506/"/></a> <a rel="nofollow" target="_blank" href="http://feeds.wordpress.com/1.0/gostumble/chornsokun.wordpress.com/506/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/chornsokun.wordpress.com/506/"/></a> <a rel="nofollow" target="_blank" href="http://feeds.wordpress.com/1.0/godigg/chornsokun.wordpress.com/506/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/chornsokun.wordpress.com/506/"/></a> <a rel="nofollow" target="_blank" href="http://feeds.wordpress.com/1.0/goreddit/chornsokun.wordpress.com/506/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/chornsokun.wordpress.com/506/"/></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=chornsokun.wordpress.com&blog=3780464&post=506&subd=chornsokun&ref=&feed=1"/></div>]]></content:encoded>
         <media:content url="http://1.gravatar.com/avatar/fc60b386b64b2b05c043d7676dde360e?s=96&amp;amp;d=&amp;amp;r=G" medium="image">
            <media:title>c.sokun</media:title>
         </media:content>
      </item>
      <item>
         <title>Weekend =&amp;gt; app.goLive ;)</title>
         <link>http://chornsokun.wordpress.com/2009/07/24/weekend-app-golive/</link>
         <description>Early this month I got into a busy schedule in order to release my new database application. I needed to run &amp;#38; check a final test, wrote up manual and do some paper work to invite my colleague across the country (2 staffs from each province X 24) to attend a 3 days training workshop [...]&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://stats.wordpress.com/b.gif?host=chornsokun.wordpress.com&amp;blog=3780464&amp;post=496&amp;subd=chornsokun&amp;ref=&amp;feed=1&quot;/&gt;</description>
         <guid isPermaLink="false">http://chornsokun.wordpress.com/?p=496</guid>
         <pubDate>Fri, 24 Jul 2009 01:59:21 -0700</pubDate>
         <content:encoded><![CDATA[<div class='snap_preview'><br /><p>Early this month I got into a busy schedule in order to release my new database application. I needed to run &amp; check a final test, wrote up manual and do some paper work to invite my colleague across the country (2 staffs from each province X 24) to attend a 3 days training workshop in total we get approximately 48 staffs which is too much for an IT training so we split it into 2 batches 12 provinces each.</p>
<p>In term of the actual database I allocated 2 days and for the first day of the training I leave it for general IT update lesson which include Khmer Unicode orientat<em>ion</em><em> </em><em>half morning,</em> and for that session alone I am very lucky to have <strong>Mr. CHEA Sok Huor</strong> a <em>Country Project Leader</em> from <a rel="nofollow" target="_blank" href="http://www.pancambodia.info">PAN</a> and his colleague came in for help. Without them I wouldn&#8217;t know where to get such precise Khmer Unicode Orientation somewhere else, so thank you from the deepest of my heart.</p>
<p>Oh! Talking about helping there is another gentle who I owe him as well, that gentle is <strong>Mr. Tuy Pheap</strong> my long colleague. We share room in the last 3 years before he moved on to his current job and come back to seat behind my back :) &#8220;Again :D&#8221;. I disturb him from time to time :D policing what my system do against his employer needs (the World Bank) not only that he also help me correct my Khmer Translation + Spelling :) and this phrase &#8220;ខ្ញុំយល់ហើយ!!!&#8221; for a button which in English say &#8220;I Understand&#8221; was his innovation :) let me tell you about this joke</p>
<blockquote><p>In our new application if there are any problems or errors detected a list of detail explanation will show up ( jQuery modal ) what I originally did was to have user click on &#8220;Ok&#8221; button to close the message. But without anything special user might just click &#8220;Ok&#8221; and go on &#8230; that not fun. So we came up with an idea instead of naming the button &#8220;Ok&#8221; we called it &#8220;I Understand&#8221; :))</p>
<p>And as a side effect during the training we forget to translate a few messages so default message showed. Since the user do not read English and he dare not click on the button to close the message :(</p></blockquote>
<p>I am glad with the result as it turn out and thanks to all the backend libraries that I used without them I wouldn&#8217;t know how much I would need to damage my brain cells to get this job done :)</p>
<p>What I used?</p>
<ul>
<li>NHibernate</li>
<li>Castle (MonoRail, ActiveRecord)</li>
<li>Rhino-Tool (Rhino.Security, Rhino.Common)</li>
<li>Oh ! ASP.NET for sure :) but I a brail devil don&#8217;t blame me for not using webform</li>
<li>Log4net</li>
<li>jQuery &amp; it plug-in(s)</li>
</ul>
<p>Challenges:</p>
<ul>
<li>For the past 5 years most of them get use to do data entry in desktop mode (VB6)</li>
<li>Some of them using the Internet for the first time; right this is (1==1).</li>
<li>The amount of data that we collect had increase 1.5X</li>
<li>More restriction in term of data modification &#8211; they used to have full control over there data and that cause me alot of headache over the past years.</li>
</ul>
<p>At the end of training session I got a request to setup a demo URL (<a rel="nofollow" target="_blank" href="http://db.ncdd.gov.kh/pid-train">http://db.ncdd.gov.kh/pid-train</a>) so that when participant get back to their duty province they can teach their colleague, by doing this I get a few additional feedback on how to improve the process of data entry as well as knowing how user interact with the application.</p>
<p>For sure: &#8220;No one is perfect&#8221; and &#8220;No software ever release bug free&#8221; as long as it could do it main job properly I would call it V1.</p>
<p>Now the weekend is coming I had to switch on actual URL and for that mean I had to copy a folder change connection string to get another URL up and running KOOL stuff ;)</p> Tagged: PID <a rel="nofollow" target="_blank" href="http://feeds.wordpress.com/1.0/gocomments/chornsokun.wordpress.com/496/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/chornsokun.wordpress.com/496/"/></a> <a rel="nofollow" target="_blank" href="http://feeds.wordpress.com/1.0/godelicious/chornsokun.wordpress.com/496/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/chornsokun.wordpress.com/496/"/></a> <a rel="nofollow" target="_blank" href="http://feeds.wordpress.com/1.0/gostumble/chornsokun.wordpress.com/496/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/chornsokun.wordpress.com/496/"/></a> <a rel="nofollow" target="_blank" href="http://feeds.wordpress.com/1.0/godigg/chornsokun.wordpress.com/496/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/chornsokun.wordpress.com/496/"/></a> <a rel="nofollow" target="_blank" href="http://feeds.wordpress.com/1.0/goreddit/chornsokun.wordpress.com/496/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/chornsokun.wordpress.com/496/"/></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=chornsokun.wordpress.com&blog=3780464&post=496&subd=chornsokun&ref=&feed=1"/></div>]]></content:encoded>
         <media:content url="http://1.gravatar.com/avatar/fc60b386b64b2b05c043d7676dde360e?s=96&amp;amp;d=&amp;amp;r=G" medium="image">
            <media:title>c.sokun</media:title>
         </media:content>
      </item>
      <item>
         <title>Sending mail to developer about exception errors</title>
         <link>http://feedproxy.google.com/~r/blogspot/chamnap/~3/8a-xdRT120k/sending-report-developer.html</link>
         <description>I want my application to send me a mail about any errors that occurs during production. Basically, I want to see a detail report like in development environment. All I have to do is to override &lt;code&gt;rescue_action_in_public&lt;/code&gt;. This method by default calls &lt;code&gt;render_optional_error_file&lt;/code&gt; method to render a static page based on status code thrown. &lt;code&gt;rescue_action_locally&lt;/code&gt; method by default will render details diagnostics from a controller action. Therefore, I just combine all of these methods into rescue_action_in_public and add some code to send mail.&lt;br /&gt;&lt;pre class=&quot;rails&quot;&gt;&lt;br /&gt;def rescue_action_in_public(exception)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;render_optional_error_file response_code_for_rescue(exception)&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;@template.instance_variable_set(&quot;@exception&quot;, exception)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;@template.instance_variable_set(&quot;@rescues_path&quot;, RESCUES_TEMPLATE_PATH)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;@template.instance_variable_set(&quot;@contents&quot;,&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;@template.render(:file =&amp;gt; template_path_for_local_rescue(exception)))&lt;br /&gt;&lt;br /&gt; # send mail to developers&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;mail = ExceptionNotifier.create_sent(@template)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;mail.set_content_type(&quot;text/html&quot;)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;ExceptionNotifier.deliver(mail)&lt;br /&gt;end&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Here is my ExceptionNotifier class, just extract needed variable to be available inside my view.&lt;br /&gt;&lt;pre class=&quot;rails&quot;&gt;&lt;br /&gt;class ExceptionNotifier &amp;lt; ActionMailer::Base&lt;br /&gt; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;def sent(template)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;@subject = 'Bug Reports'&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;@body[&quot;request&quot;] = template.request&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;@body[&quot;response&quot;] = template.response&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;@body[&quot;exception&quot;] = template.instance_variable_get(&quot;@exception&quot;)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;@body[&quot;rescues_path&quot;] = template.instance_variable_get(&quot;@rescues_path&quot;)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;@recipients = ['chamnapchhorn@gmail.com', 'ungsophy@gmail.com']&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;@from = 'noreply@gmail.com'&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;@headers = {}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;end&lt;br /&gt;&lt;br /&gt;end&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Here is my view, the default view for exception. I just change to locate new variables only.&lt;br /&gt;&lt;pre class=&quot;html&quot;&gt;&lt;br /&gt;&amp;lt;h1&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;%=h @exception.class.to_s %&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;% if @request.parameters['controller'] %&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;in &amp;lt;%=h @request.parameters['controller'].humanize %&amp;gt;Controller&amp;lt;% if @request.parameters['action'] %&amp;gt;#&amp;lt;%=h @request.parameters['action'] %&amp;gt;&amp;lt;% end %&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;% end %&amp;gt;&lt;br /&gt;&amp;lt;/h1&amp;gt;&lt;br /&gt;&amp;lt;pre&amp;gt;&amp;lt;%=h @exception.clean_message %&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;%= render :file =&amp;gt; @rescues_path[&quot;rescues/_trace.erb&quot;] %&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;%= render :file =&amp;gt; @rescues_path[&quot;rescues/_request_and_response.erb&quot;], :locals =&amp;gt; { :request =&amp;gt; @request, :response =&amp;gt; @response } %&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6761142148052793737-7544957222579683619?l=chamnapchhorn.blogspot.com' alt=''/&gt;&lt;/div&gt;&lt;img src=&quot;http://feeds.feedburner.com/~r/blogspot/chamnap/~4/8a-xdRT120k&quot; height=&quot;1&quot; width=&quot;1&quot;/&gt;</description>
         <author>chamnapchhorn@gmail.com (chamnap)</author>
         <guid isPermaLink="false">tag:blogger.com,1999:blog-6761142148052793737.post-7544957222579683619</guid>
         <pubDate>Tue, 21 Jul 2009 03:08:00 -0700</pubDate>
      </item>
      <item>
         <title>Function as Data in Javascript</title>
         <link>http://samneang-ngeth.blogspot.com/2009/07/function-as-data-in-javascript.html</link>
         <description>&lt;code&gt;function multiplyByTwo(a, b, c, callback){&lt;br /&gt; var i, ar = [];&lt;br /&gt; for(i = 0; i &amp;lt; 3; i++){&lt;br /&gt; ar[i] = callback(arguments[i] * 2);&lt;br /&gt; }&lt;br /&gt; return ar;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;function addOne(value){&lt;br /&gt; return value + 1;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;multiplyByTwo(2,4,6, addOne);&lt;/code&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/228218856178051930-1369614250000577293?l=samneang-ngeth.blogspot.com' alt=''/&gt;&lt;/div&gt;</description>
         <author>nsamneang@gmail.com (samneang)</author>
         <guid isPermaLink="false">tag:blogger.com,1999:blog-228218856178051930.post-1369614250000577293</guid>
         <pubDate>Sun, 19 Jul 2009 19:45:00 -0700</pubDate>
      </item>
      <item>
         <title>Handling Exception at the Application Level in Rails</title>
         <link>http://feedproxy.google.com/~r/blogspot/chamnap/~3/KZCvB5p8kak/handling-exception-at-application-level.html</link>
         <description>At last the point of the project, I found one more important thing that is quite useful and it could reduce the code 20%. That's when I did a handling service error on both server and client. I find myself have been repeating the code on the way. Luckily, after discussion with my colleague, I came up with idea to handle in application controller. It means that instead of handle exception on all of my controllers, I could just handle in a single place whenever exception has raised from these controllers.&lt;br /&gt;Basically, there are two methods (&lt;code&gt;rescue_action&lt;/code&gt; and &lt;code&gt;rescue_action_in_public&lt;/code&gt;) that you would need to override based on your needs. By default, these two methods do the best job to handle exception both in development and production mode. &lt;code&gt;rescue_action&lt;/code&gt; method will be called with an exception parameter that raises inside an action method. &lt;code&gt;rescue_action_in_public method&lt;/code&gt;, however, is used for public exception handling (for requests answering false to &lt;code&gt;local_request?&lt;/code&gt;). &lt;code&gt;local_request?&lt;/code&gt; method tells which rescue_*** method to call.&lt;br /&gt;&lt;br /&gt;&lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;http://api.rubyonrails.org/classes/ActionController/Rescue.html&quot;&gt;http://api.rubyonrails.org/classes/ActionController/Rescue.html&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;More importantly, we can handle exceptions for specific controller instead of the whole. All you need to do is to override one of these methods inside that controller.&lt;br /&gt;&lt;pre class=&quot;rails&quot;&gt;&lt;br /&gt;class PostsController &amp;lt; ApplicationController&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;def rescue_action_in_public(exception)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;case(exception)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;when ActiveRecord::RecordNotFound then render :file =&amp;gt; '/bad_record'&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;when NoMethodError then render :file =&amp;gt; '/no_method'&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;else render :file =&amp;gt; '/error'&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;end&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;end&lt;br /&gt;end&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;We can even handle them in a much cleaner way rather than if/else statement by using rescue_from. What it does is that it maps an exception type to handler method. This handler method can take either an exception parameter or a non-argument. We can even specify a proc or block.&lt;br /&gt;&lt;pre class=&quot;rails&quot;&gt;&lt;br /&gt;class PostsController &amp;lt; ApplicationController&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;# Declare exception to handler methods&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;rescue_from ActiveRecord::RecordNotFound, :with =&amp;gt; :bad_record&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;rescue_from NoMethodError, :with =&amp;gt; :show_error&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;def bad_record; render :file =&amp;gt; '/bad_record'; end&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;def show_error(exception); render :text =&amp;gt; exception.message; end&lt;br /&gt;&lt;br /&gt;end&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;http://ryandaigle.com/articles/2007/9/24/what-s-new-in-edge-rails-better-exception-handling&quot;&gt;http://ryandaigle.com/articles/2007/9/24/what-s-new-in-edge-rails-better-exception-handling&lt;/a&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6761142148052793737-2672112506476727939?l=chamnapchhorn.blogspot.com' alt=''/&gt;&lt;/div&gt;&lt;img src=&quot;http://feeds.feedburner.com/~r/blogspot/chamnap/~4/KZCvB5p8kak&quot; height=&quot;1&quot; width=&quot;1&quot;/&gt;</description>
         <author>chamnapchhorn@gmail.com (chamnap)</author>
         <guid isPermaLink="false">tag:blogger.com,1999:blog-6761142148052793737.post-2672112506476727939</guid>
         <pubDate>Fri, 10 Jul 2009 02:55:00 -0700</pubDate>
      </item>
      <item>
         <title>CSS float for firefox and IE</title>
         <link>http://samneang-ngeth.blogspot.com/2009/07/css-float-for-firefox-and-ie.html</link>
         <description>&lt;code&gt;Dom.styleFloat // for IE&lt;br /&gt;Dom.cssFloat // for firefox&lt;/code&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/228218856178051930-7610394620627300715?l=samneang-ngeth.blogspot.com' alt=''/&gt;&lt;/div&gt;</description>
         <author>nsamneang@gmail.com (samneang)</author>
         <guid isPermaLink="false">tag:blogger.com,1999:blog-228218856178051930.post-7610394620627300715</guid>
         <pubDate>Mon, 06 Jul 2009 01:39:00 -0700</pubDate>
      </item>
      <item>
         <title>PHP date diff</title>
         <link>http://chornsokun.wordpress.com/2009/07/04/php-date-diff/</link>
         <description>I call out for an excuse for not practicing PHP enough recent year; with just a simple date_diff could knock me out :) not to open my complain of having different version of PHP to check before using a function(s) I got a request from a friend to help workout how many days from two [...]&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://stats.wordpress.com/b.gif?host=chornsokun.wordpress.com&amp;blog=3780464&amp;post=492&amp;subd=chornsokun&amp;ref=&amp;feed=1&quot;/&gt;</description>
         <guid isPermaLink="false">http://chornsokun.wordpress.com/?p=492</guid>
         <pubDate>Fri, 03 Jul 2009 21:37:00 -0700</pubDate>
         <content:encoded><![CDATA[<div class='snap_preview'><br /><p>I call out for an excuse for not practicing PHP enough recent year; with just a simple date_diff could knock me out :) not to open my complain of having different version of PHP to check before using a function(s) I got a request from a friend to help workout how many days from two given date.</p>
<p>Now if I have two date string (it is what we get from form post right?)</p>
<pre>
// fixed format as I don't want to deal with complicate of different world format :(
$day1 = "26/03/2009";
$day2 = "28/03/2009";
// now I need to know how many days does it take from day1 to day2
// PHP 4.x; ignore my out of date PHP skill this is how I did it
$break_day1_apart = explode('/', $day1);
$break_day2_apart = explode('/', $day2);
$day1_number_form = $break_day1_apart[2].$break_day1_apart[1].$break_day1_apart[0];
$day2_number_form = $break_day2_apart[2].$break_day2_apart[1].$break_day2_apart[0]; $day_diff = abs((int)$day2_number_form - (int)$day1_number_form); // and it should work by theory
echo $day_diff; </pre>
<p>Suck ! what would you do instead? Tagged: PHP <a rel="nofollow" target="_blank" href="http://feeds.wordpress.com/1.0/gocomments/chornsokun.wordpress.com/492/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/chornsokun.wordpress.com/492/"/></a> <a rel="nofollow" target="_blank" href="http://feeds.wordpress.com/1.0/godelicious/chornsokun.wordpress.com/492/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/chornsokun.wordpress.com/492/"/></a> <a rel="nofollow" target="_blank" href="http://feeds.wordpress.com/1.0/gostumble/chornsokun.wordpress.com/492/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/chornsokun.wordpress.com/492/"/></a> <a rel="nofollow" target="_blank" href="http://feeds.wordpress.com/1.0/godigg/chornsokun.wordpress.com/492/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/chornsokun.wordpress.com/492/"/></a> <a rel="nofollow" target="_blank" href="http://feeds.wordpress.com/1.0/goreddit/chornsokun.wordpress.com/492/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/chornsokun.wordpress.com/492/"/></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=chornsokun.wordpress.com&blog=3780464&post=492&subd=chornsokun&ref=&feed=1"/></div>]]></content:encoded>
         <media:content url="http://1.gravatar.com/avatar/fc60b386b64b2b05c043d7676dde360e?s=96&amp;amp;d=&amp;amp;r=G" medium="image">
            <media:title>c.sokun</media:title>
         </media:content>
      </item>
      <item>
         <title>Maintaining Javascript Pop-Up Window Communication Across Window Opener Page Loads</title>
         <link>http://feedproxy.google.com/~r/blogspot/chamnap/~3/NCR2zrEr16s/maintaining-javascript-pop-up-window.html</link>
         <description>I came across a blog post that talks how to maintain a reference to javascript popup window while the parent window has been navigated away. This scenario doesn't want to reload the child popup window. I just quoted out from &lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;http://www.1pixelout.net/2006/12/15/cross-window-javascript-communication-20/&quot;&gt;1 Pixel Out&lt;/a&gt;. There is a really nick trick.&lt;br /&gt;&lt;br /&gt;In the main window:&lt;br /&gt;&lt;pre class=&quot;javascript&quot;&gt;&lt;br /&gt;var popupWin = null;&lt;br /&gt;&lt;br /&gt;function openPopup() {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;var url = &quot;popup.htm&quot;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;popupWin = open( &quot;&quot;, &quot;popupWin&quot;, &quot;width=500,height=400&quot; );&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;if( !popupWin || popupWin.closed || !popupWin.doSomething ) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;popupWin = window.open( url, &quot;popupWin&quot;, &quot;width=500,height=400&quot; );&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;} else {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;popupWin.focus();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;function doSomething() {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;openPopup();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;popupWin.doSomething();&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;In the popup:&lt;br /&gt;&lt;pre class=&quot;javascript&quot;&gt;&lt;br /&gt;self.focus();&lt;br /&gt;&lt;br /&gt;function doSomething() {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;alert(&quot;I'm doing something&quot;);&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;http://www.bennadel.com/blog/89-Maintaining-Javascript-Pop-Up-Window-Communication-Across-Window-Opener-Page-Loads.htm&quot;&gt;http://www.bennadel.com/blog/89-Maintaining-Javascript-Pop-Up-Window-Communication-Across-Window-Opener-Page-Loads.htm&lt;/a&gt;&lt;br /&gt;&lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;http://www.1pixelout.net/2005/04/19/cross-window-javascript-communication/&quot;&gt;http://www.1pixelout.net/2005/04/19/cross-window-javascript-communication/&lt;/a&gt;&lt;br /&gt;&lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;http://www.1pixelout.net/2006/12/15/cross-window-javascript-communication-20/&quot;&gt;http://www.1pixelout.net/2006/12/15/cross-window-javascript-communication-20/&lt;/a&gt;&lt;br /&gt;&lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;http://www.1pixelout.net/wp-content/downloads/popups20.zip&quot;&gt;http://www.1pixelout.net/wp-content/downloads/popups20.zip&lt;/a&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6761142148052793737-3156078894202383489?l=chamnapchhorn.blogspot.com' alt=''/&gt;&lt;/div&gt;&lt;img src=&quot;http://feeds.feedburner.com/~r/blogspot/chamnap/~4/NCR2zrEr16s&quot; height=&quot;1&quot; width=&quot;1&quot;/&gt;</description>
         <author>chamnapchhorn@gmail.com (chamnap)</author>
         <guid isPermaLink="false">tag:blogger.com,1999:blog-6761142148052793737.post-3156078894202383489</guid>
         <pubDate>Sat, 27 Jun 2009 04:05:00 -0700</pubDate>
         <enclosure length="1969" url="http://www.1pixelout.net/wp-content/downloads/popups20.zip" type="application/zip"/>
      </item>
      <item>
         <title>Cross-window Javascript communication</title>
         <link>http://feedproxy.google.com/~r/blogspot/chamnap/~3/armXt65b69s/cross-window-javascript-communication.html</link>
         <description>It reminds me about uploading via iframe that I did a year ago when my colleague asked me to help with login openid in a popup window. It's a similar story with this problem. Actually, login with openid could not place in a iframe because you could the code that prevents this.&lt;br /&gt;&lt;pre class=&quot;javascript&quot;&gt;&lt;br /&gt;&amp;lt;script type=&quot;text/javascript&quot;&amp;gt;if(top == self) { document.write(&quot;&quot;); } else { top.location.href = &quot;http://www.yahoo.com&quot;; }&amp;lt;/script&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Now, let's see a quick summary on this basic communication.&lt;br /&gt;&lt;br /&gt;Communication from parent to child window, you need to a reference of the child window so that can call any function in the child window.&lt;br /&gt;&lt;pre class=&quot;javascript&quot;&gt;&lt;br /&gt;// Create a new popup window&lt;br /&gt;var popupWin = window.open(url, &quot;popupWin&quot;);&lt;br /&gt;&lt;br /&gt;// To call functions defined in the popup:&lt;br /&gt;popupWin.doSomething();&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Communication from child to parent window, you need to use this way:&lt;br /&gt;&lt;pre class=&quot;javascript&quot;&gt;&lt;br /&gt;window.opener.doSomethingOnParent();&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Here is the problem, the parent window needs to know when the uploading (in iframe) or logging in (in popup window) is done. The only way that the parent window can notified by the child window after finish processing. Usually, for uploading and logging in with openid, the action in your controller would render a view back. The trick is here on the onload of the body, you could notify the parent window.&lt;br /&gt;&lt;pre class=&quot;rails&quot;&gt;&lt;br /&gt;def login&lt;br /&gt; @status = &quot;something&quot;&lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;#view&lt;br /&gt;&amp;lt;html&amp;gt;&amp;lt;head&amp;gt;&amp;lt;/head&amp;gt;&lt;br /&gt;&amp;lt;body onload=&quot;window.opener.handleOpenIDResponse('&quot; + @status + &quot;');window.close();&quot;&amp;gt;&lt;br /&gt;&amp;lt;/body&amp;gt;&lt;br /&gt;&amp;lt;/html&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;That would solve the problem, and you could send any information back through your view.&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6761142148052793737-8426930390371482210?l=chamnapchhorn.blogspot.com' alt=''/&gt;&lt;/div&gt;&lt;img src=&quot;http://feeds.feedburner.com/~r/blogspot/chamnap/~4/armXt65b69s&quot; height=&quot;1&quot; width=&quot;1&quot;/&gt;</description>
         <author>chamnapchhorn@gmail.com (chamnap)</author>
         <guid isPermaLink="false">tag:blogger.com,1999:blog-6761142148052793737.post-8426930390371482210</guid>
         <pubDate>Sat, 27 Jun 2009 00:10:00 -0700</pubDate>
      </item>
      <item>
         <title>Set class path for java:</title>
         <link>http://samneang-ngeth.blogspot.com/2009/06/set-class-path-for-java.html</link>
         <description>I almost forget how to run Java command outside Java's root folder, bin. Here are the steps to set class path for java.&lt;br /&gt;======================================&lt;br /&gt;&lt;code&gt;1./ Go into Advanced system settings in Control Panel/System&lt;br /&gt;2./ Click on Environment Variables&lt;br /&gt;3./ Click on New... to create &quot;JAVA_HOME&quot; with value &quot;C:&amp;#92;Program Files (x86)&amp;#92;Java&amp;#92;jdk1.6.0_02&quot;&lt;br /&gt;4./ Edit &quot;Path&quot; with value &quot;%JAVA_HOME%&amp;#92;BIN&quot;&lt;br /&gt;5./ Open your new CMD.&lt;br /&gt;&lt;br /&gt;Note: Each value in &quot;Path&quot; is seperated by &quot;;&quot;&lt;/code&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/228218856178051930-5355028689643312161?l=samneang-ngeth.blogspot.com' alt=''/&gt;&lt;/div&gt;</description>
         <author>nsamneang@gmail.com (samneang)</author>
         <guid isPermaLink="false">tag:blogger.com,1999:blog-228218856178051930.post-5355028689643312161</guid>
         <pubDate>Wed, 24 Jun 2009 00:19:00 -0700</pubDate>
      </item>
      <item>
         <title>TileCache with Geoserver</title>
         <link>http://samneang-ngeth.blogspot.com/2009/06/tilecache.html</link>
         <description>When we use many layers in one map, we should better use Tilecache which stores all of those images in temporary in local computer, hence our map will load much faster than normal. Here are some ways to configure Tilecache.&lt;br /&gt;======================================&lt;br /&gt;&lt;code&gt;1./ you need to have Apache server installed and make sure your Geoserver is available.&lt;br /&gt;&lt;br /&gt;2./ Define your temp folder to store those temporary images and your layers which is already generated from Geoserver in &quot;tilecache.cfg&quot;&lt;br /&gt;//temp folder&lt;br /&gt;[cache]&lt;br /&gt;type=Disk&lt;br /&gt;base= C:/temp/tilecache&lt;br /&gt;// layer from Geoserver&lt;br /&gt;[cambodia]&lt;br /&gt;type=WMS&lt;br /&gt;url=http://127.0.0.1:8080/geoserver/wms?transparent=true&lt;br /&gt;extension=png&lt;br /&gt;layers= mango:cam_DistrictCenter&lt;br /&gt;srs= EPSG:41001&lt;br /&gt;#metatile= yes&lt;br /&gt;metaBuffer=10&lt;br /&gt;metaSize=20,20&lt;br /&gt;&lt;br /&gt;3./ Define tilecache folder in &quot;httpd.conf&quot;&lt;br /&gt;&amp;lt;Directory C:&amp;#92;wamp&amp;#92;www&amp;#92;tilecache&amp;gt;&lt;br /&gt; AddHandler cgi-script .cgi&lt;br /&gt; Options +ExecCGI&lt;br /&gt;&amp;lt;/Directory&amp;gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Reference: &lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;http://tilecache.org/docs/README&quot;&gt;Tilecache's docs&lt;/a&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/228218856178051930-7340604941387077588?l=samneang-ngeth.blogspot.com' alt=''/&gt;&lt;/div&gt;</description>
         <author>nsamneang@gmail.com (samneang)</author>
         <guid isPermaLink="false">tag:blogger.com,1999:blog-228218856178051930.post-7340604941387077588</guid>
         <pubDate>Sun, 21 Jun 2009 18:44:00 -0700</pubDate>
      </item>
      <item>
         <title>has_and_belongs_to_many or has_many :through?</title>
         <link>http://feedproxy.google.com/~r/blogspot/chamnap/~3/xviTAcPEs2c/hasandbelongstomany-or-hasmany-through.html</link>
         <description>Well, I had been quite confusing about these two topics before I read some rails books. These are just different ways to do many to many relationships in ActiveRecord.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;has_and_belongs_to_many (habtm)&lt;/b&gt;&lt;br /&gt;habtm is the very old way since rails 1.2. It creates a link between associated models through an intermediate join table.&lt;br /&gt;&lt;pre class=&quot;rails&quot;&gt;&lt;br /&gt;class CreateProjectsProgrammers &amp;lt; ActiveRecord::Migration&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;def self.up&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;create_table :projects_programmers, :id =&amp;gt; false do |t|&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;t.column :project_id, :integer, :null =&amp;gt; false&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;t.column :programmer_id, :integer, :null =&amp;gt; false&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;end&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;end&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;def self.down&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;drop_table :projects_programmers&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;end&lt;br /&gt;end&lt;br /&gt;class Programmer &amp;lt; ActiveRecord::Base&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;has_and_belongs_to_many :projects # foreign keys in the join table&lt;br /&gt;end&lt;br /&gt;class Project &amp;lt; ActiveRecord::Base&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;has_and_belongs_to_many :programmers # foreign keys in the join table&lt;br /&gt;end&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Note that an id primary key is not needed in the join table and there is no join model, only join table. Here we will face a problem when we want to add extra columns on the join table. If it is in rails 1.2, we would have used &lt;code&gt;push_with_attributes&lt;/code&gt; to do this. However, &lt;code&gt;push_with_attributes&lt;/code&gt; has been deprecated in favor of a far more powerful technique, where regular Active Record models are used as join tables (remember that with habtm, the join table is not an Active Record object).&lt;br /&gt;&lt;br /&gt;To conclude, habtm is a simple way to do a many-to-many relationship using a join table when the join table doesn't have extra columns. You will need to upgrade the relationship to use &lt;code&gt;has_many :through&lt;/code&gt; once you need to add additional columns.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;has_many :through&lt;/b&gt;&lt;br /&gt;Records in the join table of habtm implementation has no independent existence. Later, we will find it very soon that the join table has a life of its own and should have a model when we add extra columns on that join table. Let's talk about relationship between article, user, and the join model is reading.&lt;br /&gt;&lt;br /&gt;When a user reads an article, we can record the fact.&lt;br /&gt;&lt;pre class=&quot;javascript&quot;&gt;&lt;br /&gt;class Article &amp;lt; ActiveRecord::Base&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;has_many :readings&lt;br /&gt;end&lt;br /&gt;class User &amp;lt; ActiveRecord::Base&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;has_many :readings&lt;br /&gt;end&lt;br /&gt;class Reading &amp;lt; ActiveRecord::Base&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;belongs_to :article&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;belongs_to :user&lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;reading = Reading.new&lt;br /&gt;reading.rating = params[:rating]&lt;br /&gt;reading.read_at = Time.now&lt;br /&gt;reading.article = current_article&lt;br /&gt;reading.user = session[:user]&lt;br /&gt;reading.save&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Here we lost what habtm solved. We could not ask a user which articles that they has read and vice versa. To solve this, use :through options inside has_many.&lt;br /&gt;&lt;pre class=&quot;javascript&quot;&gt;&lt;br /&gt;class Article &amp;lt; ActiveRecord::Base&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;has_many :readings&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;has_many :users, :through =&amp;gt; :readings&lt;br /&gt;end&lt;br /&gt;class Reading &amp;lt; ActiveRecord::Base&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;belongs_to :article&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;belongs_to :user&lt;br /&gt;end&lt;br /&gt;class User &amp;lt; ActiveRecord::Base&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;has_many :readings&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;has_many :articles, :through =&amp;gt; :readings&lt;br /&gt;end&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Now, you could do query both direction:&lt;br /&gt;&lt;pre class=&quot;javascript&quot;&gt;&lt;br /&gt;readers = an_article.users&lt;br /&gt;articles = a_reader.articles&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Unlike a normal has_many, ActiveRecord won’t let us add an object to the the has_many :through association if both ends of the relationship are unsaved records. The create method saves the record before adding it, so it does work as expected, provided the parent object isn’t unsaved itself. To add extra attributes:&lt;br /&gt;&lt;br /&gt;&lt;pre class=&quot;javascript&quot;&gt;&lt;br /&gt;user.readings.create(:read_at =&amp;gt; Time.now,&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;:rating =&amp;gt; params[:rating],&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;:article =&amp;gt; Article.new)&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Choosing which way to build a many-to-many relationship is not always simple. If you need to work with the relationship model as its own entity, use has_many :through. Use has_and_belongs_to_many when working with legacy schemas or when you never work directly with the relationship itself.&lt;br /&gt;&lt;br /&gt;&lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;http://blog.hasmanythrough.com/2006/4/20/many-to-many-dance-off&quot;&gt;http://blog.hasmanythrough.com/2006/4/20/many-to-many-dance-off&lt;/a&gt;&lt;br /&gt;&lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;http://blog.hasmanythrough.com/2006/4/17/join-models-not-proxy-collections&quot;&gt;http://blog.hasmanythrough.com/2006/4/17/join-models-not-proxy-collections&lt;/a&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6761142148052793737-8509927370996612874?l=chamnapchhorn.blogspot.com' alt=''/&gt;&lt;/div&gt;&lt;img src=&quot;http://feeds.feedburner.com/~r/blogspot/chamnap/~4/xviTAcPEs2c&quot; height=&quot;1&quot; width=&quot;1&quot;/&gt;</description>
         <author>chamnapchhorn@gmail.com (chamnap)</author>
         <guid isPermaLink="false">tag:blogger.com,1999:blog-6761142148052793737.post-8509927370996612874</guid>
         <pubDate>Thu, 18 Jun 2009 01:46:00 -0700</pubDate>
      </item>
      <item>
         <title>Artisteer</title>
         <link>http://samneang-ngeth.blogspot.com/2009/06/artisteer.html</link>
         <description>It is a cool program which helps you to design any website in a few minutes by some easy steps. I can only use Artisteer v2.1.0 since I haven't found the cracked for other versions yet. Artisteer supports either many technologies such as CodeCharge Studio4, WordPress(2.5-2.7), Joomla 1.5 and Drupal(5.x, 6.x) or Browsers like IE 6+, Firefox 2+, Opera 9+, Safari 1+ and Chrome 1+. You should watch it's &lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;http://www.artisteer.com/?p=demo&quot;&gt;demo&lt;/a&gt; then you will know how cool it is.&lt;br/&gt;&lt;br /&gt;Here are some steps to use Artisteer v2.1.0 without trial version:&lt;br /&gt;======================================&lt;br /&gt;1./ You must download Artisteer v2.1.0 by this url: &lt;br/&gt;&lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;http://download.cnet.com/Artisteer/3000-10247_4-10886734.html?part=dl-Artisteer&quot;&gt;Artisteer v2.1.0&lt;/a&gt; and install it.&lt;br/&gt;&lt;br /&gt;2./ Download this video which tells you how to remove trial: &lt;br/&gt;&lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;http://www.esnips.com/doc/7ee78388-91aa-4e2f-9fbc-7c6519f48e69/untrial.artisteer&quot;&gt;Untrial artisteer video&lt;/a&gt;&lt;br/&gt;&lt;br /&gt;3./ &lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;http://www.esnips.com/doc/781c3d45-34a3-4d44-bde9-baa730bc7e8d/art&quot;&gt;Bat file&lt;/a&gt; is the key file to remove it's trial.&lt;br/&gt;&lt;br /&gt;4./ &lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;http://www.esnips.com/doc/5069ee2c-65df-4f4b-8add-b8f2b649bb38/Artisteer2_User_Manual&quot;&gt; Artisteer's doc &lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;&lt;u&gt;Note&lt;/u&gt;&lt;/b&gt; You may not be able to view Artisteer's doc directly on the internet but you can download and view it in your own PC.&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/228218856178051930-3011747897659321197?l=samneang-ngeth.blogspot.com' alt=''/&gt;&lt;/div&gt;</description>
         <author>nsamneang@gmail.com (samneang)</author>
         <guid isPermaLink="false">tag:blogger.com,1999:blog-228218856178051930.post-3011747897659321197</guid>
         <pubDate>Fri, 05 Jun 2009 23:20:00 -0700</pubDate>
      </item>
      <item>
         <title>Proper use of session</title>
         <link>http://feedproxy.google.com/~r/blogspot/chamnap/~3/jcyT8Zbwd9A/proper-use-of-session.html</link>
         <description>Consider the following scenario, you want to store information about current user. After successful login, you might do this.&lt;br /&gt;&lt;pre class=&quot;javascript&quot;&gt;&lt;br /&gt;user = User.authenticate(params[:user_name], params[:password])&lt;br /&gt;if user&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;session[:current_user] = user.attributes&lt;br /&gt;else&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;flash[:notice] = &quot;Email and password do not match.&quot;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;redirect_to :controller =&amp;gt; &quot;login&quot;&lt;br /&gt;end&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Everything would work as you expected except when you try to change the structure of your session. This would make sessions of online users invalid while they are using your web application. For example, they will feel annoying while they are adding items to their wish lists. Another problem is that you want to make that session invalid after you delete that user account, for example. That won't work because you stored the entire record in his session. The only way to do is to add before_filter in application controller to check the existence of the current user. That would make another job to do it.&lt;br /&gt;&lt;br /&gt;The best practice is store only simple data in the session: strings, numbers, and so on. Keep your application objects in the database, and then reference them using their primary keys from the session data. &lt;br /&gt;&lt;pre class=&quot;javascript&quot;&gt;&lt;br /&gt;class ApplicationController &amp;lt; ActionController::Base&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;before_filter :get_current_user&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;private&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;def get_current_user&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;@current_user = User.find_by_id(session[:user_id])&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;end&lt;br /&gt;end&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Here you can access @current_user everywhere in your application and solve many issues during development.&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6761142148052793737-2856585702419930140?l=chamnapchhorn.blogspot.com' alt=''/&gt;&lt;/div&gt;&lt;img src=&quot;http://feeds.feedburner.com/~r/blogspot/chamnap/~4/jcyT8Zbwd9A&quot; height=&quot;1&quot; width=&quot;1&quot;/&gt;</description>
         <author>chamnapchhorn@gmail.com (chamnap)</author>
         <guid isPermaLink="false">tag:blogger.com,1999:blog-6761142148052793737.post-2856585702419930140</guid>
         <pubDate>Tue, 02 Jun 2009 18:23:00 -0700</pubDate>
      </item>
      <item>
         <title>Remote Desktop in Ubuntu</title>
         <link>http://samneang-ngeth.blogspot.com/2009/05/remote-desktop-in-ubuntu.html</link>
         <description>You will be able to remote other ubuntu desktop by this following command:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;vinagre 192.168.0.174&lt;/code&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/228218856178051930-4752149067999137305?l=samneang-ngeth.blogspot.com' alt=''/&gt;&lt;/div&gt;</description>
         <author>nsamneang@gmail.com (samneang)</author>
         <guid isPermaLink="false">tag:blogger.com,1999:blog-228218856178051930.post-4752149067999137305</guid>
         <pubDate>Wed, 27 May 2009 03:18:00 -0700</pubDate>
      </item>
      <item>
         <title>Javascript Unique Item in Array</title>
         <link>http://samneang-ngeth.blogspot.com/2009/05/javascript-unique-item-in-array.html</link>
         <description>After we follow this code bellow, we'll get tempArr[] which store unique items.&lt;br /&gt;Example: array[1,10,2,2,5,4,5,6,6,8,10,8] =&amp;gt; array[1,2,4,5,6,10,8]&lt;br /&gt;======================================&lt;br /&gt;&lt;code&gt;&lt;br /&gt;function contains(a, e) {&lt;br /&gt; for(j=0;j&amp;lt;a.length;j++)if(a[j]==e)return true;&lt;br /&gt; return false;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;if(!contains(tempArr, urlObj[i].group)){&lt;br /&gt; tempArr.length +=1;&lt;br /&gt; tempArr[tempArr.length-1] = urlObj[i].group;&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/228218856178051930-72763026050152164?l=samneang-ngeth.blogspot.com' alt=''/&gt;&lt;/div&gt;</description>
         <author>nsamneang@gmail.com (samneang)</author>
         <guid isPermaLink="false">tag:blogger.com,1999:blog-228218856178051930.post-72763026050152164</guid>
         <pubDate>Mon, 18 May 2009 02:00:00 -0700</pubDate>
      </item>
      <item>
         <title>Custom Rake Tasks</title>
         <link>http://feedproxy.google.com/~r/blogspot/chamnap/~3/xZG8Z0kQ_V4/custom-rake-tasks.html</link>
         <description>I came across to write a custom rake script for my rails application. Because my application is rich client side application and doesn't use id for any of my models. Instead, it used UUID as a primary key. I got some problems while changing this, and one of them is rails rake commands such as rake &lt;code&gt;db:test:prepare, rake test:functionals&lt;/code&gt;, .... For my application, these two commands didn't work really well since it makes my test database messed with autonumber id of all tables. Here, my rake script to load to my test database. Pay attention to mysql command, in this case, I need to run several commands inside mysql command.&lt;br /&gt;&lt;br /&gt;&lt;pre class=&quot;rails&quot;&gt;&lt;br /&gt; task :load_test_db do&lt;br /&gt; #load data to development&lt;br /&gt; Rake::Task[&quot;db:fixtures:load&quot;].invoke&lt;br /&gt; &lt;br /&gt; #clone development to test&lt;br /&gt; Rake::Task[&quot;db:test:clone_structure&quot;].invoke&lt;br /&gt; &lt;br /&gt; #pull data from development&lt;br /&gt; sh &quot;mysqldump &amp;gt; test.sql development_ncdd_templates -u root&quot;&lt;br /&gt;&lt;br /&gt; sh &quot;mysql -u root &amp;lt;&amp;lt; EOF&lt;br /&gt; use test_ncdd_templates;&lt;br /&gt; source test.sql;&lt;br /&gt; exit&lt;br /&gt; EOF&quot;&lt;br /&gt; end&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;If you want to run bash command, take this as an example. I'm not a expert of shell script, but it works for me anyway.&lt;br /&gt;&lt;br /&gt; sh &quot;#!/bin/bash&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;cd lib&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;ruby to_yml.rb&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;cd ..&quot;&lt;br /&gt;&lt;br /&gt;Here are some excellent sources:&lt;br /&gt;&lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;http://www.railsenvy.com/2007/6/11/ruby-on-rails-rake-tutorial&quot;&gt;http://www.railsenvy.com/2007/6/11/ruby-on-rails-rake-tutorial&lt;/a&gt;&lt;br /&gt;&lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;http://railscasts.com/episodes/66-custom-rake-tasks&quot;&gt;http://railscasts.com/episodes/66-custom-rake-tasks&lt;/a&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6761142148052793737-7762041590822974093?l=chamnapchhorn.blogspot.com' alt=''/&gt;&lt;/div&gt;&lt;img src=&quot;http://feeds.feedburner.com/~r/blogspot/chamnap/~4/xZG8Z0kQ_V4&quot; height=&quot;1&quot; width=&quot;1&quot;/&gt;</description>
         <author>chamnapchhorn@gmail.com (chamnap)</author>
         <guid isPermaLink="false">tag:blogger.com,1999:blog-6761142148052793737.post-7762041590822974093</guid>
         <pubDate>Wed, 13 May 2009 21:03:00 -0700</pubDate>
      </item>
      <item>
         <title>JavaScript in Object-Oriented Way</title>
         <link>http://feedproxy.google.com/~r/blogspot/chamnap/~3/i9A3dShRbxU/javascript-in-object-oriented-way.html</link>
         <description>I conducted a training to some developers in my office about one full day, yesterday. It is quite exhausted anyway, but everyone seems understand really well. This slide covers many advanced features of JavaScript: Function, Object, Closure,.... Some other points I have pointed out in this slide are about how to make private variable, public variable, static variable, privileged variable and how to do inheritance. I took about 20 different sources as my references and three famous authors. It took me two weeks, at every weekend, to finish this slide.&lt;br /&gt;&lt;br /&gt;&lt;div style=&quot;width:425px;text-align:left;&quot; id=&quot;__ss_1426608&quot;&gt;&lt;a rel=&quot;nofollow&quot; style=&quot;font:14px Helvetica, Arial, Sans-serif;display:block;margin:12px 0 3px 0;text-decoration:underline;&quot; target=&quot;_blank&quot; href=&quot;http://www.slideshare.net/cchamnap/javascript-in-objectoriented-way?type=powerpoint&quot; title=&quot;JavaScript in Object-Oriented Way&quot;&gt;JavaScript in Object-Oriented Way&lt;/a&gt;&lt;iframe class=&quot;embeddedvideo&quot; src=&quot;http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=javascriptinobject-orientedway-090512225827-phpapp02&amp;stripped_title=javascript-in-objectoriented-way&quot; type=&quot;application/x-shockwave-flash&quot; width=&quot;425&quot; height=&quot;355&quot;&gt;&lt;/iframe&gt;&lt;div style=&quot;font-size:11px;font-family:tahoma, arial;height:26px;padding-top:2px;&quot;&gt;View more &lt;a rel=&quot;nofollow&quot; style=&quot;text-decoration:underline;&quot; target=&quot;_blank&quot; href=&quot;http://www.slideshare.net/&quot;&gt;presentations&lt;/a&gt; from &lt;a rel=&quot;nofollow&quot; style=&quot;text-decoration:underline;&quot; target=&quot;_blank&quot; href=&quot;http://www.slideshare.net/cchamnap&quot;&gt;cchamnap&lt;/a&gt;.&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6761142148052793737-4515566835543181045?l=chamnapchhorn.blogspot.com' alt=''/&gt;&lt;/div&gt;&lt;img src=&quot;http://feeds.feedburner.com/~r/blogspot/chamnap/~4/i9A3dShRbxU&quot; height=&quot;1&quot; width=&quot;1&quot;/&gt;</description>
         <author>chamnapchhorn@gmail.com (chamnap)</author>
         <guid isPermaLink="false">tag:blogger.com,1999:blog-6761142148052793737.post-4515566835543181045</guid>
         <pubDate>Tue, 12 May 2009 20:59:00 -0700</pubDate>
         <enclosure length="121655" url="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=javascriptinobject-orientedway-090512225827-phpapp02&amp;stripped_title=javascript-in-objectoriented-way" type="application/x-shockwave-flash"/>
      </item>
      <item>
         <title>Selenium</title>
         <link>http://samneang-ngeth.blogspot.com/2009/05/selenium.html</link>
         <description>Selenium is a test tool that allows you to write automated web application UI tests in any programming language against any HTTP website using any mainstream JavaScript-enabled browser. &lt;br /&gt;======================================&lt;br /&gt;&lt;code&gt;1./ You need to have Ruby in your pc then install selenium by a command below.&lt;br /&gt;&lt;br /&gt;sudo gem install Selenium&lt;br /&gt;&lt;br /&gt;2./ cd to our JSSpec's path then run command below in order to access HTTP Server from that directory by default it's &quot;http://localhost:8000&quot;&lt;br /&gt;&lt;br /&gt;python -m SimpleHTTPServer&lt;br /&gt;&lt;br /&gt;3./ run you JSSpec file by putting it's name after the http's path above&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;i&gt;&lt;u&gt;Reference:&lt;/u&gt;&lt;br /&gt;&lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;http://bitbucket.org/ChrisInCambo/jsspec_ci/wiki/Home&quot;&gt;ChrisinCambo - jsspec_ci&lt;/a&gt;&lt;/i&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/228218856178051930-442228952784316244?l=samneang-ngeth.blogspot.com' alt=''/&gt;&lt;/div&gt;</description>
         <author>nsamneang@gmail.com (samneang)</author>
         <guid isPermaLink="false">tag:blogger.com,1999:blog-228218856178051930.post-442228952784316244</guid>
         <pubDate>Sat, 09 May 2009 21:11:00 -0700</pubDate>
      </item>
      <item>
         <title>JavaScript Mixins</title>
         <link>http://feedproxy.google.com/~r/blogspot/chamnap/~3/8DSAEbZeL1k/javascript-mixins.html</link>
         <description>I have just reviewed JavaScript Design Patterns, and I think it is good to mention this.&lt;br /&gt;&lt;br /&gt;It is possible to do a mixin class in JavaScript as in Ruby. This is another way to make our code reuse without inheritance. Consider you have a function, and you wish to use in many classes. In practice, you create a class that contains your general-purpose methods, and then use it to augment other classes. Class with these general-purpose methods is called Mixin class. It is generally not instantiated or called directly, instead it exists to provide methods to other classes.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;var Mixin = function() {};&lt;br /&gt;Mixin.prototype = {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;serialize: function() {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;var output = [];&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;for(key in this) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;output.push(key + ': ' + this[key]);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;return output.join(', ');&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;};&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;This sort of method could potentially be useful in many different types of classes, but it doesn’t make sense to have each of these classes inherit from Mixin. Similarly, duplicating the code in each class doesn’t make much sense either. The best approach is to use the augment function to add this method to each class that needs it:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;augment(Author, Mixin);&lt;br /&gt;&lt;br /&gt;var author = new Author('Ross Harmes', ['JavaScript Design Patterns']);&lt;br /&gt;var serializedString = author.serialize();&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;This can be thought of as a way to implement multiple inheritance in JavaScript.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;/* Augment function. */&lt;br /&gt;function augment(receivingClass, givingClass) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;for(methodName in givingClass.prototype) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if(!receivingClass.prototype[methodName]) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;receivingClass.prototype[methodName] = givingClass.prototype[methodName];&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;A more robust augment allows copying one or two of them over to another class.&lt;br /&gt;&lt;code&gt;&lt;br /&gt;/* Augment function, improved. */&lt;br /&gt;function augment(receivingClass, givingClass) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;if(arguments[2]) { // Only give certain methods.&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;for(var i = 2, len = arguments.length; i &amp;lt; len; i++) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;receivingClass.prototype[arguments[i]] = givingClass.prototype[arguments[i]];&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;else { // Give all methods.&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;for(methodName in givingClass.prototype) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if(!receivingClass.prototype[methodName]) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;receivingClass.prototype[methodName] = givingClass.prototype[methodName];&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;You can now write augment(Author, Mixin, 'serialize'); to only augment Author with the single serialize method.&lt;br /&gt;&lt;br /&gt;In other times, you don't have to need this augment function in order to do Mixins. You could do this by using apply or call method inside constructor function.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;var Author = function(name, books) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;this.name = name || &quot;&quot;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;this.books = books || [];&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;Mixin.apply(this);&lt;br /&gt;};&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Often it makes more sense to augment a class with a few methods than it does to make&lt;br /&gt;one class inherit from another. This is a lightweight way to prevent code duplication. Unfortunately, there aren’t many situations where it can be used. Only methods general enough to be used in very dissimilar classes make good candidates for sharing (if the classes aren’t that dissimilar, normal inheritance is often a better choice).&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6761142148052793737-5429879078678621629?l=chamnapchhorn.blogspot.com' alt=''/&gt;&lt;/div&gt;&lt;img src=&quot;http://feeds.feedburner.com/~r/blogspot/chamnap/~4/8DSAEbZeL1k&quot; height=&quot;1&quot; width=&quot;1&quot;/&gt;</description>
         <author>chamnapchhorn@gmail.com (chamnap)</author>
         <guid isPermaLink="false">tag:blogger.com,1999:blog-6761142148052793737.post-5429879078678621629</guid>
         <pubDate>Wed, 06 May 2009 21:41:00 -0700</pubDate>
      </item>
      <item>
         <title>Prototypal Inheritance vs. Classical Inheritance</title>
         <link>http://feedproxy.google.com/~r/blogspot/chamnap/~3/4OrxwJxVsKE/prototypal-inheritance-vs-classical.html</link>
         <description>While it is possible to emulate classical inheritance like Java or C#, it is clear that we do prototypal inheritance by taking advantages of prototype lookup chains. Each has its own advantages and disadvantages. Here I quoted from JavaScript Design Patterns:&lt;br /&gt;&lt;br /&gt;The classical approach to creating an object is to (a) define the structure of the object, using&lt;br /&gt;a class declaration, and (b) instantiate that class to create a new object. Objects created in this&lt;br /&gt;manner have their own copies of all instance attributes, plus a link to the single copy of each&lt;br /&gt;of the instance methods.&lt;br /&gt;&lt;br /&gt;In prototypal inheritance, instead of defining the structure through a class, you simply&lt;br /&gt;create an object. This object then gets reused by new objects, thanks to the way that prototype&lt;br /&gt;chain lookups work. It is called the &lt;span style=&quot;font-style:italic;&quot;&gt;prototype object&lt;/span&gt; because it provides a prototype for what the other objects should look like.&lt;br /&gt;&lt;br /&gt;Instead of using a constructor function named Person to define the class structure, Person&lt;br /&gt;is now an object literal. It is the prototype object for any other Person-like objects that you want to create. Define all attributes and methods you want these objects to have, and give them&lt;br /&gt;default values. &lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;/* Person Prototype Object. */&lt;br /&gt;var Person = {&lt;br /&gt; name: 'default name',&lt;br /&gt; getName: function() {&lt;br /&gt; return this.name;&lt;br /&gt; }&lt;br /&gt;};&lt;br /&gt;&lt;br /&gt;var reader = clone(Person);&lt;br /&gt;alert(reader.getName()); // This will output 'default name'.&lt;br /&gt;reader.name = 'John Smith';&lt;br /&gt;alert(reader.getName()); // This will now output 'John Smith'.&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;To create a new Person-like object, use the clone function. This provides an empty object with&lt;br /&gt;the prototype attribute set to the prototype object. This means that if any method or attribute&lt;br /&gt;lookup on this object fails, that lookup will instead look to the prototype object.&lt;br /&gt;To create Author, you make a clone.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;/* Author Prototype Object. */&lt;br /&gt;var Author = clone(Person);&lt;br /&gt;Author.books = []; // Default value.&lt;br /&gt;Author.getBooks = function() {&lt;br /&gt; return this.books;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;var author0 = clone(Author);&lt;br /&gt;author0.name = 'Dustin Diaz';&lt;br /&gt;author0.books = ['JavaScript Design Patterns'];&lt;br /&gt;var author1 = clone(Author);&lt;br /&gt;author1.name = 'Ross Harmes';&lt;br /&gt;author1.books = ['JavaScript Design Patterns'];&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Here is the clone function. First the clone function creates a new and empty function, F. It then sets the prototype attribute of F to the prototype object. Lastly, the function creates a new object by calling the new operator on F. The cloned object that is returned is completely empty, except for the prototype attribute, which is (indirectly) pointing to the prototype object, by way of the F object.&lt;br /&gt;&lt;code&gt;&lt;br /&gt;/* Clone function. */&lt;br /&gt;function clone(object) {&lt;br /&gt; function F() {}&lt;br /&gt; F.prototype = object;&lt;br /&gt; return new F;&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;In classical inheritance, each instance of Author has its own copy of the books array. You could add to it by writing author1.books.push('New Book Title'). That is not initially possible with the object you created using prototypal inheritance because of the way prototype chaining works. A clone is not a fully independent copy of its prototype object; it is a new empty object with its prototype attribute set to the prototype object. When it is just created, author1.name is actually a link back to the primitive Person.name. When you write to author1.name, you are defining a new attribute directly on the author1 object.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;var authorClone = clone(Author);&lt;br /&gt;alert(authorClone.name); // Linked to the primative Person.name, which is the&lt;br /&gt; // string 'default name'.&lt;br /&gt;authorClone.name = 'new name'; // A new primative is created and added to the&lt;br /&gt; // authorClone object itself.&lt;br /&gt;alert(authorClone.name); // Now linked to the primative authorClone.name, which&lt;br /&gt; // is the string 'new name'.&lt;br /&gt;authorClone.books.push('new book'); // authorClone.books is linked to the array&lt;br /&gt; // Author.books. We just modified the&lt;br /&gt; // prototype object's default value, and all&lt;br /&gt; // other objects that link to it will now&lt;br /&gt; // have a new default value there.&lt;br /&gt;authorClone.books = []; // A new array is created and added to the authorClone&lt;br /&gt; // object itself.&lt;br /&gt;authorClone.books.push('new book'); // We are now modifying that new array.&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Classical inheritance is well understood, both in JavaScript and the programmer commu-&lt;br /&gt;nity in general. Almost all object-oriented code written in JavaScript uses this paradigm. If you&lt;br /&gt;are creating an API for widespread use, or if there is the possibility that other programmers not&lt;br /&gt;familiar with prototypal inheritance will be working on your code, it is best to go with classical.&lt;br /&gt;&lt;br /&gt;JavaScript is the only popular, widely used language that uses prototypal inheritance, so odds&lt;br /&gt;are most people will never have used it before. It can also be confusing to have an object with&lt;br /&gt;links back to its prototype object. Programmers who don’t fully understand prototypal inheri-&lt;br /&gt;tance will think of this as some sort of reverse inheritance, where the parent inherits from its&lt;br /&gt;children. Even though this isn’t the case, it can still be a very confusing topic. But since this&lt;br /&gt;form of classical inheritance is only imitating true class-based inheritance, advanced JavaScript&lt;br /&gt;programmers need to understand how prototypal inheritance truly works at some point any-&lt;br /&gt;way. Some would argue that hiding this fact does more harm than good.&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6761142148052793737-8560760159261924?l=chamnapchhorn.blogspot.com' alt=''/&gt;&lt;/div&gt;&lt;img src=&quot;http://feeds.feedburner.com/~r/blogspot/chamnap/~4/4OrxwJxVsKE&quot; height=&quot;1&quot; width=&quot;1&quot;/&gt;</description>
         <author>chamnapchhorn@gmail.com (chamnap)</author>
         <guid isPermaLink="false">tag:blogger.com,1999:blog-6761142148052793737.post-8560760159261924</guid>
         <pubDate>Wed, 06 May 2009 21:40:00 -0700</pubDate>
      </item>
      <item>
         <title>ActiveRecord::Dirty</title>
         <link>http://feedproxy.google.com/~r/blogspot/chamnap/~3/EzShHrQeQ3k/activerecorddirty.html</link>
         <description>Another powerful feature of ActiveRecord is dirty objects. This module tracks unsaved attribute changes. This feature is available probably since &lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;http://ryandaigle.com/articles/2008/3/31/what-s-new-in-edge-rails-dirty-objects&quot;&gt;March, 2008&lt;/a&gt;. See examples below:&lt;br /&gt;&lt;br /&gt;&lt;b&gt;A newly instantiated object is unchanged:&lt;/b&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt; person = Person.find_by_name('uncle bob')&lt;br /&gt; person.changed? # =&amp;gt; false&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;b&gt;Change the name:&lt;/b&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt; person.name = 'Bob'&lt;br /&gt; person.changed? # =&amp;gt; true&lt;br /&gt; person.name_changed? # =&amp;gt; true&lt;br /&gt; person.name_was # =&amp;gt; 'uncle bob'&lt;br /&gt; person.name_change # =&amp;gt; ['uncle bob', 'Bob']&lt;br /&gt; person.name = 'Bill'&lt;br /&gt; person.name_change # =&amp;gt; ['uncle bob', 'Bill']&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;b&gt;Save the changes:&lt;/b&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt; person.save&lt;br /&gt; person.changed? # =&amp;gt; false&lt;br /&gt; person.name_changed? # =&amp;gt; false&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;b&gt;Assigning the same value leaves the attribute unchanged:&lt;/b&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt; person.name = 'Bill'&lt;br /&gt; person.name_changed? # =&amp;gt; false&lt;br /&gt; person.name_change # =&amp;gt; nil&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;b&gt;Which attributes have changed?&lt;/b&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt; person.name = 'bob'&lt;br /&gt; person.changed # =&amp;gt; ['name']&lt;br /&gt; person.changes # =&amp;gt; { 'name' =&amp;gt; ['Bill', 'bob'] }&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;b&gt;Before modifying an attribute in-place:&lt;/b&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt; person.name_will_change!&lt;br /&gt; person.name &amp;lt;&amp;lt; 'by'&lt;br /&gt; person.name_change # =&amp;gt; ['uncle bob', 'uncle bobby']&lt;br /&gt;&lt;/code&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6761142148052793737-3190805459986718748?l=chamnapchhorn.blogspot.com' alt=''/&gt;&lt;/div&gt;&lt;img src=&quot;http://feeds.feedburner.com/~r/blogspot/chamnap/~4/EzShHrQeQ3k&quot; height=&quot;1&quot; width=&quot;1&quot;/&gt;</description>
         <author>chamnapchhorn@gmail.com (chamnap)</author>
         <guid isPermaLink="false">tag:blogger.com,1999:blog-6761142148052793737.post-3190805459986718748</guid>
         <pubDate>Tue, 28 Apr 2009 18:33:00 -0700</pubDate>
      </item>
      <item>
         <title>My Restful Rails Presentation</title>
         <link>http://feedproxy.google.com/~r/blogspot/chamnap/~3/OKLkFZ1IJh8/my-restful-rails-presentation.html</link>
         <description>Last month, I did a presentation to my team about Restful Rails. I just uploaded to &lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;http://www.slideshare.net/cchamnap/rest-in-rails&quot;&gt;http://www.slideshare.net/cchamnap/rest-in-rails&lt;/a&gt;. It might be useful for newbie rails developer.&lt;br /&gt;&lt;div style=&quot;width:425px;text-align:left;&quot; id=&quot;__ss_1355315&quot;&gt;&lt;a rel=&quot;nofollow&quot; style=&quot;font:14px Helvetica, Arial, Sans-serif;display:block;margin:12px 0 3px 0;text-decoration:underline;&quot; target=&quot;_blank&quot; href=&quot;http://www.slideshare.net/cchamnap/rest-in-rails?type=powerpoint&quot; title=&quot;Rest in Rails&quot;&gt;Rest in Rails&lt;/a&gt;&lt;iframe class=&quot;embeddedvideo&quot; src=&quot;http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=restinrails-090428004646-phpapp01&amp;stripped_title=rest-in-rails&quot; type=&quot;application/x-shockwave-flash&quot; width=&quot;425&quot; height=&quot;355&quot;&gt;&lt;/iframe&gt;&lt;div style=&quot;font-size:11px;font-family:tahoma, arial;height:26px;padding-top:2px;&quot;&gt;View more &lt;a rel=&quot;nofollow&quot; style=&quot;text-decoration:underline;&quot; target=&quot;_blank&quot; href=&quot;http://www.slideshare.net/&quot;&gt;presentations&lt;/a&gt; from &lt;a rel=&quot;nofollow&quot; style=&quot;text-decoration:underline;&quot; target=&quot;_blank&quot; href=&quot;http://www.slideshare.net/cchamnap&quot;&gt;cchamnap&lt;/a&gt;.&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6761142148052793737-5671066014858289713?l=chamnapchhorn.blogspot.com' alt=''/&gt;&lt;/div&gt;&lt;img src=&quot;http://feeds.feedburner.com/~r/blogspot/chamnap/~4/OKLkFZ1IJh8&quot; height=&quot;1&quot; width=&quot;1&quot;/&gt;</description>
         <author>chamnapchhorn@gmail.com (chamnap)</author>
         <guid isPermaLink="false">tag:blogger.com,1999:blog-6761142148052793737.post-5671066014858289713</guid>
         <pubDate>Mon, 27 Apr 2009 22:53:00 -0700</pubDate>
         <enclosure length="121655" url="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=restinrails-090428004646-phpapp01&amp;stripped_title=rest-in-rails" type="application/x-shockwave-flash"/>
      </item>
      <item>
         <title>GeoServer in Ubuntu</title>
         <link>http://samneang-ngeth.blogspot.com/2009/04/geoserver-in-ubuntu.html</link>
         <description>It's not difficult to setup Geoserver on your local Ubuntu by following these steps bellow:&lt;br /&gt;======================================&lt;br /&gt;&lt;code&gt;&lt;br /&gt;1./ install java&lt;br /&gt;2./ download binary Geoserver then unzip it in usr/local&lt;br /&gt;&lt;br /&gt;3./ edit file startup.sh:&lt;br /&gt; #PATH=/usr/sbin:/usr/bin:/sbin:/bin;&lt;br /&gt; #DESC=&quot;Description of the service&quot;;&lt;br /&gt; #NAME=&quot;geoserver&quot;;&lt;br /&gt; #SCRIPTNAME=/etc/init.d/$NAME;&lt;br /&gt;&lt;br /&gt; JAVA_HOME=&quot;/usr/lib/jvm/java-6-sun&quot;;&lt;br /&gt; #GEOSERVER_USER=&quot;geoserver&quot;;&lt;br /&gt; #GEOSERVER_DATA_DIR=&quot;/usr/local/geoserver/data_dir&quot;;&lt;br /&gt; GEOSERVER_HOME=&quot;/usr/local/geoserver&quot;;&lt;br /&gt;&lt;br /&gt;4./ to change default port 8080 to other by :&lt;br /&gt; edit file jetty.xml&lt;/code&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/228218856178051930-6795514306307855404?l=samneang-ngeth.blogspot.com' alt=''/&gt;&lt;/div&gt;</description>
         <author>nsamneang@gmail.com (samneang)</author>
         <guid isPermaLink="false">tag:blogger.com,1999:blog-228218856178051930.post-6795514306307855404</guid>
         <pubDate>Mon, 27 Apr 2009 21:02:00 -0700</pubDate>
      </item>
      <item>
         <title>Mercurial</title>
         <link>http://samneang-ngeth.blogspot.com/2009/04/mercurial.html</link>
         <description>It's the way to access mercurial by hg command.&lt;br /&gt;======================================&lt;br /&gt;&lt;code&gt;Clone from webserver to local-1&lt;br /&gt;Clone from local-1 to local-2&lt;br /&gt;After modifying local-2 then &lt;br /&gt; &quot;hg add filename/foldername&quot;&lt;br /&gt; &quot;hg commit and write file&quot;&lt;br /&gt;Go back to local-1 then&lt;br /&gt; &quot;hg pull ../local-2&quot;&lt;br /&gt; &quot;hg update&quot;&lt;/code&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/228218856178051930-3633908121582383700?l=samneang-ngeth.blogspot.com' alt=''/&gt;&lt;/div&gt;</description>
         <author>nsamneang@gmail.com (samneang)</author>
         <guid isPermaLink="false">tag:blogger.com,1999:blog-228218856178051930.post-3633908121582383700</guid>
         <pubDate>Tue, 21 Apr 2009 18:37:00 -0700</pubDate>
      </item>
      <item>
         <title>Upload in Gears 0.5</title>
         <link>http://feedproxy.google.com/~r/blogspot/chamnap/~3/bG3c-0hPcDs/upload-in-gears-05.html</link>
         <description>Uploading in Gears is pretty easy since its HttpRequest object supports uploading imagery data. If you want that uploaded file could serve locally (in offline mode), you need to use LocalServer API. Moreover, it is feasible to upload in chunk for large files as well. It involves the use of Blob API as well as good handling on server side. I found two links that is able to achieve this: &lt;br /&gt;&lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;http://snippets.dzone.com/posts/show/6175&quot;&gt;http://snippets.dzone.com/posts/show/6175&lt;/a&gt;&lt;br /&gt;&lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;http://uploadmovietool.appspot.com/&quot;&gt;http://uploadmovietool.appspot.com/&lt;/a&gt;. However, I just show a simple implementation both server side script (Rails) and client side script (JavaScript).&lt;br /&gt;&lt;br /&gt;Let's start from select a file to upload with the help of &lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;http://code.google.com/apis/gears/api_desktop.html&quot;&gt;Desktop API&lt;/a&gt;, openFiles(). You need to pass the callback, and some option attributes like filter and singleFile. After user has selected a file, the callback will be invoked with one parameter that is a File object of that file. Notice that, this file object has two properties: name and blob. Thus, you can use LocalServer API to capture this file by calling captureBlob() and passing blob object, a unique url for accessing this file, and a content type. If you don't provide a content-type, the browser doesn't know how to view this file when it has intercepted by LocalServer. Usually, it will launch a download of this file. Oop! Don't forget to create a localserver object. I assume you understand gears api good enough.&lt;br /&gt;&lt;code&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;var desktop = google.gears.factory.create('beta.desktop');&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;desktop.openFiles(&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;function(files) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;var file = files[0];&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if(!file) return;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;//capture file for serving locally&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;fileName = file.name;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;blobStore.captureBlob(file.blob, fileName, &quot;image/JPEG&quot;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;},&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{ filter: ['.jpg'], singleFile: true }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;);&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Next, you need to create a HttpRequest object. Then, you do a post to your server side script. You can set some request headers like: 'Content-Disposition', 'Content-Type', and 'Content-Range'. Gears provides an event handler called onprogress. When this event is triggered, you would get ProgressEvent object. This object has 3 properties: total, loaded, and lengthComputable. These 3 properties are useful in updating UI. Last, you need to pass the blob object to send() of HttpRequest object. You can do this by calling getAsBlob() and passing the url that previously called by captureBlob().&lt;br /&gt;&lt;code&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;function upload() {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;var xhrUpload = google.gears.factory.create(&quot;beta.httprequest&quot;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;xhrUpload.open(&quot;POST&quot;, '/upload/files');&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;xhrUpload.setRequestHeader('Content-Disposition', 'attachment; filename=&quot;' + fileName + '&quot;');&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;xhrUpload.setRequestHeader('Content-Type', 'image/JPEG');&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;xhrUpload.setRequestHeader('Content-Range', 'bytes ' + file.blob.length);&lt;br /&gt;&lt;br /&gt; //Update UI&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;xhrUpload.upload.onprogress = function(progressEvent) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;document.getElementById(&quot;status&quot;).innerHTML = ((progressEvent.loaded/progressEvent.total)*100).toFixed(0) + &quot;%&quot;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;};&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;xhrUpload.onreadystatechange = function() {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;switch(xhrUpload.readyState) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;case 4: //complete&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;document.getElementById(&quot;status&quot;).innerHTML = &quot;done&quot;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;break;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;};&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;xhrUpload.send(blobStore.getAsBlob(fileName));&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;In Rails, it is quite easy to handle actually. You just need to extract file name of request header 'HTTP_CONTENT_DISPOSITION'. Then, you perform an OS check to write a file of the whole request body. It is a method called raw_post of request object.&lt;br /&gt;&lt;code&gt;&lt;br /&gt;class UploadController &amp;lt; ApplicationController&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;def files&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;path = request.env['HTTP_CONTENT_DISPOSITION'][/^attachment&amp;#92;; filename=&quot;([^&amp;#92;&quot;]+)&quot;$/, 1]&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if RUBY_PLATFORM.index(&quot;win&quot;)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;File.open(&quot;public/images/#{path}&quot;, &quot;wb&quot;) { |f| f.write(request.raw_post) }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;else&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;File.open(&quot;public/images/#{path}&quot;, &quot;w&quot;) { |f| f.write(request.raw_post) }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;end&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;end&lt;br /&gt;end&lt;br /&gt;&lt;/code&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6761142148052793737-3907863284119657374?l=chamnapchhorn.blogspot.com' alt=''/&gt;&lt;/div&gt;&lt;img src=&quot;http://feeds.feedburner.com/~r/blogspot/chamnap/~4/bG3c-0hPcDs&quot; height=&quot;1&quot; width=&quot;1&quot;/&gt;</description>
         <author>chamnapchhorn@gmail.com (chamnap)</author>
         <guid isPermaLink="false">tag:blogger.com,1999:blog-6761142148052793737.post-3907863284119657374</guid>
         <pubDate>Sat, 11 Apr 2009 00:34:00 -0700</pubDate>
      </item>
      <item>
         <title>JSON Handling Request in Rails</title>
         <link>http://feedproxy.google.com/~r/blogspot/chamnap/~3/f5al0LTdH9M/json-handling-request-in-rails.html</link>
         <description>I have messed around for almost a day today just to find how to convert from json object to ruby object when posting a REST web service. However, I have known quite well a couple more features of Rails in depth like Migration, Testing, RSpec, ActiveResource,....&lt;br /&gt;&lt;br /&gt;There are three data format we can post through AJAX (from JavaScript): serialization, and xml. &lt;b&gt;Serialization&lt;/b&gt; is the process that formats a set of data so that the server can easily read&lt;br /&gt;it from javascript object or html form.&lt;br /&gt;&lt;code&gt;&lt;br /&gt;// Serialized form&lt;br /&gt;name=Chhorn&amp;last=Chamnap&amp;city=Cambridge&amp;zip=02140&lt;br /&gt;&lt;/code&gt;&lt;code&gt;&lt;br /&gt;//XML&lt;br /&gt;&amp;lt;name&amp;gt;Chhorn&amp;lt;/name&amp;gt;&lt;br /&gt;&amp;lt;last&amp;gt;Chamnap&amp;lt;/last&amp;gt;&lt;br /&gt;&amp;lt;city&amp;gt;Cambridge&amp;lt;/city&amp;gt;&lt;br /&gt;&amp;lt;zip&amp;gt;02140&amp;lt;/zip&amp;gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Rails automatically recognizes these format very well. In your controller, you can access from params[:name], params[:last],.... However, you would face difficulties when you do a post request with json object. In your params variable would be {&quot;{&amp;#92;&quot;first_name&amp;#92;&quot;:&amp;#92;&quot;chamnap&lt;br /&gt;&amp;#92;&quot;,&amp;#92;&quot;last_name&amp;#92;&quot;:&amp;#92;&quot;chhorn&amp;#92;&quot;}&quot;=&amp;gt;nil. Therefore, you must parse this string to ruby object. There are two possible solutions. First solution, I got from a &lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;http://groups.google.com/group/rubyonrails-talk/t/e9758844a4769e29&quot;&gt;discussion&lt;/a&gt;.&lt;br /&gt;&lt;code&gt;&lt;br /&gt;irb&amp;gt; require 'rubygems'&lt;br /&gt;=&amp;gt; true&lt;br /&gt;irb&amp;gt; gem 'json'&lt;br /&gt;=&amp;gt; true&lt;br /&gt;irb&amp;gt; require 'json'&lt;br /&gt;=&amp;gt; true&lt;br /&gt;irb&amp;gt; raw = &quot;{&amp;#92;&quot;first_name&amp;#92;&quot;:&amp;#92;&quot;chamnap&amp;#92;&quot;,&amp;#92;&quot;last_name&amp;#92;&quot;:&amp;#92;&quot;chhorn&amp;#92;&quot;}&quot;&lt;br /&gt;=&amp;gt; &quot;{&amp;#92;&quot;first_name&amp;#92;&quot;:&amp;#92;&quot;chamnap&amp;#92;&quot;,&amp;#92;&quot;last_name&amp;#92;&quot;:&amp;#92;&quot;chhorn&amp;#92;&quot;}&quot;&lt;br /&gt;irb&amp;gt; puts raw&lt;br /&gt;{&quot;first_name&quot;:&quot;chamnap&quot;,&quot;last_name&quot;:&quot;chhorn&quot;}&lt;br /&gt;=&amp;gt; nil&lt;br /&gt;irb&amp;gt; JSON(raw)&lt;br /&gt;=&amp;gt; {&quot;first_name&quot;=&amp;gt;&quot;chamnap&quot;, &quot;last_name&quot;=&amp;gt;&quot;chhorn&quot;}&lt;br /&gt;irb&amp;gt; cooked = JSON.parse(raw)&lt;br /&gt;=&amp;gt; {&quot;first_name&quot;=&amp;gt;&quot;chamnap&quot;, &quot;last_name&quot;=&amp;gt;&quot;chhorn&quot;}&lt;br /&gt;irb&amp;gt; raw&lt;br /&gt;=&amp;gt; &quot;{&amp;#92;&quot;first_name&amp;#92;&quot;:&amp;#92;&quot;chamnap&amp;#92;&quot;,&amp;#92;&quot;last_name&amp;#92;&quot;:&amp;#92;&quot;chhorn&amp;#92;&quot;}&quot;&lt;br /&gt;irb&amp;gt; cooked&lt;br /&gt;=&amp;gt; {&quot;first_name&quot;=&amp;gt;&quot;chamnap&quot;, &quot;last_name&quot;=&amp;gt;&quot;chhorn&quot;}&lt;br /&gt;irb&amp;gt; raw.class&lt;br /&gt;=&amp;gt; String&lt;br /&gt;irb&amp;gt; cooked.class&lt;br /&gt;=&amp;gt; Hash&lt;br /&gt;irb&amp;gt; cooked[&quot;first_name&quot;]&lt;br /&gt;=&amp;gt; &quot;chamnap&quot;&lt;br /&gt;irb&amp;gt; cooked[:first_name]&lt;br /&gt;=&amp;gt; nil&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Secondly, I found by chance from my book by using &lt;code&gt;ActiveSupport::JSON.decode()&lt;/code&gt; method.&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6761142148052793737-1955150977911685380?l=chamnapchhorn.blogspot.com' alt=''/&gt;&lt;/div&gt;&lt;img src=&quot;http://feeds.feedburner.com/~r/blogspot/chamnap/~4/f5al0LTdH9M&quot; height=&quot;1&quot; width=&quot;1&quot;/&gt;</description>
         <author>chamnapchhorn@gmail.com (chamnap)</author>
         <guid isPermaLink="false">tag:blogger.com,1999:blog-6761142148052793737.post-1955150977911685380</guid>
         <pubDate>Thu, 02 Apr 2009 02:03:00 -0700</pubDate>
      </item>
      <item>
         <title>Geocoding on Google Maps</title>
         <link>http://feedproxy.google.com/~r/blogspot/chamnap/~3/c_fW1cKU3Y0/geocoding-on-google-maps.html</link>
         <description>Geocoding is the process of converting from address into geographic coordinates which you then can position on the map. It can be accessed directly via an HTTP request or by using a GClientGeocoder object. It is worthwhile to mention two methods of GClientGeocoder object.&lt;br /&gt;&lt;br /&gt;1. &lt;code&gt;GClientGeocoder.getLatLng()&lt;/code&gt;: this method allows you to get location of a specific location by querying google geoserver. You need to pass two arguments, address and a callback function. That callback function is invoked with one parameter, a GLatLng object of that location, when there is a reply from this service. See example &lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;http://code.google.com/apis/maps/documentation/examples/geocoding-simple.html&quot;&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;2. &lt;code&gt;GClientGeocoder.getLocations()&lt;/code&gt;: this method allows you more ability than the previous one by returning a JSON object consisting of the following information: Status (request, code), Placemark (address, AddressDetails, Accuracy, Point, coordinates,...). Moreover, it supports both standard and reverse geocoding. If you pass this method a GLatLng object instead of a String address, the geocoder will perform a reverse lookup and return a structured JSON object of the closest addressable location. See examples:&lt;br /&gt;&lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;http://code.google.com/apis/maps/documentation/examples/geocoding-extraction.html&quot;&gt;geocoding-extraction&lt;/a&gt;&lt;br /&gt;&lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;http://code.google.com/apis/maps/documentation/examples/geocoding-reverse.html&quot;&gt;geocoding-reverse&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Recently, I realized Google has added another information of data returned by this method, ExtendedData which consists of north, east, south, and west of that area. This is quite useful when positioning location on the map with appropriate zoom level. All you have to do, construct a GLatLngBounds object with these data, then call getBoundsZoomLevel() by passing this GLatLngBounds object to determine proper zoom level that fits map view port.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;var getLocation = function(address) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;var geoCoder = new GClientGeocoder();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;geoCoder.getLocations(&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;address,&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;function(location){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;document.getElementById('txtAddressId').value = address;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;//if this address is found&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if(location.Status.code == 200) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;var placeMark = location.Placemark[0];&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;var latLngBox = placeMark.ExtendedData.LatLonBox;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;//default zoom level is 7&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;var latlng, zoom = 7;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if(latLngBox) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;//determine zoom level if possible&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;b&gt;var latLngBound = new GLatLngBounds(new GLatLng(latLngBox.south, latLngBox.west), new GLatLng(latLngBox.north, latLngBox.east));&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;zoom = map.getBoundsZoomLevel(latLngBound);&lt;/b&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;latlng = new GLatLng(placeMark.Point.coordinates[1], placeMark.Point.coordinates[0]);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;map.setCenter(latlng, zoom);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;} else {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;alert('Address is not found.');&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;);&lt;br /&gt;}&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6761142148052793737-9210570323714499421?l=chamnapchhorn.blogspot.com' alt=''/&gt;&lt;/div&gt;&lt;img src=&quot;http://feeds.feedburner.com/~r/blogspot/chamnap/~4/c_fW1cKU3Y0&quot; height=&quot;1&quot; width=&quot;1&quot;/&gt;&lt;/code&gt;</description>
         <author>chamnapchhorn@gmail.com (chamnap)</author>
         <guid isPermaLink="false">tag:blogger.com,1999:blog-6761142148052793737.post-9210570323714499421</guid>
         <pubDate>Thu, 26 Mar 2009 21:03:00 -0700</pubDate>
      </item>
      <item>
         <title>Load Google Maps Dynamically</title>
         <link>http://feedproxy.google.com/~r/blogspot/chamnap/~3/bKM4AqacWqo/load-google-maps-dynamically.html</link>
         <description>Previously, I posted how to load google maps script dynamically for performance reasons. However, when callback function is get called, we could not pass any parameters to this callback, because the callback we passed is the name specified in string. &lt;br /&gt;&lt;br /&gt;There is another way if you use multiple APIs from Google, Google AJAX APIs. This framework allows you to load one API key for all supported Google AJAX APIs (including Google Maps) and also provides a common namespace for each API, allowing different Google APIs to operate together. If you decide not to use the Google AJAX API framework, you can continue to use the existing namespace. There is a method from this framework called load() with 2 parameters: moduleName, and callback function. Hence, I could use the same way to load google map except the url to load and call load(). &lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;http://code.google.com/apis/ajax/documentation/#Dynamic&quot;&gt;Here&lt;/a&gt; is from google documentation.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;function mapsLoaded() {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;var map = new google.maps.Map2(document.getElementById(&quot;map&quot;));&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;map.setCenter(new google.maps.LatLng(37.4419, -122.1419), 13);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;function loadMaps() {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;google.load(&quot;maps&quot;, &quot;2&quot;, {&quot;callback&quot; : mapsLoaded});&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;function initLoader() {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;var script = document.createElement(&quot;script&quot;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;script.src = &quot;http://www.google.com/jsapi?key=ABCDEFG&amp;callback=loadMaps&quot;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;script.type = &quot;text/javascript&quot;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;document.getElementsByTagName(&quot;head&quot;)[0].appendChild(script);&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;To solve the previous problem, you could actually add the script tag of Google AJAX APIs, which describes more precisely at &lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;http://code.google.com/apis/ajax/documentation/&quot;&gt;http://code.google.com/apis/ajax/documentation/&lt;/a&gt;. The Google AJAX APIs &amp;lt;script&amp;gt; tag loads a single method, while google.load() which loads individual AJAX APIs. With this method, you can load any specific Google API on demand.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;function mapsLoaded() {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;var map = new google.maps.Map2(document.getElementById(&quot;map&quot;));&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;map.setCenter(new google.maps.LatLng(37.4419, -122.1419), 13);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;function loadMaps() {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;google.load(&quot;maps&quot;, &quot;2&quot;, {&quot;callback&quot; : mapsLoaded});&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6761142148052793737-2382765381030186366?l=chamnapchhorn.blogspot.com' alt=''/&gt;&lt;/div&gt;&lt;img src=&quot;http://feeds.feedburner.com/~r/blogspot/chamnap/~4/bKM4AqacWqo&quot; height=&quot;1&quot; width=&quot;1&quot;/&gt;</description>
         <author>chamnapchhorn@gmail.com (chamnap)</author>
         <guid isPermaLink="false">tag:blogger.com,1999:blog-6761142148052793737.post-2382765381030186366</guid>
         <pubDate>Wed, 25 Mar 2009 18:21:00 -0700</pubDate>
      </item>
      <item>
         <title>MySQL Stored Function</title>
         <link>http://feedproxy.google.com/~r/blogspot/chamnap/~3/pW6PIiT0u0g/mysql-stored-function_14.html</link>
         <description>I have not touched any database code for about 1 year, and I have tried to help my friend with CREATE FUNCTION syntax. I have spent a couple hours with it in phpMyAdmin; however, I reviewed it very well which makes me much more clearer. Have a look the following code:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;CREATE FUNCTION myFunction()&lt;br /&gt;RETURNS int(11)&lt;br /&gt;BEGIN&lt;br /&gt;RETURN 1;&lt;br /&gt;END;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;There is a problem with the above code because it doesn't use any DELIMITER statements at all. I found this solution on &lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;http://forums.mysql.com/read.php?98,212863,212877#msg-212877&quot;&gt;http://forums.mysql.com/read.php?98,212863,212877#msg-212877&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Well, I have tested that again on phpMyAdmin, but it still doesn't work. I found some people said don't use phpMyAdmin to run this type of statement. Hence, I tried MySQL Query Browser, it works well.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;DELIMITER $$&lt;br /&gt;&lt;br /&gt;CREATE FUNCTION myFunction() RETURNS int(11)&lt;br /&gt;BEGIN&lt;br /&gt;RETURN 1;&lt;br /&gt;END $$&lt;br /&gt;&lt;br /&gt;DELIMITER ;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Have a look on full syntax of &lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;http://dev.mysql.com/doc/refman/5.0/en/create-procedure.html&quot;&gt;create stored routine&lt;/a&gt;.&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6761142148052793737-893409686127858482?l=chamnapchhorn.blogspot.com' alt=''/&gt;&lt;/div&gt;&lt;img src=&quot;http://feeds.feedburner.com/~r/blogspot/chamnap/~4/pW6PIiT0u0g&quot; height=&quot;1&quot; width=&quot;1&quot;/&gt;</description>
         <author>chamnapchhorn@gmail.com (chamnap)</author>
         <guid isPermaLink="false">tag:blogger.com,1999:blog-6761142148052793737.post-893409686127858482</guid>
         <pubDate>Fri, 13 Mar 2009 19:43:00 -0700</pubDate>
      </item>
      <item>
         <title>Transparency PNG file in IE</title>
         <link>http://vuthysan.blogspot.com/2009/02/transparency-png-file-in-ie.html</link>
         <description>The ability of this script is help you to show PNP files transparency in IE.It's will effect all ur &amp;lt;img class=&quot;whatever&quot;&amp;gt; tag in the page that u added this script.But to make sure that img u have to create class whatever it's name.
&lt;br /&gt;
&lt;br /&gt;// CONFIGURATION
&lt;br /&gt;// png_overlay is the png 'frame' that will be loaded over the images with a class name of &quot;frame&quot;
&lt;br /&gt;// suffix is the identifier for the rollover image; image.jpg -&amp;gt; image_suffix.jpg
&lt;br /&gt;//
&lt;br /&gt;//	var png_overlay = 'rounded_frame.png';
&lt;br /&gt;//	var suffix = '_over';
&lt;br /&gt;
&lt;br /&gt;//
&lt;br /&gt;//	addEvent()
&lt;br /&gt;//	Allows attachment of events to elements
&lt;br /&gt;//
&lt;br /&gt;function addEvent( obj, type, fn ) {
&lt;br /&gt; if (obj.addEventListener) {
&lt;br /&gt; obj.addEventListener( type, fn, false );
&lt;br /&gt; EventCache.add(obj, type, fn);
&lt;br /&gt; }
&lt;br /&gt; else if (obj.attachEvent) {
&lt;br /&gt; obj[&quot;e&quot;+type+fn] = fn;
&lt;br /&gt; obj[type+fn] = function() { obj[&quot;e&quot;+type+fn]( window.event ); }
&lt;br /&gt; obj.attachEvent( &quot;on&quot;+type, obj[type+fn] );
&lt;br /&gt; EventCache.add(obj, type, fn);
&lt;br /&gt; }
&lt;br /&gt; else {
&lt;br /&gt; obj[&quot;on&quot;+type] = obj[&quot;e&quot;+type+fn];
&lt;br /&gt; }
&lt;br /&gt;}
&lt;br /&gt;var EventCache = function() {
&lt;br /&gt; var listEvents = [];
&lt;br /&gt; return {
&lt;br /&gt; listEvents : listEvents,
&lt;br /&gt; add : function(node, sEventName, fHandler) {
&lt;br /&gt; listEvents.push(arguments);
&lt;br /&gt; },
&lt;br /&gt; flush : function() {
&lt;br /&gt; var i, item;
&lt;br /&gt; for(i = listEvents.length - 1; i &amp;gt;= 0; i = i - 1) {
&lt;br /&gt; item = listEvents[i];
&lt;br /&gt; if(item[0].removeEventListener) {
&lt;br /&gt; item[0].removeEventListener(item[1], item[2], item[3]);
&lt;br /&gt; };
&lt;br /&gt; if(item[1].substring(0, 2) != &quot;on&quot;) {
&lt;br /&gt; item[1] = &quot;on&quot; + item[1];
&lt;br /&gt; };
&lt;br /&gt; if(item[0].detachEvent) {
&lt;br /&gt; item[0].detachEvent(item[1], item[2]);
&lt;br /&gt; };
&lt;br /&gt; item[0][item[1]] = null;
&lt;br /&gt; };
&lt;br /&gt; }
&lt;br /&gt;	};
&lt;br /&gt;}();
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;addEvent(window,'unload',EventCache.flush);
&lt;br /&gt;//
&lt;br /&gt;//	correctPNG()
&lt;br /&gt;//	Allows transparent PNG images to be display correctly in IE
&lt;br /&gt;//	Not sure who wrote it, but thanks
&lt;br /&gt;//
&lt;br /&gt;function correctPNG() {
&lt;br /&gt; for(var i=0; i
 var img = document.images[i]
&lt;br /&gt; var imgName = img.src.toUpperCase()
&lt;br /&gt; if (imgName.substring(imgName.length-3, imgName.length) == &quot;PNG&quot;) {
&lt;br /&gt; var imgID = (img.id) ? &quot;id='&quot; + img.id + &quot;' &quot; : &quot;&quot;
&lt;br /&gt; var imgClass = (img.className) ? &quot;class='&quot; + img.className + &quot;' &quot; : &quot;&quot;
&lt;br /&gt; var imgTitle = (img.title) ? &quot;title='&quot; + img.title + &quot;' &quot; : &quot;title='&quot; + img.alt + &quot;' &quot;
&lt;br /&gt; var imgStyle = &quot;display:inline-block;&quot; + img.style.cssText &lt;br /&gt; if (img.align == &quot;left&quot;) imgStyle = &quot;float:left;&quot; + imgStyle
&lt;br /&gt; if (img.align == &quot;right&quot;) imgStyle = &quot;float:right;&quot; + imgStyle
&lt;br /&gt; if (img.parentElement.href) imgStyle = &quot;cursor:hand;&quot; + imgStyle &lt;br /&gt; var strNewHTML = &quot;&lt;span
&gt; + &quot; style=&amp;#92;&quot;&quot; + &quot;width:&quot; + img.width + &quot;px; height:&quot; + img.height + &quot;px;&quot; + imgStyle + &quot;;&quot;
&lt;br /&gt; + &quot;filter:progid:DXImageTransform.Microsoft.AlphaImageLoader&quot;
&lt;br /&gt; + &quot;(src=&amp;#92;'&quot; + img.src + &quot;&amp;#92;', sizingMethod='image');&amp;#92;&quot;&amp;gt;&lt;/span&gt;&quot; &lt;br /&gt; img.outerHTML = strNewHTML
&lt;br /&gt; i = i-1
&lt;br /&gt; }
&lt;br /&gt;	}
&lt;br /&gt;}
&lt;br /&gt;
&lt;br /&gt;//
&lt;br /&gt;//	rollovers()
&lt;br /&gt;//	Displays a rollover for any image with a class name of &quot;rollover&quot;. Includes IE friendly function for transparent PNG fix.
&lt;br /&gt;//
&lt;br /&gt;var rollovers = {
&lt;br /&gt; obj : Object,
&lt;br /&gt; init : function() {
&lt;br /&gt;	for( var i = 0, over; over = document.getElementsByTagName('img')[i]; i++ ){
&lt;br /&gt; if( over.className.indexOf('rollover') &amp;gt;= 0 ) {
&lt;br /&gt; rollovers.preload(over);
&lt;br /&gt; addEvent(over,'mouseover',rollovers.show);
&lt;br /&gt; addEvent(over,'mouseout',rollovers.hide);
&lt;br /&gt; }
&lt;br /&gt;	}
&lt;br /&gt; },
&lt;br /&gt; preload : function(e) {
&lt;br /&gt;	var img = new Image;
&lt;br /&gt;	var ext = e.src.substring(e.src.length - 4, e.src.length);
&lt;br /&gt;	var name = e.src.substring(0, e.src.length - 4);
&lt;br /&gt;	img.src = name + suffix + ext;
&lt;br /&gt; },
&lt;br /&gt; show : function(e) {
&lt;br /&gt;	var ext = this.src.substring(this.src.length - 4, this.src.length);
&lt;br /&gt;	var name = this.src.substring(0, this.src.length - 4);
&lt;br /&gt;	this.src = name + suffix + ext;
&lt;br /&gt; },
&lt;br /&gt; hide : function(e) {
&lt;br /&gt;	this.src = this.src.replace(suffix,'');
&lt;br /&gt; }
&lt;br /&gt;}
&lt;br /&gt;var rollovers_ie = {
&lt;br /&gt;	obj : Object,
&lt;br /&gt;	init : function() {
&lt;br /&gt; if( document.getElementsByTagName('span').length &amp;lt; 1 )
&lt;br /&gt; setTimeout('rollovers_ie.init()',500);
&lt;br /&gt; for( var i = 0, span; span = document.getElementsByTagName('span')[i]; i++ ){
&lt;br /&gt; if( span.className.indexOf('rollover') &amp;gt;= 0 ) {
&lt;br /&gt; rollovers_ie.preload(span);
&lt;br /&gt; addEvent(span,'mouseover',rollovers_ie.show);
&lt;br /&gt; addEvent(span,'mouseout',rollovers_ie.hide);
&lt;br /&gt; }
&lt;br /&gt; }
&lt;br /&gt;	},
&lt;br /&gt;	preload : function(e) {
&lt;br /&gt; var img = new Image;
&lt;br /&gt; var filter = e.style.filter;
&lt;br /&gt; var src = filter.substring( filter.indexOf(&quot;src='&quot;) + 5, filter.indexOf(&quot;',&quot;));
&lt;br /&gt; var ext = src.substring(src.length - 4, src.length);
&lt;br /&gt; var name = src.substring(0, src.length - 4);
&lt;br /&gt; img.src = name + suffix + ext;
&lt;br /&gt;	},
&lt;br /&gt;	show : function(e) {
&lt;br /&gt; var filter = this.style.filter;
&lt;br /&gt; var src = filter.substring( filter.indexOf(&quot;src='&quot;) + 5, filter.indexOf(&quot;',&quot;));
&lt;br /&gt; var ext = src.substring(src.length - 4, src.length);
&lt;br /&gt; var name = src.substring(0, src.length - 4);
&lt;br /&gt; this.style.filter = &quot;progid:DXImageTransform.Microsoft.AlphaImageLoader&quot; + &quot;(src=&amp;#92;'&quot; + name + suffix + ext + &quot;&amp;#92;', sizingMethod='image')&quot;;
&lt;br /&gt;	},
&lt;br /&gt;	hide : function(e) {
&lt;br /&gt; var filter = this.style.filter;
&lt;br /&gt; var src = filter.substring( filter.indexOf(&quot;src='&quot;) + 5, filter.indexOf(&quot;',&quot;));
&lt;br /&gt; this.style.filter = &quot;progid:DXImageTransform.Microsoft.AlphaImageLoader&quot; + &quot;(src=&amp;#92;'&quot; + src.replace(suffix,'') + &quot;&amp;#92;', sizingMethod='image')&quot;;
&lt;br /&gt;	}
&lt;br /&gt;}
&lt;br /&gt;
&lt;br /&gt;//
&lt;br /&gt;//	pngFrame()
&lt;br /&gt;//	Replaces images with class name of &quot;frame&quot; with png_overlay file.
&lt;br /&gt;//
&lt;br /&gt;function pngFrame() {
&lt;br /&gt;	var imgs = document.images;
&lt;br /&gt;	for( var i = 0, img; img = imgs[i]; i++ ) {
&lt;br /&gt; if( img.className.indexOf('frame') &amp;gt;= 0 ) {
&lt;br /&gt; var bgSrc = img.src;
&lt;br /&gt; img.style.background = &quot;url(&quot; + bgSrc + &quot;)&quot;;
&lt;br /&gt; img.src = png_overlay;
&lt;br /&gt; }
&lt;br /&gt;	}
&lt;br /&gt;}
&lt;br /&gt;
&lt;br /&gt;//
&lt;br /&gt;// Load the Functions
&lt;br /&gt;//
&lt;br /&gt;if( navigator.userAgent.indexOf('MSIE') &amp;gt;= 0 )
&lt;br /&gt;	addEvent(window,'load',correctPNG);
&lt;br /&gt;addEvent(window,'load',pngFrame);
&lt;br /&gt;if( navigator.userAgent.indexOf('MSIE') &amp;gt;= 0 )
&lt;br /&gt;	addEvent(window,'load',rollovers_ie.init);
&lt;br /&gt;addEvent(window,'load',rollovers.init);
&lt;br /&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5092296896310373218-1165836996647974201?l=vuthysan.blogspot.com' alt=''/&gt;&lt;/div&gt;</description>
         <author>noreply@blogger.com (Vuthy)</author>
         <guid isPermaLink="false">tag:blogger.com,1999:blog-5092296896310373218.post-1165836996647974201</guid>
         <pubDate>Wed, 11 Feb 2009 23:27:00 -0800</pubDate>
      </item>
      <item>
         <title>SplitButton and MenuButton</title>
         <link>http://feedproxy.google.com/~r/blogspot/chamnap/~3/KtuaMQ84NSo/splitbutton-and-menubutton.html</link>
         <description>Probably, somebody also experiences difficulties with dealing with SplitButton and MenuButton when you add new items, select an item, replace it with new items. To deal with those items, you need to call getMenu().&lt;br /&gt;&lt;br /&gt;1. To clear existing items, call clearContent() of getMenu()&lt;br /&gt;&lt;code&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;split.getMenu().clearContent();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;split.set(&quot;label&quot;, &quot;Choose One&quot;);&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;2. To add item(s), call addItem() or addItems(). Remember each item has three properties: &quot;text&quot;, &quot;value&quot;, and &quot;onclick&quot;. After calling this method, you need to call render by passing the container of this button, otherwise it won't appear on the browser. &lt;br /&gt;&lt;code&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;split.getMenu().addItems(splitData);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;split.getMenu().render(split.get('container'));&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;3. To replace with new data, just combine two previous snippet codes&lt;br /&gt;&lt;code&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;split.getMenu().clearContent();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;split.set(&quot;label&quot;, &quot;Choose One&quot;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;split.getMenu().addItems(splitData);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;split.getMenu().render(split.get('container'));&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;4. To enable selection when clicking on each item, each item must have onclick property with an object literal as shown below:&lt;br /&gt;&lt;code&gt;&lt;br /&gt;splitData = {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;fn: function(type, args, item) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;split_group.set(&quot;label&quot;, item.cfg.getProperty(&quot;text&quot;)); &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6761142148052793737-8309342522102796462?l=chamnapchhorn.blogspot.com' alt=''/&gt;&lt;/div&gt;&lt;img src=&quot;http://feeds.feedburner.com/~r/blogspot/chamnap/~4/KtuaMQ84NSo&quot; height=&quot;1&quot; width=&quot;1&quot;/&gt;</description>
         <author>chamnapchhorn@gmail.com (chamnap)</author>
         <guid isPermaLink="false">tag:blogger.com,1999:blog-6761142148052793737.post-8309342522102796462</guid>
         <pubDate>Mon, 26 Jan 2009 19:48:00 -0800</pubDate>
      </item>
      <item>
         <title>Handle DateTime field in Gears</title>
         <link>http://feedproxy.google.com/~r/blogspot/chamnap/~3/Hf9gN2jMhGw/handle-datetime-field-in-gears.html</link>
         <description>SQLite in Gears supports DATETIME data type, but it works differently from JavaScript context. SQLite only support the following formats as shown on &lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;http://www.somacon.com/p370.php&quot;&gt;SQLite Date and Time Functions&lt;/a&gt;. If you provide invalid format, SQLite will not give an error, but the function call (&lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;http://www.somacon.com/p370.php&quot;&gt;SQLite DateTime function&lt;/a&gt;) will return null, or record could not be inserted/updated. There are two ways to handle this situation.&lt;br /&gt;&lt;br /&gt;1. If you don't use ORM JavaScript library such JazzRecord or JStORM, you could make this field an Integer field and call getTime() of JavaScript Date object to store. For displaying data back, you can still sort by ascending/descending order. Pass value that get from getTime() to a constructor of Date object to convert a Date object.&lt;br /&gt;&lt;code&gt;&lt;br /&gt;var db = google.gears.factory.create('beta.database');&lt;br /&gt;db.open('database-test');&lt;br /&gt;db.execute('create table if not exists Test (Phrase text, Timestamp int)');&lt;br /&gt;//store in db&lt;br /&gt;db.execute('insert into Test values (?, ?)', ['Monkey!', new Date().getTime()]);&lt;br /&gt;var rs = db.execute('select * from Test order by Timestamp desc');&lt;br /&gt;&lt;br /&gt;while (rs.isValidRow()) {&lt;br /&gt; //convert to date object&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;var date = new Date(rs.field(1));&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;alert(rs.field(0) + '@' + date.getDate() + &quot;/&quot; + (date.getMonth()+1) + &quot;/&quot; + date.getFullYear());&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;rs.next();&lt;br /&gt;}&lt;br /&gt;rs.close();&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;One exception with this is that you can use SQLite DateTime functions when querying back because the format you store is not recognized by SQLite. You have to loop through in JavaScript and an if statement.&lt;br /&gt;&lt;br /&gt;2. This way is preferable because it supports full &lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;http://www.somacon.com/p370.php&quot;&gt;SQLite Date and Time Functions&lt;/a&gt;, but it needs some helper method to transform format between SQLite and JavaScript back and forth.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;var Util = {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;fromJSDateToSQLiteDate: function(date) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;var toTwoCharacters = function(number) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;return (number.toString().length == 2) ? number.toString() : '0' + number.toString();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;};&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;var strYear = date.getFullYear();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;var strMonth = toTwoCharacters(date.getMonth() + 1);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;var strDate = toTwoCharacters(date.getDate());&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;var strHour = toTwoCharacters(date.getHours());&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;var strMinute = toTwoCharacters(date.getMinutes());&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;var strSecond = toTwoCharacters(date.getSeconds());&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;return strYear + '-' + strMonth + '-' + strDate + ' ' + strHour + ':' + strMinute + ':' + strSecond;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;},&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;fromSQLiteDateToJSDate: function(strDateTime) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;var strDate = strDateTime.split(' ')[0];&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;var strTime = strDateTime.split(' ')[1];&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;var arrDate = strDate.split('-');&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;var arrTime = strTime.split(':');&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;return new Date(arrDate[0], arrDate[1]-1, arrDate[2], arrTime[0], arrTime[1], arrTime[2]);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;};&lt;br /&gt;&lt;/code&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6761142148052793737-3142941732244556670?l=chamnapchhorn.blogspot.com' alt=''/&gt;&lt;/div&gt;&lt;img src=&quot;http://feeds.feedburner.com/~r/blogspot/chamnap/~4/Hf9gN2jMhGw&quot; height=&quot;1&quot; width=&quot;1&quot;/&gt;</description>
         <author>chamnapchhorn@gmail.com (chamnap)</author>
         <guid isPermaLink="false">tag:blogger.com,1999:blog-6761142148052793737.post-3142941732244556670</guid>
         <pubDate>Mon, 26 Jan 2009 18:40:00 -0800</pubDate>
      </item>
      <item>
         <title>Refresh DataSource of DataTable</title>
         <link>http://feedproxy.google.com/~r/blogspot/chamnap/~3/SLGu3lkvQ_E/refresh-datasource-of-datatable.html</link>
         <description>I have been using YUI as a UI framework for my projects recently. I found the documentation of YUI is very bad since it just tells that you do this, you will get this. It doesn't tell why I need to do this, and it still misses some common examples. Most often, I need to check what are methods and properties do this object have.&lt;br /&gt;&lt;br /&gt;In order to reset new data when your data have been updated by somewhere, you need to call reset() from getRecordSet() of datatable object. Then, call setRecords() by passing your new data. If you have paginator, you also have to update it by calling setPage() to its current page and reset the total number of record.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt; dataTable.getRecordSet().reset();&lt;br /&gt; dataTable.getRecordSet().setRecords(newData);&lt;br /&gt; dataTable.refreshView();&lt;br /&gt; &lt;br /&gt; //refresh paginator&lt;br /&gt; dataTable.get(&quot;paginator&quot;).setPage(dataTable.get(&quot;paginator&quot;).getCurrentPage());&lt;br /&gt; dataTable.get(&quot;paginator&quot;).set(&quot;totalRecords&quot;, dataTable.getRecordSet().getLength());&lt;br /&gt;&lt;/code&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6761142148052793737-528205740551455819?l=chamnapchhorn.blogspot.com' alt=''/&gt;&lt;/div&gt;&lt;img src=&quot;http://feeds.feedburner.com/~r/blogspot/chamnap/~4/SLGu3lkvQ_E&quot; height=&quot;1&quot; width=&quot;1&quot;/&gt;</description>
         <author>chamnapchhorn@gmail.com (chamnap)</author>
         <guid isPermaLink="false">tag:blogger.com,1999:blog-6761142148052793737.post-528205740551455819</guid>
         <pubDate>Fri, 23 Jan 2009 01:33:00 -0800</pubDate>
      </item>
      <item>
         <title>My pimped up dev environment</title>
         <link>http://mmiika.wordpress.com/2008/10/22/my-pimped-up-dev-environment/</link>
         <description>Spent some hours to: Upgrade from Vista 32-bit to Windows Server 2008 64 bit
Funky console from http://sourceforge.net/projects/console/
Neat light-on-dark theme for VS 2008 from Brad Wilson: http://www.agileprogrammer.com/dotnetguy/archive/2006/09/07/19030.aspx
Chaos Crystal for transparent VS 2008: http://www.elgorithms.com/downloads/chaoscrystal.php
Desktop background from http://www.framebox.de/creations/3d/disruption/index.htm The result: Quite happy now, though Windows and VS could be a bit more tweakable&amp;#8230; and wish I had well working workspaces like with Ubuntu. [...]&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://stats.wordpress.com/b.gif?host=mmiika.wordpress.com&amp;blog=3798048&amp;post=64&amp;subd=mmiika&amp;ref=&amp;feed=1&quot;/&gt;</description>
         <guid isPermaLink="false">http://mmiika.wordpress.com/?p=64</guid>
         <pubDate>Wed, 22 Oct 2008 03:21:08 -0700</pubDate>
         <content:encoded><![CDATA[<div class='snap_preview'><br /><p>Spent some hours to:</p>
<ul>
<li>Upgrade from Vista 32-bit to Windows Server 2008 64 bit</li>
<li>Funky console from <a rel="nofollow" target="_blank" href="http://sourceforge.net/projects/console/">http://sourceforge.net/projects/console/</a></li>
<li>Neat light-on-dark theme for VS 2008 from Brad Wilson: <a rel="nofollow" target="_blank" href="http://www.agileprogrammer.com/dotnetguy/archive/2006/09/07/19030.aspx">http://www.agileprogrammer.com/dotnetguy/archive/2006/09/07/19030.aspx</a></li>
<li>Chaos Crystal for transparent VS 2008: <a rel="nofollow" target="_blank" href="http://www.elgorithms.com/downloads/chaoscrystal.php">http://www.elgorithms.com/downloads/chaoscrystal.php</a></li>
<li>Desktop background from <a rel="nofollow" target="_blank" href="http://www.framebox.de/creations/3d/disruption/index.htm">http://www.framebox.de/creations/3d/disruption/index.htm</a></li>
</ul>
<p>The result:</p>
<p><a rel="nofollow" title="pimped VS 2008 by Mmiika, on Flickr" target="_blank" href="http://www.flickr.com/photos/84034255@N00/2963326093/"><img src="http://farm4.static.flickr.com/3137/2963326093_bd309897bb.jpg" alt="pimped VS 2008" width="500" height="313"/></a></p>
<p>Quite happy now, though Windows and VS could be a bit more tweakable&#8230; and wish I had well working workspaces like with Ubuntu.</p> <a rel="nofollow" target="_blank" href="http://feeds.wordpress.com/1.0/gocomments/mmiika.wordpress.com/64/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mmiika.wordpress.com/64/"/></a> <a rel="nofollow" target="_blank" href="http://feeds.wordpress.com/1.0/godelicious/mmiika.wordpress.com/64/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mmiika.wordpress.com/64/"/></a> <a rel="nofollow" target="_blank" href="http://feeds.wordpress.com/1.0/gostumble/mmiika.wordpress.com/64/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mmiika.wordpress.com/64/"/></a> <a rel="nofollow" target="_blank" href="http://feeds.wordpress.com/1.0/godigg/mmiika.wordpress.com/64/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mmiika.wordpress.com/64/"/></a> <a rel="nofollow" target="_blank" href="http://feeds.wordpress.com/1.0/goreddit/mmiika.wordpress.com/64/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mmiika.wordpress.com/64/"/></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mmiika.wordpress.com&blog=3798048&post=64&subd=mmiika&ref=&feed=1"/></div>]]></content:encoded>
         <media:content url="http://1.gravatar.com/avatar/b015344ba49711e90affd0687f854dba?s=96&amp;amp;d=identicon" medium="image">
            <media:title>mmiika</media:title>
         </media:content>
         <media:content url="http://farm4.static.flickr.com/3137/2963326093_bd309897bb.jpg" medium="image">
            <media:title>pimped VS 2008</media:title>
         </media:content>
      </item>
      <item>
         <title>Inheritance</title>
         <link>http://sareuon.blogspot.com/2008/10/inheritance.html</link>
         <description>In Oop languages, Inheritance can help you to reduce the duplicate code and make objects as loosely coupled.&lt;br /&gt;So this is how to do Inheritance in javascript. Let see the code below:&lt;br /&gt;&lt;br /&gt;//Supper Class&lt;br /&gt;Input = function(a, b){&lt;br /&gt; var _a = a;&lt;br /&gt; var _b =b;&lt;br /&gt; &lt;br /&gt; this.getA = function(){&lt;br /&gt; return _a;&lt;br /&gt; };&lt;br /&gt; &lt;br /&gt; this.getB = function(){&lt;br /&gt; return _b;&lt;br /&gt; };&lt;br /&gt; }&lt;br /&gt; &lt;br /&gt; //Concrete Class&lt;br /&gt; Sum = function(a, b){&lt;br /&gt; Input.apply(this,[a,b]);&lt;br /&gt; &lt;br /&gt; this.getSum = function(){&lt;br /&gt; return (this.getA() + this.getB());&lt;br /&gt; }&lt;br /&gt; }&lt;br /&gt; &lt;br /&gt; &lt;br /&gt; //Implementation&lt;br /&gt; &lt;br /&gt; var mySum = new Sum(2,3);&lt;br /&gt; alert(mySum.getSum();&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2359002249313379007-5712356165798470401?l=sareuon.blogspot.com'/&gt;&lt;/div&gt;</description>
         <author>noreply@blogger.com (Sareuon)</author>
         <guid isPermaLink="false">tag:blogger.com,1999:blog-2359002249313379007.post-5712356165798470401</guid>
         <pubDate>Thu, 16 Oct 2008 20:22:00 -0700</pubDate>
      </item>
      <item>
         <title>Get width of text in px</title>
         <link>http://vuthysan.blogspot.com/2008/10/get-width-of-text-in-px.html</link>
         <description>Create a DIV styled with the following styles. In your JavaScript, set the font size and attributes that you are trying to measure, put your string in the DIV, then read the current width and height of the DIV. It will stretch to fit the contents and the size will be within a few pixels of the string rendered size.&lt;br /&gt;&lt;br /&gt;&amp;lt;div id=&quot;introtext&quot; class=&quot;txt_select&quot;&amp;gt;This is some introductory text&amp;lt;/div&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;style&amp;gt;&lt;br /&gt; &amp;nbsp;.txt_select{&lt;br /&gt; position: absolute;&lt;br /&gt; background-color:#000099;&lt;br /&gt; font-size:12px;&lt;br /&gt; }&lt;br /&gt;&amp;lt;/style&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;script language=&quot;javascript&quot; type=&quot;text/javascript&quot;&amp;gt;&lt;br /&gt; var test = document.getElementById(&quot;introtext&quot;);&lt;br /&gt; var height = (test.clientHeight + 1) + &quot;px&quot;;&lt;br /&gt; var width = (test.clientWidth + 1) + &quot;px&quot;;&lt;br /&gt;&amp;lt;/script&amp;gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5092296896310373218-2987372434541284658?l=vuthysan.blogspot.com' alt=''/&gt;&lt;/div&gt;</description>
         <author>noreply@blogger.com (Vuthy)</author>
         <guid isPermaLink="false">tag:blogger.com,1999:blog-5092296896310373218.post-2987372434541284658</guid>
         <pubDate>Wed, 08 Oct 2008 20:46:00 -0700</pubDate>
      </item>
      <item>
         <title>Phnom Penh Dev Feed</title>
         <link>http://groups.google.com/group/ppppkh/browse_thread/thread/8f19b6a3617a779f/8f4f96a8fb69a5a9?show_docid=8f4f96a8fb69a5a9</link>
         <author>Miika Makinen</author>
         <guid isPermaLink="false">http://groups.google.com/group/ppppkh/browse_thread/thread/8f19b6a3617a779f/8f4f96a8fb69a5a9?show_docid=8f4f96a8fb69a5a9</guid>
         <pubDate>Sun, 21 Sep 2008 18:24:59 -0700</pubDate>
      </item>
      <item>
         <title>Callback Functions</title>
         <link>http://vuthysan.blogspot.com/2008/09/callback-functions.html</link>
         <description>When you pass a function A to another function B and B executes A, it's often said that A is a callback function. If A doesn't have a name, then you can say that it's an anonymous callback function.&lt;br /&gt;&lt;br /&gt;When are the callback functions useful? Let's see some examples that demonstrate the benefits of the callback functions, namely:&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;They let you pass functions without the need to name them (which means there are less global variables)&lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;You can delegate the responsibility of calling a function to another function (which means there is less code to write)&lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;They can help with performance&lt;/li&gt;&lt;/ul&gt;&lt;span style=&quot;font-weight:bold;&quot;&gt;Callback Example:&lt;/span&gt;&lt;br /&gt; function multiplyByTwo(a, b, c, callback) {&lt;br /&gt; var i, ar = [];&lt;br /&gt; for(i = 0; i &amp;lt; 3; i++) {&lt;br /&gt; ar[i] = callback(arguments[i] * 2);&lt;br /&gt; }&lt;br /&gt; return ar;&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&amp;gt;&amp;gt;&amp;gt; myarr = multiplyByTwo(1, 2, 3, addOne);&lt;br /&gt; &lt;br /&gt; [3, 5, 7]&lt;br /&gt;&lt;br /&gt;Instead of defining addOne() we can use an anonymous function, this way saving an extra global variable.&lt;br /&gt;&amp;gt;&amp;gt;&amp;gt; myarr = multiplyByTwo(1, 2, 3, function(a){return a + 1});&lt;br /&gt;&lt;br /&gt; [3, 5, 7]&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5092296896310373218-4217937691894572827?l=vuthysan.blogspot.com' alt=''/&gt;&lt;/div&gt;</description>
         <author>noreply@blogger.com (Vuthy)</author>
         <guid isPermaLink="false">tag:blogger.com,1999:blog-5092296896310373218.post-4217937691894572827</guid>
         <pubDate>Sun, 21 Sep 2008 20:25:00 -0700</pubDate>
      </item>
      <item>
         <title>Local versus Global scoping</title>
         <link>http://vuthysan.blogspot.com/2008/09/local-versus-global-scoping.html</link>
         <description>Here's an interesting example that shows an important aspect of the local versus global scoping.&lt;br /&gt; var a = 123;&lt;br /&gt; function f() {&lt;br /&gt; alert(a);&lt;br /&gt; var a = 1;&lt;br /&gt; alert(a);&lt;br /&gt; }&lt;br /&gt; &lt;br /&gt; f();&lt;br /&gt;&lt;br /&gt;You might expect that the first alert() will display 123 (the value of the global variable a) and the second will display 1 (the local a). This is not the case. The first alert will show &quot;undefined&quot;. This is because inside the function the local scope is more important than the global scope. So a local variable overwrites any global variable with the same name. At the time of the first alert() a was not yet defined (hence the value undefined) but it still existed in the local space.&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5092296896310373218-2002202165215481447?l=vuthysan.blogspot.com' alt=''/&gt;&lt;/div&gt;</description>
         <author>noreply@blogger.com (Vuthy)</author>
         <guid isPermaLink="false">tag:blogger.com,1999:blog-5092296896310373218.post-2002202165215481447</guid>
         <pubDate>Sun, 21 Sep 2008 20:08:00 -0700</pubDate>
      </item>
      <item>
         <title>Phnom Penh Developers Yahoo Pipe</title>
         <link>http://mmiika.wordpress.com/2008/09/22/phnom-penh-developers-yahoo-pipe/</link>
         <description>Merged couple of feeds from developers in Phnom Penh into a Yahoo Pipe. Subscribe and let me know if you are blogging about programming and not part of that list yet. The current sources are: me
Chris in Cambodia Vorleak
Sokun
Chamnap
Sophy
Samneang
Sareuon
Vuthy
Phnom Penh Pragmatic Programmers &lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://stats.wordpress.com/b.gif?host=mmiika.wordpress.com&amp;blog=3798048&amp;post=57&amp;subd=mmiika&amp;ref=&amp;feed=1&quot;/&gt;</description>
         <guid isPermaLink="false">http://mmiika.wordpress.com/?p=57</guid>
         <pubDate>Sun, 21 Sep 2008 20:00:08 -0700</pubDate>
         <content:encoded><![CDATA[<div class='snap_preview'><br /><p>Merged couple of feeds from <a rel="nofollow" target="_blank" href="http://pipes.yahoo.com/mmiika/phnompenhdev">developers in Phnom Penh</a> into a Yahoo Pipe. Subscribe and let me know if you are blogging about programming and not part of that list yet. The current sources are:</p>
<ul>
<li><a rel="nofollow" target="_blank" href="http://mmiika.wordpress.com">me</a></li>
<li><a rel="nofollow" title="Chris in Cambodia" target="_blank" href="http://chrisincambo.wordpress.com">Chris in Cambodia<br />
</a></li>
<li><a rel="nofollow" target="_blank" href="http://vorleakchy.wordpress.com">Vorleak</a></li>
<li><a rel="nofollow" target="_blank" href="http://chornsokun.wordpress.com">Sokun</a></li>
<li><a rel="nofollow" target="_blank" href="http://chamnapchhorn.blogspot.com">Chamnap</a></li>
<li><a rel="nofollow" target="_blank" href="http://ungsophy.blogspot.com">Sophy</a></li>
<li><a rel="nofollow" target="_blank" href="http://samneang-ngeth.blogspot.com">Samneang</a></li>
<li><a rel="nofollow" target="_blank" href="http://sareuon.blogspot.com">Sareuon</a></li>
<li><a rel="nofollow" target="_blank" href="http://vuthysan.blogspot.com">Vuthy</a></li>
<li><a rel="nofollow" target="_blank" href="http://groups.google.com/group/ppppkh">Phnom Penh Pragmatic Programmers</a></li>
</ul> <a rel="nofollow" target="_blank" href="http://feeds.wordpress.com/1.0/gocomments/mmiika.wordpress.com/57/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mmiika.wordpress.com/57/"/></a> <a rel="nofollow" target="_blank" href="http://feeds.wordpress.com/1.0/godelicious/mmiika.wordpress.com/57/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mmiika.wordpress.com/57/"/></a> <a rel="nofollow" target="_blank" href="http://feeds.wordpress.com/1.0/gostumble/mmiika.wordpress.com/57/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mmiika.wordpress.com/57/"/></a> <a rel="nofollow" target="_blank" href="http://feeds.wordpress.com/1.0/godigg/mmiika.wordpress.com/57/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mmiika.wordpress.com/57/"/></a> <a rel="nofollow" target="_blank" href="http://feeds.wordpress.com/1.0/goreddit/mmiika.wordpress.com/57/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mmiika.wordpress.com/57/"/></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mmiika.wordpress.com&blog=3798048&post=57&subd=mmiika&ref=&feed=1"/></div>]]></content:encoded>
         <media:content url="http://1.gravatar.com/avatar/b015344ba49711e90affd0687f854dba?s=96&amp;amp;d=identicon" medium="image">
            <media:title>mmiika</media:title>
         </media:content>
      </item>
      <item>
         <title>Set up Khmer fonts</title>
         <link>http://sareuon.blogspot.com/2008/09/khkhj.html</link>
         <description>Hi, this is my first article for my blog. This is about how to setup khmer fornts on ubuntu both true type fonts and unicode. To install khmer fonts you can do following :&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Copy the fonts files from Microsoft Windows (C:&amp;#92;Windows&amp;#92;Fonts) or you can download it from internet by searching on google, yahoo or the other search engine.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Create new folder to store new fonts in &quot; /usr/local/share &quot; Ex. &lt;span style=&quot;font-weight:bold;&quot;&gt;cambodia&lt;/span&gt; and place all copy's fonts you wish to install on this new folder.&lt;/li&gt;&lt;li&gt;Open terminal ( Application -&amp;gt; Accessories -&amp;gt; Terminal) the type &lt;span style=&quot;font-weight:bold;&quot;&gt;$sudo fc-cache -fv &lt;/span&gt;to clear cache.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;To be able to type unicode in ubuntu go to (System -&amp;gt; Preferences -&amp;gt; Keyboard -&amp;gt; Layouts -&amp;gt;Add ) from Layouts select cambodia and click Add&lt;/li&gt;&lt;li&gt;After you Add cambodia keyboard you can set Layout Options and chose you favorite Layout switching&lt;br /&gt;&lt;/li&gt;&lt;/ol&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2359002249313379007-6554818490878419590?l=sareuon.blogspot.com'/&gt;&lt;/div&gt;</description>
         <author>noreply@blogger.com (Sareuon)</author>
         <guid isPermaLink="false">tag:blogger.com,1999:blog-2359002249313379007.post-6554818490878419590</guid>
         <pubDate>Tue, 16 Sep 2008 03:29:00 -0700</pubDate>
      </item>
      <item>
         <title>Re: free c# lecturing session</title>
         <link>http://groups.google.com/group/ppppkh/browse_thread/thread/abf999f5e8f5fd37/a13dacefec165039?show_docid=a13dacefec165039</link>
         <author>c.sokun</author>
         <guid isPermaLink="false">http://groups.google.com/group/ppppkh/browse_thread/thread/abf999f5e8f5fd37/a13dacefec165039?show_docid=a13dacefec165039</guid>
         <pubDate>Fri, 12 Sep 2008 19:52:56 -0700</pubDate>
      </item>
      <item>
         <title>SQL_BIG_SELECTS</title>
         <link>http://vuthysan.blogspot.com/2008/09/sqlbigselects.html</link>
         <description>Before I had one problem that can not execute big query in my Search page.It's because of web-hosting not allow to execute big query. So we have to add one line bellow before the big query like this:&lt;br /&gt;ActiveRecord::Base.connection.execute('SET SQL_BIG_SELECTS = on')&lt;br /&gt;Place.find_by_sql(&quot;..............&quot;)&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5092296896310373218-3673576625412134258?l=vuthysan.blogspot.com' alt=''/&gt;&lt;/div&gt;</description>
         <author>noreply@blogger.com (Vuthy)</author>
         <guid isPermaLink="false">tag:blogger.com,1999:blog-5092296896310373218.post-3673576625412134258</guid>
         <pubDate>Fri, 12 Sep 2008 00:00:00 -0700</pubDate>
      </item>
      <item>
         <title>Yahoo! BOSS for Ruby</title>
         <link>http://ungsophy.blogspot.com/2008/09/yahoo-boss-for-ruby.html</link>
         <description>Yahoo! launched &lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;http://developer.yahoo.com/search/boss/&quot;&gt;BOSS&lt;/a&gt;. It is a service that allows you to search the entire Yahoo! Search index. It is really cool. Meanwhile, Jay Pignata has developed a ruby library, BOSSMan, for Rubyists to mess around with Yahoo! search web service. &lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;http://github.com/jpignata/bossman-gem/tree/master&quot;&gt;BOSSMan&lt;/a&gt; lives on Github. If you wanna try just:&lt;br /&gt;&lt;pre style=&quot;font-family:courier new;&quot;&gt;gem sources -a http://gems.github.com&lt;br /&gt;gem install jpignata-bossman&lt;br /&gt;&lt;/pre&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6020668935883798887-103607047874672813?l=ungsophy.blogspot.com'/&gt;&lt;/div&gt;</description>
         <author>Sophy</author>
         <guid isPermaLink="false">tag:blogger.com,1999:blog-6020668935883798887.post-103607047874672813</guid>
         <pubDate>Wed, 03 Sep 2008 19:55:00 -0700</pubDate>
      </item>
      <item>
         <title>Re: Scrum training</title>
         <link>http://groups.google.com/group/ppppkh/browse_thread/thread/9c55f5fc297d95d5/b9c66ecbf865fe65?show_docid=b9c66ecbf865fe65</link>
         <author>Chris Brown</author>
         <guid isPermaLink="false">http://groups.google.com/group/ppppkh/browse_thread/thread/9c55f5fc297d95d5/b9c66ecbf865fe65?show_docid=b9c66ecbf865fe65</guid>
         <pubDate>Mon, 01 Sep 2008 06:30:26 -0700</pubDate>
      </item>
      <item>
         <title>Re: free c# lecturing session</title>
         <link>http://groups.google.com/group/ppppkh/browse_thread/thread/abf999f5e8f5fd37/c32eac8c2c93ebc8?show_docid=c32eac8c2c93ebc8</link>
         <author>Miika Makinen</author>
         <guid isPermaLink="false">http://groups.google.com/group/ppppkh/browse_thread/thread/abf999f5e8f5fd37/c32eac8c2c93ebc8?show_docid=c32eac8c2c93ebc8</guid>
         <pubDate>Sun, 31 Aug 2008 23:48:28 -0700</pubDate>
      </item>
      <item>
         <title>Re: free c# lecturing session</title>
         <link>http://groups.google.com/group/ppppkh/browse_thread/thread/abf999f5e8f5fd37/8f62393ba1ab0b67?show_docid=8f62393ba1ab0b67</link>
         <author>c.sokun</author>
         <guid isPermaLink="false">http://groups.google.com/group/ppppkh/browse_thread/thread/abf999f5e8f5fd37/8f62393ba1ab0b67?show_docid=8f62393ba1ab0b67</guid>
         <pubDate>Sun, 31 Aug 2008 23:34:55 -0700</pubDate>
      </item>
      <item>
         <title>Re: free c# lecturing session</title>
         <link>http://groups.google.com/group/ppppkh/browse_thread/thread/abf999f5e8f5fd37/2be1c57a34c24007?show_docid=2be1c57a34c24007</link>
         <author>Miika Makinen</author>
         <guid isPermaLink="false">http://groups.google.com/group/ppppkh/browse_thread/thread/abf999f5e8f5fd37/2be1c57a34c24007?show_docid=2be1c57a34c24007</guid>
         <pubDate>Sun, 31 Aug 2008 22:09:48 -0700</pubDate>
      </item>
      <item>
         <title>Re: free c# lecturing session</title>
         <link>http://groups.google.com/group/ppppkh/browse_thread/thread/abf999f5e8f5fd37/9e7208d61df77b26?show_docid=9e7208d61df77b26</link>
         <author>c.sokun</author>
         <guid isPermaLink="false">http://groups.google.com/group/ppppkh/browse_thread/thread/abf999f5e8f5fd37/9e7208d61df77b26?show_docid=9e7208d61df77b26</guid>
         <pubDate>Sun, 31 Aug 2008 22:01:07 -0700</pubDate>
      </item>
      <item>
         <title>Re: free c# lecturing session</title>
         <link>http://groups.google.com/group/ppppkh/browse_thread/thread/abf999f5e8f5fd37/89c0ace6c98e46ae?show_docid=89c0ace6c98e46ae</link>
         <author>Samnang</author>
         <guid isPermaLink="false">http://groups.google.com/group/ppppkh/browse_thread/thread/abf999f5e8f5fd37/89c0ace6c98e46ae?show_docid=89c0ace6c98e46ae</guid>
         <pubDate>Sun, 31 Aug 2008 21:54:19 -0700</pubDate>
      </item>
      <item>
         <title>Re: free c# lecturing session</title>
         <link>http://groups.google.com/group/ppppkh/browse_thread/thread/abf999f5e8f5fd37/8ab8d8150c77dea6?show_docid=8ab8d8150c77dea6</link>
         <author>Miika</author>
         <guid isPermaLink="false">http://groups.google.com/group/ppppkh/browse_thread/thread/abf999f5e8f5fd37/8ab8d8150c77dea6?show_docid=8ab8d8150c77dea6</guid>
         <pubDate>Sun, 31 Aug 2008 21:25:14 -0700</pubDate>
      </item>
      <item>
         <title>Re: Scrum training</title>
         <link>http://groups.google.com/group/ppppkh/browse_thread/thread/9c55f5fc297d95d5/39bb8c39a549dba0?show_docid=39bb8c39a549dba0</link>
         <author>Miika Makinen</author>
         <guid isPermaLink="false">http://groups.google.com/group/ppppkh/browse_thread/thread/9c55f5fc297d95d5/39bb8c39a549dba0?show_docid=39bb8c39a549dba0</guid>
         <pubDate>Sun, 31 Aug 2008 21:22:30 -0700</pubDate>
      </item>
      <item>
         <title>free c# lecturing session</title>
         <link>http://groups.google.com/group/ppppkh/browse_thread/thread/abf999f5e8f5fd37/fe698478db6f751d?show_docid=fe698478db6f751d</link>
         <author>c.sokun</author>
         <guid isPermaLink="false">http://groups.google.com/group/ppppkh/browse_thread/thread/abf999f5e8f5fd37/fe698478db6f751d?show_docid=fe698478db6f751d</guid>
         <pubDate>Sun, 31 Aug 2008 20:46:46 -0700</pubDate>
      </item>
      <item>
         <title>Save_without_validation</title>
         <link>http://vuthysan.blogspot.com/2008/08/first-blog.html</link>
         <description>This snip code bellow show about save a new record without validation&lt;br /&gt;&lt;br /&gt;photo = Photo.new&lt;br /&gt;photo.name = &quot;&quot;&lt;br /&gt;photo.save(false)&lt;br /&gt;&lt;br /&gt;if we use &lt;b&gt;update_attribute_with_validation_skipping&lt;/b&gt;(name, value) to update record without validation and want to success this task when we user find_by_sql to find that record we must to select all fields of that record.otherwise it will not effect at all.&lt;br /&gt;biz = Photo.find_by_sql(..............)&lt;br /&gt;biz.update_attribute_with_validation_skipping(&quot;request_date&quot;, Time.now)&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5092296896310373218-2999492964558349184?l=vuthysan.blogspot.com' alt=''/&gt;&lt;/div&gt;</description>
         <author>noreply@blogger.com (Vuthy)</author>
         <guid isPermaLink="false">tag:blogger.com,1999:blog-5092296896310373218.post-2999492964558349184</guid>
         <pubDate>Fri, 22 Aug 2008 23:26:00 -0700</pubDate>
      </item>
      <item>
         <title>Congrats Canadia Bank…</title>
         <link>http://mmiika.wordpress.com/2008/08/21/congrats-canadia-bank/</link>
         <description>Well done! Canadia bank website has manage to get into listed as an attack site&amp;#8230; http://www.google.com/search?q=canadia+bank
I have an account there :( &lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://stats.wordpress.com/b.gif?host=mmiika.wordpress.com&amp;blog=3798048&amp;post=52&amp;subd=mmiika&amp;ref=&amp;feed=1&quot;/&gt;</description>
         <guid isPermaLink="false">http://mmiika.wordpress.com/?p=52</guid>
         <pubDate>Thu, 21 Aug 2008 03:01:37 -0700</pubDate>
         <content:encoded><![CDATA[<div class='snap_preview'><br /><p>Well done! Canadia bank website has manage to get into listed as an attack site&#8230; <a rel="nofollow" target="_blank" href="http://www.google.com/search?q=canadia+bank">http://www.google.com/search?q=canadia+bank</a></p>
<p>I have an account there :(</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/mmiika.wordpress.com/52/"/> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/mmiika.wordpress.com/52/"/> <a rel="nofollow" target="_blank" href="http://feeds.wordpress.com/1.0/gocomments/mmiika.wordpress.com/52/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mmiika.wordpress.com/52/"/></a> <a rel="nofollow" target="_blank" href="http://feeds.wordpress.com/1.0/godelicious/mmiika.wordpress.com/52/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mmiika.wordpress.com/52/"/></a> <a rel="nofollow" target="_blank" href="http://feeds.wordpress.com/1.0/gostumble/mmiika.wordpress.com/52/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mmiika.wordpress.com/52/"/></a> <a rel="nofollow" target="_blank" href="http://feeds.wordpress.com/1.0/godigg/mmiika.wordpress.com/52/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mmiika.wordpress.com/52/"/></a> <a rel="nofollow" target="_blank" href="http://feeds.wordpress.com/1.0/goreddit/mmiika.wordpress.com/52/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mmiika.wordpress.com/52/"/></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mmiika.wordpress.com&blog=3798048&post=52&subd=mmiika&ref=&feed=1"/></div>]]></content:encoded>
         <media:content url="http://1.gravatar.com/avatar/b015344ba49711e90affd0687f854dba?s=96&amp;amp;d=identicon" medium="image">
            <media:title>mmiika</media:title>
         </media:content>
      </item>
      <item>
         <title>Prawn generates PDF</title>
         <link>http://ungsophy.blogspot.com/2008/08/prawn-generates-pdf.html</link>
         <description>You can use Prawn to generate PDF. Prawn is a ruby library that make PDF creation possible in Ruby. &lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;http://prawn.majesticseacreature.com/&quot;&gt;more &lt;img width=&quot;36&quot; alt=&quot;prawn.png&quot; src=&quot;http://www.rubyinside.com/wp-content/uploads/2008/08/prawn.jpg&quot;/&gt;&lt;/a&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6020668935883798887-2578418007760746581?l=ungsophy.blogspot.com'/&gt;&lt;/div&gt;</description>
         <author>Sophy</author>
         <guid isPermaLink="false">tag:blogger.com,1999:blog-6020668935883798887.post-2578418007760746581</guid>
         <pubDate>Thu, 14 Aug 2008 20:33:00 -0700</pubDate>
      </item>
      <item>
         <title>Ruby to JavaScript</title>
         <link>http://ungsophy.blogspot.com/2008/08/ruby-to-javascript.html</link>
         <description>If you are a fan of Ruby and you want to write JavaScript code, you don't need to learn JavaScript. You can write JavaScript code by using RED. RED is a ruby library that will convert Ruby code to JavaScript code. &lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;http://wonderfullyflawed.com/2008/08/07/javascript-makes-me-see-red/&quot;&gt;Check this out!&lt;/a&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6020668935883798887-3274245190116771906?l=ungsophy.blogspot.com'/&gt;&lt;/div&gt;</description>
         <author>Sophy</author>
         <guid isPermaLink="false">tag:blogger.com,1999:blog-6020668935883798887.post-3274245190116771906</guid>
         <pubDate>Thu, 14 Aug 2008 11:22:00 -0700</pubDate>
      </item>
      <item>
         <title>IRC channel to talk about patterns and practices</title>
         <link>http://groups.google.com/group/ppppkh/browse_thread/thread/3d9367380ad5d13e/674b7436b0ba6d40?show_docid=674b7436b0ba6d40</link>
         <author>Miika Makinen</author>
         <guid isPermaLink="false">http://groups.google.com/group/ppppkh/browse_thread/thread/3d9367380ad5d13e/674b7436b0ba6d40?show_docid=674b7436b0ba6d40</guid>
         <pubDate>Thu, 14 Aug 2008 02:28:38 -0700</pubDate>
      </item>
      <item>
         <title>IRC channel for patterns, practices and principles</title>
         <link>http://mmiika.wordpress.com/2008/08/14/irc-channel-for-patterns-practices-and-principles/</link>
         <description>I could not find any decent IRC channel for pragmatic programmers, so I&amp;#8217;ve just created one: irc://freenode/*dd. So, if you are into chatting [...]&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://stats.wordpress.com/b.gif?host=mmiika.wordpress.com&amp;blog=3798048&amp;post=45&amp;subd=mmiika&amp;ref=&amp;feed=1&quot;/&gt;</description>
         <guid isPermaLink="false">http://mmiika.wordpress.com/?p=45</guid>
         <pubDate>Thu, 14 Aug 2008 01:50:34 -0700</pubDate>
         <content:encoded><![CDATA[<div class='snap_preview'><br /><p>I could not find any decent IRC channel for pragmatic programmers, so I&#8217;ve just created one: <a rel="nofollow" id="ch-url-anchor" class="chatzilla-link">irc://freenode/*dd</a>. So, if you are into chatting about &#8220;advanced&#8221; programming topics like DDD, BDD/TDD, patterns or other similar subjects (language independent), come on in!</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/mmiika.wordpress.com/45/"/> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/mmiika.wordpress.com/45/"/> <a rel="nofollow" target="_blank" href="http://feeds.wordpress.com/1.0/gocomments/mmiika.wordpress.com/45/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mmiika.wordpress.com/45/"/></a> <a rel="nofollow" target="_blank" href="http://feeds.wordpress.com/1.0/godelicious/mmiika.wordpress.com/45/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mmiika.wordpress.com/45/"/></a> <a rel="nofollow" target="_blank" href="http://feeds.wordpress.com/1.0/gostumble/mmiika.wordpress.com/45/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mmiika.wordpress.com/45/"/></a> <a rel="nofollow" target="_blank" href="http://feeds.wordpress.com/1.0/godigg/mmiika.wordpress.com/45/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mmiika.wordpress.com/45/"/></a> <a rel="nofollow" target="_blank" href="http://feeds.wordpress.com/1.0/goreddit/mmiika.wordpress.com/45/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mmiika.wordpress.com/45/"/></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mmiika.wordpress.com&blog=3798048&post=45&subd=mmiika&ref=&feed=1"/></div>]]></content:encoded>
         <media:content url="http://1.gravatar.com/avatar/b015344ba49711e90affd0687f854dba?s=96&amp;amp;d=identicon" medium="image">
            <media:title>mmiika</media:title>
         </media:content>
      </item>
      <item>
         <title>Firefox 3 and localhost on Vista</title>
         <link>http://mmiika.wordpress.com/2008/08/08/firefox-3-and-localhost-on-vista/</link>
         <description>Symptom: Firefox 3 does not find localhost on Windows Vista, but does find the ip 127.0.0.1
Cure: Type &amp;#8220;about:config&amp;#8221; to Firefox address bar, and set network.dns.disableIPv6 to true &lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://stats.wordpress.com/b.gif?host=mmiika.wordpress.com&amp;blog=3798048&amp;post=42&amp;subd=mmiika&amp;ref=&amp;feed=1&quot;/&gt;</description>
         <guid isPermaLink="false">http://mmiika.wordpress.com/?p=42</guid>
         <pubDate>Thu, 07 Aug 2008 18:09:49 -0700</pubDate>
         <content:encoded><![CDATA[<div class='snap_preview'><br /><p><strong>Symptom: </strong>Firefox 3 does not find localhost on Windows Vista, but does find the ip 127.0.0.1</p>
<p><strong>Cure:</strong> Type &#8220;about:config&#8221; to Firefox address bar, and set <strong>network.dns.disableIPv6 </strong>to <strong>true</strong></p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/mmiika.wordpress.com/42/"/> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/mmiika.wordpress.com/42/"/> <a rel="nofollow" target="_blank" href="http://feeds.wordpress.com/1.0/gocomments/mmiika.wordpress.com/42/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mmiika.wordpress.com/42/"/></a> <a rel="nofollow" target="_blank" href="http://feeds.wordpress.com/1.0/godelicious/mmiika.wordpress.com/42/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mmiika.wordpress.com/42/"/></a> <a rel="nofollow" target="_blank" href="http://feeds.wordpress.com/1.0/gostumble/mmiika.wordpress.com/42/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mmiika.wordpress.com/42/"/></a> <a rel="nofollow" target="_blank" href="http://feeds.wordpress.com/1.0/godigg/mmiika.wordpress.com/42/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mmiika.wordpress.com/42/"/></a> <a rel="nofollow" target="_blank" href="http://feeds.wordpress.com/1.0/goreddit/mmiika.wordpress.com/42/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mmiika.wordpress.com/42/"/></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mmiika.wordpress.com&blog=3798048&post=42&subd=mmiika&ref=&feed=1"/></div>]]></content:encoded>
         <media:content url="http://1.gravatar.com/avatar/b015344ba49711e90affd0687f854dba?s=96&amp;amp;d=identicon" medium="image">
            <media:title>mmiika</media:title>
         </media:content>
      </item>
      <item>
         <title>Re: Scrum training</title>
         <link>http://groups.google.com/group/ppppkh/browse_thread/thread/9c55f5fc297d95d5/66464359214bd150?show_docid=66464359214bd150</link>
         <author>Chris Brown</author>
         <guid isPermaLink="false">http://groups.google.com/group/ppppkh/browse_thread/thread/9c55f5fc297d95d5/66464359214bd150?show_docid=66464359214bd150</guid>
         <pubDate>Tue, 05 Aug 2008 21:53:27 -0700</pubDate>
      </item>
      <item>
         <title>Re: Scrum training</title>
         <link>http://groups.google.com/group/ppppkh/browse_thread/thread/9c55f5fc297d95d5/390f343dc88f30f3?show_docid=390f343dc88f30f3</link>
         <author>Miika</author>
         <guid isPermaLink="false">http://groups.google.com/group/ppppkh/browse_thread/thread/9c55f5fc297d95d5/390f343dc88f30f3?show_docid=390f343dc88f30f3</guid>
         <pubDate>Mon, 04 Aug 2008 22:53:18 -0700</pubDate>
      </item>
      <item>
         <title>LOC5</title>
         <link>http://mmiika.wordpress.com/2008/08/02/loc5/</link>
         <description>total([{Item, Amount}&amp;#124;T]) -&amp;#62; price(Item) * Amount + total(T); &lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://stats.wordpress.com/b.gif?host=mmiika.wordpress.com&amp;blog=3798048&amp;post=39&amp;subd=mmiika&amp;ref=&amp;feed=1&quot;/&gt;</description>
         <guid isPermaLink="false">http://mmiika.wordpress.com/?p=39</guid>
         <pubDate>Sat, 02 Aug 2008 02:54:21 -0700</pubDate>
         <content:encoded><![CDATA[<div class='snap_preview'><br /><p>total([{Item, Amount}|T]) -&gt; price(Item) * Amount + total(T);</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/mmiika.wordpress.com/39/"/> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/mmiika.wordpress.com/39/"/> <a rel="nofollow" target="_blank" href="http://feeds.wordpress.com/1.0/gocomments/mmiika.wordpress.com/39/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mmiika.wordpress.com/39/"/></a> <a rel="nofollow" target="_blank" href="http://feeds.wordpress.com/1.0/godelicious/mmiika.wordpress.com/39/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mmiika.wordpress.com/39/"/></a> <a rel="nofollow" target="_blank" href="http://feeds.wordpress.com/1.0/gostumble/mmiika.wordpress.com/39/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mmiika.wordpress.com/39/"/></a> <a rel="nofollow" target="_blank" href="http://feeds.wordpress.com/1.0/godigg/mmiika.wordpress.com/39/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mmiika.wordpress.com/39/"/></a> <a rel="nofollow" target="_blank" href="http://feeds.wordpress.com/1.0/goreddit/mmiika.wordpress.com/39/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mmiika.wordpress.com/39/"/></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mmiika.wordpress.com&blog=3798048&post=39&subd=mmiika&ref=&feed=1"/></div>]]></content:encoded>
         <media:content url="http://1.gravatar.com/avatar/b015344ba49711e90affd0687f854dba?s=96&amp;amp;d=identicon" medium="image">
            <media:title>mmiika</media:title>
         </media:content>
      </item>
      <item>
         <title>Master Scrum</title>
         <link>http://mmiika.wordpress.com/2008/07/16/master-scrum/</link>
         <description>We might be able to pull off Certified Scrum Master training class here in Phnom Penh, Cambodia, if there are enough interested people. I did this class a while ago and it was probably the best thing I&amp;#8217;ve ever done in my life. Ok, maybe I&amp;#8217;m exaggerating a tiny bit there&amp;#8230; but ask anybody [...]&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://stats.wordpress.com/b.gif?host=mmiika.wordpress.com&amp;blog=3798048&amp;post=18&amp;subd=mmiika&amp;ref=&amp;feed=1&quot;/&gt;</description>
         <guid isPermaLink="false">http://mmiika.wordpress.com/?p=18</guid>
         <pubDate>Tue, 15 Jul 2008 17:17:33 -0700</pubDate>
         <content:encoded><![CDATA[<div class='snap_preview'><br /><p>We might be able to pull off Certified Scrum Master training class here in Phnom Penh, Cambodia, if there are enough interested people. I did this class a while ago and it was probably the best thing I&#8217;ve ever done in my life. Ok, maybe I&#8217;m exaggerating a tiny bit there&#8230; but ask anybody in our office and I&#8217;m sure they&#8217;ll say adopting scrum has been *hugely great*.</p>
<p>Anybody interested?</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/mmiika.wordpress.com/18/"/> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/mmiika.wordpress.com/18/"/> <a rel="nofollow" target="_blank" href="http://feeds.wordpress.com/1.0/gocomments/mmiika.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mmiika.wordpress.com/18/"/></a> <a rel="nofollow" target="_blank" href="http://feeds.wordpress.com/1.0/godelicious/mmiika.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mmiika.wordpress.com/18/"/></a> <a rel="nofollow" target="_blank" href="http://feeds.wordpress.com/1.0/gostumble/mmiika.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mmiika.wordpress.com/18/"/></a> <a rel="nofollow" target="_blank" href="http://feeds.wordpress.com/1.0/godigg/mmiika.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mmiika.wordpress.com/18/"/></a> <a rel="nofollow" target="_blank" href="http://feeds.wordpress.com/1.0/goreddit/mmiika.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mmiika.wordpress.com/18/"/></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mmiika.wordpress.com&blog=3798048&post=18&subd=mmiika&ref=&feed=1"/></div>]]></content:encoded>
         <media:content url="http://1.gravatar.com/avatar/b015344ba49711e90affd0687f854dba?s=96&amp;amp;d=identicon" medium="image">
            <media:title>mmiika</media:title>
         </media:content>
      </item>
      <item>
         <title>JavaScript: Behavior Driven Development / Test Driven Development Tools Roundup</title>
         <link>http://chrisincambo.wordpress.com/2008/07/14/javascript-behavior-driven-development-test-driven-development-tools-roundup/</link>
         <description>I&amp;#8217;m sure with size, complexity and sheer number of JavaScript applications and frameworks that have been poring into production over the last few years, there must be a lot of developers out there putting serious effort into testing. Despite this there seems to be quite a low amount of information on the web about the [...]&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://stats.wordpress.com/b.gif?host=chrisincambo.wordpress.com&amp;blog=4041893&amp;post=15&amp;subd=chrisincambo&amp;ref=&amp;feed=1&quot;/&gt;</description>
         <guid isPermaLink="false">http://chrisincambo.wordpress.com/?p=15</guid>
         <pubDate>Mon, 14 Jul 2008 08:01:06 -0700</pubDate>
         <content:encoded><![CDATA[<div class='snap_preview'><br /><p>I&#8217;m sure with size, complexity and sheer number of JavaScript applications and frameworks that have been poring into production over the last few years, there must be a lot of developers out there putting serious effort into testing. Despite this there seems to be quite a low amount of information on the web about the tools and frameworks that are available. So I thought I would share the with you my own personal experiences when it comes to the tools that are out there.</p>
<p><strong>Spec and Testing Frameworks:</strong></p>
<p>This is an area JavaScript has pretty much got nailed with two great offering for both the xUnit and xSpec/xBehave crowds.</p>
<p><a rel="nofollow" target="_blank" href="http://jania.pe.kr/aw/moin.cgi/JSSpec#head-7c8c71ed9dd60af7680034a40e03a0e2b92e70f7"><strong>JSSpec</strong></a></p>
<p>I really don&#8217;t know what I would do without this great BDD framework written by 강규영 (a.k.a Alan Kang). It follows the standard semantics of BDD and has an extremely natural DSL which I&#8217;ve seen developers get up and running with in under ten minutes.</p>
<pre>
describe('Plus operation', { 'should concatenate two strings': function() { value_of("Hello " + "World").should_be("Hello World"); }, 'should add two numbers': function() { value_of(1 + 2).should_be(3); }
});
</pre>
<p>The spec runner is also quite something to behold as it runs through each spec within the suite for your story. I still believe that a GUI or web interface as is the case in JSSpec is a very powerful tool when conveying the value of thorough testing to the product owner. I even had a product owner bring stakeholders into the office who have no idea about BDD or any software development practices for that matter just to show them the tests.</p>
<p>There are a few &#8216;quirks&#8217;, such as extending some of JavaScript&#8217;s base type classes and a small sprinkling of global variables but that&#8217;s a small price to pay in the name of elegant DSL, besides the code is very readable which means you can easily get in there and make some tweaks if you would prefer a slightly less flowing DSL in return for a clean namespace.</p>
<p><a rel="nofollow" target="_blank" href="http://jsunit.net/"><strong>JSUnit</strong></a></p>
<p>I used this JavaScript port of JUnit for a long time before I discovered BDD and then JSSpec. It is a very well supported framework and is very good at what it does, but as is the problem with all of the xUnit family of test suites it doesn&#8217;t have a clearly defined set of semantics for testing other than assertThis and assertThat so therefore can&#8217;t really have a DSL, so instead we have a collection of functions and a lot of room for developers to fill in the blanks.</p>
<pre>
function testPlusOperation() { assertEquals("Hello " + "World", "Hello World"); assertEquals(1 + 2, 3);
}
</pre>
<p>For people who are experienced at testing it works great, for those who aren&#8217;t things can get very ugly, very quickly. It also has a nice test runner, but the green progress bar just doesn&#8217;t have the same impact in conveying the sheer weight of the tests it is running through in the same way JSSpec does, it is very functional but isn&#8217;t going to impress the stakeholders. To sum up as I said already I can&#8217;t knock the software itself, it does exactly what is says on the box.</p>
<p><strong>Mocking Frameworks:</strong></p>
<p>Unfortunately the two offerings for mocking frameworks aren&#8217;t nearly as strong as their spec/test counterparts discussed already. They both have their ups and downs but one major flaw they both share is an inability to reliably get the public methods from your class (function) constructors and this is in part a JavaScript problem. In order for the mocking frameworks to retrieve the public methods which may be contained within your classes constructor rather than its prototype, the class has to be instantiated so that the the properties can be iterated through to see if the expected method can be found there. This is great, but the problem comes when your class is dependent on an argument passed in to the constructor. Like so:</p>
<pre>
function MyClass(dependancyObject){ this.foo = dependancyObject.someMethod();
}
</pre>
<p>When we pass MyClass over to be mocked, the mocking framework is not going to pass in an argument that implements the interface of the dependency object and therefore will raise an exception. Yes I already know there are umpteen good JavaScript coding practice that will avoid this problem, but the point is that a mocking framework should work as long as the code for my class is valid, regardless of whether it follows good practices or not.</p>
<p><a rel="nofollow" target="_blank" href="http://jsmock.sourceforge.net/"><strong>JSMock</strong></a></p>
<p>JSMock is cool little mocking framework with a very sexy DSL, the only problem is that it isn&#8217;t fully featured. It allows for you to add return value expectations to your mock object but does not allow you to place an expectation on the number of times the method will be called. This often results in this kind of thing:</p>
<pre>
myMock.expects().myVeryWellUsedMethod().andReturns(something)
myMock.expects().myVeryWellUsedMethod().andReturns(something)
myMock.expects().myVeryWellUsedMethod().andReturns(something)
myMock.expects().myVeryWellUsedMethod().andReturns(something)
myMock.expects().myVeryWellUsedMethod().andReturns(something)
myMock.expects().myVeryWellUsedMethod().andReturns(something)
myMock.expects().myVeryWellUsedMethod().andReturns(something)
myMock.expects().myVeryWellUsedMethod().andReturns(something)
</pre>
<p>When what I REALLY REALLY want to do is this:</p>
<pre>
myMock.expects().myVeryWellUsedMethod().times(8).andReturns(something)
</pre>
<p>Or if we were a bit naughty and had extended the Number.prototype, maybe even something like this:</p>
<pre>
myMock.expects().myVeryWellUsedMethod().8.times().andReturns(something)
</pre>
<p>But what we all to often end up with is this:</p>
<pre>
// <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_sad.gif' alt=':-(' class='wp-smiley'/>
var myStub = function(){ myVeryWellUsedMethod: function(){ return something; }
};
</pre>
<p>There is also no support giving expectations to the parameters passed to methods of the mock object. Personally with my normal usage patterns I seem to be able to live with that, but I know that for other people it is a big issue. I know I sound like I&#8217;ve come down quite hard on JSMock but that&#8217;s only because I really love the DSL and know that with just a couple more features it could have been perfect.</p>
<p><a rel="nofollow" target="_blank" href="http://mock4js.sourceforge.net/"><strong>Mock4js</strong></a></p>
<p>While JSMock falls short on features, I very much doubt you will hear many people laying the same charge against Mock4js. It has everything you would expect from a fully featured mocking framework, we can set expectations for our mock methods on the arguments passed, the return values, the number of times we expect it to be called and can also quickly knock up stubs if you are that way inclined.<br />
But don&#8217;t start getting too excited quite yet. The DSL is not very smooth, meaning it will take a few days before you are writing mocks without having to check the docs, but this is a small issue compared to the havoc it causes in your namespace. In order to be able to create mocks you need to make a call like so:</p>
<pre>
Mock4JS.addMockSupport(this);
</pre>
<p>This method then proceeds to decorate whichever namespace &#8216;this&#8217; is referring to (usually global or that of your testing framework) with a sh!t load of methods. The first time I used it was within in the JSSpec namespace and straight away there was a collision.<br />
“And that&#8217;s all I have to say about that”. Forrest Gump.</p>
<p><strong>Code Coverage Tools</strong></p>
<p>Although I&#8217;m not anywhere as religious about code coverage as I am to other aspects of testing, especially in JavaScript where inconsistencies often mean you have whole modules that were designed only for a single browser, SVG/VML type applications spring to mind. This means a file can receive 100% coverage in one browser and 0% in another. Despite these glaring inconsistencies code coverage is still useful to find any large gaps, especially if you are a lead developer working on a large code base with a large team where monitoring manually can be a real pain.</p>
<p><a rel="nofollow" target="_blank" href="http://siliconforks.com/jscoverage/"><strong>JSCoverage</strong></a></p>
<p>JSCoverage is a cool command line app that runs through your projects folder and recreates the project in a new folder only with some added &#8217;special sauce&#8217;. You will now be able to point there web interface to the HTML page of you test suite and get back a detailed coverage report.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/chrisincambo.wordpress.com/15/"/> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/chrisincambo.wordpress.com/15/"/> <a rel="nofollow" target="_blank" href="http://feeds.wordpress.com/1.0/gocomments/chrisincambo.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/chrisincambo.wordpress.com/15/"/></a> <a rel="nofollow" target="_blank" href="http://feeds.wordpress.com/1.0/godelicious/chrisincambo.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/chrisincambo.wordpress.com/15/"/></a> <a rel="nofollow" target="_blank" href="http://feeds.wordpress.com/1.0/gostumble/chrisincambo.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/chrisincambo.wordpress.com/15/"/></a> <a rel="nofollow" target="_blank" href="http://feeds.wordpress.com/1.0/godigg/chrisincambo.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/chrisincambo.wordpress.com/15/"/></a> <a rel="nofollow" target="_blank" href="http://feeds.wordpress.com/1.0/goreddit/chrisincambo.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/chrisincambo.wordpress.com/15/"/></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=chrisincambo.wordpress.com&blog=4041893&post=15&subd=chrisincambo&ref=&feed=1"/></div>]]></content:encoded>
         <media:content url="" medium="image">
            <media:title>chrisincambo</media:title>
         </media:content>
      </item>
      <item>
         <title>Mono on Ubuntu Hardy</title>
         <link>http://mmiika.wordpress.com/2008/07/13/mono-on-ubuntu-hardy/</link>
         <description>sudo apt-get install monodevelop
sudo apt-get install mono-gmcs
Is it possible to code without R#? &lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://stats.wordpress.com/b.gif?host=mmiika.wordpress.com&amp;blog=3798048&amp;post=35&amp;subd=mmiika&amp;ref=&amp;feed=1&quot;/&gt;</description>
         <guid isPermaLink="false">http://mmiika.wordpress.com/?p=35</guid>
         <pubDate>Sun, 13 Jul 2008 06:16:52 -0700</pubDate>
         <content:encoded><![CDATA[<div class='snap_preview'><br /><ol>
<li>sudo apt-get install monodevelop</li>
<li>sudo apt-get install mono-gmcs</li>
<li>Is it possible to code without R#?</li>
</ol>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/mmiika.wordpress.com/35/"/> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/mmiika.wordpress.com/35/"/> <a rel="nofollow" target="_blank" href="http://feeds.wordpress.com/1.0/gocomments/mmiika.wordpress.com/35/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mmiika.wordpress.com/35/"/></a> <a rel="nofollow" target="_blank" href="http://feeds.wordpress.com/1.0/godelicious/mmiika.wordpress.com/35/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mmiika.wordpress.com/35/"/></a> <a rel="nofollow" target="_blank" href="http://feeds.wordpress.com/1.0/gostumble/mmiika.wordpress.com/35/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mmiika.wordpress.com/35/"/></a> <a rel="nofollow" target="_blank" href="http://feeds.wordpress.com/1.0/godigg/mmiika.wordpress.com/35/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mmiika.wordpress.com/35/"/></a> <a rel="nofollow" target="_blank" href="http://feeds.wordpress.com/1.0/goreddit/mmiika.wordpress.com/35/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mmiika.wordpress.com/35/"/></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mmiika.wordpress.com&blog=3798048&post=35&subd=mmiika&ref=&feed=1"/></div>]]></content:encoded>
         <media:content url="http://1.gravatar.com/avatar/b015344ba49711e90affd0687f854dba?s=96&amp;amp;d=identicon" medium="image">
            <media:title>mmiika</media:title>
         </media:content>
      </item>
      <item>
         <title>Ubuntu Adventures</title>
         <link>http://mmiika.wordpress.com/2008/07/12/ubuntu-adventures/</link>
         <description>For me PC has equaled Microsoft since I sometime in late eighties/early nineties booted my fathers &amp;#8220;portable&amp;#8221; Panasonic into MS-DOS the first time. I also remember well the huge speed difference between 10 and 12 MHz 286s :) Anyways, the closest to Linux I ever came was the fact that Mr. Torvalds was born in [...]&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://stats.wordpress.com/b.gif?host=mmiika.wordpress.com&amp;blog=3798048&amp;post=30&amp;subd=mmiika&amp;ref=&amp;feed=1&quot;/&gt;</description>
         <guid isPermaLink="false">http://mmiika.wordpress.com/?p=30</guid>
         <pubDate>Sat, 12 Jul 2008 01:19:10 -0700</pubDate>
         <content:encoded><![CDATA[<div class='snap_preview'><br /><p>For me PC has equaled Microsoft since I sometime in late eighties/early nineties booted my fathers &#8220;portable&#8221; Panasonic into MS-DOS the first time. I also remember well the huge speed difference between 10 and 12 MHz 286s :) Anyways, the closest to Linux I ever came was the fact that Mr. Torvalds was born in same city as me. That is, until last couple of weeks. A &#8220;heated discussion&#8221; with Vista on my laptop lead me on a trip to Ubuntuland. Here&#8217;s a collection of thoughts:</p>
<p>Installation was a breeze. Truth be told, this is the first time I&#8217;ve installed any operating system and I was a bit scared. I found a perfect solution for me: <a rel="nofollow" target="_blank" href="http://wubi-installer.org/">Wubi</a>. As easy as installing any software on your machine!</p>
<p>A big difference between Windows and Linux world is the startup position. Windows installs with all bells and whistles turned on and Linux with them turned off. With Vista I&#8217;ve spent hours and hours trying to turn off services which slow me down and with Ubuntu I&#8217;ve spent the same hours installing services I need. Linux-way wins: It&#8217;s a lot more rewarding learning about processes you&#8217;ll need than learning about processes you&#8217;ll not need!</p>
<p>Linux has a DIY feel to it. I&#8217;ve never really wanted to install custom themes etc. to my Windows, but that was one of the first things I did with Ubuntu.</p>
<p>Terminal is your friend. I really like the fact that you learn from the beginning that most of the stuff can be done either in the terminal or with the GUI.</p>
<p>I really miss VIsual Studio, C# and Resharper while booted in Linux. Haven&#8217;t dared to try to run Mono yet.</p>
<p>Unpolished diamond? There are whole lot of things in Ubuntu (or with apps installed on it) still that need a bit of work. Couple of most annoying things: Firefox always starts in Offline mode (I&#8217;m using 3g phone as modem). No sound in Youtube videos for me.</p>
<p>Conclusion. I want to play with a Mac as well. I think OSs will and should become more specialized, one size just does not fit all. I actually like it now that I can boot into different world depending on my feeling/needs.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/mmiika.wordpress.com/30/"/> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/mmiika.wordpress.com/30/"/> <a rel="nofollow" target="_blank" href="http://feeds.wordpress.com/1.0/gocomments/mmiika.wordpress.com/30/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mmiika.wordpress.com/30/"/></a> <a rel="nofollow" target="_blank" href="http://feeds.wordpress.com/1.0/godelicious/mmiika.wordpress.com/30/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mmiika.wordpress.com/30/"/></a> <a rel="nofollow" target="_blank" href="http://feeds.wordpress.com/1.0/gostumble/mmiika.wordpress.com/30/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mmiika.wordpress.com/30/"/></a> <a rel="nofollow" target="_blank" href="http://feeds.wordpress.com/1.0/godigg/mmiika.wordpress.com/30/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mmiika.wordpress.com/30/"/></a> <a rel="nofollow" target="_blank" href="http://feeds.wordpress.com/1.0/goreddit/mmiika.wordpress.com/30/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mmiika.wordpress.com/30/"/></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mmiika.wordpress.com&blog=3798048&post=30&subd=mmiika&ref=&feed=1"/></div>]]></content:encoded>
         <media:content url="http://1.gravatar.com/avatar/b015344ba49711e90affd0687f854dba?s=96&amp;amp;d=identicon" medium="image">
            <media:title>mmiika</media:title>
         </media:content>
      </item>
      <item>
         <title>A Big Party?</title>
         <link>http://mmiika.wordpress.com/2008/07/12/a-big-party/</link>
         <description>How many times have you clicked through an installation dialog like a zombie, not really reading any stage but just going &amp;#8220;next&amp;#8221;. &amp;#8220;next&amp;#8221;? I admit doing that, but it gets worse: even web apps start to work a bit like that for me: testing a new app I&amp;#8217;ve found myself quite a few times &amp;#8220;assuming&amp;#8221; [...]&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://stats.wordpress.com/b.gif?host=mmiika.wordpress.com&amp;blog=3798048&amp;post=32&amp;subd=mmiika&amp;ref=&amp;feed=1&quot;/&gt;</description>
         <guid isPermaLink="false">http://mmiika.wordpress.com/?p=32</guid>
         <pubDate>Fri, 11 Jul 2008 21:35:31 -0700</pubDate>
         <content:encoded><![CDATA[<div class='snap_preview'><br /><p>How many times have you clicked through an installation dialog like a zombie, not really reading any stage but just going &#8220;next&#8221;. &#8220;next&#8221;? I admit doing that, but it gets worse: even web apps start to work a bit like that for me: testing a new app I&#8217;ve found myself quite a few times &#8220;assuming&#8221; what a button does etc.</p>
<p>Now, this carelessness lead to a funny (and gotta admit a it embarassing) incident yesterday. I logged into my Linked In account first time in x months and started to play with it (UI had changed quite a lot since I saw it the last time). I tested the &#8220;import contacts&#8221; feature and knowingly gave my gmail password (scary things they have nowadays) to import contacts. This imported quite a few mail addresses, including lot of expired ones, mailing list addresses, you name it. And by default each one selected, ready to be invited to linked in. Now I started to scan for a button which would &#8220;invert the selection&#8221;, and saw one saying &#8220;Invert selected contacts&#8221;, perfect! I clicked before and basically at the same time realized that it said &#8220;INVITE&#8221;, not &#8220;INVERT&#8221;. I was too late with the esc key&#8230;</p>
<p>So, as a result I managed to create some confusion on some mailing lists and probably there are some other people wondering as well about who I might be :) </p>
<p>If you were my victim, sorry about that,<br />
Miika</p>
<p>Edit: A quick search tells me I&#8217;m not the only one that has done similar mistake: <a rel="nofollow">http://www.google.com/search?q=&#8221;Invitation+to+connect+to+linked+in&#8221;</a></p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/mmiika.wordpress.com/32/"/> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/mmiika.wordpress.com/32/"/> <a rel="nofollow" target="_blank" href="http://feeds.wordpress.com/1.0/gocomments/mmiika.wordpress.com/32/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mmiika.wordpress.com/32/"/></a> <a rel="nofollow" target="_blank" href="http://feeds.wordpress.com/1.0/godelicious/mmiika.wordpress.com/32/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mmiika.wordpress.com/32/"/></a> <a rel="nofollow" target="_blank" href="http://feeds.wordpress.com/1.0/gostumble/mmiika.wordpress.com/32/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mmiika.wordpress.com/32/"/></a> <a rel="nofollow" target="_blank" href="http://feeds.wordpress.com/1.0/godigg/mmiika.wordpress.com/32/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mmiika.wordpress.com/32/"/></a> <a rel="nofollow" target="_blank" href="http://feeds.wordpress.com/1.0/goreddit/mmiika.wordpress.com/32/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mmiika.wordpress.com/32/"/></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mmiika.wordpress.com&blog=3798048&post=32&subd=mmiika&ref=&feed=1"/></div>]]></content:encoded>
         <media:content url="http://1.gravatar.com/avatar/b015344ba49711e90affd0687f854dba?s=96&amp;amp;d=identicon" medium="image">
            <media:title>mmiika</media:title>
         </media:content>
      </item>
      <item>
         <title>Ubuntu – Two Weeks Later</title>
         <link>http://chrisincambo.wordpress.com/2008/07/07/ubuntu-two-weeks-later/</link>
         <description>The Good (things that didn&amp;#8217;t work very well for me last time I tried): All of my usb devices were recognized straight away
Connecting to wireless networks is effortless
Linux Skype now has video calls
Eclipse works with all of my favourite add-ons
Google Earth
My ATI graphics card
Bluetooth The Bad: Eclipse (never known for its legs) is even slower than on windows
Fonts [...]&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://stats.wordpress.com/b.gif?host=chrisincambo.wordpress.com&amp;blog=4041893&amp;post=13&amp;subd=chrisincambo&amp;ref=&amp;feed=1&quot;/&gt;</description>
         <guid isPermaLink="false">http://chrisincambo.wordpress.com/?p=13</guid>
         <pubDate>Mon, 07 Jul 2008 03:31:29 -0700</pubDate>
         <content:encoded><![CDATA[<div class='snap_preview'><br /><p>The Good (things that didn&#8217;t work very well for me last time I tried):</p>
<ul>
<li>All of my usb devices were recognized straight away</li>
<li>Connecting to wireless networks is effortless</li>
<li>Linux Skype now has video calls</li>
<li>Eclipse works with all of my favourite add-ons</li>
<li>Google Earth</li>
<li>My ATI graphics card</li>
<li>Bluetooth</li>
</ul>
<p>The Bad:</p>
<ul>
<li>Eclipse (never known for its legs) is even slower than on windows</li>
<li>Fonts still look a bit skanky without a lot of messing around</li>
<li>OpenOffice still butchers five out of every ten .doc files I try opening</li>
</ul>
<p>The Ugly:</p>
<ul>
<li>It took me about three days of command line hacking to use dial-up via my 3G phone</li>
</ul>
<p>Summary:</p>
<p>Still not perfect but I think for me at least it now has the edge on Windows.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/chrisincambo.wordpress.com/13/"/> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/chrisincambo.wordpress.com/13/"/> <a rel="nofollow" target="_blank" href="http://feeds.wordpress.com/1.0/gocomments/chrisincambo.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/chrisincambo.wordpress.com/13/"/></a> <a rel="nofollow" target="_blank" href="http://feeds.wordpress.com/1.0/godelicious/chrisincambo.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/chrisincambo.wordpress.com/13/"/></a> <a rel="nofollow" target="_blank" href="http://feeds.wordpress.com/1.0/gostumble/chrisincambo.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/chrisincambo.wordpress.com/13/"/></a> <a rel="nofollow" target="_blank" href="http://feeds.wordpress.com/1.0/godigg/chrisincambo.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/chrisincambo.wordpress.com/13/"/></a> <a rel="nofollow" target="_blank" href="http://feeds.wordpress.com/1.0/goreddit/chrisincambo.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/chrisincambo.wordpress.com/13/"/></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=chrisincambo.wordpress.com&blog=4041893&post=13&subd=chrisincambo&ref=&feed=1"/></div>]]></content:encoded>
         <media:content url="" medium="image">
            <media:title>chrisincambo</media:title>
         </media:content>
         <category>ubuntu</category>
      </item>
      <item>
         <title>Passing arguments from method to method in JavaScript</title>
         <link>http://ungsophy.blogspot.com/2008/07/passing-arguments-from-method-to-method.html</link>
         <description>For example, you have one function &lt;span style=&quot;font-family:courier new;&quot;&gt;greeting()&lt;/span&gt; that accepts two string arguments only. And you have another function &lt;span style=&quot;font-family:courier new;&quot;&gt;callAnotherFunction()&lt;span style=&quot;font-family:arial;&quot;&gt; &lt;/span&gt;&lt;/span&gt;that accepts only one argument which is a function. In order to pass arguments from method to method, JavaScript provide ideal &lt;span style=&quot;font-family:courier new;&quot;&gt;apply()&lt;/span&gt; and &lt;span style=&quot;font-family:courier new;&quot;&gt;call()&lt;/span&gt; to deal with this scenario.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;&lt;br /&gt;function greeting(name, str) {&lt;br /&gt;alert(str + &quot;, &quot; + name);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;function callAnotherFunction(method) {&lt;br /&gt;method.apply(null, arguments); // arguments refer to [&quot;John&quot;, &quot;Good morning&quot;]&lt;br /&gt;alert(arguments.length); // arguments refer to method&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;callAnotherFunction(function() {greeting(&quot;John&quot;, &quot;Good morning&quot;)});&lt;br /&gt;&lt;br /&gt;&lt;/code&gt;The significant point in this example is &lt;code&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;arguments &lt;/span&gt;&lt;/code&gt;in&lt;code&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;&lt;/span&gt; callAnotherFunction(method). &lt;/code&gt;It means differently in the same function. In &lt;code&gt;method.apply(null, arguments)&lt;span style=&quot;font-family:Georgia, serif;&quot;&gt;, &lt;/span&gt;&lt;/code&gt;it refers to the arguments that passed from method. And in &lt;code&gt;alert(arguments.length), &lt;/code&gt;it refers to method itself, not its arguments.&lt;br /&gt;&lt;br /&gt;These example might not make sense to some people but it very useful when you want to pass arguments from method to method.&lt;br /&gt;&lt;br /&gt;Hope this help.&lt;br /&gt;&lt;code&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/code&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6020668935883798887-2134861502520415309?l=ungsophy.blogspot.com'/&gt;&lt;/div&gt;</description>
         <author>Sophy</author>
         <guid isPermaLink="false">tag:blogger.com,1999:blog-6020668935883798887.post-2134861502520415309</guid>
         <pubDate>Thu, 03 Jul 2008 11:08:00 -0700</pubDate>
      </item>
      <item>
         <title>Good practice in array deletion in JavaScript</title>
         <link>http://ungsophy.blogspot.com/2008/07/good-practice-in-array-deletion.html</link>
         <description>It is really piss me off when I spent a few hours trying to find the failure in my JavaScript code.&lt;br /&gt;&lt;br /&gt;Eventually, I found out what the problem was. I did not delete my array correctly.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;var arr = [1, 2, 3, 4];&lt;br /&gt;for (var i=0; i&amp;lt;arr.length; i++)&lt;br /&gt; arr.splice(i, 1);&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;This for loop never delete all the elements in your array. When i = 0, arr[0] (a) is deleted and when i = 1, arr[1] (c) is deleted and then exit the loop cause i eqauls arr.length equals 2.&lt;br /&gt;&lt;br /&gt;To deal with this problem, you should assing arr.length to one variable so when you delete the array it does not effect you loop.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;var arr = [1, 2, 3, 4];&lt;br /&gt;for (i=0, len=arr.length; i&amp;lt;len; i++)&lt;br /&gt; arr.splice(0,1);&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Hope this help.&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6020668935883798887-7237636593239577410?l=ungsophy.blogspot.com'/&gt;&lt;/div&gt;</description>
         <author>Sophy</author>
         <guid isPermaLink="false">tag:blogger.com,1999:blog-6020668935883798887.post-7237636593239577410</guid>
         <pubDate>Wed, 02 Jul 2008 15:51:00 -0700</pubDate>
      </item>
      <item>
         <title>Contender for quote of the year 2008:</title>
         <link>http://chrisincambo.wordpress.com/2008/06/25/contender-for-quote-of-the-year-2008/</link>
         <description>Scrum Master: He (team member) actually believes his opinion is valuable. &lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://stats.wordpress.com/b.gif?host=chrisincambo.wordpress.com&amp;blog=4041893&amp;post=10&amp;subd=chrisincambo&amp;ref=&amp;feed=1&quot;/&gt;</description>
         <guid isPermaLink="false">http://chrisincambo.wordpress.com/?p=10</guid>
         <pubDate>Tue, 24 Jun 2008 19:22:36 -0700</pubDate>
         <content:encoded><![CDATA[<div class='snap_preview'><br /><p>Scrum Master: He (team member) <em><strong>actually</strong></em> believes his opinion is valuable.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/chrisincambo.wordpress.com/10/"/> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/chrisincambo.wordpress.com/10/"/> <a rel="nofollow" target="_blank" href="http://feeds.wordpress.com/1.0/gocomments/chrisincambo.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/chrisincambo.wordpress.com/10/"/></a> <a rel="nofollow" target="_blank" href="http://feeds.wordpress.com/1.0/godelicious/chrisincambo.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/chrisincambo.wordpress.com/10/"/></a> <a rel="nofollow" target="_blank" href="http://feeds.wordpress.com/1.0/gostumble/chrisincambo.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/chrisincambo.wordpress.com/10/"/></a> <a rel="nofollow" target="_blank" href="http://feeds.wordpress.com/1.0/godigg/chrisincambo.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/chrisincambo.wordpress.com/10/"/></a> <a rel="nofollow" target="_blank" href="http://feeds.wordpress.com/1.0/goreddit/chrisincambo.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/chrisincambo.wordpress.com/10/"/></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=chrisincambo.wordpress.com&blog=4041893&post=10&subd=chrisincambo&ref=&feed=1"/></div>]]></content:encoded>
         <media:content url="" medium="image">
            <media:title>chrisincambo</media:title>
         </media:content>
         <category>scrum</category>
      </item>
      <item>
         <title>Windows out, Ubuntu in!</title>
         <link>http://chrisincambo.wordpress.com/2008/06/25/windows-out-ubuntu-in/</link>
         <description>Dear diary, well I guess it&amp;#8217;s that time of year again, my annual bout of: &amp;#8220;F%*ck you Windows, it&amp;#8217;s over, and this time I mean it, pack your crap and get out!&amp;#8221;. This time the provocation is a virus that is so persistent, that even after three weeks and multiple treatments it still keeps reappearing. [...]&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://stats.wordpress.com/b.gif?host=chrisincambo.wordpress.com&amp;blog=4041893&amp;post=8&amp;subd=chrisincambo&amp;ref=&amp;feed=1&quot;/&gt;</description>
         <guid isPermaLink="false">http://chrisincambo.wordpress.com/?p=8</guid>
         <pubDate>Tue, 24 Jun 2008 18:16:16 -0700</pubDate>
         <content:encoded><![CDATA[<div class='snap_preview'><br /><p>Dear diary, well I guess it&#8217;s that time of year again, my annual bout of: &#8220;F%*ck you Windows, it&#8217;s over, and this time I mean it, pack your crap and get out!&#8221;. This time the provocation is a virus that is so persistent, that even after three weeks and multiple treatments it still keeps reappearing. Yep, time to trade in that fat, winging and extremely bloated package for a more slender cost effective model.</p>
<p>So I have now asked Ubuntu, my long standing and very hot bit on the side to move in with me full time. She&#8217;s slim, attractive and lets me use her without protection. All my mates are really impressed! But this is now a well traveled path, I&#8217;ve been with Ubuntu before, come to think of it, I&#8217;ve even been with her sisters Fedora and Debian a few times too and I already know there&#8217;s a flip side to this coin.</p>
<p>Last time we had a whirlwind romance, I had to eventually give her the boot because after a grueling 72 hour marathon session in my spare room, she STILL could not figure out how to access the internet on my mobile phone. Anyway that&#8217;s water under the bridge, she&#8217;s matured a lot since then and I think this time we can really make a go of it, besides if I go back to Windows after telling all my friends what a fat virus riddled skank she is, I won&#8217;t be able to show my face in the pub ever again.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/chrisincambo.wordpress.com/8/"/> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/chrisincambo.wordpress.com/8/"/> <a rel="nofollow" target="_blank" href="http://feeds.wordpress.com/1.0/gocomments/chrisincambo.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/chrisincambo.wordpress.com/8/"/></a> <a rel="nofollow" target="_blank" href="http://feeds.wordpress.com/1.0/godelicious/chrisincambo.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/chrisincambo.wordpress.com/8/"/></a> <a rel="nofollow" target="_blank" href="http://feeds.wordpress.com/1.0/gostumble/chrisincambo.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/chrisincambo.wordpress.com/8/"/></a> <a rel="nofollow" target="_blank" href="http://feeds.wordpress.com/1.0/godigg/chrisincambo.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/chrisincambo.wordpress.com/8/"/></a> <a rel="nofollow" target="_blank" href="http://feeds.wordpress.com/1.0/goreddit/chrisincambo.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/chrisincambo.wordpress.com/8/"/></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=chrisincambo.wordpress.com&blog=4041893&post=8&subd=chrisincambo&ref=&feed=1"/></div>]]></content:encoded>
         <media:content url="" medium="image">
            <media:title>chrisincambo</media:title>
         </media:content>
      </item>
      <item>
         <title>Decorator Pattern in JavaScript – GoF Design Patterns</title>
         <link>http://chrisincambo.wordpress.com/2008/06/23/decorator-pattern-in-javascript-gof-design-patterns/</link>
         <description>Since moving into the new office we&amp;#8217;ve been trying really hard to set things up in such a way that a culture of learning and knowledge sharing is created. In addition to pair programming, a reading area and an ever growing library, we&amp;#8217;ve set aside three hours of group study time a week. As with [...]&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://stats.wordpress.com/b.gif?host=chrisincambo.wordpress.com&amp;blog=4041893&amp;post=3&amp;subd=chrisincambo&amp;ref=&amp;feed=1&quot;/&gt;</description>
         <guid isPermaLink="false">http://chrisincambo.wordpress.com/?p=3</guid>
         <pubDate>Sun, 22 Jun 2008 18:48:55 -0700</pubDate>
         <content:encoded><![CDATA[<div class='snap_preview'><br /><p>Since moving into the new office we&#8217;ve been trying really hard to set things up in such a way that a culture of learning and knowledge sharing is created. In addition to pair programming, a reading area and an ever growing library, we&#8217;ve set aside three hours of group study time a week. As with all things under Scrum, the time, duration, date, topic and existence of the study periods was voted on by the development teams. We settled on three sessions a week &#8211; Tuesday: GoF Design Patterns, Wednesday: Open Mic(anybody can present anything) and Thursday: JavaScript.</p>
<p>Miika and I are leading the design pattern session and I&#8217;m leading the JavaScript session. So what is the obvious progression from this&#8230;&#8230;?</p>
<p>Well I&#8217;m guessing you&#8217;ve already read the title so I doubt I&#8217;ve built up much suspense &#8211; Design Patterns in JavaScript!</p>
<p>We are using <a rel="nofollow" target="_blank" href="http://www.amazon.com/Head-First-Design-Patterns/dp/0596007124/ref=pd_bbs_sr_1?ie=UTF8&amp;s=books&amp;qid=1214186937&amp;sr=1-1">Head First Design Patterns</a> as our study guide as it is much easier to digest than any of the other books are, especially for people who speak English as a second language. So the plan is to post each one of the examples from the book implemented in JavaScript, I&#8217;m then going to post those example to Wikipedia as JavaScript is currently not very well represented in most of the design pattern entries.</p>
<p>I&#8217;m not the first person to cover the subject, in fact Ross Harmes, Dustin Diaz have already written an excellent <a rel="nofollow" target="_blank" href="http://www.amazon.com/JavaScript-Design-Patterns-Recipes-Problem-Solution/dp/159059908X">book on the subject</a>, but I am going to take a slightly different angle. The plan is to where ever possible avoid building constructs that try to imitate the constructs of other languages, so I will be avoiding using helper methods to mimic interfaces, abstract classes and other constructs and instead embrace JavaScript&#8217;s dynamic nature.</p>
<p>Here&#8217;s the pizza example from the Head First book in JavaScript:</p>
<pre>
//Class to be decorated
function Coffee(){ this.cost = function(){ return 1; };
} //Decorator A
function Milk(coffee){ this.cost = function(){ return coffee.cost() + 0.5; };
} //Decorator B
function Whip(coffee){ this.cost = function(){ return coffee.cost() + 0.7; };
} //Decorator C
function Sprinkles(coffee){ this.cost = function(){ return coffee.cost() + 0.2; };
} //Here's one way of using it
var coffee = new Milk(new Whip(new Sprinkles(new Coffee())));
alert( coffee.cost() ); //Here's another
var coffee = new Coffee();
coffee = new Sprinkles(coffee);
coffee = new Whip(coffee);
coffee = new Milk(coffee);
alert(coffee.cost());
</pre>
<p>As you can see by the procedural code using the decorator pattern in JavaScript is much the same as its usage in other more orthodox languages, the big difference is in the implementation of the pattern. As you can see there is no <em>defined </em>interface. JavaScript has no Interface construct, the answer to this as with many other dynamic languages is <a rel="nofollow" target="_blank" href="http://en.wikipedia.org/wiki/Duck_typing">duck typing</a> (<em>Note: Wikipedia needs a JavaScript duck typing example</em>).</p>
<p>Duck Typing shifts the responsibility of making sure an object meets an interface from the creator to the receiver. Which is exactly what is happening above, the decorators receive an object which needs to implement the coffee interface by having a single method named cost(). If the object passed in does not have a method called coffee, then an exception will be raised by the JavaScript interpreter at runtime.</p>
<p>I guess what I&#8217;m trying to say is the main thing for me when addressing design patterns is that the &#8216;what&#8217; (behaviour) is more important than the &#8216;how&#8217; (implementation). In JavaScript the how is duck typing, in Java the how is an interface, but who cares? The important part is the what, and in both if we try to utilize an object which doesn&#8217;t meet our interface then an exception will be raised.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/chrisincambo.wordpress.com/3/"/> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/chrisincambo.wordpress.com/3/"/> <a rel="nofollow" target="_blank" href="http://feeds.wordpress.com/1.0/gocomments/chrisincambo.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/chrisincambo.wordpress.com/3/"/></a> <a rel="nofollow" target="_blank" href="http://feeds.wordpress.com/1.0/godelicious/chrisincambo.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/chrisincambo.wordpress.com/3/"/></a> <a rel="nofollow" target="_blank" href="http://feeds.wordpress.com/1.0/gostumble/chrisincambo.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/chrisincambo.wordpress.com/3/"/></a> <a rel="nofollow" target="_blank" href="http://feeds.wordpress.com/1.0/godigg/chrisincambo.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/chrisincambo.wordpress.com/3/"/></a> <a rel="nofollow" target="_blank" href="http://feeds.wordpress.com/1.0/goreddit/chrisincambo.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/chrisincambo.wordpress.com/3/"/></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=chrisincambo.wordpress.com&blog=4041893&post=3&subd=chrisincambo&ref=&feed=1"/></div>]]></content:encoded>
         <media:content url="" medium="image">
            <media:title>chrisincambo</media:title>
         </media:content>
      </item>
      <item>
         <title>What happen in DOM?</title>
         <link>http://ungsophy.blogspot.com/2008/06/unexpect-dom-behaviour.html</link>
         <description>I have discovered the unexpected behavior of DOM when I was writing some JavaScript code. The example will illustrate the problem&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;// Create one container and add to two children to it&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:courier new;font-size:85%;&quot;&gt;var container1 = document.createElement(&quot;DIV&quot;);&lt;/span&gt; &lt;span style=&quot;font-family:courier new;font-size:85%;&quot;&gt;container1.appendChild(document.createElement(&quot;DIV&quot;));&lt;br /&gt;container1.appendChild(document.createElement(&quot;DIV&quot;));&lt;br /&gt;&lt;br /&gt;//Now I want to the two children in container to document.body&lt;br /&gt;//Apparently, the code in the comment below should work&lt;br /&gt;//document.body.appendChild(container1.childNodes[0]);&lt;br /&gt;//document.body.appendChild(container1.childNodes[1]);&lt;br /&gt;&lt;br /&gt;//Unfortunately, it does not work. When we appended the first child in container1 to&lt;br /&gt;//document.body the browser automatically deleted that child from container. So,&lt;br /&gt;//after the insertion container1 has only one child not two. The code should be like&lt;br /&gt;//the below code:&lt;br /&gt;&lt;br /&gt;document.body.appendChild(container1.childNodes[0]);&lt;br /&gt;document.body.appendChild(container1.childNodes[0]);&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Hope this help.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6020668935883798887-6248469243201389386?l=ungsophy.blogspot.com'/&gt;&lt;/div&gt;</description>
         <author>Sophy</author>
         <guid isPermaLink="false">tag:blogger.com,1999:blog-6020668935883798887.post-6248469243201389386</guid>
         <pubDate>Tue, 10 Jun 2008 11:22:00 -0700</pubDate>
      </item>
      <item>
         <title>Fixed position in IE</title>
         <link>http://ungsophy.blogspot.com/2008/03/fixed-position-in-ie.html</link>
         <description>IE does not support position: fixed like Firefox does. But we still have way to make it possible.&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;/* set background url to whatever you want and then make it fixed position.*/&lt;br /&gt;body{ &lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt; background:url(foo1) fixed;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;/* this is the div that you want to be fix */&lt;br /&gt;#my_div{&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt; position:fixed;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt; _position:absolute;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt; top:0;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt; _top:expression(eval(document.body.scrollTop));&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt; left:0;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt; margin:0;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt; padding:0;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt; background:lime;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;}&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-family:arial;&quot;&gt;Actually, I got this stuff from &lt;a rel=&quot;nofollow&quot; target=&quot;_blank&quot; href=&quot;http://annevankesteren.nl/test/examples/ie/position-fixed.html&quot;&gt;http://annevankesteren.nl/test/examples/ie/position-fixed.html&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-family:arial;&quot;&gt;Hope this help.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6020668935883798887-662115681671487760?l=ungsophy.blogspot.com'/&gt;&lt;/div&gt;</description>
         <author>Sophy</author>
         <guid isPermaLink="false">tag:blogger.com,1999:blog-6020668935883798887.post-662115681671487760</guid>
         <pubDate>Tue, 18 Mar 2008 14:46:00 -0700</pubDate>
      </item>
      <item>
         <title>Problems RMagick and RubyGems</title>
         <link>http://ungsophy.blogspot.com/2008/03/problems-rmagick-and-rubygems.html</link>
         <description>It will have some problems if you use try to use RMagick with RubyGem &amp;gt; 0.9.For instance, if you use drawing primitive methods, simply you will see &lt;span style=&quot;font-style:italic;font-weight:bold;&quot;&gt;(no primitives defined):Magick::Draw &lt;/span&gt;error message. To deal with this error, it is not very difficult. You just go to your require statement and change form &lt;span style=&quot;font-weight:bold;font-family:courier new;&quot;&gt;require 'RMagick'&lt;/span&gt; to &lt;span style=&quot;font-weight:bold;font-family:courier new;&quot;&gt;require 'RMagic.rb'. &lt;/span&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;&lt;span style=&quot;font-family:arial;&quot;&gt;See the difference.&lt;br /&gt;&lt;br /&gt;Hope this help.&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6020668935883798887-132034446552348634?l=ungsophy.blogspot.com'/&gt;&lt;/div&gt;</description>
         <author>Sophy</author>
         <guid isPermaLink="false">tag:blogger.com,1999:blog-6020668935883798887.post-132034446552348634</guid>
         <pubDate>Tue, 18 Mar 2008 13:23:00 -0700</pubDate>
      </item>
      <item>
         <title>RMagick unable to read font n021004l.pfb solution</title>
         <link>http://ungsophy.blogspot.com/2008/03/rmagick-unable-to-read-font-n021004lpfb.html</link>
         <description>&lt;span style=&quot;font-family:arial;&quot;&gt;During my development process, I have encountered one problem with RMagick. RMagick was unable to read font n021004l.pfb. Let assume that you have installed RMagick in &lt;span style=&quot;font-weight:bold;&quot;&gt;C:&amp;#92;Program Files&amp;#92;ImageMagick-6.3.0-Q8&lt;/span&gt;. Then go to folder &lt;span style=&quot;font-weight:bold;&quot;&gt;config&lt;/span&gt; in your RMagick folder and open a file name &lt;span style=&quot;font-weight:bold;&quot;&gt;type.xml&lt;/span&gt; and &lt;span style=&quot;font-style:italic;&quot;&gt;comment &lt;code&gt;&amp;lt;!--&amp;lt;include file=&quot;type-ghostscript.xml&quot; /&amp;gt;--&amp;gt;&lt;/code&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt; Hope this help.&lt;br /&gt;&lt;/span&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6020668935883798887-4269245393234030178?l=ungsophy.blogspot.com'/&gt;&lt;/div&gt;</description>
         <author>Sophy</author>
         <guid isPermaLink="false">tag:blogger.com,1999:blog-6020668935883798887.post-4269245393234030178</guid>
         <pubDate>Thu, 06 Mar 2008 17:11:00 -0800</pubDate>
      </item>
   </channel>
</rss>
<!-- fe1.pipes.sp1.yahoo.com uncompressed/chunked Sat Nov 21 04:38:20 PST 2009 -->
