Attribute Assistant

https://solutions.arcgis.com/shared/help/attribute-assistant/get-started/

https://proceedings.esri.com/library/userconf/proc17/tech-workshops/tw_383-291.pdf
continue reading....

Install PIP in Servers/Workstations behind corporate proxy

While trying to install PIP on machines in my office, I always encounter one issue or other like:

  Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, '_ssl.c:510: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed'),)': /simple/pip/

Irrespective of trying whatever workarounds floating there in forums, none seem to fetch any reliable results for me. So here is my workaround to install PIP:

1. Install easy_install by downloading setuptools package. Unzip the package and browse to that folder in command prompt. Now, run this command from Command Prompt (if it needs administrator rights- you have to open command prompt in Administrator mode) :

python setup.py install

2. Once setup tools are installed successfully, you can access easy_tools from the command prompt to install PIP using the command:

easy_install pip
Now, you can install additional packages using either PIP or Easy_Install

If you continue getting Certificate Errors while trying to install additional packages using pip, use the following commands:

To install additional packages :

pip install --trusted-host pypi.org --trusted-host files.pythonhosted.org <package_name>

To upgrade pip:

python -m pip install --trusted-host pypi.org --trusted-host files.pythonhosted.org --upgrade pip

continue reading....

Updating ArcGIS Portal 10.6 Identity Store ends up in Error code 500?

Error:

The user store configuration or group store configuration is invalid. 

Code: 500

-This is one of the strangest error I came across while trying to integrate Enterprise Active Directory to Portal.

And, my configuration is something like as in the ESRI Portal documentation with a minor modification of “isPasswordEncrypted” to “true” as below:

For User Store
{
  "type": "WINDOWS",
  "properties": {
    "userPassword": "secret",
    "isPasswordEncrypted": "true",
    "user": "mydomain\\winaccount",
    "userFullnameAttribute": "cn",
    "userEmailAttribute": "mail",
    "caseSensitive": "false"
  }
}
For Group Store:
{
  "type": "WINDOWS",
  "properties": {
    "isPasswordEncrypted": "true",
    "userPassword": "secret",
    "user": "mydomain\\winaccount"
  }
}

Like any other IT professional, whenever you’re given an option of encrypting password in a configuration, you’ll respond “true” to that. But, with ESRI software, you need to be careful while deviating from the documentation example.

           <<<<<<< It simply won’t work. >>>>>>>>>>

It’s quite surprising that somebody actually forgot to use that option of “isPasswordEncrypted” in the code while creating the Portal application.

So, in order to Update Configuration for Update Identity Store, you will need to keep “isPasswordEncrpted” option to “false”.


continue reading....

Installing reportlab using pip behind a corporate firewall/proxy

While trying to install report lab using pip on a server machine at my office, I was stuck with this error message:

Could not fetch URL https://pypi.python.org/simple/pip/: There was a problem con
firming the ssl certificate: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify
  failed (_ssl.c:661) – skipping

On digging deeper and researching further, I found the command line solution which worked for me as follows:-

python -m pip install --trusted-host pypi.python.org autopep8 --upgrade --force-reinstall reportlab

continue reading....

Git Reference

 

  1. Working Directory: where you'll be doing all the work: creating, editing, deleting and organizing files
  2. Staging Area: where you'll list changes you make to the working directory
continue reading....

Download Files from Webpages using wget

I was looking for downloading some pdf file from a webpage without right clicking each link and hit “save as”. The best open source way of doing that is by using “wget”.

continue reading....

Changing Python IDLE Windows shell association to 32 bit version

When both 32 bit python and 64 bit python are installed in the same machine, the order of installation will decide the default association for python files.

continue reading....

Finding out who is logged into server/workstation or local machine?

The easiest way to find out who is logged into a particular workstation/server or even your local machine, I use psloggedon tool provided as a  part of Mark Russinovich’s

continue reading....

Creating an Empty Stored Procedure

To create a stored procedure with an empty body, this is the easiest way:
CREATE PROC <procedure name> AS
GO
EXEC <procedure_name

continue reading....

Installing SSL using existing certificate into ArcGIS Server 10.3.1

Trying to install SSL using the ESRI workflow ended up me having an error: Importing CA certificate failed.error.

continue reading....

Running a quick node.js file server

If you don’t want to take the extra trouble of installing node-static module and writing multiple lines of code to create a server to serve the files from your folder, a “ready to use tool”  called http-server will be the solution.

http-server is a simple, zero-configuration command-line http server

All you need is have npm and node installed in your system.

Installation via npm:

npm install http-server -g

Usage:

http-server [path] [options]


example: http-server D:\myfolder –o

This will open browser window after starting the server.

 

For more http-server options, see the documentation.
continue reading....

