Tag Archives: Postaday2011

Javascript – Convert Number to String and Vice Versa

Convert String to Number using parseFloat() or parseInt()

/* parseFloat() */
parseFloat('1.45kg')  // 1.45
parseFloat('77.3')    // 77.3
parseFloat('077.3')   // 77.3
parseFloat('0x77.3')  // 0
parseFloat('.3')      // 0.3
parseFloat('0.1e6')   // 100000

/* parseInt() */
parseInt('123.45')  // 123
parseInt('77')      // 77
parseInt('077',10)  // 77
parseInt('77',8)    // 63  (= 7 + 7*8)
parseInt('077')     // 63  (= 7 + 7*8)
parseInt('77',16)   // 119 (= 7 + 7*16)
parseInt('0x77')    // 119 (= 7 + 7*16)
parseInt('099')     // 0 (9 is not an octal digit)
parseInt('99',8)    // 0 or NaN, depending on the platform
parseInt('0.1e6')   // 0
parseInt('ZZ',36)   // 1295 (= 35 + 35*36)

Continue reading Javascript – Convert Number to String and Vice Versa

SVN Migration

I am going to close the server at my home so i need to move all the stuff to the new server which is a Virtual Private Server (VPS).

The most important stuff is the Subversion repository. Luckily i found a very good post about migrating a SVN repository in just a few steps – How to migrate SVN repository?.

Let’s assume the repository is called eureka and the Subversion group in the server is svn. Continue reading SVN Migration

Rails – Stop the Rails Web Server by Command

The following command could start the Rails daemon server for you Rails web application.

  • rails s

 

Stopping the web server could be done by simply enter the Ctrl + C command in the terminal. But if your terminal session is disconnected, you have no way to stop the service. In that case, you have to kill the process directly. Continue reading Rails – Stop the Rails Web Server by Command

姜文 – 世界本來就很荒誕

沒試過跟導演訪談如斯「隆重其事」,宣傳公司很早以前跟我們定好時間,訪問前幾天仍不住提點,其中一個提示是姜文說話素來精簡,先別期望他滔滔不絕。訪問當天,導演出場以前,他隨行的助手、監製已為他打點好一切,甚至跟我們的攝影師仔細談好(只在訪問首十分鐘拍攝)。然後導演進場,身形高大,喝著茶,把玩著手上的iPhone,左顧右盼,充滿自信,說話從容不迫。姜文與隨行幾名工作人員,都聚集到四季酒店高層一個無敵海景的會議室內,訪問於是在很多人盯著下開始。還幸一切順利,雖然比預期的時間少了。

如此派場也難怪,幾天前,《讓子彈飛》在國內已經衝破6億元票房數字。姜文由演員出身,廿來歲已演出了《芙蓉鎮》、《紅高粱》等經典電影,他屢次獲獎,也見證了第五代導演的崛起。90年代他演而優則導,至今拍了四部長片,首兩部片奪得多個影展大獎,包括2000年《鬼子來了》的康城評審團大獎。

他前三部影片的藝術味道較濃,即使主演的《尋槍》、《綠茶》或《一個陌生女人的來信》也傾向小眾口味。今天他編導演的《讓子彈飛》,則讓他由第六代導演搖身一變成為中國影壇的大腕。《讓子彈飛》除了票房報捷,也掀起網上及媒體的熱烈討論,很多人說裏面含有今天中國的縮影;說影片嚮往革命,批評地方官吏的巧取豪奪。這些,聰明的姜文固然都三緘其口。然無論如何,姜文的離經叛道、玩世不恭的作風還是繼往開來,這使《讓子彈飛》在過去幾年來一眾億元大片中,觀照出不一樣的世界。

數今天中國電影的風雲人物,非姜文莫屬了。 Continue reading 姜文 – 世界本來就很荒誕