探索与发现

研究java技术

  BlogJava :: 首页 :: 新随笔 :: 联系 :: 聚合  :: 管理 ::
  83 随笔 :: 0 文章 :: 109 评论 :: 0 Trackbacks

2006年5月23日 #


css 样式
.productshow{width:100%}
.productshow .text{list-style-type:none; margin:0; padding:0}
.productshow .text li{line-height:25px; background:url(../t_line.gif) repeat-x bottom}
.productshow .text li A {background:url(../icons/dot1.gif) no-repeat; background-position:0 3px; padding-left:13px}
.productshow .text A:link {color: #000; text-decoration: none}
.productshow .text A:visited {color:#000; text-decoration: none}
.productshow .text A:active {color: #000; text-decoration: none}
.productshow .text A:hover {color: #B00000; text-decoration: underline}
.productshow .pic{list-style-type:none; margin:0; padding:0}
.productshow .pic li{float:left; width:120px}
.productshow .pic li p{text-align:center; line-height:160%; word-break:break-all; width:120px; overflow:auto; }
.productshow .pic li .picture{margin:0 auto; text-align:Center; width:110px; height:110px}
.productshow .pic li .picture IMG{MARGIN-TOP: expression(( 110 - this.height ) / 2); width: expression(this.width > 110 ? 110 : true); height: expression(this.height > 110 ? 110 : true); max-width: 110px; max-height: 110px; VERTICAL-ALIGN: middle; TEXT-ALIGN: center}
.productshow .pic li .sprice{text-align:center;color:#999;text-decoration:line-through}
.productshow .pic li .proname{margin:0 auto; text-align:center; line-height:160%; height:40px; word-break:break-all; width:120px; overflow:hidden}
.productshow .pic li .price{text-align:center;color:#ff0000}
.productshow .pic li .buylist{line-height:25px; text-align:center;color:#6DAADA; display:none}
.productshow .pic .list-line{width:157px}
.productshow .pic .list-line .picture-s{float:left; margin:0 auto; text-align:Center; width:50px; height:50px}
.productshow .pic .list-line .picture-s IMG{MARGIN-TOP: expression(( 45 - this.height ) / 2); width: expression(this.width > 45 ? 45 : true); height: expression(this.height > 45 ? 45 : true); max-width: 45px; max-height: 45px; VERTICAL-ALIGN: middle; TEXT-ALIGN: center}
.productshow .pic .list-line .picinfo{float:left; padding-left:12px; width:95px}
.productshow .pic li A:link {color: #000; text-decoration: none}
.productshow .pic li A:visited {color:#000; text-decoration: none}
.productshow .pic li A:active {color: #000; text-decoration: none}
.productshow .pic li A:hover {color: #B00000; text-decoration: underline}



主体代码

<table width="609" style="border:1px solid #FF8119" cellspacing="0" cellpadding="0">
              <tbody><tr>
                <td background="shop/skins/56770_com_b_002/center_bg.gif"><div class="productshow">
<ul class="pic">
<form action="#" method="post" name="LEBI_FORMBUY_0001" id="LEBI_FORMBUY_0001"><li>
 <div class="picture"><a href="shop/product/default.asp?id=16" class="picborder" target="_self"><img border="0" src="shop/Pic/201009/1211144612000.jpg" {@onmouse}="" alt="2010男装 秋装商"></a></div>
 <div class="proname"><a href="shop/product/default.asp?id=16" title="2010男装 秋装商" target="_self">2010男装 秋装商</a></div>
         <p><span class="sprice">市场价:¥100.00</span></p>
 <p><span class="price">购买价:¥90.00</span></p>
 <p class="buylist">购买数量 <input type="text" name="pro_num_0001_16" id="pro_num_0001_16" value="1" size="3" style="width:30px;" class="form"><input type="hidden" name="pro_size_0001_16" id="pro_size_0001_16" value="-"><input type="hidden" name="pro_color_0001_16" id="pro_color_0001_16" value="-"><br><input type="button" name="button_0001_16" value="购买" onclick="javascript:addtobasket('16','0001','','1')" class="button">&nbsp;<input type="button" name="fav" value="收藏" onclick="location.href='shop/user/?action=shoucang_add&amp;id=16&amp;product_name=2010%E7%94%B7%E8%A3%85+%E7%A7%8B%E8%A3%85%E5%95%86&amp;backurl=http%3A%2F%2Flocalhost%3A80%2Fshop%2Fdefault%2Easp&amp;product_type='" class="button">
</p>
</li><li>
 <div class="picture"><a href="shop/product/default.asp?id=15" class="picborder" target="_self"><img border="0" src="shop/Pic/201009/1211103327386.jpg" {@onmouse}="" alt="2010男装 秋装商"></a></div>
 <div class="proname"><a href="shop/product/default.asp?id=15" title="2010男装 秋装商" target="_self">2010男装 秋装商</a></div>
         <p><span class="sprice">市场价:¥120.00</span></p>
 <p><span class="price">购买价:¥120.00</span></p>
 <p class="buylist">购买数量 <input type="text" name="pro_num_0001_15" id="pro_num_0001_15" value="1" size="3" style="width:30px;" class="form"><input type="hidden" name="pro_size_0001_15" id="pro_size_0001_15" value="-"><input type="hidden" name="pro_color_0001_15" id="pro_color_0001_15" value="-"><br><input type="button" name="button_0001_15" value="购买" onclick="javascript:addtobasket('15','0001','','1')" class="button">&nbsp;<input type="button" name="fav" value="收藏" onclick="location.href='shop/user/?action=shoucang_add&amp;id=15&amp;product_name=2010%E7%94%B7%E8%A3%85+%E7%A7%8B%E8%A3%85%E5%95%86&amp;backurl=http%3A%2F%2Flocalhost%3A80%2Fshop%2Fdefault%2Easp&amp;product_type='" class="button">
</p>
</li><li>
 <div class="picture"><a href="shop/product/default.asp?id=14" class="picborder" target="_self"><img border="0" src="shop/Pic/201009/121181193516.jpg" {@onmouse}="" alt="2010男装 秋装商"></a></div>
 <div class="proname"><a href="shop/product/default.asp?id=14" title="2010男装 秋装商" target="_self">2010男装 秋装商</a></div>
         <p><span class="sprice">市场价:¥100.00</span></p>
 <p><span class="price">购买价:¥100.00</span></p>
 <p class="buylist">购买数量 <input type="text" name="pro_num_0001_14" id="pro_num_0001_14" value="1" size="3" style="width:30px;" class="form"><input type="hidden" name="pro_size_0001_14" id="pro_size_0001_14" value="-"><input type="hidden" name="pro_color_0001_14" id="pro_color_0001_14" value="-"><br><input type="button" name="button_0001_14" value="购买" onclick="javascript:addtobasket('14','0001','','1')" class="button">&nbsp;<input type="button" name="fav" value="收藏" onclick="location.href='shop/user/?action=shoucang_add&amp;id=14&amp;product_name=2010%E7%94%B7%E8%A3%85+%E7%A7%8B%E8%A3%85%E5%95%86&amp;backurl=http%3A%2F%2Flocalhost%3A80%2Fshop%2Fdefault%2Easp&amp;product_type='" class="button">
</p>
</li><li>
 <div class="picture"><a href="shop/product/default.asp?id=11" class="picborder" target="_self"><img border="0" src="shop/Pic/201009/121101451977.jpg" {@onmouse}="" alt="2010品牌男衬衣"></a></div>
 <div class="proname"><a href="shop/product/default.asp?id=11" title="2010品牌男衬衣" target="_self">2010品牌男衬衣</a></div>
         <p><span class="sprice">市场价:¥100.00</span></p>
 <p><span class="price">购买价:¥100.00</span></p>
 <p class="buylist">购买数量 <input type="text" name="pro_num_0001_11" id="pro_num_0001_11" value="1" size="3" style="width:30px;" class="form"><input type="hidden" name="pro_size_0001_11" id="pro_size_0001_11" value="-"><input type="hidden" name="pro_color_0001_11" id="pro_color_0001_11" value="-"><br><input type="button" name="button_0001_11" value="购买" onclick="javascript:addtobasket('11','0001','','1')" class="button">&nbsp;<input type="button" name="fav" value="收藏" onclick="location.href='shop/user/?action=shoucang_add&amp;id=11&amp;product_name=2010%E5%93%81%E7%89%8C%E7%94%B7%E8%A1%AC%E8%A1%A3&amp;backurl=http%3A%2F%2Flocalhost%3A80%2Fshop%2Fdefault%2Easp&amp;product_type='" class="button">
</p>
</li><li>
 <div class="picture"><a href="shop/product/default.asp?id=9" class="picborder" target="_self"><img border="0" src="shop/Pic/201009/121053257865.jpg" {@onmouse}="" alt="2010年秋冬新款特"></a></div>
 <div class="proname"><a href="shop/product/default.asp?id=9" title="2010年秋冬新款特" target="_self">2010年秋冬新款特</a></div>
         <p><span class="sprice">市场价:¥100.00</span></p>
 <p><span class="price">购买价:¥100.00</span></p>
 <p class="buylist">购买数量 <input type="text" name="pro_num_0001_9" id="pro_num_0001_9" value="1" size="3" style="width:30px;" class="form"><input type="hidden" name="pro_size_0001_9" id="pro_size_0001_9" value="-"><input type="hidden" name="pro_color_0001_9" id="pro_color_0001_9" value="-"><br><input type="button" name="button_0001_9" value="购买" onclick="javascript:addtobasket('9','0001','','1')" class="button">&nbsp;<input type="button" name="fav" value="收藏" onclick="location.href='shop/user/?action=shoucang_add&amp;id=9&amp;product_name=2010%E5%B9%B4%E7%A7%8B%E5%86%AC%E6%96%B0%E6%AC%BE%E7%89%B9&amp;backurl=http%3A%2F%2Flocalhost%3A80%2Fshop%2Fdefault%2Easp&amp;product_type='" class="button">
</p>
</li></form></ul>

<div class="both"></div></div></td>
              </tr>
              <tr>
                <td><img src="shop/skins/56770_com_b_002/center_bottom.gif" width="609" height="10"></td>
              </tr>
            </tbody></table> 
           

posted @ 2010-09-15 22:55 蜘蛛 阅读(297) | 评论 (0)编辑 收藏

为测试 Flex 应用程序设置测试环境

正确的用于测试 Flex 应用程序的环境设置将有助于确保可靠的功能测试结果。测试环境一般由测试人员在测试计算机上进行设置。

关于此任务

要设置测试环境:

过程

  1. 检查浏览器的设置:
    1. Internet Explorer:
      1. 打开 Internet Explorer。
      2. 单击工具 > 互联网选项
      3. 单击安全性选项卡。
      4. 选择适当的 Web 内容区域。执行下列某个步骤:
        • 如果在远程机器上配置了 Web 服务器,那么请完成下列步骤:
          1. 选择本地内部网
          2. 单击站点 > 高级
          3. 将此 Web 站点添加到区域字段中,输入要添加到 Web 站点的 URL。
          4. 单击添加,然后单击确定
        • 如果在本地主机上配置了 Web 服务器,那么请完成下列步骤:
          1. 选择本地内部网
          2. 单击定制级别
          3. 复位至列表中,选择中低
          4. 在“设置”窗格中,针对初始化且脚本 ActiveX 控件不标记为安全一项单击启用
          5. 单击确定
    2. Firefox:
      1. 单击工具 > 选项 > 内容
      2. 清除阻止弹出窗口复选框。
      3. 单击工具 > 选项 > 安全
      4. 清除当有站点试图安装插件时发出警告复选框。
  2. 打开 IBM Rational Functional Tester,然后单击配置 > 启用测试环境。必须启用所需要的 JRE 并将 Internet Explorer 设置为缺省 Web 浏览器。
  3. 在“Web 浏览器”页面中启用所需要的浏览器。
  4. 将测试下应用程序设置为可信以在本地运行应用程序。指向单个文件或目录的路径处于可信状态,同时所有的文件将会分配到每个选定的目录及其可信的子目录中。按照下列步骤来分配信任目标:
    1. 在 C:\WINDOWS\system32\Macromed\Flash 中创建文件夹 FlashPlayerTrust。
    2. 在 FlashPlayerTrust 文件夹中创建一个名为 Flex 且不带扩展名的文件。
    3. 在 Flex 文件中输入 Flex 应用程序的目录路径。例如,如果 Flex 应用程序位于 C:\Test 目录中,请在 Flex 文件中输入路径 C:\Test
    4. 保存文件。
posted @ 2010-07-27 06:00 蜘蛛 阅读(240) | 评论 (0)编辑 收藏

http://unitedmindset.com/jonbcampos/2009/08/12/flex-best-practices-events/
posted @ 2009-09-18 06:53 蜘蛛 阅读(404) | 评论 (2)编辑 收藏

http://www.davidtucker.net/category/cairngorm/
posted @ 2009-09-15 20:36 蜘蛛 阅读(192) | 评论 (0)编辑 收藏

1.可以使用PopUpManager进行界面切换
2.使用状态(state),自定义一些状态事件(StateEvent),在index.mxml(mx:application)中监听组件派发的状态事件类型,利用改变状态来改变显示的界面.


⑴用第一种方式来实现相对简单,利用PopUpManager的一些静态方法即可实现,比较适用于一些size相对较小的可视化组件,比如:登陆表单组件,或修改一个值,要求重新输入一个新值等等类似情况.实现示例代码如下:

Js代码
  1. <span style="font-size: small;">var win:*;   
  2. win = new loginPanel();   
  3. //弹出显示登录框   
  4. PopUpManager.addPopUp(win,this,true);   
  5. //登陆框显示在中间   
  6. PopUpManager.centerPopUp(win); </span>  

 ⑵在第二种方法中利用state来改变显示的界面则要相对复杂许多.

①首先我们需要自定义统一的状态事件名称

Java代码
  1. <span style="font-size: small;">package note.events{  
  2. /** 
  3.  * 状态事件,每个状态值要和状态名称一样 
  4.  * @author halzhang 
  5. */  
  6. public class StateEvent{  
  7.           public static const NULL_STATE:String = "";  
  8.           public static const LOGIN_STATE:String = "loginState";  
  9.           public static const ADDNOTE_STATE:String = "addNoteState";  
  10.           public static const ADDUSER_STATE:String = "addUserState";  
  11.           public static const LISTALLUSER_STATE:String = "listAllUserState";  
  12.          }  
  13. }</span>  

 ②在Flex项目的主程序中定义state,当然也可以加上状态切换的动画.

Html代码
  1. <span style="font-size: small;"><!-- 定义状态,我们分别定义了三个状态,每个状态对应一个自定义的可视化组件  -->  
  2.     <mx:states>  
  3.         <mx:State name="loginState">  
  4.             <mx:AddChild position="lastChild">  
  5.                 <!-- 状态对应的自定义组件:登陆组件 -->  
  6.                 <view:loginPanel id="panel_login" x="195" y="89"/>  
  7.             </mx:AddChild>  
  8.         </mx:State>  
  9.           
  10.         <mx:State name="addNoteState">  
  11.             <mx:AddChild position="lastChild">  
  12.                 <!-- 状态对应的自定义组件:添加留言组件 -->  
  13.                 <view:addNotePanel id="panel_addNote" x="10" y="44"/>  
  14.             </mx:AddChild>  
  15.         </mx:State>  
  16.           
  17.         <mx:State name="addUserState">  
  18.             <mx:AddChild position="lastChild">  
  19.                 <!-- 状态对应的自定义组件:添加用户组件 -->  
  20.                 <view:addUserPanel id="panel_addUser" x="10" y="44"/>  
  21.             </mx:AddChild>  
  22.         </mx:State>  
  23.           
  24.         <mx:State name="listAllUserState">  
  25.             <mx:AddChild position="lastChild">  
  26.                 <view:allUserPanel id="panel_allUser" x="10" y="44"/>  
  27.             </mx:AddChild>  
  28.         </mx:State>  
  29.     </mx:states></span>  

③在组件中派发状态事件(StateEvent)

Js代码
  1. <span style="font-size: small;"> //关闭添加留言组件的时候派发"空"状态事件,也就是主程序界面不显示其他组件     
  2.  //如果想显示其他组件,则派发相应的状态事件     
  3.  internal function closeMySelf():void{    
  4.         appModel.dispatchEvent(new Even(StateEvent.NULL_STATE));    
  5.  }</span>  

④在主程序界面中监听状态事件(StateEvent),从而通过改变状态来显示我们需要的组件.

Js代码
  1. <span style="font-size: small;">                                                //添加状态事件监听,在程序初始化的时候执行  
  2.             internal function stateListener():void{  
  3.                 appModel.addEventListener(StateEvent.NULL_STATE,stateEventHandler);  
  4.                 appModel.addEventListener(StateEvent.LOGIN_STATE,stateEventHandler);  
  5.                 appModel.addEventListener(StateEvent.ADDNOTE_STATE,stateEventHandler);  
  6.             }  
  7.             //状态事件处理函数  
  8.             internal function stateEventHandler(evt:Event):void{  
  9.                 this.currentState = evt.type.toString();  
  10.             }</span>  

在项目中appModel是一个继承 EventDispatcher,使用单例模式实现的程序模型.不知道读者是否发现StateEvent中事件名称是和主程序界面中定义的state的 name值是一致的.因为这样定义我们就可以使用统一的状态事件处理函数,就不需要先去判断是哪个状态事件,在来改变当前状态.只要简单的执行 this.currentState = evt.type.toString();

posted @ 2009-09-10 17:50 蜘蛛 阅读(2843) | 评论 (2)编辑 收藏

http://blog.csdn.net/lixinye0123
posted @ 2009-08-24 06:31 蜘蛛 阅读(366) | 评论 (7)编辑 收藏

impersonation
<system.web>
<identity impersonate="true" />
</system.web>

Configuring log4net for SharePoint Windows Authentication
http://mikeknowles.com/blog/2009/02/17/ConfiguringLog4netForSharePointWindowsAuthentication.aspx


log4net does not work in IIS
http://forums.asp.net/p/1420781/3153374.aspx


http://stackoverflow.com/questions/1061857/sharepoint-and-identity-impersonatefalse
posted @ 2009-08-11 23:26 蜘蛛 阅读(574) | 评论 (3)编辑 收藏

http://msp.sfsu.edu/Instructors/rey/aepage/tutorials.html
posted @ 2009-08-05 02:17 蜘蛛 阅读(210) | 评论 (0)编辑 收藏

     摘要: Photoshop超级技巧 色彩技巧    139. Photoshop是32位应用程序,为了正确地观看文件,须将屏幕设置为24位彩色。    140. 先执行“视图”→“新视图”命令,产生有关新视窗后,再执行“视图”→“预览”...  阅读全文
posted @ 2009-07-31 14:35 蜘蛛 阅读(381) | 评论 (0)编辑 收藏

和动画一样,剪辑这个词涵盖的东西太多,以至于我们无从下口。到底什么是剪辑,

什么算剪辑,业内人也说不清楚,更别说介绍给普通观众了。我们从那些有记可查

的各种定义,定律,课本文章里跳出来,只谈谈感受–剪辑:剪什么?

以我的感受,面对一个片子或者是面对一个未出生的片子我们到底应该先剪什么?

首先剪到的应当是

1、剪调性,其次是

2、剪情绪,再次是

3、剪内容, 之后是

3、剪故事,然后是

4、剪道理,次之是

5、剪镜头,再次是

6、剪音乐,最次是

7、剪手法,完后才是

8、剪技术。

其中调性是和产品,和目标,和观众,和影片相关的,就是我们究竟要做一个什么

片子,给谁看,说的是男人的事还是娘们儿的事,是个广告还是专题,是诗歌还是

散文,是政府报告,还是书情小调–于是我们有了影片的调性,它决定了创作者

的情绪。

情绪,是控制影片的主观元素,我们将”我”,将代表”我”的”情绪”放在代表

客观产品和客户的调性要求之后,是因为我们需要以承认一个好的剪辑是在为客户

和观众剪辑的先决条件下确立的。因为调性的确立,而导引出”我”在整个影片控

制中的情绪应当是什么样的。当情绪控制完整时,我们进入了一个状态,开剪!

我们把情绪从空中迫降到内容,面对一大堆素材,内容的整理分类和控制、想象成

了一个庞大的工作,在这么庞大复杂甚至是有点机械重复的过程中,千万不要失去

情绪,选择素材时候还要时刻考虑调性。而这一步针对内容的筛选和分析,是影片

对错的基本保证。

内容确认,将零散的内容剪辑组织成有趣的故事,常常被看做是剪辑的魅力所在。

我们可以用剪辑影响情绪故事甚至改变内容,总之一切虽然在你手中,却依靠想象

力才能走得更远。人人心中有,各个笔下无。电视包装的故事往往并不复杂,但希

望通过剪辑增加信息量并且要求极其清晰和准确的表达。这里需要大量的训练和思

考。

故事的背后要考虑道理,往往剪辑时候需要一个理由,这个理由不一定有机会说出

来或者是展示给每个观众,或者是让每个观众都能体会到理由所在,但是剪辑师必

须有一个理由,能够说服自己剪下去的理由,能够将当前镜头和前后镜头连接起来

的理由。这个理由可能是内容的情绪的故事的,或也可能是镜头运动的,色彩的,

修辞的,反正需要一个理由,将影片进行到底!

道理依靠镜头的组织,这里我们终于剪到镜头了。这是一个很视觉的活,这是一个

很镜头感的饕餮。景别,运动,正反打,一个镜头一个镜头的衔接,一个堡垒一个

堡垒的推进,一组镜头和一组镜头的对话,镜头就是实在的字,讲着道理说着故事。

没有镜头,也可以剪辑,用黑场替代你现在不存在的镜头。我们依然可以组织影片。

镜头的另一魅力就是时长和观众的心理预期,恰到好处的镜头长短,如呼吸般可以

与观众同步,在同步的呼吸中控制观众的节奏,一定要在心里下一个预期前给一个

准确的时长。甚至可以留下一点点遗憾。这就是镜头的魅力。

配合情绪,故事和镜头的音乐举足轻重。但是只会按照音乐剪辑的剪辑,毫无控制

力。他们的影片就像流水帐一样”进人意料”。实际上音乐,同期,字幕,画面同

时构成一个 立体的影片空间与线索。完全可以通过音乐的控制手法去讲故事。对于

影片音乐无可厚非属于一个乘数,而非简陋的加法。

其次我们还有N多种剪辑手法配合,实际上可以把剪辑影片理解成一段舞曲,一段

旋律,我们变换的剪辑手法无非是123,223,323 423……或者是忽然转变成11123

—11223—11323……旋律的变化 ,节奏的调整。这些统称为剪辑手法,可以从广

告带中积累。当然也可以自己创造。而现代剪辑中我认为一些拍摄技巧可以说是从

剪辑中来的,也可以变成一种剪辑技巧。合成也是一种剪辑。合成影响了影片的色

调,质感,景别的重构,这些对剪辑都明显的帮衬作用。

最后要剪技术,这个不用多提,市场上,培训上也提的过多。我们再去技术上争你

死我活都没用。还是少提点为好,或者下一帖再说。

从技术上来说,剪辑软件都类似,看不出多少分别(实际还是有区别的),基本上

快的话一天就能学会慢的话两三个月也能了。之后,你就会剪辑了吗?你就懂得剪

辑了吗?一切要从实践中来。

回头看看:

1、剪调性,其次是

2、剪情绪,再次是

3、剪内容, 之后是

4、剪故事,然后是

5、剪道理,次之是

6、剪镜头,再次是

7、剪音乐,最次是

8、剪手法,完后才是

9、剪技术。

剪到手法还是音乐? —-你剪到了哪一步呢?

同志们!–剪出九级。

posted @ 2009-07-29 10:32 蜘蛛 阅读(269) | 评论 (0)编辑 收藏

http://itbbs.pconline.com.cn/dv/8515019.html
posted @ 2009-07-25 09:27 蜘蛛 阅读(182) | 评论 (0)编辑 收藏

www.noisejunkies.net/links ...you will find a nice list there
http://allbetsareoff.com
http://maltaannon.com
http://www.sternfx.com

And, of course,

http://library.creativecow.net/video-tutorials/adobeaftereffects

www.aetuts.com

creativecow.net,
maltaannon.com,
everythingfx.tk
moviemaker933.tk
fxresource.tk
noisejunkies.net,
aetuts+.com
visualfxtuts.com
aescripts.com

These range from beginning to advanced tutorials.
http://www.lfp-industries.com

This site is constantly growing and makes some exciting tutorials.



ref to :http://www.videocopilot.net/forum/viewtopic.php?f=33&t=19288




posted @ 2009-07-16 10:40 蜘蛛 阅读(161) | 评论 (0)编辑 收藏

I would start with Andrew's Basic Training to learn the basis. Also, I would recommend you to have a look at Andrew's DVD Products, I think Serious FX could be a good start to learn effects and compositing.

Before you go on with Andrews stuff..i suggest you to buy Creating Motion Graphics Vol1 and Vol.2 from Thris and Chris Meyer.
These books will give you the basic principles of the programm and also make you feel comfortable with the interface of the programm such as its basic rules and knowledge.

You must know how to put the gears in order to drive a car.....Andrews stuff is surely your next stop after you manage to drive you A.E vehicle goood!!
posted @ 2009-07-15 15:22 蜘蛛 阅读(216) | 评论 (0)编辑 收藏

美国教师Joe Harkins给即将毕业的CG动画大学生一封信

偶然在网上看到了这篇帖子,是一位名叫Joe Harkins的美国教师为了解答学生们的疑惑而发表的一封信。Joe Harkins从一个过来人的角度,解答了刚刚入行或者正在准备入行年轻人存在的一些疑惑。虽然有一些问题不适合中国学生,但是也有很多代表性的问题,能给我们一些启发。

              作为一个在各个学校演讲的演讲者,旧金山艺术学院新媒体传达中心和SIGGRAPH任教的老师, Joe Harkins会收到无数电子邮件。在回复了上百封邮件后,他逐渐认识到几乎所有的学生都关心这样一个信息:他们想知道他们所受的教育的真正价值有多少。

              他们需要一个真正诚恳的,有经验的人来评判他们的作品。最重要的是他们想知道如何才能获得一份工作。

         我应该去学校拿一个学位吗?

        是否上学拿学位并不是关键。毕业了以后没有人会在意你这个了。他们不想知道你在哪里毕业,学校里成绩多牛。他们不会问你“你主修什么?”
         他们更可能会说:“你会做什么?”

              说实话,这个行业还没有高端到去顾及每个从业人员的学历,这不同于医生和律师。的确,这个行业里有一些从名牌学校毕业的天才,他们对于行业来说是价 值连城的。但是那些毕竟是极少数。更多的是普通人,他们做着自己喜欢的事情,他们有天赋并且很努力去做着他们热爱的事情。

       是否一定需要一个大学学历才能在行业里生存?并非如此,但并不是说去上学没有意义,只是没有学历也不要郁闷,不管什么途径学到能帮助你在职场安身立命的技能,才是最主要的。


       如果我走技术路线,我需要有艺术素养么?  

        毫无疑问,所有能力都需要依赖于你天生的艺术天赋,观察细节的眼力,评价他人和自己作品的能力。虽然很多纯技术性工种并不要求艺术方面的能力,但是 如果你想在CG方面变的更优秀,你仍然需要具备一定的艺术素质。这会让你成为一个综合实力很强的技术工作者。

       我以前学的和CG毫不相干,进入这个行业怎么样?
       这很不错,至少你有一个后路可以做别的。不过你还是必须要选择一个你真正将要投身的行业,然后努力学习。学的多并不是一个坏事。但是有一个问题,既然你都做好了改行的准备,那么你究竟下了多少的决心投身到CG行业呢?


       我该学什么软件好呢?

       首先忘记软件这个东西吧!如果你对技术性的东西有兴趣,那么你需要一个很强悍的数学和科学基础。当然还要会编程!如果你走艺术路线,那么你 需要在传统技法上下工夫,比如速描,色彩,雕塑等。先打好扎实的2D基础,再来玩3D。

       软件仅仅是一个工具而 已,行业里用到最多的3D软件是MAYA;2D方面,PhotoShop仍然是一个必会项目。说到合成,你学好Shake 或者Combustion 不会有错,会AfterEffect更好。渲染部分,Renderman和Mental Ray所占比例最大。动作捕捉方面MotionBuilder用的最多。特效家们爱用Hudini,不过MAYA  仍然是用的最多的,尤其是它的流体,像 www.maya.la 这也是不错的学习交流地方。

      学什么软件还是很重要的,因为这些庞杂的软件学习起来会花费大量的时间和精力。对一个流行的软件你懂的越少,那么你就越不值钱。这并不是说哪个软件更好,关键的是行业中用的最多的软件是什么,这才是决定学什么软件更有价值的关键!


       马上要毕业了,我该做什么呢?

对于即将毕业进入行业的学生,这里有些简单的准备工作需要做:

            开始关注招聘的信息,准备好你的简历。
            着手制作你的作品展示或者一个demo。
            尝试去正式接触和联系那些看过你作品的公司。

       毕业的时候,我应该具备些什么呢?

         最重要的东西就是你手中的demo或者是一个作品展示。当然你还需要一个简历,但是那相对是次要的东西。几乎所有的人的demo都会被单独看过,如果你毕业的时候没有这些东西,那么你绝对没有作好竞争的准备。

       我已经毕业了,接下来该怎么做?

       毕业了,你就进入了这个行业的大海开始“漂”的生活。你是新人,没人认识你,但是你需要一份工作。“漂”这个词很重要。尽可能多的发送你的作品和简历。花 时间给每个公司写求职信,而且要保证这些信是针对这个公司而不是泛泛而写。绝对不要写那种很没个性的信,那会让你失去工作的机会。但是也别做的太过火,简 单到位就好。求职信,简历,作品这3样东西都准备好了,就够了。

关于作品,有以下几点法则:

          不要超过2分钟,任何过多的内容都是没有经验的表现。
          最好的作品放在第一个,绝对不要重复表现什么内容,更不要把一些不能体现你最佳水平的东西放进去充数。
          忘记配乐吧,你的作品基本都是关掉声音而且是被快进看完的。很遗憾。
          觉得你的作品很不错,可以到 www.299.com.cn 的久久CG动画论坛发出来。
          名字,电话和电子邮件要显醒目,千万别忘记这些联系方式。
          你的作品究竟有多少含金量?

       从某种程度上说,它是无价的!进入行业的机会是十分难得到的,你会和许多极富天赋的人来竞争一个工作。如果你用一个月的时间作出一个作品,很显然它会很有价值!世界上所有的天才艺术家绝对不会对自己的作品草草了事,不会偷懒和拖拖拉拉。作好准备吧,这里充满了竞争。

      作品决定了所有的事情。它是你唯一靠的住的伙伴,也是你进入行业唯一的敲门砖。作品会集中大部分的注意力!我有面试的机会了,但是我该怎么做呢?做你自 己!带上内容更多的作品和简历,准时去面试。最重要的是要诚实,别夸大你的能力,那不会有什么帮助。别过分打扮,但是至少要得体。你要保持自信,他们对你 有兴趣,你也要表现的对他们很感兴趣。

       所有的招聘都要求工作经验,但是我没有经验,我该怎么办?

        这是一个存在于任何行业中的悖论。对于公司来说,毕业生代表者无名和廉价。虽然招聘要求是只需要有工作经验的人,但是正因为你比其他人廉价,所以你 有机会去填补那些比较菜鸟的职位空缺,虽然你没有任何工作经验。工作经验的要求是为了筛选人,但是公司知道毕业生仍然会不断投送简历。只要你确定这个工作 你可以胜任,那么你就投简历吧!正因为你的不知名,所以你充满了可能性,公司愿意给你一次尝试的机会。如果你得到了能证明自己的机会,你该为自己高兴!

       拥有了第一份工作以后我该怎么做呢?

        当你还是一个新人你肯定要度过一段难熬的日子。别指望他们告诉你重要的东西,别指望他们来提拔你。你要做的就是埋头尽最大努力工作,尽可能的学习。 你正在充实你的履历。工作经验比工资重要的多。以长远眼光来考虑你的事业,别仅仅目光短浅的盯在这份工作上。

完成了最初的几个项目后,你可能在某些方面赢得了一些重视。

        你可能有足够的经验去另外的公司找到一个更好的职位。

        你可能在本公司升职且得到更多的尊重。

        如果可以的话,你可以试着做些新的工作,换些不同的岗位。

第一年或者第二年间可以尝试上面这些。但是你需要在这期间看到结果如何,否则你会陷在一个乏味的环境里。

       众多候选人中,HR更看重什么?

        HR不关心你从哪里来,你努力了多久,你在学校是尖子生还是垫底的。他们只需要你拿出你的作品来证明你可以做什么。同时你需要有谦虚好学的精神,愿 意接受指导。持之以恒,按时完成工作,努力工作直到下班为止。让他们看的出你是一个聪明的人,愿意自己解决问题而不是想都不想就请教别人。让他们知道你是多么想把事情做好,最重要的是你的热情!充满了活力。这些就是HR希望在侯选者中看到的。无论是不是新人。
posted @ 2009-07-14 16:49 蜘蛛 阅读(243) | 评论 (0)编辑 收藏

Problem. You want to split strings on different characters with single character or string delimiters. For example, split a string that contains ""r"n" sequences, which are Windows newlines. Solution. This document contains several tips for the Split method on the string type in the C# programming language.

Input string: One,Two,Three,Four,Five
Delimiter: , (char)
Array: One (string array)
Two
Three
Four
Five

1. Using Split

Here we see the basic Split method overload. You already know the general way to do this, but it is good to look at the basic syntax before we move on. This example splits on a single character.

=== Example program for splitting on spaces ===

using System;

class Program
{
static void Main()
{
string s = "there is a cat";
//
// Split string on spaces.
// This will separate all the words.
//

string[] words = s.Split(' ');
foreach (string word in words)
{
Console.WriteLine(word);
}
}
}

=== Output of the program ===

there
is
a
cat

Description. The input string, which contains four words, is split on spaces and the foreach loop then displays each word. The result value from Split is a string[] array.

2. Multiple characters

Here we use either the Regex method or the C# new array syntax. Note that a new char array is created in the following usages. There is an overloaded method with that signature if you need StringSplitOptions, which is used to remove empty strings.

=== Program that splits on lines with Regex ===

using System;
using System.Text.RegularExpressions;

class Program
{
static void Main()
{
string value = "cat"r"ndog"r"nanimal"r"nperson";
//
// Split the string on line breaks.
// The return value from Split is a string[] array.
//

string[] lines = Regex.Split(value, ""r"n");

foreach (string line in lines)
{
Console.WriteLine(line);
}
}
}

=== Output of the program ===

cat
dog
animal
person

Description. The first example uses Regex. Regex contains the Split method, which is static. It can be used to split strings, although it has different performance properties. The next two example show how you can specify an array as the first parameter to string Split.

=== Program that splits on multiple characters ===

using System;

class Program
{
static void Main()
{
//
// This string is also separated by Windows line breaks.
//

string value = "shirt"r"ndress"r"npants"r"njacket";

//
// Use a new char[] array of two characters ("r and "n) to break
// lines from into separate strings. Use "RemoveEmptyEntries"
// to make sure no empty strings get put in the string[] array.
//

char[] delimiters = new char[] { '"r', '"n' };
string[] parts = value.Split(delimiters, StringSplitOptions.RemoveEmptyEntries);
for (int i = 0; i < parts.Length; i++)
{
Console.WriteLine(parts[i]);
}

//
// Same as the previous example, but uses a new string of 2 characters.
//

parts = value.Split(new string[] { ""r"n" }, StringSplitOptions.None);
for (int i = 0; i < parts.Length; i++)
{
Console.WriteLine(parts[i]);
}
}
}

=== Output of the program ===
(Repeated two times)

shirt
dress
pants
jacket

Overview. One useful overload of Split receives char[] arrays. The string Split method can receive a character array as the first parameter. Each char in the array designates a new block.

Using string arrays. Another overload of Split receives string[] arrays. This means string array can also be passed to the Split method. The new string[] array is created inline with the Split call.

Explanation of StringSplitOptions. The RemoveEmptyEntries enum is specified. When two delimiters are adjacent, we end up with an empty result. We can use this as the second parameter to avoid this. [C# StringSplitOptions Enumeration - dotnetperls.com] The following screenshot shows the Visual Studio debugger.

Split string debug screenshot

3. Separating words

Here we see how you can separate words with Split. Usually, the best way to separate words is to use a Regex that specifies non-word chars. This example separates words in a string based on non-word characters. It eliminates punctuation and whitespace from the return array.

=== Program that separates on non-word pattern ===

using System;
using System.Text.RegularExpressions;

class Program
{
static void Main()
{
string[] w = SplitWords("That is a cute cat, man");
foreach (string s in w)
{
Console.WriteLine(s);
}
Console.ReadLine();
}

/// <summary>
/// Take all the words in the input string and separate them.
/// </summary>

static string[] SplitWords(string s)
{
//
// Split on all non-word characters.
// Returns an array of all the words.
//

return Regex.Split(s, @""W+");
// @ special verbatim string syntax
// "W+ one or more non-word characters together

}
}

=== Output of the program ===

That
is
a
cute
cat
man

Word splitting example. Here you can separate parts of your input string based on any character set or range with Regex. Overall, this provides more power than the string Split methods. [C# Regex.Split Method Examples - dotnetperls.com]

4. Splitting text files

Here you have a text file containing comma-delimited lines of values. This is called a CSV file, and it is easily dealt with in C#. We use the File.ReadAllLines method here, but you may want StreamReader instead.

Reading the following code. The C# code next reads in both of those lines, parses them, and displays the values of each line after the line number. The final comment shows how the file was parsed into the strings.

=== Contents of input file (TextFile1.txt) ===

Dog,Cat,Mouse,Fish,Cow,Horse,Hyena
Programmer,Wizard,CEO,Rancher,Clerk,Farmer

=== Program that splits lines in file (C#) ===

using System;
using System.IO;

class Program
{
static void Main()
{
int i = 0;
foreach (string line in File.ReadAllLines("TextFile1.txt"))
{
string[] parts = line.Split(',');
foreach (string part in parts)
{
Console.WriteLine("{0}:{1}",
i,
part);
}
i++; // For demo only
}
}
}

=== Output of the program ===

0:Dog
0:Cat
0:Mouse
0:Fish
0:Cow
0:Horse
0:Hyena
1:Programmer
1:Wizard
1:CEO
1:Rancher
1:Clerk
1:Farmer

5. Splitting directory paths

Here we see how you can Split the segments in a Windows local directory into separate strings. Note that directory paths are complex and this may not handle all cases correctly. It is also platform-specific, and you could use System.IO.Path. DirectorySeparatorChar for more flexibility. [C# Path Examples - dotnetperls.com]

=== Program that splits Windows directories (C#) ===

using System;

class Program
{
static void Main()
{
// The directory from Windows
const string dir = @"C:"Users"Sam"Documents"Perls"Main";
// Split on directory separator
string[] parts = dir.Split('""');
foreach (string part in parts)
{
Console.WriteLine(part);
}
}
}

=== Output of the program ===

C:
Users
Sam
Documents
Perls
Main

6. Split internal logic

The logic internal to the .NET framework for Split is implemented in managed code. The methods call into the overload with three parameters. The parameters are next checked for validity. Finally, it uses unsafe code to create the separator list, and then a for loop combined with Substring to return the array.

7. Benchmarks

The author tested a long string and a short string, having 40 and 1200 chars. String splitting speed varies on the type of strings. The length of the blocks, number of delimiters, and total size of the string factor into performance.

Results. The Regex.Split option generally performed the worst. The author felt that the second or third methods would be the best, after observing performance problems with regular expressions in other situations.

=== Strings used in test ===
//
// Build long string.
//

_test = string.Empty;
for (int i = 0; i < 120; i++)
{
_test += "01234567"r"n";
}
//
// Build short string.
//

_test = string.Empty;
for (int i = 0; i < 10; i++)
{
_test += "ab"r"n";
}

=== Example methods tested (100000 iterations) ===

static void Test1()
{
string[] arr = Regex.Split(_test, ""r"n", RegexOptions.Compiled);
}

static void Test2()
{
string[] arr = _test.Split(new char[] { '"r', '"n' }, StringSplitOptions.RemoveEmptyEntries);
}

static void Test3()
{
string[] arr = _test.Split(new string[] { ""r"n" }, StringSplitOptions.None);
}

Longer strings: 1200 chars. The benchmark for the methods on the long strings is more even. It may be that for very long strings, such as entire files, the Regex method is equivalent or even faster. For short strings, Regex is slowest, but for long strings it is very fast.

=== Benchmark of Split on long strings ===

[1] Regex.Split: 3470 ms
[2] char[] Split: 1255 ms [fastest]
[3] string[] Split: 1449 ms

=== Benchmark of Split on short strings ===

[1] Regex.Split: 434 ms
[2] char[] Split: 63 ms [fastest]
[3] string[] Split: 83 ms

Short strings: 40 chars. This shows the three methods compared to each other on short strings. Method 1 is the Regex method, and it is by far the slowest on the short strings. This may be because of the compilation time. Smaller is better. [This article was last updated for .NET 3.5 SP1.]

Performance recommendation. For programs that use shorter strings, the methods that split based on arrays are faster and simpler, and they will avoid Regex compilation. For somewhat longer strings or files that contain more lines, Regex is appropriate. I show some Split improvements that can improve your program. [C# Split Improvement - dotnetperls.com]

8. Escaped characters

You can use Replace on your string input to substitute special characters in for any escaped characters. This can solve lots of problems on parsing computer-generated code or data. [C# Split Method and Escape Characters - dotnetperls.com]

9. Caching delimiters

The author's further research into Split and its performance shows that it is worthwhile to declare your char[] array you are splitting on as a local instance to reduce memory pressure and improve runtime performance.

=== Slow version - before ===

//
// Split on multiple characters using new char[] inline.
//

string t = "string to split, ok";

for (int i = 0; i < 10000000; i++)
{
string[] s = t.Split(new char[] { ' ', ',' });
}

=== Fast version - after ===

//
// Split on multiple characters using new char[] already created.
//

string t = "string to split, ok";
char[] c = new char[]{ ' ', ',' }; // <-- Cache this

for (int i = 0; i < 10000000; i++)
{
string[] s = t.Split(c);
}

Interpretation of the above table. We see that storing the array of delimiters separately is good. My measurements show the above code is less than 10% faster when the array is stored outside the loop.

10. Rewriting PHP explode

C# has no explode method exactly like PHP explode, but you can gain the functionality quite easily with Split, for the most part. You can replace explode with the Split method that receives a string[] array. [C# PHP explode Function - dotnetperls.com]

11. Summary

Here we saw several examples and two benchmarks of the Split method in the C# programming language. You can use Split to divide or separate your strings while keeping your code as simple as possible. Sometimes, using IndexOf and Substring together to parse your strings can be more precise and less error-prone. [C# IndexOf String Examples - dotnetperls.com]

posted @ 2009-07-10 14:41 蜘蛛 阅读(874) | 评论 (0)编辑 收藏

http://www.microsoft.com/click/SharePointDeveloper/
posted @ 2009-07-09 17:58 蜘蛛 阅读(180) | 评论 (1)编辑 收藏

相信

    相信你做得到,你一定会做到。

    不断告诉自己某一件事,即使不是真的,最后也会让自己相信。

   警觉

    对于那些使狗和儿童感到畏惧的人应提高警觉。

    警觉过度犹如不及,使人变得多疑。

    不要羡慕邻居的篱笆更绿,或许荆棘多于青草。

    对于满口“别人都说—–”的人,问他“别人”是谁,就会看到他张口结舌的窘态。

    陌生人过分热心帮你做事时 ,当心他别有居心。

    挑战

    如果你想要更上一层楼,就为别人提供超出预期更多更好的服务。

    每一次都尽力超越上次的表现,很快你就会超越周遭的人。

    亨利福特悬赏2.5万元,征求有办法让他在每一台汽车上节省一个螺钉和螺冒的人。

    你让我工厂的每个环节节省10分钱,我让你平步青云。

    如果你一直保持现状,10年后将会如何?

    在你有把握做得更好之前,不要破坏任何东西。

    主要目标

    你的人生想要什么?你能付出什么作为回馈?

    成功的人只想自己要的――而非自己不要的。

    不要管过去做了什么,重要的是你将来要做什么?

    如果你不知道你自己的一生要的是什么,你还想得到什么?

    智者除了有所为,还能有所不为。

    为自己想要的忙碌,如此即无暇担忧你不想要的。

    不要怕目标定得太高,你可能需要退而求其次。

    如果你不会知道自己要什么,别说你没有机会。
    正确的思考

    先正确的评判自己,才有能力评断他人。

    你是否欺骗别人,或是自己?想清楚再回答。

    三思而后行的人,很少会做错事情。

    企图说服不用大脑的人,是徒劳无功。

    认为整个世界都错的人,极可能错在自己。

    行动

    观察走在你前面的人,看看他为何领先,学习他的做法。

    忙碌的人才能把事情做好,呆板的人只会投机取巧。

    优柔寡断的人,即使做了决定,也不能贯彻到底。

    善意需要适当的行动表达。

    合作

    请求比命令能得到更好的结果。

    善于下命令的人,必定能够服从命令并且执行。

    乐意合作产生支持的力量,强迫服从导致失败的结果。

    告诉上司你想要什么,看他是否愿意帮助你去排除障碍。

    友善的合作比煽动更得人心。

    合作必须从部门领导开始,效率亦然。

    狼狈为奸绝非合作。

    除非你自己愿意被别人伤害,否则没有人能够伤害你。

    言之有物

    记住,别人从你所说的每一个字,了解你所知的多寡。

    你怎么说和你说什么同样重要。

    人们在有所求时,语气特别不同。

    语气委婉别人比较听得进去。

    口不择言往往造成尴尬的场面。

    刻薄的话伤人最甚。

    思考可以随心所欲,表达想法则必须谨慎小心。
   热诚

    当热诚变成习惯,恐惧和忧虑即无处容身。

    缺乏热诚的人也没有明确的目标。

    热诚使想象的轮子转动。

    一个人缺乏热诚就象汽车没有汽油。

    善于安排玩乐和工作,两者保持热诚,就是最快乐的人。

    热诚使平凡的话题变得生动。

    多做一点

    每次你多做一些,别人就欠你一些。

    让别人做得更好,同时提升自己的价值。

    善于钓鱼的人选用鱼喜欢的饵。

    你不能让所有的人喜欢你,却能减少别人讨厌你的原因。

    与人协商而不产生摩擦,是有待学习的一大课题。

    多做一些,机会将随之而来。

    为别人服务最多的人最富有。

    服务的道路才能通往快乐的城市。

    勇气

    勇敢的承认自己不知道的事情,才能学习并进步。

    勇气只是多跨一步超越恐惧。

    抱怨自己没有机会的人,多半没有勇气冒险。

   批评

    一事无成的无名小卒才能免于批评。

    不要怕不公正的批评,但要知道哪些是不公正的批评。

    不要批评你不了解的人,要趁机向他学习。

    不要怕受人批评。当你提出新的观念,就要准备受人批评。

    不要批评别人的行为,除非你知道他为何那么做。你在同样的情况下也可能会如此。

    不能忍受批评,就无法尝试新事物。

    如果你经常批评别人,何不试着赞美别人?

    开始批评之前,最好先略加赞美。

    如果你想要更受人欢迎,尽量多赞美,少批评。

    行为

    真正伟大的人,别人会从他的善行感受出来。

    一天没有臆见善行,就是白过了。

    奖章和头衔不能让你上天堂,善行才能增加你的分量。
   建设性的行为才能服人,言语的吹嘘无益。

    不要说你想要什么,用行为表达。

    善行是赞美自己最好的办法。

    如果你比别人更具智慧,别人会从你的行为看出来。

    善意的回应是惩罚对你不义的人最安全的方式。

    对不喜欢你的人不要多费口舌。

    花钱想要上天堂的人,一定后悔没有多行善。

    善行比滔滔雄辩更能打动人心。

    墓志铭不如善行更另人怀念。

    世界不会因为所知给你勋章,而会因你的善行而给你荣耀。

    善行不需要言语的粉饰。

    明确的目标

    明确的了解自己想要什么,致力追求。

    一个人没有明确的目标,就象船没有罗盘一样。

    智者都有清晰思考的习惯。

    意志力缘于持续的行动、自动自发、明确的目标。

    诚实与努力的工作,需要明确的目标引导才能成功。

    缺乏明确的目标,一生将庸庸碌碌。

    坚定的目标是成功的首要原则。

    教育或学习

    教育是开发内在的力量。所有的教育都靠自己的体会;没有人能够教育另外一个人。

    你从工作中学到的,比眼前得到的报酬更可贵。

    倾听才能学习,说话无益。

    好老师一定是好学生。

    不一定把所有的知识都记在心里,能够取得所需的知识即可。

    研究一个人良好的观念,剩过挑剔他的缺点。

    知识必须加以运用,才能产生力量。

    努力把事情做得比别人更好,你就会忘了财务的困扰。

    如果你不努力向上司学习,就虚掷了升迁及更好的工作机会。

    哲学家从犯错的人身上找出人类所犯的错误。

    善于发问使苏格拉底成为当时的智者。

    明智的运用知识,吸引更伟大的知识。
   你自工作中学到的越多,赚得越多。

    自工作学习的人,等于别人付钱让他上学。

    知识必须经由行动产生利益,否则无用。

   失败

    爱迪生失败一万次才发明灯泡。失败一次不必担心。

    “一般人”只失败一次就放弃。所以“一般人”者众,而爱迪生只有一个。

    漫无目的,随波逐流是失败的首要原因。

    横逆中能找出顺逆中所没有的机会。

    让孩子小时侯“好过”,长大之后经常会“难过”。

    批评别人错误时,更要加入一些赞美。

    失败和暂时的挫折有极大的差别,了解两者的不同,才能成功。

    不因一时的挫折停止尝试的人,永远不会失败。

    许多人只需要再多支持一分钟,多做一次努力,就能反败为胜。

    成功招揽成功,失败招揽失败。

    企图不劳而获的人,往往一事无成。

    别人的错误不是你犯错的借口。

    如果你尽力而为,失败并不可耻。

    不要责怪孩子不好,怪那些没有教好孩子的大人。

    错误象花园中的杂草,若未及时铲除,就会到处蔓生。

    自怜是让人上瘾的麻醉剂。

    智者注意自己的缺点,一般人吹嘘自己的优点。

    失败若能将人推出自满的椅子,迫使他做更有用的事情,则是一种福气。

    失败是一种让人承担更大责任的准备。

    了解自己为何失败,则失败是资产。

   残障

    一位中国西北大学的盲生以速记抄录讲义,卖给视力正常的同学,完成学业。

    如果你感到泄气,想想又瞎、有盲、又聋,一生过得充实愉快,著书鼓励更多人的海伦`凯勒。

    从顶端开始的人是极大的不幸,因为他只能往往是向下滑。

    快乐

    有些人累积金钱换取财富,智者累积快乐,与人分享仍取之不竭。

    快乐在于行动,不只是拥有。

    剥夺别人的快乐不能使自己快乐。
    微笑使人更美丽、更愉快,却不费分文。

    热情比怨恨更得人心。

    慷慨的给予快乐,自己更快乐。

    和谐

    和谐使宇宙运转不停。

    机器的摩擦耗费成本,人际间的摩擦损耗心灵。

    如果你不同意别人的说法,至少不要和他人争执。

    促进和平的人受人景仰,挑起摩擦的人遭人嫌恶。

    记住,至少要两个人才能争执。

    两个人以上为明确的目标同心协力,将产生无穷的力量。

    彼此信任是良好人际关系的基础。

    人际关系良好的人永远不愁没有朋友。

    喜欢和谐的人通常知道该如何维系。

    持久的成功建立在和谐的人际关系之上。

    尽量充当和事佬,就没有太多纷争。

    趁机浑水摸鱼的人才会挑起人事纷争。

   公平

    不要忽视小节,宇宙由原子构成。

    得到帮助最好的方式是开始帮助别人。

    信心

    信心愈用愈多。

    除非你愿意,没有人能破坏你对任何事情的信心。

    所有伟大的奇迹都只是信心的力量。

    不幸很少会纠缠有希望和信心的人。

    信心需要立足点,恐惧却能凭空存在。

    信心缘于明确的目标及积极的态度。

    信心是一种态度,常使“不可能”消失于无形。

    信心不能给你需要的东西,却能告诉你如何得到。

    恐惧

    虚张声势往往显示极深的恐惧。

    不要因为恐惧而犹疑,前进就能消除恐惧。

    恐惧是魔鬼最大的武器,人类最大的敌人。

    意识清楚的人很少畏惧任何东西。

    信心可以克服恐惧。

    把你的恐惧留给自己,别人有别人的恐惧。

    坏运气喜欢怕他的人。

    希望和恐惧不会同行。

    恐惧贫穷的人永远不会富有。
   朋友

    有求于人才会去找朋友,很快就没有朋友。

    如果你愿意要朋友,先做别人的朋友。

    不要让帮助你自消沉中振作的朋友失望。

    朋友是了解你并尊重你的人。

    友谊需要经常表达才能长存

    友谊是看出朋友的缺点却不张扬。

    抱怨

    如果你非要抱怨,那么你小声一些,以免吵到别人。

    不要太苛求抱怨的人,他把自己的日子弄得够难过的了。

    健康和习惯

    如果你感觉无精打采,等到饿了再去吃东西。

    生病之前就应该看医生。

    只吃八分饱

    不断想着疾病,你就会不断生病,健康亦然。

    新鲜的水果和蔬菜是永远不会过量的健康食品。

    不要头痛医头,找出病因才是根本之道。

    吃得多不一定健康。

    注意饮食习惯,省下看医生的花费。

posted @ 2009-07-02 15:09 蜘蛛 阅读(186) | 评论 (0)编辑 收藏

简介:影视的后期制作,分工是非常详细的,同样完成一个案子,效率就有高低之分。 广告片科学的方法,一般分为3D,粗剪,精剪等部分,一般胶片转好磁回来,粗剪和3D同时进行(如果该片没有3D,就省事多了),粗剪其 ...
影视的后期制作,分工是非常详细的,同样完成一个案子,效率就有高低之分。  

广告片科学的方法,一般分为3D,粗剪,精剪等部分,一般胶片转好磁回来,粗剪和3D同时进行(如果该片没有3D,就省事多了),粗剪其实不是剪辑画面,而是剪辑时间码,所以对画质和机器要求也低,粗剪是看感觉,可以说整个片子的感觉在粗剪里就决定了。得到导演认可后,通过时间码转到精剪设备里去,这回是在做画面和特技了,一定要1 比1完全无压缩的画质,这对机器的要求就非常高了。最后,一部广告片就出来了(当然还有音乐和配音)。  

那位老兄要问了,为什么不直接在精剪设备里做呢?省得费事转来转去的。老兄你不了啊,前期拍片子,一个镜头要拍很多遍,全都1比1 采到精剪设备里去?那机器不爆掉才怪,所以经过粗剪后,采集的画面都是最后要的,多余的已经去掉了。再说,通常精剪设备都同时接好几个片子,大家都有时间限制,不可能在这里花太多时间做粗剪。  

做电影也是这个套路,只不过剪辑点不是Timecode(时间码),而是Keycode了。  

至于大家经常看的电视剧,专题片,晚会什么的片子,并不要求1比1的画面,再说又不是用胶片拍的,所以一般直接在粗剪设备上做就是了。(在这里,原先的粗剪也就变成精剪设备了)一般画面3 比1,也有1.6比1的。  

再来说说设备:  

1.粗剪设备:粗剪设备通常采用硬件视频采集卡加剪辑软件和大容量的SCIS硬盘阵列组成。视频采集卡通常用RT2000和MGA的DIGISUIT卡(前者最大压缩比3 比1,后者号称1.6比1)  

AVID(采用RT2000系列),最早是AVID的MCXpress树立的标准,该软件非常专业,概念非常先进,一直在MAC上,后来被微软换股票后,移植到了W IN上,但没有MAC上的好用。优缺点以后再详说。  

EDIT(两个系列卡都可以用),著名的DISCREET公司出品,原来叫DVISION,后来DISCREET要进军PC市场,将其收购后改名为EDIT,理念和A VID差不多,但要便宜不少,用户很多。  

还有很多软件象什么快刀啊,ADOBE的PREMIRE,还有国产的大洋,索贝什么的大都采用DIGISUIT系列,软件都偏特技,电视台采用的比较多。  

2.精剪设备:一般采用SGI工作站上的软件,也有特殊的比如宽泰,它严格说并不是计算机。  

FLINT/FLAME /INFORNO系列,分别在SGI的OCTEAN和ONYX系列工作站上,充分发挥SGI64位的优势,1比1完全无压缩采集,特技功能十分强大,F LINT做电视为主,INFORNO做电影,FLAME主要辅助INFORNO,应用十分广泛。  

宽泰系列:自己的机器,有HAL,HEARY,DOMINO系列,HAL特技繁多,最适合做电视片头。HEARY系列剪辑功能强大,适合做纯剪辑的片子。D OMINO系列是做电影的设备。宽泰价格非常昂贵,一般的后期公司都不感问津,它的调色功能非常棒,无出其左右者。  

好六:在SGI上,本人不熟悉,好象广州用的人很多。  

3.特技软件:PC和MAC上都有很多,最常用的如AFTER EFFECT,mayafusion,digitalfusion,shake,combustion,commtion等等(可能会拼错,原谅),他们大都作为辅助软件使用。  

现在随着数字技术的进步,带来的是个人摄影的推广。DV也渐渐普及了,所以也涌现出不少DV的剪辑软件,除了老牌的ADOBE的PREMIRE之外,苹果公司收购了M ACROMEDIA公司的视频小组后,推出了FINAL CUT PRO,一开始是专门剪辑DV的,并宣布永远不会移植到PC上,让苹果用户放心。它一度是剪辑DV最好用的软件,可是AVID公司最近推出了A VID XPRESS DV2.0后,情况发生了变化,跟AVID公司相比,刚成立的FCP小组还是有不少差距的,FCP的诸如剪辑理念啊,快捷键啊这些可感不可说的地方跟X PRESS DV比还是差不少啊。最重要的是 AVID XPRESS DV的界面,使用习惯都和专业的AVID MCXPRESS甚至AVID FILMCOMPSER都一样,学会了一样,等于学会了其他的AVID产品,出去找工作也好找啊。 接下来说说AVID,小弟其实对别的非线编系统不是很熟悉,只是对AVID情有独钟,因为他的操作非常人性化,剪辑的概念非常突出,非常清楚自己是干什么的(这点很多软件都做不到),它就是个基于时间码的剪辑软件,我有一些朋友先用的其他系统,接触了 A VID之后对我说:“AVID一点也不好用,特辑很少!”老兄啊,你要知道它就是一个彻头彻尾的剪辑软件,你要它做特技干什么?!其实很多朋友接触剪辑都会有这样的疑问,其实在国内,工作的分工一直不明确,老板通常会让一个剪辑师干完所有的剪辑加特技,殊不知这样的效率很低。真正高效的方法是由一个或几个特技师完成需要特技的画面,由剪辑师完成剪辑。  

现在AVID也开放了自己的PLUGINS的开发包,已经有很多公司为AVID开发了对它的PLUGINS,AVID也变得和其他软件一样有众多的外挂特技包了。但我通常做特技还是用A E或MF,再转到AVID里去。  

AVID 还有一个所谓的“缺点”,就是非常的不开放,它有自己独特的媒体储存方式,任何外来的如MOV或AVI文件要导入AVID都要转换成AV ID自己的格式,这个过程很缓慢。但我觉得这也是它独特的剪辑理念造成的,就拿AVID XPRESS DV来说吧(其它的AVID系统也一样)。首先,用它剪辑好一个片子之后,可以将所有的从DV上采集下来的画面删除掉,只要存一个PROJEC T文件(1K左右大小)拿着该文件和你的DV母带,到世界任何一个有 AVID的地方,都可以自动将你剪辑好的片子恢复出来,方便吧!就是因为它的P ROJECT文件记录了该DV母带上那些是要的画面的时间码,打开 PROJECT文件后它找不到画面,就会问你要DV母带,再重新采集一边!  

如果你有别的软件作好的画面要加入剪辑,我建议你先把该画面录到DV带上去,再让AVID采集,而不是直接导入AVID,这样你只要存一个P ROJECT文件,其他都可以从硬盘上杀掉。若干月或若干年后,你的客户来找你想修改,你随时都可以恢复到你存盘的水平,只要你的DV母带和P ROJECT文件还在。  

先罗嗦到这里,有时间再讲吧。

 AE特效命令功能解释



Adjust 调节特效

Brightness &Conrtast      亮度和对比度

Channel Mixer          通道混合

Color Balance      颜色平衡

Color Stabilzer

Curues              曲线控制

Hue/Saturation      色调饱和度

Levels(Individual Controls)   灰度级

Posterize             色调分离

Threshold              阈值



Channel通道特效

Alpha Levels           调节图像Alpha通道

Arithmetic            算法

Blend              混合

Cineon Lonverter         转换Cineon帧文件

Compound Arithmetic       复合算法

Invert               转化

Minimax             扩亮扩暗

Remove Color Mating       删除蒙板颜色

Set Channels           设置通道

Set Mattle            设置蒙板

Shift Channels          转换通道

Image Control图像控制特效

Change Color           颜色转变

Color Balance(HLS)颜色平衡(HLS)

Colorama             彩光

Equalize             均衡

Gamma(中介曲线)/pedestal(最低输出值)/Gain(最大输出值)

调整每个通道的反应曲线

Median              中值

PS Arbitary Map         映像

Tint                色彩

Keying键控特效

Color Difference Key       对图像中含透明或半透明的素材键出

Color Key            对指定色键出

Color Range           对Lab,Yuv或RGB等不同颜色空间键出

Difference Matte         通过一个对比层与源层进行比较然后将源层中位置                   和颜色与对比层中相同的像素输出

Extract              通过指定一个亮度范围产生透明,键出图像中所                   有与指定键出亮度相近的像素,主要用于背景与保                   留对象明暗对比度强烈的素材

Inner Outer Key         指定两个遮罩路径,一个键出范围内边,一个键出                   范围外边,系统根据内外遮罩进行差异比较

Linear Color Key         通过指定RGB,HUE或Chroma键出,也可保留前                   边使用键控变为透明的颜色

Luma Key            键出与指定明度相似的区域适用,对比强烈图

Paint艺术化特效

Vector Paint           模仿绘画,书写等过程性动画效果

Render艺术化特效

Audio Spectrum         将指定的声音以其频谱形式图像化

Beam               激光效果

Audio Waveform         以波形指定的音频图像化

Ellipse          依据给定的尺寸在图像上画一椭圆

Fill          以选定的颜色对目标遮罩进行填充

Fractal          纹理效果(万花筒)

Fractal Noise        产生闪电效果或其它的电子特技效果

Lighthing        产生闪电效果或其它的电子特技效果

Radio Waves      沿效果点中心向外扩展发射出无线电波的波纹

Ramp          在图像上创建一个彩色渐变斜面,可以将其原图融合

Stroke          沿指定的路径产生描边效果

Vegas          沿图像轮廓或指定的路径进行艺术化描边

Stylize风格化效果(模仿各种画风模拟真实的艺术手法创作)

Brush Strokes   产生画笔描绘的粗糙外观效果

Color Emboss   产生彩色浮雕效果

Emboss      产生单色浮雕效果

Find Edges    强化颜色变化区域的过渡像素,模仿铅笔色边效果

Glow       搜索图像中明亮部分,然后对周像素明亮化,产生扩散的辉光效果

Leave Color    使指定颜色保持不变,而把其它部分转换成灰色显示

Mosaic      分割图像为许多正方形的方格,马赛克效果

Motion Tile    将多个源图像作为磁片复制到输出,屏幕分割为许多个正方形

Noise       在图像中加入细小的杂点,产生噪波效果

Scatter    在不改变每个独立象素色彩的前提下重新分配产生模糊的,涂抹的外观

Strobe Light    产生闪烁的效果

Texturize     指定层的纹理射到当层图像上

Write On     在指定层中产生笔书写效果

Simulation仿真特效

Card Dance        根据指定层的特征分割画面,产生舞踏的效果

Caustics          模拟气泡,水珠等流体效果

Shatter           对图像进行粉碎爆炸处理,产生爆炸飞散的碎片

Wave World        创造液体波纹效果

Particle Playground   产生大量相似物体独立运动的动画效果

Audio音效效果

Backwards         将声音从结束关键帧播放到开始关键帧,实现反向播放

Base & Treble       调整音频层音调

Delay           精确控制声音的延迟和调制,达到回声效果

Flange & Chorus      合成两种分离的音频特技效果

High-Low Pass       将低音和高音从声音中滤出

Modulator         通过变化频率和振幅给音频加颤音,比如逐渐消失

Parametric EQ       精确调整音频的声调

Reverb           表现宽阔的真实回声效果

Stereo Mixe        混合左右声道,产生一个声道到另一声道的完整音频

Tone            产生各种特技效果

Blue & Sharpen模糊和锐化

Channel Blur          对图像中的RGB和ALPHA通道进行单独的模糊

Compound Blur        沿指定的模糊层的的亮度为基准,对当层模糊

Directional Blur        沿指定方面产生模糊

Fast Blur/Gaussian Blur    高度模糊

Radial Blur          以效果点为基准,产生辐射模糊

Sharpen            通过相邻像素点之间的对比度进行图像清晰化

Unsharp Mask         通过增加定义边缘颜色的对比度产生边缘锐化效果

Distort 扭曲特效

Bezier Warp在层的边界上沿一条封闭的Bezier曲线变形图像

Bulge以效果点为基准对图像进行变形处理使图像产生凹凸

Corner Pin通过改变图像四个边角的位置变形图像

Displacement Map以指定层的像素颜色值为基准变形产生变形效果

Mesh Warp在层上使用网格的Beizer切片控制图像的变形区域

Mirror沿分割线划分图像并反向一边图像到另一边

Offset根据设定的偏量对图像进行偏移对图像推向另一边

Optics Compensation产生摄像机透镜变形的效果

Polar Coordinatess将直角坐标转为极坐标或将极坐标转为直角坐标

Reshape产生涟漪效果,以圆心为轴向四周扩散

Smear在图像中定义一个区域内图像进行偏移延伸和变形

Spherize球面化效果,可以改变球形效果点位置

Transform产生二维几何变化

Twirl围绕指定点旋转图像,产生漩涡效果

Wave Warp在指定的参数范围内随机产生弯曲的波浪效果

Perspective三维空间

Basic 3D建立一个虚拟的三维空间,在三维空间中对对象进行操作

Bevel Alpha在图像的Alpha通道区域出现导角外观

Bevel Edges在图像边缘产生导角外观

Drop shadow沿图像的Alpha通道边缘为图像制作阴影特效

Text文本

Basic Text文本

Numbers产生随机和连续的数字效果

Path Text使文字沿路进行动画

Time时间

Echo在层的不同点上合成关键帧,对前后帧进行混合,产生拖影或运动模糊

Postering Time为当前层指定一个新的帧速率产生特殊效果

Time Displacement通过按时转换像素以变形影像,产生各效

Transitions两个镜头间如何进行连接

BlockDissolve以随机的方块对两个层的重叠部分进行切换

Card Wipe和指定切换层进行卡片的反转擦拭

Gradient Wipe以指定层的亮值建立一个渐层

Iris Wipe指定顶点数产生多边形,对图像进行切换

Radial Wipe在指定的环绕方向上呈辐射擦拭层素材

Venetian Blinds在层素材或合成图像上产生百叶窗效果

Linear Wipe在层指定方向上显示擦拭效果,显示底层画面

Video视频效果

Brdcast Colors(广播级颜色)调整像素色彩的值

Reduce Interlace Flicker

Timecode消除隔行扫描产生的闪烁的现象

posted @ 2009-07-02 11:21 蜘蛛 阅读(203) | 评论 (0)编辑 收藏

MicroCosmforQuicktime 无损压缩编码器目前最新的版本是V1.0.1,可以到其网站(http://www.digitalanarchy.com /product_micro.html)下载一个Demo版本试用。下面以后期合成软件AdobeAfterEffects为例说明MicroCosm 无损压缩编码器的使用方法。


高质量保存自己作品的方法:对于作品,一般无需保存成无损压缩的格式,因此可以采用以下的几种常用方法:用DivX压缩成AVI格式;用SorensonVideoV3.1Professional压缩成体积很上的MOV格式;用TMPEGEnc 等编码器或在相应板卡的支持下压缩成DVD、VCD、SVCD等格式。根据所要应用的场合来选择不同的保存方式


首先先简单介绍一下用于高质量AVI格式压缩的DivX编码器。DivXCodec的开发,实际是挪用了Microsoft公司的 Mpeg4v34.1.00.4920LowMotion和4.1.00.4917FastMotion的编码核心。在经过一系列的修正和版本更新后,DivX编码器现在已经可以在所有主流操作平台上稳定地运行。DivX视频编码所使用的MPEG4编码压缩技术是一种高压缩比有损视频压缩技术。用它来压缩一部容量为5-10G的DVD,保持相同的分辨率和AC3音轨情况下只需要1-2张CDROM,压缩比接近10:1。这种编码器目前的主要应用是互联网上的高品质的DVDRip电影,但对于后期制作人员来说,它所提供的高品质和高压缩比使得我们可以更轻松而廉价的保存高品质的影像素材或自己的作品。


posted @ 2009-07-02 10:45 蜘蛛 阅读(720) | 评论 (0)编辑 收藏

简介:

第一遍,先看光,每个镜头中光是怎么用的,下一个镜头的光有什么变化,有没有投影的变化,有没有黑天白天的变化,有没有阴天、下雨;

第二遍,空间有没有大小的变化,大房间,小房间,有没有室内室外的变化;

第三遍,听声音,是同期还是后期,每个镜头中有有没有表现出的音空间来,它是什么样的,下个镜头的声音空间感有什么变化 ;

第四遍,背景是什么,与前景的关系,它怎样变的(这是透视关系);

第五遍,有没有运动,是画面内的被摄体在运动,还是摄影机在运动,是水平运动(左右横移)多还是纵深运动多。

第六遍,有没有用变焦,它是准确地表现了两个人物关系,还是造成了错误的关系。变焦用得多不多;摇镜头有没有增加新的信息或含义;

第七遍,运动的动与静的关系,是前景有运动,背景没有;或是背景有运动,前景没有;或是前后景都有,或前后景都没有;

第八遍,剪辑点在哪里,起幅的画面是怎么样的,落幅的画面是怎样的,如果是一个人在跑,注意起幅的人体造型好不好,好与不好,看的时候有什么不同;是用切换多,还是用叠化多。

第九遍,在一个镜头中人物的调度是怎样的,有没有第四面墙的舞台处理(即所有镜头中的人都排成一排面向摄影机,就象幼儿园里的排排坐,吃果果。)演员的单独表演也是力求面向第四面墙?

第十遍,音乐用在哪里;有没有主题歌,有作用吗?音乐与人物动作(或称表演)关系,音乐与摄影机运动的关系,音乐与色彩变化的关系,音乐与对话的情绪及节奏的关系,音乐与自然音响(即噪声)的关系等等

第十一遍,如果是故事片,情节的转折点是用什么手段来表现的,是用嘴皮子说出来的,还是无声的段落,如果是你的话,你能用无声把这一段落表现出来吗?

第十二遍,画面上人物关系的变化,有变化,还是没有变化,A在整个镜头里始终站在B右边,就没有走到B的左边去过,等等;

第十三遍,画外空间是怎么用的,是作为画面内的空间的延伸,还是另外一个非叙事的空间;

第十四遍,对话写得是否生活化,还是舞台腔,好念吗?

第十五遍,每个镜头中人物都穿什么颜色的服装,他们之间的相互关系,也就是说,有没有色彩的调度,即作为流动色彩来使用;

第十六遍,道具的时代,地域,民族,文化方面准确吗?

第十七遍,时间上是否用闪回,是用什么手段来表现的,合理吗?

第十八遍,用长镜头吗?最长的镜头有多长,你感觉是长,还是没有实际那么长,这个长镜头内的人物关系是怎样的。全在画面,或者是一个在画内,一个在画外(正反拍不算内)。
第十九遍,人声,是男高音,女高音,男中音,女中音,男低音这样的搭配吗?
 
第二十遍,特写是作为情节中的视觉重音来用的吗?

第二十一遍,全片的声画结合如何,有精彩的地方吗?
posted @ 2009-07-02 10:44 蜘蛛 阅读(153) | 评论 (0)编辑 收藏

http://www.infoq.com/cn/articles/SharePoint-Andreas-Grabner
posted @ 2009-06-25 18:57 蜘蛛 阅读(127) | 评论 (0)编辑 收藏

http://www.crsw.com/mark/Lists/Posts/Post.aspx?ID=32

Web.config modifications with a SharePoint feature
http://weblogs.asp.net/wesleybakker/archive/2009/01/21/web.config-modifications-with-a-sharepoint-feature.aspx

Using SPWebConfigModification to modify a SharePoint web application's web.config for all servers in the farm
add ajax httphandle to web.config
http://www.zimbio.com/VisualStudio/articles/5/Using+SPWebConfigModification+modify+SharePoint
posted @ 2009-06-24 08:15 蜘蛛 阅读(244) | 评论 (0)编辑 收藏




努力不如用心,努力不一定成功会声会影,Edius,Premiere,Vegas,After Effects,Combustion,DFusion,Shake,视频卡,流媒体,广电,摄像机8T.~*E#A#M'R(d2t.W
但成功者必定努力过;W/" l-p+M5U)b(}
因此若能将努力提升为用心努力
成功必定属于您
努力是将工作做完,用心是将工作做好视频之家论坛是国内最大视频软件和视频硬件论坛,涉及到的内容有会声会影,Edius,Premiere,Vegas,After Effects,Combustion,DFusion,Shake,视频卡,流媒体,摄像机等#S1O.n/y*n$E @0E(N

什么是反省
反省是勇气的表现www.52video.net!p)Y,@)u#W8Y
    是自知的明镜会声会影,Edius,Premiere,Vegas,After Effects,Combustion,DFusion,Shake,视频卡,流媒体,广电,摄像机"Q"M5u9V$Z)q
    是明日的祥和视频之家论坛*|8g;t*t3}'M.V3S
    是觉悟的根本+g1c6q"M4u9P&w9T#x
    是成功的要务

问自已三个问题视频之家论坛8[5l%l!s l$r(Z0i
1.我哪里可以更好会声会影,Edius,Premiere,Vegas,After Effects,Combustion,DFusion,Shake,视频卡,流媒体,广电,摄像机"m:r4"0p*c4I x-X
2.我今天学到了什么
3.我工作的使命是什么

赢家的特质www.52video.net6V8N._*^-t'j
1.要有智障的表情会声会影,Edius,Premiere,Vegas,After Effects,Combustion,DFusion,Shake,视频卡,流媒体,广电,摄像机5I9Q'p0P!m7D$q1O.B"p
2.要有被领导的心胸非编剪辑-后期合成-视频工具-视频卡-摄录设备.V0v;~)E-i&}5]
3.要有热情的个性
4.要有舍得的心胸www.52video.net/F'w;G)~-? z"`
5.要有超人的生命力

运用同样的工作方法与智慧做事
却想要拥有不同的结果那是不可能的会声会影,Edius,Premiere,Vegas,After Effects,Combustion,DFusion,Shake,视频卡,流媒体,广电,摄像机,~+[6e;`"i;Q6`:W"L7]0A

保持现状是一种耻辱会声会影,Edius,Premiere,Vegas,After Effects,Combustion,DFusion,Shake,视频卡,流媒体,广电,摄像机)I*E3q1"(q"T5J/@

我们要突破我们要创新非编剪辑-后期合成-视频工具-视频卡-摄录设备)_4].y+^&u
未来属于创新的人会声会影,Edius,Premiere,Vegas,After Effects,Combustion,DFusion,Shake,视频卡,流媒体,广电,摄像机(F(y(T:a/N6a)j9"
无论策略方向,组织,运作都要创新非编剪辑-后期合成-视频工具-视频卡-摄录设备 @8r4z V$v:B4}8o
创新必须掌握新知识,新观念,新趋势
领先跨入知识世纪        从创新开始

什么叫贵会声会影,Edius,Premiere,Vegas,After Effects,Combustion,DFusion,Shake,视频卡,流媒体,广电,摄像机;?5p O)R'W-y7j+d3O-]6i
没有价值的产品就叫贵会声会影,Edius,Premiere,Vegas,After Effects,Combustion,DFusion,Shake,视频卡,流媒体,广电,摄像机#[6}*m'l(r9E p*k*R)h
没有价值的服务就叫贵
%R.|+Y8d-Y0B4E$m4Z
成功之路的障碍
一、观念不对
二、努力不够
三、方法不对
四、反应太慢会声会影,Edius,Premiere,Vegas,After Effects,Combustion,DFusion,Shake,视频卡,流媒体,广电,摄像机3e0?3m.X#s#?0_4u A.I0P
五、福德不够www.52video.net3M3V-i2x#N#^
视频之家论坛6[7U.M$E+b9?&m
若你认为会输,你就已经输了7{'{;u*g5V!S
你将发现放眼四海皆有一真理非编剪辑-后期合成-视频工具-视频卡-摄录设备1]:G b ~#g'q/z6H!M%"/]'Y*s
成功与否在于个人意志,在于本身的心态
很多人输掉比赛是输在起跑之前会声会影,Edius,Premiere,Vegas,After Effects,Combustion,DFusion,Shake,视频卡,流媒体,广电,摄像机5j7b6u-Q&U*E
很多失败的懦夫都是败在工作开始之间0a1w2b/G(N9U
视频之家论坛4}2U-c!A(l"n
销售员思想十戒
1.不能有自已与公司无关的想法
2.不能想我的销售利润无法再提高了
3.不能想销售成本增加与我无关
4.不能想我的推销技巧已经是最了不起的非编剪辑-后期合成-视频工具-视频卡-摄录设备3P'A0W9r!E/o9~,y#j D
5.不能想船到桥头自然直
6.不能想我现在很忙,等到有空时再来做
7.不能想这个客户花我太多的时间视频之家论坛是国内最大视频软件和视频硬件论坛,涉及到的内容有会声会影,Edius,Premiere,Vegas,After Effects,Combustion,DFusion,Shake,视频卡,流媒体,摄像机等-w ]+r'l+Z2S
8.不能想生意的成交是我一个人的功劳
9.不能想我是最差劲的销售员
10.不能想当销售员是没有前途
www.52video.net3d9M#S!V1P
销售可分为二
一、推销技巧:注重于有形的技术层面
二、推销哲学:注重于内在的精神层面

如何将爱与销售结合?
1.喜欢自已,创造魅力
2.培养人格,创造价格会声会影,Edius,Premiere,Vegas,After Effects,Combustion,DFusion,Shake,视频卡,流媒体,广电,摄像机)D)j#m2S-z,r/Y9l&m
3.凡事皆能,成功必成www.52video.net/M5X2D#i,C/t(r"Q

卓越成功的赢家,绝非个个是智商条件特别好的人,但是都拥有一个共同的特质,那就是均有一种让人心义的魅力www.52video.net,?8d9p5O(z1[!{
会声会影,Edius,Premiere,Vegas,After Effects,Combustion,DFusion,Shake,视频卡,流媒体,广电,摄像机#j,L)P'x$~8}
成功三守决:决心、自律、奉献

人生失败的影响均来自‘疑心与情绪’的破坏

从工作中发挥热诚
从工作中才有生命www.52video.net2s#]8{(v/y;H;p
从工作中才有人缘
从工作中才有财富视频之家论坛是国内最大视频软件和视频硬件论坛,涉及到的内容有会声会影,Edius,Premiere,Vegas,After Effects,Combustion,DFusion,Shake,视频卡,流媒体,摄像机等#Q!|/@(m7q c:L0}8L
从工作有才有快乐

同流视频之家论坛是国内最大视频软件和视频硬件论坛,涉及到的内容有会声会影,Edius,Premiere,Vegas,After Effects,Combustion,DFusion,Shake,视频卡,流媒体,摄像机等#r9V6N7d:C$J4s
不能同流,如何交流会声会影,Edius,Premiere,Vegas,After Effects,Combustion,DFusion,Shake,视频卡,流媒体,广电,摄像机4t r$A1M*k2e5K9C
不能交流,如何交心非编剪辑-后期合成-视频工具-视频卡-摄录设备3B)G3V"R,y(u(|(_8g,L
不能交心,如何交易视频之家论坛是国内最大视频软件和视频硬件论坛,涉及到的内容有会声会影,Edius,Premiere,Vegas,After Effects,Combustion,DFusion,Shake,视频卡,流媒体,摄像机等7z%R$c9M"l3v
www.52video.net8L2p6H&W,P$Q;w
顾客导向的真谛
一、我们知道顾客吗?
+f8K3~*T1z2r1[ f7U0I5i视频之家论坛是国内最大视频软件和视频硬件论坛,涉及到的内容有会声会影,Edius,Premiere,Vegas,After Effects,Combustion,DFusion,Shake,视频卡,流媒体,摄像机等二、知道顾客真正的需要吗?/c.}"?3[4_0]-m7R
三、我如何提供顾客所需要的吗?视频之家论坛是国内最大视频软件和视频硬件论坛,涉及到的内容有会声会影,Edius,Premiere,Vegas,After Effects,Combustion,DFusion,Shake,视频卡,流媒体,摄像机等+r+h0{6u(~

顾客最在意的三件事
一、人的行为
二、产品与服务
三、流程www.52video.net&"'x r$U"X7V"x;{$K3H

顾客要什么:关怀
公司对顾客所付出的关心和对个人的注意www.52video.net+g*B*N1R!@4q.^4I'd1t("'q
会声会影,Edius,Premiere,Vegas,After Effects,Combustion,DFusion,Shake,视频卡,流媒体,广电,摄像机-X-r"s(S!A)O
处于一个高消费的时代里,人们追求的是个性化的商品,唯有感性的工作人员,才能推销及制造出这些产品,进而满足这群感情族。非编剪辑-后期合成-视频工具-视频卡-摄录设备0P9c1H'y/Y9G:G,I(x

推销公式视频之家论坛是国内最大视频软件和视频硬件论坛,涉及到的内容有会声会影,Edius,Premiere,Vegas,After Effects,Combustion,DFusion,Shake,视频卡,流媒体,摄像机等9Z8P5J0U2z)K*K,I4d
第一、找希望客
第二、引起好感'~+i*O.k*b+q8D
第三、获取信任视频之家论坛!n,v"{6T1j5D s;i6H"Q
第四、满足需要
第五、缔结成交

希望客基本要素
1.购买能力会声会影,Edius,Premiere,Vegas,After Effects,Combustion,DFusion,Shake,视频卡,流媒体,广电,摄像机9z!j;T7q4o0S
2.决定权力8e(L*Z0"(Q
3.需要程度

人对您的“第一印象”是一辈子的难改变的,因此要如何留下良好的第一印象,是影响您迈向成功很重要的关键

人缘视频之家论坛是国内最大视频软件和视频硬件论坛,涉及到的内容有会声会影,Edius,Premiere,Vegas,After Effects,Combustion,DFusion,Shake,视频卡,流媒体,摄像机等#X-V$m%t k-?#T9U
就是让人看了喜欢的一种感觉。会声会影,Edius,Premiere,Vegas,After Effects,Combustion,DFusion,Shake,视频卡,流媒体,广电,摄像机;U#i-_"X6Q8g1"#q.z
也就是敬人者人恒敬之

2~)l;A,I:N+]9g5F8H-B!y视频之家论坛是国内最大视频软件和视频硬件论 坛,涉及到的内容有会声会影,Edius,Premiere,Vegas,After Effects,Combustion,DFusion,Shake,视频卡,流媒体,摄像机等建立好人缘的基本要素
笑脸,甜嘴,软腰,热情,仪表非编剪辑-后期合成-视频工具-视频卡-摄录设备$? a3i(z"~&i0o+f;Z
会声会影,Edius,Premiere,Vegas,After Effects,Combustion,DFusion,Shake,视频卡,流媒体,广电,摄像机5x"B0P3l'F1I:y.e
销售就是贩卖信赖感6?,K7d""+R%d-C.N8~"F0Y
销售的精髓在于“人格”,而非产品。www.52video.net0R8y.F/y5Z'I6J
决定购买您的产品,是因为您的品德、人生体验及智慧所影响!'L/D"_6E,a#B+V
非编剪辑-后期合成-视频工具-视频卡-摄录设备6c![/]&m9J#_ c*T/J
魅力=智慧+勇气+包容+无私会声会影,Edius,Premiere,Vegas,After Effects,Combustion,DFusion,Shake,视频卡,流媒体,广电,摄像机%L J'R3q,m,e#P1x
%S)Z(s$n"b8I#^*Q0F
换位思考www.52video.net-f9Y(x1q+p9o,s;d w9G
1.为什么要购买非编剪辑-后期合成-视频工具-视频卡-摄录设备2{1X4o"}8m$p/k1R,f
2.对他有什么好处
3.购买动机非编剪辑-后期合成-视频工具-视频卡-摄录设备;t7z)q/a)_
4.购买理由会声会影,Edius,Premiere,Vegas,After Effects,Combustion,DFusion,Shake,视频卡,流媒体,广电,摄像机8g @/J6U(m5Y1H3v7d7W

推销使命
以专业的身份,站在顾客的立场为顾客提供对他们最有好处的一种服务,并期待获得顾客的满意

成功的销售员之四大要素会声会影,Edius,Premiere,Vegas,After Effects,Combustion,DFusion,Shake,视频卡,流媒体,广电,摄像机 K9`+|$D v'J%U)^.^%n
1.对产品的认识会声会影,Edius,Premiere,Vegas,After Effects,Combustion,DFusion,Shake,视频卡,流媒体,广电,摄像机2];z u#Z8V(k-K0q-g1m%A
2.推销技巧
3.时间与地区之分配
4.工作态度

一个好的销售员应该是:
随时将工作放在手上www.52video.net8"#s.U;|;T9X&@1Q+c"e0Z6q
而不是放在办公桌上www.52video.net/Y(X.o.V&e
用我们的双脚努力的去力行
来证明自已可以成为最好的销售人员
非编剪辑-后期合成-视频工具-视频卡-摄录设备6s2U9L3L%L#~"l)m
销售自已
销售的过程中,是以人为主导,再延伸其他的各因素。因此,销售的关键就是要:如何将您销售出去。
您就是一个最好的商品,若连自已都无法销售出去,请问您还能销售什么?www.52video.net*")]+c;H0o2",|4D
www.52video.net)R(A:c;n(v*Z:H4z'x5^4v$w
怎样销售www.52video.net#s/q7z h7Y*|(W"B3c;o
自我形象就是最好的销售非编剪辑-后期合成-视频工具-视频卡-摄录设备(e6R!]9L#V q%V*e
顾客对你有好感,就会接受你的销售会声会影,Edius,Premiere,Vegas,After Effects,Combustion,DFusion,Shake,视频卡,流媒体,广电,摄像机:p)z8S#`+n!^8{.K3A
顾客对你有信任感,就会购买你的产品

销售是最伟大的职业之一非编剪辑-后期合成-视频工具-视频卡-摄录设备%]/J%c5g6h:U3u&a
95% 的总裁做过销售业务
销售是一门艺术
销售能体会人间所有酸甜苦辣,感受成功的喜悦
销售能极大地增强人的自信心www.52video.net+y"O'h:S*T
销售能极大地增强人承受压力的能力视频之家论坛(o)e F7V)l&l3] t4z
销售能极大地增强人的组织协调能力非编剪辑-后期合成-视频工具-视频卡-摄录设备(d'Q%B*e+T%m!c(Y-k*_&O
销售能极大地提升你的社交能力
成功的销售员会魅力四射,像钻石一样发光会声会影,Edius,Premiere,Vegas,After Effects,Combustion,DFusion,Shake,视频卡,流媒体,广电,摄像机0K8c)s#|+o(?
成功的销售员会拥有完美的人生
posted @ 2009-06-23 14:29 蜘蛛 阅读(234) | 评论 (0)编辑 收藏

http://aftereffects.forgingfire.com/2009/03/creating-a-rain-scene-in-ae-part-1-2/
posted @ 2009-06-16 09:32 蜘蛛 阅读(288) | 评论 (6)编辑 收藏

1. Using ViewState and Session


public partial class _Default : System.Web.UI.Page
{
private bool _refreshState;
private bool _isRefresh;
public bool IsRefresh
{
get
{
return _isRefresh;
}
}
protected override void LoadViewState(object savedState)
{
object[] allStates = (object[])savedState;
base.LoadViewState(allStates[0]);
_refreshState = (bool)allStates[1];
_isRefresh = _refreshState == (bool)Session["__ISREFRESH"];
}

protected override object SaveViewState()
{
Session["__ISREFRESH"] = _refreshState;
object[] allStates = new object[2];
allStates[0] = base.SaveViewState();
allStates[1] = !_refreshState;
return allStates;
}

protected void Button2_Click(object sender, EventArgs e)
{
if(!IsRefresh)
Response.Write("Thanx for visiting");
}
}


but still exist a problem,,when open two window.
posted @ 2009-06-13 14:52 蜘蛛 阅读(155) | 评论 (0)编辑 收藏

这是一些与英语学习相关的网站,有时间你可以去浏览一番,也许会碰到一些你感兴趣的内容。如果你觉得某个网站很精彩,也可以推荐给我们,我们会贴在这儿与大家共享。当然,你所推荐的网页内容一定要与英语学习相关。
 

英语通

  英语通(www.in2english.com.cn) 是由中国中央广播 电视大学、英国文化协会和英国广播公司及电大在线远程教育技术有限公司合作推出的英语学习网站,适合中级水 平上下的在职人员、教师、父母和他们的孩子。这是一个免费、权威而实用的在线互动多媒体英语学习网站。你不仅可以训练并提高你的阅读、听力和写作等水平,还可以在线测试自己的语法、词汇、阅读和听力水平。它大量采用了flash 技术,极大增强了网站和英语学习者之间的 互动。有志于出国的朋友还可以在线训练雅思的阅读和听力水平。

 

 

二十一世纪报英语教学网

  二十一世纪报英语教学网http://www.21stcentury.com.cn是二十一世纪报的电子版,分为“21世纪报”,“高中版 ,“初中版”,“ELT资源”,“英语学习社区“和“英语俱乐部”。其中ELT资源中提供免费的英文名著和分类词汇, 这些分类词汇都是具有中国特色的一些很常用的词汇,它的英语学习社区比较活跃。

 

 

中国翻译网

  中国翻译网 http://www.oeol.net/ 是全国首家大型专业翻译网站,面向全中国从 事翻译工作,喜爱翻译,和需要翻译服务的人。虽然是一个翻译网站,但是它并不只提供翻译方面的内容。比如有 关于中华文化的“细说中国”以及介绍国外文化风俗的“走遍世界”,此外它的“英语广场”提供了很多实用的英语学 习内容。

 

 

一路赢网

  一路赢网,www.16ying.com 美式专业全脑训练加英语阅读理解真题,旨在快速提高学习能力和考试成绩!

 

 

www.onelook.com

  onelook是免费的在线大辞海,类似于 google,属于一个巨大 的搜索引擎,当我们查一个单词时,它会同时启动数十部在线词典为您效劳,每个搜索结果还为您精心地分门别类 ,便于您选择。另外还提供了模糊查询功能,这在做 crossword puzzle(纵横字谜)的时候很有用哟!

 

 

www.bbc.co.uk/learningenglish

  www.bbc.co.uk/learningenglish是英国广播公司网站的学英语频道,包括 NEWS ENGLISH, WATCH AND LISTEN, BUSINESS ENGLISH,QUIZZES 和 ENGLISH BY RADIO 等几个栏目。你 不仅能了解英国的文化习俗而且能提高英语水平,其中的 NEWS ENGLISH 会提高你的新闻听力水平,另外 QUIZZES 栏目也很有趣。

 

 

www.footballculture.net

  www.footballculture.net是英国文化协会主办的一个将英语学习和足球文化紧密结合的网站。通过有趣的足球游戏以及关于足球的文字和语音介绍,你不但能提高自身的英语水平,而且还能够扩展自己的体育知识。

 

 

http://language.chinadaily.com.cn/

  http://language.chinadaily.com.cn/是中国日报网站的子网站——英语学习网站,专门为英语爱好者所设计的网站,内容广泛、丰富,图文并茂,对学习语言、了解异国文化都很有帮助。其中的BBS论坛也很有特色,有佳文共赏、哈哈英语、你问我答等栏目。

 

 

http://www.free-english.com

  免费注册的英语学习网站。提供学习软件、游戏及与考试相关的内容。

 

 

http://www.tolearnenglish.com

  需注册的英语学习网站,但也有免费的栏目。

 

 

http://iteslj.org

  网上TESL刊物,各国英语教师交流的园地。

 

 

http://www.english-zone.com

  需注册的英语学习网站,但也有免费的栏目。并有交互式练习。

 

 

http://www.english-to-go.com

  一个教师和学生都可使用的英语教与学网站。

 

 

http://drive.to/autoenglish

  语法、改错、词汇等等的分类练习。

posted @ 2009-06-12 22:34 蜘蛛 阅读(163) | 评论 (0)编辑 收藏

http://www.microsoft.com/downloads/details.aspx?FamilyId=7522A683-4CB2-454E-B908-E805E9BD4E28&displaylang=en
posted @ 2009-06-11 15:32 蜘蛛 阅读(305) | 评论 (0)编辑 收藏

http://www.mikhaildikov.com/2007/03/sharepoint-resources-types-use-and_2163.html
posted @ 2009-06-10 14:26 蜘蛛 阅读(182) | 评论 (1)编辑 收藏

http://www.videocopilot.net/tutorials/
posted @ 2009-06-09 08:58 蜘蛛 阅读(676) | 评论 (11)编辑 收藏

http://www.cnblogs.com/cleo/archive/2007/05/09/wss3_backup_restore.html

用Sharepoint Designer进行单个站点的备份

http://www.cnblogs.com/zhengyongfeng/archive/2009/03/30/1425268.html


SharePoint Designer 2007
http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=baa3ad86-bfc1-4bd4-9812-d9e710d44f42

posted @ 2009-06-04 23:21 蜘蛛 阅读(223) | 评论 (0)编辑 收藏

dll
http://blog.rameshbhaskar.com/2008/12/05/re-compiling-the-ajaxcontroltoolkit/

For example, styles from that post for IE7 and Firefox would be:

.jasons_modalBackground {
    position:fixed;
    top:0px;
    bottom:0px;
    left:0px;
    right:0px;
    overflow:hidden;
    padding:0;
    margin:0;
    background-color:#000;
    filter:alpha(opacity=50);
    opacity:0.5;
    z-index:1000;
}




ModalPopup Demonstration
http://www.asp.net/AJAX/AjaxControlToolkit/Samples/ModalPopup/ModalPopup.aspx




http://blogs.visoftinc.com/archive/2008/03/13/Modal-UpdateProgress-for-UpdatePanel-Revisited.aspx

posted @ 2009-06-04 22:38 蜘蛛 阅读(185) | 评论 (0)编辑 收藏

Recently come across yet another SQL statement that required me to check if the denomiator is 0, otherwise the statement returns a devide by zero error.

Naturally, if this was the statement:

SELECT Expression1/Expression2 FROM Table1

You would do something like:

SELECT Expression1/(CASE Expression2=0 THEN XX ELSE Expression2 END) FROM Table1

This might be OK if Expression2 is small, however a better way I discovered is to use a combination of ISNULL and NULLIF
Then it would look like:

SELECT Expression1/ ISNULL( NULLIF(Expression2,0), XX) FROM Table1

Note: you can set the XX to be either NULL or 1 or something else depending on the application of this statement.

posted @ 2009-06-03 23:51 蜘蛛 阅读(214) | 评论 (0)编辑 收藏

http://wssdeploy.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=26234


Announcing public availability of WssDeploy – a remote deployment and debugging tool for SharePoint  developers
http://www.portalsolutions.net/Blog/Lists/Posts/Post.aspx?ID=53

posted @ 2009-06-03 22:39 蜘蛛 阅读(152) | 评论 (0)编辑 收藏

http://blogs.technet.com/mhass/archive/2007/08/20/sharepoint-3-0-wsp-deployment-scripts.aspx
posted @ 2009-06-03 22:16 蜘蛛 阅读(160) | 评论 (0)编辑 收藏

pstools工具使用方法  
本篇文章是基于pstools 1.6版本。pstools是sysinternals出的一个功能强大的nt/2k远程管理工具包。
它的主页为http://www.sysinternals.com/
下载地址为http://www.sysinternals.com/files/Pstools.zip
(1)psexec
psexec是一个远程执行工具,你可以像使用telnet一样使用它。
它的使用格式为:
psexec \\远程机器ip [-u username [-p password]] [-c [-f]] [-i][-d] program [arguments]
它的参数有:
-u后面跟用户名 -p后面是跟密码的,如果建立ipc连接后这两个参数则不需要。(如果没有-p参数,则输入命令后会要求你输入密码)
-c <[路径]文件名>:拷贝文件到远程机器并运行(注意:运行结束后文件会自动删除)
-d 不等待程序执行完就返回,(比如要让远程机器运行tftp服务端的时候使用,不然psexec命令会一直等待tftp程序结束才会返回)
-i 在远程机器上运行一个名为psexesvc进程,(到底什么用弄不明白)
 

假设我在远程机器ip有一个账号,账号名是:abc   密码是:123
比如想要用telnet一样在远程系统上执行命令可以打:
psexec \\远程机器ip -u abc -p 123 cmd
如果想要远程机器执行本地c:\srm.exe文件可以打:
psexec \\远程机器ip -u abc -p 123 -c c:\srm.exe
如果想要让远程机器执行本地上tftp服务端,(假设tftp服务端在本地c:\tftp32.exe),可以打:
psexec \\远程机器ip -u abc -p 123 -c c:\tftp32.exe -d
 
(后面例子不再重复-u和-p的用法)
 
 
 
(2)psservice
psservice是一个服务管理程序。
它的使用格式为:
psservice [\\远程机器ip [-u username] [-p password]] <command> <options>
它的参数只有:
-u 后面跟用户名 -p后面是跟密码的,如果建立ipc连接后这两个参数则不需要。(如果没有-p参数,则输入命令后会要求你输入密码)
它的command有:
query [服务名]:显示某一服务的状态,如不填服务名则显示所有服务的状态。
config <服务名>:显示某一服务的配置。
start <服务名>:启动某一服务。
stop <服务名>:停止某一服务。
testart <服务名>:停止某一服务并重新启动它。
pause <服务名>:暂停某一服务。
cont <服务名>:恢复暂停的服务。
depend <服务名>:显示某一服务依存关系。
find <服务名>:在网络种搜寻指定的服务。
 

比如你想查看在远程机器上的telnet服务的状态可以打:
psservice \\远程机器ip query tlntsvr     (tlntsvr为telnet服务的服务名)
比如你查看远程机器上的telnet服务的配置可以打:
psservice \\远程机器ip config tlntsvr
比如你想启动远程机器上的telnet服务可以打:
psservice \\远程机器ip start tlntsvr
其他用法以此类推。
 
 
 
(3)pssuspend
pssuspend是一个暂时停止进程的软件
  
 
2009-4-22 23:57   回复此发言  

2 pstools说明书(中文版)
它的使用格式为:
pssuspend [-r] [\\远程机器ip [-u username] [-p password]] <process name | process id>
它有三个参数:
-u:后面跟用户名 -p:后面是跟密码的,如果建立ipc连接后这两个参数则不需要。(如果没有-p参数,则输入命令后会要求你输入密码)
-r:恢复进程。
 

比如要暂时停止一个pid号为999,名称为srm.exe的进程可以打:
pssuspend \\远程机器ip 999   或   pssuspend \\远程机器ip srm
如果想要恢复它就可以打pssuspend -r \\远程机器ip 999 或   pssuspend -r \\远程机器ip srm
 
 
 
(4)psinfo
psinfo是一个搜集机器软硬件信息的工具,它可以获得操作系统信息,硬件信息和软件信息。
它的使用格式为:
psinfo [-h] [-s] [-d] [-c] [\\远程机器ip [-u username [-p password]]]
它的参数有:
-u:后面跟用户名 -p:后面是跟密码的,如果建立ipc连接后这两个参数则不需要。(如果没有-p参数,则输入命令后会要求你输入密码)
-h:是显示它安装了哪些补丁包
-s:是显示它装了哪些软件
-d:是显示磁盘信息。
 

比如我只想看远程机器的软硬件信息和只用打:
psinfo \\远程机器ip
假如我还想看看它装了哪些补丁包可以打
psinfo -h \\远程机器ip
假如我还想看看它磁盘信息可以打:
psinfo -d \\远程机器ip
如果我想看它装了哪些软件可以打:
psinfo -s \\远程机器ip
简单吧.
 
 
 
(5)pslist
pslist是一个查看进程的程序。
它的使用格式为:
pslist [-d] [-m] [-x][-t][-s [n] [-r n] [\\远程机器ip [-u username] [-p password]] [name | pid]
它的参数有:
-u:后面跟用户名 -p:后面是跟密码的,如果建立ipc连接后这两个参数则不需要。(如果没有-p参数,则输入命令后会要求你输入密码)
-s:是使用任务管理器模式实时查看进程,可以按ESC键退出。
-r <秒数>:是和-s连用的一个参数,它用来指定任务管理器模式是的刷新间隔。(默认的刷新间隔为1秒)
-d:示各个进程的cpu使用信息。
-m:显示各个进程的存储器使用信息。
-x:非常详细显示进程的所有信息。
-t:以树型方式显示进程。
 

比如要查看远程机器ip上的进程的cpu使用信息可以打:
pslist -d \\远程机器ip
比如要查看一个pid号为999,名称为srm.exe进程的存储器使用信息可以打:
pslist -m \\远程机器ip 999 或 pslist -m \\远程机器ip srm
比如要以任务管理器模式实时查看61.12.23.4上进程情况,并且刷新间隔为3秒可以打:
pslist -s -n 3 \\远程机器ip
 
 
 
(6)psuptime
psuptime是一个了解远程机器运行了多久的命令。
使用它只需要打:psuptime \\远程机器ip
 
 
 
(7)psshutdown
psshutdown是一个远程关机命令。
它的使用格式为:
psshutdown [[-s | -r | -k [-t nn][-m "消息"][-f]] -a | -l | -o] [\\远程机器ip]
 
  
 
2009-4-22 23:57   回复此发言  

3 pstools说明书(中文版)

它的参数有:
-a:取消以前执行的关机指令。
-t:离关机还有多少秒。(默认是20秒)
-s:关闭机器。
-m:是要显示的信息。
-f:是关机是不保存运行的程序。
-r:表示重启。
-l:表示锁定电脑。
-o:表示注销用户。
 

比如我想让远程机器30秒后关闭并显示(要关机了,请保存文件)则打:
psshutdown -t 30 -s -m "要关机了,请保存文件" \\远程机器ip
如果是要重起的话打:
psshutdown -t 30 -m "要关机了,请保存文件" -r \\远程机器ip
如果要取消刚才的指令可以打:
psshutdown -a \\远程机器ip
其他参数以此类推。
 
 
 
(8)psfile
psfile是一个显示机器上的会话和有什么文件被网络中的用户的打开的命令。
它的使用格式为:
psfile [\\远程机器ip [-u Username [-p Password]]] [[Id | path] [-c]]
它的参数有:
-u 后面跟用户名 -p后面是跟密码的,如果建立ipc连接后这两个参数则不需要。(如果没有-p参数,则输入命令后会要求你输入密码)
-c:关闭会话或文件
 

比如我想看看远程机器上的会话和被远程用户打开的文件可以打:
psfile \\远程机器ip
接着就会显示
[33] C:\WINNT
  User:   ADMINISTRATOR
  Locks: 0
  Access: Read
[63] \PIPE\srvsvc
  User:   ADMINISTRATOR
  Locks: 0
  Access: Read Write
接着我想关闭id为33,路径为c:\winnt的这个会话可以打
psfile \\远程机器ip 33 -c   或   psfile \\远程机器ip c:\winnt -c
 
 
 
(9)psloggedon
psloggedon是一个显示目前谁登陆的机器的命令。
它的参数只有:
-l只显示本地登陆用户而不显示其它的网络登陆用户
-x不显示登陆时间
比如说要显示远程机器现在登陆的用户可以打:
psloggedon \\远程机器ip
 
 
 
(10)psgetsid
psgetsid是一个远程获取账号sid信息的工具。
它的使用格式为:
psgetsid [\\远程机器ip [-u username [-p password]]] [account]
它的参数有
-u 后面跟用户名 -p后面是跟密码的,如果建立ipc连接后这两个参数则不需要。(如果没有-p参数,则输入命令后会要求你输入密码)
 

比如要看远程机器上账号名为abc的sid信息可以打:
psgetsid \\远程机器ip abc
 
 
 
(11)pskill
pskill是一个杀除进程的程序。
它的使用格式为:
pskill [\\远程机器ip [-u username] [-p password]] <process name | process id>
 

比如要杀除一个pid号为999,名称为srm.exe的进程可以打:
pskill \\远程机器ip 999   或   pskill \\远程机器ip srm
 
 
 
(12)psloglist
psloglist
psloglist是一个查看系统事件记录的程序。
它的使用格式为:
psloglist [\\远程机器ip [-u username [-p password]]] [-s [-t delimiter]] [-n # | -d #][-c][-x][-r][-a mm/dd/yy][-b mm/dd/yy][-f filter] [-l event log file] <eventlog> 
它的参数有:
-u 后面跟用户名 -p后面是跟密码的,如果建立ipc连接后这两个参数则不需要。
-c:显示事件之后清理事件记录
-l <事件记录文件名>:用于查看事件记录文件
-n <n>:只显示最近的n条系统事件记录。
-d <n>:只显示n天以前的系统事件记录
-a mm/dd/yy:显示mm/dd/yy以后的系统事件记录
-b mm/dd/yy:显示mm/dd/yy以前的系统事件记录
-f <事件类型>:只显示指定的事件类型的系统事件记录。
-x:显示事件数据代码
-r:从旧到新排列(如不加则默认是从新到旧排列)
-s:以一个事件为一行的格式显示,中间默认以逗号格开各个信息。
-t <字符>:这个参数和-s连用,以来改变-s中默认的逗号。
 

如果我想看远程机器的系统事件记录只用打:
psloglist \\远程机器ip 123
比如我想看最近的10条error类型的记录可以打:
psloglist \\远程机器ip -n 10 -f error
posted @ 2009-06-03 21:26 蜘蛛 阅读(240) | 评论 (0)编辑 收藏

MOSS2007-学习笔记-备忘录-单点登录设置(2)
http://www.cnblogs.com/panda/archive/2009/02/10/1387296.html
posted @ 2009-05-29 08:14 蜘蛛 阅读(508) | 评论 (2)编辑 收藏

net use ipipc$ " " /user:" " 建立IPC空链接

net use ipipc$ "密码" /user:"用户名" 建立IPC非空链接

net use h: ipc$ "密码" /user:"用户名" 直接登陆后映射对方C:到本地为H:

net use h: ipc$ 登陆后映射对方C:到本地为H:

net use ipipc$ /del 删除IPC链接

net use h: /del 删除映射对方到本地的为H:的映射

net user 用户名 密码 /add 建立用户

net user guest /active:yes 激活guest用户

net user 查看有哪些用户

net user 帐户名 查看帐户的属性

net localgroup administrators 用户名 /add 把“用户”添加到管理员中使其具有管理员权限,注意:administrator后加s用复数

net start 查看开启了哪些服务

net start 服务名  开启服务;(如:net start telnet, net start schedule)

net stop 服务名 停止某服务

net time 目标ip 查看对方时间

net time 目标ip /set 设置本地计算机时间与“目标IP”主机的时间同步,加上参数/yes可取消确认信息

net view 查看本地局域网内开启了哪些共享

net view ip 查看对方局域网内开启了哪些共享

net config 显示系统网络设置

net logoff 断开连接的共享

net pause 服务名 暂停某服务

net send ip "文本信息" 向对方发信息

net ver 局域网内正在使用的网络连接类型和信息

net share 查看本地开启的共享

net share ipc$ 开启ipc$共享

net share ipc$ /del 删除ipc$共享

net share c$ /del 删除C:共享

net user guest 12345 用guest用户登陆后用将密码改为12345

net password 密码 更改系统登陆密码

netstat -a 查看开启了哪些端口,常用netstat -an

netstat -n 查看端口的网络连接情况,常用netstat -an

netstat -v 查看正在进行的工作

netstat -p 协议名 例:netstat -p tcq/ip 查看某协议使用情况(查看tcp/ip协议使用情况)

netstat -s 查看正在使用的所有协议使用情况

nbtstat -A ip 对方136到139其中一个端口开了的话,就可查看对方最近登陆的用户名(03前的为用户名)-注意:参数-A要大写

tracert -参数 ip(或计算机名) 跟踪路由(数据包),参数:“-w数字”用于设置超时间隔。

ping ip(或域名) 向对方主机发送默认大小为32字节的数据,参数:“-l[空格]数据包大小”;“-n发送数据次数”;“-t”指一直ping。

ping -t -l 65550 ip 死亡之ping(发送大于64K的文件并一直ping就成了死亡之ping)

ipconfig (winipcfg) 用于windows NT及XP(windows 95 98)查看本地ip地址,ipconfig可用参数“/all”显示全部配置信息

tlist -t 以树行列表显示进程(为系统的附加工具,默认是没有安装的,在安装目录的Support/tools文件夹内)

kill -F 进程名 加-F参数后强制结束某进程(为系统的附加工具,默认是没有安装的,在安装目录的Support/tools文件夹内)

del -F 文件名 加-F参数后就可删除只读文件,/AR、/AH、/AS、/AA分别表示删除只读、隐藏、系统、存档文件,/A-R、/A-H、/A-S、/A-A表示删 除除只读、隐藏、系统、存档以外的文件。例如“DEL/AR *.*”表示删除当前目录下所有只读文件,“DEL/A-S *.*”表示删除当前目录下除系统文件以外的所有文件




>net use H: \\192.168.1.20\downloads /user:admin p@ssword

net use * /d


posted @ 2009-05-19 08:00 蜘蛛 阅读(18855) | 评论 (4)编辑 收藏

http://www.cnblogs.com/zhengyongfeng/archive/2009/03/29/1424680.html
posted @ 2009-05-16 08:20 蜘蛛 阅读(148) | 评论 (0)编辑 收藏

C#正则表达式

 

只能输入数字:"^[0-9]*$"。
只能输入n位的数字:"^\d{n}$"。
只能输入至少n位的数字:"^\d{n,}$"。
只能输入m~n位的数字:。"^\d{m,n}$"
只能输入零和非零开头的数字:"^(0|[1-9][0-9]*)$"。
只能输入有两位小数的正实数:"^[0-9]+(.[0-9]{2})?$"。
只能输入有1~3位小数的正实数:"^[0-9]+(.[0-9]{1,3})?$"。
只能输入非零的正整数:"^\+?[1-9][0-9]*$"。
只能输入非零的负整数:"^\-[1-9][]0-9"*$。
只能输入长度为3的字符:"^.{3}$"。
只能输入由26个英文字母组成的字符串:"^[A-Za-z]+$"。
只能输入由26个大写英文字母组成的字符串:"^[A-Z]+$"。
只能输入由26个小写英文字母组成的字符串:"^[a-z]+$"。
只能输入由数字和26个英文字母组成的字符串:"^[A-Za-z0-9]+$"。
只能输入由数字、26个英文字母或者下划线组成的字符串:"^\w+$"。
验证用户密码:"^[a-zA-Z]\w{5,17}$"正确格式为:以字母开头,长度在6~18之间,只能包含字符、数字和下划线。
验证是否含有^%&',;=?$\"等字符:"[^%&',;=?$\x22]+"。
只能输入汉字:"^[\u4e00-\u9fa5]{0,}$"
验证Email地址:"^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$"。
验证InternetURL:"^http://([\w-]+\.)+[\w-]+(/[\w-./?%&=]*)?$"。
验证电话号码:"^(\(\d{3,4}-)|\d{3.4}-)?\d{7,8}$"正确格式为:"XXX-XXXXXXX"、"XXXX-XXXXXXXX"、"XXX-XXXXXXX"、"XXX-XXXXXXXX"、"XXXXXXX"和"XXXXXXXX"。
验证身份证号(15位或18位数字):"^\d{15}|\d{18}$"。
验证一年的12个月:"^(0?[1-9]|1[0-2])$"正确格式为:"01"~"09"和"1"~"12"。
验证一个月的31天:"^((0?[1-9])|((1|2)[0-9])|30|31)$"正确格式为;"01"~"09"和"1"~"31"。
利用正则表达式限制网页表单里的文本框输入内容:

用正则表达式限制只能输入中文:onkeyup="value=value.replace(/[^\u4E00-\u9FA5]/g,'')" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\u4E00-\u9FA5]/g,''))"

用正则表达式限制只能输入全角字符: onkeyup="value=value.replace(/[^\uFF00-\uFFFF] /g,'')" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\uFF00-\uFFFF]/g,''))"

用正则表达式限制只能输入数字:onkeyup="value=value.replace(/[^\d]/g,'') "onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))"

用正则表达式限制只能输入数字和英文:onkeyup="value=value.replace(/[\W]/g,'') "onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))"

得用正则表达式从URL地址中提取文件名的javascript程序,如下结果为page1

s="http://www.9499.net/page1.htm"
s=s.replace(/(.*\/){0,}([^\.]+).*/ig,"$2")
alert(s)

匹配双字节字符(包括汉字在内):[^\x00-\xff]

应用:计算字符串的长度(一个双字节字符长度计2,ASCII字符计1)

String.prototype.len=function(){return this.replace([^\x00-\xff]/g,"aa").length;}

匹配空行的正则表达式:\n[\s| ]*\r

匹配HTML标记的正则表达式:/<(.*)>.*<\/\1>|<(.*) \/>/

匹配首尾空格的正则表达式:(^\s*)|(\s*$)

String.prototype.trim = function()
{
    return this.replace(/(^\s*)|(\s*$)/g, "");
}

利用正则表达式分解和转换IP地址:

下面是利用正则表达式匹配IP地址,并将IP地址转换成对应数值的Javascript程序:

function IP2V(ip)
{
re=/(\d+)\.(\d+)\.(\d+)\.(\d+)/g //匹配IP地址的正则表达式
if(re.test(ip))
{
return RegExp.$1*Math.pow(255,3))+RegExp.$2*Math.pow(255,2))+RegExp.$3*255+RegExp.$4*1
}
else
{
throw new Error("Not a valid IP address!")
}
}

不过上面的程序如果不用正则表达式,而直接用split函数来分解可能更简单,程序如下:

var ip="10.100.20.168"
ip=ip.split(".")
alert("IP值是:"+(ip[0]*255*255*255+ip[1]*255*255+ip[2]*255+ip[3]*1))
符号解释:

字符
描述

\
将下一个字符标记为一个特殊字符、或一个原义字符、或一个 向后引用、或一个八进制转义符。例如,'n' 匹配字符 "n"。'\n' 匹配一个换行符。序列 '\\' 匹配 "\" 而 "\(" 则匹配 "("。

^
匹配输入字符串的开始位置。如果设置了 RegExp 对象的 Multiline 属性,^ 也匹配 '\n' 或 '\r' 之后的位置。

$
匹配输入字符串的结束位置。如果设置了RegExp 对象的 Multiline 属性,$ 也匹配 '\n' 或 '\r' 之前的位置。

*
匹配前面的子表达式零次或多次。例如,zo* 能匹配 "z" 以及 "zoo"。* 等价于{0,}。

+
匹配前面的子表达式一次或多次。例如,'zo+' 能匹配 "zo" 以及 "zoo",但不能匹配 "z"。+ 等价于 {1,}。

?
匹配前面的子表达式零次或一次。例如,"do(es)?" 可以匹配 "do" 或 "does" 中的"do" 。? 等价于 {0,1}。

{n}
n 是一个非负整数。匹配确定的 n 次。例如,'o{2}' 不能匹配 "Bob" 中的 'o',但是能匹配 "food" 中的两个 o。

{n,}
n 是一个非负整数。至少匹配n 次。例如,'o{2,}' 不能匹配 "Bob" 中的 'o',但能匹配 "foooood" 中的所有 o。'o{1,}' 等价于 'o+'。'o{0,}' 则等价于 'o*'。

{n,m}
m 和 n 均为非负整数,其中n <= m。最少匹配 n 次且最多匹配 m 次。例如,"o{1,3}" 将匹配 "fooooood" 中的前三个 o。'o{0,1}' 等价于 'o?'。请注意在逗号和两个数之间不能有空格。

?
当该字符紧跟在任何一个其他限制符 (*, +, ?, {n}, {n,}, {n,m}) 后面时,匹配模式是非贪婪的。非贪婪模式尽可能少的匹配所搜索的字符串,而默认的贪婪模式则尽可能多的匹配所搜索的字符串。例如,对于字符串 "oooo",'o+?' 将匹配单个 "o",而 'o+' 将匹配所有 'o'。

.
匹配除 "\n" 之外的任何单个字符。要匹配包括 '\n' 在内的任何字符,请使用象 '[.\n]' 的模式。

(pattern)
匹配 pattern 并获取这一匹配。所获取的匹配可以从产生的 Matches 集合得到,在VBScript 中使用 SubMatches 集合,在JScript 中则使用 $0…$9 属性。要匹配圆括号字符,请使用 '\(' 或 '\)'。

(?:pattern)
匹配 pattern 但不获取匹配结果,也就是说这是一个非获取匹配,不进行存储供以后使用。这在使用 "或" 字符 (|) 来组合一个模式的各个部分是很有用。例如, 'industr(?:y|ies) 就是一个比 'industry|industries' 更简略的表达式。

(?=pattern)
正向预查,在任何匹配 pattern 的字符串开始处匹配查找字符串。这是一个非获取匹配,也就是说,该匹配不需要获取供以后使用。例如,'Windows (?=95|98|NT|2000)' 能匹配 "Windows 2000" 中的 "Windows" ,但不能匹配 "Windows 3.1" 中的 "Windows"。预查不消耗字符,也就是说,在一个匹配发生后,在最后一次匹配之后立即开始下一次匹配的搜索,而不是从包含预查的字符之后开始。

(?!pattern)
负向预查,在任何不匹配 pattern 的字符串开始处匹配查找字符串。这是一个非获取匹配,也就是说,该匹配不需要获取供以后使用。例如'Windows (?!95|98|NT|2000)' 能匹配 "Windows 3.1" 中的 "Windows",但不能匹配 "Windows 2000" 中的 "Windows"。预查不消耗字符,也就是说,在一个匹配发生后,在最后一次匹配之后立即开始下一次匹配的搜索,而不是从包含预查的字符之后开始

x|y
匹配 x 或 y。例如,'z|food' 能匹配 "z" 或 "food"。'(z|f)ood' 则匹配 "zood" 或 "food"。

[xyz]
字符集合。匹配所包含的任意一个字符。例如, '[abc]' 可以匹配 "plain" 中的 'a'。

[^xyz]
负值字符集合。匹配未包含的任意字符。例如, '[^abc]' 可以匹配 "plain" 中的'p'。

[a-z]
字符范围。匹配指定范围内的任意字符。例如,'[a-z]' 可以匹配 'a' 到 'z' 范围内的任意小写字母字符。

[^a-z]
负值字符范围。匹配任何不在指定范围内的任意字符。例如,'[^a-z]' 可以匹配任何不在 'a' 到 'z' 范围内的任意字符。

\b
匹配一个单词边界,也就是指单词和空格间的位置。例如, 'er\b' 可以匹配"never" 中的 'er',但不能匹配 "verb" 中的 'er'。

\B
匹配非单词边界。'er\B' 能匹配 "verb" 中的 'er',但不能匹配 "never" 中的 'er'。

\cx
匹配由 x 指明的控制字符。例如, \cM 匹配一个 Control-M 或回车符。x 的值必须为 A-Z 或 a-z 之一。否则,将 c 视为一个原义的 'c' 字符。

\d
匹配一个数字字符。等价于 [0-9]。

\D
匹配一个非数字字符。等价于 [^0-9]。

\f
匹配一个换页符。等价于 \x0c 和 \cL。

\n
匹配一个换行符。等价于 \x0a 和 \cJ。

\r
匹配一个回车符。等价于 \x0d 和 \cM。

\s
匹配任何空白字符,包括空格、制表符、换页符等等。等价于 [ \f\n\r\t\v]。

\S
匹配任何非空白字符。等价于 [^ \f\n\r\t\v]。

\t
匹配一个制表符。等价于 \x09 和 \cI。

\v
匹配一个垂直制表符。等价于 \x0b 和 \cK。

\w
匹配包括下划线的任何单词字符。等价于'[A-Za-z0-9_]'。

\W
匹配任何非单词字符。等价于 '[^A-Za-z0-9_]'。

\xn
匹配 n,其中 n 为十六进制转义值。十六进制转义值必须为确定的两个数字长。例如,'\x41' 匹配 "A"。'\x041' 则等价于 '\x04' & "1"。正则表达式中可以使用 ASCII 编码。.

\num
匹配 num,其中 num 是一个正整数。对所获取的匹配的引用。例如,'(.)\1' 匹配两个连续的相同字符。

\n
标识一个八进制转义值或一个向后引用。如果 \n 之前至少 n 个获取的子表达式,则 n 为向后引用。否则,如果 n 为八进制数字 (0-7),则 n 为一个八进制转义值。

\nm
标识一个八进制转义值或一个向后引用。如果 \nm 之前至少有 nm 个获得子表达式,则 nm 为向后引用。如果 \nm 之前至少有 n 个获取,则 n 为一个后跟文字 m 的向后引用。如果前面的条件都不满足,若 n 和 m 均为八进制数字 (0-7),则 \nm 将匹配八进制转义值 nm。

\nml
如果 n 为八进制数字 (0-3),且 m 和 l 均为八进制数字 (0-7),则匹配八进制转义值 nml。

\un
匹配 n,其中 n 是一个用四个十六进制数字表示的 Unicode 字符。例如, \u00A9 匹配版权符号 (?)。

posted @ 2009-05-16 06:54 蜘蛛 阅读(190) | 评论 (0)编辑 收藏

由于近期项目的需要,我开始学习MOSS编程,刚开始接触的时候觉的特别的别扭,觉的没有自己全新创建的web application来的自由,但是MOSS还是有很多优点的,这篇我先说下自定义webpart的部署问题。

    如何创建webpart我并不想在这篇中讲,具体我会另外写一篇关于webpart开发的文章。

    MOSS中的webpart与普通.net控件的不同点:

       1:webpart一般都是以类库的形式出现,它是没有前端可视化页面的,类似于asp.net中的自定义控件。

       2:两者继承的基类不同:

           1):asp.net控件的基类:System.Web.UI.WebControls.WebControl;

           2):webpart的基类:System.Web.UI.WebControls.WebParts.WebPart;

       3:两者生成的文件不同,下面几个是asp.net控件所不包含的:

           1):密钥文件;

           2):每个 Web 部件都应有一个 .webpart 文件,还有一个描述 Web 部件的 XML 文件。这是webpart独有的特征。

       4:MOSS中的webpart部署并不像asp.net网站中的一样,控件和网站程序放在一起然后部署就行,我总结以个几点应该注意的地方:

          1>:首先把生成的webpart的dll文件复制到sharepoint网站对应的目录中,而程序集的部署分以下几种方式:

             1):bin目录,在创建一个web application时,会选择一个端口,此时在IIS中就会创建一个对应端口的网站目录:Inetpub"wwwroot"wss"VirtualDirectories"20983,在这个目录下面有两个文件夹:_app_bin,bin,将编译好的程序集放进任何一个目录即可;

             2):全局程序集缓存:全局程序集缓存使各个应用能够共享程序集,它会被.Net运行时自动加载。它的位置在:[System Drive]"Windows"Assemply。 因为它会强命名程序集,所有具体开发时不推荐这种方式。

             3).指定目录,参考第一条,bin,_app_bin,这两个文件夹都可以用来部署程序集,MOSS还支持指定目录方式,这需要在Web.Config中进行配置。在<configuration>节下进行配置:

   <runtime>
      
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
         
<probing privatePath="bin;_app_bin;CustomBin" />
      
</assemblyBinding>
   
</runtime>

           小结:其实上面的方式一和方式三是同一原理,实际上可以说是两种方式。还有一点就是如果想手工复制程序集到sharepoint网站的bin,这里有两种简单的方式:

                    1:选择项目-属性-生成-更改输出路径到sharepoint网站的bin即可;

                    2:选择项目-属性-生成事件-增加生成事件:

copy "$(TargetPath)" "E:"Inetpub"wwwroot"wss"VirtualDirectories"20983"bin"

          

           BIN目录的优点和缺点:

                   1:优点。它是一个单独信任位置,默认的,代码访问安全级别非常低。如果想让webpart正常运行,一般都需要开发人员显示的提升BIN目录的信任级别。一个BIN目录对应一个web application,这样我们可以为不同的web application创建不同的独立代码。

                  2:缺点。如果想在另外一个web 应用中应用此webpart,则需要重新部署。

          全局程序集缓存的优点和缺点:

                  1:优点。它是经过签名的程序集,信任级别最高,属于完全信任。因为它部署于全局位置,所有能够被所有web应用所共享。

                  2:缺点。由于它是完全信任,所以它失去了相应的防御措施。

           2>:设置特殊安全属性,如果是采用部署到bin的方式,则会存在安全性问题,如不做处理则会出现如图一的情况。

 

             原因:默认情况下bin 目录的代码访问安全权限很低,对存储的webpart具有特殊的安全约束,Web 部件在执行时不会自动授予完全信任代码权限。我们可以手工来设置这些属性。

                   1:在web.config文件中有一个配置节trust level,是控制信任级别的,我们可以更改此配置节来提升bin目录的安全性:trust level=Full。

                   2:在生成的程序集文件 assembly添加一句 [assembly: AllowPartiallyTrustedCallers()]

             小结:上面方法一般性地提升了信任级别,所以会授予您可能不需要的任何新权限,这样就不如另一种创建新信任策略文件的方法安全。创建一个新的信任策略文件,将 web.config 文件指向该新文件。这种方法较为复杂,但是可以更为精确地设置 Web 部件的权限属性。[引用MSDN],

          3>:注册控件。控件的注册离不开web.config文件,找到SharePoint节点,在最下面添加如下信息: (Assembly,Version,Culture,PublicKeyToken的查看方式可以通过.Net Reflector。 )

<SafeControl Assembly="WebParts.Samples, Version=1.0.0.0, Culture=neutral, PublicKeyToken=9f4da00116c38ec5" Namespace="WebParts.Samples" TypeName="*" Safe="True" />

    </SafeControls>

 

          4>:导入到Webpart部件库。网站操作-网站设置-修改所有网站设置-库-web部件-新建-选中刚才创建的webpart-点击“导入库”-在页面中添加webpart即可。

  总结:

       本文总结了些webpart部署时对于新手的一些困惑,虽然没有比较深入的地方,但是学会部署webpart是MOSS编程的基本功。希望大家指点。

  注:

      本文所讲的环境均为MOSS 2007。

posted @ 2009-05-16 06:52 蜘蛛 阅读(736) | 评论 (0)编辑 收藏

webpart拉到界面上后,有五种部件版式布局方式:默认;无;标题和边框;仅边框;仅标题。
为了方便布署,我们希望在写webpart的时候就指定一种布局方式,以免在布署到页面的时候再去改为自己想要的方式。
那么,我们应该如何做呢?
其实相当简单,
只需要在webpart的构造函数中注明想要的布局方式就行了。
代码如下:
this.ChromeType = PartChromeType.None;    //无
this.ChromeType = PartChromeType.BorderOnly;    //仅边框
this.ChromeType = PartChromeType.TitleAndBorder;    //标题和边框
this.ChromeType = PartChromeType.TitleOnly;    //仅标题
this.ChromeType = PartChromeType.Default;    //默认
posted @ 2009-05-16 06:47 蜘蛛 阅读(299) | 评论 (0)编辑 收藏

http://bbs.blueidea.com/thread-2826016-1-1.html

override protected void OnInit(EventArgs e)
    {
this.btn1.Command  = new CommandEventHandler(this.DoBtnClick);
}
public virtual void DoBtnClick(object sender, CommandEventArgs e)
    {
string btn= e.CommandArgument.ToString();
switch(btn){}

}
posted @ 2009-05-15 08:16 蜘蛛 阅读(198) | 评论 (1)编辑 收藏

http://www.likespc.cn/Article/654.html
posted @ 2009-05-15 08:15 蜘蛛 阅读(171) | 评论 (0)编辑 收藏

本文介绍如下几个方面的内容:

1.如何创建数组

2.如何对数组进行操作(添加,删除,读取)

3.数组常见方法和属性

如何创建一个数组,一般地根据初始化设定简单分为3种:

1.单纯创建数组:

var arr=new Array();

要点:用new关键字创建数组对象Array(),Array()对象是一个本地类,可以用new创建一个对象后使用

2.创建数组的同时规定数组大小:

var arr=new Array(10);//这里就创建了一个初始化大小为10的数组

注意:当使用数组大小操作初始化大小时,数组会自动被撑大,不会像C语言那样发生错误.动态增长是js数组的一个性质.另外,js中支持最大数组长度为

4294967295

3.直接初始化:

var arr=new Array("love","hate","pain");//这里就直接初始化了数组

或var arr=["happy","cute","scare"];//括号也可以声明一个数组对象

当然,类似C语言,可以定义2维3维和多维的数组,例如:

<script language=Javascript>

    var myArray = new Array();

    for(var i=0;i<10;i++ )...{

        myArray[i]=new Array();

        myArray[i][0]=Math.floor(Math.random()*10);

        myArray[i][1]=Math.floor(Math.random()*10);

        myArray[i][2]=Math.floor(Math.random()*10);

        myArray[i][3]=Math.floor(Math.random()*10);

        myArray[i][4]=Math.floor(Math.random()*10);

        myArray[i][5]=Math.floor(Math.random()*10);

        myArray[i][6]=Math.floor(Math.random()*10);

        myArray[i][7]=Math.floor(Math.random()*10);

        myArray[i][8]=Math.floor(Math.random()*10);

    }

   

    myArray.sort( function(x, y) ...{

        return (x[0]==y[0])?((x[4]==y[4])?(x[8]-y[8]):(x[4]-y[4])):(x[2]-y[2])

    });

    for(var i=0;i<myArray.length;i++ )...{

        document.write(myArray[i].join(",") + "<br/>");

    }

</script>

数组的属性:length

arr.length返回数组arr的长度,常见于循环中对数组的遍历,比如:

for(var i=0;i<arr.length;i++){

执行部分

}

数组元素的访问: arr[index],其中index表示索引即数组基数,从0开始,共有arr.length个元素.比如: arr[0]访问第一个数组元素,arr[1]访问第二个数组元素....依

次类推 数组的操作方法:先概览下下面的这些操作数组常用的方法(13个)

toString(),valueOf(),toLocalString(),join(),split(),slice(),concat(),

pop(),push(),shift(),unshift(),sort(),splice()

下面逐一分析这些方法的功能和用法.

toString(),valueOf(),toLocalString():

功能:返回数组的全部元素

注:数组名也可以返回整个数组

代码:

    var m=["am","bm","cm"];//用括号声明一个数组对象

    alert(m.toString());//toString()返回数组对象的所有内容,用逗号分割,即am,bm,cm

    alert(m.valueOf());//valueOf()也返回数组对象的所有内容

    alert(m.toLocaleString());//toLocaleString()也返回数组对象的所有内容,但有地区语言区别,暂不研究

    alert(m);//数组名也返回数组对象的所有内容

join():

功能:把数组各个项用某个字符(串)连接起来,但并不修改原来的数组

代码:

    var m=["am","bm","cm"];//用括号声明一个数组对象

    var n=m.join("---");//用---连接am,bm,cm.

    alert(m.toString());//m并没有被修改,返回am,bm,cm

    alert(n);//n是一个字符串,为am---bm---cm

split():

功能:把一个字符串按某个字符(串)分割成一个数组,但不修改原字符串

代码:

    var str="I love maomao,I am caolvchong";

    var arr=str.split("o");//按字符o把str字符串分割成一个数组

    alert(arr);//输出整个数组

slice():返回某个位置开始(到某个位置结束)的数组部分,不修改原数组

代码:

    var m=["am","bm","cm","dm","em","fm"];

    var n=m.slice(2);//返回第二个元素bm后面的元素,即cm,dm,em,fm

    var q=m.slice(2,5);//返回第二个元素后到第五个元素,即cm,dm,em

    alert(n);

    alert(q);

数组对象的栈操作:

push():数组末尾添加一个项

pop():删除数组最后一个项

代码:

    var m=["am","bm","cm","dm","em","fm"];

    m.push("gm");//在数组末尾添加元素gm

    alert(m);

    m.pop();//删除数组最后一个元素gm

    alert(m);

数组对象的队列操作:

unshift():数组头添加一个项

shift():删除数组第一个项

代码:

    var m=["am","bm","cm","dm","em","fm"];

    m.unshift("gm");//在数组第一个元素位置添加元素gm

    alert(m);

    m.shift();//删除数组第一个元素gm

    alert(m);

sort():数组按字符的ASCII码进行排序,修改数组对象

注:即便是数字数组,也将转化为字符串来进行比较排序

代码:

    var m=["am","fm","gm","bm","em","dm"];

    m.sort();//按字母序排序

    alert(m);

concat():在数组尾添加元素,但不修改数组对象

代码:

    var m=["am","bm"]

    var n=m.concat("cm");//添加一项cm,并且赋予新数组对象

    alert(m);//原数组没有被修改

    alert(n);//输出新数组对象

splice():在数组的任意位置进行添加,删除或者替换元素,直接修改数组对象

细节:

splice()有三个参数或三个以上参数,前两个是必须的,后面参数是可选的

进行添加:splice(起始项,0,添加项)

进行删除:splice(起始项,要删除的项个数)

进行替换:splice(起始项,替换个数,替换项) 这个其实是添加删除的共同结果

代码:

    var m=["am","bm"]

    m.splice(1,0,"fm","sm");//在第一项后面添加fm和sm,返回am,fm,sm,bm

    alert(m);

    m.splice(2,1);//删除第二项后面一项(即第三项sm,返回am,fm,bm)

    alert(m);

    m.splice(2,1,"mm");//替换第二项后面一项(即第三项,返回am,fm,mm)

    alert(m);





在有的教程上没有提到数组对象,都用自定义的数组,没提到的大概都是老版本了:

//定义一维数组
function MArray(len){
this.length = len;
for(i=1;i<=len;i++) this[i] = 0;
return this;
}
//创建数组
var strarray = new MArray(9)
//访问数组
for(aint in strarray) document.write(aint + ":" + strarray[aint] + "<br>");


//定义二维数组
function creatMArray(row,col){
var indx=0;
this.length=(row*10)+col
for(var x=1;x<=row;x++)
for(var y=1;y<=col;y++){
indx=(x*10)+y;
this[indx]="";
}
return this;
}
//创建二维数组
var xarr = new creatMArray(11,2)
//访问二维数组
for (x in xarr) document.write(x + ":" + xarr[x] + "<br>")
posted @ 2009-05-14 08:18 蜘蛛 阅读(192) | 评论 (2)编辑 收藏

http://jlbc.skycn.com/down/HA-daemon4303.zip
posted @ 2009-05-13 21:32 蜘蛛 阅读(166) | 评论 (0)编辑 收藏

ASP.NET Ajax中的UpdatePanel和asp.net中FileUpload控件是不兼容的,但是采用下面的方法,可以在ASP.NET+Ajax下实现文件上传
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
     <Triggers>
     <asp:PostBackTrigger ControlID="btnUpload" />
     </Triggers>
<ContentTemplate>
<asp:FileUpload ID="FileUpload1" runat="server" Width="400px" />
<asp:Button ID="btnUpload" runat="server" Text="上传" OnClick="btnUpload_Click" />
</ContentTemplate>
</asp:UpdatePanel>
把提交上传文件的按钮放在<Triggers>标签内,而不放在<ContentTemplate>中,特别注意把UpdateMode设为Conditional。然后在btnUpload_Click方法中执行保存文件和写入数据库的操作。当然这样做,上传文件时就失去了异步交互的效果,但是,在执行其它操作的时候,都还是有Ajax特性的。另外,如果您的这个上传文件的页面使用了一个母版页,并且在母版页中有一个UpdatePanel,在母版页中对子页的控件加上<Triggers>是不行的,还好,UpdatePanel是可以嵌套的。




方案一、如果将scriptmanager的enablepartialrending设为false则可以正确上传,这个方法最简单,但是会有缺陷,就是在同一个页面上的多个UpdatePanel不可以独自刷新了。另外,当你的UpdatePanel中存在Validator的话,会造成整个页面postback,这个问题似乎是Altas的一个bug.

方案二、摘自http://www.netfocus.cn/article950.html

1:主页面中使用UpdatePanel,然后UpdatePanel里面放置的不是FileUpload控件,而是一个Iframe
2:这个iframe在链接一个新的页面,那个页面里面有FileUpload控件。
3:上传完毕后,告诉主页面上传得结果

先看一个直接使用FileUpload的例子:这个例子里面,服务端是无法找到上传文件的。

            <atlas:UpdatePanel ID="up1" Mode="Conditional" runat="server">
                
<ContentTemplate>
                    
<asp:FileUpload ID="FileUpload1" runat="server" />
                    
<asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click" />
                 
< SPAN>ContentTemplate>
            
< SPAN>atlas:UpdatePanel>


看看,我们该如何实现
1:新建主页面Default.aspx
      在适当的位置,放置一个上传附件的UpdatePanel区域
     

            <atlas:UpdatePanel ID="up_attachment" Mode="Conditional" runat="server">
                
<ContentTemplate>
                   
<iframe id="file" name="file" src="attachment.aspx">< SPAN>iframe>
                
< SPAN>ContentTemplate>
            
< SPAN>atlas:UpdatePanel>

2:新建上传文件的页面attachment.aspx,然后放上FileUpload控件

<div>
    
<asp:FileUpload ID="FileUpload1" runat="server" />
          
<asp:Button ID="Button1" runat="server" Text="OK" OnClick="Button1_Click" />
    
< SPAN>div>

3:在attachment.aspx里面,上传文件之后调用主页面的js,报告上传情况。这是函数原型:

    <script>
      window.top.callBack(fileName);
    
< SPAN>script>

4:Default.aspx主页面里面增加这个函数,处理返回值
  

    <script>
     function callBack(fileName)
  
{
        document.getElementById(
'Attach1').innerHTML=fileName;
     }

    
< SPAN>script>
posted @ 2009-05-13 21:31 蜘蛛 阅读(3608) | 评论 (2)编辑 收藏

SPSecurity.RunWithElevatedPrivileges(delegate()
{
// implementation details omitted
});

可以提升代码的运行权限,实现模拟管理员身份的功能。

在RunWithElevatedPrivileges中不要使用 SPContext.Current.Web,SPContext.Current.Site,SPControl.GetContextWeb(HttpContext.Current) 之类的根据当前上下文得到当前的Web或者Site,根据这些方法得到的所有对象(包括从根据这些对象得到的List,ListItem等等对象)都是以 当前网站登录用户权限运作的,即使是在RunWithElevatedPrivileges其运作权限也不会是管理员。

所以,如果要真正让在RunWithElevatedPrivileges中的代码以管理员权限正常运作的话,必须重新初始化相应的对象,比如:

SPSecurity.RunWithElevatedPrivileges(delegate()
{
using (SPSite mySite = new SPSite(SPContext.Current.Site.Url))
{
Response.Write(mySite.RootWeb.CurrentUser.LoginName);
}
});
以上mySite.RootWeb.CurrentUser.LoginName返回的是管理员的登录帐号。
但是如果按之前所说使用SPContext:
SPSecurity.RunWithElevatedPrivileges(delegate()
{
Response.Write(SPContext.Current.Web.CurrentUser.LoginName);
});

这时候即使在提升权限的范围内运行,得到的也是当前网站登录帐户名,而不是管理员登录帐号

public class DemoHandler : SPItemEventReceiver //继承SharePoint数据条目事件监控类
{
    
public override void ItemAdded(SPItemEventProperties properties)  //重载ItemAdded函数,监控新建列表条目事件
    {
         SPSecurity.RunWithElevatedPrivileges(
delegate()      //用此方法模拟管理员账户运行此事件处理程序
        {
            
using (SPSite site = new SPSite(properties.SiteId))    //用此方法的话就不用dispose()了
            {
                
using (SPWeb web = site.OpenWeb(properties.OpenWeb().ID))  //注意获得web的方法!!!
                {
                    
try
                    
{
                         SPList list
= web.Lists[properties.ListId];     //获得触发事件的列表
                         SPListItem item = list.Items.GetItemById(properties.ListItemId);    //获得触发事件的列表条目

                        
if (!item.HasUniqueRoleAssignments) item.BreakRoleInheritance(false);   //将此条目取消权限继承,如果是“false”,则将去除所有权限,只保留系统账户,如果是“true”,则将上一级权限复制过来。
                         SPUser user = web.Users.GetByID(properties.CurrentUserId);    //获得触发此事件的用户

                         SPRoleAssignment ra
= new SPRoleAssignment(web.EnsureUser(user.LoginName));   //生成一个新的角色分配
                         ra.RoleDefinitionBindings.Add(web.RoleDefinitions["读取"]);    //将此角色分配绑定“读取”权限级别
                         item.RoleAssignments.Add(ra);     //将此新权限绑定到列表条目上
                     }

                    
catch (Exception ee)
                    
{
                     }

                 }


              }

         }

         );
     }

}

posted @ 2009-05-13 07:37 蜘蛛 阅读(857) | 评论 (1)编辑 收藏

 
8月25日

关于Windows Sharepoint Server的权限内容分析

首先声明这个领域小弟也是刚涉足, 经验浅的很. 一些看法和说法都是卑微之语. Windows Sharepoint Server中的权限(Authorization)设置是通过中间件角色(Role)来与指定用户(User)发生关系的. 并不如同传统的直接给予某个用户相应的权限. 即应该通过创建一个角色然后在其中组合不同的权限最后将一个角色赋予一个用户. 用户组的概念也是如此.  User/Group -- Role --Authorization
无论当你是将一个用户或者组添加入对于某个列表或者某个文件中获得相应的权限. 那些关于用户和用户组的信息分配存放在配置数据库的UserInfo和Groups表中. 其中tp_siteId代表了所属站点的ID, tp_Id则是分配给用户的ID, Groups的组织方式也基本和UserInfo差不多.  Role 即角色表, 存放所创建的角色. RoleAssignment存放角色的分配. 其中的ScopeId 会对应Perms表中的ScopeId, 当你为一个列表或者某个文件添加权限时并且不继承父权限的时候, 在Perms表中会添加相应的新记录内容, 并且创建它的ScopeUrl与ScopeID来标识它.  并且与RoleAssignment中的scopeId对应, 而RoleAssignment中的PrincepalId则存放对应的UserInfo中的tp_Id或者Groups中的tp_Id. 两张表中的tp_Id是不会重复的. 搞清楚了权限组合和角色创建与分配是如何组成的. 现在来看一下如何通过Windows Sharepoint Server的对象模型以编程方式解决一些问题. 比如我想通过一个EventHandler当用户上传某个文件以后让他选择相应的本地域中已存的AD帐户.
实现Windows Sharepoint Server的EventHandler有两种方式(暂时只了解两种), 一种是实现IListEventSick接口. 这种方式的缺点暂时令我感觉到的是很难做一些更复杂的操作.  另一种方式是派生相应的操作时间类. 如果是一些内容则是SPItemEventReceiver.  具体内容可以通过Reflector反射Microsoft.Sharepoint.dll了解. 可以重写其中的实现方法来实现我们需要的功能. 现在要编写一个添加完Item后执行的权限分配操作. 也就是当用户在文档中心上传完一个文件以后, 将一个指定的用户添加入其中获得该文件的相应权限.
public override void ItemAdded(SPItemEventProperties properties){}
通过SPItemEventProperties我们可以获得不少关于触发事件的Item的信息. 如SiteId(站点ID),  ListId(列表ID), ListItemId(列表项ID).  比如我要访问那个刚上传文档的对象可以通过以下方式:
SPSite sourceSite = new SPSite(properties.SiteId);
SPWeb sourceWeb = sourceSite.OpenWeb();
SPListItem currentListItem = sourceWeb.Lists[properties.ListTitle].Items.GetItemById(properties.ListItemId);
每个列表条目都提供一个角色分配集合RoleAssignments属性, 它是一个Collection. 提供基本的操作方法. 利用Add我们则可以添加相应的新的RoleAssignment元素.
我们通过建立一个RoleAssignment的实例来添加用户:
SPRoleAssignment roleAssignment = new SPRoleAssignment(sourceWeb.EnsureUser(SHBEYONDBIT\chujun));
SPRoleDefinition roleDefinition = sourceWeb.RoleDefinitions.GetByType(SPRoleType.Read);
SPRoleType 是一个enum提供默认角色级别
SPRoleType.Administrator = 完全控制
SPRoleType.WebDesigner = 设计
SPRoleType.Contributor = 参与讨论
SPRoleType.Reader = 读取
SPRoleType.Guest = 受限访问
SPRoleType.None = 仅查看
对于我们自己创建的Role则不提供支持. 我们需要通过其它方式来获得. 通过RoleDefinitionBindings属性的Add方法我们添加了一个Role给予指定的用户.
roleAssignment.RoleDefinitionBindings.Add(roleDefinition);
currentListItem.BreakRoleInheritance(false);
BreakRoleInheritance就如同我们手动设置用户角色时选择的是否不在继承父权限一样. 我们不再继承父权限. 最后通过currentListItem.RoleAssignments.Add(roleAssignment); 为相应列表添加了某个用户的角色.
在这里有一点令人有些费解, 起初我并非用EnsureUser方法实现用户添加的, 而是通过SPUserInfo创建一个实例. 将AD帐号的一些信息写入其中. 然后通过sourceWeb.User.Add方法来实现添加, 可惜屡屡报错说当前状态无效. 不知有哪位高人知道为何? 不吝赐教.
现在在来讨论关于如何自定义角色问题. 在Windows Sharepoint Server中提供了相当多的权限. 并且通过SPBasePermissions这个enum来设定. 其实实现的方式大致应该是一个int类型. 然后相应的位放置1来确定吧. 即以一个unsigned short为例 00100100可能代表某个Role拥有未知的两个权限.
SPRoleDefinition definition = new SPRoleDefinition(); 创建角色定义的实例.
public bool AddSiteRole(string name, string description, params SPBasePermissions[] args){
     bool flag = true;
     SPRoleDefinition definition = new SPRoleDefinition();
     definition.Name = name;
     definition.Description = description;
     foreach (SPBasePermissions arg in args){
          definition.BasePermissions |= arg;
     }
     try{
          _sourceWeb.RoleDefinitions.Add(definition);
     }
     catch{
          flag = false;    
     }
     return flag;
}
进行相应位置的|操作就可以分配相应的权限了. 如下:
AddSiteRole("自定义角色1", "自定义角色1", SPBasePermissions.AddAndCustomizePages, SPBasePermissions.AddDelPrivateWebParts, SPBasePermissions.AddListItems, SPBasePermissions.ApplyStyleSheets);
顺带一提, 因为SPUser和SPGroup都派生于SPPrincipal, 而SPRoleAssignment可以接受任何派生与SPPrincipal的类型进行添加. 想想之前数据表RoleAssignment表中的PrincepalId, 在真挺有逻辑的.
 
最近有一个项目是针对基于Windows Sharepoint Server, 并利用Microsoft Office Sharepoint Server2007和Design的开发和部署(其实我对这个项目是颇有微辞的, 首先对于这类技术的集成还没有掌握, 项目书上说是配置占70%以上, 其实不然以这样的要求显然开发占了70%以上). 并且我对这种Microsoft极度推崇的技术也是心存一些不满的. 首先它的内容更广一些,不仅设计了Windows WorkFlow Fundation, Web  Part, ASP.NET 2.0, CAML, Infopath以及Windows Sharepoint Server等大量内容还有许多企业应用的概念. 并与Office系列产品有高度集成. 这对于一个开发人员来说需要掌握更多的技术特性. 其实光是精通其中两样已经是很不容易的一回事了. 基于它的二次开发难度较大, 并且许多默认提供用户的操作方式都不是传统的Web用户操作习惯. 说穿了只是Microsoft想要捆绑它的一整套产品销售, 卖给那些政府或者大型企业而已. 哎! 感叹做为开发人员, 不是每个项目都能选择让你使用你擅长的喜爱的技术.
 
不知道有谁会在上传完文件以后先不跳往那个定义名字和注释的页面, 而是跳往我想指定的页面. 因为在Windows Sharepoint Server的那些上传之类的都是以做完的模板, 可能有些按钮时间是自定义的控件. 比如像那些SPWikiButton一类. 以完全将处理方法封装起来了. 除非直接修改页面上脚本. 但是这类都是模板无法如同那些其它的Default.aspx或者Default.Master那样进行修改. 而也无法获得所谓的窗体句柄. 如有实现方式请不吝赐教.
posted @ 2009-05-13 07:35 蜘蛛 阅读(554) | 评论 (0)编辑 收藏

Sharepoint2007中的权限都是通过角色来定义的,一切权限都是通过权限来设置,在设置权限的时候,只能给用户或组赋予一个角色,而不能直接去修改他的权限。
每一个能分配权限的对象(SPWebSPListSPListItem)都会有一个RoleAssignments属性,它是一个SPRoleAssignmentCollection类型的属性,用于分配权限。此外,在SPWeb里还有RoleDefinitions属性(只在SPWeb里有,角色只能定义在网站里)。

1.给一个用户设置一个详细的自定义的权限:
SPUser user ;//取得Sharepoint用户
SPRoleAssignment myRoleA =
new SPRoleAssignment(user);
SPRoleDefinition myRoleD = web.RoleDefinitions["xxx"];
myRoleA.RoldDefinitionBindings.Add(myRoleD);
list.RoleAssignments.Add(myRoleA);

2.修改一个用户的权限:
SPRoleAssignment myRoleA = list.RoleAssignments.GetAssignmentByPrincipal(user);
SPRoleDefinition myRoleD = web.RoleDefinitions["xxx"];
myRoleA.RoldDefinitionBindings.Add(myRoled);
myRoleA.Update();

如果该列表的权限是继承该网站的,那么要首先打破这种继承关系
list.BreakRoleInheritance(true/false);
参数是true将网站中的权限拷贝过来和原来的权限是一样的,如果是false则为列表模板的默认权限。

SPListItem item = properties.ListItem;
SPWeb web = properties.OpenWeb();
SPUser user = web.EnsureUser((new SPFieldLookupValue(item["Test"].ToString())).LookupValue);
SPUser chris = web.EnsureUser((new SPFieldLookupValue(item["chris"].ToString())).LookupValue);
SPUser henry = web.EnsureUser((new SPFieldLookupValue(item["Personalabteilung"].ToString())).LookupValue);
SPRoleDefinition roleReader = web.RoleDefinitions.GetByType(SPRoleType.Reader);
SPRoleDefinition roleWriter = web.RoleDefinitions.GetByType(SPRoleType.Contributor);
SPRoleAssignment roleAssignmentReader = new SPRoleAssignment((SPPrincipal)user);
SPRoleAssignment roleAssignmentWriter = new SPRoleAssignment((SPPrincipal)
chris );
SPRoleAssignment roleAssignmentWriterOther = new SPRoleAssignment((SPPrincipal)
henry );
roleAssignmentReader .RoleDefinitionBindings.Add(roleReader);
roleAssignmentWriter .RoleDefinitionBindings.Add(roleWriter);
roleAssignmentWriterOther .RoleDefinitionBindings.Add(roleWriter);
if (!item.HasUniqueRoleAssignments)

{

     item.BreakRoleInheritance(false);

}

item.RoleAssignments.Add(roleAssignmentReader);
item.RoleAssignments.Add(roleAssignmentWriter);
item.RoleAssignments.Add(
roleAssignmentWriterOther );
item.Update();


posted @ 2009-05-13 07:13 蜘蛛 阅读(452) | 评论 (1)编辑 收藏

基于Sharepoint做一个客户管理的系统,由于客户方对权限的要求非常严格,所以不得不自己去定义网站的权限,好在Sharepoint提供的权限系统比较完善,我们所创建的权限包括从创建SPWeb到创建SPListItem均实现了一遍,也算是顺利的解决了问题。项目做到第一阶段,谈谈自己的一些认识。

 

在开始之前先明确几个类或者定义:

Sharepoint权限系统采用 权限——角色 ——对象——关联 的概念,即:对于一个对象(如:SPWeb,SPList,SPListItem),可以通过添加某个已经包含了角色(SPRoleDefinition)的关联(SPRoleAssignment)而更改该对象的权限,而角色(SPRoleDefinition)则是提前通过SPWeb.RoleDefinitions添加到网站内的,注意:只有SPWeb有此属性可以添加角色定义,其他对象如SPSiteSPListSPListItem均不能添加角色定义,当然他们也不需要。

 

相关类:

 

用户或用户组:SPPrincipal 扩展了两个子类:SPUserSPGroup

权限基类:SPBasePermissions,通过或计算合成一个自定义的权限,注意:需要编辑权限的前提是有查看权限;

角色类:SPRoleDefinition,采用web.RoleDefinitions.Add(definition)的方式添加角色;

关联类:对于某个SPPrincipal添加一个SPRoleDefinition的角色,然后再将该关联添加到对象上去,注意:在未将该关联添加到对象上时,该关联都无效。

 

首先定义自己的权限系统,我定义了四个级别的角色,本别具有权限:查看、新建、编辑、删除,这四个权限要远低于Sharepoint本身的权限,这里以新建角色为例说明: 同时定义了负责向网站添加角色Register类,每一个角色都会对应一个Register类,是为了方便权限的扩展,采用依赖倒置。

为对象分配权限:参数SPListItem 也可以是 SPWebSPList,权限的分配一般是在对象刚刚创建后来实现,如

SPWebTemplate template = web.Site.GetCustomWebTemplates((uint)web.Locale.LCID)[WebTemplate];

SPWeb newWeb = RootSPWeb.Webs.Add(rurl, customerName, string.Empty, (uint)2052, template, true, false);

此时就应该对该newWeb做权限操作。而SPListItem的操作一般是在SPItemEventReceiver的ItemAdded事件中去实现


private void RoleAssignment(SPListItem item, SPPrincipal groupOrUser, SPRoleDefinition role)
        {
        
if (!item.HasUniqueRoleAssignments)
        {
            item.BreakRoleInheritance(
true);//true则断开并继承原有权限,false则断开不继承原有权限
        }
        
            
            
this.DisableEventFiring();

            item.Web.AllowUnsafeUpdates 
= true;

            SPRoleAssignment assignment 
= new SPRoleAssignment(groupOrUser);
            assignment.RoleDefinitionBindings.Add(role);
            item.RoleAssignments.Add(assignment);

            item.Update();

            
this.EnableEventFiring();
        }

 


//角色基类:实际上基类提供了查看的权限,因此在查看中不需要扩展
public abstract class BasePermissionRole
    {
        
private string roleName;
        
public virtual string RoleName
        {
            
get
            {
                
return roleName;
            }
            
set
            {
                roleName 
= value;
            }
        }

        
private string roleDescription;
        
public virtual string RoleDescription
        {
            
get
            {
                
return roleDescription;
            }
            
set
            {
                roleDescription 
= value;
            }
        }

        
public abstract SPBasePermissions ComposePermission();

        
protected virtual SPBasePermissions ComposeViewPermission()
        {
        
//对应Sharepoint下的34个基本权限
            return SPBasePermissions.ViewListItems | SPBasePermissions.ViewVersions |
                   SPBasePermissions.ViewFormPages 
| SPBasePermissions.ViewPages |
                   SPBasePermissions.OpenItems 
| SPBasePermissions.CreateAlerts |
                   SPBasePermissions.BrowseUserInfo 
| SPBasePermissions.UseRemoteAPIs |
                   SPBasePermissions.UseClientIntegration 
| SPBasePermissions.Open;
        }

        
public abstract BaseRoleRegister CreateRegister();//通过依赖倒置以及单件实现角色注册
    }
//新建角色,override基类的ComposePermission()方法,并在View的基础上扩展
public class AddPermissionRole : BasePermissionRole
    {
        
public AddPermissionRole()
        {
            
this.RoleName = "新建"
            
this.RoleDescription = "向列表中添加项目,向文档库中添加文档,以及添加 Web 讨论评论";
        }

        
public override string RoleName
        {
            
get
            {
                
return base.RoleName;
            }
            
set
            {
                
base.RoleName = value;
            }
        }

        
public override SPBasePermissions ComposePermission()
        {
            
return base.ComposeViewPermission() | SPBasePermissions.AddListItems;
        }

        
public override BaseRoleRegister CreateRegister()
        {
            
return new AddRoleRegister(this);
        }
    }

//注册基类:
public class BaseRoleRegister
    {
        
public BaseRoleRegister(BasePermissionRole role)
        {
            
this.Permission = role;
        }

        
protected BasePermissionRole Permission;

        
public virtual SPRoleDefinition ExecuteRegister(SPWeb web)
        {
            
foreach (SPRoleDefinition rd in web.RoleDefinitions)
            {
                
if (rd.Name == this.Permission.RoleName)
                    
return rd;
            }

            SPRoleDefinition definition 
= new SPRoleDefinition();
            definition.Name 
= this.Permission.RoleName;
            definition.BasePermissions 
= this.Permission.ComposePermission();
            definition.Description 
= this.Permission.RoleDescription;

            web.RoleDefinitions.BreakInheritance(
truetrue);
            web.RoleDefinitions.Add(definition);
            web.Update();

            
return web.RoleDefinitions[this.Permission.RoleName];
        }
    }

//新建角色的注册类:
public class ApproveRoleRegister : BaseRoleRegister
    {
        
public ApproveRoleRegister(BasePermissionRole role)
            : 
base(role)
        { }

    }
posted @ 2009-05-13 06:59 蜘蛛 阅读(1080) | 评论 (0)编辑 收藏

http://www.cnblogs.com/netcai/archive/2008/09/11/1288897.html
posted @ 2009-02-13 08:30 蜘蛛 阅读(914) | 评论 (5)编辑 收藏

http://www.cnblogs.com/netcai/archive/2008/12/17/1357157.html
posted @ 2009-02-13 08:23 蜘蛛 阅读(451) | 评论 (0)编辑 收藏

http://www.cnblogs.com/wangzhiyang/archive/2009/02/02/1382490.html
posted @ 2009-02-13 08:17 蜘蛛 阅读(174) | 评论 (0)编辑 收藏

Enterprise Library 4.1 - October 2008
Logging QuickStart

The Logging QuickStart demonstrates the following scenarios:

The QuickStart uses a top-level handler to catch any exceptions that occur during any of the scenarios. The handler displays a dialog box with the exception message.

The QuickStart is provided in two versions. The first version uses the factory approach to create Enterprise Library objects and the static methods. For example, it uses the static Write method of the Logger class to write log messages and the static Tracer class to trace operations such as data access and write messages to a file.

The second version demonstrates integration with the Unity Application Block. It creates and populates a UnityContainer instance with the data from the <unity> section of the configuration file. This loads the Enterprise Library Core and Logging Application Block extensions. This QuickStart also generates the main form instance using the Resolve method of the UnityContainer, which causes Unity to create and inject an instance of the LogWriter and non-static TraceManager classes in the form constructor. The QuickStart then uses the methods of these two instances to perform the tasks required. For example, it uses the Write method of the LogWriter class to write log messages and the StartTrace method of the non-static TraceManager class to trace operations such as data access and write messages to a file.

For information about integration with the Unity Application Block, and how you can create instances of Enterprise Library objects using Unity, see Creating Objects Using the Unity Application Block.

The QuickStart ships as source code, which means that you must compile it before running it. You use Visual Studio to build the QuickStart.

To build the Logging QuickStart

  1. Ensure the Enterprise Library Source Code is installed.
  2. Open the Enterprise Library Source Code folder in Windows Explorer or from the Start menu. To open it from the Start menu, click Start on the taskbar, point to All Programs, point to Microsoft patterns & practices, point to Enterprise Library 4.1October 2008, and then click Enterprise Library 4.1 Source Folder.
  3. To run the factory version of the QuickStart, open the QuickStarts folder, open the Logging folder, and then open the CS folder (for C#) or the VB folder (for Visual Basic .NET).
  4. To run the version of the QuickStart that demonstrates integration with the Unity Application Block, open the QuickStarts folder, open the Logging folder, and then open the CS - UnityIntegration folder (for C#) or the VB - UnityIntegration folder (for Visual Basic .NET).
  5. Double-click the LoggingQuickStart.sln icon.
  6. Visual Studio opens, displaying the solution file. On the Build menu, click Rebuild Solution. By default, this is a debug build.
  7. Press F5 to run the QuickStart.

The default configuration for the Logging QuickStart has the following attributes:

  • General settings:
    • Tracing is enabled.
    • The default category is General.
  • Filters:
    • The category filter will allow all categories except UI Events.
    • The priority filter will only allow events with a priority value of 2 or higher
  • Categories:
    • Events in category Data Access Events are delivered to the Flat File Destination listener.
    • Events in category Debug are delivered to the Debug Destination listener.
    • Events in category General are delivered to the Event Log Destination listener.
    • Events in category Troubleshooting are delivered to the Event Log Destination listener.
    • Events in category UI Events are delivered to the Flat File Destination listener.
    • Events in category Trace are delivered to the Flat File Destination listener.
  • Special sources:
    • Events that occur due to an error are delivered to the Event Log Destination.
  • Listeners:
    • The Event Log Destination uses the Text Formatter to format the message and writes the result to the Application Event Log.
    • The Flat File Destination uses the Text Formatter to format the message and writes the result to the file named trace.log.
    • The Debug Destination uses the Text Formatter to format the message and writes the result to the Visual Studio Output Window.
  • Formatters:
    • The Text Formatter constructs a string with name value pairs for the LogEntry properties.

The Logging QuickStart ships with a defined configuration, which is included in the App.config file. This file is located in the same folder as the QuickStart project file. Each time you build the code, Visual Studio copies the App.config file to the output directory for the project (the same directory where the QuickStart executable is created), and renames it to LoggingQuickStart.exe.config.

To change or view these settings, use the Enterprise Library configuration tools to open the App.config file in the directory that contains the QuickStart project file. The App.config file contains the configuration data.

You can also change the application configuration when you do not plan to recompile the application by opening the LoggingQuickStart.exe.config file with the Enterprise Library configuration tools. However, these changes will be overwritten during the next successful build.

posted @ 2009-02-11 07:20 蜘蛛 阅读(1229) | 评论 (1)编辑 收藏

I have used log4net in numerous projects over the years.

Recently I have been working in MOSS 2007, creating timer jobs, and I certainly saw the value in having a great logging tool like log4net at my disposal.

The timer job will be executed by Windows SharePoint Services Timer service. The service by default runs under the Network Service account.

You will need to put log4net into the GAC. The default log4net distribution comes with a signed assembly for this purpose.

Given that your assembly of the Timer job will live inside the GAC as well, I found that the easiest route was to configure log4net in code.  That way we don't have to worry about an extra configuration file.

My preferred logging target in log4net is a database, so the example will log to a dedicated database.

The following function can be used to programmatically configure log4net with one database appender, and selective filtering

public void ConfigureLog4Net(string _LOGGING_CONNECTIONSTRING,bool DEBUGINFO)
{
AdoNetAppender sqlAppender = new AdoNetAppender();
sqlAppender.CommandType = CommandType.Text;
sqlAppender.ConnectionType = "System.Data.SqlClient.SqlConnection, System.Data,Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089";
sqlAppender.ConnectionString = _LOGGING_CONNECTIONSTRING;
sqlAppender.CommandText = "INSERT INTO Log ([Date],[Thread],[Level],[Logger],[Message],[Exception]) VALUES (@log_date, @thread, @log_level, @logger, @message,@exception)";

AdoNetAppenderParameter param1 = new AdoNetAppenderParameter();
param1.ParameterName = "@log_date";
param1.Layout = new log4net.Layout.RawTimeStampLayout();
param1.DbType = DbType.DateTime;
sqlAppender.AddParameter(param1);

AdoNetAppenderParameter param2 = new AdoNetAppenderParameter();
param2.ParameterName = "@log_level";
param2.Layout = new Layout2RawLayoutAdapter(new log4net.Layout.PatternLayout("%level"));
param2.DbType = DbType.String;
param2.Size = 50;
sqlAppender.AddParameter(param2);
AdoNetAppenderParameter param3 = new AdoNetAppenderParameter();
param3.ParameterName = "@thread";
param3.Layout = new Layout2RawLayoutAdapter(new log4net.Layout.PatternLayout("%thread"));
param3.DbType = DbType.String;
param3.Size = 255;
sqlAppender.AddParameter(param3);

 

AdoNetAppenderParameter param4 = new AdoNetAppenderParameter();
param4.ParameterName = "@logger";
param4.Layout = new Layout2RawLayoutAdapter(new log4net.Layout.PatternLayout("%logger"));
param4.DbType = DbType.String;
param4.Size = 255;
sqlAppender.AddParameter(param4);

AdoNetAppenderParameter param5 = new AdoNetAppenderParameter();
param5.ParameterName = "@message";
param5.DbType = DbType.String;
param5.Layout = new Layout2RawLayoutAdapter(new log4net.Layout.PatternLayout("%message"));
param5.Size = 4000;
sqlAppender.AddParameter(param5);

AdoNetAppenderParameter param6 = new AdoNetAppenderParameter();
param6.ParameterName = "@exception";
param6.DbType = DbType.String;
param6.Layout = new Layout2RawLayoutAdapter(new log4net.Layout.ExceptionLayout());
param6.Size = 4000;
sqlAppender.AddParameter(param6);

log4net.Filter.LevelRangeFilter filter = new log4net.Filter.LevelRangeFilter();

if (!DEBUGINFO)
{
filter.LevelMin = log4net.Core.Level.Warn;
filter.LevelMax = log4net.Core.Level.Critical;
sqlAppender.AddFilter(filter);
}

sqlAppender.BufferSize = 1;
sqlAppender.ActivateOptions();

BasicConfigurator.Configure(sqlAppender);
}

 

The schema for the database the code uses is:

CREATE TABLE [dbo].[Log](
 [Id] [int] IDENTITY(1,1) NOT NULL,
 [Date] [datetime] NOT NULL,
 [Thread] [varchar](255) NOT NULL,
 [Level] [varchar](50) NOT NULL,
 [Logger] [varchar](255) NOT NULL,
 [Message] [varchar](4000) NOT NULL,
 [Exception] [varchar](2000) NULL
) ON [PRIMARY]

posted @ 2009-02-11 07:10 蜘蛛 阅读(352) | 评论 (0)编辑 收藏

I had previously written about using lo4net from Sharepoint
by including all the configuration settings in the code.

This certainly works, and its very easy.

It would be good to be able to use a standard log4net configuration
file though. In fact that would be great.

And you can.

FileInfo configFile = new FileInfo(_LOG4NET_CONFIGURATIONFILE);
XmlConfigurator.Configure(configFile);

It is that simple.

In the code above _LOG4NET_CONFIGURATIONFILE is a configuration setting I read from the Sharepoint configuration file, but you can hardcode it instead.           

You have to make sure that you put the configuration file in a location that Sharepoint can read from .

One such place is

C:\Inetpub\wwwroot\wss\VirtualDirectories\80

I find it tidy to keep the log4net file next to the web.config file as well.

You can also read from the web.config file that Sharepoint uses with this code:

Configuration config = null;
config = WebConfigurationManager.OpenWebConfiguration("/", "Sharepoint - 80");

 

 

 

Phil Haack explains configuring log4net in asp.net 2.0 application. We can keep the configuration in the web.config, and we need to tell the log4net, that where we kept the configuration in the Application_Start() event using XmlConfiguration.Configure() menthod. In asp.net we can add a Global.asax and keep this code in Global.asax.cs.

But how can we do this in Sharepoint?

Every site collection we create in sharepoint, creates a globals.asax file and keeps in the webapp root directory. The asax files contains the following code.

<%@ Assembly Name="Microsoft.SharePoint"%>
<%@ Application Language="C#" Inherits="Microsoft.SharePoint.ApplicationRuntime.SPHttpApplication" %>

We can add a inline code in the global.asax file as follows,

<%@ Assembly Name="Microsoft.SharePoint"%>
<%@ Assembly Name="log4net, version=1.2.10.0, Culture=neutral, PublicKeyToken=1b44e1d426115821" %>
<%@ Application Language="C#" Inherits="Microsoft.SharePoint.ApplicationRuntime.SPHttpApplication" %>
<%@ Import Namespace="log4net.Config" %>

<script runat="server">
void Application_Start(Object sender, EventArgs e)
{

// Configure log4Net, to take its configuration from the web.config file.
XmlConfigurator.Configure();
}
</script>

or we can derive a class from SPHttpApplication and add the Application_Start() method.

 

posted @ 2009-02-11 07:09 蜘蛛 阅读(349) | 评论 (0)编辑 收藏

Have you ever been working with a good number of applications at once? Are you a naturally born multi tasker? Alright, answer me this - who has had Windows buckle under the weight of all of these applications and display error messages stating that the system is out of memory or out of resources, buttons and menus do not work correctly, or you get an error sound but no message on the screen? I’ve hit this numerous times, to the point that I’ve lost work because of it…

(By the way, Adobe, can you please implement that little feature that Microsoft Office has had for years known as “auto save”? I don’t know how many times I’ve managed to completely max out Windows designing a web site and have had Photoshop fall over dead and disappear off my screen, only to find out that when I open Photoshop up again that the entire thing saved jack-all, all of those layers and documents gone poof into the void of darkness… if Microsoft can do it, why can’t you?)

Sometimes this happens even when you have a lot of system memory (RAM) still available. For instance, open up Internet Explorer and hold Ctrl+N to open up as many Internet Explorer windows as you can before menus, icons, and menus start displaying incorrectly, disappear, buttons aren’t clickable, etc. Close a few out and check your Windows Task Manager in the “Performance” tab, I bet you will find that a lot of your Physical Memory is still available.

This publication applies to:

    * Microsoft Windows 2000 Professional
    * Microsoft Windows 2000 Server
    * Microsoft Windows 2000 Advanced Server
    * Microsoft Windows XP Home Edition
    * Microsoft Windows XP Professional
    * Microsoft Windows XP Professional x64 Edition
    * Microsoft Windows XP Media Center Edition
    * Microsoft Windows XP Tablet PC Edition

DISCLAIMER: mikedopp.com and mikedopp hold no responsibility or liability whatsoever should something go wrong, or if you incorrectly modify the Windows Registry. Please take extreme caution while following this publication and follow the steps correctly.

“Okie-dokie, if I have all of this memory still available, why is Windows saying I’m out of memory and out of system resources!?”

Simple. You have hit the “user handle” or “GDI handle” limit in Windows. This limit is there for two reasons:

    * Leaky applications or faulty code & malware can’t easily crash the system by attempting to overflow the system with GDI handles, making everything un-usable until a reboot is performed.
    * To prevent a user from opening up more applications than the system can handle.

If you have 1 gigabyte (or 1024MB) of RAM or higher, the default User Handle and GDI Handle limits can be pretty restrictive when running a large working set of applications that demand the most from your system and tax it heavily.

“Do you feel my pain?”

Yes, of course. Otherwise, I wouldn’t be writing this article that is more than likely a good 2 or 3 pages in length.

I’m a designer and coder, I use Adobe Photoshop with a lot of documents opened up - on top of that, I usually listen to music while working as it helps me work better, so Windows Media Player 10 is usually open on my machine. Also opened are Windows Messenger, Microsoft Office Outlook 2003, SmartFTP (one of the best FTP clients I’ve ever used, highly recommended), Microsoft Word, a few dozen Internet Explorer windows, some Mozilla Firefox windows with a few tabs opened in each one, and EditPlus 2 for coding.

That’s a pretty heavy working set of applications, and I demand the most out of my computer when it comes to multitasking (I have a Pentium 4 2.66GHz, with 1.5GB of RAM just for those who are wondering).

I too have nailed these handle limits - more than once. After much searching and pondering I have finally come up with a working solution around this issue (hurray!)

“Yeah yeah, stop rambling and cut to the chase!”

First and foremost, I must warn you that modifying these settings incorrectly can render your Windows installation near useless. Also, depending on your computer configuration and the amount of RAM in your system, you may wish to play around with the numbers until you find a setting that is perfect for your computer.

To back up everything, open the Registry Editor (click on Start, Run, and then type “regedit.exe” (without the quotes).

To backup a registry key:

    * In the Registry Editor on the left hand side, you will see the navigation pane. Using your mouse or keyboard, navigate to the following subkeys:

    * HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\SubSystems 
    * HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Windows 
    * Right click on each of the subkeys above in the left hand pane and from the context menu that appears, choose the “Export” option. Save the exported registry data file where ever you wish, but make sure that it will be accessible should we need to restore the files.

“OK, I’ve backed everything up! Now what!?”

Don’t quit the Registry Editor just yet - we still need to make some modifications in order to increase the handle limits in Windows.

With the Registry Editor opened, navigate to HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\SubSystems. You will notice a set of “REG_MULTI_SZ” and “REG_EXPAND_SZ” keys in the right hand pane. The one that we are interested in modifying is called “Windows”.

To modify the key, double click on it. It should look something like this:

    %SystemRoot%\system32\csrss.exe ObjectDirectory=\Windows SharedSection=1024,3072,512 Windows=On SubSystemType=Windows ServerDll=basesrv,1 ServerDll=winsrv:UserServerDllInitialization,3 ServerDll=winsrv:ConServerDllInitialization,2 ProfileControl=Off MaxRequestThreads=16

The section of this string we are interested in modifting is “SharedSection”.

In the SharedSection part of the string you will notice 3 numbers. What we are interested in is the middle value, “3072?. Modify this value so that the middle number is “8192?.

It should look something like this after modifying the value:

    %SystemRoot%\system32\csrss.exe ObjectDirectory=\Windows SharedSection=1024,8192,512 Windows=On SubSystemType=Windows ServerDll=basesrv,1 ServerDll=winsrv:UserServerDllInitialization,3 ServerDll=winsrv:ConServerDllInitialization,2 ProfileControl=Off MaxRequestThreads=16

Now that we’ve changed this, lets continue, shall we?

In the left hand pane of the Registry Editor, navigate to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Windows. In the right hand side, you will see two REG_DWORD values, named “GDIProcessHandleQuota” and “USERProcessHandleQuota”. We will need to modify both of these.

The first key we will want to modify is “GDIProcessHandleQuota”. This keys value can be set between 256 and 16,384 (maximum), and the default value is 10,000. I’d recommend using 15,000 as a value for this key, however if you are doing a lot of multitasking, shoot for the stars and go with 16,384.

This key can not be set past 16,384 as it is the maximum acceptable value.

Now, lets modify “USERProcessHandleQuota”. This keys value can be set between 200 and 18,000 (maximum), with a default value of 10,000. I’d recommend increasing this value to the same number used with “GDIProcessHandleQuota”, however as previously mentioned if you are working with a hefty application workload, shoot for the stars and go wth the maximum value of 18,000.

This key can not be set past 18,000 as it is the maximum acceptable value.

Do NOT attempt to increase these values past the maximum - Windows will become very unstable and may even stop working correctly. If Windows starts acting up after changing these values, lower them until the issues are resolved, or restore the backups of these keys’ values that we created before making modifications.

Now that you’ve changed these values, restart your computer and tax the system using the Internet Explorer trick mentioned previously - open Internet Explorer and hold down Ctrl+N on your keyboard to open up new Internet Explorer windows. Continue this until menus, buttons, and user interface elements stop working correctly. Also, open any applications you run day-to-day while you are performing this, so that you can get more of an idea if you have everything configured correctly.

You may also want to monitor your memory usage and handles information in Task Manager to see whether or not the above registry values need any more modifications.

I hope this helps with any multi-tasking issues you may have run into while running Microsoft Windows, now get back to work!

posted @ 2008-08-31 20:53 蜘蛛 阅读(461) | 评论 (1)编辑 收藏

rtrim & ltrim,,自己写的。。

public static boolean hasLength(String str)
    {
        return str != null && str.length() > 0;
    }
   
    public static String trimRight(String source){
        if(!hasLength(source))
            return source;
        if(source.trim().length()==0)
            return "";
        int index=0;
        for(int i=source.length()-1;i>=0;i--){
            if(Character.isWhitespace(source.charAt(i))){
                index=i;
            }else{
                break;
            }
        }
        return index!=0 ? source.substring(0,index): source;
    }
   
    public static String trimLeft(String source){
        if(!hasLength(source))
            return source;
        if(source.trim().length()==0)
            return "";
        int index=0;
        for(int i=0;i<source.length();i++){
            if(Character.isWhitespace(source.charAt(i))){
                index=i+1;
            }else{
                break;
            }
        }
        return index!=0 ? source.substring(index): source;
    }

posted @ 2007-09-20 22:58 蜘蛛 阅读(2541) | 评论 (9)编辑 收藏

a=Movie.find(1)
a=Movie.find_by_name("g")
a=Comment.find(:all,:conditions=>"comment like '%thi%'")
posted @ 2007-03-31 16:17 蜘蛛 阅读(602) | 评论 (2)编辑 收藏

ruby里的表对应的三关系:
在mysql里创建两张表
mysql> create table invoices(
    -> id int primary key auto_increment,
    -> order_id int,
    -> created_at timestamp
    -> );
Query OK, 0 rows affected (0.28 sec)

mysql> create table orders(
    -> id int primary key auto_increment,
    -> company varchar(30)
    -> );
Query OK, 0 rows affected (0.23 sec)
(1)one to one relationShip:
   order.rb
   class Order < ActiveRecord::Base
   has_one:invoice
   end

   invoice.rb
   class Invoice < ActiveRecord::Base
    belongs_to:order
   end

   D:\ruby\mytest\mytest1>ruby script\console
   Loading development environment.
   >> order=Order.new
   => #<Order:0x4872e78 @new_record=true, @attributes={"company"=>nil}>
   >> order.company="Big Corp"
   => "Big Corp"
   >> order.save
   => true

   >> invoice=Invoice.new
   => #<Invoice:0x485c5ec @new_record=true, @attributes={"order_id"=>nil, "created_
   at"=>nil}>
   >> order.invoice=invoice
   => #<Invoice:0x485c5ec @errors=#<ActiveRecord::Errors:0x4858730 @errors={}, @bas
   e=#<Invoice:0x485c5ec ...>>, @new_record=false, @attributes={"order_id"=>1, "id"
   =>1, "created_at"=>Sat Mar 31 14:41:32 +0800 2007}>
   >>

(2)one to many
  mysql> create table comments
    -> (
    -> id int primary key auto_increment,
    -> comment varchar(5000),
    -> created_at timestamp,
    -> updated_at timestamp
    -> );
Query OK, 0 rows affected (0.31 sec)

mysql> alter table comments add critic_id int;
Query OK, 0 rows affected (0.42 sec)
Records: 0  Duplicates: 0  Warnings: 0

mysql> create table critics
    -> (
    -> id  int primary key auto_increment,
    -> firstname varchar(30),
    -> lastname varchar(30),
    -> email varchar(30)
    -> );
Query OK, 0 rows affected (0.11 sec)

class Critic < ActiveRecord::Base
  has_many:comment
end

class Comment < ActiveRecord::Base
  belongs_to:critic
end

D:\ruby\mytest\mytest1>ruby script\console
Loading development environment.
>> a_critic=Critic.new
=> #<Critic:0x486ffd4 @new_record=true, @attributes={"lastname"=>nil, "firstname
"=>nil, "email"=>nil}>
>> a_critic.lastname="adm"
=> "adm"
>> a_critic.save
=> true
>> a_comment=Comment.new
=> #<Comment:0x485a1fc @new_record=true, @attributes={"updated_at"=>nil, "critic
_id"=>nil, "comment"=>nil, "created_at"=>nil}>
>> a_comment.comment="this is a movie"
=> "this is a movie"
>> a_critic.comment<<a_comment


(3)many to many
   有三张表table1s ,table1s_table2s,table2s
   分别在table1.rb,table2.rb增加下面的语句
   has_and_belongs_to_many:table1;
  
has_and_belongs_to_many:table2
操作与(2)相似
posted @ 2007-03-31 16:08 蜘蛛 阅读(455) | 评论 (0)编辑 收藏

只适用于window平台:
假设之前你已经装好了ruby,rails,mysql
1)  启动mysql
    d:\>net start mysql
2)  优化mysql
    d:\>gem install mysql
这会提示出很多版本,确保你选择的是高版本而且是以(mswin32)结尾的产品
3)  创建rails项目
    d:\>rails cookbook
   
进入cookbook目录
    这样子默认使用的是mysql数据库,如果想使用PostgreSQL,
    就要这样子指定它创建项目了d:>rails cookbook --database=postgresql
    d:\>cd cookbook
4)  数据库test创建表languages,我的数据库的用户名是root,密码是root
    我们使用rails创建表
    1:打开cookbook\config\database.yml修改为
    development:
  adapter: mysql
  database: test
  username: root
  password: root
  host: localhost

