12/27/2010

Realtime Encoding

Transloadit 介紹一篇新的服務即時轉檔服務,也就是在上傳過程同時進行轉換,讓轉檔過程速度加快150倍以上。

從技術面思考如何做?

  • 上傳的時候如何將檔案切成 {chunk1, chunk2,...}
  • Transloadit使用node.js同時自行針對上傳過程進行拆解(file upload parser)

  • chunk 丟進ffmpeg server再組合成轉檔目的檔
  • Transloadit使用ffmpeg自行建立server用來處理四面八方的chunk資料,真正麻煩的地方 !

最近思考了一堆轉檔想法,RealTime轉法滿值得學習。

12/26/2010

空中樓閣理論

凱因斯曾說:

投資人不該把精力浪費在估算股票的真實價值,而該用於分析投資大眾未來的動向,以及在樂觀時期,他們會如何把希望建築為空中樓閣.

原文

The Castle-in-the-Air Theory, one of the Investment Theories, is rather opposite in its postulations compared to the Firm Foundation Theory. The Firm Foundation Theory believes and tries to understand the intrinsic value of any stock or other asset. The castle-in-the-air theory delves deep into another aspect of investing behaviour - it tries to unravel and understand the psychic values and behaviour of the group of investors. This theory was made popular in 1936 by John Maynard Keynes, a famous economist (as also an investor) and the theory postulates that the investors try to build a sort of castles in the air and think of the probable price rise in the future than estimating the intrinsic values of stocks. Once the investor has estimated this, he/she tries to beat the crowd by building positions in the preferred stocks before the crowds (read other investors) start buying those stocks and the price surges ahead.

關鍵的操作道理!

12/23/2010

Apache Tapestry 5.2.4 : Code Less, Deliver More

Apache Tapestry 5.2.4 發佈

從2009/4發佈5.1.0.5版本經過18月時間,發佈新版5.2.4,Tapestry創始人Howard Lewis Ship針對新版本主要的改進:

Removal of Page Pooling

一些大型專案會有大量記體消耗問題;因為Tapesry Page採取Pooling機制,有一個請求進來必須綁定Page Instance,當Page結構 (Page裡面一堆元件)是夠大,Page Pooling又同時多工請求下易造成記憶體不夠使用。

新機制每一個請求都是面對相同single page tree透過額外轉換(extra transformation step)將Page與Componet所產生短暫實例放入Per-thread Map中。透過新機制不需要額外要求Page Instance同時也不需要建構多個Page Instance,將能有效防止大量記憶體消耗。

Live Service Reloading

Service在實作的過程可在大部份環境直接看到執行結果,在開發過程中減少不斷重新佈署(省時間)

ClassTransformation API Improvements

重新設計ClassTransformation API可Java環境中進行好玩ClassTransformation,而不再被限於Javassist API

Query Parameter Support

QueryParameter機制方便Page存取從Request URL帶來資料

Testing

加強整合Selenium更容易可測試Tapestry Page。

JSR-303 Support

支援Bean Validation於 Client-Side與Server-Side

Documentation

明年應該會有Tapestry 5 In Action !

這一次最大改變應該在Tapestry 內部機制強化,如果您還在選擇Java Web Framework或許可考慮Tapestry的高生產力、高執行效率之開發架構 。

參考 Announcing Tapestry 5.2

Rack URLMap

Rack提供簡易routing 功能,能夠不同URL (PATH_INFO, SCRIPT_NAME) 執行不同的middleware。

[code lang="ruby"] app = Rack::Builder.new do use Rack::CommonLogger use Rack::ShowExceptions map '/env' do run Proc.new {|env| [200, {"Content-Type" => "text/html"}, env.inspect]} end map '/' do run lambda {|env| [200, { 'Content-Type' => 'text/plain' }, ["Hello World!"] ] } end map "/lobster" do use Rack::ShowExceptions run Rack::Lobster.new end end Rack::Handler::WEBrick.run app, : Port => 9292 [/code]

或者利用 Rack::URLMap 組出 url path 對映 app之關系

