<?xml version="1.0" encoding="iso-8859-1"?><!-- generator="b2evolution/3.3.1" -->
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:admin="http://webns.net/mvcb/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>Tech Ramblings</title>
		<link>http://rtfm.ca/ramble/index.php?blog=4</link>
		<atom:link rel="self" type="application/rss+xml" href="http://rtfm.ca/ramble/index.php?blog=4&#38;tempskin=_rss2" />
		<description></description>
		<language>en-CA</language>
		<docs>http://blogs.law.harvard.edu/tech/rss</docs>
		<admin:generatorAgent rdf:resource="http://b2evolution.net/?v=3.3.1"/>
		<ttl>60</ttl>
				<item>
			<title>MySql Ruby Examples</title>
			<link>http://rtfm.ca/ramble/index.php?blog=4&amp;title=mysql-ruby-examples&amp;more=1&amp;c=1&amp;tb=1&amp;pb=1</link>
			<pubDate>Fri, 16 Jul 2010 05:30:38 +0000</pubDate>			<dc:creator>admin</dc:creator>
			<category domain="main">Programming</category>
<category domain="alt">Rails</category>			<guid isPermaLink="false">82@http://rtfm.ca/ramble/</guid>
						<description>&lt;p&gt;Decided to learn a little more about Ruby by writing a Ruby program to manipulate some MySql tables that I have. I could have used &quot;ActiveRecord&quot; but I wanted to use Ruby classes only. &lt;br /&gt;
