昨天,今天,明天,每天的每天,你是否都多懂得一点点...

星期一, 十一月 30, 2015

小宝语录

小宝每出惊人之语,用的中文语汇比我三岁半的时候多了不知何几。 听之, 每每捧腹,或不觉婉尔。

2015年11月29日晚:

宝妈: 过去那头跟你爸睡(爸爸正捧着KINDLE大啃,听到这句话魂不守舍)
小宝: 边挤进被窝边说:"我要你的怀抱" (靠,怀抱这么难的词也会说。。。)

星期日, 十一月 15, 2015

90天试用期

http://www.pdassociates.co.nz/newsletters/pitfalls-90-day-trial-period-employers-beware/

之前一直有知道有这个东西,但不太明确,刚才看了一下

90天试用期是90日历日,不是工作日
90天试用期必需明确写在合同里, 双方同意才生效
90天试用期中, 员工可以被开除, 但是这个开除的理由很重要, 一个不正确的理由可能会让雇言多花钱.
90天试用期中, 员工不能随时走, 一般要提前通知, 这根具体合同有关, 和不在试用期内是一样的
在90天试用期中被开除的员工享受和非试用期被开除的员工一样的补贴.
90天试用期原只允许少于19人的公司执行, 后被扩展到所有公司.
90天试用期的具体条款, 雇佣双方可以协商.


以上纯属个人理解, 如有出入, 不负责任.

星期日, 十月 04, 2015

windows 10 初体验

昨天装了windows 10
感觉比win8 舒服
最难得的是从待机状态可以瞬间唤醒,1秒左右。这个功能可能是因为之前我没有在BIOS里启用UEFI 的原因, 因为要从U盘启动,进了BIOS, 所以顺便把UEFI开启了。

之前最怕盖上笔记本的盖子了。因为盖上后,再打开,要花很长时间才能唤醒,而且常常屏幕亮不起来,要换电源键再待机唤醒一次才行。

现在这些问题都不见了。爽!

操作上其实感觉和WIN8区别也不大。 

之前每次装完系统总是习惯性的上office, adobe master suite, visual studio 等等。 这回都不装了, 其实装上也用不到。 现在在家基本也不办公。 

只是上上网什么的, 还是少装点东西。

说了半天,好像也没说到WIN10什么东西。好像也没什么可讲的。推荐升级就是了。

星期五, 九月 04, 2015

WR 30M Water Resistant 30M 3ATM 手表可以淋浴吗?

如果你上网问这个问题, 80%的理论派会告诉你不行,而且会长篇大论地告诉你 3ATM 是三个大气压的意思,只能在实验室的极端环境下潜30M, BLABLA, 最后告诉你这货就只能防泼水,雨水,总结就是只能生活防水, 不能淋浴。

另外20%的脑残派会告诉你当然可以, 而且可以游泳,甚至潜水30M。

那实际上了, 爷昨天刚买的表, 昨晚就带着洗澡去了。今天早上又洗了一次, 没卵事。

如果你的表是20块人民币买的,无良商贩当装饰印上的防水多少多少米的地摊货, 就不要乱试了。 他们可是经常把1000毫安时的电池标上5000毫安时的。

--
Feng

星期四, 八月 06, 2015

Follow last post

The work around is unnecessary, the only important thing is the clicked element must be an input element. The best practice will be put a transparent input overlay on any other element.

--
Feng

angular way to popup ios keyboard after clearing field

Use directive is a proper way to set focus on an input field. Thus setting the bound data will do the job instead of setting the element itself.

.directive('autoFocus', function($timeout) {
    function link(scope, element, attrs) {
      scope.$watch(attrs.autoFocus, function(value) {
 if (value){
 $timeout(function(){element[0].focus();});
 }
      });
    }

    return {
      link: link
    };
});


This does not work on iOS because the focus() needs to be called within a click() event.

So, in the click function, we can set the focus on any input field to popup the keyboard.

