Category Archives: study_note

What’s the Differences among Long, Medium and Short Grain Types

grain

NOTE : Pictures and data are from here.

These days I become interested in some healthy diet, so I want to figure out the exact food energy of each kind. It’s not hard to find these data out with the help of Google — thecaloriecounter.com. But what confused me is how to distinguish the differences among long, medium and short grain types. The pictures cannot offer any useful help, because I don’t have any basic idea of a “standard” grain type, without such conception how can you tell which one is longer or shorter? So maybe using some mathematical method will be better.Here’s how:

We can use length to width ratio to determine the grain types.

Rough or Paddy Rice (before milling, hulls intact)
Long        3.4 to 1 and more
Medium   2.3 to 3.3 to 1
Short        2.2 to 1 and less

Brown Rice (hulls have been removed but bran intact)
Long        3.1 to 1 and more
Medium   2.1 to 3.0 to 1
Short        2.0 to 1 and less

Milled Rice (hulls and bran layers have been removed)
Long        3.0 to 1 and more
Medium   2.0 to 2.9 to 1
Short        1.9 to 1 and less

We may see milled rice for most of the cases. And I tried some of my rice, both turned out to be the short ones. Now I get it all clear.

How to change the hints settings of Pentadactyl

When using Pentadactyl in XP, I found the hints are too small to distinct. It doesn’t happen when I run Ubuntu. Anyway, I googled and figured it out. Here I think I should take a note, in case my memories don’t serve me some day. Actually Pentadactyl do leaves a lot of options, but sometimes I just don’t know how to change them.

:hi Hint font-family: Verdana; font-size: 10px; font-weight: bold; color:
white; background-color: red; border-color: ButtonShadow; border-width: 0px;
border-style: solid; padding: 0px 1px 0px 1px;

And, don’t forget to write it to your RC file.

:mkp!

Set SSL Google as the Default Search Engine when using Pentadactyl in Firefox

First of all, if you don’t have any idea what Pentadactyl is, then this post maybe not worth your time.

Secondly, I should tell you about my system environments: Ubuntu 11.04; Firefox 6.0. If yours are differ from mine, I suppose it will still be ok, in most of the cases, they share the same steps.

Now, let’s start.

  1. Why use Firefox? It’s the only browser what can have Pentadactyl as the add-on.
  2. Why use Pentadactyl? It’s vim-like add-on, designed for some keyboard addicted users to make life easier and more efficiently. If you ever heard about vim, you should know how powerful it is.
  3. Why bother to use encrypted google search engine? It’s really something personal, I like it, because I like it. If you insist to ask, I think the main reason is I don’t want my search queries to be intercepted. Besides, it makes me cool and different.

In Pentadactyl, when you want search something, just type “o”(open the results in current tab) or “t”(open the results in new tab) followed the search words. By default, Pentadactyl use google as the search engine, Not google ssl. So how to change it? Add it as a bookmark will be the first step. Since we use Pentadactyl, let’s do it in some cool way:

  1. Press “:” to begin to typing command.

    bmark -keyword gssl https://encrypted.google.com/search?sclient=psy&hl=en&safe=off&site=webhp&source=hp&q=%s&pbx=1&oq=&aq=&aqi=&aql=&gs_sm=&gs_upl=

  2. Press “Enter” to execute the command. And now you add it to your bookmark. Then press “:” again to type another command.

    set defsearch=gssl

  3. Job done!

Command no.1: “-keyword” is an option for you to name a search engine which will be used in the second command. The url I provided maybe only functional in my system environment, I’m not sure. But if it doesn’t work, you could find it by yourself. AND it’s more easier.

  1. Open https://encrypted.google.com
  2. Right click of the search box
  3. Choose “Add a Keyword for this Search…”
  4. Name a keyword as you like, in my case it will be “gssl

It’s exactly the same result as command no.1. You will find the url when you check this bookmark’s property.

Command no.2: is used to set the default search engine. I really try hard to find this option of Pentadactyl…

