2011/10/26

IEH 20111025

2011/10/25 於 d`Cafe 的聚會筆記

[NoSQL ,MongoDB,Neo4j,Graph Database ...]

[Hadoop]
HDFS:是基礎建設,就像地基,是根本中的根本。
MapReduce:精華!大絕招!
HBase:Google Big Table,base on HDFS 的資料庫。
Cassandra:
Avro:
Hive:
Mahout:
Zookeeper:後面有一堆好用的 MapReduce 函式(工具?)可以呼叫使用
Pig:類似 SQL,是一種資料庫語言
Apache 有 Top Project 跟非 Top Project,
Hadoop 相關的 Sub Project 一堆都是 Top Project。

很棒的 hadoop 演講:
http://www.youtube.com/watch?v=3NAP5rk9Nzs

[Design Patten,無招勝有招,禪 ...]
Strategy
Template Method
Visitor:不同的專家去扣問不同的問題
Mediator
Observer

Reference:
http://neo4j.org/
http://www.mongodb.org/
http://www.readwriteweb.com/cloud/2011/04/5-graph-databases-to-consider.php
http://en.wikipedia.org/wiki/Graph_database
http://hadoop.apache.org/
http://hadoop.apache.org/common/docs/current/mapred_tutorial.html
http://www.jaceju.net/blog/archives/1828
http://coolshell.cn/articles/4844.html

2011/10/24

套件管理員

Python:pip
easy_install 或 setuptools 或 ez_setup.py
使用 easy_install 安裝起來放在 site-packages 的 *.egg 類似 Java 的 *.jar

PHP:Pear

Ruby:RubyGems

Perl:CPAN(Comprehensive Perl Archive Network)

R:CRAN

Node.js:npm

Ubuntu:apt-get、dpkg

Redhat:yum

Mac:homebrew

Reference:
01. http://www.ibm.com/developerworks/cn/linux/l-cppeak3.html

2011/10/23

CoffeeScript

CoffeeScript is just JavaScript!

CoffeeScript 有自己獨特的語法(類似 Python 混搭 Ruby),
編寫好的 CoffeeScript 檔,透過 CoffeeScript Compiler 可以編譯成通用的 Javascript

[使用 apt-get 安裝 CoffeeScript Compiler]
sudo apt-get install python
sudo apt-get install openssh-server libssl-dev
sudo apt-get install python-software-properties
sudo add-apt-repository ppa:chris-lea/node.js
sudo add-apt-repository ppa:gias-kay-lee/coffeescript
sudo apt-get update
sudo apt-get install nodejs
sudo apt-get install coffeescript

[使用 NPM 安裝 CoffeeScript Compiler]

要使用 NPM 需要先安裝好 Node.js 環境,請參考:
http://zx-1986.blogspot.com/2011/10/nodejs.html

然後執行:
sudo npm install -g coffee-script

[編譯安裝 CoffeeScript Compiler]
git clone https://github.com/jashkenas/coffee-script.git
cd coffee-script
sudo bin/cake install

[編譯 .coffee 檔產生 .js 檔]
# Compile a directory tree of .coffee files into a parallel tree of .js, in lib:
coffee -o lib/ -c src/

# Watch a file for changes, and recompile it every time the file is saved:
coffee --watch --compile experimental.coffee

# Concatenate a list of files into a single script:
coffee --join project.js --compile src/*.coffee

# Print out the compiled JS from a one-liner:
coffee -bpe "alert i for i in [0..10]"

# Start the CoffeeScript REPL(read-eval-print loop):
coffee

Reference:
http://upgrade2rails31.com/coffee-script
http://jashkenas.github.com/coffee-script

2011/10/18

Ubuntu 安裝 Sun Java

### Ubuntu 10.10

http://www.oracle.com/technetwork/java/javase/downloads/java-se-jdk-7-download-432154.html

### Ubuntu 11.10

```
sudo add-apt-repository ppa:ferramroberto/java
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install sun-java6-plugin sun-java6-jre sun-java6-plugin sun-java6-jdk sun-java6-bin sun-java6-fonts
sudo update-alternatives --all # 選擇 default 使用 Sun Java
```

http://www.lffl.org/2011/10/ubuntu-1110-oneiric-rimosso-java-dai.html)
http://askubuntu.com/questions/52154/how-do-i-install-the-latest-version-of-sun-java-in-ubuntu-11-10

### Ubunto 12.04

```
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java7-installer
sudo update-java-alternatives -s java-7-oracle
```

http://www.webupd8.org/2012/01/install-oracle-java-jdk-7-in-ubuntu-via.html
http://www.webupd8.org/2011/09/how-to-install-oracle-java-7-jdk-in.html

2011/10/12

Ubuntu 安裝 DHCP Server


dhcp3-server is a dummy package which wraps the real isc-dhcp-server package.
許多舊的關於 Ubuntu DHCP Server 教學文件都是不符合現狀的。
Ubuntu 11.04 內的 dhcp3-server 根本就是幌子!

真正的 DHCP 服務名稱既不是 dhcpd 也不是 dhcp3-server,而是 isc-dhcp-server。

Internet Systems Consortium, Inc. (ISC) is proud to be the producer and distributor of commercial quality Open Source software for the Internet Community and to offer world-class online and professional services based on our software.

sudo apt-get install isc-dhcp-server

設定檔:
/etc/dhcp/dhcp.conf
/etc/defaults/isc-dhcp-server

記錄檔:
/var/lib/dhcp/dhcpd.leases
/var/log/syslog

啟動腳本:
/etc/init.d/isc-dhcp-server

有多張網卡在 DHCP Server 上的需要特別注意:

When a DHCP configured PC boots, it requests its IP address from the DHCP server. It does this by sending a standardized DHCP broadcast request packet to the DHCP server with a source IP address of 255.255.255.255.
If your DHCP server has more than one interface, you have to add a route for this 255.255.255.255 address so that it knows the interface on which to send the reply.


Reference:
http://ubuntuforums.org/showthread.php?t=1754623
http://manpages.ubuntu.com/manpages/natty/man8/dhcp-helper.8.html
http://prefetch.net/articles/iscdhcpd.html
http://www.linuxhomenetworking.com/wiki/index.php/Quick_HOWTO_:_Ch08_:_Configuring_the_DHCP_Server