User:Max Dovey/ PT/TRIMESTER 1 ntw6

From XPUB & Lens-Based wiki

Week 1

Alan Turing's Universal Turing Machine (UTM) http://en.wikipedia.org/wiki/Universal_machine

was a concept for an infinite loop of tape that seperated into frames, each frame would present a different state. This created an infinite programming potential for reading. 

deconstructing the seamlessness of the factory line. The pipeline.


in the afternoon we played with Turtle.

http://opentechschool.github.io/python-data-intro/core/recap.html

https://github.com/OpenTechSchool/python/wiki/Facebook-Client

http://bitsofpy.blogspot.nl/2010/04/in-my-cosc-lab-today-few-students-were.html

facebook page query

[
>>> import json
>>> import urllib2
>>> def load_facebook_page(facebook_id):
...     addy = 'https://graph.facebook.com/548951431'
...     return json.load(urllib2.urlopen(addy))

load_facebook_page(548951431)
{u'username': u'max.dovey', u'first_name': u'Max', u'last_name': u'Dovey', u'name': u'Max Dovey', u'locale': u'en_US', u'gender': u'male', u'link': u'http://www.facebook.com/max.dovey', u'id': u'548951431'}
]

stuff to do & Resources - start fetching data from the twitter api https://code.google.com/p/python-twitter/ http://pzwart3.wdka.hro.nl/wiki/PythonTwitter http://www.lynda.com/Python-tutorials/Up-Running-Python/122467-2.html

mining the social web by o'reilly https://github.com/ptwobrussell/Mining-the-Social-Web updated github for twitter oauth http://www.pythonforbeginners.com/python-on-the-web/how-to-access-various-web-services-in-python/ http://www.greenteapress.com/thinkpython/thinkpython.pdf http://hetland.org/writing/instant-python.html

replacing "Music" with "Crap" on 20 most popular video search from youtube

import json
import requests 

r = requests.get("http://gdata.youtube.com/feeds/api/standardfeeds/top_rated?v=2&alt=jsonc")
r.text

data = json.loads(r.text)

#print data
for item in data['data']["items"]:   
    print " %s" % (item['category'].replace("Music", "CRAP"))

CRAP
Entertainment
CRAP
CRAP
CRAP
CRAP
CRAP
CRAP
CRAP
Comedy
CRAP
CRAP
Comedy
CRAP
CRAP
CRAP
CRAP
Entertainment
CRAP
CRAP
CRAP

Week2=

In the morning we looked at SVG files, and how you can edit the xml of them in a live editor within inskape. You can also execute python commands by pasting in python drawings and the vectors will be generated within inskape.

In the afternoon we looked at making api grabs , loading them with Json libs

ajax.googleapis.com/ajax

add json extension for firefox

Json turns xml into a javascript object.

json has lists - lists [] append("milk")

and dictionary {} foods = [foods["chocolate"] = "love to eat it"]

runcron - can execute pythonn scripts from a server timed.

i got my twitter search function to write to a text file. Im going to look at automating that text file to network printer for this cloud project.

useful link http://lifehacker.com/5652311/print-files-on-your-printer-from-any-phone-or-remote-computer-via-dropbox http://docs.python.org/2/tutorial/inputoutput.html facebook - https://github.com/OpenTechSchool/python/wiki/Facebook-Client youtube api - http://gdata.youtube.com/ http://nealcaren.web.unc.edu/an-introduction-to-text-analysis-with-python-part-1/

Week3=

This script prints a json grab from twitter api, loops and sends to printer every 55 seconds.

uth = twitter.oauth.OAuth(OAUTH_TOKEN, OAUTH_TOKEN_SECRET,
                           CONSUMER_KEY, CONSUMER_SECRET)

twitter_api = twitter.Twitter(domain='api.twitter.com', 
                              api_version='1.1',
                              auth=auth
                                             )
filepath = "Desktop/autoprinting/todo/" #define file path 

filename = "cloud101" #def file name 
#if file path does not exist make this
if not os.path.exists('Desktop/autoprinting/todo'):
    os.makedirs('Desktop/autoprinting/todo')
#add filename to path 
completepath = os.path.join(filepath, filename+".txt")
    

while True:
    q = "the_cloud"
    count = 30
    f = open (completepath, "w",)
    search_results= twitter_api.search.tweets(q=q, count=count)
    # search_results['meta_data']
    for status in search_results['statuses']:
        text = status['text']
        date = status['created_at']
        simplejson.dump(text + date, f)
        f.writelines("\n")

    f.close()
    
    time.sleep(55)
#if path exists 
    if os.path.exists('Desktop/autoprinting/todo/cloud101.txt'):
#lbr print 
        os.system("lpr -p -r Desktop/autoprinting/todo/cloud101.txt")

week 4

basic arithmetic (moving the digit to another column when u reach *power 10*) keeping the count. binary systems would use 10 figures ( 0,1,2,3,4,5,6,7,8,9) and then when it gets to 10 will give to another cog to start counting giving you an infinite counting system. The difference engine

George Boole began implementing numerical binary into text in logic. He is the inventor of what is known as Boolean logic, true and false statements and conditionals.

Lewis carroll wrote logic conditionals in alice and wonderland "It is a very inconvenient habit of kittens (Alice had once made the remark) that, whatever you say to them, they Always purr.  'If them would only purr for "yes" and mew for "no," or any rule of that sort,' she had said, 'so that one could keep up a conversation!  But how can you talk with a person if they always say the same thing?' Lewis Carroll (1832 - 1898)

Alice predicament allows us to talk with computers. Alice's whole adventure is based on encountering scenarios and applying logic conditionals.

8-bit = 8 on and offs. giving you 255 characters to allocate. all commmands are distributed via the ascII table. http://en.wikipedia.org/wiki/ASCII unicode (utf-8) (UTF-16) Think about the task of the translator by Walter Benjamin/ Everything is interpreted. every webpage is being encoded all bytes are counters for their 8 bit reference gives them a Glyph. see last years page for more on human computation http://pzwart3.wdka.hro.nl/wiki/Human_Computation_(Slides) PYTHON AND AUDIO wav files have a header like how utf is encoded at the top of html. (16 bit little endian , rate 44100 hz, stereo) number of samples / sample rate = time of piece. using this example http://zacharydenton.com/generate-audio-with-python/