$scope.reset = function(unit) {

unit.value = null;
$ionicListDelegate.closeOptionButtons();
focusUnit.hasFocus = false;

//work around to popup keyboard on focus on ios devices
if (ionic.Platform.isIOS()){
if (!document.activeElement.hasAttribute('auto-focus')){
//Set focus to the first input element to popup keyboard.
//the ios keyboard will only be popup inside a click event with focus
//Then the watcher will set the focus to correct element.
setTimeout(function(){
document.getElementsByClassName('unitInput')[0].focus();
},0);
}
}
$timeout(function(){
unit.hasFocus = true;
focusUnit = unit;
});
};


Then the directive will move the focus to the correct field.

There is one problem here on iOS8. The keyboard will popup, but immediately slide down again, keyboard flashes on the screen.

The reason is that the div element bound with click event cannot get focus, it passes the focus to the body element.

1. Click event -> clicked element gets focus, set focus to the input by code, input get focus, keyboard popup
2. The div element passes the focus to body, body get the focus, input loses the focus, keyboard disappear.

The solution, use an input button instead of a div, then use css to fix the button look. Because the input button can get focus (become document.activeElement), the second step will not happen.



FYI: code works, theory may be wrong.


--
Feng

星期二, 六月 09, 2015

Convert from HTML to MOBi with Calibre

It's important to change the extension from txt to HTML before importing to Calibre. Otherwise the conversion will take forever.

Before doing so, insert proper html tag so that it can be view correctly by browsers. 

Add <h2> to all chapers
Add <h1> to title
Add <br/> to each line

Add html head, body etc.

Then convert to mobi with calibre and put 

//h:h1
//h:h2

as level 1 and level 2 TOC correspondingly in the table of content section.







--
Feng

星期五, 五月 22, 2015

Title in Reference doesn't wrap for biblatex

I need to support online resource in my reference. So that I replace the original bib method with biblatex package. It worked on another of my papers. When I copied the same code to this paper. The generated references have long titles.

The solution is put \normalem before \printbibliography.

This will remove the underline of the title, but the text now can normally wrap.


\normalem
\printbibliography


--
Feng

Word movement in Mac os Terminal

Move one word back, Press ESC, then b
Move one word forward, Press ESC, then f

In ITerm, we can map option-left/right to Send Escape sequence.


--
Feng

星期三, 五月 13, 2015

Diary Number One

To improve my writing, I have set a goal of writing weekly diaries. The goal has been set for weeks now. But I haven't yet post any diary. This is my first one. Hope that I can stick to this goal and post diaries continuously.

I am going to talk about Acne today. Acne as a normal part of puberty, many people has encounter in their teenage, so do I. However, not only in my teenage, I am always being suffered. Acne has never left me since it came, although only small area persists. 

Few weeks ago, acne spreaded on my face which looked terrified. I went to see a doctor and confirmed that acne is treatable (Many people think that acne is not treatable).

The prescription is as follow:

60 zetop, 10mg each, take one twice daily
70 erythromycin, 400mg each, take one twice daily 
30g differing gel 0.1% ww, apply to affected areas at night, avoid skin around eyes.

The zetop is usually for treating hayfever, I have no idea why I need to take it.

The erythromycin and Differin are gold partners for treating acne. They work very vell. After two days, my face looked much better. But the bad news is that some obstinate acne around my chin is hard to be removed. They went away and came back quickly. I am still fighting with them.

Forgot to mention, the doctor also suggested me to wash my face with Johnson's baby soap 4 times a day. The reason is that my skin is oily. Water cannot remove oil from face, washing face with water will only spread the oil and block more pores. It's important to wash face with soap so that the oil can be removed. One drawback of the soap is that it makes the skin tight and dry after washing.




--
Feng

Copy and paste colored console output from Mac os

Tools needed: Terminal, Safari/TextEdit

Sometimes you want to show your colored console output to someone else. If you copy and paste it out, the color info is gone. 

On Mac os Yosemite, I found that you can use Terminal and Safari to make this happen. Get your console output from Terminal, and paste it to Safari (Gmail), then you can send out. 

