'Working, Studying, 잡다구리보관소/IT, Science'에 해당되는 글 102건

  1. 2014.09.04 크롬 URL 리스트(Chrome URLs)
  2. 2014.09.04 Selenium에서 파일 다운로드 - 열기선택 팝업
  3. 2014.08.19 크롬 앱중에 분명히 스토어에 있는데 검색이 안되는 앱들은 뭘까....
  4. 2014.06.11 ALM(Application LifeCycle Management) 위한 소프트웨어
  5. 2014.06.05 맥에서 root 패스워드 설정하기
  6. 2014.05.30 VMware VIX API / vmrun 을 이용해서 vmware이미지를 커맨드라인이나 원격으로 제어하기
  7. 2014.05.28 구글 간편 검색기
  8. 2014.05.27 Doxygen 기본 설정법
  9. 2014.05.27 명령어(wevtutil.exe)를 사용하여 윈도우 이벤트 로그 지우는 방법
  10. 2014.05.23 NutchTutorial
  11. 2014.05.20 win-get(windows-get / 윈도우에서 apt-get 대체 프로그램)
  12. 2014.05.20 Python 추천 라이브러리
  13. 2014.05.19 BRUTE FORCE 사전공격 단어리스트
  14. 2014.05.15 HtmlUnit 사용하기
  15. 2014.05.12 Htmlunit 을 이용한 Facebook 로그인, 글 등록 구현
  16. 2014.05.12 Controller 영역인 브라우저에서의 단위테스트를 위한 HtmlUnit 사용하기
  17. 2014.05.02 나눔 웹폰트 적용하기
  18. 2014.04.11 [HTML] href 와 src 의 차이?
  19. 2014.04.09 JSON
  20. 2014.04.07 [펌자료] "웹을 지탱하는 기술" 내용정리
  21. 2014.04.07 x86기반 오픈소스 PC, ‘기즈모스피어’
  22. 2014.03.31 USB 메모리 초기화 방법 윈도우 CMD창 활용
  23. 2014.03.07 작업스케줄러로 UAC(사용자 계정 컨트롤) 예외 프로그램 실행하기
  24. 2014.03.05 [Java] 객체 사용후 null 할당! 해야하나 말아야 하나?
  25. 2014.03.05 배치파일(.bat) 작성팁
  26. 2013.10.14 크롬 시작화면이 바꼈어요!!
  27. 2013.09.10 아이폰 스타일 안드로이드 토글버튼
  28. 2013.06.21 windows에서 airprint 사용하기(모든 프린터)
  29. 2013.04.24 Mac OS X Shortcuts(맥os 단축키)
  30. 2013.01.30 transmission 세팅

List of Chrome URLs



For Debug

The following pages are for debugging purposes only. Because they crash or hang the renderer, they're not linked directly; you can type them into the address bar if you need them.

  • chrome://crash
  • chrome://kill
  • chrome://hang
  • chrome://shorthang
  • chrome://gpuclean
  • chrome://gpucrash
  • chrome://gpuhang
  • chrome://ppapiflashcrash
  • chrome://ppapiflashhang
  • chrome://quit/
  • chrome://restart/
※ 위 내용은 chrome://chrome-urls 에서 확인할 수 있음


Posted by 장안동베짱e :


Here is a small code snippet allowing to skip Open/Save us popup downloading a .zip file:

Set Firefox Preference
1
2
3
FirefoxProfile profile = new FirefoxProfile();
profile.setPreference("browser.helperApps.neverAsk.saveToDisk","application/zip");
driver = new FirefoxDriver(profile);

In case we download .csv file:

Set Firefox Preference fo CSV File
1
profile.setPreference("browser.helperApps.neverAsk.saveToDisk","text/csv");

..or pdf file:

title: Set Firefox Preference for PDF File
1
profile.setPreference("browser.helperApps.neverAsk.saveToDisk","application/pdf");

We can also apply settings for a list of all downloadable files:
(application/... 부분은 엔터없이 "application/x-xpinstall;application/x-zip;application/x-zip-compressed;application/octet-stream;application/zip;application/pdf;application/msword;text/plain;application/octet"같이 붙여 쓸 것)

Set Preferences for All Types of Files
1
2
3
4
5
6
7
8
9
10
profile.SetPreference("browser.download.dir", downloadDir);
profile.SetPreference("browser.download.folderList", 2);
profile.SetPreference("browser.helperApps.neverAsk.saveToDisk",
"application/x-xpinstall;
application/x-zip;
application/x-zip-compressed;
application/octet-stream;
application/zip;application/pdf;
application/msword;
text/plain;application/octet");

The best place in code to apply setPreferences of Firefox is @BeforeClass:

Set Preferences for All Types of Files
1
2
3
4
5
6
7
8
9
10
11
12
13
@BeforeClass
public static void initializeClass() throws FileNotFoundException,
          IOException {
profile = new FirefoxProfile();
profile.setPreference("browser.helperApps.neverAsk.saveToDisk","application/zip");
driver = new FirefoxDriver(profile);
      
properties = new PropertiesUtil(PROPERTIES_FILE);
driver.get(properties.getValue("URL"));
driver.manage().window().maximize();
      
screenshot = new ScreenshotUtil(driver);
}
※ 주의 : setPreference의 ""따움표안에 인자값은 오타를 적을경우 별다른 에러메시지 없이 동작하지 않으니 오타를 내지 않도록 주의

※참고 : MIME types( http://help.dottoro.com/lapuadlp.php )


 http://dataqzone.com/download-file-with-selenium-save-as-popup/

 



Posted by 장안동베짱e :

공통점은 제목에 괄호인가??!


Pig Toolbox (Super Gestures)

https://chrome.google.com/webstore/detail/pig-toolbox-super-gesture/oiplkfaidhjklglajdpfehoagkmlcakh


IE Tab Multi (Enhance)

https://chrome.google.com/webstore/detail/fnfnbeppfinmnjnjhedifcfllpcfgeea

Posted by 장안동베짱e :

항목

제품명

작업, 이슈 관리

Redmine, Trac, JIRA, bugzilla

소스 제어 관리

CVS, Subversion, Git, Visual Sourcesafe

단위 테스트

xUnit, Selenium

코드 커버리지

EMMA, Cobertura, Clover

부하 테스트

Load Runner, Apache JMeter

빌드 자동화

Ant, Maven

지속적인 통합(CI)

Hudson/Jenkins, Bamboo


Posted by 장안동베짱e :




맥에서 root 패스워드 설정하기

리눅스나 유닉스에서  su 명령어를 사용하여 root계정으로 전환하려고해도,

기본적으로 root의 패스워드가 설정되어 있지 않아서 마음대로 되지 않는다.


따라서 다음의 명령어를 순서대로 입력하면 root 패스워드 설정 및 root로의 전환을 쉽게 할 수 있다.


터미널을 수행시키고

$ sudo -s 

를 입력하고 엔터를 치면, 패스워드를 물어보는데,

현재 사용하는 패스워드를 입력하면 된다.

그러면 다음과 같은 bash 프롬프트가 나오며,

다음과 같이 입력하면 된다.


bash-3.2# passwd root

Changing password for root.

New password:

Retype new password:

bash-3.2#

이렇게 새로운 패스워드를 입력한 후,

su 명령어를 입력하고 패스워드를 입력하면 마음대로 root계정으로 터미널을 수행할 수 있다.

 
 http://www.tuning-java.com/328

 


Posted by 장안동베짱e :


VMware VIX API / vmrun

나는 VMware Workstation이나 Fusion을 띄워놓고 VM에 원격으로 접속하는 일이 잦은데

VMware이미지를 제어 할때 꼭 VMware가 설치되어 있는 OS에 먼저 원격으로 접속해야 되어서 번거로웠다.


어떻게 이걸 원격으로 제어 할수 없을까 싶어서 찾아보던 중에

VMware VIX API libraries라는걸 발견했다.


그안에 보면 vmrun이라는 명령어가 있는데

이걸 이용해서 굳이 귀찮게 GUI 를 거치지 않고 터미널 상에서 이미지들을 부팅, 재부팅, 셧다운, 스냅샷제어, 

파일을 vmware로 카피하고 파일을 원격에서 실행하고 데이타를 카피 아웃해 오는 것 등 여러가지 동작을 할수 있다.


vmrun 은 앞서말한 VMware VIX API libraries 에 포함된 유틸리티로, VMware Server 및 Workstation 버전에는 기본 포함되어 있다. VMware Fusion 이나 Player 사용자들의 경우 VIX API 다운로드 페이지를 통해 SDK 를 다운받아 설치하면 된다고 한다.(맥은 /Applications/VMware Fusion.app/Contents/Library/vmrun 에 있고 윈도우는 C:\Program Files (x86)\VMware\VMware VIX\vmrun.exe 에 있음)



상세한 사용 방법은 아래의 URI를 참고하면 된다. vmware.com에 vmrun을 검색해보니 아래 버전외에는 검색이 안되는거 보니 추후버전에는 큰 변경사항은 없을 것 같다.

VMware Workstation 6.5, VMware Fusion 2.0, and VMware Server 2.0 http://www.vmware.com/pdf/vix162_vmrun_command.pdf VMware Workstation 7.0, VMware Fusion 3.0, VMware vSphere 4, VMware Server 2.0 http://www.vmware.com/pdf/vix180_vmrun_command.pdf


 

[VMware Workstation 기준 간단한 제어 요령]

[Workstation] 부팅: vmrun -T ws start /vm_folder/vm.vmx nogui 재부팅: vmrun -T ws reset /vm_folder/vm.vmx soft 셧다운: vmrun -T ws stop /vm_folder/vm.vmx soft 스냅샷 생성: vmrun -T ws snapshop /vm_folder/vm.vmx my_snapshot suspend : vmrun -T ws suspend /vm_folder/vm.vmx soft

[Fusion] 부팅: vmrun -T fusion start /vm_folder/vm.vmx nogui 재부팅: vmrun -T fusion reset /vm_folder/vm.vmx soft 셧다운: vmrun -T fusion stop /vm_folder/vm.vmx soft 스냅샷 생성: vmrun -T fusion snapshop /vm_folder/vm.vmx my_snapshot suspend : vmrun -T fusion suspend /vm_folder/vm.vmx soft

p.s 스냅샷 관련 기능들은 VMware Player 등에는 원래 없는 기능이기 때문에 당연히 동작하지 않는다. 

그 외에도 VMware 종류에 따라 지원되는 기능의 종류 및 범위가 한정되어 있다는 점도 잊지 말자.



결론) 커맨드라인상에서의 동작을 지원하니 원격에서 ssh로 붙어서 하던, 별도 스크립트나 프로그램을 짜던지 하면 간단하게 원격에서도 vmware이미지를 제어 할 수 있을듯하다.(..는 아마 안 바쁘면 내가 만들거라는 얘기, 혹시 만들면 올릴게요)


http://katselphrime.com/2014/03/16/vmrun/

http://bugtruck.blogspot.kr/2009/02/vmrun-vmware.html

http://www.vmware.com/kr/support-search.html?cc=www&client=VMware_Site_support_center&site=VMware_Site_support_center&cn=vmware&num=20&output=xml_no_dtd&ie=UTF-8&oe=UTF-8&q=Using+vmrun+to+Control+Virtual+Machines#client=VMware_Site_support_center&numgm=4&getfields=*&filter=0&site=VMware_Site_support_center&cc=en&ie=UTF-8&oe=UTF-8&start=0&num=20&cid=&tid=&cn=vmware&output=xml_no_dtd&q=Using vmrun to Control Virtual Machines


 


Posted by 장안동베짱e :


구글 간편 검색기


가끔 문서 검색할일이 있는데 주로 filetype:pdf검색을 많이 사용한다 

근데 문서가 PDF일수도 있고 ppt일때도 있고 pptx일때도 있고

아니면 파일타입 관계없이 필요할때도 많다


그럴때 마다 filetype: ... filetype:... 을 계속 하기 귀찮아서 검색기를 만들었다.

필요하신분은 수정해서 사용하시면 됩니다.


 
참고 : http://prattler22.tistory.com/21

 


Posted by 장안동베짱e :


Doxygen은 C, C++. C#, Objective-C, PHP, Java,Python, VHDL, Fortran, Tcl 등의 소스코드에서 주석을 약속된 문법대로 작성하면 주석을 분석해 HTML 또는 LATEX, PDF 형태로 소스코드를 문서화 해줍니다.

 따라서  Doxygen 을 사용하시면 소스코드의 분석 및 유지 보수에도 도움이 됩니다. 

 

우선 Doxygen 설치에 앞서 함수 구조도, 클래스 구조도등의 그래프를 무선에 포함시키기 위하여 Graphviz 를 설치하는게 좋습니다.

Graphviz은 http://www.graphviz.org/Download_windows.php 에서 받아 설치하면 됩니다.

 

다음으로 http://www.stack.nl/~dimitri/doxygen/download.html#latestsrc 에서 OS에 맞는 Doxygen을 다운받아 설치합니다. 

 

Doxygen의 주석은 /**  */ 모양의 주석 안에 약속된 형태의 태그를 명시하고 그에대한 설명을 추가하는 형식으로 되어 있습니다. 문법에 대한 설명과 팁들을 보려면 공식 홈페이지 매뉴얼http://www.stack.nl/~dimitri/doxygen/manual.html 을 참고하시기 바랍니다.

  

다음 설명은 doxygen 1.8.2 버전을 기준으로 설명합니다. 

 

Doxygen-1.8.2 를 설치 후에 Doxywizard를 실행하시면 다음과 같은 화면이 뜹니다. 

 

 

 

 

[ Wizard >> Project ]

 

Specify the working directory from which doxygen will run 

프로젝트 루트 폴더를 지정합니다.  이 폴더 안에 소스코드와 Doxygen 결과가 저장될 폴더등이 이안에 있어야 합니다.

 

Project name
프로젝트 이름을 넣습니다.

 

Project verion or id
프로젝트 버전이나 다른 프로젝트와 구별할 수 있는 식별 번호를 입력합니다. 정해진 형식은 없으며 자유롭게 입력하시면 됩니다.

 

Source code directory
소스 파일이 있는 디렉토리를 지정해 줍니다.

 

Scan recursively
소스 파일이 소스 디렉토리 안에 또 다른 디렉토리 안에 작성되어 있다면, 모든 하위 디렉토리까지 뒤져가면서 문서를 작성할지의 여부를 지정합니다.

 

Destination diectory
Doxygen이 문서를 어디에 생성할지를 정해 줍니다. 이 디렉토리 및에 자동으로 “html”디렉토리를 생성하므로 Doxygen을 위한 디렉토리만 정해주시면 됩니다.


 

 

 

[ Wizard >> Mode ]

 

Include cross-refeenced source code in the output
이 옵션을 체크하면 각 함수마다 사용한 함수 코드로 바로 Jump할 수 있는 링크를 생성해 줍니다. 

 

Select progrmming language to optimize the results for

해당 프로그램 언어를 선택하시면 됩니다. 

 

 

 

 

 

[ Wizard >> Output ]

 

with navigation panel

출력 형식을 선언하는 것이며 문서 왼쪽에 탐색 트리가 있는 것이 편하므로 “with navigation panel”에 체크를 했습니다.

 

 

 

 

[ Wizard >> Diagrams ]

 

Use dot tool from the GraphViz package

 Doxygen에서 소스간의 관계를 그래프로 출력해 주는 기능이 있습니다. 그래프로 출력해주는 기능을 Dot Tool 이라고 하더군요. 당연히 관계 그래프가 출력되는 것이 좋으므로 모든 옵션을 체크했습니다

 

 

 

 

[ Expert >> Project ]

 

DOXYFILE_ENCODING

한글사용시 한글이 깨지는 것을 막기 위해 “EUC-KR”로 변경합니다.

 

OUTPUT_LANGUAGE

출력 결과에 쓰여질 언어를 선택합니다.

 

ALWAYS_DETAILED_SEC

항상 상세정보를 보여줍니다. REPEAT_BRIEF와 같이 선택하게되면 개략 정보가 없어도 상세정보 영역을 생성하게 됩니다.

 

INLINE_INHERITED_MEMB

생성자와 소멸자를 제외한 상속된 모든 멤버들을 보여줍니다.

 

 

 

 

[ Expert >> Build ]

 

EXTRACT_ALL

이 항목을 체크 하시면 소스코드 내의 모든 요소가 문서화 대상이 됩니다.

하지만 EXTRACT_PRIVATE EXTRACT_STATIC에 체크돼 있지 않으면 private 멤버와 static 멤버는 문서화 되지 않습니다.

 

EXTRACT_PRIVATE

이 항목을 체크 하시면 클래스내의 모든 private 멤버가 문서화 대상이 됩니다.

 

EXTRACT_STATIC

이 항목을 체크 하시면 클래스내의 모든 static 멤버가 문서화 대상이 됩니다.

 

 

 

 

[ Expert >> Input ]

 

INPUT_ENCODING
한글이 깨지는 문제를 피하기 위해 “EUC-KR”로 변경합니다.

 

 

 

 

[ Expert >> Source Browser ]

 

INLINE_SOURCES 

이 항목을 체크 하시면 함수 설명에서 함수 소스코드가 들어가게 됩니다.

 

 

 

 

[ Expert >> Dot ]

 

ClASS_DIAGRAMS

클래스의 상속구조 다이어그램으로 그립니다.

 

UML_LOOK

다이어그램을 UML 형식으로 그립니다.

 

 

 

 

Run ]

 

Run doxygen

이 버튼을 클릭하시면 Doxygen 문서가 생성됩니다.

 

Show HTML output

Doxygen has finished 가 되었다면 이버튼을 통해 HTML을 볼수 있습니다.

이미 새성된 HTML은 Destinatione diectory 로 지정한 디렉토리 밑에 “html” 디렉토리가 있으며, 그안의 "index.html" 을 이용하여 HTML을 보셔도 됩니다.

 

 

이 설정 내용은 Doxygen 메뉴의 File >> Save 를 통해 저장하시면 소스 코드 변경후에 File >> Open 을 통하여 설정내용을 불러와서 그대로 다시 문서를 생성할수 있습니다.

 

이상 Doxygen 설정 방법 및 문서생성에 관한 글을 마치도록 하겠습니다. 


