<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>not so silent (e) &#187; programming</title>
	<atom:link href="http://notso.silent-e.com/category/programming/feed/" rel="self" type="application/rss+xml" />
	<link>http://notso.silent-e.com</link>
	<description>Be who you are and say what you feel, because those who mind don't matter and those who matter don't mind. - Dr. Seuss</description>
	<lastBuildDate>Tue, 31 Jan 2012 00:20:35 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>The databasedotcom rubygem 404 error and a solution</title>
		<link>http://notso.silent-e.com/2011/08/30/the-databasedotcom-rubygem-404-error-and-a-solution/</link>
		<comments>http://notso.silent-e.com/2011/08/30/the-databasedotcom-rubygem-404-error-and-a-solution/#comments</comments>
		<pubDate>Tue, 30 Aug 2011 18:05:32 +0000</pubDate>
		<dc:creator>matte</dc:creator>
				<category><![CDATA[programming]]></category>
		<category><![CDATA[salesforce]]></category>

		<guid isPermaLink="false">http://notso.silent-e.com/?p=1253</guid>
		<description><![CDATA[Today the databasedotcom gem was announced. This is a giant leap forward for those of us using the old ActiveSalesforce (ASF) gem. Much freetime has been donated by many developers to keep the ASF gem current but this new gem appears to have dedicated developers within Salesforce working on it. The Heroku team specifically, and [...]]]></description>
			<content:encoded><![CDATA[<p>Today the <a href="http://rubygems.org/gems/databasedotcom">databasedotcom gem</a> was <a href="http://blogs.developerforce.com/developer-relations/2011/08/new-force-com-and-database-com-ruby-gem-now-available.html">announced</a>. This is a giant leap forward for those of us using the old ActiveSalesforce (ASF) gem.  Much freetime has been donated by many developers to keep the ASF gem current but this new gem appears to have dedicated developers within Salesforce working on it. The Heroku team specifically, and so from here forward this should be the gem to use for anyone needing to talk to Saleforce.  A new era starts today!  Go read the announcement blog post for details about what&#8217;s new.</p>
<p>I started playing with the gem and encountered an error at probably the most basic of requests.  The solution however is simple.  </p>
<p>I&#8217;ve set up my client and authenticated correctly, following the excellent instructions in the gem README.  However, when I first called <code>client.list_sobjects</code> I received a 404 error that read&#8230;</p>
<p><code>Databasedotcom::SalesForceError: The requested resource does not exist</code></p>
<p>Jumping into Pry (have you used <a href="http://pry.github.com/">Pry</a>? It&#8217;s so much better than simple IRB) everything looked in order.  It&#8217;s connecting to the correct instance of the website but the path it requested is &#8220;/services/data/v23.0/sobjects&#8221;.</p>
<p>The error appears because v23.0 is not a valid API version (as of the writing of this post).  I forced it to use v22.0 and everything works.</p>
<p>Anyone else seeing this error, the fix is really easy.  Just set the DATABASEDOTCOM_VERSION environment variable to 22.0</p>
<p><code>$: export DATABASEDOTCOM_VERSION=22.0</code></p>
<p>Make sure you say &#8220;22.0&#8243;.  The &#8220;v&#8221; is prepended automatically and you have to use the &#8220;.0&#8243; also.  &#8220;22&#8243; won&#8217;t work.  There are several other environment variables available.  You can find them listed at the url below</p>
<p><a href="http://rubydoc.info/github/heroku/databasedotcom/master/frames/Databasedotcom/Client:initialize">http://rubydoc.info/github/heroku/databasedotcom/master/frames/Databasedotcom/Client:initialize</a></p>
<p>Hopefully this helps anyone experiencing the same error I received.  And to all time travellers from the future, your current version may be higher than 22.  Adjust accordingly and come see me with your TARDIS.  <img src='http://notso.silent-e.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://notso.silent-e.com/2011/08/30/the-databasedotcom-rubygem-404-error-and-a-solution/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>OSX Passenger prefpane tip</title>
		<link>http://notso.silent-e.com/2011/01/06/osx-passenger-prefpane-tip/</link>
		<comments>http://notso.silent-e.com/2011/01/06/osx-passenger-prefpane-tip/#comments</comments>
		<pubDate>Thu, 06 Jan 2011 19:44:22 +0000</pubDate>
		<dc:creator>matte</dc:creator>
				<category><![CDATA[note to self]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[ruby on rails]]></category>
		<category><![CDATA[technology]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[work]]></category>

		<guid isPermaLink="false">http://notso.silent-e.com/?p=1035</guid>
		<description><![CDATA[I recently undid all my MacPorts and started using Homebrew for some software on my Macs. That meant uninstalling the Apache MacPort and switching back to the default Snow Leopard version of Apache. Everything went relatively smoothly but today a noticed that my Passenger prefpane wasn&#8217;t listing all the Rails sites it had previously been [...]]]></description>
			<content:encoded><![CDATA[<p>I recently undid all my MacPorts and started using Homebrew for some software on my Macs.  That meant uninstalling the Apache MacPort and switching back to the default Snow Leopard version of Apache.  Everything went relatively smoothly but today a noticed that my <a href="http://www.fngtps.com/passenger-preference-pane">Passenger prefpane</a> wasn&#8217;t listing all the Rails sites it had previously been managing.</p>
<p>Turns out it was because in my original install of the prefpane I had used the &#8220;ports&#8221; version of a required ruby file, per instructions, since I was using the MacPort version of Apache.  The easy fix is to just reinstall the prefpane.  All of my sites now show up in the site listing and I can add the new site I&#8217;m currently developing.</p>
]]></content:encoded>
			<wfw:commentRss>http://notso.silent-e.com/2011/01/06/osx-passenger-prefpane-tip/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Dr. Strange-charset-conversion Or: How I Learned To Stop Worrying And Love Converting From Latin1 to UTF8</title>
		<link>http://notso.silent-e.com/2010/10/13/dr-strange-charset-conversion-or-how-i-learned-to-stop-worrying-and-love-converting-from-latin1-to-utf8/</link>
		<comments>http://notso.silent-e.com/2010/10/13/dr-strange-charset-conversion-or-how-i-learned-to-stop-worrying-and-love-converting-from-latin1-to-utf8/#comments</comments>
		<pubDate>Wed, 13 Oct 2010 18:53:20 +0000</pubDate>
		<dc:creator>matte</dc:creator>
				<category><![CDATA[programming]]></category>
		<category><![CDATA[work]]></category>

		<guid isPermaLink="false">http://notso.silent-e.com/?p=979</guid>
		<description><![CDATA[Recently, at work, I&#8217;d decided it was time to deal with my MySQL charset problems. In most places my server db was set to a latin1 charset. Unfortunately, someone who maintains content has been pasting unicode characters in. While my public websites display the information correctly, when I synced the content to my local development [...]]]></description>
			<content:encoded><![CDATA[<p>Recently, at work, I&#8217;d decided it was time to deal with my MySQL charset problems.  In most places my server db was set to a latin1 charset. Unfortunately, someone who maintains content has been pasting unicode characters in.  While my public websites display the information correctly, when I synced the content to my local development computer those unicode characters would display incorrectly.  The image below shows the comparison.</p>
<p><img src="http://notso.silent-e.com/images/display-comparison.png" alt="Charset problem comparison" title="display-comparison" width="500" height="373" class="imgcenter size-full wp-image-980" /></p>
<p><span id="more-979"></span></p>
<p>This was puzzling, and despite everything I tried I couldn’t get that same content to display correctly on my iMac.  However, this was a localized problem on my iMac because my MacBook displayed everything correctly.  I tried but I couldn’t figure out where the discrepancy was between the two machines so I decided to move on and fix it at the source.</p>
<p>There are tens of thousands of posts on the Internet explaining how to convert to UTF8 but nothing seemed to work until I discovered <a href="http://codex.wordpress.org/Converting_Database_Character_Sets">this post on the WordPress Codex</a>.  That post was the first one I could find that specifically addressed unicode content stored in latin1 columns and how to properly convert it.</p>
<p>To put it simply, you need to convert your text columns to their binary field type counterpart and then convert back to the text type but specifying the utf8 charset.  Once I did this, the page displayed correctly on my iMac.  Here’s what I did.</p>
<ul>
<li>Backed up my database.  While this wasn’t really needed since it’s just my local develoment machine, it’s still a good practice.</li>
<li>Opened up my terminal and ran mysql with the -s &#8211;skip-column-names flags that make it easier to copy and paste the output.</li>
<li>Ran the following script. NOTE: when doing this yourself, remember to replace “db_name” with the name of your own database.</li>
</ul>
<pre class="brush: sql; light: true; title: ; notranslate">
USE information_schema;
SELECT CONCAT('ALTER TABLE `', table_name, '` MODIFY `', column_name, '` ', REPLACE(column_type, 'char', 'binary'), ';') FROM columns WHERE table_schema = 'db_name' and data_type = 'char';
SELECT CONCAT('ALTER TABLE `', table_name, '` MODIFY `', column_name, '` ', REPLACE(column_type, 'varchar', 'varbinary'), ';') FROM columns WHERE table_schema = 'db_name' and data_type = 'varchar';
SELECT CONCAT('ALTER TABLE `', table_name, '` MODIFY `', column_name, '` ', REPLACE(column_type, 'tinytext', 'tinybinary'), ';') FROM columns WHERE table_schema = 'db_name' and data_type = 'tinytext';
SELECT CONCAT('ALTER TABLE `', table_name, '` MODIFY `', column_name, '` ', REPLACE(column_type, 'text', 'blob'), ';') FROM columns WHERE table_schema = 'db_name' and data_type = 'text';
SELECT CONCAT('ALTER TABLE `', table_name, '` MODIFY `', column_name, '` ', REPLACE(column_type, 'mediumtext', 'mediumbinary'), ';') FROM columns WHERE table_schema = 'db_name' and data_type = 'mediumtext';
SELECT CONCAT('ALTER TABLE `', table_name, '` MODIFY `', column_name, '` ', REPLACE(column_type, 'longtext', 'longbinary'), ';') FROM columns WHERE table_schema = 'db_name' and data_type = 'longtext';  

SELECT CONCAT('ALTER TABLE `', table_name, '` MODIFY `', column_name, '` ', column_type, ' CHARACTER SET utf8;') FROM columns WHERE table_schema = 'db_name' and data_type = 'char';
SELECT CONCAT('ALTER TABLE `', table_name, '` MODIFY `', column_name, '` ', column_type, ' CHARACTER SET utf8;') FROM columns WHERE table_schema = 'db_name' and data_type = 'varchar';
SELECT CONCAT('ALTER TABLE `', table_name, '` MODIFY `', column_name, '` ', column_type, ' CHARACTER SET utf8;') FROM columns WHERE table_schema = 'db_name' and data_type = 'tinytext';
SELECT CONCAT('ALTER TABLE `', table_name, '` MODIFY `', column_name, '` ', column_type, ' CHARACTER SET utf8;') FROM columns WHERE table_schema = 'db_name' and data_type = 'text';
SELECT CONCAT('ALTER TABLE `', table_name, '` MODIFY `', column_name, '` ', column_type, ' CHARACTER SET utf8;') FROM columns WHERE table_schema = 'db_name' and data_type = 'mediumtext';
SELECT CONCAT('ALTER TABLE `', table_name, '` MODIFY `', column_name, '` ', column_type, ' CHARACTER SET utf8;') FROM columns WHERE table_schema = 'db_name' and data_type = 'longtext';

SELECT DISTINCT CONCAT('ALTER TABLE `', table_name, '` CONVERT TO CHARACTER SET utf8;') FROM columns WHERE table_schema = 'db_name';
</pre>
<p>The output, in my case, was like this&#8230;</p>
<pre class="brush: sql; light: true; title: ; notranslate">
ALTER TABLE `registrations` MODIFY `name` varbinary(50);
ALTER TABLE `registrations` MODIFY `name` varchar(50) CHARACTER SET utf8;
ALTER TABLE `registrations` CONVERT TO CHARACTER SET utf8;
ALTER DATABASE `db_name` CHARACTER SET utf8;
</pre>
<p>This is just a snippet of my code but you can see exactly what’s going on.  First, the registrations.name column is being converted to varbinary(50).  Binary columns don’t care about character sets.  Then it’s being converted back to it’s original varchar(50) column but specifying “CHARACTER SET utf8”.  Finally, we convert the table and database to utf8.</p>
<p>Now go forth and spread the P.O.E. &#8230; Purity Of Encodings. <img src='http://notso.silent-e.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://notso.silent-e.com/2010/10/13/dr-strange-charset-conversion-or-how-i-learned-to-stop-worrying-and-love-converting-from-latin1-to-utf8/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to fix the Windows desktop context menu after installing Samsung MagicRotation</title>
		<link>http://notso.silent-e.com/2010/02/16/how-to-fix-the-windows-desktop-context-menu-after-installing-samsung-magicrotation/</link>
		<comments>http://notso.silent-e.com/2010/02/16/how-to-fix-the-windows-desktop-context-menu-after-installing-samsung-magicrotation/#comments</comments>
		<pubDate>Tue, 16 Feb 2010 22:21:33 +0000</pubDate>
		<dc:creator>matte</dc:creator>
				<category><![CDATA[git]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[technology]]></category>
		<category><![CDATA[work]]></category>
		<category><![CDATA[wtf?]]></category>

		<guid isPermaLink="false">http://notso.silent-e.com/?p=904</guid>
		<description><![CDATA[With the new computer setup I have at work, I needed to have one of my monitors rotated 90&#176; so it would fit until a better solution was attempted. The desktop wasn&#8217;t rotating though because I hadn&#8217;t installed Samsung&#8217;s MagicRotation software. So I did. After doing so, I noticed that the context menu on my [...]]]></description>
			<content:encoded><![CDATA[<p>With the new computer setup I have at work, I needed to have one of my monitors rotated 90&deg; so it would fit until a better solution was attempted.  The desktop wasn&#8217;t rotating though because I hadn&#8217;t installed Samsung&#8217;s MagicRotation software.  So I did.</p>
<p>After doing so, I noticed that the context menu on my desktop was way screwed up.  All the text had shifted over to the right and was unreadable.</p>
<p><span id="more-904"></span></p>
<p><img src="http://notso.silent-e.com/images/messed-up-desktop-context-menu.png" alt="messed up context menu" title="messed up context menu" class="clean right" /></p>
<p>See?  WTF?  The &#8220;MagicRotation&#8221; <strike>spam</strike> branding is pushing the text to the side.  Luckily <a href="http://groups.google.com/group/tortoisesvn/browse_thread/thread/b92ef51927bdabef/ac1932188db878a6?lnk=raot" target="_blank">the solution was already on the web</a>.  Thank you megacorp search engine starting with a &#8220;G&#8221;</p>
<p>Turns out if you are running TortoiseGit and/or TortoiseSVN then you need to turn off the icons by adding some registry keys.  These are safe additions but as always, backup your registry before attempting to mess with it.</p>
<p>Just add a DWORD entry at either &#8220;HKCU\Software\Tort​oiseSVN\ ShowContextMenuIcons&#8221; or &#8220;HKCU\Software\Tort​oiseGit\ ShowContextMenuIcons&#8221; depending on the programs you are using.  It should have a hex or decimal value, doesn&#8217;t matter which, of &#8220;0&#8243; (zero).</p>
<p>After that, just wait a few seconds and your context menu should be readable again, but without the icons for those programs.  A small, and IMHO welcome, compromise that I can live with</p>
<p><img src="http://notso.silent-e.com/images/desktop-context-menu-before-after.png" class="clean center" /></p>
]]></content:encoded>
			<wfw:commentRss>http://notso.silent-e.com/2010/02/16/how-to-fix-the-windows-desktop-context-menu-after-installing-samsung-magicrotation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>how to think of &#8220;git diff&#8221; using branch names</title>
		<link>http://notso.silent-e.com/2009/10/26/how-to-think-of-git-diff-using-branch-names/</link>
		<comments>http://notso.silent-e.com/2009/10/26/how-to-think-of-git-diff-using-branch-names/#comments</comments>
		<pubDate>Mon, 26 Oct 2009 23:01:19 +0000</pubDate>
		<dc:creator>matte</dc:creator>
				<category><![CDATA[git]]></category>
		<category><![CDATA[note to self]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[tips]]></category>

		<guid isPermaLink="false">http://notso.silent-e.com/?p=798</guid>
		<description><![CDATA[This post is more of a note to myself to remember how to think of certain git diff commands but it might be useful to other newbie-ish users of git. This is from my own experimentation, since I couldn&#8217;t find a good newbie-understandable explanation of this on the Interwebs. git diff &#60;branch name&#62; &#8211; means [...]]]></description>
			<content:encoded><![CDATA[<p>This post is more of a note to myself to remember how to think of certain git diff commands but it might be useful to other newbie-ish users of git.  This is from my own experimentation, since I couldn&#8217;t find a good newbie-understandable explanation of this on the Interwebs.</p>
<p><strong><em>git diff &lt;branch name&gt;</em></strong> &#8211; means what would change if we applied the current working HEAD of the branch we are on, including all unstaged/uncommitted changes, to the named branch.</p>
<p><strong><em>git diff &lt;branch 1&gt; &lt;branch 2&gt;</em></strong> &#8211; means what would change if we applied &lt;branch 2&gt; onto &lt;branch 1&gt;</p>
]]></content:encoded>
			<wfw:commentRss>http://notso.silent-e.com/2009/10/26/how-to-think-of-git-diff-using-branch-names/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jQuery Tools&#8217; Scrollable as a circular carousel</title>
		<link>http://notso.silent-e.com/2009/07/04/jquery-tools-scrollable-as-a-circular-carousel/</link>
		<comments>http://notso.silent-e.com/2009/07/04/jquery-tools-scrollable-as-a-circular-carousel/#comments</comments>
		<pubDate>Sat, 04 Jul 2009 22:29:09 +0000</pubDate>
		<dc:creator>matte</dc:creator>
				<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://notso.silent-e.com/?p=766</guid>
		<description><![CDATA[I recently discovered a new jQuery effect library named jQuery Tools. It&#8217;s like jQuery UI but more focused on the core items that can improve the usefulness of a website. Tabs, tooltips, scrollables, overlays, and a few more. I began using it this week to replace a carousel on my website at work. My website [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://notso.silent-e.com/images/jqt_scrollable.png" alt="jQuery Tools - Scrollable" title="jQuery Tools - Scrollable" width="400" height="138" class="clean center" /><br />
I recently discovered a new jQuery effect library named <a href="http://flowplayer.org/tools/">jQuery Tools</a>.  It&#8217;s like jQuery UI but more focused on the core items that can improve the usefulness of a website.  <a href="http://flowplayer.org/tools/tabs.html">Tabs</a>, <a href="http://flowplayer.org/tools/tooltip.html">tooltips</a>, <a href="http://flowplayer.org/tools/scrollable.html">scrollables</a>, <a href="http://flowplayer.org/tools/overlay.html">overlays</a>, and a few more.  I began using it this week to replace a carousel on <a href="http://www.ruckuswireless.com">my website at work</a>.  My website uses several different javascript libraries for these very same techniques but they&#8217;re all from different authors.  I like the idea of having a single library instead of tracking several so I&#8217;ve started converting those libraries over to jQuery Tools.  The first to go was the homepage carousel.</p>
<p>After replacing the old carousel with the new one, I discovered that the new code didn&#8217;t provide a way to do circular carousels.  It had a fixed beginning and an end.  You could program it to loop but when you got to the end and told it to move to the right again it would actually scroll really fast to the left until the first item was back on the left edge.  In a circular carousel, if you&#8217;re on the last item, you want the first item to show up to the right of the last item if you move past the end, looping forever.</p>
<p>So, with the code being released under the GPL opensource license, I did what any self-respecting developer would do.  I patched the code to make it circular when you told it you wanted it to loop.  This is a change from the old way it worked so people using this library and expecting the old functionality should be warned.  I could have added a &#8220;loopmethod&#8221; config variable but I didn&#8217;t want to introduce any new configuration variables without approval from the true author.  As it is, I only added one new method &ndash; a way to move a specific item to the left most item using an unnoticeable jump, instead of the default scroll.  This is part of the magic that makes it able to simulate a circular loop.  Compressed with the YUI Javascript Compressor, it only adds 600-ish bytes to the code.  Even less, when you finally gzip it.  Acceptable for the return in functionality, IMNSHO.</p>
<p>I haven&#8217;t tested it 100%, notably the code where you are using the custom API methods, but it SHOULD be good to go by just replacing your old version.  YMMV.  I will be submitting this to the author of jQuery Tools so he can evaluate it for the next revision of Scrollable.  In the mean time, test it, use it, let me know what you think.</p>
<p><a href="http://www.silent-e.com/code/javascript/tools.scrollable-1.0.5.js">Download the Scrollable javascript</a></p>
<div class="update">
<p><strong>UPDATE 7/6</strong> &#8211; Added autoscroll pausing when hovering over the specific page nav links, just like when hovering over the &#8220;next&#8221; and &#8220;previous&#8221; links.</p>
<p><strong>UPDATE 7/6 #2</strong> &#8211; Fixed a problem with the &#8220;disabledClass&#8221; on prev/next/prevPage/nextPage when looping.  Those elements should always appear when looping and you have them in the html.</p>
<p><strong>UPDATE 7/7</strong> &#8211; I&#8217;ve pushed my updated version of the code to my employer&#8217;s website so you can see the circular ability in action.  Visit <a href="http://www.ruckuswireless.com">http://www.ruckuswireless.com</a>.  The homepage has the page nav links underneath while the &#8220;Solutions&#8221;, &#8220;Verticals&#8221;, &#8220;TechTalk&#8221;, &#8220;Products&#8221;, &#8220;Ruck(us)&#8221; and &#8220;Management&#8221; page &#8211; under Ruck(us) &#8211; do not use the page nav links.  Note that on the &#8220;Ruck(us)&#8221; page, the &#8220;next&#8221; and &#8220;previous&#8221; links are automatically hidden because there aren&#8217;t more items than are already displayed.</p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://notso.silent-e.com/2009/07/04/jquery-tools-scrollable-as-a-circular-carousel/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
		</item>
		<item>
		<title>Fixing Snarl and autotest_menu in windows</title>
		<link>http://notso.silent-e.com/2009/04/09/fixing-snarl-and-autotest-menu-in-windows/</link>
		<comments>http://notso.silent-e.com/2009/04/09/fixing-snarl-and-autotest-menu-in-windows/#comments</comments>
		<pubDate>Thu, 09 Apr 2009 19:33:24 +0000</pubDate>
		<dc:creator>matte</dc:creator>
				<category><![CDATA[me me me]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[ruby on rails]]></category>
		<category><![CDATA[tips]]></category>

		<guid isPermaLink="false">http://notso.silent-e.com/?p=721</guid>
		<description><![CDATA[I&#8217;ve been trying to get ZenSpider autotest and Windows to play nice for a while. First, I had the problem where autotest would only run once and not stick around waiting for updates to my code. That was fixed by Luke Pearce. He commented on a previous post with his fix and I can confirm [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been trying to get ZenSpider autotest and Windows to play nice for a while.  First, I had the problem where autotest would only run once and not stick around waiting for updates to my code.  That was fixed by <a href="http://www.kulesolutions.com/" target="_blank">Luke Pearce</a>.  He <a href="http://notso.silent-e.com/2009/04/06/turning-off-the-rails-232-backtracecleaner/#comment-9523" target="_blank">commented on a previous post</a> with his fix and I can confirm that it works.  Thanx Luke!</p>
<p>I encountered another problem now.  When I ran my autotest but tried to shut it down by hitting Control-C twice in a row, the tests would just reset and run again.  Double Control-C is supposed to interrupt the process and allow me to shut it down.  This it did not do.<br />
<span id="more-721"></span><br />
I am also running the autotest/menu plugin that is supposed to explicitly ask you whether you want to quit, restart or just keep going when you hit Control-C, even if it&#8217;s just hitting it once.  This is the best possible option and is what I recommend, but it wasn&#8217;t happening.  There were no prompts to quit, continue, or restart.  Just restarting the entire test suite EVERY time I hit Control-C, whether it was two quick hits or 10 hits a row.</p>
<p>I originally looked at the code thinking that I should fix it there.  Autotest provides hooks into it&#8217;s process.  Run, interrupt, quit, etc.  I figured it had to do with one of those so I first tried just commenting out the :interrupt hook code on lines 39-41 in ZenTest-4.0.0/lib/autotest/snarl.rb.  This worked and I was happy.  However it still didn&#8217;t feel right.  I didn&#8217;t want to hack the code and ask them to fix it.  It must be working for other people because I haven&#8217;t seen other people complaining about it.</p>
<p>Turns out the fix is a really easy one and requires no hacking on the gem code at all.  It was just a problem with the order of my &#8220;require&#8221; lines in my .autotest file.  My original .autotest file looked like this&#8230;</p>
<p><code>require 'redgreen/autotest'<br />
require 'Win32/Console/ANSI'<br />
require 'autotest/snarl'<br />
require 'autotest/menu'<br />
require 'autotest/timestamp'</code></p>
<p>The .autotest file that WORKS swaps the &#8220;snarl&#8221; and &#8220;menu&#8221; lines around, like so&#8230;</p>
<p><code>require 'redgreen/autotest'<br />
require 'Win32/Console/ANSI'<br />
require 'autotest/menu'<br />
require 'autotest/snarl'<br />
require 'autotest/timestamp'</code></p>
]]></content:encoded>
			<wfw:commentRss>http://notso.silent-e.com/2009/04/09/fixing-snarl-and-autotest-menu-in-windows/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Turning off the Rails 2.3.2 BacktraceCleaner</title>
		<link>http://notso.silent-e.com/2009/04/06/turning-off-the-rails-232-backtracecleaner/</link>
		<comments>http://notso.silent-e.com/2009/04/06/turning-off-the-rails-232-backtracecleaner/#comments</comments>
		<pubDate>Mon, 06 Apr 2009 23:27:38 +0000</pubDate>
		<dc:creator>matte</dc:creator>
				<category><![CDATA[me me me]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[ruby on rails]]></category>
		<category><![CDATA[tips]]></category>

		<guid isPermaLink="false">http://notso.silent-e.com/?p=714</guid>
		<description><![CDATA[I had a situation today where, when running some functional tests, the error backtrace being displayed was not helpful at ALL. I was defining a layout for a controller as a symbol instead of a string like I should have been using. You use a string when you are just saying &#8220;Use this layout&#8221; and [...]]]></description>
			<content:encoded><![CDATA[<p>I had a situation today where, when running some functional tests, the error backtrace being displayed was not helpful at ALL.  I was defining a layout for a controller as a symbol instead of a string like I should have been using.  You use a string when you are just saying &#8220;Use this layout&#8221; and you use a symbol when you have a method to call that responds with the layout to use.  The error I was getting was &#8230;</p>
<p><code>NoMethodError: undefined method `admin' for #&lt;Admin::RegistrationsController&gt;</code></p>
<p>but what was the first line that came up in the backtrace?</p>
<p><code>app/controllers/admin/registrations_controller.rb:18:in `show'</code></p>
<p>This was giving me fits.  There&#8217;s no call to &#8216;admin&#8217; in the &#8216;show&#8217; method.  I knew there had to be something else so I searched for how to see more of the backtrace.</p>
<p>The BacktraceCleaner <a href="http://guides.rubyonrails.org/2_3_release_notes.html#quieter-backtraces" target="_blank">introduced in Rails 2.3.2</a> cleans out backtrace lines coming from the Rails framework (Railties, etc).  This is usually what you want.  However, I was sure that my error was coming from somewhere in the framework.  Turns out it&#8217;s really simple to turn off the backtrace cleaner.  Add this line in a &#8216;setup&#8217; method in your test_helper.rb file.</p>
<p><code>Rails.backtrace_cleaner.remove_silencers!</code></p>
<p>Very simple, very easy.  My name is Chef Tell.  <img src='http://notso.silent-e.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://notso.silent-e.com/2009/04/06/turning-off-the-rails-232-backtracecleaner/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Rails 2.3.2 and testing with assert_select_email</title>
		<link>http://notso.silent-e.com/2009/04/02/rails-232-and-testing-with-assert_select_email/</link>
		<comments>http://notso.silent-e.com/2009/04/02/rails-232-and-testing-with-assert_select_email/#comments</comments>
		<pubDate>Thu, 02 Apr 2009 22:38:48 +0000</pubDate>
		<dc:creator>matte</dc:creator>
				<category><![CDATA[programming]]></category>
		<category><![CDATA[ruby on rails]]></category>
		<category><![CDATA[tips]]></category>

		<guid isPermaLink="false">http://notso.silent-e.com/2009/04/02/rails-232-and-testing-with-assert_select_email/</guid>
		<description><![CDATA[I upgraded a project to Rails 2.3.2 a while back and have been getting the following error when running some unit tests&#8230; NoMethodError: undefined method `assert_select_email' for #&#60;UserMailerTest&#62; I posted to the rubyonrails-talk google group but never got a response, and I was not the first to post about this problem to that group. However [...]]]></description>
			<content:encoded><![CDATA[<p>I upgraded a project to Rails 2.3.2 a while back and have been getting the following error when running some unit tests&#8230;</p>
<p><code>NoMethodError: undefined method `assert_select_email' for #&lt;UserMailerTest&gt;</code></p>
<p>I <a href="http://groups.google.com/group/rubyonrails-talk/browse_thread/thread/fabaf2c73943e268" target="_blank">posted to the rubyonrails-talk google group</a> but never got a response, and I was not the first to post about this problem to that group.  However I found someone else commenting on this in an <a href="https://rspec.lighthouseapp.com/projects/5645/tickets/736-no-access-to" target="_blank">rspec lighthouse ticket</a> and they&#8217;d fixed it for their setup.  It was an easy conversion to non-rspec and here&#8217;s the line you need to add to your test/test_helper.rb file</p>
<p><code>include ActionController::Assertions::SelectorAssertions</code></p>
<p>I&#8217;m not sure why it&#8217;s broken but it appears to have regressed in one of the Rails 2.3.2 RCs.</p>
]]></content:encoded>
			<wfw:commentRss>http://notso.silent-e.com/2009/04/02/rails-232-and-testing-with-assert_select_email/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How I block people from visiting a website</title>
		<link>http://notso.silent-e.com/2008/11/24/how-i-block-people-from-visiting-a-website/</link>
		<comments>http://notso.silent-e.com/2008/11/24/how-i-block-people-from-visiting-a-website/#comments</comments>
		<pubDate>Mon, 24 Nov 2008 22:31:37 +0000</pubDate>
		<dc:creator>matte</dc:creator>
				<category><![CDATA[programming]]></category>
		<category><![CDATA[technology]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[work]]></category>

		<guid isPermaLink="false">http://notso.silent-e.com/?p=622</guid>
		<description><![CDATA[Inspired by the article Block a Website for Everyone But You over at CSS Tricks, I thought I&#8217;d post my way of blocking people from accessing my websites while I work on them. Chris Coyier over at CSS Tricks uses the following code in his .htaccess file to block visitors. RewriteEngine On RewriteBase / RewriteCond [...]]]></description>
			<content:encoded><![CDATA[<p>Inspired by the article <a href="http://css-tricks.com/block-a-website-for-everyone-but-you/" target="_blank">Block a Website for Everyone But You</a> over at CSS Tricks, I thought I&#8217;d post my way of blocking people from accessing my websites while I work on them.</p>
<p>Chris Coyier over at CSS Tricks uses the following code in his .htaccess file to block visitors.</p>
<p><code>RewriteEngine On<br />
RewriteBase /<br />
RewriteCond %{REMOTE_HOST} !^71\.225\.113\.171<br />
RewriteCond %{REMOTE_HOST} !^71\.185\.239\.212<br />
RewriteCond %{REMOTE_HOST} !^69\.253\.223\.254<br />
RewriteCond %{REQUEST_URI} !/comingsoon\.html$<br />
RewriteRule .* /comingsoon.html [R=302,L]<br />
</code></p>
<p>What he&#8217;s doing there is checking for specific IP addresses that are allowed to see the website but everyone else is sent to the &#8220;comingsoon.html&#8221; webpage.  This is great for people who have specific IP addresses but if you&#8217;re behind a proxy like I am at work then everyone else with you behind that proxy can still see the site.</p>
<p>I find it much easier to redirect everyone but check for a custom cookie that I can set using the <a href="https://addons.mozilla.org/en-US/firefox/addon/60" target="_blank">Webdeveloper Firefox extension</a>.  That way I can check to make sure that the redirect to the maintenance page is actually working.  Here&#8217;s the relevant code that I use (taken from a RoR tutorial of old)</p>
<p><code>RewriteCond %{DOCUMENT_ROOT}/maintenance.html -f<br />
RewriteCond %{SCRIPT_FILENAME} !maintenance.html<br />
RewriteCond %{HTTP_COOKIE} !^.*access_cookie=1.*$<br />
RewriteRule ^.*$ /maintenance.html [L]<br />
</code></p>
<p>where the text &#8220;access_cookie&#8221; (sans quotes) would be whatever cookie name you want to use.  I just create a &#8220;session cookie&#8221; set to a value of &#8220;1&#8243; (or whatever you want to make it) and check for it&#8217;s existence.</p>
<p>That gets around the problem of DHCP granted or spoofed IP addresses.  Sure a cookie is easy to add but if you make the name and/or value sufficiently difficult to guess, no one is getting in.</p>
<p>Now just add your cookie.</p>
<p><img src="http://notso.silent-e.com/images/add_cookie.png" class="clean" /></p>
<p>Note in the image that I have set it to be a &#8220;session cookie&#8221;.  This helps when you forget to delete the cookie.  Just close your tab (FF) or browser (IE), reopen it and the cookie will be gone.</p>
<p>Oh yeah.  The other thing that my .htaccess code does is, on the first line, check for the existence of the &#8220;maintenance.html&#8221; file.  I don&#8217;t want to have to add and remove this code everytime I want to take the site down.  It&#8217;s much easier to just have this code permanently in my .htaccess file and then upload the file that people will see when the site is down.  I then delete it when the site is ready to be reopened.  This is all performed using a custom Capistrano command that I run when I&#8217;m ready to deploy a new version.</p>
]]></content:encoded>
			<wfw:commentRss>http://notso.silent-e.com/2008/11/24/how-i-block-people-from-visiting-a-website/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

