By Unknown | Thursday, January 10, 2013
Posted in: | 0 comments

背單字的好網站

第一個網站是大陸那邊的網站,超方便,只要上去註冊然後選擇字彙範圍跟每天要複習的字數,之後就只要每天上去報到就可以了。我選了每天100個字,現在有點後悔.....
http://www.shanbay.com/books/index/

下一個是國外的網站,主要都是非英語系的,作用跟上面的網站很像,但是內容比較多樣化,可以選擇不同課程,我覺得也滿不錯的,用這來複習幾個還記的的法文字
http://www.memrise.com/courses/english/

Read more
By Unknown | Tuesday, January 08, 2013
Posted in: , , , | 0 comments

Livereload in sublime 2

記得這個應該是ruby的套件,沒想到現在Windows上也可以直接配合sublime使用,只需要安裝套件就全部搞定,因為太高興了所以馬上記下來。

教學來源
  1. http://shoogledesigns.com/blog/blog/2012/07/23/sublime-text-2-package-control-and-livereload/
  2. http://kevintsengtw.blogspot.tw/2012/02/sublime-text-2-part3-package-control.html#.UOvX8m-miCh
簡單說明
  1. 先在sublime 2安裝Package Control,使用快捷鍵Ctrl+`打開命令列,再把下面這一長串打進去執行。
  2. import urllib2,os; pf='Package Control.sublime-package'; ipp=sublime.installed_packages_path(); 
    os.makedirs(ipp) if not os.path.exists(ipp) else None; 
    urllib2.install_opener(urllib2.build_opener(urllib2.ProxyHandler())); 
    open(os.path.join(ipp,pf),'wb').write(urllib2.urlopen('http://sublime.wbond.net/'+pf.replace(' ','%20')).read()); 
    print 'Please restart Sublime Text to finish installation'
  3. 安裝完之後,打開Preferences/Package Control,選擇install package,打入Livereload,接著就開始安裝。
  4. Google Chrome及Firefox都有livereload套件,把它裝進去後,在設定的地方打開Allow access to file URLs
  5. 基本上到這邊就結束了,可以找一個HTML檔測試,記得要點選瀏覽器Livereload圖示他才會啟動,然後就可以正常使用。

Read more
By Unknown | Sunday, January 06, 2013
Posted in: | 0 comments

B777-300ER

B777-300ER
seating-capacity: 386
lenght: 242ft
wingspan: 212ft
cabin width: 19ft
typical cruise speed: 0.84M
max cruise spped: 0.89M
max range: 7930 nmi
direct market competitor: A330-300, A340, MD11, A350, 787

EVA
架數:15
發動機:GE90-115B
速度:0.84M
最高巡航高度:43100ft
座艙配置
312座位
318座位

Read more
By Unknown | Sunday, December 30, 2012
Posted in: | 0 comments

2012-12-30聽力

SA 60s Science

Forest Canopy Color Reveals CO2 Uptake

When autumn rolls around, the leaf peepers come out in force. Armed with digital cameras, they record the most spectacular displays of fall foliage. Well according to a study in the journal Functional Ecology [Toshie Mizunuma et al., The relationship between carbon dioxide uptake and canopy colour from two camera systems in a deciduous forest in southern England], those images may be more than just pretty pictures. They may represent a new way to monitor climate change.
Trees take carbon dioxide, or CO2, from the atmosphere and convert it into biomass. By sopping up CO2 they help to stabilize the climate. But at the same time, they’re also affected by climate, for example, budding earlier in the season as global temperatures rise.
To understand how all this balances out, ecologists monitor how forests take up CO2. It’s a costly business that involves using a network of 500 instrument towers worldwide. So researchers got to wondering whether there might be an easier way to keep an eye on photosynthesis. And they found that digital cameras do the trick.
Analyzing two years’ worth of snaps taken every half hour in a forest in southern England, the researchers discovered that a tree’s leafy colors provide a good proxy for its photosynthetic productivity. So next time you go for a walk in the woods, take only photos. And leave only data points.

Humidity Levels Explain U.S. Flu Winter Peak 

Cases of the flu peak in winter in the U.S. But why? A new study suggests it’s not the heat, but the humidity. Or lack thereof. Because in temperate regions, the influenza virus fares best when the weather is dry. That’s according to work published in the journal PLoS One. [Wan Yang, Subbiah Elankumaran and Linsey C. Marr, Relationship between Humidity and Influenza A Viability in Droplets and Implications for Influenza’s Seasonality]
Scientists have long debated why flu erupts when the days grow chilly. Is it that we spend more time cooped up together indoors? Or is there something about the virus that likes it cold and dry? To find out, researchers suspended influenza virus in a solution that mimics human mucus. They incubated this infectious soup at different humidities and measured viral survival.
And they found that at low humidity, the fake mucus dries up and the virus does just fine. But when the humidity tops 50%, the droplets only partially evaporate, leaving behind a solution that’s too salty for the virus to thrive.
Interestingly, the virus does well again when the humidity reaches 100 percent, evaporation stops and the salinity of the mucus bath is juuust right. That could explain why the flu prefers to hit the tropics in rainy season. And why you should always keep your nose clean, but moist.

Telecommuters Work Longer Hours than Office Goers

When I say “telecommuting,” do you picture yourself easing into the workday in a pair of fuzzy slippers? Well, so does your boss. But the reality is, you’re both dreaming. Because a new study shows that folks who work at home at least some of the time put in more hours than those who stay at the office. That’s according to work published in the journal Monthly Labor Review. [Mary C. Noonan and Jennifer L. Glass, The hard truth about telecommuting]
Telecommuting for a portion of the workweek certain has its appeal. Avoiding the time and cost involved in commuting and presumably having a more flexible schedule and a better work-life balance are all potential pluses. But are employees really able to take advantage of such work-at-home perks?
Researchers took advantage of labor information from census bureau surveys and were surprised by what they found. First off, the proportion of people who work remotely remained unchanged from the mid-’90s to the mid-2000s the most recent data available. Second, those who do telecommute are more likely to work overtime, an additional 5 to 7 hours on top of the standard 40.
Which means that people who work from the comfort of home are not slackers in slippers. They’re more likely tech-savvy self-starters—who don’t know when to stop.

Read more
By Unknown | Thursday, December 27, 2012
Posted in: , | 0 comments

Calculation dihedral angle from 2 vectors

計算acos的簡單範例,先用以下公式求出cos值,再利用acos得到角度





/* acos example */
#include <stdio.h>
#include <math.h>

#define PI 3.14159265

int main ()
{
  double param, result;
  param = 0.5;
  result = acos (param) * 180.0 / PI;
  printf ("The arc cosine of %lf is %lf degrees.\n", param, result );
  return 0;
}

參考

Read more
By Unknown | Wednesday, December 19, 2012
Posted in: , | 0 comments

Linked List

這個禮拜最令我傷神的,不過幸好很久以前有想過一次,所以要回復記憶比較沒有那麼困難。首先我先把C++版本的linked list刻出來,當然骨幹是參考別人的,然後自己有改了些東西,沒花多久時間很快就用出來了。

以下是標頭檔:

class CKLinkList{
    private:
        struct node {
            int x;
            int y;
            int z;
            node *link;
        } *p;

        int count_i;

    public:
        CKLinkList();
        void append(int);
        void insert_after(int,int);
        void insert_first(int);

        void display(void);
        void display_line(void);
        int length(void);
        void del(int);
        ~CKLinkList();
};

接下來是實作

#include <iostream>
#include "linklist.h"

using namespace std;

CKLinkList::CKLinkList(){
    p = NULL;
    count_i = 0;
};

int CKLinkList::length(){
    return count_i;
};

void CKLinkList::del(int num){
    node *q, *r;
    q = p;

    // No node
    if (p == NULL) return;

    // Delete the first node
    if (q->x == num){
        p = q->link;
        delete q;
        count_i--;
        return;
    }

    // Delete the remainder
    r = q;
    while( q != NULL){
        if (q->x == num){
            r->link = q->link;
            delete q;
            count_i--;
            return;
        }

        r = q;
        q = q->link;
    }
};

void CKLinkList::insert_first(int num){

    node *q, *t;
    q = p;

    t = new node;
    t->x = num;
    t->y = num*2;
    t->z = num*3;

    t->link = q;
    p = t;
    count_i++;
};

void CKLinkList::insert_after(int start_val,int num){
    node *q, *t;

    if (start_val != 0){
        q = p;
        while(q->link != NULL){
            if (q->x == start_val){

                t = new node;
                t->x = num;
                t->y = num*2;
                t->z = num*3;
                t->link = q->link;
                q->link = t;

                count_i++;
                return;
            }

            q = q->link;
        }
    }
};

void CKLinkList::append(int num){
    node *q, *t;

    if (p == NULL){
        p = new node;
        p->x = num;
        p->y = num*2;
        p->z = num*3;
        p->link = NULL;
    } else {
        q = p;
        while(q->link != NULL){
            q = q->link;
        }

        t = new node;
        t->x = num;
        t->y = num*2;
        t->z = num*3;
        t->link = NULL;
        q->link = t;
    }

    count_i++;
};

void CKLinkList::display_line(void){
    node *q;

    for(q = p; q != NULL; q = q->link){
        cout << " <- " << q->x;
    }

    cout << endl;
};

void CKLinkList::display(void){
    node *q;

    for(q = p; q != NULL; q = q->link){
        cout << "This is : " << q->x << ", " << q->y << ", " << q->z << endl;
    }
};

CKLinkList::~CKLinkList(){
    node *q;
    if (p == NULL) return;

    while (p != NULL){
        q = p->link;
        delete p;
        p = q;
    }
};

接下來我看到了一個使用C++ template去實作的版本,應該說是某個老師的教學課程(參考第10,11,12章),我就順便把她的課程講義看過一遍,然後把他的版本做出來。第一次使用C++的template,雖然滿麻煩的,但是真的是很強大,看來以後搞不好我的每個程式都要用template去做出來。以下是template的版本:

#include <iostream>
using namespace std;

template <class T>
class ChainNode {
    private:

    public:
        T data;
        ChainNode<T> *link;

        ChainNode(void){};
        ChainNode(const T& data){ this->data = data; };
        ChainNode(const T& data, ChainNode<T> *link){
            this->data = data;
            this->link = link;
        };
};

template <class T>
class Chain {
    private:
        ChainNode<T> *first;
        int count;

    public:
        Chain(void){ first = NULL; count = 0; };
        bool isEmpty() const {return first == NULL;}
        int IndexOf(const T&) const;
        int size(void){return count;}
        void Delete(int);
        void Insert(int,const T&);
        void Display(void);
        ~Chain();
};

// Destruction
template <class T>
Chain<T>::~Chain() {

    while (first != NULL){
        ChainNode<T> *next = first->link;
        delete first;
        first = next;
    }
};

template <class T>
int Chain<T>::IndexOf(const T& theElement) const{

    ChainNode<T> *currentNode = first;
    int index = 0;
    while(currentNode != NULL && currentNode->data != theElement){
        currentNode = currentNode->link;
        index++;
    }

    if (currentNode == NULL)
        return -1;
    else
        return index;
};

template <class T>
void Chain<T>::Delete(int theIndex){
    if (first == NULL) throw "Can not delete empty chain";

    ChainNode<T> *deleteNode;
    if (theIndex == 0){
        deleteNode = first;
        first = first->link;
        delete deleteNode;
        count--;

    } else {
        ChainNode<T> *p = first;
        for(int i =0; i< theIndex-1; i++){
            if (p == NULL) throw "Element not exist";
            p = p->link;
        }

        deleteNode = p->link;
        p->link = p->link->link;
        delete deleteNode;
        count--;
    }
}

template <class T>
void Chain<T>::Insert(int theIndex, const T& theElement){
    if (theIndex < 0) throw "Bad";

    if (theIndex == 0){
        first = new ChainNode<T>(theElement,first);
        count++;
    } else {
        ChainNode<T> *p = first;
        for(int i = 0; i < theIndex-1; i++){
            if (p == NULL) throw "Not Exist";
            p = p->link;
        }
        
        p->link = new ChainNode<T>(theElement, p->link);
        count++;
    }
};

template <class T>
void Chain<T>::Display(void){

    ChainNode<T> *p = first;

    while(p != NULL){
        cout << " <- " << p->data;
        p = p->link;
    }
    cout << endl;
};

int main() {
    cout << "This is LinkList .." << endl;

    Chain<int> *list = new Chain<int>;
    cout << "Size: " << list->size() << endl;

    list->Insert(0,1);
    list->Display();
    list->Insert(0,2);
    list->Display();
    list->Insert(1,3);
    list->Display();
    list->Insert(1,4);
    list->Display();
    list->Insert(0,5);
    list->Display();
    list->Delete(2);
    list->Display();

    cout << "Size: " << list->size() << endl;
}

繼續努力加油吧,這星期把linked list搞完之後還有很多要充實的,以上的source code都公布在github上看(其實blog根本不適合看這麼多程式碼是吧XD)。

Read more
By Unknown | Friday, December 14, 2012
Posted in: | 0 comments

Tempo Run

剛剛喵了一下我的跑步計畫,Tempo Run的配速看了之後覺得還有些不輕鬆。約8KM的距離速度在pace 5左右。根據最近這兩個禮拜在操場跑下來的結果,似乎400m@120s需要熱個將近10圈之後才有可能,所以我看短時間還是先把目標速訂在130s然後再慢慢加到120s。

Read more