お知らせ
現在サイトのリニューアル作業中のため、表示が崩れているページが存在することがあります。
余計な例外を投げてくるのが面倒なのでそれを無視できるように
Env | Ver |
---|---|
PHP | 7.1.3 |
Xdebug | 2.9.4 |
VSCode | 1.48.0 |
"ignore"
セクションを追加してそこに書いたファイルから出た例外は無視される
{
"version": "0.2.0",
"configurations": [
{
"name": "Listen for Xdebug",
"type": "php",
"request": "launch",
"port": 9001,
"ignore": [
"**/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php"
]
}
]
}
VSCodeのRemote - SSH拡張でSSH接続する時に毎回秘密鍵のパスフレーズを求められるのが面倒すぎるので、パスフレーズを記憶させて入力を省略させる方法を調べた
Set-Service ssh-agent -StartupType Automatic
Start-Service ssh-agent
Get-Service ssh-agent
ssh-add C:\Users\hoge\.ssh\id_rsa
ssh-add -l
以下の警告が流れてうまく行かないケース、この場合はWindows付属のOpenSSHが腐っているので入れ替える
warning: agent returned different signature type ssh-rsa (expected rsa-sha2-512)
Get-Service -Name ssh-agent | Stop-Service
sc.exe delete ssh-agent
Remove-WindowsCapability -Online -Name "OpenSSH.Client~~~~0.0.1.0"
Remove-WindowsCapability -Online -Name "OpenSSH.Server~~~~0.0.1.0"
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
choco install openssh --package-parameters="/SSHAgentFeature"
ssh-agent
が実行中で自動起動するようになっていることを確認ssh-add C:\Users\hoge\.ssh\id_rsa
ssh-add -l
Laravel + SQLServerとかやるときのメモ
sudo yum install -y epel-release
sudo yum install -y http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
sudo yum update
# これがないと SQLServer への接続でコケる
sudo yum localinstall https://packages.microsoft.com/rhel/7/prod/msodbcsql17-17.4.1.1-1.x86_64.rpm
# Laravel が起動するのに必要な様々ないろいろ
sudo yum install -y php74 php74-php-common php74-php-cli php74-php-mbstring php74-php-gd php74-php-pear php74-php-pdo php74-php-mcrypt php74-php-xmlrpc php74-php-soap php74-php-devel php74-php-intl php74-php-xml php74-php-sqlsrv
# php で呼べるようにしとく
sudo ln -s /usr/bin/php74 /usr/bin/php
php -r "phpinfo()" > phpinfo
するThread
で検索、Thread SafeかUnSafeか調べるphp\ext
に配置php.ini
のDynamic Extensions
セクションに次のような感じで記述# php_と.dllは勝手に補完される
extension=pdo_sqlsrv_74_ts_x64
extension=sqlsrv_74_ts_x64
php -r "phpinfo()" > phpinfo
してsqlsrv
が確認できたらOKTSの情報に乏しく無駄にハマったのでメモ程度に
Env | Ver |
---|---|
React | 17.0.1 |
TypeScript | 4.1.3 |
<input />
をラップしたコンポーネントのフォーカスを変更するためにref
を使いますChild.tsx
import { forwardRef } from 'react';
export type ChildProps = {
type: 'text' | 'password' | 'number';
onChange(changeValue: string): void;
};
// function 記法でないと ESLint が怒るので無効化
// eslint-disable-next-line react/display-name
export const Child = forwardRef<HTMLInputElement, ChildProps>(
// このpropsに明示的な型定義がないと型エラーが出る
(props: ChildProps, ref) => {
const onChange = (ev: React.ChangeEvent<HTMLInputElement>) => {
props.onChange(ev.target.value);
};
return (
<input
ref={ref}
type={props.type}
onChange={(ev) => onChange(ev)}
/>
);
}
);
Parent.tsx
<Child />
だけフォーカスが行くようにしてますimport { useEffect, useRef } from 'react';
import { Child } from './Child';
export const Parent = () => {
const ref = useRef<HTMLInputElement>(null);
useEffect(() => {
ref?.current?.focus();
}, []);
return (
<ul>
<li>
<Child
type={'text'}
onChange={(ev) => console.log('top input', ev)}
/>
</li>
<li>
<Child
ref={ref}
type={'text'}
onChange={(ev) => console.log('bottom input', ev)}
/>
</li>
</ul>
);
};