琐事笔记
还是经常会忘记一些事情,毕竟是大脑内存容量有限啊
一、rails
1、rails中 url 和 path的区别
def index p users_path p users_urlend
输出
"/users""http://127.0.0.1:3000/users"
一个是全路径,一个是相对路径
format("%.2f",1.222222).to_f
2、注释
单行注释用井号即可
# 定义一个方法def hello # 打印hello p "hello"end
注释多行代码
=begin def hello p 'world' end=end
三、mysql
1、mysql时间比对
select * from table_name where datediff('时间一','时间二') > 0(>0 =0 <0 三种情况)
2、mysql启动操作
下操作方法:
ALTER TABLE tablename ENGINE = MyISAM
4、查看mysql的错误日志
show variables like 'log_error';
5、查看mysql的运行状态
show [session|global] status
等同于
mysqladmin extended-status
6、查看mysql的所有进程
show full processlist;show processlist;
7、查看建表语句
show create table 表名;