[code lang="ruby"] hello_app = lambda {|env| [200, { 'Content-Type' => 'text/plain' }, ["Hello World!"] ] } env_app = Proc.new {|env| [200, {"Content-Type" => "text/html"}, env.inspect]} lobster_app = Rack::Lobster.new app = Rack::Builder.new do use Rack::CommonLogger use Rack::ShowExceptions run Rack::URLMap.new '/' => hello_app, '/env' => env_app, '/lobster' => lobster_app end Rack::Handler::WEBrick.run app, : Port => 9292 [/code]

Rack 提供urlmap算是簡易的routing功能, 通常都是Framework自行撰寫routing機制,內建Rack Routing僅限單純應用。

12/17/2010

Rack Middleware Stack

Rack middleware針對Http要求與Http回覆進行過濾(filter)。換言之,Rack機制可撰寫自己filter用來控制或加強由Rack app所產生內容。Rack內部實作利用 pipeline design pattern,separation of concerns 觀念,因此可任易組合filter針對需求或你自行開發架構。

Rack內建許多處理Http相關的Filter,分成Authentication, Authorisation , Caching, Decoration, Monitor,...,所以基本上應該想得到都存在。

如何利用Rack::Builder建構middleware stack?

12/15/2010

Virtual Users in vsftpd

Virtual Users? 基本上就是不想在系統中開帳號,針對ftp需要開啟所需要帳號既可。

Ubuntu環境中先安裝下例套件,其中當然有很多PAM 認證方式,我選擇最容易方法使用libpam-pwdfile

[code lang="shell"] apt-get install vsftpd apt-get install libpam-pwdfile 新增virtual user touch /etc/vsftpd/passwd htpasswd -c /etc/vsftpd/passwd partner1 htpasswd /etc/vsftpd/passwd partner2 [/code]

修改vsftpd認證方式,將/etc/pam.d/vsftpd全部注解(除非還要使用不同的PAM認證),加入pam_pwdfile認證方式

[code lang="shell"] sudo vim /etc/pam.d/vsftpd auth required pam_pwdfile.so pwdfile /etc/vsftpd/passwd debug account required pam_permit.so debug [/code]

微調/etc/vsftpd.conf,關掉不必要anonymous 登入

[code lang="bash"] listen=YES anonymous_enable=NO local_enable=YES write_enable=YES local_umask=022 dirmessage_enable=YES xferlog_enable=YES connect_from_port_20=YES #chroot 所指定的目錄 chroot_local_user=YES secure_chroot_dir=/var/run/vsftpd pam_service_name=vsftpd rsa_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem rsa_private_key_file=/etc/ssl/private/ssl-cert-snakeoil.key user_config_dir=/etc/vsftpd/user #比較重要設定將guest_enable開啟,否則會出現500 OOPS: cannot locate user entry:partner1錯誤 guest_enable=YES #vsftpd需要一個system account去替代virtual users,否則會找不到目錄( cannot locate user entry),剛好ftp account是安裝時預設建立直接使用預設就可以。 guest_username=ftp write_enable=YES anon_world_readable_only=NO anon_upload_enable=YES anon_mkdir_write_enable=YES anon_other_write_enable=YES local_root=/home/partner [/code]

分別調整partner1與partner2 權限

[code lang="bash"] vim /etc/vsftpd/user/partner1 vim /etc/vsftpd/user/partner2 [/code]

12/14/2010

這一季書單

"Business Model Generation: A Handbook for Visionaries, Game Changers, and Challengers" Alexander Osterwalder; Paperback; $23.07

"Just Enough Software Architecture: A Risk-Driven Approach" George H. Fairbanks; Hardcover; $69.75

"Hackers: Heroes of the Computer Revolution - 25th Anniversary Edition" Steven Levy; Paperback; $14.04

原文書真貴!

12/10/2010

Conque Shell

Conque Shell 不錯小工具,簡易terminal emulator 可以將畫面顯示於vim buffer中,最好都不要跳出vim 編輯畫面!

 vim + mysql

下載安裝 git://github.com/chrismetcalf/vim-conque.git

使用方式

[code] :ConqueTermVSplit bash --login :ConqueTermSplit :ConqueTermVSplit :ConqueTermTab [/code] 參考 Conque Shell

