Cloning Internet Applications with Ruby
eBook - ePub

Cloning Internet Applications with Ruby

Chang Sau Sheong

Share book
  1. 336 pages
  2. English
  3. ePUB (mobile friendly)
  4. Available on iOS & Android
eBook - ePub

Cloning Internet Applications with Ruby

Chang Sau Sheong

Book details
Book preview
Table of contents
Citations

About This Book

In Detail

Most users on the Internet have a few favorite Internet web applications that they use often and cannot do without. These popular applications often provide essential services that we need even while we don't fully understand its features or how they work. Ruby empowers you to develop your own clones of such applications without much ordeal. Learning how these sites work and describing how they can be implemented enables you to move to the next step of customizing them and enabling your own version of these services.

This book shows the reader how to clone some of the Internet's most popular applications in Ruby by first identifying their main features, and then showing example Ruby code to replicate this functionality.

While we understand that it  connects us to our friends and people we want to meet up with, what is the common feature of a social network that makes it a social network? And how do these features work? This book is the answer to all these questions. It will provide a step-by-step explanation on how the application is designed and coded, and then how it is deployed to the Heroku cloud platform. This book's main purpose is to break up popular Internet services such as TinyURL, Twitter, Flickr, and Facebook to understand what makes it tick. Then using Ruby, the book describes how a minimal set of features for these sites can be modeled, built, and deployed on the Internet.

Break up and rewrite popular social networking and other Internet applications using Ruby

Approach

This is a hands-on book with plenty of well-explained code. Each chapter has a standalone project in which a complete web application with specific features of a social networking site is emphasized. The final chapter of the book is a project that has a complete and fully developed social networking site. Each chapter begins with a brief description of the features of the Internet service and the market it is within. After extracting the main features of the service, the chapter goes into explaining how a clone of the service can be designed, followed by a short description of the technologies and platforms being used. The bulk of the chapter goes into describing how the clone is built, with step-by-step explanations and code examples. Finally, the chapter shows how the finished clone can be deployed on the Internet.

Who this book is for

This book is written for web application programmers with an intermediate knowledge of Ruby. You should also know how web applications work and you have used at least some of the cloned Internet services before. If you are a trying to find out exactly how can you make your very own customized applications such as TinyURL, Twitter, Flickr, or Facebook, this book is for you. Programmers who want to include features of these Internet services into their own web applications will also find this book interesting.

Frequently asked questions

How do I cancel my subscription?
Simply head over to the account section in settings and click on “Cancel Subscription” - it’s as simple as that. After you cancel, your membership will stay active for the remainder of the time you’ve paid for. Learn more here.
Can/how do I download books?
At the moment all of our mobile-responsive ePub books are available to download via the app. Most of our PDFs are also available to download and we're working on making the final remaining ones downloadable now. Learn more here.
What is the difference between the pricing plans?
Both plans give you full access to the library and all of Perlego’s features. The only differences are the price and subscription period: With the annual plan you’ll save around 30% compared to 12 months on the monthly plan.
What is Perlego?
We are an online textbook subscription service, where you can get access to an entire online library for less than the price of a single book per month. With over 1 million books across 1000+ topics, we’ve got you covered! Learn more here.
Do you support text-to-speech?
Look out for the read-aloud symbol on your next book to see if you can listen to it. The read-aloud tool reads text aloud for you, highlighting the text as it is being read. You can pause it, speed it up and slow it down. Learn more here.
Is Cloning Internet Applications with Ruby an online PDF/ePUB?
Yes, you can access Cloning Internet Applications with Ruby by Chang Sau Sheong in PDF and/or ePUB format, as well as other popular books in Computer Science & Programming in Ruby. We have over one million books available in our catalogue for you to explore.

Information

Year
2010
ISBN
9781849511063
Edition
1

Cloning Internet Applications with Ruby


Table of Contents

