2018/05/23 12:05

파일 첨부 SPRING

<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
<version>1.3.1</version>
</dependency>

<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-io</artifactId>
<version>1.3.2</version>
</dependency>

2018/05/18 11:19

하둡2 설치 프로그래밍

방화벽 열기 :  50070

# firewall-cmd --permanent --zone=public --add-port=50070/tcp

# firewall-cmd --reload


hadoop 계정 생성

# useradd hadoop


생성한 계정으로 로그인 : /home/hadoop

# su - hadoop


SSH키 생성(암호입력없이 접속하기위해)

# ssh-keygen -t dsa -P '' -f ~/.ssh/id_dsa

# cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys

# chmod 0600 ~/.ssh/authorized_keys


ssh접속확인하기

# ssh localhost


ssh접속종료

# exit


현재 위치 확인 ( 위치 : /home/hadoop)

# pwd


설치 프로그램 다운로드

#wget http://apache.claz.org/hadoop/common/hadoop-2.7.6/hadoop-2.7.6.tar.gz


압축풀기

tar zxf hadoop-2.7.6.tar.gz


환경설정으로 압축푼 폴더로 이동

cd hadoop-2.7.6/etc/hadoop


PATH설정

# vim ~/.bashrc

export JAVA_HOME=/usr/lib/jvm/jre

export HADOOP_HOME=/home/hadoop/hadoop-2.7.6

export HADOOP_INSTALL=$HADOOP_HOME

export HADOOP_MAPRED_HOME=$HADOOP_HOME

export HADOOP_COMMON_HOME=$HADOOP_HOME

export HADOOP_HDFS_HOME=$HADOOP_HOME

export HADOOP_YARN_HOME=$HADOOP_HOME

export HADOOP_COMMON_LIB_NATIVE_DIR=$HADOOP_HOME/lib/native

export PATH=$PATH:$HADOOP_HOME/sbin:$HADOOP_HOME/bin

export JAVA_LIBRARY_PATH=$HADOOP_HOME/lib/native:$JAVA_LIBRARY_PATH

:wq

PATH 적용

# source ~/.bashrc


1번 :  

# vim hadoop-env.sh

25라인  : export JAVA_HOME=/usr/lib/jvm/jre

:wq


2번 :

# vim core-site.xml

<configuration>

       <property>

               <name>fs.defaultFS</name>

               <value>hdfs://localhost:9010</value>

       </property>

</configuration>

:wq



3번 :

# vim hdfs-site.xml

<configuration>

<property>

<name>dfs.replication</name>

<value>1</value>

</property>


<property>

<name>dfs.name.dir</name>

<value>file:///home/hadoop/hadoopdata/hdfs/namenode</value>

</property>


<property>

<name>dfs.data.dir</name>

<value>file:///home/hadoop/hadoopdata/hdfs/datanode</value>

</property>

</configuration>

:wq



4. 파일이 존재하지 않아 복사

# cp mapred-site.xml.template mapred-site.xml


# vim mapred-site.xml

<configuration>

<property>

              <name>mapreduce.framework.name</name>

               <value>yarn</value>

</property>

</configuration>

:wq


5번 :

# vim yarn-site.xml

<configuration>

<property>

           <name>yarn.nodemanager.aux-services</name>

            <value>mapreduce_shuffle</value>

</property>

</configuration>

:wq


네임노드 포멧

# hdfs namenode -format


하둡 구동

# start-all.sh


하둡 중지

# stop-all.sh



2018/05/18 09:39

spring, mybatis, mysql 환경 구축 SPRING

(한글 설정)


1)

src/main/webapp 폴더의 web.xml에 아래내용 추가
<web-app>

...

</servlet-mapping> 31라인 이후



<filter>

<filter-name>encodingFilter</filter-name>

<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>

 <init-param>

  <param-name>encoding</param-name>

  <param-value>UTF-8</param-value>

 </init-param>

</filter>


