빅데이터 워크샵 - 언론재단

Similar documents
Week5

Week13

PowerPoint 프레젠테이션

Week1

PowerPoint 프레젠테이션

DIY 챗봇 - LangCon

Polly_with_Serverless_HOL_hyouk

4. #include <stdio.h> #include <stdlib.h> int main() { functiona(); } void functiona() { printf("hihi\n"); } warning: conflicting types for functiona

Page 2 of 5 아니다 means to not be, and is therefore the opposite of 이다. While English simply turns words like to be or to exist negative by adding not,

6주차.key

Hi-MO 애프터케어 시스템 편 5. 오비맥주 카스 카스 후레쉬 테이블 맥주는 천연식품이다 편 처음 스타일 그대로, 부탁 케어~ Hi-MO 애프터케어 시스템 지속적인 모발 관리로 끝까지 스타일이 유지되도록 독보적이다! 근데 그거 아세요? 맥주도 인공첨가물이

ORANGE FOR ORACLE V4.0 INSTALLATION GUIDE (Online Upgrade) ORANGE CONFIGURATION ADMIN O

초보자를 위한 C++

Lab10

1217 WebTrafMon II

소식지도 나름대로 정체성을 가지게 되는 시점이 된 거 같네요. 마흔 여덟번이나 계속된 회사 소식지를 가까이 하면서 소통의 좋은 점을 배우기도 했고 해상직원들의 소탈하고 소박한 목소리에 세속에 찌든 내 몸과 마음을 씻기도 했습니다. 참 고마운 일이지요 사람과 마찬가지로

하나님의 선한 손의 도우심 이세상에서 가장 큰 축복은 하나님이 나와 함께 하시는 것입니다. 그 이 유는 하나님이 모든 축복의 근원이시기 때문입니다. 에스라서에 보면 하나님의 선한 손의 도우심이 함께 했던 사람의 이야기 가 나와 있는데 에스라 7장은 거듭해서 그 비결을

SRC PLUS 제어기 MANUAL

Javascript.pages

Week3

Microsoft PowerPoint - web-part03-ch19-node.js기본.pptx

<C0CCBCBCBFB52DC1A4B4EBBFF82DBCAEBBE7B3EDB9AE2D D382E687770>

Modern Javascript

DocsPin_Korean.pages

Orcad Capture 9.x

PowerChute Personal Edition v3.1.0 에이전트 사용 설명서

Page 2 of 6 Here are the rules for conjugating Whether (or not) and If when using a Descriptive Verb. The only difference here from Action Verbs is wh

야쿠르트2010 3월 - 최종


PowerPoint 프레젠테이션

PCServerMgmt7

C# Programming Guide - Types

K7VT2_QIG_v3

Eclipse 와 Firefox 를이용한 Javascript 개발 발표자 : 문경대 11 년 10 월 26 일수요일

<32B1B3BDC32E687770>

T100MD+

2 min 응용 말하기 01 I set my alarm for It goes off. 03 It doesn t go off. 04 I sleep in. 05 I make my bed. 06 I brush my teeth. 07 I take a shower.

Social Network

Solaris Express Developer Edition

Mars OS System Administration Guide

