2009年9月23日 星期三

JQuery : Browser Detection and Version

Demo : http://ads.sina.com.hk/demo/200909/browser_detection.html



var userAgent = navigator.userAgent.toLowerCase();

// Figure out what browser is being used
jQuery.browser = {
version: (userAgent.match( /.+(?:rv|it|ra|ie|me)[\/: ]([\d.]+)/ ) || [])[1],
chrome: /chrome/.test( userAgent ),
safari: /webkit/.test( userAgent ) && !/chrome/.test( userAgent ),
opera: /opera/.test( userAgent ),
msie: /msie/.test( userAgent ) && !/opera/.test( userAgent ),
mozilla: /mozilla/.test( userAgent ) && !/(compatible|webkit)/.test( userAgent )
};

var is_chrome = /chrome/.test( navigator.userAgent.toLowerCase() );

$(document).ready(function(){
$.each($.browser, function(i, val) {
$("
" + i + " : " + val + "
")
.appendTo(document.body);
});
});

2009年9月21日 星期一

Book : Website Optimization (O'Reilly)


By Andrew B. King
O'Reilly Media, $39.99
Pages: 367
ISBN: 0596515081 order from Amazon.com
ISBN 13: 9780596515089 Order from O'Reilly
Due: July 16, 2008





With Website Optimization Secrets you'll learn the secrets of website success, including:

a) Search engine optimization best practices
b) Pay-per-click optimization techniques
c) Real world case studies
d) How to optimize your conversion rates
e) Web page optimization tips
f) CSS optimization tricks including CSS sprites, drop down menus, and CSS shorthand
g) Ajax optimization techniques that clean your code and improve robustness
h) Advanced web tuning techniques, including HTTP compression, caching, and URI rewriting
i) Website optimization metrics to measure and progressively improve success metrics

2009年9月20日 星期日

CSS : background repeat-x


http://ads.sina.com.hk/images/ads_menu1.gif) bottom repeat-x; padding:4px;">Full Page Crazy Ad
+ Large Rectangular

2009年9月19日 星期六

Career

創新科技署 http://www.itc.gov.hk/ch/about/recruitment.htm
政府資訊科技總監辦公室 http://www.ogcio.gov.hk/chi/jobvac/cjobvac.htm
土地註冊處 http://www.landreg.gov.hk/tc/vacancy/vacancy.htm
知識產權署 http://www.ipd.gov.hk/chi/about_us/employment.htm
政府統計處 http://www.censtatd.gov.hk/about_us/vacancies_and_career_opportunities/index_tc.jsp
康樂及文化事務署 http://www.lcsd.gov.hk/b5/jobs.php

廉政公署 http://www.icac.org.hk/tc/career_in_icac/jv/index.html
電訊管理局 http://www.ofta.gov.hk/zh/vacancy/main.html
審計署 http://www.aud.gov.hk/chi/recruitment/recruit.htm
學生資助辦事處 http://www.sfaa.gov.hk/tc/job/index.htm
環境保護署 http://www.epd.gov.hk/epd/tc_chi/business_job/job_opp/vacancies.html
衛生署 http://www.dh.gov.hk/tc_chi/vacancies/vacancies.html
司法機構 http://www.judiciary.gov.hk/tc/other_info/recruit_ad.htm
市區重建局 http://www.ura.org.hk/html/c1012000t1e.html
申訴專員公署 http://www.ombudsman.gov.hk/tc/recruitment.html
地產代理監管局 http://www.eaa.org.hk/ch_jobvacancies.htm
西九文化區管理局 http://www.wkcdauthority.hk/tc/job/jobOpp.htm
投訴警方獨立監察委員會 http://www.ipcc.gov.hk/tc/job.html
建造業工人註冊管理局 http://www.cwra.org.hk/JobVacancies/crecruit.asp
香港互聯網註冊管理有限公司 https://www.hkirc.hk/company_info/vacancy.jsp?lang=zho
香港生產力促進局 http://www.hkpc.org/html/eng/job_vacancies/job_vacancy.jsp
香港交易所 http://www.hkex.com.hk/exchange/job/job.htm

