ubuntu mysql5.5升级到5.7,添加5.7的源后,直接安装就会自动升级了。
升级完成后,要执行一下
mysql_upgrade -u root -p --force
不然执行sql语句的时候会报错: Table 'performance_schema.session_status' doesn't exist
ubuntu mysql5.5升级到5.7,添加5.7的源后,直接安装就会自动升级了。
升级完成后,要执行一下
mysql_upgrade -u root -p --force
不然执行sql语句的时候会报错: Table 'performance_schema.session_status' doesn't exist
sqlite获取当前时间:
SELECT datetime('now', 'localtime')
C# WINFORM使用html css里十六进制颜色格式:
BackColor = ColorTranslator.FromHtml("#626262");
Ctrl + M + O: 折叠所有方法
Ctrl + M + M: 折叠或者展开当前方法
Ctrl + M + L: 展开所有方法
在laravel的blade视图中,想要获取route名称,可以使用下面的代码:
Route::currentRouteName()
C#使用正则判断一个字符串是否为IP地址:
private boolean isIp(String ip) {
String rex =
"^([01]?\\d\\d?|2[0-4]\\d|25[0-5])\\." +
"([01]?\\d\\d?|2[0-4]\\d|25[0-5])\\." +
"([01]?\\d\\d?|2[0-4]\\d|25[0-5])\\." +
"([01]?\\d\\d?|2[0-4]\\d|25[0-5])$";
Pattern pattern = Pattern.compile(rex);
Matcher matcher = pattern.matcher(ip);
return matcher.find();
}
对C#缓存absoluteExpiration、slidingExpiration两个参数有点疑惑,看了很多资料终于搞明白 cache 中 absoluteExpiration,slidingExpiration 这两个参数的含义。
absoluteExpiration:用于设置绝对过期时间,它表示只要时间一到就过期,所以类型为System.DateTime,当给这个参数设置了一个时间时,slidingExpiration参数的值就只能为Cache.NoSlidingExpiration,否则出错;
slidingExpiration:用于设置可调过期时间,它表示当离最后访问超过某个时间段后就过期,所以类型为System.TimeSpan,当给这个参数设置了一个时间段时,absoluteExpiration的值就只能为Cache.NoAbsoluteExpiration,否则出错;
SQL SERVER查看最近2小时的数据的SQL语句:
select * from baijia_articles where updated_at >=dateadd(mi,-120,getdate())
VS2017在使用VS2015编译的libcurl静态库时报错,错误信息如下:
1>libcurld.lib(cookie.obj) : error LNK2019: unresolved external symbol ___iob_func referenced in function _Curl_cookie_init
1>libcurld.lib(url.obj) : error LNK2001: unresolved external symbol ___iob_func
1>libcurld.lib(mprintf.obj) : error LNK2001: unresolved external symbol ___iob_func
1>libcurld.lib(formdata.obj) : error LNK2001: unresolved external symbol ___iob_func
1> fatal error LNK1120: 1 unresolved externals
在stdafx.h中增加如下 代码:
FILE _iob[] = { *stdin, *stdout, *stderr };
extern "C" FILE * __cdecl __iob_func(void) { return _iob; }
再重新编译即可通过。
sql server游标的使用示例代码:
declare test_cursor cursor for
select t1.baijiahao as bjh_name, t1.baijiahao_home_url as home_url, t2.category_name as domain from baijia_articles t1
inner join category t2
on t1.cat_id = t2.id
open test_cursor
declare @bjh_name nvarchar(50)
declare @home_url nvarchar(90)
declare @domain nvarchar(50)
fetch next from test_cursor into @bjh_name, @home_url, @domain
while @@fetch_status=0
begin
if not exists ( select id from baijiahao where bjh_name=@bjh_name) insert into baijiahao(bjh_name, home_url, domain) values(@bjh_name, @home_url, @domain)
fetch next from test_cursor into @bjh_name, @home_url, @domain
end
close test_cursor
deallocate test_cursor