ArcGIS Server access to this resource is forbidden, regardless of authorization

When I was trying to overwrite a map service thru’ my existing GIS Server “administer” connection in ArcMap,

continue reading....

How to fix ArcGIS Server Web Adapter accessibility Error?


Today morning, I encountered the following errors while trying to access the Rest Endpoint of ArcGIS Server:
  • arcgis server web adapter error: Object reference not set to an instance of an object.
  • arcgis server web adapter error: Root Element is missing.
continue reading....

Some Essential ArcGIS JS API commands for Quick retrieval of Map Properties

To get the current extent of a map:
JSON.stringify(map.extent.toJson())
continue reading....

Transformation from NAD1983 to WGS1984

 The best one to use is : 
NAD_1983_To_WGS_1984_5


    See the details of other transformations:

   
NAD_1983_To_WGS_1984_1 – for the entire North American continent.

    NAD_1983_To_WGS_1984_2 – for the Aleutian islands.

    NAD_1983_To_WGS_1984_3 – for Hawai’i.

    NAD_1983_To_WGS_1984_4 – superseded by _5; this transformation method should no longer be used!

    NAD_1983_To_WGS_1984_5 – for the 48 contiguous United States.

    NAD_1983_To_WGS_1984_6 – for the Canadian province of Quebec.

    NAD_1983_To_WGS_1984_7 – for the Canadian province of Saskatchewan.

    NAD_1983_To_WGS_1984_8 – for the Canadian province of Alberta.

continue reading....

Objects and Prototype

Object Constructor

function car (make, model, color)

{

this.make=make || “unknown”;

this.model=model || “model”;

this.color=color||”unpainted”;

}

To give universal property to all new car objects, object protoypes are used

car.prototype.display=function()

{

msg.innerHTML += “<p> Your car is a “ + this.color + “ “ + this.make +” “ + this.model + “.</p>”;

}

 

To create new car objects

var fordCar=new car(“Ford”, “Mustang”, “blue”);

Prototypes can be universally created for any new objects using the syntax

Object.prototype.display=function()

{

msg.innerHTML += “<p> Your car is a “ + this.color + “ “ + this.make +” “ + this.model + “.</p>”;

}

In this care any newly created object can inherit the display property.

For example:

var truck={};

truck.display();

continue reading....

Arrays and Objects

Data Type: Arrays



//Defining Arrays


var languages = ["HTML", "CSS", "JavaScript", "Python", "Ruby"];


//Looping thru’ array and getting each item




for (var i=0;i<languages.length;i++)

{

    console.log(languages[i]);

}




Data Type : Object


Objects provide us with a way to represent real-world or virtual things. We can do this by storing information inside the object's properties. There are two basic ways to make objects:


Literal Notation, where we use



