Thursday, April 15, 2010

Ruby vs Java

Check out this SlideShare Presentation:

Wednesday, April 14, 2010

References

Lenz, R. (2007) "Learn Ruby On Rails: The Ultimate Beginner's Tutorial" http://www.sitepoint.com/article/learn-ruby-on-rails/2/

Sun Microsystems (2008) "MySQL Documentation" http://dev.mysql.com/doc/index.html

Kim, A.J. (2000). Community Building on the Web: Secret Strategies for Successful Online Communities. London: Addison Wesley

Eustace, K. (2009). ITC 594 - E-systems Infrastructure Development Study Guide. Wagga Wagga: Charles Sturt University.

Andreas Kuhrwahl, W. W., Thomas Jachmann. Chapter 4. RESTful web applications Retrieved 23/03/2010, 2010, from http://jsf-spring.sourceforge.net/reference/ch04.html

Wikipedia (2010). Ajax Programming Retrieved 01/04/2010, 2010, from http://en.wikipedia.org/wiki/Ajax_(programming)

Wikipedia (2010). Representational State Transfer Retrieved 23/03/2010, 2010, from http://en.wikipedia.org/wiki/Representational_State_Transfer

Wikipedia (2010). Peer-to-peer architecture retrieved 27th March 2010, from http://en.wikipedia.org/wiki/Peer-to-peer

Wikipedia (2010). Wireless Mesh Networks Retrieved 15th March 2010, from http://en.wikipedia.org/wiki/Wireless_mesh_network

Wikipedia (2010). Black box retrieved 15th March 2010, from http://en.wikipedia.org/wiki/Black_box

Wikipedia (2010). Black box retrieved 15th March 2010, from http://en.wikipedia.org/wiki/White_box_%28software_engineering

Wikipedia (2010). Price Comparison Service Retrieved 17 Mar 2010, 2010, from http://en.wikipedia.org/wiki/Price_comparison_service

Wikipedia (2010). Online Community Retrieved 17 Mar 2010, 2010, from http://en.wikipedia.org/wiki/Online_community

Wikipedia (2010). Key Size. Retrieved 22nd May 2010, from http://en.wikipedia.org/wiki/Key_size

Wikipedia (2010). Intrusion Detection System. Retrieved 22nd May 2010, from http://en.wikipedia.org/wiki/Intrusion_detection_system

Wikipedia (2010). Phishing. Retrieved 22nd May 2010, from http://en.wikipedia.org/wiki/Phishing

Wikipedia (2010). HTTP Cookie. Retrieved 22nd May 2010, from http://en.wikipedia.org/wiki/HTTP_cookie

Wikipedia (2010). Lock. Retrieved 22nd May 2010, from http://en.wikipedia.org/wiki/Lock_%28computer_science%29

Wikipedia (2010). Semaphore. Retrieved 23rd May 2010, from http://en.wikipedia.org/wiki/Semaphore_%28programming%29

Wikipedia (2010). Mutex. Retrieved 23rd May 2010, from http://en.wikipedia.org/wiki/Mutual_exclusion

Wikipedia (2010). Location-based service. Retrieved 23rd May 2010, from http://en.wikipedia.org/wiki/Location-based_service

Wikipedia (2010). Web service. Retrieved 27th May 2010, from http://en.wikipedia.org/wiki/Web_service

Spiritus-Temporis.com (2005). Web service. Retrieved 27th May 2010, from http://www.spiritus-temporis.com/web-service/advantages-of-web-services.html


Microsoft (2010). Waitable Timer Objects. Retrieved 23rd May 2010, from http://msdn.microsoft.com/en-us/library/ms687012%28VS.85%29.aspx

Economic Expert (n.d.). Semaphore (programming). Retrieved 23rd May 2010, from http://www.economicexpert.com/a/Semaphore:programming.htm

Reilly, David (n.d.). Secure Electronic Transactions: An Overview. Retrieved 22/05/2010, from http://www.davidreilly.com/topics/electronic_commerce/essays/secure_electronic_transactions.html

Ramakrishnan, Ganesh (n.d.) Secure Electronic Transaction (SET) Protocol. ISACA.org. Retrieved 22/05/2010, from http://www.isaca.org/Template.cfm?Section=Home&CONTENTID=21545&TEMPLATE=/ContentManagement/ContentDisplay.cfm

