﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><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/"><channel><title>语源科技BlogJava-gembin</title><link>http://www.blogjava.net/gembin/</link><description>&lt;font color="red"&gt;OSGi, Eclipse Equinox, ECF, Virgo, Gemini,  Apache Felix, Karaf, Aires, Camel, Eclipse RCP&lt;/font&gt;&lt;br/&gt;&lt;br/&gt;
&lt;font color="green"&gt;HBase, Hadoop, ZooKeeper, Cassandra&lt;/font&gt;&lt;br/&gt;&lt;br/&gt;

&lt;font color="blue"&gt;Flex4, AS3, Swiz framework, GraniteDS, BlazeDS etc.&lt;/font&gt;&lt;br/&gt;&lt;br/&gt;
&lt;font color="black"&gt;
There is nothing that software can't fix. Unfortunately, there is also nothing that software can't completely fuck up. That gap is called talent.&lt;/font&gt;
&lt;br/&gt;&lt;br/&gt;

&lt;a href="http://about.me/gembin"&gt;About Me&lt;/a&gt;

&lt;script type="text/javascript" src="http://platform.linkedin.com/in.js"&gt;&lt;/script&gt;&lt;script type="in/share" data-counter="right"&gt;&lt;/script&gt;

</description><language>zh-cn</language><lastBuildDate>Sun, 19 Apr 2026 14:48:17 GMT</lastBuildDate><pubDate>Sun, 19 Apr 2026 14:48:17 GMT</pubDate><ttl>60</ttl><item><title>Overriding Vs Hiding  </title><link>http://www.blogjava.net/gembin/archive/2014/05/29/414246.html</link><dc:creator>gembin</dc:creator><author>gembin</author><pubDate>Thu, 29 May 2014 07:52:00 GMT</pubDate><guid>http://www.blogjava.net/gembin/archive/2014/05/29/414246.html</guid><wfw:comment>http://www.blogjava.net/gembin/comments/414246.html</wfw:comment><comments>http://www.blogjava.net/gembin/archive/2014/05/29/414246.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/gembin/comments/commentRss/414246.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/gembin/services/trackbacks/414246.html</trackback:ping><description><![CDATA[<strong style="font-family: Arial, Helvetica, sans-serif; font-size: 16px; line-height: normal; background-color: #faf7f1;"><a href="http://yuzan.me/">http://yuzan.me/</a><br /><br />Can I override a static method?</strong><p style="font-family: Arial, Helvetica, sans-serif; font-size: 16px; line-height: normal; background-color: #faf7f1;">Many people have heard that you can't override a static method. This is true - you can't. However it is possible to write code like this:</p><p style="font-family: Arial, Helvetica, sans-serif; font-size: 16px; line-height: normal; background-color: #faf7f1;"><code style="font-size: 12px; white-space: nowrap;"><br /><span style="font-weight: bold;">class</span>&nbsp;<span style="color: #002cdd;">Foo</span>&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;<span style="font-weight: bold;">public</span>&nbsp;<span style="font-weight: bold;">static</span>&nbsp;<span style="color: #002cdd;">void</span>&nbsp;method()&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #002cdd;">System</span>.out.println(<span style="color: #bc0000;">"in&nbsp;Foo"</span>);<br />&nbsp;&nbsp;&nbsp;&nbsp;}<br />}<br /><br /><span style="font-weight: bold;">class</span>&nbsp;<span style="color: #002cdd;">Bar</span>&nbsp;<span style="font-weight: bold;">extends</span>&nbsp;<span style="color: #002cdd;">Foo</span>&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;<span style="font-weight: bold;">public</span>&nbsp;<span style="font-weight: bold;">static</span>&nbsp;<span style="color: #002cdd;">void</span>&nbsp;method()&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #002cdd;">System</span>.out.println(<span style="color: #bc0000;">"in&nbsp;Bar"</span>);<br />&nbsp;&nbsp;&nbsp;&nbsp;}<br />}<br /></code></p><p style="font-family: Arial, Helvetica, sans-serif; font-size: 16px; line-height: normal; background-color: #faf7f1;">This compiles and runs just fine. Isn't it an example of a static method overriding another static method? The answer is no - it's an example of a static method&nbsp;<em>hiding</em>&nbsp;another static method. If you try to override a static method, the compiler doesn't actually stop you - it just doesn't do what you think it does.</p><p style="font-family: Arial, Helvetica, sans-serif; font-size: 16px; line-height: normal; background-color: #faf7f1;"><strong>So what's the difference?</strong></p><p style="font-family: Arial, Helvetica, sans-serif; font-size: 16px; line-height: normal; background-color: #faf7f1;">Briefly, when you&nbsp;<em>override</em>&nbsp;a method, you still get the benefits of run-time polymorphism, and when you&nbsp;<em>hide</em>, you don't. So what does that mean? Take a look at this code:</p><p style="font-family: Arial, Helvetica, sans-serif; font-size: 16px; line-height: normal; background-color: #faf7f1;"><code style="font-size: 12px; white-space: nowrap;"><br /><span style="font-weight: bold;">class</span>&nbsp;<span style="color: #002cdd;">Foo</span>&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;<span style="font-weight: bold;">public</span>&nbsp;<span style="font-weight: bold;">static</span>&nbsp;<span style="color: #002cdd;">void</span>&nbsp;classMethod()&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #002cdd;">System</span>.out.println(<span style="color: #bc0000;">"classMethod()&nbsp;in&nbsp;Foo"</span>);<br />&nbsp;&nbsp;&nbsp;&nbsp;}<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;<span style="font-weight: bold;">public</span>&nbsp;<span style="color: #002cdd;">void</span>&nbsp;instanceMethod()&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #002cdd;">System</span>.out.println(<span style="color: #bc0000;">"instanceMethod()&nbsp;in&nbsp;Foo"</span>);<br />&nbsp;&nbsp;&nbsp;&nbsp;}<br />}<br /><br /><span style="font-weight: bold;">class</span>&nbsp;<span style="color: #002cdd;">Bar</span>&nbsp;<span style="font-weight: bold;">extends</span>&nbsp;<span style="color: #002cdd;">Foo</span>&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;<span style="font-weight: bold;">public</span>&nbsp;<span style="font-weight: bold;">static</span>&nbsp;<span style="color: #002cdd;">void</span>&nbsp;classMethod()&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #002cdd;">System</span>.out.println(<span style="color: #bc0000;">"classMethod()&nbsp;in&nbsp;Bar"</span>);<br />&nbsp;&nbsp;&nbsp;&nbsp;}<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;<span style="font-weight: bold;">public</span>&nbsp;<span style="color: #002cdd;">void</span>&nbsp;instanceMethod()&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #002cdd;">System</span>.out.println(<span style="color: #bc0000;">"instanceMethod()&nbsp;in&nbsp;Bar"</span>);<br />&nbsp;&nbsp;&nbsp;&nbsp;}<br />}<br />&nbsp;<br /><span style="font-weight: bold;">class</span>&nbsp;<span style="color: #002cdd;">Test</span>&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;<span style="font-weight: bold;">public</span>&nbsp;<span style="font-weight: bold;">static</span>&nbsp;<span style="color: #002cdd;">void</span>&nbsp;main(<span style="color: #002cdd;">String</span>[]&nbsp;args)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #002cdd;">Foo</span>&nbsp;f&nbsp;=&nbsp;<span style="font-weight: bold;">new</span>&nbsp;<span style="color: #002cdd;">Bar</span>();<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;f.instanceMethod();<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;f.classMethod();<br />&nbsp;&nbsp;&nbsp;&nbsp;}<br />}<br /></code></p><p style="font-family: Arial, Helvetica, sans-serif; font-size: 16px; line-height: normal; background-color: #faf7f1;">If you run this, the output is</p><pre style="font-size: 16px; line-height: normal; background-color: #faf7f1;">instanceMethod() in Bar classMethod() in Foo</pre><p style="font-family: Arial, Helvetica, sans-serif; font-size: 16px; line-height: normal; background-color: #faf7f1;">Why do we get instanceMethod from Bar, but classMethod() from Foo? Aren't we using the same instance f to access both of these? Yes we are - but since one is overriding and the other is hiding, we see different behavior.</p><p style="font-family: Arial, Helvetica, sans-serif; font-size: 16px; line-height: normal; background-color: #faf7f1;">Since instanceMethod() is (drum roll please...) an instance method, in which Bar&nbsp;<em>overrides</em>&nbsp;the method from Foo, at run time the JVM uses the&nbsp;<em>actual</em>&nbsp;class of the instance f to determine which method to run. Although f was&nbsp;<em>declared</em>&nbsp;as a Foo, the actual instance we created was a new Bar(). So at runtime, the JVM finds that f is a Bar instance, and so it calls instanceMethod() in Bar rather than the one in Foo. That's how Java normally works for instance methods.</p><p style="font-family: Arial, Helvetica, sans-serif; font-size: 16px; line-height: normal; background-color: #faf7f1;">With classMethod() though. since (<em>ahem</em>) it's a&nbsp;<em>class</em>&nbsp;method, the compiler and JVM don't expect to need an actual instance to invoke the method. And even if you provide one (which we did: the instance referred to by f) the JVM will never look at it. The compiler will only look at the&nbsp;<em>declared type</em>&nbsp;of the reference, and use that declared type to determine,&nbsp;<em>at compile time</em>, which method to call. Since f is declared as type Foo, the compiler looks at f.classMethod() and decides it means Foo.classMethod. It doesn't matter that the instance reffered to by f is actually a Bar - for static methods, the compiler only uses the declared type of the reference. That's what we mean when we say a static method does not have run-time polymorphism.</p><p style="font-family: Arial, Helvetica, sans-serif; font-size: 16px; line-height: normal; background-color: #faf7f1;">Because instance methods and class methods have this important difference in behavior, we use different terms - "overriding" for instance methods and "hiding" for class methods - to distinguish between the two cases. And when we say you can't override a static method, what that means is that even if you write code that&nbsp;<em>looks</em>&nbsp;like it's overriding a static method (like the first Foo and Bar at the top of this page) - it won't&nbsp;<em>behave</em>&nbsp;like an overridden method.</p><p style="font-family: Arial, Helvetica, sans-serif; font-size: 16px; line-height: normal; background-color: #faf7f1;"><strong>So what about accessing a static method using an instance?</strong></p><p style="font-family: Arial, Helvetica, sans-serif; font-size: 16px; line-height: normal; background-color: #faf7f1;">It's possible in Java to write something like:</p><pre style="font-size: 16px; line-height: normal; background-color: #faf7f1;">   f.classMethod();</pre><p style="font-family: Arial, Helvetica, sans-serif; font-size: 16px; line-height: normal; background-color: #faf7f1;">where f is an instance of some class, and classMethod() is a class method (i.e. a static method) of that class. This is legal, but it's a bad idea because it creates confusion. The actual&nbsp;<em>instance</em>&nbsp;f is not really important here. Only the&nbsp;<em>declared type</em>&nbsp;of f matters. That is, what class is f declared to be? Since classMethod() is static, the class of f (as determined by the compiler at compile time) is all we need.</p><p style="font-family: Arial, Helvetica, sans-serif; font-size: 16px; line-height: normal; background-color: #faf7f1;">Rather than writing:</p><pre style="font-size: 16px; line-height: normal; background-color: #faf7f1;">    f.classMethod();</pre><span style="font-family: Arial, Helvetica, sans-serif; font-size: 16px; line-height: normal; background-color: #faf7f1;">It would be better coding style to write either:</span><pre style="font-size: 16px; line-height: normal; background-color: #faf7f1;">    Foo.classMethod();</pre><span style="font-family: Arial, Helvetica, sans-serif; font-size: 16px; line-height: normal; background-color: #faf7f1;">or</span><pre style="font-size: 16px; line-height: normal; background-color: #faf7f1;">    Bar.classMethod(); </pre><span style="font-family: Arial, Helvetica, sans-serif; font-size: 16px; line-height: normal; background-color: #faf7f1;">That way, it is crystal clear which class method you would like to call. It is also clear that the method you are calling is indeed a class method.</span><p style="font-family: Arial, Helvetica, sans-serif; font-size: 16px; line-height: normal; background-color: #faf7f1;">Barring that, you could always come up with this monstrosity:</p><pre style="font-size: 16px; line-height: normal; background-color: #faf7f1;">    f.getClass().getMethod("classMethod", new Class[]).invoke(null, new Object[]);</pre><p style="font-family: Arial, Helvetica, sans-serif; font-size: 16px; line-height: normal; background-color: #faf7f1;">But all this could be avoided by simply not trying to override your static (class) methods. :-)</p><p style="font-family: Arial, Helvetica, sans-serif; font-size: 16px; line-height: normal; background-color: #faf7f1;"><strong>Why does the compiler sometimes talk about overriding static methods?</strong></p><p style="font-family: Arial, Helvetica, sans-serif; font-size: 16px; line-height: normal; background-color: #faf7f1;">Sometimes you will see error messages from the compiler that talk about overriding static methods. Apparently, whoever writes these particular messages has not read the Java Language Specification and does not know the difference between overriding and hiding. So they use incorrect and misleading terminology. Just ignore it. The Java Language Specification is very clear about the difference between overriding and hiding, even if the compiler messages are not. Just pretend that the compiler said "hide" rather than "override"..<br /><br />ref:&nbsp;<span style="font-family: verdana, 'courier new'; font-size: 14px; line-height: 21px;">http://www.coderanch.com/how-to/java/OverridingVsHiding</span></p><img src ="http://www.blogjava.net/gembin/aggbug/414246.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/gembin/" target="_blank">gembin</a> 2014-05-29 15:52 <a href="http://www.blogjava.net/gembin/archive/2014/05/29/414246.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Fuck GFW</title><link>http://www.blogjava.net/gembin/archive/2014/05/18/413795.html</link><dc:creator>gembin</dc:creator><author>gembin</author><pubDate>Sat, 17 May 2014 16:21:00 GMT</pubDate><guid>http://www.blogjava.net/gembin/archive/2014/05/18/413795.html</guid><wfw:comment>http://www.blogjava.net/gembin/comments/413795.html</wfw:comment><comments>http://www.blogjava.net/gembin/archive/2014/05/18/413795.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.blogjava.net/gembin/comments/commentRss/413795.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/gembin/services/trackbacks/413795.html</trackback:ping><description><![CDATA[<div></div>
Just one word: FUCK!!&nbsp;<br />Two words: FUCK&nbsp;YOU!!&nbsp;<br />Three words: FUCK&nbsp;YOU Forever!!&nbsp;<br /><br />I JUST want to access github !! WHY is this! GFW，the&nbsp;<span style="color: #333333; font-family: Arial, 宋体, 微软雅黑; line-height: 24px; background-color: #ffffff;">son of a bitch!!!!</span><br /><img src="http://www.blogjava.net/images/blogjava_net/gembin/fuck-gfw.png" border="0" alt="" width="562" height="457" />&nbsp;<img src ="http://www.blogjava.net/gembin/aggbug/413795.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/gembin/" target="_blank">gembin</a> 2014-05-18 00:21 <a href="http://www.blogjava.net/gembin/archive/2014/05/18/413795.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>A web-based monitoring tool for WebSphere MQ</title><link>http://www.blogjava.net/gembin/archive/2013/12/04/407231.html</link><dc:creator>gembin</dc:creator><author>gembin</author><pubDate>Wed, 04 Dec 2013 15:22:00 GMT</pubDate><guid>http://www.blogjava.net/gembin/archive/2013/12/04/407231.html</guid><wfw:comment>http://www.blogjava.net/gembin/comments/407231.html</wfw:comment><comments>http://www.blogjava.net/gembin/archive/2013/12/04/407231.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/gembin/comments/commentRss/407231.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/gembin/services/trackbacks/407231.html</trackback:ping><description><![CDATA[<div><div><strong>My developerWorks article on WebSphere MQ</strong></div><div></div><div><a href="http://www.ibm.com/developerworks/websphere/library/techarticles/1311_jin/1311_jin.html " title="http://www.ibm.com/developerworks/websphere/library/techarticles/1311_jin/1311_jin.html ">http://www.ibm.com/developerworks/websphere/library/techarticles/1311_jin/1311_jin.html </a></div></div><img src ="http://www.blogjava.net/gembin/aggbug/407231.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/gembin/" target="_blank">gembin</a> 2013-12-04 23:22 <a href="http://www.blogjava.net/gembin/archive/2013/12/04/407231.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>How JavaScript Timers Work</title><link>http://www.blogjava.net/gembin/archive/2013/05/27/399816.html</link><dc:creator>gembin</dc:creator><author>gembin</author><pubDate>Mon, 27 May 2013 05:50:00 GMT</pubDate><guid>http://www.blogjava.net/gembin/archive/2013/05/27/399816.html</guid><wfw:comment>http://www.blogjava.net/gembin/comments/399816.html</wfw:comment><comments>http://www.blogjava.net/gembin/archive/2013/05/27/399816.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/gembin/comments/commentRss/399816.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/gembin/services/trackbacks/399816.html</trackback:ping><description><![CDATA[<p style="font-family: Helvetica, Arial, sans-serif; font-size: 18px; line-height: 23.390625px; background-color: #ffffff;">At a fundamental level it&#8217;s important to understand how JavaScript timers work. Often times they behave unintuitively because of the single thread which they are in. Let&#8217;s start by examining the three functions to which we have access that can construct and manipulate timers.</p><ul style="font-family: Helvetica, Arial, sans-serif; font-size: 18px; line-height: 23.390625px; background-color: #ffffff;"><li><code style="white-space: pre;">var id = setTimeout(fn, delay);</code>&nbsp;&#8211; Initiates a single timer which will call the specified function after the delay. The function returns a unique ID with which the timer can be canceled at a later time.</li><li><code style="white-space: pre;">var id = setInterval(fn, delay);</code>&nbsp;&#8211; Similar to&nbsp;<code style="white-space: pre;">setTimeout</code>&nbsp;but continually calls the function (with a delay every time) until it is canceled.</li><li><code style="white-space: pre;">clearInterval(id);</code>,&nbsp;<code style="white-space: pre;">clearTimeout(id);</code>&nbsp;&#8211; Accepts a timer ID (returned by either of the aforementioned functions) and stops the timer callback from occurring.</li></ul><p style="font-family: Helvetica, Arial, sans-serif; font-size: 18px; line-height: 23.390625px; background-color: #ffffff;">In order to understand how the timers work internally there&#8217;s one important concept that needs to be explored: timer delay is not guaranteed. Since all JavaScript in a browser executes on a single thread asynchronous events (such as mouse clicks and timers) are only run when there&#8217;s been an opening in the execution. This is best demonstrated with a diagram, like in the following:</p><p style="font-family: Helvetica, Arial, sans-serif; font-size: 18px; line-height: 23.390625px; background-color: #ffffff;"></p><center style="font-family: Helvetica, Arial, sans-serif; font-size: 18px; line-height: 23.390625px; background-color: #ffffff;"><a href="http://ejohn.org/files/Timers.png" style="color: #385c85;"><img src="http://ejohn.org/files/427px-Timers.png" style="border: 0px;"  alt="" /><br />(Click to view full size diagram)</a></center><p style="font-family: Helvetica, Arial, sans-serif; font-size: 18px; line-height: 23.390625px; background-color: #ffffff;"></p><p style="font-family: Helvetica, Arial, sans-serif; font-size: 18px; line-height: 23.390625px; background-color: #ffffff;">There&#8217;s a lot of information in this figure to digest but understanding it completely will give you a better realization of how asynchronous JavaScript execution works. This diagram is one dimensional: vertically we have the (wall clock) time, in milliseconds. The blue boxes represent portions of JavaScript being executed. For example the first block of JavaScript executes for approximately 18ms, the mouse click block for approximately 11ms, and so on.</p><p style="font-family: Helvetica, Arial, sans-serif; font-size: 18px; line-height: 23.390625px; background-color: #ffffff;">Since JavaScript can only ever execute one piece of code at a time (due to its single-threaded nature) each of these blocks of code are &#8220;blocking&#8221; the progress of other asynchronous events. This means that when an asynchronous event occurs (like a mouse click, a timer firing, or an XMLHttpRequest completing) it gets queued up to be executed later (how this queueing actually occurs surely varies from browser-to-browser, so consider this to be a simplification).</p><p style="font-family: Helvetica, Arial, sans-serif; font-size: 18px; line-height: 23.390625px; background-color: #ffffff;">To start with, within the first block of JavaScript, two timers are initiated: a 10ms<code style="white-space: pre;">setTimeout</code>&nbsp;and a 10ms&nbsp;<code style="white-space: pre;">setInterval</code>. Due to where and when the timer was started it actually fires before we actually complete the first block of code. Note, however, that it does not execute immediately (it is incapable of doing that, because of the threading). Instead that delayed function is queued in order to be executed at the next available moment.</p><p style="font-family: Helvetica, Arial, sans-serif; font-size: 18px; line-height: 23.390625px; background-color: #ffffff;">Additionally, within this first JavaScript block we see a mouse click occur. The JavaScript callbacks associated with this asynchronous event (we never know when a user may perform an action, thus it&#8217;s consider to be asynchronous) are unable to be executed immediately thus, like the initial timer, it is queued to be executed later.</p><p style="font-family: Helvetica, Arial, sans-serif; font-size: 18px; line-height: 23.390625px; background-color: #ffffff;">After the initial block of JavaScript finishes executing the browser immediately asks the question: What is waiting to be executed? In this case both a mouse click handler and a timer callback are waiting. The browser then picks one (the mouse click callback) and executes it immediately. The timer will wait until the next possible time, in order to execute.</p><p style="font-family: Helvetica, Arial, sans-serif; font-size: 18px; line-height: 23.390625px; background-color: #ffffff;">Note that while mouse click handler is executing the first interval callback executes. As with the timer its handler is queued for later execution. However, note that when the interval is fired again (when the timer handler is executing) this time that handler execution is dropped. If you were to queue up all interval callbacks when a large block of code is executing the result would be a bunch of intervals executing with no delay between them, upon completion. Instead browsers tend to simply wait until no more interval handlers are queued (for the interval in question) before queuing more.</p><p style="font-family: Helvetica, Arial, sans-serif; font-size: 18px; line-height: 23.390625px; background-color: #ffffff;">We can, in fact, see that this is the case when a third interval callback fires while the interval, itself, is executing. This shows us an important fact: Intervals don&#8217;t care about what is currently executing, they will queue indiscriminately, even if it means that the time between callbacks will be sacrificed.</p><p style="font-family: Helvetica, Arial, sans-serif; font-size: 18px; line-height: 23.390625px; background-color: #ffffff;">Finally, after the second interval callback is finished executing, we can see that there&#8217;s nothing left for the JavaScript engine to execute. This means that the browser now waits for a new asynchronous event to occur. We get this at the 50ms mark when the interval fires again. This time, however, there is nothing blocking its execution, so it fires immediately.</p><p style="font-family: Helvetica, Arial, sans-serif; font-size: 18px; line-height: 23.390625px; background-color: #ffffff;">Let&#8217;s take a look at an example to better illustrate the differences between<code style="white-space: pre;">setTimeout</code>&nbsp;and&nbsp;<code style="white-space: pre;">setInterval</code>.</p><div id="ig-sh-1" style="font-family: 'Courier New'; padding: 8px; margin: 8px; background-color: #f5f5f5; border-top-width: 1px; border-top-style: solid; border-top-color: #bbbbbb; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: #bbbbbb; line-height: 23.390625px;"><div><ol style="list-style: none; margin: 0px; padding: 0px; font-family: monospace;"><li style="vertical-align: top;"><div style="font-size: 1em; line-height: 1.2em; margin: 0px; background-image: none; vertical-align: top;">setTimeout(function(){</div></li><li style="vertical-align: top;"><div style="font-size: 1em; line-height: 1.2em; margin: 0px; background-image: none; vertical-align: top;">&nbsp; &nbsp; /* Some long block of code... */</div></li><li style="vertical-align: top;"><div style="font-size: 1em; line-height: 1.2em; margin: 0px; background-image: none; vertical-align: top;">&nbsp; &nbsp; setTimeout(arguments.callee, 10);</div></li><li style="vertical-align: top;"><div style="font-size: 1em; line-height: 1.2em; margin: 0px; background-image: none; vertical-align: top;">&nbsp; }, 10);</div></li><li style="vertical-align: top;"><div style="font-size: 1em; line-height: 1.2em; margin: 0px; background-image: none; vertical-align: top;">&nbsp;</div></li><li style="vertical-align: top;"><div style="font-size: 1em; line-height: 1.2em; margin: 0px; background-image: none; vertical-align: top;">&nbsp; setInterval(function(){</div></li><li style="vertical-align: top;"><div style="font-size: 1em; line-height: 1.2em; margin: 0px; background-image: none; vertical-align: top;">&nbsp; &nbsp; /* Some long block of code... */</div></li><li style="vertical-align: top;"><div style="font-size: 1em; line-height: 1.2em; margin: 0px; background-image: none; vertical-align: top;">&nbsp; }, 10);</div></li></ol></div></div><p style="font-family: Helvetica, Arial, sans-serif; font-size: 18px; line-height: 23.390625px; background-color: #ffffff;">These two pieces of code may appear to be functionally equivalent, at first glance, but they are not. Notably the&nbsp;<code style="white-space: pre;">setTimeout</code>&nbsp;code will always have at least a 10ms delay after the previous callback execution (it may end up being more, but never less) whereas the&nbsp;<code style="white-space: pre;">setInterval</code>&nbsp;will attempt to execute a callback every 10ms regardless of when the last callback was executed.</p><p style="font-family: Helvetica, Arial, sans-serif; font-size: 18px; line-height: 23.390625px; background-color: #ffffff;">There&#8217;s a lot that we&#8217;ve learned here, let&#8217;s recap:</p><ul style="font-family: Helvetica, Arial, sans-serif; font-size: 18px; line-height: 23.390625px; background-color: #ffffff;"><li>JavaScript engines only have a single thread, forcing asynchronous events to queue waiting for execution.</li><li><code style="white-space: pre;">setTimeout</code>&nbsp;and&nbsp;<code style="white-space: pre;">setInterval</code>&nbsp;are fundamentally different in how they execute asynchronous code.</li><li>If a timer is blocked from immediately executing it will be delayed until the next possible point of execution (which will be longer than the desired delay).</li><li>Intervals may execute back-to-back with no delay if they take long enough to execute (longer than the specified delay).</li></ul><p style="font-family: Helvetica, Arial, sans-serif; font-size: 18px; line-height: 23.390625px; background-color: #ffffff;">All of this is incredibly important knowledge to build off of. Knowing how a JavaScript engine works, especially with the large number of asynchronous events that typically occur, makes for a great foundation when building an advanced piece of application code.<br /><br />from:&nbsp;<a href="http://ejohn.org/blog/how-javascript-timers-work/">http://ejohn.org/blog/how-javascript-timers-work/</a><br /><br /><br /></p><img src ="http://www.blogjava.net/gembin/aggbug/399816.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/gembin/" target="_blank">gembin</a> 2013-05-27 13:50 <a href="http://www.blogjava.net/gembin/archive/2013/05/27/399816.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Tip of changing the language settings for Websphere MQ Explorer</title><link>http://www.blogjava.net/gembin/archive/2013/03/23/396905.html</link><dc:creator>gembin</dc:creator><author>gembin</author><pubDate>Sat, 23 Mar 2013 09:26:00 GMT</pubDate><guid>http://www.blogjava.net/gembin/archive/2013/03/23/396905.html</guid><wfw:comment>http://www.blogjava.net/gembin/comments/396905.html</wfw:comment><comments>http://www.blogjava.net/gembin/archive/2013/03/23/396905.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/gembin/comments/commentRss/396905.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/gembin/services/trackbacks/396905.html</trackback:ping><description><![CDATA[<div>Open <strong>&lt;InstallDir&gt;/MQExplorer/eclipse/configuration/config.ini</strong></div><div>Add these two lines before eof<br /><br /><span style="color: #0000ff;">org.osgi.framework.language=en<br /></span><span style="color: #0000ff;">osgi.nl=en_US</span></div><div></div><img src ="http://www.blogjava.net/gembin/aggbug/396905.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/gembin/" target="_blank">gembin</a> 2013-03-23 17:26 <a href="http://www.blogjava.net/gembin/archive/2013/03/23/396905.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Mac技巧之让U盘、移动硬盘在苹果电脑和Windows PC都能识别/读写，且支持4GB大文件：exFAT格式</title><link>http://www.blogjava.net/gembin/archive/2013/03/12/396297.html</link><dc:creator>gembin</dc:creator><author>gembin</author><pubDate>Mon, 11 Mar 2013 17:27:00 GMT</pubDate><guid>http://www.blogjava.net/gembin/archive/2013/03/12/396297.html</guid><wfw:comment>http://www.blogjava.net/gembin/comments/396297.html</wfw:comment><comments>http://www.blogjava.net/gembin/archive/2013/03/12/396297.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/gembin/comments/commentRss/396297.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/gembin/services/trackbacks/396297.html</trackback:ping><description><![CDATA[<span style="font-family: Arial, Helvetica, sans-serif; line-height: 28px; background-color: #f5f4f4;">&nbsp;如果您的 U 盘、移动硬盘既要用于 PC 又要用于苹果电脑，Mac OS X 系统的 HFS＋ 和 Windows 的 NTFS 格式显然都不行&#8230;&#8230;HFS+ 在 Windows 下不识别，NTFS 格式的 U 盘、移动硬盘插在苹果电脑上只能读不能写。格式化成 FAT32 显然可以支持两个系统，但单一文件大于 4GB 就歇菜。</span><p style="margin-top: 0px; margin-bottom: 0px; padding: 15px 0px 0px; font-family: Arial, Helvetica, sans-serif; line-height: 28px; background-color: #f5f4f4;"></p><p style="margin-top: 0px; margin-bottom: 0px; padding: 15px 0px 0px; font-family: Arial, Helvetica, sans-serif; line-height: 28px; background-color: #f5f4f4;"></p><div align="center" style="margin: 0px auto; font-family: Arial, Helvetica, sans-serif; line-height: 28px; background-color: #f5f4f4;"><img src="http://www.mac52ipod.cn/attachment.php?fid=2529" border="0" alt="exFAT 格式" title="exFAT 格式" style="margin: 0px; padding: 1px; border: 1px solid #000000;" /></div><p style="margin-top: 0px; margin-bottom: 0px; padding: 15px 0px 0px; font-family: Arial, Helvetica, sans-serif; line-height: 28px; background-color: #f5f4f4;"></p><p style="margin-top: 0px; margin-bottom: 0px; padding: 15px 0px 0px; font-family: Arial, Helvetica, sans-serif; line-height: 28px; background-color: #f5f4f4;">&nbsp;&nbsp;&nbsp;&nbsp;但苹果电脑 Mac OS X 10.6.5 系统做出了一项意义重大的升级：支持 exFAT 磁盘格式，格式化成 exFAT 格式的 U 盘、移动硬盘在 Windows PC 上和苹果电脑 Mac OS X 系统下均能读写，而且支持超过单个体积超过 4 GB 的大文件。</p><p style="margin-top: 0px; margin-bottom: 0px; padding: 15px 0px 0px; font-family: Arial, Helvetica, sans-serif; line-height: 28px; background-color: #f5f4f4;">&nbsp;&nbsp;&nbsp;&nbsp;下面是将 U 盘、移动硬盘格式化成 exFAT 格式的方法，以及 exFAT、FAT32、HFS＋ 三种格式下同一块 U 盘的读写速度测试</p><a name="entrymore" style="margin: 0px auto; padding: 0px; color: rgb(100, 69, 39); outline-style: none; font-family: Arial, Helvetica, sans-serif; line-height: 28px; background-color: rgb(245, 244, 244);"></a><p style="margin-top: 0px; margin-bottom: 0px; padding: 15px 0px 0px; font-family: Arial, Helvetica, sans-serif; line-height: 28px; background-color: #f5f4f4;"></p><div align="center" style="margin: 0px auto; font-family: Arial, Helvetica, sans-serif; line-height: 28px; background-color: #f5f4f4;"><img src="http://www.mac52ipod.cn/attachment.php?fid=2526" border="0" alt="苹果电脑 Mac OS X 系统下把U盘、移动硬盘格式化成exFAT格式" title="苹果电脑 Mac OS X 系统下把U盘、移动硬盘格式化成exFAT格式" style="margin: 0px; padding: 1px; border: 1px solid #000000;" /><br style="margin: 0px auto; padding: 0px;" />苹果电脑 Mac OS X 系统下把U盘、移动硬盘格式化成exFAT格式</div><p style="margin-top: 0px; margin-bottom: 0px; padding: 15px 0px 0px; font-family: Arial, Helvetica, sans-serif; line-height: 28px; background-color: #f5f4f4;"></p><p style="margin-top: 0px; margin-bottom: 0px; padding: 15px 0px 0px; font-family: Arial, Helvetica, sans-serif; line-height: 28px; background-color: #f5f4f4;">&nbsp;&nbsp;&nbsp;&nbsp;点击苹果电脑屏幕右上角的放大镜按钮，Sportlight 搜索&#8220;磁盘工具&#8221;，在磁盘工具侧边栏选择要格式化的 U 盘或移动硬盘分区，右侧选择&#8220;抹掉&#8221;标签，在格式下拉菜单里选择 ExFAT 即可。如上图所示。</p><p style="margin-top: 0px; margin-bottom: 0px; padding: 15px 0px 0px; font-family: Arial, Helvetica, sans-serif; line-height: 28px; background-color: #f5f4f4;"></p><div align="center" style="margin: 0px auto; font-family: Arial, Helvetica, sans-serif; line-height: 28px; background-color: #f5f4f4;"><img src="http://www.mac52ipod.cn/attachment.php?fid=2527" border="0" alt="Windows 系统下把U盘、移动硬盘格式化成exFAT格式" title="Windows 系统下把U盘、移动硬盘格式化成exFAT格式" style="margin: 0px; padding: 1px; border: 1px solid #000000;" /><br style="margin: 0px auto; padding: 0px;" />Windows 系统下把U盘、移动硬盘格式化成exFAT格式</div><p style="margin-top: 0px; margin-bottom: 0px; padding: 15px 0px 0px; font-family: Arial, Helvetica, sans-serif; line-height: 28px; background-color: #f5f4f4;"></p><p style="margin-top: 0px; margin-bottom: 0px; padding: 15px 0px 0px; font-family: Arial, Helvetica, sans-serif; line-height: 28px; background-color: #f5f4f4;">&nbsp;&nbsp;&nbsp;&nbsp;Windows 7 和 Vista 默认就支持 exFAT 格式，如果是 XP 系统，要下载 KB955704 补丁：<u style="margin: 0px auto; padding: 0px;"><a href="http://www.microsoft.com/downloads/details.aspx?displaylang=zh-cn&amp;FamilyID=1cbe3906-ddd1-4ca2-b727-c2dff5e30f61" target="_blank" title="去微软官网下载 KB955704 补丁" rel="nofollow" style="margin: 0px auto; padding: 0px; color: #644527; text-decoration: none; outline-style: none;">http://www.microsoft.com/downloads/details.aspx?displaylang=zh-cn&amp;FamilyID=1cbe3906-ddd1-4ca2-b727-c2dff5e30f61</a></u></p><p style="margin-top: 0px; margin-bottom: 0px; padding: 15px 0px 0px; font-family: Arial, Helvetica, sans-serif; line-height: 28px; background-color: #f5f4f4;">&nbsp;&nbsp;&nbsp;&nbsp;至于 exFAT 格式的 U 盘的读写速度，下面是同一块 U 盘在同一台电脑（我的 Macbook Pro）上的读写速度测试，测试软件为&nbsp;<u style="margin: 0px auto; padding: 0px;"><a href="http://www.mac52ipod.cn/post/AJA-KONA-System-Test-Download.php" target="_blank" title="Mac OS X平台上的苹果电脑硬盘性能读写速度测试软件：AJA KONA System Test" style="margin: 0px auto; padding: 0px; color: #644527; text-decoration: none; outline-style: none;">以前介绍的免费软件：AJA System Test</a></u>。<br style="margin: 0px auto; padding: 0px;" /></p><div align="center" style="margin: 0px auto; font-family: Arial, Helvetica, sans-serif; line-height: 28px; background-color: #f5f4f4;"><img src="http://www.mac52ipod.cn/attachment.php?fid=2528" border="0" alt="FAT32、HFS＋、exFAT 格式的 U 盘读写速度测试" title="FAT32、HFS＋、exFAT 格式的 U 盘读写速度测试" style="margin: 0px; padding: 1px; border: 1px solid #000000;" /><br style="margin: 0px auto; padding: 0px;" />FAT32、HFS＋、exFAT 格式的 U 盘读写速度测试</div><p style="margin-top: 0px; margin-bottom: 0px; padding: 15px 0px 0px; font-family: Arial, Helvetica, sans-serif; line-height: 28px; background-color: #f5f4f4;"></p><p style="margin-top: 0px; margin-bottom: 0px; padding: 15px 0px 0px; font-family: Arial, Helvetica, sans-serif; line-height: 28px; background-color: #f5f4f4;">&nbsp;&nbsp;&nbsp;&nbsp;顺时针依次是 FAT32、HFS＋、exFAT 格式下 U 盘读写速度测试结果，不太妙。所以：只把 U 盘和移动硬盘的一个分区（专门用于 PC、Mac 之间交换文件）格式化成 exFAT 就行了。<br />KEEP FOR REF:&nbsp;<span style="font-family: verdana, 'courier new'; line-height: 21px;">http://www.mac52ipod.cn/post/use-u-disk-hdd-on-windows-pc-and-mac-os-x-4gb-exfat.php</span></p><img src ="http://www.blogjava.net/gembin/aggbug/396297.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/gembin/" target="_blank">gembin</a> 2013-03-12 01:27 <a href="http://www.blogjava.net/gembin/archive/2013/03/12/396297.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>JPA Concepts</title><link>http://www.blogjava.net/gembin/archive/2013/03/07/396169.html</link><dc:creator>gembin</dc:creator><author>gembin</author><pubDate>Thu, 07 Mar 2013 08:58:00 GMT</pubDate><guid>http://www.blogjava.net/gembin/archive/2013/03/07/396169.html</guid><wfw:comment>http://www.blogjava.net/gembin/comments/396169.html</wfw:comment><comments>http://www.blogjava.net/gembin/archive/2013/03/07/396169.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/gembin/comments/commentRss/396169.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/gembin/services/trackbacks/396169.html</trackback:ping><description><![CDATA[<div></div><div>keep it for reference</div><div></div><div>http://tomee.apache.org/jpa-concepts.html</div><div>http://www.jpalace.org/docs/tutorials/jee/jpa_2.html</div><div></div><img src ="http://www.blogjava.net/gembin/aggbug/396169.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/gembin/" target="_blank">gembin</a> 2013-03-07 16:58 <a href="http://www.blogjava.net/gembin/archive/2013/03/07/396169.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>JPA Criteria API </title><link>http://www.blogjava.net/gembin/archive/2013/03/06/396131.html</link><dc:creator>gembin</dc:creator><author>gembin</author><pubDate>Wed, 06 Mar 2013 05:44:00 GMT</pubDate><guid>http://www.blogjava.net/gembin/archive/2013/03/06/396131.html</guid><wfw:comment>http://www.blogjava.net/gembin/comments/396131.html</wfw:comment><comments>http://www.blogjava.net/gembin/archive/2013/03/06/396131.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/gembin/comments/commentRss/396131.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/gembin/services/trackbacks/396131.html</trackback:ping><description><![CDATA[<pre name="code" style="font-size: 12px; line-height: 18px;"><br /><strong>Count</strong><br />CriteriaBuilder critBuilder = entityManager.getCriteriaBuilder(); <br />CriteriaQuery&lt;Long&gt; critQuery = criteriaBuilder.createQuery(Long.class); <br />Root&lt;Foo&gt; root = critQuery.from(Foo.class);  <br />critQuery.select(critBuilder.countDistinct(root)); <br />int count = entityManager.createQuery(critQuery).getSingleResult().intValue();</pre><p style="font-family: Tahoma; font-size: 12px; line-height: 18px;"><br /></p><p style="font-family: Tahoma; font-size: 12px; line-height: 18px;">&nbsp;</p><p style="font-family: Tahoma; font-size: 12px; line-height: 18px;"><strong>&nbsp;Result</strong></p><pre name="code" style="font-size: 12px; line-height: 18px;">CriteriaBuilder critBuilder = entityManager.getCriteriaBuilder(); <br />CriteriaQuery&lt;Long&gt; critQuery = criteriaBuilder.createQuery(Long.class); <br />Root&lt;Foo&gt; root = critQuery.from(Foo.class);  <br />critQuery.select(root).distinct(true); <br />List&lt;Foo&gt; result = entityManager.createQuery(critQuery).getResultList();</pre><img src ="http://www.blogjava.net/gembin/aggbug/396131.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/gembin/" target="_blank">gembin</a> 2013-03-06 13:44 <a href="http://www.blogjava.net/gembin/archive/2013/03/06/396131.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Adobe Photoshop Source Code - version 1.0.1</title><link>http://www.blogjava.net/gembin/archive/2013/02/14/395312.html</link><dc:creator>gembin</dc:creator><author>gembin</author><pubDate>Thu, 14 Feb 2013 08:28:00 GMT</pubDate><guid>http://www.blogjava.net/gembin/archive/2013/02/14/395312.html</guid><wfw:comment>http://www.blogjava.net/gembin/comments/395312.html</wfw:comment><comments>http://www.blogjava.net/gembin/archive/2013/02/14/395312.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/gembin/comments/commentRss/395312.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/gembin/services/trackbacks/395312.html</trackback:ping><description><![CDATA[<p style="margin: 0px 0px 7px; padding: 0px; color: #5b5b5b; font-family: verdana, arial, helvetica, sans-serif; font-size: 13px; line-height: 18.140625px; background-color: #ffffff;"><cite>pho&#183;to&#183;shop,&nbsp;<em>transitive verb, often capitalized</em>&nbsp;\ˈfō-(ˌ)tō-ˌsh&#228;p\</cite></p><ol style="margin: 10px 0px; padding: 0px 0px 0px 9px; list-style-position: inside; list-style-image: initial; color: #5b5b5b; font-family: verdana, arial, helvetica, sans-serif; font-size: 13px; line-height: 18.140625px; background-color: #ffffff;"><li style="margin: 0px; padding: 0px;"><cite>to alter (a digital image) with Photoshop software or other image-editing software especially in a way that distorts reality (as for deliberately deceptive purposes)</cite></li></ol><p style="margin: 0px 0px 7px; padding: 0px 0px 0px 60px; color: #5b5b5b; font-family: verdana, arial, helvetica, sans-serif; font-size: 13px; line-height: 18.140625px; background-color: #ffffff;"><cite>&#8211; Merriam-Webster online dictionary, 2012</cite></p><h2></h2><p style="margin: 0px 0px 7px; padding: 0px; color: #5b5b5b; font-family: verdana, arial, helvetica, sans-serif; font-size: 13px; line-height: 18.140625px; background-color: #ffffff;">When brothers Thomas and John Knoll began designing and writing an image editing program in the late 1980s, they could not have imagined that they would be adding a word to the dictionary.</p><div alignleft"="" style="margin: 0px 20px 20px 0px; padding: 5px; border-top-right-radius: 3px; border-top-left-radius: 3px; -webkit-box-shadow: #cacaca 0px 0px 3px; box-shadow: #cacaca 0px 0px 3px; border: 1px solid #e2e2e2; background-color: #ffffff; float: left; color: #5b5b5b; font-family: verdana, arial, helvetica, sans-serif; font-size: 13px; line-height: 18.140625px; width: 240px;"><a href="http://www.computerhistory.org/atchm//wp-content/uploads/2013/01/Thomas_Knoll.jpg" rel="fancybox" style="color: #22589d; text-decoration: initial; outline: none; cursor: pointer;"><img image-stylized"="" src="http://www.computerhistory.org/atchm//wp-content/uploads/2013/01/Thomas_Knoll-300x290.jpg" alt="" width="240" height="232" style="border: none; display: block; padding: 0px; border-top-right-radius: 3px; border-top-left-radius: 3px; -webkit-box-shadow: #cacaca 0px 0px 3px; box-shadow: #cacaca 0px 0px 3px; margin: 0px;" /></a><p style="margin: 0px 0px 7px; padding: 10px 5px; font-size: 0.8em; color: #333333; line-height: 1.4em;">Thomas Knoll</p></div><div alignright"="" style="margin: 0px 0px 20px 20px; padding: 5px; border-top-right-radius: 3px; border-top-left-radius: 3px; -webkit-box-shadow: #cacaca 0px 0px 3px; box-shadow: #cacaca 0px 0px 3px; border: 1px solid #e2e2e2; background-color: #ffffff; float: right; color: #5b5b5b; font-family: verdana, arial, helvetica, sans-serif; font-size: 13px; line-height: 18.140625px; width: 240px;"><a href="http://www.computerhistory.org/atchm//wp-content/uploads/2013/01/John_Knoll.jpg" rel="fancybox" style="color: #22589d; text-decoration: initial; outline: none; cursor: pointer;"><img image-stylized"="" src="http://www.computerhistory.org/atchm//wp-content/uploads/2013/01/John_Knoll-300x290.jpg" alt="" width="240" height="232" style="border: none; display: block; padding: 0px; border-top-right-radius: 3px; border-top-left-radius: 3px; -webkit-box-shadow: #cacaca 0px 0px 3px; box-shadow: #cacaca 0px 0px 3px; margin: 0px;" /></a><p style="margin: 0px 0px 7px; padding: 10px 5px; font-size: 0.8em; color: #333333; line-height: 1.4em;">John Knoll</p></div><hr style="content: '.'; clear: both; visibility: hidden; line-height: 0px; height: 0px; color: #5b5b5b; font-family: verdana, arial, helvetica, sans-serif; font-size: 13px; background-color: #ffffff;" /><p style="margin: 0px 0px 7px; padding: 0px; color: #5b5b5b; font-family: verdana, arial, helvetica, sans-serif; font-size: 13px; line-height: 18.140625px; background-color: #ffffff;">Thomas Knoll, a PhD student in computer vision at the University of Michigan, had written a program in 1987 to display and modify digital images. His brother John, working at the movie visual effects company Industrial Light &amp; Magic, found it useful for editing photos, but it wasn&#8217;t intended to be a product. Thomas said, &#8220;We developed it originally for our own personal use&#8230;it was a lot a fun to do.&#8221;</p><p style="margin: 0px 0px 7px; padding: 0px; color: #5b5b5b; font-family: verdana, arial, helvetica, sans-serif; font-size: 13px; line-height: 18.140625px; background-color: #ffffff;">Gradually the program, called &#8220;Display&#8221;, became more sophisticated. In the summer of 1988 they realized that it indeed could be a credible commercial product. They renamed it &#8220;Photoshop&#8221; and began to search for a company to distribute it. About 200 copies of version 0.87 were bundled by slide scanner manufacturer Barneyscan as &#8220;Barneyscan XP&#8221;.</p><p style="margin: 0px 0px 7px; padding: 0px; color: #5b5b5b; font-family: verdana, arial, helvetica, sans-serif; font-size: 13px; line-height: 18.140625px; background-color: #ffffff;">The fate of Photoshop was sealed when Adobe, encouraged by its art director Russell Brown, decided to buy a license to distribute an enhanced version of Photoshop. The deal was finalized in April 1989, and version 1.0 started shipping early in 1990.</p><p style="margin: 0px 0px 7px; padding: 0px; color: #5b5b5b; font-family: verdana, arial, helvetica, sans-serif; font-size: 13px; line-height: 18.140625px; background-color: #ffffff;">Over the next ten years, more than 3 million copies of Photoshop were sold.</p><p style="margin: 0px 0px 7px; padding: 0px; color: #5b5b5b; font-family: verdana, arial, helvetica, sans-serif; font-size: 13px; line-height: 18.140625px; background-color: #ffffff;"><a href="http://www.computerhistory.org/atchm//wp-content/uploads/2013/01/box_and_disk1.jpg" rel="fancybox" style="color: #22589d; text-decoration: initial; outline: none; cursor: pointer;"><img size-large="" wp-image-2173=""  image-stylized"="" src="http://www.computerhistory.org/atchm//wp-content/uploads/2013/01/box_and_disk1-542x253.jpg" alt="" width="542" height="253" style="border: 1px solid #e2e2e2; display: block; padding: 3px; border-top-right-radius: 3px; border-top-left-radius: 3px; -webkit-box-shadow: #cacaca 0px 0px 3px; box-shadow: #cacaca 0px 0px 3px; margin: 10px auto;" /></a></p><p style="margin: 0px 0px 7px; padding: 0px; color: #5b5b5b; font-family: verdana, arial, helvetica, sans-serif; font-size: 13px; line-height: 18.140625px; background-color: #ffffff;">&nbsp; That first version of Photoshop was written primarily in Pascal for the Apple Macintosh, with some machine language for the underlying Motorola 68000 microprocessor where execution efficiency was important. It&nbsp;wasn&#8217;t&nbsp;the effort of a huge team. Thomas said, &#8220;For version 1, I was the only engineer, and for version 2, we had two engineers.&#8221; While Thomas worked on the base application program, John wrote many of the image-processing plug-ins.</p><p style="margin: 0px 0px 7px; padding: 0px; color: #5b5b5b; font-family: verdana, arial, helvetica, sans-serif; font-size: 13px; line-height: 18.140625px; background-color: #ffffff;"><a href="http://www.computerhistory.org/atchm/adobe-photoshop-source-code/splashscreen/" rel="attachment wp-att-2174" style="color: #22589d; text-decoration: initial; outline: none; cursor: pointer;"><img size-full="" wp-image-2174=""  image-stylized"="" src="http://www.computerhistory.org/atchm//wp-content/uploads/2013/01/splashscreen.jpg" alt="" width="500" height="276" style="border: 1px solid #e2e2e2; display: block; padding: 3px; border-top-right-radius: 3px; border-top-left-radius: 3px; -webkit-box-shadow: #cacaca 0px 0px 3px; box-shadow: #cacaca 0px 0px 3px; margin: 10px auto;" /></a></p><p style="margin: 0px 0px 7px; padding: 0px; color: #5b5b5b; font-family: verdana, arial, helvetica, sans-serif; font-size: 13px; line-height: 18.140625px; background-color: #ffffff;">With the permission of Adobe Systems Inc., the Computer History Museum is pleased to make available, for non-commercial use, the source code to the 1990 version 1.0.1 of Photoshop. All the code is here with the exception of the MacApp applications library that was licensed from Apple. There are 179 files in the zipped folder, comprising about 128,000 lines of mostly uncommented but well-structured code. By line count, about 75% of the code is in Pascal, about 15% is in 68000 assembler language, and the rest is data of various sorts.&nbsp;<span style="line-height: 19px;">To download the code you must agree to the terms of the license.</span></p><p style="margin: 20px 0px; padding: 10px 20px 10px 40px; background-image: url(http://computerhistory.org/_common/img/misc/hint.jpg); background-attachment: scroll; background-color: #fff9d0; color: #222222; font-family: verdana, arial, helvetica, sans-serif; font-size: 13px; line-height: 18.140625px; background-position: 5px 5px; background-repeat: no-repeat no-repeat;">Download&nbsp;<a title="Download Photoshop version 1.0.1 Source Code" href="http://computerhistory.org/atchm/photoshop-license-agreement/" style="color: #22589d; text-decoration: initial; outline: none; cursor: pointer;">Photoshop version 1.0.1 Source Code</a></p><p style="margin: 0px 0px 7px; padding: 0px; color: #5b5b5b; font-family: verdana, arial, helvetica, sans-serif; font-size: 13px; line-height: 18.140625px; background-color: #ffffff;">The 1990 version of the Adobe Photoshop User Guide is at<a href="http://www.computerhistory.org/collections/accession/102640940" target="_blank" style="color: #22589d; text-decoration: initial; outline: none; cursor: pointer;">http://www.computerhistory.org/collections/accession/102640940</a></p><p style="margin: 0px 0px 7px; padding: 0px; color: #5b5b5b; font-family: verdana, arial, helvetica, sans-serif; font-size: 13px; line-height: 18.140625px; background-color: #ffffff;">and the 1990 Adobe Photoshop tutorial is at<a href="http://www.computerhistory.org/collections/accession/102640945%20" target="_blank" style="color: #22589d; text-decoration: initial; outline: none; cursor: pointer;">http://www.computerhistory.org/collections/accession/102640945&nbsp;</a></p><h2>Commentary on the source code</h2><p style="margin: 0px 0px 7px; padding: 0px; color: #5b5b5b; font-family: verdana, arial, helvetica, sans-serif; font-size: 13px; line-height: 18.140625px; background-color: #ffffff;">Software architect Grady Booch is the Chief Scientist for Software Engineering at IBM Research Almaden and a trustee of the Computer History Museum. He offers the following observations about the Photoshop source code:</p><p style="margin: 0px 0px 7px; padding: 0px 0px 0px 30px; color: #5b5b5b; font-family: verdana, arial, helvetica, sans-serif; font-size: 13px; line-height: 18.140625px; background-color: #ffffff;">&#8220;Opening the files that constituted the source code for Photoshop 1.0, I felt a bit like Howard Carter as he first breached the tomb of King Tutankhamen. What wonders awaited me?</p><p style="margin: 0px 0px 7px; padding: 0px 0px 0px 30px; color: #5b5b5b; font-family: verdana, arial, helvetica, sans-serif; font-size: 13px; line-height: 18.140625px; background-color: #ffffff;">I was not disappointed by what I found. Indeed, it was a marvelous journey to open up the cunning machinery of an application I&#8217;d first used over 20 years ago.</p><p style="margin: 0px 0px 7px; padding: 0px 0px 0px 30px; color: #5b5b5b; font-family: verdana, arial, helvetica, sans-serif; font-size: 13px; line-height: 18.140625px; background-color: #ffffff;">Architecturally, this is a very well-structured system. There&#8217;s a consistent separation of interface and abstraction, and the design decisions made to componentize those abstractions &#8211; with generally one major type for each combination of interface and implementation &#8212; were easy to follow.</p><p style="margin: 0px 0px 7px; padding: 0px 0px 0px 30px; color: #5b5b5b; font-family: verdana, arial, helvetica, sans-serif; font-size: 13px; line-height: 18.140625px; background-color: #ffffff;">The abstractions are quite mature. The consistent naming, the granularity of methods, the almost breathtaking simplicity of the implementations because each type was so well abstracted, all combine to make it easy to discern the texture of the system.</p><p style="margin: 0px 0px 7px; padding: 0px 0px 0px 30px; color: #5b5b5b; font-family: verdana, arial, helvetica, sans-serif; font-size: 13px; line-height: 18.140625px; background-color: #ffffff;">Having the opportunity to examine Photoshop&#8217;s current architecture, I believe I see fundamental structures that have persisted, though certainly in more evolved forms, in the modern implementation. Tiles, filters, abstractions for virtual memory (to attend to images far larger than display buffers or main memory could normally handle) are all there in the first version. Yet it had just over 100,000 lines of code, compared to well over 10 million in the current version! Then and now, much of the code is related to input/output and the myriad of file formats that Photoshop has to attend to.</p><p style="margin: 0px 0px 7px; padding: 0px 0px 0px 30px; color: #5b5b5b; font-family: verdana, arial, helvetica, sans-serif; font-size: 13px; line-height: 18.140625px; background-color: #ffffff;">There are only a few comments in the version 1.0 source code, most of which are associated with assembly language snippets. That said, the lack of comments is simply not an issue. This code is so literate, so easy to read, that comments might even have gotten in the way.</p><p style="margin: 0px 0px 7px; padding: 0px 0px 0px 30px; color: #5b5b5b; font-family: verdana, arial, helvetica, sans-serif; font-size: 13px; line-height: 18.140625px; background-color: #ffffff;">It is delightful to find historical vestiges of the time: code to attend to Andy Herzfield&#8217;s software for the Thunderscan scanner, support of early TARGA raster graphics file types, and even a few passing references to Barneyscan lie scattered about in the code. These are very small elements of the overall code base, but their appearance reminds me that no code is an island.</p><p style="margin: 0px 0px 7px; padding: 0px 0px 0px 30px; color: #5b5b5b; font-family: verdana, arial, helvetica, sans-serif; font-size: 13px; line-height: 18.140625px; background-color: #ffffff;">This is the kind of code I aspire to write.&#8221;</p><p style="margin: 0px 0px 7px; padding: 0px; color: #5b5b5b; font-family: verdana, arial, helvetica, sans-serif; font-size: 13px; line-height: 18.140625px; background-color: #ffffff;">And this is the kind of code we all can learn from. Software source code is the literature of computer scientists, and it deserves to be studied and appreciated. Enjoy a view of Photoshop from the inside.</p><p style="margin: 0px 0px 7px; padding: 0px; color: #5b5b5b; font-family: verdana, arial, helvetica, sans-serif; font-size: 13px; line-height: 18.140625px; background-color: #ffffff;">&nbsp;</p><h2>Early Photoshop screenshots*</h2><p style="margin: 0px 0px 7px; padding: 0px; color: #5b5b5b; font-family: verdana, arial, helvetica, sans-serif; font-size: 13px; line-height: 18.140625px; background-color: #ffffff;">&nbsp;</p><div id="attachment_2202"  aligncenter"="" style="margin: 10px auto; padding: 5px; border-top-right-radius: 3px; border-top-left-radius: 3px; -webkit-box-shadow: #cacaca 0px 0px 3px; box-shadow: #cacaca 0px 0px 3px; border: 1px solid #e2e2e2; background-color: #ffffff; color: #5b5b5b; font-family: verdana, arial, helvetica, sans-serif; font-size: 13px; line-height: 18.140625px; width: 460px;"><a href="http://www.computerhistory.org/atchm//wp-content/uploads/2013/01/screen_main.jpg" rel="fancybox" style="color: #22589d; text-decoration: initial; outline: none; cursor: pointer;"><img wp-image-2202=""  image-stylized"="" src="http://www.computerhistory.org/atchm//wp-content/uploads/2013/01/screen_main.jpg" alt="" width="460" height="341" style="border: 5px solid black; display: block; padding: 0px; border-top-right-radius: 3px; border-top-left-radius: 3px; -webkit-box-shadow: #cacaca 0px 0px 3px; box-shadow: #cacaca 0px 0px 3px; margin: 0px;" /></a><p style="margin: 0px 0px 7px; padding: 10px 5px; font-size: 0.8em; color: #333333; line-height: 1.4em;">The home screen, showing the available tools.</p></div><p style="margin: 0px 0px 7px; padding: 0px; color: #5b5b5b; font-family: verdana, arial, helvetica, sans-serif; font-size: 13px; line-height: 18.140625px; background-color: #ffffff;">&nbsp;</p><div id="attachment_2200"  aligncenter"="" style="margin: 10px auto; padding: 5px; border-top-right-radius: 3px; border-top-left-radius: 3px; -webkit-box-shadow: #cacaca 0px 0px 3px; box-shadow: #cacaca 0px 0px 3px; border: 1px solid #e2e2e2; background-color: #ffffff; color: #5b5b5b; font-family: verdana, arial, helvetica, sans-serif; font-size: 13px; line-height: 18.140625px; width: 460px;"><a href="http://www.computerhistory.org/atchm//wp-content/uploads/2013/01/screen_brushes.jpg" rel="fancybox" style="color: #22589d; text-decoration: initial; outline: none; cursor: pointer;"><img wp-image-2200=""  image-stylized"="" src="http://www.computerhistory.org/atchm//wp-content/uploads/2013/01/screen_brushes.jpg" alt="" width="460" height="280" style="border: 5px solid black; display: block; padding: 0px; border-top-right-radius: 3px; border-top-left-radius: 3px; -webkit-box-shadow: #cacaca 0px 0px 3px; box-shadow: #cacaca 0px 0px 3px; margin: 0px;" /></a><p style="margin: 0px 0px 7px; padding: 10px 5px; font-size: 0.8em; color: #333333; line-height: 1.4em;">Photoshop allowed you to select brush color as well as size and texture. (The first color Mac was the Macintosh II in 1987.)</p></div><p style="margin: 0px 0px 7px; padding: 0px; color: #5b5b5b; font-family: verdana, arial, helvetica, sans-serif; font-size: 13px; line-height: 18.140625px; background-color: #ffffff;">&nbsp;</p><div id="attachment_2197"  aligncenter"="" style="margin: 10px auto; padding: 5px; border-top-right-radius: 3px; border-top-left-radius: 3px; -webkit-box-shadow: #cacaca 0px 0px 3px; box-shadow: #cacaca 0px 0px 3px; border: 1px solid #e2e2e2; background-color: #ffffff; color: #5b5b5b; font-family: verdana, arial, helvetica, sans-serif; font-size: 13px; line-height: 18.140625px; width: 418px;"><a href="http://www.computerhistory.org/atchm//wp-content/uploads/2013/01/screen_image_filters.jpg" rel="fancybox" style="color: #22589d; text-decoration: initial; outline: none; cursor: pointer;"><img image-stylized"="" src="http://www.computerhistory.org/atchm//wp-content/uploads/2013/01/screen_image_filters.jpg" alt="" width="418" height="263" style="border: 5px solid black; display: block; padding: 0px; border-top-right-radius: 3px; border-top-left-radius: 3px; -webkit-box-shadow: #cacaca 0px 0px 3px; box-shadow: #cacaca 0px 0px 3px; margin: 0px;" /></a><p style="margin: 0px 0px 7px; padding: 10px 5px; font-size: 0.8em; color: #333333; line-height: 1.4em;">There were some sophisticated selection tools, and a good assortment of image filters. One important missing feature, which came with version 3 in 1994, was the ability to divide an image into multiple layers.</p></div><p style="margin: 0px 0px 7px; padding: 0px; color: #5b5b5b; font-family: verdana, arial, helvetica, sans-serif; font-size: 13px; line-height: 18.140625px; background-color: #ffffff;">&nbsp;</p><div id="attachment_2199"  aligncenter"="" style="margin: 10px auto; padding: 5px; border-top-right-radius: 3px; border-top-left-radius: 3px; -webkit-box-shadow: #cacaca 0px 0px 3px; box-shadow: #cacaca 0px 0px 3px; border: 1px solid #e2e2e2; background-color: #ffffff; color: #5b5b5b; font-family: verdana, arial, helvetica, sans-serif; font-size: 13px; line-height: 18.140625px; width: 460px;"><a href="http://www.computerhistory.org/atchm//wp-content/uploads/2013/01/screen_preferences.jpg" rel="fancybox" style="color: #22589d; text-decoration: initial; outline: none; cursor: pointer;"><img image-stylized"="" src="http://www.computerhistory.org/atchm//wp-content/uploads/2013/01/screen_preferences.jpg" alt="" width="460" height="277" style="border: 5px solid black; display: block; padding: 0px; border-top-right-radius: 3px; border-top-left-radius: 3px; -webkit-box-shadow: #cacaca 0px 0px 3px; box-shadow: #cacaca 0px 0px 3px; margin: 0px;" /></a><p style="margin: 0px 0px 7px; padding: 10px 5px; font-size: 0.8em; color: #333333; line-height: 1.4em;">The preferences page allowed for some customization of the features.</p></div><p style="margin: 0px 0px 7px; padding: 0px; color: #5b5b5b; font-family: verdana, arial, helvetica, sans-serif; font-size: 13px; line-height: 18.140625px; background-color: #ffffff;">&nbsp;</p><div id="attachment_2201"  aligncenter"="" style="margin: 10px auto; padding: 5px; border-top-right-radius: 3px; border-top-left-radius: 3px; -webkit-box-shadow: #cacaca 0px 0px 3px; box-shadow: #cacaca 0px 0px 3px; border: 1px solid #e2e2e2; background-color: #ffffff; color: #5b5b5b; font-family: verdana, arial, helvetica, sans-serif; font-size: 13px; line-height: 18.140625px; width: 434px;"><a href="http://www.computerhistory.org/atchm//wp-content/uploads/2013/01/screen_fonts.jpg" rel="fancybox" style="color: #22589d; text-decoration: initial; outline: none; cursor: pointer;"><img wp-image-2201=""  image-stylized"="" src="http://www.computerhistory.org/atchm//wp-content/uploads/2013/01/screen_fonts.jpg" alt="" width="434" height="322" style="border: 5px solid black; display: block; padding: 0px; border-top-right-radius: 3px; border-top-left-radius: 3px; -webkit-box-shadow: #cacaca 0px 0px 3px; box-shadow: #cacaca 0px 0px 3px; margin: 0px;" /></a><p style="margin: 0px 0px 7px; padding: 10px 5px; font-size: 0.8em; color: #333333; line-height: 1.4em;">There was a limited choice of fonts, font sizes, and font styles. The text was entered into this dialog box, then moved into the image.</p></div><p style="margin: 0px 0px 7px; padding: 0px; color: #5b5b5b; font-family: verdana, arial, helvetica, sans-serif; font-size: 13px; line-height: 18.140625px; background-color: #ffffff;"><em>*Screen shots courtesy of creativebits,&nbsp;<a href="http://www.creativebits.org/" target="_blank" style="color: #22589d; text-decoration: initial; outline: none; cursor: pointer;">www.creativebits.org</a>.<br />from: &nbsp;</em><span style="font-family: verdana, 'courier new'; font-size: 14px; line-height: 21px;">http://computerhistory.org/atchm/adobe-photoshop-source-code/</span></p><img src ="http://www.blogjava.net/gembin/aggbug/395312.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/gembin/" target="_blank">gembin</a> 2013-02-14 16:28 <a href="http://www.blogjava.net/gembin/archive/2013/02/14/395312.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Thread-safety when injecting JPA EntityManager</title><link>http://www.blogjava.net/gembin/archive/2013/02/04/395088.html</link><dc:creator>gembin</dc:creator><author>gembin</author><pubDate>Mon, 04 Feb 2013 02:49:00 GMT</pubDate><guid>http://www.blogjava.net/gembin/archive/2013/02/04/395088.html</guid><wfw:comment>http://www.blogjava.net/gembin/comments/395088.html</wfw:comment><comments>http://www.blogjava.net/gembin/archive/2013/02/04/395088.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/gembin/comments/commentRss/395088.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/gembin/services/trackbacks/395088.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: Injecting&nbsp;EJB 3&nbsp;stateful beans into servlet instance fields is not thread-safe. Along the same line, injecting&nbsp;EntityManager&nbsp;with&nbsp;@PersistenceContext&nbsp;into servlet instanc...&nbsp;&nbsp;<a href='http://www.blogjava.net/gembin/archive/2013/02/04/395088.html'>阅读全文</a><img src ="http://www.blogjava.net/gembin/aggbug/395088.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/gembin/" target="_blank">gembin</a> 2013-02-04 10:49 <a href="http://www.blogjava.net/gembin/archive/2013/02/04/395088.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Java Exception Practices</title><link>http://www.blogjava.net/gembin/archive/2012/12/26/393525.html</link><dc:creator>gembin</dc:creator><author>gembin</author><pubDate>Wed, 26 Dec 2012 15:56:00 GMT</pubDate><guid>http://www.blogjava.net/gembin/archive/2012/12/26/393525.html</guid><wfw:comment>http://www.blogjava.net/gembin/comments/393525.html</wfw:comment><comments>http://www.blogjava.net/gembin/archive/2012/12/26/393525.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.blogjava.net/gembin/comments/commentRss/393525.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/gembin/services/trackbacks/393525.html</trackback:ping><description><![CDATA[<strong style="color: red; ">Just keep it for reference.</strong><br /><br /><div><strong style="color: #0000ff; ">Best Practices for Exception Handling</strong></div>http://onjava.com/pub/a/onjava/2003/11/19/exceptions.html<br /><br /><div><strong style="color: #0000ff; ">The Trouble with Checked Exceptions</strong></div><div>http://www.artima.com/intv/handcuffs.html<br /><br /><div><strong style="color: #0000ff; ">Exception-Handling Antipatterns</strong></div><div>http://today.java.net/pub/a/today/2006/04/06/exception-handling-antipatterns.html<br /><br /><div><strong style="color: #0000ff; ">Exception management and error tracking in J2EE</strong></div><div>http://www.javaworld.com/javaworld/jw-07-2005/jw-0711-exception.html?page=1<br /><br /><div><strong style="color: #0000ff; ">Exceptional practices</strong></div><div>http://www.javaworld.com/javaworld/jw-12-2001/jw-1221-exceptions.html?page=1<br /><br /><div><strong style="color: #0000ff; ">Exception Handling</strong><br /><div>http://www.objectsource.com/j2eechapters/Ch18-Exception_Handling.htm</div></div><br /><div><strong style="color: #0000ff; ">Spring MVC REST Exception Handling Best Practices&nbsp;</strong></div>http://www.stormpath.com/blog/spring-mvc-rest-exception-handling-best-practices-part-1<br />http://www.stormpath.com/blog/spring-mvc-rest-exception-handling-best-practices-part-2</div></div></div></div><img src ="http://www.blogjava.net/gembin/aggbug/393525.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/gembin/" target="_blank">gembin</a> 2012-12-26 23:56 <a href="http://www.blogjava.net/gembin/archive/2012/12/26/393525.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>The Trouble with Checked Exceptions</title><link>http://www.blogjava.net/gembin/archive/2012/12/26/393523.html</link><dc:creator>gembin</dc:creator><author>gembin</author><pubDate>Wed, 26 Dec 2012 15:35:00 GMT</pubDate><guid>http://www.blogjava.net/gembin/archive/2012/12/26/393523.html</guid><wfw:comment>http://www.blogjava.net/gembin/comments/393523.html</wfw:comment><comments>http://www.blogjava.net/gembin/archive/2012/12/26/393523.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/gembin/comments/commentRss/393523.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/gembin/services/trackbacks/393523.html</trackback:ping><description><![CDATA[<blockquote style="color: #212324; font-family: Arial, Helvetica, sans-serif; font-size: medium; line-height: normal; background-color: #ffffff; "><strong>Summary</strong><br />Anders Hejlsberg, the lead C# architect, talks with Bruce Eckel and Bill Venners about versionability and scalability issues with checked exceptions.</blockquote><p style="color: #212324; font-family: Arial, Helvetica, sans-serif; font-size: medium; line-height: normal; background-color: #ffffff; ">Anders Hejlsberg, a distinguished engineer at Microsoft, led the team that designed the C# (pronounced C Sharp) programming language. Hejlsberg first vaulted onto the software world stage in the early eighties by creating a Pascal compiler for MS-DOS and CP/M. A very young company called Borland soon hired Hejlsberg and bought his compiler, which was thereafter marketed as Turbo Pascal. At Borland, Hejlsberg continued to develop Turbo Pascal and eventually led the team that designed Turbo Pascal's replacement: Delphi. In 1996, after 13 years with Borland, Hejlsberg joined Microsoft, where he initially worked as an architect of Visual J++ and the Windows Foundation Classes (WFC). Subsequently, Hejlsberg was chief designer of C# and a key participant in the creation of the .NET framework. Currently, Anders Hejlsberg leads the continued development of the C# programming language.</p><p style="color: #212324; font-family: Arial, Helvetica, sans-serif; font-size: medium; line-height: normal; background-color: #ffffff; ">On July 30, 2003, Bruce Eckel, author of&nbsp;<em>Thinking in C++</em>&nbsp;and&nbsp;<em>Thinking in Java</em>, and Bill Venners, editor-in-chief of Artima.com, met with Anders Hejlsberg in his office at Microsoft in Redmond, Washington. In this interview, which will be published in multiple installments on Artima.com and on an audio CD-ROM to be released this fall by Bruce Eckel, Anders Hejlsberg discusses many design choices of the C# language and the .NET framework.</p><ul style="color: #212324; font-family: Arial, Helvetica, sans-serif; font-size: medium; line-height: normal; background-color: #ffffff; "><li>In&nbsp;<a href="http://www.artima.com/intv/csdes.html" style="color: #800080; text-decoration: none; ">Part I: The C# Design Process</a>, Hejlsberg discusses the process used by the team that designed C#, and the relative merits of usability studies and good taste in language design.</li><li>In this second installment, Hejlsberg discusses versionability and scalability issues with checked exceptions.<br /><br /><h1>Remaining Neutral on Checked Exceptions</h1><p><strong>Bruce Eckel</strong>: C# doesn't have checked exceptions. How did you decide whether or not to put checked exceptions into C#?</p><p><strong>Anders Hejlsberg</strong>: I see two big issues with checked exceptions: scalability and versionability. I know you've written some about checked exceptions too, and you tend to agree with our line of thinking.</p><p><strong>Bruce Eckel</strong>: I used to think that checked exceptions were really great.</p><p><strong>Anders Hejlsberg</strong>: Exactly. Frankly, they look really great up front, and there's nothing wrong with the idea. I completely agree that checked exceptions are a wonderful feature. It's just that particular implementations can be problematic. By implementing checked exceptions the way it's done in Java, for example, I think you just take one set of problems and trade them for another set of problems. In the end it's not clear to me that you actually make life any easier. You just make it different.</p><p><strong>Bruce Eckel</strong>: Was there a lot of disagreement in the C# design team about checked excpetions?</p><p><strong>Anders Hejlsberg</strong>: No, I think there was fairly broad agreement in our design group.</p><p>C# is basically silent on the checked exceptions issue. Once a better solution is known&#8212;and trust me we continue to think about it&#8212;we can go back and actually put something in place. I'm a strong believer that if you don't have anything right to say, or anything that moves the art forward, then you'd better just be completely silent and neutral, as opposed to trying to lay out a framework.</p><p>If you ask beginning programmers to write a calendar control, they often think to themselves, "Oh, I'm going to write the world's best calendar control! It's going to be polymorphic with respect to the kind of calendar. It will have displayers, and mungers, and this, that, and the other." They need to ship a calendar application in two months. They put all this infrastructure into place in the control, and then spend two days writing a crappy calendar application on top of it. They'll think, "In the next version of the application, I'm going to do so much more."</p><p>Once they start thinking about how they're actually going to implement all of these other concretizations of their abstract design, however, it turns out that their design is completely wrong. And now they've painted themself into a corner, and they have to throw the whole thing out. I have seen that over and over. I'm a strong believer in being minimalistic. Unless you actually are going to solve the general problem, don't try and put in place a framework for solving a specific one, because you don't know what that framework should look like.</p><p><strong>Bruce Eckel</strong>: The Extreme Programmers say, "Do the simplest thing that could possibly work."</p><p><strong>Anders Hejlsberg</strong>: Yeah, well, Einstein said that, "Do the simplest thing possible, but no simpler." The concern I have about checked exceptions is the handcuffs they put on programmers. You see programmers picking up new APIs that have all these throws clauses, and then you see how convoluted their code gets, and you realize the checked exceptions aren't helping them any. It is sort of these dictatorial API designers telling you how to do your exception handling. They should not be doing that.<br /><br /><h1>Versioning with Checked Exceptions</h1><p><strong>Bill Venners</strong>: You mentioned scalability and versioning concerns with respect to checked exceptions. Could you clarify what you mean by those two issues?</p><p><strong>Anders Hejlsberg</strong>: Let's start with versioning, because the issues are pretty easy to see there. Let's say I create a method&nbsp;<code style="font-family: 'Lucida Console', 'American Typewriter', 'Courier New', Courier, monospace; font-size: 0.95em; ">foo</code>&nbsp;that declares it throws exceptions&nbsp;<code style="font-family: 'Lucida Console', 'American Typewriter', 'Courier New', Courier, monospace; font-size: 0.95em; ">A</code>,&nbsp;<code style="font-family: 'Lucida Console', 'American Typewriter', 'Courier New', Courier, monospace; font-size: 0.95em; ">B</code>, and&nbsp;<code style="font-family: 'Lucida Console', 'American Typewriter', 'Courier New', Courier, monospace; font-size: 0.95em; ">C</code>. In version two of&nbsp;<code style="font-family: 'Lucida Console', 'American Typewriter', 'Courier New', Courier, monospace; font-size: 0.95em; ">foo</code>, I want to add a bunch of features, and now&nbsp;<code style="font-family: 'Lucida Console', 'American Typewriter', 'Courier New', Courier, monospace; font-size: 0.95em; ">foo</code>&nbsp;might throw exception&nbsp;<code style="font-family: 'Lucida Console', 'American Typewriter', 'Courier New', Courier, monospace; font-size: 0.95em; ">D</code>. It is a breaking change for me to add&nbsp;<code style="font-family: 'Lucida Console', 'American Typewriter', 'Courier New', Courier, monospace; font-size: 0.95em; ">D</code>&nbsp;to the throws clause of that method, because existing caller of that method will almost certainly not handle that exception.</p><p>Adding a new exception to a throws clause in a new version breaks client code. It's like adding a method to an interface. After you publish an interface, it is for all practical purposes immutable, because any implementation of it might have the methods that you want to add in the next version. So you've got to create a new interface instead. Similarly with exceptions, you would either have to create a whole new method called&nbsp;<code style="font-family: 'Lucida Console', 'American Typewriter', 'Courier New', Courier, monospace; font-size: 0.95em; ">foo2</code>&nbsp;that throws more exceptions, or you would have to catch exception&nbsp;<code style="font-family: 'Lucida Console', 'American Typewriter', 'Courier New', Courier, monospace; font-size: 0.95em; ">D</code>&nbsp;in the new&nbsp;<code style="font-family: 'Lucida Console', 'American Typewriter', 'Courier New', Courier, monospace; font-size: 0.95em; ">foo</code>, and transform the&nbsp;<code style="font-family: 'Lucida Console', 'American Typewriter', 'Courier New', Courier, monospace; font-size: 0.95em; ">D</code>&nbsp;into an&nbsp;<code style="font-family: 'Lucida Console', 'American Typewriter', 'Courier New', Courier, monospace; font-size: 0.95em; ">A</code>,<code style="font-family: 'Lucida Console', 'American Typewriter', 'Courier New', Courier, monospace; font-size: 0.95em; ">B</code>, or&nbsp;<code style="font-family: 'Lucida Console', 'American Typewriter', 'Courier New', Courier, monospace; font-size: 0.95em; ">C</code>.</p><p><strong>Bill Venners</strong>: But aren't you breaking their code in that case anyway, even in a language without checked exceptions? If the new version of&nbsp;<code style="font-family: 'Lucida Console', 'American Typewriter', 'Courier New', Courier, monospace; font-size: 0.95em; ">foo</code>&nbsp;is going to throw a new exception that clients should think about handling, isn't their code broken just by the fact that they didn't expect that exception when they wrote the code?</p><p><strong>Anders Hejlsberg</strong>: No, because in a lot of cases, people don't care. They're not going to handle any of these exceptions. There's a bottom level exception handler around their message loop. That handler is just going to bring up a dialog that says what went wrong and continue. The programmers protect their code by writing try finally's everywhere, so they'll back out correctly if an exception occurs, but they're not actually interested in handling the exceptions.</p><p>The throws clause, at least the way it's implemented in Java, doesn't necessarily force you to handle the exceptions, but if you don't handle them, it forces you to acknowledge precisely which exceptions might pass through. It requires you to either catch declared exceptions or put them in your own throws clause. To work around this requirement, people do ridiculous things. For example, they decorate every method with, "<code style="font-family: 'Lucida Console', 'American Typewriter', 'Courier New', Courier, monospace; font-size: 0.95em; ">throws Exception</code>." That just completely defeats the feature, and you just made the programmer write more gobbledy gunk. That doesn't help anybody.</p><p><strong>Bill Venners</strong>: So you think the more common case is that callers don't explicitly handle exceptions in deference to a general catch clause further up the call stack?</p><p><strong>Anders Hejlsberg</strong>: It is funny how people think that the important thing about exceptions is handling them. That is not the important thing about exceptions. In a well-written application there's a ratio of ten to one, in my opinion, of try finally to try catch. Or in C#,&nbsp;<code style="font-family: 'Lucida Console', 'American Typewriter', 'Courier New', Courier, monospace; font-size: 0.95em; ">using</code>&nbsp;statements, which are like try finally.</p><p><strong>Bill Venners</strong>: What's in the finally?</p><p><strong>Anders Hejlsberg</strong>: In the finally, you protect yourself against the exceptions, but you don't actually handle them. Error handling you put somewhere else. Surely in any kind of event-driven application like any kind of modern UI, you typically put an exception handler around your main message pump, and you just handle exceptions as they fall out that way. But you make sure you protect yourself all the way out by deallocating any resources you've grabbed, and so forth. You clean up after yourself, so you're always in a consistent state. You don't want a program where in 100 different places you handle exceptions and pop up error dialogs. What if you want to change the way you put up that dialog box? That's just terrible. The exception handling should be centralized, and you should just protect yourself as the exceptions propagate out to the handler.<br /><br /><h1>The Scalability of Checked Exceptions</h1><strong>Bill Venners</strong>: What is the scalability issue with checked exceptions?<p><strong>Anders Hejlsberg</strong>: The scalability issue is somewhat related to the versionability issue. In the small, checked exceptions are very enticing. With a little example, you can show that you've actually checked that you caught the&nbsp;<code style="font-family: 'Lucida Console', 'American Typewriter', 'Courier New', Courier, monospace; font-size: 0.95em; ">FileNotFoundException</code>, and isn't that great? Well, that's fine when you're just calling one API. The trouble begins when you start building big systems where you're talking to four or five different subsystems. Each subsystem throws four to ten exceptions. Now, each time you walk up the ladder of aggregation, you have this exponential hierarchy below you of exceptions you have to deal with. You end up having to declare 40 exceptions that you might throw. And once you aggregate that with another subsystem you've got 80 exceptions in your throws clause. It just balloons out of control.</p><p>In the large, checked exceptions become such an irritation that people completely circumvent the feature. They either say, "<code style="font-family: 'Lucida Console', 'American Typewriter', 'Courier New', Courier, monospace; font-size: 0.95em; ">throws Exception</code>," everywhere; or&#8212;and I can't tell you how many times I've seen this&#8212;they say, "<code style="font-family: 'Lucida Console', 'American Typewriter', 'Courier New', Courier, monospace; font-size: 0.95em; ">try, da da da da da, catch curly curly</code>." They think, "Oh I'll come back and deal with these empty catch clauses later," and then of course they never do. In those situations, checked exceptions have actually degraded the quality of the system in the large.</p><p>And so, when you take all of these issues, to me it just seems more thinking is needed before we put some kind of checked exceptions mechanism in place for C#. But that said, there's certainly tremendous value in knowing what exceptions can get thrown, and having some sort of tool that checks. I don't think we can construct hard and fast rules down to, it is either a compiler error or not. But I think we can certainly do a lot with analysis tools that detect suspicious code, including uncaught exceptions, and points out those potential holes to you.<br /><br />from: &nbsp;http://www.artima.com/intv/handcuffs.html<br /><br /></p></p></p></li></ul><img src ="http://www.blogjava.net/gembin/aggbug/393523.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/gembin/" target="_blank">gembin</a> 2012-12-26 23:35 <a href="http://www.blogjava.net/gembin/archive/2012/12/26/393523.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>CentOS 6 安装后基本配置</title><link>http://www.blogjava.net/gembin/archive/2012/12/23/393380.html</link><dc:creator>gembin</dc:creator><author>gembin</author><pubDate>Sun, 23 Dec 2012 14:57:00 GMT</pubDate><guid>http://www.blogjava.net/gembin/archive/2012/12/23/393380.html</guid><wfw:comment>http://www.blogjava.net/gembin/comments/393380.html</wfw:comment><comments>http://www.blogjava.net/gembin/archive/2012/12/23/393380.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/gembin/comments/commentRss/393380.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/gembin/services/trackbacks/393380.html</trackback:ping><description><![CDATA[<p style="font-family: verdana; font-size: 13px; line-height: normal; background-color: #ffffff; "><strong>1</strong><strong>．网络配置</strong></p><p style="font-family: verdana; font-size: 13px; line-height: normal; background-color: #ffffff; ">（1）命令配置<br /># ifconfig eth0 192.168.0.2 netmask 255.255.255.0 　　//ip地址、子网掩码<br /># route add default gw 192.168.0.1 dev eth0　　//网关<br /># hostname centos 　　//计算机名</p><p style="font-family: verdana; font-size: 13px; line-height: normal; background-color: #ffffff; ">（2）文件配置<br />&lt;1&gt;修改IP地址<br />修改对应网卡的IP地址的配置文件<br /># vi /etc/sysconfig/network-scripts/ifcfg-eth0<br />DEVICE=eth0　(描述网卡对应的设备别名，例如ifcfg-eth0的文件中它为eth0)<br />BOOTPROTO=static　(设置网卡获得ip地址的方式，可能的选项为static，dhcp或bootp，分别对应静态指定的ip地址，通过dhcp协议获得的ip地址，通过bootp协议获得的ip地址)<br />BROADCAST=192.168.0.255　(对应的子网广播地址)<br />HWADDR=00:07:E9:05:E8:B4　 (对应的网卡物理地址)<br />IPADDR=12.168.1.2　(如果设置网卡获得ip地址的方式为静态指定，此字段就指定了网卡对应的ip地址)<br />IPV6INIT=no　 (开启或关闭IPv6；关闭no，开启yes)<br />IPV6_AUTOCONF=no　 (开启或关闭IPv6自动配置；关闭no，开启yes)<br />NETMASK=255.255.255.0　(网卡对应的网络掩码)<br />NETWORK=192.168.1.0　(网卡对应的网络地址)<br />ONBOOT=yes　(系统启动时是否设置此网络接口，设置为yes时，系统启动时激活此设备)<br /><br />&lt;2&gt;修改网关<br />修改对应网卡的网关的配置文件<br /># vi /etc/sysconfig/network<br />NETWORKING=yes　(表示系统是否使用网络，一般设置为yes。如果设为no，则不能使用网络，而且很多系统服务程序将无法启动)<br />HOSTNAME=centos　(设置本机的主机名，这里设置的主机名要和/etc/hosts中设置的主机名对应)<br />GATEWAY=192.168.1.1　(设置本机连接的网关的IP地址。例如，网关为10.0.0.2)<br /><br />&lt;3&gt;修改DNS<br />修改对应网卡的DNS的配置文件<br /># vi /etc/resolv.conf<br />nameserver 202.101.224.68　(域名服务器)<br />nameserver 202.101.224.69　(域名服务器)<br /><br />&lt;4&gt;重新启动网络配置<br /># service network restart<br />或<br /># /etc/init.d/network restart<br /><br /><strong>2</strong><strong>．软件源配置</strong></p><p style="font-family: verdana; font-size: 13px; line-height: normal; background-color: #ffffff; ">国内速度较快的常用更新源如下：<br />http://mirrors.163.com/centos/ 163-网易<br />http://mirrors.ta139.com/centos/ 中国移动通信（山东移动）<br />http://centos.ustc.edu.cn/centos/ 中国科学技术大学<br />http://mirror.neu.edu.cn/centos/ 东北大学</p><p style="font-family: verdana; font-size: 13px; line-height: normal; background-color: #ffffff; "><strong>编辑yum</strong><strong>配置文件：&nbsp;</strong><br />#vi /etc/yum.repos.d/CentOS-Base.repo<br />[base]<br />name=CentOS-$releasever - Base<br />mirrorlist=http://mirrorlist.centos.org/?release=$releasever&amp;arch=$basearch&amp;repo=os<br />#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/<br />baseurl=http://mirrors.163.com/centos/$releasever/os/$basearch/<br />http://mirrors.ta139.com/centos/$releasever/os/$basearch/<br />http://centos.ustc.edu.cn/centos/$releasever/os/$basearch/<br />http://mirror.neu.edu.cn/centos/$releasever/os/$basearch/<br />gpgcheck=1<br />gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6</p><p style="font-family: verdana; font-size: 13px; line-height: normal; background-color: #ffffff; ">#released updates&nbsp;<br />[updates]<br />name=CentOS-$releasever - Updates<br />mirrorlist=http://mirrorlist.centos.org/?release=$releasever&amp;arch=$basearch&amp;repo=updates<br />#baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/<br />baseurl=http://mirrors.163.com/centos/$releasever/updates/$basearch/<br />http://mirrors.ta139.com/centos/$releasever/updates/$basearch/<br />http://centos.ustc.edu.cn/centos/$releasever/updates/$basearch/<br />http://mirror.neu.edu.cn/centos/$releasever/updates/$basearch/<br />gpgcheck=1<br />gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6</p><p style="font-family: verdana; font-size: 13px; line-height: normal; background-color: #ffffff; ">#additional packages that may be useful<br />[extras]<br />name=CentOS-$releasever - Extras<br />mirrorlist=http://mirrorlist.centos.org/?release=$releasever&amp;arch=$basearch&amp;repo=extras<br />#baseurl=http://mirror.centos.org/centos/$releasever/extras/$basearch/<br />baseurl=http://mirrors.163.com/centos/$releasever/extras/$basearch/<br />http://mirrors.ta139.com/centos/$releasever/extras/$basearch/<br />http://centos.ustc.edu.cn/centos/$releasever/extras/$basearch/<br />http://mirror.neu.edu.cn/centos/$releasever/extras/$basearch/<br />gpgcheck=1<br />gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6</p><p style="font-family: verdana; font-size: 13px; line-height: normal; background-color: #ffffff; ">#additional packages that extend functionality of existing packages<br />[centosplus]<br />name=CentOS-$releasever - Plus<br />mirrorlist=http://mirrorlist.centos.org/?release=$releasever&amp;arch=$basearch&amp;repo=centosplus<br />#baseurl=http://mirror.centos.org/centos/$releasever/centosplus/$basearch/<br />baseurl=http://mirrors.163.com/centos/$releasever/centosplus/$basearch/<br />http://mirrors.ta139.com/centos/$releasever/centosplus/$basearch/<br />http://centos.ustc.edu.cn/centos/$releasever/centosplus/$basearch/<br />http://mirror.neu.edu.cn/centos/$releasever/centosplus/$basearch/<br />gpgcheck=1<br />enabled=0<br />gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6</p><p style="font-family: verdana; font-size: 13px; line-height: normal; background-color: #ffffff; ">#contrib - packages by Centos Users<br />[contrib]<br />name=CentOS-$releasever - Contrib<br />mirrorlist=http://mirrorlist.centos.org/?release=$releasever&amp;arch=$basearch&amp;repo=contrib<br />#baseurl=http://mirror.centos.org/centos/$releasever/contrib/$basearch/<br />baseurl=http://mirrors.163.com/centos/$releasever/contrib/$basearch/<br />http://mirrors.ta139.com/centos/$releasever/contrib/$basearch/<br />http://centos.ustc.edu.cn/centos/$releasever/contrib/$basearch/<br />http://mirror.neu.edu.cn/centos/$releasever/contrib/$basearch/<br />gpgcheck=1<br />enabled=0<br />gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6</p><p style="font-family: verdana; font-size: 13px; line-height: normal; background-color: #ffffff; ">然后使用如下命令更新到最新系统：</p><p style="font-family: verdana; font-size: 13px; line-height: normal; background-color: #ffffff; ">#rpm &#8211;import /etc/pki/rpm-gpg-key*</p><span style="font-family: verdana; font-size: 13px; line-height: normal; background-color: #ffffff; ">#yum upgrade</span><p style="font-family: verdana; font-size: 13px; line-height: normal; background-color: #ffffff; "><strong>3</strong><strong>．安装语言包</strong></p><p style="font-family: verdana; font-size: 13px; line-height: normal; background-color: #ffffff; ">从安装盘进行安装，找到对应rpm包：<br />fonts-chinese-3.02-9.6.el5.noarch.rpm<br />fonts-ISO8859-2-75dpi-1.0-17.1.noarch.rpm</p><p style="font-family: verdana; font-size: 13px; line-height: normal; background-color: #ffffff; ">可以通过yum进行安装，安装办法为：<br />#yum groupinstall &lt;language&gt;-support</p><p style="font-family: verdana; font-size: 13px; line-height: normal; background-color: #ffffff; ">在 上面的命令中，&lt;language&gt; 是下列之一: assamese, bengali, chinese, gujarati, hindi, japanese, kannada, korean, malayalam, marathi, oriya, punjabi, sinhala, tamil, thai, 或 telegu。</p><p style="font-family: verdana; font-size: 13px; line-height: normal; background-color: #ffffff; "><strong>4</strong><strong>．解压缩软件&nbsp;</strong><br />#yum install unrar unzip p7zip-full</p><img src ="http://www.blogjava.net/gembin/aggbug/393380.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/gembin/" target="_blank">gembin</a> 2012-12-23 22:57 <a href="http://www.blogjava.net/gembin/archive/2012/12/23/393380.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>VirtualBox 安装Centos 之访问虚拟机里面的服务受阻解决方案</title><link>http://www.blogjava.net/gembin/archive/2012/12/23/393378.html</link><dc:creator>gembin</dc:creator><author>gembin</author><pubDate>Sun, 23 Dec 2012 14:40:00 GMT</pubDate><guid>http://www.blogjava.net/gembin/archive/2012/12/23/393378.html</guid><wfw:comment>http://www.blogjava.net/gembin/comments/393378.html</wfw:comment><comments>http://www.blogjava.net/gembin/archive/2012/12/23/393378.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/gembin/comments/commentRss/393378.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/gembin/services/trackbacks/393378.html</trackback:ping><description><![CDATA[<p style="margin: 0px 0px 10px; padding: 0px; color: #333333; font-family: 微软雅黑, Verdana, Tahoma, 'BitStream vera Sans', Arial, Helvetica, sans-serif; font-size: 13px; line-height: 26px; background-color: #fcfff6; ">情况是这样的，我学习cenots一直是在系统中采用virtualbox里面安装一个虚拟系统的方式。每次安装之后，都发现不能访问里面的80、21、3306等这些常用的端口。也就是说，我只能在本机访问这些端口，想从其他机器访问不OK了。想起以前自己为了这件事花了整整一周的时候才知道是端口的问题。今天一定要记录下来，免得下次又忘记了。</p><p style="margin: 0px 0px 10px; padding: 0px; color: #333333; font-family: 微软雅黑, Verdana, Tahoma, 'BitStream vera Sans', Arial, Helvetica, sans-serif; font-size: 13px; line-height: 26px; background-color: #fcfff6; ">开启80、21、3306端口：</p><pre prettyprint"="" style="margin-top: 6px; margin-bottom: 6px; padding: 2px 7px; font-family: 'Courier New', Courier, monospace, Fixed; overflow: auto; background-color: #f0f6e9; border: 1px solid #cccccc; font-size: 12.3px; line-height: 16px; width: 645.816650390625px; color: #333333; "><span style="margin: 0px; padding: 0px; color: #008800; ">/sbin/</span><span style="margin: 0px; padding: 0px; color: #000000; ">iptables </span><span style="margin: 0px; padding: 0px; color: #666600; ">-</span><span style="margin: 0px; padding: 0px; color: #000000; ">I INPUT </span><span style="margin: 0px; padding: 0px; color: #666600; ">-</span><span style="margin: 0px; padding: 0px; color: #000000; ">p tcp </span><span style="margin: 0px; padding: 0px; color: #666600; ">--</span><span style="margin: 0px; padding: 0px; color: #000000; ">dport </span><span style="margin: 0px; padding: 0px; color: #006666; ">80</span> <span style="margin: 0px; padding: 0px; color: #666600; ">-</span><span style="margin: 0px; padding: 0px; color: #000000; ">j ACCEPT <br /></span><span style="margin: 0px; padding: 0px; color: #666600; ">/</span><span style="margin: 0px; padding: 0px; color: #000000; ">sbin</span><span style="margin: 0px; padding: 0px; color: #666600; ">/</span><span style="margin: 0px; padding: 0px; color: #000000; ">iptables </span><span style="margin: 0px; padding: 0px; color: #666600; ">-</span><span style="margin: 0px; padding: 0px; color: #000000; ">I INPUT </span><span style="margin: 0px; padding: 0px; color: #666600; ">-</span><span style="margin: 0px; padding: 0px; color: #000000; ">p tcp </span><span style="margin: 0px; padding: 0px; color: #666600; ">--</span><span style="margin: 0px; padding: 0px; color: #000000; ">dport </span><span style="margin: 0px; padding: 0px; color: #006666; ">3306</span> <span style="margin: 0px; padding: 0px; color: #666600; ">-</span><span style="margin: 0px; padding: 0px; color: #000000; ">j ACCEPT <br /></span><span style="margin: 0px; padding: 0px; color: #666600; ">/</span><span style="margin: 0px; padding: 0px; color: #000000; ">sbin</span><span style="margin: 0px; padding: 0px; color: #666600; ">/</span><span style="margin: 0px; padding: 0px; color: #000000; ">iptables </span><span style="margin: 0px; padding: 0px; color: #666600; ">-</span><span style="margin: 0px; padding: 0px; color: #000000; ">I INPUT </span><span style="margin: 0px; padding: 0px; color: #666600; ">-</span><span style="margin: 0px; padding: 0px; color: #000000; ">p tcp </span><span style="margin: 0px; padding: 0px; color: #666600; ">--</span><span style="margin: 0px; padding: 0px; color: #000000; ">dport </span><span style="margin: 0px; padding: 0px; color: #006666; ">21</span> <span style="margin: 0px; padding: 0px; color: #666600; ">-</span><span style="margin: 0px; padding: 0px; color: #000000; ">j ACCEPT <br /></span><span style="margin: 0px; padding: 0px; color: #666600; ">/</span><span style="margin: 0px; padding: 0px; color: #000000; ">etc</span><span style="margin: 0px; padding: 0px; color: #666600; ">/</span><span style="margin: 0px; padding: 0px; color: #000000; ">init</span><span style="margin: 0px; padding: 0px; color: #666600; ">.</span><span style="margin: 0px; padding: 0px; color: #000000; ">d</span><span style="margin: 0px; padding: 0px; color: #666600; ">/</span><span style="margin: 0px; padding: 0px; color: #000000; ">iptables save  <br />service iptables restart</span></pre><p style="margin: 0px 0px 10px; padding: 0px; color: #333333; font-family: 微软雅黑, Verdana, Tahoma, 'BitStream vera Sans', Arial, Helvetica, sans-serif; font-size: 13px; line-height: 26px; background-color: #fcfff6; ">其实，刚刚看了以前写过的一篇文章。发现此文已经是多余的了。唉。既然写了。就写完整一点吧。</p><p style="margin: 0px 0px 10px; padding: 0px; color: #333333; font-family: 微软雅黑, Verdana, Tahoma, 'BitStream vera Sans', Arial, Helvetica, sans-serif; font-size: 13px; line-height: 26px; background-color: #fcfff6; ">一般来说，我们不会使用linux自带的防火墙的。在IDC机房，人家的防火墙是硬件。肯定比软件要强大得多。</p><p style="margin: 0px 0px 10px; padding: 0px; color: #333333; font-family: 微软雅黑, Verdana, Tahoma, 'BitStream vera Sans', Arial, Helvetica, sans-serif; font-size: 13px; line-height: 26px; background-color: #fcfff6; ">可以使用如下方式对操作防火墙：<br style="margin: 0px; padding: 0px; " />永久性关掉防火墙shell：</p><pre prettyprint"="" style="margin-top: 6px; margin-bottom: 6px; padding: 2px 7px; font-family: 'Courier New', Courier, monospace, Fixed; overflow: auto; background-color: #f0f6e9; border: 1px solid #cccccc; font-size: 12.3px; line-height: 16px; width: 645.816650390625px; color: #333333; "><span style="margin: 0px; padding: 0px; color: #000000; ">chkconfig </span><span style="margin: 0px; padding: 0px; color: #666600; ">--</span><span style="margin: 0px; padding: 0px; color: #000000; ">level </span><span style="margin: 0px; padding: 0px; color: #006666; ">35</span><span style="margin: 0px; padding: 0px; color: #000000; "> iptables off</span></pre><p style="margin: 0px 0px 10px; padding: 0px; color: #333333; font-family: 微软雅黑, Verdana, Tahoma, 'BitStream vera Sans', Arial, Helvetica, sans-serif; font-size: 13px; line-height: 26px; background-color: #fcfff6; ">通过如下命令查看防火墙是否关闭：</p><pre prettyprint"="" style="margin-top: 6px; margin-bottom: 6px; padding: 2px 7px; font-family: 'Courier New', Courier, monospace, Fixed; overflow: auto; background-color: #f0f6e9; border: 1px solid #cccccc; font-size: 12.3px; line-height: 16px; width: 645.816650390625px; color: #333333; "><span style="margin: 0px; padding: 0px; color: #000000; ">service iptables status</span></pre><p style="margin: 0px 0px 10px; padding: 0px; color: #333333; font-family: 微软雅黑, Verdana, Tahoma, 'BitStream vera Sans', Arial, Helvetica, sans-serif; font-size: 13px; line-height: 26px; background-color: #fcfff6; ">如果已经正确关闭，则会输出如下信息：</p><pre prettyprint"="" style="margin-top: 6px; margin-bottom: 6px; padding: 2px 7px; font-family: 'Courier New', Courier, monospace, Fixed; overflow: auto; background-color: #f0f6e9; border: 1px solid #cccccc; font-size: 12.3px; line-height: 16px; width: 645.816650390625px; color: #333333; "><span style="margin: 0px; padding: 0px; color: #000000; ">iptables</span><span style="margin: 0px; padding: 0px; color: #666600; ">：未运行防火墙。</span></pre><p style="margin: 0px 0px 10px; padding: 0px; color: #333333; font-family: 微软雅黑, Verdana, Tahoma, 'BitStream vera Sans', Arial, Helvetica, sans-serif; font-size: 13px; line-height: 26px; background-color: #fcfff6; ">如果，你的是英文版本，则可能提示信息不太一样。<br style="margin: 0px; padding: 0px; " />如果没有输出类似防火墙关闭的信息，直接重启系统或者执行如下命令试一试：</p><pre prettyprint"="" style="margin-top: 6px; margin-bottom: 6px; padding: 2px 7px; font-family: 'Courier New', Courier, monospace, Fixed; overflow: auto; background-color: #f0f6e9; border: 1px solid #cccccc; font-size: 12.3px; line-height: 16px; width: 645.816650390625px; color: #333333; "><span style="margin: 0px; padding: 0px; color: #000000; ">service iptables stop</span></pre><p style="margin: 0px 0px 10px; padding: 0px; color: #333333; font-family: 微软雅黑, Verdana, Tahoma, 'BitStream vera Sans', Arial, Helvetica, sans-serif; font-size: 13px; line-height: 26px; background-color: #fcfff6; ">关掉防火墙之后，那么所有开启的端口都将会暴露给互联网所有人。那么，可能会导致别有用心的人针对你的系统漏洞做出一些破坏的事情。</p><p style="margin: 0px 0px 10px; padding: 0px; color: #333333; font-family: 微软雅黑, Verdana, Tahoma, 'BitStream vera Sans', Arial, Helvetica, sans-serif; font-size: 13px; line-height: 26px; background-color: #fcfff6; ">除了这个还有一个东西是就SELINUX这个玩意儿。如果防火墙放开了端口也无法进行访问。说明这个玩意做了限制，大家将它关闭即可。</p><img src ="http://www.blogjava.net/gembin/aggbug/393378.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/gembin/" target="_blank">gembin</a> 2012-12-23 22:40 <a href="http://www.blogjava.net/gembin/archive/2012/12/23/393378.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>VirtualBox 安装 CentOs 6.3</title><link>http://www.blogjava.net/gembin/archive/2012/12/23/393376.html</link><dc:creator>gembin</dc:creator><author>gembin</author><pubDate>Sun, 23 Dec 2012 14:15:00 GMT</pubDate><guid>http://www.blogjava.net/gembin/archive/2012/12/23/393376.html</guid><wfw:comment>http://www.blogjava.net/gembin/comments/393376.html</wfw:comment><comments>http://www.blogjava.net/gembin/archive/2012/12/23/393376.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/gembin/comments/commentRss/393376.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/gembin/services/trackbacks/393376.html</trackback:ping><description><![CDATA[<p style="margin: 0px 0px 10px; padding: 0px; color: #333333; font-family: 微软雅黑, Verdana, Tahoma, 'BitStream vera Sans', Arial, Helvetica, sans-serif; font-size: 13px; line-height: 26px; background-color: #fcfff6; ">一、环境及资源准备：<br style="margin: 0px; padding: 0px; " />1）虚拟机VritualBox 4.2版本。百度搜索下载此软件很容易下载，我一般是去天空软件和华军软件网站去下载。<br style="margin: 0px; padding: 0px; " />2）CentOs版本采用的是CentOS-6.3-x86_64-minimal.iso，即最小化安装的版本。最小化安装版本没有图形界面，这样消耗CPU和内存的大大减少，所以，常常用来安装服务器系统使用。而桌面版本学习使用居多。而我们的目的就是要以服务器配置为目标进行。<br style="margin: 0px; padding: 0px; " />CentOS 6.3 64位下载地址：<a title="http://mirror.bit.edu.cn/centos/6.3/isos/x86_64/CentOS-6.3-x86_64-minimal.iso" href="http://mirror.bit.edu.cn/centos/6.3/isos/x86_64/CentOS-6.3-x86_64-minimal.iso" target="_blank" style="margin: 0px; padding: 0px; text-decoration: none; color: #0b75b6; ">http://mirror.bit.edu.cn/centos/6.3/isos/x86_64/CentOS-6.3-x86_64-minimal.iso</a><br style="margin: 0px; padding: 0px; " />3）我的系统是Win7 64位的。 windows xp 和windows 7 32位均可。</p><p style="margin: 0px 0px 10px; padding: 0px; color: #333333; font-family: 微软雅黑, Verdana, Tahoma, 'BitStream vera Sans', Arial, Helvetica, sans-serif; font-size: 13px; line-height: 26px; background-color: #fcfff6; ">二、安装配置虚拟机系统<br style="margin: 0px; padding: 0px; " />1） 打虚拟机。然后，选择虚拟机工具栏上的&#8220;新建&#8221;按钮。如图：<br style="margin: 0px; padding: 0px; " /><a href="http://www.phpcxz.com/wp-content/uploads/2012/09/01.png" style="margin: 0px; padding: 0px; text-decoration: none; color: #0b75b6; "><img size-full=""  wp-image-69"="" title="01" src="http://www.phpcxz.com/wp-content/uploads/2012/09/01.png" alt="" width="638" height="400" style="margin: 0px 10px 0px 0px; padding: 0px; border: none; float: left; " /></a></p><p style="margin: 0px 0px 10px; padding: 0px; color: #333333; font-family: 微软雅黑, Verdana, Tahoma, 'BitStream vera Sans', Arial, Helvetica, sans-serif; font-size: 13px; line-height: 26px; background-color: #fcfff6; ">&nbsp;</p><p style="margin: 0px 0px 10px; padding: 0px; color: #333333; font-family: 微软雅黑, Verdana, Tahoma, 'BitStream vera Sans', Arial, Helvetica, sans-serif; font-size: 13px; line-height: 26px; background-color: #fcfff6; ">&nbsp;</p><p style="margin: 0px 0px 10px; padding: 0px; color: #333333; font-family: 微软雅黑, Verdana, Tahoma, 'BitStream vera Sans', Arial, Helvetica, sans-serif; font-size: 13px; line-height: 26px; background-color: #fcfff6; ">&nbsp;</p><p style="margin: 0px 0px 10px; padding: 0px; color: #333333; font-family: 微软雅黑, Verdana, Tahoma, 'BitStream vera Sans', Arial, Helvetica, sans-serif; font-size: 13px; line-height: 26px; background-color: #fcfff6; ">&nbsp;</p><p style="margin: 0px 0px 10px; padding: 0px; color: #333333; font-family: 微软雅黑, Verdana, Tahoma, 'BitStream vera Sans', Arial, Helvetica, sans-serif; font-size: 13px; line-height: 26px; background-color: #fcfff6; ">&nbsp;</p><p style="margin: 0px 0px 10px; padding: 0px; color: #333333; font-family: 微软雅黑, Verdana, Tahoma, 'BitStream vera Sans', Arial, Helvetica, sans-serif; font-size: 13px; line-height: 26px; background-color: #fcfff6; ">&nbsp;</p><p style="margin: 0px 0px 10px; padding: 0px; color: #333333; font-family: 微软雅黑, Verdana, Tahoma, 'BitStream vera Sans', Arial, Helvetica, sans-serif; font-size: 13px; line-height: 26px; background-color: #fcfff6; ">&nbsp;</p><p style="margin: 0px 0px 10px; padding: 0px; color: #333333; font-family: 微软雅黑, Verdana, Tahoma, 'BitStream vera Sans', Arial, Helvetica, sans-serif; font-size: 13px; line-height: 26px; background-color: #fcfff6; ">&nbsp;</p><p style="margin: 0px 0px 10px; padding: 0px; color: #333333; font-family: 微软雅黑, Verdana, Tahoma, 'BitStream vera Sans', Arial, Helvetica, sans-serif; font-size: 13px; line-height: 26px; background-color: #fcfff6; ">&nbsp;</p><p style="margin: 0px 0px 10px; padding: 0px; color: #333333; font-family: 微软雅黑, Verdana, Tahoma, 'BitStream vera Sans', Arial, Helvetica, sans-serif; font-size: 13px; line-height: 26px; background-color: #fcfff6; ">&nbsp;</p><p style="margin: 0px 0px 10px; padding: 0px; color: #333333; font-family: 微软雅黑, Verdana, Tahoma, 'BitStream vera Sans', Arial, Helvetica, sans-serif; font-size: 13px; line-height: 26px; background-color: #fcfff6; ">&nbsp;</p><p style="margin: 0px 0px 10px; padding: 0px; color: #333333; font-family: 微软雅黑, Verdana, Tahoma, 'BitStream vera Sans', Arial, Helvetica, sans-serif; font-size: 13px; line-height: 26px; background-color: #fcfff6; ">&nbsp;</p><p style="margin: 0px 0px 10px; padding: 0px; color: #333333; font-family: 微软雅黑, Verdana, Tahoma, 'BitStream vera Sans', Arial, Helvetica, sans-serif; font-size: 13px; line-height: 26px; background-color: #fcfff6; ">2）点击&#8220;新建&#8221;按钮后，弹出如下弹出框，我们在名称项里面输入：centos 6.3 mini。这个位置随便填写没有任何问题。如果，你填写的是windows xp的话，则类型会自动变成windows，版本自动会变成windows xp。当我们填写centos 6.3的时候，类型会自动变成Linux，版本会变成 Red Hat。但是，我们安装的是64位的，所以，要修改Red Hat (64 bit)。<br style="margin: 0px; padding: 0px; " /><a href="http://www.phpcxz.com/wp-content/uploads/2012/09/02.png" style="margin: 0px; padding: 0px; text-decoration: none; color: #0b75b6; "><img size-full=""  wp-image-70"="" title="02" src="http://www.phpcxz.com/wp-content/uploads/2012/09/02.png" alt="" width="640" height="397" style="margin: 0px; padding: 0px; border: none; " /></a></p><p style="margin: 0px 0px 10px; padding: 0px; color: #333333; font-family: 微软雅黑, Verdana, Tahoma, 'BitStream vera Sans', Arial, Helvetica, sans-serif; font-size: 13px; line-height: 26px; background-color: #fcfff6; ">3）点击&#8220;下一步&#8221;，弹出内存分配的选项框。这个地方特别要注意，内存在768MB这个位置是一个分水岭。如果低于这个这个值，则安装的时候会进入字符安装模式。大于等于这个值会进入图形安装界面。刚开始我不太熟悉字符安装模式，一直在这里纠结了很久都不知道为什么。后面，百度搜索答案的时候，发现官方已经有说明。如图，我分配了1024MB的内存。图中的绿色的线代表是内存最佳的分配值，超过这个值，可能会造成系统内存不足的问题。<br style="margin: 0px; padding: 0px; " /><a href="http://www.phpcxz.com/wp-content/uploads/2012/09/03.png" style="margin: 0px; padding: 0px; text-decoration: none; color: #0b75b6; "><img size-full=""  wp-image-71"="" title="03" src="http://www.phpcxz.com/wp-content/uploads/2012/09/03.png" alt="" width="639" height="402" style="margin: 0px; padding: 0px; border: none; " /></a></p><p style="margin: 0px 0px 10px; padding: 0px; color: #333333; font-family: 微软雅黑, Verdana, Tahoma, 'BitStream vera Sans', Arial, Helvetica, sans-serif; font-size: 13px; line-height: 26px; background-color: #fcfff6; ">4）点击&#8220;下一步&#8221;保持默认的选项不变，如图：<br style="margin: 0px; padding: 0px; " /><a href="http://www.phpcxz.com/wp-content/uploads/2012/09/04.png" style="margin: 0px; padding: 0px; text-decoration: none; color: #0b75b6; "><img size-full=""  wp-image-72"="" title="04" src="http://www.phpcxz.com/wp-content/uploads/2012/09/04.png" alt="" width="638" height="400" style="margin: 0px; padding: 0px; border: none; " /></a></p><p style="margin: 0px 0px 10px; padding: 0px; color: #333333; font-family: 微软雅黑, Verdana, Tahoma, 'BitStream vera Sans', Arial, Helvetica, sans-serif; font-size: 13px; line-height: 26px; background-color: #fcfff6; ">5）点击&#8220;创建&#8221;，弹出选项框，保持默认不变。如图：<br style="margin: 0px; padding: 0px; " /><a href="http://www.phpcxz.com/wp-content/uploads/2012/09/05.png" style="margin: 0px; padding: 0px; text-decoration: none; color: #0b75b6; "><img size-full=""  wp-image-73"="" title="05" src="http://www.phpcxz.com/wp-content/uploads/2012/09/05.png" alt="" width="643" height="418" style="margin: 0px; padding: 0px; border: none; " /></a></p><p style="margin: 0px 0px 10px; padding: 0px; color: #333333; font-family: 微软雅黑, Verdana, Tahoma, 'BitStream vera Sans', Arial, Helvetica, sans-serif; font-size: 13px; line-height: 26px; background-color: #fcfff6; ">6）点击&#8220;下一步&#8221;，弹出虚拟硬盘空间分配的方式。一般保持默认不变。如图：<br style="margin: 0px; padding: 0px; " /><a href="http://www.phpcxz.com/wp-content/uploads/2012/09/06.png" style="margin: 0px; padding: 0px; text-decoration: none; color: #0b75b6; "><img size-full=""  wp-image-74"="" title="06" src="http://www.phpcxz.com/wp-content/uploads/2012/09/06.png" alt="" width="642" height="415" style="margin: 0px; padding: 0px; border: none; " /></a></p><p style="margin: 0px 0px 10px; padding: 0px; color: #333333; font-family: 微软雅黑, Verdana, Tahoma, 'BitStream vera Sans', Arial, Helvetica, sans-serif; font-size: 13px; line-height: 26px; background-color: #fcfff6; ">7）点击&#8220;下一步&#8221;，设置虚拟硬盘位置和大小。我将虚拟硬盘文件的位置放置在了G:\VBoxs中，大小配置20GB。如图：<br style="margin: 0px; padding: 0px; " /><a href="http://www.phpcxz.com/wp-content/uploads/2012/09/07.png" style="margin: 0px; padding: 0px; text-decoration: none; color: #0b75b6; "><img size-full=""  wp-image-75"="" title="07" src="http://www.phpcxz.com/wp-content/uploads/2012/09/07.png" alt="" width="639" height="415" style="margin: 0px; padding: 0px; border: none; " /></a></p><p style="margin: 0px 0px 10px; padding: 0px; color: #333333; font-family: 微软雅黑, Verdana, Tahoma, 'BitStream vera Sans', Arial, Helvetica, sans-serif; font-size: 13px; line-height: 26px; background-color: #fcfff6; ">8）点击&#8220;创建&#8221;按钮，即完成了对虚拟机的创建。但是，此时只是把配置做好了。即下来的操作才是安装系统。此时，在VBox列表里面已经有了刚才创建的虚拟机。如图：<br style="margin: 0px; padding: 0px; " /><a href="http://www.phpcxz.com/wp-content/uploads/2012/09/08.png" style="margin: 0px; padding: 0px; text-decoration: none; color: #0b75b6; "><img size-full=""  wp-image-76"="" title="08" src="http://www.phpcxz.com/wp-content/uploads/2012/09/08.png" alt="" width="644" height="283" style="margin: 0px; padding: 0px; border: none; " /></a></p><p style="margin: 0px 0px 10px; padding: 0px; color: #333333; font-family: 微软雅黑, Verdana, Tahoma, 'BitStream vera Sans', Arial, Helvetica, sans-serif; font-size: 13px; line-height: 26px; background-color: #fcfff6; ">9）到此一步，我们的配置并没有结束。因为，很多机器现在的内存都已经4GB了。这会给32位的系统安装造成一些问题。所以，我们还需要来消除这些问题。右键选中，VBox列表中刚才创建的虚拟机，选择&#8220;设置&#8221;，选择&#8220;系统&#8221;，再选择&#8220;处理器(P)&#8221;，会看到一项：扩展特性。我们把它勾选上，让虚拟机支持4GB以上的内存。如图：<br style="margin: 0px; padding: 0px; " /><a href="http://www.phpcxz.com/wp-content/uploads/2012/09/09.png" style="margin: 0px; padding: 0px; text-decoration: none; color: #0b75b6; "><img size-full=""  wp-image-77"="" title="09" src="http://www.phpcxz.com/wp-content/uploads/2012/09/09.png" alt="" width="642" height="493" style="margin: 0px; padding: 0px; border: none; " /></a></p><p style="margin: 0px 0px 10px; padding: 0px; color: #333333; font-family: 微软雅黑, Verdana, Tahoma, 'BitStream vera Sans', Arial, Helvetica, sans-serif; font-size: 13px; line-height: 26px; background-color: #fcfff6; ">10）现在我们要把Centos ISO镜像文件加载到虚拟机中。在上图中的左侧中选择&#8220;储存&#8221;。然后根据下图中的操作进行：<br style="margin: 0px; padding: 0px; " /><a href="http://www.phpcxz.com/wp-content/uploads/2012/09/10.png" style="margin: 0px; padding: 0px; text-decoration: none; color: #0b75b6; "><img size-full=""  wp-image-78"="" title="10" src="http://www.phpcxz.com/wp-content/uploads/2012/09/10.png" alt="" width="642" height="496" style="margin: 0px; padding: 0px; border: none; " /></a></p><p style="margin: 0px 0px 10px; padding: 0px; color: #333333; font-family: 微软雅黑, Verdana, Tahoma, 'BitStream vera Sans', Arial, Helvetica, sans-serif; font-size: 13px; line-height: 26px; background-color: #fcfff6; ">11）虚拟机除了镜像还可以使用电脑的光驱进行安装。如图：<br style="margin: 0px; padding: 0px; " /><a href="http://www.phpcxz.com/wp-content/uploads/2012/09/11.png" style="margin: 0px; padding: 0px; text-decoration: none; color: #0b75b6; "><img size-full=""  wp-image-79"="" title="11" src="http://www.phpcxz.com/wp-content/uploads/2012/09/11.png" alt="" width="401" height="162" style="margin: 0px; padding: 0px; border: none; " /></a></p><p style="margin: 0px 0px 10px; padding: 0px; color: #333333; font-family: 微软雅黑, Verdana, Tahoma, 'BitStream vera Sans', Arial, Helvetica, sans-serif; font-size: 13px; line-height: 26px; background-color: #fcfff6; ">然后点击&#8220;确定&#8221;即可。</p><p style="margin: 0px 0px 10px; padding: 0px; color: #333333; font-family: 微软雅黑, Verdana, Tahoma, 'BitStream vera Sans', Arial, Helvetica, sans-serif; font-size: 13px; line-height: 26px; background-color: #fcfff6; ">12）此时，我们再点击VBox工具样上的&#8220;启动&#8221;按钮。点击之前，必须先选中刚才我们创建的虚拟机。就会到达如下界面：<br style="margin: 0px; padding: 0px; " /><a href="http://www.phpcxz.com/wp-content/uploads/2012/09/12.png" style="margin: 0px; padding: 0px; text-decoration: none; color: #0b75b6; "><img size-full=""  wp-image-80"="" title="12" src="http://www.phpcxz.com/wp-content/uploads/2012/09/12.png" alt="" width="653" height="559" style="margin: 0px; padding: 0px; border: none; " /></a></p><p style="margin: 0px 0px 10px; padding: 0px; color: #333333; font-family: 微软雅黑, Verdana, Tahoma, 'BitStream vera Sans', Arial, Helvetica, sans-serif; font-size: 13px; line-height: 26px; background-color: #fcfff6; ">如果，你进入这个界面之前，弹出如下错误提示：<br style="margin: 0px; padding: 0px; " />VT-x/AMD-V 硬件加速器已被启动，但当前处于无效状态。您虚拟电脑内的操作系统将无法检测到64位的CPU，因此也将无法启动&#8230;.</p><p style="margin: 0px 0px 10px; padding: 0px; color: #333333; font-family: 微软雅黑, Verdana, Tahoma, 'BitStream vera Sans', Arial, Helvetica, sans-serif; font-size: 13px; line-height: 26px; background-color: #fcfff6; ">那么，你要确定你的CPU是支持64位的，可以按照如下方式进行解决：<br style="margin: 0px; padding: 0px; " />1、请确认你的iso文件或DVD为64位的IOS文件。<br style="margin: 0px; padding: 0px; " />2、请确认你的CPU为64位的CPU。<br style="margin: 0px; padding: 0px; " />3、请确认BIOS的Virtualization是否为Enabled。设置方法：进入BIOS&#8212;-&gt;Advanced BIOS Features&#8212;&#8211;&gt;Virtualization&#8212;-&gt;Disabled(预设值)修改为Enabled，储存(save)，重启。有些BIOS设置方法与此并不相同，比如，有些笔记本Virualization这个选项进去是将VT-x与AMD-v两项设置分开的。所以，要将两个选项都要设置为Enabled。</p><p style="margin: 0px 0px 10px; padding: 0px; color: #333333; font-family: 微软雅黑, Verdana, Tahoma, 'BitStream vera Sans', Arial, Helvetica, sans-serif; font-size: 13px; line-height: 26px; background-color: #fcfff6; ">13）我们选择&#8221;Install or upgrade an existsing system&#8221;，然后，敲击回车键往下安装。</p><p style="margin: 0px 0px 10px; padding: 0px; color: #333333; font-family: 微软雅黑, Verdana, Tahoma, 'BitStream vera Sans', Arial, Helvetica, sans-serif; font-size: 13px; line-height: 26px; background-color: #fcfff6; ">14）接下来会的界面是让你检测要安装的系统介质是否完整有效。因为我是从正规渠道下载的系统ISO，所以，基本上不会出现问题。所以，我选择了&#8220;Skip&#8221;选项跳过介质检测。如图：</p><p style="margin: 0px 0px 10px; padding: 0px; color: #333333; font-family: 微软雅黑, Verdana, Tahoma, 'BitStream vera Sans', Arial, Helvetica, sans-serif; font-size: 13px; line-height: 26px; background-color: #fcfff6; "><a href="http://www.phpcxz.com/wp-content/uploads/2012/09/13.png" style="margin: 0px; padding: 0px; text-decoration: none; color: #0b75b6; "><img size-full=""  wp-image-82"="" title="13" src="http://www.phpcxz.com/wp-content/uploads/2012/09/13.png" alt="" width="735" height="482" style="margin: 0px; padding: 0px; border: none; " /></a></p><p style="margin: 0px 0px 10px; padding: 0px; color: #333333; font-family: 微软雅黑, Verdana, Tahoma, 'BitStream vera Sans', Arial, Helvetica, sans-serif; font-size: 13px; line-height: 26px; background-color: #fcfff6; ">&nbsp;</p><p style="margin: 0px 0px 10px; padding: 0px; color: #333333; font-family: 微软雅黑, Verdana, Tahoma, 'BitStream vera Sans', Arial, Helvetica, sans-serif; font-size: 13px; line-height: 26px; background-color: #fcfff6; ">15）回车&#8220;Skip&#8221;之后出现如下界面，选择点击&#8220;Next&#8221;。</p><p style="margin: 0px 0px 10px; padding: 0px; color: #333333; font-family: 微软雅黑, Verdana, Tahoma, 'BitStream vera Sans', Arial, Helvetica, sans-serif; font-size: 13px; line-height: 26px; background-color: #fcfff6; "><a href="http://www.phpcxz.com/wp-content/uploads/2012/09/14.png" style="margin: 0px; padding: 0px; text-decoration: none; color: #0b75b6; "><img size-full=""  wp-image-83"="" title="14" src="http://www.phpcxz.com/wp-content/uploads/2012/09/14.png" alt="" width="866" height="545" style="margin: 0px; padding: 0px; border: none; " /></a></p><p style="margin: 0px 0px 10px; padding: 0px; color: #333333; font-family: 微软雅黑, Verdana, Tahoma, 'BitStream vera Sans', Arial, Helvetica, sans-serif; font-size: 13px; line-height: 26px; background-color: #fcfff6; ">16）此时会出现一个选择当前系统语言的选项，我们肯定是选择简体中文了，选择之后点击下一步。如图：</p><p style="margin: 0px 0px 10px; padding: 0px; color: #333333; font-family: 微软雅黑, Verdana, Tahoma, 'BitStream vera Sans', Arial, Helvetica, sans-serif; font-size: 13px; line-height: 26px; background-color: #fcfff6; "><a href="http://www.phpcxz.com/wp-content/uploads/2012/09/15.png" style="margin: 0px; padding: 0px; text-decoration: none; color: #0b75b6; "><img size-full=""  wp-image-84"="" title="15" src="http://www.phpcxz.com/wp-content/uploads/2012/09/15.png" alt="" width="435" height="211" style="margin: 0px; padding: 0px; border: none; " /></a></p><p style="margin: 0px 0px 10px; padding: 0px; color: #333333; font-family: 微软雅黑, Verdana, Tahoma, 'BitStream vera Sans', Arial, Helvetica, sans-serif; font-size: 13px; line-height: 26px; background-color: #fcfff6; ">17）此时会出现一个键盘语言的选择，我们肯定是选择&#8220;美国式英语&#8221;了。也就是保持默认选项，点击&#8220;下一步&#8221;即可。如图：</p><p style="margin: 0px 0px 10px; padding: 0px; color: #333333; font-family: 微软雅黑, Verdana, Tahoma, 'BitStream vera Sans', Arial, Helvetica, sans-serif; font-size: 13px; line-height: 26px; background-color: #fcfff6; "><a href="http://www.phpcxz.com/wp-content/uploads/2012/09/16.png" style="margin: 0px; padding: 0px; text-decoration: none; color: #0b75b6; "><img size-full=""  wp-image-85"="" title="16" src="http://www.phpcxz.com/wp-content/uploads/2012/09/16.png" alt="" width="531" height="318" style="margin: 0px; padding: 0px; border: none; " /></a></p><p style="margin: 0px 0px 10px; padding: 0px; color: #333333; font-family: 微软雅黑, Verdana, Tahoma, 'BitStream vera Sans', Arial, Helvetica, sans-serif; font-size: 13px; line-height: 26px; background-color: #fcfff6; ">18）出现如下界面，保持默认即可，然后点击&#8220;下一步&#8221;继续往下安装。如图：</p><p style="margin: 0px 0px 10px; padding: 0px; color: #333333; font-family: 微软雅黑, Verdana, Tahoma, 'BitStream vera Sans', Arial, Helvetica, sans-serif; font-size: 13px; line-height: 26px; background-color: #fcfff6; "><a href="http://www.phpcxz.com/wp-content/uploads/2012/09/17.png" style="margin: 0px; padding: 0px; text-decoration: none; color: #0b75b6; "><img size-full=""  wp-image-86"="" title="17" src="http://www.phpcxz.com/wp-content/uploads/2012/09/17.png" alt="" width="690" height="144" style="margin: 0px; padding: 0px; border: none; " /></a></p><p style="margin: 0px 0px 10px; padding: 0px; color: #333333; font-family: 微软雅黑, Verdana, Tahoma, 'BitStream vera Sans', Arial, Helvetica, sans-serif; font-size: 13px; line-height: 26px; background-color: #fcfff6; ">19）出现如下界面，点击&#8220;是，忽略所有数据&#8221;。因为，在VirtualBox里面，所做的任何操作都不会影响到真实系统里面的数据。所以，放心大胆地选择此项吧。如图：</p><p style="margin: 0px 0px 10px; padding: 0px; color: #333333; font-family: 微软雅黑, Verdana, Tahoma, 'BitStream vera Sans', Arial, Helvetica, sans-serif; font-size: 13px; line-height: 26px; background-color: #fcfff6; "><a href="http://www.phpcxz.com/wp-content/uploads/2012/09/22.png" style="margin: 0px; padding: 0px; text-decoration: none; color: #0b75b6; "><img size-full=""  wp-image-87"="" title="22" src="http://www.phpcxz.com/wp-content/uploads/2012/09/22.png" alt="" width="386" height="184" style="margin: 0px; padding: 0px; border: none; " /></a></p><p style="margin: 0px 0px 10px; padding: 0px; color: #333333; font-family: 微软雅黑, Verdana, Tahoma, 'BitStream vera Sans', Arial, Helvetica, sans-serif; font-size: 13px; line-height: 26px; background-color: #fcfff6; ">20）然后出现如下界面，要求我们为这台计算机取一个名字。很简单，我们按照要求填写即可。如图：</p><p style="margin: 0px 0px 10px; padding: 0px; color: #333333; font-family: 微软雅黑, Verdana, Tahoma, 'BitStream vera Sans', Arial, Helvetica, sans-serif; font-size: 13px; line-height: 26px; background-color: #fcfff6; "><a href="http://www.phpcxz.com/wp-content/uploads/2012/09/19.png" style="margin: 0px; padding: 0px; text-decoration: none; color: #0b75b6; "><img size-full=""  wp-image-88"="" title="19" src="http://www.phpcxz.com/wp-content/uploads/2012/09/19.png" alt="" width="477" height="126" style="margin: 0px; padding: 0px; border: none; " /></a></p><p style="margin: 0px 0px 10px; padding: 0px; color: #333333; font-family: 微软雅黑, Verdana, Tahoma, 'BitStream vera Sans', Arial, Helvetica, sans-serif; font-size: 13px; line-height: 26px; background-color: #fcfff6; ">21）接下来的界面是让我们为电脑设置一个时区。我的选择如图所示：</p><p style="margin: 0px 0px 10px; padding: 0px; color: #333333; font-family: 微软雅黑, Verdana, Tahoma, 'BitStream vera Sans', Arial, Helvetica, sans-serif; font-size: 13px; line-height: 26px; background-color: #fcfff6; "><a href="http://www.phpcxz.com/wp-content/uploads/2012/09/20.png" style="margin: 0px; padding: 0px; text-decoration: none; color: #0b75b6; "><img size-full=""  wp-image-89"="" title="20" src="http://www.phpcxz.com/wp-content/uploads/2012/09/20.png" alt="" width="584" height="363" style="margin: 0px; padding: 0px; border: none; " /></a></p><p style="margin: 0px 0px 10px; padding: 0px; color: #333333; font-family: 微软雅黑, Verdana, Tahoma, 'BitStream vera Sans', Arial, Helvetica, sans-serif; font-size: 13px; line-height: 26px; background-color: #fcfff6; ">22）即下来，会要求我们为默认的root系统账户设置一个密码。如图：</p><p style="margin: 0px 0px 10px; padding: 0px; color: #333333; font-family: 微软雅黑, Verdana, Tahoma, 'BitStream vera Sans', Arial, Helvetica, sans-serif; font-size: 13px; line-height: 26px; background-color: #fcfff6; "><a href="http://www.phpcxz.com/wp-content/uploads/2012/09/21.png" style="margin: 0px; padding: 0px; text-decoration: none; color: #0b75b6; "><img size-full=""  wp-image-90"="" title="21" src="http://www.phpcxz.com/wp-content/uploads/2012/09/21.png" alt="" width="402" height="150" style="margin: 0px; padding: 0px; border: none; " /></a></p><p style="margin: 0px 0px 10px; padding: 0px; color: #333333; font-family: 微软雅黑, Verdana, Tahoma, 'BitStream vera Sans', Arial, Helvetica, sans-serif; font-size: 13px; line-height: 26px; background-color: #fcfff6; ">如果，你设置的密码过于简单。如：123456这样的密码，则系统会提示我们，密码强度不够安全。我们不管它，直接选择&#8220;无论如何都使用(U)&#8221; 即可。如图：</p><p style="margin: 0px 0px 10px; padding: 0px; color: #333333; font-family: 微软雅黑, Verdana, Tahoma, 'BitStream vera Sans', Arial, Helvetica, sans-serif; font-size: 13px; line-height: 26px; background-color: #fcfff6; "><a href="http://www.phpcxz.com/wp-content/uploads/2012/09/221.png" style="margin: 0px; padding: 0px; text-decoration: none; color: #0b75b6; "><img size-full=""  wp-image-91"="" title="22" src="http://www.phpcxz.com/wp-content/uploads/2012/09/221.png" alt="" width="386" height="184" style="margin: 0px; padding: 0px; border: none; " /></a></p><p style="margin: 0px 0px 10px; padding: 0px; color: #333333; font-family: 微软雅黑, Verdana, Tahoma, 'BitStream vera Sans', Arial, Helvetica, sans-serif; font-size: 13px; line-height: 26px; background-color: #fcfff6; ">23）在接下来的界面中，我们选择&#8220;使用所有空间&#8221;的选项进行安装。如果，你想在电脑上装双系统，那么请不要选择此项。我们是用VittualBox完全不用担心硬盘会被格式化的问题。如图：</p><p style="margin: 0px 0px 10px; padding: 0px; color: #333333; font-family: 微软雅黑, Verdana, Tahoma, 'BitStream vera Sans', Arial, Helvetica, sans-serif; font-size: 13px; line-height: 26px; background-color: #fcfff6; "><a href="http://www.phpcxz.com/wp-content/uploads/2012/09/23.png" style="margin: 0px; padding: 0px; text-decoration: none; color: #0b75b6; "><img size-full=""  wp-image-92"="" title="23" src="http://www.phpcxz.com/wp-content/uploads/2012/09/23.png" alt="" width="673" height="385" style="margin: 0px; padding: 0px; border: none; " /></a></p><p style="margin: 0px 0px 10px; padding: 0px; color: #333333; font-family: 微软雅黑, Verdana, Tahoma, 'BitStream vera Sans', Arial, Helvetica, sans-serif; font-size: 13px; line-height: 26px; background-color: #fcfff6; ">24）点击&#8220;下一步&#8221;会弹出如下提示框，我们选择&#8220;将修改写入硬盘&#8221;选择。</p><p style="margin: 0px 0px 10px; padding: 0px; color: #333333; font-family: 微软雅黑, Verdana, Tahoma, 'BitStream vera Sans', Arial, Helvetica, sans-serif; font-size: 13px; line-height: 26px; background-color: #fcfff6; "><a href="http://www.phpcxz.com/wp-content/uploads/2012/09/24.png" style="margin: 0px; padding: 0px; text-decoration: none; color: #0b75b6; "><img size-full=""  wp-image-93"="" title="24" src="http://www.phpcxz.com/wp-content/uploads/2012/09/24.png" alt="" width="436" height="175" style="margin: 0px; padding: 0px; border: none; " /></a></p><p style="margin: 0px 0px 10px; padding: 0px; color: #333333; font-family: 微软雅黑, Verdana, Tahoma, 'BitStream vera Sans', Arial, Helvetica, sans-serif; font-size: 13px; line-height: 26px; background-color: #fcfff6; ">25）OK。一切完毕之后，就该执行安装过程了。我们能做的就是等待。当安装进度100%的时候，会提示我们重新引导系统。到时候记得点击即可。如图：</p><p style="margin: 0px 0px 10px; padding: 0px; color: #333333; font-family: 微软雅黑, Verdana, Tahoma, 'BitStream vera Sans', Arial, Helvetica, sans-serif; font-size: 13px; line-height: 26px; background-color: #fcfff6; "><a href="http://www.phpcxz.com/wp-content/uploads/2012/09/25.png" style="margin: 0px; padding: 0px; text-decoration: none; color: #0b75b6; "><img size-full=""  wp-image-94"="" title="25" src="http://www.phpcxz.com/wp-content/uploads/2012/09/25.png" alt="" width="538" height="355" style="margin: 0px; padding: 0px; border: none; " /></a></p><p style="margin: 0px 0px 10px; padding: 0px; color: #333333; font-family: 微软雅黑, Verdana, Tahoma, 'BitStream vera Sans', Arial, Helvetica, sans-serif; font-size: 13px; line-height: 26px; background-color: #fcfff6; ">&nbsp;<br /><strong style="color: #000000; font-family: verdana; line-height: normal; background-color: #ffffff; ">可选的类型说明如下：&nbsp;</strong><br style="color: #000000; font-family: verdana; line-height: normal; background-color: #ffffff; " /><strong style="color: #000000; font-family: verdana; line-height: normal; background-color: #ffffff; ">Desktop&nbsp;</strong><span style="color: #000000; font-family: verdana; line-height: normal; background-color: #ffffff; ">　：基本的桌面系统，包括常用的桌面软件，如文档查看工具。</span><br style="color: #000000; font-family: verdana; line-height: normal; background-color: #ffffff; " /><strong style="color: #000000; font-family: verdana; line-height: normal; background-color: #ffffff; ">Minimal Desktop</strong><span style="color: #000000; font-family: verdana; line-height: normal; background-color: #ffffff; ">　：基本的桌面系统，包含的软件更少。</span><br style="color: #000000; font-family: verdana; line-height: normal; background-color: #ffffff; " /><strong style="color: #000000; font-family: verdana; line-height: normal; background-color: #ffffff; ">Minimal</strong><strong style="color: #000000; font-family: verdana; line-height: normal; background-color: #ffffff; ">　</strong><span style="color: #000000; font-family: verdana; line-height: normal; background-color: #ffffff; ">：基本的系统，不含有任何可选的软件包。</span><br style="color: #000000; font-family: verdana; line-height: normal; background-color: #ffffff; " /><strong style="color: #000000; font-family: verdana; line-height: normal; background-color: #ffffff; ">Basic Server&nbsp;</strong><span style="color: #000000; font-family: verdana; line-height: normal; background-color: #ffffff; ">　：安装的基本系统的平台支持，不包含桌面。</span><br style="color: #000000; font-family: verdana; line-height: normal; background-color: #ffffff; " /><strong style="color: #000000; font-family: verdana; line-height: normal; background-color: #ffffff; ">Database Server</strong><span style="color: #000000; font-family: verdana; line-height: normal; background-color: #ffffff; ">　：基本系统平台，加上MySQL和PostgreSQL数据库，无桌面。</span><br style="color: #000000; font-family: verdana; line-height: normal; background-color: #ffffff; " /><strong style="color: #000000; font-family: verdana; line-height: normal; background-color: #ffffff; ">Web Server</strong><strong style="color: #000000; font-family: verdana; line-height: normal; background-color: #ffffff; ">　：</strong><span style="color: #000000; font-family: verdana; line-height: normal; background-color: #ffffff; ">基本系统平台，加上PHP，Web server，还有MySQL和PostgreSQL数据库的客户端，无桌面。</span><br style="color: #000000; font-family: verdana; line-height: normal; background-color: #ffffff; " /><strong style="color: #000000; font-family: verdana; line-height: normal; background-color: #ffffff; ">Virtual Host</strong><strong style="color: #000000; font-family: verdana; line-height: normal; background-color: #ffffff; ">　</strong><span style="color: #000000; font-family: verdana; line-height: normal; background-color: #ffffff; ">：基本系统加虚拟平台。</span><br style="color: #000000; font-family: verdana; line-height: normal; background-color: #ffffff; " /><strong style="color: #000000; font-family: verdana; line-height: normal; background-color: #ffffff; ">Software Development Workstation</strong><span style="color: #000000; font-family: verdana; line-height: normal; background-color: #ffffff; ">　：包含软件包较多，基本系统，虚拟化平台，桌面环境，开发工具。</span><br /><br /></p><p style="margin: 0px 0px 10px; padding: 0px; color: #333333; font-family: 微软雅黑, Verdana, Tahoma, 'BitStream vera Sans', Arial, Helvetica, sans-serif; font-size: 13px; line-height: 26px; background-color: #fcfff6; ">到此关于VirtualBox安装Centos 6.3 最小化安装已经介绍完了。</p><img src ="http://www.blogjava.net/gembin/aggbug/393376.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/gembin/" target="_blank">gembin</a> 2012-12-23 22:15 <a href="http://www.blogjava.net/gembin/archive/2012/12/23/393376.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>CentOS-语言设置</title><link>http://www.blogjava.net/gembin/archive/2012/12/23/393375.html</link><dc:creator>gembin</dc:creator><author>gembin</author><pubDate>Sun, 23 Dec 2012 14:08:00 GMT</pubDate><guid>http://www.blogjava.net/gembin/archive/2012/12/23/393375.html</guid><wfw:comment>http://www.blogjava.net/gembin/comments/393375.html</wfw:comment><comments>http://www.blogjava.net/gembin/archive/2012/12/23/393375.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/gembin/comments/commentRss/393375.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/gembin/services/trackbacks/393375.html</trackback:ping><description><![CDATA[<p style="padding: 0px; margin: 1em 0px 0.5em; text-indent: 2em; color: #333333; font-family: Verdana, Arial, Tahoma; line-height: 25px; background-color: #ffffff; ">查看所有的locale语言</p><pre style="padding: 0px; margin-top: 0px; font-family: 'Courier New', monospace; font-size: 12px; width: 712px; overflow: auto; background-color: #f7f7f7; color: #333333; line-height: 25px; "><div id="codeCtrl_1" style="padding-left: 10px; margin: 0px 0px 0px 3em !important; border-left-width: 3px; border-left-style: solid; border-left-color: #146b00; color: #999999; "><a id="view_1" href="" style="padding: 0px; margin: 0px; color: #999999; text-decoration: none; background-image: none; border: none; background-position: initial initial; background-repeat: initial initial; ">view plain</a>&nbsp;&nbsp;&nbsp;<span id="clipinner" style="padding: 0px; margin: 0px; position: relative; width: 100px; "><a href="http://www.sunchis.com/html/os/linux/2011/1115/373.html#" style="padding: 0px; margin: 0px; color: #999999; text-decoration: none; background-image: none; border: none; background-position: initial initial; background-repeat: initial initial; ">copy</a><embed width="100" height="20" type="application/x-shockwave-flash" wmode="transparent" swliveconnect="true" allowscriptaccess="sameDomain" menu="false" src="http://www.sunchis.com/public/clipboard.swf" devicefont="false" id="clipboardswf_1" name="clipboardswf_1" style="padding: 0px; margin: 0px; position: absolute; left: 0px; top: 0px; "></span></div><ol style="padding: 5px 0px; margin: 0px 0px 1px 3em !important; border-style: none none none solid; border-left-width: 3px; border-left-color: #146b00; list-style-position: initial; list-style-image: initial; color: #5c5c5c; "><li style="padding: 0px 3px 0px 10px !important; margin: 0px !important; border: none; list-style: decimal-leading-zero outside; color: inherit; line-height: 1.3em; "><span style="padding: 0px; margin: 0px; border: none; color: black; background-color: inherit; ">#&nbsp;locale&nbsp;-a&nbsp;</span></li><li style="padding: 0px 3px 0px 10px !important; margin: 0px !important; border: none; list-style: decimal-leading-zero outside; line-height: 1.3em; "><span style="padding: 0px; margin: 0px; border: none; color: black; background-color: inherit; ">#&nbsp;locale&nbsp;-a|grep&nbsp;en&nbsp;</span></li></ol></pre><p style="padding: 0px; margin: 1em 0px 0.5em; text-indent: 2em; color: #333333; font-family: Verdana, Arial, Tahoma; line-height: 25px; background-color: #ffffff; ">&#9632; 查看当前操作系统使用的语言</p><pre style="padding: 0px; margin-top: 0px; font-family: 'Courier New', monospace; font-size: 12px; width: 712px; overflow: auto; background-color: #f7f7f7; color: #333333; line-height: 25px; "><div id="codeCtrl_2" style="padding-left: 10px; margin: 0px 0px 0px 3em !important; border-left-width: 3px; border-left-style: solid; border-left-color: #146b00; color: #999999; "><a id="view_2" href="" style="padding: 0px; margin: 0px; color: #999999; text-decoration: none; background-image: none; border: none; background-position: initial initial; background-repeat: initial initial; ">view plain</a>&nbsp;&nbsp;&nbsp;<span id="clipinner" style="padding: 0px; margin: 0px; position: relative; width: 100px; "><a href="http://www.sunchis.com/html/os/linux/2011/1115/373.html#" style="padding: 0px; margin: 0px; color: #999999; text-decoration: none; background-image: none; border: none; background-position: initial initial; background-repeat: initial initial; ">copy</a><embed width="100" height="20" type="application/x-shockwave-flash" wmode="transparent" swliveconnect="true" allowscriptaccess="sameDomain" menu="false" src="http://www.sunchis.com/public/clipboard.swf" devicefont="false" id="clipboardswf_2" name="clipboardswf_2" style="padding: 0px; margin: 0px; position: absolute; left: 0px; top: 0px; "></span></div><ol style="padding: 5px 0px; margin: 0px 0px 1px 3em !important; border-style: none none none solid; border-left-width: 3px; border-left-color: #146b00; list-style-position: initial; list-style-image: initial; color: #5c5c5c; "><li style="padding: 0px 3px 0px 10px !important; margin: 0px !important; border: none; list-style: decimal-leading-zero outside; color: inherit; line-height: 1.3em; "><span style="padding: 0px; margin: 0px; border: none; color: black; background-color: inherit; ">#&nbsp;echo&nbsp;$LANG&nbsp;</span></li></ol></pre><p style="padding: 0px; margin: 1em 0px 0.5em; text-indent: 2em; color: #333333; font-family: Verdana, Arial, Tahoma; line-height: 25px; background-color: #ffffff; ">&#9632; 设置系统locale语言为中文环境（永久生效）</p><p style="padding: 0px; margin: 1em 0px 0.5em; text-indent: 2em; color: #333333; font-family: Verdana, Arial, Tahoma; line-height: 25px; background-color: #ffffff; "># vi /etc/sysconfig/i18n</p><pre style="padding: 0px; margin-top: 0px; font-family: 'Courier New', monospace; font-size: 12px; width: 712px; overflow: auto; background-color: #f7f7f7; color: #333333; line-height: 25px; "><div id="codeCtrl_3" style="padding-left: 10px; margin: 0px 0px 0px 3em !important; border-left-width: 3px; border-left-style: solid; border-left-color: #146b00; color: #999999; "><a id="view_3" href="" style="padding: 0px; margin: 0px; color: #999999; text-decoration: none; background-image: none; border: none; background-position: initial initial; background-repeat: initial initial; ">view plain</a>&nbsp;&nbsp;&nbsp;<span id="clipinner" style="padding: 0px; margin: 0px; position: relative; width: 100px; "><a href="http://www.sunchis.com/html/os/linux/2011/1115/373.html#" style="padding: 0px; margin: 0px; color: #999999; text-decoration: none; background-image: none; border: none; background-position: initial initial; background-repeat: initial initial; ">copy</a><embed width="100" height="20" type="application/x-shockwave-flash" wmode="transparent" swliveconnect="true" allowscriptaccess="sameDomain" menu="false" src="http://www.sunchis.com/public/clipboard.swf" devicefont="false" id="clipboardswf_3" name="clipboardswf_3" style="padding: 0px; margin: 0px; position: absolute; left: 0px; top: 0px; "></span></div><ol style="padding: 5px 0px; margin: 0px 0px 1px 3em !important; border-style: none none none solid; border-left-width: 3px; border-left-color: #146b00; list-style-position: initial; list-style-image: initial; color: #5c5c5c; "><li style="padding: 0px 3px 0px 10px !important; margin: 0px !important; border: none; list-style: decimal-leading-zero outside; color: inherit; line-height: 1.3em; "><span style="padding: 0px; margin: 0px; border: none; color: black; background-color: inherit; "><span style="padding: 0px; margin: 0px; border: none; color: red; background-color: inherit; ">LANG</span><span style="padding: 0px; margin: 0px; border: none; background-color: inherit; ">=</span><span style="padding: 0px; margin: 0px; border: none; color: blue; background-color: inherit; ">"zh_CN.UTF-8"</span>&nbsp;</span></li></ol></pre><p style="padding: 0px; margin: 1em 0px 0.5em; text-indent: 2em; color: #333333; font-family: Verdana, Arial, Tahoma; line-height: 25px; background-color: #ffffff; ">&#9632; 设置系统locale语言为英文环境（永久生效）</p><pre style="padding: 0px; margin-top: 0px; font-family: 'Courier New', monospace; font-size: 12px; width: 712px; overflow: auto; background-color: #f7f7f7; color: #333333; line-height: 25px; "><div id="codeCtrl_4" style="padding-left: 10px; margin: 0px 0px 0px 3em !important; border-left-width: 3px; border-left-style: solid; border-left-color: #146b00; color: #999999; "><a id="view_4" href="" style="padding: 0px; margin: 0px; color: #999999; text-decoration: none; background-image: none; border: none; background-position: initial initial; background-repeat: initial initial; ">view plain</a>&nbsp;&nbsp;&nbsp;<span id="clipinner" style="padding: 0px; margin: 0px; position: relative; width: 100px; "><a href="http://www.sunchis.com/html/os/linux/2011/1115/373.html#" style="padding: 0px; margin: 0px; color: #999999; text-decoration: none; background-image: none; border: none; background-position: initial initial; background-repeat: initial initial; ">copy</a><embed width="100" height="20" type="application/x-shockwave-flash" wmode="transparent" swliveconnect="true" allowscriptaccess="sameDomain" menu="false" src="http://www.sunchis.com/public/clipboard.swf" devicefont="false" id="clipboardswf_4" name="clipboardswf_4" style="padding: 0px; margin: 0px; position: absolute; left: 0px; top: 0px; "></span></div><ol style="padding: 5px 0px; margin: 0px 0px 1px 3em !important; border-style: none none none solid; border-left-width: 3px; border-left-color: #146b00; list-style-position: initial; list-style-image: initial; color: #5c5c5c; "><li style="padding: 0px 3px 0px 10px !important; margin: 0px !important; border: none; list-style: decimal-leading-zero outside; color: inherit; line-height: 1.3em; "><span style="padding: 0px; margin: 0px; border: none; color: black; background-color: inherit; "><span style="padding: 0px; margin: 0px; border: none; color: red; background-color: inherit; ">LANG</span><span style="padding: 0px; margin: 0px; border: none; background-color: inherit; ">=</span><span style="padding: 0px; margin: 0px; border: none; color: blue; background-color: inherit; ">"en_US.UTF-8"</span>&nbsp;</span></li></ol></pre><p style="padding: 0px; margin: 1em 0px 0.5em; text-indent: 2em; color: #333333; font-family: Verdana, Arial, Tahoma; line-height: 25px; background-color: #ffffff; ">&#9632; 临时改变系统locale语言（退出本次登录立即失效）</p><pre style="padding: 0px; margin-top: 0px; font-family: 'Courier New', monospace; font-size: 12px; width: 712px; overflow: auto; background-color: #f7f7f7; color: #333333; line-height: 25px; "><div id="codeCtrl_5" style="padding-left: 10px; margin: 0px 0px 0px 3em !important; border-left-width: 3px; border-left-style: solid; border-left-color: #146b00; color: #999999; "><a id="view_5" href="" style="padding: 0px; margin: 0px; color: #999999; text-decoration: none; background-image: none; border: none; background-position: initial initial; background-repeat: initial initial; ">view plain</a>&nbsp;&nbsp;&nbsp;<span id="clipinner" style="padding: 0px; margin: 0px; position: relative; width: 100px; "><a href="http://www.sunchis.com/html/os/linux/2011/1115/373.html#" style="padding: 0px; margin: 0px; color: #999999; text-decoration: none; background-image: none; border: none; background-position: initial initial; background-repeat: initial initial; ">copy</a><embed width="100" height="20" type="application/x-shockwave-flash" wmode="transparent" swliveconnect="true" allowscriptaccess="sameDomain" menu="false" src="http://www.sunchis.com/public/clipboard.swf" devicefont="false" id="clipboardswf_5" name="clipboardswf_5" style="padding: 0px; margin: 0px; position: absolute; left: 0px; top: 0px; "></span></div><ol style="padding: 5px 0px; margin: 0px 0px 1px 3em !important; border-style: none none none solid; border-left-width: 3px; border-left-color: #146b00; list-style-position: initial; list-style-image: initial; color: #5c5c5c; "><li style="padding: 0px 3px 0px 10px !important; margin: 0px !important; border: none; list-style: decimal-leading-zero outside; color: inherit; line-height: 1.3em; "><span style="padding: 0px; margin: 0px; border: none; color: black; background-color: inherit; "><span style="padding: 0px; margin: 0px; border: none; background-color: inherit; ">#&nbsp;export&nbsp;</span><span style="padding: 0px; margin: 0px; border: none; color: red; background-color: inherit; ">LANG</span><span style="padding: 0px; margin: 0px; border: none; background-color: inherit; ">=</span><span style="padding: 0px; margin: 0px; border: none; color: blue; background-color: inherit; ">zh_CN</span><span style="padding: 0px; margin: 0px; border: none; background-color: inherit; ">.UTF-8&nbsp;</span></span></li></ol></pre><p style="padding: 0px; margin: 1em 0px 0.5em; text-indent: 2em; color: #333333; font-family: Verdana, Arial, Tahoma; line-height: 25px; background-color: #ffffff; ">&#9632; 安装中文字体</p><pre style="padding: 0px; margin-top: 0px; font-family: 'Courier New', monospace; font-size: 12px; width: 712px; overflow: auto; background-color: #f7f7f7; color: #333333; line-height: 25px; "><div id="codeCtrl_6" style="padding-left: 10px; margin: 0px 0px 0px 3em !important; border-left-width: 3px; border-left-style: solid; border-left-color: #146b00; color: #999999; "><a id="view_6" href="" style="padding: 0px; margin: 0px; color: #999999; text-decoration: none; background-image: none; border: none; background-position: initial initial; background-repeat: initial initial; ">view plain</a>&nbsp;&nbsp;&nbsp;<span id="clipinner" style="padding: 0px; margin: 0px; position: relative; width: 100px; "><a href="http://www.sunchis.com/html/os/linux/2011/1115/373.html#" style="padding: 0px; margin: 0px; color: #999999; text-decoration: none; background-image: none; border: none; background-position: initial initial; background-repeat: initial initial; ">copy</a><embed width="100" height="20" type="application/x-shockwave-flash" wmode="transparent" swliveconnect="true" allowscriptaccess="sameDomain" menu="false" src="http://www.sunchis.com/public/clipboard.swf" devicefont="false" id="clipboardswf_6" name="clipboardswf_6" style="padding: 0px; margin: 0px; position: absolute; left: 0px; top: 0px; "></span></div><ol style="padding: 5px 0px; margin: 0px 0px 1px 3em !important; border-style: none none none solid; border-left-width: 3px; border-left-color: #146b00; list-style-position: initial; list-style-image: initial; color: #5c5c5c; "><li style="padding: 0px 3px 0px 10px !important; margin: 0px !important; border: none; list-style: decimal-leading-zero outside; color: inherit; line-height: 1.3em; "><span style="padding: 0px; margin: 0px; border: none; color: black; background-color: inherit; ">#&nbsp;yum&nbsp;install&nbsp;fonts-chinese.noarch&nbsp;</span></li></ol></pre><p style="padding: 0px; margin: 1em 0px 0.5em; text-indent: 2em; color: #333333; font-family: Verdana, Arial, Tahoma; line-height: 25px; background-color: #ffffff; ">&#9632; 指定中文字体路径</p><p style="padding: 0px; margin: 1em 0px 0.5em; text-indent: 2em; color: #333333; font-family: Verdana, Arial, Tahoma; line-height: 25px; background-color: #ffffff; "># vi /etc/X11/fs/config</p><pre style="padding: 0px; margin-top: 0px; font-family: 'Courier New', monospace; font-size: 12px; width: 712px; overflow: auto; background-color: #f7f7f7; color: #333333; line-height: 25px; "><div id="codeCtrl_7" style="padding-left: 10px; margin: 0px 0px 0px 3em !important; border-left-width: 3px; border-left-style: solid; border-left-color: #146b00; color: #999999; "><a id="view_7" href="" style="padding: 0px; margin: 0px; color: #999999; text-decoration: none; background-image: none; border: none; background-position: initial initial; background-repeat: initial initial; ">view plain</a>&nbsp;&nbsp;&nbsp;<span id="clipinner" style="padding: 0px; margin: 0px; position: relative; width: 100px; "><a href="http://www.sunchis.com/html/os/linux/2011/1115/373.html#" style="padding: 0px; margin: 0px; color: #999999; text-decoration: none; background-image: none; border: none; background-position: initial initial; background-repeat: initial initial; ">copy</a><embed width="100" height="20" type="application/x-shockwave-flash" wmode="transparent" swliveconnect="true" allowscriptaccess="sameDomain" menu="false" src="http://www.sunchis.com/public/clipboard.swf" devicefont="false" id="clipboardswf_7" name="clipboardswf_7" style="padding: 0px; margin: 0px; position: absolute; left: 0px; top: 0px; "></span></div><ol style="padding: 5px 0px; margin: 0px 0px 1px 3em !important; border-style: none none none solid; border-left-width: 3px; border-left-color: #146b00; list-style-position: initial; list-style-image: initial; color: #5c5c5c; "><li style="padding: 0px 3px 0px 10px !important; margin: 0px !important; border: none; list-style: decimal-leading-zero outside; color: inherit; line-height: 1.3em; "><span style="padding: 0px; margin: 0px; border: none; color: black; background-color: inherit; "><span style="padding: 0px; margin: 0px; border: none; color: red; background-color: inherit; ">catalogue</span><span style="padding: 0px; margin: 0px; border: none; background-color: inherit; ">&nbsp;=&nbsp;/usr/X11R6/lib/X11/fonts/misc:unscaled,&nbsp;</span></span></li><li style="padding: 0px 3px 0px 10px !important; margin: 0px !important; border: none; list-style: decimal-leading-zero outside; line-height: 1.3em; "><span style="padding: 0px; margin: 0px; border: none; color: black; background-color: inherit; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/usr/X11R6/lib/X11/fonts/75dpi:unscaled,&nbsp;</span></li><li style="padding: 0px 3px 0px 10px !important; margin: 0px !important; border: none; list-style: decimal-leading-zero outside; color: inherit; line-height: 1.3em; "><span style="padding: 0px; margin: 0px; border: none; color: black; background-color: inherit; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/usr/X11R6/lib/X11/fonts/100dpi:unscaled,&nbsp;</span></li><li style="padding: 0px 3px 0px 10px !important; margin: 0px !important; border: none; list-style: decimal-leading-zero outside; line-height: 1.3em; "><span style="padding: 0px; margin: 0px; border: none; color: black; background-color: inherit; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/usr/X11R6/lib/X11/fonts/Type1,&nbsp;</span></li><li style="padding: 0px 3px 0px 10px !important; margin: 0px !important; border: none; list-style: decimal-leading-zero outside; color: inherit; line-height: 1.3em; "><span style="padding: 0px; margin: 0px; border: none; color: black; background-color: inherit; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/usr/share/fonts/default/Type1,&nbsp;</span></li><li style="padding: 0px 3px 0px 10px !important; margin: 0px !important; border: none; list-style: decimal-leading-zero outside; line-height: 1.3em; "><span style="padding: 0px; margin: 0px; border: none; color: black; background-color: inherit; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;,&nbsp;</span></li><li style="padding: 0px 3px 0px 10px !important; margin: 0px !important; border: none; list-style: decimal-leading-zero outside; color: inherit; line-height: 1.3em; "><span style="padding: 0px; margin: 0px; border: none; color: black; background-color: inherit; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/usr/share/fonts/zh_CN/TrueType,&nbsp;</span></li><li style="padding: 0px 3px 0px 10px !important; margin: 0px !important; border: none; list-style: decimal-leading-zero outside; line-height: 1.3em; "><span style="padding: 0px; margin: 0px; border: none; color: black; background-color: inherit; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/usr/share/fonts/zh_TW/TrueType&nbsp;<br /><br /><br /><br /><p style="background-color: #f3f3f3; border: 0px; margin: 0px 0px 20px; padding: 0px; vertical-align: baseline; color: #333333; font-family: Verdana, 'Trebuchet MS', Tahoma, Georgia, Helvetica; line-height: 21px; white-space: normal; ">方法2</p><p style="background-color: #f3f3f3; border: 0px; margin: 0px 0px 20px; padding: 0px; vertical-align: baseline; color: #333333; font-family: Verdana, 'Trebuchet MS', Tahoma, Georgia, Helvetica; line-height: 21px; white-space: normal; ">修改CentOS运行环境的默认语言环境变量值</p><p style="background-color: #f3f3f3; border: 0px; margin: 0px 0px 20px; padding: 0px; vertical-align: baseline; color: #333333; font-family: Verdana, 'Trebuchet MS', Tahoma, Georgia, Helvetica; line-height: 21px; white-space: normal; ">[root@www ~]# vi /etc/profile</p><p style="background-color: #f3f3f3; border: 0px; margin: 0px 0px 20px; padding: 0px; vertical-align: baseline; color: #333333; font-family: Verdana, 'Trebuchet MS', Tahoma, Georgia, Helvetica; line-height: 21px; white-space: normal; ">找到export语句，在语句前面加入</p><p style="background-color: #f3f3f3; border: 0px; margin: 0px 0px 20px; padding: 0px; vertical-align: baseline; color: #333333; font-family: Verdana, 'Trebuchet MS', Tahoma, Georgia, Helvetica; line-height: 21px; white-space: normal; ">LANG=&#8221;en_US.UTF-8&#8243;</p><p style="background-color: #f3f3f3; border: 0px; margin: 0px 0px 20px; padding: 0px; vertical-align: baseline; color: #333333; font-family: Verdana, 'Trebuchet MS', Tahoma, Georgia, Helvetica; line-height: 21px; white-space: normal; ">再在export后面追加LANG</p><p style="background-color: #f3f3f3; border: 0px; margin: 0px 0px 20px; padding: 0px; vertical-align: baseline; color: #333333; font-family: Verdana, 'Trebuchet MS', Tahoma, Georgia, Helvetica; line-height: 21px; white-space: normal; ">export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE INPUTRC LANG</p><p style="background-color: #f3f3f3; border: 0px; margin: 0px 0px 20px; padding: 0px; vertical-align: baseline; color: #333333; font-family: Verdana, 'Trebuchet MS', Tahoma, Georgia, Helvetica; line-height: 21px; white-space: normal; ">保存配置，修改CentOS语言完成。</p></span></li></ol></pre><img src ="http://www.blogjava.net/gembin/aggbug/393375.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/gembin/" target="_blank">gembin</a> 2012-12-23 22:08 <a href="http://www.blogjava.net/gembin/archive/2012/12/23/393375.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>MySQL on Mac OS X</title><link>http://www.blogjava.net/gembin/archive/2012/09/22/388351.html</link><dc:creator>gembin</dc:creator><author>gembin</author><pubDate>Sat, 22 Sep 2012 15:38:00 GMT</pubDate><guid>http://www.blogjava.net/gembin/archive/2012/09/22/388351.html</guid><wfw:comment>http://www.blogjava.net/gembin/comments/388351.html</wfw:comment><comments>http://www.blogjava.net/gembin/archive/2012/09/22/388351.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/gembin/comments/commentRss/388351.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/gembin/services/trackbacks/388351.html</trackback:ping><description><![CDATA[<p style="margin: 0px 0px 10px; padding: 0px; border: 0px; outline: 0px; vertical-align: baseline; background-color: #ffffff; line-height: 25px; font-family: Helvetica, Arial, sans-serif; max-width: 720px; ">If you have installed the Startup Item, use this command:</p><pre style="margin-top: 0px; margin-bottom: 0px; padding: 2px; border: 0px; outline: 0px; font-size: 13px; vertical-align: baseline; background-color: #eeeeee; font-family: 'Courier New', Courier, fixed, monospace; max-width: 720px; line-height: 20px; ">shell&gt; <strong style="margin: 0px; padding: 0px; border: 0px; outline: 0px; vertical-align: baseline; background-color: transparent; "><code style="margin: 0px; padding: 1px; border: 0px; outline: 0px; font-size: 12px; vertical-align: baseline; background-color: inherit; color: inherit; font-family: 'Courier New', Courier, fixed, monospace; ">sudo /Library/StartupItems/MySQLCOM/MySQLCOM start</code></strong> <br /><em style="margin: 0px; padding: 0px; border: 0px; outline: 0px; vertical-align: baseline; background-color: transparent; font-weight: bold; "><code style="margin: 0px; padding: 1px; border: 0px; outline: 0px; font-size: 12px; vertical-align: baseline; background-color: inherit; color: inherit; font-family: 'Courier New', Courier, fixed, monospace; ">(Enter your password, if necessary)</code></em> <br /><em style="margin: 0px; padding: 0px; border: 0px; outline: 0px; vertical-align: baseline; background-color: transparent; font-weight: bold; "><code style="margin: 0px; padding: 1px; border: 0px; outline: 0px; font-size: 12px; vertical-align: baseline; background-color: inherit; color: inherit; font-family: 'Courier New', Courier, fixed, monospace; ">(Press Control-D or enter "exit" to exit the shell)</code></em> </pre><p style="margin: 0px 0px 10px; padding: 0px; border: 0px; outline: 0px; vertical-align: baseline; background-color: #ffffff; line-height: 25px; font-family: Helvetica, Arial, sans-serif; max-width: 720px; ">If you do not use the Startup Item, enter the following command sequence:</p><pre style="margin-top: 0px; margin-bottom: 0px; padding: 2px; border: 0px; outline: 0px; font-size: 13px; vertical-align: baseline; background-color: #eeeeee; font-family: 'Courier New', Courier, fixed, monospace; max-width: 720px; line-height: 20px; ">shell&gt; <strong style="margin: 0px; padding: 0px; border: 0px; outline: 0px; vertical-align: baseline; background-color: transparent; "><code style="margin: 0px; padding: 1px; border: 0px; outline: 0px; font-size: 12px; vertical-align: baseline; background-color: inherit; color: inherit; font-family: 'Courier New', Courier, fixed, monospace; ">cd /usr/local/mysql</code></strong> <br />shell&gt; <strong style="margin: 0px; padding: 0px; border: 0px; outline: 0px; vertical-align: baseline; background-color: transparent; "><code style="margin: 0px; padding: 1px; border: 0px; outline: 0px; font-size: 12px; vertical-align: baseline; background-color: inherit; color: inherit; font-family: 'Courier New', Courier, fixed, monospace; ">sudo ./bin/mysqld_safe</code></strong> <br /><em style="margin: 0px; padding: 0px; border: 0px; outline: 0px; vertical-align: baseline; background-color: transparent; font-weight: bold; "><code style="margin: 0px; padding: 1px; border: 0px; outline: 0px; font-size: 12px; vertical-align: baseline; background-color: inherit; color: inherit; font-family: 'Courier New', Courier, fixed, monospace; ">(Enter your password, if necessary)</code></em> <br /><em style="margin: 0px; padding: 0px; border: 0px; outline: 0px; vertical-align: baseline; background-color: transparent; font-weight: bold; "><code style="margin: 0px; padding: 1px; border: 0px; outline: 0px; font-size: 12px; vertical-align: baseline; background-color: inherit; color: inherit; font-family: 'Courier New', Courier, fixed, monospace; ">(Press Control-Z)</code></em> <br />shell&gt; <strong style="margin: 0px; padding: 0px; border: 0px; outline: 0px; vertical-align: baseline; background-color: transparent; "><code style="margin: 0px; padding: 1px; border: 0px; outline: 0px; font-size: 12px; vertical-align: baseline; background-color: inherit; color: inherit; font-family: 'Courier New', Courier, fixed, monospace; ">bg</code></strong> <em style="margin: 0px; padding: 0px; border: 0px; outline: 0px; vertical-align: baseline; background-color: transparent; font-weight: bold; "><code style="margin: 0px; padding: 1px; border: 0px; outline: 0px; font-size: 12px; vertical-align: baseline; background-color: inherit; color: inherit; font-family: 'Courier New', Courier, fixed, monospace; "><br />(Press Control-D or enter "exit" to exit the shell)<br /><br /><span style="font-family: Helvetica, Arial, sans-serif; font-size: 14px; font-style: normal; font-weight: normal; line-height: 25px; white-space: normal; background-color: #ffffff; ">You should be able to connect to the MySQL server, for example, by running&nbsp;</span><code style="margin: 0px; padding: 0px; border: 0px; outline: 0px; font-size: 13px; vertical-align: baseline; background-color: white; color: #990000; font-weight: normal; font-family: 'Courier New', Courier, fixed, monospace; font-style: normal; line-height: 25px; white-space: normal; ">/usr/local/mysql/bin/mysql</code><span style="font-family: Helvetica, Arial, sans-serif; font-size: 14px; font-style: normal; font-weight: normal; line-height: 25px; white-space: normal; background-color: #ffffff; ">.<br /></span><pre class="programlisting" style="margin-top: 0px; margin-bottom: 0px; padding: 2px; border: 0px; outline: 0px; font-size: 13px; vertical-align: baseline; font-family: 'Courier New', Courier, fixed, monospace; max-width: 720px; font-style: normal; font-weight: normal; ">alias mysql=/usr/local/mysql/bin/mysql
alias mysqladmin=/usr/local/mysql/bin/mysqladmin<br /><br /><br /><span style="font-family: arial, sans-serif; line-height: 16.399999618530273px; white-space: normal; background-color: #ffffff; ">Sequel Pro is a database management app for MySQL databases</span><br /><div>http://www.sequelpro.com/<br /><img src="http://www.sequelpro.com/assets/images/NewTabs.jpg" width="980" height="650" alt="" /></div></pre></code></em></pre><img src ="http://www.blogjava.net/gembin/aggbug/388351.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/gembin/" target="_blank">gembin</a> 2012-09-22 23:38 <a href="http://www.blogjava.net/gembin/archive/2012/09/22/388351.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>ethtool and mii-tool</title><link>http://www.blogjava.net/gembin/archive/2012/09/07/387249.html</link><dc:creator>gembin</dc:creator><author>gembin</author><pubDate>Fri, 07 Sep 2012 06:41:00 GMT</pubDate><guid>http://www.blogjava.net/gembin/archive/2012/09/07/387249.html</guid><wfw:comment>http://www.blogjava.net/gembin/comments/387249.html</wfw:comment><comments>http://www.blogjava.net/gembin/archive/2012/09/07/387249.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/gembin/comments/commentRss/387249.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/gembin/services/trackbacks/387249.html</trackback:ping><description><![CDATA[<h1><span style="font-family: arial, 宋体, sans-serif; font-size: 14px; font-weight: normal; line-height: 24px; background-color: #ffffff; ">mii-tool（这是Linux下专门设置网卡工作模式的命令）</span><div style="height: 14px; line-height: 14px; font-size: 12px; overflow: hidden; font-family: arial, 宋体, sans-serif; font-weight: normal; background-color: #ffffff; "></div><span style="font-family: arial, 宋体, sans-serif; font-size: 14px; font-weight: normal; line-height: 24px; background-color: #ffffff; ">　　1. 查看网卡的工作模式，输入命令：</span><div style="height: 14px; line-height: 14px; font-size: 12px; overflow: hidden; font-family: arial, 宋体, sans-serif; font-weight: normal; background-color: #ffffff; "></div><span style="font-family: arial, 宋体, sans-serif; font-size: 14px; font-weight: normal; line-height: 24px; background-color: #ffffff; ">　　#mii-tool -v</span><div style="height: 14px; line-height: 14px; font-size: 12px; overflow: hidden; font-family: arial, 宋体, sans-serif; font-weight: normal; background-color: #ffffff; "></div><span style="font-family: arial, 宋体, sans-serif; font-size: 14px; font-weight: normal; line-height: 24px; background-color: #ffffff; ">　　eth0: negotiated 100baseTx-FD, link ok</span><div style="height: 14px; line-height: 14px; font-size: 12px; overflow: hidden; font-family: arial, 宋体, sans-serif; font-weight: normal; background-color: #ffffff; "></div><span style="font-family: arial, 宋体, sans-serif; font-size: 14px; font-weight: normal; line-height: 24px; background-color: #ffffff; ">　　product info: vendor 00:aa:00, model 56 rev 0</span><div style="height: 14px; line-height: 14px; font-size: 12px; overflow: hidden; font-family: arial, 宋体, sans-serif; font-weight: normal; background-color: #ffffff; "></div><span style="font-family: arial, 宋体, sans-serif; font-size: 14px; font-weight: normal; line-height: 24px; background-color: #ffffff; ">　　basic mode: autonegotiation enabled</span><div style="height: 14px; line-height: 14px; font-size: 12px; overflow: hidden; font-family: arial, 宋体, sans-serif; font-weight: normal; background-color: #ffffff; "></div><span style="font-family: arial, 宋体, sans-serif; font-size: 14px; font-weight: normal; line-height: 24px; background-color: #ffffff; ">　　basic status: autonegotiation complete, link ok</span><div style="height: 14px; line-height: 14px; font-size: 12px; overflow: hidden; font-family: arial, 宋体, sans-serif; font-weight: normal; background-color: #ffffff; "></div><span style="font-family: arial, 宋体, sans-serif; font-size: 14px; font-weight: normal; line-height: 24px; background-color: #ffffff; ">　　capabilities: 100baseTx-FD 100baseTx-HD 10baseT-FD 10baseT-HD</span><div style="height: 14px; line-height: 14px; font-size: 12px; overflow: hidden; font-family: arial, 宋体, sans-serif; font-weight: normal; background-color: #ffffff; "></div><span style="font-family: arial, 宋体, sans-serif; font-size: 14px; font-weight: normal; line-height: 24px; background-color: #ffffff; ">　　advertising: 100baseTx-FD 100baseTx-HD 10baseT-FD 10baseT-HD flow-control</span><div style="height: 14px; line-height: 14px; font-size: 12px; overflow: hidden; font-family: arial, 宋体, sans-serif; font-weight: normal; background-color: #ffffff; "></div><span style="font-family: arial, 宋体, sans-serif; font-size: 14px; font-weight: normal; line-height: 24px; background-color: #ffffff; ">　　link partner: 100baseTx-FD 100baseTx-HD 10baseT-FD 10baseT-HD</span><div style="height: 14px; line-height: 14px; font-size: 12px; overflow: hidden; font-family: arial, 宋体, sans-serif; font-weight: normal; background-color: #ffffff; "></div><span style="font-family: arial, 宋体, sans-serif; font-size: 14px; font-weight: normal; line-height: 24px; background-color: #ffffff; ">　　从以上信息中可以看出，这块网卡工作在100M全双工自适应模式下，&#8220;100BaseTx-FD&#8221;意为100M Full Duplex。</span><div style="height: 14px; line-height: 14px; font-size: 12px; overflow: hidden; font-family: arial, 宋体, sans-serif; font-weight: normal; background-color: #ffffff; "></div><span style="font-family: arial, 宋体, sans-serif; font-size: 14px; font-weight: normal; line-height: 24px; background-color: #ffffff; ">　　2. 更改网卡的工作模式，输入命令：</span><div style="height: 14px; line-height: 14px; font-size: 12px; overflow: hidden; font-family: arial, 宋体, sans-serif; font-weight: normal; background-color: #ffffff; "></div><span style="font-family: arial, 宋体, sans-serif; font-size: 14px; font-weight: normal; line-height: 24px; background-color: #ffffff; ">　　#mii-tool -F media [interface]</span><div style="height: 14px; line-height: 14px; font-size: 12px; overflow: hidden; font-family: arial, 宋体, sans-serif; font-weight: normal; background-color: #ffffff; "></div><span style="font-family: arial, 宋体, sans-serif; font-size: 14px; font-weight: normal; line-height: 24px; background-color: #ffffff; ">　　media可选的模式有100baseTx-FD、100baseTx-HD、10baseT-FD、10baseT-HD等。 Interface代表所选择的网卡，如eth0、eth1等，默认为eth0。</span><div style="height: 14px; line-height: 14px; font-size: 12px; overflow: hidden; font-family: arial, 宋体, sans-serif; font-weight: normal; background-color: #ffffff; "></div><span style="font-family: arial, 宋体, sans-serif; font-size: 14px; font-weight: normal; line-height: 24px; background-color: #ffffff; ">　　例如，设置网卡工作在10M半双工模式下，输入命令：</span><div style="height: 14px; line-height: 14px; font-size: 12px; overflow: hidden; font-family: arial, 宋体, sans-serif; font-weight: normal; background-color: #ffffff; "></div><span style="font-family: arial, 宋体, sans-serif; font-size: 14px; font-weight: normal; line-height: 24px; background-color: #ffffff; ">　　#mii-tool -F 10baseT-HD eth0</span><div style="height: 14px; line-height: 14px; font-size: 12px; overflow: hidden; font-family: arial, 宋体, sans-serif; font-weight: normal; background-color: #ffffff; "></div><span style="font-family: arial, 宋体, sans-serif; font-size: 14px; font-weight: normal; line-height: 24px; background-color: #ffffff; ">　　3. 恢复网卡的自适应工作模式，输入命令：</span><div style="height: 14px; line-height: 14px; font-size: 12px; overflow: hidden; font-family: arial, 宋体, sans-serif; font-weight: normal; background-color: #ffffff; "></div><span style="font-family: arial, 宋体, sans-serif; font-size: 14px; font-weight: normal; line-height: 24px; background-color: #ffffff; ">　　#mii-tool -r eth0</span><div style="height: 14px; line-height: 14px; font-size: 12px; overflow: hidden; font-family: arial, 宋体, sans-serif; font-weight: normal; background-color: #ffffff; "></div><span style="font-family: arial, 宋体, sans-serif; font-size: 14px; font-weight: normal; line-height: 24px; background-color: #ffffff; ">　　更详细的使用方法可以用mii-tool -h来获得。<br /><br /><br /><br /></span><h2 class="contentheading" style="margin: 0px 0px 7px; font-size: 18px; line-height: 1.5em; color: #a30327; padding: 0px 0px 3px; font-family: 'Trebuchet MS', sans-serif; background-image: url(http://lynty.com/templates/ymovies/images/h3.gif); background-color: #ffffff; background-position: 0% 100%; background-repeat: repeat no-repeat; ">ethtool/mii-tool</h2><div class="newsitem_tools" style="width: 970px; margin: 0px 0px 15px !important; color: #555555; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11px; font-weight: normal; line-height: 18px; background-color: #ffffff; "><div class="newsitem_info" style="width: 679px; height: 10px; float: left; "></div><div class="buttonheading" style="width: 291px; overflow: hidden; float: right; "><span class="print" style="float: right; margin: 0px 2px 0px 0px; width: 16px; "><a href="http://www.lynty.com/index.php/ethtoolmii-tool?tmpl=component&amp;print=1&amp;page=" title="Print" rel="nofollow" style="cursor: pointer; text-decoration: none; color: #a30327; "><img src="http://www.lynty.com/templates/ymovies/images/printButton.png" alt="Print" style="border: 0px; padding: 0px; " /></a></span><span class="pdf" style="float: right; margin: 0px 2px 0px 0px; width: 16px; "><a href="http://www.lynty.com/index.php/ethtoolmii-tool?format=pdf" title="PDF" rel="nofollow" style="cursor: pointer; text-decoration: none; color: #a30327; "><img src="http://www.lynty.com/templates/ymovies/images/pdf_button.png" alt="PDF" style="border: 0px; padding: 0px; " /></a></span></div></div><div class="newsitem_text" style="width: 970px; padding-top: 10px !important; color: #555555; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11px; font-weight: normal; line-height: 18px; background-color: #ffffff; "><div class="news_item_article"><p style="margin: 0.5em 0px; "><strong>Linux LAN card: Find out full duplex / half speed or mode</strong><br /><br />Q. How do I find out if my Lan (NIC) card working at full or halt duplex mode / speed under Linux?<br /><br />A. LAN card or NIC is use to send and receive data. Technically, we use word Duplex for this functionality. Full duplex means you are able to send and receive data (files) simultaneously. In half duplex, you can either send or receive data at a time (i.e. you cannot send receive data (files) simultaneously). Obviously, full duplex gives you best user experience. However, how can I find out whether I am using full duplex/half duplex speed/mode?<br /><strong>Task: Find full or half duplex speed</strong><br /><br />You can use dmesg command to find out your duplex mode:</p><pre style="padding: 10px 15px !important; margin-top: 5px !important; margin-bottom: 15px !important; white-space: normal !important; width: auto !important; border-width: 1px 1px 1px 5px !important; border-style: solid !important; border-color: #e7e7e7 !important; background-color: #f6f6f6 !important; "># dmesg | grep -i duplex</pre><p style="margin: 0.5em 0px; ">Output:<br /><br />eth0: link up, 100Mbps, full-duplex, lpa 0x45E1<br /><br /><strong>ethtool command<br /></strong><br />Uss ethtool to display or change ethernet card settings. To display duplex speed, enter:</p><pre style="padding: 10px 15px !important; margin-top: 5px !important; margin-bottom: 15px !important; white-space: normal !important; width: auto !important; border-width: 1px 1px 1px 5px !important; border-style: solid !important; border-color: #e7e7e7 !important; background-color: #f6f6f6 !important; "># ethtool eth1</pre><p style="margin: 0.5em 0px; ">Output:<br /><br />Settings for eth1:<br />Supported ports: [ TP ]<br />Supported link modes:&nbsp;&nbsp; 10baseT/Half 10baseT/Full<br />100baseT/Half 100baseT/Full<br />1000baseT/Full<br />Supports auto-negotiation: Yes<br />Advertised link modes:&nbsp; 10baseT/Half 10baseT/Full<br />100baseT/Half 100baseT/Full<br />1000baseT/Full<br />Advertised auto-negotiation: Yes<br />Speed: 10Mb/s<br />Duplex: Full<br />Port: Twisted Pair<br />PHYAD: 0<br />Transceiver: internal<br />Auto-negotiation: on<br />Supports Wake-on: umbg<br />Wake-on: g<br />Current message level: 0x00000007 (7)<br />Link detected: yes<br /><br /><strong>mii-tool command</strong><br /><br />You can also use mii-tool to find out your duplex mode. Type following command at shell prompt:</p><pre style="padding: 10px 15px !important; margin-top: 5px !important; margin-bottom: 15px !important; white-space: normal !important; width: auto !important; border-width: 1px 1px 1px 5px !important; border-style: solid !important; border-color: #e7e7e7 !important; background-color: #f6f6f6 !important; "># mii-tool</pre><p style="margin: 0.5em 0px; "><br />Output:<br /><br />eth0: negotiated 100baseTx-FD flow-control, link ok<br /><strong><br />Remember,</strong><br /><br />1. 100baseTx-FD: 100Mbps full duplex (FD)<br />2. 100baseTx-HD: 100Mbps half duplex (HD)<br />3. 10baseT-FD: 10Mbps full duplex (FD)<br />4. 10baseT-HD: 10Mbps half duplex (HD)<br /><br />mii-tool utility checks or sets the status of a network interface Media Independent Interface (MII) unit. Most fast ethernet adapters use an MII to autonegotiate link speed and duplex setting. If you are using old card then this utility may not work (use dmesg command).<br /><br />This utility is useful for forcing specific Ethernet speed and duplex settings too, setup 100Mbps full duplex speed under Linux:</p><pre style="padding: 10px 15px !important; margin-top: 5px !important; margin-bottom: 15px !important; white-space: normal !important; width: auto !important; border-width: 1px 1px 1px 5px !important; border-style: solid !important; border-color: #e7e7e7 !important; background-color: #f6f6f6 !important; "># mii-tool -F 100baseTx-FD</pre><p style="margin: 0.5em 0px; "><br />Setup 10Mbps half duplex:</p><pre style="padding: 10px 15px !important; margin-top: 5px !important; margin-bottom: 15px !important; white-space: normal !important; width: auto !important; border-width: 1px 1px 1px 5px !important; border-style: solid !important; border-color: #e7e7e7 !important; background-color: #f6f6f6 !important; "># mii-tool -F 10baseT-HD</pre><p style="margin: 0.5em 0px; "><br />source:</p><p style="margin: 0.5em 0px; ">http://www.cyberciti.biz/faq/howto-setup-linux-lan-card-find-out-full-duplex-half-speed-or-mode/</p></div></div> </h1><img src ="http://www.blogjava.net/gembin/aggbug/387249.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/gembin/" target="_blank">gembin</a> 2012-09-07 14:41 <a href="http://www.blogjava.net/gembin/archive/2012/09/07/387249.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>XML Naming Conventions</title><link>http://www.blogjava.net/gembin/archive/2012/08/25/386269.html</link><dc:creator>gembin</dc:creator><author>gembin</author><pubDate>Sat, 25 Aug 2012 08:43:00 GMT</pubDate><guid>http://www.blogjava.net/gembin/archive/2012/08/25/386269.html</guid><wfw:comment>http://www.blogjava.net/gembin/comments/386269.html</wfw:comment><comments>http://www.blogjava.net/gembin/archive/2012/08/25/386269.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/gembin/comments/commentRss/386269.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/gembin/services/trackbacks/386269.html</trackback:ping><description><![CDATA[Names&nbsp;can&nbsp;start&nbsp;with&nbsp;letters&nbsp;including&nbsp;non-Latin&nbsp;characters.<br style="font-family: monospace; font-size: medium; line-height: normal; white-space: nowrap; background-color: #ffffff; " />Names&nbsp;can&nbsp;start&nbsp;with&nbsp;dash&nbsp;(-)&nbsp;character.<br style="font-family: monospace; font-size: medium; line-height: normal; white-space: nowrap; background-color: #ffffff; " />Names&nbsp;cannot&nbsp;start&nbsp;with&nbsp;numbers&nbsp;or&nbsp;other&nbsp;punctuation&nbsp;characters.&nbsp;<br style="font-family: monospace; font-size: medium; line-height: normal; white-space: nowrap; background-color: #ffffff; " />After&nbsp;the&nbsp;first&nbsp;character,&nbsp;numbers,&nbsp;hyphens,&nbsp;and&nbsp;periods&nbsp;are&nbsp;allowed.&nbsp;<br style="font-family: monospace; font-size: medium; line-height: normal; white-space: nowrap; background-color: #ffffff; " />Names&nbsp;can't&nbsp;contain&nbsp;spaces.&nbsp;<br style="font-family: monospace; font-size: medium; line-height: normal; white-space: nowrap; background-color: #ffffff; " />Names&nbsp;can't&nbsp;contain&nbsp;the&nbsp;colon&nbsp;(:)&nbsp;character.&nbsp;<br style="font-family: monospace; font-size: medium; line-height: normal; white-space: nowrap; background-color: #ffffff; " />Names&nbsp;can't&nbsp;start&nbsp;with&nbsp;the&nbsp;letters&nbsp;xml,&nbsp;in&nbsp;uppercase,&nbsp;lowercase,&nbsp;or&nbsp;mixed.<br style="font-family: monospace; font-size: medium; line-height: normal; white-space: nowrap; background-color: #ffffff; " />There&nbsp;can't&nbsp;be&nbsp;a&nbsp;space&nbsp;after&nbsp;the&nbsp;opening&nbsp;&lt;<br style="font-family: monospace; font-size: medium; line-height: normal; white-space: nowrap; background-color: #ffffff; " />There&nbsp;can&nbsp;be&nbsp;space&nbsp;before&nbsp;the&nbsp;closing&nbsp;&gt;&nbsp;character.&nbsp;<br style="font-family: monospace; font-size: medium; line-height: normal; white-space: nowrap; background-color: #ffffff; " /><br style="font-family: monospace; font-size: medium; line-height: normal; white-space: nowrap; background-color: #ffffff; " />Here&nbsp;are&nbsp;some&nbsp;examples&nbsp;of&nbsp;valid&nbsp;names:&nbsp;&lt;first.name&gt;&nbsp;<br style="font-family: monospace; font-size: medium; line-height: normal; white-space: nowrap; background-color: #ffffff; " /><br style="font-family: monospace; font-size: medium; line-height: normal; white-space: nowrap; background-color: #ffffff; " />Following&nbsp;are&nbsp;some&nbsp;examples&nbsp;of&nbsp;invalid&nbsp;names:&nbsp;<br style="font-family: monospace; font-size: medium; line-height: normal; white-space: nowrap; background-color: #ffffff; " /><br style="font-family: monospace; font-size: medium; line-height: normal; white-space: nowrap; background-color: #ffffff; " />&lt;xml-element&gt;&nbsp;which&nbsp;starts&nbsp;with&nbsp;xml,&nbsp;<br style="font-family: monospace; font-size: medium; line-height: normal; white-space: nowrap; background-color: #ffffff; " /><br style="font-family: monospace; font-size: medium; line-height: normal; white-space: nowrap; background-color: #ffffff; " />&lt;123&gt;&nbsp;which&nbsp;starts&nbsp;with&nbsp;a&nbsp;number,&nbsp;<br style="font-family: monospace; font-size: medium; line-height: normal; white-space: nowrap; background-color: #ffffff; " /><br style="font-family: monospace; font-size: medium; line-height: normal; white-space: nowrap; background-color: #ffffff; " />&lt;your=xml&gt;&nbsp;because&nbsp;the&nbsp;equals&nbsp;sign&nbsp;(=)sign&nbsp;is&nbsp;illegal,&nbsp;and&nbsp;<br style="font-family: monospace; font-size: medium; line-height: normal; white-space: nowrap; background-color: #ffffff; " /><br style="font-family: monospace; font-size: medium; line-height: normal; white-space: nowrap; background-color: #ffffff; " />&lt;your&nbsp;element&gt;&nbsp;which&nbsp;contains&nbsp;a&nbsp;space.<br /><font color="#000000" style="font-family: monospace; font-size: medium; line-height: normal; white-space: nowrap; background-color: #ffffff; "><br /><br /></font><table width="800" border="0" style="font-family: Arial; "><tbody><tr><td class="codeTitle" style="font-size: 24px; border-bottom-color: #cccccc; border-bottom-style: solid; ">Case Sensitivity</td></tr><tr><td><table border="0"><tbody><tr><td height="20"></td></tr></tbody></table><span style="font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; font-size: 14px; line-height: 18px; background-color: #ffffff; ">Most XML standards originating from the W3C tend to use lower case with hyphens.</span></td></tr><tr><td><table border="0" cellpadding="3" cellspacing="0" bgcolor="#ffffff"><tbody><tr><td nowrap="nowrap" valign="top" align="left"><div class="codeShade" style="padding: 4px; margin-left: 0em; border: 1px solid #cccccc; margin-top: 0.5em; margin-bottom: 0.5em; "><code><font color="#000000">&lt;first&gt;&nbsp;is&nbsp;different&nbsp;</font><font color="#7f0055"><strong>from&nbsp;</strong></font><font color="#000000">&lt;FIRST&gt;,&nbsp;which&nbsp;is&nbsp;different&nbsp;</font><font color="#7f0055"><strong>from&nbsp;</strong></font><font color="#000000">&lt;First&gt;.&nbsp;</font><br /><font color="#ffffff"></font><br /><font color="#000000">It</font><font color="#ff6100">'s&nbsp;</font><font color="#000000">a&nbsp;good&nbsp;idea&nbsp;to&nbsp;pick&nbsp;a&nbsp;naming&nbsp;style&nbsp;and&nbsp;stick&nbsp;to&nbsp;it.&nbsp;</font><br /><font color="#000000">Some&nbsp;examples&nbsp;of&nbsp;common&nbsp;styles&nbsp;are&nbsp;as&nbsp;follows:&nbsp;</font><br /><font color="#ffffff"></font><br /><font color="#000000">&lt;first_name&gt;&nbsp;</font><br /><font color="#000000">&lt;firstName&gt;&nbsp;</font><br /><font color="#000000">&lt;first-name&gt;&nbsp;</font><br /><font color="#000000">&lt;FirstName&gt;</font></code></div></td></tr></tbody></table></td></tr></tbody></table><font color="#000000" style="font-family: monospace; font-size: medium; line-height: normal; white-space: nowrap; background-color: #ffffff; "><br /></font><img src ="http://www.blogjava.net/gembin/aggbug/386269.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/gembin/" target="_blank">gembin</a> 2012-08-25 16:43 <a href="http://www.blogjava.net/gembin/archive/2012/08/25/386269.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>ANSI sequence parser (Node.js) and client-side renderer</title><link>http://www.blogjava.net/gembin/archive/2012/07/21/383681.html</link><dc:creator>gembin</dc:creator><author>gembin</author><pubDate>Sat, 21 Jul 2012 15:16:00 GMT</pubDate><guid>http://www.blogjava.net/gembin/archive/2012/07/21/383681.html</guid><wfw:comment>http://www.blogjava.net/gembin/comments/383681.html</wfw:comment><comments>http://www.blogjava.net/gembin/archive/2012/07/21/383681.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/gembin/comments/commentRss/383681.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/gembin/services/trackbacks/383681.html</trackback:ping><description><![CDATA[<script src="https://gist.github.com/3156086.js"> </script><img src ="http://www.blogjava.net/gembin/aggbug/383681.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/gembin/" target="_blank">gembin</a> 2012-07-21 23:16 <a href="http://www.blogjava.net/gembin/archive/2012/07/21/383681.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Flash 3d Sokoban Prototype With Alternativa3d</title><link>http://www.blogjava.net/gembin/archive/2012/07/21/383679.html</link><dc:creator>gembin</dc:creator><author>gembin</author><pubDate>Sat, 21 Jul 2012 15:03:00 GMT</pubDate><guid>http://www.blogjava.net/gembin/archive/2012/07/21/383679.html</guid><wfw:comment>http://www.blogjava.net/gembin/comments/383679.html</wfw:comment><comments>http://www.blogjava.net/gembin/archive/2012/07/21/383679.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/gembin/comments/commentRss/383679.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/gembin/services/trackbacks/383679.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: Emanuele Feronato&nbsp;italian geek and PROgrammer prepared two great blog posts with Sokoban game prototype. As all of his examples Sokoban prototypes have good code and can be clearly understood.Her...&nbsp;&nbsp;<a href='http://www.blogjava.net/gembin/archive/2012/07/21/383679.html'>阅读全文</a><img src ="http://www.blogjava.net/gembin/aggbug/383679.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/gembin/" target="_blank">gembin</a> 2012-07-21 23:03 <a href="http://www.blogjava.net/gembin/archive/2012/07/21/383679.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Flash 3d Sokoban Prototype With Alternativa3d Textured Version</title><link>http://www.blogjava.net/gembin/archive/2012/07/21/383678.html</link><dc:creator>gembin</dc:creator><author>gembin</author><pubDate>Sat, 21 Jul 2012 15:00:00 GMT</pubDate><guid>http://www.blogjava.net/gembin/archive/2012/07/21/383678.html</guid><wfw:comment>http://www.blogjava.net/gembin/comments/383678.html</wfw:comment><comments>http://www.blogjava.net/gembin/archive/2012/07/21/383678.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/gembin/comments/commentRss/383678.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/gembin/services/trackbacks/383678.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: Emanuele Feronato added textures and some environment to&nbsp;Sokoban game prototype made with Flare3D.I reproduced this prototype on Alternativa3D engine. And here you can find it:Generally this port...&nbsp;&nbsp;<a href='http://www.blogjava.net/gembin/archive/2012/07/21/383678.html'>阅读全文</a><img src ="http://www.blogjava.net/gembin/aggbug/383678.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/gembin/" target="_blank">gembin</a> 2012-07-21 23:00 <a href="http://www.blogjava.net/gembin/archive/2012/07/21/383678.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Flash 3d Sokoban Prototype With Alternativa3d Textured Version</title><link>http://www.blogjava.net/gembin/archive/2012/07/21/383677.html</link><dc:creator>gembin</dc:creator><author>gembin</author><pubDate>Sat, 21 Jul 2012 14:58:00 GMT</pubDate><guid>http://www.blogjava.net/gembin/archive/2012/07/21/383677.html</guid><wfw:comment>http://www.blogjava.net/gembin/comments/383677.html</wfw:comment><comments>http://www.blogjava.net/gembin/archive/2012/07/21/383677.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/gembin/comments/commentRss/383677.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/gembin/services/trackbacks/383677.html</trackback:ping><description><![CDATA[<p style="margin: 0px 0px 10px; padding: 0px; border: 0px; outline: 0px; font-size: 12px; font-family: Arial, sans-serif; vertical-align: baseline; line-height: 28px; color: #555555; ">Emanuele Feronato added textures and some environment to&nbsp;<a href="http://www.emanueleferonato.com/2011/02/25/flash-3d-sokoban-prototype-with-flare3d-final-version/" style="margin: 0px; padding: 0px; border: 0px; outline: 0px; font-weight: bold; font-style: inherit; font-family: inherit; vertical-align: baseline; color: #059bff; text-decoration: none; ">Sokoban game prototype made with Flare3D</a>.</p><p style="margin: 0px 0px 10px; padding: 0px; border: 0px; outline: 0px; font-size: 12px; font-family: Arial, sans-serif; vertical-align: baseline; line-height: 28px; color: #555555; ">I reproduced this prototype on Alternativa3D engine. And here you can find it:<br style="margin: 0px; padding: 0px; " /></p><object type="application/x-shockwave-flash" data="http://inspiritgames.com/blog/wp-content/uploads/Alternativa3dSokobanTextured.swf" width="640" height="480" id="swf58db1" style="margin: 0px; padding: 0px; border: 0px; outline: 0px; font-size: 12px; font-family: Arial, sans-serif; vertical-align: baseline; visibility: visible; color: #444444; line-height: normal; "></object><p style="margin: 0px 0px 10px; padding: 0px; border: 0px; outline: 0px; font-size: 12px; font-family: Arial, sans-serif; vertical-align: baseline; line-height: 28px; color: #555555; "></p><p style="margin: 0px 0px 10px; padding: 0px; border: 0px; outline: 0px; font-size: 12px; font-family: Arial, sans-serif; vertical-align: baseline; line-height: 28px; color: #555555; ">Generally this port is bit different from Emanuele&#8217;s version. I can&#8217;t find information about feature like SkyBox in Alternativa3D, so this feature coded manually. Another difference is camera behavior. Emanuele binds camera to object and during rotations player object stand still and only camera fly around by its orbit. In Alternativa3d version object rotates too, this allow us to face player object it to it&#8217;s current direction. Camera is not binded to the object directly it is binded to object container and we can manipulate with player object in container, add animations, rotations etc. But both variants are good I think.</p><p style="margin: 0px 0px 10px; padding: 0px; border: 0px; outline: 0px; font-size: 12px; font-family: Arial, sans-serif; vertical-align: baseline; line-height: 28px; color: #555555; "><br style="margin: 0px; padding: 0px; " />Here is source code:</p><pre as3;="" auto-links:=""  false;"="" style="margin-top: 0px; margin-bottom: 0px; padding: 0px; border: 0px; outline: 0px; font-size: 15px; font-family: inherit; vertical-align: baseline; color: #444444; line-height: normal; ">package  { 	import alternativa.Alternativa3D; 	import alternativa.engine3d.containers.*; 	import alternativa.engine3d.controllers.*; 	import alternativa.engine3d.core.Camera3D; 	import alternativa.engine3d.core.Clipping; 	import alternativa.engine3d.core.Debug; 	import alternativa.engine3d.core.MipMapping; 	import alternativa.engine3d.core.MouseEvent3D; 	import alternativa.engine3d.core.Object3D; 	import alternativa.engine3d.core.Object3DContainer; 	import alternativa.engine3d.core.Sorting; 	import alternativa.engine3d.core.View; 	import alternativa.engine3d.materials.FillMaterial; 	import alternativa.engine3d.materials.TextureMaterial; 	import alternativa.engine3d.objects.Sprite3D; 	import alternativa.engine3d.primitives.Box; 	import alternativa.engine3d.primitives.Plane; 	import alternativa.engine3d.primitives.Sphere; 	 	import flash.display.BitmapData; 	import flash.display.BlendMode; 	import flash.display.Sprite; 	import flash.display.StageAlign; 	import flash.display.StageQuality; 	import flash.display.StageScaleMode; 	import flash.events.Event; 	import flash.events.KeyboardEvent; 	import flash.filters.GlowFilter; 	import flash.geom.ColorTransform; 	import flash.geom.Vector3D; 	import flash.sampler.NewObjectSample; 	import flash.system.Capabilities; 	import flash.ui.Keyboard; 		 	[SWF(backgroundColor="#000000", frameRate="100", width="640", height="480")] 	public class alternativa3dSokoban extends Sprite  	{ 		private const CUBESIZE:Number=10; 		//embeding textures images 		[Embed(source="resource/crateTextureImg.jpg")] static private const crateTextureImg:Class; 		[Embed(source="resource/floorTextureImg.png")] static private const floorTextureImg:Class; 		[Embed(source="resource/crateTopTextureImg.jpg")] static private const crateTopTextureImg:Class; 		[Embed(source="resource/crateTopGoalTextureImg.jpg")] static private const crateTopGoalTextureImg:Class; 		[Embed(source="resource/wallTextureImg.png")] static private const wallTextureImg:Class; 		[Embed(source="resource/goalTextureImg.jpg")] static private const goalTextureImg:Class; 		[Embed(source="resource/playerTextureImg.jpg")] static private const playerTextureImg:Class; 		[Embed(source="resource/backBitmapImg.jpg")] static private const backTextureImg:Class; 		[Embed(source="resource/backBottomBitmapImg.jpg")] static private const backBottomTextureImg:Class;  		// sokobal demo level and player position 		private var levels:Array=[[1,1,1,1,0,0,0,0],[1,0,0,1,1,1,1,1],[1,0,2,0,0,3,0,1],[1,0,3,0,0,2,4,1],[1,1,1,0,0,1,1,1],[0,0,1,1,1,1,0,0]]; 		private var playerCol:uint; 		private var playerRow:uint; 		private var playerRotation:Number=0; 		private var playerAngle:Number=0; 		private var playerMovement:Number=0; 		private var dRow:int; 		private var dCol:int; 		 		// alternativa3d  engine variables 		private var camera:Camera3D; 		private var controller:SimpleObjectController; 		private var container:ConflictContainer;			 		private var frame:Sprite = new Sprite(); 		public var player:Sphere;// Sphere primitive representing the player 		public var cplayer:SimpleObjectController; //controller for player object 		public var conplayer:Object3DContainer; //container for player 		private var movingCrate:Box;// cube primitive representing the moving crate		 			 		// textures		 		private var crateTexture:TextureMaterial = new TextureMaterial(new crateTextureImg().bitmapData); 		private var floorTexture:TextureMaterial = new TextureMaterial(new floorTextureImg().bitmapData); 		private var crateTopTexture:TextureMaterial = new TextureMaterial(new crateTopTextureImg().bitmapData); 		private var crateTopGoalTexture:TextureMaterial = new TextureMaterial(new crateTopGoalTextureImg().bitmapData); 		private var wallTexture:TextureMaterial = new TextureMaterial(new wallTextureImg().bitmapData); 		private var goalTexture:TextureMaterial = new TextureMaterial(new goalTextureImg().bitmapData); 		private var playerTexture:TextureMaterial = new TextureMaterial(new playerTextureImg().bitmapData); 		// SkyBox textures 		private var backTexture:TextureMaterial = new TextureMaterial(new backTextureImg().bitmapData); 		private var backBottomTexture:TextureMaterial = new TextureMaterial(new backBottomTextureImg().bitmapData); 						 		public function alternativa3dSokoban()  		{			 			stage.scaleMode = StageScaleMode.NO_SCALE; 			stage.align = StageAlign.TOP_LEFT; 			stage.quality = StageQuality.BEST; 			 			// Camera 			camera = new Camera3D(); 			camera.view = new View(640, 480); 			addChild(camera.view); 						 			// Camera controller 			controller = new SimpleObjectController(stage, camera, 200, 3); 			 			// Root object 			container = new ConflictContainer(); 			container.resolveByAABB = true; 			container.resolveByOOBB = true; 			 			//Player controller 			conplayer = new Object3DContainer(); 			cplayer = new SimpleObjectController(stage, player, 3); 			 //i am not shure about SkyBox in Alternativa and will prepare it manually 			var backBottom:Plane = new Plane(200*CUBESIZE/2,200*CUBESIZE/2); 			backBottom.setMaterialToAllFaces(backBottomTexture); 			backBottom.x = 0; 			backBottom.y = -100*CUBESIZE/2; 			backBottom.z = 0; 			backBottom.rotationX = 90*Math.PI/180; 			container.addChild(backBottom); 			 			var backLeft:Plane = new Plane(200*CUBESIZE/2,200*CUBESIZE/2); 			backLeft.setMaterialToAllFaces(backTexture); 			backLeft.x = 0; 			backLeft.y = 0; 			backLeft.z = 100*CUBESIZE/2; 			container.addChild(backLeft);  			var backRight:Plane = new Plane(200*CUBESIZE/2,200*CUBESIZE/2); 			backRight.setMaterialToAllFaces(backTexture); 			backRight.x = 0; 			backRight.y = 0; 			backRight.z = -100*CUBESIZE/2; 			container.addChild(backRight);  			var backFront:Plane = new Plane(200*CUBESIZE/2,200*CUBESIZE/2); 			backFront.setMaterialToAllFaces(backTexture); 			backFront.x = -100*CUBESIZE/2; 			backFront.y = 0; 			backFront.z = 0; 			backFront.rotationY = 90*Math.PI/180; 			container.addChild(backFront);  			var backBack:Plane = new Plane(200*CUBESIZE/2,200*CUBESIZE/2); 			backBack.setMaterialToAllFaces(backTexture); 			backBack.x = 100*CUBESIZE/2; 			backBack.y = 0; 			backBack.z = 0; 			backBack.rotationY = 90*Math.PI/180; 			container.addChild(backBack); // end SkyBox 			 			var box:Box; 			/* 			[[1,1,1,1,0,0,0,0], 			 [1,0,0,1,1,1,1,1], 			 [1,0,2,0,0,3,0,1], 			 [1,0,3,0,0,2,4,1], 			 [1,1,1,0,0,1,1,1], 			 [0,0,1,1,1,1,0,0]]; 			*/ 			// level construction 			for (var i:uint=0; i&lt;6; i++)  			{ 				for (var j:uint=0; j&lt;8; j++)  				{ 					switch (levels[i][j])  					{ 						case 0 : 							box = new Box(CUBESIZE,CUBESIZE/2,CUBESIZE,1,1); 							box.setMaterialToAllFaces(floorTexture); 							box.x = CUBESIZE*j; 							box.y = 0; 							box.z = CUBESIZE*i; 							container.addChild(box); 							break; 						case 1 : 							box = new Box(CUBESIZE,CUBESIZE/2,CUBESIZE,1); 							box.setMaterialToAllFaces(floorTexture); 							box.x = CUBESIZE*j; 							box.y = 0; 							box.z = CUBESIZE*i; 							container.addChild(box); 							 							box = new Box(CUBESIZE,CUBESIZE,CUBESIZE,1); 							box.setMaterialToAllFaces(wallTexture); 							box.x = CUBESIZE*j; 							box.y = CUBESIZE*3/4; 							box.z = CUBESIZE*i; 							container.addChild(box); 							break; 						case 2 : 							box = new Box(CUBESIZE,CUBESIZE/2,CUBESIZE,1); 							box.setMaterialToAllFaces(goalTexture); 							box.x = CUBESIZE*j; 							box.y = 0; 							box.z = CUBESIZE*i; 							container.addChild(box); 							break; 						case 3 : 							box = new Box(CUBESIZE,CUBESIZE/2,CUBESIZE,1); 							box.setMaterialToAllFaces(floorTexture); 							box.x = CUBESIZE*j; 							box.y = 0; 							box.z = CUBESIZE*i; 							container.addChild(box); 							box = new Box(CUBESIZE,CUBESIZE,CUBESIZE,1); 							box.name = "crate_"+i+"_"+j; 							box.setMaterialToAllFaces(crateTexture); 							box.x = CUBESIZE*j; 							box.y = CUBESIZE*3/4; 							box.z = CUBESIZE*i; 							box.rotationX -= 90*Math.PI/180; 							// top of the crate 							box.faces[4].material=crateTopTexture; 							box.faces[5].material=crateTopTexture;  							container.addChild(box); 							break; 						case 4 : 							box = new Box(CUBESIZE,CUBESIZE/2,CUBESIZE,1); 							box.setMaterialToAllFaces(floorTexture); 							box.x = CUBESIZE*j; 							box.y = 0; 							box.z = CUBESIZE*i; 							container.addChild(box); 														 							player = new Sphere(CUBESIZE/2,16,16,false,playerTexture);  							conplayer.addChild(player); 							conplayer.visible = true; 							conplayer.x = CUBESIZE*j; 							conplayer.y = CUBESIZE*3/4; 							conplayer.z = CUBESIZE*i; 							conplayer.rotationX -= 90*Math.PI/180; 							container.addChild(conplayer); 							playerCol=j; 							playerRow=i; 							break; 					} 				} 			}  			// Adding camera 			container.addChild(camera); 			 			// View frame 			addChild(frame);												 			onResize();		 			stage.addEventListener(Event.ENTER_FRAME, updateEvent);			 			stage.addEventListener(KeyboardEvent.KEY_DOWN, onKeyDwn);		 			stage.addEventListener(Event.RESIZE, onResize); 		}  		private function onKeyDwn(e:KeyboardEvent):void  		{ 			if (playerRotation==0&amp;&amp;playerMovement==0)  			{ 				switch (e.keyCode)  				{ 					case Keyboard.LEFT : 						playerRotation=+9; 						playerAngle+=90; 						break; 					case Keyboard.RIGHT : 						playerRotation=-9; 						playerAngle-=90; 						break; 					case Keyboard.UP : 						movingCrate=null; 						playerAngle=Math.round(conplayer.rotationY*180/Math.PI)%360; 						if (playerAngle&lt;0)  						{ 							playerAngle+=360; 						} 						// we have to determine the difference between current row and column 						// and the new row and column according to player heading 						switch (playerAngle)  						{ 							case 0 : 								dRow=0; 								dCol=-1; 								break; 							case 90 : 								//dRow=-1; 								dRow=1; 								dCol=0; 								break; 							case 180 : 								dRow=0; 								dCol=1; 								break; 							case 270 : 								//dRow=1; 								dRow=-1; 								dCol=0; 								break; 						} 						if (levels[playerRow+dRow][playerCol+dCol]==0||levels[playerRow+dRow][playerCol+dCol]==2)  						{ 							// the player can move 							playerMovement=-CUBESIZE/10; 						}  						else  						{ 							if (levels[playerRow+dRow][playerCol+dCol]==3||levels[playerRow+dRow][playerCol+dCol]==5) { 								if (levels[playerRow+2*dRow][playerCol+2*dCol]==0||levels[playerRow+2*dRow][playerCol+2*dCol]==2) { 									// the player can move and can push a crate 									movingCrate=container.getChildByName("crate_"+(playerRow+dRow)+"_"+(playerCol+dCol))as Box; 									playerMovement=-CUBESIZE/10; 								} 							} 						} 						break;  				} 			} 		}   		public function updateEvent(e:Event):void  		{		 				if (playerRotation)  				{ 					conplayer.rotationY+=playerRotation*Math.PI/180; 					 					if (Math.abs(Math.round(conplayer.rotationY*180/Math.PI))%90==0) 					{ 						playerRotation=0; 					} 				} 				 				if (playerMovement)  				{					 					switch (playerAngle)  					{ 					case 0 : 						conplayer.x += playerMovement; 						player.rotationY -= 18*Math.PI/180; 					break; 					case 90 : 						conplayer.z += -playerMovement; 						player.rotationY -= 18*Math.PI/180; 					break; 					case 180 : 						conplayer.x += -playerMovement; 						player.rotationY -= 18*Math.PI/180; 						break; 					case 270 : 						conplayer.z += playerMovement; 						player.rotationY -= 18*Math.PI/180; 						break; 					} 					 					if (movingCrate)  					{ 						switch (playerAngle)  						{ 							case 0 : 								movingCrate.x += playerMovement; 								break; 							case 90 : 								movingCrate.z += -playerMovement; 								break; 							case 180 : 								movingCrate.x += -playerMovement; 								break; 							case 270 : 								movingCrate.z += playerMovement; 								break; 						} 					}  					// we need this to know if the player stopped on the destination tile 					if ((playerAngle%180==0&amp;&amp;(Math.round(conplayer.x*10)/10)%CUBESIZE==0)||(playerAngle%180!=0&amp;&amp;(Math.round(conplayer.z*10)/10)%CUBESIZE==0))  					{ 						playerMovement=0; 						levels[playerRow+dRow][playerCol+dCol]+=4; 						levels[playerRow][playerCol]-=4; 						if (movingCrate) { 							levels[playerRow+2*dRow][playerCol+2*dCol]+=3; 							if (levels[playerRow+2*dRow][playerCol+2*dCol]==5) { 								// changing materials on the fly 								movingCrate.setMaterialToAllFaces(crateTexture); 								// top of the crate on goal 								movingCrate.faces[4].material=crateTopGoalTexture; 								movingCrate.faces[5].material=crateTopGoalTexture;								  							} 							else  							{ 								//movingCrate.setMaterialToAllFaces(crateMaterial); 								movingCrate.setMaterialToAllFaces(crateTexture); 								// top of the crate 								movingCrate.faces[4].material=crateTopTexture; 								movingCrate.faces[5].material=crateTopTexture;								 							} 							levels[playerRow+dRow][playerCol+dCol]-=3; 							movingCrate.name="crate_"+(playerRow+2*dRow)+"_"+(playerCol+2*dCol); 						} 						playerCol+=dCol; 						playerRow+=dRow; 					} 				}  				onEnterFrame(); 		}			  		public function correct_camera_angles():void 		{ 			//set camera position 			var r:Number = 10*CUBESIZE/3;			 			var a:Number = -conplayer.rotationY; 			var cx:Number = conplayer.x+Math.cos(a)*r; 			var cz:Number = conplayer.z+Math.sin(a)*r; 			var cy:Number = conplayer.y+r;			 			controller.setObjectPosXYZ(cx,cy,cz); 			 			//look at player box 			controller.lookAtXYZ(conplayer.x,conplayer.y,conplayer.z); 			 			//correct camera angles			 				var cprotY:Number; 				 				cprotY=Math.round(conplayer.rotationY*180/Math.PI)%360;			 				if (cprotY&lt;0)  				{ 					cprotY+=360; 				} 				if (cprotY&gt;180) 				{ 					camera.rotationX = camera.rotationX + (90*Math.PI/180)*Math.sin((cprotY%180)*Math.PI/180); 				}										 				camera.rotationY = camera.rotationY+90*Math.PI/180-conplayer.rotationY; 		} 		 		public function onEnterFrame(e:Event = null):void  		{ 			controller.update(); 			correct_camera_angles(); 			cplayer.update(); 			camera.render();		 		} 		  		public function onResize(e:Event = null):void  		{ 			//here you can add border size for view 			var pd:Number = 0; 			camera.view.width = stage.stageWidth - pd*2; 			camera.view.height = stage.stageHeight - pd*2; 			camera.view.x = pd; 			camera.view.y = pd; 			 			frame.graphics.clear(); 			frame.graphics.beginFill(0x000000, 0); 			frame.graphics.drawRect(0, 0, stage.stageWidth, stage.stageHeight); 			//frame.graphics.lineStyle(0, 0x7F7F7F); 			frame.graphics.drawRect(pd, pd, camera.view.width, camera.view.height); 			frame.graphics.endFill(); 		} 	} }</pre><p style="margin: 0px 0px 10px; padding: 0px; border: 0px; outline: 0px; font-size: 12px; font-family: Arial, sans-serif; vertical-align: baseline; line-height: 28px; color: #555555; ">Here you can&nbsp;<a href="http://inspiritgames.com/blog/wp-content/uploads/Alternativa3dSokobanTextured.zip" style="margin: 0px; padding: 0px; border: 0px; outline: 0px; font-weight: bold; font-style: inherit; font-family: inherit; vertical-align: baseline; color: #059bff; text-decoration: none; ">download sources</a>.</p><img src ="http://www.blogjava.net/gembin/aggbug/383677.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/gembin/" target="_blank">gembin</a> 2012-07-21 22:58 <a href="http://www.blogjava.net/gembin/archive/2012/07/21/383677.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Embedding fonts into ActionScript 3 project</title><link>http://www.blogjava.net/gembin/archive/2012/07/21/383676.html</link><dc:creator>gembin</dc:creator><author>gembin</author><pubDate>Sat, 21 Jul 2012 14:56:00 GMT</pubDate><guid>http://www.blogjava.net/gembin/archive/2012/07/21/383676.html</guid><wfw:comment>http://www.blogjava.net/gembin/comments/383676.html</wfw:comment><comments>http://www.blogjava.net/gembin/archive/2012/07/21/383676.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/gembin/comments/commentRss/383676.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/gembin/services/trackbacks/383676.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: Operating with embedded graphics and fonts of flash application during development is significant, since unique cross-browser (and cross-platform hopefully) look is one of key RIA/flashgame features. ...&nbsp;&nbsp;<a href='http://www.blogjava.net/gembin/archive/2012/07/21/383676.html'>阅读全文</a><img src ="http://www.blogjava.net/gembin/aggbug/383676.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/gembin/" target="_blank">gembin</a> 2012-07-21 22:56 <a href="http://www.blogjava.net/gembin/archive/2012/07/21/383676.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Setting up the VNC Server in Mac OS X Lion</title><link>http://www.blogjava.net/gembin/archive/2012/07/14/383070.html</link><dc:creator>gembin</dc:creator><author>gembin</author><pubDate>Fri, 13 Jul 2012 16:00:00 GMT</pubDate><guid>http://www.blogjava.net/gembin/archive/2012/07/14/383070.html</guid><wfw:comment>http://www.blogjava.net/gembin/comments/383070.html</wfw:comment><comments>http://www.blogjava.net/gembin/archive/2012/07/14/383070.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/gembin/comments/commentRss/383070.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/gembin/services/trackbacks/383070.html</trackback:ping><description><![CDATA[<h3><p style="margin: 0px 0px 1.5em; padding: 0px; border: 0px; font-weight: bolder; font-size: 14px; font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif; vertical-align: baseline; color: #333333; text-align: left; background-color: #fefefe; ">A&nbsp;<acronym title="Virtual Network Computing" style="margin: 0px; padding: 0px; border-width: 0px 0px 1px; border-bottom-style: dotted; border-bottom-color: #666666; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; ">VNC</acronym>&nbsp;server is included in every edition of Mac OS X, including Mac OS X 10.6 &#8211;<acronym title="also known as" style="margin: 0px; padding: 0px; border-width: 0px 0px 1px; border-bottom-style: dotted; border-bottom-color: #666666; font-weight: inherit; font-style: inherit; font-family: inherit; vertical-align: baseline; ">aka</acronym>&nbsp;Snow Leopard. You can start the server through a hidden check box in the Sharing preferences.</p><p style="margin: 0px 0px 1.5em; padding: 0px; border: 0px; font-weight: normal; font-size: 14px; font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif; vertical-align: baseline; color: #333333; text-align: left; background-color: #fefefe; ">A&nbsp;<acronym title="Virtual Network Computing" style="margin: 0px; padding: 0px; border-width: 0px 0px 1px; border-bottom-style: dotted; border-bottom-color: #666666; font-style: inherit; font-family: inherit; vertical-align: baseline; ">VNC</acronym>&nbsp;server lets you control your Mac from another computer using the&nbsp;<acronym title="Virtual Network Computing" style="margin: 0px; padding: 0px; border-width: 0px 0px 1px; border-bottom-style: dotted; border-bottom-color: #666666; font-style: inherit; font-family: inherit; vertical-align: baseline; ">VNC</acronym>protocol. With recent editions of Mac OS X, Apple has moved to a more sophisticated method of screen sharing. However, a traditional&nbsp;<acronym title="Virtual Network Computing" style="margin: 0px; padding: 0px; border-width: 0px 0px 1px; border-bottom-style: dotted; border-bottom-color: #666666; font-style: inherit; font-family: inherit; vertical-align: baseline; ">VNC</acronym>&nbsp;server is still included but is turned off by default.</p>Starting the Mac OS X VNC Server</h3><ol style="margin: 0px 1.5em 1.5em 0px; padding: 0px; border: 0px; font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif; vertical-align: baseline; color: #333333; text-align: left; background-color: #fefefe; "><li style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-family: inherit; vertical-align: baseline; ">Launch the&nbsp;<strong>System Preferences</strong>.<p style="margin: 0px 0px 1.5em; padding: 0px; border: 0px; font-style: inherit; font-family: inherit; vertical-align: baseline; "></p><div id="attachment_460"  aligncenter"="" style="margin: 1em auto 20px; padding: 4px; border: 0px; font-style: inherit; font-family: inherit; vertical-align: baseline; background-color: #f1f1f1; line-height: 18px; max-width: 632px !important; text-align: center; width: 234px; "><img wp-image-460"="" title="Launch the System Preferences" src="http://www.dssw.co.uk/blog/wp-content/uploads/2010/08/1-mac-vnc-launch-the-system-preferences.jpg" alt="Launch the System Preferences" width="224" height="279" style="margin: 5px 5px 0px; padding: 0px; border: 0px; font-style: inherit; font-family: inherit; vertical-align: baseline; clear: both; display: block; max-width: 100%; height: auto; " /><p style="margin-right: 5px; margin-left: 5px; padding: 0px; border: 0px; font-style: inherit; font-family: inherit; vertical-align: baseline; color: #888888; ">Launch the System Preferences</p></div></li><li style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-family: inherit; vertical-align: baseline; ">Select the&nbsp;<strong>Sharing</strong>preferences.<p style="margin: 0px 0px 1.5em; padding: 0px; border: 0px; font-style: inherit; font-family: inherit; vertical-align: baseline; "></p><div id="attachment_461"  aligncenter"="" style="margin: 1em auto 20px; padding: 4px; border: 0px; font-style: inherit; font-family: inherit; vertical-align: baseline; background-color: #f1f1f1; line-height: 18px; max-width: 632px !important; text-align: center; width: 628px; "><img wp-image-461"="" title="Select the Sharing preferences icon" src="http://www.dssw.co.uk/blog/wp-content/uploads/2010/08/2-mac-vnc-select-sharing-preferences.jpg" alt="Select the Sharing preferences icon" width="618" height="527" style="margin: 5px 5px 0px; padding: 0px; border: 0px; font-style: inherit; font-family: inherit; vertical-align: baseline; clear: both; display: block; max-width: 100%; height: auto; " /><p style="margin-right: 5px; margin-left: 5px; padding: 0px; border: 0px; font-style: inherit; font-family: inherit; vertical-align: baseline; color: #888888; ">Select the Sharing preferences icon</p></div></li><li style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-family: inherit; vertical-align: baseline; ">Enable&nbsp;<strong>Screen Sharing</strong>&nbsp;within the&nbsp;<strong>Service</strong>list.<p style="margin: 0px 0px 1.5em; padding: 0px; border: 0px; font-style: inherit; font-family: inherit; vertical-align: baseline; "></p><div id="attachment_462"  aligncenter"="" style="margin: 1em auto 20px; padding: 4px; border: 0px; font-style: inherit; font-family: inherit; vertical-align: baseline; background-color: #f1f1f1; line-height: 18px; max-width: 632px !important; text-align: center; width: 628px; "><img wp-image-462"="" title="Enable the Screen Sharing service" src="http://www.dssw.co.uk/blog/wp-content/uploads/2010/08/3-mac-vnc-enable-screen-sharing.jpg" alt="Enable the Screen Sharing service" width="618" height="515" style="margin: 5px 5px 0px; padding: 0px; border: 0px; font-style: inherit; font-family: inherit; vertical-align: baseline; clear: both; display: block; max-width: 100%; height: auto; " /><p style="margin-right: 5px; margin-left: 5px; padding: 0px; border: 0px; font-style: inherit; font-family: inherit; vertical-align: baseline; color: #888888; ">Enable the Screen Sharing service</p></div></li><li style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-family: inherit; vertical-align: baseline; ">Click&nbsp;<strong>Computer Settings&#8230;</strong>to show the VNC password setting.<p style="margin: 0px 0px 1.5em; padding: 0px; border: 0px; font-style: inherit; font-family: inherit; vertical-align: baseline; "></p><div id="attachment_463"  aligncenter"="" style="margin: 1em auto 20px; padding: 4px; border: 0px; font-style: inherit; font-family: inherit; vertical-align: baseline; background-color: #f1f1f1; line-height: 18px; max-width: 632px !important; text-align: center; width: 628px; "><img wp-image-463"="" title="Enable VNC and choose a password" src="http://www.dssw.co.uk/blog/wp-content/uploads/2010/08/4-mac-vnc-enable-and-choose-a-password.jpg" alt="Enable VNC and choose a password" width="618" height="515" style="margin: 5px 5px 0px; padding: 0px; border: 0px; font-style: inherit; font-family: inherit; vertical-align: baseline; clear: both; display: block; max-width: 100%; height: auto; " /><p style="margin-right: 5px; margin-left: 5px; padding: 0px; border: 0px; font-style: inherit; font-family: inherit; vertical-align: baseline; color: #888888; ">Enable VNC and choose a password</p></div></li><li style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-family: inherit; vertical-align: baseline; ">Enable&nbsp;<strong>VNC viewers may control screen with password:</strong>.</li><li style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-family: inherit; vertical-align: baseline; ">Enter a strong password.</li><li style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-family: inherit; vertical-align: baseline; ">Click&nbsp;<strong>OK</strong>&nbsp;to save your settings.</li></ol><p style="margin: 0px 0px 1.5em; padding: 0px; border: 0px; font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif; vertical-align: baseline; color: #333333; text-align: left; background-color: #fefefe; ">Your Mac is now running a traditional&nbsp;<acronym title="Virtual Network Computing" style="margin: 0px; padding: 0px; border-width: 0px 0px 1px; border-bottom-style: dotted; border-bottom-color: #666666; font-style: inherit; font-family: inherit; vertical-align: baseline; ">VNC</acronym>&nbsp;server. You can now connect to your Mac using a&nbsp;<acronym title="Virtual Network Computing" style="margin: 0px; padding: 0px; border-width: 0px 0px 1px; border-bottom-style: dotted; border-bottom-color: #666666; font-style: inherit; font-family: inherit; vertical-align: baseline; ">VNC</acronym>&nbsp;client running on another Mac, Windows, or Linux computer.<br /><br />NOTE: the default vnc listening port is 5900</p><img src ="http://www.blogjava.net/gembin/aggbug/383070.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/gembin/" target="_blank">gembin</a> 2012-07-14 00:00 <a href="http://www.blogjava.net/gembin/archive/2012/07/14/383070.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Enable Telnet in MAC OS X Lion</title><link>http://www.blogjava.net/gembin/archive/2012/07/13/383063.html</link><dc:creator>gembin</dc:creator><author>gembin</author><pubDate>Fri, 13 Jul 2012 14:43:00 GMT</pubDate><guid>http://www.blogjava.net/gembin/archive/2012/07/13/383063.html</guid><wfw:comment>http://www.blogjava.net/gembin/comments/383063.html</wfw:comment><comments>http://www.blogjava.net/gembin/archive/2012/07/13/383063.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/gembin/comments/commentRss/383063.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/gembin/services/trackbacks/383063.html</trackback:ping><description><![CDATA[<div>[gembin@localhost bin]$ sudo launchctl</div><div>Password:</div><div>launchd%&nbsp;</div><div></div><div>launchd% load -F /System/Library/LaunchDaemons/telnet.plist</div><div>launchd% exit<br /><br />and now the telnet is enabled, try to test it.</div><div>[gembin@localhost bin]$ telnet localhost</div><div>Trying ::1...</div><div>Connected to localhost.</div><div>Escape character is '^]'.</div><div>login: gembin</div><div>Password:</div><div>Last login: Fri Jul 13 22:21:08 on ttys002</div><img src ="http://www.blogjava.net/gembin/aggbug/383063.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/gembin/" target="_blank">gembin</a> 2012-07-13 22:43 <a href="http://www.blogjava.net/gembin/archive/2012/07/13/383063.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Comparing the syntax of Java 5 and ActionScript 3</title><link>http://www.blogjava.net/gembin/archive/2012/07/07/382482.html</link><dc:creator>gembin</dc:creator><author>gembin</author><pubDate>Sat, 07 Jul 2012 14:44:00 GMT</pubDate><guid>http://www.blogjava.net/gembin/archive/2012/07/07/382482.html</guid><wfw:comment>http://www.blogjava.net/gembin/comments/382482.html</wfw:comment><comments>http://www.blogjava.net/gembin/archive/2012/07/07/382482.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/gembin/comments/commentRss/382482.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/gembin/services/trackbacks/382482.html</trackback:ping><description><![CDATA[<div style="font-family: Verdana, Helvetica, sans-serif; font-size: 12px; line-height: normal; text-align: left; background-color: #ffffff; "><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">This list is not complete, and your input is appreciated.</p><table cellspacing="0" cellpadding="0" border="1" style="border: medium none; border-collapse: collapse; "><tbody><tr><td valign="top" style="border: 1pt solid windowtext; padding: 0in 5.4pt; width: 145px; "><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; "><strong>Concept/Language Construct</strong></p></td><td valign="top" style="border-style: solid solid solid none; border-width: 1pt 1pt 1pt medium; padding: 0in 5.4pt; width: 168px; "><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; "><strong>Java 5.0</strong></p></td><td valign="top" style="border-style: solid solid solid none; border-width: 1pt 1pt 1pt medium; padding: 0in 5.4pt; width: 229px; "><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; "><strong>ActionScript 3.0</strong></p></td></tr><tr><td valign="top" style="border-style: none solid solid; border-width: medium 1pt 1pt; padding: 0in 5.4pt; width: 145px; "><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">Class library packaging</p></td><td valign="top" style="border-style: none solid solid none; border-width: medium 1pt 1pt medium; padding: 0in 5.4pt; width: 168px; "><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">.jar</p></td><td valign="top" style="border-style: none solid solid none; border-width: medium 1pt 1pt medium; padding: 0in 5.4pt; width: 229px; "><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">.swc</p></td></tr><tr><td valign="top" style="border-style: none solid solid; border-width: medium 1pt 1pt; padding: 0in 5.4pt; width: 145px; "><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">Inheritance</p></td><td valign="top" style="border-style: none solid solid none; border-width: medium 1pt 1pt medium; padding: 0in 5.4pt; width: 168px; "><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; "><span style="font-size: 10pt; ">class Employee extends Person{&#8230;}</span></p></td><td valign="top" style="border-style: none solid solid none; border-width: medium 1pt 1pt medium; padding: 0in 5.4pt; width: 229px; "><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; "><span style="font-size: 10pt; ">class Employee extends Person{&#8230;}</span></p><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; "></p></td></tr><tr><td valign="top" style="border-style: none solid solid; border-width: medium 1pt 1pt; padding: 0in 5.4pt; width: 145px; "><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">Variable declaration and initialization</p></td><td valign="top" style="border-style: none solid solid none; border-width: medium 1pt 1pt medium; padding: 0in 5.4pt; width: 168px; "><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; "><span style="font-size: 10pt; ">String firstName=&#8221;John&#8221;;</span></p><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; "><span style="font-size: 10pt; ">Date shipDate=new Date();</span></p><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; "><span style="font-size: 10pt; ">int i;</span></p><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; "><span style="font-size: 10pt; ">int a, b=10;</span></p><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; "><span style="font-size: 10pt; ">double salary;</span></p></td><td valign="top" style="border-style: none solid solid none; border-width: medium 1pt 1pt medium; padding: 0in 5.4pt; width: 229px; "><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; "><span style="font-size: 10pt; ">var firstName:String=&#8221;John&#8221;;</span></p><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; "><span style="font-size: 10pt; ">var shipDate:Date=new Date();</span></p><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; "><span style="font-size: 10pt; ">var i:int;</span></p><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; "><span style="font-size: 10pt; ">var a:int, b:int=10;</span></p><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; "><span style="font-size: 10pt; ">var salary:Number;</span></p></td></tr><tr><td valign="top" style="border-style: none solid solid; border-width: medium 1pt 1pt; padding: 0in 5.4pt; width: 145px; "><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">Undeclared variables</p></td><td valign="top" style="border-style: none solid solid none; border-width: medium 1pt 1pt medium; padding: 0in 5.4pt; width: 168px; "><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; "><span style="font-size: 10pt; ">n/a</span></p></td><td valign="top" style="border-style: none solid solid none; border-width: medium 1pt 1pt medium; padding: 0in 5.4pt; width: 229px; "><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; "><span style="font-size: 9pt; font-family: Utopia; ">It&#8217;s an equivalent to the wild card type notation *. If you declare a variable but do not specify its type, the * type will apply.</span></p><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; "><span style="font-size: 9pt; font-family: Utopia; ">A default value:</span><span style="font-size: 10pt; ">&nbsp;undefined</span></p><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">var myVar:*;</p><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; "></p></td></tr><tr><td valign="top" style="border-style: none solid solid; border-width: medium 1pt 1pt; padding: 0in 5.4pt; width: 145px; "><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">Variable scopes</p></td><td valign="top" style="border-style: none solid solid none; border-width: medium 1pt 1pt medium; padding: 0in 5.4pt; width: 168px; "><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">block: declared within curly braces,<br />local: declared within a method or a block</p><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; "></p><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">member: declared on the class level</p><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; "></p><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">no global variables</p></td><td valign="top" style="border-style: none solid solid none; border-width: medium 1pt 1pt medium; padding: 0in 5.4pt; width: 229px; "><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">No block scope: the minimal scope is a function</p><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; "></p><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">local: declared within a function</p><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; "></p><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">member: declared on the class level</p><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; "></p><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; "><span style="font-size: 10pt; ">If a variable is declared outside of any function or class definition, it has global scope.</span></p></td></tr><tr><td valign="top" style="border-style: none solid solid; border-width: medium 1pt 1pt; padding: 0in 5.4pt; width: 145px; "><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">Strings</p></td><td valign="top" style="border-style: none solid solid none; border-width: medium 1pt 1pt medium; padding: 0in 5.4pt; width: 168px; "><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">Immutable, store sequences of two-byte Unicode characters</p></td><td valign="top" style="border-style: none solid solid none; border-width: medium 1pt 1pt medium; padding: 0in 5.4pt; width: 229px; "><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">Immutable, store sequences of two-byte Unicode characters</p></td></tr><tr><td valign="top" style="border-style: none solid solid; border-width: medium 1pt 1pt; padding: 0in 5.4pt; width: 145px; "><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">Terminating statements with semicolons</p></td><td valign="top" style="border-style: none solid solid none; border-width: medium 1pt 1pt medium; padding: 0in 5.4pt; width: 168px; "><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">A must</p></td><td valign="top" style="border-style: none solid solid none; border-width: medium 1pt 1pt medium; padding: 0in 5.4pt; width: 229px; "><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">If you write one statement per line you can omit it.</p></td></tr><tr><td valign="top" style="border-style: none solid solid; border-width: medium 1pt 1pt; padding: 0in 5.4pt; width: 145px; "><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">Strict equality operator</p></td><td valign="top" style="border-style: none solid solid none; border-width: medium 1pt 1pt medium; padding: 0in 5.4pt; width: 168px; "><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">n/a</p></td><td valign="top" style="border-style: none solid solid none; border-width: medium 1pt 1pt medium; padding: 0in 5.4pt; width: 229px; "><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">===</p><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">for strict non-equality use</p><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">!==</p></td></tr><tr><td valign="top" style="border-style: none solid solid; border-width: medium 1pt 1pt; padding: 0in 5.4pt; width: 145px; "><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">Constant qualifier</p></td><td valign="top" style="border-style: none solid solid none; border-width: medium 1pt 1pt medium; padding: 0in 5.4pt; width: 168px; "><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">The keyword final</p><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; "></p><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">final int STATE=&#8221;NY&#8221;;</p></td><td valign="top" style="border-style: none solid solid none; border-width: medium 1pt 1pt medium; padding: 0in 5.4pt; width: 229px; "><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">The keyword const</p><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; "></p><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">const STATE:int =&#8221;NY&#8221;;</p></td></tr><tr><td valign="top" style="border-style: none solid solid; border-width: medium 1pt 1pt; padding: 0in 5.4pt; width: 145px; "><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">Type checking</p></td><td valign="top" style="border-style: none solid solid none; border-width: medium 1pt 1pt medium; padding: 0in 5.4pt; width: 168px; "><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">Static (checked at compile time)</p></td><td valign="top" style="border-style: none solid solid none; border-width: medium 1pt 1pt medium; padding: 0in 5.4pt; width: 229px; "><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; "><span style="font-size: 10pt; ">Dynamic (checked at run-time) and static (it&#8217;s so called &#8216;strict mode&#8217;, which is default in Flex Builder)</span></p></td></tr><tr><td valign="top" style="border-style: none solid solid; border-width: medium 1pt 1pt; padding: 0in 5.4pt; width: 145px; "><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">Type check operator</p></td><td valign="top" style="border-style: none solid solid none; border-width: medium 1pt 1pt medium; padding: 0in 5.4pt; width: 168px; "><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">instanceof</p></td><td valign="top" style="border-style: none solid solid none; border-width: medium 1pt 1pt medium; padding: 0in 5.4pt; width: 229px; "><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">is<span style="font-size: 10pt; ">&nbsp;&#8211; checks data type, i.e. if (myVar is String){&#8230;}</span></p><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; "></p><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">The is operator is a replacement of older instanceof</p></td></tr><tr><td valign="top" style="border-style: none solid solid; border-width: medium 1pt 1pt; padding: 0in 5.4pt; width: 145px; "><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">The as operator</p></td><td valign="top" style="border-style: none solid solid none; border-width: medium 1pt 1pt medium; padding: 0in 5.4pt; width: 168px; "><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">n/a</p></td><td valign="top" style="border-style: none solid solid none; border-width: medium 1pt 1pt medium; padding: 0in 5.4pt; width: 229px; "><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">Similar to is operator, but returns not Boolean, but the result of expression:</p><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; "></p><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">var orderId:String=&#8221;123&#8221;;</p><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">var orderIdN:Number=orderId as Number;</p><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">trace(orderIdN);//prints 123</p><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; "></p></td></tr><tr><td valign="top" style="border-style: none solid solid; border-width: medium 1pt 1pt; padding: 0in 5.4pt; width: 145px; "><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">Primitives</p></td><td valign="top" style="border-style: none solid solid none; border-width: medium 1pt 1pt medium; padding: 0in 5.4pt; width: 168px; "><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">byte, int, long, float, double,short, boolean, char</p></td><td valign="top" style="border-style: none solid solid none; border-width: medium 1pt 1pt medium; padding: 0in 5.4pt; width: 229px; "><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">all primitives in ActionScript are<span style="font-size: 10pt; ">objects.<br />Boolean, int, uint, Number, String</span></p><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; "></p><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; "><span style="font-size: 10pt; ">The following lines are equivalent;</span></p><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">var age:int = 25;</p><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">var age:int = new int(25);</p><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; "></p></td></tr><tr><td valign="top" style="border-style: none solid solid; border-width: medium 1pt 1pt; padding: 0in 5.4pt; width: 145px; "><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">Complex types</p></td><td valign="top" style="border-style: none solid solid none; border-width: medium 1pt 1pt medium; padding: 0in 5.4pt; width: 168px; "><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">n/a</p></td><td valign="top" style="border-style: none solid solid none; border-width: medium 1pt 1pt medium; padding: 0in 5.4pt; width: 229px; "><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">Array, Date, Error, Function, RegExp, XML, and XMLList</p></td></tr><tr><td valign="top" style="border-style: none solid solid; border-width: medium 1pt 1pt; padding: 0in 5.4pt; width: 145px; "><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">Array declaration and instantiation</p></td><td valign="top" style="border-style: none solid solid none; border-width: medium 1pt 1pt medium; padding: 0in 5.4pt; width: 168px; "><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">int quarterResults[];</p><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">quarterResults =<br />new int[4];</p><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; "></p><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; "></p><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">int quarterResults[]={25,33,56,84};</p><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; "></p></td><td valign="top" style="border-style: none solid solid none; border-width: medium 1pt 1pt medium; padding: 0in 5.4pt; width: 229px; "><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">var quarterResults:Array<br />=new Array();</p><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">or</p><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">var quarterResults:Array=[];</p><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; "></p><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">var quarterResults:Array=<br />[25, 33, 56, 84];</p><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">AS3 also has associative arrays that uses named elements instead of numeric indexes (similar to Hashtable).</p></td></tr><tr><td valign="top" style="border-style: none solid solid; border-width: medium 1pt 1pt; padding: 0in 5.4pt; width: 145px; "><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">The top class in the inheritance tree</p></td><td valign="top" style="border-style: none solid solid none; border-width: medium 1pt 1pt medium; padding: 0in 5.4pt; width: 168px; "><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; "><span style="font-size: 10pt; ">Object</span></p><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; "></p></td><td valign="top" style="border-style: none solid solid none; border-width: medium 1pt 1pt medium; padding: 0in 5.4pt; width: 229px; "><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; "><span style="font-size: 10pt; ">Object</span></p></td></tr><tr><td valign="top" style="border-style: none solid solid; border-width: medium 1pt 1pt; padding: 0in 5.4pt; width: 145px; "><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">Casting syntax: cast the class Object to Person:</p><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; "></p></td><td valign="top" style="border-style: none solid solid none; border-width: medium 1pt 1pt medium; padding: 0in 5.4pt; width: 168px; "><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">Person p=(Person) myObject;</p><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; "></p></td><td valign="top" style="border-style: none solid solid none; border-width: medium 1pt 1pt medium; padding: 0in 5.4pt; width: 229px; "><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">var p:Person= Person(myObject);</p><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">or</p><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px 0.4em 0in; ">var p:Person= myObject as Person;</p></td></tr><tr><td valign="top" style="border-style: none solid solid; border-width: medium 1pt 1pt; padding: 0in 5.4pt; width: 145px; "><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">upcasting</p></td><td valign="top" style="border-style: none solid solid none; border-width: medium 1pt 1pt medium; padding: 0in 5.4pt; width: 168px; "><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">class Xyz extends Abc{}</p><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">Abc myObj = new Xyz();</p><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; "></p></td><td valign="top" style="border-style: none solid solid none; border-width: medium 1pt 1pt medium; padding: 0in 5.4pt; width: 229px; "><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">class Xyz extends Abc{}</p><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">var myObj:Abc=new Xyz();</p></td></tr><tr><td valign="top" style="border-style: none solid solid; border-width: medium 1pt 1pt; padding: 0in 5.4pt; width: 145px; "><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">Un-typed variable</p></td><td valign="top" style="border-style: none solid solid none; border-width: medium 1pt 1pt medium; padding: 0in 5.4pt; width: 168px; "><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">n/a</p></td><td valign="top" style="border-style: none solid solid none; border-width: medium 1pt 1pt medium; padding: 0in 5.4pt; width: 229px; "><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; "><span style="font-size: 10pt; ">var myObject:*</span></p><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; "><span style="font-size: 10pt; ">var myObject:</span></p></td></tr><tr><td valign="top" style="border-style: none solid solid; border-width: medium 1pt 1pt; padding: 0in 5.4pt; width: 145px; "><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">packages</p></td><td valign="top" style="border-style: none solid solid none; border-width: medium 1pt 1pt medium; padding: 0in 5.4pt; width: 168px; "><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; "><span style="font-size: 10pt; ">package com.xyz;</span></p><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; "><span style="font-size: 10pt; ">class myClass {&#8230;}</span></p></td><td valign="top" style="border-style: none solid solid none; border-width: medium 1pt 1pt medium; padding: 0in 5.4pt; width: 229px; "><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; "><span style="font-size: 10pt; ">package com.xyz{</span></p><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; "><span style="font-size: 10pt; ">class myClass{&#8230;}</span></p><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; "><span style="font-size: 10pt; ">}</span></p><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; "><span style="font-size: 10pt; ">ActionScript packages can include not only classes, but separate functions as well</span></p></td></tr><tr><td valign="top" style="border-style: none solid solid; border-width: medium 1pt 1pt; padding: 0in 5.4pt; width: 145px; "><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">Class access levels</p></td><td valign="top" style="border-style: none solid solid none; border-width: medium 1pt 1pt medium; padding: 0in 5.4pt; width: 168px; "><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; "><span style="font-size: 10pt; ">public, private, protected</span></p><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">if none is specified, classes have package access level</p></td><td valign="top" style="border-style: none solid solid none; border-width: medium 1pt 1pt medium; padding: 0in 5.4pt; width: 229px; "><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">public, private, protected</p><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">if none is specified, classes have<span style="font-size: 8pt; ">internal</span>&nbsp;access level (similar to package access level in Java)</p></td></tr><tr><td valign="top" style="border-style: none solid solid; border-width: medium 1pt 1pt; padding: 0in 5.4pt; width: 145px; "><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">Custom access levels: namespaces</p></td><td valign="top" style="border-style: none solid solid none; border-width: medium 1pt 1pt medium; padding: 0in 5.4pt; width: 168px; "><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">n/a</p></td><td valign="top" style="border-style: none solid solid none; border-width: medium 1pt 1pt medium; padding: 0in 5.4pt; width: 229px; "><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; "><span style="font-size: 10pt; ">Similar to XML namespaces.</span></p><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">namespace abc;</p><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">abc function myCalc(){}</p><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; "></p><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; "><span style="font-size: 10pt; ">or</span></p><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; "></p><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">abc::myCalc(){}</p><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; "></p><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; "><span style="font-size: 10pt; ">use namespace abc ;</span></p><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; "></p></td></tr><tr><td valign="top" style="border-style: none solid solid; border-width: medium 1pt 1pt; padding: 0in 5.4pt; width: 145px; "><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">Console output</p></td><td valign="top" style="border-style: none solid solid none; border-width: medium 1pt 1pt medium; padding: 0in 5.4pt; width: 168px; "><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">System.out.println();</p></td><td valign="top" style="border-style: none solid solid none; border-width: medium 1pt 1pt medium; padding: 0in 5.4pt; width: 229px; "><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; "><span style="font-size: 10pt; ">// in debug mode only</span></p><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; "><span style="font-size: 10pt; ">trace();</span></p><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; "></p></td></tr><tr><td valign="top" style="border-style: none solid solid; border-width: medium 1pt 1pt; padding: 0in 5.4pt; width: 145px; "><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">imports</p></td><td valign="top" style="border-style: none solid solid none; border-width: medium 1pt 1pt medium; padding: 0in 5.4pt; width: 168px; "><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">import com.abc.*;</p><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">import com.abc.MyClass;</p></td><td valign="top" style="border-style: none solid solid none; border-width: medium 1pt 1pt medium; padding: 0in 5.4pt; width: 229px; "><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">import com.abc.*;</p><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">import com.abc.MyClass;</p><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; "></p><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">packages must be imported even if the class names are fully qualified in the code.</p></td></tr><tr><td valign="top" style="border-style: none solid solid; border-width: medium 1pt 1pt; padding: 0in 5.4pt; width: 145px; "><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">Unordered key-value pairs</p></td><td valign="top" style="border-style: none solid solid none; border-width: medium 1pt 1pt medium; padding: 0in 5.4pt; width: 168px; "><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">Hashtable, Map</p><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; "></p><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">Hashtable friends = new Hashtable();</p><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; "></p><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">friends.put(&#8220;good&#8221;,<br />&#8220;Mary&#8221;);</p><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">friends.put(&#8220;best&#8221;,<br />&#8220;Bill&#8221;);</p><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">friends.put(&#8220;bad&#8221;,<br />&#8220;Masha&#8221;);</p><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; "></p><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">String bestFriend= friends.get(&#8220;best&#8221;);</p><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">// bestFriend is Bill</p></td><td valign="top" style="border-style: none solid solid none; border-width: medium 1pt 1pt medium; padding: 0in 5.4pt; width: 229px; "><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">Associative Arrays</p><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; "></p><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">Allows referencing its elements by names instead of indexes.</p><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">var friends:Array=new Array();<br />friends["good"]=&#8221;Mary&#8221;;</p><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">friends["best"]=&#8221;Bill&#8221;;</p><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">friends["bad"]=&#8221;Masha&#8221;;</p><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; "></p><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; "><span style="font-size: 10pt; ">var&nbsp;</span>bestFriend:String= friends[&#8220;best&#8221;]</p><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; "></p><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">friends.best=&#8221;Alex&#8221;;</p><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; "></p><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">Another syntax:</p><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">var car:Object = {make:&#8221;Toyota&#8221;, model:&#8221;Camry&#8221;};</p><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">trace (car["make"], car.model);</p><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">// Output: Toyota Camry</p></td></tr><tr><td valign="top" style="border-style: none solid solid; border-width: medium 1pt 1pt; padding: 0in 5.4pt; width: 145px; "><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">Hoisting</p></td><td valign="top" style="border-style: none solid solid none; border-width: medium 1pt 1pt medium; padding: 0in 5.4pt; width: 168px; "><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">n/a</p></td><td valign="top" style="border-style: none solid solid none; border-width: medium 1pt 1pt medium; padding: 0in 5.4pt; width: 229px; "><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; "><span style="font-size: 10pt; ">Compiler moves all variable declarations to the top of the function, so you can use a variable name even before it&#8217;s been explicitly declared in the code.</span></p></td></tr><tr><td valign="top" style="border-style: none solid solid; border-width: medium 1pt 1pt; padding: 0in 5.4pt; width: 145px; "><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">Instantiation objects from classes</p></td><td valign="top" style="border-style: none solid solid none; border-width: medium 1pt 1pt medium; padding: 0in 5.4pt; width: 168px; "><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; "><span style="font-size: 10pt; ">Customer cmr = new Customer();</span></p><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; "></p><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; "><span style="font-size: 10pt; ">Class cls = Class.forName(&#8220;Customer&#8221;);</span></p><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; "><span style="font-size: 10pt; ">Object myObj= cls.newInstance();</span></p></td><td valign="top" style="border-style: none solid solid none; border-width: medium 1pt 1pt medium; padding: 0in 5.4pt; width: 229px; "><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; "><span style="font-size: 10pt; ">var cmr:Customer = new Customer();</span></p><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; "></p><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">var cls:Class = flash.util.getClassByName(&#8220;Customer&#8221;);<br />var myObj:Object = new cls();</p></td></tr><tr><td valign="top" style="border-style: none solid solid; border-width: medium 1pt 1pt; padding: 0in 5.4pt; width: 145px; "><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">Private classes</p></td><td valign="top" style="border-style: none solid solid none; border-width: medium 1pt 1pt medium; padding: 0in 5.4pt; width: 168px; "><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">private class myClass{&#8230;}</p></td><td valign="top" style="border-style: none solid solid none; border-width: medium 1pt 1pt medium; padding: 0in 5.4pt; width: 229px; "><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">There is no private classes in AS3.</p><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; "></p></td></tr><tr><td valign="top" style="border-style: none solid solid; border-width: medium 1pt 1pt; padding: 0in 5.4pt; width: 145px; "><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">Private constructors</p></td><td valign="top" style="border-style: none solid solid none; border-width: medium 1pt 1pt medium; padding: 0in 5.4pt; width: 168px; "><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">Supported. Typical use: singleton classes.</p></td><td valign="top" style="border-style: none solid solid none; border-width: medium 1pt 1pt medium; padding: 0in 5.4pt; width: 229px; "><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">Not available. Implementation of private constructors is postponed as they are not the part of the ECMAScript standard yet.</p><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">To create a Singleton, use public static getInstance(), which sets a private flag instanceExists after the first instantiation. Check this flag in the public constructor, and if instanceExists==true, throw an error.</p></td></tr><tr><td valign="top" style="border-style: none solid solid; border-width: medium 1pt 1pt; padding: 0in 5.4pt; width: 145px; "><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">Class and file names</p></td><td valign="top" style="border-style: none solid solid none; border-width: medium 1pt 1pt medium; padding: 0in 5.4pt; width: 168px; "><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">A file can have multiple class declarations, but only one of them can be public, and the file must have the same name as this class.</p></td><td valign="top" style="border-style: none solid solid none; border-width: medium 1pt 1pt medium; padding: 0in 5.4pt; width: 229px; "><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">A file can have multiple class declarations, but only one of them can be placed inside the package declaration, and the file must have the same name as this class.</p></td></tr><tr><td valign="top" style="border-style: none solid solid; border-width: medium 1pt 1pt; padding: 0in 5.4pt; width: 145px; "><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">What can be placed in a package</p></td><td valign="top" style="border-style: none solid solid none; border-width: medium 1pt 1pt medium; padding: 0in 5.4pt; width: 168px; "><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">Classes and interfaces</p></td><td valign="top" style="border-style: none solid solid none; border-width: medium 1pt 1pt medium; padding: 0in 5.4pt; width: 229px; "><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">Classes, interfaces, variables, functions, namespaces, and executable statements.</p></td></tr><tr><td valign="top" style="border-style: none solid solid; border-width: medium 1pt 1pt; padding: 0in 5.4pt; width: 145px; "><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">Dynamic classes (define an object that can be altered at runtime by adding or changing properties and methods).</p></td><td valign="top" style="border-style: none solid solid none; border-width: medium 1pt 1pt medium; padding: 0in 5.4pt; width: 168px; "><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">n/a</p></td><td valign="top" style="border-style: none solid solid none; border-width: medium 1pt 1pt medium; padding: 0in 5.4pt; width: 229px; "><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">dynamic class Person {</p><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">var name:String;</p><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">}</p><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">//Dynamically add a variable // and a function</p><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">var p:Person = new Person();</p><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">p.name=&#8221;Joe&#8221;;</p><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">p.age=25;</p><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">p.printMe = function () {</p><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">trace (p.name, p.age);</p><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">}</p><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">p.printMe(); // Joe 25</p></td></tr><tr><td valign="top" style="border-style: none solid solid; border-width: medium 1pt 1pt; padding: 0in 5.4pt; width: 145px; "><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">function closures</p></td><td valign="top" style="border-style: none solid solid none; border-width: medium 1pt 1pt medium; padding: 0in 5.4pt; width: 168px; "><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">n/a. Closure is a proposed addition to Java 7.</p></td><td valign="top" style="border-style: none solid solid none; border-width: medium 1pt 1pt medium; padding: 0in 5.4pt; width: 229px; "><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; "><span style="font-size: 8pt; ">myButton.addEventListener(&#8220;click&#8221;, myMethod);</span></p><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; "><span style="font-size: 10pt; ">A closure is an object that represents a snapshot of a function with its lexical context (variable&#8217;s values, objects in the scope). A function closure can be passed as an argument and executed without being a part of any object</span></p></td></tr><tr><td valign="top" style="border-style: none solid solid; border-width: medium 1pt 1pt; padding: 0in 5.4pt; width: 145px; "><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">Abstract classes</p></td><td valign="top" style="border-style: none solid solid none; border-width: medium 1pt 1pt medium; padding: 0in 5.4pt; width: 168px; "><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">supported</p></td><td valign="top" style="border-style: none solid solid none; border-width: medium 1pt 1pt medium; padding: 0in 5.4pt; width: 229px; "><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">n/a</p></td></tr><tr><td valign="top" style="border-style: none solid solid; border-width: medium 1pt 1pt; padding: 0in 5.4pt; width: 145px; "><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">Function overriding</p></td><td valign="top" style="border-style: none solid solid none; border-width: medium 1pt 1pt medium; padding: 0in 5.4pt; width: 168px; "><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">supported</p></td><td valign="top" style="border-style: none solid solid none; border-width: medium 1pt 1pt medium; padding: 0in 5.4pt; width: 229px; "><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">Supported. You must use the override qualifier</p></td></tr><tr><td valign="top" style="border-style: none solid solid; border-width: medium 1pt 1pt; padding: 0in 5.4pt; width: 145px; "><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">Function overloading</p></td><td valign="top" style="border-style: none solid solid none; border-width: medium 1pt 1pt medium; padding: 0in 5.4pt; width: 168px; "><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">supported</p></td><td valign="top" style="border-style: none solid solid none; border-width: medium 1pt 1pt medium; padding: 0in 5.4pt; width: 229px; "><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">Not supported.</p></td></tr><tr><td valign="top" style="border-style: none solid solid; border-width: medium 1pt 1pt; padding: 0in 5.4pt; width: 145px; "><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">Interfaces</p></td><td valign="top" style="border-style: none solid solid none; border-width: medium 1pt 1pt medium; padding: 0in 5.4pt; width: 168px; "><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">class A implements B{&#8230;}</p><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">interfaces can contain method declarations and final variables.</p></td><td valign="top" style="border-style: none solid solid none; border-width: medium 1pt 1pt medium; padding: 0in 5.4pt; width: 229px; "><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">class A implements B{&#8230;}</p><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">interfaces can contain only function declarations.</p></td></tr><tr><td valign="top" style="border-style: none solid solid; border-width: medium 1pt 1pt; padding: 0in 5.4pt; width: 145px; "><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">Exception handling</p></td><td valign="top" style="border-style: none solid solid none; border-width: medium 1pt 1pt medium; padding: 0in 5.4pt; width: 168px; "><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; "><span style="font-size: 9pt; font-family: Utopia; ">Keywords:</span>&nbsp;try, catch, throw, finally, throws</p><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; "></p><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">Uncaught exceptions are propagated to the calling method.</p></td><td valign="top" style="border-style: none solid solid none; border-width: medium 1pt 1pt medium; padding: 0in 5.4pt; width: 229px; "><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; "><span style="font-size: 9pt; font-family: Utopia; ">Keywords:&nbsp;</span>try, catch, throw, finally</p><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; "></p><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">A method does not have to declare exceptions.</p><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">Can throw not only Error objects, but also numbers:</p><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; "></p><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">throw 25.3;</p><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; "></p><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">Flash Player terminates the script in case of uncaught exception.</p><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; "></p></td></tr><tr><td valign="top" style="border-style: none solid solid; border-width: medium 1pt 1pt; padding: 0in 5.4pt; width: 145px; "><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">Regular expressions</p></td><td valign="top" style="border-style: none solid solid none; border-width: medium 1pt 1pt medium; padding: 0in 5.4pt; width: 168px; "><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">Supported</p></td><td valign="top" style="border-style: none solid solid none; border-width: medium 1pt 1pt medium; padding: 0in 5.4pt; width: 229px; "><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; ">Supported</p></td></tr></tbody></table></div><div style="font-family: Verdana, Helvetica, sans-serif; font-size: 12px; line-height: normal; text-align: left; background-color: #ffffff; "><p style="font-size: 1em; line-height: 1.5em; margin: 0.4em 0px; "><br /></p></div><img src ="http://www.blogjava.net/gembin/aggbug/382482.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/gembin/" target="_blank">gembin</a> 2012-07-07 22:44 <a href="http://www.blogjava.net/gembin/archive/2012/07/07/382482.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>MySQL basis</title><link>http://www.blogjava.net/gembin/archive/2012/05/22/378747.html</link><dc:creator>gembin</dc:creator><author>gembin</author><pubDate>Mon, 21 May 2012 16:25:00 GMT</pubDate><guid>http://www.blogjava.net/gembin/archive/2012/05/22/378747.html</guid><wfw:comment>http://www.blogjava.net/gembin/comments/378747.html</wfw:comment><comments>http://www.blogjava.net/gembin/archive/2012/05/22/378747.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/gembin/comments/commentRss/378747.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/gembin/services/trackbacks/378747.html</trackback:ping><description><![CDATA[<pre style="line-height: normal; word-wrap: break-word; white-space: pre-wrap; "><span style="font-size: 14pt; color: #800080; ">basic steps to play with mysql</span><span style="color: #008000; font-size: 14pt; "><br /></span><span style="color: #008000; "><br /># 1) login mysql with root</span><pre style="word-wrap: break-word; white-space: pre-wrap; ">     mysql -u root -p</pre><span style="color: #008000; "># 2) update password for root (optional)<br /></span><pre style="word-wrap: break-word; white-space: pre-wrap; "><div style="background-color:#eeeeee;font-size:13px;border:1px solid #CCCCCC;padding-right: 5px;padding-bottom: 4px;padding-left: 4px;padding-top: 4px;width: 98%;word-break:break-all"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><span style="color: #0000FF; ">UPDATE</span>&nbsp;mysql.<span style="color: #FF00FF; ">user</span>&nbsp;<span style="color: #0000FF; ">SET</span>&nbsp;password<span style="color: #808080; ">=</span>PASSWORD(<span style="color: #FF0000; ">'newPasswordFor</span><span style="color: #FF0000; ">Root</span><span style="color: #FF0000; ">'</span>)&nbsp;<span style="color: #0000FF; ">WHERE</span>&nbsp;<span style="color: #FF00FF; ">User</span><span style="color: #808080; ">=</span><span style="color: #FF0000; ">'</span><span style="color: #FF0000; ">root</span><span style="color: #FF0000; ">'</span>;<br />FLUSH&nbsp;<span style="color: #0000ff; ">PRIVILEGES</span>;</div></pre><span style="color: #008000; "><br /># 3) create a new user 'user1'</span><br />
<div style="background-color:#eeeeee;font-size:13px;border:1px solid #CCCCCC;padding-right: 5px;padding-bottom: 4px;padding-left: 4px;padding-top: 4px;width: 98%;word-break:break-all"><!--<br />
<br />
Code highlighting produced by Actipro CodeHighlighter (freeware)<br />
http://www.CodeHighlighter.com/<br />
<br />
--><span style="color: #0000FF; ">CREATE</span>&nbsp;<span style="color: #FF00FF; ">USER</span>&nbsp;user1&nbsp;IDENTIFIED&nbsp;<span style="color: #0000FF; ">BY</span>&nbsp;<span style="color: #FF0000; ">'my</span><span style="color: #FF0000; ">password</span><span style="color: #FF0000; ">'</span>;&nbsp;<font color="#0000ff">
</font></div>
</pre>
<div>
<pre style="line-height: normal; word-wrap: break-word; white-space: pre-wrap; "><span style="color: #008000; "># 4) grant all privileges for this user <br /></span>
<div style="background-color:#eeeeee;font-size:13px;border:1px solid #CCCCCC;padding-right: 5px;padding-bottom: 4px;padding-left: 4px;padding-top: 4px;width: 98%;word-break:break-all"><!--<br />
<br />
Code highlighting produced by Actipro CodeHighlighter (freeware)<br />
http://www.CodeHighlighter.com/<br />
<br />
--><span style="color: #0000FF; ">GRANT</span>&nbsp;<span style="color: #808080; ">ALL</span>&nbsp;<span style="color: #0000FF; ">PRIVILEGES</span>&nbsp;<span style="color: #0000FF; ">ON</span>&nbsp;<span style="color: #808080; ">*</span>.<span style="color: #808080; ">*</span>&nbsp;<span style="color: #0000FF; ">TO</span>&nbsp;<span style="color: #FF0000; ">'</span><span style="color: #FF0000; ">user1</span><span style="color: #FF0000; ">'</span>@<span style="color: #FF0000; ">'</span><span style="color: #FF0000; ">localhost</span><span style="color: #FF0000; ">'</span>&nbsp;IDENTIFIED&nbsp;<span style="color: #0000FF; ">BY</span>&nbsp;<span style="color: #FF0000; ">'</span><span style="color: #ff0000; ">my</span><span style="color: #ff0000; ">password</span><span style="color: #FF0000; ">'</span>;&nbsp;<br />FLUSH&nbsp;<span style="color: #0000ff; ">PRIVILEGES</span>;</div><br /><pre style="word-wrap: break-word; white-space: pre-wrap; "><span style="color: #008000; "># 5) create a database with char set utf-8<br /><br /></span><div style="background-color:#eeeeee;font-size:13px;border:1px solid #CCCCCC;padding-right: 5px;padding-bottom: 4px;padding-left: 4px;padding-top: 4px;width: 98%;word-break:break-all"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><span style="color: #0000FF; ">create</span>&nbsp;<span style="color: #0000FF; ">database</span>&nbsp;mydatabase&nbsp;<span style="font-weight: bold; ">character</span>&nbsp;<span style="color: #0000FF; ">set</span>&nbsp;utf8;<br /><span style="color: #0000FF; ">set</span>&nbsp;character_set_client<span style="color: #808080; ">=</span>utf8;<br /><span style="color: #0000FF; ">set</span>&nbsp;character_set_connection<span style="color: #808080; ">=</span>utf8;<br /><span style="color: #0000FF; ">set</span>&nbsp;character_set_database<span style="color: #808080; ">=</span>utf8;<br /><span style="color: #0000FF; ">set</span>&nbsp;character_set_results<span style="color: #808080; ">=</span>utf8;<br /><span style="color: #0000FF; ">set</span>&nbsp;character_set_server<span style="color: #808080; ">=</span>utf8;</div><span style="color: #008000; "><br /><br /></span><pre style="word-wrap: break-word; white-space: pre-wrap; "><span style="color: #008000; "># 6) switch to a database<br /></span></pre><div style="background-color:#eeeeee;font-size:13px;border:1px solid #CCCCCC;padding-right: 5px;padding-bottom: 4px;padding-left: 4px;padding-top: 4px;width: 98%;word-break:break-all"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><span style="color: #0000FF; ">use</span>&nbsp;mydatabase;<br />show&nbsp;tables;</div><pre style="word-wrap: break-word; white-space: pre-wrap; "><span style="color: #008000; "><br /># 7) Sample JDBC connection URL<br /></span><br /><div style="background-color:#eeeeee;font-size:13px;border:1px solid #CCCCCC;padding-right: 5px;padding-bottom: 4px;padding-left: 4px;padding-top: 4px;width: 98%;word-break:break-all"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />-->jdbc:mysql:<span style="color: #808080; ">//</span>localhost:<span style="color: #800000; font-weight: bold; ">3306</span><span style="color: #808080; ">/</span>mydatabase?useUnicode<span style="color: #808080; ">=</span>true<span style="color: #808080; ">&amp;</span>characterEncoding<span style="color: #808080; ">=</span>utf<span style="color: #808080; ">-</span><span style="color: #800000; font-weight: bold; ">8</span><span style="color: #808080; ">&amp;</span>autoReconnect<span style="color: #808080; ">=</span>true<span style="color: #808080; ">&amp;</span>failOverReadOnly<span style="color: #808080; ">=</span>false</div><span style="color: #008000; "><br /></span></pre><span style="color: #008000; "><br /></span></pre></pre>
</div><img src ="http://www.blogjava.net/gembin/aggbug/378747.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/gembin/" target="_blank">gembin</a> 2012-05-22 00:25 <a href="http://www.blogjava.net/gembin/archive/2012/05/22/378747.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Spring AOP: JDK Dynamic Proxy vs. CGLib proxy</title><link>http://www.blogjava.net/gembin/archive/2012/05/03/377268.html</link><dc:creator>gembin</dc:creator><author>gembin</author><pubDate>Thu, 03 May 2012 05:16:00 GMT</pubDate><guid>http://www.blogjava.net/gembin/archive/2012/05/03/377268.html</guid><wfw:comment>http://www.blogjava.net/gembin/comments/377268.html</wfw:comment><comments>http://www.blogjava.net/gembin/archive/2012/05/03/377268.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/gembin/comments/commentRss/377268.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/gembin/services/trackbacks/377268.html</trackback:ping><description><![CDATA[<font color="#92a1d6" face="Arial, Tahoma, Helvetica, FreeSans, sans-serif" size="2"><span style="line-height: 18px; background-color: #ffffff;">Spring's AOP</span></font><span style="font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px; background-color: #ffffff; ">&nbsp;is proxy-based. Spring provides&nbsp;</span><font color="#92a1d6" face="Arial, Tahoma, Helvetica, FreeSans, sans-serif" size="2"><span style="line-height: 18px; background-color: #ffffff;">two different options</span></font><span style="font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px; background-color: #ffffff; ">&nbsp;to create the proxies. One is based on JDK dynamic proxies and works with interfaces, the other one utilizes CGLib and is based on classes. (That's why the property is called&nbsp;</span><span style="font-size: 13px; line-height: 18px; background-color: #ffffff; font-family: monospace; ">proxyTargetClass</span><span style="font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px; background-color: #ffffff; ">&nbsp;respectively&nbsp;</span><span style="font-size: 13px; line-height: 18px; background-color: #ffffff; font-family: monospace; ">proxy-target-class</span><span style="font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px; background-color: #ffffff; ">.) For the moment I just want to provide a quick summary on the pros and cons of both options:</span><br style="font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px; background-color: #ffffff; " /><br style="font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px; background-color: #ffffff; " /><span style="font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px; background-color: #ffffff; ">JDK dynamic proxies:</span><br style="font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px; background-color: #ffffff; " /><ul style="padding-top: 0px; padding-right: 2.5em; padding-bottom: 0px; padding-left: 2.5em; margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; line-height: 18px; list-style-position: initial; list-style-image: initial; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; background-color: #ffffff; "><br /><li style="padding-top: 0.25em; padding-right: 0px; padding-bottom: 0.25em; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0.25em; margin-left: 0px; border-top-style: none; border-bottom-style: none; border-right-style: none; border-left-style: none; border-width: initial; border-color: initial; border-image: initial; ">The class&nbsp;<span style="font-style: italic; font-weight: bold; ">has</span>&nbsp;to implement interfaces. Otherwise you will get ClassCastExceptions saying that $Proxy0 can not be casted to the particular class.</li><br /><li style="padding-top: 0.25em; padding-right: 0px; padding-bottom: 0.25em; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0.25em; margin-left: 0px; border-top-style: none; border-bottom-style: none; border-right-style: none; border-left-style: none; border-width: initial; border-color: initial; border-image: initial; ">Eventually dynamic proxies force you to program to interfaces since you can not cast the proxy to the class - a feature I&nbsp;<span style="font-style: italic; font-weight: bold; ">really</span>&nbsp;like about them.</li><br /></ul><br style="font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px; background-color: #ffffff; " /><span style="font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px; background-color: #ffffff; ">CGLib proxies:</span><br style="font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px; background-color: #ffffff; " /><ul style="padding-top: 0px; padding-right: 2.5em; padding-bottom: 0px; padding-left: 2.5em; margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; line-height: 18px; list-style-position: initial; list-style-image: initial; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; background-color: #ffffff; "><br /><li style="padding-top: 0.25em; padding-right: 0px; padding-bottom: 0.25em; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0.25em; margin-left: 0px; border-top-style: none; border-bottom-style: none; border-right-style: none; border-left-style: none; border-width: initial; border-color: initial; border-image: initial; ">The proxies are created by sub-classing the actual class. This means wherever an instance of the class is used it is also possible to use the CGLib proxy.</li><br /><li style="padding-top: 0.25em; padding-right: 0px; padding-bottom: 0.25em; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0.25em; margin-left: 0px; border-top-style: none; border-bottom-style: none; border-right-style: none; border-left-style: none; border-width: initial; border-color: initial; border-image: initial; ">The class needs to provide a default constructor, i.e. without any arguments. Otherwise you'll get an IllegalArgumentException: "Superclass has no null constructors but no arguments were given." This makes constructor injection impossible.</li><br /><li style="padding-top: 0.25em; padding-right: 0px; padding-bottom: 0.25em; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0.25em; margin-left: 0px; border-top-style: none; border-bottom-style: none; border-right-style: none; border-left-style: none; border-width: initial; border-color: initial; border-image: initial; ">The proxying does not work with final methods since the proxy sub class can not override the class' implementation.</li><br /><li style="padding-top: 0.25em; padding-right: 0px; padding-bottom: 0.25em; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0.25em; margin-left: 0px; border-top-style: none; border-bottom-style: none; border-right-style: none; border-left-style: none; border-width: initial; border-color: initial; border-image: initial; ">The CGLib proxy is final, so proxying a proxy does not work. You will get an IllegalArgumentException saying "Cannot subclass final class $Proxy0". But this feature is usually not needed anyway.&nbsp;</li><br /><li style="padding-top: 0.25em; padding-right: 0px; padding-bottom: 0.25em; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0.25em; margin-left: 0px; border-top-style: none; border-bottom-style: none; border-right-style: none; border-left-style: none; border-width: initial; border-color: initial; border-image: initial; ">Since two objects are created (the instance of the class and the proxy as instance of a sub class) the constructor is called twice. In general this should not matter. I consider changing the class' state based on constructor calls a code smell anyway.</li><br /><li style="padding-top: 0.25em; padding-right: 0px; padding-bottom: 0.25em; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0.25em; margin-left: 0px; border-top-style: none; border-bottom-style: none; border-right-style: none; border-left-style: none; border-width: initial; border-color: initial; border-image: initial; ">You have CGLib as additional dependency.<br /><br />ref: &nbsp;<a href="http://static.springsource.org/spring/docs/3.1.1.RELEASE/spring-framework-reference/htmlsingle/spring-framework-reference.html#aop-introduction-proxies">http://static.springsource.org/spring/docs/3.1.1.RELEASE/spring-framework-reference/htmlsingle/spring-framework-reference.html#aop-introduction-proxies</a>&nbsp;<br /><br /><br /></li></ul><img src ="http://www.blogjava.net/gembin/aggbug/377268.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/gembin/" target="_blank">gembin</a> 2012-05-03 13:16 <a href="http://www.blogjava.net/gembin/archive/2012/05/03/377268.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Deep Copy And Shallow Copy</title><link>http://www.blogjava.net/gembin/archive/2012/04/07/373545.html</link><dc:creator>gembin</dc:creator><author>gembin</author><pubDate>Sat, 07 Apr 2012 10:41:00 GMT</pubDate><guid>http://www.blogjava.net/gembin/archive/2012/04/07/373545.html</guid><wfw:comment>http://www.blogjava.net/gembin/comments/373545.html</wfw:comment><comments>http://www.blogjava.net/gembin/archive/2012/04/07/373545.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/gembin/comments/commentRss/373545.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/gembin/services/trackbacks/373545.html</trackback:ping><description><![CDATA[<p style="margin-top: 10px; margin-right: 10px; margin-bottom: 10px; margin-left: 10px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; font-family: Verdana, sans-serif; font-size: 12px; line-height: 19px; background-color: #ffffff; ">Lets first separate it out and see what each one means.</p>
<p style="margin-top: 10px; margin-right: 10px; margin-bottom: 10px; margin-left: 10px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; font-family: Verdana, sans-serif; font-size: 12px; line-height: 19px; background-color: #ffffff; "></p>
<p style="margin-top: 10px; margin-right: 10px; margin-bottom: 10px; margin-left: 10px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; font-family: Verdana, sans-serif; font-size: 12px; line-height: 19px; background-color: #ffffff; "><u style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; "><em style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; ">What is Shallow Copy?</em></u></p>
<p style="margin-top: 10px; margin-right: 10px; margin-bottom: 10px; margin-left: 10px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; font-family: Verdana, sans-serif; font-size: 12px; line-height: 19px; background-color: #ffffff; ">Shallow copy is a bit-wise copy of an object. A new object is created that has an exact copy of the values in the original object. If any of the fields of the object are references to other objects, just the reference addresses are copied i.e., only the memory address is copied.</p>
<img src="http://www.jusfortechies.com/images/core-java/shallow_copy.png" alt="Shallow Copy" align="middle" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 8px; padding-right: 8px; padding-bottom: 8px; padding-left: 8px; outline-width: 0px; outline-style: initial; outline-color: initial; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #fafafa; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #dcdcdc; border-right-color: #dcdcdc; border-bottom-color: #dcdcdc; border-left-color: #dcdcdc; border-image: initial; font-family: Verdana, sans-serif; font-size: 12px; line-height: 19px; " />
<p style="margin-top: 10px; margin-right: 10px; margin-bottom: 10px; margin-left: 10px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; font-family: Verdana, sans-serif; font-size: 12px; line-height: 19px; background-color: #ffffff; ">In this figure, the MainObject1 have fields "field1" of int type, and "ContainObject1" of ContainObject type. When you do a shallow copy of MainObject1, MainObject2 is created with "field3" containing the copied value of "field1" and still pointing to ContainObject1 itself. Observe here and you will find that since field1 is of primitive type, the values of it are copied to field3 but ContainedObject1 is an object, so MainObject2 is still pointing to ContainObject1. So any changes made to ContainObject1 in MainObject1 will reflect in MainObject2.</p>
<p style="margin-top: 10px; margin-right: 10px; margin-bottom: 10px; margin-left: 10px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; font-family: Verdana, sans-serif; font-size: 12px; line-height: 19px; background-color: #ffffff; ">Now if this is shallow copy, lets see what's deep copy?</p>
<p style="margin-top: 10px; margin-right: 10px; margin-bottom: 10px; margin-left: 10px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; font-family: Verdana, sans-serif; font-size: 12px; line-height: 19px; background-color: #ffffff; "><u style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; "><em style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; ">What is Deep Copy?</em></u></p>
<p style="margin-top: 10px; margin-right: 10px; margin-bottom: 10px; margin-left: 10px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; font-family: Verdana, sans-serif; font-size: 12px; line-height: 19px; background-color: #ffffff; ">A deep copy copies all fields, and makes copies of dynamically allocated memory pointed to by the fields. A deep copy occurs when an object is copied along with the objects to which it refers.</p>
<img src="http://www.jusfortechies.com/images/core-java/deep_copy.png" alt="Deep Copy" align="middle" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 8px; padding-right: 8px; padding-bottom: 8px; padding-left: 8px; outline-width: 0px; outline-style: initial; outline-color: initial; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #fafafa; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #dcdcdc; border-right-color: #dcdcdc; border-bottom-color: #dcdcdc; border-left-color: #dcdcdc; border-image: initial; font-family: Verdana, sans-serif; font-size: 12px; line-height: 19px; " />
<p style="margin-top: 10px; margin-right: 10px; margin-bottom: 10px; margin-left: 10px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; font-family: Verdana, sans-serif; font-size: 12px; line-height: 19px; background-color: #ffffff; ">In this figure, the MainObject1 have fields "field1" of int type, and "ContainObject1" of ContainObject type. When you do a deep copy of MainObject1, MainObject2 is created with "field3" containing the copied value of "field1" and "ContainObject2" containing the copied value of ContainObject1.So any changes made to ContainObject1 in MainObject1 will not reflect in MainObject2.<br />
</p>
<p style="margin-top: 10px; margin-right: 10px; margin-bottom: 10px; margin-left: 10px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; ">Well, here we are with what shallow copy and deep copy are and obviously the difference between them. Now lets see how to implement them in java.</p>
<p style="margin-top: 10px; margin-right: 10px; margin-bottom: 10px; margin-left: 10px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; "><u style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; "><em style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; ">How to implement shallow copy in java?</em></u></p>
<p style="margin-top: 10px; margin-right: 10px; margin-bottom: 10px; margin-left: 10px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; ">Here is an example of Shallow Copy implementation<br />
</p>
<div style="background-color:#eeeeee;font-size:13px;border:1px solid #CCCCCC;padding-right: 5px;padding-bottom: 4px;padding-left: 4px;padding-top: 4px;width: 98%;word-break:break-all"><!--<br />
<br />
Code highlighting produced by Actipro CodeHighlighter (freeware)<br />
http://www.CodeHighlighter.com/<br />
<br />
--><span style="color: #008080; ">&nbsp;1</span>&nbsp;<span style="color: #0000FF; ">class</span>&nbsp;Subject&nbsp;{<br />
<span style="color: #008080; ">&nbsp;2</span>&nbsp;<br />
<span style="color: #008080; ">&nbsp;3</span>&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">private</span>&nbsp;String&nbsp;name;<br />
<span style="color: #008080; ">&nbsp;4</span>&nbsp;<br />
<span style="color: #008080; ">&nbsp;5</span>&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">public</span>&nbsp;String&nbsp;getName()&nbsp;{<br />
<span style="color: #008080; ">&nbsp;6</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">return</span>&nbsp;name;<br />
<span style="color: #008080; ">&nbsp;7</span>&nbsp;&nbsp;&nbsp;}<br />
<span style="color: #008080; ">&nbsp;8</span>&nbsp;<br />
<span style="color: #008080; ">&nbsp;9</span>&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">public</span>&nbsp;<span style="color: #0000FF; ">void</span>&nbsp;setName(String&nbsp;s)&nbsp;{<br />
<span style="color: #008080; ">10</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;name&nbsp;=&nbsp;s;<br />
<span style="color: #008080; ">11</span>&nbsp;&nbsp;&nbsp;}<br />
<span style="color: #008080; ">12</span>&nbsp;<br />
<span style="color: #008080; ">13</span>&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">public</span>&nbsp;Subject(String&nbsp;s)&nbsp;{<br />
<span style="color: #008080; ">14</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;name&nbsp;=&nbsp;s;<br />
<span style="color: #008080; ">15</span>&nbsp;&nbsp;&nbsp;}<br />
<span style="color: #008080; ">16</span>&nbsp;}<br />
<span style="color: #008080; ">17</span>&nbsp;<br />
<span style="color: #008080; ">18</span>&nbsp;<span style="color: #0000FF; ">class</span>&nbsp;Student&nbsp;<span style="color: #0000FF; ">implements</span>&nbsp;Cloneable&nbsp;{<br />
<span style="color: #008080; ">19</span>&nbsp;&nbsp;&nbsp;<span style="color: #008000; ">//</span><span style="color: #008000; ">Contained&nbsp;object</span><span style="color: #008000; "><br />
</span><span style="color: #008080; ">20</span>&nbsp;<span style="color: #008000; "></span>&nbsp;&nbsp;<span style="color: #0000FF; ">private</span>&nbsp;Subject&nbsp;subj;<br />
<span style="color: #008080; ">21</span>&nbsp;<br />
<span style="color: #008080; ">22</span>&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">private</span>&nbsp;String&nbsp;name;<br />
<span style="color: #008080; ">23</span>&nbsp;<br />
<span style="color: #008080; ">24</span>&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">public</span>&nbsp;Subject&nbsp;getSubj()&nbsp;{<br />
<span style="color: #008080; ">25</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">return</span>&nbsp;subj;<br />
<span style="color: #008080; ">26</span>&nbsp;&nbsp;&nbsp;}<br />
<span style="color: #008080; ">27</span>&nbsp;<br />
<span style="color: #008080; ">28</span>&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">public</span>&nbsp;String&nbsp;getName()&nbsp;{<br />
<span style="color: #008080; ">29</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">return</span>&nbsp;name;<br />
<span style="color: #008080; ">30</span>&nbsp;&nbsp;&nbsp;}<br />
<span style="color: #008080; ">31</span>&nbsp;<br />
<span style="color: #008080; ">32</span>&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">public</span>&nbsp;<span style="color: #0000FF; ">void</span>&nbsp;setName(String&nbsp;s)&nbsp;{<br />
<span style="color: #008080; ">33</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;name&nbsp;=&nbsp;s;<br />
<span style="color: #008080; ">34</span>&nbsp;&nbsp;&nbsp;}<br />
<span style="color: #008080; ">35</span>&nbsp;<br />
<span style="color: #008080; ">36</span>&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">public</span>&nbsp;Person(String&nbsp;s,&nbsp;String&nbsp;sub)&nbsp;{<br />
<span style="color: #008080; ">37</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;name&nbsp;=&nbsp;s;<br />
<span style="color: #008080; ">38</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;subj&nbsp;=&nbsp;<span style="color: #0000FF; ">new</span>&nbsp;Subject(sub);<br />
<span style="color: #008080; ">39</span>&nbsp;&nbsp;&nbsp;}<br />
<span style="color: #008080; ">40</span>&nbsp;<br />
<span style="color: #008080; ">41</span>&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">public</span>&nbsp;Object&nbsp;clone()&nbsp;{<br />
<span style="color: #008080; ">42</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #008000; ">//</span><span style="color: #008000; ">shallow&nbsp;copy</span><span style="color: #008000; "><br />
</span><span style="color: #008080; ">43</span>&nbsp;<span style="color: #008000; "></span>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">try</span>&nbsp;{<br />
<span style="color: #008080; ">44</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">return</span>&nbsp;<span style="color: #0000FF; ">super</span>.clone();<br />
<span style="color: #008080; ">45</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;<span style="color: #0000FF; ">catch</span>&nbsp;(CloneNotSupportedException&nbsp;e)&nbsp;{<br />
<span style="color: #008080; ">46</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">return</span>&nbsp;<span style="color: #0000FF; ">null</span>;<br />
<span style="color: #008080; ">47</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
<span style="color: #008080; ">48</span>&nbsp;&nbsp;&nbsp;}<br />
<span style="color: #008080; ">49</span>&nbsp;}<br />
<span style="color: #008080; ">50</span>&nbsp;<br />
<span style="color: #008080; ">51</span>&nbsp;<span style="color: #0000FF; ">public</span>&nbsp;<span style="color: #0000FF; ">class</span>&nbsp;CopyTest&nbsp;{<br />
<span style="color: #008080; ">52</span>&nbsp;<br />
<span style="color: #008080; ">53</span>&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">public</span>&nbsp;<span style="color: #0000FF; ">static</span>&nbsp;<span style="color: #0000FF; ">void</span>&nbsp;main(String[]&nbsp;args)&nbsp;{<br />
<span style="color: #008080; ">54</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #008000; ">//</span><span style="color: #008000; ">Original&nbsp;Object</span><span style="color: #008000; "><br />
</span><span style="color: #008080; ">55</span>&nbsp;<span style="color: #008000; "></span>&nbsp;&nbsp;&nbsp;&nbsp;Student&nbsp;stud&nbsp;=&nbsp;<span style="color: #0000FF; ">new</span>&nbsp;Student("John",&nbsp;"Algebra");<br />
<span style="color: #008080; ">56</span>&nbsp;<br />
<span style="color: #008080; ">57</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;System.out.println("Original&nbsp;Object:&nbsp;"&nbsp;+&nbsp;stud.getName()&nbsp;+&nbsp;"&nbsp;-&nbsp;"<br />
<span style="color: #008080; ">58</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;+&nbsp;stud.getSubject().getName());<br />
<span style="color: #008080; ">59</span>&nbsp;<br />
<span style="color: #008080; ">60</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #008000; ">//</span><span style="color: #008000; ">Clone&nbsp;Object</span><span style="color: #008000; "><br />
</span><span style="color: #008080; ">61</span>&nbsp;<span style="color: #008000; "></span>&nbsp;&nbsp;&nbsp;&nbsp;Student&nbsp;clonedStud&nbsp;=&nbsp;(Student)&nbsp;stud.clone();<br />
<span style="color: #008080; ">62</span>&nbsp;<br />
<span style="color: #008080; ">63</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;System.out.println("Cloned&nbsp;Object:&nbsp;"&nbsp;+&nbsp;clonedStud.getName()&nbsp;+&nbsp;"&nbsp;-&nbsp;"<br />
<span style="color: #008080; ">64</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;+&nbsp;clonedStud.getSubject().getName());<br />
<span style="color: #008080; ">65</span>&nbsp;<br />
<span style="color: #008080; ">66</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;stud.setStudentName("Dan");<br />
<span style="color: #008080; ">67</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;stud.getSubject().setSubjectName("Physics");<br />
<span style="color: #008080; ">68</span>&nbsp;<br />
<span style="color: #008080; ">69</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;System.out.println("Original&nbsp;Object&nbsp;after&nbsp;it&nbsp;is&nbsp;updated:&nbsp;"&nbsp;<br />
<span style="color: #008080; ">70</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;+&nbsp;stud.getName()&nbsp;+&nbsp;"&nbsp;-&nbsp;"&nbsp;+&nbsp;stud.getStudent().getName());<br />
<span style="color: #008080; ">71</span>&nbsp;<br />
<span style="color: #008080; ">72</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;System.out.println("Cloned&nbsp;Object&nbsp;after&nbsp;updating&nbsp;original&nbsp;object:&nbsp;"<br />
<span style="color: #008080; ">73</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;+&nbsp;clonedStud.getName()&nbsp;+&nbsp;"&nbsp;-&nbsp;"&nbsp;+&nbsp;clonedStud.getSubject().getName());<br />
<span style="color: #008080; ">74</span>&nbsp;<br />
<span style="color: #008080; ">75</span>&nbsp;&nbsp;&nbsp;}<br />
<span style="color: #008080; ">76</span>&nbsp;}<br />
<font color="#008080"><br />
</font>Output&nbsp;is:<br />
Original&nbsp;Object:&nbsp;John&nbsp;-&nbsp;Algebra<br />
Cloned&nbsp;Object:&nbsp;John&nbsp;-&nbsp;Algebra<br />
Original&nbsp;Object&nbsp;after&nbsp;it&nbsp;is&nbsp;updated:&nbsp;Dan&nbsp;-&nbsp;Physics<br />
Cloned&nbsp;Object&nbsp;after&nbsp;updating&nbsp;original&nbsp;object:&nbsp;John&nbsp;-&nbsp;Physics</div>
<br />
In this example, all I did is, implement the class that you want to copy with Clonable interface and override clone() method of Object class and call super.clone() in it. If you observe, the changes made to "name" field of original object (Student class) is not reflected in cloned object but the changes made to "name" field of contained object (Subject class) is reflected in cloned object. This is because the cloned object carries the memory address of the Subject object but not the actual values. Hence any updates on the Subject object in Original object will reflect in Cloned object.
<p>&nbsp;</p>
<p style="margin-top: 10px; margin-right: 10px; margin-bottom: 10px; margin-left: 10px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; "><u style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; "><em style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; ">How to implement deep copy in java?</em></u></p>
<p style="margin-top: 10px; margin-right: 10px; margin-bottom: 10px; margin-left: 10px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; ">Here is an example of Deep Copy implementation. This is the same example of Shallow Copy implementation and hence I didnt write the Subject and CopyTest classes as there is no change in them.<br />
</p>
<div style="background-color:#eeeeee;font-size:13px;border:1px solid #CCCCCC;padding-right: 5px;padding-bottom: 4px;padding-left: 4px;padding-top: 4px;width: 98%;word-break:break-all"><!--<br />
<br />
Code highlighting produced by Actipro CodeHighlighter (freeware)<br />
http://www.CodeHighlighter.com/<br />
<br />
--><span style="color: #008080; ">&nbsp;1</span>&nbsp;<span style="color: #0000FF; ">class</span>&nbsp;Student&nbsp;<span style="color: #0000FF; ">implements</span>&nbsp;Cloneable&nbsp;{<br />
<span style="color: #008080; ">&nbsp;2</span>&nbsp;&nbsp;&nbsp;<span style="color: #008000; ">//</span><span style="color: #008000; ">Contained&nbsp;object</span><span style="color: #008000; "><br />
</span><span style="color: #008080; ">&nbsp;3</span>&nbsp;<span style="color: #008000; "></span>&nbsp;&nbsp;<span style="color: #0000FF; ">private</span>&nbsp;Subject&nbsp;subj;<br />
<span style="color: #008080; ">&nbsp;4</span>&nbsp;<br />
<span style="color: #008080; ">&nbsp;5</span>&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">private</span>&nbsp;String&nbsp;name;<br />
<span style="color: #008080; ">&nbsp;6</span>&nbsp;<br />
<span style="color: #008080; ">&nbsp;7</span>&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">public</span>&nbsp;Subject&nbsp;getSubj()&nbsp;{<br />
<span style="color: #008080; ">&nbsp;8</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">return</span>&nbsp;subj;<br />
<span style="color: #008080; ">&nbsp;9</span>&nbsp;&nbsp;&nbsp;}<br />
<span style="color: #008080; ">10</span>&nbsp;<br />
<span style="color: #008080; ">11</span>&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">public</span>&nbsp;String&nbsp;getName()&nbsp;{<br />
<span style="color: #008080; ">12</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">return</span>&nbsp;name;<br />
<span style="color: #008080; ">13</span>&nbsp;&nbsp;&nbsp;}<br />
<span style="color: #008080; ">14</span>&nbsp;<br />
<span style="color: #008080; ">15</span>&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">public</span>&nbsp;<span style="color: #0000FF; ">void</span>&nbsp;setName(String&nbsp;s)&nbsp;{<br />
<span style="color: #008080; ">16</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;name&nbsp;=&nbsp;s;<br />
<span style="color: #008080; ">17</span>&nbsp;&nbsp;&nbsp;}<br />
<span style="color: #008080; ">18</span>&nbsp;<br />
<span style="color: #008080; ">19</span>&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">public</span>&nbsp;Person(String&nbsp;s,&nbsp;String&nbsp;sub)&nbsp;{<br />
<span style="color: #008080; ">20</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;name&nbsp;=&nbsp;s;<br />
<span style="color: #008080; ">21</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;subj&nbsp;=&nbsp;<span style="color: #0000FF; ">new</span>&nbsp;Subject(sub);<br />
<span style="color: #008080; ">22</span>&nbsp;&nbsp;&nbsp;}<br />
<span style="color: #008080; ">23</span>&nbsp;<br />
<span style="color: #008080; ">24</span>&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">public</span>&nbsp;Object&nbsp;clone()&nbsp;{<br />
<span style="color: #008080; ">25</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #008000; ">//</span><span style="color: #008000; ">deep&nbsp;copy</span><span style="color: #008000; "><br />
</span><span style="color: #008080; ">26</span>&nbsp;<span style="color: #008000; "></span>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">try</span>&nbsp;{<br />
<span style="color: #008080; ">27</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #008000; ">//</span><span style="color: #008000; ">Deep&nbsp;copy</span><span style="color: #008000; "><br />
</span><span style="color: #008080; ">28</span>&nbsp;<span style="color: #008000; "></span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Student&nbsp;s&nbsp;=&nbsp;<span style="color: #0000FF; ">new</span>&nbsp;Student(name,&nbsp;subj.getName());<br />
<span style="color: #008080; ">29</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">return</span>&nbsp;s;<br />
<span style="color: #008080; ">30</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;<span style="color: #0000FF; ">catch</span>&nbsp;(CloneNotSupportedException&nbsp;e)&nbsp;{<br />
<span style="color: #008080; ">31</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">return</span>&nbsp;<span style="color: #0000FF; ">null</span>;<br />
<span style="color: #008080; ">32</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
<span style="color: #008080; ">33</span>&nbsp;&nbsp;&nbsp;}<br />
<span style="color: #008080; ">34</span>&nbsp;}<br />
&nbsp;<br />
&nbsp;Output&nbsp;is:<br />
&nbsp;Original&nbsp;Object:&nbsp;John&nbsp;-&nbsp;Algebra<br />
&nbsp;Cloned&nbsp;Object:&nbsp;John&nbsp;-&nbsp;Algebra<br />
&nbsp;Original&nbsp;Object&nbsp;after&nbsp;it&nbsp;is&nbsp;updated:&nbsp;Dan&nbsp;-&nbsp;Physics<br />
&nbsp;Cloned&nbsp;Object&nbsp;after&nbsp;updating&nbsp;original&nbsp;object:&nbsp;Dan&nbsp;-&nbsp;Physics</div>
<p>&nbsp;</p>
<p style="margin-top: 10px; margin-right: 10px; margin-bottom: 10px; margin-left: 10px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; ">Well, if you observe here in the "Student" class, you will see only the change in the "clone()" method. Since its a deep copy, you need to create an object of the cloned class. Well if you have have references in the Subject class, then you need to implement Cloneable interface in Subject class and override clone method in it and this goes on and on.</p>
<p style="margin-top: 10px; margin-right: 10px; margin-bottom: 10px; margin-left: 10px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; "><u style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; "><em style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; ">There is an alternative way for deep copy.</em></u></p>
<p style="margin-top: 10px; margin-right: 10px; margin-bottom: 10px; margin-left: 10px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; ">Yes, there is. You can do deep copy through&nbsp;serialization. What does serialization do? It writes out the whole object graph into a persistant store and read it back when needed, which means you will get a copy of the whole object graph whne you read it back. This is exactly what you want when you deep copy an object. Note, when you deep copy through serialization, you should make sure that all classes in the object's graph are serializable. Let me explain you this alternative way with an example.<br />
</p>
<div style="background-color:#eeeeee;font-size:13px;border:1px solid #CCCCCC;padding-right: 5px;padding-bottom: 4px;padding-left: 4px;padding-top: 4px;width: 98%;word-break:break-all"><!--<br />
<br />
Code highlighting produced by Actipro CodeHighlighter (freeware)<br />
http://www.CodeHighlighter.com/<br />
<br />
--><span style="color: #008080; ">&nbsp;1</span>&nbsp;<span style="color: #0000FF; ">public</span>&nbsp;<span style="color: #0000FF; ">class</span>&nbsp;ColoredCircle&nbsp;<span style="color: #0000FF; ">implements</span>&nbsp;Serializable<br />
<span style="color: #008080; ">&nbsp;2</span>&nbsp;{<br />
<span style="color: #008080; ">&nbsp;3</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">private</span>&nbsp;<span style="color: #0000FF; ">int</span>&nbsp;x;<br />
<span style="color: #008080; ">&nbsp;4</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">private</span>&nbsp;<span style="color: #0000FF; ">int</span>&nbsp;y;<br />
<span style="color: #008080; ">&nbsp;5</span>&nbsp;<br />
<span style="color: #008080; ">&nbsp;6</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">public</span>&nbsp;ColoredCircle(<span style="color: #0000FF; ">int</span>&nbsp;x,&nbsp;<span style="color: #0000FF; ">int</span>&nbsp;y){<br />
<span style="color: #008080; ">&nbsp;7</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">this</span>.x&nbsp;=&nbsp;x;<br />
<span style="color: #008080; ">&nbsp;8</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">this</span>.y&nbsp;=&nbsp;y;<br />
<span style="color: #008080; ">&nbsp;9</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
<span style="color: #008080; ">10</span>&nbsp;<br />
<span style="color: #008080; ">11</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">public</span>&nbsp;<span style="color: #0000FF; ">int</span>&nbsp;getX(){<br />
<span style="color: #008080; ">12</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">return</span>&nbsp;x;<br />
<span style="color: #008080; ">13</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
<span style="color: #008080; ">14</span>&nbsp;<br />
<span style="color: #008080; ">15</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">public</span>&nbsp;<span style="color: #0000FF; ">void</span>&nbsp;setX(<span style="color: #0000FF; ">int</span>&nbsp;x){<br />
<span style="color: #008080; ">16</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">this</span>.x&nbsp;=&nbsp;x;<br />
<span style="color: #008080; ">17</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
<span style="color: #008080; ">18</span>&nbsp;<br />
<span style="color: #008080; ">19</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">public</span>&nbsp;<span style="color: #0000FF; ">int</span>&nbsp;getY(){<br />
<span style="color: #008080; ">20</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">return</span>&nbsp;y;<br />
<span style="color: #008080; ">21</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
<span style="color: #008080; ">22</span>&nbsp;<br />
<span style="color: #008080; ">23</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">public</span>&nbsp;<span style="color: #0000FF; ">void</span>&nbsp;setX(<span style="color: #0000FF; ">int</span>&nbsp;x){<br />
<span style="color: #008080; ">24</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">this</span>.x&nbsp;=&nbsp;x;<br />
<span style="color: #008080; ">25</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
<span style="color: #008080; ">26</span>&nbsp;}<br />
<span style="color: #008080; ">27</span>&nbsp;<br />
<span style="color: #008080; ">28</span>&nbsp;<span style="color: #0000FF; ">public</span>&nbsp;<span style="color: #0000FF; ">class</span>&nbsp;DeepCopy<br />
<span style="color: #008080; ">29</span>&nbsp;{<br />
<span style="color: #008080; ">30</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">static</span>&nbsp;<span style="color: #0000FF; ">public</span>&nbsp;<span style="color: #0000FF; ">void</span>&nbsp;main(String[]&nbsp;args)<br />
<span style="color: #008080; ">31</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />
<span style="color: #008080; ">32</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ObjectOutputStream&nbsp;oos&nbsp;=&nbsp;<span style="color: #0000FF; ">null</span>;<br />
<span style="color: #008080; ">33</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ObjectInputStream&nbsp;ois&nbsp;=&nbsp;<span style="color: #0000FF; ">null</span>;<br />
<span style="color: #008080; ">34</span>&nbsp;<br />
<span style="color: #008080; ">35</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">try</span><br />
<span style="color: #008080; ">36</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />
<span style="color: #008080; ">37</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #008000; ">//</span><span style="color: #008000; ">&nbsp;create&nbsp;original&nbsp;serializable&nbsp;object</span><span style="color: #008000; "><br />
</span><span style="color: #008080; ">38</span>&nbsp;<span style="color: #008000; "></span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ColoredCircle&nbsp;c1&nbsp;=&nbsp;<span style="color: #0000FF; ">new</span>&nbsp;ColoredCircle(100,100);<br />
<span style="color: #008080; ">39</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #008000; ">//</span><span style="color: #008000; ">&nbsp;print&nbsp;it</span><span style="color: #008000; "><br />
</span><span style="color: #008080; ">40</span>&nbsp;<span style="color: #008000; "></span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;System.out.println("Original&nbsp;=&nbsp;"&nbsp;+&nbsp;c1);<br />
<span style="color: #008080; ">41</span>&nbsp;<br />
<span style="color: #008080; ">42</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ColoredCircle&nbsp;c2&nbsp;=&nbsp;<span style="color: #0000FF; ">null</span>;<br />
<span style="color: #008080; ">43</span>&nbsp;<br />
<span style="color: #008080; ">44</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #008000; ">//</span><span style="color: #008000; ">&nbsp;deep&nbsp;copy</span><span style="color: #008000; "><br />
</span><span style="color: #008080; ">45</span>&nbsp;<span style="color: #008000; "></span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ByteArrayOutputStream&nbsp;bos&nbsp;=&nbsp;<span style="color: #0000FF; ">new</span>&nbsp;ByteArrayOutputStream();&nbsp;<br />
<span style="color: #008080; ">46</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;oos&nbsp;=&nbsp;<span style="color: #0000FF; ">new</span>&nbsp;ObjectOutputStream(bos);&nbsp;<br />
<span style="color: #008080; ">47</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #008000; ">//</span><span style="color: #008000; ">&nbsp;serialize&nbsp;and&nbsp;pass&nbsp;the&nbsp;object</span><span style="color: #008000; "><br />
</span><span style="color: #008080; ">48</span>&nbsp;<span style="color: #008000; "></span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;oos.writeObject(c1);&nbsp;&nbsp;&nbsp;<br />
<span style="color: #008080; ">49</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;oos.flush();&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
<span style="color: #008080; ">50</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ByteArrayInputStream&nbsp;bin&nbsp;=&nbsp;<br />
<span style="color: #008080; ">51</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">new</span>&nbsp;ByteArrayInputStream(bos.toByteArray());&nbsp;<br />
<span style="color: #008080; ">52</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ois&nbsp;=&nbsp;<span style="color: #0000FF; ">new</span>&nbsp;ObjectInputStream(bin);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
<span style="color: #008080; ">53</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #008000; ">//</span><span style="color: #008000; ">&nbsp;return&nbsp;the&nbsp;new&nbsp;object</span><span style="color: #008000; "><br />
</span><span style="color: #008080; ">54</span>&nbsp;<span style="color: #008000; "></span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;c2&nbsp;=&nbsp;ois.readObject();&nbsp;<br />
<span style="color: #008080; ">55</span>&nbsp;<br />
<span style="color: #008080; ">56</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #008000; ">//</span><span style="color: #008000; ">&nbsp;verify&nbsp;it&nbsp;is&nbsp;the&nbsp;same</span><span style="color: #008000; "><br />
</span><span style="color: #008080; ">57</span>&nbsp;<span style="color: #008000; "></span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;System.out.println("Copied&nbsp;&nbsp;&nbsp;=&nbsp;"&nbsp;+&nbsp;c2);<br />
<span style="color: #008080; ">58</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #008000; ">//</span><span style="color: #008000; ">&nbsp;change&nbsp;the&nbsp;original&nbsp;object's&nbsp;contents</span><span style="color: #008000; "><br />
</span><span style="color: #008080; ">59</span>&nbsp;<span style="color: #008000; "></span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;c1.setX(200);<br />
<span style="color: #008080; ">60</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;c1.setY(200);<br />
<span style="color: #008080; ">61</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #008000; ">//</span><span style="color: #008000; ">&nbsp;see&nbsp;what&nbsp;is&nbsp;in&nbsp;each&nbsp;one&nbsp;now</span><span style="color: #008000; "><br />
</span><span style="color: #008080; ">62</span>&nbsp;<span style="color: #008000; "></span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;System.out.println("Original&nbsp;=&nbsp;"&nbsp;+&nbsp;c1);<br />
<span style="color: #008080; ">63</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;System.out.println("Copied&nbsp;&nbsp;&nbsp;=&nbsp;"&nbsp;+&nbsp;c2);<br />
<span style="color: #008080; ">64</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
<span style="color: #008080; ">65</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">catch</span>(Exception&nbsp;e)<br />
<span style="color: #008080; ">66</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />
<span style="color: #008080; ">67</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;System.out.println("Exception&nbsp;in&nbsp;main&nbsp;=&nbsp;"&nbsp;+&nbsp;&nbsp;e);<br />
<span style="color: #008080; ">68</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
<span style="color: #008080; ">69</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">finally</span><br />
<span style="color: #008080; ">70</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
<span style="color: #008080; ">71</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;oos.close();<br />
<span style="color: #008080; ">72</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ois.close();<br />
<span style="color: #008080; ">73</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
<span style="color: #008080; ">74</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
<span style="color: #008080; ">75</span>&nbsp;}<br />
<font color="#008080"><br />
</font>&nbsp;The&nbsp;output&nbsp;is:<br />
&nbsp;Original&nbsp;=&nbsp;x=100,y=100<br />
&nbsp;Copied&nbsp;&nbsp;&nbsp;=&nbsp;x=100,y=100<br />
&nbsp;Original&nbsp;=&nbsp;x=200,y=200<br />
&nbsp;Copied&nbsp;&nbsp;&nbsp;=&nbsp;x=100,y=100</div>
<br />
All you need to do here is:<br />
<ul>
     <li><span style="text-align: left; ">Ensure that all classes in the object's graph are serializable.</span></li>
     <li><span style="text-align: left; ">Create input and output streams.</span></li>
     <li><span style="text-align: left; ">Use the input and output streams to create object input and object output streams.</span></li>
     <li><span style="text-align: left; ">Pass the object that you want to copy to the object output stream.</span></li>
     <li><span style="text-align: left; ">Read the new object from the object input stream and cast it back to the class of the object you sent.</span></li>
</ul>
<p style="margin-top: 10px; margin-right: 10px; margin-bottom: 10px; margin-left: 10px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; ">In this example, I have created a ColoredCircle object, c1 and then serialized it (write it out to ByteArrayOutputStream). Then I deserialed the serialized object and saved it in c2. Later I modified the original object, c1. Then if you see the result, c1 is different from c2. c2 is deep copy of first version of c1. So its just a copy and not a reference. Now any modifications to c1 wont affect c2, the deep copy of first version of c1.</p>
<p style="margin-top: 10px; margin-right: 10px; margin-bottom: 10px; margin-left: 10px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; "><u style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; "><em style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; ">Well this approach has got its own limitations and issues:</em></u></p>
<p style="margin-top: 10px; margin-right: 10px; margin-bottom: 10px; margin-left: 10px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; ">As you cannot serialize a transient variable, using this approach you cannot copy the transient variables.&nbsp;<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; " />
Another issue is dealing with the case of a class whose object's instances within a virtual machine must be controlled. This is a special case of the Singleton pattern, in which a class has only one object within a VM. As discussed above, when you serialize an object, you create a totally new object that will not be unique. To get around this default behavior you can use the readResolve() method to force the stream to return an appropriate object rather than the one that was serialized. In this particular case, the appropriate object is the same one that was serialized.<br style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; " />
Next one is the performance issue. Creating a socket, serializing an object, passing it through the socket, and then deserializing it is slow compared to calling methods in existing objects. I say, there will be vast difference in the performance. If your code is performance critical, I suggest dont go for this approach. It takes almost 100 times more time to deep copy the object than the way you do by implementing Clonable interface.</p>
<p style="margin-top: 10px; margin-right: 10px; margin-bottom: 10px; margin-left: 10px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; "><u style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; "><em style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; ">When to do shallow copy and deep copy?</em></u></p>
<p style="margin-top: 10px; margin-right: 10px; margin-bottom: 10px; margin-left: 10px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; ">Its very simple that if the object has only primitive fields, then obviously you will go for shallow copy but if the object has references to other objects, then based on the requiement, shallow copy or deep copy should be chosen. What I mean here is, if the references are not modified anytime, then there is no point in going for deep copy. You can just opt shallow copy. But if the references are modified often, then you need to go for deep copy. Again there is no hard and fast rule, it all depends on the requirement.</p>
<p style="margin-top: 10px; margin-right: 10px; margin-bottom: 10px; margin-left: 10px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; "><u style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; "><em style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; ">Finally lets have a word about rarely used option - Lazy copy</em></u></p>
<p style="margin-top: 10px; margin-right: 10px; margin-bottom: 10px; margin-left: 10px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; ">A lazy copy is a combination of both shallow copy and deep copy. When initially copying an object, a (fast) shallow copy is used. A counter is also used to track how many objects share the data. When the program wants to modify the original object, it can determine if the data is shared (by examining the counter) and can do a deep copy at that time if necessary.</p>
<p style="margin-top: 10px; margin-right: 10px; margin-bottom: 10px; margin-left: 10px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; "><iframe allowtransparency="true" frameborder="0" height="90" hspace="0" marginwidth="0" marginheight="0" scrolling="no" vspace="0" width="728" id="aswift_3" name="aswift_3" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; left: 0px; position: absolute; top: 0px; "></iframe>Lazy copy looks to the outside just as a deep copy but takes advantage of the speed of a shallow copy whenever possible. It can be used when the references in the original object are not modified often. The downside are rather high but constant base costs because of the counter. Also, in certain situations, circular references can also cause problems.</p><img src ="http://www.blogjava.net/gembin/aggbug/373545.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/gembin/" target="_blank">gembin</a> 2012-04-07 18:41 <a href="http://www.blogjava.net/gembin/archive/2012/04/07/373545.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>SAX vs. DOM</title><link>http://www.blogjava.net/gembin/archive/2012/04/01/373206.html</link><dc:creator>gembin</dc:creator><author>gembin</author><pubDate>Sun, 01 Apr 2012 08:32:00 GMT</pubDate><guid>http://www.blogjava.net/gembin/archive/2012/04/01/373206.html</guid><wfw:comment>http://www.blogjava.net/gembin/comments/373206.html</wfw:comment><comments>http://www.blogjava.net/gembin/archive/2012/04/01/373206.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/gembin/comments/commentRss/373206.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/gembin/services/trackbacks/373206.html</trackback:ping><description><![CDATA[<div style="color: #151b66; font-size: 13px; line-height: 16px; text-align: left; background-color: #ffffff; font-family: 'Trebuchet MS', sans-serif; ">While comparing two entities, we tend to see both of them as competitors and consequently comparing them to find a winner. This of course is not applicable in every case - not at least in the case of SAX and DOM. Both have their own pros and cons and they are certainly not in direct competition with each other.</div><div style="color: #151b66; font-size: 13px; line-height: 16px; text-align: left; background-color: #ffffff; font-family: 'Trebuchet MS', sans-serif; "></div><div style="font-size: 13px; line-height: 16px; text-align: left; background-color: #ffffff; font-family: 'Trebuchet MS', sans-serif; "><br style="clear: both; " /><strong>SAX vs. DOM</strong></div><div style="color: #151b66; font-size: 13px; line-height: 16px; text-align: left; background-color: #ffffff; font-family: 'Trebuchet MS', sans-serif; "></div><div style="color: #151b66; font-size: 13px; line-height: 16px; text-align: left; background-color: #ffffff; font-family: 'Trebuchet MS', sans-serif; "><br style="clear: both; " />Main differences between SAX and DOM, which are the two most popular APIs for processing XML documents in Java, are:-</div><ul style="color: #151b66; font-size: 13px; line-height: 16px; text-align: left; background-color: #ffffff; font-family: 'Trebuchet MS', sans-serif; "><li><strong style="color: black; ">Read v/s Read/Write:</strong>&nbsp;SAX can be used only for reading XML documents and not for the manipulation of the underlying XML data whereas DOM can be used for both read and write of the data in an XML document.</li><li><strong style="color: black; ">Sequential Access v/s Random Access:</strong>&nbsp;SAX can be used only for a sequential processing of an XML document whereas DOM can be used for a random processing of XML docs. So what to do if you want a random access to the underlying XML data while using SAX? You got to store and manage that information so that you can retrieve it when you need.</li><li><strong style="color: black; ">Call back v/s Tree:</strong>&nbsp;SAX uses call back mechanism and uses event-streams to read chunks of XML data into the memory in a sequential manner whereas DOM uses a tree representation of the underlying XML document and facilitates random access/manipulation of the underlying XML data.</li><li><strong style="color: black; ">XML-Dev mailing list v/s W3C:</strong>&nbsp;SAX was developed by the XML-Dev mailing list whereas DOM was developed by W3C (World Wide Web Consortium).</li><li><strong style="color: black; ">Information Set:</strong>&nbsp;SAX doesn't retain all the info of the underlying XML document such as comments whereas DOM retains almost all the info. New versions of SAX are trying to extend their coverage of information.</li></ul><div style="color: #151b66; font-size: 13px; line-height: 16px; text-align: left; background-color: #ffffff; font-family: 'Trebuchet MS', sans-serif; "><strong style="color: black; ">Usual Misconceptions</strong></div><ul style="color: #151b66; font-size: 13px; line-height: 16px; text-align: left; background-color: #ffffff; font-family: 'Trebuchet MS', sans-serif; "><li><strong style="color: black; ">SAX is always faster:</strong>&nbsp;this is a very common misunderstanding and one should be aware that SAX may not always be faster because it might not enjoy the storage-size advantage in every case due to the cost of call backs depending upon the particular situation, SAX is being used in.</li><li><strong style="color: black; ">DOM always keeps the whole XML doc in memory:</strong>&nbsp;it's not always true. DOM implementations not only vary in their code size and performance, but also in their memory requirements and few of them don't keep the entire XML doc in memory all the time. Otherwise, processing/manipulation of very large XML docs may virtually become impossible using DOM, which is of course not the case.</li></ul><div style="color: #151b66; font-size: 13px; line-height: 16px; text-align: left; background-color: #ffffff; font-family: 'Trebuchet MS', sans-serif; "><br style="clear: both; " /><div style="color: black; "><strong>How to choose one between the two?</strong></div><br style="clear: both; " />It primarily depends upon the requirement. If the underlying XML data requires manipulation then almost always DOM will be used as SAX doesn't allow that. Similarly if the nature of access is random (for example, if you need contextual info at every stage) then DOM will be the way to go in most of the cases. But, if the XML document is only required to be read and that too sequentially, then SAX will probably be a better alternative in most of the cases. SAX was developed mainly for pasring XML documents and it's certainly good at it. SO, if you need to process an XML document maybe to update a datasource, SAX will probably make a alternative.</div><div style="color: #151b66; font-size: 13px; line-height: 16px; text-align: left; background-color: #ffffff; font-family: 'Trebuchet MS', sans-serif; "></div><div style="color: #151b66; font-size: 13px; line-height: 16px; text-align: left; background-color: #ffffff; font-family: 'Trebuchet MS', sans-serif; ">Requirements may certainly fall between the two extremes discussed above and for any such situation you should weight both the alternatives before picking any of the two. There are applications where a combination of both SAX and DOM are used for XML processing so that might also be an alternative in your case. But, basically it would be a design decision and evidently it would require a thorough analysis of the pros and cons of all possible approaches in that situation.</div><img src ="http://www.blogjava.net/gembin/aggbug/373206.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/gembin/" target="_blank">gembin</a> 2012-04-01 16:32 <a href="http://www.blogjava.net/gembin/archive/2012/04/01/373206.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Top Ten Reasons not to use the C shell</title><link>http://www.blogjava.net/gembin/archive/2012/04/01/373205.html</link><dc:creator>gembin</dc:creator><author>gembin</author><pubDate>Sun, 01 Apr 2012 08:30:00 GMT</pubDate><guid>http://www.blogjava.net/gembin/archive/2012/04/01/373205.html</guid><wfw:comment>http://www.blogjava.net/gembin/comments/373205.html</wfw:comment><comments>http://www.blogjava.net/gembin/archive/2012/04/01/373205.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/gembin/comments/commentRss/373205.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/gembin/services/trackbacks/373205.html</trackback:ping><description><![CDATA[<pre style="line-height: normal; font-size: medium; word-wrap: break-word; white-space: pre-wrap; "> <a href="http://www.grymoire.com/Unix/CshTop10.txt">http://www.grymoire.com/Unix/CshTop10.txt</a> </pre><img src ="http://www.blogjava.net/gembin/aggbug/373205.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/gembin/" target="_blank">gembin</a> 2012-04-01 16:30 <a href="http://www.blogjava.net/gembin/archive/2012/04/01/373205.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Get substring of a string under UNIX/Linux</title><link>http://www.blogjava.net/gembin/archive/2012/04/01/373200.html</link><dc:creator>gembin</dc:creator><author>gembin</author><pubDate>Sun, 01 Apr 2012 07:38:00 GMT</pubDate><guid>http://www.blogjava.net/gembin/archive/2012/04/01/373200.html</guid><wfw:comment>http://www.blogjava.net/gembin/comments/373200.html</wfw:comment><comments>http://www.blogjava.net/gembin/archive/2012/04/01/373200.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/gembin/comments/commentRss/373200.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/gembin/services/trackbacks/373200.html</trackback:ping><description><![CDATA[<div style="text-align: left;"><strong style="background-color: #ffffff; color: #111111; font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif; line-height: 22px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">there many ways to do so.</strong></div><p style="background-color: #ffffff; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 1.571em; margin-left: 0px; color: #111111; font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif; line-height: 22px; "><strong style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><br style="clear: both; " />str="hello world"<br style="clear: both; " /><br />1) cut<br /><span style="color: #000000; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; font-weight: normal; line-height: 18px; text-align: left; ">Where -cN-M tells the cut command to return columns N to M, inclusive.</span>&nbsp;<br /></strong><strong style="color: #000000; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; line-height: 18px; text-align: left; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><code style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-image: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: #eeeeee; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; "><span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-image: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; ">cut -cN-M</span></code></strong></p><strong style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">start=1<br />end=5<br />sub_str=`echo ${str} | cut -c${start}-${end}`<br /></strong>output: hello<br /><br /><strong>2)</strong>
<strong>bash&nbsp;</strong><br /><span style="color: #000000; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; line-height: 18px; text-align: left; ">Note: if you are not sure of having&nbsp;</span><code style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 1px; padding-right: 5px; padding-bottom: 1px; padding-left: 5px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-image: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; color: #000000; line-height: 18px; text-align: left; ">bash</code><span style="color: #000000; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; line-height: 18px; text-align: left; ">, consider using&nbsp;</span><code style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 1px; padding-right: 5px; padding-bottom: 1px; padding-left: 5px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-image: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; color: #000000; line-height: 18px; text-align: left; ">cut</code><span style="color: #000000; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; line-height: 18px; text-align: left; ">.</span>&nbsp;<br /><pre prettyprint"="" style="margin-top: 0px; margin-bottom: 10px; padding-top: 5px; padding-right: 5px; padding-bottom: 5px; padding-left: 5px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-image: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; overflow-x: auto; overflow-y: auto; width: auto; max-height: 600px; color: #000000; line-height: 18px; text-align: left; "><code style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-image: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; background-color: #eeeeee; "><span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-image: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; ">$</span><span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-image: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; ">{</span><span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-image: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; ">str</span><span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-image: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; ">:</span><span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-image: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; ">offset</span><span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-image: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; ">}</span><span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-image: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; "><br />$</span><span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-image: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; ">{</span><span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-image: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; ">str</span><span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-image: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; ">:</span><span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-image: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; ">offset</span><span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-image: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; ">:</span><span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-image: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; ">length</span><span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-image: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; ">}<br /><br /></span><span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-image: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; "><strong style="font-family: verdana, 'courier new'; line-height: 21px; text-align: -webkit-auto; white-space: normal; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">sub_str=${str:0:5}</strong> <br /></span><span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-image: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; "><span style="font-family: verdana, 'courier new'; line-height: 21px; text-align: -webkit-auto; white-space: normal; ">output: hello</span> <br /><br /><strong style="font-family: verdana, 'courier new'; line-height: 21px; text-align: -webkit-auto; white-space: normal; ">3)</strong><span style="font-family: verdana, 'courier new'; line-height: 21px; text-align: -webkit-auto; white-space: normal; ">&nbsp;<strong>expr</strong></span><strong> </strong><br /></span></code></pre><p></p><pre prettyprint"="" style="margin-top: 0px; margin-bottom: 10px; padding-top: 5px; padding-right: 5px; padding-bottom: 5px; padding-left: 5px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-image: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; overflow-x: auto; overflow-y: auto; width: auto; max-height: 600px; line-height: 18px; text-align: left; "><code style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-image: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; background-color: #eeeeee; "><span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-image: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; "><span style="white-space: normal; ">expr substr string position length</span> <br /></span></code><span style="background-color: #eeeeee; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-image: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; "><span style="font-weight: bold; font-family: verdana, 'courier new'; line-height: 21px; text-align: -webkit-auto; white-space: normal; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">sub_str=</span><strong>`expr substr $str 1 5`</strong><br /></span><span style="background-color: #eeeeee; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; border-image: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; "><span style="font-family: verdana, 'courier new'; line-height: 21px; text-align: -webkit-auto; white-space: normal; ">output: hello</span> </span></pre><span style="font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; line-height: 18px; text-align: left; "></span><p>&nbsp;</p><img src ="http://www.blogjava.net/gembin/aggbug/373200.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/gembin/" target="_blank">gembin</a> 2012-04-01 15:38 <a href="http://www.blogjava.net/gembin/archive/2012/04/01/373200.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title> Get the length of a string under UNIX/Linux</title><link>http://www.blogjava.net/gembin/archive/2012/04/01/373199.html</link><dc:creator>gembin</dc:creator><author>gembin</author><pubDate>Sun, 01 Apr 2012 07:14:00 GMT</pubDate><guid>http://www.blogjava.net/gembin/archive/2012/04/01/373199.html</guid><wfw:comment>http://www.blogjava.net/gembin/comments/373199.html</wfw:comment><comments>http://www.blogjava.net/gembin/archive/2012/04/01/373199.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/gembin/comments/commentRss/373199.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/gembin/services/trackbacks/373199.html</trackback:ping><description><![CDATA[<p style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 1.571em; margin-left: 0px; color: #111111; font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif; line-height: 22px; background-color: #ffffff; "><strong style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">there many ways to do so.<br /><br />str="hello world"<br /><br />len=`expr length ${str}`<br /><br /></strong><strong style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">len=${#str}<br /></strong></p><div><span style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><strong>len=`echo ${str} | awk "{ print length }"`</strong><br /><br /><strong style="font-weight: bold; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">len=`echo -n ${str} | wc -c`</strong><strong>&nbsp;</strong><br /><font color="#111111" face="Arial, 'Helvetica Neue', Helvetica, sans-serif"><span style="line-height: 22px;"><br /></span></font></span></div><p>&nbsp;</p><img src ="http://www.blogjava.net/gembin/aggbug/373199.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/gembin/" target="_blank">gembin</a> 2012-04-01 15:14 <a href="http://www.blogjava.net/gembin/archive/2012/04/01/373199.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>TreeSet vs HashSet vs LinkedHashSet</title><link>http://www.blogjava.net/gembin/archive/2012/03/31/373111.html</link><dc:creator>gembin</dc:creator><author>gembin</author><pubDate>Sat, 31 Mar 2012 03:30:00 GMT</pubDate><guid>http://www.blogjava.net/gembin/archive/2012/03/31/373111.html</guid><wfw:comment>http://www.blogjava.net/gembin/comments/373111.html</wfw:comment><comments>http://www.blogjava.net/gembin/archive/2012/03/31/373111.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/gembin/comments/commentRss/373111.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/gembin/services/trackbacks/373111.html</trackback:ping><description><![CDATA[<h2><table id="tmwm" border="1" cellspacing="0" cellpadding="3" width="100%" style="color: #2a2a2a; font-family: Verdana, Tahoma, Arial, sans-serif; font-size: 11px; font-weight: normal; line-height: normal; text-align: left; background-color: #fafcff; height: 49px; "><tbody><tr><td width="33%" style="text-align: center; "><strong>TreeSet</strong></td><td width="33%" style="text-align: center; "><strong>HashSet</strong></td><td width="33%" style="text-align: center; "><strong>LinkedHashSet</strong></td></tr><tr><td width="33%"><dl><dt>public class&nbsp;<strong>TreeSet</strong></dt><dt>extends&nbsp;<a title="class in java.util" href="http://java.sun.com/j2se/1.4.2/docs/api/java/util/AbstractSet.html" style="font-weight: bold; color: #0a8fbc; ">AbstractSet</a></dt><dt>implements&nbsp;<a title="interface in java.util" href="http://java.sun.com/j2se/1.4.2/docs/api/java/util/SortedSet.html" style="font-weight: bold; color: #0a8fbc; ">SortedSet</a>,&nbsp;<a title="interface in java.lang" href="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Cloneable.html" style="font-weight: bold; color: #0a8fbc; ">Cloneable</a>,&nbsp;<a title="interface in java.io" href="http://java.sun.com/j2se/1.4.2/docs/api/java/io/Serializable.html" style="font-weight: bold; color: #0a8fbc; ">Serializable</a></dt></dl></td><td width="33%"><dl><dt>public class&nbsp;<strong>HashSet</strong></dt><dt>extends&nbsp;<a title="class in java.util" href="http://java.sun.com/j2se/1.4.2/docs/api/java/util/AbstractSet.html" style="font-weight: bold; color: #0a8fbc; ">AbstractSet</a></dt><dt>implements&nbsp;<a title="interface in java.util" href="http://java.sun.com/j2se/1.4.2/docs/api/java/util/Set.html" style="font-weight: bold; color: #0a8fbc; ">Set</a>,&nbsp;<a title="interface in java.lang" href="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Cloneable.html" style="font-weight: bold; color: #0a8fbc; ">Cloneable</a>,&nbsp;<a title="interface in java.io" href="http://java.sun.com/j2se/1.4.2/docs/api/java/io/Serializable.html" style="font-weight: bold; color: #0a8fbc; ">Serializable</a></dt></dl></td><td width="33%"><dl><dt>public class&nbsp;<strong>LinkedHashSet</strong></dt><dt>extends&nbsp;<a title="class in java.util" href="http://java.sun.com/j2se/1.4.2/docs/api/java/util/HashSet.html" style="font-weight: bold; color: #0a8fbc; ">HashSet</a></dt><dt>implements&nbsp;<a title="interface in java.util" href="http://java.sun.com/j2se/1.4.2/docs/api/java/util/Set.html" style="font-weight: bold; color: #0a8fbc; ">Set</a>,&nbsp;<a title="interface in java.lang" href="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Cloneable.html" style="font-weight: bold; color: #0a8fbc; ">Cloneable</a>,&nbsp;<a title="interface in java.io" href="http://java.sun.com/j2se/1.4.2/docs/api/java/io/Serializable.html" style="font-weight: bold; color: #0a8fbc; ">Serializable</a></dt></dl></td></tr><tr><td width="33%">unique values</td><td width="33%">unique values</td><td width="33%">Unique values</td></tr><tr><td width="33%">It stores its elements in a red-black tree</td><td width="33%">It stores its elements in a hash table</td><td width="33%">is implemented as a hash table with a linked list running through it</td></tr><tr><td width="33%">Order : ascending order</td><td width="33%"><em>undefined</em></td><td width="33%">insertion order</td></tr><tr><td width="33%">Performance : Slow</td><td width="33%"><tt>better than LinkedHashSet</tt></td><td width="33%">has fast adding to the start of the list, and fast deletion from the interior via iteration</td></tr><tr><td width="33%">operations (<code style="font-size: 1.1em; ">add</code>,&nbsp;<code style="font-size: 1.1em; ">remove</code>&nbsp;and&nbsp;<code style="font-size: 1.1em; ">contains</code>)</td><td width="33%">operations (<tt>add</tt>,&nbsp;<tt>remove</tt>,&nbsp;<tt>contains</tt>&nbsp;and&nbsp;<tt>size</tt>)</td><td width="33%">operations (<tt>add</tt>,&nbsp;<tt>contains</tt>&nbsp;and&nbsp;<tt>remove</tt>)</td></tr><tr><td width="33%">add, addAll,ceiling,clear,clone,comparator,contains,<br />descendingIterator,descendingSet,first,floor,<br />hashSet,higher,isEmpty,iterator,last,lower,pollFirst,<br />remove,size,subSet,tailSet</td><td width="33%"><code style="font-size: 1.1em; "><a href="http://java.sun.com/javase/6/docs/api/java/util/HashSet.html#add%28E%29" style="font-weight: bold; color: #0a8fbc; ">add</a>,&nbsp;<a href="http://java.sun.com/javase/6/docs/api/java/util/HashSet.html#clear%28%29" style="font-weight: bold; color: #0a8fbc; ">clear</a>,&nbsp;<a href="http://java.sun.com/javase/6/docs/api/java/util/HashSet.html#clone%28%29" style="font-weight: bold; color: #0a8fbc; ">clone</a>,&nbsp;<a href="http://java.sun.com/javase/6/docs/api/java/util/HashSet.html#contains%28java.lang.Object%29" style="font-weight: bold; color: #0a8fbc; ">contains</a>,&nbsp;<a href="http://java.sun.com/javase/6/docs/api/java/util/HashSet.html#isEmpty%28%29" style="font-weight: bold; color: #0a8fbc; ">isEmpty</a>,<a href="http://java.sun.com/javase/6/docs/api/java/util/HashSet.html#iterator%28%29" style="font-weight: bold; color: #0a8fbc; ">iterator</a>,&nbsp;<a href="http://java.sun.com/javase/6/docs/api/java/util/HashSet.html#remove%28java.lang.Object%29" style="font-weight: bold; color: #0a8fbc; ">remove</a>,&nbsp;<a href="http://java.sun.com/javase/6/docs/api/java/util/HashSet.html#size%28%29" style="font-weight: bold; color: #0a8fbc; ">size</a></code></td><td width="33%"><code style="font-size: 1.1em; "><a href="http://java.sun.com/javase/6/docs/api/java/util/HashSet.html#add%28E%29" style="font-weight: bold; color: #0a8fbc; ">add</a>,&nbsp;<a href="http://java.sun.com/javase/6/docs/api/java/util/HashSet.html#clear%28%29" style="font-weight: bold; color: #0a8fbc; ">clear</a>,&nbsp;<a href="http://java.sun.com/javase/6/docs/api/java/util/HashSet.html#clone%28%29" style="font-weight: bold; color: #0a8fbc; ">clone</a>,&nbsp;<a href="http://java.sun.com/javase/6/docs/api/java/util/HashSet.html#contains%28java.lang.Object%29" style="font-weight: bold; color: #0a8fbc; ">contains</a>,&nbsp;<a href="http://java.sun.com/javase/6/docs/api/java/util/HashSet.html#isEmpty%28%29" style="font-weight: bold; color: #0a8fbc; ">isEmpty</a>,<a href="http://java.sun.com/javase/6/docs/api/java/util/HashSet.html#iterator%28%29" style="font-weight: bold; color: #0a8fbc; ">iterator</a>,&nbsp;<a href="http://java.sun.com/javase/6/docs/api/java/util/HashSet.html#remove%28java.lang.Object%29" style="font-weight: bold; color: #0a8fbc; ">remove</a>,&nbsp;<a href="http://java.sun.com/javase/6/docs/api/java/util/HashSet.html#size%28%29" style="font-weight: bold; color: #0a8fbc; ">size</a></code></td></tr><tr><td width="33%">From AbstractSet:<br /><code style="font-size: 1.1em; "><a href="http://java.sun.com/javase/6/docs/api/java/util/AbstractSet.html#equals%28java.lang.Object%29" style="font-weight: bold; color: #0a8fbc; ">equals</a>,&nbsp;<a href="http://java.sun.com/javase/6/docs/api/java/util/AbstractSet.html#hashCode%28%29" style="font-weight: bold; color: #0a8fbc; ">hashCode</a>,&nbsp;<a href="http://java.sun.com/javase/6/docs/api/java/util/AbstractSet.html#removeAll%28java.util.Collection%29" style="font-weight: bold; color: #0a8fbc; ">removeAll</a></code></td><td width="33%"><code style="font-size: 1.1em; "><a href="http://java.sun.com/javase/6/docs/api/java/util/AbstractSet.html#equals%28java.lang.Object%29" style="font-weight: bold; color: #0a8fbc; ">equals</a>,&nbsp;<a href="http://java.sun.com/javase/6/docs/api/java/util/AbstractSet.html#hashCode%28%29" style="font-weight: bold; color: #0a8fbc; ">hashCode</a>,&nbsp;<a href="http://java.sun.com/javase/6/docs/api/java/util/AbstractSet.html#removeAll%28java.util.Collection%29" style="font-weight: bold; color: #0a8fbc; ">removeAll</a></code></td><td width="33%"><code style="font-size: 1.1em; "><a href="http://java.sun.com/javase/6/docs/api/java/util/AbstractSet.html#equals%28java.lang.Object%29" style="font-weight: bold; color: #0a8fbc; ">equals</a>,&nbsp;<a href="http://java.sun.com/javase/6/docs/api/java/util/AbstractSet.html#hashCode%28%29" style="font-weight: bold; color: #0a8fbc; ">hashCode</a>,&nbsp;<a href="http://java.sun.com/javase/6/docs/api/java/util/AbstractSet.html#removeAll%28java.util.Collection%29" style="font-weight: bold; color: #0a8fbc; ">removeAll</a></code></td></tr><tr><td width="33%"><code style="font-size: 1.1em; "><a href="http://java.sun.com/javase/6/docs/api/java/util/AbstractCollection.html#containsAll%28java.util.Collection%29" style="font-weight: bold; color: #0a8fbc; ">containsAll</a>,&nbsp;<a href="http://java.sun.com/javase/6/docs/api/java/util/AbstractCollection.html#retainAll%28java.util.Collection%29" style="font-weight: bold; color: #0a8fbc; ">retainAll</a>,&nbsp;<a href="http://java.sun.com/javase/6/docs/api/java/util/AbstractCollection.html#toArray%28%29" style="font-weight: bold; color: #0a8fbc; ">toArray</a>,&nbsp;<a href="http://java.sun.com/javase/6/docs/api/java/util/AbstractCollection.html#toArray%28T%5B%5D%29" style="font-weight: bold; color: #0a8fbc; ">toArray</a>,<a href="http://java.sun.com/javase/6/docs/api/java/util/AbstractCollection.html#toString%28%29" style="font-weight: bold; color: #0a8fbc; ">toString</a></code></td><td width="33%">AbstractCollection:<br /><code style="font-size: 1.1em; "><a href="http://java.sun.com/javase/6/docs/api/java/util/AbstractCollection.html#addAll%28java.util.Collection%29" style="font-weight: bold; color: #0a8fbc; ">addAll</a>,&nbsp;<a href="http://java.sun.com/javase/6/docs/api/java/util/AbstractCollection.html#containsAll%28java.util.Collection%29" style="font-weight: bold; color: #0a8fbc; ">containsAll</a>,&nbsp;<a href="http://java.sun.com/javase/6/docs/api/java/util/AbstractCollection.html#retainAll%28java.util.Collection%29" style="font-weight: bold; color: #0a8fbc; ">retainAll</a>,&nbsp;<a href="http://java.sun.com/javase/6/docs/api/java/util/AbstractCollection.html#toArray%28%29" style="font-weight: bold; color: #0a8fbc; ">toArray</a>,<a href="http://java.sun.com/javase/6/docs/api/java/util/AbstractCollection.html#toArray%28T%5B%5D%29" style="font-weight: bold; color: #0a8fbc; ">toArray</a>,&nbsp;<a href="http://java.sun.com/javase/6/docs/api/java/util/AbstractCollection.html#toString%28%29" style="font-weight: bold; color: #0a8fbc; ">toString</a></code></td><td width="33%"><code style="font-size: 1.1em; "><a href="http://java.sun.com/javase/6/docs/api/java/util/AbstractCollection.html#addAll%28java.util.Collection%29" style="font-weight: bold; color: #0a8fbc; ">addAll</a>,&nbsp;<a href="http://java.sun.com/javase/6/docs/api/java/util/AbstractCollection.html#containsAll%28java.util.Collection%29" style="font-weight: bold; color: #0a8fbc; ">containsAll</a>,&nbsp;<a href="http://java.sun.com/javase/6/docs/api/java/util/AbstractCollection.html#retainAll%28java.util.Collection%29" style="font-weight: bold; color: #0a8fbc; ">retainAll</a>,&nbsp;<a href="http://java.sun.com/javase/6/docs/api/java/util/AbstractCollection.html#toArray%28%29" style="font-weight: bold; color: #0a8fbc; ">toArray</a>,<a href="http://java.sun.com/javase/6/docs/api/java/util/AbstractCollection.html#toArray%28T%5B%5D%29" style="font-weight: bold; color: #0a8fbc; ">toArray</a>,&nbsp;<a href="http://java.sun.com/javase/6/docs/api/java/util/AbstractCollection.html#toString%28%29" style="font-weight: bold; color: #0a8fbc; ">toString</a></code></td></tr><tr><td width="33%">Set:<br /><code style="font-size: 1.1em; "><a href="http://java.sun.com/javase/6/docs/api/java/util/Set.html#containsAll%28java.util.Collection%29" style="font-weight: bold; color: #0a8fbc; ">containsAll</a>,&nbsp;<a href="http://java.sun.com/javase/6/docs/api/java/util/Set.html#equals%28java.lang.Object%29" style="font-weight: bold; color: #0a8fbc; ">equals</a>,&nbsp;<a href="http://java.sun.com/javase/6/docs/api/java/util/Set.html#hashCode%28%29" style="font-weight: bold; color: #0a8fbc; ">hashCode</a>,&nbsp;<a href="http://java.sun.com/javase/6/docs/api/java/util/Set.html#removeAll%28java.util.Collection%29" style="font-weight: bold; color: #0a8fbc; ">removeAll</a>,<a href="http://java.sun.com/javase/6/docs/api/java/util/Set.html#retainAll%28java.util.Collection%29" style="font-weight: bold; color: #0a8fbc; ">retainAll</a>,&nbsp;<a href="http://java.sun.com/javase/6/docs/api/java/util/Set.html#toArray%28%29" style="font-weight: bold; color: #0a8fbc; ">toArray</a>,&nbsp;<a href="http://java.sun.com/javase/6/docs/api/java/util/Set.html#toArray%28T%5B%5D%29" style="font-weight: bold; color: #0a8fbc; ">toArray</a></code></td><td width="33%"><code style="font-size: 1.1em; "><a href="http://java.sun.com/javase/6/docs/api/java/util/Set.html#addAll%28java.util.Collection%29" style="font-weight: bold; color: #0a8fbc; ">addAll</a>,&nbsp;<a href="http://java.sun.com/javase/6/docs/api/java/util/Set.html#containsAll%28java.util.Collection%29" style="font-weight: bold; color: #0a8fbc; ">containsAll</a>,&nbsp;<a href="http://java.sun.com/javase/6/docs/api/java/util/Set.html#equals%28java.lang.Object%29" style="font-weight: bold; color: #0a8fbc; ">equals</a>,&nbsp;<a href="http://java.sun.com/javase/6/docs/api/java/util/Set.html#hashCode%28%29" style="font-weight: bold; color: #0a8fbc; ">hashCode</a>,<a href="http://java.sun.com/javase/6/docs/api/java/util/Set.html#removeAll%28java.util.Collection%29" style="font-weight: bold; color: #0a8fbc; ">removeAll</a>,&nbsp;<a href="http://java.sun.com/javase/6/docs/api/java/util/Set.html#retainAll%28java.util.Collection%29" style="font-weight: bold; color: #0a8fbc; ">retainAll</a>,&nbsp;<a href="http://java.sun.com/javase/6/docs/api/java/util/Set.html#toArray%28%29" style="font-weight: bold; color: #0a8fbc; ">toArray</a>,&nbsp;<a href="http://java.sun.com/javase/6/docs/api/java/util/Set.html#toArray%28T%5B%5D%29" style="font-weight: bold; color: #0a8fbc; ">toArray</a></code></td><td width="33%"><code style="font-size: 1.1em; "><a href="http://java.sun.com/javase/6/docs/api/java/util/Set.html#add%28E%29" style="font-weight: bold; color: #0a8fbc; ">add</a>,&nbsp;<a href="http://java.sun.com/javase/6/docs/api/java/util/Set.html#addAll%28java.util.Collection%29" style="font-weight: bold; color: #0a8fbc; ">addAll</a>,&nbsp;<a href="http://java.sun.com/javase/6/docs/api/java/util/Set.html#clear%28%29" style="font-weight: bold; color: #0a8fbc; ">clear</a>,&nbsp;<a href="http://java.sun.com/javase/6/docs/api/java/util/Set.html#contains%28java.lang.Object%29" style="font-weight: bold; color: #0a8fbc; ">contains</a>,&nbsp;<a href="http://java.sun.com/javase/6/docs/api/java/util/Set.html#containsAll%28java.util.Collection%29" style="font-weight: bold; color: #0a8fbc; ">containsAll</a>,<a href="http://java.sun.com/javase/6/docs/api/java/util/Set.html#equals%28java.lang.Object%29" style="font-weight: bold; color: #0a8fbc; ">equals</a>,&nbsp;<a href="http://java.sun.com/javase/6/docs/api/java/util/Set.html#hashCode%28%29" style="font-weight: bold; color: #0a8fbc; ">hashCode</a>,&nbsp;<a href="http://java.sun.com/javase/6/docs/api/java/util/Set.html#isEmpty%28%29" style="font-weight: bold; color: #0a8fbc; ">isEmpty</a>,&nbsp;<a href="http://java.sun.com/javase/6/docs/api/java/util/Set.html#iterator%28%29" style="font-weight: bold; color: #0a8fbc; ">iterator</a>,&nbsp;<a href="http://java.sun.com/javase/6/docs/api/java/util/Set.html#remove%28java.lang.Object%29" style="font-weight: bold; color: #0a8fbc; ">remove</a>,<a href="http://java.sun.com/javase/6/docs/api/java/util/Set.html#removeAll%28java.util.Collection%29" style="font-weight: bold; color: #0a8fbc; ">removeAll</a>,&nbsp;<a href="http://java.sun.com/javase/6/docs/api/java/util/Set.html#retainAll%28java.util.Collection%29" style="font-weight: bold; color: #0a8fbc; ">retainAll</a>,&nbsp;<a href="http://java.sun.com/javase/6/docs/api/java/util/Set.html#size%28%29" style="font-weight: bold; color: #0a8fbc; ">size</a>,&nbsp;<a href="http://java.sun.com/javase/6/docs/api/java/util/Set.html#toArray%28%29" style="font-weight: bold; color: #0a8fbc; ">toArray</a>,&nbsp;<a href="http://java.sun.com/javase/6/docs/api/java/util/Set.html#toArray%28T%5B%5D%29" style="font-weight: bold; color: #0a8fbc; ">toArray</a></code></td></tr></tbody></table><br /></h2><img src ="http://www.blogjava.net/gembin/aggbug/373111.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/gembin/" target="_blank">gembin</a> 2012-03-31 11:30 <a href="http://www.blogjava.net/gembin/archive/2012/03/31/373111.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Objective-C NSString formatting </title><link>http://www.blogjava.net/gembin/archive/2012/03/04/371188.html</link><dc:creator>gembin</dc:creator><author>gembin</author><pubDate>Sat, 03 Mar 2012 16:27:00 GMT</pubDate><guid>http://www.blogjava.net/gembin/archive/2012/03/04/371188.html</guid><wfw:comment>http://www.blogjava.net/gembin/comments/371188.html</wfw:comment><comments>http://www.blogjava.net/gembin/archive/2012/03/04/371188.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/gembin/comments/commentRss/371188.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/gembin/services/trackbacks/371188.html</trackback:ping><description><![CDATA[<p style="margin-top: 20px; margin-right: 0px; margin-bottom: 20px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 25px; word-wrap: break-word; font-family: 'Lucida Grande', Geneva, Arial, Verdana, Tahoma, Arial, 微软雅黑, 黑体, 宋体; ">The format specifiers supported by the NSString formatting methods and CFString formatting <br />functions follow the IEEE printf specification; the specifiers are summarized in Table 1.<br /> Note that you can also use the &#8220;n$&#8221; positional specifiers such as %1$@ %2$s. <br />For more details, see the IEEE printf specification. You can also use these format specifiers with the NSLog function.</p><table cellspacing="1" border="0" style="color: #000000; font-family: 'Lucida Grande', Geneva, Arial, Verdana, Tahoma, Arial, 微软雅黑, 黑体, 宋体; font-size: 14px; line-height: 25px; width: 643px; "><caption>Table 1 Format specifiers supported by the NSString formatting methods and CFString formatting functions</caption><tbody style="background-color: #eeeeee; "><tr style="background-color: #cccccc; "><td style="width: 62px; ">定义</td><td style="width: 574px; ">说明</td></tr><tr><td>%@</td><td>Objective-C object, printed as the string returned by descriptionWithLocale: if available, or description otherwise. Also works with CFTypeRef objects, returning the result of the CFCopyDescription function.</td></tr><tr><td>%%</td><td>&#8216;%&#8217; character</td></tr><tr><td>%d, %D, %i</td><td>Signed 32-bit integer (int)</td></tr><tr><td>%u, %U</td><td>Unsigned 32-bit integer (unsigned int)</td></tr><tr><td>%hi</td><td>Signed 16-bit integer (short)</td></tr><tr><td>%hu</td><td>Unsigned 16-bit integer (unsigned short)</td></tr><tr><td>%qi</td><td>Signed 64-bit integer (long long)</td></tr><tr><td>%qu</td><td>Unsigned 64-bit integer (unsigned long long)</td></tr><tr><td>%x</td><td>Unsigned 32-bit integer (unsigned int), printed in hexadecimal using the digits 0&#8211;9 and lowercase a&#8211;f</td></tr><tr><td>%X</td><td>Unsigned 32-bit integer (unsigned int), printed in hexadecimal using the digits 0&#8211;9 and uppercase A&#8211;F</td></tr><tr><td>%qx</td><td>Unsigned 64-bit integer (unsigned long long), printed in hexadecimal using the digits 0&#8211;9 and lowercase a&#8211;f</td></tr><tr><td>%qX</td><td>Unsigned 64-bit integer (unsigned long long), printed in hexadecimal using the digits 0&#8211;9 and uppercase A&#8211;F</td></tr><tr><td>%o, %O</td><td>Unsigned 32-bit integer (unsigned int), printed in octal</td></tr><tr><td>%f</td><td>64-bit floating-point number (double)</td></tr><tr><td>%e</td><td>64-bit floating-point number (double), printed in scientific notation using a lowercase e to introduce the exponent</td></tr><tr><td>%E</td><td>64-bit floating-point number (double), printed in scientific notation using an uppercase E to introduce the exponent</td></tr><tr><td>%g</td><td>64-bit floating-point number (double), printed in the style of %e if the exponent is less than &#8211;4 or greater than or equal to the precision, in the style of %f otherwise</td></tr><tr><td>%G</td><td>64-bit floating-point number (double), printed in the style of %E if the exponent is less than &#8211;4 or greater than or equal to the precision, in the style of %f otherwise</td></tr><tr><td>%c</td><td>8-bit unsigned character (unsigned char), printed by NSLog() as an ASCII character, or, if not an ASCII character, in the octal format \\ddd or the Unicode hexadecimal format \\udddd, where d is a digit</td></tr><tr><td>%C</td><td>16-bit Unicode character (unichar), printed by NSLog() as an ASCII character, or, if not an ASCII character, in the octal format \\ddd or the Unicode hexadecimal format \\udddd, where d is a digit</td></tr><tr><td>%s</td><td>Null-terminated array of 8-bit unsigned characters. %s interprets its input in the system encoding rather than, for example, UTF-8.</td></tr><tr><td>%S</td><td>Null-terminated array of 16-bit Unicode characters</td></tr><tr><td>%p</td><td>Void pointer (void *), printed in hexadecimal with the digits 0&#8211;9 and lowercase a&#8211;f, with a leading 0x</td></tr><tr><td>%L</td><td>Length modifier specifying that a following a, A, e, E, f, F, g, or G conversion specifier applies to a long double argument</td></tr><tr><td>%a</td><td>64-bit floating-point number (double), printed in scientific notation with a leading 0x and one hexadecimal digit before the decimal point using a lowercase p to introduce the exponent</td></tr><tr><td>%A</td><td>64-bit floating-point number (double), printed in scientific notation with a leading 0X and one hexadecimal digit before the decimal point using a uppercase P to introduce the exponent</td></tr><tr><td>%F</td><td>64-bit floating-point number (double), printed in decimal notation</td></tr><tr><td>%z</td><td>Length modifier specifying that a following d, i, o, u, x, or X conversion specifier applies to a size_t or the corresponding signed integer type argument</td></tr><tr><td>%t</td><td>Length modifier specifying that a following d, i, o, u, x, or X conversion specifier applies to a ptrdiff_t or the corresponding unsigned integer type argument</td></tr><tr><td>%j</td><td>Length modifier specifying that a following d, i, o, u, x, or X conversion specifier applies to a intmax_t or uintmax_t argument<br /><br /></td></tr></tbody></table><br /><p style="margin-top: 20px; margin-right: 0px; margin-bottom: 20px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 25px; word-wrap: break-word; font-family: 'Lucida Grande', Geneva, Arial, Verdana, Tahoma, Arial, 微软雅黑, 黑体, 宋体; ">Mac OS X uses several data types&#8212;NSInteger, NSUInteger,CGFloat, and CFIndex&#8212;to provide a <br />consistent means of representing values in 32- and 64-bit environments. In a 32-bit environment, <br />NSInteger and NSUInteger are defined as int and unsigned int, respectively. In 64-bit environments, <br />NSInteger and NSUInteger are defined as long and unsigned long, respectively. To avoid the need to <br />use different printf-style type specifiers depending on the platform, you can use the specifiers shown<br /> in Table 2. Note that in some cases you may have to cast the value.</p><table cellspacing="1" border="0" style="color: #000000; font-family: 'Lucida Grande', Geneva, Arial, Verdana, Tahoma, Arial, 微软雅黑, 黑体, 宋体; font-size: 14px; line-height: 25px; width: 643px; "><caption>Table 2 Format specifiers for data types</caption><tbody style="background-color: #eeeeee; "><tr style="background-color: #cccccc; "><td style="width: 76px; ">类型</td><td style="width: 60px; ">定义</td><td style="width: 497px; ">建议</td></tr><tr><td>NSInteger</td><td>%ld or %lx</td><td>Cast the value to long</td></tr><tr><td>NSUInteger</td><td>%lu or %lx</td><td>Cast the value to unsigned long</td></tr><tr><td>CGFloat</td><td>%f or %g</td><td>%f works for floats and doubles when formatting; but see below warning when scanning</td></tr><tr><td>CFIndex</td><td>%ld or %lx</td><td>The same as NSInteger</td></tr><tr><td>pointer</td><td>%p</td><td>%p adds 0x to the beginning of the output. If you don&#8217;t want that, use %lx and cast to long.</td></tr><tr><td>long long</td><td>%lld or %llx</td><td>long long is 64-bit on both 32- and 64-bit platforms</td></tr><tr><td>unsigned long long</td><td>%llu or %llx</td><td>unsigned long long is 64-bit on both 32- and 64-bit platforms</td></tr></tbody></table><p style="margin-top: 20px; margin-right: 0px; margin-bottom: 20px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 25px; word-wrap: break-word; font-family: 'Lucida Grande', Geneva, Arial, Verdana, Tahoma, Arial, 微软雅黑, 黑体, 宋体; ">The following example illustrates the use of %ld to format an NSInteger and the use of a cast.</p><div objc=""  default"="" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font-family: 'Lucida Grande', Geneva, Arial, Verdana, Tahoma, Arial, 微软雅黑, 黑体, 宋体; line-height: 25px; overflow-x: auto; overflow-y: auto; white-space: nowrap; width: 580px; "><table cellspacing="0" cellpadding="0"><tbody><tr><td><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">1<br />2</div></td><td><div codecolorer"="" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; white-space: nowrap; ">NSInteger i&nbsp;=&nbsp;42;<br />printf("%ld\n",&nbsp;(long)i);</div></td></tr></tbody></table></div><p style="margin-top: 20px; margin-right: 0px; margin-bottom: 20px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 25px; word-wrap: break-word; font-family: 'Lucida Grande', Geneva, Arial, Verdana, Tahoma, Arial, 微软雅黑, 黑体, 宋体; ">In addition to the considerations mentioned in Table 2, there is one extra case with scanning: <br />you must distinguish the types for float and double. You should use %f for float, %lf for double.<br /> If you need to use scanf (or a variant thereof) with CGFloat, switch to double instead, and copy the double to CGFloat.</p><div objc=""  default"="" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font-family: 'Lucida Grande', Geneva, Arial, Verdana, Tahoma, Arial, 微软雅黑, 黑体, 宋体; line-height: 25px; overflow-x: auto; overflow-y: auto; white-space: nowrap; width: 580px; "><table cellspacing="0" cellpadding="0"><tbody><tr><td><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">1<br />2<br />3<br />4</div></td><td><div codecolorer"="" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; white-space: nowrap; ">CGFloat imageWidth;<br />double&nbsp;tmp;<br />sscanf&nbsp;(str,&nbsp;"%lf",&nbsp;&amp;amp;tmp);<br />imageWidth&nbsp;=&nbsp;tmp;</div></td></tr></tbody></table></div><p style="margin-top: 20px; margin-right: 0px; margin-bottom: 20px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; line-height: 25px; word-wrap: break-word; font-family: 'Lucida Grande', Geneva, Arial, Verdana, Tahoma, Arial, 微软雅黑, 黑体, 宋体; ">It is important to remember that %lf does not represent CGFloat correctly on either 32- or 64-bit platforms. <br />This is unlike %ld, which works for long in all cases.</p><br /><br /><br /><br /><img src ="http://www.blogjava.net/gembin/aggbug/371188.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/gembin/" target="_blank">gembin</a> 2012-03-04 00:27 <a href="http://www.blogjava.net/gembin/archive/2012/03/04/371188.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Sharing Objective-C, Cocoa and iOS [ebooks]</title><link>http://www.blogjava.net/gembin/archive/2012/03/03/371166.html</link><dc:creator>gembin</dc:creator><author>gembin</author><pubDate>Sat, 03 Mar 2012 07:43:00 GMT</pubDate><guid>http://www.blogjava.net/gembin/archive/2012/03/03/371166.html</guid><wfw:comment>http://www.blogjava.net/gembin/comments/371166.html</wfw:comment><comments>http://www.blogjava.net/gembin/archive/2012/03/03/371166.html#Feedback</comments><slash:comments>2</slash:comments><wfw:commentRss>http://www.blogjava.net/gembin/comments/commentRss/371166.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/gembin/services/trackbacks/371166.html</trackback:ping><description><![CDATA[<br />i got several objective-c &amp; iOS related books collected from the internet for sharing.<br /><br /><br />Hope u will like it.<br /><br /><img src="http://file.itpub.net/forum/201203/01/091659ezj22ekjlecejwjz.jpg" width="450" height="600" alt="" /><br /><br /><div><a href="http://115.com/file/ansjxv4t#">Apress.iPhone.and.iPad.Apps.for.Absolute.Beginners.iOS.5.Edition.Jan.2012.pdf<br /></a></div><br /><img src="http://file.itpub.net/forum/201203/01/011602xxsqsx9z2fxeas6q.jpg" width="450" height="590" alt="" /><br /><div></div><div><a href="http://115.com/file/c29z0k7h#">Apress.iOS.5.Recipes.Feb.2012.pdf</a></div><br /><br /><img src="http://file.itpub.net/forum/201202/04/092728zzn8zxkf66vmkli1.jpg" width="450" height="600" alt="" /><br /><br /><div><a href="http://115.com/file/e7qst4m2#">iOS_5_Essentials.pdf</a></div><br /><br /><img src="http://file.itpub.net/forum/201201/04/0845570ip8ig3kck5qqkkp.jpg" width="450" height="600" alt="" /><br /><br /><div><a href="http://115.com/file/e7qlzoqq#">Beginning_iOS_5_Games_Development.pdf<br /><br /></a></div><br /><img src="http://file.itpub.net/forum/201201/15/002906j54grudj6c2j8685.jpg" width="450" height="600" alt="" /><br /><br /><div><a href="http://115.com/file/e7qlhiw4#">OS_X_and_iOS_Kernel_Programming.pdf<br /><br /></a></div><br /><img src="http://file.itpub.net/forum/201201/26/100307kclsttpf774kvpls.jpg" width="450" height="600" alt="" /><br /><br /><div><a href="http://115.com/file/beps4msv#">Programming_iOS_5_2nd_Edition.pdf</a></div><br /><br /><img src="http://file.itpub.net/forum/201201/17/231452lozf2vzrpklyzlvl.jpg" width="450" height="600" alt="" /><br /><br /><div><a href="http://115.com/file/ansftwvr#">Pro_OpenGL_ES_for_iOS.pdf<br /><br /></a></div><br /><img src="http://file.itpub.net/forum/201202/01/004012llb0id0qoxldonn1.jpg" width="450" height="558" alt="" /><br /><br /><div></div><div><a href="http://115.com/file/ansft5f5#">Beginning.iOS.5.Development.Exploring.the.iOS.SDK.pdf</a></div><br /><img src="http://file.itpub.net/forum/201201/13/0059181mtmhxtgttthbftn.jpg" width="450" height="600" alt="" /><br /><br /><div></div><div><a href="http://115.com/file/c29x5wy0#">Pro_iOS_Web_Design_and_Development.pdf</a></div><br /><br /><img src="http://file.itpub.net/forum/201201/10/0100195pe5xs8xsdd3s8sf.jpg" width="450" height="600" alt="" /><br /><br /><div><a href="http://115.com/file/bepsoy27#">Pro_Core_Data_for_iOS_2nd_Edition.pdf<br /><br /></a></div><br /><img src="http://file.itpub.net/forum/201201/14/103509sdq08h666lw7dh3f.jpg" width="450" height="600" alt="" /><br /><br /><div><a href="http://115.com/file/bepsptza#">Pro_iOS_5_Augmented_Reality.pdf</a></div><br /><img src="http://file.itpub.net/forum/201201/14/085121ktj6yvebpl8jjl8d.jpg" width="450" height="600" alt="" /><br /><br /><div></div><div><a href="http://115.com/file/ansflnzb#">Pro_iOS_5_Tools.pdf</a></div><br /><img src="http://file.itpub.net/forum/201111/24/090307lvbv6kzrl0vck2i0.jpg" width="450" height="527" alt="" /><br /><br /><div></div><div><a href="http://115.com/file/dpq5dc6b#">Apress.Learn.cocos2d.Game.Development.with.iOS.5.Nov.2011.pdf<br /><br /></a></div><br /><img src="http://file.itpub.net/forum/itpub/attachment/month_1109/20110908_a0aa496f040d20db5dbbnTwCtbp8wnGw.jpg" width="450" height="600" alt="" /><br /><br /><div></div><div><a href="http://115.com/file/ansflsrw#">Xcode_4_iOS_Development.pdf</a></div><br /><br /><img src="http://file.itpub.net/forum/201111/26/080324xug90ouhtl0d6jd6.jpg" width="450" height="600" alt="" /><br /><br /><div></div><div><a href="http://115.com/file/bepswsjv#">Beginning_iOS_Game_Center_and_Game_Kit.pdf</a></div><br /><br /><img src="http://file.itpub.net/forum/201111/24/082330in8xagjigcxzxvii.jpg" width="450" height="528" alt="" /><br /><br /><div></div><div><a href="http://115.com/file/e7qljpzm#">Apress.Pro.iOS.Apps.Performance.Optimization.Nov.2011.pdf</a></div><br /><img src="http://file.itpub.net/forum/201111/25/082354q7qqjjo7qqyj5w95.jpg" width="450" height="658" alt="" /><br /><br /><div></div><div><a href="http://115.com/file/bepsl067#">Apress.iOS.Wow.Factor.Nov.2011.pdf</a></div><br /><br /><br /><img src="http://file.itpub.net/forum/itpub/attachment/month_1109/20110910_443c2622862703f6b93bAghq58CocK5I.jpg" width="450" height="600" alt="" /><br /><br /><div></div><div><a href="http://115.com/file/c29xe2am#">Developing_iOS_Applications_with_Flex_4.5.pdf<br /><br /></a></div><br /><img src="http://file.itpub.net/forum/itpub/attachment/day_110510/20110510_cb52aa13783779a4d5deJHzq7wa3M8M2.jpg" width="450" height="600" alt="" /><br /><div></div><div><a href="http://115.com/file/dpq5ka8s#">Graphics_and_Animation_on_iOS.pdf</a></div><br /><br /><img src="http://file.itpub.net/forum/itpub/attachment/day_110510/20110510_85cb2c848c11a4549238BT1TfpG60nKB.jpg" width="450" height="600" alt="" /><br /><br /><div><a href="http://115.com/file/dpq5lhqq#">Writing_Game_Center_Apps_in_iOS.pdf</a></div><br /><img src="http://file.itpub.net/forum/itpub/attachment/day_110327/20110327_67d873ccee66fd637235G0pBs65dhy6t.jpg" width="450" height="600" alt="" /><br /><br /><a href="http://115.com/file/ansf9zww#">Pro_Objective-C_Design_Patterns_for_iOS.pdf<br /><br /><br /></a>=====================================<br />= &nbsp;others<br />=====================================<br /><br /><div><a href="http://115.com/file/dpqibt0u#">Learn_Objective_C_on_the_Mac.pdf</a></div><div><a href="http://115.com/file/ansjwp1b#">Cocoa_and_Objective-C_Cookbook.pdf</a></div><div></div><div><a href="http://115.com/file/bepw9zdv#">Cocoa_and_Objective-C_up_and_running.pdf</a></div><div></div><div><a href="http://115.com/file/dpqivqkb#">Packtpub.Unity.iOS.Essentials.Dec.2011.pdf</a></div><div></div><div><a href="http://115.com/file/bepwc9pp#">iOS_4_in_Action.pdf<br /></a></div><a href="http://115.com/file/ansjee3t#">Learn_Objective-C_for_Java_Developers.pdf</a><div></div><div><a href="http://115.com/file/dpqibxxs#">Objective-C_Fundamentals.pdf<br /></a></div><div><a href="http://115.com/file/ansjw4ps#"><br /><br /><br /><br /><br /><br /></a></div><div><div></div></div><img src ="http://www.blogjava.net/gembin/aggbug/371166.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/gembin/" target="_blank">gembin</a> 2012-03-03 15:43 <a href="http://www.blogjava.net/gembin/archive/2012/03/03/371166.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Giulia  - Ce Frumoasa E Iubirea (爱情多美丽)</title><link>http://www.blogjava.net/gembin/archive/2012/01/21/368811.html</link><dc:creator>gembin</dc:creator><author>gembin</author><pubDate>Sat, 21 Jan 2012 03:21:00 GMT</pubDate><guid>http://www.blogjava.net/gembin/archive/2012/01/21/368811.html</guid><wfw:comment>http://www.blogjava.net/gembin/comments/368811.html</wfw:comment><comments>http://www.blogjava.net/gembin/archive/2012/01/21/368811.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/gembin/comments/commentRss/368811.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/gembin/services/trackbacks/368811.html</trackback:ping><description><![CDATA[<br />
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase=" http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="250" height="34"><param name="allowScriptAccess" value="sameDomain" /><param name="movie" value=" http://l.5sing.com/player.swf?songtype=fc&amp;songid=3865975" /><param name="quality" value="high" /><param name="bgcolor" value="#ffffff" /><embed src=" http://l.5sing.com/player.swf?songtype=fc&amp;songid=3865975" quality="high" bgcolor="#ffffff" width="250" height="34" allowscriptaccess="sameDomain" type="application/x-shockwave-flash" pluginspage=" http://www.macromedia.com/go/getflashplayer"></object>
<br />
<div>
<pre id="best-answer-content"  mb10"="" style="margin-top: 0px; margin-bottom: 10px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-family: Arial; white-space: pre-wrap; word-wrap: break-word; zoom: 1; line-height: 22px; background-color: #fffcf6; ">Ce frumoasa e iubirea 爱情多美丽 <br />
Fiecare clipa pictata-n roz, 每一分每一秒都涂成了玫瑰色 <br />
Tre'sa recunosc,iti apartine... 我必须得承认，这属于你 <br />
Si nici macar eu nu ma cunosc 我已无法认识自己 <br />
Asa cum ma stii pe mine.. 只有你了解真正的我 <br />
Ma tem uneori ca ai sa pleci 有时候我担心你将离去， <br />
Si nu vreau sa ma lasi fara tine...不要留下孤单的我 <br />
Iar eu nu sunt eu...而我已不是我， <br />
De fapt,fara tine,sunt nimeni...事实上，没有你，我也将无法存在 <br />
Refren: Ce frumoasa e iubirea ，爱情多美呀！ <br />
Cand ma alinti cu zambetul tau curat! 当你用纯洁的微笑爱抚我时 <br />
Ce frumoasa e iubirea 爱情多美呀 <br />
Cand tot ce spui devine adevarat!当你说的话成真的那一刻 <br />
(bis) <br />
<br />
Ficare clipa trecuta-n alb 白日里度过的每一刻 <br />
A insemna ca tu esti departe 告诉你已走远 <br />
Uneori ma intreb daca esti real 有时候我问自己你是否真的存在 <br />
Sau inchipuit din printr-o carte! 也许你只是书中的虚幻 <br />
Ma tem uneori ca ai sa pleci 有时担心你会离去 <br />
Si nu vreau sa ma lasi fara tine... 不要留下孤单的我 <br />
Iar eu nu sunt eu... 而我已不是我 <br />
De fapt,fara tine,sunt nimeni... 没有你，我也将不再存在 <br />
Refren: Ce frumoasa e iubirea 爱情多美呀 <br />
Cand ma alinti cu zambetul tau curat! 当你用纯洁的微笑爱抚我时 <br />
Ce frumoasa e iubirea 爱情多美呀 <br />
Cand tot ce spui devine adevarat! 当你的话语成真时 <br />
(bis) <br />
Ma cuprinzi incet..ma stangi la piept 慢慢将我拥入怀中 <br />
Imi spui ca nu..n-ai sa pleci prea curand... 对我说不。。。不要马上立开我 <br />
(bis) <br />
Refren: Ce frumoasa e iubirea 爱情多美呀 <br />
Cand ma alinti cu zambetul tau curat! 当你用纯洁的微笑爱抚我时 <br />
Ce frumoasa e iubirea 爱情多美呀 <br />
Cand tot ce spui devine adevarat! 当你的话语成真时<br />
(bis)</pre>
</div><img src ="http://www.blogjava.net/gembin/aggbug/368811.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/gembin/" target="_blank">gembin</a> 2012-01-21 11:21 <a href="http://www.blogjava.net/gembin/archive/2012/01/21/368811.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Mac Keyboard Shortcuts</title><link>http://www.blogjava.net/gembin/archive/2012/01/21/368798.html</link><dc:creator>gembin</dc:creator><author>gembin</author><pubDate>Fri, 20 Jan 2012 16:57:00 GMT</pubDate><guid>http://www.blogjava.net/gembin/archive/2012/01/21/368798.html</guid><wfw:comment>http://www.blogjava.net/gembin/comments/368798.html</wfw:comment><comments>http://www.blogjava.net/gembin/archive/2012/01/21/368798.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/gembin/comments/commentRss/368798.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/gembin/services/trackbacks/368798.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: &nbsp;Menu Symbols                           Menu Symbol             Key on Keyboard                               &nbsp;             Command/Apple Key (like Control on a PC)      ...&nbsp;&nbsp;<a href='http://www.blogjava.net/gembin/archive/2012/01/21/368798.html'>阅读全文</a><img src ="http://www.blogjava.net/gembin/aggbug/368798.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/gembin/" target="_blank">gembin</a> 2012-01-21 00:57 <a href="http://www.blogjava.net/gembin/archive/2012/01/21/368798.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>心理学英文词汇</title><link>http://www.blogjava.net/gembin/archive/2012/01/14/368493.html</link><dc:creator>gembin</dc:creator><author>gembin</author><pubDate>Sat, 14 Jan 2012 07:19:00 GMT</pubDate><guid>http://www.blogjava.net/gembin/archive/2012/01/14/368493.html</guid><wfw:comment>http://www.blogjava.net/gembin/comments/368493.html</wfw:comment><comments>http://www.blogjava.net/gembin/archive/2012/01/14/368493.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/gembin/comments/commentRss/368493.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/gembin/services/trackbacks/368493.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: 心理学 psychology心理现象 mental phenomenon心理过程 mental process心理状态 mental state心理活动 mental activity意识 consciousness心理维度 psychological dimension心理运动 psychomotor内部活动 internal activity普通心理学 general psychology实验...&nbsp;&nbsp;<a href='http://www.blogjava.net/gembin/archive/2012/01/14/368493.html'>阅读全文</a><img src ="http://www.blogjava.net/gembin/aggbug/368493.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/gembin/" target="_blank">gembin</a> 2012-01-14 15:19 <a href="http://www.blogjava.net/gembin/archive/2012/01/14/368493.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>