이런저런 연유로 SVN Server에 직접 접근은 불가능하고 mount를 이용해 file로 접근 가능한 방법을 찾아야만 하는 상황이 생겼다.

그래서 사용하게 된 방법이 SVN mirroring.

미러링에도 여러가지 방법이 있으나 그 중에서 svnsync를 사용하기로 했고 아래처럼 해서 성공.

원격에 있는 SVN 저장소를 $REPO라고 가정하고

로컬에 미러링할 경로를 $MIRROR라고 하자.

1. 우선 빈 저장소를 하나 생성한다.

svnadmin create $MIRROR

2. 오류없이 생성되었다면 $MIRROR/hooks 경로에 pre-revprop-change 라는 파일을 하나 생성한다.

hook에 가보면 임시 파일도 있으니 이용해도 되고 exit 0; 으로 종료되는 파일을 생성해줘도 된다.

pre-revprop-change 라는 파일은 revision 정보가 바뀔 때 실행되는 파일로 보이는데 svnsync 자체를 제한한다거나 하는 용도로 이용 가능.

예를 들어 아래와 같은 내용을 추가해두면 svnsync를 userA 이외에는 사용 못하게 할 수 있다.

(userA가 아닌 경우 실행시 메세지를 출력하고 1을 리턴하면서 실패로 종료됨)

#!/bin/sh
USER=”$3″
if [ "$USER" = "userA" ]; then exit 0; fi
echo “Only the userA user can change revprops” >&2
exit 1

3. 그 이후에 실행 권한을 부여한다.

chmod +x $MIRROR/hooks/pre-revprop-change

4. 그 다음은 svnsync 초기화 작업. (원격 SVN 저장소와의 초기화)

svnsync init –username userA file://$MIRROR $REPO

5. 마지막으로 동기화하라고 아래처럼 명령을 내리면 원격 저장소에 있는 내용과 동기화를 하게 된다.

svnsync sync file://$MIRROR

문제 중 하나는 sync 명령을 내릴 때만 동기화를 하지 자동으로 동기화를 진행하지는 않는다는건데

post-commit을 이용해 commit 발생시 동기화를 시키도록 스크립트를 만들던지 크론탭 등의 스케줄러를 이용하는 방법을 이용해야 할 것으로 보임.

 

출처 : http://blurblah.net/

'Dev > SVN' 카테고리의 다른 글

using svnsync  (0) 2013.01.02
SVN *.a library 추가 방법  (0) 2011.12.07

Garrett helped write svnsync as part of Subversion 1.4, but I wasn’t able to find any documentation for it, other than passing –help.

svnsync is a one way replication system for Subversion. It allows you to create a read-only replica of a repository over any RA layer (including http, https, svn, svn+ssh).

First, lets setup the initial sync. We have two repositories, I will skip the details of svnadmin create. For the remote access to the replica repository, I used svnserve, and I added a user with full write access. The destination repository should be completely empty before starting.

So, to make this easier, I am going to put the repository URIs into enviroment variables:

$ export FROMREPO=svn://svn.example.com/
$ export TOREPO=svn://dest.example.com/

Because the svnsync is allowed to rewrite anything on the TOREPO, we need to make sure the commit hooks are configured to allow our ‘svnsync’ user to do anything it wants.

On the server hosting TOREPO, I ran this:

$ echo "#!/bin/sh" > hooks/pre-revprop-change
$ chmod 755 hooks/pre-revprop-change

Now we are ready to setup the sync:

$ svnsync init ${TOREPO} ${FROMREPO}

This will prompt you for the username, password, and also sets several revision properties on the $TOREPO, for revision zero. It doesn’t actually copy any of the data yet. To list the properties that it created, run:

$ svn proplist --revprop -r 0 ${TOREPO}

  svn:sync-from-uuid
  svn:sync-last-merged-rev
  svn:date
  svn:sync-from-url

$ svn propget svn:sync-from-url --revprop -r 0 ${TOREPO}

  svn://svn.example.com/

So all the knowledge about what we are syncing from is stored at the destination repository. No state about this sync is stored in the source repository.

We are now ready to begin copying data:

$ svnsync --non-interactive sync ${TOREPO}

And if everything is setup correctly, you will start replicating data.

