목요일, 9월 30, 2010

[Editor][Emacs] Emacs Manual

Emacs Manual


:: GNU Emacs Manual
 - Source: http://www.delorie.com/gnu/docs/emacs/emacs_toc.html#SEC_Contents



:: Quick EMACS Commands
 - Source: http://xkahn.zoned.net/help/emacs.html
---------------
[Quitting EMACS:]
Quit:    Ctrl-x Ctrl-c
I pushed the wrong key. Help!:    Ctrl-g
---------------
[Working with files:]
Load a file:    Ctrl-x Ctrl-f
Load a directory:    Ctrl-x Ctrl-f
New file:    Ctrl-x Ctrl-f
Save a file:    Ctrl-x Ctrl-s
Save all open files:    Ctrl-x s
Save the file with a new name    Ctrl-x Ctrl-w
---------------
[Dealing with Buffers]
Switch buffers:    Ctrl-x b
Close buffer:    Ctrl-x k
Split current buffer    Ctrl-x 2
Make current buffer the only one on screen    Ctrl-x 1
Switch between the buffers on-screen    Ctrl-x o
---------------
[Cutting and pasting]
Set mark:    Ctrl-[SPACE]
Cut and save text from here to mark:    Ctrl-w
Paste saved text:    Ctrl-y
Cut text from the cursor to the end of the line:    Ctrl-k
---------------



:: Emacs Command Summary
 - Source: http://www.cs.rutgers.edu/LCSR-Computing/some-docs/emacs-chart.html
---------------
Emacs Command Summary
Emacs command summary, Thu Jul 25.

C-SP     set-mark-command         C-q      quoted-insert
C-a      beginning-of-line         C-r      isearch-backward
C-b      backward-char             C-s      isearch-forward
C-c      exit-recursive-edit         C-t      transpose-chars
C-d      delete-char             C-u      universal-argument
C-e      end-of-line             C-v      scroll-up
C-f      forward-char             C-w      kill-region
C-h      help-command             C-x      Control-X-prefix
TAB      indent-for-tab-command         C-y      yank
LFD      newline-and-indent         C-z      suspend-emacs
C-k      kill-line             ESC      ESC-prefix
C-l      recenter             C-]      abort-recursive-edit
RET      newline             C-_      undo
C-n      next-line             SPC .. ~        self-insert-command
C-o      open-line             DEL      delete-backward-char
C-p      previous-line

C-h v    describe-variable         C-h d    describe-function
C-h w    where-is             C-h k    describe-key
C-h t    help-with-tutorial         C-h c    describe-key-briefly
C-h s    describe-syntax         C-h b    describe-bindings
C-h n    view-emacs-news         C-h a    command-apropos
C-h C-n  view-emacs-news         C-h C-d  describe-distribution
C-h m    describe-mode             C-h C-c  describe-copying
C-h l    view-lossage             C-h ?    help-for-help
C-h i    info                 C-h C-h  help-for-help
C-h f    describe-function

