2011년 12월 27일 화요일

Scroll

public void scrollTo (int x, int y)

Since: API Level 1
Set the scrolled position of your view. This will cause a call to onScrollChanged(int, int, int, int) and the view will be invalidated.
Parameters

x the x position to scroll to
y the y position to scroll to

void scrollBy (int x, int y)
Since: API Level 1
Move the scrolled position of your view. This will cause a call to onScrollChanged(int, int, int, int) and the view will be invalidated.
Parameters

x the amount of pixels to scroll by horizontally
y the amount of pixels to scroll by vertically

protected void onScrollChanged (int l, int t, int oldl, int oldt)

Since: API Level 1
This is called in response to an internal scroll in this view (i.e., the view scrolled its own contents). This is typically as a result of scrollBy(int, int) or scrollTo(int, int) having been called.
Parameters

l Current horizontal scroll origin.
t Current vertical scroll origin.
oldl Previous horizontal scroll origin.
oldt Previous vertical scroll origin.

public void setScrollX (int value)

Since: API Level 14
Set the horizontal scrolled position of your view. This will cause a call to onScrollChanged(int, int, int, int) and the view will be invalidated.
Parameters

value the x position to scroll to

public void setScrollY (int value)

Since: API Level 14
Set the vertical scrolled position of your view. This will cause a call to onScrollChanged(int, int, int, int) and the view will be invalidated.
Parameters

value the y position to scroll to
public final int getScrollX ()

Since: API Level 1
Return the scrolled left position of this view. This is the left edge of the displayed part of your view. You do not need to draw any pixels farther left, since those are outside of the frame of your view on screen.
Returns

The left edge of the displayed part of your view, in pixels.
public final int getScrollY ()

Since: API Level 1
Return the scrolled top position of this view. This is the top edge of the displayed part of your view. You do not need to draw any pixels above it, since those are outside of the frame of your view on screen.
Returns

The top edge of the displayed part of your view, in pixels.

2011년 12월 13일 화요일

for문의 label

loop1 : for(int i=0; i<4; i++) {
            for(int j=0; j<1; j++) {
                    if(i == 3) break loop1;
                    System.out.println("i = " + i);
                    if(i == 2) break;
                    System.out.println("i = " + i);
                    if(i == 1)continue;
                    System.out.println("i = " + i);
                    continue loop1;
            }
            System.out.println("---");
}

위의 프로그램처럼 하였을 때 결과는
i = 0
i = 0
i = 0
i = 1
i = 1
---
i = 2
---

이렇게 나온다

2011년 12월 9일 금요일

Syntax Highlighter 적용

SyntaxHighlighter 3.0.83을 적용하였다

다른버전보다 특히 맘에 드는 점은 드래그할 시 번호가 딸려오지 않는다는 것이다 ^-^

Emacs 테마를 적용하였고 스타일 설정에 약간 고생하였는데

스타일 설정을 할 시 BlogSpot의 템플릿 디자이너 -> 고급 -> CSS 설정에서 하는 것보다는

직접 HTML편집으로 들어가서 바로 위에 구문을 넣어서 적용하는 것이 낫다는 점이다.

왜냐하면 위의 설정에서 해도 HTML편집으로 들어가면 template skin 위에 적용 되어지는 것을 볼 수 있는데

Syntax Hightlighter 링크 소스를 그 위로 올릴수가 없어 적용이 안되기 때문이다
(적용되려면 링크 소스 아래에 스타일 구문이 있어야 한다)

그래서 따로 링크 소스 아래 스타일 구문을 만들어 넣어주는 것이 좋다

클래스의 개념

class ListFolder {
      
        private String list1;
        private String list2;
      
        public ListFolder(String _list1, String _list2) {
        this.list1 = _list1;
        this.list2 = _list2;
        }
      
        public String get_list1() {
            return list1;
        }

        public String get_list2() {
            return list2;
        }
}