香港考試及評核局 http://www.hkeaa.edu.hk/tc/career/
香港房屋協會 http://www.hkhs.com/chi/gm/recruit.asp
香港金融管理局 http://www.info.gov.hk/hkma/chi/careers/recruitment_index.htm
香港按揭證券有限公司 http://www.hkmc.com.hk/eng/ahr/thecompany/vacancy.html
香港科技園公司 http://www.hkstp.org/HKSTPC/job.jsp?lan=en&typeId=JT_01&mode=html
香港個人資料私隱專員公署 http://www.pcpd.org.hk/chinese/about/jobvacan.html
香港旅遊發展局 http://partnernet.hktb.com/pnweb/jsp/comm/index.jsp?charset=en&pageContent=/jsp/hr/recruit_list.jsp
香港學術及職業資歷評審局 http://www.hkcaavq.edu.hk/zh/about_recruit.asp
香港應用科技研究院 http://www.astri.org/en/career.php
香港藝術中心 http://www.hkac.org.hk/hkac_vacancy_en.php
香港藝術發展局 http://www.hkadc.org.hk/tc/content/web.do?page=career
香港體育學院 http://www.hksi.org.hk/hksdb/html/big5/index.jsp?pagename=c_co1_hksdbco2.html
消費者委員會 http://www2.consumer.org.hk/cc_data/admin/recruit.nsf/Frame01?OpenFrameSet
港鐵公司 https://www.mtr.com.hk/eng/career/hrms/job_display.php3
僱員再培訓局 http://www.erb.org/Corp/home/hrjob_list/zh_TW/
職業安全健康局 http://www.oshc.org.hk/tchi/about_us/career.asp
職業訓練局 http://www.vtc.edu.hk/vtc/web/template/job.jsp?fldr_id=382
醫院管理局 http://www.ha.org.hk/visitor/ha_visitor_index.asp?content_id=2010&Page=ha_browse_act_jv&lang=ENG
證券及期貨事務監察委員會 http://www.sfc.hk/sfc/html/EN/aboutsfc/employment/employment.html

2009年9月12日 星期六

Typing : typingweb.com

http://www.typingweb.com/tutor/

2009年9月10日 星期四

JavaScript: screen resolution and window width

A) Screen Resolution:

if(screen.width>1279)
{

}


B) Window Width:

document.body.clientWidth

JavaScript: Regular Expression on Domains (2 methods)

Method 1:

//-- section = 0 : index+sub-index, 1 : content --//
var section="0";
var str = document.location.href;

var url_pattern=new Array(
"^news.sina.com.hk$",
"^news.sina.com.hk/$",
"^news.sina.com.hk/index.html$",
"^/cgi-bin/nw/realtime.cgi$",
"^/cgi-bin/nw/main.cgi[?]cat=2$",
"^/cgi-bin/nw/main.cgi[?]cat=19$",
"^/cgi-bin/nw/international.cgi$",
"^/cgi-bin/nw/china.cgi$",
"^/cgi-bin/nw/main.cgi[?]cat=15$",
"^/cgi-bin/nw/main.cgi[?]cat=22$",
"^/cgi-bin/nw/main.cgi[?]cat=23$",
"^/cgi-bin/vote/index.cgi$",
"^/cgi-bin/nw/special.cgi$"
);

