<?xml version="1.0" encoding="UTF-8"?>
<posts type="array">
  <post>
    <author>Simon Schoeters</author>
    <content>&lt;p&gt;It took me a while to figure out the differences between the AddHandler and AddType directives in an Apache configuration. Both directives seem to define how the contents of a file with a given extension should be threatened but when do you need the first one and when the second?&lt;/p&gt;

&lt;p&gt;Turned out it isn't too hard... the AddType handler specifies how the &lt;strong&gt;client&lt;/strong&gt; (think about a browser) has to deal with a particular data stream (e.g. download a binary or show an image or HTML page). The AddHandler on the other hand maps a handler to the file extension telling the &lt;strong&gt;server&lt;/strong&gt; what to do with it. So if you are defining a Ruby on Rails or PHP content type you will need the AddHandler, telling the server it should parse the file. If you define a JavaScript or HTML file you will need the AddType one to tell the browser what content type to expect.&lt;/p&gt;

&lt;h3&gt;Strict versus quirks mode&lt;/h3&gt;

&lt;p&gt;Something slightly related is how browsers actually deal with the content type you set in your AddType directive. Gecko based browsers (like Firefox) follow the standard closely so they will handle a file according to the content type in your Apache configuration. This means your image will show up as text if you wrongly assigned the text/plain content type. Internet Explorer is more flexible and tries to guess the mime type for misconfigured web servers showing a wrongly defined images as, well, an image.&lt;/p&gt;

&lt;h3&gt;More resources&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="http://httpd.apache.org/docs/2.0/mod/mod_mime.html" title="Apache Module mod_mime documentation" class="ext"&gt;Apache's Module mod_mime documentation&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://developer.mozilla.org/en/docs/Properly_Configuring_Server_MIME_Types" title="Properly Configuring Server MIME Types at the Mozilla Developer Center" class="ext"&gt;Properly Configuring Server MIME Types&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://developer.mozilla.org/en/docs/Properly_Configuring_Server_MIME_Types" title="A sample .htaccess file at the Mozilla Developer Center" class="ext"&gt;A sample .htaccess file with common MIME types&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</content>
    <created-at type="datetime">2007-09-05T15:10:08+02:00</created-at>
    <id type="integer">2</id>
    <location-id type="integer">3</location-id>
    <permalink>addhandler-addtype-directives</permalink>
    <title>Apache AddHandler or AddType directive?</title>
    <updated-at type="datetime">2007-10-07T01:59:19+02:00</updated-at>
  </post>
  <post>
    <author>Simon Schoeters</author>
    <content>&lt;p&gt;After upgrading Ruby to 1.8.6 and Rails to 2.0.2 I ran intro problems with my installed gems. My application couldn't find any of the installed gems anymore! The &lt;samp&gt;gem list&lt;/samp&gt; command returned the installed gems like you would expect and even the &lt;samp&gt;./script/console&lt;/samp&gt; environment in my Rails application found the gems I needed but requiring a gem in one of my controllers like:&lt;/p&gt;

&lt;p&gt;&lt;samp&gt;require 'somegem'&lt;/samp&gt;&lt;/p&gt;

&lt;p&gt;returned the following error:&lt;/p&gt;

&lt;p&gt;&lt;samp&gt;MissingSourceFile (no such file to load -- somegem)&lt;/samp&gt;&lt;/p&gt;

&lt;p&gt;It took ages to find out what the problem was. My &lt;a href="http://www.rubygems.org/read/chapter/3#page83" title="Installing RubyGems in a User Directory" class="ext"&gt;GEM_PATH&lt;/a&gt; variable - this is where RubyGems looks for the installed gems - was set. I could find the gem from everywhere, except from within the controllers in my application. However, it did work fine when I ran the WEBrick server but when using my LightTPD production server everything went fubar.&lt;/p&gt;

&lt;p&gt;Turned out I forgot to tell LightTPD to use the new GEM_PATH, other than the default one. You can do this in the LightTPD configuration file. Maybe I changed the gem installation directory as I build RubyGems from source without knowing? Add the following to your LightTPD configuration file (change the paths where needed) and reload the server.&lt;/p&gt;

