We have to set up and internal server that does not have access to internet.
However, we have make to accessible at home.

Now we have the new internal server A and an external server B, which has internet access.
This is how we did to make B as the bridge, so that we can ssh to A, and transfer files to A, and make A connect to internet.

A < ---> B < ---> Internet

Read the rest of this entry

For c++, we know that new and delete appear in pair, but is it necessary to set a pointer to NULL after delete it?

Say we have:

class A {};
A *a = new A;
// do something with a
delete a;
a = NULL;  // Do we need to do this?

Read the rest of this entry


Cytoscapeweb makes a nice presentation of the world, which could be shown in it nodes, edges and shapes.

Moreover, events could also be bound to the elements using javascript.

However, there seems no API for developers to trigger an event using javascript instead of by user clicking mouse or tap a key.

We can bind an event to an element in cytoscapeweb by :

vis.addListener(evt, [gr], fn) 

and accordingly, I suppose there should be a trigger API to fire the event, but there isn’t.

Alternative way to simulate an event, which I mean somehow like to move the cursor and click, is not possible.

Read the rest of this entry


 jQuery brings us a new javascript style, including selector, chain operation and so on.

However, the most meaningful one, which gets more and more people involved, is its plugin mechanism. 

Present there are hundreds of millions of plugins online, which have really reduce the complexity of writing javascript.

Well, most of the time, the plugins work fine; but for some times, they refuse to work on the future or live elements, which are added or modified by javascript later.

like, you have a plugin:


 * the original plugin, to add s and t to the element text.
 * you can call $("p").pg(1, 2) for existing elements,
 * however it doesn't work for futher/live elements,
 * such like <p>33333</p> in this example, which is added later dynamically.
$.fn.pg = function(s, t) {
    return this.each(function() {
        $(this).mouseenter(function() {
            $(this).text(parseInt($(this).text()) + s + t);
        // how many times I have been bound to the element.
        parseInt($(this).next().text()) + $(this).data('liveplugin.pg'));


, which takes no effects on further added "p" elements.

Read the rest of this entry


 Following code has been tested with jQuery 1.3.2 version .

All the JavaScript code mentioned in this blog should be tried on firebug.

The super popular live method was added to jQuery 1.3 . It works just great. Except when it does not work. As per the documentation this method does not work in following cases: blur, focus, mouseenter, mouseleave, change, submit .

How binding events work in jQuery

$('a').click(function(){   console.log('clicked'); }); 

Read the rest of this entry




为什么要写这篇文章? 因为我对于度娘和谷爹里搜索到关于这个问题的文章耿耿于怀, 忿忿不已. 这些文章都只说了个所以, 却没说然.

在这篇文章里, 我将详细地说一下Incomplete Object的成因, 以及这其中session, serialize及unserialize引起的问题和所起的作用

Read the rest of this entry





Read the rest of this entry






1. 每次打开第一页时,显示的记录不同。

2. 但是从第一页后的其他页面(第二页,第三页,。。。)返回第一页时,还是那个第一次打开第一页的那些记录

3. 每页记录不能重复



如果是随机从数据库取一条记录,最直接的方式,就是order by rand() limit 1:

Read the rest of this entry