2010년 5월 27일 목요일

[.net]MSDN

http://msdn.microsoft.com/ko-kr/library/ms229335(v=VS.80).aspx

2010년 5월 12일 수요일

[ERWin] OS 가 64bit인경우 파일이 안열릴때

ERWin에서 파일 오픈 시 다음과 같은 오류가 발생하는 경우 해결 방법 입니다.

[오류메시지]
오류 Input file: <파일명>.ER1 with file version: -1 is not readable by Computer Associates ERwin

[해결방법]

사용 중인 OS 가 windows 2008인 경우, ERwin을읽지 못하여 생기는 문제.
ERwin이 설치되어 있는 폴더에 가서 (기본적으로 C:Program FilesCAAllFusion ERwin Data Modeler에 설치 됩니다.) MMOPN32.exe 파일의 속성으로 갑니다.
호환성 탭으로 이동한 후, 호환성 모드의 '다음에 대해 호환성 모드로 이 프로그램 실행'을 체크하시고 window 2008를 선택하면 됩니다.

원문 : http://3030.tistory.com/59

2010년 5월 11일 화요일

[Windows 2008] 암호 정책변경

[시작] - [실행]을 눌러 [gpedit.msc]를 입력하고 실행한다.

[컴퓨터 구성] - [Windows 설정] - [보안 설정] - [계정 정책] - [암호정책]으로 순서대로 이동을 한다.

원문 : http://muritzy.spaces.live.com/Blog/cns!36B93EA29C02C776!582.entry

2010년 4월 13일 화요일

[Biztalk] BizTalk BPA와 MessageBox Viewer

BizTalk Best Practice Analyzer 1.2 와 MessageBox Viewer 10.15 새버전이 나왔습니다.

http://www.microsoft.com/downloads/details.aspx?FamilyID=93D432FE-1370-4B6D-AAA8-A0C43C30F5AB&displaylang=en

http://blogs.technet.com/jpierauc/pages/msgboxviewer.aspx

[Biztalk] Orchestration에서 Message의 특정 Element값 수정하기

!ns0:Root xmlns:ns0="http://TestXpath.Schema1">
!Record>
!AAA>AAA_0!/AAA>
!AAA>AAA_1!/AAA>
!AAA>AAA_2!/AAA>
!Count>Count_0!/Count>
!Count>Count_1!/Count>
!Count>Count_2!/Count>
!/Record>
!Record>
!AAA>AAA_0!/AAA>
!AAA>AAA_1!/AAA>
!AAA>AAA_2!/AAA>
!Count>Count_0!/Count>
!Count>Count_1!/Count>
!Count>Count_2!/Count>
!/Record>
!Record>
!AAA>AAA_0!/AAA>
!AAA>AAA_1!/AAA>
!AAA>AAA_2!/AAA>
!Count>Count_0!/Count>
!Count>Count_1!/Count>
!Count>Count_2!/Count>
!/Record>
!/ns0:Root>

보시다시피 Record가 반복이고 AAA나 Count 또한 반복이 됩니다.
이 경우 AAA는 Record 가 반복이므로 Distinguished Field로 올리지 못합니다.
처리하기 위하여 xpath라는 구문을 사용합니다.
xpath(Test_Msg2,"//Record[1]/AAA[2]/text()")="SUCC";
xpath(Test_Msg2,"//Record[1]/AAA[3]/text()")=(System.Int32)xpath(Test_Msg,"count(//Record)");
Message Assignment Shape안에서 위 구문을 입력하면 첫번째 Record의 두번째 AAA에 SUCC값을 넣을 수 있구요.
또한 첫번째 Record의 3번째 AAA에 Record의 개수를 넣을 수도 있습니다.
처리 결과는 다음과 같습니다.
!?xml version="1.0" encoding="utf-8"?>
!ns0:Root xmlns:ns0="http://TestXpath.Schema1">
!Record>
!AAA>AAA_0!/AAA>!AAA>SUCC!/AAA>!AAA>3!/AAA>!Count>Count_0!/Count>!Count>Count_1!/Count>!Count>Count_2!/Count>
!/Record>
!Record>
!AAA>AAA_0!/AAA>!AAA>AAA_1!/AAA>!AAA>AAA_2!/AAA>!Count>Count_0!/Count>!Count>Count_1!/Count>!Count>Count_2!/Count>
!/Record>
!Record>
!AAA>AAA_0!/AAA>!AAA>AAA_1!/AAA>!AAA>AAA_2!/AAA>!Count>Count_0!/Count>!Count>Count_1!/Count>!Count>Count_2!/Count>
!/Record>
!/ns0:Root>
반복되는 Record라고 하더라도 Distinguished Field와 동일한 기능을 사용할 수도 있다는 얘기지요.
xpath에 대한 내용은 다음 사이트를 보시면 좀 더 아실 수 있습니다.
http://msdn.microsoft.com/ko-kr/library/ms256086(VS.80).aspx

인포패스 양식에서 보조데이터 코드로부터 이름(값) 가져오기


