<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>String &#8211; Henry Poon&#039;s Blog</title>
	<atom:link href="https://blog.henrypoon.com/blog/tag/string/feed/" rel="self" type="application/rss+xml" />
	<link>https://blog.henrypoon.com</link>
	<description></description>
	<lastBuildDate>Wed, 05 Oct 2022 02:48:28 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	
<site xmlns="com-wordpress:feed-additions:1">83044199</site>	<item>
		<title>Sun Yat-sen Memorial Hall</title>
		<link>https://blog.henrypoon.com/blog/2019/10/22/sun-yat-sen-memorial-hall/</link>
					<comments>https://blog.henrypoon.com/blog/2019/10/22/sun-yat-sen-memorial-hall/#respond</comments>
		
		<dc:creator><![CDATA[hp]]></dc:creator>
		<pubDate>Tue, 22 Oct 2019 07:59:55 +0000</pubDate>
				<category><![CDATA[asia]]></category>
		<category><![CDATA[9]]></category>
		<category><![CDATA[century of humiliation]]></category>
		<category><![CDATA[chiang kai-shek]]></category>
		<category><![CDATA[China]]></category>
		<category><![CDATA[chinese civil war]]></category>
		<category><![CDATA[Chinese people]]></category>
		<category><![CDATA[Converts to Christianity]]></category>
		<category><![CDATA[D]]></category>
		<category><![CDATA[Dia]]></category>
		<category><![CDATA[EAR]]></category>
		<category><![CDATA[Euro]]></category>
		<category><![CDATA[Europe]]></category>
		<category><![CDATA[Event]]></category>
		<category><![CDATA[Go]]></category>
		<category><![CDATA[Hong Kong]]></category>
		<category><![CDATA[IDE]]></category>
		<category><![CDATA[It]]></category>
		<category><![CDATA[Japan]]></category>
		<category><![CDATA[Lag]]></category>
		<category><![CDATA[Lie]]></category>
		<category><![CDATA[Military personnel]]></category>
		<category><![CDATA[Nationalist government]]></category>
		<category><![CDATA[opium wars]]></category>
		<category><![CDATA[Over]]></category>
		<category><![CDATA[Politics]]></category>
		<category><![CDATA[Port]]></category>
		<category><![CDATA[prc]]></category>
		<category><![CDATA[republic of china]]></category>
		<category><![CDATA[STR]]></category>
		<category><![CDATA[String]]></category>
		<category><![CDATA[sun wen]]></category>
		<category><![CDATA[Sun Yat -]]></category>
		<category><![CDATA[Sun Yat-sen]]></category>
		<category><![CDATA[sun yatsen]]></category>
		<category><![CDATA[sun zhongshan]]></category>
		<category><![CDATA[taipei]]></category>
		<category><![CDATA[taiwan]]></category>
		<category><![CDATA[The First President]]></category>
		<category><![CDATA[The Soong Sisters]]></category>
		<category><![CDATA[unequal treaties]]></category>
		<category><![CDATA[Vol]]></category>
		<category><![CDATA[xinhai revolution]]></category>
		<guid isPermaLink="false">https://blog.henrypoon.com/?p=4665</guid>

					<description><![CDATA[Chiang Kai Shek played an instrumental role in the founding of Taiwan, but Sun Yat-sen played an instrumental role in the founding of both The People&#8217;s Republic of China AND the Republic of China. In the early 20th century, he led a revolution against the monarchy in China and founded a republic. He&#8217;s considered the [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph"><a href="https://blog.henrypoon.com/blog/2019/10/17/chiang-kai-shek-memorial-hall/" target="_blank" rel="noreferrer noopener">Chiang Kai Shek</a> played an instrumental role in the founding of Taiwan, but Sun Yat-sen played an instrumental role in the founding of both The People&#8217;s Republic of China AND the Republic of China.  In the early 20th century, he led a <a rel="noreferrer noopener" aria-label="revolution against the monarchy (opens in a new tab)" href="https://en.wikipedia.org/wiki/Xinhai_Revolution" target="_blank">revolution against the monarchy</a> in China and founded a republic.  He&#8217;s considered the Father of the Nation for BOTH the People&#8217;s Republic of China and the Republic of China.</p>



<figure class="wp-block-image"><a href="https://photos.google.com/share/AF1QipOoV8n1nYkJUnDyL3bK3FQrV-ynFqV2pcXmnvrsEn2gPtBjs3rhYhwtoN7ldPDmWA/photo/AF1QipNDiMd2D4GPs-DSv-CUphp9PTRHnw3aV7gj4KK-?key=QS1UTzE1UThyVWVBOTZwcVI1WDNUamdDbkMzakJ3" target="_blank" rel="noreferrer noopener"><img decoding="async" src="https://lh3.googleusercontent.com/JFc2VXS_ejk6ZkNx7xHIwZbL-KqD33lJ1eCXgEVSNH4wDJCdF3ykGYEi67BOYoTEYQte0nh-EoclJxJe-Q-ZgIZl4S2tA53xN5AWYlWO1xK-_8vjwk-Q4lSLmxClrXb7_OCmqCHPOuF4dB7kh4XRZWZqAZzitmceqA8tJkdrTPAS-b9PciK5dW2ZgoYUSQlf2eFFDPRP-fSLem4hv1ku2gDegi_H7kjVQglRoP_KMp02Eb4Gam75vImy2Q671PeqAggWkPple9BoNOQ6F63inG4eIjLd-azA6YKEhnYlYT-b8AowgmUfiQQ2j3bS2pfR1TA8Nx0g87pnLddkk_kRfJ6M8sc7yaujzWy4iyeykMjZ6MbS0I_xXwRp5DJkgB8pdy2jqjiyNZw1VT67i_m-dmUEanTQqMNw566CtzGOfO_xRmH2jO0EfwPWACxhQLI6EkcrJNLGH1RM0fJ2TWuilCVu5ENGFlr10N3SJN59eLJhX5EYe5DHNjXMffMpBF0EnSsAIlCo8CRNDzTzA8toCVHnU_8jSusFTVtTt3rgw12jK6qH7-Ue-FrygiPXZG9eeyniT4IGI_elB0r8-cL7rKQ8xtioZJm4pCmfMetkZRoLhkmt5yIBwViLeSpjAjOyrhaWj9sk9MnUQZeVPDFNZ5YSdwaswLHyijzvZWvfCjqH1rfa_WJDDCX3bTSLjnhglpp4AvY1vUqnroRlTTidD4behqWuanmEKzAfF41IL2Wd2XCt=w1464-h824-no" alt=""/></a></figure>



<p class="wp-block-paragraph">By the mid 19th century, the power of the Qing Dynasty was waning.  Once a proud empire, the Qing Dynasty suffered a series of humiliations through various wars against European powers and the Empire of Japan (known historically as the <a rel="noreferrer noopener" aria-label="century of humiliation (opens in a new tab)" href="https://en.wikipedia.org/wiki/Century_of_humiliation" target="_blank">century of humiliation</a>).  The <a href="https://en.wikipedia.org/wiki/Unequal_treaty" target="_blank" rel="noreferrer noopener" aria-label="unequal treaties (opens in a new tab)">unequal treaties</a> that the empire had no choice but to sign caused China to cede control of various ports to these foreign powers (hence the reason why Hong Kong became part of the British Empire).  </p>



<figure class="wp-block-image"><a href="https://photos.google.com/share/AF1QipOoV8n1nYkJUnDyL3bK3FQrV-ynFqV2pcXmnvrsEn2gPtBjs3rhYhwtoN7ldPDmWA/photo/AF1QipPDYWEFingXdAPynR4qjVklWyhWYXGYNIG_N3pX?key=QS1UTzE1UThyVWVBOTZwcVI1WDNUamdDbkMzakJ3" target="_blank" rel="noreferrer noopener"><img decoding="async" src="https://lh3.googleusercontent.com/MMV9c0N7E8rE3eYnUsSnVFElaLWRRoRHC78QzeS87y5obiu0aNJI5P4LdD1pDHVAUcIVMO1-lTWPoeJ0noNb6AOY6sc--KcitARe0qlJAk-9kE_rMzfpAZnCL0hs4dNBaviS9Tl-l-HI_AlBthMaE6PNIJkZQTBINA5S6SC36nRHpmqvVZb_gyYz2KAVau7nf-qSKjpFbZkJVyWm4a7-3K3bTJ2ZwA8Q5HvCPD66zXYfi6aLjCmo-3KmdoKeCMA0Ju2TR5ECT5PMxd4VBXBuMEsqprUgyqLyPxOj6-JpfjV4ClOB26YukMy1SJC5xDSOu5n1pxOiBLcDd4Vyec2PbBPUjRDPRWcO21-d97v3Ll1so7UDrXJnrQQtuHlhKsQaJW2L3xOqdIFMKqUmkFwDxt1_dqO0TPZk898HKQnIUoJUJbYxQ0xnTa43u7Re5AxXIiXo-NLBmN-YDD-v4e9zz4SuvVI1rmZeEgJRsP0XFOF6l8Md0Dukk-sXfESB2b1x0gbwb4E9fmQBhSIt9wQGR7BBI0ZORGgXSfd0tPe2ccy7UIFltHojHorvgYunwg6cvVuKSw91wzuDwBsn2WAfkXUWH9jv2cijawQkaP24PP0BAJiItFSk3utzLIOMdjNhsPJ5phaQFBqSlCFQNlr3FZg5Hd9dSeE3UH72kBy-x7AiQHDBRp5L-TAjkxVSeLZ6v5idCc20cvqHra2zeNTHPgZKFRIx5vKhXCCF7POwWe3sX6wf=w1464-h824-no" alt=""/></a></figure>



<p class="wp-block-paragraph">As the Qing Empire continued to be bullied, resentment grew among the people.  Out of this resentment, eventually resulted in revolution.  Sun Yat-sen tried on many separate occasions to overthrow the empire.  Even after a string of failures and exile, he persisted, and eventually achieved his goal of overthrowing the empire and founding a republic.</p>



<figure class="wp-block-image"><a href="https://photos.google.com/share/AF1QipOoV8n1nYkJUnDyL3bK3FQrV-ynFqV2pcXmnvrsEn2gPtBjs3rhYhwtoN7ldPDmWA/photo/AF1QipMZMX5AwwdssyKNlSq6Ny62gBiP9PTwSTIiNWcT?key=QS1UTzE1UThyVWVBOTZwcVI1WDNUamdDbkMzakJ3" target="_blank" rel="noreferrer noopener"><img decoding="async" src="https://lh3.googleusercontent.com/SjMP8M11FEa4aPjc-VcFLw3hCaphq__OZoyP_JqffTxgtqGwkvPnIrZMNAb3gevhRhBm-ETRVnBqeCbBVgEUlZ7fCJ0TtF9AaykfmPmJot5fxb7zB1ovprbYiZFTZhHj_okYqSxNzozcbwmtpbHa97sg64UECdhSbWCr73wFT944EOx1A3EfUxzWWh1brRHvZmrUORpTYLAi47gJgExXZeVO6a0egPVrawtmunolitU6Df2cNbS8s4143hncqYbHGCjBZ9XE4WERO77SMyAVmfBtATGMIleixdS-4fyVWpiclma2EE-gTDmOqSZRB_XbzF2VGJEZfELPmVIrVNh0ZnvwLyNuSFqz23x9dyFTDxzdm5t0MJI38nVs_TFjOS3ZOUWxX2o_Ri9GVBhe26hgVqIFZGaAXimipJtXMjedxhEQuh1_W6zbLWihkg3qdsPNLayRHxJOe9XiuVogtnw286EuYb8GW16wl7mGewCQMmpLV4KDQBXfKxRZiz03crSj0CqCq2-uezNzcpsYt9D87Sdy9osSSewN8Mwzmmu-HisxZmPQfAPSDVaHTTGbNOJm_dJ28NmU-a82cNsjQHAtJfKLwYDB0X5Sk181DKB5RAoO-hgAjb5GE7XHCnR_UPjmSCEx3bbnac7Pu7g6It5ridBzZBOGstGoUXpvvMZ4UYRzbwRS8r-g7KSzOufV1iL_GBbWAkqkSv9Qfm8_SSLCA6h6bxtkql81g6j9tTCYoU2p0Uo7=w1464-h824-no" alt=""/></a></figure>



<p class="wp-block-paragraph">The republic however was short lived.  Plagued by power struggles, the republic fell apart.  Sun Yat-sen passed away before he could see his successor, Chiang Kai-shek reunify the nation.  But even that was short lived, once Japan began invading China and then the resumption of the  Chinese Civil War almost immediately after.</p>



<p class="wp-block-paragraph">See more pictures of Taipei <a href="https://photos.google.com/share/AF1QipOoV8n1nYkJUnDyL3bK3FQrV-ynFqV2pcXmnvrsEn2gPtBjs3rhYhwtoN7ldPDmWA?key=QS1UTzE1UThyVWVBOTZwcVI1WDNUamdDbkMzakJ3" target="_blank" rel="noreferrer noopener" aria-label=" (opens in a new tab)">here</a></p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.henrypoon.com/blog/2019/10/22/sun-yat-sen-memorial-hall/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">4665</post-id>	</item>
		<item>
		<title>Serial Communication in Java with Example Program</title>
		<link>https://blog.henrypoon.com/blog/2011/01/01/serial-communication-in-java-with-example-program/</link>
					<comments>https://blog.henrypoon.com/blog/2011/01/01/serial-communication-in-java-with-example-program/#comments</comments>
		
		<dc:creator><![CDATA[hp]]></dc:creator>
		<pubDate>Sun, 02 Jan 2011 01:46:37 +0000</pubDate>
				<category><![CDATA[computer stuff]]></category>
		<category><![CDATA[9]]></category>
		<category><![CDATA[All That]]></category>
		<category><![CDATA[APT]]></category>
		<category><![CDATA[Arduino]]></category>
		<category><![CDATA[Blog]]></category>
		<category><![CDATA[Books]]></category>
		<category><![CDATA[Chan]]></category>
		<category><![CDATA[COM]]></category>
		<category><![CDATA[Comment]]></category>
		<category><![CDATA[Computer]]></category>
		<category><![CDATA[Computer languages]]></category>
		<category><![CDATA[Const]]></category>
		<category><![CDATA[Cookbook]]></category>
		<category><![CDATA[D]]></category>
		<category><![CDATA[Data types]]></category>
		<category><![CDATA[Dia]]></category>
		<category><![CDATA[Download]]></category>
		<category><![CDATA[Drive]]></category>
		<category><![CDATA[EAR]]></category>
		<category><![CDATA[Event]]></category>
		<category><![CDATA[Events]]></category>
		<category><![CDATA[Final]]></category>
		<category><![CDATA[Find]]></category>
		<category><![CDATA[Flag]]></category>
		<category><![CDATA[Go]]></category>
		<category><![CDATA[Google]]></category>
		<category><![CDATA[Hole]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[IDE]]></category>
		<category><![CDATA[IME]]></category>
		<category><![CDATA[Introduction]]></category>
		<category><![CDATA[IOS]]></category>
		<category><![CDATA[ise]]></category>
		<category><![CDATA[It]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Lag]]></category>
		<category><![CDATA[Lie]]></category>
		<category><![CDATA[Link]]></category>
		<category><![CDATA[Object]]></category>
		<category><![CDATA[Object-oriented programming languages]]></category>
		<category><![CDATA[Objective-C]]></category>
		<category><![CDATA[Over]]></category>
		<category><![CDATA[Page]]></category>
		<category><![CDATA[Parameter]]></category>
		<category><![CDATA[PDF]]></category>
		<category><![CDATA[Plan]]></category>
		<category><![CDATA[Port]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Programming languages]]></category>
		<category><![CDATA[RAR]]></category>
		<category><![CDATA[Reference]]></category>
		<category><![CDATA[Rolling]]></category>
		<category><![CDATA[Run]]></category>
		<category><![CDATA[Serial]]></category>
		<category><![CDATA[Serial communication]]></category>
		<category><![CDATA[Software design patterns]]></category>
		<category><![CDATA[Software engineering]]></category>
		<category><![CDATA[Speed]]></category>
		<category><![CDATA[STR]]></category>
		<category><![CDATA[String]]></category>
		<category><![CDATA[Struct]]></category>
		<category><![CDATA[Swing]]></category>
		<category><![CDATA[Thou]]></category>
		<category><![CDATA[Time]]></category>
		<category><![CDATA[UNC]]></category>
		<category><![CDATA[URL]]></category>
		<category><![CDATA[Variable]]></category>
		<category><![CDATA[Vol]]></category>
		<category><![CDATA[Wiki]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[WordPress.com]]></category>
		<category><![CDATA[Writing]]></category>
		<category><![CDATA[XBee]]></category>
		<category><![CDATA[Z]]></category>
		<category><![CDATA[Zip]]></category>
		<guid isPermaLink="false">http://henrypoon.mooo.com/blog/serial-communication-in-java-with-example-program</guid>

					<description><![CDATA[This is more of a follow-up to my previous post about serial programming in Java (here) and how to install the RXTX libraries (here).&#160; This post also assumes that Java is already properly set up with RXTX. Generally, communication with serial ports involves these steps (in no particular order): Searching for serial ports Connecting to [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">This is more of a follow-up to my previous post about serial programming in Java (<a title="Java Serial&nbsp;Programming" href="http://henrypoon.wordpress.com/2010/10/11/java-serial-programming/" target="_blank" rel="noopener">here</a>) and how to install the RXTX libraries (<a title="Installing RXTX for Serial Communication with&nbsp;Java" href="http://henrypoon.wordpress.com/2010/12/25/installing-rxtx-for-serial-communication-with-java/" target="_blank" rel="noopener">here</a>).&nbsp; This post also assumes that Java is already properly set up with RXTX.</p>



<p class="wp-block-paragraph">Generally, communication with serial ports involves these steps (in no particular order):</p>



<ul class="wp-block-list"><li>Searching for serial ports</li><li>Connecting to the serial port</li><li>Starting the input output streams</li><li>Adding an event listener to listen for incoming data</li><li>Disconnecting from the serial port</li><li>Sending Data</li><li>Receiving Data</li></ul>



<p class="wp-block-paragraph">I wrote an example program that includes all of those steps in it and are each in their own separate method within the class, but first I will go through my hardware set up.</p>



<h1 class="wp-block-heading">Hardware Setup</h1>



<p class="wp-block-paragraph">My current hardware setup is as follows:</p>



<ul class="wp-block-list"><li>PC connected to an XBee</li><li>Arduino connected to an XBee</li></ul>



<p class="wp-block-paragraph">User input is given from the PC through the a Java GUI that contains code for serial communication, which is the code presented here.</p>



<p class="wp-block-paragraph">The Arduino is responsible for reading this data.&nbsp; This set up is pretty much using my computer as a remote control for whatever device is on the Arduino end.&nbsp; It could be a motor control, on-off switch, etc.</p>



<h1 class="wp-block-heading">Existing Code</h1>



<p class="wp-block-paragraph">The purpose of this post is to discuss serial programming in Java, and not GUI’s.&nbsp; However, I did create a GUI for testing purposes.&nbsp; See the Code Downloads section for the actual files.</p>


<div class="wp-block-image">
<figure class="aligncenter"><img data-recalc-dims="1" decoding="async" width="300" height="136" src="https://i0.wp.com/blog.henrypoon.com/wp-content/uploads/2011/03/javagui.png?resize=300%2C136&#038;ssl=1" alt="" class="wp-image-933" srcset="https://i0.wp.com/blog.henrypoon.com/wp-content/uploads/2011/03/javagui.png?resize=300%2C136&amp;ssl=1 300w, https://i0.wp.com/blog.henrypoon.com/wp-content/uploads/2011/03/javagui.png?w=640&amp;ssl=1 640w" sizes="(max-width: 300px) 100vw, 300px" /></figure>
</div>


<p class="wp-block-paragraph">Above is the picture of the GUI complete with the buttons that I use to interact with the program.&nbsp; I also added key bindings which I can use to control the throttle.</p>



<p class="wp-block-paragraph">When the program is first started, none of the GUI elements will work except for the combo box and the connect button.&nbsp; Once a successful connection is made the controls are enabled.&nbsp; This is done through the use of the <em>setConnected(true)</em> and the <em>toggleControls()</em> methods shown in the example code that follows.</p>



<h1 class="wp-block-heading">Imports</h1>



<p class="wp-block-paragraph">The imports i used for this program were as follows:</p>



<pre class="wp-block-code"><code lang="java" class="language-java">import gnu.io.*;
import java.awt.Color;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.TooManyListenersException;</code></pre>



<p class="wp-block-paragraph">Depending on the Java IDE it might already know to tell you to use these imports except for the first one.&nbsp; That first import is specific to RXTX, and all its library methods/classes are in there.</p>



<h1 class="wp-block-heading">Class Declaration</h1>



<p class="wp-block-paragraph">The code here reads:</p>



<pre class="wp-block-code"><code lang="java" class="language-java">public class Communicator implements SerialPortEventListener</code></pre>



<p class="wp-block-paragraph">I named my class <em>Communicator</em>, but the name is really up to the programmer.&nbsp; The name pretty much reflects its intended use.</p>



<p class="wp-block-paragraph">The class should also <em>implement</em> the <em>SerialPortEventListener</em> class.&nbsp; This is a class in RXTX and is required in order to receive incoming data.</p>



<p class="wp-block-paragraph">On some IDE’s this may generate a public void method called <em>serialEvent()</em>.&nbsp; This method will be defined later.</p>



<h1 class="wp-block-heading">Class Variables and Constants</h1>



<p class="wp-block-paragraph">Below are the variables and constants that I defined in my class.&nbsp; What the variables are for is in the comments but a more detailed explanation will follow.</p>



<pre class="wp-block-code"><code lang="java" class="language-java">    //passed from main GUI
    GUI window = null;

    //for containing the ports that will be found
    private Enumeration ports = null;
    //map the port names to CommPortIdentifiers
    private HashMap portMap = new HashMap();

    //this is the object that contains the opened port
    private CommPortIdentifier selectedPortIdentifier = null;</code></pre>



<p class="wp-block-paragraph">I could have easily put the variable definitions in the constructor but it wouldn’t change anything.</p>



<p class="wp-block-paragraph">The <em>GUI</em> object is another class that I wrote separate from this one that contains all the GUI elements.&nbsp; The GUI class extends <em>javax.swing.JFrame</em>.</p>



<p class="wp-block-paragraph">The <em>HashMap</em> is for mapping each of the ports’ names to the actual object. What that means is that I can associate (<em>put()</em> method) the name of a serial port, say a string that says COM1, to an object in the code.&nbsp; Later, I can access the name COM1 from the <em>HashMap</em> by using the <em>get()</em> method and it will return the object that it was associated with previously.</p>



<p class="wp-block-paragraph">The <em>CommPortIdentifiers</em> object is needed to gather the list of ports that are available for connection. by using its <em>getPortIdentifiers()</em> method.</p>



<p class="wp-block-paragraph">The <em>SerialPort</em> object is for storing the data for the port once a successful connection is made.</p>



<p class="wp-block-paragraph">The <em>InputStream</em> and <em>OutputStream</em> is the object that is required for sending and receiving data.</p>



<p class="wp-block-paragraph">The Boolean variable <em>bConnected</em> is just a flag that I use for enabling and disabling elements on the GUI.</p>



<p class="wp-block-paragraph">The constant <em>TIMEOUT</em> is a number required when opening the port so that it knows how long to try for before stopping.</p>



<p class="wp-block-paragraph">The constants for the ASCII values are some values that I use to send through the output stream that act as delimiters for data.</p>



<p class="wp-block-paragraph">The string <em>logText</em> is basically what the comment says.&nbsp; When stuff happens in the program, the program stores a string in this variable and it will be appended to a text area in the GUI.</p>



<h1 class="wp-block-heading">Searching for Available Serial Ports</h1>



<p class="wp-block-paragraph">The method below is for searching for available serial ports on the computer.&nbsp; Code adapted from Discovering Available Comm Ports from the Reference Material.</p>



<pre class="wp-block-code"><code lang="java" class="language-java">    //search for all the serial ports
    //pre style="font-size: 11px;": none
    //post: adds all the found ports to a combo box on the GUI
    void searchForPorts()
    {
        ports = CommPortIdentifier.getPortIdentifiers();

        &lt;span style="color: blue;"&gt;while (ports.hasMoreElements())
        {
            CommPortIdentifier curPort = (CommPortIdentifier)ports.nextElement();

            //get only serial ports
            &lt;span style="color: blue;"&gt;if (curPort.getPortType() == CommPortIdentifier.PORT_SERIAL)
            {
                window.cboxPorts.addItem(curPort.getName());
                portMap.put(curPort.getName(), curPort);
            }
        }
    }</code></pre>



<p class="wp-block-paragraph">The method <em>getPortIdentifiers()</em> returns an Enumeration of all the comm ports on the computer.&nbsp; The code can iterate through each element inside the Enumeration and determine whether or not it is a serial port.&nbsp; The method <em>getPortType()</em> can identify what kind of port it is.&nbsp; If it is a serial port, then the code will add its name to a combo box in the GUI (so that users can pick what port to connect to).&nbsp; The serial port that is found should also be mapped to the HashMap so we can identify the object later.&nbsp; This is helpful because the names listed in the combo box are the actual names of the object (COM1, COM2, etc), and so we can use these names to identify the actual object they are tied to.</p>



<h1 class="wp-block-heading">Connecting to the Serial Port</h1>



<p class="wp-block-paragraph">The method below is for connecting to the serial port once they have been found (see previous section).&nbsp; See How to Open A Serial Port in the Reference Material for more information.</p>



<pre class="wp-block-code"><code lang="java" class="language-java">
    //connect to the selected port in the combo box
    //ports are already found by using the searchForPorts
    //method
    //post: the connected comm port is stored in commPort, otherwise,
    //an exception is generated
    public void connect()
    {
        String selectedPort = (String)window.cboxPorts.getSelectedItem();
        selectedPortIdentifier = (CommPortIdentifier)portMap.get(selectedPort);

        CommPort commPort = null;

        try
        {
            //the method below returns an object of type CommPort
            commPort = selectedPortIdentifier.open("TigerControlPanel", TIMEOUT);
            //the CommPort object can be casted to a SerialPort object
            serialPort = (SerialPort)commPort;

            //for controlling GUI elements
            setConnected(true);

            //logging
            logText = selectedPort + " opened successfully.";
            window.txtLog.setForeground(Color.black);
            window.txtLog.append(logText + "n");

            //CODE ON SETTING BAUD RATE ETC OMITTED
            //XBEE PAIR ASSUMED TO HAVE SAME SETTINGS ALREADY

            //enables the controls on the GUI if a successful connection is made
            window.keybindingController.toggleControls();
        }
        catch (PortInUseException e)
        {
            logText = selectedPort + " is in use. (" + e.toString() + ")";

            window.txtLog.setForeground(Color.RED);
            window.txtLog.append(logText + "n");
        }
        catch (Exception e)
        {
            logText = "Failed to open " + selectedPort + "(" + e.toString() + ")";
            window.txtLog.append(logText + "n");
            window.txtLog.setForeground(Color.RED);
        }
    }</code></pre>



<p class="wp-block-paragraph">Using the <em>HashMap</em> we can retrieve the <em>CommPortIdentifier</em> object from the string that was mapped earlier.&nbsp; This is achieved through the <em>HashMap’s</em> <em>get()</em> method.&nbsp; The object must also be casted as a <em>CommPortIdentifier</em> because the <em>get()</em> method has a return type of <em>Object</em>.</p>



<p class="wp-block-paragraph">The <em>setConnected </em>method just changes a boolean flag so that the program can store whether or not it is connected to a serial port or not.</p>



<p class="wp-block-paragraph">The <em>CommPort</em> must also be initialized because the port object will be stored here once a successful connection is made.</p>



<p class="wp-block-paragraph">The main method of interest here is the <em>open()</em> method.&nbsp; This instructs the program to open the port, and this method will return the object for the opened port, which I store in in the previously initialized <em>CommPort </em>object.&nbsp; I then cast this object as a <em>SerialPort</em> and store it as well.&nbsp; This is helpful for accessing the methods and variables specific to the <em>SerialPort</em> class.</p>



<p class="wp-block-paragraph">It should also be noted that the <em>open()</em> method requires the use of a try-catch block.&nbsp; So applying that, I catch two different exceptions.&nbsp; The <em>PortInUseException</em> is what the name says.&nbsp; If the port is in use, then this exception is thrown.&nbsp; The next catch block is just for the generic exceptions that occur.&nbsp; I never came across that during testing, nor do I know how to replicate that.</p>



<p class="wp-block-paragraph">I neglected to include any code for setting the baud rate and other settings on the XBee’s (see Hardware Configuration), because I already set those parameters previously using X-CTU (more on setting up XBee’s here).</p>



<h1 class="wp-block-heading">Initializing the Input and Output Streams</h1>



<p class="wp-block-paragraph">This method is pretty short and is pretty straightforward to read.</p>



<pre class="wp-block-code"><code lang="java" class="language-java">    //open the input and output streams
    //pre style="font-size: 11px;": an open port
    //post: initialized input and output streams for use to communicate data
    public boolean initIOStream()
    {
        //return value for whether opening the streams is successful or not
        boolean successful = false;

        try {
            //
            input = serialPort.getInputStream();
            output = serialPort.getOutputStream();
            writeData(0, 0);

            successful = true;
            return successful;
        }
        catch (IOException e) {
            logText = "I/O Streams failed to open. (" + e.toString() + ")";
            window.txtLog.setForeground(Color.red);
            window.txtLog.append(logText + "n");
            return successful;
        }
    }</code></pre>



<p class="wp-block-paragraph">The streams are initialized by returning the input and output streams of the open serial port.&nbsp; In order for the serial port object to not be null, it must store the object for the open serial port.</p>



<p class="wp-block-paragraph">The <em>getInputStream()</em> and <em>getOutputStream()</em> methods both require a try-catch block.&nbsp; The important exception to catch here is the <em>IOException</em> to signify whether the streams failed to open or not.&nbsp; For more information see How to Open A Serial Port in the Reference Material.</p>



<p class="wp-block-paragraph">I also call a method called <em>writeData(0, 0)</em>.&nbsp; This is the method that encapsulates the code required to write serial data.&nbsp; More on that later.&nbsp; Right now it is just used to set variables on the microcontroller side to zero.</p>



<h1 class="wp-block-heading">Setting Up Event Listeners to Read Data</h1>



<p class="wp-block-paragraph">Once the port is open, the serial port must know whenever there is data to be read.&nbsp; This approach is event driven rather than by polling.&nbsp; When the event is hit, a special block of code will run.&nbsp; This is advantageous to polling because polling requires constantly asking if data is available.&nbsp; The code for the event driven approach is below.&nbsp; See Event Based Two Way Communication for more information.</p>



<pre class="wp-block-code"><code lang="java" class="language-java">    //starts the event listener that knows whenever data is available to be read
    //pre style="font-size: 11px;": an open serial port
    //post: an event listener for the serial port that knows when data is received
    public void initListener()
    {
        try
        {
            serialPort.addEventListener(this);
            serialPort.notifyOnDataAvailable(true);
        }
        catch (TooManyListenersException e)
        {
            logText = "Too many listeners. (" + e.toString() + ")";
            window.txtLog.setForeground(Color.red);
            window.txtLog.append(logText + "n");
        }
    }</code></pre>



<p class="wp-block-paragraph">The code here is pretty much the whole reason why this class implements <em>SerialPortEventListener</em>.&nbsp; The parameter for adding the event listener is just the object itself.&nbsp; The base class has a method called <em>serialEvent(event)</em> that should be overridden before the event code will work.&nbsp; Overriding that method defines what happens when the event is hit.</p>



<p class="wp-block-paragraph">The method <em>addEventListener(this)</em> is the event that is always checking for <em>SerialEvents</em>.&nbsp; It isn’t really important to know what the events actually are, just that the one we’re interested in is the one that tells us whenever data is received.&nbsp; Adding the event listener is complemented by the method <em>notifyOnDataAvailable(true)</em>, which definitely helps us achieve what I mentioned previously.</p>



<p class="wp-block-paragraph">This code requires a try-catch box.&nbsp; The exception here is that there may be too many event listeners.&nbsp; I only use one in the code, so this exception should never be hit.</p>



<h1 class="wp-block-heading">Disconnecting from the Serial Port</h1>



<p class="wp-block-paragraph">Once all the communication is completed, the serial port must be disconnected.&nbsp; In some instances, some ports stay stuck open, which isn’t exactly a good thing.</p>



<pre class="wp-block-code"><code lang="java" class="language-java">    //disconnect the serial port
    //pre style="font-size: 11px;": an open serial port
    //post: closed serial port
    public void disconnect()
    {
        //close the serial port
        try
        {
            writeData(0, 0);

            serialPort.removeEventListener();
            serialPort.close();
            input.close();
            output.close();
            setConnected(false);
            window.keybindingController.toggleControls();

            logText = "Disconnected.";
            window.txtLog.setForeground(Color.red);
            window.txtLog.append(logText + "n");
        }
        catch (Exception e)
        {
            logText = "Failed to close " + serialPort.getName()
                              + "(" + e.toString() + ")";
            window.txtLog.setForeground(Color.red);
            window.txtLog.append(logText + "n");
        }
    }</code></pre>



<p class="wp-block-paragraph">The code here requires a try-catch block so there it is.&nbsp; The exception to catch here is pretty generic.</p>



<p class="wp-block-paragraph">Before closing the port, I reset the data on the microcontroller.&nbsp; That step is optional depending on the application.&nbsp; For example, if the value sent to the microcontroller is controlling the speed of a motor, I’d want the motor to turn off if I turn off the remote control.</p>



<p class="wp-block-paragraph">The event listener should be removed as it is no longer needed.</p>



<p class="wp-block-paragraph">The method to close the port is the <em>close()</em> method.</p>



<p class="wp-block-paragraph">The input and output streams should also be closed via the same method as above.</p>



<p class="wp-block-paragraph">See How to Close A Serial Port in the Reference section for more information.</p>



<h1 class="wp-block-heading">Reading Data – The <em>serialEvent</em> Method</h1>



<p class="wp-block-paragraph">This is a follow-up to the section on preparing to Read Data.&nbsp; It has information on how to process the data that the program reads.</p>



<pre class="wp-block-code"><code lang="java" class="language-java">    //what happens when data is received
    //pre style="font-size: 11px;": serial event is triggered
    //post: processing on the data it reads
    public void serialEvent(SerialPortEvent evt) {
        if (evt.getEventType() == SerialPortEvent.DATA_AVAILABLE)
        {
            try
            {
                byte singleData = (byte)input.read();

                if (singleData != NEW_LINE_ASCII)
                {
                    logText = new String(new byte[] {singleData});
                    window.txtLog.append(logText);
                }
                else
                {
                    window.txtLog.append("n");
                }
            }
            catch (Exception e)
            {
                logText = "Failed to read data. (" + e.toString() + ")";
                window.txtLog.setForeground(Color.red);
                window.txtLog.append(logText + "n");
            }
        }
    }</code></pre>



<p class="wp-block-paragraph">Since we only want to read data if it exists, we test the condition in the if statement above.&nbsp; This could be redundant because we wouldn’t be in this method if the event never got triggered.</p>



<p class="wp-block-paragraph">Reading the data requires a try-catch block.&nbsp; The <em>read()</em> method returns an integer, but the value in it is actually a byte value so this is casted to a byte, in which I store in a variable called <em>singleData</em>.&nbsp; When I was testing this code before, I noticed that the data being read would always have random new line characters in it, and I never knew why this happened.&nbsp; I never wrote any new line characters.&nbsp; Since I don’t want these, I add an if condition saying that if it encounters that, don’t display that data on the screen.</p>



<p class="wp-block-paragraph">Java also has a nice way of converting bytes to a string.  A byte array can be used as a parameter when initializing a string, which is what I’ve done when I assign a value to <em>logText</em>.</p>



<p class="wp-block-paragraph">The exception here is just the usual generic one.</p>



<h1 class="wp-block-heading">Writing Data</h1>



<p class="wp-block-paragraph">Here is the method for writing data.&nbsp; In my application, I am writing two integers sequentially to my microcontroller.&nbsp; Data that is sent to the MCU can be used for such things such as controlling motor speeds, which is what I am trying to do here.&nbsp; I hope to use the data sent do control the PWM duty cycle of the motor for speed control.</p>



<pre class="wp-block-code"><code lang="java" class="language-java">    //method that can be called to send data
    //pre style="font-size: 11px;": open serial port
    //post: data sent to the other device
    public void writeData(int leftThrottle, int rightThrottle)
    {
        try
        {
            output.write(leftThrottle);
            output.flush();
            //this is a delimiter for the data
            output.write(DASH_ASCII);
            output.flush();

            output.write(rightThrottle);
            output.flush();
            //will be read as a byte so it is a space key
            output.write(SPACE_ASCII);
            output.flush();
        }
        catch (Exception e)
        {
            logText = "Failed to write data. (" + e.toString() + ")";
            window.txtLog.setForeground(Color.red);
            window.txtLog.append(logText + "n");
        }
    }</code></pre>



<p class="wp-block-paragraph">The <em>write() </em>method here requires a try-catch block just like many of the other methods used for serial communication.&nbsp; Using the output stream, I call that method to write an integer value.&nbsp; I also write a dash and a space to separate the actual data being read.&nbsp; See the ASCII Table for the values of what these characters should be.&nbsp; This helps me differentiate the sets of data that is sent back and forth.&nbsp; The dash separates the two integers being sent and the space separates the entire set.&nbsp; On the Arduino end, four called to <em>read()</em> can separate the data without mixing things up.&nbsp; Example of that later.</p>



<h1 class="wp-block-heading">Putting All the Java Code Together</h1>



<p class="wp-block-paragraph">Once all these methods are setup, they need to be called somewhere in the program so we can put them to use.&nbsp; When the program starts, the code for searching for serial ports will run so that it can populate the combo box on the GUI.&nbsp; The GUI buttons also need to be disabled to reflect the fact they should be disabled when there is no connection to a port.&nbsp; When the connect button is pressed, the input and output streams are started and the event listener is added.&nbsp; The code for that is shown below.</p>



<pre class="wp-block-code"><code lang="java" class="language-java">        private void btnConnectActionPerformed(java.awt.event.ActionEvent evt) {
            communicator.connect();
            if (communicator.getConnected() == true)
            {
                if (communicator.initIOStream() == true)
                {
                    communicator.initListener();
                }
            }
        }</code></pre>



<p class="wp-block-paragraph">The if statement is needed such that the code will not run if a successful connection was not made.&nbsp; This is the precondition for the <em>initIOStream() </em>and the <em>initLIstener() </em>methods.</p>



<p class="wp-block-paragraph">When the user decides to disconnect from the serial port, the user only needs to call the <em>disconnect()</em> method when the disconnect button is pressed.</p>



<p class="wp-block-paragraph">The up/down arrows on my GUI are set to write data to the serial port when they are pressed.&nbsp; When data is written to the Arduino, the MCU will send the data back to the Java program, which will signal the event listener to display that data back to the screen.</p>



<h1 class="wp-block-heading">Arduino Code</h1>



<p class="wp-block-paragraph">The Arduino code is pretty straight forward.&nbsp; There are just a few calls to the <em>read()</em> method.</p>



<p class="wp-block-paragraph">Update 6 May 2012: the syntax for the Arduino code has updated since the writing of this article. &nbsp;Apparently, the lines</p>



<pre class="wp-block-code"><code lang="c" class="language-c">Serial.print(separator, BYTE);
Serial.print(space, BYTE);</code></pre>



<p class="wp-block-paragraph">are no longer valid and have since been replaced by the following:</p>



<pre class="wp-block-code"><code lang="c" class="language-c">Serial.write(byte(separator));
Serial.write(byte(space));</code></pre>



<p class="wp-block-paragraph">The code below hasn&#8217;t been edited with this change, but basically the code required for writing a byte value through serial communication has changed.</p>



<pre class="wp-block-code"><code lang="c" class="language-c">
// this is where we will put our data
int left = 0;
int right = 0;
byte space = 0;
byte separator = 0;

void setup(){
  // Start up our serial port, we configured our XBEE devices for 38400 bps. 
  Serial.begin(9200);
}

void loop(){
  // handle serial data, if any
  if (Serial.available() &amp;gt;= 4){
    left = Serial.read();
    separator = Serial.read();
    right = Serial.read();
    space = Serial.read();
    Serial.flush();

    Serial.print(left);
    Serial.print(separator, BYTE);
    Serial.print(right);
    Serial.print(space, BYTE);
    Serial.print("n");
  }
}</code></pre>



<p class="wp-block-paragraph">I first declare four variables to reflect the fact that I’m writing four different variables to the serial port.</p>



<p class="wp-block-paragraph">In the loop method, I added a condition which will check whether there are four pieces of data available before reading them.&nbsp; This again reflects the fact I’m writing four values.</p>



<p class="wp-block-paragraph">The four variables initially declared store the values in the order that they are written, and then are just printed to the screen.</p>



<p class="wp-block-paragraph">The <em>print()</em> method is able to convert the byte value to an actual character by adding a second parameter called <em>BYTE</em>.&nbsp; The left and right variables don’t need it because the values written were integers to begin with, however, the dash and space characters were written as ASCII values.</p>



<p class="wp-block-paragraph">For more information about Arduino and Java, and Arduino’s Serial library, please refer to those in the Reference Section.</p>



<h1 class="wp-block-heading">Code Downloads</h1>



<p class="wp-block-paragraph">Here are the code downloads for the GUI, key bindings and the serial communication.&nbsp; WordPress doesn’t allow uploads of zip or java files so I uploaded it all to Megaupload.</p>



<p class="wp-block-paragraph">Link to download:&nbsp;<a href="http://www.mediafire.com/?z2l26ncypmzn20z" target="_blank" rel="noopener">http://www.mediafire.com/?z2l26ncypmzn20z</a></p>



<h1 class="wp-block-heading">Other Examples</h1>



<p class="wp-block-paragraph">There are also other sites I looked at which had example code for serial port communication in Java.&nbsp; The sites are Programming Serial and Parallel Ports and Serial Port Access Using RXTX in Java, which are both in the Reference section.</p>



<h1 class="wp-block-heading">Reference Material</h1>



<p class="wp-block-paragraph">Below are a bunch of links to reference sites that I used to find some of the information written here.&nbsp; I mostly referred to bits and pieces of each article to understand the serial code and to come up with the example I present here.&nbsp; The list is in the order that I referenced them.</p>



<h2 class="wp-block-heading">Discovering Available Comm Ports</h2>



<p class="wp-block-paragraph"><a href="http://rxtx.qbang.org/wiki/index.php/Discovering_available_comm_ports" target="_blank" rel="noopener">http://rxtx.qbang.org/wiki/index.php/Discovering_available_comm_ports</a></p>



<p class="wp-block-paragraph">The code on this page is pretty specific to the title of this heading, and the code is pretty easy to follow.</p>



<h2 class="wp-block-heading">How to Open A Serial Port</h2>



<p class="wp-block-paragraph"><a target="_blank" rel="noopener">http://embeddedfreak.wordpress.com/2008/08/08/how-to-open-serial-port-using-rxtx/</a></p>



<p class="wp-block-paragraph">This page provides a very concise and detailed explanation on what each line of code does in order to get a serial port open.&nbsp; Definitely work a look if you’re trying to understand the code.</p>



<h2 class="wp-block-heading">Event Based Two Way Communication</h2>



<p class="wp-block-paragraph"><a href="http://rxtx.qbang.org/wiki/index.php/Event_Based_Two_Way_Communication" target="_blank" rel="noopener">http://rxtx.qbang.org/wiki/index.php/Event_Based_Two_Way_Communication</a></p>



<p class="wp-block-paragraph">This page has example code on how to connect to a serial port and how to interact with it.&nbsp; The code here uses events, rather than polling, to send data back and forth, which means that whenever data is received, the event code is triggered.</p>



<h2 class="wp-block-heading">How to Close A Serial Port</h2>



<p class="wp-block-paragraph"><a target="_blank" rel="noopener">http://embeddedfreak.wordpress.com/2008/08/08/how-to-close-serial-port-in-rxtx/</a></p>



<p class="wp-block-paragraph">This article is written by the same author who wrote the article on how to open serial ports.  Good example code here.</p>



<h2 class="wp-block-heading">ASCII Table</h2>



<p class="wp-block-paragraph"><a href="http://www.asciitable.com/" target="_blank" rel="noopener">http://www.asciitable.com/</a></p>



<p class="wp-block-paragraph">Having the ASCII Table is quite handy for serial data because data being sent and written are bytes, so being able to know what byte values correspond to what character really helps.</p>



<h2 class="wp-block-heading">Arduino and Java</h2>



<p class="wp-block-paragraph"><a href="http://www.arduino.cc/playground/Interfacing/Java" target="_blank" rel="noopener">http://www.arduino.cc/playground/Interfacing/Java</a></p>



<p class="wp-block-paragraph">This article discusses how to use the serial port communication with Java and Arduino, which is exactly what I am after.&nbsp; It has example code on pretty much the entire process of serial port communication, but it may be too much to read since there is little explanation about the code.</p>



<h2 class="wp-block-heading">Arduino Serial Class</h2>



<p class="wp-block-paragraph"><a href="http://arduino.cc/en/Reference/Serial" target="_blank" rel="noopener">http://arduino.cc/en/Reference/Serial</a></p>



<p class="wp-block-paragraph">A good reference for Arduino’s Serial class methods.&nbsp; Also has example code to look at.</p>



<h2 class="wp-block-heading">Programming Serial and Parallel Ports</h2>



<figure class="wp-block-embed is-type-rich is-provider-embed-handler wp-block-embed-embed-handler"><div class="wp-block-embed__wrapper">
https://docs.google.com/viewer?url=http%3A%2F%2Fjava.sun.com%2Fdeveloper%2FBooks%2Fjavaprogramming%2Fcookbook%2F11.pdf
</div></figure>



<p class="wp-block-paragraph">This article provides a brief introduction to programming serial ports and has information on the steps required to talk to the serial port.&nbsp; However, the code examples in there may be hard to follow for someone new to serial programming.</p>



<h2 class="wp-block-heading">Serial Port Access Using RXTX in Java</h2>



<p class="wp-block-paragraph"><a href="http://gomultidomain.blogspot.com/2008/06/serial-port-access-using-rxtx-in-java.html" target="_blank" rel="noopener">http://gomultidomain.blogspot.com/2008/06/serial-port-access-using-rxtx-in-java.html</a></p>



<p class="wp-block-paragraph">This page also has complete code for serial communication in Java, but what I was looking for here was how to use the write method to send serial data from Java.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.henrypoon.com/blog/2011/01/01/serial-communication-in-java-with-example-program/feed/</wfw:commentRss>
			<slash:comments>144</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">566</post-id>	</item>
		<item>
		<title>Snow Leopard on a Dell Inspiron 1520</title>
		<link>https://blog.henrypoon.com/blog/2010/06/11/snow-leopard-on-a-dell-inspiron-1520/</link>
					<comments>https://blog.henrypoon.com/blog/2010/06/11/snow-leopard-on-a-dell-inspiron-1520/#comments</comments>
		
		<dc:creator><![CDATA[hp]]></dc:creator>
		<pubDate>Fri, 11 Jun 2010 09:57:32 +0000</pubDate>
				<category><![CDATA[computer stuff]]></category>
		<category><![CDATA[9]]></category>
		<category><![CDATA[APT]]></category>
		<category><![CDATA[Blog]]></category>
		<category><![CDATA[Click]]></category>
		<category><![CDATA[COM]]></category>
		<category><![CDATA[Computer]]></category>
		<category><![CDATA[Computer architecture]]></category>
		<category><![CDATA[D]]></category>
		<category><![CDATA[Darwin]]></category>
		<category><![CDATA[Dell]]></category>
		<category><![CDATA[Dia]]></category>
		<category><![CDATA[Drive]]></category>
		<category><![CDATA[EAR]]></category>
		<category><![CDATA[Event]]></category>
		<category><![CDATA[Events]]></category>
		<category><![CDATA[Final]]></category>
		<category><![CDATA[Find]]></category>
		<category><![CDATA[Flag]]></category>
		<category><![CDATA[Force]]></category>
		<category><![CDATA[GeForce 8 series]]></category>
		<category><![CDATA[Go]]></category>
		<category><![CDATA[Google]]></category>
		<category><![CDATA[Graphics hardware]]></category>
		<category><![CDATA[Graphics processing unit]]></category>
		<category><![CDATA[Hackintosh]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[IDE]]></category>
		<category><![CDATA[IME]]></category>
		<category><![CDATA[Installation]]></category>
		<category><![CDATA[It]]></category>
		<category><![CDATA[KPA]]></category>
		<category><![CDATA[Lag]]></category>
		<category><![CDATA[Laptop]]></category>
		<category><![CDATA[Leopard]]></category>
		<category><![CDATA[Lie]]></category>
		<category><![CDATA[Link]]></category>
		<category><![CDATA[Lost]]></category>
		<category><![CDATA[Mac OS X Leopard]]></category>
		<category><![CDATA[Mac OS X Snow Leopard]]></category>
		<category><![CDATA[MacOS]]></category>
		<category><![CDATA[Management]]></category>
		<category><![CDATA[Net]]></category>
		<category><![CDATA[NVIDIA]]></category>
		<category><![CDATA[Operating systems]]></category>
		<category><![CDATA[Port]]></category>
		<category><![CDATA[Reference]]></category>
		<category><![CDATA[Run]]></category>
		<category><![CDATA[Snow]]></category>
		<category><![CDATA[Snow leopard]]></category>
		<category><![CDATA[STR]]></category>
		<category><![CDATA[String]]></category>
		<category><![CDATA[Time]]></category>
		<category><![CDATA[Trac]]></category>
		<category><![CDATA[USB]]></category>
		<category><![CDATA[Video cards]]></category>
		<category><![CDATA[Wireless]]></category>
		<category><![CDATA[X86]]></category>
		<category><![CDATA[Z]]></category>
		<guid isPermaLink="false">http://henrypoon.mooo.com/blog/snow-leopard-on-a-dell-inspiron-1520</guid>

					<description><![CDATA[After a lot of reinstalling and kext testing I&#8217;ve finally managed to get my Inspiron 1520 to run Snow Leopard with the latest updates and things working. &#160;I tried my best to list the sources of info that I found, but I Googled so much useful and not so useful links that I don&#8217;t remember [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>After a lot of reinstalling and kext testing I&#8217;ve finally managed to get my Inspiron 1520 to run Snow Leopard with the latest updates and things working. &nbsp;I tried my best to list the sources of info that I found, but I Googled so much useful and not so useful links that I don&#8217;t remember which are which anymore.</p>
<p>Computer Specs:</p>
<p>Intel Core 2 Duo T5250 Processor<br />
2 GB RAM @ 667 Ghz<br />
Intel GM965 Chipset<br />
nVidia GeForce 8600M GT<br />
Dell Wireless 1390 802.11g</p>
<h1>Installation</h1>
<p>I was lucky enough to only need the Retail Snow Leopard Disc (10A432) and the <a href="http://osx86.sojugarden.com/2010/06/myhack-installer-1-1-released/" target="_blank" rel="noopener noreferrer">myHack Installer 1.0.1</a>. &nbsp;I pretty much followed METHOD 2 in this guide (method 1 didn&#8217;t really work out for me, but it might have had something to do with the disc restoration part of the guide):</p>
<p><a href="http://prasys.co.cc/2009/08/installing-snow-leopard-for-osx86/" target="_blank" rel="noopener noreferrer">http://prasys.co.cc/2009/08/installing-snow-leopard-for-osx86/</a></p>
<p>For the myHack installer, check the box for the kext that says something about PS2 in it. &nbsp;It will enable the laptop touchpad and keyboard. &nbsp;Also, read the description for each kext to see if you need it or not.</p>
<p>When I used method 1 in the guide, I had some trouble with an installation error that said &#8220;Could not verify BaseSystem.pkg&#8221; or something along those lines. &nbsp;That error appeared at about 10-15% installation progress. &nbsp;It went away then I used method 2. &nbsp;I did read somewhere that it may have had to do with the restoration in Disk Utility. &nbsp;Either way, it worked the second time around.</p>
<p>Once SL was installed, I ran the myHack Installer on my drive to get the Chameleon Bootloader on there so I wouldn&#8217;t have to use my USB to boot all the time. &nbsp;Also, be sure not to install GraphicsEnabler as it will prevent your computer from shutting down completely (more on that later).</p>
<h1>Graphics</h1>
<p>Since my laptop uses an nVidia card, there is an issue that prevents the computer from shutting down completely if the &#8220;GraphicsEnabler&#8221; option is used in the myHack Installer. &nbsp;I believe NVInject, NVKush, and NVDarwin all suffer from this same problem. &nbsp;What happens is that when the shut down command is invoked, the computer&#8217;s screen will turn off, the HD will turn off, but the power stays on. &nbsp;When the nVidia graphics kexts aren&#8217;t used, this problem goes away.</p>
<p>I&#8217;ve tried generating an EFI String and loading that with EFI Studio, but it didn&#8217;t do the job. &nbsp;The resolution is still 1024&#215;768 and I have no QE, CI or OpenGL support. &nbsp;What I did later on was install PC EFI to see if that would fix things (I didn&#8217;t really know what I was doing here at this point). &nbsp;That didn&#8217;t really work, but I did later find out that EFI Studio allows me to add boot flags. &nbsp;I added &#8220;Graphics Mode&#8221;=&#8221;1280x800x32&#8221; to the boot flag so now it boots with the proper resolution. &nbsp;It gives the proper resolution, but still no QE/CI or OpenGL. &nbsp;This guide has information on how to test for QE (Quartz Extreme) and CI (Core Image):&nbsp;<a href="http://prasys.co.cc/tag/enable-qeci/" target="_blank" rel="noopener noreferrer">http://prasys.co.cc/tag/enable-qeci/</a></p>
<p>Another thing I tried was to modify my DSDT to get my graphics card working using this link: <a href="http://tonymacx86.blogspot.com/2010/01/advanced-dsdt-fixes-nvidia-graphics.html" target="_blank" rel="noopener noreferrer">http://tonymacx86.blogspot.com/2010/01/advanced-dsdt-fixes-nvidia-graphics.html</a>. &nbsp;I managed to get the card recognized using the DSDT code, but when I got rid of the graphics kexts, and the boot.plist options as specified in the guide, I lost my graphics acceleration. &nbsp;I know my DSDT code is working here still since System Profiler tells me what card I have with the exact same names that I gave in the DSDT. &nbsp;It seems that having graphics acceleration and shutdown/restart working properly just isn&#8217;t meant to be.</p>
<p>The tradeoff:</p>
<p>I either could have proper graphics acceleration and no shutdown, OR I could have shut down and no graphics acceleration. &nbsp;Graphics is the clear winner here, but I still hate having no shutdown. &nbsp;I have not found a fix for this.</p>
<h1>Power Management</h1>
<p>There was a problem with high CPU temperatures with the laptop. &nbsp;I installed the VoodooPowerMini kext located here (<a href="http://forum.voodooprojects.org/index.php/topic,1095.0.html" target="_blank" rel="noopener noreferrer">http://forum.voodooprojects.org/index.php/topic,1095.0.html</a>)</p>
<h1>Audio</h1>
<p>After looking for various kexts, I found that VoodooHDA worked for me. &nbsp;It can be found here (<a href="http://www.kexts.com/view/70-voodoohda_(32--_64-bit,_recompiled_by_prasys).html" target="_blank" rel="noopener noreferrer">http://www.kexts.com/view/70-voodoohda_(32&#8211;_64-bit,_recompiled_by_prasys).html</a>).</p>
<h1>Wireless</h1>
<p>Works after installation.</p>
<h1>USB Ports</h1>
<p>They work since it can recognize my mouse and USB drive.</p>
<h1>Battery Indicator</h1>
<p>I used the VoodooBattery kext located here (<a href="http://forum.voodooprojects.org/index.php/topic,1092.0.html" target="_blank" rel="noopener noreferrer">http://forum.voodooprojects.org/index.php/topic,1092.0.html</a>)</p>
<h1>Card Reader</h1>
<p>I don&#8217;t use this so I didn&#8217;t install the kext for it. &nbsp;It can be found here: <a href="http://www.dailyblogged.com/retail-snow-leopard-installation-guide/" target="_blank" rel="noopener noreferrer">http://www.dailyblogged.com/retail-snow-leopard-installation-guide/</a> or <a href="http://www.dailyblogged.com/wp-content/uploads/2009/09/VoodooSDHC.kext.zip">SD Card Fix</a> (more direct).</p>
<h1>Touchpad</h1>
<p>I had an issue where I couldn&#8217;t tap the touchpad in order for it to &#8220;click&#8221;. &nbsp;I fixed this issue by installing the VoodooPS2Controller kext (check the Trackpad option during the installation) (<a href="http://forum.voodooprojects.org/index.php/topic,235.0.html" target="_blank" rel="noopener noreferrer">http://forum.voodooprojects.org/index.php/topic,235.0.html</a>). &nbsp;Then I installed the preference pane (this allows configuring the Trackpad through System Prefs) here <a href="http://www.dailyblogged.com/retail-snow-leopard-installation-guide/" target="_blank" rel="noopener noreferrer">http://www.dailyblogged.com/retail-snow-leopard-installation-guide/</a> (command -f to find it). &nbsp;I opened System Preferences and pressed the Show All button, and I saw a &#8220;Trackpad&#8221; option, so I opened it and the option was there.</p>
<h1>Webcam</h1>
<p>Works after installation.</p>
<h1>Conclusion</h1>
<p>Everything I listed here works except for video and the card reader. &nbsp;There are other things like Ethernet, but I don&#8217;t really use it.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.henrypoon.com/blog/2010/06/11/snow-leopard-on-a-dell-inspiron-1520/feed/</wfw:commentRss>
			<slash:comments>22</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">378</post-id>	</item>
		<item>
		<title>C++ Trimming Leading or Trailing Spaces</title>
		<link>https://blog.henrypoon.com/blog/2010/02/28/c-trimming-leading-or-trailing-spaces/</link>
					<comments>https://blog.henrypoon.com/blog/2010/02/28/c-trimming-leading-or-trailing-spaces/#respond</comments>
		
		<dc:creator><![CDATA[hp]]></dc:creator>
		<pubDate>Mon, 01 Mar 2010 01:18:02 +0000</pubDate>
				<category><![CDATA[computer stuff]]></category>
		<category><![CDATA[C++]]></category>
		<category><![CDATA[Comparison of programming languages]]></category>
		<category><![CDATA[D]]></category>
		<category><![CDATA[Find]]></category>
		<category><![CDATA[It]]></category>
		<category><![CDATA[Module:Sandbox/Gadget850/Echo]]></category>
		<category><![CDATA[STR]]></category>
		<category><![CDATA[String]]></category>
		<category><![CDATA[Thou]]></category>
		<guid isPermaLink="false">http://henrypoon.mooo.com/blog/c-trimming-leading-or-trailing-spaces</guid>

					<description><![CDATA[One can use one of the string methods find_last_not_of and find_first_not_of. What these methods do is that they return the index of the string where the character in that index does NOT match what you are looking for. For example: To get rid of the leading and trailing spaces in that string, we can do [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">One can use one of the string methods <em>find_last_not_of </em>and <em>find_first_not_of. </em>What these methods do is that they return the index of the string where the character in that index does NOT match what you are looking for.</p>



<p class="wp-block-paragraph">For example:</p>



<pre class="wp-block-code"><code lang="cpp" class="language-cpp">string str = " TEST STRING "; //there is a space in the beginning and end
cout &lt;&lt; str.find_first_not_of(" ") &lt;&lt; endl; //this line will return a 1, because thats the first thats not of a " </code></pre>



<p class="wp-block-paragraph">To get rid of the leading and trailing spaces in that string, we can do this:</p>



<pre class="wp-block-code"><code lang="cpp" class="language-cpp">str = str.substr(str.find_first_not_of(" ")); //str will now be assigned "TEST STRING ", note that there is still a space at the end

str = str.substr(0, str.find_last_not_of(" ") + 1) //now the trailing space is removed. &amp;amp;nbsp;a 1 is added because without it, we would get "TEST STRIN" instead.  the 1 ensures that only the space is removed</code></pre>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.henrypoon.com/blog/2010/02/28/c-trimming-leading-or-trailing-spaces/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">262</post-id>	</item>
		<item>
		<title>C++ String to Double or Integer Conversion</title>
		<link>https://blog.henrypoon.com/blog/2010/02/17/c-string-to-double-or-integer-conversion/</link>
					<comments>https://blog.henrypoon.com/blog/2010/02/17/c-string-to-double-or-integer-conversion/#respond</comments>
		
		<dc:creator><![CDATA[hp]]></dc:creator>
		<pubDate>Wed, 17 Feb 2010 23:00:36 +0000</pubDate>
				<category><![CDATA[computer stuff]]></category>
		<category><![CDATA[C++]]></category>
		<category><![CDATA[Combinatorics]]></category>
		<category><![CDATA[Computing]]></category>
		<category><![CDATA[D]]></category>
		<category><![CDATA[Fields of mathematics]]></category>
		<category><![CDATA[Formal languages]]></category>
		<category><![CDATA[It]]></category>
		<category><![CDATA[Module:String]]></category>
		<category><![CDATA[Module:String/sandbox]]></category>
		<category><![CDATA[STR]]></category>
		<category><![CDATA[String]]></category>
		<category><![CDATA[Z]]></category>
		<guid isPermaLink="false">http://henrypoon.mooo.com/blog/c-string-to-double-or-integer-conversion</guid>

					<description><![CDATA[If the string that is being converted is actually not a number, then it will return a zero.]]></description>
										<content:encoded><![CDATA[
<pre class="wp-block-code"><code lang="cpp" class="language-cpp">string str = "some number in the form of a string";

double a;

int b;

a = atof(str.c_str()); //conversion to double

b = atoi(str.c_str()); //conversion to int</code></pre>



<p class="wp-block-paragraph">If the string that is being converted is actually not a number, then it will return a zero.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.henrypoon.com/blog/2010/02/17/c-string-to-double-or-integer-conversion/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">229</post-id>	</item>
		<item>
		<title>C++ Vocabulary</title>
		<link>https://blog.henrypoon.com/blog/2010/01/18/c-vocabulary/</link>
					<comments>https://blog.henrypoon.com/blog/2010/01/18/c-vocabulary/#respond</comments>
		
		<dc:creator><![CDATA[hp]]></dc:creator>
		<pubDate>Tue, 19 Jan 2010 03:49:41 +0000</pubDate>
				<category><![CDATA[computer stuff]]></category>
		<category><![CDATA[Assembly language]]></category>
		<category><![CDATA[C++]]></category>
		<category><![CDATA[Chan]]></category>
		<category><![CDATA[COM]]></category>
		<category><![CDATA[Comment]]></category>
		<category><![CDATA[Computer]]></category>
		<category><![CDATA[Computer programming]]></category>
		<category><![CDATA[Const]]></category>
		<category><![CDATA[D]]></category>
		<category><![CDATA[Entry point]]></category>
		<category><![CDATA[Human]]></category>
		<category><![CDATA[Humans]]></category>
		<category><![CDATA[IDE]]></category>
		<category><![CDATA[It]]></category>
		<category><![CDATA[Language]]></category>
		<category><![CDATA[Object]]></category>
		<category><![CDATA[Opera]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Programming language implementation]]></category>
		<category><![CDATA[Programming languages]]></category>
		<category><![CDATA[Scope]]></category>
		<category><![CDATA[Software engineering]]></category>
		<category><![CDATA[Source code]]></category>
		<category><![CDATA[STR]]></category>
		<category><![CDATA[String]]></category>
		<category><![CDATA[Struct]]></category>
		<category><![CDATA[Subroutine]]></category>
		<category><![CDATA[UNC]]></category>
		<category><![CDATA[Variable]]></category>
		<category><![CDATA[Z]]></category>
		<guid isPermaLink="false">http://henrypoon.mooo.com/blog/c-vocabulary</guid>

					<description><![CDATA[Comment &#8211; text written in the source code that compiler ignores and is mainly meant for humans to read for showing how the program works Conditional &#8211; decides which set of actions that the program will perform depending on a programmer specified condition Constant &#8211; a special kind of variable whose value cannot change during [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><strong>Comment</strong> &#8211; text written in the source code that compiler ignores and is mainly meant for humans to read for showing how the program works</p>
<p><strong>Conditional </strong>&#8211; decides which set of actions that the program will perform depending on a programmer specified condition</p>
<p><strong>Constant</strong> &#8211; a special kind of variable whose value cannot change during program execution</p>
<p><strong>Control structure</strong> &#8211; refers to the order in which the individual statements, instructions, or function calls of an imperative or a declarative program are executed or evaluated</p>
<p><strong>Data structure </strong>&#8211; ways that data can be organized within a program</p>
<p><strong>Data type </strong>&#8211; different varieties that data can be represented within a program</p>
<p><strong>Directive</strong> &#8211; used to describe how the parts of a program are to be used to built a complete program</p>
<p><strong>Identifier</strong> &#8211; programmer-specified name; a sequence of characters associated with and used to access a variable, particular object, class or struct, or function. Every identifier has a scope</p>
<p><strong>Iteration</strong> &#8211; a single execution of a set of instructions that are to be repeated; &#8220;the solution took hundreds of iterations&#8221;</p>
<p><strong>Keyword</strong> &#8211; a word that has particular meaning to the programming language and describes how a program is to work</p>
<p><strong>Literal</strong> &#8211; a notation for representing a fixed value in source code.  For example, the literal 12 represents the integer value &#8220;twelve&#8221;, &#8220;Morning&#8221; represents the character string value &#8220;Morning&#8221; and true represents the Boolean value true.  They describe the type of value data has</p>
<p><strong>Naming structure</strong> &#8211; rules for how data values, variables, operators, and other language constructs are referred to within the language</p>
<p><strong>Operator</strong> &#8211; special symbols that specify how data is to be manipulated.  For example, a ++ is an operator</p>
<p><strong>Pragma</strong> &#8211; data embedded in source code by programmers to indicate some intention to the compiler</p>
<p><strong><strong>Sequential execution</strong></strong> &#8211; execution by a computer if instructions in a program, performed in the sequence established by a programmer</p>
<p><strong>Subprogram</strong> &#8211; a part of the code that is reused in various parts of the program</p>
<p><strong>Variable &#8211; </strong>remembers data values for use within a program</p>
<p><strong>Variable declaration</strong> &#8211; defining a variable&#8217;s type and name (identifier)</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.henrypoon.com/blog/2010/01/18/c-vocabulary/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">187</post-id>	</item>
		<item>
		<title>How to manually uninstall the 2007 Office system if you cannot uninstall it by using the &#8220;Add or Remove Programs&#8221; feature</title>
		<link>https://blog.henrypoon.com/blog/2009/12/03/how-to-manually-uninstall-the-2007-office-system-if-you-cannot-uninstall-it-by-using-the-add-or-remove-programs-feature/</link>
					<comments>https://blog.henrypoon.com/blog/2009/12/03/how-to-manually-uninstall-the-2007-office-system-if-you-cannot-uninstall-it-by-using-the-add-or-remove-programs-feature/#respond</comments>
		
		<dc:creator><![CDATA[hp]]></dc:creator>
		<pubDate>Thu, 03 Dec 2009 04:00:00 +0000</pubDate>
				<category><![CDATA[computer stuff]]></category>
		<category><![CDATA[.exe]]></category>
		<category><![CDATA[9]]></category>
		<category><![CDATA[Cache]]></category>
		<category><![CDATA[Chan]]></category>
		<category><![CDATA[Click]]></category>
		<category><![CDATA[COM]]></category>
		<category><![CDATA[Computer]]></category>
		<category><![CDATA[Control Panel]]></category>
		<category><![CDATA[D]]></category>
		<category><![CDATA[Dia]]></category>
		<category><![CDATA[Download]]></category>
		<category><![CDATA[Drive]]></category>
		<category><![CDATA[EAR]]></category>
		<category><![CDATA[Email]]></category>
		<category><![CDATA[Features new to Windows XP]]></category>
		<category><![CDATA[File Explorer]]></category>
		<category><![CDATA[Find]]></category>
		<category><![CDATA[Go]]></category>
		<category><![CDATA[Icon]]></category>
		<category><![CDATA[IDE]]></category>
		<category><![CDATA[Installation]]></category>
		<category><![CDATA[ise]]></category>
		<category><![CDATA[It]]></category>
		<category><![CDATA[Language]]></category>
		<category><![CDATA[Lie]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[Microsoft Office]]></category>
		<category><![CDATA[Microsoft Windows]]></category>
		<category><![CDATA[Net]]></category>
		<category><![CDATA[Opera]]></category>
		<category><![CDATA[Operating systems]]></category>
		<category><![CDATA[PATH]]></category>
		<category><![CDATA[Port]]></category>
		<category><![CDATA[Products]]></category>
		<category><![CDATA[Run]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[STR]]></category>
		<category><![CDATA[String]]></category>
		<category><![CDATA[Struct]]></category>
		<category><![CDATA[System software]]></category>
		<category><![CDATA[Template]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[User Account Control]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[Windows 7]]></category>
		<category><![CDATA[Windows Installer]]></category>
		<category><![CDATA[Windows key]]></category>
		<category><![CDATA[Windows Vista]]></category>
		<category><![CDATA[Windows XP]]></category>
		<category><![CDATA[WoW64]]></category>
		<category><![CDATA[X86]]></category>
		<category><![CDATA[Z]]></category>
		<guid isPermaLink="false">http://henrypoon.mooo.com/blog/how-to-manually-uninstall-the-2007-office-system-if-you-cannot-uninstall-it-by-using-the-add-or-remove-programs-feature</guid>

					<description><![CDATA[This article describes how to uninstall the existing 2007 Microsoft Office system if you cannot uninstall it by using the Add or Remove Programs feature (or Programs and Features in Windows Vista) in Control Panel. We recommend that you verify that you cannot uninstall by using Add or Remove Programs first. UPDATE: This set of [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">This article describes how to uninstall the existing 2007 Microsoft Office system if you cannot uninstall it by using the <strong>Add or Remove Programs</strong> feature (or <strong>Programs and Features</strong> in Windows Vista) in Control Panel. We recommend that you verify that you cannot uninstall by using <strong>Add or Remove Programs</strong> first.</p>



<p class="wp-block-paragraph">UPDATE: This set of instructions works for the Office 2010 Technical Preview as well.</p>



<p class="wp-block-paragraph"><strong>Based on: <a rel="noreferrer noopener" href="https://answers.microsoft.com/en-us/msoffice/forum/all/trying-to-install-office-2010-but-getting-error/4a5e022f-13f1-42bb-ad66-f6dccfd44d40" target="_blank">https://answers.microsoft.com/en-us/msoffice/forum/all/trying-to-install-office-2010-but-getting-error/4a5e022f-13f1-42bb-ad66-f6dccfd44d4</a></strong><a rel="noreferrer noopener" href="https://answers.microsoft.com/en-us/msoffice/forum/all/trying-to-install-office-2010-but-getting-error/4a5e022f-13f1-42bb-ad66-f6dccfd44d40" target="_blank">0</a></p>



<p class="wp-block-paragraph">To automatically uninstall the 2007 Microsoft Office suite, follow the steps in the following Microsoft Knowledge Base article: <a rel="noreferrer noopener" href="http://support.microsoft.com/kb/971179/" target="_blank">http://support.microsoft.com/kb/971179/</a></p>



<p class="wp-block-paragraph">How do I uninstall the 2007 Office suites if I cannot uninstall it by using the “Add or Remove Programs” feature?</p>



<p class="wp-block-paragraph">The steps provided in the &#8216;More Information&#8217; section of this article provide the details of the removal performed by the solution in 971179.</p>



<p class="wp-block-paragraph">You may find it easier to follow the steps if you print this article first.</p>



<p class="wp-block-paragraph"><strong>First, verify that you cannot uninstall the 2007 Microsoft Office system by using Add or Remove Programs (or Programs and Features)</strong></p>



<p class="wp-block-paragraph">To verify that you cannot uninstall the 2007 Microsoft Office system by using <strong>Add or Remove Programs</strong> (or <strong>Programs and Features</strong> in Windows Vista), follow these steps.</p>



<p class="wp-block-paragraph">For Windows XP or Windows Server 2003:</p>



<ol class="wp-block-list"><li>Click <strong class="uiterm">Start</strong>, click <strong class="uiterm">Run</strong>, type control appwiz.cpl in the <strong class="uiterm">Open</strong> box, and then press ENTER.</li><li>Click to select the 2007 Office system product from the application list, and then click <strong class="uiterm">Remove</strong>.</li></ol>



<p class="wp-block-paragraph">For Windows Vista:</p>



<ol class="wp-block-list"><li>Click <strong class="uiterm">Start</strong>, type prgrams and features in the <strong class="uiterm">Search</strong> box, and then press ENTER.</li><li>Click to select the product to be uninstalled from the listing of installed products, and then click <strong class="uiterm">Uninstall/Change</strong> from the bar that displays the available tasks.</li></ol>



<p class="wp-block-paragraph">If you were able to uninstall the 2007 Microsoft Office system by using <strong class="uiterm">Add or Remove Programs</strong>, you are finished. If you were unable to uninstall the 2007 Microsoft Office system, you may have issues with the <strong class="uiterm">Add or Remove Programs</strong> dialog box, or some 2007 Microsoft Office components may not be uninstalled. In these cases, you may be unable to reinstall the 2007 Microsoft Office system. Go to the next section to uninstall the 2007 Microsoft Office system by using an alternative method.<br><strong><br>If Add or Remove Programs does not uninstall the 2007 Microsoft Office system, use this alternative method to uninstall</strong></p>



<p class="wp-block-paragraph">Use this method only if the <strong class="uiterm">Add or Remove Programs</strong> method did not work for you. Using this method does not completely uninstall the 2007 Microsoft Office system. After you use this method, you can reinstall the 2007 Microsoft Office system.</p>



<p class="wp-block-paragraph"><strong>Note</strong> You must be logged on to Windows with a user account that is a computer administrator to complete this method. If this is your personal computer, you are likely already logged on with an administrator account. If this is a computer that is part of a network, you might have to ask the system administrator for help.</p>



<p class="wp-block-paragraph">To uninstall the existing 2007 Microsoft Office system if you cannot uninstall it by using the <strong class="uiterm">Add or Remove Programs</strong> feature, follow these steps:<br>Step 1: Remove any remaining Windows Installer packages of the 2007 Microsoft Office system:</p>



<ol class="wp-block-list"><li>Click <strong class="uiterm">Start</strong>, click <strong class="uiterm">Run</strong>, type installer, and then click <strong class="uiterm">OK</strong>.<br>This process opens the %windir%Installer folder.</li><li>On the <strong class="uiterm">View</strong> menu, click <strong class="uiterm">Details</strong>.<br><strong>Important</strong> To use the <strong class="uiterm">View</strong> menu in Windows Vista, you must press the ALT key first to display the menu bar, and then click the <strong class="uiterm">View</strong> menu.</li><li>On the <strong class="uiterm">View</strong> menu, click <strong class="uiterm">Choose Details</strong>.</li><li>Click to select the <strong class="uiterm">Subject</strong> check box, type 340 in the <strong class="uiterm">Width of selected column (in pixels)</strong> box, and then click <strong class="uiterm">OK</strong>.<br><strong>Note</strong> It may take several minutes for the subjects to appear next to each .msi file.</li><li>For Windows XP or Windows Server 2003, on the <strong class="uiterm">View</strong> menu, point to <strong class="uiterm">Arrange icons by</strong>, and then click <strong class="uiterm">Subject</strong>.<br>For Windows Vista, on the <strong class="uiterm">View</strong> menu, point to <strong class="uiterm">Sort By</strong>, and then click <strong class="uiterm">Subject</strong>. In Windows Vista, a <strong class="uiterm">User Account Control</strong> dialog box may be displayed with the following warning: <div class="kb_errormsgbody"><div class="kb_errorcontent"> <div class="errormsg">An unidentified program wants access to your computer</div></div></div><p>Click <strong class="uiterm">Allow</strong> when you see this warning message.</p></li><li>For each .msi file where the subject is &#8220;Microsoft Office <var>Product_Name</var> 2007,&#8221; right-click the .msi file, and then click <strong class="uiterm">Uninstall</strong>.<br><strong>Note </strong><var>Product_Name</var> is a placeholder for the name of the 2007 Microsoft Office product.</li></ol>



<h4 class="wp-block-heading" id="tocHeadRef">Step 2: Stop the Office Source Engine service:</h4>



<ol class="wp-block-list"><li>For Windows XP and Windows Server 2003, click <strong class="uiterm">Start</strong>, click <strong class="uiterm">Run</strong>, type services.msc in the <strong class="uiterm">Open</strong> box, and then click <strong class="uiterm">OK</strong>.<br>For Windows Vista, click <strong class="uiterm">Start</strong>, click <strong class="uiterm">Start Search</strong>, type services.msc, and then press ENTER.</li><li>In the <strong class="uiterm">Services</strong> window, determine whether the Office Source Engine service is running. If this service is running, right-click <strong class="uiterm">Office Source Engine</strong>, and then click <strong class="uiterm">Stop</strong>.</li><li>Close the <strong class="uiterm">Services</strong> window.</li></ol>



<h4 class="wp-block-heading" id="tocHeadRef">Step 3: Remove any remaining 2007 Microsoft Office installation folders</h4>



<ol class="wp-block-list"><li>For Windows XP and Windows Server 2003, click <strong class="uiterm">Start</strong>, click <strong class="uiterm">Run</strong>, type %CommonProgramFiles%\Microsoft Shared in the <strong class="uiterm">Open</strong> box, and then click <strong class="uiterm">OK</strong>.<br>For Windows Vista, click <strong class="uiterm">Start</strong>, click <strong class="uiterm">Start Search</strong>, type %CommonProgramFiles%\Microsoft Shared, and then press ENTER. <div class="indent"><strong>Note </strong>On a computer that is running a 64-bit version of Windows Vista, type %CommonProgramFiles(x86)%\Microsoft Shared, and then press ENTER.</div> </li><li>If the following folders are present, delete them: <ul><li>Office12</li><li>Source Engine </li></ul></li><li>For Windows XP and Windows Server 2003, click <strong class="uiterm">Start</strong>, click <strong class="uiterm">Run</strong>, type %ProgramFiles%\Microsoft Office, and then click <strong class="uiterm">OK</strong>.<br><strong>Note</strong> On a computer that is running a 64-bit version of Windows XP, type %ProgramFiles(x86)%\Microsoft Office, and then press ENTER.<br>For Windows Vista, click <strong class="uiterm">Start</strong>, click <strong class="uiterm">Start Search</strong>, type %ProgramFiles%\Microsoft Office, and then press ENTER. <div class="indent"><strong>Note</strong> On a computer that is running a 64-bit version of Windows Vista, type %ProgramFiles(x86)%\Microsoft Office, and then press ENTER.</div> </li><li>On the root folder of each hard disk drive, locate and then open the MSOCache folder. If you cannot see the MSOCache folder, follow these steps: <ol><li>Open Windows Explorer, and then on the <strong class="uiterm">Tools</strong> menu click <strong class="uiterm">Folder Options</strong>.</li><li>Click the <strong class="uiterm">View</strong> tab.</li><li>In the Advanced settings pane under <strong class="uiterm">Hidden files and folders</strong>, click <strong class="uiterm">Show hidden files and folders</strong>.</li><li>Click to clear the <strong class="uiterm">Hide protected operating system files</strong> check box, and then click <strong class="uiterm">OK</strong>. </li></ol></li><li>Open the <var>drive_letter</var>:\MSOCache\All Users folder, and then delete every folder that has the following text in the folder name: 0FF1CE<p><strong>Note</strong> This text contains a zero and a one for the letters &#8220;O&#8221; and &#8220;I.&#8221;</p></li></ol>



<h4 class="wp-block-heading" id="tocHeadRef">Step 4: Remove any remaining 2007 Microsoft Office installation files</h4>



<ol class="wp-block-list"><li>For Windows XP and Windows Server 2003, click <strong class="uiterm">Start</strong>, click Run, type %appdata%\microsoft\templates, and then click <strong class="uiterm">OK</strong>.<br>For Windows Vista, click <strong class="uiterm">Start</strong>, click <strong class="uiterm">Start Search</strong>, type %appdata%\microsoft\templates, and then press ENTER.</li><li>Delete the following files: <ul><li>Normal.dotm</li><li>Normalemail.dotm </li></ul></li><li>For Windows XP and Windows Server 2003, click <strong class="uiterm">Start</strong>, click <strong class="uiterm">Run</strong>, type %appdata%\microsoft\document building blocks\<var>Language_ID</var>, and then click <strong class="uiterm">OK</strong>.<br>For Windows Vista, click <strong class="uiterm">Start</strong>, click <strong class="uiterm">Start Search</strong>, type <strong class="uiterm">%appdata%\microsoft\document building blocks<var>\Language ID</var></strong>, and then press ENTER.  <div class="kb_nowrapper"><strong>Notes</strong></div> <ul><li>If you cannot open this folder because the folder does not exist, go to step 6.</li><li><var>Language_ID</var> is a placeholder for the four-digit number that represents the language of the 2007 Microsoft Office system. For example, if you use the English version of the 2007 Microsoft Office system, the Language_ID value is 1033. If the Language_ID is not known, type %appdata%microsoftdocument building blocks, and then open the subfolder in that location. </li></ul></li><li>Delete the Building blocks.dotx file.</li><li>For Windows XP and Windows Server 2003, click <strong class="uiterm">Start</strong>, click <strong class="uiterm">Run</strong>, type %temp%, and then click <strong class="uiterm">OK</strong>.<br>For Windows Vista, click <strong class="uiterm">Start</strong>, click <strong class="uiterm">Start Search</strong>, type %temp%, and then press ENTER.</li><li>On the <strong class="uiterm">Edit</strong> menu, click <strong class="uiterm">Select All</strong>.</li><li>On the <strong class="uiterm">File</strong> menu, click <strong class="uiterm">Delete</strong>.</li><li>For Windows XP and Windows Server 2003, click <strong class="uiterm">Start</strong>, click <strong class="uiterm">Run</strong>, type %AllUsersprofile%\Application Data\MicrosoftOfficeData, and then click <strong class="uiterm">OK</strong>.<br>For Windows Vista, click <strong class="uiterm">Start</strong>, click <strong class="uiterm">Start Search</strong>, type %AllUsersprofile%\Application DataMicrosoftOfficeData, and then press ENTER.</li><li>Delete only the Opa12.dat file.</li></ol>



<h4 class="wp-block-heading" id="tocHeadRef">Step 5: Remove the registry subkeys of the 2007 Microsoft Office system</h4>



<p class="wp-block-paragraph"><strong>Important:</strong> This section, method, or task contains steps that tell you how to modify the registry. However, serious problems might occur if you modify the registry incorrectly. Therefore, make sure that you follow these steps carefully. For added protection, back up the registry before you modify it. Then, you can restore the registry if a problem occurs. For more information about how to back up and restore the registry, click the following article number to view the article in the Microsoft Knowledge Base: <a href="http://support.microsoft.com/kb/322756/" target="_blank" rel="noreferrer noopener">http://support.microsoft.com/kb/322756/</a></p>



<ol class="wp-block-list"><li>Locate and then delete the registry subkeys of the 2007 Microsoft Office system if they are present. To do this, follow these steps: <ol><li>For Windows XP and Windows Server 2003, click <strong class="uiterm">Start</strong>, click <strong class="uiterm">Run</strong>, type regedit, and then click <strong class="uiterm">OK</strong>.<br>For Windows Vista, click <strong class="uiterm">Start</strong>, click <strong class="uiterm">Start Search</strong>, type regedit, and then click <strong class="uiterm">OK</strong>.</li><li>Click the following subkey: <div class="indent">HKEY_CURRENT_USER\Software\Microsoft\Office\12.0</div> </li><li>On the <strong class="uiterm">File</strong> menu, click <strong class="uiterm">Export</strong>, type DeletedKey01, and then click <strong class="uiterm">Save</strong>.</li><li>On the <strong class="uiterm">Edit</strong> menu, click <strong class="uiterm">Delete</strong>, and then click <strong class="uiterm">Yes</strong> to confirm the deletion.</li><li>For each registry subkey in the following list, repeat steps 1a through 1d. Change the name of the exported key by one for each subkey.<br>For example, type DeletedKey02 for the second key, type DeletedKey03 for the third key, and so on.<br><strong>Note</strong> In the following registry keys, the asterisk character (*) represents one or more characters in the subkey name.<br><strong>32-bit versions of Microsoft Windows:</strong>  <ul><li>HKEY_CURRENT_USER\Software\Microsoft\Office\12.0</li><li>HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\12.0</li><li>HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\Delivery\SourceEngine\Downloads\*0FF1CE}-*</li><li>HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\*0FF1CE*</li><li>HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UpgradeCodes\*F01FEC</li><li>HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Products\*F01FEC</li><li>HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\ose</li><li>HKEY_CLASSES_ROOT\Installer\Features\*F01FEC</li><li>HKEY_CLASSES_ROOT\Installer\Products\*F01FEC</li><li>HKEY_CLASSES_ROOT\Installer\UpgradeCodes\*F01FEC</li><li>HKEY_CLASSES_ROOT\Installer\Win32Assemblies\*Office12* <p><strong>64-bit versions of Microsoft Windows: </strong></p></li></ul><ul><li>HKEY_CURRENT_USER\Software\Microsoft\Office\12.0</li><li>HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Office\12.0</li><li>HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Office\DeliverySourceEngineDownloads\*0FF1CE}-*</li><li>HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*0FF1CE*</li><li>HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Installer\UpgradeCodes\*F01FEC</li><li>HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Products\*F01FEC</li><li>HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\ose</li><li>HKEY_CLASSES_ROOT\Installer\Features\*F01FEC</li><li>HKEY_CLASSES_ROOT\Installer\Products\*F01FEC</li><li>HKEY_CLASSES_ROOT\Installer\UpgradeCodes\*F01FEC</li><li>HKEY_CLASSES_ROOT\Installer\Win32Assemblies\*Office12*  </li></ul></li></ol></li><li>Locate the following registry subkey: <div class="indent">HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall</div><p><strong>Note</strong> On a computer that is running a 64-bit version of Windows, locate the following registry subkey instead:</p><div class="indent">HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall</div> </li><li>On the <strong class="uiterm">File</strong> menu, click <strong class="uiterm">Export</strong>, type UninstallKey01, and then click <strong class="uiterm">Save</strong>.</li><li>Under the Uninstall subkey that you located in step 2, click each subkey, and then determine whether the subkey has the following value assigned to it: <ul><li><strong>Name</strong>: UninstallString</li><li><strong>Data</strong>: <var>file_name path</var>\Office Setup Controller\Setup.exe path<br><strong>Note</strong> In this example, <var>file_name</var> is a placeholder for the name of an installation program, and path is a placeholder for the file path. </li></ul></li><li>If the subkey contains the name and the data that are described in step 4, click <strong class="uiterm">Delete</strong> on the <strong class="uiterm">Edit</strong> menu. Otherwise, go to step 4.</li><li>Repeat steps 4 and 5 until you locate and then delete every subkey that matches the name and the data that are described in step 4.</li><li>Close Registry Editor.</li></ol>



<h4 class="wp-block-heading" id="tocHeadRef">Step 6: Restart the computer</h4>



<p class="wp-block-paragraph">Restart the computer. If the uninstall was successful, you are finished and can now reinstall the 2007 Microsoft Office system if you want. If the uninstall was not successful, go to the &#8220;Next Steps&#8221; section.</p>



<p class="wp-block-paragraph"><strong>Additional registry information</strong></p>



<p class="wp-block-paragraph">HKEY_CURRENT_USER\Software\Microsoft\Office\Common\UserInfo</p>



<p class="wp-block-paragraph">Shadow subkeys for Windows Server 2003 and for earlier versions of Windows Server:</p>



<p class="wp-block-paragraph">HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Terminal Server\Install\Software\Microsoft\Office\12.0</p>



<p class="wp-block-paragraph">Shadow subkeys for Windows Server 2008:</p>



<p class="wp-block-paragraph">HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Terminal Server\Install\Software</p>



<p class="wp-block-paragraph">Source: <a href="http://support.microsoft.com/default.aspx/kb/928218" target="_blank" rel="noreferrer noopener">http://support.microsoft.com/default.aspx/kb/928218</a></p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.henrypoon.com/blog/2009/12/03/how-to-manually-uninstall-the-2007-office-system-if-you-cannot-uninstall-it-by-using-the-add-or-remove-programs-feature/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">30</post-id>	</item>
	</channel>
</rss>
