yjhyjh5369의 등록된 링크

키자드에 등록된 총 966개의 포스트를 확인하실 수 있습니다.

Naver Blog

sitemesh & freemarker

1. web.xml <filter> <filter-name>sitemesh</filter-name> <filter-class>com.opensymphony.module.sitemesh.filter.PageFilter</filter-class> <init-param> <param-name>debug.pagewriter</param-name> <param-value>false</param-value> </init-param> </filter> <filter-mapping> <filter-name>sitemesh</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> <servlet> <servlet-name>freemarker</servlet-name> <servlet-class>freemarker.ext.servlet.FreemarkerServlet</servlet-class> <init-param> <param-name>Temp

Naver Blog

[script] 구버전 IE에서 HTML5, CSS3를 사용하는 방법

출처 : http://www.phpschool.com/link/tipntech/77726 1. 사용법 <!--[if lt IE 9]> <script src="http://ie7-js.googlecode.com/svn/version/2.1(beta4)/IE9.js">IE7_PNG_SUFFIX=".png";</script> <![endif]--> 2. 함께 사용하면 더 좋은 것들 - html5shiv: http://code.google.com/p/html5shiv/ 구버전 IE가 <header>, <nav>, <article> 등 HTML5 태그를 알아듣도록 해줍니다. - css3pie: http://css3pie.com/ 구버전 IE에서도 동글동글한 외곽선, 그림자, 그라데이션 등의 CSS3 효과를 사용할 수 있도록 해줍니다.

Naver Blog

postgresql total row count

1. int 형으로 출력 SELECT schemaname,relname,n_live_tup FROM pg_stat_user_tables ORDER BY n_live_tup DESC; 2, 5.09986e+06 형태로 출력 SELECT nspname AS schemaname,relname,reltuples FROM pg_class C LEFT JOIN pg_namespace N ON (N.oid = C.relnamespace) WHERE nspname NOT IN ('pg_catalog', 'information_schema') AND relkind='r' ORDER BY reltuples DESC; 출처 : http://stackoverflow.com/questions/2596670/how-do-you-find-the-row-count-for-all-your-tables-in-postgres

Naver Blog

jqgrid + spring mvc

