Monday, July 20, 2009

Evaluation Report

My final summary and elevator pitch is contained at Elevator Pitch 2.

The transcript of the report is as follows:

As our journey investigating the issues surrounding Business Application development draws to a close it is time to reflect on what we have seen and experienced.

The topic series and related exercises has delved briefly into areas such as e-commerce, distributed systems, database and application servers, system security, system design and mobile computing.

The workshop series required the development of an Online Taxi Booking System using the Ruby on Rails framework as a design platform. It introduced the MVC design pattern and DRY principle and pushed the convention over configuration mantra espoused by the Ruby community. At times major frustration and gnashing of teeth ensued, but it all came good in the end.

These topics and workshop series have all added a little to the total understanding required to develop a Business Application in today’s rapidly changing online environment.

Progress along this journey has been detailed in our blog which has proved both useful and enlightening.

Sunday, July 19, 2009

Workshop 7: End of the Line (Part 2)

Well it appears that I was wrong. I have managed to produce an application that integrates booking a cab with an authentication mechanism. However even though I have successfully melded these 2 attributes together the sum of the parts still does not make an appropriate production application.

In order for this application to be production ready a large number of enhancements would need to be developed. This would include the following:

  • save bookings to database
  • allow retrieval of previous bookings so user can review booking history
  • allow for payments
  • have comprehensive test suite
  • etc

Deployment

According to (Hartl, chapter 17) Mongrel is suitable to use as a webserver for Production use with a ROR application. Currently, there are only two things that everyone seems to agree on: Use Mongrel as the Rails application server, and deploy to some flavor of Unix (most commonly Linux). The rest is up to you. One option is to use a shared host. Because of the explosive growth of Rails, there are now many shared host options, and a web search for "Rails shared host" provides a cornucopia of possibilities. If you're deploying to your own server, they recommend running Apache in front of a single Mongrel process to start.

After locating the server, to deploy you need to do the following:
  1. Create the production database
  2. specify the production database details in the database.yml file
  3. migrate the application to production
    rake db:migrate RAILS_ENV=production

(Hartl, ch17) recommends the following to set up a production Rails application:

  • Linux/Apache/Mongrel for deployment
  • Caching mod_proxy_balance and shared nothing and for scaling
  • Subversion or darcs for version control
  • Capistrano for automated deployment and rollback

References
Hartl, M & Prochazka, A (2008). RailsSpace: Building a Social Networking Website with Ruby on Rails, Pearson Education

Workshop 6/7: Application Success

The following screenshots define the application that I developed today after reading RailsSpace and developing as I read:
The home page:

The about page:

The help page:

The login page:

The user hub once logged in:

Choosing to book a taxi:

The user selections from the booking screen. This is where more work would need to be done in a production environment or working application. A booking record would need to be written at this point and the user notified of thir booking number.

If the user selects Boioking History from the hub screen then all booking for the current user should be displayed.

If the user selects the logout option then they get sent here:

The following shows the user registration screen:

Here we see that we have form validation enabled:

This shows a succesfully registered user, has the same effect as a user logging in:

Workshop 6/7: Integrating RailsSpace with OTBS

I have got the RailsSpace application to the point where it should be really easy to integrate what i had done previously with the OTBS.With that in mind
  1. I created a vehicle controller
    ruby script/generate controller Vehicle cabtype bookcab
  2. modified the bookcab.html.erb to look like we did in Workshop 4
  3. Changed the link in the application.html.erb file to point to the vehicle bookcab form


    Unfortunately when you choose the link I get the following error message:

    I would love to continue investigating the issue, but unfortunately I have now developed a visual migraine, and looking at the computer screen is akin to looking at a kalaidescope.
  4. Pregnant pause for 2 hours .....

  5. Well I have my application working. Yee haa! The comment from Karen helped in the end. The error about the unknown route was purely because I had not restarted the server after creating the vehicle controller.
  6. I have managed to integrate the RailsSpace application with the OTBS application we have been developing. See my next post for application details.

Workshop 6/7: Developing RailsSpace

The following are the steps I have taken to develop the RailsSpace application:
  1. ruby script/generate controller Site index about help
  2. Here is where we learn how do undo things.
    ruby script/destroy controller
  3. Change the root mapping in the routes.rb file
    map.connect '', :controller => "site"
  4. Then to ensure that the default routing works we need to remove the public/index.html page.
  5. Modify the pages defined when we created the Site controller (index, about and help)
  6. Modify layouts.
  7. Add navigation and the site looks like:

  8. Add css and the site now looks like

  9. Well now we want to create a user so we need a database. I have create a mysql database called railsspace.
  10. Generate the user model
    ruby script/generate model User
  11. create the user in the database
    rake db:migrate
  12. learn here that we can roll back the database migration by using the command;
    rake db:migrate VERSION=0
  13. Add validation to the user model.
  14. Testing the validation gives the following output
  15. Add magic columns to the model
    ruby script/generate migration AddUserTimestamps
  16. Add user controller to enable us to register users
    ruby script/generate controller User index register
  17. At this point I got a hosting error within APTANA studio that says I couldnt have 2 application using the same host. I have gotten this error before and the only solution I could find was to close and restart APTANA. This worked.
  18. So I now have the following nicely rendered registration page:
  19. Add debugging info so that we can debug easily. Gee I wish I had seen this before. Very nice!!
  20. Continuing on we deal with what happens if a user registers successfully.The following screenshot shows this taking place:
  21. Add the link to the registration page in the application.html.erb file
  22. Add a helper function to reduce ugly code and then review documentation
    rake doc:app
    and then view doc/app/index.html
  23. Clean up the database
    rake db:migrate VERSION=0
    This will clean the database

    rake db:migrate
    This will rebuild the database

  24. I would love to investigate the testing functionality within ROR but due to time constraints I am going to bypass this section. (Here is hoping that this decision doesnt come back to bite me.)
  25. I am now back to where I started the RailsSpace review earlier today. ie I have now created the session
  26. Modify the user_controller so that registered users are automatically logged in.
  27. Change the application.html so that if we are developing we can see what the session variable contains as well. Add some javascript to display individual debug options seperately as required.
  28. Lets add a login template and link the main application screen accordingly.
  29. We can now add a logout page as well and modify the code so that the appropriate menu items appear dependent upon the logged in condition.
  30. Now lets create a protected page
    I added the code "the stupid way" as the book says inside the controller and verified that it worked.
  31. Add nice URL forwarding to protected pages, once user is authorised, by utilising the properties of the request.request.uri
  32. At this point we are all about looking at code refactoring

Workshop 6/7: Reading RailsSpace

Well I think that I made another mistake in developing my application. I didnt read the railsspace text sufficiently. I relied on the learningrails podcats/screencast series to develop the login module. As you will have noticed reading my blog this was in no way successful.

I am currently reading section 6 of RailSpace and it looks like it shows what i should have done to get the login process to work. It is actually debateable at this point as to what i would need to do to get the OTBS to work and utilise the login functionality correctly. It could be that if I implement the session logging capabilities in Section 6 of RailsSpace, that i may actually get a functioning application. But on the other hand, I may find that I am being led up yet another garden path.

