Showing posts with label python. Show all posts
Showing posts with label python. Show all posts

Wednesday, April 6, 2016

How to deploy applications with Elastic Beanstalk

Easy to begin, impossible to outgrow.
  1. Knowledge
    1. Elastic Beanstalk is a Amazon Web Service for deploying and hosting software applications.
    2. If this sounds like Heroku, your intuition is correct.
  2. Strategy
    1. Here's a tutorial specific for deploying a Django application.
    2. Setup a python environment with Django.
    3. Create a Django project.
    4. Configure the app for Elastic Beanstalk.
    5. Deploy with the EB CLI.
  3. Execution
    1. Common issues:
      1. Powershell ExecutionPolicy
      2. EB CLI Could not find any platforms
      3. Server 404 response after deploy

Thursday, December 10, 2015

How to teach a machine to learn

Machine learning in Python.
  1. Knowledge
    1. Scikit-learn is a toolkit for machine learning in Python.
    2. It explains how it solves machine learning problems
  2. Strategy
    1. Scikit-learn provides a tutorial for getting started.
    2. Although, where do we even start if our application is huge, nuanced and complex? Let's use nearest-neighbor thinking to build off a similar solution! (a quick google search found it)
  3. Execution

Thursday, August 15, 2013

Installing IDLE in Linux Mint


Within Terminal enter:

sudo apt-get install idle

Wednesday, July 31, 2013

Parsing in Python





Let's make sense of this pile of data.

Reading and parsing data are the first two building blocks of a larger process, compiling, so it's always useful to know a couple of good methods.

A quick Google search of "python reading data" got me to http://docs.python.org/2/tutorial/inputoutput.html, for some simple reference material.

Now, testing is always a fun way to find out what's going on behind the code, so let's see if we can just pull out a bit of the important data here so we don't overwhelm ourselves.

Now, continuing from before, lets convert the data object to a useful string/array.

>> theData = str(html.read()).split(',')

Now let's see what this looks like.

>> for i in range(5):


         print(i, theData[i])


This smaller data structure will come in handy when setting up our larger program design.

Here's the result:

0 b'{"Key":"100-og"

1 "Name":"$100 OG"

2 "Category":"Hybrid"

3 "Symbol":"100"

4 "Abstract":"$100 OG is a hybrid cannabis strain that originally became popular in Southern California. It produces large flowers and a potent high."


Now, wait, your probably thinking, what's that b'{ doing there?

This data is meant to be parsed with the use of json modules, not bare bones python split statements, and that should massively simplify the process.


Although; you may have to redesign your parsing algorithm to completely remove all persisting characters and strings.

Monday, July 29, 2013

Reading API Data



In Python, this is as easy as running a couple of commands in IDLE.

from urllib import urlopen

html = urlopen("http://www.leafly.com/api/details/100-og")

html.read() 


HTTPResponse instances also have some more methods and attributes, which can be found here: http://docs.python.org/release/2.2.3/lib/httpresponse-objects.html


This can be additionally simplified by importing and using the json library.