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

星期五, 十二月 12, 2014

身体

人常说身体不好,是身不好还是体不好?
身和体又有什么区别?

健身和健体又有什么分别?

身和体看似都是指身体, 但其实它们是有区别的。

我认为,体指的是头部和四肢,身就是其它的部分,主要就是躯干了。

我的论据来自中文中的其它词汇。

我们说四肢的时候, 也可以说成肢体,一般不会说肢身。
有一个词叫五体投地,指的是头肘膝着地,躯干则不着地。

所以说肉体和肉身是有区别的。。。

看看是不是有道理?

那我们又说钱乃身外之物,没有也无所谓。那这么说头也是身外之物,断了却会死翘翘。。。

身内之物估计指的是内脏, 是最重要的器官,毕竟人脚断了人还可以活着,头实在是个例外。



--
Feng

星期四, 十一月 06, 2014

Sophie's learning log

6 Nov 2014


Last few days, I took Sophie outside with her little tricycle. I did this because I would like to do some exercise anyway. She loves outside. I walked quite a lot in the noon time yesterday. When I arrived home, I feel a little bit tired. Laying on the bed with just waked up Sohpie. I asked if she want to go outside with me. She said yes. I then talked to myself that I don't want to go and felt tired today.


Sophie, who understood exactly what my murmur, said that "if you are tired, it's all right" (如果你走不动了,就算了吧)


Eventually, we went outside. Because I was happy that she is so a sympathetic little girl.

星期二, 十月 28, 2014

Send PDF to Kindle

You can send your pdf format books or whatever to kindle by email. Kindle paper white cannot read pdf format. You will need to have "convert" in the subject to convert the pdf to kindle format. If you have kindle fire or other pdf compatible devices and you prefer to read pdf, you can leave the subject empty.

But sometimes, you may notice that the converted pdf is not in normal kindle format but displayed as images. For pdfs that contains images only, this is expected. But for some text base pdf files, this can happen as well. I don't know why.


--
Feng

星期六, 十月 18, 2014

Switch to a different country on kindle

Amazon hosts their websites for different countries separately. You will need to use different domain to login to different shops.

But on kindle, you cannot specify which country you want to login to. For me, I use the same email address to login for all my amazon accounts.

I found that the only way to login to my Chinese account is to set the language to Chinese and register the device again.

--
Feng

星期一, 九月 29, 2014

芥菜

芥菜是芥菜的变种。 这句话念起来很顺,读起来却怪怪的。
读作: 盖菜是芥菜的变种

--
Feng

星期二, 九月 23, 2014

Sourcetree Git revert crash

Use SourceTree to do a git revert, the source tree crash, then sourcetree doesn't work properly.

Each time I select the reverted commit, sourcetree crash

To fix that, I found following solution

First, reset to previous commit
git reset HEAD^ --hard 
Second, Because I have push the commit, I have to reset that for the remote as well
git push -f


Also, Because I have another local which has pulled the change, I have do this again for that local...

--
Feng

星期四, 九月 04, 2014

知识是否也阻碍人类本能的进化

人类的本能可以分辨很多东西。 发霉的东西我能可以闻出来, 我们本能的讨厌发臭的东西。因为它们对我们有害。 就是没有文化,没有知识的人也不会去吃发霉发臭的东西,因为他们生理上知道它们有害,而不需要知识上的判断。

好吃的东西通常都是对人有益的。 但是有些并不是, 人类的本能无法分辨所有有害的东西。 这就需要知识来判断了。 因为有人知识的辅助,人类的本能似乎也不那么重要了。 这会不会阻碍人类本能的发展进化呀?

值得思考呀。

但进化通常是残酷的, 如果达尔文的理论正常的话。 进化需要太多的死亡。 不能本能的分辨毒蘑菇的大多数人要死光。 剩下的少部分人继续繁衍壮大。。。然后为了另一个进化,再死。。。再壮大。。。。

--
Feng

星期五, 八月 29, 2014

HTML table display padding issue

Found a very interesting padding behavior in webview (webkit)

