— Shang Liang

I’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 need to edit one line in file “ofVideoGrabber”. The solution is found in this thread, changing

bool bOk = VI.setupDevice(device, width, height);



into

bool bOk = VI.setupDevice(device, width, height, VI_COMPOSITE);



Remember to clean the project first and compile it to reflect the changes.

For Mac OSX, all you need to do is to copy “maccam.component” into “Library\QuickTime\”, no changes on the source code needed.

Enjoy!

Read More

I gave a mini tutorial on Box2D during A-SFUG meeting. You can download it here. Have fun!

Read More

Data visualization for join the pact campaign. Click to view.

data_visualization_box2d

Read More

Messing around with Box2D. Quite fun.

box2d

Read More

Most of my Flash projects use XML as “database” 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 that the scripts written for PHP 4 are not compatible with PHP 5.

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.

$xml = file_get_html('http://www.google.com/');
foreach($xml->find('img') as $element)
       echo $element;

Writing a new node is not difficult either.

$node = str_get_html('<sample_node>Hello World</sample>');

Read More

http://www.shang-liang.com/musicplayer/

Please be patient with my slow server. Thank you!

Read More

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 “Project>>Properties…>>Compiler Options>>SWC Include Libraries” and add the path of AIR swc to it. Most likely it would be something like this: “C:\Program Files\Adobe\Adobe Flash CS4\AIK1.5\frameworks\libs\air\airglobal.swc”

Cheers!

Read More

The problem has been noted in SWFObject’s issue log. If you encounter any problem with flashvars not showing up in IE, downgrade SWFAdress to 2.2 will solve the problem. You can download other versions of SWFAdress from SourceForge.

Read More

Why “z” is not the shortcut key for zoom any more? There’s no “z” in “Bind Tool” but why it’s configured this way? I thought Adobe is trying to standardize all shortcut keys across all its software?

Why the help page is online? After I managed to set the help offline, I realized they took out Actionscript 2 references.

Fuck you whoever made these decisions!

Read More

I’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 10. I think the following code is more efficient.


		function addZero(n:int, numZeros:int = 1):String {
			var str:String = n + "";
			while (str.length<numZeros+1)
			{
				str = "0" + str;
			}
			return str;
		}

Read More