http://blog.naver.com/gepanow/130147573849

 


Posted by 장안동베짱e :



- 명령어 wevtutil.exe cl <LogName>


- 사용방법 wevtutil.exe cl "Application" & wevtutil.exe cl "Security" & wevtutil.exe cl "Setup" & wevtutil.exe cl "System" & wevtutil.exe cl "Microsoft-Windows-TerminalServices-RemoteConnectionManager/Operational"


 

http://cleverdj.tistory.com/102

 


Posted by 장안동베짱e :


Introduction

Apache Nutch is an open source Web crawler written in Java. By using it, we can find Web page hyperlinks in an automated manner, reduce lots of maintenance work, for example checking broken links, and create a copy of all the visited pages for searching over. That’s where Apache Solr comes in. Solr is an open source full text search framework, with Solr we can search the visited pages from Nutch. Luckily, integration between Nutch and Solr is pretty straightforward as explained below.

Apache Nutch supports Solr out-the-box, greatly simplifying Nutch-Solr integration. It also removes the legacy dependence upon both Apache Tomcat for running the old Nutch Web Application and upon Apache Lucene for indexing. Just download a binary release from here.


Table of Contents

Steps

This tutorial describes the installation and use of Nutch 1.x (current release is 1.7). How to compile and set up Nutch 2.x with HBase, see Nutch2Tutorial.


1. Setup Nutch from binary distribution

  • Download a binary package (apache-nutch-1.X-bin.zip) from here.

  • Unzip your binary Nutch package. There should be a folder apache-nutch-1.X.

  • cd apache-nutch-1.X/

From now on, we are going to use ${NUTCH_RUNTIME_HOME} to refer to the current directory (apache-nutch-1.X/).

Set up from the source distribution

Advanced users may also use the source distribution:

  • Download a source package (apache-nutch-1.X-src.zip)

  • Unzip
  • cd apache-nutch-1.X/

  • Run ant in this folder (cf. RunNutchInEclipse)

  • Now there is a directory runtime/local which contains a ready to use Nutch installation.

When the source distribution is used ${NUTCH_RUNTIME_HOME} refers to apache-nutch-1.X/runtime/local/. Note that

  • config files should be modified in apache-nutch-1.X/runtime/local/conf/

  • ant clean will remove this directory (keep copies of modified config files)


2. Verify your Nutch installation

  • run "bin/nutch" - You can confirm a correct installation if you seeing similar to the following:

Usage: nutch COMMAND where command is one of:
crawl             one-step crawler for intranets (DEPRECATED)
readdb            read / dump crawl db
mergedb           merge crawldb-s, with optional filtering
readlinkdb        read / dump link db
inject            inject new urls into the database
generate          generate new segments to fetch from crawl db
freegen           generate new segments to fetch from text files
fetch             fetch a segment's pages

Some troubleshooting tips:

  • Run the following command if you are seeing "Permission denied":

chmod +x bin/nutch
  • Setup JAVA_HOME if you are seeing JAVA_HOME not set. On Mac, you can run the following command or add it to ~/.bashrc:

export JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home

On Debian or Ubuntu, you can run the following command or add it to ~/.bashrc:

export JAVA_HOME=$(readlink -f /usr/bin/java | sed "s:bin/java::")


3. Crawl your first website

  • Add your agent name in the value field of the http.agent.name property in conf/nutch-site.xml, for example:

<property>
 <name>http.agent.name</name>
 <value>My Nutch Spider</value>
</property>
  • mkdir -p urls

  • cd urls

  • touch seed.txt to create a text file seed.txt under urls/ with the following content (one URL per line for each site you want Nutch to crawl).

http://nutch.apache.org/
  • Edit the file conf/regex-urlfilter.txt and replace

# accept anything else
+.

with a regular expression matching the domain you wish to crawl. For example, if you wished to limit the crawl to the nutch.apache.org domain, the line should read:

 +^http://([a-z0-9]*\.)*nutch.apache.org/

This will include any URL in the domain nutch.apache.org.


3.1 Using the Crawl Command

The crawl command is deprecated. Please see section 3.3 on how to use the crawl script that is intended to replace the crawl command.

Now we are ready to initiate a crawl, use the following parameters:

  • -dir dir names the directory to put the crawl in.

  • -threads threads determines the number of threads that will fetch in parallel.

  • -depth depth indicates the link depth from the root page that should be crawled.

  • -topN N determines the maximum number of pages that will be retrieved at each level up to the depth.

  • Run the following command:

bin/nutch crawl urls -dir crawl -depth 3 -topN 5
  • Now you should be able to see the following directories created:

crawl/crawldb
crawl/linkdb
crawl/segments

NOTE: If you have a Solr core already set up and wish to index to it, you are required to add the -solr <solrUrl> parameter to your crawl command e.g.

bin/nutch crawl urls -solr http://localhost:8983/solr/ -depth 3 -topN 5

If not then please skip to here for how to set up your Solr instance and index your crawl data.

Typically one starts testing one's configuration by crawling at shallow depths, sharply limiting the number of pages fetched at each level (-topN), and watching the output to check that desired pages are fetched and undesirable pages are not. Once one is confident of the configuration, then an appropriate depth for a full crawl is around 10. The number of pages per level (-topN) for a full crawl can be from tens of thousands to millions, depending on your resources.


3.2 Using Individual Commands for Whole-Web Crawling

NOTE: If you previously modified the file conf/regex-urlfilter.txt as covered here you will need to change it back.

Whole-Web crawling is designed to handle very large crawls which may take weeks to complete, running on multiple machines. This also permits more control over the crawl process, and incremental crawling. It is important to note that whole Web crawling does not necessarily mean crawling the entire World Wide Web. We can limit a whole Web crawl to just a list of the URLs we want to crawl. This is done by using a filter just like we the one we used when we did the crawl command (above).

Step-by-Step: Concepts

Nutch data is composed of:

  1. The crawl database, or crawldb. This contains information about every URL known to Nutch, including whether it was fetched, and, if so, when.
  2. The link database, or linkdb. This contains the list of known links to each URL, including both the source URL and anchor text of the link.
  3. A set of segments. Each segment is a set of URLs that are fetched as a unit. Segments are directories with the following subdirectories:
    • crawl_generate names a set of URLs to be fetched

    • crawl_fetch contains the status of fetching each URL

    • content contains the raw content retrieved from each URL

    • parse_text contains the parsed text of each URL

    • parse_data contains outlinks and metadata parsed from each URL

    • crawl_parse contains the outlink URLs, used to update the crawldb

Step-by-Step: Seeding the crawldb with a list of URLs

Option 1: Bootstrapping from the DMOZ database.

The injector adds URLs to the crawldb. Let's inject URLs from the DMOZ Open Directory. First we must download and uncompress the file listing all of the DMOZ pages. (This is a 200+ MB file, so this will take a few minutes.)

wget http://rdf.dmoz.org/rdf/content.rdf.u8.gz
gunzip content.rdf.u8.gz

Next we select a random subset of these pages. (We use a random subset so that everyone who runs this tutorial doesn't hammer the same sites.) DMOZ contains around three million URLs. We select one out of every 5,000, so that we end up with around 1,000 URLs:

mkdir dmoz
bin/nutch org.apache.nutch.tools.DmozParser content.rdf.u8 -subset 5000 > dmoz/urls

The parser also takes a few minutes, as it must parse the full file. Finally, we initialize the crawldb with the selected URLs.

bin/nutch inject crawl/crawldb dmoz

Now we have a Web database with around 1,000 as-yet unfetched URLs in it.

Option 2. Bootstrapping from an initial seed list.

This option shadows the creation of the seed list as covered here.

bin/nutch inject crawl/crawldb urls

Step-by-Step: Fetching

To fetch, we first generate a fetch list from the database:

bin/nutch generate crawl/crawldb crawl/segments

This generates a fetch list for all of the pages due to be fetched. The fetch list is placed in a newly created segment directory. The segment directory is named by the time it's created. We save the name of this segment in the shell variable s1:

s1=`ls -d crawl/segments/2* | tail -1`
echo $s1

Now we run the fetcher on this segment with:

bin/nutch fetch $s1

Then we parse the entries:

bin/nutch parse $s1

When this is complete, we update the database with the results of the fetch:

bin/nutch updatedb crawl/crawldb $s1

Now the database contains both updated entries for all initial pages as well as new entries that correspond to newly discovered pages linked from the initial set.

Now we generate and fetch a new segment containing the top-scoring 1,000 pages:

bin/nutch generate crawl/crawldb crawl/segments -topN 1000
s2=`ls -d crawl/segments/2* | tail -1`
echo $s2

bin/nutch fetch $s2
bin/nutch parse $s2
bin/nutch updatedb crawl/crawldb $s2

Let's fetch one more round:

bin/nutch generate crawl/crawldb crawl/segments -topN 1000
s3=`ls -d crawl/segments/2* | tail -1`
echo $s3

bin/nutch fetch $s3
bin/nutch parse $s3
bin/nutch updatedb crawl/crawldb $s3

By this point we've fetched a few thousand pages. Let's invert links and index them!

Before indexing we first invert all of the links, so that we may index incoming anchor text with the pages.

bin/nutch invertlinks crawl/linkdb -dir crawl/segments

We are now ready to search with Apache Solr.

Step-by-Step: Indexing into Apache Solr

Note: For this step you should have Solr installation. If you didn't integrate Nutch with Solr. You should read here.

Now we are ready!!! To go on and index the all the resources. For more information see this paper

     Usage: bin/nutch solrindex <solr url> <crawldb> [-linkdb <linkdb>][-params k1=v1&k2=v2...] (<segment> ...| -dir <segments>) [-noCommit] [-deleteGone] [-filter] [-normalize]
     Example: bin/nutch solrindex http://localhost:8983/solr crawl/crawldb/ -linkdb crawl/linkdb/ crawl/segments/20131108063838/ -filter -normalize

Step-by-Step: Deleting Duplicates

Once indexed the entire contents, it must be disposed of duplicate urls in this way ensures that the urls are unique.

MapReduce:

  • Map: Identity map where keys are digests and values are SolrRecord instances (which contain id, boost and timestamp)

  • Reduce: After map, SolrRecords with the same digest will be grouped together. Now, of these documents with the same digests, delete all of them except the one with the highest score (boost field). If two (or more) documents have the same score, then the document with the latest timestamp is kept. Again, every other is deleted from solr index.

     Usage: bin/nutch solrdedup <solr url>
     Example: /bin/nutch solrdedup http://localhost:8983/solr

Step-by-Step: Cleaning Solr

The class scans a crawldb directory looking for entries with status DB_GONE (404) and sends delete requests to Solr for those documents. Once Solr receives the request the aforementioned documents are duly deleted. This maintains a healthier quality of Solr index.

     Usage: bin/nutch solrclean <crawldb> <solrurl>
     Example: /bin/nutch solrclean crawl/crawldb/ http://localhost:8983/solr


3.3. Using the crawl script

If you have followed the 3.2 section above on how the crawling can be done step by step, you might be wondering how a bash script can be written to automate all the process described above.

Nutch developers have written one for you :), and it is available at bin/crawl.

     Usage: bin/crawl <seedDir> <crawlID> <solrURL> <numberOfRounds>
     Example: bin/crawl urls/seed.txt TestCrawl http://localhost:8983/solr/ 2
     Or you can use:
     Example: bin/nutch crawl urls -solr http://localhost:8983/solr/ -depth 3 -topN 5

The crawl script has lot of parameters set, and you can modify the parameters to your needs. It would be ideal to understand the parameters before setting up big crawls.

  • download binary file from here

  • unzip to $HOME/apache-solr-3.X, we will now refer to this as ${APACHE_SOLR_HOME}

  • cd ${APACHE_SOLR_HOME}/example

  • java -jar start.jar


5. Verify Solr installation

After you started Solr admin console, you should be able to access the following links:

http://localhost:8983/solr/#/


6. Integrate Solr with Nutch

We have both Nutch and Solr installed and setup correctly. And Nutch already created crawl data from the seed URL(s). Below are the steps to delegate searching to Solr for links to be searchable:

  • mv ${APACHE_SOLR_HOME}/example/solr/conf/schema.xml ${APACHE_SOLR_HOME}/example/solr/conf/schema.xml.org
  • cp ${NUTCH_RUNTIME_HOME}/conf/schema.xml ${APACHE_SOLR_HOME}/example/solr/conf/

  • vi ${APACHE_SOLR_HOME}/example/solr/conf/schema.xml
  • Copy exactly in 351 line: <field name="_version_" type="long" indexed="true" stored="true"/>

  • restart Solr with the command “java -jar start.jar” under ${APACHE_SOLR_HOME}/example

  • run the Solr Index command:

bin/nutch solrindex http://127.0.0.1:8983/solr/ crawl/crawldb -linkdb crawl/linkdb crawl/segments/*

The call signature for running the solrindex has changed. The linkdb is now optional, so you need to denote it with a "-linkdb" flag on the command line.

This will send all crawl data to Solr for indexing. For more information please see bin/nutch solrindex

If all has gone to plan, we are now ready to search with http://localhost:8983/solr/admin/. If you want to see the raw HTML indexed by Solr, change the content field definition in schema.xml to:

<field name="content" type="text" stored="true" indexed="true"/>

NutchTutorial (last edited 2013-11-30 11:02:17 by talat)




 

http://wiki.apache.org/nutch/NutchTutorial

 

Posted by 장안동베짱e :


win-get(windows-get)

win-get is an automated install system and software repository for Microsoft Windows written in pascal (for the command line client) and php for the online repository. The ideas for its creation come from apt-get and other related tools for the *nix platforms.


The system works by connecting to a link repository. Finding an application and downloading it from the stored link using wget.exe . Then performing the installation routine (silent or standard). And finnally deleting the install file.


Installation: 1. Download wget.exe 2. Download win-get.exe (version 1.01) 3. Put the 2 files some where on your system (I like in the c:\windows so they are system wide accessible). *** If you are upgrading to the 1.x version from any previous version you must delete your win-get.conf file and allow win-get to recreate it!! *** Questions, Comments, Bug-reports? visit the sourceforge site at: http://sourceforge.net/projects/windows-get or email me ryan.proctor@gmail.com You can view the current changelog here: changelog.txt

내용

 

http://windows-get.sourceforge.net/

 


Posted by 장안동베짱e :


# Python 라이브러리

optparse : 커멘드라인에서 옵션을 처리하기 위한 라이브러리

python-nmap : python에서 nmap 을 사용할수 있는 라이브러리

pexpect : 프로그램 작동, 프로그램의 결과 받아서 자동화를 할수 있는 라이브러리(이책에서는 ssh 접속 자동화를 위해 사용)

pxssh : pexpect라이브러리에 있는 ssh 세션과 직접 연동할 스크립트

ftplib : ftp라이브러리

_winreg : 윈도우 레지스트리를 읽기위한 라이브러리

mechanize : 웹 자동화 라이브러리

pyPDF : PDF 문서 관리 라이브러리

exiftool : Exif 정보 라이브러리

beutifulsoup4 : html, xml 의 구문분석 라이브러리

PIL : 파이선 이미지 라이브러리

sqlite3 : sqlite3 라이브러리

pyGeoIP : GeoLiteCity 데이터베이스를 쿼리 할수 있는 라이브러리

dpkt, scapy : 패킷분석을 위한 라이브러리

python-bluez : 파이선 블루투스 라이브러리

cookielib : 쿠키를 처리할수 있는 라이브러리

smtplib : smtp 라이브러리

ctype : C스타일 코드를 작성하기 위한 ctype 라이브러리


: python-nmap pexpect pxssh ftplib _winreg mechanize pyPDF exiftool beutifulsoup4 PIL sqlite3 pyGeoIP dpkt, scapy python-bluez cookielib smtplib ctype



Posted by 장안동베짱e :

 

Place

Web

Description

Formats

www.skullsecurity.org

On the web you can find the 500 pass most used variety of dictionaries (languages, actors, porn, etc ...), names from facebook, also lists the location of files (linux, windows), extensions of web applications (phpmyadmin, apache, phpbb etc ...), it is certainly the most comprehensive web I've seen to find the specific dictionary for brute force we seek.

*.txt.bz2 *.txt

www.insidepro.com

Brings dictionaries by language and some made by the same web site (InsidePro), also brings the mythical dictionary and one of hashkiller.com milw0rm.com, and also brings a compact with the names of Facebook. I personally really like that is neat and clear the site.

* Rar -.> * Dic.

packetstormsecurity.org

Here you can find dictionaries that comes to mind (asteroids, rock, myths and legends, cinema, jazz, names, etc ...). The only problem is you have to look at a long list with no logical order.

*.txt *.txt.gz

www.cotse.com (1) 
www.cotse.com (2)

A website that offers many topics: common passwords, the terms of Street Drugs, host names, the words of the King James Bible, Latin words, Minix / usr / dict, names of movies, classical music, country music, jazz, other music, rock music, musicals, myths and legends, names of players, player names, surnames whites, among many others. Just a bit annoying clutter.

*

ftp.ox.ac.uk

FTP bring a wide variety of dictionaries by language, some literature, movieTV, music, names, etc ...

*. Z *. Gz

ftp.openwall.com

This is the FTP known that brings Openwall passwords compact and a wide variety of dictionaries for languages.

*.gz

ftp.cerias.purdue.edu

FTP much like the previous two it brings among its varieties: language, literature, movieTV, places, names, random, religion, computer, science.

*.gz

vxchaos.official.ws

This is a server that collects many files relating to "hack", and in its wordlist section is extensive and varied a collection of dictionaries to brute force, the only problem is that you can download many at a time, have many formats and are very messy.

. * Zip *. Txt.gz *. Dic *. Txt *. Gz *. Rar. * Zip *. Z

ftp.zedz.net

FTP with varied number of dictionaries (languages, actors, movies, names, etc ...)

*

10°

contest.korelogic.com

Here you can locate an dictionaries with 2 letter combinations, city names, football teams, names from Facebook, Words from the Wiki (depending on language), etc ...

*. * December. Dic.gz *. Txt

11°

www.leetupload.com

This is another collection diccinarios server.

*. Zip *. Rare. Txt

12°

ftp.funet.fi

FTP with dictionaries for languages.

*. Z *

13°

wordlist.sourceforge.net

