RDS Security group 생성, 등록

EC2 Security group 생성, 등록

RDS의 Security group에 EC2의 Security group 등록


#mysql -h <rds에 등록된 endpoint> -u <rds에 등록된 유저> -p <rds에 등록한 패스워드>


하면 db 사용가능 

Posted by 미야프
,


출처:http://tech-queries.blogspot.com/2011/06/how-to-get-public-ip-for-amazon-ec2.html

To obtain the internal IP address:

curl http://169.254.169.254/latest/meta-data/local-ipv4

To obtain the public IP address:
curl http://169.254.169.254/latest/meta-data/public-ipv4

Posted by 미야프
,

ImageMagic 6.5 버전과 6.7 이상 버전은 컨버팅시 속도차이가 좀 있다.


업데이트를 할경우.


yum erase ImageMagick //기존 버전 삭제

내 케이스에선 

해당 파일들을 받은후

rpm -Uvh ImageMagick-6.8.0-3.x86_64.rpm

rpm -Uvh ImageMagick-c++-6.8.0-3.x86_64.rpm

각자 깔아주었음.

(dependency 문제가 있을경우...

#rebuild evironment
yum install bzip2-devel freetype-devel libjpeg-devel libpng-devel libtiff-devel giflib-devel zlib-devel ghostscript-devel djvulibre-devel libwmf-devel jasper-devel libtool-ltdl-devel libX11-devel libXext-devel libXt-devel lcms-devel libxml2-devel librsvg2-devel OpenEXR-devel 

)

아래 사이트에대로 했을때 안됐기에...

As root, download the correct RPM from the ImageMagick site.  Then uninstall the system ImageMagick.  Then install this one.

http://www.imagemagick.org/script/binary-releases.php

2 yum erase ImageMagick</p><p>yum install --nogpgcheck ImageMagick-6.7.9-6.x86_64.rpm

Note: because the version # is beyond the one shipped with RHEL, it will not be updated automatically.  You will need to monitor ImageMagick for security updates and install them yourself.

Note: this is not recommended — replacing a RHEL package.  But sometimes it is needed.

2 yum erase ImageMagick
3 yum install --nogpgcheck ImageMagick-6.7.9-6.x86_64.rpm

Posted by 미야프
,

Error: Cannot retrieve repository metadata (repomd.xml) for repository: base. Please verify its path and try again


이와 같은 에러가 날경우 프록시 서버를 사용하고 있다면


/ect/yum.conf

에 proxy 세팅을 해준다 


(http이후는 사용할 프록시 서버 주소: 포트)

(proxy_username=프록시 유저명, proxy_password=프록시 유저 비밀번호)

게뱔 사용자용 세팅은

# The Web proxy server used by this account
http_proxy="http://mycache.mydomain.com:3128"
export http_proxy


글로벌 사용자용 세팅은

# The proxy server - proxy server:port number
proxy=http://mycache.mydomain.com:3128
# The account details for yum connections
proxy_username=yum-user
proxy_password=qwerty
출처: http://www.centos.org/docs/5/html/yum/sn-yum-proxy-server.html

Posted by 미야프
,

맥북을 사용한지 2년이 넘어가니 마우스패드에서 계속 마우스가 눌려저 있는 현상이 발생, 그냥 고장인가 싶었다... 그 눌림현상이 너무 심해져서 이것 저것 만지던중, 배터리가 빵빵하게 부풀어오른것을 확인하고 분리 시켜보았더니 마우스패드에서 눌림 현상이 사라졌다...

배터리만 교환하면 다시 잘쓸수 있겠네..ㅎㅎ

Posted by 미야프
,

네이트에 글 입력창 말고 글 뷰창에 블럭이 잡혀있을수 있네요, 블럭을 풀고 하니 됨 (풀거나 다시 블럭 잡고 복사 붙여 넣고 해보면... 정상적으로 복사 붙여넣기가 됨)

나중에 또 까먹기 전에 적어두자..
Posted by 미야프
,

