<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/atom10full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><feed xmlns="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearch/1.1/" xmlns:georss="http://www.georss.org/georss" xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr="http://purl.org/syndication/thread/1.0" gd:etag="W/&quot;CkANQXk4eSp7ImA9WhRWGU4.&quot;"><id>tag:blogger.com,1999:blog-9420660</id><updated>2012-01-07T18:06:30.731+08:00</updated><category term="linux" /><category term="CLI" /><category term="cvs" /><category term="java" /><category term="cygwin" /><category term="html5" /><category term="websocket" /><category term="gentoo" /><category term="interesting" /><category term="gwt" /><category term="xmlrpc" /><category term="django" /><category term="webgl" /><category term="oracle" /><category term="yaml" /><category term="firefox" /><category term="iphone" /><category term="blogger" /><category term="web2.0" /><category term="python" /><category term="thoughts" /><category term="mac" /><category term="qnap" /><category term="debian" /><category term="Hardware" /><category term="mac java" /><category term="vim" /><category term="eclipse" /><category term="mac tips" /><category term="google" /><title>Zarick's Blog | Incipio</title><subtitle type="html">pure tech stuff which matters~</subtitle><link rel="http://schemas.google.com/g/2005#feed" type="application/atom+xml" href="http://zarick.blogspot.com/feeds/posts/default" /><link rel="alternate" type="text/html" href="http://zarick.blogspot.com/" /><link rel="next" type="application/atom+xml" href="http://www.blogger.com/feeds/9420660/posts/default?start-index=26&amp;max-results=25&amp;redirect=false&amp;v=2" /><author><name>Zarick Lau</name><uri>http://www.blogger.com/profile/10752391210274843069</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://2.bp.blogspot.com/_cdYAScOA_Vs/SmH0njRAFnI/AAAAAAAABzY/O91stqmPIWQ/S220/hokkido" /></author><generator version="7.00" uri="http://www.blogger.com">Blogger</generator><openSearch:totalResults>48</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/atom+xml" href="http://feeds.feedburner.com/blogspot/incipio" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="blogspot/incipio" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><entry gd:etag="W/&quot;DkEEQnozcCp7ImA9WhdQEEo.&quot;"><id>tag:blogger.com,1999:blog-9420660.post-1358408462783451303</id><published>2011-03-20T19:36:00.006+08:00</published><updated>2011-08-11T22:56:43.488+08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-08-11T22:56:43.488+08:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="java" /><category scheme="http://www.blogger.com/atom/ns#" term="eclipse" /><title>Tips for improving Eclipse Performance</title><content type="html">&lt;div class="entry-section"&gt;
Eclipse is a great development platform. However it may seems getting slower and slower over time. While I believe real solution to performance problem only comes after correctly identify the actual root cause, doing an objective measurement, however, will take some time. Before actually spent time on perform serious profiling, I gathered some "Tips" through googling. The tips are re-organized and presented below.
&lt;/div&gt;
&lt;a name='more'&gt;&lt;/a&gt;&lt;div class="entry-section"&gt;
&lt;h4&gt;
 Tuning the Environment&lt;/h4&gt;
Tools only perform well if you put it on a properly configured environment. Tips below suggest different means to ensure the environment is properly tuned for development purpose. These tips are general enough to applicable on different development platforms.&lt;br /&gt;
&lt;h5&gt;
Disable anti-virus on demand scanning&lt;/h5&gt;
During clean, build, running test, and launching application application, lots of file is being read, class files are created (temporary) and a lot of library (jar) is being loaded as well.
Turning off On-demand scanning is the most important tips. &lt;br /&gt;
&lt;h5&gt;
Disable file index (for example: Win7/Vista file indexing)&lt;/h5&gt;
Eclipse will create a lot of output files, which have no sense to be indexed. Exclude these files from indexing.&lt;br /&gt;
&lt;h5&gt;
Putting JVM, and Eclipse install on RAM Disk&lt;/h5&gt;
By putting Eclipse and JDK on RAM Disk, Eclipse and JDK tools can be loaded more quickly.
&lt;br /&gt;
&lt;h5&gt;
Use the latest JDK and Eclipse&lt;/h5&gt;
Traditional wisdom. Always stay on the latest stable!
&lt;/div&gt;
&lt;div class="entry-section"&gt;
&lt;h4&gt;
Eclipse Startup Configuration&lt;/h4&gt;
Another kind of tips involve fine tuning the Eclipse start up configuration. To a certain extents, this is a matter of arts, as the correct configuration may vary from case to case and requires in-depth knowledge on how JVM work.
&lt;br /&gt;
&lt;h5&gt;
Explicitly define the version of JDK to use, and point directly to the DLL instead of a Java Home directory.&lt;/h5&gt;
In the configuration, use the "-vm" parameter to points to the jvm.dll directly:
&lt;br /&gt;
&lt;pre class="brush: plain"&gt;-vm
C:/Program Files/Java/jdk1.6.0_24/jre/bin/server/jvm.dll
&lt;/pre&gt;
This brings the following advantages:
&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;Splash screen coming up sooner.&lt;/li&gt;
&lt;li&gt;Eclipse.exe in the process list instead of java.exe.&lt;/li&gt;
&lt;li&gt;Firewalls: Eclipse wants access to the Internet instead of java.&lt;/li&gt;
&lt;li&gt;Window management branding issues, especially on Windows and Mac.&lt;/li&gt;
&lt;/ul&gt;
This tips can be found on various StackOverflow post, and one of the &lt;a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=188968"&gt;Bugzilla entry on Eclipse&lt;/a&gt;
&lt;br /&gt;
&lt;h5&gt;
Tuning the Heap size and GC parameters&lt;/h5&gt;
Depending on the size of the workspace, Eclipse should be given sufficient heap space. When large heap space is required, we also need to ensure a good GC and configuration is used.
&lt;br /&gt;
The following is a proposed &lt;a href="http://stackoverflow.com/questions/142357/what-are-the-best-jvm-settings-for-eclipse"&gt;solution&lt;/a&gt; by &lt;strong&gt;VonC&lt;/strong&gt; on StackOverflow:
&lt;br /&gt;
&lt;pre class="brush: plain"&gt;-Xms128m
-Xmx384m
-Xss4m
-XX:PermSize=128m
-XX:MaxPermSize=384m
-XX:CompileThreshold=5
-XX:MaxGCPauseMillis=10
-XX:MaxHeapFreeRatio=70
-XX:+CMSIncrementalPacing
-XX:+UnlockExperimentalVMOptions
-XX:+UseG1GC
-XX:+UseFastAccessorMethods
&lt;/pre&gt;
&lt;/div&gt;
&lt;div class="entry-section"&gt;
&lt;h4&gt;
Eclipse User Preference &lt;/h4&gt;
In Eclipse user preference, some functions may not be useful in every situation. As a result, the following options may worth spending time to fine tuned.
&lt;br /&gt;
&lt;h5&gt;
Disable unused options on Eclipse&lt;/h5&gt;
Following options may have little use, consider turning it off
&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;Label Decoration&lt;/li&gt;
&lt;li&gt;Validators (Some validator may have nothing to do with the project you are working on)&lt;/li&gt;
&lt;li&gt;UI fancy stuff&lt;/li&gt;
&lt;li&gt;Disable unused content assists (For example, disable SWT proposal if you are not working on SWT based project)&lt;/li&gt;
&lt;/ul&gt;
&lt;h5&gt;
Avoid too many local history&lt;/h5&gt;
If version control system is deployed and used properly, a short local history is sufficient is most case.
&lt;br /&gt;
&lt;h5&gt;
Close unused View and use correct perspective&lt;/h5&gt;
Unused perspective take some memory, unused view will take sometime to refresh without any added-value.
&lt;br /&gt;
&lt;h5&gt;
Disable unused plugins&lt;/h5&gt;
This is controversial, as some people reported that, Eclipse load plugin lazily, so disable it doesn't bring too much benefits.
&lt;/div&gt;
&lt;div class="entry-section"&gt;
&lt;h4&gt;
Misc Tips&lt;/h4&gt;
Apart from the three categories of tips, one more tips looks useful as well:
&lt;br /&gt;
&lt;h5&gt;
Keep Eclipse clean without out-dated or broken meta-data&lt;/h5&gt;
Start eclipse with the parameter:
&lt;br /&gt;
&lt;pre class="brush: plain"&gt;eclipse -clean
&lt;/pre&gt;
The details for this parameter is can be found &lt;a href="http://wiki.eclipse.org/Eclipse.ini"&gt;Eclipse Wiki&lt;/a&gt;, and further explained at &lt;a href="http://www.eclipsezone.com/eclipse/forums/t61566.html"&gt;EclipseZone&lt;/a&gt;.
&lt;/div&gt;
&lt;div class="entry-section"&gt;
&lt;h4&gt;
Reference&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="http://wiki.eclipse.org/Eclipse.ini"&gt;Eclipse.ini&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://help.eclipse.org/helios/index.jsp?topic=/org.eclipse.platform.doc.isv/reference/misc/runtime-options.html"&gt;Eclipse Runtime Options&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://stackoverflow.com/questions/142357/what-are-the-best-jvm-settings-for-eclipse"&gt;StackOverflow - What are the best JVM settings for Eclipse&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://stackoverflow.com/questions/316265/tricks-to-speed-up-eclipse"&gt;StackOverflow - Tricks to speed up Eclipse&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.pakkatechies.com/2011/07/making-eclipse-ide-faster.html"&gt;Making Eclipse IDE Faster&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.eclipsezone.com/eclipse/forums/t61566.html"&gt;Keeping Eclipse Running Clean&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;h4&gt;
Disclaimer&lt;/h4&gt;
Tips in this post are merely an recap from other peoples. I personally haven't tested all of the tips above (when I try it out latter, I'll keep posting update if the tips is not correct.).
As a result, take it at your own risk.
&lt;/div&gt;
&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9420660-1358408462783451303?l=zarick.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://zarick.blogspot.com/feeds/1358408462783451303/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=9420660&amp;postID=1358408462783451303" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/9420660/posts/default/1358408462783451303?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/9420660/posts/default/1358408462783451303?v=2" /><link rel="alternate" type="text/html" href="http://zarick.blogspot.com/2011/03/tips-for-improving-eclipse-performance.html" title="Tips for improving Eclipse Performance" /><author><name>Zarick Lau</name><uri>http://www.blogger.com/profile/10752391210274843069</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://2.bp.blogspot.com/_cdYAScOA_Vs/SmH0njRAFnI/AAAAAAAABzY/O91stqmPIWQ/S220/hokkido" /></author><thr:total>0</thr:total></entry><entry gd:etag="W/&quot;DkQEQ3o-cCp7ImA9Wx9RFks.&quot;"><id>tag:blogger.com,1999:blog-9420660.post-265667976478211268</id><published>2010-12-18T17:25:00.000+08:00</published><updated>2010-12-18T17:25:02.458+08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-12-18T17:25:02.458+08:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="linux" /><category scheme="http://www.blogger.com/atom/ns#" term="cygwin" /><category scheme="http://www.blogger.com/atom/ns#" term="CLI" /><title>The best CLI tools all the time</title><content type="html">&lt;div&gt;
Every December, each geeky website will prepare "Best Windows/Mac Software of 20xx".
Why there is not a "Best CLI Tools All the Time" article?
&lt;/div&gt;

&lt;div&gt;
Why not "Best CLI Tools of 20xx"? Sorry, there would not be too useful to have such a list every year. As good CLI goods all survive throughout years. Ever since I know the use of ssh, it keeps to top on my list. What software allow you to forward whatever port you like and execute commands on different hosts?
&lt;/div&gt;

&lt;div&gt;
While "Best CLI Tools All the TIme" comes to be head, I googled an interesting site:
&lt;a href="http://www.commandlinefu.com/"&gt;http://www.commandlinefu.com/&lt;/a&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9420660-265667976478211268?l=zarick.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://zarick.blogspot.com/feeds/265667976478211268/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=9420660&amp;postID=265667976478211268" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/9420660/posts/default/265667976478211268?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/9420660/posts/default/265667976478211268?v=2" /><link rel="alternate" type="text/html" href="http://zarick.blogspot.com/2010/12/best-cli-tools-all-time.html" title="The best CLI tools all the time" /><author><name>Zarick Lau</name><uri>http://www.blogger.com/profile/10752391210274843069</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://2.bp.blogspot.com/_cdYAScOA_Vs/SmH0njRAFnI/AAAAAAAABzY/O91stqmPIWQ/S220/hokkido" /></author><thr:total>0</thr:total></entry><entry gd:etag="W/&quot;CkAMRXs9eyp7ImA9Wx9UFEg.&quot;"><id>tag:blogger.com,1999:blog-9420660.post-7438593198128422392</id><published>2010-12-11T22:52:00.001+08:00</published><updated>2011-02-12T02:59:44.563+08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-02-12T02:59:44.563+08:00</app:edited><title>Does Dynamic Programming Languages more Productive for Web Development?</title><content type="html">&lt;div&gt;
While Dynamic Programming Languages like Python and Groovy are hot topics in recent years.
Surprisingly, there is not a clear definition for "Dynamic Programming
Language". So, what "Dynamic Programming Language" refers to and does it really
helps to spped your next web application?
&lt;/div&gt;

&lt;a name='more'&gt;&lt;/a&gt;

&lt;div&gt;
  &lt;h4&gt;Dynamic Programming Language&lt;/h4&gt;

  &lt;p&gt;
  In general, dynamic programming language refers to the languages which exhibits the following nature:
  &lt;ul&gt;
    &lt;li&gt;Dynamical Typing support&lt;/li&gt;
    &lt;li&gt;Meta-programming support&lt;/li&gt;
    &lt;li&gt;Support for functional-programming&lt;/li&gt;
    &lt;li&gt;Support for aspect-orient features&lt;/li&gt;
  &lt;/ul&gt;
  &lt;/p&gt;

  &lt;p&gt;
  And most likely, all the three dynamic languages mentioned above have the following natures:
  &lt;ul&gt;
    &lt;li&gt;Intrepreted&lt;/li&gt;
    &lt;li&gt;Web Application Framework support rapid application development, usually emphasis convention over configuration&lt;/li&gt;
  &lt;/ul&gt;
  &lt;/p&gt;

  &lt;p&gt;
  How does these features is considered a good thing?
  Below, I'll use Groovy, Python as the examples to demostrate the capability of these language on traditional / mainstream language like Java.
  &lt;/p&gt;