In order to investigate whether RailsSpace would in fact revive my application I would be inclined to once again rebuild my OTBS application from the ground up. This goes entirely against the principles espoused by the rails community of DRY or dont repeat yourself (did I actually just break that rule by spelling out the DRY definition?). But considering I am between a rock and a hard place in terms of a functioning application, I feel that this is sctually the best method.

Concurrently with starting with a completely fresh application, I would implement a source code control systems to ensure that I was able to backtrack if and when the need arose.

Well I have just created a new rails application, to see if the logging mechanism within RailsSpace will actually work for me. Following on from the steps is section 6:

  1. Run rake db:sessions:create
  2. This was successful
  3. In config/environment.rb, uncomment the line:config.action_controller.session_store = :active_record_store
  4. Well here was my first problem. There was no such line in the file. So I copied the line from RailsSpace into the file.
  5. Run rake db:migrate
  6. Well this bit worked fine.
  7. Its at this point that I realise that we need to go back to the beginning of the book and actually build an application, because there is currently nothing in this one. So its back to the start of Chapter 2.

Workshop 6/7: My final application

Below are screenshots of my application as it stands:
  1. This shows the main page when you first start the application.
  2. If I click on Log Out the following screen appears:

    This would seem to imply that the user has been logged out. Howver if I simply click on Book Cab

  3. This is the screen that display when the user selects Book Cab. Irrespective of the user being logged in or not.


  4. This is the screen I get if I try to login from the login screen without a valid user being specified.
    This actually implies to me that the session management is working correctly, but I am not getting the expected results throughout the application.

Workshop 6/7: Login Headache

You may have read my rant on the developer forum about ROR giving me a headache. Well here is my expanation of my issue. I have followed the learningrails webcast series for developing web applications, and you may notice that the css that I have used in my OTBS comes straight from them. In webcast 10 and 11 they develop or introduce the sessions controller and include the AuthenticatedSystem. My problem arises from the fact that no matter what i seem to do the authentication controller seems to think I am logged in. Below is a screen shot of my application.html.erb file: Unless I have completely got it wrong, the "logged_in?" is not getting changed, and the session is staying live (so to speak), which really makes it impossible to test my application correctly. If the user is not logged in I dont want them to be able to book a cab. Unfortunately, I always seem to be logged in. So to reiterate what I said on the developer forum(on 8th July):
I am definitely starting to loath the whole Ruby on Rails experience. I have been endeavouring to get something as simple as sessions to work. I am either connected or not. Well that all sounds good. Except for the fact that I am connected when I shouldnt be. Following the learningrails screencasts, I add authentication to the application. I add the before_filter to all the relevant controllers. However when I logout, i stay logged in. AAAARRRRGGHHHH!!!!
The thing that has stood out for me with Ruby, that they said ad nauseum on the learningrails webcast series, developing with Ruby is MORE FUN. Well in my experience NOT is actually more the case. It is more infuriating than anything else I have ever had to program. When it works it is good. When it doesnt my only response is AAAARRRRGGHHHH!!!!

Workshop 7: End of the Line

To deploy an application to production, it must be production ready. Well in successful project world anyway. I have raised some issues in the forums about where we have gone with the OTBS and especially the failings that affected my development process.

My system is far from and never will reach a production ready stage. The reasons for this are many and include the following:

  • lack of source code control
  • lack of testing methodology
  • no interface/linkage for payment mechanisms
  • what is the process that happens after a taxi is booked?

One of the problems that we have endured as developers is lack of a project plan. Reviewing the Workshop material, these are issues that were to be addressed by the blue team in Workshop 5. I am not sure of their progress but they have failed from a project management perspective in that they have not managed user expectations on this project.

It is at moments such as now when upon reflection I feel that I maybe should have chosen the other route and joined the blue team. The questions that have been tormenting me over the last few weeks are exactly the questions posed by Ken for the Managers thread (ie the blue team), but due to time constraints there is no way that these can now be achieved.

But even going down that path we are still in the situation of not having a project manager to set the project on track and to bring it to a successful conclusion.

Maybe it is worth thinking about for future versions of this subject to involve the project management subjects in a combined assignment across subject boundaries?

Monday, July 6, 2009

Workshop 5/6: More Taxi booking system - followup

Must give thanks to Karen's comment. Even though what she said to do was what I had done, the fact that she commented actually triggered the correct outcome for me.

I have got the BookCab form integrated with my OTBS. In order to do this I had to do the following

  1. Move the bookcab method into the VehicleController
  2. Move the bookcab.html.erb file into the views\vehicle\ directory
  3. Change the form action to form_action ="cabtype" instead of "vehicle/cabtype"
  4. modify my application.html.erb file so that the 'Book Cab' link pointed to the correct controller and action.

On the face of it it looks like the variable scope is confined to the MVC that is of interest. In this case it was the cab booking variables in the bookcab view being transferred to the cabtype view.

My next step now is to introduce a login mechanism and enable passenger information to be collected.

Sunday, July 5, 2009

Workshop 5/6: More Taxi booking system

I have just been having a lot of fun.

I thought I would go back into the Taxi Booking system, to improve the look of the site and to look at adding login functionality. This would involve utilising what we had developed in workshop 4 with the changes in workshop 5.

I also wanted to change how I had dealt with the protect_from_forgery error that we all got in workshop 5. I simply hashed out the line, and so everything worked.

Well the idea started out as a good one. Unfortunately, I managed to break everything, so that nothing worked. I changed the routes file so that there were no recognised routes.

Scratching my head for half an hour ensued, until I realised that I had in actual fact hashed out all the route info in the routing file. So message actually made sense. With that sorted out and the taxi details showing again I decided to press on.

My Online Taxi Booking System now looks like

Unfortunately the information doesn't came across as you can see by the following:

I am beating my head against a brick wall at the moment. Possibly mind gone blank syndrome. I definitely need to get back to RailsSpace, for another installment, which might clear things up a bit. In the meantime, I close this blog post with a screenshot of my pages_controller and file structure

You may notice that the Vehicle Controller is empty. I was getting some routing issues and so just moved the code into the pages controller. I am definitely thinking this was the wrong way to go. But that is where it is at the moment.

Update

Well after posting this blog, I had a slight rethink and put the Cabtype method back into the vehicle controller. The views all seem to work, and the cabtype view does get displayed after submitting the booking form. Alas the variables are not being initialised, so the cabtype view is not displaying the selected information. Any ideas anyone?

Wednesday, July 1, 2009

CSS and Ruby

I have just come across this Ruby gem which could be very useful for you all.
http://lesscss.org/
Less is Leaner css. Less extends css by adding: variables, mixins, operations and nested rules.
If you use css then this could be useful.

Tuesday, June 30, 2009

Web 2 communities in action

Mythbuster Adam Savage fights $11,000 AT&T bill with Twitter army Have a look at the following commentry on Computerworld blog: http://blogs.computerworld.com/mythbuster_adam_savage_fights_11_000_at_t_bill_with_twitter_army?source=CTWNLE_nlt_dailyam_2009-06-29

Monday, June 29, 2009

Some very helpful Ruby tomes

I have just going through Workshop 6 and the Topic reading: (Hartl)

