월요일, 11월 29, 2010

카라 강지영 일본 예능 활약

카라 강지영에 일본 예능 활약 동영상이다.
사실 카라는 알지만 멤버 강지영은 잘 모른다.
하지만 이제는 알게 되었다.

정말 귀엽다. ㅋㅋ

일단 한 번 보시라...


-----
Cheers,
June

일요일, 11월 14, 2010

일기 (2010.11.14)

<고도원의 아침편지>

어중간한 사원


"최악의 사원을 고용하는 것보다
어중간한 사원을 고용하는 것이 더
최악의 결과를 초래한다"라고 게이츠는 단언한다.
"일을 게을리 하는 사원이 있어도 상관없다.
해고하면 되기 때문이다. 그런데 적당히 일을 하는
어중간한 사원을 고용하면 골치 아픈 상황이 된다."
그래서 게이츠는 업무에 필요하다고 생각하는
인원수보다 적은 인원을 채용했다.
일은 인원수가 아니라 우수한 두뇌가
이루어내는 것이라는 생각 때문이었다.


- 다케우치 가즈마사의《스티브잡스 VS 빌게이츠》중에서 -


* 사람은 '일'을 하는 존재입니다.
그런데, 그 일을 하는 곳에서 알게 모르게
자신의 위치가 드러납니다. 행여라도 그 위치가
'어중간한' 자리라면 얼른 옮겨가야 합니다.
지쳐 쓰러지더라도 흠뻑 땀흘리는 자리,
실수를 하더라도 혼을 쏟아붓는 자리,
지금은 힘들지만 나중엔 기쁨과
보람을 얻을 수 있는 자리로!


-----
요즘 참 와닿는 글이다.
어떻게 보면 불평을 하는 것 아니냐고 할 수 있겠지만,
나는 열심히 공부하면서 일하고 싶다.
세상사가 다 그렇다고 하기보단,
그러한 환경을 만들어가고 싶다.
공부도 열심히 하고 나를 가슴뛰게 하는 일들도 열심히 하자...

Cheers,
June

토요일, 11월 13, 2010

[Music][Homebrew] 자작 곡

내가 컴퓨터로 음악(Sequencer) 작업을 처음 시작한 것이 1998, 1999 사이니깐..
음... 2010년 기준으로 약 10~11년 정도 되는 것 같다.
물론 꾸준히 이어서 작업을 한 것은 아니지만... 연수로는 그렇다는 거다.

그러니깐, 처음 시작할 당시엔 MS-DOS 기반에서 ST32 (Stream Tracker) 로 작업을 했다.
이때 컴퓨터로 Sequencer 를 다루어 본 사람이라면 모르지는 않을 것이다.

보통 피아노로 연주했던 걸 tape 으로 녹음한 다음 sequencer 로 대충 (ㅠ.ㅠ) 작성하는 정도다.
이때가 가장 자유스럽고 여유있고 감각이 좋았다고 생각한다.
물론 지금도 자유 (-_-;) 스럽고, 여유있고 (ㅠ.ㅠ) 감각이 (^0^) 좋다고 생각한다.

그동안 세월이 변함에 따라 Sequencer 에도 많은 변화가 있었던 만큼,
Tracker (MOD Plug; aka Impulse Tracker) 에서 다른 Tool 로 전향도 했었고
나름 괜찮다고 생각되는 작품들이 나오고 있다.

현재는 ElectroAcoustic 이지만 (물론 이 장르를 선호한다.) Acoustic 만으로 작업을 해보고 싶은 바람이 있다.
아직 해당되는 장비들은 없지만, 구비가 되면 꼭 해보려고 한다.

요즘 완성이 되었다고 생각되는 괜찮은 곡들이 있어 MySpace 에 등록을 하고 있는데
부담없이 들을 수 있는 곡이니 한 번 들어봐 주시는 것도 괜찮지 않나 싶다.

충고는 따끔하게 받겠으니 feedback 은 꼭 해주시길 바랍니다.
주소는 다음과 같습니다.
http://www.myspace.com/hojungkim

ADD: January 1st, 2011
Jamendo에 음악을 등록하였습니다. 앞으로 계속 추가할 예정입니다. ^^
http://www.jamendo.com/en/artist/Ho-Jung_Kim
2011년 새해 복 많이 받으세요~ ^^


-----
Cheers,
June

수요일, 11월 10, 2010

