<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:copyright="http://blogs.law.harvard.edu/tech/rss" xmlns:image="http://purl.org/rss/1.0/modules/image/">
    <channel>
        <title>Programming</title>
        <link>http://geekswithblogs.net/mrnat/category/1199.aspx</link>
        <description>Programming</description>
        <language>en-US</language>
        <copyright>Nat Luengnaruemitchai</copyright>
        <managingEditor>mr_nat@hotmail.com</managingEditor>
        <generator>Subtext Version 0.0.0.0</generator>
        <item>
            <title>new DateTime bug^H^H^Hby-design feature with Microsoft's latest patch for Daylight Saving</title>
            <link>http://geekswithblogs.net/mrnat/archive/2007/02/11/106047.aspx</link>
            <description>&lt;P&gt;As Bush's goverument proposed the extension of daylight saving time period, the daylight saving time will start in March and end in November in 2007&amp;nbsp;instead of April and October previously. This will cause a problem for unpatched system not to display time correctly. Therefore, several vendors have provided a patch for their own system including Microsoft. Microsoft released a &lt;A href="http://support.microsoft.com/kb/928388"&gt;KB928388&lt;/A&gt; patch. What this patch does is to modify some registry keys that keep information about time offset and daylight saving information. This information is quite static. It stores time offset, the start of DST (Xth day of week of Yth month as well as the time difference between daylight saving time and regular time). For example, this information has been patched to Second Sunday in March at 02:00:00 and First Sunday in November at 02:00:00 respectively.&lt;/P&gt;
