seige
$ wget http://www.joedog.org/pub/siege/siege-latest.tar.gz

tar xvfz siege-latest.tar.gz

./configure --with-ssl=/usr/bin/openssl

make
make install


siege -V

yum install mod_ssl openssl
 
Posted by [czar]
,

http://jna.java.net/


jna 에 관심있으신분들 사용하시길 ^^;;

jna 는 jni 처럼 dll 에있는 함수를 사용하는겁니다.
다른점이 있다면 jni 는 직접 dll 을 만들어서 해야하지만
jna 는 그냥 dll를 호출할수 있습니다 

예로 자바를 user32.dll 로 프로세스를 후킹할려면 이걸로 가능하다고 하네요 ^^...

import com.sun.jna.Library;
import com.sun.jna.Native;
import com.sun.jna.Platform;

/** Simple example of native library declaration and usage. */
public class HelloWorld {
    public interface CLibrary extends Library {
        CLibrary INSTANCE = (CLibrary) Native.loadLibrary((Platform.isWindows() ? "msvcrt" : "c"), CLibrary.class);
        void printf(String format, Object... args);
    }

    public static void main(String[] args) {
        CLibrary.INSTANCE.printf("Hello, World\n");
        for (int i = 0; i < args.length; i++) {
            CLibrary.INSTANCE.printf("Argument %d: %s\n", i, args[i]);
        }
    }
}

위예제는 위키에 등록된 예제를 퍼온것입니다.
C 에있는 printf 를 호출하는것이죠.

Posted by [czar]
,
http://www.phpschool.com/gnuboard4/bbs/board.php?bo_table=qna_install&wr_id=97764

test.co.kr 로 접속시 
www.test.co.kr 로 포워딩 해주는게 
어디서 설정해야 할지 모르겠습니다. 

네임서버도 운영중이고 웹서버도 직접 운영중인데 
웹서버 http.conf 에서 수정해야 하는건지 

<VirtualHost *:80> 
    ServerName www.test.co.kr 
    Serveralias test.co.kr 
    DocumentRoot /var/www/html/www.test.co.kr 
</VirtualHost> 

아니면 네임서버 zone 파일을 수정해야 하는건지 

      IN A 111.222.111.222 
www IN A 111.222.111.222 

어디를 어떻게 손대야 하는건가요? 



자답 : zone 파일 하단에 
*  IN  CNAME  www 
추가하니까 www 없이 접속시 www 붙여서 접속되네요
 


 
Posted by [czar]
,
회사에서 사용 할 무료 프로그램

1. filezilla
2. 7-zip

 
Posted by [czar]
,
출처 : http://mrjh.net/wiki/content.php?no=362&page=1


톰켓에서 여러 인스턴스 띄울때 쿠키 공유시키기
 (2011-03-03 15:32:31) MMM  XXX

Apache에서 proxy를 이용하여 Tomcat으로 redirect 시킬 경우

path가 안맞아서 쿠키가 먹통이 되는 경우가 생김


httpd.conf

ProxyPass / http://localhost:8080/abc


http://abc.mrjh.com/ 도메인에 위 예처럼 redirect 시키면 

톰켓에서 생성되는 쿠키 JSESSIONID의 path는 /abc로 잡히고

아파치에서는 /로 쿠키를 인식하기때문에 서로 인식이 안되는 현상이 발생함

이때 톰켓에서 아래처럼 셋팅해주면 Cookie Path를 무조건 /로 잡아줌


conf/server.xml


           connectionTimeout="20000"
           emptySessionPath="true"
           redirectPort="8443" />


위 예제는 Tomcat 6.x 까지 적용되며 Tomcat 7.x 에서는 위의 설정은 적용되지 않으며 아래와 같이 옵션을 줘야함


<Context .............. sessionCookiePath="/" ....... ></Context>

참고
http://tomcat.apache.org/migration.html#Session_cookie_configuration 


Posted by [czar]
,
톰캣 설정
context-1.xml
<Context crossContext="true" .... 생략

context-2.xml 
<Context crossContext="true" .... 생략

테스트
context-1.jsp 

<%

    ServletContext ctx = application.getContext("/context-1");

    Integer counter = (Integer)ctx.getAttribute("counter");

    if (counter == null) {

        counter = 0;

    }

    counter++;

    

    request.setAttribute("counter", counter);

    ctx.setAttribute("counter", counter);

%>


<h1>Context-1</h1>

<h1>현재 카운터는 ${counter}입니다.</h1>


context-2.jsp

<%

    ServletContext ctx = application.getContext("/context-1");

    Integer counter = (Integer)ctx.getAttribute("counter");

    if (counter == null) {

        counter = 0;

    }

    counter++;

    

    request.setAttribute("counter", counter);

    ctx.setAttribute("counter", counter);

