目前日期文章:200910 (6)

瀏覽方式: 標題列表 簡短摘要
import math
from time import localtime, strftime

def SimpsonRule(a, b, n):
sum = 0
for i in range(1,n,1):
Xi = a + ((b - a) / n) * i
if (i%2 == 0):
sum += 2 * f(Xi)
else:
sum += 4 * f(Xi)

sum += f(a) + f(b)
sum = sum * (b -a) / (3 * n)

return sum

def f(Xi):
return 1 / (Xi * Xi)

a = 1.0
b = 2.0
n = 60000000

print strftime("%H:%M:%S", localtime())
print SimpsonRule(a, b, n)
print strftime("%H:%M:%S", localtime())

give 發表在 痞客邦 留言(0) 人氣()

前端頁面的Script加上

window.event.returnValue = false;

give 發表在 痞客邦 留言(0) 人氣()

var doc = (from m in db.TblMapMetadata
where m.MapId == MapId
select new { XmlData = m.TWSMPMetadata }).First();

XmlDocument xml = new XmlDocument();
xml.LoadXml(doc.XmlData);

XmlNamespaceManager mgr = new XmlNamespaceManager(xml.NameTable);

mgr.AddNamespace("gco", "http://www.isotc211.org/2005/gco");

XmlNodeList nodes = xml.SelectNodes("//gco:CharacterString", mgr);

foreach (var node in nodes)
{
var n = ((XmlNode)node);
switch (n.ParentNode.Name)
{
case "organisationName":
fUnitName.InnerText = n.InnerText;
break;
case "individualName":
fUserName.InnerText = n.InnerText;
break;
case "positionName":
fUserTitle.InnerText = n.InnerText;
break;
case "voice":
fUserPhone.InnerText = n.InnerText;
break;
case "facsimile":
fUserFax.InnerText = n.InnerText;
break;
case "deliveryPoint":
fUserAddress.InnerText = n.InnerText;
break;
case "electronicMailAddress":
fUserEmail.InnerText = n.InnerText;
break;
};
}

give 發表在 痞客邦 留言(0) 人氣()

// TblApplyTicket 和 TblMapMetadata 是多對多的關係

m-m.png

var result = (
from m in db.TblApplyTicket
from t in m.TblMapMetadata

where m.TblUser.UId == "N125134438"
select new
{
UseRestrict = m.ApplyId.Substring(0, 1),
ApplyId = m.ApplyId,
Status = m.Status,
ApplyDate = m.ApplyDate,
MapId = t.MapId
})
.OrderByDescending(m => m.ApplyDate)
.Take(10)
.ToArray();

give 發表在 痞客邦 留言(0) 人氣()

1. using
using log4net;
using log4net.Config;

2.
#region "LogSetting"
private static readonly log4net.ILog log = log4net.LogManager.GetLogger(typeof(WMSProxy));
private void _LogSetting()
{
log4net.Config.XmlConfigurator.ConfigureAndWatch(new System.IO.FileInfo(AppDomain.CurrentDomain.BaseDirectory + "LogConfig.xml"));
}
#endregion

3. LogConfig.xml

<log4net>

<appender name="RollingFileAppender" type="log4net.Appender.RollingFileAppender">

<file value="C:/tmp/log4net.log" />

<appendToFile value="true" />

<rollingStyle value="Size" />

<maximumFileSize value="2048KB" />

<maxSizeRollBackups value="5" />

<datePattern value="yyyyMMdd-HHmm" />

<layout type="log4net.Layout.PatternLayout">

<conversionPattern value="[%date] [%level] [%logger:%line] %message%newline" />

</layout>

</appender>

<root>

<level value="DEBUG" />

<appender-ref ref="RollingFileAppender" />

</root>

</log4net>

give 發表在 痞客邦 留言(0) 人氣()

程式下載點
http://www.phpletter.com/download_project_version.php?version_id=6

官網範例
http://www.phpletter.com/Our-Projects/AjaxFileUpload/

Server端:
1. 準備一支可以接收檔案的程式, 然後透過System.Web.HttpFileCollection物件來將程式存檔

Client端:
1. 呼叫 $.ajaxFileUpload() 來上傳檔案(參考官網範例)
參數:
url - Server端程式名稱
fileElementId - input id (type='file')
dataType - 'json'
success - 成功時所執行的function
error - 失敗時所執行的function

附註
web.config內可限制檔案上傳的限制

give 發表在 痞客邦 留言(0) 人氣()