Emacs – Upgrade new emacs-live version.

기록하는 습관을 들이자.

emacs-live가 ~/.emacs.d/에 설치 되어있는지 확인하고, 만약 확인이 된다면 아래의 명령어를 입력해준다. 단 이때 git 저장소로부터 다운받아 설치가 되어 있어야 한다.

$ cd ~/.emacs.d/
$ git pull

이상.

SQL – trigger, update timestamp when row is updated.

Ref

Sometime we need to update timestamp-column when row is changed. there are a lot of solution that you do. figure out about it…
Like this.
one way to just do updating sql or other way to use trigger.
I am going to tell you about trigger is good sometime is not.

I got following post from stackoverflow, some people uploaded
In Mysql, do like the following thing.

create table ab (
  id int, 
  changeTimestamp timestamp 
    NOT NULL 
    default CURRENT_TIMESTAMP 
    on update CURRENT_TIMESTAMP 
);

but In PostgreSQL is not worked. so there is other solution i got from stackoverflow. you can refer the following thing.
comment
Create a function that updates the changetimestamp column of a table like so:

CREATE OR REPLACE FUNCTION update_changetimestamp_column()
RETURNS TRIGGER AS $$
BEGIN
   NEW.changetimestamp = now(); 
   RETURN NEW;
END;
$$ language 'plpgsql';

Create a trigger on the table that calls the update_changetimestamp_column() function whenever an update occurs like so:

CREATE TRIGGER update_ab_changetimestamp BEFORE UPDATE
ON ab FOR EACH ROW EXECUTE PROCEDURE 
update_changetimestamp_column();

That’s the solution i got. if you need more information, just refer the top of url. thanks for reading.

Clojure – Query (Insert & Delete & Query & update)

테이블명은 ‘users’ 이며 두가지의 컬럼(fname, age)을 가지고 있습니다.

1. 데이터 추가하기

[sourcecode language=”clojure”]
(insert-values
:users
["fname", "age"]
["hojun", "27"])
[/sourcecode]

2. 데이터 수정하기

[sourcecode language=”clojure”]
(update-values
:users
["fname=?"
"hojun"]
{:age "28"})
[/sourcecode]

3. 데이터 검색하기

[sourcecode language=”clojure”]
(with-query-results
results
["select fname from users"]
(doall results))

[/sourcecode]

4. 데이터 삭제하기

[sourcecode language=”clojure”]
(delete-rows
:users
["fname=?ezcocoa"])

[/sourcecode]

Android – LayoutLib is too recent. Update your tool?

the source of news – http://stackoverflow.com/questions/7083048/cant-preview-android-xml-layout-layoutlib-is-too-recent-update-your-tool

언제서 부턴가 xml layout이 보이지 않았다. 사실 layout tool을 사용하지 않고 날코딩하다보니 상관이 없었으나 너무 신경이 쓰여서 찾아보니 해결책은 간단했다.

Eclipse > help -> check for updates 클릭!

같은 메세지가 보인다면, 몇번더 업데이트 해주어야 한다. 끄읕!