Sunday, October 30, 2016

UCCB

UCCB

Effective July 1, 2016, the universal child care benefit (UCCB) is replaced by the Canada child benefit(CCB);

Foreign worker can get his UCCB after 18 months. for me, I get $2220 one time and $160 per month:

  • $100 for [2014/10,2015/01)
  • as since 2015, the UCCB increased to $160 per month, I recv $1920 for 2015
  • after the one-time payment, I get $160 per month until my work permit finished.

Tuesday, September 20, 2016

KvmSwitch_issue

KvmSwitch_issue

problem:when you put your mouse into/out of the virtual machine, it 'kicks' your KVM switch out to the other computer.

solution: get yourself to be used to not using Num-Lock, disable both on VM and hosts.

Ubuntu_XWin_OpenTerms

Ubuntu_XWin_OpenTerms

use ctrl + alt + t to open terminal, at better we arrange at most 4 terms on desktop.

Sunday, August 7, 2016

劝 学(节选)(一)

劝 学(节选)(一)

积土成山,风雨兴焉;积水成渊,蛟龙生焉;积善成德,而神明自得,圣心备焉。故不积跬步,无 以致千里;不积小流,无以成江海。骐骥一跃,不能十步;驽马十驾,功在不舍。锲而舍之,朽木不 折;锲而不舍,金石可镂。蚓无爪牙之利,筋骨之强,上食埃土,下饮黄泉,用心一也。蟹八跪而二螯, 非蛇蟺之穴无可寄托者,用心躁也。是故无冥冥之志者,无昭昭之明。无惛惛之事者,无赫赫之功。行 衢道者不至,事两君者不容。目不能两视而明,耳不能两听而聪。螣蛇无足而飞,鼫鼠五技而穷。 枟诗枠曰:“尸鸠在桑,其子七兮。淑人君子,其仪一兮。其仪一兮,心如结兮。故君子结于一世。”

跬步: 半步(迈右脚为一跬,再迈左脚为另一跬)。

骐骥:千里马的别称。

驽马:拙劣的马

十驾: 跑十天

锲/镂:都是雕刻的意思

蛇蟺(dan 第四声):蛇和黄鳝

耳不能两听而聪:耳朵不能同时听两个(地方的)声音

鼫(shi, 第四声)鼠五技而穷:鼫鼠会飞会游但是每一样都不精通。

尸鸠在桑,其子七兮。淑人君子,其仪一兮。其仪一兮,心如结兮。故君子结于一世: 布谷鸟在桑树上,有很多女朋友;君子只心仪一个,他的心意像打了结一样。

Saturday, July 30, 2016

iphone丢失模式

请先阅读下文 查找我的iphone

其实“丢失模式”顾名思义就是丢失iPhone的时候用的,如果iPhone没设密码的话可以远程设置一个密码和信息,让捡到iPhone的人看到信息把手机归还.

发现手机丢失后,请使用电脑登陆iCloud.com,点击“查找我的iPhone”。

输入iCloud密码,进入找回我的手机界面!随后,点击顶部的“所有设备”(一个ID下有多个设备),选择丢失的iOS设备。

选择设备之后,屏幕右侧会出现该设备的控制窗口。

选择“丢失模式”后,iCloud会提示你输入锁机密码(在找回iPhone后,我们需要输入以上四位数进行设备解锁)。

继续按提示输入联系电话以及信息,以上信息都将在设备成功锁定后显示在锁屏界面上!

由于是远程锁定,因此指令的传达需要网络的传输。所以,在手机没有联网的时候,iPhone是不会被锁的!而只要手机一旦联网,iPhone便会立刻锁定!同时,手机会自动定位,我们可以在网页端上查看手机所在的具体位置。

指令生效后,iPhone便会被锁定在锁屏界面,并自动显示刚才设置的电话号码与信息!在锁定期间,除了拨打指定的联系电话就无法进行任何操作。 温馨提示:由于iOS7新增了Activation Lock功能,因此,在开启查找我的手机功能之后,无论是清空数据还是关闭“查找我的iPhone”,所有的操作都需要输入iCloud密码!最狠的是,即便强制还原或降级到iOS6(目前Apple已关闭iOS6的验证通道),也需要正确输入Apple ID与密码才可成功激活,否则只能拆机卖零件了!

查找我的iphone

