<?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>Amphora TechBlog</title>
	<atom:link href="http://techblog.amphora-research.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://techblog.amphora-research.com</link>
	<description>Amphora Technical Blog</description>
	<lastBuildDate>Fri, 14 Oct 2011 13:57:46 +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>Path issues when using Capistrano</title>
		<link>http://techblog.amphora-research.com/2011/10/path-issues-when-using-capistrano/</link>
		<comments>http://techblog.amphora-research.com/2011/10/path-issues-when-using-capistrano/#comments</comments>
		<pubDate>Fri, 14 Oct 2011 13:57:46 +0000</pubDate>
		<dc:creator>Simon Coles</dc:creator>
				<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://techblog.amphora-research.com/?p=127</guid>
		<description><![CDATA[I recently started using Capistrano on a personal project, which is hosted on a relatively plain Ubuntu box. Capistrano wouldn&#8217;t do much, I kept getting errors about &#8220;bundle&#8221; not being found. Seems the newer versions of Rails and Capistrano prefix everything with &#8220;bundle&#8221; so the right Gems etc. are used. Turns out there&#8217;s a problem [...]]]></description>
			<content:encoded><![CDATA[<p>I recently started using Capistrano on a personal project, which is hosted on a relatively plain Ubuntu box.</p>
<p>Capistrano wouldn&#8217;t do much, I kept getting errors about &#8220;bundle&#8221; not being found. Seems the newer versions of Rails and Capistrano prefix everything with &#8220;bundle&#8221; so the right Gems etc. are used.</p>
<p>Turns out there&#8217;s a problem with the path that my Capistrano scripts get when they ssh into the Linux machine. Seems there&#8217;s a different environment for interactive SSH sessions, and the non-interactive SSH sessions that Capistrano uses.</p>
<p>To diagnose this, I added this to my deploy.rb:</p>
<p><code><br />
desc "Echo environment vars"<br />
namespace :env do<br />
  task :echo do<br />
    run "echo printing out cap info on remote server"<br />
    run "echo $PATH"<br />
    run "printenv"<br />
  end<br />
end<br />
</code></p>
<p>Which when I do <code>cap env:echo</code> tells me the path that my Capistrano scripts see &#8211; which crucially doesn&#8217;t include <code>/var/lib/gems/1.8/bin</code>.</p>
<p>Turns out you set the environment in <code>~/.ssh/environment</code>, adding a PATH line in the normal way.</p>
<p>But then you need to edit <code>/etc/ssh/sshd_config</code> and add a line</p>
<p><code>PermitUserEnvironment yes</code></p>
<p>And restart SSH.</p>
<p>After that your Cap deployments will be smooth&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://techblog.amphora-research.com/2011/10/path-issues-when-using-capistrano/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tomcat 6 &#8211; stack level too deep error on Windows</title>
		<link>http://techblog.amphora-research.com/2011/03/tomcat-6-stack-level-too-deep-error-on-windows/</link>
		<comments>http://techblog.amphora-research.com/2011/03/tomcat-6-stack-level-too-deep-error-on-windows/#comments</comments>
		<pubDate>Fri, 04 Mar 2011 07:04:41 +0000</pubDate>
		<dc:creator>Don Morrison</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[JRuby]]></category>
		<category><![CDATA[Tomcat]]></category>

		<guid isPermaLink="false">http://techblog.amphora-research.com/?p=94</guid>
		<description><![CDATA[Trouble with Tomcat and JRuby when running on a 64bit Windows Server leads our intrepid explorer to message boards. It seems like gembundler but it isn't. Rest assured, there's a happy ending.]]></description>
			<content:encoded><![CDATA[<h1>Breakfast of champions</h1>
<p>Have you ever had a really fun day? A day that starts like this:<br />
<code><br />
Feb 24, 2011 10:50:42 PM org.apache.catalina.core.ApplicationContext log<br />
SEVERE: unable to create shared application instance<br />
org.jruby.rack.RackInitializationException: stack level too deep<br />
from c:/console/ROOT/WEB-INF/gems/gems/bundler-1.0.10/lib/bundler/resolver.rb:348:in `catch'<br />
from c:/console/ROOT/WEB-INF/gems/gems/bundler-1.0.10/lib/bundler/resolver.rb:348:in `resolve_requirement'<br />
from c:/console/ROOT/WEB-INF/gems/gems/bundler-1.0.10/lib/bundler/resolver.rb:299:in `resolve'<br />
from c:/console/ROOT/WEB-INF/gems/gems/bundler-1.0.10/lib/bundler/resolver.rb:298:in `reverse_each'<br />
from c:/console/ROOT/WEB-INF/gems/gems/bundler-1.0.10/lib/bundler/resolver.rb:298:in `resolve'<br />
from c:/console/ROOT/WEB-INF/gems/gems/bundler-1.0.10/lib/bundler/resolver.rb:349:in `resolve_requirement'<br />
from c:/console/ROOT/WEB-INF/gems/gems/bundler-1.0.10/lib/bundler/resolver.rb:348:in `catch'<br />
from c:/console/ROOT/WEB-INF/gems/gems/bundler-1.0.10/lib/bundler/resolver.rb:348:in `resolve_requirement'<br />
... 213 levels...<br />
from file:/C:/console/ROOT/WEB-INF/lib/jruby-rack-1.0.3.jar!/vendor/rack-1.2.1/rack/builder.rb:46:in `initialize'<br />
from &lt;script&gt;:2:in `new'<br />
from &lt;script&gt;:2<br />
</code><br />
This was how my morning looked a week or two ago when I was starting up an installation of our <a href="http://amphora-research.com/products/console">Custodian&#8217;s Console</a> on a Windows server. Take another look at that stack trace. (full trace <a href="https://gist.github.com/854021">here</a>) It <strong>looks</strong> like bundler is causing some trouble in this app, right? In fact, it reads like bundler is in some sort of recursive blackhole and JRuby just gives up &#8211; as it should. Let&#8217;s see what Google has to say about this.</p>
<h1>First search: JRuby, bundler and this error message</h1>
<p>The results for my first search include a <a href="https://github.com/nicksieger/warbler">Warbler</a> issue. <a href="http://kenai.com/jira/browse/WARBLER-21 ">WARBLER-21</a>. In the comments, <a href="http://blog.nicksieger.com/">Nick Sieger</a> recommends increasing the stack size:</p>
<blockquote><p>
&#8220;We&#8217;ve heard increased reports of &#8220;stack level too deep&#8221; with Bundler lately. In fact, we bumped up the default stack size to -Xss2048k in JRuby master as of ea20ac17. Can you try running Warbler as follows:<br />
<code><br />
jruby -J-Xss2048k -S warble ...<br />
</code>
</p></blockquote>
<p>Sounds perfect. This could be the answer&#8230; annnnnd nope. I try making these changes with no effect. In fact, I try passing in stack size changes in just about every conceivable way. (In <a href="http://tomcat.apache.org/tomcat-6.0-doc/windows-service-howto.html">the Tomcat docs</a> they point out that you can also pass in an increased stack size with the <code>-JvmSs</code> option to the service itself.)</p>
<p>Hrm. Case of bad Google-Fu?</p>
<h1>What about JRuby itself? Or Bundler?</h1>
<p>I&#8217;m able to find another mention of this problem pretty quickly. This <a href="http://jira.codehaus.org/browse/JRUBY-5237">JRuby issue</a> speaks about the *exact* same error. No suggested solution but to upgrade <a href="http://jruby.org">JRuby</a> to 1.6 RC1 and <a href="http://gembundler.com/">bundler</a> to latest (1.0.10) </p>
<p>Okay. I&#8217;ll bite.</p>
<p>I upgrade bundler. Same error. </p>
<p>Then I try using JRuby 1.6 RC1. No love.</p>
<p>I&#8217;m going to have to dig deeper &#8211; it could be 3 or 4 pages of Google search results before I find my answer! </p>
<h1>Liferay?</h1>
<p>After several pages of results and no luck I stumble across some postings on a message board (yuck!) for something called <a href="http://liferay.com">Liferay</a>. Never heard of it. Turns out it has something to do with &#8220;market leading&#8221;, &#8220;portals&#8221; and &#8220;enterprises&#8221;. Oh, and message boards.</p>
<p><a href="http://www.liferay.com/community/forums/-/message_boards/message/5375338">One such post</a> talks about the same error I&#8217;m having and a working solution. Sort of.</p>
<blockquote><p>
I found out some further information. I am running Tomcat 6 as a service through the 64-bit Tomcatw.exe (procrun implementation). If I use the &#8220;jvm&#8221; startmode I get the above error. If I use the &#8220;java&#8221; startmode I don&#8217;t. Wanting to know why still.
</p></blockquote>
<p>That poor guy made the last post in that thread. I really dislike message boards.</p>
<p>Startmode, what&#8217;s that all about? Turns out that Tomcat Tomcat uses <a href="http://commons.apache.org/daemon/procrun.html">&#8220;procrun&#8221;</a> to allow it to run as a service on Windows. Ahhhh, a mention of Windows. I like where this is going.</p>
<blockquote><p>
&#8220;Procrun is a set of applications that allow Windows users to wrap (mostly) Java applications (e.g. Tomcat) as a Windows service. The service can be set to automatically start when the machine boots and will continue to run with no user logged onto the machine.&#8221;
</p></blockquote>
<p>From the <a href="http://commons.apache.org/daemon/procrun.html">procrun</a> docs:</p>
<blockquote><p>
&#8220;startmode&#8221; is here: </p>
<p>One of jvm, Java or exe. The modes are:<br />
  jvm &#8211; start Java in-process. Depends on jvm.dll, see &#8211;Jvm.<br />
  Java &#8211; same as exe, but automatically uses the default Java executable, i.e. %JAVA_HOME%\bin\java.exe. Make sure JAVA_HOME is set correctly, or use &#8211;JavaHome to provide the correct location. If neither is set, procrun will try to find the default JDK (not JRE) from the Windows registry.<br />
  exe &#8211; run the image as a separate process
</p></blockquote>
<p>Confirmed. Starting in &#8216;java&#8217; startmode allows the console to start up but shutdown via the service console is now broken and the process runs as <code>java.exe</code> instead of <code>tomcat6.exe</code>. That&#8217;s a start but not really a long-term solution. Why would this be working when running as a separate process?</p>
<p><em>That question leads me to spend several hours trying to figure out if my parameters are actually being passed into the JVM. If you are trying to do the same let me save you some time. Edit the line in <code>service.bat</code> that looks like this:<code>"%EXECUTABLE%" //IS//%SERVICE_NAME% </code> to include <code>--LogLevel Debug</code> at the end. This little change will dump lots of useful information to the catalina or commons-daemon log.</em></p>
<p>If I set the startmode to <code>java</code> I can get things to run, just not the way we need or want. Time to try something else.</p>
<h2>Back to the Liferay messageboards! Hooray.</h2>
<p>Here is a <a href="http://www.liferay.com/community/forums/-/message_boards/message/4270632 ">post</a> that actually proposes a solution to the problem: </p>
<p>The last post says:</p>
<blockquote><p>
&#8220;Tomcat 6 ships with v1.0.2 of Commons Daemon (in the form of tomcat6.exe and tomcat6w.exe). It seems this version is not compatible on certain combinations of 64-bit Windows and JDK6. </p>
<p>To resolve this, simply download v1.0.4 from http://commons.apache.org/daemon/download_daemon.cgi, replace tomcat6.exe and tomcat6w.exe with prunsrv.exe and prunmgr.exe respectively, rename to tomcat6.exe and tomcat6w.exe and run service.bat.&#8221;
</p></blockquote>
<p><strong>THAT&#8217;S</strong> what I&#8217;m talking about! I follow the proposal and it works. Neat-o.</p>
<h1>Onward to a permanent solution</h1>
<p>The newest procrun (v1.0.5) works just fine on Windows Server 2008 64bit and 32bit. Although I can&#8217;t find the specific bug fix in <a href="https://issues.apache.org/jira/browse/DAEMON">daemons (procrun) JIRA</a>, I can confirm that it works. I see some vague references to a reorg and some other moves happening in the code but nothing concrete. I&#8217;d rather not have to maintain versions of procrun along with Tomcat so I go hunting for <a href="http://tomcat.apache.org/download-60.cgi">Tomcat updates</a> &#8230; Tomcat has since released 6.0.32 which includes commons daemon (procrun) v1.0.5 since version 6.0.30 &#8211; the console is currently on 6.0.29 so an upgrade fixes the problem.</p>
<p>If you are fighting with these kinds of issues with JRuby and Tomcat (or just Tomcat) it would behoove you to try a newer version of Tomcat first, they update regularly and pull in upstream changes for other components. You can check the <a href="http://tomcat.apache.org/tomcat-6.0-doc/changelog.html">Tomcat 6.0 changelog</a> for details. For instance, the procrun update message went something like this:</p>
<blockquote><p>Update to Commons Daemon 1.0.5. (mturk)</p></blockquote>
<p>Good hunting!</p>
]]></content:encoded>
			<wfw:commentRss>http://techblog.amphora-research.com/2011/03/tomcat-6-stack-level-too-deep-error-on-windows/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Work around Rails 3 unit test transaction difficulties</title>
		<link>http://techblog.amphora-research.com/2011/02/workaround-rails-3-unit-test-transaction-difficulties/</link>
		<comments>http://techblog.amphora-research.com/2011/02/workaround-rails-3-unit-test-transaction-difficulties/#comments</comments>
		<pubDate>Tue, 15 Feb 2011 00:59:34 +0000</pubDate>
		<dc:creator>Don Morrison</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Ruby on Rails]]></category>

		<guid isPermaLink="false">http://techblog.amphora-research.com/?p=87</guid>
		<description><![CDATA[Having problems with Rails 3 unit tests in and PostgreSQL? Those pesky transactions may be causing them. Here is one man's tale of woe. (with a touch of 'hope')]]></description>
			<content:encoded><![CDATA[<h2>What hath thou done to me, O Rails 3?</h2>
<p>During a recent upgrade of one of our applications to Rails 3 I encountered some interesting (frustrating) errors while running the unit tests.</p>
<p>For reference, application was moving from 2.3.4 to 3.0.4, the database was PostgreSQL using the pg gem, and the unit test suite included shoulda + factory_girl. The tests were run with <code>`rake test`</code> and <code>`autotest`</code>.</p>
<p>Here is an example of some of the error messages I beheld:<br />
<code><br />
4) Error:<br />
test: A PatentSafe error email with suspect headers should create a ticket with the correct title. (EmailInTest):<br />
ActiveRecord::StatementInvalid: PGError: ERROR:  current transaction is aborted, commands ignored until end of transaction block<br />
:             SELECT a.attname, format_type(a.atttypid, a.atttypmod), d.adsrc, a.attnotnull<br />
FROM pg_attribute a LEFT JOIN pg_attrdef d<br />
ON a.attrelid = d.adrelid AND a.attnum = d.adnum<br />
WHERE a.attrelid = '"original_emails"'::regclass<br />
AND a.attnum &gt; 0 AND NOT a.attisdropped<br />
ORDER BY a.attnum<br />
</code></p>
<p><code><br />
5) Error:<br />
test: A received email note from a user should be assigned to the user if found. (EmailInTest):<br />
ActiveRecord::StatementInvalid: PGError: ERROR:  current transaction is aborted, commands ignored until end of transaction block<br />
: SELECT  "users"."id" FROM "users" WHERE ("users"."login_id" = 'some-email@amphora-research.com') AND ("users".id &lt;&gt; 9) LIMIT 1<br />
</code></p>
<p><code><br />
31) Error:<br />
test: An email re-sent to the notes address should return a single note. (MailReceiverTest):<br />
ActiveRecord::StatementInvalid: PGError: ERROR:  current transaction is aborted, commands ignored until end of transaction block<br />
: SELECT  "roles".* FROM "roles" WHERE (is_active = 't' and is_default = 't') LIMIT 1<br />
</code></p>
<p>As you can see, the errors aren&#8217;t really that similar except for the annoying transaction message and the traceback showed the errors weren&#8217;t coming from the same parts of the application. This happened so many times that it pains me to copy the messages here. What a weekend &#8230;</p>
<p>Amongst my attempted solutions were:</p>
<ol>
<li>commenting out transactions in the application</li>
<li>turning off transactional_features in test_helper.rb with <code>self.use_transactional_fixtures = true</code></li>
<li>running the tests with rake test</li>
<li>running the tests with autotest (not that I expected this to change my previous experience)</li>
<li>switching to minitest with minishoulda</li>
<li>starting a new rails 3 application with just a few tests</li>
</ol>
<p>The most promising of which was starting a new application, but as soon as I had added most of the models, the errors returned. In all cases, the transaction errors were there, all 75 of them. Oh yes. I remember the count.</p>
<p>It occurred to me that I had read something about <a href="http://apidock.com/rails/ActiveRecord/Transactions/ClassMethods">transaction and tests in the ActiveRecord documentation</a>. From the doc:</p>
<blockquote><p>Warning: one should not catch ActiveRecord::StatementInvalid exceptions inside a transaction block. StatementInvalid exceptions indicate that an error occurred at the database level, for example when a unique constraint is violated. On some database systems, such as PostgreSQL, database errors inside a transaction causes the entire transaction to become unusable until it’s restarted from the beginning.</p></blockquote>
<p>Could the database be the problem? At least, in the short-term?</p>
<p>A quick edit to <code>config/database.yml</code> wasn&#8217;t too much to ask given all that I had already tried.</p>
<p><code><br />
test:<br />
adapter: sqlite3<br />
database: db/test.sqlite3<br />
pool: 5<br />
timeout: 5000<br />
</code></p>
<h2>Lo! The true errors showed themselves unto me!</h2>
<p>No, really.</p>
<p>As soon as I was on sqlite3 I could see the actual application errors that were causing me such trouble. My assumption is that the way <a href="http://www.sqlite.org/lang_transaction.html">sqlite handles transactions</a>, without nesting, allows my application to keep on trucking when it encounters an error while wrapped in a unit test transaction.</p>
<p>If, you&#8217;re in a time crunch as I was, you can use this method to get your tests running and get the application upgraded but this isn&#8217;t a long-term solution. It leaves you vulnerable to differences in Sqlite and your production database, PostgreSQL in my case.</p>
<p>This <em>solution</em> raises more questions than it answers, however.</p>
<p><strong>Why wasn&#8217;t I having this problem in Rails 2.3.4?</strong></p>
<p>I&#8217;ve taken a quick poke around Rails and <a href="https://github.com/rails/rails/compare/v2.3.4...v3.0.4">a lot has changed</a>. It&#8217;s highly likely that my tests were passing in 2.3.4 as a fluke and not by design. Would that I could answer this question definitively.</p>
<p><strong>Is the problem in the Rails test framework/runner or in ActiveRecord?</strong></p>
<p>As this project needs to be upgraded <em>now</em>, I don&#8217;t have the luxury of working through this one. My initial attempts to use minitest for testing show that the transaction problem still existed so this makes me thing something bigger is at play.</p>
<p><strong>Am I following the prescribed path with regards to Rails testing?</strong></p>
<p>I copied the test setup over after setting up the new Rails 3 app and am using this as my template (mainly just <code>test_helper.rb</code>). It looks like I&#8217;m following the <em>Rails Way™</em>. I can&#8217;t shake the feeling that I&#8217;m doing something wrong in my tests.</p>
<p>Got any thoughts for me? Share them in the comments and help me get this figured out once and for all.</p>
]]></content:encoded>
			<wfw:commentRss>http://techblog.amphora-research.com/2011/02/workaround-rails-3-unit-test-transaction-difficulties/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>A Ruby pre-defined variable and you. (and JRuby)</title>
		<link>http://techblog.amphora-research.com/2010/12/a-ruby-pre-defined-variable-and-you-and-jruby/</link>
		<comments>http://techblog.amphora-research.com/2010/12/a-ruby-pre-defined-variable-and-you-and-jruby/#comments</comments>
		<pubDate>Thu, 16 Dec 2010 04:40:23 +0000</pubDate>
		<dc:creator>Don Morrison</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[JRuby]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[jruby]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[rubyonrails]]></category>
		<category><![CDATA[sequel]]></category>

		<guid isPermaLink="false">http://techblog.amphora-research.com/?p=78</guid>
		<description><![CDATA[Trying to troubleshoot a potential jar loading problem in JRuby? $" is your friend. (and so is IRC it seems!)]]></description>
			<content:encoded><![CDATA[<h3>Strangeness</h3>
<p>I was recently wrestling with an obscure JDBC bug in <a href="http://sequel.rubyforge.org/">Sequel</a>. I was seeing an error connecting to the PostgreSQL database but it was being rescued by the Sequel JDBC adapter and hidden a little bit. (If you&#8217;re curious to see the fix it&#8217;s over on <a href="https://github.com/jeremyevans/sequel/commit/931580bec1384bf09de9b5f3f0331780f1a8ec68">Github</a>). Anyway, the original error led me to believe that the JDBC adapter for postgres wasn&#8217;t being loaded at all.</p>
<h3>What to do?</h3>
<p>What else? Get on the #jruby IRC channel on Freenode. Seriously, when you&#8217;re running JRuby and you come across a problem you go to there. <a href="http://twitter.com/headius">Charles</a>, <a href="http://twitter.com/nicksieger">Nick</a>, and <a href="http://twitter.com/tom_enebo">Tom</a> (JRuby core) are always lurking around and very willing to help. Charles told me to look at <em>$&#8221;</em> and see what was loaded.</p>
<h3>$&#8221;</h3>
<p>A magic-pre-defined variable in Ruby (and JRuby) &#8211; see what I did there with the title? According to <a href="http://www.zenspider.com/">zenspider&#8217;s</a> <a href="http://www.zenspider.com/Languages/Ruby/QuickRef.html#19">QuickRef</a>:<br />
<code><br />
$"         The array contains the module names loaded by require.<br />
</code><br />
Huh. Okay, cool. As a bonus JRuby throws the loaded jars in there as well. ( I really should learn all of these, come to think it, so should you. )</p>
<h3>So what</h3>
<p>You take a look at that array and you&#8217;ll see all of the modules names currently loaded. Good stuff. Here is the part from the project that helped me resolve my issue:<br />
<code><br />
jdbc/postgres.rb<br />
postgresql-8.4-702.jdbc4.jar<br />
arjdbc/postgresql/connection_methods.rb<br />
active_record/connection_adapters/postgresql_adapter.rb<br />
arjdbc/postgresql/adapter.rb<br />
</code><br />
I was able to see that the postgresql jar was loaded along with the supporting cast of characters. This led me to the #sequel IRC channel where <a href="http://twitter.com/jeremyevans0">Jeremy Evans</a> and I were able to figure this little guy out. Trying to troubleshoot a potential jar loading problem in JRuby? <em>$&#8221;</em> is your friend. (and so is IRC it seems!)</p>
]]></content:encoded>
			<wfw:commentRss>http://techblog.amphora-research.com/2010/12/a-ruby-pre-defined-variable-and-you-and-jruby/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Postgres (pg gem) compilation problems on OpenSolaris</title>
		<link>http://techblog.amphora-research.com/2010/12/postgres-pg-gem-compilation-problems-on-opensolaris/</link>
		<comments>http://techblog.amphora-research.com/2010/12/postgres-pg-gem-compilation-problems-on-opensolaris/#comments</comments>
		<pubDate>Sat, 04 Dec 2010 03:31:52 +0000</pubDate>
		<dc:creator>Don Morrison</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[compilation]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[gems]]></category>
		<category><![CDATA[rubygems]]></category>
		<category><![CDATA[rubyonrails]]></category>
		<category><![CDATA[solaris]]></category>

		<guid isPermaLink="false">http://techblog.amphora-research.com/?p=53</guid>
		<description><![CDATA[Where our intrepid explorer finds that the newest pg gem is not always the best. A sound bit of logic, that.]]></description>
			<content:encoded><![CDATA[<p>A word to the wise: pg 0.10.0 doesn&#8217;t want to compile on OpenSolaris.</p>
<h3>The Stack</h3>
<p>One of our production servers is running OpenSolaris version OpenSolaris 2008.11 snv_101b_rc2 X86, Ruby 1.8.7 (2010-08-16 patchlevel 302) [i386-solaris2.11], and PostgreSQL 8.3.4. We use <a title="Capistrano" href="https://github.com/capistrano/capistrano" target="_blank">Capistrano</a> for deployment with some <a title="Bundler" href="http://gembundler.com/" target="_blank">bundler</a> goodness thrown in the mix.</p>
<h3>The Problem</h3>
<p>Here&#8217;s what we see when bundler tries to build the gem:</p>
<pre>ERROR: Failed to build gem native extension. (Gem::Installer::ExtensionBuildError)

/usr/local/rubies/ruby-1.8.7-p302/bin/ruby extconf.rb
checking for pg_config... yes
checking for libpq-fe.h... yes
checking for libpq/libpq-fs.h... yes
checking for PQconnectdb() in -lpq... no
checking for PQconnectdb() in -llibpq... no
checking for PQconnectdb() in -lms/libpq... no
Can't find the PostgreSQL client library (libpq)
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers.  Check the mkmf.log file for more
details.  You may need configuration options.

Provided configuration options:
        --with-opt-dir
        --without-opt-dir
        --with-opt-include
        --without-opt-include=${opt-dir}/include
        --with-opt-lib
        --without-opt-lib=${opt-dir}/lib
        --with-make-prog
        --without-make-prog
        --srcdir=.
        --curdir
        --ruby=/usr/local/rubies/ruby-1.8.7-p302/bin/ruby
        --with-pg
        --without-pg
        --with-pg-config
        --without-pg-config
        --with-pg-dir
        --without-pg-dir
        --with-pg-include
        --without-pg-include=${pg-dir}/include
        --with-pg-lib
        --without-pg-lib=${pg-dir}/lib
        --with-pqlib
        --without-pqlib
        --with-libpqlib
        --without-libpqlib
        --with-ms/libpqlib
        --without-ms/libpqlib</pre>
<p>Oh yeah! Good stuff right there.</p>
<h3>The Investigation</h3>
<p>At first, I thought the problems were to do with the development libraries being missing. This is frequently the case, and the error message pretty much says just that. <strong>Wrong</strong> &#8211; libpq was (and is) present. In fact, prior to the pg gem, we had the postgres gem running and it had the same dependencies. Next up: must be a mixup in the deployment situation. <strong>Not so</strong>. Capistrano and bundler both checked out okay.</p>
<p>After my searches on <em>The Google</em> provided ample proof that compilation on a Solaris box can be tricky, my next suspect was a wonky compiler toolchain. <strong>Nope, toolchain was just fine</strong>. Heck, I even checked the rbconfig.rb to make sure. That&#8217;s right, I&#8217;m thorough.</p>
<h3>The (Temporary) Solution</h3>
<p>On a lark, and after a day of trying all kinds of weird little tweaks &#8230; I figured, what about 0.9 ??? A quick look through the commits on 0.10.0 showed some recent work on the build system. Why not? Quick, change the Gemfile:</p>
<pre>source 'http://rubygems.org'

gem 'rails', '3.0.3'
gem 'pg', '~&gt; 0.9.0'

# That '~&gt;' operator tells Bundler/Rubygems to allow gem updates to
# the least significant portion of the version number for that gem. 

# In the Gemfile snippet above, I am signifying that I will allow any pg version
# in the 0.9.x branch. Had I specified '~&gt; 0.9', bundler would install
# the newest pg gem with a major version of '0.'.</pre>
<p>Then</p>
<pre>  &gt; bundle install
  &gt; git add .
  &gt; git commit -m "Attempt to use pg 0.9"
  &gt; git push
  &gt; cap deploy</pre>
<p><strong>SUCCESS!</strong></p>
<p>I just opened <a title="issue-56" href="http://bitbucket.org/ged/ruby-pg/issue/56/pg-0100-fails-to-compile-on-opensolaris" target="_blank">this issue</a> on the <a title="ruby-pg project" href="http://bitbucket.org/ged/ruby-pg/" target="_blank">pg project</a> and will update this space when we come up with a solution. For now, just install the pg gem from the 0.9.x version.</p>
<h3>Epilogue</h3>
<p><em>You might be wondering why I would care if I&#8217;m running this particular gem for Postgres connectivity. There are three postgres gems out there that I know of: pg, postgres, and postgres-pr. Let&#8217;s take a look at some stats from rubygems.org:</em></p>
<pre>gem                 version             date            downloads
----------------    -----------------   -------------   ----------
postgres (native)   0.7.9.2008.01.28    Jan 28, 2008          49K
postgres-pr (ruby)  0.6.3               Dec 14, 2009          35K
pg (native)         0.10.0              Dec 01, 2010         210K</pre>
<p><em><br />
Even taking the subjective versioning and download numbers, I want us to use a library that is <strong>actively maintained</strong> and <strong>well used</strong>. Michael Granger is all over pg and having the most downloads by far, gives me the warm fuzzy that errors will have been encountered and (hopefully) fixed. Since we run on a platform that can use the native gems, pg is the obvious choice &#8211; for us. Of course, as they say, your mileage may vary.</em></p>
<h3>UPDATE Dec. 15, 2010:</h3>
<p>The <a title="issue-56" href="http://bitbucket.org/ged/ruby-pg/issue/56/pg-0100-fails-to-compile-on-opensolaris" target="_blank">issue</a> has been updated &#8211; looks like this isn&#8217;t an isolated problem.</p>
]]></content:encoded>
			<wfw:commentRss>http://techblog.amphora-research.com/2010/12/postgres-pg-gem-compilation-problems-on-opensolaris/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Apple iPad print server in Pure Java</title>
		<link>http://techblog.amphora-research.com/2010/11/apple-ipad-print-server-in-pure-java/</link>
		<comments>http://techblog.amphora-research.com/2010/11/apple-ipad-print-server-in-pure-java/#comments</comments>
		<pubDate>Tue, 23 Nov 2010 09:35:24 +0000</pubDate>
		<dc:creator>Simon Coles</dc:creator>
				<category><![CDATA[iPad]]></category>
		<category><![CDATA[ePrint]]></category>
		<category><![CDATA[iOS]]></category>
		<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://techblog.amphora-research.com/?p=49</guid>
		<description><![CDATA[Apple have just released iOS 4.2 which includes the ability to print. As part of PatentSafe we have a IPP print server written in Java which can accept print jobs from the iPad and other iOS devices. We also have some Java code which advertises the printer to iOS devices either locally or via wide-area [...]]]></description>
			<content:encoded><![CDATA[<p>Apple have just released iOS 4.2 which includes the ability to print. As part of PatentSafe we have a IPP print server written in Java which can accept print jobs from the iPad and other iOS devices. We also have some Java code which advertises the printer to iOS devices either locally or via wide-area Bonjour.</p>
<p>The net result of this is we have a pure Java print server which you can print to from an iOS device. You can print from your iPad to the server, which will produce a PDF as a result.</p>
<p>We&#8217;re aware this might be of interest to other people; if you have an application where you feel it might be of use, drop us a line and we can discuss&#8230; and if you need help writing/perfecting your own iPad print server I am sure we can help.</p>
]]></content:encoded>
			<wfw:commentRss>http://techblog.amphora-research.com/2010/11/apple-ipad-print-server-in-pure-java/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Pound 2.5 and the Include directive</title>
		<link>http://techblog.amphora-research.com/2010/06/pound-2-5-and-the-include-directive/</link>
		<comments>http://techblog.amphora-research.com/2010/06/pound-2-5-and-the-include-directive/#comments</comments>
		<pubDate>Thu, 10 Jun 2010 13:28:23 +0000</pubDate>
		<dc:creator>Simon Coles</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://techblog.amphora-research.com/?p=42</guid>
		<description><![CDATA[We&#8217;re very happy with Pound as a front-end Proxy to our hosted PatentSafe servers. In the version 2.5 release notes there is mention of an Include directive which is clearly of interest because our configuration file is getting rather large! Turns out there isn&#8217;t much documentation around so here&#8217;s what we understand having read the [...]]]></description>
			<content:encoded><![CDATA[<p>We&#8217;re very happy with <a href="http://www.apsis.ch/pound/" target="_blank">Pound</a> as a front-end Proxy to our hosted <a href="http://www.amphora-research.com/products/patentsafe" target="_blank">PatentSafe</a> servers. In the version 2.5 release notes there is mention of an Include directive which is clearly of interest because our configuration file is getting rather large! Turns out there isn&#8217;t much documentation around so here&#8217;s what we understand having read the source&#8230;</p>
<p>In our main pound.cfg file we have a line like this:</p>
<pre>Include "/etc/pound/morescience.config"</pre>
<p>The <span style="font-family: Consolas, Monaco, 'Courier New', Courier, monospace; line-height: 18px; font-size: 12px; white-space: pre;">morescience.config</span> file contains just what we&#8217;d normally put in the pound.cfg file.</p>
<p>Seems to work fine, we haven&#8217;t tried with anything other than a full pathname in quotes.</p>
<p>Hope that helps someone who also can&#8217;t find the Include directive in Pound&#8217;s documentation&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://techblog.amphora-research.com/2010/06/pound-2-5-and-the-include-directive/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Overview of deploying Rails applications on GlassFish v3</title>
		<link>http://techblog.amphora-research.com/2010/04/overview-of-deploying-rails-applications-on-glassfish-v3/</link>
		<comments>http://techblog.amphora-research.com/2010/04/overview-of-deploying-rails-applications-on-glassfish-v3/#comments</comments>
		<pubDate>Wed, 07 Apr 2010 18:05:26 +0000</pubDate>
		<dc:creator>Don Morrison</dc:creator>
				<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[deployment]]></category>
		<category><![CDATA[glassfish]]></category>
		<category><![CDATA[jruby]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[rubyonrails]]></category>
		<category><![CDATA[warbler]]></category>

		<guid isPermaLink="false">http://techblog.amphora-research.com/?p=23</guid>
		<description><![CDATA[Disclaimer: Eventhough we aren&#8217;t deploying the Custodian Console under GlassFish, we spent some time playing and this overview may help some lost soul out there. (And some of the knowledge was transferrable to our current deployment method.) GlassFish GlassFish v3 is a reference implementation of Java EE 6. Quite a mouthful. For Rails developers: it [...]]]></description>
			<content:encoded><![CDATA[<p><em>Disclaimer: Eventhough we aren&#8217;t deploying the Custodian Console under GlassFish, we spent some time playing and this overview may help some lost soul out there. (And some of the knowledge was transferrable to our current deployment method.)</em></p>
<h2><em><span style="font-style: normal;">GlassFish</span></em></h2>
<p><em><span style="font-style: normal;">GlassFish v3 is a reference implementation of Java EE 6. Quite a mouthful. For Rails developers: it uses some of the latest and greatest technology available on the Java 6 Enterprise Edition, and that means the deployment environment is going to need JDK 6 (Java Development Kit), which clocks in between 42-63MB.</span></em></p>
<p><em><span style="font-style: normal;">The GlassFish application server has first class support for two deployment methods for Rails applications:</span></em></p>
<ul>
<li>Directory-based</li>
<li>WAR-based</li>
</ul>
<p><em><span style="font-style: normal;">(Technically, you could use the GlassFish gem and deploy your applications this way, but it seems to be the same style of deployment you all know and love with mongrel/thin/unicorn/etc &#8211; and who wants to read another article about that?)</span></em></p>
<p><em><span style="font-style: normal;">The differences between the deployment methods are subtle but important: a WAR can have JRuby bundled with it, whereas you&#8217;ll need to install JRuby separately with directory deployment. A WAR deploy can get you closer to a self-contained application, if that is your goal. Additionally, with the WAR file, you can drop it into the GlassFish autodeploy directory and the application server will automagically detect it and deploy. (We use <a title="Warbler on Github" href="http://github.com/nicksieger/warbler">Warbler</a>, a library that will take a Rails application and package it up in a WAR with JRuby and jruby-rack, both of which you need.)</span></em></p>
<p><span style="font-style: normal;"><strong><em>A note on asadmin:</em></strong><em> </em><span style="font-weight: normal; font-size: 13px;"><em>Most of what you do with GlassFish will be done using the </em><strong><em>asadmin</em></strong><em> command. In fact, it seems to be the hub of the GlassFish universe. </em></span></span></p>
<h3><em><span style="font-style: normal;">Installing GlassFish</span></em></h3>
<p>Installation is a simple affair &#8211; just head over to <a title="Glassfish v3 Downloads" href="https://glassfish.dev.java.net/downloads/v3-final.html">GlassFish v3 Downloads</a> and pick your poison. There is a GUI installer for Windows, Solaris, Linux and MacOSX. Thankfully, there is also a platform independent zip file.</p>
<h3>GlassFish Architecture</h3>
<p>Here is where it gets interesting(?) &#8230; *deep breath* This GlassFish &#8220;server&#8221; can house multiple domains, which in turn, have many server instances, and these server instances are where your applications are deployed. *whew!* A good resource for truly understanding the GlassFish architecture is <em><a title="GlassFish Administration on Amazon.com" href="http://www.amazon.com/GlassFish-Administration-Xuekun-Kou/dp/1847196500/ref=sr_1_1?ie=UTF8&amp;s=books&amp;qid=1270656425&amp;sr=8-1" target="_blank">GlassFish Administration </a></em><a title="GlassFish Administration on Amazon.com" href="http://www.amazon.com/GlassFish-Administration-Xuekun-Kou/dp/1847196500/ref=sr_1_1?ie=UTF8&amp;s=books&amp;qid=1270656425&amp;sr=8-1" target="_blank">by Xuekun Kou</a> (also on <a title="GlassFish Administration from Safari Books Online" href="http://my.safaribooksonline.com/9781847196507" target="_blank">Safari Books Online</a>). Luckily, with the out-of-the-box install you get a default domain (<em>domain1</em>) and a default server instance. Remember that GlassFish is intended to do all the fancy things that a Java application server can do, so you can have clustering, multiple domains, multiple applications running in a single domain, the same application running on multiple server instances &#8211; pretty much whatever you can think of.</p>
<h3>Deploy That App!</h3>
<p>So, GlassFish is installed. You need <strong>asadmin</strong> to get things going.</p>
<pre>&gt; asadmin start-domain</pre>
<p>This command will, um, start the domain. (If you had the war file in autodeploy, or if the application had been previously deployed, it would be deployed/started during domain initialization.)  GlassFish features a fairly complete administrative UI which is available at http://yourserver:4848. The admin site takes a little bit to start up as GlassFish doesn&#8217;t load anything until it is requested, this includes your Rails application. <strong>That first request is a biggie!</strong> From the admin site you can monitor performance, view logs, change settings, and all kinds of fun stuff. Take a look around, and ask yourself, &#8220;Do I really need any/all of this?&#8221;.</p>
<h4>Deploy from a directory or &#8220;It sounds easy but it may be the same dance you do now&#8221;</h4>
<p>Remember, if you aren&#8217;t bundling JRuby with your application you&#8217;ll need to tell GlassFish where it is &#8230;</p>
<pre>&gt; asadmin configure-jruby-container --jruby.home=/path/to/jruby-x.x.x</pre>
<p>and you&#8217;ll need to have all the gems installed, etc, etc. (Sound familiar?) In this case, it would be wise to have your gems vendored in your Rails application. From the directory above your rails application run:</p>
<pre>&gt; $GLASSFISH_HOME/bin/asadmin deploy your-rails-app/</pre>
<p>This will deploy the application to your server at http://localhost:3000/your-rails-app. Any errors will be available in <em>$GLASSFISH_HOME/domains/domain1/logs/server.log</em></p>
<h4>Deploy from a WAR or &#8220;It sounds easy and it is<strong>&#8220;</strong></h4>
<p>Assuming you&#8217;ve got your Rails application all WAR&#8217;d up (using <a title="Warbler on Github" href="http://github.com/nicksieger/warbler">Warbler</a>, of course). Warbler ensures that JRuby, jruby-rack, and all your gems are included.</p>
<pre>&gt; asadmin deploy /path/to/your-rails-app.war</pre>
<p>This will deploy your application to your server at http://localhost:3000/your-rails-app. Same as above. Notice you didn&#8217;t have to do anything to tell GlassFish about JRuby or the gems. Nice!</p>
<p>Alternatively, you can drop <em>your-rails-app.war</em> in <em>$GLASSFISH_HOME/domains/domain1/autodeploy</em> and GlassFish will do the rest.</p>
<h4>Making your app the root application (and changing the deployed app name)</h4>
<p>You may want your rails application to be available at http://localhost:3000/ (or the root of the server). Again, <strong>asadmin</strong> is your friend:</p>
<pre>&gt; asadmin deploy --contextroot / /path/to/your-rails-app.war</pre>
<p>Now your application is served at the root of the GlassFish server instance.</p>
<p>Want to change the name of the deployed application?</p>
<pre>&gt; asadmin deploy --name myapp /path/to/your-rails-app.war</pre>
<p>Now you have http://localhost:3000/myapp</p>
<h2>Our thoughts</h2>
<p>As mentioned earlier, GlassFish would seem to shine when used for internal application deployments where you want to leverage existing infrastructure by hosting multiple Rails application within a single GlassFish install or using the GlassFish clustering options. Imagine using Capistrano to just push up the newest WAR and having GlassFish autodeploy that, no more stopping and starting your webservers! The monitoring and administration would also provide you with insight that isn&#8217;t provided in other Rails installation methods.</p>
<p>We played with GlassFish for a bit and decided that for our purposes it was a bit heavy. What were we looking for?:</p>
<ul>
<li>easy deployment (not just for internal techies)</li>
<li>ability to provide a zip file with everything needed in it, no install needed</li>
<li>no admin UI</li>
<li>deploy without dependence on a central command (<strong>asadmin</strong> anyone?) &#8211; we could have used autodeploy here</li>
<li>smallest download possible</li>
<li>least amount of external dependencies (GlassFish requires the JDK and your run-of-the-mill Rails app isn&#8217;t going to need all that!)</li>
</ul>
<p>Keep in mind our Custodian Console is a Rails application installed at customer sites, we do not always have direct access to the servers so we need deployment to be fire and forget. This led us to pursue Tomcat as an alternative and this set up will be the topic of a future post.</p>
]]></content:encoded>
			<wfw:commentRss>http://techblog.amphora-research.com/2010/04/overview-of-deploying-rails-applications-on-glassfish-v3/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How to make a file executable in Cocoa</title>
		<link>http://techblog.amphora-research.com/2010/03/how-to-make-a-file-executable-in-cocoa/</link>
		<comments>http://techblog.amphora-research.com/2010/03/how-to-make-a-file-executable-in-cocoa/#comments</comments>
		<pubDate>Tue, 30 Mar 2010 08:26:05 +0000</pubDate>
		<dc:creator>Simon Coles</dc:creator>
				<category><![CDATA[Cocoa]]></category>
		<category><![CDATA[MacOS X]]></category>
		<category><![CDATA[permissions]]></category>

		<guid isPermaLink="false">http://techblog.amphora-research.com/?p=19</guid>
		<description><![CDATA[One of the things I need to do in our MacOS Client is make a file I create executable. It took a little reverse engeineering to do it, so here&#8217;s the code if anyone else needs to make a file executable in MacOS X Cocoa. // Set the attributes of the file we've just created [...]]]></description>
			<content:encoded><![CDATA[<p>One of the things I need to do in our MacOS Client is make a file I create executable. It took a little reverse engeineering to do it, so here&#8217;s the code if anyone else needs to make a file executable in MacOS X Cocoa.</p>
<p><code><br />
	// Set the attributes of the file we've just created which is a little clumsy - you have to create a dictionary of attributes<br />
	NSDictionary *attributes;<br />
	NSNumber *permissions;<br />
	permissions = [NSNumber numberWithUnsignedLong: 493];<br />
	attributes = [NSDictionary dictionaryWithObject:permissions forKey:NSFilePosixPermissions];<br />
	// This actually sets the permissions<br />
	[[NSFileManager defaultManager] setAttributes:attributes ofItemAtPath:filePath error:&#038;error];<br />
</code></p>
]]></content:encoded>
			<wfw:commentRss>http://techblog.amphora-research.com/2010/03/how-to-make-a-file-executable-in-cocoa/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Registering URL handlers in MacOS X Cocoa Apps</title>
		<link>http://techblog.amphora-research.com/2010/03/registering-url-handlers-in-macos-x-cocoa-apps/</link>
		<comments>http://techblog.amphora-research.com/2010/03/registering-url-handlers-in-macos-x-cocoa-apps/#comments</comments>
		<pubDate>Sat, 27 Mar 2010 17:31:39 +0000</pubDate>
		<dc:creator>Simon Coles</dc:creator>
				<category><![CDATA[Cocoa]]></category>
		<category><![CDATA[MacOS X]]></category>

		<guid isPermaLink="false">http://techblog.amphora-research.com/?p=9</guid>
		<description><![CDATA[As a personal hobby project, I&#8217;m playing with writing MacOS X applications, which is something I have always wanted to do and am now enjoying now I&#8217;ve got over the first frustrating few hours (the breakthrough was realising it was in fact quite like Smalltalk, which I loved). I should preface this with the fact [...]]]></description>
			<content:encoded><![CDATA[<p>As a personal hobby project, I&#8217;m playing with writing MacOS X applications, which is something I have always wanted to do and am now enjoying now I&#8217;ve got over the first frustrating few hours (the breakthrough was realising it was in fact quite like Smalltalk, which I loved).</p>
<p>I should preface this with the fact that I really have no idea what I am doing, which makes it kind of fun for me although I might be making some basic mistakes! Anyway, I hope this helps someone&#8230;</p>
<p>I want my App to respond to a URL scheme, so I followed the <a href="http://www.cocoadev.com/index.pl?HowToRegisterURLHandler" target="_blank">example here on CocoaDev</a>. Which worked first time when I had the application running in the debugger. You put your URL schemes in the .plist file and then I had done this in my <em>applicationDidFinishLaunching:</em> method (as I didn&#8217;t have an init() method in the class already &#8211; maybe I should have created one but I wondered if that had been deprecated):</p>
<p><code><br />
[[NSAppleEventManager sharedAppleEventManager] setEventHandler:self<br />
          andSelector:@selector(getUrl:withReplyEvent:)<br />
          forEventClass:kInternetEventClass<br />
          andEventID:kAEGetURL];<br />
</code ></p>
<p>My problem was when the application wasn't running, it would launch in response to the URL click, but it wouldn't process the URL - it was being thrown away.</p>
<p>The trick was to put it in the <em>applicationWillFinishLaunching:</em> method, which now looks like this:<br />
<code><br />
// This is called just before it will finish launching<br />
- (void)applicationWillFinishLaunching:(NSNotification *)aNotification {<br />
  // Register ourselves as a URL handler for this URL<br />
  [[NSAppleEventManager sharedAppleEventManager] setEventHandler:self<br />
    andSelector:@selector(getUrl:withReplyEvent:)<br />
    forEventClass:kInternetEventClass<br />
    andEventID:kAEGetURL];<br />
}<br />
</code></p>
<p>(note in the code examples above, I've split the lines to make them more readable)</p>
]]></content:encoded>
			<wfw:commentRss>http://techblog.amphora-research.com/2010/03/registering-url-handlers-in-macos-x-cocoa-apps/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Welcome to Amphora&#8217;s Technical Blog</title>
		<link>http://techblog.amphora-research.com/2010/03/welcome-to-amphoras-technical-blog/</link>
		<comments>http://techblog.amphora-research.com/2010/03/welcome-to-amphoras-technical-blog/#comments</comments>
		<pubDate>Sat, 27 Mar 2010 16:03:14 +0000</pubDate>
		<dc:creator>Simon Coles</dc:creator>
				<category><![CDATA[Company stuff]]></category>

		<guid isPermaLink="false">http://techblog.amphora-research.com/?p=4</guid>
		<description><![CDATA[As a company, Amphora&#8217;s main focus is on Electronic Laboratory Notebooks for scientists, so historically our blogging efforts have focused on the ELN industry or Amphora corporate stuff. We like most technies benefit greatly from the free Technical resources out there &#8211; Open Source software, other people&#8217;s blogs, Google etc. If I compare how I [...]]]></description>
			<content:encoded><![CDATA[<p>As a company, Amphora&#8217;s main focus is on Electronic Laboratory Notebooks for scientists, so historically our blogging efforts have focused on the <a href="http://elnblog.com" target="_blank">ELN industry</a> or <a title="Amphora's corporate blog" href="http://www.amphora-research.com/blog" target="_blank">Amphora corporate stuff</a>.</p>
<p>We like most technies benefit greatly from the free Technical resources out there &#8211; Open Source software, other people&#8217;s blogs, Google etc. If I compare how I can work today to when I started working in Software Development (and I&#8217;m not that old, I promise!), the ability to just type an error message into Google saves me hours every week.</p>
<p>The question is, how can we participate in this, to give something back? We&#8217;ve tried a variety of solutions:</p>
<ul>
<li>Personal blogs, but none of us really have the time or inclination to keep one going.</li>
<li>A Wiki where we were going to write interesting stuff up, which never really got populated because it was too much work.</li>
</ul>
<p>We think a blog might work, and if we use a shared one then individuals can just add stuff as they feel moved to and not have to feel pressured to write to meet an audience&#8217;s expectations.</p>
<p>The material here won&#8217;t fit well on our other blogs, which are more ELN-related. So we&#8217;ve created this blog, where our techies can just contribute back tot he community we&#8217;ve benefitted so much from. I don&#8217;t have high expectations in terms of influence or regular readership, and clearly we&#8217;ll have to keep an eye on the competitive issues!</p>
<p>Our hope is that if we spend an hour figuring something out, instead of writing it up internally, we can put it here – and one day someone will themselves Google for a problem, find a post here which helps, and be on their way.</p>
]]></content:encoded>
			<wfw:commentRss>http://techblog.amphora-research.com/2010/03/welcome-to-amphoras-technical-blog/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

