블로그 전문 “이글루스”에 오신 것을 환영합니다.

블로그 전문 “이글루스”에 오신 것을 환영합니다.
새로운 보금자리, 이것저것 어색한 것이 많으시죠?
포털블로그와는 다른, 이글루스만의 기능, 이글루스의 특징을 소개해드립니다.

이글루스는 블로그전문을 지향합니다.
2004년, 첫 발을 내디딘 이글루스는 국내 최초 트래백 을 도입하여 블로그전문 서비스로 입지를 다졌습니다. 관심사를 공유할 수 있는 ‘ 밸리’와 ‘마이’, 문화체험의 새로운 경험 ‘렛츠리뷰’, 국내 최고 메신저 네이트온 연동으로 더욱 새로운 블로깅, 독보적인 블로거가 되세요!

첫째, 공감하는 글이 있다면, 트랙백핑백을 이용하세요!
기존 포털 블로그에서 사용하던 스크랩기능 대신 트랙백과 핑백을 사용해보세요~
관심사가 비슷한 블로거를 만날 수 있는 방법입니다!

둘째, 일촌, 친구, 이웃 등 오프라인 인맥 위주의 ‘친구맺기’ 기능이 필요하시면!
이글루스에서 제공하는 이글루링크를 추천해드립니다.
이글루링크를 하시면, 해당 블로거의 새글 업데이트 소식을 실시간으로 받아볼 수 있습니다.

셋째, 카테고리별 공개/비공개 설정을 지원하지 않습니다.
이글루스는 자신이 작성한 글을 더 많은 블로거들과 나눌 수 있도록 참여와 공유를 지향합니다.
카테고리별 공개/비공개 기능은 현재 마련되어 있지 않으나 추후 필요성을 검토해보도록 하겠습니다.

넷째, 도움이 필요할 땐, EBC 와 이글루스도움말 을 찾아주세요.
이글루스를 이용하시다 발견되는 버그나 오류, 그리오 요청사항은 운영자 공식블로그 EBC 를, 이글루스의 기능과 운영정책을 알고 싶으시다면 이글루스 도움말을 방문하세요!

※ 공지사항을 지우고 싶은 경우, 포스트의 ‘삭제’를 클릭하면 지워집니다.
※ 삭제 버튼은 한 번만 누르세요. 여러 번 클릭 시 다른 글이 삭제될 수도 있습니다.

by 라셍 | 2009/02/19 15:38

게시판 페이지 번호 처리

// 작성자 :
package common; import! java.sql.*;

public class Page{

public Page() {
}

// 현화면에 보여질 페이지의 이전, 시작번호, 끝번호, 다음을 반환한다.
// - 이전 및 다음 이 없다면 각각 0을 반환함
// - [laspage]:마지막페이지 번호, [pagen] 한화면에 보여질 페이지번호의 개수, [pagenum] 현재페이지 번호
public static int[] Page(int lastpage, int pagen, int pagenum) {

int[] page_s_e = {0,0,0,0};
// 1: pagenum을 pagen으로 나눈후 몫을 저장한다.
int ppage = pagenum/pagen;

// 2: pagenum을 pagen으로 나눴을때 나머지가 존재한다면 저장한 몫을 1증가시킨다.
if(pagenum % pagen !=0) ppage++;

// 3: 저장한 몫 * pagen의 값이 현재 페이지에 보여야하는 가장 마지막 페이지 번호이다.
int endpage = ppage * pagen;

// 4: 따라서 처음 페이지 번호는 (가장 마지막 페이지 번호 - pagen + 1)이 된다.
int startpage = endpage - pagen + 1;

// endpage가 lastpage를 넘을경우 endpage를 lastpage로 교체한다.
if(endpage>lastpage) endpage=lastpage;

int prev = 0;
if(ppage>1) // '이전' 페이지가 존재한다면 화면에 표시한다.
prev = startpage - 1;

int next = 0;
if(endpage!=lastpage) // 페이지가 한화면에 다 보이지 않는다면 '다음'을 표시한다.
next = endpage + 1;

page_s_e[0] = prev;
page_s_e[1] = startpage;
page_s_e[2] = endpage;
page_s_e[3] = next;

return page_s_e;
}
public static void main(String[] args)
{
Page cla = new Page();
int[] i = {11, 5, 1};
System.err.println(cla.Page(i[0], i[1], i[2])[0]);
System.err.println(cla.Page(i[0], i[1], i[2])[1]);
System.err.println(cla.Page(i[0], i[1], i[2])[2]);
System.err.println(cla.Page(i[0], i[1], i[2])[3]);
}
}
Page.java

