Sunday, December 1, 2013

TextMate에서 tab 안쓰는 법

Preferences (Command + ,) 를 띄우고
Projects tab 에서
Tab bar with only one tab 의 체크를 끄면 된다.

-> 2013년 버전에서는 이게 가능했는데
2014년쯤부터는 이렇게 안된다.

기본으로 탭에서 열리는데, 탭을 더블클릭해주면 새창으로 뜨므로 특별히 불편하지는 않음.

탭에 들어 있을 때 문서간 이동 핫키는 command + { }

Friday, November 8, 2013

OS X Mavericks 에서 도입된 tab 안쓰는 법

Command + double click 해서 폴더 열때 탭에서 안열리게 하는 법
Command + , 로 파인더 preferences 로 들어가서
다음의 체크를 꺼주면 된다.

키워드 : 탭 사용 안하기, 사용 안하는 법, open folder
레퍼런스 : How Finder Tabs work in OS X Mavericks

Monday, November 4, 2013

웹브라우저별 홈페이지 세팅하는 법

다운받은 프로그램이 멋대로 웹브라우저의 홈페이지 세팅과 디폴트 검색엔진을 바꿔버리는 경우가 있다. 이것을 해결하는 법:

사파리 Safari
Preferences를 띄워서
General tab 에서
Default Search Engine 항목과
Homepage 항목을 제대로 해주면 된다.

구글 크롬 google chrome
Preferences를 띄워서
Settings 에서
맨 밑의 Show advanced settings.. 를 선택하고
다시 맨 밑으로 가서 Reset browser settings 를 한다.
그 후 Search 항목에서 검색엔진을 Google 등 자신이 원하는 것으로 바꿔준다.
New Tab page 에서 Change 를 눌러서 Open this page: 의 주소를 원하는걸로 바꿔준다 (optional)

익스플로러는 나중에 정리.

Friday, November 1, 2013

아이패드 에어 호평

"아이패드 미니는 시험판, 에어가 결정판"
외신들, 출시 앞두고 아이패드 에어 리뷰 기사 쏟아내
2013.10.30. 수 16:19 입력

Thursday, October 24, 2013

[써보니] 애플의 '공짜' OS, '매버릭스'

[써보니] 애플의 '공짜' OS, '매버릭스'
매버릭스에 추가된 아이클라우드 키체인은 각종 웹페이지의 아이디와 비밀번호를 통합 관리해주는 기능
키워드 : OS X

애플, PC OS 공짜시대 열었다

애플, PC OS 공짜시대 열었다
매버릭스 무료 배포… MS도 영향 받을 듯
2013.10.23. 수 08:35 입력

Saturday, October 19, 2013

eBook 파일 여는 어플리케이션

Calibre 가 좋다. epub, mobi 등을 열거나 다른 포맷으로 변환 가능하다.
http://calibre-ebook.com/download

Tuesday, October 15, 2013

.Webp 파일을 컨버트하는 방법

.webp 는 인터넷 상에서 이미지를 빠르게 전송하기 위해 구글이 만든 포맷으로 아직 지원하는 프로그램은 별로 없다. 변환하는 방법이 나온 웹페이지 링크는 다음과 같다.
How to Open and convert WebP Image Files
키워드 : 웹피

Sunday, October 13, 2013

USB 메모리

USB 메모리 스틱 구매시 아무 제품이나 사면 좋지 않다.
어떤 제품은 속도가 비정상적으로 느리기도 하고
어떤 제품은 잠시만 꽂아두면 뜨거워지는 기현상을 보인다.
그래서 메모리는 메이커를 잘 보고 사야 하는데
대만 업체인 ADATA 제품이 품질은 확실한 것으로 정평이 나 있다.
검색어 : 메모리 스틱 추천

Friday, October 11, 2013

윈도우8 시작프로그램 관리

시작프로그램이란 사용자가 직접 실행하지 않아도 윈도우가 켜지면서 자동으로 실행되는 것들이다. 이것이 실행되지 않도록 만드는 방법은 다음과 같다.
예를 들어 한글과컴퓨터 한글(아래아한글)를 깔면 HncUpdate.exe 가 매번 시작때마다 실행되어 업데이트를 요구하는데 이걸 방지하려 한다고 하자.
1. 윈도우키 + R 로 명령어 실행 창 띄우고 msconfig 실행.
2. 시스템구성 창이 뜨면 "시작프로그램" 탭 선택
3. "시작프로그램" 탭에서 작업관리자 열기 버튼 클릭
4. 나열된 프로그램 중에서 HANSOFT UPDATE 라는 것을 오른클릭해서 속성을 보면 HncUpdate.exe 라고 되어 있다. 이걸 사용 안하면 된다.
5. HANSOFT UPDATE에 오른클릭해서 사용안함 을 선택해준다.
레퍼런스 : http://yoogs38.egloos.com/10972848

Sunday, October 6, 2013

윈도우8에서 암호 없이 자동 로그인하는 방법

1. 시작 또는 데스크톱 화면에서 Windows + R 단축키 누름
2. 실행 화면에서 control userpasswords2를 입력한 후 [확인]을 클릭
3. 사용자 계정 화면에서 사용하는 계정을 클릭하고 [사용자 이름과 암호를 입력해야 이 컴퓨터를 사용 할 수 있음] 체크 박스의 체크를 해제한 후 [확인]을 클릭
4. 자동 로그인 화면에서 암호와 암호 확인에 해당 계정의 암호를 입력한 후 [확인]을 클릭
5. 컴퓨터를 다시 시작하여 Windows에 암호 없이 자동 로그인 되는지 확인
레퍼런스 : Windows 8에서 암호 없이 자동 로그인하는 방법

Windows Defender

윈도우8부터는 백신을 따로 깔 필요가 없다.

레퍼런스 :
윈도우8 바이러스 백신 윈도우 8 디펜더
엔하위키 > Windows Defender

윈도우7 단축키

‘투명화 · 하프 풀스크린…' 윈도우 7 단축키 10선

윈도우8의 한영 전환

과거에 타입3 방식의 shift+space 로 한영전환을 하는 방식 외에
윈도우키+Space로 한영전환 하는 법이 있다.

제어판의 '언어'에서 영어를 추가하면
윈도우키+Space 로 한글과 영어를 전환할 수 있다.
여기에 일본어를 추가하면
윈도우키+Space 로 한글・영어・일본어를 전환할 수 있다.

Saturday, October 5, 2013

LG 노트북 Z360 시리즈


부팅속도, 휴대성, 디자인, 디스플레이 등 모든 면을 종합해볼때 2013년도에 나온 윈도우 기반 노트북 중 가장 좋은것 같다.
@ LG 울트라북 Z360-GH7WK

윈도우8 재설치 하는 법

PC 복구 및 PC 초기화 관련
만약 당신의 윈도우에 문제가 생겼다면?

OS X 설치 CD

맥 OS 재설치 하는 법
2011년 8월 이후에 구입한 모든 맥은 OS 10.7이 설치되어 있습니다.(2012년 8월부터는 10.8이 설치되어 있습니다.) OS 10.7~10.8부터는 OS시디가 제공되지 않고 하드안에 OS 설치 프로그램이 파티션되어서 들어 있습니다. 그래서 부팅시 옵션키를 길게 누르고 계시면 부팅OS를 고르는 창이 나오는데 여기서 리커버리 디스크를 선택해서 부팅하시면 OS시디로 부팅된 것과 같은 상황이 되는 겁니다. 또한 하드디스크를 교체 하시는 경우에는 부팅시 옵션+커맨드+R를 누르고 계시면 인터넷 복구모드로 들어가서 애플 서버를 통해 하드에 다시 리커버리 디스크를 생성받을수 있어서 결국 시디가 없어도 됩니다.
출처 : 아이맥 샀는데요 원래 맥os 인스톨시디 안주나요

윈도우8 사용법과 단축키



윈도우8은 윈도우키와 함께 쓰이는 몇몇 단축키를 알아두면 좋다.

윈도우키 + C : 참메뉴
윈도우키 + X : 고급관리도구

윈도우키 + Q : 앱 검색
윈도우키 + W : 설정 검색
윈도우키 + F : 파일 검색

윈도우키 + E : 파일 브라우저
윈도우키 + R : 실행
윈도우키 + D : 바탕화면

윈도우키 + M : 모든 창 최소화
윈도우키 + U : 접근성 센터
윈도우키 + P : 외부 모니터 설정

