??xml version="1.0" encoding="utf-8" standalone="yes"?>亚洲一卡2卡三卡4卡有限公司,一本色道久久88—综合亚洲精品,国产国拍亚洲精品福利http://www.tkk7.com/Ericzhang5231/zh-cnFri, 09 May 2025 22:04:40 GMTFri, 09 May 2025 22:04:40 GMT60if/else的用心?/title><link>http://www.tkk7.com/Ericzhang5231/articles/299443.html</link><dc:creator>Eric-1001c</dc:creator><author>Eric-1001c</author><pubDate>Sat, 24 Oct 2009 02:54:00 GMT</pubDate><guid>http://www.tkk7.com/Ericzhang5231/articles/299443.html</guid><wfw:comment>http://www.tkk7.com/Ericzhang5231/comments/299443.html</wfw:comment><comments>http://www.tkk7.com/Ericzhang5231/articles/299443.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.tkk7.com/Ericzhang5231/comments/commentRss/299443.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/Ericzhang5231/services/trackbacks/299443.html</trackback:ping><description><![CDATA[<div align="center"><img style="width: 402px; height: 189px;" alt="if_else" src="http://www.tkk7.com/images/blogjava_net/ericzhang5231/if_else.png" width="402" border="0" height="189" /><br /> </div> <br />       无疑 if/else几乎是所有编E语a的一个重要语法,我们不但可以在简单的函数里面发现它的Q更不用说在h复杂逻辑、代码行数篏累的功能里面了。所以尽if/else是一个简单的语法l构Q但它的功能很强大?br />       if/else的强大得我们在遇到M分支逻辑里面都会优先考虑它的使用Q所以无论是单的Q还是复杂逻辑功能函数都会出现if/elseQ但是这U?#8220;优先考虑”更多的时候却变成了一U怂恿和诱惑。特别在复杂逻辑功能函数里面Q不乏if/else错用、滥用和嵌套用。if/else错用、滥用和嵌套用都会在不同E度上减代码的可读性,降低代码的可l护性,增加潜在bug的可能性?br />      if/else错用。什么是if/else错用Q由于h的思维快速性,使得我们能够一下子对一些中{复杂的逻辑理解Q能够一下子把中{复杂的逻辑l构现在脑P因此在编E的时候就Ҏq于自信Q依葫芦ȝQ想到哪写到那。通常q容易得某些h在用if/else的时候导致错用,下面是一个if/else错用的例子:<br /> <div style="border: 1px solid #cccccc; padding: 4px 5px 4px 4px; background-color: #eeeeee; width: 98%; font-size: 13px;"><span style="color: #008080;"> 1</span><img id="Codehighlighter1_0_22_Open_Image" onclick="this.style.display='none'; Codehighlighter1_0_22_Open_Text.style.display='none'; Codehighlighter1_0_22_Closed_Image.style.display='inline'; Codehighlighter1_0_22_Closed_Text.style.display='inline';" src="http://www.tkk7.com/images/OutliningIndicators/ExpandedBlockStart.gif" alt="" align="top" /><img style="display: none;" id="Codehighlighter1_0_22_Closed_Image" onclick="this.style.display='none'; Codehighlighter1_0_22_Closed_Text.style.display='none'; Codehighlighter1_0_22_Open_Image.style.display='inline'; Codehighlighter1_0_22_Open_Text.style.display='inline';" src="http://www.tkk7.com/images/OutliningIndicators/ContractedBlock.gif" alt="" align="top" /><span style="border: 1px solid #808080; background-color: #ffffff; display: none;" id="Codehighlighter1_0_22_Closed_Text">/**/</span><span id="Codehighlighter1_0_22_Open_Text"><span style="color: #008000;">/*</span><span style="color: #008000;"><br /> </span><span style="color: #008080;"> 2</span><span style="color: #008000;"><img src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" alt="" align="top" /> * 只存在A、B和C情况的逻辑<br /> </span><span style="color: #008080;"> 3</span><span style="color: #008000;"><img src="http://www.tkk7.com/images/OutliningIndicators/ExpandedBlockEnd.gif" alt="" align="top" /> </span><span style="color: #008000;">*/</span></span><span style="color: #000000;"><br /> </span><span style="color: #008080;"> 4</span><span style="color: #000000;"><img id="Codehighlighter1_31_53_Open_Image" onclick="this.style.display='none'; Codehighlighter1_31_53_Open_Text.style.display='none'; Codehighlighter1_31_53_Closed_Image.style.display='inline'; Codehighlighter1_31_53_Closed_Text.style.display='inline';" src="http://www.tkk7.com/images/OutliningIndicators/ExpandedBlockStart.gif" alt="" align="top" /><img style="display: none;" id="Codehighlighter1_31_53_Closed_Image" onclick="this.style.display='none'; Codehighlighter1_31_53_Closed_Text.style.display='none'; Codehighlighter1_31_53_Open_Image.style.display='inline'; Codehighlighter1_31_53_Open_Text.style.display='inline';" src="http://www.tkk7.com/images/OutliningIndicators/ContractedBlock.gif" alt="" align="top" />  </span><span style="color: #0000ff;">if</span><span style="color: #000000;">(A)</span><span style="border: 1px solid #808080; background-color: #ffffff; display: none;" id="Codehighlighter1_31_53_Closed_Text"><img src="http://www.tkk7.com/Images/dot.gif" alt="" /></span><span id="Codehighlighter1_31_53_Open_Text"><span style="color: #000000;">{<br /> </span><span style="color: #008080;"> 5</span><span style="color: #000000;"><img src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" alt="" align="top" />    </span><span style="color: #008000;">//</span><span style="color: #008000;">dosomething</span><span style="color: #008000;"><br /> </span><span style="color: #008080;"> 6</span><span style="color: #008000;"><img id="Codehighlighter1_58_164_Open_Image" onclick="this.style.display='none'; Codehighlighter1_58_164_Open_Text.style.display='none'; Codehighlighter1_58_164_Closed_Image.style.display='inline'; Codehighlighter1_58_164_Closed_Text.style.display='inline';" src="http://www.tkk7.com/images/OutliningIndicators/ExpandedBlockStart.gif" alt="" align="top" /><img style="display: none;" id="Codehighlighter1_58_164_Closed_Image" onclick="this.style.display='none'; Codehighlighter1_58_164_Closed_Text.style.display='none'; Codehighlighter1_58_164_Open_Image.style.display='inline'; Codehighlighter1_58_164_Open_Text.style.display='inline';" src="http://www.tkk7.com/images/OutliningIndicators/ContractedBlock.gif" alt="" align="top" /></span><span style="color: #000000;">  }</span></span><span style="color: #0000ff;">else</span><span style="border: 1px solid #808080; background-color: #ffffff; display: none;" id="Codehighlighter1_58_164_Closed_Text"><img src="http://www.tkk7.com/Images/dot.gif" alt="" /></span><span id="Codehighlighter1_58_164_Open_Text"><span style="color: #000000;">{<br /> </span><span style="color: #008080;"> 7</span><span style="color: #000000;"><img id="Codehighlighter1_70_98_Open_Image" onclick="this.style.display='none'; Codehighlighter1_70_98_Open_Text.style.display='none'; Codehighlighter1_70_98_Closed_Image.style.display='inline'; Codehighlighter1_70_98_Closed_Text.style.display='inline';" src="http://www.tkk7.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" alt="" align="top" /><img style="display: none;" id="Codehighlighter1_70_98_Closed_Image" onclick="this.style.display='none'; Codehighlighter1_70_98_Closed_Text.style.display='none'; Codehighlighter1_70_98_Open_Image.style.display='inline'; Codehighlighter1_70_98_Open_Text.style.display='inline';" src="http://www.tkk7.com/images/OutliningIndicators/ContractedSubBlock.gif" alt="" align="top" />     </span><span style="color: #0000ff;">if</span><span style="color: #000000;">(B)</span><span style="border: 1px solid #808080; background-color: #ffffff; display: none;" id="Codehighlighter1_70_98_Closed_Text"><img src="http://www.tkk7.com/Images/dot.gif" alt="" /></span><span id="Codehighlighter1_70_98_Open_Text"><span style="color: #000000;">{<br /> </span><span style="color: #008080;"> 8</span><span style="color: #000000;"><img src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" alt="" align="top" />       </span><span style="color: #008000;">//</span><span style="color: #008000;">dosomething</span><span style="color: #008000;"><br /> </span><span style="color: #008080;"> 9</span><span style="color: #008000;"><img id="Codehighlighter1_103_160_Open_Image" onclick="this.style.display='none'; Codehighlighter1_103_160_Open_Text.style.display='none'; Codehighlighter1_103_160_Closed_Image.style.display='inline'; Codehighlighter1_103_160_Closed_Text.style.display='inline';" src="http://www.tkk7.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" alt="" align="top" /><img style="display: none;" id="Codehighlighter1_103_160_Closed_Image" onclick="this.style.display='none'; Codehighlighter1_103_160_Closed_Text.style.display='none'; Codehighlighter1_103_160_Open_Image.style.display='inline'; Codehighlighter1_103_160_Open_Text.style.display='inline';" src="http://www.tkk7.com/images/OutliningIndicators/ContractedSubBlock.gif" alt="" align="top" /></span><span style="color: #000000;">     }</span></span><span style="color: #0000ff;">else</span><span style="border: 1px solid #808080; background-color: #ffffff; display: none;" id="Codehighlighter1_103_160_Closed_Text"><img src="http://www.tkk7.com/Images/dot.gif" alt="" /></span><span id="Codehighlighter1_103_160_Open_Text"><span style="color: #000000;">{<br /> </span><span style="color: #008080;">10</span><span style="color: #000000;"><img id="Codehighlighter1_118_153_Open_Image" onclick="this.style.display='none'; Codehighlighter1_118_153_Open_Text.style.display='none'; Codehighlighter1_118_153_Closed_Image.style.display='inline'; Codehighlighter1_118_153_Closed_Text.style.display='inline';" src="http://www.tkk7.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" alt="" align="top" /><img style="display: none;" id="Codehighlighter1_118_153_Closed_Image" onclick="this.style.display='none'; Codehighlighter1_118_153_Closed_Text.style.display='none'; Codehighlighter1_118_153_Open_Image.style.display='inline'; Codehighlighter1_118_153_Open_Text.style.display='inline';" src="http://www.tkk7.com/images/OutliningIndicators/ContractedSubBlock.gif" alt="" align="top" />        </span><span style="color: #0000ff;">if</span><span style="color: #000000;">(C)</span><span style="border: 1px solid #808080; background-color: #ffffff; display: none;" id="Codehighlighter1_118_153_Closed_Text"><img src="http://www.tkk7.com/Images/dot.gif" alt="" /></span><span id="Codehighlighter1_118_153_Open_Text"><span style="color: #000000;">{<br /> </span><span style="color: #008080;">11</span><span style="color: #000000;"><img src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" alt="" align="top" />           </span><span style="color: #008000;">//</span><span style="color: #008000;">dosomething</span><span style="color: #008000;"><br /> </span><span style="color: #008080;">12</span><span style="color: #008000;"><img src="http://www.tkk7.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" alt="" align="top" /></span><span style="color: #000000;">        }</span></span><span style="color: #000000;"><br /> </span><span style="color: #008080;">13</span><span style="color: #000000;"><img src="http://www.tkk7.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" alt="" align="top" />     }</span></span><span style="color: #000000;"><br /> </span><span style="color: #008080;">14</span><span style="color: #000000;"><img src="http://www.tkk7.com/images/OutliningIndicators/ExpandedBlockEnd.gif" alt="" align="top" />  }</span></span></div>        在这个例子里面,׃只有3个逻辑可能性,所以很Ҏ׃分别?个逻辑可能性的一一建立分支。也许在单的、行数较的代码里面Q一一建立分支的做法ƈ无大,但如果功能复杂,行数较多Q代码自描述性较差的代码里面Q你大半会被q里的逻辑搞晕的。这是if/else错用了,其实q不需要一一建立分支Q至在上面的例子里面,对于C的判断是不需要的?br />       if/else滥用。滥用是指过多的使用if/elseq行逻辑控制Q同样也是因为思维的快速性和不具有良好编E经验的人容易烦的错误。例如下面的代码Q?br /> <div style="border: 1px solid #cccccc; padding: 4px 5px 4px 4px; background-color: #eeeeee; font-size: 13px; width: 98%;"><!--<br /> <br /> Code highlighting produced by Actipro CodeHighlighter (freeware)<br /> http://www.CodeHighlighter.com/<br /> <br /> --><span style="color: #008080;"> 1</span> <span style="color: #0000ff;">if</span><span style="color: #000000;">(A</span><span style="color: #000000;">&&</span><span style="color: #000000;">B</span><span style="color: #000000;">&&</span><span style="color: #000000;">C){<br /> </span><span style="color: #008080;"> 2</span> <span style="color: #000000;">   </span><span style="color: #008000;">//</span><span style="color: #008000;">dosomething</span><span style="color: #008000;"><br /> </span><span style="color: #008080;"> 3</span> <span style="color: #000000;">   </span><span style="color: #0000ff;">if</span><span style="color: #000000;">(A){<br /> </span><span style="color: #008080;"> 4</span> <span style="color: #000000;">     </span><span style="color: #008000;">//</span><span style="color: #008000;">dosomething</span><span style="color: #008000;"><br /> </span><span style="color: #008080;"> 5</span> <span style="color: #000000;">   }</span><span style="color: #0000ff;">else</span><span style="color: #000000;">{<br /> </span><span style="color: #008080;"> 6</span> <span style="color: #000000;">     </span><span style="color: #0000ff;">if</span><span style="color: #000000;">(B){<br /> </span><span style="color: #008080;"> 7</span> <span style="color: #000000;">       </span><span style="color: #008000;">//</span><span style="color: #008000;">dosomething</span><span style="color: #008000;"><br /> </span><span style="color: #008080;"> 8</span> <span style="color: #000000;">     }</span><span style="color: #0000ff;">else</span><span style="color: #000000;">{<br /> </span><span style="color: #008080;"> 9</span> <span style="color: #000000;">        </span><span style="color: #0000ff;">if</span><span style="color: #000000;">(C){<br /> </span><span style="color: #008080;">10</span> <span style="color: #000000;">          </span><span style="color: #008000;">//</span><span style="color: #008000;">dosomething</span><span style="color: #008000;"><br /> </span><span style="color: #008080;">11</span> <span style="color: #000000;">        }<br /> </span><span style="color: #008080;">12</span> <span style="color: #000000;">     }<br /> </span><span style="color: #008080;">13</span> <span style="color: #000000;">   }</span><span style="color: #000000;"><br /> </span><span style="color: #008080;">14</span><span style="color: #000000;">}</span></div> 很明显上面的q段代码不是一个良好结构的代码D,当然q里q存在if/else错用和嵌套用的问题。但是这׃说明了if/else错用和嵌套用的基本原因是我们滥用了if/elseQ因此如果当我们使用过3个嵌套if/else之后应该思考这D代码是否能够进行重构。重构的Ҏ很多Q本文就不进行具体介l了Q有兴趣可以参考Martin Fowler的《Refactoring: Improving the Design of Existing Code》以及wiki对refactoring?a >介绍</a>?br />       if/else嵌套用。嵌套用很好解释Q也很好理解其害处。h脑的堆栈定w是有限的Q一般不if/else或其他逻辑l构嵌套过三层以上Q否则h对其的记忆就会大大减弱,怿谁也不会想不断翻之前的代码行L看某个东西吧。我们在说if/else滥用的例子就是一个典型的嵌套用法Q层数达?层以上。这U问题很Ҏ产生Q因为程序本来就是要控制逻辑的,逻辑存在多种分支在大部分时候我们都会遇上。那怎么避免q种嵌套用呢Q要做到避免其实在一开始是很难做到的,除了l验丰富的h除外。所以我的徏议是Q先把事情做对了Q程序逻辑实现了)Q然后进行重构。对于大点的E序q行重构遵@Martin的观点,先写好相关的test。而这里的重构Ҏ也可以说相当单,思\一Q用Joshua Bloch在《effective java》中介绍的方法,把嵌套里面的if/else一一揪出q放到所在嵌套层的上一层,如果揪出后还能l在新所在层揪到新所层的上一层就l箋揪,同时要注意else是否能消掉;思\二:是否能够使用switch实现Q?个以上的逻辑判断用switch的话更容易让人看懂你写的东西。最后还应该Ҏ实际情况Q是否需要把逻辑代码D|取出来成Z个单独的函数或者类。例如上例我们可以进行如下重构:<br /> <div style="border: 1px solid #cccccc; padding: 4px 5px 4px 4px; background-color: #eeeeee; font-size: 13px; width: 98%;"><!--<br /> <br /> Code highlighting produced by Actipro CodeHighlighter (freeware)<br /> http://www.CodeHighlighter.com/<br /> <br /> --><span style="color: #008080;"> 1</span> <span style="color: #008000;">/*</span><span style="color: #008000;"><br /> </span><span style="color: #008080;"> 2</span> <span style="color: #008000;"> * 思\一Q揪if/else/<br /> </span><span style="color: #008080;"> 3</span> <span style="color: #008000;"> </span><span style="color: #008000;">*/</span><span style="color: #000000;"><br /> </span><span style="color: #008080;"> 4</span> <span style="color: #0000ff;">if</span><span style="color: #000000;">(A){</span><span style="color: #008000;">//</span><span style="color: #008000;">dosomething}</span><span style="color: #008000;"><br /> </span><span style="color: #008080;"> 5</span> <span style="color: #0000ff;">if</span><span style="color: #000000;">(B){</span><span style="color: #008000;">//</span><span style="color: #008000;">dosomething}</span><span style="color: #008000;"><br /> </span><span style="color: #008080;"> 6</span> <span style="color: #0000ff;">if</span><span style="color: #000000;">(C){</span><span style="color: #008000;">//</span><span style="color: #008000;">dosomething}</span><span style="color: #008000;"><br /> </span><span style="color: #008080;"> 7</span> <span style="color: #000000;"><br /> </span><span style="color: #008080;"> 8</span> <span style="color: #008000;">/*</span><span style="color: #008000;"><br /> </span><span style="color: #008080;"> 9</span> <span style="color: #008000;"> * 思\二:使用switch<br /> </span><span style="color: #008080;">10</span> <span style="color: #008000;"> </span><span style="color: #008000;">*/</span><span style="color: #000000;"><br /> </span><span style="color: #008080;">11</span> <span style="color: #0000ff;">switch</span><span style="color: #000000;">(condition){<br /> </span><span style="color: #008080;">12</span> <span style="color: #000000;">   </span><span style="color: #0000ff;">case</span><span style="color: #000000;"> </span><span style="color: #000000;">'</span><span style="color: #000000;">A</span><span style="color: #000000;">'</span><span style="color: #000000;">: </span><span style="color: #008000;">//</span><span style="color: #008000;">dosomething;break;</span><span style="color: #008000;"><br /> </span><span style="color: #008080;">13</span> <span style="color: #000000;">   </span><span style="color: #0000ff;">case</span><span style="color: #000000;"> </span><span style="color: #000000;">'</span><span style="color: #000000;">B</span><span style="color: #000000;">'</span><span style="color: #000000;">: </span><span style="color: #008000;">//</span><span style="color: #008000;">dosomething;break;</span><span style="color: #008000;"><br /> </span><span style="color: #008080;">14</span> <span style="color: #000000;">   </span><span style="color: #0000ff;">case</span><span style="color: #000000;"> </span><span style="color: #000000;">'</span><span style="color: #000000;">C</span><span style="color: #000000;">'</span><span style="color: #000000;">: </span><span style="color: #008000;">//</span><span style="color: #008000;">dosomething;break;</span><span style="color: #008000;"><br /> </span><span style="color: #008080;">15</span> <span style="color: #000000;">   </span><span style="color: #0000ff;">default</span><span style="color: #000000;">  :</span><span style="color: #008000;">//</span><span style="color: #008000;">dosomething;break;</span><span style="color: #008000;"><br /> </span><span style="color: #008080;">16</span> <span style="color: #000000;">}</span></div> <br />       if/esle虽小Q而且功能强大Q但如果不正用,不但会让代码l护困难Q更可怕是留下潜在的bug。以?个问题是比较普通出现的问题Q只要我们细心的话,q些问题都可以避免,修改和完善?br /> <img src ="http://www.tkk7.com/Ericzhang5231/aggbug/299443.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/Ericzhang5231/" target="_blank">Eric-1001c</a> 2009-10-24 10:54 <a href="http://www.tkk7.com/Ericzhang5231/articles/299443.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>摩尔定律其实是个咒http://www.tkk7.com/Ericzhang5231/archive/2009/10/18/mor.htmlEric-1001cEric-1001cSun, 18 Oct 2009 02:52:00 GMThttp://www.tkk7.com/Ericzhang5231/archive/2009/10/18/mor.htmlhttp://www.tkk7.com/Ericzhang5231/comments/298732.htmlhttp://www.tkk7.com/Ericzhang5231/archive/2009/10/18/mor.html#Feedback0http://www.tkk7.com/Ericzhang5231/comments/commentRss/298732.htmlhttp://www.tkk7.com/Ericzhang5231/services/trackbacks/298732.html     


    摩尔定律是由intel的戈L提出的一个观点,具体含义可以查看?a style="font-family: " target="_blank">摩尔定律。摩定律指出IC制作技术以直线的方式向前推q,普遍行的说法就??8个月番一?Q摩定律甚臌被推q至整个IT行业。看来似乎一切都是那么符合摩定律,但同时这一切说明把摩尔定律?#8220;邪恶”Q摩定?#8220;诅咒”了这一切。《浪潮之巅》的作者吴军提?a style="font-family: " target="_blank">“反摩定?#8221;揭示了摩定律的实质。反摩尔定律从摩定律的反方向进行思考,单的说如果一个企业没有遵循摩定律,今天和过?8个月一样卖掉同样多、同L产品Q那它的营业额就只有一半。这说明了什么?q就意味着在不遵@摩尔定律下,q个企业90%都会倒闭Q那么你说这个是不是一个魔咒哦Q!戈登背后所代表的是intel{大公司Q它们具有先q的技术和雄厚的胦力,完全有能力做到摩定律那P但其他中公司能吗?昄是不能的Q结果是大公司越发占领市场,中小公司则被q行另一轮淘汰和吞食?nbsp;

    实Q我们不能否定摩定律给一般民众带来的好处Q个人电脑、电脑配件以及数码品越来便宜。但长远来看Q摩定律得以后中公司纷U倒闭Q市场只存在数的超U大公司Q那市场上的电脑产品h控制权不是它们说了算Q那我们是不是就变成了砧板的DQQ人宰割呢Q有Ҏq了Q还是回归话题。摩定律这U利用自w的优势?#8220;l治”市场的招式ƈ不是只有intel会用Q其实跨国大公司都对此轻车熟路,Ibm提出的SOA不正是利用自w在企业服务的Y件和g优势再次成ؓq个市场的主宎ͼMicrosoft不断的推出新的操作系l也是如此,新操作系l的推出最后得民众的口袋憋下MQMicrosoft的老板们的别墅又多一栋。很多时候,我们其实是被“摩尔定律”了,只是我们大家都还不清楚而儿?/span>

