2014年1月26日 星期日

Windows 安裝 Ruby Development Kit

1. 下載 Ruby Development Kit
2. 解壓縮到 Ruby 資料夾 (如:C:\Program Files\Ruby193\devkit)
3. 使用命令提示字元進入 devkit 資料夾
> cd C:\Program Files\Ruby193\devkit
> ruby dk.rb init
> ruby dk.rb install
4. 測試
> gem install json --platform=ruby
> ruby -rubygems -e "require 'json'; puts JSON.load('[42]').inspect"



References :
http://github.com/oneclick/rubyinstaller/wiki/Development-Kit

2014年1月16日 星期四

[翻譯] 9 foods that boost metabolism naturally 促進新陳代謝的九種食物

Your metabolism is partly ruled by genetics, but you can rev it up naturally by eating right. Fill up on the following nine foods to increase your body's fat-burning power.

你的新陳代謝不完全由天生來控制,而可以透過吃正確食物的方式來促進新陳代謝。攝取下列九種物質來增加燃燒脂肪的能量。


Egg whites 蛋白

Egg whites are rich in branched-chain amino acids, which keep your metabolism stoked, says Chicago nutritionist David Grotto. Eggs are also loaded with protein and vitamin D.

蛋白中富含支鏈氨基酸 (BCAA),爲新陳代謝所必須。蛋白中也含有蛋白質及維他命D。 
 
Health.com: The 20 best breakfast foods  


Lean meat 瘦肉

Lean meat is full of iron; deficiencies in the mineral can slow metabolism. Eat three to four daily servings of iron-rich foods, such as chicken or fortified cereal.

瘦肉中富含鐵質;在礦物質缺乏的情況下會減緩新陳代謝。每天吃三~四種富含鐵質的食物,如雞肉或強化麥片


Water 水

If you're even mildly dehydrated, your metabolism may slow down, says Dr. Scott Isaacs, clinical instructor of medicine at the Emory University School of Medicine. Tip: Drink water cold, which forces your body to use more calories to warm it up.


如果你是輕度脫水的,你的新陳代謝也會遲緩下來。
小提示:喝冷水,會強制讓你的身體消耗更多卡路里使身體暖和。


Chili peppers 辣椒

Chili peppers contain capsaicin, a chemical compound that can kick metabolism into higher gear, Isaacs says. He suggests adding a tablespoon of chopped chili peppers to a meal once a day. Chili peppers are also an unexpected source of vitamin C.

辣椒含有辣椒素,一種化學物質可以刺激新陳代謝。建議在一天中的一餐裏可增加一小匙的辣椒末。辣椒也是你意想不到的維他命C來源。


Coffee 咖啡

A study published in Physiology & Behavior found that the average metabolic rate of people who drank caffeinated coffee was 16% higher than that of those who drank decaf.

在科學行爲研究期刊中發現,喝含咖啡因咖啡的人,平均代謝率比沒有喝咖啡的人高出16


Green tea 綠茶

The brew contains a plant compound called EGCG, which promotes fat-burning, research suggests.

綠茶沖泡後會溶解出兒茶素 (epigallocatechin gallate),可促進脂肪消耗


Milk 牛奶

Studies conducted by Michael Zemel, former director of The Nutrition Institute at the University of Tennessee, suggest that consuming calcium may help your body metabolize fat more efficiently.

攝取鈣質可使你的脂肪代謝更有效


Whole grains 五穀雜糧

Whole grains help your body burn more fat because they take extra effort to break down than processed grains, like white bread and pasta. Whole foods that are rich in fiber, like brown rice and oatmeal are your best bets. 


消化五穀 (非精制麵粉) 可使身體燃燒更多的熱量,如全麥麵包或麥粉義大利麵。五穀中含有大量纖維,如糙米及燕麥是很好的考量。


Lentils 扁豆

About 20% of women are iron deficient, which is bad news for your waistline -- your body can't work as efficiently to burn calories when it's missing what it needs to work properly. One cup of lentils provides 35% of your daily iron needs.
 