Originally I had errors because it was not finding the &lt;a href=&quot;http://rubyforge.org/projects/mysql-win&quot;&gt;MySql gem&lt;/a&gt;. They may be some setting for in some configuration file, but the solution that works for me was to 'include rubygems'. Here is a basic Ruby program to connect to a database and select some information.&lt;/p&gt;
&lt;p class=&quot;amcode&quot;&gt;Code:&lt;/p&gt;&lt;div class=&quot;codeblock amc_code amc_short&quot;&gt;&lt;table&gt;&lt;tr class=&quot;amc_code_odd&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc1&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code&gt;&lt;span class=&quot;amc_default&quot;&gt;require 'rubygems'&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr class=&quot;amc_code_even&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc2&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code&gt;&lt;span class=&quot;amc_default&quot;&gt;require 'mysql'&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr class=&quot;amc_code_odd&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc3&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code&gt;&amp;nbsp;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr class=&quot;amc_code_even&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc4&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code&gt;&lt;span class=&quot;amc_default&quot;&gt;&amp;#160;&amp;#160;con = Mysql.new('localhost', 'root', '', 'db')&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr class=&quot;amc_code_odd&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc5&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code&gt;&lt;span class=&quot;amc_default&quot;&gt;&amp;#160;&amp;#160;puts &quot;Server version: &quot; + con.get_server_info&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr class=&quot;amc_code_even&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc6&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code&gt;&lt;span class=&quot;amc_default&quot;&gt;&amp;#160;&amp;#160;stmt = &quot;select id, name from users where id = 1&quot;&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr class=&quot;amc_code_odd&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc7&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code&gt;&lt;span class=&quot;amc_default&quot;&gt;&amp;#160;&amp;#160;rs = con.query(stmt)&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr class=&quot;amc_code_even&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc8&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code&gt;&lt;span class=&quot;amc_default&quot;&gt;&amp;#160;&amp;#160;puts &quot;Number of rows returned: #{rs.num_rows}&quot;&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;&lt;/div&gt;
&lt;p&gt;Of course it would be nice to see the results. The reasonably written &lt;a href=&quot;http://www.tmtm.org/en/ruby/mysql/&quot;&gt;documentation&lt;/a&gt; has no examples so I have included them here. There are different ways of fetching rows, using &lt;strong&gt;each&lt;/strong&gt; or &lt;strong&gt;each_hash&lt;/strong&gt;. I prefer the hash because I like to use column names rather then numbers. &lt;/p&gt;
&lt;p class=&quot;amcode&quot;&gt;Code:&lt;/p&gt;&lt;div class=&quot;codeblock amc_code amc_short&quot;&gt;&lt;table&gt;&lt;tr class=&quot;amc_code_odd&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc1&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code&gt;&lt;span class=&quot;amc_default&quot;&gt;rs.each_hash do |row| &lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr class=&quot;amc_code_even&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc2&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code&gt;&lt;span class=&quot;amc_default&quot;&gt;&amp;#160;&amp;#160;puts &quot;ID:#{row['id']} Name:#{row['name']}.&quot;&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr class=&quot;amc_code_odd&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc3&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code&gt;&lt;span class=&quot;amc_default&quot;&gt;end&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;&lt;/div&gt;
&lt;p&gt;And here is &lt;strong&gt;each&lt;/strong&gt;:&lt;/p&gt;
&lt;p class=&quot;amcode&quot;&gt;Code:&lt;/p&gt;&lt;div class=&quot;codeblock amc_code amc_short&quot;&gt;&lt;table&gt;&lt;tr class=&quot;amc_code_odd&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc1&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code&gt;&lt;span class=&quot;amc_default&quot;&gt;rs.each do |row|&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr class=&quot;amc_code_even&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc2&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code&gt;&lt;span class=&quot;amc_default&quot;&gt;&amp;#160;&amp;#160;puts &quot;ID:#{row[0]} Name:#{row[1]}.&quot;&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr class=&quot;amc_code_odd&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc3&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code&gt;&lt;span class=&quot;amc_default&quot;&gt;end&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;&lt;/div&gt;
&lt;p&gt;Now that we have selected, lets try a couple of other functions:&lt;/p&gt;
&lt;p class=&quot;amcode&quot;&gt;Code:&lt;/p&gt;&lt;div class=&quot;codeblock amc_code amc_short&quot;&gt;&lt;table&gt;&lt;tr class=&quot;amc_code_odd&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc1&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code&gt;&lt;span class=&quot;amc_default&quot;&gt;# Now insert!&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr class=&quot;amc_code_even&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc2&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code&gt;&lt;span class=&quot;amc_default&quot;&gt;stmt = &quot;Insert into users (name) values ('fred')&quot;&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr class=&quot;amc_code_odd&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc3&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code&gt;&lt;span class=&quot;amc_default&quot;&gt;con.query(stmt) &lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr class=&quot;amc_code_even&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc4&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code&gt;&lt;span class=&quot;amc_default&quot;&gt;puts &quot;Number of rows inserted: #{con.affected_rows}&quot;&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr class=&quot;amc_code_odd&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc5&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code&gt;&amp;nbsp;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr class=&quot;amc_code_even&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc6&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code&gt;&lt;span class=&quot;amc_default&quot;&gt;# Now update&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr class=&quot;amc_code_odd&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc7&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code&gt;&lt;span class=&quot;amc_default&quot;&gt;stmt = &quot;update users set email='fred@flintstone.ca'&amp;#160;&amp;#160;where name='fred' &quot;&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr class=&quot;amc_code_even&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc8&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code&gt;&lt;span class=&quot;amc_default&quot;&gt;con.query(stmt) &lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr class=&quot;amc_code_odd&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc9&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code&gt;&lt;span class=&quot;amc_default&quot;&gt;puts &quot;Number of rows updated: #{con.affected_rows}&quot;&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;&lt;/div&gt;
&lt;p&gt;Of course you can also perform other functions like creating tables, adding columns, you get the idea. Just for added fun, here are some other snippets, this first one prints out fields names of a table, in this case the 'secrets' table followed by a list of databases:&lt;/p&gt;
&lt;p class=&quot;amcode&quot;&gt;Code:&lt;/p&gt;&lt;div class=&quot;codeblock amc_code amc_short&quot;&gt;&lt;table&gt;&lt;tr class=&quot;amc_code_odd&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc1&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code&gt;&lt;span class=&quot;amc_default&quot;&gt;con.list_fields('secrets').fetch_fields.each do |f|&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr class=&quot;amc_code_even&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc2&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code&gt;&lt;span class=&quot;amc_default&quot;&gt;&amp;#160;&amp;#160;puts &quot;Field name : #{f.name} &quot;&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr class=&quot;amc_code_odd&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc3&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code&gt;&lt;span class=&quot;amc_default&quot;&gt;end &lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr class=&quot;amc_code_even&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc4&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code&gt;&lt;span class=&quot;amc_default&quot;&gt; &lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr class=&quot;amc_code_odd&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc5&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code&gt;&lt;span class=&quot;amc_default&quot;&gt;con.list_dbs.each do |db|&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr class=&quot;amc_code_even&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc6&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code&gt;&lt;span class=&quot;amc_default&quot;&gt;&amp;#160;&amp;#160;puts &quot;db = #{db} &quot;&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr class=&quot;amc_code_odd&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc7&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code&gt;&lt;span class=&quot;amc_default&quot;&gt;end&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;&lt;/div&gt;&lt;div class=&quot;item_footer&quot;&gt;&lt;p&gt;&lt;small&gt;&lt;a href=&quot;http://rtfm.ca/ramble/index.php?blog=4&amp;amp;title=mysql-ruby-examples&amp;amp;more=1&amp;amp;c=1&amp;amp;tb=1&amp;amp;pb=1&quot;&gt;Original post&lt;/a&gt; blogged on &lt;a href=&quot;http://b2evolution.net/&quot;&gt;b2evolution&lt;/a&gt;.&lt;/small&gt;&lt;/p&gt;&lt;/div&gt;</description>
			<content:encoded><![CDATA[<p>Decided to learn a little more about Ruby by writing a Ruby program to manipulate some MySql tables that I have. I could have used "ActiveRecord" but I wanted to use Ruby classes only. <br />
Originally I had errors because it was not finding the <a href="http://rubyforge.org/projects/mysql-win">MySql gem</a>. They may be some setting for in some configuration file, but the solution that works for me was to 'include rubygems'. Here is a basic Ruby program to connect to a database and select some information.</p>
<p class="amcode">Code:</p><div class="codeblock amc_code amc_short"><table><tr class="amc_code_odd"><td class="amc_line"><div class="amc1"></div></td><td><code><span class="amc_default">require 'rubygems'</span></code></td></tr>
<tr class="amc_code_even"><td class="amc_line"><div class="amc2"></div></td><td><code><span class="amc_default">require 'mysql'</span></code></td></tr>
<tr class="amc_code_odd"><td class="amc_line"><div class="amc3"></div></td><td><code>&nbsp;</code></td></tr>
<tr class="amc_code_even"><td class="amc_line"><div class="amc4"></div></td><td><code><span class="amc_default">&#160;&#160;con = Mysql.new('localhost', 'root', '', 'db')</span></code></td></tr>
<tr class="amc_code_odd"><td class="amc_line"><div class="amc5"></div></td><td><code><span class="amc_default">&#160;&#160;puts "Server version: " + con.get_server_info</span></code></td></tr>
<tr class="amc_code_even"><td class="amc_line"><div class="amc6"></div></td><td><code><span class="amc_default">&#160;&#160;stmt = "select id, name from users where id = 1"</span></code></td></tr>
<tr class="amc_code_odd"><td class="amc_line"><div class="amc7"></div></td><td><code><span class="amc_default">&#160;&#160;rs = con.query(stmt)</span></code></td></tr>
<tr class="amc_code_even"><td class="amc_line"><div class="amc8"></div></td><td><code><span class="amc_default">&#160;&#160;puts "Number of rows returned: #{rs.num_rows}"</span></code></td></tr>
</table></div>
<p>Of course it would be nice to see the results. The reasonably written <a href="http://www.tmtm.org/en/ruby/mysql/">documentation</a> has no examples so I have included them here. There are different ways of fetching rows, using <strong>each</strong> or <strong>each_hash</strong>. I prefer the hash because I like to use column names rather then numbers. </p>
<p class="amcode">Code:</p><div class="codeblock amc_code amc_short"><table><tr class="amc_code_odd"><td class="amc_line"><div class="amc1"></div></td><td><code><span class="amc_default">rs.each_hash do |row| </span></code></td></tr>
<tr class="amc_code_even"><td class="amc_line"><div class="amc2"></div></td><td><code><span class="amc_default">&#160;&#160;puts "ID:#{row['id']} Name:#{row['name']}."</span></code></td></tr>
<tr class="amc_code_odd"><td class="amc_line"><div class="amc3"></div></td><td><code><span class="amc_default">end</span></code></td></tr>
</table></div>
<p>And here is <strong>each</strong>:</p>
<p class="amcode">Code:</p><div class="codeblock amc_code amc_short"><table><tr class="amc_code_odd"><td class="amc_line"><div class="amc1"></div></td><td><code><span class="amc_default">rs.each do |row|</span></code></td></tr>
<tr class="amc_code_even"><td class="amc_line"><div class="amc2"></div></td><td><code><span class="amc_default">&#160;&#160;puts "ID:#{row[0]} Name:#{row[1]}."</span></code></td></tr>
<tr class="amc_code_odd"><td class="amc_line"><div class="amc3"></div></td><td><code><span class="amc_default">end</span></code></td></tr>
</table></div>
<p>Now that we have selected, lets try a couple of other functions:</p>
<p class="amcode">Code:</p><div class="codeblock amc_code amc_short"><table><tr class="amc_code_odd"><td class="amc_line"><div class="amc1"></div></td><td><code><span class="amc_default"># Now insert!</span></code></td></tr>
<tr class="amc_code_even"><td class="amc_line"><div class="amc2"></div></td><td><code><span class="amc_default">stmt = "Insert into users (name) values ('fred')"</span></code></td></tr>
<tr class="amc_code_odd"><td class="amc_line"><div class="amc3"></div></td><td><code><span class="amc_default">con.query(stmt) </span></code></td></tr>
<tr class="amc_code_even"><td class="amc_line"><div class="amc4"></div></td><td><code><span class="amc_default">puts "Number of rows inserted: #{con.affected_rows}"</span></code></td></tr>
<tr class="amc_code_odd"><td class="amc_line"><div class="amc5"></div></td><td><code>&nbsp;</code></td></tr>
<tr class="amc_code_even"><td class="amc_line"><div class="amc6"></div></td><td><code><span class="amc_default"># Now update</span></code></td></tr>
<tr class="amc_code_odd"><td class="amc_line"><div class="amc7"></div></td><td><code><span class="amc_default">stmt = "update users set email='fred@flintstone.ca'&#160;&#160;where name='fred' "</span></code></td></tr>
<tr class="amc_code_even"><td class="amc_line"><div class="amc8"></div></td><td><code><span class="amc_default">con.query(stmt) </span></code></td></tr>
<tr class="amc_code_odd"><td class="amc_line"><div class="amc9"></div></td><td><code><span class="amc_default">puts "Number of rows updated: #{con.affected_rows}"</span></code></td></tr>
</table></div>
<p>Of course you can also perform other functions like creating tables, adding columns, you get the idea. Just for added fun, here are some other snippets, this first one prints out fields names of a table, in this case the 'secrets' table followed by a list of databases:</p>
<p class="amcode">Code:</p><div class="codeblock amc_code amc_short"><table><tr class="amc_code_odd"><td class="amc_line"><div class="amc1"></div></td><td><code><span class="amc_default">con.list_fields('secrets').fetch_fields.each do |f|</span></code></td></tr>
<tr class="amc_code_even"><td class="amc_line"><div class="amc2"></div></td><td><code><span class="amc_default">&#160;&#160;puts "Field name : #{f.name} "</span></code></td></tr>
<tr class="amc_code_odd"><td class="amc_line"><div class="amc3"></div></td><td><code><span class="amc_default">end </span></code></td></tr>
<tr class="amc_code_even"><td class="amc_line"><div class="amc4"></div></td><td><code><span class="amc_default"> </span></code></td></tr>
<tr class="amc_code_odd"><td class="amc_line"><div class="amc5"></div></td><td><code><span class="amc_default">con.list_dbs.each do |db|</span></code></td></tr>
<tr class="amc_code_even"><td class="amc_line"><div class="amc6"></div></td><td><code><span class="amc_default">&#160;&#160;puts "db = #{db} "</span></code></td></tr>
<tr class="amc_code_odd"><td class="amc_line"><div class="amc7"></div></td><td><code><span class="amc_default">end</span></code></td></tr>
</table></div><div class="item_footer"><p><small><a href="http://rtfm.ca/ramble/index.php?blog=4&amp;title=mysql-ruby-examples&amp;more=1&amp;c=1&amp;tb=1&amp;pb=1">Original post</a> blogged on <a href="http://b2evolution.net/">b2evolution</a>.</small></p></div>]]></content:encoded>
								<comments>http://rtfm.ca/ramble/index.php?blog=4&amp;title=mysql-ruby-examples&amp;more=1&amp;c=1&amp;tb=1&amp;pb=1#comments</comments>
			<wfw:commentRss>http://rtfm.ca/ramble/index.php?blog=4&#38;tempskin=_rss2&#38;disp=comments&#38;p=82</wfw:commentRss>
		</item>
				<item>
			<title>Fabricating Robots</title>
			<link>http://rtfm.ca/ramble/index.php?blog=4&amp;title=fabricating-robots&amp;more=1&amp;c=1&amp;tb=1&amp;pb=1</link>
			<pubDate>Tue, 13 Jul 2010 17:11:14 +0000</pubDate>			<dc:creator>admin</dc:creator>
			<category domain="main">Programming</category>