Here's a little collection complete, but equally useful.

*.tar.gz *.zip

14°

article7.org

Here you can find a handful of dictionaries.

*txt *.zip

15°

www.nomorecrypto.com

We provide a torrent with a dictionary of 31 GB or more, no less.

*txt *.zip



Bonus Track 1:

 

Well, no need to do brute force if they have the default passwords that come in router, telnet, HTTP, etc ... That are these 3 sites:

 

Place

Web

Description

www.vulnerabilityassessment.co.uk

The largest collection of default passwords on all services and models, and are ordered by alphabet: Z |Numeric | AS400 Default Accounts | Oracle Default Passwords

www.phenoelit-us.org

Default password list many authentication services. It ran a single list.

www.indianz.ch

List Previous much like, but it seems a little less full.

                                                                                                   
Bonus Track 2:

 

And there are not only gross Force passwords, but also for system files, Apache, Oracle, CGI, etc ... That's what this website brings many statements apart for SQLi and XSS:

http://yehg.net/



http://osysleo.blogspot.kr/2013/01/dictionaries-brute-force-brute-force.html

 




Posted by 장안동베짱e :

01 시작

The dependencies page lists all the jars that you will need to have in your classpath.

The class com.gargoylesoftware.htmlunit.WebClient is the main starting point. This simulates a web browser and will be used to execute all of the tests.

Most unit testing will be done within a framework like JUnit so all the examples here will assume that we are using that.

In the first sample, we create the web client and have it load the homepage from the HtmlUnit website. We then verify that this page has the correct title. Note that getPage() can return different types of pages based on the content type of the returned data. In this case we are expecting a content type of text/html so we cast the result to an com.gargoylesoftware.htmlunit.html.HtmlPage.


@Test

public void homePage() throws Exception {

    final WebClient webClient = new WebClient();

    final HtmlPage page = webClient.getPage("http://htmlunit.sourceforge.net");

    Assert.assertEquals("HtmlUnit - Welcome to HtmlUnit", page.getTitleText());

 

    final String pageAsXml = page.asXml();

    Assert.assertTrue(pageAsXml.contains("<body class=\"composite\">"));

 

    final String pageAsText = page.asText();

    Assert.assertTrue(pageAsText.contains("Support for the HTTP and HTTPS protocols"));

 

    webClient.closeAllWindows();

}


Often you will want to simulate a specific browser. This is done by passing a com.gargoylesoftware.htmlunit.BrowserVersion into the WebClient constructor. Constants have been provided for some common browsers but you can create your own specific version by instantiating a BrowserVersion.


@Test

public void homePage_Firefox() throws Exception {

    final WebClient webClient = new WebClient(BrowserVersion.FIREFOX_17);

    final HtmlPage page = webClient.getPage("http://htmlunit.sourceforge.net");

    Assert.assertEquals("HtmlUnit - Welcome to HtmlUnit", page.getTitleText());

 

    webClient.closeAllWindows();

}


Specifying this BrowserVersion will change the user agent header that is sent up to the server and will change the behavior of some of the JavaScript.

Once you have a reference to an HtmlPage, you can search for a specific HtmlElement by one of 'get' methods, or by using XPath.

Below is an example of finding a 'div' by an ID, and getting an anchor by name:


@Test

public void getElements() throws Exception {

    final WebClient webClient = new WebClient();

    final HtmlPage page = webClient.getPage("http://some_url");

    final HtmlDivision div = page.getHtmlElementById("some_div_id");

    final HtmlAnchor anchor = page.getAnchorByName("anchor_name");

 

    webClient.closeAllWindows();

}


XPath is the suggested way for more complex searches, a brief tutorial can be found in W3Schools


@Test

public void xpath() throws Exception {

    final WebClient webClient = new WebClient();

    final HtmlPage page = webClient.getPage("http://htmlunit.sourceforge.net");

 

    //get list of all divs

    final List<?> divs = page.getByXPath("//div");

 

    //get div which has a 'name' attribute of 'John'

    final HtmlDivision div = (HtmlDivision) page.getByXPath("//div[@name='John']").get(0);

 

    webClient.closeAllWindows();

}


The last WebClient constructor allows you to specify proxy server information in those cases where you need to connect through one.


@Test

public void homePage_proxy() throws Exception {

    final WebClient webClient = new WebClient(BrowserVersion.FIREFOX_10, "http://myproxyserver", myProxyPort);

 

    //set proxy username and password

    final DefaultCredentialsProvider credentialsProvider = (DefaultCredentialsProvider) webClient.getCredentialsProvider();

    credentialsProvider.addCredentials("username", "password");

 

    final HtmlPage page = webClient.getPage("http://htmlunit.sourceforge.net");

    Assert.assertEquals("HtmlUnit - Welcome to HtmlUnit", page.getTitleText());

 

    webClient.closeAllWindows();

}


Specifying this BrowserVersion will change the user agent header that is sent up to the server and will change the behavior of some of the JavaScript.


Frequently we want to change values in a form and submit the form back to the server. The following example shows how you might do this.


@Test

public void submittingForm() throws Exception {

    final WebClient webClient = new WebClient();

 

    // Get the first page

    final HtmlPage page1 = webClient.getPage("http://some_url");

 

    // Get the form that we are dealing with and within that form,

    // find the submit button and the field that we want to change.

    final HtmlForm form = page1.getFormByName("myform");

 

    final HtmlSubmitInput button = form.getInputByName("submitbutton");

    final HtmlTextInput textField = form.getInputByName("userid");

 

    // Change the value of the text field

    textField.setValueAttribute("root");

 

    // Now submit the form by clicking the button and get back the second page.

    final HtmlPage page2 = button.click();

 

    webClient.closeAllWindows();

}


 

02 키보드 사용

For a given WebClient, the focus can be on at most one element at any given time. Focus doesn't have to be on any element within the WebClient.

There are several ways to move the focus from one element to another. The simplest is to call HtmlPage.setFocusedElement(HtmlElement). This method will remove focus from whatever element currently has it, if any, and will set it to the new component. Along the way, it will fire off any "onfocus" and "onblur" handlers that have been defined.

The element currently owning the focus can be determined with a call to HtmlPage.getFocusedElement().

To simulate keyboard navigation via the tab key, you can call HtmlPage.tabToNextElement() and HtmlPage.tabToPreviousElement() to cycle forward or backwards through the defined tab order. This tab order is defined by the tabindex attribute on the various elements as defined by the HTML specification. You can query the defined tab order with the method HtmlPage.getTabbableElements() which will return a list of all tabbable elements in defined tab order.

Access keys, often called keyboard mnemonics, can be simulated with the method HtmlPage.pressAccessKey(char).

To use special keys, you can use htmlElement.type(int) with KeyboardEvent.DOM_VK_PAGE_DOWN.

Finally, there is an assertion for testing that will verify that every tabbable element has a defined tabindex attribute. This is done with WebAssert.assertAllTabIndexAttributesSet().


 

03 테이블 사용

The first set of examples will use this simple html.


<html><head><title>Table sample</title></head><body>

    <table id="table1">

        <tr>

            <th>Number</th>

            <th>Description</th>

        </tr>

        <tr>

            <td>5</td>

            <td>Bicycle</td>

        </tr>

    </table>

</body></html>


This example shows how to iterate over all the rows and cells


final HtmlTable table = page.getHtmlElementById("table1");

for (final HtmlTableRow row : table.getRows()) {

    System.out.println("Found row");

    for (final HtmlTableCell cell : row.getCells()) {

        System.out.println("   Found cell: " + cell.asText());

    }

}


The following sample shows how to access specific cells by row and column


final WebClient webClient = new WebClient();

final HtmlPage page = webClient.getPage("http://foo.com");

 

final HtmlTable table = page.getHtmlElementById("table1");

System.out.println("Cell (1,2)=" + table.getCellAt(1,2));


The next examples will use a more complicated table that includes table header, footer and body sections as well as a caption


<html><head><title>Table sample</title></head><body>

    <table id="table1">

        <caption>My complex table</caption>

        <thead>

            <tr>

                <th>Number</th>

                <th>Description</th>

            </tr>

        </thead>

        <tfoot>

            <tr>

                <td>7</td>

                <td></td>

            </tr>

        </tfoot>

        <tbody>

            <tr>

                <td>5</td>

                <td>Bicycle</td>

            </tr>

        </tbody>

        <tbody>

            <tr>

                <td>2</td>

                <td>Tricycle</td>

            </tr>

        </tbody>

    </table>

</body></html>


HtmlTableHeader, HtmlTableFooter and HtmlTableBody sections are groupings of rows. There can be at most one header and one footer but there may be more than one body. Each one of these contains rows which can be accessed via getRows()


final HtmlTableHeader header = table.getHeader();

final List<HtmlTableRow> headerRows = header.getRows();

 

final HtmlTableFooter footer = table.getFooter();

final List<HtmlTableRow> footerRows = footer.getRows();

 

for (final HtmlTableBody body : table.getBodies()) {

    final List<HtmlTableRow> rows = body.getRows();

    ...

}

Every table may optionally have a caption element which describes it.

final String caption = table.getCaptionText()


 

04 프레임(frame / iframe)사용

Getting the page inside <frame> element or <iframe> element can be done by using HtmlPage.getFrames().
Suppose you have the following page:

<html>
  <body>
    <iframe src="two.html">
  </body>
</html>

You can use the following code to get the content of two.html:

final List<FrameWindow> window = page.getFrames();
final HtmlPage pageTwo = (HtmlPage) window.get(0).getEnclosedPage();

Another example that navigates API docs to get a desired page of a class:

final WebClient client = new WebClient();
final HtmlPage mainPage = client.getPage("http://htmlunit.sourceforge.net/apidocs/index.html");

To get the page of the first frame (at upper left) and click the sixth link:

final HtmlPage packageListPage = (HtmlPage) mainPage.getFrames().get(0).getEnclosedPage();
packageListPage.getAnchors().get(5).click();

To get the page of the frame named 'packageFrame' (at lower left) and click the second link:

final HtmlPage pakcagePage = (HtmlPage) mainPage.getFrameByName("packageFrame").getEnclosedPage();
pakcagePage.getAnchors().get(1).click();

To get the page of the frame named 'classFrame' (at right):

final HtmlPage classPage = (HtmlPage) mainPage.getFrameByName("classFrame").getEnclosedPage();


 

05 윈도우 사용

All pages are contained within WebWindow objects. This could be a TopLevelWindow representing an actual browser window, an HtmlFrame representing a <frame> element or an HtmlInlineFrame representing an <iframe> element.

When a WebClient is first instantiated, a TopLevelWindow is automatically created. You could think of this as being the first window displayed by a web browser. Calling WebClient.getPage(WebWindow, WebRequest) will load the new page into this window.

The JavaScript open() function can be used to load pages into other windows. New WebWindow objects will be created automatically by this function.


If you wish to be notified when windows are created or pages are loaded, you need to register a WebWindowListener with the WebClient via the method WebClient.addWebWindowListener(WebWindowListener)

When a window is opened either by JavaScript or through the WebClient, a WebWindowEvent will be fired and passed into the WebWindowListener.webWindowOpened(WebWindowEvent) method. Note that both the new and old pages in the event will be null as the window does not have any content loaded at this point. If a URL was specified during creation of the window then the page will be loaded and another event will be fired as described below.

When a new page is loaded into a specific window, a WebWindowEvent will be fired and passed into the WebWindowListener.webWindowContentChanged(WebWindowEvent) method.


 

06 JavaScript 사용

A frequent question we get is "how do I test my JavaScript?". There is nothing really specific for using JavaScript, it is automatically processed. So, you just need to .getPage(), find the element to click(), and then check the result. Tests for complex JavaScript libraries are included in HtmlUnit test base, you can find it here which is useful to get an idea.

Usually, you should wait() or sleep() a little, as HtmlUnit can finish before the AJAX response is retrieved from the server, please read this FAQ.

Below are some examples:


Lets say that we have a page containing JavaScript that will dynamically write content to the page. The following html will dynamically generate five textfields and place them inside a table. Each textfield will have a unique name created by appending the index to the string "textfield".

<html><head><title>Table sample</title></head><body>
    <form action='/foo' name='form1'>
    <table id="table1">
        <script type="text/javascript">
            for (i = 1; i <= 5; i++) {
                document.write("<tr><td>" + i
                    + "</td><td><input name='textfield" + i
                    + "' type='text'></td></tr>");
            }
        </script>
    </table></form>
</body></html>

We would likely want to test that the five text fields were created so we could start with this.

@Test
public void documentWrite() throws Exception {
    final WebClient webClient = new WebClient();
 
    final HtmlPage page = webClient.getPage("http://myserver/test.html");
    final HtmlForm form = page.getFormByName("form1");
    for (int i = 1; i <= 5; i++) {
        final String expectedName = "textfield" + i;
        Assert.assertEquals(
            "text", 
            form.<HtmlInput>getInputByName(expectedName).getTypeAttribute());
    }
}

We might also want to check off-by-one errors by ensuring that it didn't create "textfield0" or "textfield6". Trying to get an element that doesn't exist will cause an exception to be thrown so we could add this to the end of the previous test.

try {
    form.getInputByName("textfield0");
    fail("Expected an ElementNotFoundException");
}
catch (final ElementNotFoundException e) {
    // Expected path
}
 
try {
    form.getInputByName("textfield6");
    fail("Expected an ElementNotFoundException");
}
catch (final ElementNotFoundException e) {
    // Expected path
}

Often you want to watch alerts triggered by JavaScript.

<html><head><title>Alert sample</title></head>
<body onload='alert("foo");'>
</body></html>

Alerts are tracked by an AlertHandler which will be called whenever the JavaScript alert() function is called. In the following test, we register an alert handler which just saves all messages into a list. When the page load is complete, we compare that list of collected alerts with another list of expected alerts to ensure they are the same.

@Test
public void alerts() throws Exception {
    final WebClient webClient = new WebClient();
 
    final List collectedAlerts = new ArrayList();
    webClient.setAlertHandler(new CollectingAlertHandler(collectedAlerts));
 
    // Since we aren't actually manipulating the page, we don't assign
    // it to a variable - it's enough to know that it loaded.
    webClient.getPage("http://tciludev01/test.html");
 
    final List expectedAlerts = Collections.singletonList("foo");
    Assert.assertEquals(expectedAlerts, collectedAlerts);
}

Handling prompt dialogs, confirm dialogs and status line messages work in the same way as alerts. You register a handler of the appropriate type and it will get notified when that method is called. See WebClient.setPromptHandler(), WebClient.setConfirmHandler() and WebClient.setStatusHandler() for details on these.

Most event handlers are already implemented: onload, onclick, ondblclick, onmouseup, onsubmit, onreadystatechange, ... They will be triggered at the appropriate time just like in a "real browser".

If the event that you wish to test is not yet supported then you can directly invoke it through the ScriptEngine. Note that while the script engine is publicly accessible, we do not recommend using it directly unless you have no other choice. It is much better to manipulate the page as a user would by clicking on elements and shifting the focus around.


 

07 ActiveX 사용

Although HtmlUnit is a pure Java implementation that simulates browsers, there are some cases where platform-specific features require integration of other libraries, and ActiveX is one of them.

Internet Explorer on Windows can run arbitrary ActiveX components (provided that security level is lowered on purpose, if the user trusts the website). Neither HtmlUnit nor Internet Explorer has any control on the behavior of the run ActiveX, so you have to be careful before using that feature.


The current implementation depends on Jacob, and because it has .dll dependency, it was not uploaded to maven repository. The dependency is optional, i.e. Jacob jar is not needed for compiling or usual usage of HtmlUnit.

To use Jacob, add jacob.jar to the classpath and put the .dll in the path (java.library.path) so that the following code works for you:

final ActiveXComponent activeXComponent = new ActiveXComponent("InternetExplorer.Application");
final boolean busy = activeXComponent.getProperty("Busy").getBoolean();
System.out.println(busy);

The only thing needed is setting WebClient property:

webClient.getOptions().setActiveXNative(true);

and there you go!

 

Posted by 장안동베짱e :

1.Facebook api를 사용해서 글등록시 연속으로 등록 시 스팸방지 에러메세지가 뜨며 등록이 되지 않는다. 결국 Htmlunit 라이브러리를 이용하여 가상브라우져에서 등록하는 방식으로 구현하였슴


2. 개발에 유의한점은 

- html 을 단순화하여 분석하기 위해 모바일 페이지로 접속(m.facebook.com)

- 한글/영문등 언어별로 페이지가 다르게 나타나므로 한글페이지로 접속하도록 http header 강제 설정


3. 소스 

- 아래 소스에서 ID, PW를 facebook 계정으로 바꾸어 사용하면 됨

