Mobile Local Walkthrough Tommy MacWilliam Setup JSONP

Mobile Local Walkthrough

YQL Tips and Tricks

Tommy MacWilliam Harvard University

February 8, 2011

Announcements Mobile Local Walkthrough Tommy MacWilliam Setup JSONP YQL

I

Lecture videos available at: https://www.cs76.net/Lectures

I

Section information: https://www.cs76.net/Sections

Tips and Tricks

Today Mobile Local Walkthrough Tommy MacWilliam Setup JSONP YQL Tips and Tricks

I

Setup

I

JSONP

I

YQL

I

Tips and Tricks

Section Feedback Mobile Local Walkthrough Tommy MacWilliam Setup JSONP YQL

I

Tips and Tricks

http://tommymacwilliam.com/e76/feedback I

I

let me know how I’m doing!

I don’t like long surveys either, so give me feedback via an anonymous (I promise) 140-character tweet!

HTML Setup Mobile Local Walkthrough Tommy MacWilliam Setup JSONP

I

YQL

we can do this using a single HTML page I

Tips and Tricks

I

remember, we’ll by using JavaScript+jQuery to update the contents of this page

multiple HTML pages (or “pages” using jQuery Mobile or jQTouch) are not necessary, but you can certainly use more than one page if you’d like to

HTML Setup Mobile Local Walkthrough Tommy MacWilliam Setup JSONP YQL Tips and Tricks

I

HTML5 Doctype:

I

jQuery: I

I

http://docs.jquery.com/Downloading_jQuery

tags!

HTML Setup Mobile Local Walkthrough Tommy MacWilliam Setup JSONP

I

other things we’ll need

YQL

I

Tips and Tricks

I I

I I

text box: so users can enter a location submit button: so users can get news for a location news area: so your news has a place to be displayed to the user geolocate: up to you! history: up to you!

HTML Setup Mobile Local Walkthrough Tommy MacWilliam Setup

I

let’s test out our setup to make sure we’re good to go before we dive in

I

HTML sanity check: are the elements visible on the page and selectable?

I

jQuery sanity check: can we say hello to the user via $(document).ready?

JSONP YQL Tips and Tricks

I

remember, $ is a jQuery function, so this will only work if we’ve loaded jQuery correctly

HTML Setup Mobile Local Walkthrough Tommy MacWilliam Setup JSONP YQL Tips and Tricks

I

example time! I

http://tommymacwilliam.com/e76/section2/setup.html

JSON Mobile Local Walkthrough Tommy MacWilliam Setup JSONP

I

JSON stands for JavaScript Object Notation

YQL

I

despite having JavaScript in its name, JSON is a language-independent data interchange standard

Tips and Tricks

I I I

RFC 4627, if you’re interested just like XML, but much less verbose more human-readable, too

JSON Mobile Local Walkthrough Tommy MacWilliam Setup

I

syntax is identical to the syntax for creating a JavaScript object

JSONP

{

YQL

“car”: { “color”: “red”, “miles”: 20918, “owners”: [ “tommy”, “alycia” ] }

Tips and Tricks

} I

isn’t that so much nicer than XML?

JSON Mobile Local Walkthrough Tommy MacWilliam Setup JSONP

I

WebKit browsers have a built-in JSON parser

YQL

I

JSON.parse(string): parse a JSON string and return an object

Tips and Tricks

I

I

will fail silently if your JSON string has a syntax error!

JSON.stringify(object): convert an object into a string that can be parsed by JSON later

JSON Mobile Local Walkthrough Tommy MacWilliam Setup JSONP YQL Tips and Tricks

I

example time! I

http://tommymacwilliam.com/e76/section2/json.html

AJAX Win? Mobile Local Walkthrough Tommy MacWilliam Setup JSONP YQL

I

remember, AJAX allows us to make requests to other pages from JavaScript

I

cool beans, let’s try to load the Google News homepage with a GET request

Tips and Tricks

AJAX Win? Mobile Local Walkthrough Tommy MacWilliam Setup JSONP YQL Tips and Tricks

I

example time! I

get.html

Same Origin Policy Mobile Local Walkthrough Tommy MacWilliam Setup

I

JSONP YQL Tips and Tricks

“XMLHttpRequest cannot load http://news.google.com/. Origin http://tommymacwilliam.com is not allowed by Access-Control-Allow-Origin.” I

I

forget it, let’s just go home

this is a security feature of JavaScript: we cannot load content from different domains I

news.google.com is a different domain than tommymacwilliam.com

JSONP Mobile Local Walkthrough

I

Tommy MacWilliam Setup

I

or, “JSON with padding”

I

we can use .

96KB Sizes 0 Downloads 334 Views

Recommend Documents