레퍼런스 : 윈도우8 사용법과 단축키
http://windows.microsoft.com/ko-kr/windows-8/new-keyboard-shortcuts

Thursday, October 3, 2013

WinCDEmu

Daemon Tools 대신 쓰기 좋은 프로그램
소개글 : http://jobsblog.tistory.com/4
공식사이트 : http://wincdemu.sysprogs.org/
# 대몬, 데몬 툴즈

Tuesday, October 1, 2013

Monday, September 30, 2013

tumblr의 observer theme에서 이미지 경계 없애는 법

tumblr의 observer theme 는 가장 미니멀리즘적인 디자인이라 유용한데, 이걸 사용할때 Safari로 보면 괜찮지만 윈도우에서 익스플로러로 보면 photo 로 올린 사진들의 테두리가 굵게 나타난다.
이 테두리를 없애려면 Customize 로 들어가서 Edit Html 버튼을 누르고
.photo img, .album-art img, .videoWrapper {

}
가 있는 곳으로 찾아가 그 안에다가 border: none; 한줄을 추가하면 된다.

TextWrangler 에서 두 파일 비교하는 법

diff 또는 WinMerge 와 비슷하게 두 텍스트 파일을 비교하는 것을 별도의 유틸리티를 안깔고 TextWrangler 에서 하는 방법이 있다.
1. 비교하고자 하는 두 파일을 열고
2. 한 파일을 new window 로 띄운 후
3. 메뉴 > Search > Compare Two Front Windows
하면 된다.
키워드 : 텍스트 파일, 비교, compare, comparison, text file

Friday, September 27, 2013

트릴리안 메신저

꽤 평이 좋은 통합메신저. 맥 사용자들에게도 좋을듯하다.
한편 대다수의 맥 사용자는 Adium 통합메신저를 추천한다고 함.
맥북에어 사용기 및 활용팁 - 쓸만한 맥용 메신저
강력한 통합 메신저 trillian (트릴리안) + 메신저,메일,스카이프,트위터,페이스북 등 모든 기능을 하나로!
트릴리안 홈페이지 : https://www.trillian.im

Thursday, September 19, 2013

iOS7 정식 출시

iOS7 정식 출시, 유료 어플을 무료로 사용?…네티즌 반응 폭발!
MBN 2013-09-19 15:35
애플 iOS7로 업데이트하면 사용자 인터페이스가 플랫디자인으로 바뀌고, 안드로이드 토글 기능과 유사한 제어센터가 추가되면서 멀티태스킹 기능이 강화됩니다. 또한 그동안 유료 앱이었던 사진 편집 프로그램 ‘아이포토’ 영상 편집 프로그램 ‘아이무비’와 업무용 프로그램 모음 ‘아이웍스’(iWorks) 등의 5개 앱 역시 무료로 제공됩니다... 전세계 애플 기기 이용자들의 업데이트 수요가 한꺼번에 몰리면서 와이파이를 이용한 정식버전 업데이트는 정상적으로 이뤄지지 않는 상황. 이에 애플 기기 보유자들은 아이튠즈를 이용한 업데이트로 방향을 돌리기 시작했습니다. PC의 아이튠즈를 실행한 후 ‘업데이트 확인’을 누르면 아이튠즈가 먼저 11.1버전으로 업데이트 된 뒤 이 PC와 연결 된 애플 기기의 소프트웨어를 업데이트 할 수 있습니다.

Wednesday, September 18, 2013

스마트폰, 10초면 다 뚫린다···직접 해킹해보니

스마트폰, 10초면 다 뚫린다···직접 해킹해보니
아시아경제 2013.04.19 17:46기사입력 2013.04.19 13:42
홍동철 에스이웍스 이사는 "안드로이드 스마트폰은 소스코드가 외부에 공개됐고 애플리케이션(이하 앱) 검수도 철저하지 않기 때문에 해킹에 취약한 구조"라며 "사용자들은 의심스러운 문자나 앱에는 접근조차 하지 않아야 한다"고 말했다.

Sunday, September 15, 2013

웹 브라우저의 기본 글꼴, 가독성 좋은 글꼴로 바꾸자

웹 브라우저의 기본 글꼴, 가독성 좋은 글꼴로 바꾸자
"인터넷 익스플로러, 크롬, 파이어폭스, 오페라, 사파리의 기본 글꼴을 바꾸어 가독성이 더 좋게 만들어 봅시다. 기본 글꼴을 바꾸면 트위터의 기본 글꼴도 바뀝니다. 맑은 고딕, 나눔 고딕을 추천합니다."
→ 나눔명조도 좋다.
키워드 : 폰트, 맑은고딕, 나눔고딕

Saturday, September 14, 2013

폰트 관련

나눔명조 (Nanum Myeongjo) 가 가독성이 좋다.
폰트통 http://macnews.tistory.com/1129
참고 : 나눔고딕
키워드 : 나눔글꼴, 네이버

Friday, August 30, 2013

네이버 댓글모음 비공개하는 법

http://m.naver.com 으로 들어간다.
아무 댓글이나 하나 쓰고 댓글에서 자신의 아이디를 클릭한다.
"나의 댓글목록 공개" 를 On 에서 Off 로 바꾼다.
링크 : 네이버 댓글모음 비공개하는 법

Sunday, August 18, 2013

Squarespace

Squarespace: Build a Website
http://www.squarespace.com


Squarespace is the easiest way for anyone to create an exceptional website. 
유료 서비스임

Saturday, August 17, 2013

OS X 에서 타이머로 스크린샷 찍는 법

OS X 에 기본으로 탑재되어 있는 Grab 유틸리티를 이용한다.
메뉴에서 Timed Screen 명령을 실행하고 타이머를 시작하면 10초 이후에 스크린샷이 찍힘.
레퍼런스 : Take a Timed Screen Shot in Mac OS X
키워드 : Screenshot, screen capture, Utilities, timer

AppleScript 로 UI Scripting 하는 법 기초

사운드 preference 에서 체크박스를 토글해주는 애플스크립트를 짜보자.

우선 다음과 같이 해서 "Anchor"의 이름들을 알아낼 수 있다.
 tell application "System Preferences"  
      get the name of every anchor of pane id "com.apple.preference.sound"  
 end tell  

Script Editor 아래쪽의 Output 창에는 다음과 같이 찍힌다.
{"output", "input", "effects"}

원하는 체크박스가 "effects" 라는 anchor 밑에 있음을 알았으므로, 다음과 같이
"effects" anchor 가 나타나게 한 후,
체크박스를 클릭하게 만들면 된다.

 tell application "System Preferences"  
      reveal anchor "effects" of pane id "com.apple.preference.sound"  
 end tell  
 tell application "System Events"  
      tell process "System Preferences"  
           click checkbox 1 of tab group 1 of window 1  
      end tell  
 end tell  

응용예) 다음은 이어폰 모드와 스피커 모드를 전환해주는 애플스크립트.
이어폰을 끼기 전에는 볼륨 레벨을 낮추고 F11/F12 키로 갑자기 볼륨이 변화하는걸 막아줌. 스피커 모드를 선택하면 그 반대로 해줌.

 (*  
 on run  
      tell application "System Preferences"  
           get the name of every anchor of pane id "com.apple.preference.keyboard"  
           --> {"keyboardTab", "shortcutsTab", "keyboardTab_ModifierKeys"}  
      end tell  
 end run  
 *)  
 on run  
      set earphoneVolume to 0.1  
      set dialogResult to myMessageBox2ButtonsAndCancel("Change Sound Volume Mode to :", "Earphone", "Speaker")  
      if (dialogResult = "Cancelled") then  
           display dialog dialogResult giving up after 1  
      else  
           -- Enable Assistive Devices via Terminal   
           do shell script ¬  
                "touch /private/var/db/.AccessibilityAPIEnabled" password "q" with administrator privileges  
           if (dialogResult = "Earphone") then  
                set volume earphoneVolume  
                changeMode(1)  
                display dialog ("EARPHONE mode (Volume settings and Function key settings). volume set to " & earphoneVolume) giving up after 1  
           else  
                set volume (earphoneVolume * 2)  
                changeMode(0)  
                display dialog "SPEAKER mode (Volume settings and Function key settings)" giving up after 1  
           end if  
      end if  
 end run  
 on changeMode(earphoneMode)  
      set headphoneMode to 1 - earphoneMode  
      tell application "System Preferences"  
           set current pane to pane "com.apple.preference.keyboard"  
           reveal anchor "keyboardTab" of pane id "com.apple.preference.keyboard"  
      end tell  
      tell application "System Events"  
           if UI elements enabled then  
                tell tab group 1 of window "Keyboard" of process "System Preferences"  
                     if value of checkbox "Use all F1, F2, etc. keys as standard function keys" is headphoneMode then  
                          click checkbox "Use all F1, F2, etc. keys as standard function keys"  
                          --display dialog "clicked checkbox" giving up after 1  
                     end if  
                end tell  
           else  
                tell application "System Preferences"  
                     set current pane ¬  
                          to pane "com.apple.preference.universalaccess"  
                     display dialog ¬  
                          "UI element scripting is not enabled. Check \"Enable access for assistive devices\""  
                end tell  
           end if  
      end tell  
 end changeMode  
 on myMessageBox2ButtonsAndCancel(msg, buttonL, buttonR)  
      set userCanceled to false  
      try  
           set dialogResult to ¬  
                display dialog msg buttons {"Cancel", buttonL, buttonR} ¬  
                     default button buttonR cancel button ¬  
                     "Cancel" with title ""  
      on error number -128  
           set userCanceled to true  
      end try  
      if userCanceled then  
           return "Cancelled"  
      else  
           button returned of dialogResult  
      end if  
 end myMessageBox2ButtonsAndCancel  