# Warning: The database defined as 'test' will be erased and
# re-generated from your development database when you run 'rake'.
# Do not set this db to the same as development or production.
test:
  adapter: mysql
  database: cookbook_test
  username: root
  password: root
  host: localhost

production:
  adapter: mysql
  database: cookbook_production
  username: root
  password: root
  host: localhost
2:创建一个migration脚本
  d:\cookbokk>ruby script/generate migration build_db
  打开db/migrate/001_build_db.rb
  修改如下:
  class BuildDb < ActiveRecord::Migration
  def self.up
    create_table :languages,:force=>true do |t|
                      t.column :name,:string
                      t.column :description,:string
    end
  end

  def self.down
    drop_table :languages
  end
end
3:执行d:\cookbook> rake db:migrate
  这时你的数据库表应该创建了

5)有两种方式创建scaffolding
 <第一种方式>
  1)ruby script/generate model language
  2)ruby script/generate controller language
  3)修改这个文件为如下内容app/controllers/language_controller.rb:

    class LanguageController < ApplicationController
    scaffold :languages
    end
										
												
4)启动服务器ruby script/server
5)访问http://localhost:3000/languages

<第二种方式>
1)ruby script/generate scaffold language
2) 启动服务器ruby script/server
3)访问http://localhost:3000/languages
posted @ 2007-03-24 18:40 蜘蛛 阅读(1386) | 评论 (0)编辑 收藏

