<?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>Brian Chan&#039;s blog</title>
	<atom:link href="http://birdchan.com/home/feed/" rel="self" type="application/rss+xml" />
	<link>http://birdchan.com/home</link>
	<description>Birds of a feather flock together</description>
	<lastBuildDate>Sat, 04 Feb 2012 00:11:31 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>To disable form fields in jquery</title>
		<link>http://birdchan.com/home/2012/02/03/to-disable-form-fields-in-jquery/</link>
		<comments>http://birdchan.com/home/2012/02/03/to-disable-form-fields-in-jquery/#comments</comments>
		<pubDate>Sat, 04 Feb 2012 00:11:31 +0000</pubDate>
		<dc:creator>Brian</dc:creator>
				<category><![CDATA[technology]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://birdchan.com/home/?p=2605</guid>
		<description><![CDATA[I don&#8217;t think the current jquery syntax to enable/disable form elements is intuitive. But here it is:

?View Code JQUERY1
2
$(&#34;#my_element&#34;).attr(&#34;disabled&#34;, &#34;disabled&#34;);  // to disable
$(&#34;#my_element&#34;).removeAttr(&#34;disabled&#34;);  // to enable

]]></description>
			<content:encoded><![CDATA[<p>I don&#8217;t think the current jquery syntax to enable/disable form elements is intuitive. But here it is:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p2605code2'); return false;">View Code</a> JQUERY</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p26052"><td class="line_numbers"><pre>1
2
</pre></td><td class="code" id="p2605code2"><pre class="jquery" style="font-family:monospace;">$(&quot;#my_element&quot;).attr(&quot;disabled&quot;, &quot;disabled&quot;);  // to disable
$(&quot;#my_element&quot;).removeAttr(&quot;disabled&quot;);  // to enable</pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://birdchan.com/home/2012/02/03/to-disable-form-fields-in-jquery/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Steve Jobs &#8211; 2007 iPhone Presentation</title>
		<link>http://birdchan.com/home/2012/02/03/steve-jobs-2007-iphone-presentation/</link>
		<comments>http://birdchan.com/home/2012/02/03/steve-jobs-2007-iphone-presentation/#comments</comments>
		<pubDate>Fri, 03 Feb 2012 08:08:52 +0000</pubDate>
		<dc:creator>Brian</dc:creator>
				<category><![CDATA[technology]]></category>
		<category><![CDATA[video]]></category>

		<guid isPermaLink="false">http://birdchan.com/home/?p=2600</guid>
		<description><![CDATA[
I don&#8217;t know what brought me to this video, but I am just amazed that things which I do on my iphone everyday were a major breakthrough in 2007. In just 5 years of time, iphone has become part of our lives. It&#8217;s very hard to imagine if I don&#8217;t have google map on my [...]]]></description>
			<content:encoded><![CDATA[<p><iframe width="640" height="360" src="http://www.youtube.com/embed/6uW-E496FXg" frameborder="0" allowfullscreen></iframe></p>
<p>I don&#8217;t know what brought me to this video, but I am just amazed that things which I do on my iphone everyday were a major breakthrough in 2007. In just 5 years of time, iphone has become part of our lives. It&#8217;s very hard to imagine if I don&#8217;t have google map on my phone these days, would I print out the driving directions instead? Um&#8230; </p>
]]></content:encoded>
			<wfw:commentRss>http://birdchan.com/home/2012/02/03/steve-jobs-2007-iphone-presentation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tooltip</title>
		<link>http://birdchan.com/home/2012/01/31/tooltip/</link>
		<comments>http://birdchan.com/home/2012/01/31/tooltip/#comments</comments>
		<pubDate>Wed, 01 Feb 2012 00:27:45 +0000</pubDate>
		<dc:creator>Brian</dc:creator>
				<category><![CDATA[technology]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://birdchan.com/home/?p=2591</guid>
		<description><![CDATA[If you are looking for nice tooltip libraries, I recommend trying qTip2. It&#8217;s a jquery plugin. And it&#8217;s got most of the pop-up tooltip features you can imagine. 
I personally like this feature, that you can assign different behaviors (by different actions) to the same element. See below:

?View Code JQUERY1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// Create our first tooltip
$('.selector').qtip({
  [...]]]></description>
			<content:encoded><![CDATA[<p><a href=http://craigsworks.com/projects/qtip2/ target=_blank><img src=/blog_files/2012_01_31_qtip2/owl_footer.png style='float: right; padding-left: 5px;'></a>If you are looking for nice tooltip libraries, I recommend trying <a href=http://craigsworks.com/projects/qtip2/ target=_blank>qTip2</a>. It&#8217;s a jquery plugin. And it&#8217;s got most of the pop-up tooltip features you can imagine. </p>
<p>I personally like this feature, that you can assign different behaviors (by different actions) to the same element. See below:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p2591code4'); return false;">View Code</a> JQUERY</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p25914"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
</pre></td><td class="code" id="p2591code4"><pre class="jquery" style="font-family:monospace;">// Create our first tooltip
$('.selector').qtip({
   content: 'Mouse entered',
   show: {
       event: 'mouseenter',
       solo: true // Only show one tooltip at a time
   }
})
&nbsp;
// Remove the previous tooltips data
.removeData('qtip')
&nbsp;
// Create our second tooltip
.qtip({
   content: 'Click',
   show: {
       event: 'click',
       solo: true // Only show one tooltip at a time
   }
});</pre></td></tr></table></div>

<p>With the above code, you can have a specified mouseover preview tooltip, and a detailed view upon a mouse click. Very handy! </p>
<p>Check out their <a href=http://craigsworks.com/projects/qtip2/demos/ target=_blank>demo page</a> for all the cool features! </p>
]]></content:encoded>
			<wfw:commentRss>http://birdchan.com/home/2012/01/31/tooltip/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Patriot Black PBO Core Box Office</title>
		<link>http://birdchan.com/home/2012/01/30/patriot-black-pbo-core-box-office/</link>
		<comments>http://birdchan.com/home/2012/01/30/patriot-black-pbo-core-box-office/#comments</comments>
		<pubDate>Tue, 31 Jan 2012 07:16:48 +0000</pubDate>
		<dc:creator>Brian</dc:creator>
				<category><![CDATA[DIY]]></category>
		<category><![CDATA[technology]]></category>

		<guid isPermaLink="false">http://birdchan.com/home/?p=2579</guid>
		<description><![CDATA[Recently I went on newegg and bought this &#8220;Patriot Black PBO Core Box Office All-in-one 1080p Full HD Media Player with HDMI PCMPBO25&#8243;. (such a long name&#8230;) Simply put, a media box that streams to your TV with hdmi. 
Just in case I didn&#8217;t do justice, you got to take a look at its supported [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I went on <a href=http://www.newegg.com/Product/Product.aspx?Item=N82E16822219002 target=_blank>newegg</a> and bought this &#8220;Patriot Black PBO Core Box Office All-in-one 1080p Full HD Media Player with HDMI PCMPBO25&#8243;. (such a long name&#8230;) Simply put, a media box that streams to your TV with hdmi. </p>
<p>Just in case I didn&#8217;t do justice, you got to take a look at its supported video format list:</p>
<p>- MPEG-1: MPG/MPEG/DAT support up to 1080p<br />
- MPEG-2: MPG/MPEG/VOB/ISO/IFO/TS/TP/M2TS up to 1080p<br />
- MPEG-4: MP4/AVI/MOV support up to 1080p<br />
- DivX 3/4/5/6/7, Xvid: AVI/MKV/ support up to 1080p<br />
- H.264, AVC: TS/AVI/MKV/MOV/M2TS support up to 1080p<br />
- WMV 9: WMV support up to 1080p<br />
- FLV support 352&#215;288<br />
- ISO image<br />
- Real Video 8/9/10: RM/RMVB support up to 720</p>
<p>I mean, what else do you want? It can also hold an internal 2.5 inch hard disk within (not included), so you can copy files into it through usb. </p>
<p><img src=/blog_files/2012_01_30_PBO/PBO_box.jpg></p>
<p>Awesome idea! I thought to myself. It&#8217;s about time this kind of product should come out to the market. After all, people prefer watching videos on bigger screens rather than their computer screens. </p>
<p>When I received this in the mail, I was so excited that I quickly tried it out on my TV. Cables were so easy to connect, no brainer. The main screen came out fine. Awesome! </p>
<p><img src=/blog_files/2012_01_30_PBO/main_screen_before.jpg></p>
<p>Then to just test it out, I copied a mkv file to my 32Gb usb stick and inserted it into the pbo box. </p>
<p>After a long while, the greyed out USB menu is still greyed out. I thought to myself, perhaps this usb is too big? (ah&#8230; then I guess I can&#8217;t really use my external hard drive later&#8230;) I tried formatting my usb stick to fat32, still no luck&#8230; </p>
<p>I was so disappointed and sad. Sad because there were so many positive comments online about it, I felt cheated on. This&#8217;s got to be a conspiracy! </p>
<p>I then went onto newegg and followed the steps to do a RMA return. Weird I must say, I ended up doing a RMA exchange, and paid about $10 for the shipping fee out of my pocket. Sometimes, I do unexplainable things&#8230;</p>
<p>A few days later, the same PBO box arrived to my door. Still plastic wrapped, everything was the same, only that my heart was extremely skeptical this time. I unwrapped it and did the same wiring. The same screen came up on my TV. </p>
<p>So now, with my shaking hand I inserted my 32Gb usb stick. Same. Greyed out. </p>
<p>I was more calmed this time. I inserted another 2Gb usb stick, and that seemed to work. I played with the remote and played the mkv video file fine. No lag, and hdmi has sound. </p>
<p>Then I suspected it was the file system format. I spent quite some time on <a href=http://ntfsonmac.com/ target=_blank>ntfs-3g</a>, and stuff like that. Just to save your time, don&#8217;t do that. Keep your file format to fat32. </p>
<p>For whatever reason, all of a sudden I thought of firmware! </p>
<p>I did some searches and I found this obscure webpage documenting the firmware upgrading process: <a href=http://www.patriotmemory.com/forums/showthread.php?2131-Update-04-04-2011-PBO-Firmware-Releases target=_blank>http://www.patriotmemory.com/forums/showthread.php?2131-Update-04-04-2011-PBO-Firmware-Releases</a></p>
<p>Honestly that page doesn&#8217;t really look like anything close to being official. Looks more like a discussion forum. However, you will end up getting the latest firmware. * Btw, after pressing Stop then Pause @ the home screen, I had a hard time reading the bootcode off my screen. I ended up ignoring that. </p>
<p>At my time of installing the firmware, the filename is BETA_P70R2.zip, released on Apr 4, 2011. Yea&#8230;. I know, I see the word BETA as well&#8230; no joke. Do it at your own risk. </p>
<p>After installing the new firmware, I see this very similar main screen. </p>
<p><img src=/blog_files/2012_01_30_PBO/main_screen_after.jpg></p>
<p>Yea, see that orange background in the icon? Believe me, you are in much better shape with this orange color. </p>
<p><img src=/blog_files/2012_01_30_PBO/menu_after.jpg></p>
<p>My PBO box then recognized my 32 Gb fat32 usb stick with no problem! You will also see the blue highlight in the selection menu, which wasn&#8217;t there before. Great UI experience I guess&#8230; good job! </p>
<p>Now I just need to make sure this box will work fine with my internal hard drive. LAN also doesn&#8217;t seem to work out of the box with my linksys default setup&#8230; I guess I will find out more on another day. </p>
]]></content:encoded>
			<wfw:commentRss>http://birdchan.com/home/2012/01/30/patriot-black-pbo-core-box-office/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>rounded corners</title>
		<link>http://birdchan.com/home/2012/01/30/rounded-corners/</link>
		<comments>http://birdchan.com/home/2012/01/30/rounded-corners/#comments</comments>
		<pubDate>Tue, 31 Jan 2012 01:02:21 +0000</pubDate>
		<dc:creator>Brian</dc:creator>
				<category><![CDATA[technology]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://birdchan.com/home/?p=2556</guid>
		<description><![CDATA[An ordinary div
Row 1
A div with rounded corners
Row 2
The second div looks so much more fun and professional at the same time! 
As it turns out, all you need is one or two extra lines in order to add these rounded corners. See code below:

?View Code CSS1
2
3
#my_div &#123;
  border-radius: 15px;
&#125;

If you want more fine-tuning, [...]]]></description>
			<content:encoded><![CDATA[<p>An ordinary div</p>
<div style='background-color: #cccccc; width: 500px; text-align: center; margin-bottom: 20px;'>Row 1</div>
<p>A div with rounded corners</p>
<div style='background-color: #cccccc; width: 500px; text-align: center; margin-bottom: 20px; border-radius: 15px;'>Row 2</div>
<p>The second div looks so much more fun and professional at the same time! </p>
<p>As it turns out, all you need is one or two extra lines in order to add these rounded corners. See code below:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p2556code7'); return false;">View Code</a> CSS</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p25567"><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code" id="p2556code7"><pre class="css" style="font-family:monospace;"><span style="color: #cc00cc;">#my_div</span> <span style="color: #00AA00;">&#123;</span>
  border-radius<span style="color: #00AA00;">:</span> <span style="color: #933;">15px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></td></tr></table></div>

<p>If you want more fine-tuning, try the following. The first parameter is the horizontal radius of the rounded corner, the second the vertical.</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p2556code8'); return false;">View Code</a> CSS</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p25568"><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code" id="p2556code8"><pre class="css" style="font-family:monospace;">border-top-left-radius<span style="color: #00AA00;">:</span> <span style="color: #933;">10px</span> <span style="color: #933;">5px</span><span style="color: #00AA00;">;</span>
border-bottom-right-radius<span style="color: #00AA00;">:</span> <span style="color: #933;">10%</span> <span style="color: #933;">5%</span><span style="color: #00AA00;">;</span>
border-top-right-radius<span style="color: #00AA00;">:</span> <span style="color: #933;">10px</span><span style="color: #00AA00;">;</span></pre></td></tr></table></div>

<p>Play around with it and see if you can make something like the following. <img src='http://birdchan.com/home/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<div style='background-color: #cccccc; width: 400px; height: 300px; text-align: center; margin-bottom: 20px; border-top-left-radius: 45px; border-top-right-radius: 90px; border-bottom-left-radius: 130px; border-bottom-right-radius: 50px;'>
  <span style='position: relative; top: 50%; font-size: 30px;'>Hello</span>
</div>
<p><br style='clear: both'></p>
]]></content:encoded>
			<wfw:commentRss>http://birdchan.com/home/2012/01/30/rounded-corners/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Leading Change Together</title>
		<link>http://birdchan.com/home/2012/01/27/leading-change-together/</link>
		<comments>http://birdchan.com/home/2012/01/27/leading-change-together/#comments</comments>
		<pubDate>Sat, 28 Jan 2012 05:51:58 +0000</pubDate>
		<dc:creator>Brian</dc:creator>
				<category><![CDATA[church]]></category>
		<category><![CDATA[life]]></category>

		<guid isPermaLink="false">http://birdchan.com/home/?p=2551</guid>
		<description><![CDATA[
How do you lead a healthy team dynamic? In this episode, Bill Hybels and Jim Mellado revisit a classic interview with Carly Fiorina at The Global Leadership Summit. During the interview, Bill asked her about the dynamics within her board. Bill and Jim then identify the dynamics involved in healthy teams.
Um&#8230; very insightful. 
]]></description>
			<content:encoded><![CDATA[<p><iframe width="640" height="360" src="http://www.youtube.com/embed/AIrcqoYZlp8" frameborder="0" allowfullscreen></iframe></p>
<p>How do you lead a healthy team dynamic? In this episode, Bill Hybels and Jim Mellado revisit a classic interview with Carly Fiorina at The Global Leadership Summit. During the interview, Bill asked her about the dynamics within her board. Bill and Jim then identify the dynamics involved in healthy teams.</p>
<p>Um&#8230; very insightful. </p>
]]></content:encoded>
			<wfw:commentRss>http://birdchan.com/home/2012/01/27/leading-change-together/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Happiness</title>
		<link>http://birdchan.com/home/2012/01/27/happiness/</link>
		<comments>http://birdchan.com/home/2012/01/27/happiness/#comments</comments>
		<pubDate>Sat, 28 Jan 2012 05:12:13 +0000</pubDate>
		<dc:creator>Brian</dc:creator>
				<category><![CDATA[life]]></category>

		<guid isPermaLink="false">http://birdchan.com/home/?p=2547</guid>
		<description><![CDATA[Don&#8217;t Seek Happiness. If you seek it, you won&#8217;t find it, because
seeking is the antithesis of happiness
 &#8211; Eckhart Tolle
]]></description>
			<content:encoded><![CDATA[<p>Don&#8217;t Seek Happiness. If you seek it, you won&#8217;t find it, because<br />
seeking is the antithesis of happiness</p>
<p> &#8211; <a href=http://en.wikipedia.org/wiki/Eckhart_Tolle target=_blank>Eckhart Tolle</a></p>
]]></content:encoded>
			<wfw:commentRss>http://birdchan.com/home/2012/01/27/happiness/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP array delete an item</title>
		<link>http://birdchan.com/home/2012/01/26/php-array-delete-an-item/</link>
		<comments>http://birdchan.com/home/2012/01/26/php-array-delete-an-item/#comments</comments>
		<pubDate>Thu, 26 Jan 2012 23:41:53 +0000</pubDate>
		<dc:creator>Brian</dc:creator>
				<category><![CDATA[technology]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://birdchan.com/home/?p=2541</guid>
		<description><![CDATA[Say, you have an array like the following, how to delete &#8220;three&#8221;?

?View Code PHP1
$arr = array(&#34;one&#34;, &#34;two&#34;, &#34;three&#34;, &#34;four&#34;, &#34;five&#34;);

PHP has this function called unset, with which you can do:

?View Code PHP1
unset($arr[2]);

But&#8230; yea&#8230; there is no direct way to do something like array_delete_value(&#8220;three&#8221;)&#8230; I don&#8217;t understand why there is no easy way to do deletion [...]]]></description>
			<content:encoded><![CDATA[<p>Say, you have an array like the following, how to delete &#8220;three&#8221;?</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p2541code13'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p254113"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p2541code13"><pre class="php" style="font-family:monospace;">$arr = array(&quot;one&quot;, &quot;two&quot;, &quot;three&quot;, &quot;four&quot;, &quot;five&quot;);</pre></td></tr></table></div>

<p>PHP has this function called <a href=http://php.net/manual/en/function.unset.php target=_blank>unset</a>, with which you can do:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p2541code14'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p254114"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p2541code14"><pre class="php" style="font-family:monospace;">unset($arr[2]);</pre></td></tr></table></div>

<p>But&#8230; yea&#8230; there is no direct way to do something like <b>array_delete_value(&#8220;three&#8221;)</b>&#8230; I don&#8217;t understand why there is no easy way to do deletion by value&#8230; </p>
<p>You will need to get the array index first, whenever you want to delete by value. We will use <a href=http://us2.php.net/manual/en/function.array-search.php target=_blank>array_search</a> to get the index or key.</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p2541code15'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p254115"><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code" id="p2541code15"><pre class="php" style="font-family:monospace;">if ( ($key = array_search(&quot;three&quot;, $arr)) !== false) {
  unset($arr[$key]);
}</pre></td></tr></table></div>

<p>The above is better than traversing the whole array linearly. </p>
<p>If you need to do a global delete, use a while loop.</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p2541code16'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p254116"><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code" id="p2541code16"><pre class="php" style="font-family:monospace;">while ( ($key = array_search(&quot;three&quot;, $arr)) !== false) {
  unset($arr[$key]);
}</pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://birdchan.com/home/2012/01/26/php-array-delete-an-item/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Displaying non ascii characters in html</title>
		<link>http://birdchan.com/home/2012/01/20/displaying-non-ascii-characters-in-html/</link>
		<comments>http://birdchan.com/home/2012/01/20/displaying-non-ascii-characters-in-html/#comments</comments>
		<pubDate>Sat, 21 Jan 2012 00:00:27 +0000</pubDate>
		<dc:creator>Brian</dc:creator>
				<category><![CDATA[technology]]></category>

		<guid isPermaLink="false">http://birdchan.com/home/?p=2538</guid>
		<description><![CDATA[This happens very often. We have some non ascii characters to display on a webpage. Without properly encoding, we see funny latin letters or squares displayed instead. 
This is not an &#8220;international&#8221; issue. Even in the US, when users copy and paste content from a word document, that content often contains non-ascii characters, say the [...]]]></description>
			<content:encoded><![CDATA[<p>This happens very often. We have some non ascii characters to display on a webpage. Without properly encoding, we see funny latin letters or squares displayed instead. </p>
<p>This is not an &#8220;international&#8221; issue. Even in the US, when users copy and paste content from a word document, that content often contains non-ascii characters, say the bulletin points. After such content gets inserted in the db, that content often simply gets blindly displayed onto a webpage along with other well-behaved data. So we see the funny characters again. </p>
<p>Assuming the database has the right stuff, the simple solution to fixing this is the following.</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p2538code18'); return false;">View Code</a> HTML</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p253818"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p2538code18"><pre class="html" style="font-family:monospace;">  &lt;META HTTP-EQUIV=&quot;Content-Type&quot; CONTENT=&quot;text/html; charset=&quot;UTF-8&quot;&gt;</pre></td></tr></table></div>

<p>Just put that in your html head section. You webpage should then be displayed properly. </p>
<p>Ref link: <a href=http://www.terena.org/activities/multiling/euroml/tests/html-eurolat1.html target=_blank>http://www.terena.org/activities/multiling/euroml/tests/html-eurolat1.html</a></p>
]]></content:encoded>
			<wfw:commentRss>http://birdchan.com/home/2012/01/20/displaying-non-ascii-characters-in-html/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>text wrapping in the html pre tag</title>
		<link>http://birdchan.com/home/2012/01/20/text-wrapping-in-the-html-pre-tag/</link>
		<comments>http://birdchan.com/home/2012/01/20/text-wrapping-in-the-html-pre-tag/#comments</comments>
		<pubDate>Fri, 20 Jan 2012 23:49:39 +0000</pubDate>
		<dc:creator>Brian</dc:creator>
				<category><![CDATA[technology]]></category>

		<guid isPermaLink="false">http://birdchan.com/home/?p=2535</guid>
		<description><![CDATA[If you ever have a &#60;pre&#62; tag in a div or table, and you are providing say text from your database to the pre element, be very careful that the default style of the pre tag will let the text keep running until hitting the newline character. This is probably not desirable because these long [...]]]></description>
			<content:encoded><![CDATA[<p>If you ever have a &lt;pre&gt; tag in a div or table, and you are providing say text from your database to the pre element, be very careful that the default style of the pre tag will let the text keep running until hitting the newline character. This is probably not desirable because these long text lines will push their container thus expanding the container unexpectedly. </p>
<p>It&#8217;s ugly to say the least. </p>
<p>To enable the expected text wrapping, do:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p2535code20'); return false;">View Code</a> CSS</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p253520"><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code" id="p2535code20"><pre class="css" style="font-family:monospace;">pre <span style="color: #00AA00;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">white-space</span><span style="color: #00AA00;">:</span> pre-wrap<span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></td></tr></table></div>

<p>This will make the long lines wrap around when hitting the container&#8217;s edge, thus respecting your specified container&#8217;s width. </p>
<p>I only tested this in Chrome and Safari btw. </p>
<p>Ref link: <a href=http://stackoverflow.com/questions/1634203/pre-tag-in-html-with-fixed-width target=_blank>http://stackoverflow.com/questions/1634203/pre-tag-in-html-with-fixed-width</a></p>
]]></content:encoded>
			<wfw:commentRss>http://birdchan.com/home/2012/01/20/text-wrapping-in-the-html-pre-tag/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP encode JS decode</title>
		<link>http://birdchan.com/home/2012/01/19/php-encode-js-decode/</link>
		<comments>http://birdchan.com/home/2012/01/19/php-encode-js-decode/#comments</comments>
		<pubDate>Thu, 19 Jan 2012 21:31:16 +0000</pubDate>
		<dc:creator>Brian</dc:creator>
				<category><![CDATA[technology]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://birdchan.com/home/?p=2516</guid>
		<description><![CDATA[Very often I need to encode some string in PHP, then pass that to javascript. For example, say I am using PHP to generate some javascript functions. See below:

?View Code PHP1
2
3
4
5
6
7
$s = &#34;some text from somewhere&#34;;
$js_code = &#34;
  function do_something(some_text){
    alert(some_text);
  }
  do_something('$s');
&#34;;

The above javascript code would work fine [...]]]></description>
			<content:encoded><![CDATA[<p>Very often I need to encode some string in PHP, then pass that to javascript. For example, say I am using PHP to generate some javascript functions. See below:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p2516code23'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p251623"><td class="line_numbers"><pre>1
2
3
4
5
6
7
</pre></td><td class="code" id="p2516code23"><pre class="php" style="font-family:monospace;">$s = &quot;some text from somewhere&quot;;
$js_code = &quot;
  function do_something(some_text){
    alert(some_text);
  }
  do_something('$s');
&quot;;</pre></td></tr></table></div>

<p>The above javascript code would work fine until one day you have some symbols in $s, for example the single quote. (There may be more troublemakers, but at least this is a common one). </p>
<p>So now you start thinking about encoding and decoding. It turns out <a href=http://www.the-art-of-web.com/javascript/escape/ target=_blank>there are so many ways to do them</a>&#8230; Just which one do you need? </p>
<p>Below is my solution, you are welcome and encouraged to find your own solution.</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p2516code24'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p251624"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
</pre></td><td class="code" id="p2516code24"><pre class="php" style="font-family:monospace;">$s = &quot;some text !@#$%^&amp;*()_+[]\{}|;':&quot;,./&lt;&gt;?&quot;;  // of couse this is not syntactical, in reality think of this string coming from a db
$s_encoded = rawurlencode($s);
$js_code = &quot;
  function do_something(some_text_encoded){
    some_text = unescape(some_text_encoded);
    alert(some_text);
  }
  do_something('$s_encoded');
&quot;;</pre></td></tr></table></div>

<p>Hope this can save your time. <img src='http://birdchan.com/home/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://birdchan.com/home/2012/01/19/php-encode-js-decode/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>bin hex dec calculator</title>
		<link>http://birdchan.com/home/2012/01/19/bin-hex-dec-calculator/</link>
		<comments>http://birdchan.com/home/2012/01/19/bin-hex-dec-calculator/#comments</comments>
		<pubDate>Thu, 19 Jan 2012 21:03:47 +0000</pubDate>
		<dc:creator>Brian</dc:creator>
				<category><![CDATA[technology]]></category>

		<guid isPermaLink="false">http://birdchan.com/home/?p=2512</guid>
		<description><![CDATA[Here are some handy bin,hex,dec convertors. 
Binary => Dec or Hex
http://www.easycalculation.com/binary-converter.php
Dec => Bin or Hex
http://www.easycalculation.com/decimal-converter.php
Hex => Dec or Bin
http://www.easycalculation.com/hex-converter.php
]]></description>
			<content:encoded><![CDATA[<p>Here are some handy bin,hex,dec convertors. </p>
<p>Binary => Dec or Hex<br />
<a href=http://www.easycalculation.com/binary-converter.php target=_blank>http://www.easycalculation.com/binary-converter.php</a></p>
<p>Dec => Bin or Hex<br />
<a href=http://www.easycalculation.com/decimal-converter.php target=_blank>http://www.easycalculation.com/decimal-converter.php</a></p>
<p>Hex => Dec or Bin<br />
<a href=http://www.easycalculation.com/hex-converter.php target=_blank>http://www.easycalculation.com/hex-converter.php</a></p>
]]></content:encoded>
			<wfw:commentRss>http://birdchan.com/home/2012/01/19/bin-hex-dec-calculator/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>小學畢業</title>
		<link>http://birdchan.com/home/2012/01/19/%e5%b0%8f%e5%ad%b8%e7%95%a2%e6%a5%ad/</link>
		<comments>http://birdchan.com/home/2012/01/19/%e5%b0%8f%e5%ad%b8%e7%95%a2%e6%a5%ad/#comments</comments>
		<pubDate>Thu, 19 Jan 2012 17:50:02 +0000</pubDate>
		<dc:creator>Brian</dc:creator>
				<category><![CDATA[fun]]></category>

		<guid isPermaLink="false">http://birdchan.com/home/?p=2506</guid>
		<description><![CDATA[
假如有位婆婆跟你說她小學畢業，請不要少看她！
請先看看當年(1953)小學會考 「 常識科 」 題目，睇睇自己懂多少題，才好笑人「小學畢業」。
]]></description>
			<content:encoded><![CDATA[<p><img src=/images/primary_school_test_1953.jpg width=700></p>
<p>假如有位婆婆跟你說她小學畢業，請不要少看她！<br />
請先看看當年(1953)小學會考 「 常識科 」 題目，睇睇自己懂多少題，才好笑人「小學畢業」。</p>
]]></content:encoded>
			<wfw:commentRss>http://birdchan.com/home/2012/01/19/%e5%b0%8f%e5%ad%b8%e7%95%a2%e6%a5%ad/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Carrot Crazy</title>
		<link>http://birdchan.com/home/2012/01/13/carrot-crazy/</link>
		<comments>http://birdchan.com/home/2012/01/13/carrot-crazy/#comments</comments>
		<pubDate>Fri, 13 Jan 2012 22:06:17 +0000</pubDate>
		<dc:creator>Brian</dc:creator>
				<category><![CDATA[fun]]></category>

		<guid isPermaLink="false">http://birdchan.com/home/?p=2502</guid>
		<description><![CDATA[
Carrot Crazy from littleGIANT on Vimeo.
Very nice 3D graphics! 
]]></description>
			<content:encoded><![CDATA[<p><iframe src="http://player.vimeo.com/video/27588379?title=0&amp;byline=0&amp;portrait=0" width="601" height="338" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>
<p><a href="http://vimeo.com/27588379">Carrot Crazy</a> from <a href="http://vimeo.com/user3342946">littleGIANT</a> on <a href="http://vimeo.com">Vimeo</a>.</p>
<p>Very nice 3D graphics! </p>
]]></content:encoded>
			<wfw:commentRss>http://birdchan.com/home/2012/01/13/carrot-crazy/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>osx hardware status bar</title>
		<link>http://birdchan.com/home/2012/01/12/osx-hardware-status-bar/</link>
		<comments>http://birdchan.com/home/2012/01/12/osx-hardware-status-bar/#comments</comments>
		<pubDate>Thu, 12 Jan 2012 08:03:10 +0000</pubDate>
		<dc:creator>Brian</dc:creator>
				<category><![CDATA[technology]]></category>

		<guid isPermaLink="false">http://birdchan.com/home/?p=2498</guid>
		<description><![CDATA[I really believe this little tool is essential for all you guys out there who care about what&#8217;s going on with your hardware at any given moment. It&#8217;s called MenuMeters from Raging Menace. Basically, you can see status of your cpu, memory, hard disk, and network traffic in real time on the menu bar. Slowness [...]]]></description>
			<content:encoded><![CDATA[<p>I really believe this little tool is essential for all you guys out there who care about what&#8217;s going on with your hardware at any given moment. It&#8217;s called <a href=http://www.ragingmenace.com/software/menumeters/ target=_blank>MenuMeters</a> from Raging Menace. Basically, you can see status of your cpu, memory, hard disk, and network traffic in real time on the menu bar. Slowness of any kind can now be troubleshooted with better supporting evidence. Try it out, it&#8217;s FREE. </p>
<p><a href=http://www.ragingmenace.com/software/menumeters/ target=_blank><img src=/images/MenuMetersMenubar.png></a></p>
]]></content:encoded>
			<wfw:commentRss>http://birdchan.com/home/2012/01/12/osx-hardware-status-bar/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Trello</title>
		<link>http://birdchan.com/home/2012/01/11/trello/</link>
		<comments>http://birdchan.com/home/2012/01/11/trello/#comments</comments>
		<pubDate>Wed, 11 Jan 2012 21:52:21 +0000</pubDate>
		<dc:creator>Brian</dc:creator>
				<category><![CDATA[technology]]></category>

		<guid isPermaLink="false">http://birdchan.com/home/?p=2494</guid>
		<description><![CDATA[If you have a small organization and you need to share ideas and manage various tasks in the team, it would be quite a headache. Coz you are dealing with a mini growing social network, hopefully with something better than emails and phone calls. This is when you need trello (https://trello.com/). Take a look at [...]]]></description>
			<content:encoded><![CDATA[<p>If you have a small organization and you need to share ideas and manage various tasks in the team, it would be quite a headache. Coz you are dealing with a mini growing social network, hopefully with something better than emails and phone calls. This is when you need trello (<a href=https://trello.com/ target=_blank>https://trello.com/</a>). Take a look at their video and see if you can benefit from it. You could even use that to organize a small get-away to deal with the shopping list and packing items. Best of all, it&#8217;s FREE. <img src='http://birdchan.com/home/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p><iframe width="640" height="360" src="http://www.youtube.com/embed/aaDf1RqeLfo" frameborder="0" allowfullscreen></iframe></p>
<p><a href=https://trello.com/ target=_blank>https://trello.com/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://birdchan.com/home/2012/01/11/trello/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jquery datepicker date format</title>
		<link>http://birdchan.com/home/2012/01/10/jquery-datepicker-date-format/</link>
		<comments>http://birdchan.com/home/2012/01/10/jquery-datepicker-date-format/#comments</comments>
		<pubDate>Wed, 11 Jan 2012 01:10:48 +0000</pubDate>
		<dc:creator>Brian</dc:creator>
				<category><![CDATA[technology]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://birdchan.com/home/?p=2491</guid>
		<description><![CDATA[If you are using the jquery datepicker and have been displaying the date in the usual mysql date format, you probably will find it annoying that the date picker gives you the slash date format back. Here is how to keep the mysql date dash format all throughout.

?View Code JAVASCRIPT1
2
3
4
5
6
7
var queryDate = '2012-01-10',
   [...]]]></description>
			<content:encoded><![CDATA[<p>If you are using the jquery datepicker and have been displaying the date in the usual mysql date format, you probably will find it annoying that the date picker gives you the slash date format back. Here is how to keep the mysql date dash format all throughout.</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p2491code26'); return false;">View Code</a> JAVASCRIPT</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p249126"><td class="line_numbers"><pre>1
2
3
4
5
6
7
</pre></td><td class="code" id="p2491code26"><pre class="javascript" style="font-family:monospace;">var queryDate = '2012-01-10',
    dateParts = queryDate.match(/(\d+)/g)
    realDate = new Date(dateParts[0], dateParts[1] - 1, dateParts[2]);  
                                    // months are 0-based!
&nbsp;
$('#datePicker').datepicker({ dateFormat: 'yy-mm-dd' }); // format to show
$('#datePicker').datepicker('setDate', realDate);</pre></td></tr></table></div>

<p>The code above will translate the mysql date to do the initial setup, then use the dash format for the text field. </p>
<p>Ref: <a href=http://stackoverflow.com/questions/1953840/datepickersetdate-issues-in-jquery target=_blank>http://stackoverflow.com/questions/1953840/datepickersetdate-issues-in-jquery</a></p>
]]></content:encoded>
			<wfw:commentRss>http://birdchan.com/home/2012/01/10/jquery-datepicker-date-format/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>National Budget Explained</title>
		<link>http://birdchan.com/home/2011/12/22/national-budget-explained/</link>
		<comments>http://birdchan.com/home/2011/12/22/national-budget-explained/#comments</comments>
		<pubDate>Thu, 22 Dec 2011 08:13:19 +0000</pubDate>
		<dc:creator>Brian</dc:creator>
				<category><![CDATA[economy]]></category>

		<guid isPermaLink="false">http://birdchan.com/home/?p=2483</guid>
		<description><![CDATA[
]]></description>
			<content:encoded><![CDATA[<p><img src=/images/national_budget_explained.jpg style='width: 650px; padding-top: 10px;'></p>
]]></content:encoded>
			<wfw:commentRss>http://birdchan.com/home/2011/12/22/national-budget-explained/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>20%</title>
		<link>http://birdchan.com/home/2011/12/19/20/</link>
		<comments>http://birdchan.com/home/2011/12/19/20/#comments</comments>
		<pubDate>Mon, 19 Dec 2011 18:36:16 +0000</pubDate>
		<dc:creator>Brian</dc:creator>
				<category><![CDATA[fun]]></category>

		<guid isPermaLink="false">http://birdchan.com/home/?p=2481</guid>
		<description><![CDATA[
]]></description>
			<content:encoded><![CDATA[<p><a href="http://dilbert.com/strips/comic/2011-12-19/" title="Dilbert.com" target=_blank><img src="http://dilbert.com/dyn/str_strip/000000000/00000000/0000000/100000/40000/6000/500/146540/146540.strip.gif" border="0" alt="Dilbert.com" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://birdchan.com/home/2011/12/19/20/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Biggest Risk for the U.S. Economy in 2012</title>
		<link>http://birdchan.com/home/2011/12/18/biggest-risk-for-the-u-s-economy-in-2012/</link>
		<comments>http://birdchan.com/home/2011/12/18/biggest-risk-for-the-u-s-economy-in-2012/#comments</comments>
		<pubDate>Sun, 18 Dec 2011 19:56:04 +0000</pubDate>
		<dc:creator>Brian</dc:creator>
				<category><![CDATA[economy]]></category>

		<guid isPermaLink="false">http://birdchan.com/home/?p=2477</guid>
		<description><![CDATA[
The Street.com piece on &#8220;Biggest Risk for the U.S. Economy in 2012&#8243;
]]></description>
			<content:encoded><![CDATA[<p><iframe width="640" height="360" src="http://www.youtube.com/embed/9_G0YCs6dYA" frameborder="0" allowfullscreen></iframe></p>
<p>The Street.com piece on &#8220;Biggest Risk for the U.S. Economy in 2012&#8243;</p>
]]></content:encoded>
			<wfw:commentRss>http://birdchan.com/home/2011/12/18/biggest-risk-for-the-u-s-economy-in-2012/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

