기본 콘텐츠로 건너뛰기

12월, 2016의 게시물 표시

BitTorrent Sync

우분투 설치 apt-get -y install python-software-properties add-apt-repository ppa:tuxpoldo/btsync apt-get update apt-get -y install btsync mkdir /btsync #set ownership to btsync user chown btsync /btsync service btsync start service btsync stop 나머지 설정은 다음에... 참고 사이트 http://blog.djjproject.com/56

웹에서 폴더 선택후 업로드

찾아보니까 이런게 있네요 http://dior.ics.muni.cz/~makub/massupload.html 위의 링크에서 핵심은 아래 구문이네요 document.getElementById('dir_input').files 크롬은 이런 구문으로 폴더내의 파일을 배열로 가져오네요 내용을 보면 불여우나 익스에는 안될것 같네요

톰캣 세션 타임 아웃 설정

web.xml 파일이 있습니다. 이 파일을 열어서 session이라고 검색해 보십시오. <session-config>   <session-timeout>360</session-timeout> </session-config> 위 단락을 찾을 수 있습니다. session-timeout 시간 360이 바로 자동로그아웃 세션 시간입니다.  단위는 분이고요. 30분으로 하고 싶으시면 30으로 바꿔서 저장해주시면 되는 것이죠~ Tomcat 내에서 Session Timeout 를 설정하는 우선 순위가 존재 한다. session.setMaxInactiveInterval() 프로그램내에서 time out 를 설정했을 경우 Web application 내의 WEB-INF/web.xml Tomcat 내의 conf/web.xml 실제로 Tomcat(conf/web.xml)내에 Default 로 설정되어 있는 것은 다음과 같다. < HttpSession 메서드 > getCreationTime() - 세션 생성 시간 getLastAccessedTime() - 마지막 요청 시간 setMaxInactiveInterval() - 최대허용시간 설정 (초) getMaxInactiveInterval() - 최대허용시간 invalidate() - 세션 제거 < 타임아웃 설정하기 > - 일정 시간 동안 요청이 없으면 세션을 제거한다  1. DD에서 전체 세션 타임아웃 설정       web.xml 1. DD에서 전체 세션 타임아웃 설정       web.xml <web-app ... >     <servlet>          ...     </servlet>     <session-config>         <session-timeout>30</session-timeout>

myslq / 마리아 DB lock 확인 풀기

1. 상태 보기  show processlist; MariaDB [data]> show processlist; +------+------+-------------------+------------+---------+-------+-------+------------------+----------+ | Id   | User | Host              | db         | Command | Time  | State | Info             | Progress | +------+------+-------------------+------------+---------+-------+-------+------------------+----------+ |   99 | root | 127.0.0.1:37654   | saintdb    | Sleep   |     1 |       | NULL             |    0.000 | 2. lock 해제 id를 가지고 kill 하면 된다. kill 99;

우분투 PostgreSQL 설치

참조 사이트 http://zetawiki.com/wiki/%EC%9A%B0%EB%B6%84%ED%88%AC_PostgreSQL_%EC%84%A4%EC%B9%98 1. 설치 확인 aptitude show postgresql | grep State State: not installed 2. 설치 apt-get install postgresql 3. 확인 dpkg -l | grep postgres 4. 계정 확인 cat /etc/passwd | grep postgres postgres:x:110:120:PostgreSQL administrator,,,:/var/lib/postgresql:/bin/bash 네트웍 상태 확인 netstat -tnlp | grep postgres 패스워드 설정 sudo -u postgres psql template1 could not change directory to "/root": Permission denied psql (9.3.11) Type "help" for help. template1=# template1=# ALTER USER postgres with encrypted password 'P@ssw0rd'; ALTER ROLE template1=# \q 접속 모든 대역 허용 vi /etc/postgresql/9.3/main/postgresql.conf listen_addresses = '*' vi /etc/postgresql/9.3/main/pg_hba.conf host    all             all             0.0.0.0/0               md5 접속 테스트 psql -h 135.79.246.80 -U postgres template1 접속 db 포함 접속 #psql -h 127.0.0.1 -U postgres customsinsa 다른 DB 접속

탐색기 나 파일 마우스 오른쪽 누른 경우