Eric-1001c 2009-10-18 10:52 发表评论
]]>
览器网兼Ҏ问?-DOM基础?/title><link>http://www.tkk7.com/Ericzhang5231/articles/javascript_differ_dom.html</link><dc:creator>Eric-1001c</dc:creator><author>Eric-1001c</author><pubDate>Sat, 17 Oct 2009 08:52:00 GMT</pubDate><guid>http://www.tkk7.com/Ericzhang5231/articles/javascript_differ_dom.html</guid><wfw:comment>http://www.tkk7.com/Ericzhang5231/comments/298691.html</wfw:comment><comments>http://www.tkk7.com/Ericzhang5231/articles/javascript_differ_dom.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.tkk7.com/Ericzhang5231/comments/commentRss/298691.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/Ericzhang5231/services/trackbacks/298691.html</trackback:ping><description><![CDATA[W3C针对XHTML以及HTML开发一UDOMQ这个DOM是基于HTMLElement和HTMLDocument实现的。除了少数元素只包含HTMLElement属性和Ҏ外,每个HTML元素都通过特定的HTMLElementcd表示。然而ƈ不是所以浏览器对DOM都支持的Q下面列Z一些经怼遇到的不兼容的DOM使用问题?br /> <br /> 1.childNodes <br /> 不同览器用childNodes在处理Text节点存在一些差异。Mozilla认ؓ元素之间的空白是Text节点Q而IEQ会忽略q些I白。可以通过判断childNodes[x].nodeValue == "#text"QchildNodes[x].nodeType == 1解决q个问题Q或者用children属性,children属性是一个数l,可以通过索引获取子节点;<br /> <br /> 2.document<br /> IE使用document.allQ而用dom标准的浏览可以通过document.getElementsByTagName("*") Q?br /> <br /> 3.Id&getElementById<br /> 在IE中可以把Id当作元素使用Q但在其他浏览器不支持。因此徏议用getElementByIdQgetElementById在IE6中用,如果元素Name{于IdQ也会一同返回;<br /> <br /> 4.集合数组<br /> <span style="font-size: 12pt; font-family: 宋体;">IE中在使用集合cd象时候,讉K可以通过</span><span style="font-size: 12pt;"><span style="font-family: Times New Roman;">()</span></span><span style="font-size: 12pt; font-family: 宋体;">?/span><span style="font-size: 12pt;"><span style="font-family: Times New Roman;">[]</span></span>。徏议同一使用[]dom标准讉KQ?br /> <br /> 5.body对象<br /> <span style="font-size: 12pt; font-family: 宋体;">?/span><span style="font-size: 12pt;"><span style="font-family: Times New Roman;">IE</span></span><span style="font-size: 12pt; font-family: 宋体;">?/span><span style="font-size: 12pt;"><span style="font-family: Times New Roman;">body</span></span><span style="font-size: 12pt; font-family: 宋体;">对象要在</span><span style="font-size: 12pt;"><span style="font-family: Times New Roman;"><body></span></span><span style="font-size: 12pt; font-family: 宋体;">标签完全d才会存在Q而在</span><span style="font-size: 12pt;"><span style="font-family: Times New Roman;">FireFox</span></span><span style="font-size: 12pt; font-family: 宋体;">中一开始就存在</span>Q?br /> <br /> 6.Type属?br /> <span style="font-size: 12pt; font-family: 宋体;">?/span><span style="font-size: 12pt;"><span style="font-family: Times New Roman;">IE</span></span><span style="font-size: 12pt; font-family: 宋体;">?/span><span style="font-size: 12pt;"><span style="font-family: Times New Roman;">input</span></span><span style="font-size: 12pt; font-family: 宋体;">标签?/span><span style="font-size: 12pt;"><span style="font-family: Times New Roman;">type</span></span><span style="font-size: 12pt; font-family: 宋体;">属性是只读的,但在</span><span style="font-size: 12pt;"><span style="font-family: Times New Roman;">FireFox</span></span><span style="font-size: 12pt; font-family: 宋体;">中是可读写的Q?br /> <br /> 7.removeNodes/removeChild<br /> </span><span style="font-size: 12pt; font-family: 宋体;">在FireFox节点中没有removeNodeҎQ必M用如下方?node.parentNode.removeChild(node)</span>Q?br /> <br /> 8.ParentNode<br /> <span style="font-size: 12pt; font-family: 宋体;">IE</span><span style="font-size: 12pt; font-family: 宋体;">与FireFox的访问父元素有区别,IE为Obj.ParentElement属?FireFox为Obj.ParentNode属?/span><span style="font-size: 12pt; font-family: 宋体;">解决办法Q因为FireFox与IE都支持DOMQ因此统一用ParentNode属?/span>Q?br /> <br /> 9.set/getAttribute<br /> IE的setAttribute不能讄对象属性、事件属性和style相关的属性,对于自定义的可以讄Q要注意在FF中,通过自定义设|的属性和通过.Ҏ讄的属性不是同一个属性;<br /> <br /> 10.自定义属?br /> <span style="font-size: 12pt; font-family: 宋体;">在FF中不支持像IE那样直接获取</span>Q徏议统一用getAttributeҎQ?br /> <br /> 11.class/className<br /> <span style="font-size: 12pt; font-family: 宋体;">IE</span><span style="font-size: 12pt; font-family: 宋体;">中用”classname”做ؓ属性名来设|或取得css classQFF和其它浏览器?#8221;class”做ؓ属性名来设|或取得QDom标准的node objecthclassName属?br /> <br /> 12.Range<br /> 在IE中有document.selection.createRange(),document.body[button|input].createTextRange()Q而在FF中可以通过document.getSelection()[.getRangeAt(0)];而对Range的操作中Q除了IE和DOM标准的各Umove外,FF中的node elementq有selectionStart,selectionEnd只读属?br /> </span><br /> <br /> <img src ="http://www.tkk7.com/Ericzhang5231/aggbug/298691.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/Ericzhang5231/" target="_blank">Eric-1001c</a> 2009-10-17 16:52 <a href="http://www.tkk7.com/Ericzhang5231/articles/javascript_differ_dom.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>览器网兼Ҏ问?-DOM EVENT?/title><link>http://www.tkk7.com/Ericzhang5231/articles/javascript_differ_event.html</link><dc:creator>Eric-1001c</dc:creator><author>Eric-1001c</author><pubDate>Sat, 17 Oct 2009 04:56:00 GMT</pubDate><guid>http://www.tkk7.com/Ericzhang5231/articles/javascript_differ_event.html</guid><wfw:comment>http://www.tkk7.com/Ericzhang5231/comments/298674.html</wfw:comment><comments>http://www.tkk7.com/Ericzhang5231/articles/javascript_differ_event.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.tkk7.com/Ericzhang5231/comments/commentRss/298674.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/Ericzhang5231/services/trackbacks/298674.html</trackback:ping><description><![CDATA[DOM的不兼容也说明了DOM高ҎEvent的不兼容Q因为我们在开发Web的时候,和用L大量交互都是通过event来实现的Q所以单独把event抽出来,把其不兼Ҏ列出:<br /> <br /> <br /> Event的兼Ҏ?br /> 1.事g的区别<br /> IE         冒事g?nbsp;  在IE6增加<html>{元素对事g的响应<br /> Mozillal   冒事g?  在IE6的基上增加window对象对事件流的响?br /> Netscape   捕获事g?nbsp;  同Mozillal <br /> DOM标准    冒+捕获    增加文本节点对事件流的响应;同时冒+捕获使得事g目标q箋接收2ơ事?br />                        Q这可能是DOM的事件增加函数有W?个参数的原因Q?br /> 2.事g处理函数<br /> IE         attach(eventName, fn)?nbsp;                     eventName=on+事g?<br />            detachEvent(eventName, fn)<br /> DOM        addEventListener(eventName,fn,boolean)<br />            removeEventListener(eventName,fn,boolean)    eventName=事g?<br />                                                         boolean=true:捕获|false:冒<br />                                                         remove只有同事件流才能h <br /> 3.事g对象<br /> 定位       IEQwindow.eventQ?nbsp;                          window.event||arguments[0]<br />            DOMQarguments[0]Q事件处理函数的参数Q,可以通过caller来防止硬~码获取Q?br /> <br /> 事g目标   IEQevent.srcElement                         event.srcElement||event.target <br />            DOM:event.target<br /> <br /> L事g   IE: event.returnValue = true                 if(isIE){window.event.returnValue = true;}<br /> 默认行ؓ   DOM: event.preventDefault()                  else{arguments[0].preventDefault();} <br /> <br /> 3.1 鼠标事g[对象]<br /> 鼠标位置    IEQevent.x,event.y                         event.x?event.x:event.PageX <br />             DOM:event.pageX, event.pageY                event.y?event.y:event.PageY<br /> q入事g1   IE Qonmouseenter, onmouseleave             它们的区别在于处理嵌套dom object出入上,只有<br />             DOMQmouseover,mouseout                     DOM标准才进行处理,enter/leave会忽略,也就是说 <br />                                                         (fromElement!=toElement) && (this.contains(toElement)  触发onmouseover<br />                                                         (fromElement!=toElement) && (this.contains(fromElement) ) 触发onmouseout<br /> q入事g2   IEQevent.fromElement|toElementQ?br />                 event.srcElement<br />             DOMQ?targetQrelatedTarget                 对于mouseoverQfromElement=relatedElement,toElement = srcElement=target;<br />                                                         对于mouseout : toElement=relatedElement,fromElement = srcElement=target; <br /> <br /> 3.2 键盘事g<br /> 字符代码    IEQevent.keyCodeQDOM: 数g?event.keyCode。event.isChar?event.charCode:event.keyCode Q在FF中,keyCode只能获得功能键的数g码,其他的需通过which和charCodeQ在Opera中,则只能通过which<br /> <img src ="http://www.tkk7.com/Ericzhang5231/aggbug/298674.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/Ericzhang5231/" target="_blank">Eric-1001c</a> 2009-10-17 12:56 <a href="http://www.tkk7.com/Ericzhang5231/articles/javascript_differ_event.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>N记的Scrum使用l验http://www.tkk7.com/Ericzhang5231/articles/scrum.htmlEric-1001cEric-1001cWed, 20 Aug 2008 07:56:00 GMThttp://www.tkk7.com/Ericzhang5231/articles/scrum.htmlhttp://www.tkk7.com/Ericzhang5231/comments/223281.htmlhttp://www.tkk7.com/Ericzhang5231/articles/scrum.html#Feedback0http://www.tkk7.com/Ericzhang5231/comments/commentRss/223281.htmlhttp://www.tkk7.com/Ericzhang5231/services/trackbacks/223281.htmlhttp://blackanger.blog.51cto.com/140924/66305

