노출되는 이미지가 불편하시겠지만 양해를 구합니다. 노출, 클릭등에 관한 자료로 활용 중입니다.





2017년 1월 스타트업에서 구인(채용)시 원하는 개발관련 기술





개발 언어, DBMS/noSQL, Cloud등의 서비스 Flatform, Software등을 살펴 보면,




1th 그룹 : Java, NodeJS, Android, Python, JQuery, Amazon


2nd 그룹 : Redis, AWS, AngularJs, iOS, PostgreSQL, Nginx, Django , MongoDB




최신 기술의 동향일 수도 있지만, 이직 또는 구직을 위해서 학습을 해야 한다면, 참고 할 만 하다.





* 자료는 개발자 채용 정보 제공 사이트 rocketpunch.com의 


인기 채용 공고 40건 참조



* 채용시 사용된 keyword 리스트 추출




php
mysql
linux
android
git
kotlin
gcm/fcm
python
mssql
mongodb
amazon aws
ios
objective-c
swift
github
python
c++
django
python
postgresql
amazon aws
html5/css3/javascript
android
java
mysql
python
c++
c#
java
aws
cloud-server
dbms
node.js
postgresql
redis
nginx
react.js
hapi.js
amazon aws
restful-api
angularJS
jQuery
html5/css3/javascript
android
firebase
custom ui component
restful-api
asp.net
c#
html 
css
javascript
bootstrap
angularjs
node.js
php
mongodb
redis
프론트엔드 주요 기술
javascript
jquery
ajax
angularjs
wbesocket
html5/css3/javascript
android
ios
java
xcode
node.js
coffeescript
mysql
amazon ec2
amazon es3
android
ios
node.js
php
python
java
ios
php
mysql
apache
python
android
redis
node.js
jquery
msa
node.js
java
restful-api
linux
nosql
golang
redis
nginx
mysql
expressjs
c++
php
mysql
node.js
mongodb
android
ios
git
jira
c++
java
lucene
soir
elasticsearch
indexing
search-engine
web scraping(web crawling)
java
jsp
mysql
unity3d
cocos2d-x
c#
java
mahout-recommender
aws emr
text-mining
hadoop
elasticsearch
node.js
mongodb
nginx
redis
restful-api
amazon aws
java
python
node.js
jquery
java
python
android
ios
java
node.js
angularjs
mysql
android
java
php
jsp
jquery
mysql
html5/css3/javascript
jquery
java
python
django
html5/css3/javascript
node.js
android
mongodb
jquery
meteor
nginx
amazon aws
cordova
lamport
java
android
java
android studio
python
django
mariadb
rest API
docker
jenkins
django template engine 
cbv
javascript
html
css
angularjs
jquery
bootstrap
html/css/javascript
mysql
node.js
redis
amazon aws
php
jquery
mysql
java
python
node.js
amazon aws
codeigniter
nosql
elasticsearch
python
postgresql
redis
mongodb
flask
django
nginx
apache
sqlalchemy
oracle
python
angularjs
jquery
postgresql
nginx
redis
django
asana
slack


'Web Tech. > Spring Framework' 카테고리의 다른 글

Upload Fake Image(가짜 이미지, 피싱스크립트) 의 검증  (0) 2017.01.31
2개의 war 비교하기  (0) 2017.01.25
HMAC SHA-256 이해  (0) 2017.01.24
Tomcat JDBC Connection Pool  (0) 2016.12.20
SVN 연결 해제, 재연결  (0) 2016.12.15
블로그 이미지

StartGuide

I want to share the basic to programming of each category and how to solve the error. This basic instruction can be extended further. And I have been worked in southeast Asia more than 3 years. And I want to have the chance to work another country.

,
노출되는 이미지가 불편하시겠지만 양해를 구합니다. 노출, 클릭등에 관한 자료로 활용 중입니다.

SHA-256 해시(Hash) 이해

 

# SHA-256 Hash Calculator(계산기)를 통한 변환

 

# 해시(Hash)?

많은 용량의 데이타를 고정된 크기의 고유값으로 만드는 것이다. 데이타 값이 약간만 달려져도 해시에는 예측할 수 없는 큰 변화가 발행하며 전형 다른 값이 되며, 이를 일명 눈사태 효과라고 부른다.

 

# HMAC(해시 메시지 인증 코드)?

해시는 데이터의 수정 또는 변경은 검출 할 수 있으나, 거짓 행세는 찾을 수 없기 때문에

인증이 필요해 진다.

 

송신자와 수신자만이 공유하고 있는 Key와 Data(메시지)를 혼합해서 해시값을 만드는 것이다. 이를 HMAC(Hash-based Message Authentication Code)이라고 한다.

 

 

SHA-256 ?

Secure Hash Algorithm(SHA)-256약자의 조합으로 생성된 고유의 값이 256비트이다. ( 하지만, SHA-1은 1비트가 아니고, ver.1을 뜻한다. )

SHA-2기반으로 SHA-224, SHA-256,SHA-384, SHA-512가 만들어 졌다. ( 뒤에 숫자는 비트수를 의미한다. )

SHA-1(160비트)은 2008년에 보안에 심각한 결함이 발견

 

 

# 해쉬함수별 출력값(해쉬값) 길이 비교

Hash 함수

출력값 길이

16진수

md5

128 bits

32 bytes

ex) 8380482228e75045a7d14e063bde014b

sha-1

160 bits

40 bytes

ex) 764C46AE8BC50C4823E50F18DA45B9A21E8DD10B

sha-256

256 bits

64 bytes

ex) be178c0543eb17f5f3043021c9e5fcf30285e557a4fc309cce97ff9ca6182912


 

# 참조 :

http://sunphiz.me/wp/archives/1104?ckattempt=1

http://www.xorbin.com/tools/sha256-hash-calculator

https://www.jokecamp.com/blog/examples-of-creating-base64-hashes-using-hmac-sha256-in-different-languages/

 

 

# Message Digest 만들기

StringBuffer hexString = new StringBuffer();
MessageDigest md = MessageDigest.getInstance("SHA-256");
byte[] hash = md.digest();

for (int i = 0; i < hash.length; i++) {
    if ((0xff & hash[i]) < 0x10) {
        hexString.append("0"
                + Integer.toHexString((0xFF & hash[i])));
    } else {
        hexString.append(Integer.toHexString(0xFF & hash[i]));
    }
}

 

출처 : https://stackoverflow.com/questions/5470219/get-md5-string-from-message-digest

블로그 이미지

StartGuide

I want to share the basic to programming of each category and how to solve the error. This basic instruction can be extended further. And I have been worked in southeast Asia more than 3 years. And I want to have the chance to work another country.

,
노출되는 이미지가 불편하시겠지만 양해를 구합니다. 노출, 클릭등에 관한 자료로 활용 중입니다.



3. OctoberCMS , Creating Themes




1) 테마 만들기 ( myoctober.app:8000/backend , homestead설정 사용시 )



생성하기

- CMS -> Front-end theme -> 'Create a new blank theme'


속성 설정


- Name : Olympos

- Directory name : olympos

- Description : New starter theme

- Author : Ivan Doric

- Homepage : http://myoctober.app:8000






*테마 생성 위치 : themes/olympos/theme.yaml



활성화 - Activate Theme ( 신규 테마로 변경 )

: CMS->Front-end theme ->'Activate' Olympos





2) Layout 생성하기 : default.htm



메뉴 : CMS -> Layouts -> +Add : default.htm


위치 : themes/olympos/layouts/default.htm



* 기존 demo/layouts/default.htm를 copy하고, header/footer는 일단 삭제


