<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-5233946537982084404</id><updated>2024-08-29T00:18:24.102-07:00</updated><category term="Ruby on Rails"/><category term="Ruby"/><category term="Django"/><category term="Emulator"/><category term="Python"/><category term="assembly"/><category term="Ajax"/><category term="Algorithm"/><category term="Bochs"/><category term="Editor"/><category term="Emacs"/><category term="Google"/><category term="Hardware"/><category term="Javascript"/><category term="Kinh tế"/><category term="Operating System"/><category term="RSpec"/><category term="assembler"/><category term="att"/><category term="computer architecture"/><category term="intel"/><category term="jQuery"/><title type='text'>Hoang Tran&#39;s blog</title><subtitle type='html'>Do reinvent the wheels...</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://trbhoang.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5233946537982084404/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://trbhoang.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Hoang Tran</name><uri>http://www.blogger.com/profile/08678314335089274137</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjmUnxOybiZICKW5r-3bTq3UTUbzNN2jjXBk7CXJ9QR429gtjy9q5w6rcAAK85rE4Lezws7lIqMT-CSDfY8IxmlLv70152RAaH9y_HcXFJmFXejhoTGdzFuDbeeY3ITIA/s220/baby.gif.thumb.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>23</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-5233946537982084404.post-1719448251808401778</id><published>2011-06-09T04:07:00.000-07:00</published><updated>2011-06-09T04:09:18.578-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Bochs"/><category scheme="http://www.blogger.com/atom/ns#" term="Emulator"/><title type='text'>Turn back to Bochs</title><content type='html'>After a few days tried to use QEMU as an emulator for studying low-level software, it turned out to me that QEMU doesn&#39;t support much for debugging. Things like step-by-step run, set break points,... is unable. Then I went back to have a try with Bochs. It&#39;s amazing that Bochs is not that hard as I&#39;ve ever thought. It even provides very good debugging features. &lt;br /&gt;
&lt;br /&gt;
Here&#39;re some of my notes on Bochs installation and use:&lt;br /&gt;
&lt;div style=&quot;color: #3d85c6;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;color: #0b5394;&quot;&gt;&amp;nbsp; 1. Download Bochs source code at &lt;a href=&quot;http://bochs.sourceforge.net/getcurrent.html&quot;&gt;http://bochs.sourceforge.net/getcurrent.html&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;color: #0b5394;&quot;&gt;&lt;br /&gt;
&amp;nbsp; 2. Extract Bochs code &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt; $ gunzip -c bochs-version.tar.gz | tar -xvf -&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;color: #0b5394;&quot;&gt;&lt;br /&gt;
&amp;nbsp; 3. Configure to use debugger&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;$ ./configure --enable-debugger --enable-disasm&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;color: #0b5394;&quot;&gt;&lt;br /&gt;
&amp;nbsp; 4. Install&lt;/div&gt;&lt;div style=&quot;color: #0b5394; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; $ make&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;color: #0b5394;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; $ sudo make install&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;color: #0b5394;&quot;&gt;&lt;br /&gt;
&amp;nbsp; 5. There an example Bochs configs file name &lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;.bochsrc&lt;/span&gt;&lt;/span&gt; at extracted dir&lt;/div&gt;&lt;div style=&quot;color: #0b5394;&quot;&gt;&lt;br /&gt;
&amp;nbsp; 6. Using Bochs debugger&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;a href=&quot;http://bochs.sourceforge.net/doc/docbook/user/internal-debugger.htm&quot;&gt;http://bochs.sourceforge.net/doc/docbook/user/internal-debugger.htm&lt;/a&gt;l&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://trbhoang.blogspot.com/feeds/1719448251808401778/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5233946537982084404/1719448251808401778' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5233946537982084404/posts/default/1719448251808401778'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5233946537982084404/posts/default/1719448251808401778'/><link rel='alternate' type='text/html' href='http://trbhoang.blogspot.com/2011/06/turn-back-to-bochs.html' title='Turn back to Bochs'/><author><name>Hoang Tran</name><uri>http://www.blogger.com/profile/08678314335089274137</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjmUnxOybiZICKW5r-3bTq3UTUbzNN2jjXBk7CXJ9QR429gtjy9q5w6rcAAK85rE4Lezws7lIqMT-CSDfY8IxmlLv70152RAaH9y_HcXFJmFXejhoTGdzFuDbeeY3ITIA/s220/baby.gif.thumb.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5233946537982084404.post-8103792754316549407</id><published>2011-05-29T03:42:00.000-07:00</published><updated>2011-05-29T03:45:51.853-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="assembler"/><category scheme="http://www.blogger.com/atom/ns#" term="assembly"/><category scheme="http://www.blogger.com/atom/ns#" term="att"/><category scheme="http://www.blogger.com/atom/ns#" term="intel"/><title type='text'>Intel vs AT&amp;T syntax</title><content type='html'>There&#39;re two popular assembly syntaxes: Intel and AT&amp;amp;T. Intel syntax is popular in Windows world. In Linux, AT&amp;amp;T syntax is more popular though GAS (Gnu Assembler) supports both.&lt;br /&gt;
&lt;br /&gt;
The following lists some major differences of the two syntaxes:&lt;br /&gt;
&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;&lt;ol&gt;&lt;li&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: #b6d7a8;&quot;&gt;AT&amp;amp;T prefixes register with % sign&lt;/span&gt;&lt;br /&gt;
* Intel: &lt;br /&gt;
&amp;nbsp;&amp;nbsp; &lt;span class=&quot;Apple-style-span&quot; style=&quot;color: blue; font-family: &#39;Courier New&#39;, Courier, monospace; font-size: x-small;&quot;&gt;eax, ebx, ecx,...&lt;/span&gt;&lt;br /&gt;
* AT&amp;amp;T:&lt;br /&gt;
&amp;nbsp;&amp;nbsp; prefix by % sign: &lt;span class=&quot;Apple-style-span&quot; style=&quot;color: blue; font-family: &#39;Courier New&#39;, Courier, monospace; font-size: x-small;&quot;&gt;%eax, %ebx, %ecx,...&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: #b6d7a8;&quot;&gt;AT&amp;amp;T prefixes immediate value with $ sign, Intel is not&lt;/span&gt;&lt;br /&gt;
* Intel: &lt;span class=&quot;Apple-style-span&quot; style=&quot;color: blue; font-family: &#39;Courier New&#39;, Courier, monospace; font-size: x-small;&quot;&gt;10, 80h&lt;/span&gt;&lt;br /&gt;
* AT&amp;amp;T: &lt;span class=&quot;Apple-style-span&quot; style=&quot;color: blue; font-family: &#39;Courier New&#39;, Courier, monospace; font-size: x-small;&quot;&gt;$10, $0x80&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: #b6d7a8;&quot;&gt;AT&amp;amp;T and Intel syntax use opposite instruction operands&lt;/span&gt;&lt;br /&gt;
* Intel: &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span class=&quot;Apple-style-span&quot; style=&quot;color: purple; font-family: &#39;Courier New&#39;, Courier, monospace; font-size: x-small;&quot;&gt;mnemonic destination, source&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #274e13; font-family: &#39;Courier New&#39;, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp; Ex: &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span class=&quot;Apple-style-span&quot; style=&quot;color: blue; font-family: &#39;Courier New&#39;, Courier, monospace; font-size: x-small;&quot;&gt;mov eax, 100&lt;/span&gt;&lt;br /&gt;
* AT&amp;amp;T: &amp;nbsp;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: purple; font-family: &#39;Courier New&#39;, Courier, monospace; font-size: x-small;&quot;&gt;mnemonic source, destination&lt;/span&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp; Ex: &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: blue; font-family: &#39;Courier New&#39;, Courier, monospace; font-size: x-small;&quot;&gt;movl $100, %eax&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: #b6d7a8;&quot;&gt;AT&amp;amp;T suffixes instruction to specify instruction&#39;s operand size (1 byte: &lt;span class=&quot;Apple-style-span&quot; style=&quot;color: blue; font-family: &#39;Courier New&#39;, Courier, monospace; font-size: x-small;&quot;&gt;b&lt;/span&gt;, 2 bytes: &lt;span class=&quot;Apple-style-span&quot; style=&quot;color: blue; font-family: &#39;Courier New&#39;, Courier, monospace; font-size: x-small;&quot;&gt;w&lt;/span&gt;, 4 bytes: &lt;span class=&quot;Apple-style-span&quot; style=&quot;color: blue; font-family: &#39;Courier New&#39;, Courier, monospace; font-size: x-small;&quot;&gt;l&lt;/span&gt;) but Intel uses directive before operands (1 byte: &lt;span class=&quot;Apple-style-span&quot; style=&quot;color: blue; font-family: &#39;Courier New&#39;, Courier, monospace; font-size: x-small;&quot;&gt;byte ptr&lt;/span&gt;, 2 bytes: &lt;span class=&quot;Apple-style-span&quot; style=&quot;color: blue; font-family: &#39;Courier New&#39;, Courier, monospace; font-size: x-small;&quot;&gt;word ptr&lt;/span&gt;, 4 bytes: &lt;span class=&quot;Apple-style-span&quot; style=&quot;color: blue; font-family: &#39;Courier New&#39;, Courier, monospace; font-size: x-small;&quot;&gt;dword ptr&lt;/span&gt;)&lt;/span&gt;&lt;br /&gt;
* Intel:&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &lt;span class=&quot;Apple-style-span&quot; style=&quot;color: blue; font-family: &#39;Courier New&#39;, Courier, monospace; font-size: x-small;&quot;&gt;mov al, byte ptr foo&lt;/span&gt;&lt;br /&gt;
* AT&amp;amp;T:&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &lt;span class=&quot;Apple-style-span&quot; style=&quot;color: blue; font-family: &#39;Courier New&#39;, Courier, monospace; font-size: x-small;&quot;&gt;movb foo, %al&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;/li&gt;
&lt;/ol&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://trbhoang.blogspot.com/feeds/8103792754316549407/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5233946537982084404/8103792754316549407' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5233946537982084404/posts/default/8103792754316549407'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5233946537982084404/posts/default/8103792754316549407'/><link rel='alternate' type='text/html' href='http://trbhoang.blogspot.com/2011/05/intel-vs-at-syntax.html' title='Intel vs AT&amp;T syntax'/><author><name>Hoang Tran</name><uri>http://www.blogger.com/profile/08678314335089274137</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjmUnxOybiZICKW5r-3bTq3UTUbzNN2jjXBk7CXJ9QR429gtjy9q5w6rcAAK85rE4Lezws7lIqMT-CSDfY8IxmlLv70152RAaH9y_HcXFJmFXejhoTGdzFuDbeeY3ITIA/s220/baby.gif.thumb.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5233946537982084404.post-2344052246076502774</id><published>2011-05-28T03:08:00.000-07:00</published><updated>2011-05-29T01:06:48.787-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="assembly"/><category scheme="http://www.blogger.com/atom/ns#" term="computer architecture"/><title type='text'>Assembly Language</title><content type='html'>Assembly can be seen as machine language but in symbols/mnemonics instead of 0s or 1s. So one can make use of any aspect of computer&#39;s power if writing programs in assembly.&lt;br /&gt;
&lt;br /&gt;
Assembly is specific to machine architecture. IA32 (also called x86, i386) is the most popular architecture for PC.&lt;br /&gt;
&lt;ol&gt;&lt;li&gt;&lt;b&gt;Register&lt;/b&gt;&lt;br /&gt;
Can be classified in 4 types:&lt;br /&gt;
- general purpose (&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: blue; font-family: &#39;Courier New&#39;, Courier, monospace; font-size: x-small;&quot;&gt;eax, ebx, ecx, edx&lt;/span&gt;)&lt;br /&gt;
- pointer/index (&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: blue; font-family: &#39;Courier New&#39;, Courier, monospace; font-size: x-small;&quot;&gt;esp, ebp, esi, edi&lt;/span&gt;)&lt;br /&gt;
- instruction pointer (&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: blue; font-family: &#39;Courier New&#39;, Courier, monospace; font-size: x-small;&quot;&gt;eip&lt;/span&gt;)&lt;br /&gt;
- flags (&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: blue; font-family: &#39;Courier New&#39;, Courier, monospace; font-size: x-small;&quot;&gt;eflags&lt;/span&gt;)&lt;br /&gt;
&lt;br /&gt;
These are all 32 bits. Each register contains 8-bit and 16-bit parts. Ex: &lt;span class=&quot;Apple-style-span&quot; style=&quot;color: blue; font-family: &#39;Courier New&#39;, Courier, monospace; font-size: x-small;&quot;&gt;eax&lt;/span&gt; (32 bits),&amp;nbsp;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: blue; font-family: &#39;Courier New&#39;, Courier, monospace; font-size: x-small;&quot;&gt;ax&lt;/span&gt; (16 bits), &lt;span class=&quot;Apple-style-span&quot; style=&quot;color: blue; font-family: &#39;Courier New&#39;, Courier, monospace; font-size: x-small;&quot;&gt;ah&lt;/span&gt; (8 bits), &lt;span class=&quot;Apple-style-span&quot; style=&quot;color: blue; font-family: &#39;Courier New&#39;, Courier, monospace; font-size: x-small;&quot;&gt;al&lt;/span&gt; (8bits).&lt;br /&gt;
&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Instruction&lt;/b&gt;&lt;br /&gt;
- arithmetic/logic: &lt;span class=&quot;Apple-style-span&quot; style=&quot;color: blue; font-family: &#39;Courier New&#39;, Courier, monospace; font-size: x-small;&quot;&gt;add, sub, and, or,...&lt;/span&gt;&lt;br /&gt;
- control: &lt;span class=&quot;Apple-style-span&quot; style=&quot;color: blue; font-family: &#39;Courier New&#39;, Courier, monospace; font-size: x-small;&quot;&gt;jmp,..&lt;/span&gt;&lt;br /&gt;
- data movement: &lt;span class=&quot;Apple-style-span&quot; style=&quot;color: blue; font-family: &#39;Courier New&#39;, Courier, monospace; font-size: x-small;&quot;&gt;mov,..&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Operand&lt;/b&gt;&lt;br /&gt;
- &lt;span class=&quot;Apple-style-span&quot; style=&quot;color: blue; font-family: &#39;Courier New&#39;, Courier, monospace; font-size: x-small;&quot;&gt;register&lt;/span&gt;: operand value is contained in register&lt;br /&gt;
- &lt;span class=&quot;Apple-style-span&quot; style=&quot;color: blue; font-family: &#39;Courier New&#39;, Courier, monospace; font-size: x-small;&quot;&gt;immediate&lt;/span&gt;: operand value is a constant&lt;br /&gt;
- &lt;span class=&quot;Apple-style-span&quot; style=&quot;color: blue; font-family: &#39;Courier New&#39;, Courier, monospace; font-size: x-small;&quot;&gt;memory&lt;/span&gt;: operand value is in memory&lt;br /&gt;
&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Addressing mode&lt;/b&gt;&lt;br /&gt;
Addressing mode is the way to specify a memory address.&lt;br /&gt;
- absolute: &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: blue; font-family: &#39;Courier New&#39;, Courier, monospace; font-size: x-small;&quot;&gt;address = a value&lt;/span&gt;&lt;br /&gt;
- register: &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: blue; font-family: &#39;Courier New&#39;, Courier, monospace; font-size: x-small;&quot;&gt;address = register content&lt;/span&gt;&lt;br /&gt;
- displacement:&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: blue; font-family: &#39;Courier New&#39;, Courier, monospace; font-size: x-small;&quot;&gt;address = register content + a value&lt;/span&gt;&lt;br /&gt;
- indexed:&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: blue; font-family: &#39;Courier New&#39;, Courier, monospace; font-size: x-small;&quot;&gt;address = register content + a value + another register content (index) * another value (scale)&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Subroutine&lt;/b&gt;&lt;br /&gt;
- subroutine is a set of instructions&lt;br /&gt;
- parameters passed to subroutine are usually pushed on stack&lt;br /&gt;
&lt;/li&gt;
&lt;/ol&gt;</content><link rel='replies' type='application/atom+xml' href='http://trbhoang.blogspot.com/feeds/2344052246076502774/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5233946537982084404/2344052246076502774' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5233946537982084404/posts/default/2344052246076502774'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5233946537982084404/posts/default/2344052246076502774'/><link rel='alternate' type='text/html' href='http://trbhoang.blogspot.com/2011/05/assembly-language.html' title='Assembly Language'/><author><name>Hoang Tran</name><uri>http://www.blogger.com/profile/08678314335089274137</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjmUnxOybiZICKW5r-3bTq3UTUbzNN2jjXBk7CXJ9QR429gtjy9q5w6rcAAK85rE4Lezws7lIqMT-CSDfY8IxmlLv70152RAaH9y_HcXFJmFXejhoTGdzFuDbeeY3ITIA/s220/baby.gif.thumb.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5233946537982084404.post-5536874762002629797</id><published>2011-05-17T08:48:00.000-07:00</published><updated>2011-05-21T02:38:43.234-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Emulator"/><category scheme="http://www.blogger.com/atom/ns#" term="Hardware"/><category scheme="http://www.blogger.com/atom/ns#" term="Operating System"/><title type='text'>Some notes on QEMU</title><content type='html'>I am finding a computer emulator so that I can use to experiment some low-level softwares. There are two prominent free and open-source emulators: Bochs and QEMU. Bochs seems more popular but lacks of documentation. So I have decided to use QEMU because it&#39;s quite simple to use and well documented.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;1. Installation&lt;/b&gt; (on Ubuntu)&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: blue; font-family: &#39;Courier New&#39;, Courier, monospace; font-size: x-small;&quot;&gt;$ sudo apt-get install qemu&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;2. Start emulator&lt;/b&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: blue; font-family: &#39;Courier New&#39;, Courier, monospace; font-size: x-small;&quot;&gt;$ qemu [options] [disk_image]&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; --&amp;gt; This means start an emulator with specified &lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #e06666; font-family: &#39;Courier New&#39;, Courier, monospace; font-size: x-small;&quot;&gt;options&lt;/span&gt; and &lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #e06666; font-family: &#39;Courier New&#39;, Courier, monospace; font-size: x-small;&quot;&gt;disk_image&lt;/span&gt; (usually contains OS)&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;Ex:&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: blue; font-family: &#39;Courier New&#39;, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;$ qemu linux.img&lt;/span&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; --&amp;gt; Start an emulator with default options and its hard disk contains linux.img&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;There are lots of options which specify how your emulated computer could be such as what type of its cpu, hard disk, video card, sound card,... You can get more details on each option in &lt;a href=&quot;http://qemu.weilnetz.de/qemu-doc.html#Introduction&quot;&gt;QEMU documentation&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;3. Monitoring&lt;/b&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;QEMU provides a way to monitoring your emulator in which you can inspect your emulator, control it, change its devices, query its status,...&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;You can switch back and forth between the emulator and its monitor with keystrokes: &lt;span class=&quot;Apple-style-span&quot; style=&quot;color: red;&quot;&gt;Ctrl+Alt+2&lt;/span&gt; and &lt;span class=&quot;Apple-style-span&quot; style=&quot;color: red;&quot;&gt;Ctrl+Alt+1&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;Some monitoring commands:&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #0b5394; font-family: &#39;Courier New&#39;, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;(qemu) help or ? [cmd]&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #0b5394;&quot;&gt;(qemu) change &lt;/span&gt;&lt;i&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #e06666;&quot;&gt;device&lt;/span&gt;&lt;/i&gt; &lt;i&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #e06666;&quot;&gt;setting&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #0b5394;&quot;&gt;(qemu)&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;option&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #0b5394;&quot;&gt;x/fmt &lt;/span&gt;&lt;i&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #e06666;&quot;&gt;addr&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;var&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace; font-size: x-small; font-style: normal;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Virtual memory dump starting at addr&lt;/span&gt;&lt;/var&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace; font-size: x-small;&quot;&gt;&lt;var&gt;&amp;nbsp;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-style: normal;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #0b5394;&quot;&gt; (qemu)&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/var&gt;&lt;span class=&quot;option&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #0b5394;&quot;&gt;xp/fmt &lt;/span&gt;&lt;i&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #e06666;&quot;&gt;addr&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;var&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace; font-size: x-small; font-style: normal;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Physical memory dump starting at addr&amp;nbsp;&lt;/span&gt;&lt;/var&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: monospace;&quot;&gt;&lt;var&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;...&lt;/var&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: monospace;&quot;&gt;&lt;var&gt;&lt;br /&gt;
&lt;/var&gt;&lt;/span&gt;</content><link rel='replies' type='application/atom+xml' href='http://trbhoang.blogspot.com/feeds/5536874762002629797/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5233946537982084404/5536874762002629797' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5233946537982084404/posts/default/5536874762002629797'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5233946537982084404/posts/default/5536874762002629797'/><link rel='alternate' type='text/html' href='http://trbhoang.blogspot.com/2011/05/some-notes-on-qemu.html' title='Some notes on QEMU'/><author><name>Hoang Tran</name><uri>http://www.blogger.com/profile/08678314335089274137</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjmUnxOybiZICKW5r-3bTq3UTUbzNN2jjXBk7CXJ9QR429gtjy9q5w6rcAAK85rE4Lezws7lIqMT-CSDfY8IxmlLv70152RAaH9y_HcXFJmFXejhoTGdzFuDbeeY3ITIA/s220/baby.gif.thumb.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5233946537982084404.post-6656329133457430473</id><published>2011-05-16T07:48:00.000-07:00</published><updated>2011-05-16T08:59:21.379-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Ruby"/><category scheme="http://www.blogger.com/atom/ns#" term="Ruby on Rails"/><title type='text'>Use helpers in controller</title><content type='html'>Rails applied Restful as part of its design.&lt;br /&gt;
&lt;br /&gt;
To follow Restful, you should:&lt;br /&gt;
&lt;br /&gt;
1. Model your web app as resources&lt;br /&gt;
2. Manipulate your app&#39;s resources through a conventional interface&lt;br /&gt;
&lt;br /&gt;
Ex:&lt;br /&gt;
- if you have Product resource then urls to CRUD (Create, Edit, Update, Delete) this resource would be:&lt;br /&gt;
&lt;br /&gt;
&lt;table style=&quot;width: 100%;&quot;&gt;&lt;thead style=&quot;background-color: #dddddd; color: blue;&quot;&gt;
&lt;tr&gt; &lt;td&gt;Action&lt;/td&gt; &lt;td&gt;Urls&lt;/td&gt; &lt;td&gt;Web Method&lt;/td&gt;&lt;td&gt;Restful Interface&lt;/td&gt; &lt;/tr&gt;
&lt;/thead&gt;  &lt;tbody&gt;
&lt;tr&gt; &lt;td&gt;Create&lt;/td&gt; &lt;td&gt;/products&lt;/td&gt; &lt;td&gt;POST&lt;/td&gt; &lt;td&gt;products_url&lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt; &lt;td&gt;Edit&lt;/td&gt; &lt;td&gt;/products/1/edit&lt;/td&gt; &lt;td&gt;POST&lt;/td&gt; &lt;td&gt;edit_product_url&lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt; &lt;td&gt;Update&lt;/td&gt; &lt;td&gt;/products&lt;/td&gt; &lt;td&gt;PUT&lt;/td&gt; &lt;td&gt;product_url&lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt; &lt;td&gt;Delete&lt;/td&gt; &lt;td&gt;/products&lt;/td&gt; &lt;td&gt;DELETE&lt;/td&gt; &lt;td&gt;product_url&lt;/td&gt; &lt;/tr&gt;
&lt;/tbody&gt; &lt;/table&gt;&lt;br /&gt;
&lt;div&gt;Then to get links to delete/edit a product through Restful interface, we can use &lt;span class=&quot;Apple-style-span&quot; style=&quot;color: blue; font-family: &#39;Courier New&#39;, Courier, monospace; font-size: x-small;&quot;&gt;link_to&lt;/span&gt; method as below:&lt;br /&gt;
&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;background-color: #cccccc; padding: 5px;&quot;&gt;&lt;pre&gt;link_to &lt;span style=&quot;color: rosybrown;&quot;&gt;&#39;Edit&#39;&lt;/span&gt;, edit_product_path(product)&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div style=&quot;background-color: #cccccc; padding: 5px;&quot;&gt;&lt;pre&gt;link_to &lt;span style=&quot;color: rosybrown;&quot;&gt;&#39;Remove&#39;&lt;/span&gt;, product_path(product), &lt;span style=&quot;color: cadetblue;&quot;&gt;:confirm&lt;/span&gt; =&amp;gt; &lt;span style=&quot;color: rosybrown;&quot;&gt;&#39;Are you sure?&#39;&lt;/span&gt;, 
&lt;span style=&quot;color: cadetblue;&quot;&gt;        :method&lt;/span&gt; =&amp;gt; &lt;span style=&quot;color: cadetblue;&quot;&gt;:delete&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;
By default, you can only use above interfaces in View layer. How can we use those in Controller layer?&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;In Rails 2, call through &lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #cc0000; font-family: &#39;Courier New&#39;, Courier, monospace; font-size: x-small;&quot;&gt;@template&lt;/span&gt; variable&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #3d85c6; font-family: &#39;Courier New&#39;, Courier, monospace; font-size: x-small;&quot;&gt;@template.link_to(&#39;Edit&#39;, edit_product_path(product))&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;In Rails 3, call through &lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #cc0000; font-family: &#39;Courier New&#39;, Courier, monospace; font-size: x-small;&quot;&gt;view_context&lt;/span&gt; method&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #3d85c6; font-family: &#39;Courier New&#39;, Courier, monospace; font-size: x-small;&quot;&gt;view_context.link_to(&#39;Delete&#39;, product_path(product), :confirm =&amp;gt; &#39;Are you sure?&#39;, :method =&amp;gt; :delete)&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;div&gt;References&lt;/div&gt;&lt;div&gt;[1]&amp;nbsp;&lt;a href=&quot;http://stackoverflow.com/questions/3300582/rails-3-template-variable-inside-controllers-is-nil&quot;&gt;http://stackoverflow.com/questions/3300582/rails-3-template-variable-inside-controllers-is-nil&lt;/a&gt;&lt;/div&gt;&lt;div&gt;[2]&amp;nbsp;&lt;a href=&quot;http://railscasts.com/episodes/132-helpers-outside-views&quot;&gt;http://railscasts.com/episodes/132-helpers-outside-views&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://trbhoang.blogspot.com/feeds/6656329133457430473/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5233946537982084404/6656329133457430473' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5233946537982084404/posts/default/6656329133457430473'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5233946537982084404/posts/default/6656329133457430473'/><link rel='alternate' type='text/html' href='http://trbhoang.blogspot.com/2011/05/use-helpers-in-controller.html' title='Use helpers in controller'/><author><name>Hoang Tran</name><uri>http://www.blogger.com/profile/08678314335089274137</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjmUnxOybiZICKW5r-3bTq3UTUbzNN2jjXBk7CXJ9QR429gtjy9q5w6rcAAK85rE4Lezws7lIqMT-CSDfY8IxmlLv70152RAaH9y_HcXFJmFXejhoTGdzFuDbeeY3ITIA/s220/baby.gif.thumb.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5233946537982084404.post-5873793859245810074</id><published>2011-04-12T01:25:00.000-07:00</published><updated>2011-05-20T21:29:50.723-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Editor"/><category scheme="http://www.blogger.com/atom/ns#" term="Emacs"/><title type='text'>Code folding in Emacs</title><content type='html'>Code folding is a feature to wrap or unwrap a block of code. It can help you to see an overview of your code. This is a &lt;a href=&quot;http://emacs.wordpress.com/2007/01/16/quick-and-dirty-code-folding/&quot;&gt;quick and simple way&lt;/a&gt; to have that feature in Emacs. I modified it a little bit to make it more flexible as the way I want.&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;background-color: #f9f9f9; border: 1px solid silver; margin: 0 0 1.5em; padding: 0 1em 0 1em;&quot;&gt;&lt;pre&gt;&lt;span style=&quot;color: firebrick;&quot;&gt;;; &lt;/span&gt;&lt;span style=&quot;color: firebrick;&quot;&gt;code folding&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;(&lt;span style=&quot;color: #a020f0;&quot;&gt;defun&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;toggle-selective-display&lt;/span&gt; (level)
  (interactive &lt;span style=&quot;color: rosybrown;&quot;&gt;&quot;nEnter indentation level: &quot;&lt;/span&gt;)
  (set-selective-display level)
  )

(global-set-key &lt;span style=&quot;color: rosybrown;&quot;&gt;&quot;\M-3&quot;&lt;/span&gt; &#39;toggle-selective-display)
&lt;/pre&gt;&lt;pre&gt;&lt;/pre&gt;&lt;/div&gt;So, if I have this code:&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;background-color: #f9f9f9; border: 1px solid silver; margin: 0 0 1.5em; padding: 0 1em 0 1em;&quot;&gt;&lt;pre&gt;&lt;span style=&quot;color: #a020f0;&quot;&gt;class&lt;/span&gt; &lt;span style=&quot;color: forestgreen;&quot;&gt;User&lt;/span&gt; &amp;lt; &lt;span style=&quot;color: forestgreen;&quot;&gt;ActiveRecord&lt;/span&gt;
  has_many &lt;span style=&quot;color: cadetblue;&quot;&gt;:projects&lt;/span&gt;
  has_many &lt;span style=&quot;color: cadetblue;&quot;&gt;:assignments&lt;/span&gt;

  &lt;span style=&quot;color: #a020f0;&quot;&gt;def&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;full_name&lt;/span&gt;
    &lt;span style=&quot;color: rosybrown;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: darkgoldenrod;&quot;&gt;#{first_name}&lt;/span&gt;&lt;span style=&quot;color: rosybrown;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: darkgoldenrod;&quot;&gt;#{last_name}&lt;/span&gt;&lt;span style=&quot;color: rosybrown;&quot;&gt;&quot;&lt;/span&gt;
  &lt;span style=&quot;color: #a020f0;&quot;&gt;end&lt;/span&gt;

  &lt;span style=&quot;color: #a020f0;&quot;&gt;def&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;show_project_names&lt;/span&gt;
    projects.each &lt;span style=&quot;color: #a020f0;&quot;&gt;do&lt;/span&gt; |prj|
      puts prj.name
    &lt;span style=&quot;color: #a020f0;&quot;&gt;end&lt;/span&gt;
  &lt;span style=&quot;color: #a020f0;&quot;&gt;end&lt;/span&gt;
  
&lt;span style=&quot;color: #a020f0;&quot;&gt;end&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;then when I press Alt+3 4, all code that was indented at level 4 (4 spaces) will be wrapped as below:  &lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;background-color: #f9f9f9; border: 1px solid silver; margin: 0 0 1.5em; padding: 0 1em 0 1em;&quot;&gt;&lt;pre&gt;&lt;span style=&quot;color: #a020f0;&quot;&gt;class&lt;/span&gt; &lt;span style=&quot;color: forestgreen;&quot;&gt;User&lt;/span&gt; &amp;lt; &lt;span style=&quot;color: forestgreen;&quot;&gt;ActiveRecord&lt;/span&gt;
  has_many &lt;span style=&quot;color: cadetblue;&quot;&gt;:projects&lt;/span&gt;
  has_many &lt;span style=&quot;color: cadetblue;&quot;&gt;:assignments&lt;/span&gt;

  &lt;span style=&quot;color: #a020f0;&quot;&gt;def&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;full_name&lt;/span&gt;...
  &lt;span style=&quot;color: #a020f0;&quot;&gt;end&lt;/span&gt;

  &lt;span style=&quot;color: #a020f0;&quot;&gt;def&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;show_project_names&lt;/span&gt;...
  &lt;span style=&quot;color: #a020f0;&quot;&gt;end&lt;/span&gt;
  
&lt;span style=&quot;color: #a020f0;&quot;&gt;end&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;if I press Alt+3 2, all code indented at level 2 will be wrapped:&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;background-color: #f9f9f9; border: 1px solid silver; margin: 0 0 1.5em; padding: 0 1em 0 1em;&quot;&gt;&lt;pre&gt;&lt;span style=&quot;color: #a020f0;&quot;&gt;class&lt;/span&gt; &lt;span style=&quot;color: forestgreen;&quot;&gt;User&lt;/span&gt; &amp;lt; &lt;span style=&quot;color: forestgreen;&quot;&gt;ActiveRecord&lt;/span&gt;...  &lt;/pre&gt;&lt;pre&gt;&lt;span style=&quot;color: #a020f0;&quot;&gt;end&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;if I press Alt+3 0, wrapped code will be unwrapped again.&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;background-color: #f9f9f9; border: 1px solid silver; margin: 0 0 1.5em; padding: 0 1em 0 1em;&quot;&gt;&lt;pre&gt;&lt;span style=&quot;color: #a020f0;&quot;&gt;class&lt;/span&gt; &lt;span style=&quot;color: forestgreen;&quot;&gt;User&lt;/span&gt; &amp;lt; &lt;span style=&quot;color: forestgreen;&quot;&gt;ActiveRecord&lt;/span&gt;
  has_many &lt;span style=&quot;color: cadetblue;&quot;&gt;:projects&lt;/span&gt;
  has_many &lt;span style=&quot;color: cadetblue;&quot;&gt;:assignments&lt;/span&gt;

  &lt;span style=&quot;color: #a020f0;&quot;&gt;def&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;full_name&lt;/span&gt;
    &lt;span style=&quot;color: rosybrown;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: darkgoldenrod;&quot;&gt;#{first_name}&lt;/span&gt;&lt;span style=&quot;color: rosybrown;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: darkgoldenrod;&quot;&gt;#{last_name}&lt;/span&gt;&lt;span style=&quot;color: rosybrown;&quot;&gt;&quot;&lt;/span&gt;
  &lt;span style=&quot;color: #a020f0;&quot;&gt;end&lt;/span&gt;

  &lt;span style=&quot;color: #a020f0;&quot;&gt;def&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;show_project_names&lt;/span&gt;
    projects.each &lt;span style=&quot;color: #a020f0;&quot;&gt;do&lt;/span&gt; |prj|
      puts prj.name
    &lt;span style=&quot;color: #a020f0;&quot;&gt;end&lt;/span&gt;
  &lt;span style=&quot;color: #a020f0;&quot;&gt;end&lt;/span&gt;
  
&lt;span style=&quot;color: #a020f0;&quot;&gt;end&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;It&#39;s quite fun, right?</content><link rel='replies' type='application/atom+xml' href='http://trbhoang.blogspot.com/feeds/5873793859245810074/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5233946537982084404/5873793859245810074' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5233946537982084404/posts/default/5873793859245810074'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5233946537982084404/posts/default/5873793859245810074'/><link rel='alternate' type='text/html' href='http://trbhoang.blogspot.com/2011/04/code-folding-in-emacs.html' title='Code folding in Emacs'/><author><name>Hoang Tran</name><uri>http://www.blogger.com/profile/08678314335089274137</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjmUnxOybiZICKW5r-3bTq3UTUbzNN2jjXBk7CXJ9QR429gtjy9q5w6rcAAK85rE4Lezws7lIqMT-CSDfY8IxmlLv70152RAaH9y_HcXFJmFXejhoTGdzFuDbeeY3ITIA/s220/baby.gif.thumb.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5233946537982084404.post-5134555198202961149</id><published>2011-03-20T02:38:00.000-07:00</published><updated>2011-03-20T02:42:39.568-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Algorithm"/><category scheme="http://www.blogger.com/atom/ns#" term="Ruby"/><category scheme="http://www.blogger.com/atom/ns#" term="Ruby on Rails"/><title type='text'>A simple URL shortening algorithm</title><content type='html'>Shortening a URL is a&amp;nbsp;convenient way to save long URL to make use of space when posting. It&#39;s especially popular on Twitter where message is limited to 140 words. Many websites provide this service such as &lt;a href=&quot;http://tinyurl.com/&quot;&gt;tinyurl.com&lt;/a&gt;, &lt;a href=&quot;http://bit.ly/&quot;&gt;bit.ly&lt;/a&gt;,...&lt;br /&gt;
&lt;br /&gt;
There some &lt;a href=&quot;http://www.marketingformavens.com/blog/url-shortening-bitly-ruby-on-rails&quot;&gt;gems&lt;/a&gt; or &lt;a href=&quot;http://nasir.wordpress.com/2009/11/26/url-shortener-gem-bitly-api-wrapper-in-ruby/&quot;&gt;wrapper&lt;/a&gt; to use that service in your Rails app. But the shortened URLs belong to another domain (ex:&amp;nbsp;&lt;a href=&quot;http://bit.ly/ek8Hhe&quot;&gt;http://bit.ly/ek8Hhe&lt;/a&gt;&amp;nbsp;which belongs to &lt;a href=&quot;http://bit.ly/&quot;&gt;bit.ly&lt;/a&gt;). If you want to make it belonged to your domain (ex: &lt;a href=&quot;http://example.com/wfds7i&quot;&gt;http://example.com/wfds7i&lt;/a&gt;), you must implement your own URLs shortener.&lt;br /&gt;
&lt;br /&gt;
This is a &lt;a href=&quot;http://blog.pilsch.com/past/2009/6/7/shorten_your_own_damn_urls/&quot;&gt;simple way&lt;/a&gt; to do that.&lt;br /&gt;
&lt;br /&gt;
Basically, the problem is:&lt;br /&gt;
&lt;blockquote&gt;given a URL,&amp;nbsp;how to map it to a string which has pattern XXXXXX, where X belongs to {0..9a-zA-Z}.&amp;nbsp;There would be 62^6 =&amp;nbsp;56800235584 such strings. That amount is almost enough.&lt;/blockquote&gt;&lt;div&gt;Then the simple idea to solve that problem is:&lt;br /&gt;
&lt;blockquote&gt;map the URL to an integer in 1..62^6.&amp;nbsp;That number must correspond to a string in space {XXXXXX} that could be calculated by using a 10-base to 62-base conversion algorithm (you can understand easily by figuring out how to convert a decimal number to hexa number).&amp;nbsp;&lt;/blockquote&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;Here is an implementation of mine in Ruby:&lt;br /&gt;
&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;background-color: #f9f9f9; border: 1px solid silver; margin: 0 0 1.5em; padding: 0 1em 0 1em;&quot;&gt;&lt;pre&gt;&lt;span style=&quot;color: #a020f0;&quot;&gt;class&lt;/span&gt; &lt;span style=&quot;color: forestgreen;&quot;&gt;URLShortener&lt;/span&gt;
  &lt;span style=&quot;color: forestgreen;&quot;&gt;CHARSET&lt;/span&gt; = &lt;span style=&quot;color: rosybrown;&quot;&gt;&quot;0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ&quot;&lt;/span&gt;
  &lt;span style=&quot;color: forestgreen;&quot;&gt;BASE&lt;/span&gt; = 62
  &lt;span style=&quot;color: forestgreen;&quot;&gt;CODE_LENGTH&lt;/span&gt; = 6

  &lt;span style=&quot;color: #a020f0;&quot;&gt;def&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;self.encode&lt;/span&gt;(id)
    code = &lt;span style=&quot;color: rosybrown;&quot;&gt;&quot;&quot;&lt;/span&gt;
    &lt;span style=&quot;color: #a020f0;&quot;&gt;while&lt;/span&gt; (id &amp;gt; 0) &lt;span style=&quot;color: #a020f0;&quot;&gt;do&lt;/span&gt;
      code = &lt;span style=&quot;color: forestgreen;&quot;&gt;CHARSET&lt;/span&gt;[id % &lt;span style=&quot;color: forestgreen;&quot;&gt;BASE&lt;/span&gt;].chr + code
      id = id / &lt;span style=&quot;color: forestgreen;&quot;&gt;BASE&lt;/span&gt;
    &lt;span style=&quot;color: #a020f0;&quot;&gt;end&lt;/span&gt;

    (code.length &amp;gt; &lt;span style=&quot;color: forestgreen;&quot;&gt;CODE_LENGTH&lt;/span&gt;) ? &lt;span style=&quot;color: rosybrown;&quot;&gt;&quot;&quot;&lt;/span&gt; : &lt;span style=&quot;color: rosybrown;&quot;&gt;&quot;0&quot;&lt;/span&gt; * (&lt;span style=&quot;color: forestgreen;&quot;&gt;CODE_LENGTH&lt;/span&gt; - code.length) + code 
  &lt;span style=&quot;color: #a020f0;&quot;&gt;end&lt;/span&gt;

  &lt;span style=&quot;color: #a020f0;&quot;&gt;def&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;self.decode&lt;/span&gt;(code)
    &lt;span style=&quot;color: #a020f0;&quot;&gt;return&lt;/span&gt; -1 &lt;span style=&quot;color: #a020f0;&quot;&gt;if&lt;/span&gt; code.length != &lt;span style=&quot;color: forestgreen;&quot;&gt;CODE_LENGTH&lt;/span&gt;
    id = 0
    &lt;span style=&quot;color: #a020f0;&quot;&gt;for&lt;/span&gt; i &lt;span style=&quot;color: #a020f0;&quot;&gt;in&lt;/span&gt; 0..(&lt;span style=&quot;color: forestgreen;&quot;&gt;CODE_LENGTH&lt;/span&gt;-1) &lt;span style=&quot;color: #a020f0;&quot;&gt;do&lt;/span&gt;
      n = &lt;span style=&quot;color: forestgreen;&quot;&gt;CHARSET&lt;/span&gt;.index(code[i])
      &lt;span style=&quot;color: #a020f0;&quot;&gt;return&lt;/span&gt; -1 &lt;span style=&quot;color: #a020f0;&quot;&gt;if&lt;/span&gt; n.nil?
      id += n * (&lt;span style=&quot;color: forestgreen;&quot;&gt;BASE&lt;/span&gt; ** (&lt;span style=&quot;color: forestgreen;&quot;&gt;CODE_LENGTH&lt;/span&gt; - i - 1))
    &lt;span style=&quot;color: #a020f0;&quot;&gt;end&lt;/span&gt;
    &lt;span style=&quot;color: #a020f0;&quot;&gt;return&lt;/span&gt; id
  &lt;span style=&quot;color: #a020f0;&quot;&gt;end&lt;/span&gt;
&lt;span style=&quot;color: #a020f0;&quot;&gt;end&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://trbhoang.blogspot.com/feeds/5134555198202961149/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5233946537982084404/5134555198202961149' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5233946537982084404/posts/default/5134555198202961149'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5233946537982084404/posts/default/5134555198202961149'/><link rel='alternate' type='text/html' href='http://trbhoang.blogspot.com/2011/03/simple-url-shortening-algorithm.html' title='A simple URL shortening algorithm'/><author><name>Hoang Tran</name><uri>http://www.blogger.com/profile/08678314335089274137</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjmUnxOybiZICKW5r-3bTq3UTUbzNN2jjXBk7CXJ9QR429gtjy9q5w6rcAAK85rE4Lezws7lIqMT-CSDfY8IxmlLv70152RAaH9y_HcXFJmFXejhoTGdzFuDbeeY3ITIA/s220/baby.gif.thumb.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5233946537982084404.post-6109983114814808641</id><published>2011-03-20T00:13:00.000-07:00</published><updated>2011-06-19T23:35:11.074-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Ajax"/><category scheme="http://www.blogger.com/atom/ns#" term="Javascript"/><category scheme="http://www.blogger.com/atom/ns#" term="jQuery"/><title type='text'>Making ajax form</title><content type='html'>Making an ajax form is a javascript code snippet that we see very frequently. So I&#39;ve tried to write it as a pattern that could be easy to reuse when needed.&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;background-color: #f9f9f9; border: 1px solid silver; margin: 0pt 0pt 1.5em; padding: 0pt 1em;&quot;&gt;&lt;pre&gt;&amp;lt;&lt;span style=&quot;color: blue;&quot;&gt;form&lt;/span&gt; &lt;span style=&quot;color: darkgoldenrod;&quot;&gt;action&lt;/span&gt;=&lt;span style=&quot;color: rosybrown;&quot;&gt;&quot;do_something&quot;&lt;/span&gt; &lt;span style=&quot;color: darkgoldenrod;&quot;&gt;method&lt;/span&gt;=&lt;span style=&quot;color: rosybrown;&quot;&gt;&quot;post&quot;&lt;/span&gt; &lt;span style=&quot;color: darkgoldenrod;&quot;&gt;id&lt;/span&gt;=&lt;span style=&quot;color: rosybrown;&quot;&gt;&quot;do_something_form&quot;&lt;/span&gt;&amp;gt; 
  Field 1: &amp;lt;&lt;span style=&quot;color: blue;&quot;&gt;input&lt;/span&gt; &lt;span style=&quot;color: darkgoldenrod;&quot;&gt;type&lt;/span&gt;=&lt;span style=&quot;color: rosybrown;&quot;&gt;&quot;text&quot;&lt;/span&gt; &lt;span style=&quot;color: darkgoldenrod;&quot;&gt;name&lt;/span&gt;=&lt;span style=&quot;color: rosybrown;&quot;&gt;&quot;field1&quot;&lt;/span&gt; &lt;span style=&quot;color: darkgoldenrod;&quot;&gt;id&lt;/span&gt;=&lt;span style=&quot;color: rosybrown;&quot;&gt;&quot;field1&quot;&lt;/span&gt; /&amp;gt; 
  &amp;lt;&lt;span style=&quot;color: blue;&quot;&gt;br&lt;/span&gt; /&amp;gt; 
  Field 2: &amp;lt;&lt;span style=&quot;color: blue;&quot;&gt;input&lt;/span&gt; &lt;span style=&quot;color: darkgoldenrod;&quot;&gt;type&lt;/span&gt;=&lt;span style=&quot;color: rosybrown;&quot;&gt;&quot;text&quot;&lt;/span&gt; &lt;span style=&quot;color: darkgoldenrod;&quot;&gt;name&lt;/span&gt;=&lt;span style=&quot;color: rosybrown;&quot;&gt;&quot;field2&quot;&lt;/span&gt; &lt;span style=&quot;color: darkgoldenrod;&quot;&gt;id&lt;/span&gt;=&lt;span style=&quot;color: rosybrown;&quot;&gt;&quot;field2&quot;&lt;/span&gt;/&amp;gt; 
  &amp;lt;&lt;span style=&quot;color: blue;&quot;&gt;br&lt;/span&gt; /&amp;gt; 
  &amp;lt;&lt;span style=&quot;color: blue;&quot;&gt;input&lt;/span&gt; &lt;span style=&quot;color: darkgoldenrod;&quot;&gt;type&lt;/span&gt;=&lt;span style=&quot;color: rosybrown;&quot;&gt;&quot;submit&quot;&lt;/span&gt; &lt;span style=&quot;color: darkgoldenrod;&quot;&gt;value&lt;/span&gt;=&lt;span style=&quot;color: rosybrown;&quot;&gt;&quot;Submit&quot;&lt;/span&gt; /&amp;gt; 
&amp;lt;/&lt;span style=&quot;color: blue;&quot;&gt;form&lt;/span&gt;&amp;gt; 

&amp;lt;&lt;span style=&quot;color: blue;&quot;&gt;script&lt;/span&gt;&amp;gt;
  jQuery(&#39;#do_something_form&#39;).submit(function(event){
    // stop normal form submitting
    event.preventDefault();
  
    // get form&#39;s fields
    var field1_val = jQuery(&#39;#field1&#39;).val(),
        field2_val = jQuery(&#39;#field2&#39;).val(),
        url        = jQuery(this).attr(&#39;action&#39;);

    // send request
    jQuery.post(url,                   // ajax url
                {
                  field1: field1_val,
                  field2: field2_val
                },                     // data passed to server side
                function(response){    // callback 
                  // do things with response data, ex:
                  alert(response[&lt;span style=&quot;color: rosybrown;&quot;&gt;&quot;message&quot;&lt;/span&gt;]);
                  if (response[&lt;span style=&quot;color: rosybrown;&quot;&gt;&quot;success&quot;&lt;/span&gt;] == true) {
                    // ... 
                  }
                },
                &lt;span style=&quot;color: rosybrown;&quot;&gt;&quot;json&quot;&lt;/span&gt;                 // response&#39;s format 
    );
  });
&amp;lt;/&lt;span style=&quot;color: blue;&quot;&gt;script&lt;/span&gt;&amp;gt;&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;&lt;b&gt;Then at backend:&lt;/b&gt;&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;&lt;span style=&quot;color: #a020f0;&quot;&gt;def&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;create&lt;/span&gt;
  &lt;span style=&quot;color: darkgoldenrod;&quot;&gt;@form&lt;/span&gt; = params
  
  &lt;span style=&quot;color: #a020f0;&quot;&gt;if&lt;/span&gt; some_condition
    &lt;span style=&quot;color: darkgoldenrod;&quot;&gt;@result&lt;/span&gt; = {
      &lt;span style=&quot;color: cadetblue;&quot;&gt;:success&lt;/span&gt;    =&amp;gt; &lt;span style=&quot;color: darkgoldenrod;&quot;&gt;true&lt;/span&gt;,
      &lt;span style=&quot;color: cadetblue;&quot;&gt;:message&lt;/span&gt;    =&amp;gt; &lt;span style=&quot;color: rosybrown;&quot;&gt;&quot;Resource has been created successfully!&quot;&lt;/span&gt;,
      &lt;span style=&quot;color: cadetblue;&quot;&gt;:other_data&lt;/span&gt; =&amp;gt; {}
    }
  &lt;span style=&quot;color: #a020f0;&quot;&gt;else&lt;/span&gt;
    &lt;span style=&quot;color: darkgoldenrod;&quot;&gt;@result&lt;/span&gt; = {
      &lt;span style=&quot;color: cadetblue;&quot;&gt;:success&lt;/span&gt; =&amp;gt; &lt;span style=&quot;color: darkgoldenrod;&quot;&gt;false&lt;/span&gt;,
      &lt;span style=&quot;color: cadetblue;&quot;&gt;:message&lt;/span&gt; =&amp;gt; &lt;span style=&quot;color: rosybrown;&quot;&gt;&quot;Creation failed! Please try again!&quot;&lt;/span&gt;
    }
  &lt;span style=&quot;color: #a020f0;&quot;&gt;end&lt;/span&gt;

  render &lt;span style=&quot;color: cadetblue;&quot;&gt;:text&lt;/span&gt; =&amp;gt; &lt;span style=&quot;color: darkgoldenrod;&quot;&gt;@result&lt;/span&gt;.to_json
&lt;span style=&quot;color: #a020f0;&quot;&gt;end&lt;/span&gt;
&lt;/pre&gt;&lt;pre&gt;&lt;/pre&gt;&lt;pre&gt;&lt;/pre&gt;&lt;/div&gt;Reference:&lt;br /&gt;
&lt;a href=&quot;http://api.jquery.com/jQuery.post/&quot;&gt;http://api.jquery.com/jQuery.post/&lt;/a&gt;</content><link rel='replies' type='application/atom+xml' href='http://trbhoang.blogspot.com/feeds/6109983114814808641/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5233946537982084404/6109983114814808641' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5233946537982084404/posts/default/6109983114814808641'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5233946537982084404/posts/default/6109983114814808641'/><link rel='alternate' type='text/html' href='http://trbhoang.blogspot.com/2011/03/making-ajax-form.html' title='Making ajax form'/><author><name>Hoang Tran</name><uri>http://www.blogger.com/profile/08678314335089274137</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjmUnxOybiZICKW5r-3bTq3UTUbzNN2jjXBk7CXJ9QR429gtjy9q5w6rcAAK85rE4Lezws7lIqMT-CSDfY8IxmlLv70152RAaH9y_HcXFJmFXejhoTGdzFuDbeeY3ITIA/s220/baby.gif.thumb.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5233946537982084404.post-3055439467749093715</id><published>2011-03-13T00:40:00.000-08:00</published><updated>2011-03-13T08:22:54.407-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Kinh tế"/><title type='text'>Tổng quan về kinh tế học #1</title><content type='html'>&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhJUj_hPSopth_gZW4dbKIsZSL1KcdetjMWygII9BEAGyQXKUyVJ9aCIKBGQKRV8X4ag76NfVRnZNigtAojnOlZyVSyeGkD1znCPu3xuEuhGx2EHylK543L4Dwg56SaeJLwxmcU8Q60bg0/s1600/economics.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;285&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhJUj_hPSopth_gZW4dbKIsZSL1KcdetjMWygII9BEAGyQXKUyVJ9aCIKBGQKRV8X4ag76NfVRnZNigtAojnOlZyVSyeGkD1znCPu3xuEuhGx2EHylK543L4Dwg56SaeJLwxmcU8Q60bg0/s400/economics.jpg&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
Nói đến &lt;span class=&quot;Apple-style-span&quot; style=&quot;color: blue;&quot;&gt;&lt;b&gt;kinh tế&lt;/b&gt;&lt;/span&gt; là nói đến quá trình sản xuất, trao đổi hàng hóa, của cải vật chất và tinh thần trong xã hội. Thông qua quá trình đó, con người tương tác với nhau để tạo ra của cải vật chất hay những giá trị mới, tái phân bổ chúng, phục vụ cho các nhu cầu trong cuộc sống, rồi lại lao động và lại tái tạo ra những giá trị mới khác,... Đó là tổng thể của cái gọi là nền kinh tế. Làm sao để nền kinh tế tạo ra thật nhiều giá trị? Làm sao để quá trình sản xuất và lưu thông hàng hóa hiệu quả hơn?... Đó là những vấn đề của &lt;b&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: blue;&quot;&gt;kinh tế học&lt;/span&gt;&lt;/b&gt;.&lt;br /&gt;
&lt;br /&gt;
Một trong những yếu tố cơ bản của nền kinh tế là thị trường và tiền tệ.&lt;br /&gt;
&lt;br /&gt;
Nơi hàng hóa được đem ra trao đổi, mua bán được gọi là &lt;span class=&quot;Apple-style-span&quot; style=&quot;color: blue;&quot;&gt;&lt;b&gt;thị trường&lt;/b&gt;&lt;/span&gt;. Vd: thị trường bất động sản, thị trường chứng khoán, chợ,...&lt;br /&gt;
&lt;br /&gt;
Hàng hóa có thể được trao đổi, mua bán trên thị trường dưới nhiều hình thức:&lt;br /&gt;
- Trao đổi trực tiếp:&lt;br /&gt;
&amp;nbsp;&amp;nbsp; vd: 1 trâu đổi 100 thúng lúa&lt;br /&gt;
- Trao đổi gián tiếp (quy đổi sang một loại hàng hóa trung gian)&lt;br /&gt;
&amp;nbsp;&amp;nbsp; vd: 1 trâu &amp;lt;-&amp;gt; 100 thúng lúa&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1 bò &amp;lt;-&amp;gt; 80 thúng lúa&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1 căn nhà &amp;lt;-&amp;gt; 1000 thúng lúa&lt;br /&gt;
&amp;nbsp;&amp;nbsp; hoặc,&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1 trâu &amp;lt;-&amp;gt; 1 lượng vàng&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1 bò &amp;lt;-&amp;gt; 0.5 lượng vàng&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1 nhà &amp;lt;-&amp;gt; 100 lượng vàng&lt;br /&gt;
&lt;br /&gt;
Yếu tố đóng vai trò trung gian trong trao đổi hàng hóa được gọi là &lt;span class=&quot;Apple-style-span&quot; style=&quot;color: blue;&quot;&gt;&lt;b&gt;tiền tệ&lt;/b&gt;&lt;/span&gt;. Thời xưa, tiền tệ cũng chính là hàng hóa (lúa, vàng, bạc,...), bản thân chúng có giá trị nội tại. Khi kinh tế ngày càng phát triển, nhiều hình thức tiền tệ khác ra đời làm cho quá trình trao đổi, lưu thông hàng hóa thuận tiện, nhanh chóng hơn như tiền đồng, tiền giấy, tiền điện tử,... Tiền tệ trở về với đúng bản chất của nó: làm trung gian trong trao đổi hàng hóa, bản thân nó không có hoặc có rất ít giá trị nội tại. Vai trò trung gian, đại diện cho giá trị thực đó của tiền tệ được đảm bảo bởi nhà nước và pháp luật.</content><link rel='replies' type='application/atom+xml' href='http://trbhoang.blogspot.com/feeds/3055439467749093715/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5233946537982084404/3055439467749093715' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5233946537982084404/posts/default/3055439467749093715'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5233946537982084404/posts/default/3055439467749093715'/><link rel='alternate' type='text/html' href='http://trbhoang.blogspot.com/2011/03/tong-quan-ve-kinh-te-hoc-1.html' title='Tổng quan về kinh tế học #1'/><author><name>Hoang Tran</name><uri>http://www.blogger.com/profile/08678314335089274137</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjmUnxOybiZICKW5r-3bTq3UTUbzNN2jjXBk7CXJ9QR429gtjy9q5w6rcAAK85rE4Lezws7lIqMT-CSDfY8IxmlLv70152RAaH9y_HcXFJmFXejhoTGdzFuDbeeY3ITIA/s220/baby.gif.thumb.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhJUj_hPSopth_gZW4dbKIsZSL1KcdetjMWygII9BEAGyQXKUyVJ9aCIKBGQKRV8X4ag76NfVRnZNigtAojnOlZyVSyeGkD1znCPu3xuEuhGx2EHylK543L4Dwg56SaeJLwxmcU8Q60bg0/s72-c/economics.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5233946537982084404.post-7729470631592754897</id><published>2011-03-12T09:38:00.000-08:00</published><updated>2011-05-20T21:42:37.399-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Ruby on Rails"/><title type='text'>Be careful writing hooks to Rack layer (middle ware layer) in Rails</title><content type='html'>I&#39;ve got this error from a Rails project:&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: blue; font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;ERROR NoMethodError: private method `split&#39; called for 0:Fixnum&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: blue; font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: blue;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: black; font-family: inherit;&quot;&gt;Following the link below gave me some clues:&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: blue; font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: black; font-family: &#39;Times New Roman&#39;;&quot;&gt;&lt;a href=&quot;http://rack.lighthouseapp.com/projects/22435/tickets/52-read-error-nomethoderror-private-method-split-called-for-0fixnum&quot;&gt;http://rack.lighthouseapp.com/projects/22435/tickets/52-read-error-nomethoderror-private-method-split-called-for-0fixnum&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;color: black; font-family: &#39;Times New Roman&#39;; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: blue;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: black; font-family: inherit;&quot;&gt;1. something&#39;s wrong in Rack layer&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: blue;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: black; font-family: inherit;&quot;&gt;2. someone wrote incorrect code that hooked to Rack layer&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: blue;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: black; font-family: inherit;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;Case #1:&amp;nbsp;rarely happened&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: blue;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: black; font-family: inherit;&quot;&gt;Case #2: may be&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;I did some search and found this code in authentication module:&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;color: blue; font-family: &#39;Courier New&#39;, Courier, monospace; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;response.headers[&quot;Expires&quot;] = 0&lt;/div&gt;&lt;div style=&quot;color: blue; font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: blue; font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: black; font-family: &#39;Times New Roman&#39;;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;color: blue;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: blue;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: black; font-family: inherit;&quot;&gt;This must be the cause of the error.&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;color: blue;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: blue;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: black; font-family: inherit;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;color: blue;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: blue;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: black; font-family: inherit;&quot;&gt;Though the correct code is just:&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;color: blue; font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: blue; font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: black; font-family: &#39;Times New Roman&#39;;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: blue; font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;response.headers[&quot;Expires&quot;] = &quot;0&quot;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;color: blue; font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: blue; font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: black; font-family: &#39;Times New Roman&#39;;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: blue;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: black; font-family: inherit;&quot;&gt;it still took me over a day to find out and fix that bug!!!&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit; font-size: large;&quot;&gt;&lt;b&gt;&lt;i&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: blue;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: black;&quot;&gt;&lt;/span&gt;&lt;/span&gt;Simple but not simple!&lt;/i&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;color: blue; font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: blue; font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: black; font-family: &#39;Times New Roman&#39;;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://trbhoang.blogspot.com/feeds/7729470631592754897/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5233946537982084404/7729470631592754897' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5233946537982084404/posts/default/7729470631592754897'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5233946537982084404/posts/default/7729470631592754897'/><link rel='alternate' type='text/html' href='http://trbhoang.blogspot.com/2011/03/be-careful-writing-hooks-to-rack-layer.html' title='Be careful writing hooks to Rack layer (middle ware layer) in Rails'/><author><name>Hoang Tran</name><uri>http://www.blogger.com/profile/08678314335089274137</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjmUnxOybiZICKW5r-3bTq3UTUbzNN2jjXBk7CXJ9QR429gtjy9q5w6rcAAK85rE4Lezws7lIqMT-CSDfY8IxmlLv70152RAaH9y_HcXFJmFXejhoTGdzFuDbeeY3ITIA/s220/baby.gif.thumb.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5233946537982084404.post-6019132437329953795</id><published>2011-03-12T07:06:00.000-08:00</published><updated>2011-03-12T22:25:59.138-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Ruby"/><category scheme="http://www.blogger.com/atom/ns#" term="Ruby on Rails"/><title type='text'>A case of &quot;Broken Pipe&quot; error in Rails</title><content type='html'>Have you ever seen &quot;Broken PIPE&quot; error in Rails?&lt;br /&gt;
&lt;br /&gt;
It somehow like this:&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;border-collapse: collapse; font-family: Arial, &#39;Liberation Sans&#39;, &#39;DejaVu Sans&#39;, sans-serif; font-size: 14px; line-height: 18px;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;pre class=&quot;default prettyprint&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: #eeeeee; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; font-family: Consolas, Menlo, Monaco, &#39;Lucida Console&#39;, &#39;Liberation Mono&#39;, &#39;DejaVu Sans Mono&#39;, &#39;Bitstream Vera Sans Mono&#39;, &#39;Courier New&#39;, monospace, serif; font-size: 14px; margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 0px; max-height: 600px; overflow-x: auto; overflow-y: auto; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; padding-top: 5px; vertical-align: baseline; width: auto;&quot;&gt;&lt;code style=&quot;background-attachment: initial; background-clip: initial; background-color: #eeeeee; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; font-family: Consolas, Menlo, Monaco, &#39;Lucida Console&#39;, &#39;Liberation Mono&#39;, &#39;DejaVu Sans Mono&#39;, &#39;Bitstream Vera Sans Mono&#39;, &#39;Courier New&#39;, monospace, serif; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;&lt;span class=&quot;pun&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;***&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: #2b91af; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;Exception&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: #2b91af; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;Errno&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;EPIPE &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: darkblue; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;in&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: #2b91af; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;Passenger&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: #2b91af; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;RequestHandler&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: #2b91af; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;Broken&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt; pipe&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;process &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: maroon; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;22235&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;):&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: darkblue; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;usr&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;lib&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;ruby&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;gems&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: maroon; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;1.8&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;gems&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;passenger&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: maroon; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;2.1&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: maroon; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;lib&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;phusion_passenger&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;rack&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;request_handler&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;rb&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: maroon; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;67&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: darkblue; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;in&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: maroon; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;&quot;&gt;`write&#39;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
This error seems appear when your program interacts improperly with external programs. In my case, it happened to me in a project that I used XMLRPC library to remotely communicate with some web services.&lt;br /&gt;
&lt;br /&gt;
My implementation for that feature is as following:&lt;br /&gt;
- create a XMLRPC connection object&lt;br /&gt;
- use that XMLRPC object every time calling a webservice API&lt;br /&gt;
&lt;br /&gt;
There some other guys had been headache with that error also:&lt;br /&gt;
&lt;a href=&quot;http://gaveen.owain.org/2008/04/errnoepipe-broken-pipe-mysql-error-in.html&quot;&gt;http://gaveen.owain.org/2008/04/errnoepipe-broken-pipe-mysql-error-in.html&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;http://stackoverflow.com/questions/1082166/exception-errnoepipe-in-passenger-requesthandler-broken-pipe&quot;&gt;http://stackoverflow.com/questions/1082166/exception-errnoepipe-in-passenger-requesthandler-broken-pipe&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;http://stackoverflow.com/questions/4351624/ruby-on-rails-errnoepipe-broken-pipe&quot;&gt;http://stackoverflow.com/questions/4351624/ruby-on-rails-errnoepipe-broken-pipe&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
and the reasons they found come around Passenger or Mysql.&lt;br /&gt;
&lt;br /&gt;
In my case, I&#39;ve got the same thing even with upgrading Passenger or migrating to another web server.&lt;br /&gt;
After a lot of retries, I&#39;ve found that if I call the API very often, &quot;Broken pipe&quot; doesn&#39;t appear, but if I stop doing anything for a while and then call the API, it does happen. That observation led me to a guess: XMLRPC connection object may be broken after a certain amount of time (timeout). Excellently, that&#39;s exactly right! I then changed my implementation so that every time calling a webservice API, I use a newly created XMLRPC connection object instead of using the same XMLRPC connection object for every API calls.&lt;br /&gt;
&lt;br /&gt;
That solved my problem!&lt;br /&gt;
&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://trbhoang.blogspot.com/feeds/6019132437329953795/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5233946537982084404/6019132437329953795' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5233946537982084404/posts/default/6019132437329953795'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5233946537982084404/posts/default/6019132437329953795'/><link rel='alternate' type='text/html' href='http://trbhoang.blogspot.com/2011/03/case-of-broken-pipe-error-in-rails.html' title='A case of &quot;Broken Pipe&quot; error in Rails'/><author><name>Hoang Tran</name><uri>http://www.blogger.com/profile/08678314335089274137</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjmUnxOybiZICKW5r-3bTq3UTUbzNN2jjXBk7CXJ9QR429gtjy9q5w6rcAAK85rE4Lezws7lIqMT-CSDfY8IxmlLv70152RAaH9y_HcXFJmFXejhoTGdzFuDbeeY3ITIA/s220/baby.gif.thumb.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5233946537982084404.post-7580172097080625955</id><published>2011-02-22T09:08:00.000-08:00</published><updated>2011-03-12T22:24:17.423-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Django"/><category scheme="http://www.blogger.com/atom/ns#" term="Python"/><title type='text'>Django Overview</title><content type='html'>&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjq_LWL90krQ-wdRVLYFfg3AXAZLQ-ebjBV1Jzioa8yN4aTCYgFDyY3SgIvRc7QXW_QGGPyfsNNpTkUzQe8H_KN4WfznvCzuzKkcZ8RNY7HkAVxNooBmdQxHIhBWf6r0LdILjMHZz0eWPc/s1600/DjangoOverview.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;297&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjq_LWL90krQ-wdRVLYFfg3AXAZLQ-ebjBV1Jzioa8yN4aTCYgFDyY3SgIvRc7QXW_QGGPyfsNNpTkUzQe8H_KN4WfznvCzuzKkcZ8RNY7HkAVxNooBmdQxHIhBWf6r0LdILjMHZz0eWPc/s400/DjangoOverview.jpg&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;(will add more soon...)</content><link rel='replies' type='application/atom+xml' href='http://trbhoang.blogspot.com/feeds/7580172097080625955/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5233946537982084404/7580172097080625955' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5233946537982084404/posts/default/7580172097080625955'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5233946537982084404/posts/default/7580172097080625955'/><link rel='alternate' type='text/html' href='http://trbhoang.blogspot.com/2011/02/django-overview.html' title='Django Overview'/><author><name>Hoang Tran</name><uri>http://www.blogger.com/profile/08678314335089274137</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjmUnxOybiZICKW5r-3bTq3UTUbzNN2jjXBk7CXJ9QR429gtjy9q5w6rcAAK85rE4Lezws7lIqMT-CSDfY8IxmlLv70152RAaH9y_HcXFJmFXejhoTGdzFuDbeeY3ITIA/s220/baby.gif.thumb.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjq_LWL90krQ-wdRVLYFfg3AXAZLQ-ebjBV1Jzioa8yN4aTCYgFDyY3SgIvRc7QXW_QGGPyfsNNpTkUzQe8H_KN4WfznvCzuzKkcZ8RNY7HkAVxNooBmdQxHIhBWf6r0LdILjMHZz0eWPc/s72-c/DjangoOverview.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5233946537982084404.post-2878498482805899448</id><published>2011-02-19T07:11:00.000-08:00</published><updated>2011-03-12T22:25:07.443-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Django"/><category scheme="http://www.blogger.com/atom/ns#" term="Python"/><title type='text'>#1 Setup a basic Django project</title><content type='html'>, I&#39;ve been getting more and more interested in Django. I think why shouldn&#39;t I write a series about it. So, let&#39;s start with the basics first: how to setup Django development environment and build a basic Django project.&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: blue;&quot;&gt;&lt;b&gt;1. Setup environments&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;Install Python&lt;/li&gt;
&lt;/ul&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; Get Python at http://www.python.org&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; To verify if it&#39;s already installed, at console:&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp;&amp;nbsp; $ python&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp;&amp;nbsp; Python 2.6.6 (r266:84292, Sep 15 2010, 15:52:39)&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp;&amp;nbsp; [GCC 4.4.5] on linux2&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp;&amp;nbsp; Type &quot;help&quot;, &quot;copyright&quot;, &quot;credits&quot; or &quot;license&quot; for more information.&lt;/span&gt;&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;Install Django&lt;/li&gt;
&lt;/ul&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; Download a Django release at http://www.djangoproject.com/download/&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp;&amp;nbsp; $ tar xzvf Django.tar.gz&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp;&amp;nbsp; $ cd Django&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp;&amp;nbsp; $ sudo python setup.py install&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; To verfiy what&#39;s your current Django&#39;s version&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp;&amp;nbsp; $ python&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;gt;&amp;gt;&amp;gt; import django&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;gt;&amp;gt;&amp;gt; django.get_version()&lt;/span&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp; &lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: blue;&quot;&gt;&lt;b&gt;2. Create a basic Django project&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;To initialize project&amp;nbsp;&lt;/li&gt;
&lt;/ul&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;$ django-admin.py startproject mysite&lt;/span&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;This will create a basic Django project in mysite directory that looks as below&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;mysite/&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; __init__.py&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; manage.py&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; settings.py&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; urls.py&lt;/span&gt;&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;Now run a development webserver to see if your Django site works&lt;/li&gt;
&lt;/ul&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;$ python manage.py runserver&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;Validating models...&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;0 errors found.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;Django version 1.0, using settings &#39;mysite.settings&#39;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;Development server is running at http://127.0.0.1:8000/&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;Quit the server with CONTROL-C. &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;Goto http://127.0.0.1:8000 on your Web browser, you&#39;ll see a &quot;Welcome to Django&quot; page. It&#39;s works!&lt;/li&gt;
&lt;/ul&gt;So, you have setup a very basic Django project. If you want to make more complex stuffs, you may need to use a database backend, create some models, build your site&#39;s templates, mapping urls to what will process &amp;amp; response the corressponding templates (Django call this &quot;views&quot;), add some caching mechanisms to boost performance,...</content><link rel='replies' type='application/atom+xml' href='http://trbhoang.blogspot.com/feeds/2878498482805899448/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5233946537982084404/2878498482805899448' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5233946537982084404/posts/default/2878498482805899448'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5233946537982084404/posts/default/2878498482805899448'/><link rel='alternate' type='text/html' href='http://trbhoang.blogspot.com/2011/02/setup-basic-django-project.html' title='#1 Setup a basic Django project'/><author><name>Hoang Tran</name><uri>http://www.blogger.com/profile/08678314335089274137</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjmUnxOybiZICKW5r-3bTq3UTUbzNN2jjXBk7CXJ9QR429gtjy9q5w6rcAAK85rE4Lezws7lIqMT-CSDfY8IxmlLv70152RAaH9y_HcXFJmFXejhoTGdzFuDbeeY3ITIA/s220/baby.gif.thumb.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5233946537982084404.post-3869208155761689776</id><published>2011-02-18T07:42:00.000-08:00</published><updated>2011-03-12T22:25:35.978-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Django"/><title type='text'>How caching works in Django</title><content type='html'>&lt;div&gt;Last time, I had a chance joining to a Django project. Django is a web framework written by Python. Though I&#39;ve invested sometime before to study Django and been amazing with it, I haven&#39;t really done anything on Django yet. So that&#39;s a good opportunity for me to increase my Django knowledge. One of my tasks at start was to study caching supports in Django. Compare to what I knew with Ruby on Rails, I found that caching in Django is very strong and especially well-organized. So, it would be useful to put some&amp;nbsp;summarizations down here.&amp;nbsp;&amp;nbsp;&lt;/div&gt;&lt;ol&gt;&lt;li&gt;&lt;b&gt;General rule&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div&gt;&lt;span style=&quot;background-color: white; color: #b45f06; font-family: &#39;Courier New&#39;; font-size: 12pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;&quot;&gt;given a URL, try finding that page in the cache&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white; color: #b45f06; font-family: &#39;Courier New&#39;; font-size: 12pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: #274e13; font-family: &#39;Courier New&#39;; font-size: 12pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;&quot;&gt;if the page is in the cache:&lt;br class=&quot;kix-line-break&quot; /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;return the cached page&lt;/span&gt;&lt;span style=&quot;background-color: white; color: blue; font-family: &#39;Courier New&#39;; font-size: 12pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;&quot;&gt;&lt;br class=&quot;kix-line-break&quot; /&gt;else:&lt;br class=&quot;kix-line-break&quot; /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;generate the page&lt;br class=&quot;kix-line-break&quot; /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;save the generated page in the cache (for next time)&lt;br class=&quot;kix-line-break&quot; /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;return the generated page&lt;br /&gt;
&lt;br /&gt;
&lt;/span&gt;&lt;span style=&quot;background-color: transparent; color: blue; font-family: &#39;Courier New&#39;; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;ol&gt;&lt;/ol&gt;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;More specific&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgDj9z1Q1y7NGvpYPI_5EUcmCJG4-Veqvx_C-qFHA4zerxBcNxy4s4y_O1JLLv7SdC2oL4kc11GW4QQf2ajc4eId-aBC5hyphenhyphenLH-LbbpJgebH_yXxv6Zbs0mbe0RzE6XLeHPLVqJzp6zgZVg/s1600/image00.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;223&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgDj9z1Q1y7NGvpYPI_5EUcmCJG4-Veqvx_C-qFHA4zerxBcNxy4s4y_O1JLLv7SdC2oL4kc11GW4QQf2ajc4eId-aBC5hyphenhyphenLH-LbbpJgebH_yXxv6Zbs0mbe0RzE6XLeHPLVqJzp6zgZVg/s400/image00.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Advantages and disadvantages of caching backends&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;table cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; style=&quot;border-collapse: collapse;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;     &lt;td style=&quot;background-color: #9bbde0; border: 1px solid black;&quot;&gt;&lt;/td&gt;     &lt;td style=&quot;background-color: #9bbde0; border: 1px solid black;&quot;&gt;Advantages&lt;/td&gt;     &lt;td style=&quot;background-color: #9bbde0; border: 1px solid black;&quot;&gt;Disadvantages&lt;/td&gt;   &lt;/tr&gt;
&lt;tr&gt; &lt;td style=&quot;background-color: #9bbde0; border: 1px solid black;&quot;&gt;Memcached&lt;/td&gt; &lt;td style=&quot;border: 1px solid black;&quot;&gt;&lt;br /&gt;
- the fastest, most efficient type of cache available to Django&lt;br /&gt;
- all cached data is stored directly in memory, so there’s no overhead of database or filesystem usage&lt;br /&gt;
- cached data can be shared over multiple machines, so it’s excellent for scaling&lt;br /&gt;
- being used by Facebook, Wikipedia,...&lt;br /&gt;
&lt;br /&gt;
&lt;/td&gt;      &lt;td style=&quot;border: 1px solid black; vertical-align: top;&quot;&gt;&lt;br /&gt;
- cached data is stored in memory, so it will be lost if server crashes (but it’s not critical because cached data is just temporary)&lt;br /&gt;
- need to have memcached daemon along the way&lt;/td&gt;    &lt;/tr&gt;
&lt;tr&gt;      &lt;td style=&quot;background-color: #9bbde0; border: 1px solid black;&quot;&gt;In-database cached&lt;/td&gt;      &lt;td style=&quot;border: 1px solid black;&quot;&gt;&lt;br /&gt;
- cached data is persistent&lt;br /&gt;
- could use multiple databases for caching&lt;br /&gt;
&lt;br /&gt;
&lt;/td&gt; &lt;td style=&quot;border: 1px solid black; vertical-align: top;&quot;&gt;&lt;br /&gt;
- setup &amp;amp; manage multiple caching databases would be tough&lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt; &lt;td style=&quot;background-color: #9bbde0; border: 1px solid black;&quot;&gt;Filesystem cached&lt;/td&gt; &lt;td style=&quot;border: 1px solid black;&quot;&gt;&lt;br /&gt;
- cached data is persistent&lt;br /&gt;
- simple to setup&lt;br /&gt;
&lt;br /&gt;
&lt;/td&gt; &lt;td style=&quot;border: 1px solid black; vertical-align: top;&quot;&gt;&lt;br /&gt;
- may not scale well&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;      &lt;td style=&quot;background-color: #9bbde0; border: 1px solid black;&quot;&gt;Local-memory cached&lt;/td&gt;      &lt;td style=&quot;border: 1px solid black;&quot;&gt;&lt;br /&gt;
- simple&lt;br /&gt;
- not nescessary to have runing an external cache server as memcached&lt;/td&gt;     &lt;td style=&quot;border: 1px solid black; vertical-align: top;&quot;&gt;&lt;br /&gt;
- no cross-process caching means it’s not particularly memory-efficient&lt;br /&gt;
- probably not a good choice for production, just nice for development&lt;br /&gt;
&lt;br /&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Reference&lt;/b&gt;&lt;br /&gt;
&lt;a href=&quot;http://docs.djangoproject.com/en/1.2/topics/cache/&quot;&gt;http://docs.djangoproject.com/en/1.2/topics/cache/&lt;/a&gt; &lt;/li&gt;
&lt;/ol&gt;&lt;div&gt;&lt;span style=&quot;background-color: white; color: #b45f06; font-family: &#39;Courier New&#39;; font-size: 12pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://trbhoang.blogspot.com/feeds/3869208155761689776/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5233946537982084404/3869208155761689776' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5233946537982084404/posts/default/3869208155761689776'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5233946537982084404/posts/default/3869208155761689776'/><link rel='alternate' type='text/html' href='http://trbhoang.blogspot.com/2011/02/how-caching-works-in-django.html' title='How caching works in Django'/><author><name>Hoang Tran</name><uri>http://www.blogger.com/profile/08678314335089274137</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjmUnxOybiZICKW5r-3bTq3UTUbzNN2jjXBk7CXJ9QR429gtjy9q5w6rcAAK85rE4Lezws7lIqMT-CSDfY8IxmlLv70152RAaH9y_HcXFJmFXejhoTGdzFuDbeeY3ITIA/s220/baby.gif.thumb.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgDj9z1Q1y7NGvpYPI_5EUcmCJG4-Veqvx_C-qFHA4zerxBcNxy4s4y_O1JLLv7SdC2oL4kc11GW4QQf2ajc4eId-aBC5hyphenhyphenLH-LbbpJgebH_yXxv6Zbs0mbe0RzE6XLeHPLVqJzp6zgZVg/s72-c/image00.png" height="72" width="72"/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5233946537982084404.post-1319671405130271779</id><published>2010-10-25T03:15:00.000-07:00</published><updated>2011-03-12T22:26:30.276-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Google"/><title type='text'>Quảng cáo trên Google</title><content type='html'>&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi4Uhpe6MbcikA29cSd3IIYw8JMYSwpilEqJHHPgk9xlr8T1K_ApvCx3JKyhv37eNAE3QoJvkl7v4RtbgjPCy5LJk6obas93UM-Z0ifGhrt945JwY0FnPsMYvgZCgCsuWGCgSepgoFNhSQ/s1600/seo.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi4Uhpe6MbcikA29cSd3IIYw8JMYSwpilEqJHHPgk9xlr8T1K_ApvCx3JKyhv37eNAE3QoJvkl7v4RtbgjPCy5LJk6obas93UM-Z0ifGhrt945JwY0FnPsMYvgZCgCsuWGCgSepgoFNhSQ/s1600/seo.jpg&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px; text-align: center;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px;&quot;&gt;Google cung cấp dịch vụ quảng cáo thông qua bộ máy tìm kiếm.&amp;nbsp;&lt;/div&gt;&lt;div style=&quot;border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px;&quot;&gt;Có 2 nguồn thông tin mà bộ máy tìm kiếm của Google sẽ tìm khi người dùng gõ một từ khóa:&amp;nbsp;&lt;/div&gt;&lt;div style=&quot;border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px;&quot;&gt;&amp;nbsp;&amp;nbsp;- thông tin của Google (do Google tự tạo ra)&lt;/div&gt;&lt;div style=&quot;border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px;&quot;&gt;&amp;nbsp;&amp;nbsp;- thông tin có sẵn trên internet (do người khác tạo ra, như các trang web...)&amp;nbsp;&lt;/div&gt;&lt;div style=&quot;border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px;&quot;&gt;Kết quả tìm kiếm cũng dc hiển thị theo 2 dạng dựa vào 2 nguồn thông tin trên.&lt;/div&gt;&lt;div style=&quot;border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px;&quot;&gt;Do đó, chiến lược quảng cáo trên Google cũng gồm 2 hướng:&lt;/div&gt;&lt;div style=&quot;border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px;&quot;&gt;&amp;nbsp;&amp;nbsp;1. Thuê Google trực tiếp đăng quảng cáo của bạn. Google sẽ đưa thông tin của bạn vào nguồn &quot;thông tin của Google&quot;, cái này gọi là dịch vụ Google AdWords, muốn xài cái này cần phải trả tiền, trả càng nhiều tiền thì thông tin của bạn càng dc quảng bá nhiều (tần xuất xuất hiện trên kết quả tìm kiếm trong ngày, vị trí xuất hiện,...). Cái này đòi hỏi người dùng phải có khả năng thanh toán online (Paypal, VISA card, ...) để trả tiền đăng quảng cáo cho Google.&amp;nbsp;&lt;/div&gt;&lt;div style=&quot;border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;Có 2 khoản cần thanh toán cho Google:&amp;nbsp;&lt;/div&gt;&lt;div style=&quot;border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;- Chi phí quảng cáo hằng ngày (trung bình khoảng 10$ mỗi ngày)&lt;/div&gt;&lt;div style=&quot;border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;- Chi phí trả cho mỗi lần có ai đó click chuột vào quảng cáo (0.001$ ???)&lt;/div&gt;&lt;div style=&quot;border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; Tham khảo:&lt;/div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px;&quot;&gt;&lt;a href=&quot;http://www.youtube.com/watch?v=tx2L6EGa9DY&amp;amp;feature=related&quot; style=&quot;color: #0065cc;&quot; target=&quot;_blank&quot;&gt;http://www.youtube.com/&lt;wbr&gt;&lt;/wbr&gt;watch?v=tx2L6EGa9DY&amp;amp;feature=&lt;wbr&gt;&lt;/wbr&gt;related&lt;/a&gt;&lt;/span&gt;&lt;div style=&quot;border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px;&quot;&gt;&amp;nbsp;&amp;nbsp;2. Điều chỉnh thông tin của bạn (trang web) để Google dễ dàng tìm thấy (Google càng dễ tìm thấy thì trang web xuất hiện càng sớm trong kết quả tìm kiếm). Hướng này gọi là SEO (Search Engine Optimization). Hướng này đòi hỏi những điều chỉnh về mặt kĩ thuật đối với trang web của bạn sao cho thân thiện với bộ máy tìm kiếm như tối ưu hóa mã nguồn trang web, tạo nhiều liên kết từ bên ngoài tới trang web của bạn...&lt;/div&gt;&lt;div style=&quot;border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://trbhoang.blogspot.com/feeds/1319671405130271779/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5233946537982084404/1319671405130271779' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5233946537982084404/posts/default/1319671405130271779'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5233946537982084404/posts/default/1319671405130271779'/><link rel='alternate' type='text/html' href='http://trbhoang.blogspot.com/2010/10/quang-cao-tren-google.html' title='Quảng cáo trên Google'/><author><name>Hoang Tran</name><uri>http://www.blogger.com/profile/08678314335089274137</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjmUnxOybiZICKW5r-3bTq3UTUbzNN2jjXBk7CXJ9QR429gtjy9q5w6rcAAK85rE4Lezws7lIqMT-CSDfY8IxmlLv70152RAaH9y_HcXFJmFXejhoTGdzFuDbeeY3ITIA/s220/baby.gif.thumb.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi4Uhpe6MbcikA29cSd3IIYw8JMYSwpilEqJHHPgk9xlr8T1K_ApvCx3JKyhv37eNAE3QoJvkl7v4RtbgjPCy5LJk6obas93UM-Z0ifGhrt945JwY0FnPsMYvgZCgCsuWGCgSepgoFNhSQ/s72-c/seo.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5233946537982084404.post-1953506423016046102</id><published>2010-09-27T02:22:00.000-07:00</published><updated>2010-09-27T02:22:47.359-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Ruby"/><title type='text'>Ruby code snippets</title><content type='html'>&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: blue;&quot;&gt;1. using &#39;any?&#39; to check if something in a array/hash&lt;/span&gt;&lt;br /&gt;
&lt;pre style=&quot;background: #000000; color: #d1d1d1; padding: 10px;&quot;&gt;&lt;span style=&quot;color: #9999a9;&quot;&gt;# a = User.all&lt;/span&gt;
a&lt;span style=&quot;color: #d2cd86;&quot;&gt;.&lt;/span&gt;any? &lt;span style=&quot;color: #b060b0;&quot;&gt;{&lt;/span&gt;|user| user&lt;span style=&quot;color: #d2cd86;&quot;&gt;.&lt;/span&gt;name &lt;span style=&quot;color: #d2cd86;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #d2cd86;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #00c4c4;&quot;&gt;&quot;Hoang&quot;&lt;/span&gt;&lt;span style=&quot;color: #b060b0;&quot;&gt;}&lt;/span&gt;
&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://trbhoang.blogspot.com/feeds/1953506423016046102/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5233946537982084404/1953506423016046102' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5233946537982084404/posts/default/1953506423016046102'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5233946537982084404/posts/default/1953506423016046102'/><link rel='alternate' type='text/html' href='http://trbhoang.blogspot.com/2010/09/ruby-code-snippets.html' title='Ruby code snippets'/><author><name>Hoang Tran</name><uri>http://www.blogger.com/profile/08678314335089274137</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjmUnxOybiZICKW5r-3bTq3UTUbzNN2jjXBk7CXJ9QR429gtjy9q5w6rcAAK85rE4Lezws7lIqMT-CSDfY8IxmlLv70152RAaH9y_HcXFJmFXejhoTGdzFuDbeeY3ITIA/s220/baby.gif.thumb.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5233946537982084404.post-2740203399341397042</id><published>2010-09-23T23:55:00.000-07:00</published><updated>2011-03-12T22:27:06.806-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Ruby"/><category scheme="http://www.blogger.com/atom/ns#" term="Ruby on Rails"/><title type='text'>Some ways to refactoring Rails&#39; code</title><content type='html'>On the following, I list some ways I found to refactoring my Rails&#39; code. This list would be added more as time&#39;s going.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: blue;&quot;&gt;1. Method delegation&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;Assume you have two models:&lt;br /&gt;
&lt;i&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; + User(id, name)&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; + Account(id, number, user_id)&lt;/i&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;It could be described in Rails as:&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;background-color: #222222; border: 1px dotted; color: #eeeeee; padding: 10px;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; class User &amp;lt; ActiveRecord::Base&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; has_many :accounts&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; end&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; class Account &amp;lt; ActiveRecord::Base&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; belongs_to :user&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; end &lt;/div&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;Then if I have an Account instance named &lt;i&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: purple;&quot;&gt;account&lt;/span&gt;&lt;/i&gt;, I could get it&#39;s user&#39;s name by: &lt;i&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: white;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: purple;&quot;&gt;account.user.name&lt;/span&gt;&lt;/span&gt;&lt;/i&gt; or I can define an instance method in Account as follow:&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;background-color: #222222; border: 1px dotted; color: #eeeeee; padding: 10px;&quot;&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; class Account &amp;lt; ActiveRecord::Base&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; belongs_to :user&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; def user_name&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; user.name&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; end&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; end &amp;nbsp;&lt;/div&gt;&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;Then you can get account&#39;s user name by: &lt;i&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: purple;&quot;&gt;account.user_name&lt;/span&gt;&lt;/i&gt;. We can make the above code shorter by using delegation:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;div style=&quot;background-color: #222222; border: 1px dotted; color: #eeeeee; padding: 10px;&quot;&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; class Account &amp;lt; ActiveRecord::Base&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; belongs_to :user&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; delegate :name, :to =&amp;gt; :user, :prefix =&amp;gt; true &amp;nbsp; ## this will generate user_name methods&amp;nbsp;&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; end &amp;nbsp;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;
&lt;b&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: blue;&quot;&gt;2. Use define_method to dynamically generate similar methods&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;Given a model User(id, name, role) where role could be &quot;admin&quot;, &quot;moderator&quot;, &quot;senior&quot;, &quot;junior&quot;,... You can write instance methods to see whether a user is&amp;nbsp;&quot;admin&quot;, &quot;moderator&quot;, ... as follow:&lt;br /&gt;
&lt;br /&gt;
&lt;div id=&quot;way-2-left&quot; style=&quot;background-color: #222222; border: 1px dotted; color: #eeeeee; float: left; padding: 10px; width: 35%;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: white;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: lime;&quot;&gt;Before&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
class User &amp;lt; ActiveRecord::Base&lt;br /&gt;
&amp;nbsp;&amp;nbsp;ROLES = {&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;:admin =&amp;gt; &quot;admin&quot;, &amp;nbsp; &lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;:moderator =&amp;gt; &quot;moderator&quot;,&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;:senior =&amp;gt; &quot;senior&quot;,&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;:junior =&amp;gt; &quot;junior&quot;}&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;def admin?&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;role == ROLES[:admin]&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;end&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;def moderator?&lt;br /&gt;
&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;role == ROLES[:moderator]&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;end&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;def senior?&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;role == ROLES[:senior]&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;end&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;def junior?&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;role == ROLES[:junior]&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;end&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/div&gt;end&lt;/div&gt;&lt;/div&gt;&lt;div id=&quot;way-2-right&quot; style=&quot;background-color: #222222; border: 1px dotted; color: #eeeeee; float: left; margin-left: 30px; padding: 10px; width: 50%;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: lime;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: white;&quot;&gt;After&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
class User &amp;lt; ActiveRecord::Base&lt;br /&gt;
&amp;nbsp;&amp;nbsp;ROLES = {&lt;br /&gt;
&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;:admin =&amp;gt; &quot;admin&quot;, &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;:moderator =&amp;gt; &quot;moderator&quot;,&amp;nbsp;&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;:senior =&amp;gt; &quot;senior&quot;,&amp;nbsp;&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;:junior =&amp;gt; &quot;junior&quot;}&amp;nbsp;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;ROLES.each_pair do |key, val|&amp;nbsp;&lt;/div&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;define_method(key.to_s + &quot;?&quot;) { role == val}&lt;/div&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;end&lt;/div&gt;end&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://trbhoang.blogspot.com/feeds/2740203399341397042/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5233946537982084404/2740203399341397042' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5233946537982084404/posts/default/2740203399341397042'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5233946537982084404/posts/default/2740203399341397042'/><link rel='alternate' type='text/html' href='http://trbhoang.blogspot.com/2010/09/some-ways-to-refactoring-rails-code.html' title='Some ways to refactoring Rails&#39; code'/><author><name>Hoang Tran</name><uri>http://www.blogger.com/profile/08678314335089274137</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjmUnxOybiZICKW5r-3bTq3UTUbzNN2jjXBk7CXJ9QR429gtjy9q5w6rcAAK85rE4Lezws7lIqMT-CSDfY8IxmlLv70152RAaH9y_HcXFJmFXejhoTGdzFuDbeeY3ITIA/s220/baby.gif.thumb.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5233946537982084404.post-5681517356681574132</id><published>2010-05-28T03:01:00.000-07:00</published><updated>2010-05-31T00:52:41.401-07:00</updated><title type='text'>Ruby&#39;s origins - a find</title><content type='html'>&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgXZjrSWlMMT4kRi8FIdouVmURwIvUkypiJ1Mkq5QtMcTYdVQUyat8dP9SD6AH07rieHj4I1Q4pOJIGSZfWOD7K2UsEaF6HBeyjr-Nhm6m2G09YO76BquaVBs87xy2YcgymhWZSrRqnbKw/s1600/ruby.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;200&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgXZjrSWlMMT4kRi8FIdouVmURwIvUkypiJ1Mkq5QtMcTYdVQUyat8dP9SD6AH07rieHj4I1Q4pOJIGSZfWOD7K2UsEaF6HBeyjr-Nhm6m2G09YO76BquaVBs87xy2YcgymhWZSrRqnbKw/s200/ruby.jpg&quot; width=&quot;200&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
Ruby is a pure Object-Oriented programming language. Everything in Ruby is objects, even classes.&amp;nbsp;Amazing? Let&#39;s see why:&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;background-color: #222222; border: 1px dotted; color: #eeeeee; padding: 10px;&quot;&gt;irb&amp;gt; &#39;hello&#39;.class &lt;br /&gt;
=&amp;gt; String&lt;br /&gt;
irb&amp;gt; String.class &lt;br /&gt;
=&amp;gt; Class&lt;br /&gt;
irb&amp;gt; Array.class&lt;br /&gt;
=&amp;gt; Class&lt;br /&gt;
irb&amp;gt; Class.class &lt;br /&gt;
=&amp;gt; Class&lt;/div&gt;&lt;br /&gt;
See even further:&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;background-color: #222222; border: 1px dotted; color: #eeeeee; padding: 10px;&quot;&gt;irb&amp;gt; Class.superclass &lt;br /&gt;
=&amp;gt; Module&lt;br /&gt;
irb&amp;gt; Module.superclass &lt;br /&gt;
=&amp;gt; Object&lt;br /&gt;
irb&amp;gt; Object.superclass &lt;br /&gt;
=&amp;gt; nil&lt;/div&gt;&lt;br /&gt;
&lt;div style=&quot;background-color: #222222; border: 1px dotted; color: #eeeeee; padding: 10px;&quot;&gt;irb&amp;gt; Module.class &lt;br /&gt;
=&amp;gt; Class&lt;br /&gt;
irb&amp;gt; Object.class &lt;br /&gt;
=&amp;gt; Class&lt;/div&gt;&lt;br /&gt;
So all classes are objects of class &quot;Class&quot;. String, Array,.. are instances of class &quot;Class&quot;.&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: red;&quot;&gt;Module &lt;/span&gt;and &lt;span class=&quot;Apple-style-span&quot; style=&quot;color: red;&quot;&gt;Object &lt;/span&gt;are super classes of &quot;Class&quot; but also instances of &quot;Class&quot;!!!</content><link rel='replies' type='application/atom+xml' href='http://trbhoang.blogspot.com/feeds/5681517356681574132/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5233946537982084404/5681517356681574132' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5233946537982084404/posts/default/5681517356681574132'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5233946537982084404/posts/default/5681517356681574132'/><link rel='alternate' type='text/html' href='http://trbhoang.blogspot.com/2010/05/rubys-origins-find.html' title='Ruby&#39;s origins - a find'/><author><name>Hoang Tran</name><uri>http://www.blogger.com/profile/08678314335089274137</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjmUnxOybiZICKW5r-3bTq3UTUbzNN2jjXBk7CXJ9QR429gtjy9q5w6rcAAK85rE4Lezws7lIqMT-CSDfY8IxmlLv70152RAaH9y_HcXFJmFXejhoTGdzFuDbeeY3ITIA/s220/baby.gif.thumb.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgXZjrSWlMMT4kRi8FIdouVmURwIvUkypiJ1Mkq5QtMcTYdVQUyat8dP9SD6AH07rieHj4I1Q4pOJIGSZfWOD7K2UsEaF6HBeyjr-Nhm6m2G09YO76BquaVBs87xy2YcgymhWZSrRqnbKw/s72-c/ruby.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5233946537982084404.post-7526373408171005196</id><published>2010-05-25T04:36:00.000-07:00</published><updated>2010-05-25T20:17:31.977-07:00</updated><title type='text'>Install adva-cms on Windows</title><content type='html'>&lt;a href=&quot;http://adva-cms.org/&quot;&gt;Adva-cms&lt;/a&gt;&amp;nbsp;is an open source CMS (Content Management System) platform based on Ruby on Rails. Installing adva on Windows could be a bit tough. Follow is the steps I&#39;ve tried to get passed:&lt;br /&gt;
&lt;br /&gt;
1. Make sure you already installed &lt;a href=&quot;http://www.interaktonline.com/Documentation/KTML/031350_installimgk.htm&quot;&gt;ImageMagick&lt;/a&gt; and some gems adva requires&lt;br /&gt;
&lt;br /&gt;
2. Just follow &lt;a href=&quot;http://github.com/svenfuchs/adva_cms&quot;&gt;adva&#39;s installation guide&lt;/a&gt;:&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;background-color: #222222; border: 1px dotted; color: #eeeeee; padding: 10px;&quot;&gt;# Create your app&lt;br /&gt;
rails my-app&lt;br /&gt;
cd my-app&lt;br /&gt;
rm public/index.html&lt;br /&gt;
&lt;br /&gt;
# Prepare the config/environment.rb and remove the public/index.html&lt;br /&gt;
# in config/environment.rb make sure you have:&lt;br /&gt;
require File.join(File.dirname(__FILE__), &#39;boot&#39;)&lt;br /&gt;
require File.join(File.dirname(__FILE__), &#39;../vendor/adva/engines/adva_cms/boot&#39;) # this line&lt;br /&gt;
&lt;br /&gt;
# You *must* use Rails&#39; old routing recognition/generation mode in order for adva-cms to work correctly:&lt;br /&gt;
# in config/initializers/new_rails_defaults.rb set:&lt;br /&gt;
ActionController::Routing.generate_best_match = true&lt;br /&gt;
&lt;br /&gt;
# Clone the adva-cms ( this might take a bit, grab a coffee meanwhile :) )&lt;br /&gt;
git clone git://github.com/svenfuchs/adva_cms.git vendor/adva    # or use: git submodule add ...&lt;br /&gt;
&lt;br /&gt;
# Install the core engines and copy the assets&lt;br /&gt;
rake adva:install:core -R vendor/adva/engines/adva_cms/lib/tasks # install adva-cms to vendor/plugins/&lt;br /&gt;
rake adva:assets:install                                         # symlinks plugin assets to public/&lt;/div&gt;&lt;br /&gt;
...and get this error&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;background-color: #222222; border: 1px dotted; color: #eeeeee; padding: 10px;&quot;&gt;$ rake adva:install:core -R vendor/adva/engines/adva_cms/lib/tasks&lt;br /&gt;
(in d:/Document/Projects/AdvaCMS/adva3)&lt;br /&gt;
installing engines: adva_activity, adva_blog, adva_cms, adva_comments, adva_rbac, adva_user&lt;br /&gt;
rake aborted!&lt;br /&gt;
unknown file type: ../adva/engines/adva_activity&lt;br /&gt;
&lt;br /&gt;
(See full trace by running task with --trace)&lt;/div&gt;&lt;br /&gt;
Let&#39;s trace to see why it failed:&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;background-color: #222222; border: 1px dotted; color: #eeeeee; padding: 10px;&quot;&gt;$ rake adva:install:core -R vendor/adva/engines/adva_cms/lib/tasks --trace&lt;br /&gt;
(in d:/Document/Projects/AdvaCMS/adva3)&lt;br /&gt;
** Invoke adva:install:core (first_time)&lt;br /&gt;
** Execute adva:install:core&lt;br /&gt;
** Invoke adva:install (first_time)&lt;br /&gt;
** Execute adva:install&lt;br /&gt;
installing engines: adva_activity, adva_blog, adva_cms, adva_comments, adva_rbac, adva_user&lt;br /&gt;
rake aborted!&lt;br /&gt;
unknown file type: ../adva/engines/adva_activity&lt;br /&gt;
c:/Ruby/lib/ruby/1.8/fileutils.rb:1256:in `copy&#39;&lt;br /&gt;
c:/Ruby/lib/ruby/1.8/fileutils.rb:451:in `copy_entry&#39;&lt;br /&gt;
c:/Ruby/lib/ruby/1.8/fileutils.rb:1325:in `traverse&#39;&lt;br /&gt;
c:/Ruby/lib/ruby/1.8/fileutils.rb:448:in `copy_entry&#39;&lt;br /&gt;
c:/Ruby/lib/ruby/1.8/fileutils.rb:423:in `cp_r&#39;&lt;br /&gt;
c:/Ruby/lib/ruby/1.8/fileutils.rb:1396:in `fu_each_src_dest&#39;&lt;br /&gt;
c:/Ruby/lib/ruby/1.8/fileutils.rb:1405:in `fu_each_src_dest0&#39;&lt;br /&gt;
c:/Ruby/lib/ruby/1.8/fileutils.rb:1403:in `each&#39;&lt;br /&gt;
c:/Ruby/lib/ruby/1.8/fileutils.rb:1403:in `fu_each_src_dest0&#39;&lt;br /&gt;
c:/Ruby/lib/ruby/1.8/fileutils.rb:1394:in `fu_each_src_dest&#39;&lt;br /&gt;
c:/Ruby/lib/ruby/1.8/fileutils.rb:422:in `cp_r&#39;&lt;br /&gt;
d:/Document/Projects/AdvaCMS/adva3/vendor/adva/engines/adva_cms/lib/tasks/adva_cms.rake:139:in install&#39;&lt;br /&gt;
d:/Document/Projects/AdvaCMS/adva3/vendor/adva/engines/adva_cms/lib/tasks/adva_cms.rake:126:in `send&#39;&lt;br /&gt;
d:/Document/Projects/AdvaCMS/adva3/vendor/adva/engines/adva_cms/lib/tasks/adva_cms.rake:126:in `perform&#39;&lt;br /&gt;
d:/Document/Projects/AdvaCMS/adva3/vendor/adva/engines/adva_cms/lib/tasks/adva_cms.rake:119:in `each&#39;&lt;br /&gt;
d:/Document/Projects/AdvaCMS/adva3/vendor/adva/engines/adva_cms/lib/tasks/adva_cms.rake:119:in `perform&#39;&lt;br /&gt;
d:/Document/Projects/AdvaCMS/adva3/vendor/adva/engines/adva_cms/lib/tasks/adva_cms.rake:35&lt;/div&gt;&lt;br /&gt;
...so there&#39;re something wrong in &lt;i&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: red;&quot;&gt;adva_cms.rake&lt;/span&gt;&lt;/i&gt; file. It took me a while to understand how this file does things and found the lines that caused bugs:&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;background-color: #222222; border: 1px dotted; color: #eeeeee; padding: 10px;&quot;&gt;def source(type, subdir = nil)&lt;br /&gt;
&quot;../adva/#{type}&quot; + (subdir ? &quot;/#{subdir}&quot; : &#39;&#39;)&lt;br /&gt;
end&lt;/div&gt;&lt;br /&gt;
...so maybe this relative path causes confusing. Let&#39;s make it full:&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;background-color: #222222; border: 1px dotted; color: #eeeeee; padding: 10px;&quot;&gt;def source(type, subdir = nil)&lt;br /&gt;
&quot;#{Rails.root}/vendor/adva/#{type}&quot; + (subdir ? &quot;/#{subdir}&quot; : &#39;&#39;)&lt;br /&gt;
end&lt;/div&gt;&lt;br /&gt;
&lt;div style=&quot;background-color: #222222; border: 1px dotted; color: #eeeeee; padding: 10px;&quot;&gt;$ rake adva:install:core -R vendor/adva/engines/adva_cms/lib/tasks&lt;br /&gt;
(in d:/Document/Projects/AdvaCMS/adva3)&lt;br /&gt;
installing engines: adva_activity, adva_blog, adva_cms, adva_comments, adva_rbac&lt;br /&gt;
, adva_user&lt;br /&gt;
installing plugins: adva_cells&lt;br /&gt;
c:/Ruby/bin/rake: No such file or directory - which convert&lt;br /&gt;
rake aborted!&lt;br /&gt;
private method `chomp&#39; called for nil:NilClass&lt;/div&gt;&lt;br /&gt;
now the engines installed ok, but there&#39;s still errors in installing plugins. It caused by paperclip initialization code that uses &#39;which&#39; command to find path to &#39;convert&#39; which is a tool provided by paperclip gem but &#39;which&#39; command does not exist on Windows&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;background-color: #222222; border: 1px dotted; color: #eeeeee; padding: 10px;&quot;&gt;d:/Document/Projects/AdvaCMS/adva3/vendor/plugins/adva_cms/config/initializers/p&lt;br /&gt;
aperclip.rb:1&lt;/div&gt;&lt;br /&gt;
&lt;div style=&quot;background-color: #222222; border: 1px dotted; color: #eeeeee; padding: 10px;&quot;&gt;Paperclip.options[:command_path] = %x[which convert].chomp.gsub(/convert/, &#39;&#39;)&lt;/div&gt;&lt;br /&gt;
...so just go to &lt;i&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: red;&quot;&gt;../vendor/adva/engines/adva_cms/config/initializers/paperclip.rb&lt;/span&gt;&lt;/i&gt; and remove &#39;which&#39;&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;background-color: #222222; border: 1px dotted; color: #eeeeee; padding: 10px;&quot;&gt;Paperclip.options[:command_path] = %x[convert].chomp.gsub(/convert/, &#39;&#39;)&lt;/div&gt;&lt;br /&gt;
then adva&#39;s core installation gets passed!&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;background-color: #222222; border: 1px dotted; color: #eeeeee; padding: 10px;&quot;&gt;$ rake adva:install:core -R vendor/adva/engines/adva_cms/lib/tasks&lt;br /&gt;
(in d:/Document/Projects/AdvaCMS/adva3)&lt;br /&gt;
installing engines: adva_activity, adva_blog, adva_cms, adva_comments, adva_rbac&lt;br /&gt;
, adva_user&lt;br /&gt;
installing plugins: adva_cells&lt;br /&gt;
copied 33 migrations to db/migrate&lt;br /&gt;
copied 33 migrations to db/migrate/app&lt;br /&gt;
copied 33 migrations to db/migrate&lt;br /&gt;
==  CreateActivitiesTable: migrating ==========================================&lt;br /&gt;
-- create_table(:activities, {:force=&amp;gt;true})&lt;br /&gt;
-&amp;gt; 0.0050s&lt;br /&gt;
==  CreateActivitiesTable: migrated (0.0060s) =================================&lt;br /&gt;
...&lt;/div&gt;&lt;br /&gt;
3. Next, install adva&#39;s assets and run it up &lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;background-color: #222222; border: 1px dotted; color: #eeeeee; padding: 10px;&quot;&gt;$ rake adva:assets:install -R vendor/adva/engines/adva_cms/lib/tasks&lt;br /&gt;
$ script/server&lt;/div&gt;&lt;br /&gt;
...and this is what I&#39;ve got&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg0EYIi3_Fewb9NVRO7r3L_00z0qEHIBdKMlsiiv7Z-LZO9qZxBS4Z8MnyTjceHrYuIGT9l_AUWNgYOV7I7UvYQZiFM-MlIQKvmUBDDjFYYUk-PwOfLgFLtmBY_ENC6oyqJUFwM0_8l2zQ/s1600/adva_installation.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;400&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg0EYIi3_Fewb9NVRO7r3L_00z0qEHIBdKMlsiiv7Z-LZO9qZxBS4Z8MnyTjceHrYuIGT9l_AUWNgYOV7I7UvYQZiFM-MlIQKvmUBDDjFYYUk-PwOfLgFLtmBY_ENC6oyqJUFwM0_8l2zQ/s400/adva_installation.jpg&quot; width=&quot;352&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://trbhoang.blogspot.com/feeds/7526373408171005196/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5233946537982084404/7526373408171005196' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5233946537982084404/posts/default/7526373408171005196'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5233946537982084404/posts/default/7526373408171005196'/><link rel='alternate' type='text/html' href='http://trbhoang.blogspot.com/2010/05/install-adva-cms-on-windows.html' title='Install adva-cms on Windows'/><author><name>Hoang Tran</name><uri>http://www.blogger.com/profile/08678314335089274137</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjmUnxOybiZICKW5r-3bTq3UTUbzNN2jjXBk7CXJ9QR429gtjy9q5w6rcAAK85rE4Lezws7lIqMT-CSDfY8IxmlLv70152RAaH9y_HcXFJmFXejhoTGdzFuDbeeY3ITIA/s220/baby.gif.thumb.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg0EYIi3_Fewb9NVRO7r3L_00z0qEHIBdKMlsiiv7Z-LZO9qZxBS4Z8MnyTjceHrYuIGT9l_AUWNgYOV7I7UvYQZiFM-MlIQKvmUBDDjFYYUk-PwOfLgFLtmBY_ENC6oyqJUFwM0_8l2zQ/s72-c/adva_installation.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5233946537982084404.post-6046029383776059359</id><published>2010-05-17T03:51:00.000-07:00</published><updated>2011-03-12T22:27:50.526-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="RSpec"/><category scheme="http://www.blogger.com/atom/ns#" term="Ruby"/><category scheme="http://www.blogger.com/atom/ns#" term="Ruby on Rails"/><title type='text'>An issue with Rspec on Windows</title><content type='html'>&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgz_IKXGPalGCaGrgOO3BNPJfz7XQH7XJJbc7svY7ummS8TpfzpT3H3__14B_WP3thlsQkTT2WEMc64RCsSJpwmFw1pT9twzVln-XocU9BfQUssUVJSQF0h5fGr0lIf0Ok2VdtFo6-dZCk/s1600/rspec-user-stories.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;196&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgz_IKXGPalGCaGrgOO3BNPJfz7XQH7XJJbc7svY7ummS8TpfzpT3H3__14B_WP3thlsQkTT2WEMc64RCsSJpwmFw1pT9twzVln-XocU9BfQUssUVJSQF0h5fGr0lIf0Ok2VdtFo6-dZCk/s320/rspec-user-stories.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;br /&gt;
&lt;div style=&quot;float: left;&quot;&gt;Rspec is a very popular test framework used to test Rails application. I have tried to install and use it for my Rails projects on Windows. It raised a bug when I ran tests:&lt;br /&gt;
&lt;blockquote style=&quot;background-color: #222222; color: #eeeeee;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;c:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:440:in load_missing_constant&#39;: uninitialized constant RbReadline::Encoding (NameError)&lt;/span&gt;&lt;/blockquote&gt;&lt;blockquote style=&quot;background-color: #222222; color: #eeeeee;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;from c:/Ruby/lib/ruby/site_ruby/1.8/rbreadline.rb:4404&amp;nbsp;&lt;/span&gt;&lt;/blockquote&gt;I traced back and found these causing lines:&lt;br /&gt;
&lt;blockquote style=&quot;background-color: #222222; color: #eeeeee;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;span class=&quot;Apple-style-span&quot;&gt; if defined? &#39;&#39;.getbyte&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;@encoding = &quot;X&quot; &amp;nbsp; &amp;nbsp; &amp;nbsp;# ruby 1.9.x or greater&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;@encoding_name = Encoding.default_external.to_s&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;&amp;nbsp;&amp;nbsp; end&lt;/span&gt;&lt;/blockquote&gt;It seems the Rspec uses Ruby Readline library for its command-line interface. It defined &lt;i&gt;getbyte &lt;/i&gt;that uses Encoding module which hasn&#39;t been defined in this Ruby package on Windows. I then commented out the line using Encoding module and the bug get fixed...&lt;br /&gt;
&lt;blockquote style=&quot;background-color: #222222; color: #eeeeee;&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;span class=&quot;Apple-style-span&quot;&gt;if defined? &#39;&#39;.getbyte&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;@encoding = &quot;X&quot; &amp;nbsp; &amp;nbsp; &amp;nbsp;# ruby 1.9.x or greater&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;# @encoding_name = Encoding.default_external.to_s&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot;&gt;&amp;nbsp;&amp;nbsp; end&lt;/span&gt;&lt;/blockquote&gt;It&#39;s not common to pass over the issue by this way but hopefully it still works fine in my case.&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://trbhoang.blogspot.com/feeds/6046029383776059359/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5233946537982084404/6046029383776059359' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5233946537982084404/posts/default/6046029383776059359'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5233946537982084404/posts/default/6046029383776059359'/><link rel='alternate' type='text/html' href='http://trbhoang.blogspot.com/2010/05/issue-with-rspec-on-windows.html' title='An issue with Rspec on Windows'/><author><name>Hoang Tran</name><uri>http://www.blogger.com/profile/08678314335089274137</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjmUnxOybiZICKW5r-3bTq3UTUbzNN2jjXBk7CXJ9QR429gtjy9q5w6rcAAK85rE4Lezws7lIqMT-CSDfY8IxmlLv70152RAaH9y_HcXFJmFXejhoTGdzFuDbeeY3ITIA/s220/baby.gif.thumb.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgz_IKXGPalGCaGrgOO3BNPJfz7XQH7XJJbc7svY7ummS8TpfzpT3H3__14B_WP3thlsQkTT2WEMc64RCsSJpwmFw1pT9twzVln-XocU9BfQUssUVJSQF0h5fGr0lIf0Ok2VdtFo6-dZCk/s72-c/rspec-user-stories.png" height="72" width="72"/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5233946537982084404.post-6991722118407654562</id><published>2010-04-26T18:27:00.000-07:00</published><updated>2010-05-26T01:46:17.092-07:00</updated><title type='text'>Hello Ruby &amp; Rails</title><content type='html'>&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgRgWsywIIs5SuwSirbE8iV-89TFSHLX2ZOiNxXvfNABENrSbvfRM7F-gvw69KHemM8oyyw4QViEMGf_owii6IPL5X2cEqsmDTQGDRlKIlfRQqGXCN_uXMe_3QDxAtpbZ6Gb5znWqvIpd8/s1600/ror.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;200&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgRgWsywIIs5SuwSirbE8iV-89TFSHLX2ZOiNxXvfNABENrSbvfRM7F-gvw69KHemM8oyyw4QViEMGf_owii6IPL5X2cEqsmDTQGDRlKIlfRQqGXCN_uXMe_3QDxAtpbZ6Gb5znWqvIpd8/s200/ror.jpg&quot; width=&quot;200&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div float: left;&quot;&gt;&lt;br /&gt;
Ruby is a programming language and Rails (Ruby on Rails) is a web development framework written by Ruby. Those are attracting a lot of fans. Common philosophy that both Ruby and Rails based on is the simplicity, light-weight and beautifulness. You can find how easy it is to programming Ruby like talking. Also, bearing in mind with DRY (Don&#39;t Repeat Yourself) or CoC (Convention over Configuration) principles, Rails has made web developing simple and with least efforts.&lt;br /&gt;
&lt;br /&gt;
Keeping track changes and sharing what I&#39;ve learned from Ruby and Rails are the most important things I target to from this beginning.&lt;br /&gt;
&lt;br /&gt;
So, let&#39;s say &quot;hello Ruby &amp;amp; Rails&quot;!&lt;br /&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://trbhoang.blogspot.com/feeds/6991722118407654562/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5233946537982084404/6991722118407654562' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5233946537982084404/posts/default/6991722118407654562'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5233946537982084404/posts/default/6991722118407654562'/><link rel='alternate' type='text/html' href='http://trbhoang.blogspot.com/2010/04/hello-ruby-rails.html' title='Hello Ruby &amp; Rails'/><author><name>Hoang Tran</name><uri>http://www.blogger.com/profile/08678314335089274137</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjmUnxOybiZICKW5r-3bTq3UTUbzNN2jjXBk7CXJ9QR429gtjy9q5w6rcAAK85rE4Lezws7lIqMT-CSDfY8IxmlLv70152RAaH9y_HcXFJmFXejhoTGdzFuDbeeY3ITIA/s220/baby.gif.thumb.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgRgWsywIIs5SuwSirbE8iV-89TFSHLX2ZOiNxXvfNABENrSbvfRM7F-gvw69KHemM8oyyw4QViEMGf_owii6IPL5X2cEqsmDTQGDRlKIlfRQqGXCN_uXMe_3QDxAtpbZ6Gb5znWqvIpd8/s72-c/ror.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5233946537982084404.post-5420257403284822910</id><published>2009-02-08T22:17:00.000-08:00</published><updated>2009-12-14T01:42:54.380-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Ruby on Rails"/><title type='text'>A quick setup for development environment of Rails on Windows</title><content type='html'>1. Install Ruby&lt;br /&gt;    Use One Click Installer for Ruby&lt;br /&gt;&lt;br /&gt;2. Update Gem&lt;br /&gt;    &gt; gem update --system&lt;br /&gt;&lt;br /&gt;3. Install Rails&lt;br /&gt;    &gt; gem install rails&lt;br /&gt;&lt;br /&gt;4. Install Sqlite3 &amp;amp; Sqlite3 driver for Rails&lt;br /&gt;&lt;span&gt;    &lt;/span&gt;- download sqlite and extract to get 3 files: sqlite3.exe, sqlite3.dll, sqlite3.def&lt;br /&gt;&lt;span&gt;    &lt;/span&gt;- copy 3 above files to ruby/bin&lt;br /&gt;&lt;span&gt;    &lt;/span&gt;- $ gem install sqlite3-ruby&lt;br /&gt;&lt;span&gt;    &lt;/span&gt;&lt;span&gt;    &lt;/span&gt;&lt;span&gt;    &lt;/span&gt;-&gt; If errors, try another version of sqlite driver, ex:&lt;br /&gt;&lt;span&gt;    &lt;/span&gt;&lt;span&gt;    &lt;/span&gt;&lt;span&gt;    &lt;/span&gt;$ gem install --version 1.2.3 sqlite3-ruby</content><link rel='replies' type='application/atom+xml' href='http://trbhoang.blogspot.com/feeds/5420257403284822910/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5233946537982084404/5420257403284822910' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5233946537982084404/posts/default/5420257403284822910'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5233946537982084404/posts/default/5420257403284822910'/><link rel='alternate' type='text/html' href='http://trbhoang.blogspot.com/2009/02/quick-setup-for-development-environment.html' title='A quick setup for development environment of Rails on Windows'/><author><name>Hoang Tran</name><uri>http://www.blogger.com/profile/08678314335089274137</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjmUnxOybiZICKW5r-3bTq3UTUbzNN2jjXBk7CXJ9QR429gtjy9q5w6rcAAK85rE4Lezws7lIqMT-CSDfY8IxmlLv70152RAaH9y_HcXFJmFXejhoTGdzFuDbeeY3ITIA/s220/baby.gif.thumb.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5233946537982084404.post-7619495396926694360</id><published>2008-07-08T01:29:00.000-07:00</published><updated>2008-07-08T01:30:17.885-07:00</updated><title type='text'>hello world</title><content type='html'>Hi everybody!!!</content><link rel='replies' type='application/atom+xml' href='http://trbhoang.blogspot.com/feeds/7619495396926694360/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5233946537982084404/7619495396926694360' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5233946537982084404/posts/default/7619495396926694360'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5233946537982084404/posts/default/7619495396926694360'/><link rel='alternate' type='text/html' href='http://trbhoang.blogspot.com/2008/07/hello-world.html' title='hello world'/><author><name>Hoang Tran</name><uri>http://www.blogger.com/profile/08678314335089274137</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjmUnxOybiZICKW5r-3bTq3UTUbzNN2jjXBk7CXJ9QR429gtjy9q5w6rcAAK85rE4Lezws7lIqMT-CSDfY8IxmlLv70152RAaH9y_HcXFJmFXejhoTGdzFuDbeeY3ITIA/s220/baby.gif.thumb.jpg'/></author><thr:total>0</thr:total></entry></feed>