今天和一个在诺基亚工作过的朋友聊ScrumQ诺Z推广Scrum有两q多Q和他交学C很多东西Q给大家分n一下:

Q-Q-Q-Q-Q?br />
一D寒暄之后。。?br />
(19:58:23) i: 诺基亚用Scrum有多长时间了?br /> (19:58:24) he: 是用过.呵呵
(19:59:06) he: 整个公司推行q个大概也有两年的样?br /> (19:59:18) he: 不过具体到我q边大概是一q多
(19:59:21) i: 旉也不短
(19:59:58) i: 那你l我说下那边的情冉|么?D
(20:00:36) he: 其实怎么说呢...NC前的风格都是作坊型的
(20:00:49) he: 每个产品l就是个作?所以风格各?br /> (20:01:01) he: 有的适应Scrum快一?有的有些走?br /> (20:01:16) i: 那你所在的作坊怎么?br /> (20:01:19) i: 呵呵
(20:02:06) he: 不过不管最后是不是有些走样,q是有些好处
(20:02:20) i: 具体程?br /> (20:02:31) he: 其实主要原因是它原来q有一套标准的产品立项, 开? 试,
发布程.
(20:02:41) he: 然而又要把Scrum套C间去
(20:02:55) he: q中间其实就得看执行的团队和个h权衡?br /> (20:02:58) i: q样是好q是不好?br /> (20:03:17) he: 是这?br /> (20:03:56) he: 要的来讲,原来的发布流E是: 可行性研I?-> 立项 -> 开?br /> -> 试 -> 试用 -> 发布
(20:04:26) i: 使用scrum以后是。?br /> (20:05:08) i: 具体程是否严格按Scrum的规则来做的?br /> (20:05:37) he: 那么...xScrum嵌入到开发这个阶D去
(20:06:00) i: ?br /> (20:06:00) he: 对外面来说原来的那套程׃?..
(20:06:08) he: 所以有些地方就被框得很?br /> (20:06:24) i: 比如。?br /> (20:06:39) he: 如果团队只在开发这个周期做一两个q代...那么退化得跟原
来的程差不多了

