프로그램 사용/VLC2010. 4. 13. 13:55
매일매일 빌드하는 버전으로, 일종의 개발버전 릴리즈이다.

[링크 : http://nightlies.videolan.org/]
Posted by 구차니
linux에서 제공하는 표준 API는 존재하지 않아
C++에서도 클래스를 만들어 쓰거나, 별도의 함수를 만들어 써야 한다고 한다.

일단 Encoding은 isalnum() 이 아닐경우에는 %02X로 출력해주면 될 것으로 보이고
Decoding은 %[0-9a-f][0-9a-f] 일 경우에는 %c로 출력해주면 될 것으로 보인다.

Encoding은 한글자만 보면 되지만
Decoding은 두글자를 보면서 해야 해서 귀찮을듯..


아래는 소스가 있는 페이지 이지만, 검증은 아직 해보지 않았음
  [링크 : http://tistory.izyou.net/entry/URL-인코딩, 디코딩 클래스]
  [링크 : http://remipa.pe.kr/zog/?no=118]
  [링크 : http://demo.initech.com/?document_srl=237]
  [링크 : http://smok95.tistory.com/entry/URL-EncodeDecode]
Posted by 구차니
웹(HTML)      http://www.youtube.com/results?search_query=검색어
RSS(XML)     http://gdata.youtube.com/feeds/base/videos?q=검색어
api(XML)       http://gdata.youtube.com/feeds/api/videos?q=검색어
Posted by 구차니
wget은 HTTP나 FTP 등의 프로토콜을 통해 웹페이지나 파일을 다운받는 유틸리티이다.
아무튼 youtube에서 파일로 다운로드 받기위해 주소를 변환해서 시도를 해도
403 Forbidden 에러만 날뿐 다운로드 되지 않는다.

아무튼 쿠키를 저장하고, 이를 다시 불러들여 다운로드를 시도하면 제대로 받아진다.
쿠키를 이용해서 세션이 달라지면, 이전의 내용은 무효화 되서 그런것으로 생각된다.

--no-cookies
Disable the use of cookies. Cookies are a mechanism for maintaining server-side state. The server sends the client a cookie using the Set-Cookie header, and the client responds with the same cookie upon further requests. Since cookies allow the server owners to keep track of visitors and for sites to exchange this information, some consider them a breach of privacy. The default is to use cookies; however, storing cookies is not on by default.


--load-cookies file
Load cookies from file before the first HTTP retrieval. file is a textual file in the format originally used by Netscape's cookies.txt file.

You will typically use this option when mirroring sites that require that you be logged in to access some or all of their content. The login process typically works by the web server issuing an http cookie upon receiving and verifying your credentials. The cookie is then resent by the browser when accessing that part of the site, and so proves your identity.

Mirroring such a site requires Wget to send the same cookies your browser sends when communicating with the site. This is achieved by ‘--load-cookies’—simply point Wget to the location of the cookies.txt file, and it will send the same cookies your browser would send in the same situation. Different browsers keep textual cookie files in different locations:

Netscape 4.x.
The cookies are in ~/.netscape/cookies.txt.
Mozilla and Netscape 6.x.
Mozilla's cookie file is also named cookies.txt, located somewhere under ~/.mozilla, in the directory of your profile. The full path usually ends up looking somewhat like ~/.mozilla/default/some-weird-string/cookies.txt.
Internet Explorer.
You can produce a cookie file Wget can use by using the File menu, Import and Export, Export Cookies. This has been tested with Internet Explorer 5; it is not guaranteed to work with earlier versions.
Other browsers.
If you are using a different browser to create your cookies, ‘--load-cookies’ will only work if you can locate or produce a cookie file in the Netscape format that Wget expects.

If you cannot use ‘--load-cookies’, there might still be an alternative. If your browser supports a “cookie manager”, you can use it to view the cookies used when accessing the site you're mirroring. Write down the name and value of the cookie, and manually instruct Wget to send those cookies, bypassing the “official” cookie support:

          wget --no-cookies --header "Cookie: name=value"


--save-cookies file
Save cookies to file before exiting. This will not save cookies that have expired or that have no expiry time (so-called “session cookies”), but also see ‘--keep-session-cookies’.


--keep-session-cookies
When specified, causes ‘--save-cookies’ to also save session cookies. Session cookies are normally not saved because they are meant to be kept in memory and forgotten when you exit the browser. Saving them is useful on sites that require you to log in or to visit the home page before you can access some pages. With this option, multiple Wget runs are considered a single browser session as far as the site is concerned.

Since the cookie file format does not normally carry session cookies, Wget marks them with an expiry timestamp of 0. Wget's ‘--load-cookies’ recognizes those as session cookies, but it might confuse other browsers. Also note that cookies so loaded will be treated as other session cookies, which means that if you want ‘--save-cookies’ to preserve them again, you must use ‘--keep-session-cookies’ again.


[링크 : http://www.gnu.org/software/wget/manual/html_node/HTTP-Options.html]

--save-cookies 로 저장한 youtube 쿠키이다. 음.. 무슨 의미지 -ㅁ-?
$ cat yt.cookie
# HTTP cookie file.
# Generated by Wget on 2010-04-10 11:57:59.
# Edit at your own risk.

.youtube.com    TRUE    /       FALSE   1586228278      PREF    f1=50000000&f2=8000000
.youtube.com    TRUE    /       FALSE   1291604278      VISITOR_INFO1_LIVE      FNfBrJzTQY

$ wget "http://www.youtube.com/watch?v=mdljV2uEs1A" --save-cookies yt.cookie
$ wget --load-cookies=yt.cookie "http://v22.lscache2.c.youtube.com/videoplayback?ip=211.0.0.0&sparams=id%2Cexpire%2Cip%2Cipbits%2Ci
tag%2Calgorithm%2Cburst%2Cfactor&fexp=904405%2C900037&algorithm=throttle-factor&itag=35&ipbits=8&burst=40&sver=3&expire=1270890000&key=yt1&signature=5C611E956FB97E74D3435F8815A7A2376E3C61D4.C2C593CDDE0C15671462BB13C5404EC6927F7F7D&factor=1.25&id=99d963576b84b350" -O file.mp4
--2010-04-10 12:33:26--  http://v22.lscache2.c.youtube.com/videoplayback?ip=211.0.0.0&sparams=id%2Cexpire%2Cip%2Cipbits%2Citag%2Calgorithm%2Cburst%2Cfactor&fexp=904405%2C900037&algorithm=throttle-factor&itag=35&ipbits=8&burst=40&sver=3&expire=1270890000&key=yt1&signature=5C611E956FB97E74D3435F8815A7A2376E3C61D4.C2C593CDDE0C15671462BB13C5404EC6927F7F7D&factor=1.25&id=99d963576b84b350
Resolving v22.lscache2.c.youtube.com... 74.125.167.33
접속 v22.lscache2.c.youtube.com|74.125.167.33|:80... 접속됨.
HTTP request sent, awaiting response... 200 OK
Length: 15708973 (15M) [video/x-flv]
Saving to: `file.mp4'

100%[==========================================================================>] 15,708,973   105K/s   in 2m 0s

2010-04-10 12:35:27 (128 KB/s) - `file.mp4' saved [15708973/15708973]

URL이 너무 길어서 별도의 파일이름을 지정해주지 않으면
Cannot write to `videoplayback?ip=211.0.0.0&sparams=id,expire,ip,ipbits,itag,algorithm,burst,factor&fexp=904405,900037&algorithm=throttle-factor&itag=35&ipbits=8&burst=40&sver=3&expire=1270890000&key=yt1&signature=5C611E956FB97E74D3435F8815A7A2376E3C61D4.C2C593CDDE0C15671462BB13C5404EC6927F7F7D&factor=1.25&id=99d963576b84b350' (File name too long).
주소가 255자를 넘어서는 관계로, 파일 이름으로 하기에는 너무 길다고 에러가 발생한다.
반드시 -O filename 으로 별도의 이름을 지정해 주어야 한다.

2010/04/09 - youtube 동영상 페이지 fmt_map, fmt_url_map, fmt_list, fmt_stream_map
[링크 : http://kldp.org/node/75150]


Posted by 구차니
유튜브 페이지에는 4개의 변수가 존재한다.
일단 이 녀석들을 URL decoding 해주면 아래와 같은 값으로 나오게 된다.

fmt_mapfmt_list와 내용이  유사하며
fmt_url_mapfmt_stream_map 과 내용이 유사하다.

아무튼 다운로드 주소를 얻을려면 fmt_url_map / fmt_stream_map 중에 하나에서 빼내면 된다.

fmt_map=22/2000000/9/0/115,35/640000/9/0/115,34/0/9/0/115,5/0/7/0/0&mpu=True&hl=ko_KR&ad_flags=0&rv.5.length_seconds=243&rv.0.thumbnailUrl=http://i1.ytimg.com/vi/lzVFyWNzjtE/default.jpg&rv.7.author=allkpop&cid=11332&rv.1.length_seconds=240&ad_logging_flag=1&rv.2.id=2f5hg3FlYc4

fmt_url_map=22|http://v15.lscache4.c.youtube.com/videoplayback?ip=0.0.0.0&sparams=id%2Cexpire%2Cip%2Cipbits%2Citag%2Cratebypass%2Coc%3AU0dWRVhNU19FSkNNNl9QR1dD&fexp=900023%2C901802&itag=22&ipbits=0&sver=3&ratebypass=yes&expire=1270825200&key=yt1&signature=428B55DAF445D856E5F8A704C91B635776474DC3.B807EF9FE3245923257F82EDCDDD2FB7EFC4CFAF&id=4c66f02fc912a449,


하지만.. 리눅스에서 wget으로는 다운로드 되지 않는다 OTL

$ wget "http://v15.lscache4.c.youtube.com/videoplayback?ip=0.0.0.0&sparams=id%2Cexpire%2Cip%2Cipbits%2Citag%2Cratebypass%2Coc%3AU0dWRVhNU19FSkNNNl9QR1dD&fexp=900023%2C901802&itag=22&ipbits=0&sver=3&ratebypass=yes&expire=1270825200&key=yt1&signature=428B55DAF445D856E5F8A704C91B635776474DC3.B807EF9FE3245923257F82EDCDDD2FB7EFC4CFAF&id=4c66f02fc912a449"
--17:55:02--  http://v15.lscache4.c.youtube.com/videoplayback?ip=0.0.0.0&sparams=id%2Cexpire%2Cip%2Cipbits%2Citag%2Cratebypass%2Coc%3AU0dWRVhNU19FSkNNNl9QR1dD&fexp=900023%2C901802&itag=22&ipbits=0&sver=3&ratebypass=yes&expire=1270825200&key=yt1&signature=428B55DAF445D856E5F8A704C91B635776474DC3.B807EF9FE3245923257F82EDCDDD2FB7EFC4CFAF&id=4c66f02fc912a449
Resolving v15.lscache4.c.youtube.com... 74.125.107.35
Connecting to v15.lscache4.c.youtube.com|74.125.107.35|:80... connected.
HTTP request sent, awaiting response... 403 Forbidden
17:55:02 ERROR 403: Forbidden.


2010/02/26 - [프로그램 사용/유튜브 (youtube)] - 유튜브 파일 다운로드 하기(download youtube as file)

Posted by 구차니
XML_SetCharacterDataHandler() 함수는 prototype에서 보이는 대로
XML_char *s, int len 두개의 변수를 이용한다.

즉, 이 함수를 통해 받아들여지는 내용을 출력하기 위해서는
printf("%s",s); 가 아닌

for (int i = 0; i < len; i++) printf("%c",s[i]);
로 한글자씩 len에 맞게 출력을 해주어야 한다.

XML_SetCharacterDataHandler(XML_Parser p, XML_CharacterDataHandler charhndl)

typedef void (*XML_CharacterDataHandler)(void *userData, const XML_Char *s, int len);

Set a text handler. The string your handler receives is NOT zero terminated. You have to use the length argument to deal with the end of the string. A single block of contiguous text free of markup may still result in a sequence of calls to this handler. In other words, if you're searching for a pattern in the text, it may be split across calls to this handler.

[링크 : http://www.xml.com/pub/a/1999/09/expat/index.html?page=3#chardatahandler]

<media:description type='plain'>The funniest 6 minutes you will ever see! Remember how many of these you have done! Follow @ http://www.twitter.com/judsonlaipply Check my book out at http://www.mightaswelldance.com
http://www.theevolutionofdance.com -
for more info including song list!</media:description>

                        <media:description type="plain">
========== [4]
The funniest 6 minutes you will ever see! Remember how many of these you have done! Follow @ http://www.twitter.com/judsonlaipply Ch
eck my book out at http://www.mightaswelldance.com
========== [4]


========== [4]
http://www.theevolutionofdance.com -
========== [4]


========== [4]
for more info including song list!
                        </media:description>

그리고, 위에 보이듯이, 줄단위로 받아들이므로
단순하게 한번 복사하는 걸로는 충분하지 않아 보인다.(어떻게 할지 모호하면.. realloc 해주어야 하나..)

'프로그램 사용 > expat & XML' 카테고리의 다른 글

SAX (Simple API for XML)  (0) 2010.04.23
xml 트리 탐색 - XML tree navigation  (0) 2010.04.17
&amp; &lt; &gt; &quot; 는 머지?  (0) 2010.03.31
expat '간략한' 사용법  (0) 2010.03.28
expat-2.0.1 example  (11) 2010.03.23
Posted by 구차니
base는 웹상에서 RSS로 주어지는 URL
api는 gdata API 상에서 주어지는 URL 이다.

http://gdata.youtube.com/feeds/base/standardfeeds/
http://gdata.youtube.com/feeds/api/standardfeeds/

요녀석이 url중 api가 들어간 것의 내용(MiTeC XML Viwer)

요녀석이 url중 base가 들어간 것의 내용(MiTeC XML Viwer)


base는 각종 데이터가 웹형식이고
api는 XML 답게 데이터로 들어있다는 점이 다르다. expat 등으로 파싱을 위해서라면
api 에서 하는것이 좋을듯 하다.

2010/01/04 - [파일방] - MiTeC XML Viewer (Free!)

Posted by 구차니
cvs와 svn을 사용하면서 느끼는 점은, 우열을 가리긴 모호하다는 것이다.
cvs가 나은점도 있고, svn이 나은점도 있고,
이러한 모호함 때문에 일단 회사 개발소스는 cvs로 유지중이긴 하지만...


거두절미하고, svn은 cvs의 단점을 개선하기 위해 만들어진건데
가장 큰 변경사항은 svn에서 디렉토리 이동이 편해졌다는 점이다.
cvs은 특정 소스의 위치를 변경하거나, 하위 디렉토리의 위치를 변경하기 위해서는
소스를 새로운 곳에 새롭게 Add 하고 기존의 파일을 Delete 해야 해서
이력추적을 할 수 없게 되지만, svn에서는 이력추적이 가능해진다.


일단 사소한 것들을 고고싱 (기준은 CVS)

SVN의 장점

1. 디렉토리 이동이 편리함
    안정화된 프로젝트라면 상관없지만, 프로젝트 초기에는 디렉토리 이동이나 파일 삭제/이름 변경이 빈번한데
    cvs는 이러한 이력을 남길수가 없기 때문에, 초기 프로젝트 셋업시에는 svn이 매우 편리함.
    (이동도 편리하지만, 그에 비해 이력이 따라와서 과거의 변경점이 유지 된다는 부가적인 장점)

2. 오프라인 사용이 용이함
    확실하게 어느정도까지 오프라인 사용이 가능한지는 모호하지만, 최소한 마지막 버전과 Diff가 가능하다.
    cvs에서는 항상 서버와 비교를 하기 때문에 소스 변경사항이 있는건 알아도
    어떤 내용이 서버와 차이가 있는지 알수 없지만, svn 에서는 오프라인에서도 diff가 가능함
    (svn 자체적으로 데이터를 유지하고 있음 = 받는 측 용량 부담 증가)

3. 서버 하드공간이 절약
    cvs을 cvs2svn으로 변환해본 결과 대략 25% 이상의 공간이 절약됨
    초기 업로드는 원본으로 올리지만, diff 내용들을 gzip으로 압축하므로 서버 공간 요구량이 줄어듦
    2009/05/11 - SVN과 CVS 저장소 용량비교(compare Repository Size of CVS & SVN)

4. 커밋마다 revision이 올라감
    하나의 변동사항이나, 복수의 파일을 한번에 commit 하면 revision이 변동되고,
    프로젝트 전반적인 변동사항을 추적하기 편리함.
    cvs는 파일단위 revision이기 때문에 프로젝트 전체의 변동이나
    "어떤 파일이 변경되기 이전 시점"으로 롤백하기 매우 난해하나
    svn에서는 commit 단위로 revision이 붙으므로, 잘못 commit 하더라도 복구가 용이함
    (부가적으로 cvs에 비해서 프로젝트 전반적인 변경의 흐름을 읽기 쉬움)

5. atomic commit
    atomic 은 DB에서 하나의 행동의 묶음이 완결되지 않으면 수행되지 않은것으로 복구가 되는 것을 의미하는데
    cvs에서 아무생각없이 commit에서 변동사항들을 본다고 하다가 commit 눌러 올려서 도중에 cancel 했지만
    몇개는 변경되어 난감한 상황을 겪어봤다면 이 녀석의 유용함을 깨달을 수 있다.



SVN 단점

1. 서버 구성이 괴랄하다
    무슨 svn 제대로 쓰려면 apache까지 깔아야 해?
    로그를 남기기 위해서는 svn 자체적으로는 로그가 안남으므로 apache의 로그나 인증을 이용해야 함.
    관리자 측면에서 로그가 남지않는다는건.. 좀 불안해진다.
    (머...... 사용자는 서버 관리자의 고충은 알바없지?)

2. tag 관리가 밋밋함
   너무 많은 자유는 없는것과 다름 없다지만.. svn의 표준(?) repository는 아래와 같이 구성한다.
   2009/05/11 - SVN repository 구조

   개별 프로젝트 별로 trunk / branches / tag를 관리하고
   tagging을 위해서 전체 프로젝트를 tag 하위 디렉토리로 tag 번호를 붙여 복사해주면 된다.
   어쩌면 매우 간편하지만, cvs의 정말 꼬리표를 붙인다는 작업에 비하면 아쉬운 면이 있다.
   cvs에서는 tagging을 하려면 서버와 local의 내용이 동일해야 하고, tagging시 변동 파일이 하나라도 있으면 붙일수 없어
   업데이트 되지 않는 파일이 있는지 빼먹지 않을수 있는 여지가 있지만, svn은 서버에서 클라이언트를 보지 않고
   작업이 가능해지므로 업데이트 되지 않은(혹은 누구가 그 순간 올린 내용까지) 부분이 빼먹거나 더 들어갈수 있다.
   개인 취향이겠지만, tag는 cvs의 약간은 딱딱하고 붙이는 맛이 있는 것이 좋다고 생각한다.

3. repository 구성의 모호함
   repository는 위와 같이 구성하려면 svn 사용자는 /calc /paint 두개의 repository를 기억해야 한다.
   commit 별로 revision이 증가하는 장점의 역효과로서, 단일 프로젝트레 단일 repository를 보장해주어야 제 힘을 발휘한다.
   서로 연관이 있는 두개의 프로젝트라고 하더라도 되도록이면 프로젝트를 분리하는 것이 좋다.
   (현재까진 상위 디렉토리의 목록을 (= 프로젝트 목록) 얻어내는 법을 모르겠다.)

   /home/svn을 만들고
   /home/svn/calc 에 create repository
   /home/svn/paint 에 create repository 를 하고
   svn에서는 /home/svn/calc , /home/svn/paint가 있음을 외우고 써야한다.
   (/home/svn에 접속하면 리파지터리를 알 수 없으므로 에러가 발생한다.)


'프로그램 사용 > Version Control' 카테고리의 다른 글

cvs2svn 사용방법 2  (0) 2010.04.23
svn / svnadmin 도움말  (0) 2010.04.23
GIT는 리눅스에서 받으시는걸 추천합니다.  (0) 2010.03.18
TortoiseGIT  (0) 2010.03.18
SVN repository 어떻게 구성하지?  (2) 2010.03.08
Posted by 구차니


Welcome to CMake, the cross-platform, open-source build system. CMake is a family of tools designed to build, test and package software. CMake is used to control the software compilation process using simple platform and compiler independent configuration files. CMake generates native makefiles and workspaces that can be used in the compiler environment of your choice.

[링크 : http://www.cmake.org/]

oscam을 컴파이르 하는데 cmake 라는것을 요구하길래 먼가해서 검색해 봤더니
cross platform을 지원하는 make 라고 한다.

사용법은
cmake
make 라는데

configure 와 유사한 역활을 하는것으로 보인다.

'프로그램 사용 > make, configure' 카테고리의 다른 글

cmake 사용  (0) 2011.10.07
cross compile 초기화 하기  (0) 2010.05.18
makefile 에서 컴파일할 목록 생성하기  (0) 2010.04.03
makefile 정렬하기  (2) 2010.03.31
make, gmake  (0) 2010.03.02
Posted by 구차니
mysql 실행하기
mysql -uUSERID -pPASSWORD

mysql 종료하기
quit
exit
ctrl-D

데이터베이스(database) > 테이블(table)
생성(create) / 삭제(drop)

블로그나 wiki 설치을 위한 데이터베이스 생성
create database DATABASENAME;

목록보기(show)
show databases;
use DATABASENAME;
show tables;

데이터베이스 삭제
drop DATABASENAME;

[링크 : http://mulsoft.com/site/bbs/board.php?bo_table=mulsoft04&wr_id=1&sca=USER]

'프로그램 사용 > mysql & mariaDB' 카테고리의 다른 글

mysql / mariaDB  (1) 2014.04.16
mysql transaction  (0) 2014.04.08
mysql grant 문  (0) 2014.04.01
mysql 암호변경하기  (0) 2013.02.21
mysql 명령어 정리  (0) 2012.12.01
Posted by 구차니