금요일까지 됐는데 주말 쉬고 나니 갑자기 안됨.
찾아보니..

도구--> 환경설정 --> 단축키 --> 사전 설정 로드 --> 확인

하니 됨.
Posted by 미야프
,
예제대로 인증을 요청하면 2시간짜리로 끊어줌.
scope에 offline_access추가하면 사용자가 로그오프로 죽이지 않는한 없어지지 않음.
Posted by 미야프
,
1. 맥 OS시디를 넣고, 탐색을 실행.
2. E:(시디의 드라이브)\Boot Camp\Drivers\Apple에서 BootCamp.msi와 AppleKeyboardInstaller.exe를 컴퓨터내의 임의의 장소에 복사.
3. AppleKeyboardInstaller.exe를 압축툴을 사용해서 푼다.
4. 압축을 풀어 나온 파일중 DPInst.exe를 실행
5. 시작-->모든프로그램-->보조프로그램-->명령 프롬프트(우클릭)-->관리자로 실행 선택
6. cmd창을 열어서 BootCamp.msi가 있는 폴더로 이동, BootCamp.msi 실행.
7. 재시작.


대상: XP 프로페셔널, 유선 미니 맥 키보드(이름이 뭐더라..;;;)

내용 원본: ... 구글질중 어딘가...;;; (리붓하면서 정확한 위치를 못찾게 됐어요....;;;)

맥 키보드와 윈도 키보드 매칭:
Posted by 미야프
,
모든 파일과 설명은 http://forge.octo.com/jcaptcha/confluence/display/general/Developer+Documentation
이곳에서 확인 가능.

매이븐 2 를 사용하지 않았으므로 그 아래의 내용대로...

http://sourceforge.net/projects/jcaptcha/files/ 
에서 jcaptcha-all.jar 파일을 받고
http://commons.apache.org/downloads/download_collections.cgi
에서 commons-collection-3.2 혹은 상위 버전을 받아서
webcontent 밑의 WEB-INF 밑의 lib에 넣어 준다.

import com.octo.captcha.service.image.ImageCaptchaService;
import com.octo.captcha.service.image.DefaultManageableImageCaptchaService;

public class CaptchaServiceSingleton {

    private static ImageCaptchaService instance = new DefaultManageableImageCaptchaService();

    public static ImageCaptchaService getInstance(){
        return instance;
    }
}

클래스 생성

import com.octo.captcha.service.CaptchaServiceException;
import com.sun.image.codec.jpeg.JPEGCodec;
import com.sun.image.codec.jpeg.JPEGImageEncoder;

import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.awt.image.BufferedImage;
import java.io.ByteArrayOutputStream;
import java.io.IOException;


public class ImageCaptchaServlet extends HttpServlet {


    public void init(ServletConfig servletConfig) throws ServletException {

        super.init(servletConfig);

    }


