<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>pauldoerwald.ca - my fresh thoughts</title>
    <link>http://pauldoerwald.ca</link>
    <language>en</language>
    <webMaster>Paul Doerwald</webMaster>
    <pubDate>2015-09-07T14:24:20-07:00</pubDate>
    <copyright>Copyright 2007-2009</copyright>
    <ttl>60</ttl>
    <description>pauldoerwald.ca/my fresh thoughts</description>
    
    <item>
      <title>Disappointed in Mac OS X Server</title>
      <link>http://pauldoerwald.ca/2010/03/31/mac-os-x-server-sucks.html</link>
      <pubDate>2010-03-31 00:00:00 -0700</pubDate>
      <guid>http://pauldoerwald.ca/archives/2010/03/31/mac-os-x-server-sucks/</guid>
      <description>&lt;p&gt;Back in November 2009, Liquid Media bought one of the new Mac Mini Servers. We were really excited about it: group chat using iChat server, calendaring, Asterisk, continuous integration, etc., all in a sweet Apple-flavoured package. Since then we&amp;#8217;ve had to reinstall the entire operating system 3 times, and essentially all we have is an over-powered file and Asterisk server. I&amp;#8217;ve never been so thoroughly disappointed in an Apple product. In fact, I was so disappointed that I wrote Apple a letter about it. Not an email — a letter; you know, the thing that you put in an envelope and stick in the mail.&lt;/p&gt;
&lt;p&gt;This is the letter in full:&lt;/p&gt;
&lt;blockquote&gt;
&lt;address&gt;
&lt;p&gt;Apple Canada&lt;br /&gt;
7495 Birchmount Road&lt;br /&gt;
Markham ON&lt;br /&gt;
L3R 5G2&lt;/p&gt;
&lt;/address&gt;
&lt;p&gt;31 March 2010&lt;/p&gt;
&lt;p&gt;To Whom It May Concern:&lt;/p&gt;
&lt;p&gt;In early November 2009 I purchased the newly released Mac Mini Server with OS X Snow Leopard Server. I was very excited to set this machine up to act as a server for my small web development business. It has failed miserably in this role. I am extremely disappointed in the quality of the OS X Server software.&lt;/p&gt;
&lt;p&gt;First, some context: we are a small staff of 5 software developers. We have all been using Macs for many years. We are all reasonably experienced unix administrators and have managed all manner of Linux installs as well as our Apple computers. We are all unabashed Apple fans and have, and will continue to buy Apple products.&lt;/p&gt;
&lt;p&gt;However, we all feel that Mac OS X Server falls far below your usual standard of quality. I am writing and mailing a letter, rather than sending an email or even a fax, to underscore the depth of our disappointment in the product. Some of our specific complaints include:&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;In order to set up iChat Server, we need to specify an externally addressable hostname and configure &lt;span class=&quot;caps&quot;&gt;DNS&lt;/span&gt;. This is impossible because our Internet Service Provider assigns us a dynamic IP. Even if we used the hostname, which right now is an unmemorable blk-138-72-175.eastlink.ca, any name resolution we configure would break as soon as our IP address changes. Thus, running iChat Server, which was one of our core requirements, remains unfulfilled.&lt;/li&gt;
	&lt;li&gt;Calendaring in OS X Server is shockingly poor. We are all using Macs on the same network, yet we can’t use iCal on our Macs to create events and invite our colleagues to those events. The only way we have found to invite each other is by logging on to the web interface on the server.&lt;/li&gt;
	&lt;li&gt;We have had issues connecting multiple people at the same remote location to our network via &lt;span class=&quot;caps&quot;&gt;VPN&lt;/span&gt; at the same time. The issues are still unresolved; our lesson has been to not trust the &lt;span class=&quot;caps&quot;&gt;VPN&lt;/span&gt; services.&lt;/li&gt;
	&lt;li&gt;When we have successfully connected via &lt;span class=&quot;caps&quot;&gt;VPN&lt;/span&gt;, although we are logically on the same network, we cannot see the Mac Mini Server in the list of servers in Finder. The only way to access the server’s files was by choosing “Go to Server” in Finder and manually entering the server’s internal IP address.&lt;/li&gt;
	&lt;li&gt;We realized earlier this week that Software Update Services was, for reasons unknown to us, not downloading any Mac OS X updates. Rather than taking advantage of our fast internal network, every one of the 5-person team ended up downloading the update separately.&lt;/li&gt;
	&lt;li&gt;There is no way that we are aware of to add new services to the Server Admin tool. For instance, instead of MySQL, we run PostgreSQL. We would like to configure a continuous integration server. We would like to add additional controls to manage web application deployments for our staging environments. We would like to manage our Asterisk phone system. Unfortunately, we can only manage these services from the command line — which is not a problem for us — but it would be nice if we could use the graphical tools that made us choose OS X Server in the first place.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Ultimately, we have spent a great deal of time and effort trying to configure this server, only to end up with little more than an under-used file server. For our Calendaring and Chat services, we have returned to Google Apps. For everything else, an inexpensive Linux PC will do just as well, if not better.&lt;/p&gt;
