<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/atom10full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><feed xmlns="http://www.w3.org/2005/Atom" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" xml:lang="en">
    <title type="text">BigEvilEmpire</title>
    <subtitle type="html">This feed contains all posts from journal and codelog.</subtitle>
    <link rel="alternate" type="text/html" href="http://www.bigevilempire.com/journal/" />
    
    <updated>2009-06-02T16:44:31Z</updated>
    <rights>Copyright (c) 2009, BigEvilEmpire</rights>
    <generator uri="http://expressionengine.com/" version="1.6.7">ExpressionEngine</generator>
    <id>tag:bigevilempire.com,2009:06:02</id>


    <link rel="self" href="http://feeds.feedburner.com/bigevilempire" type="application/atom+xml" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com" /><entry>
      <title>Bondi Icebergs Club</title>
      <link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/bigevilempire/~3/Yi2-_lPDNuo/" />
      <id>tag:bigevilempire.com,2009:journal/1.46</id>
      <published>2009-06-02T05:34:45Z</published>
      <updated>2009-06-02T16:42:08Z</updated>
      <author>
            <name>BigEvilEmpire</name>
            <email>ronnieliew@gmail.com</email>
                  </author>

      <category term="Random" scheme="http://www.bigevilempire.com/journal/archives/category/category/random/" label="Random" />
      <content type="html">
        &lt;p&gt;Even if I do qualify to be a member, I am pretty sure I would not be brave enough to go swimming at the &lt;a title="Bondi Icebergs Swimming Club" href="http://www.icebergs.com.au/"&gt;Bondi Icebergs Club&lt;/a&gt;. Never mind the freezing cold water, they take their swimming seriously. To be a full swimming member, one has got to swim three out of four Sundays for 5 years.&lt;/p&gt;

&lt;p&gt;&lt;a class="no-ext" href="http://www.flickr.com/photos/arzie13/3586983689/" title="View 'Bondi Icebergs swim club' on Flickr.com by arzie13"&gt;&lt;img class="top" src="http://farm4.static.flickr.com/3364/3586983689_524461d7c0_o.jpg" alt="Bondi Icebergs swim club" width="614px" height="452px" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;What I would want is to be there at the club on the cliff top overlooking the famous Bondi Beach, staring at the ocean as the waves repeatedly explode over at the defying sea wall. Preferably warmly clothed.&lt;/p&gt;

&lt;p&gt;The amazing photo shown above is courtesy of &lt;a title="Ross Zietz" href="http://www.rosszietz.com/"&gt;Ross Zietz&lt;/a&gt;.&lt;/p&gt; 
      &lt;img src="http://feeds.feedburner.com/~r/bigevilempire/~4/Yi2-_lPDNuo" height="1" width="1"/&gt;</content>
    <feedburner:origLink>http://www.bigevilempire.com/journal/entry/bondi-icebergs-club/</feedburner:origLink></entry>

    <entry>
      <title>Flashcamp SF</title>
      <link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/bigevilempire/~3/ps9V7M8i1Fw/" />
      <id>tag:bigevilempire.com,2009:journal/1.45</id>
      <published>2009-05-30T22:08:56Z</published>
      <updated>2009-06-02T16:44:31Z</updated>
      <author>
            <name>BigEvilEmpire</name>
            <email>ronnieliew@gmail.com</email>
                  </author>

      <category term="Events" scheme="http://www.bigevilempire.com/journal/archives/category/category/events/" label="Events" />
      <content type="html">
        &lt;p&gt;My Friday night was spent at the &lt;a title="FlashCamp homepage" href="http://www.flashcamp.org/"&gt;FlashCamp&lt;/a&gt; SF. This is the second FlashCamp organized by Adobe and like its predecessor, it was held over at the Adobe San Francisco Office. For the uninitiated, the FlashCamps are free developer events focused on the Adobe Flash Platform.&lt;/p&gt;