RSA (2010). RSA Laboratories. What is SET?. Retrieved 22/05/2010 from http://www.rsa.com/rsalabs/node.asp?id=2287

Nielson, Jakob (n.d.). How to build trust on your eCommerce website. Retrieved on 22nd March 2010 from http://www.technologymatters.com.au/articles/building_trust.htm

Griss, Martin (2001). Software Agents as Next Generation Software Components. Retrieved on 23rd March 2010 from http://martin.griss.com/pubs/cbse-agents.pdf

El-Masri, A. & Suleiman, B. (2005). The Second International Conference on Innovations in Information Technology (IIT’05): A Framework for Providing Mobile Web Services. Retrieved 27th May 2010 from the IT Innovations website http://www.it-innovations.ae/iit005/proceedings/articles/D_1_IIT05_Elmasri-1.pdf





Monday, April 12, 2010

Elevator Pitch 1

Remember the old quote "Rome was not built in a day", this holds very true in regards to the development of this ePortfolio site, and also the knowledge gained from this subject. These too were not built in a day but gained over many.

It is becoming increasingly clearer that the world-wide web is transforming the business world quite dramatically and fast. More content is moving online, businesses are increasingly using more web technologies to integrate key systems, so as to gain that ever so important strategic advantage over their competitors. This masters subject ITC594 aims to provide insight into the development and implementation of e-Systems; the frameworks and tools utilised in creating these systems; and the core architectures surrounding these systems.

Throughout the duration of this programme of work, I have built a good foundation of knowledge in regards to e-Systems infrastructures; background and overview of e-commerce and distributed applications; frameworks on which e-Systems are built on; understanding of the latest in technologies affecting businesses who want to provide e-Systems, the tools and technologies involved which help enable businesses to integrate and communicate, and lastly how these systems are developed using an intuitive web application design framework "Ruby On Rails".

To be ahead of the competition, you must be fast and agile when it comes to the development of e-Systems. This is why frameworks like "Ruby on Rails" which have been detailed and discussed as part of this programme of work are helping developers design and implement web applications faster and more efficiently through the use of common design patterns such as MVC; design paradigms like 'Convention over configuration' which essentially means that the developer only has to take care of the unconventional aspects of the application, as the rest is taken care of by the framework.

I look forward to even further enhancing my knowledge in this particular growth area with the other workshops and exercises, and to further build and grow my knowledge on my 'ePortfolio', very similar to how Rome was built overtime.



Sunday, April 4, 2010

Exercise 8 - XML Introduction

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.

Below is the XML for which to store the online catalogue of cars to the XML flat file database. There can be a number of improvements made on this XML file.

1. Create a schema to validate the data being entered into the XML, so that only correct values are being stored (i.e. only numerical years are being entered into the year element and are 4 characters in length)

2. Some elements can be made attributes of certain other elements, car element is always going to have a year, colour, make, model. These can be added to <car year='' colour='' make='' model=''>


Exercise 7 - Application server platforms in e-commerce

1. Why is the perception getting stronger that integration will become a critical factor in coming days?

The ever-evolving internet technologies which includes software, hardware, and even the internet has been changing the landscape of businesses for years, through simplification and automation of existing processes, which helps provide them a competitive advantage.

As businesses grow electronically in this day and age, and this also means through communication between other business (i.e. b2b). Integration will always be a major factor, as all business not only run separate systems on different platforms, in different languages, geographically dispersed (the list goes on). But to stay competitive they must integrate and this I believe is why integration is becoming increasingly more of a critical factor.

One of the greatest examples on the internet and which currently businesses use or are looking to use are webservices. This technology has the ability to share specific information with partners, clients, other businesses so that they can utilise this information provided with their internal systems they have and also vis-versa. Another older technology which also did something similar but was not exactly realtime was FTP


2. What is the relationship of AJAX to JQuery (jquery.com) and the lightweight Web 2.0 javascript framework called MooTools (mootools.net) within the enterprise software architecture?
Lets first start off by defining what AJAX is and what JQuery and MooTool.net are:

