2024/03/08
2024/03/03
gorm,update zero value
golang,string,containsAny,
2024/03/02
div, change line code
2024/02/29
how to set file name when upload file,react
javascript, join object array
yarn uninstall
2024/02/28
Docker not found when freshly installed on Mac
Docker not found when freshly installed on Mac
2024/02/27
Arrow function vs Function declaration
- arrow function can not use this
- arrow function must be defined before use
- Function declaration can use new
spring boot test,spring context
- get value from application.yaml
- use environment
- use profile
- @component
- component scan
- initialize the component
- add it to spring application context
- can get the bean from application context
- @Component equals @Bean in a @Configuration
- can use @SpringBootTest to load spring application context
2024/01/09
after add ports to runing docker container
have to re-create container
docker-compose up -d --force-recreate xxx
2023/10/19
git,commit,branch ,cherry-pick ,merge
- commit
- is snapshot of all files
- not a change set
- to store the hash ID of the latest commit in a branch name.
- branch name is just the lastest hash of commi branch name is just the lastest hash of commit
- In fact, this is the very definition of a branch name: a name like
mastersimply stores the hash ID of the commit we want to call the latest for that branch. So given theA--B--Cstring of commits, we just add the namemaster, pointing to commitC:
- To remember which branch we want Git to update, as well as which commit we have checked-out right now, Git has the special name
HEAD current branch- A--B--C--D <-- develop (HEAD), master
HEADstill names the current commit.- A detached HEAD just means that Git has made the name
HEADpoint directly to some commit instead of attaching it to a branch name
- git merge
- git checkout master
- set HEAD to master
- git merge develop
- go backwards from master and develop, to find a shared base commit (祖先), called merge base
- The merge base commit is determined entirely by the commit graph,
- git diff baseCommint master => get change set 1
- git diff basecommit develop => get change set 2
- git combine the difference , use a new commit id to save the result ( merge commit )
- cherry-pick
- git diff somecommitId to get the change set
- just put the change on current commit(branch)
- but it maybe not works very well, git use cherry-pick-style merge, force the merge base commit to be the parent of the cherry-picked commit.
- cherry-pick create a new commit to save the result.
G--H--F' <-- master (HEAD) / ...--D \ E--F <-- developcherry-pick uses Git's merge machinery to do the change-combining, but leaves the graph unmerged, simply making a copy of some existing commit- git merge somecommitid(branch)
- git merge -no-ff
2023/10/12
postgres, golang , sqlx, placeholder, in
sql: where some_id = any(:some_name)
golang, sqlx:
" some_name" : pg.StringArray([]string )
2023/07/06
vscode ,gvm ,GOROOT
gvm install go19.2
gvm list
gvm use go19.2 --default
=>GOROOT、GOPATH will be set by gvm automatically
vsCode will use the go defined by $GOROOT
2023/06/26
2023/05/31
mysql explain select
## explain select
2023/05/26
rails,reek, rubocop, ignore alert
# :reek:警告名称
# rubocop:disable Style/LineLength, Style/StringLiterals
rails, router,url_helper
puts Rails.application.routes.named_routes.helper_names
rails,where or
- def check
- @spec = Hash.new
- @spec = Spec.merge(Spec.where(a:1).or(Spec.where(b:0)))
- .merge(Spec.where(c:0).or(Spec.where(d:0))).first
- end
2023/05/17
change git http to ssh
- git add ssh key
- ssh-keygen -t rsa
- update to github ssh key
- ssh -T git@github.com
- add to .ssh/config
Host github github.com HostName github.com IdentityFile ~/.ssh/id_git_rsa #ここに自分の鍵のファイル名 User git
ssh -T github
- change git repository from http to ssh
git remote -v
git remote set-url origin git@github.com:xx/xx.git
git remote -v