C-x C-a  add-mode-abbrev         C-x 5    split-window-horizontally
C-x C-b  list-buffers             C-x ;    set-comment-column
C-x C-c  save-buffers-kill-emacs     C-x <    scroll-left
C-x C-d  list-directory             C-x =    what-cursor-position
C-x C-e  eval-last-sexp             C-x >    scroll-right
C-x C-f  find-file             C-x [    backward-page
C-x C-h  inverse-add-mode-abbrev     C-x ]    forward-page
C-x TAB  indent-rigidly             C-x ^    enlarge-window
C-x C-l  downcase-region         C-x `    next-error
C-x C-n  set-goal-column         C-x a    append-to-buffer
C-x C-o  delete-blank-lines         C-x b    switch-to-buffer
C-x C-p  mark-page             C-x d    dired
C-x C-q  toggle-read-only         C-x e    call-last-kbd-macro
C-x C-r  find-file-read-only         C-x f    set-fill-column
C-x C-s  save-buffer             C-x g    insert-register
C-x C-t  transpose-lines         C-x h    mark-whole-buffer
C-x C-u  upcase-region             C-x i    insert-file
C-x C-v  find-alternate-file         C-x j    register-to-dot
C-x C-w  write-file             C-x k    kill-buffer
C-x C-x  exchange-dot-and-mark         C-x l    count-lines-page
C-x C-z  suspend-emacs             C-x m    mail
C-x ESC  repeat-complex-command         C-x n    narrow-to-region
C-x $    set-selective-display         C-x o    other-window
C-x (    start-kbd-macro         C-x p    narrow-to-page
C-x )    end-kbd-macro             C-x q    kbd-macro-query
C-x +    add-global-abbrev         C-x r    copy-rectangle-to-register
C-x -    inverse-add-global-abbrev     C-x s    save-some-buffers
C-x .    set-fill-prefix         C-x u    advertised-undo
C-x /    dot-to-register         C-x w    widen
C-x 0    delete-window             C-x x    copy-to-register
C-x 1    delete-other-windows         C-x {    shrink-window-horizontally
C-x 2    split-window-vertically     C-x }    enlarge-window-horizontally
C-x 4    ctl-x-4-prefix             C-x DEL  backward-kill-sentence

ESC C-SP mark-sexp             ESC =    count-lines-region
ESC C-a  beginning-of-defun         ESC >    end-of-buffer
ESC C-b  backward-sexp             ESC @    mark-word
ESC C-c  exit-recursive-edit         ESC O    ??
ESC C-d  down-list             ESC [    backward-paragraph
ESC C-e  end-of-defun             ESC \    delete-horizontal-space
ESC C-f  forward-sexp             ESC ]    forward-paragraph
ESC C-h  mark-defun             ESC ^    delete-indentation
ESC LFD  indent-new-comment-line     ESC a    backward-sentence
ESC C-k  kill-sexp             ESC b    backward-word
ESC C-n  forward-list             ESC c    capitalize-word
ESC C-o  split-line             ESC d    kill-word
ESC C-p  backward-list             ESC e    forward-sentence
ESC C-s  isearch-forward-regexp         ESC f    forward-word
ESC C-t  transpose-sexps         ESC g    fill-region
ESC C-u  backward-up-list         ESC h    mark-paragraph
ESC C-v  scroll-other-window         ESC i    tab-to-tab-stop
ESC C-w  append-next-kill         ESC j    indent-new-comment-line
ESC ESC  ??                 ESC k    kill-sentence
ESC C-\  indent-region             ESC l    downcase-word
ESC SPC  just-one-space             ESC m    back-to-indentation
ESC !    shell-command             ESC q    fill-paragraph
ESC $    spell-word             ESC r    move-to-window-line
ESC %    query-replace             ESC t    transpose-words
ESC '    abbrev-prefix-mark         ESC u    upcase-word
ESC (    insert-parentheses         ESC v    scroll-down
ESC )    move-past-close-and-reindent     ESC w    copy-region-as-kill
ESC ,    tags-loop-continue         ESC x    execute-extended-command
ESC -    negative-argument         ESC y    yank-pop
ESC .    find-tag             ESC z    zap-to-char
ESC 0 .. ESC 9  digit-argument         ESC |    shell-command-on-region
ESC ;    indent-for-comment         ESC ~    not-modified
ESC <    beginning-of-buffer         ESC DEL  backward-kill-word

C-x 4 C-f       find-file-other-window     C-x 4 d  dired-other-window
C-x 4 .  find-tag-other-window         C-x 4 f  find-file-other-window
C-x 4 b  pop-to-buffer             C-x 4 m  mail-other-window
---------------



:: Quick EMACS Commands
 - Source: http://en.opensuse.org/Emacs
---------------
Action     Key-sequence     Command
Open file     C-x C-f     find-file
Close     C-x C-c     save-buffers-kill-emacs
Save file     C-x C-s     save-buffer
Save as     C-x C-w     write-file
Page down     C-v     scroll-up
Page up     M-v     scroll-down
Goto top     M-<     beginning-of-buffer
Goto end     M->     end-of-buffer
Goto line     M-g g     goto-line
Goto start of line     C-a     beginning-of-line
Goto end of line     C-e     end-of-line
Search forwards     C-s search term     isearch-forward search term
Repeat last search forwards     C-s C-s     isearch-repeat-forward
Search backwards     C-r search term     isearch-backward search term
Repeat last search backwards     C-r C-r     isearch-repeat-backward
Cancel command     C-g     keyboard-quit
Kill line     C-k     kill-line
Kill sentence     M-k     kill-sentence
Yank last kill     C-y     yank
Yank previous kill     M-y     yank-pop
Split window horizontally     C-x 2   
Split window vertically     C-x 3   
Swap active window     C-x o   
Merge windows     C-x 1   
List buffers     C-x C-b     list-buffers
Switch to buffer     C-x b     switch-to-buffer
Switch active buffer left     C-x [LEFT]     previous-buffer
Switch active buffer right     C-x [RIGHT]     next-buffer
Kill Buffer     C-x f     kill-buffer
Spell-check current buffer    none     ispell-buffer
Spell-check current word    none     ispell-word
Indent code     C-M-\     indent-region
Goto matching closing bracket     C-M-f   
Goto matching opening bracket     C-M-b   
---------------


-----
Cheers,
June

수요일, 9월 29, 2010

[Scheme] MIT/GNU Scheme

[Scheme] MIT/GNU Scheme

:: MIT/GNU Sceme
http://groups.csail.mit.edu/mac/projects/scheme/
http://www.gnu.org/software/mit-scheme/

:: SICP (Structure and Interpretation of Computer Programs)
http://mitpress.mit.edu/sicp/full-text/book/book.html

:: A Beginner's Guide to Using EMACS
http://xkahn.zoned.net/help/emacs.html


-----------------------------------------------------

:: Quick EMACS Commands
 - Source: http://xkahn.zoned.net/help/emacs.html
---------------
[Quitting EMACS:]
Quit:    Ctrl-x Ctrl-c
I pushed the wrong key. Help!:    Ctrl-g
---------------
[Working with files:]
Load a file:    Ctrl-x Ctrl-f
Load a directory:    Ctrl-x Ctrl-f
New file:    Ctrl-x Ctrl-f
Save a file:    Ctrl-x Ctrl-s
Save all open files:    Ctrl-x s
Save the file with a new name    Ctrl-x Ctrl-w
---------------
[Dealing with Buffers]
Switch buffers:    Ctrl-x b
Close buffer:    Ctrl-x k
Split current buffer    Ctrl-x 2
Make current buffer the only one on screen    Ctrl-x 1
Switch between the buffers on-screen    Ctrl-x o
---------------
[Cutting and pasting]
Set mark:    Ctrl-[SPACE]
Cut and save text from here to mark:    Ctrl-w
Paste saved text:    Ctrl-y
Cut text from the cursor to the end of the line:    Ctrl-k
---------------



-----
Cheers,
June

[Android] My Tip; Android ant release error (-dex: apply)

[Android] My Tip; Android ant release error (-dex: apply)


// ----------------------------------
// :: Preset
// ----------------------------------
 - Source Path
    C:/Program Files/MyAPKTest
 - Android SDK Path
    C:/android/android-sdk-windows
 - Using Android SDK Version: 2.1
    C:/android/android-sdk-windows/platforms/android-6/

// ----------------------------------
// :: Problem
//
// - Caused by this into dx.bat
//    if "%params%"=="" goto endArgs
//
// - e.g.,
//    set params = "--dex C:/Program Files/MyAPKTest/bin/classes.dex" "..." "..." "..."
//    if "%params%" == ""
// - DOS Batch Interpreter does not parse duplicated double-quotation.
// ----------------------------------
C:/Program Files/MyAPKTest> ant clean [OK]
C:/Program Files/MyAPKTest> ant compile [OK]
C:/Program Files/MyAPKTest> ant release
...
-dex:
     [echo] Converting compiled files and external libraries into C:/Program Files/MyAPKTest/bin/classes.dex...
     [echo]
    [apply] =C:/Files""은(는) 예상되지 않았습니다. (Korean)
    or
    [apply] =C:/Files"" was unexpected at this time. (English)
C:/Program Files/My APK Test>



// ----------------------------------
// :: Solution
// - Condition: Does not needs options
// ----------------------------------

// ----------------------------------
// 1. Open a dx.bat
// ----------------------------------
C:/android/android-sdk-windows/platforms/android-6/tools/dx.bat

// ----------------------------------
// 2. and Adds this in the above the ":nextArg"
// ----------------------------------
...
echo ***** SKIP check the parameter *****
set args=%params%
goto endArgs

:nextArg
if "%params%"=="" goto endArgs
...

// ----------------------------------
// 3. That's it, so now run clean & compile & release
// ----------------------------------
C:/Program Files/MyAPKTest> ant clean && ant compile && ant release
...
BUILD SUCCESSFUL
Total time: x seconds
C:/Program Files/MyAPKTest>



-----
Cheers,
June

수요일, 9월 15, 2010

[Android] My Tip; Android and ProGuard

Android and ProGuard
How to set ProGuard to ANT script for Android

STEP #1
Create a build.xml for ANT
c:/> ant update project --path c:/my_src
Create a build.property for keystore

STEP #2
EDIT build.xml

STEP #3
SETS ProGuard

STEP #4
BUILD

STEP #5
TEST, that's it!



//
// build.property
//
#application-package=com.test.testApp
#sdk-location=C:/android/android-sdk-windows/platforms/android-6

# KeyStore/Alias
key.store=__MY_KEYSTORE__.keystore
key.alias=__MY_KETSTORE_ALIAS__
key.store.password=__PASSWORD__
key.alias.password=__PASSWORD__

//
// build.xml
//
// --------------------------------
// 1. replace <setup />
// --------------------------------
by
    <!-- <setup /> -->
    <setup import="false" />

// --------------------------------
// 2. Adds this in the below <setup import="false" />
// --------------------------------
<!-- ProGuard -->
    <property name="proguard-dir" value="proguard"/>
    <property name="unoptimized" value="${proguard-dir}/unoptimized.jar"/>
    <property name="optimized" value="${proguard-dir}/optimized.jar"/>

    <target name="optimize" unless="nooptimize">
        <jar basedir="${out.classes.dir}" destfile="${unoptimized}"/>

        <java jar="${proguard-dir}/proguard.jar" fork="true" failonerror="true">
            <jvmarg value="-Dmaximum.inlined.code.length=16"/>
            <arg value="@${proguard-dir}/config.txt"/>     
            <arg value="-injars ${unoptimized}"/>
            <arg value="-outjars ${optimized}"/>
            <!--<arg value="-libraryjars ${android.jar}"/>-->
<!-- ADDS Library -->
            <arg value="-libraryjars ${android.jar}" />
            <!-- <arg value="-libraryjars libs/xxx.jar; libs/yyy.jar"/> -->
<!-- ADDS Library -->
        </java>    

        <!-- Delete source pre-optimized jar -->    
        <!--delete file="${unoptimized}"/-->

        <!-- Unzip target optimization jar to original output, and delete optimized.jar -->
        <delete dir="${out.classes.dir}"/>
        <mkdir dir="${out.classes.dir}"/>
        <unzip src="${proguard-dir}/optimized.jar" dest="${out.classes.dir}"/>

        <!-- Delete optimized jar (now unzipped into bin directory) -->
        <delete file="optimized.jar"/>
    </target>
<!-- ProGuard -->
...
<!-- 3. Copy rule and paste into build.xml; see below -->
...
</project>

// --------------------------------
// 3. Copy rule and paste into build.xml
// --------------------------------
OPEN a rule xml file
<SDK_PATH>/platforms/<target_platform>/templates/android_rules.xml

COPY from in the below <project name="android_rules" default="debug">
to in the above </project>
then, PASTE this in the below ProGuard

// --------------------------------
// 4. Finds <target name="-dex" depends="compile">
// --------------------------------
then, adds ", optimize" beside "compile"

<!-- ProGuard -->
    <target name="-dex" depends="compile, optimize">
<!-- ProGuard -->
...



//
// ProGuard
//
// --------------------------------
// 1. Get latest version
// --------------------------------
Download: http://sourceforge.net/project/showfiles.php?group_id=54750

// --------------------------------
// 2. Copy proguard.jar where into downloaded zip archive to my project directory
// --------------------------------
create a directory "proguard" into my project source directory
then, copy proguard/lib/proguard.jar to c:/my_src/proguard

// --------------------------------
// 3. Create a config.txt into "my_src_dir/proguard"
// --------------------------------
# --------------------------------------------------
# ProGuard:
#    http://proguard.sourceforge.net/
# ProGuard Download:
#    http://sourceforge.net/project/showfiles.php?group_id=54750
#
# config.txt Source:
#    http://www.androidengineer.com/2010/07/optimizing-obfuscating-and-shrinking.html
# --------------------------------------------------

-target 1.6
-optimizationpasses 2
-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
-dontpreverify
#-verbose
#-dump class_files.txt
#-printseeds seeds.txt
#-printusage unused.txt
#-printmapping mapping.txt

# The -optimizations option disables some arithmetic simplifications that Dalvik 1.0 and 1.5 can't handle.
-optimizations !code/simplification/arithmetic

-keep public class * extends android.app.Activity
#-keep public class * extends android.app.Application
#-keep public class * extends android.app.Service
#-keep public class * extends android.content.BroadcastReceiver
#-keep public class * extends android.content.ContentProvider

#-keep public class * extends View {
#public <init>(android.content.Context);
#public <init>(android.content.Context, android.util.AttributeSet);
#public <init>(android.content.Context, android.util.AttributeSet, int);
#public void set*(...);
#}
# --------------------------------------------------

// --------------------------------
// build
// --------------------------------
c:/my_src> ant compile
c:/my_src> ant release


-----
Cheers,
June

목요일, 9월 02, 2010

[Android] My Tip; How to increase Android Emulator's Internal Phone Storage and RAM ?

How to increase Android Emulator's Internal Phone Storage and RAM ?

Usage:
-partition-size [Sizeo of the Internal Phone Storage; MB]
-qemu -m [Sizeo of the Physical RAM; MB]

Run:
- Internal Phone Storage: 512MB
- Physical RAM: 128MB (default)
C:/android-sdk-windows/tools> emulator -partition-size 512 -avd MyAVDname -qemu -m 128

-----
Cheers,
June