728x90

출처 : [FFmpeg]FFmpegをVisualStudioでコンパイル→デバッグする
Guide : How to compile ffmpeg under Windows7 and VS2012
msinttypes(ISO C9x compliant stdint.h and inttypes.h for Microsoft Visual Studio)
libav/c99-to-c89
FFmpeg 소스 빌드
FFMPEG build for Windows & VS2010 (ffmpeg 빌드)
the MinGW + MSYS environment

MinGW설치

mingw-get-setup.exe 다운로드

Path 추가

C:\MinGW\bin
C:\MinGW\msys\1.0\bin

Git 설치

http://msysgit.github.io/

Path 추가

C:\Program Files (x86)\Git\bin

yasm 설치 다운로드

vsyasm-1.2.0-win64.zip 파일을 받아 압축을 풀고,
vsyasm.exe 파일을 C:\MinGW\msys\1.0\bin 폴더에 복사

C:\MinGW\msys\1.0\msys.bat 수정

call "C:/Program Files (x86)/Microsoft Visual Studio 10.0/VC/vcvarsall.bat"
set path=C:/MinGW/bin;C:/MinGW/msys/1.0/bin;%path%

link.exe 이름 변경

D:\MinGW\msys\1.0\bin\link.exe와 msvc의 link.exe 이름이 동일해서
D:\MinGW\msys\1.0\bin\link.exe 파일명을 변경해야 컴파일 가능 (-> _link.exe)

pkg-config 설치 glib_2.28.1-1_win32.zip pkg-config_0.23-3_win32.zip

c99-to-c89 https://github.com/libav/c99-to-c89/downloads, ftp://ftp.videolan.org/pub/contrib/c99-to-c89/1.0.1/win32/


MSYS Shell 실행

C:\MinGW\msys\1.0\msys.bat 

 FFmpeg 소스 빌드

 

 - 작성중 -


728x90
728x90

출처 : [ JQUERY ] SRC 변경하기
[php] json_encode 함수가 없을때 해결 방법
AJAX 심플 예제~ json
json_encode
Iterate through elements with similar IDs ( wildcard search )

img src 변경

HTML

<img id="imgSrc" src="1.jpg">

JQuery

$("#imgSrc").bind("click", function(){
  $("#imgSrc").attr("src", "2.jpg");
});

속성값 조회

alert($("#img_reverse").attr("src"));

JQuery AJAX - PHP JSON 연동

json_encode.php (옵션 - PHP엔진에서 json_encode 함수가 지원하지 않는 경우)

<?
function json_encode($a=false){ 
	if(is_null($a)) return 'null'; 
	if($a === false) return 'false'; 
	if($a === true) return 'true'; 
	if(is_scalar($a)){ 
		if(is_float($a)) return floatval(str_replace(",", ".", strval($a))); 
		if(is_string($a)){ 
			static $jsonReplaces = array(array("\\", "/", "\n", "\t", "\r", "\b", "\f", '"'), array('\\\\', '\\/', '\\n', '\\t', '\\r', '\\b', '\\f', '\"')); 
			return '"' . str_replace($jsonReplaces[0], $jsonReplaces[1], $a) . '"'; 
		} else return $a; 
	} 
	$isList = true; 
	for($i=0, reset($a); $i<count($a); $i++, next($a)){ 
		if(key($a) !== $i){ 
			$isList = false; 
			break; 
		} 
	} 
	$result = array(); 
	if($isList){ 
		foreach($a as $v) $result[] = json_encode($v); 
		return '[' . join(',', $result) . ']'; 
	} else{ 
		foreach($a as $k => $v) $result[] = json_encode($k).':'.json_encode($v); 
		return '{' . join(',', $result) . '}'; 
	} 
}
?>

get_user_info.php (json 데이타 생성 php 소스)

<?
include "lib/config.php";

if(!function_exists("json_encode")) { 
	include "json_encode.php";
}

$sql="select * from user_info a where a.user_id = '$user_id'";
$voc_row=DBarray($sql);

