'Programming'에 해당되는 글 124건

  1. 2014.06.27 Node.js 시작하기
  2. 2014.06.24 JavaScript 개요
  3. 2014.04.16 webapp deploy in tomcat 7.0
  4. 2014.03.14 javascript - oop
  5. 2014.03.11 Redis 시작하기
  6. 2014.01.13 DB data simply im/export to csv file in MySQL
  7. 2014.01.13 javascipt Date객체 formatting yyyy-MM-dd hh:mm:ss
  8. 2013.11.26 read .ini / .properties in shell script
  9. 2013.11.21 get array size/length in bash shell
  10. 2013.11.20 calculateion in bash shell
  11. 2013.11.20 check wheter mySQL is running in bash shell
  12. 2013.11.20 check if mysql database exists in bash shell
  13. 2013.11.19 Using shell script to control in mySQL
  14. 2013.11.19 optional parameter expansions in bash shell
  15. 2013.11.18 Replace string in bash shell
  16. 2013.11.12 Bash shell script to swap two number
  17. 2011.11.10 jQuery - jQuery 시작하기
  18. 2011.11.08 HTML - HTML 시작하기
  19. 2011.11.07 Android - Disable orientation change / 가로, 세로 변경시 초기화 해제
  20. 2011.11.04 Android - Video loading dialog in VideoView / VideoView 로딩되기 전 로딩 다이얼로그 생성
  21. 2011.10.25 Android - Page loading dialog in Webview //웹뷰에서 페이지 로딩 다이얼로그 만들기
  22. 2011.10.24 Android - viewing PDF file in webview
  23. 2011.10.24 Android - Message에 Stirng 데이터 담아 핸들러에 sendMessage 하기 2
  24. 2011.10.20 Android - taking a phone screenshot from a computer / 폰화면 컴퓨터에서 스크린샷 찍기
  25. 2011.10.17 Android - Unzip
  26. 2011.10.17 Android - Down file using FTP/FTP방식으로 파일 다운
  27. 2011.10.17 Android - Down file using http/http방식으로 파일 다운
  28. 2011.10.17 Android - Methods GET and POST in HTML forms//http전송 get방식, post방식
  29. 2011.10.17 Android - keyboard setting for when layout is hidden by keyboard popup / EditText 클릭시 UI 같이 올라가는 문제
  30. 2011.10.12 Android - custom button pressed image change
posted by Full-stack Developer 2014. 6. 27. 18:06
Step 1. 설치

설치방법 설명 URL : http://www.nodeclipse.org/updates/
  1. node.js install
    1. URL : http://www.nodejs.org/download/
    2. OS에 맞춰 설치 (windows의경우 c\nodejs 폴더에 설치하는 것 권장. 찾기쉽기때문)
    3. (windows 경우)cmd창을 열어 nodejs설치한 경로로 이동
    4. 아래의 명령어를 차례로 입력
      1. npm install -g nodeclipse
      2. npm install -g express-generator
      3. npm install -g express
        • npm install -g express 설치 결과 예시 이미지
  2. JDK 7이상 설치
    • URL : http://www.oracle.com/technetwork/java/javase/downloads/index.html
  3. eclipse 세팅
    • nodeclipse 설치(선택)
      1. URL : http://sourceforge.net/projects/nodeclipse/files/Enide-Studio-2014/0.11-preview/Enide-Studio-2014-011-20140228-win64.zip/download
    • 기존 사용하던 eclipse에 plug in(선택)
      1. plug in URL : http://www.nodeclipse.org/updates/
      2. http://www.nodeclipse.org/updates/에 접속하여 버튼을 기존사용하는 eclipse에 드래그&드랍
        • 설치할 체크리스트
    • perspective 설정

Step 2. hello world


  1. File(상단텝) -> New -> Node.js Project or project explorer 우클릭 -> New -> Node.js Project
  2. project name을 기입하고, template을 hello world로 체크
  3. hello-world-server.js파일 우클릭 -> Run as(or Debug as) -> Node Application 클릭
  4. 테스트
    1. eclipse의 console에서 아래의 문구가 떠야한다.
    2. browser에서 테스트



Step 3. Chat Server


'Programming > Web Programming' 카테고리의 다른 글

JavaScript 개요  (0) 2014.06.24
webapp deploy in tomcat 7.0  (0) 2014.04.16
javascript - oop  (0) 2014.03.14
javascipt Date객체 formatting yyyy-MM-dd hh:mm:ss  (0) 2014.01.13
jQuery - jQuery 시작하기  (0) 2011.11.10
posted by Full-stack Developer 2014. 6. 24. 15:33
  1. Web browser
    1. 브라우저에는 javascript를 해독할 수 있는 엔진이 존재한다.
    2. 구글 크롬의 경우 just in compiler(일명 JIT 컴파일)형식의 V8 javascript engine을 사용한다.
    3. V8은 javascript 코드를 c++코드로 변환하여 compile하고 캐싱과 같은 최적화기술을 사용하여 속도향상을 시켰다.

  2. Weak & Dynamic type language
    1. javascript는 c/c++처럼 타입이 지정되어있지 않다.
    2. 타입은 var로 표시한다.
      • javascript 기본타입
        • number(8byte double)
        • string
        • boolean
        • undefined
        • null(참조객체 없음을 의미)
      • javascript 참조형타입
        • 함수
        • 객체

  3. Non-class based object-oriented programming
    1. object-oriented programming
      • class-based oop
        • c/c++, c#, java ...
      • non-class-based oop
        • javascript, python, ruby ...
    2. javascript의 oop
      • prototype chain
      • closure


'Programming > Web Programming' 카테고리의 다른 글

Node.js 시작하기  (0) 2014.06.27
webapp deploy in tomcat 7.0  (0) 2014.04.16
javascript - oop  (0) 2014.03.14
javascipt Date객체 formatting yyyy-MM-dd hh:mm:ss  (0) 2014.01.13
jQuery - jQuery 시작하기  (0) 2011.11.10
posted by Full-stack Developer 2014. 4. 16. 13:58

Webapp deploy in tomcat 7.0

 