콤보박스에 연결된 보조데이터에서 코드 및 코드값(이름)가져오는 방법을 알아낸 것 같군요.
XPATH를 잘 쓰면 되겠다 싶었는데, 알고 보니 그걸 인포패스에서 지원을 해줍니다.
그동안 코드노드 혹은 이름노드 한곳에만 값을 넣었고, 필요할 때 다른 하나를 가져오지 못했는데 할 수 있게 되었습니다.
정광원선생은 아래 방식을 사용해서 아까 얘기했던 IO값 및 Account값을 가져와서 수정하는 것에 적용해주기 바랍니다.
1. 규칙을 사용하면 아래 그림처럼 설정해주면 되고,
2. 코딩으로 할 때는 빨간상자6번에 있는 XPATH 값을 아래 코딩에서처럼 사용하면 됩니다.
String code = XHelper.OutputNodeData(원본데이터코드노드, “원본데이터코드노드의Xpath”, “”);
String value = XHelper.OutputNodeData(보조데이터반복노드, string.Format(“보조데이터이름노드의Xpath[../PV_MASTERCODE = ‘{0}’]”,code), “값이 없는 경우 기본값”);
XHelper.InputNodeData(targetValueNode, “코드밸류입력할본문노드XPATH”, value);
예를 들어 다음과 같은 XPATH 가 있으면

//*[local-name()=’AccountName’][../*[local-name()=’AccountCode’ and text()=’101010’]
해석은 다음과 같습니다.
AccountCode값이 ‘101010’인 AccountName 노드를 가져와라…

[javascript] nodeType

element(nodeType = 1) : li,p,a,body
Text(nodeType = 3) : 문서안의 모든 texttype
Document(nodeType = 9) : 문서의 루트 엘리먼트

2010년 4월 2일 금요일

인포패스에 있는 전송버튼을 TaskPane에서 javascript로 호출하는 방법

인포패스에 있는 전송버튼을 TaskPane에서 javascript로 호출하는 방법
window.external.Window.Xdocument.Submit();
그냥 뒤에 Submit만 호출하면 되더군요
장점은 속도가 빨라 진다더군요

원문 : http://www.infopathdev.com/forums/p/2351/9617.aspx#9617

2010년 3월 31일 수요일

