2009/07/24

解決ie6,ie7的select option disabled沒有作用的問題 Select, Option, Disabled And The JavaScript Solution In IE7, IE6, IE5.5

解決方案:
http://www.lattimore.id.au/2005/07/01/select-option-disabled-and-the-javascript-solution/

下載js檔, 並include到頁面即可, 作法是把頁面的select element找出來, 判斷有disabled的option就變顏色且不可選擇
http://www.lattimore.id.au/files/examples/select-option-disabled-emulation.js

因為只有在ie7以下的版本有問題, 其他瀏覽器沒問題, 所以我改寫了一下
if (navigator.appVersion.indexOf("MSIE 5.5") >= 0 || navigator.appVersion.indexOf("MSIE 6.0") >= 0 || navigator.appVersion.indexOf("MSIE 7.0") >= 0) {
window.onload = ReloadSelectElement;
}
function ReloadSelectElement() {
if (document.getElementsByTagName) {
var s = document.getElementsByTagName("select");
if (s.length > 0) {
window.select_current = new Array();
for (var i = 0, select; select = s[i]; i++) {
select.onfocus = function() { window.select_current[this.id] = this.selectedIndex; }
select.onchange = function() { restore(this); }
emulate(select);
}
}
}
}
function restore(e) {
if (e.options[e.selectedIndex].disabled) {
e.selectedIndex = window.select_current[e.id];
}
}
function emulate(e) {
for (var i = 0, option; option = e.options[i]; i++) {
if (option.disabled) {
option.style.color = "graytext";
}
else {
option.style.color = "menutext";
}
}
}

2009/07/06

BBFileScout 1.1

@Berryreview: [post] BBFileScout 1.1 Lets You Resize Images!!!: The awesome donationware/free utility BBFileScout has be.. http://tinyurl.com/lhuuyr



Twitter Link: http://twitter.com/Berryreview/statuses/2497511707



BBFileScout 1.1 加入調整圖片大小的功能。



Sent via SocialScope Lite (www.socialscope.net)

發送自我的BlackBerry®智慧型手機。

Onto Calendar

把e-mail的內容新增到calendar裡。



http://soundslikeobiwan.com/~roger/OntoCalendar/

發送自我的BlackBerry®智慧型手機。

Call Reminder

Call Reminder

類似Talk Later, 不同的是會把電話號碼新增到Calendar裡。



http://www.blackberrycool.com/2009/06/free-blackberry-call-reminder-app-works-with-calendar-and-messages/





發送自我的BlackBerry®智慧型手機。

GPSLogger Homepage - 100% free Software for BlackBerry® Devices with OS 4.2.1 or higher



可記錄GPS log, 轉換成kml檔後在google map上顯示。

GPSLogger Homepage - 100% free Software for BlackBerry® Devices with OS 4.2.1 or higher: "GPSLogger Homepage [100% free 100% offline]"

2009/06/04

Turn on safe mode (blackberry bold)

Turn on safe mode


When you start your BlackBerry® device, you can turn on safe mode to prevent third-party applications from running automatically. This safe mode enables you to troubleshoot or remove any unwanted applications.


1. Remove and reinsert the battery.

2. When the red LED light goes out, press and hold the Escape key as the device is loading.

3. When the dialog appears, click OK.


When safe mode is on, a safe mode indicator appears in the device status section of the Home screen.

To turn off safe mode, repeat step 1.

<< 很重要!下次bb又無法開機時可以先試試safe mode移除一些軟體後再重開。 >>



發送自我的BlackBerry®智慧型手機。

Signal-Location 利用手機訊號,快速定位。

利用手機的訊號,快速找到自己所在的位置,比開google map後,再等待GPS的訊號定位快多了。

http://bit.ly/KFSDN



發送自我的BlackBerry®智慧型手機。

2009/05/28

How do I wipe the BlackBerry using Jl Cmder? - BlackBerryFAQ

How do I wipe the BlackBerry using Jl Cmder? - BlackBerryFAQ

and

What to do next if Jl Cmder will not connect and wipe

connect your device to usb & cd C:\Program Files\Common Files\Research In Motion\AppLoader

go command line, type :
loader.exe /nojvm

follow step, your device will be wip.