Well, over…

Reading Note — “The Optimism Bias”

本博已被墙,楼梯请自备。

This blog has been blocked in mainland China, and if you’re unfortunately in this area, you have to find your own way to access.



Illustration by Noma Bar for TIME


“The Optimism Bias”, Time, June 6, 2011 , is a very interesting and thought-provoking article. It solved a lot of puzzles which  haunted my mind. You can read this article on Time’s website. I promise it won’t let you down. But the other thing I want to remind you is that the reading experience is totally different between web and printed paper. Of course, printed paper is much better.

We’re born to be some optimistic creatures, we tend to believe things will turn out to be better than what they will really end up; most people suppose their driving levels are beyond the average, which is certainly a ridiculous judgement; almost no one think he/she will divorce when he/she just get  the marriage-license; we underestimate our chances of getting fired; we wear rose-colored glasses to look into the world. Yet we don’t aware of it, besides, we don’t know why our genes shape us in this way.

To figure out the why question is not an easy job.

FIRST OF ALL, do you realize that you’re optimistic? If you never read such articles  or attended some psychological curriculum, I would guess your answer to be negative. But when you finish reading the last paragraph and think through, you’ll notice how overly optimistic we are.

SECONDLY, why we become so? We, human beings, regard ourselves as a rational species. We are more likely to be objective. Optimism lure us to form some false outcomes of things, which makes us seem stupid. Worst of all, optimism exists generally in most of us. So either there are some other benefits of optimism to make its exist reasonable, or evolution made a tragic joke over our mortals. Now “The Optimism Bias” reveals that do have some critical benefits of become optimistic. Like the author of  “The Optimism Bias” said:

…the bias also protects and inspires us: it keeps us moving forward rather than to the nearest high-rise ledge. Without optimism, our ancestors might never have ventured far from their tribes and we might all be cave dwellers, still huddled together and dreaming of light and heat.

To make progress, we need to be able to imagine alternative realities–better ones–and we need to believe that we can achieve them…

As compared with these advantages and disadvantages, we can conclude that to be positive is much more crucial to our survival. If we cannot walk out of the cave, it doesn’t matter whether we make some disastrous miscalculations under the influence of optimism , such as less likely to get health checkups or open a savings account.

THIRDLY, to understand the real function of our memory system. What the use of our memory system? To remember the past? Partly true, but not exactly. Research data shows our memories are not reliable. When the time passed by, our memories reconstruct the events happened before with lots of errors, omits and amends. If the memory system is naturally selected and designed precisely to reproduce the past, how can it be that wrong after thousands’ years of evolution? Let’s see  what the author say about it:

Scientists who study memory proposed an intriguing answer: memories are susceptible to inaccuracies partly because the neural system responsible for remembering episodes from our past might not have evolved for memory alone. Rather, the core function of  the memory system could in fact be to imagine the future–to enable us to prepare for what has yet to come. The system is not designed to perfectly replay past events, the researchers claimed. It is designed to flexibly construct future scenarios in our minds. As a result, memory also ends up being a reconstructive process, and occasionally, details are deleted and others inserted.

And what’s the relationship between memory system and optimism? To understand the mechanism of memory system help us a lot, we know this system deliberately delete something unexpected and insert something desirable. In this way, we become optimistic creatures.

FOURTHLY, to perceive the human time machine.

To think positively about our prospects, we must first be able to imagine ourselves in the future. Optimism starts with what may be the most extraordinary of human talents: mental time travel, the ability to move back and forth through time and space in one’s mind.

We may take this ability for granted, mankind make such mistakes quite often. But the truth is, we never randomly acquire any abilities without deliberately purpose. As we possess this ability, we’re able to make plans and set goals, which help us to be to cleverest primate on earth. But unfortunately, every coin has two sides,

While mental time travel has clear survival advantages, conscious foresight cane to human at an enormous price–the understanding that somewhere in the future, death awaits.