12/08/2010

Rack Concept

Rack提供Ruby世界中Web Servers與Web Frameworks之間的橋樑。重要位置如同J2EE中Servlet,所有Java Web Application都透過相同介面與底層溝通。

如同Christian Neukirchen所言:

I noticed that there is a lot of code duplication among frameworks since they essentially all do the same things. And still, every Ruby web framework developer is writing his own handlers for every webserver he wants to use ...
However, in essence, dealing with HTTP is rather easy. In the end , you get a request and return a response.

因此Rack就被創造出來了 ! 也解救了大家,雖然在Java World是不可能看到這種事情發生 Orz。

從架構角度來思考Rack所佔位置:

From: Rack in Rails 3  Presentation

Rack官方定義:

Rack provides a minimal, modular and adaptable interface for developing web applications in Ruby. By wrapping HTTP requests and responses in the simplest way possible, it unifies and distills the API for web servers, web frameworks, and software in between (the so-called middleware) into a single method call.

那麼怎麼樣才是一個Rack程式所需要符合條件? Rack SPEC說到:

A Rack application is an Ruby object (not a class) that responds to call. It takes exactly one argument, the environment and returns an Array of exactly three values: status, the headers, and the body.

因此,只要有call function並且接收一個environment參數,且回傳一個Array由Http Status、Http Headers、Http Body所組成成員。

根據此需求撰寫一個最簡易Rack應用程式且透過Rack::Handler跑你喜歡Web Server!

[code lang="ruby"] ?> rack_app = lambda {|env| [200, {}, ["hello rack"]]} # >> Rack::Handler::WEBrick.run rack_app [2010-12-08 00:25:55] INFO WEBrick 1.3.1 [2010-12-08 00:25:55] INFO ruby 1.9.2 (2010-08-18) [x86_64-darwin10.5.0] [2010-12-08 00:25:55] INFO WEBrick::HTTPServer#start: pid=3996 port=3000 [/code]

Rack 趨勢所造成結果,統一中間層、介面,才有學習使用價值。

參考

f

12/01/2010

Java Swing 外觀

Java Swing Look and Feel,似乎愈做愈漂亮,雖然已經超久沒有寫Swing-Based Application。如果有寫Swing可以考慮幾個不錯外觀(皮)。

  • Substance Java look & feel
  • The goal of this project is to provide a rock solid, fast and extensible library for creating visually appealing and consistent Swing applications.
    From: substance.dev.java.net

    Berkeley Software Distribution (BSD) License

11/29/2010

從JDK中學習Design Pattern

學習Design Pattern最怕就是找不到範例,無法意會其中精髓。

StockOverflow 有一篇Examples of GoF Design Patterns 列出 JDK中使用哪些Design Pattern,或許可加深印象及想法!

11/22/2010

ruby irb環境中使用vim

ruby irb 環境中並不適合編輯程式碼,因此常常浪費時間在編輯上。

gem interactive_editor 簡單整合在irb使用各種編輯器!

安裝過程:

[code] gem install interactive_editor [/code]

vim ~/.irbrc

[code] require 'rubygems' require 'interactive_editor' ... [/code]

自行定義: vim ~/.irbrc

[code] ... class << self def vi(name=nil) InteractiveEditor.edit('/Applications/MacVim.app/Contents/MacOS/Vim', name) end def vim(name=nil) InteractiveEditor.edit('/Applications/MacVim.app/Contents/MacOS/Vim', name) end def gvim(name=nil) InteractiveEditor.edit('/Applications/MacVim.app/Contents/MacOS/Vim -g -f', name) end def mate(name=nil) InteractiveEditor.edit('mate -w', name) end end [/code]

執行irb,直接打vim就可以呼叫MacVim出來編輯之後,vim -> :wq 就會直接執行所編緝程式。

11/17/2010

使用Pathogen管理Vim套件

用github管理dotfiles之後,發現Vim套件有一年多沒有更新,但是更新這些plugins相關檔案全部散落於~/.vim中,真的也不知道如何整理、維護。

Vim過去套件管理

