Apache Ant – Get the current running Ant version in Ant script

I am trying to figure out which Apache Ant version is running on the Jenkins server. Starting from Apache Ant 1.7.0, you can make use of the <Antversion> task to determine the running Ant version. The following is a simple build.xml which could serve this purpose.

<project name="ant-antversion-example" default="run" basedir=".">
  <target name="run">
    <echo message="Checking ANT version ..."/>
    <antversion property="antversion"/>
    <echo message="  version: ${antversion}"/>
  </target>
</project>

 

Try it out. Continue reading Apache Ant – Get the current running Ant version in Ant script

陶傑 – 車毀人亡

特區十六年,越混下去,越令人覺得英治之優越。

人家從來不必普選,香港市民管得服服貼貼。總督每一任空降,來到香港,不必有朋友,沒有人情關係網。

由邵逸夫、包玉剛,到小廠家和餐廳東主,英國人給你在歐洲和非洲的殖民地開拓市場,只要你苦幹,做生意的環境一定合理公正,商家沒有一個對英國人的政府有怨言。

除了香港的左派,「文革」時奉命暴動了一陣──其實他們心裏也眷戀着這片沒有赤化的安樂鄉──香港歌舞昇平,即使遇上國際的石油危機、環球衰退,英女皇的徽像,是誠信的品牌,跟着港督會同行政局,人人悅服。

只有大陸不斷給香港添煩加負擔,英國人無負於這個遠東的小島。譬如,香港滿山滿坑的木屋,是一九四九年之後才湧現的──大陸赤化,急湧來一百萬難民;一九六二年,大饑荒又翻山湧過來幾十萬。
Continue reading 陶傑 – 車毀人亡

Apache Ant – Check if a string property contains a certain string

The following example which check if a string property contains a another string.

<project name="ant-string-contains-example" default="run" basedir=".">
  <target name="run">
    <property name="greeting" value="Hello World!"/>
    <condition property="hasWorld">
      <matches pattern="World" string="${greeting}"/>
    </condition>
    <fail message="No world in the greeting!" unless="hasWorld"/>
    <!-- Move on if no failture -->
    <echo message="Passed!"/>
  </target>
</project>

 

Done =)

Reference: StackOverflow – Ant: how to fail if property contains a certain string

PowerShell – Get command path like the “which” command in Linux

I have installed Sublime Text 3 with the Git package but it keeps prompting Git command not found in the PATH variable. Before i update the PATH, i have to figure out where is my Git command.

In Linux, we can get the path of a specific command by which [comamnd].
ex. ~$ which git
powershell-which-1
Continue reading PowerShell – Get command path like the “which” command in Linux

陶傑 – 埋地雷

香港人口要增長到幾多?每天一百五十名新移民,無審批權無限期,香港十六年來,移民人口多了八十萬。

最近大暴亂的埃及,一九七三年,人口為二千八百萬,四十年後的今日,人口為八千二百萬,淨增兩倍。

埃及四十年前還出口稻米,今日,八成人口的食米,要靠入口。人口越多越窮,資源擠壓越蹙,越窮也就越見鬼,於是就爆發茉莉花革命。香港的梁班子,聲稱香港人口無上限,是想香港,像四十年前本來還有一點富庶的今日埃及,引發暴亂吧?梁班子說:新移民越多越好,因為香港人口老化,新移民來了,比香港人更樂意放開肚皮生,香港人口就會年輕化一點。

人口平均再年輕,普遍沒有得撈,或不願工作,年輕力壯起來四出暴亂,砸起金鋪的窗子時,「人口老化」的阿伯搬石頭手顫顫的砸十下子,玻璃還不碎。「年輕化」之後,年富力強,砸一下,玻璃窗就像瀑布一樣崩塌,名貴手錶和珠寶,任年輕人掃貨自由行。埃及也一樣。今日一半人口,平均年齡二十歲不到,貧窮、失業,而且不明白為何他們的統治者如此無能,這就是暴亂的溫牀。中國聲稱,英國特務滲入香港特府。特府誰是英特呢?以埃及人口高速增長、人口平均年輕化為藍本,一面投大陸所好,拚命收納新移民,任由特區消費型經濟泡沫下去的,當然就是特務了。讓香港平均年輕的人口,繼續怨氣政府,他們也不明白,「港英」在時,一切都好,換了「振英」,也都不明白為何如此無能。埃及的今日,很快就是香港特區的明天了。
Continue reading 陶傑 – 埋地雷

Dream BIG and go for it =)