<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>Fakhrul'z</title>
	
	<link>http://fakhrulz.com/wordpress</link>
	<description>is a .Net Developer</description>
	<pubDate>Tue, 10 Aug 2010 06:20:51 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.2</generator>
	<language>en</language>
			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/Fakhrulz" /><feedburner:info uri="fakhrulz" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>Lunch at Shakeys again</title>
		<link>http://feedproxy.google.com/~r/Fakhrulz/~3/cW2Nj0sGPn4/</link>
		<comments>http://fakhrulz.com/wordpress/?p=761#comments</comments>
		<pubDate>Tue, 10 Aug 2010 06:20:51 +0000</pubDate>
		<dc:creator>fakhrul</dc:creator>
		
		<category><![CDATA[Blog]]></category>

		<guid isPermaLink="false">http://fakhrulz.com/wordpress/?p=761</guid>
		<description><![CDATA[Arrive at Manila this morning. Now having a lunch at Shakeys

]]></description>
			<content:encoded><![CDATA[<p>Arrive at Manila this morning. Now having a lunch at Shakeys</p>
<p><a href="http://fakhrulz.com/wordpress/wp-content/uploads/2010/08/l-2048-1536-b855885f-4552-4664-8b0b-ee127072874d.jpeg"><img src="http://fakhrulz.com/wordpress/wp-content/uploads/2010/08/l-2048-1536-b855885f-4552-4664-8b0b-ee127072874d.jpeg" alt="" class="alignnone size-full" /></a></p>
<img src="http://feeds.feedburner.com/~r/Fakhrulz/~4/cW2Nj0sGPn4" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://fakhrulz.com/wordpress/?feed=rss2&amp;p=761</wfw:commentRss>
		<feedburner:origLink>http://fakhrulz.com/wordpress/?p=761</feedburner:origLink></item>
		<item>
		<title>C# WinForm and Sql Server CE Tutorial</title>
		<link>http://feedproxy.google.com/~r/Fakhrulz/~3/wmtWQA51Mmw/</link>
		<comments>http://fakhrulz.com/wordpress/?p=757#comments</comments>
		<pubDate>Fri, 02 Apr 2010 01:27:41 +0000</pubDate>
		<dc:creator>fakhrul</dc:creator>
		
		<category><![CDATA[Blog]]></category>

		<category><![CDATA[Development]]></category>

		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://fakhrulz.com/wordpress/?p=757</guid>
		<description><![CDATA[1. Create a WinForm project.

* If you are using a 64 bit platform, make sure that the target platform is x86. If not you will be facing a problem later on.
2. Create a form like this.

3. Insert a new item, Local Database. Then click Add.

* Click cancel at Data Source Configuration Wizard, since we will [...]]]></description>
			<content:encoded><![CDATA[<p>1. Create a WinForm project.</p>
<p><a rel="WLPP" href="http://fakhrulz.com/wordpress/wp-content/uploads/2010/04/capture1412200913454901042010215713.jpg"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Capture14-12-2009-13.45.4901-04-2010-21.57.13" src="http://fakhrulz.com/wordpress/wp-content/uploads/2010/04/capture1412200913454901042010215713-thumb.jpg" border="0" alt="Capture14-12-2009-13.45.4901-04-2010-21.57.13" width="687" height="468" /></a></p>
<p><em>* If you are using a 64 bit platform, make sure that the target platform is x86. If not you will be facing a problem later on.</em></p>
<p>2. Create a form like this.</p>
<p><a rel="WLPP" href="http://fakhrulz.com/wordpress/wp-content/uploads/2010/04/capture1412200913454901042010220335.jpg"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Capture14-12-2009-13.45.4901-04-2010-22.03.35" src="http://fakhrulz.com/wordpress/wp-content/uploads/2010/04/capture1412200913454901042010220335-thumb.jpg" border="0" alt="Capture14-12-2009-13.45.4901-04-2010-22.03.35" width="353" height="297" /></a></p>
<p>3. Insert a new item, Local Database. Then click Add.</p>
<p><a rel="WLPP" href="http://fakhrulz.com/wordpress/wp-content/uploads/2010/04/capture1412200913454901042010220507.jpg"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Capture14-12-2009-13.45.4901-04-2010-22.05.07" src="http://fakhrulz.com/wordpress/wp-content/uploads/2010/04/capture1412200913454901042010220507-thumb.jpg" border="0" alt="Capture14-12-2009-13.45.4901-04-2010-22.05.07" width="687" height="418" /></a></p>
<p><em>* Click cancel at Data Source Configuration Wizard, since we will not using this wizard for now.</em></p>
<p>4. Create table and columns like below.</p>
<p><a rel="WLPP" href="http://fakhrulz.com/wordpress/wp-content/uploads/2010/04/capture1412200913454901042010220814.jpg"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Capture14-12-2009-13.45.4901-04-2010-22.08.14" src="http://fakhrulz.com/wordpress/wp-content/uploads/2010/04/capture1412200913454901042010220814-thumb.jpg" border="0" alt="Capture14-12-2009-13.45.4901-04-2010-22.08.14" width="708" height="572" /></a></p>
<p>5. Add reference “System.Data.SqlServerCe”.</p>
<p><a rel="WLPP" href="http://fakhrulz.com/wordpress/wp-content/uploads/2010/04/capture1412200913454901042010220951.jpg"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Capture14-12-2009-13.45.4901-04-2010-22.09.51" src="http://fakhrulz.com/wordpress/wp-content/uploads/2010/04/capture1412200913454901042010220951-thumb.jpg" border="0" alt="Capture14-12-2009-13.45.4901-04-2010-22.09.51" width="471" height="387" /></a></p>
<p>6. Add this code at button Add.</p>
<div id="scid:812469c5-0cb0-4c63-8c15-c81123a09de7:f7d11923-ac88-439a-b1d1-341ed75f3078" class="wlWriterEditableSmartContent" style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px">
<pre class="c#">private void btnAdd_Click(object sender, EventArgs e)
{
    string fileName = "Database1.sdf";
    string password = "";
    string connectionString = string.Format("DataSource=\"{0}\"; Password='{1}'", fileName, password);

    string sql = "insert into ValueList (ValueData) values ('" + txtValue.Text + "')";

    SqlCeConnection cn = null;
    try
    {
        cn = new SqlCeConnection(connectionString);

        SqlCeCommand cmd = new SqlCeCommand(sql, cn);

        if (cn.State == ConnectionState.Open)
            cn.Close();

        cn.Open();
        cmd.ExecuteNonQuery();
        MessageBox.Show("Data added");
    }
    catch (Exception ex)
    {
        MessageBox.Show(ex.Message);
    }
    finally
    {
        if (cn != null)
            cn.Close();
    }
}</pre>
</div>
<p>7. Add this code at button Refresh.</p>
<div id="scid:812469c5-0cb0-4c63-8c15-c81123a09de7:6b3318ca-239c-438d-bfa3-139334d85686" class="wlWriterEditableSmartContent" style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px">
<pre class="c#">private void btnRefresh_Click(object sender, EventArgs e)
 {
     string fileName = "Database1.sdf";
     string password = "";
     string connectionString = string.Format("DataSource=\"{0}\"; Password='{1}'", fileName, password);

     string sql = "select * from ValueList";

     SqlCeConnection cn = null;
     try
     {
         cn = new SqlCeConnection(connectionString);

         SqlCeCommand cmd = new SqlCeCommand(sql, cn);

         if (cn.State == ConnectionState.Open)
             cn.Close();

         cn.Open();
         SqlCeDataReader scdr = cmd.ExecuteReader();

         listView1.Items.Clear();
         while (scdr.Read())
         {
             listView1.Items.Add(new ListViewItem(new string[] {scdr.GetInt32(0).ToString(), scdr.GetString(1)}));
         }
         scdr.Close();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
     finally
     {
         if (cn != null)
             cn.Close();
     }
 }</pre>
</div>
<p>8. You are done.</p>
<img src="http://feeds.feedburner.com/~r/Fakhrulz/~4/wmtWQA51Mmw" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://fakhrulz.com/wordpress/?feed=rss2&amp;p=757</wfw:commentRss>
		<feedburner:origLink>http://fakhrulz.com/wordpress/?p=757</feedburner:origLink></item>
		<item>
		<title>Boot, Format, and install Windows using USB Thumb/Flash Drive with WinToFlash</title>
		<link>http://feedproxy.google.com/~r/Fakhrulz/~3/r5CVnkYM8Bs/</link>
		<comments>http://fakhrulz.com/wordpress/?p=746#comments</comments>
		<pubDate>Fri, 19 Feb 2010 07:24:25 +0000</pubDate>
		<dc:creator>fakhrul</dc:creator>
		
		<category><![CDATA[Tools]]></category>

		<guid isPermaLink="false">http://fakhrulz.com/wordpress/?p=746</guid>
		<description><![CDATA[ Just find out this trick from Chips Magazines. It’s very helpful to reinstall the Windows XP OS from USB. My Industrial PC don’t have CD-ROM, Floppy even the IDE slot. So now, I can reinstall it using my DTmini Thumb/Flash Drive.
&#160;
How you can do that ?
1. Download and Run WinToFlash. 
2. Follow the step [...]]]></description>
			<content:encoded><![CDATA[<p><img style="margin: 0px 10px 0px 0px; display: inline" align="left" src="http://www.kingston.com/channelmarketingcenter/flash/product_images/dtm10/DTM10_badge.jpg" /> Just find out this trick from <a href="http://www.chip.com.my/">Chips Magazines</a>. It’s very helpful to reinstall the Windows XP OS from USB. My Industrial PC don’t have CD-ROM, Floppy even the IDE slot. So now, I can reinstall it using my <a href="http://www.kingston.com/flash/dtm10.asp">DTmini Thumb/Flash Drive</a>.</p>
<p>&#160;</p>
<p>How you can do that ?</p>
<p>1. Download and Run <a href="http://wintoflash.com/home/en/">WinToFlash</a>. </p>
<p>2. Follow the step by step from <a href="http://komku.blogspot.com/2009/09/wintoflash-guide-install-windows-xp.html">here</a>.</p>
<p>3. Now you already have the bootable USB.</p>
<p>4. But before you format the PC, maybe you need to retrieve your current Windows XP product key. You can use this <a href="http://magicaljellybean.com/keyfinder/">Magical Jelly Bean Keyfinder</a>.</p>
<p>&#160;</p>
<p>* Please make sure your USB-HDD are available at your BIOS. </p>
<img src="http://feeds.feedburner.com/~r/Fakhrulz/~4/r5CVnkYM8Bs" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://fakhrulz.com/wordpress/?feed=rss2&amp;p=746</wfw:commentRss>
		<feedburner:origLink>http://fakhrulz.com/wordpress/?p=746</feedburner:origLink></item>
		<item>
		<title>Trip to Cameron Highlands</title>
		<link>http://feedproxy.google.com/~r/Fakhrulz/~3/3sPIuxZP6g8/</link>
		<comments>http://fakhrulz.com/wordpress/?p=745#comments</comments>
		<pubDate>Sun, 03 Jan 2010 05:15:36 +0000</pubDate>
		<dc:creator>fakhrul</dc:creator>
		
		<category><![CDATA[Blog]]></category>

		<guid isPermaLink="false">http://fakhrulz.com/wordpress/?p=745</guid>
		<description><![CDATA[

Alhamdulillah, rancangan aku nak ke Cameron Highlands dah tertunai jugak. Dah lama aku nak ke sana, last aku pegi tahun 1998, dah lebih 10 tahun dah pon. Dulu pegi ngan kawan-kawan. Kali ni pegi dengan wife. Huhu.. maybe next time, boleh pegi dengan anak pulak.&#160; Aku ikut highway PLUS, then exit kat Simpang Pulai. Kalau [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://fakhrulz.com/wordpress/wp-content/uploads/2010/01/img-3980.jpg"><img style="border-right-width: 0px; margin: 5px 15px 0px 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Depan Hill View Inn" border="0" alt="Depan Hill View Inn" align="left" src="http://fakhrulz.com/wordpress/wp-content/uploads/2010/01/img-3980-thumb.jpg" width="184" height="244" /></a></p>
<p><a href="http://fakhrulz.com/wordpress/wp-content/uploads/2010/01/img-3751.jpg"><img style="border-right-width: 0px; margin: 5px 0px 0px 10px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="IMG_3751" border="0" alt="IMG_3751" align="right" src="http://fakhrulz.com/wordpress/wp-content/uploads/2010/01/img-3751-thumb.jpg" width="244" height="184" /></a></p>
<p>Alhamdulillah, rancangan aku nak ke <a href="http://maps.google.com/maps?f=q&amp;source=s_q&amp;hl=en&amp;geocode=&amp;q=Cameron+Highlands&amp;ie=UTF8&amp;hq=&amp;hnear=Cameron+Highlands,+Malaysia&amp;t=h&amp;z=11">Cameron Highlands</a> dah tertunai jugak. Dah lama aku nak ke sana, last aku pegi tahun 1998, dah lebih 10 tahun dah pon. Dulu pegi ngan kawan-kawan. Kali ni pegi dengan wife. Huhu.. maybe next time, boleh pegi dengan anak pulak.&#160; Aku ikut highway PLUS, then exit kat Simpang Pulai. Kalau exit ikut Tapah pon boleh, tapi jalan kat situ tak berapa selesa sangat. Jalan dia sempit sket. </p>
<p>&#160;</p>
<p>Trip kali ni pegi 3 hari 2 malam. Bertolak 25/12 sampai la 27/12. Kitorang stay <a href="http://www.hillview-inn.com/Home.html">kat Hill View Inn</a>, Tanah Rata. Rate bilik kira ok la. During peak season ni, RM160 per room per night. So total spent untuk hotel ni RM 320 untuk 2 malam. </p>
<p>&#160;</p>
<p><a href="http://fakhrulz.com/wordpress/wp-content/uploads/2010/01/img-3821.jpg"><img style="border-right-width: 0px; margin: 0px 0px 0px 10px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="IMG_3821" border="0" alt="IMG_3821" align="right" src="http://fakhrulz.com/wordpress/wp-content/uploads/2010/01/img-3821-thumb.jpg" width="244" height="184" /></a><a href="http://fakhrulz.com/wordpress/wp-content/uploads/2010/01/img-3830.jpg"><img style="border-right-width: 0px; margin: 0px 0px 0px 10px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="IMG_3830" border="0" alt="IMG_3830" align="right" src="http://fakhrulz.com/wordpress/wp-content/uploads/2010/01/img-3830-thumb.jpg" width="244" height="184" /></a>So, destinasi pertama kitorang ialah, tea plantantion kat <a href="http://www.bharattea.com.my/">Cameron Valley</a>. Location nya kat Tanah Rata. Lebih kurang 2 km dari hotel. Kitorang sampai sana pukul 8 pagi, huhu. We are the first visitor on that day. Kedai pon baru bukak. :). </p>
<p>&#160;</p>
<p><a href="http://www.cameronhighlandsinfo.com/attraction/Healthy_Strawberry_Farm/">Healthy Strawberry Farm</a>, <a href="http://www.cameronhighlandsinfo.com/attraction/big_red_strawberry_farm/">Big Red Strawberry Farm</a>, <a href="http://www.cameron-highland-destination.com/highlands-sights-cactus-valley.html">Cactus Point</a>, <a href="http://www.cameron-highlands.com/main-attractions/main-category/pasar-malam.html">Pasar Malam Berinchang</a>, dan <a href="http://www.greenviewgarden.com/straw.htm">Green View Garden</a>. Semua ni tempat-tempat menarik kat Cameron Highland yang kitorang sempat pergi. </p>
<p>&#160;</p>
<p>&#160;</p>
<p><a href="http://fakhrulz.com/wordpress/wp-content/uploads/2010/01/img-37511.jpg"></a></p>
<p><a href="http://fakhrulz.com/wordpress/wp-content/uploads/2010/01/img-37511.jpg"></a></p>
</p>
<p><a href="http://fakhrulz.com/wordpress/wp-content/uploads/2010/01/img-37512.jpg">&#160;</a></p>
</p>
<div style="padding-bottom: 0px; margin: 0px auto; padding-left: 0px; width: 759px; padding-right: 0px; display: block; float: none; padding-top: 0px" id="scid:66721397-FF69-4ca6-AEC4-17E6B3208830:dfbcc1e3-459a-429c-a15c-3de0ed315a61" class="wlWriterEditableSmartContent"><a style="border:0px" href="http://cid-839da7bf8decd9c5.skydrive.live.com/redir.aspx?page=browse&amp;resid=839DA7BF8DECD9C5!252&amp;ct=photos"><img style="border:0px" alt="View 20091225 - Trip to Cameron Highland" src="http://fakhrulz.com/wordpress/wp-content/uploads/2010/01/inlinerepresentationfc6354760c0b490caf2dbea50c4bc1bb.jpg" /></a>
<div style="width:759px;text-align:right;" ><a href="http://cid-839da7bf8decd9c5.skydrive.live.com/redir.aspx?page=browse&amp;resid=839DA7BF8DECD9C5!252&amp;ct=photos">View Full Album</a></div>
</div>
<p>Apa2 pon, trip kali ni best gila. (Maybe sbb pegi ngan wife kot <img src='http://fakhrulz.com/wordpress/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> ). Sampai rumah je, terus pikir untuk next trip. Hehe. Destinasi belum di ketahui lagi. </p>
<p>&#160;</p>
<p><a href="http://www.tripit.com/trip/public/id/04A09C4DD3DD">Trip It</a></p>
<img src="http://feeds.feedburner.com/~r/Fakhrulz/~4/3sPIuxZP6g8" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://fakhrulz.com/wordpress/?feed=rss2&amp;p=745</wfw:commentRss>
		<feedburner:origLink>http://fakhrulz.com/wordpress/?p=745</feedburner:origLink></item>
		<item>
		<title>Managed/Unmanaged Code Interoperability</title>
		<link>http://feedproxy.google.com/~r/Fakhrulz/~3/oWNaYJXYvSw/</link>
		<comments>http://fakhrulz.com/wordpress/?p=730#comments</comments>
		<pubDate>Wed, 23 Dec 2009 03:27:10 +0000</pubDate>
		<dc:creator>fakhrul</dc:creator>
		
		<category><![CDATA[Blog]]></category>

		<guid isPermaLink="false">http://fakhrulz.com/wordpress/?p=730</guid>
		<description><![CDATA[I just read the article here regarding to the managed and unmanaged code interoperability. Below is the summary.
&#160; 

 Call unmanaged APIs from managed code

This can be done for both flat APIs (eg. kernel32.dll and user32.dll) and COM APIs (eg. Microsoft® Word, Excel).


Expose managed APIs to unmanaged code
Examples of doing this include creating an add-in [...]]]></description>
			<content:encoded><![CDATA[<p>I just read the article <a href="http://msdn.microsoft.com/en-us/library/ms973872.aspx">here</a> regarding to the managed and unmanaged code interoperability. Below is the summary.</p>
<p>&#160; </p>
<p><b></b></p>
<p> <b>Call unmanaged APIs from managed code</b>
</p>
<p>This can be done for both flat APIs (eg. kernel32.dll and user32.dll) and COM APIs (eg. Microsoft® Word, Excel).</p>
<p><b></b></p>
<p><b></b></p>
<p><b>Expose managed APIs to unmanaged code</b></p>
<p>Examples of doing this include creating an <b>add-in for a COM-based application</b> like Windows Media® Player or embedding a managed Windows Forms control on an MFC form.</p>
<p>&#160;</p>
<h3>1. Guidelines</h3>
<h6></h6>
<h6>&#160;</h6>
<h4>Call unmanaged APIs from managed code</h4>
<p><b>Calling Unmanaged Flat APIs </b></p>
<p>There are two mechanisms for calling into unmanaged flat APIs from managed code: through <a href="http://msdn.microsoft.com/en-us/library/ms973872.aspx#manunman_pinvoke">Platform Invoke</a> (available in all managed languages) or through C++ interop (available in C++).</p>
<p>1. For calling just a few unmanaged methods or for calling simple flat APIs, the suggestion is to use <b><a href="http://www.pinvoke.net/">platform invoke</a>.</b></p>
<p>2. For wrapping complex unmanaged flat APIs, or for wrapping unmanaged flat APIs that are changing while managed code is under development, the suggestion is to use <b><a href="http://www.codeproject.com/KB/mcpp/ManagedCPPInterop.aspx">C++ interop</a>.</b></p>
<p>&#160;</p>
<p><b></b></p>
<p><b></b></p>
<p><b>Calling COM APIs </b></p>
<p>There are two ways to call COM components from managed code: through COM interop (available in all managed languages) or through C++ interop (available in C++).</p>
<p>1. For calling OLE Automation-compatible COM components, the suggestion is to use <b><a href="http://msdn.microsoft.com/en-us/library/kew41ycz%28VS.71%29.aspx">COM interop</a></b>.</p>
<p>2. For calling COM components based on Interface Definition Language (IDL), the suggestion is to use <b>C++ interop</b>.</p>
<p><b></b></p>
<h6>&#160;</h6>
<h4>Exposing Managed APIs to Unmanaged Code</h4>
<p><b></b></p>
<p><b>Directly Accessing a Managed API</b></p>
<p>If an unmanaged client is written in C++, it can be <b>compiled with the Visual Studio .NET C++ compiler as a &quot;mixed mode image.&quot;</b> After this is done, the unmanaged client can directly access any managed API. However, some coding rules do apply to accessing managed objects from unmanaged code; check the C++ documentation for more details.</p>
<p>&#160;</p>
<p><b></b></p>
<p><b></b></p>
<p><b>Exposing a Managed API as a COM API</b></p>
<p>Every public managed class can be exposed to unmanaged clients through <b>COM interop</b>.</p>
<p>&#160;</p>
<p><b></b></p>
<p><b></b></p>
<p><b>Exposing a Managed API as a Flat API</b></p>
<p>Expose your managed API as a flat API only if absolutely necessary. If you have no choice, be sure to check the C++ documentation and be fully aware of all the limitations.</p>
<p>&#160;</p>
<h3>2. Performance</h3>
<p>&#160;</p>
<p>With every transition from managed code to unmanaged code (and vice versa), there is some performance overhead. The amount of overhead depends on the types of parameters used. The CLR interop layer uses three levels of interop call optimization based on transition type and parameter types: just-in-time (JIT) inlining, compiled assembly stubs, and interpreted marshaling stubs (in order of fastest to slowest type of call). <b></b></p>
<blockquote><p><b>Approximate overhead for a platform invoke call: 10 machine instructions (on an x86 processor)</b><b></b></p>
</blockquote>
<blockquote><p><b>Approximate overhead for a COM interop call: 50 machine instructions (on an x86 processor)</b></p>
</blockquote>
<p>&#160;</p>
<p>1. If you control the interface between managed and unmanaged code, <b>make it &quot;chunky&quot; rather than &quot;chatty,&quot;</b> to reduce the total number of transitions made.<b></b></p>
<p><b>&#160;&#160;&#160;&#160; Chatty</b> interfaces are interfaces that make a lot of transitions without performing any significant work.<b></b></p>
<p><b>&#160;&#160;&#160;&#160; Chunky</b> interfaces are interfaces that make only a few transitions, and the amount of work done on the other side of the boundary is significant.</p>
<p>&#160;</p>
<p>2.&#160; Avoid Unicode/ANSI conversions if possible.</p>
<p>&#160;</p>
<p>3. For high-performance scenarios, declaring parameters and fields as <b>IntPtr</b> can boost performance, albeit at the expense of ease-of-use and maintainability.</p>
<p>&#160;</p>
<p>4. Sometimes it is faster to do manual marshaling using methods available on the <b>Marshal</b> class, rather than rely on default interop marshaling. For example, if large arrays of strings must be passed across an interop boundary, but only a few elements will be needed, declaring the array as an <b>IntPtr</b> and accessing only those few elements manually will be much faster.</p>
<p>&#160;</p>
<p>5. Use <b>InAttribute</b> and <b>OutAttribute</b> wisely to reduce unnecessary marshaling.</p>
<p>&#160;</p>
<p>6. The interop marshaler uses default rules when deciding if a certain parameter needs to be marshaled in before the call and marshaled out after the call. These rules are based on the level of indirection and the parameter type. Some of these operations might not be necessary depending on the method&#8217;s semantics.</p>
<p>&#160;</p>
<p>7. Use <b>SetLastError=false</b> on platform invoke signatures only if you will call <b>Marshal.GetLastWin32Error</b> afterwards.</p>
<p>&#160;</p>
<p>8. Setting <b>SetLastError=true</b> on platform invoke signatures requires additional work from the interop layer to preserve the last error code. Use this feature only when you rely on this information and will use it after you make the call.</p>
<p>&#160;</p>
<p>9. If, and only if, unmanaged calls are exposed in a non-exploitable fashion, use <b>SuppressUnmanagedCodeSecurityAttribute</b> to reduce the number of security checks.</p>
<p>&#160;</p>
<p><b>References:</b></p>
<p><a href="http://msdn.microsoft.com/en-us/library/ms973872.aspx">http://msdn.microsoft.com/en-us/library/ms973872.aspx</a></p>
<p><a href="http://msdn.microsoft.com/en-us/library/aa720203%28VS.71%29.aspx">http://msdn.microsoft.com/en-us/library/aa720203%28VS.71%29.aspx</a></p>
<p><a href="http://msdn.microsoft.com/en-us/library/bb985764.aspx">http://msdn.microsoft.com/en-us/library/bb985764.aspx</a></p>
<p><a href="http://www.codeproject.com/KB/COM/comintro.aspx">http://www.codeproject.com/KB/COM/comintro.aspx</a></p>
<img src="http://feeds.feedburner.com/~r/Fakhrulz/~4/oWNaYJXYvSw" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://fakhrulz.com/wordpress/?feed=rss2&amp;p=730</wfw:commentRss>
		<feedburner:origLink>http://fakhrulz.com/wordpress/?p=730</feedburner:origLink></item>
		<item>
		<title>How to uninstall SQL Server 2005 manually (not from Add or Remove Program)</title>
		<link>http://feedproxy.google.com/~r/Fakhrulz/~3/SuhvloQIdH4/</link>
		<comments>http://fakhrulz.com/wordpress/?p=725#comments</comments>
		<pubDate>Wed, 14 Oct 2009 13:12:10 +0000</pubDate>
		<dc:creator>fakhrul</dc:creator>
		
		<category><![CDATA[Blog]]></category>

		<guid isPermaLink="false">http://fakhrulz.com/wordpress/?p=725</guid>
		<description><![CDATA[
Yesterday, I had facing this problem during my development. I need to reinstall my Sql Server but I cannot see Sql Server in my Add or Remove Program. :(. Thanks to google. I found this solution: 
&#160;
Run the command to uninstall the SQL Server components
 At a command prompt, run the following command:
&#34;%ProgramFiles%\Microsoft SQL Server\90\Setup [...]]]></description>
			<content:encoded><![CDATA[</p>
<p>Yesterday, I had facing this problem during my development. I need to reinstall my Sql Server but I cannot see Sql Server in my Add or Remove Program. :(. Thanks to google. I found this solution: </p>
<p>&#160;</p>
<h5>Run the command to uninstall the SQL Server components</h5>
<p> At a command prompt, run the following command:
<p><b>&quot;%ProgramFiles%\Microsoft SQL Server\90\Setup Bootstrap\ARPWrapper.exe /Remove&quot;</b></p>
<p>&#160;</p>
<p><strong></strong></p>
<p><strong>Reference : </strong><a href="http://support.microsoft.com/?kbid=909967">http://support.microsoft.com/?kbid=909967</a></p>
<img src="http://feeds.feedburner.com/~r/Fakhrulz/~4/SuhvloQIdH4" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://fakhrulz.com/wordpress/?feed=rss2&amp;p=725</wfw:commentRss>
		<feedburner:origLink>http://fakhrulz.com/wordpress/?p=725</feedburner:origLink></item>
		<item>
		<title>Good reason not to wash your car!</title>
		<link>http://feedproxy.google.com/~r/Fakhrulz/~3/ZFQ8O8yr7Hk/</link>
		<comments>http://fakhrulz.com/wordpress/?p=721#comments</comments>
		<pubDate>Mon, 05 Oct 2009 09:15:30 +0000</pubDate>
		<dc:creator>fakhrul</dc:creator>
		
		<category><![CDATA[Blog]]></category>

		<guid isPermaLink="false">http://fakhrulz.com/wordpress/?p=721</guid>
		<description><![CDATA[
&#160;
&#160;
&#160;
&#160;
&#160;
&#160;
&#160;
&#160;
&#160;
&#160;
&#160;
&#160;
&#160;
&#160;
&#160;
&#160;
&#160;
Just found this funny sticker while buying “pisang goreng” near UPM.  . Maybe it’s true also.. Peace
]]></description>
			<content:encoded><![CDATA[<p><a href="http://fakhrulz.com/wordpress/wp-content/uploads/2009/10/image-580.jpg"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="IMAGE_580" border="0" alt="IMAGE_580" align="left" src="http://fakhrulz.com/wordpress/wp-content/uploads/2009/10/image-580-thumb.jpg" width="447" height="336" /></a></p>
<p>&#160;</p>
<p>&#160;</p>
<p>&#160;</p>
<p>&#160;</p>
<p>&#160;</p>
<p>&#160;</p>
<p>&#160;</p>
<p>&#160;</p>
<p>&#160;</p>
<p>&#160;</p>
<p>&#160;</p>
<p>&#160;</p>
<p>&#160;</p>
<p>&#160;</p>
<p>&#160;</p>
<p>&#160;</p>
<p>&#160;</p>
<p>Just found this funny sticker while buying “pisang goreng” near UPM. <img src='http://fakhrulz.com/wordpress/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> . Maybe it’s true also.. Peace</p>
<img src="http://feeds.feedburner.com/~r/Fakhrulz/~4/ZFQ8O8yr7Hk" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://fakhrulz.com/wordpress/?feed=rss2&amp;p=721</wfw:commentRss>
		<feedburner:origLink>http://fakhrulz.com/wordpress/?p=721</feedburner:origLink></item>
		<item>
		<title>Targus Laptop Bag</title>
		<link>http://feedproxy.google.com/~r/Fakhrulz/~3/JGkudvRpo_U/</link>
		<comments>http://fakhrulz.com/wordpress/?p=718#comments</comments>
		<pubDate>Tue, 29 Sep 2009 02:13:25 +0000</pubDate>
		<dc:creator>fakhrul</dc:creator>
		
		<category><![CDATA[Blog]]></category>

		<guid isPermaLink="false">http://fakhrulz.com/wordpress/?p=718</guid>
		<description><![CDATA[I just bought a new laptop bag.  . This is the first laptop bag that I had bought. Before this, I am using a bag that my boss gave to me 3 years ago. And some of the part was broken. 
&#160;
For me, it is necessary to have a comfortable bag. I am travelling [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://fakhrulz.com/wordpress/wp-content/uploads/2009/09/image-579.jpg"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; margin-left: 0px; border-left-width: 0px; margin-right: 0px" title="IMAGE_579" border="0" alt="IMAGE_579" align="right" src="http://fakhrulz.com/wordpress/wp-content/uploads/2009/09/image-579-thumb.jpg" width="180" height="320" /></a><a href="http://fakhrulz.com/wordpress/wp-content/uploads/2009/09/image-578.jpg"><img style="border-right-width: 0px; margin: 0px 15px 0px 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="IMAGE_578" border="0" alt="IMAGE_578" align="right" src="http://fakhrulz.com/wordpress/wp-content/uploads/2009/09/image-578-thumb.jpg" width="180" height="320" /></a>I just bought a new laptop bag. <img src='http://fakhrulz.com/wordpress/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> . This is the first laptop bag that I had bought. Before this, I am using a bag that my boss gave to me 3 years ago. And some of the part was broken. </p>
<p>&#160;</p>
<p>For me, it is necessary to have a comfortable bag. I am travelling a lot lately. Mostly, to Manila. Carrying a heavy notebook and electronic gadgets all over the place is hurting myself. And this is the main reason why I bought this even though my wife said that “It’s expensive” <img src='http://fakhrulz.com/wordpress/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>&#160;</p>
<p>Last week, I went to <a href="http://www.digitalmall.com.my/">Digital Mall, Petaling Jaya</a> and found this bag. It is simple bag with a fewer compartments. There is one big compartment which I can put my mouse, charger, cables, gadgets, and document also. There is also have an audio extension so that I can put the mp3 player inside the bag. But I don’t have mp3 player. :). It’s ok, I will get it soon.&#160; </p>
<p>&#160;</p>
<p><strong>Features:</strong></p>
<ol>
<li>Fits laptops with up to 15.4” wide screens. </li>
<li>A padded laptop compartment to secure and protect your notebook. </li>
<li>Wet compartment for the storage of wet umbrella or towel.&#160; </li>
<li>Headphone extension cable so you can listen to your music whilst keeping your iPod securely tucked away </li>
<li>Hidden security pocket at back panel secures and organize valuables. </li>
<li>Hidden rain cover for convenience. </li>
<li>Contoured padded backing and ergonomic adjustable shoulder straps to reduce strain and add support. </li>
</ol>
<p>&#160;</p>
<p>For the full spec, <a href="http://www.targus.com/my/product_details.asp?sku=TSB111AP">click here</a>.</p>
<img src="http://feeds.feedburner.com/~r/Fakhrulz/~4/JGkudvRpo_U" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://fakhrulz.com/wordpress/?feed=rss2&amp;p=718</wfw:commentRss>
		<feedburner:origLink>http://fakhrulz.com/wordpress/?p=718</feedburner:origLink></item>
		<item>
		<title>A WPF application?  Why?</title>
		<link>http://feedproxy.google.com/~r/Fakhrulz/~3/rlAxu1z4CZw/</link>
		<comments>http://fakhrulz.com/wordpress/?p=709#comments</comments>
		<pubDate>Wed, 05 Aug 2009 01:54:21 +0000</pubDate>
		<dc:creator>fakhrul</dc:creator>
		
		<category><![CDATA[Blog]]></category>

		<guid isPermaLink="false">http://fakhrulz.com/wordpress/?p=709</guid>
		<description><![CDATA[“Windows Presentation Foundation is an extremely powerful set of tools that lets you create richer applications with minimal effort.&#160; I went with WPF over Windows Form applications for the transparency and&#160; glow effect I get for free.&#160; I also have access to another control that did the layout for me too.” – Coding4Fun
&#160;
But unlucky for [...]]]></description>
			<content:encoded><![CDATA[<p>“Windows Presentation Foundation is an extremely powerful set of tools that lets you create richer applications with minimal effort.&#160; I went with WPF over Windows Form applications for the transparency and&#160; glow effect I get for free.&#160; I also have access to another control that did the layout for me too.” – <a href="http://blogs.msdn.com/coding4fun/archive/2009/08/04/9651495.aspx">Coding4Fun</a></p>
<p>&#160;</p>
<p>But unlucky for me, my company still using .NET framework 2.0 with Visual Studio 2005 IDE. There is no chance for me to discover the WPF in deep. To whom it may concern, we are now 5 years behind the technology. Visual Studio 2010 its alread in the market. :(. It’s bad for us.. sigh..</p>
<img src="http://feeds.feedburner.com/~r/Fakhrulz/~4/rlAxu1z4CZw" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://fakhrulz.com/wordpress/?feed=rss2&amp;p=709</wfw:commentRss>
		<feedburner:origLink>http://fakhrulz.com/wordpress/?p=709</feedburner:origLink></item>
		<item>
		<title>.NET Auto Increment Version Number</title>
		<link>http://feedproxy.google.com/~r/Fakhrulz/~3/SlhRuVtOaMk/</link>
		<comments>http://fakhrulz.com/wordpress/?p=708#comments</comments>
		<pubDate>Thu, 30 Jul 2009 06:32:21 +0000</pubDate>
		<dc:creator>fakhrul</dc:creator>
		
		<category><![CDATA[Blog]]></category>

		<guid isPermaLink="false">http://fakhrulz.com/wordpress/?p=708</guid>
		<description><![CDATA[I just found a good tools to auto increment the software revision number when you build the project.
Normally the standard revision number for .NET contains 4 parts :
&#160;
 1 - Major Version    0 - Minor Version      0 - Build Number     1 – Revision
&#160;
So, [...]]]></description>
			<content:encoded><![CDATA[<p>I just found a good tools to auto increment the software revision number when you build the project.</p>
<p>Normally the standard revision number for .NET contains 4 parts :</p>
<p>&#160;</p>
<p> 1 - Major Version   <br /> 0 - Minor Version     <br /> 0 - Build Number    <br /> 1 – Revision</p>
<p>&#160;</p>
<p>So, by default, this tools will auto generate the last 2 portion. The Build Number and the Revision. The Build Number will increase base on the date while the Revision will increase every time you build the project. </p>
<p>&#160;</p>
<p>You can try and get it from <a href="http://code.msdn.microsoft.com/AssemblyInfoTaskvers">here</a>. If it is useful, and it’s good for you.. <img src='http://fakhrulz.com/wordpress/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>&#160;</p>
<p>Others useful links:</p>
<ol>
<li>&#160;<a href="http://www.crowsprogramming.com/archives/27">http://www.crowsprogramming.com/archives/27</a></li>
<li><a href="http://sharplife.net/CommentView,guid,ac681cd4-7861-4916-867b-f1b39bb3037d.aspx#commentstart">http://sharplife.net/CommentView,guid,ac681cd4-7861-4916-867b-f1b39bb3037d.aspx#commentstart</a></li>
</ol>
<img src="http://feeds.feedburner.com/~r/Fakhrulz/~4/SlhRuVtOaMk" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://fakhrulz.com/wordpress/?feed=rss2&amp;p=708</wfw:commentRss>
		<feedburner:origLink>http://fakhrulz.com/wordpress/?p=708</feedburner:origLink></item>
	</channel>
</rss>