&lt;p&gt;I am therefore writing to ask that you accept the return of and refund the full price of our Mac Mini Server, the AppleCare Protection Plan that we purchased, as well as any costs of returning the machine to you, if applicable. I am including a copy of the receipt in this letter.&lt;/p&gt;
&lt;p&gt;I look forward to hearing from you with instructions on how to proceed. The best way for you to reach me is by email at ((hidden)) or by phone at 902-407-3037.&lt;/p&gt;
&lt;p&gt;Sincerely,&lt;/p&gt;
&lt;p&gt;Paul Doerwald&lt;br /&gt;
Chancellor&lt;br /&gt;
Liquid Media&lt;/p&gt;
&lt;p&gt;enclosure&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;I&amp;#8217;ll keep you up to date on what happens.&lt;/p&gt;</description>
      
    </item>
    
    <item>
      <title>Now running on Jekyll</title>
      <link>http://pauldoerwald.ca/2009/11/13/now-running-jekyll.html</link>
      <pubDate>2009-11-13 00:00:00 -0800</pubDate>
      <guid>http://pauldoerwald.ca/archives/2009/11/13/now-running-jekyll/</guid>
      <description>&lt;p&gt;At long last, I&amp;#8217;ve migrated off of Mephisto on to &lt;a href=&quot;http://wiki.github.com/mojombo/jekyll/&quot;&gt;Jekyll&lt;/a&gt;, as much of the Rails community has done. This message serves as a test, more than anything else, but at least now I can start posting again soon.&lt;/p&gt;</description>
      
    </item>
    
    <item>
      <title>Ruby 1.9, Rails, and unicode nightmares</title>
      <link>http://pauldoerwald.ca/2009/06/15/ruby-1-9-rails-and-unicode-nightmares.html</link>
      <pubDate>2009-06-15 00:00:00 -0700</pubDate>
      <guid>http://pauldoerwald.ca/archives/2009/06/15/ruby-1-9-rails-and-unicode-nightmares/</guid>
      <description>&lt;p&gt;Although they tell you that Rails (2.3) is ready for Ruby 1.9, the reality is that few of the gems are. On a particular project where we really wanted to use Ruby 1.9&#39;s new M17N and I18N functionality, I didn&#39;t actually run into too many problems with most of the gems I use, but for one, VERY painful one: the &lt;code&gt;postgres(/pg/ruby-pg)&lt;/code&gt; gem.&lt;/p&gt;