[C#] Asp.NET : Error : A potentially dangerous Request.Form value was detected from the client

Asp.NET : Error : A potentially dangerous Request.Form value was detected from the client
This occurs when we try to post html code. The server will validate the postdata, if it find that its an HTML code, error something similar to this is shown. This actually helps to prevent running malicious script. If you really want to post the html content add this to the page directive validateRequest=”false”.

이러한 경고 메시지를 얻게 된다면...

Web.config 에서 다음 부분에 를 추가 한다.






원문 : http://www.netme.kr/bbs/board.php?bo_table=sub_1050&wr_id=114&page=3

javascript 모음

http://www.java2s.com/Tutorial/JavaScript/0380__Window/0040__Window-Object.htm

2010년 3월 29일 월요일

[재테크일반]재테크 잘하는 방법-일상 생활에서 돈버는 25가지

주택(home)
1. 투자에 대한 성과를 바란다면 주택개조나 집안의 인테리어를 새로 바꿀 때 화장실을 가장 먼저 업그레이드하라. 주택의 투자가치는 평균크기의 화장실의 경우 102%이며 부엌은 90% 정도다. 창문교체 역시 매년 냉난방비를 줄여주는 이점으로 90%의 투자가치를갖게 된다.

2. 지출되는 이자를 조금이라도 아낄 수 있다면 이자율이 낮은 담보대출을 다시 받아라.

3. 융자금 상환이나 전-월세 등 주택관련 지출은 수입의 250%를 넘으면 안되며 계약금은 최소 20%선이 적당하다.

4. 주택관련 총지출은 총수입의 28%를 넘어서는 안되며 총부채 상환액은 36% 이하가 되어야 한다.

투자(invest)
7. 자금의 몇퍼센트를 주식에 투자해야 하는지 파악하려면 120에서 자신의 나이를 뺀 숫자를 기준으로 삼아라. 미국의 경우 1926년부터 연평균 10.5%의 투자수익률을 기록해 왔으며 장기국공채는 5.1%, 단기투자상품이나 단기재무성증권은 3.1% 수준이었다. 따라서 젊을수록 장기수익률이 높은 주식투자가 유리하며 주식시장이 약세를 보여도 오래 버틸 수 있기 때문이다.

8. 주식포트폴리오에서 자사주 매입은 10%가 넘어서는 안되며 한 회사에 대한 주식투자도마찬가지다.

계획(plan)
12. 수입의 10%를 저축하고 있지 않다면 충분한 액수가 아니다.

13. 비상시를 대비해 은행통장이나 다이렉트 뱅킹에는 적어도 생활비 3개월치의 현금을 넣어 두어야 한다. 아이가 있거나 외벌이 가정이라면 6개월치가 필요하다.

14. 세번째 자녀가 대학갈 때까지 충분한 자금을 모은다는 목표를 세워라. 나머지는 대출을 받거나 수입으로 메울 수 있다.

15. 최소 5년치 연봉 정도의 생명보험에 들 필요가 있으며, 어린 자녀들이 있고 이자부담이 높은 부채를 지고 있다면 10년치 연봉으로 늘려 잡아라.

16. 보험에 가입할 때 능력 한도내에서 자기부담액이 가장 높은 상품을 택하라. 보험료를 가장 순쉬운 방법이다. 자기부담액(deductible)은 사고시 피보험자가 부담하는 금액으로 피보험자의 영업활동에 영향을 미치지 않는 범위내에서 설정하며 자기부담액이 높을 수록 보험료(premium)는 낮아진다. 자기부담액을 500달러에서 1천달러로 올리면 보험료가 25% 싸진다.

17. 신용카드는 수수료 없이 매달 사용한도를 결제하는 적립식 체크카드가 가장 바람직하다. 할부구입에 따른 수수료와 높은 이자는 금융상 커다란 손실이다.

18. 신용 등급을 개선하는 가장 좋은 방법은 제때 결제를 하고 대출은 신용한도액의 30%를 넘으면 안된다.

소비 (spend)
20. 자동차는 최신형 모델의 중고차를 차서 고물이 될때까지 타고 다녀라. 차는 출고 1년만에 가격이 30% 떨어진다. 여기서 중고차를 산다는 의미는 (감가상각의 관점에서) 남에게 구입초기의 비싼 비용을 부담시킨다는 뜻이다.
21. 2~3년내에 자동차를 바꿀려고 생각할 경우에만 새차를 리스하라.

22. 최신형 컴퓨터을 비롯한 it제품이 출시되자마자 내리는 지름신을 퇴치하라. 3개월만 기다리면 가격은 낮아진다.


원문 : http://bbs.moneta.co.kr/nbbs/bbs.normal.qry.screen?p_message_id=8961376&p_bbs_id=N05001&p_page_num=1&p_current_sequence=zzzzz%7E&p_start_sequence=zzzzz%7E&p_start_page=1&direction=1&service=jetech&depth=0&sub=1&top=1&p_tp_board=false&cntnum=3&p_total=610

2010년 3월 28일 일요일

[oracle] FOR UPDATE

1. FOR UPDATE with no option
- 이 경우 오라클은 LOCK을 획득하기까지 무한정 기다린다.

원문 : http://ariswear.com/new_blog/entry/Oracle-SELECT-FOR-UPDATE-NOWAIT-WAIT-%EA%B8%B0%EB%8A%A5-%EC%86%8C%EA%B0%9C

2010년 3월 24일 수요일

infopath 웹서비스 호출

infopath 웹서비스 호출


C#

WebServiceAdapter2 wsAdapter = (WebServiceAdapter2)thisXDocument.DataAdapters["DataConnectionName"];
wsAdapter.Timeout = 60; // Increase to 60 seconds - Default is 30
wsAdapter.Query(); // Issue the query
JScript

var wsAdapter = XDocument.DataAdapters["DataConnectionName"];
wsAdapter.Timeout = 60; // Increase to 60 seconds - Default is 30
wsAdapter.Query(); // Issue the query
web.config change





MOSS/WSS 의 대용량 파일 업로드 설정하기

MOSS/WSS 의 대용량 파일 업로드 설정하기

2010년 3월 22일 월요일

동적 포트의 경우에는 명시적으로 송신 핸들러를 지정할 수 없기 때문에, 멀티 서버 운영 환경에는 이슈가 될 수 있습니다.
간단하게 테스트를 해보니, 해당 어댑터의 기본 핸들러가 송신 핸들러로 동작하는 것을 확인할 수 있습니다.
참고하세요.





위와 같이 오케스트레이션을 만든 후, 배포합니다.



위와 같이 파일 어댑터의 핸들러를 설정한 후, 오케스트레이션은 BizTalkServerApplication에 바인딩한 후 실행하면,



위와 같이 전송은 BizTalkFILEHandler에서 수행됨을 확인할 수 있습니다.

이클립스 단축키

Ctrl + Alt + Down
커서가 위치한 줄 또는 선택한 블록을 바로 아래에 복사한다.
Ctrl + Alt + Up
현재 선택한 줄(또는 커서) 바로 위로 복사 한다.
Alt + Down
현재 커서가 위치한 줄 또는 선택한 블록을 아래로 이동한다.
Alt + Up
현재 커서가 위치한 줄 또는 선택한 블록을 위로 이동한다.
Alt + D
현재 커서가 위치한 줄 또는 블록을 삭제한다.
Ctrl + 3
이클립스 메뉴 검색 후 바로가기(몇몇분에게 알려드렸던 윈도우 런쳐프로그램과 유사함)

Oracle Flashback 기능

Oracle Flashback 기능에 10g 부터 적용되는 휴지통 기능 외에
9i 부터 있다는 Row 기준으로 휴지통기능(?) 이 있더군요.
예를 들어 특정 classprod를 Delete 날린 후 commit 까지 한 후
등골이 오싹하고 식은땀이 흐를 때

insert into classprod
SELECT * FROM classprod
as of timestamp ( systimestamp - interval '10' minute)
where classid like 'MC80%'

이런 식으로 데이터를 살릴 수 있겠습니다.
사용하기 위한 세팅이 있긴 한것 같은데 기본적으로 디폴트 세팅 되어 있는 듯 합니다.
자세한 기술적 사항이 궁금하시거든 검색하시면 되겠습니다.
http://izzumi-dev.tistory.com/41

Tortoise 현재 설치하여 SVN을 사용시 참고

Tortoise를 설치한 이후, Disk I/O가 늘어나 노트북이 많이 느려지는군요. 참 찾아보니 원인은 SVN ICON을 갱신여부등을 나타내 주기 위해 사용되는 TSVNCache.exe 때문이고, 간단히 세팅에서 SVN에 관련이 없는 경로를 빼주면 되는 군요.

즉 c:* 와 d:*를 빼고, 꼭 필요한 경로만 포함한다는 이야기 입니다. 꼭 해보시길..

아래 설명이 나와잇는 url 참조하세요.

http://blog.naver.com/tatis3?Redirect=Log&logNo=90029538556

Microsoft MS-SQL Adapter 관련 Knowledge 공유

BizTalk Adapter 를 사용하여 Remote Server A에 있는 Stored Procedure를 호출합니다.
이때 보안상의 이유로 A의 Procedure는 Remote Server B에 있는 Table에 Insert를 수행합니다.
이 때 BizTalk Server와 Remote Server B간에는 MSDTC 관련 포트가 열려있지 않습니다.
이때 다음과 같은 오류가 발생합니다.

The adapter "SQL" raised an error message. Details "HRESULT="0x80040e14" Description="OLE DB 공급자 'SQLOLEDB'에 대해 중첩된 트랜잭션을 시작할 수 없습니다. XACT_ABORT 옵션이 OFF로 설정되어 있으므로 중첩 트랜잭션이 필요합니다."

HRESULT="0x80040e14" Description="OLE DB 오류 추적 [OLE/DB Provider 'SQLOLEDB' ITransactionLocal::StartTransaction returned 0x8004d013: ISOLEVEL=1048576]."

HRESULT="0x80040e14" Description="[OLE/DB provider returned message: 이 세션에서는 트랜잭션을 더 이상 시작할 수 없습니다.]"

".

이 경우 찾아본 결과 Remote Server A에 있는 Procedure의 시작 부분에 SET XACT_ABORT ON 이라는 구문을 넣으면 잘 동작하네요.

DTC 관련 DTCPing 오류코드 분석 및 방화벽 설정을 위한 동적포트영역 제한

아래 블로그를 보시면 DTCPing 로그 분석시 유용하게 사용할 수 있습니다. 참고하시기 바랍니다.
특히 Firewall 에서 포트가 막혀 있는지 확인할 수 있는 방법을 설명합니다.

Problem:fail to invoke remote RPC method
Error(0x6BA) at dtcping.cpp @289
-->RPC pinging exception
-->1722(RPC 서버를 사용할 수 없습니다.)
RPC test failed
Error(0x6D9) at ServerManager.cpp @450
-->RPC reverse BIND failed
-->1753(종점 매퍼에서 사용 가능한 종점이 더 이상 없습니다.)

오류코드 중 1722와 1753의 경우 포트가 막혀 있는 경우로 볼수 있습니다.

기본적인 설명을 하자면
DTC는 RPC Endpoint Mapper를 사용합니다.
기본 RPC서비스의 포트번호는 135번이고 서비스마다 동적으로 새 포트를 생성합니다.
DTCPing 프로그램을 실행하면 프로그램이 동적포트를 하나 생성합니다.
프로그램이 열고 있는 포트를 확인해 볼수 있는 커맨드는 다음과 같습니다.
netstat -anob
연결대상인 서버(PC)에서 이 포트를 telnet 커맨드로 연결해보면 동적포트가 막혀있는지 확인가능합니다.

모두 아시겠지만 동적포트는 기본적으로 제한이 없으나 방화벽등록문제등으로 특정영역으로 제한 가능합니다.
구성요소서비스의 내컴퓨터의 속성중에 기본프로토콜 탭의 연결지향TCP/IP 속성에 동적포트영역을 지정할 수 있습니다.
보통 5000-5020 또는 5000-5200등으로 지정합니다. (재부팅필요)
사용할 포트 수를 몇개로 할것인지는 DTC 사용 서비스가 얼마나 되느냐로 결정해야 하는데
MSDN에서는 보통 20개면 충분하다고도 하고 200개정도로 표시해둔곳도 있습니다.
이쪽사이트에서는 firewall 설정시 포트를 하나씩 지정하기때문에 20개만 했습니다. ^^

문제는 연결 대상 서버에도 똑같이 동적포트설정을 해야되기 때문에 (거기다 부팅까지)
모든 포트에 대해서 열지 않는한 대상 시스템 관리자의 적극적인 협조없이는 어려움이 많다는 것입니다.

http://blogs.msdn.com/distributedservices/archive/2008/11/12/troubleshooting-msdtc-issues-with-the-dtcping-tool.aspx

Oracle 11g 보안

Oracle 11g는 ‘보안’에 있어, 이전 버전에 비해 몇 가지 변경된 것이 있습니다.
그 중에 대표적인 것이, 사용자 암호의 대소문자를 구별합니다. (사용자ID는 구별하지 않습니다.)
SYSDBA로 로그인
ALTER SYSTEM SET sec_case_sensitive_logon = FALSE;

참고 : http://blog.naver.com/hypermin?Redirect=Log&logNo=70027026924

Windows 7에서 lily NAS에 접근이 안되시는 분들은 다음처럼 하시면 됩니다.
- 관리도구 -> 로컬 보안 정책을 실행합니다.
- 왼쪽 트리에서 로컬 정책 -> 보안 옵션을 클릭합니다.
- 오른쪽 리스트에서 네트워크 보안: LAN Manager 인증 수준을 더블클릭합니다.
- 콤보 박스에서 LM 및 NTLM 응답 보내기를 선택한 후, 확인 버튼을 클릭합니다.
이유는 lily NAS가 NTLMv2 보안 프로토콜을 지원하지 않기 때문입니다.

서비스를 제어하는 명령어 sc.exe (service controller)입니다.
코맨드 라인에서 서비스를 시작, 중지, 삭제, 등록할 수 있도록 해주는 명령어입니다.
서비스 시작, 중지는 net start, net stop을 이용해도 됩니다만,
sc.exe는 언인스톨 후 좀비가 된 것들을 깔끔하게 삭제도 해줍니다. sc delete {서비스명}

참고 : http://commandwindows.com/sc.htm

Biztalk 2009 개발시 프로젝트가 생성안돼는 문제가 발생

Biztalk 2009 개발시 프로젝트가 생성안돼는 문제가 발생

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\9.0\Projects\{FAE04EC0-301F-11d3-BF4B-00C04F79EFBC}] "PossibleProjectExtensions"="csproj" - Original VS install reg value. "PossibleProjectExtensions"="csproj;btproj" - Post Biztalk installation reg value