by 라셍 | 2008/10/28 12:40 | JSP | 트랙백 | 덧글(0)

계층형 게시판 알고리즘

계층형 게시판을 위한 테이블의 구성 및 알고리즘은 워낙 다양하기 때문에 특별히 정해진 솔류션은 존재하지 않습니다.
여기서는 많은 책자에서 소개되어 있는 간단한 계층형 게시판의 구조와 알고리즘에 대해서 알아봅니다.
설명을 위해 테이블에는 다음과 같은 컬럼들만 있다고 가정합니다. 실제로는 더 많겠죠.
No : 글번호(Primary Key)
Title : 글제목
Grp : 같은 주제를 갖는 게시물의 고유번호. 부모글과 부모글로부터 파생된 모든 자식글은 같은 번호를 갖습니다.
Seg : 같은 그룹내 게시물의 순서
Lvl : 같은 그룹내 계층
게시판에 첫번째 글이 올라오면, 테이블에는 다음과 같은 정보가 저장됩니다.
====================================
No, Title , Grp, Seq, Lvl
====================================
1, '안녕하세요' , 1, 1, 0
====================================
새 글에서 No는 시퀀스로부터 받아온 값, Grp는 No와 동일한 값, Seq는 1, Lvl은 0입니다.
두번째 글과 세번째 글이 올라옵니다.
====================================
No, Title , Grp, Seq, Lvl
====================================
3, '모임이 있습니다', 3, 1, 0
2, '날씨가 맑습니다', 2, 1, 0
1, '안녕하세요 ', 1, 1, 0
====================================
첫번째 글에 답글이 올라옵니다.
====================================
No, Title , Grp, Seq, Lvl
====================================
3, '모임이 있습니다', 3, 1, 0
2, '날씨가 맑습니다', 2, 1, 0
1, '안녕하세요 ', 1, 1, 0
4, ' 반가워요 ', 1, 2, 1
====================================
답글의 경우, Grp는 부모글의 Grp 값, Seq는 부모글의 Seq+1, Lvl은 부모글의 Lvl+1이 됩니다.
첫번째 글의 답글에 답글이 올라옵니다. 즉, 네번째 글의 답글이 올라옵니다.
====================================
No, Title , Grp, Seq, Lvl
====================================
3, '모임이 있습니다', 3, 1, 0
2, '날씨가 맑습니다', 2, 1, 0
1, '안녕하세요 ', 1, 1, 0
4, ' 반가워요 ', 1, 2, 1
5, ' 감사합니다 ', 1, 3, 2
====================================
첫번째 글의 두번째 답글이 올라옵니다.
====================================
No, Title , Grp, Seq, Lvl
====================================
3, '모임이 있습니다', 3, 1, 0
2, '날씨가 맑습니다', 2, 1, 0
1, '안녕하세요 ', 1, 1, 0
6, ' 환영합니다 ', 1, 2, 1
4, ' 반가워요 ', 1, 2, 1
5, ' 감사합니다 ', 1, 3, 2
====================================
여기서, 두번째 답글이 첫번째 답글보다 먼저 표시되려면, 동일한 그룹 번호에 있으면서 부모의 Seq 번호보다 큰 게시물의 Seq 번호를 모두 1만큼 증가시킵니다.
====================================
No, Title , Grp, Seq, Lvl
====================================
3, '모임이 있습니다', 3, 1, 0
2, '날씨가 맑습니다', 2, 1, 0
1, '안녕하세요 ', 1, 1, 0
6, ' 환영합니다 ', 1, 2, 1
4, ' 반가워요 ', 1, 3, 1
5, ' 감사합니다 ', 1, 4, 2
====================================
여섯번째 게시물에 답글이 올라옵니다.
====================================
No, Title , Grp, Seq, Lvl
====================================
3, '모임이 있습니다', 3, 1, 0
2, '날씨가 맑습니다', 2, 1, 0
1, '안녕하세요 ', 1, 1, 0
6, ' 환영합니다 ', 1, 2, 1
7, ' 감사합니다 ', 1, 3, 2
4, ' 반가워요 ', 1, 3, 1
5, ' 감사합니다 ', 1, 4, 2
====================================
마찬가지로 동일한 그룹 번호에 있으면서 부모의 Seq 번호보다 큰 게시물의 Seq 번호를 모두 1만큼 증가시킵니다.
====================================
No, Title , Grp, Seq, Lvl
====================================
3, '모임이 있습니다', 3, 1, 0
2, '날씨가 맑습니다', 2, 1, 0
1, '안녕하세요 ', 1, 1, 0
6, ' 환영합니다 ', 1, 2, 1
7, ' 감사합니다 ', 1, 3, 2
4, ' 반가워요 ', 1, 4, 1
5, ' 감사합니다 ', 1, 5, 2
====================================
검색 할 때는 Grp를 내림차순으로 Seq를 오름차 순으로 정렬하면 됩니다. 인덱스는 기본키와 Grp+Seq의 복합 인덱스를 설정하면 됩니다.
실제 오라클에서 테이블을 구성하고 검색해봅니다.
drop table qnaboard;
create table qnaboard
(no number,
title varchar2(100),
contents varchar2(4000),
writer varchar2(20),
wdate date,
grp number,
seq number,
lvl number);
drop sequence qnaboard_no_seq;
create sequence qnaboard_no_seq
start with 1
increment by 1;
create index qnaboard_no_idx on qnaboard(no) reverse;
alter table qnaboard
add constraint qnaboard_no_pk primary key (no);
create index qnaboard_grp_seq on qnaboard(grp desc, seq asc);
alter session set nls_date_format='yyyy-mm-dd hh24:mi:ss';
첫번째 게시물 입력 - 새 글 입력
insert into qnaboard
values(qnaboard_no_seq.nextval, '안녕하세요', null, '길동', sysdate, qnaboard_no_seq.currval, 1, 0);
두번째 게시물 입력 - 새 글 입력
insert into qnaboard
values(qnaboard_no_seq.nextval, '날씨가 맑습니다', null, '철수', sysdate, qnaboard_no_seq.currval, 1, 0);
세번째 게시물 입력 - 새 글 입력
insert into qnaboard
values(qnaboard_no_seq.nextval, '모임이 있습니다', null, '영희', sysdate, qnaboard_no_seq.currval, 1, 0);
네번째 게시물 입력 - 첫번째 게시물의 답글
답글이 올라오는 경우에는 답글에 부여 할 seq를 먼저 확보해줍니다.
update qnaboard
set seq=seq+1
where grp=1 and seq>1;
insert into qnaboard
values(qnaboard_no_seq.nextval, '반가워요', null, '만수', sysdate, 1, 2, 1);
다섯번째 게시물 입력 - 네번째 게시물의 답글
update qnaboard
set seq=seq+1
where grp=1 and seq>2;
insert into qnaboard
values(qnaboard_no_seq.nextval, '감사합니다', null, '길동', sysdate, 1, 3, 2);
여섯번째 게시물 입력 - 첫번째 게시물의 두번째 답글
update qnaboard
set seq=seq+1
where grp=1 and seq>1;
insert into qnaboard
values(qnaboard_no_seq.nextval, '환영합니다', null, '찬호', sysdate, 1, 2, 1);