&lt;p&gt;Interestingly enough, the gems work just fine until you pull some UTF-8 content from the database. The existing database adapters (and mysql is included in this) return that content as encoding ASCII-8BIT (aka BINARY). As soon as you try to show that content on a page that is otherwise encoded UTF-8, you get &lt;code&gt;incompatible character encodings: ASCII-8BIT and UTF-8&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;This is definitely a problem with the database drivers, which should be returning the same encoding as the database. This problem hasn&#39;t officially been fixed yet, but there has been some effort to that end. For postgres, you&#39;ll need to use &lt;code&gt;ruby-pg&lt;/code&gt; (rather than &lt;code&gt;postgres&lt;/code&gt; or &lt;code&gt;pg&lt;/code&gt;, even though they&#39;re somehow the same, yet different... if anyone cares to explain...?) along with &lt;a href=&quot;http://rubyforge.org/tracker/index.php?func=detail&amp;aid=25931&amp;group_id=3214&amp;atid=12398&quot;&gt;a patch&lt;/a&gt; that&#39;s referenced in an excellent &lt;a href=&quot;http://rubyforge.org/tracker/?func=detail&amp;atid=12396&amp;aid=22925&amp;group_id=3214&quot;&gt;ticket&lt;/a&gt; on the topic. I know this works on Mac OS X and on Fedora 8. For Windows, YMMV:&lt;/p&gt;

&lt;pre&gt;
# do everything as root (it&#39;s just easier this way)
sudo bash

# get rid of the pg if you have it already; you might want to do this for ruby-pg as well
/usr/local/bin/gem uninstall pg

# change to some convenient working directory
cd /usr/local/src
svn checkout http://ruby-pg.rubyforge.org/svn
cd svn/ruby-pg/trunk/ext

# download and install the patch
curl -O http://rubyforge.org/tracker/download.php/3214/12398/25931/4535/pg-m17n3.patch
patch &lt; pg-m17n3.patch
# should respond indicating that all patches successfully applied

# set up an important environment variable
export ARCHFLAGS=&#39;-arch i386&#39;

/usr/local/bin/ruby extconf.rb
make
make install
&lt;/pre&gt;

&lt;p&gt;Worked for me. Let me know in the comments if I need to make a change to the instructions above.&lt;/p&gt;

&lt;h3&gt;Update&lt;/h3&gt;
&lt;p&gt;It strikes me that if you run into any troubles applying the patch, then these instructions may be out-of-date, and you can probably just go ahead and install the latest gem, assuming it&#39;s something higher than 0.8.0.&lt;/p&gt;

</description>
      
    </item>
    
    <item>
      <title>Staging/development instance</title>
      <link>http://pauldoerwald.ca/2009/04/30/staging-development-instance.html</link>
      <pubDate>2009-04-30 00:00:00 -0700</pubDate>
      <guid>http://pauldoerwald.ca/archives/2009/04/30/staging-development-instance/</guid>
      <description>&lt;p&gt;For a client I needed to set up a sort of staging/development instance. We&#39;re a distributed team and in order for us to review each others&#39; work before it&#39;s deployed, we need to host it somewhere that&#39;s not the production server.&lt;/p&gt;

&lt;p&gt;Apparently there&#39;s a &lt;a href=&quot;http://weblog.jamisbuck.org/2007/7/23/capistrano-multistage&quot;&gt;Capistrano extension&lt;/a&gt; for handling this, and there&#39;s &lt;a href=&quot;http://www.cjohansen.no/en/rails/multi_staging_environment_for_rails_using_capistrano_and_mod_rails&quot;&gt;some good, well-cited documentation&lt;/a&gt; out there as well, but it all felt really heavy weight until I found &lt;a href=&quot;http://www.pastbedti.me/2009/01/handling-a-staging-environment-with-capistrano-rails/&quot;&gt;this article&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;I love the simplest, most elegant solution, and this approach wins. Now deploying the staging version (off the git staging branch) is as simple as &lt;code&gt;cap staging deploy&lt;/code&gt;. If I want the main production branch, I &lt;code&gt;cap production deploy&lt;/code&gt;, and I can easily add another branch if I wish. The code (from &lt;code&gt;deploy.rb&lt;/code&gt;):&lt;/p&gt;

&lt;pre&gt;
task :production do
  role :app, &quot;192.168.100.1&quot;
  role :web, &quot;192.168.100.1&quot;
  role :db,  &quot;192.168.100.1&quot;, :primary =&gt; true
  set :branch, &quot;master&quot;