Note that you have to use Terminal, use iTerm or other third party console may not work. Other editor  or browser (e.g. Google chrome) may not work either. 

The clue is using Mac os Built in apps. 


--
Feng

星期四, 三月 19, 2015

Dymo Pnp on mac os

I bought a Dymo PNP label maker from China. 

The package says it's designed for PC.

But I found a Mac os App when I connect the label maker to Mac mini.

There will be an USB drive appear when the PNP is connected. 

The PNP will just work when you print from the app. No driver is needed. It shouldn't. Because PNP means Plug and Play.

The app comes with the PNP is an old version. There is a button on the app which you can click to download the latest version. In my case, the newer version is DYMO Label v.8. The old version is DYMO Label Light 

The latest version requires installation, because it will install printer driver along with Dymo Label v8

I found that Dymo Label v8 doesn't take Chinese input. But you can copy and paste. It has quite a few build in clip art. It's much more power than the light version. 

But I found the light version is good enough for me.

--
Feng

Objective C append bytes

 const char *bytes = [jsonData bytes];

        

        NSMutableData *data = [[NSMutableData alloc] init];

        

        for (int i = 0; i < [jsonData length]; i++){

            unsigned char c = (unsigned char)bytes[i];

            if (c < 32 && c != 10 && c != 14){

                //Do nothing

            }else{

                [data appendBytes:&c length:1];

            }

        }


--
Feng

星期五, 二月 20, 2015

Understand android contact database


Getting the contact photo is such a big pain.

To understand what uri to use to get the info. It's better that you can view the database directly. 

This is how:

Create an android emulator with SD card and save few contacts. 

Use this command to dump the sql lite dataase.

adb pull /data/data/com.android.providers.contacts/databases/contacts2.db contacts2.db

Use the sqlite browser to view the sqlite database. 


The last part of content provider URI is ID.

For example, 

content://com.android.contacts/data/136

point to table data where id = 136.





--
Feng

DNS not working for .local in Yosemite?

PIng not working, but host and dig works.....

here is the solution:

sudo discoveryutil mdnsactivedirectory yes


--
Feng

星期四, 二月 12, 2015

超好用国际电话卡rebtel

超低话费
拨本地座机号转接目标号(无需网络)
也可用网络软件拨打

高级用法 smart call 可以免费拨打国际电话(双方都要注册rebtel, 哦,我不是说语音聊天, 可以实现电话拨电话国际免费). 详情看这里 http://www.howcallbest.com/rebtel-smart-call/

用以下链接注册, 充1美金,得5美金。

http://reb.tl/1veUZFA


--
Feng

星期五, 一月 30, 2015

IOS Transform logo back to its original position

It seems that the second transform calculate the position still based on the original position.


- (void) animateLogo{

    

    //Move the logo to center

    

    CGAffineTransform transformTranslate = CGAffineTransformMakeTranslation(0, 53.0);

    CGAffineTransform transformScale = CGAffineTransformMakeScale(1.35, 1.35);

    CGAffineTransform transformClock = CGAffineTransformConcat(transformScale, transformTranslate);

    [self.logoImageView setTransform:transformClock];

    

    

    [UIView animateWithDuration:1.0

     

                          delay: 0.0

     

                        options: UIViewAnimationOptionCurveEaseIn

     

                     animations:^{

                         //Move logo back to the original position.

                         CGAffineTransform transformTranslate2 = CGAffineTransformMakeTranslation(0, 0);

                         CGAffineTransform transformScale2 = CGAffineTransformMakeScale(1, 1);

                         CGAffineTransform transformClock2 = CGAffineTransformConcat(transformScale2, transformTranslate2);

                         [self.logoImageView setTransform:transformClock2];

                         

                     }

     

                     completion: ^(BOOL finish){

                         

                     }];

}


--
Feng

其它博客地址

此博客的同步博客地址: http://fengnz.wordpress.com
这里进入我的MSN SPACE.