2013年10月31日 星期四

[Linux] failed to bring up eth0 in Ubuntu


在使用 預先製作好的 VM檔案時,
內部配置有一張bridge 一張NAT 網卡,外面有dhcp server 會分發 ip 。
開了一陣子發現, 外面連不進去dhcp的那個 ip了,直覺先 /etc/init.d/networking restart 一下,
出現了 "failed to bring up eth0 " in Ubuntu

之後,會使用 ifconifig 看看是不是 dev 的name改變了,發現也沒有變動。
本來以為是,之前bind 的mac ,跟現在不一樣了 dhcp 才不能動,
改去 /etc/udev/rules.d/ check 一下 network 那個 file 。
發現並沒有產生這個file。

只好 refresh 一下 dhcp
sudo dhcpclient

It's Work ~

peicheng@TW-PCLIAO:~/code/git_col/repeating-phrases
$ ping 10.1.192.142
PING 10.1.192.142 (10.1.192.142) 56(84) bytes of data.
64 bytes from 10.1.192.142: icmp_req=1 ttl=64 time=0.320 ms
64 bytes from 10.1.192.142: icmp_req=2 ttl=64 time=1.74 ms
64 bytes from 10.1.192.142: icmp_req=3 ttl=64 time=0.596 ms




2013年10月22日 星期二

[台灣武術] 13.10.20 台灣拳頭會 於 麻豆總爺藝文中心 舉辦之”台灣拳頭 巡迴 大匯演 首站”


台灣拳頭會 於麻豆 總爺藝文中心 舉辦之”台灣拳頭 巡迴 大匯演 首站”,於時間 10月20日(日)下午舉行,
圓滿成功。

超過 20 幾個團體,50 幾種拳種,匯集一地,大家互相交流,互相成長,各路名家精銳盡出。


2013年10月17日 星期四

[solr] Solr vs SolrCloud / Solr 與 SolrCloud的差別


SolrCloud 改善了原本在 Solr 分散式上面的不足。
Solr 在之前沒有distributed index的feature,我們需要手動的去拆分 core to shards,
你要自己知道你要index的record file 是送到哪一台node上面做index,Solr並不會幫你管理這些步驟。
而且,當你的每個core不 balance 時,也要手動來結果。而且不支援 failover 。可能會導致某些 index 找不到的情況。

SolrCloud 引入 ZooKeeper

在整個系統中導入了hadoop eco 常用的 居中協調角色的 ZooKeeper來做 failover 與 load balancing。讓整個 Search engine 可以更 Robust。

There were, however, several problems with the distributed approach that necessitated improvement with SolrCloud:

- Splitting of the core into shards was somewhat manual.
- There was no support for distributed indexing, which meant that you needed to explicitly send documents to a specific shard; Solr couldn't figure out on its own what shards to send documents to.
- There was no load balancing or failover, so if you got a high number of queries, you needed to figure out where to send them and if one shard died it was just gone.
SolrCloud fixes all those problems. There is support for distributing both the index process and the queries automatically, and ZooKeeper provides failover and load balancing. Additionally, every shard can also have multiple replicas for additional robustness.

Shards and Indexing Data in SolrCloud - Apache Solr Reference Guide - Apache Software Foundation
https://cwiki.apache.org/confluence/display/solr/Shards+and+Indexing+Data+in+SolrCloud

2013年10月16日 星期三

[hadoop] mapreduce 新舊版本 org.apache.hadoop.mapred vs org.apache.hadoop.mapreduce

note一下,

0.20 前使用 org.apache.hadoop.mapred 舊介面
0.20 版本開始引入org.apache.hadoop.mapreduce 的新API

0.20 後使用
http://hadoop.apache.org/docs/current/api/org/apache/hadoop/mapreduce/Mapper.html

@InterfaceAudience.Public
@InterfaceStability.Stable
public class Mapper
extends Object
Maps input key/value pairs to a set of intermediate key/value pairs.

使用 extends

新的API中引入了 context ,直接替換了,map() , reduce()方法中使用的 OutputCollector ,Reporter object。現在透過調用 Context.write() 輸出key value。

0.20 之後 使用 extends map , extends reduce 去 extend class。
而之前 map ,reduce 則是interface。




2013年10月13日 星期日

[mac] mac 預覽圖片 preview


在使用mac整理圖片時就想說,怎麼沒有一個好用的 看圖工具了。
原來就是內建的 preview 預覽工具。

在圖片上 按 space 就可以使用上下左右去看圖了。

2013年10月11日 星期五

[hadoop]MapFile


