HTML – Include .html using jQuery

There are some methods like Server Side Includes which allow us to include other HTML files into a web page on a webserver like

<!-- #include virtual="./common.html" -->

But this technique require server side setting and may be not supported by some web hosting.

Another way to include .html in a web page is using jQuery insertion.
Continue reading HTML – Include .html using jQuery

Font/Text distortion on animate() and opacity in Internet Explorer

I have a HTML div which will be shown from hidden to visible by changing the opacity with jQuery animate(). It works fine in normal browser like Chrome and Firefox. But from the abnormal browser like Internet Explorer, the font/text is distorted.

Internet Explorer has problem with opacity and font antialiasing in animate(). A workaround is to remove the opacity after the animation is completed.

$("#my-div").animate({opacity: 1},500, function() {
  $(this).css('opacity', '');
});

Continue reading Font/Text distortion on animate() and opacity in Internet Explorer

晏嬰論和諧

此文節綠於秦戈編著的《用謀》

 
一次,晏嬰陪同齊景公去巡遊。沒過一會,梁丘據駕著六匹馬拉的車子飛奔而來。

景公問:「是誰來了?」

晏嬰說:「是梁丘據。」

景公問:「你沒有看見人,怎麼會知道呢?」

晏嬰說:「大熱天趕著馬車飛奔,重者馬死,輕者馬傷,不是梁丘據又有誰敢這麼做?(因梁丘據得寵於齊景公,他做什麼事齊景公都不會怪罪,所以才這麼說)」

景公說:「梁丘據與我最為默契和諧了。」

晏嬰說:「這只能說是相同,不能叫和諧,所謂和諧應當是君甜則臣酸,君淡則臣鹹,互有補償,以求完美。梁丘據是君甘亦甘,一味奉承,以順為正,怎能稱得上和諧呢?

景公覺得晏嬰是故意在找自己的麻煩,氣得臉色大變。

 
一語道破現在社會對和諧的誤解,讚!

用謀

作者: 秦戈

全書分為四篇,以帝王臣相后妃宦官人物的故事去透視中國封建帝制陰謀政治

若果換另一個角度,把此書作為歷史故事亦不減趣味。

越看得多就越覺得中國即使有二千多年歷史,但在民智與制度上面從未有進步過,特別是讀到宦官的那篇,便會想到很多擁有做太監潛質的議員和政府官員。哈哈,可惜他們不是活在過往的封建時代,否則他們一定可以撈到更多油水。

當然儒家歷史上還有很多出色的賢明之人,特別深刻的是晏嬰齊景公的故事。可惜的是這些人一直都未能換醒中國人的心靈。其中儒家中國社會上有最大的影響力,但可惜的是當時沒有普及教育,加上大部份可以接觸到的人都是知其一而不知其二,反而深陷在君臣倫理之中,知小仁而不知大仁,使到這封建制度更穩如泰山。

陶傑 – 愛國感情評估

「國民教育」最爆笑的地方,推梁特府「建議」,學生的「愛國」,學校要「作出感情評估」。

其中包括看見「母親黃河」,學生會不會「感動」。

為什麼要認「黃河」做「母親」?據說黃河為中華民族提供了孕育的奶汁。但香港人絕大多數是粵人,廣東離黃河十萬八千里。勉強非要認一條河來做「母親」,可以是東江、西江。香港人是喝珠江的東西江水大的,但珠江這個「母親」,沒有免費哺乳,香港人要交水費,世上哪有母親向嬰孩餵奶,還收錢的呀?所以,即使「母親」是珠江,這種母乳,且不說有工業污染,你喝着喝着,還是毫不感動。
Continue reading 陶傑 – 愛國感情評估

HTML5 Doctype

In HTML5, you can just use the following Doctype before the <html> tag.

<!DOCTYPE html>

Quote from W3Schools

The declaration must be the very first thing in your HTML5 document, before the tag.

The declaration is not an HTML tag; it is an instruction to the web browser about what version of HTML the page is written in.

In HTML 4.01, all declarations require a reference to a DTD, because HTML 4.01 was based on SGML.

HTML5 is not based on SGML, and therefore does not require a reference to a DTD.

Continue reading HTML5 Doctype

陶傑 – 甘地絕食

當代的絕食之父,當然是印度聖雄甘地了。

絕食絕不是什麼「激進」的抗爭,這是沒有見識的香港特區庸官的愚見。邏輯很簡單:如果絕食是「激進手段」,甘地就是「恐怖份子」了。國際定義,絕食是非暴力抗爭的一種方式(A method of non-violent resistance),非暴力,就等同「激進」?可見特區的什麼班子是什麼水準。

甘地一生絕食過許多次,早年是抗議英國殖民統治,最長絕食了二十一天,英國人把他關在監牢,甘地照樣絕食。最後的一次,是印度獨立前夕,印度教徒和伊斯蘭教徒自相殘殺,為了呼籲團結,甘地七十歲老人家,再絕食一次,感動了全民。

絕食抗爭,不一定成功,要看對象。甘地絕食很有效,因為他的敵人是英國。英國是耶教國家,十九世紀初廢除了黑奴制,知識份子的自由黨當政,二十世紀初,婦女又爭得了投票權。
Continue reading 陶傑 – 甘地絕食

Drupal 7 – Get the prev and next node ID using Previous/Next API

For developers, the Flippy module which i mentioned might be not flexible enough.
Drupal 7 – Display Previous and Next node links on node view using Flippy module

Then you could consider another module called Previous/Next API. With this module, you can add the previous and next node links in any preprocess functions, template.php or module files using the API functions provided by this module.

Another advantage is that it caches all the links in its own database table which could speed up the query and this also reduces the database loading. Let’s see how this module work.
Continue reading Drupal 7 – Get the prev and next node ID using Previous/Next API

Dream BIG and go for it =)