This made mention of David Hannermeir Hansens 15 minute blog development presentation. http://media.rubyonrails.org/video/rails_take2_with_sound.mov in the introduction. I watched this (i suspect that Craig had recommended this earlier) and wish that I had seen this earlier in the subject.

Having watched the demonstration, I read (Collingbourne)

I now feel that I have a much better grasp of ROR, because of these references. I have gotten back into the first few chapters of (Hartl) and really wish that this had been recommended prior to Workshop 1. It goes through a nice seemingly simple step by step process for setting up rails, and actually specifies requirements. There is a distinct chance that maybe hindsight is playing a part in my thinking, remembering back to the number of lost hours trying to get a working setup.

However, what really got me to put this missive together was a single line in (Hartl, s2.2.1)

In case you ever need to undo the work done by generate, you can use ruby script/destroy controller . That's certainly a lot easier than deleting a bunch of files by hand.
which clarified in my mind where I had been going wrong in my attempts at building the OTBS. i may well have seen this before, but I don't remember seeing this in the same section as talking about generating the controller. But then again, this may well be hindsight in action.


References
Collingbourne, H (2008)"The Little Book of Ruby"
Hartl, M & Prochazka, A, (2008). RailsSpace: Building a Social Networking Website with Ruby on Rails, Pearson Education

Friday, June 26, 2009

Tuesday, June 23, 2009

Workshop 8: Ruby on Rails Workshops Report and Evaluation

  1. List what you consider to be the three strengths of Ruby on Rails workshop series
    1. Ruby is probably a language that once you "get it" it all falls in to place. The MVC and convention over configuration means that you dont have to go looking in obscure places to find the answers to error situations. It means that application maintenance should be made simpler.
    2. Exposure to the Ruby way of doing things.
    3. ?? Due to the frustration experienced with development and the lack of overall workshop focus I find it very difficult to find anything that would qualify as a strength. Although it is feasible that I could use my experiences in the workshops as a reason not to use Rails as an application development environment

  2. List what you consider to be the three weaknesses of Ruby on Rails workshop series:
    1. There was a distinct lack of focus throughout the workshop series. It seemed to be heading in a certain direction for the first 4 workshops, but then at workshop 5 a complete change in tack occurred. The first 4 workshops should be removed. If you start with workshop 5 and go through the RailsSpace book and develop the OTBS application in conjunction.
    2. The development of the OTBS did not seem to have any real relevance to the rest of the subject matter. The Workshops should be redefined so that the development of the application corresponds to the learning outcomes being investigated in the topics.
    3. Their was little scope for collaboration with other students within the workshops. As I mentioned in an earlier blog their is scope to include a project manager from a project management subject to cross pollinate the learning outcomes for students, and to improve the collaboration aspect.

  3. List what aspects of Ruby on Rails workshop series that you found to be most difficult.
  4. Getting Ruby installed and operational. I found it hard to find any useful installation information initially. I am sure that there is lots of documentation in existence, but asking the right question proved to be difficult. Also the fact that i was trying to install in a windows environment proved frustrating. I resorted to creating a Windows XP VM to host my APTANA development environment. Once the software infrastructure was in place everything was OK.

  5. List what improvements could be made to the Ruby on Rails workshop series:
  6. The workshop series should be redesigned so that:

    • A VM should be developed so that all students start off on the same foot.
    • The references to other frameworks could be removed.
    • All the students have a programming background(?), and as such do we really need to compare looping structures or suyntax of different languages?
    • It has a defined goal with some KPIs that need to be met as students progress.
    • The workshop content should involve aspects of the topic being examined to more closely tie in with the subject objectives.
    • their should be more of a project managed feel about the workshops so that we dont miss our targets

    Free response and reflective questions:
  7. 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?
  8. My immediate response to this question is what other frameworks? Did we actually use another framework. And if we did when? If this is referring to the few questions that were used in php, then I think it is simply irrelevant.

    The experince could definitely be improved if a virtual machine was provided that had the framework already set up. I dont think that anything of real value is learnt by all students being in the dark and having to install and test various servers and hope that everything works. Everyones machine is different, and so they all have to spend a large block of time getting up and running. A VM would solve this problem by everyone starting off on the front foot.

  9. 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.
  10. There was little if any collaboration. This is primarily due to the time constraints imposed by the topic Q&A and the workshops. There is simply not enough time to get through the volume of work expected, and collaborate as well.

    The forums were the best spot for eliciting information from other students if required.

  11. Further comments to add?
  12. It may not necessarily seem that I enjoyed the Workshop series. This is not actually the case. I did find that developing in Ruby was enjoyable to a point. However this was generally overbalanced by the frustration felt when things didnt work out correctly. Learning a new language and development paradigm is an experience to be savoured. But it is very easy to be turned off and things to sour when brick walls seemingly appear. The DRY principle is espoused by the Rails community, but that is probably what I failed at the most. I think that my final tally for creating the Online Taxi Booking System was probably somewhere upward of 20. That is I started from scratch in excess of 20 times.

Workshop 7: End of the Line: production site migration and maintenance

To Do: Developers conclude their work with the OTBS and look at the options for deployment of the site. Examine the various platforms/software tools used for deployment such as UNIX environment suggested in the Discussion Notes, Mongrel or Mongrel cluster, Nginx, Subversion or Capistrano (during development stage), JRuby in the Java environment. Which way? The choice is up to you as this workshop present just one option and you may like to use another, such as deploying the OTBS in a .NET or J2EE environment Can you get the OTBS Running in production mode as a minimal production server? Share your success by posting progress comments and links etc to the Developers sub-forum site that has been set up for the Red team.

Workshop 6: Enjoying the Ride: Web framework alternatives, scalability and flexibility

Upon the completion of this workshop, developers or managers should be able to:
  • Discuss and analyse the latest Web framework technologies based upon experiences so far with Ruby on Rails
  • Identify and evaluate challenges and opportunities concerning the use of the latest Web 2.0 technologies and to ‘benchmark’ (compare) other alternatives
  • Discuss and evaluate current Ruby on Rails framework and the alternative emerging technologies.
  • Evaluate and devise scalability, flexibility, capacity planning and performance testing strategies for conducting e-commerce.
  • Deploy Web 2.0 or later technology in their business environments such as the ideas and methods of the ‘RailsSpace’ approach to the OTBS
  • Think critically and analytically when exposed to new technologies.
  • Share your findings with your peers and examine what the other team is doing.
Developers may continue to build upon work with the OTBS using the topic reading to help with user registration and advanced login features from Hartl et al (2008).
  • generate a controller and an action by adding a method(s) to a controller
  • create a view template for each action and to link to actions from views
  • use AJAX to improve the user experience
Share your success by posting progress comments and links etc to the Developers sub-forum site that has been set up for the Red team.

