Thursday, August 13, 2009

java 프로세스 죽이지 않고 dump 뜨기

java 프로세스 죽이지 않고 dump 뜨기
흔히 사용되는 dump뜨는 방법은 프로세스를 죽이면서 콘솔에 뿌리는 것인데
StackTrace를 사용하면 프로세스를 죽이지 않고도 dump를 뜰 수 있다.

설치하지 않고도 web start를 사용하여 실행되는 것도 마음에 든다.
http://www.adaptj.com/main/download

화면의 “Launch” 버튼을 클릭하여 StackTrace 실행한다.


만약 실행되지 않고 다음과 같이 물어보면 파일로 저장하고 cmd창에서 javaws launch.jnlp하면 실행된다.
실행된 후에 메뉴에서 Process > Select...를 클릭하고 팦업된 창에서 "..."를 클릭하여 java 프로세스를 고른다.



그리고 메뉴에서 Process > Thread Dump를 클릭하면 dump가 떠지고, 파일로도 저장할 수 있다.

이클립스 속으로 들어간 드림위버같은 웹 편집기

이클립스 속으로 들어간 드림위버같은 웹 편집기

이클립스 JEE 패키지에 기본으로 포함된 편집기입니다. 파일을 선택하고 오른버튼메뉴에서 Open With > Web Page Editor 를 선택해서 엽니다. 한 번 열면 계속 그 파일은 마지막 열었던 편집기로 열리게 됩니다.

마치 드림위버처럼 웹페이지 디자인 편집이 가능한 편집기가 열립니다. 파일 탭부분의 아이콘을 보면 지구표시가 함께 보입니다.

툴바에 있는 네 개의 아이콘을 클릭하면 다르게 볼 수 있습니다.

가로 분할, 세로 분할, 디자인 보기, 코드 보기가 지원되고 하단의 Preview를 통해서 브라우저에서 보이는 모습을 확인할 수 있습니다.

파일이 이것저것 열리면 에러창이 뜰 수도 있는데, 모든 파일 다 닫으시고 새로 시작하면 됩니다.

eclipse3.5 Subversive 플러그인 설치법

eclipse3.5 Subversive 플러그인 설치법

1. SVN 기본 플러그인 설치
eclipse 메뉴 Help > Install New Software... >



상단 Work with 항목에서 Galileo - http://download.eclipse.org/releases/galileo 선택 후 1~5분 기다립니다.




아래 창의 Pending... 사라지면 Collaboration 항목의 + 를 확장합니다.
Collaboration의 제일 아래 있는 Subversive SVN Team Provider(Incubation) 만 선택합니다.



Next 버튼 > Next 버튼 > I agree 체크하고 > Finish 로 설치합니다.

시간 아주 오래 걸립니다. 지금 20분째. ㅡㅡ;


2. SVN Connector 설치
http://www.eclipse.org/subversive/downloads.php
사이트에 접속해서 SVN Connector를 선택할 차례입니다.
polarion 사이트를 통해서 다운로드 받아야되는 라이선스 이슈가 있지만, 일단 설치하면 안정적인 듯 합니다.
다음 주소줄을 복사해서 eclipse 메뉴 Help > Install New Software... >
상단 Work with 항목에 붙여놓고 우측 Add... 버튼을 클릭합니다.
http://community.polarion.com/projects/subversive/download/eclipse/2.0/galileo-site/


다음 항목들을 선택합니다.
Subversive SVN Connectors
- JavaHL 1.6.0 Win32 Binaries (Optional)
- Native JavaHL 1.6 Implementation (Optional)
- Subversive SVN Connectors
- SVNKit 1.3.0 Implementation(Optional)



Next > Finish

eclipse를 재시작하고 우측 상단의 Perspective Selector 아이콘에서 SVN Repository Exploring을 선택합니다.

http://daysago.googlecode.com/svn/ 주소를 넣어 연결해 봅니다.

Wednesday, August 12, 2009

구글 크롬에서 IE TAB으로 인터넷뱅킹을 이용하다











요즘 김기창 교수의 책 '한국웹의 불편한 진실' 덕분에 더 화제가

되고 있지만, 한국의 웹사이트들이 익스플로러 이외의 브라우저를

거부하는 문제 때문에 다른 브라우저들이 제대로 대접받지 못하고

