星期一 十二月 01, 2008

   It is very common , even some experienced perl developers can not tell the difference between list and array in perl. But in fact they are very different: the list is DATA , while the array is VARIABLE. Every array holds a data of list, but one list might have nothing to do with an array.

   When I learned Perl, one thing confused me is " @l = qw/a b c/ " , at that time I thought it means "@l" is a variable , and operators like "pop" or "push" can accept variables too. That's totally wrong. "pop" or "push" does not accept any "scalar dereference".  They only accept data!

   The " @l = qw/a b c/ " means there is a list, which name is 'l' and it hosts elements 'a', 'b' and 'c' .  In Perl, the name 'l' is shared by list and array. So when we use @l , we are supposed to  use list, while use '$l', we want the variable which referrers to the list named 'l'!

星期五 十一月 28, 2008

RFC-1098: Want to know what is SNMP? use this doc 

RFC-1155: Basic ideal about how to manage IP network.

RFC-1156: This memo provides the initial version of the Management Information Base (MIB)

for use with network management protocols in TCP/IP-based internets in the short-term

RFC-1213: This doc defines the mib structure of route table.

 

 

星期一 五月 19, 2008

  2008-05-19 14:28 is exactly the one week after the earth quake in Sichuan province. China stopped at that time: people stopped in streets, at homes, or in offices. Cars stopped in roads with their horns, no moving, just horns. All of Chinese is mourning for the death in the quake.

  Sun employees in BJS07 stopped working and gathered at conference room. In the 3 miniutes, atmosphere was so sad in the room, I could not even breathe.

  Now the death toll is 34073 and it's still going on. Best wishes for all the people in Sichuan.

星期四 一月 17, 2008

    开发J2EE应用程序时, 如果希望在应用服务中进行用户安全认证而又避免编程,可以使用Sun glassfish中提供的realm. 本文以一个例子简要说明如何使用realm.

     在glassfish 预配置了三种realm: file, certificate, and admin-realm. 以file Realm为例.

     1. 建立"file" Realm 用户

       在Application Server Admin Console中打开Configuration->Security->Realms->file节点.

       点击"Manage Users" 按钮

       点击"New.." 添加一个新的用户, 填入用户ID 并设置密码,点击"Save" 按钮保存更改, 例如建立一个用户"testId", 他的用户组是"commonGroup"

 

     2. 在web.xml中建立设置安全约束
       打开web.xml文件, 以Netbeans 5.5 IDE 为例 (什么? 还没有Netbeans? 去这里http://www.netbeans.org/吧,免费的)

       扩展"登陆配置"选项, 选中"基本", 在"域名称"填入"file". 这个"file"就是在admin Console中看见的"file"按钮.

       扩展"安全角色"选项, 添加一个新的安全角色. 只是一个名称,随便起好了.比如"common-user-role"

       扩展"安全约束"选项, 点击"添加..."按钮, 起一个名字如"Basic Realm", 设置相应的URL模式(可以设置为"/*") 和HTTP方法.  选中"启用验证约束"选项, 点击"编辑" 按钮,选中想要添加的角色, 点击"添加>"按钮 添加这个角色.

      以上的设置完成之后, 在web.xml中,应该多出了如下代码, 包含了刚才所有设置:

          <security-constraint>
            <web-resource-collection>
               <web-resource-name>Basic Realm</web-resource-name>
               <url-pattern>/*</url-pattern>
             </web-resource-collection>
             <auth-constraint>
                <role-name>common-user-role</role-name>
             </auth-constraint>
         </security-constraint>
            <login-config>
              <auth-method>BASIC</auth-method>
              <realm-name>file</realm-name>
            </login-config>
       <security-role>
           <description>common user</description>
           <role-name>common-user-role</role-name>
       </security-role>

   3. 在sun-web.xml中建立映射关系

       打开sun-web.xml, 添加以下代码, 其中我们建立了"common-suer-role"(它是web.xml中定义的用户名称)和"commonGroup"(它是file Realm的用户组)的映射关系! 很晕吧?

         <security-role-mapping>
            <role-name>common-user-role</role-name>
            <group-name>commonGroup</group-name>
         </security-role-mapping>

   4. 重新生成和部署应用

      这是最后一步,就不罗嗦了. 祝好运!