반응형
이클립스 디버거를 이용해보고자 이클립스를 사용해보고 있는데 역시나 영문이다보니
좀 불편해서 한글 언어팩을 적용해보았습니다.
이전에는 한글 언어팩을 받아와서 압축을 푼뒤 덮어 씌우는 형식으로 했었는데
이클립스에서 기본 지원하는 기능으로도 가능한걸 알게 되어서 정리 해봅니다.

우선 이클립스 실행

이클립스 3.3.2 - Europa


우선 자기가 사용하는 이클립스의 버전을 기억해둡니다.
제가 사용하는 버전은 3.3.2 으로 Europa 라는 코드명을 가지고 있습니다.


메뉴의 Help -> Soft Update -> Find and Install 항목을 선택해줍니다.

Help -> Software Update -> Find and Install



이어서 뜨는 창에서 Search for new features to install 항목을 선택한뒤 Next 버튼을 눌러줍니다.



Install 창이 뜨면 New Remote Site 버튼을 클릭합니다.



팝업창이 뜨면 Name에는 원하는 이름을 적으시고
URL 란에다가는 자신의 이클립스 버전에 맞는 Babel Project 링크를 적어주시면 됩니다.

Babel Project 페이지 : [ http://www.eclipse.org/babel/downloads.php ]

버전별 URL

Europa : http://download.eclipse.org/technology/babel/update-site/europa
Ganymede : http://download.eclipse.org/technology/babel/update-site/ganymede
Galileo : http://download.eclipse.org/technology/babel/update-site/galileo

Europa는 3.3.x / Ganymede는 3.4.x / Galileo는 3.5.x 버전을 말합니다.

URL을 적어주셨으면 OK 버튼을 클릭~



추가된 Babel Language Project 항목이 선택되어진 상태로 Finish 버튼을 클릭




Searching.... 과정을 거치고 나면



Babel Project에서 지원하는 여러 나라의 언어팩이 보여집니다.
그중에서 Babel Language Packs in Korean을 선택한뒤 Next 버튼을 클릭합니다.



동의 여부를 질의하는 창


동의함을 선택하고 Next버튼을 클릭을 합니다.



언어팩의 대략적인 정보


Finish 버튼을 클릭~



언어팩 다운로드 중


이제 설치가 진행됩니다.
이 과정에서 시간이 좀 걸리는 편입니다. 한 5분정도 걸린듯......



!!! 경고 메세지 !!!


중간에 경고메세지는 상콤하게 무시해주시고 Install All 버튼을 클릭합니다.



설치가 완료되면 재시작을 할건지 여부를 물어봅니다.
Yes 버튼을 클릭해서 이클립스를 재시작 해줍니다.




이클립스가 다시 실행되면 한글 언어팩이 제대로 적용되어있는걸 확인 하실 수 있습니다.~



덧붙이는 글 ) 이클립스의 디버그 기능이 괜찮은 편이어서 사용중이기는 한데 혹시나 이클립스 사용하시는 분들중에
자기가 계속 주시하고자 하는 변수를 등록해서 관찰 하는 방법 아시는분 -0-
Posted by 1010
반응형

General : 백그라운드실행, 힙사이즈보기, 싱글클릭파일열기

- Apperance : Presentation, Theme(스킨?) 탭스타일(곡선형/사각형), 애니메이션효과
> Colors and Fonts : 내부툴단위별 UI의 폰트/칼라 : Basic의 폰트만 바꾸면 모두적용할수 있음.
> Label Decoration : Decorates compilation units and class files with an interface, enum, abstract class, or annotation indicator.
- Capabilities : 툴에 통합할수있는 다양한 외부 컴포넌트선택 (디폴트로 대부분 되어있음, 예-Hibernate, JSF지원)
- Compare/Patch : structure 또는 text비교시 선택옵션
- Content Types : 확장자,파일종류별 default encoding설정 - 필요에 따라서 파일종류(JSP, JAVA, HTML등등)를 선택하고 EUC-KR(직접입력)로 설정함
- Editors : 최근열어본파일 리스트 갯수, 에디터창 띄울때 선택옵션
> File Assosiation : 확장자별로 사용할 에디터선택 (같은종류의 파일에 대해서 여러가지 에디터가 있음, 외부에디터도 연결할수 있음)
> Text Editors : tab사이즈, undo할 갯수, 편집중인 라인 하이라이트, 라인넘버링, 영역표시기(에디터 왼쪽가장자리에 영역색이 표시됨)
 클래스 찾아가기 하이퍼링크연결, overwrite typing mode, 항목별 표현색깔 변경가능
>> Accessibility : 커서옵션, 수정된라인의 수정상태를 char로 표시
>> Annotations : 에러, 경고, 북마크, task표시의 표현색, 표현위치옵션
>> Linked Mode : 링크표시 모양,색표현 옵션
>> Quick Diff : 비교기능 사용, 비교할대상(리파지토리,로컬) 선택가능
>> Spelling : 스펠링체크 옵션
- Keys : 기능별 단축키설정
- Perspectives : 작업별 퍼스펙티브관련설정(view구조) 예-자바편집, CVS작업, 서버실행 등등.. 다르게 설정할 수 있음
- Search : 검색옵션
- Startup and Shutdown : 이클립스 부팅/종료시 workspace, plug-in 선택옵션 (디폴트 로딩 플러그인을 대부분 제거할수 있음)
- Web Browser : 연결 브라우저선택
- Welcome : welcome화면 옵션
- Workspace : Build 자동화, refresh자동화, build시 save자동화, workspace자동저장시간, TextFileEncoding? 등등
> Builder Order : 프로젝트별 빌드순서
> Linked Resources : 시스템 파일에 링크를 걸어서 사용가능? 언제?
> Local History : 로컬에 기록할 history 옵션
 
* Ant - Ant관련 옵션...
- Editor
> Content Assist
> Formatter
> Templates
- Runtime
 
* Help : 도움말 옵션
- Help Server : 내부서버 도움 설정?
 
* Install/Update : 이클립스 관련 업데이트설정
- Automatic Updates
 
* Java : PackageExplorer창에서 파일더블클릭 옵션, 리팩토링시 자동저장, 기본SearchMenu, 자바dialog 다시표시
- Appearance : 객체outline표시옵션, PackageExplorer에서 멤버보이기옵션, EmptyPackage숨기기옵션
> Members Sort Order : 멤버 정렬순서조정
> Type Filters : 타입검색시 제거할 필터링조건
- Build Path : 자바컴파일시 소스/클래스 저장위치, JRE라이브러리 선택
> Classpath Variables : 컴파일시 이용할 클래스변수(기본라이브러리)
> User Libraries : 사용자추가 라이브러리
- Code Style : 코딩시 자동으로 커멘트, prefix등 추가하도록 선택, Exception e
> Code Templates : 자동화 코드/커멘트시 템플릿
> Formatter : (사용자지정가능) 자바파일 포맷팅 옵션 (show버튼 클릭하여 자세히) (인덴트 등등)
>> Indentaion : 탭키값 사용여부 등 옵션, 필드선언문 정렬옵션, 자동인덴트옵션
>> Braces : "{" 표시위치옵션
>> White Space : 코드삽입시 한칸 띄우기 옵션
>> Blank Lines : 빈줄 삽입 옵션
>> New Liines : 줄바꿈 옵션
>> Control Statements : 구분의 줄바꿈옵션 else, catch 등
>> Line Wrapping : 소스 컬럼사이즈, 구문에 따른 자동줄바꿈 옵션
>> Comments : 커멘트 컬럼사이즈 옵션
> Organize Imports : import정렬순서
- Compiler : JDK 옵션등
> Building : problem갯수조정 등 빌드옵션
> Errors/ Warnings : 에러,경고마크 표시옵션
> Javadoc : 자바doc 작성관련 표시옵션
> Task Tags : tasktag옵션 fixme, todo, 사용자정의가능
- Debug : 디버깅 실행시 옵션
> Detail Formatters : ?
> Logical Structures : ?
> Primitive Display Option : ?
> Stop Filtering : 디버깅할 클래스 필터링 옵션
- Editor : 자바 편집시 커서 자동이동, 매칭되는 {}표시, 표시색지정
> Content Assist : .입력시 뜨는 선택리스트 관련 및 선택에 따른 옵션
>> Advanced : ?
> Folding : 코드접기 및 자동접기옵션
> Hovers : 컨트롤+마우스 시 관련된 옵션
> Mark Occurences : ?
> Systax Coloring : 구문색 지정
> Templates : ?
> Typing : 편집시 "나, {, ( 등을 입력시 자동으로 닫기문자도 같이 생성, ;이나 {를 적당한위치에 자동삽입 등
- Installed JREs : 설치된 JRE
> Execution Environments : ?
- JUnit : ?
- Properties Files Editor : 프로퍼티 파일 구문색 지정
 
* MyEclipse
- Application Servers
> Tomcat5 활성화
- Files & Editors (기타파일들의 표시설정)
- J2EE Project
> Web Project : 웹프로젝트 관련설정

[출처] 이클립스 설정|작성자 달린다범

Posted by 1010
02.Oracle/DataBase2010. 4. 5. 15:05
반응형
SELECT *
FROM A
AS OF TIMESTAMP(SYSTIMESTAMP - INTERVAL '15' MINUTE);
Posted by 1010
04.Anddoid2010. 3. 29. 09:54
반응형
안드로이드는 어플리케이션 내에서 생성된 모든 Activity의 히스토리 스택
OnCreate
(): Activity가 생성될 때 처음으로 호출되는 함수.리소스를 초기화
OnStart(): Activity가 사용자에게 보여줄 준비가 되었을 때 호출됨
OnResume():Activity가 사용자에게 보여지고 사용자의 입력을 처리할수 있음. Activity스택의 가장 상위에 위치
OnPause(): 포커스 잃고 이전의 Activity 가 Resume되기 전, 데이터 저장,에니메이션 중지,CPU를 소비하는 작업 중단
OnStop():더 이상 Activity가 사용자에게 보여지지 않음.더 이상 Activity가 스택의 가장 위에 있지 않음.
OnDestroy():시스템 내에 Activity가 존재하지 않게 됨
 
Posted by 1010
반응형

Spring - Java/J2EE Application Framework

Reference Documentation

Rod Johnson

Juergen Hoeller

Alef Arendsen

Colin Sampaleanu

Darren Davison

Dmitriy Kopylenko

Thomas Risberg

Mark Pollack

Rob Harrop

Version 1.2.2

Copies of this document may be made for your own use and for distribution to others, provided that you do not charge any fee for such copies and further provided that each copy contains this Copyright Notice, whether distributed in print or electronically.

(Work in progress)


Table of Contents

서문
1. 소개
1.1. 개요
1.2. 사용 시나리오
2. 배경 지식
2.1. 제어의 역행 / 의존 주입(Inversion of Control / Dependency Injection)
3. Beans, BeanFactory 그리고 ApplicationContext
3.1. 소개
3.2. BeanFactory 와 BeanDefinitions - 기초
3.2.1. BeanFactory
3.2.2. BeanDefinition
3.2.3. bean 클래스
3.2.3.1. 생성자를 통한 Bean 생성
3.2.3.2. 정적 factory메소드를 통한 Bean 생성
3.2.3.3. 인스턴스 factory메소드를 통한 Bean 생성
3.2.4. bean 구분자 (id 와 name)
3.2.5. 싱글톤이나 비-싱글톤(non-singleton)
3.3. 프라퍼티, 협력자(collaborators), autowiring 과 의존성 체크
3.3.1. bean프라퍼티와 협력자(collaborators) 셋팅하기
3.3.2. 생성자의 인자 분석
3.3.2.1. 생성자의 인자 타입 대응(match)
3.3.2.2. 생성자의 인자 인덱스
3.3.3. bean프라퍼티와 상세화된 생성자의 인자
3.3.3.1. value와 ref 간략화한(shortcut) 폼
3.3.4. 메소드 삽입
3.3.4.1. 룩업(Lookup) 메소드 삽입
3.3.4.2. 임의의 메소드 교체
3.3.5. depends-on 사용하기
3.3.6. Autowiring 협력자
3.3.7. 의존성을 위한 체크
3.4. bean의 성질을 커스터마이징하기.
3.4.1. Lifecycle 인터페이스
3.4.1.1. InitializingBean / init-method
3.4.1.2. DisposableBean / destroy-method
3.4.2. 당신이 누구인지 알고 있다.(Knowing who you are)
3.4.2.1. BeanFactoryAware
3.4.2.2. BeanNameAware
3.4.3. FactoryBean
3.5. 추상 그리고 자식 bean정의
3.6. BeanFactory와 상호작동하기
3.6.1. BeanFactory의 생성물이 아닌 FactoryBean 얻기
3.7. BeanPostprocessors로 bean 커스터마이징하기
3.8. BeanFactoryPostprocessors를 가진 bean factory커스터마이징하기
3.8.1. PropertyPlaceholderConfigurer
3.8.2. PropertyOverrideConfigurer
3.9. 추가적인 사용자지정 PropertyEditors 등록하기
3.10. 존재하는 bean을 위한 별칭을 추가하기 위한 별칭 요소 사용하기.
3.11. ApplicationContext에 대한 소개
3.12. ApplicationContext에 추가된 기능
3.12.1. MessageSource 사용하기
3.12.2. events 전파하기
3.12.3. Spring내에서 자원(resources) 사용하기
3.13. ApplicationContext내에서 사용자정의 행위
3.13.1. ApplicationContextAware 표시자(marker) 인터페이스
3.13.2. BeanPostProcessor
3.13.3. BeanFactoryPostProcessor
3.13.4. PropertyPlaceholderConfigurer
3.14. 추가적인 사용자정의 PropertyEditors 등록하기
3.15. 프라퍼티 표현에서 bean프라퍼티 또는 생성자의 인자를 셋팅하기.
3.16. 필드값으로부터 bean프라퍼티 또는 생성자의 인자를 셋팅하기.
3.17. 다른 메소드를 호출하고 선택적으로 반환값을 사용한다.
3.18. 하나의 파일로부터 다른것으로 bean정의를 끌어오기
3.19. 웹 애플리케이션으로부터 ApplicationContext생성하기.
3.20. Glue 코드와 좋지않은 싱글톤
3.20.1. SingletonBeanFactoryLocator 와 ContextSingletonBeanFactoryLocator을 사용하기
4. PropertyEditors, data binding, validation and the BeanWrapper
4.1. 소개
4.2. Binding data를 사용한DataBinder
4.3. Bean 조작(manipulation)과 BeanWrapper
4.3.1. Setting 과 getting 기본과 내포된 설정들
4.3.2. 내장 PropertyEditors, 변환 타입들(Built-in PropertyEditors, converting types)
4.3.3. 언급할 가치가 있는 다른 기능들.
5. Spring AOP: Spring을 이용한 Aspect 지향적인 프로그래밍
5.1. 개념
5.1.1. AOP 개념
5.1.2. Spring AOP의 기능과 대상
5.1.3. Spring 내 AOP 프록시
5.2. Spring내 Pointcuts
5.2.1. 개념
5.2.2. pointcuts에서의 작업(operation)
5.2.3. 편리한 pointcut 구현물
5.2.3.1. 정적 pointcuts
5.2.3.2. 동적 pointcuts
5.2.4. Pointcut 수퍼클래스(superclasses)
5.2.5. 사용자지정 pointcuts
5.3. Spring 내 Advice타입들
5.3.1. Advice 생명주기
5.3.2. Spring내 Advice 타입들
5.3.2.1. Interception around advice
5.3.2.2. 전(Before) advice
5.3.2.3. Throws advice
5.3.2.4. advice를 반환한 후(after returning advice)
5.3.2.5. Introduction advice
5.4. Spring내 Advisors
5.5. AOP프록시를 생성하기 위한 ProxyFactoryBean사용하기
5.5.1. 기본
5.5.2. 자바빈 프라퍼티
5.5.3. 프록시 인터페이스
5.5.4. 프록시 클래스
5.5.5. 'global' advisor 사용하기
5.6. 편리한 프록시 생성
5.6.1. TransactionProxyFactoryBean
5.6.2. EJB 프록시
5.7. 간결한 프록시 정의
5.8. ProxyFactory로 프로그램적으로 AOP프록시를 생성하기.
5.9. advised 객체 조작하기.
5.10. "autoproxy" 기능 사용하기
5.10.1. autoproxy bean정의
5.10.1.1. BeanNameAutoProxyCreator
5.10.1.2. DefaultAdvisorAutoProxyCreator
5.10.1.3. AbstractAdvisorAutoProxyCreator
5.10.2. 메터데이타-지향 자동 프록시 사용하기.
5.11. TargetSources 사용하기
5.11.1. 핫 스왑가능한 대상 소스
5.11.2. 풀링 대상 소스
5.11.3. 프로토 타입 대상 소스
5.11.4. ThreadLocal 대상 소스
5.12. 새로운 Advice 타입을 정의하기
5.13. 추가적으로 읽을거리와 자원들
5.14. 로드맵
6. AspectJ 통합
6.1. 개요
6.2. Spring IoC를 사용하여 AspectJ 설정하기.
6.2.1. "싱글톤" aspects
6.2.1.1. 예제
6.2.1.2. 정렬 이슈
6.2.2. 싱글톤 형식이 아닌 aspect
6.2.3. Gotchas
6.3. 목표 Spring advice를 위한 AspectJ 포인트컷(pointcut) 사용하기
6.4. AspectJ를 위한 Spring aspect
7. 트랜잭션 관리
7.1. Spring 트랜잭션 추상화
7.2. 트랜잭션 전략
7.3. 프로그래밍적인 트랜잭션 관리
7.3.1. TransactionTemplate 사용하기
7.3.2. PlatformTransactionManager 사용하기
7.4. 선언적 트랜잭션 관리
7.4.1. BeanNameAutoProxyCreator, 또 다른 선언적 접근방법
7.5. 프로그래밍적/선언적 트랜잭션 관리 중 선택하기
7.6. 트랜잭션 관리를 위한 어플리케이션 서버가 필요한가?
7.7. 공통적인 문제
8. 소스 레벨 메타데이타 지원
8.1. 소스-레벨 메타데이타
8.2. Spring의 메타데이타 지원
8.3. Jakarta Commons Attributes과 통합
8.4. 메타데이타와 Spring AOP 자동 프록시
8.4.1. 기초
8.4.2. 선언적인 트랜잭션 관리
8.4.3. 풀링(Pooling)
8.4.4. 사용자정의 메타데이타
8.5. MVC 웹티어 설정을 최소화하기 위한 속성 사용하기
8.6. 메타데이타 속성의 다른 사용
8.7. 추가적인 메타데이타 API를 위한 지원 추가하기
9. DAO support
9.1. 소개
9.2. 일관된 예외 구조
9.3. DAO지원을 위한 일관된 추상클래스
10. JDBC를 사용한 데이터 접근
10.1. 소개
10.2. 기본적인 JDBC처리와 에러 처리를 위한 JDBC Core클래스 사용하기
10.2.1. JdbcTemplate
10.2.2. DataSource
10.2.3. SQLExceptionTranslator
10.2.4. Statements 실행하기
10.2.5. 쿼리문 실행하기
10.2.6. 데이터베이스 수정하기
10.3. 데이터베이스에 연결하는 방법을 제어하기
10.3.1. DataSourceUtils
10.3.2. SmartDataSource
10.3.3. AbstractDataSource
10.3.4. SingleConnectionDataSource
10.3.5. DriverManagerDataSource
10.3.6. DataSourceTransactionManager
10.4. 자바 객체처럼 JDBC작업을 모델링 하기.
10.4.1. SqlQuery
10.4.2. MappingSqlQuery
10.4.3. SqlUpdate
10.4.4. StoredProcedure
10.4.5. SqlFunction
11. 객체-관계 연결자(O/R Mappers)를 이용한 데이터 접근
11.1. 소개
11.2. Hibernate
11.2.1. 자원 관리
11.2.2. 애플리케이션 컨텍스트내에서 자원 정의
11.2.3. Inversion of Control: Template and Callback
11.2.4. 탬플릿 대신에 AOP인터셉터 적용하기.
11.2.5. 프로그램의 트랜잭션 구분(Demarcation)
11.2.6. 선언적인 트랜잭션 구분
11.2.7. 트랜잭션 관리 전략
11.2.8. 컨테이너 자원 대 로컬 자원
11.2.9. 샘플들
11.3. JDO
11.4. iBATIS
11.4.1. 1.3.x and 2.0 사이의 개요와 차이점
11.4.2. iBATIS 1.3.x
11.4.2.1. SqlMap을 셋업하기
11.4.2.2. SqlMapDaoSupport 사용하기
11.4.2.3. 트랜잭션 관리
11.4.3. iBATIS 2
11.4.3.1. SqlMap 셋업하기
11.4.3.2. SqlMapClientDaoSupport 사용하기
12. 웹 MVC framework
12.1. 웹 MVC framework 소개
12.1.1. 다른 MVC구현물의 플러그인 가능성
12.1.2. Spring MVC의 특징
12.2. DispatcherServlet
12.3. 컨트롤러
12.3.1. AbstractController 와 WebContentGenerator
12.3.2. 간단한 다른 컨트롤러
12.3.3. MultiActionController
12.3.4. CommandControllers
12.4. Handler mappings
12.4.1. BeanNameUrlHandlerMapping
12.4.2. SimpleUrlHandlerMapping
12.4.3. HandlerInterceptors 추가하기
12.5. view와 view결정하기
12.5.1. ViewResolvers
12.5.2. ViewResolvers 묶기(Chaining)
12.6. 로케일 사용하기.
12.6.1. AcceptHeaderLocaleResolver
12.6.2. CookieLocaleResolver
12.6.3. SessionLocaleResolver
12.6.4. LocaleChangeInterceptor
12.7. 테마(themes) 사용하기
12.8. Spring의 multipart (파일업로드) 지원
12.8.1. 소개
12.8.2. MultipartResolver 사용하기
12.8.3. 폼에서 파일업로드를 다루기.
12.9. 예외 다루기
13. 통합 뷰 기술들
13.1. 소개
13.2. JSP & JSTL
13.2.1. 뷰 해결자(View resolvers)
13.2.2. 'Plain-old' JSPs 대(versus) JSTL
13.2.3. 추가적인 태그들을 쉽게 쓸수 있는 개발
13.3. Tiles
13.3.1. 의존물들(Dependencies)
13.3.2. Tiles를 통합하는 방법
13.3.2.1. InternalResourceViewResolver
13.3.2.2. ResourceBundleViewResolver
13.4. Velocity & FreeMarker
13.4.1. 의존물들(Dependencies)
13.4.2. 컨텍스트 구성(Context configuration)
13.4.3. 생성 템플릿들(Creating templates)
13.4.4. 진보한 구성(Advanced configuration)
13.4.4.1. velocity.properties
13.4.4.2. FreeMarker
13.4.5. 바인드(Bind) 지원과 폼(form) 핸들링
13.4.5.1. 바인드(bind) 매크로
13.4.5.2. 간단한 바인딩
13.4.5.3. 폼 input 생성 매크로
13.4.5.4. HTML회피를 오버라이드하고 XHTML호환 태그를 만든다.
13.5. XSLT
13.5.1. 나의 첫번째 단어
13.5.1.1. Bean 정의
13.5.1.2. 표준적인 MVC 컨트롤러 코드
13.5.1.3. 모델 데이터를 XML로 변환하기
13.5.1.4. view프라퍼티 정의하기
13.5.1.5. 문서 변형
13.5.2. 요약
13.6. 문서 views (PDF/Excel)
13.6.1. 소개
13.6.2. 설정 그리고 셋업
13.6.2.1. 문서 view정의
13.6.2.2. 컨트롤러 코드
13.6.2.3. Excel view를 위한 하위클래스 만들기
13.6.2.4. PDF view를 위한 하위클래스 만들기
13.7. JasperReports
13.7.1. 의존성
13.7.2. 설정
13.7.2.1. ViewResolver 설정하기
13.7.2.2. View 설정하기
13.7.2.3. 리포트 파일에 대해
13.7.2.4. JasperReportsMultiFormatView 사용하기
13.7.3. ModelAndView 활성화하기
13.7.4. 하위-리포트로 작동하기
13.7.4.1. 하위-리포트 파일 설정하기
13.7.4.2. 하위-리포트 데이터소스 설정하기
13.7.5. 전파자(Exporter) 파라미터 설정하기
14. 다른 웹 프레임워크들과의 통합
14.1. 소개
14.2. JavaServer Faces
14.2.1. DelegatingVariableResolver
14.2.2. FacesContextUtils
14.3. Struts
14.3.1. ContextLoaderPlugin
14.3.1.1. DelegatingRequestProcessor
14.3.1.2. DelegatingActionProxy
14.3.2. ActionSupport 클래스들
14.4. Tapestry
14.4.1. 아키텍쳐
14.4.2. 구현체
14.4.2.1. 샘플 어플리케이션 컨텍스트
14.4.2.2. Tapestry pages에서 빈들을 얻어오기
14.4.2.3. 어플리케이션 컨텍스트를 Tapestry에 드러내기
14.4.2.4. Component 정의 파일들
14.4.2.5. abstract accessors 추가하기
14.4.3. 개요
14.5. WebWork
15. JMS
15.1. 소개
15.2. 도메인 단일화(unification)
15.3. JmsTemplate
15.3.1. ConnectionFactory
15.3.2. 트랜잭션 관리
15.3.3. 목적지(destination) 관리
15.4. JmsTemplate 사용하기
15.4.1. 메시지 보내기
15.4.2. 동기적으로 받기(Receiving)
15.4.3. 메시지 변환기(converter) 사용하기
15.4.4. SessionCallback 과 ProducerCallback
16. EJB에 접근하고 구현하기
16.1. EJB에 접근하기
16.1.1. 개념
16.1.2. local SLSBs에 접근하기
16.1.3. remote SLSB에 접근하기
16.2. Spring의 편리한 EJB구현물 클래스를 사용하기.
17. Spring을 사용한 원격(Remoting)및 웹서비스
17.1. 소개
17.2. RMI를 사용한 서비스 드러내기
17.2.1. RmiServiceExporter를 사용하여 서비스 내보내기
17.2.2. 클라이언트에서 서비스 링크하기
17.3. HTTP를 통해 서비스를 원격으로 호출하기 위한 Hessian 이나 Burlap을 사용하기.
17.3.1. Hessian을 위해 DispatcherServlet을 묶기.
17.3.2. HessianServiceExporter를 사용하여 bean을 드러내기
17.3.3. 클라이언트의 서비스로 링크하기
17.3.4. Burlap 사용하기
17.3.5. Hessian 이나 Burlap을 통해 드러나는 서비스를 위한 HTTP 기본 인증 적용하기
17.4. HTTP호출자를 사용하여 서비스를 드러내기
17.4.1. 서비스 객체를 드러내기
17.4.2. 클라이언트에서 서비스 링크하기
17.5. 웹 서비스
17.5.1. JAX-RPC를 사용하여 서비스를 드러내기
17.5.2. 웹 서비스에 접근하기
17.5.3. Register Bean 맵핑
17.5.4. 자체적인 핸들러 등록하기
17.5.5. XFire를 사용하여 웹 서비스를 드러내기
17.6. 자동-탐지(Auto-detection)는 원격 인터페이스를 위해 구현되지 않는다.
17.7. 기술을 선택할때 고려사항.
18. Spring 메일 추상 계층을 사용한 이메일 보내기
18.1. 소개
18.2. Spring 메일 추상화 구조
18.3. Spring 메일 추상화 사용하기
18.3.1. 플러그인할 수 있는 MailSender 구현클래스들
18.4. JavaMail MimeMessageHelper 사용하기
18.4.1. 간단한 MimeMessage 를 생성하고 보내기
18.4.2. 첨부파일들과 inline 리소스들을 보내기
19. Quartz 혹은 Timer 를 사용한 스케쥴링
19.1. 소개
19.2. OpenSymphony Quartz 스케쥴러 사용하기
19.2.1. JobDetailBean 사용하기
19.2.2. MethodInvokingJobDetailFactoryBean 사용하기
19.2.3. triggers 와 SchedulerFactoryBean을 사용하여 jobs를 묶기
19.3. JDK Timer support 사용하기
19.3.1. 임의의 timers 생성하기
19.3.2. MethodInvokingTimerTaskFactoryBean 사용하기
19.3.3. 감싸기 : TimerFactoryBean을 사용하여 tasks를 세팅하기
20. JMX 지원
20.1. 소개
20.2. 당신의 bean을 JMX로 내보내기(Exporting)
20.2.1. MBeanServer 생성하기
20.2.2. 늦게 초기화되는(Lazy-Initialized) MBeans
20.2.3. MBean의 자동 등록
20.3. 당신 bean의 관리 인터페이스를 제어하기
20.3.1. MBeanInfoAssembler 인터페이스
20.3.2. 소스레벨 메타데이타(metadata) 사용하기
20.3.3. JDK 5.0 Annotations 사용하기
20.3.4. 소스레벨 메타데이타 타입들
20.3.5. AutodetectCapableMBeanInfoAssembler 인터페이스
20.3.6. 자바 인터페이스를 사용하여 관리 인터페이스 정의하기
20.3.7. MethodNameBasedMBeanInfoAssembler 사용하기
20.4. 당신의 bean을 위한 ObjectName 제어하기
20.4.1. Properties로 부터 ObjectName 읽기
20.4.2. MetadataNamingStrategy 사용하기
20.5. JSR-160 연결자(Connectors)로 당신의 bean을 내보내기
20.5.1. 서버측 연결자(Connectors)
20.5.2. 클라이언트측 연결자
20.5.3. Burlap/Hessian/SOAP 곳곳의 JMX
20.6. 프록시를 통해서 MBean에 접속하기
21. Testing
21.1. 단위 테스팅
21.2. 통합 테스팅
21.2.1. 컨텍스트 관리와 캐슁
21.2.2. 테스트 클래스 인스턴스들의 의존성 주입
21.2.3. 트랜잭션 관리
21.2.4. 편리한 변수들
21.2.5. 예시
21.2.6. 통합 테스트 실행하기
A. spring-beans.dtd
Posted by 1010
반응형

