Get a TAPI Phone handle : use phoneInitializeEx()

I needed to get the TAPI Phone handle on Windows Mobile 6 to catch the signal (or event) of incoming voice call in my application. (I wanted to pause my own media player when I got called)

For the first step, I had to get the TAPI Phone handle using phoneInitializeEx() function, but it always return PHONEERR_INVALPARAM.

I found the solution. If you reached at the same problem of me, you should try this.

DWORD dwNumDevs = 0;
DWORD dwAPIVersion = TAPI_CURRENT_VERSION; // Important!!
PHONEINITIALIZEEXPARAMS oPhoneInitializeExParams = {0};
oPhoneInitializeExParams.dwTotalSize = sizeof(PHONEINITIALIZEEXPARAMS); // Important!!
oPhoneInitializeExParams.dwOptions = PHONEINITIALIZEEXOPTION_USEEVENT; // Important!!

LONG ret = phoneInitializeEx(&m_hPhoneApp, 0, 0, _T(”TAPIPhone”), &dwNumDevs, &dwAPIVersion, &oPhoneInitializeExParams);

How to configure Library path on Linux

We know the OS has to know the path of the library to load it, so the OS has the environmetal value for this such as LD_LIBRARY_PATH. We can set new directory path for the brand new library as setting LD_LIBRARY_PATH directly, but it’s kind of uncomfortable.

You can set the library path with this way below.

You add the library path in /etc/ld.so.conf file just with VI editor or something, and the type ldconfig on the command line. What a piece of cake!!

Single User Mode without the “root” password

When you use RedHat, you are able to change the “root” password even if you forget your password. You can change the password on the Sigle User Mode booting.

The way is like this.

  1. Hit ESC key before the timout is over in the grub OS selection.
  2. Select the OS you want to boot up using arrow keys, and press e key.
  3. Select the line starting with “Kernel”, and press e key.
  4. Add “Single” or “1” after the line, and press ESC
  5. Press b key.

Now, the OS will boot up on Single User Mode.

However!!! Attention!! If you use Ubuntu or Debian, the passwd is needed even if it is the Single User Mode. So…What!!

You have to type “init=/bin/bash” instead of “Single”. OK…? OK.

Now, you can boot up on Single User Mode without the “root” passwd. Also, you can change the root passwd.

Oh~ye

Agent

 

I am the agent from now on until 2nd, March, 2012.

Windows Live Writer Error : Spell checking failed with error code 8.

I normaly use windows live writer for blogging. It was very handy.

However, after I installed Live Writer to the different labtop, installation was fine, but this spell ckeching thing’s just poped up, not running with silence. What the…

So, as usual, I googled. So I got this.

http://logmis.tistory.com/tag/spell%20checking에러 (In Korean)

In summary, just move dictionary files of Live Writer (Dictionary files have LEX as their extention. It’s in C:\Program Files\Windows Live\Writer\Dictionaries\), and run live writer once, move the dictionary files back to the original folder.

Now, you can enjoy blogging!

Elvis Costello - She

 

She may be the face I can’t forget
The trace of pleasure or regret
Maybe my treasure or the prize I have to pay
She may be the song that summer sings
Maybe the children autumn brings
Maybe a hundred different things
Within the measure of a day
She may be the beauty or the beast
Maybe the famine or the feast
May turn each day into a Heaven or a Hell
She may be the mirror of my dreams
A smile reflected in a stream
She may not be what she may seem
Inside her shell….
She, who always seems so happy in a crowd
Whose eyes can be so private and so proud
No one’s allowed to see them when they cry
She maybe the love that cannot hope to last
May come to leap from shadows in the past
That I remember ’till the day I die
She maybe the reason I survive
The why and wherefore kind of life
The one I care for through the rough and ready years
Me, I’ll take the laughter and your tears
And make them all my souvenirs
And when she goes I’ve got to be
The meaning of my life is
She….She
Oh, she….

Error Message : expected unqualified-id before numeric constant

When I compile some code, “Expected unqualified-id before numberic constant” is poped up. I’ve never seen this message before.

What the hell!!?I’ve googled, and got the explaination.

I don’t know how many cases we have for this error message, but this is for sure.

I declared “static const int MAX_COMMAND = 100″, and I defined “#define MAX_COMMAND 100″ in  the different file.Hmm, what a mistake! 

And I did this with Eclipse 3.4.1 on Ubuntu Hardy as IDE.

Split windows in VI(M)

sp filename : split windows and edit the file “filename”

vs filename : split windows vertically and edit the file “filename”

Ctrl + ww : move to the next windows

This is enough for me to use vi editor. 

Compilation to create .so file (dll) on the linux

1. gcc -c -fpic source.c

2. gcc -shared -lc -o source.so source.o

Then, you can get the .so file.

Original Meaning of Ascii Character "Carriage return" and "Line feed"

I was always confused the meaning between CR and LF.

Today, I found the answer!

Here is the explanation of the original meaning of CR and LF. In short, the CR and LF is redefined because the CR and the LF were the character to control the printing head. The contents below cited http://www.lammertbies.nl/comm/info/ascii-characters.html#line

 

10 – LF – Line feed
The line feed character is one of the characters in the ASCII character set that has been misused. Originaly, the LF character was ment to move the head of a printer one line down. A second control character CR would then be used to move the printing head to the left margin. This is the way it was implemented in many serial protocols and in operating systems like MS-DOS and Windows. On the other hand the C programming language and Unix operating system redefined this character as newline which ment a combination of line feed and carriage return. You can argue about which use is wrong. The way C and Unix handle it is certainly more natural from a programming point of view. On the other hand is the MS-DOS implementation closer to the original definition. It would have been better if both line feed and newline were part of the original ASCII definition because the first defines a typical device control functionality where the latter is a logical text separator. But this separation is not the case. Nowadays people tend to use the LF character mainly as newline function and most software that handles plain ASCII text files is capable of handling both single LF and CR/LF combinations. The control character is in the programming language C available as \n.

 

13 – CR – Carriage return
The carriage return in the ASCII character set in its original form is ment to move the printing head back to the left margin without moving to the next line. Over time this code has also been assigned to the enter key on keyboards to signal that the input of text is finished. With screen oriented representation of data, people wanted that entering data would also imply that the cursor positioned to the next line. Therefore, in the C programming language and the unix operating system, a redefinition of the LF control code has taken place to newline. Often software now silently translates an entered CR to the LF ASCII code when the data is stored.

Next Page »