查找我的iphone 在丢手机或者找不到手机的时候很有用,谨以本文作为备忘。 要使用查找我的iphone,需要在 设置 --> iCloud 中允许苹果服务器去 "查找我的iphone".
苹果服务器要定位你的iphone,你必须同意提供你的GPS(全球定位系统)位置信息(设置 --> 隐私 --> 定位服务 --> 查找我的iphone):
设置好了以后,用别人的iphone打开 "查找iphone" 程序或者在线登陆iCloud(我不确定ipad里面是否也有这个程序),它会提示你输入 AppleID 和密码, 进入以后在地图上就能看到你的手机了。 "查找iphone" 程序有一个附加功能就是向丢失的手机发送响铃,这样更方便近距离的定位(弥补GBS的精度问题),当然如果你用iphone查找iphone,近距离可以打电话来定位。

Thursday, July 14, 2016

时区时间EX

ForexTraderPro

标准时间代码

与GMT的偏移量

描述

NZDT

+13:00

新西兰夏令时

IDLE

+12:00

国际日期变更线,东边

NZST

+12:00

新西兰标准时间

NZT

+12:00

新西兰时间

AESST

+11:00

澳大利亚东部夏时制

CST(ACSST)

+10:30

中澳大利亚标准时间

CADT

+10:30

中澳大利亚夏时制

SADT

+10:30

南澳大利亚夏时制

EST(EAST)

+10:00

东澳大利亚标准时间

GST

+10:00

关岛标准时间

LIGT

+10:00

澳大利亚墨尔本时间

CAST

+9:30

中澳大利亚标准时间

SAT(SAST)

+9:30

南澳大利亚标准时间

WDT(AWSST)

+9:00

澳大利亚西部标准夏令时

JST

+9:00

日本标准时间,(USSR Zone 8)

KST

+9:00

韩国标准时间

MT

+8:30

毛里求斯时间

WST(AWST)

+8:00

澳大利亚西部标准时间

CCT

+8:00

中国沿海时间(北京时间)

JT

+7:30

爪哇时间

IT

+3:30

伊朗时间

BT

+3:00

巴格达时间

EETDST

+3:00

东欧夏时制

CETDST

+2:00

中欧夏时制

EET

+2:00

东欧,(USSR Zone 1)

FWT

+2:00

法国冬时制

IST

+2:00

以色列标准时间

MEST

+2:00

中欧夏时制

METDST

+2:00

中欧白昼时间

SST

+2:00

瑞典夏时制

BST

+1:00

英国夏时制

CET

+1:00

中欧时间

DNT

+1:00

Dansk Normal Tid

FST

+1:00

法国夏时制

MET

+1:00

中欧时间

MEWT

+1:00

中欧冬时制

MEZ

+1:00

中欧时区

NOR

+1:00

挪威标准时间

SET

+1:00

Seychelles Time

SWT

+1:00

瑞典冬时制

WETDST

+1:00

西欧光照利用时间(夏时制)

GMT

0:00

格林威治标准时间

WET

0:00

西欧

WAT

-1:00

西非时间

NDT

-2:30

纽芬兰(新大陆)白昼时间

ADT

-03:00

大西洋白昼时间

NFT

-3:30

纽芬兰(新大陆)标准时间

NST

-3:30

纽芬兰(新大陆)标准时间

AST

-4:00

大西洋标准时间(加拿大)

EDT

-4:00

(美国)东部夏令时

CDT

-5:00

(美国)中部夏令时

EST

-5:00

(美国)东部标准时间

CST

-6:00

(美国)中部标准时间

MDT

-6:00

(美国)山地夏令时

MST

-7:00

(美国)山地标准时间

PDT

-7:00

(美国)太平洋夏令时

PST

-8:00

(美国)太平洋标准时间

YDT

-8:00

Yukon夏令时

HDT

-9:00

夏威仪/阿拉斯加白昼时间

YST

-9:00

Yukon标准时

AHST

-10:00

夏威仪-阿拉斯加标准时间

CAT

-10:00

中阿拉斯加时间

NT

-11:00

州时间(Nome Time)

IDLW

-12:00

国际日期变更线,西边

时区时间

ForexTraderPro

PST:太平洋标准时间(-8:00),注意温哥华采用的是这个时间

PDT:太平洋夏令时,注意温哥华过些日子变成夏令时

ET: 美国东部时间, EST 或者 EDT: 前者为标准时间(-5:00), 后者为日光(节约)时间(-4:00). 现在是EST有效.

AST:大西洋标准时间(-4:00,加拿大部分地区采用这个)

CCT:中国沿海时间/北京时间(+8:00)

JST:日本标准时间(+9:00)

重大新闻滚动播报

重大新闻滚动播报
  • Jul 14 2016: 英国维持利率(Interest Rate Decision)不变,因脱欧以来无重大经济数据支撑 --> 需严密关注此后的经济数据以确定8月份是否会降息