[Editor][Eclipse] how to exclude Subversion directory (.svn) in the Eclipse?

how to exclude Subversion directory (.svn) in the Eclipse?

1. Open a properties from the project
2. Select "Source Tab" in Java Build Path menu
3. Expands tree and double-click "Excluded:" each other for add two exclusion patterns
.../gen
.../src
4. adds below two exclusion patterns each other into .../gen and .../src
.svn/**
**/.svn/**
5. clean & rebuild the project


-----
Cheers,
June

일요일, 11월 07, 2010

일기 (2010.11.06)

아...
오늘 영화를 네 편을 몰아서 보았다... 흠...
피곤하기는 커녕 기분이 아~주 좋다... ㅎㅎ

먼저 일본영화 "그때는 그에게 안부 전해줘(そのときは彼によろしく)" 를 보았다.
어려서 뜻 깊은 추억을 간직한 세 명의 소꿉친구들이 성인이 되어서 만남을 다룬 영화다.
음... 뭐랄까,,, 잔잔하면서도 어릴 때 추억도 생각나게 해주고,
나는 친구들에게 얼마나 잘 하고 있는지를 물어보게 해주는 그런 영화다.
영화처럼은 아니지만 나도 초등학교 다닐 때 같이 알던 여자, 남자 친구가 있었다.
남자친구는 지금도 연락을 하고 한번씩 만나기도 한다.
나에게 음악에 대해 좀 더 깊게 다가갈 수 있게 해준 정말 좋은 친구다.
여자 애는 고등학교 때 연락 한번 한 이후론 연락을 해본적이 없다.
마지막 연락 때 진로에 대해서 잠깐 얘기한 적이 있는데 공부에 전념하는 모습에...
그만... ^^  음... 지금은 어떻게 변해있을지 참 궁금하다.
친구가 우연히 길에서 봤다고 했다. 순간 마음이 두근 거렸지만...
뭐라고 얘기를 해야할지 몰라서 그냥 넘겨버렸다. 음...
언젠가는 꼭 한번 만나고 싶다.

두 번째 영화는 "The American" 이라는 영화이다.
도통봐도 무슨 내용인지 모르겠다.
George Clooney 와 Violante Placido 가 나오는 영화인데,
영화 색채와 분위기는 좋았던 것 같다. 물론 이상한 장면 (*^^*)은 빼고... ^^;

세 번째 영화는 우리나라 영화 "악마를 보았다"다.
음... 개인적으로 Gore (Splatter Film) 은 좋아하지 않아서인지 보고나서 괜히 보았다고 후회한 영화다.
최민식씨는 정말 연기를 잘 하는 것 같다. 잔인하고 폭력적인 것 보단 좀 더 상냥하고 다정한
그런 역할을 한 번 해주었으면 좋겠다는 개인적인 바람이다.

마지막 영화는 중국영화인 "聽說(Hear Me)" 라는 영화다.
청객장애를 갖고있는 언니를 위해 모른일에 헌신적으로 다하는 여동생과 수영 선수로써 동생에게
꼭 금메달을 안겨주려고 노력하는 언니, 그리고 그 여동생 Yang-yang을 첫눈에 반해 좋아하게되는 Tian 의 이야기다.
영화내용의 대부분이 수화로 이루어져있다. 내가 이렇게 듣고 말하고 볼 수 있다는게 얼마나 행복한 것인지
다시한 번 알게 해준 영화다.
보는 내내 Yang-yang 역시 말을 하지않고 수화로 하다보니 정말 Yang-yang도 청각장애인일까? 라고 생각 하면서도
분명 마지막에 말 할줄 알꺼야라고 생각하며 본 영화다. 물론 마지막에 듣고 말도 할 줄 안다. ^^

참 오랜만에 좋은 영화들을 접해서 너무 좋았다.
음... 갑자기 "Buena Vista Social Club" 다큐멘터리 영화가 생각이 난다.
Cuba 의 Jazz 를 다룬 영화인데 소개되는 음악들이 사람마다 다르겠지만 정말 최고다.
이 영화는 추천을 드리니 꼭 한 번 보시길 바란다.

-----
Cheers,
June

수요일, 10월 27, 2010

[Android] My Tip; RemoteService Example

RemoteService Example

Reference Source:
http://developer.android.com/guide/developing/tools/aidl.html
http://developer.android.com/reference/android/app/Service.html
http://www.androidpub.com/102370



// -----------------------------------------------
// more Activity
// AndroidManifest.xml
// -----------------------------------------------
<activity android:name=".MainActivity"
android:label="MainActivity"
android:configChanges="keyboardHidden|orientation"
android:theme="@android:style/Theme.NoTitleBar"
android:launchMode="singleTask"
>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".anotherActivity"
android:label="anotherActivity"
android:configChanges="keyboardHidden|orientation"
android:theme="@android:style/Theme.NoTitleBar"
android:launchMode="singleTask"
>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

// -----------------------------------------------
// RemoteService
// AndroidManifest.xml
// -----------------------------------------------
<service android:enabled="true" android:name=".testActivity">
</service>


// -----------------------------------------------
// RemoteService
// AndroidManifest.xml
// -----------------------------------------------


// -----------------------------------------------
// RemoteService
// Service.java
// -----------------------------------------------
package com.test.testActivity;

// Service
import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.app.Service;
import android.content.Intent;
import android.media.AudioManager;
import android.media.MediaPlayer;
import android.os.Bundle;
import android.os.Handler;
import android.os.HandlerThread;
import android.os.IBinder;
import android.os.Looper;
import android.os.Message;
import android.os.RemoteCallbackList;

import android.util.Log;
import android.view.SurfaceHolder;
import android.view.SurfaceView;
import android.widget.MediaController;
import android.widget.SeekBar;
import android.widget.TextView;
import android.widget.Toast;

/*
@Activity A (test)
startService( new Intent(test.testActivity, testService.class).putExtra("tag", "data") );

String[] strList = {
{"strList1"},
{"strList2"}
};
startService( new Intent(test.testActivity, testService.class).putExtra("tag2", strlist) );

@Service B (testService)
Bundle extras = getIntent().getExtras();
String[] strList = extras.getStringArray( "strlist" );
*/
public class testService extends Service {
private String TAG = "testService";

// Service
private NotificationManager mNM;
private Intent m_InvokeIntent;
private volatile Looper m_ServiceLooper;
private volatile ServiceHandler m_ServiceHandler;
public String m_Str = null;

final RemoteCallbackList m_Callbacks
= new RemoteCallbackList();

private final class ServiceHandler extends Handler {
public ServiceHandler(Looper looper) {
super(looper);
}

@Override
public void handleMessage(Message msg) {
Bundle extras = (Bundle)msg.obj;
String strTagValue = null;

/*
{
// Broadcast
strTagValue = extras.getString( "command" );
if( strTagValue != null ) {
if( strTagValue.equals("pause") ) {
stopSelf( msg.arg1 );
return;
}
else if( strTagValue.equals("stop") ) {
stopSelf( msg.arg1 );
return;
}
}
}
*/

strTagValue = null;
strTagValue = extras.getString( "tag" );
Log.d( TAG, "Message: " + msg + ", tagValue = " + strTagValue );

if( strTagValue != null ) {
if( strTagValue.equals("data") ) {
}
else if( strTagValue.equals("strlist") ) {
m_strPlayList = extras.getStringArray( "strlist" );
}
else {
Log.d( TAG, "QUIT" );
stopSelf( msg.arg1 );
return;
}
}
else {
stopSelf( msg.arg1 );
return;
}
}
};
  
@Override
public void onCreate() {
mNM = (NotificationManager)getSystemService( NOTIFICATION_SERVICE );
HandlerThread thread = new HandlerThread( "MediaServiceStart" );
thread.start();

m_ServiceLooper = thread.getLooper();
m_ServiceHandler = new ServiceHandler( m_ServiceLooper );
}

@Override
public void onStart(Intent intent, int startId) {
Log.d( TAG, "ServiceStartArguments: Starting #" + startId + ": " + intent.getExtras() );
{
Message msg = m_ServiceHandler.obtainMessage();
msg.arg1 = startId;
msg.obj = intent.getExtras();
m_ServiceHandler.sendMessage( msg );
Log.d( TAG, "ServiceStartArguments: Sending: " + msg );

// Test: Broadcast
/*
final int n = m_Callbacks.beginBroadcast();
Log.d( TAG, "n = " + n );
for( int i = 0; i < n; i++ )
Log.d( TAG, "item = " + m_Callbacks.getBroadcastItem(i) );
m_Callbacks.finishBroadcast();
*/
}
}

@Override
public void onDestroy() {
m_ServiceLooper.quit();
}

@Override
public IBinder onBind(Intent intent) {
return m_Binder;
}

// The IRemoteInterface is defined through IDL
private final IRemoteService.Stub m_Binder = new IRemoteService.Stub() {
public void registerCallback(IRemoteServiceCallback cb) {
if (cb != null) m_Callbacks.register(cb);
}

public void unregisterCallback(IRemoteServiceCallback cb) {
if (cb != null) m_Callbacks.unregister(cb);
}

public String getInfo() {
String str = "i'm service";
return str;
}
public String setInfo(String str) {
Log.d( TAG, "RECEIVED From Activity: " + str );
return str;
}
};
}