일곱번째 게시물 입력 - 여섯번째 게시물의 답글
update qnaboard
set seq=seq+1
where grp=1 and seq>2;
insert into qnaboard
values(qnaboard_no_seq.nextval, '감사합니다', null, '길동', sysdate, 1, 3, 2);
게시판을 검색하는 경우, grp로 내림차순, seq로 오름차순으로 정렬하면 됩니다.
select case when lvl=0 then no
when lvl>0 then null end no
, rpad('+', lvl, '-')||title title
, writer
, wdate
from qnaboard
order by grp desc, seq;

NO TITLE WRITER WDATE
----- -------------------- ---------- -------------------
3 모임이 있습니다 영희 2007-09-15 19:54:00
2 날씨가 맑습니다 철수 2007-09-15 19:53:55
1 안녕하세요 길동 2007-09-15 19:53:50
+환영합니다 찬호 2007-09-15 19:54:21
+-감사합니다 길동 2007-09-15 19:54:26
+반가워요 만수 2007-09-15 19:54:08
+-감사합니다 길동 2007-09-15 19:54:15

by 라셍 | 2008/10/28 12:38 | JSP | 트랙백 | 덧글(0)

MySQL Workbench를 이용한 ER diagram 작성 및 sql import/exrpot

최근에 Database 관련 ER diagram을 그리게 되는 계기가 있었다.
십여년 전에 ERWin이란 프로그램 또는 Microsoft의 Visio (처음에는 Visio가 MS 제품이 아니었다)
를 이용하여 해당 diagram을 그려 보기도 했다.

