Basic ArcGIS Server 10.4.1 Installation

•January 9, 2018 • Leave a Comment

Profile Preferences

  • Enable single-click
  • Show Common Desktop Icons (Computer, Documents)
  • Show all taskbar icons

System Configuration

  • Replace “My Computer” text with “%ComputerName% (%UserName%)”
    • Change ownership on “HKCR\CLSID\{20D04FE0-3AEA-1069-A2D8-08002B30309D}” to Administrators and allow editing
    • Set “LocalizedString” (REG_EXPAND_SZ) value to “%ComputerName% (%UserName%)”
  • Create “C:\Temp” folder
  • Create “C:\KitsapData” folder and add “ArcGISSOM” with full permissions

Utility Applications and Tools

Install ArcGIS Server 10.4.1

  • Install Software
  • Authorize software license
  • Install Patches (use “start /wait msiexec /p patch-file-name.msi”)
  • Install security certificates
  • Update the default REST API references to utilize a newer version of the ArcGIS JavaScript API
Advertisements

Visual Studio 2017 15.5.2: Addition of Flurl to ASP.NET project causes NuGet to incorrectly reference System.Net.Http

•December 19, 2017 • 1 Comment

This incident occurred whilst creating a new ASP.NET 4.7.1 project in Visual Studio Enterprise 2017 (Version 15.5.2):

  1. Created a new ASP.NET Web Application (.NET Framework Standard 4.7.1) and enabled Web API;
  2. Added Flurl.Signed and Flurl.Http.Signed via the NuGet package manager;
  3. Updated all package dependencies.

Upon building and running the web application, an error occurred:

Could not load file or assembly ‘System.Net.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a’ or one of its dependencies. The located assembly’s manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

Here’s the source error:

Line 21: new { controller = “Help”, action = “Index”, apiId = UrlParameter.Optional });
Line 22:
Line 23: HelpPageConfig.Register(GlobalConfiguration.Configuration);
Line 24: }
Line 25: }

And the full stack trace:

 

[FileLoadException: Could not load file or assembly ‘System.Net.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a’ or one of its dependencies. The located assembly’s manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)]
System.Web.Http.GlobalConfiguration..cctor() +0

[TypeInitializationException: The type initializer for ‘System.Web.Http.GlobalConfiguration’ threw an exception.]
System.Web.Http.GlobalConfiguration.get_Configuration() +14
WebApplication1.Areas.HelpPage.HelpPageAreaRegistration.RegisterArea(AreaRegistrationContext context) in ..\WebApplication1\WebApplication1\Areas\HelpPage\HelpPageAreaRegistration.cs:23
System.Web.Mvc.AreaRegistration.CreateContextAndRegister(RouteCollection routes, Object state) +104
System.Web.Mvc.AreaRegistration.RegisterAllAreas(RouteCollection routes, IBuildManager buildManager, Object state) +190
System.Web.Mvc.AreaRegistration.RegisterAllAreas(Object state) +35
System.Web.Mvc.AreaRegistration.RegisterAllAreas() +7
WebApplication1.WebApiApplication.Application_Start() in ..\WebApplication1\WebApplication1\Global.asax.cs:16

[HttpException (0x80004005): The type initializer for ‘System.Web.Http.GlobalConfiguration’ threw an exception.]
System.Web.HttpApplicationFactory.EnsureAppStartCalledForIntegratedMode(HttpContext context, HttpApplication app) +475
System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +118
System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +176
System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +349
System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +303

[HttpException (0x80004005): The type initializer for ‘System.Web.Http.GlobalConfiguration’ threw an exception.]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +658
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +89
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +188

After creating a few dummy projects and testing, I determined the adding references to Flurl.Signed / Flurl.Http.Signed and updating packages using the NuGet package manager added the following dependent assembly in the Web.Config file:

<dependentAssembly>
<assemblyIdentity name=”System.Net.Http” publicKeyToken=”b03f5f7f11d50a3a” culture=”neutral” />
<bindingRedirect oldVersion=”0.0.0.0-4.1.0.0″ newVersion=”4.1.0.0″ />
</dependentAssembly>