Workshop 5: Part C: Screen layouts and forms processing with text fields, check boxes, radio buttons and multiple list controls

  1. Create a new application called cabs in the same projects directory to demonstrate the use of an active view. > rails cabs > cd cabs
  2. Complete
  3. Create a controller called Vehicle in cabs\app\controllers cabs> ruby script/generate controller Vehicle
  4. Complete
  5. Add an action to vehicle_controller.rb as the method called cabtype class VehicleController< ApplicationController def cabtype end end
  6. Complete
  7. Add a view template - cabs\app\views\vehicle\cabtype.rhtml We will edit this view in later steps but you may like to add your own test HTML code to the view at this stage.
  8. Complete
  9. Save the view and restart the Web server and navigate to http://localhost:3000/cabs/cabtype
  10. Navigated to http://127.0.0.1:3004/vehicle/cabtype
  11. Create a file in the public directory - \cabs\public called input.html
  12. Done this
  13. Edit the vehicle_controller.rb here is a start. The data in each form element in the Rails application can be accessed via its name and a hash called params class VehicleController< ApplicationController def cabtype @data1 = params[:text1] @data2 = params[:check1] @data3 = params[:radios1] @data4 = params[:building1] end end
  14. Done this
  15. Edit the view template cabtype.rhtml
  16. Done this
  17. Start the Web server and go to the opening page of this application at http://localhost:3000/input.html
  18. Did this and had a horrible looking screen. If you just do a cut and paste from a word file the quotes play up just a little bit. This leads to a horrible looking screen rendering. Having done this Craigs mention of this problem comes to light. Should have been a touch more careful, and validated what i copied a bit more. But lesson hopefully learnt. Took but a matter of moments to rectify and have the screen render nicely.
  19. Submit the forms data. What do you find?
  20. I get a rather horrible screen that screams ActionController::InvalidAuthenticityToken at me. This is obviously security related. Looked in Application Controller and noticed the second line "protect_from_forgery".
    Hashed this out.
    Kept getting response, No route matches "/cabtype" with {:method=>:post}
    This led me to change the Submit action on the input form to "vehicle/cabtype"
    Unfortunately this still did not work. After a few minutes of scratching my head I did the brute force approach and recreated the project. Here was the whole COC conversation that happened on the forums all over again. But brute force worked.

Workshop 5:Part B: The active view: passing data from an action too a view

  1. Create a new application called scenery in the same projects directory to demonstrate the use of an active view. > rails scenery > cd scenery
  2. Complete
  3. Create a controller called Demo in scenery\app\controllers scenery> ruby script/generate controller Demo
  4. Complete

  5. Add an action to demo_controller.rb as the method called rubycobe class DemoController< ApplicationController def rubycode end end
  6. Complete
  7. Add a view template - scenery\app\views\demo\rubycode.rhtml We will edit this view in later steps but you may like to add your own test HTML code to the view at this stage.
  8. Complete
  9. Save and restart the Web server and navigate to http://localhost:3000/scenery/rubycode
  10. If I was to follow the script blindly then one of two things will happen here.
    • I have made a mistake or
    • the workshop script is wrong

    If I navigate to the url
    ../scenery/rubycode
    I get the error Routing Error.
    However if I do the logical thing and navigate to
    ../demo/rubycode
    then I get my expected page returned.
  11. Use the Time.now example to pass data from an action to a view.

  12. Modify and save the rubycode action with a value for the time instance variable in the DemoController class in app\controllers\demo_controller.rb class DemoController< ApplicationController def rubycode @time_now = Time.now end end
  13. Done that
  14. Then modify and save the corresponding view template in \app\views\demo\rubycode.rhtml by adding a call by reference to the action’s instance variable: <_br> The time is <_%= @time.now %_> <_br>
  15. Obviously this piece of code is wrong. We should be using the variable defined in the controller @time_now
  16. Restart the Web server and navigate the browser to http://localhost:3000/demo/rubycode Data has been passed from the action to the view as it is done with SQL requests. The instance variables of a Ruby class are available to view templates by referencing the action’s instance variables by name in the view .rhtml template.
  17. The output and the code files are shown below

Workshop 5: Part A: Viewing the action

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

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

  4. Create the controller to make the application do an action. This is under the controller-action/model-view structure. Stop the WEBrick server each time you edit Ruby classes and then re-start or refresh the views you are testing. Use the Ruby command below: >ruby script/generate controller Mammal The mammal_controller.rb contains just a bare class description: class MammalController< ApplicationController end and the ApplicationController class inherits from ActionController::Base class in the ActionController module under Rails.

  5. Complete
  6. 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.

  7. I get the following:
    Routing Error No route matches "/mammals" with {:method=>:get}
    I think this is simply because I coulnt follow instructions and typed /mammals rather than /mammal.
  8. Create an action by editing and saving the mammal_controller.rb class in projects\animals\app\controllers using your text editor to add the method below: class MammalController< ApplicationController def breathe end end

  9. Complete
  10. 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. Rails is trying to connect the breathe method action of the mammal controller to a view, by using the action’s name – breathe. This view template is created as breathe.rhtml and stored in the \projects\animals\views\mammal directory.

  11. Create and save a view in that directory by using a text editor to create a view called breathe.rhtml <_html> <_head> <_title>Breathe Easy <_body>Inhale and Exhale Restart the WEBrick serve r and browse again at http://localhost:3000/mammals/breathe

  12. Browsed to ../mammal/ and got the following message
    Unknown action No action responded to index. Actions: breathe
    So added the action /mammal/breathe and got the expected result.
  13. 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:
    5 + 6 =<%= 5 + 6 %>

    =<% 4.times do %> Inhale Exhale
    <%end%>
    Time is <%=Time.now %>
    The output of this little exercise is

    NOTE: in practise you normally perform calculations in the action (method) and pass the results to the view.

Workshop 5: Admiring the scenery

Topic objectives
  • To reflect on what has been done so far with Ruby on Rails
  • To reflect on my role and decide to continue as EITHER a Developer OR as an IT infrastructure manager
I will be continuing the workshops in the role of a developer. So I will be on the RED team.

Exercise 25: M-commerce and the e-wallet: Innovation and mobile devices

