Caching on wordpress

A while ago when I tried to stress-test my site on Load Impact, my web server actually couldn’t handle the traffic and hung in the middle of the test… Recently I installed this wordpress plugin called Quick Cache (Speed Without Compromise) and I noticed a huge difference in page response time. Installation was a piece of cake. Then I ran the stress test again from Load Impact. The result is very satisfying. The green line is the number of active client. The blue line is the user load time. From the chart, it shows that the average load time is constant even when the # of active clients increases. Amazing! ...

October 21, 2012 · 1 min · birdchan

DNS flush

Sometimes you may need to do a DNS flush, say after a mysterious DNS network issue. Here are the commands. Mountain Lion / Lion sudo killall -HUP mDNSResponder Leopard sudo dscacheutil -flushcache Tiger lookupd -flushcache Windows ipconfig /flushdns Run a nslookup or ping to check if you are indeed getting the correct IP(s) from the DNS server(s).

October 16, 2012 · 1 min · birdchan

OSX Mail too slow?

I notice the Mail application on my Mountain Lion has been running slower and slower. Lately, it’s so slow that the spinning wheel comes out and stays for a while from time to time. It turns out there is a way to speed up Mail. It’s to rebuild the email database. Just go to the Mail menu and click Mailbox, then click Rebuild. Then I suggest you go take a walk. There is really no spinning wheel of any sort to notify you what’s going on, in fact you may not even notice if anything is happening in the background. But from my experience, after you come back, Ctrl-Q your Mail application. Then open it up again, Mail will start indexing your emails. After a while depending on your mailbox size, your mailbox will be a lot faster than before. ...

October 13, 2012 · 1 min · birdchan

Refresh qtip content