webapp을 deploy 하는 3가지 방법에 대하여 기술하겠습니다.

 

  1. server.xml
    • 위치 : $TOMCAT_PATH/conf/server.xml
    • server.xml 구조
      <Servers>
        <Service>
           <Engine>
              <Host>
                  //이부분에 Context를 넣어주면됩니다.
                 <Context>
    • <context> 예시
      <Context docBase="test" path="/test" reloadable="true" source="org.eclipse.jst.jee.server:test"/>
       
    • 참고사항
      • tomcat에서 context는 web aplication을 의미합니다.
      • server.xml에 context를 기술하여 사용하는(위와 같은방식)것은 지향하는 추세입니다. server.xml은 tomcat server자체에 대한 설정파일 임에도 불구하고, web context에대하여 설정한다는 것은 목적에 맞지 않기 때문입니다.
         
  2. descriptor file(확장자 .xml)
    • context를 따로 파일로 관리하는 방식입니다.
    • 관리방식
      1. $TOMCAT_PATH/conf/[enginename]/[hostname]/[webappname].xml
      2. $TOMCAT_PATH/webapps/[webappname]/META-INF/context.xml
    • 설명
      • 관리방식의 1은 파일명이 webappname그대로 따른다는 것이고, 2는 webapp의META-INF아래에 context.xml에다가 기술한다는 차이점이 있습니다.
      • 해당 파일에([webappname].xml 혹은 context.xml) server.xml에서 context를 기술하는 것과 마찬가지로 <Context>를 기술하면 됩니다.
  3. auto deploy
    • webapps(appBase경로)폴더에 war파일을 넣어두면 자동으로 deploy하는 방식입니다.
    • 설정방법
      • server.xml에서 Host의 attribute에 autoDeploy를 true설정해줍니다.
        • 예시 : <Host appBase="webapps" autoDeploy="true" name="localhost" unpackWARs="true">
    • 사용방법
      • .war 파일을 appBase에 복사하면 deploy됩니다.
      • 압축해제된 webapp이 appBase 복사되면 deploy됩니다.
      • appBase에 있던 .war가 갱신되면 re-deploy됩니다.(단, host attribute인 unpackWARs가 true여야 합니다.)
        기존에 압축해제된 webapp은 제거되고 갱신된 .war를 압축해제합니다.
      • 압축해제된 webapp에 /WEB-INF/web.xml이 변경되면, re-loading됩니다.
      • webapp의 descriptor file(deploy의 3가지방법 중 2번째 방법 참조)이 변경되면 re-deploy됩니다.
      • $TOMCAT_PATH/conf/[enginename]/[hostname]/[webappname].xml 파일이 추가될경우 re-deploy됩니다.
      • <context docBase="...."  ...>에서 docBase가 삭제되었을때 un-deploy됩니다.

참조 : http://tomcat.apache.org/tomcat-7.0-doc/deployer-howto.html#Deploying_using_the_Client_Deployer_Package

'Programming > Web Programming' 카테고리의 다른 글

Node.js 시작하기  (0) 2014.06.27
JavaScript 개요  (0) 2014.06.24
javascript - oop  (0) 2014.03.14
javascipt Date객체 formatting yyyy-MM-dd hh:mm:ss  (0) 2014.01.13
jQuery - jQuery 시작하기  (0) 2011.11.10
posted by Full-stack Developer 2014. 3. 14. 17:59

Javascript OOP

참조

Object-Oriented JavaScript 소개 : https://developer.mozilla.org/en-US/docs/Web/JavaScript/Introduction_to_Object-Oriented_JavaScript#Encapsulation

Encapsulation : http://phrogz.net/JS/classes/OOPinJS.html


Class

function Person() { }

java에서 class Person(){}

c++에서 class Person(){};


Instance

방법1. new class명();
function Person() { }
var person1 = new Person();
var person2 = new Person();

방법2. Object.create(protoType [, propertiesObject ] )

// Shape - superclass
function Shape() {
  this.x = 0;
  this.y = 0;
}

// superclass method
Shape.prototype.move = function(x, y) {
    this.x += x;
    this.y += y;
    console.info("Shape moved.");
};

// Rectangle - subclass
function Rectangle() {
  Shape.call(this); // call super constructor.
}

// subclass extends superclass
Rectangle.prototype = Object.create(Shape.prototype);//or new shape();
Rectangle.prototype.constructor = Rectangle;

var rect = new Rectangle();

rect instanceof Rectangle // true.
rect instanceof Shape // true.

rect.move(1, 1); // Outputs, "Shape moved."

생성자

function Person() {
  alert('Person instantiated');
}

var person1 = new Person();
var person2 = new Person();

 


클래스 맴버(속성)

function Person(gender) {
  this.gender = gender;
  alert('Person instantiated');
}

Person.prototype.gender = '';

var person1 = new Person('Male');
var person2 = new Person('Female');

//display the person1 gender
alert('person1 is a ' + person1.gender); // person1 is a Male

함수

function Person(gender) {
  this.gender = gender;
}

Person.prototype.gender = '';

Person.prototype.sayGender = function () {
  alert(this.gender);
};

var person1 = new Person('Male');
var genderTeller = person1.sayGender;

person1.sayGender(); // alerts 'Male'
genderTeller(); // alerts undefined
alert(genderTeller === person1.sayGender); // alerts true
alert(genderTeller === Person.prototype.sayGender); // alerts true

 

genderTeller.call(person1); //alerts 'Male'

person1의 sayGender()이 호출된다.


상속

// define the Person Class
function Person() {}

Person.prototype.walk = function(){
  alert ('I am walking!');
};
Person.prototype.sayHello = function(){
  alert ('hello');
};

// define the Student class
function Student() {
  // Call the parent constructor
  Person.call(this);
};

// inherit Person
Student.prototype = new Person();//or Object.create(Person.prototype);

// correct the constructor pointer because it points to Person
Student.prototype.constructor = Student;
 
// replace the sayHello method
Student.prototype.sayHello = function(){
  alert('hi, I am a student');
};

// add sayGoodBye method
Student.prototype.sayGoodBye = function(){
  alert('goodBye');
};

var student1 = new Student();
student1.sayHello();
student1.walk();
student1.sayGoodBye();

// check inheritance
alert(student1 instanceof Person); // true 
alert(student1 instanceof Student); // true

Encapsulation(캡슐화)

function Person() { 
     //-- property --


     //private property
     var userId="";

     //public property type one
     this.weight="";
     //public property type two - may be overridden
     Person.prototype.job="";

     //-- method --


     //private method
     function getUserId(){
          return userId;
     }
     //protected method
     this.eat=function(){
          weight++;
     }
     //public method - may be overridden
     Persone.prototype.workOut=function(){
          weight--;
     }
}

'Programming > Web Programming' 카테고리의 다른 글