Cloning Internet Applications with Ruby
Credits
About the Author
Acknowledgement
About the Reviewers
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Errata
Piracy
Questions
1. Cloning Internet Applications
Who would find this book useful
Popular Internet applications
Technologies used
Sinatra
Installing
Routes
Splitting a route into multiple files
Redirection
Filters
Static pages
Views
Layouts
Helpers
Error handling
DataMapper
Installing
Connecting to the database
Creating models
Defining associations between models
One-to-one
One-to-many
Many-to-many
Creating the database tables
Finding records
Haml
Installing
Using Haml
Haml and Ruby
How this book works
Caveat
Summary
2. URL Shorteners – Cloning TinyURL
All about URL shorteners
Main features
Designing the clone
Creating a short URL for each long URL
Automatically redirecting from a short URL to a long URL
Providing a customized short URL
Filtering undesirable words out
Previewing the long URL
Providing statistics
Technologies and platforms used
Sinatra
Haml
DataMapper
Blueprint CSS
Mashups
Google Chart API
HostIP
Heroku
Building the clone
Data model
Url
Link
Visit
Application flow
Deploying the clone
Summary
3. Microblogs – Cloning Twitter
All about microblogs
Twitter
Why Twitter?
Simple
A means to have public conversation
Fan versus friend
Understanding user behavior
Easy to share through text messaging
Easy to access through multiple devices and applications
Main features
Designing the clone
Posting statuses
Following users
Sending publicly directed messages
Sending privately directed messages
Re-tweeting
Public timeline
API
Authentication, access control, and user management
Third party authentication and access control
Authentication and user management
Scalability and stability
Technologies and platforms used
JSON
Mashups
RPX
Google ClientLogin
Gravatar
TinyURL
Heroku
Building the clone
Modeling the data
User
Status
Building the application flow
Authenticating and managing users
Displaying and updating statuses
Sending and displaying direct messages
Showing and forming relationships
Implementing the API
Deploying the clone
Deploying locally
Deploying to the cloud
Summary
4. Photo Sharing – Cloning Flickr
All about photo-sharing services
Flickr
Main features
Designing the clone
Authentication, access control, and user management
Albums and photos
Uploading and storing photos
Filesystem
Database
Comments
Annotations
Editing photos
Friendly URLs
Sharing photos
Technologies and platforms used
Mashups
RPX
Gravatar
Pixlr
Amazon Web Services Simple Storage Service (S3)
RightAWS
Building the clone
Configuration
Modeling the data
User
Album
Photo
Annotation
Comment
Building the application flow
Authenticating and managing users
Landing page
Managing albums
Uploading photos
Displaying photos
Annotating photos
Commenting on photos
Editing photos
Sharing photos
Deploying the clone
Deploying on a server
Summary
5. Social Networking Services – Cloning Facebook 1
All about social networking services
Facebook
Main features
User
Community
Content sharing
Designing the clone
Authentication, access control, and user management
Status updates
User activity feeds and news feeds
Friends list and inviting users to join
Posting to the wall
Sending messages
Attending events
Forming groups
Commenting on and liking content
Sharing photos
Blogging with pages
Technologies and platforms used
Mashups
Facebook Connect
Building the clone
Configuring the clone
Modeling the data
User
Request
Message
Album
Photo
Status
Group
Event
Page
Wall
Activity
Comment
Like
Summary
6. Social Networking Services – Cloning Facebook 2
Building the application flow
Structure of the application and flow
Authenticating and managing users
Landing page, news feed, and statuses
Inviting friends and friends list
Registering a Facebook application
Creating a cross-domain communication channel file
Writing the code
User page and activity feeds
Posting to a wall
Sharing photos
Managing albums
Uploading photos
Displaying photos
Annotating photos
Viewing friends' photos
Sending messages
Creating events
Forming groups
Sharing content through pages
Commenting and liking
Deploying the clone
Deploying locally
Deploying to the cloud
Summary
Index

Cloning Internet Applications with Ruby

Copyright © 2010 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
First published: August 2010
Production Reference: 1110810
Published by Packt Publishing Ltd.
32 Lincoln Road
Olton
Birmingham, B27 6PA, UK.
ISBN 978-1-849511-06-3
www.packtpub.com
Cover Image by Asher Wishkerman ()

Credits

Author
Chang Sau Sheong
Reviewer
Warren Brian Noronha
Francisco
Acquisition Editor
Douglas Paterson
Development Editor
Chaitanya Apte
Technical Editors
Alfred John
Kartikey Pandey
Indexer
Hemangini Bari
Editorial Team Leader
Aanchal Kumar
Project Team Leader
Lata Basantani
Project Coordinator
Jovita Pinto
Proofreader
Aaron Nash
Graphics
Geetanjali Sawant
Production Coordinator
Arvindkumar Gupta
Cover Work
Arvindkumar Gupta

About the Author

Chang Sau Sheong has more than 15 years experience in software application development and has spent much of his career working on Web and Internet-based applications. He started up elipva, an e-business software company, and was the Vice President of Product Engineering as well as Chief Architect. Subsequently he was Director of Software Development for Welcome Real-time, a bank loyalty software company, Engineering Director for Yahoo! Southeast Asia and Chief Technology Officer for Garena Online, an online game publishing company. He is currently the Director of the Applied Cloud Computing Lab in HP Labs Singapore, the research arm of Hewlett Packard, leading a team of engineers to implement cloud computing solutions.
Sau Sheong frequently writes for technical magazines and journals, including Java Report, Java World, and Dr. Dobb’s Journal. He is a passionate programmer who contributes to open source projects in various technologies including Ruby and Java. He has a wide range of experience in web application development on the Internet and mobile devices. His first book was ‘Ruby on Rails Mashup Projects’ in 2008, also published by Packt Publishing.
Sau Sheong hails from tropical Malaysia but spent most of his adult and working life in sunny Singapore, where he shares his spare time between enthusiastically writing software and equally enthusiastically playing Nintendo Wii with his wife and son. He has a Bachelors degree in Computer Engineering, a Masters degree in Commercial Law, and is a certified international arbitrator.

Acknowledgement

Firstly, many thanks to Douglas Paterson who agreed to this second book project, the book...

Table of contents