<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments for ChiaoCheng.com</title>
	<atom:link href="http://www.chiaocheng.com/comments/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.chiaocheng.com</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Wed, 13 Jan 2010 02:19:58 -0800</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>Comment on Modern Warfare 2: Released but not recommended by Joe</title>
		<link>http://www.chiaocheng.com/2009/11/modern-warfare-2-released-but-not-recommended/comment-page-1/#comment-273</link>
		<dc:creator>Joe</dc:creator>
		<pubDate>Wed, 13 Jan 2010 02:19:58 +0000</pubDate>
		<guid isPermaLink="false">http://www.chiaocheng.com/?p=254#comment-273</guid>
		<description>Chiao.  It&#039;s time to get a PS3 with MW2.  Come over for a test drive.</description>
		<content:encoded><![CDATA[<p>Chiao.  It&#8217;s time to get a PS3 with MW2.  Come over for a test drive.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Modern Warfare 2: Released but not recommended by mrsleep</title>
		<link>http://www.chiaocheng.com/2009/11/modern-warfare-2-released-but-not-recommended/comment-page-1/#comment-250</link>
		<dc:creator>mrsleep</dc:creator>
		<pubDate>Fri, 25 Dec 2009 23:23:15 +0000</pubDate>
		<guid isPermaLink="false">http://www.chiaocheng.com/?p=254#comment-250</guid>
		<description>You&#039;re wrong about the dedicated servers. Infinity Ward wouldn&#039;t have had servers set up anyways. In the CS/TF2 community, the servers are mostly clan run, with some fan run servers, the dedicated server allows this.

What this means is that you cannot run modded versions of the game, like something with low gravity, or no reload, or all crits. Or with custom maps.
The good part is that it makes it harder to run hacks.

But I dont think thats worth not having dedicated servers.</description>
		<content:encoded><![CDATA[<p>You&#8217;re wrong about the dedicated servers. Infinity Ward wouldn&#8217;t have had servers set up anyways. In the CS/TF2 community, the servers are mostly clan run, with some fan run servers, the dedicated server allows this.</p>
<p>What this means is that you cannot run modded versions of the game, like something with low gravity, or no reload, or all crits. Or with custom maps.<br />
The good part is that it makes it harder to run hacks.</p>
<p>But I dont think thats worth not having dedicated servers.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Java Singleton by chiao</title>
		<link>http://www.chiaocheng.com/java-singleton/comment-page-1/#comment-181</link>
		<dc:creator>chiao</dc:creator>
		<pubDate>Mon, 19 Oct 2009 17:47:20 +0000</pubDate>
		<guid isPermaLink="false">http://www.chiaocheng.com/?page_id=123#comment-181</guid>
		<description>It will work either way.  Any static variables inside the class will be guaranteed to be initialized only once and before they are used.  Having other static variables inside the Singleton class does not affect the static &quot;instance&quot; variable inside the inner class.  Of course, your variable &quot;example&quot; may not be thread-safe depending on how you use it.  But &quot;instance&quot; is still thread safe.</description>
		<content:encoded><![CDATA[<p>It will work either way.  Any static variables inside the class will be guaranteed to be initialized only once and before they are used.  Having other static variables inside the Singleton class does not affect the static &#8220;instance&#8221; variable inside the inner class.  Of course, your variable &#8220;example&#8221; may not be thread-safe depending on how you use it.  But &#8220;instance&#8221; is still thread safe.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Java Singleton by David</title>
		<link>http://www.chiaocheng.com/java-singleton/comment-page-1/#comment-177</link>
		<dc:creator>David</dc:creator>
		<pubDate>Sat, 17 Oct 2009 23:37:52 +0000</pubDate>
		<guid isPermaLink="false">http://www.chiaocheng.com/?page_id=123#comment-177</guid>
		<description>So if you have the same implementation as Initialize-on-demand with the difference being that class Singleton declares a static variable, than this approach wont work and it will not be thread safe ? For example:

public class Singleton{
	
	 private static final int example = 0; //static variable declared just for example
	 
        private Singleton(){ }

         public static Singleton getInstance() {
		 
		  return SingletonHolder.instance;
	 }
	
	 private static class SingletonHolder { 
		 static final Singleton instance = new Singleton();
	 }

Thanks for your response.</description>
		<content:encoded><![CDATA[<p>So if you have the same implementation as Initialize-on-demand with the difference being that class Singleton declares a static variable, than this approach wont work and it will not be thread safe ? For example:</p>
<p>public class Singleton{</p>
<p>	 private static final int example = 0; //static variable declared just for example</p>
<p>        private Singleton(){ }</p>
<p>         public static Singleton getInstance() {</p>
<p>		  return SingletonHolder.instance;<br />
	 }</p>
<p>	 private static class SingletonHolder {<br />
		 static final Singleton instance = new Singleton();<br />
	 }</p>
<p>Thanks for your response.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Java Singleton by chiao</title>
		<link>http://www.chiaocheng.com/java-singleton/comment-page-1/#comment-174</link>
		<dc:creator>chiao</dc:creator>
		<pubDate>Fri, 16 Oct 2009 09:01:30 +0000</pubDate>
		<guid isPermaLink="false">http://www.chiaocheng.com/?page_id=123#comment-174</guid>
		<description>Yes, multiple threads can call getInstance() at the same time.  But just like Eager Initialization, the thread safety comes from the fact that the singleton instance is ultimately held in a static variable.  The JVM guarantees that static variables are only initialized once by the classloader, thus insuring that all threads calling getInstance() will return the same instance of the variable.

The advantage for initialize-on-demand idiom is that the static variable is inside an inner class.  The main Singleton class does not contain any static variables so eager instantiation will not take place.</description>
		<content:encoded><![CDATA[<p>Yes, multiple threads can call getInstance() at the same time.  But just like Eager Initialization, the thread safety comes from the fact that the singleton instance is ultimately held in a static variable.  The JVM guarantees that static variables are only initialized once by the classloader, thus insuring that all threads calling getInstance() will return the same instance of the variable.</p>
<p>The advantage for initialize-on-demand idiom is that the static variable is inside an inner class.  The main Singleton class does not contain any static variables so eager instantiation will not take place.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Java Singleton by David</title>
		<link>http://www.chiaocheng.com/java-singleton/comment-page-1/#comment-167</link>
		<dc:creator>David</dc:creator>
		<pubDate>Thu, 15 Oct 2009 19:03:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.chiaocheng.com/?page_id=123#comment-167</guid>
		<description>For initialize on demand, isn&#039;t there the possibility that more than one thread may call getInstance() at the same time ?</description>
		<content:encoded><![CDATA[<p>For initialize on demand, isn&#8217;t there the possibility that more than one thread may call getInstance() at the same time ?</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Java Singleton by chiao</title>
		<link>http://www.chiaocheng.com/java-singleton/comment-page-1/#comment-109</link>
		<dc:creator>chiao</dc:creator>
		<pubDate>Wed, 23 Sep 2009 20:41:16 +0000</pubDate>
		<guid isPermaLink="false">http://www.chiaocheng.com/?page_id=123#comment-109</guid>
		<description>Yup, that article talks about the possibility of using reflection to access private constructors in java.  By doing so, you can circumvent the private access restriction.  So there are ways to break your singleton pattern but if you wanted to break your own code, there are easier ways to do it.  The only time this would be a problem in the real world would be a framework or something trying to access your singleton through reflection.  That generally will not happen since a singleton by nature would be fairly custom.  

I personally have not seen anyone trying to hack their own singletons on purpose.  Why go through the trouble of creating a singleton only to hack it into multiple instances?  Might as well just create a regular class in the first place.

So that article is not really a contradiction of thread-safe methods for creating singletons.  The methods listed here are still thread-safe methods of creating a singleton.  But it does not prevent you from using reflection to hack the singleton into multiple instances.</description>
		<content:encoded><![CDATA[<p>Yup, that article talks about the possibility of using reflection to access private constructors in java.  By doing so, you can circumvent the private access restriction.  So there are ways to break your singleton pattern but if you wanted to break your own code, there are easier ways to do it.  The only time this would be a problem in the real world would be a framework or something trying to access your singleton through reflection.  That generally will not happen since a singleton by nature would be fairly custom.  </p>
<p>I personally have not seen anyone trying to hack their own singletons on purpose.  Why go through the trouble of creating a singleton only to hack it into multiple instances?  Might as well just create a regular class in the first place.</p>
<p>So that article is not really a contradiction of thread-safe methods for creating singletons.  The methods listed here are still thread-safe methods of creating a singleton.  But it does not prevent you from using reflection to hack the singleton into multiple instances.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Java Singleton by Timmy</title>
		<link>http://www.chiaocheng.com/java-singleton/comment-page-1/#comment-106</link>
		<dc:creator>Timmy</dc:creator>
		<pubDate>Wed, 23 Sep 2009 13:35:08 +0000</pubDate>
		<guid isPermaLink="false">http://www.chiaocheng.com/?page_id=123#comment-106</guid>
		<description>I find the following blog post quite contradictory.


http://yohanliyanage.blogspot.com/2009/09/breaking-singleton.html</description>
		<content:encoded><![CDATA[<p>I find the following blog post quite contradictory.</p>
<p><a href="http://yohanliyanage.blogspot.com/2009/09/breaking-singleton.html" rel="nofollow">http://yohanliyanage.blogspot.com/2009/09/breaking-singleton.html</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Wordpress thumbnail generation disabled by More pictures for MT.Net soon &#171; Mark Turner Dot Net</title>
		<link>http://www.chiaocheng.com/2009/06/wordpress-thumbnail-generation-disabled/comment-page-1/#comment-15</link>
		<dc:creator>More pictures for MT.Net soon &#171; Mark Turner Dot Net</dc:creator>
		<pubDate>Thu, 16 Jul 2009 15:08:29 +0000</pubDate>
		<guid isPermaLink="false">http://www.chiaocheng.com/?p=60#comment-15</guid>
		<description>[...] I just discovered why Wordpress was not resizing my image uploads. It turns out that Wordpress requires the php-gd library to do this, but as this gentleman points out, Wordpress does not document this anywhere. [...]</description>
		<content:encoded><![CDATA[<p>[...] I just discovered why Wordpress was not resizing my image uploads. It turns out that Wordpress requires the php-gd library to do this, but as this gentleman points out, Wordpress does not document this anywhere. [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Moving to wordpress 2.8 by shuhei</title>
		<link>http://www.chiaocheng.com/2009/06/moving-to-wordpress-2-8/comment-page-1/#comment-14</link>
		<dc:creator>shuhei</dc:creator>
		<pubDate>Sat, 11 Jul 2009 05:01:15 +0000</pubDate>
		<guid isPermaLink="false">http://www.crikeymate.com/?p=17#comment-14</guid>
		<description>nice site!</description>
		<content:encoded><![CDATA[<p>nice site!</p>
]]></content:encoded>
	</item>
</channel>
</rss>