<category domain="alt">Rails</category>			<guid isPermaLink="false">81@http://rtfm.ca/ramble/</guid>
						<description>&lt;p&gt;Working today on a Rails app that groups client generated webapges and we need to have the ability to screen out &quot;child safety challenged&quot; and &quot;naughtyware&quot; from being indexed by google so we are not blacklisted from adwords. The final step was generating the &lt;a href=&quot;http://www.robotstxt.org/meta.html&quot;&gt;robots meta tag&lt;/a&gt; to either index or not. So I was able to use the line:&lt;/p&gt;
&lt;p class=&quot;amcode&quot;&gt;Code:&lt;/p&gt;&lt;div class=&quot;codeblock amc_code amc_short&quot;&gt;&lt;table&gt;&lt;tr class=&quot;amc_code_odd&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc1&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code&gt;&lt;span class=&quot;amc_default&quot;&gt;&amp;lt;meta name=&quot;robots&quot; content=&quot;&amp;lt;%= fabricate_robots %&amp;gt;&quot; /&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;&lt;/div&gt;
&lt;p&gt;After looking at that line, I suddenly really enjoyed the fact that it appears that I am fabricating robots...&lt;/p&gt;&lt;div class=&quot;item_footer&quot;&gt;&lt;p&gt;&lt;small&gt;&lt;a href=&quot;http://rtfm.ca/ramble/index.php?blog=4&amp;amp;title=fabricating-robots&amp;amp;more=1&amp;amp;c=1&amp;amp;tb=1&amp;amp;pb=1&quot;&gt;Original post&lt;/a&gt; blogged on &lt;a href=&quot;http://b2evolution.net/&quot;&gt;b2evolution&lt;/a&gt;.&lt;/small&gt;&lt;/p&gt;&lt;/div&gt;</description>
			<content:encoded><![CDATA[<p>Working today on a Rails app that groups client generated webapges and we need to have the ability to screen out "child safety challenged" and "naughtyware" from being indexed by google so we are not blacklisted from adwords. The final step was generating the <a href="http://www.robotstxt.org/meta.html">robots meta tag</a> to either index or not. So I was able to use the line:</p>
<p class="amcode">Code:</p><div class="codeblock amc_code amc_short"><table><tr class="amc_code_odd"><td class="amc_line"><div class="amc1"></div></td><td><code><span class="amc_default">&lt;meta name="robots" content="&lt;%= fabricate_robots %&gt;" /&gt;</span></code></td></tr>
</table></div>
<p>After looking at that line, I suddenly really enjoyed the fact that it appears that I am fabricating robots...</p><div class="item_footer"><p><small><a href="http://rtfm.ca/ramble/index.php?blog=4&amp;title=fabricating-robots&amp;more=1&amp;c=1&amp;tb=1&amp;pb=1">Original post</a> blogged on <a href="http://b2evolution.net/">b2evolution</a>.</small></p></div>]]></content:encoded>
								<comments>http://rtfm.ca/ramble/index.php?blog=4&amp;title=fabricating-robots&amp;more=1&amp;c=1&amp;tb=1&amp;pb=1#comments</comments>
			<wfw:commentRss>http://rtfm.ca/ramble/index.php?blog=4&#38;tempskin=_rss2&#38;disp=comments&#38;p=81</wfw:commentRss>
		</item>
				<item>
			<title>Firefox Addon</title>
			<link>http://rtfm.ca/ramble/index.php?blog=4&amp;title=firefox-addon&amp;more=1&amp;c=1&amp;tb=1&amp;pb=1</link>
			<pubDate>Tue, 15 Jun 2010 19:33:53 +0000</pubDate>			<dc:creator>admin</dc:creator>
			<category domain="main">Programming</category>			<guid isPermaLink="false">80@http://rtfm.ca/ramble/</guid>
						<description>&lt;p&gt;Built my first firefox plugin! Fun to see something like this working. Here are the steps to just get a basic one up and running.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Turn on All Debugging&lt;/strong&gt;&lt;br /&gt;