Explore some of the problems associated with mobile technology or their suppliers.
  1. What is meant by a location based service?
  2. According to (Wikipedia) a location-based service (LBS) is an information and entertainment service, accessible with mobile devices through the mobile network and utilizing the ability to make use of the geographical position of the mobile device.

    LBS services include services to identify a location of a person or object, such as discovering the nearest banking cash machine or the whereabouts of a friend or employee. LBS services include parcel tracking and vehicle tracking services. LBS can include mobile commerce when taking the form of coupons or advertising directed at customers based on their current location.

  3. Visit an airline Web site and search for information on WAP or SMS access to booking airline services. Do the same for WAP or SMS services in banking. How do both industries compare?
  4. Olympic Airways provides a wap service at http://www.olympic-airways.gr/wap to allow users to
    • keep an eye on all Olympic Airlines Flights
    • Get information on Departures from and Arrivals at the Athens International Airport as if you were before the Flight Information Display at the airport
    • Check your actual miles if you are a member of our Frequent Flyer program

    Southwest Airlines utilises WAP http://mobile.southwest.com/ which allows passengers to
    • book flights
    • Check Flight status
    • Check In
    • Cancel Flights
    • view schedules
    • etc

    Apparently at some time prior to 23 October 2004 Westpac had WAP banking services enabled. However according to an article on ITWire on 13 October 2004 http://www.itwire.com/content/view/182/2/ from 23 October 2004, "the Westpac banking site will no longer support wireless application protocol (WAP) internet banking through your mobile phone"

    Until recently according to (AustralianIT) mobile banking services have not been provided by Australian banks. They had provided services in the earlier parts of the decade but closed them down in mid to late 2004 due to poor patronage. But things seem to have turned the corner with the banks now re entering the mobile market.
  5. Lucent Technologies designs and delivers the systems, services and software that drive next-generation communications networks at: http://www.lucent.com
  6. According to http://www.alcatel-lucent.com/wps/portal/aboutus

    Alcatel-Lucent is the trusted partner of service providers, enterprises and governments worldwide, providing solutions to deliver voice, data and video communication services to end-users.

    A leader in fixed, mobile and converged broadband networking, IP technologies, applications and services, Alcatel-Lucent leverages the unrivalled technical and scientific expertise of Bell Labs, one of the largest innovation powerhouses in the communications industry

  7. Visit the W3C website and find the status of the VoiceXML project. When do you think it will affect business on the Web and what will its impact be?
  8. The current standard for VoiceXML is v2.1 which was released on 19 June 2007. The current working draft as at 2 June 2009 is Voice Extensible Markup Language (VoiceXML) 3.0
  9. Investigate CDMA, GSM or other network technologies for mobile phones and circuit-switched and packet-switched data capabilities.
  10. According to (Wikipedia) Code division multiple access (CDMA) is a channel access method utilized by various radio communication technologies.

    One of the basic concepts in data communication is the idea of allowing several transmitters to send information simultaneously over a single communication channel. This allows several users to share a bandwidth of frequencies. This concept is called multiplexing. CDMA employs spread-spectrum technology and a special coding scheme (where each transmitter is assigned a code) to allow multiple users to be multiplexed over the same physical channel. By contrast, time division multiple access (TDMA) divides access by time, while frequency-division multiple access (FDMA) divides it by frequency. CDMA is a form of "spread-spectrum" signaling, since the modulated coded signal has a much higher data bandwidth than the data being communicated

    (Wikipedia) suggests that GSM (Global System for Mobile communications: originally from Groupe Spécial Mobile) is the most popular standard for mobile phones in the world. GSM differs from its predecessors in that both signaling and speech channels are digital, and thus is considered a second generation (2G) mobile phone system. This has also meant that data communication was easy to build into the system. Newer versions of the standard were backward-compatible with the original GSM phones. For example, Release '97 of the standard added packet data capabilities, by means of General Packet Radio Service (GPRS). Release '99 introduced higher speed data transmission using Enhanced Data Rates for GSM Evolution (EDGE).

  11. According to Nokia:
    “The Nokia One Mobile Connectivity Service provides easy and secure access to email, calendar, directory and more from a mobile phone, PDA, PC or fixed-line phone - take your corporate applications mobile.”
    Why is a company like Nokia – http://www.nokia.com – described as having end-to-end expertise?
  12. According to (Nokia) it takes innovation to win new business. Yet by its nature, innovation is hard work. The promise of a novel service is fulfilled through a complete understanding of all its components.

    Nokia Siemens Networks, in collaboration with our parent companies Nokia and Siemens, offer end-to-end expertise and capabilities to create seamless, personalized end-user experiences delivered by streamlined business and network solutions.

    We offer five key steps to create competitiveness through end-to-end innovation:

    • conduct the research
    • identify the opportunitiesfor innovation
    • specify the solutions
    • implement your plans
    • evolve your services portfolio


References
The Australian IT. Suncorp dials into mobile banking. Retrieved 19 July 2009, from http://www.australianit.news.com.au/story/0,24897,25194759-24169,00.html
Nokia Siemens Networks. End to end expertise. Retrieved 27 July 2009, from http://www.nokiasiemensnetworks.com/cn/Insight/end-to-end/end-to-end-expertise.htm?languagecode=en%20topic%20End-to-end%20expertise%20-%20our%20offering
Wikipedia. Location-based service. Retrieved 14 July 2009, from http://en.wikipedia.org/wiki/Location-based_service
Wikipedia. Code division multiple access. Retrieved 19 July 2009, from http://en.wikipedia.org/wiki/Code_division_multiple_access
Wikipedia. GSM. Retrieved 19 July 2009, from http://en.wikipedia.org/wiki/GSM

Exercise 24: Virtual business worlds and cyberagents

Search the Web for a site that uses a cyber character or cyber agent to host a business site. (If you create a successful cyber agent, you may be able to get large companies to use it to sell their products online.)
  1. Describe what software agents are.
  2. According to (Wikipedia) , a software agent is a piece of software that acts for a user or other program. Such "action on behalf of" implies the authority to decide which (and if) action is appropriate. The idea is that agents are not strictly invoked for a task, but activate themselves.
  3. Differentiate the various types of software agents.
  4. (Wikipedia) identifies the following types of software agents:
    • Autonomous agents
    • Autonomous agents are software agents that claim to be autonomous, being self-contained and capable of making independent decisions, and taking actions to satisfy internal goals based upon their perceived environment.

    • Distributed agents
    • Since agents are well suited to include their required resources in their description, they can be designed to be very loosely coupled and it becomes easy to have them executed as independent threads and on distributed processors. Thus they become distributed agents and the considerations of distributed computing apply. Agent code is particularly easy to implement in a distributed fashion and should scale well

    • Multi-agent systems
    • When several agents (inter)act they may form a multi-agent system a.k.a. multiple-agent system. Characteristically such agents will not have all data or all methods available to achieve an objective (this can be referred to as "limited viewpoint") and thus will have to collaborate with other agents. Also, there may be little or no global control and thus such systems are sometimes referred to as swarm systems. As with distributed agents, data is decentralized and execution is asynchronous

    • Mobile agents
    • Agent code that moves itself, including its execution state, on to another machine, to continue execution there. This is also referred to as mobile code. Agents can be used to gather system information, taking back-up of files by copying them in client-server paradigm, monitoring network throughput or to check resources availability and moderating the resource utilization of system by checking the services running on system

    • Fuzzy agents
    • In computer science a fuzzy agent is a software agent that implements fuzzy logic. This software entity interacts with its environment through an adaptive rule-base and can therefore be considered as a type of intelligent agent.
  5. Describe how techniques such as artificial intelligence and statistical techniques are used in software agents.
  6. (Wikipedia)In artificial intelligence, an intelligent agent (IA) is an autonomous entity which observes and acts upon an environment (i.e. it is an agent) and directs its activity towards achieving goals (i.e. it is rational). Intelligent agents may also learn or use knowledge to achieve their goals.

    Intelligent agents are also closely related to software agents. For example, autonomous programs used for operator assistance or data mining (sometimes referred to as bots) are also called "intelligent agents".

    As software agents have an autonomous role, they need to be able to make decisions. Statistical techniques are used to devise the decision model that the agent will use. As the agent learns, the statistical model is refined by the agent so that the decisions it makes better fit with expectations.

  7. List popular software agents currently in use in the commercial world.
    • http://www.amazon.com/makes recommendations on what you might like to buy, based upon previous enquiries.
    • NASA's Jet Propulsion Laboratory has an agent that monitors inventory, planning, and scheduling equipment ordering to keep costs down.
    • Allstate Insurance has a network with thousands of computers. The company uses a network monitoring agent from Computer Associates International called Neugent that watches its huge networks 24 hours a day. Every five seconds, the agent measures 1200 data points and can predict a system crash 45 minutes before it happens.
    • Google has agents that analyse web browsing trends and provide targeted advertising.
  8. Identify various activities in e-commerce where software agents are currently in use.
  9. It is suggested (Wikipedia)that there are 4 essential types of intelligent software agents:

    1. Buyer agents or shopping bots
    2. User or personal agents
    3. Monitoring and surveillance agents
    4. Data mining agents

    Examples of using software agents include:


References
Car insurance Quotes. Free Resources: software agents. Retrieved 14 July 2009, from http://www.autocarinsurancebest.com/search.html?q=software+agents&submit=Search
Wikipedia. Intelligent agent. Retrieved 14 July 2009, from http://en.wikipedia.org/wiki/Intelligent_agent
Wikipedia. Software agent. Retrieved 14 July 2009, from http://en.wikipedia.org/wiki/Software_agent

Exercise 23: Searching mechanisms

  1. How do search engines such as Alta Vista differ from information directories?
  2. I must admit that I was very surprised to see that altavista still had a presence on the web.http://www.altavista.com/ I guess it is debateable as to whether having a website constitutes a presence.
    I seemingly remember that years ago it was one of the big few interfaces to the web, but now it just looks like the very poor mans google.

    Having said all that and having to search for the connections between Altavista, information directories, and this topic, (Wikipedia) provided the enlightenment. It turns out that AltaVista used a fast, multi-threaded crawler (Scooter) to trawl the net.

    I am going to take a stab that an information directory is meant to represent a static information source, whereas AltaVista which used a crawler, could be thought of as a dynamic data source.

  3. What is a spider? What does it do?
  4. A spider is an automated software program used to locate and collect data from web pages for inclusion in a search engine's database, and to follow links to find new pages on the world wide web.(Eustace, p2)
  5. Describe a search situation where the requirement for recall is high?
  6. I am having trouble defining exactly what this question is actually asking. I am going to take a stab that it is referring to the correllation between search terms and the returned results. The more relevant the result the higher the recall value. With this interpretation in mind, (Cole)relates Visualizing a high recall search strategy output for undergraduates in an exploration stage of researching a term paper. The abstract states that When accessing an information retrieval system, it has long been said that undergraduates who are in an exploratory stage of researching their essay topic should use a high recall search strategy; what prevents them from doing so is the information overload factor associated with showing the undergraduate a long list of citations. One method of overcoming information overload is summarizing and visualizing the citation list.
  7. What is a meta-search engine? Provide some examples.
  8. According to (Wikipedia)a meta-search engine is a search tool that sends user requests to several other search engines and/or databases and aggregates the results into a single list or displays them according to their source. Metasearch engines enable users to enter search criteria once and access several search engines simultaneously. Metasearch engines operate on the premise that the Web is too large for any one search engine to index it all and that more comprehensive search results can be obtained by combining the results from several search engines. This also may save the user from having to use multiple search engines separately.

    Brainboost, ChunkIt!, Clusty, Dogpile, Excite, Harvester42, HotBot, Info.com, Ixquick, Kayak, LeapFish, Mamma, Metacrawler, MetaLib, Mobissimo, Myriad Search, SideStep, Turbo10, WebCrawler, DeeperWeb are all meta-search engines.

  9. What is spamming?
  10. According to (Yahoo)Spam is any message or posting, regardless of its content, that is sent to multiple recipients who have not specifically requested the message. Spam can also be multiple postings of the same message to newsgroups or list servers that aren't related to the topic of the message. Other common terms for spam include UCE (unsolicited commercial email) and UBE (unsolicited bulk email).
  11. How can you get your site listed at major search sites; and how could you improve your site ranking?
  12. According to (Yahoo) to get your site listed and improve your ranking do the following:
    • Submit your site
    • add meta tags
    • cultivate links to your site
    • build a quality site
    • keep your site fresh
    • use a sitemap

References
Cole C., Mandelblatt B., Stevenson J. Visualizing a high recall search strategy output for undergraduates in an exploration stage of researching a term paper (2002) Information Processing and Management, 38 (1), pp. 37-54.
Eustace K, Bots, agents, spiders and mobile computing. ITC382/ITC594/ITC565 Topic 10 lecture notes
Wikipedia. AltaVista. Retrieved 13 July 2009, from http://en.wikipedia.org/wiki/AltaVista
Wikipedia. Metasearch engine. Retrieved 13 July 2009, from http://en.wikipedia.org/wiki/Metasearch_engine
Yahoo!Help. How can I get my site listed in search engines? Retrieved 13 July 2009, from http://help.yahoo.com/l/us/yahoo/smallbusiness/webhosting/promote/promote-05.html
Yahoo!Help. What is spam? Retrieved 13 July 2009, from http://help.yahoo.com/l/us/yahoo/smallbusiness/bizmail/spam/spam-21.html

Exercise 22

  1. Use the coordination theory framework to describe the contribution of ERP software to organisational goals such as efficiency and flexibility.
  2. (Wikipedia)defines Enterprise resource planning (ERP) is a company-wide computer software system used to manage and coordinate all the resources, information, and functions of a business from shared data stores.

    An ERP system has a service-oriented architecture with modular hardware and software units and "services" that communicate on a local area network. The modular design allows a business to add or reconfigure modules (perhaps from different vendors) while preserving data integrity in one shared database that may be centralized or distributed.

  3. Differentiate between software systems such as Customer Relationship Management (CRM) software, Business-to-Business e-commerce programs and Supply-Chain Management (SCM) software.
  4. (Wikipedia) defines Customer relationship management (CRM)as consisting of the processes a company uses to track and organize its contacts with its current and prospective customers. CRM software is used to support these processes; information about customers and customer interactions can be entered, stored and accessed by employees in different company departments. Typical CRM goals are to improve services provided to customers, and to use customer contact information for targeted marketing.

    According to (Wikipedia) Business-to-business (B2B) describes commerce transactions between businesses, such as between a manufacturer and a wholesaler, or between a wholesaler and a retailer

    Supply chain management software as defined by (Wikipedia) are tools or modules used in executing supply chain transactions, managing supplier relationships and controlling associated business processes.

  5. What are the limitations of the EDI platform? How does a web-based platform for inter-enterprise communication rectify these limitations?
  6. According to (Wikipedia) Electronic Data Interchange (EDI) refers to the structured transmission of data between organizations by electronic means. It is used to transfer electronic documents from one computer system to another (ie) from one trading partner to another trading partner. It is more than mere E-mail; for instance, organizations might replace bills of lading and even checks with appropriate EDI messages

    Often missing from the EDI specifications (referred to as EDI Implementation Guidelines) are real world descriptions of how the information should be interpreted by the business receiving it. For example, suppose candy is packaged in a large box that contains 5 display boxes and each display box contains 24 boxes of candy packaged for the consumer. If an EDI document says to ship 10 boxes of candy it may not be clear whether to ship 10 consumer packaged boxes, 240 consumer packaged boxes or 1200 consumer packaged boxes. It is not enough for two parties to agree to use a particular qualifier indicating case, pack, box or each; they must also agree on what that particular qualifier means

    The Internet has provided a means for any company, no matter how small or where they are located in the world, to become part of a major supply chain initiative hosted by a global retailer or manufacturing company. Many companies around the world have shifted production of labour intensive parts to low-cost, emerging regions such as China and Eastern Europe. Web-based EDI, or webEDI, allows a company to interact with its suppliers in these regions without the worrying of implementing a complex EDI infrastructure

  7. Describe the CRM Life Cycle and the different segments of CRM software.
  8. According to (CRMNEWZ) the life cycle of CRM consists of three phases - customer acquisition, customer relationship enhancements and customer retention. CRM software streamlines CRM activities at each phase of customer relationship management.

    • Customer Acquisition
    • Contact management module and direct marketing module of CRM allow companies to effectively promote and market their products and services to prospects. Those modules help speed up the acquiring processes and reduce the cost of acquiring new customers.
    • Customer Relationship Enhancements
    • CRM helps companies better understand existing customers' needs and behaviors and enhance the profitability from existing customers by cross-selling. They can customize their products and services to individual customers' needs and preferences.
    • Customer Retention
    • Customer service module of CRM system gives the organizations the edge in customer support. They can increase customer satisfaction while reducing the cost of support. Customer retention is critical to the overall profitability of an organization. A customer you spend hundreds of dollars and months to acquire may leave you in seconds as a result of poor customer services.

    According to (Wikipedia)CRM includes many aspects which relate directly to one another:

    • Front office operations — Direct interaction with customers, e.g. face to face meetings, phone calls, e-mail, online services etc.
    • Back office operations — Operations that ultimately affect the activities of the front office (e.g., billing, maintenance, planning, marketing, advertising, finance, manufacturing, etc.)
    • Business relationships — Interaction with other companies and partners, such as suppliers/vendors and retail outlets/distributors, industry networks (lobbying groups, trade associations). This external network supports front and back office activities.
    • Analysis — Key CRM data can be analyzed in order to plan target-marketing campaigns, conceive business strategies, and judge the success of CRM activities (e.g., market share, number and types of customers, revenue, profitability).