MapFile 是 排序且帶索引的 hadoop SequenceFile 。
一個 MapFile 在 HDFS上是一個資料夾,包含兩個file組成,一個是index,也就是key的索引,另外一個就是 data,排序好的原始資料。
在查找時,只需要把index載入,memory中,使用binary search的方式,就可以很快查找到要找的key。

index
內含 
# hadoop fs -text numbers.map/index


1 128
129 5820
257 11539
385 17255
513 22971
641 28676
769 34388
897 40107

每128 key會有一個索引,第2欄是offset


data 內就含有排序後的key value 。


# hadoop fs -text numbers.map/data
13/10/11 17:17:23 INFO util.NativeCodeLoader: Loaded the native-hadoop library
13/10/11 17:17:23 INFO zlib.ZlibFactory: Successfully loaded & initialized native-zlib library
13/10/11 17:17:23 INFO compress.CodecPool: Got brand-new decompressor
1 one 11 fsdf afd fsdf 111
2 two 222 fsdf d fsd sd 222
3 thref sfd sfsdf e 333 fsd 333
4 four 44 fds 4sfsd fsdfs 4444
5 five 555 fsd fdsf fsd f sf sdfsdfsdf 5555
6 one 11 fsdf afd fsdf 111
7 two 222 fsdf d fsd sd 222
8 thref sfd sfsdf e 333 fsd 333



org.apache.hadoop.io 
Class MapFile


java.lang.Object

extended by


org.apache.hadoop.io.MapFile

Direct Known Subclasses:
ArrayFile, SetFile


public class MapFileextends Object

A file-based map from keys to values.


A map is a directory containing two files, the data file, containing all keys and values in the map, and a smaller index file, containing a fraction of the keys. The fraction is determined by MapFile.Writer.getIndexInterval().


The index file is read entirely into memory. Thus key implementations should try to keep themselves small.


Map files are created by adding entries in-order. To maintain a large database, perform updates by copying the previous version of a database and merging in a sorted change list, to create a new version of the database in a new file. Sorting large change lists can be done with SequenceFile.Sorter.


 


 


 


2013年10月8日 星期二

[hadoop] ambari HDP default jobtracker namenode port

IPC port
JobTracker:8021
namenode:8020

JobTracker WebUI : 50030
NameNode WebUI 50070




2013年10月2日 星期三

[eclipse][ubuntu] eclipse cant not start java.lang.UnsatisfiedLinkError: Could not load SWT library. Reasons:


$ cat 1380704328894.log
!SESSION 2013-10-02 16:58:48.757 -----------------------------------------------
eclipse.buildId=I20110613-1736
java.version=1.6.0_34
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=linux, ARCH=x86_64, WS=gtk, NL=zh_TW
Command-line arguments: -os linux -ws gtk -arch x86_64

!ENTRY org.eclipse.osgi 4 0 2013-10-02 16:58:50.031
!MESSAGE Application error
!STACK 1
java.lang.UnsatisfiedLinkError: Could not load SWT library. Reasons:
no swt-gtk-3740 in java.library.path
no swt-gtk in java.library.path
Can't load library: /home/peicheng/.swt/lib/linux/x86_64/libswt-gtk-3740.so
Can't load library: /home/peicheng/.swt/lib/linux/x86_64/libswt-gtk.so

at org.eclipse.swt.internal.Library.loadLibrary(Library.java:285)
at org.eclipse.swt.internal.Library.loadLibrary(Library.java:194)
at org.eclipse.swt.internal.C.(C.java:21)
at org.eclipse.swt.internal.Converter.wcsToMbcs(Converter.java:63)
at org.eclipse.swt.internal.Converter.wcsToMbcs(Converter.java:54)
at org.eclipse.swt.widgets.Display.(Display.java:132)
at org.eclipse.ui.internal.Workbench.createDisplay(Workbench.java:695)
at org.eclipse.ui.PlatformUI.createDisplay(PlatformUI.java:161)
at org.eclipse.ui.internal.ide.application.IDEApplication.createDisplay(IDEApplication.java:153)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:95)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:344)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:622)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:577)
at org.eclipse.equinox.launcher.Main.run(Main.java:1410)
at org.eclipse.equinox.launcher.Main.main(Main.java:1386)

how to solve

ln -s /usr/lib/jni/libswt-* ~/.swt/lib/linux/x86/
or
ln -s /usr/lib/jni/libswt-* ~/.swt/lib/linux/x86_64/

[hive] left semi join


