User:Max Dovey/PT/TRIMESTER 2

From XPUB & Lens-Based wiki
< User:Max Dovey‎ | PT
Revision as of 19:10, 26 March 2014 by Max Dovey (talk | contribs)

A Short History of The Internet

THE WEB - html, http, url web page : html, javascript, css

MArch 1989, Tim Berners-Lee publishes 'information management: A proposal'. Could login to servers via physical terminals and ssh. He was working on improving terminal interactions with server environments. http://www.w3.org/History/1989/proposal.html hypertext -Ted Nelson "Computer lib / Dream Machines" defines computer lib championing creative use of technology and computers. He defines Hypermedia in his unstrcutured, loose writng format. Ted Nelson believed in central ownership and a network where users would license in a cut/copy format rather than a c opy paste format. Brings up the argument about the freedom of web2.0 where all the content is free,but access through telecomms costs. Another system would be free acess but pay for content , that way authors would get credited and payed.

HTTP protocol we no longer view the "original" html doc on the server, we request php,perl that access the html for updates , and caches the file so that it doesnt have to reload it to show it to the browser client every time.

Hosting & Databases The economics of hosting... Its only as stable as the next Bussiness plan. Which isnt wrong, its just bad for us to assume that this is unfair (that when a company changes its bussiness plan and deletes your account its not fair) If you did have an economic network where you became the purchaser or the license owner of content when you embedd, rather than being the customer, you become the buyer and therefore if the company/ server goes down than you can still have ownership.

Active archives When 1 person (or millions of people) loose their myspace or geocities page all you hear is complaints, but the scale is greater when cultral institutions and large bussiness (or their server hosting companies) sink and cant pay to recover their archives. Network traffic sound http://www.ioplex.com/~miallen/tcpsound/ html.write()

speech language processing

CGI

search

Where? map dispaying google searchers containing the phrase 'where can i?" http://headroom.pzwart.wdka.hro.nl/~max/where.html

subtitles

Takes text from SRT (film subtitle files) into a formatted text file

import sys, zipfile, os, shutil, glob, textwrap, re
from os.path import join
f = open("filmsubs/Lost In Translation [Eng].srt", "r",)
h =open("lostintranslation.txt", "w")

i=0
for line in f:
    # read file

    
    if re.findall(r'\b --> \w+', line): #if you find '-->' do something

        # print next(f)
            
        # print i 

        x = 1 # x = line after this symbol 

        checkBlank = False

        while checkBlank is False: 

            p = open("filmsubs/Lost In Translation [Eng].srt", "r",)

            line = p.readlines()[i+x] #read line from point i(where we last where) plus x (read on from this point)

            h.write(line)

            p.close()

            x=x+1 #iterate this digit so that it reads nextline in this while loop until....

            if re.match(r'^\s*$',line):
                checkBlank = True



    i=i+1

pilimageseuqncefromtextfile

import PIL
from PIL import ImageFont
from PIL import Image
from PIL import ImageDraw
import struct, sys , time , os 
import glob 
from images2gif import writeGif
import sys, zipfile, os, shutil, glob, textwrap
from os.path import join

font = ImageFont.truetype("/Library/Fonts/arial.ttf", size= 12, index = 0 , encoding = 'armn' ) #set font to armn apple roman 
img=Image.new("RGBA", (600,480),(0,0,0))
pages = 0 
speed = 0.2
height = 7 
f = open("thegrandbeauty.txt", "r",)
# text = f.readlines()

if not os.path.exists('images'):
    os.makedirs('images')

for word in f:
    pages = pages +1 
    height = height +10
    draw  = draw = ImageDraw.Draw(img)
    draw.text((260, height),word,(255,255,255),font=font)
    img.save("images/a_test%02d.png" % pages)

A test14.png
A still from subtitle rip of "cleo from 5 - 7" by agnes Varda.

speech

Talking into the Twitter Stream

import json
import simplejson
import os, sys
import time
import commands 
import subprocess
import twitter
CONSUMER_KEY = "****"
CONSUMER_SECRET = "****"
OAUTH_TOKEN = "****"
OAUTH_TOKEN_SECRET = "****"

auth = 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

                                )
f = open("translate.txt", "r") #define file path

key=[]
q = [] 
for line in f:
    sentence = line.split()
    words = sentence[-1::]
    key.append(words)

p = open("translationfull.txt", "w",)
sawword= False 
q = key 
print q 
count = 2
search_results= twitter_api.search.tweets(q=q, count=count)
for status in search_results['statuses']:
    text = status['text']
    words = text.split()
    print words

    for i in words:
        if q in words:
            sawword=True
            print i
            p.write(word) 
            p.writelines("\n ")

            
        elif (sawword):
            print word 
            p.write(word)
            p.writelines("\n")
            sawword= False 
            time.sleep(2)
        p.close()