&lt;/div&gt;

&lt;div&gt;
  &lt;h4&gt;Dynamic Typing Support&lt;/h4&gt;

  &lt;p&gt;
  Through automatic type coercion, dynamic languages like Groovy free you statically defining type.
  &lt;/p&gt;

&lt;/div&gt;

&lt;div&gt;
  &lt;h4&gt;Metaprogramming Support&lt;/h4&gt;

  &lt;p&gt;
  Metaprogramming is the foundation for all kinds of fancy features in this new language.
  For example, we can easily use Metaprogramming to implement dynamic proxy or implement mixin,
  all these are traditionally hard to implements.
  &lt;/p&gt;

&lt;/div&gt;


&lt;div&gt;
  &lt;h4&gt;Functional Programming&lt;/h4&gt;

  &lt;p&gt;
  Groovy provide closure. While in Python, lamba, map and reduce is built-in functionI, in additionsl
  and method is just another object in Python. All this allow programmer easily define template
  and as well as implementing some logic in functional style.
  &lt;/p&gt;
&lt;/div&gt;

&lt;div&gt;
  &lt;h4&gt;Aspect Oriented Programming&lt;/h4&gt;

  &lt;p&gt;
  Usually through the support of the meta-programming facility, implementing AOP in dynamic language
  is relatively much easily.
  For example, in Groovy, Meta Object Protocol provide tonless means to injecting / intercepting
  method join, which is one of most commonly use case of AOP.
  In Python, new style class and decorator provides similar kind of foundation for injecting extra functions.
  &lt;/p&gt;
&lt;/div&gt;


&lt;div&gt;
  &lt;h4&gt;Intrepret Language&lt;/h4&gt;

  &lt;p&gt;
  Intrepret nature, in other words, new code can be compiled at runtime can greatly save the development time
  and improving the turn around for each cycle.
  This seems a by-product of the dynamic language. Contrary to tradional language which rely on compiling linking,
  dynamic language usuing resolve the method at runtime, it also allow each file can individually updated, without
  re-compiling the whole package / module.
  &lt;/p&gt;
&lt;/div&gt;


&lt;div&gt;
  &lt;h4&gt;Frameowkr which favors Convention over Configuration&lt;/h4&gt;

  &lt;p&gt;
  Interesting, all these new language also accompanied with new web application framework which emphais convention over configuration.
  For example, there is Grails (on Groovy) and Django (on Python).
  These framework allow developers create new function without paying too much tax on the configuration.
  &lt;/p&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9420660-7438593198128422392?l=zarick.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://zarick.blogspot.com/feeds/7438593198128422392/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=9420660&amp;postID=7438593198128422392" title="2 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/9420660/posts/default/7438593198128422392?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/9420660/posts/default/7438593198128422392?v=2" /><link rel="alternate" type="text/html" href="http://zarick.blogspot.com/2010/12/does-dynamic-programming-languages-more.html" title="Does Dynamic Programming Languages more Productive for Web Development?" /><author><name>Zarick Lau</name><uri>http://www.blogger.com/profile/10752391210274843069</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://2.bp.blogspot.com/_cdYAScOA_Vs/SmH0njRAFnI/AAAAAAAABzY/O91stqmPIWQ/S220/hokkido" /></author><thr:total>2</thr:total></entry><entry gd:etag="W/&quot;CkAGR3k8fip7ImA9Wx9UFEg.&quot;"><id>tag:blogger.com,1999:blog-9420660.post-2343946590773572326</id><published>2010-12-11T22:16:00.001+08:00</published><updated>2011-02-12T02:58:46.776+08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-02-12T02:58:46.776+08:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="java" /><title>StAX - Streaming API for XML</title><content type="html">&lt;div&gt;
StAX, is a Java processing XML API which allow software to processing XML stream 
in a push streaming style. In certain scenario, StAX will be the most efficient 
approach for prcoessing XML stream. This article aims to provide an overview on 
this API as well as comparison with two other commonly used APIs: DOM and SAX.
&lt;/div&gt;

&lt;a name='more'&gt;&lt;/a&gt;

&lt;div&gt;
  &lt;h4&gt;Background&lt;/h4&gt;

  &lt;p&gt;
  &lt;a href="http://en.wikipedia.org/wiki/StAX"&gt;StAX&lt;/a&gt;, is defined by 
  &lt;a href="http://jcp.org/en/jsr/detail?id=173"&gt;JSR 173&lt;/a&gt;. The API is initially 
  provided by some industry vendor including Oracle, and BEA and finally becomes a JSR.
  Starting from JDK 6, it is already 
  &lt;a href="http://www.oracle.com/technetwork/java/javase/features-141434.html"&gt;included 
  in JDK&lt;/a&gt; as a part of the standard Java XML processing API (JAXP).
  &lt;/p&gt;

  &lt;p&gt;
  With the advent of all kind of XML API, high level (and developer friendly) tools like 
  &lt;a href="http://jaxb.java.net/"&gt;JAXB&lt;/a&gt; and 
  &lt;a href="http://xstream.codehaus.org/"&gt;XStream&lt;/a&gt; can be very handy for 
  XML writing / reading. In certain situation, however, it would be desirable 
  to implement the processing logic with lower level XML processing API.
  For example, consider implementing a XML message router, there is no need 
  to process the whole message in order to perform the routing.
  Unmarshalling a XML message with JAXB or XStream, or even DOM 
  will not be an efficient approach. In contrary, the best handling may be only process
  the header, decide the routing and dispatch the message without 
  processing the whole XML message.
  &lt;/p&gt;

&lt;/div&gt;



