2013年3月16日 星期六

[電影] Life of π


圖:http://en.wikipedia.org/wiki/Life_of_Pi_(film)


終於播空看了 π 電影,這拍的真的不錯,裡頭寓意深遠,我還滿喜歡這種劇情。讓我想起昨天跟高中同學短暫閒聊的內容,那位同學恰巧經過台北,拿了帖子給我,在法拉利車廠前,我們閒聊了幾句。那段閒聊或許有些傲氣,拋棄了當前的工作,正籌備著回老鄉創業,同學提醒著我要訂立目標,珍惜現況顛峰,大膽追求,並且學習力可能會慢慢遞減,更要思考十年後要該端出哪盤菜呢!


看完 π 後,更清楚那種觸感,雖說大家都朝著舒適的環境追求,但只有活在有競爭環境下,才會督促自己走的更遠一點。


2013年3月15日 星期五

gdb: error while loading shared libraries: libexpat.so.0: cannot open shared object file: No such file or directory @ Ubuntu 12.04 Server 64Bit

原先以為安裝 libexpat1-dev 後即可解決,但有更多細節該留意,就順手記一下吧


$ sudo find / -name "libexpat.so*"
/lib/x86_64-linux-gnu/libexpat.so.1.5.2
/lib/x86_64-linux-gnu/libexpat.so.1
$ sudo ln -s /lib/x86_64-linux-gnu/libexpat.so.1 /lib/i386-linux-gnu/libexpat.so.0
$ sudo ldconfig
$ gdb
gdb: error while loading shared libraries: libexpat.so.0: wrong ELF class: ELFCLASS64
$ sudo apt-get install ia32-libs
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:


The following packages have unmet dependencies:
ia32-libs : Depends: ia32-libs-multiarch
E: Unable to correct problems, you have held broken packages.
$ dpkg --print-architecture
amd64
$ dpkg --print-foreign-architectures
i386
$ sudo unlink /lib/i386-linux-gnu/libexpat.so.0
$ sudo apt-get install libexpat1-dev:i386
$ sudo ln -s /lib/i386-linux-gnu/libexpat.so.1 /lib/i386-linux-gnu/libexpat.so.0
$ gdb
…
(gdb)


2013年3月9日 星期六

[C] XML parser using libroxml

複習一下 C 語言和 cmake 用法,這次用 C 來解 XML,至於為何要用 libroxml(LGPL) 嘛,只是單純碰到就用看看(且預設支援cmake),下次再改用 libxml2(MIT)。


處理一些 XML 時,會需要排版一下才方便人眼查看,這時就用到 Online XML Formatter 來格式化一下。


筆記:https://github.com/changyy/c-xml-parser-using-libroxml


$ git clone --recursive git://github.com/changyy/c-xml-parser-using-libroxml.git
$ cd c-xml-parser-using-libroxml
$ mkdir build
$ cd build
$ cmake ..
$ ./c-xml-parser


2013年3月3日 星期日

We Are Young!


這首歌的意境有很多的解釋方向,但此刻就不多說,享受那股年輕氣盛吧!最近花了兩個週末補齊了我錯估時程的工作 :P 真的,用說的都嘛比較快,不知不覺就說錯看錯估錯寫錯...


對這首歌歌詞有興趣的可以參考 fun.搖滾樂團-we-are-young-ft.-janelle-monáe-【中英歌詞】,翻的還不賴。


Tonight
We are young
So let's set the world on fire
We can burn brighter than the sun


最近周邊人的轉職、猶豫,都常讓我回顧自己去年的選擇方式,的確,就那幾個字罷了,我們還年輕,再衝動一點、再勇敢一點,再給自己多一點時間來驗證吧!


2013年3月1日 星期五

Redmine - 修正檔案上傳失敗

用 Redmine 附檔時只會看到 Internal Server Error 資訊,翻了 /var/log/apache2/error.log 後,看到了神祕句子:


Unexpected error in mod_passenger: An error occured while buffering HTTP upload data to a temporary file in /tmp/passenger.1.0.7336/generation-0/buffered_uploads. The current Apache worker process (which is running as XXX) doesn't have permissions to write to this directory. Please change the permissions for this directory (as well as all parent directories) so that it is writable by the Apache worker process, or set the 'PassengerUploadBufferDir' directive to a directory that Apache can write to.
Backtrace:
  in 'boost::shared_ptr<Passenger::BufferedUpload> Hooks::receiveRequestBody(request_rec*)' (Hooks.cpp:1321)
  in 'int Hooks::handleRequest(request_rec*)' (Hooks.cpp:585)


這時我才想到,因為我在 Apache 設定時,透過 passenger 並指定 XXX 權限跑 redmine 的,因此會碰到 XXX 無法存取 /tmp 裡頭相關的位置,解法…那就是多建立一個目錄給 redmine 使用吧 :P


$ sudo su XXX
$ mkdir /path/redmine/PassengerUploadBufferDir
$ exit
$ sudo vim /etc/apache2/conf.d/redmine
Alias /redmine "/path/redmine/public"
RailsBaseURI /redmine
<Directory /path/redmine/public>
  AssignUserId XXX XXX
  PassengerUploadBufferDir /path/redmine/PassengerUploadBufferDir
  AllowOverride all
  Options -MultiViews
</Directory>