for(var i=0; i{
if(new RegExp(url_pattern[i]).test(str))
{
section="0";
}
else
{
section="1";
}
}

if(section=="0") {
alert("index");
}
else {
alert("content");
}



Method 2:

var as_section='ros'; //all page are ros except match the following
var as_curr_url = document.location.href;
as_curr_url= as_curr_url.replace(RegExp("^http://"+location.hostname), '');

var as_exact_match = new Array(
"/",
"/index.html",
"/cgi-bin/nw/realtime.cgi",
"/cgi-bin/nw/main.cgi?cat=2",
"/cgi-bin/nw/main.cgi?cat=19",
"/cgi-bin/nw/international.cgi",
"/cgi-bin/nw/china.cgi",
"/cgi-bin/nw/main.cgi?cat=15",
"/cgi-bin/nw/main.cgi?cat=22",
"/cgi-bin/nw/main.cgi?cat=23",
"/cgi-bin/vote/index.cgi",
"/cgi-bin/nw/special.cgi"
);

var as_pattern = new Array(
//"/test/regex.html$"
);

for ( var i = 0; i < as_exact_match.length; i++) {
if (as_exact_match[i] == as_curr_url) {
as_section='index'; break;
}
}

if (as_section == "ros"){
for ( var i = 0; i < as_pattern.length; i++) {
if (as_curr_url.match(as_pattern[i])) {
as_section='index'; break;
}
}
}

if(as_section == 'index'){
alert("index");
}else {
alert("content");
}

JavaScript: detect browser width and align layer to center

Equation:

var x = (document.body.clientWidth/2) - 364;

P.S. Banner Width (728)/ 2 = 364

Demo: http://ads.sina.com.hk/demo/200909/sample20090909_ET_exBanner4.html

2009年9月8日 星期二

神話賣家:天價難以置信 (2009-09-08)

URL : http://news.sina.com.hk/cgi-bin/nw/show.cgi/2/1/1/1257419/1.html

醉心慈善事業的鄭兆財表示,今次賣鋪做好遺囑,為三名子女打算,右為女兒鄭麗。

(綜合報道)(星島日報報道)一名低調老牌家族業主,日前沽出銅鑼灣自用老鋪址,作價一億六千萬元,三十八年間勁賺,升幅逾四百五十六倍,締造物業升值神話,昨日神話主角現身了,八十九歲的業主「鄭伯」鄭兆財,半世紀以來看着白沙道蛻變,他直言:「我覺得天價,老實說,真的難以相信這個價錢!」

鄭伯表示,當他簽署售出銅鑼灣白沙道十三號鋪位後,另有一家代理來電,說有客戶願意追價一億九千萬元,「我並不心動,老實說,我覺得這已是天價,從來沒想過以這價錢賣鋪。」他謙稱:「我的知識不豐富,但總算有人生閱歷,現時內地來了許多資金,銀行息口低,但只要加息,物業價格恐怕掉頭回落!」

他又說,該鋪位早於一九六五年承租下來,每月九百元租金,經營毛冷店及百貨公司,一九七一年業主話賣鋪,開價三十五萬元,由於志在必得,他沒還價,立即拍板,已故太太梁梅更在此地投入許多心血,本來很不捨得,但自從去年他自己大病一場,高燒不退,心想赴黃泉見太太。「不料,有中醫朋友為我檢回老命,之後,我決心要處理遺囑,才決定賣鋪。」

他續說,生意會繼續下去,毗鄰現鋪址的白沙道十五號一樓,面積一千七百方呎,毛冷店明年五月遷往該處,「那是我們舊居,近年則當貨倉儲存毛冷。」那是白沙道與恩平道單邊物業,他岳父於一九五四年以十一萬購下。

鄭家曾是典型白手興家新移民,他於一九二一年生於江蘇漣水,受過抗戰洗禮,據鄭伯引述,一九四八年攜同太太子女來港,住九龍青福華村板間房,他在工地打工,太太在家賣小食,一九五一年,工地老闆嚴雲龍及丁福明幫助他,借出五千元給他創業,承租銅鑼灣軒尼詩道五一九號經營機織冷衫公司,一九六○年擴充店面發展成巴黎百貨,一九六二年在旺角彌敦道六二八號開設分店,「當年除了機織毛衣外,還聘來上海師傳做西裝銷售到歐洲去,並售賣皮鞋毛巾等等用品。試過最旺星期日,一天營業額達二十萬元!」鄭伯回憶道。

發迹後,鄭家於九龍寶靈街及美國加州置業,並熱衷慈善事業,他最遺憾的事,是太太梁梅於八一年因食道癌病故,終年僅五十七歲,為一圓亡妻回鄉建校心願,他多年來於漣水創辦幼兒院、小學及高中,女兒鄭麗透露:「爸爸熱衷買股票,於九七年間手上二千多萬元,輸剩幾百萬元,為繼續完成學校建設,被逼賣掉加州的物業。」

鄭伯與子女也經常風塵僕僕回鄉,鄭麗續說:「因為父親要看着每筆資金到位,用得妥當,慈善事業設立委員會參與,恍如香港保良局,即使他百年歸老,仍會運作下去,過去十年捐款一億三千萬元!」

是次賣鋪所得,會如何安排?鄭麗回說不知道。老伯則幽幽地向記者透露道:「是次要顧及我的三個孩子!」

2009年9月6日 星期日

Book : Foundation XML and E4X for Flash and Flex

URL : http://www.friendsofed.com/book.html?isbn=9781430216346
http://www.friendsofed.com/download.html?isbn=1430216344



Published: 12th January 2009
ISBN-10: 1-4302-1634-4
ISBN-13: 978-1-4302-1634-6

2009年9月3日 星期四

Flash Caching - use FlashVars to pass values

Don't pass parameters to flash by query string, change it as follows.

Passing parameters by query string will made the flash not cachable. Here's an sample:
Please change from

<param name="movie" value="a.swf?s=#NAV#">

to

<param name="movie" value="a.swf" >
<PARAM NAME=FlashVars VALUE="s=#NAV#" >