<?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>Jonathan Wijaya Loe&#039;s blog &#187; how to</title>
	<atom:link href="http://blog.jloe.net/tag/how-to/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.jloe.net</link>
	<description>A blog about technology blogging, tips and tricks, troubleshooting, and step by step tutorial with specialties in Microsoft .NET, C#, Zend, and PHP. Also includes wonderful and inspiring stories and jokes.</description>
	<lastBuildDate>Mon, 02 May 2011 00:05:10 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Image Manipulation in PHP</title>
		<link>http://blog.jloe.net/2009/06/22/image-manipulation-in-php/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=image-manipulation-in-php</link>
		<comments>http://blog.jloe.net/2009/06/22/image-manipulation-in-php/#comments</comments>
		<pubDate>Mon, 22 Jun 2009 08:49:17 +0000</pubDate>
		<dc:creator>Jonathan Loe</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[gd]]></category>
		<category><![CDATA[how to]]></category>
		<category><![CDATA[image manipulation]]></category>
		<category><![CDATA[image processing]]></category>
		<category><![CDATA[imagemagick]]></category>
		<category><![CDATA[imagick]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[php_gd2]]></category>
		<category><![CDATA[php_imagick]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[wampserver]]></category>
		<category><![CDATA[zend]]></category>

		<guid isPermaLink="false">http://blog.jloe.net/?p=665</guid>
		<description><![CDATA[Sometimes there is a need to do simple image manipulation for certain web projects. Take for example a popular site called Flickr. Flickr is an image hosting site that allows online community to store pictures for others to view. And for some cases some uploaders may have big image files and hence a site like [...]]]></description>
			<content:encoded><![CDATA[<p>Sometimes there is a need to do simple image manipulation for certain web projects. Take for example a popular site called <a title="Click to go to Flickr" href="http://www.flickr.com/" target="_blank">Flickr</a>. Flickr is an image hosting site that allows online community to store pictures for others to view. And for some cases some uploaders may have big image files and hence a site like Flickr definitely needs some image processing to reduce the actual image into a smaller dimension, hence smaller file size, to allow quick view before actually downloading the actual size.</p>
<p>I&#8217;ve been working with <a title="Click to check about Zend Framework" href="http://framework.zend.com/" target="_blank">Zend Framework</a> quite sometime for web projects. I found it&#8217;s quite interesting to find that Zend Framework does not have any class to perform image manipulation even though a proposal for Zend_Image had been submitted to Zend community as a wrapper of existing PHP interfaces: <a title="Click to read more about GD." href="http://www.boutell.com/gd/" target="_blank">GD</a> and <a title="Click here to read about ImageMagick" href="http://www.imagemagick.org/" target="_blank">ImageMagick</a> but unfortunately <a title="Zend_Image proposal" href="http://framework.zend.com/wiki/display/ZFPROP/Zend_Image+Proposal+-+Davey+Shafik" target="_blank">the proposal</a> was not considered.</p>
<p><!--adsense#az-edeal-->And for your information, GD which stands for &#8216;Gif Draw&#8217; is a standard PHP installation, unlike ImageMagick. If you wish to utilize these libraries, you need to have php extensions called php_gd2 and php_imagick respectively installed and enabled on the web server.</p>
<p>The noticeable difference between GD and ImageMagick is that GD simply does not support image format like <a title="Click to check more about TIFF" href="http://en.wikipedia.org/wiki/Tagged_Image_File_Format" target="_blank">TIFF</a> (Tagged Image File Format). If TIFF is not your issue then go for GD. And if you wish to make your development easier, you may be interested to use <a title="Click to download Thumbnail class" href="http://www.ajaxray.com/blog/2008/09/12/image-manipulation-in-zend-framework-with-php-thumbnailer-class-v20/" target="_blank">Thumbnail class</a> by our fellow developer. But if you&#8217;re looking into ImageMagick I&#8217;m going to show you the steps (from <a title="Click here to see the original post." href="http://sg.php.net/manual/en/imagick.setup.php" target="_blank">another site</a>) on how to install ImageMagick on your Windows web server as Windows installation is a bit tricky since &#8220;pecl install imagick&#8221; does NOT work properly.</p>
<ol>
<li>Download and install ImageMagick software from <a href="http://www.imagemagick.org/script/binary-releases.php#windows" target="_blank">http://www.imagemagick.org/script/binary-releases.php#windows</a>.</li>
<li>Download pecl-5.2-dev.zip (choose the version relevant to your PHP) from <a href="http://snaps.php.net/win32/" target="_blank">http://snaps.php.net/win32/</a></li>
<li>Copy php_imagick.dll from the archive you&#8217;ve downloaded to your PHP extension folder.</li>
<li>Add the following line to php.ini (in the extensions section):<br />
extension=php_imagick.dll</p>
<p>or on <a href="http://www.wampserver.com/en/" target="_blank" title="Click to go to WampServer official site">WampServer</a> click WampServer icon on taskbar, go to PHP &gt; php.ini and add the above entry.</li>
<li>Restart your server.</li>
<li>Try this example script below to verify your installation.
<pre name="code" class="php">header('Content-type: image/tif');

$image = new Imagick('example.tif');
// Create thumbnail for the specified image file.
$image-&gt;thumbnailImage(100, 0);

echo $image;</pre>
<p>The script should display the image thumbnail with a maximum width of 100 pixels.</li>
</ol>
<p>If you find the above steps are difficult to follow you may want to download php_imagick.dll <a title="Click to download" href="../wp-content/uploads/2009/06/php_imagick.zip">here</a> and start from step 3. And if you need help with these libraries, check the manual pages for <a title="Click to see the manual page." href="http://us3.php.net/manual/en/ref.image.php" target="_blank">GD</a> and <a title="Click to see the manual page." href="http://us3.php.net/manual/en/book.imagick.php" target="_blank">ImageMagick</a>.</p>
<p>Lastly if you find this post helpful, kindly leave your rating below to indicate that this post is really useful and at the same time let others know about this post. And if your wish to let other communities know about this post kindly click the sociable icons below. Thanks!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.jloe.net/2009/06/22/image-manipulation-in-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Web Performance Best Practices</title>
		<link>http://blog.jloe.net/2009/06/15/web-performance-best-practices/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=web-performance-best-practices</link>
		<comments>http://blog.jloe.net/2009/06/15/web-performance-best-practices/#comments</comments>
		<pubDate>Mon, 15 Jun 2009 07:29:56 +0000</pubDate>
		<dc:creator>Jonathan Loe</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[best practices]]></category>
		<category><![CDATA[firefox add-on]]></category>
		<category><![CDATA[how to]]></category>
		<category><![CDATA[page speed]]></category>
		<category><![CDATA[performance]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[web performance]]></category>
		<category><![CDATA[website]]></category>

		<guid isPermaLink="false">http://blog.jloe.net/?p=621</guid>
		<description><![CDATA[Following-up my previous post on how to increase site performance. I received an email from my lead about a Firefox add-on named &#8220;Page Speed&#8221; that helps analyze a site performance. In brief, Page Speed is an open-source Firefox/Firebug Add-on. Webmasters and web developers can use Page Speed to evaluate the performance of their web pages [...]]]></description>
			<content:encoded><![CDATA[<p>Following-up <a href="http://blog.jloe.net/2009/05/28/one-cent-tips-to-increase-site-performance/">my previous post</a> on how to increase site performance. I received an email from my lead about a Firefox add-on named &#8220;Page Speed&#8221; that helps analyze a site performance.</p>
<p>In brief, <a href="http://code.google.com/speed/page-speed/">Page Speed</a> is an open-source Firefox/Firebug Add-on. Webmasters and web developers can use Page Speed to evaluate the performance of their web pages and to get suggestions on how to improve them.</p>
<p>Page Speed works by performing several tests on a site&#8217;s web server configuration and front-end code. These tests are based on a set of best practices known to enhance web page performance. Webmasters who run Page Speed on their pages get a set of scores for each page, as well as helpful suggestions on how to improve its performance.</p>
<p>But that&#8217;s not all, the good stuff is its article <a href="http://code.google.com/speed/page-speed/docs/rules_intro.html">&#8220;Performance Best Practices&#8221;</a> which explains in detail all aspects on what needs to be done to improve your site: from network (DNS, server settings) to browser layer (CSS, JavaScript, image, compression) which extends <a href="http://blog.jloe.net/2009/05/28/one-cent-tips-to-increase-site-performance/">my previous post</a> in greater detail.</p>
<p><!--adsense#co-1-->However these best practices may not be the complete solutions, in my opinion. If your site deals with dynamic content, there should be programming logic behind the content. This means whoever creates the logic has to utilize the best logic for highest efficiency in terms of computation. And if your site deals with a database, optimizing the queries to the designated database is also required.</p>
<p>Ultimately basic rules for programming are to avoid redundancy and to distribute computation load whenever possible.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.jloe.net/2009/06/15/web-performance-best-practices/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>One-Cent Tips to Increase Site Performance</title>
		<link>http://blog.jloe.net/2009/05/28/one-cent-tips-to-increase-site-performance/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=one-cent-tips-to-increase-site-performance</link>
		<comments>http://blog.jloe.net/2009/05/28/one-cent-tips-to-increase-site-performance/#comments</comments>
		<pubDate>Wed, 27 May 2009 18:35:44 +0000</pubDate>
		<dc:creator>Jonathan Loe</dc:creator>
				<category><![CDATA[Web]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[blog]]></category>
		<category><![CDATA[how to]]></category>
		<category><![CDATA[increase performance]]></category>
		<category><![CDATA[performance]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[ways]]></category>
		<category><![CDATA[website]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://blog.jloe.net/?p=595</guid>
		<description><![CDATA[Experience a spike in usage on your hosting server? Well, my old friend does as he highlighted in his recent post about his decision in switching his theme to a simple one: one that he presumed doesn't chew up a lot of resources from his shared hosting server ;). So here's just my little thought or sharing tips on how to increase your web site or blog site performance for better user experience.]]></description>
			<content:encoded><![CDATA[<p><!--TOC--><br />
<h2>Foreword</h2>
<p>Experience a spike in usage on your hosting server? Well, my old friend does as he highlighted in <a title="Check his post" href="http://www.michaelaulia.com/blogs/switching-to-a-simpler-theme-temporarily.html" target="_blank">his recent post about his decision in switching his theme to a simple one</a>: one that he presumed doesn&#8217;t chew up a lot of resources from his shared hosting server <img src='http://blog.jloe.net/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> . So here&#8217;s just my little thought or sharing tips on how to increase your web site or blog site performance for better user experience.</p>
<h2>My One Cent</h2>
<p>There are few factors in order to achieve this, namely</p>
<h3>Server Reliability</h3>
<p>Personally I think your hosting server reliability is the foremost element to increase site performance, namely server up-time and connectivity. Essentially without a reliable hosting server, the tips below will not have much impact or in other words pretty useless. Well I highly welcome your input on list of reliable hosting servers to use. <img src='http://blog.jloe.net/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<h3>Small File Size</h3>
<p>Reduce as much as possible the size of the files used for your site: HTML, JavaScript, CSS, and image files in order to save network bandwidth. As a result, your page loads faster.</p>
<h4>For HTML and JavaScript</h4>
<p>I guess the answer is simple: eliminate white characters (spaces and new line characters) present in the file. One drawback of course, it will be difficult to debug your HTML or JavaScript. Well you can easily solve this by maintaining your friendly JavaScript for your debug purpose and dedicate a &#8220;compressed&#8221; one for production.</p>
<h4>For CSS</h4>
<p>The similar approach as the former. However I found some CSS can be quite bloated or in other words huge in size for some reason. And it is more likely that there are a lot of redundancies. If the former case is true, try <a title="Read more about CSS Framework" href="http://en.wikipedia.org/wiki/CSS_framework" target="_blank">CSS Framework</a> as your foundation/start in creating your style-sheet.</p>
<h4>For Image file</h4>
<p>Choose the best compression format (GIF, JPG, or PNG) that is suitable for your images and its purpose. Check <a title="Read more about image format." href="http://snook.ca/archives/design/which_image_for/" target="_blank">this post</a> to find out more about the advantage and disadvantage of the individual format.</p>
<p>If you use a WordPress blog, you may want to install a plug-in called <a title="See WP Minify" href="http://wordpress.org/extend/plugins/wp-minify/" target="_blank">WP Minify</a> but be warned of its drawback which I&#8217;m going to explain to you later.</p>
<h3>Reduce Round-trip</h3>
<p>Wonder what round trip means? Sorry but I couldn&#8217;t find a best definition for the term from google, but I found a closest one from <a title="Read more about round trip from wiki" href="http://en.wikipedia.org/wiki/Round-trip_delay_time" target="_blank">wiki</a> and <a title="Read more about round trip from answer.com" href="http://http://www.answers.com/topic/roundtrip" target="_blank">answer.com</a>. answer.com cited that a round trip is</p>
<blockquote><p>A trip from one place to another and back, usually over the same route.</p></blockquote>
<p>In Web, number of round trips is calculated based on the number of requests made by a browser before it is complete: one primary request for HTML files and subsequent requests for your JavaScript, CSS, and image files if needed. The solution is easy: use just <span style="text-decoration: underline;">one file</span> for respective file type. <img src='http://blog.jloe.net/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' />  (How&#8217;s that possible?) Na&#8230; just kidding. <img src='http://blog.jloe.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<h4>For JavaScript and CSS</h4>
<p>If you have more than one files, merge them into just one file.</p>
<h4>For Images</h4>
<p>One way is to piece those images together and create one bigger image file and use <a title="Click to read the explanation" href="http://www.w3.org/Style/CSS/" target="_blank">Cascading Style Sheet (CSS)</a> to show the respective image to the respective space on your page. <a title="Learn more about CSS background" href="http://www.w3schools.com/css/css_background.asp" target="_blank">CSS background</a> tells you how to achieve this.<br />
<!--adsense#az-edeal--><br />
<h3>Avoid Dynamic pages</h3>
<p>Nowadays dynamic pages are inevitable as web audiences are looking for more interactive web sites which serve fresh sets of information each day or even every hour. I guess here I&#8217;m not asking you to edit your HTML files for each of your post (for your blog) and I think those were the old days where page scripting had not been invented yet. <img src='http://blog.jloe.net/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> </p>
<p>Why do I say that? because dynamic pages may consume a lot of CPU power which may cause a hiccup on your hosting server. And worse if your site resides on a shared server, other sites may have to wait (or sacrifice) for your site to complete its computation.</p>
<p><a title="Read more about Caching." href="http://en.wikipedia.org/wiki/Caching" target="_blank">Caching</a> is a way to help reduce CPU consumption. Caching is a process of creating a duplication or copy of  your dynamic pages to be stored elsewhere, thus subsequent request of the same dynamic pages can be fetched from existing cache in order to prevent computation redundancy. For WordPress user, try <a title="See WP Super Cache" href="http://wordpress.org/extend/plugins/wp-super-cache/" target="_blank">WP Super Cache</a> plug-in.</p>
<p>Just a note, avoid dynamic compression of your web files to save your network bandwidth as this has its drawback: yields a high CPU usage.</p>
<h2>Lastword?</h2>
<p>Well, that&#8217;s all for the tips. Mike, if you&#8217;re reading this, I hope this can be your humble guidance in finding the best theme and plug-ins for your blog. <img src='http://blog.jloe.net/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> </p>
<p>Ciao! <img src='http://blog.jloe.net/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.jloe.net/2009/05/28/one-cent-tips-to-increase-site-performance/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Download Torrent from Web</title>
		<link>http://blog.jloe.net/2009/05/23/download-torrent-from-web/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=download-torrent-from-web</link>
		<comments>http://blog.jloe.net/2009/05/23/download-torrent-from-web/#comments</comments>
		<pubDate>Sat, 23 May 2009 05:29:40 +0000</pubDate>
		<dc:creator>Jonathan Loe</dc:creator>
				<category><![CDATA[Web]]></category>
		<category><![CDATA[bitlet]]></category>
		<category><![CDATA[how to]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[torrent]]></category>

		<guid isPermaLink="false">http://blog.jloe.net/?p=573</guid>
		<description><![CDATA[Good News! (or perhaps Old News) For torrent leechers this could be an alternative. But for those who do not like to have BitTorrent client fill up your hard disk space but still love to use torrent when needed, then BitLet is definitely the answer for you. BitLet is a cute web-based Java applet that [...]]]></description>
			<content:encoded><![CDATA[<div id="attachment_574" class="wp-caption alignleft" style="width: 149px"><a href="http://blog.jloe.net/wp-content/uploads/2009/05/bitlet-logo.jpg"><img class="size-full wp-image-574" title="BitLet.org" src="http://blog.jloe.net/wp-content/uploads/2009/05/bitlet-logo.jpg" alt="BitLet.org thumbnail" width="139" height="38" /></a><p class="wp-caption-text">BitLet.org</p></div>
<p>Good News! (or perhaps Old News) For torrent leechers this could be an alternative. But for those who do not like to have BitTorrent client fill up your hard disk space but still love to use torrent when needed, then BitLet is definitely the answer for you. <a title="Check out the site" href="http://www.bitlet.org/" target="_blank">BitLet</a> is a cute web-based Java applet that allows you to download torrent files on a computer that doesn’t have a BitTorrent client installed.</p>
<p>Downloading a torrent from this applet is simple. All that is needed is to copy the torrent URL you wish to download and paste it into a box as shown below. Or select your local .torrent and then click download torrent.</p>
<div id="attachment_575" class="wp-caption aligncenter" style="width: 628px"><a href="http://blog.jloe.net/wp-content/uploads/2009/05/bitlet-start.jpg"><img class="size-full wp-image-575" title="BitLet download" src="http://blog.jloe.net/wp-content/uploads/2009/05/bitlet-start.jpg" alt="BitLet - Type torrent url" width="618" height="99" /></a><p class="wp-caption-text">BitLet - Type torrent url</p></div>
<p>Click the download button to start torrent-ing and you will be prompted to allow downloading the applet if this is your first time using this. Simply download this and unblock the installed applet if you have active Windows Firewall. And a small dialog will pop up showing the status of the torrent.</p>
<div id="attachment_577" class="wp-caption aligncenter" style="width: 410px"><a href="http://blog.jloe.net/wp-content/uploads/2009/05/bitlet-download.jpg"><img class="size-full wp-image-577" title="BitLet - Download Status" src="http://blog.jloe.net/wp-content/uploads/2009/05/bitlet-download.jpg" alt="BitLet - Download Status" width="400" height="125" /></a><p class="wp-caption-text">BitLet - Download Status</p></div>
<p>As depicted above, most of relevant information is shown on the box: transfer rate, downloaded size, file name (shh&#8230; censored <img src='http://blog.jloe.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> ), number of current seeders, number of current leechers, and also edit your settings. But that&#8217;s not all, you can also upload your file to BitLet and share it to your friends to leech or even consume video streaming. Check out the blog <a title="Click to see more updates" href="http://blog.bitlet.org/" target="_blank">here</a> for development updates. Happy leeching! <img src='http://blog.jloe.net/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.jloe.net/2009/05/23/download-torrent-from-web/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Quick and Easy Way to Create Model Class in PHP</title>
		<link>http://blog.jloe.net/2009/05/20/quick-and-easy-way-to-create-model-class-in-php/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=quick-and-easy-way-to-create-model-class-in-php</link>
		<comments>http://blog.jloe.net/2009/05/20/quick-and-easy-way-to-create-model-class-in-php/#comments</comments>
		<pubDate>Wed, 20 May 2009 15:59:17 +0000</pubDate>
		<dc:creator>Jonathan Loe</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[how to]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[zend]]></category>

		<guid isPermaLink="false">http://blog.jloe.net/?p=511</guid>
		<description><![CDATA[Ever experienced a boring and time-consuming task where you have to create a new class for your model object: declaring list of variables and creating the getter and setter functions? &#8220;Always&#8221; is my answer. Imagine if you have a long list of variables. &#8220;Shoot! NOT AGAIN&#8221; may be the first exclamation came out from you. [...]]]></description>
			<content:encoded><![CDATA[<p>Ever experienced a boring and time-consuming task where you have to create a new class for your model object: declaring list of variables and creating the getter and setter functions? &#8220;Always&#8221; is my answer. Imagine if you have a long list of variables. &#8220;Shoot! NOT AGAIN&#8221; may be the first exclamation came out from you. And for the sake of a good software design, the creation of these functions is essential. Blessed if you have excellent <a title="Click to find out more" href="http://en.wikipedia.org/wiki/Integrated_development_environment" target="_blank">IDE</a> to generate these for you.</p>
<p>So far I&#8217;ve been working with some IDEs out there like Microsoft Visual Studio (including Express edition), Eclipse for PHP, Zend Studio, and PHP Designer, and to me Visual Studio is the most developer-friendly IDE. But this task is still repetitive to me and personally I am into the notion of DRY (Don&#8217;t Repeat Yourself).</p>
<p>Well, I finally found a way to resolve this in <strong>PHP</strong> and I&#8217;m going to share this. The code is extended based on a sample file from <a title="Click to read more." href="http://framework.zend.com/docs/quickstart" target="_blank">Zend QuickStart</a>.</p>
<pre name="code" class="php">
/**
 * This class is a helper class that allows developer to
 * create an object model easily by simply inheriting and
 * declaring their desired variables as public in the child class
 * and seamlessly creates a pair of getter and setter functions.
 */
class JLoe_Model_Object
{
  /**
   * The regular expression for get method name.
   *
   * @var string
   */
  const REGEX_GET = '/get.*/';

  /**
   * The regular expression for set method name.
   *
   * @var string
   */
  const REGEX_SET = '/set.*/';

  /**
   * Get the value of a property with method syntax.
   *
   * Map method calls to get and set the declared public variables.
   * This is used to help to create magic get and set functions seamlessly.
   *
   * @param  string $method method name
   * @param  mixed  $param  parameter values to be passed
   * @return property value or this object
   */
  public function __call( $method, $param )
  {
    // Check whether it's a get or set method, else throw exception
    if ( preg_match( self::REGEX_GET, $method ) ) {
      $isGet = true;
      $propName = str_replace( 'get', '', $method );
    }
    elseif ( preg_match( self::REGEX_SET, $method ) ) {
      $isGet = false;
      $propName = str_replace( 'set', '', $method );
    }
    else { throw new JLoe_Model_Exception( 'Invalid method' ); }

    // Check whether property name exists
    $propName = ucfirst( $propName );
    if ( ! property_exists( $this, $propName ) ) {
      throw new JLoe_Model_Exception( 'Invalid method' );
    }

    // Perform respective method call
    if ( $isGet ) { return $this-&gt;$propName; }
    else
    {
      $this-&gt;$propName = $param[0];
      return $this;
    }
  }

  /**
   * Map variable access onto the underlying method representation.
   *
   * Allow to map the variable access with the respective get method.
   *
   * @param  string $name the property name to access
   * @return mixed value depending on the underlying method called
   */
  public function __get( $name )
  {
    $method = 'get' . $name;
    if ( ('mapper' == $name) || !method_exists($this, $method) )
    {
      throw new JLoe_Model_Exception( 'Invalid property' );
    }
    return $this-&gt;$method();
  }

  /**
   * Map variable access onto the underlying method representation.
   *
   * Allow to map the variable access with the respective set method.
   *
   * @param  string $name the property name to access
   * @return instance of the inherited class
   */
  public function __set( $name, $value )
  {
    $method = 'set' . $name;
    if ( ('mapper' == $name) || !method_exists($this, $method) )
    {
      throw new JLoe_Model_Exception( 'Invalid property' );
    }
    $this-&gt;$method( $value );
  }
}
</pre>
<p>And with this, you can code your model class with just a few lines. Here goes a sample.</p>
<pre name="code" class="php">
class Quot_Model_Quote extends JLoe_Model_Object
{
  /**
   * Quote id.
   *
   * @var int
   */
  public $Id;

  /**
   * The quote
   *
   * @var string
   */
  public $Quote;

  /**
   * Tags for this quote.
   *
   * @var array
   */
  protected $_tags;
  public function getTags() { return $this-&gt;_tags; }
  public function setTags( $tags )
  {
    // Put your own logic here
    $this-&gt;_tags = $tags;
  }
}
</pre>
<p><!--adsense#co-1-->Here if you wish to allow other class to access it via its variable name, getter, or setter functions, you just need to declare the variable as public as depicted on line 8 and 15. On the other hand, if you wish to limit access to a variable, you can always declare the variable as protected and create your desired getter or setter functions associated with the variable as shown on line 22 to 27.</p>
<p>And now you may access the class as follows.</p>
<pre name="code" class="php">
$quote = new JLoe_Model_Quote();

$quote-&gt;Id   = $id;
$quote-&gt;Name = $name;
$quote-&gt;Tags = $tags;
// You may also use this
$quote
  -&gt;setId( $id )
  -&gt;setName( $name )
  -&gt;setTags( $tags )

$id   = $quote-&gt;Id;
$name = $quote-&gt;Name;
$tags = $quote-&gt;tags;
// Similar with
$id   = $quote-&gt;getId();
$name = $quote-&gt;getName();
$tags = $quote-&gt;getTags();
</pre>
<p>It&#8217;s that easy. Now I can write my model class quickly and easily for other PHP projects. Yey! <img src='http://blog.jloe.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.jloe.net/2009/05/20/quick-and-easy-way-to-create-model-class-in-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ways to Publicize Your Personal Blog</title>
		<link>http://blog.jloe.net/2009/05/13/ways-to-publicize-your-personal-blog/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=ways-to-publicize-your-personal-blog</link>
		<comments>http://blog.jloe.net/2009/05/13/ways-to-publicize-your-personal-blog/#comments</comments>
		<pubDate>Wed, 13 May 2009 06:05:44 +0000</pubDate>
		<dc:creator>Jonathan Loe</dc:creator>
				<category><![CDATA[Web]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[blog]]></category>
		<category><![CDATA[how to]]></category>
		<category><![CDATA[publicise]]></category>
		<category><![CDATA[publicize]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[wp]]></category>

		<guid isPermaLink="false">http://blog.jloe.net/?p=387</guid>
		<description><![CDATA[As a new blogger I always hope I could draw more readers to drop by my site at the same time increasing my site traffic or in marketing term increase your branding. However I realise I'll be competing with millions notable bloggers out there and this is not an easy task. Here, I believe my patience and persistence are being challenged. So, if you're up to this challenge I will share some guidance on where and how to start.]]></description>
			<content:encoded><![CDATA[<p><!--TOC--></p>
<h2>Introduction</h2>
<p>As a new blogger I always hope I could draw more readers to drop by my site at the same time increase my site traffic or in marketing term &#8220;increase your branding&#8221;. However I realise I&#8217;ll be competing with millions notable bloggers out there and this is not an easy task. Here, I believe my patience and persistence are being challenged. So, if you&#8217;re up to this challenge I will share some guidance on where and how to start. But do take note though that there is no guarantee that my guidance will definitely do the magic.</p>
<p>To start off, I believe that first you have to begin with your own blog &#8211; get yourself ready first. It&#8217;s just like constructing your home or house: first you start with building a strong foundation and thereafter you can easily stack up your block. Once you think you&#8217;re ready to go, then you start publicizing your blog with confidence.</p>
<p>I must admit these guides are not totally created by my own, instead I collated based on other sources I found, along with my own intuition. I&#8217;ve separated the guidance into two: What to prepare and How to publicize.</p>
<h2>Prepare your Blog</h2>
<h3>Timeless is Everlasting</h3>
<p>Means do write posts that will be readable in a year or more. A constructive and useful post may not immediately catch readers&#8217; attention (just as this post) but sees it in long-term view. Personally, I know that there are millions posts out there with the same topic as mine, but here I did not think of marketing this post but instead regarding this as my future reference.</p>
<h3>Create Sitemap</h3>
<p>Sitemap (or a site map), according to Wikipedia, is a list of pages of a web site accessible to crawlers or users as this helps search engine bots to find pages on your site. For WordPress user, you can easily achieve this by installing a plugin called &#8220;Google XML Sitemaps&#8221; mentioned in <a title="Most Useful WordPress Plugins" href="http://blog.jloe.net/2009/04/29/most-useful-wordpress-plugins/">other post</a>. Think of sitemap as shortcuts for search engine bots.</p>
<h3>SEO Compliant</h3>
<p>SEO stands for Search Engine Optimization. What does this mean? This means that any websites including your blog has to be SEO compliant in order for search engines out there (like Google) can easily index your pages and return your pages when people search. Again, a WordPress plugin called &#8220;All in One SEO Pack&#8221; is the magic wand.</p>
<h3>More Ping Services</h3>
<p>This may be the simplest one to do. In WordPress what you need to do is go to &#8220;Settings &gt; Writing&#8221; and look for the ping list text-area and add more ping services into the box. This is to notify the ping service providers when you published a new post. You can easily find a long list of them from Google or you may refer to my sources below.</p>
<h3>Be Opportunist</h3>
<p>As opposed to my previous point, if you think there&#8217;s a very interesting topic that may grab some-one&#8217;s attention immediately, do attempt. Short announcement may be a short-term branding selling strategy.</p>
<h3>Be Social</h3>
<p>Give social readers option to promote your post if they like it. These readers may come from other sites, like twitter, stumbleupon, digg, technorati, and alot more. In WordPress, a plugin &#8220;<a title="Check out the plugin" href="http://wordpress.org/extend/plugins/add-to-any/">Add to Any</a>&#8221; will help you fill the job for free and hassle-free. <img src='http://blog.jloe.net/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> </p>
<h3>Be Smart</h3>
<p>Don&#8217;t get me wrong here. I&#8217;m not talking about how you dress here instead how to dress your blog. Impress your readers with unexpected catch. Fortunately in WordPress you can easily fulfill this with the power of plug-ins. Kindly refer to <a title="9 Ways to Make Your WordPress Blog “Smart”" href="http://weblogtoolscollection.com/archives/2009/04/29/9-ways-to-make-your-wordpress-blog-smart/" target="_blank">this post</a> for the list.</p>
<p>OK, that&#8217;s my last point on what you need to do first with your blog. Next thing is to start to publicize your blog.</p>
<h2>Publicize your Blog</h2>
<p><!--adsense#az-edeal--></p>
<h3>Submit to Blog and RSS Directory</h3>
<p>First is to submit your blog &#8211; tell your existence. Blog and RSS directory provides a catalog of blogs or posts for readers to find on a specific topic or category. Submitting to these directories will definitely help you climb up the ladder in search engine results too because these directories may be more popular and therefore make your blog quickly recognised.</p>
<h3>Contribute</h3>
<p>Make contributions to other blog posts. Contribution doesn&#8217;t mean to dig out your pity pocket and donate, instead post your comments to the blog posts if you find it interesting and useful. Give kudos to the authors for their hard work in sharing their ideas.</p>
<h3>Be Proactive</h3>
<p>Join free Internet community out there, namely facebook, twitter, technorati, digg, stumbleupon and many more, and market your blog in your profile. These communities grows bigger and faster than you could imagine.</p>
<h3>Appreciate and Respect</h3>
<p>Appreciation and respect are what people always look out for in office, and even in your daily life. And here in cyberspace, the same rules apply. If you post a topic in your blog with sources from other blog, do include the URL to their site in your post to allow <a title="Click to find out more about pingback" href="http://en.wikipedia.org/wiki/Pingback" target="_blank">pingback</a>/<a title="Click to find out more about trackback" href="http://en.wikipedia.org/wiki/Trackback" target="_blank">trackback</a> &#8211; a way to notify the author your token of appreciation. As a result they feel encouraged and may post more stuff for your feed. <img src='http://blog.jloe.net/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<h2>My One Cent</h2>
<p>Lastly just my one cent, always think outside the box because I&#8217;m pretty sure you can do better than my above list which may be less effective as time lapses. And also keep in mind that this virtual space will always evolve, just like our life.</p>
<p>Hope you find this useful and I welcome your feedback or help me complete the list. Don&#8217;t forget to leave your rating or comment below. Thanks and Cheers! <img src='http://blog.jloe.net/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>Sources</p>
<ul>
<li><a title="Click to find out more" href="http://help.blogger.com/bin/answer.py?hl=en&amp;answer=42377" target="_blank">Promoting Your Blog &#8211; Blogger Help</a></li>
<li><a title="Click to find out more" href="http://sethgodin.typepad.com/seths_blog/2006/06/how_to_get_traf.html" target="_blank">How to get traffic for your blog</a></li>
<li><a title="Click to find out more" href="http://blogkori.com/how-to-write-an-effective-blog-description-and-keywords" target="_blank">How to write an effective blog description and keywords?</a></li>
<li><a title="Click to find out more" href="http://weblogtoolscollection.com/archives/2009/04/29/9-ways-to-make-your-wordpress-blog-smart/" target="_blank">9 Ways to Make Your WordPress Blog “Smart”</a></li>
<li><a title="Click to find out more" href="http://www.masternewmedia.org/rss/top55/" target="_blank">Best Blog Directory And RSS Submission Sites</a></li>
<li><a title="Click to find out more" href="http://www.rss-specifications.com/rss-submission.htm" target="_blank">RSS Specifications &#8211; Submit RSS feeds</a></li>
<li><a title="Click to find out more" href="http://www.prelovac.com/vladimir/wordpress-ping-list" target="_blank">WordPress Ping List</a></li>
<li><a title="Click to find out more" href="http://www.zachgraeve.com/2006/08/25/top-ping-urls-update-services/" target="_blank">Top Ping URLs &amp; Update Services</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://blog.jloe.net/2009/05/13/ways-to-publicize-your-personal-blog/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