We mortals are all unwillingly to accept that, it makes us depress. Things turns out to be meaningless. No matter how hard we work, no matter how many efforts we made, one day, everyone of us will disappear from this world. This will lead our necessarily activities to survival to a dead end, that divert from the meaning of life. At least, evolution and natural selection won’t allow it to be happened in mass creatures. So optimism stands out to counter the pessimism. To irrationally picture a bright future maybe the only way to inspire us to sustain.

FIFTHLY, optimism is not just something about illusion, it has the power to change the reality. Since most of us think optimism merely formed inside our mind, how can it effect the reality? Have you ever heard the self-fulfilling prophecy? It’s a prediction that directly or indirectly causes itself to become true, by the very terms of the prophecy itself, due to positive or negative feedback between belief and behavior. When you expecting something good, your brain will get excited, usually this will improve your performance in certain aspects; on contrary, your brain will stay indifferent if you primed it with some negative messages. You see, optimism do have influence over our brain, and whether our brain behaves active or negative affects our performance, different performance lead to different results, that’s why optimism has the power to change the reality.

SIXTHLY, sliver linings. Optimism not only takes effect when we face the good and the bad, but also appears when we have to make a choice among bad things (or good things). If you must bear a malady, it’s will be painful experience to choose from a broken leg or a broken arm. But once you has slightly tilt towards one malady, optimism will immediately step in and take charge of your feelings. You’ll think positive of what you have chosen. Let’s say you painfully made the decision to have a broken leg, seconds later you may conceive some ideas in you mind: It’s not that bad, maybe I’ll stack in the room, but I could play video game all day long. Great!” We live in a rapid world, time is short for us to struggle in dilemma, we must keep moving, with the  help of optimism we can make some quick decisions.

SEVENTHLY, can we take the advantage of  optimism and remain rational? Of course we can, like the author said:

I believe knowledge is key…The good news is that awareness rarely shatters the illusion. The glass remains half full. If possible, then, to strike a balance, to believe we will stay healthy, but get medical insurance anyway; to be certain the sun will shine, but grab an umbrella on our way out — just in case.

Movie Review “Dead Poets Society”

I’ve watched the film “Dead Poets Society” last week, and I found it’s really classic. But ironically, I never heard the name of this film until someone recommended another film “The Way Back” (I may talk about that later) which was shot by the same director. This movie do not like the kind of film shot in 1980’s, the scenes remind me of “Scent of a Woman”, have very high qualities. Somehow that’s not the point, the point is the poems in this file attracted me. I don’t have that good command of English, so I can certainly not understand the full spirit of these poems, that’s why I want to take a note here, it will be in handy.

I went to the woods because I wished to live deliberately, to front only the essential facts of life, and see if I could not learn what it had to teach, and not, when I came to die, discover that I had not lived. I did not wish to live what was not life, living is so dear; nor did I wish to practise resignation, unless it was quite necessary. I wanted to live deep and suck out all the marrow of life, to live so sturdily and Spartan-like as to put to rout all that was not life, to cut a broad swath and shave close, to drive life into a corner, and reduce it to its lowest terms, and, if it proved to be mean, why then to get the whole and genuine meanness of it, and publish its meanness to the world; or if it were sublime, to know it by experience, and be able to give a true account of it in my next excursion. For most men, it appears to me, are in a strange uncertainty about it, whether it is of the devil or of God, and have somewhat hastily concluded that it is the chief end of man here to “glorify God and enjoy him forever.”

– Henry David Thoreau:Walden,or Life in the Woods

O CAPTAIN! MY CAPTAIN!

O Captain! my Captain! our fearful trip is done,
The ship has weather’d every rack, the prize we sought is won,
The port is near, the bells I hear, the people all exulting,
While follow eyes the steady keel, the vessel grim and daring;

But O heart! heart! heart!
O the bleeding drops of red,
Where on the deck my Captain lies,
Fallen cold and dead.