import java.util.List; import org.apache.log4j.Logger; import com.gargoylesoftware.htmlunit.BrowserVersion; import com.gargoylesoftware.htmlunit.WebClient; import com.gargoylesoftware.htmlunit.html.HtmlElement; import com.gargoylesoftware.htmlunit.html.HtmlForm; import com.gargoylesoftware.htmlunit.html.HtmlInput; import com.gargoylesoftware.htmlunit.html.HtmlPage; public class FacebookPost2 { private static Logger log = Logger.getLogger("facebook2"); public static void main(String[] args) throws Exception { new FacebookPost2().reg("", "test"); } public void reg(String title, String content) throws Exception{ String message = ""; message = content; WebClient webClient = new WebClient(BrowserVersion.INTERNET_EXPLORER_8); //브라우져 Header 설정 webClient.addRequestHeader("Accept-Language", "ko-KR,ko;q=0.8,en-US;q=0.6,en;q=0.4, value"); webClient.addRequestHeader("Accept-Charset", "windows-949,utf-8;q=0.7,*;q=0.3"); webClient.setThrowExceptionOnScriptError(true); webClient.getCookieManager().setCookiesEnabled(true); webClient.setJavaScriptEnabled(true); //페이지 접속 HtmlPage page = (HtmlPage) webClient.getPage("http://m.facebook.com"); List<htmlform> htmlf = page.getForms(); //1번째 Form HtmlForm form = htmlf.get(0); //ID/PW 설정 form.<htmlinput> getInputByName("email").setValueAttribute(ID); form.<htmlinput> getInputByName("pass").setValueAttribute(PW); page = (HtmlPage) form.getInputByName("login").click(); Thread.sleep(100); log.error("button click"); //글 등록 page.<htmlelement> getElementByName("status").focus(); page.<htmlelement> getElementByName("status").setTextContent(message); page.<htmlelement> getElementByName("update").click(); //브라우져 닫기 webClient.closeAllWindows(); } }</htmlelement></htmlelement></htmlelement></htmlinput></htmlinput></htmlform>

<< 위코드는 약간의 수정이 필요합니다>>

 


http://krazyhe.tistory.com/23

 

Posted by 장안동베짱e :

개발환경 : JDK 1.5, Junit 3, HtmlUnit 2.7,  window XP

 

HtmlUnit 은 WebApplication 개발시 브라우저에서 테스트하지 않고 Java

프로그램을 단위 테스트 해볼수 있는 framework 이다. javascript, Ajax 를 완벽하게 지원할 뿐만 아니라 Internet Explorer, Firefox 두개의 브라우저에서 테스트 해볼수 있다.

 

(1) 환경설정

 

이것의 주요 목적은 개발된 웹사이트의 단위테스트와 정보를 리턴받기 위함이다.

http://htmlunit.sourceforge.net/ 에 주요내용이 있으므로 참고하기 바란다.

일단 왼쪽에 downloads 를 클릭해 파일을 다운받는다. 파일안 lib 폴더에

의존적인 class 들이 있으므로 그대로 복사해서 쓰면 된다.



HtmlUnit 을 돌리기 위해서 어떤 jar 버전이 의존적인지 확인해 볼려면 다음 페이지로 가서 확인하면된다. http://htmlunit.sourceforge.net/dependencies.html



다운받은 jar 파일을 복사해넣고 간단히 테스트 프로그램을 만들어서 실행해보자.

HtmlUnit 을 테스트하기위해서는 Junit 프레임웍을 사용해야한다.

windows > Preferences > Java Build Path 로 들어간다. Libraries 탭을 클릭해서 설정화면으로 들어가자. 화면에서 오른쪽 버튼중 Add Library 를 클릭하게 되면 eclipse 에서 제공하는 라이브러리 패키지 리스트가 제공된다. 그중 Junit 을 선택하게 되면 Junit3, Junit4 중 하나를 선택하게 되는데 나는 이전부터 Junit3 가 익숙해져 있어서 3 를 선택했다.



(2) 테스트 클래스 제작

 

이제 Junit 클래스를 하나 만든다. junit.framework.TestCase 클래스를 상속받아 만드는데 함수실행을 위해서는 함수명 앞에 testXXX 형태로 이름을 만들어야 framework 이 인식하게 된다. 사이트에서 사용한 예제는 Junit4 를 기반으로 했기 때문에 @Test 어노테이션을 사용할수 있지만 Juit3 에서는 못하기 때문에 함수명을 textXXX 로 만들수 밖에 없다.


import junit.framework.TestCase; import com.gargoylesoftware.htmlunit.WebClient; import com.gargoylesoftware.htmlunit.html.HtmlPage; public class WebSubmit extends TestCase { public void testHomePage() throws Exception { final WebClient webClient = new WebClient(); final HtmlPage page = webClient.getPage("http://htmlunit.sourceforge.net"); assertEquals("HtmlUnit - Welcome to HtmlUnit", page.getTitleText()); final String pageAsXml = page.asXml(); assertTrue(pageAsXml.contains("")); final String pageAsText = page.asText(); assertTrue(pageAsText.contains("Support for the HTTP and HTTPS protocols")); } }

위 소스를 테스트 한 결과이다. 왼쪽에 보면 문제 없이 진행된 것을 볼수 있다.



그리고 로그를 확인해 보면 사이트로 전송받은 HTML 내용이 DEBUG 모드로

출력되어있는 것을 볼수 있다. Junit 은 기본적으로 Log4j 를 사용하기 때문에log4j 설정값이 들어있는 properties 를 패키지 제일 상단에 복사해 넣는다.



만약 log4j.properties 가 없다면 아래와 같은 에러가 날것이다. 그리고 HtmlUnit 에서 출력하는 상세로그를 확인할수 없어 디버그 하기 힘들다.

log4j:WARN No appenders could be found for logger (com.gargoylesoftware.htmlunit.WebClient).

log4j:WARN Please initialize the log4j system properly.



다음 테스트 내용은 브라우저에서 실행할 내용을 단위테스트 함수에서 실행하는 것이다. 보통 브라우저에서 회원가입이나 데이터를 입력해서 submit 을 해야되는 경우 할 때 마다 수많은 입력값을 넣어 테스트를 하고 실패했을 경우 다시 재입력해야되는 귀찮은 작업을 해야한다. 하지만 단위테스트 함수를 만들어 놓고 그 안에 입력값을 고정으로 해서 작업한다면 다시 재입력해야 되는 수고는 덜수 있을 뿐만 아니라 값을 넘기고 난 이후의 비즈니스 로직을 효과적이고 빠르게 테스트 해볼수 있을 것이다


public void testSubmittingForm() throws Exception {               final WebClient webClient = new WebClient();       // WAS 를 띄운다. 테스트 하고자 하는 페이지로 접근하여 데이타를 받아온다       final HtmlPage page1 = webClient.getPage("http://localhost:8080/test.html");       // HTML 에서 form 객체를 가져온다.       final HtmlForm form = page1.getFormByName("myform");             // Button 객체를 가져온다.       final HtmlSubmitInput button = form.getInputByName("button");       // Input text 객체를 가져온다.       final HtmlTextInput textField = form.getInputByName("userid");       textField.setValueAttribute("값변경"); // Input text 값을 변경한다.  

      // 버튼 클릭과 같은 기능을 한다. javascript 함수 호출이나 submit 기능을       // 구현해 놓았다면 그대로 실행될 것이다.       final HtmlPage page2 = button.click(); }

 


 http://mainia.tistory.com/529

 

Posted by 장안동베짱e :
웹폰트는 구독자의 컴퓨터에서도 글쓴 이가 설정한 폰트로 볼 수 있어 가독성이 뛰어난 장점이 있습니다.
특히 네이버에서 아름다운 한글 알리기를 위해 보급중인 나눔고딕은 모바일에서도 가독성이 뛰어납니다.
한편 구글 크롬은 IE, 사파리 등 다양한 브라우저 가운데 속도가 빠르고 편의성이 뛰어나 국내에서도 꾸준하게 사용자가 늘어나고 있는데요 이러한 구글 크롬과 네이버 나눔고딕이 만났을 떄 PC나 모바일에서 구독자의 가독성을 도와줄 수 있습니다.
다만 설치형블로그에만 적용이 가능해 네이버나 다음 등에서 제공하는 블로그가 아닌 티스토리, 이글루스 등의 블로그에만 적용이 가능한 점이 단점입니다.
아직 구글크롬을 사용해보지 않으신 분들은 구글 크롬 브라우저를 다운 받아 설치해야 하며 간편하게 설치 가능합니다. 아직 한번도 사용해보지 않으셨다면 이번 기회에 구글 크롬을 다운받아 사용해보시기 바랍니다.


구글 크롬 웹폰트로 나눔고딕 또는 나눔 폰트 적용하기
구글에서는 구글폰트를 통해서 나눔폰트를 적용할 수 있습니다. ▷ 구글 폰트 바로가기 ---> https://www.google.com/fonts/earlyaccess
① 구글폰트 페이지에 접속한 후 'ctrl+F' 단축키를 이용해 'Nanum'을 입력해 나눔폰트체를 찾습니다.


② 위 이미지처럼 빨간 네모박스 속의 나눔고딕링크를 내블로그 관리자-->Html/css--> style/css 최상단에 삽입합니다.


③ 다시 'ctrl+F' 단축키를 이용해 css/style에서 'font-family'를 찾아 'Nanaum Gothic'을 입력한 후 저장을 눌러줍니다.


④ 미리보기를 통해 폰트적용이 되었는지 확인합니다.


미리보기를 통해 확인하니 PC상에서 적용이 잘 된 것을 볼 수 있습니다. 모바일에서는 어떻게 보이는지 확인해 보면 아래와 같이 모바일에서 더 선명하게 잘 보이고 있음을 알 수 있습니다.



이제 웹폰트로 나눔고딕을 적용하여 내 글을 보는 구독자에게 보다 편안하게 글을 볼 수 있도록 하세요.


출처 http://poto1.tistory.com/234



Posted by 장안동베짱e :



HTML에서 href와 src는 거의 유사한 작동을 한다.

href의 경우

<link rel="stylesheet" type="text/css" href="style.css"/>


이 와 같이 사용한다.

그런데 href 부분을 src로 사용해도 작동한다. 물론 결과도 동일하다.

자바스크립트 파일의 경우에 <script type="text/javascript" src="foobar.js"/> 와 같이 사용한다.


href 의 경우에는 브라우저의 html 파일 불러오기와 href에 링크된 파일을 가져오는 것을 병렬로 처리하고

src의 경우에는 src에 링크된 파일을 가져오는 동안 브라우저가 페이지를 불러오는 것을 일시 중지하고 가져온 후에 다시 페이지를 불러온다.

src에 링크된 파일이 모두 받아진 이후에 페이지가 불리워짐

그런데 왜 href와 src로 나누었을까?


w3c의 comment에 따르면

http://www.w3.org/TR/1999/REC-html401-19991224/index/attributes.html
URI for linked resource 라고 Comment가 되어있다

src는

script - URI for an external script
img - URI of image to embed

이렇게 적혀있다.

사용상의 결과적으로는 같은 외부의 무언가를 가져오는 것이다.


link 태그에서 이상한것은 약간 다른점은 stylesheet같은경우 외부 주소의 파일을 가져올 수 있고

a 태그에서는 외부의 것을 가져오는 것이아니라 그냥 연결을 위한 주소를 사용한다

보통 link태그에서는 href 속성이 다른 리소스를 연결하는 목적지를 나타낸다.

link 태그에서 href 속성이 없으면 link를 정의하지 않는다(src로 써도 되기는 함)

a 태그에서는 href 속성이이동할 URL을 정의한다.

갈수록 미궁으로..


stackoverflow에 보면 http://stackoverflow.com/questions/3395359/difference-between-src-and-href&usg=ALkJrhiOUA

여러가지 논쟁이 벌어진걸 알 수 있는데

href는 가져올 수 있는 리소스를 사용자가 요청
src는 브라우저가 가져와야 리소스를 보여줌

이렇다는데..

어찌 처리하는지 나중에 다시..

 


출처 http://parkcj.wordpress.com/2012/10/24/html-href-%EC%99%80-src-%EC%9D%98-%EC%B0%A8%EC%9D%B4/

 

 


Posted by 장안동베짱e :


소개

JSON은 JavaScript Object Notation의 약자입니다. JavaScript 문법으로 데이터를 기술한것이 특징인데 대부분의 브라우저는 JavaScript를 지원해 호환성이 좋고 XML과 비교하면 데이터 표현이 단순하기 때문에 기기간 통신에 사용하는 데이터 포맷으로 많이 쓰이고 있습니다.

Content-Type: application/json; charset=utf-8

JSON의 미디어 타입은 'application/json' 입니다. JSON은 스펙 상 UTF-8, UTF-16, UTF-32 중 하나로 인코딩하도록 되어 있기 때문에 최초의 4바이트를 검사하면 문자 인코딩을 알아낼 수 있지만, HTTP 헤더의 Content-Type에 charset으로 지정하는 것이 좋습니다. 특별한 이유가 없는 한 UTF-8을 사용하는것이 무난합니다.

문법

기본 자료형

JSON은 다음의 자료형을 지원합니다.

  • object
  • array
  • string
  • number
  • boolean
  • null

객체(Object)

{
	"name" : {
		"first": "Taewoo",
		"last": "Lee"
	},
	"site": "http://www.oiehot.com",
	"age": "31",
	"interests": {"Go", "Dart", "Html5", "CSS3", "Http"}
}

객체는 이름과 값의 집합입니다. 이름과 값의 세트를 객체에서는 '멤버'라고 부릅니다. 멤버의 이름은 항상 문자열입니다. 멤버의 값은 JSON이 지원하는 객체, 배열, 문자열, 숫자, 불린, NULL 자료형의 값을 가질 수 있습니다. 객체는 { }로 감싸주며 멤버는 쉼표(,)로 구분합니다. 멤버와 값은 콜론(:)으로 구분합니다.

배열(Array)

[ "foo", "bar", "baz" ]
[ {"foo":"bar"}, {"key":"value"} ]
[ [10, 10], [40, 50] ]
[ ]
[ {"foo":"bar"}, "baz", 100, true, null ]

배열은 [ ]로 감싸주고, 값은 쉼표(,)로 구분합니다.

문자열(String)

"가나다"
"\uAC00\uB098\uB2E4"
"foo\\bar\n"

문자열은 이중인용부호(")로 감싸줍니다. 유니코드를 숫자로 표현하기 위해서 \uXXXX 형식으로 Escape 할 수 있습니다. 백슬래시(\\)와 줄바꿈(\n) 같은 제어문자 Escape도 지원합니다.

수치(Number)

10
-100
30.1
1.0E-10

정수와 부동소수점 모두를 포함합니다. 표기는 10진법만 가능합니다.

불린(Boolean)

true
false

값이 참이냐 거짓인가를 취하는 불린형은 리터럴로 준비되어 있습니다. 반드시 소문자로 써야 합니다.

  • 리터럴 : 프로그램 소스코드에 직접 기술하는 변수와 상수 이외의 값을 말합니다.

Null

null

null값도 리터럴로 준비되어 있습니다. 반드시 소문자로 써야 합니다.

  • null값 : 프로그램 언어에서 값이 없음을 의미하는 값입니다.

자료형 응용

시간

시간은 기본적인 자료형으로 제공하지 않습니다. 개발자가 어떤 규칙을 정해서 사용해야 합니다. 가장 단순한것은 Unix 시간(Unix Epoch)으로 수치로 표현하는 방법입니다.

1234567890 // 2009년 2월 14일 08시 31분 30초
1382803323 // 2013년 10월 27일 01시 02분 03초

Unix 시간의 경우 타임 존을 다룰 수 없기 때문에 타임 존을 취급할 필요가 있을 때 JavaScript의 Date 클래스의 toString() 메서드로 출력한 문자열을 이용할 수 있습니다.

Mon Sep 23 2013 10:30:00 GMT+0900 // Firefox 23
Mon Sep 23 2013 10:30:00 GMT+0900 (대한민국 표준시) // Chrome 29
Mon Sep 23 2013 10:30:00 GMT+0900 (대한민국 표준시) // Opera 15
Mon Sep 23 10:30:00 UTC+0900 2013 // Internet Explorer 10

하지만 위 메소드는 브라우저마다 다른 결과를 보여주는 문제점이 있습니다. 따라서 좀 더 표준적인 포맷에 맞춰주는것이 바람직합니다. 다음은 ISO 8601 포맷의 예입니다.

2010-09-23T10:30:00+09:00

링크

링크를 표현하기 위해서는 단순히 URI를 문자열 값으로 사용하는게 가장 간편합니다.

{ "href": "http://example.com/foo/bar" }

멤버의 이름을 href, src 같이 HTML에서 자주 사용하는 태그로 맞춰두면 사용하는 사람은 이 멤버가 링크라는 것을 쉽게 파악할 수 있을것입니다.

JSONP

JSONP는 JSON with Padding 의 약자입니다.

(학습예정 - 웹을 지탱하는 기술 - 348p)

자료


 


원본 http://oiehot.com/it/language/json/

Posted by 장안동베짱e :



웹의 다양한 용도


1. 웹사이트


2. User Interface

HTML 도움말, 웹 UI for embedded systems


3. API

Web Service 라 부름




웹을 지탱하는 기술


1. HTTP, URI, HTML


2. 하이퍼미디어

비선형적 컨텐츠. 중간에 link 타고 갈 수 있고, 동영상, 다른 사이트 등을 껴 넣을 수 있다. (책은 선형)


3. 분산시스템

자료의 내용이 전세계적으로 퍼져있고, 자료의 처리도 서버와 클라이언트가 분담한다.




REST


* Architecture "Style"로 반드시 지켜야 하는게 아니라, 약간의 타협을 통해 운영 가능하다.

Server / Client

Stateless

Cache

Uniform Interface ( GET, POST, PUT, DELETE 등의 8개의 Method 만 사용 )

Layered System

Code On Demand ( Java Applet, Flash, JavaScript )




URI : Uniform Resource Identifier


ex) http://user:pass@blog.examples.com:8000/search?q=test&debug=true#n10

URI Scheme : http

User : user:pass

Host name : blog.examples.com

Port number : 8000

Path : /search

Query Parameter : q=test&debug=true

URI fragment : #n10


* URI 는 % encoding.

% encoding 에서는 대문자, 소문자 구별이 없다.

%xx 의 16진수를 기반으로 인코딩한다.


* 앞으로의 상황을 고려해서라도 UTF-8 이 가장 좋은 인코딩

UTF-8 은 한 글자가 3바이트로 세상의 모든 언어 표현가능.


* 스펙상 URI 의 길이 제한은 없으나, 대부분의 브라우저가 구현상 제한이 있다.


* URN 은 Uniform Resource Name 으로 도메인명에 종속적이지 않은 주소체계.

URL 이 영구적이라는 특성 때문에 사용하지 않는다.

URL 은 자료의 위치개념이 강하고, URI 는 specific 한 객체 자체 개념이 강하다.




URI 의 설계


* 좋은 URI 는 변하지 않는다.

프로그래밍 언어에 의존적인 확장자와 경로를 포함하지 않는다.

예) cgi-bin, .pl, servlet, .do 등


메서드명과 세션 ID 를 포함하지 않는다.

예) ?action=showPage, jsessionid=12345


URI는 리소스를 표현하는 명사로 한다.

해당 리소스를 취득할지 갱신할지 등은 HTTP 메서드로 결정한다.

리소스는 그 identification 만 표현할 수 있으면 된다.


* URI 를 변경하고 싶을 때는 301 Moved Permanently 와 함께 Location Header 에 redirect 되야 할 주소를 전달해 주어 client 에서 유기적으로 redirect 되도록 해야 한다.


* URI 설계 테크닉

구현에 의존적이지 않은 확장자로 표현을 지정한다.

언어를 지정하는 확장자( .ko, .fr )를 사용하여 불필요한 Content Negotiation 을 지양한다.

참고로 Content Negotiation 은 Accept 관련 Header 를 사용하여 한다.


계층구조를 적용하기 힘든 경우 매트릭스 URI 를 사용한다.

예) http://example.com/map/lat=35.7;lng=139.7 

     http://example.com/map/35.7, 139.75


