Tuesday, October 13, 2015

Git 윈도우10에서 SourceTree가 다운될때

윈도우10에서는 Git클라이언트인 SourceTree 최신버전이 다운된다.
그래서 아래 링크에 있는 SourceTree 1.5.2를 받아서 설치하면 해결된다.
하지만 SourceTree 1.5.2는 파일을 add/commit할때 폴더별로 정렬이 안되어서 불편하다.
아직은 윈도우8.1이 가장 편리한 윈도우인것 같다.(최신 지원 기능 및 적은 업데이트)

다운로드

Monday, October 12, 2015

Redis 설치(Mac)

brew redis install
redis-server

Saturday, October 10, 2015

Ruby cannot load such file -- 2.2/pg_ext (LoadError) 에러 해결 방법

윈도우에 Ruby on Rails를 설치하여 빌드하여 실행 하려고 하는데(rails s) 다음과 같은 에러가 발생했다.

C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/pg-0.17.1-x64-mingw32/lib/pg.rb:10:in `require': cannot load such file -- 2.2/pg_ext (LoadError)
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/pg-0.17.1-x64-mingw32/lib/pg.rb:10:in `rescue in <top (required)>'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/pg-0.17.1-x64-mingw32/lib/pg.rb:3:in `<top (required)>'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.10.6/lib/bundler/runtime.rb:76:in `require'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.10.6/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.10.6/lib/bundler/runtime.rb:72:in `each'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.10.6/lib/bundler/runtime.rb:72:in `block in require'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.10.6/lib/bundler/runtime.rb:61:in `each'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.10.6/lib/bundler/runtime.rb:61:in `require'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.10.6/lib/bundler.rb:134:in `require'
        from C:/git/amanda-api/config/application.rb:7:in `<top (required)>'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.1.13/lib/rails/commands/commands_tasks.rb:79:in `require'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.1.13/lib/rails/commands/commands_tasks.rb:79:in `block in server'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.1.13/lib/rails/commands/commands_tasks.rb:76:in `tap'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.1.13/lib/rails/commands/commands_tasks.rb:76:in `server'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.1.13/lib/rails/commands/commands_tasks.rb:40:in `run_command!'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.1.13/lib/rails/commands.rb:17:in `<top (required)>'
        from bin/rails:4:in `require'
        from bin/rails:4:in `<main>'

이를 해결하는 방법은 다음과 같다.
gem instasll pg --pre
gem list pg

확인결과 최신버전은 0.18.3이다.
그럼 Gemfile, Gemfile.lock에서 pg의 버전을 0.18.3으로 변경하면 해결 된다.

Monday, October 5, 2015

Android keyboard show/hide event

    public static void hideKeyBoard(View v) {
        InputMethodManager imm = (InputMethodManager) v.getContext().getSystemService(INPUT_METHOD_SERVICE);
        imm.hideSoftInputFromWindow(v.getApplicationWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS);
    }

    public static void showKeyBoard(View v) {
        InputMethodManager imm = (InputMethodManager) v.getContext().getSystemService(INPUT_METHOD_SERVICE);
        imm.showSoftInput(v, InputMethodManager.SHOW_IMPLICIT);
    }

    private ViewTreeObserver.OnGlobalLayoutListener keyboardLayoutListener = new ViewTreeObserver.OnGlobalLayoutListener() {
        @Override
        public void onGlobalLayout() {
            int heightDiff = rootLayout.getRootView().getHeight() - rootLayout.getHeight();
            int contentViewTop = getWindow().findViewById(Window.ID_ANDROID_CONTENT).getTop();

            LocalBroadcastManager broadcastManager = LocalBroadcastManager.getInstance(BaseFragmentActivity.this);

            if(heightDiff <= contentViewTop){
                onHideKeyboard();

                Intent intent = new Intent("KeyboardWillHide");
                broadcastManager.sendBroadcast(intent);
            } else {
                int keyboardHeight = heightDiff - contentViewTop;
                onShowKeyboard(keyboardHeight);

                Intent intent = new Intent("KeyboardWillShow");
                intent.putExtra("KeyboardHeight", keyboardHeight);
                broadcastManager.sendBroadcast(intent);
            }
        }
    };
    private boolean keyboardListenersAttached = false;
    private ViewGroup rootLayout;

    protected void onShowKeyboard(int keyboardHeight) {}
    protected void onHideKeyboard() {}

    protected void attachKeyboardListeners(View contentView) {
        if (keyboardListenersAttached) {
            return;
        }

        rootLayout = (ViewGroup)contentView;
        rootLayout.getViewTreeObserver().addOnGlobalLayoutListener(keyboardLayoutListener);
        keyboardListenersAttached = true;
    }

RubyMine 7 스타트업 회사에서 싸게 구매하는 법(Startup discount)

https://www.jetbrains.com/shop/eform/startup

최근에 Ruby On Rails로 된 서버를 개발하다가 개발툴인 RubyMine을 구매하려고 하다가 보니 다음과 같은 공식 사이트에서 스타트업을 위한 할인 캠페인을 발견했다.

다음과 같이 3년이하, 10인이하 사업장에서 할인을 받을수 있다. 할인 폼에 정보를 입력하면 2-3일정도의 심사 과정을 거친후에 메일로 그 결과가 발송된다.

This discount is available to any company that meets all the following requirements:
  • Is privately held,
  • Has been in business for no more than 3 years,
  • Has no more than 10 employees,
  • Is engaged in development of a software-based product or service, and
  • Is an established business with a website and/or existing public references on the Internet.
If your company meets these criteria, apply for your discount now.
After your application is approved, your startup discount will be available for one or more purchases for 12 months