Archives

You are currently viewing archive for October 2006
Category: Web dev
Posted by: hajime osako
Category: Web dev
Posted by: hajime osako
Category: Web dev
Posted by: hajime osako
ITmedia エンタープライズ:Java Tips:Iterator、Enumerationなどループあれこれ
ちなみにrequestオブジェクトを覘くには、
	Map test = request.getParameterMap();
	java.util.Set stKey = test.keySet();
	java.util.Iterator ite = stKey.iterator();
	while (ite.hasNext())
	{
	    Object o = ite.next();
	    String key = (String)o;
	    String[] val = (String[])test.get(key); //Ljava.lang.Stringのため
	    System.out.println(key+":"+val[0]);
	}

Category: Web dev
Posted by: hajime osako
[ThinkIT] 第2回:サーバ用のスクリプトの例 (2/3)
function testAjax(callback_function, param1, param2) 
{
	var callback={php_function:callback_function};

	var obj = new php_class(callback);
	obj.timeout = 30000; //timeout msec

	window.status="Receiving data...";
	obj.php_function(param1, param2);
	window.status="Complete";
}
Category: Web dev
Posted by: hajime osako
<div id="menu" style="position:absolute;top:0px;left:710px;z-index:2;">
Floating menu list.....
</div>

<script>
function Menu(){
	if(document.all){
		document.all("menu").style.pixelTop=document.body.scrollTop;
	}else{
		document.getElementById("menu").style.top=pageYOffset+"px";
	}
}

onscroll = Menu;
</script>
追記:
scrollTopは正常に動かない場合あり。
ブラウザのスクロール量を取得するには?
ブラウザの表示領域のサイズを取得する方法。
画面の横幅は、bodyの要素を取得するやり方だと、bodyの幅であって、ウィンドウの表示幅ではない。
Category: Web dev
Posted by: hajime osako
JS(JavaScript)で取得できるクライアント情報、そこからアクセス解析の仕組みを考えてみる
function functest()
{
  var strwork;
  var jsDate;

  jsDate = new Date();

  strwork = "JSDATE  :  " + jsDate.getFullYear() + "/" + jsDate.getMonth()+1 + "/" + jsDate.getDate() + " " + jsDate.getHours() + ":" + jsDate.getMinutes() + ":" + jsDate.getSeconds() + "\n";
  strwork = strwork + "HOST     :  " + location.host + "\n";
  strwork = strwork + "HOSTNAME :  " + location.hostname + "\n";
  strwork = strwork + "PORT     :  " + location.port + "\n";
  strwork = strwork + "PROTOCOL :  " + location.protocol + "\n";
  strwork = strwork + "HASH     :  " + location.hash + "\n";
  strwork = strwork + "SEARCH   :  " + location.search + "\n";
  strwork = strwork + "REQUEST  :  " + location.pathname + "\n";
  strwork = strwork + "CODE     :  " + navigator.appCodeName + "\n";
  strwork = strwork + "BROWSER  :  " + navigator.appName + "\n";
  strwork = strwork + "VERSION  :  " + navigator.appVersion + "\n";
  strwork = strwork + "LANG     :  " + navigator.language + "\n";
  strwork = strwork + "PLATFORM :  " + navigator.platform + "\n";
  strwork = strwork + "USERAGENT:  " + navigator.userAgent + "\n";
  strwork = strwork + "REFERER  :  " + document.referrer + "\n";
  strwork = strwork + "DOMAIN   :  " + document.domain + "\n";
  strwork = strwork + "SCREEN.W :  " + screen.width + "\n";
  strwork = strwork + "SCREEN.H :  " + screen.height + "\n";
  if (screen.colorDepth==8) {
    strwork = strwork + "SCREEN.COL:  " + screen.colorDepth + "Bit\n";
  } else {
    strwork = strwork + "SCREEN.COL:  " + screen.colorDepth + "Bit\n";
  }
  
  alert(strwork);

}

Category: Web dev
Posted by: hajime osako
RADKRAFT: サーブレット/JSPのヘッダ情報の取得方法
<%@ page language="java" contentType="text/html;charset=Shift_JIS" %>
<html><body>
クライアントのホスト名(REMOTE_HOST)=<%= request.getRemoteHost() %><br>
クライアントのIPアドレス(REMOTE_ADDR)=<%= request.getRemoteAddr() %><br>
要求されたURL(1)=<%= request.getRequestURI() %><br>

要求されたURL(2)=<%= request.getRequestURL().toString() %><br>
サーブレットパス=<%= request.getServletPath() %><br>
サーバ上のパス=<%= getServletContext().getRealPath(request.getServletPath()) %><br>
要求されたURLのパス(PATH_INFO)=<%= request.getPathInfo() %><br>
要求されたURLのサーバ上のパス(PATH_TRANSLATED)=<%= request.getPathTranslated() %><br>

要求のメソッド=<%= request.getMethod() %><br>
参照元のURL=<%= request.getHeader("Referer") %><br>
プロトコル(HTTP)=<%= request.getProtocol() %><br>

ポート番号=<%= String.valueOf(request.getServerPort()) %><br>
<br>
ファイルconfig.xmlのパス=<%= getServletContext().getRealPath("/config.xml") %><br>
ファイルconfig.xmlのURL=<%= request.getContextPath() + "/config.xml" %><br>
</body></html>

Category: Web dev
Posted by: hajime osako
Sooey - PHP5 で利用できる新しい関数

array_combine()
scandir()
file_put_contents()
stripos()
Category: Web dev
Posted by: hajime osako
RADKRAFT: Java Reflection API
	public String myReflection(String className) {
		String return_str = "";

		try {
			int i,j;
			Class cls = Class.forName(className);
			Field[] fieldList = cls.getFields();

			for (i=0;i<fieldList.length;i++) {
				Field fld = fieldList[i];
				return_str += Modifier.toString(fld.getModifiers());
				return_str += " " + fld.getType().getName();
				return_str += " " + fld.getName() + ";\n";
			}

			return_str += "\n";

			Constructor[] ctorList = cls.getConstructors();

			for (i=0;i<ctorList.length;i++) {
				Constructor ct = ctorList[i];
				return_str += Modifier.toString(ct.getModifiers());
				return_str += " " + ct.getDeclaringClass().getName();
				Class[] cparamList = ct.getParameterTypes();
				return_str += "(";

				for (j=0;j<cparamList.length;j++) {
					return_str += " " + cparamList[j].getName();
				}

				return_str += ");\n";
			}
			return_str += "\n";

			Method[] methList = cls.getMethods();

			for (i=0;i<methList.length;i++) {
				Method m = methList[i];
				return_str += Modifier.toString(m.getModifiers());
				return_str += " " + m.getReturnType().getName();
				return_str += " " + m.getName();
				Class[] mparamList = m.getParameterTypes();
				return_str += "(";

				for (j=0;j<mparamList.length;j++) {
					return_str += " " + mparamList[j].getName();
				}

				return_str += ");\n";
			}

			return_str += "\n";
		} catch (Exception e) {
			e.printStackTrace();
		}

		return return_str;
	}
Category: Web dev
Posted by: hajime osako
Category: Web dev
Posted by: hajime osako