Except, I suck. And the first thing I did was hit control+c. I figured this is a cool replication system, so I just ran the sync command from above again, and got this:

$ svnsync --non-interactive sync ${TOREPO}

Failed to get lock on destination repos, currently held by 'svn.example.com:0e4e0d98-631d-0410-9a00-9320a90920b3'
Failed to get lock on destination repos, currently held by 'svn.example.com:0e4e0d98-631d-0410-9a00-9320a90920b3'
Failed to get lock on destination repos, currently held by 'svn.example.com:0e4e0d98-631d-0410-9a00-9320a90920b3'
Failed to get lock on destination repos, currently held by 'svn.example.com:0e4e0d98-631d-0410-9a00-9320a90920b3'
Failed to get lock on destination repos, currently held by 'svn.example.com:0e4e0d98-631d-0410-9a00-9320a90920b3'
Failed to get lock on destination repos, currently held by 'svn.example.com:0e4e0d98-631d-0410-9a00-9320a90920b3'
Failed to get lock on destination repos, currently held by 'svn.example.com:0e4e0d98-631d-0410-9a00-9320a90920b3'
Failed to get lock on destination repos, currently held by 'svn.example.com:0e4e0d98-631d-0410-9a00-9320a90920b3'
Failed to get lock on destination repos, currently held by 'svn.example.com:0e4e0d98-631d-0410-9a00-9320a90920b3'
Failed to get lock on destination repos, currently held by 'svn.example.com:0e4e0d98-631d-0410-9a00-9320a90920b3'
svnsync: Couldn't get lock on destination repos after 10 attempts

Oh snap. I guess its not so easy to restart after an aborted sync.

I started debugging, and found that svnsync kept its lock state in a special property in revision zero again.

So, To fix this, we can safely just delete this lock:

$ svn propdelete svn:sync-lock --revprop -r 0  ${TOREPO}

Now running sync again works! Hurrah!

After the sync finishes, we will want to keep the replica up to date.

I personally set a ‘live’ sync, but it is also possible to use a crontab or other scheduling method to invoke sync whenever you want.

To setup a live sync, on the FROMREPO server, I appended this to my hooks/post-commit file:

svnsync --non-interactive sync svn://dest.example.com/ &

You will want to make sure that the user-running subversion (and the hook script) has a cached copy of the authentication info for the destination repository.

Unfortunately, the post-commit hook won’t catch everything, so we also need to added this to the post-revprop-change hook:

svnsync --non-interactive copy-revprops  svn://dest.example.com/ ${REV} &

This will help propagate things like editing svn:log messages.

And there you go, thats the path I took to mirror one of my repositories onto another machine.

 

출처 : http://journal.paul.querna.org/articles/2006/09/14/using-svnsync/

'Dev > SVN' 카테고리의 다른 글

svnsync 명령을 이용해 SVN mirroring 하기  (0) 2013.01.02
SVN *.a library 추가 방법  (0) 2011.12.07

[Spring framework 설치] 

-- 이클립스 플러그인 설치

1. 상위 help탭 > install new software 선택 후 Add 눌러서 http://springide.org/updatesite 입력

 

2. Core / Spring IDE & Extensions / Spring IDE 추가 후 Next

 

3. Next 클릭

 

4. I accept 클릭 

 

5. Install Software


-- Spring Container 설치