AJAX
AJAX (shorthand for Asynchronous Javascript and XML) is a group of interrelated web development techniques used on the client-side to create interactive web applications (Wikipedia, 2010). AJAX is not a technology itself, but a group of technologies such as HTML, CSS, XML, Javascript, all integrated to increase the interactivity and develop dynamic interfaces on web pages.


JQuery
JQuery is a web framework that utilises javascript to help simplify the development of web 2.0 applications. It provides a framework in which developers can use many feature rich functions and methods (also including AJAX) to help provide feature rich web applications.


MooTools.net
MooTools.net and JQuery are very similar in that they are a web 2.0 framework that provide developers feature rich functions and methods (including AJAX integration) to help make web 2.0 applications.

To sum things up JQuery and MooTools.net are just two frameworks you can use. They overlap in alot of functionality, but it just depends on what your preference is.


3. What are the similarities between object-orientated development using model-view-controller (MVC) in Ruby on Rails 2.0 and Action Script 2.0 (Flash animations)?

Basically both these frameworks implement the same design pattern of MVC, and are both are based on an object orientated language. The only main difference between these two are really how and what the frameworks are utilised for. Ruby On Rails 2.0 is used for Website and application development, while Action Script 2.0 is really dedicated to Flash animations and for a specific environment.


4. What does it mean to develop RESTful practices into our web applications?
Representational State Transfer (REST) for short is a style of software architecture for distributed hypermedia systems such as the world wide web. The term was introduced by Roy Fielding in 2000 in one of his doctoral dissertations (Wikipedia, 2010). A concise definition by Roy Fielding is as follows “[REST] is intended to evoke an image of how a well designed Web application behaves: a network of web pages (a virtual state-machine), where the user progresses through an application by selecting links (state transitions), resulting in the next page (representing the next state of the application) being transferred to the user and rendered for their use.” RESTful web applications conform to these principles, thus guaranteeing uniform access to resources regardless of their location, enabling easy integration and loose coupling between applications. Building on that, RESTful web applications make it easy to provide device-specific responses and search engine optimized URLs. (Kuhrwahl & Wopperer, n.d.)

References
Wikipedia. Ajax Programming Retrieved 01/04/2010, 2010, from http://en.wikipedia.org/wiki/Ajax_(programming)

Wikipedia. Representational State Transfer Retrieved 23/03/2010, 2010, from
http://en.wikipedia.org/wiki/Representational_State_Transfer


Andreas Kuhrwahl, W. W., Thomas Jachmann. Chapter 4. RESTful web applications Retrieved 23/03/2010, 2010, from http://jsf-spring.sourceforge.net/reference/ch04.html

Workshop 7

As a developer, what are the options available when deploying and maintaining the Ruby on Rails application online?

As a developer there are many ways in which to deploy a ruby on rails application as there are many ways to develop a ruby application. However, there are perferred ways in the ruby community which are suggested by our fellow ruby coders in how to deploy our applications to production.

Since deployment of ruby applications is really only the uploading of application files to a web service, it best to probably stick with the most preferred option which is suggested by the community of ruby diehards if you are using any of these particular web servers.

One option is the use of software called 'JumpBox' which basically packages an applications software, dependencies, and application data into a single virtual computer (Ubuntu Linux environment) which hosts a fully functioning Apache, Ruby, MySQL, and Ruby on Rails environment.
This is quite good if you are running virtual hardware (VMware, Parallels, VirtualBox, Amazon EC2 Cloud Computing) whereby you can just deploy the new instance with the application on it to that platform and use it straightaway without having to configure the application on the machine, as everything is packaged up in the one virtual computer.

JRuby is another deployment approach for a ruby application when you need to deploy to a java application server, this approach would be recommended if you have to deploy to a java application server running Glassfish.

It is actually stated on the Ruby website that Phusion, or mod_rails is the actually preferred option for deployments as is it very well-documented, and supports Apache and Nginx web servers.

Here is the extensive help guide http://www.modrails.com/documentation/Users%20guide%20Apache.html

Setup of the webserver is believed to be the hardest bit about getting a Ruby application to run correctly, and Phusion aka mod_rails seems to have a very good module that out of the box with very minimal setup can have a running version of a ruby application in no time at all.




Workshop 6

This workshop asks us to carry on with the development of the Online Taxi Booking System, and to post what changes and additions have been made to the system. Additionally it asks us to look and consider the aspects of social networking and how it can be applied to the Online Taxi Booking System.

