windows 7, 빠른 실행 나타내기
%userprofile%\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch
by 멋진상수 | 2011/08/26 16:32 | Tips | 트랙백 | 덧글(0)
ubuntu에서 nabi 사용하기 및 입력 IME 변경
1.나비 설치
 $ sudo apt-get install nabi

2. ime 변경
 $ im-switch -c



참 쉽죠잉~!

 

by 멋진상수 | 2011/08/26 16:23 | Tips | 트랙백 | 덧글(0)
ALSA linux에서 마이크로 녹음하기
ALSA라는 놈이 있다.. 리눅스에..
이놈은 마이크로 입력 받아서 처리하는 api, lib, application으로 되어있다.
보다 자세한 정보는 구글신에게 alsa로 검색하면된다.
그러면 http://www.alsa-project.org를 알려준다.
보다 자세한 샘플코드로 따라하기 하려면,,
비록 영어지만... 좀 쉽게 되어있다
by 멋진상수 | 2011/03/25 10:38 | Tips | 트랙백 | 덧글(0)
윈도우에서 기계식 키보드 사용시 한영변환이 않될 때..
기계식 키보드를 윈도우에서 사용하다보면, 윈도우 한영 변환이 않될 때가 있다..
이럴때는 이렇게..
-------------------------------
http://blog.naver.com/shinhj72?Redirect=Log&logNo=60045306752&jumpingVid=6072C86D29A12555201D0E43B701AF3439C3
-------------------------------

이렇게 하면된다.

그럼.


hangul_switch-shinhj72.zip
by 멋진상수 | 2010/12/28 21:58 | Tips | 트랙백 | 덧글(0)
STL string 사용시 주의점( 버그?? )
-------------------------------------------------------------------------
일단.. 이 문제의 확인은 gcc version 4.4.3 (Ubuntu 4.4.3-4ubuntu5)  에서 확인했음을 미리 밝힙니다.
-------------------------------------------------------------------------

자 이제 재미 있는 stl의 string의 버그(?)에 관해서 알아보자..


------------------------------------------------------------
#include <string>
#include <stdio.h>

#include <string>
#include <stdio.h>
#include <ctype.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>


using namespace std;
int main()
{
   string st1, st2, st3, label;

  st1 = "aaa bbb ccc ";
  st2 = st1;
  st3 = st1+" ";

  printf("st1: %x:%s<\n", st1.c_str(),st1.c_str() ); <----- 1)
  printf("st2: %x:%s<\n", st2.c_str(),st2.c_str() ); <----- 2)
  printf("st3: %x:%s<\n", st3.c_str(),st3.c_str() ); <----- 3)


  label = strtok((char*)  st1.c_str(), " ");


  printf("st1: %x:%s<\n", st1.c_str(),st1.c_str() ); <----- 4)
  printf("st2: %x:%s<\n", st2.c_str(),st2.c_str() ); <----- 5)
  printf("st3: %x:%s<\n", st3.c_str(),st3.c_str() ); <----- 6)

  return 0;
}
-----------------------------------------------------------

자 .. 여기서 1,2,3의 값은 각각 어떻게 될까??
예상은 각각 모두 달라야 하지만.. 놀랍게도...
1,2는 동일한 번지를 가지고 있고 3번은 다른 값을 가지고 있다..

1) st1: 25b6028:aaa bbb ccc
2) st2: 25b6028:aaa bbb ccc
3) st3: 25b6058:aaa bbb ccc

그리고 label = strtok((char*)  st1.c_str(), " "); 이렇게 하면 어떻게될까??
당연히 예상은 st1만 값이 변경되어야 하지만....  st2도 같이 변경된다.
 
4) st1: 25b6028:aaa
5) st2: 25b6028:aaa <---------------짜잔..
6) st3: 25b6058:aaa bbb ccc


에게.. 이거 별거 아니네.. 하시는 분이 있을거다.. 분명이.. 나도 그러니까..

그런데..  다음의 상황을 보자.. 졸라 웃기게 된다.


------------------------------------------------------------
#include <string>
#include <stdio.h>

#include <string>
#include <stdio.h>
#include <ctype.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>


using namespace std;

void test( string aaa)   <---------------------------------------------3)
{
    label = strtok((char*)  aaa.c_str(), " ");
}

int main()
{
   string st1, st2, st3, label;

  st1 = "aaa bbb ccc ";

  printf("st1: %x:%s<\n", st1.c_str(),st1.c_str() );    <---------- 1)

  test( st1);
  printf("st1: %x:%s<\n", st1.c_str(),st1.c_str() );   <----------- 2)

  return 0;
}
-----------------------------------------------------------

위의 소스는 test함수는 call by ref가 아니라 cal by value이다.
그럼... 당연히 1)과 2)의 값은 동일해야 한다.
그런데.. 결과는 ??

1) st1: 251e028:aaa bbb ccc <
2) st1: 251e028:aaa<

다르다... 왜?
void test( string aaa)   <--- 이것은 string aaa=st1 이것을 내포하고 있다..
따라서 위에처럼...

aaa와 st1의 address는 동일하다.. 그러면.. 자동적으로 call by ref 처럼되어버린다.

이제.. 왜 이넘이 문제점이 되는지 이해가 되는지??

자.. 이를 어떻게 해결하면되나??

 1. 번째.. strtok 를 사용하지 말자... 다른거 사용하자...
    google에서 c++ stl, string, tokenize로 검색하면 다른게 나온다.

2. 번째..    aaa = aaa + " " 이런거 추가해서.. c_str()의 포인터를 다르게 가져가자..
void test( string aaa)
{
   aaa = aaa + " ";
    label = strtok((char*)  aaa.c_str(), " ");
}

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

자.. 결론.. c++, stl의 string은
---------------------------
  st1 = "aaa bbb ccc ";
  st2 = st1;
---------------------------
이 상황에서는 s1과 s2의 내부적으로 포인터를 동일하게 가져가는것 같다.
( 아니면.. 포인터만 따로 가지고 있는데.. 그것이 update가 않될 수도 있다.)

주의하자..~~~!!!!







by 멋진상수 | 2010/09/27 16:33 | Tips | 트랙백 | 덧글(2)
< 이전페이지 다음페이지 >