있는 것이 현실입니다. 그놈의 Active X 때문이죠.





하지만 해결책이 없는 것은 아닙니다.

파이어폭스와 구글 크롬에서는 플러그인을 사용해서

가상의 IE 환경을 구현해줍니다.

이를 통해 인터넷뱅킹도 이용할 수 있습니다.




구글 크롬 사용자인 저는 이 방법을 통해 드디어 인터넷뱅킹 등

한국 웹사이트를 방문할 때 발생했던 문제를 해결했습니다.

인터넷 뱅킹에 들어가서 자금이체까지 완벽히 마쳤습니다.

단점이 있다면 IE 환경에서는 속도가 조금 느려진다는 것.

하지만 그럭저럭 쓸 만합니다. 딱 익스플로러 만큼 느려집니다.

이제 익스플로러는 점점 더 기억 속으로 묻히게 되겠네요.




파이어폭스에서 IE TAB을 구현하는 것은 아주 간단히 설치 한 번으로

해결할 수 있었지만, 구글 크롬에서 IE TAB을 설치하는 것은

조금은 더 복잡합니다. 니켈 플러그인 같은 것을 쓰면 좀더 쉬울지는 모르지만

저처럼 단순히 IE TAB만 설치하려는 분들에게는 좀더 깔끔한 방식이 있습니다.

그 방법을 여기에 설명해볼까 합니다.











1. 우선 위 첨부파일을 다운받아서 아래 폴더에 저장합니다.




C:\Documents and Settings\(자신의 계정)\Local Settings\Application Data\Google\Chrome\User Data\Default\Plugin Data





2. 윈도 -> '실행'에서 cmd 창을 띄웁니다. cd 를 이용해 위 경로로 이동합니다.





cd C:\Documents and Settings\(자신의 계정)\Local Settings\Application Data\Google\Chrome\User Data\Default\Plugin Data





3. 레지스트리에 위 파일을 등록합니다.




regsvr32 npmeadax.dll




4. 크롬 북마크바에서 마우스 오른쪽 버튼을 눌러 '페이지 추가'를 선택합니다. 이름에는 'IE TAB' 등 적당한 이름을 넣으시고 URL에는 아래를 복사해서 넣습니다.




javascript:(function () { var lh=location.href; if( !lh || lh.match(/^(javascript|about):/i) ) return; document.write('<html><head><title> '+(document.title?document.title:lh).replace(/</g,'<').replace(/>/g,'>')+' - using Internet Explorer rendering<\/title><\/head><body style=\'margin:0px;padding:0px;\'> <script type=\'text/javascript\'>var script = document.createElement(\'script\'); var embed = \'<embed type=\\\'application\/x-meadco-neptune-ax\\\' width=\\\'100\x25\\\' height=\\\'100\x25\\\' param-location=\\\'' + lh + '\\\'><\/embed>\'; script.setAttribute(\'src\',\'data:text/javascript,document.write(embed);\'); document.body.appendChild(script);<\/script><\/body><\/html>'); })();




5. 자 이제 IE TAB 설치가 완료되었습니다. 은행 사이트에 가셔서 북마크바의 IE TAB을 누르시면 이제 IE 환경으로 바뀝니다.




자바스크립트의 클래스화

31일차: 자바스크립트의 클래스화

Ajax 2009/08/12 09:48



*자바에서 클래스 정의

class 클래스 이름{

변수들

메서드들(){ }

}




*자바스크립트에서 클래스 정의

클래스 이름 = function(){

변수;

}




//함수 정의(클래스에 함수 추가시켜주기)

클래스이름.prototype.함수이름 = function(){

함수 내용;

}




Member = function(id, name){

this.id = id;

this.name = name;

}







Member.prototype.setValue(newId,newName){

this.id = newId;

this.name = newName;

}




==> var mem = new Member("elvo", "이정석");

==> mem.setValue("abc","홍길동");







*JSON 기법




클래스 이름 = function(){

변수;

}




클래스이름.prototype ={

함수명1: function(){

함수내용;

}, <- 함수사이에 쉼표 꼭 해줘야함 

함수명2: function(){

함수내용;

}

}







*자바스크립트에서 패키지 정의하기




package ajax.xhr;

