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 확인법'이 화제를 모으고 있는 가운데...