1. javascript $("#list").jqGrid({ url: g_url, // data: "table=users", postData: {table: 'users'}, /** 중요 **/ // cache: false, // global: false, /** trigger global Ajax event handlers for this request **/ // async: false, mtype:"POST", datatype: 'json', // contentType: "application/x-www-form-urlencoded", colNames: ['ID', '이름', '권한', '이메일'], colModel: [ {name:'id', index:'id', width:55}, {name:'name', index:'name', width:90}, {name:'auth', index:'auth', width:90}, {name:'email', index:'email', wi

Naver Blog

jquery outerHTML()

1. 1 $('#div1').clone().wrapAll('<div/>').parent().html(); cs 2. 1 2 3 4 5 jQuery.fn.outerHTML = function(s) { return s ? this.before(s).remove() : jQuery("<p>").append(this.eq(0).clone()).html(); }; Colored by Color Scripter cs

Naver Blog

연산자 우선순위

종류 연산방향 연산자 우선순위 단항 연산자 <------ ++ -- + - ~ ! (타입) 높음 낮음 산술 연산자 ------> * / % ------> + - ------> << >> >>> 비교 연산자 ------> < > <= >= instanceof ------> == != 논리 연산자 ------> & ------> ^ ------> | ------> && ------> || 삼항 연산자 ------> ?: 대입 연산자 <------ = *= /= %= += -= <<= >>= >>>= &= ^= |=

Naver Blog

++i 와 i = i + 1 의 비교

++i 와 i = i + 1의 결과는 같지만 실제로 연산이 수행되는 과정은 다르다. ++i가 더 적은 명령만으로 작업을 수행하기 때문에 더 빠르다. * 바이트 코드 비교 수식 i = i + 1 ++i 컴파일된 코드 istore_1 iload_1 iconst_1 iadd istore_1 istore_1 iinc 1 1 위의 표는 컴파일 했을 때 새엉되는 클래스 파일(*.class)의 바이트코드 명령어를 비교한 것이다. i = i + 1은 5개의 명령으로, ++i는 2개의 명령으로 이루어져 있다.

Naver Blog

java class 내에서 this와 this()의 차이

1. this - 인스턴스 자신을 가리키는 참조변수, 인스턴스의 주소가 저장되어 있다. - 모든 인스턴스메서드에 지역변수로 숨겨진 채로 존재한다. 2. this(), this(매개변수) - 생성자, 같은 클래스의 다른 생성자를 호출할 때 사용한다. - 반드시 첫 줄에서만 호출이 가능하다.

Naver Blog

클래스메서드(static method)와 인스턴스 메서드

1. 클래스를 설계할때, 멤버변수 중 모든 인스턴스에 공통적으로 사용해야 하는 것에 static을 붙인다. - 생성된 각 인스턴스는 서로 독립적이기 때문에 각 인스턴스의 변수는 서로 다른 값을 유지한다. 그러나 모든 인스턴스에서 같은 값이 유지되어야 하는 변수는 static을 붙여서 클래스 변수로 정의해야 한다. 2. 클래스변수(static)는 인스턴스를 생성하지 않아도 사용 할 수 있다. - static이 붙은 변수(클래스 변수)는 클래스가 메모리에 올라갈 때 이미 자동적으로 생성되기 때문이다. 3. 클래스메서드는 인스턴스 변수를 사용할 수 없다. - 인스턴스변수는 인스턴스가 반드시 존재해야만 사용할 수 있는데, 클래스 메서드는 인스턴스 생성 없이 호출 가능하기 때문에 클래스 메서드가 호출 되었을 때 인스턴스가 존재할 수도 있고 없을 수도 있다. 그래서 클랫메서드에서 인스턴스변수의 사용을 금지한다. 4. 메서드 내에서 인스턴스변수를 사용하지 않는다면, static을 붙이는 것을 고

Naver Blog

jquery attr과 prop 차이점 (attr vs prop)

1. 개요 - jQuery 1.6/1.6.1에서 .attr()와 .prop()로 나눔 ( checkbox에 버그가 존재해서 ) * 공식 API 문서 ( http://api.jquery.com/prop/ ) The difference between attributes and properties can be important in specific situations. Before jQuery 1.6, the .attr() method sometimes took property values into account when retrieving some attributes, which could cause inconsistent behavior. As of jQuery 1.6, the .prop() method provides a way to explicitly retrieve property values, while .attr() retrieves attributes. 2. .attr(),

Naver Blog

javascript - insert item into array at a specific index (원하는 위치에 값 추가)

var arr = []; arr[0] = "a"; arr[1] = "b"; arr[2] = "c"; arr[3] = "d"; arr.splice(2,0, "ee"); - splice의 2번째 인자는 삭제할 아이템의 갯수인데 0이므로 특정 위치에 값 추가의 효과를 볼 수 있다. * splice Document http://www.w3schools.com/jsref/jsref_splice.asp

Naver Blog

정규분포 [正規分布, normal distribution] jquery chart

jstat chart 주소 : www.jstat.org License : MIT

Naver Blog

postgresql에서 insert하고 id 리턴받기

INSERT INTO Table1 (name) VALUES ('a_title') RETURNING id 위와 같이 RETURNING을 붙여준다. 출처 : http://stackoverflow.com/questions/6560447/can-i-use-return-value-of-insert-returning-in-another-insert

Naver Blog

mybatis insert return [serial]

1 2 3 <insert id="insert" useGeneratedKeys="true" keyProperty="survey_id" keyColumn="survey_id"> insert문 </insert> Colored by Color Scripter cs keyProperty는 map의 survey_id라는 이름의 변수 (혹은 키)에 값을 넣겠다는 의미이고 keyColumn은 db의 어떤 column에서 값을 가져올지 정하는 값이다. keyColumn을 생략하면 default로 가장 앞의 key를 가져오는데 만약 pk가 여러개의 column이 묶여 있을 경우 문제가 될 수 있다. 위와 같이 설정 할 경우 map에 survey_id라는 key의 value를 사용 할 수 있다.

Naver Blog

jquery live method 삭제(remove)

live()가 jquery 1.9에서 삭제되었음. 따라서 아래와 같이 사용 요망 1 2 3 $(document).on('keydown', 'input[name=basis_from], input[name=basis_to]', function(e) { alert('dddd'); }); Colored by Color Scripter cs 첫번째 인자 : 이벤트 두번째 인자 : 이벤트를 bind할 객체 (쉼표로 여러개를 한번에 등록 가능)

Naver Blog

internet explorer autocomplete off

google chrome에서는 form 태그에 autocomplete="off"라는 옵션을 주면 비밀번호를 저장하지 않게 할 수 있다. Internet Explorer(IE)에서는 11버전부터 이 기능을 지원하지 않는다. 근거 자료 : microsoft MSDN - http://msdn.microsoft.com/en-us/library/ie/ms533486(v=vs.85).aspx 위 문서를 해석하면 11버전에서는 지원하지 않습니다. 만약 autocomplete가 활성화 되어 있다면 각 필드마다 추천 값들이 제시될 것입니다. 추천값들은 name변수나 vcard_name변수에 따른 vCard schema에 의거해 정해집니다 만약 autocomplete가 비활성화 되어 있다면 저장되지 않고 물어보지도 않습니다. password 문법의 값들은 autocomplete로 채워질수 있습니다; 하지만 이 정보를 저장할수 있는 기능이 브라우저 내에서 비활성화 되어있을수도 있고, autocomple

Naver Blog

spring MultiActionController를 통한 파일 업로드 by Excel

1. HTML <form id="multiForm" name="multiForm" method="post" action="/target/multiInsertAction.do" enctype="multipart/form-data"> <input type="file" id="file" name="file"/> <button type="submit" class="cm_btn_01"><span>등록</span></button> </form> 2. FileUploadBean public class FileUploadBean { private MultipartFile file; public MultipartFile getFile() { return file; } public void setFile(MultipartFile file) { this.file = file; } } 3. Controller public ModelAndView multiInsertAction(HttpServletRequ

Naver Blog

Java String class의 특징

String 클래스에는 문자열을 저장하기 위해서 문자형 배열 변수(char []) value를 인스턴스 변수로 정의해놓고 있다. 인스턴스 생성 시 생성자의 매개변수로 입력받은 문자열은 이 인스턴스 변수에 문자형 배열로 저장되는 것이다. 한번 생성된 String 인스턴스가 갖고 있는 문자열은 읽어 올 수만 있고, 변경할 수는 없다. 예를 들어 아래의 코드와 같이 '+' 연산자를 이용해서 문자열을 결합하는 경우 인스턴스 내의 문자열이 바뀌는 것이 아니라 새로운 문자열이 담긴 String 인스턴스가 생성되는 것이다. String a = "a"; String b = "b"; String a += b; 이처럼 덧셈연산자(+)를 사용해서 문자열을 결합하는 것은 매 연산 시 마다 새로운 문자열을 가진 String 인스턴스가 생성되어 메모리 공간을 차지하게 되기 때문에 가능한 결합횟수를 줄이는 것이 좋다. 문자열간의 결합이나 추출 등 문자열을 다루는 작업이 많이 필요한 경우에는 String 클래스

Naver Blog

HTML 객체의 넓이보다 text의 길이가 길어졌을 경우 ... 처리 방법

.ellipsis{ white-space:nowrap; text-overflow:ellipsis; /* IE, Safari */ -o-text-overflow:ellipsis; overflow:hidden; -moz-binding: url('ellipsis.xml#ellipsis'); }

Naver Blog

[공유] 브라우저와 기술에 대하여 한눈에 볼 수 있는 사이트

출처 ONE WAY, JESUS! [agapeuni]|프로그래머 THE EVOLUTION OF THE WEB : Browser & Technologies [출처] http://www.evolutionoftheweb.com/?hl=en#/evolution/day ONE WAY, JESUS! [agapeuni] - 2014년 01월 14일 다른 블로그 및 홈페이지에 게재할 경우에는 출처를 밝혀 주세요. *^^* 스크랩된 글은 재스크랩이 불가능합니다.

Naver Blog

mybatis sql transaction 처리 (sqlSession, sqlSessionManager)

mybatis의 sqlSession은 현재 session이 close되어 있는지 확인 할 방법이 없을 뿐더러 다시 open을 할 방법도 없는 것 같다. 그래서 sqlSessionManager를 사용.... private final String resource="mybatis/mybatisConfig.xml"; // sessionManager 생성 SqlSessionFactory factory; SqlSessionManager manager; factory = new SqlSessionFactoryBuilder().build(Resources.getResourceAsReader(resource)); manager = SqlSessionManager.newInstance(factory); // 연결되어 있는 상태인가 확인하여 연결되어 있지 않으면 다시 연결 // 괄호 안의 true는 autoCommit 여부 if(false == managerisManagedSessionStarted()

Naver Blog

CentOS - MySQL install

1. SQL server 설치 yum install mysql-server 2. server start service mysqld start 3. 부팅 시 mysql 실행시키도록 설정 chkconfig mysqld on 4. password 변경 (선택) (초기에는 root 비밀번호가 존재하지 않음) - mysql -u root - use mysql; - update user set password=password('변경할 비밀번호') where user = 'root'; - flush privileges; - exit - service mysqld restart 5. anonymous 유저 삭제 - mysql -u root -p - delete from mysql.user where user='';

Naver Blog

mysql user 생성

1. create ex) ryu / ssf4 mysql> create user 'ryu'@'localhost' identified by 'ssf4'; 2. ryu 유저에게 abc 데이터베이스를 로컬에서만 접속할 수 있게 권한 부여 mysql> GRANT ALL PRIVILEGES ON abc.* TO 'ryu'@'localhost' WITH GRANT OPTION; 3. ryu 유저에게 모든 데이터베이스를 로컬에서만 접속할 권한 부여 mysql> GRANT ALL PRIVILEGES ON *.* TO 'ryu'@'localhost' 4. ryu 유저에게 abc 데이터베이스에 원격에서도 접속할 권한 부여 mysql> GRANT ALL PRIVILEGES ON *.* TO '계정'@'%' identified by '비밀번호';

Naver Blog

[spring] itext pdf 문서에 비밀번호 걸기

1. 라이브러리 - itextpdf.jar 2. code 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 public static void main(String[] args) { try { OutputStream file = new FileOutputStream(new File("D:\\Test.pdf")); Document document = new Document(); PdfWriter writer = PdfWriter.getInstance(document, file); writer.setEncryption("hello".getBytes(), "hello123".getBytes(), PdfWriter.ALLOW_PRINTING, PdfWriter.ENCRYPTION_AES_128); document.open(); document.add(new Paragraph("Hello World, iText")); document.add(new

Naver Blog

spring @transactional

ServiceImpl에 @Transactional(propagation = Propagation.REQUIRED, rollbackFor={Exception.class})

Naver Blog

java로 exe 파일 읽어서 특정 문자열을 바꾸어 저장하기

1. String 이용 public static void main(String[] args) throws Exception { Path newP = Paths.get("d:/result.exe"); String content = binaryFileToHexString("d:/attach.exe"); System.out.println(content.indexOf("{exec}")); String result = content.substring(0, content.indexOf("7B657865637D")) + "7777772E6E617665722E636F6D" + content.substring(content.indexOf("7B657865637D") + "7777772E6E617665722E636F6D".length()); Files.write(newP, hexStringToByteArray(result)); } public static String binaryFileToHexStr

Naver Blog

operating system in java. [JAVA에서 OS이름 구하기]

System.getProperty("os.name");

Naver Blog

엑셀에서 셀에 email 주소만 입력 가능하게 하는 방법

[데이터 - 데이터 유효성 검사 - 설정 - 제한대상 - 사용자 지정] 선택 후 아래와 같이 수식 입력 * E3은 셀 번호 =AND(FIND(".",E3),FIND("@",E3))

Naver Blog

자바(java) sendmail 파일명 한글 깨짐

자바의 sendmail을 사용하여 첨부파일을 보내면 수신자의 메일에서 파일명이 개지는 현상 해결방법 setAttachFileName(파일명) 도는 setFileName(파일명)에서 "파일명" 을 아래와 같이 변경 MimeUtility.encodeText("파일명", "EUC-KR", "B"));

Naver Blog

postgresql에서 idle 강제 kill

SELECT pg_terminate_backend(pid) FROM pg_stat_activity WHERE datname = 'mes_sys' AND pid <> pg_backend_pid() AND state = 'idle' AND state_change < current_timestamp - INTERVAL '5' MINUTE; 여기에서 datname을 각 프로젝트에 맞게 변경하면 된다.

Naver Blog

javascript unit test - qunit

javascript unit test라고 구글에 검색하면 많은 테스트 모듈이 나온다. node.js를 사용해서 테스트 하는 것들이 있는데 너무 어려워서 못써먹겠고.... 그것을 제외하고 가장 사용하기 쉬운 것을 기록한다. http://qunitjs.com/ 1. html <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>QUnit Example</title> <link rel="stylesheet" href="qunit.css"> </head> <body> <div id="qunit"></div> <div id="qunit-fixture"></div> <script src="qunit.js"></script> <script src="tests.js"></script> </body> </html> 2. script test( "hello test", function() { ok( 1 == "1", "Passed!" ); });

Naver Blog

HashMap, HashTable, LinkedHashMap, ConcurrentHashMap

1. HashMap vs HashTable 비동기화 vs 동기화 비동기화가 성능이 좋고, 동기화는 성능이 안좋다. 비동기는 Multi Thread환경에서 사용하면 안된다. 여러개의 thread가 동시에 HashMap을 건드려서 key, value를 넣게 되면 문제가 발생할 수 있다. 2. Hashap, HashTable vs LinkedHashMap Data 추출 시 저장된 순서에 상관없이 랜덤 추출 vs Data 추출 시 저장된 순서대로 추출 LinkedHashMap의 경우 3번째 인자값을 true로 설정 해줌으로써 저장순서 대신 접근 순서에 대한 기록을 유지한다. 3. ConcurrentHashMap 동기화를 제공하는 Map Interface HashTable보다 성능이 좋다.

Naver Blog

[PHP] eval 함수의 위험성

출처 : http://habony.tistory.com/265#.U3Hc7vl_vUp mixed eval ( string $code_str ) (PHP 4, PHP 5) 이 함수는 php코드를 평가하기 위해 사용됩니다. 예를 들면, 다음의 결과로 이해할 수 있을 것입니다. 예제(ex #1 <?php $string = 'cup'; $name = 'coffee'; $str = 'This is a $string with my $name in it.'; echo $str. "\n"; eval("\$str = \"$str\";"); echo $str. "\n"; /* 결과: This is a $string with my $name in it. This is a cup with my coffee in it. */ ?> 작은 따옴표에 의한 값은 보통 일반 텍스트 문자로 처리되지만, eval 함수를 사용하게 되면 php 코드로 해석, 실행해 버립니다. 그래서 간혹 개발자는 편의상 디비에 저장해 두

Naver Blog

javascript: variable as array key (변수를 배열의 키로 사용)

var elements = {}; var key = 'bond'; var v = 'network gear'; elements[key] = v;

Naver Blog

php json_encode/json_decode mixed object and array output

{"data":[]} 를 script로 보내면 array이기 때문에 key : value 의 형태로 값을 넣을 수 없다. 또한 {"data":{}}로 되어 있더라도 json_decode를 하면 []로 변경된다. json_encode(변수, JSON_FORCE_OBJECT) 를 하게 되면 무조건 {} 로 변경되기 때문에 문제가 발생할 수 있다. (array를 사용해야 할 경우) if(count(변수) == 0) { 변수 = new stdClass(); } 와 같이 처리할 수 있다.

Naver Blog

php code 체크 모듈

http://phpmd.org/documentation/index.html 112번에서 실행하면 됨

Naver Blog

javascript 실행 시간 측정

var from = new Date().getTime(); // 단위 ms // 처리 로직 var to = new Date().getTime(); alert(to - from);

Naver Blog

javascript] json isEmpty (빈 오브젝트인지 검사 empty object)

var json_object = {} var json_array = [] json_array의 경우는 비어있는지 체크할 때 json_array.length 가 0인지 체크하면 되지만 json_object의 경우는 length를 사용하면 제대로 된 결과를 얻을 수 없다. 이 경우 jquery에서 제공해 주는 isEmptyObject()를 사용하면 된다. 출처 : http://api.jquery.com/jQuery.isEmptyObject/ 1. 리턴 값 비어있는 object이면 true를 리턴 2. 사용법 2.1. if(jQuery.isEmptyObject(json_object)) { // 비어 있을 경우 } 2.2. if(true === jQuery.isEmptyIObject(json_object)) { // 비어 있을 경우 }

Naver Blog

javascript] jquery를 이용하여 tag의 첫번째 자리 (index 0)에 객체 추가하기

before <div class="container"> <div class="inner">Hello</div> <div class="inner">Goodbye</div> </div> ----------------------------------- prepend 사용 $(".container").prepend('<div class="inner">Hi</div>'); ----------------------------------- after <div class="container"> <div class="inner">Hi</div> <div class="inner">Hello</div> <div class="inner">Goodbye</div> </div>

Naver Blog

php에서 json형태로 데이터 넣기

$enable = '1'; $count = 10000; 1. for($display_cnt = 0; $display_cnt < $count; $display_cnt ++) { $result['list'][$display_cnt]['enable'] = $enable; $result['list'][$display_cnt]['id'] = $enable; $result['list'][$display_cnt]['users'] = $enable; $result['list'][$display_cnt]['srcs'] = $enable; $result['list'][$display_cnt]['src_eth'] = $enable; $result['list'][$display_cnt]['dsts'] = $enable; $result['list'][$display_cnt]['dst_eth'] = $enable; $result['list'][$display_cnt]['services'] = $enable;

Naver Blog

[공유] 무조건 알아야 할 PHP 속도 테스트 20가지

출처 시점의 변화|피레님 스크랩된 글은 재스크랩이 불가능합니다.

Naver Blog

javascript - Using jQuery to compare two arrays

두개의 array를 비교하여 같은 array인지 알고 싶을 경우 $(arr1).not(arr2).length == 0 를 사용한다. 두개의 array가 같다면 $(arr1).not(arr2).length는 0이다. http://api.jquery.com/:not/#not-elements 위의 주소로 가보면 온갖걸 다 쓸 수 있다.

Naver Blog

svn commit 시도 시 SVN: Working Copy ~~~ locked가 걸렸을 때

1. clean up을 해본다. 2. lock 파일 삭제 - 파일 옵션에서 숨김파일 표시로 변경 - svn 폴더로 들어가서 lock 파일 삭제

Naver Blog

javascript array sort

javascript에 기본적으로 array sort 함수를 지원한다. var arr = [40, 1, 10, 5, 25]; 1. arr.sort(); - 이와 같이 쓸 경우 1, 10, 25, 40 과 같이 문자로 취급하여 정렬한다. 2. arr.sort(function(a, b){return a-b}); - 1, 5, 10, 25, 40 과 같이 정렬 3. arr.sort(function(a, b){return b-a}); - 40, 25, 10, 5, 1 과 같이 정렬

Naver Blog

php, html, javascript, css 코드 검사

PHP Storm을 사용하면 코드 검사를 할 수 있다. 1. 코드 검사 Code - Inspect Code - Whole project - OK 2. 경고/오류 로 구분하여 보기 inspection 결과 화면에서 오른쪽 맨 위 첫번째 버튼 클릭 3. filter 사용 (볼 필요 없는 것 선택) inspection 결과 화면에서 오른쪽 아래에서 3번째 버튼 (연장 버튼) 클릭

Naver Blog

html - xmp 내부에서 ... 찍기

text-overflow: ellipsis; white-space: pre; overflow: hidden; word-wrap: normal; display: block;

Naver Blog

크로스 도메인 처리

도메인이 다른 곳으로 ajax를 보내면 console창에서 오류 메시지가 뜨고 심지어 IE에서는 아예 차단을 시켜 버린다. jsonp로 처리하면 문제 없음 $.ajax({ url: 'http://127.0.0.1:8090/STAY_OUT?server=' + get_server(), dataType : 'jsonp', jsonp : 'callback', timeout: 200, async: false, success: function(data) { }, error: function() { } });

Naver Blog

get current URL with javascript

자바스크립트에서 현재 접속한 페이지의 주소 얻기 document.URL

Naver Blog

javascript jquery] html dom element redraw

$('#parentOfElementToBeRedrawn').hide().show(0);

Naver Blog

text 선택 방지

-webkit-touch-callout: none; -webkit-user-select: none; -khtml-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none;

Naver Blog

ASP] Call

Call 키워드가 있어도 함수를 호출하고 없어도 호출하는데 Call 키워드가 있을 경우 - Call 함수명(파라미터1, 파라미터2, ...) Call 키워드가 없을 경우 - 함수명 파라미터1,파라미터2 * 함수명과 파라미터1 사이에 공백

Naver Blog

convert string to jsonobject

string을 json으로 변경해서 써야할 때. import net.sf.json.JSONObject; JSONObject temp = JSONObject.fromObject("{'a':'b'}");

Naver Blog

convert object to jsonobject (오브젝트를 JSON 형식으로 변환)

Map<String, Object> map = new HashMap<String, Object>(); map.put("PARTNER_NO" , "0002485000" ); map.put("RSRVCH_DIV" , "91" ); map.put("RSRV_NO" , BARCODE ); map.put("RSRV_STAT" , "2" ); 1. JSONSerializer.toJSON(map); // net.sf.json.JSONSerializer 2. JSONObject.fromObject(map); // net.sf.json.JSONObject

Naver Blog

java에서 원하는 character set으로 파일 읽고 쓰기

1. 읽기 BufferedReader instrm = new BufferedReader(new InputStreamReader(new FileInputStream(new File(getFilename())), "ms949")); while((tmpstr = instrm.readLine()) != null ) { } 2. 쓰기 OutputStreamWriter osw = new OutputStreamWriter(new FileOutputStream(new File(filepath), true), "ms949"); br = new BufferedWriter(osw); br.write(value);

Naver Blog

sencha - html tag안에 객체 추가하기

1. script <script type="text/javascript"> Ext.define('MyApp.store.MyTreeStore', { extend: 'Ext.data.TreeStore', requires: [ 'Ext.data.proxy.Ajax', 'Ext.data.reader.Json' ], constructor: function(cfg) { var me = this; cfg = cfg || {}; me.callParent([Ext.apply({ storeId: 'MyTreeStore', root:{ text:'root', expanded:true }, proxy: { type: 'ajax', url: '/backoffice/buy/menuTreeList.ajax', reader: { type: 'json' } } }, cfg)]); } }); Ext.define('MyApp.view.MyTreePanel', { extend: 'Ext.tree.Panel', requ

Naver Blog

sencha grid column replace

{ xtype:'gridcolumn', itemId: 'id', width: 90, align: 'center', dataIndex: 'id', text : '바로가기', renderer: function(value, meta, record, rowIndex, colIndex, store, view){ return Math.round(value/1000) + "Kb"; } }, renderer를 이용하여 replace http://docs.sencha.com/extjs/4.2.2/#!/api/Ext.grid.column.Column 참조

Naver Blog

sencha - actioncolumn

{ xtype: 'actioncolumn', handler: function(view, rowIndex, colIndex, item, e, record, row) { onclickWebPosManagementDetailPopup(rowIndex); }, width: 85, align: 'center', text: '바로가기', dataIndex: 'activeDetailButton', icon: '../resources/img/btn_view.png', iconCls: 'iconStyle1' }, actioncolumn을 사용하면 column에 버튼이 생기는데 handler를 이용하여 버튼이 눌렸을 때 동작을 지정할 수 있음

Naver Blog

ER-WIN 논리/물리 순서 정렬

1. 물리에서 아무 테이블이나 선택 2. 마우스 우클릭해서 columns 선택 3. reset 버튼 클릭 4. reset order 클릭 5. 2개의 라디오 버튼 중에 아래 버튼 클릭 (위는 해당 테이블만 정렬, 아래는 전체 테이블 정렬)

Naver Blog

javascript 원시타입 - Infinity

자바스크립트에서는 최대 숫자를 벗어나는 숫자를 표현하기 위해 Infinity라고 하는 값이 정의되어 있다. 실제로 Infinity의 타입은 “number”로 나온다. 자바스크립트에서 지원하는 최소값을 벗어나는 문자를 표현하고 싶다면 –Infinity를 사용하면 된다.

Naver Blog

javascript undefined

var v = 1; 에서 v는 undefined로 정의 되고 코드를 실행하는 단계에서 다시 1로 초기화 된다. if문에서 undefined가 false로 변환된다.

Naver Blog

javascript arguments.callee

callee 속성은 현재 실행되고 있는 함수(함수 객체)를 나타낸다. 마치 생성자 안에서 사용되는 this와도 유사한 개념이다. arguments.callee 속성을 이용하면 익명함수(unnamed function)가 자신을 참조할 수도 있고 재귀 호출도 쉽게 구현할 수 있다. function makeFactorialFunc() { return function(x) { if(x <= 1) { return 1; } return x * arguments.callee(x - 1); } }

Naver Blog

erwin - export query

Physical로 변경 - Forward Engineer - Schema Generation - Preview

Naver Blog

MariaDB 백업

mysqldump -u root -p DB_name > BACKUP_NAME.sql 윈도우 버전의 경우 설치 경로의 bin 디렉토리까지 이동하여 실행시켜야 한다.

Naver Blog

mariaDB 1418 오류

1. 에러 메시지 /* SQL 오류 (1418): This function has none of DETERMINISTIC, NO SQL, or READS SQL DATA in its declaration and binary logging is enabled (you *might* want to use the less safe log_bin_trust_function_creators variable) */ 2. 처리방법 - DB에 접속해서 아래 변수의 값을 확인한다. - show global variables like 'log_bin_trust_function_creators' - value 값이 off가 나온다면 my.conf에 다름과 같이 설정하고 서버를 재시작한다. - log_bin_trust_function_creators = 1 - 만약 my.conf 안에 /etc/my.cnf.d 라는 경로가 있다면 해당 경로로 간다. - server.cnf안에 설정을 입력한다. - serv

Naver Blog

mySQL is integer (숫자만 찾기)

select field from table where field REGEXP '^-?[0-9]+$';

Naver Blog

sencha grid - auto column size 하는 방법

1. viewConfig에 forceFit: true 추가 2. size를 변경했으면 하는 column에 flex: true 추가 3. 한 컬럼만 변경되었으면 할 경우에는 한군데만 쓰고 여러군데가 바뀌게 하고 싶으면 여러군데다가 사용하면 됩니다. 4. Scroll이 필요한 경우에는 알아서 스크롤 영역을 확보하고 scroll이 필요가 없을 경우에는 스크롤 영역이 사라집니다.

Naver Blog

sencha tab에서 초기에 모든 탭 자동 로딩하기 (all tabs auto loading)

deferredRender:false

Naver Blog

datefield (datepicker) 자동으로 펼치게 하기

Ext.getCmp('sellPeriod1').onTriggerClick();

Naver Blog

sencha grid 데이터 변경

function changeStat(rowIndex, value) { var models = Ext.getCmp("gridList").getStore().getRange(); if(value === P_BARCD_STAT_NOT_USE) { models[rowIndex].set('BARCD_STAT',P_BARCD_STAT_USE); } else { models[rowIndex].set('BARCD_STAT',P_BARCD_STAT_NOT_USE); } } 위와 같이 rowIndex + column명으로 변경한다. 단, column에서 renderer를 사용할 경우 setting과 동시에 renderer가 view data로 바꿔버리니 주의 할 것

Naver Blog

javascript (jquery) 특정 textbox 또는 textarea에서 현재 커서 위치 가져오기

(function ($, undefined) { $.fn.getCursorPosition = function() { var el = $(this).get(0); var pos = 0; if('selectionStart' in el) { pos = el.selectionStart; } else if('selection' in document) { el.focus(); var Sel = document.selection.createRange(); var SelLength = document.selection.createRange().text.length; Sel.moveStart('character', -el.value.length); pos = Sel.text.length - SelLength; } return pos; } })(jQuery); $("#myTextBoxSelector").getCursorPosition();

Naver Blog

Convert ArrayList containing Strings to an array of Strings in Java

자바에서 문자열의 배열에 문자열을 포함하는 ArrayList를 반환하는 방법 List<String> list =new ArrayList<String>(); list.add("android"); list.add("apple"); String[] stringArray = list.toArray(new String[list.size()]);

Naver Blog

sencha grid tooltip

1. grid의 listener에 아래와 같이 추가 listeners: { viewready: gridToolTip } 2. 아래와 같은 함수 선언 function gridToolTip(grid) { var view = grid.view; // record the current cellIndex grid.mon(view, { uievent: function (type, view, cell, recordIndex, cellIndex, e) { grid.cellIndex = cellIndex; grid.recordIndex = recordIndex; } }); grid.tip = Ext.create('Ext.tip.ToolTip', { target: view.el, delegate: '.x-grid-cell', trackMouse: true, renderTo: Ext.getBody(), listeners: { beforeshow: function updateTipBody(tip) { i

Naver Blog

javascript - string format ( { 0}  과 같은 형태의 문자열을 replace )

String.prototype.format = String.prototype.f = function() { var s = this, i = arguments.length; while (i--) { s = s.replace(new RegExp('\\{' + i + '\\}', 'gm'), arguments[i]); } return s; }; Usage 'Added {0} by {1} to your collection'.f(title, artist)

Naver Blog

javascript - comment documentation ( 주석을 문서화 )

주석을 문서화 하기 위해서는 아래와 같이 주석을 달아야 한다. ( jsDoc ) /** * Adds two numbers * @param {Number} a * @param {Number} b * @return {Number} sum */ function sum(a,b) { return a + b; }

Naver Blog

JAVA에서 String이 '숫자'로만 이루어져 있는지 체크

출처 : http://stackoverflow.com/questions/1102891/how-to-check-if-a-string-is-a-numeric-type-in-java How to check if a String is a numeric type in Java How would you check if a String was a number before parsing it? stackoverflow.com 1. Exception 사용 public static boolean isNumeric(String str) { try { double d = Double.parseDouble(str); } catch(NumberFormatException nfe) { return false; } return true; } 2. 정규식 사용 public static boolean isNumeric(String str) { return str.matches("-?\\d+(\\.\\d+)?");

Naver Blog

sencha grid - column 색상 변경

renderer: function(value, meta) { if (parseInt(value) > 0) { meta.tdCls = 'red'; return value; } else { meta.tdCls = 'category-not-matching'; return value; } }, 'red'는 class name

Naver Blog

remote 주소를 제대로 가져올 수 없을 때. nginx - ip 설정

WEB 서버 경로 : /usr/local/nginx-1.4.7/ /usr/local/nginx-1.4.7/conf/nginx.conf 파일의 server 부분에 아래의 내용을 추가 server { proxy_set_header Host $http_host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } 프로그램 상에서 아이피를 추출해야 하는경우 request.getHeader("X-Real-IP"); http와 https에 모두 추가 해야 함. nginx start : ./nginx nginx stop : ./nginx -s stop

Naver Blog

Sencha Grid Column Header TEXT 변경 방법

1. Get Sencha Grid Column var columns = Ext.getCmp('gridList').getView().getGridColumns(); 2. Grid column 중에서 변경하고자 하는 ItemId(Grid 에서 이미 선언한) 를 찾아 변경 Ext.each(columns, function (col) { if( col.itemId == itemId ) { col.setText("쿠폰사"); return false; } });

Naver Blog

2015년 2월 3일 오후 3시 12분에 저장한 글입니다.

minValue : 지정한 날 이전은 선택할 수 없다. maxValue : 지정한 날 이후는 선택할 수 없다. 예: Ext.create('Ext.form.field.Date', { xtype: 'datefield', id: 'rcpDate', width: 124, renderTo: 'rcpDate', maskRe: /[0-9.]/, margin: '0 5 0 5', format: 'Y-m-d', value : getTodayDate(), minValue: new Date() });

Naver Blog

sencha에서 row를 클릭하면 radio가 자동으로 선택되게

1. column { xtype: 'gridcolumn', renderer: function(value, metaData, record, rowIndex, colIndex, store, view) { var checked = ''; if(rowIndex === 0){ checked = 'checked'; } return '<input type= "radio" name="radiogroup" '+ checked + '/>'; }, width: 50, align: 'center', dataIndex: 'active', text: '선택' } 2. event listeners : { itemClick : { fn : me.onGridItemClick } } 3. function onGridItemClick : function(dataview, record, item, index, e, eOpts) { $(item).find("input[name=radiogroup]").prop("chec

Naver Blog

select2 destroy or remove

$("id").select2("remove"); $("id").select2("destroy"); 버전에 따라 다르다.

Naver Blog

Firefox ( ff, 파이어폭스 ) - 팝업을 새창으로 띄우지 않고 새 탭으로 띄우기

1. 부가기능인 Tab Mix Plus 설정 기능 사용 - Tab Mix Plus를 설치한 뒤, - Tools -> 부가기능 -> Tab Mix Plus 설정 -> 링크 -> 싱글 윈도우 모드 사용 2. 파이어폭스 설정 (about:config) 변경 - 주소창에 about:config 입력 - browser.link.open_newwindow 입력 후 값을 3으로 변경 - browser.link.open_enwwindow.restriction의 값을 0으로 변경 * 만약 창 크기가 변경 될 경우 - 도구 -> 설정 -> 고급 -> 자바스크립트 설정에서 '현재 창을 이동하거나 크기 조절' 옵션을 체크 해제

Naver Blog

PPT 글꼴 일괄 적용 ( 한번에 글꼴(폰트) 바꾸기 )

[홈] 텝에서 오른쪽 끝의 "바꾸기" 선택

Naver Blog

request 넘기지 않고 사용하는 방법

return ((ServletRequestAttributes) RequestContextHolder.currentRequestAttributes()).getRequest().getSession(false).getAttribute(sessionType).toString(); 1. RequestContextHolder Spring MVC에서 어떤곳에서든 request 객체를 얻어오기 위해 사용합니다. 2. RequestContextHolder.currentRequestAttributes() 현재 thread에 바인딩 되어있는 RequestAttributes를 돌려줍니다.

Naver Blog

mysql ( mariadb ) timeout

1. connection 확인 show processlist; 2. 현재 설정된 timeout 확인 show variables like '%timeout%' 3. timeout 변경 cd /etc/my.cnf.d vi server.cnf [mysqld] wait_timeout = 60 interactive_timeout= 60 ( 단위 : 초 ) DB서버를 재기동 시키면 다시 원래대로 돌아 갑니다. 그렇다면 값을 계속 유지 하게 하려면 아래와 같이 설정 파일에 추가를 해주고 재기동을 시키면 됩니다. vi /etc/mysql/conf.d/mariadb.cnf 4. 재시작 /etc/init.d/mysql stop /etc/init.d/mysql start

Naver Blog

slick grid ( render grid ) . scroll paging 처리

1. liststore에 옵션 추가 buffered: true, trailingBufferZone: 5, leadingBufferZone: 5, purgePageCount: 0, scrollToLoadBuffer: 10, 2. gridList에 옵션 추가 plugins: [ Ext.create('Ext.grid.plugin.BufferedRenderer', {}) ], 3. 조회시 아래와 같이 해야 함 var listStore = Ext.data.StoreManager.get("listStore"); listStore.proxy.extraParams = param; listStore.load({ callback : function(records, operation, success) { if( success == true){ $('#listSearchResultTextBegin').text('조회결과 Total '); $('#listSearchResultTextCount').text(

Naver Blog

Excel에서 column의 size ( width ) 를 자동으로 설정

모든 데이터가 들어간 이후에 if(null != model.get("colName")) { List<String> colName = (List<String>) model.get("colName"); for (int i = 0; i < colName.size(); i++) { sheet.autoSizeColumn(i); } } 위의 코드를 추가합니다. 그런데, autoSizeColumn 함수 자체가 정확하게 동작하지 않아서.. 보기 좋게 size를 조절하지 못합니다.

Naver Blog

jQuery UI Sortable Position

$( "#menuListContainer > ul" ).sortable({ start: function(event, ui) { ui.item.startPos = ui.item.index(); } , stop: function(event, ui) { console.log("Start position: " + ui.item.startPos); console.log("New position: " + ui.item.index()); } });

Naver Blog

JSP 에서 model attribute에 설정된 값 받아오기

request.getAttribute("tckKnd")

Naver Blog

firefox ( 파이어폭스 ) inline-block not working

display: -moz-inline-stack;를 같이 사용하면 됨

Naver Blog

mysql name(이름) masking

DELIMITER // CREATE DEFINER=`mcouponbo`@`%` FUNCTION `getMaskName`(`v_code` varchar(10)) RETURNS varchar(50) CHARSET utf8 BEGIN declare return_value varchar(50); SELECT CASE CHAR_LENGTH(v_code) WHEN 0 THEN '' WHEN 1 THEN '*' WHEN 2 THEN CONCAT('*', SUBSTRING(v_code, 2, 1)) ELSE CONCAT(SUBSTRING(v_code, 1, 1), REPEAT('*', CHAR_LENGTH(v_code) - 2), SUBSTRING(v_code, CHAR_LENGTH(v_code), 1)) END INTO return_value; RETURN return_value; END// DELIMITER ;

Naver Blog

mysql 전화번호 masking

DELIMITER // CREATE DEFINER=`mcouponbo`@`%` FUNCTION `getMaskPhone`(`v_code` varchar(50)) RETURNS varchar(50) CHARSET utf8 BEGIN declare return_value varchar(50); SET v_code = replace(v_code, '-', ''); SELECT CASE WHEN CHAR_LENGTH(v_code) < 9 THEN v_code ELSE CASE SUBSTRING(v_code, 1, 2) WHEN '02' THEN CONCAT('02', '-', REPEAT('*', CHAR_LENGTH(v_code) - 6), '-', SUBSTRING(v_code, CHAR_LENGTH(v_code) - 3, CHAR_LENGTH(v_code))) ELSE CONCAT(SUBSTRING(v_code, 1, 3), '-', REPEAT('*', CHAR_LENGTH(v_co

1 2 3 4 5 6 7 8 9 10