2016년 6월 29일 수요일

프로그래머를 위한 에디터 테마 및 폰트

테마 - Dark Wins White

There has been a lot of research on this topic since the 1980s and a lot of it still holds true today. One study from the 1980s states this:
However, most studies have shown that dark characters on a light background are superior to light characters on a dark background (when the refresh rate is fairly high). For example, Bauer and Cavonius (1980) found that participants were 26% more accurate in reading text when they read it with dark characters on a light background.
Reference: Bauer, D., & Cavonius, C., R. (1980). Improving the legibility of visual display units through contrast reversal. In E. Grandjean, E. Vigliani (Eds.), Ergonomic Aspects of Visual Display Terminals (pp. 137-142). London: Taylor & Francis
The reason why this matters is because of focus. As this article on UXMovement states, "white stimulates all three types of color sensitive visual receptors in the human eye in nearly equal amounts." It causes the eye to focus by tightening the iris. Since the eye is focused, dark letter forms on light backgrounds are easier to read. When using a dark background with strong light letter forms, the iris opens to allow more light in, but that causes letter forms to blur. Why?
People with astigmatism (approximately 50% of the population) find it harder to read white text on black than black text on white. Part of this has to do with light levels: with a bright display (white background) the iris closes a bit more, decreasing the effect of the "deformed" lens; with a dark display (black background) the iris opens to receive more light and the deformation of the lens creates a much fuzzier focus at the eye.
Jason Harrison – Post Doctoral Fellow, Imager Lab Manager – Sensory Perception and Interaction Research Group, University of British Columbia
Now there seem to be varying factors into contrast and legibility. Room ambient lighting. Brightness of the monitor. Also you can mitigate the straining effects of white (#FFF) on black (#000) by simply lessening the contrast like using a light gray (#EEE, #DDD, #CCC) on a dark background (#111, #222).

ref from sof http://ux.stackexchange.com/questions/53264/dark-or-white-color-theme-is-better-for-the-eyes

폰트 - Courier New

Courier New

http://quoteunquoteapps.com/courierprime/

2016년 6월 20일 월요일

좋은 펀드 고르기

펀드는 유형이 다양 하고, 같은 유형 안에서도 수많은 상품이 존재 한다.

때문에 수익률만 따질게 아니라 , BenchMark 를 따져야 한다.

기준가격(기준가)

특정 시점의 집합투자증권(펀드)의 일정단위(보통 1,000좌)당 순자산가액을 의미하며, [펀드의 순자산가액 /잔존 총좌수*1000]의 식으로 계산한다. 거래단위(보통 1,000좌)당 분배가능금액의 의미를 가지며, 집합투자증권의 운용회사가 일별로 산출하여 공시한다. 운용사의 홈페이지 또는 금융투자협회 공시시스템을 통해 확인할 수 있다.

수익률

(환매시 기준가/가입시기준가-1)X100

BM (BenchMark) 


펀드가 세운 자산 운용 목표를 나타내는 것으로, 펀드 운용성과를 측정하는 기준이 된다.

벤치마크 기준

  • 주식형 펀드 : KOSPI200 지수 ,
  • MMF : 콜금리나 양도성 예금증서 금리
  • 채권형 펀드 : 3년만기 국고채, 1년만기 통화안정 채권의 금리


KOSPI200 지수 를 BM 으로 하는 주식형 펀드가 일정기간동안,
KOSPI200 지수가 10% 상승 했는데, 펀드가 15% 수익을 올렸다고 하면,
이 펀드는 우수한 펀드라고 할 수 있다.

수익률과 BM 수익률이 둘 다 좋은지 살펴보고, 3개월 6개월 등 짧은 기간이 아닌
1년 이상 꾸준히 BM 수익률을 초과 했는지가 중요함

표준편차


수익률의 변동성을 측정한 값,
-- 편차가 클수록 변동성이 심하고 위험
-- 편차가 작으면 안정된 수익률 덜 위험

베타

벤치마킹 지수의 변화에 따른 펀드 수익률의 변화를 측정한 값 , 베타가 1이면 펀드 수익률이 BM 수익률과 똑같이 움직임. 시장이 좋을때는 베타값이 높은 펀드에 투자,
주식 시장이 나쁠때는 베타값이 높은 펀드에 투자.


샤프지수


시장이나 펀드의 가격이 변하는 상황에서 얼마나 많은 수익률을 낼 수 있는지나타내는 값.
샤프 지수 값이 높을 수록 위험대비 수익률이 우수 함.

트레이너지수

펀드의 베타계수 한 단위당 무위험 초과 수익률을 나타내는 지표, 펀드가 얼마나 분산투자를 잘 했는지 판단 하는 지표, 지수가 높을수록 동일한 베타계수에 대하여 수익률이 높음을 나타냄


알파


개별펀드의 실제 수익률이 시장평균을 가정한 수익률에 비해 얼마나 높은지 나타내는 지표.
초과수익을 나타내는 지표로 사용되며, 펀드매니저의 종목 선정능력을 알아보는 지표로 의미 있음. 윟ㅁ대비 운용 성과를 알아내는 지표로 지표값이 클 수록 펀드매니저가 종목선정이나 자산 배분,매매 타이밍 포착 능력이 좋음을 의미함.


출처 : http://www.whitepaper.co.kr/news/articleView.html?idxno=38647

2016년 6월 15일 수요일

java jdbc result json mapper

>code>package com.example;

import java.sql.*;
import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
import com.google.gson.JsonPrimitive;

public class DbMapper {
 
 public static JsonArray select(String sql) throws Exception{
  
  
  Connection dbConnection = CommonConstant.getDbConn();
  
  Statement getFromDb = dbConnection.createStatement();
  ResultSet rs = getFromDb.executeQuery(sql);
  ResultSetMetaData rsmd = rs.getMetaData();
  JsonArray recordsArray = new JsonArray();
  
  int numColumns = rsmd.getColumnCount();
     String[] arrColumnNames = new String[numColumns];
     int[] columnTypes = new int[numColumns];

     for (int i = 0; i < arrColumnNames.length; i++) {
         arrColumnNames[i] = rsmd.getColumnLabel(i + 1);
         columnTypes[i] = rsmd.getColumnType(i + 1);
         /*System.out.print(i + " : ");
         System.out.print(columnNames[i]);
         System.out.print(i + " = ");
         System.out.print(columnTypes[i]);
         System.out.print("\n");
         */
     }
     
     //JsonPrimitive jsonPrimitiveNull = new JsonPrimitive(null);
     long startTime = System.currentTimeMillis();
  while (rs.next()) {
    boolean b;
          long l;
          double d;
          float f;
          String s;
          
   JsonObject currentRecord = new JsonObject();

     for( int i=0; i<arrColumnNames.length; i++) {
      
      
    String column_name = arrColumnNames[i];
    
    //System.out.println();
    //System.out.println("while loop: "+column_name + " : "+ columnTypes[i]);

     switch (columnTypes[i]) {
     case Types.BIT: // tiny int 가 비트로 와서 수정함 
     case Types.TINYINT:
      l = rs.getInt(i + 1);
                  if (rs.wasNull()) {
                      //jgen.writeNull();
                      currentRecord.add(column_name,null);
                  } else {
                      //currentRecord.add(column_name,new JsonPrimitive(l));
                   System.out.println(column_name);
                   System.out.println(l);
                   System.out.println(new JsonPrimitive(l));
                   
                      currentRecord.add(column_name,new JsonPrimitive(l));
                      
                  }
                  break;
              case Types.INTEGER:
              case Types.SMALLINT:
 
                  l = rs.getInt(i + 1);
                  if (rs.wasNull()) {
                      //jgen.writeNull();
                      currentRecord.add(column_name,null);
                  } else {
                      //currentRecord.add(column_name,new JsonPrimitive(l));
                      currentRecord.add(column_name,new JsonPrimitive(l));
                      
                  }
                  break;

              case Types.BIGINT:
                  l = rs.getLong(i + 1);
                  if (rs.wasNull()) {
                      currentRecord.add(column_name,null);
                  } else {
                      currentRecord.add(column_name,new JsonPrimitive(l));
                  }
                  break;

              case Types.DECIMAL:
              case Types.NUMERIC:
                  //jgen.writeNumber(rs.getBigDecimal(i + 1));
               rs.getBigDecimal(i + 1);
               if (rs.wasNull()) {
                currentRecord.add(column_name,null);
               }else{
                currentRecord.add(column_name,new JsonPrimitive(rs.getBigDecimal(i + 1)));
               }
                  
                  break;

              case Types.FLOAT:
              /* f = rs.getFloat(i + 1);
               //System.out.println("=====================================================================");
                  //System.out.println(f);
                  //System.out.println("=====================================================================");
                  if (rs.wasNull()) {
                      currentRecord.add(column_name,null);
                  } else {
                      //jgen.writeNumber(d);
                   currentRecord.add(column_name,new JsonPrimitive(f));
                  }
                  break;*/
              case Types.REAL:
              case Types.DOUBLE:
                  d = rs.getDouble(i + 1);
                  System.out.println(d);
                  if (rs.wasNull()) {
                      currentRecord.add(column_name,null);
                  } else {
                      //jgen.writeNumber(d);
                   currentRecord.add(column_name,new JsonPrimitive(d));
                  }
                  break;

              //case Types.NVARCHAR:
              case Types.VARCHAR:
              //case Types.LONGNVARCHAR:
              case Types.LONGVARCHAR:
                  //jgen.writeString(rs.getString(i + 1));
                  s = rs.getString(i + 1);
                  if (rs.wasNull()) {
                      currentRecord.add(column_name,null);
                  } else {
                      //jgen.writeNumber(d);
                   currentRecord.add(column_name,new JsonPrimitive(s));
                  }           
                  break;

              case Types.BOOLEAN:
              
                  b = rs.getBoolean(i + 1);
                  if (rs.wasNull()) {
                      currentRecord.add(column_name,null);
                  } else {
                      //jgen.writeBoolean(b);
                      currentRecord.add(column_name,new JsonPrimitive(b));
                  }
                  break;

              case Types.BINARY:
              case Types.VARBINARY:
              case Types.LONGVARBINARY:
                  //jgen.writeBinary(rs.getBytes(i + 1));
                  //currentRecord.add(column_name,new JsonPrimitive(""+rs.getBytes(i + 1).toString()));
               //System.out.println(rs.getString(i + 1));
               String str = new String(rs.getBytes(i+1),"UTF-8");
               currentRecord.add(column_name,new JsonPrimitive(str));
               //currentRecord.add(column_name,new JsonPrimitive(""+rs.getString(i + 1)));
                  break;
/*
              case Types.TINYINT:
              case Types.SMALLINT:
                  l = rs.getShort(i + 1);
                  if (rs.wasNull()) {
                      currentRecord.add(column_name,null);
                  } else {
                      currentRecord.add(column_name,new JsonPrimitive(l));
                  }
                  break;
*/
              case Types.DATE:
                  // provider.defaultSerializeDateValue(rs.getDate(i + 1), jgen);
                  Date date = rs.getDate(i + 1);
                  if(rs.wasNull()){
                   currentRecord.add(column_name,null);
                  }else{
                   currentRecord.add(column_name,new JsonPrimitive(rs.getDate(i + 1).toString()));  
                  }
                  
                  break;

              case Types.TIMESTAMP:
                  //provider.defaultSerializeDateValue(rs.getTime(i + 1), jgen);
               Time t1 = rs.getTime(i + 1);
                  if(rs.wasNull()){
                   currentRecord.add(column_name,null);
                  }else{
                   currentRecord.add(column_name,new JsonPrimitive(rs.getTime(i + 1).toString()));    
                  }
                  
                  break;

              case Types.BLOB:
                  //Blob blob = rs.getBlob(i+1);
                  /*Blob blob = rs.getBlob("photo");
                  // materialize BLOB onto client
                  return blob.getBytes(1, (int) blob.length());*/
                  //byte[] b1 = blob.getBytes(i+1, (int) blob.length());
                  //System.out.println(b1.toString());
                  //provider.defaultSerializeValue(blob.getBinaryStream(), jgen);
                  //currentRecord.add(column_name,new JsonPrimitive(b1.toString()));
                  //blob.free();
                  String str1 = new String(rs.getBytes(i+1),"UTF-8");
               currentRecord.add(column_name,new JsonPrimitive(str1));
               
                  break;

              case Types.CLOB:
                  Clob clob = rs.getClob(i+1);
                  //provider.defaultSerializeValue(clob.getCharacterStream(), jgen);
                  currentRecord.add(column_name,new JsonPrimitive(clob.toString()));
                  //clob.free();
                  break;

              case Types.ARRAY:
                  throw new RuntimeException("ResultSetSerializer not yet implemented for SQL type ARRAY");

              case Types.STRUCT:
                  throw new RuntimeException("ResultSetSerializer not yet implemented for SQL type STRUCT");

              case Types.DISTINCT:
                  throw new RuntimeException("ResultSetSerializer not yet implemented for SQL type DISTINCT");

              case Types.REF:
                  throw new RuntimeException("ResultSetSerializer not yet implemented for SQL type REF");

              case Types.JAVA_OBJECT:
              default:
               rs.getObject(i+1);
                  if (rs.wasNull()) {
                   currentRecord.add(column_name,null);
                  }else{
                   currentRecord.add(column_name,new JsonPrimitive(rs.getObject(i + 1).toString()));
                  }
                  //provider.defaultSerializeValue(rs.getObject(i + 1), jgen);
                  
                  break;
              }
     }
     //System.out.println(currentRecord);
     recordsArray.add(currentRecord);
  }
  long stopTime = System.currentTimeMillis();
       long elapsedTime = stopTime - startTime;
       //System.out.println("select switch  :"+elapsedTime);
  return recordsArray;
 }
}

angularjs 게시판 및 페이징

<table class="basicTb noticeTb">
    <thead>
        <tr>
            <th>종류</th>
            <th width="150px">섹터</th>
            <th>제목</th>
            <th>등록자</th>
            <th>등록일</th>
        </tr>
    </thead>
    <tbody id="tb_content">
    <!-- 
        <tr>
            <td class="agC"><span class="bxRed">뉴스</span></td>
            <td><span class="bxA"><em>A</em>자동차</span></td>
            <td>현지 주 정부 재협상 요구... 기아차 멕시코 공장 급제동</td>
            <td class="agC">Peter</td>
            <td class="agC">2016-05-09</td>
        </tr>
        <tr>
            <td class="agC"><span class="bxDblue">공시</span></td>
            <td><span class="bxG"><em>A</em>자동차</span></td>
            <td>현지 주 정부 재협상 요구... 기아차 멕시코 공장 급제동</td>
            <td class="agC">Peter</td>
            <td class="agC">2016-05-09</td>
        </tr>
        <tr>
            <td class="agC"><span class="bxRbrown">리서치</span></td>
            <td><span class="bxA"><em>A</em>자동차</span></td>
            <td>현지 주 정부 재협상 요구... 기아차 멕시코 공장 급제동</td>
            <td class="agC">Peter</td>
            <td class="agC">2016-05-09</td>
        </tr>
        <tr>
            <td class="agC"><span class="bxRed">뉴스</span></td>
            <td><span class="bxA"><em>A</em>자동차</span></td>
            <td>현지 주 정부 재협상 요구... 기아차 멕시코 공장 급제동</td>
            <td class="agC">Peter</td>
            <td class="agC">2016-05-09</td>
        </tr>
        <tr>
            <td class="agC"><span class="bxRed">뉴스</span></td>
            <td><span class="bxA"><em>A</em>자동차</span></td>
            <td>현지 주 정부 재협상 요구... 기아차 멕시코 공장 급제동</td>
            <td class="agC">Peter</td>
            <td class="agC">2016-05-09</td>
        </tr>   
        -->                                                                  
    </tbody>
</table>

<div id="paging">
 <ul>
  <li>1</li>
 </ul>
</div>
(function(angular) {
    angular.module('dgs').controller('nt0101Controller', function($rootScope,$scope,$http,$compile){
     
      var containerHt=$('#container').height();
      var sHeadHt=$('.sHead').height();      
      var conTy2Ht=containerHt -sHeadHt;
      $('.contentsTy2').css('height',conTy2Ht+'px');
      $(window).resize(function(){
       var containerHt=$('#container').height();
          var sHeadHt=$('.sHead').height();      
          var conTy2Ht=containerHt -sHeadHt;
          $('.contentsTy2').css('height',conTy2Ht+'px');       
      });
            
      //분할그리드
      $('#horiSplitter').jqxSplitter({ width: '100%', height: '100%', orientation: 'vertical', panels: [{ size: '550px'}] });
            $( "#datepicker" ).datepicker();     


            
            
            $scope.page = 1;
            $scope.page_per = "all"; //전체는 all , 10,20,30 갯수 적으면 됨
            
            function reqData(){
             // page 
             var url = "service/nt/nt0100.jsp?page="+$scope.page;
          url += "&page_per="+$scope.page_per;
          /*
          url += "&FS_TYP="+$scope.FS_TYP.value; // 
          url += "&OUT_TYP="+$scope.OUT_TYP.value; // OUT_TYP
          url += "&TERM_TYP="+$scope.TERM_TYP;
          url += "&YEAR_TYP="+$scope.YEAR_TYP;
          url += "&IFRS="+$scope.IFRS;
          url += "&CURRENCY="+$scope.CURRENCY;
          */
          console.log(url);
          
          $http.get(url).success(function(data, status, headers, config) {
        console.log(data);
        
        // tb_content
        var html = "";
        
        $(data.result).each(function(index){
         var row = data.result[index]; 
         var firstRow = row.NOTE_CONTENT.indexOf("\n")>-1?row.NOTE_CONTENT.split("\n")[0]:row.NOTE_CONTENT;
         html += "<tr>"
          +"    <td class=\"agC\"><span class=\"bxRed\">"+row.NOTE_CATEGORY+"</span></td>"
          +"    <td><span class=\"bxA\"><em>A</em>"+row.NOTE_SECTOR+"</span></td>"
          +"    <td style=\"word-wrap: break-word; word-break:break-all\">"+firstRow+"</td>"
          +"    <td class=\"agC\">"+row.NOTE_WRITER+"</td>"
          +"    <td class=\"agC\">"+row.NOTE_DATE+"</td>"
          +"</tr>"
        });
        $("#tb_content").html(html);
        
        // 페이징 처리
        var total_record = data.record_info[0].total_record;
        if($scope.page_per == "all"){
         $("#paging").html("");
        }else{
         var paging = getPageNavi($scope.page,$scope.page_per,total_record);
         
         //paging = $compile($(paging).contents())($scope);
         paging = $compile($(paging))($scope);
         console.log(paging);
         
         $("#paging").html(paging);
        }
        
          });
            }
            $scope.goPage=function(page){
             $scope.page = page;
             reqData();
            }
            reqData();
            
            function getPageNavi(page_cur,page_per,total_record){
             var block_page = 10;
             var page = {
                  first : 1,
                  last : null,
                  prev : null,
                  next : null,
                  start : null,
                  end : null,
                  block_prev : null,
                  block_next : null  
                 };
             
             page.last = Math.ceil(parseInt(total_record,10)/parseInt(page_per,10));
             page.prev = page_cur-1>=1? page_cur-1: null;
             page.next = page_cur+1<=page.last? page_cur+1:null;
             // page start
             page.start = (Math.ceil(page_cur / block_page)-1)*block_page+1;
             page.end = page.last <= (page.start+block_page-1)? page.last : page.start+block_page-1; 
             page.block_prev = page.start-1>=1? page.start-1 : null;
             page.block_next = (page.start+block_page)<=page.last? page.start+block_page : null;  
             
             console.log(page);
             
             var rstr = "";
             rstr += "<a href=\"\" ng-click=\"goPage(1)\">[처음]</a>&nbsp;";
             if(page.block_prev){
              rstr += "<a ng-click=\"goPage("+page.block_prev+")\">[이전 "+block_page+" 개]</a>&nbsp;";
             }else{
              rstr += "[이전 "+block_page+" 개]&nbsp;";
             }
             if(page.prev){
              rstr += "<a ng-click=\"goPage("+page.prev+")\">[이전 페이지]</a>&nbsp;";
             }else{
              rstr += "[이전 페이지]&nbsp;";
             }
             
             for(var index=page.start;index<=page.end;index++){
              if(index == $scope.page){
               rstr += "<a ng-click=\"goPage("+index+")\"><b>["+index+"]</b></a>&nbsp;";
              }else{
               rstr += "<a ng-click=\"goPage("+index+")\">["+index+"]</a>&nbsp;";
              }
              
             }
             
             if(page.next){
              rstr += "<a ng-click=\"goPage("+page.next+")\">[다음 페이지]</a>&nbsp;";
             }else{
              rstr += "[다음 페이지]&nbsp;";
             }
             
             if(page.block_next){
              rstr += "<a ng-click=\"goPage("+page.block_next+")\">[다음 "+block_page+" 개]</a>&nbsp;";
             }else{
              rstr += "[다음 "+block_page+" 개]&nbsp;";
             }
             rstr += "<a ng-click=\"goPage("+page.last+")\">[끝]</a>";
             
              
             
             return rstr;
            }

    });
})(angular);

angularjs ui routing 적용

angularjs ui routing 적용

  1. 메뉴 추가 및 컨트롤러 없는 html 적용 # 해시맵 사용
    /src/main/resources/static/index.html
    /src/main/resources/static/home.html
    /src/main/resources/static/company.html
    /src/main/resources/static/js/hello.js
  2. <!doctype html>
    <html>
    <head>
    <title>Hello AngularJS</title>
    <link href="css/angular-bootstrap.css" rel="stylesheet">
    <style type="text/css">
    [ng\:cloak], [ng-cloak], .ng-cloak {
     display: none !important;
    }
    </style>
    </head>
    
    <body ng-app="hello">
     <div class="container">
      <h1>Greeting</h1>
      <div ng-controller="homeController as home" ng-cloak class="ng-cloak">
       <p>The ID is {{home.greeting.id}}</p>
       <p>The content is {{home.greeting.content}}</p>
       <a href="#/home">home</a> |
       <a href="#/company">company</a> <br>
       <div ng-view></div>
      </div>
     </div>
     <script src="js/angular-bootstrap.js" type="text/javascript"></script>
     <script src="js/hello.js"></script>
    </body>
    </html>
    

angularjs ui routing 적용

angularjs ui routing 적용

  1. 메뉴 추가 및 컨트롤러 없는 html 적용 # 해시맵 사용
    /src/main/resources/static/index.html
    /src/main/resources/static/home.html
    /src/main/resources/static/company.html
    /src/main/resources/static/js/hello.js
  2. <!doctype html>
    <html>
    <head>
    <title>Hello AngularJS</title>
    <link href="css/angular-bootstrap.css" rel="stylesheet">
    <style type="text/css">
    [ng\:cloak], [ng-cloak], .ng-cloak {
     display: none !important;
    }
    </style>
    </head>
    
    <body ng-app="hello">
     <div class="container">
      <h1>Greeting</h1>
      <div ng-controller="homeController as home" ng-cloak class="ng-cloak">
       <p>The ID is {{home.greeting.id}}</p>
       <p>The content is {{home.greeting.content}}</p>
       <a href="#/home">home</a> |
       <a href="#/company">company</a> <br>
       <div ng-view></div>
      </div>
     </div>
     <script src="js/angular-bootstrap.js" type="text/javascript"></script>
     <script src="js/hello.js"></script>
    </body>
    </html>
    

maven Angular js 설정

Angular js 시작

hello world using json

  1. /pom.xml webjar 를 통한 angularjs 실행 설정
    <?xml version="1.0" encoding="UTF-8"?>
    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
        <modelVersion>4.0.0</modelVersion>
    
        <groupId>com.dangun</groupId>
        <artifactId>boot</artifactId>
        <version>0.0.1-SNAPSHOT</version>
    
        <packaging>war</packaging>
    
        <parent>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-parent</artifactId>
            <version>1.3.5.RELEASE</version>
        </parent>
        <dependencies>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-web</artifactId>
            </dependency>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-devtools</artifactId>
                <optional>true</optional>
            </dependency>
            <dependency>
                <groupId>com.fasterxml.jackson.dataformat</groupId>
                <artifactId>jackson-dataformat-xml</artifactId>
            </dependency>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter</artifactId>
                <exclusions>
                    <exclusion>
                        <groupId>org.springframework.boot</groupId>
                        <artifactId>spring-boot-starter-logging</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-log4j</artifactId>
            </dependency>
            <dependency>
                <groupId>org.webjars</groupId>
                <artifactId>angularjs</artifactId>
                <version>1.3.8</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>org.webjars</groupId>
                <artifactId>jasmine</artifactId>
                <version>2.0.0</version>
                <scope>test</scope>
            </dependency>
        </dependencies>
    
        <properties>
            <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
            <wro4j.version>1.7.9</wro4j.version>
            <java.version>1.8</java.version>
        </properties>
    
        <!-- Additional lines to be added here... -->
        <build>
            <resources>
                <resource>
                    <directory>${project.basedir}/src/main/resources</directory>
                </resource>
                <resource>
                    <directory>${project.build.directory}/generated-resources</directory>
                </resource>
            </resources>
            <plugins>
                <plugin>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-maven-plugin</artifactId>
                    <configuration>
                        <fork>true</fork>
                    </configuration>
                </plugin>
                <plugin>
                    <artifactId>maven-resources-plugin</artifactId>
                    <executions>
                        <execution>
                            <!-- Serves *only* to filter the wro.xml so it can get an absolute
                                path for the project -->
                            <id>copy-resources</id>
                            <phase>validate</phase>
                            <goals>
                                <goal>copy-resources</goal>
                            </goals>
                            <configuration>
                                <outputDirectory>${basedir}/target/wro</outputDirectory>
                                <resources>
                                    <resource>
                                        <directory>src/main/wro</directory>
                                        <filtering>true</filtering>
                                    </resource>
                                </resources>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>ro.isdc.wro4j</groupId>
                    <artifactId>wro4j-maven-plugin</artifactId>
                    <version>${wro4j.version}</version>
                    <executions>
                        <execution>
                            <phase>generate-resources</phase>
                            <goals>
                                <goal>run</goal>
                            </goals>
                        </execution>
                    </executions>
                    <configuration>
                        <wroManagerFactory>ro.isdc.wro.maven.plugin.manager.factory.ConfigurableWroManagerFactory</wroManagerFactory>
                        <cssDestinationFolder>${project.build.directory}/generated-resources/static/css</cssDestinationFolder>
                        <jsDestinationFolder>${project.build.directory}/generated-resources/static/js</jsDestinationFolder>
                        <wroFile>${project.build.directory}/wro/wro.xml</wroFile>
                        <extraConfigFile>${basedir}/src/main/wro/wro.properties</extraConfigFile>
                        <contextFolder>${basedir}/src/main/wro</contextFolder>
                    </configuration>
                    <dependencies>
                        <dependency>
                            <groupId>org.webjars</groupId>
                            <artifactId>jquery</artifactId>
                            <version>2.1.1</version>
                        </dependency>
                        <dependency>
                            <groupId>org.webjars</groupId>
                            <artifactId>angularjs</artifactId>
                            <version>1.3.8</version>
                        </dependency>
                        <dependency>
                            <groupId>org.webjars</groupId>
                            <artifactId>bootstrap</artifactId>
                            <version>3.2.0</version>
                        </dependency>
                    </dependencies>
                </plugin>
                <plugin>
                    <groupId>com.github.searls</groupId>
                    <artifactId>jasmine-maven-plugin</artifactId>
                    <version>2.0</version>
                    <executions>
                        <execution>
                            <goals>
                                <goal>test</goal>
                            </goals>
                        </execution>
                    </executions>
                    <configuration>
                        <additionalContexts>
                            <context>
                                <contextRoot>/lib</contextRoot>
                                <directory>${project.build.directory}/generated-resources/static/js</directory>
                            </context>
                        </additionalContexts>
                        <preloadSources>
                            <source>/lib/angular-bootstrap.js</source>
                            <source>/webjars/angularjs/1.3.8/angular-mocks.js</source>
                        </preloadSources>
                        <jsSrcDir>${project.basedir}/src/main/resources/static/js</jsSrcDir>
                        <jsTestSrcDir>${project.basedir}/src/test/resources/static/js</jsTestSrcDir>
                        <webDriverClassName>org.openqa.selenium.phantomjs.PhantomJSDriver</webDriverClassName>
                    </configuration>
                    <dependencies>
                        <dependency>
                            <groupId>org.webjars</groupId>
                            <artifactId>angularjs</artifactId>
                            <version>1.3.8</version>
                        </dependency>
                    </dependencies>
                </plugin>
            </plugins>
        </build>
    
    </project>
  2. src/main/resources/static/index.html 생성
    
    <!doctype html>
    <html>
    <head>
    <title>Hello AngularJS</title>
    <link href="css/angular-bootstrap.css" rel="stylesheet">
    <style type="text/css">
    [ng\:cloak], [ng-cloak], .ng-cloak {
      display: none !important;
    }
    </style>
    </head>
    
    <body ng-app="hello">
      <div class="container">
        <h1>Greeting</h1>
        <div ng-controller="home" ng-cloak class="ng-cloak">
          <p>The ID is {{greeting.id}}</p>
          <p>The content is {{greeting.content}}</p>
        </div>
      </div>
      <script src="js/angular-bootstrap.js" type="text/javascript"></script>
      <script src="js/hello.js"></script>
    </body>
    </html>
       
       
  3. /src/main/resources/static/js/hello.js
    angular.module('hello', []).controller('home', function($http) {
     var self = this;
     $http.get('resource/').then(function(response) {
      self.greeting = response.data;
     })
    });
    
  4. mvn spring-boot:run
    mvn spring-boot:run
  5. 브라우저 확인 : http://localhost:8080

메이븐 웹 프로젝트 tomcat 배포

메이븐 웹 프로젝트 tomcat 배포

  1. 이클립스 톰캣 서버 위치 변경
  2. 톰캣 서버 사용자 추가 C:\Program Files\Apache Software Foundation\Tomcat 8.0\conf\tomcat-users.xml
    <?xml version='1.0' encoding='cp949'?>
    <tomcat-users xmlns="http://tomcat.apache.org/xml"
                  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                  xsi:schemaLocation="http://tomcat.apache.org/xml tomcat-users.xsd"
                  version="1.0">
     <role rolename="manager-script"/>
     <user username="admin" password="admin" roles="manager-script"/>
    </tomcat-users>
    role 과 사용자를 추가 하였다.
  3. maven-war-plugin , tomcat-maven-plugin 추가 및 설정
    추가 한 부분은 build node 아래 plugins 노드에 있다.
    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
      <modelVersion>4.0.0</modelVersion>
      <groupId>com.dangun</groupId>
      <artifactId>boot</artifactId>
      <packaging>war</packaging>
      <version>0.0.1-SNAPSHOT</version>
      <name>boot Maven Webapp</name>
      <url>http://maven.apache.org</url>
      <dependencies>
        <dependency>
          <groupId>junit</groupId>
          <artifactId>junit</artifactId>
          <version>3.8.1</version>
          <scope>test</scope>
        </dependency>
      </dependencies>
      <build>
        <finalName>boot</finalName>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-war-plugin</artifactId>
            <version>2.1.1</version>
            <configuration>
        <warSourceDirectory>src/main/webapp</warSourceDirectory>
        <webXml>src/main/webapp/WEB-INF/web.xml</webXml>
            </configuration>
          </plugin>
          <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>tomcat-maven-plugin</artifactId>
            <version>1.1</version>
            <configuration>
        <url>http://127.0.0.1:8080/manager/text</url>
        <path>/</path>
        <charset>UTF-8</charset>
        <mode>war</mode>
        <username>admin</username>
        <password>admin</password>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </project>

  4. 이클립스의 서버 에서 톰캣을 더블클릭 후 Server Location을 use Tomcat installation 으로 변경
  5. 커맨드 창에서 입력 하거나 이클립스 Run As maven > mvn tomcat:deploy
  6. mvn tomcat:redeploy

2016년 6월 14일 화요일

2.1. json 규격

java script code 공통부 , 데이터부 로 나뉜다.

{
 common :
 {
  msg_code : "0000",
  msg : "성공"
 },
 data :{
  result_1 : [],
  result_2 : null
 }
}
데이터부는 없을 수 있지만 , 공통부(common)는 항상 존재 한다.

1. 리스트 데이터

{
  common: {
    msg_code: "0000",
    msg: "성공"
  },
  data: {
    result_1: [
      {
        "NOTE_ID": 8044,
        "NOTE_CATEGORY": "뉴스",
        "NOTE_SECTOR": "증권",
        "NOTE_DATE": "2016-04-18",
        "NOTE_WRITER": "peter",
        "NOTE_CONTENT": "안방에서 ISA 가입한다. 일임형에만 온라인 계약 허용 [연합뉴스]\n-",
        "NOTE_WRITE_DTM": null,
        "NOTE_MODIFY_DTM": null
      },
      {
        "NOTE_ID": 8036,
        "NOTE_CATEGORY": "뉴스",
        "NOTE_SECTOR": "ITHW",
        "NOTE_DATE": "2016-04-15",
        "NOTE_WRITER": "peter",
        "NOTE_CONTENT": "TSMC 1Q16 results \n1Q16 results\n- Rev in-line, GPM miss (due to earthquake impact)\n",
        "NOTE_WRITE_DTM": null,
        "NOTE_MODIFY_DTM": null
      },
      {
        "NOTE_ID": 8035,
        "NOTE_CATEGORY": "뉴스",
        "NOTE_SECTOR": "자동차부품",
        "NOTE_DATE": "2016-04-15",
        "NOTE_WRITER": "peter",
        "NOTE_CONTENT": "March Michelin Tire Market Data (March)\n:: Europe including Russia & CIS > OE yoy - 1% / RE",
        "NOTE_WRITE_DTM": null,
        "NOTE_MODIFY_DTM": null
      }
    ],
    result_2: null
  }
}

eclipse rcp dialog resize

  Dialog 안에 메소드를 만든다. private void autoResize(){     getShell().layout( true, true);     final Point newSize = getShell().computeSize...