JavaScript 개요  (0) 2014.06.24
webapp deploy in tomcat 7.0  (0) 2014.04.16
javascipt Date객체 formatting yyyy-MM-dd hh:mm:ss  (0) 2014.01.13
jQuery - jQuery 시작하기  (0) 2011.11.10
HTML - HTML 시작하기  (0) 2011.11.08
posted by Full-stack Developer 2014. 3. 11. 15:41


  1. 소개
    • 오픈소스
    • ANSI C로 구현
    • key-value sotre구조
    • 제공 자료형은 5가지
      • strings
      • hashes
      • lists
      • sets
      • sorted sets
    • memory dataset에서 동작
    • 대부분의 프로그래밍 언어에서 사용가능
    • Linux에서 개발 추천

  2. 설치방법
    • 리눅스

      1. Redis 다운로드 및 구성
        • ​​버전확인 : http://www.redis.io/download 
          $ wget http://download.redis.io/releases/redis-2.8.7.tar.gz
          $ tar xzf redis-2.8.7.tar.gz
          $ cd redis-2.8.7
          $ make
      2. 서버 실행
        $ src/redis-server
      3. 클라이언트 실행
        $ src/redis-cli
        redis> set foo bar
        OK
        redis> get foo
        "bar"
    • windows

      1. Redis 다운로드
        • https://github.com/rgl/redis/downloads

      2. 설치
        • redis-x.x.x-setup-xx-bit.exe 실행
      3. 서버 실행
        1. 설치 경로 이동 ex)C:\Program Files\Redis
        2. redis-server.exe 실행
      4. 클라이언트 실행
        1. 설치 경로 이동 ex)C:\Program Files\Redis
        2. redis-cli.exe 실행
  3. 데이터 타입
    • String

      • 가장 기본적인 Redis data type
      • binary 저장소
      • 다향한 종류의 데이터를 담을 수 있음
      • 최대길이 512Mb
      • 사용가능 기능
        • 자동 카운터 기능
        • string append 기능
        • string의 구간(start/end index)을 이용한 get/set기능
        • bit단위로 string set/get기능
      • Strings에서 사용가능한 명령어 : http://www.redis.io/commands/#string
    • Lists

      • 간단한 string lists
      • 삽입명령 순으로 정렬
        • lists의 head나, tail로 삽입가능
      • 최대 길이는  232 - 1(4,294,967,295)개
      • Lists에서 사용가능한 명령어 : http://www.redis.io/commands#list
    • Sets

      • 정렬이 않되어있는 String 집합
      • 추가, 제거, 존재여부 테스트
      • 중복 제거
      • 최대 길이는  232 - 1(4,294,967,295)개
      • Sets에서 사용가능한 명령어 : http://www.redis.io/commands#set
    • Hashes

      • String fields(keys)와 String values의 연속
      • fields가 100개이하일때, 매우 작은 저장공간을 사용
      • 최대 길이는  232 - 1(4,294,967,295)개
      • Hashes에서 사용가능한 명령어 : http://www.redis.io/commands#hash
    • Sorted sets

      • Sets와 유사. 차이점은 score를 이용하여 정렬함
      • score
        • 데이터를 가져올때 사용됨
        • 적은수에서 큰수로 scoring됨
        • unique함
      • 삽입, 제거, 갱신을 매우빠르게 수행
      • score범위를 지정하여 매우빠르게 데이터를 가져올수 있음
      • soreted sets의 중간에있는 데이터도 빠르게 접근함
      • Sorted sets에서 사용가능한 명령어 : http://www.redis.io/commands#sorted_set
  4. 명령어
    • 명령어 사용 예시
      redis> EXISTS mykey//EXISTS : 해당 key가 존재하는지 판별
      (integer) 0 // 0이면 존재하지 않음. 1이면 존재함
      redis> APPEND mykey "Hello"
      (integer) 5 //append 명령어 수행 후 mykey의 길이
      redis> APPEND mykey " World"
      (integer) 11
      redis> GET mykey //해당 key의 value를 가져옴
      "Hello World"
      redis> 
  5. springframework에 redis 개발환경 구축
    • redis clients URL : http://www.redis.io/clients
    • JAVA에서 사용가능한 library종류
      • Jedis(대표적)
      • Redisson(대표적)
      • JRedis
      • JDBC-Redis
      • RJC
      • redis-protocol
      • aredis
      • lettuce
    • 사용방법 및 예제(Jedis일 경우)
      1. maven 사용하는 경우
        • maven에 dependency 추가
          <dependency>
              <groupId>redis.clients</groupId>
              <artifactId>jedis</artifactId>
              <version>2.2.1</version>
              <type>jar</type>
              <scope>compile</scope>
          </dependency>
      2. jar파일로 직접 연동할 경우
        • 다운로드 URL : https://github.com/xetorthio/jedis/downloads


posted by Full-stack Developer 2014. 1. 13. 16:54

Export DB data


SELECT (column,...] INTO OUTFILE '/tmp/backUpDB.csv' FROM [table name];

Import DB data


LOAD DATA LOCAL INFILE '/tmp/backUpDB.csv' INTO TABLE [table name];


ps data에 탭이 있을경우 조건식을 줘야함.

posted by Full-stack Developer 2014. 1. 13. 10:32

formatting yyyy-MM-dd hh:mm:ss


time = new Date(time);

var h = time.getHours();

time.setHours(h+9);//korea timezone is GMT+09:00

time = time.toISOString().slice(0, 19).replace("T"," ");

'Programming > Web Programming' 카테고리의 다른 글

JavaScript 개요  (0) 2014.06.24
webapp deploy in tomcat 7.0  (0) 2014.04.16
javascript - oop  (0) 2014.03.14
jQuery - jQuery 시작하기  (0) 2011.11.10
HTML - HTML 시작하기  (0) 2011.11.08
posted by Full-stack Developer 2013. 11. 26. 13:55

Step 1 make ini/properties file


ex) info.properties

name=angela

age=25



Step 2 use ini/proeperties file

ex)profile.sh

. info.properties

echo "name is $name, age is $age"

posted by Full-stack Developer 2013. 11. 21. 15:34

tables=( "auth" "key" "ledger" )

readonly TABLE_COUNT=${#tables[@]}



posted by Full-stack Developer 2013. 11. 20. 14:42

#!/bin/bash

num=10


echo "num is $flag"

echo $((++flag))

echo $((flag+5))

echo $((++flag))

posted by Full-stack Developer 2013. 11. 20. 14:04

#!/bin/bash

mySqlPSCnt=$(pgrep mysqld | wc -l);

if [ "$mySqlPSCnt" == 0 ];

then

        echo "mySQL is down.";

else

        echo "mySQL is alive.";

fi


referebce : https://gist.github.com/mheadd/5571023


posted by Full-stack Developer 2013. 11. 20. 13:40

#!/bin/bash

Result=`mysql -u userId -puserPw --skip-column-names -e "show databases like 'database_name'"`

if [ "$Result" != "database_name" ]; then

    echo "Database isn't exist"

else

    echo "Database is exist"

fi

posted by Full-stack Developer 2013. 11. 19. 16:57

Style one


mysql --user=mysql_user_ID --password=mysql_user_password database_name  << EOF

show tables;





Style two


Result=`mysql -u userId -puserPw --skip-column-names -e "show databases like 'database_name'"`

if [ "$Result" != "database_name" ]; then

    echo "Database isn't exist"

else

    echo "Database is exist"

fi



posted by Full-stack Developer 2013. 11. 19. 14:34

Step 1. add option word:


Step 2. add option case



#!/bin/bash

echo "OPTIND starts at $OPTIND"

while getopts ":p:q:d:" optname

  do

    case "$optname" in

      "p")

        echo "Option $optname is specified"

        ;;

      "q")

        echo "Option $optname has value $OPTARG"

        ;;

      "d")

        echo "Directory is $OPTARG"

        ;;

      "?")

        echo "Unknown option $OPTARG"

        ;;

      ":")

        echo "No argument value for option $OPTARG"

        ;;

      *)

      # Should not occur

        echo "Unknown error while processing options"

        ;;

    esac

    echo "OPTIND is now $OPTIND"

  done