키워드 : UI Scripting
레퍼런스 :
Modifying “User interface sound effects” with applescript
Why does this applescript not actually set the input volume to zero?
AppleScript Essentials - User Interface Scripting by Benjamin S. Waldie
Applescript 10.7:Can’t get anchor “FileVault” of pane id “com.apple.preference.security”

레퍼런스 (볼륨 관련):
Set incredibly precise volume levels using AppleScript
http://hints.macworld.com/article.php?story=20100226174946948

Applescript to toggle F1-F11 keys as function keys
http://forums.macrumors.com/showthread.php?t=383969

Enable and disable Assistive Devices via Terminal
http://hints.macworld.com/article.php?story=20060203225241914

Friday, August 16, 2013

TextMate 에서 현재 날짜 입력하는 방법

isoD 라고 입력하고 tab 을 치면 된다.
isoD 란, ISO 표준 형식의 date 를 말한다.
예를 들어 02/04/03 의 경우
2nd of April 2003 (European style)
4th of February 2003 (USA style)
3rd of April 2002
와 같이 여러가지로 해석될 수 있는데, 이런 혼란을 방지하기 위해
날짜 포맷을 YYYY-MM-DD 로 표준화한 것이 ISO date format 이다.
키워드 : textmate current date shortcut

Thursday, August 15, 2013

Perl 에서 Array 에 element 를 add 하기

 sub addElmtToArray  
 {  
      my $pa = shift;  
      my $elmt = shift;  
      $pa->[scalar(@$pa)] = $elmt;  
 }  
키워드 : append

Perl 에서 element 를 remove 하기

 sub removeArrayElmt  
 {  
      my $array = shift;  
      my $index = shift;  
      splice(@$array, $index, 1);       
 }  
출처 : http://perlmaven.com/splice-to-slice-and-dice-arrays-in-perl

Monday, August 12, 2013

Thursday, August 8, 2013

OS X 의 Sound 볼륨 컨트롤 관련 팁

1. Option+Shift 를 누르고 볼륨을 컨트롤하면 더 미세하게 조정된다
2. 헤드폰 사용시 실수로 볼륨을 키우고 싶지 않다면
System Preference > Keyboard 에 가서 "Use all F1, F2, ... keys as standard function keys" 의 체크를 켜준다 (그러면 F11, F12 로 볼륨 크기 조절하려면 Fn 버튼을 같이 눌러야 한다)
키워드 : 소리 크기 조절, 사운드
검색어 : google > os x volume smaller increments

Wednesday, August 7, 2013

특정 개수 문자를 제외한 부분을 얻어내는 regular expression

뒷부분 6개의 문자를 제외한 것을 추출하는 regular expression
      $num =~ m/^(\d+)(\d{6})$/;  
      print $1; print "\n";  
      print $2; print "\n";  

Regular expressions in Perl


Regular expressions in Perl

This document presents a tabular summary of the regular expression (regexp) syntax in Perl, then illustrates it with a collection of annotated examples.

Metacharacters

charmeaning
^beginning of string
$end of string
.any character except newline
*match 0 or more times
+match 1 or more times
?match 0 or 1 times; or: shortest match
|alternative
( )grouping; “storing”
[ ]set of characters
{ }repetition modifier
\quote or special
To present a metacharacter as a data character standing for itself, precede it with \ (e.g. \.matches the full stop character . only).
In the table above, the characters themselves, in the first column, are links to descriptions of characters in my The ISO Latin 1 character repertoire - a description with usage notes. Note that the physical appearance (glyph) of a character may vary from one device or program or font to another.

Repetition

a*zero or more a’s
a+one or more a’s
a?zero or one a’s (i.e., optional a)
a{m}exactly m a’s
a{m,}at least m a’s
a{m,n}at least m but at most a’s
repetition?same as repetition but the shortestmatch is taken
Read the notation a’s as “occurrences of strings, each of which matches the pattern a”. Read repetition as any of the repetition expressions listed above it. Shortest match means that the shortest string matching the pattern is taken. The default is “greedy matching”, which finds the longest match. The repetition? construct was introduced in Perl version 5.

Special notations with \

Single characters
\ttab
\nnewline
\rreturn (CR)
\xhhcharacter with hex. code hh
“Zero-width assertions”
\b“word” boundary
\Bnot a “word” boundary
Matching
\wmatches any single character classified as a “word” character (alphanumeric or “_”)
\Wmatches any non-“word” character
\smatches any whitespace character (space, tab, newline)
\Smatches any non-whitespace character
\dmatches any digit character, equiv. to [0-9]
\Dmatches any non-digit character

Character sets: specialities inside [...]

