Wednesday, July 27, 2011

find command batch processing

Find some folders (say all .svn folders) and remove them all, in one command:
find -iwholename './*.svn' -exec rm -Rf '{}' \;

Sunday, July 24, 2011

程序员技术练级攻略

程序员技术练级攻略
Joel Spolsky's blog
Joel Spolsky: Advice for Computer Science College Students

The Interconnected World of Tech Companies

Very interesting. See how new companies emerge as the result of being established by employees from earlier companies: The Interconnected World of Tech Companies.

Friday, July 8, 2011

iPhone/iPad/android touch event

I have been looking for ways of detecting touch screen events on iPhone comparable to mouse events on a regular computer. I found this today and think it's wonderful. My game now can interact with user on iPhone.

On iPhone/iPad/android, can use the follow replacements for mouse events:
mousedown -> touchstart
mousemove -> touchmove
mouseup -> touchend

In mouse/touch events, obtain page location by:
me.vSelectCanvas.addEventListener('mousedown', function(e) {
if (e.which == 3) { return; } // do nothing for right mouse button.
var mouse_x = e.pageX - this.offsetLeft,
mouse_y = e.pageY - this.offsetTop;
// ...
}, false);

me.vSelectCanvas.addEventListener('touchstart', function(e) {
if (e.touches.length == 1) {
var mouse_x = e.touches[0].pageX - this.offsetLeft,
mouse_y = e.touches[0].pageY - this.offsetTop;
// ...
}
}, false);

To detect browser agent type (regular browser or smart phone) and reset window size:
  var D=navigator.userAgent.toLowerCase();
var x=(D.indexOf("android")!=-1)||(D.indexOf("iphone")!=-1)||(D.indexOf("ipad")!=-1);
var d=x?window.innerWidth:900;
var B=x?window.innerHeight:550;
(See code here)

And here's information on How to get iPad/iPhone screen dimensions in javascript.

Tuesday, July 5, 2011

IT new trend

Seems it includes social/mobile/cloud computing, and mining on large data.

Quora - a question-answer addition/search web site (About).
浅析Quora的技术架构
Quora使用到的技术
What's interesting to me is long polling (comet) - a server push technology.

今年科技公司IPO表现点评.
Interesting ones to me include LinkedIn, Zillow, Zygna (简介), Facebook.

如何科学的建立自己的个人网站

The Myth of Architecture Corruption

Baidu Web App Contest

Saturday, July 2, 2011

Call a C program from php and read output

Use shell_exec() command:

$output = shell_exec('/path/to/your/program'); // $output contains whatever program prints.

This is great. It makes possible writing C code for computation intensive part and pass result back to php.

Blog Archive

Followers