&lt;p&gt;&lt;samp&gt;fastcgi.server =&lt;br /&gt;
(&lt;br /&gt;
&amp;nbsp;".fcgi" =&amp;gt;&lt;br /&gt;
&amp;nbsp;(&lt;br /&gt;
&amp;nbsp;&amp;nbsp;"localhost" =&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;(&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;"min-procs" =&amp;gt; 1,&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;"max-procs" =&amp;gt; 1,&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;"socket" =&amp;gt; "&amp;lt;app&amp;gt;/tmp/sockets/fcgi.socket",&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;"bin-path" =&amp;gt; "&amp;lt;app&amp;gt;/public/dispatch.fcgi",&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;"bin-environment" =&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;(&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;"RAILS_ENV" =&gt; "production",&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;strong&gt;"GEM_PATH" =&gt; "/usr/local/lib/ruby/gems/1.8/"&lt;/strong&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;)&lt;br /&gt;
&amp;nbsp;)&lt;br /&gt;
)&lt;/samp&gt;&lt;/p&gt;

&lt;p&gt;That's it, Suffix is now happily running the latest Ruby on Rails version.&lt;/p&gt;</content>
    <created-at type="datetime">2008-02-29T10:07:22+01:00</created-at>
    <id type="integer">20</id>
    <location-id type="integer">3</location-id>
    <permalink>missing-gems-in-lighttpd</permalink>
    <title>Missing gems in LightTPD</title>
    <updated-at type="datetime">2008-03-03T00:11:49+01:00</updated-at>
  </post>
  <post>
    <author>Simon Schoeters</author>
    <content>&lt;p&gt;The System Preferences application on Mac is universal since Snow Leopard: it can run in 32-bit or 64-bit but not at the same time. That's why you have to restart the application when you want to open an older Preference Pane.&lt;/p&gt;

&lt;p&gt;Today I tried to upgrade the &lt;a href="http://milkcarton.be/apps/lazypoken" title="A poken automounter" class="ext"&gt;LazyPoken&lt;/a&gt; prefpane as it was still a 32-bit build and the next Mac OS X will probably no longer support the 32-bit System Preferences application. That turned out to be a little harder as expected.&lt;/p&gt;

&lt;h3&gt;Build settings&lt;/h3&gt;

&lt;p&gt;First of all you should change your project ARCH flags to tell the gcc compiler it should build for 64-bit. You can do this in Project &amp;rarr; Edit Project Settings, choose the Build tab and look for the Architectures or ARCHS parameter. Choose the 64-bit or Universal mode (if you need to support Tiger).&lt;/p&gt;

&lt;p&gt;This is not enough however. If you try to build and install your application you&amp;apos;ll notice it&amp;apos;s still running in 32-bit, stubborn prefpane.&lt;/p&gt;

&lt;p&gt;The 64-bit System Preferences application also uses garbage collection and all 64-bit prefpanes need to support this as well. You can enable this in the same build panel under the Objective-C Garbage Collection or GCC_ENABLE_OBJC_GC parameter. Choose the Supported or Required option, again, depending on what you want to support.&lt;/p&gt;

&lt;p&gt;Clean and build your application again, check for warnings and try it out. Looking better now?&lt;/p&gt;

&lt;h3&gt;64-bit gotchas&lt;/h3&gt;

&lt;ul&gt;
	&lt;li&gt;Sparkle: make sure to include the With Garbage Collection version of Sparkle, you just activated garbage collection remember?&lt;/li&gt;
	&lt;li&gt;Older frameworks: make sure the frameworks your application depends on compile in 64-bit mode. The Developer Tools installed with Xcode include a tool to check your code for possible 64-bit incompatibilities. Read the &lt;a href="http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/Cocoa64BitGuide/ConvertingExistingApp/ConvertingExistingApp.html#//apple_ref/doc/uid/TP40004247-CH5-SW1" title="64-bit Trasition Guide for Cocoa" class="ext"&gt;Converting an Existing Application to 64-Bit&lt;/a&gt; documentation.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Still running into problems? Read the &lt;a href="http://developer.apple.com/mac/library/documentation/UserExperience/Conceptual/PreferencePanes/Articles/UpdatingPreferencePanesforSnowLeopardandBeyond.html" title="Updating Preference Panes for Snow Leopard and Beyond" class="ext"&gt;Updating Preference Panes for Snow Leopard and Beyond&lt;/a&gt; article from Apple&amp;apos;s Preference Pane Programming Guide.&lt;/p&gt;</content>
    <created-at type="datetime">2010-02-04T00:06:36+01:00</created-at>
    <id type="integer">66</id>
    <location-id type="integer">8</location-id>
    <permalink>building-64bit-prefpane</permalink>
    <title>Building a 64-bit prefpane</title>
    <updated-at type="datetime">2010-02-04T00:15:10+01:00</updated-at>
  </post>
</posts>
