Wednesday, April 20, 2016

TD Benifit

If you select a registered account:
• your contributions are made with ‘before-tax’ dollars each pay.
• TD’s contributions will go into a Deferred Profit Sharing Plan or DPSP and you will receive a tax
receipt showing TD’s contributions as part of your Pension Adjustment. This amount will reduce
your RSP contribution room for the next year.
If you direct either your own or TD’s contributions into a registered account, you need to ensure you
have available RSP contribution room.
If you select a non registered account…
• your contributions are made with ‘after tax’ dollars.
• TD’s contributions are considered taxable income and you will receive a T4PS slip at tax time.
The Employee Ownership Plan provides flexibility to make changes each calendar quarter.

If you withdraw from an RSP account,
 The amount withdrawn is taxable.
 You’ll receive a tax receipt for your withdrawal amount and you’ll need to report this as
taxable income for the year.
If you withdraw from a non-registered account no tax slip is issued.
• You are responsible for calculating and reporting any capital gains or losses on your TD
Bank shares on your income tax return.
• Please refer to HR Self Service for your annual statements, transaction history and your
withdrawal statement for the information you need to calculate and report you capital gains
or losses.

If you leave TD and…
have been employed by TD for 2 continuous years, you’re entitled
to your total Employee Ownership Plan balance
 have not been employed by TD for 2 continuous years, you can
withdraw your contributions only. TD’s contributions are forfeited.
 If you return to TD within 3 months, you can participate in the
Employee Ownership Plan immediately.

Oracle pl/sql note

DBMS_METADATA
BEGIN DBMS_METADATA.SET_TRANSFORM_PARAM(DBMS_METADATA.SESSION_TRANSFORM,'PRETTY', true); END;
DBMS_METADATA.GET_DDL

Oracle 11g new features:
continue support
virtual column
disabled triggers
result cache

The advantage to using RAISE_APPLICATION_ERROR instead of RAISE is that you can associate
an error message with the exception.

SQLERRM will return is 512 bytes, Oracle recommends DBMS_UTILITY.FORMAT_ERROR_STACK
DBMS_UTILITY.FORMAT_ERROR_BACKTRACE --see the error line number

System exception
An exception that is defined by Oracle and is usually raised by the PL/SQL runtime
engine when it detects an error condition. Some system exceptions have names,
such as NO_DATA_FOUND, while many others simply have numbers and
descriptions.
Programmer-defined exception
An exception that is defined by the programmer and is therefore specific to the
application at hand. You can associate exception names with specific Oracle errors
using the EXCEPTION_INIT pragma (a compiler directive, requesting a specific
behavior), or you can assign a number and description to that error using
RAISE_APPLICATION_ERROR.

Associative arrays:
 like hash table
Nested tables:
 unbounded
 become sparse through deletions
 no inherent order to the elements
varrays:
 must specify the max number of elements
 never sparse
 element order is preserved

python note

Java is a statically typed language, i.e. the types are checked and enforced at compile time. In contrast, Python is dynamic which means that the types are checked only at runtime.
Python also supports a rich set of functional programming features and idioms. In Python, functions are first-class objects that can be created, manipulated and passed around just
like any other object.

== is for value equality.
is is for reference equality.

The // operator is also provided for doing floor division no matter what the operands are.
>>> 17 / 3.0  # int / float -> float
5.666666666666667
>>> 17 // 3.0  # explicit floor division discards the fractional part
5.0

Python is an interpreted language, which can save you considerable time during program development because no compilation and linking is necessary.
The interpreter can be used interactively.

ensures they are always cleaned up promptly and correctly.
with open("myfile.txt") as f:
    for line in f:
        print line

comments:
# or """ """


write file:
>>> out=open("data.out","w")
>>> print("Its a write test for Python",file=out)
>>> out.close

try/except/finally
try:
data = open('its.txt', "w")
print("It's...", file=data)
except IOError as err:
print('File error: ' + str(err))
finally:
if 'data' in locals():
data.close()

Sunday, April 17, 2016

在成长的过程中丢弃了最初的美好

