Search

1/08/2009

Cross-Domain Communication with IFrames

window.location.hash = '' will cause browser reload,
window.location.hash = '#' won't
Cross-Domain Communication with IFrames - 不同 domain 的 parent 跟 child 透過 fragment identifier 溝通

child的js


window.onload = function() {
setInterval(function() {
var hashVal = window.location.hash.substr(1);
document.body.style.backgroundColor = hashVal;
}, 1000);
$("speedUp").onclick = function() { parent.window.location.hash = "speedUp"; }
$("slowDown").onclick = function() { parent.window.location.hash = "slowDown"; }
}

parent的js

setInterval(function() {
if (window.location.hash == "#speedUp" && liftInterval >= 60) {
liftInterval = Math.round(0.8 * liftInterval);
window.location.hash = "#";
launchLift();
}
if (window.location.hash == "#slowDown" && liftInterval < 500) {
liftInterval = Math.round(1.2 * liftInterval);
window.location.hash = "#";
launchLift();
}
}, 100);

update: ie下這個方法不work
Julien Lecomte’s Blog » Introducing CrossFrame, a Safe Communication Mechanism Across Documents and Across Domains
Cross-Domain Communication Between IFrames

1/07/2009

javascript write css inline important

如果樣式裡面有加上 css important, ex: #foo{background: red !important},如果要用 javascript override掉了會你會這樣寫: $('foo').style.background = 'blue !importnat',不過這種寫法在ie下面會是一個 js error,在 firefox 也不會 work,在firefox下可以這樣寫$('foo').style.setProperty('background', 'blue', 'important')不過由於 ie 不支援 setProperty,似乎也沒有任何辦法可以加上 inline css important,替代方案是在 css 最後一行加上#foo{background: blue !importnat},或者是直接新增一個 style 再 append 在 <head>

What determines that a script is long-running? | NCZOnline

What determines that a script is long-running? | NCZOnline
Internet Explorer determines that a script is long-running by the total amount of statements the JScript engine has executed. By default, the value is 5 million statements and can be altered via a registry setting. When your script exceeds this maximum number of statements, you’ll get this dialog:
IE Dialog: A script on this page is causing Internet Explorer to run slowly. If it continues to run, your compute rmay become unresponsive.
Firefox determines that a script is long-running by timing how long the script engine has been executing code continuously. The default time is set to 10 seconds and can be altered via about:config. Note that the amount of time modal dialogs, such as alerts, are displayed does not count against the script engine execution code. When this execution time has been reached, Firefox displays a dialog with the following message:
Firefox Dialog: A script on this page may be busy, or it may have stopped responding. You can stop the script now, open the script in the debugger, or let the script continue.
Safari also uses script engine execution time to determine when a script has become long-running. After some digging around in the WebKit source code, it looks like the default timeout is 5 seconds. When that threshold is reached, the following dialog is displayed:
Safari Dialog: A script on the page [url] is making Safari unresponsive. Do you want to continue running the script, or stop it?
Opera is an interesting case: it doesn’t appear to have a long-running script limit. I ran several tests that completed even after minutes of code execution. During the time, the browser remain mostly responsive, which is impressive. I’m not sure if this approach is a good thing or a bad thing at the moment, but it’s what is implemented.


function chunk(array, process, context) {
var items = array.concat(); //clone the array
setTimeout(function() {
var item = items.shift();
process.call(context, item);
if (items.length > 0) {
setTimeout(arguments.callee, 100);
}
},
100);
}

Steve Souders - High Performance Web Sites

Steve Souders - High Performance Web Sites

Hammerhead
CS193H
UA Profiler
Episodes
Cuzillion
Compare

Fiddler Web Debugger - Script Samples

Fiddler Web Debugger - Configuring clients 這邊有寫如何讓 fiddler 也可以紀錄 firefox 的 http request. 基本上只要把 proxy 指到 127.0.0.1:8888 或者把 proxy.pac 設到 {my document}/Fiddler2/Scripts/BrowserPAC.js 就可以了
另一方面因為 fiddler 是一個 proxy, 中間自然可以做一些手腳, 透過 fiddler script 可以做到一些有趣的事情, 可以參考 FiddlerScript CookBook

// Simulate modem uploads 
// Delay sends by 300ms per KB uploaded.
oSession["request-trickle-delay"] = "300";

// Simulate modem downloads
Delay receives by 150ms per KB downloaded.
oSession["response-trickle-delay"] = "150";

// Display in the "Custom Column" the number of milliseconds from the moment of the request until the last byte was received.
oSession["ui-customcolumn"] = oSession["X-TTLB"];