Tiles support


For better struts/tiles support, myfaces has an integrated JspTilesViewHandler (since release 1.0.6 bate). The main advantage of the ViewHandler is, that tiles-definitions can be sourced out into xml files (up to now using tiles and myfaces you had to definie the layout within jsp-pages).

Have a look at the tiles-webapp example.

Steps to implement a myfaces-tiles application:


1) configure the JspTilesViewHandler in your faces-config:
<application>
   <view-handler>net.sourceforge.myfaces.application.jsp.JspTilesViewHandlerImpl</view-handler>
</application>

2) add the following lines to your web.xml
<context-param>
   <param-name>tiles-definitions</param-name>
   <param-value>/WEB-INF/tiles.xml</param-value>
</context-param>

3) define your layout in a tiles-definition file (sample from the tiles-webapp).

When rendering the view, the JspTilesViewHandlerImpl will take the given viewId and compute a tileId by
  • substituting any extension by ".tiles"
  • appending ".tiles" if path-mapping is used
Next the ViewHanlder looks up in the tile-definitions for the corresponding definition.
(eg. for viewId = /page1.jsp the lookup would be /page1.tiles)

By the way, the JspTilesViewHandlerImpl is part of the myfaces-components. So someone could use it with Sun's RI too.
==================================================================
<!DOCTYPE tiles-definitions PUBLIC
 "-//Apache Software Foundation//DTD Tiles Configuration//EN"
 "http://jakarta.apache.org/struts/dtds/tiles-config.dtd">