jQuery.utils is a library I maintain and use in my every day work and spare time. It's a collection of jQuery plugins and widget that I often use.

Some are made by me, some by other authors, but they are all under MIT or dual Open Source license.

General Notice I'm looking for some help to maintain this project and make it better (especially an IE expert). Any kind of help would be greatly appreciated (bug report, documentation, unit tests, bug fixing, etc..). You can contact me at haineault (at) gmail.com

Notice:

I'm interesting about how developers use this library and what plugins they use the most. If you do use my library and have some feedback to give me it's the right time:

Take a minute to fill this survey

Goals

  • Provide extra jQuery features for everyday web development
  • Provide downloads on a highly available server
  • Easily make custom builds
  • Provide unit tests for plugins who hasn't
  • Centralize the documentation of the plugins I often use on a highly available server
  • Maybe find some contributors
  • Have fun with jQuery

Builds

Build Plugins
jquery.utils.js utils, strings, anchorHandler, cookie, countdown, cycle, delayedObserver, flash, i18n, masked, mousewheel, slimbox, timeago
jquery.utils.lite.js utils, strings, cookie, cycle, flash, masked, mousewheel, slimbox

Plugins

Plugin Description Author
jquery.utils.js Various utility that I don't know where to put Maxime Haineault
jquery.strings.js Various string formatting method (by now it only has a format method inspired by the Advanced String Formatting module in Python3K, sprintf is expceted next) Maxime Haineault
jquery.anchorhandler.js Handle URLs anchor gracefully with regular expressions (inspired by Django URLs dispatcher). Maxime Haineault
jquery.cookie.js Cookie manipulation Klaus Hart
jquery.countdown.js A simple countdown script Maxime Haineault
jquery.cycle.js A cycle script, useful for banner rotation M. Alsup
jquery.delayedobserver.js A delayed observer. Maxime Haineault
jquery.flash.js A plugin for embedding Flash movies Luke Lutman
jquery.i18n.js Provide a simple API for plugin translation Maxime Haineault
ui.masked.js Input restriction libary Josh Bush
jquery.mousewheel.js Adds mouse wheel support for your application Brandon Aaron
jquery.slimbox.js Slimbox 2 is a 4 KB visual clone of the popular Lightbox 2 script by Lokesh Dhakar, written using the jQuery javascript library. Christophe Beyls
jquery.timeago.js A plugin that makes it easy to support automatically updating fuzzy timestamps (e.g. "4 minutes ago" or "about 1 day ago") Ryan McGeary

Extra plugins

These plugins are not built by default. To include them you only have to uncomment a line in build.yml and type ./built.py -m. See the build system documentation for more details.

Plugin Description Author
jquery.flickrshow.js This plugins takes a flickr photostream link and turns it into a nice little slideshow.
jquery.arrayUtils.js Provide additional functional method to work with array. This library is largely inspired by the enumerables concept in the Prototype Javascript Library
jquery.ddbelated.js A plugin designed to fix that problem by applying appropriate filters to user specified elements, while keeping all element tags intact.

UI (widgets)

These plugin are available with the jquery.utils.ui.js build.

Widget Description Author
ui.builder.js Simple template generator for UI common widgets Maxime Haineault
ui.toaster.js IM style popup notification system Maxime Haineault
ui.timepickr.js Time picker control Maxime Haineault
dev.timepickrDev UI timepickr development notes Maxime Haineault

Note: Depends on the jQuery UI library.

Experimental

These are toy projects, some might be eventually included in the build, some are not even actually working yet. In other words, it's my sandbox

Name Description Author
jquery.extendCSS.js Maxime Haineault
jquery.jpath.js Maxime Haineault
jquery.valid.js Validation libary Maxime Haineault
jquery.keynav.js Maxime Haineault

Links

Discussions about jQuery utils
Project statistics

Stats

Posted by 1010
반응형

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
 <HEAD>
  <TITLE> New Document </TITLE>
  <META NAME="Generator" CONTENT="EditPlus">
  <META NAME="Author" CONTENT="">
  <META NAME="Keywords" CONTENT="">
  <META NAME="Description" CONTENT="">
 </HEAD>
<SCRIPT LANGUAGE="JavaScript">
<!--
 function test(obj){
  var tc = document.getElementsByName(obj.name);
  for(var i=0; tc.length; i++){
   if(tc[i] == obj){
    var j = i;
    break;
   }
  }
  alert(j);

 }
//-->
</SCRIPT>
 <BODY>
  <INPUT TYPE="text" NAME="aaa" ONCLICK="test(this);"><INPUT TYPE="button" name="btn" VALUE="" ONCLICK="test(this);">
   <INPUT TYPE="text" NAME="aaa" ONCLICK="test(this);"><INPUT TYPE="button"  name="btn" VALUE="" ONCLICK="test(this);">
 </BODY>
</HTML>

Posted by 1010
반응형
사용자 삽입 이미지
프로젝트에서 의사소통 및 문서정리를 위해서 wiki를 하나 설치하기로 했다. Trac같이 이슈트랙킹과 wiki가 같이 제공하는 것도 좋지만 이슈 트랙킹은 다른 것으로 하기에 간단한 걸 하나 구하기로 했다.
내가 쓰는 언어가 Java이니 문제 발생할 경우 그래도 복구가 가능한 java 기반의 JSPWiki를 선택했다.

1. Requirements
다음과 같은 시스템 요구사항을 가진다. 일반적인 것이기 때문에 다음 소프트웨어의 설치는 생략한다.

  • Java 1.4 이상
  • tomcat 5.5 이상


2. 다운로드
다음 URL에서 JSPWiki를 다운받는다.
http://www.jspwiki.org/wiki/JSPWikiDownload
여기서 설치할 버전은 2.6.4를 기준으로 한다.

3. 설치
Zip 파일을 풀면 JSPWiki.war 파일이 있다. tomcat을 구동하고 webapps 밑에 복사한다.
여기 경우는 context root를 단순히 wiki로 하기 위해 wiki.war로 이름을 바꾸어서 webapps 밑에 넣었다.
tomcat 이 war를 풀면서 다음과 같은 에러가 발생한다. 일단 무시하고 tomcat을 내린다.

java.lang.NullPointerException
        at com.ecyrd.jspwiki.util.WatchDog.enterState(WatchDog.java:231)
        at com.ecyrd.jspwiki.search.LuceneSearchProvider$LuceneUpdater.backgroundTask(LuceneSearchProvider.java:711)
        at com.ecyrd.jspwiki.util.WikiBackgroundThread.run(WikiBackgroundThread.java:135)

이제 war가 풀린 디렉토리에서 작업할 것이다. webapps/wiki.war는 삭제하고 풀린 webapps/wiki 만 남긴다. 주의할 점은 tomcat이 기동된 상태에서 wiki.war를 삭제하면 wiki 디렉토리도 삭제된다는 점이다.

4. WEB-INF/jspwiki.properties 수정
각종 wiki 데이터가 생성될 디렉토리가 필요하다. 여기서는 /home/wikidata 디렉토리 생성했다.

그리고 tomcat의 webapps/wiki 디렉토리 밑의 WEB-INF/jspwiki.properties 중 다음 내용을 수정한다.

...
jspwiki.fileSystemProvider.pageDir = /home/wikidata/
...
jspwiki.basicAttachmentProvider.storageDir = /home/wikidata/
...
log4j.appender.FileLog.File = /home/wikidata/jspwiki.log
...

그리고 다시 tomcat 시작...

5. 설치확인
다음 URL로 접속하여 설치사항을 확인한다. 물론 ip와 port는 자신의 환경에 맞게...
URL: http://localhost:8080/wiki/Install.jsp
처음에는 관리계정이 없다. 각각 설정을 확인하고 "Configure" 버튼을 클릭한다. 그러면 설치가 되고 admin 계정이 생성되고 임의적으로 생성된 Password를 알려준다.
생성된 admin 암호는 "Configure" 클릭한 다음 화면에 나타나니 화면이동 말고 잘 적어둔다.

6. 접속
다음 URL에 접속하고 admin으로 로그인해서 이것 저것 살펴본다. ^^
http://localhost:8080/wiki/

Posted by 1010
반응형
http://heedy.pe.kr/entry/etc200807042



서버 구성

Windows XP sp2
아파치

Tomcat 6.0.13 + Apache 2.2.4 + MySQL 5.0.45+ WindowsXP 를 참고.

JSPWiki 다운로드

JSPWiki http://jspwiki.org/ - JSPWiki-2.4.103-bin.zip


먼저 압축 파일 안에 있는 README 파일을 훑어 보아야 한다. 당연히 !


설치

다운 받은 JSPWiki-2.4.103-bin.zip 속에 있는 JSPWiki.war 를 C:\tomcat\webapps 에 복사하기만 하면 된다.

설치 끝...^0^
이제 Tomcat 을 다시 실행하면 저절로 압축이 풀리는 것을 볼 수 있다.

톰캣을 실행하면 저절로 압축이 풀리며 설치된다.

Tomcat 을 다시 실행하면 (C:\tomcat\bin\startup.bat 를 실행)

다음과 같은 메시지를 Tomcat 실행 화면에서 볼 수 있었다.

    정보: Deploying web application archive JSPWiki.war
    log4j:ERROR setFile(null,true) call failed.
    java.io.FileNotFoundException: \tmp\jspwiki.log (지정된 경로를 찾을 수 없습니다)

그리고 실행결과로

C:\tomcat\webapps\JSPWiki 에 JSPWiki.war 의 파일들이 풀려지고
C:\p\web\www-data\jspwiki (빈 폴더)
C:\tomcat\temp\JSPWiki-4313181
C:\tomcat\temp\JSPWiki-10625551
폴더가 만들어 졌다.

