2016年9月12日 星期一

秦頌 - 電影心得,觀後感



 這是1996年的電影但是內容流暢度深度不受時間的侵蝕。

 以背景來說整個電影以黃土色為基調顯示出時間的陳舊感偏灰的色調也反應出裡面每個角色的人生心情(除了少數時刻,這部戲裡並沒有活得快樂的人)所有衣飾、武器、宮庭建築、案牘文書都相當考究,對白簡洗煉、粗曠豪邁不斷地在人物談話與表現之間給人思考與感官上的衝擊

 電影開始,高漸離與嬴政同在一個媽媽的懷抱裡哺餵,象徵人初生時同由大地滋養,大地提供相同的環境與資源,母親的愛也不因出身而有所偏私。大地提供了成長的能量,也提供了殺戮搏鬥的空間。

 嬴政代表著權威專制暴力強大,他有極強的意志力以統治中國的彊土與人心為終極目的,對於行動上的反抗,一律用暴力解決對於在心裡的反抗,除了限制圖書以外,他認為還需要能深入人心的秦頌來化解,於是他需要高漸離來完成這件事。

 高漸離代表著浪漫自由博愛弱小,對於維護自己的思想價值意志力不輸嬴政。雖然弱小,卻不害怕暴力,不因刀劍相向而屈膝,從頭到尾只有求死,沒有求饒,而他之所以求死,是因為失去自由與自尊(被烙囚字)對天下歸誰沒有興趣不反對統一,但反對所有殺戮。從頭到尾只當嬴政是朋友,從不當他是大王,對於嬴政對他的要求與管制方式不屈不撓地反抗,只在必要的時候妥協(為了救燕國囚徒,他同意為嬴政譜寫秦頌,出任大樂府令)

 嬴櫟陽雖然是嬴政的愛女看似過著榮華富貴應有盡有的生活,但其實她也過著灰白的人生,無比的空虛。她沒有任何朋友,在他身邊的人既不是男性,也不是女性,除了父親,她沒有可以說話的人,除了彈琴,也沒有別的事物可以寄託,他所擁有的人的感情就只有父親的親情,而她這唯一的父親卻為了國家利益,要將她嫁給大將軍王賁,親情再大,也只有第二順位

 故事主軸在這三個人之間震,高漸離與嬴櫟陽,雖然是以權貴與囚徒的身份相遇,但他們同為浪漫的弱小者在這專制困局中,彼此成為唯一的溫情出口他們無法抗拒王權,但即使只有一時半刻,也不顧危險地做他們想做的事,為自己而活。嬴政雖然對高漸離有友情,對嬴櫟楊有親情,但對國家利益與既定方針決不讓步,對於冒犯自己意志的行為,也必定會做出處分。

  王剪與王賁,為國家征戰多年,但其實看不出他們的愛國心,只看到他們在王權的壓力下不斷出兵打仗,某種程度他們是從兩個方面在保護自己的身家安全,他們的威脅一方面是自外敵(六國)另一方面則是來自嬴政,所以在軍事上不得不全力以赴,回過頭來也一定要嬴政將公主許配給王賁。

 最初嬴政的如意算盤,是掉燕國,得到高漸離製作的秦頌,再掉其它國家,之後將嬴櫟陽嫁給王賁,如此,內部安定政局,外部統一天下彊土與人心。但高漸離卻被烙上了囚字,對嬴政抗命不從,又與嬴櫟陽發生了關係影響到嬴政對王的規劃主要人心都已從嬴政預想的軌道上偏離,嬴政雖然憤怒,但還是想維持他原來的方針,他用語術與權術壓著所有人繼續照他的路線走,但人性卻不能按照威權被完全操控。最後高漸離嬴櫟陽都為了捍衛自己的思想與感情而死亡。嬴政還活著,成功的統一了天下,但失去所有親人與朋友,最終也沒得到人心。

 嬴政與高漸離的告別是以朋友的型式:高漸離稱呼嬴政為大哥,嬴政則送高漸離好死的一劍。

 嬴政從不認為自己有錯,只是在棋局中,一直在做不得不的決定。但在最後的場景,嬴政也認錯了,他認為一生最大的錯誤,就在重用樂人高漸離,造成他的計畫分崩離析他將樂器投入河裡而他也只能帶著這個悔恨離世。

    參考影評

2016年9月2日 星期五

小說推薦: 洗錢 by 橘玲

小說推薦: 洗錢 
作者: 橘玲
簡介: 
可以說是金融背景的偵探小說, 
裡面可以看到的是在巨大資金面前的人性表現
還有在日本國內怎麼:
- 冒領駕照
- 冒領戶籍謄本
- 冒領護照
- 利用境外壽險規避遺產稅
- 利用境外銀行,折扣債券,以及信託契約,來規避利息與股利所得稅
- 在美國開設匿名帳戶
- 將大筆資金匯出國外,但完全不留下匯款紀錄
另外還有提到租稅天堂與國家主權之間的關係以及賓拉登的洗錢方式
細節還有很多
整體來說讀起來是精彩通順
算是蠻難得一見的作品
喜歡讀偵探or金融小說的人 可以考慮找來看看

2014年8月1日 星期五

Submit a doc to a solr cloud

This post gives an example to submit a doc to a solr cloud.

