2009年12月16日 星期三

SQL 2008 安裝遇到的問題

這兩天在安裝SQL Server 2008 Enterprise,結果遇到一個很詭異的大問題,
安裝完SQL,竟然不能啟用服務…

查了log檔,發現錯誤很離譜,Server上明明就沒有"E"磁碟,
錯誤竟然是「FCB::Open failed: Could not open file e:\sql10_main_t\sql\mkmastr\databases\objfre\i386\model.mdf」

找了相關的文章,才發現有一堆人跟遇到一樣的問題,
Problem on starting SQL Server
看了一下討論的過程,還蠻好笑的,
有重新安裝SQL Server的,但有人解決了,有人沒解決
總之,我不想重新安裝,浪費時間又沒效率
還有人直接在E磁碟建相同的目錄,
再把SQL安裝目錄下的model、master、msdb等mdf檔直接copy過去,解決
也有人跟我一樣的情形,沒有E磁碟,所以不可行
還好後來有人在msdn上找到解決方法了,

解法如下:
在command line模式中,進入C:\Program Files\Microsoft SQL Server\100\Setup Bootstrap\Release目錄下,

輸入指令:
Setup /QUIET /ACTION=REBUILDDATABASE /INSTANCENAME=InstanceName /SQLSYSADMINACCOUNTS=accounts /[ SAPWD= StrongPassword ]

解決@@

詳細說明請參考msdn: Rebuilding System Databases

2009年3月15日 星期日

DSM-設計結構矩陣

設計結構矩陣(Design Structure Matrix),設計結構矩陣(DSM)是一種簡潔,系統/專案的矩陣表示法
這個矩陣包含了構成系統/專案的所有次系統/活動的列舉以及對應的資訊交換及相依性的模式.那就是說,在啟動某一特定活動時會需要何種的資訊內容(各種參數)與由該項活動所產生出來的資訊將要送到何處去(亦即,矩陣中的其他任務將會運用到這個產出資訊).

DSM提供了有關如何去管理一項複雜系統/專案以及標示出資訊需求及要求的相關議題,任務排序以及迭代這些方面的洞察。

2009年2月28日 星期六

Send mail in JavaMail with gmail smtp

最近用到Java Mail,正在煩惱要用哪個Smtp Server來寄信,就想到用Gmail

附上程式碼....

import java.security.Security;
import java.util.Properties;

import javax.mail.Authenticator;
import javax.mail.Message;
import javax.mail.PasswordAuthentication;
import javax.mail.Session;
import javax.mail.Transport;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeMessage;

import com.sun.net.ssl.internal.ssl.Provider;

public class GmailSend {
private String mailhost = "smtp.gmail.com";

public synchronized void sendMail(String subject, String body, String sender, String recipients) throws Exception {

Security.addProvider(new Provider());

Properties props = new Properties();
props.setProperty("mail.transport.protocol", "smtp");
props.setProperty("mail.host", "smtp.gmail.com");
props.put("mail.smtp.auth", "true");
props.put("mail.smtp.port", "465");
props.put("mail.smtp.socketFactory.port", "465");
props.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory");
props.put("mail.smtp.socketFactory.fallback", "false");
props.setProperty("mail.smtp.quitwait", "false");

Session session = Session.getDefaultInstance(props, new Authenticator() {
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication("your@gamil.com", "password@gmail");
}
});

MimeMessage message = new MimeMessage(session);
message.setFrom(new InternetAddress(sender,"nickname of sender"));
message.setSubject(subject);
message.setContent(body, "text/plain;charset=big5");
if (recipients.indexOf(',') > 0)
message.setRecipients(Message.RecipientType.TO, InternetAddress.parse(recipients));
else
message.setRecipient(Message.RecipientType.TO, new InternetAddress(recipients));

Transport.send(message);
System.out.println("finished!");
}

}


原始連結:
http://yuweijun.blogspot.com/2008/11/send-mail-through-gmail-smtp-using.html

2009年2月19日 星期四

Perl中對URL參數進行編碼

在打工的時候遇到的問題,
今天找了好久,終於找到解決方法了
原來是big5轉utf8的問題…

首先,因為原本存在MySQL中的資料是以big5編碼的,
所以要傳到utf8的網頁當參數時,除了用url的編碼外,
還要用encode編一次,但是這還不夠,
由於是big5碼,所以要先以big5解碼,再轉utf8,
於是…解法如下:
-------------------------------------------------------------------------------
use Encode;
use CGI;

$url_para = encode("utf8",decode("big5",$original_str));

$final_para = uri_escape($url_para);
-------------------------------------------------------------------------------

That's all.

2009年2月14日 星期六

Prototype在Firefox中無法正常運作bug

Prototype.js 1.6.0.3中有一處bug,
導致Ajax.Request對象無法在Firefox下正常運作,
找了好久,終於找到相關的修正方法了…

原版本:
for (var name in headers)
this.transport.setRequestHeader(name, headers[name]);
},

修正後:
for (var name in headers)
if(typeof headers[name] != 'function')
this.transport.setRequestHeader(name, headers[name]);
},

終於可以正常運作了,
只是沒想到這個bug在1.5版就有了。

參考:
http://www.cnblogs.com/beginor/archive/2007/06/02/768883.html

2009年1月13日 星期二

Integration with Flex Builder 3 plug-in and MyEclipse

這兩天快被flex環境的架設搞瘋了,不過問題終於解決了…

首先,有幾個東西要下載
1.Flex Builder 3 plug-in,要先註冊
2.MyEclipse or Eclipse

◎自動安裝
先裝Eclipse,再安裝Flex 3 plug-in
安裝Flex 3 plug-in的時候,會要求你找到Eclipse的安裝目錄,
這個目錄下要包含"Configuration"的目錄,
安裝完後,就完成了。

◎手動安裝
先裝Eclipse,再安裝Flex 3 plug-in
由Eclipse中新增Flex 3 plug-in,
選單 Help / Software Update / Add Software / Local,
選Flex 3 plug-in的安裝目錄,
[安裝目錄]\Adobe\Flex Builder 3 Plug-in\com.adobe.flexbuilder.update.site
完成安裝,Eclipse會自動新增一個Flex Builder的專案類型。