* css : style.css 신규 생성

  <link href="{{ 'assets/css/style.css'|theme }}" rel="stylesheet">

      


* js : app.js는 신규 생성 ( jquery.js는 복사 )

        <script src="{{ [
            'assets/js/jquery.js', 'assets/js/app.js',
            ]|theme }}"></script>




3) Homepage 생성하기 : homepage.htm



메뉴 : CMS -> Layouts -> +Add : homepage.htm ( URL : / )


위치 : themes/olympos/pages/homepage.htm


Markup :

<h1>This is our homepage</h1>


4) 실행 결과

 






* 브라우저 View Source결과 ( script는 단일 파일로 변경되어, 요청 traffic을 감소 시킴 )

<!-- Scripts -->
<script src="http://myoctober.app:8000/combine/ffc6422ecc7902bad467abb69edcd8cb-1484897286"></script>

동영상 (영문 강좌)

     - watch-learn.com october-cms


블로그 이미지

StartGuide

I want to share the basic to programming of each category and how to solve the error. This basic instruction can be extended further. And I have been worked in southeast Asia more than 3 years. And I want to have the chance to work another country.

,
노출되는 이미지가 불편하시겠지만 양해를 구합니다. 노출, 클릭등에 관한 자료로 활용 중입니다.


2.October CMS , Basic Concepts ( 기본 개념 )




* Backend 접속 하기


URL : myoctober:8000/backend

ID/PW : admin/admin







1) 컨셉 1, Pages



- CMS -> Pages메뉴에서 '+Add'를 통해서 생성


- TITLE의 입력시

--입력값에 따라 URL 및 Filename을 자동 생성( 필요에 따라 변경 가능 )


-- [hostname:port]/URL로 접근 가능


-- 설정 항목 : Filename, Layout, Description, Markup(HTML)


- Markup내에서
-- Content 사용시:
 --- 사용 문법 : {% content "welcome.htm" %}
  --- 저장 위치 : themes/demo/content/welcome.html



-- Layout 선택 : default


     --- 저장 위치 :  themes/demo/layouts/default.htm


     --- Partial 사용시 : footer
         ---- 저장 위치 : themes/demo/partials/footer.htm
         ---- 사용 문법 : {% partial 'footer' %}



- Page의 물리적인 파일 구조와 저장 위치


    -- 위치 : themes/demo/pages/homepage.thm ( 기본 설치는 themes/demo에 위치 )


    -- 파일 : 속성 영역과 HTML Code영역으로 구분되어서 저장




예) 신규 Page : 'about'



- 설정 화면 : Layout(default)




- 결과 화면




2) 컨셉2, Plugin


- 설치 메뉴 

-- Settings -> SYSTEM -> Updates & Plugins -> Install Plugins


- blog plugin 설치후 사용하기 

-- 카테고리와 글을 추가

-- Categories -> New(새 카테고리) : New cat (Name ), new-cat ( Slug )

-- New post(새 포스트) -> (edit text) ->Save ( Manage, Published선택 )



- 목록 화면을 보여주기 위해서 페이지 추가

-- Pages -> +Add

--- blog라는 TITLE로 생성 (blog.htm)

-- Components -> BLOG를 선택하고 'Post List'를 'Markup' 영역으로 이동후 Save

--- blog.htm : {% component 'blogPosts' %}



-- 실행 화면 : myoctober:800/blog



- 내용 화면을 보여주기 위해서 페이지 추가

-- Pages -> +Add

--- blog-post라는 TITLE로 생성 (blog-post.htm, url : /blog/:slug )


-- Components -> BLOG를 선택하고 'Post'를 'Markup' 영역으로 이동후 Save

--- blog-post.htm : {% component 'blogPost' %}




-- 목록 페이지의 Post List 컴포넌트의 Links(Post page)에 연결


-- 실행 화면 ( 목록에서 선택시 )  : Layout(default) 미적용





* Backend 스크린샷

-Dashboard


-CMS

-- Pages, Partials, Layouts, Content, Assets, Components


-Media
-- Images, Video, Audio, Documents


-Setting
-- CMS : Front-end theme, Maintenance mode
-- SYSTEM : Updates & Plugins, Administrators, Customize back-end, Editor settings
-- MAIL : Mail Configuration, Mail templates
-- LOGS : Event log, Request log, Access log







관련 동영상 : Part2 Basic Concepts

http://watch-learn.com/series/making-websites-with-october-cms






사전 준비 : October CMS on Homestead 설치, http://printhelloworld.tistory.com/79

블로그 이미지

StartGuide

I want to share the basic to programming of each category and how to solve the error. This basic instruction can be extended further. And I have been worked in southeast Asia more than 3 years. And I want to have the chance to work another country.

,
노출되는 이미지가 불편하시겠지만 양해를 구합니다. 노출, 클릭등에 관한 자료로 활용 중입니다.


OctoberCMS on Laravel(라라벨) Homestead



1) 소개


OctoberCMS는 무료이고, 오픈 소스이며, 자체 호스팅형의 CMS 플랫폼으로 Laravel PHP 프레임웍을 기초로 한다.


2번째 속성으로 Simple하고 모듈형 CMS는 개발자에 의해 확장되며, 정확하고 아름다운 UI를 갖고 있다.



Getting back to basics


 https://octobercms.com/blog/post/getting-back-to-basics


"많은 유명한 CMS들은 복잡하고 뒤얽혀진 시스템이 되었으며, 만약에 안을 들여다 보면 꽤 실망하게 될 것이다..."




2) OctoberCMS 설치 (신규, 추가)


vagrant를 실행하고, October project를  설치한다. ( 신규 프로젝트 생성 )

 
    > vagrant up
    > vagrant ssh
    > cd Code
    
    >
    > composer create-project october/october myoctober dev-master -vvv
    >
myoctober :  선호하는 폴더명/Domain명으로 대체


*비슷한 설명 : https://octobercms.com/docs/console/commands#console-install-composer




3) hosts파일에 등록하기 ( 접근용 Domain )

  192.168.10.10    myoctober.app


4) .homestead/Homestead.yaml 수정하기

   sites:
        - map : myoctober.app   
          to : /home/vagrant/Code/myoctober
    databases:
        - myoctober


5) vagrant 재시작

 
    > vagrant reload --provision
    > vagrant ssh
    > cd Code

* Oracle VM Virtual Box가 무반응시에 Oracle VM Virtual Box관리자 화면에서 시작/종료를 반복후에 위의 reload명령어를 수행한다.



* vagrant reload --provision 옵션 설명 : https://www.vagrantup.com/docs/cli/reload.html



6) 설치 결과를 확인하는 접속





* 단일 장비에서는 설정을 console명령으로 직접 변경 가능하다,

   DB 선택, DB 계정, Domain명등을 설정할 수 있다


    > php artisan October:install



아래는 backend 접속을 위한 수동 설정을 다룬다.


6) DB 설정


MySQL(33060), Postgres(54320)을 사용하며, username과 password는 homestead/secret이다.



7) /config/database.php를 수정

    'default' => 'pgsql', // 'mysql'

from

        'pgsql' => [
            'driver'   => 'pgsql',
            'host'     => 'localhost',
            'port'     => '',
            'database' => 'database',
            'username' => 'root',
            'password' => '',
            'charset'  => 'utf8',
            'prefix'   => '',
            'schema'   => 'public',
        ],


to

 
        'pgsql' => [
            'driver'   => 'pgsql',
            'host'     => env('DB_HOST'),
            'port'     => env('DB_PORT'),
            'database' => env('DB_DATABASE'),
            'username' => env('DB_USERNAME'),
            'password' => env('DB_PASSWORD'),
            'charset'  => 'utf8',
            'prefix'   => '',
            'schema'   => env('DB_SCHEMA'),
        ],