1. 스프링 사이트(http://www.springsource.org/download)에 접속, 하단의 Spring Framework 클릭.


2. 최근 버젼 다운로드 클릭. [용량이 커서 파일 공유는 못함..ㅈㅅ]


3. 회원 가입

4. 다운로드


5. jar 파일을 관리할 Project를 추가하여 받은 zip 파일의 압축을 푼 내용 중 jar파일을 넣어준다.


3. Working Set을 관리한다.


출처 : http://blog.daum.net/gunsu0j

'Dev > JAVA' 카테고리의 다른 글

자바 데몬(daemon) 만들기  (0) 2011.06.09
Java Simple Daemon  (0) 2011.06.05
자바 이미지 사이즈 추출 예제  (0) 2011.04.23
자바 이미지 리사이즈(썸네일)  (0) 2011.04.06

'Dev > Javascript' 카테고리의 다른 글

20 Best jQuery Slideshow / Photo Gallery Plugins  (0) 2012.02.29
Prototype에서 jQuery로 옮겨타기  (0) 2011.07.31
Firebug의 console 파헤치기.  (0) 2011.07.19
fireBug 사용법  (0) 2011.07.19
[jQuery] firebug로 디버그  (0) 2011.07.19
출처 : http://graphicalerts.com/20-best-jquery-slideshow-image-photo-gallery-plugins/

Photo Gallery, picture gallery, or slideshow are the best way to showcase your images / photos to your readers. This post is a showcase of 20 best jQuery slideshow / photo gallery plugins .

20 Best jQuery Slideshow / Photo Gallery Plugins

1. Galleria

jQuery slideshow

Galleria is a JavaScript image gallery unlike anything else. It can take a simple list of images and turn it into a foundation of multiple intelligent gallery designs, suitable for any project.

2. Galleriffic

jQuery slideshow

Galleriffic is a jQuery Slideshow plugin that provides a rich, post-back free experience optimized to handle high volumes of photos while conserving bandwidth.

3. Nivo Slider

jQuery slideshow

Nivo Slider is a lightweight jQuery Slideshow  plugin for creating good-looking image sliders.

4. Avia Slider

jQuery slideshow

AviaSlider is a jQuery Slideshow plugin with very unique transition effects.

5. Pikachoose

jQuery slideshow

Pikachoose is a lightweight Jquery plugin that allows easy presentation of photos with options for slideshows, navigation buttons, and auto play.

6. Image Flow

jQuery slideshow

Image flow is inspired by Apple’s cover flow. The javascript renders the cover flow effect without any noticeable flaw.

7. SpaceGallery

jQuery slideshow

SpaceGallery is onother cool jQuery Slideshow plugin  display Your images.

8. jQuery Gallery Scroller

jQuery slideshow

jQuery Gallery Scroller (jqGalScroll) takes list of images and creates a smooth scrolling photo gallery scrolling vertically, horizontally, or diagonally.

9. prettyPhoto

jQuery slideshow

jQuery Lightbox clone, pretty similar to original Lightbox with few another features and full documentation.

10. s3slider

jQuery slideshow

JQuery Slideshow with three different features and displaying sides, fully customizable sizes, delay speed and with good documentation.

11. GalleryView

jQuery slideshow

This is a cool jQuery Slideshow Plugin to show images as gallery

12. Supersized

jQuery slideshow

Supersized is an image gallery built by BuildInternet.com and it is able to slideshows the images with full screen.

13. EOGallery

jQuery slideshow

EOGallery is a web animated slideshow gallery made with jQuery.

14. PictureSlides

jQuery slideshow

PictureSlides is a plugin for jQuery, and it is a highly customizable JavaScript-based way to easily turn your images into a collection viewable as a slideshow, and with fading effects, if desired.

15. Pirobox

jQuery slideshow

Pirobox is lightweight jQuery Lightbox script.

16. CrossSlide

jQuery slideshow

CrossSlide is a jQuery plugin implementing some common slide-show animations, traditionally only available via Adobe Flash™ or other proprietary plugins. CrossSlide builds upon jQuery’s animation facility, so it is as portable across browsers as jQuery itself (that is, a lot!)

17. ColorBox

jQuery slideshow

18. Coin Slider

jQuery slideshow

jQuery Image Slider with Unique Effects.

19. jQuery.popeye

jQuery slideshow

jQuery.popeye is an advanced image gallery script built on the JavaScript library jQuery.

20. Smoot Div Scroll

jQuery slideshow

Smooth Div Scroll is a jQuery plugin that scrolls content horizontally left or right. Apart from many of the other scrolling plugins that have been written for jQuery, Smooth Div Scroll does not limit the scroling to distinct steps. As the name of the plugin hints, scrolling is smooth.

Related posts:

  1. 20 Awesome jQuery Lightbox Plugins Share jQuery is a powerful tool in the hands of developers and some even call it a flash killer as...
  2. 25 Beautiful Examples of CSS and jQuery Drop down Menu Tutorials Share Here you will find 25 high quality CSS and jQuery drop down menu examples or just multi level menu...
  3. 21 Best jQuery Tooltip Plugins, Demos, Examples & Tutorials Share Today we are posting some attractive, Handy and useful jquery Tooltip plugins for your new projects. If the tooltip...
  4. 50 best photoshop photo effects tutorials Share I’ve collected 50 best Photoshop photo effects tutorials that will inspire and help you to master Photoshop photo effects...
  5. 40 Beautiful Examples of Ajax CSS forms styling Share Forms are an important part of every website. It can be as simple as getting subscribed to website RSS...

'Dev > Javascript' 카테고리의 다른 글

jquery slideshow  (0) 2012.02.29
Prototype에서 jQuery로 옮겨타기  (0) 2011.07.31
Firebug의 console 파헤치기.  (0) 2011.07.19
fireBug 사용법  (0) 2011.07.19
[jQuery] firebug로 디버그  (0) 2011.07.19
APC(Alternative PHP Cache)는 eAccelerator 처럼 PHP 캐싱을 수행합니다.

- APC 설치
APC를 다운로드 후 설치를 진행합니다.
http://pecl.php.net/package/APC
[root@yongbok ~]# cd /usr/local/src
[root@yongbok ~]# wget http://pecl.php.net/get/APC-3.1.3p1.tgz
[root@yongbok ~]# tar xzvf APC-3.1.3p1.tgz
[root@yongbok ~]# cd APC-3.1.3p1
[root@yongbok ~]# /usr/local/php5/bin/phpize
[root@yongbok ~]# ./configure --enable-apc --with-php-config=/usr/local/php5/bin/php-config
[root@yongbok ~]# make && make install
Installing shared extensions: /usr/local/php5/lib/php/extensions/no-debug-non-zts-20060613/
[root@yongbok ~]# ls -l /usr/local/php5/lib/php/extensions/no-debug-non-zts-20060613 | grep apc
-rwxr-xr-x 1 root wheel 542184 1 25 02:54 apc.so

php.ini 파일에 아래 내용을 추가 합니다.
[root@yongbok ~]# vi /usr/local/apache2/conf/php.ini
[APC]
extension_dir=/usr/local/php5/lib/php/extensions/no-debug-non-zts-20060613
extension=apc.so
apc.mode=shm
apc.file_md5=1
apc.ttl=3600
apc.idle=900
apc.hash_buckets=256
apc.max_file_size=1024
apc.cachedir=/tmp
apc.mmap_file_mask=/tmp/apc.XXXXXX


아파치를 재시작 후 phpinfo 를 이용하여 APC를 확인합니다.
[root@yongbok ~]# /usr/local/apache2/bin/apachectl restart
[root@yongbok ~]# echo '<?php phpinfo(); ?>' > /var/www/html/phpinfo.php




출처 : http://www.cyworld.com/ruo91/3591174


1. http://pecl.php.net/package/apc 에서 다운로드
2. tar -xvzf APC-3.1.9.tgz
3. cd APC-3.1.9
4. ....../php/bin/phpize
5. ./configure --enable-apc-mmap --with-apxs=/home/apache/bin/apxs --with-php-config=/home/php/bin/php-config
6. make
7. make install
php 의 extension 모듈 위치 확인할 것.
8. php.ini 수정하기
extension_dir=설정한위치로적용
예) ....../php/lib/php/extensions/no-debug-zts-20090626/apc.so
extension_dir=....../php/lib/php/extensions
extension="no-debug-zts-20090626/apc.so"

