<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Vicky On Rails</title>
	<atom:link href="http://vikasnandal.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://vikasnandal.wordpress.com</link>
	<description>Ruby On Rails Its Fun</description>
	<lastBuildDate>Thu, 08 Jan 2009 19:31:03 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='vikasnandal.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://0.gravatar.com/blavatar/65db65211335927aa3cb67fd0b380a8f?s=96&#038;d=http%3A%2F%2Fs2.wp.com%2Fi%2Fbuttonw-com.png</url>
		<title>Vicky On Rails</title>
		<link>http://vikasnandal.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://vikasnandal.wordpress.com/osd.xml" title="Vicky On Rails" />
	<atom:link rel='hub' href='http://vikasnandal.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Ajax pagination with mislav&#8217;s will_paginate</title>
		<link>http://vikasnandal.wordpress.com/2009/01/08/ajax-pagination-with-mislavs-will_paginate/</link>
		<comments>http://vikasnandal.wordpress.com/2009/01/08/ajax-pagination-with-mislavs-will_paginate/#comments</comments>
		<pubDate>Thu, 08 Jan 2009 19:30:22 +0000</pubDate>
		<dc:creator>vikasnandal</dc:creator>
				<category><![CDATA[1]]></category>

		<guid isPermaLink="false">http://vikasnandal.wordpress.com/?p=26</guid>
		<description><![CDATA[Installation of mislav&#8217;s will_paginate. In previous rails versions the PaginationHelper was in bilt but in later versions (Rails 2.0) it is deleted. There are two ways to install the will paginate. * use the gem(recommended) * install as Rails plugin using git; I have put that in the vender/gems folder. Here is the process : [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vikasnandal.wordpress.com&amp;blog=3078769&amp;post=26&amp;subd=vikasnandal&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Installation of mislav&#8217;s will_paginate.<br />
In previous rails versions the PaginationHelper was in bilt but in later versions (Rails 2.0) it is deleted. There are two ways to install the will paginate.</p>
<p>    * use the gem(recommended)<br />
    * install as Rails plugin using git;</p>
<p>I have put that in the vender/gems folder.<br />
Here is the process :</p>
<p>Gem Installation.</p>
<p>1. Download the gem from the Git Hub :<br />
<code><br />
git clone git://github.com/mislav/will_paginate.git<br />
</code><br />
2. Put this in vender/gems folder.<br />
3. Put the following code in environment.rb file :<br />
<code><br />
config.gem "mislav-will_paginate", :version =&gt; "2.3.6", :lib =&gt; "will_paginate"<br />
</code><br />
4. Now in your controller write the code for pagination :<br />
<code><br />
def index<br />
@posts = Post.paginate(:all, :page =&gt; params[:page], :per_page =&gt; 6)<br />
respond_to do |format|<br />
format.html { }<br />
format.js {<br />
render :update do |page|<br />
page.replace_html 'all-posts', :partial =&gt; @posts<br />
page.replace_html 'pagination', :partial =&gt; 'pagination',<br />
:locals =&gt; {:collection =&gt; @posts}<br />
end<br />
}<br />
format.xml { render : xml =&gt; @posts }<br />
end<br />
</code></p>
<p>There will be two partials one for showing the posts and other for the pagination helper.</p>
<p>5. The pagination partial will look like this : -</p>
<p>pagination.html.erb :-<br />
<code><br />
 "true", :params =&gt; { :paginated =&gt; true } %&gt;<br />
</code><br />
6. The index.rhtml file will be :</p>
<p>index.html.erb :-<br />
<code></p>
<div id="all-posts">
 @posts %&gt;
</div>
<div id="pagination">
 "true" %&gt;
</div>
<p><!-- pagination --><br />
</code></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/vikasnandal.wordpress.com/26/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/vikasnandal.wordpress.com/26/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/vikasnandal.wordpress.com/26/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/vikasnandal.wordpress.com/26/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/vikasnandal.wordpress.com/26/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/vikasnandal.wordpress.com/26/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/vikasnandal.wordpress.com/26/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/vikasnandal.wordpress.com/26/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/vikasnandal.wordpress.com/26/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/vikasnandal.wordpress.com/26/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/vikasnandal.wordpress.com/26/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/vikasnandal.wordpress.com/26/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/vikasnandal.wordpress.com/26/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/vikasnandal.wordpress.com/26/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vikasnandal.wordpress.com&amp;blog=3078769&amp;post=26&amp;subd=vikasnandal&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://vikasnandal.wordpress.com/2009/01/08/ajax-pagination-with-mislavs-will_paginate/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/972b56099c97e781f86c2a1db22e3ac7?s=96&#38;d=identicon" medium="image">
			<media:title type="html">vikasnandal</media:title>
		</media:content>
	</item>
		<item>
		<title>Creating Tag Cloud using acts_as_taggable</title>
		<link>http://vikasnandal.wordpress.com/2008/03/10/creating-tag-cloud-using-acts_as_taggable/</link>
		<comments>http://vikasnandal.wordpress.com/2008/03/10/creating-tag-cloud-using-acts_as_taggable/#comments</comments>
		<pubDate>Mon, 10 Mar 2008 10:22:48 +0000</pubDate>
		<dc:creator>vikasnandal</dc:creator>
				<category><![CDATA[Ruby on rails Plugins]]></category>
		<category><![CDATA[acts_as_taggabel. Tag Cloud]]></category>
		<category><![CDATA[Tags]]></category>

		<guid isPermaLink="false">http://vikasnandal.wordpress.com/?p=3</guid>
		<description><![CDATA[In you rails application if you are using acts_as_taggable plugin for creating tags you often need to use tag cloud. To create a tag cloud using acts_as_taggable plugin its simple. We need to add some code in tagaable plugin. It is as follows: Add a new method in the Tag model provided by the acts_as_taggable [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vikasnandal.wordpress.com&amp;blog=3078769&amp;post=3&amp;subd=vikasnandal&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>In you rails application if you are using acts_as_taggable plugin for creating tags you often need to use tag cloud. To create a tag cloud using acts_as_taggable plugin its simple. We need to add some code in tagaable plugin.</p>
<p>It is as follows:<br />
Add a new method in the Tag model provided by the acts_as_taggable plugin. Open the vendor/plugins/acts_as_taggable/lib/tag.rb file and add the following method:</p>
<p><code><br />
def self.tags(options = {})<br />
query = &quot;select tags.id, name, count(*) as count&quot;<br />
query &lt;&lt; &quot; from taggings, tags&quot;<br />
query &lt;&lt; &quot; where tags.id = tag_id&quot;<br />
query &lt;&lt; &quot; group by tag_id&quot;<br />
query &lt;&lt; &quot; order by #{options[:order]}&quot; if options[:order] != nil<br />
query &lt;&lt; &quot; limit #{options[:limit]}&quot; if options[:limit] != nil<br />
tags = Tag.find_by_sql(query)<br />
end<br />
</code></p>
<p>This method will return the id, name, and usage count for each tag. This method also provides a way to limit and order the tags. Once we have added the new method in the Tag model we will need to add a method to the application helper which will help in selecting the right style class for each tag. Add the following function to app/helpers/application_helper.rb:</p>
<p><code><br />
def tag_cloud(tags, classes)<br />
max, min = 0, 0<br />
tags.each { |t|<br />
max = t.count.to_i if t.count.to_i &amp;gt; max<br />
min = t.count.to_i if t.count.to_i &amp;lt; min<br />
}</p>
<p>divisor = ((max - min) / classes.size) + 1</p>
<p>tags.each { |t|<br />
yield t.name, classes[(t.count.to_i - min) / divisor]<br />
}<br />
end<br />
</code></p>
<p>Now focus on the controller and view. In the controller you can use the following bit of code to get the the first one hundred tags order by name:</p>
<p><code><br />
@tags = Tag.tags(:limit =&gt; 100, :order =&gt; "name desc")</code></p>
<p>In the view we will use the tag_cloud method so that it will select the right css class based on the tag usage count. Here is the view code:</p>
<p><code></p>
<p>:tag, :id =&gt; name},<br />
:class =&gt; css_class %&gt;<br />
</code></p>
<p>In the Css file add the following line.</p>
<p><code><br />
.nube1,.nube1:hover, .nube1:active, .nube1:visited {text-decoration:underline;font-size: 1.2em;font-weight: 100;margin-left:1px;color:#000000;}<br />
.nube2,.nube2:hover, .nube2:active, .nube2:visited {text-decoration:underline;font-size: 1.4em;font-weight: 300;margin-left:1px;color:#000000;}<br />
.nube3,.nube3:hover, .nube3:active, .nube3:visited {text-decoration:underline;font-size: 1.6em;font-weight: 500;margin-left:1px;color:#000000;}<br />
.nube4,.nube4:hover, .nube4:active, .nube4:visited {text-decoration:underline;font-size: 1.9em;font-weight: 700;margin-left:1px;color:#000000;}<br />
.nube5,.nube5:hover, .nube5:active, .nube5:visited {text-decoration:underline;font-size: 2.2em;font-weight: 900;margin-left:1px;color:#000000;}<br />
.nube6,.nube6:hover, .nube6:active, .nube6:visited {text-decoration:underline;font-size: 2.5em;font-weight: 1100;margin-left:1px;color:#000000;}<br />
</code></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/vikasnandal.wordpress.com/3/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/vikasnandal.wordpress.com/3/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/vikasnandal.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/vikasnandal.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/vikasnandal.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/vikasnandal.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/vikasnandal.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/vikasnandal.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/vikasnandal.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/vikasnandal.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/vikasnandal.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/vikasnandal.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/vikasnandal.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/vikasnandal.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/vikasnandal.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/vikasnandal.wordpress.com/3/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vikasnandal.wordpress.com&amp;blog=3078769&amp;post=3&amp;subd=vikasnandal&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://vikasnandal.wordpress.com/2008/03/10/creating-tag-cloud-using-acts_as_taggable/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/972b56099c97e781f86c2a1db22e3ac7?s=96&#38;d=identicon" medium="image">
			<media:title type="html">vikasnandal</media:title>
		</media:content>
	</item>
		<item>
		<title>How to export data to CSV In Ruby on Rails</title>
		<link>http://vikasnandal.wordpress.com/2008/03/09/how-to-export-data-to-csv-in-ruby-on-rails/</link>
		<comments>http://vikasnandal.wordpress.com/2008/03/09/how-to-export-data-to-csv-in-ruby-on-rails/#comments</comments>
		<pubDate>Sun, 09 Mar 2008 18:57:04 +0000</pubDate>
		<dc:creator>vikasnandal</dc:creator>
				<category><![CDATA[1]]></category>

		<guid isPermaLink="false">http://vikasnandal.wordpress.com/?p=20</guid>
		<description><![CDATA[he exporting of data to CSV in Rails is very easy just like snitching icecream from 2 year baby. You just need to install a Gem for it and a method and its done. The procedure is written below:- 1. install the fastercsv gem :- sudo gem install fastercsv 2. now in the controller use [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vikasnandal.wordpress.com&amp;blog=3078769&amp;post=20&amp;subd=vikasnandal&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>he exporting of data to CSV in Rails is very easy just like snitching icecream from 2 year baby. You just need to install a Gem for it and a method and its done.</p>
<p>The procedure is written below:-</p>
<p>1. install the fastercsv gem :-<br />
<code><br />
sudo gem install fastercsv<br />
</code></p>
<p>2. now in the controller use this gem and copy the method in the bottom of your controller and also use CSV as written:-</p>
<p>class ArticlesController &lt; ApplicationController</p>
<p>require &#8216;fastercsv&#8217;<br />
&#8230;&#8230;<br />
.<br />
.<br />
.</p>
<p>def show_users<br />
@users = User.find(:all)<br />
stream_csv do |csv|<br />
csv &lt;&lt; ["Show all the users in excel"]<br />
csv &lt;&lt; [""]<br />
csv &lt;&lt; ["ID" ,"Name" ,"Address" ,"Email"]<br />
@users.each do |u|<br />
csv &lt;&lt; [u.id, u.name, u.address, u.email]<br />
end<br />
end</p>
<p>end</p>
<p>private<br />
def stream_csv</p>
<p>filename = action_name + &#8220;.csv&#8221;</p>
<p>#this is required if you want this to work with IE<br />
if request.env['HTTP_USER_AGENT'] =~ /msie/i<br />
headers['Pragma'] = &#8216;public&#8217;<br />
headers["Content-type"] = &#8220;text/plain&#8221;<br />
headers['Cache-Control'] = &#8216;no-cache, must-revalidate, post-check=0, pre-check=0&#8242;<br />
headers['Content-Disposition'] = &#8220;attachment; filename=\&#8221;#{filename}\&#8221;"<br />
headers['Expires'] = &#8220;0&#8243;<br />
else<br />
headers["Content-Type"] ||= &#8216;text/csv&#8217;<br />
headers["Content-Disposition"] = &#8220;attachment; filename=\&#8221;#{filename}\&#8221;"<br />
end</p>
<p>render :text =&gt; Proc.new { |response, output|<br />
csv = FasterCSV.new(output, :row_sep =&gt; &#8220;\r\n&#8221;)<br />
yield csv<br />
}<br />
end</p>
<p>end</p>
<p>and its done. You have exported data to excel sheet .</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/vikasnandal.wordpress.com/20/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/vikasnandal.wordpress.com/20/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/vikasnandal.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/vikasnandal.wordpress.com/20/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/vikasnandal.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/vikasnandal.wordpress.com/20/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/vikasnandal.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/vikasnandal.wordpress.com/20/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/vikasnandal.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/vikasnandal.wordpress.com/20/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/vikasnandal.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/vikasnandal.wordpress.com/20/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/vikasnandal.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/vikasnandal.wordpress.com/20/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/vikasnandal.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/vikasnandal.wordpress.com/20/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vikasnandal.wordpress.com&amp;blog=3078769&amp;post=20&amp;subd=vikasnandal&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://vikasnandal.wordpress.com/2008/03/09/how-to-export-data-to-csv-in-ruby-on-rails/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/972b56099c97e781f86c2a1db22e3ac7?s=96&#38;d=identicon" medium="image">
			<media:title type="html">vikasnandal</media:title>
		</media:content>
	</item>
		<item>
		<title>How to export data using MS word or MS excel</title>
		<link>http://vikasnandal.wordpress.com/2008/03/08/how-to-export-data-using-ms-word-or-ms-excel/</link>
		<comments>http://vikasnandal.wordpress.com/2008/03/08/how-to-export-data-using-ms-word-or-ms-excel/#comments</comments>
		<pubDate>Sat, 08 Mar 2008 18:54:55 +0000</pubDate>
		<dc:creator>vikasnandal</dc:creator>
				<category><![CDATA[1]]></category>

		<guid isPermaLink="false">http://vikasnandal.wordpress.com/?p=17</guid>
		<description><![CDATA[Its also very easy to export data to doc format or xls format. There is no plugin or gem required for that. The procedure is : FOR XLS FORMAT: def export headers['Content-Type'] = "application/vnd.ms-excel" headers['Content-Disposition'] = 'attachment; filename="excel-export.xls"' headers['Cache-Control'] = '' @records = Record.find(:all) end FOR DOC FORMAT def export headers['Content-Type'] = "application/vnd.ms-word" headers['Content-Disposition'] = [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vikasnandal.wordpress.com&amp;blog=3078769&amp;post=17&amp;subd=vikasnandal&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Its also very easy to export data to doc format or xls format. There is no plugin or gem required for that.<br />
The procedure is :</p>
<p>FOR XLS FORMAT:<br />
<code><br />
def export<br />
headers['Content-Type'] = "application/vnd.ms-excel"<br />
headers['Content-Disposition'] = 'attachment; filename="excel-export.xls"'<br />
headers['Cache-Control'] = ''<br />
@records = Record.find(:all)<br />
end<br />
</code></p>
<p>FOR DOC FORMAT</p>
<p><code><br />
def export<br />
headers['Content-Type'] = "application/vnd.ms-word"<br />
headers['Content-Disposition'] = 'attachment; filename="excel-export.doc"'<br />
headers['Cache-Control'] = ''<br />
@records = Record.find(:all)<br />
end<br />
</code></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/vikasnandal.wordpress.com/17/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/vikasnandal.wordpress.com/17/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/vikasnandal.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/vikasnandal.wordpress.com/17/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/vikasnandal.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/vikasnandal.wordpress.com/17/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/vikasnandal.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/vikasnandal.wordpress.com/17/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/vikasnandal.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/vikasnandal.wordpress.com/17/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/vikasnandal.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/vikasnandal.wordpress.com/17/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/vikasnandal.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/vikasnandal.wordpress.com/17/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/vikasnandal.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/vikasnandal.wordpress.com/17/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vikasnandal.wordpress.com&amp;blog=3078769&amp;post=17&amp;subd=vikasnandal&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://vikasnandal.wordpress.com/2008/03/08/how-to-export-data-using-ms-word-or-ms-excel/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/972b56099c97e781f86c2a1db22e3ac7?s=96&#38;d=identicon" medium="image">
			<media:title type="html">vikasnandal</media:title>
		</media:content>
	</item>
		<item>
		<title>Uploading video using Mongrel_upload progress and Active Messaging</title>
		<link>http://vikasnandal.wordpress.com/2008/02/23/uploading-video-using-mongrel_upload-progress-and-active-messaging/</link>
		<comments>http://vikasnandal.wordpress.com/2008/02/23/uploading-video-using-mongrel_upload-progress-and-active-messaging/#comments</comments>
		<pubDate>Sat, 23 Feb 2008 18:49:35 +0000</pubDate>
		<dc:creator>vikasnandal</dc:creator>
				<category><![CDATA[1]]></category>

		<guid isPermaLink="false">http://vikasnandal.wordpress.com/?p=14</guid>
		<description><![CDATA[ActiveMessaging is an attempt to bring the simplicity and elegance of rails development to the world of messaging. Messaging, (or event-driven architecture) is widely used for enterprise integration, with frameworks such as Java&#8217;s JMS, and products such as ActiveMQ, Tibco, IBM MQSeries, etc. Download Active Messaging from SVN: script/plugin install http://activemessaging.googlecode.com/svn/trunk/plugins/activemessaging For the protocol, ActiveMessaging [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vikasnandal.wordpress.com&amp;blog=3078769&amp;post=14&amp;subd=vikasnandal&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>ActiveMessaging is an attempt to bring the simplicity and elegance of rails development to the world of messaging. Messaging, (or event-driven architecture) is widely used for enterprise integration, with frameworks such as Java&#8217;s JMS, and products such as ActiveMQ, Tibco, IBM MQSeries, etc.</p>
<p>Download Active Messaging from SVN:</p>
<p><code>script/plugin install http://activemessaging.googlecode.com/svn/trunk/plugins/activemessaging<br />
</code></p>
<p>For the protocol, ActiveMessaging supports Stomp: Streaming Text-Oriented Messaging Protocol. Stomp is a messaging standard to exchange text based messages over wire connections, usually tcp/ip.</p>
<p>TO install the stomp install the gems:</p>
<p>Assuming you have Rails 1.1+ and MySql already, you&#8217;ll also need 2 more RubyGems: daemons and Stomp:</p>
<p><code>sudo gem install daemons<br />
sudo gem install stomp </code></p>
<p>Download Apache ActiveMQ from</p>
<p>http://activemq.apache.org/</p>
<p>Apache ActiveMQ is the most popular and powerful open source Message Broker and Enterprise Integration Patterns provider.<br />
<code><br />
cd /usr/local/src </p>
<p>#unix and cygwin<br />
wget http://people.apache.org/repo/m2-snapshot-repository/org/apache/activemq/apache-activemq/4.2-SNAPSHOT/apache-activemq-4.2-20070221.081507-10-src.tar.gz</p>
<p>#os x<br />
curl -O http://people.apache.org/repo/m2-snapshot-repository/org/apache/activemq/apache-activemq/4.2-SNAPSHOT/apache-activemq-4.2-20070221.081507-10-src.tar.gz</p>
<p>cd ..<br />
tar xvfz apache-activemq-4.2-20070221.081507-10-src.tar.gz</p>
<p>cd apache-activemq-4.2-incubator-SNAPSHOT</p>
<p>./bin/activemq </p>
<p></code></p>
<p>Download the sample application using ActiveMessaging and Amazon S3</p>
<p>http://blog.snowonrails.com/articles/2007/05/31/how-to-build-a-mini-youtube-using-activemessaging-plugin-and-amazon-s3</p>
<p>Mongrel Upload Demo<br />
http://itblog.mcgeecorp.com/2007/5/15/mongrel-upload-progress-demo</p>
<p>Install the mongrel_upload progress plugin<br />
<code><br />
gem install mongrel --source=http://mongrel.rubyforge.org/releases/</p>
<p>svn co svn://rubyforge.org/var/svn/mongrel/trunk/projects/mongrel_upload_progress<br />
cd mongrel_upload_progress<br />
rake install</p>
<p></code></p>
<p>Mongrel_upload useses respond_to_parent function and also mongrel_upload_progress.conf file</p>
<p>Now Active Messaging video uploading as give by the</p>
<p>uses the Amazon S3 address for string the file address. And for that you need API key<br />
and for sure its not free. So I have discovered the alternate to use the localhost for stroing the images.</p>
<p>Its very simple..</p>
<p>In the model video.rb use the following:</p>
<p><code><br />
VIDEO_BASE = "#{RAILS_ROOT}/public/videos"<br />
VIDEO_UPLOADED = VIDEO_BASE+"/uploaded/"<br />
VIDEO_CONVERTED = VIDEO_BASE+"/converted/"</p>
<p>def video=(video_file)<br />
@temp_file = video_file<br />
self.file_name = video_file.original_filename<br />
self.ext = self.file_name.split('.').last<br />
end</p>
<p>def video_upload_path(file_name=self.file_name)<br />
VIDEO_UPLOADED + file_name<br />
end</p>
<p>def video_convert_path(file_name=convert_file_name)<br />
VIDEO_CONVERTED + "#{id}/"+ file_name<br />
end</p>
<p>def convert_file_name<br />
"#{get_original_filename_without_ext}.flv"<br />
end</p>
<p>def before_create<br />
logger.debug("In before save of video.rb, video_upload_path is:"+video_upload_path+" and video_convert_path is:"+video_convert_path)<br />
save_upload_file<br />
end</p>
<p>def after_create<br />
create_dir<br />
end</p>
<p>private<br />
def get_original_filename_without_ext(filename=self.file_name)<br />
filename.sub(/(.\w+\z)/,"")<br />
end</p>
<p>def create_dir<br />
if !File.exist?(VIDEO_CONVERTED+"#{id}/")<br />
Dir.mkdir(VIDEO_CONVERTED+"#{id}/")<br />
end<br />
end</p>
<p>def save_upload_file<br />
if !File.exist?(VIDEO_BASE)<br />
Dir.mkdir(VIDEO_BASE)<br />
end<br />
if !File.exist?(VIDEO_UPLOADED)<br />
Dir.mkdir(VIDEO_UPLOADED)<br />
end<br />
if !File.exist?(VIDEO_CONVERTED+"#{id}/")<br />
Dir.mkdir(VIDEO_CONVERTED+"#{id}/")<br />
end</p>
<p>File.open(video_upload_path,"wb") do |f|<br />
f.write(@temp_file.read)<br />
end<br />
end<br />
</code></p>
<p>n the broker.yml file use the following settings:<br />
<code><br />
adapter: stomp<br />
login: ""<br />
passcode: ""<br />
host: localhost<br />
port: 61613<br />
reliable: true<br />
reconnectDelay: 5<br />
</code></p>
<p>Now its done.</p>
<p>Start your newly created application as like that:</p>
<p>Start ActiveMQ<br />
Start Rails with mongrel_upload_progress config file<br />
Start Poller<br />
Start DRB server</p>
<p>Bingoooooooooo. </p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/vikasnandal.wordpress.com/14/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/vikasnandal.wordpress.com/14/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/vikasnandal.wordpress.com/14/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/vikasnandal.wordpress.com/14/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/vikasnandal.wordpress.com/14/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/vikasnandal.wordpress.com/14/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/vikasnandal.wordpress.com/14/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/vikasnandal.wordpress.com/14/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/vikasnandal.wordpress.com/14/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/vikasnandal.wordpress.com/14/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/vikasnandal.wordpress.com/14/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/vikasnandal.wordpress.com/14/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/vikasnandal.wordpress.com/14/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/vikasnandal.wordpress.com/14/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/vikasnandal.wordpress.com/14/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/vikasnandal.wordpress.com/14/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vikasnandal.wordpress.com&amp;blog=3078769&amp;post=14&amp;subd=vikasnandal&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://vikasnandal.wordpress.com/2008/02/23/uploading-video-using-mongrel_upload-progress-and-active-messaging/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/972b56099c97e781f86c2a1db22e3ac7?s=96&#38;d=identicon" medium="image">
			<media:title type="html">vikasnandal</media:title>
		</media:content>
	</item>
		<item>
		<title>Ajax Editing using In-Place Form Editing</title>
		<link>http://vikasnandal.wordpress.com/2008/02/08/ajax-editing-using-in-place-form-editing/</link>
		<comments>http://vikasnandal.wordpress.com/2008/02/08/ajax-editing-using-in-place-form-editing/#comments</comments>
		<pubDate>Fri, 08 Feb 2008 18:47:27 +0000</pubDate>
		<dc:creator>vikasnandal</dc:creator>
				<category><![CDATA[1]]></category>

		<guid isPermaLink="false">http://vikasnandal.wordpress.com/?p=10</guid>
		<description><![CDATA[Your application has data that are often edited by your users—usually very quickly. You want to give your users an easy way to edit application data in place without having to open a separate editing form. Rails makes in-place editing easy with the script.aculo.us InPlaceEditor control and accompanying helpers. First create a model and controller. [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vikasnandal.wordpress.com&amp;blog=3078769&amp;post=10&amp;subd=vikasnandal&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Your application has data that are often edited by<br />
your users—usually very quickly. You want to give your users an easy<br />
way to edit application data in place without having to open a separate<br />
editing form.</p>
<p>Rails makes in-place editing easy with the script.aculo.us InPlaceEditor<br />
control and accompanying helpers.</p>
<p>First create a model and controller.</p>
<p>Put JavaScript files in your views. Somewhere in the head<br />
of your HTML document, you can call the following:</p>
<p><code>&lt;%=javascript_include_tag :defaults%&gt;</code></p>
<p>put the in place editor in you .rhtml file like this</p>
<p><code>&lt;%=in_place_editor_field :contact, :name%&gt;</code></p>
<p>In Controller write the following line<br />
<code><br />
in_place_edit_for :contact, :name<br />
</code><br />
and its done. </p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/vikasnandal.wordpress.com/10/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/vikasnandal.wordpress.com/10/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/vikasnandal.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/vikasnandal.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/vikasnandal.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/vikasnandal.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/vikasnandal.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/vikasnandal.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/vikasnandal.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/vikasnandal.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/vikasnandal.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/vikasnandal.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/vikasnandal.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/vikasnandal.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/vikasnandal.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/vikasnandal.wordpress.com/10/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vikasnandal.wordpress.com&amp;blog=3078769&amp;post=10&amp;subd=vikasnandal&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://vikasnandal.wordpress.com/2008/02/08/ajax-editing-using-in-place-form-editing/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/972b56099c97e781f86c2a1db22e3ac7?s=96&#38;d=identicon" medium="image">
			<media:title type="html">vikasnandal</media:title>
		</media:content>
	</item>
		<item>
		<title>Observe_form for getting Live preview</title>
		<link>http://vikasnandal.wordpress.com/2008/01/08/observe_form-for-getting-live-preview/</link>
		<comments>http://vikasnandal.wordpress.com/2008/01/08/observe_form-for-getting-live-preview/#comments</comments>
		<pubDate>Tue, 08 Jan 2008 18:35:32 +0000</pubDate>
		<dc:creator>vikasnandal</dc:creator>
				<category><![CDATA[1]]></category>

		<guid isPermaLink="false">http://vikasnandal.wordpress.com/?p=4</guid>
		<description><![CDATA[You’d like to give your users the ability to see a live preview of their data as they are editing it. You don’t want them to have to wait until they submit a form. So that if there is any error it can be rectified. Include the javascripts in the layouts. Now that we’ve got [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vikasnandal.wordpress.com&amp;blog=3078769&amp;post=4&amp;subd=vikasnandal&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>You’d like to give your users the ability to see a live preview of their data<br />
as they are editing it. You don’t want them to have to wait until they<br />
submit a form. So that if there is any error it can be rectified.</p>
<p>Include the javascripts in the layouts.</p>
<p><code></code></p>
<p>Now that we’ve got the necessary JavaScript libraries loaded, we’ll create<br />
the model and controller.Suppose the controller name is Content and model name is Example. There are two fields in the table (&#8216;title&#8217; and &#8216;body&#8217; )</p>
<p>Now in the model define the attribute accessor</p>
<p><code><br />
class Example<br />
attr_accessor :title, :body<br />
end<br />
</code></p>
<p>We will create a new method<br />
<code><br />
def new<br />
@data= Example.new<br />
end<br />
</code></p>
<p>Create the file, app/views/content/new.rhtml, and edit it to look like<br />
the following.<br />
<code><br />
&lt;% form_for(:example,:url =&gt; {:action=&gt;'create',:html =&gt; {:class=&gt;'wufoo', :id =&gt; &quot;form&quot;} ) do |form| %&gt;<br />
&lt;%= text_field :example, :title %&gt;</p>
<p>&lt;%= text_area :example, :body %&gt;</p>
<p>&lt;%= submit_tag &quot;Save&quot; %&gt;<br />
&lt;% end %&gt;<br />
&lt;%= observe_form &quot;form&quot;,:frequency =&gt; 5,:update =&gt; &quot;preview&quot;,:complete =&gt; &quot;Element.show(' preview' )&quot;,<br />
:url =&gt; { :action =&gt; &quot;preview&quot; } %&gt;<br />
</code></p>
<p>In the method preview we write<br />
<code><br />
def preview<br />
render :layout =&gt; false<br />
end<br />
</code></p>
<p>The only job of the action code is to short circuit the application’s usual<br />
rendering. Since we’re going to be updating the live-preview element of<br />
our diary entry creation page with the full results of the preview( ) action,<br />
we don’t want it returning a full HTML page.</p>
<p>The preview action’s view, in app/views/content/preview.rhtml should look<br />
like this:</p>
<p><strong><br />
Form Preview<br />
</strong><br />
<code><br />
&lt;%= params[:example][:title] %&gt;<br />
</code><br />
<code><br />
&lt;%= textilize params[:example][:body] %&gt;<br />
</code><br />
That’s all there is to it! This view prints the entry’s title as an HTML<br />
heading and then generates HTML output via the textilize( ) method. This<br />
method uses the RedCloth library internally to transform very simple<br />
text markup to HTML. </p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/vikasnandal.wordpress.com/4/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/vikasnandal.wordpress.com/4/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/vikasnandal.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/vikasnandal.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/vikasnandal.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/vikasnandal.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/vikasnandal.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/vikasnandal.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/vikasnandal.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/vikasnandal.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/vikasnandal.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/vikasnandal.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/vikasnandal.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/vikasnandal.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/vikasnandal.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/vikasnandal.wordpress.com/4/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vikasnandal.wordpress.com&amp;blog=3078769&amp;post=4&amp;subd=vikasnandal&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://vikasnandal.wordpress.com/2008/01/08/observe_form-for-getting-live-preview/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/972b56099c97e781f86c2a1db22e3ac7?s=96&#38;d=identicon" medium="image">
			<media:title type="html">vikasnandal</media:title>
		</media:content>
	</item>
	</channel>
</rss>
