Friday, April 16, 2010

Exercise 6

1. Design The form

2. Write the script
2.1 Python
Step 1: Create a following html file with name html_python.html

Step 2:Create a python file name python.py (match with the name in html form)

Line 1: Specify the location of python.exe
Line 2: Import cgi
Line 4: Define main()
Line 5: Inform the browsers that the information is the text
Line 6: Declare a variable
Line 7-10: If condition to identify whether form "firstname" is null or not. If not null the information will be display, otherwise, the error will display.
Step 3:Press submit button and it is a result

3. Can you modify the script to process the form
Python
Step 1: Create a python file name python_mod.py with the following code

Step 2: Modify html file with this code :form method="post" action="/cgi-bin/python_mod.py"
Step 3: Input the information and press submit. This is the result

4. Improve the user experience by add a Javascript feature
Use JavaScript to confirm you want to submit it or not by code: input type="submit" value="Submit" onclick="return confirm('Are you sure you want to submit?')"

and To validate the field. For example, the field name can not be null.

By insert this code:
function validateName()
{
var str=form1.name.value;
if(str.length==0)
{
alert("The name cannot be empty");
return false;
}
return true;
}
and modify this code in the form1: input name="name" type="text" onBlur="validateName()"

Exercise 8

Create an XML document for an online catalogue of cars where each car has the child elements of make, model, year, colour, engine, number_of_doors, transmission_type and accessories. The engine has child elements called number_of_cylinders and fuel_system.

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 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

Elevator Pitch 1

Hello everybody,

We have created the blog to present our assignment about business to business system. After we have done all the exercises and workshops in assignment 1, we now have some concept about the e-commerce, distributed applications, client/server, database server, web application server, and ruby. That is very good for us to develop a professional website. Indeed, now we know how to develop a basic dynamic website by using php languages as well as the concept of 3-ties database model and other things are very useful.

Especially, after done the workshop about Ruby, we could understand what Ruby is, what Sinatra is, how does it works and how to deploy it on Heroku. We realized Ruby is a very good for rapid software application development

That's all. We hope that we will get more knowledge as well as aware of issues and procedures in assignment 2 in order to be able to develop a online business system.

Thank you

Elevator Pitch 1 Recording - Download