(20:07:05) i: 我感觉Scrum可以替代q整个流E吧?br /> (20:07:20) he: ?)不过那不是我能改变的
(20:07:43) i: 那你个h认ؓ程该怎么改变才比较好
(20:07:55) i: 拿N以前的这个ؓ例子
(20:08:07) he: 前四个其实都可以
(20:08:24) he: 不过因ؓ刚推行的时候大安对Scrum没有?br /> (20:08:38) he: 上边也不愿意LC西搞得那么激q?br /> (20:09:53) i: 可是我感觉把开发那个环节采用scrum也算是正的吧,因ؓ?br /> 面的可行性研I方面如何去scrum?br /> (20:10:33) he: ?可行性研I的意?br /> (20:10:44) he: 其实是抽两三个最_ֹ的h
(20:10:51) he: l成一个预研的team
(20:11:08) i: en
(20:11:17) he: 然后在给定的旉内把PMq没有把握的功能作出demo来验证一
条\能不能走?br /> (20:11:23) he: 其实是满适合Scrum?br /> (20:11:32) he: 个h觉得:)
(20:11:38) i: 恩,有道?br /> (20:12:05) i: Scrumq个概念到是不仅仅拘泥于开?br /> (20:12:16) he: 然后q些feature的demo׃支持之后的立申?才能拿到
l费
(20:12:42) i: 那现?strong>诺基亚的scrumq是在开发环?/strong>上吗
(20:13:02) he: 是的
(20:13:21) i: 那现在是成功呢Q还是。。?br /> (20:13:26) he: 据我了解多数?br /> (20:13:45) he: ?不管怎么? 它ƈ不像一个原来标准的样子, 作了某些妥协
(20:13:45) i: 对了Q和你分享一本书
(20:13:55) he: 但我觉得q是提高了效率的:)
(20:14:16) he: 虽然,很大E度上取决于团队和个觉程?br /> (20:14:56) i: 你说Q假如让你在一个下团队里去实施ScrumQ你会如何做?br /> (20:15:22) i:
http://www.infoq.com/minibooks/scrum-xp-from-the-trenches
今天在infoq看到q本书?br /> (20:15:41) he: 呵呵, q本我有PDF
(20:16:10) i: 噢。。?br /> (20:16:13) i: hehe
(20:16:26) he: 不过没看?)
(20:16:33) i: 说说你的xQ关于我刚才那个问题
(20:17:41) he: 是这? 我以前带的团队通常都是在预研之后接手的
(20:18:08) he: 所以在q个阶段之前, 主要q是和Product Manager讨论他的需
?br /> (20:18:24) he: 您可以把N记的Product Manager看作一个内部客?br /> (20:18:30) i: 恩,那些backlog要列出来?br /> (20:18:46) he: q不到Backlog那里....
(20:18:53) i: 好,你l,呵呵
(20:19:06) he: Product Manager会提Z他自q角度出发最看重的需?br /> (20:19:26) he: q些需求也许是很简短的表述,像一个带场景的user story
(20:19:33) i: ?br /> (20:19:47) he: 因ؓ他不会很兛_技? 他更多的代表市场
(20:20:58) he: 所以他的需求也许是q样子的:
节点A支持灵zȝ存储讑֤, 自动监测客户l与的存储设备数量ƈ作出按比?br /> xx:xx的空间占?br />
(20:21:21) i: 对,只是个user story
(20:21:31) i: 下一步呢
(20:21:55) he: 或者当用户B的voice传输到节点C?自动监其媒体cdq?br /> 做出质量和编码的变换
(20:22:27) he: q些user story, 我们通常会在他的会议上先C? 整理?br /> 一个list
(20:22:50) he: PM会给Z看重的优先
(20:23:07) i: 客户l出优先U?Q?br /> (20:23:38) he: 对的, 比如? q当于问他: 您最希望在第一个demo day?br /> 看到的是哪一个feature?
(20:23:43) i: 而不是我们分析需求去列出优先U,明白
(20:23:48) he: 或者您最希望推向市场卖的是哪一?br /> (20:23:54) i: ?br /> (20:23:58) he: 是的,它首先是面向feature?br /> (20:24:04) he: 然后...我们不能全都{应
(20:24:27) i: Z?br /> (20:24:44) i: 可以分P代来做吧
(20:24:59) he: 我们需要与做feasibility study的team沟?看看他所提出?br /> 要求是不是都能实?或者能否以可以接受的代价实?/strong>
(20:25:22) i: ?br /> (20:25:48) i: 怎么又回到第一环节?br /> (20:25:59) he: 如果不能实现, 我们可以q一步跟他确? 您看, 你所说的
feature是A, 但是我们觉得您更需要的可能是A+
(20:26:28) he: 或? 您看, 在给出的开发周期内A不能全都实现, 是否可以?br /> 实现A- ...
(20:26:58) he: 或者当前的q_对于实现A有所限制, 我们可以l您提供两个?br /> ? A1 或者A2
(20:27:11) he: 有的时候他或者她都会咆哮...
(20:27:13) i: 恩,应该是增量式开发,一步步完成客户的需?br /> (20:27:28) i: 呵呵
(20:27:30) he: 或者我们双斚w在咆?..
(20:28:17) he: 那么也许最后达成的l果可能会是我们需要在W一个demo中作
出a, 然后同时{待另外一个team的组件b的效? 如果不行,那么backup可能?br /> c...
(20:28:57) he: q个妥协后的l果通常被称为product feature backlog
(20:29:24) he: 它对于技术细节关注很?主要x最后能完成的feature
(20:29:34) i: ?br /> (20:30:02) i: q个时候到sprint计划会议来细分这些backlog了吧
(20:30:06) he: 客户在交货或者中间确认进度的时候看的通常都是feature
backlog
(20:30:45) he: 是的, 通常之后每个feature team都会召集h开?br /> (20:30:55) he: 也就是Scrum team
(20:31:08) he: 每个feature都分解ؓ技术上实现的步?/strong>
(20:31:32) i: 然后l分出来交给团队?br /> (20:31:35) he: Scrum Master 会将q些步骤作ؓ一个个TASKU录
(20:31:45) he: 不是l分出来交给团队...
(20:32:01) he: q个时候每个团队都参与q来看自q那部分feature backlog
?br />
(20:33:05) i: Scrum Master 记录那些task做什么?br /> (20:33:07) he: 成员王小花可能会?..我觉着?要实现feature A 可能我们
需要先在后D存储s上实C个抽象层InfA
(20:33:22) he: 它需要routine A1 A2 A3来做
(20:33:31) he: 王二d可能反对...
(20:33:46) i: 呵呵?br /> (20:33:59) he: 说我觉着我们只需要服用组件B和组件C提供的服务接口InfB1?br /> InfC2...
(20:34:20) he: 然后l一个带路由表的配置文g...
(20:34:30) i: 那这个会议最l目标是要干什么,或者说要得C么结?br /> (20:34:53) he: 最后的q些task, ׃形成一个周期内的sprint backlog
(20:35:13) he: 能力好的团? 所能细分出来的task精?br /> (20:35:19) i: 噢,是指定backlog的过E?br /> (20:35:27) he: 通常_度控制?0h
(20:36:28) i: 如果需求有变的情况如何处理
(20:37:02) i: 在P代的时?br /> (20:37:14) he: ?..我记得上ơ某大师来讲座的时候我们也问过
(20:37:35) i: 呵呵Q怎么回答?br /> (20:37:45) he: 他的{案是标准做法是l箋把sprint做完,然后在接下来的一?br /> sprint中完成变?br /> (20:38:11) i: 明白了。。?br /> (20:38:37) i: 那P代期间你们有每日例会?br /> (20:39:02) he: 是的, daily meeting
(20:39:25) i: 对了Q你们是不是也这样处理需求的变化Q放在下个sprint?br /> (20:39:47) he: 不是
(20:39:53) he: 我们的sprint 周期长达一个月..
(20:40:10) i: Scrum里规则是一个月。。?br /> (20:40:17) i: 那。。?br /> (20:40:19) he: 所以通常我们有drop一个旧的和add一个新?/strong>
(20:40:42) he: 除了通常比较化的Not Started. On Going和Done 三个状?br /> 之外
(20:40:56) he: 我们有Dropped和Added
(20:42:07) i: 噢,q样处理也很U学
(20:42:46) he: 呵呵:)因ؓ有时候一个月q是太长
(20:43:00) he: 因ؓ对于两地或者三C间的协同开?br /> (20:43:06) he: 一个月可以发生的事情太多了
(20:43:23) he: 其是这几个地方都有时差的时?br /> (20:43:47) i: 不过q代没有完成的话Q也许客户不清楚自己需求的变更是好
是坏Q大师那么说也有道理吧。P代完成,让客L了以后他再看是否变化需求?br /> (20:44:02) i: 我说的有没有可能 Q?br /> (20:44:30) he: 是的:)
(20:45:06) he: 但是有时候需求确实很?..
(20:45:09) i: 具体应用具体处理吧,L有了处理的办法?br /> (20:45:13) i: ?br /> (20:45:19) he: 比如H然拿某Ud的单
(20:45:27) he: 而该客户以需求怪异著称
(20:45:34) i: 呵呵
(20:45:38) he: q种情况不一定非得等C一?/strong>...
(20:45:45) i: 实
(20:45:55) i: 拥抱变化
(20:46:29) he: 其实我觉得很依赖团队成员?br /> (20:46:36) he: 如果团队成员很不U极
(20:46:36) i: Scrum的规则也应该是符合实际情늚l验性方法才能发挥能
量?br /> (20:46:47) i: 个h敏捷?br /> (20:46:55) he: 那么sprint planning׃L沉沉变成d指派...
(20:47:09) i: Scrum里面说自我管?br /> (20:47:31) i: 如何调动成员的积极性来更好的团队自我管?br /> (20:49:18) he: 其实原来我带的team比较实际一?...
(20:49:23) he: 每个sprint都有demo...
(20:49:29) i: 那天在infoq上看了一文章,关于q个问题Q是说团队成员的
Mh精不?br /> (20:49:38) i: 恩,你l?br /> (20:49:53) he: 大家通常都很期望demo day那天PM发话? ?对的,我就是想
要这?br /> (20:50:10) he: 如此以来...整个teamp甌预算出去大吃大喝?br /> (20:50:20) he: 因ؓ整个team都比较好?..
(20:50:23) i: 呵呵
(20:50:29) he: 成都好吃的地方很?也不很贵
(20:50:39) i: 好吃不懒?br /> (20:50:58) he: ?ȝ来说,是得有promotion:)
(20:51:05) he: 我个?br /> (20:51:29) i: 一些物质激?br /> (20:52:10) he: ?.其实也不限于q个...物质
(20:52:28) he: 您说:)
(20:53:06) i: 比如一起出Lq_放松个一两天
(20:53:19) he: ?br /> (20:54:10) i: 对了Q你们用看板没有
(20:54:39) i: 是有专门的系l还是手工看?br /> (20:55:38) he: ??strong>一间屋专门换了ȝ板的
...
(20:55:50) i: 常用?br /> (20:55:53) he: 四面墙可以ؕ涂ؕ?/strong>....
(20:56:03) he: ?l常:P
(20:56:08) i: 呵呵
(20:56:21) i: 我们q方面做的不太够
(20:56:25) he: 针对team里年Mh表现Ʋ都比较强的特点
(20:56:31) he: 我们划出一面墙?br /> (20:56:40) he: 当月sprint完成的最好的q轻?br /> (20:56:46) he: 有权占有那面?/strong>...
(20:56:53) i: 呵呵
(20:57:02) he: 只要不写的太反动...随便他怎么规划
(20:57:04) i: 涂鸦?br /> (20:57:08) he: ?差不?br /> (20:57:25) he: 对羞涩性队员的效果可能差一?br /> (20:57:33) i: 挺有意?br /> (20:57:54) he: :)
。。?br /> end


