This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void getCurrentLocation() { | |
LocationManager locationManager; | |
String context = Context.LOCATION_SERVICE; | |
locationManager = (LocationManager) getSystemService(context); | |
Criteria crta = new Criteria(); | |
crta.setAccuracy(Criteria.ACCURACY_FINE); | |
crta.setAltitudeRequired(false); | |
crta.setBearingRequired(false); | |
crta.setCostAllowed(true); | |
crta.setPowerRequirement(Criteria.POWER_LOW); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
****************** Server ******************** | |
import socket | |
import sys | |
HOST = '192.168.142.160' #this is your localhost | |
PORT = 8888 | |
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) | |
#socket.socket: must use to create a socket. | |
#socket.AF_INET: Address Format, Internet = IP Addresses. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import os | |
from urllib2 import urlopen, URLError, HTTPError | |
import re | |
# Change information as appropriate | |
# Where files will be downloaded and unzipped |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def heapify(arr, n, i): | |
largest = i # Initialize largest as root | |
l = 2 * i + 1 # left = 2*i + 1 | |
r = 2 * i + 2 # right = 2*i + 2 | |
print(arr,"largest: " + str(largest), "i: " + str(i), "l: " + str(l), "r: " + str(r), h) | |
# See if left child of root exists and is | |
# greater than root | |
if l < n and arr[i] < arr[l]: | |
largest = l |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> | |
<script> | |
$(function(){ | |
$("button").click(function(){ | |
//get the value of both (username and password fields) | |
var username = $("#username").val(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import matplotlib.pyplot as plt | |
from sklearn import datasets | |
iris = datasets.load_iris() | |
X = iris.data[:, 0:2] | |
y = iris.target | |
plt.scatter(X[:, 0], X[:, 1], c=y, edgecolor='k') | |
plt.xlabel('Sepal length') | |
plt.ylabel('Sepal width') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import matplotlib.pyplot as plt | |
from sklearn import linear_model, datasets | |
from scipy.special import expit | |
from scipy.stats import binom | |
from scipy import stats | |
import pandas as pd | |
plt.subplot(2, 1, 1) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from mpl_toolkits.mplot3d import Axes3D | |
import matplotlib.pyplot as plt | |
from matplotlib import cm | |
from matplotlib.ticker import LinearLocator, FormatStrFormatter | |
import numpy as np | |
from scipy.stats import norm | |
fig = plt.figure() | |
ax = fig.gca(projection='3d') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from mpl_toolkits.mplot3d import Axes3D | |
import matplotlib.pyplot as plt | |
from matplotlib import cm | |
from matplotlib.ticker import LinearLocator, FormatStrFormatter | |
import numpy as np | |
from scipy.stats import norm | |
fig = plt.figure() | |
ax = fig.gca(projection='3d') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import tensorflow as tf | |
import os | |
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3' | |
mnist = tf.keras.datasets.mnist | |
(x_train, y_train),(x_test, y_test) = mnist.load_data() |
OlderNewer