buildingplatforms

Post on 24-May-2015

2.327 Views

Category:

Technology

0 Downloads

Preview:

Click to see full reader

DESCRIPTION

Os últimos anos conferiram à web uma nova dinâmica. Novos produtos e soluções inundam a nossa atenção a toda a hora, mas a verdadeira killer feature é a facilidade com que se constroem novos serviços sobre APIs. Building platforms é uma apresentação orientada adevelopers sobre APIs e plataformas como Microformats, OpenID, OAuth.

TRANSCRIPT

Frederico Oliveira / Webreakstuff / @ SAPO Codebits

Building Platforms

Introdução

Web 2.0? What the f%&#?

out: Square Corners in: Rounded Corners

out: #FF0000in: Gradientes

out: cat

out: catin: lolcat

invisible dance partner.

out: Robotsin: Humans

out: IRCin: Facebook / MySpace

social networking é o novo instant messaging

out: Rede como plataforma in: Apps como plataforma

out: Data Silos in: Data Sources

data! data! data!

data!data!

data! data!

data!

All praise the mighty API!

API (Application Programming Interface)

o LEGO da internet.

data!

data!

data! data!

data!

data!

data!data!

data! data!

mashups

An interesting 2005, Bubblr, Clockr, Dumpr.net, Favcol, FD's Flickr Toys, Findr, Flappr, Flash-based Kaleidoscope, Flauntr, Flickeur, Flickr Chia Pet, Flickr Color Selectr, Flickr Font, Flickr Graph, Flickr Group Trackr, Flickr Hive Mind, Flickr Leech, Flickr Leech, Flickr Logo Makr, Flickr People Finder, Flickr RSS Reader, Flickr Set Manager, Flickr Sets RSS, Flickr SlideShow Generator, Flickr Tag Viewer, Flickr2Photocast, FlickrFling, FlickrFly, Flickriver, FlickrLilli, FlickrNews, FlickrReplacr, Flicktionary, Fotocrib, Gickr, h4ppierphotos, Invitr, Islands of Consciousness, Mappr, Matchr, MightyFlickr, Mosaickr, Pixel Peeper, Printr Killr, Retrievr, RSS 2 PDF, Salutr, Selfportraitr

Porquê APIs? (para empresas)

Porquê APIs? (para developers)

Weather.com + Google Maps + Dopplr = Melhores sítios para passar férias em Janeiro.

Last.fm + Amazon ECS = Recomendações personalizadas de albuns com reviews e e-store

Daylife + Technorati + Yahoo Finance = Sistema para correlacionar mercados e notícias no mundo

(Que me tivesse dito com antecedência para comprar acções GALP) :-)

out: internet como plataformain: tudo é uma plataforma

data! data!

data!data!

data! data!

data!

Web-apps sem API são desinteressantes.

“Can’t get enough of that sweet, sweet data.”

Tom Coates @ Web 2.0 Expo

APIs são tão 2006

Microformats, OpenID, OAuth

Muito mais 2007/08.

Microformats, OpenID, OAuth

Patterns para descrever microcontent, escritas sobre semântica existente (xhtml).microformats.org

<div class="agent vcard"> <a class="email fn" href="mailto:jfriday@host.com">Joe Friday</a> <div class="tel">+1-919-555-7878</div> <div class="title">Area Administrator, Assistant</div></div>

Exemplo: hCardAGENT:BEGIN:VCARD\nFN:Joe Friday\nTEL:+1-919-555-7878\nTITLE:Area Administrator\, Assistant\n EMAIL\;TYPE=INTERNET:\njfriday@host.com\nEND:VCARD\n

<div class="vevent"> <a class="url" href="http://www.web2con.com/">http://www.web2con.com/</a> <span class="summary">Web 2.0 Conference</span>: <abbr class="dtstart" title="2007-10-05">October 5</abbr>- <abbr class="dtend" title="2007-10-20">19</abbr>, at the <span class="location">Argent Hotel, San Francisco, CA</span></div>