물론 C:\tomcat\conf\auto\mod_jk.conf 파일에 다음 설정이 추가 되었다. (Tomcat 6.0.13 + Apache 2.2.4 + MySQL 5.0.45+ WindowsXP 에서 처럼 설정했다면... )
    JkMount /JSPWiki ajp13
    JkMount /JSPWiki/* ajp13


설정

웹브라우저에서 http://localhost/JSPWiki/Install.jsp (대소문자 주의!)로 들어가면
Installer Page 가 보인다. 다음 설정들을 할 수 있다.

Basics
Application Name : JSPWiki
Base URL : http://localhost/JSPWiki/
Page storage : c:/jspwiki/pages/ (/p/web/www-data/jspwiki/)

Security
Security configuration : JAAS plus container security (default) / Container security only

Advanced Settings
Log files : c:/jspwiki/tmp/jspwiki.log (/tmp/jspwiki.log)
Work directory : c:/jspwiki/tmp/ (/tmp/)

Configure! 버튼을 누르면

C:\tomcat\webapps\JSPWiki\WEB-INF\jspwiki.properties
userdatabase.xml
groupdatabase.xml
파일이 수정됨.


설정이 끝났다.


로그파일이 없으면 오류가 발생한다.

톰캣을 재시작하면

log4j:ERROR setFile(null,true) call failed.
java.io.FileNotFoundException: c:\jspwiki\tmp\jspwiki.log (지정된 경로를 찾을 수 없습니다)

C:\jspwiki\pages
C:\jspwiki\tmp (refmgr.ser,lucene\segments)
폴더가 만들어 졌다.

그래서 c:\jspwiki\tmp\jspwiki.log 파일을 수동으로 만들어 주었다.(톰캣을 재시작)


아파치에서 JSPWiki 보기

이미 JKMount 설정이 위에서 되었기 때문에
그냥 아파치를 재시작하기만 한 후
웹브라우저 http://localhost/JSPWiki/ 로 들어가면 mian 문서를 볼수 있다.


기본 페이지 넣기

아무런 데이터도 들어가지 않은 JSPWiki 의 처음 실행 화면은 설렁하기만 하다.
JSPWiki-corepages.zip 를 압축을 풀어
Page storage (c:/jspwiki/pages/) 에 넣어주면 기본 페이지들을 만들 수도 있다.


한글 사용

다음 JSPWiki 에서 한글이름으로 된 페이지를 만들기 위해서는
server.xml 파일에 아래 항목을 찾아 굵은 글씨 부분을 넣어 주면 된다.

<Connector port="8009" protocol="AJP/1.3" redirectPort="8443" URIEncoding="UTF-8" />

이렇게 하니  한글검색도 되네.

 이 문서들( http://jspwiki.org/wiki/TomcatAndUTF8 , http://jspwiki.org/wiki/KoreanSupport  )을 참고하자.

그러나
완전히 한글로 된 것은 아니군... 쩝...
실제 파일은 16진수 형식의 파일 이름(이렇게 %ED%95%9C%EA%B8%80)을 가지고 하드디스크에 저장이 된다.
UTF-8 문자를 시스템이 다 지원 못하면 어쩔 수 없이 16진수 형식의 파일 이름이 낫겠다.


로그(C:\jspwiki\tmp\jspwiki.log)에 我爱你 가 我?? 로 표시 되네.
아직 문제가 남아 있다.



Posted by 1010
04.Anddoid2010. 3. 24. 11:19
반응형
Posted by 1010
01.JAVA/Java2010. 3. 24. 09:45
반응형
출처 : http://bleujin.tistory.com/153

framework_src.zip의 com.bleujin.framework.db.sample에 기본 적인 예제가 있으며 특히 com.bleujin.framework.db.sample에 가장 기초적인 예제가 있다.

해당 예제들을 실행하기 위해서는 sample_mysql.sql(mssql.sql, oracle.sql 역시 모두 같은 역할을 한다.) 의 예제 테이블 등의 내용을 실행시킨다 . 모든 테스트를 실행하기 위해서는 com.bleujin.framework.db.sample.SampleAllTest.java 를 실행한다.


주요 클래스

DBManager

     - 가장 먼저 생성해야 할 클래스로 대부분 JDBC URL과 userID, password를 생성자로 받는다.
        DB별로 혹은
            MySQLDBManger, MySQLPoolDBManager
            MSSQLDBManger, MSSQLPoolDBManager
            OracleDBManger, OracleDBManager, OracleCacheDBManger, Oracle9iCacheDBManger
            H2EmbedDBMangaer, HSQLDBManager 등등

DB별, 접속형태별(Pool여부, Cache여부)로 여러개의 구현체를 가지고 있다.

ex)
DBManager dbm = new MySQLPoolDBManager("jdbc:mysql://novision/test", "bleu", "redf") ;



IDBController


      - DBManger를 생성자로 받는 IQueryable Impl의 Factory 역할을 맡는다.
      - 현재는 IDBController의 구현체로 DBController 한개만 있다.
      - initSelf() 메소드로 dbm의 Pool 초기화 등의 작업을 실행하고 destroySelf() 메소드로 DBManager Pool을 해제시킨다. initSelf()는 생성후 꼭 실행시켜 주어야 한다. 보통의 경우 initSelf()는 프로그램 시작시에 한번, destorySelf()는 프로그램 종료시에 한번 실행한다. Static 변수로 참조하여 사용하는 경우가 일반적이지만 꼭 그럴필요는 없다.

ex)
DBController dc = new DBController(dbm) ;
dc.initSelf() ;
....
dc.destroySelf() ;

     - DBManger와 IDBController를 생성시키고 initSelf()를 실행했다면 이제 쿼리를 실행시킬 준비는 모두 완료되었다.
        가장 간단한 쿼리 실행은
        Rows rows = dc.execQuery(String select) ;
        int result = dc.execUpdate(String mdl) ; 이다.
       



IQueryable
    - 인터페이스이고 execQuery()와 execUpdate()의 주 메소드 2개를 가지고 있다. 모든 실행할수 있는 쿼리는 IQueryable를 상속받는다. 가장 많이 알려진 구현체로 UserCommand, UserCommandBatch, UserProcedure, UserProcedureBatch, UserPorcedures 등이 있다.




IUserCommand

     - 굳이 비슷한 걸 찾자면 JDBC의 PreparedStatement의 역할과 비슷하며 사용방법도 비슷하다.

ex)
IUserCommand cmd = dc.createUserCommand("select * ... where a = ? and b = ?") ;
cmd.addParam(1).addParam("abc") ;
// cmd.addParam(0, 1).addParam(1, "abc") ; // 위구문과 의미가 같다. param index는 0부터 시작한다.

// 혹은 아래와 같이 같은 변수를 여러개 사용하거나 편이성을 위해 named parameter를 사용할수 있다.
IUserCommand cmd = dc.createUserCommand("select * ... where a = :a and b = :b and c >= :a") ;
cmd.addParam("a", 1).addParam(b, "abc") ;

// 만약 특별한 형을 지정하고 싶다면. cmd.addParam("a", 1, Types.LONG) ; 와 같이 명시적으로 지정한다.


      - IUserCommand 실행
Rows rows = cmd.execQuery() ;  // select
int result = cmd.execUpdate() ;     // mdl

       - 실행계획 보기
//실행계획의 해당 DB의 기능을 이용하기 때문에 Format은 DB마다 다른데, MySQL은 표 형태로, MSSQL은 XML Graph형태로, Oracle은 문자열로 보여준다.
cmd.viewPlan(OutputSteam output) ;


       - Page 설정
// 쿼리를 실행하기 전에 Page를 설정하여 해당 Page의 결과값만을 가져올수 있다.
cmd.setPage(Page.create(10, 2)) ;     // 10개씩 했을때 2페이지 즉 11-20번째 row를 가져온다.
cmd.execQuery() ;

이전의 cursor 관련글에서도 확인하였듯이 가장 좋은 방법은 원하는 집함만을 억세스 해서 원하는 집합형태로 가져오는 쿼리를 사용하는 것이 Page 설정에 있어서의 가장 좋은 답이다. 그렇게 생각했기 때문에 예전의 버전에는 Page 관련 기능을 넣지 않았다. 다만 그것은 MySQL의 limit나 오라클의 rownum의 단순한 사용방법보다는 훨씬 더 고난이도이기 때문에 DB별로 자유자재로 할 수 있는 사람이 극히 드물고 또한 매우 번거롭다. 또한 그 효과를 볼수 있는 곳이 제한적이기 때문에 번거로움을 무시하고 모든 곳에 그와 같은 쿼리 방식을 사용하는것은 불필요하다는 아니지만 비효율적이다라는 생각이 들었다.


Rows


   - 쿼리를 실행할수 있는 Interface인 IQueryable의 하위 구현체는 IUserCommand, IUserProcedure, IUserCommmandBatch, IUserProcedureBatch, UserProceudres, TimeoutQuery ... 등등 아주 많은데 그중의 모든 Select 문의 결과값으로 ResultSet의 인터페이스를 구현한 Rows를 반환한다. ResultSet Interface를 구현하였기 때문에 기존의 메소드를 거의 모두 지원하며 몇가지 추가 유틸리티 메소드를 제공한다.

  - 기존의 일반 JDBC에서 반환하는 ResultSet의 구현체와는 다르게 Rows는 Value Object 기반의 클라이언트 커서를 사용한다. 따라서 쿼리의 실행후 pstmt.close(), rs.close(), freeConnection()의 과정은 전부 내부에서 이루어지고 호출자에게 노출되지 않는다. 일단 IDBControler가 초기화된후 dc.getRows() 혹은 cmd.execQuery() 실행후 사용자는 Resource의 반환등에 전혀 신경쓸 필요 없으며 내부적으로 상황에 맞는 결과 캐쉬를 통해 실행속도를 보장한다. rows는 인터페이스 규약상 close()가 있지만 close()를 하지않아도 단순 ValueObject이므로 가비지 컬렉터에 의해 자동으로 정리가 된다.

   - Rows는 거의 순수하게 Value 객체이기 때문에 Framework에서 자동으로 반환한 Resource와 상관없이 Clob 억세스와 쿼리 재실행 등이 가능하며 Serialized XML 형태로 언제든 변환이 가능하다.


rows.getNextPage() ; // 다음 페이지의 rows를 가져온다.
rows.getPrePage() ;; // 이전 페이지의 rows를 가져온다.

   - Clob Access
     JDBC에는 Clob과 Blob의 표준 datetype이 있지만 DB마다 지원여부와 사용방법이 조금씩 다르다. 또한 그 사용방법이 대부분 번거롭게 때문에 varchar의 글자수 제한으로 어쩔수 없이 Clob을 사용해야 하는 경우 매우 불편하다. 그래서 Datatype이 Clob이더라도 DB에 따라 자동 형변환을 통해 rows.getString()을 통해 Access한다. (Blob은 getBinaryStream()) 만약에 Clob에 들어가는 데이타가 100M가 넘는다면 이 방법을 사용하는 것을 신중히 생각해야 할지도 모른다. 그러나 텍스트 1M를 넣는 경우도 매우 흔치 않을뿐더러 그경우에도 Blob으로 다루는 방법을 선택하는게 좋다.

    # insert 혹은 update시 parameter는 DB 벤더에 상관없이 setClob(String str), setBlob(InputStream input) 메소드를 사용하면 된다.




IUserCommandBatch

   - 특정 테이블에 10건의 insert를 해야 한다면 10개의 UserCommand를 실행시키는 것보다 10개의 Arrary를 parameter에 set한후 실행시키는 Batch를 사용하는게 좋다. 평균적으로 최소한 Batch는 건당 insert 속도가 최소 1ms 이하를 보장하며 이는 UserCommand의 기준 속도인 50ms보다 약 50배가 더 빠르다.

ex)
IUserCommandBatch cmd = dc.createUserCommandBatch("insert into update_sample values(?, ?)") ;
int max = 1000 ;
for (int i = 0; i < max; i++) {
        cmd.addBatchParam(0, i) ;
        cmd.addBatchParam(1, i + "th ..") ;
 }
int count = cmd.execUpdate() ;
와 같이 설정하거나..

int[] a = new int[max];
String[] b = new String[max] ;
for (int i = 0; i < max; i++) {
    a[i] = i ;      b[i] = i + "th .." ;
}
cmd.addParam(a).addParam(b) ;
int count = cmd.execUpdate() ;
등과 같이 직접 Array를 인자로 설정한다.


    - 하나의 Batch문에 에 가장 효율적인 건수는 JVM에서 관리되는 Array가 차지하는 메모리에도 밀접한 관련이 있긴 하지만 대략 10,000-100,000 사이가 가장 좋다. row의 평균사이즈를 150-250 byte로 했을때 대부분은 만건당 최대 10초이내의 효과를 보인다.




IUserProcedure

   - 가장 많은 오해를 받지만 가장 효율적이며 많이 사용되는 객체이다. IUserProcedure는 오라클이나 MSSQL의 Procedure와는 직접적인 관계는 없다. 프로그램에 직접 ANSI SQL를 사용했을 경우 이후 DB에 변동이 있다면 재앙수준의 변경을 요구한다. 특히 SQL이 String 변수로 관리되기 때문에 직접 모든 프로그램을 열어서 수정해야 한다. 컴파일 오류가 아닌 런타임 오류가 나기 때문에 수정에 대한 확신도 매우 어렵다.

    이러한 문제로 몇년전부터는 IBatis등에서 XML 형태로 Key Value형태로 관리한후 Key 형태로 Access 하는 방식이 좀더 많이 퍼지게 되었다. 비슷하게 UserProcedure는 앞에서 말한 DB 벤더에 디펜던트한 Procedure와는 직접적 상관없이 그냥 IDName을 가진 Message 객체에 불과하다. 그 Message를 어떻게 해석할 것인가는 DB Manager에 달려 있으며

현재 Framework에 포함되어 있는 OracleDBManger는 패키지와 프로시저, MSSQL은 Procededure로, MySQL은 Procedure 혹은 Function으로 H2DBManager는 특정 XML 파일의 Key-Value 형식의 SQL name으로 해석하고 있다. 즉 UserProcedure는 DB Maanger를 어떻게 구현하는가에 따라 해석방법이 정해지며 일단 같은 name을 가진다면 DB 벤더의 프로시저 혹은 패키지 지원여부와 상관없이 동일한 결과값을 보장해야 한다.


ex)
IUserProcedure upt = dc.createUserProcedure("Sample@selectBy(:a)") ;
upt.addParam("a", 1); 
Rows rows = upt.execQuery() ;

만약 DBManager가 MySQLPoolDBManager라면 위 구문을 Sample_selectBy라는 procedure라고 해석하며
해당 MySQL에는 아래와 같은 Procedure가 있다면 해당 프로시저를 실행한후 그 결과 Rows를 반환한다.

CREATE PROCEDURE sample_selectBy(v_a int)
BEGIN
    SELECT * FROM update_sample WHERE a > v_a ;
END//



만약 DBManger가 오라클이라면 아래와 같이 Sample Package의 selectBy function을 실행시킨후 결과셋을 반환한다.

CREATE OR REPLACE PACKAGE BODY Sample
    is
        function selectBy (v_a number) return Types.cursorType
        is
            rtn_cursor Types.cursorType ;
        begin
            open rtn_cursor For
            select * from update_sample where a > v_a ;
           
            return rtn_cursor ;
        end ;

         ................
       
End Sample ;


     - 이와 같이 DB가 Procedure를 지원하는가 혹은 지원하지 않는가와 상관없이 IUserProcedure는 쓰이며 그 해석방법은 DBManager에게 달려있다. IUserCommand보다 IUserProcedure의 사용을 더 권장하는 이유는 DB 벤더의 장점을 최대한 활용할 수 있고 개발과 유지보수에 있어서의 장점때문이다. 물론 기타 성능이나 보안등의 자잘한 이유는 제껴두고서라도 말이다.


IUserProcedureBatch

    - IUserCommandBatch 처럼 UserProcedure의 Batch 버전이다. 다만 Proceudre 구조상 Batch라서 해서 UserProcedure와 비교해 커다란 성능차이는 없다. 다만 하나의 Procedure에 여러개의 SQL문을 담을 수 있다는 걸 생각하면 복잡한 배치처리 작업에나 쓸만하다.



UserProcedures
    - s가 뒤에 하나 붙어 있다. UserProcedure는 자신이 IQueryable의 구현체이면서 IQueryable의 구현체를 담을수 있는 composite 형태로 되어 있다. UserProcedures에 담긴 모든 MDL문은 자동으로 하나의 Transaction으로 처리가 된다. 그리고 물론 각각의 개별적인 실행보다는 조금 더 빠르다.

ex)
 IUserCommand cmd1 = dc.createUserCommand("insert into update_sample values(?, ?)") ;
 cmd1.addParam(1).addParam("abc") ;
 IUserCommand cmd2 = dc.createUserCommand("delete from update_sample where a = ?") ;
 cmd2.addParam(1);
       
 UserProcedures upts = dc.createUserProcedures("Multi MDL") ;
 upts.add(cmd1).add(cmd2) ;

 int result = upts.execUpdate() ;
 assertEquals(2, result) ;
    
    - 만약 UserProcedures에 여러개의 Select Query를 집어넣고 execQuery()를 실행하면 어떻게 될까? 이 경우에 여러개의 결과값을 반환하게 되는데 Rows.getNextRows()를 통해 다음 결과셋을 얻을수 있다. UserProcedures에 담긴 IQueryable 객체는 add된 순서대로 실행된다.

ex)        
  IUserCommand cmd1 = dc.createUserCommand("select * from copy_sample") ;
  cmd1.setPage(Page.create(10, 1)) ;
  IUserCommand cmd2 = dc.createUserCommand("select 3 from dept_sample") ;
       
  UserProcedures upts = dc.createUserProcedures("Multi Query") ;
  upts.add(cmd1).add(cmd2) ;
       
  Rows first = upts.execQuery() ;  // first query result ;
  assertEquals(true, first.getRowCount() == 10) ;
       
  Rows second = first.getNextRows() ; // second query result ;
  assertEquals(3, second.firstRow().getInt(1)) ;




XAUserProcedure

    - 앞의 UserProcedures는 하나의 DB에 대한 Transaction 보장이며 이기종 DB 즉 멀티 DB에 대한 멀티 MDL문의 분산 트랜잭션은 XAUserProcedure를 통해 할수 있다.


    MSSQL의 접속관리자인 mdc와 오라클의 접속관리자인 odc가 아래와 같이 이미 생성되어 있다고 하자.
// prepare
MSSQLDBManager mManager = new MSSQLDBManager("jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=test", "bleu", "redf");
DBController mdc = new DBController(mManager) ;
mdc.initSelf() ;

OracleDBManager oManager = new OracleDBManager("jdbc:oracle:thin:@novision:1521:al", "al", "redf") ;
DBController odc = new DBController(oManager) ;
odc.initSelf() ;
       

// tx1 : MSSQL용 쿼리 집합을 만든다.        
TxTransaction tx1 = new MSSQL2000TxTransaction(mManager, "mquery") ;
tx1.add((Queryable)mdc.createUserCommand("insert into copy_tblc values('111', 111)")) ;
       
// tx2 : oracle용 쿼리 집합을 만든다.
TxTransaction tx2 = new Oracle9iTxTransaction(oManager, "oquery") ;
tx2.add((Queryable)odc.createUserCommand("insert into copy_tblc values('111', 111)")) ;
       

// add tx : 두개의 쿼리 집합을 XAUserProcedure에 넣는다.
TxTransaction[] txs = new TxTransaction[]{tx1, tx2} ;
XAUserProcedure upts = new XAUserProcedure(txs) ;

// 실행한다.
upts.execUpdate() ;


// clear : 더이상 사용되지 않을 DB 접속정보라면 정리한다.
mdc.destroySelf() ;
odc.destroySelf() ;


      - 보통의 XaTransaction 보다 훨씬 더 간편하게 실행할 수 있다. 결국 인터페이스의 간결화로 호출자는 자세한 XaTransaction 과정에 대해 알 필요가 없다.

MSSQL에서 XaTransaction을 사용하기 위해서는
     * Be sure that you have copied your sqljdbc.dll file from C:\Program Files\Microsoft SQL Server 2000 Driver for JDBC\SQLServer JTA\ to your SQL Server's "binn" directory (most likely C:\Program Files\Microsoft SQL Server\MSSQL\Binn).
     * Then open your instjdbc.sql script from C:\Program Files\Microsoft SQL Server 2000 Driver for JDBC\SQLServerJTA\ within Query Analyzer and run the script. This will install the extended stored procedures into SQL Server so that it can reference the sqljdbc.dll file.

     의 과정을 실행해야 하며 MS DTC가 기동중이어야 한다. MySQL은 얼마전까지 XaTransaction을 지원하지 않았고 현재도 InnoDB storage engine에서만 지원하는 걸로 알고 있다.



CombinedQuery

     - CombinedQuery는 UserProcedure와 조금 비슷한데 단지 UserProcedures와는 달리 MDL문과 Query문을 동시에 실행시킬수 있다는 점이 다르다.


ex)
IUserCommand ins = dc.createUserCommand("insert into update_sample values(?,?)") ;
ins.addParam(1).addParam("abc") ;
       
IUserCommand sel = dc.createUserCommand("select * from update_sample") ;
       
CombinedUserProcedures upts = dc.createCombinedUserProcedures("combined") ;
upts.add(ins, "ins", IQueryable.UPDATE_COMMAND).add(sel, "sel", IQueryable.QUERY_COMMAND) ;

// 타입이 다른 ins문과 sel문을 동시에 실행시킨다.       
upts.execUpdate() ;
       
Map result = upts.getResultMap() ; // for access sel'result
       
int rowcount = (Integer)result.get("ins") ;
Rows rows = (Rows)result.get("sel") ;
       
assertEquals(1, rowcount) ;
assertEquals("abc", rows.firstRow().getString("b")) ;

    - 역시 하나의 Transaction으로 처리된다. 주로 마이그레이션 작업이나 session scope temporary table을 가지고 작업할때 쓰인다. 혹은 Session Level Configuration 명령문과 select문을 혼합할때 쓰이기도 한다. 즉 특정경우에 Set Ansi_null Off 시키고자 할때 session 명령문은 Update로 Select문은 Query로 실행시킨다. 앞어 거듭 말했듯 Rows는 클라이언트 커서이기 때문에 한건을 insert 하고 해당 건을 select하고 해당 건을 지우는 3개의 명령문을 combinedProcedure에 넣고 실행시켜도 제대로 된 Rows 결과물을 볼 수 있다.




ExtraServant


    - ExtraServant는 IQueryable의 구현 클래스가 아니며 이름 그대로 IDBController의 하인 역할를 수행한다. 예컨데 모든 쿼리의 실행시간을 System.out으로 확인하고 싶다고 하자.

ex)
dc.addServant(new StdOutServant(StdOutServant.All)) ;

를 실행시켜 주면 해당 dc로부터 생성된 모든 IQueryable 객체는 실행후 StdOutServant를 통해 쿼리 이름과 실행시간을 System.out에 출력한다. 그와 동시에 300ms 이상의 모든 쿼리는 따로 기록해 두고 싶다고 한다면.

ex)
dc.addServant(new TraceOfLateProcServant(300)) ;
를 추가시키면 된다.

dc는 1개 이상의 ExtraServant를 가지며 모든 쿼리는 해당 쿼리 작업을 완료후 Chain된 ExtranServant를 통해 임의의 추가 행동을 지정할 수 있다. ExtraServant는 별도의 Thread로 관리되며 ExtraServant의 동작시간과 행동은 기존의 작업에 영향을 주지 않는다.

별도의 IDBController를 새로 만들어서 Connection만 공유한채 Servant 정보는 달리 유지시킬수 있다.

ex)
DBController newDc = new DBController("newDC", dc.getDBManager()) ;
newDc.addServant(new StdOutServant(StdOutServant.All)) ; // 모든 IQueryable를 화면에 프린트하는 Servant를 추가한다.
newDc.addServant(new StdOutServant(StdOutServant.All)) ; // 한개 더 추가한다.
newDc.initSelf() ;
       
newDc.getRows("select 1 from copy_sample") ;
newDc.destroySelf() ;

위의 경우 newDC는 기존 dc.getDBManger의 Owner가 아니기 때문에 destroySelf()를 실행시켜도 해당 DBManger의 Pool은 파괴되지 않는다.

     - ExtraServant는 다양한 상황에 새롭게 상속받아 구현함으로써 다양한 역할을 수행할 수 있다. 이를테면 특정 사용자가 접속했을때 MSN으로 메시지를 보내주는 Servant를 구현할 수도 있고 특정 쿼리들이 실행되었을때 Log를 남기는 Servant를 구현할수도 있다.



   Handler

   - Rows는 여러종류의 Handler를 사용하여 다양한 타입으로 변신이 가능하다.


Rows rows = dc.getRows("select * from copy_sample order by no1", 10, 1) ;

첫번째 row를 Map 형태로 바꿀 수도 있고
ex)
Map results = (Map)rows.toHandle(new MapHandler()) ;
assertEquals(2, results.size()) ;   // column 수 확인

모든 row를 Map의 List 형태로 바꿀 수도 있고.
List<Map> results = (List<Map>)rows.toHandle(new MapListHandler()) ;
assertEquals(10, results.size()) ; // row수 확인

모든 row를 Bean List 형태로 바꿀 수도 있고
List<TestBean> results = (List<TestBean>)rows.toHandle(new BeanListHandler(TestBean.class)) ;
TestBean row = results.get(0);

assertEquals(1, row.getNo1()) ;
assertEquals("01", row.getNo2()) ;

assertEquals(2, results.get(1).getNo1()) ;
assertEquals("02", results.get(1).getNo2()) ;


특정 컬럼의 값만을 얻어올수도 있다.
Object value = rows.toHandle(new ScalarHandler(2)) ; // 첫번째 row의 2번째 컬럼의 값
assertEquals("1", value.toString()) ;




6년전에 해당 Framework를 처음 개발했을때 목적은 4가지이다.

1. 풀링을 구현하되 프레임워크 사용자가 실수로라도 Connectionless를 만들 수 있는 방법을 원천적으로 차단한다.
    -> Connectio은 외부에서 보이지 않으며 Client Cursor 사용으로 결과셋 전달후 Resource는 자동으로 바로 반환한다. 즉 사용자는 JDBC의 Resource에 대해 알 필요도 없으며 알 수도 없다.

2. 프로그램에 SQL문을 심지 않는다.
    -> UserProcedure의 적극적인 사용으로 Query문은 모두 중앙집중 관리 되며 이는 개별적인 DB 벤더의 장점은 최대한 활용함과 동시에 DB 벤더에 종속되지 않는다는 상이한 목표를 동시에 추구한다. IQueryable의 모든 구현체는 단순히 Message역할만을 수행하기 때문에 JDBC의 PreparedStatement와 달리 정리해줘야 할 Resource가 아니다.

3. LOB 핸들링을 쉽게 한다.
   -> 벤더마다 그리고 버전마다 Lob Handling에 있어서의 사용방법이 다른걸 간단한 인터페이스로 통합시고 사용자는 byte 단위의 Access Handling을 하지 않아도 되게 한다.

4. 사용방법은 쉬워야 함과 동시에 여러가시 발생할 수 있는 상황에 쉽게 적응 가능해야 한다. 동시에 불필요한 퍼포먼스 감소를 일으켜서는 안된다.



이후.. 한동안 추가 기능이 없다가 최근에

  - MySQL을 기존의 MSSQL, Oracle과 더블어 기본 테스트 항목및 지원DB로 함.
  - 인터페이스의 소폭 수정
  - viewPlan(Query의 실행계획보기)
  - Paging (쿼리의 Page 설정, nextPage, prePage Access)
  - NamedParameter

등등의 잡다한 기능을 넣었다. 가장 큰 이유는 Paging 때문인데 JDBC에 Client cursor에 Page 관련 메소드가 있는데 제대로 implement한  JDBC가 거의 없어서 그냥 만들었다. -ㅅ-. Page는 DB 마다 처리 방법이 다르지만 해당 DB에 가장 효율적인 방법을 사용하려고 했다.




framework_src.zip

framework_core_fat.jar



사용자는 framework_core_fat.jar를 추가하고 해당 DB의 JDBC jar만 추가시켜서 사용하면 된다.

아래와 같은 Apache Common Jar를 사용한다.
<fatjar.jarsource file="lib\jericho-html-2.5.jar" relpath=""/>  // 얘는 parser framework에 쓰임
<fatjar.jarsource file="lib\jmock-core-1.2.0.jar" relpath=""/>
<fatjar.jarsource file="lib\junit.jar" relpath=""/>
<fatjar.jarsource file="lib\apache-common\commons-pool-1.1.jar" relpath=""/>
<fatjar.jarsource file="lib\apache-common\commons-beanutils-1.8.0.jar" relpath=""/>
<fatjar.jarsource file="lib\apache-common\commons-collections-3.1.jar" relpath=""/>
<fatjar.jarsource file="lib\apache-common\commons-dbcp-1.1.jar" relpath=""/>
<fatjar.jarsource file="lib\apache-common\commons-digester.jar" relpath=""/>
<fatjar.jarsource file="lib\apache-common\commons-fileupload-1.1.jar" relpath=""/>
<fatjar.jarsource file="lib\apache-common\commons-io-1.2.jar" relpath=""/>
<fatjar.jarsource file="lib\apache-common\commons-lang-2.3.jar" relpath=""/>
<fatjar.jarsource file="lib\apache-common\commons-logging-1.0.4.jar" relpath=""/>
<fatjar.jarsource file="lib\apache-common\commons-net-1.3.0.jar" relpath=""/>
<fatjar.jarsource file="lib\apache-common\commons-validator-1.1.4.jar" relpath=""/>
Posted by 1010
05.JSP2010. 3. 24. 09:42
반응형

Jsp File Browser

An easy to use and easy to install file browser java server page. This JSP program allows remote web-based file access and manipulation.
Features:
Main Screen (Dir viewer) with preview of directory 1.
  • Create, copy, move, rename and delete files and directories
  • Shortkeys
  • View Files (pictures, movies, pdf, html,...)
  • Javascript filename filter
  • Edit textfiles
  • Upload files to the server (Status via Upload monitor)
  • Download files from the server
  • Download groups of files and folders as a single zip file that is created on the fly
  • Execute native commands on the server (e.g ls, tar, chmod,...)
  • View entries and unpack zip, jar, war and gz files on the server
  • Just one file, very easy to install (in fact, just copy it to the server)
  • Customizable layout via css file
  • Restrict file access via black or whitelist
  • Changeable to a read-only (with or without upload) solution
  • ...

It should work with any JSP1.1 compatible server(e.g. Tomcat>=3.0), I have tested it on Tomcat 4.0 and 5.5, Resin 2.1.7 and Jetty.
If you found any bugs or have a feature request, please use the bug tracking system, or write me an email.
I will also add common questions here.
If you want to get informed about new releases, please enter the Mailinglist (only for new release announces, no discussion). Write a mail with empty body to jspfilebrowser-subscribe@vonloesch.de.
Please submit bugs here.

Download version 1.2
Screenshots
Online Demo (no upload and command execution, can be very slow)
Bug tracking and Feature requests

Posted by 1010
99.유용한정보/잡식2010. 3. 9. 16:17
반응형
출처 : http://hompy.info/594

서울 골목길까지 로드뷰로 보는 Daum지도
| 한번에 최저가를 검색하는 Daum쇼핑하우
저번 주에 스마트폰 개발 관련 컨퍼런스 2 곳을 다녀왔고 이와 관련된 자료들을 조금 살펴 보았습니다. 앱센터 컨퍼런스와 전자신문에서 주최했던 컨퍼런스 아이폰 앱 제작 스토리 였으며 스마트폰 애플리케이션 개발자가 참고할만 이슈들이 있어 관심을 가지고 참가 했습니다. 특히 앱센터에서는 개인 개발자를 지원하는 프로그램이 준비된다고 하니 주의깊게 살펴봐야 할 것 같습니다. 창업을 고려하는 분들이라면 중소기업청에서 하고 있는 1인 창조 기업 지원사업에 대해 알아보시면 도움이 될 것입니다. 아래에는 그동안 살펴본 체크 사항들을 짧막하게 정리해 본 메모가 있습니다.
저 또한 아이폰 애플리케이션 개발에 관심이 있는 관계로 요즘 이와 관련하여 스터디를 진행하고 있습니다. 요즘들어 참가신청이 늦었음에도 참여를 희망하는 분들이 많지만 스터디 장소가 좀 협소해서 맴버수를 10여명 수준으로 제한을 두고 있습니다. 좀더 넓은 공간을 제공할 수 있는 분이 있다면 지원해주시면 좋겠고 그렇게 된다면 더 많은 분들을 참여시켜 드릴 수 있겠지요.
여담으로 웹프로그래머의 홈페이지 정보 블로그 방문자 TOTAL 이 3백만을 넘었습니다. 그동안 신경을 못쓰고 있었는데 많은 분들이 다녀가셨지요. 이를 계기로 앞으로 열심히 블로그에 글을 올리겠다는 약속은 못하지만 가끔이라도 흥미로운 글을 올려볼까 합니다.^^

[스마트폰 그리고 아이폰]
위치 기반, 통화 기반, 카메라 기반 휴대용 어플리케이션
자는 시간을 제외하고 언제든 접근 가능, 온라인 오프라인 일체화
UI / UX, 접근성, 동선이 짧고 신속하게 이용 가능
아이튠즈, 손쉽게 음악 파일을 받고 관리
선택의 폭이 넓은 다양한 장르의 저렴한 17만개 어플리케이션
개발자 접근성, 수평적, 생산 주기, 제작 기간
기업이 할 수 없는 개인 개발자의 기발하고 창의적이며 도전적인 작품 탄생 가능
자랑할 수 있는 스마트폰, 자랑할 수 있는 어플리케이션
3rd-Party 협력 업체들이 수익을 올릴 수 있는 마켓 개방, 상생의 모델, 수평적 네트워크, 에코시스템, 비즈니스 생태계, 기회의 평등, 3만여명의 개발자
급성장하고 있는 SNS 와의 융합
아이디어가 곧 시장
PC환경에서 경험할 수 없는 새로운 어플리케이션
LBS, 증강현실, SNS, SNG, 무료 통화
뱅킹, 주식거래
앱스토어, 북스토어
아이폰 / 아이팟 / 아이패드

[어플리케이션 개발]
자랑이 가능한 어플리케이션
자투리 시간에 할용할 수 있는 어플리케이션
새로운 어플리케이션
연령/언어/문화적인 특성이 고려된 어플리케이션
장르, Games > Entertainment > Utilites > Photography
가격, $0.99 > $1.99 > $2.99 > $4.99 > $9.99
모방 – 기능 개선 – 창조, 진화, 예) 일반 룰러 –> 회전 –> 중력센서 –> 초음파
엔진 사용, 2D/3D 엔진, AR 엔진, 증강현실 엔진
QA, UX 중요
지속적인 업그레이드
매시업, 오픈API, 오픈소셜
커스터마이징, 전화 거는 어플리케이션, spDial
개발 기간 : 1주 ~ 1달, 선행 학습 : 5일 ~ 1달
대학 커리큘럼, 1학기 수업 과정, 2인 1주 투입 프로토타입 완성, 기업과 캘리브레이션 3개월, 제품 출시, 한국컨텐츠진흥원, 지역 기반 진흥원
인력 수급?, 학교, 학원 교육 과정 점진적 확대, 재직자 교육 과정, 현장 파견 교육
전업 개발 vs 취업 개발
제조사, 서비스 오퍼레이터 별 교육

[어플리케이션 마케팅]
리뷰 사이트, 파워 블로그
UCC, 유튜브 동영상, 플레이 동영상
SNS, 트위터, 페이스북, 싸이월드, 바이럴 마케팅
모바일 광고 대행(AD platform), Admob
새로나온 어플리케이션이나 오늘만 무료인 어플리케이션 알림 서비스
유용한 정보 알림 서비스 어플리케이션 배포, 광고 인프라 확보
판매 추적 툴: appFigures, 랭킹 추적 툴: APPlyzer
현재 마켓 동향 분석 브랜드 마케팅용 어플리케이션
베타 테스터 모집, 리딤 코드 배포
앱 다운로드 상위 순위 앱 확보, 전문 마케팅 회사 활용 가능, 리드할 수 있는 어플리케이션 확보로 후속 어플리케이션 마케팅 툴로 활용
상위 순위 앱을 기반으로 언론 노출, 자사 브랜드 강화, 자사 앱 가치 상승, 앱 외주 개발, 사업 제의, 사업 제휴 폭발, 지속적인 관리 및 업그레이드
어플리케이션 네이밍, a/b/c/d로 시작?, 고유 브랜드, 이름 선점 필요, 애플에서 동일 이름 후속 어플리케이션 등록 제한
앱스토어 소개 페이지, 스크린샷, 아이콘 디자인, 첫인상
개인과 기업의 차이점

[어플리케이션 수익성]
Touch Snake, 일반 앱 수익성 테스트, 이찬진, 한달간 623 카피, $0.99/UNIT
2 Across, Eliza Block, 매일 700 카피, 매일 $2,000, $5.99/UNIT
Cartoon Wars, 최강우, 최초 1위 랭크, 하루 1만 카피 이상, $0.99/UNIT
Awesome note, 8억원 수익 추정, 백승찬, $3.99/UNIT
Heavy Mach, 3주만에 1억원 수익, 2주만에 전체 5위, $0.99/UNIT
Plants vs. Zombies, 출시 9일만에 매출 100만달러, 2.99$/UNIT
AppBox Pro, 하루 4만 카피, $0.99/UNIT

웹프로그래머의 홈페이지 정보 블로그 http://hompy.info/594
Posted by 1010
반응형
디비에 넣을때 변환

String contents = comment.getContent().replace( "\r\n", "<BR/>" );
comment.setContent(contents);


화면상에 뿌려줄때 변환 (수정모드시)
String contents = qnaComment.getContent().replace( "<BR/>", "\r\n" );
qnaComment.setContent(contents);

일반화면
<%=contents>
Posted by 1010
카테고리 없음2010. 2. 25. 11:51
반응형
  • 제목 : 한RSS 디렉토리 등록
  • 본문 : <a href="http://www.hanrss.com/directory">한RSS 디렉토리</a>
  • 해당 글을 RSS로 발행합니다.
Posted by 1010
반응형

괜찮은 일정관리 프로그램 [라이프 매니저]

► Retweet


메모의 단점은 시간이 정리하지 않고 묵혀두면 안 하니 만 못하든 점이다. 평소 메모를 많이 하는 편이지만 책상이며, 모니터며 늘어가는 메모지는 골치덩어리일 뿐이다. 올 초 뭔가 돌파구를 찾아보겠다고 구입한 프랭클린 다이어리 역시 별반 다를 바가 없다. 기록하고 실행하지 못하면 소용이 없다.

라이프매니저1

최근에 괜찮은 일정관리 프로그램 하나를 발견했다. 대단히 심플하면서도 가볍고, 실행의지를 북돋우는 프로그램이다.

라이프매니저일간

대략적인 메뉴 구성과 기능에 대한 설명이다.

1.일간 계획 – 하루 동안의 계획을 기록하고 실행할 수 있는 일종의 Todo리스트를 제공.
2.주간 계획 – 한 주를 한눈에 조망하고 확인할 수 있는 페이지.
3.다음 행동 - 프로젝트에 연결되는 다음행동들을 지정하고 리스트화.
4.프로젝트 – 두 가지 이상의 다음행동이 포함되는 것이 모두 프로젝트에 포함된다.
5.일일 기록 - 일종의 일기형식으로 매일의 기록을 기재할 수 있다.
6.수집함 - 머리에 떠오르는 Todolist나 프로젝트를 기록. 항상 0이 되도록 제때 옮겨야 한다.
7.언젠가/어쩌면 - 바로 실행하지 못하더라도 언젠가 / 어쩌면 확인해야 할 부분으로 나누어 관리한다.
8.추후확인 - 위임한 일이나 확인이 필요한 부분을 따로 기록하고 관리할 수 있다.

실행하지 못한 부분들은 붉은 색으로 표시되고, 완료된 리스트는 체크표시 되고 기간이 지나면 자동으로 목록에서 사라진다. 지난 일정에 대한 검색도 용이하며, USB에 담아서 사용하기도 편하다.


http://lifemanager.me/
]http://lifemanager.me/
http://lifemanager.me/

Posted by 1010
반응형
<html>
  <head>
    <!--
      CryptoMX Tools
      Copyright (C) 2004 - 3005 Derek Buitenhuis

      This program is free software; you can redistribute it and/or
      modify it under the terms of the GNU General Public License
      as published by the Free Software Foundation; either version 2
      of the License, or (at your option) any later version.

      This program is distributed in the hope that it will be useful,
      but WITHOUT ANY WARRANTY; without even the implied warranty of
      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      GNU General Public License for more details.

      You should have received a copy of the GNU General Public License
      along with this program; if not, write to the Free Software
      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
    -->
    <title>DES Crypt</title>
    <!-- des.js -->
   
    <script language="Javascript">
function dP(){
  salt=document.CRYPT.Salt.value;
  pw_salt=this.crypt(salt,document.CRYPT.PW.value);

  document.CRYPT.ENC_PW.value=pw_salt[0];
  document.CRYPT.Salt.value=pw_salt[1];
  return false;
}

function bTU(b){
      value=Math.floor(b);
      return (value>=0?value:value+256);
}
function fBTI(b,offset){
      value=this.byteToUnsigned(b[offset++]);
      value|=(this.byteToUnsigned(b[offset++])<<8);
      value|=(this.byteToUnsigned(b[offset++])<<16);
      value|=(this.byteToUnsigned(b[offset++])<<24);
      return value;
}
function iTFB(iValue,b,offset){
      b[offset++]=((iValue)&0xff);
      b[offset++]=((iValue>>>8)&0xff);
      b[offset++]=((iValue>>>16)&0xff);
      b[offset++]=((iValue>>>24)&0xff);
}
function P_P(a,b,n,m,results){
      t=((a>>>n)^b)&m;
      a^=t<<n;
      b^=t;
      results[0]=a;
      results[1]=b;
}
function H_P(a,n,m){
      t=((a<<(16-n))^a)&m;
      a=a^t^(t>>>(16-n));
      return a;
}
function d_s_k(key){
      schedule=new Array(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
      c=this.fourBytesToInt(key,0);
      d=this.fourBytesToInt(key,4);
      results=new Array(0,0);
      this.PERM_OP(d,c,4,0x0f0f0f0f,results);
      d=results[0];c=results[1];
      c=this.HPERM_OP(c,-2,0xcccc0000);
      d=this.HPERM_OP(d,-2,0xcccc0000);
      this.PERM_OP(d,c,1,0x55555555,results);
      d=results[0];c=results[1];
      this.PERM_OP(c,d,8,0x00ff00ff,results);
      c=results[0];d=results[1];
      this.PERM_OP(d,c,1,0x55555555,results);
      d=results[0];c=results[1];
      d=(((d&0x000000ff)<<16)|(d&0x0000ff00)|((d&0x00ff0000)>>>16)|((c&0xf0000000)>>>4));
      c&=0x0fffffff;
      s=0;t=0;
      j=0;
      for(i=0;i<this.ITERATIONS;i++){
         if(this.shifts2[i]){
            c=(c>>>2)|(c<<26);
            d=(d>>>2)|(d<<26);
         }else{
            c=(c>>>1)|(c<<27);
            d=(d>>>1)|(d<<27);
         }
         c&=0x0fffffff;
         d&=0x0fffffff;
         s=this.skb[0][c&0x3f]|this.skb[1][((c>>>6)&0x03)|((c>>>7)&0x3c)]|this.skb[2][((c>>>13)&0x0f)|((c>>>14)&0x30)]|this.skb[3][((c>>>20)&0x01)|((c>>>21)&0x06)|((c>>>22)&0x38)];
         t=this.skb[4][d&0x3f]|this.skb[5][((d>>>7)&0x03)|((d>>>8)&0x3c)]|this.skb[6][(d>>>15)&0x3f]|this.skb[7][((d>>>21)&0x0f)|((d>>>22)&0x30)];
         schedule[j++]=((t<< 16)|(s&0x0000ffff))&0xffffffff;
         s=((s>>>16)|(t&0xffff0000));
         s=(s<<4)|(s>>>28);
         schedule[j++]=s&0xffffffff;
      }
      return schedule;
}
function D_E(L,R,S,E0,E1,s){
      v=R^(R>>>16);
      u=v&E0;
      v=v&E1;
      u=(u^(u<<16))^R^s[S];
      t=(v^(v<<16))^R^s[S+1];
      t=(t>>>4)|(t<<28);
      L^=this.SPtrans[1][t&0x3f]|this.SPtrans[3][(t>>>8)&0x3f]|this.SPtrans[5][(t>>>16)&0x3f]|this.SPtrans[7][(t>>>24)&0x3f]|this.SPtrans[0][u&0x3f]|this.SPtrans[2][(u>>>8)&0x3f]|this.SPtrans[4][(u>>>16)&0x3f]|this.SPtrans[6][(u>>>24)&0x3f];
      return L;
}
function bdy(schedule,Eswap0,Eswap1) {
  left=0;
  right=0;
  t=0;
      for(j=0;j<25;j++){
         for(i=0;i<this.ITERATIONS*2;i+=4){
            left=this.D_ENCRYPT(left, right,i,Eswap0,Eswap1,schedule);
            right=this.D_ENCRYPT(right,left,i+2,Eswap0,Eswap1,schedule);
         }
         t=left;
         left=right;
         right=t;
      }
      t=right;
      right=(left>>>1)|(left<<31);
      left=(t>>>1)|(t<<31);
      left&=0xffffffff;
      right&=0xffffffff;
      results=new Array(0,0);
      this.PERM_OP(right,left,1,0x55555555,results);
      right=results[0];left=results[1];
      this.PERM_OP(left,right,8,0x00ff00ff,results);
      left=results[0];right=results[1];
      this.PERM_OP(right,left,2,0x33333333,results);
      right=results[0];left=results[1];
      this.PERM_OP(left,right,16,0x0000ffff,results);
      left=results[0];right=results[1];
      this.PERM_OP(right,left,4,0x0f0f0f0f,results);
      right=results[0];left=results[1];
      out=new Array(0,0);
      out[0]=left;out[1]=right;
      return out;
}
function rC(){ return this.GOODCHARS[Math.floor(64*Math.random())]; }
function cript(salt,original){
  if(salt.length>=2) salt=salt.substring(0,2);
  while(salt.length<2) salt+=this.randChar();
  re=new RegExp("[^./a-zA-Z0-9]","g");
  if(re.test(salt)) salt=this.randChar()+this.randChar();
  charZero=salt.charAt(0)+'';
      charOne=salt.charAt(1)+'';
  ccZ=charZero.charCodeAt(0);
  ccO=charOne.charCodeAt(0);
  buffer=charZero+charOne+"           ";
      Eswap0=this.con_salt[ccZ];
      Eswap1=this.con_salt[ccO]<<4;
      key=new Array(0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0);
      for(i=0;i<key.length&&i<original.length;i++){
         iChar=original.charCodeAt(i);
         key[i]=iChar<<1;
      }
      schedule=this.des_set_key(key);
      out=this.body(schedule,Eswap0,Eswap1);
      b=new Array(0,0,0,0,0,0,0,0,0);
      this.intToFourBytes(out[0],b,0);
      this.intToFourBytes(out[1],b,4);
      b[8]=0;
      for(i=2,y=0,u=0x80;i<13;i++){
         for(j=0,c=0;j<6;j++){
            c<<=1;
            if((b[y]&u)!=0) c|=1;
            u>>>=1;
            if(u==0){
               y++;
               u=0x80;
            }
            buffer=buffer.substring(0,i)+String.fromCharCode(this.cov_2char[c])+buffer.substring(i+1,buffer.length);
         }
      }
  ret=new Array(buffer,salt);
      return ret;
}

function Crypt() {
this.ITERATIONS=16;
this.GOODCHARS=new Array(
  ".","/","0","1","2","3","4","5","6","7",
  "8","9","A","B","C","D","E","F","G","H",
  "I","J","K","L","M","N","O","P","Q","R",
  "S","T","U","V","W","X","Y","Z","a","b",
  "c","d","e","f","g","h","i","j","k","l",
  "m","n","o","p","q","r","s","t","u","v",
  "w","x","y","z");
this.con_salt=new Array(
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
      0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
      0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
      0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
      0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
      0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,
      0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,
      0x0A,0x0B,0x05,0x06,0x07,0x08,0x09,0x0A,
      0x0B,0x0C,0x0D,0x0E,0x0F,0x10,0x11,0x12,
      0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,
      0x1B,0x1C,0x1D,0x1E,0x1F,0x20,0x21,0x22,
      0x23,0x24,0x25,0x20,0x21,0x22,0x23,0x24,
      0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,
      0x2D,0x2E,0x2F,0x30,0x31,0x32,0x33,0x34,
      0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,
      0x3D,0x3E,0x3F,0x00,0x00,0x00,0x00,0x00 );
this.shifts2=new Array(
  false,false,true,true,true,true,true,true,
  false,true, true,true,true,true,true,false );
this.skb=new Array(0,0,0,0,0,0,0,0);
  this.skb[0]=new Array(
         0x00000000,0x00000010,0x20000000,0x20000010,
         0x00010000,0x00010010,0x20010000,0x20010010,
         0x00000800,0x00000810,0x20000800,0x20000810,
         0x00010800,0x00010810,0x20010800,0x20010810,
         0x00000020,0x00000030,0x20000020,0x20000030,
         0x00010020,0x00010030,0x20010020,0x20010030,
         0x00000820,0x00000830,0x20000820,0x20000830,
         0x00010820,0x00010830,0x20010820,0x20010830,
         0x00080000,0x00080010,0x20080000,0x20080010,
         0x00090000,0x00090010,0x20090000,0x20090010,
         0x00080800,0x00080810,0x20080800,0x20080810,
         0x00090800,0x00090810,0x20090800,0x20090810,
         0x00080020,0x00080030,0x20080020,0x20080030,
         0x00090020,0x00090030,0x20090020,0x20090030,
         0x00080820,0x00080830,0x20080820,0x20080830,
         0x00090820,0x00090830,0x20090820,0x20090830 );
  this.skb[1]=new Array(
         0x00000000,0x02000000,0x00002000,0x02002000,
         0x00200000,0x02200000,0x00202000,0x02202000,
         0x00000004,0x02000004,0x00002004,0x02002004,
         0x00200004,0x02200004,0x00202004,0x02202004,
         0x00000400,0x02000400,0x00002400,0x02002400,
         0x00200400,0x02200400,0x00202400,0x02202400,
         0x00000404,0x02000404,0x00002404,0x02002404,
         0x00200404,0x02200404,0x00202404,0x02202404,
         0x10000000,0x12000000,0x10002000,0x12002000,
         0x10200000,0x12200000,0x10202000,0x12202000,
         0x10000004,0x12000004,0x10002004,0x12002004,
         0x10200004,0x12200004,0x10202004,0x12202004,
         0x10000400,0x12000400,0x10002400,0x12002400,
         0x10200400,0x12200400,0x10202400,0x12202400,
         0x10000404,0x12000404,0x10002404,0x12002404,
         0x10200404,0x12200404,0x10202404,0x12202404 );
  this.skb[2]=new Array(
         0x00000000,0x00000001,0x00040000,0x00040001,
         0x01000000,0x01000001,0x01040000,0x01040001,
         0x00000002,0x00000003,0x00040002,0x00040003,
         0x01000002,0x01000003,0x01040002,0x01040003,
         0x00000200,0x00000201,0x00040200,0x00040201,
         0x01000200,0x01000201,0x01040200,0x01040201,
         0x00000202,0x00000203,0x00040202,0x00040203,
         0x01000202,0x01000203,0x01040202,0x01040203,
         0x08000000,0x08000001,0x08040000,0x08040001,
         0x09000000,0x09000001,0x09040000,0x09040001,
         0x08000002,0x08000003,0x08040002,0x08040003,
         0x09000002,0x09000003,0x09040002,0x09040003,
         0x08000200,0x08000201,0x08040200,0x08040201,
         0x09000200,0x09000201,0x09040200,0x09040201,
         0x08000202,0x08000203,0x08040202,0x08040203,
         0x09000202,0x09000203,0x09040202,0x09040203 );
  this.skb[3]=new Array(
         0x00000000,0x00100000,0x00000100,0x00100100,
         0x00000008,0x00100008,0x00000108,0x00100108,
         0x00001000,0x00101000,0x00001100,0x00101100,
         0x00001008,0x00101008,0x00001108,0x00101108,
         0x04000000,0x04100000,0x04000100,0x04100100,
         0x04000008,0x04100008,0x04000108,0x04100108,
         0x04001000,0x04101000,0x04001100,0x04101100,
         0x04001008,0x04101008,0x04001108,0x04101108,
         0x00020000,0x00120000,0x00020100,0x00120100,
         0x00020008,0x00120008,0x00020108,0x00120108,
         0x00021000,0x00121000,0x00021100,0x00121100,
         0x00021008,0x00121008,0x00021108,0x00121108,
         0x04020000,0x04120000,0x04020100,0x04120100,
         0x04020008,0x04120008,0x04020108,0x04120108,
         0x04021000,0x04121000,0x04021100,0x04121100,
         0x04021008,0x04121008,0x04021108,0x04121108 );
  this.skb[4]=new Array(
         0x00000000,0x10000000,0x00010000,0x10010000,
         0x00000004,0x10000004,0x00010004,0x10010004,
         0x20000000,0x30000000,0x20010000,0x30010000,
         0x20000004,0x30000004,0x20010004,0x30010004,
         0x00100000,0x10100000,0x00110000,0x10110000,
         0x00100004,0x10100004,0x00110004,0x10110004,
         0x20100000,0x30100000,0x20110000,0x30110000,
         0x20100004,0x30100004,0x20110004,0x30110004,
         0x00001000,0x10001000,0x00011000,0x10011000,
         0x00001004,0x10001004,0x00011004,0x10011004,
         0x20001000,0x30001000,0x20011000,0x30011000,
         0x20001004,0x30001004,0x20011004,0x30011004,
         0x00101000,0x10101000,0x00111000,0x10111000,
         0x00101004,0x10101004,0x00111004,0x10111004,
         0x20101000,0x30101000,0x20111000,0x30111000,
         0x20101004,0x30101004,0x20111004,0x30111004 );
  this.skb[5]=new Array(
         0x00000000,0x08000000,0x00000008,0x08000008,
         0x00000400,0x08000400,0x00000408,0x08000408,
         0x00020000,0x08020000,0x00020008,0x08020008,
         0x00020400,0x08020400,0x00020408,0x08020408,
         0x00000001,0x08000001,0x00000009,0x08000009,
         0x00000401,0x08000401,0x00000409,0x08000409,
         0x00020001,0x08020001,0x00020009,0x08020009,
         0x00020401,0x08020401,0x00020409,0x08020409,
         0x02000000,0x0A000000,0x02000008,0x0A000008,
         0x02000400,0x0A000400,0x02000408,0x0A000408,
         0x02020000,0x0A020000,0x02020008,0x0A020008,
         0x02020400,0x0A020400,0x02020408,0x0A020408,
         0x02000001,0x0A000001,0x02000009,0x0A000009,
         0x02000401,0x0A000401,0x02000409,0x0A000409,
         0x02020001,0x0A020001,0x02020009,0x0A020009,
         0x02020401,0x0A020401,0x02020409,0x0A020409 );
  this.skb[6]=new Array(
         0x00000000,0x00000100,0x00080000,0x00080100,
         0x01000000,0x01000100,0x01080000,0x01080100,
         0x00000010,0x00000110,0x00080010,0x00080110,
         0x01000010,0x01000110,0x01080010,0x01080110,
         0x00200000,0x00200100,0x00280000,0x00280100,
         0x01200000,0x01200100,0x01280000,0x01280100,
         0x00200010,0x00200110,0x00280010,0x00280110,
         0x01200010,0x01200110,0x01280010,0x01280110,
         0x00000200,0x00000300,0x00080200,0x00080300,
         0x01000200,0x01000300,0x01080200,0x01080300,
         0x00000210,0x00000310,0x00080210,0x00080310,
         0x01000210,0x01000310,0x01080210,0x01080310,
         0x00200200,0x00200300,0x00280200,0x00280300,
         0x01200200,0x01200300,0x01280200,0x01280300,
         0x00200210,0x00200310,0x00280210,0x00280310,
         0x01200210,0x01200310,0x01280210,0x01280310 );
  this.skb[7]=new Array(
         0x00000000,0x04000000,0x00040000,0x04040000,
         0x00000002,0x04000002,0x00040002,0x04040002,
         0x00002000,0x04002000,0x00042000,0x04042000,
         0x00002002,0x04002002,0x00042002,0x04042002,
         0x00000020,0x04000020,0x00040020,0x04040020,
         0x00000022,0x04000022,0x00040022,0x04040022,
         0x00002020,0x04002020,0x00042020,0x04042020,
         0x00002022,0x04002022,0x00042022,0x04042022,
         0x00000800,0x04000800,0x00040800,0x04040800,
         0x00000802,0x04000802,0x00040802,0x04040802,
         0x00002800,0x04002800,0x00042800,0x04042800,
         0x00002802,0x04002802,0x00042802,0x04042802,
         0x00000820,0x04000820,0x00040820,0x04040820,
         0x00000822,0x04000822,0x00040822,0x04040822,
         0x00002820,0x04002820,0x00042820,0x04042820,
         0x00002822,0x04002822,0x00042822,0x04042822 );
this.SPtrans=new Array(0,0,0,0,0,0,0,0);
  this.SPtrans[0]=new Array(
         0x00820200,0x00020000,0x80800000,0x80820200,
         0x00800000,0x80020200,0x80020000,0x80800000,
         0x80020200,0x00820200,0x00820000,0x80000200,
         0x80800200,0x00800000,0x00000000,0x80020000,
         0x00020000,0x80000000,0x00800200,0x00020200,
         0x80820200,0x00820000,0x80000200,0x00800200,
         0x80000000,0x00000200,0x00020200,0x80820000,
         0x00000200,0x80800200,0x80820000,0x00000000,
         0x00000000,0x80820200,0x00800200,0x80020000,
         0x00820200,0x00020000,0x80000200,0x00800200,
         0x80820000,0x00000200,0x00020200,0x80800000,
         0x80020200,0x80000000,0x80800000,0x00820000,
         0x80820200,0x00020200,0x00820000,0x80800200,
         0x00800000,0x80000200,0x80020000,0x00000000,
         0x00020000,0x00800000,0x80800200,0x00820200,
         0x80000000,0x80820000,0x00000200,0x80020200 );
  this.SPtrans[1]=new Array(
         0x10042004,0x00000000,0x00042000,0x10040000,
         0x10000004,0x00002004,0x10002000,0x00042000,
         0x00002000,0x10040004,0x00000004,0x10002000,
         0x00040004,0x10042000,0x10040000,0x00000004,
         0x00040000,0x10002004,0x10040004,0x00002000,
         0x00042004,0x10000000,0x00000000,0x00040004,
         0x10002004,0x00042004,0x10042000,0x10000004,
         0x10000000,0x00040000,0x00002004,0x10042004,
         0x00040004,0x10042000,0x10002000,0x00042004,
         0x10042004,0x00040004,0x10000004,0x00000000,
         0x10000000,0x00002004,0x00040000,0x10040004,
         0x00002000,0x10000000,0x00042004,0x10002004,
         0x10042000,0x00002000,0x00000000,0x10000004,
         0x00000004,0x10042004,0x00042000,0x10040000,
         0x10040004,0x00040000,0x00002004,0x10002000,
         0x10002004,0x00000004,0x10040000,0x00042000 );
  this.SPtrans[2]=new Array(
         0x41000000,0x01010040,0x00000040,0x41000040,
         0x40010000,0x01000000,0x41000040,0x00010040,
         0x01000040,0x00010000,0x01010000,0x40000000,
         0x41010040,0x40000040,0x40000000,0x41010000,
         0x00000000,0x40010000,0x01010040,0x00000040,
         0x40000040,0x41010040,0x00010000,0x41000000,
         0x41010000,0x01000040,0x40010040,0x01010000,
         0x00010040,0x00000000,0x01000000,0x40010040,
         0x01010040,0x00000040,0x40000000,0x00010000,
         0x40000040,0x40010000,0x01010000,0x41000040,
         0x00000000,0x01010040,0x00010040,0x41010000,
         0x40010000,0x01000000,0x41010040,0x40000000,
         0x40010040,0x41000000,0x01000000,0x41010040,
         0x00010000,0x01000040,0x41000040,0x00010040,
         0x01000040,0x00000000,0x41010000,0x40000040,
         0x41000000,0x40010040,0x00000040,0x01010000 );
  this.SPtrans[3]=new Array(
         0x00100402,0x04000400,0x00000002,0x04100402,
         0x00000000,0x04100000,0x04000402,0x00100002,
         0x04100400,0x04000002,0x04000000,0x00000402,
         0x04000002,0x00100402,0x00100000,0x04000000,
         0x04100002,0x00100400,0x00000400,0x00000002,
         0x00100400,0x04000402,0x04100000,0x00000400,
         0x00000402,0x00000000,0x00100002,0x04100400,
         0x04000400,0x04100002,0x04100402,0x00100000,
         0x04100002,0x00000402,0x00100000,0x04000002,
         0x00100400,0x04000400,0x00000002,0x04100000,
         0x04000402,0x00000000,0x00000400,0x00100002,
         0x00000000,0x04100002,0x04100400,0x00000400,
         0x04000000,0x04100402,0x00100402,0x00100000,
         0x04100402,0x00000002,0x04000400,0x00100402,
         0x00100002,0x00100400,0x04100000,0x04000402,
         0x00000402,0x04000000,0x04000002,0x04100400 );
  this.SPtrans[4]=new Array(
         0x02000000,0x00004000,0x00000100,0x02004108,
         0x02004008,0x02000100,0x00004108,0x02004000,
         0x00004000,0x00000008,0x02000008,0x00004100,
         0x02000108,0x02004008,0x02004100,0x00000000,
         0x00004100,0x02000000,0x00004008,0x00000108,
         0x02000100,0x00004108,0x00000000,0x02000008,
         0x00000008,0x02000108,0x02004108,0x00004008,
         0x02004000,0x00000100,0x00000108,0x02004100,
         0x02004100,0x02000108,0x00004008,0x02004000,
         0x00004000,0x00000008,0x02000008,0x02000100,
         0x02000000,0x00004100,0x02004108,0x00000000,
         0x00004108,0x02000000,0x00000100,0x00004008,
         0x02000108,0x00000100,0x00000000,0x02004108,
         0x02004008,0x02004100,0x00000108,0x00004000,
         0x00004100,0x02004008,0x02000100,0x00000108,
         0x00000008,0x00004108,0x02004000,0x02000008 );

  this.SPtrans[5]=new Array(
         0x20000010,0x00080010,0x00000000,0x20080800,
         0x00080010,0x00000800,0x20000810,0x00080000,
         0x00000810,0x20080810,0x00080800,0x20000000,
         0x20000800,0x20000010,0x20080000,0x00080810,
         0x00080000,0x20000810,0x20080010,0x00000000,
         0x00000800,0x00000010,0x20080800,0x20080010,
         0x20080810,0x20080000,0x20000000,0x00000810,
         0x00000010,0x00080800,0x00080810,0x20000800,
         0x00000810,0x20000000,0x20000800,0x00080810,
         0x20080800,0x00080010,0x00000000,0x20000800,
         0x20000000,0x00000800,0x20080010,0x00080000,
         0x00080010,0x20080810,0x00080800,0x00000010,
         0x20080810,0x00080800,0x00080000,0x20000810,
         0x20000010,0x20080000,0x00080810,0x00000000,
         0x00000800,0x20000010,0x20000810,0x20080800,
         0x20080000,0x00000810,0x00000010,0x20080010 );
  this.SPtrans[6]=new Array(
         0x00001000,0x00000080,0x00400080,0x00400001,
         0x00401081,0x00001001,0x00001080,0x00000000,
         0x00400000,0x00400081,0x00000081,0x00401000,
         0x00000001,0x00401080,0x00401000,0x00000081,
         0x00400081,0x00001000,0x00001001,0x00401081,
         0x00000000,0x00400080,0x00400001,0x00001080,
         0x00401001,0x00001081,0x00401080,0x00000001,
         0x00001081,0x00401001,0x00000080,0x00400000,
         0x00001081,0x00401000,0x00401001,0x00000081,
         0x00001000,0x00000080,0x00400000,0x00401001,
         0x00400081,0x00001081,0x00001080,0x00000000,
         0x00000080,0x00400001,0x00000001,0x00400080,
         0x00000000,0x00400081,0x00400080,0x00001080,
         0x00000081,0x00001000,0x00401081,0x00400000,
         0x00401080,0x00000001,0x00001001,0x00401081,
         0x00400001,0x00401080,0x00401000,0x00001001 );
  this.SPtrans[7]=new Array(
         0x08200020,0x08208000,0x00008020,0x00000000,
         0x08008000,0x00200020,0x08200000,0x08208020,
         0x00000020,0x08000000,0x00208000,0x00008020,
         0x00208020,0x08008020,0x08000020,0x08200000,
         0x00008000,0x00208020,0x00200020,0x08008000,
         0x08208020,0x08000020,0x00000000,0x00208000,
         0x08000000,0x00200000,0x08008020,0x08200020,
         0x00200000,0x00008000,0x08208000,0x00000020,
         0x00200000,0x00008000,0x08000020,0x08208020,
         0x00008020,0x08000000,0x00000000,0x00208000,
         0x08200020,0x08008020,0x08008000,0x00200020,
         0x08208000,0x00000020,0x00200020,0x08008000,
         0x08208020,0x00200000,0x08200000,0x08000020,
         0x00208000,0x00008020,0x08008020,0x08200000,
         0x00000020,0x08208000,0x00208020,0x00000000,
         0x08000000,0x08200020,0x00008000,0x00208020 );
this.cov_2char=new Array(
      0x2E,0x2F,0x30,0x31,0x32,0x33,0x34,0x35,
      0x36,0x37,0x38,0x39,0x41,0x42,0x43,0x44,
      0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,
      0x4D,0x4E,0x4F,0x50,0x51,0x52,0x53,0x54,
      0x55,0x56,0x57,0x58,0x59,0x5A,0x61,0x62,
      0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,
      0x6B,0x6C,0x6D,0x6E,0x6F,0x70,0x71,0x72,
      0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A );
this.byteToUnsigned=bTU;
this.fourBytesToInt=fBTI;
this.intToFourBytes=iTFB;
this.PERM_OP=P_P;
this.HPERM_OP=H_P;
this.des_set_key=d_s_k;
this.D_ENCRYPT=D_E;
this.body=bdy;
this.randChar=rC;
this.crypt=cript;
this.displayPassword=dP;
}
Javacrypt=new Crypt();

    </script>
  </head>
  <body>
    <form name="CRYPT">
      <strong>Text: </strong><input type="text" name="PW">
      <input type="button" value="Encrypt" onClick="Javacrypt.displayPassword()"><br>
      <strong>Encrypted: </strong><input type="text" name="ENC_PW"><br>
      <strong>Salt: </strong><input type="text" name="Salt">
    </form>
    <br>
    <b>NOTE</b>: If you do not enter a salt, one will be randomly generated.
  </body>
</html>
Posted by 1010
반응형
<html>
  <head>
    <!--
      CryptoMX Tools
      Copyright (C) 2004 - 2006 Derek Buitenhuis

      This program is free software; you can redistribute it and/or
      modify it under the terms of the GNU General Public License
      as published by the Free Software Foundation; either version 2
      of the License, or (at your option) any later version.

      This program is distributed in the hope that it will be useful,
      but WITHOUT ANY WARRANTY; without even the implied warranty of
      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      GNU General Public License for more details.

      You should have received a copy of the GNU General Public License
      along with this program; if not, write to the Free Software
      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
    -->
    <title>SHA-1 Crypt</title>
  </head>
  <body>
      <!-- sha1.js -->
    <script language="JavaScript">
/*
 * A JavaScript implementation of the Secure Hash Algorithm, SHA-1, as defined
 * in FIPS PUB 180-1
 * Version 2.1 Copyright Paul Johnston 2000 - 2002.
 * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
 * Distributed under the BSD License
 * See http://pajhome.org.uk/crypt/md5 for details.
 */