過去Vim有人提出使用Vimball格式,但是它不是官方檔案格式也不容易使用於CLI環境下!

pathogen套件管理

直到我看了Tim Pope 所開發的Vim套件管理程式pathogen.vim,只要將所有套件放在~/.vim/bundle用不同的目錄名稱來區別,執行Vim時自動將所有套件載入,要移除套件只要將~/.vim/bundle/plugin-name刪除。

目前安裝套件: ls ~/.vim/bundle

[code] IndexedSearch ir_black snipmate.vim vcscommand vim-cucumber vim-fuzzyfinder vim-markdown vim-ruby vim-sparkup vim-tcomment bufexplorer jquery taglist vim-align vim-endwise vim-git vim-rails vim-ruby-debugger vim-supertab vim-vibrantink gist nerdtree textile.vim vim-autocomplpop vim-fugitive vim-haml vim-repeat vim-shoulda vim-surround [/code]

安裝Pathogen

下載 pathogen.vim 放至 ~/.vim/autoload 目錄中 [code] -> ls ~/.vim/autoload/ pathogen.vim [/code] 編輯 vim ~/.vimrc [code] " 最前面加入 filetype off call pathogen#helptags() call pathogen#runtime_append_all_bundles() [/code]

如何同步更新Vim套件

雖然有Pathogen管理Vim套件但是無法自動更新套件,目前大致上有二種方式:

  • 寫個 vim ~/.vim/update_bundles script ,用來自動更新bundle下所有套件,同時維護update_bundles
  • 使用git submodules觀念連結散落於GitHub Vim 套件至~/.vim/bundle/

兩種方式都是有效解決同步Vim套件問題,不過各有優缺點自行評估使用,不過現在維護VIM相關設定真的也容易許多了!

參考文件

11/16/2010

用github管理dotfiles

dotfiles基本上就是個人一堆設定檔如.vim, .vimrc, .screenrc, .irb, ...

在維護這些dotfiles有時候真的很花時間,乾脆直接放在github並使用git控管,日後要重灌、更新只少有一致的版本可以使用!

先去github新建 dotfiles git repository,利用git將你的dotfiles全部commit至github中,個人是將dot改成沒有dot檔案名稱再commit,利用Ryan 所寫的Rakefile自動安裝到自己的環境中。

安裝方式:

[code] git clone git://github.com/chliu/dotfiles ~/.dotfiles cd ~/.dotfiles rake install [/code]

11/12/2010

Apple加入OpenJDK

Apple加入Oracle’s OpenJDK,將提供更多 Java 技術到OpenJDK中。

將從Java SE 7 開始提供實作包括32-bit 與64-bit HotSport-base java virtual machine, class libraries, networking stack, graphical client....

個人是比較期待graphical client相關東西,這個應該是Apple強項。 JVM漸漸走向OpenJDK!

11/08/2010

HTML 5 大方向

從上一次Steve Jobs挑起Apple與Flash大戰之後,HTML5愈來愈被人重視,先別管到底是誰輸贏,HTML5必然浮上台面上雖然真的有一點不想理它,但是它也算是下一代網頁規格、規範。

HTML5 大方向為何(很粗看一下):

  • 新增描述文件的Tag

    section, header, footer, nav, article, aside...或許div將愈用愈少, 文件結構語意更重要!

  • 支援更多API

    contracts api, selectors api v2, indexed database api, web workers, web storage, web sockets, geolocation api, canvas 2d context, messaging api, html media capture,...好吧Javascript愈寫愈少,反正瀏覽器本身內建!

    瀏覽器將漸漸成為framework!

  • web form2

    placeholder text, autofocus fields, email addresses, web addresses, numbers as spinboxes, numbers as sliders, date pickers, search boxs, color pickers, form validation, required fields, ...常用處理都內建進來,看來Javascript會再少用一些。

  • 支援CSS3
  • 支援mobile
  • 支援Video/Audio Formats

    反正就是要努力拋棄Flash!

HTML5 及各家瀏覽器都尚未準備齊全,不過只少可以看得出來下一代網頁未來的大方向。

11/06/2010