원문 : http://blogs.msdn.com/biztalkcrt/archive/2009/08/21/visual-studio-2008-fails-to-create-open-biztalk-projects.aspx

Xpath Count

System.Convert.ToInt32(xpath([XML Message],@"count(//*[local-name()='ACCOUNTID')"));

URL : http://social.msdn.microsoft.com/Forums/en/biztalkgeneral/thread/a2a24741-4d95-4065-bb21-e4478d28d597

2010년 3월 19일 금요일

파일로 찍어보기

System.IO.StreamWriter sw = new System.IO.StreamWriter("c:\\log.xml",true);
sw.WriteLine("찍어보기");
sw.Close();

2010년 3월 15일 월요일

[Asp.net] Label에 Innerhtml 사용하기

var ProductName = document.getElementById("");
ProductName.innerHTML = "All Product";

ms-sql 재귀호출(start with)

WITH dept_CTE AS (
SELECT 1 as dispseq, dept_id, dept_name, parent_dept_id,COMPANY_ID
FROM adm_dept
WHERE parent_dept_id = '' // 최상위 부모노드
UNION ALL
SELECT dc.dispseq + 1 as dispseq, d.dept_id, d.dept_name, d.parent_dept_id,d.COMPANY_ID
FROM adm_dept d
INNER JOIN dept_CTE dc
ON dc.dept_id = d.parent_dept_id
)
SELECT a.dispseq, a.dept_id, a.dept_name, a.parent_dept_id,a.COMPANY_ID
FROM dept_CTE a