var hexcase = 0;
var b64pad  = "";
var chrsz   = 8;

function hex_sha1(s){return binb2hex(core_sha1(str2binb(s),s.length * chrsz));}
function b64_sha1(s){return binb2b64(core_sha1(str2binb(s),s.length * chrsz));}
function str_sha1(s){return binb2str(core_sha1(str2binb(s),s.length * chrsz));}
function hex_hmac_sha1(key, data){ return binb2hex(core_hmac_sha1(key, data));}
function b64_hmac_sha1(key, data){ return binb2b64(core_hmac_sha1(key, data));}
function str_hmac_sha1(key, data){ return binb2str(core_hmac_sha1(key, data));}

function sha1_vm_test()
{
  return hex_sha1("abc") == "a9993e364706816aba3e25717850c26c9cd0d89d";
}

function core_sha1(x, len)
{
  x[len >> 5] |= 0x80 << (24 - len % 32);
  x[((len + 64 >> 9) << 4) + 15] = len;

  var w = Array(80);
  var a =  1732584193;
  var b = -271733879;
  var c = -1732584194;
  var d =  271733878;
  var e = -1009589776;

  for(var i = 0; i < x.length; i += 16)
  {
    var olda = a;
    var oldb = b;
    var oldc = c;
    var oldd = d;
    var olde = e;

    for(var j = 0; j < 80; j++)
    {
      if(j < 16) w[j] = x[i + j];
      else w[j] = rol(w[j-3] ^ w[j-8] ^ w[j-14] ^ w[j-16], 1);
      var t = safe_add(safe_add(rol(a, 5), sha1_ft(j, b, c, d)),
                       safe_add(safe_add(e, w[j]), sha1_kt(j)));
      e = d;
      d = c;
      c = rol(b, 30);
      b = a;
      a = t;
    }

    a = safe_add(a, olda);
    b = safe_add(b, oldb);
    c = safe_add(c, oldc);
    d = safe_add(d, oldd);
    e = safe_add(e, olde);
  }
  return Array(a, b, c, d, e);
 
}

