<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>Spritle's Blog</title>
	
	<link>http://www.spritle.com/blogs</link>
	<description>Distributed Agile Software Development</description>
	<lastBuildDate>Wed, 02 May 2012 11:13:42 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/Spritle" /><feedburner:info uri="spritle" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>Run RhoMobile Apps With XCode 4.3.2</title>
		<link>http://feedproxy.google.com/~r/Spritle/~3/dIH6_bZmf90/</link>
		<comments>http://www.spritle.com/blogs/2012/05/02/run-rhomobile-apps-with-xcode-4-3-2/#comments</comments>
		<pubDate>Wed, 02 May 2012 11:13:42 +0000</pubDate>
		<dc:creator>Balaji D Loganathan</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[rhodes]]></category>
		<category><![CDATA[rhomobile]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[xcode]]></category>

		<guid isPermaLink="false">http://www.spritle.com/blogs/?p=1928</guid>
		<description><![CDATA[Potential errors you may face when you run Rhodes application with XCode 4.3.2 and possible solutions for it. Potential errors and solutions: ERROR: invalid SDK in BUILD.YML ! iphonesimulator5.0 is NOT installed on this computer ! Suggestion: XCode 4.3.2 comes with iphonesimulator5.1 In build.yml change it like sdk: iphonesimulator5.1 Another good option is to install [...]]]></description>
			<content:encoded><![CDATA[<p>Potential errors you may face when you run Rhodes application with XCode 4.3.2 and possible solutions for it.<span id="more-1928"></span><br />
<strong>Potential errors and solutions:</strong></p>
<ol>
<li>
ERROR: invalid SDK in BUILD.YML !<br />
iphonesimulator5.0 is NOT installed on this computer !</p>
<blockquote><p><b>Suggestion</b>:<br />
XCode 4.3.2 comes with iphonesimulator5.1<br />
In build.yml change it like<br />
<code>sdk: iphonesimulator5.1</code><br />
Another good option is to install missing simulator via XCode-> Preferences -> Select Downloads tab and then install iOS 5.0 Simulator
 </p></blockquote>
</li>
<li>&#8230;/gems/rhodes-3.3.2/lib/build/jake.rb:297: command not found: /Developer/usr/bin/xcodebuild -version -sdk iphonesimulator5.1<br />
<blockquote><p><b>Suggestion</b>:<br />
 Older version of Rhodes iPhone rake tasks uses /Developer/usr/bin/xcodebuild path instead of /Applications/Xcode.app/Contents/Developer<br />
See the file [<a href="https://github.com/rhomobile/rhodes/blob/master/platform/iphone/rbuild/iphone.rake" target="_blank">/platform/iphone/rbuild/iphone.rake</a>] code &#8220;task :iphone&#8221; at line (around) 474.<br />
In your local gem installation change it to the path where actual xcodebuild is installed.<br />
You can use &#8220;which xcodebuild&#8221; to find the path.
 </p></blockquote>
</li>
<li>0560b000 APP| App error: Expected argument 2 of type int, but got Fixnum 0<br />
	in SWIG method &#8216;set_view_notification&#8217;</p>
<blockquote><p><b>Temporary suggestion by Rhodes team</b>:<br />
Set the scheme &#8220;rhorunner&#8221; to use Release instead of Debug.<br />
See the screenshot.<br />
<a target="_new" href="http://www.spritle.com/blogs/wp-content/uploads/2012/05/Screen-Shot-2012-05-01-at-11.04.18-PM.png"><img src="http://www.spritle.com/blogs/wp-content/uploads/2012/05/Screen-Shot-2012-05-01-at-11.04.18-PM-300x186.png" alt="" title="Screen Shot 2012-05-01 at 11.04.18 PM" width="300" height="186" class="alignnone size-medium wp-image-1933" /></a>
</p></blockquote>
</li>
<li>I have both XCode 4.2 and XCode4.3.2 but can&#8217;t get XCode 4.3.2 is not working with Rhodes<br />
<blockquote><p><b>Suggestion</b>:<br />
You can use xcode-switch to select the xcodebuild that you want to use or modify the iphone.rake accordingly.
</p></blockquote>
</li>
</ol>
<img src="http://www.spritle.com/blogs/wp-content/plugins/pixelstats/trackingpixel.php?post_id=1928&amp;ts=1335957256" style="display:none;" alt="pixelstats trackingpixel"/><img src="http://feeds.feedburner.com/~r/Spritle/~4/dIH6_bZmf90" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.spritle.com/blogs/2012/05/02/run-rhomobile-apps-with-xcode-4-3-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.spritle.com/blogs/2012/05/02/run-rhomobile-apps-with-xcode-4-3-2/</feedburner:origLink></item>
		<item>
		<title>Open Native Maps App From A Rhodes Application</title>
		<link>http://feedproxy.google.com/~r/Spritle/~3/Jgs_OXhlxds/</link>
		<comments>http://www.spritle.com/blogs/2012/04/06/open-native-maps-app-from-a-rhodes-application/#comments</comments>
		<pubDate>Fri, 06 Apr 2012 02:30:29 +0000</pubDate>
		<dc:creator>Rajeswari K</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[rhodes]]></category>
		<category><![CDATA[rhomobile]]></category>
		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://www.spritle.com/blogs/?p=1877</guid>
		<description><![CDATA[Recently I tried Rhodes MapView in a sample application. While using rhodes we have situations to use native Maps application that is installed in Android/iPhone Mobile. To use the pre installed Maps application from Rhodes application, we can specify the map_params as follows: map_params = { :provider =&#62; &#039;Google&#039;, :settings =&#62; {:map_type =&#62; &#34;hybrid&#34;,:region =&#62; [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I tried Rhodes <strong>MapView</strong> in a sample application. While using rhodes we have situations to use native Maps application that is installed in Android/iPhone Mobile. To use the pre installed Maps application from Rhodes application, we can specify the map_params as follows:<span id="more-1877"></span></p>
<ul>
<pre class="brush: ruby">
map_params = {
     :provider =&gt; &#039;Google&#039;,
     :settings =&gt; {:map_type =&gt; &quot;hybrid&quot;,:region =&gt; [@params[&#039;latitude&#039;], @params[&#039;longitude&#039;], 0.2, 0.2],
                   :zoom_enabled =&gt; true,:scroll_enabled =&gt; true,
                   :api_key =&gt; &#039;Your api key&#039;},
     :annotations =&gt; [{:latitude =&gt; &#039;13.04708&#039;, :longitude =&gt; &#039;80.198243&#039;, :title =&gt; &quot;Click to see the direction&quot;, :subtitle =&gt; &quot;&quot;, :url =&gt; &quot;http://maps.google.com/maps?saddr=Chennai&amp;amp;daddr=Madurai&quot;}]
      }
MapView.create map_params
</pre>
</ul>
<p>When we click on the marker it opens the <strong>Google Maps</strong> application with the specified source and destination parameters with suggested routes between start address and end address.<br />
<a href="http://www.spritle.com/blogs/wp-content/uploads/2012/04/mapview.png"><img src="http://www.spritle.com/blogs/wp-content/uploads/2012/04/mapview-184x300.png" alt="" title="mapview" width="184" height="300" class="aligncenter size-medium wp-image-1897" /></a>&nbsp;&nbsp;<a href="http://www.spritle.com/blogs/wp-content/uploads/2012/04/mapview_with_marker.png"><img src="http://www.spritle.com/blogs/wp-content/uploads/2012/04/mapview_with_marker-189x300.png" alt="" title="mapview_with_marker" width="189" height="300" class="aligncenter size-medium wp-image-1900" /></a>&nbsp;&nbsp;<a href="http://www.spritle.com/blogs/wp-content/uploads/2012/04/directions.png"><img src="http://www.spritle.com/blogs/wp-content/uploads/2012/04/directions-190x300.png" alt="" title="directions" width="190" height="300" class="aligncenter size-medium wp-image-1904" /></a>&nbsp;&nbsp;<a href="http://www.spritle.com/blogs/wp-content/uploads/2012/04/direction_map.png"><img src="http://www.spritle.com/blogs/wp-content/uploads/2012/04/direction_map-191x300.png" alt="" title="direction_map" width="191" height="300" class="aligncenter size-medium wp-image-1906" /></a></p>
<p>This works fine for iPhone/iPad as well.</p>
<img src="http://www.spritle.com/blogs/wp-content/plugins/pixelstats/trackingpixel.php?post_id=1877&amp;ts=1335957256" style="display:none;" alt="pixelstats trackingpixel"/><img src="http://feeds.feedburner.com/~r/Spritle/~4/Jgs_OXhlxds" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.spritle.com/blogs/2012/04/06/open-native-maps-app-from-a-rhodes-application/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.spritle.com/blogs/2012/04/06/open-native-maps-app-from-a-rhodes-application/</feedburner:origLink></item>
		<item>
		<title>Create NFC Apps Using RhoMobile</title>
		<link>http://feedproxy.google.com/~r/Spritle/~3/q5Ze93B4vuM/</link>
		<comments>http://www.spritle.com/blogs/2012/04/04/create-nfc-apps-using-rhomobile/#comments</comments>
		<pubDate>Wed, 04 Apr 2012 12:01:14 +0000</pubDate>
		<dc:creator>Visnu Priya</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[Nfc Rhodes Rhomobile Ruby]]></category>
		<category><![CDATA[rhodes]]></category>
		<category><![CDATA[rhomobile]]></category>
		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://www.spritle.com/blogs/?p=1747</guid>
		<description><![CDATA[We just finished creating an NFC capable app using Rhomobile and here is our blog about it. By the way this is second blog do encourage me to write more. NFC &#8211; Near Field Communication used for short range wireless communication between two Mobiles with secured communication up to distances of 4 to 5 cm. [...]]]></description>
			<content:encoded><![CDATA[<p>We just finished creating an NFC capable app using Rhomobile and here is our blog about it. By the way this is second blog do encourage me to write more. <img src='http://www.spritle.com/blogs/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /><br />
<strong>NFC</strong> &#8211; <strong>Near Field Communication</strong> used for short range wireless communication between two Mobiles with secured communication up to distances of 4 to 5 cm. As per my knowledge NFC is supported in Android 2.3.3 and higher but mostly manufacturer specific. <span id="more-1747"></span><br />
NFC is commonly used in</p>
<blockquote><p>Mobile phones and PDAs<br />
Personal computers<br />
Check-out cash registers or &#8220;point-of-sale&#8221; equipment<br />
Turnstiles<br />
Vending machines<br />
Parking meters<br />
ATMs<br />
Applications around the office and house, e.g. garage doors</p></blockquote>
<p>If you got some ideas (good crazy ones) on other usages, then please share it a comment so that we can develop it using RhoMobile under open source license.</p>
<p>RhoMobile does support NFC capability, which includes:</p>
<ul>
<li>Reading NDEF data from an NFC tag</li>
<li>Beaming NDEF messages from one device to another</li>
</ul>
<p>You can also check the RhoMobile NFC documentation at  <a href="http://docs.rhomobile.com/rhodes/nfc" title="http://docs.rhomobile.com/rhodes/nfc" target="_blank">http://docs.rhomobile.com/rhodes/nfc</a></p>
<p>Let&#8217;s see how to <strong>develop</strong> NFC functionality based Rhodes application using Rhomobile.</p>
<p>1. Create sample rhodes app</p>
<pre class="brush: ruby">
$ rhodes app sample_app
$ cd sample_app
$ rhodes model nfc
</pre>
<p>2. Enable NFC in <strong>build.yml</strong></p>
<pre class="brush: ruby">
android:
  version: 2.3.3
  extensions:
  - nfc
</pre>
<p>3. In <strong>app/application.rb</strong> file, activate NFC on Android device.<br />
Rho::NFCManager.enable is used to enable the NFC capability on device.Rho::NFCManager.set_nfc_callback(call back url) is called when NFC device receives NFC event(peer to peer).Rho::NFCManager.set_nfc_tech_callback(call back url) is called for reading and writing NFC tag.Rho:NFCManager.perform_open_application_event method is enable the application to receive NFC when application is running in the background.</p>
<pre class="brush: ruby">
def on_nfc_app
   Rho::NFCManager.enable
   Rho::NFCManager.set_nfc_callback(&quot;set_nfc_callback url&quot;)
   Rho::NFCManager.set_nfc_tech_callback(&quot;nfc_tech_callback url&quot;)
   Rho::NFCManager.perform_open_application_event
end
</pre>
<p>4. In <strong>app/Nfc/nfc_controller.rb</strong><br />
Let&#8217;s see how to start peer to peer data exchange using Rho::NFCManager API.You can push NFC tag to another nfc enabled mobile.First you need payload message as follows,</p>
<pre class="brush: ruby">
Rho::NFCManager.make_payload_with_well_known_text(&quot;en&quot;, &quot;HELLO WORLD&quot;)
</pre>
<p>puts payload message into hash of records.Create hash of record Using Ndef (NFC data Exchange Format) as follows,</p>
<pre class="brush: ruby">
hash = {
      &#039;id&#039;      = [0],
      &#039;type&#039;    = Rho::NdefRecord:: RTD_TEXT,
      &#039;tnf&#039;     = Rho::NdefRecord::TNF_WELL_KNOWN,
      &#039;payload&#039; = payload
      }
</pre>
<p>Then use Rho::NFCManager.make_NdefRecord_from_hash(hash) method to create message record.Convert record array into message using following method</p>
<pre class="brush: ruby">
record= Rho::NFCManager.make_NdefMessage_from_array_of_NdefRecord(records)
</pre>
<p>Now we can push message using Rho::NFCManager.p2p_enable_foreground_nde_push(record) and when you want to stop message use Rho::NFCManager.p2p_disable_foreground_nde_push.</p>
<p>Sample screenshots taken from Android Emulator:<br />
<a href="http://www.spritle.com/blogs/wp-content/uploads/2012/03/nfc_start.png"><img class="alignnone size-medium wp-image-1787" src="http://www.spritle.com/blogs/wp-content/uploads/2012/03/nfc_start-191x300.png" alt="" width="191" height="300" /></a>&nbsp;&nbsp;&nbsp;<a href="http://www.spritle.com/blogs/wp-content/uploads/2012/03/nfc_push.png"><img class="alignnone size-medium wp-image-1786" src="http://www.spritle.com/blogs/wp-content/uploads/2012/03/nfc_push-191x300.png" alt="" width="191" height="300" /></a>&nbsp;&nbsp;&nbsp; <a href="http://www.spritle.com/blogs/wp-content/uploads/2012/03/nfc_stop.png"><img class="alignnone size-medium wp-image-1788" src="http://www.spritle.com/blogs/wp-content/uploads/2012/03/nfc_stop-191x300.png" alt="" width="191" height="300" /></a></p>
<p>We hope you liked this blog.<br />
Comments are welcome.</p>
<img src="http://www.spritle.com/blogs/wp-content/plugins/pixelstats/trackingpixel.php?post_id=1747&amp;ts=1335957256" style="display:none;" alt="pixelstats trackingpixel"/><img src="http://feeds.feedburner.com/~r/Spritle/~4/q5Ze93B4vuM" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.spritle.com/blogs/2012/04/04/create-nfc-apps-using-rhomobile/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.spritle.com/blogs/2012/04/04/create-nfc-apps-using-rhomobile/</feedburner:origLink></item>
		<item>
		<title>Consume SOAP webservice in rhoconnect</title>
		<link>http://feedproxy.google.com/~r/Spritle/~3/QFkT7tdcsYg/</link>
		<comments>http://www.spritle.com/blogs/2012/03/23/consume-soap-webservice-in-rhoconnect/#comments</comments>
		<pubDate>Thu, 22 Mar 2012 23:24:23 +0000</pubDate>
		<dc:creator>Dhepthi L Narasimhan</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[rhoconnect]]></category>
		<category><![CDATA[rhodes]]></category>
		<category><![CDATA[rhomobile]]></category>
		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://www.spritle.com/blogs/?p=1723</guid>
		<description><![CDATA[Rhomobile is cross-platform mobile framework to develop native application. The documentation for developing native app is nice. I recently tried consuming webservice using savon gem in rhoconnect. The most tricky part is to get input from rhodes application and use that as a parameters in rhoconnect webservice call. The gist of things needed for making [...]]]></description>
			<content:encoded><![CDATA[<p>Rhomobile is cross-platform mobile framework to develop native application. The <a href="http://docs.rhomobile.com/" target="_blank">documentation </a> for developing native app is nice. I recently tried consuming webservice using <strong>savon </strong>gem in rhoconnect. The most tricky part is to get input from rhodes application and use that as a parameters in rhoconnect webservice call. The gist of things needed for making SOAP call are<span id="more-1723"></span></p>
<ul>
<blockquote><p>
                   * Create a rhodes application<br />
		   * Pass the input parameters to rhoconnect application<br />
	           * Make a SOAP request in rhoconnect<br />
		   * Display the SOAP response in rhodes from rhoconnect
</p></blockquote>
</ul>
<p>We will use <a href="http://www.webservicex.net/length.asmx?WSDL" target="_blank">http://www.webservicex.net/length.asmx?WSDL</a> webservice to consume and manipulate response in rhoconnect. Let&#8217;s see how to make these things work. </p>
<p><strong>1. Sample Rhodes Application with search action</strong></p>
<ul>
 First we will create a rhodes app with model Unit as shown</p>
<pre class="brush: ruby">
	rhodes app rhodes-unit-webservice
	rhodes model Unit value,from,to
	</pre>
<p>	Enable <strong>sync </strong>in Model to connect to rhoconnect</p>
<pre class="brush: ruby">
	class Product
	enable :sync
	end
	</pre>
<p>	Pass inputs given by user to rhoconnect search action</p>
<pre class="brush: ruby">
	def search
         Unit.search(
            :from =&gt; &#039;search&#039;,
            :search_params =&gt; {
                :Value =&gt; @params[&#039;unit&#039;][&#039;value&#039;],
                :From =&gt; @params[&#039;unit&#039;][&#039;from&#039;],
                :To =&gt; @params[&#039;unit&#039;][&#039;to&#039;]
                 },
            :callback =&gt; url_for(:action =&gt; :search_callback),
            :callback_param =&gt; &quot;&quot;
        )
       render :action =&gt; :wait
      end
      </pre>
<p> We will implement search callback after SOAP request done in rhoconnect. Now let&#8217;s see what to do in rhoconenct</ul>
<p> <strong>2. Rhoconnect Application with SOAP webservice call in search action</strong></p>
<ul>
  We will create a basic rhoconnect application with Unit source adapter as shown</p>
<pre class="brush: ruby">
	  rhoconnect app rhoconnect-unit-webservice
	  rhoconnect source Unit
	  </pre>
<p>	  Add <strong>savon </strong>gem in <strong>Gemfile</strong></p>
<pre class="brush: ruby">
	  gem &#039;savon&#039;
	  </pre>
<p>	  Call ChangeLengthUnit method in webservice using savon</p>
<pre class="brush: ruby">
	  require &#039;savon&#039;
          @webservice_url = &quot;http://www.webservicex.net/length.asmx?WSDL&quot;
          client = Savon::Client.new(@webservice_url )
          data= client.request :change_length_unit do
          soap.body = {
           &quot;LengthValue&quot; =&gt; params[&quot;Value&quot;],
           &quot;fromLengthUnit&quot; =&gt; params[&quot;From&quot;],
           &quot;toLengthUnit&quot; =&gt; params[&quot;To&quot;]
            }
          end
          puts data.to_hash
	  </pre>
<p>	Here <strong>data.to_hash</strong> has the response of webservice called. We will get inputs for this SOAP request from rhodes search action. We can access those params in rhoconnect search action as</p>
<pre class="brush: ruby">
          def search(params)
	  # params - values from rhodes
	  end
	  </pre>
<p>	  We will assign the response of SOAP call to <strong>@result</strong> which will in turn stores in redis database as shown</p>
<pre class="brush: ruby">
	  puts data.to_hash
	  @result = data.to_hash
	  @result
          </pre>
</ul>
<p><strong>3. Display SOAP response from rhoconnect</strong></p>
<ul>
  Now response of SOAP request is stored in redis database. We can access it in search callback in rhodes as</p>
<pre class="brush: ruby">
	def search_callback
          status = @params[&quot;status&quot;]
          if status == &quot;complete&quot;
             data = Unit.find_all
             data.each do |val|
               Alert.show_popup(&quot;The Converted value is #{val.change_length_unit_result}&quot;)
             end
          WebView.navigate(url_for :action =&gt; :index)
         end
       end
       </pre>
<p> All values stored in rhoconnect can be retrieved through find query. This is how we consume SOAP webservice from rhodes through rhoconnect. </ul>
<p><strong>Some of the screenshots taken from Iphone Mobile</strong></p>
<p><a href="http://www.spritle.com/blogs/wp-content/uploads/2012/03/Screen-shot-2012-03-21-at-10.49.29-PM.jpg"><img src="http://www.spritle.com/blogs/wp-content/uploads/2012/03/Screen-shot-2012-03-21-at-10.49.29-PM-156x300.jpg" alt="" title="Screen shot 2012-03-21 at 10.49.29 PM" width="156" height="300" class="aligncenter size-medium wp-image-1732" /></a><a href="http://www.spritle.com/blogs/wp-content/uploads/2012/03/Screen-shot-2012-03-21-at-10.50.16-PM.jpg"><img src="http://www.spritle.com/blogs/wp-content/uploads/2012/03/Screen-shot-2012-03-21-at-10.50.16-PM-154x300.jpg" alt="" title="Screen shot 2012-03-21 at 10.50.16 PM" width="154" height="300" class="aligncenter size-medium wp-image-1734" /></a><a href="http://www.spritle.com/blogs/wp-content/uploads/2012/03/Screen-shot-2012-03-21-at-10.50.30-PM.jpg"><img src="http://www.spritle.com/blogs/wp-content/uploads/2012/03/Screen-shot-2012-03-21-at-10.50.30-PM-157x300.jpg" alt="" title="Screen shot 2012-03-21 at 10.50.30 PM" width="157" height="300" class="aligncenter size-medium wp-image-1735" /></a><a href="http://www.spritle.com/blogs/wp-content/uploads/2012/03/Screen-shot-2012-03-21-at-10.50.45-PM.jpg"><img src="http://www.spritle.com/blogs/wp-content/uploads/2012/03/Screen-shot-2012-03-21-at-10.50.45-PM-159x300.jpg" alt="" title="Screen shot 2012-03-21 at 10.50.45 PM" width="159" height="300" class="aligncenter size-medium wp-image-1736" /></a></p>
<p>I hope this blog will be helpful for making SOAP request in rhomobile. Source code of rhodes and rhoconnect application is available at <a href="https://github.com/Dhepthi/rhodes-unit-webservice">https://github.com/Dhepthi/rhodes-unit-webservice</a>, <a href="https://github.com/Dhepthi/rhoconnect-unit-webservice">https://github.com/Dhepthi/rhoconnect-unit-webservice</a>.Please feel free to improve and send me a pull request. Any suggestion or comments are welcome.</p>
<img src="http://www.spritle.com/blogs/wp-content/plugins/pixelstats/trackingpixel.php?post_id=1723&amp;ts=1335957256" style="display:none;" alt="pixelstats trackingpixel"/><img src="http://feeds.feedburner.com/~r/Spritle/~4/QFkT7tdcsYg" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.spritle.com/blogs/2012/03/23/consume-soap-webservice-in-rhoconnect/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.spritle.com/blogs/2012/03/23/consume-soap-webservice-in-rhoconnect/</feedburner:origLink></item>
		<item>
		<title>IPhone Push Notification using Ruby</title>
		<link>http://feedproxy.google.com/~r/Spritle/~3/yb0XK9hZ9-g/</link>
		<comments>http://www.spritle.com/blogs/2012/03/21/iphone-push-notification-using-ruby/#comments</comments>
		<pubDate>Wed, 21 Mar 2012 01:10:37 +0000</pubDate>
		<dc:creator>Dhepthi L Narasimhan</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[apple]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[Push]]></category>
		<category><![CDATA[rhodes]]></category>
		<category><![CDATA[rhomobile]]></category>
		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://www.spritle.com/blogs/?p=1646</guid>
		<description><![CDATA[Push Notification is one of the challenging concept in all smart phones. Especially when it comes to Iphone push, it is quite long process. I recently had a chance to try Push notification in Iphone. The most difficult task is to create SSL certificate and Provisional certificate. Let&#8217;s see how to create it and make [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Push Notification</strong> is one of the challenging concept in all smart phones. Especially when it comes to Iphone push, it is quite long process. I recently had a chance to try Push notification in Iphone. <span id="more-1646"></span></p>
<p>The most difficult task is to create <strong>SSL certificate</strong> and <strong>Provisional certificate</strong>. Let&#8217;s see how to create it and make use of it.</p>
<p><strong>1. Create Certificate Signing Request (CSR)</strong></p>
<ul>
 Open Keychain Access application in your mac and generate CSR as follows</p>
<p>      <strong>*</strong> Request a Certificate from authority as shown</p>
<p><a href="http://www.spritle.com/blogs/wp-content/uploads/2012/03/Screen-shot-2012-03-20-at-3.48.42-PM.jpg"><img src="http://www.spritle.com/blogs/wp-content/uploads/2012/03/Screen-shot-2012-03-20-at-3.48.42-PM.jpg" alt="" title="Screen shot 2012-03-20 at 3.48.42 PM" width="600" height="400" class="aligncenter size-full wp-image-1648" /></a></p>
<p>       <strong>*</strong> It will open a dialog, follow the process to create the certificate. The certificate with certSigningRequest extension will be created. </p>
<p>Save the  certificate to disk for further use</ul>
<p><strong>2. Create SSL Certificate</strong></p>
<ul>
 We can create our ssl certificate in provisioning portal of IOS dev center. The steps to create SSL certificate</p>
<p>     <strong>*</strong> Create a New App ID by clicking on APP IDs in the left menu as shown</p>
<p><a href="http://www.spritle.com/blogs/wp-content/uploads/2012/03/Screen-shot-2012-03-20-at-3.40.23-PM.jpg"><img src="http://www.spritle.com/blogs/wp-content/uploads/2012/03/Screen-shot-2012-03-20-at-3.40.23-PM.jpg" alt="" title="Screen shot 2012-03-20 at 3.40.23 PM" width="600" height="400" class="aligncenter size-full  wp-image-1651" /></a></p>
<p>     * To enable Push Notification, check the Enable Push Notification Service box and clicking Configure button will open an dialog box as shown</p>
<p><a href="http://www.spritle.com/blogs/wp-content/uploads/2012/03/Screen-shot-2012-03-20-at-3.41.50-PM.jpg"><img src="http://www.spritle.com/blogs/wp-content/uploads/2012/03/Screen-shot-2012-03-20-at-3.41.50-PM.jpg" alt="" title="Screen shot 2012-03-20 at 3.41.50 PM" width="557" height="407" class="aligncenter size-full wp-image-1652" /></a></p>
<p>      * The Dialog will prompt for CSR certificate. Upload the certificate just created in above steps and follow the window to create APN certificate</p>
<p>      * APN certificate with <strong>cer</strong> extension will be generated for given request and you can download it as shown<br />
<a href="http://www.spritle.com/blogs/wp-content/uploads/2012/03/Screen-shot-2012-03-20-at-3.51.01-PM.jpg"><img src="http://www.spritle.com/blogs/wp-content/uploads/2012/03/Screen-shot-2012-03-20-at-3.51.01-PM.jpg" alt="" title="Screen shot 2012-03-20 at 3.51.01 PM" width="500" height="200" class="aligncenter size-full wp-image-1653" /></a></p>
<p>      * Opening it in Keychain Access, you will able to see Certificate, Private,Public Key as shown</p>
<p><a href="http://www.spritle.com/blogs/wp-content/uploads/2012/03/Screen-shot-2012-03-20-at-4.30.08-PM.jpg"><img src="http://www.spritle.com/blogs/wp-content/uploads/2012/03/Screen-shot-2012-03-20-at-4.30.08-PM.jpg" alt="" title="Screen shot 2012-03-20 at 4.30.08 PM" width="557" height="407" class="aligncenter size-full wp-image-1655" /></a></p>
</ul>
<p><strong>3. Create Provisioning Profile</strong></p>
<ul>
Now we have to create a Provisioning profile for newly created SSL certificate. The steps are</p>
<p>       <strong>*</strong> Create Provisioning profile by clicking <strong>Provisioning</strong> in left menu of IOS provisioning portal as shown</p>
<p><a href="http://www.spritle.com/blogs/wp-content/uploads/2012/03/Screen-shot-2012-03-20-at-3.51.49-PM.jpg"><img src="http://www.spritle.com/blogs/wp-content/uploads/2012/03/Screen-shot-2012-03-20-at-3.51.49-PM.jpg" alt="" title="Screen shot 2012-03-20 at 3.51.49 PM" width="600" height="300" class="aligncenter size-full wp-image-1656" /></a></p>
<p>       <strong>*</strong> By filling the necessary details, Development Provisioning profile with <strong>mobileprovision</strong> will be generated as shown</p>
<p><a href="http://www.spritle.com/blogs/wp-content/uploads/2012/03/Screen-shot-2012-03-20-at-3.52.10-PM.jpg"><img src="http://www.spritle.com/blogs/wp-content/uploads/2012/03/Screen-shot-2012-03-20-at-3.52.10-PM.jpg" alt="" title="Screen shot 2012-03-20 at 3.52.10 PM" width="716" height="300" class="aligncenter size-full wp-image-1657" /></a></p>
<p>       <strong>*</strong> Download,open it in Xcode and install the profile for your iphone/ipad.
</ul>
<p><strong>4. Export APN certificate to .pem format</strong></p>
<ul>
We need to export the generated .cer certificate to .pem format as follows</p>
<p>        <strong>*</strong> Open KeyAccess, Select your generated certificate alone with private key and export it to p12 format as shown</p>
<p><a href="http://www.spritle.com/blogs/wp-content/uploads/2012/03/Screen-shot-2012-03-20-at-4.42.53-PM.jpg"><img src="http://www.spritle.com/blogs/wp-content/uploads/2012/03/Screen-shot-2012-03-20-at-4.42.53-PM.jpg" alt="" title="Screen shot 2012-03-20 at 4.42.53 PM" width="697" height="407" class="aligncenter size-full wp-image-1658" /></a></p>
<p>        <strong>*</strong> In terminal, use the following code to export it to pem format</p>
<pre class="brush: ruby">
openssl pkcs12 -in CertificateName.p12 -out CertificateName.pem -nodes
</pre>
<p>Make a note .pem certificate file, we will use it in ruby</ul>
<p><strong>5. Device Token</strong></p>
<ul>
 Each Device has token associated with it. We need to get the Device Token in order to make communication with that device. In <strong>rhodes</strong> it is much easier to retrieve the device token. The steps to get device token using rhodes<br />
      <strong>*</strong> Create a rhodes app</p>
<pre class="brush: ruby">
            rhodes app app_name
            </pre>
<p>      <strong>*</strong> Enable <strong>push</strong> in <strong>build.yml</strong></p>
<pre class="brush: ruby">
             capablities:
               - push
             </pre>
<p>      <strong>*</strong> In terminal, type the following to run your rhodes app in Iphone through <strong>Xcode</strong></p>
<pre class="brush: ruby">
               rake swtich_app
               rake build:iphone:setup_xcode_project
               </pre>
<p>       <strong>*</strong> Connect you device to Mac. Open <strong>rrhorunner.xcodeproj</strong> in Xcode and run the rhodes app in your device.</p>
<p>       <strong>*</strong> Running you app in device will prompt you to allow for notification as follows</p>
<p><a href="http://www.spritle.com/blogs/wp-content/uploads/2012/03/push.jpg"><img src="http://www.spritle.com/blogs/wp-content/uploads/2012/03/push-199x300.jpg" alt="" title="push" width="199" height="300" class="aligncenter size-medium wp-image-1660" /></a></p>
<p>       <strong>* </strong>Clicking Allow will get the device id from device. You can get the device id from the log window of xcode or through code as</p>
<pre class="brush: ruby">
             System.get(&#039;device_id&#039;) # =&gt; D12f5sad7673-h543
             </pre>
</ul>
<p><strong>6. Send Messages using ruby gem</strong></p>
<ul>
Once you have all the necessary things needed to communicate with IOS device, we can use <strong>apns gem</strong> exclusively for IOS device. The steps are</p>
<p>           <strong>*</strong> First install apns gem as</p>
<pre class="brush: ruby">
                gem install apns
               </pre>
<p>           <strong>*</strong> Configure apns with your generated pem file, device token as</p>
<pre class="brush: ruby">
                APNS.host = &#039;gateway.sandbox.push.apple.com&#039;
                APNS.pem  = &#039;/path/to/your/cert.pem&#039;
                APNS.port = 2195
                device_token = &#039;your_device_token&#039;
               </pre>
<p>           <strong>*</strong> Send notification to your ios device as </p>
<pre class="brush: ruby">
               APNS.send_notification(device_token, &#039;Hello iPhone!&#039;)
               </pre>
</ul>
<p>The <strong>entire code</strong> looks like</p>
<ul>
<pre class="brush: ruby">
require &#039;apns&#039;

APNS.host = &#039;gateway.sandbox.push.apple.com&#039;
APNS.pem  = &#039;/path/to/your/cert.pem&#039;
APNS.port = 2195

device_token = &#039;your_device_token&#039;
APNS.send_notification(device_token, &#039;Hello iPhone!&#039;)
</pre>
</ul>
<p><strong> Note : Mobile Provision</strong> will not be installed in your xcode until it has the proper private key associated with it.</p>
<p>We will get an message in IOS device. I hope this blog would be useful to send push notification in Iphone using ruby gem. Any suggestion or comments are most welcome </p>
<img src="http://www.spritle.com/blogs/wp-content/plugins/pixelstats/trackingpixel.php?post_id=1646&amp;ts=1335957256" style="display:none;" alt="pixelstats trackingpixel"/><img src="http://feeds.feedburner.com/~r/Spritle/~4/yb0XK9hZ9-g" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.spritle.com/blogs/2012/03/21/iphone-push-notification-using-ruby/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://www.spritle.com/blogs/2012/03/21/iphone-push-notification-using-ruby/</feedburner:origLink></item>
		<item>
		<title>Access LDAP Server using Ruby</title>
		<link>http://feedproxy.google.com/~r/Spritle/~3/QL-XUmLM9tM/</link>
		<comments>http://www.spritle.com/blogs/2012/03/18/access-ldap-server-using-ruby/#comments</comments>
		<pubDate>Sun, 18 Mar 2012 17:01:40 +0000</pubDate>
		<dc:creator>Dhepthi L Narasimhan</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[rhodes]]></category>
		<category><![CDATA[ruby rhodes rhomobile]]></category>

		<guid isPermaLink="false">http://www.spritle.com/blogs/?p=1638</guid>
		<description><![CDATA[Recently I tried accessing LDAP server using ruby gem. I came to know about net-ldap gem which does the job in easier way. The Lightweight Directory Access Protocol (LDAP) is an application protocol for accessing and maintaining distributed directory information services over an Internet Protocol. Let&#8217;s see how to access information from LDAP using net-ldap [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I tried accessing LDAP server using ruby gem. I came to know about <strong>net-ldap</strong> gem which does the job in easier way. The <strong>Lightweight Directory Access Protocol (LDAP)</strong> is an application protocol for accessing and maintaining distributed directory information services over an Internet Protocol.  Let&#8217;s see how to access information from LDAP using net-ldap gem.<span id="more-1638"></span></p>
<p>1. First, Install the gem as</p>
<ul>
<pre class="brush: ruby">
       gem install net-ldap
 </pre>
</ul>
<p>2. Initiate LDAP server as follows</p>
<ul>
<pre class="brush: ruby">
      require &#039;rubygems&#039;
      require &#039;net/ldap&#039;
      ldap = Net::LDAP.new
      ldap.host = &quot;x500.bund.de&quot;
      ldap.port = &quot;389&quot;
      is_authorized = ldap.bind 
</pre>
</ul>
<p><strong>x500.bund.de</strong> is public LDAP server. You can find various public ldap server in net.</p>
<p>3. If suppose we need to authenticate Ldap server using username and password. We can do it as</p>
<ul>
<pre class="brush: ruby">
      ldap = Net::LDAP.new
      ldap.host = &quot;x500.bund.de&quot;
      ldap.port = &quot;389&quot;
      username = &quot;xxxxxxxx&quot;
      pasword = &quot;xxxxxxxxx&quot;
      ldap.auth username, password
      is_authorized = ldap.bind  #returns true if auto works
</pre>
</ul>
<p>4. Now let see how to search some records in LDAP server</p>
<ul>
<pre class="brush: ruby">
  attrs = []
  ldap.search( :base =&gt; &quot;l=init,ou=Service,o=Bund,c=DE&quot;, :attributes =&gt; attrs, :return_result =&gt; true ) do |entry|
     # entry is records returned after search
  end
</pre>
<p>Here entry  will return set of records that matching the word given in base.
</ul>
<p>5. We can also use filter to refine our search as</p>
<ul>
<pre class="brush: ruby">
filter = Net::LDAP::Filter.eq(&quot;username&quot;, &quot;xxxxx&quot;)
attrs = []
ldap.search(:base =&gt; treebase, :filter =&gt; filter, :attributes =&gt; attrs,
  #refined search
end
</pre>
</ul>
<p>I hope this blog will be useful for accessing Ldap server using ruby gem. Any suggestion or comments are most welcome</p>
<img src="http://www.spritle.com/blogs/wp-content/plugins/pixelstats/trackingpixel.php?post_id=1638&amp;ts=1335957256" style="display:none;" alt="pixelstats trackingpixel"/><img src="http://feeds.feedburner.com/~r/Spritle/~4/QL-XUmLM9tM" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.spritle.com/blogs/2012/03/18/access-ldap-server-using-ruby/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.spritle.com/blogs/2012/03/18/access-ldap-server-using-ruby/</feedburner:origLink></item>
		<item>
		<title>Training on RhoMobile at Singapore – Photos</title>
		<link>http://feedproxy.google.com/~r/Spritle/~3/U1lrB7kBZvs/</link>
		<comments>http://www.spritle.com/blogs/2012/03/16/training-on-rhomobile-at-singapore-photos/#comments</comments>
		<pubDate>Fri, 16 Mar 2012 13:15:43 +0000</pubDate>
		<dc:creator>Balaji D Loganathan</dc:creator>
				<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[android]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[rhodes]]></category>
		<category><![CDATA[rhomobile]]></category>
		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://www.spritle.com/blogs/?p=1632</guid>
		<description><![CDATA[On 2nd March 2012 we conducted a half-day training on &#8220;Building cross-platform Mobile applications using RhoMobile platform at Singapore. Here are some of pictures taken from the events. We covered topics like Introduction to RhoMobile [Basics of mobile app s, rhomobile basics, Enterprise apps demos] Enterprise apps using Rhomobile [device capabilities (barcode, signature, camera...), demos] [...]]]></description>
			<content:encoded><![CDATA[<p>On 2nd March 2012 we conducted a half-day training on &#8220;<strong>Building cross-platform Mobile applications  using RhoMobile platform</strong> at Singapore.<br />
Here are some of pictures taken from the events.<br />
<span id="more-1632"></span></p>
<p><a target="new" href="http://www.spritle.com/blogs/wp-content/uploads/2012/03/Singapore_mobile_apps_training_rhomobile.jpg"><img src="http://www.spritle.com/blogs/wp-content/uploads/2012/03/Singapore_mobile_apps_training_rhomobile.jpg" alt="" title="Singapore_mobile_apps_training_rhomobile" class="alignnone size-full wp-image-1633" /></a><br />
We covered topics like</p>
<ul>
<li>Introduction to RhoMobile [Basics of mobile app	s, rhomobile basics, Enterprise apps demos]</li>
<li>Enterprise apps using Rhomobile [device capabilities (barcode, signature, camera...), demos]</li>
<li>Lets build a native mobile application</li>
</ul>
<p>Thanks to the participants from Singapore for the attending it.</p>
<img src="http://www.spritle.com/blogs/wp-content/plugins/pixelstats/trackingpixel.php?post_id=1632&amp;ts=1335957256" style="display:none;" alt="pixelstats trackingpixel"/><img src="http://feeds.feedburner.com/~r/Spritle/~4/U1lrB7kBZvs" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.spritle.com/blogs/2012/03/16/training-on-rhomobile-at-singapore-photos/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.spritle.com/blogs/2012/03/16/training-on-rhomobile-at-singapore-photos/</feedburner:origLink></item>
		<item>
		<title>New features in Rails 3.2</title>
		<link>http://feedproxy.google.com/~r/Spritle/~3/mZmZ62PALLU/</link>
		<comments>http://www.spritle.com/blogs/2012/03/07/rails-3-2-new-features/#comments</comments>
		<pubDate>Wed, 07 Mar 2012 01:04:58 +0000</pubDate>
		<dc:creator>Dhepthi L Narasimhan</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[rails 3.2]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Ruby on Rails]]></category>

		<guid isPermaLink="false">http://www.spritle.com/blogs/?p=1622</guid>
		<description><![CDATA[Rails 3.2 was released with lot of amazing changes. I recently read about new features which provides better and new tags, faster reloading in development, faster queries and so on. So let&#8217;s take a look of some of those interesting features * Faster Reloading in Development We can only reload classes if their dependent files [...]]]></description>
			<content:encoded><![CDATA[<p>Rails 3.2 was released with lot of amazing changes. I recently read about new features which provides better and new tags, faster reloading in development, faster queries and so on. So let&#8217;s take a look of some of those interesting features <span id="more-1622"></span>   </p>
<p><strong>* Faster Reloading in Development</strong></p>
<ul> We can only reload classes if their dependent files get changed. You can do this by setting <strong>reload_classes_only_on_change</strong> to true or false</p>
<pre class="brush: ruby">
        config.reload_classes_only_on_change = boolean_value
</pre>
</ul>
<p><strong>* Better content_tag_for and div_for tag</strong></p>
<ul>
 These tags can take collection of records as a argument itself instead of looping through it for each record. An example </p>
<p>Instead of the below code</p>
<pre class="brush: ruby">
@products.each do |item|
       content_tag_for(:li, item) do
              Name: &lt;%= item.name %&gt;
      end
end
</pre>
<p>we can rewrite this as</p>
<pre class="brush: ruby">
content_tag_for(:li,@products) do |item|
       Name: &lt;%= item.name %&gt;
end
</pre>
</ul>
<p><strong><br />
* Smarter Layout rendering approach</strong></p>
<ul>
  You can use default layout when you specify a layout with <strong>only</strong> and <strong>:except</strong> conditions  and in those conditions fail. An example</p>
<pre class="brush: ruby">
class ProductsController
   layout &#039;banner&#039; , <img src='http://www.spritle.com/blogs/wp-includes/images/smilies/icon_surprised.gif' alt=':o' class='wp-smiley' /> nly =&gt; :new
end
</pre>
<p>In this above case, you will be using your default layout(layouts/application) for rest of the action. If the new action request comes in, you will be rendered with banner layout.
</ul>
<p><strong>* Tag Level changes</strong></p>
<ul>
<strong>form_for</strong> tag with <strong>:as</strong> option changes the values of css class and id as <strong>&#8220;#{action}_#{as}&#8221;</strong>.  An Example</p>
<p>Previously it was </p>
<pre class="brush: ruby">
form_for(@product, :as =&gt; &#039;item&#039;) # =&gt; &quot;&lt;form class=&quot;item_new&quot;&gt;&quot;
</pre>
<p>But now we have it as</p>
<pre class="brush: ruby">
form_for(@product, :as =&gt; &#039;item&#039;) # =&gt; &quot;&lt;form class=&quot;new_item&quot;&gt;&quot;
</pre>
<p>            <strong>button_tag</strong> is new tag added to ActionView::Helpers::FormBuilder. Its just similar to submit_tag. An Example as</p>
<pre class="brush: ruby">
&lt;%= form_for @product do |f| %&gt;
  &lt;%= f.button %&gt;
&lt;% end %&gt;
</pre>
</ul>
<p><strong><br />
* Better rails commands</strong></p>
<ul>
  We have better Rails command line. Some of them are</p>
<p>         &#8211; Atributes takes string by default<br />
         &#8211; Old plugin generator removed<br />
         &#8211; Destroy alias added
</ul>
<p><strong>* Changes in render template</strong></p>
<ul>
Now it is possible to provide <strong>:handlers</strong> and <strong>:formats</strong> directly as an options. An example</p>
<pre class="brush: ruby">
render :template =&gt; edit, :formats =&gt; :html, :handlers =&gt; :erb
</pre>
</ul>
<p>These are some of the changes I went through while going through the changelog. I hope this blog would be useful for knowing new changes in Rails 3.2. Let move forward in working with Rails 3.2 further</p>
<img src="http://www.spritle.com/blogs/wp-content/plugins/pixelstats/trackingpixel.php?post_id=1622&amp;ts=1335957256" style="display:none;" alt="pixelstats trackingpixel"/><img src="http://feeds.feedburner.com/~r/Spritle/~4/mZmZ62PALLU" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.spritle.com/blogs/2012/03/07/rails-3-2-new-features/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.spritle.com/blogs/2012/03/07/rails-3-2-new-features/</feedburner:origLink></item>
		<item>
		<title>Github with coderwall Application in Rhomobile</title>
		<link>http://feedproxy.google.com/~r/Spritle/~3/6JyzrdLc2r4/</link>
		<comments>http://www.spritle.com/blogs/2012/03/01/github-with-coderwall-application-in-rhomobile/#comments</comments>
		<pubDate>Thu, 01 Mar 2012 01:15:06 +0000</pubDate>
		<dc:creator>Visnu Priya</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[json]]></category>
		<category><![CDATA[rhodes]]></category>
		<category><![CDATA[rhomobile]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[XML]]></category>

		<guid isPermaLink="false">http://www.spritle.com/blogs/?p=1555</guid>
		<description><![CDATA[I recently tried to integrate github and coderwall in rhomobile application. Using github oauth we can authenticate user and show the following details of user and coderwall patches of user 1.User Repositories 2.User Forked Repositories 3.User Watched Repositories 4.User Following 5.User Follower Now lets see how to authenticate user in github First we need to [...]]]></description>
			<content:encoded><![CDATA[<p>I recently tried to integrate github and coderwall in rhomobile application. Using github oauth we can authenticate user and show the following details of user and coderwall patches of user</p>
<blockquote>
<p>		1.User Repositories<br />
		2.User Forked Repositories<br />
		3.User Watched Repositories<br />
		4.User Following<br />
		5.User Follower</p></blockquote>
<p>Now lets see how to authenticate user in github  <span id="more-1555"></span><br />
First we need to register our application in github:developer site.we will use <strong>client_id</strong> and <strong>client_secret</strong> of registered application as shown </p>
<ul>
<pre class="brush: ruby">
	def github_login
            local_callback_url =url_for( :action =&gt; :github_callback )
     	    call_back_url = RedirectServiceURL + &quot;/&quot; + &#039;127.0.0.1:&#039; +
            System.get_property(&#039;rhodes_port&#039;).to_s + local_call_back_url
     	    url =&quot;https://github.com/login/oauth/authorize?client_id=xxxxx&amp;
            redirect_uri=#{call_back_url}&amp;scope=user,public_repo,repo,gist&quot;
     	    WebView.navigate(url)
 	end
</pre>
</ul>
<p>From above method we can get @params["code"] to access token of current user. We have used following callback url to redirect our rhombile application since rhomobile have random port number</p>
<ul>
<pre class="brush: ruby">
	RedirectServiceURL = &quot;http://redirectme.to&quot;     //used to redirect application url//
</pre>
</ul>
<p>You can attain port number as </p>
<ul>
<pre class="brush: ruby">
	System.get_property(&#039;rhodes_port&#039;).to_s
</pre>
</ul>
<p>Lets see how to process @params[code] to get user token as shown</p>
<ul>
<pre class="brush: ruby">
	def github_callback
    		code=@params[&quot;code&quot;]
	    	@@token=Rho::AsyncHttp.post(
                    :url =&gt; &quot;https://github.com/login/oauth/access_token?client_id=xxxxx&amp;amp;client_secret=xxxx&amp;amp;code=&quot; + code
		                            )
    		user_info = &quot;https://github.com/api/v2/json/user/show?&quot; + @@token[&quot;body&quot;]
    		user=Rho::AsyncHttp.get(
             		:url =&gt; user_info,
              				)
	        WebView.navigate( url_for :action =&gt; :listing )
  	end
</pre>
</ul>
<p>So far we saw how to authenticate user and get token. We can also get access to public, forked and watched repositories using Username as shown below</p>
<ul>
<pre class="brush: ruby">
my_repo_url = &quot;https://github.com/api/v2/json/repos/show/&quot;
              + Rho::RhoConfig.username   #=&gt; Get Public and forked repositories info
my_watched_url = &quot;https://github.com/api/v2/json/repos/watched/&quot;
              + Rho::RhoConfig.username   #=&gt; Get watched repositories
</pre>
</ul>
<p>Using callback events for the each url, we can manipulate data and display it</p>
<p>We can also list of followers and following users using the below url</p>
<ul>
<pre class="brush: ruby">
my_following_url = &quot;https://github.com/api/v2/json/user/show/&quot;
              + Rho::RhoConfig.username + &quot;/following&quot; #=&gt; Following url

my_followers_url = &quot;https://github.com/api/v2/json/user/show/&quot;
              + Rho::RhoConfig.username + &quot;/followers&quot; # =&gt; Followers list
</pre>
</ul>
<p>Finally we will integrate Coderwall_page  in github rhomobile application. Since Coderwall use github authentication to give patches, we can easily integrate coderwall page in github rhomobile application. We get details of user in coder wall in <strong>JSON</strong> format as shown</p>
<ul>
<pre class="brush: ruby">
 	        user_details_url = &quot;http://coderwall.com/#{Rho::RhoConfig.username}.json&quot;
     		result = Rho::AsyncHttp.get(:url =&gt; auth_url)
 </pre>
</ul>
<p>The execution of GET request will give User details.<br />
<strong><br />
Some of the screenshots taken from Android Mobile</strong><br />
<a href="http://www.spritle.com/blogs/wp-content/uploads/2012/02/SC20120227-152830.png"><img src="http://www.spritle.com/blogs/wp-content/uploads/2012/02/SC20120227-152830-225x300.png" alt="" width="225" height="300" class="alignnone size-medium wp-image-1556" /></a>&nbsp;&nbsp;&nbsp;<a href="http://www.spritle.com/blogs/wp-content/uploads/2012/02/SC20120227-152822.png"><img src="http://www.spritle.com/blogs/wp-content/uploads/2012/02/SC20120227-152822-225x300.png" alt="" width="225" height="300" class="alignnone size-medium wp-image-1557" /></a>&nbsp;&nbsp;&nbsp;<a href="http://www.spritle.com/blogs/wp-content/uploads/2012/02/SC20120227-152443.png"><img src="http://www.spritle.com/blogs/wp-content/uploads/2012/02/SC20120227-152443-225x300.png" alt="" width="225" height="300" class="alignnone size-medium wp-image-1558" /></a></p>
<p>I hope this blog will be helpful for integrating github authentication in rhomobile. Source code of application is available at <a href="https://github.com/spritle/rhodes_github_client_demo" title="https://github.com/spritle/rhodes_github_client_demo" target="_blank">https://github.com/spritle/rhodes_github_client_demo</a>.Please feel free to improve and send me a pull request. Any suggestion or comments are welcome.</p>
<img src="http://www.spritle.com/blogs/wp-content/plugins/pixelstats/trackingpixel.php?post_id=1555&amp;ts=1335957256" style="display:none;" alt="pixelstats trackingpixel"/><img src="http://feeds.feedburner.com/~r/Spritle/~4/6JyzrdLc2r4" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.spritle.com/blogs/2012/03/01/github-with-coderwall-application-in-rhomobile/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.spritle.com/blogs/2012/03/01/github-with-coderwall-application-in-rhomobile/</feedburner:origLink></item>
		<item>
		<title>New Amazing features in Ruby 1.9.3</title>
		<link>http://feedproxy.google.com/~r/Spritle/~3/H4-fViWs2po/</link>
		<comments>http://www.spritle.com/blogs/2012/02/29/new-amazing-features-in-ruby-1-9-3/#comments</comments>
		<pubDate>Wed, 29 Feb 2012 02:01:54 +0000</pubDate>
		<dc:creator>Dhepthi L Narasimhan</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[ruby 1.9.3]]></category>

		<guid isPermaLink="false">http://www.spritle.com/blogs/?p=1561</guid>
		<description><![CDATA[Ruby is one of the dynamic object oriented programming language. Ruby 1.9 has been released with lot of amazing features. Ruby 1.9.3 is the latest stable version of ruby, with major increases in speed and reliability. Some of the features in Ruby 1.9.3 are * &#8220;load.c&#8221; patch to speed up requiring/loading files * Improved GC [...]]]></description>
			<content:encoded><![CDATA[<p>Ruby is  one of the dynamic object oriented programming language. Ruby 1.9 has been released with lot of amazing features. Ruby 1.9.3 is the latest stable version of ruby, with major increases in speed and reliability. Some of the features in Ruby 1.9.3 are <span id="more-1561"></span>        </p>
<blockquote><ul>
               * &#8220;load.c&#8221; patch to speed up requiring/loading files<br />
               * Improved GC performance with a lazy garbage collector<br />
               * Random.rand accepts inputs in form of ranges<br />
               * IO/Console, new library in stdlib<br />
               * New encodings supported<br />
               * New String methods<br />
               * Extended formats for Timezone<br />
               * Scope of Constants in Struct<br />
               * Improved matrix library<br />
               * New methods private_constants and public_constants in Module
</ul>
</blockquote>
<p>Let&#8217;s have a quick walkthrough of some Ruby 1.9.3 features below</p>
<p><strong>* <strong>Extended formats for Timezone</strong></strong></p>
<ul>  <strong>Time#strftime</strong> now supports some extended formats for timezone like :z and ::z. An example of strftime method </p>
<pre class="brush: ruby">
               Time.now.strftime(&quot;%:z %::z&quot;)   # =&gt; &quot;+01:00 +01:00:00&quot;
</pre>
<p>where :z includes the minutes and ::z gives the full HH:MM:SS</ul>
<p><strong>* <strong>New Methods for String Class</strong></strong></p>
<ul>  In addition to some changes in String class, we have some new methods like <strong>prepend</strong> and <strong>byteslice</strong>. </p>
<p>           <strong>String#prepend</strong> prepends a new string to an existing string. A simple example is</p>
<pre class="brush: ruby">
              str = &quot; Programmer&quot;
              str.prepend(&quot;Ruby &quot;)
              puts str    # =&gt; &quot;Ruby Programmer&quot;
 </pre>
<p>           <strong>String#byteslice</strong>  returns a substring from the given string depending upon the arguments passed. Some formats of byteslice are</p>
<pre class="brush: ruby">
       &quot;ruby&quot;.byteslice(1)     # =&gt; &quot;u&quot;
      &quot;ruby&quot;.byteslice(1, 2)  # =&gt; &quot;ub&quot;
      &quot;ruby&quot;.byteslice(1..3)  # =&gt; &quot;uby&quot;
</pre>
</ul>
<p><strong>* <strong>Changes in Random#rand </strong></strong></p>
<ul>  Ruby 1.9.2 introduced Random class in which we can create our own random number object. In 1.9.2, you can use rand as instance method like</p>
<pre class="brush: ruby">
                     1.9.2p290 :003 &gt; r = Random.new
                     1.9.2p290 :004 &gt; r.rand(2..6)
</pre>
<p>       But now in Ruby 1.9.3, you can directly accept ranges on its own rand class method like</p>
<pre class="brush: ruby">
                     1.9.3p0 :029 &gt; Random.rand(1..3)
                     =&gt; 3
</pre>
<p>       In addition to this, <strong>Kernel.rand</strong> also supports ranges like</p>
<pre class="brush: ruby">
                     1.9.3p0 :030 &gt; rand(2..8)
                     =&gt; 6
</pre>
</ul>
<p><strong>* <strong>New encodings supported</strong></strong></p>
<ul>    Ruby 1.9.3 supports some new encodings. In previous version, we used to have <strong>UTF-16</strong> and <strong>UTF-32</strong> for big-endian(BE) and little -endian specific forms but now we have 4 new encodings like</p>
<pre class="brush: ruby">
                   1.9.3p0 :001 &gt; Encoding.find(&quot;UTF-32&quot;)
                   =&gt; #&lt;Encoding:UTF-32 (dummy)&gt;
                   1.9.3p0 :002 &gt; Encoding.find(&quot;UTF-16&quot;)
                   =&gt; #&lt;Encoding:UTF-16 (dummy)&gt;
                   1.9.3p0 :003 &gt; Encoding.find(&quot;CP950&quot;)
                   =&gt; #&lt;Encoding:CP950&gt;
                   1.9.3p0 :004 &gt; Encoding.find(&quot;CP951&quot;)
                   =&gt; #&lt;Encoding:CP951&gt;
</pre>
</ul>
<p><strong>* Constant Scope in Struct Bug Fix</strong></p>
<ul>         A weird bug in Ruby 1.9.2 Struct. Passing a block to 1.9.2 Struct.new does not create a new scope for constants. For example</p>
<pre class="brush: ruby">
             VALUE = false
             Test = Struct.new(:name, :age) do
                def self.check?
                     VALUE
                end
              end

              Test::VALUE = true
              Test.check?
</pre>
<p>The output of above code differs in ruby 1.9.2 and ruby 1.9.3. The output will be as shown below</p>
<pre class="brush: ruby">
    # ruby 1.9.2-p180
    Test::VALUE = true # Actually does VALUE=true
    Test.check?        # Reads new value of VALUE
    =&gt; true
</pre>
<pre class="brush: ruby">
# ruby 1.9.3-p0
Test::VALUE = true # Creates new constant Test::VALUE
Test.check?         # Reads unchanged value of VALUE
=&gt; false
</pre>
<p>In Ruby 1.9.2, the interpreter assumes you mean to write VALUE = true and changes the global constant. This behavior is a bug.</p>
<p>Ruby 1.9.3 <strong>corrects</strong> this behavior. It interprets Test::VALUE = true to mean &#8220;Create a brand new constant named Test::VALUE and assign it to true&#8221;. And so the global VALUE remains unchanged.
</ul>
<p><strong>* Lazy Sweeping Garbage Collector</strong></p>
<ul>   Ruby 1.9.3 provides Lazy sweeping GC which is 8% faster on average. The Simple (non-lazy) Mark Sweep GC executes mark and sweep atomically. Also, it sweeps the whole heap and links all live objects to the freelist whereas in Lazy sweeping, each invocation of the object allocation sweeps the heap until it finds an appropriate free object.
</ul>
<p>These are some of the ruby 1.9.3 features I learnt. </p>
<img src="http://www.spritle.com/blogs/wp-content/plugins/pixelstats/trackingpixel.php?post_id=1561&amp;ts=1335957256" style="display:none;" alt="pixelstats trackingpixel"/><img src="http://feeds.feedburner.com/~r/Spritle/~4/H4-fViWs2po" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.spritle.com/blogs/2012/02/29/new-amazing-features-in-ruby-1-9-3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.spritle.com/blogs/2012/02/29/new-amazing-features-in-ruby-1-9-3/</feedburner:origLink></item>
	</channel>
</rss>