O Captain! my Captain! rise up and hear the bells;
Rise up&emdash;for you the flag is flung&emdash;for you the bugle trills,
For you bouquets and ribbon’d wreaths&emdash;for you the shores a-crowding,
For you they call, the swaying mass, their eager faces turning;
Here Captain! dear father!
The arm beneath your head!
It is some dream that on the deck,
You’ve fallen cold and dead.

My Captain does not answer, his lips are pale and still,
My father does not feel my arm, he has no pulse nor will,
The ship is anchor’d safe and sound, its voyage closed and done,
From fearful trip the victor ship comes in with object won:
Exult O shores, and ring O bells!
But I with mournful tread,
Walk the deck my Captain lies,
Fallen cold and dead.

THE ROAD NOT TAKEN

Two roads diverged in a yellow wood,
And sorry I could not travel both
And be one traveler,long I stood
And looked down one as far as I could
To where it bent in the undergrowth;

Then took the other,as just as fair,
And having perhaps the better claim;
Because it was grassy and wanted wear;
Though as for that,the passing there
Had worn them really about the same,

And both that morning equally lay
In leaves no step had trodden black.
Oh,I kept the first for another day!
Yet knowing how way leads on to way,
I doubted if I should ever come back.
I shall be telling this with a sigh
Somewhere ages and ages hence;
Two roads diverged in a yellow wood,and I—
I took the less traveled by,
And that has made all the difference.

Shall I compare thee to a summer’s day?
Thou art more lovely and more temperate:
Rough winds do shake the darling buds of May,
And summer’s lease hath all too short a date:
Sometime too hot the eye of heaven shines,
And often is his gold complexion dimmed,
And every fair from fair sometime declines,
By chance, or nature’s changing course untrimmed:
But thy eternal summer shall not fade,
Nor lose possession of that fair thou ow’st,
Nor shall death brag thou wand’rest in his shade,
When in eternal lines to time thou grow’st,
So long as men can breathe or eyes can see,
So long lives this, and this gives life to thee.

– William Shakespeare

She Walks In Beauty
She walks in beauty,like the night
Of cloudless climes and starry skies;
And all that’s best of dark and bright
Meet in her aspect and her eyes;
Thus mellow’d to that tender light
Which heaven to gaudy day denies.

One shade the more,one ray the less,
Had half impair’d the nameless grace
Which waves in every raven tress,
Or softly lightens o’er he face;
Where thoughts serenely sweet express
How pure,how dear their dwelling-place.

And on that cheek,and o’er that brow,
So soft,so calm,yet eloquent,
The smiles thatv win,the tints that glow,
But tell of days in goodness spent,
A mind at peace with all below,
A heart whose love is innocent!

– George Gorden Byron

Last but not least, in the end of the film, when the students stand upon the desk, when the words “Oh, captain. My captain.” spit out their mouth. I was totally moved and I yelled in my heart, “Fuck the regulations!

How to fix the problem when Firefox cannot launch in Ubuntu

I’ve encountered such problems for several times. I don’t know why, but it just happens. Bad luck, maybe.

First of all, let me describer the syndrome, actually there are two syndromes:

  1. After launching the Firefox, the browser returns an error message:

    firefox is already running, but is not responding…

  2. After launching the Firefox, there’s totally no feedback. At first, the icon will show up, and after a short while, it disappears.

So the point is: how to fix it?

Of course, everyone knows that you should check the answers which you get from Google. But this time I got no luck, either those guys problems are differ from mine or the answers didn’t work for me. But at least, you can have a try.

Solution One:

Open Terminal (Applications–Accessories–Terminal or simply hit Ctrl+Alt+T), enter

killall firefox-bin

or

killall firefox

then reboot your Firefox.

Solution Two:

Unfortunately, solution one didn’t apply to my problem. So I have to find another one.

Open Home Folder (Places–How Folder), show all the hidden folders (you can do it by hit Ctrl+H), find folder named “.mozllia“, find its sub-folder named “firefox“, delete it and try again.