private ArrayList<ListFolder> lf = new ArrayList<ListFolder>
위와 같이 선언한다면

lf.list1과 lf.list2에 값을 넣을 수 있다
그리고 lf.get_list1()과 lf.get_list2() 명령으로 값을 반환시킬 수 있다.

다른 클래스에서 이것을 사용할 수도 있다.
private class Test extends ArrayList<ListFolder> {

        ArrayList<ListFolder> ALF;

        public Test(ArrayList<ListFolder> TLF) {
                this.ALF = TLF;
        }

        public Output(int position) {
                ListFolder LF = ALF.get(position);
                System.out.println(LF.get_list1());
                System.out.println(LF.get_list2());
        }
}

카테고리 설정

<b:widget id='Label1' locked='false' title='Category' type='Label'>
<b:includable id='main'>
  <b:if cond='data:title'>
    <h2><data:title/></h2>
  </b:if>
  <div expr:class='&quot;widget-content &quot; + data:display + &quot;-label-widget-content&quot;'>
    <b:if cond='data:display == &quot;list&quot;'>
      <!--<ul>-->
       <b:loop values='data:labels' var='label'>
        <!--<li>-->
          <b:if cond='data:blog.url == data:label.url'>
            <span expr:dir='data:blog.languageDirection'><data:label.name/></span>
          <b:else/>
            <a expr:dir='data:blog.languageDirection' expr:href='data:label.url'><data:label.name/></a>
          </b:if>
          <b:if cond='data:showFreqNumbers'>
            <span dir='ltr'>(<data:label.count/>)</span>
          </b:if>
        <!--</li>-->
      </b:loop>
      <!--</ul>-->
    <b:else/>
      <b:loop values='data:labels' var='label'>
        <span expr:class='&quot;label-size label-size-&quot; + data:label.cssSize'>
          <b:if cond='data:blog.url == data:label.url'>
            <span expr:dir='data:blog.languageDirection'><data:label.name/></span>
          <b:else/>
            <a expr:dir='data:blog.languageDirection' expr:href='data:label.url'><data:label.name/></a>
          </b:if>
          <b:if cond='data:showFreqNumbers'>
            <span class='label-count' dir='ltr'>(<data:label.count/>)</span>
          </b:if>
        </span>
      </b:loop>
    </b:if>
    <b:include name='quickedit'/>
  </div>
</b:includable>
</b:widget>

위의 코드를 보면 <ul>을 제거함으로써 태그 중간중간에 입체선이 그어지는 것을 막을 수 있었다. 그런데 입체선을 막는 순간 각 태그마다 앞에 동그라미가 생기는데 그것을 없애주려고 <li>를 제거하였다가 동그라미는 없어졌지만 줄바꿈이 사라져서 붙어버렸다.

설치한 이클립스를 어디서나 실행하려면

이클립스를 /home/eclipse에 설치했다고 했을 때

vi /usr/bin/eclipse

로 파일을 만든 후

#!/bin/sh
export ECLIPSE_HOME="/home/eclipse"
$ECLIPSE_HOME/eclipse $*

위의 것을 입력해 준다

그 후 chmod 755 /usr/bin/eclipse

를 설정해주면 된다

우분투 이클립스에서 EUC-KR사용하기

EUC-KR설정을 사용하기전 윈도우에서 가져온 파일이 깨지는 현상이 발생하였는데



아래와 같이 EUC-KR에 대한 언어팩을 설치해주고

아래와 같이 텍스트 파일 인코딩에 EUC-KR을 설정해준다면


아래와 같이 말끔히 해결되었습니다!

우분투 업데이트가 안될시 링크 수정

우분투를 깔았는데 자동으로 업데이트가 되지 않는 것을 볼 수 있는데 이것은 몇년 전에 죽은 링크를 아직도 연결하고 있기 때문이다. 따라서 수동으로 링크를 수정해 주어야 하는데

/etc/apt/sources.list 에 들어가서 아래와 같이 수정해주면 된다