You should have:&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://addons.mozilla.org/en-US/firefox/addon/1843/&quot;&gt;Firebug&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://addons.mozilla.org/en-US/firefox/addon/1815/&quot;&gt;Console&lt;sup&gt;2&lt;/sup&gt;&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://addons.mozilla.org/en-US/firefox/addon/6622/&quot;&gt;Dom inspecter&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;In about:config set to true:&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;extensions.logging.enabled&lt;/li&gt;
  &lt;li&gt;javascript.options.showInConsole&lt;/li&gt;
  &lt;li&gt;browser.dom.window.dump.enabled (note: you add this one!)&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;strong&gt;Setup an Projects directory under mozilla&lt;/strong&gt;&lt;br /&gt;
&lt;code&gt;win: \path2\Mozilla\Firefox\Projects\yourExtensionName&lt;/code&gt;&lt;br /&gt;
&lt;code&gt;linux: ~/.mozilla/firefox/Projects\yourExtensionName&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Note that Projects and Profiles are not to be confused! You may want a different Project/Profile name. I chose the same to know what project &amp;amp; what profile to use for testing!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Setup an Profiles directory under mozilla&lt;/strong&gt;&lt;br /&gt;
&lt;code&gt;win: \path2\Mozilla\Firefox\Profiles\yourExtensionName&lt;/code&gt;&lt;br /&gt;
&lt;code&gt;linux: ~/.mozilla/firefox/Profile\yourExtensionName&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Setup a profile on firefox&lt;/strong&gt;&lt;br /&gt;
Place the profile you are about to create under the above created directories. To do this use Firefox's &lt;a href=&quot;http://kb.mozillazine.org/Profile_Manager&quot;&gt;profile manager&lt;/a&gt;:&lt;/p&gt;
&lt;p class=&quot;amcode&quot;&gt;Code:&lt;/p&gt;&lt;div class=&quot;codeblock amc_code amc_short&quot;&gt;&lt;table&gt;&lt;tr class=&quot;amc_code_odd&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc1&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code&gt;&lt;span class=&quot;amc_default&quot;&gt;firefox firefox -p&amp;#160;&amp;#160;// win&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr class=&quot;amc_code_even&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc2&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code&gt;&lt;span class=&quot;amc_default&quot;&gt;&amp;#160;&amp;#160; (may have to set windows env var: MOZ_NO_REMOTE=1&amp;#160;&amp;#160;???&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr class=&quot;amc_code_odd&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc3&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code&gt;&lt;span class=&quot;amc_default&quot;&gt;firefox -ProfileManager -no-remote&amp;#160;&amp;#160;&amp;#160;&amp;#160;// Linux&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;&lt;/div&gt;
&lt;p&gt;In my case I used the yourExtensionName as the profile name.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Setup Files Required&lt;/strong&gt;&lt;br /&gt;
Google it to find the directory structure you need as well as the base content for the following base files:&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;install.rdf&lt;/li&gt;  
  &lt;li&gt;chrome.manifest&lt;/li&gt;
  &lt;li&gt;XUL files (this in directory content, its your coding!)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;These files will be in the &lt;br /&gt;
