<?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: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-2933742489031701882</id><updated>2012-02-16T20:33:06.156-08:00</updated><title type='text'>Fattah's blog</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://fattahulalam.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2933742489031701882/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://fattahulalam.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Fattah</name><uri>http://www.blogger.com/profile/08444860579014449384</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://1.bp.blogspot.com/_0XSjqHl32MA/Se_qAWSWLVI/AAAAAAAAAOI/zZN82R_mG1E/S220/Faruk+vai.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>5</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-2933742489031701882.post-43238034015154317</id><published>2009-12-30T02:42:00.000-08:00</published><updated>2009-12-30T02:51:08.614-08:00</updated><title type='text'>Don't use return statement in call block</title><content type='html'>return statement in call block returns from surrounding method instead of returning from call block.&lt;br /&gt;&lt;br /&gt;Following code snippet describes it with example.&lt;br /&gt;&lt;br /&gt;def function1(&amp;amp;block)&lt;br /&gt;&lt;br /&gt;callback_result = yield('value1', 'value2')&lt;br /&gt;&lt;br /&gt;puts "call block returned: #{callback_result}"&lt;br /&gt;&lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;def function2()&lt;br /&gt;&lt;br /&gt;function1() do |param1, param2|&lt;br /&gt;puts "block implementation of function2 with param1 =&gt; #{param1} &amp;amp; param2 =&gt; #{param2}"&lt;br /&gt;return "#{param1} changed. #{param2} changed."&lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;puts "next line after calling function1"&lt;br /&gt;&lt;br /&gt;return "function2 returned"&lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;def function3()&lt;br /&gt;&lt;br /&gt;function1() do |param1, param2|&lt;br /&gt;puts "block implementation of function3 with param1 =&gt; #{param1} &amp;amp; param2 =&gt; #{param2}"&lt;br /&gt;"#{param1} changed. #{param2} changed."&lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;puts "next line after calling function1"&lt;br /&gt;&lt;br /&gt;return "function3 returned"&lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;output of function2() is&lt;br /&gt;&lt;br /&gt;block implementation of function2 with param1 =&gt; value1 &amp;amp; param2 =&gt; value2&lt;br /&gt;"value1 changed. value2 changed."&lt;br /&gt;&lt;br /&gt;Output of function3() is&lt;br /&gt;&lt;br /&gt;block implementation of function3 with param1 =&gt; value1 &amp;amp; param2 =&gt; value2&lt;br /&gt;call block returned: value1 changed. value2 changed.&lt;br /&gt;next line after calling function1&lt;br /&gt;"function3 returned"&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2933742489031701882-43238034015154317?l=fattahulalam.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://fattahulalam.blogspot.com/feeds/43238034015154317/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2933742489031701882&amp;postID=43238034015154317' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2933742489031701882/posts/default/43238034015154317'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2933742489031701882/posts/default/43238034015154317'/><link rel='alternate' type='text/html' href='http://fattahulalam.blogspot.com/2009/12/dont-use-return-statement-in-call-block.html' title='Don&apos;t use return statement in call block'/><author><name>Fattah</name><uri>http://www.blogger.com/profile/08444860579014449384</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://1.bp.blogspot.com/_0XSjqHl32MA/Se_qAWSWLVI/AAAAAAAAAOI/zZN82R_mG1E/S220/Faruk+vai.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2933742489031701882.post-4393258106615673199</id><published>2009-04-28T02:18:00.000-07:00</published><updated>2009-04-28T02:51:01.003-07:00</updated><title type='text'>Layout in actionmailer</title><content type='html'>By default mailer methods expects layout in view/layouts directory by the underscored version of the mailer class name.&lt;br /&gt;&lt;br /&gt;If mailer class is like&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 51);font-family:arial;" &gt;class UserMailer &lt; &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="color: rgb(51, 51, 51);font-family:arial;" &gt;ActionMailer::Base&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="color: rgb(51, 51, 51);font-family:arial;" &gt;&lt;br /&gt; def welcome_mail()&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 51);font-family:arial;" &gt;            ....&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 51);font-family:arial;" &gt;    end&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 51);font-family:arial;" &gt;   &lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 51);font-family:arial;" &gt;    ....&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 51);font-family:arial;" &gt;end&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;then the mailer layout name will be &lt;span style="color: rgb(51, 51, 51);font-size:85%;" &gt;&lt;span style="font-family:arial;"&gt;user_mailer.html.erb in view/layouts directory&lt;/span&gt;&lt;/span&gt;. The layout name needs to end in “_mailer” to be automatically recognized by mailer as a layout.&lt;br /&gt;&lt;br /&gt;Content of &lt;span style="color: rgb(51, 51, 51);font-size:85%;" &gt;&lt;span style="font-family:arial;"&gt;user_mailer.html.erb&lt;/span&gt;&lt;/span&gt; should contain &lt;span style="color: rgb(153, 153, 153);font-size:85%;" &gt;yield&lt;/span&gt; like the application layout. In this example the &lt;span style="font-size:85%;"&gt;&lt;span style="color: rgb(51, 51, 51);font-family:arial;" &gt;welcome_mail.html.erb&lt;/span&gt;&lt;/span&gt; will be rendered at yield position.&lt;br /&gt;&lt;br /&gt;A different layout can also be set using &lt;span style="color: rgb(51, 51, 51);font-size:85%;" &gt;&lt;br /&gt;&lt;br /&gt;layout 'awesome'  # it will use awesome.html.erb as the layout&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="color: rgb(51, 51, 51);font-family:arial;" &gt;&lt;br /&gt;class UserMailer &lt; ActionMailer::Base    &lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(51, 51, 51);font-size:85%;" &gt;layout 'awesome' &lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 51);font-family:arial;" &gt;   ....&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 51);font-family:arial;" &gt;end&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Resource: &lt;a href="http://guides.rubyonrails.org/action_mailer_basics.html"&gt;http://guides.rubyonrails.org/action_mailer_basics.html&lt;/a&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2933742489031701882-4393258106615673199?l=fattahulalam.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://fattahulalam.blogspot.com/feeds/4393258106615673199/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2933742489031701882&amp;postID=4393258106615673199' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2933742489031701882/posts/default/4393258106615673199'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2933742489031701882/posts/default/4393258106615673199'/><link rel='alternate' type='text/html' href='http://fattahulalam.blogspot.com/2009/04/layout-in-actionmailer.html' title='Layout in actionmailer'/><author><name>Fattah</name><uri>http://www.blogger.com/profile/08444860579014449384</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://1.bp.blogspot.com/_0XSjqHl32MA/Se_qAWSWLVI/AAAAAAAAAOI/zZN82R_mG1E/S220/Faruk+vai.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2933742489031701882.post-4343807803437539073</id><published>2009-04-22T21:10:00.000-07:00</published><updated>2009-04-22T21:12:09.082-07:00</updated><title type='text'>Error in loading mysql library in rails</title><content type='html'>Problem:&lt;br /&gt;&lt;br /&gt;Error in loading mysql library&lt;br /&gt;&lt;br /&gt;The specified module could not be found.   - C:/ruby/lib/ruby/gems/1.8/gems/mysql-2.7.3-x86-mswin32/ext/mysql.so&lt;br /&gt;&lt;br /&gt;Solution:&lt;br /&gt;&lt;br /&gt;For this to work, you must have libmysql.dll in your PATH environmental variable. If you have MySQL installed locally,&lt;br /&gt;just make sure that &lt;mysql_install_dir&gt;\bin is in your path. If you don't have MySQL installed locally, you can&lt;br /&gt;install one or more of the MySQL tools, find the libmysql.dll included in their bin directory, and copy it to&lt;br /&gt;the %SystemRoot%\System32 folder.&lt;br /&gt;&lt;br /&gt;Reference: RubyInstallDirectory/lib/ruby/gems/1.8/gems/mysql-2.7.3-x86-mswin32/README&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2933742489031701882-4343807803437539073?l=fattahulalam.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://fattahulalam.blogspot.com/feeds/4343807803437539073/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2933742489031701882&amp;postID=4343807803437539073' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2933742489031701882/posts/default/4343807803437539073'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2933742489031701882/posts/default/4343807803437539073'/><link rel='alternate' type='text/html' href='http://fattahulalam.blogspot.com/2009/04/error-in-loading-mysql-library-in-rails.html' title='Error in loading mysql library in rails'/><author><name>Fattah</name><uri>http://www.blogger.com/profile/08444860579014449384</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://1.bp.blogspot.com/_0XSjqHl32MA/Se_qAWSWLVI/AAAAAAAAAOI/zZN82R_mG1E/S220/Faruk+vai.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2933742489031701882.post-1155776914621332232</id><published>2009-01-10T05:58:00.001-08:00</published><updated>2009-01-10T05:58:14.304-08:00</updated><title type='text'>Access a method from both view and controller</title><content type='html'>&lt;p&gt;If you need a method that will be accessed from both view and controller write the method in controller and pass the name of the function as an argument of helper_method.&lt;/p&gt;  &lt;p&gt;class ApplicationController &amp;lt; ActionController::Base&lt;/p&gt;  &lt;p&gt;..&lt;/p&gt;  &lt;p&gt;..&lt;/p&gt;  &lt;p&gt;def logged_in_user()   &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; user_id = session[:user_id]    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; user = User.find_by_id(user_id)    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; return user    &lt;br /&gt;&amp;#160; end&lt;/p&gt;  &lt;p&gt;helper_method :logged_in_user&lt;/p&gt;  &lt;p&gt;end&lt;/p&gt;  &lt;p&gt;Here, logged_in_user method is accessible from all of the controllers those extend ApplicationController and helper_method :logged_in_user will expose this method to views. Your common accessible method signature may have arguments. But, only helper_method :logged_in_user is enough to make it accessible from view with the same signature defined.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2933742489031701882-1155776914621332232?l=fattahulalam.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://fattahulalam.blogspot.com/feeds/1155776914621332232/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2933742489031701882&amp;postID=1155776914621332232' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2933742489031701882/posts/default/1155776914621332232'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2933742489031701882/posts/default/1155776914621332232'/><link rel='alternate' type='text/html' href='http://fattahulalam.blogspot.com/2009/01/access-method-from-both-view-and.html' title='Access a method from both view and controller'/><author><name>Fattah</name><uri>http://www.blogger.com/profile/08444860579014449384</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://1.bp.blogspot.com/_0XSjqHl32MA/Se_qAWSWLVI/AAAAAAAAAOI/zZN82R_mG1E/S220/Faruk+vai.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2933742489031701882.post-1981617526894208241</id><published>2008-11-30T02:58:00.000-08:00</published><updated>2008-11-30T03:17:03.167-08:00</updated><title type='text'>linux password</title><content type='html'>&lt;span id="intelliTXT" name="intelliTxt"&gt;&lt;span style="font-family:Courier;"&gt;&lt;strong&gt;   passwd&lt;/strong&gt;               Change your own password.&lt;/span&gt;  &lt;p&gt;&lt;span style="font-family:Courier;"&gt;&lt;strong&gt;   passwd&lt;/strong&gt; &lt;strong&gt;sleepy&lt;/strong&gt;       Change sleepy's password.&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-family:Courier;"&gt;&lt;strong&gt;   passwd -d&lt;/strong&gt; &lt;strong&gt;sleepy&lt;/strong&gt;    Delete sleepy's password.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;reference&lt;/p&gt;&lt;p&gt;&lt;a href="http://lowfatlinux.com/linux-change-password-passwd.html"&gt;http://lowfatlinux.com/linux-change-password-passwd.html&lt;/a&gt;&lt;br /&gt;&lt;span style="font-family:Courier;"&gt;&lt;/span&gt;&lt;/p&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2933742489031701882-1981617526894208241?l=fattahulalam.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://fattahulalam.blogspot.com/feeds/1981617526894208241/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2933742489031701882&amp;postID=1981617526894208241' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2933742489031701882/posts/default/1981617526894208241'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2933742489031701882/posts/default/1981617526894208241'/><link rel='alternate' type='text/html' href='http://fattahulalam.blogspot.com/2008/11/linux-password.html' title='linux password'/><author><name>Fattah</name><uri>http://www.blogger.com/profile/08444860579014449384</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://1.bp.blogspot.com/_0XSjqHl32MA/Se_qAWSWLVI/AAAAAAAAAOI/zZN82R_mG1E/S220/Faruk+vai.jpg'/></author><thr:total>0</thr:total></entry></feed>
