星期二, 七月 28, 2009

something about xulrunner and xpcom


-----------
 addProgressListener( listener, notifyMask )
    Return type: no return value
    Add a progress listener to the browser which will monitor loaded documents. The progress listener should implement the nsIWebProgressListener interface.

----------------
loadURI( uri, referrer, charset )
    Return type: no return value
    Load a URL into the document, with the given referrer and character set.

If you use an nsIURI argument for the first, uri, argument, the call will fail. If you use a string URL it will work.
---------------
 stop()
    Return type: no return value
    Equivalent to pressing the Stop button, this method stops the currently loading document.

---------------
interface nsIServerSocketListener : nsISupports
Methods

 nsIServerSocketListener

 This interface is notified whenever a server socket accepts a new connection.
 The transport is in the connected state, and read/write streams can be opened
 using the normal nsITransport API.  The address of the client can be found by
 calling the nsISocketTransport::GetAddress method or by inspecting
 nsISocketTransport::GetHost, which returns a string representation of the
 client's IP address (NOTE: this may be an IPv4 or IPv6 string literal).


 onSocketAccepted

 This method is called when a client connection is accepted.

 @param aServ
        The server socket.
 @param aTransport
        The connected socket transport.

void onSocketAccepted(in nsIServerSocket aServ, in nsISocketTransport aTransport)

 onStopListening

 This method is called when the listening socket stops for some reason.
 The server socket is effectively dead after this notification.

 @param aServ
        The server socket.
 @param aStatus
        The reason why the server socket stopped listening.  If the
        server socket was manually closed, then this value will be
        NS_BINDING_ABORTED.

void onStopListening(in nsIServerSocket aServ, in nsresult aStatus)

https://developer.mozilla.org/en/XUL/browser
http://www.oxymoronical.com/experiments/apidocs/
--
Liu Lantao
College of Information Science and Technology, Beijing Normal University
EMAIL: liulantao ( at ) gmail ( dot ) com ;
WEBSITE: http://www.liulantao.com/ .
------

星期一, 七月 27, 2009

.htaccess

.htaccess

<Limit GET>
Order Deny,Allow
Deny from all
Allow from 10.0.0.0/8
</Limit>


--
Liu Lantao
College of Information Science and Technology, Beijing Normal University
EMAIL: liulantao ( at ) gmail ( dot ) com ;
WEBSITE: http://www.liulantao.com/ .
------

星期三, 七月 22, 2009

nagios中主机依赖与服务依赖

主机依赖:A主机依赖于B主机

服务依赖:A服务依赖于B服务

服务依赖有几种情况:

A主机上的X服务依赖于A主机上的Y服务

A主机上的X服务依赖于B主机上的X服务

A主机上的X服务依赖于B主机上的Y服务

 

依赖关系在主机和服务之间有很重要的地位。比如服务依赖的情况,很多服务都依赖于主机的可连接性,网页的可访问依赖于web服务器的状态。一般情况下,如果主机已经死掉,它上面的其它服务的监测也会失败。如果主机上的服务由不同的管理员负责,通过nagios进行检测,只需通报主机已经down掉的消息给系统管理员即可,因为即使得到其它相关服务无法访问的消息,其它服务管理员无力处理这个问题。nagios默认能够支持刚才提到的依赖。主机依赖也有相似的状况,比如A主机通过B主机连接网络提供服务,如果监测到B主机停止的话,则不再对A主机进行监测。

 

主机依赖 通过hostdependency进行定义。

参数格式定义

define hostdependency{
  host_name              host_name
  hostgroup_name      hostgroup_name
  dependent_host_name            host_name
  dependent_hostgroup_name    hostgroup_name
  inherits_parent                  [0/1]
  execution_failure_criteria     [o,d,u,p,n]
  notification_failure_criteria   [o,d,u,p,n]
  dependency_period              timeperiod_name
  }

o: OK; d: DOWN; u: UP; p:PENDDING; n:NONE.

 

实例

define hostdependency{
  host_name        WWW1
  dependent_host_name       DBASE1
  notification_failure_criteria        d,u
  }

 

服务依赖 通过servicedependency进行定义。

参数格式定义:

define servicedependency{
  host_name                 host_name
  hostgroup_name         hostgroup_name
  service_description       service_description
  dependent_host_name              host_name
  dependent_hostgroup_name      hostgroup_name
  dependent_service_description   service_description
  inherits_parent                  [0/1]
  execution_failure_criteria     [o,w,u,c,p,n]
  notification_failure_criteria   [o,w,u,c,p,n]
  dependency_period            timeperiod_name
  }

o: OK; w: WARNING; u: UP; c: CRITICAL; p: PENDDING; n:NONE;

实例:

define servicedependency{
  host_name             WWW1
  service_description             Apache Web Server
  dependent_host_name       WWW1
  dependent_service_description      Main Web Site
  execution_failure_criteria               n
  notification_failure_criteria             w,u,c
  }

--
Liu Lantao
College of Information Science and Technology, Beijing Normal University
EMAIL: liulantao ( at ) gmail ( dot ) com ;
WEBSITE: http://www.liulantao.com/ .
------