&lt;code&gt;Projects/yourExtensionName/&lt;/code&gt; &lt;br /&gt;
directory.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Development Tip&lt;/strong&gt;&lt;br /&gt;
You will want Firefox to automatically load the addon each time you code changes to the extension, so in the folder&lt;br /&gt;
&lt;code&gt;Projects/yourExtensionName/extensions&lt;/code&gt; &lt;br /&gt;
have a file name like: &lt;br /&gt;
&lt;code&gt;&lt;a href=&quot;mailto:extensionname@your.unique.name&quot;&gt;extensionname@your.unique.name&lt;/a&gt;&lt;/code&gt;. &lt;br /&gt;
This should match the &lt;strong&gt;id&lt;/strong&gt; tag in the &lt;strong&gt;install.rdf&lt;/strong&gt; manifest file. Note you will have to restart firefox to pick up the changes.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Gotchas&lt;/strong&gt;&lt;br /&gt;
In the install.rdf file make sure that the tags:&lt;/p&gt;
&lt;p class=&quot;amcode&quot;&gt;Code:&lt;/p&gt;&lt;div class=&quot;codeblock amc_code amc_short&quot;&gt;&lt;table&gt;&lt;tr class=&quot;amc_code_odd&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc1&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code&gt;&lt;span class=&quot;amc_default&quot;&gt;&amp;lt;em:minVersion&amp;gt;3.0&amp;lt;/em:minVersion&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr class=&quot;amc_code_even&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc2&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code&gt;&lt;span class=&quot;amc_default&quot;&gt;&amp;#160;&amp;#160;&amp;lt;em:maxVersion&amp;gt;3.6.4&amp;lt;/em:maxVersion&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;&lt;/div&gt;
&lt;p&gt;allow for your version of Firefox!&lt;/p&gt;&lt;div class=&quot;item_footer&quot;&gt;&lt;p&gt;&lt;small&gt;&lt;a href=&quot;http://rtfm.ca/ramble/index.php?blog=4&amp;amp;title=firefox-addon&amp;amp;more=1&amp;amp;c=1&amp;amp;tb=1&amp;amp;pb=1&quot;&gt;Original post&lt;/a&gt; blogged on &lt;a href=&quot;http://b2evolution.net/&quot;&gt;b2evolution&lt;/a&gt;.&lt;/small&gt;&lt;/p&gt;&lt;/div&gt;</description>
			<content:encoded><![CDATA[<p>Built my first firefox plugin! Fun to see something like this working. Here are the steps to just get a basic one up and running.</p>

<p><strong>Turn on All Debugging</strong><br />
You should have:</p>
<ul>
  <li><a href="https://addons.mozilla.org/en-US/firefox/addon/1843/">Firebug</a></li>
  <li><a href="https://addons.mozilla.org/en-US/firefox/addon/1815/">Console<sup>2</sup></a></li>
  <li><a href="https://addons.mozilla.org/en-US/firefox/addon/6622/">Dom inspecter</a></li>
</ul>
<p>In about:config set to true:</p>
<ul>
  <li>extensions.logging.enabled</li>
  <li>javascript.options.showInConsole</li>
  <li>browser.dom.window.dump.enabled (note: you add this one!)</li>
</ul>




<p><strong>Setup an Projects directory under mozilla</strong><br />
<code>win: \path2\Mozilla\Firefox\Projects\yourExtensionName</code><br />
<code>linux: ~/.mozilla/firefox/Projects\yourExtensionName</code></p>

<p>Note that Projects and Profiles are not to be confused! You may want a different Project/Profile name. I chose the same to know what project &amp; what profile to use for testing!</p>

<p><strong>Setup an Profiles directory under mozilla</strong><br />
<code>win: \path2\Mozilla\Firefox\Profiles\yourExtensionName</code><br />
<code>linux: ~/.mozilla/firefox/Profile\yourExtensionName</code></p>

<p><strong>Setup a profile on firefox</strong><br />
Place the profile you are about to create under the above created directories. To do this use Firefox's <a href="http://kb.mozillazine.org/Profile_Manager">profile manager</a>:</p>
<p class="amcode">Code:</p><div class="codeblock amc_code amc_short"><table><tr class="amc_code_odd"><td class="amc_line"><div class="amc1"></div></td><td><code><span class="amc_default">firefox firefox -p&#160;&#160;// win</span></code></td></tr>
<tr class="amc_code_even"><td class="amc_line"><div class="amc2"></div></td><td><code><span class="amc_default">&#160;&#160; (may have to set windows env var: MOZ_NO_REMOTE=1&#160;&#160;???</span></code></td></tr>
<tr class="amc_code_odd"><td class="amc_line"><div class="amc3"></div></td><td><code><span class="amc_default">firefox -ProfileManager -no-remote&#160;&#160;&#160;&#160;// Linux</span></code></td></tr>
</table></div>
<p>In my case I used the yourExtensionName as the profile name.</p>

<p><strong>Setup Files Required</strong><br />
Google it to find the directory structure you need as well as the base content for the following base files:</p>
<ul>
  <li>install.rdf</li>  
  <li>chrome.manifest</li>
  <li>XUL files (this in directory content, its your coding!)</li>
</ul>
<p>These files will be in the <br />
<code>Projects/yourExtensionName/</code> <br />
directory.</p>

<p><strong>Development Tip</strong><br />
You will want Firefox to automatically load the addon each time you code changes to the extension, so in the folder<br />
<code>Projects/yourExtensionName/extensions</code> <br />
have a file name like: <br />
<code><a href="http://rtfm.camailto:extensionname@your.unique.name">extensionname@your.unique.name</a></code>. <br />
This should match the <strong>id</strong> tag in the <strong>install.rdf</strong> manifest file. Note you will have to restart firefox to pick up the changes.</p>

<p><strong>Gotchas</strong><br />
In the install.rdf file make sure that the tags:</p>
<p class="amcode">Code:</p><div class="codeblock amc_code amc_short"><table><tr class="amc_code_odd"><td class="amc_line"><div class="amc1"></div></td><td><code><span class="amc_default">&lt;em:minVersion&gt;3.0&lt;/em:minVersion&gt;</span></code></td></tr>
<tr class="amc_code_even"><td class="amc_line"><div class="amc2"></div></td><td><code><span class="amc_default">&#160;&#160;&lt;em:maxVersion&gt;3.6.4&lt;/em:maxVersion&gt;</span></code></td></tr>
</table></div>
<p>allow for your version of Firefox!</p><div class="item_footer"><p><small><a href="http://rtfm.ca/ramble/index.php?blog=4&amp;title=firefox-addon&amp;more=1&amp;c=1&amp;tb=1&amp;pb=1">Original post</a> blogged on <a href="http://b2evolution.net/">b2evolution</a>.</small></p></div>]]></content:encoded>
								<comments>http://rtfm.ca/ramble/index.php?blog=4&amp;title=firefox-addon&amp;more=1&amp;c=1&amp;tb=1&amp;pb=1#comments</comments>
			<wfw:commentRss>http://rtfm.ca/ramble/index.php?blog=4&#38;tempskin=_rss2&#38;disp=comments&#38;p=80</wfw:commentRss>
		</item>
				<item>
			<title>Passing Ruby vars to Javascript</title>
			<link>http://rtfm.ca/ramble/index.php?blog=4&amp;title=passing-ruby-vars-to-javascript&amp;more=1&amp;c=1&amp;tb=1&amp;pb=1</link>
			<pubDate>Thu, 10 Jun 2010 19:50:42 +0000</pubDate>			<dc:creator>admin</dc:creator>
			<category domain="main">GIS</category>			<guid isPermaLink="false">79@http://rtfm.ca/ramble/</guid>
						<description>&lt;p&gt;It may not be the best way of doing things, but it is the way I am doing it. I need to pass a Ruby variable to a javascript function, here's how:&lt;/p&gt;