function sha1_ft(t, b, c, d)
{
  if(t < 20) return (b & c) | ((~b) & d);
  if(t < 40) return b ^ c ^ d;
  if(t < 60) return (b & c) | (b & d) | (c & d);
  return b ^ c ^ d;
}

function sha1_kt(t)
{
  return (t < 20) ?  1518500249 : (t < 40) ?  1859775393 :
         (t < 60) ? -1894007588 : -899497514;
}  

function core_hmac_sha1(key, data)
{
  var bkey = str2binb(key);
  if(bkey.length > 16) bkey = core_sha1(bkey, key.length * chrsz);

  var ipad = Array(16), opad = Array(16);
  for(var i = 0; i < 16; i++)
  {
    ipad[i] = bkey[i] ^ 0x36363636;
    opad[i] = bkey[i] ^ 0x5C5C5C5C;
  }

  var hash = core_sha1(ipad.concat(str2binb(data)), 512 + data.length * chrsz);
  return core_sha1(opad.concat(hash), 512 + 160);
}

function safe_add(x, y)
{
  var lsw = (x & 0xFFFF) + (y & 0xFFFF);
  var msw = (x >> 16) + (y >> 16) + (lsw >> 16);
  return (msw << 16) | (lsw & 0xFFFF);
}

function rol(num, cnt)
{
  return (num << cnt) | (num >>> (32 - cnt));
}

