Showing posts with label Workshops(Sinatra app). Show all posts
Showing posts with label Workshops(Sinatra app). Show all posts

Thursday, May 27, 2010

Step 8 - Question

a. What is MongoDB? How does it relate to MongoHQ

According to Mongodb.org (2010), MongoDB (from “humongous”) is a scalable, high-performance, open source, document-oriented database, and written in C++ programming language. As Wikipedia (2010) explain that MongoDB is designed for problems without heavy transactional requirements that are not easily solved by traditional RDBMSs, including problems that require databases to span many servers. MongoDB is not a relational database management system. The database manages collections of JSON-like documents that are stored in a binary format referred to as BSON.

MongoDB relates to MongoHQ:

MongoHQ provides a hosting platform for MongoDB and also uses MongoDB as the back-end for its service.

References

Mongodb (2010). The Best Features of Document Databases Key-Value Stores, and RDBMSes. Retrieved from www.Mongodb.org

Wikipedia (2010). MongoDB. Retrieved from http://en.wikipedia.org/wiki/MongoDB

b. What is MongoMapper

According to Github.com (2010), MongoMapper is a Ruby wrapper library which aims to make using MongoDB much easier and friendlier than the default Ruby driver provided by XGen. When is makes sense to do so, MongoMapper tries to stick closely with the familiar syntax of ActiveRecord.

Due to the way MongoDB stores data, MongoMapper consists two key concepts are: Document and the EmbeddedDocument

The Document is essentially a record with fields

An Embedded Document is exactly like a Document, except that it is injected into a Document and still retains all of ts information.

References

Github.com (2010). MongoMapper. Retrieved from http://wiki.github.com/jnunemaker/mongomapper/

c. What is the relation between MongoDB and Mysql

This table below is the quick comparision between MongoDB and MySQL (mongodb.org, 2010)

MongoDB

MySQL

Data Model

Document-Oriented (BSON)

Relational

Data Types

string, int, double, boolean, date, bytearray, object, array, others

Link

Large Objects (File)

Yes (GridFS)

Blobs?

Replication

Master-slave

Master-slace

Object (row) Storage

Collection based

Table-slave

Query Method

Dynamic; object-based query language

Dynamic; SQL

Secondary Indexes

Yes

Yes

Atomicity

Single document

Yes-advanced

Interface

Native drivers

Native drivers

Server-side batch data manipulation

Map/Reduce, server-side javascript

Yes (SQL)

Written in

C++

C

Concurrency Control

Update in Place

Reference

Mongodb.org (2010). MongoDB, CouchDB, MySQL Compare Grid. Retrieved from http://www.mongodb.org/display/DOCS/MongoDB,+CouchDB,+MySQL+Compare+Grid

Step 7 - Deploy to Heroku

"Heroku open" and then navigate to Heroku web address. That is http://young-summer-66.heroku.com/


After click on "View Comment", it will direct to the View page.
Click on Add New Comment, it will redirect to the home page.

Thursday, April 15, 2010

Step 8 - Answer the question

a. What is git? Why it is useful?
According to Git site (n.d), Git is a free and open source, distributed version control system to handle everything from small to very large projects with speed and efficiency.

Every Git clone is a full-fledge repository with complete history and full revision tracking capabilities, not dependent on network access or a central server. Especially. (Git, n.d)

As Awebb (2009) stated that, Git is very useful because it shows significant benefits in development process such as
- It develops software collaboratively better while minimizing the influence of code conflicts
- Easy to track
- Branching and merging are fast and easy to do (Git, n.d)
- It is easy to turn any directory tree into a Git repository

References
Awebb (2009). Presentation on managing Drupal projects with Git and GitHub. Retrieved from http://groups.drupal.org/node/27834
Git (n.d). Retrieved from http://git-scm.com/

b. Describe how Sinatra relates to Ruby on Rails
According to wikipedia (2010), Sinatra is a free and open source web application framework and Domain Specific Language (DSL) for quickly creating web-applications in Ruby.It is an alternative to other Ruby web application frameworks such as Ruby on Rails.

Unlike Ruby on Rails, Sinatra does not follow a Model-View-Control (MVC) to create websites. Instead, Sinatra focuses on “quickly creating web-application in Ruby with minimal effort”. (wikipedia, 2010).

As Ron (2007) stated that Rails requires a separates routes file to define how the web application response to request, while Sinatra will automatically add the route, and simply start responding to request just by declaring a new “get” or “post” action

Reference

Ron, E. (2007). Sinatra, a Ruby web framework, and Why it Matters. Retrieved from http://deadprogrammersociety.blogspot.com/2007/10/sinatra-ruby-web-framework-and-why-it.html
Wikipedia (2010). Sinatra (Software). Retrieved from http://en.wikipedia.org/wiki/Sinatra_%28software%29#cite_note-0

c. What is heroku? What is a Heroku “Dyno”? Describe how Heroku makes deployment and scaling of Ruby web applications easy.


According to Heroku site, “Heroku is a cloud application platform for Ruby – a new way of building and deploying web apps”. Deploy any ruby app instantly with a simple and familiar git push. It has many benefits from taking advanced features like HTTP caching, memcached, rack, middleware, and instant scaling built into every app. Never think about hosting or server (Heroku, n.d).

Also flowing to Heroku site, Heroku “Dyno” is roughlt equivalent to an individual Mongrel, Thin, or FastCGI backend in traditional Ruby deployment environments.

Heroku can deploy and scale easily on Ruby because some features below (Heroku, n.d):
- Multi-Tenant: Heroku is a multi-tenant platform and hosting environment
- Fully Managed: Heroku can control all the infrastructure and software layers
- Curation: actively curate each layer
- Everything you need: provide everything needed to run a modern, high-performance, scalable web app.

References

Heroku (n.d). Introduction to Heroku. Retrieved from http://docs.heroku.com/heroku
Heroku (n.d). Dynos. Retrieved from http://docs.heroku.com/dynos

d. Inspect the Hello World application “app.rb” file. Answer these questions:
a. What is the purpose of the “/param/:name method”
That method to get the parameter from “/” and shows the message “Hello World”
b. What happens when the user navigates to the /home page?
The page almost does not change because it will be redirected to itself
c. What is the purpose of the :set directive
It is used to specify a location of file. Static files are served from the ./public directory.

Step 7 - Introduce change

Step 7 Introduce change
Change the message "Hello world" to "Welcome to Heroku" by using Vi command
After that do these following commands again
- git init
- git add .
- git commit -m "Change the message"
- git push heroku master

Step 6 - Deployment Confirmation

Step 6: Deployment Confirm
- Heroku open and then navigate to Heroku web address. That is http://blooming-beach-29.heroku.com/

Wednesday, April 14, 2010

Step 5 - Deployment on Heroku

Step 4: Run Hello World
After installed Ruby, Sinatra and Git, We can run Hello World in localhost by the command "ruby app.rb", after that used a browser and navigate to http://localhost:4567/


Step 5: Deployment on Heroku
There are many steps to do at this step.
First: Create the Heroku account and then install heoku by "gem install heroku" and then publish the key on heroku by "heroku keys:add"
Second: Publish your application on Heroku with these following commands below:
1. Track your application with Git
- git init
- git add .
- git commit -m "New app"
2. Create you application on Heroku
- Heroku create
- Enter your username and password
3. Push your application on Heroku
- git push heroku master