Programming/C Win32 MFC2017. 4. 14. 14:55

워드를 보면 이런 기능이 있는데





어떻게 구현하는거지? 고민을 했거늘...

결론은 이렇게 쉬운거였나...


karaofdec 11-04-01 09:28  

네...GetWindowRect로 해결 했습니다. 

아래와 같이 하니 상하 크기만 줄어드는 효과를 낼 수 있네요... 

CRect dialog_rc; 

this->GetWindowRect(dialog_rc); 

dialog_rc.bottom += 100; 

dialog_rc.right += 100; 

MoveWindow(dialog_rc); 

[링크 : http://www.tipssoft.com/bulletin/tb.php/QnA/19829]


+

다이얼로그에다가 직접 노가다로 이것저것 넣었다 뺏다 하는거 보다는

이렇게 창 크기를 변경하는게 유용할 듯?



+

생각난김에 동적 컨트롤 추가

[링크 : http://yowon009.tistory.com/418]

[링크 : http://www.tipssoft.com/bulletin/tb.php/update/804] << 요거

    [링크 : http://www.tipssoft.com/bulletin/tb.php/QnA/13289]


'Programming > C Win32 MFC' 카테고리의 다른 글

cstring 'null' append 문제?  (0) 2017.05.18
MFC 시간측정(msec)  (0) 2017.04.18
mfc ccombobox 문자열 받아오기  (0) 2017.04.05
MFC 라디오버튼 사용하기  (0) 2017.04.05
mfc cstring 문자열 관련(유니코드)  (0) 2017.04.04
Posted by 구차니
Programming/php2017. 4. 13. 18:55

php에서 세션은 /tmp에 파일로 저장되는데(리눅스 기준)

/tmp는 누구나 접근이 가능한 곳이라 보안상의 문제가 되기에

세션변수로 패스워드를 저장하면 안된다고 한다.


[링크 : http://blog.habonyphp.com/entry/php-세션-데이터-보안의-중요성]


그리고 /tmp는 파일로 저장하기에 세션변수를 많이 쓰면 file i/o로 부하가 많이 걸릴수 있다.

[링크 : http://jonnung.github.io/php/2016/12/17/php-session-start-inefficient/]


그래서 memcached 라던가 sqlite 등의 DB에 세션을 저장하는 거였나...

$ sudo apt-cache search memcache

php5-memcache - memcache extension module for PHP5

php5-memcached - memcached extension module for PHP5, uses libmemcached

memcached - high-performance memory object caching system

memcachedb - Persistent storage engine using the memcache protocol 

[링크 : http://php.net/manual/en/book.memcached.php]



+

원래 찾으려고 했던 내용...

걍 global로 지정해서 저장하던가 아니면 class로 해서 변수 저장하던가.. 인가?

[링크 : http://blog.naver.com/mikong22/220835017565]

'Programming > php' 카테고리의 다른 글

php static과 변수 유효범위  (0) 2017.04.15
php 상수 선언 - define  (0) 2017.04.15
php mvc 구현(+ PDO)  (2) 2017.04.07
php mysql 자동증가값 받기  (0) 2017.03.14
php zend guard ?  (2) 2017.03.14
Posted by 구차니
Programming/php2017. 4. 7. 10:02

index.php에 어떠한 내용도 들어가지 않는 신기한 마법?


[링크 : http://webskills.kr/archives/495]

[링크 : http://webskills.kr/archives/515] <<

[링크 : http://webskills.kr/archives/532]


+

2017.04.10

자세히 들여다 보니...

.htaccess의

RewriteRule ^(.+)$ index.php?url=$1 [QSA,L]

요 한줄이 핵심(?)적으로 얘를 통해 인자를 받아서 처리하도록 해야 정상 작동을 한다.

'Programming > php' 카테고리의 다른 글

php 상수 선언 - define  (0) 2017.04.15
php 세션주의사항(?)  (0) 2017.04.13
php mysql 자동증가값 받기  (0) 2017.03.14
php zend guard ?  (2) 2017.03.14
php -> exe (윈도우)  (0) 2017.03.14
Posted by 구차니
Programming/C Win32 MFC2017. 4. 5. 15:38

GetLBText() 로 해당 인덱스의 문자열을 받아올 수 있다.


[링크 : http://six605.tistory.com/250]


Gets a string from the list box of a combo box.

int GetLBText( 

   int nIndex, 

   LPTSTR lpszText  

) const;

 

void GetLBText( 

   int nIndex, 

   CString& rString  

) const; 

[링크 : https://msdn.microsoft.com/en-us/library/zcy9kze7(v=vs.110).aspx]

Posted by 구차니
Programming/C Win32 MFC2017. 4. 5. 14:28

MFC 에서 쓸려면

Group을 설정해야 하는데

여러개를 묶을때 처음 녀석을 Group True로 설정

그리고 나머지는 False로 하고

가장 처음 Group True로 된 녀석에게 변수를 추가해주는데

대개는 DDX 사용하도록 권장하는 듯

[링크 : http://armcc.tistory.com/67]


수작업(!)으로 하려면

라디오 버튼은 CButton을 사용하기 때문에

GetCheckedRadioButton(first, last); 메소드를 이용해서 체크된 녀석의 ID를 받아오거나

[링크 : http://toring92.tistory.com/137]


여러개의 그룹을 수작업으로

((CButton*)GetDlgItem(IDC_RADIO1))->GetCheck() 이런식으로 일일이 체크해야 할 듯 하다.

[링크 : http://stackoverflow.com/questions/1165619/mfc-radio-buttons-ddx-radio-and-ddx-control-behavior]

Posted by 구차니
Programming/C Win32 MFC2017. 4. 4. 20:41

음.. CString에서 제공하는 메소드는 아래뿐이네.. GetData() 나 다른것들은 상속에 의해서 다른 클래스에서 온 듯

operator LPCTSTR

GetBuffer() 

[링크 : https://msdn.microsoft.com/en-us/library/aa315043(v=vs.60).aspx]


GetString()은 누구꺼냐.. CObject의 스멜이 나긴 한다만...

(LPCTSTR)로 캐스팅하는 것과 거의 구현이 같은 GetString() 이란 메소드도 있습니다. 

[링크 : https://indidev.net/forum/viewtopic.php?f=5&t=92]


음.. 걍 void* 형으로 캐스팅?

CString str = L"английский"; //Russian Language

DWORD dwWritten=0;

WriteFile(pHandle , (void*) str, str.GetLength()*sizeof(TCHAR),&dwWritten , NULL);

[링크 : https://social.msdn.microsoft.com/.../how-to-send-unicode-characters-to-serial-port?forum=vcgeneral]


LPSTR - Long Pointer STRing

LPCSTR - LP Const STRing

LPTSTR - LP Tchar STRing

LPCTSTR - LPC Tchar STRing

LPWSTR - LP Wchar STRing

LPCWSTR - LP Const Wchar STRing

[링크 : http://pelican7.egloos.com/v/1768951]


char 형식의 좁은 문자 리터럴(예: 'a')

wchar_t 형식의 와이드 문자 리터럴(예: L'a')

char16_t 형식의 와이드 문자 리터럴(예: u'a')

char32_t 형식의 와이드 문자 리터럴(예: U'a') 

[링크 : https://msdn.microsoft.com/ko-kr/library/69ze775t.aspx]


TEXT("")과 _T("")의 차이점은

TEXT("")는 WinNT.h에서 #define했고

_T("")는 tchar.h에서 TEXT가 4글자라서 _T이렇게 2글자로 #define했다. 

[링크 : http://x108zero.blogspot.kr/2013/12/text-t-l.html]



+

tchar.h

#define __T(x)      L ## x

#define _T(x)       __T(x)


음.. L 이야 Long에 대한 prefix literal 이니...까?



'Programming > C Win32 MFC' 카테고리의 다른 글

mfc ccombobox 문자열 받아오기  (0) 2017.04.05
MFC 라디오버튼 사용하기  (0) 2017.04.05
bit field와 컴파일러별 byte align  (0) 2017.03.27
MFC CButton 마우스 클릭시 작동하기  (0) 2017.03.08
GetHttpConnection()  (0) 2017.03.03
Posted by 구차니

망할(!) 유니코드 ㅠㅠ

sqlite의 내용이 utf-8일텐데 아무튼.. 이걸 받아서 print 하니

죄다 u'\u' 이런식으로 유니코드 문자열을 알려주는 접두와 16진수로만 출력이 된다

그래서 이걸 정상적으로 출력하는걸 찾아보는데

간편하게 출력하는건 없고.. 파이썬 print 함수의 특징으로 봐야 하려나?


튜플,리스트 단위로 출력하면 escape 된 채로

항목 하나만 출력하면 정상적으로 한글로 나온다.

도대체 머야?!


아무튼 아래와 같이 하면 정상출력되긴 한다.( u' ' 접두는 붙는다.)

print repr(a).decode("unicode-escape") 

[링크 : http://stackoverflow.com/.../python-print-unicode-strings-in-arrays-as-characters-not-code-points]

'Programming > python(파이썬)' 카테고리의 다른 글

python + openCV 공부 시작  (0) 2019.04.30
pypy  (0) 2018.04.04
파이썬 리스트(list)와 튜플(tuple)  (0) 2017.04.02
파이썬 type 확인하기  (0) 2017.04.02
python sqlite3  (0) 2017.03.30
Posted by 구차니

튜플은 (1,2,3) 식으로 출력되고

리스트는 [1,2,3] 식으로 출력된다.


다만 내용적으로는 리스트는 순서가 변할수 있으며(순서가 의미가 없다)

튜플은 순서를 바꿀수 없다(즉, 순서에 의미가 있다)


4.6.5. Tuples

Tuples are immutable sequences, typically used to store collections of heterogeneous data (such as the 2-tuples produced by the enumerate() built-in). Tuples are also used for cases where an immutable sequence of homogeneous data is needed (such as allowing storage in a set or dict instance). 

[링크 : https://docs.python.org/3/library/stdtypes.html#tuples]


4.6.4. Lists

Lists are mutable sequences, typically used to store collections of homogeneous items (where the precise degree of similarity will vary by application). 

[링크 : https://docs.python.org/3/library/stdtypes.html#lists]

'Programming > python(파이썬)' 카테고리의 다른 글

pypy  (0) 2018.04.04
파이썬 print가 희한하네..  (0) 2017.04.02
파이썬 type 확인하기  (0) 2017.04.02
python sqlite3  (0) 2017.03.30
python smtplib의 신비..?  (0) 2016.12.30
Posted by 구차니


type(변수명) 


참 쉽네...

[링크 : http://chouingchou.tistory.com/53]

'Programming > python(파이썬)' 카테고리의 다른 글

파이썬 print가 희한하네..  (0) 2017.04.02
파이썬 리스트(list)와 튜플(tuple)  (0) 2017.04.02
python sqlite3  (0) 2017.03.30
python smtplib의 신비..?  (0) 2016.12.30
python이 인기라는데..  (0) 2014.03.19
Posted by 구차니

python에서 sqlite 파일을 접속해서 조작하는 방법


$ sudo apt-get install python-sqlite

Reading package lists... Done

Building dependency tree

Reading state information... Done

The following extra packages will be installed:

  libsqlite0

Suggested packages:

  python-sqlite-dbg

The following NEW packages will be installed:

  libsqlite0 python-sqlite

0 upgraded, 2 newly installed, 0 to remove and 7 not upgraded.

Need to get 141 kB of archives.

After this operation, 519 kB of additional disk space will be used.

Do you want to continue? [Y/n]

Get:1 http://mirrordirector.raspbian.org/raspbian/ jessie/main libsqlite0 armhf 2.8.17-12 [119 kB]

Get:2 http://mirrordirector.raspbian.org/raspbian/ jessie/main python-sqlite armhf 1.0.1-11 [21.3 kB]

Fetched 141 kB in 1s (95.8 kB/s)

Selecting previously unselected package libsqlite0.

(Reading database ... 137326 files and directories currently installed.)

Preparing to unpack .../libsqlite0_2.8.17-12_armhf.deb ...

Unpacking libsqlite0 (2.8.17-12) ...

Selecting previously unselected package python-sqlite.

Preparing to unpack .../python-sqlite_1.0.1-11_armhf.deb ...

Unpacking python-sqlite (1.0.1-11) ...

Setting up libsqlite0 (2.8.17-12) ...

Setting up python-sqlite (1.0.1-11) ...

Processing triggers for libc-bin (2.19-18+deb8u7) ...


pi@raspberrypi:~ $ cd src

pi@raspberrypi:~/src $ ll

total 2060

drwxr-xr-x  2 pi pi    4096 Mar 30 14:40 .

drwxr-xr-x 30 pi pi    4096 Mar 30 14:34 ..

-rw-r--r--  1 pi pi 2099200 Mar 29 12:29 sqlite.udb


pi@raspberrypi:~/src $ python

Python 2.7.9 (default, Sep 17 2016, 20:26:04)

[GCC 4.9.2] on linux2

Type "help", "copyright", "credits" or "license" for more information.

>>> import sqlite3

>>> conn = sqlite3.connect('sqlite.udb')

>>> c = conn.cursor()

>>> c.execute("select * from tbl_recv")

<sqlite3.Cursor object at 0x769eaa20> 


데이터가 유니코드로 나오나..

# we can also implement a custom text_factory ...

# here we implement one that will ignore Unicode characters that cannot be

# decoded from UTF-8

con.text_factory = lambda x: unicode(x, "utf-8", "ignore") 


[링크 : https://docs.python.org/2/library/sqlite3.html]

'Programming > python(파이썬)' 카테고리의 다른 글

파이썬 리스트(list)와 튜플(tuple)  (0) 2017.04.02
파이썬 type 확인하기  (0) 2017.04.02
python smtplib의 신비..?  (0) 2016.12.30
python이 인기라는데..  (0) 2014.03.19
python2 vs python3  (0) 2013.01.02
Posted by 구차니