Install mod_pagespeed on Ubuntu

Google 針對Apahce出的 mod_pagespeed 模組,主要讓你的網站用最省力、簡單、自動化跑最佳化 HTML, JavaScript, CSS, Image 相關網站元素。

聽聽Google怎麼說

we’re introducing a module for the Apache HTTP Server called mod_pagespeed to perform many speed optimizations automatically. We’re starting with more than 15 on-the-fly optimizations that address various aspects of web performance, including optimizing caching, minimizing client-server round trips and minimizing payload size. We’ve seen mod_pagespeed reduce page load times by up to 50% (an average across a rough sample of sites we tried) -- in other words, essentially speeding up websites by about 2x, and sometimes even faster.

ubuntu 安裝

  1. wget https://dl-ssl.google.com/dl/linux/direct/mod-pagespeed-beta_current_amd64.deb
  2. sudo dpkg -i mod-pagespeed*.deb
  3. vim /etc/apache2/mods-available/pagespeed.conf

    修改ModPagespeedDomain 加入網站domain name => www.chrispad.com

  4. sudo /etc/init.d/apache2 restart

確認網站的HTML、CSS是否已經改變過,想要進一步的微調 Go!

10/19/2010

meta-programming in ruby

最近大概是人生當中比較閒時段,拿起meta-programming in ruby 書本閱讀,思考rubyonrails可以幫助我什麼,它的核心精神又是什麼。rubyonrails一直是很magic framework,讓它這麼強大、動態原因還是在ruby meta-programming,隨手整理還需要強化的地方。

  1. The object model
  2. block (closure) v.s proc v.s lambda
  3. methods (method_missing and dynamic methods)
  4. class v.s module design
  5. meta-program api
  6. review of the design of activerecord

雖然ruby很動態、magic不過就像大老所說:

There is no such thing as meta-programming. It’s just programming all the way through.

8/25/2010

Automatic Resource Management in java 7

最近 Java 7 build 105版本加入一個 Automatic Resource Management 特性,基本上,就是try-with-resources觀念。try block中所使用的resource將會自動被關閉不管正常執行完或發生錯誤,日後不需要再手動關掉resource物件,。

FEATURE SUMMARY: A *resource* is as an object that must be closed manually, such as a java.io.InputStream, OutputStream, Reader, Writer, Formatter; java.nio.Channel;java.net.socket; java.sql.Connection, Statement, ResultSet, or java.awt.Graphics. The *automatic resource management statement* is a form of the try statement that declares one or more resources. The scope of these resource declarations is limited to the statement. When the statement completes, whether normally or abruptly, all of its resources are closed automatically.

8/23/2010

HowTo deploy Redmine on ubuntu with Passenger

redmine已經是非常不錯專案管理軟體,主要簡潔、方便,重點是用rubyonRails架構撰寫,自己要客制化也比較容易一點!

redmine howtos 也撰寫了各式各樣不同的環境安裝,如果只要安裝redmine直接就可以解決。

但是如何佈署至Apache(雖然也是很多文章),同時也是第一次使用Passsenger算滿值得記念。

8/11/2010

Tapestry 5.2.0 Alpha Release

似乎是等太久,不過仍然是Tapestry5.2 Alpha版本 Orz,依舊修改一堆bugs 與performance 議題,主要改進:

  • 能夠動態載入Service介面之實作
  • 新增QueryParameters機制,方便在page存取URL帶來資料
  • 能夠處理Form取消邏輯,將略過client-side validattion
  • 使用標準 SAX parser, 為了能夠更容易支援Google App Engine
  • 支援 JSR-303 Bean Validation
  • 加強與簡化meta-programming 能力 (java要做到這個地步真不容易)
  • Page機制改成singleton (no longer pooled instanced),內部機制調整

Tapestry 已經是非常不錯framework,目前也使用5.1於多個專案中,開發速度、Performance都已經接收過考驗也值得推薦。

6/18/2010

Install mongodb on OSx

安裝mongodb,使用 homebrew OSX環境中

[bash] #install path /usr/local/Cellar/mongodb/1.4.2-x86_64 brew install mongodb sudo mongod #run mongo shell mongo [/bash]

