CruiseControl 백업
IT
- CruiseControl 백업 2010.06.03
- 스위치의 기능 및 동작 방식... 2010.04.28
- 무료 UML툴 ! StarUML 2010.04.13
- IOCP 강좌 2010.03.05
- Linq 이용해서 CSV 로드 2009.12.15
- Cause: The name is undefined. Ant error 2009.12.12
- ssh 기본 포트 변경하기 2009.12.10
- ssh 암호없이 접속하기 2009.12.10
- CruiseControl 관련 사이트 2009.12.08
- Message Queue 클래스 2009.12.05
CruiseControl 백업
2010. 6. 3. 08:56
스위치의 기능 및 동작 방식...
2010. 4. 28. 17:25
무료 UML툴 ! StarUML
2010. 4. 13. 14:31
IOCP 강좌
2010. 3. 5. 18:15
Linq 이용해서 CSV 로드
2009. 12. 15. 13:39
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Data; using System.IO; using System.Windows.Forms; namespace CheckTool { class ClassCSV { private string[] doc_csv_Shop; private string[] doc_csv_Char; private string[] doc_csv_Fight; private string[] doc_csv_Item; private string[] doc_csv_Package; private string[] doc_csv_Skill; private string[] doc_csv_Weapon; private string[] doc_csv_RandBox; private string[] doc_csv_Limit; private string[] doc_csv_Event; Dictionary<string, string> dicXML_Shop; CheckTool cForm; public ClassCSV(CheckTool CheckFormUse) { cForm = CheckFormUse; dicXML_Shop = new Dictionary<string, string>(); } public bool SetCSV(string strName, string strFilePath) { string[] doc_temp; try { doc_temp = File.ReadAllLines(strFilePath, System.Text.Encoding.Default); } catch (FileLoadException) { // 로드 에러 MessageBox.Show(strFilePath + "파일 로드 중 에러"); return false; } catch (FileNotFoundException) { // 파일이 없음 MessageBox.Show(strFilePath + "파일이 해당 경로에 없음"); return false; } catch (IOException) { // 다른 프로그램에서 이미 사용중 MessageBox.Show(strFilePath + "파일을 다른 프로그램에서 사용중임"); return false; } switch(strName) { case "Shop" : doc_csv_Shop = doc_temp; break; case "Char": doc_csv_Char = doc_temp; break; case "Fight": doc_csv_Fight = doc_temp; break; case "Item": doc_csv_Item = doc_temp; break; case "Package": doc_csv_Package = doc_temp; break; case "Skill": doc_csv_Skill = doc_temp; break; case "Weapon": doc_csv_Weapon = doc_temp; break; case "RandBox": doc_csv_RandBox = doc_temp; break; case "Limit": doc_csv_Limit = doc_temp; break; case "Event": doc_csv_Event = doc_temp; break; } return true; } public bool SetCSVAll(string strFolderPath) { strFolderPath = strFolderPath + @"\"; if( SetCSV("Shop", strFolderPath+ "ShopTable.csv") == false) return false; if ( SetCSV("Char", strFolderPath + "CharacterTable.csv") == false) return false; if (SetCSV("Fight", strFolderPath + "FightTable.csv") == false) return false; if (SetCSV("Item", strFolderPath + "ItemTable.csv") == false) return false; if (SetCSV("Package", strFolderPath + "PackageTable.csv") == false) return false; if (SetCSV("Skill", strFolderPath + "SkillTable.csv") == false) return false; if (SetCSV("Weapon", strFolderPath + "Weapon.csv") == false) return false; if (SetCSV("RandBox", strFolderPath + "RandBoxTable.csv") == false) return false; if (SetCSV("Limit", strFolderPath + "LimitItemTable.csv") == false) return false; if (SetCSV("Event", strFolderPath + "EventItemTable.csv") == false) return false; return true; } public void CompShopChar() { // Shop엔 있고 Character엔 없는 것 cForm.OutputTxt("== CharacterTable.csv & ShopTable.csv (CharacterTable에 없는 ShopTable ID) =="); cForm.OutputTxt("-- ID, Name --"); IEnumerable<string> Query = from shop in doc_csv_Shop let sh = shop.Split(',') where !(from char_ in doc_csv_Char let ch = char_.Split(',') select ch[1]) .Contains(sh[1]) && sh[3] == "1" // 타입이 1인것(캐릭터) select sh[1] + "," + sh[2]; Query = Query.Skip(1); foreach (var data in Query) { cForm.OutputError(data); } } public void CompSkillFight() { // Skill에 이 있는 ID가 Fight에 없을때 cForm.OutputTxt("" + '\r' + '\n'); cForm.OutputTxt("== FightTable.csv & SkillTable.csv (FightTable에 없는 SkillTable ID) =="); cForm.OutputTxt("-- ID, Name --"); IEnumerable<string> Query = from skill in doc_csv_Skill let sk = skill.Split(',') where !(from fight in doc_csv_Fight let fi = fight.Split(',') where fi[3].StartsWith("3") //3은 스킬 select fi[1]) // ID .Contains(sk[1]) //ID select sk[1] + "," + sk[2]; Query = Query.Skip(1); foreach (var data in Query) { cForm.OutputError(data); } } public void CompShopFight() { // Fight엔 있고 Shop엔 없는 것 cForm.OutputTxt("" + '\r' + '\n'); cForm.OutputTxt("== ShopTable.csv & FightTable.csv (FightTable에 없는 ShopTable ID) =="); IEnumerable<string> Query = from fight in doc_csv_Fight let fi = fight.Split(',') where !(from shop in doc_csv_Shop let sh = shop.Split(',') select sh[1]) // ID .Contains(fi[3]) //Code_ID select fi[3] + "," + fi[18]; Query = Query.Skip(1); foreach (var data in Query) { cForm.OutputError(data); } } public void CompShopItem() { // Shop엔 있고 Item엔 없는 것 cForm.OutputTxt("" + '\r' + '\n'); cForm.OutputTxt("== ShopTable.csv & ItemTable.csv (ItemTable에 없는 ShopTable ID) =="); cForm.OutputTxt("-- ID, Name --"); IEnumerable<string> Query = from shop in doc_csv_Shop let sh = shop.Split(',') where !(from item in doc_csv_Item let it = item.Split(',') select it[1]) .Contains(sh[1]) && (sh[3] == "2" || sh[3] == "7" || sh[3] =="8") // 타입이 2(무기), 7(기능성), 8(알) select sh[1] + "," + sh[2]; Query = Query.Skip(1); foreach (var data in Query) { cForm.OutputError(data); } } public void CompShopSkill() { // Shop엔 있고 Skill엔 없는 것 cForm.OutputTxt("" + '\r' + '\n'); cForm.OutputTxt("== ShopTable.csv & SkillTable.csv (SkillTable에 없는 ShopTable ID) =="); cForm.OutputTxt("-- ID, Name --"); IEnumerable<string> Query = from shop in doc_csv_Shop let sh = shop.Split(',') where !(from skill in doc_csv_Skill let sk = skill.Split(',') select sk[1]) .Contains(sh[1]) && (sh[3] == "3") // 타입이 3(스킬) select sh[1] + "," + sh[2]; Query = Query.Skip(1); foreach (var data in Query) { cForm.OutputError(data); } } public void CompShopRandBox(){ // RandBox에 있는 데이터와 Shop 데이터 비교 cForm.OutputTxt("" + '\r' + '\n'); cForm.OutputTxt("== RandBoxTable.csv & ShopTable.csv (Type, Value) 비교 =="); cForm.OutputTxt("-- GetItem_ID, Get_Type, Get_Value --"); IEnumerable<string> Query = from rand in doc_csv_RandBox let ra = rand.Split(',') from shop in doc_csv_Shop let sh = shop.Split(',') //Value까지 고려 한거 where (ra[3] == sh[1]) && ((ra[4] != sh[5]) || (ra[5] != sh[6] && ra[5] != sh[8] && ra[5] != sh[10] && ra[5] != sh[12] && ra[5] != sh[14])) //Value고려하지 않은거. //where (ra[3] == sh[1]) && (ra[4] != sh[5]) //select rand; //ra[3] GenItem_ID, ra[4] Get_Type, ra[5] Get_value, ra[7] Note select ra[3] + "," + ra[4] + "," + ra[5] + "," + ra[7]; foreach (var data in Query) { cForm.OutputError(data); } } public void CompShopWeapon(){ // Shop엔 있고 Weapon엔 없는 것 cForm.OutputTxt("" + '\r' + '\n'); cForm.OutputTxt("== Weapon.csv & ShopTable.csv (Weapon에 없는 ShopTable ID) =="); cForm.OutputTxt("-- ID, Name --"); IEnumerable<string> Query = from shop in doc_csv_Shop let sh = shop.Split(',') where !(from weapon in doc_csv_Weapon let we = weapon.Split(',') select we[0]) .Contains(sh[1]) //&& (sh[3] == "2") // Type 2는 무기 && (sh[1].StartsWith("25")) // 25로 시작하는건 무기 //select weapon; //sh[1] id, sh[2] Name select sh[1] + "," + sh[2]; Query = Query.Skip(1); foreach (var data in Query) { cForm.OutputError(data); } } public void CompItemWeapon() { // Weapon엔 있고 Item엔 없는 것 cForm.OutputTxt("" + '\r' + '\n'); cForm.OutputTxt("== Weapon.csv & ItemTable.csv (Weapon에 없는 ItemTable ID) =="); cForm.OutputTxt("-- ID, Name --"); IEnumerable<string> Query = from item in doc_csv_Item let it = item.Split(',') where !(from weapon in doc_csv_Weapon let we = weapon.Split(',') select we[0]) .Contains(it[1]) && it[1].StartsWith("25") // 25로 시작하는건 무기 //select weapon; //it[1] ID, it[2] name select it[1] + "," + it[2]; Query = Query.Skip(1); foreach (var data in Query) { cForm.OutputError(data); } } public void CompShopPackage() { // Package에 있는 데이터와 Shop 데이터 비교 cForm.OutputTxt("" + '\r' + '\n'); cForm.OutputTxt("== PackageTable.csv & ShopTable.csv (Type) 비교 =="); for(int i = 0, j = 1; j <= 5 ; i = i+3, j++) { cForm.OutputTxt("-- Code, Type, Name " + j.ToString() + "--"); IEnumerable<string> Query = from pack in doc_csv_Package let pa = pack.Split(',') from shop in doc_csv_Shop let sh = shop.Split(',') //Value 고려 //where (pa[i + 5] == sh[1]) && ((pa[i + 6] != sh[5]) || (pa[i + 7] != sh[6] && pa[i + 7] != sh[8] && pa[i + 7] != sh[10] && pa[i + 7] != sh[12] && pa[i + 7] != sh[14])) //Value 뺌 where (pa[i + 5] == sh[1]) && (pa[i + 6] != sh[5]) //select pack; //pa[i+5] Codei, pa[i+6] Typei, pa[i+7] Value, sh[2] Name //Value 뺌 //select pa[i + 5] + "," + pa[i + 6] + "," + pa[i + 7] + "," + sh[2]; select pa[i + 5] + "," + pa[i + 6] + "," + sh[2]; foreach (var data in Query) { cForm.OutputError(data); } } } public void CompShopLimit() { // LimitItem과 shop과 비교 cForm.OutputTxt("" + '\r' + '\n'); //cForm.OutputTxt("== LimitItemTable.csv 데이터와 ShopTable.csv 데이터 일치하지 않는 것 =="); cForm.OutputTxt("== LimitItemTable.csv & ShopTable.csv (ID, StartDay, EndDay) 비교 =="); cForm.OutputTxt("-- ID, Name, StartDay, EndDay --"); IEnumerable<string> Query = from limit in doc_csv_Limit let li = limit.Split(',') where !(from shop in doc_csv_Shop let sh = shop.Split(',') select sh[1]) .Contains(li[0]) //select weapon; //it[1] ID, it[2] name select li[0] + "," + li[1] + "," + li[2] + "," + li[3]; Query = Query.Skip(1); foreach (var data in Query) { cForm.OutputError(data); } IEnumerable<string> Query2 = from limit in doc_csv_Limit let li = limit.Split(',') from shop in doc_csv_Shop let sh = shop.Split(',') where (li[0] == sh[1]) && ((li[2] != sh[21]) || (li[3] != sh[22])) //li[0] : ID, li[1] : Name, li[2] : StartDay, li[3] : EndDay select li[0] + "," + li[1] + "," + li[2] + "," + li[3]; foreach (var data in Query2) { cForm.OutputError(data); } } public void CompShopEvent(){ // Event와 Shop 비교 cForm.OutputTxt("" + '\r' + '\n'); cForm.OutputTxt("== EventTable.csv & ShopTable.csv (Get_Type) 비교 =="); cForm.OutputTxt("-- ID, Name, Get_Type --"); IEnumerable<string> Query = from event_ in doc_csv_Event let ev = event_.Split(',') from shop in doc_csv_Shop let sh = shop.Split(',') where ev[1] == sh[1] && ev[2] != sh[5] // ev[1] ID, ev[5] Name, ev[2] Get_Type select ev[1] + "," + ev[5] + "," + ev[2]; foreach (var data in Query) { cForm.OutputError(data); } } } }
Cause: The name is undefined. Ant error
2009. 12. 12. 16:00
반복문이 필요해서 for문을 써보았다.
근데 바로 "Cause: The name is undefined." 뜨면서 빌드 실패했다.
국내 사이트를 검색하니 정보가 없다 역시 ㅠ
구글링했더니 뭔가 파일이 필요하댄다.
ant-contrib-버전.jar 를 다운받고 이 파일을 ant경로에 lib에 넣었다.
다운로드 링크 : http://sourceforge.net/projects/ant-contrib/files/
### 방법 1 ####
<path id="for.classpath>
<fileset dir=${lib.path}">
<include name="*ant-contrib*.jar"/>
</path>
로 path를 잡고
<taskdef resource="net/sf/antcontrib/antlib.xml" classpathref="for.classpath"/>
로 taskdef를 잡는다.
<for list="1,2,3" param="number">
<sequential>
<echo message="number: @{number}"/>
</sequental>
</for>
이제 <for> 를 쓰니 잘된다. 휴... 그리고 param을 쓸때는 $가 아닌 @ 요거이다 !
### 방법 2 ###
찾아보니 방법1은 예전에 쓰던 방법이랜다.
<ac:for list="1,2,3" param="number" xmlns:ac="antlib:net.sf.antcontrib">
<ac:sequential>
<echo message="number: @{number}"/>
</ac:sequental>
</ac:for>
네임스페이스 ac를 설정해서 하는 방법인듯. 암튼 이게 더 세련되고 간단하다 ~최신식? ㅋ
근데 바로 "Cause: The name is undefined." 뜨면서 빌드 실패했다.
국내 사이트를 검색하니 정보가 없다 역시 ㅠ
구글링했더니 뭔가 파일이 필요하댄다.
ant-contrib-버전.jar 를 다운받고 이 파일을 ant경로에 lib에 넣었다.
다운로드 링크 : http://sourceforge.net/projects/ant-contrib/files/
### 방법 1 ####
<path id="for.classpath>
<fileset dir=${lib.path}">
<include name="*ant-contrib*.jar"/>
</path>
로 path를 잡고
<taskdef resource="net/sf/antcontrib/antlib.xml" classpathref="for.classpath"/>
로 taskdef를 잡는다.
<for list="1,2,3" param="number">
<sequential>
<echo message="number: @{number}"/>
</sequental>
</for>
이제 <for> 를 쓰니 잘된다. 휴... 그리고 param을 쓸때는 $가 아닌 @ 요거이다 !
### 방법 2 ###
찾아보니 방법1은 예전에 쓰던 방법이랜다.
<ac:for list="1,2,3" param="number" xmlns:ac="antlib:net.sf.antcontrib">
<ac:sequential>
<echo message="number: @{number}"/>
</ac:sequental>
</ac:for>
네임스페이스 ac를 설정해서 하는 방법인듯. 암튼 이게 더 세련되고 간단하다 ~최신식? ㅋ
ssh 기본 포트 변경하기
2009. 12. 10. 15:15
/etc/ssh/sshd_config 에서
port 22 <- 이부분을 찾아서 수정하면 된다. ex) port 8025
주석이 되어 있다면(#port 22) 주석제거하면 됨.
서비스 재시작~
/etc/init.d/sshd restart
port 22 <- 이부분을 찾아서 수정하면 된다. ex) port 8025
주석이 되어 있다면(#port 22) 주석제거하면 됨.
서비스 재시작~
/etc/init.d/sshd restart
ssh 암호없이 접속하기
2009. 12. 10. 15:11
자기 컴에서 /root/.ssh 폴더로 이동
이미 공개키(id_rsa.pub)가 생성되어 있다면 1번 과정 생략하면 된다.
1. 키 생성
[root@mycom~]# ssh-keygen -t rsa
이것저것 세번 물어보는데 세 번 모두 그냥 엔터 !
그러면,
/root/.ssh/id_rsa 에 공개키(id_rsa.pub)와 비밀키(id_rsa)가 생성됨.
2. 키 복사
자기 컴의 공개키를 열어서 내용을 복사한다.
대상 컴퓨터로 접속해서,
/root/.ssh 폴더로 간다 ~
authorized_keys 파일이 없을 경우 만들어서
내용을 붙여넣기 해준다.
있을 경우는 밑에 추가해서 붙여넣어주면 된다~
이미 공개키(id_rsa.pub)가 생성되어 있다면 1번 과정 생략하면 된다.
1. 키 생성
[root@mycom~]# ssh-keygen -t rsa
이것저것 세번 물어보는데 세 번 모두 그냥 엔터 !
그러면,
/root/.ssh/id_rsa 에 공개키(id_rsa.pub)와 비밀키(id_rsa)가 생성됨.
2. 키 복사
자기 컴의 공개키를 열어서 내용을 복사한다.
대상 컴퓨터로 접속해서,
/root/.ssh 폴더로 간다 ~
authorized_keys 파일이 없을 경우 만들어서
내용을 붙여넣기 해준다.
있을 경우는 밑에 추가해서 붙여넣어주면 된다~
CruiseControl 관련 사이트
2009. 12. 8. 15:16
1. Installing CruiseControl on CentOS with Plesk
http://www.lejnieks.com/2008/07/05/installing-cruisecontrol-on-centos-with-plesk/
CentOs 에서의 CruiseControl 설치법이 있는 사이트
2. Configuration Reference
http://cruisecontrol.sourceforge.net/main/configxml.html
config.xml 레퍼런스가 나와있는 사이트
3. Apache Ant User Manual
http://ant.apache.org/manual/toc.html
Ant 레퍼런스가 나와있는 사이트
Ant 에 대해서 모르고 인터넷에 있는 예제를 따라서 CruiseControl을 만드니, 나와 설정이 너무 달랐다.
Ant 를 먼저 공부하고 맘에 드는 놈을 자신의 환경에 쓰도록 하자.
4. Refactor your configuration file
http://www.build-doctor.com/2008/02/29/refactor-your-configuration-file/
설정파일(config.xml) 리팩토링 !!!
내 config.xml 에는 프로젝트가 몇십개가 된다.
혹시 로그폴더 위치가 바뀌게 된다면??? 몇십개의 줄을 하나마다 바꾸어 줘야한다.
이럴때 ${log.dir} 이라는 property name을 쓴다면 한줄만 바꾸어 주면 된다.
이러한 변수를 잘 활용하고, 또한 프로젝트 <include.project> 를 활용해서 쪼개어 주자.
http://www.lejnieks.com/2008/07/05/installing-cruisecontrol-on-centos-with-plesk/
CentOs 에서의 CruiseControl 설치법이 있는 사이트
2. Configuration Reference
http://cruisecontrol.sourceforge.net/main/configxml.html
config.xml 레퍼런스가 나와있는 사이트
3. Apache Ant User Manual
http://ant.apache.org/manual/toc.html
Ant 레퍼런스가 나와있는 사이트
Ant 에 대해서 모르고 인터넷에 있는 예제를 따라서 CruiseControl을 만드니, 나와 설정이 너무 달랐다.
Ant 를 먼저 공부하고 맘에 드는 놈을 자신의 환경에 쓰도록 하자.
4. Refactor your configuration file
http://www.build-doctor.com/2008/02/29/refactor-your-configuration-file/
설정파일(config.xml) 리팩토링 !!!
내 config.xml 에는 프로젝트가 몇십개가 된다.
혹시 로그폴더 위치가 바뀌게 된다면??? 몇십개의 줄을 하나마다 바꾸어 줘야한다.
이럴때 ${log.dir} 이라는 property name을 쓴다면 한줄만 바꾸어 주면 된다.
이러한 변수를 잘 활용하고, 또한 프로젝트 <include.project> 를 활용해서 쪼개어 주자.
Message Queue 클래스
2009. 12. 5. 22:18
#define MAX_MESSAGE_NUMBER 100 #define MAX_MESSAGE_SIZE 128 #define MAX_PROCESS_NAME 32 #include <boost/interprocess/ipc/message_queue.hpp> #include <boost/interprocess/creation_tags.hpp> #include <iostream> using namespace boost::interprocess; class CMessageQ { public: CMessageQ(const char* pName) { m_pMsgQ = NULL; strcpy(m_Name, pName); } ~CMessageQ(void) { Remove(); } public: bool Create() { try{ Remove(); // 메모리에서 제거되면 안되므로 static으로 선언 static message_queue mq(create_only, m_Name, MAX_MESSAGE_NUMBER, MAX_MESSAGE_SIZE); m_pMsgQ = &mq; }catch(interprocess_exception &ex){ std::cout << "MessageQ Create() error : " << ex.what() << std::endl; return false; } return true; } bool Open() { try{ static message_queue mq(open_only, m_Name); m_pMsgQ = &mq; }catch(interprocess_exception &ex){ std::cout << "MessageQ Open() error : " << ex.what() << std::endl; return false; } return true; } size_t Get() { size_t temp; try{ temp = m_pMsgQ->get_num_msg(); return temp; }catch(interprocess_exception &ex){ std::cout << "MessageQ Get() error : " << ex.what() << std::endl; } return 0; } template <typename T> bool Send(T* Data,size_t Size, unsigned int priority = 0) { try{ m_pMsgQ->send(Data, Size, priority); }catch(interprocess_exception &ex){ std::cout << "MessageQ Send() error : " << ex.what() << std::endl; return false; } return true; } template <typename T> bool Recv(T* Data, size_t Size, unsigned int& priority) { size_t recvd_size=0; try{ //m_pMsgQ->receive(Data, Size, recvd_size, priority); m_pMsgQ->receive(Data, MAX_MESSAGE_SIZE, recvd_size, priority); if( Size != recvd_size ) { std::cout << "MessageQ Recv() Size Wrong : " << std::endl; return false; } }catch(interprocess_exception &ex){ std::cout << "MessageQ Recv() error : " << ex.what() << std::endl; return false; } return true; } void Remove() { message_queue::remove(m_Name); } private: char m_Name[MAX_PROCESS_NAME]; // 프로세스 이름 message_queue* m_pMsgQ; // 메시지큐 포인터 };
이렇게 사용하면 될려나 ㅡㅡ; ㅎㅎ