Skip to content

Instantly share code, notes, and snippets.

View nohe427's full-sized avatar
💾
Saving...

Alexander Nohe nohe427

💾
Saving...
View GitHub Profile
package com.arcgis.apps.testextent;
import android.graphics.Color;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.MotionEvent;
import android.view.ScaleGestureDetector;
import android.view.View;
@nohe427
nohe427 / mainactivity.java
Created May 21, 2016 22:00
updateFeature
package com.ashleyandalexander.esri.addafeature;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import com.esri.android.map.MapView;
import com.esri.android.map.ags.ArcGISFeatureLayer;
import com.esri.core.geodatabase.GeodatabaseEditError;
import com.esri.core.geodatabase.GeodatabaseFeature;
@nohe427
nohe427 / NewAppend.cs
Last active February 25, 2016 14:17
Update features after append
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
using ESRI.ArcGIS.esriSystem;
using ESRI.ArcGIS.Geodatabase;
namespace NewAppend
{
class Program
@nohe427
nohe427 / hammingDistance.py
Last active January 29, 2016 19:57
A quick proof of concept for calculating the hamming distance between words to find the shortest distance
def calculateHammingDistance():
closestWord = None
prevWordDistance = None
TestWord = "work"
DictWords = ["four", "That", "Thin", "Test", "This", "NINJA"]
for word in DictWords:
if (len(TestWord) == len(word)):
wordDist = distance(TestWord, word)
if (prevWordDistance == None or prevWordDistance > wordDist):
prevWordDistance = wordDist
@nohe427
nohe427 / alexMath.py
Created January 21, 2016 14:23
BabylonianMethodForFindingSqrt
class alexMath(object):
"""Demonstaration of how the computer calculates the square roots of
numbers. Shows all iterations of what it calculates for example on
how it works.
Based off of the Babylonian Method located here:
https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method"""
@staticmethod
def __privSqrtFunc(number, sigdigs):
public static void HttpUploadFile(string url, string file, string paramName, string contentType, NameValueCollection nvc)
{
Console.WriteLine(string.Format("Uploading {0} to {1}", file, url));
string boundary = "---------------------------" + DateTime.Now.Ticks.ToString("x");
byte[] boundarybytes = System.Text.Encoding.ASCII.GetBytes("\r\n--" + boundary + "\r\n");
HttpWebRequest wr = (HttpWebRequest)WebRequest.Create(url);
wr.ContentType = "multipart/form-data; boundary=" + boundary;
wr.Method = "POST";
wr.KeepAlive = true;
@nohe427
nohe427 / encryptDecrypt.py
Last active August 31, 2015 18:10
Thanks @AshleyDesktop for the update!
import random, unittest
def generateMagicKey():
magicKey = {}
list1 = ["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
list2 = ["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
while len(list2) > 0:
z = random.randint(0, len(list2)-1)
y = random.randint(0, len(list2)-1)
a, b = list1[z], list2[y]
@nohe427
nohe427 / getUsers.py
Created August 26, 2015 18:01
This gets all users in an ArcGIS Online organization
import urllib
import urllib2
import json
class ArcGISOnline(object):
def __init__(self, Username, Password):
self.username = Username
self.password = Password
self.__token = self.generateToken(self.username, self.password)['token']
//
// main.cpp
// Lesson9-1
//
// Created by Alexander Nohe on 8/4/15.
// Copyright (c) 2015 Alexander Nohe. All rights reserved.
//
#include <iostream>
#include <fstream>
@nohe427
nohe427 / SampleTBX.pyt
Created March 30, 2015 15:51
This is a sample filter for a long data type in Python.
import arcpy
class Toolbox(object):
def __init__(self):
"""Define the toolbox (the name of the toolbox is the name of the
.pyt file)."""
self.label = "ToolboxSample"
self.alias = "ToolboxSample"