.env 파일 만들기 ( 위치 : project root )

DB_HOST=127.0.0.1
DB_PORT=5432
DB_DATABASE=myoctober
DB_USERNAME=homestead
DB_PASSWORD=secret
DB_SCHEMA=public


데이타베이스 migrate (터미널상에서)

> cd myoctober > php artisan october:up


octoberCMS의 backend접속 하기

> http://myoctober.app:8000/backend
> admin/admin





원문 : https://renatio.com/blog/install-octobercms-laravel-homestead

블로그 이미지

StartGuide

I want to share the basic to programming of each category and how to solve the error. This basic instruction can be extended further. And I have been worked in southeast Asia more than 3 years. And I want to have the chance to work another country.

,
노출되는 이미지가 불편하시겠지만 양해를 구합니다. 노출, 클릭등에 관한 자료로 활용 중입니다.



Laravel(라라벨) 5.3,

Layouts, CSS & JS Part 1




Layout를 사용해서 파일이나 페이지에 포함되도록 끼워 넣는 방법과 JS파일을 연결하는 방법을 정리한다.



1. 기본 Layout 폴더와 페이지를 만들기


위치 : reources\views\layout\layouts.blade.php


    
<!DOCTYPE HTML>
<html>
<head>
  <title>
    @yield('title') Page
  </title>
</head>
<body>
    @yield('content')
</body>
@stack('scripts')
{!! Html::script('js/hello.js') !!}
</html>

1.1 public/js/hello.js

    
alert('Hello World!!');



2. laravelcollective/html 설치하기

    
> composer require laravelcollective/html


2.1 laravelcollective/html 등록하기


위치 : config/app.php

    
    'providers' => [ Collective\Html\HtmlServiceProvider::class, ],

    'aliases' => [ 'Form' => Collective\Html\FormFacade::class,
                        'Html' => Collective\Html\HtmlFacade::class, ],


3. View 페이지 ( Blade Template PHP ) 작성 하기


위치 : resources/views/pages/hello.blade.php

    
    @extends('layout.layouts')
    @section('title','Hello World')

    @section('content')
        My name is Henrio !!!
    @endsection

    @push('scripts')
        {!! Html::script('js/hello2.js') !!}
    @endpush

2.1 public/js/hello2.js

    
alert('Hello, Hello, It's ME.');


동영상 강좌  : https://www.youtube.com/watch?v=Xza0wUFJC3M&index=3&list=PL-4_JsMSrLiqrzQ36KwYVn4uCjYLiAd_C






Laravel(라라벨) 5.3 ,

Layouts, CSS & JS Part 2



1. download Bootstrap


 copy folder to /public with name of 'bootstrap'




2. include css to layouts.blade.php

	<head>
		{!! Html::style('bootstrap/css/bootstrap.min.css')!!}
	</head>


3. add form code to hello.blade.php

	@section('content')
	    <div class="container">

		<div class="row">
		    <h4>Hello World! Henrio</h4>
		    <hr/>
		</div>

		<div class="row">

		    <div class="container">

			{!! Form::open( ['url' => '', 'method' => 'POST',
			    'class' => 'form-horizontal'] ) !!}
			{!! Form::token() !!}

			<div class="row">
			    <div class="col-sm-2 center-block">
				{!! Form::label('text','Insert Your Text Here!',
				    ['class' => 'control-label pull-right']) !!}
			    </div>
			    <div class="col-sm-4 center-block">
				{!! Form::text('text','',
				    ['class' => 'form-control pull-left']) !!}
			    </div>
			    <div class="col-sm-6 center-block">

			    </div>
			</div> <!-- class row -->

			<div class="row">
			     
			</div> <!-- class row -->

			<div class="row">
			    <div class="col-sm-6 center-block">
				{!! Form::submit('Submit The Input',
				    ['id' =>'btn-stmt','class' => 'btn btn-info pull-right']) !!}
			    </div>
			    <div class="col-sm-6 center-block">

			    </div>
			</div> <!-- class row -->

			{!! Form::close() !!}

		    </div> <!-- class container  -->

		</div> <!-- class row -->

	    </div> <!-- class container -->
	@endsection


4. create styles.css under css folder

	
	#btn-sbmt {
	    position:relative;
	    margin-top:50px;
	}