PWR PWR HDD HDD USB USB Quick Network Setup Guide xdsl/cable Modem PC DVR 1~3 1.. DVR DVR IP xdsl Cable xdsl Cable PC PC DDNS (

1


CD-RW_Advanced.PDF

13주-14주proc.PDF

Assign an IP Address and Access the Video Stream - Installation Guide

휠세미나3 ver0.4

PL10

112초등정답3-수학(01~16)ok

Software Requirrment Analysis를 위한 정보 검색 기술의 응용

Microsoft PowerPoint - 기계공학실험1-1MATLAB_개요2D.pptx

10X56_NWG_KOR.indd

歯처리.PDF

Stage 2 First Phonics

10주차.key

0.1-6

요약 1

2007 학년도 하반기 졸업작품 아무도 모른다 (Nobody Knows) 얄리, 보마빼 (AIi, Bomaye) 외계인간 ( 外 界 人 間 ) 한국예술종합학교 연극원 극작과 예술전문사 안 재 승

chapter4

VOL /2 Technical SmartPlant Materials - Document Management SmartPlant Materials에서 기본적인 Document를 관리하고자 할 때 필요한 세팅, 파일 업로드 방법 그리고 Path Type인 Ph

HTML5가 웹 환경에 미치는 영향 고 있어 웹 플랫폼 환경과는 차이가 있다. HTML5는 기존 HTML 기반 웹 브라우저와의 호환성을 유지하면서도, 구조적인 마크업(mark-up) 및 편리한 웹 폼(web form) 기능을 제공하고, 리치웹 애플리케이 션(RIA)을

15_3oracle

1_2•• pdf(••••).pdf

MasoJava4_Dongbin.PDF

October 2014 BROWN Education Webzine vol.8 울긋불긋 가을이야기 목차 From Editor 앉아서 떠나는 여행 Guidance 그림책 읽어주는 기술 Homeschool 다양한 세계문화 알아보기 Study Trip 올 가을!풍요로운 낭만축

Domino Designer Portal Development tools Rational Application Developer WebSphere Portlet Factory Workplace Designer Workplace Forms Designer

_KF_Bulletin webcopy

07 자바의 다양한 클래스.key

YV-150-S.CHINESE1.0-1

SIGPLwinterschool2012

USB USB DV25 DV25 REC SRN-475S REC SRN-475S LAN POWER LAN POWER Quick Network Setup Guide xdsl/cable Modem PC DVR 1~3 1.. DVR DVR IP xdsl Cable xdsl C

untitled

APOGEE Insight_KR_Base_3P11

본문01

04서종철fig.6(121~131)ok

C++-¿Ïº®Çؼ³10Àå

manual pdfÃÖÁ¾

강의10

28 THE ASIAN JOURNAL OF TEX [2] ko.tex [5]

LXR 설치 및 사용법.doc

PRO1_04E [읽기 전용]

03.Agile.key

s SINUMERIK 840C Service and User Manual DATA SAVING & LOADING & & /

untitled

chap10.PDF

thesis

02 C h a p t e r Java

DE1-SoC Board

B _01_M_Korea.indb

09오충원(613~623)

오늘날의 기업들은 24시간 365일 멈추지 않고 돌아간다. 그리고 이러한 기업들을 위해서 업무와 관련 된 중요한 문서들은 언제 어디서라도 항상 접근하여 활용이 가능해야 한다. 끊임없이 변화하는 기업들 의 경쟁 속에서 기업내의 중요 문서의 효율적인 관리와 활용 방안은 이

Remote UI Guide

Facebook API

Mobile Service > IAP > Android SDK [ ] IAP SDK TOAST SDK. IAP SDK. Android Studio IDE Android SDK Version (API Level 10). Name Reference V

슬라이드 1

Interstage5 SOAP서비스 설정 가이드

±èÇö¿í Ãâ·Â

untitled

ecorp-프로젝트제안서작성실무(양식3)

Transcription:

Joonhwan Lee, Ph.D. Human-Computer Interaction & Design Lab. Seoul National University

:,, :, /, /, / API : Facebook, Twitter, Google API, (crawler) 3

Ruby, Python, R, Java API: JSON : HTML parser, data mining algorithm,, ngram - http://trend.naver.com - http://www.google.com/trends/ - http://ngrams.googlelabs.com R python, R, Java 4

Ruby 1995 OOP,,,,! (mac, windows, linux ) 5

Ruby Ruby on Rails Ruby Data mining python java Data mining R Ruby on Rails Ruby on Rails Ruby 6

(Ruby) Mac OS/Windows http://installrails.com 7

(Ruby)

CMD & Terminal Windows Mac OS X command line tool Windows: cmd Mac: Applications Utilities Terminal Terminal 9

CMD & Terminal CMD Terminal example cd cd cd.. cd Documents cd ~/Desktop / dir ls - mkdir rmdir rename mkdir rmdir mv copy cp mkdir temp rmdir temp rename temp1 temp2 mv temp1 temp2 copy temp1 temp2 cp temp1 temp2 10

Text Editors. =. ( : x, x, x, x), Mac: TextMate, Smultron PC: SciTE, notepad++ 11

My First Ruby Program! text editor!! ruby < > 12

My First Ruby Program! irb (interactive ruby shell)!!!!! 13

why s poignant guide to Ruby http://mislav.uniqpath.com/poignant-guide/ http://www.rubyinside.com/media/poignant-guide.pdf ( ) ( 4/E), / / ( ) / ( ) reference http://www.ruby-doc.org/core-2.0.0/ http://api.rubyonrails.org 14

CodeAcademy http://codeacademy.com 15

Ruby

Data Type and Programming Language,. :,, ( ) (array) (hash):, 17

Numbers: Integer and Float integer( ) 8-382 920182371982791488273 0 float( ) 23.381 0.0002 0.0-2582.218389128 18

Simple Arithmetic. Lab 1 # code 1 puts 1.0 + 2.0 puts 2.0 * 3.0 puts 5.0-8.0 puts 9.0 / 2.0 => 3.0 => 6.0 => -3.0 => 4.5 # code 2 puts 1 + 2 puts 2 * 3 puts 5-8 puts 9 / 2 => 3 => 6 => -3 => 4 19

integer integer 9/2, float float 9.0/2.0 = 4.5 integer float float 9/2 float, float... 20

+ : addition - : subtraction * : multiplication / : division modulo (%) : 5%2 => 1, 1.5%0.4 => 0.3 exponentiation (**) : x**4 = x 4, x**-1 = x -1 multiple exponentiation 4**3**2 is the same as 4**9, not 64**2 21

Comment,, comment. Comment : # : =begin... =end 22

String String. String "" ''. 'Hello' "Hello, Ruby 2.0.0!" 'A drunken man said,!@#*$!@#&$^%#*!@#' ' ' '' puts. (lab4.rb) 23

String (String). (, ),, (space) (empty character, null character)? puts '?'. (lab4.rb )? lab4.rb:8: invalid multibyte char (US-ASCII) ruby 2.0.0 UTF-8 is default 24

US-ASCII Code ASCII (American Standard Code for Information Interchange) 128, ( ) 25

Unicode ASCII (?) UTF-8 ( ) : US-ASCII ( < 2.0.0) UTF-8 ( > 2.0.0) 26

utf-8 # encoding: utf-8 27

"" '' String "" ''. "" ''?. Knock, knock, "who's there?" > puts "Knock, knock, "who's there?"" => syntax error, unexpected tidentifier, expecting $end puts "Knock, knock, "who's there?"" ^ 28

String! puts "I like" + "apple pie." => I likeapple pie. no space puts "twinkle " * 10 29

String or Number? 12 vs. '12' Lab 2 puts 12 + 12 puts '12' + '12' puts '12 + 12' puts 2 * 5 puts '2' * 5 puts '2 * 5' => 24 => 1212 => 12 + 12 => 10 => 22222 => 2 * 5 30

String!. : (concatenate) :. Lab 3 puts '12' + 12 => TypeError: can't convert Fixnum into String puts '2' * '5' => TypeError: can't convert String into Integer puts 'Ruby' + 1.9 => TypeError: can't convert Float into String puts 'Ruby' * 'Rocks!' => TypeError: can't convert String into Integer 31

,. 22. 27. XX OO.,, 22, 27. y = 2x + a x = 3, a = 5, y =? x = 5, a = -1, y =? 32

Lab 4 name = "Tom Cruise" puts "My name is " + name + "." puts "You don't look like him."! (assign), = 33

reassign composer = "Mozart" puts "My favorite composer is " + composer + "." composer = "Beethoven" puts "My favorite composer is " + composer + "." assign. assign. var = "nothing" puts var var = 12 + 342 puts var 34

+. Lab 5. composer = "Mozart" puts "My favorite composer is #{composer}." second = 60 * 60 * 24 puts "#{second} seconds in a day."! #{ }.,. 35

Method? puts, gets, chomp, to_i, to_s : : object, : method :. object.method(parameter) : "hello\n".chomp "hello\n" chomp... +, -, *, / : : 1.+(3) 1 integer + 3 puts, gets: (self) 36

String Method String "..." '...' String http://www.ruby-doc.org/core-2.0.0/string.html capitalize, center, chomp, chop, concat, crypt, downcase, include?, length, reverse, slice, upcase 37

Math : (+, -, *, /) (**), (%) Math puts(math::pi) puts(math.cos(math::pi/3)) puts(math.tan(math::pi/4)) puts(math.log(math::e**2)) => 3.14159265358979 => 0.5 => 1.0 => 2.0 puts((1 + Math.sqrt(5))/2) => 1.61803398874989 38

Method. def sayhello puts 'Hello' end def saybye puts 'Bye' end > sayhello => Hello > saybye => Bye 39

Method parameter def sayhello(name) puts 'Hello ' + name + '!' end def saybye(name1, name2) puts 'See you soon, ' + name1 + ' and ' + name2 + '!' end sayhello('nicole') sayhello('ruby') saybye('jack', 'Jill') 40

Method Lab 6 def calc_ex(n1, n2, n3) return (n1 * n2) / n3 end a = calc_ex(3, 9, 7) b = calc_ex(82, 42.8, 22) c = a + b puts a puts b puts c 41

Time Date t = Time.now t = Time.local(2012, 10, 27, 15, 45, 35) (year, month, day, hour, minute, second) > puts t.year > puts t.day > puts t.hour 42

t.strftime("%y/%m/%d %H:%M:%S") t.strftime("%y/%m/%d %I:%M:%S %p") *formatting rule: http://ruby-doc.org/core-2.0.0/ Time.html 43

: t1 = t + 30 (adding 30 seconds) t2 = t + (60 * 60 * 24 * 5) (adding 5 days) t1 < t2 (true) t2 < t (false) 44

(Date) Date require method require 'date' today = Date.today aday = Date.new(2012, 10, 27) today.to_s (date ) 45

(flow) - flow... ooo.. ooo.. : A B C1 A B C2 46

Boolean Comparison Operators Similar to Algebra > greater than < less than >= greater than or equal to <= less than or equal to == equality (equal to) Note: = is the assignment operator: x = 5;!= inequality (not equal to) 47

Branching: if statement (true). (false). if boolean_expression end execute this line false condition action true 48

Branching: if statement INDENT Lab 7 puts 'Hello, what\'s your name?' name = gets.chomp puts 'Hello, ' + name + '.' if name == 'ruby' puts 'What a lovely name!' end => Hello, what's your name? ruby Hello, ruby. What a lovely name! TRUE FALSE 49

Branching: if else statement false if boolean_expression execute this line #1 else execute this line #2 end condition true false false action true action 50

Branching: if else statement Lab 8 puts 'I am a fortune-teller. Tell me your name:' name = gets.chomp if name == 'ruby' puts 'I see great things in your future.' else puts 'Your future is... Oh my! Look at the time!' puts 'I really have to go, sorry!' end!! => I am a fortune-teller. Tell me your name: java Your future is... Oh my! Look at the time! I really have to go, sorry! 51

Branching: nested if else statement Lab 9 puts 'Hello, and welcome to 7th grade English.' puts 'My name is Mrs. Gabbard. And your name is...?' name = gets.chomp if name == name.capitalize puts 'Please take a seat, ' + name + '.' else puts name + '? You mean ' + name.capitalize + ', right?' puts 'Don\'t you even know how to spell your name??' reply = gets.chomp if reply.downcase == 'yes' puts 'Hmmph! Well, sit down!' else puts 'GET OUT!!' end end 52

Branching: if elsif statement if boolean_expression execute this line #1 elsif boolean_expression execute this line #2 elsif boolean_expression execute this line #3 else boolean_expression execute this line #4 end false condition false action true true action 1 true action 2 53

Branching: if elsif statement Lab 10 puts "Enter your password:" password = gets.chomp! if password.length <= 4 puts "Password should be longer than 4 letters." elsif password.length > 8 puts "Password should be shorter than 8 letters." else puts "You have entered #{password}." end! 54

Branching: case statement if...elsif case statement when condition1 do this line #1 when condition2 do this line #1 when condition3 do this line #1 else do this line #1 end 55

Branching: case statement Lab 11 puts "What's your age?" age = gets! case age.to_i when 0..2 then puts "baby" when 3..6 then puts "little child" when 7..12 then puts "child" when 12..18 then puts "youth" else end puts "adult" 56

Logical Operators: AND. Logical Operator AND. A AND B: A B A && B A and B A B Output 0 0 0 0 1 0 1 0 0 1 1 1 AND table age = 21; permit = 1;! if age >= 20 if permit == 1 puts "OK to Drive"; else puts "Ride the bus"; end else puts "Ride the bus"; end Nested ifs age = 21; permit= 1;! if age >= 20 and permit == 1 puts "OK to Drive"; else puts "Ride the bus"; end compound condition 57

Logical Operators: OR, OR A OR B: A B A B A or B A B Output 0 0 0 0 1 1 1 0 1 1 1 1 OR table age = 21; permit = 1;! if age >= 20 or (age >= 20 and permit == 1) puts "OK to Drive"; else puts "Ride the bus"; end AND OR. ( ). 58

Looping iteration. iteration. Iteration. loop while, for 59

Looping: while statement loop setup variables test condition setup change test variables!! test condition false true action(s) change test variable! loop 60

Looping: while statement while loop while end_condition do this line #1 do this line #2 end i = 10 while i > 0 do end puts i i = i - 1 setup variables test condition action change variable 61

Array. arr1 = Array.new (Array ) arr2 = [1, 2, 3] (Array ) 62

Array Array arr1 = Array.new arr1.push(1) arr1.push("hello") arr1.push(123.45) arr1 << 320 arr1 << 'new world' arr1 => [1, "hello", 123.45, 320, "new world"] 63

Array arr2 = [1, "help", 123.45] : ( ) ( 0 ) arr1[0] arr2[2] arr1[0] = 4 arr2[2] = "hello" 64

Array nil arr2 = [1, "help", 123.45] arr2[5] = "UFO" arr2 => [1, "help", 123.45, nil, nil, "UFO"] : size. arr2.size 65

Array Methods : include? arr2.include? "UFO" => true arr2.include? "java" => false arr2.first arr2.last arr2.push("java") arr2 << "java" arr2.insert(2, "java") # 66

Array Methods arr2.pop # arr2.delete("java") arr2.delete_at(2) cities = ["seoul", "tokyo", "pittsburgh", "paris", "new york", "london", "hong kong"] cities.sort numbers = [2, 4, 234.2, -129.34, 23, 31.983, 0] numbers.sort numbers.max or numbers.min 67

Array Methods join join. cities = ["seoul", "tokyo", "pittsburgh", "paris", "new york", "london", "hong kong"] cities.join => "seoultokyopittsburghparisnew yorklondonhong kong" cities.join(", ") # => "seoul, tokyo, pittsburgh, paris, new york, london, hong kong" http://www.ruby-doc.org/core-2.0.0/array.html 68

Ranges in Ruby (1..10) : 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ('a'..'f') : 'a', 'b', 'c', 'd', 'e', 'f' (1..10).to_a => [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] ('a'..'f').to_a => ["a", "b", "c", "d", "e", "f"] 69

Array Iterators: each each: loop Array array.each do variable end code! array = [1, 2, 3, 4, 5] array.each do x end puts x 70

Number Iterators: times times: loop Integer integer.times do end code! i = 0 10.times do puts i i = i + 1 end 71

Range Range 1st ~ 31st January to December line number 23 to 32 a f ~, to, ~ ~ : range o x in Ruby (1..9) => 1, 2, 3, 4, 5, 6, 7, 8, 9 (1...9) => 1, 2, 3, 4, 5, 6, 7, 8 ('a'..'d') => 'a', 'b', 'c', 'd' 72

Range http://www.ruby-doc.org/core-2.0.0/range.html (1..5).each do x puts x end => 1 2 3 4 5 (1..5).to_a => [1, 2, 3, 4, 5] ('a'..'f').min => 'a' ('a'..'f').max => 'f' ('a'..'f').include?('c') => true 73

Ranges as Conditions for i in 0..5 puts "current i value is #{i}" end! (0..5).each do i puts "current i value is #{i}" end 74

IO Class. File. gets, puts, print IO IO read, write, readline. IO File. 75

File save open File. file = File.new("filename", "mode") mode. r : read-only r+ : read-write w : write-only w+ : read-write file.close 76

File. file = File.new("test.txt", "w"). file << "hello, ruby". file.close 77

File. file = File.new("test.txt", "r"). a = file.read. file.each do line puts line.upcase end. file.close 78

: Jobs Speech Lab 12 jobs_speech.txt.,. ",.. : I AM HONORED TO BE... : gsub(',',''), split() 79

Twitter

Twitter API REST API https://dev.twitter.com/docs/api Streaming API https://dev.twitter.com/docs/streaming-apis. consumer_key. https://dev.twitter.com/docs 81

Twitter https://dev.twitter.com/apps/new * { 82

Twitter Customer Key and Access Token { { 83

Twitter Crawling Gems twitter gem Twitter REST API gem install twitter http://rdoc.info/gems/twitter tweetstream gem Twitter Streaming API gem install tweetstream https://github.com/intridea/tweetstream 84

Twitter token. require "twitter" client = Twitter::REST::Client.new do config config.consumer_key = "YOUR_CONSUMER_KEY" config.consumer_secret = "YOUR_CONSUMER_SECRET" config.access_token = "YOUR_ACCESS_TOKEN" config.access_token_secret = "YOUR_ACCESS_SECRET" end 85

Twitter Lab 13 20 client.user_timeline("oisoo").each do t puts t.text puts "-----------------------------" end < >..... -----------------------------.! RT @HesterHabangLee: @oisoo!,,... http://t.co/wykjpzzrx6 -----------------------------... 86

twitter gem twitter gem twitter REST API. https://dev.twitter.com/docs/api/1.1 API. : http://rdoc.info/gems/twitter#usage_examples client.user("oisoo") client.user(48661131) client.user_timeline("oisoo") client.user_timeline("oisoo", :count => 100) client.user("oisoo").location client.user("oisoo").created_at client.user("oisoo").followers_count client.user("oisoo").friends_count client.user("oisoo").status.text client.user("oisoo").status.retweet_count... 87

Twitter Username : oisoo Name : Id : 48661131 Location : Hwacheon 38.166458,127.516781 User since : 2009-06-19 18:35:25 +0900 Bio : Korean Novelist 'Lee Oisoo'... Followers : 1518973 Friends : 21289 Listed Cnt : 44207 Tweet Cnt : 9902 Geocoded : false Language : en URL : http://twtkr.com/oisoo Time Zone : Seoul Verified! : false Tweet time : 2012-11-22 13:18:18 +0900 Tweet ID : 271467616776904705 Tweet text : [18 ] 11/21( )~25( )... Retweet Cnt: 203 88

Twitter. friends = client.friend_ids(name) name id twitter friends friends.attrs[:ids] id friends.attrs[:ids].each do uid f = client.user(uid) puts f.followers_count end 89

Twitter Lab 14 name = "Yunaaaa" user = Hash.new! friends = Twitter.friend_ids(name) friends.ids.each do fid f = Twitter.user(fid) # Only iterate if we can see their followers if (f.protected.to_s!= "true") user[f.screen_name.to_s] = f.followers_count end! end user.sort_by { k,v -v}.each { user, count puts "#{user}, #{count}" } 90

Rate Limiting! request. https://dev.twitter.com/docs/rate-limiting Rate limit window duration is currently 15 minutes long. https://dev.twitter.com/docs/rate-limiting/1.1/limits 91

Rate Limit Control Rate limit.. Lab 15 begin f = Twitter.user(uid) puts "processing '#{f.screen_name}'..." rescue Twitter::Error::TooManyRequests => rate_limit_error puts "you have reached the rate_limits." sleep rate_limit_error.rate_limit.reset_in retry end 92

Twitter Streaming APIs https://dev.twitter.com/docs/streaming-apis API REST API: request. Public Streaming API User Streaming API Site Streaming API 93

Twitter Streaming APIs Public Streaming API 1% 400 Global Trends User Streaming API Site Streaming API user stream 94

Tweetstream Gem Streaming API require 'tweetstream' TweetStream.configure do config config.consumer_key = "COMSUMER_KEY" config.consumer_secret = "CONSUMER_SECRET" config.oauth_token = "OAUTH_TOKEN" config.oauth_token_secret = "OAUTH_TOKEN_SECRET" config.auth_method = :oauth end 95

Twitter Lab 16 TweetStream::Client.new.track(keyword 1, keyword2, keyword3) TweetStream::Client.new.track( 'apple', 'samsung' ) do status puts "[#{status.user.screen_name}] #{status.text}" end 96

TweetStream::Client.new.follow(uid1, uid2, uid3) Lab 17 TweetStream::Client.new.follow(48661131, 163171634, 76295962, 128154362) do status puts "[#{status.user.screen_name}] #{status.text}" end 97

Facebook

Facebook Login Facebook User C Login Password Login Password Facebook User A Facebook DB Password Login Password Login Login Password Facebook User (Me) Facebook User B Facebook User D

OAuth OAuth 3rd party. 3 ID, Access Token. OAuth,,,,,,. 100

OAuth Facebook App Access Privilege Request OAuth token Facebook User C Access Privilege Facebook User A Facebook DB Request OAuth token Access Privilege OAuth token Facebook User (Me) OAuth token OAuth token Facebook User B Facebook App Request OAuth token Access Privilege Facebook User D

https://developer.facebook.com 102

103

104

Graph API https://developers.facebook.com/docs/graph-api/ 105

Graph API Explorer https://developers.facebook.com/tools/explorer 106

Graph API Explorer Permission 107

JSON JSON(JavaScript Object Notation).,. (http://ko.wikipedia.org/wiki/json) {"name2": 50, "name3": " 3", "name1": true} JSON { " ": " ", " ": 25, " ": " ", " ": " ", " ": [" ", " "], " ": {"#": 2, " ": " ", " ": " "}, } " ": " 7 " 108

Koala Facebook Koala Facebook Graph API, REST API, OAuth ruby library https://github.com/arsduo/koala Koala gem install koala ( gem install koala --pre) 109

Get Access Token access token. access token request app id login cookie Graph API Explorer access token. ( expire - 4 ) 110

Koala require 'koala' access_token = "CAACEdEo " @graph = Koala::Facebook::API.new(access_token) profile = @graph.get_object("me") @graph.get_object hash friends = @graph.get_connections("me", "friends") feeds = @graph.get_connections("me", "feeds") @graph.get_connections("me", "feed", :limit => 30) @graph.get_connections("me", "feed", { :since => @date, :limit => 1000}) 111

Connections Graph API connection. friends = @graph.get_connections("me", "friends") feeds = @graph.get_connections("me", "feeds") 112

Friends. 1: Leila Takayama, 21xx42 2: Nina Shih, 41xx38 3: Kipum Lee, 62xx49 4: Chris Harrison, 81xx40 5: Jeehyung Lee, 11xx512 113

Friends Lab 18 friends = @graph.get_connections("me", "friends")! no = 1 friends.each do f name = "" if f.has_key?("name") end name += f["name"] if f.has_key?("id") end name += ", " + f["id"] puts no.to_s + ": " + name no+=1 end 114

Mutual Friendship! @graph.get_connections("me", "mutualfriends/#{friend_id}") 115

Mutual Friends size, mutual friends. Desney Tan, 54 Gary Hsieh, 75 Robert Kraut, 35 Bilge Mutlu, 75 Austin Sung, 17 Irina Shklovski, 35 Luis von Ahn, 25 Laura Dabbish, 56 116

Mutual Friends size Lab 19 friends = @graph.get_connections("me", "friends")! friends.each do f if f.has_key?("id") mutual = @graph.get_connections("me", "mutualfriends/#{f['id']}") if f.has_key?("name") puts f["name"] + ", " + mutual.size.to_s end end end 117

Feed feed = @graph.get_connections("me", "feed") ( ) @graph.get_connections("me", "feed", :limit => 30) @graph.get_connections("me", "feed", { :since => @date, :limit => 1000}). 1: link, 3 Likes, Joonhwan Lee shared Duhee Lee's 2: photo, 25 Likes, Joonhwan Lee added 3 new photos 3: photo, 25 Likes, Joonhwan Lee added 5 new photos 4: photo, 0 Likes, Nexon!. 5: photo, 1 Likes, Nexon!. 6: photo, 0 Likes, Nexon!. 7: photo, 25 Likes, Joonhwan Lee added 6 new photos 8: photo, 25 Likes, Joonhwan Lee added 6 new photos 118

Feed Lab 20 no = 1 feed.each do f line = "" line += "#{no}: #{f['type']}" if f.has_key?("likes") line += ", #{f['likes']['data'].size} Likes" else line += ", 0 Likes" end if f.has_key?("story") line += ", #{f['story'].slice(0..30)}" end if f.has_key?("message") line += ", #{f['message'].slice(0..30)}" end puts line no += 1 end 119

Paging feed, 25 paging issue 25,. koala next_page access. 120

Paging Lab 21 first_page = @graph.get_connections("me", "feed") temp = first_page begin // process temp temp = temp.next_page end while(!temp.nil?) 121

Paging of Likes feed, comment like paging issue feed Lab 22 first_page_of_likes = @graph.get_connections(feed_id,'likes ') 122

Facebook Application access_token access_token 123

(Information Visualization)

17 Wurman, S.A. (1987) "Information Anxiety" New York: Doubleday 30, http://wikibon.org/blog/taming-big-data/ 50, http://www.sas.com/resources/whitepaper/wp_46345.pdf 125

,? 126

Sensemaking & Issue Data Information! Q: Data Information? Sensemaking: Issue Human attention is the scarce resource - Herbert Simon, 1969, information overload Solution? People think visually. 127

Sensemaking slide courtesy: John Stasko, GATech Fall 2012 CS 7450 12 Q: / (potassium)? potassium fiber?? 128

Example of Sensemaking slide courtesy: John Stasko, GATech data visualization Fiber Fall 2012 Potassium CS 7450 13 129

Think Visually..? 19 ( ),. 1854,., ( ).., (2006) 130

Think Visually..? 131

Think Visually..?. ( ).. ( ).., (2006). 132

Power of Visualization 133

(information visualization) X (External Cognition Aid),, Card, Mackinlay, Shneiderman (1998), "Readings in Information Visualization: Using Vision to Think" 134

R 37.466 37.465 37.464 IBK Communication Center R: lat 37.463 visualization e.g., 37.462 library(ggmap) library(mapproj) css <- get_map(' ', zoom=17, maptype='hybrid') ibk <- data.frame(lon=126.949335, lat=37.463842) ggmap(css, base_layer=ggplot(aes(x=lon, y=lat), data=ibk)) + geom_point(colour='red', size=5) + geom_text(label='ibk Communication Center', colour='red', size=3, hjust=-0.1) 37.461 126.948 126.950 126.952 126.954 lon * install.packages('ggmap'). 136

processing MIT aesthetics+computation group Ben Fry Casey Reas! ( ) - http://www.processing.org / / 137

processing 138

d3.js JavaScript,.. Stanford Visualization Group (Protovis toolkit) - Mike Bostock, Jeffrey Heer HTML DOM(Document Object Model) visualize web interactive visualization HTML5, CSS3, SVG 139

d3.js Examples http://projects.flowingdata.com/life-expectancy/ 140

d3.js Examples http://www.nytimes.com/interactive/2012/05/17/business/dealbook/ how-the-facebook-offering-compares.html 141

d3.js Examples http://exposedata.com/parallel/ 142

Tableau Desktop Information Visualization Group,... 143

Tableau Desktop 144

Many Eyes Information Visualization Tool IBM infovis group - F. Viégas et al. Information Visualization...?..? public sense-making 145 http://www-958.ibm.com/

Many Eyes Data upload Select Visualization Style! http://www-958.ibm.com/software/analytics/manyeyes/visualizations/ movie-genres-1888-2012-count 146

Many Eyes Public Discussion!! 147

149

75% (E. Tufte) (trend), 150

Google Flu Trend http://www.google.org/flutrends/us/#us 151

Github Scan, http://hcidex.snu.ac.kr:8090/ 152

(nominal data) (tag cloud) - (word tree) - 153

2014 154

2009 155

Social Network Analysis Reachability Distance & Number of Paths Degree of Node Centrality Morphology Changes 156

(Lazer et al. 2009) 157

(geographic information) / 158

- - + 159

Geography of Hate,, http://users.humboldt.edu/mstephens/hate/hate_map.html# 160

Questions?