Tutorial - Apache Hive - Apache Software Foundation
https://cwiki.apache.org/confluence/display/Hive/Tutorial#Tutorial-Joins


Hive 的說明內只出了Joins的幾種組合用法,
其中有個是 left semi join


In order check the existence of a key in another table, the user can use LEFT SEMI JOIN as illustrated by the following example.

INSERT OVERWRITE TABLE pv_users
SELECT u.*
FROM user u LEFT SEMI JOIN page_view pv ON (pv.userid = u.id)
WHERE pv.date = '2008-03-03';


如果有兩張表
A,B
A 
id name   
1  abc
2  edf

B
id city
1  taipei
2  ku
1  yl

使用 left semi join 時,B表只會出現一筆 rec ,達到去重效果。

cf.


Hive Join(翻译自Hive wiki) - ggjucheng - 博客园
http://www.cnblogs.com/ggjucheng/archive/2013/01/15/2860723.html


 


2013年9月30日 星期一

[angular js] Module ~ factory service provider

[angular js] Module ~ factory service provider

區分這三者的不同。

# Factory
that needs some amount of logic or parameters before it can be initialized

#

[angular js] Module ~ factory service provider

[angular js] Module ~ factory service provider

區分這三者的不同。

2013年9月27日 星期五

[python]Suffix Arrays


Suffix Arrays
http://algorithmicalley.com/archive/2013/06/30/suffix-arrays.aspx


[hadoop] commission and decommission

[hadoop] commission and decommission Step

hadoop 1尚未完成攥寫 可先參考 hadoop 2 上的流程。
peicheng-note: [hadoop]hadoop 2 commission and decommission
http://peichengnote.blogspot.tw/2014/04/hadoophadoop-2-commission-and.html

[hadoop] job scheduler

[hadoop] job scheduler


2013年9月17日 星期二

[linux]settup passwordliess login



peicheng@TW-PCLIAO:~
$ ssh-copy-id -i ~/.ssh/id_rsa.pub root@renode2
Warning: the RSA host key for 'renode2' differs from the key for the IP address '10.1.191.177'
Offending key for IP in /home/peicheng/.ssh/known_hosts:28
Matching host key in /home/peicheng/.ssh/known_hosts:78
Are you sure you want to continue connecting (yes/no)? yes

peicheng@TW-PCLIAO:~
$ ssh root@renode2
Warning: the RSA host key for 'renode2' differs from the key for the IP address '10.1.191.177'
Offending key for IP in /home/peicheng/.ssh/known_hosts:28
Matching host key in /home/peicheng/.ssh/known_hosts:78
Are you sure you want to continue connecting (yes/no)? yes
Last login: Wed Jul 10 11:54:56 2013 from remaster

rm the line number  28



2013年9月15日 星期日

[think]兩岸生比拚 教授:驚悚勝飛彈



這種渴望,當年讓我內心整個糾結。其實只是比我們還要早想清楚那時間要的是什麼,和大部份不服輸隨波逐流的人。

"因應少子化趨勢,薛承泰認為,競爭力將是重要關鍵。他以台灣過去和現在的大學景況相比,早期大學多從上午7時開始上課,現在則多從9時開始,但開學一個月後觀察,早上3學分的課,學生卻常只來上2學分。

進一步比較兩岸大學景況,薛承泰表示,假如早上8時到大陸走一趟,就算不是北大、清大等名校,其他大學校園裡頭,也能看到學生爭相進教室準備上課的積極態度,反觀台灣則多半是空蕩蕩,這種落差「比1000顆飛彈瞄準台灣還驚悚」。"


兩岸生比拚 教授:驚悚勝飛彈 | 重點新聞 | 中央社即時新聞 CNA NEWS
http://www.cna.com.tw/News/FirstNews/201309150014-1.aspx




2013年9月13日 星期五

[武術]台灣拳頭全國巡迴大匯演 台灣拳頭會

台灣拳頭全國巡迴大匯演─啟動新聞稿

時間:102年9月22日 14:00開始
地點:台南市總爺藝文中心
指導單位:台南市政府、台南市體育處、台南市麻豆區公所
主辦單位:台灣拳頭會

 

 

台灣拳頭會 成立於2010年。 乃是以大台南各門各派武術家為推手,結合全台武林人士,共同挖整推動台灣傳統武術文化的卓越平台。在第一、二屆理事長 陳昭憲 先生,秘書長 郭應哲 教授等全體 理監事、顧問努力下,成果斐然。每年定期舉辦演武大會、全國性武術比賽、及傳統武術傳承講習,結合在第廟會文化活動,如麻豆代天府,麻豆文旦節等。逐漸讓 全國社會各界,知道台灣傳統武術特別大台南地區的多元與多采之美。