5. add styles.css to layouts.blade.php

	<head>
		{!! Html::style(css/styles.css')!!}
	</head>



동영상 강좌 https://www.youtube.com/watch?v=PS-Yr8CRI1o&index=4&list=PL-4_JsMSrLiqrzQ36KwYVn4uCjYLiAd_C





Laravel(라라벨) 5.3,

Forms And Working With Models



1. Create Controller & Model , MySQL Table

	
> php artisan make:controller TextController
> php artisan make:model Posts
> create table (
		id int not null auto_increment primary key,
		posts text,
	)


2. Modify Code for model at app/Posts.php

class Posts extends Model
{
    //
    public $timestamps = false;

    protected $table = "posts";
    protected $primaryKey = "ID";
    protected $casts = ["ID" => "INT"];

}	


3. Modify Code for controller at app/Http/Controllers/TextController.php

public function submitted(Request $request) {
        $text = $request->get('text');
        echo $text;	
}


4. Add router to routes/web.php

Route::post('submitted','TextController@submitted');	


5. Add post url at resource/views/pages/hello.blade.php

	
                {!! Form::open( ['url' => '/submitted', 'method' => 'POST',
                    'class' => 'form-horizontal'] ) !!}
                {!! Form::token() !!}


Test access and check the result  : http://[hosturl]:8000/hello




6. Modify code to save at app/Http/Controllers/TextController.php

        $text = $request->get('text');
        //echo $text;
        $posts = new Posts();
        $posts->Posts = $text;
        // save
        $posts->save();	





동영상 강좌 https://www.youtube.com/watch?v=OgbUlgSwl-o&index=5&list=PL-4_JsMSrLiqrzQ36KwYVn4uCjYLiAd_C



관련된 이전 글 : Laravel 5.3 , Routes & Controllers for MVC ( Model View Controller )


- Controller 와 View 수정을 위한 위치등을 참조...


http://printhelloworld.tistory.com/admin/entry/post/?id=76


블로그 이미지

StartGuide

I want to share the basic to programming of each category and how to solve the error. This basic instruction can be extended further. And I have been worked in southeast Asia more than 3 years. And I want to have the chance to work another country.

,
노출되는 이미지가 불편하시겠지만 양해를 구합니다. 노출, 클릭등에 관한 자료로 활용 중입니다.


Laravel(라라벨) 5.3,

Routes & Controllers for MVC



-- vagrant를 통해서 homestead를 설치한 환경에서 작성




1. Route 파일 위치 확인하기


routes/ 폴더 아래에 api.php , console.php, web.php가 존재한다.




사용할 파일은 web.php 이다.


* 해당 파일의 내용을 확인하는 방법은 http://[호스트명]:8000/으로 접속하면 결과를 볼 수 있다. welcome.blade.php는 resource/views/welcome.blade.php에 위치 한다.



2. HelloController 생성하기


HelloWorld>php -v
HelloWorld>php artisan make:controller HelloController


3. View ( Blade Template ) 생성하기


resources/views/아래에 pages 폴더를 만들고, 그 아래에 hello.blade.php파일을 생성한다.



4. HelloController에 function을 추가하기



*  http://[호스트명]:8000/hello으로 접속하면 Error가 발생하는 것을 볼 수 있다.



5. Web Route 파일에 분기 로직을 추가 하기



*  http://[호스트명]:8000/hello으로 접속하면 Empty화면을 볼 수 있다.



6. View ( View Blade Template ) 수정 하기




*  http://[호스트명]:8000/hello으로 접속하면 정상적인 결과를 볼 수 있다.




참조 동영상


https://www.youtube.com/watch?v=gx4q5Nnw9eY



Laravel 5.3 Tutorial Series  ( 최종 Update : 2016. Nov. 5 )


https://www.youtube.com/playlist?list=PL-4_JsMSrLiqrzQ36KwYVn4uCjYLiAd_C

블로그 이미지

StartGuide

I want to share the basic to programming of each category and how to solve the error. This basic instruction can be extended further. And I have been worked in southeast Asia more than 3 years. And I want to have the chance to work another country.

,
노출되는 이미지가 불편하시겠지만 양해를 구합니다. 노출, 클릭등에 관한 자료로 활용 중입니다.


Tomcat JDBC Connection Pool의 

일반 속성 ( Common Attributes )을 사용 하기




JDBC 연결하고 사용중(서비스중)에 갑자기 발생하는 단절 현상과 같이 Query시에 발생하는 PSQLException 중에서 에러 메시지 종류가 1. ERROR : could not establish connection,2. Detail : could not connect to server 인 경우에 testOnBorrow, validationQuery를 사용하면, 연결 단절시에 대한 조치를 할 수 있다. 




설정하는 옵션에 대한 설명은 아래 표를 참고 한다.

Attribute Description
defaultAutoCommit

(boolean) The default auto-commit state of connections created by this pool. If not set, default is JDBC driver default (If not set then the setAutoCommit method will not be called.)

testOnBorrow

(boolean) The indication of whether objects will be validated before being borrowed from the pool. If the object fails to validate, it will be dropped from the pool, and we will attempt to borrow another. NOTE - for a true value to have any effect, the validationQuery or validatorClassName parameter must be set to a non-null string. In order to have a more efficient validation, see validationInterval. Default value is false

validationQuery

(String) The SQL query that will be used to validate connections from this pool before returning them to the caller. If specified, this query does not have to return any data, it just can't throw a SQLException. The default value is null. Example values are SELECT 1(mysql), select 1 from dual(oracle), SELECT 1(MS Sql Server)

validationQueryTimeout

(int) The timeout in seconds before a connection validation queries fail. This works by calling java.sql.Statement.setQueryTimeout(seconds) on the statement that executes the validationQuery. The pool itself doesn't timeout the query, it is still up to the JDBC driver to enforce query timeouts. A value less than or equal to zero will disable this feature. The default value is -1.

validatorClassName

(String) The name of a class which implements the org.apache.tomcat.jdbc.pool.Validator interface and provides a no-arg constructor (may be implicit). If specified, the class will be used to create a Validator instance which is then used instead of any validation query to validate connections. The default value is null. An example value iscom.mycompany.project.SimpleValidator.

참조 원문 : https://tomcat.apache.org/tomcat-8.0-doc/jdbc-pool.html



for high-concurrency (높은 동시성)


Validating Connections

데이타베이스 풀링은 문제점을 갖고 있고, 이는 연결된 풀들이 끊어질 수(신선하지 않은) 있다.

<Resource type="javax.sql.DataSource"
            name="jdbc/TestDB"
            factory="org.apache.tomcat.jdbc.pool.DataSourceFactory"
            driverClassName="com.mysql.jdbc.Driver"
            url="jdbc:mysql://localhost:3306/mysql"
            username="mysql_user"
            password="mypassword123"
            testOnBorrow="true"
            validationQuery="SELECT 1"
            />

Validation Queries는 몇가지 단점도 있다.


1. 자주 사용하면, 시스템의 성능을 저하시킨다.

2. 멀리 떨어져 있는 상태에서 호출하면, 결과는 실패일 수있다

 

http://www.tomcatexpert.com/blog/2010/04/01/configuring-jdbc-pool-high-concurrency



자바에서 사용하는 경우를 예로 들면 아래와 같다.

Code Example - Plain Java

import java.sql.Connection;
  import java.sql.ResultSet;
  import java.sql.Statement;

  import org.apache.tomcat.jdbc.pool.DataSource;
  import org.apache.tomcat.jdbc.pool.PoolProperties;

  public class SimplePOJOExample {

      public static void main(String[] args) throws Exception {
          PoolProperties p = new PoolProperties();
          p.setUrl("jdbc:mysql://localhost:3306/mysql");
          p.setDriverClassName("com.mysql.jdbc.Driver");
          p.setUsername("root");
          p.setPassword("password");
          p.setJmxEnabled(true);
          p.setTestWhileIdle(false);
          p.setTestOnBorrow(true);
          p.setValidationQuery("SELECT 1");
          p.setTestOnReturn(false);
          p.setValidationInterval(30000);
          p.setTimeBetweenEvictionRunsMillis(30000);
          p.setMaxActive(100);
          p.setInitialSize(10);
          p.setMaxWait(10000);
          p.setRemoveAbandonedTimeout(60);
          p.setMinEvictableIdleTimeMillis(30000);
          p.setMinIdle(10);
          p.setLogAbandoned(true);
          p.setRemoveAbandoned(true);
          p.setJdbcInterceptors(
            "org.apache.tomcat.jdbc.pool.interceptor.ConnectionState;"+
            "org.apache.tomcat.jdbc.pool.interceptor.StatementFinalizer");
          DataSource datasource = new DataSource();
          datasource.setPoolProperties(p);

          Connection con = null;
          try {
            con = datasource.getConnection();
            Statement st = con.createStatement();
            ResultSet rs = st.executeQuery("select * from user");
            int cnt = 1;
            while (rs.next()) {
                System.out.println((cnt++)+". Host:" +rs.getString("Host")+
                  " User:"+rs.getString("User")+" Password:"+rs.getString("Password"));
            }
            rs.close();
            st.close();
          } finally {
            if (con!=null) try {con.close();}catch (Exception ignore) {}
          }
      }

  }



블로그 이미지

StartGuide

I want to share the basic to programming of each category and how to solve the error. This basic instruction can be extended further. And I have been worked in southeast Asia more than 3 years. And I want to have the chance to work another country.

,
노출되는 이미지가 불편하시겠지만 양해를 구합니다. 노출, 클릭등에 관한 자료로 활용 중입니다.


Laravel(라라벨) Homestead 사용하기




Laravel은 로컬 개발환경을 포함해서 PHP 개발 경험 전체를 즐겁도록 하기 위한 노력을 많이 한다고 설명하며,  그것은 Homestead다.



(먼저 필요한 것 중에서) Vagrant는 쉽고 우아한 방법으로 가상머신 관리와 공급을 제공한다. ( 가상화 인스턴스인 Virtual Machine을 관리하는 소프트웨어 이다. )


Oracle Virtual BoxVagrant를 설치 해야 한다. 

여러 Provider를 지원하기는 하지만, 기본 Provider는 VirtualBox이다. 


=> Vagrant 설치후 확인 : vagrant -v


http://rangken.github.io/blog/2015/vagrant-1/ ( Vagrant 기본 설정 및 명령어 )




Laravel Homestead는 공식 지원이며, 미리 설치된 Vagrant box이며, 로컬 머신에 PHP, HHVM, web server 또는 어떤 다른 소프트웨어의 설치가 필요없는 개발 환경을 제공한다.


=> 다양한 box들 : https://atlas.hashicorp.com/boxes/search



0. 설치 환경


- window 10
- virtual box 4.3.12 ( 5.0.x ~ 5.1.x 는 설치시 에러 )



1. 설치 및 셋업



1) HomeStead Vagrant Box 설치 


    -- Vagrant Box는 일종의 스냅샷 이미지 ( OS와 프로그램이 미리 설치되어 있는 이미지)

    -- Ubuntu 16.04.01 (homestead 4.4.0) ,PHP 7.1, HHVM, Nginx

    -- MySQL, Postgres, NodeJs, Redis, Memcached, Beanstalkd, Blackfire Profiler

> vargrant box add laravel/homestead



=> C:\Users\[계정명]\.vagrant.d\boxes\laravel-VAGRANTSLASH-homestead\0.4.0\virtualbox 에 가상 디스크가 생긴다.



2) Homestead 프로젝트 설치