불투명(Opaque)하게 설계해야 한다.

클라이언트 쪽에서 URI 를 구성하거나, 확장자로 리소스의 내용을 추단하거나 할 수 없게 해야 한다.


* URI 를 강하게 의식하기

URI 는 리소스 이름

URI 는 수명이 길다.

URI 는 브라우저가 어드레스 란에 표시한다.




HTTP


* HTTP 버전

0.9

팀 버너스리가 웹을 처음 발명했을 때 사용하던 녀석. 헤더가 없었고, HTTP Method 는 GET 뿐.

1.0

최초 표준화된 녀석으로, 헤더가 도입되고, HTTP Method 가 추가되었다.

1.1

현재 가장 많이 쓰이는 버전으로 Accept 헤더에 의한 Content Negotiation, Cache Control, 지속적 연결 등의 기능이 추가

이후

WebDAV 등 확장 스펙들이 공개되고, WS-* 규격이 난립. 하지만 REST 아키텍쳐로 1.1을 효과적으로 활용하자는 움직임이 강함.


* Client & Sever

클라이언트에서 일어나는 일

1. 요청 메세지 구축

2. 요청 메세지 송신

3. 응답이 돌아올 때까지 대기

4. 응답 메세지 수신

5. 응답 메세지 해석

6. 클라이언트의 목적 달성을 위한 처리





서버에서 일어나는 일

1. 요청을 대기

2. 요청 메세지 수신

3. 요청 메세지 해석

4. 적절한 애플리케이션으로 처리를 위임

5. 애플리케이션 프로그램으로부터 결과를 취득

6. 응답 메세지 구축

7. 응답 메세지 송신


* 요청 메세지

GET /test?q=test#n10 HTTP/1.1

Host:example.com:8080


POST 의 경우 Header 이후에 한 라인 CRCF 후 Body 내용이 들어갈 수 있다.


* 응답 메세지

HTTP1.1 200 OK

Content-Type:application/xhtml+xml; charset=utf-8


Body...


* Stateless 의 장점과 단점

장점

서버의 구현이 단순해진다.

단점

송신할 데이터 양이 많고, 인증과정 등이 있다면 부하가 걸리는 처리가 늘어나 퍼포먼스의 저하가 초래된다.

통신 에러에 대한 대처가 어렵다.




HTTP Method ( 총 8개 )


GET

POST

PUT

DELETE

HEAD : 헤더(메타 데이터)만 취득

OPTIONS : 서포트하는 메서드의 종류 취득

TRACE : Loop back 시험

CONNECT


* POST

POST는 보통 Resource Create 에 사용된다.

나머지 Method 로 처리불가능한 것은 모두 POST 처리 가능하긴 하다.

201 Created 를 return 할 경우 Header 의 Location 에 생성된 resource URI 를 넣어준다.


* PUT

PUT은 보통 Resource Update 와 Create 에 사용된다.

Create 에 사용되는 경우는 원하는 주소를 지정해야 한다.

Update 의 경우 변환된 내용을 반환하거나, 204 No Content 를 반환하고, Create 의 경우는 201 Created 만 반환한다.


* DELETE

Resource Delete 에 사용되며, 200 OK 나 204 No Content 를 반환한다.


* HEAD

바디부분은 받지 않는데, 네트워크 대역을 절약하면서 리소스의 크기를 비롯한 부가정보를 알기 쉽고, Content Negotiation를 수행할수도 있다.


* OPTIONS

해당 Resource 가 지원하는 메서드 목록을 받는다.

이 값은 Header 의 Allow 값에 Comma Separated 되어 전달되어온다.


* Form 태그와 HTTP Method

Form 태그의 경우 GET 과 POST 만을 지원한다.

하지만, HTTP Method 는 그 나름의 의미가 있기 때문에 Ruby 스타일의 _method 를 사용할 수 있다.

<form target="/item" action="POST">

<input type="hidden" id="_method" value="PUT"/>

...

</form>


또 다른 방법으로 X-HTTP-Method-Override 라는 방법이 있는데, 이는 POST 가 application/x-www-form-urlencoded 를 사용하여 일부 내용 전달에 어려움이 있을 때 사용된다.

이는 헤더에 내용을 전달하면 된다.


* 조건부 요청

If-Modified-Since 헤더를 이용하여, 내용이 변했을 때 GET 으로 내용을 추가 가져온다.


* 멱등성과 안정성

멱등성은 몇번을 수행해도 결과가 동일한 것을 말한다.

안정성은 리소스의 상태를 변경시키지 않는 것을 말한다.

GET, HEAD 는 멱등이고 안전.

PUT, DELETE 는 멱등이지만 안전하지 않다.

POST 는 멱등이지도 안전하지도 않다.

위의 설명은 원칙적으로 그렇지만, 메서드의 구현을 잘못 했을 경우 지켜지지 않을 수도 있다.







Status Code( 스테이터스 코드 )


* 스테이터스 코드의 분류와 의미

1xx : 처리중

처리가 계속되고 있음을 나타낸다. 클라이언트는 요청을 계속하던지 서버의 지시에 따라 업데이트하여 재전송한다.

2xx : 성공

3xx : 리다이렉트

다른 리소스로의 리다이렉트를 나타낸다. 보통 이 스테이터스 코드는 Location 헤더를 동반하고, 해당 주소로 리다이렉트한다.

4xx : 클라이언트 에러

클라이언트 요청에 에러가 있다. 에러를 해결하지 않으면 몇번을 요청해도 정상적인 결과를 얻을 수 없다.

5xx : 서버 에러

서버에 에러가 있다. 서버 측 원인이 해결되면, 동일한 요청에 정상적 결과를 얻을 수 있다.


코드의 첫글자를 통해 최소한의 처리가 가능하다.


* 자주 사용되는 스테이터스 코드

200 OK

201 Created

POST 의 경우 Location 헤더를 함께 return 한다.

301 Moved Permanently

Location 헤더를 함께 전달하여 리다이렉트를 가능하게 한다.

303 See Other

보통 POST 로 조작한 리소스를 GET 으로 가져올 때 사용

400 Bad Request

적절한 클라이언트 에러를 나타내는 코드가 없거나, 일반적인 클라이언트 에러를 나타낸다.

401 Unauthorized

인증이 실패하거나, 권한이 없는 리소스 접근할 때 발생한다. WWW-Authenticate 헤더를 통해 인증방식을 전달한다.

404 Not Found

리소스를 찾을 수 없을 때 발생

500 Internal Server Error

일반적인 서버 에러나 적절한 서버에러코드가 없을 때 사용된다.

503 Service Unavailable

서비스가 점검 등의 이유로 일시적으로 정지되었을 때 사용되며, Retry-After 헤더를 사용하여 다음 접속 시간을 권유한다.


* 각 프로그램이나 서버의 종류에 따라 스테이터스 코드를 조금씩 다르게 사용하는 경향이 있으니 주의한다.




HTTP Header ( HTTP 헤더 )


* HTTP 기본 헤더

Content-Type

미디어 타입을 지정한다.

예) application/xhtml+xml : / 왼편은 타입이고, 오른쪽은 서브타입이다.

charset 도 함께 정의하는데, 보통 UTF-8 을 사용한다.


Content-Language

예) ko-KR : - 왼편에 ISO 639 지정 언어코드가 들어가고, 오른편에는 ISO 3166 이 정의한 지역코드가 들어간다.


* Content Negotiation

Accept

예) Accept: text/html, application/xhtml+xml, application/xml; q=0.9, */*;q=0.8

q value 는 소수점 이하 세자리 이내의 0~1 사이의 수치가 들어간다.

text/html, application/xhtml+xml 의 경우 default인 1,

application/xml 은 0.9,

나머지는 0.8 의 우선순위를 가진다.


만약 클라이언트의 Aceept 헤더에 지정한 미디어 타입이 서버가 대응하는 내용이 아니면 406 Not Acceptable 을 반환한다.


Accept-Charset

예) Accept-Charset : EUC-KR,utf-8;q=0.7, */*;q=0.7


Accept-Language

예) Accept-Language: ko, en-us;q=0.7, en;q=0.3


* 기타 헤더

Content-Length

바디의 길이를 지정한다.


Transfer-Encoding:chunked

바디를 분할하여 전송한다.


* 인증 헤더

인증이 필요한 리소스를 권한 없이 접근하는 경우 401 Unauthorized 스테이터스 코드와 함께 WWW-Authenticate 헤더가 함께 리턴된다. WWW-Authenticate 에는 서버의 인증정보를 담고 있다.

예) WWW-Authenticate:Basic realm="example.com"


베이직 인증

유저 이름과 패스워드에 의한 인증방싣이다.

Authorization 헤더에 넣어 요청마다 전송해야 한다.

예) Authorization: Basc dXNlcjpwYXNzd29yZA==

Basic 인증 방식은 유저이름과 패스워드를 : 로 연결하고 Base64 로 인코딩한 문자열인데, Base64 방식은 디코딩이 간단히 된다. 따라서 Basic 인증을 사용할 경우에는 SSL, TLS 를 이용해 HTTPS 통신을 하고, 통신선로 상에서 암호화하는 것을 검토해야 한다. 이게 어렵다면 다른 인증방식을 사용해야 한다.


Digest 인증

Basic 인증보다 보안이 강화된 인증 방식이다.

메세지 다이제스트의 줄임말로 이는 어떤 메세지에 대해 해시 함수를 적용한 해시값을 말한다.

예) WWW-Authenticate: DIgest realm="example.com", nonce="1ac421d9e0a4k7q982z966p..", qop="auth", opaque="92eb5ffee5ae.."

WWW-Authenticate 의 값을 Challenge 라고 부르는데, 이 값을 이용하여 요청할 때 다시 authenticate 해서 보내야 한다.

nonce 는 number used once 의 약자로 한번만 사용되는 숫자이다. 모든 요청에 대해 매번 변한다. 이는 서버구현에 의존하는데 기본적으로 타임스탬프와 서버 고유의 어떤 값을 이용해 생성한다.

qop 는 quality of protection 의 줄임말로, auth 나 auth-init 값이 들어간다. auth의 경우 메서드와 URI로부터 다이제스트를 작성하고, auth-init 의 경우 메서드와 URI, 그리고 메세지 바디를 이용해 digest 를 작성한다. auth-init 의 경우는 메세지 전체의 보안도 보증된다.

opaque 는 클라이언트에서 추측할 수 없는 문자열이다.





(1)값 : 유저이름, realm, 패스워드는 : 로 연결하고 MD5 해시 값을 구한다.

(2)값 :메서드와 URI 패스를 : 로 연결하고 MD5 해시 값을 구한다.

(1)의 값, nonce, 클라이언트가 nonce를 보낸 횟수, cnonce, qop값, 2의 값을 : 로 연결하고 MD5 해시 값을 구한다.

이 값을 response 필드에 넣고 다시 송신해야 한다.

ex) Authorization:Digest username="user", realm="example.com", nonce="1ac421d9e...", uri="/test", qop="auth", nc=00000001, cnonce="900150983cd24fb...", response="0fde218e...", opaque="92eb5ffee5ae2..."


Digest 인증의 장점과 단점

서버에 패스워드의 해시값만 보관하면 되므로 보안 위험이 줄어든다.

Basic 인증의 경우 같은 URI 공간의 리소스라면 클라이언트는 한번 인증되면 계속 user:password 만 보내면 다시 리소스에 접근할 수 있지만, Digest 의 경우 서버로부터 nonce 를 부조건 다시 받아 계산해야 한다. 따라서 무조건 어떤 리소스든 401 Unauthorize 응답을 한번은 얻어야 한다. 그래서 Digest 인증의 경우 무거워서 보급이 잘 안 되어, 여러 서버에서 옵션으로 사용하곤 한다. https 를 대신 운영하는 곳이 많다.


WSSE 라는 표준 이외의 인증방식도 있다.


요즘은 통합 인증관리, 권한위임 등을 위한 OpenID 와 OAuth 등이 유행하고 있다.


* 캐시 해더

Pragma:no-cache

리소스를 캐시하지 말것을 말한다.


Expires

캐시의 유효기한을 나타낸다.


Cache-Control

상세한 캐시 방법을 지정한다.

예) Cache-Control:max-age:86400

86400 초 동안 캐시가 유효하다.


* 조건부 GET

If-Modified-Since 를 통해 해당 내용이 바뀌었다면 GET 해서 가져올 수 있다.

바뀌지 않았을 경우 304 Not Modified 와 Last-Modified 값이 return 된다.


If-Modified-Since 와 Last-Modified 헤더에 의존한 조건부 GET 은 편리하지만, 시계 표준차이문제나 시계기능 사용이 어려운 서버 등에서 사용하기가 어렵다. 이 때는 If-None-Match 와 ETag( 엔티티 태그) 헤더를 사용한다. ETag 는 어떤 조건에 의해 해당 파일의 변경여부를 문자열로 나타낸 값이다.


* 지속적 접속

HTTP 1.0에서는 응답이 올때마다 TCP 커넥션을 끊었지만, HTTP 1.1 에서는 접속상태를 유지한다.

Connection 헤더에 close 값을 전달했을 때 끊는 방식을 사용한다.

HTTP 1.0에서는 지속적 연결을 위해서 Keep-Alive 헤더를 사용했다.




Microformats 와 RDF

(Resource Description Framework)


* 시멘틱 웹을 위한 xml format.


* RDF 는 주어, 술어, 목적어를 이용해 웹의 리소스에 메타 데이터를 부여한다. 복잡하고, 통일성이 없고, 별도의 메타데이터 파일이나 구문에 기록이 필요하다.


* microformats 의 경우는 rel 속성을 이용하여 리소스에 메타 데이터를 부여하며, HTML 태그 안에 삽입 가능하다.


* microformats 에서 가장 많이 쓰이는 것들은 rel-license 와 rel-nofollow 이다.


* microformats 는 간단하지만, class 와 rel 속성에 값을 부여하기 때문에, 이름이 중복될 가능성이 있다.


* RDFa 는 RDF in Attribute 의 약자로 외형은 microformat 과 거의 동일하나, microformats 가 가진 이름충돌 문제를 xml의 이름공간으로 해결하는 방식이다.




ATOM


* RSS 스펙의 난립에 대응하여 확장성 있는 피드 표준 포맷을 책정한 것.


* RSS 는 주로 블로그의 신착정보를 전달하는 피드 목적으로 이용되지만, Atom 은 블로그 뿐 아니라 검색엔진이나 사진관리 등 다양한 웹 서비스의 웹 API 로 이용될 수 있다.




JSON을 이용한 크로스 도메인 통신


* JSONP

JSON with Padding 의 약자이다.

Ajax에서 이용하는 XMLHttpRequest 라는 JS 모듈은 보안상의 제한으로 인해, JS 파일을 가져왔던 동일 서버하고만 통신할 수 있다. JS 가 다른 서버와 통신할 수 있다면, 브라우저에서 입력한 정보를 부정하게 다른 서버에 전송할 수 있기 때문. 크로스 도메인 통신이란 이와는 반대되는, 불특정 다수의 도메인 서버에 접속하는 것을 말한다.

이 문제는 <script> 태그로 해결할 수 있는데, <script src="..."> 를 통해 여러 사이트의 JS 파일을 읽을 수 있다. 이는 보안제한에 해당하지 않는 문제이다. 이 성질을 이용해 callback 함수를 전달하여 다른 서버의 JS 를 통해 데이터를 받아올 수 있는데 이를 JSONP 라고 부른다.

예) <script src="http://example.com/data.json?callback=foo">




웹 서비스의 설계


* 읽기전용 웹 서비스의 설계 ( 리소스 지향 아키텍처 접근방법 )

1. 웹 서비스에서 제공할 데이터를 특정

2. 데이터를 리소스로 나눈다

3. 리소스에 URI 로 이름을 부여한다.

4. 클라이언트에 제공할 리소스의 표현을 설계한다. ( xml, json, xhtml 등 )

5. 링크와 폼을 이용해 리소스와 리소스를 연결한다.

6. 이벤트의 표준적인 코스를 검토한다.

7. 에러에 대해 검토한다. ( 존재하지 않는 URI 지정, 필수 파라미터 미지정, 지원하지 않는 메서드 사용 등 )


* 쓰기 가능한 웹 서비스의 설계

쓰기 가능한 웹 서비스는 트랜잭션, 일괄처리, 베타제어를 고려해야 해서 어렵다.

일괄처리의 경우 일부만 성공한 경우는 207 Multi-Status 와 함께 WebDAV 의 <D:multistatus>요소를 조합하는 방법과 200 OK 와 독자 포맷을 조합하는 방법으로 성공과 실패여부를 전송한다.

트랜잭션은 여러개의 처리를 Atomic 하게 처리해야 한다. 임시 Resource 에 여러차례 시도해서 모두 성공하면, 서버에 Transaction 을 하라는 명령을 내리는 방법과 서버에서 알아서 Transaction 을 구현하는 두 가지 방법이 있다.

DELETE 의 경우에 상위 리소스를 삭제했을 때, 하위리소스도 삭제할지 불가능하게 할지도 정해야 한다.

배타제어는 Mutual Exclusion 이라고 해서 Lock 을 거는 것과 같다. 이 잠금에는 비관적 잠금(Pessimistic Lock)과 낙관적 잠금(Optimistic Lock)이 있다.


Pessimistic Lock 은 경쟁상황이 아예 일어나지 않도록 하는 Lock이다.

잠금을 구현하는 방법은 WebDAV 의 LOCK/UNLOCK 을 이용하는 방법이 있다. HTTP Method로 LOCK 을 사용하는데, 이 방법으로 잠긴 리소스에 다른 user가 접속하면 423 LOCKED 가 return 된다. 잠금을 제대로 지정한 후 If 헤더로 Locktoken 을 지정하여야 해당 락을 제대로 사용할 수 있다. 잠금해제는 UNLOCK Method 를 이용해서 하며, 이 때 Lock-Token header 를 함께 전달한다. 