reference : http://www.ibm.com/developerworks/opensource/library/l-bash-parameters/index.html


posted by Full-stack Developer 2013. 11. 18. 11:15

#!/bin/bash

target="Izlovezangelazbaby"


#replace other word

output="${target/z/a}"

#output="${target/z/}"


#replaced stirng echo 

echo $target | sed "s/z/ /g"


echo $output

posted by Full-stack Developer 2013. 11. 12. 14:39

#!/bin/bash


function intro(){

        echo "swap shell script!"

}


function swapNum(){


        local tmp=$1

        num1=$num2 #call by value

        num2=$tmp


        return 255 #return value is 1byte

}


intro


echo "begin num is $1, $2"


num1=$1

num2=$2


swapNum num1 num2 #call fucntion


echo "result is $?"//return value

echo "artificial num is $num1, $num2"



posted by Full-stack Developer 2011. 11. 10. 18:02
Step 1 . Download jQuery

-http://jquery.com/
 
 


Step 2. Add script
- 해당페이지에 js파일을 넣는다. 
- 아래와 같이 추가한다.

<html>
<head>
<meta charset="UTF-8"/>
<script src="jquery-1.6.2.min.js"> </script>
</head>
</html> 

Step 3. Use jQuery

 
<html>
<head>
<meta charset="UTF-8"/>
<script src="jquery-1.6.2.min.js"> </script>
<script>

$(function(){

//alert($('li').length);
$('ul#sectionList li');
document.getElementsByTagName('ul')[0].getElementById('sectionList').childNodes;

var cnt = $('ul#sectionList').children().length;
console.log(cnt);
$('ul#sectionList li').css({
width: 100/cnt+'%',
});
console.log($('ul#sectionList li'));
$('ul#sectionList li').click(function(){
//hide selected image
$('ul#sectionList li.selected').removeClass('selected');
//show image for only this li
$(this).addClass('selected');
});
});

</script>

Sample code
-주석없는 예제는 하단에 있습니다.
<html>
<head>
<meta charset="UTF-8"/>
<script src="jquery-1.6.2.min.js"> </script>// jQuery를 추가한다.
<script>//스크립트 사용
//$의 의미는 jQuery이다. 즉, jQuery가 $로 typedef되어있다. jQuery == $
//jQuery를 사용할때는 $()형식으로 사용한다. 
$(function(){//c에서 main함수 같은 것이다. 이렇게하면 body의 script가 로딩된후 해당함수가 실행된다. 
html은 맨위에서 한줄한줄 적용된다. 즉 해당소스를 크게보면 head안에 <meta .../>를 수행하고 script src="..</script>를 수행하고 <script> ... </script>를 수행한다. 그 후 <body>의 script가 수행된다는 점을 기억하자.


        $('#sectionList li');//#->id .->class #sectionList li(공백)->id가 sectionList 하위의 li(parent elemtnt 공백 parent elemnt child)
document.getElementById('sectionList').childNodes;
//위의 $('#sectionList li');와 같은 기능의 소스다. 한눈에봐도 jQuery를 사용하는게 짧은것을 볼수있다.(즉, 같은 기능을 짧은코드로 수행할 수 있어서 매우 효율적이다.)

var cnt = $('ul#sectionList').children().length;//id가 sectionList인 ul의 li개수를 가져온다.
console.log(cnt);//chrome을 사용하고 요소검사를 하면 로그가 보일것이다.
$('ul#sectionList li').css({//id가 sectionList인 ul의 li들의 css를 변경한다.
width: 100/cnt+'%',//JSON처럼 ,로 설정할것을을 나열한다. ;으로 끝나지 않는다.
});
console.log($('ul#sectionList li'));
$('ul#sectionList li').click(function(){//$('ul#sectionList li')는 배열이다 즉 모든 li에 동일 작업roof가 도는것과 같다.
//hide selected image
$('ul#sectionList li.selected').removeClass('selected');//바로전에 클릭된던 li의 class를 제거한다.
//show image for only this li
$(this).addClass('selected');//click한 li에 select라는 class를 add한다. class는 class=" selected fooclass sooclass"와같이 여러클레스를 다중 추가해줄 수 있는데 공백으로 구분한다.
});
});

</script>
<style type="text/css">
ul#sectionList li.selected {
background-color: red;
}
li{
float: left; //리스트가 달릴때 vertical로 안달리고 horizental식으로 달리게하는 설정이다.
}

body{
margin:0px;
}

ul#sectionList{
-webkit-padding-start:0px;
background-color: green;
overflow:hidden;//상위 element가 height가 설정하지않고, 하위 li들이 flot될때 height가 0이되는 현상이 일어나는데 overflow:hidden;을 해준다면 child의 height로 보여주게 됩니다.
}
</style>
</head>
<body>
<div>
<ul id="sectionList">
<li> <a>전체</a> </li>//chrome에서 요소검사를하면 class가 추가 삭제 되는 현상을 볼수있다.
<li> <a>야구</a> </li>
<li> <a>축구</a> </li>
<li> <a>종합</a> </li>
<li> <a>포토</a> </li>
</ul>
</div>
</body>
</html>

----------------------예제----------------------
<html>
<head>
<meta charset="UTF-8"/>
<script src="jquery-1.6.2.min.js"> </script>
<script>

$(function(){

$('#sectionList li');
document.getElementById('sectionList').childNodes;


var cnt = $('ul#sectionList').children().length;
console.log(cnt);
$('ul#sectionList li').css({
width: 100/cnt+'%',
});
console.log($('ul#sectionList li'));
$('ul#sectionList li').click(function(){
//hide selected image
$('ul#sectionList li.selected').removeClass('selected');
//show image for only this li
$(this).addClass('selected');
});
});

</script>
<style type="text/css">
ul#sectionList li.selected {
background-color: red;
}
li{
float: left;
}

body{
margin:0px;
}

ul#sectionList{
-webkit-padding-start:0px;
background-color: green;
overflow:hidden;
}
</style>
</head>
<body>
<div>
<ul id="sectionList">
<li> <a>전체</a> </li>
<li> <a>야구</a> </li>
<li> <a>축구</a> </li>
<li> <a>종합</a> </li>
<li> <a>포토</a> </li>
</ul>
</div>
</body>
</html> 
 

'Programming > Web Programming' 카테고리의 다른 글