--> git bash를 사용할 수 있는 환경을 구성후에 사용 할 것



   

(1) 홈 디렉토리에서 저장소 clone

> cd ~
> git clone https://github.com/laravel/homestead.git Homestead



   

(2) Homestead 디렉토리에서 git bash실행

> cd ~/Homestead
> bash init.sh

   => 홈 디렉토리밑에 .homestead/Homestead.yaml설정파일 생성


   또는 > laravel new example 와 같이 어플리케이션을 직접 생성



   

(3) Homestead.yaml 설정


    - cpu 개수는 적당히 늘려주기

    - 로컬 Window 공유 디렉토리 생성 하기 ( ~/Code )

    - sites변경시에는 갱신  : >vagrant reload --provision

---
ip: "192.168.10.10"    # homestead VM이 사용할 주소
memory: 2048
cpus: 2
provider: virtualbox   # Virtual Machine Provider

authorize: ~/.ssh/id_rsa.pub

keys:
    - ~/.ssh/id_rsa     # SSH로그인에 사용할 private key

folders:
    - map: ~/Code    # 로컬 디렉토리 경로
      to: /home/vagrant/Code    # VM의 디렉토리 경로

sites:
    - map: homestead.app  # 도메인 이름
      to: /home/vagrant/Code/Laravel/public   # 웹서버의 Document Root

databases:
    - homestead

# blackfire:
#     - id: foo
#       token: bar
#       client-id: foo
#       client-token: bar

# ports:
#     - send: 50000
#       to: 5000
#     - send: 7777
#       to: 777
#       protocol: udp

    - project 생성 : ~Code > composer create-project   laravel/laravel --no-dev --prefer-dist -vvv laravel


(4) Host 파일 설정하기

  -- 웹페이지 접속을 위한 도메인 등록

# %WINDIR%\System32\drivers\etc\hosts
192.168.10.10    homestead.app


   

(5) Vagrant Box 실행

    -- boot the VM & 자동으로 공유폴더와 Nginx 사이트를 구성한다.

C:\Users\[계정명]\Homestead\
C:\Users\[계정명]\Homestead\vagrant up
C:\Users\[계정명]\Homestead\

=> 이때  /.ssh/id_rsa가 Not Found일때 : > ~/.ssh/ssh-keygen 실행


$ ssh-keygen -t rsa Generating public/private rsa key pair. Enter file in which to save the key (/c/Users/[계정명]/.ssh/id_rsa): /c/Users/[계정명]/.ssh/id_rsa already exists. Overwrite (y/n)? y Enter passphrase (empty for no passphrase): Enter same passphrase again:


=> 동시에 C:\Users\[계정명]\VirtualBox VMs에 폴더가 Homestead-xx 생긴다.


=> Console ,  userid/password : vagrant/vagrant


=> destroy시 : > vagrant destroy --force


=> SSH auth에서 에러 발생시, 아래 config.ssh.forward_agent = true를 Vagrantfile내에 추가



(6) Vagrant ssh 실행


C:\Users\[계정명]\Homestead\
C:\Users\[계정명]\Homestead\vagrant ssh
C:\Users\[계정명]\Homestead\

=> 접속 실패시 


1) config.ssh.forward_agent = true를 Vagrantfile내에 추가

Vagrant.configure("2") do |config| config.ssh.private_key_path = "~/.ssh/id_rsa" config.ssh.forward_agent = true end

2) id_rsa.pub 복사


~/.ssh/id_rsa.pub@guest 파일 내용을 ~/.ssh/authorized_key@host에 추가


 참조 : http://stackoverflow.com/questions/22922891/vagrant-ssh-authentication-failure



=> 추가로 다중 프로젝트(Laravel 어플리케이션) 생성하기

> vagrant ssh
> cd Code
> laravel new example

#수정하기 
#./homestead/Homestead.yaml

sites:
    - map: homestead.app
      to: /home/vagrant/Code/Laravel/public

    - map: example.app
      to: /home/vagrant/Code/example/public

databases:
    - homestead
    - example




==> 원문 : 


https://laravel.com/docs/5.1/homestead



Homestead environment ( Port Forward , 충돌시 변경되므로 부팅 로그를 확인) :

    • SSH: 2222 → Forwards To 22
    • HTTP: 8000 → Forwards To 80
    • HTTPS: 44300 → Forwards To 443
    • MySQL: 33060 → Forwards To 3306
    • Postgres: 54320 → Forwards To 5432



==> 참고:


https://goo.gl/lRnC8k ( vagrant로 node 개발 환경 구성 하기 )


http://mobicon.tistory.com/322 ( vagrant 개발 환경 구축 및 애플리케이션 공유하기 )

--> Node.js + MongoDB 개발환경


http://l5.appkr.kr/lessons/02-install-homestead-windows.html 

( Homestead 설치 (on Windows) )

--> SSH 설정, MySQL 접속(id/pw: homestead/secret)


http://m.blog.naver.com/two4zero/220602350718 ( laravel - Homestead 설치 )


http://k-story.tistory.com/333 (VirtualBox에서 xshell 연동하기.)

--> Virtual Box 네트워크 어댑터, 포트 포워딩 설정 ( 호스트 IP, 게스트 IP )


http://stackoverflow.com/questions/29450404/is-there-a-default-password-to-connect-to-vagrant-when-using-homestead-ssh-for ( 연결에 사용되는 default password )

--> vagrant@127.0.0.1's password:


* 기타 설치 에러 A:



Q : VBoxManage.exe hostonlyif create에러가 발생 할때

C:\Program Files\Oracle\VirtualBox\>VBoxManage.exe hostonlyif create
0%...
Progress state: E_FAIL
VBoxManage.exe: error: Failed to create the host-only adapter
VBoxManage.exe: error: Code E_FAIL (0x80004005) - Unspecified error
 (extended info not available)
VBoxManage.exe: error: Context: "int __cdecl handleCreate(struct HandlerArg *,int,int *)" 
at line 66 of file VBoxManageHostonly.cpp

Answer 1 : kaspersky 언인스톨, NDIS6 브릿지 드라이버 설청

Hi,
I found a solution preventing you to uninstall Kaspersky.
You have to install manually the VirtualBox Network drivers. You can found those drivers here :
C:\Program Files\Oracle\VirtualBox\drivers\network
There is two folders, go inside both of them and right click install on the *.inf files.
Now the installation of hosts only virtual networks adapters should be nice but don't boot up. You have to manually install a new service on your "VirtualBox Host-Only Network" adapter.
go to the network adapters list
right click on this network adapter choose "Properties"
click on the "Install..." button and add a service
choose The Manufacturer "Oracle Corporation" and the network service named "VirtualBox NDIS6 Bridged Networking driver".
Validate all the windows, and all should be OK. 