Eric-1001c 2008-08-20 15:56 发表评论
]]>
利用回调实现Spring+Hibernate中的扚w删除http://www.tkk7.com/Ericzhang5231/articles/220158.htmlEric-1001cEric-1001cTue, 05 Aug 2008 06:41:00 GMThttp://www.tkk7.com/Ericzhang5231/articles/220158.htmlhttp://www.tkk7.com/Ericzhang5231/comments/220158.htmlhttp://www.tkk7.com/Ericzhang5231/articles/220158.html#Feedback0http://www.tkk7.com/Ericzhang5231/comments/commentRss/220158.htmlhttp://www.tkk7.com/Ericzhang5231/services/trackbacks/220158.html 利用hibernate提供的回调机Ӟ可以实现扚w删除Q具体方法是Q?br />
 1getHibernateTemplate().execute(new HibernateCallback(){
 2   public Object doInHibernate(Session session) throws HibernateException, SQLException {
 3    List result = new ArrayList();
 4    String hql = "delete Object";
 5    Query query = session.createQuery(hql);
 6    result.add(new Integer(query.executeUpdate()));
 7    return result;
 8   }

 9   
10  }
);

q种做法hibernate只会生成一条sqlQ效率相对较高。但是利用回调机Ӟ管能删除数据库的数据,而一U缓存中的数据ƈ没有删掉Q因此在使用的时候要格外心