&lt;div&gt;
  &lt;h4&gt;Push Streaming XML Processing&lt;/h4&gt;

  So StAX is a "Push" and "Streaming" API for XML processing. What does it actually means.
  Example below can help to illustrate these two idea.
  Let's say there is simple XML message looks like this:

  &lt;pre class="brush: xml"&gt;
  &amp;lt;words a=&amp;quot;123&amp;quot;&amp;gt;
    &amp;lt;word/&amp;gt;
    &amp;lt;word&amp;gt;Apple&amp;amp;amp;Orange&amp;lt;/word&amp;gt;
    &amp;lt;!-- comment --&amp;gt;
  &amp;lt;/words&amp;gt;
  &lt;/pre&gt;

  And below is a simple code snipplet demostrate how StAX API can be used:
  &lt;pre class="brush: java"&gt;
  XMLEventReader reader = XMLInputFactory.newFactory().createXMLEventReader(inputStream);
  while (reader.hasNext()) {
   XMLEvent e = reader.nextEvent();
   String eventType = &amp;quot;N/A&amp;quot;;
   switch (e.getEventType()) {
    case XMLEvent.START_DOCUMENT:
     eventType = &amp;quot;START_DOCUMENT&amp;quot;;
     break;
    case XMLEvent.END_DOCUMENT:
     eventType = &amp;quot;END_DOCUMENT&amp;quot;;
     break;
    case XMLEvent.START_ELEMENT:
     eventType = &amp;quot;START_ELEMENT&amp;quot;;
     break;
    case XMLEvent.END_ELEMENT:
     eventType = &amp;quot;END_ELEMENT&amp;quot;;
     break;
    case XMLEvent.CHARACTERS:
     eventType = &amp;quot;CHARACTERS&amp;quot;;
     break;
    case XMLEvent.COMMENT:
     eventType = &amp;quot;COMMENT&amp;quot;;
     break;
   }
   System.out.println(eventType + &amp;quot;:&amp;quot; + e.toString());
  }
  &lt;/pre&gt;

  Executing the sniplet above will generate be following output below:
  &lt;pre class="brush: plain"&gt;
  START_DOCUMENT:&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding='null' standalone='no'?&amp;gt;
  START_ELEMENT:&amp;lt;words a='123'&amp;gt;
  CHARACTERS:
    
  START_ELEMENT:&amp;lt;word&amp;gt;
  END_ELEMENT:&amp;lt;/word&amp;gt;
  CHARACTERS:
    
  START_ELEMENT:&amp;lt;word&amp;gt;
  CHARACTERS:Apple
  CHARACTERS:&amp;amp;
  CHARACTERS:Orange
  END_ELEMENT:&amp;lt;/word&amp;gt;
  CHARACTERS:
    
  COMMENT:&amp;lt;!-- comment --&amp;gt;
  CHARACTERS:

  END_ELEMENT:&amp;lt;/words&amp;gt;
  END_DOCUMENT:ENDDOCUMENT

  &lt;/pre&gt;

  &lt;p&gt;
  In this example, XmlEventReader, one of primary interface in StAX is used. XmlEventReader provides the
  &lt;strong&gt;nextNext()&lt;/strong&gt; and &lt;strong&gt;next()&lt;/strong&gt; method.
  XMLEventReader can be viewed as a reader, which will parse the XML stream.
  XMLEventReader will parse and returnn an XMLEventReader upon each &lt;strong&gt;next()&lt;/strong&gt; call.
  The API is similar to the Java collections API. However, in StAX, what is being iterate is not a collection of items,
  but a series of XML processing Event.
  &lt;/p&gt;

  &lt;p&gt;
  XMLEvent in StAX refers to the various event when a parser is paring a XML stream.
  When the XML parser start parsing an XML document, it will return an Event to represent the start of document (START_DOCUMENT).
  When it proceed parsing, it will encounter the start of an XML element (START_ELEMENT), that is the &lt;strong&gt;&amp;lt;words&amp;gt;&lt;/strong&gt; node.
  Similarlly, when the parser encounters some TEXT data (including whitespace and new line between two XML tag), it will report it as a Character event.
  When it recognize an end of tag (like &lt;strong&gt;&amp;lt;/words&amp;gt;&lt;/strong&gt; it will report it as an end of element event (END_ELEMENT).
  And finally, when it found that the parsing is finished, it will report an End of Document event (END_DOCUMENT).
  &lt;/p&gt;

  &lt;p&gt;
  In other words, in StAX, application will handle the stream of XML event. In additions, with StAX, application will proactively control the parsing.
  XMLEventReader will not do the parsing unless the "next()" is called. Everything "next()" is called, the XML parsing continue and stop when XML event
  is created and the event will then returned to the application.
  Application using StAX can decide whether it should read up the whole document, or pause after traversing the beginging portion of the XML stream.
  &lt;/p&gt;

&lt;/div&gt;


&lt;div&gt;
  &lt;h4&gt;XMLStreamReader and XMLEventReader&lt;/h4&gt;

  In StAX, two interface is provided: XMLStreamReader and XMLEventReader. The conceptual use of this two are basically the same.
  Software will use the "hasNext()" and "next()" to control the parsing. The main key difference is, with XMLEventReader
  each next() will return an event which encapsulate the XML parsing event.
  With XMLStreamReader, next() call will return the event type.
  To access the details (like the XML element name and attribute contents), we need to use various accessor methods
  on the XMLStreamReader to retrieve the information.

  The sample code below will try to parse an XML message and return a Message object to represent the message.
  The code below will demostrate how XMLEventReader and XMLStreamReader can be used to implements MessageReader interface.
  
  Consider the XML message below:
  &lt;pre class="brush: xml"&gt;
  &amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot;?&amp;gt;
  &amp;lt;mf:message xmlns:mf=&amp;quot;http://www.nixstyle.net/lab/xml/message-router&amp;quot;&amp;gt;
    &amp;lt;mf:header&amp;gt;
      &amp;lt;mf:source&amp;gt;z33220011z&amp;amp;amp;gmail.com&amp;lt;/mf:source&amp;gt;
      &amp;lt;mf:destination&amp;gt;a77662233a&amp;amp;amp;gmail.com&amp;lt;/mf:destination&amp;gt;
    &amp;lt;/mf:header&amp;gt;
    &amp;lt;mf:content&amp;gt;
      &amp;lt;xyz:message xmlns:xyz=&amp;quot;http://www.nixstyle.net/lab/xml/message-sample&amp;quot;&amp;gt;Yo!&amp;lt;/xyz:message&amp;gt;
    &amp;lt;/mf:content&amp;gt;
  &amp;lt;/mf:message&amp;gt;
  &lt;/pre&gt;

  Below is a MessageReader interface
  &lt;pre class="brush: java"&gt;
  public interface MessageReader {
  &amp;nbsp;&amp;nbsp;Message next() throws XMLStreamException;
  }
  &lt;/pre&gt;
  
  Below is an implementation of MessageReader using XMLEventReader
  &lt;pre class="brush: java"&gt;
  &amp;nbsp;&amp;nbsp;public Message next() throws XMLStreamException {
  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;XMLEvent event = reader.nextTag();
  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;expectStartOfElement(event, &amp;quot;message&amp;quot;);
  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;return parseMessage();
  &amp;nbsp;&amp;nbsp;}

  &amp;nbsp;&amp;nbsp;private Message parseMessage() throws XMLStreamException {
  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Message message = new Message();
  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;XMLEvent event = reader.nextTag();
  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;parseMessageHeader(event, message);
  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;event = reader.nextTag();
  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;parseMessageContent(event, message);
  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;return message;
  &amp;nbsp;&amp;nbsp;}

  &amp;nbsp;&amp;nbsp;private void parseMessageContent(XMLEvent event, Message message) throws XMLStreamException {
  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;expectStartOfElement(event, &amp;quot;content&amp;quot;);
  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;while (!isEndOfElement(event, &amp;quot;content&amp;quot;)) {
  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;event = reader.nextEvent();
  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}
  &amp;nbsp;&amp;nbsp;}

  &amp;nbsp;&amp;nbsp;private void parseMessageHeader(XMLEvent event, Message message) throws XMLStreamException {

  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;String source = null;
  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;String destination = null;

  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;expectStartOfElement(event, &amp;quot;header&amp;quot;);

  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;while (source == null || destination == null) {

  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;XMLEvent nextTag = reader.nextTag();
  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (nextTag.isStartElement()) {

  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (&amp;quot;source&amp;quot;.equals(nextTag.asStartElement().getName().getLocalPart())) {
  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;source = reader.getElementText();
  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}

  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (&amp;quot;destination&amp;quot;.equals(nextTag.asStartElement().getName().getLocalPart())) {
  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;destination = reader.getElementText();
  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}
  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}

  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}

  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;message.setSource(source);
  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;message.setDestination(destination);

  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;XMLEvent next = reader.nextTag();
  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;moveToNextEndElement(next, &amp;quot;header&amp;quot;);

  &amp;nbsp;&amp;nbsp;}

  &amp;nbsp;&amp;nbsp;private void moveToNextEndElement(XMLEvent event, String elementName) throws XMLStreamException {
  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;while (!isEndOfElement(event, elementName)) {
  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (reader.hasNext()) {
  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;event = reader.nextTag();
  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;} else {
  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;throw new RuntimeException(&amp;quot;Unexpected stream&amp;quot;);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}
  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}
  &amp;nbsp;&amp;nbsp;}
  &amp;nbsp;&amp;nbsp;
  &amp;nbsp;&amp;nbsp;private void expectStartOfElement(XMLEvent event, String elementName) throws XMLStreamException {
  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (!isStartOfElement(event, elementName)) {
  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;throw new RuntimeException(&amp;quot;Unexpected stream&amp;quot;);
  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}
  &amp;nbsp;&amp;nbsp;}
  &amp;nbsp;&amp;nbsp;
  &amp;nbsp;&amp;nbsp;private boolean isStartOfElement(XMLEvent event, String elementName) throws XMLStreamException {
  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (event.isStartElement()) {
  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;return event.asStartElement().getName().getLocalPart().equals(elementName);
  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}
  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;return false;
  &amp;nbsp;&amp;nbsp;}

  &amp;nbsp;&amp;nbsp;private boolean isEndOfElement(XMLEvent event, String elementName) throws XMLStreamException {
  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (event.isEndElement()) {
  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;return event.asEndElement().getName().getLocalPart().equals(elementName);
  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}
  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;return false;
  &amp;nbsp;&amp;nbsp;}
  &lt;/pre&gt;

  Below is an implementation of MessageReader using XMLStreamReader
  &lt;pre class="brush: java"&gt;
  &amp;nbsp;&amp;nbsp;public Message next() throws XMLStreamException {
  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Message message = null;
  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;while (reader.hasNext()) {
  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;int eventCode = reader.next();
  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (eventCode == XMLStreamConstants.START_ELEMENT) {
  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;String elementName = reader.getLocalName();
  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (&amp;quot;message&amp;quot;.equals(elementName)) {
  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;message = parseMessage();
  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}
  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}
  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}
  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;return message;
  &amp;nbsp;&amp;nbsp;}

  &amp;nbsp;&amp;nbsp;private Message parseMessage() throws XMLStreamException {
  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Message message = new Message();
  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;int nextTag = reader.nextTag();
  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (nextTag == XMLStreamConstants.START_ELEMENT) {
  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (&amp;quot;header&amp;quot;.equals(reader.getLocalName()) == false) {
  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;throw new RuntimeException(&amp;quot;Unexpected stream&amp;quot;);
  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}
  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;parseMessageHeader(message);
  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}
  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;nextTag = reader.nextTag();
  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (nextTag == XMLStreamConstants.START_ELEMENT) {
  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (&amp;quot;content&amp;quot;.equals(reader.getLocalName()) == false) {
  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;throw new RuntimeException(&amp;quot;Unexpected stream&amp;quot;);
  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}
  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;parseMessageContent(message);
  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}
  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;return message;
  &amp;nbsp;&amp;nbsp;}

  &amp;nbsp;&amp;nbsp;private void parseMessageContent(Message message) throws XMLStreamException {
  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (reader.getLocalName().equals(&amp;quot;content&amp;quot;) == false) {
  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;throw new RuntimeException(&amp;quot;Unexpected stream&amp;quot;);
  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}

  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;while (!isEndOfElement(&amp;quot;content&amp;quot;)) {
  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;reader.next();
  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}
  &amp;nbsp;&amp;nbsp;}

  &amp;nbsp;&amp;nbsp;private void parseMessageHeader(Message message) throws XMLStreamException {

  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;String source = null;
  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;String destination = null;

  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;expectStartOfElement(&amp;quot;header&amp;quot;);

  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;while (source == null || destination == null) {

  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;int nextTag = reader.nextTag();

  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (nextTag == XMLStreamConstants.START_ELEMENT) {

  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (&amp;quot;source&amp;quot;.equals(reader.getLocalName())) {
  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;source = extractText();
  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;moveToNextEndElement(&amp;quot;source&amp;quot;);
  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}

  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (&amp;quot;destination&amp;quot;.equals(reader.getLocalName())) {
  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;destination = extractText();
  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;moveToNextEndElement(&amp;quot;destination&amp;quot;);
  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}

  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}
  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}

  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (reader.nextTag() != XMLStreamConstants.END_ELEMENT) {
  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;throw new RuntimeException(&amp;quot;Unexpected stream&amp;quot;);
  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}

  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;message.setSource(source);
  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;message.setDestination(destination);

  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;moveToNextEndElement(&amp;quot;header&amp;quot;);

  &amp;nbsp;&amp;nbsp;}


  &amp;nbsp;&amp;nbsp;private String extractText() throws XMLStreamException {
  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;while (!isStartOfText()) {
  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;reader.next();
  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}
  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;return reader.getText();
  &amp;nbsp;&amp;nbsp;}

  &amp;nbsp;&amp;nbsp;private void moveToNextEndElement(String elementName) throws XMLStreamException {
  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;while (!isEndOfElement(elementName)) {
  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (reader.hasNext()) {
  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;reader.next();
  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;} else {
  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;throw new RuntimeException(&amp;quot;Unexpected stream&amp;quot;);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}
  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}
  &amp;nbsp;&amp;nbsp;}

  &amp;nbsp;&amp;nbsp;private void expectStartOfElement(String elementName) {
  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (!isStartOfElement(elementName)) {
  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;throw new RuntimeException(&amp;quot;Unexpected stream&amp;quot;);
  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}
  &amp;nbsp;&amp;nbsp;}

  &amp;nbsp;&amp;nbsp;private boolean isStartOfElement(String elementName) {
  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (reader.getEventType() == XMLStreamConstants.START_ELEMENT) {
  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;return reader.getLocalName().equals(elementName);
  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}
  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;return false;
  &amp;nbsp;&amp;nbsp;}

  &amp;nbsp;&amp;nbsp;private boolean isEndOfElement(String elementName) {
  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (reader.getEventType() == XMLStreamConstants.END_ELEMENT) {
  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;return reader.getLocalName().equals(elementName);
  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}
  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;return false;
  &amp;nbsp;&amp;nbsp;}

  &amp;nbsp;&amp;nbsp;private boolean isStartOfText() {
  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;switch (reader.getEventType()) {
  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;case XMLStreamConstants.CDATA:
  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;case XMLStreamConstants.CHARACTERS:
  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;return true;
  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}
  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;return false;
  &amp;nbsp;&amp;nbsp;}
  &lt;/pre&gt;

  &lt;p&gt;
  In the sniplets shown above, XMLEventReader and XMLStreamReader is both used.
  The key difference is, XMLEventReader return an XMLEvent which provide a little bit
  Object oriented interface for accessing the XML event details. With XMLStreamReader, 
  the accessor method like &lt;strong&gt;getText()&lt;/strong&gt; and &lt;strong&gt;getLocalName()&lt;/strong&gt;
  is only available on the XMLStreamReader interface.
  As a result, XMLEventReader is usually the preferred approach.
  &lt;/p&gt;

&lt;/div&gt;

&lt;div&gt;
  &lt;h4&gt;Compare with SAX and DOM&lt;/h4&gt;

&lt;p&gt;
  When comparing StAX with SAX, the most notable difference will be the control of the parsing.
  With SAX, the application can only provide a callback to handle the event.
  Once the parsing is started, parser will continue parsing the whole stream.
  The application will have no control on the parsing, for example, terminte the parsing after
  processing a message header.
&lt;/p&gt;

&lt;p&gt;
  When compare with DOM, the difference is more significant. When processing XML using DOM,
  the object model representing the whole XML structure will be constructed. 
  When the XML message size is huge, it may be inefficient for building the whole DOM tree.
  Especially, most of the time, application will convert an XML into some kind of POJO.
  In contrary, using streaming API like StAX can eliminate the needs to building the
  DOM tree in memory.
&lt;/p&gt;

&lt;p&gt;
  On the other hand, if all the application need is performing some analysis on the 
  XML stream, only building a DOM and manipulate with DOM tree will make more sense.
&lt;/p&gt;

&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9420660-2343946590773572326?l=zarick.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel="related" href="http://jcp.org/en/jsr/detail?id=173" title="StAX - Streaming API for XML" /><link rel="replies" type="application/atom+xml" href="http://zarick.blogspot.com/feeds/2343946590773572326/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=9420660&amp;postID=2343946590773572326" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/9420660/posts/default/2343946590773572326?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/9420660/posts/default/2343946590773572326?v=2" /><link rel="alternate" type="text/html" href="http://zarick.blogspot.com/2010/12/stax-streaming-api-for-xml.html" title="StAX - Streaming API for XML" /><author><name>Zarick Lau</name><uri>http://www.blogger.com/profile/10752391210274843069</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://2.bp.blogspot.com/_cdYAScOA_Vs/SmH0njRAFnI/AAAAAAAABzY/O91stqmPIWQ/S220/hokkido" /></author><thr:total>0</thr:total></entry><entry gd:etag="W/&quot;Ck8AQHozfip7ImA9Wx9UFEg.&quot;"><id>tag:blogger.com,1999:blog-9420660.post-6713924729954209058</id><published>2010-12-07T23:43:00.002+08:00</published><updated>2011-02-12T03:00:41.486+08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-02-12T03:00:41.486+08:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="yaml" /><title>YAML - YAML Ain't Markup Language</title><content type="html">&lt;div&gt;
&lt;a href="http://www.yaml.org/"&gt;YAML&lt;/a&gt;, which stands for "YAML Ain't Markup Languge", is a
&lt;a href="http://en.wikipedia.org/wiki/Data_serialization"&gt;data serialization format&lt;/a&gt;,
which can be used to represent data or message.
&lt;/div&gt;

&lt;div&gt;
This article provide a background on YAML as well as a comparison between YAML and XML using the Maven POM as a example.
&lt;/div&gt;

&lt;a name='more'&gt;&lt;/a&gt;

&lt;div&gt;
&lt;h4&gt;What is YAML?&lt;/h4&gt;
&lt;div&gt;
While there are &lt;a href="http://en.wikipedia.org/wiki/Comparison_of_data_serialization_formats"&gt;
many of data serialization format&lt;/a&gt;, the strengths of YAML is the focus on human
readability and still provide rich constructs for representing different data structure.
&lt;/div&gt;

&lt;div&gt;
In YAML, each data stream can consists of multiple YAML data, each data is separated by the '---'
marker. And '...' can be used to signal an end of stream. Hash prompt '#' is used to start an
comments which ended by the end-of-line. Data in YAML can be represented in three different ways:
Scalar, Associative Array and Sequence.
&lt;/div&gt;

&lt;div&gt;
For associative array (aka Map), it can be represented in this way:
&lt;pre class="brush: plain"&gt;
  name: Xyz Conference
  maxParticipants: 20
  startTime: 2010-10-14 08:30:00.00
  breakfastProvided: yes
&lt;/pre&gt;
&lt;/div&gt;

&lt;div&gt;
Alternatively, associative array can also model with JSON style (as a short form):
&lt;pre class="brush: plain"&gt;
  [ name: Xyz Conference, maxParticipants: 20, startTime: 2010-10-14 08:30:00.00,  breakfastProvided: yes]
&lt;/pre&gt;
&lt;/div&gt;

&lt;div&gt;
For sequence, it can be represented in this way
&lt;pre class="brush: plain"&gt;
  - Java
  - Python
  - Ruby
&lt;/pre&gt;
&lt;/div&gt;

&lt;div&gt;
Alternatively, sequence can also model in JSON style (as a short form):
&lt;pre class="brush: plain"&gt;
  [ Java, Python, Ruby ]
&lt;/pre&gt;
&lt;/div&gt;

&lt;div&gt;
The short form syntax in YAML also imply that, JSON document is compliant with YAML.
&lt;/div&gt;

&lt;/div&gt;


&lt;div&gt;To get a taste of YAML, below is a personal organizer modeled using YAML:&lt;/div&gt;
&lt;div&gt;
&lt;pre class="brush: plain"&gt;
---
# Document which representing my personal organizer

# Tasks
tasks:
 - 
   summary:     Prepare project proposal
   tags:        [School, Urgent]
   update time: 2010-10-14 18:59:23.17
   completed:   true
 - 
   summary:     Arrange a gathering
   tags:        [Friend, Someday]
   update time: 2010-10-14 18:59:23.17
   completed:   false

# Memos
memos:
 - 
   content:     &gt;
                Precedence of UrlMappings for status code is defined by lexical order.
                While regex based URL mapping is defined by the precedence rules.
   update time: 2010-10-14 18:59:23.17
   archived:    false
 - 
   content:     &gt;
                Pattern-Oriented Software Architecture Volumn 2
                http://www.cs.wustl.edu/~schmidt/POSA/POSA2/
   update time: 2010-10-10 18:59:23.17
   archived:    true

...
&lt;/pre&gt;
&lt;/div&gt;

&lt;div&gt;
From the example above, it is extremely easy to comprehend the content. It consists of two tasks and two memos. The structure of each task and memo is also readily understandable. In this example, several strengths of YAML is demostrated.
&lt;/div&gt;

&lt;div&gt;
&lt;h5&gt;Richer information model used in YAML.&lt;/h5&gt;

&lt;div&gt;
Compare with XML which each documents consists of element node.&amp;nbsp;YAML document consists of four types of node, which are sequence, scalar, mapping and alias.&amp;nbsp;While you can certainly model sequence or key to value pair in XML, it is more clumsy when compare to the one modeled in YAML.
&lt;/div&gt;

&lt;div&gt;
In YAML, indentation is used to to present the hierarchy structure of data. Child elements will have more indentation then it's parent node.&amp;nbsp;However, only whitespace character (ascii x20) is used for indentation, tab character (ascii x09) is not allowed.
&lt;/div&gt;
&lt;/div&gt;

&lt;div&gt;
&lt;h5&gt;Readily defined type&lt;/h5&gt;

&lt;div&gt;
In YAML, some commonly used data types are already defined, which include String, Time, Boolean, Integer Number and Floating Point Number.
&lt;/div&gt;

&lt;div&gt;
While in XML, you can use DTD or Schema to defined the data types for each of element, for this typing is offered from YAML, any YAML document will be benefits with this offering.
&lt;/div&gt;

&lt;div&gt;
A full reference of the data supported in YAML can be found here.
&lt;/div&gt;
&lt;/div&gt;


&lt;div&gt;
&lt;h5&gt;Flexibility on encoding String&lt;/h5&gt;

&lt;div&gt;In YAML, string can be encode without any quote. In additions, you will find that, the use of tag in YAML is minimized. It make it perfert to encoding messages block in a YAML documents. For example, we can easily put a HTML or XML block, or some code fragments in the YAML document without resorting escape the characters in the text.&lt;/div&gt;

&lt;div&gt;In XML, if you want to encode a HTML fragment, or a Math&amp;nbsp;formula, or a code fragment, you will need escape some reserved characters with escape sequence.&lt;/div&gt;
&lt;/div&gt;

&lt;div&gt;
&lt;h5&gt;Space efficiency&lt;/h5&gt;

&lt;div&gt;As YAML do not rely on balanced mark up (like XML) to represent the data structure, most of the document payload is representing the data itself, instead. Compare with XML, each tag must have a balanced closing tag, the size used for representation a piece of data in YAML is usually lesser than XML. Below, a direct XML and YAML comparison will&amp;nbsp;demonstrate&amp;nbsp;this points&lt;/div&gt;

&lt;div&gt;Well, YAML is full of&amp;nbsp;strengths, but it don't means it will be a&amp;nbsp;perfect&amp;nbsp;choice for representing all kind of data or messages. As always, no one tools can serve all purpose and YAML is no exception. YAML does have some weakness, below are some key issues:&lt;/div&gt;
&lt;/div&gt;

&lt;div&gt;
&lt;h5&gt;Lack of schema definition&lt;/h5&gt;
&lt;div&gt;YAML doesn't provide any facility to define the schema and the semantics of the Document.&lt;/div&gt;

&lt;div&gt;If different parties are going to interchange a YAML document, the exact specification of the document must be specified with somewhere else.&lt;/div&gt;

&lt;div&gt;Compare with XML, in which the schema can be defined clearly with XML Schema or Relax NG, YAML just doesn't provide this kind of feature.&lt;/div&gt;
&lt;/div&gt;

&lt;div&gt;
&lt;h5&gt;Lack of supporting technology&lt;/h5&gt;
&lt;div&gt;YAML doesn't provide any "query language" (like XQuery, XPath in XML) to support querying YAML.&lt;/div&gt;
&lt;/div&gt;


&lt;div&gt;
&lt;h5&gt;Lack of namespace support&lt;/h5&gt;
&lt;div&gt;YAML does not provide any namespace mechanism. Without a namespace concept, it also imply there is not possible to unambiously weaving different YAML documents.&lt;/div&gt;
&lt;/div&gt;

&lt;div&gt;
&lt;h5&gt;Comparing with XML directly&lt;/h5&gt;

&lt;div&gt;While XML are the most commonly used data format, there are some problem. One frequently heard complaint on XML is the space efficiency.&lt;/div&gt;

&lt;div&gt;The following is a &lt;a href="http://maven.apache.org/guides/introduction/introduction-to-the-pom.html"&gt;sample Maven POM file&lt;/a&gt; which describe a project / module build configuration&lt;/div&gt;


&lt;div&gt;
&lt;pre name="code" class="brush: xml"&gt;
&amp;lt;project&amp;gt;
  &amp;lt;modelVersion&amp;gt;4.0.0&amp;lt;/modelVersion&amp;gt;
  &amp;lt;name&amp;gt;Maven Default Project&amp;lt;/name&amp;gt;

  &amp;lt;repositories&amp;gt;
    &amp;lt;repository&amp;gt;
      &amp;lt;id&amp;gt;central&amp;lt;/id&amp;gt;
      &amp;lt;name&amp;gt;Maven Repository Switchboard&amp;lt;/name&amp;gt;
      &amp;lt;layout&amp;gt;default&amp;lt;/layout&amp;gt;
      &amp;lt;url&amp;gt;http://repo1.maven.org/maven2&amp;lt;/url&amp;gt;
      &amp;lt;snapshots&amp;gt;
        &amp;lt;enabled&amp;gt;false&amp;lt;/enabled&amp;gt;
      &amp;lt;/snapshots&amp;gt;
    &amp;lt;/repository&amp;gt;
  &amp;lt;/repositories&amp;gt;

  &amp;lt;pluginRepositories&amp;gt;
    &amp;lt;pluginRepository&amp;gt;
      &amp;lt;id&amp;gt;central&amp;lt;/id&amp;gt;
      &amp;lt;name&amp;gt;Maven Plugin Repository&amp;lt;/name&amp;gt;
      &amp;lt;url&amp;gt;http://repo1.maven.org/maven2&amp;lt;/url&amp;gt;
      &amp;lt;layout&amp;gt;default&amp;lt;/layout&amp;gt;
      &amp;lt;snapshots&amp;gt;
        &amp;lt;enabled&amp;gt;false&amp;lt;/enabled&amp;gt;
      &amp;lt;/snapshots&amp;gt;
      &amp;lt;releases&amp;gt;
        &amp;lt;updatePolicy&amp;gt;never&amp;lt;/updatePolicy&amp;gt;
      &amp;lt;/releases&amp;gt;
    &amp;lt;/pluginRepository&amp;gt;
  &amp;lt;/pluginRepositories&amp;gt;

  &amp;lt;build&amp;gt;
    &amp;lt;directory&amp;gt;target&amp;lt;/directory&amp;gt;
    &amp;lt;outputDirectory&amp;gt;target/classes&amp;lt;/outputDirectory&amp;gt;
    &amp;lt;finalName&amp;gt;${artifactId}-${version}&amp;lt;/finalName&amp;gt;
    &amp;lt;testOutputDirectory&amp;gt;target/test-classes&amp;lt;/testOutputDirectory&amp;gt;
    &amp;lt;sourceDirectory&amp;gt;src/main/java&amp;lt;/sourceDirectory&amp;gt;
    &amp;lt;scriptSourceDirectory&amp;gt;src/main/scripts&amp;lt;/scriptSourceDirectory&amp;gt;
    &amp;lt;testSourceDirectory&amp;gt;src/test/java&amp;lt;/testSourceDirectory&amp;gt;
    &amp;lt;resources&amp;gt;
      &amp;lt;resource&amp;gt;
        &amp;lt;directory&amp;gt;src/main/resources&amp;lt;/directory&amp;gt;
      &amp;lt;/resource&amp;gt;
    &amp;lt;/resources&amp;gt;
    &amp;lt;testResources&amp;gt;
      &amp;lt;testResource&amp;gt;
        &amp;lt;directory&amp;gt;src/test/resources&amp;lt;/directory&amp;gt;
      &amp;lt;/testResource&amp;gt;
    &amp;lt;/testResources&amp;gt;
  &amp;lt;/build&amp;gt;

  &amp;lt;reporting&amp;gt;
    &amp;lt;outputDirectory&amp;gt;target/site&amp;lt;/outputDirectory&amp;gt;
  &amp;lt;/reporting&amp;gt;

  &amp;lt;profiles&amp;gt;
    &amp;lt;profile&amp;gt;
      &amp;lt;id&amp;gt;release-profile&amp;lt;/id&amp;gt;

      &amp;lt;activation&amp;gt;
        &amp;lt;property&amp;gt;
          &amp;lt;name&amp;gt;performRelease&amp;lt;/name&amp;gt;
        &amp;lt;/property&amp;gt;
      &amp;lt;/activation&amp;gt;

      &amp;lt;build&amp;gt;
        &amp;lt;plugins&amp;gt;
          &amp;lt;plugin&amp;gt;
            &amp;lt;inherited&amp;gt;true&amp;lt;/inherited&amp;gt;
            &amp;lt;groupId&amp;gt;org.apache.maven.plugins&amp;lt;/groupId&amp;gt;
            &amp;lt;artifactId&amp;gt;maven-source-plugin&amp;lt;/artifactId&amp;gt;

            &amp;lt;executions&amp;gt;
              &amp;lt;execution&amp;gt;
                &amp;lt;id&amp;gt;attach-sources&amp;lt;/id&amp;gt;
                &amp;lt;goals&amp;gt;
                  &amp;lt;goal&amp;gt;jar&amp;lt;/goal&amp;gt;
                &amp;lt;/goals&amp;gt;
              &amp;lt;/execution&amp;gt;
            &amp;lt;/executions&amp;gt;
          &amp;lt;/plugin&amp;gt;
          &amp;lt;plugin&amp;gt;
            &amp;lt;inherited&amp;gt;true&amp;lt;/inherited&amp;gt;
            &amp;lt;groupId&amp;gt;org.apache.maven.plugins&amp;lt;/groupId&amp;gt;
            &amp;lt;artifactId&amp;gt;maven-javadoc-plugin&amp;lt;/artifactId&amp;gt;

            &amp;lt;executions&amp;gt;
              &amp;lt;execution&amp;gt;
                &amp;lt;id&amp;gt;attach-javadocs&amp;lt;/id&amp;gt;
                &amp;lt;goals&amp;gt;
                  &amp;lt;goal&amp;gt;jar&amp;lt;/goal&amp;gt;
                &amp;lt;/goals&amp;gt;
              &amp;lt;/execution&amp;gt;
            &amp;lt;/executions&amp;gt;
          &amp;lt;/plugin&amp;gt;
          &amp;lt;plugin&amp;gt;
            &amp;lt;inherited&amp;gt;true&amp;lt;/inherited&amp;gt;
            &amp;lt;groupId&amp;gt;org.apache.maven.plugins&amp;lt;/groupId&amp;gt;
            &amp;lt;artifactId&amp;gt;maven-deploy-plugin&amp;lt;/artifactId&amp;gt;

            &amp;lt;configuration&amp;gt;
              &amp;lt;updateReleaseInfo&amp;gt;true&amp;lt;/updateReleaseInfo&amp;gt;
            &amp;lt;/configuration&amp;gt;
          &amp;lt;/plugin&amp;gt;
        &amp;lt;/plugins&amp;gt;
      &amp;lt;/build&amp;gt;
    &amp;lt;/profile&amp;gt;
  &amp;lt;/profiles&amp;gt;

&amp;lt;/project&amp;gt;
&lt;/pre&gt;
&lt;/div&gt;

&lt;div&gt;If it is modeled with YAML, it will looks something like this:&lt;/div&gt;

&lt;div&gt;
&lt;pre class="brush: plain"&gt;
project:
  modelVersion: 4.0.0
  name: Maven Default Project

  repositories: 
    - id: central
      name: Maven Repository Switchboard
      layout: default
      url: http://repo1.maven.org/maven2
      snapshots: 
        enabled: false

  pluginRepositories: 
    - id: central
      name: Maven Plugin Repository
      url: http://repo1.maven.org/maven2
      layout: default
      snapshots: 
        enabled: false
      releases: 
        updatePolicy: never
      
  build: 
    directory: target
    outputDirectory: target/classes
    finalName: ${artifactId}-${version}
    testOutputDirectory: target/test-classes
    sourceDirectory: src/main/java
    scriptSourceDirectory: src/main/scripts
    testSourceDirectory: src/test/java
    resources: 
      - directory: src/main/resources
    testResources: 
      - directory: src/test/resources

  reporting: 
    outputDirectory: target/site

  profiles: 
    - id: release-profile

      activation: 
        property: 
          name: performRelease

      build: 
        plugins: 
          - inherited: true
            groupId: org.apache.maven.plugins
            artifactId: maven-source-plugin
            executions: 
              - id: attach-sources
                goals: 
                  goal: jar

          - inherited: true
            groupId: org.apache.maven.plugins
            artifactId: maven-javadoc-plugin
            executions: 
              - id: attach-javadocs
                goals: 
                  goal: jar
                
          - inherited: true
            groupId: org.apache.maven.plugins
            artifactId: maven-deploy-plugin
            configuration: 
              updateReleaseInfo: true
&lt;/pre&gt;
&lt;/div&gt;

&lt;div&gt;One notable difference amongst these two document is, the YAML one is more readable. When looks into details, the total size for the XML version is 2941 bytes while the size for the YAML is only 1714 bytes, which is effectively 42% reduction in size. In additions, the number of lines in the XML version is 110 lines, while the YAML version is only 68 lines, which is 38% reduction.&lt;/div&gt;

&lt;div&gt;The difference is mainly due to the fact that, YAML doesn't requires a balance end tag. In additions, YAML natively providing constructs to support sequence and maps as top level elements. For example, two model lists of repository in XML, we need two tags (repositories and repository) to module a list, and two extra lines for putting the end tags. In YAML the end tag is never needed.&lt;/div&gt;
&lt;/div&gt;

&lt;div&gt;
&lt;h4&gt;Conclusion&lt;/h4&gt;
&lt;div&gt;Considering both the pros and cons, YAML has great advantage on the human friendiness and clarity, while the lack of schema / namespace support will prevent it from being employed on large scale or complex environment.&lt;/div&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9420660-6713924729954209058?l=zarick.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel="related" href="http://www.yaml.org" title="YAML - YAML Ain't Markup Language" /><link rel="replies" type="application/atom+xml" href="http://zarick.blogspot.com/feeds/6713924729954209058/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=9420660&amp;postID=6713924729954209058" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/9420660/posts/default/6713924729954209058?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/9420660/posts/default/6713924729954209058?v=2" /><link rel="alternate" type="text/html" href="http://zarick.blogspot.com/2010/12/yaml-yaml-aint-markup-language.html" title="YAML - YAML Ain't Markup Language" /><author><name>Zarick Lau</name><uri>http://www.blogger.com/profile/10752391210274843069</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://2.bp.blogspot.com/_cdYAScOA_Vs/SmH0njRAFnI/AAAAAAAABzY/O91stqmPIWQ/S220/hokkido" /></author><thr:total>0</thr:total></entry><entry gd:etag="W/&quot;DkIESXczcCp7ImA9Wx9SFUk.&quot;"><id>tag:blogger.com,1999:blog-9420660.post-1755612243534636474</id><published>2010-12-05T17:43:00.002+08:00</published><updated>2010-12-05T18:21:48.988+08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-12-05T18:21:48.988+08:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="blogger" /><title>Using SyntaxHighlighter at Blogspot</title><content type="html">&lt;div&gt;
Blogspot doesn't support syntax highlight by default. What a shame, considering that all decent Wiki engine are providing certain level of support for this already. While Blogspot isn't a wiki, but without syntax highlighting, I just keep have a feel that, Blogspot is not a place for technical post. Anyway, &lt;a href="http://alexgorbatchev.com/SyntaxHighlighter/"&gt;SyntaxHighlighter&lt;/a&gt; is a solution for this.
&lt;/div&gt;

&lt;div&gt;
The official installation instruction require you to upload the script and link the scripts from your blogspot template. Castillo has &lt;a href="http://urenjoy.blogspot.com/2008/10/publish-source-code-in-blogger.html"&gt;post&lt;/a&gt; a workaround on how to use this lovely tools on Blogspot without having a hosting space. The post seems out-dated. It isn't too hard to figure out the way, below are the up-to-date procedure.
&lt;/div&gt;

&lt;div&gt;
1. Update the Blogspot template and add following in the &amp;lt;head&amp;gt;
&lt;pre class="brush: plain"&gt;
  &amp;lt;script language='javascript'   
    src='http://bitbucket.org/alexg/syntaxhighlighter/raw/b7578b438a69/scripts/XRegExp.js'/&amp;gt;
  &amp;lt;script language='javascript' 
    src='http://bitbucket.org/alexg/syntaxhighlighter/raw/b7578b438a69/scripts/shCore.js'/&amp;gt;
  &amp;lt;script language='javascript' 
    src='http://bitbucket.org/alexg/syntaxhighlighter/raw/b7578b438a69/scripts/shAutoloader.js'/&amp;gt;

  &amp;lt;link rel='stylesheet' type='text/css'
    href='http://bitbucket.org/alexg/syntaxhighlighter/raw/b7578b438a69/styles/shCoreDefault.css' /&amp;gt;

&lt;/pre&gt;
&lt;/div&gt;

&lt;div&gt;
2. Apply the following snipplets near the end of &amp;lt;body&amp;gt;
&lt;pre class="brush: plain"&gt;
&amp;lt;script language='javascript'&amp;gt;
SyntaxHighlighter.config.bloggerMode = true;
SyntaxHighlighter.autoloader(
  'xml  http://bitbucket.org/alexg/syntaxhighlighter/raw/b7578b438a69/scripts/shBrushXml.js',
  'css  http://bitbucket.org/alexg/syntaxhighlighter/raw/b7578b438a69/scripts/shBrushCss.js'
);
SyntaxHighlighter.all();
&amp;lt;/script&amp;gt;
&lt;/pre&gt;
&lt;/div&gt;

&lt;div&gt;
3. In the post, use &amp;lt;pre&amp;gt; with the class attribute to define the corresponding syntax
&lt;pre class="brush: xml"&gt;
&amp;lt;pre class=&amp;quot;brush: xml&amp;gt;
  &amp;lt;echo&amp;gt;Hi SyntaxHighlighter!&amp;lt;/echo&amp;gt;
&amp;lt;/pre&amp;gt;
&lt;/pre&gt;
&lt;/div&gt;

&lt;div&gt;
SyntaxHighlighter support different kind of syntax, all you need to do is just to define it in the "autoloader" call. The full list of supported syntax can be found &lt;a href="http://bitbucket.org/alexg/syntaxhighlighter/src/b7578b438a69/scripts/"&gt;here&lt;/a&gt;. 
SyntaxHighlighter also provided a few different theme which can be configure by importing different javascript, the full list can be found in &lt;a href="http://bitbucket.org/alexg/syntaxhighlighter/src/b7578b438a69/styles/"&gt;here&lt;/a&gt;.
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9420660-1755612243534636474?l=zarick.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel="related" href="http://alexgorbatchev.com/SyntaxHighlighter/" title="Using SyntaxHighlighter at Blogspot" /><link rel="replies" type="application/atom+xml" href="http://zarick.blogspot.com/feeds/1755612243534636474/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=9420660&amp;postID=1755612243534636474" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/9420660/posts/default/1755612243534636474?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/9420660/posts/default/1755612243534636474?v=2" /><link rel="alternate" type="text/html" href="http://zarick.blogspot.com/2010/12/using-syntaxhighlighter-at-blogspot.html" title="Using SyntaxHighlighter at Blogspot" /><author><name>Zarick Lau</name><uri>http://www.blogger.com/profile/10752391210274843069</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://2.bp.blogspot.com/_cdYAScOA_Vs/SmH0njRAFnI/AAAAAAAABzY/O91stqmPIWQ/S220/hokkido" /></author><thr:total>0</thr:total></entry><entry gd:etag="W/&quot;CkEAQHgyfip7ImA9Wx5WE0g.&quot;"><id>tag:blogger.com,1999:blog-9420660.post-5926968830919797052</id><published>2010-09-25T01:50:00.000+08:00</published><updated>2010-09-25T01:50:41.696+08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-09-25T01:50:41.696+08:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="linux" /><title>SLAX - Beautiful Live CD and Live USB</title><content type="html">SLAX is simple Live CD / Live USB distribution. It allows easily to web interface for creating tailored made build.&lt;br /&gt;
&lt;br /&gt;
In additions to the modules available on the official website, it is extremely easy to create modules. To illustrate how easy it is, the following is a steps by steps:&lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;
 1. Download a vanilla SLAX ISO
 2. Boot-up the image with a spare machine or Virtual Machine
 3. After image boots up, login as root
 4. Create a directory
    $ mkdir /tmp/rootcopy
 5. Put some files under this directory
 6. Create the module file
    $ cd /tmp
    $ dir2lsm rootcopy mymodule.lzm
 7. Put this module file under /slax/modules
&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9420660-5926968830919797052?l=zarick.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel="related" href="http://www.slax.org" title="SLAX - Beautiful Live CD and Live USB" /><link rel="replies" type="application/atom+xml" href="http://zarick.blogspot.com/feeds/5926968830919797052/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=9420660&amp;postID=5926968830919797052" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/9420660/posts/default/5926968830919797052?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/9420660/posts/default/5926968830919797052?v=2" /><link rel="alternate" type="text/html" href="http://zarick.blogspot.com/2010/09/slax-beautiful-live-cd-and-live-usb.html" title="SLAX - Beautiful Live CD and Live USB" /><author><name>Zarick Lau</name><uri>http://www.blogger.com/profile/10752391210274843069</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://2.bp.blogspot.com/_cdYAScOA_Vs/SmH0njRAFnI/AAAAAAAABzY/O91stqmPIWQ/S220/hokkido" /></author><thr:total>0</thr:total></entry><entry gd:etag="W/&quot;D0INRX47cCp7ImA9Wx5WE0k.&quot;"><id>tag:blogger.com,1999:blog-9420660.post-7437056419974883771</id><published>2010-09-25T00:26:00.000+08:00</published><updated>2010-09-25T00:26:34.008+08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-09-25T00:26:34.008+08:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="cygwin" /><title>Fixing the Cygwin ACL Problem</title><content type="html">Cygwin is always one of the best tools for me. It provide an emulated *nix like environment include a shell environment, POSIX path, etc. Of all the emulation provided, however, the POSIX-like permission is the only thing I am not appreciated.&lt;br /&gt;
&lt;br /&gt;
The purpose of permission and ACL is for controlling access of files under a multi-user environment. Whilst it will be useful for running network services, it is pointless for most development use cases. Files are mostly accessed by only one user, that is me!&lt;br /&gt;
&lt;br /&gt;
When Cygwin is emulating POSIX permission using Windows ACL, it can easily caused undesirable trouble when one is trying to access the files from both Cygwin environment and ordinary Windows based tools.&amp;nbsp;To get rid of this, Cygwin provided means for disabling this.&amp;nbsp;Unfortunately, the mechanism is different between 1.5.x and 1.7x. And this can even more frustrating when you are trying to upgrade from 1.5.x to 1.7.x.&lt;br /&gt;
&lt;br /&gt;
All the details below can be found on Cygwin &lt;a href="http://www.cygwin.com/cygwin-ug-net/ntsec.html"&gt;manual&lt;/a&gt;. But it may take sometimes to dig it out even with the help of google. So, here we go!&lt;br /&gt;
&lt;br /&gt;
For version prior to 1.7, the method is setting the following environment variable:&lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;    CYGWIN=nontsec&lt;/pre&gt;
&lt;br /&gt;
Since 1.7, the method is setting 'noacl' as part of the mount point options in fstab. You should have a line like this:&lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;    none /cygdrive cygdrive noacl,binary,posix=0,user 0 0
&lt;/pre&gt;
&lt;br /&gt;
Note that, no extra entries should present for all mount point which can be mount up automatically.&lt;br /&gt;
&lt;br /&gt;
For upgrading from 1.5 to 1.7, you should also clean up the mount point defined in the registry. From Cygwin 1.7, registry is &lt;a href="http://www.cygwin.com/faq/faq.setup.html#faq.setup.registry"&gt;only used for defining the installation directory&lt;/a&gt; of Cygwin itself.&lt;br /&gt;
When in doubt, use &lt;em&gt;&lt;a href="http://www.cygwin.com/cygwin-ug-net/using-utils.html"&gt;cygcheck&lt;/a&gt;&lt;/em&gt; to have a look, which can shows the mount point configuration inherited from registry.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9420660-7437056419974883771?l=zarick.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://zarick.blogspot.com/feeds/7437056419974883771/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=9420660&amp;postID=7437056419974883771" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/9420660/posts/default/7437056419974883771?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/9420660/posts/default/7437056419974883771?v=2" /><link rel="alternate" type="text/html" href="http://zarick.blogspot.com/2010/09/fixing-cygwin-acl-problem.html" title="Fixing the Cygwin ACL Problem" /><author><name>Zarick Lau</name><uri>http://www.blogger.com/profile/10752391210274843069</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://2.bp.blogspot.com/_cdYAScOA_Vs/SmH0njRAFnI/AAAAAAAABzY/O91stqmPIWQ/S220/hokkido" /></author><thr:total>0</thr:total></entry><entry gd:etag="W/&quot;Ck4ERXszeSp7ImA9Wx9UFEg.&quot;"><id>tag:blogger.com,1999:blog-9420660.post-9117884790413149372</id><published>2010-05-02T04:11:00.002+08:00</published><updated>2011-02-12T03:01:44.581+08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-02-12T03:01:44.581+08:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="linux" /><title>Huawei B970b (Smartone Vodafone Wifi Router)</title><content type="html">Before I subscribe the Smartone Vodafone Home Broadband service, I've serviously try to seek some official answer the following questions:&lt;br /&gt;
1. Will the router get a public IP address?&lt;br /&gt;
2. Does the bundled WIFI router allow me to configure port forwarding?&lt;br /&gt;
&lt;br /&gt;
And the official answer is NO!&lt;br /&gt;
&lt;br /&gt;
But the fact is, YES! The router is Huawei B970b, as there is not much information on the Net at this moment, I'd share information gathered so far.&amp;nbsp;Before is a summary followed with command line output capture (Yes, I can get the shell &amp;nbsp;access on the router easily)!&lt;br /&gt;
&lt;br /&gt;
&lt;a name='more'&gt;&lt;/a&gt;
Below is summary of import points&lt;br /&gt;
1. I do get a public IP!&lt;br /&gt;
2. The default router admin software (web-based) allow you to configure port forward&lt;br /&gt;
3. In addition, you can also configure DMZ server, MAC filter, DynDNS setting.&lt;br /&gt;
4. Telnet port (23) is opened by default (login with the admin account and you get a busybox)&lt;br /&gt;
5. It use dnsmasq and iptables&lt;br /&gt;
&lt;br /&gt;
The following is the information I gathered after I gain root access:&lt;br /&gt;
&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;# cat /proc/version&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;Linux version 2.4.20 (bcm@localhost.localdomain) (gcc version 3.2.3 with Broadcom modifications) #2 Tue Feb 2 18:23:23 CST 2010&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;# mount&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;rootfs on / type rootfs (rw)&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;/dev/root on / type squashfs (ro)&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;none on /dev type devfs (rw)&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;proc on /proc type proc (rw)&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;ramfs on /tmp type ramfs (rw)&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;/dev/mtdblock/3 on /tmp/var/custom type squashfs (ro)&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;# free&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;total &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; used &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; free &amp;nbsp; &amp;nbsp; &amp;nbsp; shared &amp;nbsp; &amp;nbsp; &amp;nbsp;buffers&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&amp;nbsp;&amp;nbsp;Mem: &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;30520 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;13552 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;16968 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1520&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&amp;nbsp;Swap: &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;Total: &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;30520 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;13552 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;16968&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;# cat /proc/kmsg&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&amp;lt;4&amp;gt;Kernel addr reboot flag = 0xa1fff000, reboot_number = 0xa1fff004&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&amp;lt;4&amp;gt;Kernel physical_mem =0x2000000 reboot flag = 0x12345678, reboot_number = 0x0&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&amp;lt;4&amp;gt;CPU ProcId is: 0x00029029, options: 0x0000014d&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&amp;lt;4&amp;gt;Primary instruction cache 16kb, linesize 16 bytes (4 ways)&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&amp;lt;4&amp;gt;Primary data cache 16kb, linesize 16 bytes (2 ways)&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&amp;lt;4&amp;gt;Linux version 2.4.20 (bcm@localhost.localdomain) (gcc version 3.2.3 with Broadcom modifications) #2 Tue Feb 2 18:23:23 CST 2010&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&amp;lt;4&amp;gt;Setting the PFC to its default value&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&amp;lt;4&amp;gt;Determined physical RAM map:&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&amp;lt;4&amp;gt; memory: 01fff000 @ 00000000 (usable)&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&amp;lt;4&amp;gt;On node 0 totalpages: 8191&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&amp;lt;4&amp;gt;zone(0): 8191 pages.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&amp;lt;4&amp;gt;zone(1): 0 pages.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&amp;lt;4&amp;gt;zone(2): 0 pages.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&amp;lt;4&amp;gt;Kernel command line: root=/dev/mtdblock2 noinitrd console=ttyS0,115200&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&amp;lt;4&amp;gt;CPU: BCM5354 rev 3 at 240 MHz&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&amp;lt;4&amp;gt;Calibrating delay loop... 239.20 BogoMIPS&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&amp;lt;6&amp;gt;Memory: 30452k/32764k available (1563k kernel code, 2312k reserved, 112k data, 68k init, 0k highmem)&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&amp;lt;6&amp;gt;Dentry cache hash table entries: 4096 (order: 3, 32768 bytes)&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&amp;lt;6&amp;gt;Inode cache hash table entries: 2048 (order: 2, 16384 bytes)&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&amp;lt;4&amp;gt;Mount-cache hash table entries: 512 (order: 0, 4096 bytes)&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&amp;lt;4&amp;gt;Buffer-cache hash table entries: 1024 (order: 0, 4096 bytes)&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;dev: &amp;nbsp; &amp;nbsp;size &amp;nbsp; erasesize &amp;nbsp;name&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;mtd0: 00040000 00010000 "cfe"&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;mtd1: 00340000 00010000 "linux"&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;mtd2: 00282970 00010000 "rootfs"&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;mtd3: 00060000 00010000 "resource"&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;mtd4: 00010000 00010000 "factory"&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;mtd5: 00010000 00002000 "nvram"&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div&gt;
&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9420660-9117884790413149372?l=zarick.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://zarick.blogspot.com/feeds/9117884790413149372/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=9420660&amp;postID=9117884790413149372" title="2 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/9420660/posts/default/9117884790413149372?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/9420660/posts/default/9117884790413149372?v=2" /><link rel="alternate" type="text/html" href="http://zarick.blogspot.com/2010/05/huawei-b970b-smartone-vodafone-wifi.html" title="Huawei B970b (Smartone Vodafone Wifi Router)" /><author><name>Zarick Lau</name><uri>http://www.blogger.com/profile/10752391210274843069</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://2.bp.blogspot.com/_cdYAScOA_Vs/SmH0njRAFnI/AAAAAAAABzY/O91stqmPIWQ/S220/hokkido" /></author><thr:total>2</thr:total></entry><entry gd:etag="W/&quot;CEMMR3g7cCp7ImA9WxFTEkw.&quot;"><id>tag:blogger.com,1999:blog-9420660.post-4469925619016643173</id><published>2010-04-02T20:44:00.003+08:00</published><updated>2010-04-02T20:48:06.608+08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-04-02T20:48:06.608+08:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="websocket" /><category scheme="http://www.blogger.com/atom/ns#" term="webgl" /><category scheme="http://www.blogger.com/atom/ns#" term="gwt" /><category scheme="http://www.blogger.com/atom/ns#" term="html5" /><category scheme="http://www.blogger.com/atom/ns#" term="google" /><title>HTML5 port of Quake II</title><content type="html">I can imagine the this kind of things will be implemented in near future, but it is just appear sooner than I expect. I rarely play game these days, but this demo is appealing to me!&lt;br /&gt;
&lt;br /&gt;
&lt;object height="270" width="448"&gt;&lt;param name="movie" value="http://www.youtube.com/v/XhMN0wlITLk&amp;rel=0&amp;color1=0xb1b1b1&amp;color2=0xcfcfcf&amp;hl=en_US&amp;feature=player_embedded&amp;fs=1"&gt;
&lt;/param&gt;
&lt;param name="allowFullScreen" value="true"&gt;
&lt;/param&gt;
&lt;param name="allowScriptAccess" value="always"&gt;
&lt;/param&gt;
&lt;embed src="http://www.youtube.com/v/XhMN0wlITLk&amp;rel=0&amp;color1=0xb1b1b1&amp;color2=0xcfcfcf&amp;hl=en_US&amp;feature=player_embedded&amp;fs=1" type="application/x-shockwave-flash" allowfullscreen="true" allowScriptAccess="always" width="448" height="270"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9420660-4469925619016643173?l=zarick.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel="related" href="http://googlewebtoolkit.blogspot.com/2010/04/look-ma-no-plugin.html" title="HTML5 port of Quake II" /><link rel="replies" type="application/atom+xml" href="http://zarick.blogspot.com/feeds/4469925619016643173/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=9420660&amp;postID=4469925619016643173" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/9420660/posts/default/4469925619016643173?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/9420660/posts/default/4469925619016643173?v=2" /><link rel="alternate" type="text/html" href="http://zarick.blogspot.com/2010/04/html5-port-of-quake-ii.html" title="HTML5 port of Quake II" /><author><name>Zarick Lau</name><uri>http://www.blogger.com/profile/10752391210274843069</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://2.bp.blogspot.com/_cdYAScOA_Vs/SmH0njRAFnI/AAAAAAAABzY/O91stqmPIWQ/S220/hokkido" /></author><thr:total>0</thr:total></entry><entry gd:etag="W/&quot;Ak4CQX06cCp7ImA9WxBaEEo.&quot;"><id>tag:blogger.com,1999:blog-9420660.post-5589263068324193813</id><published>2010-03-20T17:56:00.000+08:00</published><updated>2010-03-20T17:56:00.318+08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-03-20T17:56:00.318+08:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="mac java" /><title>Broken Java Preference in OS X Leopard</title><content type="html">I use&amp;nbsp;&lt;a href="http://www.ppshk.com/"&gt;PPS&lt;/a&gt;&amp;nbsp;frequently but it is broken since the last upgrade. The Login Page is a Java Applet and the problem SHOULD be solved by changing setting in Java Preference.&lt;br /&gt;
&lt;br /&gt;
According to the PPS instruction, enable SSLv3 and TLSv1 in Java Preference can solve it.&amp;nbsp;If you try to enable these in Java Preference, the applet is still not work. The problem is due a bug in Java Preference, when you enable TLSv1, the corresponding property is not actually saved.&lt;br /&gt;
&lt;br /&gt;
To workaround this problem:&lt;br /&gt;
&lt;div&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;cd&amp;nbsp;~/Library/Caches/Java/&lt;/div&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;echo deployment.security.TLSv1=true &amp;gt;&amp;gt; deployment.properties&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
This step should be redo again every time setting is changed from Java Preference.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
This information is found in a forum post:&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;http://discussions.apple.com/message.jspa?messageID=10859921&lt;br /&gt;&lt;br /&gt;
By the way, why Apple not fixed?&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9420660-5589263068324193813?l=zarick.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel="related" href="http://discussions.apple.com/message.jspa?messageID=10859921" title="Broken Java Preference in OS X Leopard" /><link rel="replies" type="application/atom+xml" href="http://zarick.blogspot.com/feeds/5589263068324193813/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=9420660&amp;postID=5589263068324193813" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/9420660/posts/default/5589263068324193813?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/9420660/posts/default/5589263068324193813?v=2" /><link rel="alternate" type="text/html" href="http://zarick.blogspot.com/2010/03/broken-java-preference-in-os-x-leopard.html" title="Broken Java Preference in OS X Leopard" /><author><name>Zarick Lau</name><uri>http://www.blogger.com/profile/10752391210274843069</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://2.bp.blogspot.com/_cdYAScOA_Vs/SmH0njRAFnI/AAAAAAAABzY/O91stqmPIWQ/S220/hokkido" /></author><thr:total>0</thr:total></entry><entry gd:etag="W/&quot;C0ENRX4-cSp7ImA9WxBRFU8.&quot;"><id>tag:blogger.com,1999:blog-9420660.post-5942772237589600999</id><published>2010-01-03T20:27:00.001+08:00</published><updated>2010-01-03T20:28:14.059+08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-01-03T20:28:14.059+08:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="mac tips" /><title>Restore application from the Dock</title><content type="html">In OS X, you can minimize a application with 'Cmd-M'.&lt;br /&gt;
&lt;br /&gt;
To restore it there is no hot key to do so, but one tricks is to use spotlight.

Just type the application name in spotlight and the application will be restored.&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9420660-5942772237589600999?l=zarick.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel="related" href="http://www.intelegant.org/2008/03/30/mac-os-x-how-to-maximize-restore-minimized-apps-docs-from-the-dock/" title="Restore application from the Dock" /><link rel="replies" type="application/atom+xml" href="http://zarick.blogspot.com/feeds/5942772237589600999/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=9420660&amp;postID=5942772237589600999" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/9420660/posts/default/5942772237589600999?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/9420660/posts/default/5942772237589600999?v=2" /><link rel="alternate" type="text/html" href="http://zarick.blogspot.com/2010/01/restore-application-from-dock.html" title="Restore application from the Dock" /><author><name>Zarick Lau</name><uri>http://www.blogger.com/profile/10752391210274843069</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://2.bp.blogspot.com/_cdYAScOA_Vs/SmH0njRAFnI/AAAAAAAABzY/O91stqmPIWQ/S220/hokkido" /></author><thr:total>0</thr:total></entry><entry gd:etag="W/&quot;CUIMRnc5eyp7ImA9WxNVGUs.&quot;"><id>tag:blogger.com,1999:blog-9420660.post-1022715817211634976</id><published>2009-10-31T12:25:00.003+08:00</published><updated>2009-10-31T12:33:07.923+08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-10-31T12:33:07.923+08:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="vim" /><title>Filter file content in Vim</title><content type="html">&lt;p&gt;The following is a simple method to do a 'grep' in the Vim buffer, without do it in the shell.&lt;/p&gt;

&lt;p&gt;Consider the following file content:
&lt;pre&gt;
  public class SomeThing {
    // some constant
    final static public String CONSTANT_A = "a";
    // another constant
    final static public String CONSTANT_B = "b";
    // yet another constant
    final static public String CONSTANT_C = "c";
  }
&lt;/pre&gt;
&lt;/p&gt;

&lt;p&gt;To filter out the constant definition lines ('final static public ...'), you can use a 'g' command in Vim to filter lines by regex and &lt;i&gt;append&lt;/i&gt; to a register 'x'.&lt;/p&gt;
&lt;pre&gt;
:g/final static public/normal "Xyy
&lt;/pre&gt;
&lt;/p&gt;

&lt;p&gt;Then, paste the register in somewhere you need it. For example, to put it in new buffer.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9420660-1022715817211634976?l=zarick.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://zarick.blogspot.com/feeds/1022715817211634976/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=9420660&amp;postID=1022715817211634976" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/9420660/posts/default/1022715817211634976?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/9420660/posts/default/1022715817211634976?v=2" /><link rel="alternate" type="text/html" href="http://zarick.blogspot.com/2009/10/filter-file-content-in-vim.html" title="Filter file content in Vim" /><author><name>Zarick Lau</name><uri>http://www.blogger.com/profile/10752391210274843069</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://2.bp.blogspot.com/_cdYAScOA_Vs/SmH0njRAFnI/AAAAAAAABzY/O91stqmPIWQ/S220/hokkido" /></author><thr:total>0</thr:total></entry><entry gd:etag="W/&quot;CUcFQ3c-cCp7ImA9WxNVGUs.&quot;"><id>tag:blogger.com,1999:blog-9420660.post-4069394219816856550</id><published>2009-10-31T12:23:00.000+08:00</published><updated>2009-10-31T12:23:32.958+08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-10-31T12:23:32.958+08:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="vim" /><title>Vim command line editing</title><content type="html">&lt;p&gt;Paste the contents of register into the command line is very useful, for example, you can edit a non-trivial command in normal vim buffer, or you can copy some text from the file. There are at least two way to do it:&lt;/p&gt;

&lt;p&gt;The 'CTRL_R', in command mode, can be used for this [:help c_CTRL-R]
&lt;ol&gt;
&lt;li&gt;Assume you saved some text in register 'a'&lt;/li&gt;
&lt;li&gt;Under command mode, press 'Ctrl-R a'&lt;/li&gt;
&lt;li&gt;The text in register 'a' will pasted in the command line&lt;/li&gt;
&lt;/ol&gt;&lt;/p&gt;

&lt;p&gt;One powerful alternative is the command window [:help q:]
&lt;ol&gt;
&lt;li&gt;Under normal mode, use 'q:' to enter command window&lt;/li&gt;
&lt;li&gt;Editing the command&lt;/li&gt;
&lt;li&gt;Press 'Enter' to execute, or 'Ctrl-C' to quit this mode&lt;/li&gt;
&lt;/ol&gt;&lt;/p&gt;

&lt;p&gt;This two method is provided by Tim on the &lt;a href="http://www.nabble.com/copy-paste-in-command-line-td18628494.html"&gt;thread&lt;/a&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9420660-4069394219816856550?l=zarick.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://zarick.blogspot.com/feeds/4069394219816856550/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=9420660&amp;postID=4069394219816856550" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/9420660/posts/default/4069394219816856550?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/9420660/posts/default/4069394219816856550?v=2" /><link rel="alternate" type="text/html" href="http://zarick.blogspot.com/2009/10/vim-command-line-editing.html" title="Vim command line editing" /><author><name>Zarick Lau</name><uri>http://www.blogger.com/profile/10752391210274843069</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://2.bp.blogspot.com/_cdYAScOA_Vs/SmH0njRAFnI/AAAAAAAABzY/O91stqmPIWQ/S220/hokkido" /></author><thr:total>0</thr:total></entry><entry gd:etag="W/&quot;CEUDSHk9fSp7ImA9WxNVGUs.&quot;"><id>tag:blogger.com,1999:blog-9420660.post-1928605441110565715</id><published>2009-10-31T11:27:00.004+08:00</published><updated>2009-10-31T12:11:19.765+08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-10-31T12:11:19.765+08:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="cygwin" /><category scheme="http://www.blogger.com/atom/ns#" term="cvs" /><title>CVS client in Cygwin and CVSNT doesn't play with each other!</title><content type="html">&lt;p&gt;I have puzzled by the strange CVS error for a few weeks and finally I sit down and dig out the real problem. If you need to use CVS on Windows and you are a Cygwin user, read on!&lt;/p&gt;

&lt;p&gt;If you checkout the source using CVSNT client, and try to use Cygwin client to do other CVS operation, you will found CVS client will quickly failed with the error: "Repository not found".&lt;/p&gt;

&lt;p&gt;If you try to checkout the source using Cygwin client and try to use CVSNT client to do other CVS operation, the CVSNT client will have strange result too.&lt;/p&gt;

&lt;p&gt;The real reason is the silly line-ending issue. CVSNT will always convert sources from Unix line ending to DOS line ending, including the CVS specific files (CVS/Root for example). If you don't enable the line-ending conversion in Cygwin (I never do this), Cygwin client will never read the CVS file correctly, and no CVS operation can be performed properly.&lt;/p&gt;

&lt;p&gt;On the other hand, if you checkout the source using Cygwin client, all source files and CVS specific files will be in Unix line-ending. CVSNT client cannot handle this properly too! There is a setting in CVSNT client to treat the work copy in Unix line ending, but it just seems doesn't work for me.&lt;/p&gt;

&lt;p&gt;The solution? Stick with only one tools. I choose to stick with Cygwin client as it is the more natural for me. In additions, I found Eclipse and NetBeans can handle the source checked out via Cygwin client and CVSNT client. Hence, I haven't yet got any functionality miss out in Cygwin client + Eclipse/NetBeans combination.&lt;/p&gt;

&lt;p&gt;There is a entry in Cygwin FAQ to enable the DOS/Unix line ending conversion mode in Cygwin, I haven't try this as I believe this mode may cause some problems on other programs / tools in Cygwin.&lt;/p&gt;

&lt;p&gt;If you need a more details on this issue, the following places may helps:
&lt;ul&gt;
  &lt;li&gt;&lt;a href="http://www.tortoisecvs.org/faq.html#brokenlineendings"&gt;Line Ending discussion in TotroiseCVS FAQ&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href="http://cygwin.com/faq/faq-nochunks.html#faq.api.cr-lf"&gt;Line Ending discussion in Cygwin FAQ&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href="http://cygwin.com/cygwin-ug-net/using-textbinary.html"&gt;Cygwin User Guide on the Line-Ending issue&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9420660-1928605441110565715?l=zarick.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://zarick.blogspot.com/feeds/1928605441110565715/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=9420660&amp;postID=1928605441110565715" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/9420660/posts/default/1928605441110565715?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/9420660/posts/default/1928605441110565715?v=2" /><link rel="alternate" type="text/html" href="http://zarick.blogspot.com/2009/10/cvs-client-in-cygwin-and-cvsnt-doesnt.html" title="CVS client in Cygwin and CVSNT doesn't play with each other!" /><author><name>Zarick Lau</name><uri>http://www.blogger.com/profile/10752391210274843069</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://2.bp.blogspot.com/_cdYAScOA_Vs/SmH0njRAFnI/AAAAAAAABzY/O91stqmPIWQ/S220/hokkido" /></author><thr:total>0</thr:total></entry><entry gd:etag="W/&quot;CEQEQXk_eip7ImA9WxNVGUs.&quot;"><id>tag:blogger.com,1999:blog-9420660.post-8898971251875269488</id><published>2009-10-31T01:08:00.001+08:00</published><updated>2009-10-31T12:11:40.742+08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-10-31T12:11:40.742+08:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="debian" /><category scheme="http://www.blogger.com/atom/ns#" term="qnap" /><title>Rescue Debian on QNAP TS-209</title><content type="html">&lt;span style="font-family: 'Lucida Grande'; font-size: small;"&gt;&lt;span style="font-size: 11px;"&gt;&lt;span style="font-family: monospace; font-size: 12px; line-height: 15px; white-space: pre-wrap;"&gt;I've a QNAP TS-209 serve sitting on my home network and serving as file server, web server, etc. Thanks to the &lt;a href="http://www.cyrius.com/debian/orion/qnap/ts-209/"&gt;work of Martin&lt;/a&gt;, Debian can run on my box with only trivial effort. 

Just like most of the NAS, however, you can only access it via ssh/telnet unless you have serial access. If you made some silly mistake and it won't booting up properly, you will need some rescue methods. As it doesn't won't support to boot from CD/floppy, and there is no easy way to have console access, Live CD or old floppy bootdisk just doesn't help.

Fortunately, the boot loader of QNAP (uBoot) support &lt;a href="http://wiki.qnap.com/wiki/System_Recovery_Mode"&gt;recovery mode&lt;/a&gt;, which will fetch a image and flash memory. This mechanism is very useful, and can be used to recover the Debian without reinstalling everything.

Recovery mode is basically using tftp to download a binary image, hence, in order to use this, you must backup the correct image once you have installed the Debian. The image can be backup with the following command:
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: monospace; font-size: small;"&gt;&lt;span class="Apple-style-span" style="font-size: 12px; line-height: 15px; white-space: pre-wrap;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Lucida Grande'; font-size: small;"&gt;&lt;span style="font-size: 11px;"&gt;&lt;span style="font-family: monospace; font-size: 12px; line-height: 15px; white-space: pre-wrap;"&gt;[debian-in-qnap] $ cat /dev/mtd1 /dev/mtd2 /dev/mtd3 &amp;gt; qnapimg.bin

Once you made the image, backup it, it is the only file needed to recover the system. Note that the image is actually the linux kernel and initrd image, hence, you should redo the backup every time you upgrade kernel on the system.

Now, when you need to recover the system, following the steps:
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Lucida Grande'; font-size: small;"&gt;&lt;span style="font-size: 11px;"&gt;&lt;span style="font-family: monospace; font-size: 12px; line-height: 15px; white-space: pre-wrap;"&gt;&lt;ul&gt;
&lt;li&gt;Setup tftp on the local network with IP address: 192.168.0.11&lt;/li&gt;
&lt;li&gt;Put the &lt;u&gt;qnapimg.bin&lt;/u&gt; under root directory of tftp&lt;/li&gt;
&lt;li&gt;Start the QNAP in recocovery (shutdown, press and hold reset button, and start the system, release the reset until you hear two short beap sound&lt;/li&gt;
&lt;/ul&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: 'Lucida Grande'; font-size: small;"&gt;&lt;span style="font-size: 11px;"&gt;&lt;span style="font-family: monospace; font-size: 12px; line-height: 15px; white-space: pre-wrap;"&gt;After some minutes, you system will restart using your recovery image.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9420660-8898971251875269488?l=zarick.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://zarick.blogspot.com/feeds/8898971251875269488/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=9420660&amp;postID=8898971251875269488" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/9420660/posts/default/8898971251875269488?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/9420660/posts/default/8898971251875269488?v=2" /><link rel="alternate" type="text/html" href="http://zarick.blogspot.com/2009/10/rescue-debian-on-qnap-ts-209.html" title="Rescue Debian on QNAP TS-209" /><author><name>Zarick Lau</name><uri>http://www.blogger.com/profile/10752391210274843069</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://2.bp.blogspot.com/_cdYAScOA_Vs/SmH0njRAFnI/AAAAAAAABzY/O91stqmPIWQ/S220/hokkido" /></author><thr:total>0</thr:total></entry><entry gd:etag="W/&quot;DkUERH87eip7ImA9WxJSEUs.&quot;"><id>tag:blogger.com,1999:blog-9420660.post-2392651524444500249</id><published>2009-05-01T15:50:00.000+08:00</published><updated>2009-05-01T15:50:05.102+08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-05-01T15:50:05.102+08:00</app:edited><title>Vim subsitute with expression expansion</title><content type="html">&lt;p&gt;Just read a really interesting Vim tips and tricks post on Vim substitute with expression. In a nutshell, Vim substitute command allow you to use Vim expression, whose used in Vim script. For example, the following command will change all 'CONFIG' to 'config'.&lt;/p&gt;

&lt;pre&gt;
:%s,CONFIG,\=tolower(submatch(0)),
&lt;/pre&gt;

&lt;p&gt;In this example, the key is '\=' notation, which is a switch to enter expression evaluation mode. The function submatch(0) refers to the full match of the substitute command, and both tolower() and submatch() is normal Vim functions only.&lt;/p&gt;

&lt;p&gt;Read the &lt;a href="http://www.thegeekstuff.com/2009/04/vi-vim-editor-search-and-replace-examples/"&gt;Vi and Vim Editor: 12 Powerful Find and Replace Examples&lt;/a&gt; for more examples.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9420660-2392651524444500249?l=zarick.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel="related" href="http://www.thegeekstuff.com/2009/04/vi-vim-editor-search-and-replace-examples/" title="Vim subsitute with expression expansion" /><link rel="replies" type="application/atom+xml" href="http://zarick.blogspot.com/feeds/2392651524444500249/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=9420660&amp;postID=2392651524444500249" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/9420660/posts/default/2392651524444500249?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/9420660/posts/default/2392651524444500249?v=2" /><link rel="alternate" type="text/html" href="http://zarick.blogspot.com/2009/05/vim-subsitute-with-expression-expansion.html" title="Vim subsitute with expression expansion" /><author><name>Zarick Lau</name><uri>http://www.blogger.com/profile/10752391210274843069</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://2.bp.blogspot.com/_cdYAScOA_Vs/SmH0njRAFnI/AAAAAAAABzY/O91stqmPIWQ/S220/hokkido" /></author><thr:total>0</thr:total></entry><entry gd:etag="W/&quot;C0AFQnk8fSp7ImA9WxVWF0g.&quot;"><id>tag:blogger.com,1999:blog-9420660.post-6313525186511706398</id><published>2009-02-28T00:20:00.001+08:00</published><updated>2009-02-28T00:21:53.775+08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-02-28T00:21:53.775+08:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Hardware" /><title>5 watt Linux server in a Power Plug</title><content type="html">&lt;p&gt;Marvell has announced a extremely low power consumption SoC device.&lt;/p&gt;

&lt;p&gt;This is a really cool device, think you can have a box running web application, dhcp, dns proxy with just a power plug sized device.&lt;/p&gt;

&lt;p&gt;When attached with an external disk, this will become an ultra low cost NAS and running media streaming, file sharing service&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9420660-6313525186511706398?l=zarick.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel="related" href="http://www.marvell.com/featured/plugcomputing.jsp" title="5 watt Linux server in a Power Plug" /><link rel="replies" type="application/atom+xml" href="http://zarick.blogspot.com/feeds/6313525186511706398/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=9420660&amp;postID=6313525186511706398" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/9420660/posts/default/6313525186511706398?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/9420660/posts/default/6313525186511706398?v=2" /><link rel="alternate" type="text/html" href="http://zarick.blogspot.com/2009/02/5-watt-linux-server-in-power-plug.html" title="5 watt Linux server in a Power Plug" /><author><name>Zarick Lau</name><uri>http://www.blogger.com/profile/10752391210274843069</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://2.bp.blogspot.com/_cdYAScOA_Vs/SmH0njRAFnI/AAAAAAAABzY/O91stqmPIWQ/S220/hokkido" /></author><thr:total>0</thr:total></entry><entry gd:etag="W/&quot;C0IFSHozcCp7ImA9WxVRFEo.&quot;"><id>tag:blogger.com,1999:blog-9420660.post-4467764585150799033</id><published>2009-01-21T00:56:00.000+08:00</published><updated>2009-01-21T01:11:59.488+08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-01-21T01:11:59.488+08:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="oracle" /><title>Oracle slow initial connection (default installation on Windows)</title><content type="html">Recently, I'm managed to create a few Oracle DBs on various Windows box for development purpose.&lt;br /&gt;
 &lt;br /&gt;
As all are aimed for development purpose and no special configuration is planned. However, with default DB configuration on Windows, you will experience very slow initial connection lag time. To solve this problem, you need to disable NTS authentication.&lt;br /&gt;
&lt;br /&gt;
To do this, edit sqlnet.or &lt;br /&gt;
&lt;em&gt;SQLNET&lt;/em&gt;.&lt;em&gt;AUTHENTICATION_SERVICES&lt;/em&gt;=(&lt;em&gt;NONE&lt;/em&gt;)&lt;br /&gt;
&lt;br /&gt;
Note that, you should see the original setting is NTS (which is native authentication method on Windows platform).&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9420660-4467764585150799033?l=zarick.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://zarick.blogspot.com/feeds/4467764585150799033/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=9420660&amp;postID=4467764585150799033" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/9420660/posts/default/4467764585150799033?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/9420660/posts/default/4467764585150799033?v=2" /><link rel="alternate" type="text/html" href="http://zarick.blogspot.com/2009/01/oracle-slow-initial-connection-default.html" title="Oracle slow initial connection (default installation on Windows)" /><author><name>Zarick Lau</name><uri>http://www.blogger.com/profile/10752391210274843069</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://2.bp.blogspot.com/_cdYAScOA_Vs/SmH0njRAFnI/AAAAAAAABzY/O91stqmPIWQ/S220/hokkido" /></author><thr:total>0</thr:total></entry><entry gd:etag="W/&quot;CEMGRXgzeSp7ImA9WxRVEk8.&quot;"><id>tag:blogger.com,1999:blog-9420660.post-8358950486954994766</id><published>2008-11-09T17:05:00.003+08:00</published><updated>2008-11-09T17:20:24.681+08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2008-11-09T17:20:24.681+08:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="java" /><title>Great profiling tools VisualVM bundled with JDK6</title><content type="html">&lt;p&gt;Whenever encounter memory leak or performance problem, profiler will be your great friend.&lt;/p&gt;

&lt;p&gt;Sometimes before, I have used some well known profiling tools like YourKit or hprof, jmap, tools, but recently, I discover JDK 6 has bundled with a new tools called VisualVM.&lt;/p&gt;

&lt;p&gt;Indeed, the VisualVM is itself a self contained &lt;a href=""&gt;project&lt;/a&gt;, it provides some common monitoring features like thread/heap monitoring, as well as cpu / memory profiling features. It also allows you taking snapshots and compare memory snapshot.&lt;/p&gt;

&lt;p&gt;IMO, it should deserve much more attention than its currently have. And it is really a perfect tools for most performance monitoring / tunning needs.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9420660-8358950486954994766?l=zarick.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel="related" href="http://java.sun.com/javase/6/docs/technotes/guides/visualvm/index.html" title="Great profiling tools VisualVM bundled with JDK6" /><link rel="replies" type="application/atom+xml" href="http://zarick.blogspot.com/feeds/8358950486954994766/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=9420660&amp;postID=8358950486954994766" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/9420660/posts/default/8358950486954994766?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/9420660/posts/default/8358950486954994766?v=2" /><link rel="alternate" type="text/html" href="http://zarick.blogspot.com/2008/11/great-profiling-tools-visualvm-bundled.html" title="Great profiling tools VisualVM bundled with JDK6" /><author><name>Zarick Lau</name><uri>http://www.blogger.com/profile/10752391210274843069</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://2.bp.blogspot.com/_cdYAScOA_Vs/SmH0njRAFnI/AAAAAAAABzY/O91stqmPIWQ/S220/hokkido" /></author><thr:total>0</thr:total></entry><entry gd:etag="W/&quot;CEQFSH09fCp7ImA9WxNVGUs.&quot;"><id>tag:blogger.com,1999:blog-9420660.post-4821701717191507442</id><published>2008-09-27T23:43:00.005+08:00</published><updated>2009-10-31T12:11:59.364+08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-10-31T12:11:59.364+08:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="vim" /><category scheme="http://www.blogger.com/atom/ns#" term="oracle" /><title>Happy Vimming again!</title><content type="html">&lt;p&gt;
Vim has been my favorite editor for years. However, for Java related development I've switched to Eclipse. Vim is then only been used for general text editing (writing notes, scripts, etc).
&lt;/p&gt;

&lt;p&gt;
Recently, I have to do fairly amount of coding in PL/SQL. After struggling for weeks to writing code in SQLDeveloper, I remember the lovely Vim.
&lt;/p&gt;

&lt;p&gt;
Vim already bundled the syntax file for PLSQL and Oracle SQL,.
However, Vim doesn't bundled with a good PL/SQL indentation setup, which can be found in &lt;a href="http://plnet.org/files/vim/indent"&gt;here&lt;/a&gt;.
&lt;/p&gt;

&lt;p&gt;
Another important setup is connecting sqlplus and vim and it is can be done by adding the line below into glogin.sql (sqlplus init file):
&lt;/p&gt;&lt;pre&gt;
 DEFINE _EDITOR='vim -c "set filetype=plsql"'
&lt;/pre&gt;
&lt;p&gt;&lt;/p&gt;

&lt;p&gt;
Finally, to make the sqlplus usable, it is better to use &lt;a href="http://utopia.knoware.nl/%7Ehlub/rlwrap/"&gt;rlwrap&lt;/a&gt; (which bring basic readline features like command history and hot key to the sqlplus).
&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9420660-4821701717191507442?l=zarick.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://zarick.blogspot.com/feeds/4821701717191507442/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=9420660&amp;postID=4821701717191507442" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/9420660/posts/default/4821701717191507442?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/9420660/posts/default/4821701717191507442?v=2" /><link rel="alternate" type="text/html" href="http://zarick.blogspot.com/2008/09/happy-vimming-again.html" title="Happy Vimming again!" /><author><name>Zarick Lau</name><uri>http://www.blogger.com/profile/10752391210274843069</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://2.bp.blogspot.com/_cdYAScOA_Vs/SmH0njRAFnI/AAAAAAAABzY/O91stqmPIWQ/S220/hokkido" /></author><thr:total>0</thr:total></entry><entry gd:etag="W/&quot;AkUNQn09eip7ImA9WxdbEkU.&quot;"><id>tag:blogger.com,1999:blog-9420660.post-1591209112343333321</id><published>2008-08-09T20:02:00.003+08:00</published><updated>2008-08-09T21:24:53.362+08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2008-08-09T21:24:53.362+08:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="thoughts" /><title>Olympic, China, Microsoft</title><content type="html">&lt;p&gt;I'm originally going to blog about the amazing opening ceremony of the 2008 Olympic games on last night. But I just changed my mind as my good feeling is substituted with big anger!&lt;/p&gt;

&lt;p&gt;Today is the second day of the Olympic games, I'm just going to checkout for the official means on watching the games via Internet. After all, I found that, i-cable is the only authorized company to provide the Olympic video online in Hong Kong. Hence, I visit the site and well, fail to watch any video clips.&lt;/p&gt;

&lt;p&gt;The site shown that, Microsoft Windows Media Player 9 is required. Currently, I'm using Mac OSX as my primary desktop and I'm already installed the official WMV codec from MS website. And the sad fact is that, clearly MS Windows is prerequisite for watching the games. But hey, Olympic is the event of anyone on the earth, it seems now, Olympic is game for Microsoft users.&lt;/p&gt;

&lt;p&gt;Nowadays, we can watch TV and listen to radio as long as you have working TV set or radio. But on the Internet, you must pay to one vendor: MS. Sorry I believe there is something wrong, what do you think?&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9420660-1591209112343333321?l=zarick.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://zarick.blogspot.com/feeds/1591209112343333321/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=9420660&amp;postID=1591209112343333321" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/9420660/posts/default/1591209112343333321?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/9420660/posts/default/1591209112343333321?v=2" /><link rel="alternate" type="text/html" href="http://zarick.blogspot.com/2008/08/olympic-china-microsoft.html" title="Olympic, China, Microsoft" /><author><name>Zarick Lau</name><uri>http://www.blogger.com/profile/10752391210274843069</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://2.bp.blogspot.com/_cdYAScOA_Vs/SmH0njRAFnI/AAAAAAAABzY/O91stqmPIWQ/S220/hokkido" /></author><thr:total>1</thr:total></entry><entry gd:etag="W/&quot;A0QNSXg-fip7ImA9WxdbEEw.&quot;"><id>tag:blogger.com,1999:blog-9420660.post-713270842914459227</id><published>2008-08-06T18:19:00.001+08:00</published><updated>2008-08-06T18:43:18.656+08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2008-08-06T18:43:18.656+08:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="linux" /><title>What happens during power outage</title><content type="html">&lt;p&gt;Just skimming through Slashdot and enjoyed an well-written &lt;a href="http://www.halfgaar.net/why-power-failures-are-bad-for-your-data"&gt;article&lt;/a&gt; by Halfgaar.&lt;/p&gt;

&lt;p&gt;
What's make me think interesting is the following two points:
&lt;ul&gt;
&lt;li&gt;Different components on the system response slightly different during power outage&lt;/li&gt;
&lt;li&gt;Another point is how aged disk will died after power failure&lt;/li&gt;
&lt;/ul&gt;
&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9420660-713270842914459227?l=zarick.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel="related" href="http://www.halfgaar.net/why-power-failures-are-bad-for-your-data" title="What happens during power outage" /><link rel="replies" type="application/atom+xml" href="http://zarick.blogspot.com/feeds/713270842914459227/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=9420660&amp;postID=713270842914459227" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/9420660/posts/default/713270842914459227?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/9420660/posts/default/713270842914459227?v=2" /><link rel="alternate" type="text/html" href="http://zarick.blogspot.com/2008/08/what-happens-during-power-outage.html" title="What happens during power outage" /><author><name>Zarick Lau</name><uri>http://www.blogger.com/profile/10752391210274843069</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://2.bp.blogspot.com/_cdYAScOA_Vs/SmH0njRAFnI/AAAAAAAABzY/O91stqmPIWQ/S220/hokkido" /></author><thr:total>0</thr:total></entry><entry gd:etag="W/&quot;AkAFSHY4fyp7ImA9WxdXGEk.&quot;"><id>tag:blogger.com,1999:blog-9420660.post-6460472757683154751</id><published>2008-07-01T01:50:00.004+08:00</published><updated>2008-07-01T01:58:39.837+08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2008-07-01T01:58:39.837+08:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="mac" /><title>My /first/ Mac</title><content type="html">&lt;p&gt;Last Friday, I finally bought my /first/ Mac (yup, theoretically, it is the second as I iPhone is counted Mac also:).&lt;/p&gt;

&lt;p&gt;Hardware design is just really and I have also very happy with the design as well as the performance so far.&lt;/p&gt;

&lt;p&gt;By the way, usability of OS X is really excellent. &lt;/p&gt;

&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_cdYAScOA_Vs/SGkd3MC_YhI/AAAAAAAAADo/UVFqLqr9P9E/s1600-h/IMG_0053.JPG"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;" src="http://3.bp.blogspot.com/_cdYAScOA_Vs/SGkd3MC_YhI/AAAAAAAAADo/UVFqLqr9P9E/s320/IMG_0053.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5217734477249208850" /&gt;&lt;/a&gt;

&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_cdYAScOA_Vs/SGkeIkLcPTI/AAAAAAAAADw/bmiGeJT9M7A/s1600-h/IMG_0060.JPG"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;" src="http://2.bp.blogspot.com/_cdYAScOA_Vs/SGkeIkLcPTI/AAAAAAAAADw/bmiGeJT9M7A/s320/IMG_0060.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5217734775784881458" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9420660-6460472757683154751?l=zarick.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://zarick.blogspot.com/feeds/6460472757683154751/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=9420660&amp;postID=6460472757683154751" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/9420660/posts/default/6460472757683154751?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/9420660/posts/default/6460472757683154751?v=2" /><link rel="alternate" type="text/html" href="http://zarick.blogspot.com/2008/07/my-first-mac.html" title="My /first/ Mac" /><author><name>Zarick Lau</name><uri>http://www.blogger.com/profile/10752391210274843069</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://2.bp.blogspot.com/_cdYAScOA_Vs/SmH0njRAFnI/AAAAAAAABzY/O91stqmPIWQ/S220/hokkido" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://3.bp.blogspot.com/_cdYAScOA_Vs/SGkd3MC_YhI/AAAAAAAAADo/UVFqLqr9P9E/s72-c/IMG_0053.JPG" height="72" width="72" /><thr:total>0</thr:total></entry><entry gd:etag="W/&quot;D0ACQ309fCp7ImA9WxdXEEs.&quot;"><id>tag:blogger.com,1999:blog-9420660.post-2069210932307847819</id><published>2008-06-21T23:59:00.004+08:00</published><updated>2008-06-22T00:29:22.364+08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2008-06-22T00:29:22.364+08:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="linux" /><category scheme="http://www.blogger.com/atom/ns#" term="iphone" /><title>Recover the data on iPhone</title><content type="html">&lt;p&gt;Recently, I bricked my iPhone again (the third times). I've some photo which haven't yet uploaded to my album, hence I really want to find a way to recover my photos.&lt;/p&gt;

&lt;p&gt;As I don't get any good solution, I managed to restore it and use a simple tricks to dump the iphone disk image, then, use some common data recovery tools to help the process.&lt;/p&gt;

&lt;p&gt;To dump the image into a disk file (in your desktop), run the following in the iphone:&lt;/p&gt;

&lt;pre class="console"&gt;
root@my-iphone&gt; dd if=/dev/disk0 | ssh username@mydesktop 'dd of=iphone-dump.img'
&lt;/pre&gt;

&lt;p&gt;When this is finished, you can use some tools to recover the file on the disk image.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9420660-2069210932307847819?l=zarick.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://zarick.blogspot.com/feeds/2069210932307847819/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=9420660&amp;postID=2069210932307847819" title="7 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/9420660/posts/default/2069210932307847819?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/9420660/posts/default/2069210932307847819?v=2" /><link rel="alternate" type="text/html" href="http://zarick.blogspot.com/2008/06/recover-data-on-iphone.html" title="Recover the data on iPhone" /><author><name>Zarick Lau</name><uri>http://www.blogger.com/profile/10752391210274843069</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://2.bp.blogspot.com/_cdYAScOA_Vs/SmH0njRAFnI/AAAAAAAABzY/O91stqmPIWQ/S220/hokkido" /></author><thr:total>7</thr:total></entry></feed>