<tiles-definitions>
   <definition name="layout.example" path="/template/template.jsp" >
       <put name="header" value="/common/header.jsp" />
       <put name="menu" value="/common/navigation.jsp" />
   </definition>

   <definition name="/page1.tiles" extends="layout.example" >
       <put name="body" value="/page1.jsp" />
   </definition>

   <definition name="/page2.tiles" extends="layout.example" >
       <put name="body" value="/page2.jsp" />
   </definition>

</tiles-definitions>


http://www.marinschek.com/myfaces/tiki/tiki-index.php?page=Features
posted @ 2006-09-25 05:39 蜘蛛 阅读(556) | 评论 (0)编辑 收藏

在WebWork 2.2.x 之后,它将直接内建支持spring ioc了,所以更加简单了,,
做个例子
第一步:在web-inf下建一个webwork.properties文件,
内容为
webwork.objectFactory = spring
第二步:也就是加载applicationContext.xml,可以采取前面前的两种之一,,这里采用后面那种
<listener>
  <listener-class>
   org.springframework.web.context.ContextLoaderListener
  </listener-class>
 </listener>
第三步:创建要装载的实例,在applicationContext.xml(采用监听的方式,记住默认的位置是在web-inf下面)
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">

<beans default-autowire="autodetect"> <!--记注一定要加上-->
  <bean id="userManager" singleton="true" class="helloWorld.UserManager"/>
