'잡동사니'에 해당되는 글 13788건

  1. 2021.07.12 DataGridView
  2. 2021.07.11 초복
  3. 2021.07.11 늬우스
  4. 2021.07.10 별이 발라당
  5. 2021.07.09 glibc 버전 얻기
  6. 2021.07.09 fopen exclusivly
  7. 2021.07.08 winform 자동으로 UI 늘리기
  8. 2021.07.08 winform MDI
  9. 2021.07.08 vs2019 sdi , mdi 프로젝트 생성하기
  10. 2021.07.08 gcc unsigned to signed upcast 테스트
Programming/c# & winform2021. 7. 12. 10:52

c#의 기본 컨트롤인데 초기 데이터 생성해서 밀어 넣는게 짜증나는거 제외하면

기본 정렬기능부터 꽤나 쓸만해 보이는 녀석이다.

 

        private void Form1_Load(object sender, EventArgs e)
        {
            //DataSet ds = new System.Data.DataSet();
            DataTable table = new DataTable();
            table.Columns.Add("ID", typeof(string));
            table.Columns.Add("제목", typeof(string));
            table.Columns.Add("구분일", typeof(string));
            table.Columns.Add("생성일", typeof(string));
            table.Columns.Add("수정일", typeof(string));

            table.Rows.Add("ID 1", "제목 1번", "사용중", "2019/03/13", "2019/03.13");
            table.Rows.Add("ID 1", "제목 1번", "사용중", "2019/03/13", "2019/03.13");
            table.Rows.Add("ID 1", "제목 1번", "사용중", "2019/03/13", "2019/03.13");
            table.Rows.Add("ID 1", "제목 1번", "사용중", "2019/03/13", "2019/03.13");
            table.Rows.Add("ID 1", "제목 1번", "사용중", "2019/03/13", "2019/03.13");
            table.Rows.Add("ID 1", "제목 1번", "사용중", "2019/03/13", "2019/03.13");
            table.Rows.Add("ID 1", "제목 1번", "사용중", "2019/03/13", "2019/03.13");
            table.Rows.Add("ID 1", "제목 1번", "사용중", "2019/03/13", "2019/03.13");
            table.Rows.Add("ID 1", "제목 1번", "사용중", "2019/03/13", "2019/03.13");
            table.Rows.Add("ID 1", "제목 1번", "사용중", "2019/03/13", "2019/03.13");

            dataGridView1.DataSource = table;
        }