JavaScript 개요  (0) 2014.06.24
webapp deploy in tomcat 7.0  (0) 2014.04.16
javascript - oop  (0) 2014.03.14
javascipt Date객체 formatting yyyy-MM-dd hh:mm:ss  (0) 2014.01.13
HTML - HTML 시작하기  (0) 2011.11.08
posted by Full-stack Developer 2011. 11. 8. 17:28
시작하기전에
-apache서버를 설치를 해야하는데 구글링해서 무료라서 설치하기 쉬울것이다.
apavhe서버를 (단, windows OS일 경우)설치하면 
C:\Program Files\Apache Software Foundation\Apache2.2\htdocs 에 수정한 html파일을 넣어두면 127.0.0.1로 접근하면 파일리스트가 보일것이다. 
그래서 파일을 실행하여 결과화면을 보면서 개발하면된다.

-크롬 요소검사사용을 추천한다. 위에 자신이 개발한 html코드를 작성하고 우클릭->요소검사를 하면 
html css 등 여러 데이터를 분석하는데 큰 도움이 된다.



1.Web programming
-keyword는 소문자로
-html은 이미지, 텍스트같은 데이터만
-css는 테마, 스타일을 설정
-javascript는 동작, 반응 리엑션을 다룬다.
-php는 DBconnection과같이 DB데이터를 다룬다. 페이지를 만들수도 있다.
-기타 프로그래밍과같이 모듈화를 잘해야 한다.
2.기본구조
<html>
<head>
            </head>
            <body>
            </body>
</html> 

3.keyword
<a> - 링크 
<ul> - 리스트 그룹 (ul안에 li를 넣는다)
<li> - 리스트 아이템 
<img> - 이미지 (img는 img안에 넣을 것이 없어서 <img src="dir/images.jpg"/> 와같은식으로 효기된다.)

4.한글깨짐 문제
-meta데이터 html데이터를 설명하기위한 데이터 charset을 설정해주어야 한글이 안깨진다.
<head>
<meta charset="UTF-8"/>
</head>

5.style 설정
style은 <head> 안에 넣는다 </head>
<head>
<style type="
text/css">
...
</style> 
...
</head>
 
6.예제를 통한 설명
-style에 데이터를 지우면서 차이를 비교하세요. 
-하단에 주석이 없는 깨끗한 예제가 있습니다. 

 
<html>
<head>
<meta charset="UTF-8"/>//한글깨짐 해결해주는 부분

<style type="text/css">//스타일 시작부분
body {//style를 적용할때  적용대상(body) { 식으로 시작한다.
margin: 0;
}

li {//리스트 아이템에 style 적용하는 부분 - 아래와같이 적용을 안할경우 기본브라우저가 자동생성해주는 부분이 있어서 자신의 style에 맞게 설정해주어야 한다.
background-color: none;
list-style-type: none;
padding-bottom: 5px;
border-bottom: 1px solid #e3e3e3;//boder-bottom-width, boder-bottom-style, boder-bottom-color을 한번에 설정해줄수있다. 1px solid #e3e3e3  와같이 설정 데이터 사이에 ,은 안넣어준다.
}
ul{//리스트 그룹에 style 적용
-webkit-padding-start: 0px;
}
div#rt_news{//div중 rt_news에 style을 설정한다는 의미다. 아래 보면 id 지정해준 부분이있다.
만약 div #re_new로 div와 #사이를 띄어줄경우 모든 div안에있는 id가 rt_news인 element의 스타일을 설정한다는 의미다. 
width:218px;
}
</style>

</head>
<body>

<div id="rt_news">//div는 박스 개념으로 보면된다. 대세는 div라고한다. 예전에는 table을 많이 사용했다고함.
<img src="images/sokbo.png" />
<ul>//리스트 그룹
<li id="myLi">//리스트아이템(li)을 ul안에 넣는다.
<a>기사입니다! 첫번째</a>
</li>
<li class="myClass">
<a href="http://codedb.tistory.com">기사 두번째!</a>//a는 링크로 기사 두번째! 와같이 표기되게 바꾸어 클릭하면 href로 설정한 url로 이동한다.
</li>
<li>
<a>기사 세번째이여요옹~</a>
</li>
<li>
<a>기사 세번째이여요옹~</a>
</li>
<li>
<a>기사 세번째이여요옹~</a>
</li>
<li>
<a>기사 세번째이여요옹~</a>
</li>
<li>
<a>기사 세번째이여요옹~</a>
</li>
<li>
<a>기사 세번째이여요옹~</a>
</li>
<li>
<a>기사 세번째이여요옹~</a>
</li>
<li>
<a>기사 세번째이여요옹~</a>
</li>
<li>
<a>기사 세번째이여요옹~</a>
</li>
<li>
<a>기사 세번째이여요옹~</a>
</li>
<li>
<a>기사 세번째이여요옹~</a>
</li>
</ul>
</div>

</body>
</html>
---------------------예제------------------------
 <html>
<head>
<meta charset="UTF-8"/>

<style type="text/css">
body {
margin: 0;
}

li {
background-color: none;
list-style-type: none;
padding-bottom: 5px;
border-bottom: 1px solid #e3e3e3;
}
ul{
-webkit-padding-start: 0px;
}
div#rt_news{
width:218px;
}
</style>

</head>
<body>

<div id="rt_news">
<img src="images/sokbo.png" />
<ul>
<li id="myLi">
<a>기사입니다! 첫번째</a>
</li>
<li class="myClass">
<a href="http://codedb.tistory.com">기사 두번째!</a>
</li>
<li>
<a>기사 세번째이여요옹~</a>
</li>
<li>
<a>기사 세번째이여요옹~</a>
</li>
<li>
<a>기사 세번째이여요옹~</a>
</li>
<li>
<a>기사 세번째이여요옹~</a>
</li>
<li>
<a>기사 세번째이여요옹~</a>
</li>
<li>
<a>기사 세번째이여요옹~</a>
</li>
<li>
<a>기사 세번째이여요옹~</a>
</li>
<li>
<a>기사 세번째이여요옹~</a>
</li>
<li>
<a>기사 세번째이여요옹~</a>
</li>
<li>
<a>기사 세번째이여요옹~</a>
</li>
<li>
<a>기사 세번째이여요옹~</a>
</li>
</ul>
</div>

</body>
</html>

'Programming > Web Programming' 카테고리의 다른 글

JavaScript 개요  (0) 2014.06.24
webapp deploy in tomcat 7.0  (0) 2014.04.16
javascript - oop  (0) 2014.03.14
javascipt Date객체 formatting yyyy-MM-dd hh:mm:ss  (0) 2014.01.13
jQuery - jQuery 시작하기  (0) 2011.11.10
posted by Full-stack Developer 2011. 11. 7. 18:22
<activity android:name="MainActivity" android:configChanges="keyboardHidden|orientation">

 

안녕하세요 ^^

잠깐 설명을 해볼까 해요.

폰에서 화면전환시 Activity가 계속 초기화되는 문제를 해결하기위해서 AndroidManifest.xml에서

해당 Activity에 위에 노랑색부분처럼 설정을 해줘야 가로, 세로 전환할때 초기화가 안됩니다.