Eric-1001c 2008-08-05 14:41 发表评论
]]>
LDAP:error code 一览表 http://www.tkk7.com/Ericzhang5231/articles/213279.htmlEric-1001cEric-1001cTue, 08 Jul 2008 03:27:00 GMThttp://www.tkk7.com/Ericzhang5231/articles/213279.htmlhttp://www.tkk7.com/Ericzhang5231/comments/213279.htmlhttp://www.tkk7.com/Ericzhang5231/articles/213279.html#Feedback0http://www.tkk7.com/Ericzhang5231/comments/commentRss/213279.htmlhttp://www.tkk7.com/Ericzhang5231/services/trackbacks/213279.html0 LDAP_SUCCESS Success
1 LDAP_OPERATIONS_ERROR Operations error
2 LDAP_PROTOCOL_ERROR Protocol error
3 LDAP_TIMELIMIT_EXCEEDED Timelimit exceeded
4 LDAP_SIZELIMIT_EXCEEDED Sizelimit exceeded
5 LDAP_COMPARE_FALSE Compare false
6 LDAP_COMPARE_TRUE Compare true
7 LDAP_STRONG_AUTH_NOT_SUPPORTED Strong authentication not supported
8 LDAP_STRONG_AUTH_REQUIRED Strong authentication required
9 LDAP_PARTIAL_RESULTS Partial results
10 LDAP referral error and is a good indication that the LDAP server is set up to use referrals. However, WebSphere Portal does not support LDAPs with referrals.
(solution: 1. The LDAP administrator can disable referrals and ensure that your wpconfig.properties file has the correct LDAP settings listed. 2. Use a different LDAP server that does not have or require referrals.)
16 LDAP_NO_SUCH_ATTRIBUTE No such attribute
17 LDAP_UNDEFINED_TYPE Undefined attribute type
18 LDAP_INAPPROPRIATE_MATCHING Inappropriate matching
19 LDAP_CONSTRAINT_VIOLATION Constraint violation
20 LDAP_TYPE_OR_VALUE_EXISTS Type or value exists
21 LDAP_INVALID_SYNTAX Invalid syntax
32 LDAP_NO_SUCH_OBJECT No such object
33 LDAP_ALIAS_PROBLEM Alias problem
34 LDAP_INVALID_DN_SYNTAX Invalid DN syntax
35 LDAP_IS_LEAF Object is a leaf
36 LDAP_ALIAS_DEREF_PROBLEM Alias dereferencing problem
48 LDAP_INAPPROPRIATE_AUTH Inappropriate authentication
49 LDAP_INVALID_CREDENTIALS Invalid credentials
50 LDAP_INSUFFICIENT_ACCESS Insufficient access
51 LDAP_BUSY DSA is busy
52 LDAP_UNAVAILABLE DSA is unavailable
53 LDAP_UNWILLING_TO_PERFORM DSA is unwilling to perform
54 LDAP_LOOP_DETECT Loop detected
64 LDAP_NAMING_VIOLATION Naming violation
65 LDAP_OBJECT_CLASS_VIOLATION Object class violation
66 LDAP_NOT_ALLOWED_ON_NONLEAF Operation not allowed on nonleaf
67 LDAP_NOT_ALLOWED_ON_RDN Operation not allowed on RDN
68 LDAP_ALREADY_EXISTS Already exists
69 LDAP_NO_OBJECT_CLASS_MODS Cannot modify object class
70 LDAP_RESULTS_TOO_LARGE Results too large
80 LDAP_OTHER Unknown error
81 LDAP_SERVER_DOWN Can't contact LDAP server
82 LDAP_LOCAL_ERROR Local error
83 LDAP_ENCODING_ERROR Encoding error
84 LDAP_DECODING_ERROR Decoding error
85 LDAP_TIMEOUT Timed out
86 LDAP_AUTH_UNKNOWN Unknown authentication method
87 LDAP_FILTER_ERROR Bad search filter
88 LDAP_USER_CANCELLED User cancelled operation
89 LDAP_PARAM_ERROR Bad parameter to an ldap routine
90 LDAP_NO_MEMORY Out of memory