서버에서 Lock 을 구현하는 방법도 있는데, scope, timeout 과 같은 parameter 를 이용하는 것이 보통이다.

비관적 잠금은 시스템의 스케일이 커질수록 문제가 커진다.


Optimistic Lock 은 여러 사람이 항상 같은 리소스를 계속 편집하는 경우가 거의 없다는 전제하에 경쟁이 일어났을 때 합리적으로 대처하는 방식이다.

낙관적 잠금은 조건부 편집을 사용한다. 서버에서 전달되는 ETag 나 LastModified 값과 클라이언트에서 전달하는 If-Match Header 값을 이용하여 구현한다. If-Match 헤더를 통해 전달된 값이 valid 하지 않을 때는 412 Precondition Failed 를 return 한다. 이 때는 여러가지 처리방법이 있는데, 서버에서 리소스를 따로 저장했다가 merge 하는 방법, 클라이언트에서 reload 후 재시도 등의 방법이 대표적이다.


* 웹 서비스에서 제공하는 데이터를 특정하고 리소스로 나누는 방법.

관계 모델 ER 다이어그램 이용

중심이 되는 table 에서 정보를 추출

탑 레벨 리소스와 URI 계층구조 등을 설정하기가 어렵다.

객체 지향 모델의 클래스 다이어그램 이용

is-a, has-a 를 이용하면 탑 레벨 리소스와 URI 계층구조를 구하기 쉽다.

정보 아키텍처 이용

지식이나 데이터의 조직화를 통해 정보를 알기 쉽게 전달하는 표현기술.



출처 http://aroundck.tistory.com/2020


Posted by 장안동베짱e :





‘기즈모스피어(GizmoSphere)’는 AMD가 만든 64비트 G시리즈 프로세서(APU)를 탑재한 베어본 PC다. 기판에 PC 부품이 오밀조밀 탑재된 케이스 없는 베어본 PC라고 생각하면 된다. x86 프로세서가 탑재됐으니 윈도우 OS를 설치해 쓸 수 있다. 최신 ‘윈도우8′은 물론 ‘윈도우7′, ‘윈도우XP’ 등 옛 윈도우 OS도 얹을 수 있다. 윈도우뿐만이 아니다. 리눅스나 우분투, 안드로이드4.1(젤리빈) 등 흔히 쓰이는 오픈소스 OS를 모두 지원한다.

기즈모스피어에 쓰인 프로세서는 ‘AMD G-T40E’다. 1GHz 속도로 동작하는 듀얼코어 제품이다. DDR3 1GB 용량의 내장 램이 적용됐고, 캐시메모리는 1MB다. 기즈모스피어 설명에 따르면 최대 52.8기가플롭스(1기가플롭스는 1초에 10억회 부동소수점 연산) 수준의 부동소수점 연산 성능을 낸다.

PC라면 무릇 그래픽 처리장치(GPU)도 품고 있어야 한다. 기즈모스피어에는 AMD의 내장형 GPU ‘라데온 HD 6250′이 적용됐다. ‘다이렉트X 11’을 지원하는 것은 물론, 디스플레이포트와 HDMI 포트도 지원한다. 외부 모니터에 연결해 쓸 수 있다는 얘기다. 기즈모스피어가 지원하는 개발도구는 세이지 일렉트로닉 엔지니어링이 개발한 ‘세이지 EDK(Embedded Development Kit)’와 ‘스마트프로브(SmartProbe)’다.



예전부터 컴퓨터를 스마트폰처럼 주머니에 넣고 다니면서 쓰다가 

집이나 학교/회사 같은데서 모니터/키보드마우스만 있으면 도크같은데 꽂아 쓰는걸 상상해왔는데


일반 스마트폰들은 ARM기반이라 윈도우를 깔지 못해 실망하고 있었다.

ARM용 윈도우폰이 나오긴 했지만 x86기반 프로그램들이랑 호환이 당연히 안되고..


얼마전에 뒤늦게 라즈베리파이란걸 알게 되었는데

오늘 문득 x86기반 라이베리파이 비스무리 한것도 이제쯤이면 나오지 않았을까 해서 찾아낸 기즈모스피어!


물론 내 상상처럼 평소 스마트폰 처럼 쓰다가 집에선 도크에 꽂아쓰고.. 뭐 이런건 되지 않지만

이 정도면 들고다니다가 집이던 회사던 그냥 키보드/마우스/모니터만 꽂으면 쓸수 있을듯..


하긴, 요즘은 x86기반 테블릿pc들이 나와줘서 스마트폰처럼은 아니지만 내가 원하는걸 엇비슷하게 할 수 있긴하다.

언젠간 스마트폰도 지금 테블릿 pc처럼 쓸수 있게 되지 않을까?

아~~ 윈도우 깔린 테블릿 PC사고 싶다!!!!



원본 http://www.bloter.net/archives/161480

 

 


Posted by 장안동베짱e :

예상치 않은 USB 메모리 오류 해결 방법으로 CMD 창을 이용한 diskpart 윈도우 명령어를 통해 쉽게 해결 할 수 있습니다.

쿨펀치의 포스팅을 보시고 하나씩 따라 하시면 됩니다.

 

 

윈도우 시작 버튼 누른 후

" 실행 " 메뉴 또는 위 이미지처럼 " 검색창 " 에

1. CMD 입력.

2. 검색된 CMD 클릭.

 

 

CMD 프롬프트창이 열렸습니다.

diskpart 입력 후, 엔터키 입력.

 

 

위 순서대로 명령어 입력을 해주셔야 합니다.

중간 에 선택 적용해야 되는 부분이 있습니다.

꼭 설명을 잘 이해하신 후 따라 하셔야 USB 메모리 초기화에 큰 문제가 없습니다.

 

diskpart 명령어 설명

- list disk : 컴퓨터에 연결된 물리적인 하드디스크 & 메모리 디스크 등을 보여 줍니다.

- select disk 8 (선택 하고자 하는 디스크 숫자) : 물리적 하드디스크 & 메모리 디스크등 포맷 하고자 하는 디스크 선택.

- clean : 선택된 디스크 초기화

- create partition primary : 선택된 디스크의 전체공간을 주 파티션으로 만듭니다.

- format fs=ntfs quick : 선택된 디스크 ntfs로 빠른 포맷 합니다.

- format fs=fat32 quick : 선택된 디스크 fat32로 빠른 포맷 합니다.

- exit : 해당 명령어 밖으로 나가기 & 프롬프트 창 닫기.

 

USB 메모리 초기화 명령어 입력 순서

1. list disk

2. select disk 8 (초기화 하고자 하는 디스크 숫자를 선택 하시면 됩니다. 저는 디스크 8을 포맷하기 위해 8 선택)

3. clean

4. create partition primary

5. format fs=ntfs quick  (포맷 형식에 따라 NTFS 또는 FAT32 중 선택 포맷 하시면 됩니다.)

6. exit

7. exit

위 1. ~ 7. 순위로 명령을 입력 하시면 됩니다.

 

위 USB 메모리 초기화 명령어 입력 순서대로 따라 하셨다면.

USB 메모리 초기화 완료입니다.

 

참고!!

USB 메모리 초기화 이후 포맷 방식 변경하고자 할 때.

방법1

USB 메모리 초기화 방법 다시 실행 후 포맷 방식 변경

 

방법2

USB 메모리 초기화 이후 드라이브 속성에서 포맷 설정 변경하기

USB 메모리 초기화 이후 포맷 형식을 바꾸고 싶다면,

CMD 명령 프롬프트 창을 이용 하지 않고도 윈도우 탐색기에서 포맷 하고 하는 드라이브 마우스 우클릭 하시면 " 포맷 " 있습니다.

포맷 창이 열린 후 파일 시스템을 선택 사용자가 원하는 포맷 형식을 선택 포맷을 하시면 됩니다.

 

아참 이 방법은 USB 메모리 초기화 완료후 포맷 방식 변경 하는 법입니다.

USB 메모리 초기화 방법이 아님을 참고해 주세요. 

 

쿨펀치와 함께 USB 메모리 초기화 방법에 대해 알아봤습니다.

즐거운 컴퓨터 생활 할 수 있도록 최선을 다해 포스팅 하겠습니다.


 


출처 http://coolpunch.tistory.com/677

 


Posted by 장안동베짱e :

NT6 계열 운영체제에서 아이콘에 방패가 그려져 있고 실행시킬 때 다음의 경고 메시지가 뜬다. 
"게시자를 알 수 없는 다음 프로그램이 이 컴퓨터를 변경 할 수 있도록 허용하시겠습니까?" 
이 때 이 방법을 활용해보자. 여기서는 사용자 계정 컨트롤을 활성화시킨 다음에도 UAC를 우회할 수 있는 방법을 설명한다. 

1. 시작 메뉴에서 작업스케줄러를 입력해서 실행시킨다. 

2. 3개로 분활 된 화면 중 오른쪽 작업 창에서 [작업 만들기] 클릭 



3. [이름] 항목에 단축실행할 이름을 입력한다. 그리고 [가장 높은 수준의 권한으로 실행]을 체크한다. 



4. [동작]을 누른다.그리고 [새로 만들기]를 누른다. 


5. 프로그램의 경로를 입력하거나 [찾아보기]를 누른 후 실행 할 프로그램을 선택한다. 



이제 방금 추가한 프로그램이 추가된 것을 볼 수 있다. 



6. 노트북인 경우 [조건]에서 [전원] 부분의 체크를 [컴퓨터의 AC 전원이 켜져 있는 경우에만 작업 시작] 를 지워서 배터리 상태에서도 동작하게 한다. 



7. [설정] 에서 [요청 시 작업이 실행되도록 허용]과 [요청할 때 실행 중인 작업이 끝나지 않으면 강제로 작업 중지] 두 개만 체크되도록 한다. 



8. 이제 다시 3개의 분할 된 창영역 중에서 제일 왼쪽 [작업 스케줄러 라이브러리]를 선택한다. 
방금 만든 권한 상승된 작업이 추가되었다. 




9. 바탕화면에 바로가기를 만든다. 바탕화면 오른쪽 클릭 - [새로 만들기] - [바로 가기] 

10. [항목 위치 입력] 부분에 C:\Windows\System32\schtasks.exe /run /tn "방금만든 작업이름"과 같은 형식으로 입력한다. 

이제 작업을 실행하면 UAC 내용의 확인을 묻지 않고 작은 커맨드 창이 떴다가 바로 프로그램이 실행되는 모습을 볼 수 있다. 

바로 가기의 [속성]에서 [바로가기] - [아이콘 변경] 을 통해 해당 실행 프로그램의 아이콘으로 변경시킬 수 있다. 



 


출처 http://finder-textcube.blogspot.kr/2011/08/uac.html
원본 http://www.vistax64.com/tutorials/162976-bypass-uac.html
 

 


Posted by 장안동베짱e :
질문은 이런 내용 이었다.

현재 메모리 누수 현상이 있어
jdbc connection 관련해서 확인하고 있는데요

보통 PreparedStatement, ResultSet 사용 후 finally 절에서 close 하자나요
근데 Vector 라든지 StringBuffer 도 사용 후 null 처리를 하고 종료를 해야하는지 잘 모르겠네요

소스에서 null 된것도 있고 안된것도 있고;; 헷갈리네요
구글링 해도 잘 안나와 있고 ㅠㅜ
...

이 질문에 대한 내 생각은 이렇다...

=================================================================

*제 답변은 일반적으로 많이 사용하는 썬의 (지금은 오라클이지만.. ㅜ_ㅜ) JVM 구현을 기준으로 합니다.

의견이 상당히 많이 달려있군요. 

메모리와 관련하여

1. 객체를 사용하고 나서 null 할당하는건 코드만 더럽히는 짓이다 vs 꼭꼭 null 처리해주는 좋은습관!
2. null 을 할당하는것은 별 의미없다 vs 이건 정말 중요하다
3. null 을 할당한다면 언제 할당해야 하느냐?



이런것들은 자바를 사용하는 개발자들 사이에서 오랫동안 논란이 되어왔고 아직도 논란이 되고 있는 부분이지요. 사실상 이 논란은 자바라는 언어에서 프로그래머가 직접 메모리를 할당/관리 하지 않기때문에 발생하는 것입니다. 하지만 GC 의 원리를 이해하게되면 null 할당이 편집증걸린 프로그래머나 할만한 일은 아니라는것을 알게됩니다. 그리고, 자바라는 언어가 이런 부분들을 해소하기 위해 어떤 노력을 했는지도 알수 있지요. (뒤에 null 할당이 아닌 다른 방법으로 동일한 효과를 얻는 예제를 소개 하겠습니다.) 

위의 3가지 논란에 대해 정리하기에 앞서 한가지 모두가 인정할만한 부분을 짚고 넘어가겠습니다. 

작은 프로그램(혹은 메서드)에서는 null 할당은 큰 의미가 없습니다. 여기서 작은 프로그램이란 
  • 프로그램(혹은 메서드) 자체의 동작시간이 짧고
  • 객체의 생성이 빈번하지 않으며
  • 적은 메모리를 사용하는 
  • 메모리 누수가 문제되지 않는
  • 실행시 지정한(혹은 기본값) 힙사이즈를 채 반도 사용하지 않는
프로그램(메서드)으로 정의해 보겠습니다. (좀더 구체적으로 정의할 방법도 있겠습니다만 당장 떠오르는게 저것밖에 없네요. ^-^;;) 사실 공부하려고 짜보는 프로그램이 아닌 어느정도 규모있는 프로그램이라면 대부분 위의 네가지에 정반대되는 경우일 겁니다.  제가 계속 프로그램이라는 단어에 괄호치고 메서드라고 넣는 이유는 프로그램 전체가 위의 항목에 해당 될수도 있지만 어느 클래스의 특정 메서드가 위의 항목에 해당되는 경우도 있기 때문입니다. 이를 테면 작은 프로그램인데 몇개의 클래스에 정의된 특정 메서드들이 프로그램의 실행시간의 많은 부분을 차지한다던가 그 메서드에서만 메모리를 많이 사용한다던가 라는 상황도 있기 때문입니다. 

(프로그램(메서드)의 규모는 개발자마다 체감되는게 다르기 때문에 작다 크다 정의내리면 논란이 되는 경우가 많은데 일단 얘기를 이어나가야 하니 넘어갑시다.)

맨위에서 언급한 논란의 각각에 작은 프로그램(메서드)의 정의를 반대로 적용해 보시면 도움이 될겁니다. 정의를 반대로 적용봤을때 해당한다면 고민하지 마시고 아래의 방법을 추천드립니다.

지금 작성하고 있는 코드가 큰 프로그램(메서드)의 일부라면 항상 가능한한 모든 객체의 사용후 null 을 할당해 주어야 하며, 이것은 정말 중요한 부분입니다.

왜 위와 같이 해야하는지 몇가지 예제을 통해 살펴보도록 하겠습니다. 직접 붙여넣고 실행 해보시기 바랍니다. (실행시 VM 옵션으로 -verbose:gc 를 추가하셔서 실제 GC 가 일어나는 것을 확인해 보세요.)

첫번째 예제 : null 을 안주면 어떻게 되나?

public class GCTest {
private final static int ALLOC_SIZE = (int) (Runtime.getRuntime().maxMemory() * 0.60);

public void allocate() {

System.out.println("Before first allocation");
byte[] b = new byte[ALLOC_SIZE];
System.out.println("After first allocation");

System.out.println("Before second allocation");
byte[] b2 = new byte[ALLOC_SIZE];
System.out.println("After second allocation");

}

public static void main(String[] args) {
new GCTest().allocate();
}
}

먼저 예제를 설명 드리자면 가용한 메모리의 60% 를 allocate 라는 메서드의 첫번째 지역 변수인 b 에서 할당을 합니다. 그리고 이후에는 전혀 사용되지 않고 있지요. 그리고 나서 다시 두번째 지역변수인 b2 에서 또 60% 를 할당을 합니다. 

위의 예제의 결과는 아래 와 같습니다.

Before first allocation
After first allocation
Before second allocation
[GC 555205K->555136K(712576K), 0.0017096 secs]
[GC 555136K->555104K(712576K), 0.0045040 secs]
[Full GC 555104K->555088K(660160K), 0.0052565 secs]
[GC 555088K->555088K(712576K), 0.0071493 secs]
[Full GC 555088K->555066K(665280K), 0.0062704 secs]
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
at GCTest.allocate(GCTest.java:12)
at GCTest.main(GCTest.java:18)

첫번째 할당은 정상적으로 이뤄졌지만 두번째 할당을 진행하려고 보니 메모리가 부족한 상황이라 마이너 GC 가 발생하고 연달아 Full GC 까지 이뤄 졌습니다. 하지만 메모리는 여전히 부족합니다. 왜냐면 메서드가 반환되기 이전에는 b 의 참조가 존재하므로 (설사 사용되지 않는다 하더라도) GC 대상에서 제외되었기 때문입니다. 누가봐도 당연히 OOM (Out of memory) 가 나는 상황입니다. 또한 누가봐도 b2 를 할당하는 시점에 GC 가 일어 난다고 예상이 됩니다. (메모리가 부족한 상황에서 GC 는 반드시 일어납니다.) 

이 예제는 조건을 극단적으로 단순화 해놨을 뿐이지 규모가 큰 프로그램(메서드) 에서는 언제든 발생할 수 있는 상황입니다. 예를 들어 여러 스레드가 동작하며 각각 어떤 메서드를 실행을 하는데 그 메서드가 이런 구조라면

메서드 호출 -> 객체 잔뜩 생성 -> 객체 마구 사용(이후에는 사용안함) -> 블럭되는 I/O 처리 -> 반환

메서드가 종료되기 전까지 참조를 물고있는 사용되지 않는 지역변수들이 점점 쌓여 갈겁니다. 결국 메모리가 부족해 GC 가 수행되더라도 GC 의 대상이 되어야할 객체들은 참조를 물고 있으니 OOM(버틸수가없다) 으로 직행하는 거지요.

두번째 예제 : null 을 주면 어떻게 되나?

