Toast GRID를 React/TypeScript환경에서 사용해보았습니다. (생각나는 데로 팁을 추가해보겠습니다.)

 

#01. row수가 약 300건 가까이 될때, 셀 선택시 엄청나게 느린 경우가 발생했는데, 아래 속성을 추가하니 속도가

빨라졌습니다.

 

bodyHeight={'fitToParent'}

 

#02. ajax 처리 후 데이터건수를 업데이트 해 주려고 할 때, ToastGrid의 TypeScript Wrapper에 response에 이벤트 타입이 TuiGridEvent로 받아버려서 제대로 속성 값을 처리할 수 없습니다. 그럴 땐  아래처럼 해 주면 됩니다. (any타입을 받아서 처리합니다.)

 

   

 grid_detail.current?.getInstance().on('response', function (ev: any) {

        const { response } = ev.xhr;

        const responseObj = JSON.parse(response);

		//setTotalRow 는 useState 함수입니다. 
        setTotalRow(responseObj.data.contents.length);

      });

#03. checkbox 체크시 해당row에 특정CELL 색상 변경

tuiGrid 의 addCellClassName, removeCellClassName을 이용해서 구현이 가능합니다..

msbuild NSwagger 툴체인의 경로

 

3.1의 경우

[누겟패키지의 경로]\packages\nswag.msbuild\13.버전\tools\NetCore31

 

 

  • NSwagExe
  • NSwagExe_x86
  • NSwagExe_Core21
  • NSwagExe_Core31
  • NSwagExe_Net50
  • NSwagDir
  • NSwagDir_Core21
  • NSwagDir_Core31
  • NSwagDir_Net50

아래 내용을 d:\backup.ps1 파일로 저장한다.

 

#내용시작

$MYSQL_PATH = "C:\Program Files\MariaDB 10.5\bin\mysqldump.exe " #mysqldump 실행파일경로
$BACKUP_FOLDER = "D:\backup\db" #백업할 경로
$dbuser = "디비계정"
$dbpass = "디비암호"
$dbname = "디비이름"
$BACKUPDATE = Get-Date -Format FileDate #현재날짜

