<?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>Jim Yi</title>
	<atom:link href="http://www.jimyi.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.jimyi.com</link>
	<description>Personal website/blog of Jim Yi</description>
	<lastBuildDate>Mon, 26 Apr 2010 01:59:32 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.5</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>jQuery plugin: Bottom Event</title>
		<link>http://www.jimyi.com/blog/2010/04/25/jquery-plugin-bottom-event/</link>
		<comments>http://www.jimyi.com/blog/2010/04/25/jquery-plugin-bottom-event/#comments</comments>
		<pubDate>Mon, 26 Apr 2010 01:59:32 +0000</pubDate>
		<dc:creator>Jim</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.jimyi.com/?p=88</guid>
		<description><![CDATA[Overview
Adds a &#8220;bottom&#8221; event that will be triggered when the user has scrolled to the bottom or within proximity to the bottom of an element.  This is essentially a the same as my previous scrollLoader plugin, though more generic for other use cases.
Syntax

$(element).bottom(options);

Options
proximity (optional &#8211; default: 0): How close to the scrollbar is to [...]]]></description>
			<content:encoded><![CDATA[<h4>Overview</h4>
<p>Adds a &#8220;bottom&#8221; event that will be triggered when the user has scrolled to the bottom or within proximity to the bottom of an element.  This is essentially a the same as my previous scrollLoader plugin, though more generic for other use cases.</p>
<h4>Syntax</h4>
<p>
<pre><code>$(element).bottom(options);</code></pre>
<p></p>
<h4>Options</h4>
<p><em>proximity (optional &#8211; default: 0):</em> How close to the scrollbar is to the bottom of the element before triggering a load.  Use proximity: 0 for absolute bottom.<br />Proximity = (total scroll height &#8211; current scroll position) / total scroll height.</p>
<h4>Example Usage</h4>
<p>
<pre><code>// we start with 1 page of data
var page = 1;
$(document).ready(function() {
    $(window).bottom();
    $(window).bind("bottom", function() {
        var obj = $(this);
        // since this ajax call might take a while
        if (!obj.data("loading")) {
            obj.data("loading", true);
            $("#news_list").append("&lt;li&gt;Loading...&lt;/li&gt;");
            $.getJSON("/news/list?page=" + (++page), function(data) {
                // remove the loading text
                $("#news_list li:last").remove();
                for (var i = 0; i < data.news.length; i++) {
                    $("#news_list").append("&lt;li&gt;" + data.news[i].headline + "&lt;/li&gt;");
                }
                // now that the ajax call is done, we can re-enable this
                obj.data("loading", false);
            });
        }
    });
});</code></pre>
<p></p>
<p><a href="/content/jquery_bottom/demo.html">Demo</a> - bottom bound to both the window and an element with overflow: auto<br />
<a href="http://github.com/jimyi/jquery_bottom">Download at GitHub - jquery.bottom-1.0.js</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.jimyi.com/blog/2010/04/25/jquery-plugin-bottom-event/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Bean Pattern in PHP5</title>
		<link>http://www.jimyi.com/blog/2010/02/21/bean-pattern-in-php5/</link>
		<comments>http://www.jimyi.com/blog/2010/02/21/bean-pattern-in-php5/#comments</comments>
		<pubDate>Mon, 22 Feb 2010 00:15:24 +0000</pubDate>
		<dc:creator>Jim</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.jimyi.com/?p=74</guid>
		<description><![CDATA[Taking advantage of PHP5&#8217;s magic methods __get, __set, and __call, the bean pattern can be implemented pretty easily in PHP.  Here&#8217;s an example of it in Java:

public class UserBean {

    protected String username, email, location;

    public String getUsername() {
        return username;
 [...]]]></description>
			<content:encoded><![CDATA[<p>Taking advantage of PHP5&#8217;s magic methods __get, __set, and __call, the bean pattern can be implemented pretty easily in PHP.  Here&#8217;s an example of it in Java:</p>
<p>
<pre><code>public class UserBean {

    protected String username, email, location;

    public String getUsername() {
        return username;
    }
    public void setUsername(String username) {
        this.username = username;
    }

    public String getEmail() {
        return email;
    }
    public void setEmail(String email) {
        this.email = email;
    }

    public String getLocation {
        return location;
    }
    public void setLocation(String location) {
        this.location = location;
    }
}
</code></pre>
</p>
<p>One of the annoyances of this (at least for me) is that you end up creating a bunch of getter/setter methods that don&#8217;t do anything special &#8211; they either return the encapsulated variable or set it.  So, I wrote a base class that uses PHP5&#8217;s magic methods to take care of all of those generic getters and setters.<span id="more-74"></span></p>
<p>
<pre><code>abstract class Bean {
    public function __call($name, $arguments) {
        if (strpos($name, 'get') === 0) {
            $property = strtolower(substr($name,3,1)) . substr($name,4);
            return $this->$property;
        }
        elseif (strpos($name, 'set') === 0) {
            $property = strtolower(substr($name,3,1)) . substr($name,4);
            return $this->$property = $arguments[0];
        }
        else {
            throw new Exception("Method $name does not exist");
        }
    }

    public function __get($name) {
        $getter = 'get' . ucfirst($name);
        if (method_exists($this, $getter)) {
            return call_user_func(array($this, $getter));
        }
        return $this->$name;
    }

    public function __set($name, $value) {
        $setter = 'set' . ucfirst($name);
        if (method_exists($this, $setter)) {
            call_user_func(array($this, $setter), $value);
        }
        else {
            $this->$name = $value;
        }
    }
}
</code></pre>
</p>
<p>Using the above abstract class, the example UserBean in PHP would become just:</p>
<p>
<pre><code>class UserBean extends Bean {
    protected $username, $email, location;
}
</code></pre>
</p>
<p>And you can access the bean as follows, without having to write any of these functions:</p>
<p>
<pre><code>$user = new UserBean();
$user->setUsername('Jim');
echo $user->getUsername();
</code></pre>
</p>
<p>If you needed to do any additional work in the getter function, you can just create a getter function like you normally would:</p>
<p>
<pre><code>class UserBean extends Bean {
    protected $username, $email, location;
    public function getUsername() {
        return "User: $username";
    }
}
</code></pre>
</p>
<p>In addition, if you want cleaner syntax (i.e. when mixing PHP with your HTML), you could also access properties of the bean directly, and the getter/setter functions will be called automatically if they exist.  Since the properties are &#8220;protected&#8221;, attempts to access the properties will get routed to the __get and __set functions, where it will attempt to call a getter/setter if it exists.</p>
<p>
<pre><code>$user = new UserBean();
$user->username = 'Jim';
echo $user->username;;
</code></pre></p>
]]></content:encoded>
			<wfw:commentRss>http://www.jimyi.com/blog/2010/02/21/bean-pattern-in-php5/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>jQuery plugin: Scroll Loader</title>
		<link>http://www.jimyi.com/blog/2009/10/22/jquery-plugin-scroll-loader/</link>
		<comments>http://www.jimyi.com/blog/2009/10/22/jquery-plugin-scroll-loader/#comments</comments>
		<pubDate>Thu, 22 Oct 2009 04:35:57 +0000</pubDate>
		<dc:creator>Jim</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.jimyi.com/?p=52</guid>
		<description><![CDATA[Overview
Load extra content when the user scrolls the window or an element towards the bottom.  This is probably most useful when you want to use Ajax to load the extra content.
Syntax

$(element).scrollLoader(options);

Options
ratio (optional &#8211; default: .05): How close to the scrollbar is to the bottom of the element before triggering a load.  Use ratio: [...]]]></description>
			<content:encoded><![CDATA[<h4>Overview</h4>
<p>Load extra content when the user scrolls the window or an element towards the bottom.  This is probably most useful when you want to use Ajax to load the extra content.</p>
<h4>Syntax</h4>
<p>
<pre><code>$(element).scrollLoader(options);</code></pre>
<p></p>
<h4>Options</h4>
<p><em>ratio (optional &#8211; default: .05):</em> How close to the scrollbar is to the bottom of the element before triggering a load.  Use ratio: 0 for absolute bottom.<br />Ratio = (total scroll height &#8211; current scroll position) / total scroll height.</p>
<p><em>loadContent (required):</em> Function to execute when the scrollbar reaches the specified ratio.</p>
<h4>Available Triggers</h4>
<p>
<pre><code>$(element).trigger("enableLoad"); // enables this plugin

$(element).trigger("disableLoad"); // disables this plugin

$(element).trigger("manualLoad"); // manually trigger the loadContent function</code></pre>
<p></p>
<h4>Example Usage</h4>
<p>
<pre><code>var offset = 2;
$(document).ready(function() {
  $(window).scrollLoader({
    loadContent: function() {
      $("#news_list").append("&lt;li&gt;Loading...&lt;/li&gt;");
      // since this ajax call might take a while
      $(window).trigger("disableLoad");
      $.getJSON("/news/list?offset=" + offset++, function(data) {
        // remove the loading text
        $("#news_list li:last").remove();
        for (var i = 0; i < data.news.length; i++) {
          $("#news_list").append("&lt;li&gt;" + data.news[i].headline + "&lt;/li&gt;");
        }
        // now that the ajax call is done, we can re-enable this
        $(window).trigger("enableLoad");
      });
    }
  });
});</code></pre>
<p></p>
<p><a href="/content/scroll_loader/scroll_loader.html">Demo</a> - scrollLoader bound to both the window and an element with overflow: auto<br />
<a href="/content/scroll_loader/jquery.scroll.loader.js">Download - jquery.scroll.loader.js</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.jimyi.com/blog/2009/10/22/jquery-plugin-scroll-loader/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>jqModal IE7 Black Flicker Bug</title>
		<link>http://www.jimyi.com/blog/2009/10/18/jqmodal-ie7-black-flicker-bug/</link>
		<comments>http://www.jimyi.com/blog/2009/10/18/jqmodal-ie7-black-flicker-bug/#comments</comments>
		<pubDate>Sun, 18 Oct 2009 04:33:21 +0000</pubDate>
		<dc:creator>Jim</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.jimyi.com/?p=41</guid>
		<description><![CDATA[jqModal r14 has an odd bug that only occurs on IE7 only, where the screen will flicker black before displaying the modal window.  This only happens when you use the options modal: true and overlayClass. I did some digging through the source and found a quick workaround &#8211; change line 41 from:
if(c.modal) {if(!A[0])L('bind');A.push(s);}
to
if(c.modal) {A.push(s);}
Or just [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://dev.iceburg.net/jquery/jqModal/">jqModal</a> r14 has an odd bug that only occurs on IE7 only, where the screen will flicker black before displaying the modal window.  This only happens when you use the options <strong><code>modal: true</code></strong> and <strong><code>overlayClass</code></strong>. I did some digging through the source and found a quick workaround &#8211; change line 41 from:</p>
<pre><code>if(c.modal) {if(!A[0])L('bind');A.push(s);}</code></pre>
<p>to</p>
<pre><code>if(c.modal) {A.push(s);}</code></pre>
<p>Or just get the updated file <a href="/content/jqmodal/jqModal.ie7fix.js">here</a>.</p>
<p>Since jqModal&#8217;s source is minified, I&#8217;m not 100% sure what the removed piece of code was meant to do, but from what I&#8217;ve tested, the behavior is still the same.</p>
<p>Quick demos are here:</p>
<ul>
<li><a href="/content/jqmodal/flicker.html">IE7 Flicker</a></li>
<li><a href="/content/jqmodal/noflicker.html">No more flicker!</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.jimyi.com/blog/2009/10/18/jqmodal-ie7-black-flicker-bug/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>New Site: Delete Your Account</title>
		<link>http://www.jimyi.com/blog/2009/06/24/new-site-delete-your-account/</link>
		<comments>http://www.jimyi.com/blog/2009/06/24/new-site-delete-your-account/#comments</comments>
		<pubDate>Thu, 25 Jun 2009 00:21:32 +0000</pubDate>
		<dc:creator>Jim</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.jimyi.com/?p=11</guid>
		<description><![CDATA[Just launched a new site: Delete Your Account
Description: Information on how to delete your account from all of the major social networking, blogging, shopping, etc. sites and services across the web.
]]></description>
			<content:encoded><![CDATA[<p>Just launched a new site: <a href="http://deleteyouraccount.com">Delete Your Account</a></p>
<p>Description: Information on how to delete your account from all of the major social networking, blogging, shopping, etc. sites and services across the web.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jimyi.com/blog/2009/06/24/new-site-delete-your-account/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>HTML: Tournament Brackets</title>
		<link>http://www.jimyi.com/blog/2009/04/09/html-tournament-brackets/</link>
		<comments>http://www.jimyi.com/blog/2009/04/09/html-tournament-brackets/#comments</comments>
		<pubDate>Fri, 10 Apr 2009 01:28:16 +0000</pubDate>
		<dc:creator>Jim</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.jimyi.com/?p=7</guid>
		<description><![CDATA[There&#8217;s a lack of HTML code for tournament brackets out there that don&#8217;t use tables, so I decided to go ahead and create some.  I have tested this across all major browsers.  To get an idea of how it works, start with the 4 player tournament, as it does get a little messy [...]]]></description>
			<content:encoded><![CDATA[<p>There&#8217;s a lack of HTML code for tournament brackets out there that don&#8217;t use tables, so I decided to go ahead and create some.  I have tested this across all major browsers.  To get an idea of how it works, start with the 4 player tournament, as it does get a little messy when you reach 32 players.</p>
<ul>
<li><a href="/content/brackets/bracket.css">bracket.css</a></li>
<li><a href="/content/brackets/tournament4.html">tournament4.html</a></li>
<li><a href="/content/brackets/tournament8.html">tournament8.html</a></li>
<li><a href="/content/brackets/tournament16.html">tournament16.html</a></li>
<li><a href="/content/brackets/tournament32.html">tournament32.html</a></li>
</ul>
<p></p>
<p>Free to use/steal/copy.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jimyi.com/blog/2009/04/09/html-tournament-brackets/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Equal Spaced Objects with CSS</title>
		<link>http://www.jimyi.com/blog/2009/04/04/equal-spaced-objects-with-css/</link>
		<comments>http://www.jimyi.com/blog/2009/04/04/equal-spaced-objects-with-css/#comments</comments>
		<pubDate>Sun, 05 Apr 2009 02:41:45 +0000</pubDate>
		<dc:creator>Jim</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.jimyi.com/?p=3</guid>
		<description><![CDATA[
After I read this article on Smashing Magazine (also CSS-Tricks), I didn&#8217;t really find any of those solutions acceptable since they require extra markup.  I want to be able to have objects equal spaced just using code like this:
  &#60;div id="container"&#62;
    &#60;img src="circle1.png" alt="" /&#62;
    &#60;img src="circle2.png" [...]]]></description>
			<content:encoded><![CDATA[<p class="centered"><img src="/content/equalspace/equal_spaced.png" alt="Equally Spaced Objects" /></p>
<p>After I read this <a href="http://www.smashingmagazine.com/2009/03/23/ask-sm-equal-spacing-css-image-replacement-max-side-on-images/">article on Smashing Magazine</a> (also <a href="http://css-tricks.com/equidistant-objects-with-css/">CSS-Tricks</a>), I didn&#8217;t really find any of those solutions acceptable since they require extra markup.<span id="more-3"></span>  I want to be able to have objects equal spaced just using code like this:</p>
<pre><code>  &lt;div id="container"&gt;
    &lt;img src="circle1.png" alt="" /&gt;
    &lt;img src="circle2.png" alt="" /&gt;

    &lt;img src="circle3.png" alt="" /&gt;
    &lt;img src="circle4.png" alt="" /&gt;
  &lt;/div&gt;</code></pre>
<p></p>
<p>Using the property text-align: justify by itself will not work because the last line of paragraphs aren&#8217;t justified &#8211; so when you have only one line, justification does nothing. With CSS3, there&#8217;s a property called <a href="http://www.css3.com/css-text-justify/">text-justify</a> that lets you specify how you want the text justified.  Using text-justify: distribute-all-lines, the last line of a paragraph will be justified.  So with the following CSS applied to the &#8220;container&#8221; above, we can achieve equal spacing objects.</p>
<pre><code>  #container {
    text-align: justify;
    text-justify: distribute-all-lines;
  }</code></pre>
<p></p>
<p>The only problem: since text-justify is a part of CSS3, support for it isn&#8217;t widely available.  This won&#8217;t work on Firefox 3.0.8, Opera 9.64, Safari 3.2.2, and Google Chrome.  The browsers that it does work on: Internet Explorer 5.5, 6, and 7 (I don&#8217;t have 8 installed to try).</p>
<p><a href="/content/equalspace/">Live demo here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jimyi.com/blog/2009/04/04/equal-spaced-objects-with-css/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Phillies celebration a week ago</title>
		<link>http://www.jimyi.com/blog/2008/11/07/phillies-celebration-a-week-ago/</link>
		<comments>http://www.jimyi.com/blog/2008/11/07/phillies-celebration-a-week-ago/#comments</comments>
		<pubDate>Sat, 08 Nov 2008 00:55:52 +0000</pubDate>
		<dc:creator>Jim</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.jimyi.com/?p=36</guid>
		<description><![CDATA[Pretty crazy night on Broad Street after winning the World Series.
&#160;&#160;
flickr photo set
]]></description>
			<content:encoded><![CDATA[<p>Pretty crazy night on Broad Street after winning the World Series.</p>
<p><a href="http://www.flickr.com/photos/jimyi/2985177585/"><img src="http://farm4.static.flickr.com/3167/2985177585_b9a23c5dd4_m.jpg" width="240" height="180" alt="climbing a building" /></a>&nbsp;&nbsp;<a href="http://www.flickr.com/photos/jimyi/2985174637/"><img src="http://farm4.static.flickr.com/3024/2985174637_24078d1e49_m.jpg" width="180" height="240" alt="street light" /></a></p>
<p><a href="http://www.flickr.com/photos/jimyi/sets/72157608491768810/">flickr photo set</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.jimyi.com/blog/2008/11/07/phillies-celebration-a-week-ago/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