// -----------------------------------------------
// testActivity.java
// -----------------------------------------------
// Service
import android.content.ServiceConnection;
import android.content.ComponentName;
import android.os.IBinder;
import android.os.RemoteException;
public class testActivity extends Activity implements {
// Service
private IRemoteService m_Service = null;

@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

//setContentView(R.layout.main);
//Intent(testActivity.this, testService.class)
//Intent intt = new Intent( testActivity.this, Activity2.class );
//startActivity( intt );

//bindService( new Intent(testService.class.getName()), m_Connection, Context.BIND_AUTO_CREATE );
bindService( new Intent(testActivity.this, testService.class), m_Connection, Context.BIND_AUTO_CREATE );
startService( new Intent(testActivity.this, testService.class).putExtra("tag", "quit") );

/*
if( m_Service != null ) {
try {
m_Service.unregisterCallback( m_Callback );
} catch (RemoteException e) {
}
}

// Detach our existing connection.
unbindService( m_Connection );
stopService( new Intent(testActivity.this, testService.class) );
*/
}

@Override
protected void onDestroy() {
if( m_Service != null ) {
try {
m_Service.unregisterCallback( m_Callback );
} catch (RemoteException e) {
}
}

if( m_Connection != null ) {
// Detach our existing connection.
unbindService( m_Connection );
}
stopService( new Intent(testActivity.this, testService.class) );

super.onDestroy();
}