위에 노랜색부분처럼 설정을 안해주신다면 ->(가로세로 전환한 시점) 

 onCreate -> onCreate -> onCreate ... 이겠죠?

설정을 해주시면

onCreate-> onConfigurationChanged -> onConfigurationChanged ->...


와같은 식으로 동작합니다.

도움되셨으면 좋겟네요 ㅎ

Enjoy coding, Don't be angry :)
 

posted by Full-stack Developer 2011. 11. 4. 14:16
Step 1. SetOnPreparedListener

public class SampleVideo extends Activity {
VideoLoding dlg;
VideoView vv;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.videopage);
Intent i = getIntent();
if(dlg==null){
dlg = new VideoLoding(this,true);
dlg.show();
}
vv = (VideoView)findViewById(R.id.video);
        MediaController mc =  new MediaController(this);
        vv.setVideoURI(Uri.parse(i.getStringExtra("url")));
        vv.setMediaController(mc);
        vv.setOnPreparedListener(new OnPreparedListener() {

            public void onPrepared(MediaPlayer arg0) {
                if(dlg!=null && dlg.isShowing()){
        dlg.dismiss();
        dlg=null;
        }
            }
        });
        vv.start();
}

}

Do u wanna custom indeterminate progressbar?

here is http://codedb.tistory.com/entry/Android-custom-indeterminate-progressbar


안녕하세요 ^^

설명을 잠시 해보겠습니다.

VideoView를 start하기전에 로딩 다이얼로그를 show()해주세요.
그리고 setOnPreparedListener을 설정해주시고 로딩 다이얼로그를 dismiss()해주세요.

즉 play준비가 다되었을때 다이얼로그를 종료한다는 이야기죠.

혹시 커스텀 로딩 다일로그가 필요하세요? 아래링크로 가세요!

http://codedb.tistory.com/entry/Android-custom-indeterminate-progressbar

도움이 되었으면 좋겠네요 ㅎ

즐코딩! 낫빡침! 


posted by Full-stack Developer 2011. 10. 25. 09:57
Step 1. Set WebviewClient
 

Webview child = new Webview(this);

...

child.setWebViewClient(new CWebViewClient(this));

Step 2. Using PageLoding Dialog

 public class CWebViewClient extends WebViewClient {
CWebviewLoding dlg;
Context ctx;
public CWebViewClient(Context ctx) {
this.ctx=ctx;
}

@Override
    public boolean shouldOverrideUrlLoading(WebView view, String url) {
        view.loadUrl(url);
        return true;
    }

@Override
public void onPageFinished(WebView view, String url) {
if(dlg!=null && dlg.isShowing()){
dlg.dismiss();
dlg=null;
}
super.onPageFinished(view, url);
}

@Override
public void onPageStarted(WebView view, String url, Bitmap favicon) {
if(dlg==null){
dlg = new CWebviewLoding(ctx);
dlg.show();
}
super.onPageStarted(view, url, favicon);
}
@Override
public void onReceivedError(WebView view, int errorCode,
String description, String failingUrl) {
if(dlg!=null && dlg.isShowing()){
dlg.dismiss();
dlg=null;
}
super.onReceivedError(view, errorCode, description, failingUrl);
}
}

Do u wanna  custom indeterminate progressbar?
 
here is  http://codedb.tistory.com/entry/Android-custom-indeterminate-progressbar

 

안녕하세요 ^^
설명을 조금 해보겠습니다. ㅎ
웹뷰에 페이지로딩할때 페이지로딩 시작,마침 시점에 다이얼로그를 삽입해
사용자에게 '아 먼가 돌아가고 있나보군!' 이라는 생각이 들게 만들려고 만든건데요

웹뷰에 setWebViewClient으로 Webviewclient를 세팅해주셔야해요.
그러려면 WebViewClient를 만들어야겠죠?

step2에서 보듯이 만드시면되요 잘보시면 dlg라고 커스텀한 다이얼로그가 있는데요
웹뷰 페이지로딩 시작과 종료시점에 show, dismiss를 해주시면 페이지가 로딩될때
잘 동작하겠죠 혹여나 error가 날때를 대비해서 에러나면 dismiss해주는것도 좋을듯
싶어요.

혹시 가운데 동글동글 돌아가는 다이얼로그가 필요하시나요?
아래 경로로가시면 커스텀한 다이얼로그 예제가 있답니닷!!
http://codedb.tistory.com/entry/Android-custom-indeterminate-progressbar

많은 도움이 되셨기를 빕니다.

즐코딩! 낫빡침!
 

posted by Full-stack Developer 2011. 10. 24. 19:20
Step 1. Add permission

<uses-permission android:name="android.permission.INTERNET" />

Step 2. Using google viewer

        WebView webview = (WebView)findViewById(R.id.videoView1);
        webview.getSettings().setJavaScriptEnabled(true); 
        String pdf = "http://www.xxx.xxx/xxx.pdf";
        webview.loadUrl("http://docs.google.com/gview?embedded=true&url=" + pdf);


안녕하세요 ^^
설명을 좀 해볼께요.

우선 인터넷을 사용하니까 permission을 주어야겠죠? Step1처럼 말이죠 ㅎ

그다음은 구글에서 제공하는 pdf뷰어를 사용하는거에요 이걸 이용하면
따로 pdf뷰어를 설치하지 않아도 pdf파일을 볼수가 있죠 ㅎ

Step2와같이 pdf경로를 넣어주시면 됩니다.

도움되셧길 빌계요 ㅎ

즐코딩! 낫빡침! 

 
posted by Full-stack Developer 2011. 10. 24. 19:01
1.send
                Bundle data = new Bundle();
data.putString("data", "I am famous");
msg.setData(data);
commanderHdr.sendMessage(msg); 

2.get
                 Handler commanderHdr = new Handler(){
public void handleMessage(Message msg){
String mylogo = msg.getData().getString("data");
}
};


안녕하세요 ^^
설명을 조금 해보겠습니다 ㅎ

 보내는 부분에서  Bundle을 이용해서 String데이터를 비롯해 넣어주싶은 모든 타입의
데이터를 넣어주세요 putXXX 이런식으로요 ㅎ
그다음 Message변수에 setData로 Bundle을 장착!
그다음 sendMessage로 메시지를 전송하면됩니다.ㅎ

 받는부분에서는 Message에 getData로 데이터를 get해봐서 데이터를 사용하는것입니다.
뭐 예제 2.get을 보시면 금방 눈치 채셨겠지만 말이죠?

도움되셨길 바랍니다 ㅋ

즐코딩! 낫빡침! 

 
posted by Full-stack Developer 2011. 10. 20. 11:45
Step 1. Find ddms.bat
-u r AndoridSDK dir/tools/ddms.bat


Step 2. Click u r Device



Step 3. Click Screen Capture...



Step 4. Use this! 




 

안녕하세요 ^^

설명을 조금 해볼까 합니다 ㅎ
보통 폰으로 개발하는게 훨신 빠르잖아요? ㅎ 그럼 폰으로 스크린샷을 찍을일이 종종 있는데
이때 달빅 디버그 모니터를 이용합니다.