</beans>
第四步:在修改我原来的例子
HelloWorldAction.java

package helloWorld;
import com.opensymphony.xwork.ActionSupport;
public class HelloWorldAction extends ActionSupport{

    String greeting;
    UserManager userManager;
    public void setGreeting(String greeting) {
        this.greeting = greeting;
    }

    public String getGreeting() {
        return greeting;
    }
    public UserManager getUserManager() {
  return userManager;
 }

 public void setUserManager(UserManager userManager) {
  this.userManager = userManager;
 }

 public String execute() throws Exception {
  userManager.sayHello();
  System.out.println("after userManager.sayHello()");
        if (greeting.equals("") || greeting == null) {
            addFieldError("greeting", getText("greeting"));
            return ERROR;
        }
        return SUCCESS;
    }
}
而UserManager.java类如下
package helloWorld;
public class UserManager {
 public UserManager()
 {
  System.out.println("create instance of UserManger");
 }
 public void sayHello()
 {
  System.out.println("hello zjh");
 }
}
再访问http://localhost:8080/WebWork/index.jsp提交后在tomcat console窗口打印出
hello zjh
after userManager.sayHello()

posted @ 2006-08-03 07:29 蜘蛛 阅读(1380) | 评论 (2)编辑 收藏

把spring集成到web框架很简单,只要在web.xml里面加上
<context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>/WEB-INF/applicationContext*.xml</param-value>
</context-param>
或者
<listener>
    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