[링크 : https://kinghell.tistory.com/57]

 

DataSet 이라는 클래스는 DB에서 끌어올때 쓰기 유용한 듯.

그래도 둘다 dataGridView.DataSource에 넣으면 되니 어느것이든 상관없으려나?

[링크 : https://afsdzvcx123.tistory.com/entry/C-윈폼-DataGridView-데이터-조회-추가-삭제하는-방법]

 

+

셀 내의 폰트 크기 조절(전체), 셀 크기는 어떻게 조절하냐 ㅠㅠ

[링크 : https://docs.microsoft.com/ko-kr/dotnet/desktop/winforms/controls/how-to-set-font-and-color-styles-in-the-windows-forms-datagridview-control?view=netframeworkdesktop-4.8]

 

AutoSizeColumnMode / AutoSizeRowsMode를 AllCells로 하면 데이터 내의 모든 값을 보고 적당한 크기로 해주는 듯.

그런데 AllCells 하면 용량이 크면 너무 부하가 걸릴 것 같으니 DisplayedCells가 나을 것 같다.

Column/Rows 에 하나라도 None/Fit이 있으면 작동을 하지 않고

AllCells 혹은 DisplayedCells 등이 조합되서 설정되지 않으면 작동을 안하는 듯.

[링크 : https://docs.microsoft.com/ko-kr/dotnet/desktop/winforms/controls/sizing-options-in-the-windows-forms-datagridview-control?view=netframeworkdesktop-4.8]

 

컬럼 헤더에 숫자 넣기

            foreach (DataGridViewRow row in dataGridView1.Rows)
            {
                row.HeaderCell.Value = "A";
                row.Height = 19;
            }

            dataGridView1.Rows[0].HeaderCell.Value = "A";
            dataGridView1.Rows[1].HeaderCell.Value = "B";
            dataGridView1.Rows[2].HeaderCell.Value = "C";
            dataGridView1.Rows[3].HeaderCell.Value = "D";
            dataGridView1.Rows[4].HeaderCell.Value = "E";

[링크 : https://rocabilly.tistory.com/167]

 

컬럼/로우 헤더 스타일(폰트)

            dataGridView1.DataSource = table;
            dataGridView1.DefaultCellStyle.Font = new Font("Tahoma", 30);
            dataGridView1.ColumnHeadersDefaultCellStyle.Font = new Font("Tahoma", 30);
            dataGridView1.RowHeadersDefaultCellStyle.Font = new Font("Tahoma", 30);

[링크 : https://docs.microsoft.com/ko-kr/dotnet/api/system.windows.forms.datagridview.columnheadersdefaultcellstyle?view=net-5.0]

 

아래의 항목을 설정해주어야 헤더의 폭이 자동으로 설정된다.

ColumnHeadersHeightSizeMode - AutoSize

RowHeadersWidthSizeMode - AutoSizeToAllHeaders

[링크 : https://docs.microsoft.com/ko-kr/dotnet/api/system.windows.forms.datagridview.columnheadersheightsizemode?view=net-5.0]

[링크 : https://docs.microsoft.com/ko-kr/dotnet/api/system.windows.forms.datagridview.rowheaderswidthsizemode?view=net-5.0]

'Programming > c# & winform' 카테고리의 다른 글

winform MDI 시도!  (0) 2021.07.12
winform IsMdiContainer  (0) 2021.07.12
winform 자동으로 UI 늘리기  (0) 2021.07.08
winform MDI  (0) 2021.07.08
winform 첨자(superscript/subscript)  (0) 2021.07.07
Posted by 구차니

우리 똥개가 맞는 첫 초복

살았다~ 뚜룻뚜룻

 

'개소리 왈왈 > 사진과 수다' 카테고리의 다른 글

오늘은 호랑이 장가가는 날씨 그리고 쌍무지개  (0) 2021.07.19
장대비, 쌍무지개  (0) 2021.07.15
은하수  (0) 2020.09.20
별이 쏟아지네  (0) 2020.09.19
자동차 카메라 장착  (0) 2020.06.14
Posted by 구차니

어짜피 신생아가 줄어 선생이 남아날텐데

기존 인력을 좀더 양질의 교육을 위해 갈아넣어야 할 시대가 다가왔음에도

여성취업을 이라는 전제로, 이유를 끼워맞춰 만들어내고 있구만

[링크 : https://news.v.daum.net/v/20210711050124778]

 

연구비 살살녹는다

[링크 : https://news.v.daum.net/v/20210711071106776]

Posted by 구차니

좀 덥긴 했는데 산책하고 돌아오는 약간 오르막에

뒤로 자빠져서 발라당 해서

복날도 안지났는데 훅 가는줄 알고 고이고이 모셔서 안고옴 -_-

 

근데 훼이크였냐!?!?

'개소리 왈왈 > 육아관련 주저리' 카테고리의 다른 글

비덕분인지 습하진 않네  (0) 2021.07.16
킥보드 득템  (0) 2021.07.13
휴가중!  (0) 2021.07.05
휴양!  (0) 2021.07.04
을라들 규강검진  (0) 2021.07.03
Posted by 구차니
Linux2021. 7. 9. 10:42

ldd나 getconf 등으로 얻을수도 있지만, 임베디드에서는 해당 실행 파일을 넣지 않는 경우도 있어서 멘붕

[링크 : https://ososoi.tistory.com/79]

[링크 : https://www.linuxquestions.org/questions/linux-software-2/how-to-check-glibc-version-263103/]

 

라이브러리 버전을 보면 보이긴 한데.. 확실하게 확인하고 싶으니까 좀 더 찾아보니

# ls -al /lib/libc*
-rwxr-xr-x    1 root     root       1230544 Jan  1  1970 /lib/libc-2.26.so
lrwxrwxrwx    1 root     root            12 Jan  1  1970 /lib/libc.so.6 -> libc-2.26.so

 

so 인데 실행이 되는게 신기하긴 하네..

# /lib/libc.so.6
GNU C Library (Buildroot) stable release version 2.26, by Roland McGrath et al.
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
Compiled by GNU CC version 6.4.0.
Available extensions:
        crypt add-on version 2.1 by Michael Glad and others
        GNU Libidn by Simon Josefsson
        Native POSIX Threads Library by Ulrich Drepper et al
        BIND-8.2.3-T5B
libc ABIs: UNIQUE
For bug reporting instructions, please see:
<http://www.gnu.org/software/libc/bugs.html>.

 

[링크 : https://dev.to/0xbf/how-to-get-glibc-version-c-lang-26he]

 

Posted by 구차니
Programming/C Win32 MFC2021. 7. 9. 10:35

 

NOTES
   Glibc notes
       The GNU C library allows the following extensions for the string specified in mode:

       c (since glibc 2.3.3)
              Do not make the open operation, or subsequent read and write operations, thread cancellation points.  This flag is ignored for fdopen().

       e (since glibc 2.7)
              Open the file with the O_CLOEXEC flag.  See open(2) for more information.  This flag is ignored for fdopen().

       m (since glibc 2.3)
              Attempt to access the file using mmap(2), rather than I/O system calls (read(2), write(2)).  Currently, use of mmap(2) is attempted only for a file opened for reading.

       x      Open the file exclusively (like the O_EXCL flag of open(2)).  If the file already exists, fopen() fails, and sets errno to EEXIST.  This flag is ignored for fdopen().

[링크 : https://stackoverflow.com/questions/33312900/how-to-forbid-multiple-fopen-of-same-file]

[링크 : https://stackoverflow.com/questions/16806998/is-fopen-a-thread-safe-function-in-linux]

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

MSB / LSB 변환  (0) 2022.08.29
kore - c restful api server  (1) 2022.07.07
vs2019 sdi , mdi 프로젝트 생성하기  (0) 2021.07.08
vkey win32 / linux  (0) 2021.04.30
strptime  (0) 2021.02.17
Posted by 구차니
Programming/c# & winform2021. 7. 8. 13:55

말이 애매한데..

창을 키우면 자동으로 내부 콤포넌트들이 자동으로 키워져 비율에 맞게 작동하는

UI를 제작하고 싶어서 찾아보는 중.

 

Dock을 Fill로 해주면 되는 건가?

[링크 : https://docs.microsoft.com/en-us/dotnet/desktop/winforms/controls/layout?view=netdesktop-5.0]

 

[링크 : https://cwkcw.tistory.com/166]

 

+

paint 함수를 재정의 해서 계산후 적용하는 것도 방법이군..

[링크 : https://stackoverflow.com/questions/40269285/c-sharp-changing-the-size-of-a-button-text]

'Programming > c# & winform' 카테고리의 다른 글

winform IsMdiContainer  (0) 2021.07.12
DataGridView  (0) 2021.07.12
winform MDI  (0) 2021.07.08
winform 첨자(superscript/subscript)  (0) 2021.07.07
nuget RibbonWinForms  (0) 2021.07.06
Posted by 구차니
Programming/c# & winform2021. 7. 8. 13:37

MFC 말고 winform으로는 안되나 찾아보는데 IsMdiContainer 라는게 있대서 찾아보니 있긴하네?

아무튼.. 그렇다면 창 스타일로 지정되고

dialog based로 생성되어도 그 안에 MDI로 구성을 하는 스타일로 격하(?)되었다는 건가?

 

[링크 : https://docs.microsoft.com/.../how-to-create-mdi-parent-forms?view=netframeworkdesktop-4.8]

[링크 : https://docs.microsoft.com/.../how-to-create-mdi-child-forms?view=netframeworkdesktop-4.8]

[링크 : https://docs.microsoft.com/.../multiple-document-interface-mdi-applications?view=netframeworkdesktop-4.8]

 

'Programming > c# & winform' 카테고리의 다른 글

DataGridView  (0) 2021.07.12
winform 자동으로 UI 늘리기  (0) 2021.07.08
winform 첨자(superscript/subscript)  (0) 2021.07.07
nuget RibbonWinForms  (0) 2021.07.06
ansi escape code  (0) 2021.05.24
Posted by 구차니
Programming/C Win32 MFC2021. 7. 8. 11:39

그냥해봤는데 내꺼에 설치된 패키지 중에는 SDI / MDI를 지원하는 패키지가 없었는지

부랴부랴 검색해서 추가중

[링크 : https://yyman.tistory.com/1357]

 

 

와와 이제 뜬다!!!!

 

흐으으으으음?! 컴파일러 뿐만 아니라 MFC 라이브러리가 별도로 필요한가?

이 프로젝트에는 MFC 라이브러리가 필요합니다. 사용되는 모든 도구 세트 및 아키텍처의 경우 Visual Studio 설치 관리자(개별 구성 요소 탭)에서 설치하세요.

[링크 : https://docs.microsoft.com/ko-kr/visualstudio/msbuild/errors/msb8041?view=vs-2019]

 

MFC로 검색해서 두개의 구성요소를 설치해야 한다.

  • 스펙터 완화를 지원하는 최신 v000 빌드 도구용 C++ MFC(x86 및 x64)
  • 최신 v000 빌드 도구용 C++ MFC(x86 및 x64)

 

스펙터는 설치안하고 최신 빌드 도구용만 까니 라이브러리 없다고 실행안되는거 보면.. 스펙터는 핑계고(?)

번역상에 문제로 스펙터 완화를 지원하는... 건 실제로는 runtime library 아닌가 의심된다.

 

아무튼 프로젝트 생성해서 빌드만 겨우 했네 휴..

근데 SDI로 작성하긴 했는데 왜이렇게 데모 프로젝트가 현란해? 무슨 Visual Studio 인 줄 ㄷㄷ

[링크 : https://yyman.tistory.com/1367]

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

kore - c restful api server  (1) 2022.07.07
fopen exclusivly  (0) 2021.07.09
vkey win32 / linux  (0) 2021.04.30
strptime  (0) 2021.02.17
while(-1) 이 될까?  (0) 2019.05.24
Posted by 구차니
프로그램 사용/gcc2021. 7. 8. 10:40

귀찮으니 날로먹는 코딩으로 테스트

$ cat 1.c
#include <stdio.h>

void main()
{
        unsigned char a = 0xFF;
        char b =a;
        short c = a;
        short d = (char)a;
        short e = (int)a;

        int f = a;
        int g = (int)a;
        int h = (int)(char)a;

        printf("a %d\n",a);
        printf("a %d\n",(int)a);
        printf("a %d\n",(char)a);
        printf("b %d\n",b);
        printf("c %d\n",c);
        printf("d %d\n",d);
        printf("e %d\n",e);
        printf("f %d\n",f);
        printf("g %d\n",g);
        printf("h %d\n",h);
}

 

컴파일러 버전과 아키텍쳐, 그리고 결과인데... 머냐..?!?!

$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/9/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none:hsa
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 9.3.0-17ubuntu1~20.04' --with-bugurl=file:///usr/share/doc/gcc-9/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++,gm2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-9 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-9-HskZEa/gcc-9-9.3.0/debian/tmp-nvptx/usr,hsa --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 9.3.0 (Ubuntu 9.3.0-17ubuntu1~20.04)
$ arm-linux-gnueabihf-gcc -v
Using built-in specs.
COLLECT_GCC=arm-linux-gnueabihf-gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc-cross/arm-linux-gnueabihf/7/lto-wrapper
Target: arm-linux-gnueabihf
Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro 7.5.0-3ubuntu1~18.04' --with-bugurl=file:///usr/share/doc/gcc-7/README.Bugs --enable-languages=c,ada,c++,go,d,fortran,objc,obj-c++ --prefix=/usr --with-gcc-major-version-only --program-suffix=-7 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-libitm --disable-libquadmath --disable-libquadmath-support --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib --enable-multiarch --enable-multilib --disable-sjlj-exceptions --with-arch=armv7-a --with-fpu=vfpv3-d16 --with-float=hard --with-mode=thumb --disable-werror --enable-multilib --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=arm-linux-gnueabihf --program-prefix=arm-linux-gnueabihf- --includedir=/usr/arm-linux-gnueabihf/include
Thread model: posix
gcc version 7.5.0 (Ubuntu/Linaro 7.5.0-3ubuntu1~18.04)
$ ./1
a 255
a 255
a -1
b -1
c 255
d -1
e 255
f 255
g 255
h -1
# /mnt/1
a 255
a 255
a 255
b 255
c 255
d 255
e 255
f 255
g 255

 

라즈베리 파이 4에서 시도. arm 아키텍쳐용 컴파일러의 특성인가?

$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/aarch64-linux-gnu/8/lto-wrapper
Target: aarch64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 8.3.0-6' --with-bugurl=file:///usr/share/doc/gcc-8/README.Bugs --enable-languages=c,ada,c++,go,d,fortran,objc,obj-c++ --prefix=/usr --with-gcc-major-version-only --program-suffix=-8 --program-prefix=aarch64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-libquadmath --disable-libquadmath-support --enable-plugin --enable-default-pie --with-system-zlib --disable-libphobos --enable-multiarch --enable-fix-cortex-a53-843419 --disable-werror --enable-checking=release --build=aarch64-linux-gnu --host=aarch64-linux-gnu --target=aarch64-linux-gnu
Thread model: posix
gcc version 8.3.0 (Debian 8.3.0-6)
$ ./1
a 255
a 255
a 255
b 255
c 255
d 255
e 255
f 255
g 255
h 255

 

+

두개중에 하나만 주면 되는진 모르겠지만, 둘 다 주거나 -fsigned-char 만 주어도 결과가 -1로 나오긴 한다.

원문으로 보니 --signed-chars는 RVCT 컴파일러를 위한 옵션인 듯.

The ANSI C standard specifies a range for both signed (at least -127 to +127) and unsigned (at least 0 to 255) chars. Simple chars are not specifically defined and it is compiler dependent whether they are signed or unsigned. Although the ARM architecture has the LDRSB instruction, that loads a signed byte into a 32-bit register with sign extension, the earliest versions of the architecture did not. It made sense at the time for the compiler to treat simple chars as unsigned, whereas on the x86 simple chars are, by default, treated as signed.
One workaround for users of GCC is to use the -fsigned-char command line switch or --signed-chars for RVCT, that forces all chars to become signed, but a better practice is to write portable code by declaring char variables appropriately. Unsigned char must be used for accessing memory as a block of bytes or for small unsigned integers. Signed char must be used for small signed integers and simple char must be used only for ASCII characters and strings. In fact, on an ARM core, it is usually better to use ints rather than chars, even for small values, for performance reasons. You can read more on this in Optimizing Code to Run on ARM Processors.

[링크 : https://developer.arm.com/.../Miscellaneous-C-porting-issues/unsigned-char-and-signed-char]

 

LDRSB (Thumb*) - Load Register Signed Byte

[링크 : http://qcd.phys.cmu.edu/QCDcluster/intel/vtune/reference/LDRSB_(Thumb).htm]

 

LDRB - Load Register Byte

[링크 : http://qcd.phys.cmu.edu/QCDcluster/intel/vtune/reference/INST_LDRB.htm]

 

char -> signed char: -fsigned-char == -fno-unsigned-char
char -> unsigned char: -funsigned-char == -fno-signed-char

[링크 : https://jooojub.github.io/gcc-options-fsigned-char/]

 

-fsigned-char
Let the type char be signed, like signed char.
Note that this is equivalent to -fno-unsigned-char, which is the negative form of -funsigned-char. Likewise, the option -fno-signed-char is equivalent to -funsigned-char.

-funsigned-char
Let the type char be unsigned, like unsigned char.
Each kind of machine has a default for what char should be. It is either like unsigned char by default or like signed char by default.
Ideally, a portable program should always use signed char or unsigned char when it depends on the signedness of an object. But many programs have been written to use plain char and expect it to be signed, or expect it to be unsigned, depending on the machines they were written for. This option, and its inverse, let you make such a program work with the opposite default.
The type char is always a distinct type from each of signed char or unsigned char, even though its behavior is always just like one of those two.

[링크 : https://gcc.gnu.org/onlinedocs/gcc/C-Dialect-Options.html]

 

+

2021.07.09

으잉? singed char로 하면 되긴 한다. char가 signed 아니었어?!

'프로그램 사용 > gcc' 카테고리의 다른 글

static link  (0) 2022.02.07
구조체 타입과 변수명은 구분된다?  (0) 2021.11.18
gcc vectorized loop  (0) 2021.06.30
gcc unsigned to signed cast  (0) 2021.06.22
gcc %p (nil)  (0) 2021.05.07
Posted by 구차니