References
CRMNEWZ. CRM And Customer Life Cycle. Retrieved 20 July 2009, from http://www.crmnewz.com/crmnewz-18-20050407CRMandCustomerLifeCycle.html
Wikipedia. Business-to-business. Retrieved 20 July 2009, from http://en.wikipedia.org/wiki/Business-to-business
Wikipedia. Customer relationship management. Retrieved 20 July 2009, from http://en.wikipedia.org/wiki/Customer_relationship_management
Wikipedia. Electronic Data Interchange. Retrieved 20 July 2009, from http://en.wikipedia.org/wiki/Electronic_Data_Interchange
Wikipedia. Enterprise resource planning. Retrieved 20 July 2009, from http://en.wikipedia.org/wiki/Enterprise_resource_planning
Wikipedia. Supply chain management. Retrieved 20 July 2009, from http://en.wikipedia.org/wiki/Supply_chain_management

Exercise 21: Shopping cart specifications

Develop the class diagram for the following shopping cart specifications:
A shoppingCart object is associated with only one creditCard and customer and to items in itemToBuy object. Persistent customer information such as name, billing address, delivery address, e-mail address and credit rating is stored in the customer object. The credit card object is associated with a frequentShopper discount object, if the credit rating for the customer is good. The customer can make or cancel orders as well as add and delete items to the shopping cart product. The credit card object contains the secure method for checking that the charge is authentic.

This is a class diagram of the textual information provided. This was produced using the class diagram tool in Visual Studio 2008. There are no multiplicities defined. This would be fleshed out with some further business case analysis.