&lt;p&gt;&lt;a class="no-ext" href="http://www.flickr.com/photos/75662727@N00/3576830951" title="View 'Tshirt from Flashcamp' on Flickr.com"&gt;&lt;img class="top right" src="http://farm4.static.flickr.com/3618/3576830951_c7314cf764_m.jpg" alt="Tshirt from Flashcamp" width="200px" height="272px" /&gt;&lt;/a&gt;This time, the event was mainly revolving around the next generation of the Flex SDK, code-named Gumbo. It was a huge night for the Flash community as Adobe presented a barrage of information on Flex 4, &lt;a title="Flash Catalyst on Adobe Labs" href="http://labs.adobe.com/technologies/flashcatalyst/"&gt;Flash Catalyst&lt;/a&gt; and the recently renamed Flash Builder.&lt;/p&gt;

&lt;p&gt;FlashCamp came with a whole bunch of free swag: beta software (Flash Builder 4 Beta, Flash Catalyst 1.0 Beta and Flex 4), eboy stickers and a t-shirt.&lt;/p&gt;

&lt;p&gt;For those who are yearning to lay your hands on the betas, it was alluded that they will be publicly released this coming Monday. Definitely watch for it over at the &lt;a title="Adobe Labs" href="http://labs.adobe.com/"&gt;Adobe Labs&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The free t-shirt was surprisingly interesting and in all likelihood, the cream of the crop amongst the free swag. &lt;/p&gt;

&lt;p&gt;It depicted a woman (presumably a personification of Photoshop) receiving a gift box from a suitor (predictably a male geek representing Flex). The gift box symbolizes the crown jewel of the next wave of Adobe software releases: the Flash Catalyst. All these done in &lt;a title="eBoy" href="http://www.eboy.com/"&gt;eBoy-style pixel art&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;I thought the illustration seemed pretty fitting, considering the role that Flash Catalyst fill, is essentially a tool that bridges the workflow between design and development. A gift from the developers to get the designers more involved.&lt;/p&gt;

&lt;p&gt;&lt;a class="no-ext" href="http://www.flickr.com/photos/75662727@N00/3577917654" title="View 'Goodies won at Flashcamp' on Flickr.com"&gt;&lt;img class="top left" src="http://farm4.static.flickr.com/3660/3577917654_1866cc9423_m.jpg" alt="Goodies won at Flashcamp" width="200px" height="272px" /&gt;&lt;/a&gt;I was a particularly happy attendee myself this time round mostly because my ticket won me a stash of ActionScript and Flex-related books at the raffle.&lt;/p&gt;

&lt;p&gt;It was a total of 7 books, 5 of which from the O'Reilly series. Some of them were actually on my Amazon wish-list. Many thanks to Adobe and &lt;a title="Mike Chambers" href="http://www.mikechambers.com/blog/"&gt;Mike Chambers&lt;/a&gt; who drew my raffle ticket. I can now strike these books off my list without spending a dime and they are definitely going into &lt;a title="My Bookshelf" href="http://www.bigevilempire.com/journal/entry/my-bookshelf/"&gt;geek hoard&lt;/a&gt;. I am hopeful that the content in the Flex 3 books would still be applicable when Flex 4 is officially out. &lt;/p&gt;

&lt;p&gt;The entire night was a series of informative sessions. Regretably for most, it was quite a challenge to hear the speakers amidst of all the ongoing chatter in the background. Despite attempts from the organizers to keep the volume down, it was really difficult to concentrate.&lt;/p&gt;

&lt;p&gt;Generally, I think the event went quite well. Most people were pretty pleased about it and were typically curious about the new releases.&lt;/p&gt;
 
      &lt;img src="http://feeds.feedburner.com/~r/bigevilempire/~4/ps9V7M8i1Fw" height="1" width="1"/&gt;</content>
    <feedburner:origLink>http://www.bigevilempire.com/journal/entry/flashcamp-sf/</feedburner:origLink></entry>

    <entry>
      <title>The Shareen and Joe Show</title>
      <link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/bigevilempire/~3/gFfGfIyWNKI/" />
      <id>tag:bigevilempire.com,2009:journal/1.43</id>
      <published>2009-03-18T03:03:35Z</published>
      <updated>2009-03-18T03:47:35Z</updated>
      <author>
            <name>BigEvilEmpire</name>
            <email>ronnieliew@gmail.com</email>
                  </author>

      <category term="Leisure" scheme="http://www.bigevilempire.com/journal/archives/category/category/leisure/" label="Leisure" />
      <content type="html">
        &lt;p&gt;I have recently chanced upon a podcast done by some folks back in Singapore, "The Shareen And Joe Show". After listening to a few episodes, I feel that the podcast deserves more than a &lt;a href="http://twitter.com/ronnieliew/status/1340758876" title="tweet"&gt;tweet&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;As suggested by the title of the podcast, the people behind these daily episodes are &lt;a href="http://twitter.com/JoeAugustin" title="Joe Augustin"&gt;Joe Augustin&lt;/a&gt; and &lt;a href="http://twitter.com/shareenwong" title="Shareen Wong"&gt;Shareen Wong&lt;/a&gt;. Both of them were partners in crime as radio deejays for a radio station in Singapore. As as a result of an &lt;a href="http://morningjam.com/2009/02/10/radio-silence-broken-just-a-little/" title="unfortunate incident"&gt;unfortunate incident&lt;/a&gt;, the duo departed from the radio station, moved on and started this podcast.&lt;/p&gt;

