# httpd -v
# httpd 2.2.14
# php -v
# php 5.3
# chcon -R -t httpd_user_content_t /home/mfg
# vi /etc/selinux/config
#SELINUX=enforcing
SELINUX=disabled
SELINUXTYPE=targeted
ServerName app.madforgarlic.com
ServerAdmin mfg@madforgarlic.com
DocumentRoot "/home/mfg/www"
Alias /media "/home/mfg/media"
<Directory />
Option FollowSymLinks
AllowOverride FileInfo
Order allow,deny
Allow from all
</Directory>
## Oracle Client
rpm -ivh oracle-instantclient11.2-basic-11.2.0.4.0-1.x86_64.rpm
rpm -ivh oracle-instantclient11.2-devel-11.2.0.4.0-1.x86_64.rpm
## PHP 컨피그 설치 다시
** DB Pool 정보 확인
https://github.com/jjang9b/CodeIgniter_sqlrelay
20여년간 외식전문기업에서 디지털전화과 혁신에 관한 일을 하면서 경험하게 된 다양한 이야기를 나만의 방식으로 풀어 내고자 한다. 외식기업 뿐 아니라 소상공인 모두 지속가능한 성장을 위해서 이제는 반드시 필요 한 것이 디지털 기술의 활용이며 우리의 변화가 필요 하다.
2015년 4월 13일 월요일
[Linux] Basic Command - tar
[root@test /]> tar cvf FileNames.tar FolderNames[root@test /]> tar cvfz FileNames.tar.gz FolderNames[root@test /]> tar cvfz FileNames.tar FolderNames
[root@test /]> tar xvfz FileNames.tar.gz
[root@test /]> tar xvf FileNames.tar
2015년 3월 17일 화요일
2015년 1월 29일 목요일
[Windows 7] ODBC 설정시 Oracle Driver 설정 방법
과거 응용프로그램들 또는 설정을 해야 하는 경우가 간혹 발생을 하게 되는데 Windows7을 사용하지만 잘 알지 못하는 경우가 대부분이다.
평상시 처럼 제어판에 있는 ODBC를 열고나서 설정해야지 했더니 보이지 않는다. 앗 뭐지 잠시 생각하다가 뭔가 분명 32Bit와 64비트의 차이가 있을 것이다라는 흠짓한 생각들이 들면서 알게된 내용 누군가를 위하다기 보다는 내 스스로가 또 지나면 잊어 버릴 듯 하여 남겨 놓는다.
Oracle ODBC 드라이버가 32 Bit 이기 때문입니다. 따라서 "데이터 원본(ODBC)"을 32bit 모드로 실행을 하면 사용이 가능 하다.
1. Run CMD
2. C:\>%systemroot%\SysWOW64\odbcad32.exe Enter
3. 뭐 나머지야 설정 하면 되겠지?
<< 오늘도 이래저래 주저리 주저리 궁시렁 궁시렁... 삽질 하지 않는 그날까지.>>
평상시 처럼 제어판에 있는 ODBC를 열고나서 설정해야지 했더니 보이지 않는다. 앗 뭐지 잠시 생각하다가 뭔가 분명 32Bit와 64비트의 차이가 있을 것이다라는 흠짓한 생각들이 들면서 알게된 내용 누군가를 위하다기 보다는 내 스스로가 또 지나면 잊어 버릴 듯 하여 남겨 놓는다.
Oracle ODBC 드라이버가 32 Bit 이기 때문입니다. 따라서 "데이터 원본(ODBC)"을 32bit 모드로 실행을 하면 사용이 가능 하다.
1. Run CMD
2. C:\>%systemroot%\SysWOW64\odbcad32.exe Enter
3. 뭐 나머지야 설정 하면 되겠지?
<< 오늘도 이래저래 주저리 주저리 궁시렁 궁시렁... 삽질 하지 않는 그날까지.>>
2015년 1월 26일 월요일
[Power Builder] datawindow.Update() option Example
오랜시간 PowerBuilder 사용하고 있으나 실상을 뒤집어 보면 아는게 별로 없는 허접한 개발자 맞다. 이제서야 정확한 이 옵션의 의미를 이해 했다는 것은 편의성이 가져다 주는 오만함을 심어 줬던것은 아니었을까. 역시나 내 무식함을 오늘도 한번 다시 느낀다.
Reference URL
http://infocenter.sybase.com/archive/index.jsp?topic=/com.sybase.help.pb_10.5.pbug/html/pbug/BHBHDIEG.htm
Example
Consider this situation: a DataWindow object is updating the Employee table, whose key is Emp_ID; all columns in the table are updatable. Suppose the user has changed the salary of employee 1001 from $50,000 to $65,000. This is what happens with the different settings for the WHERE clause columns:
If you choose Key Columns for the WHERE clause, the UPDATE statement looks like this:
UPDATE Employee
SET Salary = 65000
WHERE Emp_ID = 1001
This statement will succeed regardless of whether other users have modified the row since your application retrieved the row. For example, if another user had modified the salary to $70,000, that change will be overwritten when your application updates the database.
If you choose Key and Modified Columns for the WHERE clause, the UPDATE statement looks like this:
UPDATE Employee
SET Salary = 65000
WHERE Emp_ID = 1001
AND Salary = 50000
Here the UPDATE statement is also checking the original value of the modified column in the WHERE clause. The statement will fail if another user changed the salary of employee 1001 since your application retrieved the row.
If you choose Key and Updatable Columns for the WHERE clause, the UPDATE statement looks like this:
UPDATE Employee
SET Salary = 65000
WHERE Emp_ID = 1001
AND Salary = 50000
AND Emp_Fname = original_value
AND Emp_Lname = original_value
AND Status = original_value
Reference URL
http://infocenter.sybase.com/archive/index.jsp?topic=/com.sybase.help.pb_10.5.pbug/html/pbug/BHBHDIEG.htm
Example
Consider this situation: a DataWindow object is updating the Employee table, whose key is Emp_ID; all columns in the table are updatable. Suppose the user has changed the salary of employee 1001 from $50,000 to $65,000. This is what happens with the different settings for the WHERE clause columns:
If you choose Key Columns for the WHERE clause, the UPDATE statement looks like this:
UPDATE Employee
SET Salary = 65000
WHERE Emp_ID = 1001
This statement will succeed regardless of whether other users have modified the row since your application retrieved the row. For example, if another user had modified the salary to $70,000, that change will be overwritten when your application updates the database.
If you choose Key and Modified Columns for the WHERE clause, the UPDATE statement looks like this:
UPDATE Employee
SET Salary = 65000
WHERE Emp_ID = 1001
AND Salary = 50000
Here the UPDATE statement is also checking the original value of the modified column in the WHERE clause. The statement will fail if another user changed the salary of employee 1001 since your application retrieved the row.
If you choose Key and Updatable Columns for the WHERE clause, the UPDATE statement looks like this:
UPDATE Employee
SET Salary = 65000
WHERE Emp_ID = 1001
AND Salary = 50000
AND Emp_Fname = original_value
AND Emp_Lname = original_value
AND Status = original_value
2015년 1월 14일 수요일
[Struts 2] Web Application - Getting Started
#과거 2004년도에 초기 Struts 1.3 버전 때 개발을 주로 하다가 프로그래밍 안한지 6년 7년 만에 필요한 것이 있어서 다시 시작하려니 이미 많은 부분이 바뀌어서 간단하게 만드는 부분이니 Struts 을 찾아 보다 또 버전이 업그레이드 되었다.
# 간략하게 정리 하면서 샘플을 만들어 봤다. 혹 나와 같은 사람이거나 새롭게 접근하는 친구들이 있다면 도움이 될지 모르겠다.
# 그러나, 개략적인 설명의 대부분은 기존 Struts 1을 경험한 사람을 위주로 하였음을 미안하게 생각한다. 또는 기존에 Web 관련 개발을 해본 친구들이라면 함께 이해하고 넘어가는데 큰 어려움이 없을것으로 생각된다.
위 사진은 전반적인 구성을 보여주고 있다. 브라우저에서 요청이 들어 오면 일단 프론트 컨트롤러가 받아서 공통된 처리를 시행하면서 개별 처리와 뷰를 호출하는 구조로 되어 있다. 개별처리 부분에선 데이터에 대한 모델이 필요한 경우 참조하게 된다. 이구성은 기존의 Struts1 과도 동일하다는 것을 알 수 있다.
단지 차이가 좀 있다면 기존의 Struts1 에서는 로그인이나 입력되는 Form 관련 페이지에서 Form 값을 받아 주는 ActionForm 클래스를 상속받아서 처리 해줘야 하는 번거로움이 있었다. 그런데 버전 2.0 대에 오면서 이 부분이 없어졌다.
# 실행을 위한 사전 준비사항
1) web.xml파일 설정
<?xml version="1.0" encoding="UTF-8"?>
<web-app
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
id="WebApp_ID"
version="2.5">
<display-name>inv</display-name>
<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<resource-ref>
<res-ref-name>jdbc/myoracle</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>
2) Action 설정
import org.apache.struts2.dispatcher.SessionMap;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.Preparable;
import Resource;
import User;
import HrInfoService;
import HrInfoServiceImpl;
public class LoginAction extends ActionSupport implements Preparable {
private static final long serialVersionUID = 9149826260758390091L;
private User user;
private Resource resource;
private HrInfoService hrInfoService;
private String id;
private String password;
private String companyName;
public void prepare() {
resource = new Resource();
resource.setDriver(getText("driver"));
resource.setUrl(getText("url"));
resource.setUsername(getText("username"));
resource.setPassword(getText("password"));
hrInfoService = new HrInfoServiceImpl();
}
public String loginForm() {
return SUCCESS;
}
public String login() throws Exception {
User user = new User();
user.setId(this.id);
user.setPassword(this.password);
User isValidLogon = hrInfoService.authenticateLogin(resource, user);
if (isValidLogon != null) {
String id = isValidLogon.getId();
@SuppressWarnings({ "rawtypes", "unchecked" })
SessionMap<String, String> session = (SessionMap) ActionContext.getContext().getSession();
session.put("userId", id);
session.put("companyName", companyName);
return SUCCESS;
} else {
addActionError("Incorrect ID or password");
return INPUT;
}
}
// ---------------------------- Log Out register user
public String logOut() {
@SuppressWarnings("rawtypes")
SessionMap session = (SessionMap) ActionContext.getContext().getSession();
session.remove("userId");
addActionMessage("You Have Been Successfully Logged Out");
return SUCCESS;
}
public void setuser(User user) {
this.user = user;
}
public User getUser() {
return user;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
}
3) JSP 페이지 설정
<%@ page contentType="text/html; charset=UTF-8"%>
<!doctype html>
<html lang="ko">
<head>
<title>SUNATFOOD - Purchase</title>
<link rel="stylesheet" href="css/baseStyle.css" />
<!--[if IE]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
</head>
<body >
<header>
<hgroup>
<h1>Example</h1>
</hgroup>
</header>
<nav>
<ul>
<li><a href="index.jsp">Home</a></li>
<li><a href="#">About Us</a></li>
</ul>
</nav>
<article>
<section>
<header>
<h1>Beta Test HTML5 적용 (크롬브라우저 사용 권장 최적화) </h1>
</header>
<form action="/login.action" method="post">
<label for="id">LogIn ID:</label>
<input type="text" required name="id" id="id" placeholder="Enter your id" autofocus><br />
<label for="password">LogIn Password:</label>
<input type="password" required name="password" id="password" placeholder="Enter your password"><br />
<input type="submit" value="LOG-IN">
</form>
</section>
</article>
<footer>
<p>© **** All rights reserved.</p>
</footer>
</body>
</html>
4) struts.xml 작성
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN" "http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
<package name="default" extends="struts-default" namespace="/">
<!-- Login Action -->
<action name="loginForm" class="saf.hr.action.LoginAction" method="loginForm">
<result name="success">/index.jsp</result>
</action>
<action name="login" class="saf.hr.action.LoginAction" method="login">
<result name="success" type="redirect">/getPayInfoList.action</result>
<result name="input">/index.jsp</result>
</action>
<action name="logOut" class="saf.hr.action.LoginAction" method="logOut">
<result name="success" type="redirect">/loginForm.action</result>
</action>
</package>
</struts>
# 간략하게 정리 하면서 샘플을 만들어 봤다. 혹 나와 같은 사람이거나 새롭게 접근하는 친구들이 있다면 도움이 될지 모르겠다.
# 그러나, 개략적인 설명의 대부분은 기존 Struts 1을 경험한 사람을 위주로 하였음을 미안하게 생각한다. 또는 기존에 Web 관련 개발을 해본 친구들이라면 함께 이해하고 넘어가는데 큰 어려움이 없을것으로 생각된다.
[이미지출처 - 스프링3입문]
위 사진은 전반적인 구성을 보여주고 있다. 브라우저에서 요청이 들어 오면 일단 프론트 컨트롤러가 받아서 공통된 처리를 시행하면서 개별 처리와 뷰를 호출하는 구조로 되어 있다. 개별처리 부분에선 데이터에 대한 모델이 필요한 경우 참조하게 된다. 이구성은 기존의 Struts1 과도 동일하다는 것을 알 수 있다.
단지 차이가 좀 있다면 기존의 Struts1 에서는 로그인이나 입력되는 Form 관련 페이지에서 Form 값을 받아 주는 ActionForm 클래스를 상속받아서 처리 해줘야 하는 번거로움이 있었다. 그런데 버전 2.0 대에 오면서 이 부분이 없어졌다.
[이미지출처 - 스프링3입문]
# 실행을 위한 사전 준비사항
1) web.xml파일 설정
<?xml version="1.0" encoding="UTF-8"?>
<web-app
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
id="WebApp_ID"
version="2.5">
<display-name>inv</display-name>
<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<resource-ref>
<res-ref-name>jdbc/myoracle</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>
2) Action 설정
import org.apache.struts2.dispatcher.SessionMap;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.Preparable;
import Resource;
import User;
import HrInfoService;
import HrInfoServiceImpl;
public class LoginAction extends ActionSupport implements Preparable {
private static final long serialVersionUID = 9149826260758390091L;
private User user;
private Resource resource;
private HrInfoService hrInfoService;
private String id;
private String password;
private String companyName;
public void prepare() {
resource = new Resource();
resource.setDriver(getText("driver"));
resource.setUrl(getText("url"));
resource.setUsername(getText("username"));
resource.setPassword(getText("password"));
hrInfoService = new HrInfoServiceImpl();
}
public String loginForm() {
return SUCCESS;
}
public String login() throws Exception {
User user = new User();
user.setId(this.id);
user.setPassword(this.password);
User isValidLogon = hrInfoService.authenticateLogin(resource, user);
if (isValidLogon != null) {
String id = isValidLogon.getId();
@SuppressWarnings({ "rawtypes", "unchecked" })
SessionMap<String, String> session = (SessionMap) ActionContext.getContext().getSession();
session.put("userId", id);
session.put("companyName", companyName);
return SUCCESS;
} else {
addActionError("Incorrect ID or password");
return INPUT;
}
}
// ---------------------------- Log Out register user
public String logOut() {
@SuppressWarnings("rawtypes")
SessionMap session = (SessionMap) ActionContext.getContext().getSession();
session.remove("userId");
addActionMessage("You Have Been Successfully Logged Out");
return SUCCESS;
}
public void setuser(User user) {
this.user = user;
}
public User getUser() {
return user;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
}
3) JSP 페이지 설정
<%@ page contentType="text/html; charset=UTF-8"%>
<!doctype html>
<html lang="ko">
<head>
<title>SUNATFOOD - Purchase</title>
<link rel="stylesheet" href="css/baseStyle.css" />
<!--[if IE]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
</head>
<body >
<header>
<hgroup>
<h1>Example</h1>
</hgroup>
</header>
<nav>
<ul>
<li><a href="index.jsp">Home</a></li>
<li><a href="#">About Us</a></li>
</ul>
</nav>
<article>
<section>
<header>
<h1>Beta Test HTML5 적용 (크롬브라우저 사용 권장 최적화) </h1>
</header>
<form action="/login.action" method="post">
<label for="id">LogIn ID:</label>
<input type="text" required name="id" id="id" placeholder="Enter your id" autofocus><br />
<label for="password">LogIn Password:</label>
<input type="password" required name="password" id="password" placeholder="Enter your password"><br />
<input type="submit" value="LOG-IN">
</form>
</section>
</article>
<footer>
<p>© **** All rights reserved.</p>
</footer>
</body>
</html>
4) struts.xml 작성
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN" "http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
<package name="default" extends="struts-default" namespace="/">
<!-- Login Action -->
<action name="loginForm" class="saf.hr.action.LoginAction" method="loginForm">
<result name="success">/index.jsp</result>
</action>
<action name="login" class="saf.hr.action.LoginAction" method="login">
<result name="success" type="redirect">/getPayInfoList.action</result>
<result name="input">/index.jsp</result>
</action>
<action name="logOut" class="saf.hr.action.LoginAction" method="logOut">
<result name="success" type="redirect">/loginForm.action</result>
</action>
</package>
</struts>
[Struts 2] Web Application - Env. Configuration
# Reference URL - http://struts.apache.org/docs/tutorials.html
아래 문서는 내부 구성원을 위한 간략한 설정 및 설치를 위한 정보 공유에 목적이 있으며 IT의 구성 환경에 따라 달라 질 수 있으므로 개인적인 활용에는 적절하지 않을 수도 있다.
1. 개발환경
- Windows 7 64Bit Pro
- Java JDK 1.7.0_55
: http://www.oracle.com/technetwork/java/javase/downloads/index.html?ssSourceSiteId=ocomen
- Struts 2.3.16.3
: http://archive.apache.org/dist/struts/binaries/
- Spring Tool Suite (STS) R3.6.1
: https://spring.io/tools
2. 운용환경
- CentOS 6.5 64Bit
- apache Tomcat 7.0
: http://tomcat.apache.org/download-70.cgi
3. 설치 및 설정
JDK와 Struts 버전에 관한 관리를 위해서 lib 폴더는 버전별로 별도로 관리 하고 향후 STS에서 버전별 그리고 기능별로 분리 관리 하여 사용할 수 있도록 한다. 예를 들면 아래와 같은 화면으로 User Library 를 추가하여 관리 한다.
개발 하고자 하는 경우에 따라 버전별로 기능별로 구성하여 Build Path 를 구성 할 수 있다.
가장 필수가 되는 라이브러리는 데이터베이스 관련 JDBC 라이브러리 이다. 우리는 오라클 11g 를 사용하는 관계로 아래 링크의 라이브러리 파일을 추가 하여 활용 한다. 오라클의 정책이 변경되서 인지 모르겠으나 어느 시점 부터는 로그인이 필요하도록 연결되어 있으니 만일 오라클 계정이 없다면 추가 한 이후에 가능 할 것으로 생각 된다.
Oracle Database 11g Release 2 JDBC Drivers
Help URL
라이브러리 설정이 완료된 이후엔 기존 Web Application 을 연결 또는 신규로 프로젝트를 생성하여 구성한다.
우리는 기본 구성을 다음과 같이 한다.
패키지 명명 기준은 "계열사명.서브시스템.action, dao, odel, service " 로 구성한다. 또한 기본구성이 되는 properties 파일은 기준이 되는 파일을 공용 디스크에서 공유된 파일로 복사 하여 맞춘다.
피드 구독하기:
글 (Atom)
다양한 채널의 블로그 작성으로 집중이 좀 안되기도 하고 나의 회사를 운영하고 관리 하다 보니 회사의 블로그로 작성 해보는 것은 어떤가 하고 하나로 옮겨 봅니다. (주)다이닝웨이브 - 블로그 바로가기
-
웹/앱 리뉴얼 프로젝트를 진행 중에 내부에서 처리해야할 프로세스상 로직이 있었는데 오라클(데이터베이스) 단계에서 처리가 곤란하게 되어 외부서비스(웹)의 특정 URL/URI를 호출해야 되는 경우가 생겼다. 구글링으로 검색을 해도 상세히 설명 된 곳이 별...
-
# Reference URL - http://struts.apache.org/docs/tutorials.html 아래 문서는 내부 구성원을 위한 간략한 설정 및 설치를 위한 정보 공유에 목적이 있으며 IT의 구성 환경에 따라 달라 질 수 있으...
-
주로 윈도우에서 RStudio를 사용할 때는 잘 몰랐는데 이동성 때문에 Mac Ari/Book에서 사용하는 경우 한글 깨짐현상이 발생 하기도 한다. 이럴때 해야 하는 여러가지 방법이 있는데 그중에 내가 사용한 내용을 공유하고자 한다. 우선은 RS...