$arr = array(
  'user_id' => $voc_row[user_id], 
  'name' => iconv("EUC-KR","UTF-8", $voc_row[name]), 
  'tel' => $voc_row[tel], 
  'email' => $voc_row[email]
);

echo json_encode($arr);
?>

JQuery AJAX 호출

function getUserInfo(parma_user_id) {
	$.ajax({
		url: 'get_user_info.php',
		type: 'GET',
		dataType: 'json',
		data: {
			user_id: parma_user_id
		},
		success : function(result){
			$('#user_id_text').html(result.user_id);
			$('#user_name_text').html(result.name);
			$('#user_tel_text').html(result.tel);
			$('#user_email_text').html(result.email);
		},
		error : function(XMLHttpRequest, textStatus, errorThrown) {
			alert('There was an error.');
		}
	});	
}

Dropdown Menu

출처 - Dropdown Menu

		<ol class="lnb" id="documenter_nav">
			<li><a class="current" href="<c:url value='/index.cmx'/>">홈페이지</a></li>
			<li><a href="<c:url value='/info.cmx'/>">소개</a></li>
			<li><a href="#using_retina_graphics">매뉴얼</a></li>
			<li><a href="#creating_galleries">회원가입</a></li>
			<li><a href="#last_words">결제하기</a></li>
			<li><a href="#template_elements">관리자 모드</a>
				<ol class="sub01" style="display:none;">
					<li><a href="#template_elements_columns">사용자 현황</a>
					<li><a href="#template_elements_lists">포인트 사용현황</a>
					<li><a href="#template_elements_on_off_toggle.">세부 설정</a>
				</ol>
			</li>
		</ol>

javascript

<script type="text/javascript">  
$(function(){  
 $("ol.sub").hide();  
 $("ol.lnb li").hover(function(){  
  $("ol:not(:animated)",this).slideDown("fast");  
 },  
 function(){  
  $("ol",this).slideUp("fast");  
 })
});  
</script>

반복문 each

<div class="grid1_wrap" data-last="true" style="position: relative; height: 300px;">
	<div class="grid1"
		style="position: absolute; left: 0px; top: 0px; -webkit-transition: -webkit-transform; transition: -webkit-transform; -webkit-transform: translate3d(0px, 0px, 0px);">
		<div class="grid1_inner" data-template="text/0">
			<ul class="uio_text">

			</ul>
		</div>
		
		<div id="rowDumy" style="display: none">
			<li id="row_user" class="ut_item" style="height: 80px">
				<a href="javascript:void(0);" 
					class="ut_a" data-clk="cont1">
					<span class="user_list_info"></span>
					<span id="user_status" style="color: red; font-weight: bold;"></span>
					<br/><span class="reg_date" style="display: none;">입사일자 : </span>
				</a>
			</li>
		</div>
	</div>
</div>

javascript

function getUserList(user_status) {
	//
	try {
		$.ajax({
			type: 'POST',
			url: '<c:url value="/json.cmx"/>',
			dataType: 'json',
			data: {
				cmd : 'user_data',
				subcmd : 'list',
				dept_id : ${dept_info.id}
			},
			success: function(result)
			{
				$('.grid1_wrap').height(result.data.list.length * 82);
				
				$.each(result.data.list, function(index, data)
				{
					var row = $('#row_user').clone().attr('id','user_id_' + data.id)
					row.find('.ut_a').attr('user_id',data.id).attr('user_name', data.user_name);
					row.find('.ut_a').attr('href', "javascript:goItemList("+data.id+",'"+data.user_name+"');");
					row.appendTo('.uio_text');
					
					row.find('.user_list_info').html(data.user_name);
					if (data.delete_yn == 2) {
						row.find('#user_status').html('퇴사');
					} else if (data.delete_yn == 3) {
						row.find('#user_status').html('출산휴가');
					}
					
					if (data.reg_date!=undefined) {
						var date=new Date(data.reg_date);
						row.find('.reg_date').html('입사일자 : ' + date.format("yyyy년 MM월 dd일 a/p hh시 mm분"));
					}
				});
			},
			error : function(XMLHttpRequest, textStatus, errorThrown) {
				alert('There was an error.');
			}
		});
	} catch(e) {
		alert(e);
	}
}