Exemplo: hCalendarBEGIN:VCALENDARPRODID:-//XYZproduct//ENVERSION:2.0BEGIN:VEVENTURL:http://www.web2con.com/DTSTART:20071005DTEND:20071020SUMMARY:Web 2.0 ConferenceLOCATION:Argent Hotel\, San Francisco\, CAEND:VEVENTEND:VCALENDAR

Microformats, OpenID, OAuth

Objectivo: ser interpretados principalmente por pessoas. Máquinas depois.microformats.org

1-0

Microformats, OpenID, OAuth

Sistema de identidade aberto e descentralizado. Um único login para todos os sites.openid.net

Microformats, OpenID, OAuth

Evita ter de confiar na Microsoft (Passport), ou SixApart (Typekey).

Microformats, OpenID, OAuth

Decisão sobre em quem confiar está do lado do utilizador.

2-0

Microformats, OpenID, OAuth

Protocolo de autenticação seguro para APIs, para clientes Desktop e Web-basedoauth.net

Microformats, OpenID, OAuth

Evita ter de dar dados confidenciais a um site que quer aceder a dados em outro. Ex: Facebook + GMail contacts

Microformats, OpenID, OAuth

Ao contrário de trocar emails e passwords (com acesso total), trocam-se tokens de acesso limitado aos dados do user.

3-0

Hack-fest sem código? <:(

No API? No problem.

http://www.ruby-lang.org/en/http://code.whytheluckystiff.net/hpricot/http://mofo.rubyforge.org/

lojadocidadao.pt + hpricot = O script anti-filas.

1 def update(serv) 2 a = Hpricot(open(serv)) 3 4 a.search("b").each_with_index do |a, i| 5 if i == 1 6 pessoas = a.inner_html 7 elsif i == 2 8 tempomedio = a.inner_html 9 elsif i == 3 10 tempoat = a.inner_html 11 elsif i == 5 12 balcoes = a.inner_html 13 end 14 end 15 end 16 17 update("http://www.lojadocidadao.pt/webiglc/inlineinclude.aspx?local=3&entidade=3&senha=A")

deviantart + hpricot + feed-rss = Feed de wallpapersurl = "http://browse.deviantart.com/customization/wallpaper/animals/"doc = Hpricot(open(url))

elements = (doc/"div.stream")#elements = (elements/"a.src")

pages = Array.new

html = elements.to_html html.each('<') { |s| s =~ /a href=\"([^\"]+)/ if Regexp.last_match(1) != nil pages.push(Regexp.last_match(1)) end}

pages.each { |s| p s }

wikipedia + hpricot = Crawler de artigosdoc = Hpricot open('http://en.wikipedia.org/wiki/List_of_bicycle_manufacturing_companies')@article = (doc/"#content").each do |content| #change /wiki/ links to point to full wikipedia path (content/:a).each do |link| unless link.attributes['href'].nil? if (link.attributes['href'][0..5] == "/wiki/") link.attributes['href'].sub!('/wiki/', 'http://en.wikipedia.org/wiki/') end end end

#remove unnecessary content and edit links items_to_remove.each { |x| (content/x).remove }

#replace links to create new entries with plain text (content/"a.new").each do |link| link.parent.insert_before Hpricot.make(link.attributes['title']), link end.removeend

flickr + mecanize = flickr hcard contact fetcher agent = WWW::Mechanize.new

agent.user_agent_alias = 'Mac FireFox'page = agent.get('http://flickr.com/signin/')form = page.forms.name('login_form').firstform.login = 'login'form.passwd = 'pass'page = agent.submit(form)

page = agent.click page.links.text('click here')page = agent.click(page.links.text('Contacts'))page = agent.click(page.links.text('Contact List'))page = agent.click page.links.text('Contacts')[1]

page.links.text('profile').each do |profile| profile_page = agent.get(profile.href) tree = Microformat.find(:text => profile_page.body) hcard = tree.first unless tree.empty? puts hcard.email.gsub(' [at] ','@') unless hcard.email.nil?end

Data é o “building block” fundamental da web hoje em dia. Tudo o que construímos são potenciais plataformas.

Bonus bits: Android (demo)open + free + mobile platform

fred@webreakstuff.com

top related