&lt;pre&gt;&amp;lt;%  @x = &quot;#{params[:shortened_url]}&quot;  %&amp;gt;
&amp;lt;a href=&quot;javascript:task('&amp;lt;%=  @x -%&amp;gt;')&quot;&gt;Do it&amp;lt;/a&gt;
&lt;/pre&gt;&lt;div class=&quot;item_footer&quot;&gt;&lt;p&gt;&lt;small&gt;&lt;a href=&quot;http://rtfm.ca/ramble/index.php?blog=4&amp;amp;title=passing-ruby-vars-to-javascript&amp;amp;more=1&amp;amp;c=1&amp;amp;tb=1&amp;amp;pb=1&quot;&gt;Original post&lt;/a&gt; blogged on &lt;a href=&quot;http://b2evolution.net/&quot;&gt;b2evolution&lt;/a&gt;.&lt;/small&gt;&lt;/p&gt;&lt;/div&gt;</description>
			<content:encoded><![CDATA[<p>It may not be the best way of doing things, but it is the way I am doing it. I need to pass a Ruby variable to a javascript function, here's how:</p>

<pre>&lt;%  @x = "#{params[:shortened_url]}"  %&gt;
&lt;a href="javascript:task('&lt;%=  @x -%&gt;')">Do it&lt;/a>
</pre><div class="item_footer"><p><small><a href="http://rtfm.ca/ramble/index.php?blog=4&amp;title=passing-ruby-vars-to-javascript&amp;more=1&amp;c=1&amp;tb=1&amp;pb=1">Original post</a> blogged on <a href="http://b2evolution.net/">b2evolution</a>.</small></p></div>]]></content:encoded>
								<comments>http://rtfm.ca/ramble/index.php?blog=4&amp;title=passing-ruby-vars-to-javascript&amp;more=1&amp;c=1&amp;tb=1&amp;pb=1#comments</comments>
			<wfw:commentRss>http://rtfm.ca/ramble/index.php?blog=4&#38;tempskin=_rss2&#38;disp=comments&#38;p=79</wfw:commentRss>
		</item>
				<item>
			<title>New Installation Headaches</title>
			<link>http://rtfm.ca/ramble/index.php?blog=4&amp;title=new-installation-headaches&amp;more=1&amp;c=1&amp;tb=1&amp;pb=1</link>
			<pubDate>Sat, 05 Jun 2010 05:59:49 +0000</pubDate>			<dc:creator>admin</dc:creator>
			<category domain="main">GIS</category>			<guid isPermaLink="false">78@http://rtfm.ca/ramble/</guid>
						<description>&lt;p&gt;I need to have a Linux instance running for a Rails app that I am to fix. That means I need Ruby, Rails, and MySql. Not sure yet about apache-passenger.&lt;br /&gt;
I like the command line, but since I have not used it much lately I am learning by being burnt by simple mistakes and just not knowing. When I know what I want to do and cannot do it because of some simple mistake, its frustrating. I have done all this on windows awhile ago and know how to do it easily &amp;amp; quickly. Now on Linux I want it to go just as fast and I don't do well knowing what has to be done and seeing very slow progress.&lt;br /&gt;
Headache city as I know more about software then installation of these. I am having trouble with mysql mostly, getting permissions and things working. I am trying to run:&lt;/p&gt;
&lt;p class=&quot;amcode&quot;&gt;Code:&lt;/p&gt;&lt;div class=&quot;codeblock amc_code amc_short&quot;&gt;&lt;table&gt;&lt;tr class=&quot;amc_code_odd&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc1&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code&gt;&lt;span class=&quot;amc_default&quot;&gt;mysqlimport -u clusterurl -p clusterurl_development clusterurl_production.backupfile.sql&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;&lt;/div&gt;
&lt;p&gt;and am getting &lt;strong&gt;Access Denied&lt;/strong&gt; errors. I did it quickly on the first attempt on my windows mysql installation, but the Linux one I'm setting permissions and there is a small piece missing somewhere as its late and I typed &lt;strong&gt;priviledge&lt;/strong&gt; a dozen times instead of &lt;strong&gt;privilege&lt;/strong&gt;. I've been at it a couple of hours.&lt;br /&gt;
I think I will post a little list of MySql commands that I know I will be using often.&lt;br /&gt;
Off to bed...&lt;/p&gt;&lt;div class=&quot;item_footer&quot;&gt;&lt;p&gt;&lt;small&gt;&lt;a href=&quot;http://rtfm.ca/ramble/index.php?blog=4&amp;amp;title=new-installation-headaches&amp;amp;more=1&amp;amp;c=1&amp;amp;tb=1&amp;amp;pb=1&quot;&gt;Original post&lt;/a&gt; blogged on &lt;a href=&quot;http://b2evolution.net/&quot;&gt;b2evolution&lt;/a&gt;.&lt;/small&gt;&lt;/p&gt;&lt;/div&gt;</description>
			<content:encoded><![CDATA[<p>I need to have a Linux instance running for a Rails app that I am to fix. That means I need Ruby, Rails, and MySql. Not sure yet about apache-passenger.<br />
I like the command line, but since I have not used it much lately I am learning by being burnt by simple mistakes and just not knowing. When I know what I want to do and cannot do it because of some simple mistake, its frustrating. I have done all this on windows awhile ago and know how to do it easily &amp; quickly. Now on Linux I want it to go just as fast and I don't do well knowing what has to be done and seeing very slow progress.<br />
Headache city as I know more about software then installation of these. I am having trouble with mysql mostly, getting permissions and things working. I am trying to run:</p>
<p class="amcode">Code:</p><div class="codeblock amc_code amc_short"><table><tr class="amc_code_odd"><td class="amc_line"><div class="amc1"></div></td><td><code><span class="amc_default">mysqlimport -u clusterurl -p clusterurl_development clusterurl_production.backupfile.sql</span></code></td></tr>
</table></div>
<p>and am getting <strong>Access Denied</strong> errors. I did it quickly on the first attempt on my windows mysql installation, but the Linux one I'm setting permissions and there is a small piece missing somewhere as its late and I typed <strong>priviledge</strong> a dozen times instead of <strong>privilege</strong>. I've been at it a couple of hours.<br />
I think I will post a little list of MySql commands that I know I will be using often.<br />
Off to bed...</p><div class="item_footer"><p><small><a href="http://rtfm.ca/ramble/index.php?blog=4&amp;title=new-installation-headaches&amp;more=1&amp;c=1&amp;tb=1&amp;pb=1">Original post</a> blogged on <a href="http://b2evolution.net/">b2evolution</a>.</small></p></div>]]></content:encoded>
								<comments>http://rtfm.ca/ramble/index.php?blog=4&amp;title=new-installation-headaches&amp;more=1&amp;c=1&amp;tb=1&amp;pb=1#comments</comments>
			<wfw:commentRss>http://rtfm.ca/ramble/index.php?blog=4&#38;tempskin=_rss2&#38;disp=comments&#38;p=78</wfw:commentRss>
		</item>
				<item>
			<title>Virtualbox</title>
			<link>http://rtfm.ca/ramble/index.php?blog=4&amp;title=virtualbox&amp;more=1&amp;c=1&amp;tb=1&amp;pb=1</link>
			<pubDate>Sat, 05 Jun 2010 05:47:49 +0000</pubDate>			<dc:creator>admin</dc:creator>
			<category domain="main">Programming</category>			<guid isPermaLink="false">77@http://rtfm.ca/ramble/</guid>
						<description>&lt;p&gt;Need to have a Linux instance running on my windows xp laptop. Have downloaded and installed &lt;a href=&quot;http://www.virtualbox.org/&quot;&gt;Virtualbox&lt;/a&gt; and it runs like a charm. Its Open Source (GPL) and is has full virtualization, meaning that the OS that runs in it runs &lt;strong&gt;unmodified&lt;/strong&gt;! I downloaded a Ubuntu v10 iso and Virtualbox will use that as a mounted CD and install smoothly! So nice.&lt;br /&gt;