the parent container has this style

    padding: 5px 0 5px 40px;
     width: 100%;
     display: table;

The child style has this style:

     display: table-cell;
     padding-left: 55px;
     vertical-align: middle;

The developer used table-cell style to make the text vertical center aligned. The problem is that the 40px padding on the parent container doesn't reduce the child's width. The child was push out to the right of the container.  Remove the table-cell style will fix this issue, but you lose the vertical center alignment.

To fix this, move the 40px padding to the child, the new style become

    padding: 5px 0;
     width: 100%;
     display: table;

     display: table-cell;
     padding-left: 95px;
     vertical-align: middle;

Why you set padding in two places when you can use one.

BTW, margin doesn't work along with table-cell




--
Feng

星期四, 七月 31, 2014

Ruby doesn't make

C:\Tools\Vim\vimfiles\bundle\commandT\ruby\command-t>ruby extconf.rb
checking for ruby.h... C:/Users/ydeng/feng/gre/ruby-1.9.3-p545-i386-mingw32/lib/
ruby/1.9.1/mkmf.rb:381:in `try_do': The compiler failed to generate an executabl
e file. (RuntimeError)
You have to install development tools first.
        from C:/Users/ydeng/feng/gre/ruby-1.9.3-p545-i386-mingw32/lib/ruby/1.9.1
/mkmf.rb:506:in `try_cpp'
        from C:/Users/ydeng/feng/gre/ruby-1.9.3-p545-i386-mingw32/lib/ruby/1.9.1
/mkmf.rb:931:in `block in have_header'
        from C:/Users/ydeng/feng/gre/ruby-1.9.3-p545-i386-mingw32/lib/ruby/1.9.1
/mkmf.rb:790:in `block in checking_for'
        from C:/Users/ydeng/feng/gre/ruby-1.9.3-p545-i386-mingw32/lib/ruby/1.9.1
/mkmf.rb:284:in `block (2 levels) in postpone'
        from C:/Users/ydeng/feng/gre/ruby-1.9.3-p545-i386-mingw32/lib/ruby/1.9.1
/mkmf.rb:254:in `open'
        from C:/Users/ydeng/feng/gre/ruby-1.9.3-p545-i386-mingw32/lib/ruby/1.9.1
/mkmf.rb:284:in `block in postpone'
        from C:/Users/ydeng/feng/gre/ruby-1.9.3-p545-i386-mingw32/lib/ruby/1.9.1
/mkmf.rb:254:in `open'
        from C:/Users/ydeng/feng/gre/ruby-1.9.3-p545-i386-mingw32/lib/ruby/1.9.1
/mkmf.rb:280:in `postpone'
        from C:/Users/ydeng/feng/gre/ruby-1.9.3-p545-i386-mingw32/lib/ruby/1.9.1
/mkmf.rb:789:in `checking_for'
        from C:/Users/ydeng/feng/gre/ruby-1.9.3-p545-i386-mingw32/lib/ruby/1.9.1
/mkmf.rb:930:in `have_header'
        from extconf.rb:33:in `<main>'


C:\Tools\Vim\vimfiles\bundle\commandT\ruby\command-t>set path=C:\Users\ydeng\fen
g\gre\DevKit-tdm-32-4.5.2-20111229-1559-sfx\mingw\bin;%path%

C:\Tools\Vim\vimfiles\bundle\commandT\ruby\command-t>ruby extconf.rb
checking for ruby.h... yes
creating Makefile

C:\Tools\Vim\vimfiles\bundle\commandT\ruby\command-t>

-------------------------------------------------------------------------

You should be about to see the reason from above set command. The mingw's bin folder needs to be added to the path.


--
Feng

星期四, 六月 05, 2014

MAC OS terminal read .bash_profile instead of .bash_rc

General speaking .bash_profile is for login shell (ssh etc).
.bashrc is for not login shell.

MAC OS terminal app is an exception. it reads .bash_profile for any new terminal window.

星期四, 五月 22, 2014

小宝两岁

