爱好VC++、 摄影;关注社会、文化。

发布新日志

  • 访教技学院何克抗教授

    2009-01-05 08:28:46

    松柏经年而愈加苍劲 大师暮年而壮心不已

    ———访教技学院何克抗教授

     


      曾经了解过“建构主义”,对何教授的微言大义很是佩服。对他老人家很是佩服。然而没想到这次采访,一波三折。之前便听说他很忙,没想到他对推广自己教育理念的事事必躬亲。古稀之年仍要颠簸于大江南北,甚至是世界各地。不巧几次预约,先生都出差在外。后来终于赶上何教授在学校。

      做准备时,看到有人在博客里写到,何教授不苟言笑。看了之后颇感不安。见到他本人以后才发现一切担心都是多余的,何教授是一位非常慈祥的老人。年过七十,却依然精神饱满,比想象中年轻。眉宇间散发着不俗的气质,言谈举止中流露出大家风范。谈到他的理论更是焕发出生机勃勃的风采,充满青春的活力。会心处眼睛还时不时地弯成两道新月。

      遥想1937年,那还是一个民不聊生的年代,何老先生出生在广东大浦县的一个国民党军官家庭。到如今已是70余年的风风雨雨,何老从那个年代一路走来,成就了今天的硕果累累,成就了今天的誉满天下,也历练成了一位宠辱不惊的侠之大者,这其中要经历多少不为人知的酸甜苦辣故事呢?那就请大家随我一起走进这位老教授的百味人生吧。 

      童年在艰苦中磨练

      在他年幼的时候他的父亲就抛弃了他的母亲,另娶妻子移居到了香港。因父亲条件较好,可以供他上学,童年的何克抗就投奔了父亲和继母,到香港念小学。继母对他十分苛刻,那段日子他的艰难可想而知。何教授却说,很感谢他的那位母亲,正是因为她的刁难,他才更加坚强,更加的上进。何克抗教授的自强不息的品格从那时就已见端倪。逆境对于弱者是灾难,而对于强者却是催使自己更强大的一种历练。

      后来因为种种原因他离开了父亲,回到生母的身边。民不聊生时代,一个女人独自带着一个孩子度日的艰难,我们不难想象。但是就在那种艰难的日子里,他母亲从来都没有叫过苦,一个人承担了一切,并且把一切经营的有条有理。何教授说,他的性格受母亲很大的影响,母亲与生俱来的乐观,使他有一种随遇而安的能力,无论何种境况他从来都没有放弃过希望。母亲识字不多,却深明大义,全力支持年少的何克抗读书。

      何老当年也受到许多亲友的资助,从那时起何克抗始终怀着一颗感恩的心,这颗感恩的心致使他日后不遗余力的回报社会。
      
      青春在知识中放光

      何教授自大学时代就与北师大有着不解之缘,1956年,何克抗被北京师范大学物理系录取,开始了他的大学生活。随后他又在北师大读无线电电子专业的研究生。那个年代极左的思潮正在社会上泛滥,修正主义很是严重。在那个时候,如果想好好学习还真不是一件容易的事情。一不小心,就会被人怀疑作想成名成家,搞个人主义,进而遭到批判。所以学习这样光明正大的事情反倒要偷偷去做。何克抗教授在学生时代就很勤奋,学习是他离不开的兴趣爱好。一有时间他就会躲开人群,偷偷地看书学习。每次都是战战兢兢,唯恐被人发现。

      何教授一直兴趣广泛,在大学时还发生过一个小插曲。青年时期的何克抗一度十分爱好文学,在文学方面也颇有天赋,在报刊上发表过很多文章,也获过不少的奖。所以何教授那个时候很想转到中文系。可是因为一些原因没有转成。如果转成功了,今天就少了教技专家何教授了,而多了一位文学泰斗。到底什么原因呢?原来那时文学青年写文章时不免会涉及政治,因而惨遭批斗,所以吓得何教授也不敢转了,只是一心搞物理科学的学习。
     
      下放劳动与在工厂工作时的何老

      1969年,何教授成为了第一批下放劳动的知识青年。在山西临汾的农村,何克抗没有像其他人那样抑郁不满,怨天尤人,而是随遇而安,他没有觉得自己的专业得不到发挥。何教授对贫下中农有着一种朴实的感情,服务贫下中农在他看来并不是空喊口号,他常常利用农闲时间帮老乡修无线收信机等一些当时仅有的电器。何教授很是有苦中作乐的精神,在农村还兴致勃勃地跟当地的中医学针灸呢。 

      在73-77年间何教授先后到过100多个工厂,虽然又苦又累,,但是何克抗教授当时特别爱动脑筋,又乐于助人,于是积累很多无线电技术方面的经验。
     
      真金终将发光

      由于何老在工厂的成绩十分突出,不久就重新回到了师大的校园,到物理系教书。78年,改革开放伊始,百废待兴,何教授出了自己的专著,总结无线电方面的经验,填补了当时的空白。成为了当时师大出专著为数不多的老师之一。后来,由于何教授的能力十分突出,便挑起物理系的大梁,成为物理系的系主任。79年联合国支援我国100万美金,支持中国发展教育技术,借着这股东风,我校成立了教育技术学院,也是全国最早成立的教技学院之一,何克抗教授便是先驱者之一。

      何教授说,他的一生如果有什么困难的话就是专业的跨越度很大。何教授由原本的无线电专业转入了计算机领域,再到后来的教育技术,再到现在主攻教育学理论的研究与实践,这其中的每一步,都有着不少的难度,何教授说,这都得益于他从年轻时开始就兴趣广泛,这才踏实了每一步,在涉足的每一个领域都取得了重大的成就。
     
      熠熠生辉的成就

      近年来,何克抗教授及其领导的团队主要在“教育信息化工程”、“中小学的教学改革试验”和“教育创新理论”等三个方面开展了研究与探索。不仅研发出一大批国内领先的教育信息化解决方案和教育软件产品,而且率先倡导并大力推动信息技术与各学科课程的整合,并在“信息技术与课程整合”的理论与实践方面始终引领国内的方向与潮流。在担任“全国教师教育信息化专家委员会”主任期间,负责主持制定了全国第一个教师专业能力标准——“全国中小学教师教育技术能力标准”。
      
      与此同时,何克抗教授在长期深入进行中小学教改试验研究的基础上,努力探索网络时代的创新教育理论,通过对国内外教育名家思想、理论的批判继承,并紧密结合中国的实际,在创造性思维理论、信息技术与课程深层次整合理论、儿童思维发展新论、语觉论(儿童语言发展新论)、建构主义的教学设计理论等方面逐步创立了自成一家的全新教育理论。

      曾任和现任的主要学术兼职如下:
    第一届全球华人计算机教育应用大会学术委员会主席
    国际计算机教育应用学会(ICCE)执行委员
    国际计算机教育促进会(AACE)亚太分会执行委员
    全国教育技术学研究会理事长
    中国教育技术协会副会长兼学术委员会主席
    国家现代远程教育资源建设专家组副组长
    何教授取得了这么多荣誉,这么多的称号而他却最愿意称自己为"行者",顶天立地的行者,(所谓顶天立地,何教授是这么解释的:顶天即握国际学术最新动向,立地就是把它们实施推广,让这些教育成果在中国的土地上开花结果让更多的人受益。)读万卷书,行千里路的行者,何教授目前正基于网络环境下的基础教育跨越式创新探索试验,往返于城市之间而不知疲倦,这份颠簸即使是年轻人也难以忍受,而何教授却默默地享受着这一份操劳给自己带来的充实。
     
      在采访的最后,何教授充满憧憬的说:“生命的价值在于创造,我希望未来的几年里,能够再出两三本教育学方面的书。”

      他虽已是古稀之年但热情不减当年,心系教育事业,鞠躬尽瘁。他还热情洋溢地寄语师大的莘莘学子:“农村是教育的广阔天地,教育的均衡,教育的公平是我们的责任,我们是托起希望的太阳的一代!”

      采访完何教授,我感慨颇多,尤其是想起了曹操的:“老骥伏枥,志在千里,烈士暮年,壮心不已。”

    信息来源:

    http://news.bnu.edu.cn/News/14207.html
  • 自我设限

    2008-12-13 19:55:47

    跳蚤的跳跃高度可以达到它身体的400倍左右,堪称动物界的跳高冠军。有人往一个玻璃杯里放进一只跳蚤,发现跳蚤总能立即轻易地跳了出来。这次杯子底儿朝上,再把跳蚤放进杯子里。“嘣”的一声,跳蚤重重地撞在杯子底儿上。跳蚤十分困惑,但是它不会停下来。一次次被撞,跳蚤开始变得聪明起来了,它开始根据杯子底儿的高度来调整自己的跳跃高度。再过一阵子,这只跳蚤不再碰壁,而是在下面很压抑地跳动。一天后,实验者把杯子轻轻拿掉,跳蚤却还在原来那个高度上继续地跳。
        最可悲的是:从此以后,虽然杯子已不存在,跳蚤却连“再试一次”的勇气都没有了。心理学家把这种现象叫做“自我设限”。
  • 胡适的话

    2008-12-13 19:53:19

    著名学者胡适曾说过:“理想中的学者,既能博大,又能精深,博大要几乎无所不知,精深要几乎唯他独尊。”我们的孩子想看这些书,绝对是在扩充他们的知识面。读了一本书,就像对生活打开了一扇窗户。“读史使人明智,读诗使人聪慧,数学使人精密,哲学使人深刻,伦理学使人有修养,逻辑学使人善辩。”
  • 面对“教育部:师德将作为新教师聘用的必备条件”直言。

    2008-09-11 08:36:42

         
            当前中小学教师工作压力是很大的,来自家长的,来自社会,还有自己(学校,教育部门)施加(自己折腾自己,呵呵)的。然而,他们的工作量是非常大的。焦虑症,颈椎病,咽 炎等是教师的职业病。面对家长的期待,升学的压力,就是外界不给压力,教师们都已经感到沉甸甸的。
          然而,教师工资与他们的付出不相对。特别小学教师更是辛苦。每位家长都认为自己的宝宝是最优秀的,是皇帝。而面对这些娇生惯养的孩子,老师如何去管理去教?无疑教师会付出很多的劳动。有着近20年教龄的中小学 教师,现在每月工资大概1500元。在这物价飞涨年月,这点工资也就勉强生活而已。
          教师职业道德是该讲,是该有个标准。但是,教师的工资福利提不上去,在 这个现实的社会里,这些标准没有什么意义。总不能憋着肚子,谈职业道德吧。试想如果教师的工资福利比较令人满意,谁还会办课外班呢。
          我想每个人都希望去享受 生活,而不为生活而奔波。
  • 午间--喜爱阳光

    2008-09-05 15:38:27

    在望京科技创业园上班有3个多月了。每天午餐后,我习惯性地在绕园区溜达一周。
    独自走在林荫道上,心情很放松。远离了繁忙压抑的工作环境,享受轻松的我。偶尔也会遇见其他公司的员工,看来大家都利用午休的时间,出来散步,和朋友聊聊天。
    有时我觉得我们每天就好像工作在监狱一样,中午的时候,出来放风。犯人在监狱里有狱警看管,不被允许随便出来溜达,做自己想做的事情。我们在公司里,老板在时刻盯着你,也不会随便出来。不能大声说话,不让上QQ,不让......

    我有时也会特意走在炙热的阳光下,也许是因为每天坐在办公室里,见不到阳光的缘故,我总是对阳光充满了渴望。记得小的时候,总是喜欢炎热的夏天去河里玩耍。
    我问同事是否一起出去溜达,他们说太晒了。我说就是家里的被子,每隔一段时间还要在阳光下晒一晒,否则会发霉的。更何况人呢,不见阳光会不健康的。日出而作,日落而息。我们几乎没有接受阳光的几乎。我的脸在家里总是黑黑的,到到公式上班月后,人家说北京养人,---我都出息的白净了----其实不健康的表现。

    所以,我总是对阳光充满了渴望,喜欢晒太阳。


  • 6-9月份总结项目管理经验

    2008-09-04 21:46:32

    从6月份开始在一家软件公司做项目经理的职位,大概有3个多月的时间了,现在把这期间的工作内容和需要改进之处小结。
    一、工作内容
    1.6月份主要是招聘开发工程师。
    虽说中国IT从业人员比较多,但真正招聘到符合项目需求的人很少。这其中的原因:
    招聘的时间问题。每年3、4和9、10是跳槽时期,人员流动比较大。
    公司自身因素问题。公司的规模、薪酬福利。
    2.7月份开始开发。
    确定开发的技术架构。
    明确需求。由于自身不是石油工程专业毕业,对一些需求的理解有困难。两外该项目的需求一直不是很明确。边学习专业知识边探索开发。到7月末已经招聘到3位MFC开发工程师。在做项目管理的同时,我写了读las文件的模块,使用了模板,自我感觉海不错。
    8.明确需求。
    在这个月末的时候,我们将客户请到了公司,用了6天的时间明确需求。这些天好像这天在开会。o(∩_∩)。
    二、今后的改进
    1.加强对开发进度的管理,盯紧开发进度。
    把握每位工程师每天开发进度,通过定期和不定时的讨论,了解各个工程师的工作任务和开发计划。努力将自己制定的目标和工程师的目标结合在一起。
    2.增加每天的反思
    晚上认真思考当前的工作得失,努力将自己的工作调整到最佳状态。
    3.增加在工作中的果断意识。
    在明确目标,澄清问题之后,要果断定论。努力提高自己与工程师的沟通和协调能力。

  • 现在孩子好好学习就是在挣钱

    2008-08-26 18:30:06

    从孩子开始上学开始,家长对孩子的着急就开始了,报各种各样的班。这种状态一直会持续到孩子大学毕业。
    父母在该孩子的花钱上可谓“视金钱为粪土”,孩子就是化粪池。
    如果孩子学习好,在上初中、高中和大学时为父母剩下很多钱。比如有的高中升学时,一分只差可能未能过线,家长可能要花上1万元的的赞助费。对三本的大学每年的学费都在1万,而读一本,2本的学校的学费大概在5000元。
    所以从这个角度看,学生好好学习就是在挣钱啊。更极端的讲学习的本质就是挣钱!
  • :刘翔退赛是一门学问 整件事情是策划

    2008-08-19 13:31:10

    千万不要把人捧上天.


    http://sports.tom.com/2008-08-19/0ND0/13075699.html
  • 中国-比利时 男足失败的不光彩

    2008-08-12 08:30:32

    前天晚上,中国-比利时男足进行了比赛,以失败而告终.
    在比赛中中国被红牌罚下2人.其中一人在中场踹人,另外的是队长,用肘击对方,而被 罚下.

    我想要成为一支优秀的球队,不仅仅在球员的个人技术,球员之间的配合.球员的个人素质修养是非常重要.在球场上关键时刻,既要从技术角度上犯规而合情合理.而不能发粗.将国人的脸面丢尽.
    中华民族是礼仪之邦,崇尚大度。有着宽广的胸襟,在国际赛场上,不去做那些有失大雅的,让球迷痛心的荒唐的动作。输球不能输掉人品!
  • MDT研发模块开发模型

    2008-07-29 11:05:40

  • 又开始写Blog啦!

    2008-05-12 12:49:37

    几乎半年你见的Blog终于又可以使用了。在Blog不在期间内,一定有许多朋友光临过。对这些关注我的朋友说声对不起,希望继续关注我。
    我的这个Blog主要是发表一些关于教育技术的言论、观点和看法。希望和大家在教育技术领域内共同进步。
  • Say no dogmatism to them

    2007-07-26 12:53:51

    I take bus at MaDian satation in Beijing everyday.
  • RDF and template

    2007-07-23 11:30:12

    1.         RDF and template

    1.1.        Resourece descrīption framework

    RDF (Resource Descrīption Framework) is a format that can be used to store resources such as bookmarks or mail. Alternatively, data in other formats can be used and code written that will read the file and create RDF data from it. This is how Mozilla works when it reads data such as bookmarks, the history or mail messages. Mozilla provides datasources for this common data so that you can easily use them.

    <RDF:RDF xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
             xmlns:ANIMALS="http://www.some-fictitious-zoo.com/rdf#"> 
      <RDF:Seq about="http://www.some-fictitious-zoo.com/all-animals">
        <RDF:li>
           <RDF:Descrīption about="http://www.some-fictitious-zoo.com/mammals/lion">
             <ANIMALS:name>Lion</ANIMALS:name>
             <ANIMALS:species>Panthera leo</ANIMALS:species>
             <ANIMALS:class>Mammal</ANIMALS:class>
           </RDF:Descrīption>
        </RDF:li>
        <RDF:li>
           <RDF:Descrīption about="http://www.some-fictitious-zoo.com/arachnids/tarantula">
             <ANIMALS:name>Tarantula</ANIMALS:name>
             <ANIMALS:species>Avicularia avicularia</ANIMALS:species>
             <ANIMALS:class>Arachnid</ANIMALS:class>
           </RDF:Descrīption>
        </RDF:li>
        <RDF:li>
           <RDF:Descrīption about="http://www.some-fictitious-zoo.com/mammals/hippopotamus">
             <ANIMALS:name>Hippopotamus</ANIMALS:name>
             <ANIMALS:species>Hippopotamus amphibius</ANIMALS:species>
             <ANIMALS:class>Mammal</ANIMALS:class>
           </RDF:Descrīption>
        </RDF:li>
      </RDF:Seq>
    </RDF:RDF>

     

    1.2.        template

    <?xml version="1.0"?> 
    <?xml-stylesheet href="chrome://global/skin/" type="text/css"?> 
    <window id="example-window" title="Example 9.2.1"
            xmlns:html="http://www.w3.org/1999/xhtml"
            xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
    <vbox datasources="rdf:bookmarks" ref="NC:BookmarksRoot" flex="1">
      <template>
        <button uri="rdf:*" label="rdf:http://home.netscape.com/NC-rdf#Name"/>
      </template>
    </vbox>
    </window> 
    In this case, rdf:bookmarks is used. You can probably guess that this means to use the bookmarks datasource. This datasource is provided by Mozilla. The ref attribute indicates where in the datasource you would like to retrieve data from. In the case of the bookmarks, the value NC:BookmarksRoot is used to indicate the root of the bookmarks hierarchy. An attribute value inside the template that begins with 'rdf:' indicates that the value should be taken from the datasource. In the example earlier, this is the case for the label attribute. The remainder of the value refers to the name property is the datasource. It is constructed by taking the namespace URL used by the datasource and appending the property name.

     

    1.3.        Rules

    We define a rule for each variation of elements that we want to have created. In our case, we would need a rule for bookmarks and a rule for separators. Attributes placed on the rule element determine which rules apply to which RDF resource.

    <vbox datasources="rdf:bookmarks" ref="NC:BookmarksRoot" flex="1">
       <template> 
        <rule rdf:type="http://home.netscape.com/NC-rdf#BookmarkSeparator">
         <spacer uri="rdf:*" height="16"/>
        </rule> 
        <rule>
          <button uri="rdf:*" label="rdf:http://home.netscape.com/NC-rdf#Name"/>
        </rule>
      
      </template>
     </vbox> 

    1.4.        Adding Datasources to Trees

    <tree id="my-tree" flex="1"

          datasources="rdf:files" ref="file:///" flags="dont-built-content">

       <treecols>

          <treecol id="Name" label="Name" primary="true" flex="1"/>

          <splitter/>

          <treecol id="Date" label="Date" flex="1"/>

       </treecols>
      

       <template>

          <rule>

             <treechildren>

                <treeitem uri="rdf.*">

                   <treerow>

                      <treecell label="rdf://http://home.netscape.com/NC-rdf#Name"/>

                      <treecell label="rdf://http:home.netscape.com/WEB-rdf#LastModifiedDate"/>

                   </treerow>

                </treeitem>

             </treechildren>

          </rule>

       </template>

    </tree>

    An interesting part of RDF datasources is that the resource values are only determined when the data is needed. This means that values that are deeper in the resource hierarchy are not determined until the user navigates to that node in the tree. This becomes useful for certain datasources where the data is determined dynamically.

    1.5.        Sorting columns

    sortDirection  sortActive and sortDirectionIndicator

    <treecols>
      <treecol id="Name" label="Name" flex="1" primary="true"
                class="sortDirectionIndicator" sortActive="true"
                sortDirection="ascending"
                sort="rdf:http://home.netscape.com/NC-rdf#Name"/>
      <splitter/>
      <treecol id="Date" label="Date" flex="1" class="sortDirectionIndicator"
               sort="rdf:http://home.netscape.com/WEB-rdf#LastModifiedDate"/>
    </treecols>

     

    1.6.        RDF Datasources

    History list  Bookmarks and Files

     

    1.7.        Custom RDF Datasources

    <?xml version="1.0"?>
     
    <RDF:RDF xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
             xmlns:ANIMALS="http://www.some-fictitious-zoo.com/rdf#">
     
       <RDF:Descrīption RDF:about="http://www.some-fictitious-zoo.com/arachnids">
         <ANIMALS:name>Arachnids</ANIMALS:name>
       </RDF:Descrīption>
     
           <RDF:Descrīption RDF:about="http://www.some-fictitious-zoo.com/arachnids/tarantula" ANIMALS:specimens="0">
             <ANIMALS:name>Tarantula</ANIMALS:name>
             <ANIMALS:species>Avicularia avicularia</ANIMALS:species>
           </RDF:Descrīption>
     
       <RDF:Descrīption RDF:about="http://www.some-fictitious-zoo.com/birds">
         <ANIMALS:name>Birds</ANIMALS:name>
       </RDF:Descrīption>
     
           <RDF:Descrīption RDF:about="http://www.some-fictitious-zoo.com/birds/emu" ANIMALS:specimens="12">
             <ANIMALS:name>Emu</ANIMALS:name>
             <ANIMALS:species>Dromaius novaehollandiae</ANIMALS:species>
           </RDF:Descrīption>
     
           <RDF:Descrīption RDF:about="http://www.some-fictitious-zoo.com/birds/barnowl" ANIMALS:specimens="4">
             <ANIMALS:name>Barn Owl</ANIMALS:name>
             <ANIMALS:species>Tyto alba</ANIMALS:species>
           </RDF:Descrīption>
     
           <RDF:Descrīption RDF:about="http://www.some-fictitious-zoo.com/birds/raven" ANIMALS:specimens="0">
             <ANIMALS:name>Raven</ANIMALS:name>
             <ANIMALS:species>Corvus corax</ANIMALS:species>
           </RDF:Descrīption>
     
       <RDF:Descrīption RDF:about="http://www.some-fictitious-zoo.com/fish">
         <ANIMALS:name>Fish</ANIMALS:name>
       </RDF:Descrīption>
     
           <RDF:Descrīption RDF:about="http://www.some-fictitious-zoo.com/fish/cod" ANIMALS:specimens="0">
             <ANIMALS:name>Cod</ANIMALS:name>
             <ANIMALS:species>Gadus morhua</ANIMALS:species>
           </RDF:Descrīption>
     
           <RDF:Descrīption RDF:about="http://www.some-fictitious-zoo.com/fish/swordfish" ANIMALS:specimens="3">
             <ANIMALS:name>Swordfish</ANIMALS:name>
             <ANIMALS:species>Xiphias gladius</ANIMALS:species>
           </RDF:Descrīption>
     
       <RDF:Descrīption RDF:about="http://www.some-fictitious-zoo.com/mammals">
         <ANIMALS:name>Mammals</ANIMALS:name>
       </RDF:Descrīption>
     
           <RDF:Descrīption RDF:about="http://www.some-fictitious-zoo.com/mammals/lion" ANIMALS:specimens="4">
             <ANIMALS:name>Lion</ANIMALS:name>
             <ANIMALS:species>Panthera leo</ANIMALS:species>
           </RDF:Descrīption>
     
           <RDF:Descrīption RDF:about="http://www.some-fictitious-zoo.com/mammals/hippopotamus" ANIMALS:specimens="2">
             <ANIMALS:name>Hippopotamus</ANIMALS:name>
             <ANIMALS:species>Hippopotamus amphibius</ANIMALS:species>
           </RDF:Descrīption>
     
           <RDF:Descrīption RDF:about="http://www.some-fictitious-zoo.com/mammals/africanelephant" ANIMALS:specimens="4">
             <ANIMALS:name>African Elephant</ANIMALS:name>
             <ANIMALS:species>Loxodonta africana</ANIMALS:species>
           </RDF:Descrīption>
     
           <RDF:Descrīption RDF:about="http://www.some-fictitious-zoo.com/mammals/llama" ANIMALS:specimens="3">
             <ANIMALS:name>Llama</ANIMALS:name>
             <ANIMALS:species>Lama glama</ANIMALS:species>
           </RDF:Descrīption>
     
           <RDF:Descrīption RDF:about="http://www.some-fictitious-zoo.com/mammals/polarbear" ANIMALS:specimens="0">
             <ANIMALS:name>Polar Bear</ANIMALS:name>
             <ANIMALS:species>Thalarctos maritimus</ANIMALS:species>
           </RDF:Descrīption>
     
           <RDF:Descrīption RDF:about="http://www.some-fictitious-zoo.com/mammals/aardvark" ANIMALS:specimens="2">
             <ANIMALS:name>Aardvark</ANIMALS:name>
             <ANIMALS:species>Orycteropus afer</ANIMALS:species>
           </RDF:Descrīption>
     
           <RDF:Descrīption RDF:about="http://www.some-fictitious-zoo.com/mammals/ninebandedarmadillo" ANIMALS:specimens="0">
             <ANIMALS:name>Nine-banded Armadillo</ANIMALS:name>
             <ANIMALS:species>Dasypus novemcinctus</ANIMALS:species>
           </RDF:Descrīption>
     
       <RDF:Descrīption RDF:about="http://www.some-fictitious-zoo.com/reptiles">
         <ANIMALS:name>Reptiles</ANIMALS:name>
       </RDF:Descrīption>
     
           <RDF:Descrīption RDF:about="http://www.some-fictitious-zoo.com/reptiles/anaconda" ANIMALS:specimens="1">
             <ANIMALS:name>Anaconda</ANIMALS:name>
             <ANIMALS:species>Eunectes murinus</ANIMALS:species>
           </RDF:Descrīption>
     
           <RDF:Descrīption RDF:about="http://www.some-fictitious-zoo.com/reptiles/chameleon" ANIMALS:specimens="2">
             <ANIMALS:name>Chameleon</ANIMALS:name>
             <ANIMALS:species>Chamaeleo chamaelon</ANIMALS:species>
           </RDF:Descrīption>
     
      <RDF:Seq RDF:about="http://www.some-fictitious-zoo.com/all-animals">
        <RDF:li>
          <RDF:Seq RDF:about="http://www.some-fictitious-zoo.com/arachnids">
            <RDF:li RDF:resource="http://www.some-fictitious-zoo.com/arachnids/tarantula"/>
          </RDF:Seq>
        </RDF:li>
        <RDF:li>
          <RDF:Seq RDF:about="http://www.some-fictitious-zoo.com/birds">
            <RDF:li RDF:resource="http://www.some-fictitious-zoo.com/birds/emu"/>
            <RDF:li RDF:resource="http://www.some-fictitious-zoo.com/birds/barnowl"/>
            <RDF:li RDF:resource="http://www.some-fictitious-zoo.com/birds/raven"/>
          </RDF:Seq>
        </RDF:li>
        <RDF:li>
          <RDF:Seq RDF:about="http://www.some-fictitious-zoo.com/fish">
            <RDF:li RDF:resource="http://www.some-fictitious-zoo.com/fish/cod"/>
            <RDF:li RDF:resource="http://www.some-fictitious-zoo.com/fish/swordfish"/>
          </RDF:Seq>
        </RDF:li>
        <RDF:li>
          <RDF:Seq RDF:about="http://www.some-fictitious-zoo.com/mammals">
            <RDF:li RDF:resource="http://www.some-fictitious-zoo.com/mammals/lion"/>
            <RDF:li RDF:resource="http://www.some-fictitious-zoo.com/mammals/hippopotamus"/>
            <RDF:li RDF:resource="http://www.some-fictitious-zoo.com/mammals/africanelephant"/>
            <RDF:li RDF:resource="http://www.some-fictitious-zoo.com/mammals/llama"/>
            <RDF:li RDF:resource="http://www.some-fictitious-zoo.com/mammals/polarbear"/>
            <RDF:li RDF:resource="http://www.some-fictitious-zoo.com/mammals/aardvark"/>
            <RDF:li RDF:resource="http://www.some-fictitious-zoo.com/mammals/ninebandedarmadillo"/>
          </RDF:Seq>
        </RDF:li>
        <RDF:li>
          <RDF:Seq RDF:about="http://www.some-fictitious-zoo.com/reptiles">
            <RDF:li RDF:resource="http://www.some-fictitious-zoo.com/reptiles/anaconda"/>
            <RDF:li RDF:resource="http://www.some-fictitious-zoo.com/reptiles/chameleon"/>
          </RDF:Seq>
        </RDF:li>
      </RDF:Seq>
     
    </RDF:RDF>
     
    <?xml version="1.0"?>
     
    <?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
     
    <window
      id="example-window"
      title="History List"
      xmlns:ANIMALS="http://www.some-fictitious-zoo.com/rdf#"
      xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
     
    <button label="Click here to see the mammals the zoo has" type="menu"
            datasources="animals.rdf" ref="http://www.some-fictitious-zoo.com/mammals">
      <template>
        <rule ANIMALS:specimens="0"></rule>
        <rule>
          <menupopup>
            <menuitem uri="rdf:*" label="rdf:http://www.some-fictitious-zoo.com/rdf#name"/>
          </menupopup>
        </rule>
      </template>
    </button>
     
    </window>

     

    1.8.        advanced rules

    Full rules contain three child tags, a conditions tag, a bindings tag and an action tag, although the bindings tag is not always needed. If the conditions match for that resource, the content in the actions element is generated for that resource. If the conditions do not match, no content is
  • Trees

    2007-07-20 16:47:44

    1.1.        the tree

    A tree consists of two parts, the set of columns, and the tree body. The set of columns is defined by a number of treecol elements, one for each column. Each column will appear as a header at the top of the tree. The second part, the tree body, contains the data to appear in the tree and is created with a treechildren tag. In a tree, all of the data to be displayed is supplied by a separate object, called a tree view. When it comes time to display a cell, the tree widget will call out to this tree view to determine what to display, which in turn will be drawn by the tree.

    Tree elements;

    Ø         treeThis is the outer element of a tree.

    Ø         treecolsThis element is a placeholder for a set of treecol elements.

    Ø         treecolThis is used to declare a column of the tree. By using this element, you can specify additional information about how the data in the columns are sorted and if the user can resize the columns. You should always place an id attribute on a column, as Mozilla uses the ids to identify the columns when rearranging and hiding them. This is no longer required in Mozilla 1.8 and later, but it is still a good idea to use ids on columns.

    Ø         treechildrenThis contains the main body of the tree where the individual rows of data will be displayed.

    The content tree view;

    Ø         treeitemThis contains a single parent row and all its descendants. This element also serves as the item which can be selected by the user. The treeitem tag would go around the entire row so that it is selectable as a whole.

    Ø         treerowA single row in the tree, which should be placed inside a treeitem tag.

    Ø         treecellA single cell in a tree. This element would go inside a treerow element.

    <tree flex="1">
      <treecols>
        <treecol id="sender" label="Sender" flex="1"/>
        <treecol id="subject" label="Subject" flex="2"/>
      </treecols> 
      <treechildren>
        <treeitem>
          <treerow>
            <treecell label="joe@somewhere.com"/>
            <treecell label="Top secret plans"/>
          </treerow>
        </treeitem>
        <treeitem>
          <treerow>
            <treecell label="mel@whereever.com"/>
            <treecell label="Let's do lunch"/>
          </treerow>
        </treeitem>
      </treechildren>
    </tree>

     

    1.2.        Getting /setting the selected tree items

    The syntax of the onselect event handler is shown below.

    <tree id="treeset" ōnselect="alert('You selected something!');">
    he tree has a property currentIndex, which can be used to get the currently selected item, where the first row is 0.
    From the tree, you can get the selection using the tree's view property and then retrieve the view's selection property. You can use the methods of the selection object to retrieve the set of selected items or modify the selection.
    var start = new Object();
    var end = new Object();
    var numRanges = tree.view.selection.getRangeCount(); 
    for (var t=0; t<numRanges; t++){
      tree.view.selection.getRangeAt(t,start,end);
      for (var v=start.value; v<=end.value; v++){
        alert("Item "+v+" is selected.");
      }
    }
    alert(tree.view.selection.isSelected(3));
     
    Ø         tree.view.selection.select(5);
    Ø         tree.view.selection.rangedSelect(2,7,true);
    Ø         tree.view.selection.clearRange(2,7);
     

    1.3.        creating a custom view

    To implement a custom view, you will need to create an object which implements the nsITreeView interface. You can create these objects in Javascrīpt. In general, although the tree view has thirty or so functions that may be implemented, you only need to implement the ones that the tree will call. Three methods that you should implement are listed below.

    Ø         rowCount This property should be set to the total number of rows in the tree.

    Ø         getCellText( row , column ) This method should return the text contents at the specified row and column. This will be called to display data for each cell. The rows are supplied as numeric values starting at 0. The columns are supplied as the values of the id attribute on the columns. In Mozilla 1.8 and later, the column will instead be a TreeColumn object.

    Ø         setTree( tree ) This method is called once to set the tree element on the view.

    The final step is to associate the view object with the tree. The tree has a property view, which can be assigned to the view object declared above. We can assign a value to this property at any time to set or change the view.

    <?xml version="1.0"?>
    <?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
    <window title="Tree Example" id="tree-window"
       xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
       onload="setView();">
     
    <scrīpt>
    var treeView = {
        rowCount : 10000,
        getCellText : function(row,column){
          if (column.id == "namecol") return "Row "+row;
          else return "February 18";
        },
        setTree: function(treebox){ this.treebox = treebox; },
        isContainer: function(row){ return false; },
        isSeparator: function(row){ return false; },
        isSorted: function(){ return false; },
        getLevel: function(row){ return 0; },
        getImageSrc: function(row,col){ return null; },
        getRowProperties: function(row,props){},
        getCellProperties: function(row,col,props){},
        getColumnProperties: function(colid,col,props){}
    };
     function setView()
    {
        document.getElementById('my-tree').view=treeView;
    }
    </scrīpt> 
    <tree id="my-tree" flex="1">
      <treecols>
        <treecol id="namecol" label="Name" flex="1"/>
        <treecol id="datecol" label="Date" flex="1"/>
      </treecols>
      <treechildren/>
    </tree> 
    </window> 

    1.4.        Tree Box objects

    The tree box object is a specialized box object used specifically for trees. The tree box implements the TreeBoxObject interface.

    <scrīpt>
    function doScroll()
    {
      var value = document.getElementById("tbox").value;
      var tree = document.getElementById("thetree"); 
      var boxobject = tree.boxObject;
      boxobject.QueryInterface(Components.interfaces.nsITreeBoxObject);
      boxobject.scrollToRow(value);
    }
    </scrīpt>
     
    <tree id="thetree" rows="4">
      <treecols>
        <treecol id="row" label="Row" primary="true" flex="1"/>
      </treecols>
      <treechildren>
        <treeitem label="Row 0"/>
        <treeitem label="Row 1"/>
        <treeitem label="Row 2"/>
        <treeitem label="Row 3"/>
        <treeitem label="Row 4"/>
        <treeitem label="Row 5"/>
        <treeitem label="Row 6"/>
        <treeitem label="Row 7"/>
        <treeitem label="Row 8"/>
        <treeitem label="Row 9"/>
      </treechildren>
    </tree>
     
    <hbox align="center">
      <label value="Scroll to row:"/>
      <textbox id="tbox"/>
      <button label="Scroll" ōncommand="doScroll();"/>
    </hbox>

    You might notice that the tree box object can be retieved in the same way as other box objects using the boxObject property, however we need to call QueryInterface to cast the box object to the more specific tree box object.

  • Events and Scripts

    2007-07-19 14:03:27

    1.         Events and scrīpts

    1.1.        Adding Events Handlers

    The event is then sent to the XUL in phases. The first phase is the capturing phase, in which the event is first sent to the window, then to the document, followed by each ancestor of the XUL element where the event occured downwards until it reaches that element. Then, the event is sent to that XUL element. Finally, during the bubbling phase, the event is sent to each element back upwards until it reaches the window again. You can respond to an event during either the capturing or bubbling phase. Once the event has finished propagating, any default action will occur, which is the built in behaviour of the element.

    <vbox ōncommand="alert(event.target.tagName);">

      <button label="OK"/>
      <checkbox label="Show images"/>
    </vbox>

     

    1.2.        DOM Event Listeners

    <button id="okbutton" label="OK"/>

    <scrīpt>

    function buttonPressed(event)

    { alert("Button was pressed!");

    }

    var button = document.getElementById("okbutton");

    button.addEventListener("command", buttonPressed, true);

    </scrīpt>

    1.3.        stop event

     <hbox id="outerbox">

      <button id="okbutton" label="OK"/>

    </hbox>

     

    <scrīpt>

    function buttonPressed(event)

    {

      alert("button was pressed!");

     

    }

     

    function boxPressed(event)

    {

      alert("box was pressed!");

      event.stopPropagation();

     

    }

     

    var button = document.getElementById("okbutton");

    button.addEventListener("command", buttonPressed, true);

     

    var box = document.getElementById("outerbox");

    box.addEventListener("command", boxPressed, true);

    </scrīpt>

    1.4.        Mouse Events

    Indicates the poistion of the mouse .

    <scrīpt>

    function updateMouseCoordinates(event)

    {

      var text = "X:" + event.clientX + " Y:" + event.clientY;

      document.getElementById("xy").value = text;

    }

    </scrīpt>

    <label id="xy"/>

    <hbox width="400" height="400" ōnmousemove="updateMouseCoordinates(event);"/>

     

    Get relative position of the element;

    var element = event.target;
    var elementX = event.clientX - element.boxObject.x;
    var elementY = event.clientY - element.boxObject.y;

     

    1.5.        Focused Elements

    You can respond to focus changes by adding an onfocus or onblur attribute on an element.

    You can also add event handlers dynamically using the DOM function addEventListener. You can use it for any element and event type. It takes three parameters, the event type, a function to execute when the event occurs and a boolean indicating whether to capture or not. The currently focused element is held by an object called a command dispatcher, of which there is only one for the window. The command dispatcher is responsible for keeping track of the focused element as the user uses the interface. You can retrieve the command dispatcher from a window using the document's commandDispatcher property. From there, you can get the focused element with the dispatcher's focusedElement propertyThere are several ways to change the currently focused element. The simplest is to call the focus method of a the XUL element that you wish to set the focus to. The blur method can be used to remove the focus from an element. The following example demonstrates this:

    Example 6.4.5:

    <textbox id="addr"/>
     
    <button label="Focus" ōncommand="document.getElementById('addr').focus()"/>

    Or, you can use the