Different meanings apply inside a character set (“character class”) denoted by [...] so that, instead of the normal rules given here, the following apply:
[characters]matches any of the characters in the sequence
[x-y]matches any of the characters from x to y (inclusively) in the ASCII code
[\-]matches the hyphen character “-
[\n]matches the newline; other single character denotations with \ apply normally, too
[^something]matches any character except those that [something] denotes; that is, immediately after the leading “[”, the circumflex “^” means “not” applied to all of the rest

Examples

expressionmatches...
abcabc (that exact character sequence, but anywhere in the string)
^abcabc at the beginning of the string
abc$abc at the end of the string
a|beither of a and b
^abc|abc$the string abc at the beginning or at the end of the string
ab{2,4}can a followed by two, three or four b’s followed by a c
ab{2,}can a followed by at least two b’s followed by a c
ab*can a followed by any number (zero or more) of b’s followed by a c
ab+can a followed by one or more b’s followed by a c
ab?can a followed by an optional b followed by a c; that is, either abc or ac
a.can a followed by any single character (not newline) followed by a c
a\.ca.c exactly
[abc]any one of ab and c
[Aa]bceither of Abc and abc
[abc]+any (nonempty) string of a’s, b’s and c’s (such as aabbaacbabcacaa)
[^abc]+any (nonempty) string which does not contain any of ab and c (such as defg)
\d\dany two decimal digits, such as 42; same as \d{2}
\w+a “word”: a nonempty sequence of alphanumeric characters and low lines (underscores), such as foo and 12bar8 and foo_1
100\s*mkthe strings 100 and mk optionally separated by any amount of white space (spaces, tabs, newlines)
abc\babc when followed by a word boundary (e.g. in abc! but not in abcd)
perl\Bperl when not followed by a word boundary (e.g. in perlert but not in perl stuff)

Examples of simple use in Perl statements

These examples use very simple regexps only. The intent is just to show contexts where regexps might be used, as well as the effect of some “flags” to matching and replacements. Note in particular that matching is by defaultcase-sensitive (Abc does not match abc unless specified otherwise).
s/foo/bar/;
replaces the first occurrence of the exact character sequence foo in the “current string” (in special variable $_) by the character sequence bar; for example, foolish bigfoot would become barlish bigfoot
s/foo/bar/g;
replaces any occurrence of the exact character sequence foo in the “current string” by the character sequence bar; for example, foolish bigfoot would become barlish bigbart
s/foo/bar/gi;
replaces any occurrence of foo case-insensitively in the “current string” by the character sequence bar(e.g. Foo and FOO get replaced by bar too)
if(m/foo/)...
tests whether the current string contains the string foo



출처 : http://www.cs.tut.fi/~jkorpela/perl/regexp.html

Perl 에서 maximum value of a scalar

maximum value of a scalar

For 32-bit version of Perl, the maximum integer (without using bigint or similar) that can be stored precisely is -253 on the negative side and 253 on the positive side.

    build settingsMax positive integerMax negative integer
    32-bit ints and double floats253 = 9,007,199,254,740,992-253 = -9,007,199,254,740,992
    64-bit ints and double floats264-1 = 18,446,744,073,709,551,615-263 = 9,223,372,036,854,775,808
    64-bit ints and quadruple floats2113 = 10,384,593,717,069,655,257,060,992,658,440,192-2113 = -10,384,593,717,069,655,257,060,992,658,440,192

Tuesday, August 6, 2013

SubX : 맥에서 자막 제작하기

SubX : 맥에서 자막 제작하기
공부/맥 2012/01/10 01:38
무료 앱이며, 여기를 클릭하여 SubX 프로젝트 웹사이트에 들어가서 (Download “SubX.mac.zip”)를 클릭하면 된다. 윈도우용도 마련되어 있다.
출처 : http://il-q.tistory.com/12

Friday, August 2, 2013

좀비PC 확인법 인기

보호나라, 좀비PC 확인법 인기
한국인터넷진흥원(KISA)에서 운영하는 보호나라(www.boho.or.kr)의 '좀비 PC 확인법'이 화제를 모으고 있는 가운데...

Wednesday, July 31, 2013

VLC등에서 옛날 avi를 플레이할때 ghost가 보이는 현상 해결법

Wondershare player 사용하면 됨
(Damaged and Cannot be Opened FIX 설정해주고 쓰면 됨)

참고로 옛날 avi 가 툭툭 끊어지며 재생되는 현상이 있을 경우 MPlayerX 를 쓰면 재생이 잘되는 경우가 있음

키워드 : old, 동영상, 깨지는 현상, 고스트

Mountain Lion: Damaged and Cannot be Opened FIX

Top 4 AVI Players for Mac

Top 4 AVI Players for Mac
NO 1. How to Play AVI in Mac: Video Converter for Mac
NO 2. Download AVI player for Mac - Wondershare Player
NO 3. QuickTime + Perian
NO 4. Download AVI player for Mac — Mplayer

Saturday, July 20, 2013

OS X에서 다이얼로그 박스 버튼들을 tab 키로 옮겨다니는 방법

디폴트로는 탭이 안먹히는데 Preference 에서 다음과 같이 해주면 된다.


링크 : Use the Tab Key to Switch Between Dialog Buttons in Mac OS X

Friday, July 5, 2013

AppleScript에서의 \r과 \n

AppleScript에서의 carriage return 과 line feed 는
각각 return, linefeed 로 쓰면 된다

예)
set str to "My name is " & linefeed & "Babo"

Saturday, June 29, 2013

Tuesday, June 11, 2013

mountain lion hanging when wake from sleep

mountain lion hanging when wake from sleep

Mountain Lion won't wake up after an extended sleep
The current workarounds are:
Disable hibernate mode.
Disable standby mode.

Mountain Lion can’t Wake Up from Slumber
SEPTEMBER 5, 2012

Troubleshooting system sleep in OS X
1. Disconnect or disable peripherals
2. Reset the power manager
3. Remove the sleep image file
$ sudo rm /private/var/vm/sleepimage

Monday, June 10, 2013

.DS_Store already exists

"The operation can't be completed because an item with the name .DS_Store already exists"
이런 error message 가 뜨면서 외장하드에 카피가 안될 경우 임시 해결법

터미널에서
cp -r 소스폴더 타겟폴더
명령으로 하면 잘 된다.

근본적인 것은 OS 차원에서 문제 수정이 되어야 할듯.
키워드 : copy
출처 : https://discussions.apple.com/thread/4506193?start=0&tstart=0

OS X Finder 에서 hidden file 표시하기

터미널에서 다음을 실행하고
$ defaults write com.apple.Finder AppleShowAllFiles YES
Finder 를 Relaunch 함
출처 : Show hidden files Mac OS X 10.7 Lion and 10.8 Mountain Lion

Friday, June 7, 2013

OS X 에서 외장하드가 eject 안될때 해결법

The volume cannot be ejected because it is currently in use 메시지가 뜰때 해결법
Option + Command + Esc 해서 Finder 를 Relaunch 한다
출처 : The volume cannot be ejected because it is currently in use
키워드 : 파인더, 추출, external hard drive

Tuesday, May 21, 2013

Perl 에서 hash 의 element 수 구하기

 print scalar(keys %h);  
출처 : How can I find the number of elements in a hash?

Perl 에서 array 복사하기

다음과 같은 대입문은 어레이를 copy 즉 duplicate 함.
      my @a = (1, 2, 3, 4, 5);  
      my @b = @a;  
      for(my $i = 0; $i < scalar(@b); $i = $i + 1)  
      {  
           $b[$i] = $b[$i] + 100;  
      }  
      printArray(\@a);  
      printArray(\@b);  

Monday, May 20, 2013

Perl 에서 array 를 함수의 reference 로 pass 하는 법

 my @a = (10, 20, 30);  
 foo(\@a);  
 sub foo  
 {  
      my $pa = shift;  
      my @a = @$pa;  
      for(my $i = 0; $i < @a; $i = $i + 1)  
      {  
           print "$a[$i]\n";  
      }  
 }  

Sunday, May 19, 2013

Perl 의 array 에서 특정 value 가 element 에 존재하는지 체크하는 법

      my @a = ("A", "B", "C");  
      if(grep(/A/, @a))  
      {  
           print "found it\n";  
      }  
      else  
      {  
           print "Coudn't find it\n";  
      }  
키워드 :exists
참고링크 : How can I check if a Perl array contains a particular value?

Perl 에서 hash 를 sort 하는 법

여기 참조 : Perl 에서 hash 를 print 하는 법
sort 할때의 비교문
integer 로서 비교할 때는 <=> 를 사용하고
string 으로서 비교할 때는 cmp 를 사용한다.

Perl 에서 hash 를 함수의 reference 로 pass 하는 법

여기 참조 : Perl 에서 hash 를 print 하는 법

Perl 에서 hash 를 print 하는 법

 sub printHash_stringKey  
 {  
      my $v = shift;  
      my @keys = sort {$a cmp $b} keys %$v;  
      foreach my $key (@keys)  
      {  
           print "$key: $v->{$key}\n";  
      }  
 }  
 sub printHash_intKey  
 {  
      my $v = shift;  
      my @keys = sort {$a <=> $b} keys %$v;  
      foreach my $key (@keys)  
      {  
           print "$key: $v->{$key}\n";  
      }  
 }  
호출은 printHash(\%hash); 와 같이 하면 됨


Value 로 sort 하는 방법
 sub sortHashByValue  
 {  
      my $hash = shift;  
      my @keys = sort {$hash->{$b} <=> $hash->{$a}} keys %$hash;  
      foreach my $key (@keys)   
      {   
           print "$key: $hash->{$key}\n";  
      }  
 }  

Thursday, May 16, 2013

SlowMp3

Slow Mp3
MP3를 느리게 플레이해주는 어플리케이션
Slow MP3 is a musician's music player. It can slow down, transpose and transcribe songs on the fly. Need to learn a song in a different key from the original? No problem. Want to play a fast solo part over and over again, in half speed? Can do. Cannot identify a chord? Slow MP3 will show the notes to you.
키워드 : 재생

How to open apps from an unidentified developer in OS X Mountain Lion

How to open apps from an unidentified developer in OS X Mountain Lion
By Allyson Kazmucha, Wednesday, Aug 15, 2012 a 11:27 am

Sunday, May 5, 2013

1080p와 1080i

