<?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-30102683</id><updated>2011-12-07T15:16:30.719+05:30</updated><category term='ruby'/><category term='attachment'/><category term='paragraphs'/><category term='relationship'/><category term='Unknown gem'/><category term='wvdial'/><category term='connect'/><category term='HABTM'/><category term='rails version'/><category term='force'/><category term='version'/><category term='While executing gem ... (Gem::InstallError)'/><category term='new application'/><category term='application'/><category term='association'/><category term='intrepid'/><category term='style'/><category term='specific version'/><category term='Netconnect'/><category term='Huawei 1260'/><category term='reliance netconnect'/><category term='gem'/><category term='rails'/><category term='internet'/><category term='Reliance'/><category term='app'/><category term='email'/><category term='ubuntu'/><category term='ERROR'/><category term='India'/><category term='markup'/><category term='Many to Many'/><category term='uninstall'/><category term='ActionMailer'/><title type='text'>Himanshu's</title><subtitle type='html'>Learning sharing ROR...</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://himanshuonweb.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/30102683/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://himanshuonweb.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Himanshu</name><uri>http://www.blogger.com/profile/16344716060687825090</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>8</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-30102683.post-9166972969667600334</id><published>2011-02-24T14:52:00.007+05:30</published><updated>2011-02-24T15:20:56.827+05:30</updated><title type='text'>Making ruby faster...</title><content type='html'>&lt;pre&gt;&lt;br /&gt;&lt;h6  style="font-family:courier new;"&gt;&lt;span style="font-size:100%;"&gt;Culprits to slow down the ruby code&lt;/span&gt;&lt;/h6&gt;&lt;br /&gt;&lt;span style="font-style: italic; font-weight: bold;"&gt;- Avoid use of pre increment operator&lt;/span&gt;&lt;br /&gt;e.g. The += operator, it makes a copy of the string, append to the copy and assign that copy to the variable.&lt;br /&gt;IT SHOULD ONLY BE USED IF A COPY MUST BE MADE.&lt;br /&gt;- Proof:&lt;br /&gt;a. open scite editor.&lt;br /&gt;b. create a new *.rb file.&lt;br /&gt;c. paste the following code:&lt;code&gt;&lt;br /&gt; require 'benchmark'&lt;br /&gt;&lt;br /&gt; Benchmark.bm do|b|&lt;br /&gt;   b.report("+= ") do&lt;br /&gt;     a = ""&lt;br /&gt;     1_000_000.times { a += "." }&lt;br /&gt;   end&lt;br /&gt;&lt;br /&gt;   b.report("&lt;&lt; ") do       a = ""       1_000_000.times { a &lt;&lt; "." }     end   end&lt;/code&gt;&lt;br /&gt;d. Press F5, and see the result. The result would look like this:&lt;br /&gt;&lt;code&gt;&lt;br /&gt;    user     system      total        real&lt;br /&gt;+= 322.063000 208.094000 530.157000 (536.359375)&lt;br /&gt;&lt;&lt;&gt;&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/30102683-9166972969667600334?l=himanshuonweb.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://himanshuonweb.blogspot.com/feeds/9166972969667600334/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=30102683&amp;postID=9166972969667600334' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/30102683/posts/default/9166972969667600334'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/30102683/posts/default/9166972969667600334'/><link rel='alternate' type='text/html' href='http://himanshuonweb.blogspot.com/2011/02/making-ruby-faster.html' title='Making ruby faster...'/><author><name>Himanshu</name><uri>http://www.blogger.com/profile/16344716060687825090</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-30102683.post-8408643081230050838</id><published>2009-10-29T17:44:00.003+05:30</published><updated>2009-10-29T17:51:08.217+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='version'/><category scheme='http://www.blogger.com/atom/ns#' term='application'/><category scheme='http://www.blogger.com/atom/ns#' term='specific version'/><category scheme='http://www.blogger.com/atom/ns#' term='new application'/><category scheme='http://www.blogger.com/atom/ns#' term='app'/><category scheme='http://www.blogger.com/atom/ns#' term='rails version'/><category scheme='http://www.blogger.com/atom/ns#' term='force'/><title type='text'>Force Rails Version When Creating a new RAILS application</title><content type='html'>I have multiple version of RAILS installed in my machine. I want to create an application that should use the specific rails version, for this we can force app to use the specific rails version while creating the application, as:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;$rails _1.2.3_ myapp&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;This will create myapp application which will use rails 1.2.3&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/30102683-8408643081230050838?l=himanshuonweb.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://himanshuonweb.blogspot.com/feeds/8408643081230050838/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=30102683&amp;postID=8408643081230050838' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/30102683/posts/default/8408643081230050838'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/30102683/posts/default/8408643081230050838'/><link rel='alternate' type='text/html' href='http://himanshuonweb.blogspot.com/2009/10/force-rails-version-when-creating-new.html' title='Force Rails Version When Creating a new RAILS application'/><author><name>Himanshu</name><uri>http://www.blogger.com/profile/16344716060687825090</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-30102683.post-8293777934487449739</id><published>2009-08-30T23:16:00.003+05:30</published><updated>2009-08-30T23:49:38.222+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='uninstall'/><category scheme='http://www.blogger.com/atom/ns#' term='Unknown gem'/><category scheme='http://www.blogger.com/atom/ns#' term='While executing gem ... (Gem::InstallError)'/><category scheme='http://www.blogger.com/atom/ns#' term='ERROR'/><category scheme='http://www.blogger.com/atom/ns#' term='gem'/><title type='text'>Deleting persistant gems</title><content type='html'>I had two versions of rubyforge 1.0.3 and 1.0.4.&lt;br /&gt;whilst running ruby console, its giving error:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;can't activate rubyforge (= 1.0.3, runtime), already activated rubyforge-1.0.4&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;So thought of removing by simply using:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;sudo gem uninstall rubyforge --debug&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;But this surprised me by saying:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;ERROR:  While executing gem ... (Gem::InstallError)&lt;br /&gt;    Unknown gem rubyforge &gt;= 0&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;After investing many hours I found a solution:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;gem list -d &lt;gem_name&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;this will give you the details as:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;rubyforge (1.0.3)&lt;br /&gt;    Authors: Ryan Davis, Eric Hodel, Ara T Howard&lt;br /&gt;    Rubyforge: http://rubyforge.org/projects/codeforpeople&lt;br /&gt;    Homepage: http://codeforpeople.rubyforge.org/rubyforge/&lt;br /&gt;    Installed at: /home/deepti/.gem/ruby/1.8&lt;br /&gt;&lt;br /&gt;    A script which automates a limited set of rubyforge operations&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Just mention the given gem path:&lt;br /&gt;&lt;pre&gt;sudo gem uninstall --install-dir /home/&lt;me&gt;/.gem/ruby/1.8 rubyforge -v 1.0.4&lt;/pre&gt;&lt;br /&gt;Pheww!!! Finally its out from my gem list...&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/30102683-8293777934487449739?l=himanshuonweb.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://himanshuonweb.blogspot.com/feeds/8293777934487449739/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=30102683&amp;postID=8293777934487449739' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/30102683/posts/default/8293777934487449739'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/30102683/posts/default/8293777934487449739'/><link rel='alternate' type='text/html' href='http://himanshuonweb.blogspot.com/2009/08/deleting-persistant-gems.html' title='Deleting persistant gems'/><author><name>Himanshu</name><uri>http://www.blogger.com/profile/16344716060687825090</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-30102683.post-8754083793630421453</id><published>2009-08-19T22:08:00.005+05:30</published><updated>2009-08-19T22:53:19.510+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='India'/><category scheme='http://www.blogger.com/atom/ns#' term='reliance netconnect'/><category scheme='http://www.blogger.com/atom/ns#' term='Netconnect'/><category scheme='http://www.blogger.com/atom/ns#' term='internet'/><category scheme='http://www.blogger.com/atom/ns#' term='Huawei 1260'/><category scheme='http://www.blogger.com/atom/ns#' term='Reliance'/><category scheme='http://www.blogger.com/atom/ns#' term='intrepid'/><category scheme='http://www.blogger.com/atom/ns#' term='connect'/><category scheme='http://www.blogger.com/atom/ns#' term='wvdial'/><category scheme='http://www.blogger.com/atom/ns#' term='ubuntu'/><title type='text'>Using Reliance Netconnect Huawei 1260 on Ubuntu Intrepid 8.10</title><content type='html'>After struggling a lot, I got my Huawie 1260 working on Ubuntu Intrepid 8.10. May be useful for you.&lt;br /&gt;&lt;br /&gt;1- Start Ubuntu ensuring USB modem is not connected and configure the file /etc/wvdial.conf&lt;br /&gt;&lt;pre&gt;sudo gedit /etc/wvdial.conf&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;paste the following lines:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;[Dialer Defaults]&lt;br /&gt;&lt;br /&gt;Init1 = ATZ&lt;br /&gt;&lt;br /&gt;Init2 = ATQ0 V1 E1 S0=0 &amp;C1 &amp;D2 +FCLASS=0&lt;br /&gt;&lt;br /&gt;Stupid Mode = 1&lt;br /&gt;&lt;br /&gt;Modem Type = USB Modem&lt;br /&gt;&lt;br /&gt;ISDN = 0&lt;br /&gt;&lt;br /&gt;Phone = #777&lt;br /&gt;&lt;br /&gt;New PPPD = yes&lt;br /&gt;&lt;br /&gt;Modem = /dev/ttyUSB0&lt;br /&gt;&lt;br /&gt;Username = &amp;lt;your ten digit reliance netconnect number&amp;gt;&lt;br /&gt;&lt;br /&gt;Password = &amp;lt;your ten digit reliance netconnect number&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;2- Plug-in USB modem, your /var/log/messages will say something like:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;Aug 16 19:35:57 abc-laptop kernel: [  111.532151] usb 4-1: new full speed USB device using uhci_hcd and address 2&lt;br /&gt;Aug 16 19:35:57 abc-laptop kernel: [  111.744188] usb 4-1: configuration #1 chosen from 1 choice&lt;br /&gt;Aug 16 19:35:57 abc-laptop kernel: [  111.747614] usbserial_generic 4-1:1.0: generic converter detected&lt;br /&gt;Aug 16 19:35:57 abc-laptop kernel: [  111.748339] usb 4-1: generic converter now attached to ttyUSB0&lt;br /&gt;Aug 16 19:35:57 abc-laptop kernel: [  111.909454] usbcore: registered new interface driver libusual&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;3- Run &lt;br /&gt;&lt;pre&gt;lsusb&lt;/pre&gt; whose output will be like:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;us 007 Device 002: ID 04f2:b008 Chicony Electronics Co., Ltd &lt;br /&gt;Bus 007 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub&lt;br /&gt;Bus 004 Device 002: ID 12d1:142b Huawei Technologies Co., Ltd. &lt;br /&gt;Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub&lt;br /&gt;Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub&lt;br /&gt;Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub&lt;br /&gt;Bus 001 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub&lt;br /&gt;Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub&lt;br /&gt;Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;4- Add a module for the above listed Huawei device, as: &lt;br /&gt;&lt;br /&gt;&lt;pre&gt;sudo modprobe usbserial vendor=0x12d1 product=0x142b&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;make sure the vendor and product ID are the same as listed in the above lsusb output&lt;br /&gt;&lt;br /&gt;5- Check the files for USB device:&lt;br /&gt;&lt;pre&gt;ls -la /dev/ttyU*&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Output will be similar to:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;crw-rw---- 1 root uucp 188, 0 2009-08-16 19:36 /dev/ttyUSB0&lt;br /&gt;crw-r--r-- 1 root root 188, 1 2009-08-16 19:34 /dev/ttyUSB1&lt;/pre&gt; &lt;br /&gt;&lt;br /&gt;if no USB0 or USB1 files listed, then try creating it as:&lt;br /&gt;&lt;pre&gt;sudo mknod /dev/ttyUSB0 c 188 0&lt;br /&gt;sudo mknod /dev/ttyUSB1 c 188 1&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;6- now hopefully your are done with the configuration part. just try connecting internet:&lt;br /&gt;&lt;pre&gt;sudo wvdial&lt;/pre&gt;&lt;br /&gt;console will look like:&lt;br /&gt;&lt;pre&gt;--&gt; WvDial: Internet dialer version 1.60&lt;br /&gt;--&gt; Cannot get information for serial port.&lt;br /&gt;--&gt; Initializing modem.&lt;br /&gt;--&gt; Sending: ATZ&lt;br /&gt;ATZ&lt;br /&gt;OK&lt;br /&gt;--&gt; Sending: ATQ0 V1 E1 S0=0 &amp;C1 &amp;D2 +FCLASS=0&lt;br /&gt;ATQ0 V1 E1 S0=0 &amp;C1 &amp;D2 +FCLASS=0&lt;br /&gt;OK&lt;br /&gt;--&gt; Modem initialized.&lt;br /&gt;--&gt; Sending: ATDT#777&lt;br /&gt;--&gt; Waiting for carrier.&lt;br /&gt;ATDT#777&lt;br /&gt;CONNECT&lt;br /&gt;--&gt; Carrier detected.  Starting PPP immediately.&lt;br /&gt;--&gt; Starting pppd at Thu Aug 20 22:06:00 2009&lt;br /&gt;--&gt; Pid of pppd: 7268&lt;br /&gt;--&gt; Using interface ppp0&lt;br /&gt;--&gt; pppd: [10]�[17] &lt;br /&gt;--&gt; pppd: [10]�[17] &lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Congrats! your are connected!!! to DISCONNECT use ctrl+c.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/30102683-8754083793630421453?l=himanshuonweb.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://himanshuonweb.blogspot.com/feeds/8754083793630421453/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=30102683&amp;postID=8754083793630421453' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/30102683/posts/default/8754083793630421453'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/30102683/posts/default/8754083793630421453'/><link rel='alternate' type='text/html' href='http://himanshuonweb.blogspot.com/2009/08/using-reliance-netconnect-huawei-1260.html' title='Using Reliance Netconnect Huawei 1260 on Ubuntu Intrepid 8.10'/><author><name>Himanshu</name><uri>http://www.blogger.com/profile/16344716060687825090</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-30102683.post-3954802137677057530</id><published>2009-04-12T19:43:00.009+05:30</published><updated>2009-04-12T22:03:20.613+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='markup'/><category scheme='http://www.blogger.com/atom/ns#' term='rails'/><category scheme='http://www.blogger.com/atom/ns#' term='paragraphs'/><category scheme='http://www.blogger.com/atom/ns#' term='style'/><title type='text'>Common Mistakes with Views</title><content type='html'>&lt;table border="0"&gt;&lt;br /&gt;&lt;tr bgcolor="#A09AFF"&gt;&lt;br /&gt;&lt;td&gt;&lt;b&gt;Donts&lt;/b&gt;&lt;/td&gt;&lt;br /&gt;&lt;td&gt;&lt;b&gt;Dos&lt;/b&gt;&lt;/td&gt;&lt;br /&gt;&lt;td&gt;&lt;b&gt;Why?&lt;/b&gt;&lt;/td&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;tr&gt;&lt;br /&gt;&lt;td bgcolor="#FF8E8E" style="font-size:10px;"&gt;&lt;br /&gt;&amp;lt;p&amp;gt;&lt;br /&gt;  &lt;%= form.label :title %&gt;&lt;br /&gt;  &lt;%= form.text_field :title %&gt; &lt;br /&gt;&amp;lt;/p&amp;gt;&lt;br /&gt;&lt;/td&gt;&lt;br /&gt;&lt;td bgcolor="#D0FF76" style="font-size:10px;"&gt;&lt;br /&gt;&amp;lt;div&amp;gt;&lt;br /&gt;  &lt;%= form.label :title %&gt;&lt;br /&gt;  &lt;%= form.text_field :title %&gt; &lt;br /&gt;&amp;lt;/div&amp;gt;&lt;br /&gt;&lt;/td&gt;&lt;br /&gt;&lt;td style="font-size:10px;" bgcolor="#E8FFFF"&gt;&lt;br /&gt;&amp;lt;p&amp;gt;&lt;br /&gt;  &amp;lt;div class="fieldWithErrors"&amp;gt;&lt;br /&gt;    &amp;lt;label for="deal_title"&amp;gt;Title&amp;lt;label&amp;gt;&lt;br /&gt;  &amp;lt;/div&amp;gt;&lt;br /&gt;  &amp;lt;div class="fieldWithErrors"&amp;gt;&lt;br /&gt;    &amp;lt;input id="deal_title" name="deal[title]" size="30" type="text" value="" /&amp;gt;&lt;br /&gt;  &amp;lt;/div&amp;gt;&lt;br /&gt;&amp;lt;/p&amp;gt;&lt;b&gt;&lt;br /&gt;got the problem? There are divs inside the paragraph tags, which is invalid markup&lt;br /&gt;&lt;/b&gt;&lt;br /&gt;&lt;/td&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;tr&gt;&lt;br /&gt;&lt;td bgcolor="#FF8E8E" style="font-size:10px;"&gt;&lt;br /&gt;&amp;lt;div&amp;gt;&lt;br /&gt;  &lt;%= form.label :location %&gt;&lt;br /&gt;  &lt;%= form.select :location, Location::ALL %&gt;&lt;br /&gt;&amp;lt;/div&amp;gt;&lt;br /&gt;&lt;/td&gt;&lt;br /&gt;&lt;td bgcolor="#D0FF76" style="font-size:10px;"&gt;&lt;br /&gt;&amp;lt;div&amp;gt;&lt;br /&gt;  &lt;%= form.label :location %&gt;&lt;br /&gt;  &lt;%= form.select :location, Location::ALL, :include_blank =&gt; true %&gt;&lt;br /&gt;&amp;lt;/div&amp;gt;&lt;br /&gt;&lt;/td&gt;&lt;br /&gt;&lt;td style="font-size:10px;" bgcolor="#E8FFFF"&gt;&lt;br /&gt;&lt;b&gt;Required Atribute&lt;/b&gt;&lt;br /&gt;If the option is required, prefer that the user gets a validation message saying they need a location instead of accidentally assigning location to Boston when it should be New York.&lt;br/&gt;&lt;b&gt;Optional Attribute&lt;/b&gt;&lt;br /&gt;A blank default has no downside for an optional attribute&lt;br /&gt;&lt;/td&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;tr&gt;&lt;br /&gt;&lt;td bgcolor="#FF8E8E" style="font-size:10px;"&gt;&lt;br /&gt;&lt;b&gt;Styling elements globally&lt;/b&gt;&lt;br /&gt;input {&lt;br /&gt;  float: left;&lt;br /&gt;  clear: both;&lt;br /&gt;}&lt;br /&gt;&lt;/td&gt;&lt;br /&gt;&lt;td bgcolor="#D0FF76" style="font-size:10px;"&gt;&lt;br /&gt;form#new_user #first_name.text_field input {&lt;br /&gt;  float: left;&lt;br /&gt;  clear: both;&lt;br /&gt;}&lt;br /&gt;&lt;/td&gt;&lt;br /&gt;&lt;td style="font-size:10px;" bgcolor="#E8FFFF"&gt;&lt;br /&gt;Writing style to remain specific to page elements will save you from having to troubleshoot many strange layout bugs, and also saves you from having to reset these styles for any subsequent elements.&lt;br /&gt;&lt;/td&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;tr&gt;&lt;td colspan="3" style="font-size:10px;"&gt;&lt;br /&gt;&lt;a href="http://giantrobots.thoughtbot.com/2009/4/9/common-markup-style-mistakes"&gt;Source&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;br /&gt;&lt;/table&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/30102683-3954802137677057530?l=himanshuonweb.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://himanshuonweb.blogspot.com/feeds/3954802137677057530/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=30102683&amp;postID=3954802137677057530' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/30102683/posts/default/3954802137677057530'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/30102683/posts/default/3954802137677057530'/><link rel='alternate' type='text/html' href='http://himanshuonweb.blogspot.com/2009/04/common-mistakes-with-views.html' title='Common Mistakes with Views'/><author><name>Himanshu</name><uri>http://www.blogger.com/profile/16344716060687825090</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-30102683.post-8443628034250202784</id><published>2009-02-17T12:46:00.005+05:30</published><updated>2009-03-21T14:23:06.255+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='ruby'/><category scheme='http://www.blogger.com/atom/ns#' term='Many to Many'/><category scheme='http://www.blogger.com/atom/ns#' term='association'/><category scheme='http://www.blogger.com/atom/ns#' term='rails'/><category scheme='http://www.blogger.com/atom/ns#' term='HABTM'/><category scheme='http://www.blogger.com/atom/ns#' term='relationship'/><title type='text'>Mess up with Many to Many?</title><content type='html'>There are two ways to build a many-to-many relationship.&lt;br /&gt;&lt;br /&gt;The first way uses a has_many association with the :through option and a join model, so there are two stages of associations.&lt;br /&gt;&lt;br /&gt;  class Assignment &lt; ActiveRecord::Base&lt;br /&gt;    belongs_to :programmer  # foreign key - programmer_id&lt;br /&gt;    belongs_to :project     # foreign key - project_id&lt;br /&gt;  end&lt;br /&gt;  class Programmer &lt; ActiveRecord::Base&lt;br /&gt;    has_many :assignments&lt;br /&gt;    has_many :projects, :through =&gt; :assignments&lt;br /&gt;  end&lt;br /&gt;  class Project &lt; ActiveRecord::Base&lt;br /&gt;    has_many :assignments&lt;br /&gt;    has_many :programmers, :through =&gt; :assignments&lt;br /&gt;  end&lt;br /&gt;&lt;br /&gt;For the second way, use has_and_belongs_to_many in both models. This requires a join table that has no corresponding model or primary key.&lt;br /&gt;&lt;br /&gt;  class Programmer &lt; ActiveRecord::Base&lt;br /&gt;    has_and_belongs_to_many :projects       # foreign keys in the join table&lt;br /&gt;  end&lt;br /&gt;  class Project &lt; ActiveRecord::Base&lt;br /&gt;    has_and_belongs_to_many :programmers    # foreign keys in the join table&lt;br /&gt;  end&lt;br /&gt;&lt;br /&gt;Choosing which way to build a many-to-many relationship is not always simple. If you need to work with the relationship model as its own entity, use has_many :through. Use has_and_belongs_to_many when working with legacy schemas or when you never work directly with the relationship itself. &lt;br /&gt;&lt;a href="http://api.rubyonrails.org/classes/ActiveRecord/Associations/ClassMethods.html"&gt;Source&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/30102683-8443628034250202784?l=himanshuonweb.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://himanshuonweb.blogspot.com/feeds/8443628034250202784/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=30102683&amp;postID=8443628034250202784' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/30102683/posts/default/8443628034250202784'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/30102683/posts/default/8443628034250202784'/><link rel='alternate' type='text/html' href='http://himanshuonweb.blogspot.com/2009/02/mess-up-with-habtm.html' title='Mess up with Many to Many?'/><author><name>Himanshu</name><uri>http://www.blogger.com/profile/16344716060687825090</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-30102683.post-4552571717686807256</id><published>2008-11-05T18:44:00.003+05:30</published><updated>2008-11-05T18:56:29.875+05:30</updated><title type='text'>LIBMYSQL.DLL Not Found</title><content type='html'>While starting mysql server if you are getting error like:&lt;br /&gt;LIBMYSQL.DLL Not found, the u need to check the followings-&lt;br /&gt;&lt;br /&gt;1- Check whether you've mysql gem.(Though you don't need to install it as it is already included in Instant Rails)&lt;br /&gt;&lt;br /&gt;2- Check whether the file libmysql.dll is present in /ruby/bin, if not &lt;a href="http://www.dll-files.com/dllindex/pop.php?libmysql"&gt;Download it&lt;/a&gt; from here, and paste it to ruby/bin.&lt;br /&gt;&lt;br /&gt;Hopefully it will work!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/30102683-4552571717686807256?l=himanshuonweb.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://himanshuonweb.blogspot.com/feeds/4552571717686807256/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=30102683&amp;postID=4552571717686807256' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/30102683/posts/default/4552571717686807256'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/30102683/posts/default/4552571717686807256'/><link rel='alternate' type='text/html' href='http://himanshuonweb.blogspot.com/2008/11/libmysqldll-not-found.html' title='LIBMYSQL.DLL Not Found'/><author><name>Himanshu</name><uri>http://www.blogger.com/profile/16344716060687825090</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-30102683.post-1041396610132932758</id><published>2008-06-12T13:22:00.005+05:30</published><updated>2008-06-12T14:29:31.558+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='ActionMailer'/><category scheme='http://www.blogger.com/atom/ns#' term='email'/><category scheme='http://www.blogger.com/atom/ns#' term='attachment'/><title type='text'>Send Email with Attachment using Action Mailer</title><content type='html'>As i love to keep the things simple.. :) Its very easy to use ActionMailer.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style:italic;"&gt;1. Paste the following code in to cofig/environments/development.rb-&lt;/span&gt;&lt;br /&gt;&lt;code&gt;&lt;pre&gt;config.action_mailer.raise_delivery_errors = true&lt;br /&gt; ActionMailer::Base.delivery_method = :smtp#FOR UNIT/FUNCTIONAL TESTING THIS'LL BE :test&lt;br /&gt; ActionMailer::Base.server_settings = {&lt;br /&gt;   :address        =&gt; &amp;lt;replace with your SMTP server&gt;,&lt;br /&gt;   :port           =&gt; &amp;lt;your SMTP server's port&gt;,&lt;br /&gt;   :domain         =&gt; &amp;lt;your domain&gt;,&lt;br /&gt;   :authentication =&gt; :login ,&lt;br /&gt;   :user_name      =&gt; &amp;lt;set if your SMTP server requires authentication&gt;,&lt;br /&gt;   :password       =&gt; &amp;lt;set if your SMTP server requires authentication&gt;&lt;br /&gt; }&lt;br /&gt; ActionMailer::Base.perform_deliveries = true&lt;br /&gt; ActionMailer::Base.raise_delivery_errors = true&lt;br /&gt; ActionMailer::Base.default_charset = "utf-8"&lt;/pre&gt;&lt;br /&gt;&lt;/code&gt;&lt;span style="font-style:italic;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style:italic;"&gt;2. Generate Model class which is derived from ActionMailer::Base. From command prompt of your project directory issue the command-&lt;/span&gt;&lt;br /&gt;&lt;code&gt;&lt;pre&gt;&lt;br /&gt;ruby script/generate mailer &amp;lt;MyMailSender&gt; &amp;lt;send_mail_method&gt;&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;this'll generate the Model named as MyMailSender which will have method name as send_mail_method.&lt;br /&gt;&lt;br /&gt;this model's method have all the data which will be used by its view. view is nothing but the mail which the erceipents are going to receive. at this time Class will look like-&lt;br /&gt;&lt;code&gt;&lt;pre&gt;&lt;br /&gt;class MyMailSender &lt; ActionMailer::Base&lt;br /&gt;&lt;br /&gt;  def send_mail_method(sent_at = Time.now)&lt;br /&gt;    @subject    = 'MyMailSender#sendMail'&lt;br /&gt;    @body       = {}&lt;br /&gt;    @recipients = 'xyz@xyz.com'&lt;br /&gt;    @bcc        = ''&lt;br /&gt;    @from       = 'abc@abc.com'&lt;br /&gt;    @sent_on    = sent_at&lt;br /&gt;    @headers    = {}&lt;br /&gt;  end&lt;br /&gt;&lt;/pre&gt;&lt;/code&gt;&lt;br /&gt;if u want to send a file as an attachment then u've to add the following lines to this method-&lt;br /&gt;&lt;code&gt;&lt;pre&gt;&lt;br /&gt;attachment :content_type =&gt; 'application/vnd.ms-excel',&lt;br /&gt;           :body         =&gt;&lt;br /&gt;File.open("#{RAILS_ROOT}/public/test_sheet.xls","rb") {|f| f.read},&lt;br /&gt;           :filename     =&gt; 'test.xls'&lt;br /&gt;&lt;/pre&gt;&lt;/code&gt;&lt;br /&gt;ensure that test_sheet.xls is there in public folder. If u tend to send another type of file like image, text etc. then u've to change the value of :&lt;a href="http://www.w3.org/TR/REC-html40/types.html#type-content-type"&gt;content_type&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style:italic;"&gt;3. Design a view for your mail.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Now all set to send email, just u've to design a format of email. which will inside-&lt;br /&gt;&lt;code&gt;&lt;pre&gt;&lt;br /&gt;views/my_mail_sender/send_mail_method.rhtml&lt;br /&gt;&lt;/pre&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style:italic;"&gt;4. Call Action mailer's method.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;whenever u need to send email call from ur controller, as-&lt;br /&gt;&lt;code&gt;&lt;pre&gt;&lt;br /&gt;MyMailSender::deliver_send_mail_method&lt;br /&gt;&lt;/pre&gt;&lt;code&gt;&lt;br /&gt;thing to remember is to prefix ur method with deliver_ whenever u call ur method.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/30102683-1041396610132932758?l=himanshuonweb.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://himanshuonweb.blogspot.com/feeds/1041396610132932758/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=30102683&amp;postID=1041396610132932758' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/30102683/posts/default/1041396610132932758'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/30102683/posts/default/1041396610132932758'/><link rel='alternate' type='text/html' href='http://himanshuonweb.blogspot.com/2008/06/send-email-with-attachment-using-action.html' title='Send Email with Attachment using Action Mailer'/><author><name>Himanshu</name><uri>http://www.blogger.com/profile/16344716060687825090</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry></feed>