I understand what’s going on but not how to fix the dependency reference. I did find however that simply removing or commenting out the dependent assembly reference to “System.Net.Http” resolved the issue (at least presumably until another NuGet update is made).

Since I did not have this issue prior to updating Visual Studio 2017 from 15.5.1 to 15.5.2 last week, I’m making an educated guess that was the cause.

(more to come…)

 

Keyboard Shortcuts for macOS

•November 22, 2017 • Leave a Comment

Text Navigation, Selection, and Editing

  1. Home / End: Command ( ⌘ ) + up arrow / down arrow
  2. Page up / down: Option ( ⌥ ) + up arrow / down arrow
  3. Beginning of line / End of line: Command ( ⌘ ) + left arrow / right arrow
  4. Previous word / Next word: Option ( ⌥ ) + left arrow / right arrow
  5. Select all: Command ( ⌘ ) + A
  6. Select from cursor to previous word / next word: Shift ( ⇧ ) + left arrow / right arrow
  7. Select from cursor to beginning of line / end of line: Command ( ⌘ ) + Shift ( ⇧ ) + left arrow / right arrow
  8. Select from cursor to beginning of document / end of document: Command ( ⌘ ) + Shift ( ⇧ ) + up arrow / down arrow
  9. Cut / Copy / Paste: Command ( ⌘ ) + X / C / V
  10. Undo / Redo: Command ( ⌘ ) + Z / Y
  11. Check Spelling and Grammar: Shift ( ⇧ ) + Command ( ⌘ ) + Colon ( : )

