2013年2月28日 星期四

Apache+PHP5 使用Mysql遇到的問題

Window 7 重灌後, 重拾PHP的專案, 啟動時遇到的問題, 在 Phpinfo 內怎樣都看不到MySql載入, php.ini 也都沒有設定錯, 查看 Apache 的 error.log 出現如下

PHP Warning:  PHP Startup: Unable to load dynamic library 'C:\\AppServ\\php5\\ext\\php_mysql.dll' - The specified module could not be found.\r\n in Unknown on line 0

原因不是別的, 只是少了 libmysql.dll ;

把libmysql.dll複製一份到C:\Windows\System32就好了.

PS: 請注意你的libMySql.dll 的 版本與 php 相同.

2013年2月21日 星期四

在Google Sites(協作) 使用 Goolge Driver(Google Docs)的資料夾文件

參考https://developers.google.com/apps-script/articles/embedding_docslist_in_sites的作法

在Site的管理界面, 新增一個Script

function showFolderInSite() {
var files = DocsList.getFolderById('Google資料夾ID').getFiles();
var page = SitesApp.getPageByUrl('要出現的協作網頁網址');
var attachments = page.getAttachments();

for (i in attachments) {
attachments[i].deleteAttachment();
}

for (i in files) {
page.addWebAttachment(files[i].getName(), '', files[i].getUrl());
}
}

 

1.替換程式內資料夾ID

 


2.替換程式內網頁的URL


image


 


整個結果大致如下


image


 


再回到協作去看就可以看到同步過來的檔案了, 但是如果Driver有再新增檔案, 必須再執行一次Script, 應該還有其它方法吧. 有空再研究.

2013年2月18日 星期一

MS-SQL 2008 msdb missing(遺失)

今天做了一件很蠢的事, 我竟然不認識msdb, 把 MSDBData.mdf 給永久刪除了.

結果重新開機再次進入SQL Server Management Studio時, 出現了

TITLE: Microsoft SQL Server Management Studio
------------------------------

Failed to retrieve data for this request. (Microsoft.SqlServer.Management.Sdk.Sfc)

For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&LinkId=20476

------------------------------
ADDITIONAL INFORMATION:

An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)

------------------------------

Database 'msdb' cannot be opened due to inaccessible files or insufficient memory or disk space.  See the SQL Server errorlog for details. (Microsoft SQL Server, Error: 945)

For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=10.50.4000&EvtSrc=MSSQLServer&EvtID=945&LinkId=20476

Google後,在 MSDN 找到解答, 關鍵字是  Rebuild System Databases,

重點是要找到安裝光碟(或重新下載download), 找到媒體目錄內的setup.exe . 用命令列重新產生.

提供我的指令供參考.

Setup /QUIET /ACTION=REBUILDDATABASE /INSTANCENAME=SQLEXPRESS /SQLSYSADMINACCOUNTS=BUILTIN\Administrators  /SAPWD= StrongPassword /SQLCOLLATION=Chinese_Taiwan_Stroke_CI_AS

另外注意一點, 你的目錄 MSSQL\Binn\Templates 內有沒有範本檔, 它是用這裡的範本來產生的, 如果沒有, 也要重媒體檔(setup\sql_engine_core_inst_msi\Pfiles\SqlServr\MSSQL.X\MSSQL\Binn\Templates)再複製過來.

執行完成, 是沒有訊息的, 有訊息表示沒有成功, 要檢查你的參數, 檢查 C:\Program Files\Microsoft SQL Server\100\Setup Bootstrap\Logs 下的 Summary.txt .