Pearware Blog : Archives for August 2006 http://blog.pearware.org/articles/2006/08.rss en-us 40 agile web development Offsetting flight emissions <p>I&#8217;m flying back to Phoenix today, as part of my telecommuting agreement. Due to the fact that I&#8217;ll be flying frequently, I feel that I should do something to balance the impact on the environment of my flights. Flying burns a lot of fuel, and flying from Columbus, OH to Phoenix, AZ is certainly no exception. So, today, I&#8217;m purchasing a <a href="http://www.terrapass.com/flight/index2.html">Flight TerraPass</a> to offset the carbon emissions of my flights.</p> Sun, 20 Aug 2006 13:48:00 -0500 urn:uuid:9c206669-a30b-40fa-8d5e-0e5d5151828c http://blog.pearware.org/articles/2006/08/20/offsetting-flight-emissions#comments environment carbon emissions terrapass telecommuting http://blog.pearware.org/articles/2006/08/20/offsetting-flight-emissions Ahh, the easy life <p>This is what my dog does while I work all day&#8230;</p> <p><a href="http://www.flickr.com/photos/mparrish/215397058/"><img src="http://static.flickr.com/96/215397058_9ac81d3aa6_m.jpg"/></a></p> Mon, 14 Aug 2006 13:46:00 -0500 urn:uuid:dc56f853-eb91-49c4-b412-6ecf839e3245 http://blog.pearware.org/articles/2006/08/14/ahh-the-easy-life#comments penelope http://blog.pearware.org/articles/2006/08/14/ahh-the-easy-life Error working with large YAML files <p>As part of my <a href="http://blog.pearware.org/articles/2006/08/13/rails-migrations-dropping-default-constraint-on-column">Application migration project</a>, I need to pre-populate the new database with zip code data. The <a href="http://pragmaticprogrammer.com/titles/fr_rr/">Rails Recipes book</a> (very useful) has a nice recipe on extracting fixtures from live data. So, I&#8217;ve created a zips.yml file that contains all the zip code data that I can insert into the new database. However, when I try to load the fixture using this <a href="http://rails.techno-weenie.net/tip/2006/6/8/bootstrapping_your_database">very cool rake task from Technoweenie</a>, the <span class="caps">YAML</span> library throws the following exception: <strong>SystemStackError: stack level too deep</strong>.</p> <p>It is possible to work-around the error by increasing the stack limit on the command-line. on Mac <span class="caps">OSX</span> (and probably Linux/Unix), the following command can be run before running the rake task: <strong>ulimit -s 32768</strong>. This increases the default stack limit to 32MB, which should be enough, unless the yaml file is really large, I suppose.</p> <p>Does anyone know if somebody is working on fixing the <span class="caps">YAML</span> library to be nicer to the stack?</p> Sun, 13 Aug 2006 13:34:00 -0500 urn:uuid:5fdcea08-eeac-48bf-976c-5b5c89f34597 http://blog.pearware.org/articles/2006/08/13/error-working-with-large-yaml-files#comments ruby rails yaml error bootstrap rake http://blog.pearware.org/articles/2006/08/13/error-working-with-large-yaml-files Rails Migrations - Dropping default constraint on column <p>I&#8217;m working on a project for a client to convert a website from <a href="http://www.php.org"><span class="caps">PHP</span></a> to <a href="http://www.rubyonrails.com">Ruby on Rails</a>. The database is also changing from Microsoft <span class="caps">SQL</span> Server to MySQL, along with several schema redesigns.</p> <p>One thing I wanted to do to our new db, was change a foreign key column from <strong><span class="caps">NOT NULL DEFAULT 0</span></strong> to allow nulls and remove the default. Currently, the organizations table has a record with ID = 0 to signify a blank organization. Users that do not belong to an organization, have a foreign key to that Zero-record. Well, a better way to represent that is for the foreign key column in users to simply be <span class="caps">NULL</span> and ditch the Zero-record in the organizations table.</p></p> <p>I have created a Migration class to handle the schema change. However, it looks like I have to drop to <span class="caps">SQL</span> as there is not Migration way of doing this. Here&#8217;s what it looks like:</p> <pre><code> execute 'ALTER TABLE users ALTER organization_id DROP DEFAULT'</code></pre> <p>I wanted to be able to handle this in the Migration-syntax, but I don&#8217;t think that&#8217;s possible. It would be nice to do something like:</p> <pre><code> change_column :users, :organization_id, :integer, :default => :null, :null => true</code></pre> Sun, 13 Aug 2006 13:31:00 -0500 urn:uuid:9de7ba89-c5a0-418e-9b5c-31b19a33b1f0 http://blog.pearware.org/articles/2006/08/13/rails-migrations-dropping-default-constraint-on-column#comments ruby rails database migrations schema mysql http://blog.pearware.org/articles/2006/08/13/rails-migrations-dropping-default-constraint-on-column Cool Google Maps flight simulator <p>Now this is a pretty cool idea!</p> <p><a href="http://www.isoma.net/games/goggles.html">Go There!</a></p> Sun, 06 Aug 2006 13:07:00 -0500 urn:uuid:53d18403-e129-4fc7-a907-985efd0d9a07 http://blog.pearware.org/articles/2006/08/06/cool-google-maps-flight-simulator#comments web technology google maps web2.0 http://blog.pearware.org/articles/2006/08/06/cool-google-maps-flight-simulator Rails redeploy issue resolved <p>I just redeployed a rails site for a client of mine, <a href="http://www.realidaho.com">Real Idaho</a>, using <a href="http://manuals.rubyonrails.com/read/book/17">Capistrano</a> and it didn&#8217;t work properly. I was able to resolve the issue, and here are the details in case this ever happens to you&#8230;</p> <p>Running</p> <pre><code>$ rake deploy</code></pre> <p>gave the following output (some content suppressed):</p> <pre><code>... transaction: commit * executing task restart * executing "/home/*****/apps/*****/current/script/process/reaper -d 'dispatch.fcgi'" servers: ["216.118.83.207"] [216.118.83.207] executing command ** [out :: 216.118.83.207] bash: /home/*****/apps/*****/current/script/process/reaper: Permission denied command finished rake aborted! command "/home/******/apps/******/current/script/process/reaper -d 'dispatch.fcgi'" failed on 216.***.***.***</code></pre> <p>The problem is that the files in script/ and the dispatch.* files in public need to be executable, but when <a href="http://manuals.rubyonrails.com/read/book/17">Capistrano</a> pulls down the latest subversion code, it defaults those files to the permissions:</p> <pre><code>-rw-r--r--</code></pre> <p>which is just read/write.</p> <p>In order to have subversion pull down the files with the correct, executable, permissions, you must run the following command on each executable file and commit them to subversion:</p> <pre><code>$ svn propset svn:executable</code></pre> <p>I found the following article, <a href="http://blog.teksol.info/articles/2006/03/09/subversion-primer-for-rails-projects">Subversion Primer for Rails projects</a>, which has a nice script to automate the task of setting the necessary files as executable. Here&#8217;s the script:</p> <pre><code>$ svn propset svn:executable "*" `find script -type f | grep -v '.svn'` public/dispatch.*</code></pre> <p>Then, run</p> <pre><code>$ svn commit</code></pre> <p>to commit those changes to Subversion.</p> <p>I think this should resolve the issue, but I haven&#8217;t redeployed yet, so I haven&#8217;t verified that this will really fix my deployment issue.</p> Sun, 06 Aug 2006 11:25:00 -0500 urn:uuid:6c7d5d72-611c-4f06-b09b-70496d0c9c99 http://blog.pearware.org/articles/2006/08/06/rails-redeploy-issue-resolved#comments web ruby rails capistrano rails deploy errors http://blog.pearware.org/articles/2006/08/06/rails-redeploy-issue-resolved Solar Wi-Fi To Bring Net to Developing Countries <p>I think this is a very cool idea and one I am very glad to see happening. I really think efforts like this can be <a href="http://www.worldchanging.com/">worldchanging</a>, and do a lot to help people, especially children, in the developing world to have more opportunities. The project is <a href="http://www.green-wifi.org/">Green WiFi</a> and is founded by Bruce Baikie, former manager of strategic marketing and solutions for the telecommunications industry at <a href="http://www.sun.com">Sun Microsystems</a>, and Marc Pomerleau, currently a member of Sun Microsystem&#8217;s identity management marketing team. According to their site:</p> <div style="width: 90%; margin: auto; font-style: italic;"> &#8220;GREEN-WiFi strives to apply smart, sustainable, communications technologies to help bridge the digital divide for children in the developing world. A solar-powered Wi-Fi grid network solution can be part of the answer.&#8221; </div> <p>Here&#8217;s a <a href="http://hardware.slashdot.org/hardware/06/08/03/2244211.shtml">link</a> to the story on <a href="http://www.slashdot.org">Slashdot</a>.</p> Fri, 04 Aug 2006 11:24:00 -0500 urn:uuid:1709d9a0-2173-4516-864b-5d793502f47a http://blog.pearware.org/articles/2006/08/04/solar-wi-fi-to-bring-net-to-developing-countries#comments web environment technology environment tech wifi worldchanging http://blog.pearware.org/articles/2006/08/04/solar-wi-fi-to-bring-net-to-developing-countries Is your site really Web 2.0? <p>Now you can run your website through a handy-dandy <a href="http://en.wikipedia.org/wiki/Web_2.0">Web 2.0</a> validator, to see if it really is Web 2.0. This site was put together by <a href="http://30secondrule.com">30 Second Rule</a>, a website design and development company in Phoenix that is active in the Ruby community. My blog’s score should be upped by writing this article! :)</p> <p><a href="http://web2.0validator.com">Go to the Web 2.0 Validator</a></p> Thu, 03 Aug 2006 11:07:00 -0500 urn:uuid:e2cdab0f-72fa-476d-963f-47c7b91a421d http://blog.pearware.org/articles/2006/08/03/is-your-site-really-web-2-0#comments web ruby web web2.0 http://blog.pearware.org/articles/2006/08/03/is-your-site-really-web-2-0