Solution Two worked for me, So I hope it will also works for you. Good luck.

How to install Firefox 4 (Stable) In Ubuntu [10.04 and 10.10]

Source: How To Install Firefox 4 (Stable) In Ubuntu [10.04 and 10.10]

Now Firefox 4 (stable) has finally released, I cannot wait to have a try. Though I use Chrome quite a lot nowadays, Firefox was once my favorite. Somehow it’s a little bit slow, but it can highly customize, that win my heart, besides, I’m quite indulge in”Pentadactyl“, an add-on to emulate vim in the browser. Of course, Chrome has the similar extension, “Vimium“, but I suppose  “Pentadactyl” is better.

If your OS is other than Ubuntu, you can probably find Firefox installer in this page, download it, click and install, simple and easy. And if you happened to use Ubuntu like me, then follow these steps:

  1. If you are using the development version of Firefox, remove it with the command,
    sudo apt-get remove firefox-4.0
    If you are not using the development version, skip this step.
  2. Now add the Firefox stable PPA.
    sudo add-apt-repository ppa:mozillateam/firefox-stable
  3. Now update the software list
    sudo apt-get update
  4. Finally install Firefox 4 with the command.
    sudo apt-get install firefox
    After installation, you will find Firefox under Applications > Internet > Firefox Web Browser.

Some of the add-ons are not compatible with Firefox 4, such as “Autoproxy”, I don’t know how to fix it now, but I’m sure with the help Almighty Google, you can find your way.

O.k., let’s surf.

Omnibar的其他应用