&lt;p&gt;For someone miles away from home, this podcast is very heartwarming. The best part of it is that it has been tremendously entertaining and amusing. This podcast is my defense to why I have been laughing to myself during my daily commute to work. Both Joe and Shareen talks about everything and nothing, covering a wide range of topics from the current raves in Singapore to  weird subjects like Joe's interpretation of Shareen's nightmare. &lt;/p&gt;

&lt;p&gt;For any Singaporeans, whether you are overseas or not, this is a highly recommended podcast. Personally I find it a great way to stay in touch with things back home through this engaging and witty duo. So go on, give them your support and yourself a "keep-you-company-on-the-way-to-work" show (as Joe puts it), subscribe to &lt;a href="http://itunes.apple.com/WebObjects/MZStore.woa/wa/viewPodcast?id=307895715" title='"The Shareen and Joe Show" on iTunes'&gt;"The Shareen and Joe Show" on iTunes&lt;/a&gt; or through their &lt;a href="http://morningjam.com/" title="The Shareen And Joe Show"&gt;website&lt;/a&gt;!&lt;/p&gt; 
      &lt;img src="http://feeds.feedburner.com/~r/bigevilempire/~4/gFfGfIyWNKI" height="1" width="1"/&gt;</content>
    <feedburner:origLink>http://www.bigevilempire.com/journal/entry/the-shareen-and-joe-show/</feedburner:origLink></entry>

    <entry>
      <title>Snowboarding In Tahoe</title>
      <link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/bigevilempire/~3/T8DAygXx9BY/" />
      <id>tag:bigevilempire.com,2009:journal/1.40</id>
      <published>2009-01-20T05:37:56Z</published>
      <updated>2009-02-14T10:11:57Z</updated>
      <author>
            <name>BigEvilEmpire</name>
            <email>ronnieliew@gmail.com</email>
                  </author>

      <category term="Trips" scheme="http://www.bigevilempire.com/journal/archives/category/category/trips/" label="Trips" />
      <content type="html">
        &lt;p&gt;Living on the equator means you do not get seasons. It is simply warm and humid all year round. No seasons also mean no snow. I grew up in &lt;a href="http://en.wikipedia.org/wiki/Singapore" title="Singapore"&gt;Singapore&lt;/a&gt; (a little island on the equator) and the only experience I have of snow is what I see in movies or television programs. We don't quite get the white Christmas.&lt;/p&gt; 

&lt;p&gt;Yesterday, I felt snow.&lt;/p&gt;

&lt;p&gt;Even better, I snowboarded. Something I always wanted to try; one more item off the list.&lt;/p&gt;

&lt;p&gt;&lt;a class="no-ext" href="http://www.flickr.com/photos/ronnieliew/3209384506/" title="View at the peak by ronnieliew, on Flickr"&gt;
&lt;img class="top" width="614" height="460" alt="View at the peak" src="http://farm4.static.flickr.com/3463/3209384506_9e7150a009_b.jpg"/&gt;
&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Ten things I learnt from snowboarding: &lt;/p&gt;

