<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <title>Hulihan Applications Blog</title>
    <link>http://blog.hulihanapplications.com</link>
    <description>Hulihan Applications - A design and programming firm Specializing in Web, Logo, and Graphic Design and programming, Web Design, Graphic Design, Logo Design, Network Administration/Security/Management and Web Site Hosting. Custom Design and Applications ar</description>
    <language>yourLanguage('en')</language>
    <item>
      <title>Strip HTML in Ruby on Rails </title>
      <description>Code Security is very important nowadays, so I thought I&amp;#39;d show everyone how to automatically strip off any HTML, javascript, css, etc. tags in ruby on rails. Many malicious users often try to type in code that execute when another person is looking at what they typed(like a forum post, for instance). Some security issues caused by this are XSS(Cross Site Scripting) and CSRF(Cross Site Request Forgery). So if someone is going to enter in ANY text that will show up on your site, I&amp;#39;d recommend that you clean their text of code before it&amp;#39;s entered into your website/software.&lt;br /&gt;&lt;br /&gt;Here&amp;#39;s how to clean a normal string:&lt;br /&gt;&lt;br /&gt;&lt;div class="normal_code_block"&gt;string = &amp;quot;&amp;lt;b&amp;gt;Bob&amp;lt;/b&amp;gt;&amp;quot; &lt;br /&gt;&lt;br /&gt;string = string.gsub(/&amp;lt;\/?[^&amp;gt;]*&amp;gt;/,&amp;nbsp; &amp;quot;&amp;quot;)&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&lt;br /&gt;Also, another handy thing you can do is clean everything going into&lt;br /&gt;your&amp;nbsp; database. This code will automatically clean any string or text&lt;br /&gt;data in your database. You don&amp;#39;t even have to enter in the name of&lt;br /&gt;the columns you want cleaned.&amp;nbsp; All you have to do is change the name of the model(it&amp;#39;s in &lt;font color="#ff6600"&gt;orange&lt;/font&gt; below) and then enter in the code into your class model, ie: product.rb. And it will take care of the cleaning&lt;br /&gt;for you:&lt;br /&gt;&lt;br /&gt;&lt;div class="normal_code_block"&gt;&amp;nbsp;class &lt;font color="#ff6600"&gt;Product&lt;/font&gt; &amp;lt; ActiveRecord::Base&lt;br /&gt;&lt;br /&gt;&amp;nbsp; before_save :strip_html&lt;br /&gt;&amp;nbsp; def strip_html # Automatically strips any tags from any string to text typed column&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; for column in &lt;font color="#ff6600"&gt;Product&lt;/font&gt;.content_columns&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if column.type == :string || column.type == :text # if the column is text-typed&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if !self[column.name].nil? # strip html from string if it&amp;#39;s not empty&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; self[column.name] = self[column.name].gsub(/&amp;lt;\/?[^&amp;gt;]*&amp;gt;/, &amp;quot;&amp;quot;) &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; end&lt;br /&gt;&amp;nbsp; end &lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Keep in mind that this code will clean out ANYTHING that is in tags,&lt;br /&gt;such as: &amp;lt;br&amp;gt;&amp;lt;b&amp;gt;&amp;lt;whatever&amp;gt;&amp;lt;cheese&amp;gt;&amp;lt;etc&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;</description>
      <pubDate>Sat, 19 Jul 2008 22:59:00 -0600</pubDate>
      <link>http://blog.hulihanapplications.com/browse/view/10</link>
      <guid>10</guid>
    </item>
    <item>
      <title>Amethyst 0.1.4 Released</title>
      <description>&lt;p&gt;Hey Everyone! Just a quick note, Amethyst 0.1.4 was released tonight. We fixed some issues with the RSS feed, and also added a &lt;a href="http://en.wikipedia.org/wiki/Captcha"&gt;CAPTCHA&lt;/a&gt; capability to prevent spammers from adding annoying comments. As always, you can try it out in the &lt;a href="http://amethyst.demos.hulihanapplications.com/"&gt;Amethyst Demo&lt;/a&gt;. Enjoy!&amp;nbsp;  &lt;/p&gt;</description>
      <pubDate>Sat, 17 May 2008 00:06:00 -0600</pubDate>
      <link>http://blog.hulihanapplications.com/browse/view/9</link>
      <guid>9</guid>
    </item>
    <item>
      <title>Filtering out Swear words in Ruby</title>
      <description>&amp;nbsp;I was looking around for a quick couple of lines of code that would search out any string for a swear word and replace it with a cleaner word. I had a little trouble finding an easy example, so here&amp;#39;s one for you. I use a modified version of this script for a lot of my applications:&lt;p&gt;&amp;nbsp;&lt;font color="#ffffff"&gt;$&lt;/font&gt; &lt;font color="#ff0000"&gt;nano filter_swear_words.rb&lt;/font&gt;&lt;/p&gt;  &lt;div class="normal_code_block"&gt; #!/usr/bin/ruby&lt;br /&gt;@string = &amp;quot;What the funk&amp;quot;&lt;br /&gt;&lt;br /&gt;@bad_words = Hash.new&lt;br /&gt;@bad_words[:funk] = &amp;quot;funny&amp;quot;&amp;nbsp;#the [:funk] is the bad word, and the &amp;quot;funny&amp;quot; is the replacement@bad_words[:shoot] = &amp;quot;shucks&amp;quot; # add more in this fashion&amp;nbsp;&lt;p&gt;@seperated_words =&amp;nbsp; @string.split(&amp;quot; &amp;quot;) # seperate content by spaces&lt;/p&gt;&lt;p&gt;print &amp;quot;Original String: #{@string}\n&amp;quot;&lt;/p&gt;&lt;p&gt;@cleaned_string = &amp;quot;&amp;quot;&lt;br /&gt;&lt;br /&gt;for word in @seperated_words&lt;br /&gt;&amp;nbsp;@bad_words.each do |bad_word, replacement|&lt;br /&gt;&amp;nbsp; if word == bad_word.to_s # if the word we&amp;#39;re looking at is bad&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp; word = replacement # replcae the word&amp;nbsp; &lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp; else # the word is we&amp;#39;re looking at is okay&lt;br /&gt;&amp;nbsp;&amp;nbsp; end&lt;br /&gt;&amp;nbsp;end&lt;br /&gt;&lt;br /&gt;&amp;nbsp;@cleaned_string &amp;lt;&amp;lt; word + &amp;quot; &amp;quot;&lt;br /&gt;end&lt;/p&gt;&lt;p&gt;print &amp;quot;Cleaned String: #{@cleaned_string}\n&amp;quot; &lt;/p&gt;&lt;/div&gt;&lt;p&gt;So when we run the script, here&amp;#39;s what we get: &lt;/p&gt;&lt;font color="#ffffff"&gt;$&lt;/font&gt; &lt;font color="#ff0000"&gt;ruby filter_swear_words.rb&lt;/font&gt;&lt;div class="normal_code_block"&gt; Original String: What the funk&lt;br /&gt;Cleaned String: What the funny&lt;/div&gt;</description>
      <pubDate>Tue, 01 Apr 2008 18:17:00 -0600</pubDate>
      <link>http://blog.hulihanapplications.com/browse/view/8</link>
      <guid>8</guid>
    </item>
    <item>
      <title>Downgrading Ruby on Rails</title>
      <description>&lt;p&gt;&lt;font size="1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Well, now that the new version of ruby on rails is out(2.0.2), everything should be new and improved. I do like a lot of things in the new version of rails but many of my apps are written in previous versions(like 1.2.6) and I&amp;#39;d like to keep them that way, for now. Rails 2.x is pretty good, but it&amp;#39;s missing a lot of old rails core commands(like the old rest-less &lt;/font&gt;&lt;font size="1" color="#993300"&gt;script/generate scaffold&lt;/font&gt;&lt;font size="1"&gt;), that I happen to use sometimes. Also, a lot of people deploy rails applications in shared hosting environments and other places where they don&amp;#39;t have the permissions to reinstall old versions of rails via gem, so here&amp;#39;s an alternative. Here we will actually freeze the older version of rails to our application. In this example, I&amp;#39;ll be downgrading ruby on rails &lt;/font&gt;&lt;font size="1" color="#993300"&gt;2.0.2&lt;/font&gt;&lt;font size="1"&gt; to &lt;/font&gt;&lt;font size="1" color="#993300"&gt;1.2.6.&amp;nbsp;&lt;/font&gt;&lt;/p&gt;&lt;p&gt;First, create a new rails application(we&amp;#39;ll call it app):&lt;/p&gt;&lt;p&gt;&lt;font color="#00ff00"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;font color="#ffffff"&gt;$&lt;/font&gt; &lt;font color="#ff0000"&gt;rails app&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;&lt;p&gt;Then, cd into the directory:&lt;/p&gt;&lt;p&gt;&lt;font color="#00ff00"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;font color="#ffffff"&gt;$&lt;/font&gt; &lt;font color="#ff0000"&gt;cd app&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;&lt;p&gt;Now we will download the version of rails you want(here we will grab 1.2.6, but you can get any version) from the rails archive:&lt;/p&gt;&lt;p&gt;&lt;font size="1" color="#0000ff"&gt; Note: you can do this a couple of different ways, this is using svn&lt;/font&gt; &lt;/p&gt;&lt;p&gt;&lt;font color="#00ff00"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;font color="#ffffff"&gt;$&lt;/font&gt; &lt;font color="#ff0000"&gt;svn co http://dev.rubyonrails.org/svn/rails/tags/rel_1-2-6/&lt;/font&gt;&lt;br /&gt;&lt;/font&gt;&lt;br /&gt;Copy and rename the downloaded folder to vendor/rails:&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;font color="#00ff00"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;font color="#ffffff"&gt;$&lt;/font&gt; &lt;font color="#ff0000"&gt;mv rel_1-2-6/ vendor/rails&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font size="1" color="#0000ff"&gt;Note: Rails looks automatically for a vendor/rails folder before using the server-wide ruby on rails libraries(aka gems). Having them stored this way is called &amp;quot;freezing&amp;quot; your gems. &lt;/font&gt;&lt;/p&gt;&lt;p&gt;Now all we have to do is replace the 2.0.2 version of&amp;nbsp; config/environment.rb file with a copy of the 1.2.6 version: &amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;font color="#00ff00"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;font color="#ffffff"&gt;$&lt;/font&gt; &lt;font color="#ff0000"&gt;mv config/environment.rb config/environment.rb.original&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font color="#00ff00"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;font color="#ffffff"&gt;$&lt;/font&gt; &lt;font color="#ff0000"&gt;nano -w config/environment.rb&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;&lt;p&gt;Here I&amp;#39;m using the linux text editor, nano. You can also use emacs, vi, notepad, textpad, or whatever you want. Basically, we&amp;#39;re going to create a new empty file named config/environment.rb and paste this code into it:&lt;/p&gt;&lt;div class="normal_code_block"&gt; &lt;font color="#000000"&gt;ENV[&amp;#39;RAILS_ENV&amp;#39;] ||= &amp;#39;development&amp;#39;&lt;br /&gt;RAILS_GEM_VERSION = &amp;#39;1.2.6&amp;#39;&lt;br /&gt;&lt;br /&gt;require File.join(File.dirname(__FILE__), &amp;#39;boot&amp;#39;)&lt;br /&gt;Rails::Initializer.run do |config|&lt;br /&gt;&amp;nbsp; config.action_controller.perform_caching = true&lt;br /&gt;end&lt;/font&gt; &lt;/div&gt;  &lt;br /&gt;If you used the nano command(which I am using in this example), you can save the file by pressing CTRL + O(hold down the ctrl key and hit O), and then CTRL + X.&amp;nbsp;&lt;p&gt;That&amp;#39;s it! You can now confirm that your using rails 1.2.6 by running this command:&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;font color="#00ff00"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;font color="#ffffff"&gt;$&lt;/font&gt; &lt;font color="#ff0000"&gt;script/about&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;You should see the version of rails now being 1.2.6, like so:&amp;nbsp;&lt;/p&gt;  &lt;div class="normal_code_block"&gt; &lt;p&gt;&lt;font size="1"&gt;About your application&amp;#39;s environment&lt;br /&gt;Ruby version&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; 1.8.6 (x86_64-linux)&lt;br /&gt;RubyGems version&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1.0.1&lt;br /&gt;&lt;strong&gt;Rails version&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; 1.2.6&lt;/strong&gt;&lt;br /&gt;Active Record version&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; 1.15.6&lt;br /&gt;Action Pack version&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; 1.13.6&lt;br /&gt;Action Web Service version&amp;nbsp; 1.2.6&lt;br /&gt;Action Mailer version&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; 1.3.6&lt;br /&gt;Active Support version&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; 1.4.4&lt;br /&gt;Edge Rails revision&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 8976&lt;br /&gt;Application root&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /home/bob/app&lt;br /&gt; Environment&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; development&lt;br /&gt;Database adapter&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; mysql&lt;/font&gt;&lt;br /&gt;&amp;nbsp;&lt;/p&gt; &lt;/div&gt;  &lt;p&gt; &amp;nbsp;&lt;/p&gt;</description>
      <pubDate>Sun, 02 Mar 2008 21:40:00 -0700</pubDate>
      <link>http://blog.hulihanapplications.com/browse/view/7</link>
      <guid>7</guid>
    </item>
    <item>
      <title>Amethyst released</title>
      <description>&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="text-align: center"&gt;&lt;img src="../../images/amethyst_simplified.png" alt="Amethyst" title="Amethyst" /&gt;&lt;/div&gt;&amp;nbsp;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; It&amp;#39;s that time again. We released another application this month! Today we released Amethyst to the public. It&amp;#39;s a blogging application written in ruby on rails. It&amp;#39;s very simple, clean, and straightforward. Keep in mind that it&amp;#39;s our first release, so it&amp;#39;s in beta(though we&amp;#39;ve tested it quite a bit, just like anything else we release). Our blog runs on amethyst, so check it out and see what you think. If you have any suggestions, &lt;a href="http://www.hulihanapplications.com/contact_us.php" target="_blank" title="Contact Us"&gt;let us know!&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; If you&amp;#39;re interested in the Amethyst blog software, you can try out a demo or download it at the project page here: &lt;/p&gt;&lt;p&gt;&lt;a href="http://www.hulihanapplications.com/projects_amethyst.php" target="_blank" title="Amethyst"&gt;&amp;nbsp;http://www.hulihanapplications.com/projects_amethyst.php&lt;/a&gt;&lt;/p&gt;&lt;p&gt;Enjoy!&amp;nbsp;&lt;/p&gt;</description>
      <pubDate>Fri, 15 Feb 2008 14:34:00 -0700</pubDate>
      <link>http://blog.hulihanapplications.com/browse/view/6</link>
      <guid>6</guid>
    </item>
    <item>
      <title>Onyx Released</title>
      <description>&lt;div style="text-align: center"&gt;&lt;img src="http://onyx.demos.hulihanapplications.com/images/logo.png" alt="Onyx" title="Onyx" /&gt;&lt;/div&gt;&lt;p&gt;Well, we finally released the first version of Onyx today, our Ruby on Rails gallery application. It&amp;#39;s the very first version, and we&amp;#39;ve tested it quite a bit, and it seems to be very promising. Since it is brand new, it is still in beta. It has a couple of really cool features, url image grabbing and tag galleries, etc. Take a look, here&amp;#39;s the link to the project page:&lt;/p&gt;&lt;p&gt;&lt;a href="http://www.hulihanapplications.com/projects_onyx.php" target="_blank"&gt;&amp;nbsp;http://www.hulihanapplications.com/projects_onyx.php &lt;/a&gt;&lt;/p&gt;&lt;p&gt;Download it or try the demo, and let us know what you think!&amp;nbsp; &lt;/p&gt;</description>
      <pubDate>Mon, 04 Feb 2008 22:33:00 -0700</pubDate>
      <link>http://blog.hulihanapplications.com/browse/view/5</link>
      <guid>5</guid>
    </item>
    <item>
      <title>Mysql Console Rake Task</title>
      <description>&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; I just wanted to share a handy rake task that I found. It allows you to connect directly to a mysql console in a linux shell(granted the &amp;#39;mysql&amp;#39; command is present). It reads in the mysql connection settings stored in config/database.yml so there&amp;#39;s no need to enter in a user/database name or password. Here&amp;#39;s the code you can add to &lt;strong&gt;lib/tasks/mysql.rake&lt;/strong&gt;&lt;font color="#00ff00"&gt; &lt;font color="#ff0000"&gt;(or whatever) &lt;font color="#000000"&gt;or &lt;strong&gt;Rakefile&lt;/strong&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;  &lt;/p&gt;&lt;p&gt;&lt;font color="#333399"&gt;&lt;font size="1"&gt;def mysql_console(config)&lt;br /&gt;&amp;nbsp; returning &amp;#39;&amp;#39; do |mysql|&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; mysql &amp;lt;&amp;lt; mysql_command &amp;lt;&amp;lt; &amp;#39; &amp;#39;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; mysql &amp;lt;&amp;lt; &amp;quot;-u#{config[&amp;#39;username&amp;#39;]} &amp;quot; if config[&amp;#39;username&amp;#39;]&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; mysql &amp;lt;&amp;lt; &amp;quot;-p#{config[&amp;#39;password&amp;#39;]} &amp;quot; if config[&amp;#39;password&amp;#39;]&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; mysql &amp;lt;&amp;lt; &amp;quot;-h#{config[&amp;#39;host&amp;#39;]} &amp;quot;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if config[&amp;#39;host&amp;#39;]&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; mysql &amp;lt;&amp;lt; &amp;quot;-P#{config[&amp;#39;port&amp;#39;]} &amp;quot;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if config[&amp;#39;port&amp;#39;]&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; mysql &amp;lt;&amp;lt; config[&amp;#39;database&amp;#39;]&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if config[&amp;#39;database&amp;#39;]&lt;br /&gt;&amp;nbsp; end&lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;def mysql_command&lt;br /&gt;&amp;nbsp; &amp;#39;mysql&amp;#39;&lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;desc &amp;quot;Launch mysql shell.&amp;nbsp; Use with an environment task (e.g. rake production mysql)&amp;quot;&lt;br /&gt;task :mysql do&lt;br /&gt;&amp;nbsp; system sh_mysql(YAML.load(open(File.join(&amp;#39;config&amp;#39;, &amp;#39;database.yml&amp;#39;)))[RAILS_ENV])&lt;br /&gt;end&lt;/font&gt;&lt;br /&gt;&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;Then you would run the task by typing:&lt;/p&gt;&lt;p&gt;&lt;font size="1" color="#333399"&gt;&amp;nbsp;$ rake mysql&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font size="1" color="#333399"&gt;&amp;nbsp;Welcome to the MySQL monitor.&amp;nbsp; Commands end with ; or \g.&lt;br /&gt;Your MySQL connection id is 109184 to server version: 5.0.45-community-log&lt;br /&gt;&lt;br /&gt;Type &amp;#39;help;&amp;#39; or &amp;#39;\h&amp;#39; for help. Type &amp;#39;\c&amp;#39; to clear the buffer.&lt;br /&gt;&lt;br /&gt;mysql&amp;gt;&lt;/font&gt;&lt;/p&gt;&lt;p&gt;That&amp;#39;s it! &lt;/p&gt;</description>
      <pubDate>Sat, 02 Feb 2008 13:37:00 -0700</pubDate>
      <link>http://blog.hulihanapplications.com/browse/view/4</link>
      <guid>4</guid>
    </item>
    <item>
      <title>attr_accessor and ruby object variables</title>
      <description>&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; In most other languages(java, c++, etc.), when you create an object, you have to define the variables that will make up the structure of the object. You also usually add a getter(retrieves the variable) and a setter(sets/writes the contents of the variable) so you can access the variable.&amp;nbsp; &lt;/p&gt;&lt;p&gt;However, in Ruby, you only need one line of code that will do all of the above:&lt;/p&gt;&lt;div class="normal_code_block"&gt;&lt;font color="#008080"&gt;attr_accessor :myvar&lt;/font&gt; &lt;/div&gt;&lt;p&gt;This creates the getter and setter methods from the variable, which(by default) look like this:&lt;/p&gt;&lt;div class="normal_code_block"&gt;&lt;font color="#ffffff"&gt;&lt;font color="#008080"&gt;&amp;nbsp;&amp;nbsp; def myvar #this is the getter &lt;/font&gt;&lt;/font&gt;&lt;p&gt;&lt;font color="#008080"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; @myvar #returns the contents of @myvar &lt;/font&gt;&lt;/p&gt;&lt;font color="#008080"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end&lt;/font&gt;&lt;p&gt;&lt;font color="#008080"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; def myvar(anything) #this is the setter &lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font color="#008080"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; @myvar = anything #set the contents of myvar to anything! &lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font color="#008080"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end&lt;/font&gt;&lt;/p&gt;&lt;/div&gt;&lt;p&gt;You&amp;#39;re also looking at the code to override the methods, too!&amp;nbsp; Example: If you want to create a backup variable whenever you create the original, do this:&lt;/p&gt;&lt;p&gt;&lt;font color="#993300"&gt;app/model/example.rb&amp;nbsp;&lt;/font&gt;&lt;/p&gt;&lt;div class="normal_code_block"&gt;&lt;font color="#008080"&gt;Class Example &lt;/font&gt;&lt;p&gt;&lt;font color="#008080"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; attr_accessor :myvar&amp;nbsp; &lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font color="#008080"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; def myvar=(anything) #this is the setter&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font color="#008080"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; @myvar_backup = @myvar #backup the original variable&lt;/font&gt; &lt;/p&gt; &lt;p&gt;&lt;font color="#008080"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; @myvar = anything #set the contents of myvar to anything!&amp;nbsp;&lt;/font&gt;&lt;/p&gt;&lt;font color="#008080"&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end&lt;/font&gt;&lt;p&gt;&lt;font color="#008080"&gt;&amp;nbsp;end&lt;/font&gt;&lt;/p&gt;&lt;/div&gt;&lt;p&gt;&lt;font color="#993300"&gt;script/console&amp;nbsp;&lt;/font&gt;&lt;/p&gt;&lt;div class="normal_code_block"&gt;&lt;font color="#008000"&gt; @myExample = Example.new&lt;/font&gt;&lt;br /&gt;&lt;font color="#ff6600"&gt;=&amp;gt; #&amp;lt;Example:0x2b50b2c3d560&amp;gt;&lt;/font&gt;&lt;br /&gt;&lt;font color="#008000"&gt;&amp;gt;&amp;gt; @myExample.inspect # see what the object has&lt;/font&gt;&lt;br /&gt;&lt;font color="#ff6600"&gt;=&amp;gt; &amp;quot;#&amp;lt;Example:0x2b50b2c3d560&amp;gt;&amp;quot;&lt;/font&gt;&lt;br /&gt;&lt;font color="#008000"&gt;&amp;gt;&amp;gt; @myExample.myvar = &amp;quot;hello!&amp;quot; # set the variable&lt;/font&gt;&lt;br /&gt;&lt;font color="#ff6600"&gt;=&amp;gt; &amp;quot;hello!&amp;quot;&lt;/font&gt;&lt;br /&gt;&lt;font color="#008000"&gt;&amp;gt;&amp;gt; @myExample.inspect # see what the object has now&lt;/font&gt;&lt;br /&gt;&lt;font color="#ff6600"&gt;=&amp;gt; &amp;quot;#&amp;lt;Example:0x2b50b2c3d560 @myvar_backup=\&amp;quot;hello!\&amp;quot;, @myvar=\&amp;quot;hello!\&amp;quot;&amp;gt;&amp;quot;&lt;/font&gt;&lt;/div&gt;&lt;p&gt;Also, if you just wanted the getter or setter only, you would use:&lt;/p&gt;&lt;p&gt;attr_reader :myvar &lt;strong&gt;or &lt;/strong&gt;attr_writer :myvar &lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;Read more about accessors:&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;a href="http://www.ruby-doc.org/docs/UsersGuide/rg/accessors.html"&gt;http://www.ruby-doc.org/docs/UsersGuide/rg/accessors.html&lt;/a&gt;&lt;/p&gt;</description>
      <pubDate>Fri, 21 Dec 2007 08:34:00 -0700</pubDate>
      <link>http://blog.hulihanapplications.com/browse/view/3</link>
      <guid>3</guid>
    </item>
    <item>
      <title>What is a reverse proxy?</title>
      <description>In the web world, a reverse proxy is often used to balance traffic going to a site across several servers. Here is a snippet from the sans institute that explains a reverse proxy in simpler terms:

&lt;div class="normal_code_block"&gt;
So what exactly is a Reverse Proxy? &lt;br&gt;&lt;br&gt;First let's review what a forward proxy or proxy is and how
it works. A forward proxy acts as a gateway for a client's browser, sending HTTP requests on
the client's behalf to the Internet.&lt;br&gt;&lt;br&gt; The proxy protects your inside network by hiding the actual
client's IP address and using its own instead.&lt;br&gt;&lt;br&gt; When an outside HTTP server receives the
request, it sees the requestor's address as originating from the proxy server, not from the
actual client.&lt;br&gt;&lt;br&gt;
A Reverse Proxy proxies on behalf of the backend HTTP server, not on behalf of the outside client's request, hence the term "reverse".&lt;br&gt;&lt;br&gt;
&lt;/div&gt;&lt;br&gt;
Read more about this at:
&lt;a href="http://www.sans.org/reading_room/whitepapers/webservers/302.php"&gt;
http://www.sans.org/reading_room/whitepapers/webservers/302.php&lt;/a&gt;</description>
      <pubDate>Sat, 08 Dec 2007 08:04:00 -0700</pubDate>
      <link>http://blog.hulihanapplications.com/browse/view/1</link>
      <guid>1</guid>
    </item>
    <item>
      <title>First Post</title>
      <description>Welcome to our blog! This purpose of this blog is to provide the public with cool information regarding networking, web design &amp;amp; development, ruby on rails, etc. etc. Hope you enjoy! </description>
      <pubDate>Fri, 07 Dec 2007 11:31:00 -0700</pubDate>
      <link>http://blog.hulihanapplications.com/browse/view/2</link>
      <guid>2</guid>
    </item>
  </channel>
</rss>
