January 29,2009
收驚文
道法本無多 南辰貫北河 算來無盡數 合斬世間魔
鬼魅若不順我 道心請盡 雷霹靂粉粹
普蓭咒 普蓭經 手執素珠口唸經
上天下方多清 上有琉璃或夜界 若有蓮花滿地開
解英體 晟英身 弟子(信女)xxx
災秧化為塵 普蓭咒 普蓭經 普蓭菩薩降來臨
起忌天無煞 地無煞 年無煞 月無煞 日無煞 時無煞
起忌凶星 起忌定(木桑) 起忌土木神煞 起忌一百連八煞
急急如律令
(三清)奉勅令普蓭到此罡
November 25,2008
[Tip]Convert Mysql to Postgresql
mysqldump $DATABASE_NAME -v -nt --compatible=ansi,postgresql --complete-insert=TRUE --extended-insert=FALSE --compact --default-character-set=UTF8 -u $DATABASE_USER -p -r $OUTPUT_FILE
%Postgresql%/bin
psql -d $DATABASE_NAME -f $OUTPUT_FILE -U user_name -W
November 13,2008
Convert shapefile to PostgreSQL in Windows XP using shp2pgsql
1. 將*.shp檔轉為文字檔
shp2pgsql db.shp public.table -> db.sql
2. 用記事本另存 db.sql 為 UTF-8 Encoding
3. 刪除db.sql中異常字元(e.g. \ )
4. psql -d database_name -f db.sql -U user_name -W
April 2,2008
[筆記]專利侵害鑑定流程
在專利侵權鑑定報告主要是依據專利的專利侵權鑑定理論來進行,而專利侵權理論不外乎是考慮下列三項原則。
1. 字義侵權( literal infringement)
2. 均等論( doctrine of equivalents)
3. 禁反言( file wrapper estoppel)
January 12,2007
[JAVA] JDBC bug CachedRowSet with the column "Text, NText" in Sql Server 2000
使用sun.jdbc.rowset.CachedRowSet時會發生的怪問題,當MS SQL server 2000的資料欄位型態是 text or ntext的時候,如果資料是空字串,會Catch到SQLException: underlying input stream returned zero bytes。
Solution:改用varchar就沒事了.... 囧....
December 19,2005
[ASP.Net]連結Crystal Report
Import CrystalDecisions.CrystalReports.Engine ( for ReportDocument物件)
CrystalDecisions.Shared ( for TableLogOnInfo 物件 )
code behind
using CrystalDecisions.Web;
using CrystalDecisions.CrystalReports.Engine;
using CrystalDecisions.Shared;
private void Page_Load(object sender, System.EventArgs e)
{
ReportDocument crReport = new ReportDocument();
Config.CrystalReportConnection(ref crReport,"CrystalReport1.rpt");
//第二個參數是Crystal Report報表檔名
crvReport.ReportSource=crReport; //crvReport is Crystal Report Viewer's ID
}
Config.cs
public static void CrystalReportConnection(ref CrystalDecisions.CrystalReports.Engine.ReportDocument crReport, string CrystalReportFileName)
{
crReport.Load(System.Web.HttpContext.Current.Server.MapPath(Config.getInstance().crystalReport_FileRoot) +"/"+ CrystalReportFileName);
//設定 *.rpt 檔案來源
//下述設定連結內容
TableLogOnInfo crLogOnInfo = new TableLogOnInfo();
foreach (CrystalDecisions.CrystalReports.Engine.Table crTable in crReport.Database.Tables)
{
crLogOnInfo = crTable.LogOnInfo;
crLogOnInfo.ConnectionInfo.ServerName="server ip";
crLogOnInfo.ConnectionInfo.UserID="id";
crLogOnInfo.ConnectionInfo.Password="pwd";
crLogOnInfo.ConnectionInfo.DatabaseName="DB_name";
crTable.ApplyLogOnInfo(crLogOnInfo);
}
//上述設定連結內容
}
December 5,2005
[ASP.Net]DataSet新增資料(DataRow)並透過xml格式儲存讀寫
寫
try
{
//建立儲存選取之mailing List DataSet
DataSet ds = new DataSet();
ds.Tables.Add("CHECKED"); //新增CHECKED資料表至DATASET ds之中
ds.Tables["CHECKED"].Columns.Add("STU_ID"); //新增欄位STU_ID至DATASET ds之中
ds.Tables["CHECKED"].Columns.Add("STU_NAME");
ds.Tables["CHECKED"].Columns.Add("CMP_NAME");
ds.Tables["CHECKED"].Columns.Add("EMAIL");
for(int i = 0; i<dgEmail.Items.Count; i++)
{
HtmlInputCheckBox app_no = (HtmlInputCheckBox)dgEmail.Items[i].FindControl("chkSTU_ID");
if(app_no.Checked)
{
System.Data.DataRow row = ds.Tables["CHECKED"].NewRow();
row["STU_ID"]=dgEmail.Items[i].Cells[6].Text; //由dgEmail這個DataGrid新增學生編號
row["STU_NAME"]=dgEmail.Items[i].Cells[0].Text;
row["CMP_NAME"]=dgEmail.Items[i].Cells[1].Text;
row["EMAIL"]=dgEmail.Items[i].Cells[4].Text;
ds.Tables["CHECKED"].Rows.Add(row);
}
}
//將建立之mailing List DataSet的資料寫入 mailList.xml 檔案
ds.WriteXml(Server.MapPath(Config.Document.Training_Education)+ "/mailList.xml",XmlWriteMode.WriteSchema);
ds.Dispose();
}
catch(Exception ex)
{
Response.Write(ex.Message);
}
讀
DataSet ds = new DataSet();
ds.ReadXml(Server.MapPath(Config.Document.Training_Education)+"/mailList.xml");
December 2,2005
[ASP.Net]CodeBehind web control button結合前瑞javascript的方法
Codebehind的情形之下,利用web form控制項(HTML控制項以伺服器端執行不能run)在中的Attribute屬性,可以和前端的javascript做結合,當我們新增一個Attribute屬性,就代表著最後產生HTML code之後的一個屬性或方法。
常常寫程式會遇到double check的情形以增加程序上的正確性,可利用如下程式碼。
private void Page_Load(object sender, System.EventArgs e)
{
btnSubmit.Attributes.Add("onclick","javascript:return confirm('sure?');");
}
November 28,2005
DataGrid中製作Delete(刪除)按紐
HTML
在DataGrid的asp:ButtonColumn屬性增加下面這一段
<asp:ButtonColumn HeaderText="功能" Text="<div id="de" onclick="JavaScript:return confirm('確定要刪除?')">刪除</div>" CommandName="Delete">
C# CodeBehind
private void dgHR_DeleteCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
{
string key = dgHR.DataKeys[e.Item.ItemIndex].ToString();
string sql = "Delete from ALLIANCE_HR where EMP_NO = '" + key + "'";
SqlConnection conn = new SqlConnection(Config.CONN_STRING);
conn.Open();
SqlCommand cmd = new SqlCommand(sql,conn);
cmd.ExecuteNonQuery();
cmd.Dispose();
conn.Close();
}
November 22,2005
[ASP.Net]Sql Transaction
SqlTransaction myTrans = null;
SqlConnection conn = new SqlConnection(Config.CONN_STRING);
conn.Open();
try
{
myTrans = conn.BeginTransaction();
SqlCommand cmd = new SqlCommand();
cmd.Transaction=myTrans;
cmd.Connection=conn;
string sql = "";
cmd.CommandText=sql;
cmd.ExecuteNonQuery();
myTrans.Commit();
}
catch(Exception exp)
{
myTrans.Rollback();
Response.Write(exp.Message);
}