var Name = { };`



Constructor Notation, where we use the keyword new.


Declaration : var myObj={};


Multiple ways of Creating  Objects :



var myObj = {property1: value, property2:value};


var myObj=new Object();



Two ways of accessing Properties:



1. ObjectName.PropertyName


2. ObjectName[“PropertyName”]



Using methods



   var matt= new Object();


   matt.name=”Matt Davingly”;


matt.age=25;


matt.setAge= function(newAge)


{


   this.age = newAge;


};



Constructors


Constructors are a way to make objects with the keyword new. The most basic constructor is the Object constructor, which will make an object with no methods or properties.


For more complicated objects we can make our own constructors and put in whatever properties and methods we want.


Custom Constructors



function Person(name,age) {

  this.name = name;

  this.age = age;

}





var bob = new Person("Bob Smith", 30);



Constructors with Methods



function Rectangle(length, width) {

  this.length = length;

  this.width = width;

  this.calcArea = function() {

      return this.length * this.width;

  };

  this.calcPerimeter=function()

  {

      return 2*length+2*width;

  }

 
}


var rex = new Rectangle(7,3);

var area = rex.calcArea();

var perimeter = rex.calcPerimeter();



Array of Objects


Array of Objects can be made as below:-



// Our person constructor

function Person (name, age) {

    this.name = name;

    this.age = age;

}


// Now we can make an array of people

var family = new Array();

family[0] = new Person("alice", 40);

family[1] = new Person("bob", 42);

family[2] = new Person("michelle", 8);




Loop through the Array of Objects



function Person(name,age)

{

    this.name=name;

    this.age=age;

}


// Now we can make an array of people

family=[];

family.push(new Person("alice", 40));

family.push(new Person("bob", 42));

family.push(new Person("michelle", 8));

family.push(new Person("timmy", 6));


// loop through our new array

for (var i=0; i<family.length; i++)

{

    console.log (family[i].name);

}



Passing Objects into Functions



// Our person constructor

function Person (name, age) {

    this.name = name;

    this.age = age;

}


// We can make a function which takes persons as arguments

// This one computes the difference in ages between two people

var ageDifference = function(person1, person2) {

    return person1.age - person2.age;

}


var alice = new Person("Alice", 30);

var billy = new Person("Billy", 25);


// get the difference in age between alice and billy using our function

var diff = ageDifference(alice, billy);



List all Properties of an Object using for Loop



var nyc = {

    fullName: "New York City",

    mayor: "Michael Bloomberg",

    population: 8000000,

    boroughs: 5

};


// loop to print the value of nyc's properties

for(var property in nyc) {

  console.log(nyc[property]);

}



Extending the “Prototype”


if you want to add a method to a class such that all members of the class can use it, we use the following syntax to extend the prototype:



className.prototype.newMethod =

function() {
statements;
};


Inheritance in Class

In object-oriented programming, inheritance allows one class to see and use the methods and properties of another class.



//Animal class created here

function Animal(name, numLegs){

this.name=name;

this.numLegs=numLegs;

}




// sayName method for Animal is created as a prototype


//[this.name] inherits the name property from Animal Class

Animal.prototype.sayName=function(){

console.log("Hi my name is "+ [this.name]);

};


// Testing the constructor and method

var penguin = new Animal("Captain Cook", 2);

penguin.sayName();



The power of inheritance can be further explored here:


// This is an Animal class with sayName method

function Animal(name, numLegs) {

    this.name = name;

    this.numLegs = numLegs;

}

Animal.prototype.sayName = function() {

    console.log("Hi my name is " + this.name);

};


// defined a Penguin class with defined # of legs

function Penguin(name){

    this.name=name;

    this.numLegs=2;

}


// set its prototype to be a new instance of Animal


Penguin.prototype=new Animal();

penguin=new Penguin("Moby Dick");


//Now, inheritance is in action where penguin


//inherits sayName method from Animal class

penguin.sayName();



Using typeof variable


To execute something based on the type of variable, use “typeof” :



//Define object


var languages = {

    english: "Hello!",

    french: "Bonjour!",

    notALanguage: 4,

    spanish: "Hola!"

};


// print hello in the 3 different languages

for (var hello in languages){

    if (typeof languages[hello]==="string"){

        console.log (languages[hello]);

    }

}




Codecademy.com
continue reading....

JavaScript Self Closing Function

Self Closing Functions

In order to limit the scope of a variable to local level or to reuse the same variable/function name, JavaScript provides an option of self closing anonymous functions.

Syntax:

(function(){

----your function here---

}());

The () after the anonymous function ensures that the code runs immediately.

The () in which the entire function is wrapped will instruct JavaScript that it can be a nameless anonymous function.

The anonymous self closing function comes in handy when you’re referencing to so many other functions or libraries in your code and that you don’t have to worry about name conflicts of your variables or functions with other referring functions.

continue reading....

Simple trick to generate File List in Windows Command line

If you need to create a list of songs stored in the computer, here is the simple way to do that using DOS commands:

continue reading....

What are Batch (.bat) Files?

In the DOS environment, batch files are the list of command line instructions batched together. The purpose of batch file is to run a set of commands in sequence. Creating a batch file is very easy and doesn't require any programming skills.

Some Simple Batch Commands 


CallCall command can be used to call another batch file inside the current file.
call c:\test2.bat
 
Echo
Echo command is used for displaying information and commands on the screen or prevent them from being displayed.
 Echo on  and @Echo off are the two supplementary commands created out of Echo to turn ON and OFF the information display

For
If you need to select a specific set of files and run a command on each of them, FOR is used
for (variable) in (set of files) do (command)

Let's see how it works:
We need to delete all pictures (jpg files) from a directory in the system. Let's write a batch file which does that selective deletion.
for %%F in (*.jpg) do del "%%F"
Explanation:

  1. We are storing the value of every file ending in .jpg in the current directory to a variable '%%F' 
  2. Then, we ask the DEL command to delete all the values stored in the variable '%%F'.Pretty simple, huh?

If
This is used for executing a command based on a condition. IF must include an ELSE statement which says what happens if the condition is not met.
Let's see how it works:
if exist c:\test.txt (copy c:\test.txt d:\backup) else echo test.txt does not exist
Explanation:
If the 'test.txt' file exists, it will be copied to d:\backup. If it doesn't exist, a message test.txt does not exist" will be displayed.


REM
This is how commenting is done in batch file. Commenting serves as a help explanation about the file.
@echo off
rem This batch file aims
rem to copy files between directories
if exist c:\test.txt (copy c:\test.txt d:\backup) else echo test.txt does not exist


Crippled References:

See wiki for the list of command line references.
See help on how to create Microsoft XP batc files
continue reading....