IE7的”Open in new Tab” 消失了

安裝 IE7 正式版以後,發現一個問題,滑鼠右鍵點選連結時,應該要出現 “Open in new Tab” 的,可是卻消失了。
我納悶了很久,不知道該怎麼解決。
某天因緣際會之下,看到了這篇文章:IE7 Tabbed Browsing Q & A ,作者說如果有任何關於 Tab browsing 疑問的話,請儘管留言,他會努力解決,於是我留下問題。
過了許久,等我想起這件事情的時候,再次回來看這篇文章,發現作者已經很詳細的回答了我的問題。

@elleryq, most likely you have an add-on that decided to override IDocHostUIHandler in order to provide a custom context menu. The fix is to look at your add-ons and upgrade or un-install them. Some, such as the Google toolbar, have fixed this in the newest versions.
To provide more detail, the problem is that they’re loading the IE6 version of the context menu out of shdoclc.dll, which is no longer part of IE, but is still part of Windows Explorer. There was some bad documentation on our part (well, legacy) which suggested loading otherwise undocumented IE resources out of shdoclc.dll, which a handful of add-ons followed.
IDocHostUIHandler was primarily intended to be used by 3rd party browsers such as Maxthon, and not IE extensions. The recommended advice for 3rd party developers is to use standard context menu extensions whenever possible (see the “Context Menus and Extensions” section in http://msdn2.microsoft.com/en-us/library/aa770042.aspx) and if you really *have* to override IDocHostUIHandler, load your own resources for the context menus.
tonyschr

所以我照著他的建議,更新 Google toolbar 到最新版,問題就解決啦~

備份AD通訊錄

備份Active Directory上所有 user 的分機與 e-mail…
把下面的 code 存成 export.vbs以後,點擊兩下就可以執行了。

'Global variables
Dim oContainer
Dim OutPutFile
Dim FileSystem
'Initialize global variables
Set FileSystem = WScript.CreateObject("Scripting.FileSystemObject")
Set OutPutFile = FileSystem.CreateTextFile("msi.csv", True)
Set oContainer=GetObject("LDAP://DC=test,DC=com")
'Enumerate Container
EnumerateUsers oContainer
'Clean up
OutPutFile.Close
Set FileSystem = Nothing
Set oContainer = Nothing
WScript.Echo "Finished"
WScript.Quit(0)
Sub EnumerateUsers(oCont)
On Error resume next
Dim oUser
For Each oUser In oCont
Select Case LCase(oUser.Class)
Case "user"
'If Not IsEmpty(oUser.distinguishedName) Then
'	OutPutFile.WriteLine "dn: " & oUser.distinguishedName
'End If
If Not IsEmpty(oUser.name) Then
OutPutFile.Write oUser.Get("name")
End If
OutPutFile.Write ","
If Not IsEmpty(oUser.FullName) Then
OutPutFile.Write oUser.FullName
End If
OutPutFile.Write ","
' EmailAddress
If Not IsEmpty(oUser.EmailAddress) Then
OutPutFile.Write oUser.EmailAddress
End If
OutPutFile.Write ","
If Not IsEmpty(oUser.TelephoneNumber) Then
OutputFile.Write oUser.Get("TelephoneNumber")
End If
OutPutFile.WriteLine
Case "organizationalunit" , "container"
EnumerateUsers oUser
End Select
Next
End Sub

參考資料:

FireFox 2.0 RC1

把公司的 FireFox 改用 2.0RC1,Extension 詳列如下:

  • 2.0 仍可使用者:
    • DOM Inspector
    • Talkback
    • Adblock Filterset.G Updater
    • CustomizeGoogle
    • IE Tab
    • Image Zoom
    • PDF Download
    • Web Developer
    • FlashGot
    • 新同文堂
    • Download Statusbar
    • Adblock Plus
    • ColorZilla
    • Google Toolbar for Firefox
    • Google Browser Sync
  • 不相容 2.x:
    • del.icio.us
    • Fasterfox
    • Hypertext DOM Browser
    • Furl Tools
    • Copy URL +
    • Greasemonkey
    • CSSViewer
    • Screen grab!
    • gmif
    • Tabbrowser Preferences

目前一切順利,不過少了一些如 del.icio.us、furl.net、Copy URL+等等的方便工具,還真是麻煩~

WinMerge Filter

無意中看到這篇:WinMerge檔案濾鏡的使用方法,於是動手幫WinMerge加了這個濾鏡,這下子,比對檔案的時候可是快多了!

怎麼新增?
[Tools][Filters],再選 New,WinMerge會開出記事本,把下面內容貼上,存檔。

怎麼使用?
比對時,Filter選為剛剛加入的 cpp_with_cvs 或是自己輸入 [F]cpp_with_cvs,進行compare 即可。

## This is a directory/file filter template for WinMerge
name: cpp_with_cvs
desc: For company usage.
## Select if filter is inclusive or exclusive
## Inclusive (loose) filter lets through all items not matching rules
## Exclusive filter lets through only items that match to rule
## include or exclude
def: include
## Filters for filenames begin with f:
## Filters for directories begin with d:
## (Inline comments begin with " ##" and extend to the end of the line)
f: \.bak$              ## 備份檔
f: \\~*$               ## 備份檔
f: \\#*$               ## WinCVS 的備份檔
f: \.map$              ## .map, .rom, .axf 都是編譯的產出物
f: \.rom$
f: \.axf$
f: \ChangeLog$         ## ChangeLog 也不要
d: \\CVS$              ## CVS下的檔案不用比對
d: \\\.OBJ_RELEASE$    ## 這兩個都是編譯時的產出
d: \\\.OBJ_DEBUG$

Workaround

感謝前同事 Terry 同學的解釋,讓我搞懂了。
Workaround 的意思:對Bug 來說,並沒有fixed 但是有替代方案可以避開
Severity 是代表嚴重性,當選為 Workaround 的時候,表示這個 bug 並沒有真正 fix,但是有替代方案可以避開,嚴重性不高
No workaround 的話,表示目前沒有 fix,也沒有替代方案,嚴重性就比較高~

.PHONY in Makefile

Make 主要的工作目標都是針對檔案,所以萬一你定義的工作目標並不是檔案,或是正好與檔案重複的時候,其實是會讓人丈二金剛摸不著頭的。
所以,.PHONY 被用來定義假工作目標,這樣 Make 就知道這不是針對檔案。
Make 預設的假工作目標有:

  • all
  • install
  • clean
  • distclean
  • TAGS
  • info
  • check

用了 Make 也用了三四年了吧,現在看了”GNU Make 專案開發工具”這本書才知道…
慚愧…

VFPWiki升級之路(4)最終篇-bigdump.php

在此特別感謝網友阿凱推薦了這篇文章:BigDump-MySQL資料匯入好幫手,讓我得以解決 sql 檔案過大的問題。
這裡記下所有步驟:

  1. 備份原先VFP Wiki的資料庫,上傳到虛擬機器上,備份時,這些選項要記得選起來:
    • 資料庫輸出選項:
      • 加入刪除資料表語法
    • 結構:
      • 加入刪除資料表語法
      • 加入 if not exists
      • 建立/更新檢查日期
  2. 修改 bigdump.php 裡的資料庫設定,上傳到虛擬機器上
  3. 從瀏覽器去訪問bigdump.php,然後找到剛剛的備份sql檔案,進行匯入
  4. 下載 MediaWiki-1.6.8,1.7.x已經改用 PHP 5.0 了,所以跟環境不符合,不能用
  5. 解開 MediaWiki-1.6.8,丟到虛擬機器上的 /var/www,修改 /etc/apache2/sites-availables/default,將原來的 apache2-default 改成 mediawiki-1.6.8
  6. 下載原本的 LocalSettings.php,同樣也是丟到 /var/www
  7. 以 ssh 連到虛擬機器,這邊要作 upgrade,切換到 /var/www/mediawiki-1.6.8/maintenance,執行 php update.php
  8. 與原來的VFP Wiki作比對,比較是否有遺失頁面。不知道為什麼,的確有些頁面無法連到了,資料庫仍然存在這些頁面,只是我不知道該怎麼弄出來,後來因為這種情況的頁面不多,所以手動從原本的站台複製。
  9. 從虛擬機器上的 phpMyAdmin 再次匯出資料庫(參考步驟1)。
  10. 上傳匯出的SQL檔與bigdump.php
  11. 上傳 MediaWiki-1.6.8 與設定檔,當然記得要修改一下LocalSettings.php,因為虛擬機器還是與現實環境有差距。
  12. 經過一點點曲折以後,大功告成。

終於了卻一樁長久以來想做卻沒完成的心願。

VFPWiki升級之路(3)-MySQL

搞了半天,才發現MySQL版本裝錯。於是就先移除掉,再重新安裝。
可是卻無法啟動,看了/var/log/daemon.log之後,發現有這麼一行錯誤訊息:

Fatal error: Can’t open privilege tables: Table ‘mysql.host’ doesn’t exist

原來是 /var/lib/mysql 路徑下沒有 mysql 這個資料夾,於是我們改採手動建立,並且變更 owner 以及 permission。
再執行 mysql_install_db 來建立基本資料庫即可。

#cd /var/lib/mysql
#mkdir mysql
#chown mysql:mysql mysql
#chmod g+w mysql
#chmod o-rx mysql
#mysql_install_db

重新啟動 mysql,雖然是順利啟動了,可是卻出現錯誤訊息:

/usr/bin/mysqladmin: connect to server at ‘localhost’ failed
error: ‘Access denied for user: ‘debian-sys-maint@localhost’ (Using password: YES)’

停止mysql時也一樣有錯誤訊息:

/usr/bin/mysqladmin: shutdown failed; error: ‘Access denied. You need the SHUTDOWN privilege for this operation’

看來都是一樣的問題,所以需要手動GRANT權限給debian-sys-maint這個user,首先參考/etc/mysql/debian.cnf,得知帳號與密碼,再使用GRANT指令即可:

#cat /etc/mysql/debian.cnf
#mysql
>GRANT all on mysql.* TO ‘debian-sys-maint’@’localhost’ IDENTIFIED BY ‘your_password’;
>GRANT SHUTDOWN on *.* TO ‘debian-sys-maint’@’localhost’;

完工。

SQL 與 Text

今天想到蠻有趣的構想。
SQL 一如我們所知,是查詢資料表格用的。除此之外,也可以查詢 Excel 或是 具有特定格式的 Text。
如果今天以 regular expression 用來查詢一個文字檔,像這樣:

select pos from mybase.txt where str=’a*c’

或是這樣

select pos from mybase.txt where str=’\d\d\d\d’

然後我們就得到一份表格,告知我們 ‘a*c’ 或 ‘\d\d\d\d’ 在 mybase.txt 裡出現的位置。
喔~這看來很方便呢~~
如果要替換某些字串呢?像這樣

update mybase.txt set str=’abcd’ where str=’\d\d\d\d’

把所有是四個位數的數字替換成 abcd。
刪除也可以囉~

delete from mybase.txt where str=’^void’

把所有一開頭是 void 的 void 都刪掉…
新增?沒啥特殊功能可以加上,就是 append 到最後吧…

insert into mybase.txt ( str ) values (‘end of file’)

歸納一些關鍵字如下:

  • str 表示要找的字串或是找到的字串
  • pos 則表示在檔案中的位置,也許可以再延伸出 line 與 column,來表示列與行的位置。
  • 當然也要支援 count() 之類的函數,這樣就可以統計共出現幾次。

我想我會找時間來完成這個有趣的構想吧…
補充:
剛剛又想到,其實也可以以 Lucene 來當作資料來源,這樣也很有趣…