엘리먼트 each

		$( "li.ut_item" ).each(function( index ) {
			//console.log( index + ": " + $( this ).text() );
			$( this ).find('#btnSaveSurvey').show();
			$( this ).find('#btnSavePhoto').show();
		});

-

728x90
728x90

출처 : Spring Security 3 - 맛보기와 기본 설정의 이해
스프링 시큐리티 적용하기 (properties 인증 방법)
Spring Security를 이용한 인증 처리
AJAX Login with Spring Security

WEB-INF\web.xml

	<!-- 스프링 시큐리티 적용하기 -->
	<context-param&g
		<param-name>contextConfigLocation</param-name>
		<param-value>WEB-INF/spring-security.xml</param-value>
 	</context-param>	
	<filter>
		<filter-name>springSecurityFilterChain</filter-name>
		<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
	</filter>
	<filter-mapping>
		<filter-name>springSecurityFilterChain</filter-name>
		<url-pattern>/*</url-pattern>
	</filter-mapping>
	<listener>
  		<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
 	</listener>

WEB-INF\spring-security.xml

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:security="http://www.springframework.org/schema/security"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://www.springframework.org/schema/beans
           http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
           http://www.springframework.org/schema/security
           http://www.springframework.org/schema/security/spring-security-3.2.xsd">

	<security:http pattern="/common/css/**" security="none" />
	<security:http pattern="/common/img/**" security="none" />
	<security:http pattern="/common/js/**" security="none" />

	<security:http auto-config="true">
		<security:intercept-url pattern="/admin/**"	access="ROLE_ADMIN" />
		<security:intercept-url pattern="/**" access="IS_AUTHENTICATED_ANONYMOUSLY" />		

		<!-- 
		<security:form-login login-page="/login.do"
			login-processing-url="/j_spring_security_check.do"
			default-target-url="/loginSuccess.do" authentication-failure-url="/loginFailed.do" />

		<security:logout logout-url="/j_spring_security_logout.do"
			logout-success-url="/logout.do" invalidate-session="true" />
 		-->			
	</security:http>


	<security:authentication-manager>
		<security:authentication-provider>
            <security:user-service>
                <security:user name="admin" password="admin!@" authorities="ROLE_ADMIN" />
            </security:user-service>		
			<!-- 
			<security:user-service properties="/WEB-INF/users-config.xml" />
			 -->
		</security:authentication-provider>
	</security:authentication-manager>

</beans>

WEB-INF\users-config.xml (옵션)

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
<properties>
        <comment>users</comment>
        <entry key="admin">1111,ROLE_ADMIN,ROLE_USER</entry>
        <entry key="user">2222,ROLE_USER</entry>
</properties>

 

728x90
728x90

출처 : Chapter 19. Quartz 혹은 Timer 를 사용한 스케쥴링     

DongHoReportBatch.java

package com.blueX.batch;

import java.text.SimpleDateFormat;
import java.util.Date;

import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.scheduling.quartz.QuartzJobBean;

public class DongHoReportBatch extends QuartzJobBean {

	@Override
	protected void executeInternal(JobExecutionContext jobExecutionContext) throws JobExecutionException {
		Date dt = new Date();
		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd, hh:mm:ss a"); 
		System.out.println(sdf.format(dt).toString()); 
	}
	
	public static void main(String[] args) throws Exception {
		String[] configLocation = new String[] { "file:WebContent/WEB-INF/blueX-servlet.xml" };
		ApplicationContext context = new ClassPathXmlApplicationContext(configLocation);
	}

}

blueX-servlet.xml

	<bean class="org.springframework.scheduling.quartz.SchedulerFactoryBean" autowire="no">
		<property name="triggers">
       		<list>
	         	<ref bean="dongHoReportTrigger" />
			</list>
     	</property>
     	<property name="quartzProperties">
		    <props>
		    	<prop key="org.quartz.threadPool.class">org.quartz.simpl.SimpleThreadPool</prop>
		        <prop key="org.quartz.threadPool.threadCount">5</prop>
		        <prop key="org.quartz.threadPool.threadPriority">4</prop>
		        <prop key="org.quartz.jobStore.class">org.quartz.simpl.RAMJobStore</prop>
		        <prop key="org.quartz.jobStore.misfireThreshold">60000</prop>
			</props>
		</property>
	</bean>
	
	<bean id="dongHoReportTrigger" class="org.springframework.scheduling.quartz.SimpleTriggerBean">
		<property name="jobDetail" ref="dongHoReportJob" />
		<property name="startDelay" value="60000"/> <!-- 서버 시작후 1분후 첫 실행 -->
		<property name="repeatInterval" value="300000"/> <!-- 첫 실행 후 5분 마다 실행 -->
	</bean> 
	
	<bean id="dongHoReportJob" class="org.springframework.scheduling.quartz.JobDetailBean">
		<property name="jobClass" value="com.blueX.batch.DongHoReportBatch" />
	</bean>
728x90
728x90

DigestUtils

package bluexmas.utils;

import java.io.FileNotFoundException;
import java.io.RandomAccessFile;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

public class DigestUtils {

	public static String extractStringHashSHA256(String str){
		String SHA = ""; 
		try{
			MessageDigest sh = MessageDigest.getInstance("SHA-256"); 
			sh.update(str.getBytes()); 
			byte byteData[] = sh.digest();
			StringBuffer sb = new StringBuffer(); 
			for(int i = 0 ; i < byteData.length ; i++){
				sb.append(Integer.toString((byteData[i]&0xff) + 0x100, 16).substring(1));
			}
			SHA = sb.toString();
			
		}catch(NoSuchAlgorithmException e){
			e.printStackTrace(); 
			SHA = null; 
		}
		return SHA;
	}
	
	public static String extractFileHashSHA256(String filename) throws Exception {
		
		String SHA = ""; 
		int buff = 16384;
		try {
			RandomAccessFile file = new RandomAccessFile(filename, "r");

			MessageDigest hashSum = MessageDigest.getInstance("SHA-256");

			byte[] buffer = new byte[buff];
			byte[] partialHash = null;

			long read = 0;

			// calculate the hash of the hole file for the test
			long offset = file.length();
			int unitsize;
			while (read < offset) {
				unitsize = (int) (((offset - read) >= buff) ? buff : (offset - read));
				file.read(buffer, 0, unitsize);

				hashSum.update(buffer, 0, unitsize);

				read += unitsize;
			}

			file.close();
			partialHash = new byte[hashSum.getDigestLength()];
			partialHash = hashSum.digest();
			
			StringBuffer sb = new StringBuffer(); 
			for(int i = 0 ; i < partialHash.length ; i++){
				sb.append(Integer.toString((partialHash[i]&0xff) + 0x100, 16).substring(1));
			}
			SHA = sb.toString();

		} catch (FileNotFoundException e) {
			e.printStackTrace();
		}
		
		return SHA;
	}
	
	public static void main(String[] args) throws Exception {
		System.out.println(extractStringHashSHA256("1"));
		System.out.println(extractFileHashSHA256("a.pdf"));
	}	
}


728x90
728x90

Delphi - Http POST call

DelphiHttpPostCall.7z

procedure TForm1.Button1Click(Sender: TObject);
var
  sl : TStringList;
  ResponseStream: TMemoryStream;
  resultBytes: TBytes;
begin
  sl := TStringList.Create;
  ResponseStream := TStringStream.Create;
  try
    IdHTTP1.Request.ContentType := 'application/x-www-form-urlencoded';
    sl.Add('id=' + Edit2.Text);
    IdHTTP1.Post(Edit1.Text, sl, ResponseStream);
    ResponseStream.Position := 0;

    SetLength(resultBytes, ResponseStream.Size);
    ResponseStream.ReadBuffer(resultBytes[0], Length(resultBytes));

    Memo1.Lines.Text := TEncoding.UTF8.GetString(resultBytes);
  finally
    sl.Free;
    ResponseStream.Free;
  end;
end;
728x90
728x90

selectfield

{
	xtype : 'selectfield',
	name : 'role',
	id : 'role',
	label : '담당업무',
	useClearIcon : true,
	options : [ 
	    { text : '현장소장', value : '02' }, 
	    { text : '디자이너', value : '03' }, 
	    { text : '컨설턴트', value : '04' }
	]
}

selectfield - json 이용

job_type.json

{"d":[{ "text": "초중고등학생", "value": "초중고등학생" },
{ "text": "대학(원)생", "value": "대학(원)생" },
{ "text": "사무직", "value": "사무직" },
{ "text": "연구/개발직", "value": "연구/개발직" },
{ "text": "기술직", "value": "기술직" },
{ "text": "경영/관리직", "value": "경영/관리직" },
{ "text": "영업/마케팅", "value": "영업/마케팅" },
{ "text": "전문직", "value": "전문직" },
{ "text": "자영업", "value": "자영업" },
{ "text": "판매직", "value": "판매직" },
{ "text": "노무직", "value": "노무직" },
{ "text": "서비스직", "value": "서비스직" },
{ "text": "농업", "value": "농업" },
{ "text": "축산업", "value": "축산업" },
{ "text": "임업", "value": "임업" },
{ "text": "수산업", "value": "수산업" },
{ "text": "공무원", "value": "공무원" },
{ "text": "군경", "value": "군경" },
{ "text": "교직", "value": "교직)" },
{ "text": "예술", "value": "예술" },
{ "text": "주부", "value": "주부" },
{ "text": "기타", "value": "기타" }]}

model

Ext.regModel('d', {
	fields : [ 
		{ name : 'text', type : 'string' }, 
		{ name : 'value', type : 'string' } 
	]
});

store

Ext.regStore('JobStore', {
	model : 'd',
	autoLoad : true,
	proxy : {
		type : 'ajax',
		url : common_url + 'job_type.json',
		reader : {
			type : 'json',
			root : 'd'
		},
		extraParams: { // 파라미터 설정 부분
			cmd : 'CodeData',
			subcmd : 'inc_data',
			inc_id : m_inc_id
		}
	},
	listeners:{ // 로딩이 완료 되면 호출
		load: function(self, records, successful) {
			//dataStore.loadRawData(self.proxy.reader.rawData);
			if (dataInfo != -1) {
				Ext.getCmp("space").setValue(dataInfo.space_code);
			}
		}
	}
});

selectfield

{
	xtype : 'selectfield',
	name : 'job', // 동적로딩인 경우 필수
	id : 'job',
	label : '직업',
	useClearIcon : true,
	store: 'JobStore', //No quotes here. 
	displayField: 'text', 
	valueField: 'value', 
	placeHolder: '직업을 선택해 주세요'
}

passwordfield

{
	xtype : 'passwordfield',
	id : 'password',
	label : '비밀번호',
	useClearIcon : true
}

datepickerfield

{
	xtype: 'datepickerfield',
	destroyPickerOnHide: true,
	name : 'date',
	label: 'Start Date',
	value: new Date(),
	picker: {
		yearFrom: 1990 
	} 
}
{
	xtype : 'datepickerfield',
	id : 'start_date',
	label : '공사시작일',
	useClearIcon : true,
	picker: {   
		yearFrom: 2012,  
		yearTo : 2015,
		slotOrder: ['year', 'month' ,'day']  
	}
}

emailfield

{
	xtype : 'emailfield',
	id : 'email',
	label : '이메일',
	useClearIcon : true
}

clear forms

this.form = new Ext.form.FormPanel();
 
// And somewhere else
this.form.getForm().reset(); // doesn't work

confirm 창

var ret = confirm("정말로 삭제 하시겠습니까?");
if (ret) {
	Ext.Ajax.request({
		url: 'json',
		params : {
			cmd : 'IncidentDong',
			subcmd : 'delete',
			id : m_dong_id
		},
		success: function(response, opts) {
			var JsonData = JSON.parse(response.responseText);
			if(JsonData.data.err == "") {
				ns_incident_dong_list.panel_list.getList(m_inc_id);
			} else {
				alert(JsonData.data.err);
			}
		}
	});
}

x-list-item-body

dataList = new Ext.List({
	title: 'Incident목록',
	store: dataStore,
	scroll: false, // <-- 여기 중요
	layout:'fit', // <-- 여기 중요
	blockRefresh:true,
	onItemDisclosure: {
		handler: function(record, btn, index) {
			//alert(record.get('no'));
			/*
			ns_incident_write.init();
			ns_incident_write.panel.getInfoData(record.get('id'));
			main.MainPanel.setActiveItem(ns_incident_write.panel, "slide");
			*/
			overlay.setCentered(true);
			overlay.setIncID(record.get('id'));
			overlay.show();
		}
	},
	listeners: {
		itemtap: function(list, index, el, event){
			if (event.getTarget('.x-list-item-body')) {
				//alert('index =' + index);                	
				var record = this.store.getAt(index);
				ns_incident_list.panel_list.goNextPage(record.get('id'));
			}
		}
		/*
		el: {
			tap: function(param1, param2, param3) {
				alert('Play Pressed!');
			},
			delegate: '.x-list-item-body'
		},
		select: function (list, record) {
			list.down('titlebar').setTitle(model.get('name'));
		} // select
		*/
	}, // listeners
	itemTpl:'{court} / {name} / {valuation} / {inspector}'
});