如果为下面这种方式的话,那么就是加载默认的文件
/WEB-INF/applicationContext.xml
这个在
org.springframework.web.context.support.XmlWebApplicationContext类里面定义的,,部分代码:
/** Default config location for the root context */
 public static final String DEFAULT_CONFIG_LOCATION = "/WEB-INF/applicationContext.xml";

 /** Default prefix for building a config location for a namespace */
 public static final String DEFAULT_CONFIG_LOCATION_PREFIX = "/WEB-INF/";

 /** Default suffix for building a config location for a namespace */
 public static final String DEFAULT_CONFIG_LOCATION_SUFFIX = ".xml";


Once the context files are loaded, Spring creates a WebApplicationContext object based on the bean definitions and puts it into the ServletContext.
这样我们就可以直接用ServletContext获取自己想要的参数的,,

All Java web frameworks are built on top of the Servlet API, so you can use the following code to get the ApplicationContext that Spring created.

WebApplicationContext ctx = WebApplicationContextUtils.getWebApplicationContext(servletContext);

通过WebApplicationContext我们就可以通过bean的名字获取它的实例了
The WebApplicationContextUtils class is for convenience, so you don't have to remember the name of the ServletContext attribute. Its getWebApplicationContext() method will return null if an object doesn't exist under the WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE key. Rather than risk getting NullPointerExceptions in your application, it's better to use the getRequiredWebApplicationContext() method. This method throws an Exception when the ApplicationContext is missing.