很多人都在成长的过程中丢弃了最初的美好,当初执拗的相信童话的孩子永远的走向了成年,抛却了一切童真,行走于这纷扰的世间,为各种各样的事奔波劳碌,但心里总归还是相信美好,周星驰用独特的方式,在俗世中维护了曾经我们每个人那颗纯真的心。

Wednesday, April 13, 2016

Design Patters example in JDK

Swing
EventListener: Observer
BorderFactory: Factory
Look and feel: Abstract Factory


1. Creational Patterns
Factory
BorderFactory.createLineBorder
BorderFactory.createTitledBorder
Factory Method
Calendar.getInstance()
Abstract Factory
SWT control (or JDK look & feel)
IGUIFactory (WinFactory, OSXFactory ...)
IButton (WinButton, OSXButton ...)
if(Win)
createWinButton
Builder (too many parameters)
StringBuffer.append
StringBuilder.append
ProtoType (reduce the class number)
Object.clone() (Cloneable)
Singleton
Runtime.getRuntime()
lazy initialization
eager initialization
static block initialization
static class holder
enum way
NullObject

2. Structural Patterns (Structural patterns are concerned with how classes and objects arecomposed to
form larger structures.Structural class patterns use inheritance to compose
interfacesor implementations.)
Adapter (Convert the interface of a class into another interface clients expect)
InputStreamReader(InputStream): returns a Reader
Arrays.asList
Bridge (TODO):
Composite (Compose objects into tree structures to represent part-whole hierarchies.
Composite lets clients treat individual objects and compositions of object uniformly.)
Container.add: return Component
Decorator (Attach additional responsibilities to an object dynamically. Decorators provide
a flexible alternative to subclassing for extending functionality.):
1. All subclasses of java.io.InputStream, OutputStream, Reader and Writer have a constructor taking an instance of same type.
2. java.util.Collections, the synchronizedXXX() and unmodifiableXXX() methods.
Facade
My example: ACUtils.getResult(String queryStr) return List<String>
Flyweight
Integer.valueOf, Boolean.valueOf
proxy (Provide a surrogate or placeholder for another object to control access to it.)
java.lang.reflect.Proxy (InvocationHandler.newInstance())
rmi/web service