I got it up and running without a hitch. Two thumbs up.&lt;/p&gt;&lt;div class=&quot;item_footer&quot;&gt;&lt;p&gt;&lt;small&gt;&lt;a href=&quot;http://rtfm.ca/ramble/index.php?blog=4&amp;amp;title=virtualbox&amp;amp;more=1&amp;amp;c=1&amp;amp;tb=1&amp;amp;pb=1&quot;&gt;Original post&lt;/a&gt; blogged on &lt;a href=&quot;http://b2evolution.net/&quot;&gt;b2evolution&lt;/a&gt;.&lt;/small&gt;&lt;/p&gt;&lt;/div&gt;</description>
			<content:encoded><![CDATA[<p>Need to have a Linux instance running on my windows xp laptop. Have downloaded and installed <a href="http://www.virtualbox.org/">Virtualbox</a> and it runs like a charm. Its Open Source (GPL) and is has full virtualization, meaning that the OS that runs in it runs <strong>unmodified</strong>! I downloaded a Ubuntu v10 iso and Virtualbox will use that as a mounted CD and install smoothly! So nice.<br />
I got it up and running without a hitch. Two thumbs up.</p><div class="item_footer"><p><small><a href="http://rtfm.ca/ramble/index.php?blog=4&amp;title=virtualbox&amp;more=1&amp;c=1&amp;tb=1&amp;pb=1">Original post</a> blogged on <a href="http://b2evolution.net/">b2evolution</a>.</small></p></div>]]></content:encoded>
								<comments>http://rtfm.ca/ramble/index.php?blog=4&amp;title=virtualbox&amp;more=1&amp;c=1&amp;tb=1&amp;pb=1#comments</comments>
			<wfw:commentRss>http://rtfm.ca/ramble/index.php?blog=4&#38;tempskin=_rss2&#38;disp=comments&#38;p=77</wfw:commentRss>
		</item>
				<item>
			<title>Geolocation and PHP</title>
			<link>http://rtfm.ca/ramble/index.php?blog=4&amp;title=geolocation-and-php&amp;more=1&amp;c=1&amp;tb=1&amp;pb=1</link>
			<pubDate>Fri, 28 May 2010 23:48:03 +0000</pubDate>			<dc:creator>admin</dc:creator>
			<category domain="main">Programming</category>
<category domain="alt">GIS</category>			<guid isPermaLink="false">76@http://rtfm.ca/ramble/</guid>
						<description>&lt;p&gt;Geo location is now so easy:&lt;/p&gt;