As either a developer or as an IT manager, how can aspects of social networking be applied to th
e OTBS?

Social networking could be a great tool to market this application to a extremely large consumer base. Very similar to word of mouth, but via a social networking site.

First off a business site could be setup in facebook whereby people could add to their profile and foll
ow. Also addition widgets could be added so to order a taxi via the facebook website through web services. Great place to have customer reviews and feedback on the service, creating like a cult following and really promoting the business to other individuals who might be interested in using the service.
So now onto the Online Taxi Booking System and the enhancements and changes i have been playing around with...

Basically i've created using the scaffolding approach to create the taxi, and passengers objects. By using the scaffolding approach it has auto generated the model, controller, views (show, edit, new, delete) in a white label format.

The actions have been added to the controllers for show, new, destroy, and edit page redirection.

The addition i have been playing around with has been data validation for the current passenger create page. Ruby on Rails provides a validation library that can be used to validate certain data is contained in the model before it can be saved. Below is the code used and the validation logic added to the model class.
































Unfortunately i tried to play around with AJAX integration into the pages themselves but ran into quite a bit of trouble getting it to work. According to
http://www.devarticles.com/c/a/Ruby-on-Rails/Ruby-on-Rails-and-AJAX/2/, it seems as though AJAX integration is already built into the framework and makes it easier for developers to use, however with my limited knowledge of Rails/Ruby i ran into a number of issues that stopped me.

Anyways, I can see why now ruby and rails is very powerful as it gets rid of or reduces quite substantially the mundane tasks as these are automatically created for you via templates so that you can have an application up and running sooner. I wish i had more time to play around with this, as i can see as a developer this framework... gives us more time to be spent on more interesting problems instead of mundane tasks all applications need such as validation, database access etc.

Workshop 8

Evaluation and Report

1. List what you consider to be the three strengths of Ruby on Rails workshop series

  • Gives a good background introduction into Ruby and Rails and what this application framework can do
  • MVC architecture pattern and its relevance to developers on how quick and easy an application can be created
  • Discovered alot of interesting things RoR has to offer in terms of the framework, and how useful power and useful the language is through the workshops

2. List what you consider to be the three weaknesses of Ruby on Rails workshop series:
  • student collaboration was encouraged. But what i found was it was quite difficult as a distant student to work collaborative on workshops
  • learning a new programming language, the framework, and all the topic covered is quite a lot to learn
  • Not enough tutorials, had to find alot of information online, especially issues around setup of software. Should have a FAQs section whereby common things such as installation issues and configuration issues which students come across are kept so that the next students dont run into the same issues.
3. List what aspects of Ruby on Rails workshop series that you found to be most difficult.

The thing i found most challenging with the series was getting my head around the coding and framework aspects of ruby and rails. Creating views, models, and controllers was fine but when you have to make changes outside the generic objects, then I felt like i was really lost and on my own then, not really knowing what i was doing.

Also getting all the different applications to work together on my computer was quite a challenge. As i ran into a number of issues with running MySQL and Apache, which i had to do searches on the internet to find fixes for which took quite a bit of time sorting out.

4. List what improvements could be made to the Ruby on Rails workshop series:
  • Improve the method of delivery, whereby tutorials are held online so as to create a sense of community and collaboration among distance students
  • Instructions were a little difficult to understand sometimes in the workshops, so should try and be concise and clear in what is the expected outcomes.
  • Maybe instead of the OTBS, we can build our own type of application

5. Reflect on your experiences with the other Web framework used in this subject: Was it effective? How can it be improved? Should other Web frameworks be used as well or instead of Ruby on Rails?

There was use of PHP and mentioning of .NET etc but i didn't really find this as to be as effective. If the reason is to compare frameworks, i believe major frameworks should be chosen to compare and use such as .NET, Spring MVC, RoR.

6. Did the Developer’s or IT managers Team that you joined after workshop 4 have a preference towards using other tools to facilitate collaboration? Comment on the differences between these use of the sub-forum or Interact wiki tools from your experiences in this subject.

There wasn't really any communication, and it never really felt like there was a team aspect to the workshop. I've felt like communication never really happens in alot of the subjects i have undertaken
in distance education.