end

task :staging do
  role :app, &quot;192.168.100.2&quot;
  role :web, &quot;192.168.100.2&quot;
  role :db,  &quot;192.168.100.2&quot;, :primary =&gt; true
  set :branch, &quot;staging&quot;
end
&lt;/pre&gt;

&lt;p&gt;&lt;code&gt;cap staging deploy:migrations&lt;/code&gt;, &lt;code&gt;cap production mongrel:cluster:start&lt;/code&gt;, etc. all work as expected, and even better yet, if I fall into my old habits of &lt;code&gt;cap deploy&lt;/code&gt; I&#39;ll get an error which reminds me that I &lt;i&gt;have&lt;/i&gt; to specify a deploy target.&lt;/p&gt;

&lt;p&gt;Who needs complex capistrano extensions when you have this? I don&#39;t think it can get cleaner or simpler!&lt;/p&gt;
</description>
      
    </item>
    
    <item>
      <title>Migrating from MySQL to PostgreSQL</title>
      <link>http://pauldoerwald.ca/2008/12/29/migrating-from-mysql-to-postgresql.html</link>
      <pubDate>2008-12-29 00:00:00 -0800</pubDate>
      <guid>http://pauldoerwald.ca/archives/2008/12/29/migrating-from-mysql-to-postgresql/</guid>
      <description>&lt;p&gt;I&#39;ve taken over a Rails project whose database is MySQL. While I&#39;ve grudgingly come to respect MySQL, I still vastly prefer PostgreSQL, largely because I&#39;m more familiar with it. I decided to take the plunge and migrate the project from MySQL to PostgreSQL.&lt;/p&gt;

&lt;p&gt;A search for MySQL to Postgres conversion scripts turns up pretty empty, but then it struck me that I can do the conversion using ActiveRecord&#39;s schema dumping. The problem with this approach is that AR ignores constraints, foreign keys, etc., but in my case, the data I was migrating used none of those. Then to copy the data, I used MySQL&#39;s &lt;code&gt;select into outfile&lt;/code&gt; feature and PostgreSQL&#39;s &lt;code&gt;copy from file&lt;/code&gt; feature. The steps were:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;I created a postgres database &lt;code&gt;application_development&lt;/code&gt; and put it in the &lt;code&gt;test&lt;/code&gt; section of &lt;code&gt;config/database.yml&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;I dumped the current schema by running &lt;code&gt;rake db:schema:dump&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;I loaded that schema by running &lt;code&gt;RAILS_ENV=test rake db:schema:load&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Grant your MySQL user file privileges. Log on to MySQL as root: &lt;code&gt;mysql -u root&lt;/code&gt;, and then do the grant: &lt;code&gt;grant File on *.* to &#39;paul&#39;@&#39;localhost&#39;;&lt;/code&gt; — bear in mind that this may introduce a significant security risk in a production system; be safe and revoke the privilege when you&#39;re done.&lt;/li&gt;
&lt;li&gt;Create a &lt;code&gt;/dumps&lt;/code&gt; directory and give it &lt;code&gt;777&lt;/code&gt; (world write) permissions.&lt;/li&gt;
&lt;li&gt;For each table (&lt;code&gt;users&lt;/code&gt;, &lt;code&gt;profiles&lt;/code&gt;, &lt;code&gt;friendships&lt;/code&gt;, etc.) in MySQL, run: &lt;code&gt;select * into outfile &#39;/dumps/users.sql&#39; from users;&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;In Postgres, load the dumps. You&#39;ll have to do this as a postgres superuser, or you&#39;ll have to copy from STDIN. &lt;code&gt;copy users from &#39;/dumps/profiles.sql&#39;;&lt;/code&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;From here, I updated my &lt;code&gt;config/database.yml&lt;/code&gt; and restarted my mongrels, and everything worked perfectly! I&#39;m going to start adding database constraints now...&lt;/p&gt;

