Author Archives: Ying Kit Yuen

About Ying Kit Yuen

Life is for fun~ =)

Python – Connect to MSSQL server using pymssql package

1. Install the pymssql package.

pip install pymssql

 

2. Create the your .py file.
test_mssql.py

import pymssql
conn = pymssql.connect(host='<host>', user='<username>', password='<password>', database='<dbname>')
cur = conn.cursor()

cur.execute('SELECT CONVERT(date, CURRENT_TIMESTAMP)')
row = cur.fetchone()
while row:
  print "CURRENT_TIMESTAMP=%s" % (row[0])
  row = cur.fetchone()

conn.close()

Continue reading

Tig – Git interface on command line

It’s not easy to view the Git log in command line but most of the time is the most straight forward way or sometimes, the only way you could view the Git commit history.

Tig is a ncurses-based interface to view your Git repository.

Installation on OS X using Homebrew:

brew install tig

 

Installation on Ubuntu:

apt-get install tig

Continue reading

mdpress – Present your markdown file in slideshow

I have been using reveal.js to create slideshow from markdown. It’s very nice and powerful. But the setup is a bit complicated. Sometimes i want to have a more simple solution.

Other than reveal.js, impress.js is a similar tool which allows you to present your ideas in a even more fancy way. I am not going to go into details of impress.js. Instead, i would introduce a tool called Mdpress which generate the .html presentation from markdown.

1. Install the Mdpress.

gem install mdpress

Continue reading

陶傑 – 天寒說佛

大陸北京毒霧鎖天,居民在街上戴防毒面具。洋人憂慮子女健康,陸續回國。

兩年前美國駐北京領事館每日發佈北京的污染數據,一片好意,但遭到中國政府辱罵為「干涉內政」,現在,北京一片灰霾。

美國駐華大使駱家輝便服親民,中國也大罵,指為做秀挑撥,現在,中國的總書記模仿,去北京吃包子,這又不是「做秀」了。

一個民族缺乏基本的理智和邏輯,卻又迷信「GDP壓倒一切」,道德信仰,又被他們膜拜的真神毛澤東摧毀淨盡,這下子,可精采了──說是精采,因為大陸是不可以批評的,一批評,即是「偏激」,你便是那十四億人民的敵人了。
Continue reading

陶傑 – 夏志清與錢鍾書

夏志清逝世,民國時代剩下的一廟殘燈,又滅了一盞。

夏志清不但推崇張愛玲,還心儀錢鍾書,尤其錢鍾書的小說,連同張愛玲,夏志清認為比魯迅好。

在七十年代,因為毛澤東和共產黨將魯迅尊為文學的穆罕默德,說魯迅的小說很一般,甚而推許所謂「漢奸」張愛玲,對於那時的中國人,好像端了一塊肥豬肉進阿富汗塔利班的清真寺裏供奉膜拜,加上夏志清的反共,夏志清被左仔文人攻擊為「學閥」。

夏志清比錢鍾書晚半輩,一九四四年,夏志清在宋淇家裏初見錢鍾書,覺得在盛年的錢鍾書,有周瑜的氣質,雄姿英發,羽扇綸巾,因為年少得志,有孤傲倜儻之氣。

錢鍾書問夏志清,最近讀了什麼書。夏志清說他讀了古希臘史詩,錢問夏志清喜歡哪一部。
Continue reading

永遠の0

作者: 百田尚樹

譯者: 王蘊潔 (我看的這個中文譯本譯得非常好,超讚!)

震撼人心的一部小說… 一部關於二戰時期美日兩軍戰爭的小說…

未看過的可能會懷疑這是一部美化日軍係二戰時所犯罪行的小說,我不能判斷書中所描述的有多真實,但我相信有很多在前線作戰的士兵都不是戰爭狂熱份子,佢地只不過是後方策動與指揮戰爭的棋子。最大的錯誤係佢地無去反抗外在環境所附於佢地身上的壓力,盲目遵循,造成生靈塗炭。

作者用文字告訴世人戰爭的可怕,我不敢想象戰爭親身在戰場時那種壓力。另一方面我認為作者給世人帶出了一份非常重要的信息,那就是要有否定甚至對抗那大圍意識形態的勇氣,堅持自己的信念。

artwrok

AngularJS directives of Foundation

We got the Foundation 5 with Sass styling working on our AngularJS project which was scaffolded by Yeoman.

 

Let’s continue our ng-foundation example above.

To utilize the Foundation framework in a more effective way, the Mad Mimi team creates some native AngularJS directives based on Foundation‘s markup and CSS which is available on Bower.

Continue reading

Yeoman – Setup AngularJS and Foundation 5 with Sass

The generator-angular written by the Yeoman team comes with Bootstrap integration. But instead of using Bootstrap, i would like to use Foundation 5 with Sass. The following example is created under Node.js v0.10.29.

1. Create your project directory. In my case, i will name the project ng-foundation.

mkdir ng-foundation

 

2. Move to the ng-foundation folder.

cd ng-foundation

 

3. Scaffold the AngularJS project using the generator-angular as usual.

yo angular

Continue reading