// Service
private ServiceConnection m_Connection = new ServiceConnection() {
public void onServiceConnected(ComponentName className, IBinder service) {
m_Service = IRemoteService.Stub.asInterface(service);
try {
m_Service.registerCallback(m_Callback);
Log.d( TAG, "RECEIVED From Service: " + m_Service.getInfo() );
m_Service.setInfo( "i'm activity" );
} catch (RemoteException e) {
}
Toast.makeText( testActivity.this, "Service Connected", Toast.LENGTH_SHORT ).show();
}

public void onServiceDisconnected(ComponentName className) {
m_Service = null;
Toast.makeText( testActivity.this, "Service Disconnected", Toast.LENGTH_SHORT ).show();
}
};

// This implementation is used to receive callbacks from the remote service.
private IRemoteServiceCallback m_Callback = new IRemoteServiceCallback.Stub() {
public void valueChanged(int value) {
//mHandler.sendMessage(mHandler.obtainMessage(BUMP_MSG, value, 0));
}
};
}

// -----------------------------------------------
// IRemoteService.aidl (default + method)
// Source (v1.6): C:/android-sdk-windows/platforms/android-4/samples/ApiDemos/src/com/example/android/apis/app
// -----------------------------------------------
package com.test.testActivity;
import com.test.testActivity.IRemoteServiceCallback;
interface IRemoteService {
void registerCallback(IRemoteServiceCallback cb);
void unregisterCallback(IRemoteServiceCallback cb);
// ADD
String getInfo();
String setInfo(String str);
}

// -----------------------------------------------
// IRemoteServiceCallback.aidl (default)
// Source (v1.6): C:/android-sdk-windows/platforms/android-4/samples/ApiDemos/src/com/example/android/apis/app
// -----------------------------------------------
default



-----
Cheers,
June

금요일, 10월 22, 2010

[Editor][Vim] Vim in Eclipse, Vrapper

Vrapper: Vim-like editing in Eclipse
Source: http://vrapper.sourceforge.net/home/

1. Eclipse: Help -> Install New Software
Add & Install: http://vrapper.sourceforge.net/update-site/stable

2. Window -> Preferences -> General -> Keys -> Select Vim's key bindings
Replace key:
 - Page Down: Ctrl+F
 - Page Up: Ctrl+B
 - Scroll Line Down: Ctrl+E
 - Scroll Line Up: Ctrl+Y