setVisible

Ext.getCmp("btnAdd2").setVisible(false);

Message 창 출처 : Sencha Touch Message Box

Ext.Msg.alert('blueX', '사진 등록은 사건이 등록되어야 가능합니다.', Ext.emptyFn);



728x90
728x90

출처 : Firemonkey Styles - Felix John COLIBRI.
Working with Native and Custom FireMonkey Styles
Step 3 - Add Style-Resources as RCDATA (Delphi)
동영상 - FireMonkey - Style lookup& costom listbox item

style

  object TLayout
    StyleName = 'Layout1'
    DesignVisible = False
    Height = 32.000000000000000000
    Position.X = 499.000000000000000000
    Position.Y = 196.000000000000000000
    Width = 155.000000000000000000
    object TButton
      StyleName = 'Button1'
      Align = alRight
      Height = 32.000000000000000000
      Position.X = 75.000000000000000000
      TabOrder = 1
      Width = 80.000000000000000000
    end
    object TActiveStyleTextObject
      StyleName = 'text'
      Align = alClient
      Color = claBlack
      Height = 17.000000000000000000
      HorzTextAlign = taLeading
      Margins.Left = 3.000000000000000000
      Margins.Top = 1.000000000000000000
      Margins.Right = 3.000000000000000000
      Margins.Bottom = 1.000000000000000000
      Width = 190.000000000000000000
      WordWrap = False
      Shadow.Color = claNull
      ShadowVisible = False
      ActiveTrigger = stSelected
      ActiveColor = claBlack
      ActiveShadow.Color = claNull
    end
  end

예제

procedure TForm1.FormCreate(Sender: TObject);
var
  _Item : TListBoxItem;
begin
  Self.OnGetMoveControl := GetMoveControl;

  _Item := TListBoxItem.Create(nil);
  _Item.Parent := ListBox1;
  _Item.StyleLookup := 'layout1';
  _Item.Text := 'a';
  (_Item.FindStyleResource('button1') as TButton).Text := 'test';
  (_Item.FindStyleResource('button1') as TButton).OnClick := ItemButtonClick;
end;

procedure TForm1.ItemButtonClick(Sender: TObject);
var
  VP: TPointF;
begin
  VP := (Sender as TButton).LocalToAbsolute((Sender as TButton).Position.Point);
  VP := (Sender as TButton).Scene.LocalToScreen(VP);
  {
  VP := (Sender as TButton).Position.Point;
  VP := (Sender as TButton).Scene.LocalToScreen(VP);
  }
  PopupMenu1.Popup(50, 50); // 모바일에서는 동작하지 않음

  ComboBox1.DropDown;
end;
728x90

+ Recent posts