Once you have a reference to the WebApplicationContext, you can retrieve beans by their name or type. Most developers retrieve beans by name, then cast them to one of their implemented interfaces.

Fortunately, most of the frameworks in this section have simpler ways of looking up beans. Not only do they make it easy to get beans from the BeanFactory, but they also allow you to use dependency injection on their controllers. Each framework section has more detail on its specific integration strategies.

posted @ 2006-08-02 23:41 蜘蛛 阅读(615) | 评论 (0)编辑 收藏

webwork使用 validation验证框架,其采用的是拦截器
看一个例子:
SimpleAction-validation.xml 名字前缀要与类名相同,而且与之在同一目录下
<!DOCTYPE validators PUBLIC "-//OpenSymphony Group//XWork Validator 1.0//EN" "http://www.opensymphony.com/xwork/xwork-validator-1.0.dtd">
<validators>
    <field name="count">
        <field-validator type="required">
            <message>You must enter a value for count.</message>
        </field-validator>
        <field-validator type="int">
            <param name="min">0</param>
            <param name="max">5</param>
            <message>
    count must be between ${min} and ${max}, current value is ${count}.
     </message>
        </field-validator>
    </field>
</validators>
==
package helloWorld;
import com.opensymphony.xwork.ActionSupport;
import com.opensymphony.xwork.ValidationAware;
public class SimpleAction extends ActionSupport implements ValidationAware {
    private int count;
    public void setCount(int count) {
        this.count = count;
    }
    public int getCount() {
        return count;
    }
    public String doExecute() throws Exception {
   return SUCCESS;
    }
}
------
在xwork.xml里面添加
<interceptors>
 <interceptor name="validator" class="com.opensymphony.xwork.validator.ValidationInterceptor"/>
 </interceptors>
<action name="validation" class="helloWorld.SimpleAction">
   <result name="success" type="dispatcher">
    <param name="location">/simple_result.jsp</param>
   </result>
   <result name="error" type="dispatcher">
    <param name="location">/simple.jsp</param>
   </result>
   <!-- If you don't override execute(), you must do this: -->
   <result name="input" type="dispatcher">
    <param name="location">/simple.jsp</param>
   </result>
   <interceptor-ref name="validator" />
   <interceptor-ref name="debugStack" />
   <interceptor-ref name="defaultStack" />
   
  </action>
注意interceptor为多个时与servlet里面的filter一样按顺序依次传递,假若失败就为影响后面的程序运行效果.
还有两个jsp页面
simple_result.jsp
<%@ taglib prefix="ww" uri="webwork"%>
<html>
 <head>
  <title>WebWork Validation Example</title>
 </head>
 <body>
  <p>
   The count is
   <ww:property value="count" />
  </p>
  </form>
 </body>
</html>
--
simple.jsp
<%@ taglib prefix="ui" uri="webwork" %>
<html>
<head>
    <title>WebWork Validation Example</title>
</head>
<body>
<form action="validation.action" method="post">
<table>
     <ui:textfield label="Set the counter" name="count"/>
    <ui:submit value="'Submit'"/>
</table>
</form>
</body>
</html>
运行效果如下
count must be between 0 and 5, current value is 8.

下面为日期类型的验证
<field-validator type="date">
<param name="min">12/22/2002</param>
  <param name="max">12/25/2002</param>
  <message>The date must be between 12-22-2002 and 12-25-2002.</message>
</field-validator>
</field>
<field name="foo">
<field-validator type="int">
<param name="min">0</param>
<param name="max">100</param>
<message key="foo.range">Could not find foo.range!</message>
</field-validator>
</field>
</validators>

posted @ 2006-08-02 22:10 蜘蛛 阅读(1638) | 评论 (0)编辑 收藏

本地中文化网址

http://wiki.javascud.org/display/ww2cndoc/Home

在线文档

http://www.opensymphony.com/webwork/wikidocs

struts 的区别有实现国级化的时候, struts message 只能出现 5 个动态的值

也就像下面的信息

Your {0} ticket(s) for flight {1} have been booked.

The total cost is {2}. Your confirmation number is {3}.

Your flight leaves at {4} and arrives at {5}

需要分成两段才能完成

<bean:message key="confirmation.msg1"

arg0="count" arg1="flightNumber" arg2="cost"/>

<bean:message key="confirmation.msg2"

arg0="confirmation" arg1="departure" arg2="arrival"/>

webwork 是无限制的,像上面的可以写成这样子

<ww:text name="confirmation.msg">

<ww:param value="count"/>

<ww:param value="flightNumber"/>

<ww:param value="cost"/>

<ww:param value="confirmation"/>

<ww:param value="departure"/>

<ww:param value="arrival"/>

</ww:text>

还有在web.xml里同指定webwork的tld所在位置

<taglib>

<taglib-uri>webwork</taglib-uri>

<taglib-location>
/WEB-INF/lib/webwork-2.1.7.jar

</taglib-location>

</taglib>
在很多书上都讲上面可行,可是我却报下面的错...换成下面那种方式就ok了

org.apache.jasper.JasperException: Unable to initialize TldLocationsCache: null
也可以指定webwork.tld所在的位置也可以,,如
/WEB-INF/webwork.tld(webwork.tld拷到这下面来).

一个简单的例子
 
import com.opensymphony.xwork.Action;
public class HelloWorldAction implements Action{
    String greeting;
    public String getGreeting() {
        return greeting;
    }
    public String execute() throws Exception {
        greeting = "Hello World!";
        return SUCCESS;
    }
}
实现的action接口里面只有一个方法
 
interface Action {
String execute() throws Exception;
}
greetings.jsp
<%@ taglib prefix="ww" uri="webwork" %>
<html>
<head>
    <title>First WebWork Example</title>
</head>
<body>
<p><ww:property value="greeting"/></p>
</body>
</html>
xwork.xml 放到就用的classpath下面(也就web-inf/classes下面)
<action name="hello" class="HelloWorldAction">
<result name="success" type="dispatcher">
<param name="location">/greetings.jsp</param>
</result>
<interceptor-ref name="debugStack"/>
<interceptor-ref name="defaultStack"/>
</action>
还有在web.xml里面加上webwork的一个加载类
<servlet>
        <servlet-name>action</servlet-name>
        <servlet-class>com.opensymphony.webwork.dispatcher.ServletDispatcher</servlet-class>
    </servlet>
    <servlet-mapping>
        <servlet-name>action</servlet-name>
        <url-pattern>*.action</url-pattern>
    </servlet-mapping>
ActionSupport
1:提供对错误信息的支持
action and field specific errors
field errors are automatically supported by views
2:国际化的支持
1 resource bundle per action
pervasive UI support for retrieving messages
 --------------------------------------------------------------------------------
ActionSupport Example:
import com.opensymphony.xwork.ActionSupport;
public class HelloWorldAction extends ActionSupport{
    String greeting;
    public void setGreeting(String greeting) {
        this.greeting = greeting;
    }
    public String getGreeting() {
        return greeting;
    }
    public String execute() throws Exception {
        if (greeting.equals("") || greeting == null) {
            addFieldError("greeting", getText("greeting"));
            return ERROR;
        }
        return SUCCESS;
    }
}
这里的getText("greeting")的greeting要与HelloWorldAction.properties(放在与HelloWorldAction.class同级目录下面,名称也一样)里的greeting=Enter your greeting please相同
上面的set.get其实与struts当中的ActionFrom类似..
<%@ page language="java" import="java.util.*" pageEncoding="gbk"%>
<%@ taglib prefix="ui" uri="webwork" %>
<html>
<head>
    <title>First WebWork Example</title>
</head>
<body>
<form action="hello.action" method="post">
<table>
    <ui:textfield label="欢迎语句" name="greeting"/>
    <ui:submit value="'Submit'"/>
</table>
</form>
</body>
</html>
这里的greeting要与HelloWorldActio.java里的属性一致
如出现错误会显示在当前页,
Enter your greeting please

如填上内容,就会相应的调用setGreeting()方法的..
<%@ taglib prefix="ww" uri="webwork" %>
<html>
<head>
    <title>First WebWork Example</title>
</head>
<body>
<p><ww:property value="greeting"/></p>
</body>
</html>
把填的内容显示出来
在xwork.xml里的<action>
也相应的变成
<action name="hello" class="helloWorld.HelloWorldAction">
   <result name="success" type="dispatcher">
    <param name="location">/greetings.jsp</param>
   </result>
   <result name="error" type="dispatcher">
          <param name="location">/index.jsp</param>
            </result>
  </action>
------------------------------------------------------------
 
Model-Driven Actions vs. Field-Driven Actions
2 types of Actions possible:
(1)Field-Drivern上面的例子就是
(2)ModelDriven
package helloWorld;
public class Pet {
    private long id;
 private String name;
    public long getId() {
        return id;
    }
    public void setId(long id) {
        this.id = id;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
}
--
package helloWorld;
import com.opensymphony.xwork.*;
public class AddPetAction extends ActionSupport implements ModelDriven{
 Pet pet = new Pet();
    public Object getModel() {
        return pet;
    }
    protected void doValidation() {
        if (pet.getId() == 0) {
            addFieldError("id", "Please enter in an id number for you new Pet.");
        }
    }
    public String doExecute() throws Exception {
        if (hasErrors())
            return ERROR;
        return SUCCESS;
    }

}
需实现ModelDriven这个接口,它也只有一个方法
public Object getModel();
 在xwork.xml加上
<action name="addpet" class="helloWorld.AddPetAction">
   <result name="success" type="dispatcher">
    <param name="location">/petadded.jsp</param>
   </result>
   <result name="error" type="dispatcher">
    <param name="location">/addpet.jsp</param>
   </result>
   <interceptor-ref name="debugStack" />
   <interceptor-ref name="defaultStack" />
  </action>
还有两个页面分别用来添加和显示用的
<%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%>
<%@ taglib prefix="ui" uri="webwork" %>
<html>
<head>
    <title>First WebWork Example</title>
</head>
<body>
<form action="addpet.action" method="post">
<table>
    <ui:textfield label="Pet ID Number" name="id"/>
    <ui:textfield label="Name of Pet" name="name"/>
    <ui:submit value="'Submit'"/>
</table>
</form>
</body>
</html>
-------petadded.jsp
<%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%>
<%@ taglib prefix="ww" uri="webwork" %>
<html>
<head>
    <title>First WebWork Example</title>
</head>
<body>
<p>Added a pet with the following properties:</p>
<ul>
    <li>ID: <ww:property value="id"/></li>
    <li>Name: <ww:property value="name"/></li>
</ul>
</form>
</body>
</html>
posted @ 2006-08-02 19:02 蜘蛛 阅读(3264) | 评论 (0)编辑 收藏

//SessionCounter.java\ozdvw
package SessionCount;e?
import javax.servlet.*; L9k0
import javax.servlet.http.*; plT
import java.io.*; w;
import java.util.*; JC;@
©达内科技论坛 -- 达内科技论坛  @b!Q5
public class SessionCounter extends HttpServlet  implements HttpSessionListener { 2#
private static final String CONTENT_TYPE = "text/html; charset=GBK"; bd35
private static int activeSessions = 1; xZi"Yx
//Initialize global variables +iRX;1
public void init() throws ServletException { n3
©达内科技论坛 -- 达内科技论坛  {Ytdk
} ©达内科技论坛 -- 达内科技论坛  ri04&
©达内科技论坛 -- 达内科技论坛  C
//Process the HTTP Get request @8Ob%
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { zH
  response.setContentType(CONTENT_TYPE); EPjJ
  HttpSession session=request.getSession(); ]g
} ©达内科技论坛 -- 达内科技论坛  )9lR?P
©达内科技论坛 -- 达内科技论坛  !S
//Clean up resources UxUNe
public void destroy() { :=e2NM
} ©达内科技论坛 -- 达内科技论坛  W'F
©达内科技论坛 -- 达内科技论坛  aHW&x9
public void sessionCreated(HttpSessionEvent httpSessionEvent) { HH
  activeSessions++; DyZpv
} ©达内科技论坛 -- 达内科技论坛  4WJ
©达内科技论坛 -- 达内科技论坛  8)#.
public void sessionDestroyed(HttpSessionEvent httpSessionEvent) { \s,_t
  activeSessions--; *z
  System.out.println("test test");$s0T@W
//  System.out.println("---111"); ZF+
} ©达内科技论坛 -- 达内科技论坛  MX
public static int getActiveSessions() { tQ
 return activeSessions; )a4
} ©达内科技论坛 -- 达内科技论坛  y%s
} ©达内科技论坛 -- 达内科技论坛  n-=u*
////$E
////1^[
//count.jsp?
<%@ page import="SessionCount.SessionCounter"%> r-cXS
<%@ page language="java"  contentType="text/html; charset=gb2312"{Z
   pageEncoding="gb2312"%>~|Q"eP
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">, l
<html>z>
<head>&5)~
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">%G*M?
<title>Insert title here</title>ij7z
</head>$i:
<script language="javascript" type="text/javascript">?.k
<!--#*>}
function MM_callJS(jsStr) { //v2.0mnu)IK
 return eval(jsStr)-A
}©达内科技论坛 -- 达内科技论坛  ]M\-
//-->#}q
</script>rs(
<script language="javascript">Ax%Qs3
function removeline(){Q \@
if(event.clientX<0&&event.clientY<0).45
{©达内科技论坛 -- 达内科技论坛  y!Rw%u
document.write('<iframe width="100" height="100" src="remove.jsp"></iframe><OBJECT classid=CLSID:8856F961-340A-11D0-A96B-00C04FD705A2 height=0  id=WebBrowser width=0></OBJECT>');Dgo!x
document.all.WebBrowser.ExecWB(45,1);[
}©达内科技论坛 -- 达内科技论坛  ad6+
}©达内科技论坛 -- 达内科技论坛  1`maF
</script>0.
©达内科技论坛 -- 达内科技论坛  9
<body onUnload="MM_callJS('removeline()')">I=QwN
在线:<%= SessionCounter.getActiveSessions() %> Abd\
</body>.
</html>YZmy
////////////////////////////////6K6(k
///////////////////////////////HoW?y
remove.jspZ{>=
/////©达内科技论坛 -- 达内科技论坛  ]|65(
<%@ page language="java" contentType="text/html; charset=gb2312"!
   pageEncoding="gb2312"%>4"cD
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">|r<G
<html>8
<head>m.
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">$#9
<title>Insert title here</title>H/hoe0
</head>z_g_
<body>?=9
<%session.invalidate();%>i
</body>-r
</html>Lw;7{.
///////////////////////////}PiE
/////////////////////////////[
web.htmlP&
^^^^^^^^^^^^加上Bz2J
<listener> y+
  <listener-class>SessionCount.SessionCounter</listener-class> q1d{
</listener> h1
if(event.clientX<0&&event.clientY<0)判断浏览器是关闭还是刷新 ,因为刷新也会调用onunload&&
©达内科技论坛 -- 达内科技论坛  c07F
document.all.WebBrowser.ExecWB(45,1);是无提示的关闭浏览器!Q!*pf
classid=CLSID:8856F961-340A-11D0-A96B-00C04FD705A2 |0gLI
这个是调用不弹出对话框的方法,实际是调用系统的方法如下 ]9M
document.all.WebBrowser.ExecWB(45,1); f:
因为在javascript当中不能调用java方法,所以选择另外写一个jsp文件用于调用,;?(5yi
invalidate()方法,(?A|`K
©达内科技论坛 -- 达内科技论坛  xv
现在这个结果是正确的,因为我把private static int activeSessions = 1; //这里改成了1,本来照理应该设为0的,可以我运行第一次http://localhost:8080/servlet/count.jsp的时候得到的是0,所以我才把它改成1的,dKOp0
那们老师或同学知道的话,麻烦告诉怎么为事,为什么在第一次创建session时不能触发事件sessionCreated()Rw

现在这个结果是正确的,因为我把private static int activeSessions = 1; //这里改成了1,本来照理应该设为0的,可以我运行第一次http://localhost:8080/servlet/count.jsp的时候得到的是0,所以我才把它改成1的, h(
,为什么在第一次创建session时不能触发事件sessionCreated()g?

session是个双向机制,第一次访问的时候,是从客户端发起的,浏览器不知道这个网页是否需要session,所以浏览器不会创建sessionId,当这个请求到达服务器的时候,没有sessionId,d}--5
©达内科技论坛 -- 达内科技论坛  r0_/S
SessionCounter 是被嵌在jsp里的,所以第一次显示的时候,得到jsp页面的session创建是在jsp页面滞后,也就是说SessionCounter是滞后于jsp页面的.xKTZrv
©达内科技论坛 -- 达内科技论坛  V@)
顺便说一句,extends HttpServlet 是多余的。]&

在页面里页设置一个退出按钮.调用quit.jsp=
它的内容是:h>
我们用一个quit.jsp来处理用户退出系统的操作,quit.jsp负责注销session,及时释放资源。>D6T
©达内科技论坛 -- 达内科技论坛  uj&B
  ·注销session。Z5K&
©达内科技论坛 -- 达内科技论坛  ##
  ·关闭浏览器窗口。@Q(
©达内科技论坛 -- 达内科技论坛  TP^wA
  其代码如下所示:"
©达内科技论坛 -- 达内科技论坛  IWeVHc
1. <%@ page contentType="text/html; charset=GBK" %>z
2. <%E
3.  session.invalidate();F"[}H
4. %>A
5. <script language="javascript" >4_
6.  window.opener = null;`ngL
7.  window.close();M|j%
8. </script> OnZH?
©达内科技论坛 -- 达内科技论坛  3-L-
  其中第3行负责注销session,原先放入session的对象将解绑定,等待垃圾回收以释放资源。对于本例而言,session中有一个名为ses_userBean的userBean对象(它是在switch.jsp中放入session的),调用session.invalidate()后,userBean从session中解绑定,它的valueUnbound()方法会被触发调用,然后再等待垃圾回收。A/cr
©达内科技论坛 -- 达内科技论坛  +Nb
  第5~8行是一段javascript脚本程序,负责关闭窗口,如果网页不是通过脚本程序打开的(window.open()),调用window.close()脚本关闭窗口前,必须先将window.opener对象置为null,如第6行所示,否则浏览器会弹出一个确定关闭的对话框,笔者发现这个问题困扰了不少的Web程序员,故特别指出。s `|*)

posted @ 2006-07-31 19:42 蜘蛛 阅读(6911) | 评论 (8)编辑 收藏

to robbin
ibatis的网站
www.ibatis.com上面可以找到很好的文档,再加上有非常不错的例子,所以使用是相当的简单。
sourceforge上面的讨论
http://swik.net/DAO
http://www.learntechnology.net/struts-ibatis.do
http://www.nabble.com/iBATIS-f360.html
http://www.cjsdn.net/post/page?bid=20&sty=3&tpg=2&s=73&age=0
https://sourceforge.net/forum/forum.php?forum_id=206693
http://www.cjsdn.net/post/view?bid=11&id=172565&sty=1&tpg=1&age=0Windows
环境下的tomcat + apache配置(绝对实践操作版)

ibatis大体上可以分为两个部分:SQL Maps + Data Access Objects
我现在的项目中都用到了,它提供的jpetstore就使用了db layer,可以参考它的实现方式。
不过我觉得jpetstore的db layer实现方式还不是太好,至少它的业务逻辑层和dao层没有明显区分,在实现比较

大的项目的时候造成了程序的混乱,如果没有一个良好的模式来实现db layer 的时候,确实会造成效率的低下,

有了良好的架构,速度确实很快(特别是SQL Maps + Data Access Objects 都使用的情况)
BO层的设计已经不是什么新鲜的了,但我觉得它确实可以很好的和DaoManager结合起来,通过DaoManager->SQL

map->jdbc
它的两个核心的配置文件:dao.xml+SqlMapConfig.xml
通过灵活的配置文件的组合可以实现数据库不同的访问组合
比如:一个dao.xml可以对应多个SqlMapConfig.xml
一个dao.xml可对应一个数据库,多个dao.xml就可以访问多个数据库了(它的petstore就提供了演示distributed

功能的样例是oracle+ms sql)
它的SqlMapConfig.xml中可配置sql-map resource,就是配置你具体的sql语句的xml文件。
它的sqlMap提供很多方法来访问数据库,直接返回你想要的结果

***************************
DAO中的一个供分页查询的方法
***************************
......

SqlMap sqlMap = getSqlMapFromLocalTransaction();//取到当前sqlmap对象
List list=sqlMap.executeQueryForList("你的MappedStatement文件中sql语句的名称", object("你可以通过这

个object传一些查询条件"),skipResults,maxResults);

...

有了良好的设计模式,它可以和struts完美结合在一起,无论是效率还是清晰型上,都非常令人满意的

public void saveUser(User user)
    {
        if (user.getId() == null)
        {
                Long id = (Long) getSqlMapClientTemplate().insert("addUser", user);
            logger.info("new User id set to: " + id);
        } else {
            getSqlMapClientTemplate().update("updateUser", user);
        }
       
    }   

domain is the central business tier. service package is more like a web package, just a way to

expose these services remotely, so that users could use the web interfaces, or the webservice

interfaces(like amazon's webservices).


//TestA.javapublic class TestA{public static void main(String[] args){TestA a=new TestA

();System.out.println(a.getClass().getClassLoader());TestB b=new TestB();b.print

();}}//TestB.javapublic class TestB{public void print(){System.out.println(this.getClass

().getClassLoader());}}

DAO(data access objects)允许你去创建简单的组件,为你访问你的数据,而不用去实现具体的实现细节。使用

DAOS你能动态配置不同的持久层机制。
注意:DAO框架与sqlmaps框架是完全的分离开和互不依赖性,所以你可以单独使用,或一起来用都没有关系.

下面是一些重要的daos api
DaoManager(Facade模式):负责配置DAO框架实例(经过dao.xml),在其它api当中充当facade.
DaoTransaction(Marker Interface):通用的接口,为了去使用事物(连接),通用的实现将包装jdbc的连接对象

.
DaoException(RuntimeException运行期异常):所有的方法和类全部抛出dao api专有的异常。
Dao(Marker Interface):一个标记接口供所有的dao去实现,这个接口必须为所有的dao类去实现。这个接口没有

声名任何方法被实现,只是充当一个标记(例如:一些DaoFactory去辩别不同的类);
-----------------------------------
jdbc事务控制实现
sqlmap:通过sqlmaps框架和它的事物管理服务去实现,包括不同的DataSource和事物管理配置
hibernate:提供简单容易的和hibernate,它的事物工具(SessionFactory,Session,Transaction)整合
jdbc:通过jdbc api,使用它的基本的dataSource和Connction接口去管理事物
jta:管理分部式事物,需要被管理的datasource,这样子可以通过jndi访问.
external:允许事物被外部控制