<filter-mapping>

 <filter-name>encodingFilter</filter-name>

 <url-pattern>/*</url-pattern>

</filter-mapping>

</web-app>



2)

src/main/webapp/WEB-INF/views폴더의 home.jsp 파일의 첫줄에 (모든 jsp파일에)
<%@ page pageEncoding="UTF-8" contentType="text/html; charset=UTF-8"%>




(mybatis + mysql 연동)

1)
라이브러리 다운로드 (pom.xml)


<?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/maven-v4_0_0.xsd">

<modelVersion>4.0.0</modelVersion>

<groupId>com.kte</groupId>

<artifactId>sts6</artifactId>

<name>sts6</name>

<packaging>war</packaging>

<version>1.0.0-BUILD-SNAPSHOT</version>

<properties>

<java-version>1.6</java-version>

<org.springframework-version>4.1.1.RELEASE</org.springframework-version>

<org.aspectj-version>1.6.10</org.aspectj-version>

<org.slf4j-version>1.6.6</org.slf4j-version>

</properties>


<dependencies>


<dependency>

<groupId>commons-fileupload</groupId>

<artifactId>commons-fileupload</artifactId>

<version>1.3.1</version>

</dependency>


<dependency>

<groupId>org.apache.commons</groupId>

<artifactId>commons-io</artifactId>

<version>1.3.2</version>

</dependency>


<dependency>

<groupId>org.lazyluke</groupId>

<artifactId>log4jdbc-remix</artifactId>

<version>0.2.7</version>

</dependency>


<dependency>

<groupId>org.mariadb.jdbc</groupId>

<artifactId>mariadb-java-client</artifactId>

<version>1.1.7</version>

</dependency>


<dependency>

<groupId>org.mybatis</groupId>

<artifactId>mybatis</artifactId>

<version>3.3.1</version>

</dependency>


<dependency>

<groupId>org.mybatis</groupId>

<artifactId>mybatis-spring</artifactId>

<version>1.2.2</version>

</dependency>


<dependency>

<groupId>commons-dbcp</groupId>

<artifactId>commons-dbcp</artifactId>

<version>1.4</version>

</dependency>


<dependency>

<groupId>org.springframework</groupId>

<artifactId>spring-jdbc</artifactId>

<version>${org.springframework-version}</version>

</dependency>


<dependency>

<groupId>com.fasterxml.jackson.jaxrs</groupId>

<artifactId>jackson-jaxrs-base</artifactId>

<version>2.4.4</version>

</dependency>


2)

mybatis-context.xml



<?xml version="1.0" encoding="UTF-8"?>

<beans xmlns="http://www.springframework.org/schema/beans"

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

xmlns:mybatis-spring="http://mybatis.org/schema/mybatis-spring"

xsi:schemaLocation="

http://www.springframework.org/schema/beans

http://www.springframework.org/schema/beans/spring-beans.xsd

http://mybatis.org/schema/mybatis-spring

http://mybatis.org/schema/mybatis-spring-1.2.xsd">


<bean id="propertyPlaceholderConfigurer"

class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">

<property name="locations" value="/WEB-INF/mybatis/mariadb_db.properties" />

</bean>

<bean id="dataSource"

class="org.apache.commons.dbcp.BasicDataSource">

<property name="driverClassName" value="${jdbc.driverClassName}" />

<property name="url" value="${jdbc.url}" />

<property name="username" value="${jdbc.username}" />

<property name="password" value="${jdbc.password}" />

<property name="validationQuery" value="${jdbc.validationQuery}" />

</bean>

<bean id="log4jDataSource"

class="net.sf.log4jdbc.Log4jdbcProxyDataSource">

<constructor-arg ref="dataSource" />

<property name="logFormatter">

<bean class="net.sf.log4jdbc.tools.Log4JdbcCustomFormatter">

<property name="loggingType" value="MULTI_LINE" />

<property name="sqlPrefix" value="SQL : " />

</bean>

</property>

</bean>

<bean id="sqlSessionFactory"

class="org.mybatis.spring.SqlSessionFactoryBean">

<property name="dataSource" ref="log4jDataSource" />

<property name="mapperLocations"

value="classpath:com/kte/프로젝트명/mapper/*.xml" />

<property name="configLocation"

value="/WEB-INF/mybatis/mybatis-config.xml" />

<property name="transactionFactory">

<bean class="org.apache.ibatis.transaction.managed.ManagedTransactionFactory" />

</property>

</bean>

<bean id="sqlSession" class="org.mybatis.spring.SqlSessionTemplate">

<constructor-arg ref="sqlSessionFactory" />

</bean>

</beans>



2018/04/30 16:18

bootstrap tooltip

head
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css"><script src="http://code.jquery.com/jquery-latest.min.js"></script><script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script><script>    $(document).ready(function() {	$('[data-toggle="tooltip"]').tooltip({		// container: "body",		delay: { "show": 0, "hide": 111000 }	});	$('.tooltip-right').tooltip({		placement: 'right',		viewport: {selector: 'body', padding: 2}	});	$('.tooltip-bottom').tooltip({		placement: 'bottom',		viewport: {selector: 'body', padding: 2}	});	$('.tooltip-viewport-right').tooltip({		placement: 'right',		viewport: {selector: '.container-viewport', padding: 2}	});	$('.tooltip-viewport-bottom').tooltip({		placement: 'bottom',		viewport: {selector: '.container-viewport', padding: 2}	});   });</script>
body
<div class="container">	<h2>툴팁</h2>	<a href="#" data-toggle="tooltip" title="" data-original-title="Default tooltip">you probably</a>	<hr>	<div class="button-margin">	<button type="button" class="btn btn-default" data-toggle="tooltip" data-placement="left" title="Tooltip on left">Tooltip on left</button>	<button type="button" class="btn btn-default" data-toggle="tooltip" data-placement="top" title="Tooltip on top">Tooltip on top</button>	<button type="button" class="btn btn-default" data-toggle="tooltip" data-placement="bottom" title="Tooltip on bottom">Tooltip on bottom</button>	<button type="button" class="btn btn-default" data-toggle="tooltip" data-placement="right" title="Tooltip on right">Tooltip on right</button>	</div>	<div class="button-margin"   id="fixed-div">	<button type="button" class="btn btn-default" data-toggle="tooltip" data-placement="right" title="Tooltip on right">Tooltip on left</button>	</div>	<div class="checkbox disabled" data-toggle="tooltip" title="Disabled" data-placement="top">	  <label>	    <input type="checkbox" value="" disabled>	    Option two is disabled	  </label>	</div>	<hr>	<div  data-toggle="tooltip" title="Disabled" data-placement="top">	<input class="form-control" id="disabledInput" type="text" placeholder="Disabled input here..." disabled>	</div>	<hr>	<div class="dropdown clearfix">	  <button class="btn btn-default dropdown-toggle" type="button" id="dropdownMenu3" data-toggle="dropdown" aria-expanded="true">	    Dropdown	    <span class="caret"></span>	  </button>	  <ul class="dropdown-menu" role="menu" aria-labelledby="dropdownMenu3">	    <li role="presentation"><a role="menuitem" tabindex="-1" href="#">Regular link</a></li>	    <li role="presentation" class="disabled" data-toggle="tooltip" title="Disabled" data-placement="left"><a role="menuitem" tabindex="-1" href="#">Disabled link</a></li>	    <li role="presentation"><a role="menuitem" tabindex="-1" href="#">Another link</a></li>	  </ul>	</div>	<hr>	<!-- HTML to write -->	<a href="#" data-toggle="tooltip" title="Some tooltip text!">Hover over me</a>	<!-- Generated markup by the plugin -->	<div class="tooltip top" role="tooltip">	  <div class="tooltip-arrow"></div>	  <div class="tooltip-inner">	    Some tooltip text!000	  </div>	</div>	<a href="#" data-toggle="tooltip" title="" data-original-title="Default tooltip" style="white-space: nowrap;">Sometimes you want to add a tooltip to a hyperlink that wraps multiple lines. The default behavior of the tooltip plugin is to center it horizontally and vertically. Add white-space: nowrap; to your anchors to avoid this Sometimes you want to add a tooltip to a hyperlink that wraps multiple lines. The default behavior of the tooltip plugin is to center it horizontally and vertically. Add white-space: nowrap; to your anchors to avoid this</a>	<hr>	<div class="btn-group" role="group" aria-label="...">	  <button type="button" class="btn btn-default" data-toggle="tooltip" title="Disabled" data-placement="top">Left</button>	  <button type="button" class="btn btn-default" data-toggle="tooltip" title="Disabled" data-placement="top">Middle</button>	  <button type="button" class="btn btn-default" data-toggle="tooltip" title="Disabled" data-placement="top">Right</button>	</div>	<div class="input-group">	  <span class="input-group-addon">@</span>	  <input type="text" class="form-control" placeholder="Username" data-toggle="tooltip" title="Disabled" data-placement="top" data-delay='{ "show": 500, "hide": 1000 }'>	</div>	<div style="margin-top: 30px;">	<a href="#" data-toggle="tooltip" data-html="true" title="<h1>Default <a href='http://google.com'>tooltip</a></h1>" data-delay='{ "hide": 3000 }'>you probably</a>	</div>	<div style="margin-top: 30px;">	<a href="#" data-toggle="tooltip" data-html="true" >you probably</a>	</div></div>
설명

툴팁은 링크에 마우스를 올리면 메시지가 나오는 말풍선을 말합니다. 기본적으로 모든 웹브라우저에서 태그에 title 속성을 적용하면 마우스 오른쪽 아래에 말풍선이 나타나지만 부트스트랩은 보다 세련된 말풍선 효과를 나타낼 수 있습니다.

 

툴팁은 예외적으로 자바스크립트로 활성화해야 하며 data-toggle=”tooltip” 속성도 포함해야 합니다. 타겟팅을 위해 선택자를 지정해야 하는데 모든 툴팁에는 이 데이터 속성이 있어서 이를 대상으로 선택자를 정합니다. 툴팁으로 나타날 문구는 title 속성이나 data-original-title 속성에 값으로 지정합니다.

<a href=”#” data-toggle=”tooltip” title=”” data-original-title=”Default tooltip>you probably</a>

 

자바스크립트는 다음과 같이 설정합니다.

$(“[data-toggle=’tooltip’]“).tooltip();

 


이어지는 내용

2018/04/26 09:44

position:absolute와 tabel-cell을 이용한 중앙 정렬

position:absolute와 tabel-cell을 이용한 중앙 정렬

  • 장점
    • ie8 이상 모든 브라우저에서 지원 가능합니다.
    • layer 안의 content 영역이 고정값이 아니라 가변이어도 자동으로 중앙정렬이 됩니다.
  • 단점
    • 코드 중첩이 여러번 되어야 합니다.

<div class="layer">
  <div class="layer_inner">
    <div class="content">Layer Contents</div>
  </div>
</div>

.layer{position:absolute;display:table;top:0;left:0;width:100%;height:100%}.layer .layer_inner{display:table-cell;text-align:center;vertical-align:middle}.layer .content{display:inline-block;background:#f00}


1 2 3 4 5 6 7