&lt;ul&gt;
    &lt;li&gt;Kids are naturally and literally fearless.&lt;/li&gt;
    &lt;li&gt;You need waterproof pants.&lt;/li&gt;
    &lt;li&gt;You need thick knee pads.&lt;/li&gt;
    &lt;li&gt;You need thick butt cushions.&lt;/li&gt;
    &lt;li&gt;You cannot ski or snowboard if you have acrophobia.&lt;/li&gt;
    &lt;li&gt;Hardest part of snowboarding is getting up.&lt;/li&gt;
    &lt;li&gt;Snowboarding is like swimming, u get hungry fast.&lt;/li&gt;
    &lt;li&gt;Repeated falling on snow can hurt.&lt;/li&gt;
    &lt;li&gt;Slopes are &lt;em&gt;way steeper&lt;/em&gt; at the peak.&lt;/li&gt;
    &lt;li&gt;You can still perspire like a pig even if it is cold.&lt;/li&gt;
&lt;/ul&gt; 
      &lt;img src="http://feeds.feedburner.com/~r/bigevilempire/~4/T8DAygXx9BY" height="1" width="1"/&gt;</content>
    <feedburner:origLink>http://www.bigevilempire.com/journal/entry/snowboarding-in-tahoe/</feedburner:origLink></entry>

    <entry>
      <title>Weekend in Kuala Lumpur</title>
      <link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/bigevilempire/~3/pJTQU3ebjSk/" />
      <id>tag:bigevilempire.com,2008:journal/1.38</id>
      <published>2008-12-30T02:00:20Z</published>
      <updated>2008-12-30T16:49:20Z</updated>
      <author>
            <name>BigEvilEmpire</name>
            <email>ronnieliew@gmail.com</email>
                  </author>

      <category term="Trips" scheme="http://www.bigevilempire.com/journal/archives/category/category/trips/" label="Trips" />
      <content type="html">
        &lt;p&gt;Back home in Singapore for my Christmas vacation and next thing I know, I am off to Kuala Lumpur, Malaysia for the weekend! Many thanks to Eric and Qinxin for organizing this crazy pig-out trip to our northern neighbour.&lt;/p&gt;

&lt;p&gt;&lt;a class="no-ext" href="http://www.flickr.com/photos/ronnieliew/3143975338/" title="Night scene at KL by ronnieliew, on Flickr"&gt;&lt;img class="top" src="http://farm4.static.flickr.com/3287/3143975338_89091b6641_b.jpg" width="614" height="375" alt="Night scene at KL" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It was a really simple weekend that consisted of the following activities in no particular order and occurrences: eating, shopping, sleeping and driving (getting lost in the road networks of KL). There was no itinerary, no crazy schedule to follow and no tourist attractions to hit. We just roamed where we wanted and kept our eyes peeled for food that we can sink our teeth into. My kind of fun!&lt;/p&gt;

&lt;p&gt;&lt;a class="no-ext" href="http://www.flickr.com/photos/ronnieliew/3143970964/" title="BBQ chicken wings at Jalan Alor by ronnieliew, on Flickr"&gt;&lt;img class="top" src="http://farm4.static.flickr.com/3290/3143970964_53e975d61b_b.jpg" width="614" height="375" alt="BBQ chicken wings at Jalan Alor" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We nearly visited the Kuala Lumpur Bird Park, which was more of an accident rather than anything intentional. I blame it on the ridiculous road system that had us going in circles. It also had the retarded GPS as an accomplice.&lt;/p&gt;

&lt;p&gt;Despite the lack of a plan and a couple of navigational mishaps, we got along pretty fine in Kuala Lumpur. We had chicken noodles soaked in Chinese wine, really expensive tea, famous &lt;a href="http://en.wikipedia.org/wiki/Nasi_lemak" title="Nasi Lemak"&gt;Nasi Lemak&lt;/a&gt;, extremely unhealthy BBQ chicken wings and a lot of Japanese food. Good times.&lt;/p&gt; 
      &lt;img src="http://feeds.feedburner.com/~r/bigevilempire/~4/pJTQU3ebjSk" height="1" width="1"/&gt;</content>
    <feedburner:origLink>http://www.bigevilempire.com/journal/entry/weekend-in-kuala-lumpur/</feedburner:origLink></entry>


    <entry>
      <title>Configure MySQL for UTF-8</title>
      <link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/bigevilempire/~3/jjbOgxUsY4Y/" />
      <id>tag:bigevilempire.com,2009:codelog/2.44</id>
      <published>2009-03-20T08:38:58Z</published>
      <updated>2009-04-17T09:46:59Z</updated>
      <author>
            <name>BigEvilEmpire</name>
            <email>ronnieliew@gmail.com</email>
                  </author>

      <category term="MySQL" scheme="http://www.bigevilempire.com/codelog/archives/category/category/mysql/" label="MySQL" />
      <content type="html">
        &lt;p&gt;Ever saved a record into a MySQL database and upon retrieval of the record, you realized that the non-Latin characters(e.g. Asian characters) don't quite turn up as expected? Specifically, they turn up as a bunch of "?".&lt;/p&gt;