public class GCTest2 {
private final static int ALLOC_SIZE = (int) (Runtime.getRuntime().maxMemory() * 0.60);

public void allocate() {

System.out.println("Before first allocation");
byte[] b = new byte[ALLOC_SIZE];
System.out.println("After first allocation");
b = null;
System.out.println("After assign null to b");
System.out.println("Before second allocation");
byte[] b2 = new byte[ALLOC_SIZE];
System.out.println("After second allocation");
}
public static void main(String[] args) {
new GCTest2().allocate();
}
}

첫번째 예제와 상황은 동일합니다. 하지만 b 를 다쓰고 나서 null 할당 해주었지요.
결과는 이렇습니다.

Before first allocation
After first allocation
After assign null to b
Before second allocation
[GC 555205K->555168K(712576K), 0.0019313 secs]
[GC 555168K->555104K(712576K), 0.0027482 secs]
[Full GC 555104K->208K(105344K), 0.0509913 secs]
After second allocation

예상하셨다시피 OOM 은 일어나지 않았습니다. 앞서 언급했던 

메서드 호출 -> 객체 잔뜩 생성 -> 객체 마구 사용(이후에는 사용안함) -> 블럭되는 I/O 처리 -> 반환

이런 구조의 메서드를 

메서드 호출 -> 객체 잔뜩 생성 -> 객체 마구 사용(이후에는 사용안함) -> 마구사용한 객체 가차없이 null 할당 -> 블럭되는 I/O 처리 -> 반환

이렇식으로 수정한 것과 동일합니다. OOM 으로 직행하려다가 현명한 개발자 덕분에 GC 가 보람있는 일을 했네요. 일례로 많은 사용자를 대상으로 하는 웹어플리케이션에는 아주 딱 들어맞는 상황입니다. 특히. 웹이라는 특성상 서비스의 유형에 따라 피크타임이 존재하기 때문에 더더욱 적합합니다. (개발자의 상황에 적합하지 못한 코드 덕분에 심심하면 죽어나간 서버가 한둘이 아닙니다.)

조건을 단순화한 예제이지만 대부분의 큰 프로그램의 어딘가에서 null 할당을 해줘야 하나 말아야 하나를 고민할때 생각해 볼만한 예제라고 생각이되는군요.

적다보니 내용이 너무 길어 지는 감이 있어 앞에서 얘기한 null 할당 이외의 방법을 소개하고 끝내도록 하겠습니다. 

자바가 처음 나온후 컴퓨터 분야에서는 꽤 오랜 시간이 흘렀습니다.  VM 이 알아서 메모리를 관리해 준다는 장점은 사용하다보니 다른 문제들을 야기하게 되었습니다. 바로 "우린 좀더 GC 와 얘기하고싶다" 라는 건데요.

null 할당은 GC 가 일어나기만 하면 바로 회수해 가버리고 이후에 해당 객체를 더이상 사용할 수 없지만.

1. GC 를 한번 해보고, 메모리가 충분하다면 계속 참조하고 싶다
2. GC 가 일어나기 전까지만 계속 참조하고 싶다.
3. finalize 이후에 뭔가 더 처리 하고 싶다.

라는 요구사항들이 여기저기서 터져나오기 시작한거죠. 결국 1.2 버전에서 새로운 클래스들이 소개되기 에 이르렀는데 그게 바로 

java.lang.ref 

패키지 입니다. 현재 많은 오픈소스 캐싱 라이브러리 들이 이 패키지를 잘 활용한 예제이지요.  여기에는 딱 5개의 클래스가 존재 합니다.

Reference, PhantomReference, SoftReference, WeakReference, ReferenceQueue

입니다. 여기서 주역들은 

1. GC 를 한번 해보고, 메모리가 충분하다면 계속 참조하고 싶다 (SoftReference)
2. GC 가 일어나기 전까지만 계속 참조하고 싶다. (WeakReference)
3. finalize 이후에 뭔가 더 처리 하고 싶다. (PhantomReference)

이 3가지 클래스 입니다. 저는 WeakReference 와 SoftReference 를 소개 하겠습니다.

WeakReference 예제

import java.lang.ref.WeakReference;

public class GCTest3 {
private final static int ALLOC_SIZE = (int) (Runtime.getRuntime().maxMemory() * 0.60);
public void allocate() {
System.out.println("Before first allocation");
WeakReference<byte[]> b = new WeakReference<byte[]>(new byte[ALLOC_SIZE]);
System.out.println("After first allocation");

System.out.println("b is alive ? " + b.get());
System.out.println("Before second allocation");
byte[] b2 = new byte[ALLOC_SIZE];
System.out.println("After second allocation");
System.out.println("b is alive ? " + b.get());
}
public static void main(String[] args) {
new GCTest3().allocate();
}
}

수행 결과는 