Eric-1001c 2008-07-08 11:27 发表评论
]]>
Chapter 7 Defining Portals and Pageshttp://www.tkk7.com/Ericzhang5231/articles/212742.htmlEric-1001cEric-1001cSat, 05 Jul 2008 08:06:00 GMThttp://www.tkk7.com/Ericzhang5231/articles/212742.htmlhttp://www.tkk7.com/Ericzhang5231/comments/212742.htmlhttp://www.tkk7.com/Ericzhang5231/articles/212742.html#Feedback0http://www.tkk7.com/Ericzhang5231/comments/commentRss/212742.htmlhttp://www.tkk7.com/Ericzhang5231/services/trackbacks/212742.html

7.1 Logical Structure of a Portal

The portal uses a tree like hierarchical structure, where the root o tree is called Content Root. Nodes in this hierarchy belong to one of the following types:

Pages

Labels,

URLs,

Pages: the basic building block used for displaying content in the form of portlets. Page nodes may contain other nodes, including other pages.

Labels: a placeholder for pages. Labels may contain other nodes, but display no content, and are used to provide logical grouping of nodes which are used to define common attributes such as access permissions.

URLs: used to access any resource that can be addressed with a URL. URLs obviously do not contain any other nodes. URLs are useful for addressing external Web sites or another part of the portal.

7.2 Browsing through the Content Hierarchy

7.2.1 The Manage Pages window allows you to browse through the content hierarchy. On the right-hand side of the current node name are some buttons:

Editing page properties

Editing page layout (only for page nodes)

Controlling access permissions

Deleting the node

7.2.2 Page Inheritance with Shared Pages

When content of a new page is based on another page, the new page is essentially the aggregation of the existing page with a new specialized layer on top of latter. This implies that a prerequisite for accessing a page using a shared page is that both the page and the shared page must be accessible by the user. Shared pages essentially implement a form of inheritance. A page based on a shared page inherits the layout and content of latter.

An important characteristic of share pages is that any changes made to the share page are reflected on all the pages referencing it. A shared page can reference another shared page, thus creating a chain of page references.

7.2.3 Advanced Layout Editing

WebSphere Portal allows six different page basic layouts. Click the Configure button in top-right corner of the window, we can check the box reading Show Toggle Link for Show Layout Tools/Hide Layout Tools. Once do this, the six layout patterns are no longer visible and you may customize your layout by adding as many container as you want. For each column container you may set its width, as well as add row containers within it.

7.2.4 Locks

The Locks tab allows the administrator to limit the flexibility of a user in editing the page layout and content. Locking the container prevents users from removing this container from a page, whereas locking the container content prevents users from adding or removing portlets and sub containers from the container. Lock are applicable to shared pages, and allow top-level administrators in cascading portals to define content that is mandatory in a page. Of course, you can un-lock containers.



