<?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/"
	>

<channel>
	<title>BDC Software &#187; Ruby on Rails</title>
	<atom:link href="http://www.bdcsoftware.com/category/ruby_on_rails/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.bdcsoftware.com</link>
	<description>Experience Matters</description>
	<lastBuildDate>Thu, 07 Jul 2011 19:01:03 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>XML/SWF Charts in Ruby on Rails</title>
		<link>http://www.bdcsoftware.com/xmlswf-charts-in-ruby-on-rails/</link>
		<comments>http://www.bdcsoftware.com/xmlswf-charts-in-ruby-on-rails/#comments</comments>
		<pubDate>Sat, 08 Aug 2009 23:40:10 +0000</pubDate>
		<dc:creator>raf</dc:creator>
				<category><![CDATA[Ruby on Rails]]></category>

		<guid isPermaLink="false">http://www.bdcsoftware.com/?p=160</guid>
		<description><![CDATA[Since RMagick seems to be broken on Win32 when using with Ruby 1.8.4 and Gruff is using RMagick to draw its pretty graphs, I had to go out and find an alternative chart library for use with Rails. XML/SWF Charts Fortunately I have run into this chart library a while back when doing php evelopment. [...]]]></description>
			<content:encoded><![CDATA[<p>
Since RMagick seems to be broken on Win32 when using with Ruby 1.8.4 and Gruff is using RMagick to draw its pretty graphs, I had to go out and find an alternative chart library for use with Rails.</p>
<p>
<br />
<strong>XML/SWF Charts</strong><br />
Fortunately I have run into this chart library a while back when doing php evelopment. It&#8217;s not really a php driven because the data input andconfiguration is in form of a XML file. To make it work with rails, all Ihad to do is translate the php function that generates the XML file to Ruby.</p>
<p>Well, after a few hours of playing around and experimenting with differentapproaches to the issue I think I have come up with a fairly easy way to get he charts working with rails.</p>
<p><div id="attachment_202" class="wp-caption aligncenter" style="width: 387px"><a href="http://www.bdcsoftware.com/wp-content/uploads/2009/08/chart_sample.gif" rel="lightbox[160]" title="chart_sample"><img src="http://www.bdcsoftware.com/wp-content/uploads/2009/08/chart_sample.gif" alt="Chart Sample" title="chart_sample" width="377" height="253" class="size-full wp-image-202" /></a><p class="wp-caption-text">Chart Sample</p></div>
</p>
<p>
The above sample displays a sample of a working graph. After a few failed / ugly attempts, I settled for a class/controller hybrid that hopefully is easy to use. So with out further rambling, here is a step by step guide to get it to work:</p>
<p>1.Download the <a href="http://www.maani.us/xml_charts/" title="SWF Chart library">SWF Chart library</a> and place it in the /public directory
</p>
<p>
2.Download the <a href='http://www.bdcsoftware.com/wp-content/uploads/2009/08/swfchart.rb'>swfchart.rb</a> class and place in the /lib directory
</p>
<p>
3.Download <a href='http://www.bdcsoftware.com/wp-content/uploads/2009/08/chart_controller.rb'>chart_controller</a> and place it in the /controllers directory
</p>
<p>
With all the pieces in place, the last two components will be tied to your application directly. The data and options for the chart have to be set in a controller. For instance something like this should work:
</p>
<p>
<span style="background-color: #99ccff">@swf = SWFChart.new</span>
</p>
<p>
<span style="background-color: #99ccff">session[:swfchart] = @swf</span><br />
<span style="background-color: #99ccff">#set data headings</span><br />
<span style="background-color: #99ccff">@swf.data_array = Array.new</span><br />
<span style="background-color: #99ccff">@swf.data_array[0] = [nil]</span><br />
<span style="background-color: #99ccff">@swf.data_array[1] = ['']</span></p>
<p><span style="background-color: #99ccff">#get space count per category</span><br />
<span style="background-color: #99ccff">for c in @current_show.ShowCategories</span><br />
<span style="background-color: #99ccff">    @swf.data_array[0] &lt;&lt; c.name</span><br />
<span style="background-color: #99ccff">    @swf.data_array[1] &lt;&lt; c.BaseSpaces.count</span><br />
<span style="background-color: #99ccff">end</span><br />
<span style="background-color: #99ccff">@swf.chart_type = &quot;3d pie&quot;</span><br />
<span style="background-color: #99ccff">@swf.chart_rect = {:x =&gt; &#8217;150&#8242;,:width =&gt; &#8217;200&#8242;,:height =&gt; &#8217;125&#8242;}</span><br />
<span style="background-color: #99ccff">@swf.legend_rect = {:x =&gt; 10, :y =&gt; 10, :width =&gt; 50, :height =&gt; 200}</span></p>
<p>And finally, the chart will be displayed from the view with code like this:
</p>
<p style="background-color: #99ccff">
&lt;%= @swf.insert_chart(:data_source =&gt; url_for(:controller =&gt; &quot;/chart&quot;), :width =&gt; &quot;400&quot;, :height =&gt; &quot;300&quot;) %&gt;
</p>
<p>
Observant readers will have noticed that the whole chart data-setting and generation is encapsulated in the swfchart.rb class from the /lib directory. Unfortunately I don&rsquo;t have much time to encapsulate this as a plugin, but perhaps somebody could take what I have and run with it&hellip;
</p>
<p>
06.12.06 &#8211; Edit<br />
There have been a few issues reported by a few users while trying to get this up and running. In order to solve some of the more common mistakes, I have decided to create a sample project. Just download <a href='http://www.bdcsoftware.com/wp-content/uploads/2009/08/testapp.zip'>testapp.zip</a>, unzip, run webrick and browse to <a href="http://localhost:3000/sample" title="http://localhost:3000/sample">http://localhost:3000/sample</a>
</p>
<p>
08.02.06 &#8211; Edit<br />
Version 0.1.14 of the SWFChart wrapper is done. Changes include a &quot;plugin&quot; like structure (still have to solve copying of the charts to the public directory before it becomes a true plugin) and minor bugfixes to xml generator method.
</p>
<p>
Installation:<br />
Just download the <a href='http://www.bdcsoftware.com/wp-content/uploads/2009/08/swfchart.0.1.14.zip'>swfchart.0.1.14.zip</a> and unzip it to the root of your rails application. If you have a previous version installed, remove swfchart.rb from the lib directory and any require statements from your controllers.
</p>
<p><!-- PHP 5.x --></p>
]]></content:encoded>
			<wfw:commentRss>http://www.bdcsoftware.com/xmlswf-charts-in-ruby-on-rails/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Dreamweaver 8 and Ruby on Rails CodeHints</title>
		<link>http://www.bdcsoftware.com/dreamweaver-8-and-ruby-on-rails-codehints/</link>
		<comments>http://www.bdcsoftware.com/dreamweaver-8-and-ruby-on-rails-codehints/#comments</comments>
		<pubDate>Sat, 08 Aug 2009 23:39:00 +0000</pubDate>
		<dc:creator>raf</dc:creator>
				<category><![CDATA[Ruby on Rails]]></category>

		<guid isPermaLink="false">http://www.bdcsoftware.com/?p=158</guid>
		<description><![CDATA[I am so used to coding help (intellisense) from Visual Studio, that not having an IDE with this type of functionality is a major inconvenience when working with the Ruby on Rails framework. There are editors that offer syntax highlighting and project management options, but all of them lack the intellisense (aka. code completion or [...]]]></description>
			<content:encoded><![CDATA[<p>
I am so used to coding help (intellisense) from Visual Studio, that not having an IDE with this type of functionality is a major inconvenience when working with the Ruby on Rails framework. There are editors that offer syntax highlighting and project management options, but all of them lack the intellisense (aka. code completion or coding hints) functionality.
</p>
<p>
The closest editor is jEdit. It offers code hints for the current class and has ruby RDOC add-in. However, I have not found a way to add the ROR API to it. So it&rsquo;s a shame&hellip;
</p>
<p>
<a href="http://www.bdcsoftware.com/development/rubyonrails/jedit.gif" rel="lightbox[158]" title="Dreamweaver 8 and Ruby on Rails CodeHints"><img src="http://www.bdcsoftware.com/development/rubyonrails/jedit_tn.gif" border="0" alt="Jedit and ROR" width="450" height="310" /></a><br />
 	jEdit and Ruby on Rails
</p>
<h3>Welcome Dreamweaver 8</h3>
<p>
 If you have worked with DW before, you will know that it offers syntax highlighting for many languages. It also has something similar to intellisense built-in for PHP and ASP. It will not complete your custom attributes or methods, but it can list the most used API calls (for instance Session&hellip; or Request&hellip; in ASP). Too bad they don&rsquo;t offer Ruby or ROR codehints&hellip;
</p>
<p>
Well, with a little bit of hacking, you can actually get  syntax highlighting and codhints working in DW 8.
</p>
<p>
First, follow <a href="http://rubygarden.org/ruby/ruby?action=browse&amp;diff=1&amp;id=DreamweaverMX">these instructions</a> to get syntax highlighting. For DW 8, I had to add the rules to the file in my profile directory and not in the global file in Program Files dir.
</p>
<h3>CodeHints</h3>
<p>
The toughest part of getting Ruby on Rails codehints into DW 8 was actually to get them out of the RDOC Html format. Last thing I wanted to manually copy and paste hundreds of lines J. Unfortunately, either I don&rsquo;t understand how to use RDOC correctly or this thing is completely broken. RDOC output to HTML work fine, but the output can&rsquo;t be easily used to get a list of all the APIs. The XML output could be used, but&hellip;it will NOT list the actual methods and parameters. Anyhow here is, after a few hours of trying to get the HTML template to behave the way I want it to, <a href="http://www.bdcsoftware.com/development/rubyonrails/rubyonrails_api_for_dreamweaver.txt">a file with some of  the most used APIs</a> in DW format ready to be added to &ldquo;C:\Program  Files\Macromedia\Dreamweaver 8\Configuration\CodeHints\CodeHints.xml&rdquo;
</p>
<h3>End Result </h3>
<p>
<img src="http://www.bdcsoftware.com/development/rubyonrails/dw_codehint1.gif" border="0" alt="Ruby on Rails in DreamWeaver" width="494" height="306" /><br />
   Dreamweaver CodeHints
</p>
<p>
<img src="http://www.bdcsoftware.com/development/rubyonrails/dw_codehint2.gif" border="0" alt="Alternative Code completion" width="412" height="82" />
</p>
<p><!-- PHP 5.x --></p>
]]></content:encoded>
			<wfw:commentRss>http://www.bdcsoftware.com/dreamweaver-8-and-ruby-on-rails-codehints/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