mongod也可以直接指定儲存路徑mongodb --dbpath ~/db/,同時官方的推薦使用64bit。

6/16/2010

介紹MongoDB特性


MongoDB介於key values stores和RDBMS系統之間系統.




MongoDb ( From "humongous") 主要特性:




  • Document-oriented storage

  • json格式為主儲存方式



  • Full Index Support

  • 任何屬性基本上都可以建index



  • Replication & High Availability

  • 簡單的說就是備份機制強擴充容易



  • Auto-Sharding

  • 能夠自動、簡易做到Sharding



  • Querying

  • json格式方式查詢



  • Fast in place

  • One nice feature with MongoDB is that updates can happen “in place”- the database does not have to allocate and write a full new copy of the object. 所以更新速度快!



  • Map/Reduce

  • 支援Map/Reduce操作



  • GridFS

  • 能夠處理大檔案、影音檔、檔案儲存



  • Commercial Support

  • 需要商業支援請呼叫MongoDB support Team



在NoSql多門派中,個人比較看好MongoDB主要就是簡易與方便擴充,performance考慮到其次,已經在考慮如何使用MongoDB設計系統。

6/14/2010

使用Amazon S3非同步備份

Amazon S3簡易的付費網路磁碟服務,協助開發者做Web-Scale Computing。

付費的方式用多少付多少,算起來還滿合理,可透過Amazon提供SIMPLE MONTHLY CALCULATOR親自試算看看。目前考量只拿來當作非同步備份機制使用,雖然S3是為了Web-Scale Computing設計。

如何備份資料庫與系統資料?

6/08/2010

SimpleNote + Notational Velocity 極讚記事本

最近在iphone上使用Simplenote記事本確實滿方便,但最主要是免費又簡易,同時又幫你sync至simple-note.appspot.com中,讓您隨時隨地可以存取資料,這種方式也算是雲端應用之一。

另一個好用軟體在Mac osx下執行Notational Velocity (記法、速度),最大特色就是簡單到不行,但確功能極全而且使用它可輕鬆將simplenote同步在一起,資料完全無後顧之慮。

images by Neil Boyd and UX Patterns

6/01/2010

log4j in tomcat

Tomcat是使用Commons Logging 當作log system,不過大部份web app都是使用log4j,如何讓tomcat支援log4j?

雖然官方已經有說明還是寫一下筆記以免又忘了!

5/21/2010

Maintenance page for Apache

網站上線後在初期會有很多程式修正,因此網站更新過程必須停止程式運作( java web app),在維護過程中讓使用重導至維護面是很重要。在apache環境提供滿多解決方案,這效果讓維護過程使用者知道網站尚未死掉。

Prototype coexist with jquery in tapestry5

在使用tapestry5時,prototype1.6.1 與jquery1.3.2共存,IE8出現錯誤javascript error...

javascript錯誤訊息如下:

...IE8 brings an error of "object not defined" at prototype.js line 4821...

試了很多怪招都沒有用,最後僅升級jquery1.4.2事情就解決了Orz,白白浪費這麼多時間!

5/15/2010

yahoo 輸入法+嘸蝦米

Yahoo輸入法已經有支援Mac環境,雖然官方沒有說支援嘸蝦米,但是yahoo輸入法採香草Open架構,也能夠Plugin使用其它輸入法。

安裝步驟:

  1. 安裝Yahoo輸入法Mac
  2. 利用G大神找Liu*.cin
  3. 複製liu*.cin 至~/Library/Application Support/Yahoo! KeyKey/DataTables/Generic
  4. 登出
  5. 努力微調到您要的感覺

5/07/2010

disabled ipv6 ubuntu 10.04

關掉ubuntu ipv6加速網路速度

先確認是否已經disabled ipv6

cat /proc/sys/net/ipv6/conf/all/disable_ipv6
# 1 -> disabled 0 -> enabled

編輯 sudo vim /etc/sysctl.conf

#disable ipv6
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1

5/02/2010

Tapestry Talk

非常不錯介紹Tapestry Talk

Watch Howard Lewis Ship talk