Have you heard about Vision?

Check out this application called Vision; It allows you to watch videos on your BlackBerry.



You can download Vision by going to:

http://vision.metova.com/download



發送自我的BlackBerry®智慧型手機。

2009/05/27

PowerShell 程式中加入中斷

Write-Host "Press any key to continue ..."
$x = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")


在程式碼中加入以上二行即可。

2009/05/19

My case-mate backpack battery door

剛到貨燒燙燙的 case-mate backpack battery door。 觸感還不錯!







發送自我的BlackBerry®智慧型手機。

2009/05/17

2009/05/16

咦?!什麼時候多了這個東西?

咦?!什麼時候多了這個東西?看起來怪怪的…





發送自我的BlackBerry®智慧型手機。

2009/05/12

又發現個好玩的東西-SMS with Location

如果朋友或老婆有智慧型手機而且又是個大路痴的時候,這個東西就很好用了。http://get.wizi.com/blackberry.htm



Wizi SMS with Location - 在SMS中加入目前所在位置。





發送自我的BlackBerry®智慧型手機。

2009/05/10

2009/05/09

Fw: eVeek free theme - Indigo

有興趣的可以下載下來試用。







發送自我的BlackBerry®智慧型手機。



-----Original Message-----

From: jessewth@gmail.com



Date: Sat, 9 May 2009 14:31:49

To: Twitter Mail<74jand32tr@twittermail.com>; Flickr Mail<opened40big@photos.flickr.com>

Subject: eVeek free theme - Indigo





免費的 eVeek.com theme, 看起來還不錯

:) http://www.eveek.com/Themes_90/Indigo-90-OTA2/com_plazmic_theme_Indigo_.jad



發送自我的BlackBerry®智慧型手機。

2009/05/03

BilbyLight v1.0.1 讓 BlackBerry 的背光持續開啟

如果有用過 BlackBerry 導航過的話,最大的困擾就是過一段時間bb會自動將背光關閉,這時只要使用BilbyLight就可以保持背光持續開啟了。



OTA: http://go.mobihand.com/?op=dlm&pd=24468&l=1&ps=102&ext=jad





發送自我的BlackBerry®智慧型手機。

2009/04/30

Slique :: Slick & Sleek Leather Theme for Bold 9000 - Bottom Dock v1.0

Slick theme的作者又有新的作品出爐了!



http://go.mobihand.com/?op=dlm&pd=28624&l=1&ps=150&ext=jad



使用storm的風格,桌布是皮格感覺的rim logo,按鈕跟文字顯示上都很讚哦!



另外有一款相同風格的today theme也提供下載。



http://go.mobihand.com/?op=dlm&pd=28623&l=1&ps=150&ext=jad





發送自我的BlackBerry®智慧型手機。

2009/04/03

Trigger Error Handling For ASP

最近遇到一個情況,在A資料表內有不同的trigger,其中有個trigger 1的作法是在update數量時要去同時update另一個B資料表的數量,
而這個A資料表的另一個trigger 2也會被執行,如果這時trigger 1內的另一個C資料內的Constraint裡觸發時,ASP的ADO會誤以為Trigger 2執行成功,
而不會返回錯誤,以致於程式裡無法作error handling

此時的解法就只能去調整trigger的執行順序,讓有Constraint的Trigger能先被執行,這樣才能抓到錯誤。
以下是範例示範:


-- 1. Constraint : CK_MyProduct_Qty_Selling
ALTER TABLE [dbo].[MyProduct] WITH NOCHECK ADD CONSTRAINT [CK_MyProduct_Qty_Selling]
CHECK (([MyProductQty]-[MyProductQtySelling])>=(0) AND [MyProductQty]>(0))
GO
ALTER TABLE [dbo].[MyProduct] CHECK CONSTRAINT [CK_MyProduct_Qty_Selling]

-- 2. Trigger : InsertLog
CREATE TRIGGER [dbo].[TRI_InsertLog]
ON [dbo].[JesseWangDB]
FOR UPDATE
AS
BEGIN
IF UPDATE (Product_Qty)
BEGIN
INSERT MyLog .....
END
END
GO