제가 아는 방법으로는 Android SDK설치하실때 경로 있죠?
거기에 찾아들어가보시면 tools라는 폴더가있어요 들어가시면
ddms.bat파일이 있습니다. 실행하시면 끗! ㅋ

실행하고 스크린샷찍으실 디바이스를 클릭하신 후 상단 메뉴바에 Device를 클릭하시면
스크린캡쳐가 반갑게 적혀있죠 ㅎ

도움이 되셨길 바랍니다!

즐코딩! 낫빡침! 

posted by Full-stack Developer 2011. 10. 17. 17:37
 package com.xxx.xxx;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;


public class CUnzip {
final static int BUFFER_SIZE = 1024 * 1000;
public boolean UnzipStart(String fname ){
File zipFile = new File("/sdcard/urdir/filename.ZIP") ;
File targetDir = new File("/sdcard/dir/");
try {
return unzip(zipFile,targetDir);
} catch (Exception e) {

return false;
}
}
private boolean unzip(File zipFile, File targetDir) {
        FileInputStream fis = null;
        ZipInputStream zis = null;
        ZipEntry zentry = null;

        try {
try {

fis = new FileInputStream(zipFile);
zis = new ZipInputStream(fis);

while ((zentry = zis.getNextEntry()) != null) {
String fileNameToUnzip = zentry.getName(); 

File targetFile = new File(targetDir, fileNameToUnzip);

if (zentry.isDirectory()) {//if is Directory
File path = new File(targetFile.getAbsolutePath());
if (!path.isDirectory()) {
path.mkdirs();
}
} else { //if is File 
File path = new File(targetFile.getParent());
if (!path.isDirectory()) {
path.mkdirs();
}
unzipEntry(zis, targetFile);
}
}
} finally {
if (zis != null) {
zis.close();
}
if (fis != null) {
fis.close();
}
}
} catch (Exception e) {
return false;
}
return true;
    }
    private static File unzipEntry(ZipInputStream zis, File targetFile) throws Exception {
        FileOutputStream fos = null;
        try {
            fos = new FileOutputStream(targetFile);

            byte[] buffer = new byte[BUFFER_SIZE];
            int len = 0;
            while ((len = zis.read(buffer)) != -1) {
            if(len == 0){
            return null;
            }
                fos.write(buffer, 0, len);
            }
        } finally {
            if (fos != null) {
                fos.close();
            }
        }
        return targetFile;
    }
}

posted by Full-stack Developer 2011. 10. 17. 17:27
Step 1. Add externer archives...
-u r project -> Rclick -> build path ->add externer archives... 


Step 2. Source
package com.xxx.xxx;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.util.ArrayList;

import org.apache.commons.net.ftp.FTP;
import org.apache.commons.net.ftp.FTPClient;
import org.apache.commons.net.ftp.FTPFile;
import org.apache.commons.net.ftp.FTPReply;

import android.util.Log;


public class FTPUtill {
String SERVERIP = "127.0.0.1";
int PORT = 21;
String SERVERID = "u r id";
String SERVERPW = "u r pw";
    FTPClient ftpClient=null;

boolean DownloadContents(String filename){
this.ftpClient = new FTPClient();
        connect();
login(SERVERID,SERVERPW);
  cd("Root/xxx");//input u r directory
  FTPFile[] files = list();
  if(files==null){
  return false;
  }
  ArrayList<String> ImageIds_tmp = new ArrayList<String>();
  for(int i =0 ;i<files.length;i++){
String fileName = files[i].getName();
            String extension = fileName.substring(fileName.lastIndexOf(".") + 1);
            long size = files[i].getSize();
            extension=extension.toUpperCase();            
if (size > 0) {
for(int j=0;j<size;j++){
if(filename.equalsIgnoreCase(fileName.substring(0, fileName.indexOf(".")))){
StringBuffer furl = new StringBuffer("/sdcard/xxx/");
furl.append(fileName);
ImageIds_tmp.add(furl.toString());
get(fileName, fileName);
}
}
}         
logout();
        disconnect();
        return true;
}
    public boolean login(String user, String password) {
        try {
            this.connect();
            return this.ftpClient.login(user, password);
        }
        catch (IOException ioe) {
            ioe.printStackTrace();
        }
        return false;
    }

    private boolean logout() {
        try {
            return this.ftpClient.logout();
        }
        catch (IOException ioe) {
            ioe.printStackTrace();
        }
        return false;
    }

    public void connect() {
        try {
        this.ftpClient.connect(SERVERIP, PORT);
            int reply;
            reply = this.ftpClient.getReplyCode();
            if(!FTPReply.isPositiveCompletion(reply)) {
            this.ftpClient.disconnect();
            }
        }
        catch (IOException ioe) {
            if(this.ftpClient.isConnected()) {
                try {
                this.ftpClient.disconnect();
                } catch(IOException f) {;}
            }
        } 
    }

    public FTPFile[] list() {
        FTPFile[] files = null;
        try {
            files = this.ftpClient.listFiles();
            return files;
        }
        catch (IOException ioe) {
            ioe.printStackTrace();
        }
        return null;
    }

    public File get(String source, String target) {
        OutputStream output = null;
        try {
        StringBuffer furl = new StringBuffer("/sdcard/xxx/");
        File path = new File(furl.toString());
            if(! path.isDirectory()) {
                    path.mkdirs();
              }
            
            furl.append(target);
            File local = new File(furl.toString());
            if(local.isFile()){
            return null;
            }
            output = new FileOutputStream(local);
        }
        catch (FileNotFoundException fnfe) {;}
        File file = new File(source);
        try {
            if (this.ftpClient.retrieveFile(source, output)) {
                return file;
            }
        }
        catch (IOException ioe) {;}
        return null;
    }

    public void cd(String path) {
        try {
        this.ftpClient.setFileType(FTP.BINARY_FILE_TYPE);
        this.ftpClient.enterLocalPassiveMode();
        this.ftpClient.changeWorkingDirectory(path);
        }
        catch (IOException ioe) {
            ioe.printStackTrace();
        }
    }

    private void disconnect() {
        try {
        this.ftpClient.disconnect();
        }
        catch (IOException ioe) {
            ioe.printStackTrace();
        }
    }
}

안녕하세요 ^^ 
잠시 설명을 약간 해볼까해요.
전 아파치에서 제공하는 FTP를 사용하였는데요.
위에 소스를 잘 분석하시면 사용방법은 간단합니다.
서버 ip 사용자 id, pw, port를 설정해주시고
맨위쪽에 DownloadContents부분을 하나씩 차근차근 디버깅하시면서 
보시면 이해가 되실꺼에요.
접속하고 디렉토리로 이동하고 파일리스트 가져와 내가원하는 파일 찾아서 다운로드!!

그럼 빠른 업무효율을 위해 DownloadContents ctlr+f ㄱㄱ싱

도움이 되셨길 빌께요 ^^

즐코딩! 낫빡침! 

posted by Full-stack Developer 2011. 10. 17. 16:51
void downloadData(String addr){
StringBuilder html = new StringBuilder();
try{
URL url = new URL(addr);
HttpURLConnection conn = (HttpURLConnection)url.openConnection();
if(conn != null){
conn.setConnectTimeout(10000);
conn.setUseCaches(false);
if(conn.getResponseCode() == HttpURLConnection.HTTP_OK){
File book=new File("/sdcard/filedir", "filename.dat");
       FileOutputStream fileOutput = new FileOutputStream(book);
       InputStream inputStream = conn.getInputStream();
       int downloadedSize = 0;
       byte[] buffer = new byte[1024];
       int bufferLength = 0; 
       while ( (bufferLength = inputStream.read(buffer)) > 0 ) {
               fileOutput.write(buffer, 0, bufferLength);
               downloadedSize += bufferLength;
       }
       fileOutput.close();
}
}
}catch(Exception ex){;}
}

안녕하세요 ^^
잠시 설명을 해볼까 합니다ㅎ

파일다운받을때 http방식으로 다운받는 로직인데요.
addr에 파일 풀경로를 넣어주시고
노란색으로 표시된부분에 다운받을실 경로와 파일명을 기입해주시면
끗!

도움이 되셨길 빌어요 ^^
즐코딩! 낫빡침! 

 
posted by Full-stack Developer 2011. 10. 17. 16:32
1.Get 방식
example)