function str2binb(str)
{
  var bin = Array();
  var mask = (1 << chrsz) - 1;
  for(var i = 0; i < str.length * chrsz; i += chrsz)
    bin[i>>5] |= (str.charCodeAt(i / chrsz) & mask) << (24 - i%32);
  return bin;
}

function binb2str(bin)
{
  var str = "";
  var mask = (1 << chrsz) - 1;
  for(var i = 0; i < bin.length * 32; i += chrsz)
    str += String.fromCharCode((bin[i>>5] >>> (24 - i%32)) & mask);
  return str;
}

function binb2hex(binarray)
{
  var hex_tab = hexcase ? "0123456789ABCDEF" : "0123456789abcdef";
  var str = "";
  for(var i = 0; i < binarray.length * 4; i++)
  {
    str += hex_tab.charAt((binarray[i>>2] >> ((3 - i%4)*8+4)) & 0xF) +
           hex_tab.charAt((binarray[i>>2] >> ((3 - i%4)*8  )) & 0xF);
  }
  return str;
}

function binb2b64(binarray)
{
  var tab = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
  var str = "";
  for(var i = 0; i < binarray.length * 4; i += 3)
  {
    var triplet = (((binarray[i   >> 2] >> 8 * (3 -  i   %4)) & 0xFF) << 16)
                | (((binarray[i+1 >> 2] >> 8 * (3 - (i+1)%4)) & 0xFF) << 8 )
                |  ((binarray[i+2 >> 2] >> 8 * (3 - (i+2)%4)) & 0xFF);
    for(var j = 0; j < 4; j++)
    {
      if(i * 8 + j * 6 > binarray.length * 32) str += b64pad;
      else str += tab.charAt((triplet >> 6*(3-j)) & 0x3F);
    }
  }
  return str;
}

    </script>
    <form>
      <font color=#000000 size=3>Input</font>
      <input type=text name=input size=40><br>
      <font color=#000000 size=3>Result</font>
      <input type=text name=hash size=50><br>
      <input type=button value="SHA-1 It!" onclick="hash.value = hex_sha1(input.value)">
    </form>
  </body>
</html>

Posted by 1010
반응형
<html>
  <head>
    <!--
      CryptoMX Tools
      Copyright (C) 2004 - 2006 Derek Buitenhuis

      This program is free software; you can redistribute it and/or
      modify it under the terms of the GNU General Public License
      as published by the Free Software Foundation; either version 2
      of the License, or (at your option) any later version.

      This program is distributed in the hope that it will be useful,
      but WITHOUT ANY WARRANTY; without even the implied warranty of
      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      GNU General Public License for more details.

      You should have received a copy of the GNU General Public License
      along with this program; if not, write to the Free Software
      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
    -->
    <title>MD5 Hashing</title>
  </head>
  <body>
      <!-- md5.js -->
    <script language="JavaScript">
/*
 * A JavaScript implementation of the RSA Data Security, Inc. MD5 Message
 * Digest Algorithm, as defined in RFC 1321.
 * Version 2.1 Copyright (C) Paul Johnston 1999 - 2002.
 * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
 * Distributed under the BSD License
 * See http://pajhome.org.uk/crypt/md5 for more info.
 */

var hexcase = 0;
var b64pad  = "";
var chrsz   = 8;

function hex_md5(s){ return binl2hex(core_md5(str2binl(s), s.length * chrsz));}
function b64_md5(s){ return binl2b64(core_md5(str2binl(s), s.length * chrsz));}
function str_md5(s){ return binl2str(core_md5(str2binl(s), s.length * chrsz));}
function hex_hmac_md5(key, data) { return binl2hex(core_hmac_md5(key, data)); }
function b64_hmac_md5(key, data) { return binl2b64(core_hmac_md5(key, data)); }
function str_hmac_md5(key, data) { return binl2str(core_hmac_md5(key, data)); }

function md5_vm_test()
{
  return hex_md5("abc") == "900150983cd24fb0d6963f7d28e17f72";
}

function core_md5(x, len)
{
  x[len >> 5] |= 0x80 << ((len) % 32);
  x[(((len + 64) >>> 9) << 4) + 14] = len;

  var a =  1732584193;
  var b = -271733879;
  var c = -1732584194;
  var d =  271733878;

  for(var i = 0; i < x.length; i += 16)
  {
    var olda = a;
    var oldb = b;
    var oldc = c;
    var oldd = d;

    a = md5_ff(a, b, c, d, x[i+ 0], 7 , -680876936);
    d = md5_ff(d, a, b, c, x[i+ 1], 12, -389564586);
    c = md5_ff(c, d, a, b, x[i+ 2], 17,  606105819);
    b = md5_ff(b, c, d, a, x[i+ 3], 22, -1044525330);
    a = md5_ff(a, b, c, d, x[i+ 4], 7 , -176418897);
    d = md5_ff(d, a, b, c, x[i+ 5], 12,  1200080426);
    c = md5_ff(c, d, a, b, x[i+ 6], 17, -1473231341);
    b = md5_ff(b, c, d, a, x[i+ 7], 22, -45705983);
    a = md5_ff(a, b, c, d, x[i+ 8], 7 ,  1770035416);
    d = md5_ff(d, a, b, c, x[i+ 9], 12, -1958414417);
    c = md5_ff(c, d, a, b, x[i+10], 17, -42063);
    b = md5_ff(b, c, d, a, x[i+11], 22, -1990404162);
    a = md5_ff(a, b, c, d, x[i+12], 7 ,  1804603682);
    d = md5_ff(d, a, b, c, x[i+13], 12, -40341101);
    c = md5_ff(c, d, a, b, x[i+14], 17, -1502002290);
    b = md5_ff(b, c, d, a, x[i+15], 22,  1236535329);

    a = md5_gg(a, b, c, d, x[i+ 1], 5 , -165796510);
    d = md5_gg(d, a, b, c, x[i+ 6], 9 , -1069501632);
    c = md5_gg(c, d, a, b, x[i+11], 14,  643717713);
    b = md5_gg(b, c, d, a, x[i+ 0], 20, -373897302);
    a = md5_gg(a, b, c, d, x[i+ 5], 5 , -701558691);
    d = md5_gg(d, a, b, c, x[i+10], 9 ,  38016083);
    c = md5_gg(c, d, a, b, x[i+15], 14, -660478335);
    b = md5_gg(b, c, d, a, x[i+ 4], 20, -405537848);
    a = md5_gg(a, b, c, d, x[i+ 9], 5 ,  568446438);
    d = md5_gg(d, a, b, c, x[i+14], 9 , -1019803690);
    c = md5_gg(c, d, a, b, x[i+ 3], 14, -187363961);
    b = md5_gg(b, c, d, a, x[i+ 8], 20,  1163531501);
    a = md5_gg(a, b, c, d, x[i+13], 5 , -1444681467);
    d = md5_gg(d, a, b, c, x[i+ 2], 9 , -51403784);
    c = md5_gg(c, d, a, b, x[i+ 7], 14,  1735328473);
    b = md5_gg(b, c, d, a, x[i+12], 20, -1926607734);

    a = md5_hh(a, b, c, d, x[i+ 5], 4 , -378558);
    d = md5_hh(d, a, b, c, x[i+ 8], 11, -2022574463);
    c = md5_hh(c, d, a, b, x[i+11], 16,  1839030562);
    b = md5_hh(b, c, d, a, x[i+14], 23, -35309556);
    a = md5_hh(a, b, c, d, x[i+ 1], 4 , -1530992060);
    d = md5_hh(d, a, b, c, x[i+ 4], 11,  1272893353);
    c = md5_hh(c, d, a, b, x[i+ 7], 16, -155497632);
    b = md5_hh(b, c, d, a, x[i+10], 23, -1094730640);
    a = md5_hh(a, b, c, d, x[i+13], 4 ,  681279174);
    d = md5_hh(d, a, b, c, x[i+ 0], 11, -358537222);
    c = md5_hh(c, d, a, b, x[i+ 3], 16, -722521979);
    b = md5_hh(b, c, d, a, x[i+ 6], 23,  76029189);
    a = md5_hh(a, b, c, d, x[i+ 9], 4 , -640364487);
    d = md5_hh(d, a, b, c, x[i+12], 11, -421815835);
    c = md5_hh(c, d, a, b, x[i+15], 16,  530742520);
    b = md5_hh(b, c, d, a, x[i+ 2], 23, -995338651);

    a = md5_ii(a, b, c, d, x[i+ 0], 6 , -198630844);
    d = md5_ii(d, a, b, c, x[i+ 7], 10,  1126891415);
    c = md5_ii(c, d, a, b, x[i+14], 15, -1416354905);
    b = md5_ii(b, c, d, a, x[i+ 5], 21, -57434055);
    a = md5_ii(a, b, c, d, x[i+12], 6 ,  1700485571);
    d = md5_ii(d, a, b, c, x[i+ 3], 10, -1894986606);
    c = md5_ii(c, d, a, b, x[i+10], 15, -1051523);
    b = md5_ii(b, c, d, a, x[i+ 1], 21, -2054922799);
    a = md5_ii(a, b, c, d, x[i+ 8], 6 ,  1873313359);
    d = md5_ii(d, a, b, c, x[i+15], 10, -30611744);
    c = md5_ii(c, d, a, b, x[i+ 6], 15, -1560198380);
    b = md5_ii(b, c, d, a, x[i+13], 21,  1309151649);
    a = md5_ii(a, b, c, d, x[i+ 4], 6 , -145523070);
    d = md5_ii(d, a, b, c, x[i+11], 10, -1120210379);
    c = md5_ii(c, d, a, b, x[i+ 2], 15,  718787259);
    b = md5_ii(b, c, d, a, x[i+ 9], 21, -343485551);

    a = safe_add(a, olda);
    b = safe_add(b, oldb);
    c = safe_add(c, oldc);
    d = safe_add(d, oldd);
  }
  return Array(a, b, c, d);

}

function md5_cmn(q, a, b, x, s, t)
{
  return safe_add(bit_rol(safe_add(safe_add(a, q), safe_add(x, t)), s),b);
}
function md5_ff(a, b, c, d, x, s, t)
{
  return md5_cmn((b & c) | ((~b) & d), a, b, x, s, t);
}
function md5_gg(a, b, c, d, x, s, t)
{
  return md5_cmn((b & d) | (c & (~d)), a, b, x, s, t);
}
function md5_hh(a, b, c, d, x, s, t)
{
  return md5_cmn(b ^ c ^ d, a, b, x, s, t);
}
function md5_ii(a, b, c, d, x, s, t)
{
  return md5_cmn(c ^ (b | (~d)), a, b, x, s, t);
}

function core_hmac_md5(key, data)
{
  var bkey = str2binl(key);
  if(bkey.length > 16) bkey = core_md5(bkey, key.length * chrsz);

  var ipad = Array(16), opad = Array(16);
  for(var i = 0; i < 16; i++)
  {
    ipad[i] = bkey[i] ^ 0x36363636;
    opad[i] = bkey[i] ^ 0x5C5C5C5C;
  }

  var hash = core_md5(ipad.concat(str2binl(data)), 512 + data.length * chrsz);
  return core_md5(opad.concat(hash), 512 + 128);
}

function safe_add(x, y)
{
  var lsw = (x & 0xFFFF) + (y & 0xFFFF);
  var msw = (x >> 16) + (y >> 16) + (lsw >> 16);
  return (msw << 16) | (lsw & 0xFFFF);
}

function bit_rol(num, cnt)
{
  return (num << cnt) | (num >>> (32 - cnt));
}

function str2binl(str)
{
  var bin = Array();
  var mask = (1 << chrsz) - 1;
  for(var i = 0; i < str.length * chrsz; i += chrsz)
    bin[i>>5] |= (str.charCodeAt(i / chrsz) & mask) << (i%32);
  return bin;
}

function binl2str(bin)
{
  var str = "";
  var mask = (1 << chrsz) - 1;
  for(var i = 0; i < bin.length * 32; i += chrsz)
    str += String.fromCharCode((bin[i>>5] >>> (i % 32)) & mask);
  return str;
}

function binl2hex(binarray)
{
  var hex_tab = hexcase ? "0123456789ABCDEF" : "0123456789abcdef";
  var str = "";
  for(var i = 0; i < binarray.length * 4; i++)
  {
    str += hex_tab.charAt((binarray[i>>2] >> ((i%4)*8+4)) & 0xF) +
           hex_tab.charAt((binarray[i>>2] >> ((i%4)*8  )) & 0xF);
  }
  return str;
}

function binl2b64(binarray)
{
  var tab = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
  var str = "";
  for(var i = 0; i < binarray.length * 4; i += 3)
  {
    var triplet = (((binarray[i   >> 2] >> 8 * ( i   %4)) & 0xFF) << 16)
                | (((binarray[i+1 >> 2] >> 8 * ((i+1)%4)) & 0xFF) << 8 )
                |  ((binarray[i+2 >> 2] >> 8 * ((i+2)%4)) & 0xFF);
    for(var j = 0; j < 4; j++)
    {
      if(i * 8 + j * 6 > binarray.length * 32) str += b64pad;
      else str += tab.charAt((triplet >> 6*(3-j)) & 0x3F);
    }
  }
  return str;
}

    </script>
    <form>
      <font color=#000000 size=3>Input</font>  </td><td > <input type=text name=input size=40><br>
      <font color=#000000 size=3>Result</font> </td><td > <input type=text name=hash size=40><br>
      <input type=button value="MD5 It!" onclick="hash.value = hex_md5(input.value)">
    </form>
  </body>
</html>

Posted by 1010
반응형
<html>
  <head>
    <!--
      CryptoMX Tools
      Copyright (C) 2004 - 2006 Derek Buitenhuis

      This program is free software; you can redistribute it and/or
      modify it under the terms of the GNU General Public License
      as published by the Free Software Foundation; either version 2
      of the License, or (at your option) any later version.

      This program is distributed in the hope that it will be useful,
      but WITHOUT ANY WARRANTY; without even the implied warranty of
      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      GNU General Public License for more details.

      You should have received a copy of the GNU General Public License
      along with this program; if not, write to the Free Software
      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
    -->
    <title>MD4 Hashing</title>
  </head>
  <body>
      <!-- md4.js -->
    <script language="JavaScript">
/*
 * A JavaScript implementation of the RSA Data Security, Inc. MD4 Message
 * Digest Algorithm, as defined in RFC 1320.
 * Version 2.1 Copyright (C) Jerrad Pierce, Paul Johnston 1999 - 2002.
 * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
 * Distributed under the BSD License
 * See http://pajhome.org.uk/crypt/md5 for more info.
 */

var hexcase = 0;
var b64pad  = "";
var chrsz   = 8;

function hex_md4(s){ return binl2hex(core_md4(str2binl(s), s.length * chrsz));}
function b64_md4(s){ return binl2b64(core_md4(str2binl(s), s.length * chrsz));}
function str_md4(s){ return binl2str(core_md4(str2binl(s), s.length * chrsz));}
function hex_hmac_md4(key, data) { return binl2hex(core_hmac_md4(key, data)); }
function b64_hmac_md4(key, data) { return binl2b64(core_hmac_md4(key, data)); }
function str_hmac_md4(key, data) { return binl2str(core_hmac_md4(key, data)); }

function md4_vm_test()
{
  return hex_md4("abc") == "a448017aaf21d8525fc10ae87aa6729d";
}

function core_md4(x, len)
{
  x[len >> 5] |= 0x80 << (len % 32);
  x[(((len + 64) >>> 9) << 4) + 14] = len;
 
  var a =  1732584193;
  var b = -271733879;
  var c = -1732584194;
  var d =  271733878;

  for(var i = 0; i < x.length; i += 16)
  {
    var olda = a;
    var oldb = b;
    var oldc = c;
    var oldd = d;

    a = md4_ff(a, b, c, d, x[i+ 0], 3 );
    d = md4_ff(d, a, b, c, x[i+ 1], 7 );
    c = md4_ff(c, d, a, b, x[i+ 2], 11);
    b = md4_ff(b, c, d, a, x[i+ 3], 19);
    a = md4_ff(a, b, c, d, x[i+ 4], 3 );
    d = md4_ff(d, a, b, c, x[i+ 5], 7 );
    c = md4_ff(c, d, a, b, x[i+ 6], 11);
    b = md4_ff(b, c, d, a, x[i+ 7], 19);
    a = md4_ff(a, b, c, d, x[i+ 8], 3 );
    d = md4_ff(d, a, b, c, x[i+ 9], 7 );
    c = md4_ff(c, d, a, b, x[i+10], 11);
    b = md4_ff(b, c, d, a, x[i+11], 19);
    a = md4_ff(a, b, c, d, x[i+12], 3 );
    d = md4_ff(d, a, b, c, x[i+13], 7 );
    c = md4_ff(c, d, a, b, x[i+14], 11);
    b = md4_ff(b, c, d, a, x[i+15], 19);

    a = md4_gg(a, b, c, d, x[i+ 0], 3 );
    d = md4_gg(d, a, b, c, x[i+ 4], 5 );
    c = md4_gg(c, d, a, b, x[i+ 8], 9 );
    b = md4_gg(b, c, d, a, x[i+12], 13);
    a = md4_gg(a, b, c, d, x[i+ 1], 3 );
    d = md4_gg(d, a, b, c, x[i+ 5], 5 );
    c = md4_gg(c, d, a, b, x[i+ 9], 9 );
    b = md4_gg(b, c, d, a, x[i+13], 13);
    a = md4_gg(a, b, c, d, x[i+ 2], 3 );
    d = md4_gg(d, a, b, c, x[i+ 6], 5 );
    c = md4_gg(c, d, a, b, x[i+10], 9 );
    b = md4_gg(b, c, d, a, x[i+14], 13);
    a = md4_gg(a, b, c, d, x[i+ 3], 3 );
    d = md4_gg(d, a, b, c, x[i+ 7], 5 );
    c = md4_gg(c, d, a, b, x[i+11], 9 );
    b = md4_gg(b, c, d, a, x[i+15], 13);

    a = md4_hh(a, b, c, d, x[i+ 0], 3 );
    d = md4_hh(d, a, b, c, x[i+ 8], 9 );
    c = md4_hh(c, d, a, b, x[i+ 4], 11);
    b = md4_hh(b, c, d, a, x[i+12], 15);
    a = md4_hh(a, b, c, d, x[i+ 2], 3 );
    d = md4_hh(d, a, b, c, x[i+10], 9 );
    c = md4_hh(c, d, a, b, x[i+ 6], 11);
    b = md4_hh(b, c, d, a, x[i+14], 15);
    a = md4_hh(a, b, c, d, x[i+ 1], 3 );
    d = md4_hh(d, a, b, c, x[i+ 9], 9 );
    c = md4_hh(c, d, a, b, x[i+ 5], 11);
    b = md4_hh(b, c, d, a, x[i+13], 15);
    a = md4_hh(a, b, c, d, x[i+ 3], 3 );
    d = md4_hh(d, a, b, c, x[i+11], 9 );
    c = md4_hh(c, d, a, b, x[i+ 7], 11);
    b = md4_hh(b, c, d, a, x[i+15], 15);

    a = safe_add(a, olda);
    b = safe_add(b, oldb);
    c = safe_add(c, oldc);
    d = safe_add(d, oldd);

  }
  return Array(a, b, c, d);

}

function md4_cmn(q, a, b, x, s, t)
{
  return safe_add(rol(safe_add(safe_add(a, q), safe_add(x, t)), s), b);
}
function md4_ff(a, b, c, d, x, s)
{
  return md4_cmn((b & c) | ((~b) & d), a, 0, x, s, 0);
}
function md4_gg(a, b, c, d, x, s)
{
  return md4_cmn((b & c) | (b & d) | (c & d), a, 0, x, s, 1518500249);
}
function md4_hh(a, b, c, d, x, s)
{
  return md4_cmn(b ^ c ^ d, a, 0, x, s, 1859775393);
}

/*
 * Calculate the HMAC-MD4, of a key and some data
 */
function core_hmac_md4(key, data)
{
  var bkey = str2binl(key);
  if(bkey.length > 16) bkey = core_md4(bkey, key.length * chrsz);

  var ipad = Array(16), opad = Array(16);
  for(var i = 0; i < 16; i++)
  {
    ipad[i] = bkey[i] ^ 0x36363636;
    opad[i] = bkey[i] ^ 0x5C5C5C5C;
  }

  var hash = core_md4(ipad.concat(str2binl(data)), 512 + data.length * chrsz);
  return core_md4(opad.concat(hash), 512 + 128);
}

function safe_add(x, y)
{
  var lsw = (x & 0xFFFF) + (y & 0xFFFF);
  var msw = (x >> 16) + (y >> 16) + (lsw >> 16);
  return (msw << 16) | (lsw & 0xFFFF);
}

function rol(num, cnt)
{
  return (num << cnt) | (num >>> (32 - cnt));
}

function str2binl(str)
{
  var bin = Array();
  var mask = (1 << chrsz) - 1;
  for(var i = 0; i < str.length * chrsz; i += chrsz)
    bin[i>>5] |= (str.charCodeAt(i / chrsz) & mask) << (i%32);
  return bin;
}

function binl2str(bin)
{
  var str = "";
  var mask = (1 << chrsz) - 1;
  for(var i = 0; i < bin.length * 32; i += chrsz)
    str += String.fromCharCode((bin[i>>5] >>> (i % 32)) & mask);
  return str;
}

function binl2hex(binarray)
{
  var hex_tab = hexcase ? "0123456789ABCDEF" : "0123456789abcdef";
  var str = "";
  for(var i = 0; i < binarray.length * 4; i++)
  {
    str += hex_tab.charAt((binarray[i>>2] >> ((i%4)*8+4)) & 0xF) +
           hex_tab.charAt((binarray[i>>2] >> ((i%4)*8  )) & 0xF);
  }
  return str;
}

