ZXing 是一個一維/二維條碼製作與識別的 library,計畫首頁在 https://github.com/zxing
本文要說的是如何製作帶有中文的 QRCode。不用囉唆了,直接看 code
using ZXing; Bitmap bm = |
這樣就得到了一個 QRCode 圖片

簡單吧!
ZXing 是一個一維/二維條碼製作與識別的 library,計畫首頁在 https://github.com/zxing
本文要說的是如何製作帶有中文的 QRCode。不用囉唆了,直接看 code
using ZXing; Bitmap bm = |
簡單吧!
ASP.Net 的 RadioButtonList 是一個蠻好用的控制項,用了他就不用拉好幾個 RadioButton 了。不過有一個困擾的地方就是他的 Item 並沒有 Visible 的屬性,使得有時想要隱藏某些項目時感覺有些困擾
其實,沒有 Visible 屬性也沒有關係,他有 Arrtibutes 屬性可以用,只要用
RadioButtonList1.Items[0].Attributes.Add("style", "display:none");
或是
RadioButtonList1.Items[0].Attributes["style"] = "display:none";
就可以隱藏第 0 個 item 了
提供給大家參考
最近開始使用 SQLite 當作應用程式的本地資料儲存媒體,當然也想要針對 SQLite 資料庫做一些管理跟查詢工作。雖然網路上可以找到需付費或是不須付費的 SQLite 管理工具,但是還是想使用自製的 DB 工具來查詢資料。畢竟用慣了,哪裡用得不爽還可以自己改一改。
但是自製的 DB 工具使用的是 ADO 來連接資料庫,對於 SQLite 的免費連接方案只有 SQLite ODBC Driver 了
連接上是沒有問題,也可以正常的擷取資料,無亂碼
不過使用 OpenSchema 來取得資料庫中的 table,以及 table 中的欄位時,卻出現了亂碼
解決方法如下:
開啟 ODBC 設定,將「OEMCP Translation」打勾,就 OK 了
設定完成之後,就可以正確的抓到中文的 table name 跟 column name 了
1. 讓 ASP.Net 信任 ExchangeServer 的自訂憑證
在 Global.asax.cs 裡面的 Application_Start 事件加入以下這行:
ServicePointManager.ServerCertificateValidationCallback +=
new RemoteCertificateValidationCallback(ValidateServerCertificate);
以及在 Global.asax.cs 加入這個靜態方法
public static bool ValidateServerCertificate(Object sender,
X509Certificate certificate, X509Chain chain,
SslPolicyErrors sslPolicyErrors)
{
return true;
}
using 要加入
using System.Net;
using System.Net.Security;
using System.Security.Cryptography.X509Certificates;
2. 發郵件時程式
SmtpClient sc = new SmtpClient();
sc.Credentials = CredentialCache.DefaultNetworkCredentials;
sc.EnableSsl = true;
sc.Send(mm); // mm 是 MailMessage
3. 在 web.config 中設定好
<system.net>
<mailSettings>
<smtp from="寄信人信箱" deliveryMethod="Network">
<network host="郵件主機"
port="埠號"
userName="登入帳號"
password="登入密碼"
defaultCredentials="true" />
</smtp>
</mailSettings>
</system.net>
4. 將 IIS 的應用程式集區設定為「整合式」
//
// 將長字串拆解成數行,中間用 CR+LF 分開
// Crystal Report 9 以後適用
//
StringVar s := {要拆解的欄位}; // 要拆解的字串
StringVar output := ''; // 輸出字串
NumberVar CharsInALine := 20; // 一行幾個字
NumberVar currLength := 0;
while Length(s) > 0 do
(
// 這只是很粗略的判斷,假定使用者只會輸入半形英數字跟中文字,
// 不會使用半形的特殊符號,如半形日文假名
if AscW(s) > 256 then
(
currLength := currLength + 2; // 中文字,長度 + 2
)
else
(
currLength := currLength + 1; // 文數字,長度 + 1
);
output := output + s[1];
if currLength >= CharsInALine then
(
output := output + Chr(13) + Chr(10);
currLength := 0;
);
s := Mid(s, 2);
);
output;