<?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"
	>

<channel>
	<title>mjijackson</title>
	<atom:link href="http://mjijackson.com/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://mjijackson.com/blog</link>
	<description>Just another WordPress weblog</description>
	<pubDate>Tue, 16 Sep 2008 04:38:25 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6</generator>
	<language>en</language>
	<image>
  <link>http://mjijackson.com/blog</link>
  <url>http://mjijackson.com/blog/wp-content/themes/version3/img/icons/favicon.gif</url>
  <title>mjijackson</title>
</image>
		<item>
		<title>Shadowbox 2.0 Final Release</title>
		<link>http://mjijackson.com/blog/2008/shadowbox-20-final-release/</link>
		<comments>http://mjijackson.com/blog/2008/shadowbox-20-final-release/#comments</comments>
		<pubDate>Fri, 11 Jul 2008 04:57:11 +0000</pubDate>
		<dc:creator>mjijackson</dc:creator>
		
		<category><![CDATA[JavaScript]]></category>

		<category><![CDATA[Shadowbox]]></category>

		<guid isPermaLink="false">http://mjijackson.com/2008/07/10/shadowbox-20-final-release/</guid>
		<description><![CDATA[I&#8217;m pleased to report that it seems the release candidate was a success, so I&#8217;m announcing the final release of Shadowbox version 2.0. I&#8217;ve put a lot of work into it, and I hope you enjoy it.

Some changes from version 1.0 include (but are not limited to) the following:


More stable communication between adapters for all [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m pleased to report that it seems the release candidate was a success, so I&#8217;m announcing the final release of <a href="http://www.mjijackson.com/shadowbox">Shadowbox version 2.0</a>. I&#8217;ve put a lot of work into it, and I hope you enjoy it.</p>

<p>Some changes from version 1.0 include (but are not limited to) the following:</p>

<ul>
<li>More stable communication between adapters for all frameworks</li>
<li>Smoother and more consistent animation</li>
<li>Improved support for Internet Explorer 7</li>
<li>More modular code design and custom build form</li>
<li>Improved i18n support</li>
<li>Much improved skinning API</li>
</ul>

<p>Really, the list could get quite long here. The truth is that it&#8217;s late, I&#8217;m tired, and unfortunately, I don&#8217;t really keep a nice, neat change log of every change that I make to the code. So I apologize to those of you who find them useful. Perhaps I&#8217;ll take that up in the future. In reality, I made hundreds of little tweaks and performance enhancements, so the list would be very long a boring anyways. Just trust me when I say that version 2 is much better than 1 ever was.</p>

<p>Many thanks to Wizzud (in the forums) whose help has been invaluable in squashing numerous bugs and who has generously donated hours of time to help stem the onslaught of support requests.</p>

<p>As always, please post any questions you may have in the <a href="http://www.nabble.com/Shadowbox-f31623.html">forum</a> instead of here on my blog. Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://mjijackson.com/blog/2008/shadowbox-20-final-release/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Shadowbox 2.0 RC1</title>
		<link>http://mjijackson.com/blog/2008/shadowbox-20-rc1/</link>
		<comments>http://mjijackson.com/blog/2008/shadowbox-20-rc1/#comments</comments>
		<pubDate>Tue, 01 Jul 2008 03:17:39 +0000</pubDate>
		<dc:creator>mjijackson</dc:creator>
		
		<category><![CDATA[JavaScript]]></category>

		<category><![CDATA[Projects]]></category>

		<category><![CDATA[Shadowbox]]></category>

		<guid isPermaLink="false">http://mjijackson.com/2008/06/30/shadowbox-20-rc1/</guid>
		<description><![CDATA[Don&#8217;t worry. I&#8217;m not dead&#8230;yet. It has been a crazy couple of months since I released the first version of Shadowbox. If you&#8217;re wondering what I&#8217;ve been up to, here&#8217;s a short list:


Graduated college
Took a week-long vacation to Hawai&#8217;i
Ate way too many Mauna Loa&#8217;s
Moved
Started a new job


I&#8217;m pretty sure that at least 3 of the [...]]]></description>
			<content:encoded><![CDATA[<p>Don&#8217;t worry. I&#8217;m not dead&#8230;yet. It has been a <em>crazy</em> couple of months since I released the first version of Shadowbox. If you&#8217;re wondering what I&#8217;ve been up to, here&#8217;s a short list:</p>

<ul>
<li>Graduated college</li>
<li>Took a week-long vacation to Hawai&#8217;i</li>
<li>Ate <em>way</em> too many Mauna Loa&#8217;s</li>
<li>Moved</li>
<li>Started a new job</li>
</ul>

<p>I&#8217;m pretty sure that at least 3 of the above qualify as major life-altering events, so please excuse me for not having released a major update to Shadowbox in the past few months. ;) I&#8217;m back now.</p>

<p><span id="more-19"></span></p>

<p>I&#8217;ve also been prowling the web to find out how people are using Shadowbox and where it comes short. The biggest problems that I&#8217;ve been hearing (and that I&#8217;ve tried to address with this release) are the following:</p>

<ul>
<li>Support for i18n</li>
<li>More consistent animation support across libraries (particularly MooTools)</li>
<li>Better theme/skin support</li>
<li>Better documentation</li>
<li>Support for slideshows (on an automatic timer)</li>
<li>Standalone version without need for an external JavaScript library</li>
<li>More modular code (file size)</li>
</ul>

<p>I&#8217;m proud to announce that I believe I&#8217;ve solved every one of the above issues with this release, as well as squashed a number of minor bugs.</p>

<p>This is just a release candidate, in case I&#8217;ve missed something obvious. Please <a href="http://www.mjijackson.com/shadowbox">check it out</a> and let me know what you think.</p>

<p><a href="http://www.mjijackson.com/shadowbox">Shadowbox project page</a></p>
]]></content:encoded>
			<wfw:commentRss>http://mjijackson.com/blog/2008/shadowbox-20-rc1/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Call for Shadowbox Translations</title>
		<link>http://mjijackson.com/blog/2008/call-for-shadowbox-translations/</link>
		<comments>http://mjijackson.com/blog/2008/call-for-shadowbox-translations/#comments</comments>
		<pubDate>Sat, 29 Mar 2008 17:25:30 +0000</pubDate>
		<dc:creator>mjijackson</dc:creator>
		
		<category><![CDATA[Shadowbox]]></category>

		<guid isPermaLink="false">http://mjijackson.com/2008/03/29/call-for-shadowbox-translations/</guid>
		<description><![CDATA[Hello all! It has been quite a while since I&#8217;ve posted anything here. I&#8217;ve been spending most of my free time improving Shadowbox instead of writing new blog material.

Due to popular demand, the next version of Shadowbox will have much improved i18n support (among other improvements). However, unfortunately I&#8217;m only fluent in 1.5 languages (English [...]]]></description>
			<content:encoded><![CDATA[<p>Hello all! It has been quite a while since I&#8217;ve posted anything here. I&#8217;ve been spending most of my free time improving Shadowbox instead of writing new blog material.</p>

<p>Due to popular demand, the next version of Shadowbox will have much improved i18n support (among other improvements). However, unfortunately I&#8217;m only fluent in 1.5 languages (English and some Italian), so I need your help. If you would like Shadowbox translated into your native tongue, please translate the following object and post it here or send it to me.</p>

<p><span id="more-18"></span></p>

<p>I&#8217;ll be keeping a list of already supported languages on this page. Thanks!</p>

<pre><code>Shadowbox.LANG = {

    code:       'en',

    of:         'of',

    loading:    'loading',

    cancel:     'Cancel',

    next:       'Next',

    previous:   'Previous',

    play:       'Play',

    pause:      'Pause',

    close:      'Close',

    errors:     {
        single: 'You must install the &lt;a href="{0}"&gt;{1}&lt;/a&gt; browser plugin to view this content.',
        shared: 'You must install both the &lt;a href="{0}"&gt;{1}&lt;/a&gt; and &lt;a href="{2}"&gt;{3}&lt;/a&gt; browser plugins to view this content.',
        either: 'You must install either the &lt;a href="{0}"&gt;{1}&lt;/a&gt; or the &lt;a href="{2}"&gt;{3}&lt;/a&gt; browser plugin to view this content.'
    }

};
</code></pre>

<p>Already supported languages:</p>

<ul>
<li>Deutsch</li>
<li>English</li>
<li>Español</li>
<li>Français</li>
<li>Galego</li>
<li>Italiano</li>
<li>한국말</li>
<li>Burmese</li>
<li>Nederlands</li>
<li>Polski</li>
<li>Português (Brasil)</li>
<li>Português (Portugal)</li>
<li>русский язык</li>
<li>Slovenčina</li>
<li>Svenska</li>
<li>中文 (Simplified)</li>
<li>中文 (Traditional)</li>
</ul>

<p>Please include the native name of the language with your entry! For example, for French I would write &#8220;Français&#8221;.</p>

<p>For language codes, see <a href="http://www.gnu.org/software/gettext/manual/gettext.html#Language-Codes">this</a> page.</p>
]]></content:encoded>
			<wfw:commentRss>http://mjijackson.com/blog/2008/call-for-shadowbox-translations/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Redesigned</title>
		<link>http://mjijackson.com/blog/2008/redesigned/</link>
		<comments>http://mjijackson.com/blog/2008/redesigned/#comments</comments>
		<pubDate>Wed, 12 Mar 2008 14:52:54 +0000</pubDate>
		<dc:creator>mjijackson</dc:creator>
		
		<category><![CDATA[Design]]></category>

		<category><![CDATA[Markdown]]></category>

		<guid isPermaLink="false">http://mjijackson.com/2008/03/12/redesigned/</guid>
		<description><![CDATA[Just like almost every other blogger I know, I recently fell victim to the blog redesign bug. I apologize to those of you who have been waiting for new features to be incorporated into Shadowbox, but I just felt like I had to get this off of my mind first. Now that it&#8217;s done (with [...]]]></description>
			<content:encoded><![CDATA[<p>Just like almost every other blogger I know, I recently fell victim to the blog redesign bug. I apologize to those of you who have been waiting for new features to be incorporated into Shadowbox, but I just felt like I had to get this off of my mind first. Now that it&#8217;s done (with a few small bugs still hanging around in various browsers no doubt) I&#8217;ll be getting on with more serious projects.</p>

<p>One major change that I made with the site is in the commenting. Instead of using straight HTML, I switched to using <a href="http://daringfireball.net" title="Daring Fireball">John Gruber&#8217;s</a> <a href="http://daringfireball.net/projects/markdown/" title="Markdown: a text-to-HTML conversion tool for web writers">Markdown</a> format. In fact, pretty much the whole site is based on Markdown now. The posts, comments, and even the comment preview function. By the way, I plan on making the comment preview plugin available on WordPress as soon as I get some time.</p>

<p>If you&#8217;re afraid of Markdown, don&#8217;t be. It is the most easy-to-use writing tool that I can think of. In fact, I bet you already know most of the <a href="http://daringfireball.net/projects/markdown/syntax" title="Markdown syntax reference">rules</a>.</p>

<p>I have a lot of good stuff in the works that I&#8217;ll be making publicly available very soon. In the meantime, feel free to let me know what you think of the redesign!</p>
]]></content:encoded>
			<wfw:commentRss>http://mjijackson.com/blog/2008/redesigned/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Shadowbox 1.0 released</title>
		<link>http://mjijackson.com/blog/2008/shadowbox-10-released/</link>
		<comments>http://mjijackson.com/blog/2008/shadowbox-10-released/#comments</comments>
		<pubDate>Thu, 21 Feb 2008 18:15:25 +0000</pubDate>
		<dc:creator>mjijackson</dc:creator>
		
		<category><![CDATA[JavaScript]]></category>

		<category><![CDATA[Projects]]></category>

		<category><![CDATA[Shadowbox]]></category>

		<guid isPermaLink="false">http://mjijackson.com/2008/02/21/shadowbox-10-released/</guid>
		<description><![CDATA[This morning, I released version 1.0 of Shadowbox. In its first month, the beta was downloaded over 15,000 times! I really appreciate the amount of interest the JavaScript community has shown in this project. I&#8217;m working hard to make sure that it&#8217;s a quality piece of code, and I hope you enjoy it. The 1.0 [...]]]></description>
			<content:encoded><![CDATA[<p>This morning, I released version 1.0 of Shadowbox. In its first month, the beta was downloaded over 15,000 times! I really appreciate the amount of interest the JavaScript community has shown in this project. I&#8217;m working hard to make sure that it&#8217;s a quality piece of code, and I hope you enjoy it. The 1.0 version includes the following feature enhancements over the previous betas:</p>

<ul>
<li>Extensive and fully documented JavaScript API</li>
<li>Compatibility with the original <a href="http://www.huddletogether.com/projects/lightbox2/" title="Lightbox">Lightbox</a> HTML markup</li>
<li>Support for image maps</li>
<li>Numerous other options and bug fixes</li>
</ul>

<p>If you have any questions about how to use Shadowbox for your project, please ask them in the <a href="http://www.nabble.com/Shadowbox-f31623.html" title="Shadowbox support forum">support forum</a>.</p>

<p>More information <a href="http://mjijackson.com/shadowbox" title="Shadowbox">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://mjijackson.com/blog/2008/shadowbox-10-released/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Shadowbox support forum on Nabble</title>
		<link>http://mjijackson.com/blog/2008/shadowbox-support-forum-on-nabble/</link>
		<comments>http://mjijackson.com/blog/2008/shadowbox-support-forum-on-nabble/#comments</comments>
		<pubDate>Wed, 20 Feb 2008 21:49:16 +0000</pubDate>
		<dc:creator>mjijackson</dc:creator>
		
		<category><![CDATA[JavaScript]]></category>

		<category><![CDATA[Shadowbox]]></category>

		<guid isPermaLink="false">http://mjijackson.com/2008/02/20/shadowbox-support-forum-on-nabble/</guid>
		<description><![CDATA[It&#8217;s been difficult to keep the discussion threads organized here on my blog, so I opened up a forum with the nice folks at Nabble. Please post any questions or difficulties that you&#8217;re having with Shadowbox in that venue.

You can find it here.
]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s been difficult to keep the discussion threads organized here on my blog, so I opened up a forum with the nice folks at <a href="http://nabble.com">Nabble</a>. Please post any questions or difficulties that you&#8217;re having with Shadowbox in that venue.</p>

<p>You can find it <a href="http://www.nabble.com/Shadowbox-f31623.html">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://mjijackson.com/blog/2008/shadowbox-support-forum-on-nabble/feed/</wfw:commentRss>
		</item>
		<item>
		<title>What do you use Shadowbox for?</title>
		<link>http://mjijackson.com/blog/2008/what-do-you-use-shadowbox-for/</link>
		<comments>http://mjijackson.com/blog/2008/what-do-you-use-shadowbox-for/#comments</comments>
		<pubDate>Tue, 12 Feb 2008 22:40:48 +0000</pubDate>
		<dc:creator>mjijackson</dc:creator>
		
		<category><![CDATA[JavaScript]]></category>

		<category><![CDATA[Shadowbox]]></category>

		<guid isPermaLink="false">http://mjijackson.com/2008/02/12/what-do-you-use-shadowbox-for/</guid>
		<description><![CDATA[Wow. One evening, about three weeks ago, I stayed up late working on a little JavaScript app called Shadowbox that I had been working on for several weeks. Before I went to bed, I shot off an email to the jQuery mailing list and made a quick post in the Ext.js forums just to see [...]]]></description>
			<content:encoded><![CDATA[<p>Wow. One evening, about three weeks ago, I stayed up late working on a little JavaScript app called <a href="http://mjijackson.com/shadowbox/">Shadowbox</a> that I had been working on for several weeks. Before I went to bed, I shot off an email to the <a href="http://jquery.com">jQuery</a> mailing list and made a quick <a href="http://extjs.com/forum/showthread.php?t=24200&#038;highlight=shadowbox">post</a> in the Ext.js forums just to see if anybody else would be interested in using it.</p>

<p>Little did I know.</p>

<p><span id="more-14"></span></p>

<p>With a <a href="http://ajaxian.com/?p=3251">big push</a> from the ubiquitous <a href="http://reybango.com">Rey Bango</a>, here&#8217;s what it has done so far:</p>

<ul>
    <li>8 beta releases</li>
    <li>10,734 <a href="http://code.google.com/p/michaeljackson/downloads/list?can=1&#038;q=&#038;colspec=Filename+Summary+Uploaded+Size+DownloadCount">downloads</a> from Google Code</li>
    <li>Over 1,500 <a href="http://del.icio.us/search/?fr=del_icio_us&#038;p=shadowbox&#038;type=all">bookmarks</a> on <a href="http://del.icio.us">Del.icio.us</a></li>
    <li><a href="http://mjijackson.com/shadowbox/#adapters">Adapters</a> for 6 major JavaScript frameworks</li>
    <li>And a lot of traffic here on my site</li>
</ul>

<p>Needless to say, I am very pleased that it has been received so well by the JavaScript community and that so many are getting use out of it. I have received quite a few emails with questions as well as comments on the <a href="http://mjijackson.com/2008/01/22/shadowbox-js-media-viewer-1-0-beta/">original post</a>, and I&#8217;ve responded to as many as I have time for. Please forgive me if I haven&#8217;t gotten around to answering your particular question&#8230;I&#8217;ve been swamped!</p>

<p>One thing that I have noticed is that quite a few people seem to be using it for purposes other than displaying static pictures and movies. I&#8217;ve e-talked with many individuals who are using Shadowbox for inline HTML content, image maps, and Ajax-powered galleries among other things, and I&#8217;d like to provide an API in 1.0 that will nicely accommodate several different methods of use.</p>

<p>So I guess my question is, what are YOU using Shadowbox for?</p>

<p>Please feel free to post links to anything you may have done with it. I&#8217;d like to see what you&#8217;ve come up with!</p>
]]></content:encoded>
			<wfw:commentRss>http://mjijackson.com/blog/2008/what-do-you-use-shadowbox-for/feed/</wfw:commentRss>
		</item>
		<item>
		<title>RGB to HSL and RGB to HSV color model conversion algorithms in JavaScript</title>
		<link>http://mjijackson.com/blog/2008/rgb-to-hsl-and-rgb-to-hsv-color-model-conversion-algorithms-in-javascript/</link>
		<comments>http://mjijackson.com/blog/2008/rgb-to-hsl-and-rgb-to-hsv-color-model-conversion-algorithms-in-javascript/#comments</comments>
		<pubDate>Sun, 10 Feb 2008 23:01:41 +0000</pubDate>
		<dc:creator>mjijackson</dc:creator>
		
		<category><![CDATA[Color]]></category>

		<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://mjijackson.com/2008/02/10/rgb-to-hsl-and-rgb-to-hsv-color-model-conversion-algorithms-in-javascript/</guid>
		<description><![CDATA[Some useful functions for converting between the major additive color models.]]></description>
			<content:encoded><![CDATA[<p>Here is a set of additive color model conversion algorithms that I found published on <a href="http://en.wikipedia.org/wiki/HSL_color_space" title="HSL color space">Wikipedia</a> and have implemented in JavaScript. It was surprisingly difficult to find these actually implemented anywhere in compact, efficient, and bug-free code, so I wrote my own. These should be easily portable to other programming languages if desired.</p>

<p><span id="more-10"></span></p>

<pre><code>/**
 * Converts an RGB color value to HSL. Conversion formula adapted from
 * http://en.wikipedia.org/wiki/HSL_color_space. Assumes r, g, and b are
 * contained in the set [0, 255] and returns h, s, and l in the set [0, 1].
 *
 * @param   {Number}    r       The red color value
 * @param   {Number}    g       The green color value
 * @param   {Number}    b       The blue color value
 * @return  {Array}             The HSL representation
 */
var rgbToHsl = function(r, g, b){
    r /= 255, g /= 255, b /= 255;
    var max = Math.max(r, g, b), min = Math.min(r, g, b);
    var h, s, l = (max + min) / 2;

    if(max == min){
        h = s = 0; // achromatic
    }else{
        var d = max - min;
        s = l &gt; 0.5 ? d / (2 - max - min) : d / (max + min);
        switch(max){
            case r: h = (g - b) / d + (g &lt; b ? 6 : 0); break;
            case g: h = (b - r) / d + 2; break;
            case b: h = (r - g) / d + 4; break;
        }
        h /= 6;
    }

    return [h, s, l];
};

/**
 * Converts an HSL color value to RGB. Conversion formula adapted from
 * http://en.wikipedia.org/wiki/HSL_color_space. Assumes h, s, and l are
 * contained in the set [0, 1] and returns r, g, and b in the set [0, 255].
 *
 * @param   {Number}    h       The hue
 * @param   {Number}    s       The saturation
 * @param   {Number}    l       The lightness
 * @return  {Array}             The RGB representation
 */
var hslToRgb = function(h, s, l){
    var r, g, b;

    if(s == 0){
        r = g = b = l; // achromatic
    }else{
        function hue2rgb(p, q, t){
            if(t &lt; 0) t += 1;
            if(t &gt; 1) t -= 1;
            if(t &lt; 1/6) return p + (q - p) * 6 * t;
            if(t &lt; 1/2) return q;
            if(t &lt; 2/3) return p + (q - p) * (2/3 - t) * 6;
            return p;
        };

        var q = l &lt; 0.5 ? l * (1 + s) : l + s - l * s;
        var p = 2 * l - q;
        r = hue2rgb(p, q, h + 1/3);
        g = hue2rgb(p, q, h);
        b = hue2rgb(p, q, h - 1/3);
    }

    return [r * 255, g * 255, b * 255];
};

/**
 * Converts an RGB color value to HSV. Conversion formula adapted from
 * http://en.wikipedia.org/wiki/HSV_color_space. Assumes r, g, and b are
 * contained in the set [0, 255] and returns h, s, and v in the set [0, 1].
 *
 * @param   {Number}    r       The red color value
 * @param   {Number}    g       The green color value
 * @param   {Number}    b       The blue color value
 * @return  {Array}             The HSV representation
 */
var rgbToHsv = function(r, g, b){
    r = r/255, g = g/255, b = b/255;
    var max = Math.max(r, g, b), min = Math.min(r, g, b);
    var h, s, v = max;

    var d = max - min;
    s = max == 0 ? 0 : d / max;

    if(max == min){
        h = 0; // achromatic
    }else{
        switch(max){
            case r: h = (g - b) / d + (g &lt; b ? 6 : 0); break;
            case g: h = (b - r) / d + 2; break;
            case b: h = (r - g) / d + 4; break;
        }
        h /= 6;
    }

    return [h, s, v];
};

/**
 * Converts an HSV color value to RGB. Conversion formula adapted from
 * http://en.wikipedia.org/wiki/HSV_color_space. Assumes h, s, and v are
 * contained in the set [0, 1] and returns r, g, and b in the set [0, 255].
 *
 * @param   {Number}    h       The hue
 * @param   {Number}    s       The saturation
 * @param   {Number}    v       The value
 * @return  {Array}             The RGB representation
 */
var hsvToRgb = function(h, s, v){
    var r, g, b;

    var i = Math.floor(h * 6);
    var f = h * 6 - i;
    var p = v * (1 - s);
    var q = v * (1 - f * s);
    var t = v * (1 - (1 - f) * s);

    switch(i){
        case 0: r = v, g = t, b = p; break;
        case 1: r = q, g = v, b = p; break;
        case 2: r = p, g = v, b = t; break;
        case 3: r = p, g = q, b = v; break;
        case 4: r = t, g = p, b = v; break;
        case 5: r = v, g = p, b = q; break;
    }

    return [r * 255, g * 255, b * 255];
};
</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://mjijackson.com/blog/2008/rgb-to-hsl-and-rgb-to-hsv-color-model-conversion-algorithms-in-javascript/feed/</wfw:commentRss>
		</item>
		<item>
		<title>How to install PHP 5.2, 5.3, and LightTPD on Mac OS X using MacPorts</title>
		<link>http://mjijackson.com/blog/2008/how-to-install-php-53-alongside-52-on-lighttpd-using-macports/</link>
		<comments>http://mjijackson.com/blog/2008/how-to-install-php-53-alongside-52-on-lighttpd-using-macports/#comments</comments>
		<pubDate>Tue, 05 Feb 2008 02:40:34 +0000</pubDate>
		<dc:creator>mjijackson</dc:creator>
		
		<category><![CDATA[LightTPD]]></category>

		<category><![CDATA[Mac]]></category>

		<category><![CDATA[MacPorts]]></category>

		<category><![CDATA[MySQL]]></category>

		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://mjijackson.com/2008/02/04/how-to-install-php-53-alongside-52-on-lighttpd-using-macports/</guid>
		<description><![CDATA[Run two versions of PHP on the same machine!]]></description>
			<content:encoded><![CDATA[<p>A few months ago, I was looking for a way to install PHP 5.3 alongside 5.2 on my development machine, a MacBook. Why? It has a lot to do with the new <a href="http://php.net/manual/en/language.oop5.late-static-bindings.php">late static bindings</a> and <a href="http://blog.agoraproduction.com/index.php?/archives/47-PHP-Namespaces-Part-1-Basic-usage-gotchas.html">namespaces</a> that have already been committed into PHP&#8217;s HEAD. I&#8217;ve been anticipating these features for a while now, and I was anxious to try them out.</p>

<p>Special thanks goes to MacPorts&#8217; Ryan Schmidt who helped me out on <a href="http://lists.macosforge.org/pipermail/macports-users/2007-December/007567.html">this</a> thread.</p>

<p><span id="more-7"></span></p>

<h3>Step One: Install MacPorts</h3>

<p>If you&#8217;re not familiar with <a href="http://www.macports.org/">MacPorts</a>, it&#8217;s a package management system for Mac OS X. MacPorts makes it easy to install, upgrade, and remove open-source software packages on your Mac. In this tutorial, it&#8217;s what I&#8217;ll be using to install all of the new software. If you haven&#8217;t yet installed MacPorts, the project has a nice <a href="http://www.macports.org/install.php">installation guide</a> that will guide you through the entire process. But don&#8217;t worry, you probably won&#8217;t need it. The installer is very straightforward.</p>

<p class="center"><img src='http://mjijackson.com/wordpress/wp-content/uploads/2008/02/macports.png' alt='MacPorts installer dialogue' /></p>

<p>Once you get MacPorts installed, update your port trees with the following command:</p>

<pre>
$ sudo port -d selfupdate
</pre>

<h3>Step Two: Install LightTPD</h3>

<p><a href="http://www.lighttpd.net/">LightTPD</a> is a great webserver that is very fast and very flexible. In this tutorial, we&#8217;ll be taking advantage of some of that flexibility to install two versions of PHP and run them on the same webserver using <a href="http://www.fastcgi.com/">FastCGI</a>. If you&#8217;d like to know more, check out <a href="http://raygunrobot.com/archives/PHP-5-and-LightTPD-on-Mac-OS-X">this</a> post by Garrett Albright. He also does a good job explaining why we&#8217;ll be using LightTPD instead of <a href="http://apache.org/">Apache</a>. Also, the basic MacPorts installation of PHP and LightTPD in this tutorial will closely follow the instructions given in that post, but with a few slight modifications.</p>

<p>Installing LightTPD using MacPorts is simple:</p>

<pre>
$ sudo port install lighttpd
</pre>

<p>If you&#8217;ve ever compiled software from source, you&#8217;ll recognize the significance of that one line! It does a LOT of stuff for you in the background.</p>

<h3>Step Three: Install PHP 5.2</h3>

<p>Being the current stable release at the time of this writing, PHP 5.2 should automatically install when you run <code>port install php5</code>. However, because we&#8217;ll be running on LightTPD using <a href="http://trac.lighttpd.net/trac/wiki/Docs:ModFastCGI">mod_fastcgi</a>, we&#8217;ll need to include the <code>fastcgi</code> <a href="http://guide.macports.org/#using.variants">variant</a>. Note: You may also want to use other variants such as <code>mysql5</code> or <code>postgresql</code> to include database libraries, but those are outside the scope of this tutorial. If you do decide to include support for MySQL, I&#8217;ll show you how to hook it up to 5.3 later on.</p>

<pre>
$ sudo port install php5 +fastcgi
</pre>

<p>This command will install PHP 5 with all of its dependencies, and will also compile a FastCGI module that we can use with our LightTPD installation. This could take a while, so make sure you have something to do while everything compiles.</p>

<h3>Step Four: Install PHP 5.3</h3>

<p>If you don&#8217;t need PHP 5.3 right now, you can skip this part. Otherwise, download the latest PHP 5.3 snapshot from <a href="http://snaps.php.net/">here</a> and uncompress it on your machine. Because I&#8217;m a big fan of <a href="http://hivelogic.com/articles/using_usr_local/">using /usr/local</a>, I uncompressed mine to <code>/usr/local/src</code>, but you can decompress yours anywhere you like. Now we&#8217;re going to do something special. Remember all those packages that MacPorts installed automatically for us when we installed PHP 5.2? We can use those same packages to compile 5.3.</p>

<pre>
$ cd /usr/local/src/php5.3-*
$ ./configure --prefix=/usr/local --mandir=/usr/local/share/man --infodir=/usr/local/share/info --with-config-file-path=/usr/local/etc --enable-calendar --with-iconv=/opt/local --enable-exif --enable-ftp --enable-wddx --with-zlib=/opt/local --with-bz2=/opt/local --with-libxml-dir=/opt/local --with-gettext=/opt/local --with-xmlrpc --enable-soap --enable-bcmath --enable-mbstring --enable-dba --with-openssl=/opt/local --with-mhash=/opt/local --with-mcrypt=/opt/local --with-xsl=/opt/local --with-curl=/opt/local --with-pcre-regex=/opt/local --with-gd --with-jpeg-dir=/opt/local --with-png-dir=/opt/local --enable-gd-native-ttf --without-pear --with-freetype-dir=/opt/local --with-ldap=/usr --with-kerberos=/usr --with-iodbc=/usr --with-sqlite --with-pdo-sqlite=/opt/local --enable-sqlite-utf8
</pre>

<h3>If you&#8217;re using MySQL 5&#8230;</h3>

<p>If you don&#8217;t have a MacPorts install of MySQL 5 already, you can find directions on how to do that <a href="http://2tbsp.com/content/install_and_configure_mysql_5_macports">here</a>. From this point, I assume you&#8217;ve already got it installed and working.</p>

<p>If you&#8217;d like to compile support for MySQL 5 into your PHP 5.3 build, you&#8217;ll need a few additional steps. By way of explanation, the PHP installer expects a certain directory structure in the MySQL directory. However, the MacPorts install of MySQL 5 moves things around a bit. No problem, we&#8217;ll just set up a temporary directory with some symlinks to help the PHP build find everything.</p>

<pre>
$ cd /usr/local/tmp
$ mkdir mysql5
$ ln -s /opt/local/lib/mysql5 mysql5/lib
$ ln -s /opt/local/include/mysql5 mysql5/include
</pre>

<p>These commands will create a temporary directory at <code>/usr/local/tmp/mysql5</code> that contains two symlinks to the actual locations of the MacPorts MySQL 5 installation. Next, we need to make sure to tell the PHP configure script about these. Add the following flags to the configure command we made above.</p>

<pre>
--with-mysql=/usr/local/tmp/mysql5 --with-pdo-mysql=/opt/local/bin/mysql_config5 --with-mysql-sock=/opt/local/var/run/mysql5/mysqld.sock --with-mysqli=/opt/local/bin/mysql_config5
</pre>

<p>After you run the configure, you can delete the <code>/usr/local/tmp/mysql5</code> directory.</p>

<h3>Step Five: Configure PHP and LightTPD</h3>

<p>When the PHP installation(s) is finished, we need to create and modify our php.ini file.</p>

<pre>
$ cd /opt/local/etc/
$ cp php.ini-recommended php.ini
</pre>

<p>The above commands copy the recommended initialization file (php.ini-recommended) that ships with the default distribution to a new file (php.ini) that will be used when PHP gets fired up. Open the file (<code>/opt/local/etc/php.ini</code>) in your text editor, and find the following line (in my php.ini, it was on line 565):</p>

<pre>
; cgi.fix_pathinfo=1
</pre>

<p>and uncomment it (i.e. change it to)</p>

<pre>
cgi.fix_pathinfo=1
</pre>

<p>That&#8217;s all for now so save and close the file. If you&#8217;ve installed 5.3 as well, you can find that configuration file at <code>/usr/local/etc/php.ini</code> (assuming you installed everything where I did). Be sure to make the same change in that file as well.</p>

<p>Now it&#8217;s time to modify your LightTPD configuration file. Like PHP, LightTPD ships with a default configuration file that you should copy at first to get you started.</p>

<pre>
$ cd /opt/local/etc/lighttpd/
$ cp lighttpd.conf.default lighttpd.conf
</pre>

<p>Open your newly created LightTPD configuration file (<code>/opt/local/etc/lighttpd/lighttpd.conf</code>) in a text editor, find the line (line 24 in my file) that says</p>

<pre>
#                               "mod_fastcgi",
</pre>

<p>and uncomment it (i.e. remove the hash at the beginning of the line). This line tells LightTPD to enable the <code>mod_fastcgi</code> module.</p>

<p>Immediately following this section of the configuration file is a section that tells the webserver where you want to serve files from and where you keep your error logs. I use <code>/usr/local/www</code> as my webserver root, so I have mine configured like this:</p>

<pre>
## a static document-root, for virtual-hosting take look at the
## server.virtual-* options
server.document-root        = "/usr/local/www/public-html/"

## where to send error-messages to
server.errorlog             = "/usr/local/www/logs/lighttpd/error.log"
</pre>

<p>My document root is <code>/usr/local/www/public-html</code>. This is the directory that you&#8217;ll place all of your publicly visible HTML and/or PHP files in. A few lines down, you&#8217;ll notice the following:</p>

<pre>
#server.event-handler = "freebsd-kqueue" # needed on OS X
</pre>

<p>Since we&#8217;re on OS X, uncomment this line. Okay, take a breather. We&#8217;re almost done.</p>

<h3>Step Six: Configure FastCGI</h3>

<p>All that&#8217;s left is to tell LightTPD how to handle requests for PHP files. Recall that we&#8217;re going to be running PHP with FastCGI, so we&#8217;ll need to configure the fastcgi module. Look for the line in your LightTPD configuration file that says</p>

<pre>
#### fastcgi module
</pre>

<p>Just below this line is where you&#8217;ll put the following configuration data for a normal PHP 5.2 install.</p>

<pre>
fastcgi.server = ( ".php" =>
    ( "localhost" =>
        (
            "socket" => "/tmp/php5-fastcgi.socket",
            "bin-path" => "/opt/local/bin/php-cgi",
            "broken-scriptfilename" => "enable",
            "allow-x-send-file" => "enable",
            "min-procs" => 2,
            "max-procs" => 2,
            "bin-environment" => (
                "PHP_FCGI_CHILDREN" => "4",
                "PHP_FCGI_MAX_REQUESTS" => "500"
            )
        )
    )
)
</pre>

<p>If you&#8217;d like to know what&#8217;s going on here, you can find a lot of information in the <a href="http://trac.lighttpd.net/trac/browser/trunk/doc/fastcgi.txt">fastcgi.txt</a> file. Basically, we&#8217;re telling LightTPD to treat any request for a file that ends in &#8220;.php&#8221; as PHP.</p>

<p>If you don&#8217;t want to install PHP 5.3, you&#8217;re done! However, it&#8217;s easy to add a 5.3 configuration directive as well. You need to do three things:</p>

<ol>
    <li>Figure out what criterion the server can use to determine that the file should be treated as PHP 5.3 instead of 5.2. In my case, I put all of my experimental 5.3 stuff in a special directory at my webserver root, <code>/php53/</code>.</li>
    <li>Change the temporary socket location</li>
    <li>Change the binary executable location</li>
</ol>

<p>My PHP 5.3 configuration section follows. Yours may be different depending on personal preference.</p>

<pre>
$HTTP["url"] =~ "/php53/" {
    fastcgi.server = ( ".php" =>
        ( "localhost" =>
            (
                "socket" => "/tmp/php53-fastcgi.socket",
                "bin-path" => "/usr/local/bin/php-cgi",
                "broken-scriptfilename" => "enable",
                "allow-x-send-file" => "enable",
                "min-procs" => 2,
                "max-procs" => 2,
                "bin-environment" => (
                    "PHP_FCGI_CHILDREN" => "4",
                    "PHP_FCGI_MAX_REQUESTS" => "500"
                )
            )
        )
    )
}
</pre>

<p>Here we use a special hash variable <code>$HTTP</code> to parse the URL request and look for our special directory. This feature of the LightTPD webserver offers some incredible flexibility. We can actually use any regular expression we want in place of the <code>/php53/</code> above.</p>

<p>Then, if the URL matches our regular expression, we tell the server to use the executable in <code>/usr/local/bin/php-cgi</code> (the 5.3 executable) to create the temporary socket at <code>/tmp/php53-fastcgi.socket</code>. Comparison with the first directive should make the differences obvious.</p>

<h3>Make sure it all worked!</h3>

<p>Time to test it out. First we need to fire up the webserver. Before starting LightTPD, we can use the following command to make sure it likes our config file.</p>

<pre>
$ lighttpd -t -f /opt/local/etc/lighttpd/lighttpd.conf
</pre>

<p>If everything is okay, you should see a <code>Syntax OK</code> message. If something&#8217;s not right, go back and check your work. This next command will actually start the webserver.</p>

<pre>
$ lighttpd -D -f /opt/local/etc/lighttpd/lighttpd.conf
</pre>

<p>Now, go to your webserver root (specified in Step 5 above), and create a file called <code>info.php</code>. Put the following code inside.</p>

<pre>
&lt;?php

phpinfo();

?>
</pre>

<p>Now open up your browser and navigate to <code>http://localhost/info.php</code>. You should see a page with all of your PHP 5.2 configuration information.</p>

<p>To test the PHP 5.3 install, make a special <code>php53</code> directory (assuming you followed the above configuration) in your webserver root and place a copy of the above <code>info.php</code> file in it. Now point your browser to <code>http://localhost/php53/info.php</code> and you should see the configuration information for 5.3!</p>

<p class="center"><img src='http://mjijackson.com/wordpress/wp-content/uploads/2008/02/phpinfo53.png' alt='phpinfo() 5.3' /></p>

<p>Enjoy.</p>
]]></content:encoded>
			<wfw:commentRss>http://mjijackson.com/blog/2008/how-to-install-php-53-alongside-52-on-lighttpd-using-macports/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Shadowbox.js Media Viewer 1.0 beta</title>
		<link>http://mjijackson.com/blog/2008/shadowbox-js-media-viewer-1-0-beta/</link>
		<comments>http://mjijackson.com/blog/2008/shadowbox-js-media-viewer-1-0-beta/#comments</comments>
		<pubDate>Wed, 23 Jan 2008 05:01:46 +0000</pubDate>
		<dc:creator>mjijackson</dc:creator>
		
		<category><![CDATA[JavaScript]]></category>

		<category><![CDATA[Projects]]></category>

		<category><![CDATA[Shadowbox]]></category>

		<guid isPermaLink="false">http://mjijackson.com/2008/01/22/shadowbox-js-media-viewer-1-0-beta/</guid>
		<description><![CDATA[Display your media in style.]]></description>
			<content:encoded><![CDATA[<div class="update" style="width:450px">
<p><strong>Update:</strong> Version 1.0 is now <a href="mjijackson.com/shadowbox">available</a>.</p>
</div>

<p>A few weeks ago, I was looking for a <a href="http://www.huddletogether.com/projects/lightbox2/">Lightbox</a>-like script that would allow me to display more than just pictures. In addition to static images, my client required the ability to display various types of movies including <a href="http://www.apple.com/quicktime/">QuickTime</a> and <a href="http://en.wikipedia.org/wiki/SWF">SWF</a>. The only script that fit the bill was <a href="http://www.stickmanlabs.com/lightwindow/">Lightwindow</a>&mdash;a nice piece of work to be sure&mdash;but it required the <a href="http://www.prototypejs.org">Prototype</a> + <a href="http://script.aculo.us">Scriptaculous</a> combo and I was already using <a href="http://developer.yahoo.com/yui/">YUI</a>.</p>

<p>Besides, I thought, it would be really great to have a full-featured media viewing application that was <a href="http://snook.ca/archives/javascript/be_library_agnostic/">library agnostic</a>. Then, if I need to use a different framework for some particular reason, I can easily switch.</p>

<p><span id="more-4"></span></p>

<p>Thus was born <a href="/shadowbox/">Shadowbox</a>&mdash;a cross-browser, cross-platform, cleanly-coded and fully-documented media viewer application built entirely in JavaScript. It&#8217;s currently in beta testing phase, so please let me know on this post if you find any bugs.</p>

<p>More info <a href="/shadowbox/">here</a>.</p>

<div class="edit">
<p><strong>Edit:</strong> Please don&#8217;t post support-type questions on this thread (i.e. &#8220;How do I &#8230;?&#8221;). I don&#8217;t currently have time to respond to them. The comments section below will be monitored closely for the sake of other visitors.</p>
</div>

<div class="update">
<p><strong>Update (&beta;2):</strong> Fixed a small bug that wouldn&#8217;t allow thumbnail galleries.</p>
</div>

<div class="update">
<p><strong>Update (&beta;3):</strong> Added adapter for <a href="http://mootools.net">MooTools</a> library.</p>
</div>

<div class="update">
<p><strong>Update (&beta;4):</strong> Several changes:</p>
<ul>
    <li>Added <a href="http://dojotoolkit.org">Dojo Toolkit</a> adapter (thanks Peter Higgins)</li>
    <li>Replaced <code>resizeLgImages</code> option with <code>handleLgImages</code>. The new option gives the user the ability to drag images that are too large for the view instead of simply resizing them.</li>
    <li>Added a buffered listener on window resize to prevent jittery window resizing</li>
</ul>
</div>

<div class="update">
<p><strong>Update (&beta;5):</strong> Various bug fixes and improvements:</p>
<ul>
    <li>Fixed bug in rendering of error handling messages</li>
    <li>Added support for explicitly specifying dimensions of images</li>
    <li>Added support for resizing of Flash content when the browser window is too small. Uses <code>handleLgImages</code> option.</li>
    <li>Added <code>onFinish</code> callback</li>
    <li>Fixed a bug in iframe sizing when dynamic image resizing is enabled</li>
    <li>Extended <code>Element.setOpacity</code> in MooTools adapter to fix visibility issues</li>
    <li>Added support for advanced setup that can bypass the need to modify HTML source</li>
    <li>Added plugin to jQuery adapter with support for metadata (thanks Mike Alsup)</li>
    <li>Moved private <code>file_types</code> property to public <code>EXTENSIONS</code> to allow customization for experienced users who wish to add more file types</li>
    <li>Added <code>text-align:left</code> attribute to CSS to override any other setting that may exist in parent elements</li>
</ul>
</div>

<div class="update">
<p><strong>Update (&beta;6):</strong> Two bug fixes:</p>
<ul>
    <li>Fixed bug in <code>setup()</code> that prevented jQuery object from being passed directly (thanks Mike Alsup)</li>
    <li>Fixed bug in MooTools adapter that did not correctly prevent an event&#8217;s default behavior in IE (thanks Alex)</li>
</ul>
</div>

<div class="update">
<p><strong>Update (&beta;7):</strong> Several fixes and improvements:</p>
<ul>
    <li>Added i18n support in the form of a customizable <code>text</code> option that can be used on <code>init()</code></li>
    <li>Added support for inline content from elements within the current page</li>
    <li>Added <code>animSequence</code> option to allow further control over the dimension animation sequence</li>
    <li>Fixed bug in <code>setup()</code> that processed links with no <code>rel</code> attribute (thanks Frederic)</li>
    <li>Moved <code>Shadowbox.EXTENSIONS</code> to <code>options.ext</code> to allow users to modify it in the same manner as other options</li>
    <li>Fixed various issues with the CSS files</li>
</ul>
<p>I&#8217;m getting very close to a 1.0 release so please keep the bug reports coming if you find any!</p>
</div>

<div class="update">
<p><strong>Update (&beta;8):</strong> Fixed two small bugs that I introduced in the &beta;7 release (thanks Frederic &#038; guy).</p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://mjijackson.com/blog/2008/shadowbox-js-media-viewer-1-0-beta/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