Before first allocation
After first allocation
b is alive ? [B@64c3c749
Before second allocation
[GC 555205K->555168K(712576K), 0.0016671 secs]
[GC 555168K->555104K(712576K), 0.0015086 secs]
[Full GC 555104K->208K(105344K), 0.0562847 secs]
After second allocation
b is alive ? null

GC 한방에 날아가버렸네요.


SoftReference 예제


import java.lang.ref.SoftReference;

public class GCTest3 {
private final static int ALLOC_SIZE = (int) (Runtime.getRuntime().maxMemory() * 0.60);
public void allocate() {
System.out.println("Before first allocation");
SoftReference<byte[]> b = new SoftReference<byte[]>(new byte[ALLOC_SIZE]);
System.out.println("After first allocation");

System.out.println("b is alive ? " + b.get());
System.out.println("Before second allocation");
byte[] b2 = new byte[ALLOC_SIZE];
System.out.println("After second allocation");
System.out.println("b is alive ? " + b.get());
}
public static void main(String[] args) {
new GCTest3().allocate();
}
}


WeakReference 의 예제에서 SoftReference 로 클래스만 바뀌었습니다.

결과를 볼까요?

Before first allocation
After first allocation
b is alive ? [B@7150bd4d
Before second allocation
[GC 555205K->555136K(712576K), 0.0016918 secs]
[GC 555136K->555104K(712576K), 0.0014965 secs]
[Full GC 555104K->555088K(660160K), 0.0045636 secs]
[GC 555088K->555088K(712576K), 0.0068316 secs]
[Full GC 555088K->186K(110208K), 0.0575150 secs]
After second allocation
b is alive ? null

한번 해보고 버틸수가 없다! 이러니까. 결국 이녀석도 날아가 버렸네요.


오늘 제가 여지껏 지식인에서 했던 답변중 제일 긴 답변인것 같습니다.

꼭 도움이 됐길 바랍니다. 즐겁게 프로그래밍 하시구요~ 그럼 이만! 




원본 http://lemonfish.egloos.com/5380639




Posted by 장안동베짱e :
  • 동시 실행 문제
단순히 위와 같이 파일 경로만 정해주면,
파일이 실행된 후에 그 파일이 종료되고 커맨드가 실행창으로 넘어올 때까지 대기하게 된다.
동시 실행을 위해서는 배치 명령어 start 를 사용하면 되겠다.
start 명령어의 /d 옵션은 파일의 시작 위치를 나타내며, /b 는 새로 창을 띄우지 않겠다는 옵션이다.
(cmd 에서 start /? 으로 확인해보자)
start /d "C:\Program Files\Mozilla Firefox\" /b firefox.exe
start /d "C:\Program Files\Internet Explorer\" /b iexplore.exe

  • 배치 파일의 실행
다른 배치 파일은 call 명령어를 이용해 실행시켜야 한다.
call "C:\QuickStart\setNetworkDrive.bat"


배치 파일(.bat)로 테스트 스크립트를 작성하다보면 sleep 해야 할 경우가 생기는데 이 경우 다음과 같이 하면 된다.

ping -n 초 127.0.0.1 >nul

또는

timeout /t 초 /nobreak > NUL


timeout 은 Windows 7 에서부터 되는 거 같은데(XP에선 없었던 거 같은데..) 유용하다. /nobreak 옵션을 주면 배치 파일에서 Ctrl + C를 눌러도 멈출 수가 없으니 웬만하면 빼자-_-;;



파일 만들기(***.bat)

[방법]

c:\>copy con ***.bat

CLS

DIR

^Z

 

기본 명령어

(1) 일반적인 도스명령를 그대로 사용한다.

(2) 배치에만 사용하는 전용 명령가 있다.

  1. REM       
    : 배치파일 속에 달고 싶은 설명, 주석
  2. PAUSE     
    : 배치파일 실행중 일시 멈추게함
  3. ECHO "문자열"
    : 에코명령 다음에 오는 문자열을 화면에 나타낸다.
  4. ECHO ON
    : 이후부터 '명령어'라인을 화면에 보인다.
  5. ECHO OFF
    : 이후 실행되는 명령어 라인을 화면에 나타내지 않는다.
  6. @ECHO OFF 
    : 'ECHO OFF'라는 그 자체까지 보이지 않게 한다.
  7. ECHO
    : 현재 ECHO ON/OFF 상태를 확인한다.

분기 명령어

: 배치파일의 순차적 수행을 필요에 따라 변경할 때 사용한다.

 

(1) CALL

: 배치파일 실행 중 다른 배치파일을 호출하여 실행시키고 다시 원래의 배치파일로 돌아오게 하는 명령이다.

[문법] 

CALL "파일명"

[보기]

c:\>COPY CON file1.bat

DIR C:\ > C:DIRList.TXT

^Z

c:\>COPY CON file2.bat
CALL file1.bat
TYPE C:DIRList.TXT

^Z

[설명]

"file2.bat"을 실행하면 "file1.bat"란 배치파일을 불러(CALL) 실행하여 "DIRList.TXT"파일을 만든 후, 다시 "file2.bat"파일로 돌아와 "DIRList.TXT"파일을 화면에 출력한다.

 

(2) IF

: 주어진 조건에 따라 명령을 선별적으로 선택, 실행하는 명령이다.

[문법]

  1. IF EXIST [파일이름] [명령] 
    : 찾는 파일이 존재하면 명령을 실행하라
  2. IF NOT EXIT [파일이름] [명령] 
    : 찾는 파일이 없으면 명령을 실행하라
  3. IF "문자열1" == "문자열2" [명령]
    : "문자열1"과 "문자열2"가 서로 일치하면 명령을 실행하라.
  4. IF NOT "문자열1" == "문자열2" [명령]
    : "문자열1"과 "문자열2"가 서로 불일치하면 명령을 실행하라.
  5. IF ERRORLEVEL [값] [명령]
    : IF명령 바로 앞에서 수행되었던 프로그램이 수행을 마치면서 남긴 종료코드(ExitCode)를 검사하여 지정 값보다 크면 명령을 실행하라는 뜻이다.
  6. IF [NOT] ERRORLEVEL [값] [명령]
    : IF명령 바로 앞에서 수행되었던 프로그램이 수행을 마치면서 남긴 종료코드(ExitCode)를 검사하여 지정 값보다 작으면 명령을 실행하라는 뜻이다.

[보기]

  • IF EXIST *.BAK DEL *.BAK
    : BAK라는 백업파일이 있으면 모두 지워버리라.
  • c:\>COPY CON TEST1.BAT
    @ECHO OFF
    IF "%1" == "A" ECHO TESTING A
    IF NOT "%1" == "A" ECHO IT IS NOT EQUAL.
    ^z 
    : c:\>TEST1 A 엔터하면 화면에 "TESTING A"라고 표시한다.
    : c:\>TEST1 C 엔터하면 A와 같지 않으므로 "IT IS NOT EQUAL"라고 표시한다.
  • c:\>COPY CON XY.BAT
    XCOPY %1 A:
    IF NOT ERRORLEEVEL 0 ECHO COPY FAILED !
    IF ERRORLEVEL 0 ECHO SUCCESSFULLY !
    ^Z 
    : c:\>XY *.* 엔터하면 성공적 수행여부에 따라  'FAILED !' 또는 'SUCCESSFULLY !' 라는 메시지가 나온다.

(3) GOTO

: 레이블 이름이 있는 행으로 실행 순서를 옮긴다. '레이블(Label)'은 8자이 내로, 레이블 앞에는 콜론(:)을 사용한다.

[문법]

GOTO 레이블

:레이블

[보기]

c:\>COPY CON HWPMV.BAT
@ECHO OFF
IF NOT EXIST *.HWP GOTO FIRST
MOVE /-Y *.HWP C:\HNCDOC
ECHO HWPFILE MOVE DONE !
GOTO END
:FIRST
ECHO *.HWP FILE NOT FOUND !
:END
^Z

[설명]

"HWPMV.BAT"을 실행하면 현재 디렉토리에 있는 모든 HWP 파일을 "c:\HNCDOC" 디렉토리로 옮기고 "HWPFILE MOVE DONE !" 메시지를 화면에 보이고 END 레이블로 와서 배치파일을 종료한다. 옮길 HWP 파일이 없으면 "*.HWP FILE NOT FOUND !" 메시지가 나오고 배치파일을 종료한다.

 

(4) 변수

: 바꿔 쓸 수 있는 인자(Replaceable Parameter)를 의사변수라 하며, %0 ~ %9(10개)으로 표시한다.

[문법]

c:\>명령어 파일1 파일2   "    "   "   "   "   "          파일9
         %0      %1    %2  %3  %4  %5  %6  %7  %8  %9

[보기]

c:\>COPY CON DIRALL.BAT
DIR %1
pause
DIR %2
pause
type %0
^Z

[설명]

"c:\>DIRALL A: B:" + (엔터) 명령어 DIRALL(.BAT)은 %0, A:은 %1, B:은 %2 에 해당하므로 '작성예1'의 내용 중 %1,%2,%0에 대입하여 명령을 수행한 결과가 화면에 나오게 된다. 즉 화면에는 'DIR A:'과, 'DIR B:'이 차례로 출력되고 멈췄다가 'DIRALL.BAT' 파일 내용이 출력된다.

 

(5) 기타변수

[보기]

c:\dev\walp>test.bat
~dps0: C:\dev\walp\
~dp0: C:\dev\walp\
~s0: C:\dev\walp\test.bat
~0: test.bat
~dps0\..: C:\dev\walp\\..
~dps0..: C:\dev\walp\..


(6) SHIFT

: 쉬프트는 옮김, 변위를 의미하는 데 10개 이상의 대체 인자도 사용 가능하다. 대체인자를 한 자리씩 왼쪽으로 이동한다.

[보기]

: 지정한 문장(text) 파일들을 차례로 TYPE시키는 배치파일 예.

c:\>COPY CON TELLME.BAT
@ECHO OFF
:BEGIN
IF NOT EXIST %1 GOTO END
TYPE %1
SHIFT
GOTO BEGIN
:END
ECHO 더이상 파일이 없습니다.
^Z

[설명]

"c:\>TELLME AAA.TXT BBB.TXT CCC.TXT .........  " + (엔터)
           %0     %1       %2      %3     ........%15

텍스트 파일명은 특정해야 하며 Wildcard문자(*,?)는 사용할 수 없다. 지정된 여러 파일들에 %1 변수가 차례로 SHIFT(변위)되면서 파일을 대입시켜 내용을 출력한다.
즉, AAA.TXT가 먼저 %1이 되고, 다음 BBB.TXT, 또 CCC.TXT, ... 등이 %1에 대입된다. 계속 10개 이상의 변수도 지정할 수 있다.

지정된 파일이 모두 옮겨 대입되고 나면 배치파일이 끝나게 된다. 배치파일 내용 중 GOTO 명령에서 BEGIN 레이블로 가서 다시 시작하게하는 것을 LOOP(고리)라고 한다.

 

(7) FOR
: FOR 명령은 지정된 횟수 만큼 배치파일이 같은 명령을 계속 반복하게하는 명령, 즉 반복수행(Looping) 명령이다.

[문법]

FOR %%변수 IN (셋트 파라미터) DO [명령어] %%변수

: '(셋트 파라미터)'는 일련의 많은 갯수의 파일들을 말하고, '%%변수'는 SET에 명시된 각 파일에 순차적으로 설정되어 명령을 실행하는 대입변수이다. (셋트 파라미터에 와일드카드문자(*,?)를  사용할 수 있다.)

[보기]

: 확장명이 BAT,DOC,TXT,CAP인 문장 파일 모두를 차례로 화면에 출력(TYPE)되게 배치파일을 만들어 보자.

c:\>COPY CON TYPEALL.BAT

FOR %%Z IN (*.BAT *.DOC *.TXT *.CAP) DO TYPE %%Z
^Z



 


출처 http://ohgyun.com/173
출처 http://fuzzer4life.blogspot.kr/2013/06/sleep.html
출처 http://blog.naver.com/6420h?Redirect=Log&logNo=60095322019





Posted by 장안동베짱e :

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

어느날부터 크롬의 시작페이지가 히스토리 화면만 나오고 앱화면이나 다른기기, 최근닫은 탭 같은항목이 사려졌네요. 앱은 chrome://apps/ 를 사용하면 되지만 다른기기, 최근닫은 탭은 어떻게 방법이 없더라구요.

 그래서 찾아봤습니다.  

 

1. 크롬을 엽니다.


2. chrome://flags/ 를 주소창에 입력합니다.

 

 

그럼 이렇게 나옵니다.


3. #enable-instant-extended-api 를 찾기로 검색한 후에 내용을 '사용 중지'로 변경해 줍니다.




4. 크롬을 재시작 합니다. (자동으로 재시작하라고 뜸/안뜨기도 함)

Posted by 장안동베짱e :

안드로이드를 개발하면서 아이폰의 가장 부러운것이 기본 UI디자인 입니다.

이번에 필요했던것은 안드로이드에서 아이폰처럼 토글버튼이 슬라이딩효과를 주고 싶었던것이지요.


검색을 하다 괜찮은 곳이 있어 공유하려고 합니다.^^



아래 링크를 따라가 보시면 풀소스가 있으니 참고하시기 바랍니다.^^

https://github.com/pellucide/Android-Switch-Demo-pre-4.0



Posted by 장안동베짱e :

윈도우라 OS X TIP에서 쓰긴 뭐해서 여기에 남기네요 ㅎㅎ


구글에서 airprint activator for windows 라고 치셔서 맨위에 링크로 들어가시거나,

아님 http://stanley.thepharmacopedia.com/2012/03/25/airprint-activator-for-windows-ios5-supported/ 에 들어가셔서

다운로드 란에 있는 프로그램을 다운받으시고,

실행시키시면, 독일어로 어쩌구 저꺼구 된 창이 하나 뜰꺼에요 ㅎㅎ 



여기서 초록색 누르면 먼가 신기한 프로그램이 쉭 하고 지나가고고 독일어로 된 창이 하나 뜰겁니다. 

가볍게 넘어가주고요.

그담에 제어판 -> 장치 및 프린터에서 사용하실 프린터 우클릭, 속성 -> 공유로 가시면 


공유란에서 설치 해주시구요.

컴터 한번 재부팅 함 해주세요.

그담에 아이패드나 아이폰에서 (전 아이패드에서 실험) 프린트 기능 지원되는 어플에서, 프린트 누르시고 프린터 찾기 누르시면, 
검색이 되실겁니다. 

처음에 사용자 아뒤하고, 비번 요구하면 윈도우에서 사용하시는 계정이름하고 비번 치시면 연결이 됩니다.
(첨에만 하고 두번째엔 안 묻더군요)

사용환경은 윈도우 8에 아이패드 미니 IOS 6.1.3입니다~ 


 


출처http://cafe.naver.com/inmacbook/792297

 

 



Posted by 장안동베짱e :


Mac OS X Shortcuts

Many of these shortcuts can be customized (eg the Exposé shortcuts), as explained in Customizing shortcuts below.

Symbols seen on Mac menus and non-US Apple keyboards, with their common names
Enlarge
Symbols seen on Mac menus and non-US Apple keyboards, with their common names

Shortcuts With Global Scope

More shortcuts with global scope can be found on the Universal Access page.

command-option-escforce quit
hold command-shift-option-escape for 4 secForce quit front-most application (without confirmation)
control-ejectshow shutdown dialog
command-option-ejectsleep now
command-shift-Qlog out
command-shift-option-Qlog out without confirmation
command-control-ejectrestart
control-shift-ejectsleep displays
command-option-control-ejectshut down
command-tabcycle between open applications
command-`*after* having pressed command-tab, it will cycle between open applications in reverse
command-shift-tabcycle between open applications in reverse direction
command-`cycle between open windows in the selected application
command-shift-`cycle between open windows in the selected application in reverse direction
control-F4cycle between open windows in all applications
control-shift-F4cycle between open windows in all applications in reverse direction
F8Spaces (Leopard only)
F9Exposé for all windows (Panther and newer)
F10Exposé for all windows in selected application
F11Exposé to reveal desktop
F12Dashboard (Tiger and newer)
control-#Jump to a space (10.5+)
control-arrowCycle through spaces (10.5+)
command-spaceactivate Spotlight (Tiger) or switch between keyboard layouts (pre-Tiger systems)
command-option-spaceopen a Spotlight search in a finder "Find" window
shift-volumeChange volume without sound effect
option-shift-volumeFine-grained volume control (10.5+ ?)
option-volumeSound Preference Pane
option-brightnessDisplay Preference Pane
command-decrease-brightnessChange display mode (only on revised fn keyboard layout on Alu. keyboards, newer MBP/MBs?)
opt-"Empty Trash"Empty trash, including locked items, without any alerts
command-escapeopen front row (Press any F key (except F2) or Escape to exit)
hold shift while performing actionslow down any animation (exposé, time machine, minimize, etc)
option-drag scrollbarsmooth scrolling
option-ejectEject secondary optical media drive (if one exists)
option-click dock icon or windowSwitch to application and hide previous application
command-option-click dock icon or windowSwitch to application and hide all others
command-drag menuletre-order icon
command-drag menulet off the menu barremove icon from menu bar

Command-Tab Box

Press command-tab and hold the command key to keep the box open. Release the command key to switch to the selected application.

escapeexit command-tab box (equivalent to pressing the period key (.))
Hhide application
Qquit application
left/right arrow keys or home/end or `(grave accent)/tabselect an application (you can also aim with the mouse)
up/down arrow keysview windows of selected application (use arrow keys to navigate, then press enter to select window)


Dock

hold option while in Dock menuchange the Quit to Force Quit
option-command-drag onto Dock iconforce application to open dropped item
option-drag Dock separatorforce the Dock to only resize to non-interpolated icon sizes
command-drag Dock icon to destinationcopy a Dock item to somewhere else on the hard drive
shift-drag Dock dividermove Dock to left, bottom, or right side of screen
command-drag onto Dock iconprevent Dock icons from moving
command-click Dock iconshow dock item in Finder


Keyboard Navigation in Mac OS X Core Apps

Expose, Spaces
tab (Expose)cycle through Expose'd windows
tab (Spaces)cycle through Spaces
number (Spaces)focus specific space
c (Spaces)collect all windows in space 1
Dashboard
command-right arrowgo to next page of widgets in widget dock
command-left arrowgo to previous page of widgets in widget dock
command-+show/hide widget dock
command-Rreload widget
option-hover pointer over widgetshow close button for widget
Spotlight
escapeclear search field (press again to close menu)
tabselect current search term (equivalent to command-a)
command-entershow selected file in Finder (equivalent to command-R or command-clicking an item)
command-up arrowmove to the first result in the previous category
command-down arrowmove to the first result in the next category
Finder
shift-command-TAdd to Favorites
command-TAdd to Sidebar
escapeCancel a drag-and-drop action while dragging
option-click zoom buttonCascade all Finder windows
option-click close box or command-option-WClose all open finder windows (except popup windows)
shift-option-command-WClose all open finder windows (including popup windows)
command-KConnect to Server
option-drag fileCopy file to location
option-command-ADeselect all items
command-EEject
shift-command-deleteEmpty the Trash (with warning)
shift-option-command-deleteEmpty the Trash (without warning)
command-FFind any matching Spotlight attribute
shift-command-FFind Spotlight file name matches
shift-option-command-escapeForce Quit Finder
control-command-IGet Summary Info
command-[Go Back
command-]Go Forward
shift-command-GGo to Folder dialog (with Tab Autocomplete)
shift-command-HGo to home folder of current user
shift-command-?Mac Help
option-command-drag fileMake alias of file
command-LMake alias of the selected item
shift-option-command-up arrowMake desktop the active window, select parent volume
Page Down or control-down arrowMove down one page
command-drag fileMove file
command-deleteMove to Trash
Page Up or control-up arrowMove up one page
command-NNew Finder window
shift-command-NNew folder
option-command-NNew Smart Folder
shift-command-DOpen desktop folder
control-command-up arrowOpen enclosed folder in a new window
Space while draggingWhen dragging file onto folder it will spring open without the usual delay
shift-command-IOpen iDisk
shift-command-KOpen Network window
command-up arrowOpen parent folder (if there is no selection or open windows, open Home)
option-command-up arrowOpen parent folder, closing current folder
command-OOpen selected item
command-down arrowOpen selected item (if there is no selection or open windows, open Desktop)
option-command-down arrowOpen selected item, closing current folder
command-click sidebar iconOpen Sidebar item in a new window
shift-command-AOpen the Applications folder
shift-command-COpen the Computer window
shift-command-UOpen Utilities folder
Space or command-YQuick Look selected item
option-spacebarFullscreen quicklook selected item
Return or EnterRename the selected file/folder (escape cancels, enter accepts the changes)
double-click resize widgetResize current column to fit the longest file name
tab (shift-tab reverses direction)Select the next icon in Icon and List views
option-hover pointer over filenamesShow full name if condensed with an ellipsis
option-command-IShow Inspector (a single window that updates based on selected item or items)
command-RShow original (of alias)
command-JShow View Options
option-command-YSlideshow of selection
command-1, command-2, command-3, command-4Switch Finder views (Icon, List, Column, Cover Flow)
command-ZUndo
shift-command-ZRedo
Finder - Icon View
command-1switch to icon view
tab/shift-tabmove between icons
Finder - Column View
command-3Switch to Column View
tab/shift-tabswitch between panes
option-double-click resize widgetresize all columns to fit their longest file names
type anythingFind As You Type within the focused pane (FAYT)
rightFocus contents of selected directory in a new pane
leftgo one pane back
Finder - List View
command-2switch to list view
type anythingFind As You Type (FAYT)
tabcycle through contents of folder, wrapping around
shift tab
command-upchange working directory to parent
rightopen selected folder
left (on a file)jump to parent folder, if that folder is visible
left (on folder)close that folder, if open
option-rightopen all children of all selected folders
option-leftclose all selected folders and children
option-click disclosure triangleexpand/collapse folder and children, recursively
Cover Flow
command-4switch to cover flow view
open..., save..., browse...
/go to... dialogue, allowing one to specify full pathnames from root file. w/ Tab Autocomplete
command-shift-gGo to folder... dialogs. w/ Tab Autocomplete
tab spaceactivate disclosure triangle

Column View Note:

  • A hollow arrow indicates that the pane with the selected folder is active.
  • A solid white arrow indicates that contents of the selected folder are active in the pane to the right .
  • The behavior of FAYT/Tab in Column View is functionally equivalent to tab-autocomplete on a standard *nix shell.

Taking Screenshots

The Taking Screenshots in Mac OS X article includes keyboard shortcuts related to taking screenshots.

Dialog Boxes

enterclick the default button in dialog box (the button that is entirely blue) (The return key also works if there are no text fields that use return)
spaceclick the focused button (the button that has a blue halo around it)
option with Enter, Return, or Tabapplies that key to a text box without leaving the box
command-.cancel (equivalent to pressing the escape key)
command-Ddon’t save (in save/cancel/don’t save dialog)
command-Rreplace (in “Do you want to replace this file” dialog)
type first letter in button labelpress Button
tab (shift-tab reverses direction)tab between buttons (Full Keyboard Access must be turned on in System Preferences)

Shortcuts Common to Most Applications

hold option key with menu openshow additional menu options
spacebarsimulate a mouse click on focused object (i.e., the button or control that has a blue halo around it)
command-shift-?Search application help. As of 10.5, this also FAYT searches available menu items. It also activates the menu bar as keyboard navigable if the search string is empty.
command-shift-+increase font size
command--decrease font size
command-,preferences
command-?help
command-shift-:show spelling window
command-;check spelling
command-Aselect all
command-Ccopy
command-Dduplicate
command-shift-Cshow colors
command-Euse selection for find
command-Ffind
command-Gfind next
command-shift-Gfind previous
command-Hhide application windows
command-option-Hhide windows of other applications
command-Jscroll to selection
command-Mminimize (equivalent to double-clicking the title bar)
command-option-Mminimize all application windows (equivalent to option-double-clicking the title bar or option-clicking the minimize button)
command-Nnew
command-Oopen
command-Pprint
command-Qquit
command-Ssave
command-Ssave
command-shift-Ssave as
command-option-Ssave all
command-Tshow fonts
command-Vpaste
command-Wclose window
command-option-Wclose all application windows (equivalent to option-clicking the close button)
command-shift-Wclose a file and its associated windows
command-Xcut
command-Zundo
command-shift-Zredo

Other Application Shortcuts

command-option-Tshow/hide a toolbar
command-click toolbar lozengecycle forward through toolbar displays
command-shift-click toolbar lozengecycle backward through toolbar displays
command-drag toolbar iconre-order icon
command-drag toolbar icon off the toolbarremove icon from toolbar
command-drag title barmove window without bringing it to front
command-click file name in title barshow file path in popup


Text Shortcuts

These shortcuts can be used within all text areas in Cocoa applications.

option-left arrowmove left one word
option-right arrowmove right one word
control-deletedelete accent to left
option-deleteback delete one word
shift-option-deletefoward delete one word (equivalent to option-del)
option-up arrowmove up one paragraph
option-down arrowmove down one paragraph
command-up arrowmove to beginning of all text
command-down arrowmove to end of all text
control-left arrowmove to start of current line
command-left arrow
control-right arrowmove to end of current line
command-right arrow
shift + any of the aboveextend selection by appropriate amount
click then dragselect text
double-click then dragselect text, wrapping to word ends
triple-click then dragselect text, wrapping to paragraph ends
shift-select text with mouseadd to selection (contiguous)
command-select text with mouseadd to selection (non-contiguous)
option-dragselect rectangular area (non-contiguous)
command-option-dragadd rectangular area to selection
drag selectionmove text
option-drag selectioncopy text
command-control-Duse the dictionary to look up the word under the mouse pointer
escapeshow auto-complete list for word (equivalent to F5 or option-escape)
control-Amove to start of current paragraph
control-Bmove left one character
control-Dforwards delete
control-Emove to end of current paragraph
control-Fmove right one character
control-Hdelete
control-Kdelete remainder of current paragraph
control-Nmove down one line
control-Oinsert new line after cursor
control-Pmove up one line
control-Ttranspose (swap) two surrounding character
control-Vmove to end, then left one character
control-Ypaste text previously deleted with control-K

System startup

Hold down these keys to cause a Mac to perform special actions at startup time.

Cboot from CD or DVD
Dforce the boot device to be the internal hard drive
Tstart up in FireWire/Thunderbolt target mode (the Mac temporarily becomes a very expensive external FireWire/Thunderbolt drive)
Xforce boot into Mac OS X (older Macs that dual-boot into OS 9 and X)
Nboot from Network drive
shifthold after power-up to boot into safe mode, hold after login to prevent startup items from opening
mouse buttoneject CD before booting normally
command-Sboot into single user mode; type exit when done
command-option-O-Fboot into the Open Firmware prompt
command-option-P-Rreset PRAM
command-option-Vverbose boot; show the Unixy text goodness at boot time
command-option-shift-deletebypass internal hard drive and boot from external drive or CD
optionchoose startup disk at boot time
command-.when startup disk chooser is active, open the CD tray

Customizing shortcuts

Many system-wide shortcuts can be customized. This is described in detail in the Changing Keyboard Shortcuts article.

Shortcuts on laptops

On most Mac laptops, some of the function keys (F1 - F12) are used to control hardware features:

F1decrease brightness
F2increase brightness
F3mute on G4s, decrease volume on G3s
F4decrease volume on G4s, increase volume on G3s
F5increase volume on G4s, numlock on G3s
F6Num lock on G4s, mute on G3s
F7Display mode (mirror or extend external display)
F8disable backlit keyboards (Aluminum PowerBooks)
F9decrease keyboard brightness for backlit keyboards
F10increase keyboard brightness for backlit keyboards
F12eject (some Macs, namely all MacBooks, MacBook Pros, and newer PowerBooks, place a dedicated eject key next to the F12 key)

Newer Mac laptops (MacBook Pros made after February 2008, MacBooks after November(?) 2007, MacBook Airs), and the Aluminum keyboard, have a different layout for fn keys. Some keys have been added, while the numlock key has been removed and the display mode key has been integrated into the brightness key (see combinations in parenthesis)

F1decrease brightness (command+F1 changes display mode, option+F1 brings up display prefs)
F2increase brightness (option+F2 brings up display prefs)
F3exposé (F3 shows all windows, control+F3 shows app windows, option+F3 brings up exposé prefs, command+F3 shows desktop)
F4dashboard (option+F4 brings up exposé prefs)
F5decrease keyboard brightness for backlit keyboards (option+F5 brings up keyboard prefs)
F6increase keyboard brightness for backlit keyboards (option+F6 brings up keyboard prefs)
F7media navigation backwards (like hitting back on Apple Remote)
F8media play/pause (like hitting play/pause on Apple Remote)
F9media navigation forwards (like hitting next on Apple Remote)
F10mute volume (option+F10 brings up sound prefs)
F11decrease volume (option+shift+F11 for incremental decrease, option+F11 brings up sound prefs)
F12increase volume (option+shift+F12 for incremental increase, option+F12 brings up sound prefs)


If you want to use these function keys for standard keyboard shortcuts, you must use the fn key, located in the lower-left corner of the keyboard. For example, to use Spaces on these keyboards, you must press fn-F8; to shift between all open windows in all applications, you must press ctrl-fn-F4; etc.

This behaviour can be altered in the Keyboard tab of the Keyboard & Mouse preference pane, so that hardware functions (like screen brightness) require pressing fn, and standard keyboard shortcuts (like Spaces) work without the fn key.

Application specific shortcuts

iPhoto

command-option-backspacedelete pictures from the library from within an album
command-1,2,3,4,5rate picture

iTunes

command-option-backspacedelete songs from the library from within a playlist
command-Bshow browser
command-Lhighlight currently playing track
command-shift-Rreveal currently playing track in Finder (was command-R until iTunes 10)

MS Office 2004

Word 2004

Insert Bullet
Clear FormattingCntrl + Spacebar

Powerpoint 2004

page down while in normal view, cursor in the slide window (not notes or outline)next slide
F6/fn-F6toggle between Slide, Outline, and notes windows
control-shift-Sstart slide show from first slide
control-shift-Bstart slide show from current slide

Powerpoint 2008

F6/fn-F6 toggle has a bug where it occasionally jumps to the first slide instead of toggling cursor.




Posted by 장안동베짱e :



1. transmission-daemon 설치

#sudo apt-get install transmission-daemon


2. 설정파일 수정

#sudo vi /var/lib/transmission-daemon/info/setting.json


"download-dir": "/home/allsunday/Downloads/Torrent/download"

transmission-daemon 을 실행하는 debian-transmission 사용자가 파일을 읽고 쓸 수 있는 디렉토리여야 한다. 

"rpc-enabled": true

"rpc-authentication-required": true

"rpc-username": 유저명

"rpc-password": 패스워드

rpc-username 은 웹관리자 화면에서 사용할 id

rpc-password 는 웹관리자 화면에서 사용할 id의 password, 평문으로 저장하면 자동으로 암호화 된다.

"rpc-whitelist-enabled": false

"watch-dir": "/home/allsunday/Downloads/Torrent/download"

"watch-dir-enabled": true

watch-dir 로 설정해 놓은 디렉토리에 토렌트파일을 복사해 놓으면 자동으로 다운로드가 진행 된다.


3. 재시작

#sudo service transmission-daemon restart


4. 다운로드 테스트

http://localhost:9091/transmission/web/ 으로 접속해서 다운로드 테스트를 해본다.

watch-dir 을 samba 로 공유한 뒤 토렌트파일을 복사하여 다운로드 테스트를 해본다.



 


출처 http://redgura.tistory.com/306

 

 


Posted by 장안동베짱e :