躺在沙灘上的小豬

          快樂的每一天

          #

          酸酸甜甜就是我





          曲名:酸酸甜甜就是我     歌手:張含韻 

          耳朵里塞著小喇叭
          躲在被窩里看漫畫
          雖然我還在象牙塔
          我多么想一夜長大
          親愛的爸爸媽媽
          別叫我小傻瓜
          雖然我很聽話
          不代表我沒有想法

          喜歡酸的甜這就是真的我
          每一天對于我都非常新鮮
          我挑剔的味覺
          有最獨特的區別
          我喜歡酸的甜這就是真的我
          青春期的我有一點點自戀
          大人們的世界
          等待著我去冒險

          耳朵里塞著小喇叭
          躲在被窩里看漫畫
          雖然我還在象牙塔
          我多么想一夜長大
          親愛的爸爸媽媽
          別叫我小傻瓜
          雖然我很聽話
          不代表我沒有想法

          喜歡酸的甜這就是真的我
          每一天對于我都非常新鮮
          我挑剔的味覺
          有最獨特的區別
          我喜歡酸的甜這就是真的我
          青春期的我有一點點自戀
          大人們的世界
          等待著我去冒險

          哈~~~~~快長大
          快快長大
          對這個世界say hi
          我要我自我最像我的自我
          人群之中我有最最的獨特
          唱我自己的歌
          要唱出我的性格
          我要我自我
          最愛我的自我
          笑過哭過我會全部都記得
          夢想總會有沙漠
          夢想就是種快樂

          posted @ 2005-10-20 18:49 martin xus| 編輯 收藏

          統計合計和明細。

          今天遇到一個需求:

          假如我有這幾個數字:
          用戶:       user
          消費:       fee

          現在數據庫里面可能一個用戶有多條數據。
          例如:

          id  user     fee
          1  張三    100
          1  張三    50
          1  張三    20

          2  李四    30
          2  李四    20

          3  小王    1000

          現在我需要這樣的結果:

          不僅要統計出明細而且要總和,并且按 fee,id排序

          小王    1000

          張三  170
          張三    100
          張三    50
          張三    20

          李四    50
          李四    30
          李四    20


          用union all,在計算出來的結果上再order by就達到了最初的效果了。

          select *
            
          from (select t.id, '' name, sum(t.fee) fee, '' fff, '' ff, sum(t.fee) fee2
                    
          from
           tt_test t
                   
          group by
           t.id
                  
          union all

                  
                   (
          select a.*, b.fee2
                     
          from
           tt_test a,
                          (
          select sum(t.fee) fee2, t.id from tt_test t group by
           t.id) b
                    
          where a.id =
           b.id)) s

           
          order by s.fee2 desc, s.id

          感覺有點麻煩,不知道有好的方法沒

          posted @ 2005-10-20 16:40 martin xus| 編輯 收藏

          Get started with Geronimo

          http://www-128.ibm.com/developerworks/opensource/library/os-ag-starthere/

          posted @ 2005-10-13 10:48 martin xus| 編輯 收藏

          Commons IO 1.1 released

          Commons IO:
          http://jakarta.apache.org/commons/io/

          Download:
          http://jakarta.apache.org/site/downloads/downloads_commons-io.cgi

          ---------------------------------------------------------------------

          Commons IO 1.1 release notes


          Commons IO is a package of Java utility classes for java.io's hierarchy.
          Classes in this package are considered to be so standard and of such high
          reuse as to justify existence in java.io.

          Commons IO contains utility classes, stream implementations, file filters,
          and endian transformation classes.


          Incompatible changes from 1.0
          -----------------------------
          Binary compatible - Yes

          Source compatible - Yes

          Semantic compatible - Yes, except:
          - FileUtils.writeStringToFile()
          A null encoding previously used 'ISO-8859-1', now it uses the platform default
          Generally this will make no difference

          - LockableFileWriter
          Improved validation and now create directories if necesssary

          plus these bug fixes may affect you semantically:
          - FileUtils.touch() (Bug fix 29821)
          Now creates the file if it did not previously exist

          - FileUtils.toFile(URL) (Bug fix 32575)
          Now handles escape syntax such as %20

          - FileUtils.sizeOfDirectory() (Bug fix 36801)
          May now return a size of 0 if the directory is security restricted


          Deprecations from 1.0
          ---------------------
          - CopyUtils has been deprecated.
          Its methods have been moved to IOUtils.
          The new IOUtils methods handle nulls better, and have clearer names.

          - IOUtils.toByteArray(String) - Use {@link String#getBytes()}
          - IOUtils.toString(byte[]) - Use {@link String#String(byte[])}
          - IOUtils.toString(byte[],String) - Use {@link String#String(byte[],String)}


          Bug fixes from 1.0
          ------------------
          - FileUtils - touch() [29821]
          Now creates the file if it did not previously exist

          - FileUtils - toFile(URL) [32575]
          Now handles escape syntax such as %20

          - FileFilterUtils - makeCVSAware(IOFileFilter) [33023]
          Fixed bug that caused method to be completely broken

          - CountingInputStream [33336]
          Fixed bug that caused the count to reduce by one at the end of the stream

          - CountingInputStream - skip(long) [34311]
          Bytes from calls to this method were not previously counted

          - NullOutputStream [33481]
          Remove unecessary synchronization

          - AbstractFileFilter - accept(File, String) [30992]
          Fixed broken implementation

          - FileUtils [36801]
          Previously threw NPE when listing files in a security restricted directory
          Now throw IOException with a better message

          - FileUtils - writeStringToFile()
          Null encoding now correctly uses the platform default


          Enhancements from 1.0
          ---------------------
          - FilenameUtils - new class [33303,29351]
          A static utility class for working with filenames
          Seeks to ease the pain of developing on Windows and deploying on Unix

          - FileSystemUtils - new class [32982,36325]
          A static utility class for working with file systems
          Provides one method at present, to get the free space on the filing system

          - IOUtils - new public constants
          Constants for directory and line separators on Windows and Unix

          - IOUtils - toByteArray(Reader,encoding)
          Handles encodings when reading to a byte array

          - IOUtils - toCharArray(InputStream) [28979]
          - toCharArray(InputStream,encoding)
          - toCharArray(Reader)
          Reads a stream/reader into a charatcter array

          - IOUtils - readLines(InputStream) [36214]
          - readLines(InputStream,encoding)
          - readLines(Reader)
          Reads a stream/reader line by line into a List of Strings

          - IOUtils - toInputStream(String) [32958]
          - toInputStream(String,encoding)
          Creates an input stream that uses the string as a source of data

          - IOUtils - writeLines(Collection,lineEnding,OutputStream) [36214]
          - writeLines(Collection,lineEnding,OutputStream,encoding)
          - writeLines(Collection,lineEnding,Writer)
          Writes a collection to a stream/writer line by line

          - IOUtils - write(...)
          Write data to a stream/writer (moved from CopyUtils with better null handling)

          - IOUtils - copy(...)
          Copy data between streams (moved from CopyUtils with better null handling)

          - IOUtils - contentEquals(Reader,Reader)
          Method to compare the contents of two readers

          - FileUtils - toFiles(URL[])
          Converts an array of URLs to an array of Files

          - FileUtils - copyDirectory() [32944]
          New methods to copy a directory

          - FileUtils - readFileToByteArray(File)
          Reads an entire file into a byte array

          - FileUtils - writeByteArrayToFile(File,byte[])
          Writes a byte array to a file

          - FileUtils - readLines(File,encoding) [36214]
          Reads a file line by line into a List of Strings

          - FileUtils - writeLines(File,encoding,List)
          writeLines(File,encoding,List,lineEnding)
          Writes a collection to a file line by line

          - FileUtils - EMPTY_FILE_ARRAY
          Constant for an empty array of File objects

          - ConditionalFileFilter - new interface [30705]
          Defines the behaviour of list based filters

          - AndFileFilter, OrFileFilter [30705]
          Now support a list of filters to and/or

          - WildcardFilter [31115]
          New filter that can match using wildcard file names

          - FileFilterUtils - makeSVNAware(IOFileFilter)
          New method, like makeCVSAware, that ignores Subversion source control directories

          - ClassLoaderObjectInputStream
          An ObjectInputStream that supports a ClassLoader

          - CountingInputStream,CountingOutputStream - resetCount() [28976]
          Adds the ability to reset the count part way through reading/writing the stream

          - DeferredFileOutputStream - writeTo(OutputStream) [34173]
          New method to allow current contents to be written to a stream

          - DeferredFileOutputStream [34142]
          Performance optimizations avoiding double buffering

          - LockableFileWriter - encoding support [36825]
          Add support for character encodings to LockableFileWriter
          Improve the validation
          Create directories if necesssary

          - IOUtils and EndianUtils are no longer final [28978]
          Allows developers to have subclasses if desired
          ---------------------------------------------------------------------
          best practices
          user guide

          posted @ 2005-10-12 08:45 martin xus| 編輯 收藏

          [Z]常用的匹配正則表達式和實例

          來自:藍色理想

          匹配中文字符的正則表達式:

          [\u4e00-\u9fa5]

          匹配雙字節字符(包括漢字在內):

          [^\x00-\xff]

          應用:計算字符串的長度(一個雙字節字符長度計2,ASCII字符計1)

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

          匹配空行的正則表達式:

          \n[\s| ]*\r

          匹配HTML標記的正則表達式:

          /<(.*)>.*<\/\1>|<(.*) \/>/ 


          匹配首尾空格的正則表達式:

          (^\s*)|(\s*$)


          應用:javascript中沒有像vbscript那樣的trim函數,我們就可以利用這個表達式來實現,如下:

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


          利用正則表達式分解和轉換IP地址:

          下面是利用正則表達式匹配IP地址,并將IP地址轉換成對應數值的Javascript程序:

          function IP2V(ip){
               re
          =/(\d+)\.(\d+)\.(\d+)\.(\d+)///匹配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))


          匹配Email地址的正則表達式:

          \w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*


          匹配網址URL的正則表達式:

          http://([\w-]+\.)+[\w-]+(/[\w- ./?%&=]*)?


          利用正則表達式去除字串中重復的字符的算法程序:[注:此程序不正確,原因見本貼回復]

          var s="abacabefgeeii"
          var s1=s.replace(/(.).*\1/g,"$1")
          var re=new RegExp("["+s1+"]","g")
          var s2=s.replace(re,""
          alert(s1
          +s2) //結果為:abcefgi


          我原來在CSDN上發貼尋求一個表達式來實現去除重復字符的方法,最終沒有找到,這是我能想到的最簡單的實現方法。思路是使用后向引用取出包括重復的字符,再以重復的字符建立第二個表達式,取到不重復的字符,兩者串連。這個方法對于字符順序有要求的字符串可能不適用。

          得用正則表達式從URL地址中提取文件名的javascript程序,如下結果為page1

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

          利用正則表達式限制網頁表單里的文本框輸入內容:

          用正則表達式限制只能輸入中文:

          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,''))"  

          posted @ 2005-10-11 19:31 martin xus| 編輯 收藏

          僅列出標題
          共28頁: First 上一頁 17 18 19 20 21 22 23 24 25 下一頁 Last 
          主站蜘蛛池模板: 高邮市| 灵武市| 肇州县| 临桂县| 丰顺县| 平安县| 伊金霍洛旗| 南开区| 寿阳县| 班戈县| 连平县| 樟树市| 韶关市| 凤城市| 台北县| 宜阳县| 勃利县| 武定县| 嘉祥县| 芒康县| 金坛市| 汤阴县| 错那县| 博客| 唐河县| 海南省| 龙岩市| 来凤县| 双柏县| 巴青县| 杂多县| 南投县| 承德县| 穆棱市| 乾安县| 原平市| 清河县| 新河县| 巴塘县| 海阳市| 通化市|