<?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>Winston{YW}</title>
	<atom:link href="http://www.winstonyw.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.winstonyw.com</link>
	<description>The slightly personal blog of Winston who is quite passionate about the Web</description>
	<pubDate>Thu, 28 Aug 2008 15:26:27 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6</generator>
	<language>en</language>
			<item>
		<title>DOCTYPE.. (X)HTML, Strict or Transitional?</title>
		<link>http://www.winstonyw.com/2008/08/28/doctype-xhtml-strict-or-transitional/</link>
		<comments>http://www.winstonyw.com/2008/08/28/doctype-xhtml-strict-or-transitional/#comments</comments>
		<pubDate>Thu, 28 Aug 2008 15:22:30 +0000</pubDate>
		<dc:creator>Winston</dc:creator>
		
		<category><![CDATA[Usability]]></category>

		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://www.winstonyw.com/?p=167</guid>
		<description><![CDATA[Lately, I have been reading up on DOCTYPE and (X)HTML as I felt that my knowledge of them was limited. This post is a summary and brain-dump of my readings and is not to be taken as an exhaustive documentation on the subject of DOCTYPE and (X)HTML. Do correct me if I err in any [...]]]></description>
			<content:encoded><![CDATA[<p>Lately, I have been reading up on DOCTYPE and (X)HTML as I felt that my knowledge of them was limited. This post is a summary and brain-dump of my readings and is not to be taken as an exhaustive documentation on the subject of DOCTYPE and (X)HTML. Do correct me if I err in any of the stuff mentioned below.</p>
<h3>DOCTYPE</h3>
<p>A DOCTYPE, or Document Type Declaration, defines the legal structure, elements and attributes of a web page. It is declared at the very top of every web page, and is required for browsers and validators to parse and render the document consistently and correctly.</p>
<h3>HTML vs. XHTML</h3>
<p>In the process of creating a web page, we have the choice of declaring our markup to be either HTML or XHTML. However, based on my observations, web pages nowadays are mostly declared as XHTML because XHTML, being known as a reformulation of HTML in XML, is an extension and improvement over HTML.</p>
<p>To quote the current <a href="http://www.w3.org/TR/xhtml1/" target="_blank">XHTML 1.0 Recommendation</a>:</p>
<blockquote><p>The XHTML family is the next step in the evolution of the Internet. By migrating to XHTML today, content developers can enter the XML world with all of its attendant benefits, while still remaining confident in their content&#8217;s backward and future compatibility.</p></blockquote>
<p>As XHTML conforms to the syntax of XML, XHTML pages are required to be well-formed. By enforcing well-formed rules in our markup, XHTML is more consistent to code and easier to maintain. The following are some of the more important rules of being well-formed:</p>
<ul>
<li>elements must be properly nested</li>
<li>elements and attributes must be written in lowercase</li>
<li>non-empty elements must be closed</li>
<li>empty elements are minimized as a single element and closed with a space before the trailing slash</li>
<li>images must contain alternative text</li>
<li>markup characters: &lt;, &gt;, &amp; and &quot; are escaped</li>
</ul>
<p>Being well-formed also means that XHTML is backward-compatible and can be served as HTML, using the media type: <em>text/html</em>. In fact, web servers and server-side scripting environments (PHP, Ruby etc) use this media type for content delivery, and so by default, XHTML pages are served as HTML. </p>
<p>In addition, XHTML inherits a useful feature from XML in XML namespaces. Because of this, XHTML markup can include other markup languages like MathML, SMIL, or SVG, and thus extend the basic functionality of a web document. This is semantic flexibility that isn&#8217;t available in HTML.</p>
<p>Deciding between HTML and XHTML is the easy part, but for each declaration, there are also different flavours to choose from, such as the Strict and Transitional DOCTYPE (and Frameset DOCTYPE).</p>
<h3>Strict DOCTYPE</h3>
<p>A Strict DOCTYPE enforces the separation of structure and presentation, requiring that presentational elements are shifted from markup to CSS. Using a Strict DOCTYPE also ensures that all markup are fully standards-compliant, and would only be processed by browsers in their strictest, standards-compliant mode. Ultimately, this results in the most consistent and forward compatible interpretation of the markup.</p>
<h3>Transitional DOCTYPE</h3>
<p>A Transitional DOCTYPE is used when transiting from legacy markup to modern standards, permitting the use of some deprecated elements or attributes that were common in legacy markup. This DOCTYPE is not meant to be used permanently and all markup should aim towards implementing the Strict DOCTYPE.</p>
<h3>Differences between Strict and Transitional DOCTYPE</h3>
<p>In general, most of the differences between a Strict and Transitional DOCTYPE are related to presentational elements. Listed below are some of the differences that are more likely to cause problems when migrating from Transitional to Strict DOCTYPE.</p>
<h5>Elements not allowed with Strict DOCTYPEs:</h5>
<ul>
<li>center</li>
<li>font</li>
<li>iframe</li>
<li>strike</li>
<li>u </li>
</ul>
<h5>Attributes not allowed with Strict DOCTYPEs:</h5>
<ul>
<li>align (allowed on table elements: col, colgroup, tbody, td, tfoot, th, thead, and tr)</li>
<li>language</li>
<li>background</li>
<li>bgcolor</li>
<li>border (allowed on table)</li>
<li>height (allowed on img and object)</li>
<li>hspace</li>
<li>noshade</li>
<li>nowrap</li>
<li>target</li>
<li>text</li>
<li>link</li>
<li>vlink</li>
<li>alink</li>
<li>vspace</li>
<li>width (allowed on img, object, table, col, and colgroup)</li>
</ul>
<h3>Conclusion</h3>
<p>As most of the readings point out, we should strive to use a Strict DOCTYPE for our web quality&#8217;s sake. This is because a Strict DOCTYPE promotes the separation of presentation and structure, and results in code consistency and ease of maintenance of any website. HTML 4.01 Strict or XHTML 1.0 Strict? That would depends on our requirements and application architecture. But from a <a href="http://en.wikipedia.org/wiki/Standardista" target="_blank">Web Standardista</a>&#8217;s point of view, making sure that a Strict DOCTYPE is in use is more important than anything else.</p>
<p>Note to self: I should start to transit this blog into a Strict DOCTYPE.</p>
<h5>Resources:</h5>
<ul>
<li><a href="http://www.alistapart.com/stories/doctype/" target="_blank">Fix Your Site With the Right DOCTYPE!</a></li>
<li><a href="http://www.w3.org/QA/2002/04/valid-dtd-list.html" target="_blank">Recommended Lists of DTDs</a></li>
<li><a href="http://www.w3.org/MarkUp/2004/xhtml-faq" target="_blank">HTML and XHTML Frequently Answered Questions</a></li>
<li><a href="http://codex.wordpress.org/HTML_to_XHTML" target="_blank">HTML to XHTML</a></li>
<li><a href="http://en.wikipedia.org/wiki/XHTML" target="_blank">XHTML Wikipedia</a></li>
<li><a href="http://xhtml.com/en/xhtml/serving-xhtml-as-html/" target="_blank">Serving XHTML As HTML</a></li>
<li><a href="http://www.robertnyman.com/2005/11/02/html-or-xhtml/" target="_blank">HTML or XHTML</a></li>
<li><a href="http://24ways.org/2005/transitional-vs-strict-markup" target="_blank">Transitional vs. Strict Markup</a></li>
<li><a href="http://www.zvon.org/xxl/xhtmlReference/Output/comparison.html" target="_blank">Comparison of Strict and Transitional XHTML</a></li>
<li><a href="http://www.blackwidows.co.uk/resources/tutorials/xhtml/attribute-comparison.php" target="_blank">XHTML1.0 Element Attributes by DTD</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.winstonyw.com/2008/08/28/doctype-xhtml-strict-or-transitional/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Create a Digg-Like Delicious Count Button With JQuery</title>
		<link>http://www.winstonyw.com/2008/08/23/create-a-digg-like-delicious-count-button-with-jquery/</link>
		<comments>http://www.winstonyw.com/2008/08/23/create-a-digg-like-delicious-count-button-with-jquery/#comments</comments>
		<pubDate>Sat, 23 Aug 2008 15:57:22 +0000</pubDate>
		<dc:creator>Winston</dc:creator>
		
		<category><![CDATA[JQuery]]></category>

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

		<category><![CDATA[Web Development]]></category>

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

		<guid isPermaLink="false">http://www.winstonyw.com/?p=161</guid>
		<description><![CDATA[Background
During the conceptualization stages of Winston{YW}, I was inspired by Antonio and so, I wanted my WordPress blog to have a Delicious Count Button on each post too. Ideally, this Delicious Count Button could be used to bookmark the post in Delicious, and at the same time, display the number of times the post has [...]]]></description>
			<content:encoded><![CDATA[<h3>Background</h3>
<p>During the conceptualization stages of Winston{YW}, I was inspired by <a href="http://woork.blogspot.com" target="_blank">Antonio</a> and so, I wanted my WordPress blog to have a Delicious Count Button on each post too. Ideally, this Delicious Count Button could be used to bookmark the post in <a href="http://www.delicious.com" target="_blank">Delicious</a>, and at the same time, display the number of times the post has been bookmarked on Delicious.</p>
<p>By referring to the <a href="http://delicious.com/help/feeds" target="_blank">new Delicious API</a>, I managed to build this Delicious Count Button with JQuery, and I even styled it to match the looks of the <a href="http://digg.com/tools/integrate" target="_blank">Digg button</a>. Now, I shall go through the process of building this Delicious Count Button for your WordPress blog. See a <a href="http://www.winstonyw.com/wp-demo/create-a-digg-like-delicious-count-button-with-jquery-demo.html" target="_blank">DEMO here</a>.</p>
<h3>Step 1: The Button Image</h3>
<p>Browse to the <a href="http://digg.com/img/digg-it-tiny-submit.gif" target="_blank">image on Digg&#8217;s website</a>. &#8220;Right Click&#8221; the image, and &#8220;Save Image As&#8221;. Place the image in your theme&#8217;s IMAGES directory.</p>
<h3>Step 2: The HTML</h3>
<p>You should be familiar with <a href="http://codex.wordpress.org/The_Loop" target="_blank">The Loop in WordPress</a>. Copy this snippet of HTML into The Loop; place it where you would like to have this Delicious Count Button.</p>
<pre class="syntax-highlight:php">
&lt;div class=&quot;post_delicious&quot;&gt;
  &lt;span class=&quot;md5hash&quot;&gt;&lt;?php echo md5(get_permalink()); ?&gt;&lt;/span&gt;
  &lt;a href=&quot;http://del.icio.us/post?v=4&amp;amp;amp;amp;noui&amp;amp;amp;amp;jump=close&amp;amp;amp;amp;url=&lt;?php the_permalink() ?&gt;&amp;amp;amp;amp;title=&lt;?php echo urlencode(the_title(&#039;&#039;,&#039;&#039;,FALSE)) ?&gt;&quot; target=&quot;_blank&quot;&gt;Del.icio.us&lt;/a&gt;
&lt;/div&gt;
</pre>
<p>This snippet of code sets up a DIV that contains a SPAN and an ANCHOR. The SPAN is where the magic occurs as the content would be replaced by a count of the number of times your post has been bookmarked on Delicious through the use of JQuery. The content in the SPAN tag is actually a MD5 hash of the permalink of the post, which is used as an unique key to query the Delicious API for details of this post. The ANCHOR is a link which contains the necessary parameters, populated by the details of each post, to submit the post to Delicious.</p>
<h3>Step 3: The CSS</h3>
<p>Copy this snippet of CSS into the CSS file, which should be styles.css for most WordPress themes. This would style the DIV which you copied in Step 2, and make it look like the Digg button.</p>
<pre class="syntax-highlight:css">
.post_delicious {
  display: block;
  background: url(&quot;images/tiny-submit.gif&quot;) no-repeat top right;
  height: 20px;
  width: 85px;
  padding: 2px 45px 0px 0;
  font-family: arial, sans-serif;
  font-size: 11px;
  font-weight: bold;
  cursor: pointer;
}

  .md5hash {
    display: none;
  }

  .post_delicious a, .post_delicious a:visited {
    float: right;
    color: #444444;
    text-decoration: none;
  }

  .post_delicious a:hover {
    color: #0000000;
    text-decoration: underline;
  }
</pre>
<h3>Step 4: The JQuery Package</h3>
<p>Proceed to download the <a href="http://docs.jquery.com/Release:jQuery_1.2.6" target="_blank">latest version of JQuery</a>, or use a Google-hosted version of JQuery by reading more about it on the <a href="http://code.google.com/apis/ajaxlibs/" target="_blank">Google AJAX Libraries API</a>. Insert the link to the JQuery package in the HEAD tags of your HTML.</p>
<pre class="syntax-highlight:php">
&lt;head&gt;
  &lt;!-- Misc Stuff --&gt;
  &lt;script type=&quot;text/javascript&quot; src=&quot;&lt;directory_to&gt;/jquery-1.2.6.pack.js&quot;&gt;&lt;/script&gt;
&lt;/head&gt;
</pre>
<h3>Step 5: The JQuery Code</h3>
<p>Copy this snippet of JQuery code. Place it either in the HEAD tags of your HTML, or at the bottom of your HTML, just before the closing HTML tag.</p>
<pre class="syntax-highlight:javascript">
&lt;script type=&quot;text/javascript&quot;&gt;
$(function() {

  $.each($(&quot;span.md5hash&quot;), function () {
    var elem = $(this);
    $.ajax({ type: &quot;GET&quot;,
             dataType: &#039;jsonp&#039;,
             url: &quot;http://feeds.delicious.com/v2/json/urlinfo/&quot;+$(this).html(),
             success: function(data){
               if (data.length &gt; 0) {
                 elem.next().prepend(data[0].total_posts + &quot; &quot;);
               }
             }
          });
  });

})
&lt;/script&gt;
</pre>
<p>This is the MAGIC! Once your blog is loaded in a browser, this snippet of code scans for all the SPAN tags that has the class &#8220;md5hash&#8221;, and for each SPAN tag found (which should be one per post), it issues an AJAX request to the new Delicious API to obtain details of the post. </p>
<p>On the return of the AJAX request, the content in the SPAN tag (which is the MD5 hash of the permalink) is then replaced with a count of the number of times the post has been bookmarked on Delicious.</p>
<h3>Conclusion</h3>
<p>Finally, upload your changes and with that, you have successfully placed a Delicious Count Button on each of your posts! I hope you find this post useful, and do let me know in the comments if you have any questions or encounter any problems.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.winstonyw.com/2008/08/23/create-a-digg-like-delicious-count-button-with-jquery/feed/</wfw:commentRss>
		</item>
		<item>
		<title>A New Simple Design</title>
		<link>http://www.winstonyw.com/2008/08/11/a-new-simple-design/</link>
		<comments>http://www.winstonyw.com/2008/08/11/a-new-simple-design/#comments</comments>
		<pubDate>Sun, 10 Aug 2008 17:50:55 +0000</pubDate>
		<dc:creator>Winston</dc:creator>
		
		<category><![CDATA[Usability]]></category>

		<category><![CDATA[Web Design]]></category>

		<guid isPermaLink="false">http://www.winstonyw.com/?p=153</guid>
		<description><![CDATA[After a hiatus of nearly two years, I want to start blogging actively again. This new design is created for that purpose, as a celebration of my return to blogging. 
I have it made to be just a plain and simple blog design that&#8217;s absent of many colours or other funky design elements, as I [...]]]></description>
			<content:encoded><![CDATA[<p>After a hiatus of nearly two years, I want to start blogging actively again. This new design is created for that purpose, as a celebration of my return to blogging. </p>
<p>I have it made to be just a plain and simple blog design that&#8217;s absent of many colours or other funky design elements, as I hope that the content would eventually be the main draw. But, I also have it optimized in several aspects to make it look aesthetically pleasing (at least to me).</p>
<p><a href="http://www.winstonyw.com/uploads/winstonyw_2008.jpg" ><img class="left clear" src="http://www.winstonyw.com/uploads/winstonyw_2008.jpg" alt="New Blog Design" /></a></p>
<p>Firstly, the main fonts are 13px at least, and there&#8217;s a line height of 1.5em between the lines to make sure that paragraphs are easily readable. Secondly, for every paragraph, the number of words per line is in the range of 12-18 words which is what I understand as the optimum number of words per line. Thirdly, I am using a grid layout that further enhances readability. Last but not least, I am using dark coloured wordings on a white background which is the safest colour combination for any blog design. You may disagree with me on all the aspects I listed above, but well, those are what I believe in.</p>
<p>Anyway, I don&#8217;t call myself a designer and this blog is a culmination of inspirations I got from a number of blogs. This list is not exhaustive, but the following are the ones that I felt had the strongest influence in my new blog design:</p>
<ul>
<li><a href="http://www.subtraction.com">Subtraction</a></li>
<li><a href="http://quotedprintable.com/pages/scribbish">Scribbish Theme</a></li>
<li><a href="http://woork.blogspot.com">Woork</a></li>
<li><a href="http://ma.tt">Matt Mellenweg</a></li>
<li><a href="http://www.chrisbrogan.com">Chris Brogan</a></li>
<li><a href="http://www.problogger.com">ProBlogger</a></li>
<li><a href="http://www.readwriteweb.com">ReadWriteWeb</a></li>
<li><a href="http://www.techcrunch.com">TechCrunch</a></li>
</ul>
<p>As of this writing, this blog design is almost complete. But I am still looking to integrate <a href="http://www.friendfeed.com/winstonyw">my FriendFeed</a> into the blog. I had a look at the <a href="http://wordpress.org/extend/plugins/friendfeed-activity-widget/">FriendFeed plugin</a>, but am not extremely fond of it. So, for now I would sit on it while I brainstorm for fresh ideas on how to do the integration.</p>
<p>That&#8217;s all I have to say about my new blog design. I hope you like it as much as I do, and I welcome feedback or suggestions!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.winstonyw.com/2008/08/11/a-new-simple-design/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Getting PHP to work with MySQL</title>
		<link>http://www.winstonyw.com/2008/06/04/getting-php-to-work-with-mysql/</link>
		<comments>http://www.winstonyw.com/2008/06/04/getting-php-to-work-with-mysql/#comments</comments>
		<pubDate>Wed, 04 Jun 2008 14:11:24 +0000</pubDate>
		<dc:creator>Winston</dc:creator>
		
		<category><![CDATA[Web Development]]></category>

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

		<guid isPermaLink="false">http://www.winstonyw.com/2008/06/04/getting-lighttpd-to-work-with-mysql/</guid>
		<description><![CDATA[In my previous post, I described how to get PHP working with LightTPD on a Windows machine. But that&#8217;s not the end of the story, since what I really wanted was to get my local WordPress installation working, and the missing piece to the puzzle is to make sure that PHP is enabled for MySQL [...]]]></description>
			<content:encoded><![CDATA[<p>In my <a href="http://www.winstonyw.com/2008/05/28/installing-lighttpd-and-php-on-windows/" target="_blank">previous post</a>, I described how to get PHP working with LightTPD on a Windows machine. But that&#8217;s not the end of the story, since what I really wanted was to get my local WordPress installation working, and the missing piece to the puzzle is to make sure that PHP is enabled for MySQL use.</p>
<p>To do that, simply edit the following in the php.ini file:</p>
<ul>
<li>Load MySQL extensions from the correct directory: extension_dir = &#8220;c:\php\ext&#8221;</li>
<li>Remove the comment tag for: extension=php_mysql.dl&#8221;</li>
</ul>
<p>A simple post that&#8217;s really supposed to be appended to the previous post, but I had some problems trying to get the get the code tag working, so I prefer not to touch that post again.</p>
<p>Anyway, my WordPress is in the htdocs directory right now, waiting for me to start some serious templating.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.winstonyw.com/2008/06/04/getting-php-to-work-with-mysql/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Installing LightTPD and PHP on Windows</title>
		<link>http://www.winstonyw.com/2008/05/28/installing-lighttpd-and-php-on-windows/</link>
		<comments>http://www.winstonyw.com/2008/05/28/installing-lighttpd-and-php-on-windows/#comments</comments>
		<pubDate>Wed, 28 May 2008 14:53:27 +0000</pubDate>
		<dc:creator>Winston</dc:creator>
		
		<category><![CDATA[Web Development]]></category>

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

		<guid isPermaLink="false">http://www.winstonyw.com/2008/05/28/installing-lighttpd-and-php-on-windows/</guid>
		<description><![CDATA[This blog is in need of a makeover, and so I am trying to keep the procrastination habit at bay, practice some GTD and get started on creating a new template for it. First of all, I need a local development environment for PHP on Windows, since I am a Windows user. Previously, I would [...]]]></description>
			<content:encoded><![CDATA[<p>This blog is in need of a makeover, and so I am trying to keep the procrastination habit at bay, practice some GTD and get started on creating a new template for it. First of all, I need a local development environment for PHP on Windows, since I am a Windows user. Previously, I would have installed <a href="http://sg.php.net/install.windows" target="_blank">IIS on Windows and used it as the server for PHP</a>, but it&#8217;s always a chore trying to find my Windows CD.</p>
<p>Fortunately, I learnt about <a href="http://www.lighttpd.net/" target="_blank">LightTPD</a> recently in my work at <a href="http://www.wego.com" target="_blank">Wego</a> and how I can use it to replace IIS as the server for PHP. It&#8217;s easy installation and setup within minutes. Great! Let&#8217;s get started!</p>
<h3>1. Download and Install PHP</h3>
<p>Download PHP from <a href="http://www.php.net/downloads.php">PHP website</a>. I chose the zip package and simply unzipped it into my directory of choice: Almighty C drive! So now, it&#8217;s residing at &#8220;C:\php&#8221;.</p>
<h3>2. Download and Install LightTPD</h3>
<p>Download a Win32 version of LightTPD from the <a href="http://en.wlmp-project.net/downloads.php?cat=lighty" target="_blank">WLMP Project</a>; I chose the Setup Wizard (.exe) version.</p>
<p>Double-click on the downloaded executable to start the short installation process, during which you would specify the destination of the install. I installed mine at &#8220;C:\Program Files\LightTPD&#8221;.</p>
<h3>3. Start and Test LightTPD</h3>
<p>To start LightTPD, go to the LightTPD directory (i.e. &#8220;C:\Program Files\LightTPD&#8221;), find the file &#8220;TestMode.bat&#8221; and double-click on it. A console window would open and indicate that the server has been started.</p>
<p>To test that LightTPD is working at this moment, point your browser to http://localhost. You should see a &#8220;LightTPD Test Page&#8221;.</p>
<p>That was easy right? Now we just need to edit some configurations to make PHP work with LightTPD.</p>
<h3>4. Editing LightTPD Configurations</h3>
<p>Edit the file lighttpd-inc.conf (i.e. &#8220;C:\Program Files\LightTPD\conf\lighttpd-inc.conf&#8221;) with the following:</p>
<ul>
<li>Remove the comment tag for &#8220;mod-cgi&#8221; (Line 20)</li>
<li>Add this line (assuming that PHP was installed on C drive):
<ul>
<li>cgi.assign = ( &#8220;.php&#8221; =&gt; &#8220;C:/php/php-cgi.exe&#8221; )</li>
</ul>
</li>
</ul>
<h3>5. Editing PHP Configurations</h3>
<p>In your PHP directory, rename the file php.ini-recommended to php.ini and edit php.ini with the following:</p>
<ul>
<li>  short_open_tag = On</li>
<li>  display_errors = On</li>
<li>  doc_root = &#8220;C:\Progra~1\LightTPD\htdocs&#8221;</li>
</ul>
<h3>6. Test PHP with LightTPD</h3>
<p>To test that LightTPD now works with PHP, create a file with the following contents:</p>
<pre class="syntax-highlight:php">
&lt;?php phpinfo(); ?&gt;
</pre>
<p>Place the file in your htdocs directory (i.e. &#8220;C:\Program Files\LightTPD\htdocs&#8221;), open up your browser and browse to the page. Walaa! You should be able to see the standard phpinfo() messages.</p>
<p>There you have it! A development environment for PHP on Windows in 6 simple steps. Now, to get started on the new template..</p>
]]></content:encoded>
			<wfw:commentRss>http://www.winstonyw.com/2008/05/28/installing-lighttpd-and-php-on-windows/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Allowing Intuitive Date Range Input With Date()</title>
		<link>http://www.winstonyw.com/2008/04/09/allowing-intuitive-date-range-input-with-date/</link>
		<comments>http://www.winstonyw.com/2008/04/09/allowing-intuitive-date-range-input-with-date/#comments</comments>
		<pubDate>Wed, 09 Apr 2008 15:58:50 +0000</pubDate>
		<dc:creator>Winston</dc:creator>
		
		<category><![CDATA[Database]]></category>

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

		<guid isPermaLink="false">http://www.winstonyw.com/2008/04/09/allowing-intuitive-date-range-input-with-date/</guid>
		<description><![CDATA[For my current project, a small part of it requires that a web form be built that would request for a date range input from the user. On submit, the form would send a select statement, together with the date range input as a condition, to the underlying database, retrieve a set of results and [...]]]></description>
			<content:encoded><![CDATA[<p>For my current project, a small part of it requires that a web form be built that would request for a date range input from the user. On submit, the form would send a select statement, together with the date range input as a condition, to the underlying database, retrieve a set of results and display it. For this purpose, naturally I am using the <em>BETWEEN .. AND</em> function <a href="http://www.winstonyw.com/2008/03/17/search-by-date-or-timestamp-in-mysql/">as discussed previously</a>.</p>
<p>Recall that if you would like to return results for the month of March, you would need to have a condition like:</p>
<pre class="syntax-highlight:sql">
WHERE created_at BETWEEN &quot;2008-03-01&quot; AND &quot;2008-04-01&quot;
</pre>
<p>in which created_at is a datetime value.</p>
<p>However, the date range &#8220;2008-03-01&#8243; to &#8220;2008-04-01&#8243; is not a practical input to the web form. Intuitively, if this date range were to be entered as a form input, the user would have intended that the form returned all results between March 1st to April 1st <strong>inclusive</strong>. Instead, to return only the results between March 1st and March 31st, a more intuitive input would have been &#8220;2008-03-01&#8243; to &#8220;2008-03-31&#8243;.</p>
<p>Then how can we allow the user to key in a set of intuitive inputs (but erroneous when fed directly to the database), and at the same time return a set of correct results? To overcome this, we have two solutions:</p>
<h3>First Solution</h3>
<p>Programatically, increase the latter date by a day before constructing your <em>WHERE</em> clause in your select query. For example, we modify &#8220;2008-03-31&#8243; to become &#8220;2008-04-01&#8243; before issuing the select query to the database.</p>
<p>However, this is not an elegant solution as extraneous code is required to massage the input in order to yield the correct set of results.</p>
<h3>Second (and Better) Solution</h3>
<p>Use the <a href="http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html#function_date">DATE() function</a> to extract the date part of the datetime value, created_at, in the WHERE conditional clause:</p>
<pre class="syntax-highlight:sql">
WHERE DATE(created_at) BETWEEN &quot;2008-03-01&quot; AND &quot;2008-03-31&quot;
</pre>
<p>In this case, you are effectively only comparing the date part of the created_at value to the date range, and timestamp is completely omitted from the comparison.</p>
<p>Simple, intuitive, and yields the expected set of results.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.winstonyw.com/2008/04/09/allowing-intuitive-date-range-input-with-date/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Installing Ruby Thin Server on Windows</title>
		<link>http://www.winstonyw.com/2008/03/23/ruby-thin-server-on-windows/</link>
		<comments>http://www.winstonyw.com/2008/03/23/ruby-thin-server-on-windows/#comments</comments>
		<pubDate>Sun, 23 Mar 2008 13:07:26 +0000</pubDate>
		<dc:creator>Winston</dc:creator>
		
		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://www.winstonyw.com/2008/03/23/ruby-thin-server-on-windows/</guid>
		<description><![CDATA[For those who are on Windows, but yet wish to install Ruby Thin Server on your PC, here&#8217;s a short how-to.
Ruby Thin Server requires the following dependencies:

Rack
EventMachine

Unfortunately, the latest version of EventMachine (0.10.0 at the time of this post) is not a Win32 binary release, so it&#8217;s a hassle trying to get it installed on [...]]]></description>
			<content:encoded><![CDATA[<p>For those who are on Windows, but yet wish to install <a href="http://code.macournoyer.com/thin/">Ruby Thin Server</a> on your PC, here&#8217;s a short how-to.</p>
<p>Ruby Thin Server requires the following dependencies:</p>
<ul>
<li><a href="http://rack.rubyforge.org/">Rack</a></li>
<li><a href="http://rubyforge.org/projects/eventmachine/">EventMachine</a></li>
</ul>
<p>Unfortunately, the latest version of EventMachine (0.10.0 at the time of this post) is not a Win32 binary release, so it&#8217;s a hassle trying to get it installed on Windows. Instead, your best choice would be to download an <a href="http://rubyforge.org/frs/download.php/23665/eventmachine-win32-0.8.1.gem">earlier version of EventMachine 0.8.1</a>, which is a Win32 binary release.</p>
<p>Even though it&#8217;s an earlier version, I have not encountered any problems with it. Of course, I am using Windows only for development purposes, and not for production purposes.</p>
<p>Install each dependency by following the steps below before you install Thin.</p>
<h3>1. Install Rack.</h3>
<pre class="syntax-highlight:sh">c:\&gt; gem install rack</pre>
<h3>2. Download EventMachine 0.8.1</h3>
<p><a href="http://rubyforge.org/frs/download.php/23665/eventmachine-win32-0.8.1.gem">Download</a>. Install EventMachine locally.</p>
<pre class="syntax-highlight:sh">c:\&gt; gem install eventmachine -l</pre>
<h3>3. Install Ruby Thin Server, but ignore dependencies.</h3>
<pre class="syntax-highlight:sh">c:\&gt; gem install thin --ignore-dependencies</pre>
<p>Following these steps should install Ruby Thin Server successfully on your Windows machine.</p>
<p>Update from <a href="http://groups.google.com/group/thin-ruby/browse_thread/thread/c15b2472eb97c2ba?hl=en">Google Groups</a>:<br />
Thin has been updated to install EventMachine 0.8.1 if you are on Windows. But you can always rely on the steps above if something fails.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.winstonyw.com/2008/03/23/ruby-thin-server-on-windows/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Search by Date or Timestamp in MySQL</title>
		<link>http://www.winstonyw.com/2008/03/17/search-by-date-or-timestamp-in-mysql/</link>
		<comments>http://www.winstonyw.com/2008/03/17/search-by-date-or-timestamp-in-mysql/#comments</comments>
		<pubDate>Mon, 17 Mar 2008 15:26:28 +0000</pubDate>
		<dc:creator>Winston</dc:creator>
		
		<category><![CDATA[Database]]></category>

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

		<guid isPermaLink="false">http://www.winstonyw.com/2008/03/17/search-by-date-or-timestamp-in-mysql/</guid>
		<description><![CDATA[Lately, I have been very much involved in the developmental aspects of MySQL, and searching by date or timestamp on a very large set of data is by far the most common task that I am required to do. Due to this, I was able to refresh my knowledge on MySQL and able to pick [...]]]></description>
			<content:encoded><![CDATA[<p>Lately, I have been very much involved in the developmental aspects of MySQL, and searching by date or timestamp on a very large set of data is by far the most common task that I am required to do. Due to this, I was able to refresh my knowledge on MySQL and able to pick up some tips and tricks on working with date or timestamp in MySQL.</p>
<p>One of the <a href="http://dev.mysql.com/doc/refman/5.0/en/comparison-operators.html">helpful functions</a> I found, was <em>BETWEEN..AND&#8230;</em> Previously, if I was extracting data between two dates, e.g. all records that occurred in the month of January, I would code my query like this:</p>
<pre class="syntax-highlight:sql">
select * from table_name
where created_at &gt;= &quot;2008-01-01&quot; and created_at &lt;= &quot;2008-02-01;
</pre>
<p>However, the &#8220;greater than&#8221; and &#8220;lesser than&#8221; comparison can actually be replaced by a single function, <em>BETWEEN..AND..</em>:</p>
<pre class="syntax-highlight:sql">
select * from table_name
where created_at between &quot;2008-01-01&quot; and &quot;2008-02-01;
</pre>
<p>Do note that the first date to be specified in the query MUST be earlier than the second date, else the query would simply return an empty set. Hope you won&#8217;t repeat the same mistake as I did.. I had to spend like 15 minutes looking at the query before I discovered the gruesome error.</p>
<p>In addition, if you look at the documentation, it states that:</p>
<blockquote><p>
If expr is greater than or equal to min and expr is less than or equal to max, BETWEEN returns 1, otherwise it returns 0. This is equivalent to the expression (min <= expr AND expr <= max) if all the arguments are of the same type.
</p></blockquote>
<p>Why then did I use <em>&#8220;between &#8216;2008-01-01&#8242; and &#8216;2008-02-01&#8242;&#8221;</em> to extract all information that occurred within the month of January, and not <em>&#8220;between &#8216;2008-01-01&#8242; and &#8216;2008-01-31&#8242;&#8221;</em>?</p>
<p>This is because, if the timestamp is not stated (i.e. only a date is used), MySQL automatically assumes a timestamp of <em>00:00:00</em> for the date. Hence, if I had used <em>&#8220;between &#8216;2008-01-01&#8242; and &#8216;2008-01-31&#8242;&#8221;</em>, MySQL would have changed that to <em>&#8220;between &#8216;2008-01-01 00:00:00&#8242; and &#8216;2008-01-31 00:00:00&#8242;&#8221;</em>, which clearly indicates that any record with a date of <em>2008-01-31</em> and timestamp greater than <em>00:00:00</em> would be excluded from the query. This is different from what we want, which is all the records in the month of January, 31st January inclusive.</p>
<p>Try this to verify that MySQL sets a timestamp of <em>00:00:00</em> for a date:</p>
<pre class="syntax-highlight:sql">
mysql&gt; select current_date();

+----------------+
| current_date() |
+----------------+
| 2008-03-17     |
+----------------+
1 row in set (0.00 sec)

mysql&gt; select timestamp(current_date());

+---------------------------+
| timestamp(current_date()) |
+---------------------------+
| 2008-03-17 00:00:00       |
+---------------------------+
1 row in set (0.00 sec)
</pre>
<p>Hopefully, this post has helped you to better understand how to use <em>BETWEEN..AND..</em> to query your databases. In my subsequent posts, I will look at other useful MySQL functions.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.winstonyw.com/2008/03/17/search-by-date-or-timestamp-in-mysql/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Upgrading WordPress 2.0.x to 2.3.3</title>
		<link>http://www.winstonyw.com/2008/03/01/upgrading-wordpress-20x-to-233/</link>
		<comments>http://www.winstonyw.com/2008/03/01/upgrading-wordpress-20x-to-233/#comments</comments>
		<pubDate>Sat, 01 Mar 2008 12:29:47 +0000</pubDate>
		<dc:creator>Winston</dc:creator>
		
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://www.winstonyw.com/2008/03/01/upgrading-wordpress-20x-to-233/</guid>
		<description><![CDATA[Are you having problems upgrading your WordPress to version 2.3.3?
After following through the extended steps of upgrading WordPress, I encountered the following error on trying to access /wp-admin/upgrade.php:
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, webmaster@winstonyw.com and inform them of the time [...]]]></description>
			<content:encoded><![CDATA[<p>Are you having problems upgrading your WordPress to version 2.3.3?</p>
<p>After following through the extended steps of upgrading WordPress, I encountered the following error on trying to access /wp-admin/upgrade.php:</p>
<blockquote><p>Internal Server Error</p>
<p>The server encountered an internal error or misconfiguration and was unable to complete your request.</p>
<p>Please contact the server administrator, webmaster@winstonyw.com and inform them of the time the error occurred, and anything you might have done that may have caused the error.</p>
<p>More information about this error may be available in the server error log.</p></blockquote>
<p>Searching Google and the WordPress forums gave me an answer. Simply add the following two lines to the .htaccess file which should be residing in the blog&#8217;s root directory:</p>
<pre class="syntax-highlight:bash">
php_value memory_limit 32M
php_flag zend.ze1_compatibility_mode Off
</pre>
<p>Then, I was able to execute /wp-admin/upgrade.php successfully.However, for some reason, WordPress would overwrite .htaccess during the upgrade procedure, and so the two lines would be missing again. I had to add the two lines back to the .htaccess file before my blog is able to work.</p>
<p>Now I am back in business, after forsaking this blog for more than a year!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.winstonyw.com/2008/03/01/upgrading-wordpress-20x-to-233/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Tweak: Gmail and Reader Integrator</title>
		<link>http://www.winstonyw.com/2006/11/07/tweak-gmail-and-reader-integrator/</link>
		<comments>http://www.winstonyw.com/2006/11/07/tweak-gmail-and-reader-integrator/#comments</comments>
		<pubDate>Mon, 06 Nov 2006 16:24:18 +0000</pubDate>
		<dc:creator>Winston</dc:creator>
		
		<category><![CDATA[Greasemonkey]]></category>

		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://www.winstonyw.com/2006/11/07/tweak-gmail-and-reader-integrator/</guid>
		<description><![CDATA[Editing the Sizes of the Split-Windows
Suppose you wish to edit the sizes of the split-windows for Gmail and Reader Integrator, this is possible and easy to accomplish. Follow these steps to customize the Gmail or Reader window sizes to your preference:

In Firefox, open Tools &#62; Greasemonkey &#62; Manage..
Click on &#8220;Gmail + Reader Integrator&#8221; in the [...]]]></description>
			<content:encoded><![CDATA[<h3>Editing the Sizes of the Split-Windows</h3>
<p>Suppose you wish to edit the sizes of the split-windows for <a href="http://www.winstonyw.com/2006/11/03/greasemonkey-script-gmail-and-reader-integrator/" target="_blank">Gmail and Reader Integrator</a>, this is possible and easy to accomplish. Follow these steps to customize the Gmail or Reader window sizes to your preference:</p>
<ol>
<li>In Firefox, open Tools &gt; Greasemonkey &gt; Manage..</li>
<li>Click on &#8220;Gmail + Reader Integrator&#8221; in the left panel</li>
<li>Click &#8220;Edit&#8221; button</li>
<li>Choose a text editor, preferably with &#8220;Lines Number&#8221; display</li>
<li>Go to Line 54 and 55</li>
<li>Edit the sizes (in px)</li>
</ol>
<h5>Quick Tip 1:</h5>
<p>In a 1280 x 1024 resolution, the height of an email row in Inbox is approximately 22px. Therefore, the default for &#8220;<em>GMAIL_SPLIT_HEIGHT</em>&#8221; is set as 220px which displays about 10 email rows in split-window view.</p>
<h3>Editing the Size of the Reader Window (Gmail Collapsed )</h3>
<p>By default, on collapsing the Gmail window while the Reader is open, the Reader would be resized to fill the height of a screen. Suppose you wish to further extend the height of the Reader when the Gmail window is collapsed, do the following:</p>
<ol>
<li>Search for <em>function resizeReaderFrame</em>, or Line 665</li>
<li>Change &#8220;<em>window.innerHeight - readerEmbed.offsetTop</em>&#8221; to a large value</li>
</ol>
<h5>Quick Tip 2:</h5>
<p>You can open|close the Reader window by clicking on the Reader link in the LHS navi. That link is like a &#8220;toggle&#8221; for the visibility of the Reader window.</p>
<p>Feel free to drop me a message regarding other preferred customizations?</p>
<p>Lastly, the response towards the script has been overwhelming. Thank you!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.winstonyw.com/2006/11/07/tweak-gmail-and-reader-integrator/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
