Mac OS使用capistrano进行部署输入bundle exec cap production deploy:check时候得到以下错误: 解决方式: ssh-add -K ~/.ssh/id_rsa 可以看到输出: => Identity added: /Users/xander/.ssh/id_rsa (xxxxxx@qq.com) 请注...
XanderCheung
8857
0
0
Mac OS使用capistrano进行部署输入bundle exec cap production deploy:check时候得到以下错误: 解决方式: ssh-add -K ~/.ssh/id_rsa 可以看到输出: => Identity added: /Users/xander/.ssh/id_rsa (xxxxxx@qq.com) 请注...
XanderCheung
8857
0
0
给定一个整数数组 nums 和一个目标值 target,请你在该数组中找出和为目标值的那 两个 整数,并返回他们的数组下标。你可以假设每种输入只会对应一个答案。但是,你不能重复利用...
XanderCheung
6338
0
0
在Rails中也集成了乐观锁的功能,由无所不能的ActiveRecord实现。使用的方式及其简单,只需要在对应的model中加入一个lock_version字段: class CreateOrders < ActiveRecord::Migration[5.1] def change ...
MIHU
7199
0
2
gorm 不支持自动转化成数据库精度,postgres支持.后面6位,所以如果直接使用 now.New(t).EndOfMonth() 去往数据库更新的话,就会导致被错误的前进了一秒,所以要把后面多余的精度设为0 imp...
XanderCheung
10236
0
0
在ruby中,我们如果想 得到某一时刻的 n 个月后,我们通常这样写: t = Time.parse("2020-03-31 12:00:00") t + 1.month # => 2020-04-30 12:00:00 +0800 # 或者 1.month.after(t) # => 2020-04-30 12:00:00 +0800 在golang ...
XanderCheung
23339
0
1
如查询”按照created_at升序第一个创建的User“ 正确的写法: db.Model(&models.User{}).Order("created_at ASC").Limit(1).Find(&s) sql: SELECT * FROM "users" ORDER BY created_at ASC LIMIT 1 错误写法: db.Model(&models...
XanderCheung
69217
0
0
The enum defined like this: enum status: %i[pending unfinished finished] You can get the integer like so: < Rails 5 my_model = MyModel.find(123) my_model[:status] # Returns the integer value Rails 5+ my_model.status_before_type_cast # Ret...
XanderCheung
7290
0
0
bundle install 时遇到如下错误 Fetching mysql2 0.5.3Installing mysql2 0.5.3 with native extensionsGem::Ext::BuildError: ERROR: Failed to build gem native extension. current directory: /Users/xander/.rbenv/versions/2.5.1/lib/ruby/gems...
XanderCheung
10005
0
0
中继(中转)能用的工具很多,有 HaProxy、iptables、Socat等。 Socat:优点:支持 TCP/UDP 转发。缺点:不支持端口段(多个端口需要开启多个转发)HaProxy:优点:支持 TCP 转发,支持 端...
XanderCheung
29254
0
1
方案A:在服务器上修改配置 使用 vim /etc/ssh/sshd_config 编辑如下两行:找到下面两行 # ClientAliveInterval 0 # ClientAliveCountMax 3 去掉注释,改成 # 客户端每隔多少秒向服务发送一个心跳数据...
XanderCheung
6116
0
1
构建Docker容器时,最佳实践是构建小型容器映像。较小的Docker映像往往具有更快的构建时间和拉取时间。此外,使用小型Docker映像也有安全优势-与大型Docker容器相比,小型容器的受...
XanderCheung
7235
0
0
1.添加用户(如: deploy) sudo adduser deploy 2.添加sudo权限 sudo usermod -G sudo deploy 3.添加root权限 查看/etc/sudoers文件权限,如果只读权限,修改为可写权限 chmod 777 /etc/sudoers ls -l /etc/sudoers ...
XanderCheung
9185
0
1
Rails find_or_create_by : 查找具有给定属性的第一条记录,或创建一条记录 def find_or_create_by(attributes, &block) find_by(attributes) || create(attributes, &block) end 但请注意,此方法不是原子方...
XanderCheung
7684
0
1
比如 sh install.sh 执行过程中需要键盘输入 :Enter,yes,Enter,yesRUN sh -c '/bin/echo -e "\nyes\n\nyes" | sh install.sh'