#############################################################################

#deb cdrom:[Ubuntu 10.10 _Maverick Meerkat_ - Release i386 (20101007)]/ maverick main restricted
# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.

deb http://ftp.daum.net/ubuntu/ maverick main restricted
deb-src http://ftp.daum.net/ubuntu/ maverick main restricted

## Major bug fix updates produced after the final release of the
## distribution.
deb http://ftp.daum.net/ubuntu/ maverick-updates main restricted
deb-src http://ftp.daum.net/ubuntu/ maverick-updates main restricted

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team. Also, please note that software in universe WILL NOT receive any
## review or updates from the Ubuntu security team.
deb http://ftp.daum.net/ubuntu/ maverick universe
deb-src http://ftp.daum.net/ubuntu/ maverick universe
deb http://ftp.daum.net/ubuntu/ maverick-updates universe
deb-src http://ftp.daum.net/ubuntu/ maverick-updates universe

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team, and may not be under a free licence. Please satisfy yourself as to
## your rights to use the software. Also, please note that software in
## multiverse WILL NOT receive any review or updates from the Ubuntu
## security team.
deb http://ftp.daum.net/ubuntu/ maverick multiverse
deb-src http://ftp.daum.net/ubuntu/ maverick multiverse
deb http://ftp.daum.net/ubuntu/ maverick-updates multiverse
deb-src http://ftp.daum.net/ubuntu/ maverick-updates multiverse

## Uncomment following lines to add software from the 'backports'
## repository.
## N.B. software from this repository may not have been tested as
## extensively as that contained in the main release, although it includes
## newer versions of some applications which may provide useful features.
## Also, please note that software in backports WILL NOT receive any review
## or updates from the Ubuntu security team.
deb http://ftp.daum.net/ubuntu/ maverick-backports main restricted universe multiverse
deb-src http://ftp.daum.net/ubuntu/ maverick-backports main restricted universe multiverse

## Uncomment the following two lines to add software from Canonical's
## 'partner' repository.
## This software is not part of Ubuntu, but is offered by Canonical and the
## respective vendors as a service to Ubuntu users.
# deb http://archive.canonical.com/ubuntu maverick partner
# deb-src http://archive.canonical.com/ubuntu maverick partner

#############################################################################

링크 뒤에 나오는 maverick은 우분투의 버전명이다
우분투는 각 버전마다 이름이 있는데 11.04이면 natty이다
이게 어떤 영향이 있는지는 자세히 모르지만.. 바꿔주는 것이 괜찮을 듯 싶다

우분투 사용시 DHCP설정을 해도 인터넷이 안잡힐때

ISP업체에 Hostname과 Mac Address가 전달되지 않으면 그곳서버에서 IP주소를 주지 않습니다

Window같은 경우는 자동으로 넘겨주지만 우분투의 경우는 그렇지 않기 때문에 IP주소를 받기 위해서는 약간의 수정을 해야 합니다

/etc/dhcp/dhclient.conf(11.04 ver) 파일에서 그 두 변수를 넘겨주도록 바꿔준다면 인터넷이 잡히지 않는 문제를 해결할 수 있습니다.


#send host-name "<hostname>";
#send dhcp-client-identifier xx:xx:xx:xx:xx:xx;

위와 같이 되어있을 수도 있고 하나만 #처리가 되어있을수도 있는데 <hostname> 이 위치한 곳에는 명령어 hostname을 쳐서 나오는 문장을 넣어 주시면 되고 xx:xx~로 되어 있는 부분은 명령어 ifconfig를 치면 네트워크 어댑터마다 Mac Address가 나오는 데 자신이 쓰는 네트워크에 해당하는 Mac Address를 넣어주면 되겠습니다. 보통 유선 네트워크는 eth0으로 설정되어 있습니다.

이렇게 설정해준다면 무리없이 DHCP상에서 유선인터넷이 가능합니다