// Display the # of milliseconds until the First Byte was received from the server, followed by the # of ms until the Last Byte.
oSession["ui-customcolumn"] = "FB: " + oSession["X-TTFB"] + "; LB: " + oSession["X-TTLB"];

1/04/2009

私宅料理

《 小路的陽台‧西班牙私家菜 》

小路的陽台
0926144013
台北縣永和市環河西路1段85巷8弄1號4樓
小路的陽台怎麼去? 真的非常難去
建議就是走環河西路到一段85巷下車(下圖為85巷口, 有個警衛亭)
然後往前走到T字形處,
左轉後兩步就立刻右轉進另一條巷子,
往前走發現摩托車群在你左手邊就對了,
再來就是注意右手邊的門牌號碼,
小路的陽台是個紅色的門,樓上就是了。

私宅打邊爐
其實在台北原本就有幾家私宅餐廳,在饕客圈裡也小有名氣,以我個人吃過的而言,像是臨沂街的郭老師滿舍私廚、敦化南路巷子裡的OA+永和小路的陽台新中街的法烹沙龍龍江路的Bagel Bage等等,而私廚餐廳的最大特色,通常是裝潢氣氛別具特色,或是有其獨家祕方的菜餚,二者特色兼備的其實很難,而二者特色都沒有的,那大概開沒多久就要倒了

正宗沙茶火鍋老店‧麒麟閣

正宗沙茶火鍋老店‧麒麟閣

麒麟閣
地址:台北縣永和市永和路二段57號2樓 (頂溪捷運站附近)
Tel:( 02 ) 2924 - 9259‧( 02 ) 2925 - 3423
網址:http://www.kirinhouse.com/
營業時間:上午 11 : 00 - 15 : 00  下午 17 : 00 - 24 : 00
休假時間:6 月 1 日 - 7 月 30 日

1/02/2009

非凡大探索 » 11/8店家資料-日港客必吃精選

非凡大探索 » 11/8店家資料-日港客必吃精選

店名:茂園餐廳
地址:台北市長安東路二段185號
電話:(02)2752-8587、(02)2711-4179
營業時間:12:00-14:00、17:00-22:00
老闆:第三代小老闆 標先生 0935-591-213
推薦:白斬雞 450元/半隻(每日限量20隻)、花枝丸 30元/顆、鹹冬瓜蒸魚 時價、蚵仔仁 200元/小份

店名:欣葉創始店
地址:台北市雙城街34-1號
電話:02-2596-3255
營業時間:
老闆:大廚 鄭坤銀
推薦:菜脯蛋 180元、紅蟳米糕 680元、滷肉 240元/三塊、三杯雞 680元、蠶絲大蝦 260元/尾

店名:吉祥樓
地址:苗栗縣三義鄉勝興村二十份283號
電話:037-875-923
營業時間:公休:每月最後一週星期一公休
老闆:老闆 范發良
推薦:招牌白玉三寶 400元、芋頭糕 300元、椒鹽豬腳 400元


店名:金都餐廳
地址:南投縣埔里鎮信義路236號  
電話:049-2995-096
營業時間:11:00~14:30 17:00~21:00
老闆:主廚 劉恆宏
推薦:紹興醉香雞 360元、蓮花仙子羹360元、紹興宣紙蔗香扣肉 560元、紹興原鄉米飯480元、埔里米粉炒200元

店名:鼎泰豐
地址:台北市信義路2段194號(永康街口)
電話:02-2321-8928
營業時間:10:00-21:00
老闆:廚房負責人:戴伶軒
推薦:陽春麵:60、蝦仁炒飯:170、小籠包:180、蝦仁炒手:140


店名:阿美飯店
地址:台北市大安區吉林路81號
電話:02-25235115 25215999
營業時間:
老闆:店長:陳志翔 大廚:林景瑋
推薦:擔仔麵 NT.35 紅蟳米糕 NT.490

店名:台一生態水上花園餐廳(台一生態教育休閒農場內)
地址:南投縣埔里鎮中山路一段176號 
電話:049-2997-848
營業時間:11:00~14:00 16:30~20:30
老闆:主廚 潘志宏
推薦:梅汁蝦280元 埔里金瓜米粉160元 梅干扣肉240元

店名:呂桑食堂
地址:台北市永康街12-5號
電話:(02)2351-3323
營業時間:11:30-14:00;17:00-21:00
老闆:方國昌
推薦:糕渣 100元 肝花 100元 棗餅 100元 味噌大腸 140元 紅糟肉 140元