Eric-1001c 2008-07-05 16:06 发表评论
]]>
Chapter 1 Introducehttp://www.tkk7.com/Ericzhang5231/articles/websphereportal.htmlEric-1001cEric-1001cSat, 05 Jul 2008 08:04:00 GMThttp://www.tkk7.com/Ericzhang5231/articles/websphereportal.htmlhttp://www.tkk7.com/Ericzhang5231/comments/212741.htmlhttp://www.tkk7.com/Ericzhang5231/articles/websphereportal.html#Feedback0http://www.tkk7.com/Ericzhang5231/comments/commentRss/212741.htmlhttp://www.tkk7.com/Ericzhang5231/services/trackbacks/212741.htmlChapter 1 Introduce

1.1 Why do we need portal

As Internet dev, business required to integrate various sites into one to supply more comfortable service. However, this generated a smorgasbord look and feel. Security soon became an issue and each site then required authentication, which mean user would endure the frustrating experiencing of logins on a single site with difference name and password. And now many different devices with different attributes such as desktops, mobile phones, and palm pilots are needed to access into business sys.

Portals help today's business address the Internet challenges. It helps programmers focus on developing the business functionality by letting the portal manage the look and feel, personalization, content management, and security. It allows users to integrate different applications from disparate locations and enables them to seamlessly exchange information. Each user can create a personalized device-independent "desktop" with a consistent look and feel by suing drag and drop components.

1.2 IBM WebSphere Family

IBM WebSphere is made up of three components: foundation and tools, reach and user experience or business portals, and business integration.

1.3 What is WebSphere Portal?

1.3.1 The User Experience

Each user can create his or her own portal pages and customize the content and look and feel of these pages. They can add functionality to their pages through portlets, which are portal app. Based on their permissions, users can choose for each page or set of pages their own themes, skins, and layout.

Themes: define the fonts, colors, spacing, and other look-and-feel components of the page.

Skins: comprise title bars, borders, shadows, etc. that surround the portlets.

1.3.1.1 Content Management

WP provides the user the ability to syndicate content or to get up-to-date personalized and filtered content and services from multiple subscriber source such as Financial Times and others. Also support RSS format. IBM Lotus Workpalce Web Content Management (ILWWCM) provides Web Content Management system. ILWWCM is designed for organizations with user that publish content to a web site, whether it is marketing updating product information or human resources updating information on benefits. Content can be published through templates or forms and consists of images, word doc, excel, html and so forth.

1.3.1.2 Document management

WebSphere Portal Document Manager (PDM) provides user the ability to view, add, edit, and delete documents within a common folder hierarchy that can be user-defined. Documents can be made available immediately or to go through an approval process using a defined workflow model.

1.3.1.3 Search

Use of the search capabilities is made through the search portlet, the WP crawler, or the document indexer. Enhanced search is also provided through IBM Lotus Extended Search and DV2 Information Integrator.

1.3.1.4 Collaboration

WebSphere Portal provides complete support for collaboration through the Notes, Domino, and Domino Web Access portlets. These portlets provide access to collaboration app that use Lotus Notes databases on Domino servers such as Mail, Calendar, To Do, Notes View, TeamRoom, and Discussion. Additional portlets are available that integrate Domino.doc, Discovery Server, QuickPlace, and Sametime.

WP offers Collaboration Center, which is a framework that integrates People Finder, the Web Conference Center, QuickPlace, and Sametime.

1.3.1.5 Personalization

  1. Creating a user profile by collecting user information and classifying it into segments;
  2. Creating models for the content that defines it by its attributes. For instance, a content model might contain product name, price, and age segment;
  3. Matching the user segment to the content on the basis of any combination of filtering, rules, or recommendation engine.

The personalization rules are referenced in the portlets. They are created using web-based tools. Another method provided to match site visitors with content is through the recommendation engine. The recommendation engine uses statistical techniques to identify groups of users with similar interests. WebSphere Portal also provides campaign management tools, which enable a business goal to be reached by defining and executing a set of business rules.

1.3.1.6 Performance

WebSphere Portal creates logs that feed into the IBM Tivoli Web Site Analyzer. The Web Site analyzer will analyze the data and report metric in both graphic and text formats so that you can determine the effectiveness of you web site and focus on areas to improve it.

1.3.2 The Developer Experience

1.3.2.1 Portlets communication

  1. Sending information through a portlet action and a portlet message. (Simply speaking, one portlet create a portlet action and encode it into the URL that is used for displaying another portlet. Upon clicking the URL, an action listener is called and then a portlet message is sent to another portlet with the needed parameters)
  2. WP provides cooperative portlets, which can be "Click-2-Action" or "wired", to pass messages independently. Portlet express their desire to interact with a broker who at runtime matches data types between the source of one portlet with the action of another portlet. If a match occurs with a "Click-2-Action portlet", a pop-up menu appears on the page that will enable the user to transfer the data to the connected portlet. If the portlet is wired by an administrator, then the data will be exchanged automatically as opposed to having to wait for the user to click the pop-up menu.

1.3.2.2 Through the portlet API, WebSphere Portal provides programmers the ability to

           dynamically discover available services.

1.3.2.3 WP server supports the JAAS architecture

1.3.2.4 WP provides developers with support for Web Service for Remote Portlets

(WSRP)

1.3.2.5 WebSphere Portal Application Integrator (WPAI) support ability to access

          Enterprise Application Systems such as SAP, PeopleSoft, Siebel

1.3.2.2 The Administrator Experience

WebSphere Portal enables an administrator to have complete dynamic control over user access right for every portal resource including portlets, pages, and user groups. The permission are defined by the user role. WP has defined roles (Administrator, Security Administrator, Delegator, Manager, Editor, Privileged User, and User).

If a role is assigned to a page, group, or folder, then resource below the parent inherit the permissions unless they are specifically blocked. A user can also delegate his or her role to other users.

WebSphere Portal Member Services provides administration services through portlets for creating, updating, and deleting portal user and for managing their access rights. These services are provided at both the user and group levels. Users can be members of one or more groups and groups can be members of other groups.

User profile information can be supported in an LDAP and/or a database.

WebSphere Portal support form-based authentication (HTML user prompted form) through WAS or a third-party authentication server such as Tivoli Access Manager or Netegrity Siteminder.

1.3.3 WebSphere Portal Architecture



Eric-1001c 2008-07-05 16:04 发表评论
]]>
Recommand a websitehttp://www.tkk7.com/Ericzhang5231/articles/210776.htmlEric-1001cEric-1001cThu, 26 Jun 2008 03:32:00 GMThttp://www.tkk7.com/Ericzhang5231/articles/210776.htmlhttp://www.tkk7.com/Ericzhang5231/comments/210776.htmlhttp://www.tkk7.com/Ericzhang5231/articles/210776.html#Feedback0http://www.tkk7.com/Ericzhang5231/comments/commentRss/210776.htmlhttp://www.tkk7.com/Ericzhang5231/services/trackbacks/210776.html影像 http://parandroid.com/

Eric-1001c 2008-06-26 11:32 发表评论
]]>
վ֩ģ壺 AVô뾫Ʒ| www.ɫͼ| պAvĻþþ޸| þþƷŮav鶹| þþƷav鶹ͼƬ| ձĻ| ֻëƬѲ| ɫ߳Ƶ| ɫƵվ| ѹۿɫƵվbd| ޾ƷƵ߹ۿ| 69Ƶѹۿl| 69avѹۿ| ѻɫַ| ӰԺֻ߹ۿ| պAVһl| պ߹ۿƵ| AVպƷþþþ| ˳߲վ| ƷƬ| AVŮһ| ŮƵ| ˾Ʒձר| avһ| ޹ƷԲĵӰ| þþƷ77777| 91Ʒ鶹ϵ| ɫͼС˵ר| ҹƵ| ޳߹ۿ| ޹պa߲| 㽶Ƶ߹ۿ| ˹ƷƵ| 99ƷƵƵѹۿ| ɫaѿ| ޿ѿ| WWWƵ| 2018ĻƵ| ߾ƷƵ| ޹˾þۺ| AVһȾþ |