3. Apply & OK

4. Click Vim(Toggle Vrapper) button onto Toolbar when you need


-----
Cheers,
June

월요일, 10월 04, 2010

[Android] My Tip; Android Resolution Problem

Android Resolution Problem

Your App resolution wil be fixed 320x480(Portrait) if you missed the minSdkVersion.
so, you should be set it to 4(Android SDK Version 1.6) or higher.

Adds this into your AndroidManifest.xml:
Note: Change "(" to "<" and ")" to ">"
(manifest)
...
(uses-sdk android:minSdkVersion="4")(/uses-sdk)
(/manifest)

I've tested on Samsung Galaxy Tab.



-----
Cheers,
June

목요일, 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

목요일, 8월 26, 2010

[Android] QAEP (MSM/QSD Android Enablement Project)

QAEP (MSM/QSD Android Enablement Project)
Source: https://www.codeaurora.org/wiki/QAEP#Branch_Releases


-----
Cheers,
June

[CV][IP] DICOM

DICOM (Digital Imaging and Communications in Medicine)

[Link]
* DICOM@OFFIS
http://dicom.offis.de/dcmintro.php.en
* Sample DICOM (.dcm) file
http://filmandpaperdigitizers.com/samples/DICOM/
* Medical Image Samples
http://barre.nom.fr/medical/samples/



-----
Cheers,
June

[Algorithm][AI][Genetic]

AI: Genetic Algorithm

[Link]
* Genetic-Programming by John R. Koza
http://www.genetic-programming.com/johnkoza.html
* Father of the Genetic Programming, John R. Koza (Written in Korean)
http://popsci.hankooki.com/popsci_news/view.php?news1_id=2506&cate=14&page=78&keyword=



-----
Cheers,
June

목요일, 8월 19, 2010

[Android] Android

Android

* Android Open Source Project
Source: http://android.git.kernel.org/

* Android x86 Project (Porting Android to x86)
Source: http://www.android-x86.org/


* Content Provider
Reference: http://www.devx.com/wireless/Article/41133


{ // CContentProvider Example
http://code.google.com/p/listenmystory/source/browse/

//
// CContentProvider Example
//

#DB: DB_CPtest
#TABLE NAME: info
#TABLE DESCRIPTION:
_id | title | data | data2 (extra)

// Get all of data
Uri allTitles = Uri.parse( "content://com.android.myTest1/db_cptest" );
Cursor c = managedQuery( allTitles, null, null, null, "_id asc" );
if( c.moveToFirst() ) {
do {
//Toast.makeText(this,
// c.getString(c.getColumnIndex(CContentProvider._ID)) + ", " +
// c.getString(c.getColumnIndex(CContentProvider.TITLE)) + ", " +
// c.getString(c.getColumnIndex(CContentProvider.DATA)) + ", " +
// c.getString(c.getColumnIndex(CContentProvider.DATA2)),
//Toast.LENGTH_LONG).show();

String strId = c.getString( c.getColumnIndex(CContentProvider._ID) );
String strTitle = c.getString( c.getColumnIndex(CContentProvider.TITLE) );
String strData = c.getString( c.getColumnIndex(CContentProvider.DATA) );
String strData2 = c.getString( c.getColumnIndex(CContentProvider.DATA2) );
Log.d( TAG, "id = " + strId + ", title = " + strTitle + ", data = " + strData + ", data2 = " + strData2 );
} while( c.moveToNext() );
}

// INSERT
ContentValues values = new ContentValues();
values.put( "title", "title1" );
values.put( "data", "data" );
values.put( "data2", "extra" );
Uri uri = Uri.parse( "content://com.android.myTest1/db_cptest" );
Uri resUri = getContentResolver().insert( uri, values );

// UPDATE #1
ContentValues values = new ContentValues();
values.put( "data", "data" );
Uri uri = Uri.parse( "content://com.android.myTest1/db_cptest/1" );
int resRowCount = getContentResolver().update( uri, values, null, null );
if( resRowCount > 0 )
Log.d( TAG, "Updated [TRUE]" );
else
Log.d( TAG, "Updated [FALSE]" );

// UPDATE #2
ContentValues values = new ContentValues();
values.put( "data", "data" );
Uri uri = Uri.parse( "content://com.android.myTest1/db_cptest" );
String[] strParam = { "title1" };
int resRowCount = getContentResolver().update( uri, values, "title=?", strParam );
if( resRowCount > 0 )
Log.d( TAG, "Updated [TRUE]" );
else
Log.d( TAG, "Updated [FALSE]" );
} // end of CContentProvider Example

