Skip to content

Home

Hexo折腾笔记(二)博客优化与定制

首先我使用的是由zippera基于官方Light主题改进而来的Lightum主题,其他主题可能稍有出入。

速度优化

参考之前的文章:静态页面优化。然后使用了hexo-qiniu-sync这个项目,将静态的图片以及css、js同步到了七牛云。(PS:主题模板中包含了两个不同版本的jquery,分别在head.ejs与after-footer.ejs中,随便删除一个。)

对于处于body区域的script、style的引用尽可能的加入data-no-instant属性,避免InstantClick重复加载。

给instantclick加载进度条加上阴影效果

#instantclick-bar{
-webkit-box-shadow: 0 0 8px rgba(0, 0, 0, 0.56);
box-shadow: 0 0 8px rgba(0, 0, 0, 0.56);
}

加入Swiftype搜索

Swiftype官网申请代码,然后修改search.ejs文件为:

<div class="search">
<form>
<input type="search" id="st-search-input" placeholder="<%= __('search') %>">
</form>
</div>

Hexo折腾笔记(一)博客加速以及instantclick的兼容

~~首先,Gitcafe的国内速度已经够快了,加不加速其实没多大区别,只不过是闲的蛋疼而已。~~ Gitcafe无故page不更新,所以又换回了github。

Hexo加速

Hexo加速可以有以下几个方面: 1. 使用BootCDN并将图片等资源储存至七牛云。可以使用此项目click here。 2. 使用hexo optimize压缩优化HTML、CSS、JS、Image资源。 3. 使用InstantClick

InstantClick是一款类似于Turbolinks的js库,利用pjax(pushState and Ajax)技术对网站进行优化,能够极大的提高访问速度。

ASP.NET MVC4笔记(一) 扩展Simplemembership

using System.Web.Mvc;

namespace MvcClassManageSystem.ActionFilters
{
    public class LogStateFilterAttribute : ActionFilterAttribute
    {
        public override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            base.OnActionExecuting(filterContext);
            //string controller = filterContext.RouteData.Values["controller"].ToString();
            //string action = filterContext.RouteData.Values["action"].ToString();
            //System.Diagnostics.Debug.WriteLine("OnAction:" + controller + "/" + action);

            if (WebMatrix.WebData.WebSecurity.IsAuthenticated == true)
            {
                filterContext.Result = new RedirectToRouteResult(new System.Web.Routing.RouteValueDictionary(new { Controller = "Home", action = "Index" }));
            }
        }
    }
}

ASP.NET MVC 4笔记(二)

  1. 有Timestamp修饰的表在修改已有的记录是一定要将该字段复制,也就是说一定要在Edit网页里面添加一行: @Html.HiddenFor(model => model.RowVersion)
  2. WebSecurity.CreateAccount必须在Userprofile里面先创建账户。 System.Diagnostics.Debug.WriteLine("OnAction:" + controller + "/" + action);
  3. 转换string数组到int数组 int[] HostsList = Array.ConvertAll(Request["HostsId"].Split(','), u => int.Parse(u));

(转)慢慢的,就没有了,就像从未存在过

几年以前,我曾经嘲笑过某科技界大佬。当时他说:也许90后、95后会慢慢不知道谷歌是什么网站。

那一年,这对于我来说简直就是世界上最好笑的笑话。谷歌,全世界最卓越的互联网公司,活在互联网的一代中国人,会不知道他们的网站?

今天,我收回这句嘲笑。因为这件不可能的事,它慢慢变成了现实。

没有人再关注什么谷歌不谷歌。对他们来说,百度也蛮好用的,反正他们几乎没用过谷歌。没有谷歌又怎样?大家还是开心的刷微博,看微信,听歌,看娱乐节目。对于从来就不知道谷歌的人来说,少了谷歌又有什么影响?

慢慢的,就没有了,就像从未存在过

ZOJ month contest D.Determinant and Matrix


Time Limit: 2 Seconds      Memory Limit: 65536 KB


Description

Recently, LBH is learning the curse linear algebra. Thus he is very interested in matrix and determinant now. In order to practice his ability of solving the problem of linear algebra, he just invent some problems by himself. Once the problems was create, he would solve it immediately. However, he meet a problem that was so hard that he couldn't work out even though racked his brains. The problem was described as follow:

To a integer martix Mnn(aij), we define two function add(Mnn(aij))=Mnn(aij + 1) and sub(Mnn(aij))=Mnn(aij - 1) which were exactly like this:

baylor 6622 Absurdistan Roads( NWERC Contest)

原题pdf:click here

Description

The people of Absurdistan discovered how to build roads only last year. After the discovery, every city decided to build their own road connecting their city with another city. Each newly built road can be used in both directions.

Absurdistan is full of surprising coincidences. It took all N cities precisely one year to build their roads. And even more surprisingly, in the end it was possible to travel from every city to every other city using the newly built roads.

FFT求快速卷积的思考

离散型卷积的定义是:$$y(n)=\sum_{m=0}^{n} x(m)h(n-m)$$

注意,h函数是反转的。

在Chipher Messages一题中,b串需要反转再与a串匹配。

比如说:

a串: 110110110,则:

b`串:1011<------这里才是原来b串的头。但是向上对应到a串时,已经是m-1这个位置了。所以说,小于m-1的卷积是没有意义的。

于是,base=m。整体匹配。