저마다 다른 ‘풀HD’, 기준이 뭐니
블로터닷넷 2013.05.03
‘풀HD’라는 말은 사실 정확한 규격이 아니다. 애초 하드웨어의 한계를 감추기 위한 용어에 가깝다...결론적으로 화면은 1920×1080i와 1280×720p의 해상도를 일컫는다. 이 해상도의 뒤만 따서 ’1080i’와 ’720p’라고 흔히 부른다. 언뜻 보면 1080i가 더 높은 해상도 같지만 이는 한 번에 540줄씩 홀수 짝수로 나눠서 뿌려주는 방식이고 720p는 계속해서 720줄의 화면을 보여주기 때문에 어떤 게 더 화질이 좋다고는 말하기 어렵다... TV 입장에서 보면 소스 포맷은 분명 1080p가 맞다. 그런데 송출하는 영상은 1080i다. 이걸 풀HD로 업스케일링하는 것인데, TV에 전송되는 영상은 분명 풀HD가 맞다. MP3 파일을 CD 포맷으로 바꿔 구운 것과 비슷하다.
키워드 : TV

Saturday, April 13, 2013

OS X 에서 Notes 가 저장된 위치

Notes 의 데이터는
~/Library/Containers/com.apple.Notes/Data/Library/Notes/NotesV1.storedata
같은 이름의 파일에 저장되어 있다.
Where does OS X Mountain Lion store Notes data?

Finder 의 파일명 폰트 크게 하는 법

Finder 에서 command + J (View » Show View Options) 해서 폰트 사이즈를 키워준다.
(폰트 크기는 16 까지 키울 수 있음)
"Use as defaults" 를 해준다.
키워드 : Set a larger font size for the Finder's various views

Friday, April 12, 2013

애플 '뉴 아이맥' 성능 이정도 일줄이야…

애플 '뉴 아이맥' 성능 이정도 일줄이야…
ETNews 2012.12.01
프라이메이트 랩은 아이맥을 맥 미니, 맥프로와도 성능 비교했는데, 맥미니보다는 성능이 전반적으로 뛰어났다. 맥프로와 비교한 테스트에서는 4코어 맥프로보다는 높은 성능을 보였다.. ..벤치마크 테스트는 아이맥 21.5인치 모델로 했는데 27인치 모델은... 몇 주 후 출시될 예정이다.
키워드 : new iMac

Wednesday, April 10, 2013

한국식 보안 상황에서 살아남는 법

SSL 이란 무엇인가
한국식 보안 상황에서 살아남는 법
액티브엑스 - 한국 보안을 망친 주범
키워드 : 암호화, 보안, IT 이야기-시즌2, 미닉스의 작은 이야기들 웹툰

3.20 해킹사태 원인 밝혀졌다 - 소프트포럼 '제큐어웹'

3.20 해킹사태 '원인 밝혀졌다'
MBC 2013-04-10
지난달 20일 방송사와 금융사 전산망을 마비시킨 해킹사건. 당시 악성코드가 어떻게 침투했는지 원인이 밝혀졌습니다... 인터넷 뱅킹이나 온라인 결제를 하려면 반드시 내려받아 설치해야 하는 '제큐어웹 엑티브X' 프로그램. 정부 합동조사팀은 지난 3.20 해킹 사태에 이 보안 프로그램이 이용된 사실을 확인했습니다. MBC와 KBS, 신한은행 등 6개 피해사의 업데이트 서버 관리자 PC를 분석한 결과, 모두 '제큐어웹'을 통해 악성코드가 설치됐다는 겁니다.

속수무책 당한 '제큐어웹', "국내 공인인증체계 보안 취약점 보완해야"
이투데이 : 2013-04-10 02:19
지난 3ㆍ20 전산망마비의 악성코드 유포 진원지로 알려진 '제큐어웹'은 국내 대다수 금융권과 인터넷뱅킹 사용자들이 사용하는 보안 프로그램이라는 점에서 향후 큰 파장이 예상된다. '제큐어웹'은 국내 보안업체 '소프트포럼'에서 개발한 공인인증서 보안프로그램이다.

3ㆍ20 해킹 원인으로 `제큐어 웹` 지목됐으나, 사실 여부는 파악 중
디지털타임스 : 2013-04-10 10:10
9일 정부 당국과 업계는... 제큐어 웹을 통해 악성코드가 설치된 것으로 보인다고 밝혔다. 정부 합동 조사팀도 악성코드가 지난해 6월부터 여러 차례에 걸쳐 이 프로그램을 통해 침투했다고 덧붙였다... 그러나... 의견이 분분하다. 제큐어웹의 업데이트를 통해서 악성코드가 감염됐거나 제큐어웹이 설치되는 과정에서 엑티브X가 풀릴 때 감염 됐는지 등 정확한 결론이 나온 상태가 아니기 때문이다.

제큐어웹(XecureWeb)과 초토화된 한국 보안

제큐어웹(XecureWeb)과 초토화된 한국 보안
미닉스 2013/04/09 23:40 | IT 전망
3.20 방송국, 금융권 해킹의 경로가 된 제큐어웹(XecureWeb)은 한국식 공인인증서 처리를 위한 프로그램입니다. 한마디로 말해서 한국의 보안 체계가 완전히 초토화되었다는 뜻입니다... 제큐어웹의 취약점은 지난 6월부터 알려져 있었지만 관계 당국은 이를 쉬쉬하고 있었습니다. 개인 PC까지 해킹을 당하고 알 수 없는 금융 사고가 나고 있었는데도 이를 알리지 않았습니다. 공인인증모듈 처리 프로그램이 해킹당했다는 사실을 알릴 경우 한국식 공인인증체계가 곧바로 무너질 것이기 때문입니다. 당국이 공인인증서를 처리하는 프로그램에 문제가 생겼음을 숨긴 채 은밀하게 문제를 해결해 보려고 시간을 끄는 동안 해커들은 이 취약점을 이용하여 한국의 거의 모든 금융권과 전자상거래 업체의 보안 서버를 해킹했습니다... 공인인증서를 이용하여 금융 거래를 한 개인, 온라인 쇼핑 등 전자상거래를 한 사람들의 컴퓨터는 이미 좀비가 되어 있는 상태라고 판단해도 틀리지 않습니다. 해커들이 마음만 먹는다면 지금 당장이라도 대한민국의 모든 컴퓨터에게 자살 명령을 내릴 수 있습니다. 다행히 자비로우신 해커님들께서 은행, 방송국 등 대규모 업체를 주 타깃으로 해주셨기 때문에 개인들이 아직 살아 있는 상태입니다.

MS, 윈도7 지원중단

MS, 윈도7 지원중단
윈도7 지원이 중단된다. 마이크로소프트(MS)의 지원을 계속 받으려면 '서비스팩(SP)'을 설치해야 한다. MS가 지난달부터 SP1 버전에 대한 자동업데이트를 예고했다. 윈도7 PC에 실제 적용됐는지 각 기업 관리자와 일반 사용자들의 점검이 필요하다... 9일 MS가 지원을 중단하는 대상은 SP1을 설치하지 않은 윈도7 최종판(RTM)이다. 윈도7 RTM 버전은 지난 2009년10월22일 출시됐다... 추세를 보면 윈도7 SP2가 배포될 가능성은 크지 않다. 윈도2000은 SP4까지, 윈도XP는 SP3까지, 윈도비스타는 SP2까지 나왔다. 윈도7이 SP1에서 끝나도 이상하지 않다.

Friday, April 5, 2013

차단된 사이트 접속 방법

This summary is not available. Please click here to view the post.

Thursday, April 4, 2013

IP 우회 접속 어플리케이션 TOR Vidalia

