<?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>Daily Morn by Raymond Li</title>
	<atom:link href="http://rayli.net/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://rayli.net/blog</link>
	<description></description>
	<lastBuildDate>Sun, 22 Jan 2012 02:52:33 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=</generator>
		<item>
		<title>Quicktime to AVI converter for free</title>
		<link>http://rayli.net/blog/2011/11/quicktime-to-avi-converter-for-free/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=quicktime-to-avi-converter-for-free</link>
		<comments>http://rayli.net/blog/2011/11/quicktime-to-avi-converter-for-free/#comments</comments>
		<pubDate>Thu, 01 Dec 2011 01:58:39 +0000</pubDate>
		<dc:creator>Raymond Li</dc:creator>
				<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://rayli.net/blog/?p=978</guid>
		<description><![CDATA[Need to convert your Quicktime mov file to the AVI format? Here&#8217;s a free and fast way to do it. STEP 1: Make a directory called temp\. Let&#8217;s put it on the Desktop. STEP 2: Put the Quicktime movie you&#8217;d like to convert in the new temp\ directory. STEP 3: Download a 32-bit version of [...]]]></description>
			<content:encoded><![CDATA[<p>Need to convert your Quicktime mov file to the AVI format? Here&#8217;s a free and fast way to do it.</p>
<p><span id="more-978"></span></p>
<p>STEP 1: Make a directory called <em>temp\</em>. Let&#8217;s put it on the Desktop.</p>
<p>STEP 2: Put the Quicktime movie you&#8217;d like to convert in the new <em>temp\</em> directory.</p>
<p>STEP 3: Download a 32-bit version of <em>ffmpeg </em>from here: <a href="http://ffmpeg.zeranoe.com/builds/win32/static/">http://ffmpeg.zeranoe.com/builds/win32/static/</a>. Decompress the 7z file. You may need to download and install 7-zip if you don&#8217;t already have it: <a href="http://www.7-zip.org/download.html">http://www.7-zip.org/download.html</a>. The result should look something like this:</p>
<p style="text-align: center;"><img class="aligncenter" title="Temp directory" src="http://rayli.net/ref/2011-11/temp_dir.jpg" alt="Temp directory" width="450" height="326" /></p>
<p>STEP 4: Open a command prompt by navigating to <em>Start Menu &gt; Run</em>.</p>
<p><img class="aligncenter" title="Run" src="http://rayli.net/ref/2011-11/run.jpg" alt="Run" width="400" height="492" /></p>
<p>STEP 5: Type <em>cmd </em>and press Enter.</p>
<p style="text-align: center;"><img class="aligncenter" title="Run Dialog" src="http://rayli.net/ref/2011-11/run_dialog.jpg" alt="Run Dialog" width="400" height="205" /></p>
<p>STEP 6: cd to the <em>temp\</em> directory on the Desktop.</p>
<p>STEP 7: Run the <em>ffmpeg</em>command replacing <em>quicktime.mov</em> with your movie file and replace <em>quicktime.avi</em> with your desired output file:</p>
<pre class="brush: bash; title: ; notranslate">
ffmpeg -i aoeu.mov aoeu.avi
</pre>
<p>Here is an example:</p>
<p><img class="aligncenter" title="ffmgep command" src="http://rayli.net/ref/2011-11/cmd_ffmpeg.jpg" alt="ffmgep command" width="450" height="217" /></p>
<p>Press ENTER and you have successfully converted your file to the AVI format!</p>
]]></content:encoded>
			<wfw:commentRss>http://rayli.net/blog/2011/11/quicktime-to-avi-converter-for-free/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Vi Help</title>
		<link>http://rayli.net/blog/2011/10/vi-help/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=vi-help</link>
		<comments>http://rayli.net/blog/2011/10/vi-help/#comments</comments>
		<pubDate>Tue, 01 Nov 2011 01:58:05 +0000</pubDate>
		<dc:creator>Raymond Li</dc:creator>
				<category><![CDATA[Vim]]></category>

		<guid isPermaLink="false">http://rayli.net/blog/?p=946</guid>
		<description><![CDATA[New to Vi? Find out what Vi does, what Vi does not do, where Vi comes from and when to run Vi. What does it do? Vi (pronounced vee-eye) is a text editor. It allows you to edit files interactively and visually see the changes at the same time. The original Vi is a modal [...]]]></description>
			<content:encoded><![CDATA[<p>New to Vi? Find out what Vi does, what Vi does not do, where Vi comes from and when to run Vi.</p>
<p><span id="more-946"></span></p>
<h3>What does it do?</h3>
<p>Vi (pronounced vee-eye) is a text editor. It allows you to edit files interactively and visually see the changes at the same time.</p>
<p>The original Vi is a modal editor consisting of two modes: normal mode and insert mode. In normal mode, keystrokes are interpreted as commands (i.e. &#8211; &#8220;j&#8221; moves down one line and &#8220;k&#8221; moves up one line). In insert mode, keystrokes are typed directly into the file being edited. Many of the text editor applications we are familiar with consist of only a single insert mode: Microsoft Word, Notepad, Wordpad, and even the email editor web applications (i.e. &#8211; Gmail).</p>
<h3>What does it not do?</h3>
<p>The original Vi text editor does not format the text in your files. Bold, italics, underlining, font size, font color (the list goes on) are not features of Vi. Vi does not do spell-checking. Vi does not do any syntax highlighting for programming languages like Perl, Python, etc.</p>
<p>As over 30 years have gone by since vi was created, many clones have been created: Stevie, Elvis, nvi and Vim, just to name a few. Many of these clones have plug-ins that support spell-check, syntax highlighting, and much more.</p>
<h3>Where does it come from?</h3>
<p>Vi is the visual mode of  a line editor called ex.</p>
<p>However, it all started with ed which is a UNIX command line editor for teletypes. ed was written by Ken Thompson in 1971. In February 1976, George Coulouris modified Thompson&#8217;s code and created em editor which is designed for display terminals. Bill Joy and Chuck Haley then took em, modified it to create en, and then modified that to create ex.</p>
<p>In October 1977, vi was born from the mind of Bill Joy. It was officially released as the visual mode of ex 1.1 in the first BSD Unix release in March 1978. Seeing the popularity of the visual mode, ex 2.0  included a short-cut to go directly to the visual mode by using the command vi.</p>
<h3>When should you run it?</h3>
<p>Anytime you need to edit a text file, vi can be run. For example, to edit help.txt, type: vi help.txt. Vi will launch and display the contents of help.txt.It is important to avoid the use of vi in the presence of an adamant EMACS user (especially Church of EMACS members). The possibility of being insulted, attacked or even becoming the target of an evangelistic conversion process are all within the realm of reality. In all seriousness, the vi vs. EMACS debate is an on-going rivalry that will likely have no end. Caveat emptor… <img src='http://rayli.net/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<h3>Next Steps</h3>
<p>Check out some of the references below for more information about vi and its family of clones. If Vi gives you a warm fuzzy feeling, make sure to check out Vim … the de facto Vi clone these days. It even has a great support for Windows!</p>
<h3>References</h3>
<p>Wikipedia &#8211; Vi<br />
<a title="Wikipedia - Vi" href="http://en.wikipedia.org/wiki/Vi"> http://en.wikipedia.org/wiki/Vi</a></p>
<p>The Vi Lovers Home Page<br />
<a title="The Vi Lovers Home Page" href="http://thomer.com/vi/vi.html"> http://thomer.com/vi/vi.html</a></p>
<p>Wikipedia &#8211; Ed (text editor)<br />
<a title="Wikipedia - Ed (text editor)" href="http://en.wikipedia.org/wiki/Ed_(text_editor)"> http://en.wikipedia.org/wiki/Ed_(text_editor)</a></p>
<p>Vim, The Editor<br />
<a title="Vim, The Editor" href="http://vim.sourceforge.net/"> http://vim.sourceforge.net/</a></p>
<p>An Introduction to Display Editing with Vi<br />
<a title="An Introduction to Display Editing with Vi" href="http://docs.freebsd.org/44doc/usd/12.vi/paper.html"> http://docs.freebsd.org/44doc/usd/12.vi/paper.html</a></p>
<p>Wikipedia &#8211; Editor War<br />
<a title="Wikipedia - Editor War" href="http://en.wikipedia.org/wiki/Editor_war"> http://en.wikipedia.org/wiki/Editor_war</a></p>
<div id="_mcePaste">Emacs &#8211; The Sacred Editor</div>
<div id="_mcePaste"><a title="Emacs - The Sacred Editor" href="http://www.dina.dk/~abraham/religion/">http://www.dina.dk/~abraham/religion/</a></div>
]]></content:encoded>
			<wfw:commentRss>http://rayli.net/blog/2011/10/vi-help/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>PSHamcrest 0.1-alpha released!</title>
		<link>http://rayli.net/blog/2011/09/pshamcrest-0-1-alpha-released/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=pshamcrest-0-1-alpha-released</link>
		<comments>http://rayli.net/blog/2011/09/pshamcrest-0-1-alpha-released/#comments</comments>
		<pubDate>Thu, 01 Sep 2011 14:01:27 +0000</pubDate>
		<dc:creator>Raymond Li</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Powershell]]></category>

		<guid isPermaLink="false">http://rayli.net/blog/?p=929</guid>
		<description><![CDATA[PSHamcrest is released! PSHamcrest is a very basic Powershell unit test framework inspired by Hamcrest. It&#8217;s super easy to use &#8212; just dump it in the same directory and dot source it. I looked around on the Internet and didn&#8217;t find a simple, no frills unit test framework for PowerShell that leveraged Hamcrest matchers. So [...]]]></description>
			<content:encoded><![CDATA[<p>PSHamcrest is released! PSHamcrest is a very basic Powershell unit test framework inspired by Hamcrest. It&#8217;s super easy to use &#8212; just dump it in the same directory and dot source it.</p>
<p><span id="more-929"></span></p>
<p>I looked around on the Internet and didn&#8217;t find a simple, no frills unit test framework for PowerShell that leveraged Hamcrest matchers. So I wrote one! Being relatively new to PowerShell, I probably haven&#8217;t leveraged common PowerShell idioms. Hopefully, it&#8217;s easy enough to modify and tailor to your project. This is my first shot at it. Comments and suggestions are welcome!</p>
<p>Official PSHamcrest Page:<br />
<a title="PSHamcrest" href="http://rayli.net/blog/pshamcrest">http://rayli.net/blog/pshamcrest</a></p>
<p>Codeplex Page:<br />
<a title="PSHamcrest - Codeplex Page" href="http://pshamcrest.codeplex.com/">http://pshamcrest.codeplex.com/</a></p>
<p>Latest release:<br />
<a title="PSHamcrest Latest Release" href="http://pshamcrest.codeplex.com/releases">http://pshamcrest.codeplex.com/releases</a></p>
<p>Browse the latest source code:<br />
<a title="PSHamcrest Source Code" href="http://pshamcrest.codeplex.com/SourceControl/BrowseLatest">http://pshamcrest.codeplex.com/SourceControl/BrowseLatest</a></p>
]]></content:encoded>
			<wfw:commentRss>http://rayli.net/blog/2011/09/pshamcrest-0-1-alpha-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to install Office on a netbook?</title>
		<link>http://rayli.net/blog/2011/08/how-to-install-office-on-a-netbook/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=how-to-install-office-on-a-netbook</link>
		<comments>http://rayli.net/blog/2011/08/how-to-install-office-on-a-netbook/#comments</comments>
		<pubDate>Tue, 02 Aug 2011 01:30:10 +0000</pubDate>
		<dc:creator>Raymond Li</dc:creator>
				<category><![CDATA[Windows]]></category>
		<category><![CDATA[Netbook]]></category>

		<guid isPermaLink="false">http://rayli.net/blog/?p=872</guid>
		<description><![CDATA[Netbooks generally lack CD or DVD drives, but installing Office 2010 Professional (or just about any software that comes on CD or DVD) only takes a few extra steps. Here&#8217;s one way to do it. Things you&#8217;ll need: Second computer with a CD or DVD drive. USB drive that has enough capacity to store the [...]]]></description>
			<content:encoded><![CDATA[<p>Netbooks generally lack CD or DVD drives, but installing Office 2010 Professional (or just about any software that comes on CD or DVD) only takes a few extra steps. Here&#8217;s one way to do it.</p>
<p><span id="more-872"></span></p>
<p>Things you&#8217;ll need:</p>
<ol>
<li>Second computer with a CD or DVD drive.</li>
<li>USB drive that has enough capacity to store the CD/DVD contents.</li>
</ol>
<p>You&#8217;ll need a computer with a CD or DVD drive that can read your Office 2010 installation CD/DVD. Here&#8217;s what you do:</p>
<ol>
<li>Using the second computer, copy the contents of the CD/DVD to your USB drive.</li>
<li>A trial version of Office came with my Acer Aspire One netbook. To get as clean an installation as possible, I uninstalled Office from my netbook first.</li>
<li>Plug the USB drive into your netbook.</li>
<li>Run the Office Setup file from your USB drive.</li>
<li>Make sure you have the product key.</li>
<li>Install, activate and enjoy your Office 2010 Professional installation!</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://rayli.net/blog/2011/08/how-to-install-office-on-a-netbook/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Touchpad scroll not working in Firefox on Thinkpad</title>
		<link>http://rayli.net/blog/2011/07/touchpad-scroll-not-working-in-firefox-on-thinkpad/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=touchpad-scroll-not-working-in-firefox-on-thinkpad</link>
		<comments>http://rayli.net/blog/2011/07/touchpad-scroll-not-working-in-firefox-on-thinkpad/#comments</comments>
		<pubDate>Sun, 10 Jul 2011 21:50:41 +0000</pubDate>
		<dc:creator>Raymond Li</dc:creator>
				<category><![CDATA[Popular]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[Thinkpad]]></category>

		<guid isPermaLink="false">http://rayli.net/blog/?p=864</guid>
		<description><![CDATA[Trackpoint/touchpad scrolling in Firefox 5 doesn&#8217;t work for you? There&#8217;s no need to configure a complicated Firefox JavaScript hack or change any Firefox scroll settings. Here&#8217;s what worked for me&#8230; I&#8217;m running a Lenovo Thinkpad W500, Windows 7 64-bit and Firefox 5. To get Firefox scrolling working, I updated the UltraNav driver. Previously, I was [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://rayli.net/blog/2011/07/touchpad-scroll-not-working-in-firefox-on-thinkpad"><img class="alignleft" title="Touchpad scroll won't work in Firefox on Thinkpad" src="http://rayli.net/ref/2011-07/trackpoint.png" alt="Touchpad scroll won't work in Firefox on Thinkpad" width="142" height="100" /></a>Trackpoint/touchpad scrolling in Firefox 5 doesn&#8217;t work for  you? There&#8217;s no need to configure a complicated Firefox JavaScript hack  or change any Firefox scroll settings. Here&#8217;s what worked for me&#8230;</p>
<p><span id="more-864"></span></p>
<p>I&#8217;m running a Lenovo Thinkpad W500, Windows 7 64-bit and Firefox 5. To get Firefox scrolling working, I updated the UltraNav driver. Previously, I was running v13.2.4.12 (Jul-14-2009). Updating it to v15.3.6.0 (May-5-2011) and rebooting fixed the scrolling. Hopefully, it works for you, too.</p>
<p>The <a title="UltraNav driver for Windows 7 (32-bit, 64-bit), Vista (32-bit, 64-bit) and XP (32-bit, 64-bit)" href="http://www-307.ibm.com/pc/support/site.wss/MIGR-66898.html">UltraNav driver for Windows 7 (32-bit, 64-bit), Vista (32-bit, 64-bit) and XP (32-bit, 64-bit)</a> can be found on the Lenovo Support site.</p>
]]></content:encoded>
			<wfw:commentRss>http://rayli.net/blog/2011/07/touchpad-scroll-not-working-in-firefox-on-thinkpad/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>OneNote Skydrive on Windows Phone 7</title>
		<link>http://rayli.net/blog/2011/06/onenote-skydrive-on-windows-phone-7/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=onenote-skydrive-on-windows-phone-7</link>
		<comments>http://rayli.net/blog/2011/06/onenote-skydrive-on-windows-phone-7/#comments</comments>
		<pubDate>Thu, 30 Jun 2011 18:24:35 +0000</pubDate>
		<dc:creator>Raymond Li</dc:creator>
				<category><![CDATA[Windows Phone 7]]></category>
		<category><![CDATA[OneNote]]></category>

		<guid isPermaLink="false">http://rayli.net/blog/?p=848</guid>
		<description><![CDATA[OneNote syncing from your Windows Phone 7 device to the web and to the desktop version of OneNote is awesome. But what about OneNote notebooks that weren&#8217;t created on my Windows Phone 7 device? How do I get them on my phone? The process for opening OneNote notebooks that weren&#8217;t created on your phone is [...]]]></description>
			<content:encoded><![CDATA[<p>OneNote syncing from your Windows Phone 7 device to the web and to the desktop version of OneNote is awesome. But what about OneNote notebooks that weren&#8217;t created on my Windows Phone 7 device? How do I get them on my phone?</p>
<p><span id="more-848"></span></p>
<p>The process for opening OneNote notebooks that weren&#8217;t created on your phone is a bit awkward, but once you get used to it, it only takes the minute or so to login to SkyDrive and off you go! The basic idea is to navigate to your document in SkyDrive and open your OneNote notebook from there.</p>
<ol>
<li>In your Windows Phone 7 browser, navigate to <a title="SkyDrive" href="http://skydrive.live.com">http://skydrive.live.com</a>. If you&#8217;re using IE, make sure your &#8220;Website preference&#8221; is set to &#8220;Mobile version.&#8221;</li>
<li>In SkyDrive, navigate to the OneNote document you&#8217;d like to open on your mobile device and click on it.</li>
<li>And that&#8217;s all there is! The OneNote document is now imported onto your phone.</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://rayli.net/blog/2011/06/onenote-skydrive-on-windows-phone-7/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Trackball scrolling</title>
		<link>http://rayli.net/blog/2011/05/trackball-scrolling/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=trackball-scrolling</link>
		<comments>http://rayli.net/blog/2011/05/trackball-scrolling/#comments</comments>
		<pubDate>Tue, 31 May 2011 12:44:18 +0000</pubDate>
		<dc:creator>Raymond Li</dc:creator>
				<category><![CDATA[Hardware]]></category>
		<category><![CDATA[mouse]]></category>

		<guid isPermaLink="false">http://rayli.net/blog/?p=830</guid>
		<description><![CDATA[Trackball scrolling is a challenging issue, since some trackballs largely ignore the issue (Logitech Marble Mouse) and other solutions are quite pricey (Kensington Slimblade Trackball). Here&#8217;s a solution that  worked for me&#8230; The Kensington Orbit Trackball with Scroll Ring is as simple and practical as it gets. Without repeating my review, you can check it [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.amazon.com/review/R1HGYFZAZ3BHVD"><img class="alignleft" title="Raymond Li's review of Kensington Orbit Trackball with Scroll Ring" src="http://rayli.net/img/scrollring.png" alt="Raymond Li's review of Kensington Orbit Trackball with Scroll Ring" width="100" height="100" /></a>Trackball scrolling is a challenging issue, since some trackballs largely ignore the issue (<a title="Logitech Marble Mouse" href="http://www.google.com/search?q=Logitech+Marble+Mouse">Logitech Marble Mouse</a>) and other solutions are quite pricey (<a title="Kensington Slimblade Trackball" href="http://www.google.com/search?q=kensington+slimblade+trackball">Kensington Slimblade Trackball</a>). Here&#8217;s a solution that  worked for me&#8230;</p>
<p><span id="more-830"></span>The Kensington Orbit Trackball with Scroll Ring is as simple and practical as it gets. Without repeating my review, you can check it out on Amazon: <a title="Raymond Li's review of Kensington Orbit Trackball with Scroll Ring" href="http://www.amazon.com/review/R1HGYFZAZ3BHVD">Raymond Li&#8217;s review of Kensington Orbit Trackball with Scroll Ring</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://rayli.net/blog/2011/05/trackball-scrolling/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Swarm, Particle! Swarm! Part 1</title>
		<link>http://rayli.net/blog/2011/04/swarm-particle-swarm-part-1/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=swarm-particle-swarm-part-1</link>
		<comments>http://rayli.net/blog/2011/04/swarm-particle-swarm-part-1/#comments</comments>
		<pubDate>Sun, 01 May 2011 03:42:32 +0000</pubDate>
		<dc:creator>Raymond Li</dc:creator>
				<category><![CDATA[Bioinformatics]]></category>
		<category><![CDATA[JHU]]></category>
		<category><![CDATA[PSO]]></category>

		<guid isPermaLink="false">http://rayli.net/blog/?p=781</guid>
		<description><![CDATA[The particle swarm optimization algorithm can be an effective algorithm for solving difficult problems. Why use particle swarms to solve problems? How does it work? What is particle swarm optimization? Particle swarm optimization (PSO) is an algorithm whose goal is to find the optimal solution for a problem. Give me an example. Let&#8217;s say the [...]]]></description>
			<content:encoded><![CDATA[<p>The particle swarm optimization algorithm can be an effective algorithm for solving difficult problems. Why use particle swarms to solve problems? How does it work?</p>
<p><span id="more-781"></span><em><strong>What is particle swarm optimization?</strong></em></p>
<p>Particle swarm optimization (PSO) is an algorithm whose goal is to find the optimal solution for a problem.</p>
<p><em><strong>Give me an example.</strong></em></p>
<p>Let&#8217;s say the problem you&#8217;re attempting to solve is <em>x*x + y*y = 0</em>. Potential solutions to this problem consist of <em>(x,y)</em> pairs. Any <em>(x,y)</em> pair could be a potential solution:</p>
<ul>
<li><em>(1,3)</em></li>
<li><em>(4,2)</em></li>
<li><em>(5,9)</em></li>
</ul>
<p>In PSO, a potential solution is represented by a particle. Therefore, a particle with the values <em>(1,3)</em> represents the potential solution <em>(1,3)</em>. If x and y are coordinates on an x-y coordinate system, the particle with the values<em> (1,3)</em> would be positioned at <em>x=1</em> and <em>y=3</em>. If the particle moves to <em>x=4</em> and <em>y=2</em>, it now represents a different potential solution, namely<em> (4,2)</em>.</p>
<p>Each time the particle moves to a different position, it uses its <em>(x,y)</em> values and plugs them into the problem <em>(x*x+y*y=0)</em> to see if it gets 0. If not, it moves to another location which represents yet another potential solution. If more than one of these particles is moving around looking for potential solutions, we get a particle swarm. Particle swarms moving around in this manner are searching for the optimal solution to the problem.</p>
<p><em><strong>This seems like random guesswork. How does the particle swarm find the right solution?<br />
</strong></em></p>
<p>The short answer is that each particle&#8217;s movement is not completely random. Particles are influenced by their personal experience and the experience of the entire swarm. Due to these influences, the swarm tends to converge on the optimal solution.</p>
<p><strong><em>What is a particle&#8217;s personal experience?</em></strong></p>
<p>Every particle remembers the best solution it has come across in its own personal experience. As the particle moves from position to position, it plugs them into the problem and gets a result. The closer this result is to 0, the closer it is to the optimal or &#8220;right&#8221; solution. When the particle encounters a solution that is more optimal than the solution currently in its memory, the new solution replaces the older, less optimal solution in the particle&#8217;s memory.</p>
<p><strong><em>Cool&#8230; so what&#8217;s the experience of the entire swarm?</em></strong></p>
<p>When a particle moves to a different position, not only is the new solution compared with the particle&#8217;s memory, the solution is compared with the swarm&#8217;s memory. If the new solution is more optimal than the current solution in the swarm&#8217;s memory, the new solution replaces the less optimal solution in the swarm&#8217;s memory. In addition to each particle remembering the single most optimal solution it&#8217;s found so far, the swarm also remembers the single most optimal solution found so far.</p>
<p><em><strong>How do these experiences influence the particle&#8217;s movement?</strong></em></p>
<p>The actual mechanics of how the particle is influenced will be explained in another post. Despite the particle flying around randomly, it has a tendency to be pulled in the direction of its best personal solution as well as the swarm&#8217;s best solution.</p>
<p><em><strong>But how does it find the best solution?</strong></em></p>
<p>There is no guarantee that it finds the best solution.</p>
<p>The particles are randomly searching all solutions with a tendency to be pulled in the direction of the best solution it&#8217;s found and the best solution found by the swarm. This tendency makes the swarm focus its search in relatively promising regions in hopes of finding a better solution.</p>
<p>It&#8217;s possible for a swarm to converge on a non-optimal solution too quickly before getting a chance to search the rest of the solutions. Balancing the weight of influence from both personal and swarm experience is one of the most important factors for the swarm converging on the optimal solution.</p>
<p><em><strong>Where can I find more information about PSO?</strong></em></p>
<p>If you&#8217;re looking for the paper that started it all, here&#8217;s the original paper from Kennedy and Eberhart: <a title="Particle Swarm Optimization" href="http://scholar.google.com/scholar?cluster=12071314502045197672&amp;hl=en&amp;as_sdt=0,21&amp;as_vis=1">Particle Swarm Optimization</a>.</p>
<p>A really good tutorial on the basics of PSO: <a title="PSO Tutorial" href="http://www.swarmintelligence.org/tutorials.php">PSO Tutorial</a>.</p>
<p>Maybe you want to see PSO in action: <a title="Source Code Library: Particle Swarm Optimisation (PSO)" href="http://www.adaptivebox.net/CILib/code/psocodes_link.html">Source Code Library: Particle Swarm Optimisation (PSO)</a>.</p>
<p>Wikipedia&#8217;s take on PSO: <a title="Particle swarm optimization" href="http://en.wikipedia.org/wiki/Particle_swarm_optimization">Particle swarm optimization</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://rayli.net/blog/2011/04/swarm-particle-swarm-part-1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Binary serialization in C#</title>
		<link>http://rayli.net/blog/2011/03/binary-serialization-in-c-sharp/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=binary-serialization-in-c-sharp</link>
		<comments>http://rayli.net/blog/2011/03/binary-serialization-in-c-sharp/#comments</comments>
		<pubDate>Sun, 06 Mar 2011 02:20:22 +0000</pubDate>
		<dc:creator>Raymond Li</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[C#]]></category>

		<guid isPermaLink="false">http://rayli.net/blog/?p=748</guid>
		<description><![CDATA[Serializing an object into a binary file is an easy and fast way to persist your objects. If binary serialization is used to cache objects normally read from an XML file, a database or some other file format, you&#8217;ll get even more benefits. After incorporating binary serialization into a C# application that loaded data from [...]]]></description>
			<content:encoded><![CDATA[<p>Serializing an object into a binary file is an easy and fast way to persist your objects. If binary serialization is used to cache objects normally read from an XML file, a database or some other file format, you&#8217;ll get even more benefits.</p>
<p><span id="more-748"></span></p>
<p>After incorporating binary serialization into a C# application that loaded data from an Excel spreadsheet, I was able to get a 33% decrease in execution time by caching the generated object into a binary file. It&#8217;s a quick-and-dirty way to get a speed increase especially when you&#8217;re loading a lot of external data that changes, but doesn&#8217;t change frequently.</p>
<p>The first step for serializing a class into a binary file is to mark the class as <em>Serializable</em>.</p>
<pre class="brush: csharp; title: ; notranslate">
[Serializable]
public class YourClass
{
	// your class definition.
}
</pre>
<p>Now that your class is ready to be serialized, you can use <em>ObjectSerializer</em>. The <em>ObjectSerializer </em>class below allows anyone to serialize an object into a binary file. Serializing or de-serializing a class marked with the <em>[Serializable]</em> attribute takes no more than 3 lines of C# code.</p>
<pre class="brush: csharp; title: ; notranslate">
public class ObjectSerializer&lt;T&gt;
{
	protected IFormatter iformatter;

	public ObjectSerializer()
	{
		this.iformatter = new BinaryFormatter();
	}

	public T GetSerializedObject(string filename)
	{
		if (File.Exists(filename))
		{
			Stream inStream = new FileStream(
				filename,
				FileMode.Open,
				FileAccess.Read,
				FileShare.Read);
			T obj = (T)this.iformatter.Deserialize(inStream);
			inStream.Close();
			return obj;
		}
		return default(T);
	}

	public void SaveSerializedObject(T obj, string filename)
	{
		Stream outStream = new FileStream(
			filename,
			FileMode.Create,
			FileAccess.Write,
			FileShare.None);
		this.iformatter.Serialize(outStream, obj);
		outStream.Close();
	}
}
</pre>
<p>To serialize an object using <em>ObjectSerializer</em>, first instantiate the <em>ObjectSerializer </em>class. Then use the <em>SaveSerialziedObject()</em> method to serialize the object.</p>
<pre class="brush: csharp; title: ; notranslate">
YourClass yourObject = new YourClass();
ObjectSerializer&lt;YourClass&gt; objSerializer =
	new ObjectSerializer&lt;YourClass&gt;();

// serializes yourClass to SomeFilename.bin.
objSerializer.SaveSerializedObject(yourObject, &quot;SomeFilename.bin&quot;);
</pre>
<p>To deserialize the binary file generated from the previous operation, instantiate the <em>ObjectSerializer </em>class. Then use the <em>GetSerializedObject()</em> method to retrieve the original object.</p>
<pre class="brush: csharp; title: ; notranslate">
ObjectSerializer&lt;YourClass&gt; objSerializer =
	new ObjectSerializer&lt;YourClass&gt;();

// deserializes yourClass from SomeFilename.bin.
YourClass yourObjectFromFile =
	objSerializer.GetSerializedObject(&quot;SomeFilename.bin&quot;);
</pre>
<p>And there you have it&#8230; quick-and-dirty binary serialization in C#!</p>
]]></content:encoded>
			<wfw:commentRss>http://rayli.net/blog/2011/03/binary-serialization-in-c-sharp/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to convert Fahrenheit to Celsius?</title>
		<link>http://rayli.net/blog/2011/02/how-to-convert-fahrenheit-to-celsius/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=how-to-convert-fahrenheit-to-celsius</link>
		<comments>http://rayli.net/blog/2011/02/how-to-convert-fahrenheit-to-celsius/#comments</comments>
		<pubDate>Tue, 01 Feb 2011 23:28:08 +0000</pubDate>
		<dc:creator>Raymond Li</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://rayli.net/blog/?p=727</guid>
		<description><![CDATA[Converting Fahrenheit to Celsius doesn&#8217;t require a calculator. Here are some easy-to-remember temperatures if you&#8217;re accustomed to Fahrenheit temperatures&#8230; 10F ≈ -10C 32F = 0C (melting point of water) 40F ≈ 4C 70F ≈ 20C 100F ≈ 40C Converting Fahrenheit to Celsius Take your Fahrenheit temperature, and subtract 32 from it. Let&#8217;s say the temperature is 50F. Our result [...]]]></description>
			<content:encoded><![CDATA[<p>Converting Fahrenheit to Celsius doesn&#8217;t require a calculator. Here are some easy-to-remember temperatures if you&#8217;re accustomed to Fahrenheit temperatures&#8230;</p>
<div><span id="more-727"></span></div>
<p id="_mcePaste">
<ul>
<li>10F ≈ -10C</li>
<li>32F = 0C (melting point of water)</li>
<li>40F ≈ 4C</li>
<li>70F ≈ 20C</li>
<li>100F ≈ 40C</li>
</ul>
<p><strong>Converting Fahrenheit to Celsius</strong></p>
<ol>
<li>Take your Fahrenheit temperature, and subtract 32 from it. Let&#8217;s say the temperature is 50F. Our result is then 50 &#8211; 32 = 18.</li>
<li>Multiply the result by 5. In our example, we do the multiplication and get 18 x 5 = 90.</li>
<li>Divide the result by 9 to get our final Celsius result, 90 ÷ 9 = 10C.</li>
</ol>
<p><strong>Fahrenheit to Celsius formula</strong>: (F-32) x 5 ÷ 9 = C</p>
<p><strong>Convert Celsius to Fahrenheit</strong></p>
<ol>
<li>Take your Celsius temperature, and multiply by 9. Let&#8217;s say the temperature is 25C. Our result is then 25 x 9 = 225.</li>
<li>Divide the result by 5. In our example, we do the division and get 225 ÷ 5 = 45.</li>
<li>Add 32 to the result to get our final Fahrenheit result, 45 + 32 = 77.</li>
</ol>
<p><strong>Celsius to Fahrenheit formula: </strong>C x 9 ÷ 5 + 32 = F</p>
<p><strong>Why is -40F = -40C?</strong></p>
<p>Oddly enough, -40F is not colder than -40C. Yes, they are both really cold, but they are also exactly the same temperature. Let&#8217;s use the formulas from above and try it out.</p>
<p>Convert -40F to Celsius</p>
<ol>
<li>(F-32) x 5 ÷ 9</li>
<li>(-40-32) x 5 ÷ 9</li>
<li>-72 x 5 ÷ 9 = -40</li>
</ol>
<p>Convert -40C to Fahrenheit</p>
<ol>
<li>(C x 9 ÷ 5) + 32</li>
<li>(-40 x 9 ÷ 5) + 32</li>
<li>-72 + 32 = -40</li>
</ol>
<p>Exactly the same!</p>
]]></content:encoded>
			<wfw:commentRss>http://rayli.net/blog/2011/02/how-to-convert-fahrenheit-to-celsius/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

