
posted @ 2009-10-15 10:38 saobaolu| 編輯 收藏
|
|||
摘要: 代碼改編自 NetPuter 大大發布的 SDK,這份 SDK 是我用過的最好的 PHP SDK,修改了一些東西:1、增加了收到的訊息類型 voice video2、收到text的時候,如果是 hello2bizuser 的話,調用 onsubscribe 方法(微信4.x 以前貌似都還是發hello2bizuser 所以不得不兼容啊)Code highlighting produced by A... 閱讀全文
posted @ 2013-08-24 16:02 saobaolu| 編輯 收藏
posted @ 2010-07-06 22:43 saobaolu| 編輯 收藏 1 import java.io.*;
最后應該把p給close了哈2 import java.util.Scanner; 3 public class SortTest { 4 public static void main(String[] args) throws IOException { 5 int temp = 0;//臨時變量,用于冒泡交換 6 int[] num=new int[10]; //聲明一個空的數組 10個長度 7 Scanner sc = new Scanner(System.in); 8 FileOutputStream out=new FileOutputStream("1.txt"); 9 PrintStream p=new PrintStream(out); 10 //開始循環賦值 11 for(int i =0;i<num.length;i++){ 12 num[i]=sc.nextInt(); 13 } 14 p.append("排序前為:"); 15 for (int i = 0; i <num.length; i++) { 16 System.out.println(num[i]); 17 p.append(num[i]+" , "); 18 } 19 // 用于排序 20 for (int i = 0; i < num.length-1; i++) { 21 for (int j = 0; j < num.length - i - 1; j++) { 22 if (num[j] > num[j + 1]) { 23 temp = num[j]; 24 num[j] = num[j + 1]; 25 num[j + 1] = temp; 26 } 27 } 28 } 29 //輸出文件 30 p.append("\n"); 31 p.append("排序后為:"); 32 // 循環輸出 33 System.out.println("排序后為:"); 34 for (int i = 0; i <num.length; i++) { 35 System.out.println(num[i]); 36 p.append(num[i]+" , "); 37 } 38 39 40 } 41 } posted @ 2010-06-26 09:02 saobaolu| 編輯 收藏 轉自:http://www.ry168.net/bbs/thread-226-1-1.html 總結了一下,只要在CSS中定義了如下句子,可保網頁不會再被撐開了。 自動換行問題,正常字符的換行是比較合理的,而連續的數字和英文字符常常將容器撐大,挺讓人頭疼,下面介紹的是CSS如何實現換行的方法 對于div,p等塊級元素 正常文字的換行(亞洲文字和非亞洲文字)元素擁有默認的white-space:normal,當定義的寬度之后自動換行 html IE瀏覽器 連續的英文字符和阿拉伯數字,使用word-wrap: break-word ;或者word-break:break-all;實現強制斷行 html css Firefox瀏覽器 html css 對于table元素 Firefox瀏覽器 1. 使用 table-layout:fixed;強制table的寬度,內層td,th采用word-break : break-all;或者word-wrap : break-word ;換行,使用overflow:hidden;隱藏超出內,這里overflow:auto;無法起作用<table style="table-layout:fixed" width="200"><tr> <td width="25%" style="word-break : break-all; overflow:hidden; ">abcdefghigklmnopqrstuvwxyz1234567890</td> <td width="75%" style="word-wrap : break-word; overflow:hidden; ">abcdefghigklmnopqrstuvwxyz1234567890</td> </tr></table> 最佳CSS定義換行代碼.wrap { table-layout:fixed; word-break: break-all; overflow:hidden; } posted @ 2010-06-25 14:06 saobaolu| 編輯 收藏 網址是http://wp.qq.com
發現這個玩意越來越強大了,就忍不住把官方的介紹搬過來: 代碼樣例 ![]() 1)、sigkey為個人鑒權key,請勿修改,否則無法發起臨時會話。 2)、臨時會話圖標<img border="0" SRC='http://wpa.qq.com/pa?p=1:80000805:1' alt="點擊這里給我發消息"> SRC是圖標鏈接,自定義圖標中可以替換這一部分為自己圖片的鏈接, 參數: P=以冒號“:”分隔多個參數 第一個參數為版本號,目前為1; 第二個為QQ/TM號碼; 第三個參數為圖像風格,支持多種狀態。 alt是圖標旁留言。 3)、除了自定義圖標需要修改臨時會話圖標外,其他情況下建議不要修改代碼,因為有可能導致在不同的環境和瀏覽器下,無法發起臨時會話。 自定義在線風格圖片 用JS實現,具體步驟如下: 1) 申請代碼 <a href="http://sighttp.qq.com/cgi-bin/check?sigkey=81a37f0b7cac68639bddfdb9b93a6c92bc211f3e3a4e683afbb31a079382dc9d"; target=_blank; onclick="var tempSrc='http://sighttp.qq.com/wpa.js?rantime='+Math.random()+'&sigkey=81a37f0b7cac68639bddfdb9b93a6c92bc211f3e3a4e683afbb31a079382dc9d';var oldscript=document.getElementById('testJs');var newscript=document.createElement('script');newscript.setAttribute('type','text/javascript'); newscript.setAttribute('id', 'testJs');newscript.setAttribute('src',tempSrc);if(oldscript == null){document.body.appendChild(newscript);}else{oldscript.parentNode.replaceChild(newscript, oldscript);}return false;"><img border="0" SRC='http://wpa.qq.com/pa?p=1:80000805:1' alt="點擊這里給我發消息"></a>
2) 定義online數組,必須是online命名 <script>var online= new Array();</script> 3) 獲取在線狀態 <script src="http://webpresence.qq.com/getonline?Type=1&80000805:"></script> 可以獲取多個,必須以冒號分隔,以冒號結尾,比如: <script src="http://webpresence.qq.com/getonline?Type=1&80000805:10000:123456:"></script> online[0]=0,表示80000805離線 online[1]=1,表示10000在線 online[2]=1,表示123456在線 填寫號碼的先后順序,分別對應數組online的0、1、2 4) 添加代碼 把SRC='http://wpa.qq.com/pa?p=1:80000805:1'替換為自己的圖片,比如: <script> if(online[0]==0) document.write("<a href="http://sighttp.qq.com/cgi-bin/check?sigkey=81a37f0b7cac68639bddfdb9b93a6c92bc211f3e3a4e683afbb31a079382dc9d"; target=_blank; onclick="var tempSrc='http://sighttp.qq.com/wpa.js?rantime='+Math.random()+'&sigkey=81a37f0b7cac68639bddfdb9b93a6c92bc211f3e3a4e683afbb31a079382dc9d';var oldscript=document.getElementById('testJs');var newscript=document.createElement('script');newscript.setAttribute('type','text/javascript'); newscript.setAttribute('id', 'testJs');newscript.setAttribute('src',tempSrc);if(oldscript == null){document.body.appendChild(newscript);}else{oldscript.parentNode.replaceChild(newscript, oldscript);}return false;"><img border="0" SRC='http://xxxx/outline.jpg' alt="點擊這里給我發消息"></a>");
else document.write("<a href="http://sighttp.qq.com/cgi-bin/check?sigkey=81a37f0b7cac68639bddfdb9b93a6c92bc211f3e3a4e683afbb31a079382dc9d"; target=_blank; onclick="var tempSrc='http://sighttp.qq.com/wpa.js?rantime='+Math.random()+'&sigkey=81a37f0b7cac68639bddfdb9b93a6c92bc211f3e3a4e683afbb31a079382dc9d';var oldscript=document.getElementById('testJs');var newscript=document.createElement('script');newscript.setAttribute('type','text/javascript'); newscript.setAttribute('id', 'testJs');newscript.setAttribute('src',tempSrc);if(oldscript == null){document.body.appendChild(newscript);}else{oldscript.parentNode.replaceChild(newscript, oldscript);}return false;"><img border="0" SRC='http://xxxx/online.jpg' alt="點擊這里給我發消息"></a>"); </script> 我是這樣看的,用tx的方法得到某QQ號是否在線,用js判斷,顯示online.jpg或者outline.jpg這兩個圖片,其余不變。 posted @ 2010-06-25 07:28 saobaolu| 編輯 收藏
package myeclipsegen;
點此下載源文件和編譯好的class文件吧import java.io.*; public class MyEclipseGen ![]() private static final String LL = "Decompiling this copyrighted software is a violation of both your license agreement and the Digital Millenium Copyright Act of 1998 (http://www.loc.gov/copyright/legislation/dmca.pdf). Under section 1204 of the DMCA, penalties range up to a $500,000 fine or up to five years imprisonment for a first offense. Think about it; pay for a license, avoid prosecution, and feel better about yourself."; public String getSerial(String userId, String licenseNum) ![]() java.util.Calendar cal = java.util.Calendar.getInstance(); cal.add(1, 3); cal.add(6, -1); java.text.NumberFormat nf = new java.text.DecimalFormat("000"); licenseNum = nf.format(Integer.valueOf(licenseNum)); String verTime = new StringBuilder("-").append(new java.text. SimpleDateFormat("yyMMdd").format(cal.getTime())).append("0"). toString(); String type = "YE3MP-"; String need = new StringBuilder(userId.substring(0, 1)).append(type). append("300").append(licenseNum).append(verTime).toString(); String dx = new StringBuilder(need).append(LL).append(userId).toString(); int suf = this.decode(dx); String code = new StringBuilder(need).append(String.valueOf(suf)). toString(); return this.change(code); } private int decode(String s) ![]() int i; char[] ac; int j; int k; i = 0; ac = s.toCharArray(); j = 0; k = ac.length; while (j < k) ![]() i = (31 * i) + ac[j]; j++; } return Math.abs(i); } private String change(String s) ![]() byte[] abyte0; char[] ac; int i; int k; int j; abyte0 = s.getBytes(); ac = new char[s.length()]; i = 0; k = abyte0.length; while (i < k) ![]() j = abyte0[i]; if ((j >= 48) && (j <= 57)) ![]() j = (((j - 48) + 5) % 10) + 48; } else if ((j >= 65) && (j <= 90)) ![]() j = (((j - 65) + 13) % 26) + 65; } else if ((j >= 97) && (j <= 122)) ![]() j = (((j - 97) + 13) % 26) + 97; } ac[i] = (char) j; i++; } return String.valueOf(ac); } public MyEclipseGen() ![]() super(); } public static void main(String[] args) ![]() try ![]() System.out.println("please input register name:"); BufferedReader reader = new BufferedReader(new InputStreamReader( System.in)); String userId = null; userId = reader.readLine(); MyEclipseGen myeclipsegen = new MyEclipseGen(); String res = myeclipsegen.getSerial(userId, "20"); System.out.println("Serial:" + res); reader.readLine(); } catch (IOException ex) ![]() } } } /Files/chenglu/MyEclipse61Gen.zip 額,還有,MyEclipse6的下載地址是:請使用迅雷下載。。http://downloads.myeclipseide.com/downloads/products/eworkbench/6.0.1GA/MyEclipse_6.0.1GA_E3.3.1_FullStackInstaller.exe posted @ 2010-06-19 22:09 saobaolu| 編輯 收藏 先來看html代碼
<p>
在純struts2中獲取用戶選擇值直接<label>選擇分類</label> <select name="classId"> <option value="1">企業動態</option> <option value="2">最新活動</option> </select> </p> private String classId;
就可以,需要注意的是select一定要帶name,option取到的是valuepublic void setTitle(String title) { this.title = title; } public String getClassId() { return classId; } posted @ 2010-06-17 07:12 saobaolu| 編輯 收藏
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() posted @ 2010-06-16 09:09 saobaolu| 編輯 收藏 1 ![]() ![]() 2 ![]() 3 ![]() 4 ![]() 5 ![]() ![]() 6 ![]() posted @ 2010-03-22 21:24 saobaolu| 編輯 收藏 posted @ 2010-01-26 11:17 saobaolu| 編輯 收藏 r(Read,讀取):對文件而言,具有讀取文件內容的權限;對目錄來說,具有瀏覽目錄的權限。
w(Write,寫入):對文件而言,具有新增、修改文件內容的權限;對目錄來說,具有刪除、移動目錄內文件的權限。 x(eXecute,執行):對文件而言,具有執行文件的權限;對目錄了來說該用戶具有進入目錄的權限。 e.g. -rw-r--r-- 1.去掉第一個- 后面三個三個為一組 rw-/r--/r-- (所有者權限/組用戶權限/其他用戶權限) 2.解析:所有者權限:讀取、寫入、不可執行;本組用戶權限:讀取、不可寫入、不可執行;其他用戶權限:讀取、不可寫入、不可執行。 3.兩種方式去解析成數字表示法: 3.1:r: 對應數值4 w: 對應數值2 x:對應數值1,則:4+2+1=7/4+0+0=4/4+0+0=4:744權限 3.2:將其轉換成二進制數,有值就是1,沒值就是0,則:110/100/100,轉換成十進制:110=7/100=4/110=4:744權限 posted @ 2010-01-08 04:36 saobaolu| 編輯 收藏 摘要:
《Linux(第1—4章)總結》
1. linux操作系統的特點:開放性,多用戶,多任務,良好的用戶界面,設備獨立性,出色的速度性能,豐富的網絡功能,可靠的安全性,可移植性強,安全符合POSIX標準,UNIX的完整實現,開發功能強。
2. &nbs... 閱讀全文
posted @ 2010-01-08 02:45 saobaolu| 編輯 收藏 Spring的applicationContext.xml文件 想必用過Spring的程序員們都有這樣的感覺,Spring把邏輯層封裝的太完美了(個人感覺View層封裝的不是很好)。以至于有的初學者
都不知道Spring配置文件的意思,就拿來用了。所以今天我給大家詳細解釋一下Spring的applicationContext.xml文件。
Ok,我還是通過代碼加注釋的方式為大家演示:
posted @ 2010-01-02 23:42 saobaolu| 編輯 收藏 Linux下Squid代理服務器的配置(轉) posted @ 2009-12-18 08:24 saobaolu| 編輯 收藏 |
|||