qtip2 is very handy to show/hide additional information on websites. The qtip content is by default cached to minimize unnecessary fetching. However though, sometimes it’s desirable to fetch for new content every time the tooltip comes up. In that case, use the once : false attribute to force re-fetching of new content. $('#my_dom_element').qtip({ content: { text: 'loading...', ajax: { url: 'my_content.php', once: false // need to re-fetch every time }, title: { text: 'My title', button: true } }, position: { at: 'left center', // Position the tooltip above the link my: 'right bottom', viewport: $(window), // Keep the tooltip on-screen at all times effect: false // Disable positioning animation }, show: { event: 'mouseenter', solo: true // Only show one tooltip at a time }, hide: 'unfocus', style: { classes: 'ui-tooltip-wiki ui-tooltip-light ui-tooltip-shadow', width: '800px' } });

October 9, 2012 · 1 min · birdchan

ATV焦點2012-09-03

[youtube &w=640&h=360] 是非顛倒,可恥可恥

October 8, 2012 · 1 min · birdchan

不要這麼快下結論,因為你不知道別人正在面對什麼

一位醫生在接到緊急手術的電話之後,以最快的速度趕到醫院,並用最快的速度換上手術服。 當他朝手術室走來時,焦急萬分的男孩的父親失控地對他喊道:「你怎麼這麼晚才來?你難道不知道我兒子的生命正處在危險中嗎?你難道一點責任心都沒有嗎?」 醫生淡然地笑著說:「很抱歉,剛剛我不在醫院。但我一接到電話就以最快的速度趕來了。現在,我希望您能冷靜一下。這樣我也好去做我的工作。」 「冷靜?如果手術室裡是你的兒子,你能冷靜嗎?如果現在你兒子死了,你會怎樣?」男孩的父親憤怒地說。 醫生又淡然地笑了,回答道:「我將會默誦聖經上的一句話:‘我們從塵土中來,也都歸於塵土,祝福是主的名字。‘醫生不能延長生命,我們只是在神的恩典下盡力而為,請為你的兒子祈禱吧。」 「當人漠不關心時才會給出如此輕巧的建議。」男孩的父親嘀咕道。 幾個小時後,手術順利完成,醫生高興地走出來,對男孩的父親說:「謝天謝地,你的兒子得救了!」 然而,還沒有等到男孩的父親答話,他便匆匆離去了,並說:「如果有問題,你可以問護士!」 「他怎麼如此傲慢?連我問問兒子的情況這幾分鐘的時間他都等不了嗎?」父親對護士忿忿不平地說道。 護士的眼淚一下子就流出來了。「他的兒子昨天在一次交通事故中死了。當我們叫他來為你兒子做手術的時候,他正在去墓地的路上。現在,他救活了你兒子,要趕去完成他兒子的葬禮。」 有時候不要這麼快下結論,因為你不知道別人正在面對什麼! Ref link: http://ibook.idv.tw/enews/enews721-750/enews735.html

September 16, 2012 · 1 min · birdchan

What job are you suited for?

I did become an engineer, haha.

September 14, 2012 · 1 min · birdchan

Highcharts pie charts can have url links

For some reasons the default highcharts pie chart has no url links. Or at least that feature is not being demo’ed. See their example here: http://www.highcharts.com/demo/pie-basic. After tweaking the code for a while, here is the code that enables URL links in a pie chart. var chart; $(document).ready(function() { chart = new Highcharts.Chart({ chart: { renderTo: 'my_chart_id', plotBackgroundColor: null, plotBorderWidth: null, plotShadow: false }, title: { text: 'my_title' }, tooltip: { formatter: function() { var y = this.y; var p = Math.round(this.percentage*100)/100; return ''+ this.point.name +': ' + y + ' (' + p + '%)'; } }, plotOptions: { pie: { allowPointSelect: true, cursor: 'pointer', dataLabels: { enabled: false }, showInLegend: true } }, series: [{ type: 'pie', name: 'overall', point: { events: { click: function(e) { //this.slice(); //console.log(e); location.href = e.point.url; e.preventDefault(); } } }, data: [ {name: 'Not Tested', color: '#FFA850', y: 87, url: 'http://my_site1.com'}, {name: 'Fail', color: '#FF2929', y: 2, url: 'http://my_site2.com'}, {name: 'Pass', color: '#31FF4F', y: 32, url: 'http://my_site3.com'} ] }] }); }); The part that enables the clicking is the new url key in data, and the event handling. ...

September 8, 2012 · 2 min · birdchan

Comcast Internet service only $62.95 a month?

I have signed up for Comcast’s bundle deal for TV and internet a few months ago. After a while I cancelled the TV service. I wasn’t really paying much attention to my bills until today I checked, Comcast is charging me $62.95 for internet service only? Really? Why??? I have done some research and all I can say is the pricing info is very unclear, not until you get your bill. ...

September 7, 2012 · 1 min · birdchan

年少無知

[youtube &w=640&h=360] 年少無知 電視劇【天與地】片尾曲 主唱:林保怡.陳豪.黃德斌 作曲:黃貫中 填詞:林若寧 編曲:黃貫中.劉志遠 監製:黃貫中 歌詞 林:年少多好 頑劣多好 不甘安於封建制度裡迷信上街真理會達到 旗幟高舉 群眾聲討 不惜犧牲一切去上訴權貴的想法太俗套 只可惜生活是一堆挫折 只可惜生命是必須妥協 陳:年少多好 貧困多好 一蚊積蓄足以快樂到廉價結他抒發我暴躁 財富得到 年歲不保 捐輸不必講究有回報人世間總會有異數 只可惜生活是一聲發洩只可惜生命是一聲抱歉怕追討 合:如果命運能選擇十字街口你我踏出的每步更瀟灑 如果活著能坦白舊日所相信價值不必接受時代的糟蹋 黃:年少多好 朋友多好 一番爭執不會有被告遊戲競爭不會記入腦 年歲增長 無法修補 青春的詩總會老 時間多恐怖 合:如果命運能選擇十字街口你我踏出的每步無用困惑 如果活著能坦白舊日所相信價值今天發現還未老 如果命運能演習現實中不致接納一生每步殘酷抉擇 留守過去的想法我會否好像這樣生於世上無目的鞭撻

September 3, 2012 · 1 min · birdchan