Exercise 20: Modeling with UML

  1. Use Case, Class, Sequence, Collaboration, State chart, Activity, Component and Deployment diagrams are used in UML. Describe each of the eight (8) main diagrams used in UML.
  1. Use Case diagram
  2. Use cases are text stories, widely used to discover and record requirements.(Larman, p61)

    A use case diagram is an excellent picture of the system context; it makes a good context diagram, that is, showing the boundary of a system, what lies outside of it, and how it gets used. It serves as a communication tool that summarizes the behaviour of a system and its actors.(Larman, p90)

  3. Class diagram
  4. Class diagrams are used to illustrate classes, interfaces, and their associations. They are used for static object modeling. (Larman, p249)
  5. Sequence diagram
  6. A system sequence diagram (SSD) is a fast and easily created artifact that illustrates input and output events related to the systems under discussion. An SSd shows, for a particuler course of events within a use case, the external actors that interact directly with the system, the system (as a black box), and the system events that the actors generate.(Larman, p173-175)
  7. Collaboration diagram
  8. Also called an interaction diagram or a communication diagram. These diagrams illustrate how objects interact via messages. They are used for dynamic object modelling. There are two common types: sequence and communication interaction diagrams. (Larman p221)
  9. State Chart diagram
  10. A state chart allows nesting to obtain substates; a substate inherits the transitions of its superstate (the enclosing state). Substates can be graphically shown by nesting them in a superstate box. (Larman, p489)
  11. Activity diagram
  12. A UML activity diagram shows sequential and parallel activities in a process. They are useful for modelling business processes, workflows, data flows, and complex algorithms.(Larman, p477)
  13. Component diagram
  14. UML components are a design-level perspective,; they don't exist in the concrete software perspective, but map to concrete artifacts such as a set of files. (Larman, p654)
  15. Deployment diagram
  16. A deployment diagram shows the assignment of concrete software artifacts (such as executable files) to computational nodes (something with processing services). It shows the deployment of software elements to the physical architecture and the communication (usually on a network) between physical elements. (Larman, p651)(

References
Larman, C. (2005). Applying UML and patterns: an introduction to object-oriented analysis and design and the unified process (3rd ed.): Prentice Hall PTR Upper Saddle River, NJ, USA.

Exercise 19: TP monitors and transaction protocols

  1. Give a description in your own words of the ACID properties of a transaction.
  2. Atomic means that all portions of a transaction will process successfully or none of them will.
    Consistant means that if a transaction is repeated then the same result will eventuate.
    Isolated means that the transaction is not affected by other transactions.
    Durable means that the result are stored permanently.
  3. Describe a TP monitor environment. How can a TP monitor stop an operating system being overwhelmed?
  4. A TP (Transaction Processing) monitor is a complex program which manages the execution of a transaction starting with the client executing the transaction; it will normally employ a number of servers and then return any results to the client. TP monitors carry out two important processes: they manage the concurrent execution of the threads and processes that make up a transaction and ensure that the ACID properties detailed earlier in the chapter are enforced; for example, a TP monitor ensures that when a transaction updates a shared item of data when other transactions wish to access the data then the result of the updating is consistent.(Ince, p365)
  5. What is difference in load balancing with traditional and transactional MOM, RPC and conversations?
  6. According to (Wikipedia) load balancing is a technique to spread work between two or more computers, network links, CPUs, hard drives, or other resources, in order to get optimal resource utilization, maximize throughput, and minimize response time.

    Message-oriented middleware (MOM) is infrastructure focused on message sending that increases the interoperability, portability, and flexibility of an application by allowing the application to be distributed over multiple heterogeneous platforms. It reduces the complexity of developing applications that span multiple operating systems and network protocols by insulating the application developer from the details of the various operating system and network interfaces

    In traditional MOM, messages are addressed to their recipients, although sender and receiver are loosely coupled and need not synchronise to communicate.(IEEE)

    Remote procedure call (RPC) is an Inter-process communication technology that allows a computer program to cause a subroutine or procedure to execute in another address space (commonly on another computer on a shared network) without the programmer explicitly coding the details for this remote interaction.

  7. How can TP Monitors save money?
  8. TP monitors save money by making use of the processer idle time between user requests. This usage relieves the need for purchasing additional hardware for each individual to utilise. It also means that you make the hardware that you do have work more efficiently from a business perspective.
  9. Why is a two-phase commit protocol better than a one-phase atomic commit protocol?
  10. The two-phase commit protocol is better in a distributed environment in that it allows a server to make a unilateral decision to abort a transaction if required.
    (Ince, p361) The description of the protocol is detailed below in steps 3.1 to 3.4. The general rule about aborting or committing a transaction is: 1. If the client requests that a transaction is aborted, for example the client is building up an order in a shopping cart and decides not to complete the order, then the coordinator will inform all the servers involved in the transaction that they should abort. 2. If one of the servers decides to abort a transaction, for example in order to release a lock, then the coordinator informs all the servers involved in the transaction; they will then all abort. 3. If the client asks for a transaction to be committed then the two-phase commit protocol starts and steps 3.1 to 3.4 are carried out. 3.1 The coordinator asks each server whether they can commit. 3.2 Each server decides whether it can commit or not and sends back a reply which indicates the result of its decision. If it cannot commit then it aborts its transaction. 3.3 If all the servers have voted to commit their transactions then the coordinator informs all the servers that they can commit. 3.4 If at least one server cannot commit then the coordinator decides to abort the transaction and sends an abort message to all the servers involved. 4. Those servers which have agreed to commit to a transaction wait for the final decision from the coordinator. This will be either a commit instruction or an abort instruction. They will then act on this.
  11. What is CICS by IBM?
  12. (Ince, p365-366) CICS is a complex TP monitor marketed by IBM. It will:
    • Initiate and destroy threads to carry out transactional operations. Many transaction monitors will access a pool of threads which have been set up when the monitor was started.
    • Manage the resources that are being accessed, for example ensuring that updates are carried out in such a way that the resource does not lend itself in an inconsistent state.
    • Ensure that if a transaction fails then suitable action is taken; this action can be provided by a programmer as code to be executed. In order to do this most TP monitors will use a two-phase atomic commit protocol.
    • Schedule threads so that low-priority transactions, for example batch transactions, are allocated a smaller share of resources than high-priority transactions such as online transactions.
    • Enable the processing load on a distributed system to be shared between a number of servers.
    • Enable a distributed system to function – even in the presence of the failure of one or more servers.

References
IEEE, (2009). Message-Oriented Middleware. Retrieved 9 July 2009, from http://dsonline.computer.org/portal/site/dsonline/menuitem.9ed3d9924aeb0dcd82ccc6716bbe36ec/index.jsp?&pName=dso_level1&path=dsonline/topics/middleware&file=intro_MOM.xml&xsl=article.xsl
Ince, D. (2006). Developing Distributed & E-commerce Applications: Prentice-Hall, Inc. Upper Saddle River, NJ, USA.
Wikipedia. Load balancing (computing). Retrieved 9 July 2009, from http://en.wikipedia.org/wiki/Load_balancing_(computing)
Wikipedia. Message-oriented middleware. Retrieved 9 July 2009, from http://en.wikipedia.org/wiki/Message-oriented_middleware
Wikipedia. Remote procedure call. Retrieved 9 July 2009, from http://en.wikipedia.org/wiki/Remote_procedure_call

Exercise 18: Threading demonstration in Python

A simple demonstration of the threading module in Python that uses both a lock and semaphore to control concurrency is by Ted Herman at the University of Iowa.

I have looked at the code and the output.

The microsoft subjects that form part of this course also deal with threading issues, required us to understand concurrency and enabled us to think about threadsafe practices.

Exercise 17: Concurrency terms

Find definitions for eight terms and concepts used in threaded programming:
  1. Thread Synchronization
  2. (msdn)Synchronization provides a compromise between the unstructured nature of multi threaded programming and the structured order of synchronous processing. You use synchronization techniques: To explicitly control the order in which code runs whenever tasks must be performed in a specific sequence -or- To prevent the problems that can occur when two threads share the same resource at the same time. For example, you could use synchronization to cause a display procedure to wait until a data retrieval procedure that is running on another thread is complete.
  3. Locks
  4. Locks are pieces of software that make sure that two processes do not get into each other's way when accessing a common resource and sequence the processes when there are dependencies among them.(Eustace, p8)
  5. Deadlock
  6. A deadlock is a case where two pieces of code are trying to access the same objects but are blocking each other from getting at the resources. (Johnson, p396)
  7. Semaphores
  8. In the .Net framework The Semaphore class is used to throttle usage of some resource. Specifically, a Semaphore creates a kernel object that supports a certain number of valid slots at once. When the slots are filled, the remaining code will block until a slot is made available by another thread releasing the slot.(Johnson, p405)
  9. Mutex (mutual exclusion)
  10. A Mutex allows synchronization (like a lock) across AppDomain and process boundaries. (Johnson, p402-405) Using a named Mutex is a common way to synchronize data across process boundaries.
  11. Thread
  12. A process is a running program – code, data (variables, data structures, etc) with at least one thread of execution. A thread is a flow of control through the process, plus a private stack for local data. Threads enable concurrency (Eustace, p2)
  13. Event
  14. An Event provides a way to notify to multiple threads (across AppDomain and process boundaries) that some event has occurred. Events are a type of kernel object that has two states, on and off. These states allow threads across an application to wait until an event is signaled to do something specific.(Johnson, p402-406)
  15. Waitable timer.
  16. A waitable timer (MSDN) object is a synchronization object whose state is set to signaled when the specified due time arrives. The behavior of a waitable timer can be summarized as follows:
    • When a timer is set, it is canceled if it was already active, the state of the timer is nonsignaled, and the timer is placed in the kernel timer queue.
    • When a timer expires, the timer is set to the signaled state. If the timer has a completion routine, it is queued to the thread that set the timer. The completion routine remains in the asynchronous procedure call (APC) queue of the thread until the thread enters an alertable wait state. At that time, the APC is dispatched and the completion routine is called. If the timer is periodic, it is placed back in the kernel timer queue.
    • When a timer is canceled, it is removed from the kernel timer queue if it was pending. If the timer had expired and there is still an APC queued to the thread that set the timer, the APC is removed from the thread's APC queue. The signaled state of the timer is not affected.

References
Eustace K. Concurrency and Transactions, ITC382/ITC594/ITC565 Topic 8
MSDN. Waitable Timer Objects. Retrieved on 6 July 2009, from http://msdn.microsoft.com/en-us/library/ms687012(VS.85).aspx
MSDN. Thread Synchronization. Retrieved on 6 July 2009, from http://msdn.microsoft.com/en-us/library/dsw9f9ts(VS.71).aspx
Johnson, B., Lanham, B., & Wildermuth, S. (2007). Mcpd self-paced training kit (exam 70-549): designing and developing enterprise applications using the microsoft®. net framework.