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

<channel>
	<title>Dnamique</title>
	<atom:link href="http://www.dnamique.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.dnamique.com</link>
	<description>what is Soft in Software</description>
	<pubDate>Thu, 12 Nov 2009 06:00:57 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.7.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Setting up PostgreSQL 8.x with Ruby 1.8.6 on Rails 2.3.4</title>
		<link>http://www.dnamique.com/setting-up-postgresql-8-with-ruby-on-rails/</link>
		<comments>http://www.dnamique.com/setting-up-postgresql-8-with-ruby-on-rails/#comments</comments>
		<pubDate>Thu, 12 Nov 2009 06:00:57 +0000</pubDate>
		<dc:creator>Bachir El Khoury</dc:creator>
		
		<category><![CDATA[Ruby on Rails]]></category>

		<guid isPermaLink="false">http://www.dnamique.com/?p=77</guid>
		<description><![CDATA[PostgreSQL is a:
Sophisticated open-source Object-Relational DBMS supporting almost all SQL constructs, including subselects, transactions, and user-defined types etc&#8230;
The Problem


You have just installed PostgrelSQL.


You have generated your rails app

rails myApp -d postgresql



You try to run the server

ruby script/server



You add your DB details in config/database.yml and you notice this note.
 On Windows:

#   gem install ruby-postgres
# [...]]]></description>
			<content:encoded><![CDATA[<p>PostgreSQL is a:</p>
<blockquote><p>Sophisticated open-source Object-Relational DBMS supporting almost all SQL constructs, including subselects, transactions, and user-defined types etc&#8230;</p></blockquote>
<h2>The Problem</h2>
<ol>
<li>
<p>You have just installed <a href="http://www.postgresql.org/">PostgrelSQL</a>.</p>
</li>
<li>
<p>You have generated your rails app</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;">rails myApp -d postgresql</pre></div></div>

</li>
<li>
<p>You try to run the server</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;">ruby script/server</pre></div></div>

</li>
<li>
<p>You add your DB details in config/database.yml and you notice this note.</p>
<p> On Windows:</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;">#   gem install ruby-postgres
#       Choose the win32 build.
#       Install PostgreSQL and put its /bin directory on your path.</pre></div></div>

</li>
<li>
<p>Install that gem</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;">gem install ruby-postgres</pre></div></div>

<p><i>* I didn&#8217;t get prompted to choose the win32 build but it all installs well.</i>
</li>
<p>From now on, to cut this short, few of the errors that you might encounter:</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;">Please install the postgres adapter: 'gem install activerecord-postgres-adapter'</pre></div></div>

<p>if you try to install that gem you will get this Error</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;">ERROR:  could not find activerecord-postgres-adapter locally or in a repository</pre></div></div>

<p>So try to install this gem instead &#8220;ruby-postgres&#8221; like i mentioned before.</p>
<p>Another prompt you might get is when trying to run the server:</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;">The ordinal 284 could not be located in the dynamic link library SSLEAY32.dll</pre></div></div>

</ol>
<h2>The Solution</h2>
<ol>
<li>
<p>Copy both &#8220;ssleay32.dll&#8221; and &#8220;libeay32.dll&#8221; from Postgresql bin directory. On my machine that&#8217;s:</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;">C:\Program Files\PostgreSQL\8.4\bin</pre></div></div>

</li>
<li>
<p>and put them in Ruby&#8217;s bind directory. On my machine that&#8217;s:</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;">C:\Ruby\bin</pre></div></div>

</li>
<p><i>* It seems those files were already in Ruby&#8217;s bin folder, so overwrite the ones there.</i></p>
<li>And it works!</li>
</ol>
<p><br/></p>
]]></content:encoded>
			<wfw:commentRss>http://www.dnamique.com/setting-up-postgresql-8-with-ruby-on-rails/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Installing mysql gem on MAC OS + XAMPP + Rails 2.3</title>
		<link>http://www.dnamique.com/installing-mysql-gem-on-mac-os-xampp/</link>
		<comments>http://www.dnamique.com/installing-mysql-gem-on-mac-os-xampp/#comments</comments>
		<pubDate>Sun, 08 Nov 2009 12:06:36 +0000</pubDate>
		<dc:creator>Bachir El Khoury</dc:creator>
		
		<category><![CDATA[Ruby on Rails]]></category>

		<guid isPermaLink="false">http://www.dnamique.com/?p=74</guid>
		<description><![CDATA[If you are on a MAC, using the easy going XAMPP and need that rails app to get up and running using mysql, then read on.
So Rails 2 does not come with the mysql gem installed.
You run:
gem install mysql
and to your shock you get:
ERROR:  Error installing mysql:
	ERROR: Failed to build gem native extension.
And in [...]]]></description>
			<content:encoded><![CDATA[<p>If you are on a MAC, using the easy going XAMPP and need that rails app to get up and running using mysql, then read on.</p>
<p>So Rails 2 does not come with the mysql gem installed.</p>
<p>You run:<br />
gem install mysql</p>
<p>and to your shock you get:<br />
ERROR:  Error installing mysql:<br />
	ERROR: Failed to build gem native extension.</p>
<p>And in your log you see:<br />
no such file to load &#8212; mysql</p>
<p>Before you do anything, make sure you download the &#8220;<a href="http://www.apachefriends.org/en/xampp-macosx.html">developer package</a>&#8221; from XAMPP website.</p>
<p>Then in your terminal run this command:</p>
<p>sudo env ARCHFLAGS=&#8221;-arch i386&#8243; gem install mysql &#8212; &#8211;with-mysql-dir=/Applications/XAMPP/xamppfiles/lib/mysql &#8211;with-mysql-lib=/Applications/XAMPP/xamppfiles/lib/mysql/ &#8211;with-mysql-include=/Applications/XAMPP/xamppfiles/include/mysql/</p>
<p>And finally, it worked!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dnamique.com/installing-mysql-gem-on-mac-os-xampp/feed/</wfw:commentRss>
		</item>
		<item>
		<title>CakePHP - Export data to Excel - The easy way!</title>
		<link>http://www.dnamique.com/cakephp-export-data-to-excel-the-easy-way/</link>
		<comments>http://www.dnamique.com/cakephp-export-data-to-excel-the-easy-way/#comments</comments>
		<pubDate>Mon, 26 Oct 2009 02:05:20 +0000</pubDate>
		<dc:creator>Bachir El Khoury</dc:creator>
		
		<category><![CDATA[CakePHP]]></category>

		<guid isPermaLink="false">http://www.dnamique.com/?p=55</guid>
		<description><![CDATA[I am posting this method here just so we never ever ever ever&#8230;
forget what Albert Einstein once said
Everything should be made as simple as possible, but not simpler.
Exporting data to Excel files from a database can be done in so many different ways, using so many libraries and classes such as PEAR&#8217;s Spreadsheet_Excel_Writer
But here comes [...]]]></description>
			<content:encoded><![CDATA[<p>I am posting this method here just so we never ever ever ever&#8230;<br />
forget what Albert Einstein once said</p>
<blockquote><p>Everything should be made as simple as possible, but not simpler.</p></blockquote>
<p>Exporting data to Excel files from a database can be done in so many different ways, using so many libraries and classes such as PEAR&#8217;s <a href="http://pear.php.net/package/Spreadsheet_Excel_Writer">Spreadsheet_Excel_Writer</a></p>
<p>But here comes the easiest and simplest alternative if you are too busy to read too much instructions, or can&#8217;t install any modules or libraries to PHP on your host.</p>
<p>Large code snippets are great, but to save you some copying and pasting just download <a href="http://www.dnamique.com/files/export_xls/export_xls.zip">the source</a>.</p>
<p>In the sample code, my model is called &#8220;Myview&#8221;, although not included in the zip as it can be any model you want, nothing goes in there.<br />
You will also find the controller, layouts and views related.</p>
<p>All you need to is call that export_xls() method in myview_controller.php</p>
<p>All it does is:<br />
- fetch your data with find(&#8217;all&#8217;)<br />
- Renders the layout called &#8220;export_xls.ctp&#8221; in view/layouts<br />
- Renders the view called &#8220;export_xls.ctp&#8221; in view/myview</p>
<p>REMEMBER:<br />
- Excel document grid is a simple html table<br />
- You can stylize and format your table using CSS</p>
<p>That&#8217;s it!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dnamique.com/cakephp-export-data-to-excel-the-easy-way/feed/</wfw:commentRss>
		</item>
		<item>
		<title>File browser for Ruby on Rails</title>
		<link>http://www.dnamique.com/file-browser-for-ruby-on-rails/</link>
		<comments>http://www.dnamique.com/file-browser-for-ruby-on-rails/#comments</comments>
		<pubDate>Thu, 04 Jun 2009 06:57:06 +0000</pubDate>
		<dc:creator>Bachir El Khoury</dc:creator>
		
		<category><![CDATA[Ruby on Rails]]></category>

		<guid isPermaLink="false">http://www.dnamique.com/?p=1</guid>
		<description><![CDATA[I have spent all day yesterday looking for a good(any) Ruby on Rails file explorer or browser for a web application but did not find anything. Few people mentioned Boxroom which looks great except it is an entire web application.
Then I bumped to jQuery File Tree.

jQuery File Tree is a configurable, AJAX file browser plugin [...]]]></description>
			<content:encoded><![CDATA[<p>I have spent all day yesterday looking for a good(any) Ruby on Rails file explorer or browser for a web application but did not find anything. Few people mentioned <a title="Boxroom" href="http://boxroom.rubyforge.org/">Boxroom</a> which looks great except it is an entire web application.<br/><br />
Then I bumped to <a title="jQuery File Tree" href="http://abeautifulsite.net/notebook/58" target="_blank">jQuery File Tree.</a></p>
<blockquote><p>
jQuery File Tree is a configurable, AJAX file browser plugin for jQuery. You can create a customized, fully-interactive file tree with as little as one line of JavaScript code.
</p></blockquote>
<p>It has a Ruby connector but not a Rails one, so I decided to write a connector that I can use with Rails 2.3.<br/><br />
I will show you in very easy steps how to setup this up.<br/><br />
<a href="http://www.dnamique.com/files/file_tree_for_rails/source_0.2.zip">Download the source code.</a><br/><br />
<a href="http://www.dnamique.com/files/file_tree_for_rails/demo_0.2.zip">Download a demo.</a></p>
<ol>
<li>Assuming you have your Rails app created and ready. Open the source zip file and copy both &#8216;app&#8217; and &#8216;public&#8217; folders into your application&#8217;s root.</li>
<p><br/></p>
<li>Next, in the head tag of your layout, add the javascript libraries needed and the jQuery File Tree CSS file.<br/>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #FFCF4F;">&lt;<span style="color: #FFCF4F; font-weight: bold;">script</span> <span style="color: #BB9800; font-weight:bold;">type</span><span style="color: #BB9800;">=</span><span style="color: #DB6E6E;">&quot;text/javascript&quot;</span> <span style="color: #BB9800; font-weight:bold;">src</span><span style="color: #BB9800;">=</span><span style="color: #DB6E6E;">&quot;javascripts/jquery.js&quot;</span>&gt;&lt;<span style="color: #BB9800;">/</span><span style="color: #FFCF4F; font-weight: bold;">script</span>&gt;</span>
<span style="color: #FFCF4F;">&lt;<span style="color: #FFCF4F; font-weight: bold;">script</span> <span style="color: #BB9800; font-weight:bold;">type</span><span style="color: #BB9800;">=</span><span style="color: #DB6E6E;">&quot;text/javascript&quot;</span> <span style="color: #BB9800; font-weight:bold;">src</span><span style="color: #BB9800;">=</span><span style="color: #DB6E6E;">&quot;javascripts/jquery.easing.js&quot;</span>&gt;&lt;<span style="color: #BB9800;">/</span><span style="color: #FFCF4F; font-weight: bold;">script</span>&gt;</span>
<span style="color: #FFCF4F;">&lt;<span style="color: #FFCF4F; font-weight: bold;">script</span> <span style="color: #BB9800; font-weight:bold;">type</span><span style="color: #BB9800;">=</span><span style="color: #DB6E6E;">&quot;text/javascript&quot;</span> <span style="color: #BB9800; font-weight:bold;">src</span><span style="color: #BB9800;">=</span><span style="color: #DB6E6E;">&quot;javascripts/jqueryFileTree.js&quot;</span>&gt;&lt;<span style="color: #BB9800;">/</span><span style="color: #FFCF4F; font-weight: bold;">script</span>&gt;</span>
<span style="color: #FFCF4F;">&lt;<span style="color: #FFCF4F; font-weight: bold;">link</span> <span style="color: #BB9800; font-weight:bold;">rel</span><span style="color: #BB9800;">=</span><span style="color: #DB6E6E;">&quot;stylesheet&quot;</span> <span style="color: #BB9800; font-weight:bold;">href</span><span style="color: #BB9800;">=</span><span style="color: #DB6E6E;">&quot;stylesheets/jqueryFileTree.css&quot;</span> <span style="color: #BB9800; font-weight:bold;">type</span><span style="color: #BB9800;">=</span><span style="color: #DB6E6E;">&quot;text/css&quot;</span><span style="color: #BB9800;">/</span>&gt;</span></pre></div></div>

</li>
<li>Right under that add this style for the page:

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #FFCF4F;">&lt;</span>style type<span style="color: #FFCF4F;">=</span><span style="color: #DB6E6E;">&quot;text/css&quot;</span><span style="color: #FFCF4F;">&gt;</span>
    body <span style="color: #FFCF4F;">&#123;</span>
        background<span style="color: #FFCF4F;">-</span>color<span style="color: #FFCF4F;">:</span>#EEEEEE<span style="color: #FFCF4F;">;</span>
        font<span style="color: #FFCF4F;">-</span>family<span style="color: #FFCF4F;">:</span>Verdana<span style="color: #FFCF4F;">,</span>Arial<span style="color: #FFCF4F;">,</span>Helvetica<span style="color: #FFCF4F;">,</span>sans<span style="color: #FFCF4F;">-</span>serif<span style="color: #FFCF4F;">;</span>
        font<span style="color: #FFCF4F;">-</span>size<span style="color: #FFCF4F;">:</span>11px<span style="color: #FFCF4F;">;</span>
        padding<span style="color: #FFCF4F;">:</span>15px<span style="color: #FFCF4F;">;</span>
    <span style="color: #FFCF4F;">&#125;</span>
    .<span style="color: #BB9800;">demo</span><span style="color: #FFCF4F;">&#123;</span>
        background<span style="color: #FFCF4F;">-</span>color<span style="color: #FFCF4F;">:</span>#FFFFFF<span style="color: #FFCF4F;">;</span>
        border<span style="color: #FFCF4F;">-</span>color<span style="color: #FFCF4F;">:</span>#BBBBBB #FFFFFF #FFFFFF #BBBBBB<span style="color: #FFCF4F;">;</span>
        border<span style="color: #FFCF4F;">-</span>style<span style="color: #FFCF4F;">:</span>solid<span style="color: #FFCF4F;">;</span>
        border<span style="color: #FFCF4F;">-</span>width<span style="color: #FFCF4F;">:</span>1px<span style="color: #FFCF4F;">;</span>
        height<span style="color: #FFCF4F;">:</span>400px<span style="color: #FFCF4F;">;</span>
        overflow<span style="color: #FFCF4F;">:</span><span style="color: #FFCF4F;">scroll</span><span style="color: #FFCF4F;">;</span>
        padding<span style="color: #FFCF4F;">:</span>5px<span style="color: #FFCF4F;">;</span>
        width<span style="color: #FFCF4F;">:</span>200px<span style="color: #FFCF4F;">;</span>
    <span style="color: #FFCF4F;">&#125;</span>
<span style="color: #FFCF4F;">&lt;/</span>style<span style="color: #FFCF4F;">&gt;</span></pre></td></tr></table></div>

</li>
<li>In the body tag, create the div that will carry the File Tree explorer.<br/>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>38
39
</pre></td><td class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #FFCF4F;">&lt;<span style="color: #FFCF4F; font-weight: bold;">h2</span>&gt;</span>jQuery File Tree for Ruby on Rails<span style="color: #FFCF4F;">&lt;<span style="color: #BB9800;">/</span><span style="color: #FFCF4F; font-weight: bold;">h2</span>&gt;</span>
<span style="color: #FFCF4F;">&lt;<span style="color: #FFCF4F; font-weight: bold;">div</span> <span style="color: #BB9800; font-weight:bold;">id</span><span style="color: #BB9800;">=</span><span style="color: #DB6E6E;">&quot;fileTree&quot;</span> <span style="color: #BB9800; font-weight:bold;">class</span><span style="color: #BB9800;">=</span><span style="color: #DB6E6E;">&quot;demo&quot;</span>&gt;&lt;<span style="color: #BB9800;">/</span><span style="color: #FFCF4F; font-weight: bold;">div</span>&gt;</span></pre></td></tr></table></div>

</li>
<li>Now to create our fileTree using jQuery, we add this script in the head tag:

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>29
30
31
32
33
34
35
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;"><span style="color:#F0DFAF; font-weight:bold;"><span style="color: #FFCF4F;">&lt;</span>script type<span style="color: #FFCF4F;">=</span><span style="color: #DB6E6E;">&quot;text/javascript&quot;</span><span style="color: #FFCF4F;">&gt;</span></span>
<span style="color:#F0DFAF; font-weight:bold;">    $<span style="color: #FFCF4F;">&#40;</span>document<span style="color: #FFCF4F;">&#41;</span>.<span style="color: #BB9800;">ready</span><span style="color: #FFCF4F;">&#40;</span> <span style="color: #BB9800; font-weight: bold;">function</span><span style="color: #FFCF4F;">&#40;</span><span style="color: #FFCF4F;">&#41;</span> <span style="color: #FFCF4F;">&#123;</span></span>
<span style="color:#F0DFAF; font-weight:bold;">        $<span style="color: #FFCF4F;">&#40;</span><span style="color: #DB6E6E;">'#fileTree'</span><span style="color: #FFCF4F;">&#41;</span>.<span style="color: #BB9800;">fileTree</span><span style="color: #FFCF4F;">&#40;</span><span style="color: #FFCF4F;">&#123;</span> root<span style="color: #FFCF4F;">:</span> <span style="color: #DB6E6E;">''</span><span style="color: #FFCF4F;">,</span> script<span style="color: #FFCF4F;">:</span> <span style="color: #DB6E6E;">'jqueryfiletree/content'</span> <span style="color: #FFCF4F;">&#125;</span><span style="color: #FFCF4F;">,</span> <span style="color: #BB9800; font-weight: bold;">function</span><span style="color: #FFCF4F;">&#40;</span>file<span style="color: #FFCF4F;">&#41;</span> <span style="color: #FFCF4F;">&#123;</span></span>
<span style="color:#F0DFAF; font-weight:bold;">            <span style="color: #FFCF4F;">alert</span><span style="color: #FFCF4F;">&#40;</span>file<span style="color: #FFCF4F;">&#41;</span><span style="color: #FFCF4F;">;</span></span>
<span style="color:#F0DFAF; font-weight:bold;">        <span style="color: #FFCF4F;">&#125;</span><span style="color: #FFCF4F;">&#41;</span><span style="color: #FFCF4F;">;</span></span>
<span style="color:#F0DFAF; font-weight:bold;">    <span style="color: #FFCF4F;">&#125;</span><span style="color: #FFCF4F;">&#41;</span><span style="color: #FFCF4F;">;</span></span>
<span style="color:#F0DFAF; font-weight:bold;"><span style="color: #FFCF4F;">&lt;/</span>script<span style="color: #FFCF4F;">&gt;</span></span></pre></td></tr></table></div>

<p>@ line 31, you will notice we passed root and script variables to the fileTree method.<br/><br />
root  = the folder you wish to browse, in this case it is an empty string, to point to our public folder. If you wish to point to the images folder, then you type root:&#8221;images/&#8221;<br/><br />
script= controller/method
</li>
<p><br/></p>
<li>Now open config/routes.rb and add this line:

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>2
</pre></td><td class="code"><pre class="ruby" style="font-family:monospace;">map.<span style="color:#bb9800; font-weight:bold;">resources</span> <span style="color:#db6e6e; font-weight:bold;">:jqueryfiletree</span></pre></td></tr></table></div>

</li>
<li>DONE! Run the server and you will see the File Tree browser.</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://www.dnamique.com/file-browser-for-ruby-on-rails/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
