博客 (753)

在 Global.asax 的 Application_Start() 方法中添加以下代码,作用是在应用程序启动时预先访问一遍所有动态页面,办法虽土,但很有效。


本代码适合 Web Forms 项目,不适合 MVC 项目;修改代码中的 domain 值为真实的网站域名


代码整理中……


在 IIS 中设置应用程序池最长时效或永不过期,则效果更佳。

在应用程序池中选中网站对应的应用程序池,在右侧“操作”窗口中选择“正在回收...”

取消“固定间隔”框中的所有选项,确定。

未命名-1.png

实践证明,近 200 个动态页面一次性访问需要耗时近 10 分钟,发布后 10 分钟内无法正常浏览网站是同样是无法忍受的。因此更改方案为:

做一个 Winform 应用程序来定时访问这些页面,30 秒一个,一个半小时能完成一个循环,对正常浏览的影响非常小。

xoyozo 6 年前
3,159

在 MySQL 中,int 的取值范围是 [-2147483648, 2147483647],占用 4 个字节。

int(M) 中 M 的默认值为 11,该值不影响取值范围和占用字节,仅表示最大显示宽度


以某 int 字段存储的记录值为 2147483647 为例:

类型为 int(1) 时,SELECT 结果为 214
类型为 int(2) 时,SELECT 结果为 2147
……
类型为 int(7) 时,SELECT 结果为 214748364
类型为 int(8) ~ int(11) 时,SELECT 结果为 2147483647


测试结果跟网上的说法不同


如果添加了 zerofill 属性,当然是填充零的效果,仍以上述值为例:

类型为 int(1) 时,SELECT 结果为 214
类型为 int(2) 时,SELECT 结果为 2147
……
类型为 int(7) 时,SELECT 结果为 214748364
类型为 int(8) ~ int(10) 时,SELECT 结果为 2147483647
类型为 int(11) 时,SELECT 结果为 02147483647


结论,既然 M 值不影响取值范围和占用字节,那么何必去改它呢。除非有特殊业务需求,否则很容易引起逻辑混乱,特别是当你误认为它是用来限定取值范围或节省存储空间的时候。

xoyozo 6 年前
3,808
发布选项 \ 项目类型Web 窗体网站

Web 应用程序

(Web 窗体)

Web 应用程序

(MVC)

ASP.NET Core 

Web 应用程序

在发布期间预编译

Precompile during publishing

若勾选,将 .cs 文件编译为 .dll
无论是否勾选,都将 .cs 文件编译为 .dll

允许更新预编译站点

Allow precompiled site to be updatable

若不允许,则会将 .aspx 等页面也一同编译,并以内容“这是预编译工具生成的标记文件,不应删除!”代替

未进行完整的测试和分析,总结有误请指正。

xoyozo 6 年前
4,534
用途批头规格头型
备注
台式机4mm~5mm十字
笔记本外壳3.0mm十字
笔记本内部2.0mm~2.4mm十字
苹果平板笔记本1.2mm五角
苹果中板(套筒)螺丝2.5mm十字可用一字螺丝刀代替
苹果7
0.6mm
三角(Y型)
iPhone 外壳底部0.8mm五角
iPhone 内部
1.25mm~1.5mm十字
三星手机
1.25mm~1.5mm十字个别 2.0mm
小米手机
1.25mm~1.5mm十字


PH000:1.5mm 十字

PH00:2.0mm 十字

PH0:约 3mm 十字

PH1:约 5mm 十字

PH2:约 6.5mm 十字

PH3:约 8mm 十字


购买时请选择:磁性旋转

xoyozo 6 年前
11,338

AngulrAdminLTE
Amaze UI
收费情况收费免费免费




清除浮动

.am-cf

























xoyozo 6 年前
3,494

EF 提供一个查询 SQL 日志的属性:

DbContext.Database.Log

该属性是一个委托。

最简单的用法是直接输出到控制台:

DbContext.Database.Log = Console.WriteLine;

WebFrom 中可以输出到页面:

DbContext.Database.Log = Response.Write;

该委托可以带一个参数,利用它可以输出简单格式化的日志信息:

DbContext.Database.Log = (sql) =>
{
    Console.WriteLine("查询开始");
    Console.WriteLine(sql);
    Console.WriteLine("查询结束");
};

上面是直接输出到控制台或页面,当然也可以保存到变量:

string s = "";
DbContext.Database.Log = (sql) =>
{
    s += sql;
};

当然还有更强大更广泛的使用方式,有兴趣可以参阅 Jeffcky 的文章

xoyozo 6 年前
6,397

函数功能:添加/修改/删除/获取 URL 中的参数(锚点敏感)