Answer 2 : 네트웍 설정 ( Virtual Box )을 아래와 같이 수정


https://www.virtualbox.org/ticket/14040






* ssh-config 확인하는 방법


> vagrant ssh-config
Host default
HostName 127.0.0.1
User vagrant
Port 2222
UserKnownHostsFile /dev/null
StrictHostKeyChecking no
PasswordAuthentication no
IdentityFile "/Users/MYUSER/.vagrant.d/insecure_private_key"
IdentitiesOnly yes
LogLevel FATAL
ForwardAgent yes



* 기타 설치 에러 B:


Q : Warning: Authentication failure. Retrying...이 지속적으로 발생할때


==> default: Forwarding ports...
default: 80 => 8080 (adapter 1)
default: 22 => 2222 (adapter 1)
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
default: SSH address: 127.0.0.1:2222
default: SSH username: vagrant
default: SSH auth method: private key
default: Warning: Connection timeout. Retrying...
default: Warning: Authentication failure. Retrying...
default: Warning: Authentication failure. Retrying...
default: Warning: Authentication failure. Retrying...
default: Warning: Authentication failure. Retrying...
default: Warning: Authentication failure. Retrying...

실제 해결된 방법은 config.ssh.forward_agent = true를 Vagrantfile내에 추가하면 되었다.



Answer 1 : NAT -> Advanced 설정


http://stackoverflow.com/questions/40968297/laravel-homestead-hangs-at-ssh-auth-method-private-key-on-mac



Answer 2  : config.vm.boot_timeout = 600 을 추가하기


http://es.stackoverflow.com/questions/36242/error-config-vm-boot-timeout-en-vagrant-up-para-homestead



-- config.vm.boot_timeout = 600 ( Vagrantfile내에 추가 )

    config.vm.boot_timeout = 600 

    if File.exist? homesteadYamlPath then
        settings = YAML::load(File.read(homesteadYamlPath))
    elsif File.exist? homesteadJsonPath then
        settings = JSON.parse(File.read(homesteadJsonPath))
    end



Answer 3  : private key를  host 등록하기  


https://github.com/mitchellh/vagrant/issues/5186


0. vagrant ssh-config를 통해 IdentifyFile위치 확인 insecure_private.key.pub 내용 복사

$ vagrant ssh-config
Host default
  HostName 127.0.0.1
  User vagrant
  Port 2222
  UserKnownHostsFile /dev/null
  StrictHostKeyChecking no
  PasswordAuthentication no
  IdentityFile C:/Users/admin/.vagrant.d/insecure_private_key
  IdentitiesOnly yes
  LogLevel FATAL
  ForwardAgent yes

1. vagrant up중에 default: Warning: Authentication failure. Retrying...반복시에 중단

2. vagrant ssh접속 시도, passsword를 입력요청시에 vagrant를 입력
3. insecure_private.key.pub를 복사해서 ~/.ssh/authorized_keys에 추가 4. vagrant halt후에 vagrant up --provision으로 재시작

<예제>

    
    config.ssh.private_key_path = File.expand_path('~/.ssh/id_rsa')
    config.vm.boot_timeout = 600 

    if File.exist? homesteadYamlPath then
        settings = YAML::load(File.read(homesteadYamlPath))
    elsif File.exist? homesteadJsonPath then
        settings = JSON.parse(File.read(homesteadJsonPath))
    end


vagrant 실행 화면 ( 정상적인 상황 )
    
$ vagrant reload --provision
==> homestead-7: Attempting graceful shutdown of VM...
    homestead-7: Guest communication could not be established! This is usually because
    homestead-7: SSH is not running, the authentication information was changed,
    homestead-7: or some other networking issue. Vagrant will force halt, if
    homestead-7: capable.
==> homestead-7: Forcing shutdown of VM...
==> homestead-7: Checking if box 'laravel/homestead' is up to date...
==> homestead-7: Clearing any previously set forwarded ports...
==> homestead-7: Clearing any previously set network interfaces...
==> homestead-7: Preparing network interfaces based on configuration...
    homestead-7: Adapter 1: nat
    homestead-7: Adapter 2: hostonly
==> homestead-7: Forwarding ports...
    homestead-7: 80 (guest) => 8000 (host) (adapter 1)
    homestead-7: 443 (guest) => 44300 (host) (adapter 1)
    homestead-7: 3306 (guest) => 33060 (host) (adapter 1)
    homestead-7: 5432 (guest) => 54320 (host) (adapter 1)
    homestead-7: 22 (guest) => 2222 (host) (adapter 1)
==> homestead-7: Running 'pre-boot' VM customizations...
==> homestead-7: Booting VM...
==> homestead-7: Waiting for machine to boot. This may take a few minutes...
    homestead-7: SSH address: 127.0.0.1:2222
    homestead-7: SSH username: vagrant
    homestead-7: SSH auth method: private key
    homestead-7: Warning: Authentication failure. Retrying...
    homestead-7: Warning: Authentication failure. Retrying...
    homestead-7: Warning: Authentication failure. Retrying...
    homestead-7: Warning: Authentication failure. Retrying...
	....
    homestead-7: Warning: Authentication failure. Retrying...
    homestead-7: Warning: Authentication failure. Retrying...
    homestead-7: Warning: Authentication failure. Retrying...
==> homestead-7: Machine booted and ready!
==> homestead-7: Checking for guest additions in VM...
    homestead-7: The guest additions on this VM do not match the installed version of
    homestead-7: VirtualBox! In most cases this is fine, but in rare cases it can
    homestead-7: prevent things such as shared folders from working properly. If you see
    homestead-7: shared folder errors, please make sure the guest additions within the
    homestead-7: virtual machine match the version of VirtualBox you have installed on
    homestead-7: your host and reload your VM.
    homestead-7:
    homestead-7: Guest Additions Version: 5.1.10
    homestead-7: VirtualBox Version: 4.3
==> homestead-7: Setting hostname...
==> homestead-7: Configuring and enabling network interfaces...
==> homestead-7: Mounting shared folders...
    homestead-7: /vagrant => C:/Users/admin/Homestead
    homestead-7: /home/vagrant/Code => C:/Users/admin/Code
==> homestead-7: Running provisioner: file...
==> homestead-7: Running provisioner: shell...
    homestead-7: Running: inline script
==> homestead-7: Running provisioner: shell...
    homestead-7: Running: inline script
==> homestead-7: Running provisioner: shell...
    homestead-7: Running: inline script
==> homestead-7: Running provisioner: shell...
    homestead-7: Running: C:/Users/admin/AppData/Local/Temp/vagrant-shell20170103-6508-1tmfveg.sh
==> homestead-7: Running provisioner: shell...
    homestead-7: Running: script: Creating Site: homestead.app
==> homestead-7: Running provisioner: shell...
    homestead-7: Running: script: Creating Site: example.app
==> homestead-7: Running provisioner: shell...
    homestead-7: Running: script: Restarting Nginx
==> homestead-7: Running provisioner: shell...
    homestead-7: Running: script: Creating MySQL Database: homestead
==> homestead-7: Running provisioner: shell...
    homestead-7: Running: script: Creating Postgres Database: homestead
==> homestead-7: Running provisioner: shell...
    homestead-7: Running: script: Creating MySQL Database: example
==> homestead-7: Running provisioner: shell...
    homestead-7: Running: script: Creating Postgres Database: example
==> homestead-7: Running provisioner: shell...
    homestead-7: Running: script: Clear Variables
==> homestead-7: Running provisioner: shell...
    homestead-7: Running: script: Update Composer
