<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    posts - 165, comments - 198, trackbacks - 0, articles - 1
      BlogJava :: 首頁 :: 新隨筆 :: 聯系 :: 聚合  :: 管理


    Python is a dynamic object-oriented programming language that can be used for many kinds of software development.

    It offers strong support for integration with other languages and tools, comes with extensive standard libraries, and can be learned in a few days.
    offers 提出
    integration 綜合
    extensive 寬廣
    standard libraries 標準庫


    Many Python programmers report substantial productivity gains and feel the language encourages the development of higher quality, more maintainable code.
    report 宣告
    substantial 實質
    productivity 生產力

    posted @ 2008-09-23 09:56 G_G 閱讀(200) | 評論 (1)編輯 收藏

    直接 運行 div_show_drag.rar
    http://m.tkk7.com/Files/Good-Game/div_Show_drag.rar

    html test
    <html>
    <head>

    <script?type="text/javascript"?src="showDivUtil.js"></script>

    </head>

    <body>

    <input?type="button"?id="_in"?value="google-baidu"?onclick="test();"/>
    <div?id='_div'?/>
    <script?language="javascript">
    /*api說明
    ????ShowDiv(?源element?,?是否使用現有?div?)
    ????????源element,是否使用現有?div?都可為null?;
    */
    var?ediv?=?new?ShowDiv('_in',null);

    function?test(){
    ????
    if(?!?ediv.isShow?){
    ????????
    // tdiv[X,Y,H,W]準備展現div set->tdiv.X = ..? ? ,
    ??????? // tsubEle[X,Y,H,W]
    ??????? // 源ele大小位置??,tscreen[
    screenH,screenW]屏幕長寬
    ????????ediv.setLocation?=?function(tdiv,tsubEle,tscreen){
    ????????????
    /*??居中展現
    ?????????????tdiv.W?=200?;
    ?????????????tdiv.H?=?300?;
    ?????????????tdiv.X?=?tscreen.screenW/2-tdiv.W/2?;
    ?????????????tdiv.Y?=?tscreen.screenH/2-tdiv.H/2?;
    ????????????
    */

    ?????????????
    /*??根據?tsubEle?位置?左顯示
    ????????????tdiv.X?=?tsubEle.X+tsubEle.W?;
    ????????????tdiv.Y?=?tsubEle.Y?;
    ?????????????
    */

    ??????????????
    /*??根據?tsubEle?大小??左長條?顯示?
    ?????????????tdiv.X?=?tsubEle.X+tsubEle.W?;
    ?????????????tdiv.Y?=?tsubEle.Y?;
    ?????????????
    */
    ????????????
    ????????
    ??????????????
    /*??根據?tsubEle?大小??下長條?顯示
    ?????????????tdiv.X?=?tsubEle.X+tsubEle.W?;
    ?????????????tdiv.Y?=?tsubEle.Y?;
    ?????????????tdiv.H?=?200?;
    ?????????????tdiv.W?=?tsubEle.W?;
    ?????????????
    */
    ????????????
    ????????????
    /*??..?等等?自己嘗試吧*/
    ????????????tdiv.innerHTML?
    =?"<li>google</li><li>baidu</li>"?;
    ????????????
    //可以參考?
    ????????????Drag.init(tdiv);
    ????????}????
    ????????ediv.setStyle('background
    -color:#F4F4F4;');
    ????????ediv.show();
    ????}
    else{
    ????????ediv.close();
    ????????
    //ediv.delete();
    ????}
    }

    </script>
    </body>
    </html>



    showDivUtil.js

    /*
    * Skynet
    *? 2008-9-15 00:56
    *?? liukaiyi@gmail.com
    */

    function?ShowDiv(subEle,ediv){
    ????
    //public?
    ????this.style??;
    ????
    this.isShow?=?false?;

    ????
    //private?
    ????this._div??;
    ????
    this._subEle??;
    ????
    this._subEle??;


    ????????
    if(?typeof?ediv?==?"undefined"?||?ediv?==?null)?
    ????????????
    this._div=document.createElement("div");
    ????????
    else?if(?typeof?ediv?==?"string")?
    ????????????
    this._div=document.getElementById(ediv);????
    ????????
    else?if(??/object/.test(typeof?ediv)?)
    ????????????
    this._div=?ediv?;
    ????????
    ????????
    if(?typeof?subEle?==?"string")?
    ????????????
    this._subEle=document.getElementById(subEle);????
    ????????
    else?if(??/object/.test(typeof?subEle)?)
    ????????????
    this._subEle=?subEle?;

    }

    ????
    //外置方法?x?,?y?,w?,?h?,?div
    ????ShowDiv.prototype.setLocation?=?new?Function()?;

    ????
    //設置?div?樣式
    ????ShowDiv.prototype.setStyle=function(styleStrOrObj){
    ????????
    this.style=this._div.style?;
    ????????
    if(?typeof?styleStrOrObj?==?"string"){
    ????????????
    var?strs?=?styleStrOrObj.split(/;/)?;
    ????????????
    for(var?i=0;i<strs.length;i++){
    ????????????????
    var?key?=?strs[i].split(/:/)[0];
    ????????????????
    var?value?=?strs[i].split(/:/)[1];
    ????????????????
    var?_s?=?key.indexOf("-")?;
    ????????????????
    if(?_s>0)?
    ????????????????????key
    =key.substring(0,_s)+key.substring(_s+1,_s+2).toLocaleUpperCase()+key.substring(_s+2,key.length);
    ????????????????
    if(?key!=null&&key!=''&&key!='?'?){
    ????????????????????eval(?'
    this._div.style.'+key+'="'+value+'"'?);
    ????????????????}
    ????????????}
    ????????}
    else?if(??/object/.test(typeof?styleStrOrObj)?)?{
    ????????????
    this._div.style?=?styleStrOrObj?;
    ????????}
    ????????
    if(this._div.style.position==null?||?this._div.style.position=="")
    ????????????
    this._div.style.position="absolute";
    ????}
    ????
    ????ShowDiv.prototype.show
    =function(){
    ????????
    if(?typeof?this._subEle?!=?"undefined"?||?this._subEle?!=?null){
    ????????????
    this._subEle.Y?=?getElementPos(this._subEle).y;
    ????????????
    this._subEle.X?=?getElementPos(this._subEle).x?;
    ????????????
    this._subEle.W?=?this._subEle.offsetWidth?;
    ????????????
    this._subEle.H?=?this._subEle.offsetHeight?;
    ????????}
    ????????
    //this._div.Y?=?sset
    ????????//this._div.X?=?sset
    ????????this._div.W?=?parseInt(?this._div.style.width?);
    ????????
    this._div.H?=?parseInt(?this._div.style.height?);
    ????????
    ????????
    this.setLocation(this._div,this._subEle,{screenW:document.body.clientWidth,screenH:document.body.clientHeight});
    ????????
    this._div.style.left?=?this._div.X??;
    ????????
    this._div.style.top?=?this._div.Y?;
    ????????
    ????????
    if(?this._div.W?&&?this._div.H?){
    ????????????
    this._div.style.width?=?this._div.W?;
    ????????????
    this._div.style.height?=?this._div.H?;
    ????????}
    ????????document.body.appendChild(
    this._div);
    ????????
    this.isShow?=?true?;
    ????}

    ????ShowDiv.prototype.close
    =function(){
    ????????document.body.removeChild(
    this._div);?
    ????????
    this.isShow?=?false?;
    ????}

    ?????ShowDiv.prototype.
    delete=function(){
    ????????document.body.removeChild(
    this._div);?
    ????????
    this._div?=?null?;
    ????????
    this.isShow?=?false?;
    ????}

    ?
    //得到 Element 位置
    //?說明:用?Javascript?獲取指定頁面元素的位置
    //
    ?整理:http://www.codebit.cn
    //
    ?來源:YUI?DOM
    function?getElementPos(el)?{
    ????
    var?ua?=?navigator.userAgent.toLowerCase();
    ????
    var?isOpera?=?(ua.indexOf('opera')?!=?-1);
    ????
    var?isIE?=?(ua.indexOf('msie')?!=?-1?&&?!isOpera);?//?not?opera?spoof
    ????if(el.parentNode?===?null?||?el.style.display?==?'none'){
    ????????
    return?false;
    ????}
    ????
    var?parent?=?null;
    ????
    var?pos?=?[];
    ????
    var?box;

    ????
    if(el.getBoundingClientRect){
    ????
    //?IE?
    ????????box?=?el.getBoundingClientRect();
    ????????
    var?scrollTop?=?Math.max(document.documentElement.scrollTop,?document.body.scrollTop);
    ????????
    var?scrollLeft?=?Math.max(document.documentElement.scrollLeft,?document.body.scrollLeft);
    ????????
    return?{x:box.left?+?scrollLeft,?y:box.top?+?scrollTop};
    ????}
    else?if(document.getBoxObjectFor){
    ?????
    //?gecko
    ????????box?=?document.getBoxObjectFor(el);
    ????????
    var?borderLeft?=?(el.style.borderLeftWidth)?parseInt(el.style.borderLeftWidth):0;
    ????????
    var?borderTop?=?(el.style.borderTopWidth)?parseInt(el.style.borderTopWidth):0;
    ????????pos?
    =?[box.x?-?borderLeft,?box.y?-?borderTop];
    ????}
    else?{
    ?????
    //?safari?&?opera
    ????????pos?=?[el.offsetLeft,?el.offsetTop];
    ????????parent?
    =?el.offsetParent;
    ????????
    if?(parent?!=?el)?{
    ????????????
    while?(parent)?{
    ????????????????pos[
    0]?+=?parent.offsetLeft;
    ????????????????pos[
    1]?+=?parent.offsetTop;
    ????????????????parent?
    =?parent.offsetParent;
    ????????????}
    ????????}
    ?????????
    if?(ua.indexOf('opera')?!=?-1||?(?ua.indexOf('safari')?!=?-1?&&?el.style.position?==?'absolute'?)){
    ????????????pos[
    0]?-=?document.body.offsetLeft;
    ????????????pos[
    1]?-=?document.body.offsetTop;
    ????????}
    ????}
    ?
    ????
    if?(el.parentNode)?{?parent?=?el.parentNode;?}
    ????
    else?{?parent?=?null;?}
    ?
    ?
    ????
    //?account?for?any?scrolled?ancestors
    ?????while?(parent?&&?parent.tagName?!=?'BODY'?&&?parent.tagName?!=?'HTML'){?????
    ????????pos[
    0]?-=?parent.scrollLeft;
    ????????pos[
    1]?-=?parent.scrollTop;
    ????????
    if?(parent.parentNode)?{?parent?=?parent.parentNode;?}
    ????????
    else?{?parent?=?null;?}
    ????}
    ????
    return?{x:pos[0],?y:pos[1]};
    }?




    posted @ 2008-09-15 01:02 G_G 閱讀(434) | 評論 (0)編輯 收藏


    上面加上我的注解(希望能對大家理解有幫助):
    /**************************************************
    ?*?dom-drag.js
    ?*?09.25.2001
    ?*?www.youngpup.net
    ?*?Script?featured?on?Dynamic?Drive?(
    http://www.dynamicdrive.com)?12.08.2005
    ?**************************************************
    ?*?10.28.2001?-?fixed?minor?bug?where?events
    ?*?sometimes?fired?off?the?handle,?not?the?root.
    ???*????注解:??Skynet
    ?*????email?:?liukaiyi@gmail.com
    ?*????????blog?:?m.tkk7.com/Good-Game
    ?*************************************************
    */

    var?Drag?
    =?{

    ????obj?:?
    null,
    ????
    ????
    /*?api?說明:?
    ????*?????方法調用可以參考:
    http://www.dynamicdrive.com/dynamicindex11/domdrag/
    ????*?????????o?拖拽?Handle?
    ????*????????oRoot?被拖拽?element??(可選,?默認不填?o為被拖拽對象??type=object)
    ????*????????minX,?maxX,?minY,?maxY?限制拖拽范圍?(可選,默認不填為全屏?type=int?)
    ????*?????????bSwapHorzRef,?bSwapVertRef?判斷是否允許?橫,縱向拖拽(可選,默認不填無限制?type=boolean?)
    ????*?????fXMapper(x),?fYMapper(y)??為外置函數?拖拽效果體現前調用?(x,y)?為當前element位置(可選?type=Function)
    ????
    */
    ????init?:?function(o,?oRoot,?minX,?maxX,?minY,?maxY,?bSwapHorzRef,?bSwapVertRef,?fXMapper,?fYMapper)
    ????{
    ????????
    /*?拖拽事件?掛載??(本js?主線?生命周期?描述)
    ????????*????1.?預定?o.onmousedown事件觸發運行??Drag.start。
    ????????*????2.?觸發?element->?onmousedown->Drag.start
    ????????*????????2.1????先得到?element?當前"改變初"位置,記入到?o.lastMouseX?;o.lastMouseY,掛載Drag.obj,Darp.root?為當前?element。
    ????????*????????2.2?????預定?document.onmousemove????=?Drag.drag;?document.onmouseup?=?Drag.end。
    ????????*????3.??觸發?document.onmousemove?運行?Drag.drag->?拖拽效果體現。
    ????????*????4.??觸發?document.onmouseup?運行?Drag.end->?掛載?document.onmousemove;document.onmouseup;Drag.obj取消。
    ????????
    */
    ????????o.onmousedown?
    =?Drag.start;
    ????????
    ????????
    //是否能?橫,縱向拖拽
    ????????o.hmode????????????=?bSwapHorzRef???false?:?true?;
    ????????o.vmode????????????
    =?bSwapVertRef???false?:?true?;
    ????????
    //掛載?o.root?
    ????????o.root?=?oRoot?&&?oRoot?!=?null???oRoot?:?o?;
    ????????
    ????????
    if?(o.hmode??&&?isNaN(parseInt(o.root.style.left??)))?o.root.style.left???=?"0px";
    ????????
    if?(o.vmode??&&?isNaN(parseInt(o.root.style.top???)))?o.root.style.top????=?"0px";
    ????????
    if?(!o.hmode?&&?isNaN(parseInt(o.root.style.right?)))?o.root.style.right??=?"0px";
    ????????
    if?(!o.vmode?&&?isNaN(parseInt(o.root.style.bottom)))?o.root.style.bottom?=?"0px";
    ????????
    ????????
    //?限定?移動范圍
    ????????o.minX????=?typeof?minX?!=?'undefined'???minX?:?null;
    ????????o.minY????
    =?typeof?minY?!=?'undefined'???minY?:?null;
    ????????o.maxX????
    =?typeof?maxX?!=?'undefined'???maxX?:?null;
    ????????o.maxY????
    =?typeof?maxY?!=?'undefined'???maxY?:?null;

    ????????o.xMapper?
    =?fXMapper???fXMapper?:?null;
    ????????o.yMapper?
    =?fYMapper???fYMapper?:?null;
    ????????
    ????????
    /*自定義拖拽-事件添加(相當于我們在java中的?抽象類?中未實現的方法??比如:
    ????????*????obj.onDrag?=?function(x,?y)?{
    ?????????*????????scrolldiv.style.top=y?*?(-1)?+"px";
    ????????*????}
    ????????
    */
    ????????o.root.onDragStart????
    =?new?Function();
    ????????o.root.onDragEnd????
    =?new?Function();
    ????????o.root.onDrag????????
    =?new?Function();
    ????},

    ????
    //由?function?init?>>?o.onmousedown????=?Drag.start;
    ????start?:?function(e)
    ????{
    ????????
    //得到被拖拽?element
    ????????var?o?=?Drag.obj?=?this;
    ????????e?
    =?Drag.fixE(e);
    ????????
    ????????
    //element?移動初位置?
    ????????var?y?=?parseInt(o.vmode???o.root.style.top??:?o.root.style.bottom);
    ????????var?x?
    =?parseInt(o.hmode???o.root.style.left?:?o.root.style.right?);
    ????????
    //可能的外置函數調用
    ????????o.root.onDragStart(x,?y);
    ????????
    //event?初位置?記入
    ????????o.lastMouseX????=?e.clientX;
    ????????o.lastMouseY????
    =?e.clientY;
    ????????
    ????????
    if?(o.hmode)?{
    ????????????
    if?(o.minX?!=?null)????o.minMouseX????=?e.clientX?-?x?+?o.minX;
    ????????????
    if?(o.maxX?!=?null)????o.maxMouseX????=?o.minMouseX?+?o.maxX?-?o.minX;
    ????????}?
    else?{
    ????????????
    if?(o.minX?!=?null)?o.maxMouseX?=?-o.minX?+?e.clientX?+?x;
    ????????????
    if?(o.maxX?!=?null)?o.minMouseX?=?-o.maxX?+?e.clientX?+?x;
    ????????}

    ????????
    if?(o.vmode)?{
    ????????????
    if?(o.minY?!=?null)????o.minMouseY????=?e.clientY?-?y?+?o.minY;
    ????????????
    if?(o.maxY?!=?null)????o.maxMouseY????=?o.minMouseY?+?o.maxY?-?o.minY;
    ????????}?
    else?{
    ????????????
    if?(o.minY?!=?null)?o.maxMouseY?=?-o.minY?+?e.clientY?+?y;
    ????????????
    if?(o.maxY?!=?null)?o.minMouseY?=?-o.maxY?+?e.clientY?+?y;
    ????????}
    ????????
    ????????
    /*>>>>>>>>>>>比較關鍵的掛載<<<<<<<<<<<<<<
    ????????*????
    ????????*????使用?document.onmousemove?事件?而不使用?element的,是應為當拖動太快,可能會脫離element.
    ????????
    */
    ????????document.onmousemove????
    =?Drag.drag;
    ????????document.onmouseup????????
    =?Drag.end;

    ????????
    return?false;
    ????},

    ????
    //由?function?start>>?document.onmousemove????=?Drag.drag;
    ????drag?:?function(e)
    ????{
    ????????e?
    =?Drag.fixE(e);
    ????????var?o?
    =?Drag.obj;

    ????????var?ey????
    =?e.clientY;
    ????????var?ex????
    =?e.clientX;
    ????????
    //得到?element?當前位置(vmode,hmode判斷是否可以橫縱向拖拽)
    ????????var?y?=?parseInt(o.vmode???o.root.style.top??:?o.root.style.bottom);
    ????????var?x?
    =?parseInt(o.hmode???o.root.style.left?:?o.root.style.right?);
    ????????var?nx,?ny;
    ????????
    ????????
    if?(o.minX?!=?null)?ex?=?o.hmode???Math.max(ex,?o.minMouseX)?:?Math.min(ex,?o.maxMouseX);
    ????????
    if?(o.maxX?!=?null)?ex?=?o.hmode???Math.min(ex,?o.maxMouseX)?:?Math.max(ex,?o.minMouseX);
    ????????
    if?(o.minY?!=?null)?ey?=?o.vmode???Math.max(ey,?o.minMouseY)?:?Math.min(ey,?o.maxMouseY);
    ????????
    if?(o.maxY?!=?null)?ey?=?o.vmode???Math.min(ey,?o.maxMouseY)?:?Math.max(ey,?o.minMouseY);
    ????????
    ????????
    //本js中?最主要的地方:?
    ????????
    //得到?鼠標移動?向量?drap(x,y)?=?fun_drap:event(x,y)?-?fun_start:event(x,y)
    ????????
    //并于?得到拖拽效果:??element(x,y)?+?drap(x,y)?
    ????????nx?=?x?+?((ex?-?o.lastMouseX)?*?(o.hmode???1?:?-1));
    ????????ny?
    =?y?+?((ey?-?o.lastMouseY)?*?(o.vmode???1?:?-1));

    ????????
    if?(o.xMapper)????????nx?=?o.xMapper(y)
    ????????
    else?if?(o.yMapper)????ny?=?o.yMapper(x)
    ????????
    ????????
    //效果體現
    ????????Drag.obj.root.style[o.hmode???"left"?:?"right"]?=?nx?+?"px";
    ????????Drag.obj.root.style[o.vmode?
    ??"top"?:?"bottom"]?=?ny?+?"px";
    ????????Drag.obj.lastMouseX????
    =?ex;
    ????????Drag.obj.lastMouseY????
    =?ey;
    ????????
    //調用外置函數
    ????????Drag.obj.root.onDrag(nx,?ny);
    ????????
    return?false;
    ????},
    ????
    ????
    //由?function?start>>?document.onmouseup????????=?Drag.end;
    ????end?:?function()
    ????{
    ????????document.onmousemove?
    =?null;
    ????????document.onmouseup???
    =?null;
    ????????Drag.obj.root.onDragEnd(????parseInt(Drag.obj.root.style[Drag.obj.hmode?
    ??"left"?:?"right"]),?
    ????????????????????????????????????parseInt(Drag.obj.root.style[Drag.obj.vmode?
    ??"top"?:?"bottom"]));
    ????????Drag.obj?
    =?null;
    ????},
    ????
    ????
    //跨?瀏覽器?得到?event
    ????fixE?:?function(e)
    ????{
    ????????
    if?(typeof?e?==?'undefined')?e?=?window.event;
    ????????
    if?(typeof?e.layerX?==?'undefined')?e.layerX?=?e.offsetX;
    ????????
    if?(typeof?e.layerY?==?'undefined')?e.layerY?=?e.offsetY;
    ????????
    return?e;
    ????}
    };

    posted @ 2008-09-14 11:28 G_G 閱讀(2676) | 評論 (0)編輯 收藏


    參考:
    http://neil-jh.javaeye.com/blog/199345

    效果:
  • google



  • <%@?page?language="java"?contentType="text/html;?charset=UTF-8"
    ????pageEncoding
    ="UTF-8"%>
    <%@taglib?uri="/struts-tags"?prefix="s"%>
    <%@taglib?uri="http://java.sun.com/jstl/core_rt"?prefix="c"%>
    <!DOCTYPE?html?PUBLIC?"-//W3C//DTD?HTML?4.01?Transitional//EN"?"http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    ??
    <meta?http-equiv="Content-Type"?content="text/html;?charset=UTF-8">
    <title>Insert?title?here</title>
    </head>
    <body>
    <li>
    ????
    <!--?類中靜態變量??-->
    ????
    <s:property?value="%{@action.SsdAction@GOOD}"/>
    ??????
    ????
    <!--?調用?方法?-->
    ??????
    <s:set?name="num"?value="20"?/>
    ????
    <s:set?name="listData"?value="%{?ssdMethod.getBeans(#num)??}"?/>
    ????
    ????
    <!--?和?jstl?配合使用?-->
    ????
    <select>
    ????????
    <c:forEach?var="btmp"?items="${listData}">
    ????????????
    <option?value="${btmp.id}?}">${btmp.name}</option>
    ????????
    </c:forEach>
    ????
    </select>
    ????
    ????
    <!--?調用枚舉類?
    ????????public?enum?Type?{
    ????????????//id?value?:?gget?sset?
    ????????????g1(1,"test1"),
    ????????????g2(2,"test2"),
    ????????????g3(3,"test3");
    ????????????.
    ????
    -->
    ????
    <s:select?list="%{?@myEnum.Type@values()?}"?listKey="id"?listValue="value"?/>

    ????
    <!--?循環遍歷?添加邏輯?..{?#this.id>2?}?-->
    ????
    <s:select?list="%{?@myEnum.Type@values().{?#this.id>2?}?}"?listKey="id"?listValue="value"?/>

    </li>


    </body>
    </html>

    posted @ 2008-09-11 16:04 G_G 閱讀(435) | 評論 (0)編輯 收藏

    haptic 觸覺?
    ?? --of or relating to the sensation of touch.
    ?? --關于???????????? 觸動???????????????????????? 感覺。

    ?????????????????? haptics is the science of applying tactile sensation to humen interaction with computers .
    字面翻譯:? 觸覺論?? 是? 一種? 科學 ? ? ?? 申請 ? ? ? ? ?? ???? 觸覺?????????????????? 與? 人類?????? 互動??????????? 和?????? 電腦
    ??????????????? : 觸覺論 是將人類的接觸感覺應用與計算機連接的一門科學。


    ?????? A haptic device is one that involves physical contact between the computer and the user .
    》》一個觸覺設備??????????? 是一個???????? 涉及????? 物理 ?????? 連接?????? 在?????????????????? 電腦????? ? ?? ??? 和??? 人
    》》一個觸覺設備包含 計算機和用戶之間的物理連接

    ???? usually through an input/output device,such as a joystick or?? data gloves ,that senses the body,s movements.
    》》通常???? 通過???????? 一個 輸入/輸出? 設備 ? , 比如 ? ? 一個 操縱桿 或??? 數據手套 , 這些設備? ?? 感覺?? 身體的移動 。

    posted @ 2008-09-10 23:14 G_G 閱讀(168) | 評論 (0)編輯 收藏

    主頁:http://code.google.com/apis/protocolbuffers/docs/overview.html

    testProto.proto

    package?foo.bar;
    option?java_package?
    =?"com.proto";

    message?Person?{
    ??required?string?name?
    =?1;
    ??required?int32?id?
    =?2;
    ??optional?string?email?
    =?3;

    ??enum?PhoneType?{
    ????MOBILE?
    =?0;
    ????HOME?
    =?1;
    ????WORK?
    =?2;
    ??}

    ??message?PhoneNumber?{
    ????required?string?number?
    =?1;
    ????optional?PhoneType?type?
    =?2?[default?=?HOME];
    ??}

    ??repeated?PhoneNumber?phone?
    =?4;
    }

    運行命令
    '/home/kaiyi/proto/bin/protoc'? --java_out=src testProto.proto?


    使用(? 本類可用,builder 可改,開用但 list 刪除要使用比較郁悶的方法刪除!)
    package?unit;

    import?java.util.ArrayList;
    import?java.util.Arrays;
    import?java.util.Collections;
    import?java.util.List;

    import?com.google.protobuf.InvalidProtocolBufferException;
    import?com.proto.TestProto;
    import?com.proto.TestProto.Person;
    import?com.proto.TestProto.Person.PhoneNumber;

    public?class?Main?{
    ????
    public?static?void?main(String[]?args)?throws?InvalidProtocolBufferException?{
    ????????
    //空創建
    ????????Person.Builder?builder?=?Person.newBuilder();
    ????????builder.setName(
    "liukaiyi");
    ????????builder.setId(
    1);
    ????????
    ????????builder.setEmail(
    "email");
    ????????
    ????????PhoneNumber.Builder?pBuilder1?
    =?PhoneNumber.newBuilder();
    ????????pBuilder1.setNumber(
    "1");
    ????????pBuilder1.setType(TestProto.Person.PhoneType.MOBILE);
    ????????
    ????????
    ????????PhoneNumber.Builder?pBuilder2?
    =?PhoneNumber.newBuilder();
    ????????pBuilder2.setNumber(
    "2");
    ????????pBuilder2.setType(TestProto.Person.PhoneType.HOME);
    ????????
    ????????
    ????????
    ????????builder.addPhone(pBuilder1);
    ????????builder.addPhone(pBuilder2);
    ???????
    //此處為存儲到數據庫 或 傳輸!
    byte[]?data?=?builder.build().toByteArray()?;
    ????????
    for(byte?tb?:?data?)
    ????????????System.out.print(?(
    char)tb?);
    ????????
    ????????
    ????????
    //組建
    ????????Person?person?=?Person.parseFrom(data);
    ????????Person.Builder?builder2?
    =?Person.newBuilder(person);
    ????????builder2.setEmail(
    "test");
    ????????
    ????????PhoneNumber.Builder?pBuilder3?
    =?PhoneNumber.newBuilder();
    ????????pBuilder3.setNumber(
    "3");
    ????????pBuilder3.setType(TestProto.Person.PhoneType.HOME);
    ????????builder2.addPhone(pBuilder3);
    ???????
    //這 我最不明白的地方 , list 這 只能 使用 這種方法才可以刪除 list ????
    ??? ??? List list = new ArrayList(builder2.getPhoneList());
    ??? ??? List<PhoneNumber> ltmp =? builder2.getPhoneList() ;
    ??? ??? for(int i=0;i<list.size();i++ ){
    ??? ??? ??? if(ltmp.get(i).getNumber().equals("2"))
    ??? ??? ??? ??? list.remove( ltmp.get(i) ) ;
    ??? ??? }
    ??? ??? builder2.clearPhone().addAllPhone(list);

    ??????? builder2.clearEmail();

    ????????System.out.println(list.size());
    ????????System.out.println();
    ????????
    byte[]?data2?=?builder2.build().toByteArray()?;
    ????????
    for(byte?tb?:?data2?)
    ????????????System.out.print(?(
    char)tb?);
    ????????
    ????????
    ????????
    ????????
    ????}
    }



    posted @ 2008-09-08 17:01 G_G 閱讀(2760) | 評論 (0)編輯 收藏



    <? xml?version="1.0"?encoding="utf8"? ?>
    <% @?page?language = " java " ?contentType = " text/html;?charset=utf8 " ?pageEncoding = " utf8 " %>
    <% @taglib?uri = " /WEB-INF/struts-tags.tld " ?prefix = " s " %>
    <% @taglib?uri = " /WEB-INF/ljw.tld " ?prefix = " ljw " %>
    ????

    <% @page?import = " com.ljw.bean.CorrectionWrong " %>
    <% @page?import = " com.ljw.bean.CorrectionWrong.State " %>
    <% @page?import = " com.opensymphony.xwork2.util.ValueStack " %> < html? xmlns ="http://www.w3.org/1999/xhtml" >
    < head >
    < meta? http-equiv ="Content-Type" ?content ="text/html;?charset=utf8" ? />
    < title > Insert?title?here </ title >
    < script? type ="text/javascript" ?src ="../js/prototype.js" ></ script >
    < script? type ="text/javascript" ?src ="../js/jsMsg.jsp" ></ script >
    < script? type ="text/javascript" ?src ="../js/comm.js" ></ script >
    < SCRIPT? language =JavaScript? src ="../js/supertable/dialog.js" ?type =Text/JavaScript ></ SCRIPT >
    </ head >
    < body >
    < div? id ="communityDiv" >
    < s:set? name ="" ></ s:set >
    < s:iterator? id ="d" ?value ="%{pageList.objectList}" >
    ????用戶名字:
    < s:property? value ="#d.userInfo.userName" />< br >
    ????url:
    < s:property? value ="#d.url" />< br >
    ????狀態:
    < s:property? value ="#d.ecwState.value" />< br >
    ????糾錯:
    < s:property? value ="#d.cwArticle" /></ br >
    ????編輯輸入:
    < textarea? rows ="10" ?cols ="50" ?id ='<s:property? value ="#d.id" /> '?> < s:property? value ="#d.boardmasterDesc" /></ textarea >
    ????
    < input? type ="button" ?onclick ="getUpdate('<s:property?value=" #d.id" /> ')"/>
    < hr />
    </ s:iterator >
    < br />
    < ljw:pages? value ="%{pageList.pages}" ?javaScript ="loadCommunityListUrl" />
    </ div >
    </ body >
    < script? type ="text/javascript" >
    function ?loadCommunityListUrl(url)?{
    ?????$('communityDiv').innerHTML?
    = ?pageLoadingCenter;
    ??????
    var ?urls? = ?getActionName(url);
    ??????
    var ?pars? = ?getActionPars(url);
    ??????
    var ?myAjax? = ? new ?Ajax.Updater( " communityDiv " ,?urls,?{method:?'post',?parameters:?pars});
    ????}
    var ?request? = ? false ;
    try ?{
    ??request?
    = ? new ?XMLHttpRequest();
    }?
    catch ?(trymicrosoft)?{
    ??
    try ?{
    ????request?
    = ? new ?ActiveXObject( " Msxml2.XMLHTTP " );
    ??}?
    catch ?(othermicrosoft)?{
    ????
    try ?{
    ??????request?
    = ? new ?ActiveXObject( " Microsoft.XMLHTTP " );
    ????}?
    catch ?(failed)?{
    ??????request?
    = ? false ;
    ????}??
    ??}
    }
    if ?( ! request)
    ??alert(
    " Error?initializing?XMLHttpRequest! " );
    ??
    var ?_robj? = ? null ?;
    function ?getUpdate(ki)?{
    ??_robj?
    = ?document.getElementById(ki)?;
    ??
    var ?urls? = 'cwmain. do ';
    ??
    var ?pars? = ?'c = ajaxUpdateByBoardMaster & cwId = ' + ki + ' & boardMasterDesc = ' + _robj.value?;
    ??request.open(
    " POST " ,?urls,? true );
    ??request.setRequestHeader(
    " Cache-Control " , " no-cache " );
    ??request.setRequestHeader(
    " content-type " , " application/x-www-form-urlencoded " );
    ??request.send(pars);
    ??request.onreadystatechange?
    =
    ?updatePage;
    }




    function ?updatePage()?{
    ????
    if ?(request.readyState? == ? 4 )?{
    ????????
    if ?(request.status? == ? 200 ? || ?request.status == 0 ?)?{
    ????????????alert(request.responseText);
    ????????????eval('
    var ?ajaxData? = ' + request.responseText);
    ????????????
    if (?ajaxData.isUpdate?){
    ?????????????????alert(?'更新成功!'?);
    ????????????}
    else {
    ????????????????alert(?'更新不成功!'?);
    ????????????}
    ????????}?
    ????}
    }



    </ script >
    </ html >

    posted @ 2008-08-16 18:15 G_G 閱讀(586) | 評論 (2)編輯 收藏



    < html > ??
    < head >< title > 拖動效果函數演示?by?Longbill.cn </ title > ??
    < style > ??

    div??
    { ??
    ????position?
    : ?absolute ; ??
    ????background-color?
    : ?#c3d9ff ; ??
    ????margin?
    : ?0px ; ??
    ????padding?
    : ?5px ; ??
    ????border?
    : ?0px ; ??
    ????width?
    : ?100px ; ??
    ????height
    : 100px ; ??
    } ??
    </ style >

    </ head > ??
    < body > ??
    ????
    ????
    < script > ??
    function ?drag(o,s)??
    {??
    ????
    if ?( typeof ?o? == ? " string " )?o? = ?document.getElementById(o);??
    ????o.orig_x?
    = ?parseInt(o.style.left)? - ?document.body.scrollLeft;??
    ????o.orig_y?
    = ?parseInt(o.style.top)? - ?document.body.scrollTop;??
    ????o.orig_index?
    = ?o.style.zIndex;??
    ??????????
    ????o.onmousedown?
    = ? function (a)??
    ????{??
    ????????
    this .style.cursor? = ? " move " ;??
    ????????
    this .style.zIndex? = ? 10000 ;??
    ????????
    var ?d = document;??
    ????????
    if ( ! a)a = window.event;??
    ????????
    var ?x? = ?a.clientX + d.body.scrollLeft - o.offsetLeft;??
    ????????
    var ?y? = ?a.clientY + d.body.scrollTop - o.offsetTop;??
    ????????
    // author:?www.longbill.cn??
    ????????d.ondragstart? = ? " return?false; " ??
    ????????d.onselectstart?
    = ? " return?false; " ??
    ????????d.onselect?
    = ? " document.selection.empty(); " ??
    ??????????????????
    ????????
    if (o.setCapture)??
    ????????????o.setCapture();??
    ????????
    else ? if (window.captureEvents)??
    ????????????window.captureEvents(Event.MOUSEMOVE
    | Event.MOUSEUP);??

    ????????d.onmousemove?
    = ? function (a)??
    ????????{??
    ????????????
    if ( ! a)a = window.event;??
    ????????????o.style.left?
    = ?a.clientX + document.body.scrollLeft - x;??
    ????????????o.style.top?
    = ?a.clientY + document.body.scrollTop - y;??
    ????????????o.orig_x?
    = ?parseInt(o.style.left)? - ?document.body.scrollLeft;??
    ????????????o.orig_y?
    = ?parseInt(o.style.top)? - ?document.body.scrollTop;??
    ????????}??

    ????????d.onmouseup?
    = ? function ()??
    ????????{??
    ????????????
    if (o.releaseCapture)??
    ????????????????o.releaseCapture();??
    ????????????
    else ? if (window.captureEvents)??
    ????????????????window.captureEvents(Event.MOUSEMOVE
    | Event.MOUSEUP);??
    ????????????d.onmousemove?
    = ? null ;??
    ????????????d.onmouseup?
    = ? null ;??
    ????????????d.ondragstart?
    = ? null ;??
    ????????????d.onselectstart?
    = ? null ;??
    ????????????d.onselect?
    = ? null ;??
    ????????????o.style.cursor?
    = ? " normal " ;??
    ????????????o.style.zIndex?
    = ?o.orig_index;??
    ????????}??
    ????}??
    ??????
    ????
    if ?(s)??
    ????{??
    ????????
    var ?orig_scroll? = ?window.onscroll ? window.onscroll: function ?(){};??
    ????????window.onscroll?
    = ? function ?()??
    ????????{??
    ????????????orig_scroll();??
    ????????????o.style.left?
    = ?o.orig_x? + ?document.body.scrollLeft;??
    ????????????o.style.top?
    = ?o.orig_y? + ?document.body.scrollTop;??
    ????????}??
    ????}??
    }??
    </ script > ??

    < div? id ="div1" ?style ="left:10px;top:10px;" > div1:我可以被拖動 </ div > ??
    < div? id ="div2" ?style ="left:120px;top:10px;background-color?:?#f3d9ff" > div2:來拖我呀 </ div > ??
    < div? id ="div3" ?style ="left:230px;top:10px;background-color?:?#c3ffff" > div3:我隨便你拖 </ div > ??
    < div? id ="div4" ?style ="left:10px;top:120px;background-color?:?#c3d944" > div4:我可以隨窗口滑動,把我拖到最下面,然后滾動網頁看看 </ div > ??
    < div? id ="div5" ?style ="left:120px;top:120px;background-color?:?#f3d944" > 作者:?Longbill
    < a? href =http://www.longbill.cn? target =_blank > www.longbill.cn </ a > ??
    </ div > ??
    < div? id ="div6" ?style ="left:230px;top:120px;background-color?:?#e3f944;width:200px;" > 參數說明:
    ??
    drag(obj?[,scroll]);
    ??
    obj:對象的id或對象本身;
    ??
    scroll(可選):對象是否隨窗口拖動而滑動,默認為否
    ??
    鼠標右鍵查看源代碼??
    </ div > ??


    < script > ??
    drag(
    " div1 " );??
    drag(
    " div2 " );??
    drag(
    " div3 " );??
    drag(
    " div4 " , 1 );??
    drag(
    " div5 " , 1 );??
    drag(
    " div6 " , 1 );??


    </ script > ??

    </ body > ?

    posted @ 2008-08-16 17:22 G_G 閱讀(322) | 評論 (0)編輯 收藏

    demo 下載: http://m.tkk7.com/Files/Good-Game/div_.rar
    運行 div.html


    html:
    <html>
    <head>
    <script?type="text/javascript"?src="prototype.js"></script>
    <script?type="text/javascript"?src="drag.js"></script>
    <META?http-equiv=Content-Type?content="text/html;?charset=utf8">
    </head>

    <body>
    <a
    ????
    onclick="getDrag(event,
    ?????????????????????'ajax.html?id=5',
    ?????????????????????'position:absolute;display:none;left:50;??top:10;??z-index:1000;??padding:0px;??background-color:#FFFFCC;??color:#201000;??font-size:12px;??border:5px???solid???#284860;',
    ??????????????????????'background-color:#CCFFCC;')"
    >測試使用(請點擊)
    </a>
    </body>
    </html>



    js.
    //?參考?:?http://hi.baidu.com/foxlively/blog/item/0ce341b3f0c050a2d8335af8.html
    //
    ?使用?:?prototype.js?
    //
    使用方法?
    var?_div1?=?null;
    var?_style2?=?null;

    function?getDrag(event,?url,divId,?style1,?style2)?{
    ????
    ????
    if?(style2)
    ????????_style2?
    =?style2;
    ????
    else
    ????????_style2?
    =?"";
    ????
    ????
    if(divId==null)
    ????????_div1?
    =?document.createElement("div");
    ????
    else
    ????????_div1?
    =?document.getElementById(divId);
    ????
    ????_div1.style.position?
    =?'absolute';
    ????_div1.style.display?
    =?'none';

    ????
    if?(_div1.style.border?==?null?||?_div1.style.border?==?'')
    ????????_div1.style.border?
    =?'1px?solid?#284860';

    ????
    if?(style1)
    ????????_div1.setAttribute('style',?style1);
    ????actionAjax(url);
    ????document.body.appendChild(_div1);
    ????showByEvent(event,?_div1);
    }


    function?getActionName(url)?{
    ????
    var?question?=?url.indexOf("?");
    ????
    if?(question?>?0)?{
    ????????
    return?url.substring(0,?question);
    ????}
    ????
    else?{
    ????????
    return?url;
    ????}
    }

    function?getActionPars(url)?{
    ????
    var?question?=?url.indexOf("?");
    ????
    if?(question?>?0)?{
    ????????
    return?url.substring(question+1,?url.length);
    ????}
    ????
    else?{
    ????????
    var?d?=?new?Date();
    ????????
    var?t?=?d.getTime();
    ????????
    return?"timestamp="+t;
    ????}
    }


    function?actionAjax(url)?{
    ????
    var?urls?=?getActionName(url);
    ????
    var?pars?=?getActionPars(url);
    ????
    var?myAjax?=?new?Ajax.Updater(_div1,?urls,?{
    ????????method?:'post',
    ????????parameters?:pars,
    ????????onComplete?:_action
    ????});
    }

    function?_action(req)?{
    ????
    var?varhtml?=?"<div?id=\"_drag_div\"?style=\""
    ????????????+?_style2
    ????????????+?
    "\"?align=\"right\"><br/><a?href=\"javascript:;\"?onclick=\"this.parentNode.parentNode.style.display='none';this.parentNode.parentNode.innerHTML=null;\">[關閉]</a></div>"
    ????????????
    +?req.responseText
    ????????????
    +"<div?id=\"_drag_div\"?style=\""
    ????????????+?_style2
    ????????????+?
    "\"?align=\"left\"><br/><a?href=\"javascript:;\"?onclick=\"this.parentNode.parentNode.style.display='none';this.parentNode.parentNode.innerHTML=null;\">[關閉]</a></div>"
    ????????????;
    ????
    //varhtml?=??varhtml.replace(/form[?]+action=["'](.*)["']/gi,?"form?action=\"javascript:actionAjax('$1');\"?")??;
    ??????????????????????????????
    ????_div1.innerHTML?
    =?varhtml;
    ????
    var?drag?=?new?Drag();
    ????
    //?drag.build(div1);//拖動本身
    ????drag.build(_div1,?_div1.firstChild);//?通過一個對象拖動另一個對象
    ????//drag.build(_div1,?_div1.lastChild);//?通過一個對象拖動另一個對象
    }


    function?showByEvent(event,?useDiv)?{
    ????useDiv.style.display?
    =?"";
    ????useDiv.style.left?
    =?mouseX(event);
    ????useDiv.style.top?
    =?mouseY(event);
    }


    function?mouseX(ev)?{
    ????
    if(?ev?==?null?)ev?=?event?||?window.event?;
    ????
    if(ev.clientX){
    ????????
    return?ev.clientX?+?document.body.scrollLeft?-?document.body.clientLeft;
    ????}
    else?if(ev.pageX){
    ????????
    return?ev.pageX;
    ????}
    }
    function?mouseY(ev)?{
    ????
    if(?ev?==?null?)ev?=?event?||?window.event?;
    ????
    if(ev.clientY){
    ????????
    return?ev.clientY?+?document.body.scrollTop?-?document.body.clientTop?;
    ????}
    else?if(ev.pageX){
    ????????
    return?ev.pageY;
    ????}
    }

    function?Drag()?{
    }
    Drag.prototype.baseX?
    =?0;
    Drag.prototype.baseY?
    =?0;
    Drag.prototype.lastX?
    =?0;
    Drag.prototype.lastY?
    =?0;
    Drag.prototype.nowX?
    =?0;
    Drag.prototype.nowY?
    =?0;
    Drag.prototype.obD?
    =?null;
    Drag.prototype.obM?
    =?null;
    Drag.prototype.build?
    =?function(_obD,?_obM)?{
    ????
    if?(_obM)?{
    ????????Drag.prototype.obM?
    =?_obM;
    ????}?
    else?{
    ????????Drag.prototype.obM?
    =?_obD;
    ????}
    ????Drag.prototype.obD?
    =?_obD;
    ????Drag.prototype.obM.onmousedown?
    =?function(event)?{
    ????????Drag.prototype.lastX?
    =?mouseX(event);
    ????????Drag.prototype.lastY?
    =?mouseY(event);
    ????????Drag.prototype.baseX?
    =?Drag.prototype.obD.style.left;
    ????????Drag.prototype.baseY?
    =?Drag.prototype.obD.style.top;
    ????????
    this.onmousemove?=?function(event)?{
    ????????????Drag.prototype.nowX?
    =?mouseX(event);
    ????????????Drag.prototype.nowY?
    =?mouseY(event);
    ????????????Drag.prototype.obD.style.left?
    =?(parseFloat(Drag.prototype.baseX)
    ????????????????????
    +?Drag.prototype.nowX?-?Drag.prototype.lastX)
    ????????????????????
    +?"px";
    ????????????Drag.prototype.obD.style.top?
    =?(parseFloat(Drag.prototype.baseY)
    ????????????????????
    +?Drag.prototype.nowY?-?Drag.prototype.lastY)
    ????????????????????
    +?"px";
    ????????}
    ????}
    ????Drag.prototype.obM.onmouseup?
    =?function(event)?{
    ????????
    //?obD.onmouseup?=?null;
    ????????Drag.prototype.obD.onmousemove?=?null;
    ????????Drag.prototype.obM.onmousemove?
    =?null;
    ????}
    ????Drag.prototype.obM.onmouseout?
    =?function()?{
    ????????
    //?obM.onmouseup?=?null
    ????????Drag.prototype.obM.onmousemove?=?null;
    ????????Drag.prototype.obD.onmousemove?
    =?null;
    ????}
    }

    posted @ 2008-08-14 14:11 G_G 閱讀(1523) | 評論 (1)編輯 收藏

    參考:http://www.programbbs.com/bbs/view25-12320-1.htm
    但上面的 一些sql語句 ,有查詢時間問題,在此我已于改正了并希望和大家分享。

    ---------自我感覺 第四題 很不錯!-------------


    ----------------------------------------------------------------------
    第一題(只要重復的都要?輸出)
    ----------------------------------------------------------------------
    create?table?c?(id?int?);
    insert?into?c?values?(1),(2),(3),(4),(3),(5),(6),(1);
    結果:
    ????
    select?id?from?c?group?by?id?having?count(id)>1?;
    附加(查詢重復最多的倒排)
    select?bid,count(bid)?as?cu?from?tb?group?by?bid?having?count(bid)>1??order?by?cu??desc





    ----------------------------------------------------------------------
    第二題(報表查詢橫向輸出)
    查詢后的結果:
    Create table d(id int,name varchar(50));
    insert into d values(1,'gly');
    insert into d values(2,'ptgly');
    insert into d values(3,'ybgly');
    insert into d values(4,'ptgly');
    insert into d values(5,'ybgly');
    +---+-----+------+
    |gly|ptgly|ybgly | ????
    |---+-----+------+-
    |1? |2??? |2???? |
    +---+-----+------+
    -----------------------------------------------------------------------
    select?
    ????
    sum(case?when?name='gly'?then?1?else?0?end?)?as?gly??,
    ????
    sum(case?when?name='ptgly'?then?1?else?0?end?)?as?ptgly??,
    ????
    sum(case?when?name='ybgly'?then?1?else?0?end?)?as?ybgly??
    from?d?;



    第三題
    可以根據上面 2,4 可以得出 。
    下面我們詳細說下 4題。


    -----------------------------------------------------------------------
    第四題(復雜組合查詢?。?br />create table table_a (No int, No2 int,num double,itime date);
    insert into table_a values
    ???? (1234,567890,33.5,'2004-12-21'),
    ???? (1234,598701,44.8,'2004-11-21'),
    ???? (1234,598701,45.2,'2004-10-01'),
    ???? (1234,567890,66.5,'2004-9-21'),
    ???? (3456,789065,22.5,'2004-10-01'),
    ???? (3456,789065,77.5,'2004-10-27'),
    ???? (3456,678901,48.5,'2004-12-21');
    按月統計銷售表中貨物的銷售量數
    查詢結果如下:
    ? No, No2 ,?? 九月,  十月,十一月,十二月
    1234,567890, 66.5 ,  0 ,  0? ,? 33.5
    1234,598701,? 0?? , 45.2, 44.8, 0
    3456,789065, 0? ,  100,  0? ,  0
    3456,678901, 0 ,??? 0,??? 0? ,? 48.5
    -----------------------------------------------------------------------
    //當然也可以 使用mysql 時間函數 在軟件編輯時 你可以輸入 String[] 并根據數據動態拼寫 sql( case部分!! )
    //這個 例子很好 哦!報表可以一句sql 得出!

    select?NO,NO2,
    ????
    sum(case??when?itime?like?'2004-%9%'?then?num?else?0?end)?as?9M,
    ????
    sum(case??when?itime?like?'2004-10%'?then?num?else?0?end)?as?10M,
    ????
    sum(case??when?itime?like?'2004-11%'?then?num?else?0?end)?as?11M,
    ????
    sum(case??when?itime?like?'2004-12%'?then?num?else?0?end)?as?12M
    from?table_a?group?by?no,no2?order?by?no,no2?;


    --------------------------------------------------------------
    第五題
    代碼,名稱
    1???? a
    2???? b
    11??? c
    (代碼11表示為1的下級)
    我要通過一條句子,得出如下結果:

    代碼,名稱,有無下級
    1???? a???? 有
    2???? b???? 無
    11??? c???? 無


    Create table TabTest(t_Code varchar(10),t_Name varchar(10));
    insert into TabTest values('1','a');
    insert into TabTest values('2','b');
    insert into TabTest values('11','c');
    --------------------------------------------------------------
    select?tt1.t_Code,tt1.t_name,(?
    ?????
    case?
    ?????????????
    when?exists?(select?1?from?tabtest?tt2?
    ???????????????????????????????????????
    where?tt2.t_code?like?CONCAT(tt1.t_code,'%')?and?
    ??????????????????????????????????????? tt2.t_code?
    <>?tt1.t_code?)??then?'you'?
    ?????????????
    else?'wu'
    ??????
    end?)?as?you_wu
    from?tabtest??tt1?;








    posted @ 2008-08-09 22:00 G_G 閱讀(3476) | 評論 (9)編輯 收藏

    僅列出標題
    共16頁: 上一頁 1 2 3 4 5 6 7 8 9 下一頁 Last 
    主站蜘蛛池模板: 亚洲乱码日产精品BD在线观看| 亚洲国产精品日韩在线| 免费无码黄网站在线看| 亚洲老熟女@TubeumTV| 天天天欲色欲色WWW免费| 久久精品免费网站网| 狠狠色伊人亚洲综合网站色| 国产精品无码素人福利免费 | 亚洲色大成WWW亚洲女子| 国产亚洲av人片在线观看| 67194成手机免费观看| 美女裸体无遮挡免费视频网站| 亚洲成色在线综合网站| 日韩免费a级在线观看| 国产精品99久久免费观看| 日本亚洲欧美色视频在线播放| 亚洲狠狠综合久久| 亚洲欧洲日产国码高潮αv| 在线观看日本免费a∨视频| a毛片久久免费观看| 国产成人人综合亚洲欧美丁香花| 亚洲日韩区在线电影| 亚洲国产主播精品极品网红| 91免费资源网站入口| 久久午夜无码免费| 一级做a爱过程免费视频高清| 学生妹亚洲一区二区| 久久精品国产亚洲AV大全| 亚洲精品无码日韩国产不卡?V| 国产免费av片在线看| 久久99精品视免费看| 国产伦精品一区二区免费| 亚洲狠狠婷婷综合久久| 亚洲理论精品午夜电影| 亚洲成AV人在线播放无码| 亚洲精品tv久久久久久久久久| 免费无码看av的网站| 免费看韩国黄a片在线观看| 69影院毛片免费观看视频在线| 免费无码H肉动漫在线观看麻豆| 日韩a毛片免费观看|