성능을 위해서 15개만 선택 가능한다. Context menus are shortened when more than 15 files are selected https://support.microsoft.com/ko-kr/kb/2022295 한개 선택 후 사용 할 수 있는 방법 1.시작-프로그램 및 파일 검색에 regedit 입력 후 엔터를 누릅니다. 2.레지스트리 편집기가 뜨면 아래의 경로로 이동합니다.   HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Folder\shell 3. 마우스 우측 클릭 후 새로 만들기로 키를 선택하고 이름을 Command Prompt로 만들어 줍니다. 영문 사이트(Context Menu Editors) http://www.thewindowsclub.com/remove-click-context-menu-items-editors 16개 이상 선택하는게 쉽지 않다. http://stackoverflow.com/questions/20740846/windows-explorer-right-click-context-menu-for-files-and-folders HKEY_CLASSES_ROOT\*\shellex\ContextMenuHandlers https://msdn.microsoft.com/en-us/library/bb776881.aspx 1000개 까지 가능하게 수정하자 http://www.sevenforums.com/tutorials/131470-context-menu-items-missing-fix-when-more-than-15-files-selected.html

pdftotext: Linux / UNIX Convert a PDF File To Text

설치 # yum install poppler-utils $ sudo apt-get install poppler-utils 사용법 pdftotext { PDF-file } { text-file } $ pdftotext hp-manual.pdf hp-manual.txt $ pdftotext -f 5 -l 10 hp-manual.pdf hp-manual.txt $ pdftotext -opw 'password' hp-manual.pdf hp-manual.txt $ pdftotext -upw 'password' hp-manual.pdf hp-manual.txt $ pdftotext -eol unix hp-manual.pdf hp-manual.txt

java 난수 발생하기

1. 지정 범위까지 난수 발생 하기 public class Example {   public static void main(String[] args) {     // 3에서 12까지 범위의 정수를 랜덤하게 20개 출력     for (int i = 1; i <= 20; i++)       System.out.println(randomRange(3, 12));   }   // 지정된 범위의 정수 1개를 램덤하게 반환하는 메서드   // n1 은 "하한값", n2 는 상한값   public static int randomRange(int n1, int n2) {     return (int) (Math.random() * (n2 - n1 + 1)) + n1;   } }

java 배열 사용 방법

List listA = new ArrayList(); listA.add("김삿갓"); listA.add("홍아리"); listA.add(new String("홍길동")); listA.add(1, "1번째 요소값"); // 인덱스를 통한 조회 String element0 = listA.get(0).toString(); String element1 = listA.get(1).toString(); String element3 = listA.get(2).toString(); //Iterator 통한 전체 조회 Iterator iterator = listA.iterator(); while (iterator.hasNext()) {     String element = (String) iterator.next();     } //for-loop 통한 전체 조회 for(Object object : listA) {     String element = (String) object; }

java 특정 디렉토리에 있는 파일 목록을 읽어내기, 정렬해서 가져오기

폴더 리스트 가져오기 String path="C:\"; File dirFile=new File(path); File []fileList=dirFile.listFiles(); for(File tempFile : fileList) {   if(tempFile.isFile()) {     String tempPath=tempFile.getParent();     String tempFileName=tempFile.getName();     System.out.println("Path="+tempPath);     System.out.println("FileName="+tempFileName);     /*** Do something withd tempPath and temp FileName ^^; ***/   } } 정렬해서 가져오기 import java.io.FileFilter; import java.io.IOException; import java.util.Arrays; import java.util.Date; import org.apache.commons.io.comparator.LastModifiedFileComparator; import org.apache.commons.io.filefilter.FileFileFilter; public class LastModifiedFileComparatorTest { public static void main(String[] args) throws IOException { File directory = new File("."); // get just files, not directories File[] files = directory.listFiles((FileFilter) FileFileFilter.FILE); System.out.println("Default order")

java 도메인(Domain)을 IP로 변환하는 법

다음 팁은 도메인(Domain)을 IP로 변환하는 팁입니다. 서버에 접속해야 하는 클라이언트가 서버 IP를 알아야 하는 경우에 사용하실 수 있습니다. import java.net.InetAddress; import java.net.UnknownHostException; public class DomainToIp { public static void main(String args[]){ try {          InetAddress addr = InetAddress.getByName("froginpot.tistory.com");        byte[] ipAddr = addr.getAddress();          // IP 형식으로 변환        String ipAddrStr = "";        for (int i=0; i 0) {                ipAddrStr += ".";            }            ipAddrStr += ipAddr[i]&0xFF;        }              System.out.println("IP : " + ipAddrStr);          } catch (UnknownHostException e) {     System.out.println("Unknown Host");    } } }

java 시스템 시간

long time = System.currentTimeMillis();  SimpleDateFormat dayTime = new SimpleDateFormat("yyyy-mm-dd hh:mm:ss"); //구분자 없이 사용할려면... //SimpleDateFormat dayTime = new SimpleDateFormat("yyyyMMddHHmmss"); String str = dayTime.format(new Date(time)); System.out.println(str); long start = System.currentTimeMillis() ;  new trunc_tweet_tag("./message/"); long end = System.currentTimeMillis();  System.out.println((end-start)/1000 +" 초 걸림");