大約有20%的女性鐵質缺乏,這對你的身材來說是不好的消息 -- 當缺乏鐵質時身體則無法有效燃燒卡路里。一杯量的扁豆提供你一天所需鐵質的35%。





References :
9 foods that boost metabolism naturally - CNN.com

2014年1月15日 星期三

每日攝取量:
一般成人:8~10 克
高血壓患者:5 克

岩鹽:
富含微量元素及礦物質

海鹽:
海水蒸發結晶
鹽鹵(內含豐富的鈣、鉀、鈉、鎂等礦物質)

精鹽:
1 公克鹽鈉量約 400 毫克
含氯化鈉、碘
攝取過多會心血管疾病、高血壓


低鈉鹽:
以氯化鉀取代 47% 氯化鈉
一樣有鹹味
攝取過多會有高鉀,腎髒病、腎衰竭患者少用

健康美味鹽:
以氯化鉀取代 30% 氯化鈉

無碘鹽(台鹽如意精鹽):
不含碘適用於甲狀腺機能亢進的患者

2014年1月12日 星期日

Arduino I2C

I2C总线是由数据线SDA和时钟SCL构成的串行总线,可发送和接收数据。在CPU与被控IC之间、IC与IC之间进行双向传送,最高传送速率100kbps。各种被控制电路均并联在这条总线 上,但就像电话机一样只有拨通各自的号码才能工作,所以每个电路和模块都有唯一的地址,在信息的传输过程中,I2C总线上并接的每一模块电路既可以是主控 器(或被控器),又可以是发送器(或接收器),这取决于它所要完成的功能。

 

連接腳位:
Arduino UNO : A4 (SDA), A5 (SCL)
Arduino MEGA :  20 (SDA), 21 (SCL)

使用 Wire.h 函式庫
 


 
References :
Arduino主从机之间的I2C通讯实验 来自 宜昌城老张的博客-与非网博客
arduino-info - LCD-Blue-I2C

/etc/network/interfaces sub-interface

# vi /etc/network/interfaces
auto eth0:0
iface eth0:0 inet static
address 192.168.1.11
netmask 255.255.255.0
broadcast 192.168.1.255
network 192.168.1.0




References :
Ubuntu Linux: Creating ethernet alias for eth0 network device

2014年1月8日 星期三

build Debian image for Raspberry Pi



References :
build your own Raspberry Pi SD card (original post from http://blog.kmp.or.at/2012/05/build-your-own-raspberry-pi-image/)

Pd-extended on Raspberry Pi

# vi /etc/apt/sources.list
deb-src http://archive.raspbian.org/raspbian wheezy main contrib non-free rpi
$ wget https://puredata.info/downloads/pd-extended-0-43-3-on-raspberry-pi-raspbian-wheezy-armhf/releases/1.0/Pd-0.43.3-extended-20121004.deb
$ sudo dpkg -i Pd-0.43.3-extended-20121004.deb

$ sudo apt-get update
$ sudo apt-get -f install



References :
Pd-extended 0.43.3 on Raspberry Pi (Raspbian Wheezy) - armhf — PD Community Site

Linux backup mbr

Backup MBR and Extended Partitions :
# dd if=/dev/sdc of=/tmp/backup-sdc.mbr bs=512 count=1

# sfdisk -d /dev/sdc > /tmp/backup-sdc.sfdisk

Restore MBR and Extended Partitions :
# dd if=backup-sdc.mbr of=/dev/sdc

# sfdisk /dev/sdc < backup-sdc.sfdisk 




References :
UNIX / Linux: Copy Master Boot Record (MBR)

2014年1月3日 星期五

puredata ALSA output error (snd_pcm_open): No such file or directory

$ pd -nogui -noadc -alsa testPatch.pd

ALSA output error (snd_pcm_open): No such file or directory


// list sound card device
$ aplay -l

// try the correct sound device
$ pd -audioindev 0 -audiooutdev 0
Media -> Test Audio and MIDI...



// set correct audio device
$ pd
Media -> Audio Settings... -> select Input and Output device





References :
Running Puredata on the Raspberry Pi | Limina.Log
Raspberry Pi • View topic - alsa audio-in with Pure Data and USB dongle