// -----------------------------------------------------------



-----
Cheers,
June

[Linux][Memory] User/Kernel Space

--------------------------------------
Q: How does Linux partition logical address space as far as User/Kernel space is concerned, especially when it comes to deciding what gets mapped to virtual versus physical RAM? - Questions
--------------------------------------
Source: http://fixunix.com/questions/14616-how-does-linux-partition-logical-address-space-far-user-kernel-space-concerned-especially-when-comes-deciding-what-gets-mapped-virtual-versus-physical-ram.html

The norm for a memory allocation scheme is to use physical memory before
dumping the overflow to disk. However with Linux it's unique in that
there's a set limit for user and kernel space (aka monolithic kernel).
Which leads me to believe that the logical address space is set aside
ahead of time. Meaning that if a person has 2GBs of physical RAM and
chooses option 3GBs/1GBS of user/kernel space, that either 1GB of kernel
space and 1GB of user space will be allocated to physical RAM; OR, 2 GBs
of user space will go to physical RAM while the remaining 2 GBs (1 user,
the other kernel) will be virtual. This seems rather asinine, so I
hardly believe this is how it works.

It was also proposed to me that the system only considers how much it -
will- give to either user or kernel space. Meaning that at boot up, if a
system only uses 2 MBs of Kernel space, only 2 MBs gets mapped from the
the total available memory for Kernel space (as there's a cap). Also
meaning that those first 2 MBs would be allocated to physical memory.
Then as more would be requested more would be allocated for either user
or kernel space, straight from physical memory, till it ran out. This
sounds like a more solid schema, but at the same time it seems silly to
do things on a first come, first serve basis. It seems more reasonable
that it would partition each application such that each has some
physical memory to work in, and then to use a memory map for anything
additional to disk.

So the question is, how does Linux delegate it's memory with regards to
user/kernel space? Does Linux treat User/Kernel space just as a hard
limit, allocating memory as it's needed until it hits the cap for a
particular "type" of memory? Or does it preordain that kernel space will
be in physical memory while user space will get the remainder, whether
it be physical or not? Is there possibly another partitioning scheme,
similar to the one I suggested above?

I'm beginning to believe it's a simple tallying scheme, checking to see
how much kernel space or user space has been allocated.

ie/
3GB/1GB of User/Kernel space is available.
2 MBs gets allocated at boot-time for the kernel and it's modules -
(1.000GBs-0.002GBs=NewAvailableKernelSpace)
50 MBs gets allocated to X in user space - (3.000GBs-
0.050GBs=NewAvailableUserSpace)
So on and so forth.

I imagine that the logical address space is just a series of pointers
telling the system where everything is. For example, the first logical
address might point to physical memory for kernel space, while the
second logical address unit might point to user space in virtual memory
(similar to the example above). I imagine that's the whole value of
logical address space - it provides the HAL.

Any reference material or solid answers surrounding the mysteries of
Linux's memory allocation would be appreciated.

Thanks,
Dustin
--------------------------------------

--------------------------------------
Q: Virtual memory - user space kernel space
--------------------------------------
Source: http://fixunix.com/linux/7872-virtual-memory-user-space-kernel-space.html

Hi,
I m having some questions in Linux memory management.
I m considering about 32 bit machine only.
If you have a 512 MB of memory, how it is divided between kernel space
and user space?

What is the link between this division and 3GB userspace and 1 GB
kernel space division.
Is the 3G/1G division is for virtual memory?
Is the total Virtual memory can be 4G only? I mean is it the maximum?

Thanks in advance.

regards
SaranJothy

Re: Virtual memory - user space kernel space
SaranJothy wrote:
> Hi,
> I m having some questions in Linux memory management.
> I m considering about 32 bit machine only.
> If you have a 512 MB of memory, how it is divided between kernel space
> and user space?


A (relatively) small part is statically allocated to hold the kernel 
code and static data. The rest is dynamically allocated to whatever is 
required (user, drivers, kernel, ...)

> What is the link between this division and 3GB userspace and 1 GB
> kernel space division.


None.

> Is the 3G/1G division is for virtual memory?


Yes.

> Is the total Virtual memory can be 4G only? I mean is it the maximum?


In 32 bit Linux: yes, you cannot address more than 4GB of virtual 
addresses with 32 bit pointers.

-- 
Josef Möllers (Pinguinpfleger bei FSC)
If failure had no penalty success would not be a prize
-- T. Pratchett


Re: Virtual memory - user space kernel space
On Feb 8, 1:45 pm, "SaranJothy" wrote:
> Hi,
> I m having some questions in Linux memory management.
> I m considering about 32 bit machine only.
> If you have a 512 MB of memory, how it is divided between kernel space
> and user space?


you bumble virtual and physical memory. kernel divides _only_ virtual
memory between kernel space and user space,
physical memory are share to both. so, if for example, I want to
allocate n mb from user space, i can get some virtual address p
associated with physical page g.
and if i after it will try to allocate n mb from kernel space i can
get some virtual address i, associated with the same physical page g.
it's normal.

>
> What is the link between this division and 3GB userspace and 1 GB
> kernel space division.
> Is the 3G/1G division is for virtual memory?


yep

> Is the total Virtual memory can be 4G only? I mean is it the maximum?
>


nope. intel, for example, support PAE feature, that performs 64G
virtual space.

> Thanks in advance.
>
> regards
> SaranJothy



Re: Virtual memory - user space kernel space
Thanks for the reply.
As said,
> A (relatively) small part is statically allocated to hold the kernel
> code and static data. The rest is dynamically allocated to whatever is
> required (user, drivers, kernel, ...)

So, It depends upon the total size of kernel code and static data.
Right?

I read like 1G is allocated for kernel and 3G is allocated for
userspace in Virtual memory.
So part of RAM is mapped to 1G Kernel space address.
If part of RAM where kernel resides is smaller(as in most cases) than
1G, how it is mapped to 1G?

how 3G /1G break is maintained for secondary storage having just
2 G of memory?

I m having some problems in co-relating Physical memory and VM. pls.,
correct me.

Regards,
Saran


Re: Virtual memory - user space kernel space
Hi,
Thanks for the replies.
As said,
> A (relatively) small part is statically allocated to hold the kernel
> code and static data. The rest is dynamically allocated to whatever is
> required (user, drivers, kernel, ...)


So, It depends upon the total size of kernel code and static data.
Right?


1G/3G division in virutal memory is nothing but a set of pointers to
have VM management.
Set of pointers for Kernel. -1G
Set of pointers for User space - 3G
Kernel space pointers are special such that they have direct mapping
to Physical memory.
User space pointers has to go via MMU to get the location in physical
memory. Just correct me with the above understanding?


The process (User space) memory is swapped in and out to Secondary
storage to meet memory requirements of new process required to
execute.
What happens when we dont have enough Secondary storage.
say we have 2G RAM and 1.5G application is currently running.(I hope
this is possible) We have 1G of secondary storage only.
Now a 1.5G application wants to run.
(How the currently executing 1.5G application gets swapped out?

My intention of qn. is what happens when we dont have enough Secondary
memory.

Thanks for your replies,
Saran

Re: Virtual memory - user space kernel space
"just.asgard" wrote in
news:1170938227.135204.298340@p10g2000cwp.googlegr oups.com:

>> Is the total Virtual memory can be 4G only? I mean is it the maximum?
>>

>
> nope. intel, for example, support PAE feature, that performs 64G
> virtual space.


This is incorrect. PAE provides 64G of _physical_ address space. It
doesn't change the 4GB of virtual address space. You still only have 32-
bit registers.

GH


Re: Virtual memory - user space kernel space
SaranJothy wrote:
> Thanks for the reply.
> As said,

>>A (relatively) small part is statically allocated to hold the kernel
>>code and static data. The rest is dynamically allocated to whatever is
>>required (user, drivers, kernel, ...)

>
> So, It depends upon the total size of kernel code and static data.
> Right?


Yes.

In the old days, all physical memory was mapped 1:1 to virtual addresses 
0xc0000000 upwards, so the kernel could access everything directly. If 
you had more than 1GB of physical memory, you could recompile the kernel 
to start at 0x80000000 or even (correct me if I'm wrong) 0x40000000, to 
accomodate up to 2 or 3 GB of physical memory.
Later, Hugemem and friends were introduced and you could have more than 
1GB of physical memory.

> I read like 1G is allocated for kernel and 3G is allocated for
> userspace in Virtual memory.
> So part of RAM is mapped to 1G Kernel space address.


Yes, the part which holds the kernel code and static data is mapped to 
the 1G kernel address space. Dynamically allocated kernel memory is also 
mapped to the space. Other pages (user pages, buffers, ...) can be 
mapped on demand.

> If part of RAM where kernel resides is smaller(as in most cases) than
> 1G, how it is mapped to 1G?


In general, there is no distinction between less than 1GB and more than 
1GB of physical memory.

> how 3G /1G break is maintained for secondary storage having just
> 2 G of memory?


??? "secondary storage" ???
You mean swap space? Linux uses swap space in addition to physical 
memory, so having 1GB of physical memory and 2GB of swap space would 
allow you to use 3GB of virtual memory, distributed amongst the kernel 
(a relatively small portion, locked to physical memory) and user processes.

> I m having some problems in co-relating Physical memory and VM. pls.,
> correct me.


Try to find a decent book on virtual memory.

An attempt of a very short explanation:
virtual memory is subdivided into "page frames", in ia32 these are 4KB.
Likewise, physical memory is subdivided into "pages", again 4KB in size.
There is a piece of hardware, the Memory Management Unit (MMU) which 
takes a virtual address coming out of the CPU and replaces this by a 
physical address, in the simplest case by a table-lookup: The upper 20 
bits (the page frame number) of a 32-bit virtual address selects one of 
the 1048576 slots in the table. This slot contains a bit "valid" and the 
upper 20 bits (the page number) of the physical address. If the "valid" 
bit is 0, then this virtual address is invalid and the access is aborted 
(SIGSEGV). If the "valid" bit is 1, the 20 bits "page frame number" is 
replaced by the 20 bits "page number",keeping the lower 12 bits of the 
(virtual) address. That 32 bit value is then used as the physical address.
When switching between processes, the kernel has to replace the low 
786432 entries in this table by the low 786432 entries of the new 
process' table. Also, you need two tables: one for kernel and one for 
the currently active user process, the kernel's low 786432 entries are 
identical to the user process' low 786432 entries. The upper 262144 of a 
user process' table _always_ have the "valid" bit cleared.

Does this help?

Josef
-- 
Josef Möllers (Pinguinpfleger bei FSC)
If failure had no penalty success would not be a prize
-- T. Pratchett

Re: Virtual memory - user space kernel space
SaranJothy wrote:

> Thanks for the reply.
> As said,
>> A (relatively) small part is statically allocated to hold the kernel
>> code and static data. The rest is dynamically allocated to whatever is
>> required (user, drivers, kernel, ...)

> So, It depends upon the total size of kernel code and static data.
> Right?
>
> I read like 1G is allocated for kernel and 3G is allocated for
> userspace in Virtual memory.
> So part of RAM is mapped to 1G Kernel space address.


If you have less than 1G of physical RAM, *all* physical RAM
is mapped into the top 1G kernel space.

The key is to understand that you can have more than one
virtual mapping for a physical RAM page. So, when userspace
requires a memory page, one of the already mapped (but unused)
pages in kernel space gets mapped into userspace as well.

> If part of RAM where kernel resides is smaller(as in most cases) than
> 1G, how it is mapped to 1G?


The kernel is typically loaded at the beginning of the physical RAM.
This, like all other RAM is then mapped to start at the 3GB boundary.

There is one exception - If you have 1GB or more of physical RAM,
the RAM which cannot be mapped into the top 1GB, gets managed as
high memory and only mapped on request.

>
> how 3G /1G break is maintained for secondary storage having just
> 2 G of memory?


It's unrelated. Of course, if you want to memory map a file, you
have to stay below the free virtual space.

Regards,

Iwo

Re: Virtual memory - user space kernel space
On Thu, 08 Feb 2007 14:06:26 +0000 Iwo Mergler wrote:

| The key is to understand that you can have more than one
| virtual mapping for a physical RAM page. So, when userspace
| requires a memory page, one of the already mapped (but unused)
| pages in kernel space gets mapped into userspace as well.

That's a feature used by VRB to make a ring buffer (provided the size
is an exact multiple of page size) that automatically wraps around
by having a mirror image mapping of the entire buffer immediately
following the first mapping in VM. That allows direct access via
tools that don't understand the ring buffer wraparound (e.g. strXXX
functions in stdlib or others) while avoiding any copy activities
to maintain both the data and empty space as contiguous areas.

See: http://vrb.slashusr.org/

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

-----
Cheers,
June