<?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>Mission Data Blog &#187; steveny</title>
	<atom:link href="http://www.missiondata.com/blog/author/steveny/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.missiondata.com/blog</link>
	<description>Louisville-based Web Development &#38; Software Engineering</description>
	<lastBuildDate>Tue, 24 Jan 2012 14:58:58 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1</generator>
		<item>
		<title>MetaSearch</title>
		<link>http://www.missiondata.com/blog/software-development/244/metasearch/</link>
		<comments>http://www.missiondata.com/blog/software-development/244/metasearch/#comments</comments>
		<pubDate>Fri, 17 Sep 2010 18:18:40 +0000</pubDate>
		<dc:creator>steveny</dc:creator>
				<category><![CDATA[Software Development]]></category>
		<category><![CDATA[Ernie Miller]]></category>
		<category><![CDATA[MetaSearch]]></category>
		<category><![CDATA[Ruby5 podcast]]></category>

		<guid isPermaLink="false">http://www.missiondata.com/blog/?p=244</guid>
		<description><![CDATA[Most people know we churn out a good many Rails-based websites. Now one of our own, Ernie Miller, is starting to make waves with his object-based searching gem, MetaSearch. For his efforts, Ernie received a mention on the Ruby5 podcast. Go listen to the podcast, then go check out MetaSearch!]]></description>
			<content:encoded><![CDATA[<p>Most people know we <a href="http://www.cheapcycleparts.com/">churn</a> <a href="http://www.louisvillerealtors.com/">out</a> <a href="http://www.schlechtycenter.org/">a</a> <a href="http://www.cnpe.org/">good</a> <a href="http://www.cattlefax.com/">many</a> <a href="http://www.streamthatcause.com/">Rails</a>-<a href="http://powerpacknation.optimabatteries.com">based</a> <a href="http://www.ymilive.org/">websites</a>.  Now one of our own, <a href="http://metautonomo.us/">Ernie Miller</a>, is starting to make waves with his object-based searching gem, <a href="http://metautonomo.us/projects/metasearch">MetaSearch</a>.  For his efforts, Ernie received a mention on the <a href="http://ruby5.envylabs.com/episodes/114-episode-112-september-17th-2010">Ruby5 podcast</a>.  Go listen to the <a href="http://ruby5.envylabs.com/episodes/114-episode-112-september-17th-2010">podcast</a>, then go check out MetaSearch!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.missiondata.com/blog/software-development/244/metasearch/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Showing progress using dd</title>
		<link>http://www.missiondata.com/blog/system-administration/87/showing-progress-using-dd/</link>
		<comments>http://www.missiondata.com/blog/system-administration/87/showing-progress-using-dd/#comments</comments>
		<pubDate>Wed, 16 Sep 2009 15:04:39 +0000</pubDate>
		<dc:creator>steveny</dc:creator>
				<category><![CDATA[System Administration]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://www.missiondata.com/blog/linux/87/showing-progress-using-dd/</guid>
		<description><![CDATA[One of the frustrating behaviors of dd is that it provides no feedback about what it is doing. It does however provide a signal (USR1) that you can send to the process that will dump the current progress. Open a new terminal (I use screen) and type: while true; do kill -USR1 `pidof dd`; sleep [...]]]></description>
			<content:encoded><![CDATA[<p>One of the frustrating behaviors of <a href="http://en.wikipedia.org/wiki/Dd_%28Unix%29">dd</a> is that it provides no feedback about what it is doing.  It does however provide a signal (USR1) that you can send to the process that will dump the current progress.  Open a new terminal (I use screen) and type:</p>
<pre><code>while true; do kill -USR1 `pidof dd`; sleep 2; done</code></pre>
<p>(NOTE: if `pidof dd` doesn&#8217;t work for you, just use the process id directly)</p>
<p>Switch back to the terminal where dd is running and you should see:</p>
<pre><code>9902751744 bytes (9.9 GB) copied, 732.883 s, 13.5 MB/s
9469+0 records in
9468+0 records out
9927917568 bytes (9.9 GB) copied, 734.914 s, 13.5 MB/s
9496+0 records in
9495+0 records out
9956229120 bytes (10 GB) copied, 736.941 s, 13.5 MB/s</code></pre>
<p>updating every couple of seconds.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.missiondata.com/blog/system-administration/87/showing-progress-using-dd/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Deploying a Subversion branch with Capistrano</title>
		<link>http://www.missiondata.com/blog/system-administration/84/deploying-an-svn-branch-with-capistrano/</link>
		<comments>http://www.missiondata.com/blog/system-administration/84/deploying-an-svn-branch-with-capistrano/#comments</comments>
		<pubDate>Wed, 30 Jan 2008 15:39:34 +0000</pubDate>
		<dc:creator>steveny</dc:creator>
				<category><![CDATA[System Administration]]></category>
		<category><![CDATA[Capistrano]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://www.missiondata.com/blog/ruby/84/deploying-an-svn-branch-with-capistrano/</guid>
		<description><![CDATA[Capistrano is a tool for automating tasks via SSH on remote servers. It has many uses, I (and many others) use it to deploy their (rails) applications. The best I can tell there is no built in way to deploy a branch from your source code control system. There are a couple ways of accomplishing [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.capify.org/">Capistrano</a> is a tool for automating tasks via SSH on remote servers.  It has many uses, I (and many others) use it to deploy their (rails) applications.  The best I can tell there is no built in way to deploy a branch from your source code control system.  There are a couple <a href="http://blog.aisleten.com/2007/09/04/deploying-svn-tags-using-capistrano/">ways of accomplishing</a> this.  I chose passing in the branch as a parameter to the Capistrano command:</p>
<pre><code>cap --set-before branch=testbranch  deploy</code></pre>
<p><span id="more-84"></span><br />
&#8230;where &#8216;testbranch&#8217; is the name of my subversion branch, and &#8216;deploy&#8217; is the action to take.  The &#8216;&#8211;set-before option&#8217; sets a variable before the recipes are loaded (<a href="http://osdir.com/ml/lang.ruby.capistrano.general/2006-11/msg00012.html">sort of)</a>.  All you need to do to make this work you just need to set the repository URL correctly based on if the branch variable exists or not.  In my case, that is editing the top of deploy.rb in the config section of my rails app:</p>
<pre><code>if variables.include?(:branch)
  set :repository,  "http://svn.example.com/project/branches/#{branch}"
else
  set :repository,  "http://svn.example.com/project/trunk"
end</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://www.missiondata.com/blog/system-administration/84/deploying-an-svn-branch-with-capistrano/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Handling Session Timeouts (and other errors) using Ajax</title>
		<link>http://www.missiondata.com/blog/web-development/83/handling-session-timeouts-and-other-errors-using-ajax/</link>
		<comments>http://www.missiondata.com/blog/web-development/83/handling-session-timeouts-and-other-errors-using-ajax/#comments</comments>
		<pubDate>Fri, 11 Jan 2008 20:18:11 +0000</pubDate>
		<dc:creator>steveny</dc:creator>
				<category><![CDATA[Tips]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[session timeouts]]></category>

		<guid isPermaLink="false">http://www.missiondata.com/blog/uncategorized/83/handling-session-timeouts-and-other-errors-using-ajax/</guid>
		<description><![CDATA[Ajax can bring a much more responsive and intuitive feel to web applications. However, many times developers overlook error cases when using Ajax. What if the request fails? In one particular case a user&#8217;s session may have timed out before they made an Ajax call. This post describes one such way of handling this in [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://en.wikipedia.org/wiki/Ajax_(programming)">Ajax</a> can bring a much more responsive and intuitive feel to web applications.  However, many times developers overlook error cases when using Ajax.  What if the request fails?  In one particular case a user&#8217;s session may have timed out before they made an Ajax call.  This post describes one such way of handling this in a somewhat friendly way.<br />
<span id="more-83"></span></p>
<h3>Handling session timeouts on non-Ajax requests</h3>
<p>The first step to handing session timeouts with AJAX is to handle them for non-Ajax requests first.  One way of doing this is trapping the URL the user is attempting to access  (but not authenticated to), redirecting them to a login page, and upon success, redirecting them back to their original request.</p>
<p>If they aren&#8217;t authenticated, send them to the login page:</p>
<pre><code>if(!loggedIn())
{
  response.sendRedirect("/login.jsp?uri=" + URLEncoder.encode(fullURI, "UTF8"));
}</code></pre>
<p>Hide the original request in the page:</p>
<pre><code></code>
<form action="/account/login" method="POST">
<input name="uri" type="hidden" value="&lt;%=request.getParameter(" />"&gt;
  <label for="user_login">ID:</label>
<input id="user_login" name="user_login" type="text" />
  <label for="user_password">Password:</label>
<input id="user_password" name="user_password" type="password" />
<input name="login" type="submit" />
</form>
</pre>
<p>&#8230;and after a successful signup, send them back to where they wanted to go:</p>
<pre><code>if(authenticated())
{
  response.sendRedirect(request.getParameter("uri"));
}</code></pre>
<h3>Handling Session Timeouts for Ajax Requests</h3>
<p>The first thing we need to know is if it is an ajax request or not.  Since I am going to use <a href="http://www.prototypejs.org/">prototype</a> for all my ajax calls it is as straight forward as looking for the special header prototype sends on each request:</p>
<pre><code>private boolean isXMLHttpRequest(HttpServletRequest request)
{
  return request.getHeader("x-requested-with") != null &amp;amp;&amp;amp; request.getHeader("x-requested-with").equals("XMLHttpRequest");
}</code></pre>
<p>Once we know the request type, we will send a non-200 <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html">HTTP status code</a> if their is an authentication error.  From the standards, the most appropriate status code is a 401 (Unauthorized).  This code, however, comes with some baggage.  On a non-ajax HTTP request all browsers will respond by displaying an authentication dialog.  Most browsers don&#8217;t do this on ajax calls.  Most.  Safari decided that it should pop up the authentication dialog on ajax requests.  Without going too deeply into how this is probably correct and we should be using HTTP to its full advantage and using HTTP authentication instead of a custom authentication scheme, I don&#8217;t want this behavior.  I landed on using the much less appropriate 403 (Forbidden).</p>
<p>So, if the user isn&#8217;t authenticated  (such as with an expired session), send the 403 response back to the browser:</p>
<pre><code>if(isXMLHttpRequest(request))
{
  response.sendError(403);
}</code></pre>
<p>Now we handle the 403 on the browser side of things:</p>
<pre><code>new Ajax.Request('/search',
     {asynchronous:true,
       evalScripts:true,
       onException: function(req,exception) {
         alert('An exception "' + exception + '" was thrown accessing "' + request.url + '"' )
         return true
       },
       on403: function(t) {
         alert('Your session appears to have expired.  You will asked to log in again and returned here.')
         window.location.reload()
         return true
       },
       onFailure: function(request) {
         alert('An unhandled error occured ' + t.status + ': ' + t.statusText);
         return true
       },
       onLoading:function(request){Element.show('loading')},
       onComplete:function(request){Element.hide('loading')},
       onSuccess: function(t) {
         //do something with the results
       },
       parameters:Form.serialize(this)
     })</code></pre>
<p>The interesting bit of this call is the on403 method.  Prototype will call onXXX() where XXX is a non-200 HTTP response code.  When a 403 is returned, I simply reload the current page.  Since we handled the scenario of authenticating and returning to the requested page for the non-Ajax call, this &#8216;just works&#8217;.  You may wish to do something else here, including some nifty ajax widget that authenticates in-line and makes the call again.</p>
<p>Now that we have an Ajax request that suits our needs, we will want to use it throughout our project.  Instead of repeating the same code over and over again, let&#8217;s <a href="http://c2.com/cgi/wiki?DontRepeatYourself">DRY</a> it up.</p>
<h3>Creating a Wrapper Class</h3>
<p>Since I am going to use this scheme for <a href="http://www.prototypejs.org/api/ajax/request">Ajax.Request</a> and <a href="http://www.prototypejs.org/api/ajax/updater">Ajax.Updater</a> I created two wrapper classes that use a common function for setting the options.  This scheme allows you to override any of the default options I use in the wrapper:</p>
<pre><code>Ajax.MyRequest = Class.create(Ajax.Request, {
  initialize: function($super, url, options) {
    $super(url,_options(options));
  }
})

Ajax.MyUpdater = Class.create(Ajax.Updater, {
  initialize: function($super, container, url, options) {
    $super({success:container},url,_options(options));
  }
})

function _options(options) {
  return Object.extend({
     asynchronous:true,
     evalScripts:true,
     onException: function(request,exception) {
       Element.hide('loading')
       alert('An exception "' + exception + '" was thrown accessing "' + request.url + '"' )
       return true
     },
     on403: function(t) {
       Element.hide('loading')
       alert('Your session appears to have expired.  You will asked to log in again and returned here.')
       window.location.reload()
       return true
     },
     onFailure: function(t) {
       Element.hide('loading')
       alert('An unhandled error occured ' + t.status + ': ' + t.statusText);
     },
     onLoading:function(request){Element.show('loading')},
     onComplete:function(request){window.setTimeout('Element.hide("loading");', 100);}
  }, options || {});
}</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://www.missiondata.com/blog/web-development/83/handling-session-timeouts-and-other-errors-using-ajax/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Sending UTF-8 email with Oracle</title>
		<link>http://www.missiondata.com/blog/database/79/sending-utf-8-email-with-oracle/</link>
		<comments>http://www.missiondata.com/blog/database/79/sending-utf-8-email-with-oracle/#comments</comments>
		<pubDate>Wed, 18 Apr 2007 19:45:02 +0000</pubDate>
		<dc:creator>steveny</dc:creator>
				<category><![CDATA[Database]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[Oracle]]></category>

		<guid isPermaLink="false">http://www.missiondata.com/blog/uncategorized/79/sending-utf-8-email-with-oracle/</guid>
		<description><![CDATA[I have seen several examples of sending email using oracle with non-ascii characters floating around the Internet, but few seem to tackle sending these &#8216;special&#8217; characters in both the subject and the body. Many also take a shortcut and use 8bit transfer encoding for the body. I am 99.9% sure that this will work on [...]]]></description>
			<content:encoded><![CDATA[<p>I have seen several examples of sending email using oracle with non-ascii characters floating around the Internet, but few seem to tackle sending these &#8216;special&#8217; characters in both the subject and the body.  Many also take a shortcut and use 8bit <a href="http://en.wikipedia.org/wiki/MIME#Content-Transfer-Encoding">transfer encoding</a> for the body.  I am 99.9% sure that this will work on today&#8217;s mail servers, but basic SMTP only really needs to support 3 transfer encodings &#8211; 7bit ascii, base64, and quoted-printable.</p>
<p><span id="more-79"></span></p>
<p>For my example I chose the latter.  Quoted-printable has two distinct advantages: 1) It should be supported by all servers and 2) Unlike base64 it will keep characters that are 7bit ascii in ascii and only encode characters it needs to.</p>
<pre><code>CREATE OR REPLACE PROCEDURE MAIL_TEST IS
  lv_server      VARCHAR2(255) := '';
  lv_rcpt        VARCHAR2(255) := 'to@example.com';
  lv_from        VARCHAR2(255) := 'from@example.com';
  lv_subject     VARCHAR2(255) := 'Le chien paresseux a sauté';
  lv_message     VARCHAR2(255) := 'Voix ambiguë d''un coeur qui au zéphyr préfère les jattes de kiwis';
  lv_conn        UTL_SMTP.CONNECTION;
BEGIN
  lv_Conn := UTL_SMTP.Open_Connection(lv_server);
  UTL_SMTP.Helo(lv_conn, lv_server);
  UTL_SMTP.Mail(lv_conn, lv_from);
  UTL_SMTP.Rcpt(lv_conn, lv_rcpt);
  UTL_SMTP.OPEN_DATA(lv_conn);
  UTL_SMTP.WRITE_DATA(lv_conn, 'Subject: =?UTF-8?Q?' ||
                                UTL_RAW.CAST_TO_VARCHAR2(UTL_ENCODE.QUOTED_PRINTABLE_ENCODE(UTL_RAW.CAST_TO_RAW(lv_subject))) ||
                                '?=' || UTL_TCP.CRLF);
  UTL_SMTP.WRITE_DATA(lv_conn, 'MIME-version: 1.0' || UTL_TCP.CRLF);
  UTL_SMTP.WRITE_DATA(lv_conn, 'Content-Type: text/html;charset=utf-8' || UTL_TCP.CRLF);
  UTL_SMTP.WRITE_DATA(lv_conn, 'Content-Transfer-Encoding: quoted-printable '|| UTL_TCP.CRLF);
  UTL_SMTP.WRITE_DATA(lv_conn, 'Date: ' || TO_CHAR(SYSDATE, 'dd Mon yy hh24:mi:ss' ) ||' -0800 (GMT)' || UTL_TCP.CRLF);
  UTL_SMTP.WRITE_DATA(lv_conn, 'From: ' || lv_from || UTL_TCP.CRLF);
  UTL_SMTP.WRITE_DATA(lv_conn, 'To: ' || lv_rcpt || UTL_TCP.CRLF);
  UTL_SMTP.WRITE_DATA(lv_conn,  UTL_TCP.CRLF);
  UTL_SMTP.WRITE_RAW_DATA(lv_conn, UTL_ENCODE.QUOTED_PRINTABLE_ENCODE(UTL_RAW.CAST_TO_RAW(lv_message)));
  UTL_SMTP.WRITE_DATA(lv_conn, UTL_TCP.CRLF);
  UTL_SMTP.CLOSE_DATA(lv_conn);
  UTL_SMTP.QUIT(lv_conn);
END;</code></pre>
<p>If you wanted to use 8bit ascii you would change the data and transfer encoding header to this:</p>
<pre><code>UTL_SMTP.WRITE_DATA(lv_conn, 'Content-Transfer-Encoding: 8bit'|| UTL_TCP.CRLF);
UTL_SMTP.WRITE_RAW_DATA(lv_conn, UTL_RAW.CAST_TO_RAW(UTL_TCP.CRLF || lv_message || UTL_TCP.CRLF));</code></pre>
<p>Finally, you can also use base64 encoding for the subject:</p>
<pre><code>  UTL_SMTP.WRITE_DATA(lv_conn, 'Subject: =?UTF-8?B?' ||
                                UTL_RAW.CAST_TO_VARCHAR2(UTL_ENCODE.BASE64_ENCODE(UTL_RAW.CAST_TO_RAW(lv_subject))) ||
                                '?=' || UTL_TCP.CRLF);</code></pre>
<p>Calling me a PL/SQL developer would be an insult to PL/SQL developers everywhere.  I apologize in advance for any perceived lack of style.  Most of the variables would be sourced from parameters passed in to the procedure or database values.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.missiondata.com/blog/database/79/sending-utf-8-email-with-oracle/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Mongrel vs. WEBrick</title>
		<link>http://www.missiondata.com/blog/system-administration/71/mongrel-vs-webrick/</link>
		<comments>http://www.missiondata.com/blog/system-administration/71/mongrel-vs-webrick/#comments</comments>
		<pubDate>Tue, 03 Apr 2007 16:08:13 +0000</pubDate>
		<dc:creator>steveny</dc:creator>
				<category><![CDATA[System Administration]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[Mongrel vs WEBrick]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://www.missiondata.com/blog/ruby/71/mongrel-vs-webrick/</guid>
		<description><![CDATA[We had the need to hook up a simple ruby web process (non-rails) to our production apache server. As Leslie Hensley pointed out, fcgi and scgi are on the way out, and mongrel + mod_proxy_balancer is the new way to go. We use mongrel extensively in our rails deploys, but always just used WEBrick to [...]]]></description>
			<content:encoded><![CDATA[<p>We had the need to hook up a simple ruby web process (non-rails) to our production apache server.  As <a href="http://www.papermountain.org/">Leslie Hensley</a> pointed out, fcgi and scgi are on the way out, and <a href="http://mongrel.rubyforge.org/">mongrel</a> + <a href="http://mongrel.rubyforge.org/docs/apache.html">mod_proxy_balancer</a> is the new way to go.  We use mongrel extensively in our rails deploys, but always just used <a href="http://www.webrick.org/">WEBrick</a> to do simple serving.  To make a long story short, we had to ask ourselves&#8230;.is mongrel that much better (and in this case better == faster) than WEBrick?</p>
<p><span id="more-71"></span></p>
<p>At first I decided my test would just respond with the yamlized request (just like the <a href="http://mongrel.rubyforge.org/rdoc/index.html">mongrel sample</a> did).  This worked fine but there was a significant size difference in the two documents (WEBrick&#8217;s was much bigger).  In the end, I just decided to respond with a few bytes of text.</p>
<h3>The Code</h3>
<p><strong>mongrel_service.rb:</strong></p>
<pre><code>require 'rubygems'
require 'mongrel'
require 'yaml'

class SimpleHandler &amp;lt; Mongrel::HttpHandler
  def process(request, response)
    response.start do |head,out|
      head["Content-Type"] = "text/html"
      out &amp;lt;&amp;lt; "I am mongrel, hear me roar"
    end
  end
end

config = Mongrel::Configurator.new :host =&amp;gt; "localhost", :port =&amp;gt; 4000 do
  listener {uri "/", :handler =&amp;gt; SimpleHandler.new}
  trap("INT") { stop }
  run
end

config.join</code></pre>
<p><strong>webrick_service.rb:</strong></p>
<pre><code>require 'webrick'
require 'yaml'
include WEBrick

class SimpleServlet &amp;lt; HTTPServlet::AbstractServlet
  def do_GET(request, response)
    response["Content-Type"] = "text/html"
    response.body = "I am WEBrick, hear me roar"
  end
end

s = HTTPServer.new( :Port =&amp;gt; 4001 )
s.mount("/", SimpleServlet)
trap('INT'){ s.shutdown }
s.start</code></pre>
<h3>The Test</h3>
<p>There are <a href="http://www.joedog.org/JoeDog/Siege">serveral</a> <a href="http://www.hpl.hp.com/research/linux/httperf/">good</a> benchmarking tools available, but I had <a href="http://en.wikipedia.org/wiki/ApacheBench">apache bench (ab)</a> handy, so that is what I used.  I just used the stock gem install of mongrel and the WEBrick that comes with ruby 1.8.4 (the one non-stock change I made was to comment out access logging for WEBrick since mongrel doesn&#8217;t log by default).</p>
<h3>The Results</h3>
<table border="1">
<tbody>
<tr>
<th>Total Requests</th>
<th>Concurrent Connections</th>
<th>WEBrick (seconds)</th>
<th>Mongrel (seconds)</th>
</tr>
<tr>
<td>1000</td>
<td>1</td>
<td>1.889523</td>
<td>0.365838</td>
</tr>
<tr>
<td>10000</td>
<td>10</td>
<td>19.443034</td>
<td>4.411788</td>
</tr>
<tr>
<td>10000</td>
<td>100</td>
<td>20.906522</td>
<td>4.174591</td>
</tr>
</tbody>
</table>
<h3>The Conclusion</h3>
<p>Looks like mongrel it is&#8230;.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.missiondata.com/blog/system-administration/71/mongrel-vs-webrick/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Tomcat + UTF8 + HTTP Get</title>
		<link>http://www.missiondata.com/blog/web-development/69/tomcat-utf8-http-get/</link>
		<comments>http://www.missiondata.com/blog/web-development/69/tomcat-utf8-http-get/#comments</comments>
		<pubDate>Mon, 19 Mar 2007 15:53:21 +0000</pubDate>
		<dc:creator>steveny</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[tomcat]]></category>

		<guid isPermaLink="false">http://www.missiondata.com/blog/java/69/tomcat-utf8-http-get/</guid>
		<description><![CDATA[By default tomcat doesn&#8217;t UTF-8 encode get parameters like it does post parameters. This doesn&#8217;t seem to be the case with other application servers. So before you get yourself into trouble with your internationalized web application, make sure you make this change.]]></description>
			<content:encoded><![CDATA[<p>By default tomcat doesn&#8217;t UTF-8 encode get parameters like it does post parameters.  This doesn&#8217;t seem to be the case with <a href="http://www.caucho.com/">other</a> application servers.  So before you get yourself into trouble with your internationalized web application, make sure you make <a href="http://tomcat.apache.org/faq/connectors.html#utf8">this change</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.missiondata.com/blog/web-development/69/tomcat-utf8-http-get/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Scary apache errors moving from prefork to worker</title>
		<link>http://www.missiondata.com/blog/system-administration/66/scary-apache-errors-moving-from-prefork-to-worker/</link>
		<comments>http://www.missiondata.com/blog/system-administration/66/scary-apache-errors-moving-from-prefork-to-worker/#comments</comments>
		<pubDate>Wed, 07 Mar 2007 20:52:52 +0000</pubDate>
		<dc:creator>steveny</dc:creator>
				<category><![CDATA[System Administration]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[solaris]]></category>

		<guid isPermaLink="false">http://www.missiondata.com/blog/uncategorized/66/scary-apache-errors-moving-from-prefork-to-worker/</guid>
		<description><![CDATA[We were helping a client push more data through their apache/tomcat web application running on a Solaris box and decided to switch from the process (prefork) to the threaded(worker) processing model. When we fired up the new apache we started getting errors like these: [emerg] (45)Deadlock situation detected/avoided: apr_proc_mutex_lock failed. Attempting to shutdown process gracefully. [...]]]></description>
			<content:encoded><![CDATA[<p>We were helping a client push more data through their apache/tomcat web application running on a Solaris box and decided to switch from the process (prefork) to the threaded(worker) processing model.  When we fired up the new apache we started getting errors like these:</p>
<pre>
<code>[emerg] (45)Deadlock situation detected/avoided: apr_proc_mutex_lock failed. Attempting to shutdown process gracefully.</code>
</pre>
<p>Not good.  After a <a href="http://issues.apache.org/bugzilla/show_bug.cgi?id=32325">little digging</a> we found that the default AcceptMutex switched from pthread to fcntl between apache 2.0.49 and 2.0.52.</p>
<p>Adding:</p>
<pre>
<code>AcceptMutex pthread</code>
</pre>
<p>to httpd.conf cleared up the errors and we&#8217;ve had smooth sailing ever since.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.missiondata.com/blog/system-administration/66/scary-apache-errors-moving-from-prefork-to-worker/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Building a better world with Google Spreadsheets</title>
		<link>http://www.missiondata.com/blog/web-development/65/building-a-better-world-with-google-spreadsheets/</link>
		<comments>http://www.missiondata.com/blog/web-development/65/building-a-better-world-with-google-spreadsheets/#comments</comments>
		<pubDate>Wed, 06 Dec 2006 15:51:04 +0000</pubDate>
		<dc:creator>steveny</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://blogs.missiondata.com/uncategorized/65/building-a-better-world-with-google-spreadsheets/</guid>
		<description><![CDATA[I was tickled when I ran across the GoogleLookup and GoogleFinance functions in Google Spreadsheets. I was very tickled when I found there was a REST API for interacting with the spreadsheets. So not only can you lookup the current volume of Google stock in a spreadsheet (=GoogleFinance(&#8220;GOOG&#8221;, &#8220;volume&#8221;)) or find out Roger Clemens&#8217;s ERA [...]]]></description>
			<content:encoded><![CDATA[<p>I was tickled when I ran across the <a href="http://docs.google.com/support/spreadsheets/bin/answer.py?answer=54199&#038;ctx=sibling">GoogleLookup</a> and <a href="http://docs.google.com/support/spreadsheets/bin/answer.py?answer=54198&#038;ctx=sibling">GoogleFinance</a> functions in <a href="">Google Spreadsheets</a>.  I was <b>very</b> tickled when I found there was a <a href="http://code.google.com/apis/gdata/spreadsheets.html">REST API</a> for interacting with the spreadsheets.</p>
<p>So not only can you lookup the current volume of Google stock in a spreadsheet (=GoogleFinance(&#8220;GOOG&#8221;, &#8220;volume&#8221;)) or find out Roger Clemens&#8217;s ERA (=GoogleLookup(&#8220;Roger Clemens&#8221;,&#8221;earned run average&#8221;)) you can access those values real time using an open API.  I cobbled together a quick ruby program that can retrieve values from a private or public (published) Google spreadsheet.  </p>
<p><span id="more-65"></span></p>
<p>The public sample should work for everyone since I published that spreadsheet for the world to see.  You will need to provide your own credentials and spreadsheet key to use the authenticated example.  I will caution that this is just a proof of concept that has limited functionality, weak parsing, and no error checking.</p>
<pre>
<code>#!/usr/bin/env ruby

require 'net/http'
require 'net/https'
require 'uri'
require 'rubygems'
require 'hpricot'

#
# Make it east to use some of the convenience methods using https
#
module Net
  class HTTPS &lt; HTTP
    def initialize(address, port = nil)
      super(address, port)
      self.use_ssl = true
    end
  end
end

class GoogleSpreadSheet
  def initialize(spreadsheet_key)
    @spreadsheet_key = spreadsheet_key
    @headers = nil
  end

  def authenticate(email, password)
    url = URI.parse('https://www.google.com/accounts/ClientLogin')
    response = Net::HTTPS.post_form(url,
      {'Email'=&gt;email,
       'Passwd'=&gt;password,
       'source'=&gt;"ruby-ss-example-1",
       'service'=&gt;'wise' })
    @headers = {
     'Authorization' =&gt; "GoogleLogin auth=#{response.body.split(/=/).last}",
     'Content-Type'  =&gt; 'application/atom+xml'
    }
  end

  def evaluate_cell(cell)
    path = "/feeds/cells/#{@spreadsheet_key}/1/#{@headers ? "private" : "public"}/basic/#{cell}"
    doc = Hpricot(request(path))
    result = (doc/"content[@type='text']").inner_html
  end

  private
  def request(path)
    http = Net::HTTP.new('spreadsheets.google.com', 80)
    response,data = http.get(path, @headers)
    data
  end
end

gs = GoogleSpreadSheet.new('p39irgfu5fsFokTPyPCG8Lg')
puts gs.evaluate_cell("A1")
puts gs.evaluate_cell("A2")
puts gs.evaluate_cell("B1")

gs = GoogleSpreadSheet.new(&lt;your spreadsheet key&gt;)
gs.authenticate(&lt;your email&gt;, &lt;your password&gt;)
puts gs.evaluate_cell("E132")</code>
</pre>
<p>The fun really just starts here.  You can edit existing spreadsheets too (although you can &#8216;t create or delete them yet).  As <a href='http://blogs.missiondata.com/author/richier/'>Rich</a> pointed out to me a few days ago, it won&#8217;t be too long before we are adding &#8216;export to Google spreadsheet&#8217; functions to our web applications.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.missiondata.com/blog/web-development/65/building-a-better-world-with-google-spreadsheets/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>IE7 adds native XMLHTTPRequest object</title>
		<link>http://www.missiondata.com/blog/web-development/64/ie7-adds-native-xmlhttprequest-object/</link>
		<comments>http://www.missiondata.com/blog/web-development/64/ie7-adds-native-xmlhttprequest-object/#comments</comments>
		<pubDate>Thu, 26 Oct 2006 12:43:58 +0000</pubDate>
		<dc:creator>steveny</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[ajax]]></category>

		<guid isPermaLink="false">http://blogs.missiondata.com/?p=64</guid>
		<description><![CDATA[The recently released IE7 supports a native XMLHTTPRequest object. On the surface this can be considered a good thing and should be commended. However, to the people that erroneously (in hindsight) assumed that&#8230; window.XMLHttpRequest == ! (not) IE &#8230;they are in for some strange behavior (here, here, here, and here for example). The problem occurs [...]]]></description>
			<content:encoded><![CDATA[<p>The recently released IE7 supports <a href=" http://blogs.msdn.com/ie/archive/2006/01/23/516393.aspx">a native XMLHTTPRequest object</a>.  On the surface this can be considered a good thing and should be commended.  However, to the people that erroneously (in hindsight) assumed that&#8230;</p>
<p><code>  window.XMLHttpRequest == ! (not) IE</code></p>
<p>&#8230;they are in for some strange behavior  (<a href="http://web.archive.org/web/20041104081337js_/creatimation.net/extra/live-request/liveRequest.js">here</a>, <a href="http://web.archive.org/web/20041012102019/http://beta4.com/~avi/liveUpdater.js">here</a>, <a href="http://lakeshore.sourceforge.net/">here</a>, and <a href="http://www.google.com/codesearch?q=if+%28window.XMLHttpRequest%29+initialize+it+once&#038;btnG=Search+Code">here</a> for example).</p>
<p>The problem occurs when the code is optimized for non-IE browsers and does not recreate the XMLHTTPRequest object on each event.  Back when  &#8220;window.XMLHttpRequest == !IE&#8221; was true, this code worked as expected: IE browsers created a new XMLHttpRequest object on each event and non-IE browsers reused the same XMLHttpRequest object.  Now IE7 will correctly process the first event but then fails on the second (and subsequent) requests because you still can&#8217;t reuse XMLHttpRequest objects.</p>
<p>We chose to just remove the optimization all together and recreate the object on each event for all browsers.  Others may wish to come up with some other check that will allow them to keep it. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.missiondata.com/blog/web-development/64/ie7-adds-native-xmlhttprequest-object/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
	</channel>
</rss>