&lt;p&gt;The likelihood of why this is occurring is that the MySQL database is configured as a default for Latin characters. In this day and age, one would assume that UTF-8 would be a de facto standard for this. Given my limited knowledge on database administration, I cannot fathom why Latin is chosen as a default over UTF-8. Shouldn't the benefit and the flexibility of supporting non-Latin characters outweigh whatever space that a Latin-only database saves (I am guessing this is the benefit) ?&lt;/p&gt;

&lt;p&gt;Oh well, what would I know.&lt;/p&gt;

&lt;p&gt;If UTF-8 is a foreign term, you absolutely need to read why it should even be a concern to any developer: &lt;a href="http://www.joelonsoftware.com/articles/Unicode.html" title="The Absolute Minimum Every Software Developer Absolutely, Positively Must Know About Unicode and Character Sets"&gt;The Absolute Minimum Every Software Developer Absolutely, Positively Must Know About Unicode and Character Sets&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;For those, who see the need to support UTF-8 in your MySQL databases, fortunately you can do so by editing the MySQL configuration file &amp;#40;my.cnf&amp;#41;. This file is typically found at: /etc/mysql/my.cnf if you are on Mac OS X or any UNIX/Linux-based OS.&lt;/p&gt;

&lt;p&gt;Add the following to the my.cnf:&lt;/p&gt;

&lt;pre class="code:bash"&gt;
[client]
default-character-set = utf8 
...
... 

[mysqld]
default-character-set = utf8 
character-set-server  = utf8
default-collation     = utf8_general_ci
...
&lt;/pre&gt;

&lt;p&gt;As an alternative, you can specify the default collation to be using "utf8_unicode_ci". The difference between them is :&lt;/p&gt;

&lt;blockquote&gt;&lt;p&gt;For any Unicode character set, operations performed using the _general_ci collation are faster than those for the _unicode_ci collation. For example, comparisons for the utf8_general_ci  collation are faster, but slightly less correct, than comparisons for utf8_unicode_ci. The reason for this is that utf8_unicode_ci supports mappings such as expansions; that is, when one character compares as equal to combinations of other characters. For example, in German and some other languages “ß” is equal to “ss”. utf8_unicode_ci also supports contractions and ignorable characters. utf8_general_ci  is a legacy collation that does not support expansions, contractions, or ignorable characters. It can make only one-to-one comparisons between characters.&lt;/p&gt;&lt;/blockquote&gt; 

&lt;p&gt;For more information on configuration of character-set:&lt;/p&gt;

&lt;ul&gt;&lt;li&gt;&lt;a href="http://dev.mysql.com/doc/refman/5.0/en/charset-connection.html" title="Conection Character Sets and Collations"&gt;Conection Character Sets and Collations&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://dev.mysql.com/doc/refman/5.0/en/charset-unicode-sets.html" title="Unicode Character Sets"&gt;Unicode Character Sets&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt; 
      &lt;img src="http://feeds.feedburner.com/~r/bigevilempire/~4/jjbOgxUsY4Y" height="1" width="1"/&gt;</content>
    <feedburner:origLink>http://www.bigevilempire.com/codelog/entry/configure-mysql-for-utf-8/</feedburner:origLink></entry>

    <entry>
      <title>Learning Ruby</title>
      <link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/bigevilempire/~3/r4jvupD2t7I/" />
      <id>tag:bigevilempire.com,2009:codelog/2.42</id>
      <published>2009-03-09T00:21:09Z</published>
      <updated>2009-03-20T18:55:15Z</updated>
      <author>
            <name>BigEvilEmpire</name>
            <email>ronnieliew@gmail.com</email>
                  </author>

      <category term="Ruby" scheme="http://www.bigevilempire.com/codelog/archives/category/category/ruby/" label="Ruby" />
      <content type="html">
        &lt;p&gt;As I delved more into the world of the Ruby Programming language, I am discovering tools and resources that would be of help to someone new to Ruby. I want to log my learnings as I go along in hope that it would benefit anyone who might be trudging down this same path. &lt;/p&gt;