</description>
      
    </item>
    
    <item>
      <title>Motorway Map</title>
      <link>http://pauldoerwald.ca/2008/12/23/motorway-map.html</link>
      <pubDate>2008-12-23 00:00:00 -0800</pubDate>
      <guid>http://pauldoerwald.ca/archives/2008/12/23/motorway-map/</guid>
      <description>&lt;p&gt;&lt;a href=&quot;http://motorwaymap.co.uk/&quot;&gt;I may never look at the UK motorway system the same again!&lt;/a&gt;&lt;/p&gt;</description>
      
    </item>
    
    <item>
      <title>Trouble installing new Postgres Ruby adapter</title>
      <link>http://pauldoerwald.ca/2008/12/22/trouble-installing-new-postgres-adapter.html</link>
      <pubDate>2008-12-22 00:00:00 -0800</pubDate>
      <guid>http://pauldoerwald.ca/archives/2008/12/22/trouble-installing-new-postgres-adapter/</guid>
      <description>&lt;p&gt;I tried working with Rails 2.2, and I started getting an &lt;code&gt;undefined method `transaction_status&#39; for #&amp;lt;PGconn:0x32ec0cc&amp;gt;&lt;/code&gt; error on my MacBook. Turns out that the Postgres gem had been updated and was now called &lt;code&gt;ruby-pg&lt;/code&gt;. I tried installing it, but the compile kept failing. The instructions told me to set the &lt;code&gt;ARCHFLAGS&lt;/code&gt; environment variable, but:&lt;/p&gt;

&lt;pre&gt;
export ARCHFLAGS=&#39;-arch i386&#39;
sudo gem install ruby-pg
&lt;/pre&gt;

&lt;p&gt;didn&#39;t work. Eventually I clued in that root&#39;s environment was different than mine. So, I tried:&lt;/p&gt;

&lt;pre&gt;
bash-3.2# export ARCHFLAGS=&#39;-arch i386&#39;
bash-3.2# gem install ruby-pg
Building native extensions.  This could take a while...
Successfully installed ruby-pg-0.7.9.2008.01.28
1 gem installed
Installing ri documentation for ruby-pg-0.7.9.2008.01.28...
Installing RDoc documentation for ruby-pg-0.7.9.2008.01.28...
&lt;/pre&gt;

&lt;p&gt;This works. Finally.&lt;/p&gt;

</description>
      
    </item>
    
    <item>
      <title>MySQL can't count</title>
      <link>http://pauldoerwald.ca/2008/12/12/mysql-can-t-count.html</link>
      <pubDate>2008-12-12 00:00:00 -0800</pubDate>
      <guid>http://pauldoerwald.ca/archives/2008/12/12/mysql-can-t-count/</guid>
      <description>&lt;p&gt;My dislike of MySQL is well know. Here&#39;s a gotcha I just found which doesn&#39;t seem to appear on the infamous &lt;a href=&quot;http://sql-info.de/mysql/gotchas.html&quot;&gt;MySQL Gotchas&lt;/a&gt; page:&lt;/p&gt;

&lt;pre&gt;
mysql&gt; select count(*) from events where type is null;
+----------+
| count(*) |
+----------+
|       &lt;b&gt;68&lt;/b&gt; | 
+----------+
1 row in set (0.00 sec)

mysql&gt; select type, count(type) from events group by type;
+-----------+-------------+
| type      | count(type) |
+-----------+-------------+
| NULL      |           &lt;b&gt;0&lt;/b&gt; | 
| DayEvent  |         875 | 
| NullEvent |        5501 | 
+-----------+-------------+
3 rows in set (0.01 sec)
&lt;/pre&gt;

&lt;p&gt;Explain, please, how this could possibly make sense in any context??&lt;/p&gt;</description>
      
    </item>
    
    <item>
      <title>HABTM fixtures causing load of nonexistent model</title>
      <link>http://pauldoerwald.ca/2008/10/19/habtm-fixtures-causing-load-of-nonexistent-model.html</link>
      <pubDate>2008-10-19 00:00:00 -0700</pubDate>
      <guid>http://pauldoerwald.ca/archives/2008/10/19/habtm-fixtures-causing-load-of-nonexistent-model/</guid>
      <description>&lt;p&gt;... and now let me shed some light on this unintuitive blog title ...&lt;/p&gt;

&lt;p&gt;In my Rails 2.1.1 project, I have two models, &lt;code&gt;Collection&lt;/code&gt; and &lt;code&gt;SubjectCategory&lt;/code&gt; and they are related by a &lt;code&gt;has_and_belongs_to_many&lt;/code&gt;. In my fixtures, I had corresponding &lt;code&gt;collections.yml&lt;/code&gt;, &lt;code&gt;subject_categories.yml&lt;/code&gt;, and the habtm &lt;code&gt;collections_subject_categories.csv&lt;/code&gt; file. Everything works fine, and my test suite isn&#39;t creating any problems, but the other day when I happened to look at the &lt;code&gt;log/test.log&lt;/code&gt; file I saw:&lt;/p&gt;

&lt;pre&gt;
Unable to load collections_subject_category, underlying cause no such file to load -- collections_subject_category 

 /Library/Ruby/Site/1.8/rubygems/custom_require.rb:27:in `gem_original_require&#39;