소개글
국내에서 해외 사이트를 접속할때 간혹 국내에서 접속 차단된 사이트들이 있습니다... pc에서는 ultra- surf 같은 프로그램을 이용해 ip 우회접속을 했는데 맥에서는 딱히 이런 프로그램들이 없어서 불편했었... 는데 맥에서도 이런 우회접속이 되는 프로그램이 있네요~
(출처 : http://www.albireo.net/threads/13998/)

사용법
1. Tor software bundle을 다운받아서 깔고
2. Tor Browser 를 실행시키면 자동으로 Vidalia 가 뜨면서 우회접속이 가능하도록 됨
3. Tor Browser 에서 차단된 사이트를 이용하면 됨

인터넷상에는 FireFox를 함께 이용하는 방법이 주로 소개되어 있는데 그 방식은 이제 지원되지 않음

다운로드 : Download Tor: https://www.torproject.org/projects/vidalia.html.en
위키 : http://en.wikipedia.org/wiki/Tor_(anonymity_network)

Thursday, March 28, 2013

How to download YouTube videos

How to download YouTube videos
March 5, 2013
  • Clip Converter (Web-based/Windows/Mac OS X/Free)
  • aTube Catcher (Windows/Free)
  • MacX YouTube Downloader (Mac OS X/Free)
  • Easy YouTube Video Downloader (Web-based/Free)
  • KeepVid (Web-based/Free)

Tuesday, March 26, 2013

MSX Magazine

MSX Magazine archive
http://miraigamer.net/msx/magazines/
http://www.mediafire.com/?b7d0kdv3k71m6#j6zj55mmoqjvj

ASCII MSX Magazine archive (06-1988 to summer 1992)
http://www.msx.org/news/en/ascii-msx-magazine-archive-available

MSX Fan Magazine 등
http://archive.org/details/computermagazines



키워드 : retro gaming, msx 매거진

Friday, March 22, 2013

avast!

바이러스 백신 어베스트
http://www.avastkorea.com/

Sunday, March 17, 2013

애플, 맥북프로에 삼성 부품 뺐다가 '날벼락'

애플, 맥북프로에 삼성 부품 뺐다가 '날벼락'
머니투데이 : 2013.03.17 13:14
(종합)SSD 샌디스크로 교체→팬 소음 항의… 디스플레이 'LG 제품 유령현상, 소송 제기'
애플이 특허소송전을 벌이고 있는 삼성전자 대신 다른 파트너와 손을 잡았다가 골머리를 앓고 있다. 2013년 맥북 프로에 삼성전자의 SSD(Solid State Drive) 대신 샌디스크 제품을 탑재한 후 소비자들의 팬 소음 항의에 시달리고 있다... 유령 현상은... 지난해 6월 제품이 출시된 이후 지속적으로 문제가 제기돼 왔다... 문제는 유령 현상이 LG디스플레이 패널을 채택한 맥북프로에서만 나타나고 있다는 것

Friday, March 8, 2013

Numbers , Keynote, Pages 에서 zoom 하는 법

Command + Shift + <
Command + Shift + >

Numbers 에서 여러 column 들의 width 를 조절하는 법

Cell 들을 선택하고 마우스로 그냥 위쪽의 width 조절하면 한꺼번에 조절됨
또는, Cell 들을 선택하고 Option + Command + i 한 후 다음과 같이 width 변경해주면 됨

Thursday, March 7, 2013

Keynote 에서 master slide 만드는 법

메뉴 > View > Show Master Slides
하면 왼쪽에 마스터 슬라이드들이 뜬다.
여기서 하나를 골라 에디트해주면 된다.

이렇게 만들어진 마스터슬라이드를 적용하려면
위쪽 메뉴 아이콘들 중에 Masters 를 클릭해서 고르면 된다.
키워드 : 키노트

Monday, February 25, 2013

잘 안쓰는 우측의 command 및 option 키 활용예

다음과 같이 Mission Control 과 Application Windows 에 할당해두면 유용하다


Tuesday, February 19, 2013

관리목적 공유폴더

관리목적 공유폴더
C$ 혹은 D$
C드라이브에 대한 관리목적 공유폴더입니다... 예를 들어 네트워크 상에서 다른 컴퓨터의 C$로 접근하게 되면 그 컴퓨터의 C드라이브가 우리가 흔히 보는 폴더 창으로 나타납니다. 당연히 이 폴더 창으로 그 컴퓨터 앞에서 직접하는 작업과 동일하게 모든 작업을 진행 할수 있습니다... 이것은 C드라이브를 공유폴더로 설정해 놓은 것과 같은 역할을 하며, 그로 인한 위험성도 같습니다

iMac을 샀을 때 당할 수 있는 불량

당신이 iMac을 샀을 때 당할 수 있는 불량
참고로, 여기서 겪은 불량들은 다행히도 Apple Store에서 구입하여 14일이내에 묻지마 환불, 교환이 가능했기 때문에 큰 피해는 없었다.. ..가급적 애플스토어 이용을 권하는 바이다.. ..그동안 많은 리퍼비시 제품을 구매했었으나 아이맥처럼 불량이 많이 걸린 적은 처음이었다. (사실 그동안 리퍼로 서너차례 맥북과 맥북 프로, 아이맥 등을 구매했으나 이번 알루미늄 아이맥처럼 연속 불량이 걸린게 처음. 그동안은 아무 불량이 없었음)

윈도우에서 폴더를 버추얼 드라이브로 만드는 법 - WinCDEmu

10 Free Software to Mount CD or DVD ISO Image File as Virtual Drives
Updated by Raymond - 5 months ago - Software
WinCDEmu - iso 더블클릭하면 마운트되고 iso 오른클릭하고 eject 가능

다른 방법
다음과 같이 로드하면 로드가 되긴 하는데 실제 드라이브 내의 setup.exe 등을 실행시 제대로 되지 않는다.
DOS창에서 다음 실행 :
     subst [desired drive="" name=""]: [folder path=""]
예 :
     subst j: E:\Wallpaper\Themes\Animals\Birds
출처 : How to Create Virtual Drive for Any Folder
키워드 : directory, CD, DVD, virtual daemon
검색어 : load folder as virtual drive

Sunday, February 17, 2013

파인더의 duplicate

파일 카피할때 Ctrl + C 하고 Ctrl + V 하는 대신 Ctrl + D 하면 편하다.

Friday, February 15, 2013

Using Spaces on OS X Lion

Using Spaces on OS X Lion
On Lion, Spaces tend to instead be called Desktops, ...

Thursday, February 14, 2013

LMP to reunite Apple wireless keyboard with numeric keypad

LMP to reunite Apple wireless keyboard with numeric keypad
... for people who do a lot of numeric entry—as well as audio and video professionals, who often rely on certain number pad keys for shortcuts—the keypad-less keyboard can be a major bummer...

Sunday, February 10, 2013

Why can't i download videos on keepvid? Resolved

1. Download Java SE from here : http://www.oracle.com/technetwork/java/javase/downloads/index.html
2. Install Java (Don't have to restart system)
3. Use Keepvid in Safari or Firefox (Chrome doesn't work because it's not 64 bit browser as now)


이렇게 해도 잘 안되는 경우가 있는데 이럴 떄는 동영상 다운로드용 어플리케이션을 쓰는게 좋다.

Saturday, February 9, 2013

OS X 에서 창들을 임시로 다 치우려면

Fn + F11 하면 된다.
키워드 : 데스크탑, desktop, clear

FileMerge

FileMerge : mac os x 에서 쓰기 좋은 diff 비슷한 어플리케이션.
OS X 용 Apple Developer Tool 중의 하나.
XCode 깔면 같이 깔리는 어플리케이션이다.
diff 또는 WinMerge 와 비슷.
http://en.wikipedia.org/wiki/Apple_Developer_Tools#FileMerge
osx - Graphical diff for Mac OS X - Stack Overflow
키워드 : 텍스트 파일, 비교, compare, comparison, text file

Friday, February 8, 2013

Excel에서 search and replace

엑셀에서 선택영역을 지정하고 찾기 바꾸기를 하면 selected area 에서만 replace 가 된다.
키워드 : find

Excel에서 오름차순 정렬

엑셀에서 두 column을 선택해서 오름차순 정렬을 하면 좌측의 컬럼을 기준으로 정렬이 된다.
우측의 컬럼을 기준으로 정렬하려면 "사용자 지정 정렬"을 선택해서 sort기준이 될 열을 선택하면 된다.
두 열을 함께 선택하면, 각 열이 따로따로 정렬되는 일은 생기지 않는다.

Wednesday, January 30, 2013

Saturday, January 26, 2013

Keynote 의 drawing 및 image editing 기능

Keynote versus Photoshop? Not as crazy as its sounds

Many people who use Keynote as a presentation tool may not even be aware that it comes with its own Illustrator-like Pen tool that can draw freehand vector paths, and you can expand the program’s basic shape options to make them infinitely extensible.

Select a shape, choose Format > Shape > Make Editable to make them editable (선택된 상태에서 그냥 한번 더 클릭해도 됨). You can then hold down the Alt key and click on any part of the shape’s paths to add an anchor point there, and double-clicking this point switches it between sharp angle and smooth Bézier curve, which you can further adjust by dragging Bézier handles (option 키를 누르고 드래깅하면 양쪽 핸들이 같은 길이가 됨). The same technique also works with lines, which lets you create curved arrows easily.

Wednesday, January 23, 2013

"Wide character in print" warning

검색어 : "Wide character in print" perl
레퍼런스 : Unicode-processing issues in Perl and how to cope with it
키워드 : utf-8

주어진 filepath 가 존재할 경우 available 한 다른 파일명을 얻어내는 함수

 sub availableFilename  
 {  
      my $givenFilepath = shift;  
      if(-e $givenFilepath){  
           my ($dir, $filenameOnly, $ext) = filepathParse($givenFilepath);  
           my $virgin = 1;  
           my $otherFilepath = "";  
           for(my $i = 1; $i < 80; $i++){  
                $otherFilepath = $dir . $filenameOnly . $ext;  
                if(!(-e $otherFilepath)){  
                     $virgin = 0;  
                     last;  
                }  
                $filenameOnly .= "_";  
           }  
           if($virgin){return "";}  
           else{return $otherFilepath;}  
      }else{  
           return $givenFilepath;  
      }  
 }  

Perl의 File Write

Text File 에 쓰기
 sub WriteToTextFile  
 {  
      my $outfile = shift;  
      my $text = shift;  
        
      my $errmsg = "Couldn't write to $outfile";  
      open (OUTFILE, ">$outfile") or die "$errmsg : $!";  
   
      print OUTFILE $text;  
      close OUTFILE;  
        
      print("Write success.\n");  
 }  

Binary File 에 쓰기
 sub WriteToBinFile  
 {  
      my $pa = shift;  
      my $outfile = shift;  
        
      my $buffer = "";  
      my $errmsg = "Couldn't write to $outfile";  
      open (OUTFILE, ">$outfile") or die "$errmsg : $!";  
      binmode (OUTFILE);  
        
      foreach(@$pa){  
           $buffer .= pack('C1', $_);  
      }  
   
      print OUTFILE $buffer;  
      close OUTFILE;  
        
      print("Write success.\n");  
 }  

Perl 의 regular expression 에서 문자가 몇번 repeat 되었는가 검사하는 법

인용 : When it is necessary to specify the minimum and maximum number of repeats explicitly, the bounds operator {} may be used. Thus. a{2} is the letter ‘a’ repeated exactly twice, a{2,4} represents the letter ‘a’ repeated between 2 and 4 times, and a{2,} represents the letter ‘a’ repeated at least twice with no upper limit.
검색어 : perl regular expression number repeat
출처 : Regular Expression Reference

Perl의 regular expression 에서 개행문자 포함한 모든 문자 표현하는 법

다음과 같이 /s modifier 를 써준다.
([.|\n]+ 과 같이 쓰면 원하는 대로 동작 안함)
      $text = "The quick brown\nfox jumps over the lazy dog. Hahaha.";  
      if($text =~ /^(.+)jumps/s){  
           print "MATCH\n" . $text;  
      }else{  
           print "NOT match\n" . $text;  
      }  
키워드 : all characters including newlines
레퍼런스 : Regex to match any character including new lines

Perl 에서 directory 내의 모든 file 리스팅하는 법

 #!/usr/bin/perl -w  
   
 use strict;  
 use warnings;  
   
 my $dir = "/Users/username/documents folder";  
   
 opendir(DIR, $dir) or die $!;  
   
 while (my $file = readdir(DIR)) {  
      next if ($file =~ m/^\./); # ignore filenames starting with a dot.  
      print "$file\n";  
 }  
   
 closedir(DIR);  
 exit 0;  
키워드 : folder, listing, iterate
레퍼런스 : How do I list the files in a directory?

Perl regular expression 의 ^ operator

[] 안에 쓰면 뒤에 오는 문자들에 대해 not 연산을 수행. priority 는 가장 낮다.
[^a|b] 로 쓰면 a 와 b 를 제외한 모든 문자 즉 NOT('a' OR 'b') 를 의미.

그 외의 경우에는 string 의 처음을 나타냄.

Sunday, January 20, 2013

TextWrangler 의 Balance and Fold 기능

원하는 위치에 커서를 위치시키고 Command + Shift + B 한다.
이 기능을 쓰면 커서가 있는 곳을 둘러싼 bracket 이나 parenthesis 를 fold 해준다.

긴글 혹은 텍스트 내 출처 명기 등 추가 정보를 괄호 등으로 감싸서 깨끗하게 정리하기 좋다.

Saturday, January 19, 2013

Perl 에서 sort 하기

키와 몸무게 데이터가 있다고 할때 키로 sort 해보자.
 use strict;  
 use warnings;  
 my @a = (  
      [168, 62],  
      [170, 54],  
      [168, 60],  
      [180, 100],  
 );  
 my @b = sort byHeight(@a);  
 printDS(\@b);  
 sub byHeight  
 {  
      return ($a->[1] <=> $b->[1]);  
 }  
 sub printDS  
 {  
      my $ds = shift;  
      use Data::Dumper;   
      print Dumper @$ds;  
      print "\n";  
 }  
위의 byHeight() 는 다음과 같이 한 것과 동일하다.
 
 sub byHeight  
 {  
      if($a->[0] > $b->[0]){  
           return 1;  
      }elsif($a->[0] < $b->[0]){  
           return -1;  
      }else{  
           return 0;  
      }  
 } 
키가 같은 경우 몸무게로 sort 하게 하려면 다음과 같이 하면 된다.
 sub byHeight  
 {  
      if($a->[0] > $b->[0]){  
           return 1;  
      }elsif($a->[0] < $b->[0]){  
           return -1;  
      }else{  
           return ($a->[1] <=> $b->[1]);  
      }  
 }  
키워드 : weight

Friday, January 18, 2013

Perl 에서 hash 비우기

다음과 같이 하면 된다.
 %hash = ();  
 %$hash_ref = ();  
출처 : How to clear perl hash
키워드 : empty, reference, hash table

string 의 eq 를 case insensitive 하게 하는 방법

uc() 또는 lc() 를 사용한다.
uc 는 to uppercase, lc 는 to lowercase 해주는 함수.
 if(uc("PIzzA") eq uc("PizzA")){  
      print "MATCH\n";  
 }else{  
      print "Not match\n";  
 }  
검색어 : compare, comparison, 비교, 스트링, 문자열, 대소문자

Perl 에서 hash 를 iterate 하는 법

다음과 같이 하면 된다.
방법 1
 foreach my $key ( keys %hash )  
 {  
     print "key: $key, value: $hash{$key}\n";  
 }  
key 를 한번에 임시 list 에 받아오므로 key 로 정렬 가능하나 메모리 사용량 많음

방법 2
 while ( ($key, $value) = each %hash )  
 {  
     print "key: $key, value: $hash{$key}\n";  
 }  
key 로 정렬은 못하지만 메모리 사용량 적음 (한번에 key, value pair 만큼만 메모리 사용됨)

레퍼런스 : iterate through a hash
검색어 : hash perl enumerate

Thursday, January 17, 2013

Pause/Break key의 역할

[IT강의실] 키보드의 SysRq, Scroll Lock, Pause 키는 어디에 쓰지?
동아일보 2013-01-16 16:02 최종수정 2013-01-16 17:17
PC를 켰을 때 운영체제 부팅 직전에 표시되는 바이오스(BIOS) 화면에서 Pause/Break키를 누르면 동작을 멈추게 할 수도 있다. 또한, 윈도 환경에서 윈도키와 Pause/Break키를 함께 누르면 해당 PC의 시스템정보를 볼 수 있다. 제어판에 들어갈 필요 없이 시스템 정보를 확인하고자 할 때 나름 요긴하다.

Wednesday, January 16, 2013

Perl 에서 array 를 n개의 같은 값으로 초기화하는 방법

 my $s = 6 x 10;  
 my @a = (6) x 10;  
 print $s; print "\n";  
 printDS(\@a);  
   
 sub printDS  
 {  
      my $ds = shift;  
      use Data::Dumper;   
      print Dumper @$ds;  
      print "\n";   
 }   
키워드 : same value
검색어 : perl initialize array with same number

Perl 에서 string 과 integer type conversion 하는 방법

Perl 에서는 스트링이나 숫자 타입이 별개가 아니라 Scalar 로 뭉뚱그려 사용된다. 변수 타입은 타입 정의에 의해 결정되는 것이 아니라 operand 에 의해 결정된다.
예)
 my @a = qw/100 200 300 400 500/;  # 스트링으로서 정의
 my $t = $a[2] + $a[3];   # 덧셈 operand 에 의해 숫자로 취급
 print "$a[2] + $a[3] = " . $t;   # . operand 에 의해 스트링으로 취급
 print "\n";  
   
 foreach(@a){ 
      if(/^3/){  # 스트링으로서 regular expression
           print "$_ starts with 3.\n";  
      }  
 }  
키워드 : type casting, 타입 변환, 문자열
레퍼런스 :
Automatic string to number conversion or casting in Perl
Perl: Convert from srting to number

Tuesday, January 15, 2013

Perl 에서 calculator 기능 사용하기

 my $v = eval("1+1");  
 print $v;  
실행하면 2가 찍힌다.
키워드 : evaluate, bc, 계산기

Monday, January 14, 2013

Perl 에서 sort 하기 / sort 된 array 에 새 item 삽입하기

 use strict;  
 use warnings;  
   
 test();  
   
 sub test  
 {  
        my @a = (  
               ["Hobbit", 168, 63],  
               ["Elf", 180, 54],  
               ["Dwarf", 159, 100],  
        );  
        my @b = sort byHeight(@a);  
        my @elmt = ("Human", 176, 70);  
        my @c = sort byHeight \@elmt, @b;  
          
        printDS(\@a);  
        printDS(\@b);  
        printDS(\@c);  
 }  
 sub byHeight{  
        $a->[1] <=> $b->[1];  
 }  
 sub printDS  
 {  
        my $ds = shift;  
        use Data::Dumper;   
        print Dumper @$ds;  
        print "~~~~~~~~~~~~~~~~~~~~~\n";  
 }  
레퍼런스 : Insert into a sorted array
키워드 : new element, elmt, binary search

Sunday, January 13, 2013

Saturday, January 12, 2013

Perl 에서 array of arrays 를 특정 field 로 sort 하는 법

다음 참조하기: Perl 에서 sort 하기 / sort 된 array 에 새 item 삽입하기
-------------
예를 들어 12번째 field 로 sort 한다면
@AoA = sort { $a->[12] <=> $b->[12] } @AoA
예 1:
 my @aofa = ();  
 my @a = ("Glen Benton", 92);  
 my @b = ("Jimi Hendrix", 27);  
 my @c = ("Oda Nobunaga", 47);  
 my @d = ("Christ", 33);  
 push(@aofa, \@a);  
 push(@aofa, \@b);  
 push(@aofa, \@c);  
 push(@aofa, \@d);  
   
 for (@aofa) {  
   print "@$_"; print "\n";  
 }  
 print "\n";  
   
 my @sorted = sort {$a->[1] cmp $b->[1]} @aofa;  
   
 for (@sorted) {  
   print "@$_"; print "\n";  
 }  
 print "\n";  
예 2:
 my @AoA = (  
   ['a', '2003-11-09', 'b'],  
   ['c', '2003-11-01', 'd'],  
   ['e', '2002-11-01', 'f'],  
   ['g', '2003-10-01', 'h'],  
   ['g', '2002-10-01', 'h'],  
 );  
   
 #my @new_arr = sort {$a->[0] cmp $b->[0]} @AoA;  
 my @new_arr = sort {$a->[1] cmp $b->[1]} @AoA;  
 #my @new_arr = sort {$a->[2] cmp $b->[2]} @AoA;  
   
 for (@new_arr) {  
   print "@$_"; print "\n";  
 }  
출처 : http://www.sitepoint.com/forums/showthread.php?659680-Perl-Sort-Array-of-Arrays
키워드 : 정렬

Perl에서 array 들로 이루어진 hash 의 pointer 다루기 예

1:  my %hash;  
2:    
3:  my @bee = ("Propolis", "Honey");  
4:  my @cow = ("Beef", "Milk");  
5:  my @hen = ("Chicken", "Egg");  
6:    
7:  $hash{"Bee"} = \@bee;  
8:  $hash{"Cow"} = \@cow;  
9:  $hash{"Hen"} = \@hen;  
10:    
11:  my $pHash = \%hash;  
12:    
13:  my $pa = $pHash->{"Cow"};   
14:  print(@$pa); print "\n";  
15:  print($pa->[0]); print "\t";  
16:  print($pa->[1]); print "\n";  

Friday, January 11, 2013

Perl 에서 Hash table sort 하기기

key 로 sort 하기
 sub sortByKeySample  
 {  
         # define a hash  
         my %v = (20 => "Bee", 30 => "Aeron", 10 => "Dog", 40 => "Cat");  
   
         # sort by value and put the keys in an array   
         my @keys = sort {$a <=> $b} keys %v;  
           
         # loop through array to print the hash pairs ordered  
         foreach my $key (@keys)  
         {  
          print "$key: $v{$key}\n";  
         }  
 }  
value 로 sort 하기 (ascending order)
 sub sortByValueSample  
 {  
         # define a hash  
         my %v = (v1 => 75, v2 => 251, v3 => 3, v4 => 12);  
   
         # sort by value and put the keys in an array   
         my @keys = sort {$v{$a} <=> $v{$b}} keys %v;  
           
         # loop through array to print the hash pairs ordered  
         foreach my $key (@keys)  
         {  
          print "$key: $v{$key}\n";  
         }  
 }  
value 로 sort 하기 (descending order)
 sub sortByValueDescendingSample  
 {  
         # define a hash  
         my %v = (v1 => 75, v2 => 251, v3 => 3, v4 => 12);  
   
         # sort by value and put the keys in an array   
         my @keys = sort {$v{$b} <=> $v{$a}} keys %v;  
           
         # loop through array to print the hash pairs ordered  
         foreach my $key (@keys)  
         {  
          print "$key: $v{$key}\n";  
         }  
 }  
레퍼런스 : Perl sort Function
키워드 : 해쉬, dictionary, 사전, 정렬

Wednesday, January 9, 2013

Perl script 자신의 이름 얻어내는 법

command line 에서 타이핑된 Perl command 의 이름을 얻으려면
$0 로 받으면 된다.
 print($0 . "\n");  

Perl 내부에서 bash script 호출하는 법

다음과 같이 하면 된다.
system('ls -l');
키워드 : call, 안쪽, 시스템, 유닉스 명령어, UNIX command

Saturday, January 5, 2013

Perl 의 array pointer 에서 array 멤버 개수 알아내기

last index 는 $#$pa 이므로 여기에 하나 더하면 멤버 개수가 되고
print($#$pa + 1);

scalar 값으로 받아도 된다.
print(scalar(@$pa));

키워드 : element, elmt, number of, count, pointers, list

Perl 에서 array pointer 와 복사

my @a = @$pa;
위와 같이 하면 $pa 가 가리키는 내용물이 모두 @a 로 카피된다.
reference 만 얻어지는 것이 아님.
키워드 : copy

Perl 에서 주어진 path 를 parsing 해서 directory, extension, filename 을 알아내는 방법

다음과 같이 한다.
         use File::Basename;
         my @a = fileparse("/foo/bar/baz.txt", qr/\.[^.]*/);  
         print "dir : $a[1]\n";  
         print "file : $a[0]\n";  
         print "ext : $a[2]\n";  
다음과 같은 함수를 만들어두면 좀더 직관적으로 쓸 수 있다.
 use File::Basename;
 sub filepathParse  
 {  
      my @a = fileparse(shift, qr/\.[^.]*/);  
      return ($a[1], $a[0], $a[2]);  
 }  
검색어 : perl path manipulation, filename
키워드 : pathname, basename, string, filenameOnly
레퍼런스 : http://perldoc.perl.org/File/Basename.html

Perl 의 file test 문

-r File is readable by effective uid/gid.
-w File is writable by effective uid/gid.
-x File is executable by effective uid/gid.
-o File is owned by effective uid.

-R File is readable by real uid/gid.
-W File is writable by real uid/gid.
-X File is executable by real uid/gid.
-O File is owned by real uid.

-e File exists.
-z File has zero size (is empty).
-s File has nonzero size (returns size in bytes).

-f File is a plain file.
-d File is a directory.
-l File is a symbolic link.
-p File is a named pipe (FIFO), or Filehandle is a pipe.
-S File is a socket.
-b File is a block special file.
-c File is a character special file.
-t Filehandle is opened to a tty.

키워드 : flags
How can I check if a file exists in Perl?