Vikings

          #

          Java.util.Collection兩副結(jié)構(gòu)圖片

          ?

          這張圖片太大了。 就點擊看吧:
          http://www.falkhausen.de/download/diagram/img/java.util.Collection.gif

          posted @ 2006-10-09 17:39 Vikings 閱讀(348) | 評論 (0)編輯 收藏

          三種人

          公司有困難時的三種人:

          1。有問題不提出。
          2。提出問題,不去想解決問題方法。
          3。默默解決問題。

          公司首先會開的會是2。

          posted @ 2006-05-26 23:31 Vikings 閱讀(152) | 評論 (0)編輯 收藏

          Google 的一些秘密入口

          Google 的一些秘密入口

            http://www.google.com/microsoft?

            微軟風(fēng)格的入口
            
            http://www.google.com/mac?
            MAC風(fēng)格的入口
            
            http://www.google.com/linux?
            Linux風(fēng)格的入口
            
            http://www.google.com/bsd?
            FreeBSD風(fēng)格的入口
            
            Google有各種語言的版本,下面這些語言可能實在是稀罕了點兒
            
            http://www.google.com/intl/xx-klingon/?
            克林岡語入口(沒看過星際旅行嗎?)
            
            http://www.google.com/intl/xx-bork/?
            政治入口?
            
            http://www.google.com/intl/xx-elmer/?
            宗教入口
            
            http://www.google.com/intl/xx-piglatin/?
            小豬入口
            
            http://www.google.com/intl/xx-hacker/?
            黑客專用入口
            
            Google里還有一個小小的彩蛋游戲,大家自己去看吧!
            http://www.google.com/Easter/feature_easter.html?
            
            
            下面是一此更有用的彩蛋
            
            http://froogle.google.com/?
            作用: 通過特殊的搜索引擎,你可以在網(wǎng)上找到你想購物的網(wǎng)站位置。以及你可以很方便的搜索出同類產(chǎn)品的價格。
            
            看看世界各地的商品價格,自己再買的時候心底有數(shù)多了把
            
            http://labs.google.com/gviewer.html?
            作用:一個小玩具,適合那些連鼠標(biāo)都懶得動的懶人。當(dāng)你在google上找到了查詢結(jié)果后,你可以使用google viewer讓結(jié)果以自己定義的間隔時間來一條一條自動滾屏。
            
            http://labs.google.com/cgi-bin/webquotes?
            作用:可以搜索出你要查詢的內(nèi)容在internet上被多少其他的網(wǎng)站引用過,可以讓你知道internet上其他人對你要查詢內(nèi)容的觀點,適合寫論文和評論以及特殊用途人使用。
            
            http://labs.google.com/glossary?
            作用:顧名思義了,就是一個查英語縮寫語意的工具,google的詞匯表
            
            http://labs1.google.com/gvs.html?
            作用:給google打一個電話,說出你要查找的內(nèi)容,然后google會把你要查詢的結(jié)果顯示出來,給不識字的人用的。

          posted @ 2006-04-30 14:21 Vikings 閱讀(243) | 評論 (0)編輯 收藏

          Outlook express 看 rss feed。

          nntp協(xié)議轉(zhuǎn)換rss 協(xié)議tools:
          http://www.methodize.org/nntprss


          double click nntprss-start.jar
          Add channel .
          Delete all channels not wanted.

          可以用news://127.0.0.1 在本地開一個new Server。

          posted @ 2006-02-23 16:57 Vikings 閱讀(356) | 評論 (0)編輯 收藏

          InputStream , buffer概念

          try {
                                      String host 
          = new URL(link).getHost();
                                      String url 
          = "http://"+ host + "/favicon.ico";
                                      is 
          = new URL(url).openConnection().getInputStream();
                                      
          byte[] buffer = new byte[5000];
                                      bos 
          = new ByteArrayOutputStream();
                                      
          int bytesRead = 0;
                                      
          while ((bytesRead = is.read(buffer)) > 0{
                                          bos.write(buffer, 
          0, bytesRead);
                                      }

                                      bos.flush();
                                  }
          catch (IOException e){
                                      canDownloader 
          = false;
                                  }
          原來要從一個InputStream里面讀一個byte[],
          我是這么寫的:
          byte[] bytes = new byte[is.avlilabel]
          is.read[bytes];
          原來如果is過大的話,
          沒有buffer,有可能讀不完整。

              while ((bytesRead = is.read(buffer)) > 0{
                                          bos.write(buffer, 
          0, bytesRead);
                  }

          就沒這問題了。

          posted @ 2006-02-17 19:25 Vikings 閱讀(882) | 評論 (0)編輯 收藏

          對web.xml 的幾點配置心得。包括mime-mapping

          1.指定了自己的javaEncoding
          (參考 http://gceclub.sun.com.cn/staticcontent/html/sunone/app7/app7-dg-webapp/ch6/ch6-4.html 
             <servlet>
                  
          <servlet-name>jsp</servlet-name>
                  
          <servlet-class>org.apache.jasper.servlet.JspServlet</servlet-class>
                  
          <init-param>
                      
          <param-name>fork</param-name>
                      
          <param-value>false</param-value>
                  
          </init-param>
                          
          <init-param>
                      
          <param-name>javaEncoding</param-name>
                      
          <param-value>GB18030</param-value>
                  
          </init-param>
                  
          <init-param>
                      
          <param-name>xpoweredBy</param-name>
                      
          <param-value>true</param-value>
                  
          </init-param>
                  
          <load-on-startup>3</load-on-startup>
              
          </servlet>


           2.添加rar,iso等的mime-type映射
          避免在瀏覽器里直接打開。

          <mime-mapping>
          <extension>mht</extension>
          <mime-type>text/x-mht</mime-type>
          </mime-mapping>
          <mime-mapping>
                  
          <extension>rar</extension>
                  
          <mime-type>application/octet-stream</mime-type>
              
          </mime-mapping>
              
          <mime-mapping>
                  
          <extension>iso</extension>
                  
          <mime-type>application/octet-stream</mime-type>
              
          </mime-mapping>
              
          <mime-mapping>
                  
          <extension>ape</extension>
                  
          <mime-type>application/octet-stream</mime-type>
              
          </mime-mapping>
              
          <mime-mapping>
                  
          <extension>rmvb</extension>
                  
          <mime-type>application/octet-stream</mime-type>
              
          </mime-mapping>
              
          <mime-mapping>
                  
          <extension>ico</extension>
                  
          <mime-type>image/x-icon</mime-type>
              
          </mime-mapping>

             <mime-mapping>
             
          <extension>doc</extension>  
          <mime-type>application/msword</mime-type>  
          </mime-mapping>  
          <mime-mapping>  
             
          <extension>xls</extension>  
             
          <mime-type>application/vnd.ms-excel</mime-type>  
          </mime-mapping>  
          <mime-mapping>  
             
          <extension>ppt</extension>  
             
          <mime-type>application/vnd.ms-powerpoint</mime-type>  
          </mime-mapping>


          3.對html靜態(tài)頁面設(shè)置編碼

          <!--  修改下面兩行以支持靜態(tài)超文本的自動編碼 
            
          --> 
           
          <mime-mapping>
            
          <extension>htm</extension> 
            
          <mime-type>text/html;charset=gb2312</mime-type> 
            
          </mime-mapping>
           
          <mime-mapping>
            
          <extension>html</extension> 
            
          <mime-type>text/html;charset=gb2312</mime-type> 
            
          </mime-mapping>
            
          </web-app>



          http://sirsunny.cnblogs.com/archive/2005/08/11/212541.html

          posted @ 2006-02-17 19:22 Vikings 閱讀(4327) | 評論 (1)編輯 收藏

          java.awt.Image 的幾樣經(jīng)驗

          1. 從文件/或者Url中獲得Image.
          java.awt.image包下的

          Toolkit.getDefaultToolkit().createImage(Url)
          Toolkit.getDefaultToolkit().createImage(File);

          返回是java.awt.Image

          javax.imageio包下的:

          ImageIO.read(Url);

          返回是BufferedImage

          2. Image to bytes;

             Iterator iter = ImageIO.getImageWritersByMIMEType("image/jpeg");
                      ImageWriter writer 
          = iter.hasNext() ? (ImageWriter) iter.next() : null;
                      ByteArrayOutputStream baos 
          = new ByteArrayOutputStream();
                      ImageOutputStream ios 
          = ImageIO.createImageOutputStream(baos);
                      writer.setOutput(ios);
                      BufferedImage rendImage 
          = null;
                      
          if (image instanceof BufferedImage) {
                          rendImage 
          = (BufferedImage) image;
                      }
           else {
                          Frame frame 
          = new Frame();
                          frame.addNotify();
                          MediaTracker tracker 
          = new MediaTracker(frame);                
                          tracker.addImage(image, 
          0);
                          tracker.waitForAll();
                          rendImage 
          = new BufferedImage(image.getWidth(null),
                                  image.getHeight(
          null), 1);
                          Graphics g 
          = rendImage.createGraphics();
                          g.drawImage(image, 
          00null);
                      }

                      writer.write(
          new IIOImage(rendImage, nullnull));
                      writer.dispose();
                      
          return baos.toByteArray();

          3. 剪裁圖片
          起作用是ImageFilter

              ImageFilter smallCropFilter =new CropImageFilter(0,0,20,20);
              java.awt.Image smallImage
          = Toolkit.getDefaultToolkit().createImage(new FilteredImageSource(sourceImage.getSource(),smallCropFilter));                
                                    




           

          posted @ 2006-02-16 15:22 Vikings 閱讀(2342) | 評論 (1)編輯 收藏

          Java在Linux下不能處理圖形的解決辦法

          Java在Linux下不能處理圖形的解決辦法


          Java在圖形處理時調(diào)用了本地的圖形處理庫。在利用Java作圖形處理(比如:圖片縮放,圖片簽名,生成報表)時,如果運行在windows上不會出問題。如果將程序移植到Linux/Unix上的時候有可能出現(xiàn)圖形不能顯示的錯誤。

          提示信息:"Can't connect to X11 window server"這是由于Linux的圖形處理需要一個X Server服務(wù)器。(關(guān)于Linux的圖形處理模式參考htt p://www.douzhe.com/docs/fbsd2/5.htm)

          解決辦法:

          1.如果服務(wù)器上安裝有圖形界面,可以通過設(shè)置環(huán)境變量:DISPALY=127.0.0.1:0.0解決。

          2. 如果沒有安裝圖形界面,可以在Java運行時加上參數(shù):-Djava.awt.headless=true。

          3. 使用PJA庫來代替本地圖形處理庫。

          參考:http://www.idautomation.com/kb/xwindow-error.html Tomcat的修改如下:
          打開 %Tomcat_home%/bin/catalina.sh 文件在文件的86%處,啟動Tomcat的腳本中加上:-Djava.awt.headless=true \

          參考:
          "$_RUNJAVA" $JAVA_OPTS $CATALINA_OPTS \
          -Djava.endorsed.dirs="$JAVA_ENDORSED_DIRS"
          -classpath "$CLASSPATH" \
          -Dcatalina.base="$CATALINA_BASE" \
          -Dcatalina.home="$CATALINA_HOME" \
          -Djava.io.tmpdir="$CATALINA_TMPDIR" \
          -Djava.awt.headless=true \
          org.apache.catalina.startup.Bootstrap "$@" start \
          >> "$CATALINA_BASE"/logs/catalina.out 2>&1 &
          if [ ! -z "$CATALINA_PID" ]; then
          echo $! > $CATALINA_PID fi
          fielif [ "$1" = "stop" ] ; then

          保存后,重新啟動就可以處理圖形了。

          posted @ 2006-02-13 18:44 Vikings 閱讀(168) | 評論 (0)編輯 收藏

          常用正則表達(dá)式

          1。^\d+$  //匹配非負(fù)整數(shù)(正整數(shù) + 0) 
          2。^[0-9]*[1-9][0-9]*$  //匹配正整數(shù) 
          3。^((-\d+)|(0+))$  //匹配非正整數(shù)(負(fù)整數(shù) + 0) 
          4。^-[0-9]*[1-9][0-9]*$  //匹配負(fù)整數(shù) 
          5。^-?\d+$    //匹配整數(shù) 
          6。^\d+(\.\d+)?$  //匹配非負(fù)浮點數(shù)(正浮點數(shù) + 0) 
          7。^(([0-9]+\.[0-9]*[1-9][0-9]*)|([0-9]*[1-9][0-9]*\.[0-9]+)|([0-9]*[1-9][0-9]*))$  //匹配正浮點數(shù) 
          8。^((-\d+(\.\d+)?)|(0+(\.0+)?))$  //匹配非正浮點數(shù)(負(fù)浮點數(shù) + 0) 
          9。^(-(([0-9]+\.[0-9]*[1-9][0-9]*)|([0-9]*[1-9][0-9]*\.[0-9]+)|([0-9]*[1-9][0-9]*)))$  //匹配負(fù)浮點數(shù) 
          10。^(-?\d+)(\.\d+)?$  //匹配浮點數(shù) 
          11。^[A-Za-z]+$  //匹配由26個英文字母組成的字符串 
          12。^[A-Z]+$  //匹配由26個英文字母的大寫組成的字符串 
          13。^[a-z]+$  //匹配由26個英文字母的小寫組成的字符串 
          14。^[A-Za-z0-9]+$  //匹配由數(shù)字和26個英文字母組成的字符串 
          15。^\w+$  //匹配由數(shù)字、26個英文字母或者下劃線組成的字符串 
          16。^[\w-]+(\.[\w-]+)*@[\w-]+(\.[\w-]+)+$    //匹配email地址 
          17。^[a-zA-z]+://匹配(\w+(-\w+)*)(\.(\w+(-\w+)*))*(\?\S*)?$  //匹配url 
          18。匹配中文字符的正則表達(dá)式: [\u4e00-\u9fa5] 
          19。匹配雙字節(jié)字符(包括漢字在內(nèi)):[^\x00-\xff]
          20。應(yīng)用:計算字符串的長度(一個雙字節(jié)字符長度計2,ASCII字符計1)
          String.prototype.len=function(){return this.replace([^\x00-\xff]/g,"aa").length;} 
          21。匹配空行的正則表達(dá)式:\n[\s| ]*\r 
          22。匹配HTML標(biāo)記的正則表達(dá)式:/<(.*)>.*<\/\1>|<(.*) \/>/ 
          23。匹配首尾空格的正則表達(dá)式:(^\s*)|(\s*$)

          * 正則表達(dá)式用例
            * 1、^\S+[a-z A-Z]$ 不能為空 不能有空格  只能是英文字母
            * 2、\S{6,}         不能為空 六位以上
            * 3、^\d+$          不能有空格 不能非數(shù)字
            * 4、(.*)(\.jpg|\.bmp)$ 只能是jpg和bmp格式
            * 5、^\d{4}\-\d{1,2}-\d{1,2}$ 只能是2004-10-22格式
            * 6、^0$            至少選一項
            * 7、^0{2,}$        至少選兩項
            * 8、^[\s|\S]{20,}$ 不能為空 二十字以上
            * 9、^\+?[a-z0-9](([-+.]|[_]+)?[a-z0-9]+)*@([a-z0-9]+(\.|\-))+[a-z]{2,6}$郵件
            * 10、\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*([,;]\s*\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*)* 輸入多個地址用逗號或空格分隔郵件
            * 11、^(\([0-9]+\))?[0-9]{7,8}$電話號碼7位或8位或前面有區(qū)號例如(022)87341628
            * 12、^[a-z A-Z 0-9 _]+@[a-z A-Z 0-9 _]+(\.[a-z A-Z 0-9 _]+)+(\,[a-z A-Z 0-9 _]+@[a-z A-Z 0-9 _]+(\.[a-z A-Z 0-9 _]+)+)*$
            *     只能是字母、數(shù)字、下劃線;必須有@和.同時格式要規(guī)范 郵件
            * 13 ^\w+@\w+(\.\w+)+(\,\w+@\w+(\.\w+)+)*$上面表達(dá)式也可以寫成這樣子,更精練。
              14   ^\w+((-\w+)|(\.\w+))*\@\w+((\.|-)\w+)*\.\w+$

          posted @ 2006-01-06 15:48 Vikings 閱讀(4799) | 評論 (0)編輯 收藏

          由Spring portlet MVC想到的

          Spring Protlet MVC研究報告

          關(guān)鍵詞:

           Portal Server , portlet JSR-168規(guī)范

           

          1.      關(guān)于Portal Serverportlet 

          Portal的概念是基于Web的,以“應(yīng)用整合”和“消除信息孤島”為最終目的,提供單點登錄、內(nèi)容聚合、個性化門戶定制等功能。

          Portal服務(wù)器是容納Portlet容器,支持Portlet呈現(xiàn)的普通或者特殊Web服務(wù)器。

          Portal服務(wù)器優(yōu)點:提供個性化設(shè)置、單點登錄、內(nèi)容聚合、信息發(fā)布、權(quán)限管理等功能,支持各種信息數(shù)據(jù)來源,并將這些數(shù)據(jù)信息放在網(wǎng)頁中組合而成,提供個性化的內(nèi)容定制,不同權(quán)限的瀏覽者能夠瀏覽不同的信息內(nèi)容等。

           

          Portal概念提出后,許多大公司都推出了各自的Portal Server:

          BEA. WebLogic Portal 8.1 SP4: IBM WebSphere Portal 5.1: SunOne Portal 2005Q1等。而且每一個大公司都有各自的標(biāo)準(zhǔn)。

          PortletSun公司未推出標(biāo)準(zhǔn)前,各家公司的標(biāo)準(zhǔn)都不兼容,于是,類似JavaTM Servlet 2.4 Specification (JSR154)標(biāo)準(zhǔn)。 SUN推出了兩個關(guān)于Portlets標(biāo)準(zhǔn)。

          a)        Java Portlet Specification 1.0 (JSR168), 20031027

          b)      Web Services for Remote Portlets 1.0, 200393

          節(jié)選自: Java Portlet Specification 1.0 (JSR168)

          Portlets are web components -like Servlets- specifically designed to be aggregated in the context of a composite page.

          Usually, many Portlets are invoked to in the single request of a Portal page. Each Portlet produces a fragment of markup that it s combined with the markup of other Portlets, all within the Portal page markup

          其他免費Java portal Server: JBoss Portal 2.0, Apache Jetspeed 2, Apache Pluto 1.0.1

          2.      現(xiàn)有Portal Server比較

          a)      JAVA Protal Server

          a.1 Apache Pluto 1.0.1

          以下是Spring Portlet Support下的pluto-spring-portlet-sample.zip 運行在Pluto后的效果:

           

          b)       MicroSoft Protal Server

          b.1 Sharepoint Protal Server 2003/2005


              總結(jié): MSprotal概念與SUN提出的protal概念需要用意一樣都為了整合Web應(yīng)用,但沒有統(tǒng)





          一的標(biāo)準(zhǔn)。





           
          兩者開發(fā)出來的應(yīng)用不能由各自的
          Protal Server互相運行。

          3.      問題

          a)      需要用Spring protlet MVC 需要一個Protal Server ,需要確定選用哪個Protal Server

          b)      選用Protal Server的原因,是因為要和.net開發(fā)的protlet應(yīng)用集成?還是打算和以后的java開發(fā)的prolet應(yīng)用集成?

          前者未經(jīng)過測試,成功岸例也不多。后者因為有JSR168規(guī)范,所有support此規(guī)范的Protal Server都應(yīng)該支持。

           

          4.      Spring protlet MVC Spring Web MVC

          The Spring Portlet MVC project provides a complete MVC layer for the JSR-168 Portlet API in the same way that Spring Web MVC does for the Servlet API.

          換句話說:

          Spring Web MVC 的項目 Web Server上運行。

          Spring protlet MVC 的項目 Protal Server上運行。

          問題:

          Spring Web MVC寫好的項目,經(jīng)過a few改動(改繼承類和protlet.xml,和Spring-Applicationcontext.xml)就可以發(fā)布在Java Protal server上。

          posted @ 2005-10-28 18:01 Vikings 閱讀(1005) | 評論 (0)編輯 收藏

          僅列出標(biāo)題
          共4頁: 上一頁 1 2 3 4 下一頁 
          主站蜘蛛池模板: 阿荣旗| 佛冈县| 玉环县| 云霄县| 内丘县| 治县。| 皮山县| 宁河县| 东乌| 无锡市| 宜黄县| 视频| 怀来县| 甘肃省| 泸溪县| 鄂托克旗| 恭城| 镇宁| 永宁县| 兴文县| 屏东市| 海安县| 博野县| 安阳县| 聂拉木县| 上杭县| 周口市| 同仁县| 正蓝旗| 东至县| 昭觉县| 尉犁县| 拉孜县| 武安市| 苗栗市| 朝阳区| 鞍山市| 金塔县| 黄大仙区| 永胜县| 澄迈县|