小宝昨天过生日. 两岁了
今天下午小宝醒后, 无声无息的出现在厨房. 果然长大了.
她以前醒后第一件事就是哭. 然后被抱起.

--
Feng

星期五, 五月 16, 2014

公钥私钥浅喻

私钥好比钞票上的仿伪记号
公钥就是验钞机

通常来说,公钥往往是从网上下载的。这就会有一个问题。

公钥和私钥用法很多

这里说一种, 用来验证发布者。

我们知道, 人民币要由中央银行印的才是真钞。
我印的那肯定是假钞。

我现在给你一千万人民币, 还送了你一台验钞机。 你用验钞机一验, 全是真币。。。你高兴了。。。

但你惨了, 那验钞机是我做的,它验我的假币当然都说是真的。

假验钞机验假币,当然完蛋。

那怎么知道验抄机是假的呢? 那就牵扯到公证机构了。

现在你收到一叠假币, 和一个假验钞机。 假币上的防伪标记是我做的。 验钞机也是我做的。 但是你知道,验抄机上也是有防伪标记的, 验钞机上写着"此验钞机是真的-中央银行认证"。

好了, 你正好有一个验钞机验证器, 是从可靠的来源获得的。 于是你验证了一下这个验钞机。。。它妈的, 原来是假货。 于是, 你认定这叠钞票是假的。 如果验证出这个验钞机是真的, 那说明这些抄票是由中央银行授权的机构生产, 也是真钞。

这个验钞机上的防伪标记就相当于公证机构的私钥。 而那个验钞机验证器就是公证机构的公钥了。 公钥机构的公钥 (ROOT CA)一般在操作系统里已经带了。 是可靠的, 当然, 病毒软件也可以安装一些不可靠的公钥进去。

总的来说, 一个证书(CERT),就是由公证机构用私钥签过名的你的公钥。 公证机构证明,这个公钥的确是你发布的。 所以证书不是公钥, 证书里包含公钥。

--
Feng

星期三, 五月 14, 2014

git server on mac os over ssh

To set up git server on mac over ssh, you don't need extra tools. You will need ssh + git.

Once you set up a git repository on the server. 

you can git clone it over ssh.

But I got this problem:

1. git-upload-pack cannot be found

bash: git-upload-pack: command not found
fatal: Could not read from remote repository.

Reason:

The ssh environment is different to terminal. The PATH has different value which doesn't contains git's path.

Solution:

add a .bashrc file in the home folder. and add this lines

export PATH=/usr/local/git/bin:$PATH

2.  Symbol not found

dyld: lazy symbol binding failed: Symbol not found: ___strlcpy_chk
  Referenced from: /usr/local/git/bin/git-upload-pack
  Expected in: /usr/lib/libSystem.B.dylib

dyld: Symbol not found: ___strlcpy_chk
  Referenced from: /usr/local/git/bin/git-upload-pack
  Expected in: /usr/lib/libSystem.B.dylib

Then I cannot resolve this issue. (should be able to resolve by the path as well)

Then I installed the xcode command line tool... and delete the bashrc. The problem gone...

So... the solution is install xcode command line tool.

Because xcode command line tool will install another version of git under /usr/bin folder. 

The git environment before is under /usr/local/git/bin, this version don't need to set the path.

--
Feng

星期三, 四月 30, 2014

use xpath to extract web info in google chrome console



example:


var a = $x('//b[contains(., "人均")]/text()')
jQuery(a).text()
--
Feng

星期一, 四月 21, 2014

快速选择dropbox 的重复图片

因为把两个DROPBOX的 camera upload 文件合并了, 有不少重复的文件, dropbox 在重复的文件名后面加了 (1), 所以可以很容易看出重复的文件. 

但是有一百多个文件, 手工一个个找出来不容易, 于是写了段代码把不重复的文件隐藏起来.

在浏览器的命令行输入以下代码, 把正常的文件名藏起. 然后剩下的全是重复的, 就按住CONTROL键点选, 然后删除就可以了. 只是免了翻页寻找的过程. 并不能帮你选起.

