Welcome

Wheresoever you go, go with all your heart. (Confucius)

5/25/2012

Environment variables on Oracle 11g Release 2

  • Setting up environment variables

$ vi .bashrc
# add ORACLE_HOME, ORACLE_BASE and ORACLE_SID
# example
export ORACLE_BASE=/db/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1
export ORACLE_SID=oracle_sid


  • Test

$ sqlplus /nolog
SQL> connect / as sysdba
SQL>  startup
ORA-01078: failure in processing system parametersLRM-00109: could not open parameter file 'anywhere'
If you are facing the above error while startup of oracle, possible reasons might be the init{ORACLE_SID}.ora file not accessible by oracle user. To solve this problem, you can get your pfile at the location $ORACLE_BASE/admin/$ORACLE_SID/pfile/. A typical file name is init.ora.{NUMBER}. From that location, make a spfile by the following:
$ORACLE_BASE=/db/app/oracle/ and $ORACLE_SID=ora_sid
$sqlplus /nolog
SQL> connect / as sysdba
SQL> create spfile from pfile='/db/app/oracle/admin/ora_sid/pfile/init.ora.{NUMBER}
   File created.
SQL> startup

Using Key simulation in MFC

Sometimes, we need to send keys to another process when developing MFC application.
We called sending keys "Key simulation"
For this purpose, we can use the function "SendInput" as a function of MFC.
Here I will describe an example. So, see the function description.


We have to get a window handle to send keys.
In MFC, there are several methods for this. Here I will use FindWindowEx method.
When finding the specific window handle, you can describe "class name" or "Window title name"
I think "Window title name" is more convenient.

// Get window handle

HWND hWindow = ::FindWindowEx(NULL, NULL, "Class Name", 0);
or
HWND hWindow = ::FindWindowEx(NULL, NULL, 0, "Window title name");

// Get thread and process id

PROCESS_INFORMATION pi;
pi.dwThreadId = ::GetWindowThreadProcessId(hWindow, &(pi.dwThreadId));

SendKey(WORD('A'), MapVirtualKey('A',0), pi);


Refer two methods 'SendKey' and 'SendCtrlShiftKey'


void SendKey(WORD vk, WORD scan, PROCESS_INFORMATION pi)
{

INPUT is;

is.type = INPUT_KEYBOARD;  //INPUT_KEYBOARD = 1
is.ki.time = 0;

is.ki.wVk = vk;
is.ki.wScan = scan;
is.ki.dwFlags = NULL;
is.ki.dwExtraInfo = NULL;

SendInput(1, &is, sizeof(INPUT)); // Key down
WaitForInputIdle( pi.hProcess, INFINITE );

is.ki.wVk = vk;
is.ki.dwFlags = KEYEVENTF_KEYUP;
is.ki.wScan = scan;
is.type = INPUT_KEYBOARD;

SendInput(1, &is, sizeof(INPUT)); // Key up
WaitForInputIdle( pi.hProcess, INFINITE );
}


void SendCtrlShiftKey(WORD vk, PROCESS_INFORMATION pi)
{
INPUT inp[6];
short Ecnt = 0x00;


// VK_CONTROL down.
inp[0].ki.time = NULL;
inp[0].type = INPUT_KEYBOARD;
inp[0].ki.dwExtraInfo = NULL;
inp[0].ki.dwFlags = NULL;
inp[0].ki.wVk = VK_CONTROL;
inp[0].ki.wScan = MapVirtualKey(VK_CONTROL,0);

// VK_SHIFT down.
inp[1].ki.time = NULL;
inp[1].type = INPUT_KEYBOARD;
inp[1].ki.dwExtraInfo = NULL;
inp[1].ki.dwFlags = NULL;
inp[1].ki.wVk = VK_SHIFT;
inp[1].ki.wScan = MapVirtualKey(VK_SHIFT,0);

// Character Key down.
inp[2].ki.time = NULL;
inp[2].type = INPUT_KEYBOARD;
inp[2].ki.dwExtraInfo = NULL;
inp[2].ki.dwFlags = NULL;
inp[2].ki.wVk = vk;
inp[2].ki.wScan = MapVirtualKey(vk,0);

// VK_CONTROL up.
inp[3].ki.time = NULL;
inp[3].type = INPUT_KEYBOARD;
inp[3].ki.dwExtraInfo = NULL;
inp[3].ki.dwFlags = KEYEVENTF_KEYUP;
inp[3].ki.wVk = VK_CONTROL;
inp[3].ki.wScan = MapVirtualKey(VK_CONTROL,0);

// VK_SHIFT up.
inp[4].ki.time = NULL;
inp[4].type = INPUT_KEYBOARD;
inp[4].ki.dwExtraInfo = NULL;
inp[4].ki.dwFlags = KEYEVENTF_KEYUP;
inp[4].ki.wVk = VK_SHIFT;
inp[4].ki.wScan = MapVirtualKey(VK_SHIFT,0);

// Character Key up.
inp[5].ki.time = NULL;
inp[5].type = INPUT_KEYBOARD;
inp[5].ki.dwExtraInfo = NULL;
inp[5].ki.dwFlags = KEYEVENTF_KEYUP;
inp[5].ki.wVk = vk;
inp[5].ki.wScan = MapVirtualKey(vk,0);



SendInput(1,inp,sizeof(INPUT)); // VK_CONTROL down
WaitForInputIdle( pi.hProcess, INFINITE );

SendInput(1,&inp[1],sizeof(INPUT)); // VK_SHIFT down
WaitForInputIdle( pi.hProcess, INFINITE );

SendInput(1,&inp[2],sizeof(INPUT)); // Key down
WaitForInputIdle( pi.hProcess, INFINITE );

SendInput(1,&inp[5],sizeof(INPUT)); // Key up
WaitForInputIdle( pi.hProcess, INFINITE );

SendInput(1,&inp[4],sizeof(INPUT)); // VK_SHIFT up
WaitForInputIdle( pi.hProcess, INFINITE );

SendInput(1,&inp[3],sizeof(INPUT)); // VK_SHIFT up
WaitForInputIdle( pi.hProcess, INFINITE );
}

Cydia

[Cydia Source List]

http://sinfuliphonerepo.com
http://cydia.hackulo.us
http://repo.hackyouriphone.org
http://repo.biteyourapple.net
http://cydia.xsellize.com
http://repo.insanelyi.com

[Essential applications]
1. mobileterminal: change password [alpine]
2. OpenSSH
3. SBSetting
4. CyDelete
5. afc2add
6. Installous 4
7. AppSync 5.0+
8. iFile