이런 Database Entity-Relation (ER) Diagram은 실제의 sql문으로 보내거나 가져올 수 있는데,
sql에서 가져와서 diagram으로 그리는 개체로 이용하는 것을 Reverse Engineering이라 하고,
그 반대로 sql로 내보내는 것을 Forward Engineering이라 한다.

비지오 2007 에서는 reverse engineering은 되나 forward engineering은 되지 않는다.
또한 ERWin 은 예전의 3.x대에 비해 최근의 4.x가 GUI에 더 나아졌다는 생각이 들지 않았다.
결국 구글에서 관련 자료를 찾아보다가 현재로서는 이게 제일 나을듯 싶다는 것을 발견했다.

다른 이야기로 최근에 MySQL 데이터베이스 회사가 SUN에 M&A 되었다는 소식을 들었다.
현금 1조의 어마어마한 금액에 팔렸다는 소식이었다. 아마도 SUN이 오라클 등의 대적을 하면서
응용프로그램 또는 서비스 시장에 사활을 걸고 달려드는 것이 아닌가 하는 생각이 들었다.

이 MySQL 회사에서 나온 Workbench라는 제품이 있는데, 바로 이것을 사용하여
위의 기능을 해 보았다.
하루 이틀 사용해 보고 기능을 적어보는 것이니, 그리 자세한 기능은 모르지만
현재 하고자 하는 것은 충분히 할 수 있었다.

참고로 기존에 MySQL로 작업하던 sql 문을 가지고 테스트를 해 보았는데,
이상없이 잘 되었다.

http://dev.mysql.com/workbench/
에 들어가면 아래와 같이 download 링크가 있다.



그것을 다운받아 설치하고 기동하면 위와 같은 화면이 뜬다.


이제 기존에 foo.sql 이라는 sql문이 있었고 그것을 가져오기 위하여 File>Import>Reverse Engineer를 선택하면...


오른편 테이블에 가져온 테이블이 보이며, Phisical Schema에는 suri라는 Database가 보이며, 이것의 다이어 그램을 그리기 위하여
"Add diagram"을 더블클릭한다.


그리고 오른편에 Catalog>Table에서 테이블을 Drag&Drop하여 정렬하면 위와 같은 화면이 되며...
왼편의 relation등을 설정하는 등의 작업을 진행한다.


