
Oxite 是一套微軟新推的開放原始碼的部落格(blogging)平台。
http://visitmix.com/labs/oxite/
包爾伯 發表在 痞客邦 留言(1) 人氣(1,032)
相信有用ASP.NET 2.0的人若是有需要將資料庫資料轉成Excel檔案給別人使用時,有時會因為編碼問題而困擾
因此我把我知道的分享給大家知道一下
若有需要的人就自己拿去用吧
包爾伯 發表在 痞客邦 留言(1) 人氣(2,428)
Dim s As String = “選取的項目:<br>”
For i As Integer = 0 To cblCate.Items.Count - 1
If cblCate.Items(i).Selected Then
‘ List the selected items
s = s & cblCate.Items(i).Text
s = s & “<br>”
End If
Next
Response.Write(s);
包爾伯 發表在 痞客邦 留言(0) 人氣(704)
因為需要將一個資料夾中的txt由亂碼的狀態轉為Utf-8的XML檔
所以把這寫在一起
Dim filePath As String = Server.MapPath(doc + Me.ddlFolder1.SelectedValue + “\”)
Dim dirInfo As New DirectoryInfo(filePath)
Dim fileInfos() As FileInfo = dirInfo.GetFiles(”*.txt”)
Dim file As String = Me.ddlFolder2.SelectedValue
For Each f As FileInfo In fileInfos
Dim filename As String = f.Name
Dim lst As String() = filename.Split(”.”)
Dim strfile As String = lst(0)
Dim strFromPath As String = Server.MapPath(”..\\Data\\TaichungCounty\\”)
Dim strToPath As String = Server.MapPath(”..\\Data\\XML\\”)
Dim strCon As New StreamReader(strFromPath + strfile + “.txt”, System.Text.Encoding.Default)
Dim s As String = strCon.ReadToEnd()
Dim sWriter As New StreamWriter(strToPath + strfile + “.xml”, False, System.Text.Encoding.UTF8)
sWriter.Write(s)
sWriter.Close()
Next
包爾伯 發表在 痞客邦 留言(0) 人氣(1,672)
網路上有很多C#的Sample Code
我就放一個VB.NET的Code
首先 : 製作一支ValidateCode.aspx
=====================================================
包爾伯 發表在 痞客邦 留言(1) 人氣(6,098)
Public Function AppRoot() As String
Dim appRelativeRoot As String = Me.ResolveUrl(”~”)
Dim originalUrl As String = Me.Request.Url.ToString
Dim pos As Integer = originalUrl.IndexOf(appRelativeRoot)
Dim path As String = appRelativeRoot
If pos > 0 Then
path = originalUrl.Substring(0, pos + appRelativeRoot.Length)
End If
Return path
End Function
結果: =http://localhost:2622/
2.可以取得虛擬根目錄
Dim strUrl As String = Request.Url.GetLeftPart(UriPartial.Authority)
結果:strUrl =http://localhost:2622/demo/
包爾伯 發表在 痞客邦 留言(0) 人氣(1,220)
其實這個Free ASP.NET XML component裡面他有很多東西可以用。
Notice: The Chilkat documentation is located at:
http://www.chilkatsoft.com/refdoc
我把我的範例寫出來給大家看,用這寫XML速度很快。
包爾伯 發表在 痞客邦 留言(0) 人氣(1,806)
Dim ds As New DataSet
Dim strurl As String = Server.MapPath(”mod1.xml”)
ds.ReadXml(strurl)
Dim Writer As New XmlTextWriter(Server.MapPath(”mod3.xml”), System.Text.Encoding.UTF8)
Writer.Formatting = System.Xml.Formatting.Indented
Writer.Indentation = 4 // 這個比較重要,這個屬性說明xml文件裡面的內容是按級別縮進的。
//下面開始生成文件的內容
包爾伯 發表在 痞客邦 留言(0) 人氣(1,627)
範例:
要將shp 轉成 txt運用資料夾的功能把檔名抓出來
然後再寫成指令碼
shp2pgsql “D:\Share\Alvin\scbtaiwan\SCB_TWN_grid\大台北\grid” “grid” > D:\Share\Alvin\scbtaiwan\SCB_TWN_grid\大台北\grid.txt”
程式碼如下
Dim filePath As String = Server.MapPath(doc + Me.ddlFolder1.SelectedValue + “\” + Me.ddlFolder2.SelectedValue + “\”)
Dim dirInfo As New DirectoryInfo(filePath)
Dim fileInfos() As FileInfo = dirInfo.GetFiles(”*.shp”)
Dim file As String = Me.ddlFirst.SelectedValue
If file = “0″ Then
file = “”
End If
Dim Ans As String
For Each f As FileInfo In fileInfos
Dim filename As String = f.Name
filename = filename.Replace(”.shp”, “”)
Ans += “shp2pgsql “”" + filePath + filename + “”" “”" + file + filename.Replace(”beijing_”, “”) + “”" > “”" + filePath + filename + “.txt”"
“
Next
Me.Literal1.Text = Ans
包爾伯 發表在 痞客邦 留言(0) 人氣(131)
Displaying the Files in a Directory
Public doc As String = “..\Data\”
Protected Sub ddlFolder1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ddlFolder1.SelectedIndexChanged
Dim filePath As String = Server.MapPath(doc + Me.ddlFolder1.SelectedValue + “\”)
Dim dirInfo As New DirectoryInfo(filePath)
Me.ddlFolder2.DataSource = dirInfo.GetDirectories()
Me.ddlFolder2.DataBind()
End Sub
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not Page.IsPostBack Then
Dim filePath As String = Server.MapPath(doc)
Dim dirInfo As New DirectoryInfo(filePath)
Me.ddlFolder1.DataSource = dirInfo.GetDirectories()
Me.ddlFolder1.DataBind()
End If
End Sub
Protected Sub ddlFolder2_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ddlFolder2.SelectedIndexChanged
Dim filePath As String = Server.MapPath(doc + Me.ddlFolder1.SelectedValue + “\” + Me.ddlFolder2.SelectedValue + “\”)
Dim dirInfo As New DirectoryInfo(filePath)
Me.dlList.DataSource = dirInfo.GetFiles(”*.shp”)
Me.dlList.DataBind()
Me.ddlfiles.DataSource = dirInfo.GetFiles(”*.shp”)
Me.ddlfiles.DataBind()
End Sub
包爾伯 發表在 痞客邦 留言(0) 人氣(167)