<?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>SapnaSolutions Blog</title>
	<atom:link href="http://sappsdreams.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://sappsdreams.wordpress.com</link>
	<description>Some blabs from SapnaSolutions&#039; dreamers...</description>
	<lastBuildDate>Mon, 12 Sep 2011 07:11:25 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='sappsdreams.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://1.gravatar.com/blavatar/b997b55dcc2d7b8707caa66c7d14ffcc?s=96&#038;d=http%3A%2F%2Fs2.wp.com%2Fi%2Fbuttonw-com.png</url>
		<title>SapnaSolutions Blog</title>
		<link>http://sappsdreams.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://sappsdreams.wordpress.com/osd.xml" title="SapnaSolutions Blog" />
	<atom:link rel='hub' href='http://sappsdreams.wordpress.com/?pushpress=hub'/>
		<item>
		<title>How to make your application work for both MySQL and PostgreSQL?</title>
		<link>http://sappsdreams.wordpress.com/2011/09/12/how-to-make-your-application-work-for-both-mysql-and-postgresql/</link>
		<comments>http://sappsdreams.wordpress.com/2011/09/12/how-to-make-your-application-work-for-both-mysql-and-postgresql/#comments</comments>
		<pubDate>Mon, 12 Sep 2011 07:11:25 +0000</pubDate>
		<dc:creator>Rans</dc:creator>
				<category><![CDATA[databases]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[PostgreSQL]]></category>

		<guid isPermaLink="false">http://sappsdreams.wordpress.com/?p=182</guid>
		<description><![CDATA[I am using rails 3 and ruby 1.9.2 in my application. For development environment, I am using MySQL and for staging environment, I am using PostgreSQL Database. After hosting, we have faced some issues. 1) Quoting styles: MySQL allows you to quote table and column names with backquotes, whereas PostgreSQL uses double quotes. For ex: <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sappsdreams.wordpress.com&amp;blog=11568774&amp;post=182&amp;subd=sappsdreams&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I am using rails 3 and ruby 1.9.2 in my application.<br />
For development environment, I am using MySQL and for staging environment, I am using PostgreSQL Database.<br />
After hosting, we have faced some issues.</p>
<p><strong>1) Quoting styles:</strong><br />
MySQL allows you to quote table and column names with backquotes, whereas PostgreSQL uses double quotes.<br />
For ex:<br />
One of our tables has a column in it called when, which must be quoted whenever we use it.<br />
Rails will of course handle the quoting for you if you do something like</p>
<pre>Meeting.find_by_when(Time.now)</pre>
<p>But if you are constructing your own SQL conditions then you have to handle the quoting problem.</p>
<p>In MySQL, it would be like</p>
<pre>Meeting.where("`when` &lt; ?", Time.now)</pre>
<p>In PostgreSQL, it would be like</p>
<pre>Meeting.where("\"when\" &lt; ?", Time.now)</pre>
<p>Solution:</p>
<pre>Meeting.where("#{Meeting.connection.quote_column_name(when)} &lt; ?", Time.now)</pre>
<p><strong>2) Boolean type:</strong><br />
MySQL lacks a native BOOLEAN type, so if you create a boolean column in Rails, you will end up with a TINYINT(1) column which has values of 0 and 1 for false and true respectively. PostgreSQL has a native BOOLEAN type, it will accept only false/true unlike MySQL.</p>
<p>In MySQL, it would be like</p>
<pre>Meeting.where("import=1") OR Meeting.where("import=?", true)</pre>
<p>In PostgreSQL, it would be like</p>
<pre>Meeting.where("import=?", true)</pre>
<p>Solution:</p>
<pre>so replace 0 and 1 with false and true in your all files then it work in both MySQL and PostgreSQL.</pre>
<p><strong>3) Other differences:</strong><br />
(i) Fulltext Search: PostgreSQL is case sensitive. MySQL is not case sensitive.<br />
(ii) To select random records from DB, Mysql has a function called &#8220;rand()&#8221; and PostgreSQL has a function called &#8220;random()&#8221;.<br />
(iii) PostgreSQL ALTER TABLE supports ADD COLUMN, RENAME COLUMN and RENAME TABLE only. MySQL has all options in ALTER TABLE.<br />
(iv) In PostgreSQL, attribute name starting with numbers, like &#8220;360_degree&#8221; are not allowed.</p>
<p>Good luck!</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sappsdreams.wordpress.com/182/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sappsdreams.wordpress.com/182/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sappsdreams.wordpress.com/182/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sappsdreams.wordpress.com/182/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sappsdreams.wordpress.com/182/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sappsdreams.wordpress.com/182/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sappsdreams.wordpress.com/182/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sappsdreams.wordpress.com/182/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sappsdreams.wordpress.com/182/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sappsdreams.wordpress.com/182/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sappsdreams.wordpress.com/182/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sappsdreams.wordpress.com/182/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sappsdreams.wordpress.com/182/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sappsdreams.wordpress.com/182/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sappsdreams.wordpress.com&amp;blog=11568774&amp;post=182&amp;subd=sappsdreams&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://sappsdreams.wordpress.com/2011/09/12/how-to-make-your-application-work-for-both-mysql-and-postgresql/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d968f09778657cdb1d7c0d58939834f8?s=96&#38;d=monsterid&#38;r=G" medium="image">
			<media:title type="html">rans</media:title>
		</media:content>
	</item>
		<item>
		<title>Dasboard (the company around you)</title>
		<link>http://sappsdreams.wordpress.com/2011/09/12/dasboard-the-company-around-you/</link>
		<comments>http://sappsdreams.wordpress.com/2011/09/12/dasboard-the-company-around-you/#comments</comments>
		<pubDate>Mon, 12 Sep 2011 07:10:51 +0000</pubDate>
		<dc:creator>cquenx</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[Dashboard]]></category>
		<category><![CDATA[Product]]></category>

		<guid isPermaLink="false">http://sappsdreams.wordpress.com/?p=189</guid>
		<description><![CDATA[Yes, what if you can have an overview of your entire company and every employee. Dasboard brings you the best of both the worlds- the statistics of the company and a perfect UI to give you the finest User Experience. Most of the graph database in dasboard are moving towards runtime flexibility (but not a <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sappsdreams.wordpress.com&amp;blog=11568774&amp;post=189&amp;subd=sappsdreams&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Yes, what if you can have an overview of your entire company and every employee. Dasboard brings you the best of both the worlds- the statistics of the company and a perfect UI to give you the finest User Experience.</p>
<p>Most of the graph database in dasboard are moving towards runtime flexibility (but not a lot) for well defined types and performance. A client graph for e.g gives a representation of various clients and various projects, if I just want to list all the people in the company and check out each of their performance dasboard allows u to do that too. How does dasboard get individual performances? The little secret here is that we are using a generic internal feedback system that we started developing. Based on various feedbacks our internally learning algorithms carefully does collaborative filtering and represents it in the finest UI possible.</p>
<p>Thats not it..!! Dasboard even brings all your projects together. Dasboard talks to various API’s and combining this information with some of the best practices we have been adopting from the <em><strong>agile world</strong></em> dasboard is fast evoloving into one of the finest inhouse products we have been working on.</p>
<p>Stay tuned….!!</p>
<table style="width:auto;">
<tbody>
<tr>
<td><a href="https://picasaweb.google.com/lh/photo/5Op2sDMb9TWjNTWRplT_iw?feat=embedwebsite"><img src="https://lh6.googleusercontent.com/-Qepa9mm1X9c/TmhZS35KIpI/AAAAAAAAAKE/fvFjZxCRURk/s400/Screenshot.png" alt="" width="400" height="101" /></a></td>
</tr>
<tr>
<td style="font-family:arial,sans-serif;font-size:11px;text-align:right;">From <a href="https://picasaweb.google.com/thepigeon.x/September82011?authuser=0&amp;feat=embedwebsite">September 8, 2011</a></td>
</tr>
</tbody>
</table>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sappsdreams.wordpress.com/189/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sappsdreams.wordpress.com/189/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sappsdreams.wordpress.com/189/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sappsdreams.wordpress.com/189/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sappsdreams.wordpress.com/189/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sappsdreams.wordpress.com/189/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sappsdreams.wordpress.com/189/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sappsdreams.wordpress.com/189/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sappsdreams.wordpress.com/189/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sappsdreams.wordpress.com/189/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sappsdreams.wordpress.com/189/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sappsdreams.wordpress.com/189/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sappsdreams.wordpress.com/189/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sappsdreams.wordpress.com/189/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sappsdreams.wordpress.com&amp;blog=11568774&amp;post=189&amp;subd=sappsdreams&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://sappsdreams.wordpress.com/2011/09/12/dasboard-the-company-around-you/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/3d31289d68a7d9e8fd8859b49b7b6e0d?s=96&#38;d=monsterid&#38;r=G" medium="image">
			<media:title type="html">cquenx</media:title>
		</media:content>

		<media:content url="//lh6.googleusercontent.com/-Qepa9mm1X9c/TmhZS35KIpI/AAAAAAAAAKE/fvFjZxCRURk/s400/Screenshot.png" medium="image" />
	</item>
		<item>
		<title>RabbitMQ and Rails. Why my chat application failed.</title>
		<link>http://sappsdreams.wordpress.com/2011/07/21/rabbitmq-and-rails-why-my-chat-application-failed/</link>
		<comments>http://sappsdreams.wordpress.com/2011/07/21/rabbitmq-and-rails-why-my-chat-application-failed/#comments</comments>
		<pubDate>Thu, 21 Jul 2011 12:09:06 +0000</pubDate>
		<dc:creator>sid</dc:creator>
				<category><![CDATA[rails]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[AMQP]]></category>
		<category><![CDATA[EventMachine]]></category>
		<category><![CDATA[RabbitMQ]]></category>

		<guid isPermaLink="false">http://sappsdreams.wordpress.com/?p=171</guid>
		<description><![CDATA[Over the last few weeks I&#8217;ve been playing with RabbitMQ and Rails have been completely blown away by how awesome it is. I started out to build a simple chat application which would allow users to create a room and log into the room and post messages to multiple users who were logged in. Though, <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sappsdreams.wordpress.com&amp;blog=11568774&amp;post=171&amp;subd=sappsdreams&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Over the last few weeks I&#8217;ve been playing with <a href="http://www.rabbitmq.com/">RabbitMQ</a> and Rails have been completely blown away by how awesome it is.</p>
<p>I started out to build a simple chat application which would allow users to create a room and log into the room and post messages to multiple users who were logged in. Though, this is probably not the best use case for using AMQP but it helped me understand how AMQP worked and maybe I&#8217;ll get to use somewhere more apt.</p>
<p><strong> RabbitMQ </strong></p>
<p><a href="http://www.rabbitmq.com/">What is RabbitMQ</a><br />
RabbitMQ is an open source, highly scalable messaging system which provides support for STOMP, SMTP and HTTP messaging. <a href="http://www.rabbitmq.com/">[www.rabbitmq.com]</a></p>
<p>It&#8217;s built using the Advanced Message Queuing protocol <a href="http://www.amqp.org/">(AMQP)</a> which provides APIs in Ruby and several other programming languages.</p>
<p><strong> Installation </strong></p>
<p>The easiest way to <a href="http://www.rabbitmq.com/install.html#machomebrew">install RabbitMQ</a> on the Mac is using homebrew. The Macports installation has many issues and I would recommend going with HomeBrew. It also takes care of all dependencies like the correct Erlang installation etc.</p>
<p>You can test your installation by moving into the installation &#8216;bin&#8217; directory and running rabbitmq-server</p>
<p>If you end up seeing something like</p>
<pre> ...
 starting error log relay                                              ...done
 starting networking                                                   ...done
 starting direct_client                                                ...done
 starting notify cluster nodes
 broker running</pre>
<p>your good to go.</p>
<p><strong> Creating our AMQP server </strong></p>
<p>In Ruby we could run our AMQP server using the <a href="http://rubygems.org/gems/amqp">&#8216;amqp gem&#8217;</a> along with EventMachine.</p>
<p>The AMQP server code.</p>
<pre>require 'rubygems'
require 'amqp'
require 'mongo'
require 'em-websocket'
require 'json'

....

@sockets = []
EventMachine.run do
  connection  = AMQP.connect(:host =&gt; '127.0.0.1')
  channel = AMQP::Channel.new(connection)
  puts "Connected to AMQP broker. #{AMQP::VERSION} "
  mongo = MongoManager.establish_connection("trackertalk_development")

  EventMachine::WebSocket.start(:host =&gt; '127.0.0.1', :port =&gt; 8080) do |ws|
    socket_detail = {:socket =&gt; ws}
    ws.onopen do
      @sockets &lt; true)
        #AMQP::Consumer.new(channel, queue)

      elsif status[:status] == 'MESSAGE'
        full_message = "<strong> #{status[:username]} :</strong>  #{status[:message]}"
        exchange.publish(full_message)
      end
    end

    ws.onclose do
      @sockets.delete ws
    end
  end

end</pre>
<p>The code snippet contains most of the amqp server code. The entire code lives inside the EM.run loop. Ignore the Mongo bit as it doesn&#8217;t play a part in our area of interest.</p>
<pre>@sockets = []
EventMachine.run do
  connection  = AMQP.connect(:host =&gt; '127.0.0.1')
  channel = AMQP::Channel.new(connection)
...</pre>
<p>In this snippet I created a new AMQP connection to localhost. When not provided with any other parameter the default port used by AMQP is 5672 with the username: guest and password :guest. Since the RabbitMQ installation will never (in most cases) have to be accessed from outside the server its safe to run the installation with the defaults.</p>
<p>The second line creates a new <a href="http://rubydoc.info/github/ruby-amqp/amqp/master/AMQP/Channel">channel</a>.</p>
<p>Once the channel is established the EM::Websocket block is used to allow modern browsers to connect to our server on port 8080</p>
<pre>EventMachine::WebSocket.start(:host =&gt; '127.0.0.1', :port =&gt; 8080) do |ws|
    socket_detail = {:socket =&gt; ws}
    ws.onopen do
      @sockets &lt; true)
        #AMQP::Consumer.new(channel, queue)

      elsif status[:status] == 'MESSAGE'
        full_message = "<strong> #{status[:username]} :</strong>  #{status[:message]}"
        exchange.publish(full_message)
      end
    end

    ws.onclose do
      @sockets.delete ws
    end</pre>
<p>This is where the core logic lies. On the socket connect block I store the current socket in an array to use it later.</p>
<p>The &#8216;onmessage&#8217; block is called when a new message arrives from the browser. Since I needed to dynamically create new exchanges and queues I used a very amateurish system. The message sent from the browser arrives with the following parameters in the JSON format</p>
<p><strong> The following snippet is not a part of AMQP but a feature borrowed from XMPP to get my application working </strong></p>
<pre>{status:'status', username:'someusername', roomname:'someroomname', message:'somemessage'}</pre>
<p>Status could have values from ['status', 'message', 'presence']<br />
Username contains the &#8216;current_user&#8217; name<br />
Roomname indicates the &#8216;room&#8217; the user has been logged into.</p>
<p>Status messages indicate that some kind of chore needs to be performed like subscribing to queues, binding exchanges etc.</p>
<p>Messages indicate that the message needs to be pushed to an exchange. When a message is published to an exchange, subscribing queues push the message to the browser using Websockets.</p>
<p>Presence messages indicate the users presence.</p>
<p><strong> Why the entire application was a failure </strong></p>
<p>The most important aspect while using AMQP is identifying the type of exchanges needed. In this case my assumptions on identifying rooms to be exchanges and users to have individual queues proved to be the reason for failure.</p>
<p>The reason why this assumption would fail is if a user queue would bind to multiple exchanges with each user having a unique queue assigned to him, a simple <a href="http://rubydoc.info/github/ruby-amqp/amqp/master/file/docs/Exchanges.textile#Fanout_exchanges">fanout</a> exchange would push messages from different rooms to the user&#8217;s logged in chat room which is not what we want. This way users would end up receiving messages that are not relevant.</p>
<p>A ideal approach would have multiple users subscribe to a room (assumed to be the queue in this case) via a <a href="http://rubydoc.info/github/ruby-amqp/amqp/master/file/docs/Exchanges.textile#Topic_exchanges">topic exchange</a>.</p>
<p>I also believe that it would be logical to dynamically create queues and exchanges using the EM.periodic timer to check a NoSQL database or key-value store for new requests rather than using Websockets.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sappsdreams.wordpress.com/171/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sappsdreams.wordpress.com/171/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sappsdreams.wordpress.com/171/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sappsdreams.wordpress.com/171/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sappsdreams.wordpress.com/171/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sappsdreams.wordpress.com/171/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sappsdreams.wordpress.com/171/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sappsdreams.wordpress.com/171/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sappsdreams.wordpress.com/171/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sappsdreams.wordpress.com/171/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sappsdreams.wordpress.com/171/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sappsdreams.wordpress.com/171/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sappsdreams.wordpress.com/171/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sappsdreams.wordpress.com/171/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sappsdreams.wordpress.com&amp;blog=11568774&amp;post=171&amp;subd=sappsdreams&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://sappsdreams.wordpress.com/2011/07/21/rabbitmq-and-rails-why-my-chat-application-failed/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/5b1eca209b1b486ff1732ffb7c745f0e?s=96&#38;d=monsterid&#38;r=G" medium="image">
			<media:title type="html">siddharthravichandran</media:title>
		</media:content>
	</item>
		<item>
		<title>Incompatible character encodings error in ruby 1.9</title>
		<link>http://sappsdreams.wordpress.com/2011/07/21/incompatible-character-encodings-error-in-ruby-1-9/</link>
		<comments>http://sappsdreams.wordpress.com/2011/07/21/incompatible-character-encodings-error-in-ruby-1-9/#comments</comments>
		<pubDate>Thu, 21 Jul 2011 10:25:52 +0000</pubDate>
		<dc:creator>Rans</dc:creator>
				<category><![CDATA[rails]]></category>
		<category><![CDATA[Encoding]]></category>
		<category><![CDATA[rchardet19]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[UTF-8]]></category>

		<guid isPermaLink="false">http://sappsdreams.wordpress.com/?p=160</guid>
		<description><![CDATA[Problem: Incompatible character encodings error while importing csv files in ruby 1.9 which have data in multiple languages. I am using rails 3 and ruby 1.9.2 in my application. While importing/parsing the CSV, I get an error &#8220;Incompatible character encodings: ASCII-8bit and UTF-8&#8243;. I quickly checked my database encoding, it was UTF-8 only and also <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sappsdreams.wordpress.com&amp;blog=11568774&amp;post=160&amp;subd=sappsdreams&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><b>Problem:</b><br />
<em><strong>Incompatible character encodings error while importing csv files in ruby 1.9 which have data in multiple languages.</strong></em></p>
<p>I am using rails 3 and ruby 1.9.2 in my application.<br />
While importing/parsing the CSV, I get an error &#8220;Incompatible character encodings: ASCII-8bit and UTF-8&#8243;.<br />
I quickly checked my database encoding, it was UTF-8 only and also in application.rb, I had </p>
<pre> 'config.encoding = "utf-8"' </pre>
<p> I had no idea what was going wrong&#8230;</p>
<p>After googling a bit, I found that couple of posts mentioned some workarounds for this issue, so I tried:</p>
<pre>
# encoding: utf-8 =&gt; in my class
# and
"hello ümlaut".force_encoding("UTF-8")
</pre>
<p>That output was </p>
<pre>
"hello ?mlat"
</pre>
<p>With this the Error was fixed (no rails error) but the converted string value is incorrect. It was working correctly in some places but not everywhere.</p>
<p>I searched a bit more and then I found that the sequence of bytes that represent an “ü” is different in different encodings and could not be recognized in UTF-8, so such characters were replaced with a “?”.</p>
<p><b>Solution:</b><br />
  We have to find out that the original encoding of the string and then convert to UTF-8. To achieve this in ruby 1.9.2, we can&#8217;t do it directly.<br />
  so, we need to install the gem <strong>&#8216;rchardet19&#8242;</strong><br />
  and then add this to the top of your class, <strong>require &#8216;iconv&#8217;</strong></p>
<p>  now,</p>
<pre>
  data = CharDet.detect(value)
  puts "Detected encoding- #{data.encoding}"
</pre>
<p>  and,</p>
<pre>
  value = data.confidence &gt; 0.6 ? Iconv.iconv("UTF-8", data.encoding, value) : value
</pre>
<p>  we are just converting to UTF-8 from the detected encoding.</p>
<p>  This fixes the issue.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sappsdreams.wordpress.com/160/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sappsdreams.wordpress.com/160/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sappsdreams.wordpress.com/160/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sappsdreams.wordpress.com/160/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sappsdreams.wordpress.com/160/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sappsdreams.wordpress.com/160/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sappsdreams.wordpress.com/160/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sappsdreams.wordpress.com/160/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sappsdreams.wordpress.com/160/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sappsdreams.wordpress.com/160/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sappsdreams.wordpress.com/160/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sappsdreams.wordpress.com/160/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sappsdreams.wordpress.com/160/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sappsdreams.wordpress.com/160/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sappsdreams.wordpress.com&amp;blog=11568774&amp;post=160&amp;subd=sappsdreams&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://sappsdreams.wordpress.com/2011/07/21/incompatible-character-encodings-error-in-ruby-1-9/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d968f09778657cdb1d7c0d58939834f8?s=96&#38;d=monsterid&#38;r=G" medium="image">
			<media:title type="html">rans</media:title>
		</media:content>
	</item>
		<item>
		<title>Passing parameters to HTML page loaded in a webView</title>
		<link>http://sappsdreams.wordpress.com/2011/04/11/passing-parameters-to-html-page-loaded-in-a-webview/</link>
		<comments>http://sappsdreams.wordpress.com/2011/04/11/passing-parameters-to-html-page-loaded-in-a-webview/#comments</comments>
		<pubDate>Mon, 11 Apr 2011 10:34:58 +0000</pubDate>
		<dc:creator>Sushma</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[android]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[Titanium]]></category>

		<guid isPermaLink="false">http://sappsdreams.wordpress.com/?p=148</guid>
		<description><![CDATA[I have been working on Titanium for last few days. As a web developer I found it very interesting to develop an iphone and Android app without knowing objectiveC or Java. One of the problem I faced was to pass parameter to HTML page loaded in a webView. In this post I will show how <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sappsdreams.wordpress.com&amp;blog=11568774&amp;post=148&amp;subd=sappsdreams&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I have been working on Titanium for last few days. As a web developer I found it very interesting to develop an iphone and Android app without knowing objectiveC or Java.<br />
One of the problem I faced was to pass parameter to HTML page loaded in a webView.<br />
In this post I will show how to make javascript variable accessible to HTML page opened in a webView.</p>
<p>In the following code, the JS variable &#8216;message&#8217; is initialized on &#8216;beforeload&#8217; event of the webview in webview.evalJS() method which will invoke the javascript code inside the context of the webview.</p>
<p><strong>app.js</strong><br />
<code><br />
var window = Titanium.UI.createWindow();<br />
var webview = Titanium.UI.createWebView({url:'message.html'});<br />
window.add(webview);<br />
var str = "Hello world!";<br />
webview.addEventListener('beforeload',function(e)<br />
{<br />
webview.evalJS("var message='"+ str+"';");<br />
});<br />
window.open();<br />
</code><br />
As the JS &#8216;message&#8217; variable is assigned before loading the webview, it is also available in the html page.</p>
<p><strong>message.html</strong><br />
<code><br />
&lt;html&gt;<br />
&lt;head&gt;<br />
&lt;script type="text/javascript"&gt;<br />
alert(message);<br />
&lt;/script&gt;<br />
&lt;/head&gt;<br />
&lt;body&gt;<br />
&lt;/body&gt;<br />
&lt;/html&gt;<br />
</code></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sappsdreams.wordpress.com/148/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sappsdreams.wordpress.com/148/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sappsdreams.wordpress.com/148/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sappsdreams.wordpress.com/148/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sappsdreams.wordpress.com/148/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sappsdreams.wordpress.com/148/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sappsdreams.wordpress.com/148/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sappsdreams.wordpress.com/148/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sappsdreams.wordpress.com/148/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sappsdreams.wordpress.com/148/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sappsdreams.wordpress.com/148/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sappsdreams.wordpress.com/148/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sappsdreams.wordpress.com/148/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sappsdreams.wordpress.com/148/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sappsdreams.wordpress.com&amp;blog=11568774&amp;post=148&amp;subd=sappsdreams&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://sappsdreams.wordpress.com/2011/04/11/passing-parameters-to-html-page-loaded-in-a-webview/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/c932fb75237bc90316af7dd729e96127?s=96&#38;d=monsterid&#38;r=G" medium="image">
			<media:title type="html">sush</media:title>
		</media:content>
	</item>
		<item>
		<title>Tips for faster loading web sites(Optimizing page load time)</title>
		<link>http://sappsdreams.wordpress.com/2011/02/18/tips-for-faster-loading-web-sitesoptimizing-page-load-time/</link>
		<comments>http://sappsdreams.wordpress.com/2011/02/18/tips-for-faster-loading-web-sitesoptimizing-page-load-time/#comments</comments>
		<pubDate>Fri, 18 Feb 2011 14:05:27 +0000</pubDate>
		<dc:creator>Rans</dc:creator>
				<category><![CDATA[Optimization]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[Tips]]></category>

		<guid isPermaLink="false">http://sappsdreams.wordpress.com/?p=130</guid>
		<description><![CDATA[1) Make fewer HTTP request(Js, CSS &#38; image) Most of the end-user response time is spent on the front-end and tied up in downloading all the components in the page like images, stylesheets, scripts, etc. Reducing the number of components in turn reduces the number of HTTP requests. a) Combined files =&#62; its a way <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sappsdreams.wordpress.com&amp;blog=11568774&amp;post=130&amp;subd=sappsdreams&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<pre style="white-space:pre-wrap;"><strong>1) Make fewer HTTP request(Js, CSS &amp; image)</strong>
     Most of the end-user response time is spent on the front-end and tied up in downloading all the components in the page like images, stylesheets, scripts, etc. Reducing the number of components in turn reduces the number of HTTP requests.
     a) Combined files =&gt; its a way to reduce the number of HTTP requests by combining all files into a single file. ex: js &amp; css
         In our rails app, we used bundle_fu(<a href="https://github.com/timcharper/bundle-fu">https://github.com/timcharper/bundle-fu</a>). Its used to bundle all your assets very easy. It can speed your load time up around 50%.

         Example put the following around your stylesheets/javascripts:
         -bundle :name =&gt; "default_bundle" do
           = javascript_include_tag "http://w.sharethis.com/button/buttons.js"
           = stylesheet_link_tag 'jquery-ui', 'auto_complete/token-input.css'
           = javascript_include_tag 'jquery-1.4.2.js', 'jquery-ui.js', 'auto_complete/jquery.tokeninput.js', 'auto_complete/setup.js', 'underscore.js', 'date.js', 'cal.js', 'application.js', 'time_picker/jquery.timePicker.js', 'ajax_pagination.js'
           = stylesheet_link_tag 'compiled/certification.css','compiled/error.css', 'compiled/elements.css', 'compiled/messages.css', 'compiled/calendar.css', 'compiled/common.css', 'time_picker/timePicker.css', :media =&gt; 'screen, projection'
           = stylesheet_link_tag 'compiled/print.css', :media =&gt; 'print'
           = javascript_include_tag "markerCluster/jsapi", "markerCluster/map.js", "markerCluster/markerclusterer.js", "jquery-jtemplates"

     b) CSS sprites     =&gt; Its used to reducing the number of image requests. Combine your background images into a single image and use the CSS background-image and background-position properties to display the desired image segment.
﻿
<strong>2) Avoid empty src or href</strong>
     You may expect a browser to do nothing. But most browsers makes a request to server(sending a large amount of unexpected traffic).

<strong>3) Compress components with gzip﻿</strong>
     This is used to reduce their file size over the wire by approximately 70%. This can be set up using your Apache(needs Apache 2, mod_deflate, mod_headers and access to server config) or Nginx config.

     example for apache(in the server config file):
     # Compress some text file types
     AddOutputFilterByType DEFLATE text/html text/css text/xml application/x-javascript

     # Deactivate compression for buggy browsers
     BrowserMatch ^Mozilla/4 gzip-only-text/html
     BrowserMatch ^Mozilla/4\.0[678] no-gzip
     BrowserMatch \bMSIE !no-gzip !gzip-only-text/html

     # Set header information for proxies
     Header append Vary User-Agent

<strong>4) Add expires headers for JS &amp; CSS</strong>
     There are two aspects to this rule:
     a) For static components : implement "Never expire" policy by setting far future Expires header
     b) For dynamic components: use an appropriate Cache-Control header to help the browser with conditional requests

     This means that A first-time visitor to your page may have to make several HTTP requests, but by using the Expires header you make those components cacheable. The next request, Browser use a cache to reduce the number and size of HTTP requests, making web pages load faster. A web server uses the Expires header in the HTTP response to tell the client how long a component can be cached. However, it creates an additional problem too. The problem is what happens if you change these files? The browser will be stuck with the old files. The solution is to send a last modified timestamp with your requests (Ex: "&lt;img src='/images/rails.png?84392578943' /&gt;"). Now your browser will know to ask for the file again. The "timestamp" is the default behavior of rails.

<strong>5) Put CSS at top</strong>
     Yahoo discovered that moving stylesheets to the document HEAD makes pages appear to be loading faster. This is because putting stylesheets in the HEAD allows the page to render progressively.

<strong>6) Minify JS &amp; CSS</strong>
     Minification is the practice of removing unnecessary characters from code like comments and unneeded white space characters (space, newline, tab and etc). This improves response time performance &amp; load times. You can use JSMin and YUI Compressor for minifying your JS code. Also some plugins are there, please check it here: <a href="https://github.com/sinefunc/sinatra-minify">https://github.com/sinefunc/sinatra-minify</a> and <a href="https://github.com/ericbarnes/ci-minify">https://github.com/ericbarnes/ci-minify</a>.