Sunday, May 15, 2016

prototype


var Person = function(){this.bar = 'bar'};
Person.prototype.foo = 'foo'; // Person.prototype = { foo : 'foo', ... }

var Chef = function(){this.goo = 'goo'};
Chef.prototype = new Person(); // Chef.prototype = { bar : 'bar', ... }

var cody = new Chef();
console.log(cody.goo); // logs 'goo': own prop
console.log(cody.bar); // logs 'bar': found bar from Chef's prototype
console.log(cody.foo); // logs 'foo': found foo from Chef's prototype's prototype

__proto__never_changes

var Foo = function Foo(){};
Foo.prototype.x = 1;
var FooInstance = new Foo();
console.log(FooInstance.x); // logs 1, as you think it would

//now let’s replace/override the prototype object with a new Object() object
Foo.prototype = {x:2};
console.log(FooInstance.x); // logs 1: once created, object's __proto__ never changes

// create a new instance of Foo()
var NewFooInstance = new Foo();
console.log(NewFooInstance.x); // logs 2

constructor__is__prop_of_prototype

function Foo(){};
var aFoo = new Foo();
//constructor__is__prop_of_prototype
//aFoo.hasOwnProperty("constructor") is false, aFoo.constructor is actually Foo.prototype.constructor
alert( Foo.prototype.constructor === aFoo.constructor ) // alert "true"

Saturday, May 14, 2016

arguments

var add = function() {
/*
 even though we forgo specifying parameters when defining the function, we
can rely on the arguments array passed to the function to access parameters
*/
 return arguments[0] + arguments[1];
};
console.log(add(4, 4)); // returns 8

Friday, May 13, 2016

吐槽温哥华房产交易

温哥华买房,有几点对买家不利:

  • 竞价机制 一般来说,卖方会出一个比政府估价高很多的价格,在这个价格之上,各买家出价,第一次竞价已经把房价炒到很高了,但是买家还可以加价,这不尼玛扯吗,怪不得房价这么高。
  • 障碍解除机制 除了在出价上PK之外,买方的offer(购买意愿书)还包括一个障碍清单,这本来是利好买家,可是如果你出的是带条件的offer,卖方就基本不会接受。原本先天属于买家的这种权利就这样被剥夺了!
  • 验房成为一种奢侈 验房是买家的先天权利,在无条件offer中被剥夺。
  • 贷款成为巨大风险 买家在买房的时候不可能知道自己能不能贷到款,而障碍解除机制中你不能把贷不到款作为你的障碍,这样你的定金就可能打水漂。
  • 评估成为一种猫腻 因为在竞价中把房价炒到很高,所以银行很可能不愿意按照那个价格给你贷款,这时候差价你就得自己去凑,凑不到的话定金还是打水漂。买家同样不能把评估风险作为障碍

Wednesday, May 11, 2016

primitive_and_prototype_chain

var i = 10
Object.prototype.foo = 'Foo';
alert( i.foo ) //Foo

i.bar = 'Bar' // No effect: primitive is not extensive in own props
alert( i.bar )// undefined

alert( i.constructor ) // function Number(){}
alert( typeof i.constructor.prototype ) //object

Sunday, May 8, 2016

reference

var myObject = {};
var copyOfMyObject = myObject;
myObject.foo = 'bar';
console.log(myObject, copyOfMyObject); // logs 'Object { foo="bar"} Object { foo="bar"}'

=== operator for js

var price1 = 10;
var price2 = 10;
var price3 = new Number('10');
var price4 = price3;
var price5 = new Number('10');
console.log(price1 === price2); // logs true: primitive values compared by value

console.log(price1 === price3); //logs false: compares object with primitive

console.log(price4 === price3);// logs true: same references

alert("now checking price5...")
console.log(price5 === price3);// logs false: diff references

Monday, January 18, 2016

single-threaded apartment

