Upload
others
View
4
Download
0
Embed Size (px)
Citation preview
Part 3: Online Social Networks
1
Today's plan
• Project 2 Questions?
2
Social networking services
• Social communities– Bebo, MySpace, Facebook, etc.
• Content sharing– YouTube, Flickr, MSN Soapbox, etc.
• Corporate– LinkedIn, Plaxo, etc.
• Portals– MSN, Yahoo 360, etc.
• Recommendation engines– Last.fm, StumbleUpon, Digg, Me.dium, etc.
• Bookmarking/Tagging– Del.icio.us , CiteUlike, Furl, etc.
• Discussion groups– Blogs, forums, chat, messaging, Live QnA, etc.
• Mobile social networks– Vipera, Nokia “MOSH”, etc.
• Virtual worlds– Second life
3
Social Network Sites: History
[Boyd et al., 2007]
SixDegrees.com the first recognizable OSN
Profiles and lists of friends
Combined existing features!
Failed - Nothing to do after accepting friend requests.
OSN wave after 2001
Friendster:
Technical and social difficulties with scale!
“Fakesters” diluted the community
MySpace:
Capitalized on Friendster’s problems
Bands and fans
Allowed personalization of profiles
Facebook:
Growth: Harvard-only => University-only => high schools & professionals => everyone
Introduced applications (provided APIs) 4
Social networking services
Source: Bebo, Social Media – ‘getting your message across’
Shift in online communities
OSNs are organized around people
“Egocentric” networks
WEB: world composed of groups
OSNs: world composed of networks
5
What do social networks enable?
Leveraging the “community”
in traditional applications
• Content/information sharing
• Search
• Information management
• Recommendations
• Advertisements
6
What is social media marketing anyway?
7
• Growing out of search marketing, and public relations before that
• Social media marketing is any way you can get attention for your message using people connected to the Internet
People + message + Internet = social media marketing
Content-based social media marketing
8
• Focuses on the content to be posted and passed around: blogs, videos, photos, news stories, podcasts
• Or bookmarks to the content
• Feeds viral marketing
Content sites
Bookmarking sites
Personality-based social media marketing
9
• Consumer companies create character profiles, but may not be the best marketing for IT companies
• IT consultants create professional profiles
Interest-based social media marketing
10
• Communities form around topics of interest, such as message boards and specialty search engines
IT marketers must get into these
conversations
Maybe social bookmarking sites fit into this
category, too
Fantasy-based social media marketing
11
• Virtual worlds, inhabited by avatars, allow fantasy lives that marketers wish to be part of—Apple, IBM, and other companies already play
• Kids have their worlds, too, but IT marketers can safely ignore them
Social media marketing can be planned
12
• Choose interesting topics for your stories—just like good old public relations
• Use good titles and descriptions—just like search marketing
• Make it easy to bookmark, unless you think that’s cheesy
<title>
Even virtual worlds get marketing plans
13
• IBM has over 4,000 employees who participate in over 30 Virtual Worlds
• IBM has more than 30 virtual islands in Second Life for developer support, client meetings, and more
Orientation
Area and Map
of part of IBM’s
presence in
Second Life
Plan for next two weeks
• Today:– Facebook platform overview
– PHP language
• Next Tuesday (Lecture)– PHP (continued), Ziran Chen leading
• Next Thursday (Lab session)– Project 2 presentations
– Facebook API, "hello world"
– Assignment 4: First Facebook App14
What is Facebook
• More than 1Billion users worldwide
• Gallery, Profile Management,
Collaboration, Notes, Ratings, Discussion Boards, Video all in one place
• You don’t need to pay anything to access it
• Social Network
15
Benefits of developing on FB Platform
• User management is done by FB
• Harvest social relationships
• Viral marketing
• Easy to develop, promote and monetize
• Bring an existing app and brand into FB
• Support for different languages
16
Seriously, what can I develop?
• Imagination is the limit
• Games
• Dumb entertaining apps
• Content sharing apps
• Business apps
• Social network aggregator and mash-ups
17
Lets Start!
18
How an app works
19
Facebook Platform
• Allows third parties to develop web or desktop applications that– leverage user data and Facebook’s social graph
• e.g. name, networks, photos, friends, marketplace, etc
– deeply integrate into the Facebook ecosystem• e.g. profile real estate, mini-feed, look and feel, etc
• Frontend Integration (UI)– Reusing Facebook’s controls and styles
• Backend Integration (Data)– Access to user data and settings as well as scalable
data store
20
Frontend Platform
• Markup (FBML) – extension of HTML
– Stands for Facebook Markup Language
– Improves usability by allowing third-party applications to leverage existing Facebook UI controls
• dashboard, invite users, comments, forms, type-ahead, etc
– Adheres to each user’s privacy settings automatically
• Scripting (FBJS)
– Stands for Facebook JavaScript
– Facilitates “Javascript” functionality in a safe context
– Includes native support for Ajax and Animation libraries
21
Backend Platform
Query (FQL)Stands for Facebook Query LanguageOffers SQL-like interface to get/set user data
Interface (API)Offers REST-like interface to get/set user dataClient (wrapper) libraries exist in 17+ programming languagesPHP, Ruby, C#, Java, Perl, Python, Lisp, etcEncapsulate common, mundane and generally difficult to “get right”
tasks such as authentication, encryption, transformation, etc
Data StoreFacebook offers applications free (though capped) data store
that is highly scalable (i.e. optimized distributed tables)
22
User makes request for an
application hosted page
Facebooksends request to application
Application renders and
returns response to Facebook
Facebookrenders (parses)
response from application
Facebookreturns
requested page to User
FB Platform Architecture
Your code processes
form request using
PHP and generates
FBML pages
23
PHP Syntax
• <?php/* code */
?>
Example (http://dutch.mathcs.emory.edu/~eugene/lab9/hello.php )<html>
<body>
<?phpecho "Hello World";
?>
</body></html>
24
Intro to PHP
• PHP stands for PHP: Hypertext Preprocessor
– is a widely-used, open source scripting language
– scripts are executed on the server
• PHP files can contain text, HTML, JavaScript code, and PHP code
– code is executed on the server, and the result is returned to the browser as plain HTML
– PHP files have a default file extension of ".php"
25
What Can PHP Do?
• generate dynamic page content
• create, open, read, write, and close files on the server
• collect form data
• send and receive cookies
• add, delete, modify data in your database
• restrict users to access some pages on your website
• encrypt data
26
27
PHP Variables
• A variable is created the moment you first assign a value to it:– $txt="Hello world!";
• PHP automatically converts the variable to the correct data type, depending on its value.
27
<?php
$x=5;
$y=6;
$z=$x+$y;
echo $z;
?>
Scope
• Four variable scopes:
– local
– global
– static
– parameter
28
<?php
$x=5; // global scope
function myTest()
{
echo $x; // local scope
}
myTest();
?>
Global Scope
• A variable that is defined outside of any function, has a global scope.
• Global variables can be accessed from any part of the script, EXCEPT from within a function.
• To access a global variable from within a function, use the globalkeyword:
29
<?php
$x=5; // global scope
$y=10; // global scope
function myTest()
{
global $x,$y;
$y=$x+$y;
}
myTest();
echo $y; // outputs 15
?>
PHP Strings
• Very similar to JavaScript
• http://www.w3schools.com/php/php_string.asp
30
Control Flow
• if statement - executes some code only if a specified condition is true
• if...else statement - executes some code if a condition is true and another code if the condition is false
• if...else if....else statement - selects one of several blocks of code to be executed
• switch statement - selects one of many blocks of code to be executed
• http://www.w3schools.com/php/php_if_else.asp
31
32 CS190: Web Science and Technology, 2010
PHP Arrays
• <?php$cars=array("Volvo","BMW","Toyota");echo "I like " . $cars[0] . ", " . $cars[1] . " and " . $cars[2] . ".";
?>
• http://www.w3schools.com/php/php_arrays.asp
32
33 CS190: Web Science and Technology, 2010
PHP Loops
<?php
$cars=array("Volvo","BMW","Toyota");
$arrlength=count($cars);
for($x=0;$x<$arrlength;$x++)
{
echo $cars[$x];
echo "<br>";
}
?> 33
Associative Arrays
• Associative arrays are arrays that use named keys that you assign to them.
– $age['Peter']="35";$age['Ben']="37";$age['Joe']="43";
34
Loop through Associative Arrays
$age=array("Peter"=>"35","Ben"=>"37","Joe"=>"43");
foreach($age as $x => $x_value){echo "Key=" . $x . ", Value=" . $x_value;echo "<br>";}
?>
35
PHP Functions
• http://www.w3schools.com/php/php_functions.asp
36
PHP Forms
• <html><body>
Welcome <?php echo $_POST["fname"]; ?>!<br>You are <?php echo $_POST["age"]; ?> years old.
</body></html>
• http://www.w3schools.com/php/php_forms.asp
37
Exercise
• Re-implement the JavaScript calculator app in PHP
38