<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="wordpress/2.3.3" -->
<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/"
	>

<channel>
	<title>psychoric</title>
	<link>http://www.psychoric.com</link>
	<description>mastering the skills to maximize the tools</description>
	<pubDate>Sat, 06 Sep 2008 04:57:04 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.3.3</generator>
	<language>en</language>
			<item>
		<title>Stats: alive</title>
		<link>http://www.psychoric.com/2008/09/06/stats-alive/</link>
		<comments>http://www.psychoric.com/2008/09/06/stats-alive/#comments</comments>
		<pubDate>Sat, 06 Sep 2008 04:53:49 +0000</pubDate>
		<dc:creator>Eric</dc:creator>
		
		<category><![CDATA[Psycho's Note]]></category>

		<guid isPermaLink="false">http://www.psychoric.com/2008/09/06/stats-alive/</guid>
		<description><![CDATA[c:\>ping psychoric
Pinging psychoric [Malaysia] with 32 tonnes of shit:
Reply from psychoric: shit=32 time=2months+ TTL=240
Reply from psychoric: shit=32 time=2months+ TTL=240
Reply from psychoric: shit=32 time=2months+ TTL=240
Reply from psychoric: shit=32 time=2months+ TTL=240
Ping statistics for psychoric: [breathing]
Woots, it is now close to 3 months since I last posted here. I don&#8217;t think it is anything unusual as I always [...]]]></description>
			<content:encoded><![CDATA[<p>c:\>ping psychoric</p>
<p>Pinging psychoric [Malaysia] with 32 tonnes of shit:<br />
Reply from psychoric: shit=32 time=2months+ TTL=240<br />
Reply from psychoric: shit=32 time=2months+ TTL=240<br />
Reply from psychoric: shit=32 time=2months+ TTL=240<br />
Reply from psychoric: shit=32 time=2months+ TTL=240</p>
<p>Ping statistics for psychoric: [breathing]</p>
<p>Woots, it is now close to 3 months since I last posted here. I don&#8217;t think it is anything unusual as I always believe in procratisnating. There have been up and down. Family crap that I can&#8217;t do much about unless if I can manage to cough out hundred of thousands, then I guess everyone will be worry free. But hell, I can&#8217;t so I have to live with it. Yeah you will probably say there are people out there who are even more unfortunate than this. I know that. On the good side, I learnt that problem is not really a problem if everyone sticks together. Otherwise, problem creates problem. It is only partially true that money plays a critical role in a family. The lack of it causes worries, grudges, arguments. But if you think deeper, it is not the real reason. The actual cause is on each member of the family. Shoud everyone understand the situation and adapt to it considerately, the effects of any problem are minimized. Communication is also very important to sustain a marriage, a family, a relationship. Many times we have seen cases of sad ending that are caused by breakdown in communication. When individuals are able to sit down and talk calmly, I believe nothing is impossible. What&#8217;s the point of bottling matters up and in the end causes an explosion that requires even more effort to clean up?</p>
<p>Anyway, enough of those important-in-life theories. <a href="http://www.mifc.com.my" target="_blank">MIFC</a> was on last month and I managed to shoot 2 countries of the many. You can find the pictures <a href="http://gallery.psychoric.com/main.php?g2_itemId=6672" target="_blank">here</a> and <a href="http://gallery.psychoric.com/main.php?g2_itemId=6821" target="_blank">here</a>.Apart from this, nothing much fancy to share, except that I am stepping my feet into MOSS 2007 (Sharepoint). So far, it is a new and smooth experience. But I guess I can say so before I bang into the limiting walls that many have run into. Any exciting upcoming events to look forward to? That will be visiting Bali at the end of October and a new job <img src='http://www.psychoric.com/wp/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Ciao for now!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.psychoric.com/2008/09/06/stats-alive/feed/</wfw:commentRss>
		</item>
		<item>
		<title>20080626 Today&#8217;s Photo - Multiple mE!</title>
		<link>http://www.psychoric.com/2008/06/26/20080626-todays-photo-multiple-me/</link>
		<comments>http://www.psychoric.com/2008/06/26/20080626-todays-photo-multiple-me/#comments</comments>
		<pubDate>Thu, 26 Jun 2008 14:06:17 +0000</pubDate>
		<dc:creator>Eric</dc:creator>
		
		<category><![CDATA[More Photos]]></category>

		<guid isPermaLink="false">http://www.psychoric.com/2008/06/26/20080626-todays-photo-multiple-me/</guid>
		<description><![CDATA[Got this idea from a photography forumer. His work is way better but i like mine too!  Basically it shows my main activities at home  Weird to see so many of yourself at the same time&#8230;

]]></description>
			<content:encoded><![CDATA[<p>Got this idea from a photography forumer. His work is way better but i like mine too! <img src='http://www.psychoric.com/wp/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> Basically it shows my main activities at home <img src='http://www.psychoric.com/wp/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> Weird to see so many of yourself at the same time&#8230;</p>
<p><a href="http://www.psychoric.com/gallery/main.php?g2_view=core.DownloadItem&amp;g2_itemId=6512&amp;g2_GALLERYSID=TMP_SESSION_ID_DI_NOISSES_PMT" rel="lightbox[g2image]" title="multiple-me!"><img src="http://www.psychoric.com/gallery/main.php?g2_view=core.DownloadItem&amp;g2_itemId=6513&amp;g2_GALLERYSID=TMP_SESSION_ID_DI_NOISSES_PMT" alt="multiple-me!" title="multiple-me!" width="150" height="101" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.psychoric.com/2008/06/26/20080626-todays-photo-multiple-me/feed/</wfw:commentRss>
		</item>
		<item>
		<title>20080624 Today&#8217;s Photo</title>
		<link>http://www.psychoric.com/2008/06/24/20080624-todays-photo/</link>
		<comments>http://www.psychoric.com/2008/06/24/20080624-todays-photo/#comments</comments>
		<pubDate>Tue, 24 Jun 2008 12:38:25 +0000</pubDate>
		<dc:creator>Eric</dc:creator>
		
		<category><![CDATA[More Photos]]></category>

		<guid isPermaLink="false">http://www.psychoric.com/2008/06/24/20080624-todays-photo/</guid>
		<description><![CDATA[Ah, been a while since my last post  Was too bored on a Sunday afternoon and actually spent some times in bathroom to take pictures of water droplets. Yeah, i was really bored  Anyway, managed to come out with the picture below. What do you think? Feel free to use it as your [...]]]></description>
			<content:encoded><![CDATA[<p>Ah, been a while since my last post <img src='http://www.psychoric.com/wp/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> Was too bored on a Sunday afternoon and actually spent some times in bathroom to take pictures of water droplets. Yeah, i was really bored <img src='http://www.psychoric.com/wp/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> Anyway, managed to come out with the picture below. What do you think? Feel free to use it as your wallpaper <img src='http://www.psychoric.com/wp/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> :P</p>
<p><a href="http://www.psychoric.com/gallery/main.php?g2_view=core.DownloadItem&amp;g2_itemId=6508&amp;g2_GALLERYSID=TMP_SESSION_ID_DI_NOISSES_PMT" rel="lightbox[g2image]" title="wallpaper-water_700"><img src="http://www.psychoric.com/gallery/main.php?g2_view=core.DownloadItem&amp;g2_itemId=6509&amp;g2_GALLERYSID=TMP_SESSION_ID_DI_NOISSES_PMT" alt="wallpaper-water_700" title="wallpaper-water_700" width="150" height="94" /></a></p>
<p>Click for the <a href="http://gallery.psychoric.com/main.php?g2_view=core.DownloadItem&amp;g2_itemId=6510&amp;g2_serialNumber=1" target="_blank" title="full size">full size</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.psychoric.com/2008/06/24/20080624-todays-photo/feed/</wfw:commentRss>
		</item>
		<item>
		<title>20080527 Today&#8217;s Photo</title>
		<link>http://www.psychoric.com/2008/05/27/20080527-todays-photo/</link>
		<comments>http://www.psychoric.com/2008/05/27/20080527-todays-photo/#comments</comments>
		<pubDate>Tue, 27 May 2008 06:03:35 +0000</pubDate>
		<dc:creator>Eric</dc:creator>
		
		<category><![CDATA[More Photos]]></category>

		<guid isPermaLink="false">http://www.psychoric.com/2008/05/27/20080527-todays-photo/</guid>
		<description><![CDATA[Finally had a chance to get my hands on a set of extension tubes (in case you are blur, extension tube is meant for macro photography). Played around with it for couple of hours and am really amazed at the result! Well i am not praising my shooting skill but the details that you can [...]]]></description>
			<content:encoded><![CDATA[<p>Finally had a chance to get my hands on a set of extension tubes (in case you are blur, extension tube is meant for macro photography). Played around with it for couple of hours and am really amazed at the result! Well i am not praising my shooting skill but the details that you can capture with it. Paired it with my faithful EF 50mm f/1.8, it can do magic!</p>
<p>One of the OK shots</p>
<p><a href="http://www.psychoric.com/gallery/main.php?g2_view=core.DownloadItem&amp;g2_itemId=6373&amp;g2_GALLERYSID=TMP_SESSION_ID_DI_NOISSES_PMT" rel="lightbox[g2image]" title="_MG_6901a"><img src="http://www.psychoric.com/gallery/main.php?g2_view=core.DownloadItem&amp;g2_itemId=6374&amp;g2_GALLERYSID=TMP_SESSION_ID_DI_NOISSES_PMT" alt="_MG_6901a" title="_MG_6901a" height="150" width="100" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.psychoric.com/2008/05/27/20080527-todays-photo/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Project SsSS</title>
		<link>http://www.psychoric.com/2008/05/09/project-ssss/</link>
		<comments>http://www.psychoric.com/2008/05/09/project-ssss/#comments</comments>
		<pubDate>Thu, 08 May 2008 16:06:35 +0000</pubDate>
		<dc:creator>Eric</dc:creator>
		
		<category><![CDATA[Psycho's Note]]></category>

		<guid isPermaLink="false">http://www.psychoric.com/2008/05/09/project-ssss/</guid>
		<description><![CDATA[Ha! Been almost a month since the last post. This project is my first into the world of DIY in photography. I love DIY!
So what do you do with a empty box lying around? (actually i got mine from MPH warehouse sales)

Cut off the flaps. You can leave them too as &#8216;extension&#8217; or &#8216;box-hood&#8217;

Draw the [...]]]></description>
			<content:encoded><![CDATA[<p>Ha! Been almost a month since the last post. This project is my first into the world of DIY in photography. I love DIY!</p>
<p>So what do you do with a empty box lying around? (actually i got mine from MPH warehouse sales)</p>
<p><img src="http://www.psychoric.com/wp/wp-content/uploads/2008/05/_mg_6386.JPG" alt="_mg_6386.JPG" /></p>
<p>Cut off the flaps. You can leave them too as &#8216;extension&#8217; or &#8216;box-hood&#8217;</p>
<p><img src="http://www.psychoric.com/wp/wp-content/uploads/2008/05/_mg_6387.JPG" alt="_mg_6387.JPG" /></p>
<p>Draw the lines on where you wanna cut. Size is up to you</p>
<p><img src="http://www.psychoric.com/wp/wp-content/uploads/2008/05/_mg_6389.JPG" alt="_mg_6389.JPG" /></p>
<p>I cut 3 sides. You can cut 4 if you like <img src='http://www.psychoric.com/wp/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<p><img src="http://www.psychoric.com/wp/wp-content/uploads/2008/05/_mg_6393.JPG" alt="_mg_6393.JPG" /></p>
<p>Book wrapper isn&#8217;t just for book! It is used here as a &#8216;diffuser&#8217; for the lighting</p>
<p><img src="http://www.psychoric.com/wp/wp-content/uploads/2008/05/_mg_6395.JPG" alt="_mg_6395.JPG" /></p>
<p>There you go, a bare box. You can add on by adding white paper as the inner wallpaper</p>
<p><img src="http://www.psychoric.com/wp/wp-content/uploads/2008/05/_mg_6397.JPG" alt="_mg_6397.JPG" /></p>
<p>Tested with lighting. Note that the light temperature isn&#8217;t suitable. Go for one with cool daylight.</p>
<p><img src="http://www.psychoric.com/wp/wp-content/uploads/2008/05/_mg_6399.JPG" alt="_mg_6399.JPG" /></p>
<p>Added a near black background paper. Aw, wrong type as you can see reflection on the paper</p>
<p><img src="http://www.psychoric.com/wp/wp-content/uploads/2008/05/_mg_6422.JPG" alt="_mg_6422.JPG" /></p>
<p>Test shot without the background</p>
<p><img src="http://www.psychoric.com/wp/wp-content/uploads/2008/05/_mg_6401.JPG" alt="_mg_6401.JPG" /></p>
<p>Test shot with the background</p>
<p><img src="http://www.psychoric.com/wp/wp-content/uploads/2008/05/_mg_6406.JPG" alt="_mg_6406.JPG" /></p>
<p>Cheap and easy, you have a photo tent for product shot or anything you can fit in there. With 3 openings, you can add on or move the lighting anywhere you like.</p>
<p>Cost<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br />
Paper box : FOC<br />
Book wrapper: RM1.90<br />
Paper background: RM0.60<br />
Tools: I am sure you have it around your household<br />
Total: RM2.50<br />
Result: Priceless<br />
Bonus: You do your part in recycling! <img src='http://www.psychoric.com/wp/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<p>Oh, what&#8217;s SsSS? My own-made-up-acronym that stands for <strong>Small stuff Shooting Studio</strong>! <img src='http://www.psychoric.com/wp/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.psychoric.com/2008/05/09/project-ssss/feed/</wfw:commentRss>
		</item>
		<item>
		<title>C# Generic Comparer</title>
		<link>http://www.psychoric.com/2008/04/17/c-generic-comparer/</link>
		<comments>http://www.psychoric.com/2008/04/17/c-generic-comparer/#comments</comments>
		<pubDate>Thu, 17 Apr 2008 02:46:53 +0000</pubDate>
		<dc:creator>Eric</dc:creator>
		
		<category><![CDATA[Coder's Code]]></category>

		<guid isPermaLink="false">http://www.psychoric.com/2008/04/17/c-generic-comparer/</guid>
		<description><![CDATA[This morning I ran into a situation where i need to sort an array of ServiceController before binding into a combobox. So I looked around and I found Array.Sort (or List.Sort). Tried with the parameter-less call, but .NET doesn&#8217;t like it. One of the required overloaded methods requires a IComparer. Hmm, looks familiar and found [...]]]></description>
			<content:encoded><![CDATA[<p>This morning I ran into a situation where i need to sort an array of ServiceController before binding into a combobox. So I looked around and I found Array.Sort (or List<T>.Sort). Tried with the parameter-less call, but .NET doesn&#8217;t like it. One of the required overloaded methods requires a IComparer. Hmm, looks familiar and found some straightforward examples online. Immediately I have a simple class that solves my problem.</p>

<div class="wp_syntax"><div class="code"><pre class="csharp"><span style="color: #0600FF;">private</span> <span style="color: #FF0000;">class</span> ServiceControllerSort <span style="color: #008000;">:</span> IComparer<span style="color: #008000;">&lt;</span>ServiceController<span style="color: #008000;">&gt;</span>
<span style="color: #000000;">&#123;</span>
	<span style="color: #0600FF;">public</span> <span style="color: #FF0000;">int</span> Compare<span style="color: #000000;">&#40;</span>ServiceController x, ServiceController y<span style="color: #000000;">&#41;</span>
	<span style="color: #000000;">&#123;</span>
		<span style="color: #0600FF;">return</span> <span style="color: #FF0000;">string</span>.<span style="color: #0000FF;">Compare</span><span style="color: #000000;">&#40;</span>x.<span style="color: #0000FF;">DisplayName</span>, y.<span style="color: #0000FF;">DisplayName</span>, <span style="color: #0600FF;">true</span><span style="color: #000000;">&#41;</span>;
	<span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></div></div>

<p>Now what? What if next time I want to sort on my ExtendedServiceController class (as if there is necessity to do one)? I will have more and more IComparer implementations. I decided to explore further and this <a href="http://book.itzero.com/read/microsoft/0602/Addison.Wesley.Data.Binding.with.Windows.Forms.2.0.Programming.Smart.Client.Data.Applications.with.dot.NET.Jan.2006_html/032126892X/ch09lev1sec13.html" target="_blank">page</a> says it all. Took the code, clean it up and woots, I have a generic comparison class that is usable for almost all types.</p>

<div class="wp_syntax"><div class="code"><pre class="csharp"><span style="color: #008080; font-style: italic;">/// &lt;summary&gt;</span>
<span style="color: #008080; font-style: italic;">/// Custom sorter based on property</span>
<span style="color: #008080; font-style: italic;">/// &lt;/summary&gt;</span>
<span style="color: #008080; font-style: italic;">/// &lt;typeparam name=&quot;T&quot;&gt;Target Type&lt;/typeparam&gt;</span>
<span style="color: #0600FF;">public</span> <span style="color: #FF0000;">class</span> ExtSortComparer<span style="color: #008000;">&lt;</span>T<span style="color: #008000;">&gt;:</span> IComparer<span style="color: #008000;">&lt;</span>T<span style="color: #008000;">&gt;</span>
<span style="color: #000000;">&#123;</span>
	<span style="color: #0600FF;">private</span> ListSortDirection _sortDirection <span style="color: #008000;">=</span> ListSortDirection.<span style="color: #0000FF;">Ascending</span>;
	<span style="color: #0600FF;">private</span> PropertyDescriptor _targetPropDescriptor;
&nbsp;
	<span style="color: #008080; font-style: italic;">/// &lt;summary&gt;</span>
	<span style="color: #008080; font-style: italic;">/// Constructor</span>
	<span style="color: #008080; font-style: italic;">/// &lt;/summary&gt;</span>
	<span style="color: #0600FF;">public</span> ExtSortComparer<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
	<span style="color: #000000;">&#123;</span>
	<span style="color: #000000;">&#125;</span>
&nbsp;
	<span style="color: #008080; font-style: italic;">/// &lt;summary&gt;</span>
	<span style="color: #008080; font-style: italic;">/// Constructor</span>
	<span style="color: #008080; font-style: italic;">/// &lt;/summary&gt;</span>
	<span style="color: #008080; font-style: italic;">/// &lt;param name=&quot;PropertyName&quot;&gt;Name of property to sort on. Case sensitive.&lt;/param&gt;</span>
	<span style="color: #0600FF;">public</span> ExtSortComparer<span style="color: #000000;">&#40;</span><span style="color: #FF0000;">string</span> PropertyName<span style="color: #000000;">&#41;</span>
	<span style="color: #000000;">&#123;</span>
		_targetPropDescriptor <span style="color: #008000;">=</span> TypeDescriptor.<span style="color: #0000FF;">GetProperties</span><span style="color: #000000;">&#40;</span><span style="color: #008000;">typeof</span><span style="color: #000000;">&#40;</span>T<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#91;</span>PropertyName<span style="color: #000000;">&#93;</span>;
	<span style="color: #000000;">&#125;</span>
&nbsp;
	<span style="color: #008080; font-style: italic;">/// &lt;summary&gt;</span>
	<span style="color: #008080; font-style: italic;">/// Constructor</span>
	<span style="color: #008080; font-style: italic;">/// &lt;/summary&gt;</span>
	<span style="color: #008080; font-style: italic;">/// &lt;param name=&quot;PropertyName&quot;&gt;Name of property to sort on. Case sensitive.&lt;/param&gt;</span>
	<span style="color: #008080; font-style: italic;">/// &lt;param name=&quot;SortDirection&quot;&gt;Sort direction&lt;/param&gt;</span>
	<span style="color: #0600FF;">public</span> ExtSortComparer<span style="color: #000000;">&#40;</span><span style="color: #FF0000;">string</span> PropertyName, ListSortDirection SortDirection<span style="color: #000000;">&#41;</span> <span style="color: #008000;">:</span> <span style="color: #0600FF;">this</span><span style="color: #000000;">&#40;</span>PropertyName<span style="color: #000000;">&#41;</span>
	<span style="color: #000000;">&#123;</span>
		_sortDirection <span style="color: #008000;">=</span> SortDirection;
	<span style="color: #000000;">&#125;</span>
&nbsp;
	<span style="color: #008080; font-style: italic;">/// &lt;summary&gt;</span>
	<span style="color: #008080; font-style: italic;">/// Constructor</span>
	<span style="color: #008080; font-style: italic;">/// &lt;/summary&gt;</span>
	<span style="color: #008080; font-style: italic;">/// &lt;param name=&quot;TargetProperty&quot;&gt;Descriptor of property to sort on&lt;/param&gt;</span>
	<span style="color: #0600FF;">public</span> ExtSortComparer<span style="color: #000000;">&#40;</span>PropertyDescriptor TargetProperty<span style="color: #000000;">&#41;</span>
	<span style="color: #000000;">&#123;</span>
		_targetPropDescriptor <span style="color: #008000;">=</span> TargetProperty;
	<span style="color: #000000;">&#125;</span>
&nbsp;
	<span style="color: #008080; font-style: italic;">/// &lt;summary&gt;</span>
	<span style="color: #008080; font-style: italic;">/// Constructor</span>
	<span style="color: #008080; font-style: italic;">/// &lt;/summary&gt;</span>
	<span style="color: #008080; font-style: italic;">/// &lt;param name=&quot;TargetProperty&quot;&gt;Descriptor of property to sort on&lt;/param&gt;</span>
	<span style="color: #008080; font-style: italic;">/// &lt;param name=&quot;SortDirection&quot;&gt;Sort direction&lt;/param&gt;</span>
	<span style="color: #0600FF;">public</span> ExtSortComparer<span style="color: #000000;">&#40;</span>PropertyDescriptor TargetProperty, ListSortDirection SortDirection<span style="color: #000000;">&#41;</span>
	<span style="color: #000000;">&#123;</span>
		_targetPropDescriptor <span style="color: #008000;">=</span> TargetProperty;
		_sortDirection <span style="color: #008000;">=</span> SortDirection;
	<span style="color: #000000;">&#125;</span>
&nbsp;
	<span style="color: #008080; font-style: italic;">/// &lt;summary&gt;</span>
	<span style="color: #008080; font-style: italic;">/// Compare two given object</span>
	<span style="color: #008080; font-style: italic;">/// &lt;/summary&gt;</span>
	<span style="color: #008080; font-style: italic;">/// &lt;param name=&quot;x&quot;&gt;Object A&lt;/param&gt;</span>
	<span style="color: #008080; font-style: italic;">/// &lt;param name=&quot;y&quot;&gt;Object B&lt;/param&gt;</span>
	<span style="color: #008080; font-style: italic;">/// &lt;returns&gt;Result of comparison&lt;/returns&gt;</span>
	<span style="color: #0600FF;">public</span> <span style="color: #FF0000;">int</span> Compare<span style="color: #000000;">&#40;</span>T x, T y<span style="color: #000000;">&#41;</span>
	<span style="color: #000000;">&#123;</span>
		<span style="color: #008080; font-style: italic;">//ensure there is proper property description</span>
		<span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span>_targetPropDescriptor <span style="color: #008000;">!=</span> <span style="color: #0600FF;">null</span><span style="color: #000000;">&#41;</span>
		<span style="color: #000000;">&#123;</span>
			<span style="color: #FF0000;">int</span> intRetValue <span style="color: #008000;">=</span> _CompareValues<span style="color: #000000;">&#40;</span>_targetPropDescriptor.<span style="color: #0000FF;">GetValue</span><span style="color: #000000;">&#40;</span>x<span style="color: #000000;">&#41;</span>, 
											_targetPropDescriptor.<span style="color: #0000FF;">GetValue</span><span style="color: #000000;">&#40;</span>y<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>;
&nbsp;
			<span style="color: #008080; font-style: italic;">//reverse the sorting if descending</span>
			<span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span>_sortDirection <span style="color: #008000;">==</span> ListSortDirection.<span style="color: #0000FF;">Descending</span><span style="color: #000000;">&#41;</span>
				<span style="color: #0600FF;">return</span> intRetValue <span style="color: #008000;">*</span> <span style="color: #FF0000;">-1</span>;
&nbsp;
			<span style="color: #0600FF;">return</span> intRetValue; <span style="color: #008080; font-style: italic;">//return the result</span>
		<span style="color: #000000;">&#125;</span>
&nbsp;
		<span style="color: #0600FF;">return</span> <span style="color: #FF0000;">0</span>; <span style="color: #008080; font-style: italic;">//return neutral if insufficient information to sort</span>
	<span style="color: #000000;">&#125;</span>
&nbsp;
	<span style="color: #008080; font-style: italic;">/// &lt;summary&gt;</span>
	<span style="color: #008080; font-style: italic;">/// Compare values of target property</span>
	<span style="color: #008080; font-style: italic;">/// &lt;/summary&gt;</span>
	<span style="color: #008080; font-style: italic;">/// &lt;param name=&quot;ValueX&quot;&gt;Value of property (Object A)&lt;/param&gt;</span>
	<span style="color: #008080; font-style: italic;">/// &lt;param name=&quot;ValueY&quot;&gt;Value of property (Object B)&lt;/param&gt;</span>
	<span style="color: #008080; font-style: italic;">/// &lt;returns&gt;Result of comparison&lt;/returns&gt;</span>
	<span style="color: #0600FF;">private</span> <span style="color: #FF0000;">int</span> _CompareValues<span style="color: #000000;">&#40;</span><span style="color: #FF0000;">object</span> ValueX, <span style="color: #FF0000;">object</span> ValueY<span style="color: #000000;">&#41;</span>
	<span style="color: #000000;">&#123;</span>
		<span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span>ValueX <span style="color: #008000;">is</span> IComparable<span style="color: #000000;">&#41;</span> <span style="color: #008080; font-style: italic;">//if X can be compared</span>
			<span style="color: #0600FF;">return</span> <span style="color: #000000;">&#40;</span><span style="color: #000000;">&#40;</span>IComparable<span style="color: #000000;">&#41;</span>ValueX<span style="color: #000000;">&#41;</span>.<span style="color: #0000FF;">CompareTo</span><span style="color: #000000;">&#40;</span>ValueY<span style="color: #000000;">&#41;</span>;
&nbsp;
		<span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span>ValueY <span style="color: #008000;">is</span> IComparable<span style="color: #000000;">&#41;</span> <span style="color: #008080; font-style: italic;">//else if Y can be compared</span>
			<span style="color: #0600FF;">return</span> <span style="color: #000000;">&#40;</span><span style="color: #000000;">&#40;</span>IComparable<span style="color: #000000;">&#41;</span>ValueY<span style="color: #000000;">&#41;</span>.<span style="color: #0000FF;">CompareTo</span><span style="color: #000000;">&#40;</span>ValueX<span style="color: #000000;">&#41;</span>;
&nbsp;
		<span style="color: #008080; font-style: italic;">//when both can't be compared, resort to string value.</span>
		<span style="color: #0600FF;">return</span> ValueX.<span style="color: #0000FF;">ToString</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>.<span style="color: #0000FF;">CompareTo</span><span style="color: #000000;">&#40;</span>ValueY.<span style="color: #0000FF;">ToString</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>;
	<span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></div></div>

<p>The comments should explain what is happening internally. Another good addition to my common library! If you have any thoughts, shoot!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.psychoric.com/2008/04/17/c-generic-comparer/feed/</wfw:commentRss>
		</item>
		<item>
		<title>New accessories: Pop-up flash diffuser</title>
		<link>http://www.psychoric.com/2008/04/08/new-accessories-pop-up-diffuser/</link>
		<comments>http://www.psychoric.com/2008/04/08/new-accessories-pop-up-diffuser/#comments</comments>
		<pubDate>Tue, 08 Apr 2008 15:14:43 +0000</pubDate>
		<dc:creator>Eric</dc:creator>
		
		<category><![CDATA[Psycho's Note]]></category>

		<guid isPermaLink="false">http://www.psychoric.com/2008/04/08/new-accessories-pop-up-diffuser/</guid>
		<description><![CDATA[Been very long time since i bought any camera stuff and i came across this should-be-useful item while surfing with no aim. I managed to find it at one of the local online store and instantly made an order. The total damage, RM40. The item reached my hand today (prompt shipping, thumbs up!) so immediately [...]]]></description>
			<content:encoded><![CDATA[<p>Been very long time since i bought any camera stuff and i came across this <a href="http://yamiya.com.my/store/product.php?productid=17691&amp;cat=0&amp;page=1" target="_blank">should-be-useful item</a> while surfing with no aim. I managed to find it at <a href="http://www.yamiya.com.my/store/home.php" target="_blank">one of the local online store</a> and instantly made an order. The total damage, RM40. The item reached my hand today (prompt shipping, thumbs up!) so immediately ran a test trial with it. Let the results speak themselves</p>
<table style="border-width: 0px" border="0">
<tr>
<td align="center"><strong>Without</strong></td>
<td align="center"><strong>With</strong></td>
</tr>
<tr>
<td align="center"><a href="http://www.psychoric.com/gallery/main.php?g2_view=core.DownloadItem&amp;g2_itemId=6151&amp;g2_GALLERYSID=TMP_SESSION_ID_DI_NOISSES_PMT" rel="lightbox[g2image]" title="_MG_6043"><img src="http://www.psychoric.com/gallery/main.php?g2_view=core.DownloadItem&amp;g2_itemId=6152&amp;g2_GALLERYSID=TMP_SESSION_ID_DI_NOISSES_PMT" alt="_MG_6043" title="_MG_6043" height="100" width="150" /></a></td>
<td align="center"><a href="http://www.psychoric.com/gallery/main.php?g2_view=core.DownloadItem&amp;g2_itemId=6154&amp;g2_GALLERYSID=TMP_SESSION_ID_DI_NOISSES_PMT" rel="lightbox[g2image]" title="_MG_6047"><img src="http://www.psychoric.com/gallery/main.php?g2_view=core.DownloadItem&amp;g2_itemId=6155&amp;g2_GALLERYSID=TMP_SESSION_ID_DI_NOISSES_PMT" alt="_MG_6047" title="_MG_6047" height="100" width="150" /></a></td>
</tr>
<tr>
<td align="center"><a href="http://www.psychoric.com/gallery/main.php?g2_view=core.DownloadItem&amp;g2_itemId=6158&amp;g2_GALLERYSID=TMP_SESSION_ID_DI_NOISSES_PMT" rel="lightbox[g2image]" title="_MG_6050"><img src="http://www.psychoric.com/gallery/main.php?g2_view=core.DownloadItem&amp;g2_itemId=6159&amp;g2_GALLERYSID=TMP_SESSION_ID_DI_NOISSES_PMT" alt="_MG_6050" title="_MG_6050" height="150" width="100" /></a></td>
<td align="center"><a href="http://www.psychoric.com/gallery/main.php?g2_view=core.DownloadItem&amp;g2_itemId=6156&amp;g2_GALLERYSID=TMP_SESSION_ID_DI_NOISSES_PMT" rel="lightbox[g2image]" title="_MG_6049"><img src="http://www.psychoric.com/gallery/main.php?g2_view=core.DownloadItem&amp;g2_itemId=6157&amp;g2_GALLERYSID=TMP_SESSION_ID_DI_NOISSES_PMT" alt="_MG_6049" title="_MG_6049" height="150" width="100" /></a></td>
</tr>
<tr>
<td align="center"><a href="http://www.psychoric.com/gallery/main.php?g2_view=core.DownloadItem&amp;g2_itemId=6164&amp;g2_GALLERYSID=TMP_SESSION_ID_DI_NOISSES_PMT" rel="lightbox[g2image]" title="_MG_6057"><img src="http://www.psychoric.com/gallery/main.php?g2_view=core.DownloadItem&amp;g2_itemId=6165&amp;g2_GALLERYSID=TMP_SESSION_ID_DI_NOISSES_PMT" alt="_MG_6057" title="_MG_6057" height="100" width="150" /></a></td>
<td align="center"><a href="http://www.psychoric.com/gallery/main.php?g2_view=core.DownloadItem&amp;g2_itemId=6166&amp;g2_GALLERYSID=TMP_SESSION_ID_DI_NOISSES_PMT" rel="lightbox[g2image]" title="_MG_6059"><img src="http://www.psychoric.com/gallery/main.php?g2_view=core.DownloadItem&amp;g2_itemId=6167&amp;g2_GALLERYSID=TMP_SESSION_ID_DI_NOISSES_PMT" alt="_MG_6059" title="_MG_6059" height="100" width="150" /></a></td>
</tr>
<tr>
<td align="center"><a href="http://www.psychoric.com/gallery/main.php?g2_view=core.DownloadItem&amp;g2_itemId=6160&amp;g2_GALLERYSID=TMP_SESSION_ID_DI_NOISSES_PMT" rel="lightbox[g2image]" title="_MG_6051"><img src="http://www.psychoric.com/gallery/main.php?g2_view=core.DownloadItem&amp;g2_itemId=6161&amp;g2_GALLERYSID=TMP_SESSION_ID_DI_NOISSES_PMT" alt="_MG_6051" title="_MG_6051" height="150" width="100" /></a></td>
<td align="center"><a href="http://www.psychoric.com/gallery/main.php?g2_view=core.DownloadItem&amp;g2_itemId=6162&amp;g2_GALLERYSID=TMP_SESSION_ID_DI_NOISSES_PMT" rel="lightbox[g2image]" title="_MG_6052"><img src="http://www.psychoric.com/gallery/main.php?g2_view=core.DownloadItem&amp;g2_itemId=6163&amp;g2_GALLERYSID=TMP_SESSION_ID_DI_NOISSES_PMT" alt="_MG_6052" title="_MG_6052" height="150" width="100" /></a></td>
</tr>
</table>
<p>So what do you think? Is it worth the purchase? I think it does coz sometimes you wouldn&#8217;t want a harsh light especially on closer subjects.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.psychoric.com/2008/04/08/new-accessories-pop-up-diffuser/feed/</wfw:commentRss>
		</item>
		<item>
		<title>C# Generic Constraints</title>
		<link>http://www.psychoric.com/2008/03/28/c-generic-constraints/</link>
		<comments>http://www.psychoric.com/2008/03/28/c-generic-constraints/#comments</comments>
		<pubDate>Fri, 28 Mar 2008 02:14:33 +0000</pubDate>
		<dc:creator>Eric</dc:creator>
		
		<category><![CDATA[Coder's Code]]></category>

		<guid isPermaLink="false">http://www.psychoric.com/2008/03/28/c-generic-constraints/</guid>
		<description><![CDATA[Generic is a new wonder in .NET with the flexiblity it introduces to coders. But when you wish to explore further, you might face the limitation of only able to work with Object capabilities. This is because generic doesn&#8217;t know your type details, and since all types are Object, so you only have Object to [...]]]></description>
			<content:encoded><![CDATA[<p>Generic is a new wonder in .NET with the flexiblity it introduces to coders. But when you wish to explore further, you might face the limitation of only able to work with Object capabilities. This is because generic doesn&#8217;t know your type details, and since all types are Object, so you only have Object to play with. To overcome this, we have Where keyword in C# (VB.net has As, i think). Apart from be able to constraint the types that generic accept, it also allows you to use the constraints capabilities.</p>
<p>Generics support few types of constraints:</p>
<ul>
<li>Interface: Allow only types that implement specific interfaces to use your generic.</li>
<li>Class/Base class: Allow only types that match or inherit from a specific base class to use your generic.</li>
<li>Constructor: Require types that use your generic to implement a parameterless constructor.</li>
</ul>
<p>Say you have a custom Interface as below</p>
<pre class="mycode">
<code>public interface IMyCustomOne
{
	string WhatsMyName();
}</code></pre>
<p>and a generic method</p>
<pre class="mycode">
<code>public bool CheckNameEqualJohn&lt;T&gt;()
{
	return (T.WhatsMyName == "John");
}</code></pre>
<p>Compiler will throw you at the instant you try to build.</p>
<p>To solve this, we add Where at the end</p>
<pre class="mycode">
<code>public bool CheckNameEqualJohn&lt;T&gt;() where T : IMyCustomOne
{
	return (T.WhatsMyName == "John");
}</code></pre>
<p>Woots, compiler is now happy! The obstacle has been removed and off you go to maximize your creativity. If you need 2 constraints, how to go about it?</p>
<pre class="mycode">
<code>public class MyClass&lt;T,U&gt;
	where T : IMyCustomT
	where U : IMyCustomU
{
	//....
}</code></pre>
<p>Some additional jargons about this constraint that will make you look cooler in front of your peers</p>
<p><strong>Unbound Type Parameter</strong><br />
Basically this refers to the most basic way of us using generic</p>
<pre class="mycode">
<code>public class MyClass&lt;T&gt;
{
	//....
}</code></pre>
<p><strong>Naked Type Constraint</strong><br />
When a generic type parameter is used as constraint</p>
<pre class="mycode">
<code>public class MyClass&lt;T&gt;
{
	public void MethodOne&lt;U&gt;(U param) where U : T
	{
		//....
	}
}</code></pre>
<p>Happy Generic&#8217;ing!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.psychoric.com/2008/03/28/c-generic-constraints/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Better comparison with enumeration</title>
		<link>http://www.psychoric.com/2008/03/11/better-comparison-with-enumeration/</link>
		<comments>http://www.psychoric.com/2008/03/11/better-comparison-with-enumeration/#comments</comments>
		<pubDate>Tue, 11 Mar 2008 08:45:25 +0000</pubDate>
		<dc:creator>Eric</dc:creator>
		
		<category><![CDATA[Coder's Code]]></category>

		<guid isPermaLink="false">http://www.psychoric.com/2008/03/11/better-comparison-with-enumeration/</guid>
		<description><![CDATA[Suppose you have an enum list and a variable which value comes from external source. What do you usually do to compare against the enum list?

If (MyValue == "3") { //3 means ok, do some stuff }

What if one day you decide that you don&#8217;t like 3 (for whatever reason) and change it to 30? [...]]]></description>
			<content:encoded><![CDATA[<p>Suppose you have an enum list and a variable which value comes from external source. What do you usually do to compare against the enum list?</p>
<pre class="mycode">
<code>If (MyValue == "3") { //3 means ok, do some stuff }</code>
</pre>
<p>What if one day you decide that you don&#8217;t like 3 (for whatever reason) and change it to 30? You will have to find and replace the repeated value all over your project. Yes, you have the FindAndReplace function with most IDE, but holy cow, you only realize that the last couple of 3 meant something else!</p>
<p>So a safer way is to cast the value into appropriate enum for comparison or any other operation.</p>
<pre class="mycode">
<code>'VB.NET
dim myEnumValue as TheEnum = CType([Enum].Parse(GetType(TheEnum), _
				tempValue.ToString()), TheEnum)
If myEnumValue = TheEnum.NumberThree Then
	'..
End If

//C#
TheEnum myEnumValue = (TheEnum)Enum.Parse(typeof(TheEnum), tempValue);
if (myEnumValue == TheEnum.NumberThree) { //.. }</code>
</pre>
<p>&#8220;Hey, that looks useful. I want it in my SuperCoolReusable library&#8221; you might say. With the power of Generic, we can put it into a common call.</p>
<pre class="mycode">
<code>'VB.NET
Public Shared Function ParseEnum(Of T)(ByVal Value As Object) As T
	Return CType([Enum].Parse(GetType(T), Value.ToString()), T)
End Function

//C#
public static ReturnType ConvertStringToEnum&lt;ReturnType&gt;(string Value)
{
	return (ReturnType)Enum.Parse(typeof(ReturnType), Value);
}</code>
</pre>
<p>Another simple yet useful tip! <img src='http://www.psychoric.com/wp/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.psychoric.com/2008/03/11/better-comparison-with-enumeration/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Have you made your environment pledge?</title>
		<link>http://www.psychoric.com/2008/03/03/have-you-made-your-environment-pledge/</link>
		<comments>http://www.psychoric.com/2008/03/03/have-you-made-your-environment-pledge/#comments</comments>
		<pubDate>Mon, 03 Mar 2008 00:39:56 +0000</pubDate>
		<dc:creator>Eric</dc:creator>
		
		<category><![CDATA[Psycho's Note]]></category>

		<guid isPermaLink="false">http://www.psychoric.com/2008/03/03/have-you-made-your-environment-pledge/</guid>
		<description><![CDATA[Facts, in case you wonder :
1. It takes less than half a second to turn off the water tap while brushing your teeth, and that in turn saves 14,600 litres of water a year!
2. It requires less than 0.1% of your brain power to remember to turn lights out when not required, and that action [...]]]></description>
			<content:encoded><![CDATA[<p>Facts, in case you wonder :</p>
<p>1. It takes less than half a second to turn off the water tap while brushing your teeth, and that in turn saves 14,600 litres of water a year!</p>
<p>2. It requires less than 0.1% of your brain power to remember to turn lights out when not required, and that action saves 68kilogram of CO2 a year!</p>
<p>3. It requires less than couple of mouse clicks to print 2 pages a sheet, and that setting saves half a tree every year!</p>
<p>Those are my pledges to prevent the earth from deteriorating. You don&#8217;t have to be involved in lots of activities to save the earth when you can even start small at your own pace. Make your pledge today <a href="http://www.thegreatestraceonearth.com/your_enviro_pledge/eng/?g=142737253718290" target="_blank">here</a>! Together, we can <img src='http://www.psychoric.com/wp/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.psychoric.com/2008/03/03/have-you-made-your-environment-pledge/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