asp.net AutoPostBack시 DropDownList 값 유지하기

if (ddl_Step != null && Request.Form[ddl_Step.UniqueID] != null && !Request.Form[ddl_Step.UniqueID].Equals(string.Empty))
{
ddl_Step.SelectedValue = Request.Form[ddl_Step.UniqueID].ToString();
}

if (ddl_Product != null && Request.Form[ddl_Product.UniqueID] != null && !Request.Form[ddl_Product.UniqueID].Equals(string.Empty))
{
ddl_Product.SelectedValue = Request.Form[ddl_Product.UniqueID].ToString();
}
if (lbActorName != null && Request.Form[lbActorName.UniqueID] != null && !Request.Form[lbActorName.UniqueID].Equals(string.Empty))
{
lbActorName.Text = Request.Form[lbActorName.UniqueID].ToString();
}

ddl_Step, ddl_Product DropDownList ID값
lbActorName textbox 값

2010년 3월 2일 화요일

ms-sql 동적으로 쿼리만들기

ALTER PROCEDURE [dbo].[sp_get_Reff_Info]
@FormCode varchar(100),
@process_id varchar(10),
@nPageSize INT,
@nCurrPage INT,
@title varchar(1000),
@ref_code varchar(100),
@dtStartDate datetime,
@dtEndDate datetime
AS
BEGIN

SET NOCOUNT ON;
DECLARE @strCount NVARCHAR(20)
DECLARE @@strSqlString NVARCHAR(4000)
DECLARE @@strTotalCount NVARCHAR(4000)