&lt;p&gt;I may have jumped the gun when I wrote about &lt;a href="http://www.bigevilempire.com/codelog/entry/using-ruby-modules/" title="using modules in Ruby"&gt;using modules in Ruby&lt;/a&gt;. To kick-start learning about Ruby, it might be prudent to understand about the syntax of Ruby. There are several gems (pun intended) available online that cover the basics of the Ruby language:&lt;/p&gt;

&lt;ul&gt;
    &lt;li&gt;&lt;a href="http://en.wikibooks.org/wiki/Ruby_Programming" title="Wikibooks: Ruby Programming"&gt;Wikibooks: Ruby Programming&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href="http://www.rubycentral.com/pickaxe" title="Programming Ruby"&gt;Programming Ruby&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href="http://poignantguide.net/ruby/" title="Why's (Poignant) Guide to Ruby"&gt;Why's (Poignant) Guide to Ruby&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href="http://www.cs.auckland.ac.nz/references/ruby/doc_bundle/Newcomers/ruby.html" title="Things That Newcomers to Ruby Should Know"&gt;Things That Newcomers to Ruby Should Know&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In addition to these guides, there are also tools which are pretty handy for Ruby. For some quick action and experimentations with Ruby, there is always the &lt;a href="http://en.wikipedia.org/wiki/Interactive_Ruby_Shell" title="Interactive Ruby Shell"&gt;Interactive Ruby Shell&lt;/a&gt; (commonly referred to as IRB). To use the IRB, just launch the Terminal app in Mac OS X and type "irb". Within the IRB, you will be able to enter Ruby commands and have the interpreter respond immediately.&lt;/p&gt;

&lt;pre class="code:ruby"&gt;
$ irb

irb(main):001:0&gt; myArray = [1,2,3,4,5]
=&gt; [1, 2, 3, 4, 5]
irb(main):002:0&gt; myArray.each do |x|
irb(main):003:1* puts x
irb(main):004:1&gt; end
1
2
3
4
5
=&gt; [1, 2, 3, 4, 5]
irb(main):005:0&gt;
&lt;/pre&gt;

&lt;p&gt;For quick-access to view Ruby documentation off-line, you can always fall back on the ri documentation viewer. Launch the Terminal app in Mac OS X and invoke "ri" followed by the name of a Ruby class, module or method and ri will pull up the documentation accordingly.&lt;/p&gt;

&lt;p&gt;Here are some sample usage of ri:&lt;/p&gt;

&lt;pre class="code:bash"&gt;
ri Array
ri 'Array#&amp;lt;&amp;lt;'
ri Array.each
ri Array::new
&lt;/pre&gt;

&lt;p&gt;For any initiate to Ruby, these should be more than enough to get u moving along. Happy learning.&lt;/p&gt;

 
      &lt;img src="http://feeds.feedburner.com/~r/bigevilempire/~4/r4jvupD2t7I" height="1" width="1"/&gt;</content>
    <feedburner:origLink>http://www.bigevilempire.com/codelog/entry/learning-ruby/</feedburner:origLink></entry>

    <entry>
      <title>Using Ruby Modules</title>
      <link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/bigevilempire/~3/A4tKKNfmMsI/" />
      <id>tag:bigevilempire.com,2009:codelog/2.41</id>
      <published>2009-03-03T08:15:29Z</published>
      <updated>2009-03-20T18:43:18Z</updated>
      <author>
            <name>BigEvilEmpire</name>
            <email>ronnieliew@gmail.com</email>
                  </author>

      <category term="Ruby" scheme="http://www.bigevilempire.com/codelog/archives/category/category/ruby/" label="Ruby" />
      <content type="html">
        &lt;p&gt;In my recent pursue of learning &lt;a href="http://rubyonrails.org/" title="Rails"&gt;Rails&lt;/a&gt;, I have gotten more exposure to the Ruby. The Ruby programming language is very pretty in terms of its syntax and the semantics. It is object-oriented and allow classes to import modules as mixins, which is the subject of this post.&lt;/p&gt;