-- 3. Trigger : UpdateDetails
CREATE TRIGGER [dbo].[TRI_UpdateDetails]
ON [dbo].[JesseWangDB]
FOR UPDATE
AS
DECLARE @OldProductId int

BEGIN
IF UPDATE (Product_QtySelling)
BEGIN
SELECT @OldProductId=ProductId FROM deleted

UPDATE MyStock
SET MyStockQty = MyStockQty + 1
WHERE MyStockProductId = @OldProductId
END
END
GO


當我執行以下程式時,觸發MyStock的Constraint :



UPDATE MyProduct SET MyProductQtySelling = MyProductQtySelling + 1 WHERE MyProductId = 38382


結果:


(1 個資料列受到影響)
訊息 547,層級 16,狀態 0,程序 TRI_UpdateDetails,行 29
UPDATE 陳述式與 CHECK 條件約束 "CK_MyProduct_Qty_Selling" 衝突。衝突發生在資料庫 "JesseWangDB",資料表 "dbo.MyProduct"。
陳述式已經結束。


因為TRI_InsertLog先被執行到了,所以ASP的ADO誤以為執行結果無誤。

所以我們要調整Trigger順序


EXEC sp_settriggerorder @triggername=N'[dbo].[TRI_UpdateDetails]', @order=N'First', @stmttype=N'UPDATE'


調整後的結果:


訊息 547,層級 16,狀態 0,程序 TRI_UpdateDetails,行 29
UPDATE 陳述式與 CHECK 條件約束 "CK_MyProduct_Qty_Selling" 衝突。衝突發生在資料庫 "JesseWangDB",資料表 "dbo.MyProduct"。
陳述式已經結束。


這樣ASP的ADO就可以抓到error了。

2009/02/19

Oanda FXConverter for BlackBerry - 即時匯率換算軟體

這麼好用的軟體居然沒人發現...LOL



雖然WORLDMATE LIVE可以設三個匯率換算,但是Gold的會員要錢,有時連網路又慢...

OANDA FXConverter完全沒有這個困擾,即時的換算164個貨幣,連線速度快而且免費!



操作很簡單,主畫面就可設定二個匯率的換算...看到台幣直直落實在是...

下方還有秒數告知你是多久前更新的匯率,酷!



Link:http://m.fxconverter.com/



發送自我的BlackBerry®智慧型手機。

2009/02/18

Maximum URL length is 2,083 characters in Internet Explorer

Maximum URL length is 2,083 characters in Internet Explorer

URL的長度最大是2,083字元,Get的長度最大則是2,048字元

IE 8 新功能 : Web Slice 、Accelerators (加速器) 、Search Provider (搜尋提供者)

Accelerators 跟 Search Provider 都只要準備好xml檔即可

可參考:邊做邊學Internet Explorer 8:為你的網站穿上新衣 - Internet Explorer 8 新功能

講一下web slice

1.在某個div加入hslice即可


<div id="ws" class="hslice ProductName">

2.有幾個必要的class要加
hslice, feedurl 或 entry-content, entry-title


<div id="ws" class="hslice ProductContent">
<a rel="entry-content" href="display.aspx?pid=11122211" style="display:none;">
<div class="entry-title ProductTitle">
blackberry bold 9000 on sale!
</div>
</div>

3.feedurl及entry-content
entry-content --> display內的連結,必需使用 target="_blank" 另開視窗顯示,不然跳頁的頁面會在ie8裡的web slice小視窗中顯示
feedurl --> 連結不必特別處理,會在目前視窗中顯示,但必須使用xml格式

使用feedurl:


<div id="ws" class="hslice ProductContent">
<a rel="feedurl" href="myfeed.ashx?pid=11122211" style="display:none;"></a>
<div class="entry-title ProductTitle">
blackberry bold 9000 on sale!
</div>
</div>


myfeed.aspx:


