How to Update Hexo?
Hexo 4.0.0 has been released on 2019-10-14. How to upgrade it?
Hexo 4.0.0 has been released on 2019-10-14. How to upgrade it?
Unity是一个.NET Framework用于依赖注入的容器。依赖注入一般分为三个阶段:Register, Resolve和Dispose。Unity支持三种方式的Register:
那这三种方式分别用于什么场景呢?简单来说,Instance registration和Type
registration较为常见,直接通过ResolvedParameter解析依赖的对象,Factory
registration更灵活,可以通过调用方法创建对象。举个例子,如果注入对象所依赖的参数是一个List<T>
或Dictionary<T1, T2>
,而T又是自定义的类,那么就必须使用Factory
registration。本文主要介绍的就是如何解析一个自定义类的List或Dictionary。
When you use RegisterType or RegisterInstance combined with InjectionFactory in old version of Unity, the following complier warning will be displayed:
'InjectionFactory' is obsolete: 'InjectionFactory has been deprecated and will be removed in next release. Please use IUnityContainer.RegisterFactory(...) method instead.
使用Unity的InjectionFactory进行依赖注入遇到如下提示:
'InjectionFactory' is obsolete: 'InjectionFactory has been deprecated and will be removed in next release. Please use IUnityContainer.RegisterFactory(...) method instead.
在代码库里看到不少Task.ContinueWith()的代码,查了下语法,没太理解下面两种写法的区别(借用MSDN的代码):
public static async Task ContinueWithExample()
{
// Execute the antecedent.
Task<DayOfWeek> taskA = DayOfWeekAsync();
// Execute the continuation when the antecedent finishes.
await taskA.ContinueWith(antecedent => Console.WriteLine("Today is {0}.", antecedent.Result));
}
AIMD (additive-increase/multiplicative-decrease)是用于TCP拥塞控制的算法。AIMD思想虽然简单,但我认为它非常符合“simple but elegant”的哲学。尤其是在多连接拥塞控制中的公平性分析,还挺巧妙。这里主要探讨AIMD在非TCP场景下的应用,不对其原理进行深度剖析。
Crawler运行一段时间后可能会莫名其妙地停止工作,查看日志发现如下错误:
session not created: This version of ChromeDriver only supports Chrome version 76
原因是用selenium创建ChromeDriver时,ChromeDriver与ChromeBrowser的版本不匹配(这玩意儿兼容性看起来不是很好),而此问题总是发生的原因在于ChromeBrowser会自动升级,因此需要手动将ChromeDriver也升级到对应版本。
卤煮火烧是一道地道的北京小吃,如果你爱吃内脏,那它必定是你不能错过的美味; 反之则是吾之蜜糖,彼之砒霜,唯恐避之不及。其实许多北京小吃还是挺好吃的,只是术业有专攻,吃每样小吃得找对店铺,自然得花些功夫。加之街头许多店挂羊头卖狗肉,打着名吃的旗号却做不出那个味儿,大部分人尤其是游客只想尝个鲜,随口一吃就下了结论“这东西真难吃”,殊不知只是没找对地方。而许多景点又有太多所谓小吃一条街,表面看来方便了食客将美食一“街”打尽,实际却砸了招牌,几无回头客。
一行中并排显示两图片,搜索了下,有说两张并排这么写的:
<figure class="half">
<img src="http://xxx.jpg">
<img src="http://yyy.jpg">
</figure>
试了下,在Hexo中并不好使,估计这个需要额外安装包支持。
工厂模式是一种常见设计模式,大多数资料会将其分为三种:简单工厂模式(Simple Factory),工厂模式(Factory Method)和抽象工厂模式(Abstract Factory)。按照《HeadFirst Design Pattern》的说法,Simple Factory其实不能称之为一种设计模式,因为它主要思想是把对象创建的功能隔离开来,也是工厂模式思想的基础。本文主要讨论工厂模式和抽象工厂模式的对比及不同应用场景,假设读者对两种模式已有基本了解。