I feel that to get past this maybe online communication and/or tutorials online at a designated time might help to breakdown this communication barriers, and help students to interact more might be an option worth pursuing.


7. Further comments to add?


I found the course material really interesting and it opened up my eyes to e-Systems, and all the parts around it. I hoped to spend more time on RoR as i found this to be quite powerful

Workshop 5 - Part A

This particular Workshop gives us the choice to either carry on the role as a developer or swap to being an IT infrastructure manager. I have chosen to carry on the role as a developer as i am finding the use of Ruby on Rails to be quite interesting and useful to my current career.

Part A: View the action


1. Create the Rails application framework in the projects folder: C:\InstantRails\...\projects\>rails animals



















2. Running the application on localhost:3000 using the WeBrick ruby server (or Mongrel as alternative) and access via Web browser at http://localhost:3000/




















3. Create the controller to make the application do an action. This is under the controller-action/model-view structure.
















4. Test the controller by starting the WEBrick server and navaigatibng the browser to http://localhost:3000/mammal Note how the controller name is appended to the end of the URL and that no action resulted because there are no controller methods.









5. Create an ac
tion by editing and saving the mammal_controller.rb class in projects\animals\app\controllers using your text editor to add the method below:

6. Start the WEBrick server and browse at http://localhost:3000/mammals/breathe where you will get a “missing template” message since it is missing a view for the breathe method.










7. Create and save a view in that directory by using a text editor to create a view called breathe.rhtml
































(The output to the webpage for the Inhale and Exhale)

8. Try Ruby code and HTML in the action view by using the <%....%> wrapper around the inserted Ruby code. Here are some snippets to try from workshop 4:

Workshop 4 - Riding the Rails with Ruby

Now down to some actual ruby coding. This workshop provided an insight into the actual code of ruby with some great examples. It contrasted the various styles of java vs ruby in syntax, with some coding examples to figure out in ruby.

To Do
What are the syntax differences in the way that Ruby and Javascript use the If statement?


To code an If loop in javascript the following syntax is used:


if (object = condition)
{
'code to be executed
}

Whereas Ruby would use the following syntax:

if object = condition
'code to be executed
end
The differences are as follows:
  • javscript must contain the condition rule within brackets ()
  • javscript must have contain open and close {} squiggly line brackets for code to be executed
  • javascript uses else if
  • ruby doesn't need to have brackets around the condition
  • ruby doesn't need to contain {} squiggly line brackets for encapsulation of the code to be executed
  • ruby uses an elsif instead of else if
  • ruby to close of the if statement uses and 'end'

While Ruby and Python are quite similar, can you find some similarities between Ruby and Javascript?
  • Both are based on object-orientated principles
  • Both languages are dynamically typed
  • Both pass objects by reference
  • Both languages are garbage collected, as in they have memory management


Challenge Problems
Now here comes the coding parts of the workshops...

1. Create and test a Ruby program called dognames.rb

Here is the code of my program dognames.rb, as you can see i take in a name variable and assign each item into the array, once the array has been defined i sort the array and output the result.

#!/usr/bin/ruby

puts "What is your dog name?"
$dog1 = gets

puts "What is your dog name?"
$dog2 = gets
puts "What is your dog name?"
$dog3 = gets
array = [$dog1,$dog2,$dog3]
puts "your dog name"
puts array.sort


Test 1: ('Pearl', 'Coco', 'Butch')
Result 1:










Test 2: ('Pearl', 'Andy', 'Butch')
Result 2:











Test 3: ('Pearl', 'Andy', 'Fifi')
Result 3:











2. Write a Ruby program called fizzbuzz.rb that prints the numbers from 1 to 100. But for multiples of three print "Fizz" instead of the number and for the multiples of five print "Buzz". For numbers which are
multiples of both three and five print "FizzBuzz".

Here is the code below to be able to produce the expected result using Ruby, as we can see there is a loop involved going upto the number 100, then conditional if statements to replace numbers with the words if met.

#!/usr/bin/ruby

def fizzbuzz
1.upto(100) do |i|
if i % 5 == 0 and i % 3 == 0

puts "FizzBuzz"

elsif i % 5 == 0

puts "Buzz"

elsif i % 3 == 0

