1) Go to serverconfig.ini in \MapGuideEnterprise2011\Server\Bin and open in a text editor.
Edit the LicenseServerPath variable to point to your LMTOOLS install. The default for a local install is: LicenseServerPath =@127.0.0.1.
Edit the SerialNumber variable to indicate the serial number in use by LMTOOLS, such as: SerialNumber = 123-12345678
2) Open a text editor and create a licpath.lic file in \MapGuideEnterprise2011\Server. The value after SERVER must match your LicenseServerPath entry. See the example below.
SERVER 127.0.0.1 000000000000
USE_SERVER
3) Restart the MapGuide service (Look under Windows Services)
4) 確認C:\Program Files\Autodesk\MapGuideEnterprise2011\Server路徑下是否存在LICPATH.LIC
若缺此檔案,請建立文字檔並命名為LICPATH.LIC,其內容為:
------------------------------------------------
SERVER 127.0.0.1 000000000000
USE_SERVER
5) Start Map Guide Studio
2011年5月10日 星期二
2011年4月27日 星期三
MgFeatureProperty
MgFeatureProperty is for object properties (ie. You have a feature class that has another nested class definition)
As for the process of adding points. It basically is
1. Create your feature source
1.1 Create a feature class definition for the feature source
1.2 Add any properties to the feature class
1.3 Set the geometry type of the feature class to points
1.4 Save this to a session resource.
1.5 Set the spatial context equal to the SRS of the current MgMap, otherwise the points you insert may not be where you think they are.
2. Create a layer definition that references the created feature source
2.1 Create or load the xml content for this layer definition
2.2 Save this to a session resource.
3. Create an MgInsertFeatures command
3.1 Set the first parameter className = name of your created feature class
3.2 Create a property collection
3.2.1 Fill the property collection with the values you want to insert. Each value corresponds to a property in your feature class.
3.2.2 For the point feature, insert a MgGeometryProperty object. As a MgGeometryProperty requires a MgByteReader for the geometry value, use a MgGeometryFactory to create your MgGeometry object and convert it to a MgByteReader with a MgAgfReaderWriter instance.
3.3 Add this MgInsertFeatures command to your MgFeatureCommandCollection
3.4 Finally, pass this MgFeatureCommandCollection to the UpdateFeatures() method of your MgFeatureService. Also give it the resource id of the feature source you created.
3.5 You may need to close any open MgFeatureReaders in the result of UpdateFeatures(), this is what the code you posted is trying to do.
4. Finally refresh the map on the client side (manual or programmatically) and the point should be there.
That's a high level overview of it all. There may be a few bits that are slightly incorrect, but that is the general process flow.
As for the process of adding points. It basically is
1. Create your feature source
1.1 Create a feature class definition for the feature source
1.2 Add any properties to the feature class
1.3 Set the geometry type of the feature class to points
1.4 Save this to a session resource.
1.5 Set the spatial context equal to the SRS of the current MgMap, otherwise the points you insert may not be where you think they are.
2. Create a layer definition that references the created feature source
2.1 Create or load the xml content for this layer definition
2.2 Save this to a session resource.
3. Create an MgInsertFeatures command
3.1 Set the first parameter className = name of your created feature class
3.2 Create a property collection
3.2.1 Fill the property collection with the values you want to insert. Each value corresponds to a property in your feature class.
3.2.2 For the point feature, insert a MgGeometryProperty object. As a MgGeometryProperty requires a MgByteReader for the geometry value, use a MgGeometryFactory to create your MgGeometry object and convert it to a MgByteReader with a MgAgfReaderWriter instance.
3.3 Add this MgInsertFeatures command to your MgFeatureCommandCollection
3.4 Finally, pass this MgFeatureCommandCollection to the UpdateFeatures() method of your MgFeatureService. Also give it the resource id of the feature source you created.
3.5 You may need to close any open MgFeatureReaders in the result of UpdateFeatures(), this is what the code you posted is trying to do.
4. Finally refresh the map on the client side (manual or programmatically) and the point should be there.
That's a high level overview of it all. There may be a few bits that are slightly incorrect, but that is the general process flow.
於
清晨5:03
2011年4月26日 星期二
Virtual PC LoopBack網卡應用
在上一篇文章中提到 Guest 的網路卡設定可以是對外的(直接使用Host的網卡或使用NAT方式)或是對內的(自建一個私有網路環境),但是如果使用者想自建一個只能與 Host 透過網路溝通且不對外公開的 Guest 環境,那麼不管選擇對外的網路卡或是對內的私有網路都無法達到這樣的需求。這樣的需求通常應用在服務上線前的自我測試環境。
解決這個問題可透過微軟所提供的 Loop Back 網路卡 方式來解決,作業程序如下:
1. 在 Host 作業系統安裝微軟 Loop Back 網卡。
1.1透過 開始-->執行功能執行 hdwwiz.exe 指令開啟新增硬體精靈。
1.2在新增硬體精靈視窗歡迎畫面按 下一步 按鈕。
1.3在精靈協助您安裝其他硬體畫面點選 安裝我從清單中手動選取的硬體(進階選項)(M) 後按 下一步 按鈕。
1.4在一般硬體類型清單中點選 網路介面卡 後按 下一步 按鈕。
1.5在網路介面卡 製造商 清單中點選 Microsoft ,接著在右邊的 網路介面卡 清單中點選 Microsoft Loopback Adapter 後按 下一步 按鈕。
1.6在 要安裝的硬體 畫面按 下一步 按鈕。
1.7在完成新增硬體精靈畫面按 完成 按鈕。此時可查看 Windows 7 控制台-->網路和網際網路-->網路連線的網路連線 會多出一個 區域連線x 無法識別的網路 Microsoft Loopback Adapter 的網路卡圖示。
2.規劃好 Loop Back 網卡使用的虛擬網段(通常使用172, 192,168 等私有網段)及 Host 與 Guest 的虛擬 IP 位址。
3.依規劃設定 Host 作業系統下的 Loop Back 網路卡的 IP 位址及 網路遮罩 (預設匣道器與DNS主機可以不用設)。
4.在 Host 作業系統下將 Guest 的網路卡設定為剛剛所建的 Loopback 網路介面卡,然後在進到 Guest 作業系統中設定該網路卡的 IP 位址(只要設 IP 位址 與 網路遮罩 資料即可)。
解決這個問題可透過微軟所提供的 Loop Back 網路卡 方式來解決,作業程序如下:
1. 在 Host 作業系統安裝微軟 Loop Back 網卡。
1.1透過 開始-->執行功能執行 hdwwiz.exe 指令開啟新增硬體精靈。
1.2在新增硬體精靈視窗歡迎畫面按 下一步 按鈕。
1.3在精靈協助您安裝其他硬體畫面點選 安裝我從清單中手動選取的硬體(進階選項)(M) 後按 下一步 按鈕。
1.4在一般硬體類型清單中點選 網路介面卡 後按 下一步 按鈕。
1.5在網路介面卡 製造商 清單中點選 Microsoft ,接著在右邊的 網路介面卡 清單中點選 Microsoft Loopback Adapter 後按 下一步 按鈕。
1.6在 要安裝的硬體 畫面按 下一步 按鈕。
1.7在完成新增硬體精靈畫面按 完成 按鈕。此時可查看 Windows 7 控制台-->網路和網際網路-->網路連線的網路連線 會多出一個 區域連線x 無法識別的網路 Microsoft Loopback Adapter 的網路卡圖示。
2.規劃好 Loop Back 網卡使用的虛擬網段(通常使用172, 192,168 等私有網段)及 Host 與 Guest 的虛擬 IP 位址。
3.依規劃設定 Host 作業系統下的 Loop Back 網路卡的 IP 位址及 網路遮罩 (預設匣道器與DNS主機可以不用設)。
4.在 Host 作業系統下將 Guest 的網路卡設定為剛剛所建的 Loopback 網路介面卡,然後在進到 Guest 作業系統中設定該網路卡的 IP 位址(只要設 IP 位址 與 網路遮罩 資料即可)。
於
上午8:40
2011年4月12日 星期二
數值資料字串格式化(VB篇)
D 或 d,代表「十進位」。
只有整數類資料型別 (Integral Type) 才支援這個格式。
數值將會被轉換為十進位數 (0-9) 的字串,如果數值為負數,則在前面加上負號。
例如下列範例會使用十進位格式規範格式化:
Dim value As Integer
value = 12345
outputBlock.Text &= value.ToString("D") & vbCrLf
' Displays 12345
outputBlock.Text &= value.ToString("D8") & vbCrLf
' Displays 00012345
value = -12345
outputBlock.Text &= value.ToString("D") & vbCrLf
' Displays -12345
outputBlock.Text &= value.ToString("D8") & vbCrLf
' Displays -0001234
F或f,代表「固定點」。
數字會轉換為 "ddd.ddd..." 型式的字串,其中 "d" 表示數字 (0-9)。
下列範例會使用定點格式規範格式化 Double 和 Int32 值。
Dim integerNumber As Integer
integerNumber = 17843
outputBlock.Text &= String.Format(integerNumber.ToString("F", CultureInfo.InvariantCulture)) & vbCrLf
' Displays 17843.00
integerNumber = -29541
outputBlock.Text &= String.Format(integerNumber.ToString("F3", CultureInfo.InvariantCulture)) & vbCrLf
' Displays -29541.000
Dim doubleNumber As Double
doubleNumber = 18934.1879
outputBlock.Text &= String.Format(doubleNumber.ToString("F", CultureInfo.InvariantCulture)) & vbCrLf
' Displays 18934.19
outputBlock.Text &= String.Format(doubleNumber.ToString("F0", CultureInfo.InvariantCulture)) & vbCrLf
' Displays 18934
doubleNumber = -1898300.1987
outputBlock.Text &= String.Format(doubleNumber.ToString("F1", CultureInfo.InvariantCulture)) & vbCrLf
' Displays -1898300.2
outputBlock.Text &= doubleNumber.ToString("F3", _
New CultureInfo("es-ES")) & vbCrLf
' Displays -1898300,199
N或n,代表數字。
數字會轉換為 "d,ddd,ddd.ddd…" 格式的字串、'd' 表示數字 (0-9)、',' 表示數字群組之間的千位分隔符號,
而 '.' 則表示小數點符號。
下列範例會使用數字格式規範來格式化各種浮點數值
。
Dim dblValue As Double = -12445.6789
outputBlock.Text &= String.Format(dblValue.ToString("N", CultureInfo.InvariantCulture)) & vbCrLf
' Displays -12,445.68
outputBlock.Text &= dblValue.ToString("N1", _
New CultureInfo("sv-SE")) & vbCrLf
' Displays -12?445,7
Dim intValue As Integer = 123456789
outputBlock.Text &= String.Format(intValue.ToString("N1", CultureInfo.InvariantCulture)) & vbCrLf
' Displays 123,456,789.0
P或p,代表百分比
下列範例會使用百分比格式規範來格式化浮點數值。
Dim number As Double = 0.2468013
outputBlock.Text &= String.Format(number.ToString("P", CultureInfo.InvariantCulture)) & vbCrLf
' Displays 24.68 %
outputBlock.Text &= number.ToString("P", _
New CultureInfo("hr-HR")) & vbCrLf
' Displays 24,68%
outputBlock.Text &= String.Format(number.ToString("P1", CultureInfo.InvariantCulture)) & vbCrLf
' Displays 24.7 %
D 或 d,代表「十進位」。
只有整數類資料型別 (Integral Type) 才支援這個格式。
數值將會被轉換為十進位數 (0-9) 的字串,如果數值為負數,則在前面加上負號。
例如下列範例會使用十進位格式規範格式化:
Dim value As Integer
value = 12345
outputBlock.Text &= value.ToString("D") & vbCrLf
' Displays 12345
outputBlock.Text &= value.ToString("D8") & vbCrLf
' Displays 00012345
value = -12345
outputBlock.Text &= value.ToString("D") & vbCrLf
' Displays -12345
outputBlock.Text &= value.ToString("D8") & vbCrLf
' Displays -0001234
F或f,代表「固定點」。
數字會轉換為 "ddd.ddd..." 型式的字串,其中 "d" 表示數字 (0-9)。
下列範例會使用定點格式規範格式化 Double 和 Int32 值。
Dim integerNumber As Integer
integerNumber = 17843
outputBlock.Text &= String.Format(integerNumber.ToString("F", CultureInfo.InvariantCulture)) & vbCrLf
' Displays 17843.00
integerNumber = -29541
outputBlock.Text &= String.Format(integerNumber.ToString("F3", CultureInfo.InvariantCulture)) & vbCrLf
' Displays -29541.000
Dim doubleNumber As Double
doubleNumber = 18934.1879
outputBlock.Text &= String.Format(doubleNumber.ToString("F", CultureInfo.InvariantCulture)) & vbCrLf
' Displays 18934.19
outputBlock.Text &= String.Format(doubleNumber.ToString("F0", CultureInfo.InvariantCulture)) & vbCrLf
' Displays 18934
doubleNumber = -1898300.1987
outputBlock.Text &= String.Format(doubleNumber.ToString("F1", CultureInfo.InvariantCulture)) & vbCrLf
' Displays -1898300.2
outputBlock.Text &= doubleNumber.ToString("F3", _
New CultureInfo("es-ES")) & vbCrLf
' Displays -1898300,199
N或n,代表數字。
數字會轉換為 "d,ddd,ddd.ddd…" 格式的字串、'd' 表示數字 (0-9)、',' 表示數字群組之間的千位分隔符號,
而 '.' 則表示小數點符號。
下列範例會使用數字格式規範來格式化各種浮點數值
。
Dim dblValue As Double = -12445.6789
outputBlock.Text &= String.Format(dblValue.ToString("N", CultureInfo.InvariantCulture)) & vbCrLf
' Displays -12,445.68
outputBlock.Text &= dblValue.ToString("N1", _
New CultureInfo("sv-SE")) & vbCrLf
' Displays -12?445,7
Dim intValue As Integer = 123456789
outputBlock.Text &= String.Format(intValue.ToString("N1", CultureInfo.InvariantCulture)) & vbCrLf
' Displays 123,456,789.0
P或p,代表百分比
下列範例會使用百分比格式規範來格式化浮點數值。
Dim number As Double = 0.2468013
outputBlock.Text &= String.Format(number.ToString("P", CultureInfo.InvariantCulture)) & vbCrLf
' Displays 24.68 %
outputBlock.Text &= number.ToString("P", _
New CultureInfo("hr-HR")) & vbCrLf
' Displays 24,68%
outputBlock.Text &= String.Format(number.ToString("P1", CultureInfo.InvariantCulture)) & vbCrLf
' Displays 24.7 %
於
凌晨12:06
2011年4月11日 星期一
MaxUserPort 和 TcpTimedWaitDelay
TcpTimedWaitDelay
TcpTimedWaitDelay 值決定了 TCP/IP 必須經過多久,才能釋出已關閉的連線及重複使用它的資源。 這個關閉和釋出的間隔稱為 TIME_WAIT 狀態,或是區段生命期限上限 (2MSL) 狀態的兩倍。 在這段時間內,通往用戶端和伺服器的連線重新開啟的成本,比建立新的連線低。 藉由縮減這個項目的值,TCP/IP 可以更快釋出已關閉的連線,提供更多資源給新的連線。 如果執行中的應用程式需要快速釋出、建立新連線,或多個連線在 TIME_WAIT 狀態中造成通訊量太低,因而需要進行調整的話,請調整這個參數。
預設值是 0xF0,它會將等待時間設為 240 秒(4 分鐘)。
最小的建議值是 0x1E,它會將等待時間設為 30 秒。 請利用這個程序來檢視或自訂您的值。
啟動 regedit 指令,瀏覽至HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\TCPIP\Parameters 登錄次機碼,建立名稱為 TcpTimedWaitDelay 的新 REG_DWORD 值。
將值設為十進位 30,也就是十六進位的 0x0000001e。 這個值會將等待時間設為 30 秒。
關閉登錄編輯器。
停止並重新啟動系統。
MaxUserPort
MaxUserPort 值決定了當應用程式向系統要求可用的使用者埠時,TCP/IP 所能指派的最高埠號。 如果您的系統報告建立 Socket 時,發生錯誤異常狀況,可能是匿名(短期)埠的數量不當所造成,當系統開啟大量的埠來建立 Web 服務、資料庫或其他遠端資源的連線時,尤其如此。
依預設,Windows 會保留埠號 1024 至 5000,供匿名(短期)埠使用
一般作法是將這個值設成 32768。 請利用這個程序來檢視或自訂您的值。
啟動 regedit 指令,瀏覽至HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\TCPIP\Parameters 登錄次機碼,建立名稱為 MaxUserPort 的新 REG_DWORD 值。
將這個值設成至少十進位 32768。
關閉登錄編輯器。
停止並重新啟動系統。
TcpTimedWaitDelay 值決定了 TCP/IP 必須經過多久,才能釋出已關閉的連線及重複使用它的資源。 這個關閉和釋出的間隔稱為 TIME_WAIT 狀態,或是區段生命期限上限 (2MSL) 狀態的兩倍。 在這段時間內,通往用戶端和伺服器的連線重新開啟的成本,比建立新的連線低。 藉由縮減這個項目的值,TCP/IP 可以更快釋出已關閉的連線,提供更多資源給新的連線。 如果執行中的應用程式需要快速釋出、建立新連線,或多個連線在 TIME_WAIT 狀態中造成通訊量太低,因而需要進行調整的話,請調整這個參數。
預設值是 0xF0,它會將等待時間設為 240 秒(4 分鐘)。
最小的建議值是 0x1E,它會將等待時間設為 30 秒。 請利用這個程序來檢視或自訂您的值。
啟動 regedit 指令,瀏覽至HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\TCPIP\Parameters 登錄次機碼,建立名稱為 TcpTimedWaitDelay 的新 REG_DWORD 值。
將值設為十進位 30,也就是十六進位的 0x0000001e。 這個值會將等待時間設為 30 秒。
關閉登錄編輯器。
停止並重新啟動系統。
MaxUserPort
MaxUserPort 值決定了當應用程式向系統要求可用的使用者埠時,TCP/IP 所能指派的最高埠號。 如果您的系統報告建立 Socket 時,發生錯誤異常狀況,可能是匿名(短期)埠的數量不當所造成,當系統開啟大量的埠來建立 Web 服務、資料庫或其他遠端資源的連線時,尤其如此。
依預設,Windows 會保留埠號 1024 至 5000,供匿名(短期)埠使用
一般作法是將這個值設成 32768。 請利用這個程序來檢視或自訂您的值。
啟動 regedit 指令,瀏覽至HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\TCPIP\Parameters 登錄次機碼,建立名稱為 MaxUserPort 的新 REG_DWORD 值。
將這個值設成至少十進位 32768。
關閉登錄編輯器。
停止並重新啟動系統。
於
凌晨12:50
2011年4月8日 星期五
2011年3月24日 星期四
Bt連線相關設定
二、連接數量設定(本項設定影響下載速度、及下載當中的網路使用關係極大):
連接數量設定,是依下載時來源種子、及列隊客戶端(即上傳連接者)實際數量而定。
不能一昧設定到最大值,以免開啟BT時,干擾正常的網路活動。
對照下面的舊圖做說明----(原以英文版下載,為方便說明,加上繁中名辭對照)
a. 整体最大連接數的設定:
如果同時下載多個資源(torrents),建議連接數至多開至1500。
對照上圖,單一檔案下載,「可能達到的」來源就有7318個;如同時下載五個檔案,其「
可能達到的」來源,假設都是千個以上。這時,整体最大連接數,還是建議開1500就足夠。
相反的,資源數極少,下載五個檔,總數只有五十、或一百、或兩百、300,那麼將整体最
大連接數再加 20% 就太夠了。
b. 每個Torrent的下載(使用者,即Peers )連接數:
對照上圖:偵測到的可能來源7318,已連接的可下載來源325(雖然連接到了,但並不代
表325個來源,每個都正在提供我們下載資源。 )
設定:建議最大值設500即可(我的習慣是單一下載,至多設500;多重下載,每個Torrent
的下載數至多設300。)設太少,可能會失去連接「大水管」的機會。
c. 每個Torrent上傳(種子,即Seeds)連接數:
對照上圖:可看到1023正渴望由我們這裏得到資源,其中52個已與我們連接(同樣的,這
52 個飢渴的傢伙,並非個個正由我們傳輸資源給他們。)
設定:取 b 的五分之一夠了。
三、Trackers(伺服器)適度增加(本項設定影響下載速度最大) :
同樣條件,BT下載有人是牛步,有人如飛翔,差別就在「有沒有增加Trackers」。這也是BT
生手最大的的盲點:生手根本不知道什麼叫Trackers,更遑論增加BT Trackers數量。而熟手
認定這是理所當然,根本懶得說明。
更好笑的是:只要生手問到如何增加BT速度,熟手一定會故意誤導大家往奇奇怪怪的地方鑽
、鑽、鑽.......再有志一同,「都」不小心漏提TRAKERS,讓生手永遠無解~
連接數量設定,是依下載時來源種子、及列隊客戶端(即上傳連接者)實際數量而定。
不能一昧設定到最大值,以免開啟BT時,干擾正常的網路活動。
對照下面的舊圖做說明----(原以英文版下載,為方便說明,加上繁中名辭對照)
a. 整体最大連接數的設定:
如果同時下載多個資源(torrents),建議連接數至多開至1500。
對照上圖,單一檔案下載,「可能達到的」來源就有7318個;如同時下載五個檔案,其「
可能達到的」來源,假設都是千個以上。這時,整体最大連接數,還是建議開1500就足夠。
相反的,資源數極少,下載五個檔,總數只有五十、或一百、或兩百、300,那麼將整体最
大連接數再加 20% 就太夠了。
b. 每個Torrent的下載(使用者,即Peers )連接數:
對照上圖:偵測到的可能來源7318,已連接的可下載來源325(雖然連接到了,但並不代
表325個來源,每個都正在提供我們下載資源。 )
設定:建議最大值設500即可(我的習慣是單一下載,至多設500;多重下載,每個Torrent
的下載數至多設300。)設太少,可能會失去連接「大水管」的機會。
c. 每個Torrent上傳(種子,即Seeds)連接數:
對照上圖:可看到1023正渴望由我們這裏得到資源,其中52個已與我們連接(同樣的,這
52 個飢渴的傢伙,並非個個正由我們傳輸資源給他們。)
設定:取 b 的五分之一夠了。
三、Trackers(伺服器)適度增加(本項設定影響下載速度最大) :
同樣條件,BT下載有人是牛步,有人如飛翔,差別就在「有沒有增加Trackers」。這也是BT
生手最大的的盲點:生手根本不知道什麼叫Trackers,更遑論增加BT Trackers數量。而熟手
認定這是理所當然,根本懶得說明。
更好笑的是:只要生手問到如何增加BT速度,熟手一定會故意誤導大家往奇奇怪怪的地方鑽
、鑽、鑽.......再有志一同,「都」不小心漏提TRAKERS,讓生手永遠無解~
於
上午10:38
訂閱:
文章 (Atom)