please check the screenshot. Right now, as you can see, I have made it Yslow grade from "F" to "B" very easily. I am sure, we can easily get grade "A" too... We need some support from the server side regarding "Add expires header" and "Use Cookie-free Domains for Components". I have requested engineyard(hosting server) for the same. Waiting for the reply from them. By next week, it will turn into grade "A".

and also found one good link from rubyquicktips. Benchmark.ms is very nice. its used to track how long some bit of code takes to process. please check it here: <a href="http://rubyquicktips.tumblr.com/post/2838217166/benchmark-ms-rails-you-sneaky-devil">http://rubyquicktips.tumblr.com/post/2838217166/benchmark-ms-rails-you-sneaky-devil</a>

Before optimization:
<a href="http://ranjithonrails.files.wordpress.com/2011/02/screenshot.png"><img class="alignnone size-medium wp-image-42" title="before_optimization" src="http://ranjithonrails.files.wordpress.com/2011/02/screenshot.png?w=300&#038;h=180" alt="" width="300" height="180" /></a>

After optimization:
<a href="http://ranjithonrails.files.wordpress.com/2011/02/picture-4.png"><img class="alignnone size-medium wp-image-43" title="after_optimization" src="http://ranjithonrails.files.wordpress.com/2011/02/picture-4.png?w=300&#038;h=150" alt="" width="300" height="150" /></a></pre>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sappsdreams.wordpress.com/130/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sappsdreams.wordpress.com/130/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sappsdreams.wordpress.com/130/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sappsdreams.wordpress.com/130/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sappsdreams.wordpress.com/130/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sappsdreams.wordpress.com/130/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sappsdreams.wordpress.com/130/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sappsdreams.wordpress.com/130/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sappsdreams.wordpress.com/130/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sappsdreams.wordpress.com/130/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sappsdreams.wordpress.com/130/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sappsdreams.wordpress.com/130/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sappsdreams.wordpress.com/130/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sappsdreams.wordpress.com/130/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sappsdreams.wordpress.com&amp;blog=11568774&amp;post=130&amp;subd=sappsdreams&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://sappsdreams.wordpress.com/2011/02/18/tips-for-faster-loading-web-sitesoptimizing-page-load-time/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d968f09778657cdb1d7c0d58939834f8?s=96&#38;d=monsterid&#38;r=G" medium="image">
			<media:title type="html">rans</media:title>
		</media:content>

		<media:content url="http://ranjithonrails.files.wordpress.com/2011/02/screenshot.png?w=300" medium="image">
			<media:title type="html">before_optimization</media:title>
		</media:content>

		<media:content url="http://ranjithonrails.files.wordpress.com/2011/02/picture-4.png?w=300" medium="image">
			<media:title type="html">after_optimization</media:title>
		</media:content>
	</item>
		<item>
		<title>Hoptracker &#8211; Part II</title>
		<link>http://sappsdreams.wordpress.com/2010/04/21/hoptracker-part-ii/</link>
		<comments>http://sappsdreams.wordpress.com/2010/04/21/hoptracker-part-ii/#comments</comments>
		<pubDate>Wed, 21 Apr 2010 10:15:53 +0000</pubDate>
		<dc:creator>hari4sapna</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[hoptoad]]></category>
		<category><![CDATA[hoptracker]]></category>
		<category><![CDATA[pivotal tracker]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[softwire]]></category>

		<guid isPermaLink="false">http://sappsdreams.wordpress.com/?p=109</guid>
		<description><![CDATA[Part II Step by Step guide to get hoptracker working for your app. Softwire Intro: Base app for Hoptracker which pulls errors from Hoptoad and adds them as bugs in Pivotal Tracker Project. It is still an alpha stage app with very basic user interface, no administration module yet, so all details of projects available <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sappsdreams.wordpress.com&amp;blog=11568774&amp;post=109&amp;subd=sappsdreams&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><strong>Part II</strong></p>
<p>Step by Step guide to get hoptracker working for your app.</p>
<p><strong>Softwire Intro:</strong><br />
Base app for Hoptracker which pulls errors from Hoptoad and adds them as bugs in Pivotal Tracker Project. It is still an alpha stage app with very basic user interface, no administration module yet, so all details of projects available for all, essentially for internal use as of now.</p>
<p><strong>Steps in softwire:</strong><br />
1. Goto http://softwire.sapps.in</p>
<p>2. Click on New app. This will ask you to provide app related details:<br />
a) name of your app<br />
b) Hoptoad app name (.hoptoadapp.com : Its the  portion that softwire is interested in.)<br />
c) Hoptoad Auth Key (Get this from hoptoadapp.com)<br />
d) Pivotal Tracker Project Id<br />
e) Pivotal Tracker Auth Key (Again log into Pivotal to get this)</p>
<p>3. Create the app and see it listed in the listings page. Note the &#8220;Id&#8221; field of your app (as you will later use it to configure the hoptracker in your app). Bear with me at this point in time for atleast the Id should have been hashed. The next release will have a better approach to this.</p>
<p>Thats it, you are done with the registration of your app with softwire and it is now ready to do the bug movement provided it is notified to do so. This notification happens via hoptracker plugin in your app. Lets see how that is done in a bit.</p>
<p><strong>Hoptracker Intro:</strong><br />
A Rack based app to log hoptoad errors onto Pivotal Tracker. This plugin communicates with softwire (http://softwire.sapps.in) application and notifies whenever an exception occurs. Softwire, then pulls the error from Hoptoad and adds it as a bug in Pivotal Tracker.</p>
<p><strong>Steps in hoptracker</strong><br />
1. Drop the plugin in your projects&#8217; vendor/plugins folder (script/plugin install git@github.com:sapnasolutions/hoptracker.git).<br />
2. In the environment.rb add the following line:<br />
config.middleware.use &#8216;Hoptracker::Rack&#8217;<br />
3. Create hoptracker.rb file in your initializers and drop in this line:<br />
Hoptracker.app_id= (This is the Id that you got as part of app creation on softwire.)<br />
4. Restart your server and start getting your hoptoad errors onto your pivotal tracker project.</p>
<p>Enjoy!</p>
<p>P.S: This is still a work in progress project and does not contain an admin interface nor does it have any test cases! <img src='http://s0.wp.com/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' />  . Contributions are welcome and appreciated!</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sappsdreams.wordpress.com/109/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sappsdreams.wordpress.com/109/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sappsdreams.wordpress.com/109/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sappsdreams.wordpress.com/109/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sappsdreams.wordpress.com/109/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sappsdreams.wordpress.com/109/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sappsdreams.wordpress.com/109/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sappsdreams.wordpress.com/109/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sappsdreams.wordpress.com/109/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sappsdreams.wordpress.com/109/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sappsdreams.wordpress.com/109/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sappsdreams.wordpress.com/109/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sappsdreams.wordpress.com/109/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sappsdreams.wordpress.com/109/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sappsdreams.wordpress.com&amp;blog=11568774&amp;post=109&amp;subd=sappsdreams&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://sappsdreams.wordpress.com/2010/04/21/hoptracker-part-ii/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/cd762338e899b1062940df172e457a44?s=96&#38;d=monsterid&#38;r=G" medium="image">
			<media:title type="html">hari4sapna</media:title>
		</media:content>
	</item>
		<item>
		<title>Hoptracker &#8211; Move your hoptoad errors to pivotal tracker</title>
		<link>http://sappsdreams.wordpress.com/2010/04/21/hoptracker-move-your-hoptoad-errors-to-pivotal-tracker/</link>
		<comments>http://sappsdreams.wordpress.com/2010/04/21/hoptracker-move-your-hoptoad-errors-to-pivotal-tracker/#comments</comments>
		<pubDate>Wed, 21 Apr 2010 05:09:38 +0000</pubDate>
		<dc:creator>hari4sapna</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[delayed_job]]></category>
		<category><![CDATA[hoptoad]]></category>
		<category><![CDATA[pivotal tracker]]></category>
		<category><![CDATA[rack]]></category>
		<category><![CDATA[saas]]></category>

		<guid isPermaLink="false">http://sappsdreams.wordpress.com/?p=106</guid>
		<description><![CDATA[Part I Background: At Sapna, we use: 1) Pivotal Tracker for project management where all the stories/ chores and bugs go in. 2) And we use Hoptoad to notify errors in the app. The problem: Once an error comes to the mail box or we check it out at app.hoptoadapp.com, one needed to copy paste <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sappsdreams.wordpress.com&amp;blog=11568774&amp;post=106&amp;subd=sappsdreams&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><strong>Part I</strong></p>