컬럼을 수정하기 위하여, 테이블을 선택한 후 마우스오른쪽 단추>Edit... 를 선택하면...


위와 같은 테이블 설정 창이 아래쪽에 보이며, 아랫부분에 있는 Columns 탭을 선택하여 해당 컬럼을 수정할 수 있다.


작업을 마친 다음 다시 sql로 내보내기 위하여, File>Export>Forward Engineer SQL CREATE Script...를 선택하여,


위와 같이 넣고 생성을 하면...


sql문이 만들어 지며, 이를 MySQL 에 다시 적용하면 된다.

by 라셍 | 2008/10/20 11:29 | DB | 트랙백 | 덧글(0)

8 Strategies For Successful Relations With Clients

Let’s face it. Some days, you want to just fire your clients. You go through one too many comps, iterations or edits and you’ve had enough. It has happened to everyone at least once and I’d be lying if I said it won’t happen again; you get to the end of a project and realize that you would have made more per hour flipping burgers at McDonald’s. Thankfully, as with most common problems, there are a few simple guidelines that you can follow to help make sure that you’re never working for below minimum wage.

Due Diligence

“Experts often possess more data than judgment.” -Colin Powell

Know your role

Remember that the client will always know more about their product or service than you do. They are the expert at what they do; their problem is usually that they don’t know how to explain it well. That is where you, as the designer, step in to help. You are a graphical communications ninja, but to effectively make your, and ultimately your client’s, point you must fully understand what needs to be said.

From the outset, make it a priority to get as much information as possible about the company, their product or service, the intended audience of your work and the reason that your work needs to exist. The better prepared you are and the more information you get out of the client before you start working, the quicker your design will be accepted, and the quicker you will get paid. Use that overflow of data from the client to form a coherent picture of what you’re trying to accomplish and then use your good judgment to make something beautiful from the madness. By spending ample time collecting information, you have allowed the client to share their knowledge and participate in the project. This is a good thing. When clients feel they are part of the process they are less likely to question the design decisions you make.

Hire the right customers

“If you try and please everyone, you won’t please anyone.” -37signals
Remember that part of your due diligence is making sure that the project is a good fit for you as a designer. You cannot be everything to everyone, and if you try to be, you will not only look bad, you’ll lose money.
Remember the principle that carries the Vilfredo Pareto name: 80% of the output will come from 20% of the input. In other words, you will make 80% of your income from 20% of your clients, so focus on the good ones and fire the bad ones. Stay true to your strengths and don’t be afraid to pass on a project. In the end, everyone, including your client, will be better off.

I repeat…

Don’t try to take on every project that comes across your desk, even when you’re starting out. This will preclude a large percentage of your client problems. By picking your two or three biggest strengths and building a solid reputation, you will attract clients who are looking for a genius in your fields of choice and who, consequently, will be willing to pay well for the service.
The Harvard Business professor Michael Porter states you can hold a competitive advantage in one, and only one, of two areas: price or quality. Focus your efforts on your strengths, build a solid reputation and you’ll never be forced to compete on price again.

Communication

“The most important thing in communication is to hear what isn’t being said.” -Peter F. Drucker

Approach all communication with a Zen mind

Zen philosophy teaches you to approach every task with a beginner’s mind. This is simple when you’re trying to teach yourself hyper-astro-meta-particle physics, but not as easy as you think when it comes to something you do all day, every day. Try hard to put yourself in the shoes of a beginner; you will be more apt to understand and sympathize with your client’s point of view. You will also find that by using less jargon (by assuming the language of a beginner) your client will understand and internalize your point much more quickly, which in turn helps to create an evangelist for your work in your client’s organization, which always makes your life easier.
But adopting a beginner’s mind isn’t as simple as dropping your haughty design-speak in favor of a fifth grade vocabulary. You need to approach each conversation or communication as a beginner does, with no expectations and no preconceived notions. Without the benefit of assumptions or preconceived notions, you will be forced to ask more questions and in turn draw more information out of the client; and just like that, your job will have gotten easier. Disclaimer: If all this Zen stuff is too new age for you, just remember the old adage: When you assume, you make an ass out of u and me.