puts "Fizz"
else
puts i
end
end
end
fizzbuzz


Output is as follows from the command prompt when executed.
























3. Compare the Ruby and Python versions of the dog years calculator
  • Ruby doesn't need brackets () for declaring a method.
  • Python used an input() method for capturing data entered via the keyboard.
  • Ruby used a gets method for capturing data via the keyboard.
  • Ruby uses if statement without : at the end of statement but Python uses it.
  • Ruby uses a puts method or operator for screen output but Python uses print.
  • Python must have a main function in order for the program to run.

Workshop 3 - MySQL and Database Design

1. Setup the MySQL tools on your computer. Setup of MySQL tools was relatively easy, all that was needed was to download the tool from the MySQL site and run the default setup configuration install. Once install the application just needed to be launched.





















2. Setup InstantRails and setup a new application directory for each of your web application projects.

InstantRails was an easy setup as this has all the necessary components needed to run ruby on rails. However, there was an issue for myself and running WAMPServer on the same machine as this also installed all the necessary components such as MySQL, Apache which conflicted with InstantRails. So I made an executive decision and went with setting up ROR on WAMP, which proved to be a little difficult at first but runs fine now.

3. Once Rails is running at http://localhost:3000, you need to configure database access. To start the internal webserver of WEBrick is pretty straightforward. What you needed to run is a command prompt from Windows and browse to the top directory of your newly created web application in Ruby. Once there you need to run this command to instantiate WEBrick 'ruby script/server'. This kicks of the local webserver running under a different port of the machine and serves various requests from that port (3000) which you can see below from the screen shots.













Going to http://localhost:3000/ in Firefox Web browser, shows this form which means the WEBrick webserver is operational and ruby is working correctly.






















To configure the database(s) for the web project. Yes database(s) as this creates a set of similar database configurations (i.e. one being the development one, testing one, and production one). These are stored in the config/database.yml file. When setting up the project however an explicit command needs to be run when creating the project in Rails so that the database.yml is setup to connect to a real MySQL database locally and not the SQLlite db it normally creates in the database.yml. This command is exactly the same as the creating the ruby project however there is one extra option which defines to use MySQL instead of SQLLite. 'rails OTBS -d mysql' This will update the database.yml file accordingly, and all thats needed to be done to the file is update it if you have any special security logins for the databases. Below is a screen shot of the database.yml i created of the Online Taxi Booking System.























4. Generate the Passenger model by creating the MySQL database and 'passengers' table from the information above.

To generate the passenger model in rails you can use the command scaffolding to do this.

ruby script/generate scaffold Passenger name:string contact_number:string
suburb_origin:string street:string street_number:string building:string
suburb_destination:string passenger_number:string taxi_type:string
date:date time_required:integer

Once the model has been created you need to run the command 'rake db:create' from the command line which will create the database into MySQL.

After the database has been created you need to create the table based on the scaffold generation of passengers. To do this run this command 'rake db:migrate', which will create the passengers table and populate it with all the fields specified earlier in the scaffold c
ommand.








Workshop 2 - Model View Controller design approach

Seeing how the previous workshop went into great detail of the MVC history and design pattern and how it works within Rails. I won't go into great detail of what it is, but only how Rails implements it.

1. How is Rails structured to follow the MVC pattern?

Ruby on Rails is based on the MVC design paradigm (as i said before). It implements this design pattern by breaking up the newly created
application into its separate parts as seen here in the image below: Once you have all the necessary components installed, go to the command line and run rails [projectname] command. This will create a new application directory structure which adheres to the principals of MVC.












As we can see Rails has created a directory call app which contains all the sub-components of the application (i.e. Views, Models, and Controllers). This helps to keep the distinct parts of the application separate, and easier to manage if and when the application becomes big.

























2. Apply the MVC design approach to our Project: Online Taxi Booking System.

To apply the MVC design approach to our Online Taxi Booking System is quite straightforward in Rails. First you need to create the application which was executed in the previous step. Next is to create Views, Models, and Controllers for the application. The way to do this is quite simple by using the command of ruby script/generate scaffold [object] which basically generates each component (i.e. View, Model, and Controller) for the object and places each item in the designated app folder of the projects directory.

As you can see the taxi object was created with all the corresponding model, view, and controller created as well.