<p><strong>Background:</strong><br />
At Sapna, we use:<br />
1) Pivotal Tracker for project management where  all the stories/ chores and bugs go in.<br />
2) And we use Hoptoad to notify errors in the app.</p>
<p><strong>The problem:</strong><br />
Once an error comes to the mail box or we check it out at app.hoptoadapp.com, one needed to copy paste the error into Pivotal Tracker so as to track the error to completion. And this is manual job of copy/paste and sometimes, one tends to forget to the same. So we saw a need to automatically move errors from hoptoad into pivotal tracker. As of now Hoptoad support adding tickets to lighthouse projects for a price (check:<a href="http://hoptoadapp.com/pages/home"> hoptoadapp.com</a>). So this got us started on <a href="https://github.com/sapnasolutions/hoptracker">Hoptracker</a>.</p>
<p><strong>Initial design:</strong><br />
We wanted to write this rack app (hoptracker) which checks the response headers to see for errors and if found:<br />
1. Check hoptoad for latest errors<br />
2. Check pivotal tracker for the list of hoptoad errors (we add the hoptoad error id as part of the story/bug name). Any delta that it results in.<br />
3. We add them to Pivotal tracker.</p>
<p>This would work fine but the problem here is that for every error, all the 3 steps would usually run and then the response would be sent to the user, which potentially will slow down the app, which is not desired.</p>
<p><strong>Alternate design considerations:</strong><br />
If we moved these steps to a background process and not interfere with the response, then that would be ideal. So we planned to use <a href="http://github.com/tobi/delayed_job">delayed_job</a> to do the background processing of the same. Then again, the plugin hoptracker will come with a dependency that every app which would use hoptracker needs to have delayed_job gem installed and the table created. A dependency like this, we did not want to inject.</p>
<p>Moving forward, we thought it would be right to move these steps to a small app which is doing the work for all our apps, more like a Saas. Thus softwire was born. The negatives of such an approach is that, we now need to have an admin interface in softwire where apps need to be registered with the necessary (hoptoad/ pivotal tracker) details. But then we voted that this is a much cleaner approach and hence built it.</p>
<p><strong>How did we solve:</strong><br />
<strong>Hoptracker:</strong><br />
The hoptracker plugin which still is a rack app, on receipt of an error just notifies <a href="http://softwire.sapps.in/">softwire</a> of the error.</p>
<p><strong>Softwire:</strong><br />
Each app as part of using the hoptracker plugin, needs to first register with softwire and provide app related (hoptoad, pivotal tracker) details. Softwire then produces a unique hash which needs to be provided to the hoptracker initializer in ones app. Please checkout the readme of <a href="https://github.com/sapnasolutions/hoptracker">hoptracker</a> and <a href="https://github.com/sapnasolutions/softwire">softwire</a>) for further details or read up <a href="http://sappsdreams.wordpress.com/2010/04/21/hoptracker-part-ii/">part II</a> for a step by step usage of hoptracker/softwire.</p>
<p>Once the above process is done. Softwire maintains a local database of all the hoptoad errors already logged into pivotal tracker. Hence the second step (&#8220;Check pivotal tracker for the list of hoptoad errors (we add the hoptoad error id as part of the story/bug name). Any delta that it results in.&#8221;) is avoided by looking into the local database of errors and the delta set of errors are built locally. And then the third step of insertion of new errors into pivotal tracker happens.</p>
<p>Checkout <a href="http://sappsdreams.wordpress.com/2010/04/21/hoptracker-part-ii/">Part II</a> for a step by step tutorial in using hoptracker and softwire.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sappsdreams.wordpress.com/106/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sappsdreams.wordpress.com/106/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sappsdreams.wordpress.com/106/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sappsdreams.wordpress.com/106/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sappsdreams.wordpress.com/106/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sappsdreams.wordpress.com/106/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sappsdreams.wordpress.com/106/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sappsdreams.wordpress.com/106/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sappsdreams.wordpress.com/106/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sappsdreams.wordpress.com/106/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sappsdreams.wordpress.com/106/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sappsdreams.wordpress.com/106/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sappsdreams.wordpress.com/106/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sappsdreams.wordpress.com/106/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sappsdreams.wordpress.com&amp;blog=11568774&amp;post=106&amp;subd=sappsdreams&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://sappsdreams.wordpress.com/2010/04/21/hoptracker-move-your-hoptoad-errors-to-pivotal-tracker/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/cd762338e899b1062940df172e457a44?s=96&#38;d=monsterid&#38;r=G" medium="image">
			<media:title type="html">hari4sapna</media:title>
		</media:content>
	</item>
		<item>
		<title>Ruby on Rails plugin for Facebook style selector</title>
		<link>http://sappsdreams.wordpress.com/2010/03/03/ruby-on-rails-plugin-for-facebook-style-selector/</link>
		<comments>http://sappsdreams.wordpress.com/2010/03/03/ruby-on-rails-plugin-for-facebook-style-selector/#comments</comments>
		<pubDate>Wed, 03 Mar 2010 06:34:12 +0000</pubDate>
		<dc:creator>Sushma</dc:creator>
				<category><![CDATA[helper]]></category>
		<category><![CDATA[plugins]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[facebook]]></category>
		<category><![CDATA[friend selector]]></category>
		<category><![CDATA[plugin]]></category>

		<guid isPermaLink="false">http://sappsdreams.wordpress.com/?p=93</guid>
		<description><![CDATA[Awesome Selector (Ruby on Rails plugin) For a recent project we needed to show list of users with some basic information and with multiple select options, just like  facebook friends selector for selecting friends, groups, projects etc&#8230; This is generally a requirement in most of the social networking projects, with minor changes here and there. <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sappsdreams.wordpress.com&amp;blog=11568774&amp;post=93&amp;subd=sappsdreams&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<div id=":d5">
<div><strong>Awesome Selector (Ruby on Rails plugin)<br />
</strong></div>
<div><strong><br />
</strong></div>
<p>For a recent project we needed to show list of users with some basic information and with multiple select options, just like  facebook friends selector for selecting friends, groups, projects etc&#8230;</p>
<p>This is generally a requirement in most of the social networking projects, with minor changes here and there.</p>
<p>So I decided to build a plug-in with some easy configuration options, which should work independent of the type of object to be shown in the list.</p>
<p>It&#8217;s a nice FB like user interface to select multiple elements. We can configure it easily by some parameters as described below.</p>
<div>The features I&#8217;d like to highlight are:</div>
<div>
<ol>
<li>FB like user interface.</li>
<li>Word filter.</li>
<li> Templates.</li>
<li>Auto complete.</li>
<li>Effortless integration and easy to customize.</li>
</ol>
</div>
<p>For more information on setup and download <a href="http://github.com/sushma/awesome_selector" target="_blank">click here</a></p>
<div>You just need to call the helper with required parameters, on the page where you want the list to be displayed</div>
<pre>
&lt;%=  awesome_selector  :objects =&gt; @users,
:field_names =&gt; ["name","email"],
:form_post_url =&gt; users_path,
:template =&gt; "template_1",
:auto_complete_field_name =&gt; "name",
:image_url =&gt; "avatar_photo_url(:thumb)",
:max_selection_limit =&gt; [5, 'Sorry, you can not select more users.'] %&gt;
</pre>
<p>Currently there are two templates available &#8216;template_1&#8242; and &#8216;template_2&#8242;. An example of the generated list is as follows:</p>
<div><strong>template_1</strong></div>
<div><a href="http://sushmapandey.files.wordpress.com/2010/03/template_1.png"><img title="template_1" src="http://sushmapandey.files.wordpress.com/2010/03/template_1.png?w=460&#038;h=194" alt="" width="460" height="194" /></a></div>
<div><strong>template_2</strong></div>
<div><a href="http://sushmapandey.files.wordpress.com/2010/03/template_2.png"><img title="template_2" src="http://sushmapandey.files.wordpress.com/2010/03/template_2.png?w=460&#038;h=197" alt="" width="460" height="197" /></a></div>
<p>After submitting the form, selected object ids are available as params[:selected_element_ids] separated by comma.</p>
<p>Thanks to the following for their kind contribution to the JS libraries used in this plugin.</p>
<div>
<ol>
<li><a href="http://www.devbridge.com/projects/autocomplete/jquery/" target="_blank">Autocomplete</a> by Tomas Kirda<a href="http://www.fluidbyte.net/index.php?view=jquery-filter-plugin" target="_blank"></a></li>
<li><a href="http://www.fluidbyte.net/index.php?view=jquery-filter-plugin" target="_blank">jquery-filter-plugin</a> by Kent Safranski</li>
</ol>
</div>
</div>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sappsdreams.wordpress.com/93/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sappsdreams.wordpress.com/93/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sappsdreams.wordpress.com/93/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sappsdreams.wordpress.com/93/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sappsdreams.wordpress.com/93/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sappsdreams.wordpress.com/93/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sappsdreams.wordpress.com/93/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sappsdreams.wordpress.com/93/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sappsdreams.wordpress.com/93/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sappsdreams.wordpress.com/93/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sappsdreams.wordpress.com/93/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sappsdreams.wordpress.com/93/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sappsdreams.wordpress.com/93/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sappsdreams.wordpress.com/93/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sappsdreams.wordpress.com&amp;blog=11568774&amp;post=93&amp;subd=sappsdreams&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://sappsdreams.wordpress.com/2010/03/03/ruby-on-rails-plugin-for-facebook-style-selector/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/c932fb75237bc90316af7dd729e96127?s=96&#38;d=monsterid&#38;r=G" medium="image">
			<media:title type="html">sush</media:title>
		</media:content>

		<media:content url="http://sushmapandey.files.wordpress.com/2010/03/template_1.png" medium="image">
			<media:title type="html">template_1</media:title>
		</media:content>

		<media:content url="http://sushmapandey.files.wordpress.com/2010/03/template_2.png" medium="image">
			<media:title type="html">template_2</media:title>
		</media:content>
	</item>
		<item>
		<title>Suggested tools for DB optimization</title>
		<link>http://sappsdreams.wordpress.com/2010/02/19/suggested-tools-for-db-optimization/</link>
		<comments>http://sappsdreams.wordpress.com/2010/02/19/suggested-tools-for-db-optimization/#comments</comments>
		<pubDate>Fri, 19 Feb 2010 08:11:10 +0000</pubDate>
		<dc:creator>Ritu</dc:creator>
				<category><![CDATA[databases]]></category>
		<category><![CDATA[Optimization]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[bullet]]></category>
		<category><![CDATA[slim-scrooge]]></category>

		<guid isPermaLink="false">http://sappsdreams.wordpress.com/?p=84</guid>
		<description><![CDATA[In Sapna from long time we have been discussing about the tools we should use for better code and development. Extracted from the same discussion, I have written a post about what tools can be used in development phase to optimize our Rails apps on my blog. Just to save myself copy pasting the whole <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sappsdreams.wordpress.com&amp;blog=11568774&amp;post=84&amp;subd=sappsdreams&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>In Sapna from long time we have been discussing about the tools we should use for better code and development. Extracted from the same discussion, I have written a post about what tools can be used in development phase to optimize our Rails apps on my blog.</p>
<p>Just to save myself copy pasting the whole post, I am posting <a href="http://rituonrails.wordpress.com/2010/02/16/move-towards-optimization-now/">a link here</a>. Try and let me know your ideas on these tools.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sappsdreams.wordpress.com/84/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sappsdreams.wordpress.com/84/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sappsdreams.wordpress.com/84/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sappsdreams.wordpress.com/84/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sappsdreams.wordpress.com/84/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sappsdreams.wordpress.com/84/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sappsdreams.wordpress.com/84/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sappsdreams.wordpress.com/84/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sappsdreams.wordpress.com/84/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sappsdreams.wordpress.com/84/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sappsdreams.wordpress.com/84/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sappsdreams.wordpress.com/84/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sappsdreams.wordpress.com/84/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sappsdreams.wordpress.com/84/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sappsdreams.wordpress.com&amp;blog=11568774&amp;post=84&amp;subd=sappsdreams&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://sappsdreams.wordpress.com/2010/02/19/suggested-tools-for-db-optimization/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/40e6077783a81c2a780438d4e423464f?s=96&#38;d=monsterid&#38;r=G" medium="image">
			<media:title type="html">Ritz</media:title>
		</media:content>
	</item>
	</channel>
</rss>