注意, 不能用SHFIT键多选, 因为这样会选到藏起来的那些文件.

jQuery('.browse-file').each(
function(index, elem){
if (!/\(1\)/.test(jQuery(this).html())){
jQuery(this).hide();
}
}
);


--
Feng

星期三, 四月 09, 2014

YuFeng Deng's invitation is awaiting your response

 
YuFeng Deng would like to connect on LinkedIn. How would you like to respond?
YuFeng Deng
YuFeng Deng
Senior Software Developer @ MCom (Now Fiserv) - Doing Mobile, Web and Platform developments
Confirm you know YuFeng
You are receiving Reminder emails for pending invitations. Unsubscribe
© 2014, LinkedIn Corporation. 2029 Stierlin Ct. Mountain View, CA 94043, USA

星期三, 四月 02, 2014

YuFeng Deng's invitation is awaiting your response

 
YuFeng Deng would like to connect on LinkedIn. How would you like to respond?
YuFeng Deng
YuFeng Deng
Senior Software Developer @ MCom (Now Fiserv) - Doing Mobile, Web and Platform developments
Confirm you know YuFeng
You are receiving Reminder emails for pending invitations. Unsubscribe
© 2014, LinkedIn Corporation. 2029 Stierlin Ct. Mountain View, CA 94043, USA

星期二, 四月 01, 2014

regex, how look behind work

Look behind doesn't take space either

Look this example

(?m)(?<=a)bc.(?<=a)bc


it will only match abcabc

the matched string is bcabc


how to read this regex?

Remove the look behind first

it becomes bc.bc

OK, this will match quite a few string, like dbcebc


but, remember we have look behind, that means, before first bc, it must be an a, before second bc, it must be another a there. so....

only abcabc will match.


Look behind add another layer of restriction. easy?

--
Feng

Regex "And" operation

Regex "Or" operation is obvious.

This is a example

^abc$|^123$

This will match abc or 123. 

But how do you do a regex "and"

You may write something like this:

^abc$&^123$

Wrong, this is totally wrong. There is not "&" operator in regex.

Is it possible to do an "And" operation in regex? 

The answer is "YES".

That leads us to the power regex look around feature. 

For "And" operation, what we need is the positive look ahead.

(?m)^(?=.*[A-Z].*)(?=.*[a-z].*)(?=.*?[0-9].*)[^1]*$

Have a look example above. 

Look head matches, but doesn't take space, That means, the regex after the look ahead will start matching from the beginning as well.

In this example, the only matched string will be Abcd5234. 


Abcd1234
ABCD1234
abcd1234
abcdabcd
aBcd1234
aBcdabcd
Abcd5234


Why?

Because this string must match ^(?=.*[A-Z].*), means at least 1 Capital letter. 
Also, it must match (?=.*[a-z].*), one lowercase letter. 
Also, it must match (?=.*?[0-9].*), one number
and lastly, it must match [^1]*, no "1" included.





--
Feng

星期一, 三月 31, 2014

Re: 批量删除iphone/ipad 上的照片

如果要删除photo stream 里的照片, 要在 settings -> general -> icloud -> photo 里面把 photo stream 关了。


On Mon, Mar 31, 2014 at 8:27 AM, feng <fengnz@gmail.com> wrote:
想要删除ipad上的照片,因为空间不够,而且都备份到百度网盘了。

于是第一个想到的是itune, 然后想到iphoto

其实最简单的方法在下面,居然是 preview



 figured it out, it works on the iphone 2G but i think it will work for the newer iphones too.

 

This is what i did

 

-connected my iphone to my mac

-open preview

-file > import from iphone

-command + A to select all photos

-hit the delete symbol on the bottom

 

then it just deleted all photos that were taken from my camera roll.


https://discussions.apple.com/thread/3777283


实验结果, 只删除了Camera Roll 里的文件, Photo Stream 没有被影响。 不过空间出来好多了。


--
Feng



--
Feng

其它博客地址

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