&lt;p&gt;I am still very new to Ruby and pretty much learning as I go along. This post is more to document my own learning than anything. &lt;/p&gt;


&lt;pre class="code:ruby"&gt;
module MySharedModule
  HASH_CONSTANT = &amp;#123;:mykey =&gt; "value of mykey"&amp;#125;
  
  def mixin_method
    puts "calling mixin method"
  end
    
  class ClassInModule
    def self.class_method
      puts "calling class method"
    end
    
    def instance_method
      puts "calling instance_method"
    end
  end
end


class MyClass
  include MySharedModule
  
  def initialize
    # access module's constant
    # to be more verbose: MySharedModule::HASH_CONSTANT 
    puts HASH_CONSTANT[:mykey]    
    
    # access module method
    mixin_method
        
    # calls class method of a class in module
    # to be more verbose: MySharedModule::ClassInModule.class_method
    ClassInModule.class_method
        
    # instantiate, call instance method of class in module
    # to be more verbose: MySharedModule::ClassInModule.class_method
    instance = ClassInModule.new
    instance.instance_method    
  end
end


myClass = MyClass.new



# Output:
# value of mykey
# calling mixin method
# calling class method
# calling instance_method
&lt;/pre&gt;


&lt;p&gt;To learn more about using modules in Ruby:&lt;/p&gt;
&lt;ul&gt;
    &lt;li&gt;&lt;a href="http://www.rubyfleebie.com/an-introduction-to-modules-part-1/" title="Ruby Fleebie: An introduction to modules"&gt;Ruby Fleebie: An introduction to modules&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href="http://www.juixe.com/techknow/index.php/2006/06/15/mixins-in-ruby/" title="Juixe TechKnow: Ruby Mixin Tutorial"&gt;Juixe TechKnow: Ruby Mixin Tutorial&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt; 
      &lt;img src="http://feeds.feedburner.com/~r/bigevilempire/~4/A4tKKNfmMsI" height="1" width="1"/&gt;</content>
    <feedburner:origLink>http://www.bigevilempire.com/codelog/entry/using-ruby-modules/</feedburner:origLink></entry>

    <entry>
      <title>Bash Completion For Git</title>
      <link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/bigevilempire/~3/yCR8uVybi-s/" />
      <id>tag:bigevilempire.com,2009:codelog/2.39</id>
      <published>2009-01-15T07:10:23Z</published>
      <updated>2009-01-16T16:23:23Z</updated>
      <author>
            <name>BigEvilEmpire</name>
            <email>ronnieliew@gmail.com</email>
                  </author>

      <category term="Mac" scheme="http://www.bigevilempire.com/codelog/archives/category/category/mac/" label="Mac" />
      <content type="html">
        &lt;p&gt;Bash completion for Git is a very handy utility for a Git and &lt;a href="http://www.gnu.org/software/bash/" title="Bash"&gt;Bash&lt;/a&gt; user. For the past few months, I have been trying out Git for source control. Having Bash completion for Git was useful in my attempts to get acquainted with the commands. So what exactly is Bash completion for Git?&lt;/p&gt;

&lt;p&gt;If you are on Mac OS X, Bash comes with command completion. After typing part of a filename, command or pathname in Bash, hitting the &amp;lt;TAB&amp;gt; key will trigger Bash to prompt you with either the remaining portion of the filename or path. A subsequent &amp;lt;TAB&amp;gt; will then trigger a list of filenames or path that matches what has been keyed in so far.&lt;/p&gt;

&lt;p&gt;Bash completion for Git works the same way by prompting you with available commands or filename.&lt;/p&gt;

&lt;p&gt;One possible installation method would be using &lt;a href="http://www.macports.org/" title="MacPorts"&gt;MacPorts&lt;/a&gt;. MacPorts is a really useful tool for compiling, installing and upgrading open-source software on the Mac OS X. It is command-line driven and is relatively simple to use.&lt;/p&gt;

&lt;pre class="code:bash"&gt;
sudo port install -u git-core +bash_completion +doc +svn
&lt;/pre&gt;

&lt;p&gt;The command above installs Git with variants (variants are essentially additional options). In this case, MacPorts is installing Git with SVN, Git Man files (documentatons) and the main subject of our interest: Bash completion itself.&lt;/p&gt;