function binl2b64(binarray)
{
  var tab = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
  var str = "";
  for(var i = 0; i < binarray.length * 4; i += 3)
  {
    var triplet = (((binarray[i   >> 2] >> 8 * ( i   %4)) & 0xFF) << 16)
                | (((binarray[i+1 >> 2] >> 8 * ((i+1)%4)) & 0xFF) << 8 )
                |  ((binarray[i+2 >> 2] >> 8 * ((i+2)%4)) & 0xFF);
    for(var j = 0; j < 4; j++)
    {
      if(i * 8 + j * 6 > binarray.length * 32) str += b64pad;
      else str += tab.charAt((triplet >> 6*(3-j)) & 0x3F);
    }
  }
  return str;
}

    </script>
    <form>
      <font color=#000000 size=3>Input</font>  </td><td > <input type=text name=input size=40><br>
      <font color=#000000 size=3>Result</font> </td><td > <input type=text name=hash size=40><br>
      <input type=button value="MD4 It!" onclick="hash.value = hex_md4(input.value)">
    </form>
  </body>
</html>

Posted by 1010
반응형
<html>
  <head>
    <!--
      CryptoMX Tools
      Copyright (C) 2004 - 2006 Derek Buitenhuis

      This program is free software; you can redistribute it and/or
      modify it under the terms of the GNU General Public License
      as published by the Free Software Foundation; either version 2
      of the License, or (at your option) any later version.

      This program is distributed in the hope that it will be useful,
      but WITHOUT ANY WARRANTY; without even the implied warranty of
      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      GNU General Public License for more details.

      You should have received a copy of the GNU General Public License
      along with this program; if not, write to the Free Software
      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
    -->
    <title>ASCII/Binary Converter</title>
  </head>
  <body text="black" link="blue" vlink="blue" alink="red"><br><br>
    <script language="JavaScript1.2">
function dobin(text,sepa) {
var letbin = ""
for (i=0; i<text.length;i++) {

let = text.substr(i,1);
if (i>0) {
var sep = sepa;
if (i % 10 == 0) {
  letbin=letbin+''
}
}
else {
var sep = "";
}

//Ascii -- Binary Code
if (let ==  "A") {letbin = letbin + sep + '01000001'}
if (let ==  "B") {letbin = letbin + sep + '01000010'}
if (let ==  "C") {letbin = letbin + sep + '01000011'}
if (let ==  "D") {letbin = letbin + sep + '01000100'}
if (let ==  "E") {letbin = letbin + sep + '01000101'}
if (let ==  "F") {letbin = letbin + sep + '01000110'}
if (let ==  "G") {letbin = letbin + sep + '01000111'}
if (let ==  "H") {letbin = letbin + sep + '01001000'}
if (let ==  "I") {letbin = letbin + sep + '01001001'}
if (let ==  "J") {letbin = letbin + sep + '01001010'}
if (let ==  "K") {letbin = letbin + sep + '01001011'}
if (let ==  "L") {letbin = letbin + sep + '01001100'}
if (let ==  "M") {letbin = letbin + sep + '01001101'}
if (let ==  "N") {letbin = letbin + sep + '01001110'}
if (let ==  "O") {letbin = letbin + sep + '01001111'}
if (let ==  "P") {letbin = letbin + sep + '01010000'}
if (let ==  "Q") {letbin = letbin + sep + '01010001'}
if (let ==  "R") {letbin = letbin + sep + '01010010'}
if (let ==  "S") {letbin = letbin + sep + '01010011'}
if (let ==  "T") {letbin = letbin + sep + '01010100'}
if (let ==  "U") {letbin = letbin + sep + '01010101'}
if (let ==  "V") {letbin = letbin + sep + '01010110'}
if (let ==  "W") {letbin = letbin + sep + '01010111'}
if (let ==  "X") {letbin = letbin + sep + '01011000'}
if (let ==  "Y") {letbin = letbin + sep + '01011001'}
if (let ==  "Z") {letbin = letbin + sep + '01011010'}
if (let ==  "a") {letbin = letbin + sep + '01100001'}
if (let ==  "b") {letbin = letbin + sep + '01100010'}
if (let ==  "c") {letbin = letbin + sep + '01100011'}
if (let ==  "d") {letbin = letbin + sep + '01100100'}
if (let ==  "e") {letbin = letbin + sep + '01100101'}
if (let ==  "f") {letbin = letbin + sep + '01100110'}
if (let ==  "g") {letbin = letbin + sep + '01100111'}
if (let ==  "h") {letbin = letbin + sep + '01101000'}
if (let ==  "i") {letbin = letbin + sep + '01101001'}
if (let ==  "j") {letbin = letbin + sep + '01101010'}
if (let ==  "k") {letbin = letbin + sep + '01101011'}
if (let ==  "l") {letbin = letbin + sep + '01101100'}
if (let ==  "m") {letbin = letbin + sep + '01101101'}
if (let ==  "n") {letbin = letbin + sep + '01101110'}
if (let ==  "o") {letbin = letbin + sep + '01101111'}
if (let ==  "p") {letbin = letbin + sep + '01110000'}
if (let ==  "q") {letbin = letbin + sep + '01110001'}
if (let ==  "r") {letbin = letbin + sep + '01110010'}
if (let ==  "s") {letbin = letbin + sep + '01110011'}
if (let ==  "t") {letbin = letbin + sep + '01110100'}
if (let ==  "u") {letbin = letbin + sep + '01110101'}
if (let ==  "v") {letbin = letbin + sep + '01110110'}
if (let ==  "w") {letbin = letbin + sep + '01110111'}
if (let ==  "x") {letbin = letbin + sep + '01111000'}
if (let ==  "y") {letbin = letbin + sep + '01111001'}
if (let ==  "z") {letbin = letbin + sep + '01111010'}
if (let ==  " ") {letbin = letbin + sep + '00100000'}

//Numbers:
if (let ==  "0") {letbin = letbin + sep + '00110000'}
if (let ==  "1") {letbin = letbin + sep + '00110001'}
if (let ==  "2") {letbin = letbin + sep + '00110010'}
if (let ==  "3") {letbin = letbin + sep + '00110011'}
if (let ==  "4") {letbin = letbin + sep + '00110100'}
if (let ==  "5") {letbin = letbin + sep + '00110101'}
if (let ==  "6") {letbin = letbin + sep + '00110110'}
if (let ==  "7") {letbin = letbin + sep + '00110111'}
if (let ==  "8") {letbin = letbin + sep + '00111000'}
if (let ==  "9") {letbin = letbin + sep + '00111001'}

//Special Characters:
if (let ==  "!") {letbin = letbin + sep + '00100001'}
if (let ==  "\"") {letbin = letbin + sep + '00100010'}
if (let ==  "#") {letbin = letbin + sep + '00100011'}
if (let ==  "$") {letbin = letbin + sep + '00100100'}
if (let ==  "%") {letbin = letbin + sep + '00100101'}
if (let ==  "&") {letbin = letbin + sep + '00100110'}
if (let ==  "'") {letbin = letbin + sep + '00100111'}
if (let ==  "(") {letbin = letbin + sep + '00101000'}
if (let ==  ")") {letbin = letbin + sep + '00101001'}
if (let ==  "*") {letbin = letbin + sep + '00101001'}
if (let ==  "+") {letbin = letbin + sep + '00101011'}
if (let ==  ",") {letbin = letbin + sep + '00101100'}
if (let ==  "-") {letbin = letbin + sep + '00101101'}
if (let ==  ".") {letbin = letbin + sep + '00101110'}
if (let ==  "/") {letbin = letbin + sep + '00101111'}
if (let ==  ":") {letbin = letbin + sep + '00111010'}
if (let ==  ";") {letbin = letbin + sep + '00111011'}
if (let ==  "<") {letbin = letbin + sep + '00111100'}
if (let ==  "=") {letbin = letbin + sep + '00111101'}
if (let ==  ">") {letbin = letbin + sep + '00111110'}
if (let ==  "?") {letbin = letbin + sep + '00111111'}
if (let ==  "@") {letbin = letbin + sep + '01000000'}
if (let ==  "[") {letbin = letbin + sep + '01011011'}
if (let ==  "\\") {letbin = letbin + sep + '01011100'}
if (let ==  "]") {letbin = letbin + sep + '01011101'}
if (let ==  "^") {letbin = letbin + sep + '01011110'}
if (let ==  "_") {letbin = letbin + sep + '01011111'}
if (let ==  "`") {letbin = letbin + sep + '01100000'}
if (let ==  "{") {letbin = letbin + sep + '01111011'}
if (let ==  "|") {letbin = letbin + sep + '01111100'}
if (let ==  "}") {letbin = letbin + sep + '01111101'}
if (let ==  "~") {letbin = letbin + sep + '01111110'}
if (let ==  "�") {letbin = letbin + sep + '10000000'}
if (let ==  "¡") {letbin = letbin + sep + '10100001'}
if (let ==  "¢") {letbin = letbin + sep + '10100010'}
if (let ==  "£") {letbin = letbin + sep + '10100011'}
if (let ==  "�") {letbin = letbin + sep + '10100100'}
if (let ==  "�") {letbin = letbin + sep + '10100101'}
if (let ==  "�") {letbin = letbin + sep + '10100110'}
if (let ==  "§") {letbin = letbin + sep + '10100111'}
if (let ==  "�") {letbin = letbin + sep + '10100111'}
if (let ==  "�") {letbin = letbin + sep + '10101001'}
if (let ==  "�") {letbin = letbin + sep + '10101010'}
if (let ==  "«") {letbin = letbin + sep + '10101011'}
if (let ==  "�") {letbin = letbin + sep + '10101100'}
if (let ==  "�") {letbin = letbin + sep + '10101101'}
if (let ==  "�") {letbin = letbin + sep + '10101110'}
if (let ==  "�") {letbin = letbin + sep + '10101111'}
if (let ==  "�") {letbin = letbin + sep + '10110000'}
if (let ==  "�") {letbin = letbin + sep + '10110001'}
if (let ==  "�") {letbin = letbin + sep + '10110010'}
if (let ==  "�") {letbin = letbin + sep + '10110011'}
if (let ==  "�") {letbin = letbin + sep + '10110100'}
if (let ==  "�") {letbin = letbin + sep + '10110101'}
if (let ==  "�") {letbin = letbin + sep + '10110110'}
if (let ==  "�") {letbin = letbin + sep + '10110111'}
if (let ==  "�") {letbin = letbin + sep + '10111000'}
if (let ==  "�") {letbin = letbin + sep + '10111001'}
if (let ==  "�") {letbin = letbin + sep + '10111010'}
if (let ==  "»") {letbin = letbin + sep + '10111011'}
if (let ==  "�") {letbin = letbin + sep + '10111100'}
if (let ==  "�") {letbin = letbin + sep + '10111101'}
if (let ==  "�") {letbin = letbin + sep + '10111110'}
if (let ==  "�") {letbin = letbin + sep + '10111111'}
if (let ==  "�") {letbin = letbin + sep + '11000000'}
if (let ==  "�") {letbin = letbin + sep + '11000001'}
if (let ==  "�") {letbin = letbin + sep + '11000010'}
if (let ==  "�") {letbin = letbin + sep + '11000011'}
if (let ==  "Ä") {letbin = letbin + sep + '11000100'}
if (let ==  "Å") {letbin = letbin + sep + '11000101'}
if (let ==  "Æ") {letbin = letbin + sep + '11000110'}
if (let ==  "Ç") {letbin = letbin + sep + '11000111'}
if (let ==  "�") {letbin = letbin + sep + '11001000'}
if (let ==  "�") {letbin = letbin + sep + '11001001'}
if (let ==  "�") {letbin = letbin + sep + '11001010'}
if (let ==  "Ë") {letbin = letbin + sep + '11001011'}
if (let ==  "�") {letbin = letbin + sep + '11001100'}
if (let ==  "�") {letbin = letbin + sep + '11001101'}
if (let ==  "�") {letbin = letbin + sep + '11001110'}
if (let ==  "�") {letbin = letbin + sep + '11001111'}
if (let ==  "�") {letbin = letbin + sep + '11010000'}
if (let ==  "�") {letbin = letbin + sep + '11010001'}
if (let ==  "�") {letbin = letbin + sep + '11010010'}
if (let ==  "�") {letbin = letbin + sep + '11010011'}
if (let ==  "�") {letbin = letbin + sep + '11010100'}
if (let ==  "�") {letbin = letbin + sep + '11010101'}
if (let ==  "Ö") {letbin = letbin + sep + '11010110'}
if (let ==  "�") {letbin = letbin + sep + '11010111'}
if (let ==  "Ø") {letbin = letbin + sep + '11011000'}
if (let ==  "�") {letbin = letbin + sep + '11011001'}
if (let ==  "�") {letbin = letbin + sep + '11011010'}
if (let ==  "�") {letbin = letbin + sep + '11011011'}
if (let ==  "Ü") {letbin = letbin + sep + '11011100'}
if (let ==  "�") {letbin = letbin + sep + '11011101'}
if (let ==  "�") {letbin = letbin + sep + '11011110'}
if (let ==  "ß") {letbin = letbin + sep + '11011111'}
if (let ==  "à") {letbin = letbin + sep + '11100000'}
if (let ==  "á") {letbin = letbin + sep + '11100001'}
if (let ==  "â") {letbin = letbin + sep + '11100010'}
if (let ==  "�") {letbin = letbin + sep + '11100011'}
if (let ==  "ä") {letbin = letbin + sep + '11100100'}
if (let ==  "å") {letbin = letbin + sep + '11100101'}
if (let ==  "æ") {letbin = letbin + sep + '11100110'}
if (let ==  "ç") {letbin = letbin + sep + '11100111'}
if (let ==  "è") {letbin = letbin + sep + '11101000'}
if (let ==  "é") {letbin = letbin + sep + '11101001'}
if (let ==  "ê") {letbin = letbin + sep + '11101010'}
if (let ==  "ë") {letbin = letbin + sep + '11101011'}
if (let ==  "ì") {letbin = letbin + sep + '11101100'}
if (let ==  "í") {letbin = letbin + sep + '11101101'}
if (let ==  "î") {letbin = letbin + sep + '11101110'}
if (let ==  "�") {letbin = letbin + sep + '11101111'}
if (let ==  "�") {letbin = letbin + sep + '11110000'}
if (let ==  "ñ") {letbin = letbin + sep + '11110001'}
if (let ==  "ò") {letbin = letbin + sep + '11110010'}
if (let ==  "ó") {letbin = letbin + sep + '11110011'}
if (let ==  "ô") {letbin = letbin + sep + '11110100'}
if (let ==  "�") {letbin = letbin + sep + '11110101'}
if (let ==  "ö") {letbin = letbin + sep + '11110110'}
if (let ==  "�") {letbin = letbin + sep + '11110111'}
if (let ==  "ø") {letbin = letbin + sep + '11111000'}
if (let ==  "ù") {letbin = letbin + sep + '11111001'}
if (let ==  "ú") {letbin = letbin + sep + '11111010'}
if (let ==  "û") {letbin = letbin + sep + '11111011'}
if (let ==  "û") {letbin = letbin + sep + '11111100'}
if (let ==  "�") {letbin = letbin + sep + '11111101'}
if (let ==  "�") {letbin = letbin + sep + '11111110'}
if (let ==  "�") {letbin = letbin + sep + '11111111'}

}
document.asc2bin.binary.value = letbin
return false;
}

function doasc(text) {

if (text.length % 8 != 0) {
  alert (text + " is not an even binary.\n\nYou may have missed a digit or maybe added an additional digit/character.\n\nSeparaters are NOT required here.")
  return false;
  last;
}
var letasc = ""
lettot = text.length / 8
j=0
for (i=0; i<lettot;i++) {

let = text.substr(j,8);



if (let ==  "01000001") {letasc = letasc + 'A'}
if (let ==  "01000010") {letasc = letasc + 'B'}
if (let ==  "01000011") {letasc = letasc + 'C'}
if (let ==  "01000100") {letasc = letasc + 'D'}
if (let ==  "01000101") {letasc = letasc + 'E'}
if (let ==  "01000110") {letasc = letasc + 'F'}
if (let ==  "01000111") {letasc = letasc + 'G'}
if (let ==  "01001000") {letasc = letasc + 'H'}
if (let ==  "01001001") {letasc = letasc + 'I'}
if (let ==  "01001010") {letasc = letasc + 'J'}
if (let ==  "01001011") {letasc = letasc + 'K'}
if (let ==  "01001100") {letasc = letasc + 'L'}
if (let ==  "01001101") {letasc = letasc + 'M'}
if (let ==  "01001110") {letasc = letasc + 'N'}
if (let ==  "01001111") {letasc = letasc + 'O'}
if (let ==  "01010000") {letasc = letasc + 'P'}
if (let ==  "01010001") {letasc = letasc + 'Q'}
if (let ==  "01010010") {letasc = letasc + 'R'}
if (let ==  "01010011") {letasc = letasc + 'S'}
if (let ==  "01010100") {letasc = letasc + 'T'}
if (let ==  "01010101") {letasc = letasc + 'U'}
if (let ==  "01010110") {letasc = letasc + 'V'}
if (let ==  "01010111") {letasc = letasc + 'W'}
if (let ==  "01011000") {letasc = letasc + 'X'}
if (let ==  "01011001") {letasc = letasc + 'Y'}
if (let ==  "01011010") {letasc = letasc + 'Z'}
if (let ==  "01100001") {letasc = letasc + 'a'}
if (let ==  "01100010") {letasc = letasc + 'b'}
if (let ==  "01100011") {letasc = letasc + 'c'}
if (let ==  "01100100") {letasc = letasc + 'd'}
if (let ==  "01100101") {letasc = letasc + 'e'}
if (let ==  "01100110") {letasc = letasc + 'f'}
if (let ==  "01100111") {letasc = letasc + 'g'}
if (let ==  "01101000") {letasc = letasc + 'h'}
if (let ==  "01101001") {letasc = letasc + 'i'}
if (let ==  "01101010") {letasc = letasc + 'j'}
if (let ==  "01101011") {letasc = letasc + 'k'}
if (let ==  "01101100") {letasc = letasc + 'l'}
if (let ==  "01101101") {letasc = letasc + 'm'}
if (let ==  "01101110") {letasc = letasc + 'n'}
if (let ==  "01101111") {letasc = letasc + 'o'}
if (let ==  "01110000") {letasc = letasc + 'p'}
if (let ==  "01110001") {letasc = letasc + 'q'}
if (let ==  "01110010") {letasc = letasc + 'r'}
if (let ==  "01110011") {letasc = letasc + 's'}
if (let ==  "01110100") {letasc = letasc + 't'}
if (let ==  "01110101") {letasc = letasc + 'u'}
if (let ==  "01110110") {letasc = letasc + 'v'}
if (let ==  "01110111") {letasc = letasc + 'w'}
if (let ==  "01111000") {letasc = letasc + 'x'}
if (let ==  "01111001") {letasc = letasc + 'y'}
if (let ==  "01111010") {letasc = letasc + 'z'}
if (let ==  "00100000") {letasc = letasc + ' '}

//Numbers:
if (let ==  "00110000") {letasc = letasc + '0'}
if (let ==  "00110001") {letasc = letasc + '1'}
if (let ==  "00110010") {letasc = letasc + '2'}
if (let ==  "00110011") {letasc = letasc + '3'}
if (let ==  "00110100") {letasc = letasc + '4'}
if (let ==  "00110101") {letasc = letasc + '5'}
if (let ==  "00110110") {letasc = letasc + '6'}
if (let ==  "00110111") {letasc = letasc + '7'}
if (let ==  "00111000") {letasc = letasc + '8'}
if (let ==  "00111001") {letasc = letasc + '9'}

//Special Characters:
if (let ==  "00100001") {letasc = letasc + '!'}
if (let ==  "00100010") {letasc = letasc + '\"'}
if (let ==  "00100011") {letasc = letasc + '#'}
if (let ==  "00100100") {letasc = letasc + '$'}
if (let ==  "00100101") {letasc = letasc + '%'}
if (let ==  "00100110") {letasc = letasc + '&'}
if (let ==  "00100111") {letasc = letasc + '\''}
if (let ==  "00101000") {letasc = letasc + '('}
if (let ==  "00101001") {letasc = letasc + ')'}
if (let ==  "00101001") {letasc = letasc + '*'}
if (let ==  "00101011") {letasc = letasc + '+'}
if (let ==  "00101100") {letasc = letasc + ','}
if (let ==  "00101101") {letasc = letasc + '-'}
if (let ==  "00101110") {letasc = letasc + '.'}
if (let ==  "00101111") {letasc = letasc + '/'}
if (let ==  "00111010") {letasc = letasc + ':'}
if (let ==  "00111011") {letasc = letasc + ';'}
if (let ==  "00111100") {letasc = letasc + '<'}
if (let ==  "00111101") {letasc = letasc + '='}
if (let ==  "00111110") {letasc = letasc + '>'}
if (let ==  "00111111") {letasc = letasc + '?'}
if (let ==  "01000000") {letasc = letasc + '@'}
if (let ==  "01011011") {letasc = letasc + '['}
if (let ==  "01011100") {letasc = letasc + '\\'}
if (let ==  "01011101") {letasc = letasc + ']'}
if (let ==  "01011110") {letasc = letasc + '^'}
if (let ==  "01011111") {letasc = letasc + '_'}
if (let ==  "01100000") {letasc = letasc + '`'}
if (let ==  "01111011") {letasc = letasc + '{'}
if (let ==  "01111100") {letasc = letasc + '|'}
if (let ==  "01111101") {letasc = letasc + '}'}
if (let ==  "01111110") {letasc = letasc + '~'}
if (let ==  "10000000") {letasc = letasc + '�'}
if (let ==  "10100001") {letasc = letasc + '¡'}
if (let ==  "10100010") {letasc = letasc + '¢'}
if (let ==  "10100011") {letasc = letasc + '£'}
if (let ==  "10100100") {letasc = letasc + '�'}
if (let ==  "10100101") {letasc = letasc + '�'}
if (let ==  "10100110") {letasc = letasc + '�'}
if (let ==  "10100111") {letasc = letasc + '§'}
if (let ==  "10100111") {letasc = letasc + '�'}
if (let ==  "10101001") {letasc = letasc + '�'}
if (let ==  "10101010") {letasc = letasc + '�'}
if (let ==  "10101011") {letasc = letasc + '«'}
if (let ==  "10101100") {letasc = letasc + '�'}
if (let ==  "10101101") {letasc = letasc + '�'}
if (let ==  "10101110") {letasc = letasc + '�'}
if (let ==  "10101111") {letasc = letasc + '�'}
if (let ==  "10110000") {letasc = letasc + '�'}
if (let ==  "10110001") {letasc = letasc + '�'}
if (let ==  "10110010") {letasc = letasc + '�'}
if (let ==  "10110011") {letasc = letasc + '�'}
if (let ==  "10110100") {letasc = letasc + '�'}
if (let ==  "10110101") {letasc = letasc + '�'}
if (let ==  "10110110") {letasc = letasc + '�'}
if (let ==  "10110111") {letasc = letasc + '�'}
if (let ==  "10111000") {letasc = letasc + '�'}
if (let ==  "10111001") {letasc = letasc + '�'}
if (let ==  "10111010") {letasc = letasc + '�'}
if (let ==  "10111011") {letasc = letasc + '»'}
if (let ==  "10111100") {letasc = letasc + '�'}
if (let ==  "10111101") {letasc = letasc + '�'}
if (let ==  "10111110") {letasc = letasc + '�'}
if (let ==  "10111111") {letasc = letasc + '�'}
if (let ==  "11000000") {letasc = letasc + '�'}
if (let ==  "11000001") {letasc = letasc + '�'}
if (let ==  "11000010") {letasc = letasc + '�'}
if (let ==  "11000011") {letasc = letasc + '�'}
if (let ==  "11000100") {letasc = letasc + 'Ä'}
if (let ==  "11000101") {letasc = letasc + 'Å'}
if (let ==  "11000110") {letasc = letasc + 'Æ'}
if (let ==  "11000111") {letasc = letasc + 'Ç'}
if (let ==  "11001000") {letasc = letasc + '�'}
if (let ==  "11001001") {letasc = letasc + '�'}
if (let ==  "11001010") {letasc = letasc + '�'}
if (let ==  "11001011") {letasc = letasc + 'Ë'}
if (let ==  "11001100") {letasc = letasc + '�'}
if (let ==  "11001101") {letasc = letasc + '�'}
if (let ==  "11001110") {letasc = letasc + '�'}
if (let ==  "11001111") {letasc = letasc + '�'}
if (let ==  "11010000") {letasc = letasc + '�'}
if (let ==  "11010001") {letasc = letasc + '�'}
if (let ==  "11010010") {letasc = letasc + '�'}
if (let ==  "11010011") {letasc = letasc + '�'}
if (let ==  "11010100") {letasc = letasc + '�'}
if (let ==  "11010101") {letasc = letasc + '�'}
if (let ==  "11010110") {letasc = letasc + 'Ö'}
if (let ==  "11010111") {letasc = letasc + '�'}
if (let ==  "11011000") {letasc = letasc + 'Ø'}
if (let ==  "11011001") {letasc = letasc + '�'}
if (let ==  "11011010") {letasc = letasc + '�'}
if (let ==  "11011011") {letasc = letasc + '�'}
if (let ==  "11011100") {letasc = letasc + 'Ü'}
if (let ==  "11011101") {letasc = letasc + '�'}
if (let ==  "11011110") {letasc = letasc + '�'}
if (let ==  "11011111") {letasc = letasc + 'ß'}
if (let ==  "11100000") {letasc = letasc + 'à'}
if (let ==  "11100001") {letasc = letasc + 'á'}
if (let ==  "11100010") {letasc = letasc + 'â'}
if (let ==  "11100011") {letasc = letasc + '�'}
if (let ==  "11100100") {letasc = letasc + 'ä'}
if (let ==  "11100101") {letasc = letasc + 'å'}
if (let ==  "11100110") {letasc = letasc + 'æ'}
if (let ==  "11100111") {letasc = letasc + 'ç'}
if (let ==  "11101000") {letasc = letasc + 'è'}
if (let ==  "11101001") {letasc = letasc + 'é'}
if (let ==  "11101010") {letasc = letasc + 'ê'}
if (let ==  "11101011") {letasc = letasc + 'ë'}
if (let ==  "11101100") {letasc = letasc + 'ì'}
if (let ==  "11101101") {letasc = letasc + 'í'}
if (let ==  "11101110") {letasc = letasc + 'î'}
if (let ==  "11101111") {letasc = letasc + '�'}
if (let ==  "11110000") {letasc = letasc + '�'}
if (let ==  "11110001") {letasc = letasc + 'ñ'}
if (let ==  "11110010") {letasc = letasc + 'ò'}
if (let ==  "11110011") {letasc = letasc + 'ó'}
if (let ==  "11110100") {letasc = letasc + 'ô'}
if (let ==  "11110101") {letasc = letasc + '�'}
if (let ==  "11110110") {letasc = letasc + 'ö'}
if (let ==  "11110111") {letasc = letasc + '�'}
if (let ==  "11111000") {letasc = letasc + 'ø'}
if (let ==  "11111001") {letasc = letasc + 'ù'}
if (let ==  "11111010") {letasc = letasc + 'ú'}
if (let ==  "11111011") {letasc = letasc + 'û'}
if (let ==  "11111100") {letasc = letasc + 'û'}
if (let ==  "11111101") {letasc = letasc + '�'}
if (let ==  "11111110") {letasc = letasc + '�'}
if (let ==  "11111111") {letasc = letasc + '�'}
if (letasc == "") {
  alert ("not found")
  break;
}
j=j+8
}
document.bin2asc.ascii.value = letasc
return false;
}
    </script>
    <form name="asc2bin">
      <strong>Convert to Binary</strong><br>
      Enter Text: <input type="Text" name="text" size="92"><br>
      <input type="hidden" name="separater" maxlength="1" size="1">
      <input type="button" value="Convert" onclick="dobin(document.asc2bin.text.value,document.asc2bin.separater.value);">
      <br><br>
      Binary Output: <input type="Text" name="binary" size="90">
    </form>
    <br><br>
    <form name="bin2asc">
      <strong>Convert to Ascii</strong><br>
      Enter Binary: <input type="Text" name="text" size="90"><br>
      <input type="button" value="Convert" onclick="doasc(document.bin2asc.text.value);">
      <br><br>
      ASCII Output: <input type="Text" name="ascii" size="90">
    </form>
    <br><br>
  </body>
