<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DZone Snippets: Brainpipe's Code Snippets</title>
    <link>http://snippets.dzone.com/posts</link>
    <pubDate>Sun, 27 Jul 2008 02:45:14 GMT</pubDate>
    <description>DZone Snippets: Brainpipe's Code Snippets</description>
    <item>
      <title>Apache2 proxy to local port</title>
      <link>http://snippets.dzone.com/posts/show/1318</link>
      <description>Apache as the receptionist, forwarding requests to and from an internal server (e.g. webrick or lighttpd).&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;&lt;VirtualHost *&gt;&lt;br /&gt;        ServerName www.example.com&lt;br /&gt;        ProxyPass / http://localhost:3000/&lt;br /&gt;        ProxyPassReverse / http://localhost:3000/&lt;br /&gt;        ProxyPreserveHost On&lt;br /&gt;&lt;/VirtualHost&gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Change 3000 to whatever port you need and make sure the internal server is set up to answer requests on that port (not port 80). The ProxyPreserveHost line is critical to keep all your URLs working correctly.</description>
      <pubDate>Tue, 31 Jan 2006 11:09:16 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/1318</guid>
      <author>brainpipe ()</author>
    </item>
    <item>
      <title>Convert unicode characters to HTML entities in Ruby</title>
      <link>http://snippets.dzone.com/posts/show/1161</link>
      <description>&lt;code&gt;&lt;br /&gt;def entities( str )&lt;br /&gt;  converted = []&lt;br /&gt;  str.split(//).collect { |c| converted &lt;&lt; ( c[0] &gt; 127 ? "&amp;##{c[0]};" : c ) }&lt;br /&gt;  converted.join('')&lt;br /&gt;end&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Mon, 16 Jan 2006 06:57:40 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/1161</guid>
      <author>brainpipe ()</author>
    </item>
    <item>
      <title>Fix for nil object error in Rails test fixtures</title>
      <link>http://snippets.dzone.com/posts/show/1135</link>
      <description>If you're seeing errors like this when you run Rails tests:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;# NoMethodError: You have a nil object when you didn't expect it!&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;You might need to edit test/test_helper.rb to make sure use_instantiated_fixtures is true:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;self.use_instantiated_fixtures = true&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Prior to 1.0, Rails automatically created instance variables out of fixtures. So if you had a fixture record named "foo", you could access it in your test as "@foo". As of 1.0, the default is to disable that feature, which breaks a lot of existing code. Mike Clark &lt;a href="http://clarkware.com/cgi/blosxom/2005/10/24#Rails10FastTesting" title="Mike Clark's Weblog: Faster Testing with Rails 1.0"&gt;explains the change&lt;/a&gt;.</description>
      <pubDate>Wed, 11 Jan 2006 06:43:42 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/1135</guid>
      <author>brainpipe ()</author>
    </item>
  </channel>
</rss>