&lt;P&gt;It looks OK right. System has been patched. Life is good. Not so fast, my friends. The operating system before Vista era doesn't really support Dynamic DST (Ability to keep different daylight saving information for different periods.) This means the time will be changed retroactively. For example, &lt;/P&gt;
&lt;P&gt;Before the patch&lt;/P&gt;&lt;FONT color=#2b91af size=2&gt;
&lt;P&gt;TimeZone&lt;/FONT&gt;&lt;FONT size=2&gt;.CurrentTimeZone.GetUtcOffset(&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;new&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#2b91af size=2&gt;DateTime&lt;/FONT&gt;&lt;FONT size=2&gt;(2006, 11, 1)) should return -05:00:00&lt;BR&gt;&lt;FONT color=#2b91af&gt;TimeZone&lt;/FONT&gt;&lt;FONT size=2&gt;.CurrentTimeZone.GetUtcOffset(&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;new&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#2b91af size=2&gt;DateTime&lt;/FONT&gt;&lt;FONT size=2&gt;(2007, 11, 1)) should return -05:00:00&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;FONT size=2&gt;&lt;FONT size=3&gt;
&lt;P&gt;After the patch&lt;/P&gt;
&lt;P&gt;&lt;FONT size=2&gt;&lt;FONT color=#2b91af&gt;TimeZone&lt;/FONT&gt;.CurrentTimeZone.GetUtcOffset(&lt;FONT color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT color=#2b91af&gt;DateTime&lt;/FONT&gt;(2006, 11, 1)) should return -04:00:00&lt;BR&gt;&lt;FONT color=#2b91af&gt;TimeZone&lt;/FONT&gt;.CurrentTimeZone.GetUtcOffset(&lt;FONT color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT color=#2b91af&gt;DateTime&lt;/FONT&gt;(2007, 11, 1)) should return -04:00:00&lt;/FONT&gt;&lt;/P&gt;&lt;FONT size=2&gt;
&lt;P&gt;&lt;FONT size=3&gt;Expected behavior&lt;/FONT&gt;&lt;/P&gt;&lt;/FONT&gt;
&lt;P&gt;&lt;FONT size=2&gt;&lt;FONT color=#2b91af&gt;TimeZone&lt;/FONT&gt;.CurrentTimeZone.GetUtcOffset(&lt;FONT color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT color=#2b91af&gt;DateTime&lt;/FONT&gt;(2006, 11, 1)) should return -05:00:00&lt;BR&gt;&lt;FONT color=#2b91af&gt;TimeZone&lt;/FONT&gt;.CurrentTimeZone.GetUtcOffset(&lt;FONT color=#0000ff&gt;new&lt;/FONT&gt; &lt;FONT color=#2b91af&gt;DateTime&lt;/FONT&gt;(2007, 11, 1)) should return -04:00:00&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;First when I heard about this problem, I couldn't believe my own ears that Microsoft would provide a patch where it will cause a problem somewhere else but it is. The implication of this means if you store the data in UTC timezone to represent datetime, you stored 2006-11-1 12:00:00AM as 2006-11-1 05:00:00 AM previously and when you retrieve it back based on new patch, you will get 2006-11-1 01:00:00AM back instead. So if you search such date in the database probably you won't get anything back. The same problem applied with a case I found recently. We have a system that needs interopability between Java and .NET. We use the native implementation of Date where the DateTime in .NET will be converted into .NET ticks at UTC time sending over to Java side and then Java will convert .NET tick back to milliseconds since epoch and construct java.util.Date object in Java. Everything had been good until recently our beloved administrators installed timezone patch in every machine. One user started complain that she entered 2007-11-1 in the application but it turns out to get data on 2007-10-31 for her instead. What happened was 2007-11-1 in .NET Datetime will be converted into 2007-10-31 11:00PM and it got serialized into XML as 2007-10-31. When the data got transferred to the other side, it will return wrong data back to us. To make the story funnier, although Microsoft provided an API to get dynamic DST in Vista, .NET code seems to use the old function. Therefore it will return wrong timezone information as well. What a compatibility!&lt;/P&gt;
&lt;P&gt;If you have a problem like me, I hope that the information provided here would help you not to spend too much time diagnose what's going on here.&lt;/P&gt;
&lt;P&gt;Thanks&amp;nbsp;&lt;A href="http://www.jnbridge.com/blog"&gt;Citrin Wayne&lt;/A&gt;&amp;nbsp;for providing such responsive help, extensive information, and the great product.&lt;/P&gt;
&lt;P&gt;Reference:&lt;BR&gt;&lt;A class=l onmousedown="return clk(this.href,'','','res','3','')" href="http://msdn2.microsoft.com/en-us/library/ms724253.aspx"&gt;&lt;FONT color=#551a8b&gt;DYNAMIC_TIME_ZONE_INFORMATION&lt;/FONT&gt;&lt;/A&gt;&lt;BR&gt;&lt;A class=l onmousedown="return clk(this.href,'','','res','1','')" href="http://support.microsoft.com/kb/928388"&gt;&lt;FONT color=#551a8b&gt;2007 time zone update for &lt;B&gt;Microsoft&lt;/B&gt; Windows operating systems&lt;/FONT&gt;&lt;/A&gt;&lt;BR&gt;&lt;A href="http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1180416&amp;amp;SiteID=1"&gt;http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1180416&amp;amp;SiteID=1&lt;/A&gt;&lt;BR&gt;&lt;A title="Permanent Link: More about JNBridgePro and the new daylight savings time rules" href="http://www.jnbridge.com/blog/?p=23" rel=bookmark&gt;More about JNBridgePro and the new daylight savings time rules&lt;/A&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=106047"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=106047" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/mrnat/aggbug/106047.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Nat Luengnaruemitchai</dc:creator>
            <guid>http://geekswithblogs.net/mrnat/archive/2007/02/11/106047.aspx</guid>
            <pubDate>Sun, 11 Feb 2007 10:40:00 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/mrnat/comments/106047.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/mrnat/archive/2007/02/11/106047.aspx#feedback</comments>
            <slash:comments>2</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/mrnat/comments/commentRss/106047.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/mrnat/services/trackbacks/106047.aspx</trackback:ping>
        </item>
        <item>
            <title>.NET WebBrowser.Url and Uri Misuse</title>
            <link>http://geekswithblogs.net/mrnat/archive/2006/10/24/95008.aspx</link>
            <description>Many times, people use Uri.ToString() to convert Uri back into String. However, based on the &lt;A href="http://msdn2.microsoft.com/en-us/library/system.uri.tostring.aspx"&gt;documentation&lt;/A&gt;, ToString() actually returns the canonical string representation of the actual URL. This means the special characters that were previously escaped will be unescaped. If you try to use a string that returns from the function, it will be ok in most case except when you have escaped characters in there such as "%20" (" "), "%2b" ("+"), "%25 ("%"), etc. To make the code works right, you should actually use Uri.AbsoluteUri to return back the right representation of the URL itself. I found that WebBrowser.Url actually uses Uri.ToString() which prohibits users to pass in escaped characters as parts of URL. I hope that one day, it will be fixed.... hopefully in .NET 3.0?&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=95008"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=95008" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/mrnat/aggbug/95008.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Nat Luengnaruemitchai</dc:creator>
            <guid>http://geekswithblogs.net/mrnat/archive/2006/10/24/95008.aspx</guid>
            <pubDate>Tue, 24 Oct 2006 15:05:00 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/mrnat/comments/95008.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/mrnat/archive/2006/10/24/95008.aspx#feedback</comments>
            <slash:comments>2</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/mrnat/comments/commentRss/95008.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/mrnat/services/trackbacks/95008.aspx</trackback:ping>
        </item>
        <item>
            <title>Eclipse 3.2 Tomorrow</title>
            <link>http://geekswithblogs.net/mrnat/archive/2006/06/29/83628.aspx</link>
            <description>I'm an Intelli-J IDEA fan, but I will give it a try when Eclipse 3.2 is out tomorrow. &lt;A href="http://www.eclipse.org/org/press-release/20060626callisto.php"&gt;http://www.eclipse.org/org/press-release/20060626callisto.php&lt;/A&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=83628"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=83628" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/mrnat/aggbug/83628.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Nat Luengnaruemitchai</dc:creator>
            <guid>http://geekswithblogs.net/mrnat/archive/2006/06/29/83628.aspx</guid>
            <pubDate>Thu, 29 Jun 2006 11:10:00 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/mrnat/comments/83628.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/mrnat/archive/2006/06/29/83628.aspx#feedback</comments>
            <slash:comments>2</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/mrnat/comments/commentRss/83628.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/mrnat/services/trackbacks/83628.aspx</trackback:ping>
        </item>
        <item>
            <title>Application.EnableVisualStyles() haunted me again</title>
            <link>http://geekswithblogs.net/mrnat/archive/2006/04/27/76609.aspx</link>
            <description>&lt;P&gt;Recently, I changed my code to use Application.EnableVisualStyles() in .NET 2.0 and believed that most of the bugs that existed with .NET 1.1 should be fixed already. So I got a new exception AccessViolationException a lot recently and tried to locate the cause but without luck. I think it must happen because of this. I will try to remove it and see what happens.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=76609"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=76609" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/mrnat/aggbug/76609.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Nat Luengnaruemitchai</dc:creator>
            <guid>http://geekswithblogs.net/mrnat/archive/2006/04/27/76609.aspx</guid>
            <pubDate>Thu, 27 Apr 2006 10:30:00 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/mrnat/comments/76609.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/mrnat/archive/2006/04/27/76609.aspx#feedback</comments>
            <slash:comments>1</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/mrnat/comments/commentRss/76609.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/mrnat/services/trackbacks/76609.aspx</trackback:ping>
        </item>
        <item>
            <title>/dev/random and its lack of entropy</title>
            <link>http://geekswithblogs.net/mrnat/archive/2006/03/12/72144.aspx</link>
            <description>&lt;P&gt;A week ago, my colleague encountered a weird bug where a SOAP call via AXIS stopped responding and it kept hanging. Interestingly, this problem never happened on the other box or in windows machine. We dumped the stacktrace and found that SecureRandom implementation of JSSE is the part of the problem. A quick check via google yields something about /dev/random. It seems that Linux Kernel 2.4.X seems to have a problem with /dev/random. After it dumped out a couple hundreds bits, it will just block the stream as it seemed to wait for more entropy. However, it never gave any more bytes from the stream at all. To fix this problem, we had to set system property called &amp;#8220;java.security.egd&amp;#8221; to use /dev/urandom instead to solve this problem.&lt;/P&gt;
&lt;P&gt;The other ways to solve this problem are&lt;/P&gt;
&lt;P&gt;1. Use J2SE 1.5 as its JSSE uses /dev/urandom instead.&lt;/P&gt;
&lt;P&gt;2. Upgrade kernel to 2.6. This problem seems to be fixed in 2.6 kernel.&lt;/P&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=72144"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=72144" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/mrnat/aggbug/72144.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Nat Luengnaruemitchai</dc:creator>
            <guid>http://geekswithblogs.net/mrnat/archive/2006/03/12/72144.aspx</guid>
            <pubDate>Sun, 12 Mar 2006 11:38:00 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/mrnat/comments/72144.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/mrnat/archive/2006/03/12/72144.aspx#feedback</comments>
            <slash:comments>1</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/mrnat/comments/commentRss/72144.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/mrnat/services/trackbacks/72144.aspx</trackback:ping>
        </item>
        <item>
            <title>VS 2005 September CTP is out!</title>
            <link>http://geekswithblogs.net/mrnat/archive/2005/09/12/53588.aspx</link>
            <description>Look forward to RTM version!!!!! Download it @ MSDN Subscriber Download.&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=53588"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=53588" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/mrnat/aggbug/53588.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Nat Luengnaruemitchai</dc:creator>
            <guid>http://geekswithblogs.net/mrnat/archive/2005/09/12/53588.aspx</guid>
            <pubDate>Mon, 12 Sep 2005 11:09:00 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/mrnat/comments/53588.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/mrnat/archive/2005/09/12/53588.aspx#feedback</comments>
            <wfw:commentRss>http://geekswithblogs.net/mrnat/comments/commentRss/53588.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/mrnat/services/trackbacks/53588.aspx</trackback:ping>
        </item>
        <item>
            <title>ImageAnimator deadlock</title>
            <link>http://geekswithblogs.net/mrnat/archive/2005/08/26/51107.aspx</link>
            <description>&lt;P&gt;I just used ImageAnimator class for the first time. And I ran into a problem pretty quickly. &lt;/P&gt;
&lt;P&gt;First, OnFocusChanged eventhandler will be fired from another thread handled by ImageAnimator =&amp;gt; which is not a UI thread. So any UI operations are called in the event handler, you need to use Control.Invoke to call back into UI thread.&lt;/P&gt;
&lt;P&gt;Second, every time OnFocusChanged&amp;nbsp;is called, it will make a lock using ReaderWriterLock. This worked fine until I made a callback using Control.Invoke. The deadlock appeared. I tracked down and found that there is one PictureBox using ImageAnimator as well and it is trying to Dispose itself which called ImageAnimator.StopAnimator on UI Thread. StopAnimator will try to get a writer lock which my OnFocusChanged has a reader lock on this. The problem is that OnFocusChanged will push a message into UI thread to update my image. But the message is after the operation to StopAnimator. So StopAnimator is waiting for lock while OnFocusChanged wait for Invoke to finish. Boom, the deadlock appeared. To solve this, easy, just change Control.Invoke to Control.BeginInvoke. So OnFocusChanged won't have to wait until the update part is done.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=51107"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=51107" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/mrnat/aggbug/51107.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Nat Luengnaruemitchai</dc:creator>
            <guid>http://geekswithblogs.net/mrnat/archive/2005/08/26/51107.aspx</guid>
            <pubDate>Thu, 25 Aug 2005 20:57:00 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/mrnat/comments/51107.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/mrnat/archive/2005/08/26/51107.aspx#feedback</comments>
            <slash:comments>1</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/mrnat/comments/commentRss/51107.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/mrnat/services/trackbacks/51107.aspx</trackback:ping>
        </item>
        <item>
            <title>ContextLoader problem</title>
            <link>http://geekswithblogs.net/mrnat/archive/2005/08/26/51106.aspx</link>
            <description>&lt;P&gt;Yesterday, I came across a problem where I host JVM inside a process and use JNI to connect to JVM. Usually it should work fine. However, when you spin off a new thread from unmanaged world and make a JNI call into Java code that uses ClassLoader. That's where I ran into the problem. Since the thread is instantiated outside JVM, therefore, Thread.currentThread().getContextClassLoader() is not set properly. It would be defaulted to System/Bootstrap ClassLoader instead. Therefore, it cannot find the class&amp;nbsp;it has to load.&lt;/P&gt;
&lt;P&gt;To solve this problem, I kept a reference of ClassLoader which I got from Thread.currentThread().getContextClassLoader() and set it to the new thread I created before making a call into Java code.&lt;/P&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=51106"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=51106" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/mrnat/aggbug/51106.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Nat Luengnaruemitchai</dc:creator>
            <guid>http://geekswithblogs.net/mrnat/archive/2005/08/26/51106.aspx</guid>
            <pubDate>Thu, 25 Aug 2005 20:45:00 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/mrnat/comments/51106.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/mrnat/archive/2005/08/26/51106.aspx#feedback</comments>
            <slash:comments>1</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/mrnat/comments/commentRss/51106.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/mrnat/services/trackbacks/51106.aspx</trackback:ping>
        </item>
        <item>
            <title>What Would You Do When You Have Limited Time To Develop An Application?</title>
            <link>http://geekswithblogs.net/mrnat/archive/2005/06/16/44020.aspx</link>
            <description>&lt;P&gt;I would like to get a poll. When you are in a project that has a tight time constraint and you have some poor existing code base, what would you do? Are you going to leave it as is and get stuff done or refactor it all the way? Which way do you think will make the project done earlier? Why do you think so?&lt;/P&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=44020"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=44020" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/mrnat/aggbug/44020.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Nat Luengnaruemitchai</dc:creator>
            <guid>http://geekswithblogs.net/mrnat/archive/2005/06/16/44020.aspx</guid>
            <pubDate>Thu, 16 Jun 2005 14:19:00 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/mrnat/comments/44020.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/mrnat/archive/2005/06/16/44020.aspx#feedback</comments>
            <slash:comments>1</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/mrnat/comments/commentRss/44020.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/mrnat/services/trackbacks/44020.aspx</trackback:ping>
        </item>
        <item>
            <title>Composite UI Application Block : Code Drop 2</title>
            <link>http://geekswithblogs.net/mrnat/archive/2005/06/16/44018.aspx</link>
            <description>&lt;P&gt;The new code drop of Composite UI Application Block is out. You can download it &lt;A href="http://www.gotdotnet.com/workspaces/workspace.aspx?id=22f72167-af95-44ce-a6ca-f2eafbf2653c"&gt;here&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;Now most of core code has been working including EventBroker, Module Loader. Also there are some documentation and quickstart available to get you guys start playing with this quickly. Thanks for &lt;A href="http://blogs.msdn.com/eugeniop/default.aspx"&gt;&lt;SPAN style="BORDER-BOTTOM-STYLE: groove"&gt;Eugeniop&lt;/SPAN&gt;&lt;/A&gt;, &lt;A href="http://www.peterprovost.org/"&gt;&lt;SPAN style="BORDER-BOTTOM-STYLE: groove"&gt;Peter&lt;/SPAN&gt;&lt;/A&gt; and other people for pushing this out.&lt;/P&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=44018"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=44018" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/mrnat/aggbug/44018.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Nat Luengnaruemitchai</dc:creator>
            <guid>http://geekswithblogs.net/mrnat/archive/2005/06/16/44018.aspx</guid>
            <pubDate>Thu, 16 Jun 2005 14:03:00 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/mrnat/comments/44018.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/mrnat/archive/2005/06/16/44018.aspx#feedback</comments>
            <slash:comments>1</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/mrnat/comments/commentRss/44018.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/mrnat/services/trackbacks/44018.aspx</trackback:ping>
        </item>
    </channel>
</rss>