Walkthrough 8
index.html – homepage. ▫ buildings.js – buildings in the game. ▫ houses.js – Harvard houses + locations. ▫ math3d.js – movement math. ▫ passengers.js – all the people in the game. ▫ service.css – appearance of the homepage. ▫

Walkthrough 8
Agenda. ▫ Distribution Code. ▫ HTML + CSS. ▫ Javascript. ▫ API's: Google Earth and Google Maps. ▫ Pickup. ▫ Dropoff. ▫ Choice of feature ...

Walkthrough 8
index.html – homepage. ▫ buildings.js – buildings in the game. ▫ houses.js – Harvard houses + locations. ▫ math3d.js – movement math. ▫ passengers.js – all the ...

CS 50 Walkthrough 5
Data structures, hexadecimal, and pointers. • Programs: – whodunit. – resize. – recover ... Image recovery! ... Go through each block in the disk image and: 1.

CS 50 Walkthrough 5
Image recovery - Steps. • Steps: Go through each block in the disk image and: 1. If we find a JPEG signature, start wriûng the bytes out to another file. 2. If we find a new JPEG signature, close that old file and go back to 2. 3. If we find the E

CS50 Walkthrough 4
To Do. ▫ distribution code. ▫ ncurses. ▫ move cursor. ▫ allow changing user-added ... Allows you to change colors, ... g.board[g.y][g.x] is spot on board where.

CS 50 Walkthrough 5
A bitmap is a series of consecuûve pixels described after each other. • Also has “metadata” in first 54 bytes consisûng of two headers.

CS50 Walkthrough 4
function, takes one argument ch (ascii). ▫ if ch is 0, . , KEY_BACKSPACE, KEY_DC. ▫ set that spot in the board to 0. ▫ if ch is numerical between '1' and '9'.

CS50 Walkthrough #3
search. ▫ sort. ▫ fifteen.c. ▫ distribution code ... Re-implement as binary! ▫ why? ▫ 2 main ways. ▫ iterative. ▫ recursive. Page 6. Binary Search: Iterative. Go to middle.

CS50 Walkthrough 4
distribution code. ▫ ncurses. ▫ move cursor. ▫ allow changing user-added numbers, but not original ones. ▫ allow replacement of blank with number. ▫ invalid move? ▫ won? ... Moving the cursor. ▫ Switch statements! switch (test). { case

CS 50 Walkthrough 6
create nodes for them. – put these nodes ... store each le›er i of the word in that node. • fgetc(dptr) is that ... put a pointer to your node that you just malloced there.

CS50 Walkthrough #3
Go to middle if k < value at middle search for k between first and the one before the middle if k > value at middle search for k between one after the middle and ...

CS50 Walkthrough 1
Videos on website. ▫ Purpose. ▫ To guide you through the week's assignment ... poor/fair/good/better/best ... Building Blocks. ▫ printf. ▫ GetInt(). ▫ “thinking”.

CS 50 Walkthrough 6
Topics: – More data structures, more pointers. – More File I/O. • You implement: ... convert each le›er of word tolower. • hash word and go to that place in array.

A local mobility agent selection algorithm for mobile ...
Email: {yxu, hlee, vriz}@i2r.a-star.edu.sg. Abstract— The Mobile IP ... dent service. No matter where a host resides physically, the network should be able to identify it correctly with transpar- ent support for communications above network layer.

Computer Science 50 Walkthrough 2
This old man, he played one. He played knick-knack on my thumb. Knick-knack paddywhack, give your dog a bone. This old man came rolling home. This old man, he played two. He played knick-knack on my shoe. Knick-knack paddywhack, give your dog a bone.

Computer Science 50 Walkthrough 2
Computer Science 50. Introduction to Computer Science I. Harvard College. Marta Bralic [email protected]. Walkthrough 2 ...

Computer Science 50 Walkthrough 2
This old man, he played one. He played knick-knack on my thumb. Knick-knack paddywhack, give your dog a bone. This old man came rolling home. This old ...

iOS: Evil Hangman Walkthrough - cs164
Mar 21, 2012 - Property Lists. Equivalence. Classes. Protocols. Transitioning. Between. Views. Settings. iOS: Evil Hangman Walkthrough. CS164 Walkthrough ...

Cognitive Walkthrough Forms
University of Colorado at Boulder. Department of Computer Science ... Alto, California designed and completed a study to compare a variety of usability ..... performed; where each "best way" corresponds to one sequence of user actions, eg. a ...

CS50 Walkthrough #3 - CS50 CDN
what type are these values? ▫ how do we initialize them? ▫ don't forget! ▫ swap tiles for even d ... Questions? Please email me feedback: [email protected].

xenogears walkthrough pdf
File: Xenogears walkthrough pdf. Download now. Click here if your download doesn't start automatically. Page 1 of 1. xenogears walkthrough pdf. xenogears ...