String ZookeeperQuorum="192.168.10.1",192.168.10.2,192.168.10.3";
CloudSolrServer server=new CloudSolrServer(ZookeeperQuorum);
server.setDefaultCollection("yourCollection");
SolrInputDocument doc = new SolrInputDocument();
doc.addField("id","111");
doc.addField("intfield",100);
doc.addField("StringField","some data");
server.connect();
server.add(doc);
server.commit();

Then, a doc with id=111 will be created, and in that doc we will see "intfield"=100 and "StringField"="some data".

2014年7月27日 星期日

Add and read cache file in MapReduce program (2.2.0 API)

In MapReduce programming,
if u need ur mappers or reducers to read the content of a file,
then it is necessary to
1. put that file to HDFS
2. add that file to be localized using mapreduce Job's api so that mappers or reducers can access it

Following is the java codes for doing so:

In main function

Job job = Job.getInstance(conf, "jobname");
job.addCacheFile(new Path("hdfs://ip:port/folder/filename").toUri());

In the setup of the mapper (or reducer)

URI[] uris=context.getCacheFiles();        
Path path = new Path(uris[0].toString());
Now one may read the content of the file.
In addition, if in the main function one use job.addCacheFile to add multiple files, say

job.addCacheFile(new Path("hdfs://ip:port/folder/file1").toUri());
job.addCacheFile(new Path("hdfs://ip:port/folder/file2").toUri());
job.addCacheFile(new Path("hdfs://ip:port/folder/file3").toUri());
then file1's URI will be uris[0], file2's URI will be uris[1], and file3's URI will be uris[2].

2014年7月23日 星期三

MapReduce - wordcount 程式說明 (hadoop 2.2.0 api)



public class WordCountNewAPI {

public static void main(String[] args) throws Exception{
  
      Configuration conf = new Configuration();
       // 指定Namenode的位置
      conf.set("fs.defaultFS", "hdfs://yourhostIP:port");

      System.setProperty("HADOOP_USER_NAME", hadoopUser);
    
      Job job = Job.getInstance(conf,"Job name");

      job.setJarByClass(WordCountNewAPI.class);
   
      // 指定HDFS上的輸入與輸出目錄
      Path input = new Path("/input");
      Path output = new Path("/output");
      // 可以有多個input path, 可以指定資料夾, 也可以指定到資料夾+檔案名稱
      FileInputFormat.addInputPath(job, input);
      FileOutputFormat.setOutputPath(job, output);
   
      job.setMapperClass(Map.class);
     /* Combiner可用也可以不用, 不影響結果, 使用它是為了增加工作效率;在這裡, Combiner使用上面的Reduce類別, 它會將每份文件各自先做Reduce後, 再送交給Reducer做overall的Reduce */
      job.setCombinerClass(Reduce.class);
      job.setReducerClass(Reduce.class);

    /*Hadoop定義了多種方法將不同型態的輸入資料轉化為map能夠處理的 pair, 這裡我們使用TextInputFormat(這也是Hadoop預設的輸入方法), 它輸出的 pair型別為 */
    /* LongWritable, Text是Hadoop特定的資料型別, 可以分別想成是java的long, string */
    /* TextInputFormat以換行作為分割點, it takes the offset to one line as one output key, and takes the text content of that line as the output value corresponding to that key */
     job.setInputFormatClass(TextInputFormat.class);
     job.setMapOutputKeyClass(Text.class);
     job.setMapOutputValueClass(IntWritable.class);

    // Run job
     boolean succ = job.waitForCompletion(true);
     if (! succ) {
         System.out.println("Job failed, exiting");
         System.exit(-1);
     }
     else{
         System.out.println("Job successfully done!");
     }
 }

 public static class Map extends Mapper {
   //IntWritable是Hadoop特定的資料型別, 可以分別想成是java的int
     private final static IntWritable one = new IntWritable(1);
     private Text word = new Text();

     public void map(LongWritable key, Text value, Context context)
       throws IOException, InterruptedException {
       String line = value.toString();
       StringTokenizer tokenizer = new StringTokenizer(line);
       while (tokenizer.hasMoreTokens()) {
         word.set(tokenizer.nextToken());
     //摘取到的字出現一次, 這裡將它紀錄下來
         context.write(word, one);
       }
     }
   }

 public static class Reduce extends Reducer {
     public void reduce(Text key, Iterable values, Context context)
       throws IOException, InterruptedException {
       int sum = 0;
   //對每一個字, 算出它出現的次數
       for(IntWritable value : values) {
         sum += value.get();
       }
       context.write(key, new IntWritable(sum));
     }
   }
}

2014年7月15日 星期二

MapReduce call native library: A MEMO

Reference:
http://hadoop.apache.org/docs/r2.2.0/hadoop-project-dist/hadoop-common/NativeLibraries.html

My revision:
This example shows you how to distribute a shared library, mylib.so, and load it from a MapReduce task.

1. First copy the library to the HDFS, say path: hdfs://ip:port/libraries/mylib.so

2. The job launching program should contain the following: 
Job job = new Job(conf)
job.addFileToClassPath(new Path(" hdfs://ip:port/libraries/mylib.so"));

3. The mapper and the reducer can contain: System.loadLibrary("mylib.so");