&lt;p class=&quot;amcode&quot;&gt;Code:&lt;/p&gt;&lt;div class=&quot;codeblock amc_code amc_short&quot;&gt;&lt;table&gt;&lt;tr class=&quot;amc_code_odd&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc1&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code&gt;&lt;span class=&quot;amc_default&quot;&gt;$geo = unserialize(file_get_contents('http://www.geoplugin.net/php.gp?ip='.$_SERVER['REMOTE_ADDR']));&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr class=&quot;amc_code_even&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc2&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code&gt;&lt;span class=&quot;amc_default&quot;&gt;print_r($geo);&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr class=&quot;amc_code_odd&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc3&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code&gt;&lt;span class=&quot;amc_default&quot;&gt;echo &quot;City: &quot; . $geo['geoplugin_city'];&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr class=&quot;amc_code_even&quot;&gt;&lt;td class=&quot;amc_line&quot;&gt;&lt;div class=&quot;amc4&quot;&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;code&gt;&lt;span class=&quot;amc_default&quot;&gt;...&lt;/span&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;&lt;/div&gt;
&lt;p&gt;Thanks &lt;a href=&quot;http://www.geoplugin.com/&quot; target=&quot;_new&quot; title=&quot;geoPlugin for IP geolocation&quot;&gt;geoPlugin&lt;/a&gt;!&lt;/p&gt;&lt;div class=&quot;item_footer&quot;&gt;&lt;p&gt;&lt;small&gt;&lt;a href=&quot;http://rtfm.ca/ramble/index.php?blog=4&amp;amp;title=geolocation-and-php&amp;amp;more=1&amp;amp;c=1&amp;amp;tb=1&amp;amp;pb=1&quot;&gt;Original post&lt;/a&gt; blogged on &lt;a href=&quot;http://b2evolution.net/&quot;&gt;b2evolution&lt;/a&gt;.&lt;/small&gt;&lt;/p&gt;&lt;/div&gt;</description>
			<content:encoded><![CDATA[<p>Geo location is now so easy:</p>
<p class="amcode">Code:</p><div class="codeblock amc_code amc_short"><table><tr class="amc_code_odd"><td class="amc_line"><div class="amc1"></div></td><td><code><span class="amc_default">$geo = unserialize(file_get_contents('http://www.geoplugin.net/php.gp?ip='.$_SERVER['REMOTE_ADDR']));</span></code></td></tr>
<tr class="amc_code_even"><td class="amc_line"><div class="amc2"></div></td><td><code><span class="amc_default">print_r($geo);</span></code></td></tr>
<tr class="amc_code_odd"><td class="amc_line"><div class="amc3"></div></td><td><code><span class="amc_default">echo "City: " . $geo['geoplugin_city'];</span></code></td></tr>
<tr class="amc_code_even"><td class="amc_line"><div class="amc4"></div></td><td><code><span class="amc_default">...</span></code></td></tr>
</table></div>
<p>Thanks <a href="http://www.geoplugin.com/" target="_new" title="geoPlugin for IP geolocation">geoPlugin</a>!</p><div class="item_footer"><p><small><a href="http://rtfm.ca/ramble/index.php?blog=4&amp;title=geolocation-and-php&amp;more=1&amp;c=1&amp;tb=1&amp;pb=1">Original post</a> blogged on <a href="http://b2evolution.net/">b2evolution</a>.</small></p></div>]]></content:encoded>
								<comments>http://rtfm.ca/ramble/index.php?blog=4&amp;title=geolocation-and-php&amp;more=1&amp;c=1&amp;tb=1&amp;pb=1#comments</comments>
			<wfw:commentRss>http://rtfm.ca/ramble/index.php?blog=4&#38;tempskin=_rss2&#38;disp=comments&#38;p=76</wfw:commentRss>
		</item>
				<item>
			<title>MySQL Raw SQL files</title>
			<link>http://rtfm.ca/ramble/index.php?blog=4&amp;title=mysql-raw-sql-files&amp;more=1&amp;c=1&amp;tb=1&amp;pb=1</link>
			<pubDate>Mon, 05 Apr 2010 22:29:39 +0000</pubDate>			<dc:creator>admin</dc:creator>
			<category domain="main">Programming</category>			<guid isPermaLink="false">75@http://rtfm.ca/ramble/</guid>
						<description>&lt;p&gt;Had problems upgrading to wampserver 2, so migrated back to wamp5. In the process I toasted the MySQL 5.1.36 version that I had with wamp5, but had all the raw sql files. &lt;/p&gt;

&lt;p&gt;I reinstalled wamp5 (c:\wamp5) and then tried to move the old raw sql files (c:\wampOLD\mysql\data\))over to the new MySQL data directory (c:\wamp5\mysql\data\), but no luck. Something was amiss. Aha! The version of MySql with wamp5 was 5.0.15 and I had raw sql files from 5.1.36.&lt;/p&gt;

&lt;p&gt;So I installed MySQL 5.1.36 to a new location (c:\mysql51), moved the old raw sql files over to this data directory (c:\mysql\data\) and crossed my fingers and it worked. So now I have to properly export the SQL tables and reload into the earlier version of MySQL that comes with wamp5.&lt;/p&gt;

&lt;p&gt;Originally I did not copy over these files! You need to.&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;ibdata1&lt;/li&gt;
  &lt;li&gt;ib_logfile0&lt;/li&gt;
  &lt;li&gt;ib_logfile1&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;There may be an easier way, but this way is done.&lt;/p&gt;&lt;div class=&quot;item_footer&quot;&gt;&lt;p&gt;&lt;small&gt;&lt;a href=&quot;http://rtfm.ca/ramble/index.php?blog=4&amp;amp;title=mysql-raw-sql-files&amp;amp;more=1&amp;amp;c=1&amp;amp;tb=1&amp;amp;pb=1&quot;&gt;Original post&lt;/a&gt; blogged on &lt;a href=&quot;http://b2evolution.net/&quot;&gt;b2evolution&lt;/a&gt;.&lt;/small&gt;&lt;/p&gt;&lt;/div&gt;</description>
			<content:encoded><![CDATA[<p>Had problems upgrading to wampserver 2, so migrated back to wamp5. In the process I toasted the MySQL 5.1.36 version that I had with wamp5, but had all the raw sql files. </p>

<p>I reinstalled wamp5 (c:\wamp5) and then tried to move the old raw sql files (c:\wampOLD\mysql\data\))over to the new MySQL data directory (c:\wamp5\mysql\data\), but no luck. Something was amiss. Aha! The version of MySql with wamp5 was 5.0.15 and I had raw sql files from 5.1.36.</p>

<p>So I installed MySQL 5.1.36 to a new location (c:\mysql51), moved the old raw sql files over to this data directory (c:\mysql\data\) and crossed my fingers and it worked. So now I have to properly export the SQL tables and reload into the earlier version of MySQL that comes with wamp5.</p>

<p>Originally I did not copy over these files! You need to.</p>
<ul>
  <li>ibdata1</li>
  <li>ib_logfile0</li>
  <li>ib_logfile1</li>
</ul>

<p>There may be an easier way, but this way is done.</p><div class="item_footer"><p><small><a href="http://rtfm.ca/ramble/index.php?blog=4&amp;title=mysql-raw-sql-files&amp;more=1&amp;c=1&amp;tb=1&amp;pb=1">Original post</a> blogged on <a href="http://b2evolution.net/">b2evolution</a>.</small></p></div>]]></content:encoded>
								<comments>http://rtfm.ca/ramble/index.php?blog=4&amp;title=mysql-raw-sql-files&amp;more=1&amp;c=1&amp;tb=1&amp;pb=1#comments</comments>
			<wfw:commentRss>http://rtfm.ca/ramble/index.php?blog=4&#38;tempskin=_rss2&#38;disp=comments&#38;p=75</wfw:commentRss>
		</item>
			</channel>
</rss>