<?xml version="1.0" encoding="big5"?>
<rss version="2.0" xmlns:mon="http://www.microsoft.com/schemas/rss/monitoring/2007">
<channel>
<title>my web slice feed</title>
<link>http://192.168.51.64</link>
<description>my web slice</description>
<pubDate>2009/2/18 下午 02:46:14</pubDate>
<ttl>1440</ttl>
<item>
<title>BlackBerry Bold 9000</title>
<link>http://192.168.51.64/product.aspx?pid=1112233</link>
<description><![CDATA[
<div>
<div><img src="http://192.168.51.64/myproduct.jpg"></div>
<div>product name : BlackBerry Bold 9000 on sale!</div>
<div>price : $17500</div>
<div><a href="http://192.168.51.64/pay/buynow.aspx">Buy Now!</a></div>
</div>
]]></description>
</item>
</channel>
</rss>


其他參考資料:

2009/01/22

ASP - 小心ASP在Dictionary裡的用法....

這是asp,不是asp.net哦!

比如說我有個dictionary


dim dicProduct
set dicProduct = server.CreateObject ("scripting.dictionary")

...

如果要判斷dicProduct某個key是否存在,請使用:


if dicProduct.exists("product_createddate") then
...
end if


請不要用


if dicProduct("product_createddate") = "" then
...
end if


因為不但會無法判斷,還會自動的把你的dicProduct裡長出一個key叫product_createddate, 會給後面的程式碼帶來災難!

遇到後,只有一句話來形容asp, 那就是「吃飽太閒了」

使用 VRTA 加快網頁速度的 12 個步驟

這是我同事Luke在週會上分享的主題,對於前端工程師來說相當的有幫助,有時候會覺得該作都都作的差不多了,但為何網頁還是會慢呢?

分析後就能很快的找到問題所在,對症下藥改善缺失。

也提供了幾個soultion,像css小圖合併,減少零零散散的小圖loading...等等。

分享幾個連結:

使用 Visual Round Trip Analyzer 加快網頁速度的 12 個步驟
http://msdn.microsoft.com/zh-tw/magazine/dd188562.aspx#id0100011

CSS整形與最佳化工具
http://www.isparkle.cn/show/csstidy/?lang=zh

CSS 圖片合併產生器
http://spritegen.website-performance.org/

javascript - 幫js檔減肥:使用 yuicompressor 壓縮js檔

年終了,發現很多該寫的都沒有寫....= =
所以趁機整理一些平常會用到的工具,以免放假放太久會忘記。

今天寫yuicompressor的用法

首先下載yuicompressor:
http://developer.yahoo.com/yui/compressor/

指令:
java -jar yuicompressor-2.3.6.jar --type js --charset big5 -o <產出檔案> <來源檔案>

壓縮後會把.js檔裡的空白及註解都移除

2009/01/16

原來小英也愛用黑苺機啊∼

今天看到的新聞:



聯合、中時政治新聞報導,均以「蔡英文下廚紓壓」為標題切入,並帶出小英部落格、使用黑苺機看網友留言、是否會有雙英會、與民進黨的磨合等訪談內容。其中聯合點出「Yahoo!奇摩新聞領袖專訪系列」,中時則僅提及蔡英文昨日接受「網路媒體專訪」…



看來國內外的領袖都愛用BB哦!



發送自我的BlackBerry®智慧型手機。

[SQL] 使用 SQL 指令作分頁處理 - CTE

可參考這篇文章:

My Program:利用CTE將分頁資料取出-Stored Procedure篇

簡單指令參考:


with myctequery as (
select row_number() over ( ORDER BY order_code DESC ) as CTESN ,
select * from orders (nolock) )
select * from myctequery
where CTESN between 1 and 10 -- 傳入要帶入的分頁筆數

缺點是要先count一次orders的總筆數,才能決定共有幾頁。
效能在前幾頁是最好的,但隨著資料量愈大,移到愈後面的頁數效能會遞減...

2009/01/06

C# 從程式內呼叫程式,以特定使用者呼叫 Process.StartInfo



Process pro = new Process();
pro.StartInfo.UserName = "aaa_iuser"; // 指定以特定使用者執行
string pw = "P@$$w0rd";
SecureString ss = new SecureString(); // password 要以SecureString傳入,而且一定要給password = =
foreach (char c in pw)
{
ss.AppendChar(c);
}
pro.StartInfo.Password = ss;
pro.StartInfo.UseShellExecute = false;
pro.StartInfo.UseShellExecute = false;
pro.StartInfo.FileName = "notepad.exe";
pro.Start();

軟體工程的重要的指標