%>


<h1>Context-1</h1>

<h1>현재 카운터는 ${counter}입니다.</h1>


출처 : http://jee-bpel-soa.blogspot.com/2009/06/session-sharing-in-apache-tomcat.html
Posted by [czar]
,

http://blog.kornr.net/index.php/2009/05/29/tomcat-jsessionid-and-subdomains

Tomcat, JSessionID, and subdomains...

Imagine you're developping a web site that manages subdomains for your users, in such a way that all your users automatically get a http://user1.example.com orhttp://user2.example.com subdomain.

In order to keep the normal session available on all the subdomains, one just needs to make the session cookie associated to the smallest common domain, in this exemple, the example.com domain, so that www.example.com share the same cookie with all the other http://[whatever].example.com subdomains. Piece of cake:cookie.setDomain("example.com"), right? Almost. Just, not in a servlet container. Because, you can't.

It's amazing, but in a servlet container, you just can't tell which domain the JSESSIONID cookie is associated to. Unfortunately, Tomcat provides no container-specific way to modify this behaviour.

So, here's a simple patch that fixes the issue. It's not suited for all purpose, it just removes any www prefix that appears in the hostname, and use it as cookie domain. If there's no www prefix, the normal behaviour applies.

In apache-tomcat-6.0.18-src/java/org/apache/catalina/connector/Request.java, find the configureSessionCookie() method, and replace it with this one:

    /**
     * Configures the given JSESSIONID cookie.
     *
     * @param cookie The JSESSIONID cookie to be configured
     */
    protected void configureSessionCookie(Cookie cookie) {
        cookie.setMaxAge(-1);
        String contextPath = null;
        if (!connector.getEmptySessionPath() && (getContext() != null)) {
            contextPath = getContext().getEncodedPath();
        }
        if ((contextPath != null) && (contextPath.length() > 0)) {
            cookie.setPath(contextPath);
        } else {
            cookie.setPath("/");
        }
        if (isSecure()) {
            cookie.setSecure(true);
        }

        // CHANGES BELOW
	String domain = this.getServerName();
	if (domain != null)
	    {
		if (domain.toLowerCase().startsWith("www."))
		    domain = domain.substring(4);
		
		cookie.setDomain(domain);
	    }
}
Posted by [czar]
,
ServletResponseAware 도 있음.

 

Accessing data through the ActionContext

 

ActionContext을 이용하여 session정보에 access (권장하지 않음)

SessionAware 인터페이스 이용하여 session정보에 access (이 방법을 권장)

 

 accessing the request and response

 

ActionContext를 이용하여 access (권장하지 않음)

ServletActionContext를 이용하여 access (권장하지 않음)

ServletRequestAware 를 이용하여 access (이 방법을 권장)



http://www.gurubee.net/display/WEBSTUDY/4.7+Accessing+data+through+the+ActionContext 

 

 

Posted by [czar]
,
/**
 * object 형태의 json 데이터를 string 형으로 변환
 * @param obj
 * @returns
 */
function jsonToString(obj) {
var t = typeof (obj);
    if (t != "object" || obj === null) {
        // simple data type
        if (t == "string") obj = '"'+obj+'"';
        return String(obj);
    } else {
    // recurse array or object
        var n, v, json = [], arr = (obj && obj.constructor == Array);
        for (n in obj) {
            v = obj[n]; t = typeof(v);
            if (t == "string") v = '"'+v+'"';
            else if (t == "object" && v !== null) v = jsonToString(v);
            json.push((arr ? "" : '"' + n + '" : ') + String(v));
        }
        return (arr ? "[" : "{") + String(json) + (arr ? "]" : "}");
    }
}

function objectToString(o){
    var parse = function(_o){
        var a = [], t;
        for(var p in _o){
            if(_o.hasOwnProperty(p)){
                t = _o[p];
                if(t && typeof t == "object"){
                    a[a.length]= p + ":{ " + arguments.callee(t).join(", ") + "}";
                }
                else {
                    if(typeof t == "string"){
                        a[a.length] = [ p+ ": \"" + t.toString() + "\"" ];
                    }
                    else{
                        a[a.length] = [ p+ ": " + t.toString()];
                    }
                }
            }
        }
        return a;
    };
    return "{" + parse(o).join(", ") + "}";
}
Posted by [czar]
,
setsebool -P ftp_home_dir=1


위 명령어를 실행해주니 잘 보인다;;; 



 


http://www.jopenbusiness.com/mediawiki/index.php/CentOS#vsftpd_.EC.84.A4.EC.B9.98

  • FTP 클라이언트에서 접속이 디렉토리 목록이 표시되지 않을 경우
  • FTP Client 설정에서 문자셋을 UTF-8로 강제로 설정하고 접속 한다.
 
Posted by [czar]
,