BEGIN
SET @strCount = CAST(@nPageSize * @nCurrPage AS NVARCHAR(20))
END
if(@FormCode = 'PROMOTIONAL')
BEGIN
SET @@strSqlString = ' SELECT TOP '+@strCount+' ''' + '' + ''' AS state, a.idn, a.ref_code '
+ ' ,a.title,convert(char, a.initiate_datetime, 120) as initiate_datetime,a.initiator_name '
+ ' ,(select User_name from ADM_USER where user_id = a.last_user_id) as last_user_name '
+ ' ,a.initiator_dept,originalxml '
+ ' from doc a '
+ ' where process_id in ( ''1'',''2'',''3'',''4'' ) and is_finished =''Y'' '
+ ' and convert(char, a.initiate_datetime, 120) >= convert(char, @dtStartDate, 120) '
+ ' and convert(char, a.initiate_datetime, 120) < DateAdd(day, 1, @dtEndDate) '
+ CASE
WHEN (@title = '')
THEN
''
ELSE
' and a.title like ''%'+@title+'%'' '
END
+ CASE
WHEN (@ref_code = '')
THEN
''
ELSE
' and a.ref_code like ''%'+@ref_code+'%'' '
END
+ ' order by ref_code '
SET @@strTotalCount = ' SELECT count(*) as TOTALCOUNT '
+ 'from doc a where process_id in ( ''1'',''2'',''3'',''4'' ) and is_finished =''Y'' '
+ ' and convert(char, a.initiate_datetime, 120) >= convert(char, @dtStartDate, 120) '
+ ' and convert(char, a.initiate_datetime, 120) < DateAdd(day, 1, @dtEndDate) '
+ CASE
WHEN (@title = '')
THEN
''
ELSE
' and (a.title = '''+@title+''') '
END
+ CASE
WHEN (@ref_code = '')
THEN
''
ELSE
' and a.ref_code like ''%'+@ref_code+'%'' '
END

END
else
BEGIN
SET @@strSqlString =' SELECT TOP '+@strCount+' ''' + '' + ''' AS state, a.idn, a.ref_code '
+ ' ,a.title,convert(char, a.initiate_datetime, 120) as initiate_datetime,a.initiator_name '
+ ' ,(select User_name from ADM_USER where user_id = a.last_user_id) as last_user_name '
+ ' ,a.initiator_dept,originalxml '
+ ' from doc a '
+ ' where process_id = ''6'' and is_finished =''Y'' '
+ ' and convert(char, a.initiate_datetime, 120) >= convert(char, @dtStartDate, 120) '
+ ' and convert(char, a.initiate_datetime, 120) < DateAdd(day, 1, @dtEndDate) '
+ CASE
WHEN (@title = '')
THEN
''
ELSE
' and a.title like ''%'+@title+'%'' '
END
+ CASE
WHEN (@ref_code = '')
THEN
''
ELSE
' and a.ref_code like ''%'+@ref_code+'%'' '
END
+ ' order by ref_code '
SET @@strTotalCount = ' SELECT count(*) as TOTALCOUNT '
+ 'from doc a where process_id = ''6'' and is_finished =''Y'' '
+ ' and convert(char, a.initiate_datetime, 120) >= convert(char, @dtStartDate, 120) '
+ ' and convert(char, a.initiate_datetime, 120) < DateAdd(day, 1, @dtEndDate) '
+ CASE
WHEN (@title = '')
THEN
''
ELSE
' and (a.title = '''+@title+''') '
END
+ CASE
WHEN (@ref_code = '')
THEN
''
ELSE
' and a.ref_code like ''%'+@ref_code+'%'' '
END
END

EXEC SP_EXECUTESQL @@strSqlString, N'@dtStartDate datetime, @dtEndDate datetime', @dtStartDate, @dtEndDate
EXEC SP_EXECUTESQL @@strTotalCount, N'@dtStartDate datetime, @dtEndDate datetime', @dtStartDate, @dtEndDate
END

DataSet 복사해서 변경하기(asp.net)

public void setDataset(DataSet ds)
{
DataSet dsTemp = ds;
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
{

if (i == 0)
{
ds.Tables[0].Rows[i]["Step_seq"] = "10";
ds.Tables[0].Rows[i]["target_seq"] = "10";
}
else
{

if (ds.Tables[0].Rows[i]["Step_seq"].ToString().Trim() == dsTemp.Tables[0].Rows[i - 1]["Step_seq"].ToString().Trim()) //같을경우
{
int nTargetSeq = int.Parse(dsTemp.Tables[0].Rows[i - 1]["target_seq"].ToString()) + 10;
ds.Tables[0].Rows[i]["Step_seq"] = dsTemp.Tables[0].Rows[i - 1]["Step_seq"].ToString();
ds.Tables[0].Rows[i]["target_seq"] = nTargetSeq.ToString();
}
else
{
int nStepSeq = int.Parse(dsTemp.Tables[0].Rows[i - 1]["Step_seq"].ToString()) + 10;
//ds.Tables[0].Rows[i]["Step_seq"] = nStepSeq.ToString();
ds.Tables[0].Rows[i]["target_seq"] = "10";

}
}

}
}

InfoPathAttachmentEncoding

using System;
using System.IO;
using System.Text;
using System.Security.Cryptography;

namespace InfoPathAttachmentEncoding
{
///
/// InfoPathAttachment encodes file data into the format expected by InfoPath for use in file attachment nodes.
///

public class InfoPathAttachmentEncoder
{
private string base64EncodedFile = string.Empty;
private string fullyQualifiedFileName;

private string strNewFileName;
private byte[] data;

///
/// Creates an encoder to create an InfoPath attachment string.
///

///
public InfoPathAttachmentEncoder(string fullyQualifiedFileName)
{
if (fullyQualifiedFileName == string.Empty)
throw new ArgumentException("Must specify file name", "fullyQualifiedFileName");

if (!File.Exists(fullyQualifiedFileName))
throw new FileNotFoundException("File does not exist: " + fullyQualifiedFileName, fullyQualifiedFileName);

this.fullyQualifiedFileName = fullyQualifiedFileName;
}

public InfoPathAttachmentEncoder(string strNewFileName, byte[] data)
{
this.strNewFileName = strNewFileName;
this.data = data;
}

public string ToBase64String2()
{
if (this.strNewFileName == null || this.data == null)
throw new ArgumentException("Must specify new file name or data", "fullyQualifiedFileName");

// This memory stream will hold the InfoPath file attachment buffer before Base64 encoding.
MemoryStream ms = new MemoryStream();

string fileName = this.strNewFileName;

uint fileNameLength = (uint)fileName.Length + 1;

byte[] fileNameBytes = Encoding.Unicode.GetBytes(fileName);

using (BinaryWriter bw = new BinaryWriter(ms))
{
// Write the InfoPath attachment signature.
bw.Write(new byte[] { 0xC7, 0x49, 0x46, 0x41 });

// Write the default header information.
bw.Write((uint)0x14); // size
bw.Write((uint)0x01); // version
bw.Write((uint)0x00); // reserved

// Write the file size.
bw.Write((uint)this.data.Length);

// Write the size of the file name.
bw.Write((uint)fileNameLength);

// Write the file name (Unicode encoded).
bw.Write(fileNameBytes);

// Write the file name terminator. This is two nulls in Unicode.
bw.Write(new byte[] { 0, 0 });

bw.Write(this.data, 0, this.data.Length);
}

// This memorystream will hold the Base64 encoded InfoPath attachment.
MemoryStream msOut = new MemoryStream();

using (BinaryReader br = new BinaryReader(new MemoryStream(ms.ToArray())))
{
// Create a Base64 transform to do the encoding.
ToBase64Transform tf = new ToBase64Transform();

byte[] data = new byte[tf.InputBlockSize];
byte[] outData = new byte[tf.OutputBlockSize];

int bytesRead = 1;

while (bytesRead > 0)
{
bytesRead = br.Read(data, 0, data.Length);

if (bytesRead == data.Length)
tf.TransformBlock(data, 0, bytesRead, outData, 0);
else
outData = tf.TransformFinalBlock(data, 0, bytesRead);

msOut.Write(outData, 0, outData.Length);
}
}

msOut.Close();

return base64EncodedFile = Encoding.ASCII.GetString(msOut.ToArray());
}

///
/// Returns a Base64 encoded string.
///

/// String
public string ToBase64String()
{
if (base64EncodedFile != string.Empty)
return base64EncodedFile;

// This memory stream will hold the InfoPath file attachment buffer before Base64 encoding.
MemoryStream ms = new MemoryStream();

// Get the file information.
using (BinaryReader br = new BinaryReader(File.Open(fullyQualifiedFileName, FileMode.Open, FileAccess.Read, FileShare.Read)))
{
string fileName = Path.GetFileName(fullyQualifiedFileName);

uint fileNameLength = (uint)fileName.Length + 1;

byte[] fileNameBytes = Encoding.Unicode.GetBytes(fileName);

using (BinaryWriter bw = new BinaryWriter(ms))
{
// Write the InfoPath attachment signature.
bw.Write(new byte[] { 0xC7, 0x49, 0x46, 0x41 });

// Write the default header information.
bw.Write((uint)0x14); // size
bw.Write((uint)0x01); // version
bw.Write((uint)0x00); // reserved

// Write the file size.
bw.Write((uint)br.BaseStream.Length);

// Write the size of the file name.
bw.Write((uint)fileNameLength);

// Write the file name (Unicode encoded).
bw.Write(fileNameBytes);

// Write the file name terminator. This is two nulls in Unicode.
bw.Write(new byte[] {0,0});

// Iterate through the file reading data and writing it to the outbuffer.
byte[] data = new byte[64*1024];
int bytesRead = 1;

while (bytesRead > 0)
{
bytesRead = br.Read(data, 0, data.Length);
bw.Write(data, 0, bytesRead);
}
}
}


// This memorystream will hold the Base64 encoded InfoPath attachment.
MemoryStream msOut = new MemoryStream();

using (BinaryReader br = new BinaryReader(new MemoryStream(ms.ToArray())))
{
// Create a Base64 transform to do the encoding.
ToBase64Transform tf = new ToBase64Transform();

byte[] data = new byte[tf.InputBlockSize];
byte[] outData = new byte[tf.OutputBlockSize];

int bytesRead = 1;

while (bytesRead > 0)
{
bytesRead = br.Read(data, 0, data.Length);

if (bytesRead == data.Length)
tf.TransformBlock(data, 0, bytesRead, outData, 0);
else
outData = tf.TransformFinalBlock(data, 0, bytesRead);

msOut.Write(outData, 0, outData.Length);
}
}

msOut.Close();

return base64EncodedFile = Encoding.ASCII.GetString(msOut.ToArray());
}
}
}

InfoPathAttachmentEncoding

using System;
using System.IO;
using System.Text;

namespace InfoPathAttachmentEncoding
{
///
/// Decodes a file attachment and saves it to a specified path.
///

public class InfoPathAttachmentDecoder
{
private const int SP1Header_Size = 20;
private const int FIXED_HEADER = 16;

private int fileSize;
private int attachmentNameLength;
private string attachmentName;
private byte[] decodedAttachment;

///
/// Accepts the Base64 encoded string
/// that is the attachment.
///

public InfoPathAttachmentDecoder(string theBase64EncodedString)
{
byte [] theData = Convert.FromBase64String(theBase64EncodedString);
using(MemoryStream ms = new MemoryStream(theData))
{
BinaryReader theReader = new BinaryReader(ms);
DecodeAttachment(theReader);
}
}

private void DecodeAttachment(BinaryReader theReader)
{
//Position the reader to get the file size.
byte[] headerData = new byte[FIXED_HEADER];
headerData = theReader.ReadBytes(headerData.Length);

fileSize = (int)theReader.ReadUInt32();
attachmentNameLength = (int)theReader.ReadUInt32() * 2;

byte[] fileNameBytes = theReader.ReadBytes(attachmentNameLength);
//InfoPath uses UTF8 encoding.
Encoding enc = Encoding.Unicode;
attachmentName = enc.GetString(fileNameBytes, 0, attachmentNameLength - 2);
decodedAttachment = theReader.ReadBytes(fileSize);
}

public void SaveAttachment(string saveLocation)
{
string fullFileName = saveLocation;
if(!fullFileName.EndsWith(Path.DirectorySeparatorChar.ToString()))
{
fullFileName += Path.DirectorySeparatorChar;
}

fullFileName += attachmentName;

if(File.Exists(fullFileName))
File.Delete(fullFileName);

FileStream fs = new FileStream(fullFileName, FileMode.CreateNew);
BinaryWriter bw = new BinaryWriter(fs);
bw.Write(decodedAttachment);

bw.Close();
fs.Close();
}

public string Filename
{
get{ return attachmentName; }
}

public byte[] DecodedAttachment
{
get{ return decodedAttachment; }
}
}
}

ASP.NET SP호출

public DataSet GetDefaultApprovalLineMody(string stridx)
{
DataSet ds = new DataSet();

SqlConnection objCon = null;
SqlCommand objCmd = null;
SqlDataAdapter objAdpt = null;

try
{
objCon = new SqlConnection(strConnection);
objCon.Open();

objCmd = objCon.CreateCommand();
objCmd.CommandText = "sp_get_approval_line";
objCmd.CommandType = CommandType.StoredProcedure;
objCmd.Parameters.Add(new SqlParameter("@idn", stridx));
objCmd.Parameters.Add(new SqlParameter("@LoginID", txtLoginUser.Text));
objCmd.Parameters.Add(new SqlParameter("@circuit_seq", txtCircuitSeq.Text));

objAdpt = new SqlDataAdapter();
objAdpt.SelectCommand = objCmd;

objAdpt.Fill(ds);
}
catch (Exception ex)
{
throw ex;
}
finally
{
if (objCmd != null)
{
objCmd.Dispose();
}

if (objCon != null)
{
if (objCon.State != ConnectionState.Closed) objCon.Close();
objCon.Dispose();
}
}

return ds;
}

ASP.NET 서버단에서 javascript 호출하기

- string script = "script attachvalidation('test'); /script";
- this.ClientScript.RegisterStartupScript(this.GetType(), "msg", script);

- Response.Write(script alert('test');
- gobjXDocument.View.Window.Close(true);script);

xpath coding

window.external.Window.XDocument = infopath폼의 xml 가져오기

selectSingleNode = 노드 한개 가져오기
selectNodes = 노드 N개 가져오기
for(var i=0;i{
actordata[i].text //selectNodes의 해당값 가져오기
}

parent.removeChild(rowDelete); //해당 노드 삭제

window.external.Window.XDocument.Extension.SubmitWarring() = infopath 메소드 호출하기

2010년 2월 19일 금요일

xpath node 추가하기(위)

var parent = gobjXDocument.DOM.selectSingleNode("//*[local-name()='Sanofi']/*[local-name()='Header']");

var rowOne = parent.selectSingleNode("./*[local-name()='Step']");

//clone first row
var rowClone = rowOne.cloneNode(true);

//set values
rowClone.selectSingleNode("//*[local-name()='UserID']").text = "test";

//append row to XML document
rowOne.insertBefore(rowClone, rowOne);

2010년 2월 18일 목요일

sharepoint에서 PagingControl.dll 사용법

sharepint bin 폴더에 PagingControl.dll을 복사해 놓아야합니다. (sharepoint root/bin)

그리고 cs파일에 2가지를 추가해줍니다.

using System.Security;
using System.Security.Permissions;

SqlClientPermission perm = new SqlClientPermission(PermissionState.Unrestricted);
perm.Assert();
... DB 처리

CodeAccessPermission.RevertAssert();

이렇게 하면 paging을 사용할수있습니다.

이렇게 하지 않으면 재수없는 sharepoint 에러가 계속해서 받겨주던군요...(아래항목)

'System.Data.SqlClient.SqlClientPermission, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' 형식의 사용 권한을 요청하지 못했습니다.
Windows SharePoint Services 관련 문제를 해결합니다.

2010년 2월 7일 일요일

GridView의 원하는 값 가져오기

var gridView = document.getElementById('');
gridView.rows[i].cells[1].innerText
해당 Rows의 첫번째 로우는 헤더값임



























2010년 1월 18일 월요일

gac에 편리하게 올리기

빌드 전 이벤트
"C:\Program Files\Microsoft SDKs\Windows\v6.0A\Bin\gacutil.exe" gacutil.exe /u $(ProjectName)
빌드 후 이벤트

"C:\Program Files\Microsoft SDKs\Windows\v6.0A\Bin\gacutil.exe" /i $(TargetFileName)

MS-SQL 날짜를 데이터 형식으로 변경하기

MS-SQL 날짜를 데이터 형식으로 변경하기 (CONVERT) 링크

2010년 재테크의 필수는 환율지식 쌓기

2010년 재테크의 필수는 환율지식 쌓기 링크

정리
- 달라 약세에 따른 유가, 원자재값 상승