cmd /c " `"$MYSQL_PATH`" -u $dbuser -p$dbpass $dbname > $BACKUP_FOLDER$BACKUPDATE.sql "
Compress-Archive -Path $BACKUP_FOLDER$BACKUPDATE.sql -DestinationPath $BACKUP_FOLDER$BACKUPDATE.zip
Remove-Item -Path $BACKUP_FOLDER$BACKUPDATE.sql

#내용 끝

 

 

#파워셸에서 스케쥴러를 등록한다.
$Trigger= New-ScheduledTaskTrigger -At 01:00am –Daily #새벽 1시에 실행되는 스케쥴 트리거를 만든다.
$User= "NT AUTHORITY\SYSTEM" # 실행할 유저
$Action= New-ScheduledTaskAction -Execute "PowerShell.exe" -Argument "D:\backup.ps1" # 실행 대상 스크립트
Register-ScheduledTask -TaskName "MYSQL BACKUP" -Trigger $Trigger -User $User -Action $Action -RunLevel Highest –Force # 실행할 태스크의 이름

 

#등록상태를 확인한다.
Get-ScheduledTask | Where-Object {$_.TaskName -match "MYSQL"}

 

 

 

작업스케쥴러에서도 잘 등록되었음을 확인 할 수 있다.

 

'설정' 카테고리의 다른 글

Toast Grid 몇 가지 팁  (0) 2021.05.22
NSwagger 툴체인의 경로  (0) 2021.05.16
ffmpeg 사용 명령어  (0) 2020.12.07
hyper 터미널 툴 (3.0.2) 실행이 안될때  (0) 2020.10.21
certbot renew 불가시  (0) 2020.10.18


# hls 생성
ffmpeg -i csw-main.mp4 -vf "scale=1280x720" -b:v 1M -g 60 -hls_time 2 -hls_list_size 0 -hls_segment_size 500000 output.m3u8


# ffmpeg 사용, 크기조정

ffmpeg -i 입력.mp4 -vf "scale=1280x720"  출력.mp4

# framerate 조정

ffmpeg -i 입력.mp4 -b:v 800k -filter:v fps=fps=20 출력.mp4

윈도우운영체제에서 hyper 터미널이 실행이 안될때 처리방법입니다.

 

실행시 프로세스에는 떠 있는데, 화면이 나타나지 않는 현상입니다.

1. 관리자로 cmd 창을 열어

gpupdate /force 

입력

 

 

2. %appdata% 와 %localappdata% 폴더에서 hyper 디렉토리를 삭제. (그전에 Hyper 프로세스를 선택해 작업끝내기를 합니다.)

3. 다시 인스톨 합니다.

이제 잘 뜹니다.(prefence에서 기본 쉘은 wsl로 선택함)

무료 SSL 인증서로 letsencrypt는 정말 유용합니다.

다만 3개월마다 갱신해줘야한다는게 불편하긴하지만, 이것도 cron걸어두면 괜찮죠..

 

cron에서 걸어둘 인증서 자동 관리기인 certbot에서 renew가 명령어가 안될때..

 

다음과 같이 conf파일에 사용할 수없는 문자가 입력되어 오류가 날 수 있습니다. (다른 이유가 있을 수도 있으니, 오류 메시지를 잘 확인하도록 합니다.)

grep -r -P '[^\x00-\x7f]' /etc/nginx /etc/letsencrypt/ 해서 어느파일에서 00 ~7f 문자가 사용되었는지 확인합니다.

 

nginx에서 gzip 으로 압축하여 전달하지 않을 user-agent문자열 셋팅 부분에 불용문자열이 있네요.

gzip_disable "MSIE [1-6].(?!.*SV1)" 으로 변경하였습니다.

 

이제 SSL 갱신이 잘됩니다.

vmware 15.x 버전을 쓰고 있는데 호스트운영체제(윈도우즈)와 게스트운영체제(CentOS8)의 폴더 공유가 잘 되지 않아 해당 도움말을 찾아보았습니다.

 

docs.vmware.com/en/VMware-Workstation-Pro/15.0/com.vmware.ws.using.doc/GUID-AB5C80FE-9B8A-4899-8186-3DB8201B1758.html

 

위 링크에 도움말이 있고, 각 vmware제품 버전에 맞추어 확인하면됩니다.

 

1.먼저 VM Setting에 공유폴더를 설정합니다.

2. 게스트 OS에서 아래와 같이 마운트를 시킵니다.

잘 되네요~

 

아래는 사이트에 있는 설명입니다.

 

After you enable a shared folder, you can mount one or more directories or subdirectories in the shared folder to any location in the file system in addition to the default location of /mnt/hgfs.

Depending on the kernel version of the Linux guest operating system, VMware Tools uses different components to provide shared-folder functionality. In Linux kernels prior to version 4.0, the VMware Tools services script loads a driver that performs the mount. Linux kernels 4.0 and later use a FUSE file system component.

You can use different mount commands to mount all shares, one share, or a subdirectory within a share to any location in the file system. The commands also vary depending on the Linux-kernel version of the guest.

Mount Command SyntaxLinux Kernel Prior to 4.0Linux Kernel 4.0 and LaterDescription

mount -t vmhgfs .host:/ /home/user1/shares /usr/bin/vmhgfs-fuse .host:/ /home/user1/shares -o subtype=vmhgfs-fuse,allow_other Mounts all shares to /home/user1/shares
mount -t vmhgfs .host:/foo /tmp/foo /usr/bin/vmhgfs-fuse .host:/foo /tmp/foo -o subtype=vmhgfs-fuse,allow_other Mounts the share named foo to /tmp/foo
mount -t vmhgfs .host:/foo/bar /var/lib/bar /usr/bin/vmhgfs-fuse .host:/foo/bar /var/lib/bar -o subtype=vmhgfs-fuse,allow_other Mounts the subdirectory bar within the share foo to /var/lib/bar

For Linux kernel prior to version 4.0, you can use VMware-specific options in addition to the standard mount syntax. Enter the command /sbin/mount.vmhgfs -h to list the options.

For Linux kernel version 4.0 or later, enter the command /usr/bin/vmhgfs-fuse -h to list the available options.

값 출력 비교를 위한 엑셀의 샘플 자료값입니다.

    class Program
    {
        static void Main(string[] args)
        {
            var x = new decimal[] { 20, 30, 40, 50, 60, 70 };
            var y = new decimal[] { 12.48M, 32.33M, 33.11M, 84.12M, 45.91M, 40.11M };

            var cp = CovarianceP(x, y);
            Console.WriteLine("Covariance Population : {0}", cp); //모집단 공분산


            var cs = CovarianceS(x, y);
            Console.WriteLine("Covariance Sample : {0}", cs); //표본집단 공분산

            Console.ReadLine();
        }

        /// <summary>
        /// 모집단 공분산 구하기
        /// </summary>
        /// <param name="x"></param>
        /// <param name="y"></param>
        /// <returns></returns>
        static decimal CovarianceP(decimal[] x, decimal[] y)
        {
            if (x.Length != y.Length)
                throw new ArgumentException("two parameters must be same length.");

            var avg_x = x.Average();
            var avg_y = y.Average();

            return x.Zip(y, (x1, y1) => (x1 - avg_x) * (y1 - avg_y)).Average();
        }

        /// <summary>
        /// 표본집단 공분산 구하기
        /// </summary>
        /// <param name="x"></param>
        /// <param name="y"></param>
        /// <returns></returns>
        static decimal CovarianceS(decimal[] x, decimal[] y)
        {
            if (x.Length != y.Length)
                throw new ArgumentException("two parameters must be same length.");

            var avg_x = x.Average();
            var avg_y = y.Average();

            return x.Zip(y, (x1, y1) => (x1 - avg_x) * (y1 - avg_y)).Sum() / (x.Length -1);
        }
    }

 

결과입니다.

double로 하실경우 소수점 마지막자리에 오차가 좀 발생합니다.

 

 

공분산에 대한 설명은 이분 블로그에서 너무나 친절하고 쉽게 설명이 되어 있습니다.

https://blog.naver.com/ikek21/220003173213

 

공분산(covariance)

공분산이 뭐에요? 란 질문에.. 난 당황했었다.. 다.. 당황하셨어요? 그리곤 재빨리 자리를 피했다.. 하지만...

blog.naver.com

 

+ Recent posts