2022/02/28
2022/02/20
mac java version
久しぶりにJavaを触った。
many many jdks ...so how to mange so many jdks
- show jdks version on your mac pc
/usr/libexec/java_home -V - env is a good idea.
- python->pyenv
- node->nodenv
- ruby->rbenv
- golang->gvm
- java->jenv
- install jenv
brew install jenv
export JENV_ROOT="$HOME/.jenv"
echo 'eval "$(jenv init -)"' >> ~/.bash_profile
source ~/.bash_profile
jenv doctor - add jdk path to jenv
jenv add /Library/Java/JavaVirtualMachines/jdk-12.0.2.jdk/Contents/Home - use some version
jenv local 11
2022/02/16
Gradle The JavaExec.main property has been deprecated
deprecated gradle features were used in this build, making it incompatible with gradle 8.0.
=> add ↓ to gradle.properties
org.gradle.warning.mode=all
then
he JavaExec.main property has been deprecated
change build.gradle
plugins {
id "application"
}
apply plugin : "java"
application {
mainClass = 'xxx.xxx'
}
then
gradle run
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
slf4j has more implements. but you have none in you class path, that is the reason.
add it
gradle example
build.gradle
```
dependencies { implementation 'org.slf4j:slf4j-log4j12:1.7.36' }
```
2021/10/18
mysql explain
explain someSql;
possible_keys show useable keys
explain select a from b use index (c) where xxx ;
show index from tableA;
create index someIndex on someTable(someColumn);
drop index someIndex on someTable;
*************************** 1. row ***************************
id: 1
select_type: SIMPLE
table: some table
partitions: NULL
type: ALL
possible_keys: PRIMARY
key: NULL
key_len: NULL
ref: NULL
rows: 2972
filtered: 1.11
Extra: Using where
2021/04/22
insert ignore
INSERT IGNORE INTO users (userid,username) VALUES (2,'swan'),(4,'bear') ;
--- Query OK, 1 row affected, 1 warning (0.02 sec) Records: 2 Duplicates: 1 Warnings: 1
mysqlのorder by fieldで指定のID順に並べる
select *
from icons where id in(4, 5, 6) order by field(id, 5, 4, 6) => mysql> select * from icons where id in(4, 5, 6) order by field(id, 5, 4, 6);
2020/11/16
Webpacker can't find application.js
これはwebpackerがコンパイル*されていないことが原因です。
なので下記のコマンドで解決しました。
rails webpacker:install
rails webpacker:compile
2020/10/21
GitHub 二段階認証 token
毎回やりかを忘れ。。
Personal access tokens
$ git clone https://github.com/private-organization/repository.git Cloning into 'repository'... Username for 'https://github.com': xxx Password for 'https://xxx@github.com': {ここでGitHubのパスワードでなくtokenを入力する}