{
...
String result = sendData("http://xxx.xxx.xxx/xxx.asp?title=leeminjung&type=article");
...
}

private static String sendData(String addr){
StringBuilder html = new StringBuilder();
try{
URL url = new URL(addr);
HttpURLConnection conn = (HttpURLConnection)url.openConnection();
if(conn != null){
conn.setConnectTimeout(10000);
conn.setUseCaches(false);
if(conn.getResponseCode() == HttpURLConnection.HTTP_OK){
BufferedReader br = new BufferedReader(
new InputStreamReader(conn.getInputStream()));
for(;;){
String line = br.readLine();
if(line == null)break;
html.append(line );
html.append('\n');
}
br.close();
}
conn.disconnect();
}
}
catch(Exception ex){;}
return html.toString();


2.Post 방식

example)

{
...
   login();
... 


public void login() {
        try {
             URL url = new URL("http://xxx.xxx.xx.xx/xxxx/xxxx/xxx");      
             HttpURLConnection http = (HttpURLConnection) url.openConnection();  

             http.setDefaultUseCaches(false);                                           
             http.setDoInput(true);
             http.setDoOutput(true);
             http.setRequestMethod("POST");
             http.setRequestProperty("content-type", "application/x-www-form-urlencoded");
             
             EditText pwet = (EditText)findViewById(R.id.login_pw_edit);
             EditText idet = (EditText)findViewById(R.id.login_id_edit);

             StringBuffer buffer = new StringBuffer();
                     
buffer.append("LOGIN__USER_ID").append("=").append(idet.getText().toString()).append("&");            
             buffer.append("LOGIN__USER_PW").append("=").append(pwet.getText().toString()); 
                       
             OutputStreamWriter outStream = new OutputStreamWriter(http.getOutputStream(), "EUC-KR");
             PrintWriter writer = new PrintWriter(outStream); 
             writer.write(buffer.toString());//send data
             writer.flush();

             InputStreamReader tmp = new InputStreamReader(http.getInputStream(), "EUC-KR"); 
             BufferedReader reader = new BufferedReader(tmp);
             StringBuilder builder = new StringBuilder();
             String str;
             while ((str = reader.readLine()) != null) {
                  builder.append(str + "\n");
             }
             String  result = builder.toString();//request result
            ...
        } catch (MalformedURLException e) {;} catch (IOException e) {;} 


안녕하세요 ^^
설명을 조금 해드리겠습니다 ㅎ
우선 get방식은 경로에 위에 예제에도 나왔듯이 url에  ?변수명=데이터식으로 이어붙이기를 계속
하시면 되겠죠? 예제보시면 딱 아~ 하실꺼에요..(제 희망사항 ㅠ_ㅠ)

그리고 post방식은  2.post방식 예제에서 노란색으로 표시된 부분을 보시면 변수명 데이터 삽입한
게 보이실 거에요 ㅎ
그럼 응용하면 되겠죠?

도움 되셧길 바래요~

즐코딩! 낫빡침! 

 
posted by Full-stack Developer 2011. 10. 17. 16:05
<activity android:name=".xxxx"
                  android:windowSoftInputMode="adjustPan">



안녕하세요 ^^
잠깐 설명을 해보겠습니다.

 EditText가 있다면 글을 적으려고하면 UI가 위로 같이 올라가버리는 현상이 일어나죠?
이것을 없에기 위해서 EditText를 클릭하여 키보드가 올라가도 UI는 그대로 변경되지
않게 하기위한 방법입니다.

사용방법은 AndroidManifest.xml에서 해당 Activity에 위의 예제처럼 추가해주시면 됩니다.
완전 똑같이 하실필요는 없구요 ㅎ추가만해주셔도 되요 ㅎ

도움이 되셨길 바래요ㅎ

즐코딩! 낫빡침! 

 
posted by Full-stack Developer 2011. 10. 12. 18:21
Step 1. Create CustomButton.xml
res/drawable/custombtn.xml <- create custombtn.xml

 <?xml version="1.0" encoding="utf-8"?> 
<selector  xmlns:android="http://schemas.android.com/apk/res/android">
<item 
    android:state_pressed="false"
    android:drawable="@drawable/bu4_searchall"/>
<item 
    android:drawable="@drawable/bu4_searchall_o"/>
</selector> 

Step 2. To Use 
-ex)res/layout/main.xml 
...
<ImageView
android:src="@drawable/custombtn"
android:id="@+id/main_pressedimgtest_iv" 
android:layout_width="wrap_content" 
android:layout_height="wrap_content"
/> 
... 

Step 3. SetOnClickListener
-user source  ex)src/com.xxx.xxx/main.java
...
 ImageView custombtn = (ImageView)findViewById(R.id.main_pressedimgtest_iv);
 custombtn.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
}
});
... 

안녕하세요 ^^
설명을 해드릴까 합니다.

이건 하단 컨트롤바같은 UI를 만들때 사용자가 press할때 이미지를 변경해주는 방법이에요.
사용자에게 터치감을 주기위해서 사용했습니다.

방법은 우선 버튼의 Step1처럼 버튼 누를시 이미지 변경되게 구현하구요
Step2에서 구현한 커스텀UI를 적용해요  Step2에 노란색 부분을 보시면 알수있겠죠?
Step3에서 클릭이벤트를 설정해줘야 press를 하겠죠?

도움되셧길 바랍니다. ㅎ

즐코딩! 낫빡침!