<?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>Shang Liang &#187; Tips</title>
	<atom:link href="http://shang-liang.com/blog/category/tips/feed/" rel="self" type="application/rss+xml" />
	<link>http://shang-liang.com/blog</link>
	<description>Life in a Flash</description>
	<lastBuildDate>Fri, 03 Sep 2010 05:32:45 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Syntax highlighting for Sass in Dreamweaver</title>
		<link>http://shang-liang.com/blog/syntax-highlighting-for-sass-in-dreamweaver/</link>
		<comments>http://shang-liang.com/blog/syntax-highlighting-for-sass-in-dreamweaver/#comments</comments>
		<pubDate>Fri, 03 Sep 2010 05:32:45 +0000</pubDate>
		<dc:creator>5566</dc:creator>
				<category><![CDATA[Tips]]></category>
		<category><![CDATA[Tools]]></category>

		<guid isPermaLink="false">http://shang-liang.com/blog/?p=260</guid>
		<description><![CDATA[I&#8217;ve just started using Sass to code CSS. I really like it because it has greatly boosted my ego as a programmer, &#8220;I can put programming logic inside my CSS!&#8221; And of course, it makes it much easier to manage a complicated CSS. However, I can&#8217;t edit scss files with Dreamweaver and I miss seeing [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve just started using Sass to code CSS. I really like it because it has greatly boosted my ego as a programmer, &#8220;I can put programming logic inside my CSS!&#8221; And of course, it makes it much easier to manage a complicated CSS. However, I can&#8217;t edit scss files with Dreamweaver and I miss seeing the colorful syntax. After searching for a while, I found the solution.</p>
<p><a href="http://www.visual28.com/articles/less-scss-syntax-highlighting-in-dreamweaver">less-scss-syntax-highlighting-in-dreamweaver</a></p>
<p>It&#8217;s quite easy. All you need to do is to find this file <em>Dreamweaver CS?/Configuration/DocumentTypes/MMDocumentTypes.xml </em>and<em> </em>change this line <strong>macfileextension=&#8221;css&#8221;</strong> to this <strong>macfileextension=&#8221;css,scss&#8221;</strong>.</p>
]]></content:encoded>
			<wfw:commentRss>http://shang-liang.com/blog/syntax-highlighting-for-sass-in-dreamweaver/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>away3d clipping problem</title>
		<link>http://shang-liang.com/blog/away3d-clipping-problem/</link>
		<comments>http://shang-liang.com/blog/away3d-clipping-problem/#comments</comments>
		<pubDate>Fri, 03 Sep 2010 05:15:47 +0000</pubDate>
		<dc:creator>5566</dc:creator>
				<category><![CDATA[Tips]]></category>

		<guid isPermaLink="false">http://shang-liang.com/blog/?p=247</guid>
		<description><![CDATA[I spent hours trying to solve this problem. If you need to load an swf which runs away3d inside it, the loaded swf may get cropped off on the right and bottom sides. Don&#8217;t try to set the clipping attributes of the View3D instance. I&#8217;ve tried all sorts of clippings but had no luck. The [...]]]></description>
			<content:encoded><![CDATA[<p>I spent hours trying to solve this problem. If you need to load an swf which runs away3d inside it, the loaded swf may get cropped off on the right and bottom sides. Don&#8217;t try to set the clipping attributes of the View3D instance. I&#8217;ve tried all sorts of clippings but had no luck. The problem lies with the swf&#8217;s document dimension. Once that&#8217;s set correctly, the cropping problem will be fixed.</p>
]]></content:encoded>
			<wfw:commentRss>http://shang-liang.com/blog/away3d-clipping-problem/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Apply both inner glow and outer glow on a MovieClip</title>
		<link>http://shang-liang.com/blog/apply-both-inner-glow-and-outer-glow-on-a-movieclip/</link>
		<comments>http://shang-liang.com/blog/apply-both-inner-glow-and-outer-glow-on-a-movieclip/#comments</comments>
		<pubDate>Thu, 08 Jul 2010 16:05:09 +0000</pubDate>
		<dc:creator>5566</dc:creator>
				<category><![CDATA[Tips]]></category>

		<guid isPermaLink="false">http://shang-liang.com/blog/?p=212</guid>
		<description><![CDATA[To have 2 glows, you need to apply the inner glow first then the outer glow. If not, the inner glow will not be activated. It&#8217;s true for both timeline based filters and scripted filters.]]></description>
			<content:encoded><![CDATA[<p>To have 2 glows, you need to apply the inner glow first then the outer glow. If not, the inner glow will not be activated. It&#8217;s true for both timeline based filters and scripted filters.</p>
]]></content:encoded>
			<wfw:commentRss>http://shang-liang.com/blog/apply-both-inner-glow-and-outer-glow-on-a-movieclip/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How to force server to run php5</title>
		<link>http://shang-liang.com/blog/how-to-force-server-to-run-php5/</link>
		<comments>http://shang-liang.com/blog/how-to-force-server-to-run-php5/#comments</comments>
		<pubDate>Thu, 03 Dec 2009 04:10:04 +0000</pubDate>
		<dc:creator>5566</dc:creator>
				<category><![CDATA[Tips]]></category>

		<guid isPermaLink="false">http://shang-liang.com/blog/?p=204</guid>
		<description><![CDATA[From: tech-bits.com &#8220;Some hosting providers are still using php 4 as their default for scripts, but offer php5 as well.  To force your scripts to all use php5, you can try adding this to a .htaccess file on your site: AddType x-mapp-php5 .php AddHandler x-mapp-php5 .php &#8220;]]></description>
			<content:encoded><![CDATA[<p>From: <a href="http://www.tech-bits.com/index.php/CategoryID/1/EntryId/130/entry">tech-bits.com</a></p>
<p>&#8220;Some hosting providers are still using php 4 as their default for scripts, but offer php5 as well.  To force your scripts to all use php5, you can try adding this to a <span style="font-weight: bold;">.htaccess</span> file on your site:</p>
<pre>AddType x-mapp-php5 .php
AddHandler x-mapp-php5 .php</pre>
<p>&#8220;</p>
]]></content:encoded>
			<wfw:commentRss>http://shang-liang.com/blog/how-to-force-server-to-run-php5/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Getting Playstation Eye to work with openframeworks</title>
		<link>http://shang-liang.com/blog/getting-playstation-eye-to-work-with-openframeworks/</link>
		<comments>http://shang-liang.com/blog/getting-playstation-eye-to-work-with-openframeworks/#comments</comments>
		<pubDate>Wed, 11 Nov 2009 03:49:22 +0000</pubDate>
		<dc:creator>5566</dc:creator>
				<category><![CDATA[Experimental]]></category>
		<category><![CDATA[Tips]]></category>

		<guid isPermaLink="false">http://shang-liang.com/blog/?p=194</guid>
		<description><![CDATA[I&#8217;ve never seen such clear webcams before! The PS3 Eye is truly amazing! By default, PS3 Eye is not supported by Windows or Mac OSX. Luckily there are drivers ready for you to grab. For PC, use this driver. For Mac OSX, use this driver. To get PS3 Eye working for openframeworks in windows, you [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve never seen such clear webcams before! The PS3 Eye is truly amazing!</p>
<p>By default, PS3 Eye is not supported by Windows or Mac OSX. Luckily there are drivers ready for you to grab. For PC, <a title="ps3 playstation eye windows driver" href="http://alexpopovich.wordpress.com/2008/10/02/sony-ps3eye-camera-directshow-capture-source-filter/" target="_blank">use this driver</a>. For Mac OSX, <a title="PS3 playstation mac driver maccam" href="http://webcam-osx.sourceforge.net/" target="_blank">use this driver</a>.</p>
<p>To get PS3 Eye working for openframeworks in windows, you need to edit one line in file &#8220;ofVideoGrabber&#8221;. The solution is found in <a title="fix openframeworks to work with ps3 eye" href="http://www.openframeworks.cc/forum/viewtopic.php?f=8&amp;t=1182" target="_blank">this thread</a>, changing<br/><br/>
<pre>bool bOk = VI.setupDevice(device, width, height);</pre>
<p><br/><br/>into<br/><br/>
<pre>bool bOk = VI.setupDevice(device, width, height, VI_COMPOSITE);</pre>
<p><br/><br/>Remember to clean the project first and compile it to reflect the changes.</p>
<p>For Mac OSX, all you need to do is to copy &#8220;maccam.component&#8221; into &#8220;Library\QuickTime\&#8221;, no changes on the source code needed.</p>
<p>Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://shang-liang.com/blog/getting-playstation-eye-to-work-with-openframeworks/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Sharing some good PHP stuff: Simple HTML DOM Parser</title>
		<link>http://shang-liang.com/blog/sharing-some-good-php-stuff-simple-html-dom/</link>
		<comments>http://shang-liang.com/blog/sharing-some-good-php-stuff-simple-html-dom/#comments</comments>
		<pubDate>Sun, 04 Oct 2009 10:46:47 +0000</pubDate>
		<dc:creator>5566</dc:creator>
				<category><![CDATA[Tips]]></category>
		<category><![CDATA[Tools]]></category>

		<guid isPermaLink="false">http://shang-liang.com/blog/?p=173</guid>
		<description><![CDATA[Most of my Flash projects use XML as &#8220;database&#8221; and PHP is my preferred server script.  I found Simple_HTML_DOM Parser quite a good tool for reading and writing XML files. The default DOM in PHP is quite hard to use. The syntax for creating nodes in PHP is very tiring. Besides that, the biggest headache is [...]]]></description>
			<content:encoded><![CDATA[<p>Most of my Flash projects use XML as &#8220;database&#8221; and PHP is my preferred server script.  I found <a href="http://simplehtmldom.sourceforge.net/">Simple_HTML_DOM</a> Parser quite a good tool for reading and writing XML files. The default DOM in PHP is quite hard to use. The syntax for creating nodes in PHP is very tiring. Besides that, the biggest headache is that the scripts written for PHP 4 are not compatible with PHP 5.</p>
<p>Simple HTML DOM Parser is designed for reading and editing HTML but it works fine with XML files, since XML files are more tidy than HTML. Reading and traversing the XML is easy, just use the find function.</p>
<pre>$xml = file_get_html('http://www.google.com/');
foreach($xml-&gt;find('img') as $element)
       echo $element;</pre>
<p>Writing a new node is not difficult either.</p>
<pre>$node = <strong>str_get_html</strong>(<span class="var">'&lt;sample_node&gt;Hello World&lt;/sample&gt;'</span>);</pre>
]]></content:encoded>
			<wfw:commentRss>http://shang-liang.com/blog/sharing-some-good-php-stuff-simple-html-dom/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Update: Configure FlashDevelop Code Autocompletion For AIR API</title>
		<link>http://shang-liang.com/blog/update-configure-flashdevelop-code-autocompletion-for-air-api/</link>
		<comments>http://shang-liang.com/blog/update-configure-flashdevelop-code-autocompletion-for-air-api/#comments</comments>
		<pubDate>Mon, 07 Sep 2009 03:33:25 +0000</pubDate>
		<dc:creator>5566</dc:creator>
				<category><![CDATA[Tips]]></category>
		<category><![CDATA[Tools]]></category>

		<guid isPermaLink="false">http://shang-liang.com/blog/?p=166</guid>
		<description><![CDATA[Previously in Flash CS3, the trick of getting autocompletion in FlashDevelop is not working any more in Flash CS4, ast least not in my case. After testing a while I finally got it working again by setting the swc path of the project. Choose &#8220;Project&#62;&#62;Properties&#8230;&#62;&#62;Compiler Options&#62;&#62;SWC Include Libraries&#8221; and add the path of AIR swc [...]]]></description>
			<content:encoded><![CDATA[<p>Previously in Flash CS3, <a href="http://shang-liang.com/blog/configure-flashdevelop-code-autocomplition-for-air-api/" target="_blank">the trick of getting autocompletion in FlashDevelop</a> is not working any more in Flash CS4, ast least not in my case. After testing a while I finally got it working again by setting the swc path of the project.</p>
<p>Choose &#8220;Project&gt;&gt;Properties&#8230;&gt;&gt;Compiler Options&gt;&gt;SWC Include Libraries&#8221; and add the path of AIR swc to it. Most likely it would be something like this: &#8220;C:\Program Files\Adobe\Adobe Flash CS4\AIK1.5\frameworks\libs\air\airglobal.swc&#8221;</p>
<p>Cheers!</p>
]]></content:encoded>
			<wfw:commentRss>http://shang-liang.com/blog/update-configure-flashdevelop-code-autocompletion-for-air-api/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Algorithm for adding leading zeros</title>
		<link>http://shang-liang.com/blog/algorithm-for-adding-leading-zeros/</link>
		<comments>http://shang-liang.com/blog/algorithm-for-adding-leading-zeros/#comments</comments>
		<pubDate>Thu, 02 Jul 2009 06:42:10 +0000</pubDate>
		<dc:creator>5566</dc:creator>
				<category><![CDATA[Tips]]></category>

		<guid isPermaLink="false">http://shang-liang.com/blog/?p=143</guid>
		<description><![CDATA[I&#8217;ve always been writing this. function addZero(n:int):String { if (n < 10) { return "0" + n; }else { return "" + n; } } The function adds one leading 0 quite well but if two 0 is needed, it's quite bad to write all the conditions to check whether it's less than 100 or [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve always been writing this.</p>
<pre>
		function addZero(n:int):String {
			if (n < 10) {
				return "0" + n;
			}else {
				return "" + n;
			}
		}
</pre>
<p>The function adds one leading 0 quite well but if two 0 is needed, it's quite bad to write all the conditions to check whether it's less than 100 or 10. I think the following code is more efficient. </p>
<pre>

		function addZero(n:int, numZeros:int = 1):String {
			var str:String = n + "";
			while (str.length&lt;numZeros+1)
			{
				str = "0" + str;
			}
			return str;
		}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://shang-liang.com/blog/algorithm-for-adding-leading-zeros/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>A new trick to make pixel fonts clear in Flash</title>
		<link>http://shang-liang.com/blog/a-new-trick-to-make-pixel-fonts-clear-in-flash/</link>
		<comments>http://shang-liang.com/blog/a-new-trick-to-make-pixel-fonts-clear-in-flash/#comments</comments>
		<pubDate>Wed, 01 Jul 2009 05:14:20 +0000</pubDate>
		<dc:creator>5566</dc:creator>
				<category><![CDATA[Tips]]></category>

		<guid isPermaLink="false">http://shang-liang.com/blog/a-new-trick-to-make-pixel-fonts-clear-in-flash/</guid>
		<description><![CDATA[Pixel fonts tend to get blur in Flash. Most of the time the problem can be solved by setting the textfield&#8217;s coordinates (x,y) into integers but sometimes it fails to work. I&#8217;ve found a new trick to solve this problem. If you check the option of the textfield to be selectable, the texts appear clear [...]]]></description>
			<content:encoded><![CDATA[<p>Pixel fonts tend to get blur in Flash. Most of the time the problem can be solved by setting the textfield&#8217;s coordinates (x,y) into integers but sometimes it fails to work. I&#8217;ve found a new trick to solve this problem. If you check the option of the textfield to be selectable, the texts appear clear no matter what their x and y are.</p>
]]></content:encoded>
			<wfw:commentRss>http://shang-liang.com/blog/a-new-trick-to-make-pixel-fonts-clear-in-flash/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Not enough disk space to install flash player 10 problem</title>
		<link>http://shang-liang.com/blog/not-enough-disk-space-to-install-flash-player-10-problem/</link>
		<comments>http://shang-liang.com/blog/not-enough-disk-space-to-install-flash-player-10-problem/#comments</comments>
		<pubDate>Tue, 09 Dec 2008 16:58:41 +0000</pubDate>
		<dc:creator>5566</dc:creator>
				<category><![CDATA[Tips]]></category>

		<guid isPermaLink="false">http://shang-liang.com/blog/?p=87</guid>
		<description><![CDATA[If your computer doesn&#8217;t have a C: drive, flash player 10 installer for firefox won&#8217;t be able to run properly. It keeps giving not enough disk space error. After Googling for a while, I found the solution in Yahoo answers. If you don&#8217;t have a C-drive, then you can also share a folder or your [...]]]></description>
			<content:encoded><![CDATA[<p>If your computer doesn&#8217;t have a C: drive, flash player 10 installer for firefox won&#8217;t be able to run properly. It keeps giving not enough disk space error. After Googling for a while, I found the solution in Yahoo answers.</p>
<blockquote><p>If you don&#8217;t have a C-drive, then you can also share a folder or your root drive and then add this folder as a network drive and assign the letter C to it. after the installation you can disconnect the share again and disable sharing. Worked for me. -<a title="Not enough disk space to install flash player 10 problem yahoo answers" href="http://answers.yahoo.com/question/index?qid=20081016061537AA5JSgJ" target="_blank">Yahoo! Answers</a></p></blockquote>
<p>* The method that uses a USB drive didn&#8217;t work for me. My system drive is named as &#8220;W&#8221;, stands for Windows. I&#8217;m weird, I know.</p>
<p>It&#8217;s such a low level bug and it&#8217;s really unaccetable. I&#8217;ve installed tons of stuff in my computer and had never encounter this kind of problem before.</p>
]]></content:encoded>
			<wfw:commentRss>http://shang-liang.com/blog/not-enough-disk-space-to-install-flash-player-10-problem/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
	</channel>
</rss>