Applications

  1. Quit application: Command ( ⌘ ) + Q
  2. Switch between applications: Command ( ⌘ ) + Tab
  3. Switch between windows in the same application: Command ( ⌘ ) + Backquote ( ` )
  4. Open Preferences for the Active App: Command ( ⌘ ) + Comma ( , )
  5. Open new document or window: Command ( ⌘ ) + N
  6. Close Window: Command ( ⌘ ) + W
  7. Zoom in or out of a Safari window: Command ( ⌘ ) + Plus Sign ( + ) or Command ( ⌘ ) + Minus Sign ( – )
  8. Expanding Save As Dialog in Finder: Command ( ⌘ ) + (“Cmd+”)
  9. Open new tab in Chrome: Command ( ⌘ ) + T
  10. Chrome history: Command ( ⌘ ) + Y or Command ( ⌘ ) + Shift ( ⇧ ) + H

Folders

  1. Open Desktop Folder: Command ( ⌘ ) + Shift ( ⇧ ) + D
  2. Open Documents Folder: Command ( ⌘ ) + Shift ( ⇧ ) + O
  3. Open Utilities: Command ( ⌘ ) + Shift ( ⇧ ) + U
  4. Open iCloud Drive from the Finder: Command ( ⌘ ) + Shift ( ⇧ ) + I
  5. View a Quick Look Slideshow of Selected Files: Option ( ⌥ ) + Command ( ⌘ ) + Y
  6. Jump to the AirDrop Folder on Your Mac From The Finder: Command ( ⌘ ) + Shift ( ⇧ ) + R
  7. Empty Trash with no confirmation: Command ( ⌘ ) + Shift ( ⇧ ) + Option ( ⌥ ) + Delete

System

  1. Spotlight Search: Command ( ⌘ ) + space bar
  2. Select and Launch Apps with your Keyboard: F4 (Launchpad) + Arrow Keys
  3. Lock Screen: Command ( ⌘ ) + Control ( ⌃ ) + Q
    1. Keyboards with Eject ( ) button: Command ( ⌘ ) + Control ( ⌃ ) + Eject (  )
  4. Log Out of your macOS user account: Shift ( ⇧ ) + Command ( ⌘ ) + Q
    1. Bypass the log out dialog: Option ( ⌥ ) + Shift ( ⇧ ) + Command ( ⌘ ) + Q
  5. Force Quit an application: Command ( ⌘ ) + Option ( ⌥ ) + Esc
  6. Hide or Show the Dock: Command ( ⌘ ) + Option ( ⌥ ) + D
  7. Display and Control Accessibility: Option ( ⌥ ) + Command ( ⌘ ) + F5

Other

  1. Get details on any word: Command ( ⌘ ) + Control ( ⌃ ) + D
  2. Finder QuickView: Space bar
  3. Take a screenshot of the entire desktop: Command ( ⌘ ) + Shift ( ⇧ ) + 3
  4. Take a screenshot of an application: Command ( ⌘ ) + Shift ( ⇧ ) + 4
    1. Press the spacebar to toggle between draw and select

[Most of these are learned and/or from memory while others were compiled and abbreviated from the excellent articles “15 macOS Keyboard Shortcuts To Improve Your Productivity” and “Ten More macOS Keyboard Shortcuts to Improve Productivity” published 2017/10/13 and 2017/10/20 respectively.]

Other resources to consult:

Useful HTTP Response Headers for IIS and ArcGIS JavaScript Web Applications

•February 6, 2017 • Leave a Comment

This is in addition to a question I answered on Stack Overflow where someone had asked how to turn off IE compatibility mode (hint: set “X-UA-Compatible” to “IE=edge”).

These additional response headers are useful in making ArcGIS Server REST endpoints accessible across sites without adding XSS vulnerability.

Useful HTTP Response Headers for IIS and ArcGIS JavaScript Web Applications
Access-Control-Allow-Credentials true
Access-Control-Allow-Headers Origin,X-Requested-With,Content-Type,Accept
Access-Control-Allow-Methods GET,PUT,POST,DELETE,OPTIONS
Access-Control-Allow-Origin *
X-UA-Compatible IE=edge

Learning Python

•February 12, 2015 • Leave a Comment

Books

Learn Python the Hard Way, 3rd Edition” is available online for free or you can buy the eBook.

Several Packt Publishing titles also come to mind:
Learning Python Design Patterns
Expert Python Programming
Python Tools for Visual Studio
Raspberry Pi Cookbook for Python Programmers
BeagleBone for Secret Agents
Python for Secret Agents
Python Programming for Arduino

I would suggest creating an account with them and signing up for their daily special.

Some people don’t like O’Reilly but I find their books are pretty good as well:
Head First Python

IDE

One thing Python lacks is a solid IDE but that’s changed now that Microsoft has made Visual Studio Community 2013 available for free. Couple this with the Packt title, “Python Tools for Visual Studio“, listed earlier and you have a viable platform.

Some people swear by IDLE; I like Google’s PyScripter myself.

There’s also a great stackoverflow article listing many of the IDEs available and their feature set.

Python 2.x vs 3.x

There’s a war of sorts going on in the Python community since the release of version 3.x which breaks some existing 2.x code. The general consensus is to steer people towards 3.x unless they have to support 2.x legacy code or require a plug-in that’s not supported in 3.x.

Globally disable OnSwipe on iPad

•August 18, 2011 • Leave a Comment

Yep, I stole this entry’s title from the support article in the WordPress support forums.

Please do all those iPad owners a favor and disable OnSwipe on your blog. It does nothing to enhance or beautify your blog. In fact, it does the opposite and removes your individualization thus making all WordPress blogs look (and bounce) the same (boring).

How to Compile a Simple OpenGL Program (Part I : Symantec C++ 7)

•May 22, 2010 • 1 Comment

The other day, I was searching through my collection of discs and was distracted by a shiny thing: Symantec C++ 7.

Symantec C++ 7 is a complete development environment for Windows 16-bit & 32-bit and runs under MS-DOS, Windows 3.1, Windows NT, & Windows 95. While looking through the contents of the disc, I spied an OpenGL samples folder with one specifically named Book which I believe to be a reference to The Book.

I’ve always been fascinated by computer graphics so I decided to see how this compiler, released in 1995, held up today and try out the samples. The software includes an installer but more importantly, a folder is included on the disc from which the compiler and IDE can be run directly making this task easy to accomplish.

I copied the SC folder (BIN, HELP, INCLUDE, LIB, SAMPLES, etc.) to the local hard drive and then wrote a command script to set the environment for it:

@echo off
title Symantec C++ 7
set SYMANTEC7=C:\Tools\Symantec7
set include=%SYMANTEC7%\Include
set lib=%SYMANTEC7%\Lib
path %SYMANTEC7%\bin;%SYMANTEC7%\redist32;%PATH%
echo ----------------------------------------------------------
echo SCW32 : Windows 32-bit front-end
echo ----------------------------------------------------------

I also placed a shortcut in the Start Menu to execute the command script with the following settings:

Shortcut Name: Symantec C++ 7

Target: %COMSPEC% /k C:\Users\Public\bin\Symantec7.cmd

Start In: C:\Tools\Symantec7\Samples\win32

Comment: Set environment for Symantec C++ 7 for Windows

Icon: %SystemDrive%\Tools\Symantec7\bin\SCW32.EXE,0

I started SCW32 (the 32-bit version of the IDE) and voila! I opened up one of the OpenGL projects, compiled, and executed it:

OpenGL Sample of an array of teapots with different material colors.

OpenGL sample of an array of teapots with different material colors.

Very cool. In looking at the project definition, I noticed it was a single C file. Knowing there were 69 68 individual projects, I wondered how I could simplify this so it would be easier to compile all the examples. Fortunately, in addition to the project files, which are proprietary to Symantec C++, there are makefile equivalents for each project. Unfortunately, the make utility included with Symantec can’t seem to build them (I’ll figure out why at some other point in time).

The easier solution for the time being was to figure out what information the compiler needed to compile each source file into an executable. Reading through the makefiles for the options and linkage and then experimenting lead me to this:

sc -mn -C -WA -S -3 -a8 -g TEAPOTS.C glaux.lib glu32.lib opengl32.lib gdi32.lib

Here’s an explanation of the command line options used for Symantec C++ 7:

-mn
Memory model = Win32s, Windows 95, Windows NT
-C
No inline function expansion
-WA
Windows Executable
-S
Always generate stack frame
-3
80386 code (4 : 80486; 5 : Pentium)
-a8
Alignment of struct members
-g
Generate debug info
glaux.lib glu32.lib opengl32.lib gdi32.lib
The libraries necessary for linking

Armed with this knowledge, there are a couple of ways to compile all the examples. The simplest method is to use a shell “for” loop:

for %c in (*.c) do sc -mn -C -WA -S -3 -a8 -g %c glaux.lib glu32.lib opengl32.lib gdi32.lib

Interestingly, this works fine in Windows XP and all the examples compile. But in Windows 7 (64-bit), as it loops through each source file, some examples will compile, others generate an “OPTLINK” exception, and then the compiler will finally hang. The exceptions and hanging seem to be arbitrary as they occur at different points in the loop. Yet, no problems are encountered if each command is executed manually.

An example of the OPTLINK exception.

An example of the OPTLINK exception.

The “for” loop could be speeded up by pre-compiling the headers beforehand with the -HX compiler option.

Another method would be to create a makefile to incorporate all the projects with dependencies to build all & clean all. I’ll leave this as an exercise to perform at a later time.

In the end, this was a fun exercise getting to know an old friend. I’m surprised at how well the compiler (SC) has held up through the years despite all the changes made Windows but even more so that the IDE (SCW32) functions so well. Even though the size of the buttons and dialogs point to a time where 800×600 was king, the interface was ahead of its time and maybe even better than Visual Studio in some ways.

My interest in OpenGL has also been rekindled, especially in regards to Android, although I consider my desires to be more experimental in nature. I’m not a graphics artist so I don’t believe I’ll be publishing anything serious. But it’s still fun to play with.

The next step is to compile these examples with Visual Studio but before doing so, I’m going to slight detour into some history which involves Teapot