Tapestry Zone

Tapestry Zone 定義一個可動態被更新區域,在頁面中利用Ajax或者其它Client side effect來驅動它。

雖然大家都會寫ajax了,但是很少人去定義被更新區域叫Zone,真的是滿有意義定義及規範。 在Tapestry Zone可以讓開發者簡易且有規範輕鬆做出動態更新功能,我們並不需要太專注於javascript撰寫!

4/29/2010

Tapestry 5 block concept

基本上block是一種元件它能夠集合靜態文字、html elements、元件,用來定義此區塊能夠有什麼樣式(UI)。似乎還是很複雜不如把它看成div區塊,tapestry想法透過定義block讓開發者能夠簡易操控於畫面上,並且重覆使用block物件來layout畫面。

4/14/2010

Increase the VM memory for IntelliJ IDEA

如何調整Intellij IDEA 9 所使用java memory ? 跑一些web application一下子out of memory.

OSX 環境中可以編輯此檔 /Applications/IntelliJ IDEA 9.0.1.app/Contents/Info.plist

調整

VMOptions
-Xms384m -Xmx640m -XX:MaxPermSize=256m -ea -Xbootclasspath/a:../lib/boot.jar

4/13/2010

New Macbook Pro release

新的Apple Macbook Pro已經更新了

不過只有一句話 真的很貴! Orz,反而教育價比較有誠意一點ooxx

暫時先等國外的評論,再好好做決定

4/10/2010

rTorrent 推薦設定

讓rtorrent跑得更順更安性兩個設定

  • vim .rtorrent.rc
  • 參考Optimize Your BitTorrent Download Speed
  • min_peers = 40
    max_peers = 52  
    max_uploads = 10
    download_rate = 0 
    upload_rate = 10  
    
  • 啟動Bittorrent Protocol Encryption
  • Protocol encryption (PE), message stream encryption (MSE), or protocol header encrypt (PHE)[1] are related features of some peer-to-peer file-sharing clients, including BitTorrent clients. They attempt to enhance privacy and confidentiality. In addition, they attempt to make traffic harder to identify by third parties including internet service providers (ISPs).
    # The example value allows incoming encrypted connections, starts unencrypted
    # outgoing connections but retries with encryption if they fail, preferring
    # plaintext to RC4 encryption after the encrypted handshake
    encryption = allow_incoming,try_outgoing,enable_retry
    
rTorrent 推薦設定

4/09/2010

abs for rtorrent client

