tag:blogger.com,1999:blog-5458331244641854812024-03-05T14:02:03.193-06:00GIS and Remote Sensing Tools, Tips and more ..Rambling thoughts on GIS and Remote sensing tools, Data visualization, Geospatial application development, GIS programming/scripts and spatial technologies....
Adminhttp://www.blogger.com/profile/17622977804566362679noreply@blogger.comBlogger230125tag:blogger.com,1999:blog-545833124464185481.post-47379045450584241932021-12-02T11:23:00.006-06:002021-12-02T11:23:37.671-06:00Instruct GIT not to track a specific file<p>In scenarios like you have a configuration file in a remote repo for the production environment, and you don’t want to commit the changes to this configuration file made from local. </p><p>How do you instruct git to do not track the local changes?</p><p><b><span style="color: #2b00fe;">--skip-worktree</span> </b>is what you need.</p><p><span style="color: #2b00fe;"><b>git update-index --skip-worktree <filepath/file_name></b></span></p><p>After index update git won't show you the file in working tree.</p><p><br /></p><p>If you want to track the changes update-index as </p><p><b style="color: #2b00fe;">git update-index --no-skip-worktree <filepath/file_name></b></p>Adminhttp://www.blogger.com/profile/17622977804566362679noreply@blogger.com0tag:blogger.com,1999:blog-545833124464185481.post-66381448927977966722021-11-19T10:09:00.000-06:002021-11-19T10:09:10.494-06:00Update WPF Interaction Triggers in from .Net Framework 4.8 to .Net 5<p> </p><p class="MsoNormal">When migrating the Visual Studio projects from .Net
Framework 4.8 to .Net 5, you may encounter <span style="mso-spacerun: yes;"> </span>in the following error regarding <b>Interaction.Triggers</b>.<o:p></o:p></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"><span style="color: red; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;"><o:p> </o:p></span><b>Error XDG0008 The name "Interaction"
does not exist in the namespace
"http://schemas.microsoft.com/xaml/behaviors".</b></p><p class="MsoNormal"><o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p>The one solution to fix it is to install “<b>Microsoft.Xaml.Behaviors.Wpf</b>”
from Nuget</p><p class="MsoNormal"><o:p></o:p></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;">And update the namespace ( if needed)<o:p></o:p></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none; text-indent: .5in;"><span style="color: red; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">xmlns</span><span style="color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">:</span><span style="color: red; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">i</span><span style="color: blue; font-family: Consolas; font-size: 9.5pt; mso-bidi-font-family: Consolas;">="http://schemas.microsoft.com/expression/2010/interactivity"</span><o:p></o:p></p>
<p class="MsoNormal">to<o:p></o:p></p>
<p class="MsoNormal"><span style="mso-spacerun: yes;"> </span><span style="color: red; font-family: Consolas; font-size: 9.5pt; line-height: 107%;">xmlns:i</span><span style="color: blue; font-family: Consolas; font-size: 9.5pt; line-height: 107%;">="http://schemas.microsoft.com/xaml/behaviors"</span><span style="font-family: Consolas; font-size: 9.5pt; line-height: 107%;"><o:p></o:p></span></p>Adminhttp://www.blogger.com/profile/17622977804566362679noreply@blogger.com0tag:blogger.com,1999:blog-545833124464185481.post-6340241348506087022021-01-28T10:35:00.004-06:002021-01-28T10:35:38.166-06:00[Snippet] Add/Remove an Assembly to/from the Global Assembly Cache using C#.Net<p> </p><p><br /></p><p>Code snippets to add remove an assembly from GAC - </p><p>Add reference to - <b>System.EnterpriseServices</b></p><p><b>using System.EnterpriseServices.Internal;</b></p><p><br /></p><p>var path = "the absolute path of assembly";</p><div> Publish publish = new Publish();</div><p> publish.GacInstall(path);</p><div><div> publish.GacRemove(path);</div></div><div><br /></div><p>Reference:</p><p><a href="https://docs.microsoft.com/en-us/dotnet/framework/app-domains/install-assembly-into-gac#global-assembly-cache-tool">https://docs.microsoft.com/en-us/dotnet/framework/app-domains/install-assembly-into-gac#global-assembly-cache-tool</a></p><p><a href="https://docs.microsoft.com/en-us/dotnet/framework/app-domains/how-to-remove-an-assembly-from-the-gac">https://docs.microsoft.com/en-us/dotnet/framework/app-domains/how-to-remove-an-assembly-from-the-gac</a></p>Adminhttp://www.blogger.com/profile/17622977804566362679noreply@blogger.com0tag:blogger.com,1999:blog-545833124464185481.post-57786311816081739262020-12-16T13:42:00.001-06:002020-12-16T13:42:14.584-06:00[Code Snippet] : Connect to Sql Server from ArcObject<p> using System;</p><p>using ESRI.ArcGIS.DataSourcesFile;</p><p>using ESRI.ArcGIS.esriSystem;</p><p>using ESRI.ArcGIS.Geodatabase;</p><p><br /></p><p>namespace MyNamespace</p><p>{</p><p> class MyProgram</p><p> {</p><p> private static LicenseInitializer _licenseInitializer = new LicenseInitializer();</p><p><br /></p><p> [STAThread()]</p><p> static void Main(string[] args)</p><p> {</p><p> _licenseInitializer.InitializeApplication(new esriLicenseProductCode[] { esriLicenseProductCode.esriLicenseProductCodeEngineGeoDB },</p><p> new esriLicenseExtensionCode[] { });</p><p><br /></p><p> Type factoryType = Type.GetTypeFromProgID("esriDataSourcesGDB.SqlWorkspaceFactory");</p><p> IPropertySet propertySet = new PropertySetClass();</p><p> propertySet.SetProperty("SERVER", "<b><span style="color: red;">servername</span></b>");</p><p> propertySet.SetProperty("INSTANCE", "sde:sqlserver:<b><span style="color: red;">servername</span></b>");</p><p> propertySet.SetProperty("AUTHENTICATION_MODE", "DBMS");</p><p><span> </span>// propertySet.SetProperty("AUTHENTICATION_MODE", "OSA");</p><p> propertySet.SetProperty("DATABASE", "test1");</p><p> propertySet.SetProperty("USER", "<b><span style="color: red;">username</span></b>");</p><p> propertySet.SetProperty("PASSWORD", "<b><span style="color: red;">password</span></b>");</p><p> propertySet.SetProperty("VERSION", "sde.DEFAULT");</p><p><br /></p><p> IWorkspaceFactory workspaceFactory = new SDCWorkspaceFactory();</p><p> IWorkspace workspace = workspaceFactory.Open(propertySet, 0);</p><p> }</p><p> }</p><p>}</p><div><br /></div>Adminhttp://www.blogger.com/profile/17622977804566362679noreply@blogger.com0tag:blogger.com,1999:blog-545833124464185481.post-14393586150887943742020-12-11T11:50:00.002-06:002020-12-11T11:50:38.534-06:00[Code Snippet] Assert.Throws on Exception and Derived Type Nunit<p> Code snippet for asserting throw in ArgumentException and its derived types(such as ArgumentNullException) in Nunit - </p><p>public void Test(){</p><p>Assert.Throws(Is.InstanceOf<ArgumentException>(), () =>{</p><p><span> </span>//SUT code</p><p>});</p><p>}</p>Adminhttp://www.blogger.com/profile/17622977804566362679noreply@blogger.com0tag:blogger.com,1999:blog-545833124464185481.post-20823544072174647762020-05-11T14:35:00.001-05:002020-05-11T14:35:59.113-05:00[Code snippet] How to set value of private variable in Unit Test Using Reflection ?<div dir="ltr" style="text-align: left;" trbidi="on">
A sample example to set private variable to true from unit test class in C#.Net<br />
<br />
//TestService.cs<br />
public class <b>TestService</b><br />
{<br />
private bool <b>_isInitialized </b>= false;<br />
}<br />
<br />
<br />
<br />
//TestServiceUnitTest.cs<br />
using System.Reflection;<br />
<br />
public class TestServiceUnitTest<br />
{<br />
private <b>TestService _testService</b>;<br />
<br />
[TestInitalize]<br />
private void testInitalize()<br />
{<br />
<b>_testService </b>= new TestService();<br />
}<br />
<br />
[TestMethod]<br />
Private void SetInitializeToTrue()<br />
{<br />
FieldInfo field = typeof(TestService).GetField("<b>_isInitialized</b>", BindingFlags.NonPublic | BindingFlags.Instance);<br />
<br />
<div>
field.SetValue(<b>_testService </b>, <b>true</b>);</div>
<div>
<br /></div>
}<br />
<div>
}</div>
</div>
Adminhttp://www.blogger.com/profile/17622977804566362679noreply@blogger.com0tag:blogger.com,1999:blog-545833124464185481.post-66928841039739866142020-04-22T13:51:00.005-05:002020-05-11T14:35:47.696-05:00[Code Snippet] Assert Exception in private methods using PrivateObject<div dir="ltr" style="text-align: left;" trbidi="on">
<b>NON ASYNC Method</b><br />
<br />
<b>Method.cs</b><br />
<br />
private MyMethod(object value1)<br />
{<br />
if(value1 == null)<br />
{<br />
throw new ArgumentNullException(nameof(MyMethod));<br />
}<br />
}<br />
<br />
<b>Test.Cs</b><br />
<br />
[TestMethod]<br />
public void MyMethod_Throws_Verify()<br />
{<br />
PrivateObject po = new PrivateObject(new Method())<br />
<br />
TargetInvocationException exception = Assert.ThrowsException<TargetInvocationException>(() =><br />
privateObject.Invoke("MyMethod", new object[] { null }));<br />
<br />
Assert.AreEqual(typeof(ArgumentNullException), exception.InnerException.GetType());<br />
<br />
}<br />
<br />
<br />
<a name='more'></a><br />
<br />
<b>ASYNC METHOD</b><br />
<b><br /></b>
<b>MethodAsync.cs</b><br />
private async MyMethod(object value1)<br />
{<br />
if(value1 == null)<br />
{<br />
throw new ArgumentNullException(nameof(MyMethod));<br />
}<br />
}<br />
<b><br /></b>
<b>TestAsync.cs</b><br />
<b><br /></b>
[TestMethod]<br />
public <b>async Task </b>MyMethod_Throws_Verify()<br />
{<br />
PrivateObject po = new PrivateObject(new Method())<br />
<br />
var exception = <b>await </b>Assert.<b>ThrowsExceptionAsync</b><TargetInvocationException>( <b>async </b>() =><br />
privateObject.Invoke("MyMethod", new object[] { null }));<br />
<br />
Assert.AreEqual(typeof(ArgumentNullException), exception.InnerException.GetType());<br />
<br />
}<br />
<br />
<b><br /></b>
<b><br /></b>
<b><br /></b>
<b><br /></b>
<b><br /></b>
<b><br /></b>
<b><br /></b>
<b><br /></b>
<b><br /></b>
<b><br /></b>
<b><br /></b></div>
Adminhttp://www.blogger.com/profile/17622977804566362679noreply@blogger.com1tag:blogger.com,1999:blog-545833124464185481.post-54198860147384106602019-09-24T14:05:00.001-05:002019-09-24T19:47:55.050-05:00[Code Snippet] Example of using Delegate, Func and Action side by side in C#<div dir="ltr" style="text-align: left;" trbidi="on">
Quick and dirty example of using Delegate, Func and Action<br />
side by side in C# to show how to use function pointer or callback in C#<br />
<br />
<br />
Example #1 Delegate and Func side by side<br />
<br />
static int <b><span style="color: blue;">DoubleTheValue</span></b>(int x)<br />
{<br />
return x * 2;<br />
}<br />
<br />
// delegate type should match the function signature - <span style="color: blue;">DoubleTheValue</span><br />
public <b>delegate </b>int <b><span style="color: red;">functionDelegateType</span></b>(int x);<br />
<br />
static void <b>Method1</b>(<span style="color: red;">functionDelegateType </span>func)<br />
{<br />
int doubleValue = func(5);<br />
}<br />
<br />
<br />
static void <b>Method2</b>(Func<int, int> func) // easier syntax<br />
{<br />
int doubleValue = func(5);<br />
}<br />
<br />
static void Main(string[] args)<br />
{<br />
<b>Method1</b>(<span style="background-color: white;"><span style="color: blue;">DoubleTheValue</span></span>);<br />
<br />
<b>Method2</b>(<span style="color: blue;">DoubleTheValue</span>);<br />
}<br />
<br />
Example #2 Delegate and Action side by side<br />
<br />
<span style="white-space: pre;"> </span>static void <b><span style="color: blue;">DisplayOnConsole</span></b>(int x)<br />
{<br />
Console.WriteLine(x.ToString());<br />
}<br />
<br />
// delegate type should match the function signature - DisplayOnConsole<br />
public delegate void <b><span style="color: red;">functionDelegateType </span></b>(int x);<br />
static void <b>Method1</b>(<span style="color: red;">functionDelegateType </span>func)<br />
{<br />
func(5);<br />
}<br />
<br />
<br />
static void <b>Method2</b>(Action<int> func) // easier syntax<br />
{<br />
func(5);<br />
}<br />
<br />
<br />
static void Main(string[] args)<br />
{<br />
<b>Method1</b>(<span style="color: blue;">DisplayOnConsole</span>);<br />
<b>Method2</b>(<span style="color: blue;">DisplayOnConsole</span>);<br />
}<br />
<br />
Reference:<br />
<a href="https://social.msdn.microsoft.com/Forums/vstudio/en-US/a1ac99ed-0801-4773-a866-4223d42422cf/how-to-pass-function-as-an-argument-to-another-function-in-c?forum=csharpgeneral">https://social.msdn.microsoft.com/Forums/vstudio/en-US/a1ac99ed-0801-4773-a866-4223d42422cf/how-to-pass-function-as-an-argument-to-another-function-in-c?forum=csharpgeneral</a></div>
Adminhttp://www.blogger.com/profile/17622977804566362679noreply@blogger.com0tag:blogger.com,1999:blog-545833124464185481.post-11615953445362341492019-09-03T14:52:00.002-05:002019-09-03T14:52:54.992-05:00[Code snippet] INotifyPropertyChanged in the model and subscribed the PropertyChanged event of the model in ViewModel<div dir="ltr" style="text-align: left;" trbidi="on">
<pre lang="cs"><span class="code-keyword">internal</span> <span class="code-keyword">class</span> Model:INotifyPropertyChanged
{
<span class="code-keyword">public</span> Model()
{
}
<span class="code-keyword">string</span> _FirstName = <span class="code-string">"</span><span class="code-string">Shahir"</span>;
<span class="code-keyword">public</span> <span class="code-keyword">string</span> FirstName
{
<span class="code-keyword">get</span> { <span class="code-keyword">return</span> _FirstName; }
<span class="code-keyword">set</span>
{
_FirstName = <span class="code-sdkkeyword">value</span>;
OnPropertyChanged();
}
}
<span class="code-keyword">public</span> <span class="code-keyword">event</span> PropertyChangedEventHandler PropertyChanged;
<span class="code-keyword">private</span> <span class="code-keyword">void</span> OnPropertyChanged([CallerMemberName] <span class="code-keyword">string</span> propertyName = <span class="code-string">"</span><span class="code-string">"</span>)
{
<span class="code-keyword">if</span>(PropertyChanged!=<span class="code-keyword">null</span>)
{
PropertyChanged(<span class="code-keyword">this</span>, <span class="code-keyword">new</span> PropertyChangedEventArgs(propertyName));
}
}
}</pre>
<br />
<br />
<pre lang="cs"><span class="code-keyword">internal</span> <span class="code-keyword">class</span> MyViewModel:INotifyPropertyChanged
{
<span class="code-keyword">private</span> Model myModel;
<span class="code-keyword">public</span> MyViewModel(Model model)
{
<span class="code-keyword">this</span>.myModel = model;
myModel.PropertyChanged += myModel_PropertyChanged;
}
<span class="code-keyword">public</span> <span class="code-keyword">event</span> PropertyChangedEventHandler PropertyChanged;
<span class="code-keyword">private</span> <span class="code-keyword">void</span> OnPropertyChanged([CallerMemberName] <span class="code-keyword">string</span> propertyName = <span class="code-string">"</span><span class="code-string">"</span>)
{
<span class="code-keyword">if</span> (PropertyChanged != <span class="code-keyword">null</span>)
{
PropertyChanged(<span class="code-keyword">this</span>, <span class="code-keyword">new</span> PropertyChangedEventArgs(propertyName));
}
}
<span class="code-keyword">string</span> _FirstName;
<span class="code-keyword">public</span> <span class="code-keyword">string</span> MyFirstName
{
<span class="code-keyword">get</span> { <span class="code-keyword">return</span> myModel.FirstName; }
<span class="code-keyword">set</span>
{
_FirstName = <span class="code-sdkkeyword">value</span>;
OnPropertyChanged();
}
}
<span class="code-keyword">private</span> <span class="code-keyword">void</span> myModel_PropertyChanged(<span class="code-keyword">object</span> sender, System.ComponentModel.PropertyChangedEventArgs e)
{
<span class="code-keyword">if</span> (e.PropertyName == <span class="code-string">"</span><span class="code-string">FirstName"</span>)
{
MyFirstName = myModel.FirstName;
}
}
}</pre>
<pre lang="cs">
</pre>
<pre lang="cs">REFERECE - <a href="https://www.codeproject.com/Questions/1055820/How-the-Model-changes-could-be-notified-to-ViewMod">https://www.codeproject.com/Questions/1055820/How-the-Model-changes-could-be-notified-to-ViewMod</a></pre>
</div>
Adminhttp://www.blogger.com/profile/17622977804566362679noreply@blogger.com0tag:blogger.com,1999:blog-545833124464185481.post-76223826420300632182019-08-20T10:27:00.000-05:002019-08-20T10:27:06.642-05:00Code snippet: ArcGIS Runtime 100.x Geodatabase Delta Sync<div dir="ltr" style="text-align: left;" trbidi="on">
<b>ESRI namespaces</b><br />
<b><br /></b>
using Esri.ArcGISRuntime.Tasks.Offline;<br />
using Esri.ArcGISRuntime.Data;<br />
using Esri.ArcGISRuntime.Tasks;<br />
using Esri.ArcGISRuntime.Http;<br />
<br />
<br />
<br />
<b>Code snippet</b><br />
<b><br /></b>
string localGeodatabaseName = @"C:\Data\test.geodatabase";<br />
<br />
string deltaGeodatabaseName = @"C:\Deltas\_ags_data{52DwertD40459D02EC197E5EC12C}.geodatabase";<br />
<br />
Task<IReadOnlyList<SyncLayerResult>> syncTaskResult = <b>GeodatabaseSyncTask.ImportGeodatabaseDeltaAsync</b>(localGeodatabaseName , deltaGeodatabaseName );<br />
<div>
<br /></div>
</div>
Adminhttp://www.blogger.com/profile/17622977804566362679noreply@blogger.com0tag:blogger.com,1999:blog-545833124464185481.post-37596013995892096432019-08-20T10:14:00.000-05:002019-08-20T10:14:32.153-05:00Code snippet: HTTP call to ArcGIS server from ArcGIS Runtime Enviroment 100.x<div dir="ltr" style="text-align: left;" trbidi="on">
<b>Required namespaces - </b><br />
<br />
using System.Net.Http;<br />
using Esri.ArcGISRuntime.Http;<br />
<br />
<div>
<div>
using Newtonsoft.Json; //To parse the response</div>
</div>
<div>
<br /></div>
<div>
<b>Code snippet - </b></div>
<div>
<br /></div>
<div>
<div>
Uri requestUri = new Uri(serviceUrl +"?f=pjson");</div>
<div>
<br /></div>
<div>
//Default HttpClient handler which also handles the ArcGIS server Identity</div>
<div>
ArcGISHttpClientHandler handler = new ArcGISHttpClientHandler() </div>
<div>
{ UseDefaultCredentials = true };</div>
<div>
<br /></div>
<div>
HttpClient client = new HttpClient(handler);</div>
<div>
<br /></div>
<div>
string serverResponseJsonString = await client.GetStringAsync(requestUri);</div>
<div>
<br /></div>
<div>
Console.WriteLine(serverResponseJsonString ); </div>
<div>
</div>
<div>
<br /></div>
<div>
//Convert respones string to JSON Object, optional</div>
<div>
ArcGisServerResponse serverResponseJson = JsonConvert.DeserializeObject<ArcGisServerResponse>(serverResponseJsonString);</div>
</div>
<div>
<br /></div>
<div>
<br /></div>
</div>
Adminhttp://www.blogger.com/profile/17622977804566362679noreply@blogger.com0tag:blogger.com,1999:blog-545833124464185481.post-72388047903750580962019-06-15T09:36:00.001-05:002019-06-15T09:36:21.835-05:00Flavours of .NET implementation<div dir="ltr" style="text-align: left;" trbidi="on">
<br /><table class="charttable" style="background-color: white; border-collapse: collapse; border-spacing: 0px; border: 1px solid silver; box-sizing: border-box; color: #3b3b3b; font-family: "Segoe UI", "Lucida Grande", Verdana, Arial, Helvetica, sans-serif; font-size: 18px; margin: 0px; outline: 0px; padding: 0px; width: 834.4px;" summary="table"><tbody style="border: 0px; box-sizing: border-box; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;">
<tr style="border: 0px; box-sizing: border-box; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;"><td style="border-collapse: collapse; border: 1px solid silver; box-sizing: border-box; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 3px; vertical-align: middle;"> </td><td style="border-collapse: collapse; border: 1px solid silver; box-sizing: border-box; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 3px; vertical-align: middle;">OS</td><td style="border-collapse: collapse; border: 1px solid silver; box-sizing: border-box; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 3px; vertical-align: middle;">Open Source</td><td style="border-collapse: collapse; border: 1px solid silver; box-sizing: border-box; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 3px; vertical-align: middle;">Purpose</td></tr>
<tr style="border: 0px; box-sizing: border-box; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;"><td style="border-collapse: collapse; border: 1px solid silver; box-sizing: border-box; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 3px; vertical-align: middle;">.NET Framework</td><td style="border-collapse: collapse; border: 1px solid silver; box-sizing: border-box; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 3px; vertical-align: middle;">Windows</td><td style="border-collapse: collapse; border: 1px solid silver; box-sizing: border-box; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 3px; vertical-align: middle;">No</td><td style="border-collapse: collapse; border: 1px solid silver; box-sizing: border-box; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 3px; vertical-align: middle;">Used for building Windows desktop applications and ASP.NET Web apps running on IIS.</td></tr>
<tr style="border: 0px; box-sizing: border-box; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;"><td style="border-collapse: collapse; border: 1px solid silver; box-sizing: border-box; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 3px; vertical-align: middle;">.NET Core</td><td style="border-collapse: collapse; border: 1px solid silver; box-sizing: border-box; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 3px; vertical-align: middle;">Windows, Linux, macOS</td><td style="border-collapse: collapse; border: 1px solid silver; box-sizing: border-box; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 3px; vertical-align: middle;">Yes</td><td style="border-collapse: collapse; border: 1px solid silver; box-sizing: border-box; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 3px; vertical-align: middle;">Used for building cross-platform console apps and ASP.NET Core Web apps and cloud services.</td></tr>
<tr style="border: 0px; box-sizing: border-box; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;"><td style="border-collapse: collapse; border: 1px solid silver; box-sizing: border-box; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 3px; vertical-align: middle;">Xamarin</td><td style="border-collapse: collapse; border: 1px solid silver; box-sizing: border-box; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 3px; vertical-align: middle;">iOS, Android, macOS</td><td style="border-collapse: collapse; border: 1px solid silver; box-sizing: border-box; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 3px; vertical-align: middle;">Yes</td><td style="border-collapse: collapse; border: 1px solid silver; box-sizing: border-box; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 3px; vertical-align: middle;">Used for building mobile applications for iOS and Android, as well as desktop apps for macOS.</td></tr>
<tr style="border: 0px; box-sizing: border-box; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px;"><td style="border-collapse: collapse; border: 1px solid silver; box-sizing: border-box; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 3px; vertical-align: middle;">.NET Standard</td><td style="border-collapse: collapse; border: 1px solid silver; box-sizing: border-box; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 3px; vertical-align: middle;">N/A</td><td style="border-collapse: collapse; border: 1px solid silver; box-sizing: border-box; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 3px; vertical-align: middle;">Yes</td><td style="border-collapse: collapse; border: 1px solid silver; box-sizing: border-box; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 3px; vertical-align: middle;">Used for building libraries that can be referenced from all .NET implementations, such as .NET Framework, .NET Core and Xamarin.<br /></td></tr>
</tbody></table>
<br /><div>
Ref - <a href="https://msdn.microsoft.com/en-us/magazine/mt842506.aspx">https://msdn.microsoft.com/en-us/magazine/mt842506.aspx</a></div>
<div>
<br /></div>
</div>
Adminhttp://www.blogger.com/profile/17622977804566362679noreply@blogger.com0tag:blogger.com,1999:blog-545833124464185481.post-35715928305872733732019-05-19T23:45:00.000-05:002019-05-19T23:52:44.838-05:00Code Snippet: ESRI JS API 4.11 get Latittude Longitude on mouse hover<div dir="ltr" style="text-align: left;" trbidi="on">
ESRI JS API 4.11 get Latittude Longitude on mouse hover<br />
<br />
<br />
<span style="background-color: #1e1e1e; color: #9cdcfe; font-family: consolas, "courier new", monospace; font-size: 14px; white-space: pre;">//print point on mouse hover on map</span><br />
<div dir="ltr" style="text-align: left;" trbidi="on">
<div style="background-color: #1e1e1e; font-family: consolas, "courier new", monospace; font-size: 14px; line-height: 19px; white-space: pre;">
<div>
<span style="color: #9cdcfe;"><br /></span><span style="color: #9cdcfe;"><br /><br /><br /><br /></span>
<br />
<div style="color: #d4d4d4;">
<span style="color: #9cdcfe;">mapView</span>.<span style="color: #dcdcaa;">on</span>(<span style="color: #ce9178;">"pointer-move"</span>, <span style="color: #569cd6;">function</span>(<span style="color: #9cdcfe;">event</span>){</div>
</div>
<div style="color: #d4d4d4;">
<span style="color: #569cd6;">let</span> <span style="color: #9cdcfe;">mapPoint</span> = <span style="color: #9cdcfe;">mapView</span>.<span style="color: #dcdcaa;">toMap</span>({<span style="color: #9cdcfe;">x:</span> <span style="color: #9cdcfe;">event</span>.<span style="color: #9cdcfe;">x</span>, <span style="color: #9cdcfe;">y:</span> <span style="color: #9cdcfe;">event</span>.<span style="color: #9cdcfe;">y</span>});</div>
<div style="color: #d4d4d4;">
<span style="color: #4ec9b0;">console</span>.<span style="color: #dcdcaa;">log</span>(<span style="color: #9cdcfe;">mapPoint</span>); </div>
<div style="color: #d4d4d4;">
});</div>
<div style="color: #d4d4d4;">
<br /></div>
<div style="color: #d4d4d4;">
<br /></div>
<div style="color: #d4d4d4;">
<br /></div>
<div style="color: #d4d4d4;">
<br /></div>
<div style="color: #d4d4d4;">
//print point on mouse click on map</div>
<div style="color: #d4d4d4;">
<br /></div>
<div style="color: #d4d4d4;">
<span style="color: #9cdcfe;">mapView</span>.<span style="color: #dcdcaa;">on</span>(<span style="color: #ce9178;">"click"</span>, <span style="color: #569cd6;">function</span>(<span style="color: #9cdcfe;">event</span>){</div>
<div style="color: #d4d4d4;">
<span style="color: #569cd6;">let</span> <span style="color: #9cdcfe;">mapPoint</span> = <span style="color: #9cdcfe;">event</span>.<span style="color: #9cdcfe;">mapPoint</span>;</div>
<div style="color: #d4d4d4;">
<span style="color: #4ec9b0;">console</span>.<span style="color: #dcdcaa;">log</span>(<span style="color: #9cdcfe;">mapPoint</span>)</div>
<div style="color: #d4d4d4;">
});</div>
</div>
<br />
Both console statement will return the identical object as below which has latitude and longitude<br />
<br />
<ol class="tree-outline hide-selection-when-blurred source-code object-properties-section" role="tree" style="box-sizing: border-box; color: rgb(33, 33, 33) !important; display: flex; flex-direction: column; font-family: Consolas, "Lucida Console", "Courier New", monospace; font-size: 12px; list-style-type: none; margin: 0px; min-height: 0px; min-width: 0px; padding: 0px; position: relative; white-space: pre-wrap; z-index: 0;" tabindex="-1">
<li aria-expanded="true" class="parent object-properties-section-root-element expanded selected" role="treeitem" style="align-items: center; box-sizing: border-box; display: flex; flex-direction: row; min-height: 16px; min-width: 0px; position: relative; text-overflow: ellipsis; user-select: text; white-space: nowrap;" tabindex="-1"><span class="console-object console-object-preview" style="box-sizing: border-box; font-style: italic; min-height: 0px; min-width: 0px; outline-width: 0px; overflow-wrap: break-word; white-space: pre-wrap; word-break: break-all;" tabindex="-1"><span class="object-properties-preview" style="box-sizing: border-box; min-height: 0px; min-width: 0px;">{<span class="name" style="box-sizing: border-box; color: #565656; min-height: 0px; min-width: 0px;">__accessor__</span>: <span class="object-value-object" style="box-sizing: border-box; min-height: 0px; min-width: 0px;">b</span>}</span><span class="object-state-note info-note" style="background-color: #b3cbf7; border-radius: 3px; box-sizing: border-box; color: white; display: inline-block; font-size: 9px; height: 11px; line-height: 13px; margin: 0px 6px; min-height: 0px; min-width: 0px; text-align: center; width: 11px;"></span></span></li>
<ol class="children expanded" role="group" style="box-sizing: border-box; list-style-type: none; min-height: 0px; min-width: 0px; padding-left: 12px;">
<li role="treeitem" style="align-items: center; box-sizing: border-box; display: flex; min-height: 16px; min-width: 0px; position: relative; text-overflow: ellipsis; user-select: text; white-space: nowrap;"><span class="name-and-value" style="box-sizing: border-box; line-height: 16px; min-height: 0px; min-width: 0px; overflow: hidden; text-overflow: ellipsis;"><span class="name" style="box-sizing: border-box; color: #881391; min-height: 0px; min-width: 0px;">cache</span>: <span style="box-sizing: border-box; min-height: 0px; min-width: 0px;">(...)</span></span></li>
<li role="treeitem" style="align-items: center; box-sizing: border-box; display: flex; min-height: 16px; min-width: 0px; position: relative; text-overflow: ellipsis; user-select: text; white-space: nowrap;"><span class="name-and-value" style="box-sizing: border-box; line-height: 16px; min-height: 0px; min-width: 0px; overflow: hidden; text-overflow: ellipsis;"><span class="name" style="box-sizing: border-box; color: #881391; min-height: 0px; min-width: 0px;">extent</span>: <span style="box-sizing: border-box; min-height: 0px; min-width: 0px;">(...)</span></span></li>
<li role="treeitem" style="align-items: center; box-sizing: border-box; display: flex; min-height: 16px; min-width: 0px; position: relative; text-overflow: ellipsis; user-select: text; white-space: nowrap;"><span class="name-and-value" style="box-sizing: border-box; line-height: 16px; min-height: 0px; min-width: 0px; overflow: hidden; text-overflow: ellipsis;"><span class="name" style="box-sizing: border-box; color: #881391; min-height: 0px; min-width: 0px;">hasM</span>: <span style="box-sizing: border-box; min-height: 0px; min-width: 0px;">(...)</span></span></li>
<li role="treeitem" style="align-items: center; box-sizing: border-box; display: flex; min-height: 16px; min-width: 0px; position: relative; text-overflow: ellipsis; user-select: text; white-space: nowrap;"><span class="name-and-value" style="box-sizing: border-box; line-height: 16px; min-height: 0px; min-width: 0px; overflow: hidden; text-overflow: ellipsis;"><span class="name" style="box-sizing: border-box; color: #881391; min-height: 0px; min-width: 0px;">hasZ</span>: <span style="box-sizing: border-box; min-height: 0px; min-width: 0px;">(...)</span></span></li>
<li role="treeitem" style="align-items: center; box-sizing: border-box; display: flex; min-height: 16px; min-width: 0px; position: relative; text-overflow: ellipsis; user-select: text; white-space: nowrap;"><span class="name-and-value" style="box-sizing: border-box; line-height: 16px; min-height: 0px; min-width: 0px; overflow: hidden; text-overflow: ellipsis;"><span class="name" style="box-sizing: border-box; color: #881391; min-height: 0px; min-width: 0px;">latitude</span>: <span style="box-sizing: border-box; min-height: 0px; min-width: 0px;">(...)</span></span></li>
<li role="treeitem" style="align-items: center; box-sizing: border-box; display: flex; min-height: 16px; min-width: 0px; position: relative; text-overflow: ellipsis; user-select: text; white-space: nowrap;"><span class="name-and-value" style="box-sizing: border-box; line-height: 16px; min-height: 0px; min-width: 0px; overflow: hidden; text-overflow: ellipsis;"><span class="name" style="box-sizing: border-box; color: #881391; min-height: 0px; min-width: 0px;">longitude</span>: <span style="box-sizing: border-box; min-height: 0px; min-width: 0px;">(...)</span></span></li>
<li role="treeitem" style="align-items: center; box-sizing: border-box; display: flex; min-height: 16px; min-width: 0px; position: relative; text-overflow: ellipsis; user-select: text; white-space: nowrap;"><span class="name-and-value" style="box-sizing: border-box; line-height: 16px; min-height: 0px; min-width: 0px; overflow: hidden; text-overflow: ellipsis;"><span class="name" style="box-sizing: border-box; color: #881391; min-height: 0px; min-width: 0px;">m</span>: <span style="box-sizing: border-box; min-height: 0px; min-width: 0px;">(...)</span></span></li>
<li role="treeitem" style="align-items: center; box-sizing: border-box; display: flex; min-height: 16px; min-width: 0px; position: relative; text-overflow: ellipsis; user-select: text; white-space: nowrap;"><span class="name-and-value" style="box-sizing: border-box; line-height: 16px; min-height: 0px; min-width: 0px; overflow: hidden; text-overflow: ellipsis;"><span class="name" style="box-sizing: border-box; color: #881391; min-height: 0px; min-width: 0px;">spatialReference</span>: <span style="box-sizing: border-box; min-height: 0px; min-width: 0px;">(...)</span></span></li>
<li role="treeitem" style="align-items: center; box-sizing: border-box; display: flex; min-height: 16px; min-width: 0px; position: relative; text-overflow: ellipsis; user-select: text; white-space: nowrap;"><span class="name-and-value" style="box-sizing: border-box; line-height: 16px; min-height: 0px; min-width: 0px; overflow: hidden; text-overflow: ellipsis;"><span class="name" style="box-sizing: border-box; color: #881391; min-height: 0px; min-width: 0px;">type</span>: <span style="box-sizing: border-box; min-height: 0px; min-width: 0px;">(...)</span></span></li>
<li role="treeitem" style="align-items: center; box-sizing: border-box; display: flex; min-height: 16px; min-width: 0px; position: relative; text-overflow: ellipsis; user-select: text; white-space: nowrap;"><span class="name-and-value" style="box-sizing: border-box; line-height: 16px; min-height: 0px; min-width: 0px; overflow: hidden; text-overflow: ellipsis;"><span class="name" style="box-sizing: border-box; color: #881391; min-height: 0px; min-width: 0px;">x</span>: <span style="box-sizing: border-box; min-height: 0px; min-width: 0px;">(...)</span></span></li>
<li role="treeitem" style="align-items: center; box-sizing: border-box; display: flex; min-height: 16px; min-width: 0px; position: relative; text-overflow: ellipsis; user-select: text; white-space: nowrap;"><span class="name-and-value" style="box-sizing: border-box; line-height: 16px; min-height: 0px; min-width: 0px; overflow: hidden; text-overflow: ellipsis;"><span class="name" style="box-sizing: border-box; color: #881391; min-height: 0px; min-width: 0px;">y</span>: <span style="box-sizing: border-box; min-height: 0px; min-width: 0px;">(...)</span></span></li>
<li role="treeitem" style="align-items: center; box-sizing: border-box; display: flex; min-height: 16px; min-width: 0px; position: relative; text-overflow: ellipsis; user-select: text; white-space: nowrap;"><span class="name-and-value" style="box-sizing: border-box; line-height: 16px; min-height: 0px; min-width: 0px; overflow: hidden; text-overflow: ellipsis;"><span class="name" style="box-sizing: border-box; color: #881391; min-height: 0px; min-width: 0px;">z</span>: <span style="box-sizing: border-box; min-height: 0px; min-width: 0px;">(...)</span></span></li>
<li role="treeitem" style="align-items: center; box-sizing: border-box; display: flex; min-height: 16px; min-width: 0px; position: relative; text-overflow: ellipsis; user-select: text; white-space: nowrap;"><span class="name-and-value" style="box-sizing: border-box; line-height: 16px; min-height: 0px; min-width: 0px; overflow: hidden; text-overflow: ellipsis;"><span class="name object-properties-section-dimmed" style="box-sizing: border-box; color: #881391; min-height: 0px; min-width: 0px; opacity: 0.6;">constructed</span>: <span style="box-sizing: border-box; min-height: 0px; min-width: 0px;">(...)</span></span></li>
<li role="treeitem" style="align-items: center; box-sizing: border-box; display: flex; min-height: 16px; min-width: 0px; position: relative; text-overflow: ellipsis; user-select: text; white-space: nowrap;"><span class="name-and-value" style="box-sizing: border-box; line-height: 16px; min-height: 0px; min-width: 0px; overflow: hidden; text-overflow: ellipsis;"><span class="name object-properties-section-dimmed" style="box-sizing: border-box; color: #881391; min-height: 0px; min-width: 0px; opacity: 0.6;">destroyed</span>: <span style="box-sizing: border-box; min-height: 0px; min-width: 0px;">(...)</span></span></li>
<li role="treeitem" style="align-items: center; box-sizing: border-box; display: flex; min-height: 16px; min-width: 0px; position: relative; text-overflow: ellipsis; user-select: text; white-space: nowrap;"><span class="name-and-value" style="box-sizing: border-box; line-height: 16px; min-height: 0px; min-width: 0px; overflow: hidden; text-overflow: ellipsis;"><span class="name object-properties-section-dimmed" style="box-sizing: border-box; color: #881391; min-height: 0px; min-width: 0px; opacity: 0.6;">initialized</span>: <span style="box-sizing: border-box; min-height: 0px; min-width: 0px;">(...)</span></span></li>
<li aria-expanded="false" class="parent" role="treeitem" style="align-items: center; box-sizing: border-box; display: flex; min-height: 16px; min-width: 0px; position: relative; text-overflow: ellipsis; user-select: text; white-space: nowrap;"><span class="name-and-value" style="box-sizing: border-box; line-height: 16px; min-height: 0px; min-width: 0px; overflow: hidden; text-overflow: ellipsis;"><span class="name object-properties-section-dimmed" style="box-sizing: border-box; color: #881391; min-height: 0px; min-width: 0px; opacity: 0.6;">__accessor__</span>: <span class="object-value-object value" style="box-sizing: border-box; min-height: 0px; min-width: 0px;"><span class="object-description" style="box-sizing: border-box; color: grey; min-height: 0px; min-width: 0px;">b </span><span class="object-properties-preview" style="box-sizing: border-box; min-height: 0px; min-width: 0px;">{<span class="name" style="box-sizing: border-box; color: #565656; min-height: 0px; min-width: 0px;">host</span>: <span class="object-value-object" style="box-sizing: border-box; min-height: 0px; min-width: 0px;">{…}</span>, <span class="name" style="box-sizing: border-box; color: #565656; min-height: 0px; min-width: 0px;">_origin</span>: <span class="object-value-number" style="box-sizing: border-box; color: #1c00cf; min-height: 0px; min-width: 0px;">6</span>, <span class="name" style="box-sizing: border-box; color: #565656; min-height: 0px; min-width: 0px;">cursors</span>: <span class="object-value-object" style="box-sizing: border-box; min-height: 0px; min-width: 0px;">{…}</span>, <span class="name" style="box-sizing: border-box; color: #565656; min-height: 0px; min-width: 0px;">ctorArgs</span>: <span class="object-value-null" style="box-sizing: border-box; color: grey; min-height: 0px; min-width: 0px;">null</span>, <span class="name" style="box-sizing: border-box; color: #565656; min-height: 0px; min-width: 0px;">destroyed</span>: <span class="object-value-boolean" style="box-sizing: border-box; color: #0d22aa; min-height: 0px; min-width: 0px;">false</span><span style="box-sizing: border-box; min-height: 0px; min-width: 0px;">, …</span>}</span></span></span></li>
<li aria-expanded="false" class="parent" role="treeitem" style="align-items: center; box-sizing: border-box; display: flex; min-height: 16px; min-width: 0px; position: relative; text-overflow: ellipsis; user-select: text; white-space: nowrap;"><span class="name-and-value" style="box-sizing: border-box; line-height: 16px; min-height: 0px; min-width: 0px; overflow: hidden; text-overflow: ellipsis;"><span class="name object-properties-section-dimmed" style="box-sizing: border-box; color: #881391; min-height: 0px; min-width: 0px; opacity: 0.6;">__proto__</span>: <span class="object-value-object value" style="box-sizing: border-box; min-height: 0px; min-width: 0px;">Object</span></span></li>
</ol>
</ol>
</div>
</div>
Adminhttp://www.blogger.com/profile/17622977804566362679noreply@blogger.com0tag:blogger.com,1999:blog-545833124464185481.post-18380057680927480112019-04-12T22:55:00.001-05:002019-04-12T22:56:21.336-05:00Code Snippet : Windows NTLM POST using Node JS<div dir="ltr" style="text-align: left;" trbidi="on">
let ntlm = require('request-ntlm-lite');<br />
<br />
let postData = 'user=test'; //anything<br />
<br />
let headers = {'Content-Type': 'application/x-www-form-urlencoded'};<br />
<br />
let ntlmOptions = { <br />
<span style="white-space: pre;"> </span>url: 'postUrl',<br />
<span style="white-space: pre;"> </span>username: 'username',<br />
<span style="white-space: pre;"> </span>password: 'password',<br />
<span style="white-space: pre;"> </span>workstation:'',<br />
<span style="white-space: pre;"> </span>rejectUnauthorized: false, //disable ssl certificate error<br />
<span style="white-space: pre;"> </span>ntlm_domain: 'domain_name',<br />
<span style="white-space: pre;"> </span>json: true,<br />
<span style="white-space: pre;"> </span>headers:headers<br />
};<br />
<br />
<br />
ntlm.post(ntlmOptions, postData, function(error, response, body){<br />
<span style="white-space: pre;"> </span>console.log(error);<br />
<span style="white-space: pre;"> </span>console.log(response); <br />
});</div>
Adminhttp://www.blogger.com/profile/17622977804566362679noreply@blogger.com0tag:blogger.com,1999:blog-545833124464185481.post-18059049873835086792019-04-12T22:36:00.002-05:002019-04-12T22:56:08.663-05:00Database Configuration to connect with named instance SQL Server with mssql for node.js<div dir="ltr" style="text-align: left;" trbidi="on">
After some frustration, it found that Node JS mssql (5.0.5) doesn't like instance name in config file to make mssql.ConnectionPool(config)-<br />
<br />
Works<br />
<br />
<br />
dbConfig: {<br />
"user": "user",<br />
"password": "pass",<br />
<span style="color: red;"> "server": "myserver", </span>// Without instance name <br />
"database": "dbname",<br />
"port":1433,<br />
"driver": "tedious",<br />
"options": {<br />
"instance":"mylocaldevdatabase",<br />
"trustedConnection": true<br />
}<br />
}<br />
<br />
<br />
Doesn't Work<br />
<br />
<a name='more'></a><br />
<br />
<br />
dbConfig: {<br />
"user": "user",<br />
"password": "pass",<br />
<span style="color: red;">"server": "myserver\\myinstance", </span> // With instance name <br />
"database": "dbname",<br />
"port":1433,<br />
"driver": "tedious",<br />
"options": {<br />
"trustedConnection": true<br />
}<br />
}<br />
<br />
<div>
<br /></div>
<div>
while making connection as in Node Js </div>
<div>
<br /></div>
<div>
<div>
<span style="color: blue;">import * as mssql from "mssql";</span></div>
</div>
<div>
<span style="color: blue;"><br /></span></div>
<div>
<b><span style="color: blue;">mssql.ConnectionPool(dbConfig)</span></b></div>
</div>
Adminhttp://www.blogger.com/profile/17622977804566362679noreply@blogger.com0tag:blogger.com,1999:blog-545833124464185481.post-85302298774166296912019-03-28T10:38:00.001-05:002019-03-28T10:38:45.745-05:00ESRI JS API 4.8 makes default call to unsupported API to generate token.<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="separator" style="clear: both; text-align: left;">
ESRI Identity Manager, ESRI JS API 4.8 makes default call to unsupported API to generate token.</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhZdU3rYLSQLleWsegNzmrj9l0pxwt5nLPc-Gpu_YLUdH3ci2lkEuTO2E01LRW6OAxoxdAh-26wuRQvY7MFHs3yHYxWqC2Qnu7o-cW_JDZ323SYYOnWFAjdMieQ8eSMaxiO0fI_-VNW3yA_/s1600/ESRI_ID.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="369" data-original-width="1088" height="108" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhZdU3rYLSQLleWsegNzmrj9l0pxwt5nLPc-Gpu_YLUdH3ci2lkEuTO2E01LRW6OAxoxdAh-26wuRQvY7MFHs3yHYxWqC2Qnu7o-cW_JDZ323SYYOnWFAjdMieQ8eSMaxiO0fI_-VNW3yA_/s320/ESRI_ID.png" width="320" /></a></div>
ID calls to <span style="background-color: #f44336; color: white; font-family: Verdana, Arial, Helvetica, sans-serif;">portal/sharing </span><span style="background-color: white; font-family: Verdana, Arial, Helvetica, sans-serif;">in stead of </span><span style="background-color: #f44336; color: white; font-family: Verdana, Arial, Helvetica, sans-serif;">portal/sharing/rest/ </span><span style="background-color: white; font-family: Verdana, Arial, Helvetica, sans-serif;">for token.</span></div>
Adminhttp://www.blogger.com/profile/17622977804566362679noreply@blogger.com0tag:blogger.com,1999:blog-545833124464185481.post-79915989478848869262019-03-22T10:55:00.005-05:002019-03-28T14:11:27.531-05:00Generate ArcGIS Token By URL Request From ArcGIS Portal, Federated Environment , ESRI JS API and Angular snippets<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
<div class="MsoNormal">
In my custom angular web application, I had to pull the data
from different ArcGIS server environments, say Dev ArcGIS server and Test
ArcGIS server environment, some of my items are directly referred from ArcGIS
server services and some of them are from Enterprise portal referring the
WebMapId and PortalId from both environment (Dev, Test). Servers are in
federated environment.<o:p></o:p></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
To pull the data from different ArcGIS server environment,
user must login in each environment. In addition, user must login to get inside
the custom application and Enterprise AD Group was set to authenticate users on
the custom web application and ArcGIS server environments. So, there will be 3
login attempts (1 –application itself, 2- Dev server/portal, 3- Test
server/portal) to use the application, which doesn’t provide good user experience.
<o:p></o:p></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
To improve the better application workflow, I decided to reduce
the number of logins required in the application and use AD Username and
Password captured during application login to generate token for each ArcGIS
server environment. Here are some reference snippets to generate token from ArcGIS
server and use tokens request parameter in ESRI JS API and Angular.<o:p></o:p></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<o:p><br /></o:p></div>
<div class="MsoNormal">
<b>Step 1: Generate token and store tokens in session </b></div>
<br />
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
devServerLogin(username, password){</div>
<div class="MsoNormal">
let portalTokenUrl = ....+'/portal/sharing/rest/generateToken'; <span style="color: red;">//Federated evn., use Portal to generate user token.</span></div>
<div class="MsoNormal">
<span style="color: red;"><br /></span></div>
<div class="MsoNormal">
if(username && password){</div>
<div class="MsoNormal">
this.httpClient.post(tokenUrl, this.getCredentials(username, password), this.getHttpOptions()).subscribe(esriResponse =>{</div>
<div class="MsoNormal">
sessionStorage.setItem('dev_access_token', esriResponse['token']);</div>
<div class="MsoNormal">
sessionStorage.setItem('dev_access_token_expires', esriResponse['expires']);</div>
<div class="MsoNormal">
});;</div>
<div class="MsoNormal">
}</div>
<div class="MsoNormal">
}</div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
private getCredentials(username, password){</div>
<div class="MsoNormal">
let expiration = 720; <span style="color: red;">//1440 -> 60 minute * 24 = 1 day token , 720 -> 12hrs token</span><span style="color: red;"> </span><br />
<span style="color: red;"> </span><br />
let urlReferer = 'https://'+window.location.host+'/';
</div>
<div class="MsoNormal">
<br />
let tokenCredentials = 'username='+username+'&password='+password+'&f=json&expiration='+expiration+'&client=referer&referer='+urlReferer;<br />
<br /></div>
<div class="MsoNormal">
return tokenCredentials;</div>
<div class="MsoNormal">
}</div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
private getHttpOptions(){</div>
<div class="MsoNormal">
let httpOptions = {</div>
<div class="MsoNormal">
headers: new HttpHeaders({ 'Content-Type': 'application/x-www-form-urlencoded', }),</div>
<div class="MsoNormal">
withCredentials: true, </div>
<div class="MsoNormal">
};</div>
<div class="MsoNormal">
return httpOptions;</div>
<div class="MsoNormal">
}</div>
<div class="MsoNormal">
<br />
<a name='more'></a></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<b>Step 2: Use token for custom query to ArcGIS server directly</b></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
let token = sessionStorage.getItem('dev_access_token'); </div>
<div class="MsoNormal">
let serverUrl = .....+'rest/services/MapServer/exts/'+....;</div>
<div class="MsoNormal">
let customQuery = '';</div>
<div class="MsoNormal">
let queryUrl:string = serverUrl+customQuery+'&f=pjson&token='+token; <span style="color: red;">//Append the token</span></div>
<div class="MsoNormal">
</div>
<div class="MsoNormal">
this.httpClient.get(queryUrl, {withCredentials:true}).subscribe( esriResponse ->{</div>
<div class="MsoNormal">
console.log('Custom query response ' + esriResponse);</div>
<div class="MsoNormal">
});</div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<b>Step 3: Register ArcGIS Server pregenerated token with IdentityManager</b></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
let tokenProperties = {</div>
<div class="MsoNormal">
'server' : ...+'/rest/services',<span style="color: red;"> // Use ArcGIS server REST url not portal REST URL</span></div>
<div class="MsoNormal">
'token' : sessionStorage.getItem('dev_access_token'),</div>
<div class="MsoNormal">
'ssl' : false,</div>
<div class="MsoNormal">
'userId' : username,</div>
<div class="MsoNormal">
'expires': sessionStorage.getItem('dev_access_token_expires')</div>
<div class="MsoNormal">
};</div>
<div class="MsoNormal">
</div>
<div class="MsoNormal">
IdentityManager.registerToken(tokenProperties);</div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
</div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<b>Step 4: Force ESRI JS API to use credentials from IdentityManager for subsequent request </b></div>
<div class="MsoNormal">
</div>
<div class="MsoNormal">
<o:p></o:p></div>
<div class="MsoNormal">
esriConfig.request.identity = true; </div>
<br />
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<o:p><br /></o:p></div>
References<br />
<br />
<ol style="text-align: left;">
<li><a href="https://developers.arcgis.com/rest/enterprise-administration/server/generatetoken.htm">https://developers.arcgis.com/rest/enterprise-administration/server/generatetoken.htm</a></li>
<li><a href="https://community.esri.com/thread/205582-how-to-generate-token-by-url-request-from-arcgis-portal">https://community.esri.com/thread/205582-how-to-generate-token-by-url-request-from-arcgis-portal</a></li>
<li><a href="https://community.esri.com/thread/119908?bcsi-ac-c30e6d8e7dfc909a=2B8A3782000000039twpYO0gK6dqpvBoKxDM7WQCt/RhAgAAAwAAAFmoIwAIBwAAAAAAAB0TBwAAAAAA">https://community.esri.com/thread/119908?bcsi-ac-c30e6d8e7dfc909a=2B8A3782000000039twpYO0gK6dqpvBoKxDM7WQCt/RhAgAAAwAAAFmoIwAIBwAAAAAAAB0TBwAAAAAA</a></li>
<li><a href="https://stackoverflow.com/questions/43284011/arcgis-portal-login-in-code-without-prompt">https://stackoverflow.com/questions/43284011/arcgis-portal-login-in-code-without-prompt</a></li>
<li><a href="http://enterprise.arcgis.com/en/portal/latest/administer/windows/scripting-with-the-arcgis-rest-api.htm">http://enterprise.arcgis.com/en/portal/latest/administer/windows/scripting-with-the-arcgis-rest-api.htm</a></li>
<li><a href="http://enterprise.arcgis.com/en/portal/latest/administer/windows/scripting-with-the-arcgis-rest-api.htm">https://developers.arcgis.com/javascript/latest/api-reference/esri-identity-IdentityManager.html#registerToken</a></li>
</ol>
<br />
<br />
<br /></div>
Adminhttp://www.blogger.com/profile/17622977804566362679noreply@blogger.com1tag:blogger.com,1999:blog-545833124464185481.post-5138740039398139642018-11-21T12:40:00.001-06:002018-11-21T12:40:34.675-06:00ArcGIS Server SOI - HandleRESTRequest Parameter limitations <div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="ltr" style="text-align: left;" trbidi="on">
The SOI Rest request handler method -<br />
<br />
<span style="color: blue;">public byte[] HandleRESTRequest(string Capabilities, string resourceName, string operationName,</span><br />
<span style="color: blue;"> string operationInput, string outputFormat, string requestProperties, out string responseProperties)</span><br />
<span style="color: blue;"><br />
</span> HandleRESTRequest paramater provides following information inside the method<br />
<br />
<span style="background-color: yellow; color: #505051; font-family: "geneva" , "arial" , "helvetica" , sans-serif; font-size: 12px;">capabilities</span><span style="background-color: #e5edf4; color: #505051; font-family: "geneva" , "arial" , "helvetica" , sans-serif; font-size: 12px;"> Map,Query,Data</span><br />
<span style="background-color: #e5edf4; color: #505051; font-family: "geneva" , "arial" , "helvetica" , sans-serif; font-size: 12px;"> </span><span style="background-color: yellow; color: #505051; font-family: "geneva" , "arial" , "helvetica" , sans-serif; font-size: 12px;">resourceName</span><span style="background-color: #e5edf4; color: #505051; font-family: "geneva" , "arial" , "helvetica" , sans-serif; font-size: 12px;"> </span><span style="background-color: lime; color: #505051; font-family: "geneva" , "arial" , "helvetica" , sans-serif; font-size: 12px;">layers/0</span><span style="background-color: #e5edf4; color: #505051; font-family: "geneva" , "arial" , "helvetica" , sans-serif; font-size: 12px;">, </span><br />
<span style="background-color: yellow; color: #505051; font-family: "geneva" , "arial" , "helvetica" , sans-serif; font-size: 12px;">operationName</span><span style="background-color: #e5edf4; color: #505051; font-family: "geneva" , "arial" , "helvetica" , sans-serif; font-size: 12px;"> query, </span><br />
<span style="background-color: yellow; color: #505051; font-family: "geneva" , "arial" , "helvetica" , sans-serif; font-size: 12px;">operationInput</span><span style="background-color: #e5edf4; color: #505051; font-family: "geneva" , "arial" , "helvetica" , sans-serif; font-size: 12px;"> {"returnZ":false,"returnIdsOnly":false,</span><br />
<span style="background-color: #e5edf4; color: #505051; font-family: "geneva" , "arial" , "helvetica" , sans-serif; font-size: 12px;">"where":"","returnDistinctValues":false,"returnM":false,"returnCountOnly":false,"returnExtentsOnly":false,</span><br />
<span style="background-color: #e5edf4; color: #505051; font-family: "geneva" , "arial" , "helvetica" , sans-serif; font-size: 12px;">"returnTrueCurves":false,"returnGeometry":true,</span><br />
<span style="background-color: #e5edf4; color: #505051; font-family: "geneva" , "arial" , "helvetica" , sans-serif; font-size: 12px;">"spatialRel":"esriSpatialRelIntersects","geometryType":"esriGeometryEnvelope"}, outputFormat json, </span><br />
<span style="background-color: yellow; color: #505051; font-family: "geneva" , "arial" , "helvetica" , sans-serif; font-size: 12px;">requestProperties</span><span style="background-color: #e5edf4; color: #505051; font-family: "geneva" , "arial" , "helvetica" , sans-serif; font-size: 12px;"> {"computeETag":true,"ETag":"\"c429a59c\""}, </span><br />
<span style="background-color: yellow; color: #505051; font-family: "geneva" , "arial" , "helvetica" , sans-serif; font-size: 12px;">responseProperties</span><span style="background-color: #e5edf4; color: #505051; font-family: "geneva" , "arial" , "helvetica" , sans-serif; font-size: 12px;"> {"Content-Type":"text/plain"}</span><br />
<span style="background-color: #e5edf4; color: #505051; font-family: "geneva" , "arial" , "helvetica" , sans-serif; font-size: 12px;"><br />
</span> </div>
But it has no way of telling service name and layer name ...other than using layer index from resourceName if you want to perform layer specific operation in layers.<br />
<br /></div>
Adminhttp://www.blogger.com/profile/17622977804566362679noreply@blogger.com0tag:blogger.com,1999:blog-545833124464185481.post-59558298338168875712018-08-05T12:02:00.002-05:002018-08-05T12:03:16.462-05:00[Code snippet]: Planet API Image Download Url <div dir="ltr" style="text-align: left;" trbidi="on">
<br />
from requests.auth import HTTPBasicAuth<br />
import os<br />
import requests<br />
<br />
<br />
item_id = "20161109_173041_0e0e"<br />
item_type = "PSScene3Band"<br />
<br />
<br />
os.environ['PLANET_API_KEY'] = '3b711bededf6485a0' #not a real id<br />
asset_type = "visual"<br />
item_url = 'https://api.planet.com/data/v1/item-types/{}/items/{}/assets'.format(item_type, item_id)<br />
<br />
# Request a new download URL<br />
result = requests.get(item_url, auth=HTTPBasicAuth(os.environ['PLANET_API_KEY'], ''))<br />
download_url = result.json()[asset_type]['location']<br />
<br />
print(download_url)</div>
Adminhttp://www.blogger.com/profile/17622977804566362679noreply@blogger.com0tag:blogger.com,1999:blog-545833124464185481.post-74416087647805560162018-06-14T22:03:00.001-05:002018-06-14T22:03:02.989-05:00Angular Async Patterns<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjsfSbWAy2hZI7EdJ5iGZKpWKGvwVClMXcbEGL20gCJchDpG-dhFq7u5dhLZ-k6OjbD-SsN75mZO13ah2Ksi1BfhYvgGYo2kiSsR3fZiat_jTpfrjoeHV8l270u26pi1SBpxLX-VDrqN3fO/s1600/Angular_Async_Patterns.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="596" data-original-width="766" height="310" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjsfSbWAy2hZI7EdJ5iGZKpWKGvwVClMXcbEGL20gCJchDpG-dhFq7u5dhLZ-k6OjbD-SsN75mZO13ah2Ksi1BfhYvgGYo2kiSsR3fZiat_jTpfrjoeHV8l270u26pi1SBpxLX-VDrqN3fO/s400/Angular_Async_Patterns.png" width="400" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://sean-olson-e.github.io/Angular-and-the-ArcGIS-API-for-JavaScript/#/17">https://sean-olson-e.github.io/Angular-and-the-ArcGIS-API-for-JavaScript/#/17</a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<br /></div>
Adminhttp://www.blogger.com/profile/17622977804566362679noreply@blogger.com0tag:blogger.com,1999:blog-545833124464185481.post-80062474226862943512018-06-11T14:57:00.003-05:002018-06-11T14:57:45.104-05:00[Snippet]: Fetch User Name and Email Address from Windows AD Group using Powershell script.FetchAdUsers.ps1<br />
<br />
#Store users' info in CSV<br />
<br />
<b><span style="color: blue;">Get-ADGroupMember -Identity </span>GROUPNAME<span style="color: blue;"> -Recursive|Get-ADUser -Properties Mail, MemberOf | Select-Object GivenName, Surname, SamAccountName, Mail | Export-csv -path </span></b><b>GROUPNAME </b><b>.csv </b><b style="color: blue;">-NoTypeInformation</b>Adminhttp://www.blogger.com/profile/17622977804566362679noreply@blogger.com0tag:blogger.com,1999:blog-545833124464185481.post-53156877277511393512018-05-30T22:54:00.001-05:002018-05-30T23:05:17.364-05:00[Code Snippet] How to a create user in arcgis portal with a custom role?Create a user or add member in ArcGIS portal with a custom role -<br />
<br />
1. Get all custom roles from the portal, I presumed that the portal already has custom roles other than (org_user, org_publisher, org_admin)<br />
<br />
<span style="font-family: "courier new" , "courier" , monospace;">from arcgis.gis import *</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">gis= GIS(portalUrl, userName, password)</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><span style="color: blue;"><b>allRoles</b> </span>= gis.users.roles.all(max_roles=50)</span><br />
<br />
2. Create a User with Default Role<br />
<br />
<span style="font-family: "courier new" , "courier" , monospace;">username="test"</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">password=''</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">firstname='test_name'</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">lastname='test_last'</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">email='test@test.com'</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">description = 'Test Account'</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">role = 'org_publisher'</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">provider = 'enterprise'</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">idp_username = 'test'</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">level = 2</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">thumbnail = None</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span>
<span style="font-family: "courier new" , "courier" , monospace;">newUser = gis.users.create(username, password,firstname,</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> lastname, email, description, role, provider, </span><br />
<span style="font-family: "courier new" , "courier" , monospace;"> idp_username, level, thumbnail)</span><br />
<br />
<br />
3. Update the defualt role to Custom Role - <span style="color: red;">Assign the role object not role name</span><br />
<br />
<span style="font-family: "courier new" , "courier" , monospace;">#Assigning the first role out of many portal roles, as an example</span><br />
<span style="font-family: "courier new" , "courier" , monospace;">status = newUser.update_role(<b><span style="color: blue;">role=allRoles[0]</span></b>) </span><br />
<span style="font-family: "courier new" , "courier" , monospace;">print(status)</span><br />
<br />
If role assigned success, the value of <b>status </b>will be <b>True</b>.<br />
<br />
<br />
Reference:<br />
https://developers.arcgis.com/python/guide/accessing-and-managing-users/<br />
<div>
</div>
Adminhttp://www.blogger.com/profile/17622977804566362679noreply@blogger.com0tag:blogger.com,1999:blog-545833124464185481.post-61865734385494584322018-05-25T12:30:00.002-05:002018-05-25T12:30:54.259-05:00[Code Snippet] Find Custom Role of users that are in ArcGIS portal - ArcGISfrom arcgis.gis import *<br />
<br />
<div>
<div>
self.portalInfo = GIS(self.portalUrl, self.userName, self.password)</div>
<div>
<br /></div>
<div>
self.portalUsers = self.portalInfo.users.search('')</div>
<div>
<br /></div>
<div>
users = self.portalUsers</div>
<div>
<br /></div>
<div>
roleManager = arcgis.gis.RoleManager(self.portalInfo)</div>
<div>
<br /></div>
<div>
roles = roleManager.all()</div>
<div>
<br /></div>
<div>
for user in users:</div>
<div>
<br /></div>
<div>
<span style="white-space: pre;"> </span>if hasattr(user,'roleId'):</div>
<div>
<br /></div>
<div>
<span style="white-space: pre;"> </span>for role in roles:</div>
<div>
<br /></div>
<div>
<span style="white-space: pre;"> </span>if(user.roleId == role.role_id):</div>
<div>
<br /></div>
<div>
<span style="white-space: pre;"> </span>print(user.username,user.role,role.name)</div>
</div>
Adminhttp://www.blogger.com/profile/17622977804566362679noreply@blogger.com0tag:blogger.com,1999:blog-545833124464185481.post-7004277279925344812018-05-25T12:07:00.000-05:002018-05-25T12:07:12.883-05:00Remote debug environment setup for ArcGIS server extensions- SOE and SOIIn order to debug the ArcGIS server extension SOE/SOI from your development machine, you have to follow 3 steps:<br />
<div class="MsoNormal">
<o:p></o:p></div>
<div class="MsoListParagraphCxSpFirst" style="margin-left: 1.25in; mso-add-space: auto; mso-list: l0 level1 lfo3; text-indent: -.25in;">
<!--[if !supportLists]--><span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"><span style="mso-list: Ignore;"> 1.<span style="font: 7.0pt "Times New Roman";"> </span></span></span><!--[endif]-->Enable remote debug ( Presumption is your development machine and GIS server are different machines)<o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 1.25in; mso-add-space: auto; mso-list: l0 level1 lfo3; text-indent: -.25in;">
<!--[if !supportLists]--><span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"><span style="mso-list: Ignore;"> 2.<span style="font: 7.0pt "Times New Roman";"> </span></span></span><!--[endif]-->Enable sever extension for debug<o:p></o:p></div>
<div class="MsoListParagraphCxSpLast" style="margin-left: 1.25in; mso-add-space: auto; mso-list: l0 level1 lfo3; text-indent: -.25in;">
<!--[if !supportLists]--><span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"><span style="mso-list: Ignore;"> 3.<span style="font: 7.0pt "Times New Roman";"> </span></span></span><!--[endif]-->Attach debugger to the process running the service<br />
<br />
<o:p></o:p></div>
<div class="MsoNormal">
Download and install the remote debuggin tools from - <a href="https://docs.microsoft.com/en-us/visualstudio/debugger/remote-debugging">https://docs.microsoft.com/en-us/visualstudio/debugger/remote-debugging </a><br />
<br /></div>
<div class="MsoListParagraphCxSpFirst" style="mso-list: l2 level1 lfo2; text-indent: -.25in;">
<span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"><span style="mso-list: Ignore;"><span style="font-stretch: normal; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal;"> </span><b><span style="font-stretch: normal; font-style: normal; font-variant: normal; line-height: normal;">A. </span><span style="font-family: "times new roman"; font-size: 7pt; font-stretch: normal; font-style: normal; font-variant: normal; line-height: normal;"> </span></b></span></span><!--[endif]--><b>Enable remote debug</b><o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: .75in; mso-add-space: auto; mso-list: l1 level1 lfo1; text-indent: -.25in;">
<!--[if !supportLists]--><span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"><span style="mso-list: Ignore;">1.<span style="font: 7.0pt "Times New Roman";"> </span></span></span><!--[endif]-->Download and configure Remote tools on the development<o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 1.25in; mso-add-space: auto; mso-list: l1 level2 lfo1; text-indent: -.25in;">
<!--[if !supportLists]--><span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"><span style="mso-list: Ignore;">a.<span style="font: 7.0pt "Times New Roman";"> </span></span></span><!--[endif]-->Find msvsmon.exe in the directory matching your version of Visual Studio. For Visual Studio 2015:<o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 1.25in; mso-add-space: auto;">
<br /></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 1.25in; mso-add-space: auto;">
Program Files\Microsoft Visual Studio 14.0\Common7\IDE\<b style="mso-bidi-font-weight: normal;">Remote Debugger\x64\msvsmon.exe<o:p></o:p></b></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 1.25in; mso-add-space: auto;">
(x64 can debug both x86 and x64 but x86 can only debugs x86)<o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 1.25in; mso-add-space: auto;">
<br /></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: .75in; mso-add-space: auto; mso-list: l1 level1 lfo1; text-indent: -.25in;">
<!--[if !supportLists]--><span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"><span style="mso-list: Ignore;">2.<span style="font: 7.0pt "Times New Roman";"> </span></span></span><!--[endif]-->On the remote computer, <span style="mso-spacerun: yes;"> </span>copy Remote Debugger folder from development machine and put in C:\ drive. Then, run <b style="mso-bidi-font-weight: normal;">msvsmon.exe </b><o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: .75in; mso-add-space: auto; mso-list: l1 level1 lfo1; text-indent: -.25in;">
<!--[if !supportLists]--><span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"><span style="mso-list: Ignore;">3.<span style="font: 7.0pt "Times New Roman";"> </span></span></span><!--[endif]-->The <b style="mso-bidi-font-weight: normal;">msvsmon.exe output terminal shows</b><br />
<a name='more'></a><b style="mso-bidi-font-weight: normal;"> </b><o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: .75in; mso-add-space: auto;">
<br /></div>
<div class="MsoListParagraphCxSpMiddle" style="mso-list: l2 level1 lfo2; text-indent: -.25in;">
<b><span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"><span style="mso-list: Ignore;"><span style="font-family: "times new roman"; font-size: 7pt; font-stretch: normal; font-style: normal; font-variant: normal; line-height: normal;"> </span></span></span>B. Extension debug workflow</b><o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 1.0in; mso-add-space: auto; mso-list: l2 level2 lfo2; text-indent: -.25in;">
<!--[if !supportLists]--><span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"><span style="mso-list: Ignore;">a.<span style="font: 7.0pt "Times New Roman";"> </span></span></span><!--[endif]-->Stop the service that will uses extension from ArcGIS Manager<o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 1.0in; mso-add-space: auto; mso-list: l2 level2 lfo2; text-indent: -.25in;">
<!--[if !supportLists]--><span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"><span style="mso-list: Ignore;">b.<span style="font: 7.0pt "Times New Roman";"> </span></span></span><!--[endif]-->Deploy your extension <o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 1.0in; mso-add-space: auto; mso-list: l2 level2 lfo2; text-indent: -.25in;">
<!--[if !supportLists]--><span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"><span style="mso-list: Ignore;">c.<span style="font: 7.0pt "Times New Roman";"> </span></span></span><!--[endif]-->Enable debugging of extensions<o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 1.5in; mso-add-space: auto;">
<span style="mso-no-proof: yes;"><!--[if gte vml 1]><v:shapetype id="_x0000_t75"
coordsize="21600,21600" o:spt="75" o:preferrelative="t" path="m@4@5l@4@11@9@11@9@5xe"
filled="f" stroked="f"> <v:stroke joinstyle="miter"/> <v:formulas> <v:f eqn="if lineDrawn pixelLineWidth 0"/> <v:f eqn="sum @0 1 0"/> <v:f eqn="sum 0 0 @1"/> <v:f eqn="prod @2 1 2"/> <v:f eqn="prod @3 21600 pixelWidth"/> <v:f eqn="prod @3 21600 pixelHeight"/> <v:f eqn="sum @0 0 1"/> <v:f eqn="prod @6 1 2"/> <v:f eqn="prod @7 21600 pixelWidth"/> <v:f eqn="sum @8 21600 0"/> <v:f eqn="prod @7 21600 pixelHeight"/> <v:f eqn="sum @10 21600 0"/> </v:formulas> <v:path o:extrusionok="f" gradientshapeok="t" o:connecttype="rect"/> <o:lock v:ext="edit" aspectratio="t"/> </v:shapetype><v:shape id="Picture_x0020_1" o:spid="_x0000_i1026" type="#_x0000_t75"
style='width:240pt;height:136.5pt;visibility:visible;mso-wrap-style:square'> <v:imagedata src="file:///C:\Users\ALamsal\AppData\Local\Temp\msohtmlclip1\01\clip_image001.png"
o:title=""/> </v:shape><![endif]--><!--[if !vml]--><!--[endif]--></span><o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 1.0in; mso-add-space: auto; mso-list: l2 level2 lfo2; text-indent: -.25in;">
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEip3i6vPQhVs9GC3AmE2O15LiW9yuVvMZvu51LXIKfr9nkLaq1-FlBlAhaCeDA345HerBgdiRysiH6sbcL1_l9VUga-i8smDEFlRdbaM3mMK82jafhOmGF7nXtHWMGMyS5FUflqiO9eQnLE/s1600/1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="546" data-original-width="958" height="182" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEip3i6vPQhVs9GC3AmE2O15LiW9yuVvMZvu51LXIKfr9nkLaq1-FlBlAhaCeDA345HerBgdiRysiH6sbcL1_l9VUga-i8smDEFlRdbaM3mMK82jafhOmGF7nXtHWMGMyS5FUflqiO9eQnLE/s320/1.png" width="320" /></a></div>
<!--[if !supportLists]--><span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"><span style="mso-list: Ignore;">d.<span style="font: 7.0pt "Times New Roman";"> </span></span></span><!--[endif]-->Start the service<o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 1.0in; mso-add-space: auto; mso-list: l2 level2 lfo2; text-indent: -.25in;">
<!--[if !supportLists]--><span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"><span style="mso-list: Ignore;">e.<span style="font: 7.0pt "Times New Roman";"> </span></span></span><!--[endif]-->Find the ArcSOC.exe Process ID (PID) that is associated with service ( you can find it from Task Manager)<o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 1.5in; mso-add-space: auto;">
<br /></div>
<div class="MsoListParagraphCxSpMiddle" style="mso-list: l2 level1 lfo2; text-indent: -.25in;">
<span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"><span style="mso-list: Ignore;"> <b>C. </b></span></span><b>Attach process from Visual studio</b><o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 1.0in; mso-add-space: auto; mso-list: l2 level2 lfo2; text-indent: -.25in;">
<!--[if !supportLists]--><span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"><span style="mso-list: Ignore;">a.<span style="font: 7.0pt "Times New Roman";"> </span></span></span><!--[endif]-->Debug <span style="font-family: "wingdings"; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-char-type: symbol; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin; mso-symbol-font-family: Wingdings;"><span style="mso-char-type: symbol; mso-symbol-font-family: Wingdings;">è</span></span> Attach to Process<o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 1.0in; mso-add-space: auto; mso-list: l2 level2 lfo2; text-indent: -.25in;">
<!--[if !supportLists]--><span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"><span style="mso-list: Ignore;">b.<span style="font: 7.0pt "Times New Roman";"> </span></span></span><!--[endif]-->Get you remote machine ID and port number from <b style="mso-bidi-font-weight: normal;">msvsmon.exe </b>output terminal ( step #A.2)<o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 1.5in; mso-add-space: auto;">
<span style="mso-no-proof: yes;"><!--[if gte vml 1]><v:shape id="Picture_x0020_2"
o:spid="_x0000_i1025" type="#_x0000_t75" style='width:152.25pt;height:102pt;
visibility:visible;mso-wrap-style:square'> <v:imagedata src="file:///C:\Users\ALamsal\AppData\Local\Temp\msohtmlclip1\01\clip_image003.png"
o:title=""/> </v:shape><![endif]--><!--[if !vml]--><!--[endif]--></span><o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 1.5in; mso-add-space: auto;">
<br /></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 1.0in; mso-add-space: auto; mso-list: l2 level2 lfo2; text-indent: -.25in;">
<!--[if !supportLists]--><span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"><span style="mso-list: Ignore;">c.<span style="font: 7.0pt "Times New Roman";"> </span></span></span><!--[endif]-->Select the ArcSoc PID and attach it.<o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 1.0in; mso-add-space: auto; mso-list: l2 level2 lfo2; text-indent: -.25in;">
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhMamC0aO4oRKFPtaRwV8sms5N85ZDrNtpvUm17IuCgTmHv2QB94mJLiaFr_obRvAEc7R6sveRh0sz1upbFJIAYsbyr3GZAuuiv_Zpyx_an4sUfuIfT1g2W20V6jVPqsGUk0Ya3O4Gdywnw/s1600/2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="592" data-original-width="888" height="213" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhMamC0aO4oRKFPtaRwV8sms5N85ZDrNtpvUm17IuCgTmHv2QB94mJLiaFr_obRvAEc7R6sveRh0sz1upbFJIAYsbyr3GZAuuiv_Zpyx_an4sUfuIfT1g2W20V6jVPqsGUk0Ya3O4Gdywnw/s320/2.png" width="320" /></a></div>
<!--[if !supportLists]--><span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"><span style="mso-list: Ignore;">d.<span style="font: 7.0pt "Times New Roman";"> </span></span></span><!--[endif]-->Set a breakpoint, if your breakpoint is in the extension initialization code, the breakpoint will be hit as service starts . Otherwise , the breakpoint will hit when extension is used.<o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 1.0in; mso-add-space: auto; mso-list: l2 level2 lfo2; text-indent: -.25in;">
<!--[if !supportLists]--><span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"><span style="mso-list: Ignore;">e.<span style="font: 7.0pt "Times New Roman";"> </span></span></span><!--[endif]-->Then, debug happily.<o:p></o:p></div>
<div class="MsoListParagraphCxSpLast" style="margin-left: 1.0in; mso-add-space: auto;">
<br /></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal" style="margin-left: .5in;">
References<o:p></o:p></div>
<div class="MsoNormal" style="margin-left: .5in;">
<a href="https://docs.microsoft.com/en-us/visualstudio/debugger/remote-debugging">https://docs.microsoft.com/en-us/visualstudio/debugger/remote-debugging</a><o:p></o:p></div>
<div class="MsoNormal" style="margin-left: .5in;">
<a href="http://enterprise.arcgis.com/en/server/10.4/publish-services/windows/debugging-an-extension.htm">http://enterprise.arcgis.com/en/server/10.4/publish-services/windows/debugging-an-extension.htm</a><o:p></o:p></div>
<div class="MsoNormal" style="margin-left: .5in;">
<br /></div>
<br />Adminhttp://www.blogger.com/profile/17622977804566362679noreply@blogger.com2tag:blogger.com,1999:blog-545833124464185481.post-59327222865869339202018-04-11T14:25:00.006-05:002018-05-04T10:26:18.881-05:00Code snippet: Get DateTime from UTC timestamp in ArcGIS Online<span style="font-family: "helvetica neue" , "arial" , "helvetica" , sans-serif;"><span style="background-color: white;"> </span><span style="background-color: white;">ArcGIS Online</span><span style="background-color: white;"> stores all date values in </span><span style="background-color: white;">UTC. A short snippet to convert UTC timestamp to DateTime using Python.</span></span><br />
<br />
<span style="color: blue; font-family: "trebuchet ms" , sans-serif;"><i> <b>from datetime import datetime</b></i></span><br />
<span style="color: blue; font-family: "trebuchet ms" , sans-serif;"><i><br /></i></span>
<span style="font-family: "trebuchet ms" , sans-serif;"><i><span style="color: blue;"> </span>utcTimeStamp = 1472218452855 </i></span><br />
<span style="color: blue; font-family: "trebuchet ms" , sans-serif;"><i><br /></i></span>
<span style="font-family: "trebuchet ms" , sans-serif;"><i><span style="color: blue;"> </span>date<span style="color: blue;"> = </span><b style="color: blue;">datetime.fromtimestamp(</b>utcTimeStamp <b style="color: blue;">/ 1e3)</b></i></span><br />
<span style="color: blue; font-family: "trebuchet ms" , sans-serif;"><i> </i></span><br />
<span style="font-family: "trebuchet ms" , sans-serif;"><i><span style="color: blue;"> </span><b style="color: blue;">print(</b>date<b style="color: blue;">)</b></i></span><br />
<br />
output: <span style="font-family: "courier new" , "courier" , monospace;">2016-08-26 09:34:12.855000</span><br />
<br />Adminhttp://www.blogger.com/profile/17622977804566362679noreply@blogger.com0