</html>
         
Posted by 1010
반응형
<html>
  <head>
    <!--
      CryptoMX Tools
      Copyright (C) 2004 - 2006 Derek Buitenhuis

      This program is free software; you can redistribute it and/or
      modify it under the terms of the GNU General Public License
      as published by the Free Software Foundation; either version 2
      of the License, or (at your option) any later version.

      This program is distributed in the hope that it will be useful,
      but WITHOUT ANY WARRANTY; without even the implied warranty of
      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      GNU General Public License for more details.

      You should have received a copy of the GNU General Public License
      along with this program; if not, write to the Free Software
      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
    -->
    <title>Base64 Encoding/Decoding</title>
  </head>
  <body>
   <script type="text/javascript"><!--

   var keyStr = "ABCDEFGHIJKLMNOP" +
                "QRSTUVWXYZabcdef" +
                "ghijklmnopqrstuv" +
                "wxyz0123456789+/" +
                "=";

   function encode64(input) {
      var output = "";
      var chr1, chr2, chr3 = "";
      var enc1, enc2, enc3, enc4 = "";
      var i = 0;

      do {
         chr1 = input.charCodeAt(i++);
         chr2 = input.charCodeAt(i++);
         chr3 = input.charCodeAt(i++);

         enc1 = chr1 >> 2;
         enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
         enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
         enc4 = chr3 & 63;

         if (isNaN(chr2)) {
            enc3 = enc4 = 64;
         } else if (isNaN(chr3)) {
            enc4 = 64;
         }

         output = output +
            keyStr.charAt(enc1) +
            keyStr.charAt(enc2) +
            keyStr.charAt(enc3) +
            keyStr.charAt(enc4);
         chr1 = chr2 = chr3 = "";
         enc1 = enc2 = enc3 = enc4 = "";
      } while (i < input.length);

      return output;
   }

   function decode64(input) {
      var output = "";
      var chr1, chr2, chr3 = "";
      var enc1, enc2, enc3, enc4 = "";
      var i = 0;

      // remove all characters that are not A-Z, a-z, 0-9, +, /, or =
      var base64test = /[^A-Za-z0-9\+\/\=]/g;
      if (base64test.exec(input)) {
         alert("There were invalid base64 characters in the input text.\n" +
               "Valid base64 characters are A-Z, a-z, 0-9, �+�, �/�, and �=�\n" +
               "Expect errors in decoding.");
      }
      input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");

      do {
         enc1 = keyStr.indexOf(input.charAt(i++));
         enc2 = keyStr.indexOf(input.charAt(i++));
         enc3 = keyStr.indexOf(input.charAt(i++));
         enc4 = keyStr.indexOf(input.charAt(i++));

         chr1 = (enc1 << 2) | (enc2 >> 4);
         chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
         chr3 = ((enc3 & 3) << 6) | enc4;

         output = output + String.fromCharCode(chr1);

         if (enc3 != 64) {
            output = output + String.fromCharCode(chr2);
         }
         if (enc4 != 64) {
            output = output + String.fromCharCode(chr3);
         }

         chr1 = chr2 = chr3 = "";
         enc1 = enc2 = enc3 = enc4 = "";

      } while (i < input.length);

      return output;
   }

   //--></script>
    <form name="base64Form">
      <center>
        Type in the message you want to encode in Base64, or paste<br>
        Base64 encoded text into the text field, select Encode or Decode, <br>
        and click the button! You can use Base64 encoded messages with<br>
        the <a href="stegano.html">Steganography</a> page.<br>
        <br>
        <textarea name="theText" cols="40" rows="6"></textarea><br>
        <input type="button" name="encode" value="Encode to base64"
          onClick="document.base64Form.theText.value=encode64(document.base64Form.theText.value);">
        <input type="button" name="decode" value="Decode from base64"
          onClick="document.base64Form.theText.value=decode64(document.base64Form.theText.value);">
      <center>
    </form>
  </body>
</html>
           

Posted by 1010
반응형
<HTML>
<HEAD>
<TITLE>TextRange.compareEndPoints() Method</TITLE>
<SCRIPT LANGUAGE="JavaScript">
var fixedRange
function setAndShowRangeData() {
    var selectedRange = document.selection.createRange()
    var result1 = fixedRange.compareEndPoints("StartToEnd", selectedRange)
    var result2 = fixedRange.compareEndPoints("StartToStart", selectedRange)
    var result3 = fixedRange.compareEndPoints("EndToStart", selectedRange)
    var result4 = fixedRange.compareEndPoints("EndToEnd", selectedRange)
   
    B1.innerText = result1
    compare1.innerText = getDescription(result1)
    B2.innerText = result2
    compare2.innerText = getDescription(result2)
    B3.innerText = result3
    compare3.innerText = getDescription(result3)
    B4.innerText = result4
    compare4.innerText = getDescription(result4)
}
function getDescription(comparisonValue) {
    switch (comparisonValue) {
        case -1 :
            return "comes before"
            break
        case 0 :
            return "is the same as"
            break
        case 1 :
            return "comes after"
            break
        default :
            return "vs."    
    }
}
function init() {
    fixedRange = document.body.createTextRange()
    fixedRange.moveToElementText(fixedRangeElem)
}
</SCRIPT>
</HEAD>
<BODY onLoad="init()">
<H1>TextRange.compareEndPoints() Method</H1>
<HR>
<P>Select text in the paragraph in various places relative to
the fixed text range (shown in red).</P>
<TABLE ID="results" BORDER=1 >
<TR><TH>Property</TH><TH>Returned Value</TH><TH>Fixed Range vs. Selection</TR>
<TR>
    <TD CLASS="propName">StartToEnd</TD>
    <TD CLASS="count" ID="B1">&nbsp;</TD>
    <TD CLASS="count" ID="C1">Start of Fixed
    <SPAN ID="compare1">vs.</SPAN> End of Selection</TD>
</TR>
<TR>
    <TD CLASS="propName">StartToStart</TD>
    <TD CLASS="count" ID="B2">&nbsp;</TD>

<TD CLASS="count" ID="C2">Start of Fixed
    <SPAN ID="compare2">vs.</SPAN> Start of Selection</TD>
</TR>
<TR>
    <TD CLASS="propName">EndToStart</TD>
    <TD CLASS="count" ID="B3">&nbsp;</TD>
    <TD CLASS="count" ID="C3">End of Fixed
    <SPAN ID="compare3">vs.</SPAN> Start of Selection</TD>
</TR>
<TR>
    <TD CLASS="propName">EndToEnd</TD>
    <TD CLASS="count" ID="B4">&nbsp;</TD>
    <TD CLASS="count" ID="C4">End of Fixed
    <SPAN ID="compare4">vs.</SPAN> End of Selection</TD>
</TR>
</TABLE>
<HR>
<P onMouseUp="setAndShowRangeData()">
Text, Text,Text,Text,Text,Text,Text,Text,Text,Text,<SPAN ID="fixedRangeElem">
Text,Text,Text,Text,Text,Text,Text,Text,</SPAN>,
Text,Text,Text,Text,Text,Text,Text,Text,Text,Text,Text,Text,Text,Text,Text,Text,</P>
</BODY>
</HTML>

Posted by 1010
반응형
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/tr/xhtml1/DTD/xhtml1-transitional.dtd">
<!--
     Example File From "JavaScript and DHTML Cookbook"
     Published by O'Reilly & Associates
     Copyright 2003 Danny Goodman
-->
<html>
<head>
<title>Recipe 14.7</title>
<link rel="stylesheet" id="mainStyle" href="../css/cookbook.css" type="text/css" />
<style type="text/css">
table {table-collapse:collapse; border-spacing:0}
td {border:2px groove black; padding:7px; background-color:#ccffcc}
th {border:2px groove black; padding:7px; background-color:#ffffcc}
.ctr {text-align:center}
</style>
<script type="text/javascript">
// Table data -- an array of objects
var jsData = new Array();
jsData[0] = {location:"Uruguay", year:1930, winner:"Uruguay", winScore:4,
             loser:"Argentina", losScore:2};
jsData[1] = {location:"Italy", year:1934, winner:"Italy", winScore:2,
             loser:"Czechoslovakia", losScore:1};
jsData[2] = {location:"France", year:1938, winner:"Italy", winScore:4,
             loser:"Hungary", losScore:2};
jsData[3] = {location:"Brazil", year:1950, winner:"Uruguay", winScore:2,
             loser:"Brazil", losScore:1};
jsData[4] = {location:"Switzerland", year:1954, winner:"West Germany", winScore:3,
             loser:"Hungary", losScore:2};

// Draw table from 'jsData' array of objects
function drawTable(tbody) {
    var tr, td;
    tbody = document.getElementById(tbody);
    // loop through data source
    for (var i = 0; i < jsData.length; i++) {
        tr = tbody.insertRow(tbody.rows.length);
        td = tr.insertCell(tr.cells.length);
        td.setAttribute("align", "center");
        td.innerHTML = jsData[i].year;
        td = tr.insertCell(tr.cells.length);
        td.innerHTML = jsData[i].location;
        td = tr.insertCell(tr.cells.length);
        td.innerHTML = jsData[i].winner;
        td = tr.insertCell(tr.cells.length);
        td.innerHTML = jsData[i].loser;
        td = tr.insertCell(tr.cells.length);
        td.setAttribute("align", "center");
        td.innerHTML = jsData[i].winScore + " - " + jsData[i].losScore;
    }
}

</script>
</head>
<body onload="drawTable('matchData')">
<h1>Transforming JavaScript Data into HTML Tables</h1>
<hr />

<table id="cupFinals">
<thead>
<tr><th>Year</th>
    <th>Host Country</th>
    <th>Winner</th>
    <th>Loser</th>
    <th>Score (Win - Lose)</th>
</tr>
</thead>
<tbody id="matchData"></tbody>
</table>

</body>
</html>



Posted by 1010
반응형
<head>
<title></title>
</script>
</head>
<body>
<div id="thetable"></div>
<script type = "text/javascript" >
var table = document.createElement("table");
table.border = "1";
var tbody = document.createElement("tbody");

table.appendChild(tbody);
var row = document.createElement("tr");

for (i = 1; i < 3; i++) {
    var row = document.createElement("tr");
    for (j = 1; j < 3; j++) {
        var td = document.createElement("td");
        var data = document.createTextNode("Row " + i + ", Column " + j);
        td.appendChild(data);
        row.appendChild(td);
    }
    tbody.appendChild(row);
}
document.getElementById("thetable").appendChild(table);
</script>
</body>

Posted by 1010
반응형

/*
JavaScript Bible, Fourth Edition
by Danny Goodman

John Wiley & Sons CopyRight 2001
*/

<HTML>
<HEAD>
<TITLE>Modifying Table Cell Content</TITLE>
<STYLE TYPE="text/css">
.absoluteWrap {position:absolute}
.relativeWrap {position:relative}
.total {color:red}
</STYLE>
<SCRIPT LANGUAGE="JavaScript">
var Ver4 = parseInt(navigator.appVersion) == 4
var Ver4Up = parseInt(navigator.appVersion) >= 4
var Nav4 = ((navigator.appName == "Netscape") && Ver4)
var modifiable
// calculate and display a row's total
function showTotal(qtyList) {
    var qty = qtyList.options[qtyList.selectedIndex].value
    var prodID = qtyList.name
    var total = "US$" +
        (qty * parseFloat(qtyList.form.elements[prodID + "Price"].value))
    var newCellHTML = "<SPAN CLASS='total'>" + total + "</SPAN>"
    if(Nav4) {
        document.layers[prodID + "TotalWrapper"].document.layers[prodID + 
            "Total"].document.write(newCellHTML)
        document.layers[prodID + "TotalWrapper"].document.layers[prodID + 
            "Total"].document.close()
    } else if (modifiable) {
        if (document.all) {
            document.all(prodID + "Total").innerHTML = newCellHTML
        } else {
            document.getElementById(prodID + "Total").innerHTML = newCellHTML
        }
    }
}
// initialize global flag for browsers capable of modifiable content
function init() {
    modifiable  = (Ver4Up && document.body && document.body.innerHTML)
}
// display content for all products (e.g., in case of Back navigation)
function showAllTotals(form) {
    for (var i = 0; i < form.elements.length; i++) {
        if (form.elements[i].type == "select-one") {       
            showTotal(form.elements[i])
        }        
    }
}
</SCRIPT>
</HEAD>
<BODY onLoad="init(); showAllTotals(document.orderForm)">
<H1>Modifying Table Cell Content</H1>
<HR>
<FORM NAME="orderForm">
<TABLE BORDER=1>
<COLGROUP WIDTH=150>
<COLGROUP WIDTH=100>
<COLGROUP WIDTH=50>
<COLGROUP WIDTH=100
<TR>
    <TH>Product Description</TH>
    <TH>Price Each</TH>
    <TH>Quantity</TH>
    <TH>Total</TH>
</TR>
<TR>
    <TD>Wonder Widget 9000</TD>
    <TD>US$125.00</TD>
    <TD><SELECT NAME="ww9000" onChange="showTotal(this)">
        <OPTION VALUE="0">0
        <OPTION VALUE="1">1
        <OPTION VALUE="2">2
        <OPTION VALUE="3">3
        </SELECT>
        <INPUT TYPE="hidden" NAME="ww9000Price" VALUE="125.00"></TD>
    <TD>
    <SCRIPT LANGUAGE="JavaScript">
    if (Nav4) {

var placeHolder = "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"
        placeHolder += "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"
        document.write("<SPAN ID='ww9000TotalWrapper' CLASS='relativeWrap'>")
        document.write("<SPAN ID='ww9000Total' CLASS='absoluteWrap'></SPAN>")
        document.write("<SPAN>" + placeHolder + "</SPAN></SPAN>")
    } else {
        document.write("<SPAN ID='ww9000Total' CLASS='relativeWrap'>" +
          "<P>&nbsp;</P></SPAN>")
    }
    </SCRIPT>
    </TD>
</TR>
</TABLE>
</FORM>
</BODY>
</HTML>


Posted by 1010
반응형
<html>
<head>
<script type="text/javascript">
function deleteRow(i){
    document.getElementById('myTable').deleteRow(i)
}
</script>
</head>

<body>
<table id="myTable" border="1">
<tr>
  <td>Row 1</td>
  <td><input type="button" value="Delete" onclick="deleteRow(this.parentNode.parentNode.rowIndex)"></td>
</tr>
<tr>
  <td>Row 2</td>
  <td><input type="button" value="Delete" onclick="deleteRow(this.parentNode.parentNode.rowIndex)"></td>
</tr>
<tr>
  <td>Row 3</td>
  <td><input type="button" value="Delete" onclick="deleteRow(this.parentNode.parentNode.rowIndex)"></td>
</tr>
</table>
</body>

</html>
Posted by 1010
반응형
<html>
<head>
<script type="text/javascript">
function aboveFrames(){
    document.getElementById('myTable').frame="above"
}
function belowFrames(){
    document.getElementById('myTable').frame="below"
}
</script>
</head>

<body>
<table id="myTable">
    <tr>
        <td>a</td>
        <td>b</td>
    </tr>
    <tr>
        <td>c</td>
        <td>d</td>
    </tr>
</table>
<form>
    <input type="button" onclick="aboveFrames()" value="Show above frames">
    <input type="button" onclick="belowFrames()" value="Show below frames">
</form>
</body>
</html>

Posted by 1010
반응형
<HTML>
<HEAD>
<TITLE>Using Properties</TITLE></HEAD>
<BODY>
<H1>Using Properties</H1>
<FORM>
<P><INPUT TYPE="BUTTON" NAME="red" VALUE="Red"
 ONCLICK='document.bgColor="red"'></P>
<P><INPUT TYPE="BUTTON" NAME="white" VALUE="White"
 ONCLICK='document.bgColor="white"'></P>
<P><INPUT TYPE="BUTTON" NAME="blue" VALUE="Blue"
 ONCLICK='document.bgColor="blue"'></P>
</FORM>
</BODY>
</HTML>

Posted by 1010
반응형
<html>
<body>
<button onclick="this.disabled='true'; alert(this.isDisabled);">Disable Me</button>
</body>
</html>

   
Posted by 1010