隨筆 - 25, 文章 - 1, 評論 - 0, 引用 - 0
          數(shù)據(jù)加載中……

          [20100524]-[素材]-[顏色]-[一組簡單顏色]-[FusionChart使用]

              private static String[] COLOR = "'AFD8F8'""'F6BD0F'""'8BBA00'",
                      
          "'FF8E46'""'008E8E'""'D64646'""'8E468E'""'588526'",
                      
          "'B3AA00'""'008ED6'""'9D080D'""'A186BE'" }
          ;

          posted @ 2010-05-24 01:31 至尊貝貝 閱讀(183) | 評論 (0)編輯 收藏

          [Flex4]-[20100524]-[文件上傳]

          需要用到的Flex原生態(tài)對象

          1.FileReferenceList

          2.FileReference

          3.URLRequest

          4.URLVariables


          封裝對象:
          CURL

          參考代碼:


          private var files:FileReferenceList=new FileReferenceList;
          files.addEventListener(Event.SELECT, onSelectFiles);
          files.browse([
          new FileFilter("圖片""*.jpg;*.gif;*.png""bmp")]);

          protected function onSelectFiles(event:Event):void
          {

              
          for each (var f:FileReference in files.fileList)
              
          {

                  var fileItem:Object
          =new Object;
                  fileItem.file
          =f;
                  fileItem.name
          ="NoName";
                  fileItem.typeid
          =11;
                  fileItem.filename
          =f.name;
                  selectFiles.addItem(fileItem);
              }


          }

          protected function uploadI_clickHandler(event:MouseEvent):void
          {
                  
          if (selectFiles.length > 0)
                  
          {

                      var item:Object
          =selectFiles.removeItemAt(0);

                      var curl:CURL
          =new CURL;
                      curl.url
          ="UploadImageServlet";
                      curl.setData(
          "name", item.name);
                      curl.setData(
          "type", item.typeid);
                      curl.setData(
          "imagedesc", item.imagedesc);
                      var file:FileReference
          =item.file as FileReference;
                      
          if (file != null)
                      
          {
                          file.addEventListener(Event.COMPLETE, onFileUploadComplete);
                          file.upload(curl.urlRequest);
                      }


                  }

                  
          }

              
          protected function onFileUploadComplete(event:Event):void
          {
              var f:FileReference
          =event.currentTarget as FileReference;
              f.removeEventListener(Event.COMPLETE, onFileUploadComplete);
              uploadI_clickHandler(
          null);
          }

          posted @ 2010-05-24 01:28 至尊貝貝 閱讀(606) | 評論 (0)編輯 收藏

          [Flex]-[20100524]-[Stream]-[從服務(wù)端讀取圖片]

          Flex 如何從服務(wù)端讀取流信息
          參考解決一,從服務(wù)端讀取Bitmap數(shù)據(jù)

          使用的原生態(tài)對象
          1 URLStream
          2 URLRequest
          3 URLVariables  

          封裝對象:
          CURL

          源碼如下:

          package incisive.framework.c.factory
          {
           import flash.net.URLRequest;
           import flash.net.URLVariables;

           
          public class CURL
           
          {

            
          public static const urlbase:String="http://localhost:8080/bss/";
            
          private var _urlRequest:URLRequest=new URLRequest;
            
          private var _url:String;
            
          private var vars:URLVariables=new URLVariables;

            
          public function CURL(u:String=null)
            
          {
             
          if (u != null)
             
          {
              _urlRequest
          =new URLRequest(urlbase + u);
             }

            }


           

            
          public function get urlRequest():URLRequest
            
          {
             
          if (_urlRequest != null)
              _urlRequest.data
          =vars;
             
          return _urlRequest;
            }


            
          public function get url():String
            
          {
             
          return _url;
            }


            
          public function set url(value:String):void
            
          {
             _url
          =value;
             _urlRequest
          =new URLRequest(urlbase + value);
            }


            
          public function setData(key:String, value:String, encode:Boolean=false):void
            
          {
             
          if (encode)
             
          {
              vars[key]
          =encodeURI(value);
             }

             
          else
              vars[key]
          =value;

            }

           }

          }


           


          Stream 如何如下:

           curl:CURL = new CURL;
           curl.url 
          = u;
           var imageStream:URLStream
          =new URLStream;
           imageStream.load(curl.urlRequest);


          posted @ 2010-05-24 01:21 至尊貝貝 閱讀(490) | 評論 (0)編輯 收藏

          Ajax從服務(wù)端讀取圖片數(shù)據(jù)

          服務(wù)端代碼:
          @Action(value = "/imageload")
              
          public String imageLoad ()throws Exception {
                  
                  File f 
          = new File ("d:/down.jpg");
                  FileInputStream in 
          = new FileInputStream (f);
                  
          byte[] b = new byte[in.available()];
                  in.read(b);
                  HttpServletResponse response 
          = ServletActionContext.getResponse();
          //        response.setCharacterEncoding("UTF-8");
                  response.setContentType("image");
                  OutputStream pwt 
          = response.getOutputStream();
                  pwt.write(b);
                  pwt.flush();
                  pwt.close();
                  
          return null;
              }
          客戶端代碼:
          <%@ page language="java" contentType="text/html; charset=utf-8"
              pageEncoding
          ="utf-8"%>
          <!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>
          <script type="text/javascript" src="js/jquery-1.4.2.min.js"></script>
          </head>
          <body>
          <img id="img1" src=""></img>
          <script type="text/javascript">
              
          function load() {
                  $('#img1').attr('src', 'subject
          /imageload.action');
              }
          </script>

          <button onclick=load();>點(diǎn)擊獲取</button>
          </body>
          </html>


          posted @ 2010-05-19 17:20 至尊貝貝 閱讀(1241) | 評論 (0)編輯 收藏

          無語

          問題又始于IE與Firefox 試問你用一個(gè)最新版的Firefox去與遠(yuǎn)古級的IE6做比較有意義么, 可是偏偏有許多人喜歡這么去比較,借此來宣傳Firefox. 馬克思說了很多費(fèi)話,但還是有一句說的蠻對的,我們要辯證地看待事物. 劉翔他跑了世界冠軍破了世界紀(jì)錄也與我無關(guān), 臨場退賽也與我無關(guān),他跑了第一也不代表黃種人就怎么怎么樣了 我一直用IE 我也用Firefox 我也用Chrome 我也用Safari 我也不用殺毒軟件,我也不中木馬病毒. 我就知道,倒賣大蒜,白癡都能掙錢,我也知道,程序員同樣龍魚混雜.我們很少聽到龍嘯,看到的都是魚在冒泡. 每天都是IE與Firefox ,Windows與Linux, C與Java

          posted @ 2010-05-18 10:10 至尊貝貝 閱讀(120) | 評論 (0)編輯 收藏

          [20100514]-[FLEX4]-[在SWF中嵌入字體]

          起因是 Flex4中使用的仍然是MX的DataGrid 但是因?yàn)樽煮w原因 ,使得DataGrid在某些效果上(如Fade|Rotate)可能無效甚至失去響應(yīng),解決的辦法是把字體嵌入到SWF中去.參考代碼:
          <fx:Style>
                  @namespace s "library://ns.adobe.com/flex/spark";
                  @namespace mx "library://ns.adobe.com/flex/mx";
                  @namespace bi "com.neusoft.bi.*";
                  @namespace widgets "com.neusoft.biframework.widgets.*";
                  @font-face {
                      src:url("assets/fonts/jsong.ttf"); 
                      fontFamily: "jsong";
                      embedAsCFF: false;
                  }
              
          </fx:Style>


          <mx:DataGrid x="0"
                               y
          ="0"
                               id
          ="grid1"
                               dataProvider
          ="{data}"
                               width
          ="100%"
                               height
          ="100%">
                      
          <mx:columns>
                          
          <mx:DataGridColumn headerText="列1"
                                             fontFamily
          ="jsong"
                                             dataField
          ="col1"/>
                          
          <mx:DataGridColumn headerText="列2"
                                             fontFamily
          ="jsong"
                                             dataField
          ="col2"/>
                          
          <mx:DataGridColumn headerText="列3"
                                             fontFamily
          ="jsong"
                                             dataField
          ="col3"/>
                      
          </mx:columns>
                  
          </mx:DataGrid>

          posted @ 2010-05-14 16:33 至尊貝貝 閱讀(727) | 評論 (0)編輯 收藏

          [20100427]-[源碼]-[Java]-[讀取文件并輸出]

          import java.io.BufferedReader;
          import java.io.BufferedWriter;
          import java.io.File;
          import java.io.FileInputStream;
          import java.io.FileOutputStream;
          import java.io.InputStreamReader;
          import java.io.OutputStreamWriter;

          public class Main {

              
          /**
               * 
          @param args
               
          */

              
          public static void main(String[] args) {
                  
          // TODO Auto-generated method stub
                  Main
                          .ListFilesInDirectory(
          "E://WorkShop/source");
              }


              
          static void ListFilesInDirectory(String path) {
                  File file 
          = new File(path);
                  File[] files 
          = file.listFiles();
                  
          for (File fl : files) {
                      
          if (fl.isDirectory())
                          ListFilesInDirectory(fl.toString());
                      
          else {
                          
          if (fl.getName().endsWith("java")) {
                              System.out.println(fl.getName());

                              
          try {
                                  Main.ReadFile(fl);
                              }
           catch (Exception e) {
                                  
          // TODO Auto-generated catch block
                                  e.printStackTrace();
                              }

                          }

                      }

                  }


              }


              
          public static void ReadFile(File f) throws Exception {
                  BufferedReader br 
          = new BufferedReader(new InputStreamReader(
                          
          new FileInputStream(f)));
                  BufferedWriter bw 
          = new BufferedWriter(new OutputStreamWriter(
                          
          new FileOutputStream(new File("d://output1.txt"), true)));
                  String tmp 
          = new String();
                  
          while ((tmp = br.readLine()) != null{
                      
          if (tmp.matches("\\s+"|| tmp.length() == 0)
                          
          continue;
                      
          if (tmp.matches("^\\s*(/\\*).*"|| tmp.matches("^\\s*\\*.*")||tmp.matches("^\\s*//.*")
                              
          || tmp.matches("^\\s+\\*/.*")){
                          
          continue;
                      }

                      bw.write(tmp);
                      bw.newLine();
                  }

                  br.close();
                  bw.close();
              }

          }

          posted @ 2010-05-06 23:08 至尊貝貝 閱讀(161) | 評論 (0)編輯 收藏

          Flex報(bào)錯(cuò) : CreateProcess error=2

          新安裝了一個(gè)FlexBuilder3
          可是在運(yùn)行 Application的時(shí)候 報(bào)出
          CreateProcess: "%ProgramFiles%\Internet Explorer\iexplore.exe" G:\java\Flex\........html error=2

          Error=2好像是Windows系統(tǒng)返回的錯(cuò)誤

          且不去管他. ~

          打開Eclipse的--Preferences---General---Web Browser---將Default system Web browser 修改成Internet Explorer或Firefox

          問題得以解決 `~


          至此問題原因 也很明了

          因?yàn)槲业南到y(tǒng)已經(jīng)使用了很多年了~ Windows默認(rèn)的是IE6吧~ 已經(jīng)早就升級成了IE8 但是參數(shù)Default Web Browser應(yīng)該還是指向IE6 , 所以出了問題~~
          與Eclipse無關(guān)~~

          posted @ 2010-03-14 11:36 至尊貝貝 閱讀(1739) | 評論 (0)編輯 收藏

          Google Chrome 離線下載安裝包地址


          下載地址:dl.google.com/chrome/install/472.53/chrome_installer.exe

          472.53為Chrome版本號

          posted @ 2010-01-28 00:56 至尊貝貝 閱讀(376) | 評論 (0)編輯 收藏

          Mysql 中文亂碼問題

          set names 'utf8' ;
          alter database databaseName character set utf8; 
          create database mydb character set utf8; 
          set character_set_client=utf8;  
          set character_set_connection=utf8; 
          set character_set_database=utf8; 
          set character_set_results=utf8; 
          set character_set_server=utf8; 

          set collation_connection=utf8_unicode_ci; 
          set collation_database=utf8_unicode_ci; 
          set collation_server=utf8_unicode_ci;

          posted @ 2010-01-25 00:17 至尊貝貝 閱讀(117) | 評論 (0)編輯 收藏

          僅列出標(biāo)題
          共3頁: 上一頁 1 2 3 下一頁 
          主站蜘蛛池模板: 黑水县| 闽清县| 商城县| 黑山县| 保定市| 黄大仙区| 陵川县| 新源县| 渑池县| 延川县| 万源市| 清水河县| 大城县| 星子县| 永新县| 龙川县| 洛浦县| 香港| 长沙县| 遂溪县| 拉萨市| 巴青县| 临颍县| 扎赉特旗| 渭源县| 赫章县| 赤壁市| 宜昌市| 额济纳旗| 满洲里市| 当雄县| 齐齐哈尔市| 介休市| 昌宁县| 衡山县| 双桥区| 天镇县| 奉新县| 嵩明县| 水富县| 榕江县|