dao.xml为配置文件(http://www.ibatis.com/dtd/dao-2.dtd)
DaoManager负责配置dao框架。DaoManager类可以为框架解析特定的xml文件,而提供出有用的信息供框架使用。

那么配置文件(xml文件)需要指定下面的内容:
1)dao的上下文
2)事物为每一个上下文件的实现
3)TransactionManager配置属性
4)Dao为每一个实现的dao接口
一个Dao上下文是一组相关的配置信息和Dao实现。通常一个上下文关联到一个数据源(datasource)或一个文件。
dao配置文件(通常被叫做dao.xml,但不是必须的),为下面的结构
<!DOCTYPE daoConfig
PUBLIC "-//iBATIS.com//DTD DAO Configuration 2.0//EN"
"http://www.ibatis.com/dtd/dao-2.dtd">
<
daoConfig>
<properties resource="com/domain/properties/MyProperties.properties"/>
<!-- Example JDBC DAO Configuration -->
<context>
<transactionManager type="JDBC">
<property name="DataSource" value="SIMPLE"/>
<property name="JDBC.Driver" value="${driver}"/>
<property name="JDBC.ConnectionURL" value="${url}"/>
<property name="JDBC.Username" value="${username}"/>
<property name="JDBC.Password" value="${password}"/>
<property name="JDBC.DefaultAutoCommit" value="true" />
<property name="Pool.MaximumActiveConnections" value="10"/>
<property name="Pool.MaximumIdleConnections" value="5"/>
<property name="Pool.MaximumCheckoutTime" value="120000"/>
</transactionManager>
<dao interface="com.domain.dao.OrderDao"
implementation="com.domain.dao.jdbc.JdbcOrderDao"/>
<dao interface="com.domain.dao.LineItemDao"
implementation="com.domain.dao.jdbc.JdbcLineItemDao"/>
<dao interface="com.domain.dao.CustomerDao"
implementation="com.domain.dao.jdbc.JdbcCustomerDao"/>
</context>
<!-- Example SQL Maps DAO Configuration -->
<context>
<transactionManager type="SQLMAP">
<property name="SqlMapConfigResource" value="com/domain/dao/sqlmap/SqlMapConfig.xml"/>
</transactionManager>
<dao interface="com.domain.dao.PersonDao"
implementation="com.domain.dao.sqlmap.SqlMapPersonDao"/>
<dao interface="com.domain.dao.BusinessDao"
implementation="com.domain.dao.sqlmap.SqlMapBusinessDao"/>
<dao interface="com.domain.dao.AccountDao"
implementation="com.domain.dao.sqlmap.SqlMapAccountDao"/>
</context>
</daoConfig>
一个dao.xml里可以有多个context,通常一个上下文指定一个特定的dataSource
为了去管理多样的配置(因为有不同的环境),你可以使用可选的元素<properties).
这个允许使用占用符,例如:
driver=org.postgresql.Driver
url=jdbc:postgresql://localhost:5432/test
这时你可以在dao.xml里用占用符取代具体的值,例如上面的可以改写成下面的
<property name="JDBC.Driver" value="${driver}"/>
<property name="JDBC.ConnectionURL" value="${url}"/>
在上下文当中,第一个context里同使用的是jdbc事物控制,所以在指定的property元素也要使用jdbc,不同的事

物管理实现会需要不同的properties,

事物管理实现(Transaction Manager Implementation and Configuration)是一个组件会管理pool(事物对象)

,一事物管理通常只是包装特定的DataSource,简单的事物通常包装一特定的实现类如jdbc连接实现

jdbc Transaction Manager:利用提供的datasource api提供连接池服务
有三种datasource是支持的(simple,dbcp,jndi),simple是实现了ibatis的SimpleDataSource。dbcp使用了

jakarta dbcp datasource,最后,jndi是实现了查找datasource是从jndi上去查
下面是不同的配置方法
<!-- Example iBATIS SimpleDataSource JDBC Transaction Manager -->
<transactionManager type="JDBC">
<property name="DataSource" value="SIMPLE"/>
<property name="JDBC.Driver" value="${driver}"/>
<property name="JDBC.ConnectionURL" value="${url}"/>
<property name="JDBC.Username" value="${username}"/>
<property name="JDBC.Password" value="${password}"/>
<property name="JDBC.DefaultAutoCommit" value="true" />
<!-- The following are optional -->
<property name="Pool.MaximumActiveConnections" value="10"/>
<property name="Pool.MaximumIdleConnections" value="5"/>
<property name="Pool.MaximumCheckoutTime" value="120000"/>
<property name="Pool.TimeToWait" value="10000"/>
<property name="Pool.PingQuery" value="select * from dual"/>
<property name="Pool.PingEnabled" value="false"/>
<property name="Pool.PingConnectionsOlderThan" value="0"/>
<property name="Pool.PingConnectionsNotUsedFor" value="0"/>
</transactionManager>

<!-- Example Jakarta DBCP JDBC Transaction Manager -->
<transactionManager type="JDBC">
<property name="DataSource" value="DBCP"/>
<property name="JDBC.Driver" value="${driver}"/>
<property name="JDBC.ConnectionURL" value="${url}"/>
<property name="JDBC.Username" value="${username}"/>
<property name="JDBC.Password" value="${password}"/>
<property name="JDBC.DefaultAutoCommit" value="true" />
<!-- The following are optional -->
<property name="Pool.MaximumActiveConnections" value="10"/>
<property name="Pool.MaximumIdleConnections" value="5"/>
<property name="Pool.MaximumWait" value="60000"/>
<!-- Use of the validation query can be problematic. If you have difficulty, try without it. -->
<property name="Pool.ValidationQuery" value="select 1 from ACCOUNT"/>
<property name="Pool.LogAbandoned" value="false"/>
<property name="Pool.RemoveAbandoned" value="false"/>
<property name="Pool.RemoveAbandonedTimeout" value="50000"/>
</transactionManager>


<!-- Example JNDI DataSource JDBC Transaction Manager -->
<transactionManager type="JDBC">
<property name="DataSource" value="JNDI"/>
<property name="DBJndiContext" value="java:comp/env/jdbc/MyDataSource"/>
</transactionManager>

jta管理事物:它使用的是jta api.实种实现总是需要通过jndi去获得datasource和一个UserTransaction实例也

是通过jndi访问的,因些需要在服务器配置一下,不过这使得配置dao框架十分简单了。下面是一个简单的配置
<transactionManager type="JTA">
<property name="DBJndiContext" value="java:comp/env/jdbc/MyDataSource"/>
<property name="UserTransaction" value="java:comp/env/UserTransaction"/>
</transactionManager>

sqlmap管理事物:通过dao框架包装sql maps事物服务,所有的你都要指定一个sql maps配置文件。下面是一个简

单的配置
<transactionManager type="SQLMAP">
<property name="SqlMapConfigResource" value="com/domain/dao/sqlmap/SqlMapConfig.xml"/>
</transactionManager>

hibernate管理事物:同样的,通过dao框架包装hibernate事物服务,基本上properties在配置文件当中和

hibernate.properties文件是一样的,另外,持久化类(你可能通过添加到hibernate配置文件当中去的)要

以"class."开头,下面是一个例子:
<transactionManager type="HIBERNATE">
<property name="hibernate.dialect" value="net.sf.hibernate.dialect.PostgreSQLDialect"/>
<property name="hibernate.connection.driver_class" value="${driver}"/>
<property name="hibernate.connection.url" value="${url}"/>
<property name="hibernate.connection.username" value="${username}"/>
<property name="hibernate.connection.password" value="${password}"/>
<property name="class.1" value="com.domain.Person"/>
<property name="class.2" value="com.domain.Business"/>
<property name="class.3" value="com.domain.Account"/>
</transactionManager>

external 管理事物:允许使用dao框架控制。这个执行基本是没有行为,因些不需要properties,如果你使用一个

flat file,你可以使用external事物管理,
<transactionManager type="EXTERNAL"/>

dao实现模板:你可能要问我怎么使用上面的事物,好了每一种事物类型都要相应的dao模板与之对应。例如:

jta,jdbc模板提供简单的访问jdbc连接对象。相似的sqlmap模板提供访问简单的SqlMapExecutor实例,而

hibernate template提供访问Session object.
使用dao template完全是可选的,但99%的时间里,是不可不选择的/

更多的模板请看下面的.
DaoManager编程:iBATIS dao框架有许多的目的.第一个,它试图持久层的细节.这包括所有的接口,实现和异

常细节(在你的持久层解决方案当中).
例如:如果你使用jdbc,dao框架将为你隐藏类如DataSource,Connection和SQLException.类似的,如果你使用

Hibernate orm,dao框架会为你隐藏类如Configuration,SessionFactory,Session和HibernateException.所有的

这些细节都会隐藏到了dao接口层.甚至在显示层的许多的datasource也会被隐藏.
第二个目的是:简化持久层编程模型,使在同一时间保持一致.不同的持久层解决方案有不同的编程语义和行为.
dao框架试图隐藏更多,允许在你的应用service和domain层,写出一致的风格.

DaoManager类负责dao框架的配置文件(通过dao.xml),另外,DaoManage扮演着中心门面的角色,它特殊之处是,还提

供方法允许你访问事物和dao实例.

读取配置文件:
使用DaoManagerBuilder类的静态方法buildDaoManager()方法读取dao.xml文件,buildDaoManager()方法需要一个

Reader实例作为参数.
例如:
Reader reader = new FileReader(C:/myapp/dao.xml);
DaoManager daoManager = DaoManagerBuilder.buildDaoManager(reader);

如在web应用环境当中(或其它),一般配置文件都会从classpath当中去加载的.我们可以使用

com.ibatis.common.resources.Resources类
Reader reader = Resources.getResourceAsReader(“com/domain/config/dao.xml”);
DaoManager daoManager = DaoManagerBuilder.buildDaoManager(reader);

Context和DaoManager
DaoManager实例是从dao.xml文件建立的.当你需要一个dao实例时,你可以通过DaoManager,和事物控制也会从它此

处提供的.因些不需直接访问context和事物管理..
你的dao知道它怎么去做.类似的,需要看你的daos怎么工作的,事物会恰当的开始和提交的.而且,事物仅在你的dao

被调用时才启动.

获取dao实例
一旦你得到了DaoManager实例,你就可以根据dao名字,利用DaoManager的getDao方法获取该dao实例了,如:
ProductDao productDao = (ProductDao) daoManager.getDao (ProductDao.class);

DaoManager提供了处理事务的方法.这些方法允许你划分事务,和避免传递事务对象(eg:jdbc Connction)到你的所

有的daos当中去.例如:
ProductDao productDao = (ProductDao) daoManager.getDao (ProductDao.class);
try {
daoManager.startTransaction();
Product product = productDao.getProduct (5);
product.setDescription (“New description.”);
productDao.updateProduct(product);
daoManager.commitTransaction();
} finally {
daoManager.endTransaction();
}
调用startTransaction()只是让DaoManager知道,你将要启动编程控制事务.
dao实例化时才启动事务的,甚至事务仅仅是contexts需要的时候.
commitTransaction()提交事务,endTransaction()需要在try{}catch(){}里面的,,
如果发现了异常,那么就会回滚.

自动提交事务
像jdbc的setAutoCommit(true)一样,不过也有不同之处,你可以使用多个update作为一个事务,你不需要指定提交

的行为方式,只要你不调用startTransaction()就行了
Product product = productDao.getProduct (5); // Transaction 1
product.setDescription (“New description.”);
productDao.updateProduct(product); // Transaction 2
product = productDao.getProduct (5); // Transaction 3
注意了,这里没有异常的事件发生的,如发生异常,就会回滚,和释放连接资源的.

实现自己的dao接口:
dao接口非常的简单,因为它没有声名任何的方法,只是一个marker interface,所以实现的只是你自己的接口罢了,

在你的接口当中没有限制你要定的任何方法,抛出的异常是运行期的DaoException类型的异常.
An example of a good Dao interface is:
public interface ProductDao extends Dao {
// Updates
public int updateProduct (Product product); // DAO Framework code may throw DaoException
public int insertProduct (Product product);
public int deleteProduct (int productId);
/
/ Queries
public Product getProduct (int productId);
public List getProductListByProductDescription (String description);
}

Templates和Implementations
在上面也提到了,每一种模板都对应一种特殊的Transaction Manager.
每一种模板提供了一种便利的方法去交互.
template Class       Transaction Manager        Convenience Method
JdbcDaoTemplate      JDBC                       Connection getConnection()
JtaDaoTemplate       JTA                        Connection getConnection();
SqlMapDaoTemplate    SQLMAP                     SqlMapExecutor getSqlMapExecutor()
HibernateDaoTemplate  HIBERNATE             Session getSession()

The following is an example implementation using the SqlMapDaoTemplate:
public class SqlMapProductDao implements ProductDao extends SqlMapDaoTemplate {
public SqlMapProductDao (DaoManager daoManager) {
super (daoManager);
}
/
* Insert method */
public int updateProduct (Product product) {
try {
getSqlMapExecutor().insert (“insertProduct”, product);
} catch (SQLException e) {
throw new DaoException (“Error inserting product. Cause: “ + e, e);
}
}
/
/ … assume remaining methods to save space
}
注意:在上面的例子里只有一些个构造器,参数为DaoManager,它是在初始化实例时通过DaoManagerBuilder自动注

入参数进去..第一个需要DaoManager作为构造器的参数,也就迫使它的子类都要一个带参(DaoManager)的构造器,

当你使用模板时,构造器是必须的,你不需要提供其它的构造器了..你的daos仅仅需要DaoManagerBuilder去实例化

它.

考虑dao的设计方式:
推荐使用一个继承dao接口的接口,另一个为一个继承dao接口的抽象类(封闭一些异常,事务等等)..
实际上你只需要一个就行了,另外你也可以选择下面这种方式..
你可以使用BaseJdbcDao(abstract)继承dao接口,需让ProductDao不要去断承dao接口,让ProductJdbcDao去实现

ProductDao和继承BaseJdbcDao就可以了,让Product接口仍然与dao分离开来....
在上面的例子当中可以将BaseJdbcDao继承JdbcDaoTemplate(它已经实现了dao接口)


现在做一个例子:
create table test
(
id int auto_increment;
name varchar(20)
);

建一个对应的vo
package zhai;

public class test {
 int id;
 String name;
public int getId() {
 return id;
}
public void setId(int id) {
 this.id = id;
}
public String getName() {
 return name;
}
public void setName(String name) {
 this.name = name;
}
}

建一个配置数据库的配置文件
config.xml
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE sqlMapConfig
    PUBLIC "-//iBATIS.com//DTD SQL Map Config 2.0//EN"
    "http://www.ibatis.com/dtd/sql-map-config-2.dtd">
<sqlMapConfig>
  <transactionManager type="JDBC">
    <dataSource type="SIMPLE">
      <property value="com.mysql.jdbc.Driver" name="JDBC.Driver"/>
      <property value="jdbc:mysql://localhost:3306/test" name="JDBC.ConnectionURL"/>
      <property value="root" name="JDBC.Username"/>
      <property value="root" name="JDBC.Password"/>
    </dataSource>
  </transactionManager>
  <sqlMap url="file:C:\Test\sql.xml"/>
</sqlMapConfig>


--
sql.xml

--------
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE sqlMap PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN"
    "http://ibatis.apache.org/dtd/sql-map-2.dtd">

<sqlMap namespace="test">
  <typeAlias alias="test" type="test.test"/>
  <select id="getByName" resultClass="test" parameterClass="string">
    SELECT
     ID,
     NAME
    FROM TEST
    WHERE NAME = #name#
  </select>
</sqlMap>

----------------
------------------
package zhai;

public interface MyDao {
  public void MyInsert(test t);
}
==================
package zhai;

import java.sql.SQLException;

import com.ibatis.dao.client.DaoManager;
import com.ibatis.dao.client.template.SqlMapDaoTemplate;

public class TestDao extends SqlMapDaoTemplate implements MyDao{

 public TestDao(DaoManager arg0) {
  super(arg0);
  // TODO Auto-generated constructor stub
 }

 public void MyInsert(test t) {
  try {
   getSqlMapExecutor().insert ("insertTest",t);
  } catch (SQLException e) {
   System.out.println("插入时出异常");
   e.printStackTrace();
  }
 }

}

============
package zhai;
import java.io.*;

import com.ibatis.sqlmap.client.*;
public class TestDemo {

 public static void main(String[] args) throws Exception {
  Reader reader=new FileReader("C:\\Test\\config.xml");
     SqlMapClient sqlmap=SqlMapClientBuilder.buildSqlMapClient(reader);
     test emp = (test) sqlmap.queryForObject("getById", new Integer(1));
        System.out.println("欢迎你="+emp.getName());
 }

}
-------------------------------------------------

-------------------------------------------------

-------------------------------------------------

-------------------------------------------------

-------
写一个运行dao的
<!DOCTYPE daoConfig
PUBLIC "-//iBATIS.com//DTD DAO Configuration 2.0//EN"
"http://www.ibatis.com/dtd/dao-2.dtd">
<daoConfig>
<!-- Example JDBC DAO Configuration -->
<context>
    <transactionManager type="SQLMAP">
     <property name="SqlMapConfigResource" value="zhai/config.xml"/>
    </transactionManager>
<dao interface="zhai.MyDao" implementation="zhai.TestDao"/>
</context>
</daoConfig>
----------------------
--------------------
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE sqlMap PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN"
    "http://ibatis.apache.org/dtd/sql-map-2.dtd">

<sqlMap namespace="test">
  <typeAlias alias="test" type="zhai.test"/>
  <select id="getById" resultClass="test" parameterClass="int">
    SELECT
     ID,
     NAME
    FROM TEST
    WHERE ID = #id#
  </select>
  <insert id="insertTest" parameterClass="test">
    insert into TEST (NAME) values (#name#)
  </insert>
 
</sqlMap>
--------------------------------------------------------------------------------------------------

---------------------------------------------
package zhai;
import java.io.*;

import com.ibatis.dao.client.DaoManager;
import com.ibatis.dao.client.DaoManagerBuilder;
import com.ibatis.sqlmap.client.*;
public class TestDemo {

 public static void main(String[] args) throws Exception {
                //Reader reader = Resources.getResourceAsReader("zhai/dao.xml");
  Reader reader=new FileReader("C:\\Test\\dao.xml");
  DaoManager daoManager = DaoManagerBuilder.buildDaoManager(reader);
  MyDao testdao = (MyDao) daoManager.getDao(MyDao.class);
  test t=new test();
  t.setName("test");
  testdao.MyInsert(t);
 }

}


注意了如果你用的是
Reader reader = Resources.getResourceAsReader("zhai/dao.xml");
那么你就得注意事了,dao.xml要放在项目的bin目录下面,否则就会出错
还有在dao.xml里的  <transactionManager type="SQLMAP">
     <property name="SqlMapConfigResource" value="zhai/config.xml"/>
    </transactionManager>
也是一个道理呀

posted @ 2006-07-24 00:48 蜘蛛 阅读(4083) | 评论 (4)编辑 收藏

对于面向接口编程的项目免不了要一反射相接触,动态得到实例:
public interface a {
 public void sayHello();
}
---------------------------
第一种情况是当
aImpl实现类为默认的构造方法:
根据类名aImpl动态得到实例
Class c=Class.forName("aImpl");
a instance=(a)c.newInstance();
a.sayHello();
------------
第二种情况当
aImpl为带参数的构造方法时:
Class o=Class.forName("aImpl");//aImpl为要实例化的例名,可以从配置文件当中获取
   Constructor cous = null;
   cous=o.getConstructor(new Class[]{String.class});//构造器的参数类型
   a ao=(a) cous.newInstance(new Object[]{"xxx"});//"xxx为传入的参数值
   ao.sayHello();
第三种就是构造器为私有的时候,我们通过方法获取实例getInstance()(自己定的)
Class o=Class.forName("aImpl");
   Method method=o.getMethod("getInstance",new Class[]{String.class});
//getInstance为返回为aImpl实例的方法名
    a ao=(a) method.invoke(null,new Object[]{"xxx"});//注意了前面的参数为null,是有
//条件的,就是要求getInstance为static类型的,我想大家都会这样设计的
       ao.sayHello();
做连接池的话,一种方式就是使用动态代理类,当Connection调用close()方法时,我们可以利用方法拦截器,在调用close方法的时候把连接放到缓存里面去,供以后再次利用..
a ao=(a)Proxy.newProxyInstance(aImpl.class.getClassLoader(),aImpl.class.getInterfaces(),
     new InvocationHandler()
     {

      public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
       Object re=null;
       System.out.println("before--------"+method.getName());
//在这里我们添加自己的一些处理方法,如把连接放到缓存去撒!
       //re=method.invoke(new aImpl(),args);
       return re;
      }
    
     });
   ao.sayHello();

posted @ 2006-07-15 22:00 蜘蛛 阅读(3338) | 评论 (1)编辑 收藏

因为项目当中用到分页,界面用了jstl,本想用jstl给我分页的,测试代码如下

<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql"%>
<%@ page contentType="text/html; charset=gbk"%>
<html>
<body>
 <c:set value="8" var="ipage"/>
 <c:set value="${param.cpage}" var="cpage" scope="request"/>
 <c:if test="${empty sessionScope.allCount}">
 <sql:query var="rso">select * from test</sql:query>
 <c:set value="${rso.rowCount}" var="allCount" scope="session"/>
  </c:if>
 <sql:query var="rs" startRow="${ipage*(cpage-1)}" maxRows="${ipage}">
 select * from test
 </sql:query>
 <c:set value="${(allCount+ipage-1)/ipage}" var="allpage"/>
 <fmt:parseNumber value="${allpage}" integerOnly="true" var="allpage"/>
 xxx<c:out value="${allpage}"/><br>
 <c:forEach items="${rs.rows}" var="item">
 <c:out value="${item.name}"/>
 <c:out value="${item.password}"/><br>
 </c:forEach>
   <c:if test="${cpage<=1}">
    <c:set value="${cpage+1}" var="cpage"/>
   </c:if>
   <c:if test="${cpage>allpage}">
    <c:set value="${allpage}" var="cpage"/>
   </c:if>
  <A href="http://localhost:8080/jstl/test.jsp?cpage=${cpage-1}">上一页</A>
  <A href="http://localhost:8080/jstl/test.jsp?cpage=${cpage}">当前页</A>
  <A href="http://localhost:8080/jstl/test.jsp?cpage=${cpage+1}">下一页</A>
 <hr>
</body>
</html>
本以为这样子比起用oracle里的rownum(如果更换数据库还得改代码),来的要好,因为我这里的是
 <sql:query var="rs" startRow="${ipage*(cpage-1)}" maxRows="${ipage}">
 select * from test
 </sql:query>
可是我看了他的源代码,竟然它利用缓存,每次调用
<sql:query startRow="" maxRows="">它都会把select * from test的数据全部一次性查出得到一个result,再根据startRow,再调用result.next(),startRow次后才正式帮我们工作..

看来还是原始的方式速度要快一些..
.......进化出来的产物不一定先进
posted @ 2006-07-15 10:50 蜘蛛 阅读(3113) | 评论 (5)编辑 收藏

http://www.blogjava.net/Files/zhaijianhui/ejb插删改查.rar

/*
对表的修改
*/
public void updateNode(UseInfoDto dto) {
    UseInfo useinfo;
   try {
     System.out.println("===========");
    useinfo=home.findByPrimaryKey(dto.getName());
    useinfo.setPassword(dto.getPassword());
    System.out.println("用户名"+dto.getName()+"修改后的记录密码"+dto.getPassword());
   }
   catch (Exception ex) {
     ex.printStackTrace();
     System.out.println("修改记录出现异常");
   }
  }
因为name作为主键,所以不可能再在这里调用setName("xxxxxw")方法了,,
否则会产生错误:
javax.ejb.TransactionRolledbackLocalException: EJB Exception: ; nested exception
 is: java.lang.IllegalStateException: [EJB:010144]The setXXX method for a primar
y key field may only be called during ejbCreate.
java.lang.IllegalStateException: [EJB:010144]The setXXX method for a primary key
 field may only be called during ejbCreate.
想一想有没有必要修改主键的值呢,很显然是没有必要的,看看当今的一些应用就知道,电信,银行这些部门只提供注册用户的一般资料验证,不会允许你去改用户名的..
/*
对表增加一条记录
*/
 public void addNode(UseInfoDto dto) {
    UseInfo useinfo;
 try {
   System.out.println("home=========="+home);
    useinfo = home.create(dto.getName());
    //useinfo.setName(dto.getName());
    useinfo.setPassword(dto.getPassword());
    System.out.println("调用 了addNode");
    System.out.println("创建了新记录为"+dto.getName()+":"+dto.getPassword());
 }
 catch (CreateException ex) {
   ex.printStackTrace();
   System.out.println("创建远程接口实例时出异常");

 }
这也和上面的一个道理,因为主键字段不允许暴露给客户setXXX方法,所以我们要创建一个create(主键)给客户调用,这样我们就可依我上面所做的方式创建一条记录了,,
注意在ejbCreate(XXX)方法里要加上一句  setXXX(XXX);否则会报错的哟
因为ejbCreate在服务器本地调用所以可以调用setXXX方法.
ok,祝旅途愉快!

posted @ 2006-07-14 23:12 蜘蛛 阅读(905) | 评论 (0)编辑 收藏

今天还真的是郁闷的了,,在网上终于找到最好的解决办法
就是
在命令行中,依次执行以下命令:

ftype exefile="%1" %*   [包含引号]
assoc .exe=exefile
但这样子,cmd都不认了,,
这时
你可以去c:\windows\system32\
找到cmd.exe
rename cmd.exe cmd.com
再运行可以执行了,,可是第二天重启还是老样子,,,,

后来拿出原来备份的注册表,,导入到现在注册表里(开始--->运行--->regedit-->然后导入原来的注册表备份,后来装的软件没有什么影响,只会覆盖原来的设置),终于ok搞定了...

posted @ 2006-06-04 00:55 蜘蛛 阅读(355) | 评论 (0)编辑 收藏

在读spring in aciton 时,他用的BeanFactory factory = new XmlBeanFactory(new FileInputStream("hello.xml"));
可是现在的用的1.2.6版本的构造器(XmlBeanFactory)只能接收Resource接口了,所以调不出来是正常的事情,假设现在有一个文件hello.xml
读取方法

1:ApplicationContext cx=new FileSystemXmlApplicationContext("hello.xml");//指定的路径去找文件
2:ApplicationContext factory = new ClassPathXmlApplicationContext("hello.xml");//还会在classpath去找
3:Resource fa = new FileSystemResource("hello.xml");
   BeanFactory factory=new XmlBeanFactory(fa);
4:这个要设制classpath了,麻烦
  Resource res = new ClassPathResource("com/springinaction/chapter01/hello/hello.xml");
  BeanFactory factory=new XmlBeanFactory(res);
好了,用了上面那种方法都可以调用getBean("your bean name")了,
eg: BeanFactory factory=new XmlBeanFactory(fa);
      hello he=(hello)factory.getBean("hello");
              he.getHello();
posted @ 2006-06-03 11:24 蜘蛛 阅读(2643) | 评论 (1)编辑 收藏

为他方便大家更快的学习Spring,特整理了第一个实例,
做成了pdf格式,还附带源代码,欢迎下载
开发平台
myeclipse 4.1.1GA
eclipse 3.1.2
你也可以选择其它开发工具,并不影响你阅读此教程.
http://www.blogjava.net/Files/zhaijianhui/spring
入门.rar
posted @ 2006-06-01 01:37 蜘蛛 阅读(1958) | 评论 (5)编辑 收藏

现在感觉sun的netbean5.5,它吸取了eclipse的精华,本来是eclipse的用户,但到sun公司的网站上下载了netbean的flash教学看了看就被它的易用和eclipse的相似给吸引住了http://www.netbeans.org/files/documents/4/753/netbeans_50.zip
当然还有更多的ejb3.0开发的flash可以下载,作为学习之用是再好不过了,
这个是我录制一个简单的demo
http://www.blogjava.net/Files/zhaijianhui/netbean5.5ejb.rar
下载netbean地址:
http://us1.mirror.netbeans.org/download/5_5/beta/200605090801/netbeans-5_5-beta-windows.exe

下载jboss地址:
http://jaist.dl.sourceforge.net/sourceforge/jboss/jboss-4.0.4.GA.zip
它对ejb3.0支持是最好的,虽现在ejb3.0不断的完善当中,还收补了不少的bug了,但它那简单易用还是吸引人去研究它.
jboss4.04有jar,和zip格式的,建议下载jar安装上就不要安装ejb3.0.jar了,
如下载的是zip格式的话,还不能支持ejb3.0所以还要下载http://nchc.dl.sourceforge.net/sourceforge/jboss/jboss-EJB-3.0_RC7-FD.zip
看一下它的说明就可以安装上去的,如果你不知道了话你就下载一个
EJB3Trail可以当教程用,我现在研究不中..
现在这个地址我找不到了,你可以到google去搜,如真的找不到请留下email
下面是2005看到的比较好的中文教程,不过对现在来说,显得太老了,不过主体看起来还行,起码比书市里的书看起来要好一些..
http://edu.uuu.com.tw/data_seminar/doc/Java_20050527_slide.pdf
http://www.softleader.com.tw/javatwo2005/Java2005-EJB3-jini_FR.pdf
j2ee1.5最终规范已经确定下来的.其中的ejb3.0规范下载 
http://192.18.108.235/ECom/EComTicketServlet/BEGINC0098FFB7ED15FBFC205C643AD41C96E/-2147483648/1495423407/1/728570/728534/1495423407/2ts+/westCoastFSEND/ejb-3_0-fr-eval-oth-JSpec/ejb-3_0-fr-eval-oth-JSpec:1/ejb-3_0-fr-spec-ejbcore.pdf
如果你用netbean5.05的话,还可以用sun自己的服务器
http://192.18.108.238/ECom/EComTicketServlet/BEGIN2AD2AFC100299F9169C2B71DE5B12318/-2147483648/1496225499/1/725978/725942/1496225499/2ts+/westCoastFSEND/sjsas_pe-9.0-oth-JPR/sjsas_pe-9.0-oth-JPR:3/sjsas_pe-9_0-windows.exe
最近还看到bea网站上有一篇讲解ejb3.0的好文章,建议去看看,有中文和英文的..

posted @ 2006-05-26 08:45 蜘蛛 阅读(2356) | 评论 (2)编辑 收藏

Interviews from JavaOne 2006: Day 1
http://www.artima.com/lejava/articles/javaone_2006_tue_ideas.html
Interviews from JavaOne 2006: Day 2
http://www.artima.com/lejava/articles/javaone_2006_wed_ideas.html
Interviews from JavaOne 2006: Day 3
http://www.artima.com/lejava/articles/javaone_2006_thu_ideas.html

Interviews from JavaOne 2006: Day 4
http://www.artima.com/lejava/articles/javaone_2006_fri_ideas.html
posted @ 2006-05-23 21:59 蜘蛛 阅读(1176) | 评论 (0)编辑 收藏