commons-net-1.0.0.jar download from
http://www.ibiblio.org/pub/packages/maven2/commons-net/commons-net/1.0.0/
API
http://jakarta.apache.org/commons/net/api/org/apache/commons/net/ftp/FTPClient.html
Monday, November 06, 2006
Saturday, June 17, 2006
[java] Read properties
Enumeration e =System.getProperties().propertyNames();
Object obj;
while( e.hasMoreElements()){
obj = e.nextElement();
System.out.println(obj + " = " + System.getProperty(obj.toString()));
}
Monday, May 22, 2006
javascript simulated query string
function getRequest(requestName)
{
var url=location.search.toLowerCase();
var Request = new Object();
if(url.indexOf("?")!=-1){
var str=url.substr(1);
strs = str.split("&");
for(var i=0;i<strs.length;i++){
Request[strs[i].split("=")[0]]=unescape(strs[i].split("=")[1]);
}
}
return(Request[requestName]);
}
標籤:
javascript
javascript return value to opener
if (window.opener && !window.opener.closed)
window.opener.document.Form1.fileName.value ="aaa";
標籤:
javascript
Tuesday, May 16, 2006
Export file from web page (JSP)
<%@page contentType="text/html;charset=MS950"%>
<%@page pageEncoding="MS950"%>
<%
String m_filename = "hello.txt ";
String m_content = "Hello\nWorld";
response.addHeader("Content-Disposition", "attachment; filename=" + m_filename);
response.setContentType("text/plain");
response.getWriter().write(m_content);
%>
Monday, May 15, 2006
prevent right click(Javascript)
var message="Function Disabled!";
function clickIE4(){
if (event.button==2){
//alert(message);
return false;
}
}
function clickNS4(e){
if (document.layersdocument.getElementById&&!document.all){
if (e.which==2e.which==3){
//alert(message); return false; } } }
if (document.layers){
document.captureEvents(Event.MOUSEDOWN);
document.onmousedown=clickNS4; }
else if (document.all&&!document.getElementById){
document.onmousedown=clickIE4;
}
document.oncontextmenu=new Function("return false")
標籤:
javascript,
web
Friday, May 12, 2006
Thursday, May 11, 2006
How to add audio file in HTML img tag?
Add audio file in your img tag, such that your picture can sing.
It is funny.
It is funny.
Wednesday, March 01, 2006
Add some javascript in web control
How to check something before clicking web control button?
In client side:(javascript)
In Server side:
button1 is a ID of web control button.
In client side:(javascript)
function Check_function(){
if(checkIsOk)
return true;
else
return false;
}
In Server side:
button1 is a ID of web control button.
button1Attributes.Add("onclick","if(Check_function()==false) return false;");
標籤:
asp.net,
asp.net1.1,
javascript
Monday, February 27, 2006
Java : Convert from type X to type Y
[refer from http://www.rgagnon.com/javadetails/java-0004.html]
integer to String :
double to String :
long to String :
float to String :
String to integer :
String to double :
String to long :
String to float :
decimal to binary :
decimal to hexadecimal :
hexadecimal (String) to integer :
ASCII code to String
integer to ASCII code (byte)
To extract Ascii codes from a String
integer to boolean
boolean to integer
note :To catch illegal number conversion, try using the try/catch mechanism.
Convert from type X to type Y
integer to String :
int i = 42; String str = Integer.toString(i);or String str = "" + i |
String str = Double.toString(i); |
String str = Long.toString(l); |
String str = Float.toString(f); |
String to integer :
str = "25"; int i = Integer.valueOf(str).intValue();or int i = Integer.parseInt(str); |
double d = Double.valueOf(str).doubleValue(); |
long l = Long.valueOf(str).longValue();or long l = Long.parseLong(str); |
float f = Float.valueOf(str).floatValue(); |
decimal to binary :
int i = 42; String binstr = Integer.toBinaryString(i); |
decimal to hexadecimal :
int i = 42; String hexstr = Integer.toString(i, 16);or String hexstr = Integer.toHexString(i);or (with leading zeroes and uppercase) public class Hex {
public static void main(String args[]){
int i = 42;
System.out.print
(Integer.toHexString( 0x10000 | i).substring(1).toUpperCase());
}
}
|
hexadecimal (String) to integer :
int i = Integer.valueOf("B8DA3", 16).intValue();
orint i = Integer.parseInt("B8DA3", 16); |
ASCII code to String
int i = 64; String aChar = new Character((char)i).toString(); |
integer to ASCII code (byte)
char c = 'A'; int i = (int) c; // i will have the value 65 decimal |
To extract Ascii codes from a String
String test = "ABCD";
for ( int i = 0; i < test.length(); ++i ) {
char c = test.charAt( i );
int j = (int) c;
System.out.println(j);
} |
b = (i != 0); |
i = (b)?1:0; |
note :To catch illegal number conversion, try using the try/catch mechanism.
try{
i = Integer.parseInt(aString);
}
catch(NumberFormatException e)
{
}
|
Saturday, February 25, 2006
How to clean the IE browser cache?
<script language="javascript">
document.execCommand("ClearAuthenticationCache","false");
</script>
標籤:
javascript
Subscribe to:
Posts (Atom)