&lt;p&gt;When installing new version of a port, MacPorts will make the existing version inactive and then install the latest version. Over time, you can wind up with a lot of inactive version for a port. The -u flag simply instructs MacPorts to uninstall any inactive ports.&lt;/p&gt;

&lt;p&gt;The last step to this is to edit the user Bash configuration file in your home folder (~/.bash_profile) or the system-wide one (/etc/profile) and insert in the following:&lt;/p&gt;

&lt;pre class="code:bash"&gt;
if [ -f /opt/local/etc/bash_completion ]; then
  . /opt/local/etc/bash_completion
  export PS1='\h:\W$(__git_ps1 "(%s)") \u\$ '
fi
&lt;/pre&gt;

&lt;p&gt;Apart from checking if the bash completion script exists and running it, the code above will also modify the Bash prompt so that you can always tell which Git branch you are currently working on. Handy information to have at the Bash prompt.&lt;/p&gt;

&lt;p&gt;And it is done, Git for source control with extra help from Bash completion.&lt;/p&gt; 
      &lt;img src="http://feeds.feedburner.com/~r/bigevilempire/~4/yCR8uVybi-s" height="1" width="1"/&gt;</content>
    <feedburner:origLink>http://www.bigevilempire.com/codelog/entry/bash-completion-for-git/</feedburner:origLink></entry>

    <entry>
      <title>NSURLConnection With gzip</title>
      <link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/bigevilempire/~3/0z9FR2Ob5n0/" />
      <id>tag:bigevilempire.com,2008:codelog/2.37</id>
      <published>2008-10-20T00:04:32Z</published>
      <updated>2009-03-27T05:49:33Z</updated>
      <author>
            <name>BigEvilEmpire</name>
            <email>ronnieliew@gmail.com</email>
                  </author>

      <category term="Cocoa" scheme="http://www.bigevilempire.com/codelog/archives/category/category/cocoa/" label="Cocoa" />
      <category term="Cocoa Touch" scheme="http://www.bigevilempire.com/codelog/archives/category/category/cocoa-touch/" label="Cocoa Touch" />
      <category term="Objective-C" scheme="http://www.bigevilempire.com/codelog/archives/category/category/objective-c/" label="Objective-C" />
      <content type="html">
        &lt;p&gt;It is nice to know that the NSURLConnection class supports &lt;acronym title="GNU zip"&gt;gzip&lt;/acronym&gt; out of the box. The NSURLConnection class also does auto-decoding of the compressed data when the compressed content is received. However, by default even though the NSURLConnection class is handling this, it does not automatically add the required header to the HTTP request.&lt;/p&gt;

&lt;p&gt;In order to inform the web server that the client is compression-aware and prefer to receive gzip-compressed content, you need to manually add the header to the HTTP request:&lt;/p&gt;

&lt;pre class="code:ObjC"&gt;
NSURL *url = [NSURL URLWithString:@"http://www.fubar.com/webservice.xml"];
NSMutableURLRequest* urlReq = [[NSMutableURLRequest alloc] initWithURL:url];

//add gzip-encoding to HTTP header
[urlReq setValue:@"gzip" forHTTPHeaderField:@"Accept-Encoding"];
&lt;/pre&gt;

&lt;p&gt;If the web server supports gzip compression, the response that it returns to your Cocoa application or iPhone app will be compressed.&lt;/p&gt;

&lt;p&gt;By utilizing gzip-compressed content, it reduces response time for a HTTP response because the size of the HTTP response is smaller. This may have a considerable impact to native iPhone apps that rely heavily on web services since the overall network traffic is optimized and data transfer is more responsive. &lt;/p&gt;

&lt;p&gt;For those new to gzip compression, BetterExplained has a very good article explaining &lt;a href="http://betterexplained.com/articles/how-to-optimize-your-site-with-gzip-compression/" title="How To Optimize Your Site With gzip Compression"&gt;how gzip help in site optimization&lt;/a&gt;.&lt;/p&gt; 
      &lt;img src="http://feeds.feedburner.com/~r/bigevilempire/~4/0z9FR2Ob5n0" height="1" width="1"/&gt;</content>
    <feedburner:origLink>http://www.bigevilempire.com/codelog/entry/nsurlconnection-with-gzip/</feedburner:origLink></entry>

</feed>