Listen for what isn’t there

What the client says: Can you make that text just a little bigger?
What the client means: This font might be a little hard to read. What do you think?
Everyone fears the dreaded “Make this text bigger” line, and everyone (well, almost everyone) has probably cringed and then painfully capitulated. When faced with clients asking for design changes, especially from those clients who don’t have any design training (let alone a good eye for design), it’s important to check your design ego at the door and ask a few pointed questions. What you really need to find out is what the client actually means. Before doing anything to the design, pause for a moment and ask the client to explain what it is about the design that doesn’t accomplish the specific goals you outlined in the pre-work discovery meetings. (You did set specific goals, didn’t you!?)
Here are a few tips to help you get to the point:
  • Ask blunt questions (but tactfully). Don’t start or get hauled into arguments.
  • Use feature/benefit terminology and plain language, not design-speak.
  • Use yes/no questions that push the client to reveal what they really think (e.g. “Do you think this font is hard to read?”).
  • Take criticism well. (No one likes an overly sensitive artist.)
By your focusing on the goals rather than the implementation, clients will understand that you are trying to use your craft for their benefit, not just to take their money. Oh, and a note about that ego you left at the door: now is not the time to go into a diatribe about your profession or your skill as a designer. No one cares; your client just wants a functional design that they can be proud of when they show it to their boss.

Do what you said you were going to do

But don’t die by the contract. I’ve heard of many situations where clients and designers get into arguments about what was and wasn’t in the original contract. If the client comes to you with something that is obviously beyond the scope of the contract, you have a few choices:
  1. You can do what the client wants and ask for nothing more in return.
  2. You can refuse to do it and stick to what the original contract said.
  3. You can try to renegotiate the contract to a new middle ground before continuing work on the project.
There isn’t any one right answer here; different situations call for different actions. If you’re not going to get badly burned by going the extra mile, it will probably be worth it (so long as the client knows you’re hooking them up). That said, sometimes the new request is outrageous and would take many, many hours to implement. In those situations, it is a good idea to be open, talk it through with the client, make it known that you’d love to help but it would be too much of a time commitment (you do have other clients, after all) for the current numbers to work out.
If you approach things with an open mind, with a positive attitude (instead of a demanding one) and on an even playing field, the client will generally help you out with a bit more cash. And if they are livid at the thought of paying you more money for more work, well, they may have just singled themselves out as a client who needs to be fired.

Admit it when you screw up

Then do everything possible to make it right. Mistakes are okay; everyone makes them from time to time. Hopefully you’re not a habitual offender. But the general rule is: the sooner you recognize the mistake and take the heat for it, the better off you’ll be in the long run.
By letting more time pass, the mistake only grows and becomes more difficult to cover up, and the heat that was originally a small and controlled campfire is now the roaring flames of hell licking at the bottoms of your feet. Get it out of the way, clear the air and get on with it. Your client will appreciate your candor and honesty, even if he or she isn’t that happy about the problem itself.

Parting Shot

Hopefully you’ve started to catch on here. Most of the things that can be counted as “common problems” are fairly easy to circumvent, especially if you put in your time doing your due diligence on the front end and adopt a firm but cooperative attitude in your client communications.
Remember, clients aren’t supposed to be a burden. They are a blessing (they are buying the bread on your table after all). But the relationship should always be mutually beneficial. You are getting paid to do what you, presumably, love to do, and the client is getting something beautiful and functional. Hopefully, you’re both learning a little something along the way.

by 라셍 | 2008/10/10 09:04 | 도움이 되는글 | 트랙백 | 덧글(0)

<< 이전 페이지다음 페이지 >>