先前也有几篇文章提到了Omnibar的应用,分别在这里这里,这里介绍一下其他的应用,因为这方面的应用都比较雷同,如果以后再有相关的文章就一并更新到这里。

    一、Omnibar中调用Google Dictionary查询单词:

  1. 打开 Search Engines 面板 (右键点击Omnibar选择 Edit Search Engines… )
  2. 点击 Add 新建一个搜索引擎
  3. Name 随意,可以取 Google Dictionary
  4. Keyword 也随意,但这个字段会在今后的搜索中经常用到,所以建议取得简洁又好记,我用的是 dic
  5. URL 设置成:

    http://www.google.com/dictionary?langpair=en|zh-cn&q=%s

  6. 点击 OK
  7. 现在在 Omnibar 中先键入先前设定好的 dic ,然后按照提示按 Tab 键,地址栏最前面会显示 “Search Dictionary:” ,现在再键入单词就直接跳出Google Dictionary的内容了。

    二、Omnibar中添加Google Canlendar事件:

    (这个应用参考了谷奥的文章,具体在这里

  1. 打开 Search Engines 面板 (右键点击Omnibar选择 Edit Search Engines… )
  2. 点击 Add 新建一个搜索引擎
  3. Name 随意,可以取 Add Google Calendar Events
  4. Keyword 也随意,但这个字段会在今后的搜索中经常用到,所以建议取得简洁又好记,我用的是 cal
  5. URL 设置成:

    http://www.google.com/calendar/event?ctext=+%s+&action=TEMPLATE&pprop=HowCreated%3AQUICKADD

  6. 点击 OK
  7. 现在在 Omnibar 中先键入先前设定好的 cal ,然后按照提示按 Tab 键,地址栏最前面会显示 “Search Add Google Calendar Events:” ,现在再键入随意内容就可以直接跳出Google Calendar的事件添加页面。如果你添加的形式诸如:

    [keyword] play starcraft 5pm tomorrow

    或者

    [keyword] play starcraft19:00 12/24

    那么在Google Calendar的事件添加页面中连时间也会一并加入。

在Chrome浏览器地址栏(Omnibar)中使用”I Feel Lucky”

我这个人有书签洁癖,太常用、太普通的网站我一般是不会放入书签栏的。但有的常用网站,网址相当难记,典型的就是“支付宝”。我一般会在Omnibar中直接打 “zhifubao” 搜索,然后在结果页面中打开支付宝的网站。这样其实是有些繁琐的,我们都知道在Google网站上有一个”I Feel Lucky”的功能,搜索时可以直接打开结果页面的第一个网站。那么这个功能如果能直接在Omnibar中实现不是很好吗?于是我找了一下,又是在Google Chrome的帮助论坛上找到了答案,参考页面在这里。具体实现方法如下:

  1. 打开 Search Engines 面板 (右键点击Omnibar选择 Edit Search Engines… )
  2. 点击 Add 新建一个搜索引擎
  3. Name 随意,可以取 I Feel Lucky
  4. Keyword 也随意,但这个字段会在今后的搜索中经常用到,所以建议取得简洁又好记,我用的是 gg
  5. URL 设置成:

    http://www.google.com/search?source=ig&hl=en&rlz=1G1GGLQ_ENUS264&q=%s&btnI=I%27m+Feeling+Lucky

  6. 点击 OK
  7. 现在在 Omnibar 中先键入先前设定好的 gg ,然后按照提示按 Tab 键,Omnibar变样了吧?地址栏最前面会显示 “Search I Feel Lucky:” ,现在再键入随便什么内容就能直接打开结果页面的第一条记录地址了。

更改Chrome浏览器地址栏(Omnibar)的默认搜索引擎

Chrome的Omnibar可以直接拿来当搜索栏用,这早就是个稀松平常的事情了,不过在不同的电脑上使用下来还是略有不同。有的电脑上在Omnibar里搜索给出的是google.com的搜索结果,而有的却把我重定向(redirect)到google.com.hk,给出的自然是中文搜索结果。介于中文世界中的搜索结果常年不给力,我个人还是更倾向于使用英文。所以如何更改Omnibar搜索时的重定向成了我的一个问题。最后在Chrome的帮助论坛里找到了一些参考,原文在这里。具体方法是:

  1. 打开 Search Engines 面板 (右键点击Omnibar选择 Edit Search Engines… )
  2. 选择 Google , 然后点击 Edit
  3. URL 字段中的文字全部拷贝下来,应该是下面的样子:

    {google:baseURL}search?{google:RLZ}{google:acceptedSuggestion}{google:originalQueryForSuggestion}sourceid=chrome&ie={inputEncoding}&q=%s

  4. 关闭窗口,然后点击 Add 新建一个搜索引擎
  5. Name 随便取,比如:Google/ncr
  6. Keyword 也随便取,比如:ncr
  7. URL 字段里把你刚才拷贝的内容粘贴进来,但是要把其中的 {google.baseURL} 改掉,一般改成 http://www.google.com 即可,即如下形式:
  8. http://www.google.com/search?{google:RLZ}{google:acceptedSuggestion}{google:originalQueryForSuggestion}sourceid=chrome&ie={inputEncoding}&q=%s

    当然,你也可以改成其它形式,如果想默认使用英国的Google搜索引擎,就把 {google.baseURL} 改成 http://www.google.co.uk ,其他的大家可以举一反三,以此类推。

  9. 点击 OK
  10. 在 Search Engines 面板里找到你刚刚添加的搜索引擎,选择它,再点击 Make Default
  11. 点击 Close
  12. 点击Chrome浏览器右上角扳手,然后找到 Preference
  13. 进入后在 Default Search 中同样选择你刚才设置的搜索引擎的名字。
  14. 关闭窗口

O.K.,现在在Omnibar里搜索时给出的搜索结果都是google.com引擎的,不会再发生跳转的现象。

p.s: 发现有一个问题,用Google自家的 “Highlight to Search (by Google) – Version: 1.0.34″ 有时还是会在选定词句搜索后跳转到 google.com.hk ,即使我挂着SSH也是一样。也就是说这个扩展非常智能,估计是从我的ip来判断重定向的国家,所以SSH也没用,要挂VPN才行。但也不是每台电脑都有这种情况,所以只能把问题描述一下,放在这里存疑了。