3. Behavioral Patterns (Behavioral patterns are concerned with algorithms and theassignment of
responsibilities between objects. Behavioral patternsdescribe not just patterns
of objects or classes but also the patternsof communication between them.)
Chain of Responsibility (giving morethan one object a chance to handle the request.)
java exception handling, set the processor request
Command (the toolkit can't implement the request
explicitly in the buttonor menu, because only applications that use the toolkit
know whatshould be done on which object.)
java.lang.Runnable
javax.swing.Action
Interpreter
java.text.Format
java.util.Patterns
JavaCC
Iterator
Iterator (has remove method and has a shorter/better method name)
Enumeration
Mediator
Executor.execute
Momento (capture and externalize an object'sinternal state so that the object can be restored to this state later.)
All implementations of java.io.Serializable
xml marshal/unmarshal
Observer
EventListner
State(TODO)
Strategy:
Comparator.compare
Template method
All non-abstract methods of java.util.AbstractList or other class
Visitor
SimpleFileVisitor

Monday, April 11, 2016

晚上打篮球后吃什么

之前不要吃太饱,运动回来后喝一杯温牛奶+香蕉/苹果

一般以减脂塑形为目的,无需很夸张速效地增肌的话,你基本不用理会各种蛋白粉健饮什么的,在健身前1小时吃两根香蕉足以补充热量提供体力支持,而且它的完美之处还在于运动过程中不知不觉保健肠胃,你从心理上更不会觉得摄入过多的糖分和热量,不会还没健身先顶了一身压力。+运动结束以后重点是补水和少量补糖,但是也不要立即这样做,建议在40分钟以后吃一只不那么高糖的水果,喝一杯牛奶。切忌咖啡、茶饮这种消肿利尿加速脱水的饮料,也不要碰那些高糖的碳酸或者果汁饮料&rlz=1C1CAFB_enCA684CA684&oq=一般以减脂塑形为目的,无需很夸张速效地增肌的话,你基本不用理会各种蛋白粉健饮什么的,在健身前1小时吃两根香蕉足以补充热量提供体力支持,而且它的完美之处还在于运动过程中不知不觉保健肠胃,你从心理上更不会觉得摄入过多的糖分和热量,不会还没健身先顶了一身压力。++运动结束以后重点是补水和少量补糖,但是也不要立即这样做,建议在40分钟以后吃一只不那么高糖的水果,喝一杯牛奶。切忌咖啡、茶饮这种消肿利尿加速脱水的饮料,也不要碰那些高糖的碳酸或者果汁饮料

如果是晚饭后再运动的话,且体脂比较高减肥意愿比较强烈,那么:+1、两根香蕉完全可以取代晚餐,并尽量在17:00以前吃,对于大多数人的作息来说,17%3A00以后吃水果(特别是高糖水果,事实上水果都是比较高糖的)都没有太大意义了,而且这些糖分很难解决掉,所以有些东西即便好,也不是怎么吃随时吃都好。+2、18:00~20%3A00之间解决你今天以内所剩的运动量,不要再拖后,否则得不偿失,原因说过了如果你已经长时间习惯晚睡,那么运动时间最多可以拖到21%3A00.+3、晚练过后不比白天,没有多久就睡觉了,运动完40分钟以后你只需要一杯补养助眠的温牛奶,如果你实在饿到不行了,牛奶根本欺骗不了你的胃,那么,你最好也只吃一些水煮的蔬菜(胡萝卜、花椰菜、白菜等),少许。&rlz=1C1CAFB_enCA684CA684&oq=如果是晚饭后再运动的话,且体脂比较高减肥意愿比较强烈,那么:+1、两根香蕉完全可以取代晚餐,并尽量在17:00以前吃,对于大多数人的作息来说,17%3A00以后吃水果(特别是高糖水果,事实上水果都是比较高糖的)都没有太大意义了,而且这些糖分很难解决掉,所以有些东西即便好,也不是怎么吃随时吃都好。+2、18:00~20%3A00之间解决你今天以内所剩的运动量,不要再拖后,否则得不偿失,原因说过了如果你已经长时间习惯晚睡,那么运动时间最多可以拖到21%3A00.+3、晚练过后不比白天,没有多久就睡觉了,运动完40分钟以后你只需要一杯补养助眠的温牛奶,如果你实在饿到不行了,牛奶根本欺骗不了你的胃,那么,你最好也只吃一些水煮的蔬菜(胡萝卜、花椰菜、白菜等),少许。

根据描述,楼主是一位运动爱好者,爱好各种体育锻炼,但是很少进入健身房进行大重量的肌肉刺激生长训练,那像蛋白质粉、大量鸡蛋清这类高蛋白食品并不适合楼主,并且,楼主的锻炼时间偏晚,如果晚上12睡觉的话,运动之后2小时就要睡觉,此时非常不适合摄入大量蛋白质,身体短时间内无法消化吸收这么多蛋白质,而且睡眠中残留在肠胃的食物对消化系统有损伤。+楼主的锻炼时间正好在晚饭后2小时,并不需要额外摄入能量,晚饭多吃点碳水化合物主食和高蛋白食物就可以了,碳水化合物可以提供充足的能量供应,高蛋白食物(瘦肉、鱼类、鸡蛋)可以确保你的肌肉中的蛋白质含量充足,在剧烈运动时蛋白质的消耗也是很大的,如果蛋白质补充不足,越练越瘦也是可能的。+运动之后食用一些水果,比如香蕉,短时间内提供能量,苹果、草莓、梨什么的家常水果提供充足矿物质和维生素帮助你的身体恢复,调节体内PH值。不要喝果汁、咖啡、巧克力和碳酸饮料,那里面的成分除了糖之外,剩下的维生素含量没多少。如果哪天运动量很大,饿的不行,吃一些低脂的能量食物,如全麦面包,少量鸡蛋清也OK,+睡前一包牛奶,提高睡眠质量,提供适量钙质、蛋白质,利于身体恢复,防止肌肉抽筋。&rlz=1C1CAFB_enCA684CA684&oq=根据描述,楼主是一位运动爱好者,爱好各种体育锻炼,但是很少进入健身房进行大重量的肌肉刺激生长训练,那像蛋白质粉、大量鸡蛋清这类高蛋白食品并不适合楼主,并且,楼主的锻炼时间偏晚,如果晚上12睡觉的话,运动之后2小时就要睡觉,此时非常不适合摄入大量蛋白质,身体短时间内无法消化吸收这么多蛋白质,而且睡眠中残留在肠胃的食物对消化系统有损伤。+楼主的锻炼时间正好在晚饭后2小时,并不需要额外摄入能量,晚饭多吃点碳水化合物主食和高蛋白食物就可以了,碳水化合物可以提供充足的能量供应,高蛋白食物(瘦肉、鱼类、鸡蛋)可以确保你的肌肉中的蛋白质含量充足,在剧烈运动时蛋白质的消耗也是很大的,如果蛋白质补充不足,越练越瘦也是可能的。+运动之后食用一些水果,比如香蕉,短时间内提供能量,苹果、草莓、梨什么的家常水果提供充足矿物质和维生素帮助你的身体恢复,调节体内PH值。不要喝果汁、咖啡、巧克力和碳酸饮料,那里面的成分除了糖之外,剩下的维生素含量没多少。如果哪天运动量很大,饿的不行,吃一些低脂的能量食物,如全麦面包,少量鸡蛋清也OK,+睡前一包牛奶,提高睡眠质量,提供适量钙质、蛋白质,利于身体恢复,防止肌肉抽筋。

Tuesday, April 5, 2016

中山大学公开课 头痛

中山大学公开课 头痛
闫振文 中山大学孙逸仙纪念医院  神经科 

http://yanzhenwen.haodf.com/
yanzhw@mail.sysu.edu.cn

http://gangli2008.haodf.com/payment/newintro

跟月经期没关系,每年发作一两次或更多,每次疼痛持续一个月或更长。前额头附近疼痛,全身无力,双腿发软发抖

原发性头痛 78%
     找不到病因,偏头痛、紧张性头痛、丛急性头痛
继发性头痛 13%  (头痛只是一部分)
     颅内肿瘤、过度使用药物等引起
其它头痛
    三叉神经痛等

1. 偏头痛,几十年反复发作,伴有呕吐,呕吐之后会缓解
大部分是偏侧,但也有很多是双侧。偏爱于女性
40岁较多,60岁后极少
月经前后易发作,头痛期 4-72小时,发作期有没有什么先兆?(怕吵,眼发麻,言语不流利,锯齿形闪光或视觉扭曲)
2. CT:检查方便,安全快速,外伤
   MRI(磁共振):看到的病灶更加清晰,可检测脑白质异常、肿瘤等

丛急性头痛,较少见,很有规律,剧痛,男性为多
紧张性头痛:轻到中度,日常活动不加重,无恶心和呕吐,畏光畏声,一般为双侧头痛,布袋子捂住一样的痛
偏头痛:
      有时候有先兆,有时候无先兆,中到重度
       痛的时候捂住太阳穴这个地方,畏声畏光,活动会加重,搏动性头痛(一跳一跳的痛),恶心或呕吐(有的不呕吐),劳动能力下降

       偏头痛患者的体格检查往往没有异常发现
       偏头痛是目前无法根治但可以有效控制的疾患

慢性每日头痛,每月超过15天,每天超过4小时



诱发因素,头痛日记,以前吃过什么药
有无抑郁,焦虑,睡眠问题
(睡眠问题引起头痛,还是头痛引起失眠)
头痛部位,头痛时间与分布
上次就诊时间,何时做过哪些检查
头痛的性质程度怎样,如刀割样、烧灼样、刺痛、跳痛、胀痛、还是爆裂样痛;头痛加重和缓解的因素。

同时要提供与头痛伴发的症状,也即各种原发病的应有症状:如有无伴随引起颅内严重病变的恶心、呕吐、意识障碍、神经系统症状(肢体无力、麻木、抽搐、视力障碍)等,有无引起头颈部病变的五官症状(流泪、鼻阻、流涕)等,有无发热等全身性疾病的症状,有无失眠、多梦、多虑、焦虑、恐惧、抑郁等神经官能症症状,防止遗漏早期的严重病变。