==> homestead-7: Updating to version 1.3.0 (stable channel).
==> homestead-7:     Downloading: Connecting...                                               Downloadi         ng: 100%
==> homestead-7: Use composer self-update --rollback to return to version 1.2.3
==> homestead-7: Running provisioner: shell...
    homestead-7: Running: C:/Users/admin/AppData/Local/Temp/vagrant-shell20170103-6508-inqc9i.sh


블로그 이미지

StartGuide

I want to share the basic to programming of each category and how to solve the error. This basic instruction can be extended further. And I have been worked in southeast Asia more than 3 years. And I want to have the chance to work another country.

,
노출되는 이미지가 불편하시겠지만 양해를 구합니다. 노출, 클릭등에 관한 자료로 활용 중입니다.


Laravel(라라벨) 기초 요약

( 주로 Laravel 5.0~5.2 )





1) 어플리케이션 키



-- 세션 데이타를 암호화 하거나 laravel의 암호 패키지인 Crypt클래스로 암/복호화할떄 사용


-- composer나 installer가 프로젝트를 생성시에는 마지막 단계에서 키가 자동 생성됨


-- 임의로 직접 생성 : php artisan key:generate


-- 생성된 APP_KEY는 .env에 저장됨

   : 여러대의 서버를 운영할때는 동일 .env 파일을 사용해야 함


-- 키가 설정되어 있지 않다면, config/app.php에 설정된 기본키를 사용(보안 취약)




2) 설정 파일



-- 데이타 베이스 : config/database.php


    : key/value형식의 배열로 관리


    ex) 'host' => env('DB_HOST', 'localhost')

        : 환경 설정파일인 .env에서 DB_HOST항목을 읽고, 없으면 localhost를 사용


    : 'default' => 'mysql' 의 수정으로 데이타베이스 변경


-- 파일을 위한 캐시 : config/cache.php


-- 메일 설정 : config/mail.php


-- laravel 환경 설정 : config/app.php


    : 'debug' => env('APP_DEBUG', false) 에서 true로 변경하면


    : 'timezone' => 'Asia/Seoul'


    : 'url' => 'http://sample.com'

 

    : 'locale' => 'ko'   # 기본 locale은 en으로 되어 있음


    : 'log' => env('APP_LOG', 'single')  # 어플로그를 단일 파일로 로그는 남기는 설정


        ex) storage/logs/laravel.log 




3) laravel routing(라우팅)





-- url routing은 클라이언트가 요청한 url과 요청방식(get,post,delete,put등)에 따른 서버의 처리방식을 지정


-- Pretty UTL은 RESTful 기반의 웹서비스 제공


   ex) index.php?action=view&article=123


   ex) index.php/view/article/123


-- MVC패턴의 가장 앞에 위치하여 Front Controller라고 함


-- 라우팅 설정 : app/Http/routes.php ( Laravel 5.0~5.2 )

-- 라우팅 설정 : routes/web.php ( Laravel 5.3 )



--- 기본적인 라우트


Route::get('hello', function() {
    return 'Hello!';
});


--- 계층 구조


Route::get('hello/world', function(){
    return 'Hello World!';
});


--- 파라미터 전달

Route::get('hello/world/{name}', function($name){
    return 'Hello World!' . $name ;
});


--- 파라미터 전달 ( null 또는 default )

Route::get('hello/world/{name?}', function($name=null){
     return 'Hello World!' . $name ;
});


4) HTTP 응답


--- Response Class 사용


use Illuminate\Http\Response;
Route::get('hello/world/{name}', function(name) {
    $response = new Response('Hello World', $name, 200);
     return $response;
});


* use구문 선언과, new 객체를 통해 생성 번거롭다



--- response Helper Class 사용 ( use, new를 사용 안함)


Route::get('hello/world/{name}', function(name){
    $response = new Response('Hello World', $name, 200);
     return response('Hello World'. $name, 200)->header('Content-Type','text/plain');
});


* Method Chaining 가능 / 다중 헤더 설정



Route::get('hello/world/{name}', function(name){
    $response = new Response('Hello World', $name, 200);
    return response('Hello World'. $name, 200)
     ->header('Content-Type','text/plain')
     ->header('Cache-Control','max-age=' . 60*60. ".must-revalidate")  
});



* JSON 데이타 형식



Route::get('hello/world/{name}', function(name){
    $data = ['name' => 'Iron Man', 'gender'=>'Man'];
    return response()->json($data);
});


5) Views


--- View Class 사용 ( 점(.)을 계층 구분 )


Route::get('hello/html', function() {
    return View::make('hello.html');
});


* 위치 : resources/views/hello/html.php ( Views위치는 Laravel 5.0~5.3 동일 )


(laravel의 모든 view는 resources/view폴더에 위치 )



--- view Helper Class 사용

Route::get('hello/html', function() {
    return view('hello.html');
});

});


--- view에 변수 전달 


1) app/http/routes.php


 

Route::get('task/view', function() {
    $task = ['name' => 'Task 1', 'due_date' => '2015-06-01 12:00:11'];
 
    return view('task.view')->with('task', $task);
});



2) resource/views/task/view.php


 

< !doctype html >
< html lang="ko">
 <head>
     <meta charset="UTF-8">
     <title>Ok</title>
 </head>
 <body>
     <h1>할일 정보</h1>
     <p> 할 일: <?= $task['name'] ?></p>
     <p> 기 한:   <?= $task['due_date'] ?></p>
 </body>
</html>



6) Blade


: laravel에 포함 되어 있는 Template Engine

: 기본 View와 구분하기 위해 Blade Template 파일은 .blade.php의 확장자 사용


-- 변수 출력 : {{ $var }} 를 사용 ( <?= $var ?> 과 동일한 기능)

    : XSS, Cross-Site Scripting의 악의적인 자바스크립트 동작 막기

 
<!doctype html>
<html lang="ko">
 <head>
     <meta charset="UTF-8">
     <title>Ok</title>
 </head>
 <body>
     <h1>할일 정보</h1>
     <p> 작 업: {{ $task['name'] }} </p>
     <p> 기 한: {{ $task['due_date'] }} </p>
 </body>
</html>

-- 조건문 : 키워드 앞에 @를 붙여 준다.

1) 기존 php 코드
 
= 5) { ?>
 

는 5 보다 큽니다.

* php의 복잡한 코드는 가독성도 떨어지고, 실수할 여지가 많다. 2) Blade 조건문
 
@if ($num > 5)
 

{{ $num }} 는 5 보다 큽니다.

@else

{{ $num }} 은 5보다 작습니다.

@endif


7) Layout 상속


1) resources/views/layouts/master.blade.php
<!DOCTYPE html>
<html lang='ko'>
<head>
    <meta charset='utf-8'>
    <title> @yield('title')</title>
    <link href='https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css' rel='stylesheet'>
</head>
<body>
    <div class='container'>
        @yield('content')
    </div>
</body>
</html> 


* @yield : 자식 컨텐츠에 구현하도록 양보하는 키워드 ( @section 키워드로 구현 )
* @extends : 자식 페이지는 상속할 부모 템플릿을 extends 키워드로 지정
2) resources/views/task/list3.blade.php
 
@extends('layouts.master')
@section('title')
    할일 목록
@endsection
  
@section('content')
    
        @foreach($tasks as $task)
            
        @endforeach
        
할 일 기 한
{{ $task['name'] }} {{ $task['due_date'] }}
@endsection

* Layout 상속 : https://www.lesstif.com/pages/viewpage.action?pageId=24445482



8) Blade 디버깅


- Blade Template : Blade Compiler -> Legacy PHP Code(파일명 변경됨) ->PHP Engine




