<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Industry Zero: One man's thought on software, business and life</title>
	<atom:link href="http://www.industryzero.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.industryzero.com</link>
	<description>It is really about nothing</description>
	<lastBuildDate>Tue, 04 Oct 2011 13:53:11 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>How to get log4j working with ruby on rails under Tomcat</title>
		<link>http://www.industryzero.com/2011/10/04/how-to-get-log4j-working-with-ruby-on-rails-under-tomcat/</link>
		<comments>http://www.industryzero.com/2011/10/04/how-to-get-log4j-working-with-ruby-on-rails-under-tomcat/#comments</comments>
		<pubDate>Tue, 04 Oct 2011 13:53:11 +0000</pubDate>
		<dc:creator>Leo Chan</dc:creator>
				<category><![CDATA[Whatever]]></category>
		<category><![CDATA[jruby]]></category>
		<category><![CDATA[log4j]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[ror]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[tomcat]]></category>

		<guid isPermaLink="false">http://www.industryzero.com/2011/10/04/how-to-get-log4j-working-with-ruby-on-rails-under-tomcat/</guid>
		<description><![CDATA[I have spent quite a bit of time on this and also Google around.  So I figured I will share: This assume you are using rails 3.0 or above, Warbler, and Tomcat 7.0 above Download latest log4j.jar and put it in your rails project&#8217;s lib directory Put your log4j.properties file in the rails root directory [...]]]></description>
				<content:encoded><![CDATA[<p>I have spent quite a bit of time on this and also Google around.  So I figured I will share:</p>
<p>This assume you are using rails 3.0 or above, Warbler, and Tomcat 7.0 above</p>
<ol>
<li>Download latest log4j.jar and put it in your rails project&#8217;s lib directory</li>
<li>Put your log4j.properties file in the rails root directory</li>
<li>Add this line in warble.rb: config.java_classes = FileList["log4j.properties"]</li>
<li>Add this line in warble.rb:  config.webxml.jruby.rack.logging = &#8216;log4j&#8217;</li>
</ol>
<p>Explaination:</p>
<p>Step 2 and 3 will allow warbler to put log4j.properties into the WEB-INF/classes directory</p>
<p>Step 4 will make sure jruby-rack using log4j for logging.</p>
<p>If you run into any issue, check your log4j.properties.</p>
<p>Here is the standard one I use:<br />
<code><br />
  log4j.rootLogger=INFO, R</p>
<p>log4j.appender.R=org.apache.log4j.RollingFileAppender<br />
log4j.appender.R.File=${catalina.base}/logs/production.log<br />
log4j.appender.R.MaxFileSize=10000KB<br />
log4j.appender.R.MaxBackupIndex=5<br />
log4j.appender.R.layout=org.apache.log4j.PatternLayout<br />
log4j.appender.R.layout.ConversionPattern=%d [%t] %-5p %c - %m%n<br />
</code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.industryzero.com/2011/10/04/how-to-get-log4j-working-with-ruby-on-rails-under-tomcat/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Good link on install rvm, rails and passenger</title>
		<link>http://www.industryzero.com/2011/04/26/good-link-on-install-rvm-rails-and-passenger/</link>
		<comments>http://www.industryzero.com/2011/04/26/good-link-on-install-rvm-rails-and-passenger/#comments</comments>
		<pubDate>Tue, 26 Apr 2011 14:30:30 +0000</pubDate>
		<dc:creator>Leo Chan</dc:creator>
				<category><![CDATA[Whatever]]></category>

		<guid isPermaLink="false">http://www.industryzero.com/2011/04/26/good-link-on-install-rvm-rails-and-passenger/</guid>
		<description><![CDATA[http://blog.blenderbox.com/2011/01/07/installing-rvm-ruby-rails-passenger-nginx-on-centos/]]></description>
				<content:encoded><![CDATA[<p>http://blog.blenderbox.com/2011/01/07/installing-rvm-ruby-rails-passenger-nginx-on-centos/</p>
]]></content:encoded>
			<wfw:commentRss>http://www.industryzero.com/2011/04/26/good-link-on-install-rvm-rails-and-passenger/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Another crazy iphone app by me</title>
		<link>http://www.industryzero.com/2011/03/13/another-crazy-iphone-app-by-me/</link>
		<comments>http://www.industryzero.com/2011/03/13/another-crazy-iphone-app-by-me/#comments</comments>
		<pubDate>Sun, 13 Mar 2011 16:33:55 +0000</pubDate>
		<dc:creator>Leo Chan</dc:creator>
				<category><![CDATA[Whatever]]></category>

		<guid isPermaLink="false">http://www.industryzero.com/2011/03/13/another-crazy-iphone-app-by-me/</guid>
		<description><![CDATA[I just finished another iphone app.  It is a fun app that mix Chinese Fortune Cookies with pictures.  Here it is : http://itunes.apple.com/us/app/ipicfortune/id423065900?mt=8]]></description>
				<content:encoded><![CDATA[<p>I just finished another iphone app.  It is a fun app that mix Chinese Fortune Cookies with pictures.  Here it is : <a href="http://itunes.apple.com/us/app/ipicfortune/id423065900?mt=8">http://itunes.apple.com/us/app/ipicfortune/id423065900?mt=8</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.industryzero.com/2011/03/13/another-crazy-iphone-app-by-me/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Got my first iphone app approved by Apple app store</title>
		<link>http://www.industryzero.com/2011/01/07/got-my-first-iphone-app-approved-by-apple-app-store/</link>
		<comments>http://www.industryzero.com/2011/01/07/got-my-first-iphone-app-approved-by-apple-app-store/#comments</comments>
		<pubDate>Fri, 07 Jan 2011 22:10:24 +0000</pubDate>
		<dc:creator>Leo Chan</dc:creator>
				<category><![CDATA[Software]]></category>

		<guid isPermaLink="false">http://www.industryzero.com/2011/01/07/got-my-first-iphone-app-approved-by-apple-app-store/</guid>
		<description><![CDATA[After many hours of work, I finally got my iphone app approved by Apple app store.  Here it is:  http://itunes.apple.com/us/app/ushospfinder/id412630399]]></description>
				<content:encoded><![CDATA[<p>After many hours of work, I finally got my iphone app approved by Apple app store.  Here it is: <span style="font-family: Helvetica; line-height: normal; font-size: 12px" class="Apple-style-span"> <a href="http://itunes.apple.com/us/app/ushospfinder/id412630399?mt=8&amp;ls=1#"><span class="s2">http://itunes.apple.com/us/app/ushospfinder/id412630399</span></a></span><meta content="text/html; charset=UTF-8" http-equiv="Content-Type" /><meta content="text/css" http-equiv="Content-Style-Type" /><title></title><meta content="Cocoa HTML Writer" name="Generator" /><meta content="1038.35" name="CocoaVersion" /><br />
<style type="text/css"> p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; color: #1738f5} span.s1 {color: #000000} span.s2 {text-decoration: underline} </style>
]]></content:encoded>
			<wfw:commentRss>http://www.industryzero.com/2011/01/07/got-my-first-iphone-app-approved-by-apple-app-store/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Google analytics missing 11/02/2010 data</title>
		<link>http://www.industryzero.com/2010/11/03/google-analytics-missing-11022010-data/</link>
		<comments>http://www.industryzero.com/2010/11/03/google-analytics-missing-11022010-data/#comments</comments>
		<pubDate>Wed, 03 Nov 2010 11:24:06 +0000</pubDate>
		<dc:creator>Leo Chan</dc:creator>
				<category><![CDATA[Whatever]]></category>

		<guid isPermaLink="false">http://www.industryzero.com/2010/11/03/google-analytics-missing-11022010-data/</guid>
		<description><![CDATA[Yes, everyone woke up find out Google analytics has missed yesterday data?  What&#8217;s up Google?]]></description>
				<content:encoded><![CDATA[<p>Yes, everyone woke up find out Google analytics has missed yesterday data?  What&#8217;s up Google?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.industryzero.com/2010/11/03/google-analytics-missing-11022010-data/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to set up multiple databases in rails project</title>
		<link>http://www.industryzero.com/2010/03/01/how-to-set-up-multiple-databases-in-rails-project/</link>
		<comments>http://www.industryzero.com/2010/03/01/how-to-set-up-multiple-databases-in-rails-project/#comments</comments>
		<pubDate>Mon, 01 Mar 2010 20:30:43 +0000</pubDate>
		<dc:creator>Leo Chan</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[rails models multiple databases]]></category>

		<guid isPermaLink="false">http://www.industryzero.com/2010/03/01/how-to-set-up-multiple-databases-in-rails-project/</guid>
		<description><![CDATA[Here is a question comes up a lot. Here is how to do it without additional plugin. config/database.yml: development: adapter: sqlite3 database: db/development.sqlite3 timeout: 5000 second_development: adapter: sqlite3 database: db/second_development.sqlite3 timeout: 5000 test: adapter: sqlite3 database: db/test.sqlite3 timeout: 5000 second_test: adapter: sqlite3 database: db/second_test.sqlite3 timeout: 5000 production: adapter: sqlite3 database: db/production.sqlite3 timeout: 5000 second_production: adapter: [...]]]></description>
				<content:encoded><![CDATA[<p>Here is a question comes up a lot.  Here is how to do it without additional plugin.<br />
config/database.yml:</p>
<blockquote><p>development:</p>
<blockquote><p> adapter: sqlite3<br />
database: db/development.sqlite3<br />
timeout: 5000</p></blockquote>
<p>second_development:</p>
<blockquote><p> adapter: sqlite3<br />
database: db/second_development.sqlite3<br />
timeout: 5000</p></blockquote>
<p>test:</p>
<blockquote><p> adapter: sqlite3<br />
database: db/test.sqlite3<br />
timeout: 5000</p></blockquote>
<p>second_test:</p>
<blockquote><p> adapter: sqlite3<br />
database: db/second_test.sqlite3<br />
timeout: 5000</p></blockquote>
<p>production:</p>
<blockquote><p> adapter: sqlite3<br />
database: db/production.sqlite3<br />
timeout: 5000</p></blockquote>
<p>second_production:</p>
<blockquote><p> adapter: sqlite3<br />
database: db/second_production.sqlite3<br />
timeout: 5000</p></blockquote>
</blockquote>
<p>migration for models in first database is like normal migration, example (xxxxxxx_create_user.rb):</p>
<blockquote><p> def self.up</p>
<blockquote><p> create_table &#8220;users&#8221;  do |t|</p>
<blockquote><p> t.string   &#8220;password&#8221;<br />
t.string   &#8220;email&#8221;</p>
<p>t.timestamps</p></blockquote>
<p>end</p></blockquote>
<p>end</p></blockquote>
<blockquote><p>def self.down</p>
<blockquote><p> drop_table :users</p></blockquote>
<p>end</p></blockquote>
<p>migration for models in  second database require slightly modification, example (xxxxxxx_create_dogs.rb)</p>
<blockquote><p>def self.up</p>
<blockquote><p> ActiveRecord::Base.establish_connection &#8220;second_#{RAILS_ENV}&#8221;<br />
create_table :dogs do |t|<br />
t.string :name, :null=&gt;falset.timestamps<br />
end<br />
ActiveRecord::Base.establish_connection &#8220;#{RAILS_ENV}&#8221;</p></blockquote>
<p>end</p>
<p>def self.down</p>
<blockquote><p> ActiveRecord::Base.establish_connection &#8220;second_#{RAILS_ENV}&#8221;<br />
drop_table :users<br />
ActiveRecord::Base.establish_connection &#8220;#{RAILS_ENV}&#8221;</p></blockquote>
<p>end</p></blockquote>
<p>Note that schema_migration table is located in the first database (default one) only in this case.</p>
<p>Models for the first (default database) is the same as regular rails model.</p>
<p>Models for the second database requires adding the following line in the Models:<br />
establish_connection &#8220;second_#{RAILS_ENV}&#8221;<br />
Example:</p>
<blockquote><p> class Dog &lt; ActiveRecord::Base<br />
establish_connection &#8220;second_#{RAILS_ENV}&#8221;<br />
end</p></blockquote>
<p>That is it.  Not that complicated.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.industryzero.com/2010/03/01/how-to-set-up-multiple-databases-in-rails-project/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Erlang programming example one.</title>
		<link>http://www.industryzero.com/2009/09/04/erlang-programming-example-one/</link>
		<comments>http://www.industryzero.com/2009/09/04/erlang-programming-example-one/#comments</comments>
		<pubDate>Fri, 04 Sep 2009 15:29:25 +0000</pubDate>
		<dc:creator>Leo Chan</dc:creator>
				<category><![CDATA[Software]]></category>

		<guid isPermaLink="false">http://www.industryzero.com/2009/09/04/erlang-programming-example-one/</guid>
		<description><![CDATA[I am currently reading a book on Erlang Programming by Francesco Cesarini:Erlang Programming .  It is quite well written.  In it, there is some programming exercises.  One of them is to write a simple key value DB.  So I wrote one.  Here it is: -module(db). -export([new/0,destroy/1,write/3,delete/2,read/2,match/2]). new()-&#62;Db=[], Db. destroy(Db)-&#62;_=Db, ok. write(Key,Element,Db)-&#62;NewDb = [{Key,Element}&#124;delete(Key,Db)], NewDb. delete(Key,Db)-&#62;case [...]]]></description>
				<content:encoded><![CDATA[<p>I am currently reading a book on Erlang Programming by Francesco Cesarini:<a href="http://www.amazon.com/gp/product/0596518188?ie=UTF8&amp;tag=industryzero-20&amp;linkCode=as2&amp;camp=1789&amp;creative=9325&amp;creativeASIN=0596518188">Erlang Programming</a><img src="http://www.assoc-amazon.com/e/ir?t=industryzero-20&amp;l=as2&amp;o=1&amp;a=0596518188" style="border: medium none  ! important; margin: 0px ! important" border="0" height="1" width="1" /> .  It is quite well written.  In it, there is some programming exercises.  One of them is to write a simple key value DB.  So I wrote one.  Here it is:</p>
<p>-module(db).<br />
-export([new/0,destroy/1,write/3,delete/2,read/2,match/2]).<br />
new()-&gt;Db=[],<br />
Db.</code></p>
<p>destroy(Db)-&gt;_=Db,<br />
ok.</p>
<p>write(Key,Element,Db)-&gt;NewDb = [{Key,Element}|delete(Key,Db)],<br />
NewDb.</p>
<p>delete(Key,Db)-&gt;case Db of<br />
[H|T] -&gt;<br />
case H of<br />
{Key,_} -&gt; T;<br />
_-&gt; [H|delete(Key,T)]<br />
end;<br />
[] -&gt;Db<br />
end.</p>
<p>read(Key,Db)-&gt;case Db of<br />
[H|T] -&gt;<br />
case H  of<br />
{Key,Element} -&gt;Element;<br />
_-&gt;read(Key,T)<br />
end;<br />
[] -&gt;{error,instance}<br />
end.<br />
match(Element,Db)-&gt;case Db of<br />
[H|T] -&gt;<br />
case H  of<br />
{Key,Element}-&gt;[Key|match(Element,T)];<br />
_ -&gt;match(Element,T)<br />
end;<br />
[] -&gt;Db<br />
end.<br />
To use it:</p>
<p>1&gt; Db = db:new().<br />
[]<br />
2&gt; Db1 = db:write(book,elrang,Db).<br />
[{book,elrang}]<br />
3&gt; Db2 = db:write(author,francesco,Db1).<br />
[{author,francesco},{book,elrang}]<br />
5&gt; db:read(author,Db2).<br />
francesco<br />
6&gt; db:match(elrang,Db2).<br />
[book]</p>
<p>Not very useful but it shows how to write simple program in erlang.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.industryzero.com/2009/09/04/erlang-programming-example-one/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Bing is equal if not better than Google</title>
		<link>http://www.industryzero.com/2009/07/30/bing-is-equal-if-not-better-than-google/</link>
		<comments>http://www.industryzero.com/2009/07/30/bing-is-equal-if-not-better-than-google/#comments</comments>
		<pubDate>Thu, 30 Jul 2009 20:07:39 +0000</pubDate>
		<dc:creator>Leo Chan</dc:creator>
				<category><![CDATA[Business]]></category>
		<category><![CDATA[Software]]></category>

		<guid isPermaLink="false">http://www.industryzero.com/2009/07/30/bing-is-equal-if-not-better-than-google/</guid>
		<description><![CDATA[Yes, it is true.  I have tried it on many times and look at them side by side.  I will say Bing is as good if not better than Google.  Google now finally have a competitor.  Yahoo makes the right decision to use Bing.]]></description>
				<content:encoded><![CDATA[<p>Yes, it is true.  I have tried it on many times and look at them side by side.  I will say Bing is as good if not better than Google.  Google now finally have a competitor.  Yahoo makes the right decision to use Bing.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.industryzero.com/2009/07/30/bing-is-equal-if-not-better-than-google/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Why can&#8217;t we write law like we write software?</title>
		<link>http://www.industryzero.com/2009/07/23/why-cant-we-write-law-like-we-write-software/</link>
		<comments>http://www.industryzero.com/2009/07/23/why-cant-we-write-law-like-we-write-software/#comments</comments>
		<pubDate>Thu, 23 Jul 2009 17:56:51 +0000</pubDate>
		<dc:creator>Leo Chan</dc:creator>
				<category><![CDATA[Politics]]></category>
		<category><![CDATA[Software]]></category>

		<guid isPermaLink="false">http://www.industryzero.com/2009/07/23/why-cant-we-write-law-like-we-write-software/</guid>
		<description><![CDATA[This is ofcourse a rhetorical question.  I know we can&#8217;t write law like we write software because the political process will never be able to do that.  But think for a moment for the why shouldn&#8217;t we?  Law likes software is a set of rule governing a system.  Although law is not exact instruction like [...]]]></description>
				<content:encoded><![CDATA[<p>This is ofcourse a rhetorical question.  I know we can&#8217;t write law like we write software because the political process will never be able to do that.  But think for a moment for the why shouldn&#8217;t we?  Law likes software is a set of rule governing a system.  Although law is not exact instruction like software but it acts almost like  software requirements or system specifications.  We don&#8217;t expect to write a perfect requirements and system specificatons right the first time we try.  That is why software development has become an iterative and agile process.  A good software development process will require small iteration, constant refinement, constant feedback.  Law should use the same kind of process.  Instead of trying to get it perfect the first time. Why can&#8217;t we just keep iterating?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.industryzero.com/2009/07/23/why-cant-we-write-law-like-we-write-software/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Palm Pre SDK vs iPhone SDK</title>
		<link>http://www.industryzero.com/2009/07/21/palm-pre-sdk-vs-iphone-sdk/</link>
		<comments>http://www.industryzero.com/2009/07/21/palm-pre-sdk-vs-iphone-sdk/#comments</comments>
		<pubDate>Tue, 21 Jul 2009 17:20:29 +0000</pubDate>
		<dc:creator>Leo Chan</dc:creator>
				<category><![CDATA[Whatever]]></category>

		<guid isPermaLink="false">http://www.industryzero.com/2009/07/21/palm-pre-sdk-vs-iphone-sdk/</guid>
		<description><![CDATA[The winner is Palm Pre SDK.  Why?  Palm picks a good architecture using javascript, html and css as its core technologies.  There is little learning curve. Unlike iphone which you need to learn Objective-C, xcode, Cocoa, etc.   It also follows convention over configuration (similar to rails).  Using Eclipse as IDE is also a good [...]]]></description>
				<content:encoded><![CDATA[<p>The winner is Palm Pre SDK.  Why?  Palm picks a good architecture using javascript, html and css as its core technologies.  There is little learning curve. Unlike iphone which you need to learn Objective-C, xcode, Cocoa, etc.   It also follows convention over configuration (similar to rails).  Using Eclipse as IDE is also a good choice.  Using VirtualBox as the base of the Emulator is a very smart engineering choice.  I like people who don&#8217;t reinventing the wheel.  Setting up is esay and so is getting the helloworld app up.   Good job Palm.  I think you will have a good future in competing with Apple.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.industryzero.com/2009/07/21/palm-pre-sdk-vs-iphone-sdk/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
