Self CPR

Self-CPR [slideshare id=9533590&w=425&h=355&fb=0&mw=0&mh=0&sc=no] View more presentations from Brian Chan Self-CPR - Presentation Transcript 假設現在時刻是 17:50 ,忙忙碌碌的你上了一整天的班,正在 獨自 開車回家的路上! 你 感覺到非常緊張和不舒服 … 突然!你感到 胸口 有一股 劇痛 並且開始 漫延到手臂和下巴 可是,離最近的醫院大概還有一段路程 更糟糕的是路況很差 你自己都不知道能不能 撑 得了那麼遠 ? 怎麼辦 ??? 你以前是曾經受過 心肺復甦法 CPR 訓練 但老師並 没 教你 怎麼給自己做急救 ? 獨處時 , 心臟病發 作怎 樣 急救 ? 一个人若是心 臟 不能正常跳 動 , 並 且 開 始感到快要昏 過 去 時 ,他大概只有 10 秒 鐘 的 時間 ,然 後 就 會 失去知 覺 ,不省人事。若是四周没有旁人能帮忙急救,患者要立刻把握 這 10 秒 鐘 的短 暫黃金時間 自己救自己。 如何把握 10 秒鐘黃金時間 ??? ...

October 4, 2011 · 1 min · birdchan

check file size at the client side

To check the size of a file (before form submission), you can do it easily as follows: function validate_file(){ file_obj = document.getElementById('my_file').files[0]; if (typeof file_obj != 'undefined'){ if (file_obj.size > 2000000){ // 2Mb alert('file size is greater than 2Mb'); return false; } } return true; } If you really want to do something fancy, check out this site: http://www.html5rocks.com/en/tutorials/file/dndfiles/#toc-reading-files

October 4, 2011 · 1 min · birdchan

blob sizes

TINYBLOB 255 (2^8 - 1) characters. 255b BLOB 65535 (2^16 - 1) characters. 65Kb MEDIUMBLOB 16777215 (2^24 - 1) characters. 16Mb LONGBLOB 4294967295 (2^32 - 1) characters. 4Gb

October 4, 2011 · 1 min · birdchan

Stop event propagation

Sometimes it’s annoying when say a checkbox has multiple actions binded to it which you are not aware of. Some parent elements may affect their child elements, thus making debugging and implementation so hard and confusing. Well, one technique can be used is to stop the event propagation. Basically the idea is, once the child element receives the event, as usual perform the appropriate actions, then stop the event from going up the DOM tree, thus avoiding all kinds of unexpected side-effects. ...

September 29, 2011 · 1 min · birdchan

Mighty Mouse's scroll ball

My mighty mouse scroll ball was fine for a month, but until recently scrolling up won’t work. At first I thought I was a software issue, but after updating everything and restarting osx, the issue remains. If that happens to you, don’t trash your mouse yet. Do this. Try pressing down the ball hard, then roll the ball a little in that position. Now try and see if your scrolling comes back. This works for me. ...

September 28, 2011 · 1 min · birdchan

osx mysql not working after a reboot

First and foremost, I am using Lion and running all latest updates as of today. I restarted my desktop system over the weekend as a usual practice. Then this morning I realized my local website isn’t working. Further tracking leads to MySQL not starting successfully. You can see the red text in the MySQL System Preference. Clicking on “Start MySQL Server” won’t help. At this point, ask yourself if you are using my.cnf. Usually, you don’t have to. But if you ever need to do any customization, you probably have copied this file over to /etc. If this applies to you, keep reading. Otherwise this fix may not apply to you. ...

September 26, 2011 · 2 min · birdchan

Splitting and joining files

So I bzipped a 40G file last night. I checked the timestamp and it took about an hour to finish with my 8-core cpu. Since the 40G file is a text file, the resulting file is only 1.4G large. Impressive, I went on to get my morning coffee, happy. Then when I got back, I realized a 1.4G file is still a little too big to transfer it at once. Network failure often happens, and I will need to chop up this file somehow. I did some searches and found that the old school way is to use the split command. I tried that but I got these funny xaa, xab, xac files… ok, fine, I can provide prefixes to them, but still. It’s not intuitive to know how to combine these files back. I suppose a “cat * > file” will do. But what’s the resulting filename? How am I supposed to remember after even just one day? I suppose I can keep a readme file… man, this is last century! ...

September 22, 2011 · 2 min · birdchan

Running bzip2 with multiple cores

I was trying to bzip a 40Gb file and it was taking forever. I then checked the Activity Monitor. It turns out the default bzip was only using one cpu core!!! If you really want to make use of your other cpu cores while doing bzip’ing, here is a nice way I found. Go to http://www.zhuk.fi/pbzip2-action/ and download PBZIP2 Automator action and workflow/service for Mac OS X. Once you have the tbz2 file, double click, then you will see a folder with two files insides. Double click on each file to install the necessary programs. ...

September 22, 2011 · 1 min · birdchan

How to cancel a Wells Fargo personal check?

This is how to cancel a Wells Fargo check as of Sept 21, 2011. Login to your WF account. Click “Account Services”, it’s among the top tabs the 5th one counting from the left. On the next page, Under “Account Services”, find “Stop Payment on a Check”, should be the 9th link. Then just follow the steps. You will need to have the info on the check #, the amount, payable to, and signed date. ...

September 21, 2011 · 1 min · birdchan

selecting checkboxes

Say you have a few checkboxes, defined as below: Item 1 Item 2 Item 3 Basic stuff. Now you want to get those that are checked. In PHP $cb_arr = $_POST["items"]; In javascript, or jquery var cb_arr = $(".my_cb:checked"); Notice the cb_arr above is not a js array. You need to use .each() to iterate through the items. To pass that to php via ajax, you can serialize it like this: var cb_arr_str = $(".my_cb:checked").map(function() { return this.value; }).get().join(','); My point here is this. The ids turn out to be quite useless when dealing with checkboxes. ...

September 16, 2011 · 1 min · birdchan