/// <summary>
/// 设置 URL 参数(设 value 为 undefined 或 null 删除该参数)
/// <param name="url">URL</param>
/// <param name="key">参数名</param>
/// <param name="value">参数值</param>
/// </summary>
function fn_set_url_param(url, key, value) {
    // 第一步:分离锚点
    var anchor = "";
    var anchor_index = url.indexOf("#");

    if (anchor_index >= 0) {
        anchor = url.substr(anchor_index);
        url = url.substr(0, anchor_index);
    }

    // 第二步:删除参数
    key = encodeURIComponent(key);
    var patt;

    // &key=value
    patt = new RegExp("\\&" + key + "=[^&]*", "gi");
    url = url.replace(patt, "");

    // ?key=value&okey=value  -> ?okey=value
    patt = new RegExp("\\?" + key + "=[^&]*\\&", "gi");
    url = url.replace(patt, "?");

    // ?key=value
    patt = new RegExp("\\?" + key + "=[^&]*$", "gi");
    url = url.replace(patt, "");

    // 第三步:追加参数
    if (value != undefined && value != null) {
        value = encodeURIComponent(value);
        url += (url.indexOf("?") >= 0 ? "&" : "?") + key + "=" + value;
    }

    // 第四步:连接锚点
    url += anchor;

    return url;
}

/// <summary>
/// 获取 URL 参数(无此参数返回 null,多次匹配使用“,”连接)
/// <param name="url">URL</param>
/// <param name="key">参数名</param>
/// </summary>
function fn_get_url_param(url, key) {
    key = encodeURIComponent(key);
    var patt = new RegExp("[?&]" + key + "=([^&#]*)", "gi");

    var values = [];

    while ((result = patt.exec(url)) != null) {
        values.push(decodeURIComponent(result[1]));
    }

    if (values.length > 0) {
        return values.join(",");
    } else {
        return null;
    }
}


调用示例:

var url = window.location.href;

// 设置参数
url = fn_set_url_param(url, 'a', 123);

// 获取参数
console.log(fn_get_url_param, url, 'a');


压缩版:

function fn_set_url_param(b,c,e){var a="";var f=b.indexOf("#");if(f>=0){a=b.substr(f);b=b.substr(0,f)}c=encodeURIComponent(c);var d;d=new RegExp("\\&"+c+"=[^&]*","gi");b=b.replace(d,"");d=new RegExp("\\?"+c+"=[^&]*\\&","gi");b=b.replace(d,"?");d=new RegExp("\\?"+c+"=[^&]*$","gi");b=b.replace(d,"");if(e!=undefined&&e!=null){e=encodeURIComponent(e);b+=(b.indexOf("?")>=0?"&":"?")+c+"="+e}b+=a;return b}
function fn_get_url_param(b,c){c=encodeURIComponent(c);var d=new RegExp("[?&]"+c+"=([^&#]*)","gi");var a=[];while((result=d.exec(b))!=null){a.push(decodeURIComponent(result[1]))}if(a.length>0){return a.join(",")}else{return null}};


xoyozo 6 年前
3,134
提供商IPv4IPv6备注
下一代互联网国家工程中心

240c::6666

240c::6644

http://www.chinaipv6.com.cn/

我国首个 IPv6 公共 DNS

114DNS

114.114.114.114

114.114.115.115


http://www.114dns.com/

虽然称为 114DNS,但并非电信专用,联通、移动全国通用。

阿里

223.5.5.5

223.6.6.6

2400:3200::1

2400:3200:baba::1

http://www.alidns.com/

腾讯(DNSPod)
119.29.29.29

https://www.dnspod.cn/Products/Public.DNS

百度180.76.76.762400:da00::6666

http://dudns.baidu.com/intro/publicdns/

谷歌

8.8.8.8

8.8.4.4


更国际化
IBM
9.9.9.9

Cloudflare

1.1.1.1

1.0.0.1

2001:2001::

2001:2001:2001::

全球最快


xoyozo 6 年前
3,692

RHSA-2017:1842: kernel security, bug fix, and enhancement update (Important)

RHSA-2017:1615: kernel security and bug fix update (Important)

RHSA-2017:1372: kernel security and bug fix update (Moderate)

RHSA-2017:1308: kernel security, bug fix, and enhancement update (Important)

RHSA-2017:0933: kernel security, bug fix, and enhancement update (Important)

RHSA-2017:0892: kernel security and bug fix update (Important)

RHSA-2017:0817: kernel security, bug fix, and enhancement update (Moderate)

RHSA-2017:0307: kernel security and bug fix update (Moderate)

RHSA-2017:0036: kernel security and bug fix update (Important)

RHSA-2016:2766: kernel security and bug fix update (Important)

RHSA-2016:2105: kernel security update (Important)

RHSA-2016:2006: kernel security and bug fix update (Important)

RHSA-2016:1406: kernel security and bug fix update (Important)

RHSA-2016:0855: kernel security, bug fix, and enhancement update (Moderate)

RHSA-2016:0715: kernel security, bug fix, and enhancement update (Moderate)


修复命令:yum update kernel

修复后需要重新启动系统(阿里云技术回复:-devel 的组件涉及系统核心,必须重启才能生效),否则安骑士依然会提示漏洞待处理,漏洞依然存在。


扩展阅读:修改内核引导顺序(阿里云教程)


6364653052494532088476105.png

xoyozo 6 年前
5,431

风险名称:系统共享配置检测

风险等级:中危


检测项说明:

检测注册表项HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\LSA\\RestrictAnonymous的值,该值控制是否允许远程操作注册表


检测项目:

远程操作注册表

建议值:

1

路径:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\LSA\RestrictAnonymous

建议:

建议禁止远程访问操作注册表,建议关闭


xoyozo 6 年前
3,250