rtorrent是目前常用torrent console client,利用Archlinux abs編譯達到優化rtorrent目的

  1. 更新Archlinux abs tree
  2.  sudo abs 
  3. 將更新rtorrent至home
  4.  cp -r /var/abs/community/rtorrent/ ~/abs 
  5. 修改vim PKGBUILD, 加入-with-posix-fallocate用來降低filesystem fragmentation
  6. #./configure --prefix=/usr --disable-debug --with-xmlrpc-c || return 1
    ./configure --prefix=/usr --disable-debug --with-posix-fallocate|| return 1
    
  7. compile rtorrent
  8.  makepkg -s 
  9. 安裝rtorrent package
  10. sudo pacman -U rtorrent-0.8.6-2-i686.pkg.tar.gz 
    Password: 
    loading package data...
    checking dependencies...
    (1/1) checking for file conflicts                   [######################] 100%
    (1/1) upgrading rtorrent                            [######################] 100%
    

4/07/2010

Hibernate 3.5.0 final release

終算釋放新版了,似乎等了滿久!

3.5.0 版本中新增一些期待滿久的特性:

  • JSR 317(JPA)支援 
  • 整合hibernate-anootaitons, hibernate-entitymanager, hibernate-enver至核心中
  • 新增標準Infinispan as second-level cache 支援
  • 加強"read only" / "immutable" 支援
  • 支援JDBC 4
  • 支援column-level read/write fragments (HBM only for now)
  • Initial support for fetch profiles (不知道什麼東西)
  • Phase 1 will focus on the API and the metadata infastructure needed to support fetch profiles. It will also provide implementation for using the join strategy.

個人所期待支援就是JPA2,JPA1在查詢支援及彈性不是這麼理想,不過這一次修正似乎滿多關於second-level cache問題

Hibernate 3.5.0 final release

3/06/2010

start sshd in Mac

最近工作機換成Mac min i,一切又是新的感覺,等待新的macbook pro。 sudo /usr/libexec/sshd-keygen-wrapper sudo /usr/sbin/sshd -i

2/06/2010

Full system upgrade in ARch linux

pacman -Syu

一行指令更新系統同時synchronize the repository

最近接觸Arch Linux 設計理念真的很不錯,似乎可以考慮好好使用它。

1/30/2010

Java Native Method

很少有機會接觸native method,平時都是拿java來實作webapp,在追縱一段程式發現為什麼程式只有宣告而沒有實作而且還用上native keyword,好奇心想要瞭解為什麼要用java native method?

The Java Native Interface (JNI) is a programming framework that allows Java code running in a Java Virtual Machine (JVM) to call and to be called[1] by native applications (programs specific to a hardware and operating system platform) and libraries written in other languages, such as C, C++ and assembly.

大致上會用到JNI應該有下面幾個原因:

  • 需要呼叫O.S應用
  • 舊系統(c, c++, win32)
  • 搞Embedded System
  • performance考量

利用native method可以在java 環境中呼叫外部資源,但是在很多地方我想應該是沒有這麼容易可以解決,不過算是又進一步瞭解java可以幫我們做些什麼事,有空寫一個Hello World來測試。

1/29/2010

設定iphone3.0 同步更新google calendar

之前已經有設定不過一直失敗,這一次看到別人走CalDAV方式,方法還滿容易。

參考此文章 Configuring CalDAV on iPhone 3.0 for Sun Calendar Server

1/23/2010

how to extract java war file

只要使用jar指令就可以處理war檔

解壓縮war檔 :

jar xvf  WOW.war

壓成war檔 :

jar cvf WOW.war ./WOW/ 

1/20/2010

phpBB3使用Gmail送信

目前尚未決定自行架設Mail Server,phpbb3目前也尚未完整support Gmail 相關認證,因此必須小繞一下路,使用SSL protocal向gmail做帳號認證,但中、長期還是自行架設比較方便一點。

如何設定phpBB3支援Gmail認證:

  1. php使用ssl module
  2. Apache 安裝OpenSSL module,讓PHP支援SSL
  3. phpBB3管理介面中PHP資訊,顯示 => OpenSSL support enabled
  4. phpBB3管理介面中Email設定
    • SMTP 伺服器位址: ssl://smtp.gmail.com
    • SMTP 伺服器連接埠: 465
    • SMTP 驗證方式: LOGIN
    • SMTP 會員名稱: abc@gmail.com
    • SMTP 密碼:: ************

基本上這些設定完應該是可以使用Gmail 來送信,不過Gmail會有一些送信delay問題,所以比較中、長期來話還是需要 Mail Server,以便有彈性去調整送信策略!

1/17/2010

phpBB3加入google analytics

幫phpBB3加入google analytics,也是非常容易,只要去管理員控制台 (ACP) 編輯樣板並選擇overall_footer.html。

然後加入由google analytics 所產生一堆javascript code, 選擇插入overall_footer.html 地方,最好是放在後面可以加速網頁顯示。

phpBB3換不同的Domain Name

phpBB3換不同的Domain Name,應該注意步驟:

進入管理員控制台 (ACP),伺服器組態相關設定:

  1. Cookie settings : 改成新的Domain
  2. Server Settings: 改成新的Domain
  3. 更新 template cache

1/15/2010

Install JDK in ArchLinux

安裝JDK,預設安裝Sun JDK

pacman -S jdk
#link
ln -s /opt/java/bin/java /usr/bin
#test
java -version

setup Pacman mirrorlist

設定ArchLinux mirrorList

vi /etc/pacman.d/mirrorlist # Taiwan Server = ftp://ftp.tku.edu.tw/Linux/ArchLinux/$repo/os/i686 Server = http://ftp.tku.edu.tw/Linux/ArchLinux/$repo/os/i686