— Shang Liang

Archive
Experimental

A gene is a long sequence of string with 4 letters, A, T, C and G. The “encryption” was figured out long time ago. Every 3 bases code for one amino acid. But, what if we look at genes from a computer graphic programmer’s point of view?

I wrote a program in Processing to “decrypt” genes in my way. I read 12 bases and convert it to a RGB color. The images are the result of such interpretation. It’s a E.Coli genome (a bacteria easily found from our backside). It’s very similar to a random noise image. However, what caught my eyes are the darker bands close to the bottom of the image. Does it mean anything?

Further study will be carried out. I’ll verify whether the dark bands correspond to any biological features. Are those areas more packed with coding genes or non-coding genes?

Another thing I would like to do is to write a program to search for a better “decryption” look up table, to see if that will yield better results. Interestingly, these kind of programming method is normally call “genetic algorithm”.

Image generated based on E.Coli Genome

Image generated with random noise

Read More

Try it Now!

[UPDATE] BIRME is an HTML5 App now and you can use it online. 

The story behind

As a web developer, I often need to resize images into a specific dimension to suit the website’s design. I used to resize images in Photoshop but I find it tedious to record actions again and again for different websites. Besides that, Photoshop is not cheap and not everyone has a (legal) copy. I tried some existing software but none of them satisfied me. Therefore, I decided to write one myself .

I’ve been searching and testing with many different platforms to develop it, C++, Java, Python and Perl. None of the above can achieve what I wanted, a single executable file without any extra libraries or dll files, no installation required. Finally I landed on PHP and I used bamcompile to generate an executable file. I still have troubles to get a Mac or Linux version of any PHP compiler to work. I may re-use my C++ code for Mac in the future and wrap it up as an .app.

Read More

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

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

Please be patient with my slow server. Thank you!

Read More

Just something really random and stupid, but I think it may be useful. Sometimes it’s too quiet and your ear has the “ying ying ying” sound. It’s quite annoying. This small file generates white noise.  Built in Processing and Minim library.

Download: PC & Mac

Read More

This is my entry for Code::XtremeApps::2008. It was a 24 hours coding competition. Sadly, my entry didn’t even get pass the preliminary round. As usual, I conclude the judges didn’t know what they were doing and they are not good enough to judge my idea.

Download Here!

Read More

In Papervision3D, all classes that extend DisplayObject3D inherit its lookAt function. But the problem is the result of A.lookAt(B) sometimes ends up as A back facing B. This problem is more obvious when you want to rotate a plane to face the camera. The plane becomes invisible because it’s back facing the camera. If you set the material to double-sided, the material is mirrored which is not acceptable in some cases.

To work around the problem without touching 3D rotations, you can create an empty object3D as C and place it along vector BA and call A.lookAt(C). Vector BA can be calculated as {A.x-B.x, A.y-B.y, A.z-B.z} and the position for C should be {BA.x*1.1+A.x, BA.y*1.1+A.y, BA.z*1.1+A.z}. The number 1.1 is just an arbitrary number. Any number greater than 1 will do the trick.

I’ve done this piece of ugly thing as a demonstration and the source is here.

Read More