/*Rules for single-threaded apartments are simple, but it is important to follow them carefully: Every object should live on only one thread (within a single-threaded apartment). Marshal all pointers to objects when passing them between apartments./*传统线程可以访问同进程内的资源*/ Each single-threaded apartment must have a message loop to handle calls from other processes and apartments within the same process. Single-threaded apartments without objects (client only) also need a message loop to dispatch broadcast sendmessages that some applications use. DLL-based or in-process objects do not call the COM initialization ;Each thread of a client process or out-of-process server must call CoInitialize, or call CoInitializeEx and specify COINIT_APARTMENTTHREADED for the dwCoInit parameter。The main apartment is the thread that calls CoInitializeEx first. DLL-based or in-process objects register their threading model with the ThreadingModel named-value under the InprocServer32 key in the registry. Apartment-aware objects must also write DLL entry points carefully. */ COM creates a hidden window using the Windows class "OleMainThreadWndClass" in each single-threaded apartment. A call to an object is received as a window message to this hidden window. When the object's apartment retrieves and dispatches the message, the hidden window will receive it. The window procedure will then call the corresponding interface method of the object. Single-threaded apartments can implement IMessageFilter 。 综上,单线程套间本质上是一个类(接口),保存着一个窗口句柄、一个线程(线程先初始化com库[就是注册],然后有消息loop)、0或多个组件对象、客户线程(也需要在com注册),该类(接口)可以进一步实施IMessageFilter接口。

In-Process Server Threading Issues

Like other servers, in-process servers can be single-threaded, apartment-threaded, or free-threaded. These servers can be used by any OLE client, regardless of the threading model used by that client. For an in-process server, when the threading model of the client and in-process server differ, COM must interpose itself between the client and the object. When an in-process object that supports the single-threaded model is called simultaneously by multiple threads of a client, COM cannot allow the client threads to directly access the object's interface—the object was not designed for such access.Instead, COM must ensure that calls are synchronized and are made only by the client thread that created the object. Therefore, COM creates the object in the client's main apartment and requires all the other client apartments to access the object by using proxies. When a free-threaded apartment (multithreaded apartment model) in a client creates an apartment-threaded in-process server, COM spins up a single-threaded apartment model "host" thread in the client. This host thread will create the object, and the interface pointer will be marshaled back to the client's free-threaded apartment. Similarly, when a single-threaded apartment in an apartment-model client creates a free-threaded in-process server, COM spins up a free-threaded host thread (multithreaded apartment on which the object will be created and then marshaled back to the client single-threaded apartment). COM helps protect access to objects provided by a single-threaded DLL by requiring access from the same client apartment in which they were created. In addition, all of the DLL entry points (like DllGetClassObject and DllCanUnloadNow) and global data should always be accessed by the same apartment. COM creates such objects in the main apartment of the client, giving the main apartment direct access to the object's pointers. Calls from the other apartments use interthread marshaling to go from the proxy to the stub in the main apartment and then to the object. This allows COM to synchronize calls to the object. Interthread calls are slow, so it is recommended that these servers be rewritten to support multiple apartments. single-threaded的全称应该是single-thread-per-process。

COM Fundamentals

COM requires that the only way to gain access to the methods of an interface is through a pointer to the interface. An interface definition specifies the interface's member functions, called methods, their return types, the number and types of their parameters, and what they must do. There is no implementation associated with an interface. COM interfaces are immutable—You cannot define a new version of an old interface and give it the same identifier. Adding or removing methods of an interface or changing semantics creates a new interface, not a new version of an old interface. Therefore, a new interface cannot conflict with an old interface. However, objects can support multiple interfaces simultaneously and can expose interfaces that are successive revisions of an interface, with different identifiers. Thus, each interface is a separate contract, and systemwide objects need not be concerned about whether the version of the interface they are calling is the one they expect. The interface ID (IID) defines the interface contract explicitly and uniquely. All COM objects must implement the IUnknown interface。 For any given object instance, a call to QueryInterface(IID_IUnknown, ...) must always return the same physical pointer value(((IUnknown*)*ppv)->AddRef(); ). This allows you to call QueryInterface(IID_IUnknown, ...) on any two interfaces and compare the results to determine whether they point to the same instance of an object. Containment/Delegation(包容/托管) the outer object explicitly delegates implementation to the inner object's methods,That is, the outer object uses the inner object's services to implement itself.显然所有com对象都支持包容。 Aggregation is actually a specialized case of containment/delegation.the outer object exposes interfaces from the inner object as if they were implemented on the outer object itself. The following rules apply to creating an aggregable object: The aggregable (or inner) object's implementation of QueryInterface, AddRef, and Release for its IUnknown interface controls the inner object's reference count, and this implementation must not delegate to the outer object's unknown (the controlling IUnknown). The aggregable (or inner) object's implementation of QueryInterface, AddRef, and Release for its other interfaces must delegate to the controlling IUnknown and must not directly affect the inner object's reference count. The inner IUnknown must implement QueryInterface only for the inner object. The aggregable object must not call AddRef when holding a reference to the controlling IUnknown pointer. When the object is created, if any interface other than IUnknown is requested, the creation must fail with E_NOINTERFACE.