/Library/Ruby/Site/1.8/rubygems/custom_require.rb:27:in `require&#39;
...
&lt;/pre&gt;

&lt;p&gt;A strange error, considering the test suite actually works. Turns out that the test suite is trying to load a model called &lt;code&gt;CollectionsSubjectCategory&lt;/code&gt; and its corresponding &lt;code&gt;collections_subject_category.rb&lt;/code&gt; source file.&lt;/p&gt;

&lt;p&gt;This is obviously wrong behaviour. The correct solution would be to create a fork of Rails on GitHub, fix the problem, notify someone of my fix, and then wait and wonder and potentially maintain my fork &lt;i&gt;ad infinitum&lt;/i&gt;. Instead, I created a fix with a hack; in &lt;code&gt;app/models/collections_subject_category.rb&lt;/code&gt;:&lt;/p&gt;

&lt;pre&gt;
class CollectionsSubjectCategory
end
&lt;/pre&gt;

&lt;p&gt;Awful, I know, but now I avoid spurious errors in my &lt;code&gt;test.log&lt;/code&gt;.&lt;/p&gt;

</description>
      
    </item>
    
    <item>
      <title>SessionTimeout</title>
      <link>http://pauldoerwald.ca/2008/10/16/sessiontimeout.html</link>
      <pubDate>2008-10-16 00:00:00 -0700</pubDate>
      <guid>http://pauldoerwald.ca/archives/2008/10/16/sessiontimeout/</guid>
      <description>&lt;p&gt;For those interested, Luke Redpath&#39;s &lt;code&gt;SessionTimeout&lt;/code&gt; plugin as documented in &lt;u&gt;The Rails Way&lt;/u&gt; doesn&#39;t appear to be available from its &lt;a href=&quot;http://opensource.agileevolved.com/trac/wiki/SessionTimeout&quot;&gt;previous home&lt;/a&gt;, but it can be found on GitHub at &lt;a href=&quot;http://github.com/lukeredpath/session-timeout/tree/master&quot;&gt;http://github.com/lukeredpath/session-timeout/tree/master&lt;/a&gt;. I installed and ran it on a Rails 2.1.1 application, and it still works as advertised.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Update:&lt;/b&gt; Upon closer inspection, Rails once again managed to break its contract and redefined the method &lt;code&gt;minutes&lt;/code&gt;, as in &lt;code&gt;20.minutes&lt;/code&gt; to return &lt;code&gt;1200 seconds&lt;/code&gt; rather than simply &lt;code&gt;1200&lt;/code&gt;. Even though both results are of class &lt;code&gt;Fixnum&lt;/code&gt;, the newer version manages to break &lt;code&gt;session_times_out_in 20.minutes&lt;/code&gt;. You are advised to use just the number &lt;code&gt;1200&lt;/code&gt;.

</description>
      
    </item>
    
  </channel>
</rss>