extension="apc.so"
apc.enabled=1
apc.shm_segments=1
apc.shm_size=256
apc.ttl=7200
apc.user_ttl=7200
apc.num_files_hint=1024
apc.mmap_file_mask=/tmp/apc.XXXXXX
apc.enable_cli=1
apc.include_once_override=1

[출처] php apc 추가하기|작성자 밍구

[번역] PHP 코드를 최적화하는 40가지 팁

가끔 PHP로 웹페이지를 작성할 일이 있는데, 유용한 팁을 우연히 보게 되어 한글로 옮겨적어본다.

원문: Reinhold Weber씨의 40 Tips for optimizing your php Code

  1. 메쏘드가 static이 될 수 있다면 static으로 선언하라. 4배 빨라진다.
  2. echo가 print보다 빠르다.
  3. 문자열을 이어붙이지 말고, echo를 이용하여 여러 개의 파라미터를 적어라.
  4. for 루프을 위핸 최대값(탈출조건)을 루프 안에서가 아니고 루프 시작 이전에 지정하라.
  5. 메모리를 해제하기 위해 변수를 unset하라. 특히 커다란 배열은 그래야 된다.
  6. get, set, __autoload와 같은 마법을 피해라.
  7. require_once()는 비싸다.
  8. include와 require를 사용할 때, 경로를 찾는데 시간이 적게 걸리는 full path를 사용하라.
  9. 스크립트가 언제 실행했는지 알고 싶으면 time()보다 $_SERVER['REQUEST_TIME']이 좋다.
  10. 정규표현식보다는 가능하면 strncasecmp나 strpbrk, stripos를 사용하라.
    1. 역주
    2. strncasecmp: 두 문자열의 앞쪽 일부가 대소문자 구분없이 일치하는지 확인할 때 사용
    3. strpbrk: 문자 집합에 속한 특정 문자가 문자열에 나타나는지 확인할 때 사용
    4. stripos: 대소문자 구분없이 특정 문자열이 다른 문자열에 포함되는지 확인할 때 사용
  11. str_replace가 preg_replace보다 빠르지만, strtr은 str_replace보다 4배 빠르다.
  12. 만약 문자열 교체 같은 함수가 배열과 문자열을 인자로 받아들이면, 그리고 그 인자 리스트가 길지 않다면, 배열을 한 번에 받아들여서 처리하는 것 대신에 한 번에 문자열을 하나씩 넘겨서 처리하는 것을 고려해봐라.
  13. 여러 개의 if/else if 문장 대신에 select 문장을 사용하는 게 더 좋다.
  14. @를 이용한 에러 출력 방지는 매우 느리다.
  15. Apache의 mod_deflate를 켜라.
    1. 역주
    2. mod_deflate는 서버의 출력을 클라이언트에게 보내기 전에 압축하는 모듈임
  16. DB를 다 사용했으면 연결을 닫아라.
  17. $row['id']가 $row[id]보다 7배 빠르다.
  18. 에러 메시지는 비싸다.
  19. for 루프의 표현식 안에서 함수를 사용하지 마라. for ($x = 0; $x < count($array); $x)에서 count() 함수가 매번 호출된다.
  20. 메쏘드 안에서 지역 변수를 증가시키는 것이 거의 함수 안에서 지역 변수를 호출(증가?)하는 것만큼 빠르다.
  21. 전역 변수를 증가시키는 것이 지역 변수를 증가시키는 것보다 2배 느리다.
  22. 객체의 멤버변수를 증가시키는 것이 지역 변수를 증가시키는 것보다 3배 느리다.
  23. 값이 지정되지 않은 지역 변수를 증가시키는 것이 미리 초기화된 변수를 증가시키는 것보다 9~10배 느리다.
  24. 전역 변수를 함수 안에서 사용하지 않으면서 그저 선언하기만 해도 (지역 변수를 증가시키는 것만큼) 느려진다. PHP는 아마 전역 변수가 존재하는지 알기 위해 검사를 하는 것 같다.
  25. 메쏘드 호출은 클래스 안에서 정의된 메쏘드의 갯수에 독립적인 듯 하다. 왜냐하면 10개의 메쏘드를 테스트 클래스에 추가해봤으나 성능에 변화가 없었기 때문이다.
  26. 파생된 클래스의 메쏘드가 베이스 클래스에서 정의된 것보다 더 빠르게 동작한다.
  27. 한 개의 매개변수를 가지고 함수를 호출하고 함수 바디가 비어있다면(함수 내부에서 아무것도 실행하지 않는다면) 그것은 7~8개의 지역변수를 증가시키는 것과 똑같은 시간을 차지한다. 비슷한 메쏘드 호출은 마찬가지로 15개의 지역변수를 증가시키는 연산쯤 된다.
  28. 문자열을 이중 따옴표 대신에 단일 따옴표로 둘러싸는 것은 좀 더 빠르게 해석되도록 한다. 왜냐하면 PHP가 이중 따옴표 안의 변수를 찾아보지만 단일 따옴표 안에서는 변수를 찾지 않기 때문이다. 물론 문자열 안에서 변수를 가질 필요가 없을 때만 이렇게 사용할 수 있다.
  29. 문자열을 echo할 때 마침표 대신에 쉼표로 분리하는 것이 더 빠르다.
    1. 주의: 이것은 여러 문자열을 인자로 받아들이는 함수인 echo로만 작동한다.
  30. Apache에 의해 PHP 스크립트는 정적 HTML 페이지보다 최소 2에서 10배 느리게 서비스된다. 더 많은 정적 HTML 페이지와 더 적은 스크립트를 사용하려고 노력하라.
  31. PHP 스크립트는 캐시되지 않으면 매번 재 컴파일된다. 컴파일 시간을 제거함으로써 25~100%만큼의 성능을 증가시키기 위해 PHP 캐싱 도구를 설치하라.
  32. 가능한 한 많이 캐시하라. memcached를 사용하라. memcached는 고성능 메모리 객체 캐싱 시스템이다.
  33. 문자열을 가지고 작업하며 문자열이 특정 길이인지 확인할 필요가 있을 때, strlen() 함수를 쓸 것이다. 이 함수는 계산없이 zval 구조체에서 사용할 수 있는 이미 알려진 문자열 길이를 반환하기 때문에 매우 빠르다. 그러나 strlen()이 함수이기 때문에 여전히 조금 느리다. 왜냐하면 함수 호출은 언급된 함수의 실행 뒤에 lowercase와 hashtable lookup같은 여러 개의 연산을 호출하기 때문이다. 어떤 경우에는 isset() 트릭을 이용하여 코드의 스피드를 증가시킬 수도 있다.
    if (strlen($foo) < 5) { echo "Foo is too short"; }
    if (!isset($foo{5})) { echo "Foo is too short"; }

    isset()을 호출하는 것은 strlen()과는 달리 isset()이 언어 기본문법이고 함수가 아니기 때문에 함수 찾와 lowercase 작업을 필요로 하지 않으므로 strlen()보다 더 빠를 수도 있다. 이것은 가상적으로 문자열의 길이를 결정하는 실제 코드에 과부하가 없다는 것을 의미한다.

  34. 변수 $i의 값을 증가시키거나 감소키킬 때, $i++은 ++$i보다 조금 더 느릴 수 있다. 이것은 PHP의 특징이고 다른 언어에는 해당되지 않으니 좀 더 빨라질 것을 기대하면서 C나 Java 코드를 바꾸러 가지 마라. 안 빨라질 것이다. ++$i는 PHP에서 좀 더 빠른데 그것은 $i++에 4개의 opcode가 사용되는 대신에 3개만 필요하기 때문이다. 후증가는 사실 증가될 임시변수의 생성을 초래한다. 반면에 전증가는 원래 값을 직접 증가시킨다. 이것은 opcode가 Zend의 PHP optimizer처럼 최적화하는 최적화 기법의 하나이다. 모든 opcode optimizer들이 이 최적화를 수행하는 것은 아니고 많은 ISP와 server들이 opcode optimizer없이 수행되고 있기 때문에 명심하는 게 좋을 것이다.
  35. 모든 것이 OOP일 필요는 없다. 종종 그것은 너무 많은 과부하가 된다. 각각의 메쏘드와 객체 호출은 메모리를 많이 소비한다.
  36. 모든 데이터 구조를 클래스로 구현하지 마라. 배열도 유용하다.
  37. 메쏘드를 너무 많이 분리하지 마라. 어떤 코드를 정말 재사용할지 생각해봐라.
  38. 항상 메쏘드의 코드를 나중에 필요할 때 분리할 수 있다.
  39. 수많은 미리 정의된 함수를 활용해라.
  40. 매우 시간을 소비하는 함수가 있다면, C 확장으로 작성하는 것을 고려해봐라.
  41. 당신의 코드를 프로파일해봐라. 프로파일러는 코드의 어떤 부분이 가장 많은 시간을 소비하는지 보여준다. Xdebug 디버거는 이미 프로파일러를 포함하고 있다. 프로파일링은 전체적인 병목을 보여준다.
  42. Apache 모듈로 사용가능한 mod_gzip은 실행 중에 데이터를 압축하여 전송할 데이터를 80%까지 줄일 수 있다.

+ Recent posts