<?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>Chong's Sandbox</title>
	<atom:link href="http://chong.liamnolan.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://chong.liamnolan.com</link>
	<description></description>
	<pubDate>Sat, 30 Aug 2008 04:01:31 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.1</generator>
	<language>en</language>
			<item>
		<title>Art Fest 2008</title>
		<link>http://chong.liamnolan.com/2008/05/26/art-fest-2008/</link>
		<comments>http://chong.liamnolan.com/2008/05/26/art-fest-2008/#comments</comments>
		<pubDate>Mon, 26 May 2008 19:32:38 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Life]]></category>

		<category><![CDATA[art fest]]></category>

		<guid isPermaLink="false">http://chong.liamnolan.com/blog/2008/05/26/art-fest-2008/</guid>
		<description><![CDATA[We went to the 2008 Art Fest held in the fair park. Kids experienced things they haven't done before and they said they had lots of fun.

[YG]
]]></description>
			<content:encoded><![CDATA[<div class="YG_list">
<p>We went to the 2008 Art Fest held in the fair park. Kids experienced things they haven&#8217;t done before and they said they had lots of fun.</p>
<div class="YG_icon_slideshow"><a href="http://chong.liamnolan.com/2008/05/26/art-fest-2008/" title="Slideshow"></a></div>
</div>
<div style="clear:both;"></div>
]]></content:encoded>
			<wfw:commentRss>http://chong.liamnolan.com/2008/05/26/art-fest-2008/feed/</wfw:commentRss>
		</item>
		<item>
		<title>WP gallery</title>
		<link>http://chong.liamnolan.com/2007/09/26/plugin-gallery/</link>
		<comments>http://chong.liamnolan.com/2007/09/26/plugin-gallery/#comments</comments>
		<pubDate>Wed, 26 Sep 2007 20:04:09 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Wordpress]]></category>

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

		<guid isPermaLink="false">http://chong.liamnolan.com/blog/2007/09/26/plugin-gallery/</guid>
		<description><![CDATA[I  was searching for a simple WordPress gallery plugin but the problem was that there were so many of them.  I played some of them but  I couldn't find that meets my purpose.  Instead of testing all of them, I created yet another plugin.  My objective was:

	It should be as [...]]]></description>
			<content:encoded><![CDATA[<p>I  was searching for a simple WordPress gallery plugin but the problem was that there were so many of them.  I played some of them but  I couldn&#8217;t find that meets my purpose.  Instead of testing all of them, I created yet another plugin.  My objective was:</p>
<ol>
<li>It should be as easy as writing an article.</li>
<li>It should work with or without JS support.</li>
<li>It can be embedded into an article or a page.</li>
</ol>
<p>This plugin fulfilled my purpose so far.  Some examples are <a href="http://chong.liamnolan.com/blog/category/picture_story/" title="Gallery entries">here</a>. If you are interested, you can download it <a href="http://chong.liamnolan.com/files/etc/YG_0.1.zip" title="Download Y Gallery">here</a>. <span id="more-42"></span></p>
<p>Here is the simple howto:</p>
<ol>
<li>After writing a blurb/article, type &#91;YG&#93;.  It basically tell <a href="http://codex.wordpress.org/Filters" title="WordPress API/Filter">WP content filter</a> that this is beginning of the gallery.</li>
<li>Use WordPress&#8217; built in &#8220;Upload&#8221; form and upload some images.</li>
<li>Once images are uploaded, click &#8220;Browse&#8221; tab and select &#8220;Thumbnail&#8221; and &#8220;File&#8221; options as the image below shows.  Then, click &#8220;Send to editor&#8221; button.</li>
</ol>
<p>It will look something like this.<img src="http://chong.liamnolan.com/files/2007/09/img.jpg" alt="Using Y Gallery" align="middle" border="1" /></p>
<p>I hope this will be helpful to someone.  I will update it if there is requests.</p>
]]></content:encoded>
			<wfw:commentRss>http://chong.liamnolan.com/2007/09/26/plugin-gallery/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Some HTML &#38; JS gotchas</title>
		<link>http://chong.liamnolan.com/2007/09/05/some-html-js-gotchas/</link>
		<comments>http://chong.liamnolan.com/2007/09/05/some-html-js-gotchas/#comments</comments>
		<pubDate>Wed, 05 Sep 2007 23:35:27 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://chong.liamnolan.com/blog/2007/09/05/some-html-js-gotchas/</guid>
		<description><![CDATA[1. Mysterious padding

&#60;div style="background-color:blue;"&#62;
    &#60;img src="some_url/a.gif" alt="Header" /&#62;
&#60;/div&#62;
 
See the output results above, it creates blue padding at the bottom of the image in IE.  To fix the issue, you have to rewrite the code without a line break (mean a single line of code) or even simply add &#60;br /&#62; [...]]]></description>
			<content:encoded><![CDATA[<p>1. Mysterious padding</p>
<pre>
&lt;div style="background-color:blue;"&gt;</pre>
<pre>    &lt;img src="some_url/a.gif" alt="Header" /&gt;</pre>
<pre>&lt;/div&gt;</pre>
<p align="center"> <img src="http://chong.liamnolan.com/files/2007/09/img_ie.gif" alt="Image on IE" /><img src="http://chong.liamnolan.com/files/2007/09/img_ff.gif" alt="Image on FF" /></p>
<p>See the output results above, it creates blue padding at the bottom of the image in IE.  To fix the issue, you have to rewrite the code without a line break (mean a single line of code) or even simply add &lt;br /&gt; tag immediately after the &lt;img&gt; tag.<span id="more-39"></span></p>
<p>2. Setting an integer or string value?</p>
<pre>
&lt;script type="text/javascript"&gt;</pre>
<pre>    function moveThisElement(value){</pre>
<pre>        document.getElementById("adiv").style.top = value;

}

&lt;/script&gt;</pre>
<p>Suppose I passed the values below to moveThisElement()</p>
<table border="1" cellpadding="1" cellspacing="1" width="300">
<tr>
<th>Value</th>
<th>Works?</th>
</tr>
<tr>
<td>100 + &#8220;px&#8221;</td>
<td>Yes</td>
</tr>
<tr>
<td>100 + &#8221; px&#8221;</td>
<td>No</td>
</tr>
<tr>
<td>100</td>
<td>Yes</td>
</tr>
<tr>
<td>&#8220;100&#8243;</td>
<td>Yes</td>
</tr>
<tr>
<td>&#8220;100px&#8221;</td>
<td>Yes</td>
</tr>
</table>
<p>This little test shows that an html element&#8217;s top or left value is string.   (I confess that I wasn&#8217;t sure.) Notice if there is a space between numeric value and &#8220;px&#8221;, it won&#8217;t work in Fire Fox.  It works fine in IE and Safari though.</p>
<p>3. JS syntax error in WordPress MU versrion 1.2.3</p>
<p>In version 1.2.3 of WP MU, there is malformed JS literal notation.  It creates JS error in IE and it is really annoying.  It looks like this and the last comma should be removed.  File name is wp-content/mu-plugins/dashboardswitcher.php line #54.</p>
<pre>
    var h = $( '#blog-title' )</pre>
<pre>    .css({

        background: 'transparent url( ../wp-content/mu-plugins/bullet_arrow_down.gif ) no-repeat scroll 100% .2em;',

        padding: '0 25px 2px 5px',

        cursor: 'pointer',

        border: '1px solid #14568a'<strong>,  &lt;</strong>-- This comma

    })</pre>
]]></content:encoded>
			<wfw:commentRss>http://chong.liamnolan.com/2007/09/05/some-html-js-gotchas/feed/</wfw:commentRss>
		</item>
		<item>
		<title>What to expect when you are not expecting</title>
		<link>http://chong.liamnolan.com/2007/07/24/what-to-expect-when-you-are-not-expecting/</link>
		<comments>http://chong.liamnolan.com/2007/07/24/what-to-expect-when-you-are-not-expecting/#comments</comments>
		<pubDate>Tue, 24 Jul 2007 18:14:03 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Life]]></category>

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

		<guid isPermaLink="false">http://chong.liamnolan.com/blog/2007/07/24/what-to-expect-when-you-are-not-expecting/</guid>
		<description><![CDATA[I have had a nice surprise from my 3 year-old son.  He just turned 3 last month and people say he talks pretty well for his age.  The other day he kept misbehaving despite my gentle warnings. I said finally, "I'm gonna have to spank your butt!"  I was expecting that he [...]]]></description>
			<content:encoded><![CDATA[<p>I have had a nice surprise from my 3 year-old son.  He just turned 3 last month and people say he talks pretty well for his age.  The other day he kept misbehaving despite my gentle warnings. I said finally, &#8220;I&#8217;m gonna have to spank your butt!&#8221;  I was expecting that he calms down a bit.  He hates being spanked on his butt very much.  Who wouldn&#8217;t?</p>
<p>Instead of being intimidated by my waring, my son talked to me back in a loving tone.<span id="more-35"></span></p>
<p>&#8220;Daddy, I love you. Don&#8217;t spank my butt.&#8221;</p>
<p>You should have seen his facial expression too.  An angel counldn&#8217;t have put together such cute words.  OK, Daddy is totally out of the spanking mood.  Sorry.</p>
<p>I wasn&#8217;t expect him to say that at all.  He already knows how to put his parents through a guilt trip. Not fair, son.</p>
<p>One of my wife&#8217;s co-worker had a little surprise by SamSung recently.  He bought a SamSung&#8217;s new phone, Helio.  My wife said he was very excited about the phone as she was excite about her iPhone.  Yes, I got a little bit excited about my BlackJack(Yet another PDA phone) and first thing I did was reading its user&#8217;s manual.</p>
<p>When he opened the box, (I bet he was expecting a manual that he CAN read) something totally unexpected came out.  Here is the surprise:</p>
<p><img src="http://chong.liamnolan.com/files/2007/07/helio.gif" alt="Helio Korean manual" border="1" /></p>
<p>Can you imagine how confused this man was?  Is this a cute mistake or discrimination?  It won&#8217;t be a big deal if I got this since I&#8217;m Korean.  However, this poor man had to turn this manual to me to see if there is any cool features that he might have missed.</p>
<p>For those who happened to get the Korean Helio manual and don&#8217;t know how to read, follow this URL : <a href="http://www.helio.com/page?p=support&amp;" title="Helio Support">http://www.helio.com/page?p=support&amp;</a></p>
]]></content:encoded>
			<wfw:commentRss>http://chong.liamnolan.com/2007/07/24/what-to-expect-when-you-are-not-expecting/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Trampoline</title>
		<link>http://chong.liamnolan.com/2007/07/24/trampoline/</link>
		<comments>http://chong.liamnolan.com/2007/07/24/trampoline/#comments</comments>
		<pubDate>Tue, 24 Jul 2007 14:23:34 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Life]]></category>

		<guid isPermaLink="false">http://chong.liamnolan.com/blog/2007/07/24/trampoline/</guid>
		<description><![CDATA[Here is my boys new toy, trampoline.  When we first put them on the trampoline, they looked like a clown  trying to keep his balance on a rope.  But it didn't take too long for them to find a way to have fun on it.  It is their blessing time every [...]]]></description>
			<content:encoded><![CDATA[<p>Here is my boys new toy, trampoline.  When we first put them on the trampoline, they looked like a clown  trying to keep his balance on a rope.  But it didn&#8217;t take too long for them to find a way to have fun on it.  It is their blessing time every evening.</p>
<div style="text-align:center;"></div>
]]></content:encoded>
			<wfw:commentRss>http://chong.liamnolan.com/2007/07/24/trampoline/feed/</wfw:commentRss>
	<enclosure url="http://chong.liamnolan.com/files/2007/07/20070722_Trampoline.flv" length="1" type="video/x-flv"/>
	</item>
		<item>
		<title>Liam&#8217;s birthday</title>
		<link>http://chong.liamnolan.com/2007/07/17/liams-birthday/</link>
		<comments>http://chong.liamnolan.com/2007/07/17/liams-birthday/#comments</comments>
		<pubDate>Wed, 18 Jul 2007 02:45:48 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Story w/ Pictures]]></category>

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

		<guid isPermaLink="false">http://chong.liamnolan.com/blog/2007/07/17/liams-birthday/</guid>
		<description><![CDATA[Liam had his 3 years birthday last month.  I've been so lazy about uploading these pictures.  No more procrastination!

Mommy made the spider man cakes for the boys.  Of course, Spider man is Liam and Nolan's favorite super hero. They saw the spider man 3 movie after the small birthday party.  They [...]]]></description>
			<content:encoded><![CDATA[<div class="YG_list">
<p>Liam had his 3 years birthday last month.  I&#8217;ve been so lazy about uploading these pictures.  No more procrastination!</p>
<p>Mommy made the spider man cakes for the boys.  Of course, Spider man is Liam and Nolan&#8217;s favorite super hero. They saw the spider man 3 movie after the small birthday party.  They were so into the movie that they didn&#8217;t move a muscle during the entire movie.</p>
<p>They were so curious and happy about their super hero cake.  But, a cake is a cake to kids.  They enjoyed this cool looking cakes.  Thanks, mommy.</p>
<div class="YG_icon_slideshow"><a href="http://chong.liamnolan.com/2007/07/17/liams-birthday/" title="Slideshow"></a></div>
</div>
<div style="clear:both;"></div>
]]></content:encoded>
			<wfw:commentRss>http://chong.liamnolan.com/2007/07/17/liams-birthday/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Mouth fumble</title>
		<link>http://chong.liamnolan.com/2007/07/17/mouth-fumble/</link>
		<comments>http://chong.liamnolan.com/2007/07/17/mouth-fumble/#comments</comments>
		<pubDate>Tue, 17 Jul 2007 21:05:13 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Life]]></category>

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

		<guid isPermaLink="false">http://chong.liamnolan.com/blog/2007/07/17/mouth-fumble/</guid>
		<description><![CDATA[Have you had a day that your brain is half way asleep?  I certainly had one.  Actually I had 2 in a row.  Monday is typically a slow day.  It is as if I just walked out of a refrigerator and went to work.  You get the idea.  Although [...]]]></description>
			<content:encoded><![CDATA[<p>Have you had a day that your brain is half way asleep?  I certainly had one.  Actually I had 2 in a row.  Monday is typically a slow day.  It is as if I just walked out of a refrigerator and went to work.  You get the idea.  Although my brain was in the hibernation mode, my tummy was not.  On the way home, I pulled up at Schloztky&#8217;s drive-thru.  My wife was telling me what she wanted while I was looking at the menu.  I was placing my order with my tongue that is controlled by, so called, the Monday brain.<span id="more-16"></span></p>
<blockquote><p>Chong: Hi, I&#8217;d like to have the classic combo with a large Coke or Pepsi.</p>
<p>Schloztky guy: What kind of chips you want?</p>
<p>Wife: Oh, get the jalapeno one.</p>
<p>Chong: Huh? Ok.  Let me have the JALAPENO COOKIE.</p>
<p>Schloztky guy: Jalapeno cookie?</p>
<p>Chong: (I still didn&#8217;t realize what just came out of my mouth.) Yes, please.</p>
<p>Wife: LOL</p></blockquote>
<p><img src="http://chong.liamnolan.com/files/2007/07/jcookie.jpg" alt="Jalapeno Cookie" /></p>
<p>Dang it.  It was yesterday which was apparently Monday.  I thought my body and soul got back to the normal working mode today.  I wanted to add some sizzle to my boring Tuesday morning, so my wife and I pulled up at the Starbucks drive-thru. Our regular is the white chocolate mocha with non-fat milk and no whip cream.  Here is how you usually order that (Starbucks guy told me):</p>
<p align="center"><strong>Let me have 2 Grande, non-fat, no-whip white mochas.</strong></p>
<p>So, here goes the story.</p>
<blockquote><p> Chong: Do you want the Tall or Grande?</p>
<p>Wife: Tall is fine.</p>
<p>Chong: Let me have 2 <strong>Tall, Grande</strong> non-fat, no-whip white chocolate mocha, please.</p>
<p>Starbuck girl: I&#8217;m sorry.  What size you want?</p>
<p>Wife: LOL</p></blockquote>
<p><img src="http://chong.liamnolan.com/files/2007/07/starbucks.jpg" alt="Confusing starbucks order" /></p>
<p>It was kinda tricky order, wasn&#8217;t it?</p>
]]></content:encoded>
			<wfw:commentRss>http://chong.liamnolan.com/2007/07/17/mouth-fumble/feed/</wfw:commentRss>
		</item>
		<item>
		<title>iPhone craze</title>
		<link>http://chong.liamnolan.com/2007/07/09/iphone-craze/</link>
		<comments>http://chong.liamnolan.com/2007/07/09/iphone-craze/#comments</comments>
		<pubDate>Mon, 09 Jul 2007 21:14:18 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[IT+]]></category>

		<guid isPermaLink="false">http://chong.liamnolan.com/blog/2007/07/09/iphone-craze/</guid>
		<description><![CDATA[After a long waiting in (so called) iPhone line, my wife finally got her baby, iPhone.  She has been very excited about this pricey phone like a kid on a Christmas Eve .   I was very happy for her that she still has such a big excitement for something since I don't [...]]]></description>
			<content:encoded><![CDATA[<p>After a long waiting in (so called) iPhone line, my wife finally got her baby, iPhone.  She has been very excited about this pricey phone like a kid on a Christmas Eve .   I was very happy for her that she still has such a big excitement for something since I don&#8217;t get very excited about virtually anything.</p>
<p><img src="http://chong.liamnolan.com/files/2007/07/iphone.jpg" alt="iPhone" align="middle" /><span id="more-14"></span></p>
<p>Despite the criticism on iPhone and the fact Apple is not a cellphone manufacturing company, I think Apple did a great job.  They exceeded their sales expectation easily.  Their marketing strategy created a huge curiosity.  They kept everything secret and unveiled one at a time.  On the iPhone launching week, the Apple web site was updated every day with a secret.   My wife couldn&#8217;t stop herself from visiting Apple web site everyday.</p>
<p>I think what distinguished iPhone from others was what shipped in it.  It has Google map mashup, Cooler version of iPod and more glittered by Mac&#8217;s slick user interface.  I was happy with its unique way of activating the service through iTune.</p>
<p>Apple has advantage over other major cellphone companies in my opinion.  They have the ability and the long history of manufacturing both hardware and software.  Steve Jobs emphasized that Apple is a software company during his interview at <a title="Steve Jobs and Bill Gates together" href="http://d5.allthingsd.com/20070530/video-steve-jobs-and-bill-gates-prologue/">D5</a>. (It is funny now that he kept his mouth solid shut when asked about the iPhone.) I had a misconception that Apple was a computer manufacturing company.  Sorry, I&#8217;m a typical PC guy.</p>
<p>Apple may struggle in their new area but I think they will changed the cellphone industry.  Maybe they did at some extent.</p>
]]></content:encoded>
			<wfw:commentRss>http://chong.liamnolan.com/2007/07/09/iphone-craze/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Apache log to DB</title>
		<link>http://chong.liamnolan.com/2007/07/06/apache_log2db/</link>
		<comments>http://chong.liamnolan.com/2007/07/06/apache_log2db/#comments</comments>
		<pubDate>Fri, 06 Jul 2007 18:45:38 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Life]]></category>

		<category><![CDATA[Work-around]]></category>

		<guid isPermaLink="false">http://chong.liamnolan.com/blog/2007/07/06/apache_log2db/</guid>
		<description><![CDATA[My company used to download the Apache log file daily, parse it and then put it into the database.  A script did this but as we added more servers, it became hard to maintain.   I ran across Apache piped logs and found a way to store the log directly into DB.

This is [...]]]></description>
			<content:encoded><![CDATA[<p>My company used to download the Apache log file daily, parse it and then put it into the database.  A script did this but as we added more servers, it became hard to maintain.   I ran across <a href="http://httpd.apache.org/docs/1.3/logs.html#piped" title="Apache piped logs">Apache piped logs</a> and found a way to store the log directly into DB.<span id="more-13"></span></p>
<p>This is what the httpd.conf file looks like:</p>
<blockquote><p># Set some variables to exclude certain cases</p>
<p>SetEnvIf Remote_Addr &#8220;123\.123\.0\.11&#8243; dontlog<br />
SetEnvIf Host &#8220;donotlog.com&#8221; dontlog<br />
SetEnvIf Request_URI &#8220;\.gif|jpg|png|css|js$&#8221; dontlog<br />
SetEnvIf Request_URI &#8220;/dontlog_folder&#8221;  dontlog</p>
<p># Log data: IP bytes protocol method host file uri status session_id user_agent referrer response_time datetime cookie<br />
# delimiter  [|]</p>
<p>LogFormat &#8220;%a[|]%B[|]%H[|]%m[|]%{Host}i[|]%f[|]%U%q[|]%&gt;s[|]%{PHPSESSID}C[|]%{User-Agent}i[|]%{Referer}i[|]%D[|]%t[|]%{Cookie}i&#8221; chong</p>
<p>CustomLog &#8220;<strong>|</strong>/etc/httpd/logs/log2db.php&#8221; chong env=!dontlog<br />
CustomLog &#8220;/etc/httpd/logs/access_excluded.log&#8221; chong env=donglog</p></blockquote>
<p>Notice | in the last line.  That pipe does the magic.  This configuration will do these:</p>
<ol>
<li>It will log requesting IP, bytes, protocol and so forth as listed above. And pass that data to log2db.php file.</li>
<li>It will exclude IP address of 123.123.0.11 from being logged.</li>
<li>It will exclude donotlog.com.  This will be useful if you want to exclude certain virtual hosts.</li>
<li>it will exclude image files, style sheet and javascript file.</li>
<li>It will exclude request that contains &#8216;/dontlog_folder&#8217; directory</li>
<li>Just in case, it will log all the excluded log data into access_excluded.log file.</li>
</ol>
<p>Now, let&#8217;s create a simple script to insert these data to MySql db.</p>
<p>Create a table something like this:</p>
<blockquote>
<pre>
CREATE TABLE `log_200707` (
`id` int(11) NOT NULL auto_increment,
`ip` varchar(32) NOT NULL default '',
`bytes` int(11) NOT NULL default '0',
`protocol` varchar(32) NOT NULL default '',
`method` varchar(8) NOT NULL default '',
`host` varchar(32) NOT NULL default '',
`file` varchar(255) NOT NULL default '',
`uri` varchar(255) NOT NULL default '',
`ssid` varchar(128) NOT NULL default '',
`useragent` varchar(255) NOT NULL default '',
`referrer` varchar(255) NOT NULL default '',
`restime` int(11) NOT NULL default '0',
`datetime` datetime NOT NULL default '0000-00-00 00:00:00',
`cookie_user_tr_id` int(11) NOT NULL default '0',
PRIMARY KEY  (`id`),
KEY `host` (`host`),
KEY `cookie_user_tr_id` (`cookie_user_tr_id`)
) TYPE=MyISAM;</pre>
</blockquote>
<p>Finally, here is a code snippet of log2db.php script:</p>
<blockquote>
<pre>#!/usr/bin/php</pre>
<pre>&lt;?php</pre>
<p>$fp = @fopen(&#8217;php://stdin&#8217;, &#8216;r&#8217;);<br />
$line = @fgets($fp, 1024);</p>
<p>$data = explode(&#8217;[|]&#8216;, $line);<br />
if( 13 &gt; count($data) ) exit(&#8217;Insufficient data. Check the log data&#8217;);</p>
<p>$link = mysql_pconnect(&#8217;123.123.0.000&#8242;, &#8216;weblog&#8217;, &#8216;password&#8217;);<br />
if( ! $link ) exit(&#8217;DB connection failed&#8217;);</p>
<p>$db = mysql_select_db(&#8217;weblog&#8217;, $link);</p>
<p>$table = &#8216;log_&#8217; . date(&#8217;Ym&#8217;);</p>
<p>// Our case, we needed to capture user tracking id</p>
<p>$cookie = &#8221;;</p>
<p>if( $data[13] != &#8221; &amp;&amp; strpos($data[13], &#8216;user_trk_id&#8217;) !== false ) {<br />
preg_match(&#8217;/user_trk_id=(d+)/&#8217;, $data[13], $match);<br />
$cookie = $match[1];<br />
}</p>
<p>// You may add a query to create a table.  Monthly table is suffice for us.  We decided to pre-create tables for better performance</p>
<p>$qry = &#8216;INSERT INTO &#8216; . $table .<br />
&#8216;(ip, bytes, protocol, method, host, file, uri, status, ssid, useragent, referrer, restime, datetime, ut_uid)&#8217; .<br />
&#8216; VALUES (&#8221; . $data[0] . &#8221;, &#8221; . $data[1] . &#8221;, &#8221; . $data[2] . &#8221;, &#8221; . $data[3] . &#8221;, &#8221; . $data[4] . &#8221;, &#8221; . $data[5] . &#8221;, &#8221; . $data[6] . &#8221;, &#8221; . $data[7] . &#8221;, &#8221; . $data[8] . &#8221;, &#8221; . $data[9] . &#8221;, &#8221; . $data[10] . &#8221;, &#8221; . $data[11] . &#8221;, NOW(), &#8221;. $cookie .&#8221;)&#8217;;</p>
<p>$rs = mysql_unbuffered_query($qry, $link);</p>
<p>?&gt;</p></blockquote>
<p>You may implement this per-domain basis usting VirtualHost setting or be fancy with DB part but you get the idea.   Another nagging headache has gone.</p>
<p>*Updated</p>
<p>1. Make sure logging PHP script&#8217;s permission. It should be executable by web server.</p>
<p>2. The script should live as long as http request. Imagine, a request to a URI can contain multiple files that needs to be logged. Implement while statement and make sure the script doesn&#8217;t miss out anything.</p>
]]></content:encoded>
			<wfw:commentRss>http://chong.liamnolan.com/2007/07/06/apache_log2db/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Mom&#8217;s visit</title>
		<link>http://chong.liamnolan.com/2007/07/01/moms-visit/</link>
		<comments>http://chong.liamnolan.com/2007/07/01/moms-visit/#comments</comments>
		<pubDate>Sun, 01 Jul 2007 15:15:20 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Life]]></category>

		<category><![CDATA[Story w/ Pictures]]></category>

		<guid isPermaLink="false">http://chong.liamnolan.com/blog/2007/07/01/moms-visit/</guid>
		<description><![CDATA[My mom visited us for a month. It was her second visit this year. In January, she only stayed for 2 weeks due to her illness. Her health condition got better this time. She was very excited to see her grand children again. She wasn't be able to do much during the previous short trip [...]]]></description>
			<content:encoded><![CDATA[<div class="YG_list">
<p>My mom visited us for a month. It was her second visit this year. In January, she only stayed for 2 weeks due to her illness. Her health condition got better this time. She was very excited to see her grand children again. She wasn&#8217;t be able to do much during the previous short trip so she had lots of plans this time. My best benefit from her visit was that I had Korean food every day. I didn&#8217;t realized how much I missed the Korean food.</p>
<p>I try not to regret on anything that is a part of the past but this time I couldn&#8217;t help thinking &#8220;I should&#8217;ve taken more pictures.&#8221; I will take a lot of pictures when we visit her next year.</p>
<div class="YG_icon_slideshow"><a href="http://chong.liamnolan.com/2007/07/01/moms-visit/" title="Slideshow"></a></div>
</div>
<div style="clear:both;"></div>
]]></content:encoded>
			<wfw:commentRss>http://chong.liamnolan.com/2007/07/01/moms-visit/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