    protected void doGet(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws ServletException, IOException {

       byte[] captchaChallengeAsJpeg = null;
       // the output stream to render the captcha image as jpeg into
        ByteArrayOutputStream jpegOutputStream = new ByteArrayOutputStream();
        try {
        // get the session id that will identify the generated captcha.
        //the same id must be used to validate the response, the session id is a good candidate!
        String captchaId = httpServletRequest.getSession().getId();
        // call the ImageCaptchaService getChallenge method
            BufferedImage challenge =
                    CaptchaServiceSingleton.getInstance().getImageChallengeForID(captchaId,
                            httpServletRequest.getLocale());

            // a jpeg encoder
            JPEGImageEncoder jpegEncoder =
                    JPEGCodec.createJPEGEncoder(jpegOutputStream);
            jpegEncoder.encode(challenge);
        } catch (IllegalArgumentException e) {
            httpServletResponse.sendError(HttpServletResponse.SC_NOT_FOUND);
            return;
        } catch (CaptchaServiceException e) {
            httpServletResponse.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
            return;
        }

        captchaChallengeAsJpeg = jpegOutputStream.toByteArray();

        // flush it in the response
        httpServletResponse.setHeader("Cache-Control", "no-store");
        httpServletResponse.setHeader("Pragma", "no-cache");
        httpServletResponse.setDateHeader("Expires", 0);
        httpServletResponse.setContentType("image/jpeg");
        ServletOutputStream responseOutputStream =
                httpServletResponse.getOutputStream();
        responseOutputStream.write(captchaChallengeAsJpeg);
        responseOutputStream.flush();
        responseOutputStream.close();
    }
}

클래스 생성

web.xml에

<servlet>
        <servlet-name>jcaptcha</servlet-name>
        <servlet-class>ImageCaptchaServlet</servlet-class>
        <load-on-startup>0</load-on-startup>
    </servlet>

<servlet-mapping>
        <servlet-name>jcaptcha</servlet-name>
        <url-pattern>/jcaptcha</url-pattern>
    </servlet-mapping>

추가

사용할 페이지에

<img src="/jcaptcha">
<input type='text' name='j_captcha_response' value=''>

추가


입력값과 이미지가 맞는지 확인할 다음 소스를 서블릿이나 적적한 곳에 삽입

Boolean isResponseCorrect =Boolean.FALSE;
           //remenber that we need an id to validate!
           String captchaId = httpServletRequest.getSession().getId();
           //retrieve the response
           String response = httpServletRequest.getParameter("j_captcha_response");
           // Call the Service method
            try {
                isResponseCorrect = CaptchaServiceSingleton.getInstance().validateResponseForID(captchaId,
                        response);
            } catch (CaptchaServiceException e) {
                 //should not happen, may be thrown if the id is not valid
            }

//do something according to the result!

해주면 끝... 이라고 나와있지만...

Could not initialize class CaptchaServiceSingleton
에러가 나네..... 살펴 보니

commons-logging.jar 파일이 라이브러리에 더 추가 되어야 함.

/////////////////////////////////////////////////////////

위의 자동생성 이미지 커스터마이징 부분

다음과 같은 클래스 하나 더 생성

public class MyImageCaptchaEngine extends ListImageCaptchaEngine {
     protected void buildInitialFactories() {
            WordGenerator wgen = new RandomWordGenerator("ABCDEFGHIJKLMNOPQRSTUVWXYZ123456789");
            RandomRangeColorGenerator cgen = new RandomRangeColorGenerator(
                 new int[] {0, 100},
                 new int[] {0, 100},
                 new int[] {0, 100});
            TextPaster textPaster = new RandomTextPaster(new Integer(7), new Integer(7), cgen, true);

            BackgroundGenerator backgroundGenerator = new FunkyBackgroundGenerator(new Integer(200), new Integer(100));

            Font[] fontsList = new Font[] {
                new Font("Arial", 0, 10),
                new Font("Tahoma", 0, 10),
                new Font("Verdana", 0, 10),
             };

             FontGenerator fontGenerator = new RandomFontGenerator(new Integer(20), new Integer(35), fontsList);

             WordToImage wordToImage = new ComposedWordToImage(fontGenerator, backgroundGenerator, textPaster);
             this.addFactory(new GimpyFactory(wgen, wordToImage));
     }
}

//위의 WordGenerator wgen = new RandomWordGenerator("ABCDEFGHIJKLMNOPQRSTUVWXYZ123456789"); 부분에서 따옴표 안쪽을 숫자만으로 바꾸면 숫자만으로 출력되며, 원하는 문자로 바꿀수 있음

그리고 싱글턴 클래스를 다음으로 수정
public class CaptchaServiceSingleton {
    private static ImageCaptchaService instance;
    static {
    instance = new DefaultManageableImageCaptchaService(
    new FastHashMapCaptchaStore(),
    new MyImageCaptchaEngine(),
    180,
    100000,
    75000);
    }
    public static ImageCaptchaService getInstance(){
        return instance;
    }
}

하면, 앞의 기본형보다 조금더 보기 좋은 이미지를 생성하게 됨
Posted by 미야프
,