2012년 11월 23일 금요일
Install JEUS server runtime on Eclipse
http://technet.tmax.co.kr/kr/pds/bin/jeus/readBoardForm.do?bbsCode=bin_jeus&fc=pds&sc=pds_bin&tc=pds_bin_jeus¤tPage=1&seqNo=38947&categoryId=&productCode=&range=10&searchType=ALL&searchText=
JEUS의 Boot, Down, Deploy 기능을 Eclipse를 사용자들을 위해서 제공하는 Plugin입니다.
* Requirements for "JEUS + Eclipse(galileo) Bridge"
JEUS Version
아래 명시된 JEUS 를 지원합니다.
• JEUS 5.0 : fix#27
• JEUS 6.0 : fix#6
plug -in
Bridge를 사용하기 위해서는 'eclipse IDE for javaee developers' 패키지나 webtools 플러그인이 설치된 이클립스가 필요합니다.
• eclipse-jee-galileo-win32.zip [다운로드]
* 설치방법
1. Eclipse에서 Help > Install New Software 메뉴를 선택합니다.
2. Add 버튼을 선택 후 Archive 버튼을 선택합니다.
3. New Archive Site 메뉴를 선택 후 다운로드 받은 Eclipse(galileo) Bridge for JEUS.zip 파일을 선택합니다.
4. Finish 버튼을 선택하여 설치합니다.
* 메뉴얼
Eclipse에서 Help > Help Conents 메뉴에 JEUS 서버 설정 가이드를 참고하시면 됩니다.
2012년 11월 19일 월요일
AIX 에서 특정 port 를 사용하는 Process ID 찾기
# netstat -Aan | grep 8080
f1000500003e9bb8 tcp4 0 0 *.10431 *.* LISTEN
# rmsock f1000500003e9bb8 tcpcb
The socket 0xf1000500003e9808 is being held by proccess 4849780 (wsm).
2012년 10월 30일 화요일
2012년 10월 25일 목요일
Firefox sqlite-manager(plugin)를 firefox 없이 실행하기
* 아래 파일을 다운로드 받아 C:\Program Files (x86)\xulrunner 에 압축 해제
http://ftp.mozilla.org/pub/mozilla.org/xulrunner/releases/10.0.2/runtimes/xulrunner-10.0.2.en-US.win32.zip
* 아래 파일을 다운받아 C:\utils\sqlitemanager-xr-0.7.7-all에 압축 해제
http://sqlite-manager.googlecode.com/files/sqlitemanager-xr-0.7.7-all.zip
* 배치 파일에 아래 내용을 넣고 저장 & 실행
* xulrunner site
https://developer.mozilla.org/en-US/docs/XULRunner
* sqlite-manager site
http://sqlite-manager.googlecode.com
Install ffmpeg on Ubuntu 10.04 LTS
reference
http://ubuntuforums.org/showthread.php?t=786095
http://ffmpeg.org/trac/ffmpeg/wiki/UbuntuCompilationGuideLucid
$ mkdir /home/user0/ffmpeg_packages
$ cd /home/user0/ffmpeg_packages
$ sudo apt-get remove ffmpeg x264 libx264-dev yasm
$ sudo apt-get update
$ wget http://security.ubuntu.com/ubuntu/pool/multiverse/f/faac/libfaac0_1.26-0.1ubuntu2_amd64.deb
$ wget http://security.ubuntu.com/ubuntu/pool/multiverse/f/faac/libfaac-dev_1.26-0.1ubuntu2_amd64.deb
$ dpkg -i libfaac0_1.26-0.1ubuntu2_amd64.deb
$ sudo dpkg -i libfaac-dev_1.26-0.1ubuntu2_amd64.deb
$ sudo apt-get install -y build-essential git-core checkinstall texi2html \
libopencore-amrnb-dev libopencore-amrwb-dev libtheora-dev libvorbis-dev zlib1g-dev
* yasm
$ cd /home/user0/ffmpeg_packages
$ wget http://www.tortall.net/projects/yasm/releases/yasm-1.2.0.tar.gz
$ tar xzvf yasm-1.2.0.tar.gz
$ cd yasm-1.2.0
$ ./configure
$ make
$ sudo checkinstall --pkgname=yasm --pkgversion="1.2.0" --backup=no --deldoc=yes --default
* x264
$ cd /home/user0/ffmpeg_packages
$ git clone --depth 1 git://git.videolan.org/x264
$ cd x264
$ ./configure --enable-static
$ make
$ sudo checkinstall --pkgname=x264 --default --pkgversion="3:$(./version.sh | \
awk -F'[" ]' '/POINT/{print $4"+git"$5}')" --backup=no --deldoc=yes
* LAME
$ cd /home/user0/ffmpeg_packages
$ sudo apt-get remove libmp3lame-dev
$ sudo apt-get install nasm
$ wget http://downloads.sourceforge.net/project/lame/lame/3.99/lame-3.99.5.tar.gz
$ tar xzvf lame-3.99.5.tar.gz
$ cd lame-3.99.5
$ ./configure --enable-nasm --disable-shared
$ make
$ sudo checkinstall --pkgname=lame-ffmpeg --pkgversion="3.99.5" --backup=no --default \
--deldoc=yes
* libvpx
$ cd /home/user0/ffmpeg_packages
$ git clone --depth 1 http://git.chromium.org/webm/libvpx.git
$ cd libvpx
$ ./configure
$ make
$ sudo checkinstall --pkgname=libvpx --pkgversion="$(date +%Y%m%d%H%M)-git" --backup=no \
--default --deldoc=yes
* ffmpeg
$ cd /home/user0/ffmpeg_packages
$ git clone --depth 1 git://source.ffmpeg.org/ffmpeg
$ cd ffmpeg
$ ./configure --enable-gpl --enable-libfaac --enable-libmp3lame --enable-libopencore-amrnb \
--enable-libopencore-amrwb --enable-libtheora --enable-libvorbis --enable-libvpx \
--enable-libx264 --enable-nonfree --enable-version3 --enable-x11grab
$ make
$ sudo checkinstall --pkgname=ffmpeg --pkgversion="5:$(./version.sh)" --backup=no \
--deldoc=yes --default
$ hash x264 ffmpeg ffplay ffprobe
2012년 10월 5일 금요일
Convert video file using QuickTime for Java (MOV -> MP4)
1. Install QuickTime 7
http://www.apple.com/quicktime/
2. Copy QTJava.zip
Source : C:\Program Files (x86)\QuickTime\QTSystem\QTJava.zip
Destination : ${JAVA_HOME}/jre/lib/ext
--------------------------------------------------------------------------------
* sample code
--------------------------------------------------------------------------------
package quicktime;
import java.io.File;
import org.apache.commons.lang.time.StopWatch;
import quicktime.io.IOConstants;
import quicktime.io.OpenMovieFile;
import quicktime.io.QTFile;
import quicktime.std.StdQTConstants;
import quicktime.std.movies.Movie;
import quicktime.std.qtcomponents.MovieExporter;
import quicktime.util.QTUtils;
public class QtjConverter {
public static void main(String[] args) {
String src = "c:\\temp\\Wildlife.mov";
String dest = "c:\\temp\\Wildlife.mp4";
StopWatch sw = new StopWatch();
sw.start();
try {
boolean result = qtjConvert(src, dest);
System.out.println("result="+result);
}
catch ( Exception e ) {
e.printStackTrace();
}
sw.stop();
long time = sw.getTime();
System.out.println("time="+time);
}
public static boolean qtjConvert(String src, String dest) throws Exception {
boolean result = false;
QTSession.open();
try {
QTFile movieFile = new QTFile(src);
Movie movie = Movie.fromFile (OpenMovieFile.asRead(movieFile));
//MovieExporter
//new Thread (new Exporter(movie)).start();
QTFile destFile = new QTFile (new File (dest));
// int flags = StdQTConstants.createMovieFileDeleteCurFile |
// StdQTConstants.createMovieFileDontCreateResFile |
// StdQTConstants.showUserSettingsDialog;
int flags = StdQTConstants.createMovieFileDontCreateResFile;
// int type = StdQTConstants.kQTFileTypeMovie;
// type = QTUtils.toOSType("mpg4");
// type = QTUtils.toOSType("MooV");
// MovieExporter exporter = new MovieExporter (StdQTConstants.kQTFileTypeMovie);
// movie.convertToFile(null, destFile, StdQTConstants.kQTFileTypeMovie,
// StdQTConstants.kMoviePlayer, IOConstants.smSystemScript,
// StdQTConstants.showUserSettingsDialog | StdQTConstants.movieToFileOnlyExport
// | StdQTConstants.movieFileSpecValid, exporter);
// movie.convertToFile(destFile, StdQTConstants.kQTFileTypeMovie, 0, 0);
// movie.convertToFile(destFile, StdQTConstants.kQTFileTypeMovie, StdQTConstants.kMoviePlayer, IOConstants.smAllScripts, flags);
// movie.convertToFile(destFile, StdQTConstants.kQTFileTypeMovie, StdQTConstants.kMoviePlayer, IOConstants.smSystemScript, flags);
// movie.convertToFile(destFile, QTUtils.toOSType("MooV"), 0, 0);
movie.convertToFile(destFile, QTUtils.toOSType("mpg4"), 0, 0);
result = true;
}
catch ( Exception e ) {
throw e;
}
QTSession.close();
return result;
}
}
2012년 7월 27일 금요일
sqlite에 auto increment 값 입력하고 입력된 일련번호 값 받아오기
CREATE TABLE userInfo
userId INTEGER PRIMARY KEY,
first_name TEXT NOT NULL,
last_name TEXT NOT NULL,
);
<insert id="insertUser" parameterType="userVo">
<![CDATA[
INSERT INTO userInfo (
first_name
,last_name
) VALUES (
#{firstName}
,#{lastName}
)
]]>
<selectKey keyProperty="userId" resultType="int">
SELECT LAST_INSERT_ROWID()
</selectKey>
</insert>
public class UserInfoDAOImpl extends BaseDAO implements UserInfoDAO{
@Override
public int insertJob(UserVo userVo) throws OSPException {
int returnVal = -1;
returnVal = (Integer) getSqlSession().insert("com.test.dao.UserInfoDAO.insertUser", userVo);
System.out.println("userId="+userVo.getUserId());
return returnVal;
}
}
2012년 6월 26일 화요일
안드로이드 개발환경 설정 (r18)
* 설치환경
JDK 1.7.0_04 (64)
Eclipse Classic 3.7.2 (64)
* 환경변수 JAVA_HOME
* Android SDK download (r18)
http://developer.android.com/sdk/index.html
* 설치 종료 후 SDK Manager 에서 플랫폼과 패키지를 추가
http://developer.android.com/sdk/installing/adding-packages.html
* Eclipse ADT Plugin 설치
이클립스 실행
Help > Install New Software....
Add 버튼 클릭
Name: ADT Plugin
Location: https://dl-ssl.google.com/android/eclipse/
Click OK
Developer Tools 체크하고 Next 클릭
Next 클릭
라이센스 동의하고 Finish 클릭
설치가 완료되면 Eclipse 재시작
재시작시 Use existing SDKs, Existing Location에 Android SDK 설치 디렉토리 선택 (기본으로 설치했다면 C:\Program Files(x86)\Android\android-sdk)
2012년 6월 15일 금요일
ffmpeg install on Ubuntu 10.04(lucid) LTS
reference
http://ubuntuforums.org/showthread.php?t=786095
http://ffmpeg.org/trac/ffmpeg/wiki/UbuntuCompilationGuideLucid
$ mkdir /home/user0/ffmpeg_packages
$ cd /home/user0/ffmpeg_packages
$ sudo apt-get remove ffmpeg x264 libx264-dev yasm
$ sudo apt-get update
$ wget http://security.ubuntu.com/ubuntu/pool/multiverse/f/faac/libfaac0_1.26-0.1ubuntu2_amd64.deb
$ wget http://security.ubuntu.com/ubuntu/pool/multiverse/f/faac/libfaac-dev_1.26-0.1ubuntu2_amd64.deb
$ dpkg -i libfaac0_1.26-0.1ubuntu2_amd64.deb
$ sudo dpkg -i libfaac-dev_1.26-0.1ubuntu2_amd64.deb
$ sudo apt-get install -y build-essential git-core checkinstall texi2html \
libopencore-amrnb-dev libopencore-amrwb-dev libtheora-dev libvorbis-dev zlib1g-dev
* yasm
$ cd /home/user0/ffmpeg_packages
$ wget http://www.tortall.net/projects/yasm/releases/yasm-1.2.0.tar.gz
$ tar xzvf yasm-1.2.0.tar.gz
$ cd yasm-1.2.0
$ ./configure
$ make
$ sudo checkinstall --pkgname=yasm --pkgversion="1.2.0" --backup=no --deldoc=yes --default
* x264
$ cd /home/user0/ffmpeg_packages
$ git clone --depth 1 git://git.videolan.org/x264
$ cd x264
$ ./configure --enable-static
$ make
$ sudo checkinstall --pkgname=x264 --default --pkgversion="3:$(./version.sh | \
awk -F'[" ]' '/POINT/{print $4"+git"$5}')" --backup=no --deldoc=yes
* LAME
$ cd /home/user0/ffmpeg_packages
$ sudo apt-get remove libmp3lame-dev
$ sudo apt-get install nasm
$ wget http://downloads.sourceforge.net/project/lame/lame/3.99/lame-3.99.5.tar.gz
$ tar xzvf lame-3.99.5.tar.gz
$ cd lame-3.99.5
$ ./configure --enable-nasm --disable-shared
$ make
$ sudo checkinstall --pkgname=lame-ffmpeg --pkgversion="3.99.5" --backup=no --default \
--deldoc=yes
* libvpx
$ cd /home/user0/ffmpeg_packages
$ git clone --depth 1 http://git.chromium.org/webm/libvpx.git
$ cd libvpx
$ ./configure
$ make
$ sudo checkinstall --pkgname=libvpx --pkgversion="$(date +%Y%m%d%H%M)-git" --backup=no \
--default --deldoc=yes
* ffmpeg
$ cd /home/user0/ffmpeg_packages
$ git clone --depth 1 git://source.ffmpeg.org/ffmpeg
$ cd ffmpeg
$ ./configure --enable-gpl --enable-libfaac --enable-libmp3lame --enable-libopencore-amrnb \
--enable-libopencore-amrwb --enable-libtheora --enable-libvorbis --enable-libvpx \
--enable-libx264 --enable-nonfree --enable-version3 --enable-x11grab
$ make
$sudo checkinstall --pkgname=ffmpeg --pkgversion="5:$(./version.sh)" --backup=no \
--deldoc=yes --default
$ hash x264 ffmpeg ffplay ffprobe
2012년 6월 14일 목요일
java로 ubuntu 환경에서 /proc/stat을 이용해 CPU 사용량 체크하기
package test;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
public class CpuRateByCore {
public static int INTERVAL = 1000;
public static String[] getCpuUsageByCore() {
String[] result = null;
String[] command = { "bash", "-c", "cat /proc/stat | grep 'cpu[0-9]'" };
Runtime runtime = Runtime.getRuntime();
BufferedReader reader = null;
List<CpuInfoVo> prevInfoList = new ArrayList<CpuInfoVo>();
List<CpuInfoVo> diffInfoList = new ArrayList<CpuInfoVo>();
try {
Process process = runtime.exec(command);
reader = new BufferedReader(new InputStreamReader(process.getInputStream()));
String line = null;
String[] columns = null;
long total = 0;
long idle = 0;
int x = 0;
while ( (line = reader.readLine()) != null ) {
// System.out.println(line);
line = line.replace(" ", " ");
columns = line.split(" ");
total = 0;
idle = 0;
for ( int i = 1 ; i < columns.length ; i++ ) {
total += Long.parseLong(columns[i]);
}
idle = Long.parseLong(columns[4]);
CpuInfoVo vo = new CpuInfoVo();
vo.setTotal(total);
vo.setIdle(idle);
prevInfoList.add(vo);
x++;
}
// sleep 1sec
//Thread.sleep(INTERVAL);
process = runtime.exec(command);
reader = new BufferedReader(new InputStreamReader(process.getInputStream()));
x = 0;
while ( (line = reader.readLine()) != null ) {
line = line.replace(" ", " ");
columns = line.split(" ");
total = 0;
idle = 0;
for ( int i = 1 ; i < columns.length ; i++ ) {
total += Long.parseLong(columns[i]);
}
idle = Long.parseLong(columns[4]);
long diffTotal = total - prevInfoList.get(x).getTotal();
long diffIdle = idle - prevInfoList.get(x).getIdle();
long cpuRate = 0;
if (diffTotal != 0)
cpuRate = 100 * ( diffTotal - diffIdle ) / diffTotal;
CpuInfoVo vo = new CpuInfoVo();
vo.setTotal(diffTotal);
vo.setIdle(diffIdle);
vo.setRate(cpuRate);
diffInfoList.add(vo);
x++;
}
result = new String[diffInfoList.size()];
for (int i=0; i<diffInfoList.size(); i++) {
CpuInfoVo cpuInfoVo = (CpuInfoVo)diffInfoList.get(i);
result[i] = Long.toString(cpuInfoVo.getRate());
}
}
catch ( Exception e ) {
e.printStackTrace();
}
return result;
}
public static void main(String[] args) throws Exception {
String[] cpuRates = getCpuUsageByCore();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
String ymd = sdf.format(Calendar.getInstance().getTime().getTime());
StringBuilder message = new StringBuilder();
message.append(ymd);
int total = 0;
for ( int i = 0 ; i < cpuRates.length ; i++ ) {
message.append(" ").append(cpuRates[i]);
total += Integer.parseInt(cpuRates[i]);
}
int cpuRate = total / cpuRates.length;
message.append(" (avg)").append(cpuRate);
System.out.println(message);
}
}
2012년 4월 29일 일요일
apache BeanUtils.populate에서 user_name 형식의 속성을 userName 멤버변수에 입력하도록 하기
public static void populate(Object bean, Map properties) throws IllegalAccessException, InvocationTargetException {
// Do nothing unless both arguments have been specified
if ((bean == null) || (properties == null)) {
return;
}
// Loop through the property name/value pairs to be set
Iterator entries = properties.entrySet().iterator();
while (entries.hasNext()) {
// Identify the property name and value(s) to be assigned
Map.Entry entry = (Map.Entry) entries.next();
String name = (String) entry.getKey();
if (name == null) {
continue;
}
char[] del = {'_'};
name = StringUtils.replace(WordUtils.capitalize(name, del), "_", "");
if (name.length() > 1) {
name = name.substring(0,1).toLowerCase() + name.substring(1);
}
// Perform the assignment for this property
BeanUtils.setProperty(bean, name, entry.getValue());
}
}
피드 구독하기:
글 (Atom)