class aaa{}




var ajax = new Object();

ajax.Request = function(){}




var ajax = new Object();

ajax.xhr = new Object();

ajax.xhr.Request = function(){}




=>

var ajax = {};

ajax.xhr={};

ajax.xhr.Request = function(){}










* httpRequest.js를 패키지, 클래스화 하여 ajax.js로 바꾸기






httpRequest.js

function getXMLHttpRequest(){ //XHR객체를 리턴해주는 함수 만들기
if(window.ActiveXObject){//IE 6.0 이라면..
try{
return new ActiveXObject("Msxml2.XMLHTTP");
}catch (e) {
try {//IE의 옛날 버전 이라면..
return new ActiveXObject("Microsoft.XMLHTTP");
} catch (e1) {
return null;
}
}
}else if(window.XMLHttpRequest){ //다른 모든 기타 브라우저들 이라면 (IE 7.0이후 포함)
return new XMLHttpRequest();
}else{
return null;
}
}

var httpRequest = null;

function sendRequest(url, params, callback, method) {
httpRequest = getXMLHttpRequest();//XMLHttpRequest객체 구하기
var httpMethod = method ? method : 'GET'; //메소드값이 없으면 겟방식으로..


if(httpMethod != 'GET' && httpMethod != 'POST'){
httpMethod = 'GET';
}

var httpParams = (params == null || params == '')? null : params;

var httpUrl = url;

if(httpMethod == 'GET' && httpParams != null){
httpUrl = httpUrl + "?" + httpParams;
}

httpRequest.open(httpMethod, httpUrl, true);
httpRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');

httpRequest.onreadystatechange = callback;
httpRequest.send(httpMethod == 'POST' ? httpParams : null);

}




ajax.js

var ajax = {};
ajax.xhr = {};

ajax.xhr.Request = function(url,params,callback, method){
this.url = url;
this.params = params;
this.callback = callback;
this.method = method;
this.send();
}

ajax.xhr.Request.prototype = {
getXMLHttpRequest: function(){ //XHR객체를 리턴해주는 함수 만들기
if(window.ActiveXObject){//IE 6.0 이라면..
try{
return new ActiveXObject("Msxml2.XMLHTTP");
}catch (e) {
try {//IE의 옛날 버전 이라면..
return new ActiveXObject("Microsoft.XMLHTTP");
} catch (e1) {
return null;
}
}
}else if(window.XMLHttpRequest){ //다른 모든 기타 브라우저들 이라면 (IE 7.0이후 포함)
return new XMLHttpRequest();
}else{
return null;
}
},

send: function() {
this.req = this.getXMLHttpRequest();//XMLHttpRequest객체 구해서 req라는 멤버변수를 만들어 거기에 넣어줌
var httpMethod = this.method ? this.method : 'GET'; //메소드값이 없으면 겟방식으로..

if(httpMethod != 'GET' && httpMethod != 'POST'){
httpMethod = 'GET';
}

var httpParams = (this.params == null || this.params == '')? null : this.params;

var httpUrl = this.url;

if(httpMethod == 'GET' && httpParams != null){
httpUrl = httpUrl + "?" + httpParams;
}

this.req.open(httpMethod, httpUrl, true);
this.req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');

var request = this;
this.req.onreadystatechange = function(){
request.onStateChange.call(request);
}

this.req.send(httpMethod == 'POST' ? httpParams : null);

},
onStateChange: function(){
this.callback(this.req);
}
}

Tuesday, August 11, 2009

Monday, August 10, 2009

Quick Ajax Debugging Tip


Quick Ajax Debugging Tip
Ok, so this has been bugging me for the past few hours so I thought I'd share a quick hack. I've got a prototype I'm working on for a client that has a bit of Ajax in it. My Application.cfc code comes from a snippet I have in ColdFusion Builder and has the following onError:

Short and simple. An ugly dump is fine for testing. However, when an Ajax called was made, Firebug displayed a butt load of HTML (the dump) and it was difficult to find the exact message. I just changed it to the following code and it was incredibly helpful. Still not something I'd recommend on production, but I may change my snippet to support this:
message=#arguments.exception.message# detail=#arguments.exception.detail#
Basically, if method exists in the URL, assume it's Ajax. (I could also check the headers, as described here.)