狂想的蛇之黃金時(shí)代已過
          徘徊在工程和藝術(shù)之間

          2006年4月6日

          類名:
          ? org.apache.commons.collections.BeanMap

          用法:
          ? //...得到orderLine
          ? Map<String,Object> map = new BeanMap(orderLine);
          ? map.put("vendorDiscount",orderLine.getProduct().getVendor().getDiscount());
          ??//得到orderLine
          ??Map<String,Object>?map?=?new?BeanMap(orderLine);
          ??map.put(
          "vendorDiscount",orderLine.getProduct().getVendor().getDiscount());

          使用場景:
          ? dwr中可以直接把java對象轉(zhuǎn)換成js對象傳回,但是有時(shí)候需要在傳回的對象上附加屬性,例如在訂單項(xiàng)(訂單中的一行)中,我想附加相關(guān)產(chǎn)品供應(yīng)商信用等級優(yōu)惠條件,如果直接把對象關(guān)系圖傳過去,需要傳4層,其實(shí)我只要在訂單項(xiàng)后附加一個(gè)屬性就行了。所以我就先把訂單項(xiàng)(OrderLine)轉(zhuǎn)化為一個(gè)map,向這個(gè)map中put新的屬性,這樣傳回到瀏覽器的對象還是和以前一樣的,只是附加了一個(gè)vendorDiscount:0.6 .

          posted @ 2006-11-08 20:04 黃金時(shí)代已過 閱讀(3003) | 評論 (0)編輯 收藏
           
          其一:
          <div height="300px" style="overflow:scroll;">...</div>后滾動(dòng)條死活不出來,如果寫成

          <style>
          .scrollbox{
          ? height:300px;
          ? overflow:scroll;
          }
          </style>
          <div class="scrollbox">...</div>
          就一切正常。

          后來發(fā)現(xiàn)如果直接使用style屬性,應(yīng)該寫成<div style="height:300px; overflow:scroll;">...</div>
          nnd,郁悶,不禁敬仰美工的工作。

          其二:
          為了圖簡便,直接用dwr調(diào)用了manager的方法時(shí),manager中引用的其他manager總是null,仔細(xì)想想,發(fā)現(xiàn)manager是由spring管理的,所以應(yīng)該creator="spring",而不是creator="new"。得解。
          這樣調(diào)用終歸不爽,還是應(yīng)該有services才行,看來偷懶是不行了。

          另:昨晚看了一下dwr2.0,發(fā)現(xiàn)ajax終于走到正道上了。Reverse Ajax! 在java中設(shè)置界面控件的內(nèi)容,細(xì)粒度的請求和更新,由后臺來主導(dǎo)完整業(yè)務(wù)邏輯,而html就像c/s程序中的資源文件一樣被加載,這樣才能真正適合企業(yè)應(yīng)用(網(wǎng)站還是用以前的才對)。環(huán)境已經(jīng)成熟,到應(yīng)用不知道還要等多久
          posted @ 2006-11-07 22:48 黃金時(shí)代已過 閱讀(164) | 評論 (0)編輯 收藏
           
          今天無意中竟然下載到了Refactoring Databases,哎呀,貪財(cái)貪財(cái)!
          開發(fā)過程中database schema 的變化總是引起很多麻煩,希望這本書能有所幫助。
          posted @ 2006-04-18 11:36 黃金時(shí)代已過 閱讀(388) | 評論 (1)編輯 收藏
           

          Ruby中遞歸層數(shù)好像有限制,如函數(shù)
          def test(a)
          ?? if a==1
          ???? 1
          ?? else
          ???? a*test(a-1)
          ?? end
          end?

          puts test(780)
          輸出:84972392897964072098249533940415832032901226147549483885937628906393387016759749166779390912108512193770727396731176148684817099219862241070518329897737419790700834153338358789804054247254662503406001643932256413944181262536626134781963753899870200241216683120301369375204827350328695627459108294334206019027913654171970749305552969884823232609436511764040695691647958710090181422374514248844937618454949350242415512115167050621676322866110695044767187626021475743251277035950696737988473189355598223688184822894258942937354547600827689072340880783574157611601536909313655637665907495308227315772813753604514703047972667545052382993341295609886125445821680344472136291787954204104578202488733326674486963013530280156726975853827440416172311405531398732685573114934257635906047009853269995109193159402626590282423997495520628272375213203911332399362264123774789131108251376802391556145557618075940012872003438523613025838162437433166091728438034202592564763334170361422871174553523479072202135150477947497462319792004248488747067669226929977889728474667753117513554197181549148693463434107347395476738175071015937790196691810903035212156632705787120639270121315037723516623976522946189161132382463371686857543746042274574224547052957738646625809966919808812294116127379399188579075359032740380579901160073141745025441935558361164158736914927029701136227557285045299271693750581590882877670856450852068994081414494717924806473008367067880435766156267541200120373117672789242005510204657433232442062443350842731528466220850546079536126591907570634996939687881634634077903962785409702209303560414980140946811644475359177263347973998479963954822343870777236845722878913093643097703061981548194975005332841862304172509388532508262400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000


          puts test(781)
          輸出:
          E:/eclipse-SDK-3.2M6-win32/workspace/testruby/Test5.rb:5:in `*': stack level too deep (SystemStackError)
          from E:/eclipse-SDK-3.2M6-win32/workspace/testruby/Test5.rb:5:in `test'
          from E:/eclipse-SDK-3.2M6-win32/workspace/testruby/Test5.rb:5:in `test'
          from E:/eclipse-SDK-3.2M6-win32/workspace/testruby/Test5.rb:5:in `test'
          from E:/eclipse-SDK-3.2M6-win32/workspace/testruby/Test5.rb:5:in `test'
          from E:/eclipse-SDK-3.2M6-win32/workspace/testruby/Test5.rb:5:in `test'
          from E:/eclipse-SDK-3.2M6-win32/workspace/testruby/Test5.rb:5:in `test'
          from E:/eclipse-SDK-3.2M6-win32/workspace/testruby/Test5.rb:5:in `test'
          from E:/eclipse-SDK-3.2M6-win32/workspace/testruby/Test5.rb:5:in `test'
          ?... 727 levels...
          from E:/eclipse-SDK-3.2M6-win32/workspace/testruby/Test5.rb:5:in `test'
          from E:/eclipse-SDK-3.2M6-win32/workspace/testruby/Test5.rb:5:in `test'
          from E:/eclipse-SDK-3.2M6-win32/workspace/testruby/Test5.rb:5:in `test'
          from E:/eclipse-SDK-3.2M6-win32/workspace/testruby/Test5.rb:9

          posted @ 2006-04-07 13:06 黃金時(shí)代已過 閱讀(1033) | 評論 (1)編輯 收藏
           
          Ruby一直被認(rèn)為沒有好的IDE,今天把RDT跑起來了,還不錯(cuò),雖然還不能和JDT相比。

          使用 Eclipse 插件 Ruby Development Tools
          http://www-128.ibm.com/developerworks/cn/opensource/os-rubyeclipse/

          為何配合RDT,我特地下載了一個(gè)Eclipse3.2M6,界面好花哨,但用起來心虛虛的,干活還使用3.1踏實(shí)。
          posted @ 2006-04-07 11:10 黃金時(shí)代已過 閱讀(360) | 評論 (0)編輯 收藏
           
          在ruby和相關(guān)的一些一切被說得很神時(shí),聽聽一個(gè)異端的發(fā)言

          Why Ruby on Rails won't become mainstream
          http://beust.com/weblog/archives/000382.html
          posted @ 2006-04-06 18:36 黃金時(shí)代已過 閱讀(231) | 評論 (0)編輯 收藏
           
          主站蜘蛛池模板: 东山县| 务川| 富裕县| 内江市| 岳池县| 中牟县| 洪洞县| 福建省| 康马县| 连山| 宁武县| 二连浩特市| 乡城县| 礼泉县| 深州市| 格尔木市| 巴里| 木里| 图木舒克市| 呼和浩特市| 棋牌| 衡水市| 北流市| 江都市| 台南县| 临湘市| 保定市| 共和县| 柘荣县| 九龙城区| 黄山市| 剑河县| 贵德县| 通榆县| 广德县| 巨野县| 古丈县| 荣昌县| 桑日县| 玉屏| 连南|