- 컴파일된 파일 : storage/framework/view 폴더에 위치



원문 :

https://www.lesstif.com/pages/viewpage.action?pageId=28606603

쉽게 배우는 라라벨5 프로그래밍, 2016, Sep



블로그 이미지

StartGuide

I want to share the basic to programming of each category and how to solve the error. This basic instruction can be extended further. And I have been worked in southeast Asia more than 3 years. And I want to have the chance to work another country.

,
노출되는 이미지가 불편하시겠지만 양해를 구합니다. 노출, 클릭등에 관한 자료로 활용 중입니다.



SVN 연결 해제, 재연결 in Eclipse



eclipse 프로젝트 트리에서 ( 즉, project or package explorer )




1. 연결 해제


-해당 프로젝트 위에서 우측 마우스 클릭


- team ->disconnect 선택



* 재연결을 위해서는 삭제 안하기를 선택




2. 재연결


-해당 프로젝트 위에서 우측 마우스 클릭


- team ->share project 선택





http://www.thinkplexx.com/learn/howto/scm/svn/disconnect-and-reconnect-svn-project-to-another-location-subclipse-version

'Web Tech. > Spring Framework' 카테고리의 다른 글

HMAC SHA-256 이해  (0) 2017.01.24
Tomcat JDBC Connection Pool  (0) 2016.12.20
eclipse(이클립스), 색상 테마 (color theme) 변경  (0) 2016.12.06
Ramda 표현식  (0) 2016.11.15
Java IO Package  (0) 2016.11.15
블로그 이미지

StartGuide

I want to share the basic to programming of each category and how to solve the error. This basic instruction can be extended further. And I have been worked in southeast Asia more than 3 years. And I want to have the chance to work another country.

,
노출되는 이미지가 불편하시겠지만 양해를 구합니다. 노출, 클릭등에 관한 자료로 활용 중입니다.



Laravel를 xampp에 설치하기 ( windows 기준 )




1. 사전 준비 ( 설치된 상태라면, pass )



1) xampp 설치하기


다운로드




2) composer설치하기 ( 설치후 composer명령어 실행으로 정상 설치여부를 확인 )


다운로드 : Composer-Setup.exe






2. xampp 구성 변경하기



1) 도메인 정하고, virtual hosts 수정하기


virtual host등록 위치 : [ C:\xampp설치위치]\apache\conf\extra\httpd-vhosts.conf


# VirtualHost for LARAVEL.DEV

<virtualhost laravel.dev:80>
    DocumentRoot "C:\xampp\htdocs\laravel\public"
    ServerAdmin laravel.dev
    <directory "c:\xampp\htdocs\laravel">
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
    </directory>
</virtualhost>


샘플 도메인 : laravel.dev


# localhost name resolution is handled within DNS itself.
#    127.0.0.1       localhost
#    ::1             localhost

127.0.0.1    laravel.dev


시스템 host 등록(관리자권한으로 편집) : c:\windows\system32\drivers\etc\hosts




2) install laravel 명령어 실행


위치 : htdocs폴더


명령어 : composer create-project laravel/laravel {laravel} "5.1.*"


* 실행 결과 : Laravel를 다운로드하고 설치

* {laravel} : 현재 위치에 생성될 프로젝트명(폴더명으로 사용)





* xampp 실행후 웹 화면







원문 :

https://www.codementor.io/magarrent/tutorials/how-to-install-laravel-5-xampp-windows-du107u9ji


유사 페이지 :


https://laravel.com/docs/5.3/installation#installing-laravel




설치 이후 


한글 강좌는 아래 링크로...


https://www.lesstif.com/pages/viewpage.action?pageId=28606603




영문 강좌 사이트는...

https://www.tutorialspoint.com/laravel/index.htm




할일 목록 ( Task List ) 만들기


https://laravel.com/docs/5.1/quickstart

블로그 이미지

StartGuide

I want to share the basic to programming of each category and how to solve the error. This basic instruction can be extended further. And I have been worked in southeast Asia more than 3 years. And I want to have the chance to work another country.

,
노출되는 이미지가 불편하시겠지만 양해를 구합니다. 노출, 클릭등에 관한 자료로 활용 중입니다.


JavaScript 파일을 강제로 갱신하기(JS 자동 업데이트)


1. ?version추가


2. 1일 제한, 항상 최신

Cache-Control: max-age=86400, must-revalidate Cache-Control: no-cache, must-revalidate


3. 강제 갱신(ASP.NET)


4. 파라미터에 파일크기를 추가하기


원문 :

http://stackoverflow.com/questions/32414/how-can-i-force-clients-to-refresh-javascript-files


참조

http://kanu.tistory.com/30  JS, CSS 파일의 수정한 내용 적용 안될때 처리 방법



블로그 이미지

StartGuide

I want to share the basic to programming of each category and how to solve the error. This basic instruction can be extended further. And I have been worked in southeast Asia more than 3 years. And I want to have the chance to work another country.

,
노출되는 이미지가 불편하시겠지만 양해를 구합니다. 노출, 클릭등에 관한 자료로 활용 중입니다.


Eclipse, 색상 테마 (color theme) 변경



-foreground, background, class, method, string, operator, keyword등등


1. Eclipse Marketplace를 통해, Color Theme 설치하기


설치후 변경 메뉴 :



2. 추가 테마 다운로드

http://www.eclipsecolorthemes.org/



1) Import XML


2) Import EPF(Eclipse Preference) , without install plugin 


추천 1

Monokai Soda Sublime Text  : http://www.eclipsecolorthemes.org/?view=theme&id=6862


추천 2

Sublime Scala : http://www.eclipsecolorthemes.org/?view=theme&id=11461



원문 :

https://www.mkyong.com/eclipse/how-to-change-eclipse-theme/


제거하기

Navigate to Windows>Preferences>Java>Editor.
Click on Syntax Coloring.
Click "Restore Defaults" and "Apply".

Then, navigate to General>Editors.
Click on Text Editors.
Click on "Restore Defaults" and "Apply".



'Web Tech. > Spring Framework' 카테고리의 다른 글

Tomcat JDBC Connection Pool  (0) 2016.12.20
SVN 연결 해제, 재연결  (0) 2016.12.15
Ramda 표현식  (0) 2016.11.15
Java IO Package  (0) 2016.11.15
java.util Collection Framework  (0) 2016.11.14
블로그 이미지

StartGuide

I want to share the basic to programming of each category and how to solve the error. This basic instruction can be extended further. And I have been worked in southeast Asia more than 3 years. And I want to have the chance to work another country.

,
노출되는 이미지가 불편하시겠지만 양해를 구합니다. 노출, 클릭등에 관한 자료로 활용 중입니다.

선호도 높은 16개의 웹 디자인 폰트(2007년 기준..)


-Helvetica, Arial

-Verdana

-Georgia

-Trebuchet

-Century Gothic ( ? 이 편집기는 지원 안됨 )

-Lucida Grande ( ? 이 편집기는 지원 안됨 )




출처 :

This article is the 2nd one in the Web Design series. It was inspired and partially based on the results of the interviews conducted with 35 web designers by Smashing Magazine.

http://www.inspirationbit.com/16-best-loved-font-bits-in-web-design/



* Word에서 사용하면 좋은 글꼴



http://www.officetutor.co.kr/board/faq_lib/frm_vba_content.asp?page=8&idx=65


블로그 이미지

StartGuide

I want to share the basic to programming of each category and how to solve the error. This basic instruction can be extended further. And I have been worked in southeast Asia more than 3 years. And I want to have the chance to work another country.

,