此次表演,共有太祖、永春、永春鶴、香港永春、羅漢、長肢猴拳、短肢猴拳、飛鶴、食鶴、六合螳螂、七星螳螂、太極梅花螳螂、陳家太極、楊家太極、鄭子太極、李派太極、程派高氏八卦掌、尹式八卦掌等共有21種之多可見一斑(見附表二)。

台灣拳頭會 雖會址在 台南 麻豆,但影響力遍及全台,故此次演武大會乃全國性巡迴表演。演出表如附表一。

 

附表一 各地演出表





























































場次


時間


地點


活動標題


備註


1.台南麻豆


102年9月22日


總爺藝文中心


台灣拳頭

全面啟動


 


2.高雄


102年11月24日


衛武營都會公園(暫定)


百武朝鳳

(暫定)


 


3.新竹


103年1月5日


竹東客家戲曲公園


錦園八卦

武動風城


 


4.台南市


103年3月9日(暫定)


台南市文化中心


府城武韻

(暫定)


 


5.台中


103年4月20&.27日(擇一)


大甲文昌祠


台灣武藝

眾耀天后


大甲媽祖共同舉行


6.台南新營


103年6月29日(暫定)


新營文化中心音樂廳(暫定)


太極武藝

(暫定)


 


7.台北


103年8月(暫定)


台北師範大學(暫定)


渡海來台

武風雲集


北派武藝集演


 

 

 

 

附表二 總爺演武門派表

















































































































































拳種


種類


門派及館號


備註


太祖、五祖


 


二甲太祖拳


 


 


西螺勤習堂


 


 


台南金水師系統


 


永春


 


台南金水師系統


 


 


香港葉問系


 


羅漢


 


玉井後旦仔宋江陣


 


十八羅漢拳


岡山嚷師


 


鶴拳


飛鶴


麻豆謝厝寮


 


食鶴


柳營故舍


 


永春鶴


台中十甲玉麟金獅陣


 


永春鶴


台中豐原玉麟金獅陣


 


太祖化鶴


楠西宋江陣、西螺勤習堂


 


羅漢化鶴


台南鹽埕宋江陣


 


猴拳


長肢猴


宜蘭太祖長肢猴


 


永春猴


七甲永春拳


 


北派


八極拳


台灣武藝文化研究協會


 


六合螳螂


中華民國螳螂拳協會


 


七星螳螂


台灣武藝文化研究協會


 


太極梅花螳螂


 


 


太極


陳家太極


高雄市陳氏太極拳協會

台南市中觀陳氏太極拳協會


 


楊家太極


中華民國楊太極武藝協會


 


鄭子太極


台南市薪傳太極拳協會


 


李派太極


高雄縣李派太極拳研究會


 


八卦掌


程派高氏八卦掌


新竹縣錦園八卦掌研究協會


 


尹式八卦掌


中華民國尹式八卦掌協會

 


[mac]brew install python Python/mactoolboxglue.c:472: error: old-style parameter declarations in prototyped function definition

[mac]brew install python
error when install python use brew on mac

Python/mactoolboxglue.c:472: error: old-style parameter declarations in prototyped function definition

try to re install your Command Line Tools via Xcode’s Preferences. CLT


2013年9月8日 星期日

[武術][twwy][田調日記] 13.09.08 虎尾 西安里 五間厝 白鶴陣 / 西螺 勤習堂 / 虎尾 三塊厝 勤習堂

[武術][twwy][田調日記] 13.09.08 虎尾 西安里 五間厝 白鶴陣 / 西螺 勤習堂 / 虎尾 三塊厝 勤習堂

此次田調的重點放在 五間厝 的 白鶴陣。
本以為這裡只是一個陣,後來發現原來這是有 拳法 武術的 一個武館。
當年唐山師父 在此教拳,教授 五枚派 白鶴拳 。
有不少拳法,出陣時,並沒有兵器,只有空拳對兵器。

依我觀之,李淮朱 師父演示的 手法,我看起來很像李小龍常演示的寸勁,
並且有震肢,一出手冷脆有拍拍聲。

後來訪 西螺 勤習堂 廖本勝 師父,了解到原來 三塊厝 阿味師 陳己酉 的學習與傳承故事。

在訪 虎尾 三塊厝 勤習堂 陳俊劼 老師 ,他是 陳己酉的孫子,由於父親早逝,後來幾乎由阿味師 帶大。