Friday, April 27, 2012

HTML5 new features

用HTML5实现人脸识别 (Translated from: Face detection with getUserMedia)
用HTML5实现手机摇一摇的功能

Friday, April 20, 2012

ACM classic - Reflections on Trusting Trust

Reflections on Trusting Trust, by Ken Thompson.

See how Ken Thompson implanted a back door into unix by hacking the compiler.

DjVu to PDF converter

DjVu to PDF converter
Free & Online. BETA version. Searchable PDFs!

http://www.djvu-pdf.com/

Wednesday, April 18, 2012

Debugging experience

Debugging is a hard thing. Here records some of my experiences.

- A same program instance is running on many machines for years without problem. But today one single machine reports an error. A stored procedure that takes multiple parameters, is now getting those parameters in reverse order.
Reason: A query that returns the list of parameters is now returning the entries in reverse. MSSQL returns data set in undeterministic order if "order by" is not used. It has worked consistently for years on all the machines, now for unknown reason is functioning differently on one single machine.
Solution: Add "order by" clause to the query.

- The Database server in production was accidentally uninstalled ... This happened because the admin logged into the wrong server. As the solution, the desktop background is changed to reflect the server name.

"Same Domain Policy" limitation of jQuery

The same domain policy prevents javascripts hosted on one domain from accessing data from a remote domain. This is for security purpose. So when use jQuery, you can not directly access a web service from a remote server.

The solution is to create a serverside script (for example, in php, as shown below) on your domain, which will serve as a proxy, get the data from the remote domain, and then output it. For example:

<?php
readfile('http://remote_server.com/service?param=' . urlencode($_GET['param']);
?>

[1] Getting data from remote URL using jquery
[2] Cross-domain requests with jQuery

Blog Archive

Followers