Sunday, November 7, 2010

Software Engineering

CSE 322 and IT 325
Reference Book: Roger S. Pressman

Saturday, October 16, 2010

Simulations

Monte Carlo Simulations - http://www.chem.unl.edu/zeng/joy/mclab/mcintro.html
Sample Programs - http://omlc.ogi.edu/software/mc/

Summary: This document introduces the concept of Monte Carlo methods by defining the terms and describing a simple example (the determination of pi using a Monte Carlo simulation). Following this introduction is a section on the Monte Carlo experiment, part of the physical chemistry lab at UNL, which computes the population distribution in the rotational energy levels of HCl and DCl.


Introduction to Monte Carlo Methods

The expression "Monte Carlo method" is actually very general. Monte Carlo (MC) methods are stochastic techniques--meaning they are based on the use of random numbers and probability statistics to investigate problems. You can find MC methods used in everything from economics to nuclear physics to regulating the flow of traffic. Of course the way they are applied varies widely from field to field, and there are dozens of subsets of MC even within chemistry. But, strictly speaking, to call something a "Monte Carlo" experiment, all you need to do is use random numbers to examine some problem.
The use of MC methods to model physical problems allows us to examine more complex systems than we otherwise can. Solving equations which describe the interactions between two atoms is fairly simple; solving the same equations for hundreds or thousands of atoms is impossible. With MC methods, a large system can be sampled in a number of random configurations, and that data can be used to describe the system as a whole.
"Hit and miss" integration is the simplest type of MC method to understand, and it is the type of experiment used in this lab to determine the HCl/DCl energy level population distribution. Before discussing the lab, however, we will begin with a simple geometric MC experiment which calculates the value of pi based on a "hit and miss" integration.


Monte Carlo Calculation of Pi

The first figure is simply a unit circle circumscribed by a square. We could examine this problem in terms of the full circle and square, but it's easier to examine just one quadrant of the circle, as in the figure below.
If you are a very poor dart player, it is easy to imagine throwing darts randomly at Figure 2, and it should be apparent that of the total number of darts that hit within the square, the number of darts that hit the shaded part (circle quadrant) is proportional to the area of that part. In other words,
If you remember your geometry, it's easy to show that
If each dart thrown lands somewhere inside the square, the ratio of "hits" (in the shaded area) to "throws" will be one-fourth the value of pi. If you actually do this experiment, you'll soon realize that it takes a very large number of throws to get a decent value of pi...well over 1,000. To make things easy on ourselves, we can have computers generate random* numbers.
If we say our circle's radius is 1.0, for each throw we can generate two random numbers, an x and a y coordinate, which we can then use to calculate the distance from the origin (0,0) using the Pythagorean theorem. If the distance from the origin is less than or equal to 1.0, it is within the shaded area and counts as a hit. Do this thousands (or millions) of times, and you will wind up with an estimate of the value of pi. How good it is depends on how many iterations (throws) are done, and to a lesser extent on the quality of the random number generator. Simple computer code for a single iteration, or throw, might be:
x=(random#)
 y=(random#)
 dist=sqrt(x^2 + y^2)
 if dist.from.origin (less.than.or.equal.to) 1.0 
  let hits=hits+1.0

Monte Carlo Computation of Population Distribution

The actual Monte Carlo method used in this lab to determine the population distribution among rotational energy levels is simpler than the two-dimensional example of the estimation of pi, as only one random number is generated for each "throw." This will be apparent shortly.
For this lab, the Boltzmann distribution can be solved analytically, and it is in fact used in determining the Monte Carlo distribution. As such, this is not a particularly informative simulation (you could just solve the Boltzmann equation for however many energy levels you wished and look at those numbers). However, this lab allows you to watch how changing the number of throws affects the results, and it automates the examination of the effects of temperature and isotope on population of energy levels.
The process used by the computer program for this lab is quite simple.
  • The input information is used to solve the Boltzmann equation for some number of energy levels. For a maximum of J=4, the relative populations might look like the figure to the right.
  • The rest of the simulation is easier to understand if you imagine laying the peaks in the "spectrum" side-by-side, as shown below. If we generate random numbers along that line, whenever a number falls within the range of a particular J value, it counts as a "hit" for that energy level. Obviously, for shorter lengths (J=0) the number of "hits" will be smaller than for longer lengths (J=2).



  • Since random number generators typically produce numbers on the range of zero to one, the population distribution is normalized so that the total "length" is equal to 1.0.
  • For each "throw," or random number produced, the computer determines which energy level range it belongs to, and calls it a "hit" for that J value. After the computer completes all throws, the number of hits (or relative number of hits) for each energy level are given. It is up to you to compare this output to the theoretical distribution produced by the Boltzmann equation, as described in the Lab Report Instructions.


* Computer-generated numbers aren't really random, since computers are deterministic. But, given a number to start with--generally called a random number seed--a number of mathematical operations can be performed on the seed so as to generate unrelated (pseudorandom) numbers. The output of random number generators is tested with rigorous statistical tests to ensure that the numbers are random in relation to one another. One caveat: If you use a random number seed more than once, you will get identical random numbers every time. Thus, for multiple trials, different random number seeds must be used. Commercial programs, like Mathematica, pull a random number seed from somewhere within the system--perhaps the time on the clock--so the seed is unlikely to be the same for two different experiments.

Monday, October 11, 2010

Examination Day

Examination Day - October 13-16


Wednesday 10:30 - 303; 4:30 - 306
Thursday 1:30 - 304; 4:30 - RSB3
Friday 7:30 - 301; 10:30 - 207

Wednesday, September 15, 2010

Photoshop CS2 Animation

http://www.ehow.com/how_4447746_animation-photoshop-cs.html


How to Make Animation in PhotoShop CS2

Sometimes we'd like to create a simple animation for our website. You can create an animation in PhotoShop CS2, and save the file as a GIF. Follow these directions to create a simple animation of a moving arrow. Once you learn the basics, you can try something more elaborate.

Read more: How to Make Animation in PhotoShop CS2 | eHow.com http://www.ehow.com/how_4447746_animation-photoshop-cs.html#ixzz0zfjHthqJ
 
1Go to FILE > NEW > in the menu bar. A new menu will pop up.


  • 2Set the width and height to 600 pixels (in the menu that opened) and set the color mode to RGB Color. Then click OK and the menu will close.

  • 3Click to select the CUSTOM SHAPE TOOL, on the left hand side of the screen, to add an arrow shape to the image.

  • 4Go to the pallet in the lower right hand corner, and click on the PATHS tab, so that the PATHS PALLET appears.

  • 5Click on the small circle with the triangle arrow, in the PATHS PALLET, located to the right of the PATHS tab.

  • 6Click on MAKE SELECTION in the new menu that opened.

  • 7Click OK on the window that opens. That menu will close, and now the line around your arrow should be a dotted line that appears to be moving around the arrow.

  • 8Use your PAINT BUCKET in the left menu, to add color to the arrow.

  • 9Click SELECT > DESELECT > in the menu bar and the dotted line should disappear.

  • 10Go to the pallet in the lower right hand corner, and click on the LAYERS tab, so that the LAYERS PALLET appears.

  • 11Right click on the actual thumbnail image in the LAYERS Pallet, and a new menu will pop up. Click on DUPLICATE LAYER. Another menu will pop up, click OK, and it will close.

  • 12Repeat the previous instruction. You should then have three identical layers.

  • 13Highlight the thumbnail in the first layer.

  • 14Use the MOVE TOOL in the left hand menu to move the arrow in your image to the far left.

  • 15Highlight the thumbnail in the second layer.

  • 16Use the MOVE TOOL in the left hand menu to move the arrow in your image to the center of the image.

  • 17Highlight the thumbnail in the third layer.

  • 18Use the MOVE TOOL in the left hand menu to move the arrow in your image to the far right. The three arrows will appear overlapped, stretched across your image, but they should all be of the same height from the bottom and top of the image.

  • 19In the LAYER PALLET, click the eye next to the thumbnail next to Layer 2 and Layer 3. Your main image should now show just one arrow.

  • 20In the menu bar go to WINDOW > ANIMATION > A new menu will open, showing your animation story board.

  • 21Click on the icon that is DUPLICATES SELECTED FRAMES, which is located directly to the left of the trash can icon, in your animation story board window. A second thumbnail will appear on your story board.

  • 22In the LAYERS PALLET, click on the eye next to LAYER 1, so it disappears. Click on the eye next to LAYER 2, so the eye will appear. (You will notice, your second thumbnail in the story board has changed, to reflect the layer with the visible eye.)

  • 23Click on the icon that is DUPLICATES SELECTED FRAMES, which is located directly to the left of the trash can icon, in your animation story board window. A third thumbnail will appear on your story board.

  • 24In the LAYERS PALLET, click on the eye next to LAYER 2, so it disappears. Click on the eye next to LAYER 3, so the eye will appear. (You will notice, your third thumbnail in the story board has changed, to reflect the layer with the visible eye.)

  • 25Go to FILE > SAVE FOR WEB > A new, larger window menu will open, showing one screen of your image.

  • 26Click on the icon at the bottom of the new menu, which looks like a globe with a question mark. A new window will open, showing what your animation looks like.

  • 27Close menu after previewing your animation and return to the previous window with the globe-like icon.
     
    28Click on the SAVE button in that open window, and save animation on your computer as a GIF.




  • Read more: How to Make Animation in PhotoShop CS2 | eHow.com http://www.ehow.com/how_4447746_animation-photoshop-cs.html#ixzz0zfjQLZyj

     

    Tuesday, September 14, 2010

    Projects/Ecommerce Integration/FunctionalSpecifications

    Projects/Ecommerce Integration/FunctionalSpecifications

    http://wiki.openbravo.com/wiki/Projects/Ecommerce_Integration/FunctionalSpecifications

    Purpose

    The purpose of this project is to enable companies to extend their business processes allowing customers to do real-time transactions through an on-line shopping front-end and use Openbravo ERP as a back-end.

    Scope

    The scope of this project is restricted to extend the current Openbravo web services to integrate Openbravo ERP with ecommerce's solutions and develop a connector for the Magento e-commerce platform as an example of this integration.

     

    User roles & profiles

    • The system administrator. The person that installs Openbravo ERP, the e-commerce platform and the Openbravo ERP / e-commerce connector. Additionally, this person also setups Openbravo ERP and the e-commerce systems for their operation.
    • The customer. The person that connects to the on-line e-commerce front-end and browses the product catalog or places an order.
    • The sales manager. The person is the company that looks after the sales orders and ensures that all the sales operations work correctly.

    Business process definition

    • Search the product catalog.
    • Browse the product catalog.
    • Making an order using an on-line front-end.
    • Notifying the customer that is not enough stock.
    • Generate an invoice for an order that has been completed.

    User stories

    Story 1. A customer connects to the e-commerce front-end looking for a product:
    1. The customer starts at the e-commerce front-end main page.
    2. The customer searches in the products catalog for a specific product.
    3. The customer gets information about the product.
    4. The customer decides if she wants to proceed with an order.
    Story 2. A customer connects to the e-commerce front-end for browsing the products catalog:
    1. The customer starts at the e-commerce front-end main page.
    2. The customer browser hierarchically the products catalog.
    3. The customer gets information about the product.
    4. The customer decides if she wants to proceed with an order.
    Story 3. A customer places successfully an order into the system:
    1. The customer registers or logins into the system.
    2. The customer places an order within the system.
    3. System checks that there is enough stock.
    4. Completes the order successfully.
    5. Decides if she wants an invoice send by mail or shown to her.
    Story 4. A customer tries to place an order into the system but the product is out of stock:
    1. The customer registers or logins into the system.
    2. The customer places an order within the system.
    3. System checks that there is enough stock.
    4. The user is informed of the shortage of stock.
    Story 5. A customer tracks the status of her orders:
    1. The customer logins into the system.
    2. Browses her historical list of sales orders.
    3. Selects the order for which wants more detail and its status.
    4. Detail of the order is shown.

    Functional requirements based on business processes

    Customer management
    It's a common scenario that a new user registers using the e-commerce front-end to be able to perform a commercial transaction later. It should be possible to:
    • Check if a customer already exists in Openbravo ERP.
    • Create new customers in Openbravo ERP.
    • Modify the information of a customer in Openbravo ERP.
    Product catalog
    A product catalog contains all the products that a user can view.
    General considerations:
    • Openbravo ERP supports multiple languages for the product name.
    • All the information about the products in the catalog is stored in Openbravo ERP.
    It should be possible for a user to perform the following actions:
    • Browse the product catalog hierarchically sorted by alphabetically by product name.
    • Browse the product catalog hierarchically by product category.
    • Search the product catalog.
    • Get all the details of a product.
    Every product object can contain at least the following details:
    • Product name.
    • Product description.
    • Product category.
    • Product attributes (weight, color, size, etc).
    • Product price and tax.
    It should be possible for users to query product's inventory availability. This can be displayed when the user is viewing the product information.
    Sales order
    It should be possible for a user to:
    • Perform a full sales order.
    • Modify or cancel an order once it has been created in the system.
    • Get a list of the products that has bought.
    • Track the status of his orders pending to be send.
    Invoicing
    It should be possible for the e-commerce system:
    • Get access to the full invoice object to render an invoice by itself.
    • Get a PDF version of an invoice using the default server report.

    User Interface Mockups

    Technical Requirements

    Web services allows applications to be integrated more rapidly and easily. Integration focuses on the XML messages that define the services rather than the protocol used to relay these messages. These characteristics are ideal for connecting business functions across heterogeneous systems.
    The integration requirements are:
    • The e-commerce system makes calls to the Openbravo ERP web service whenever it requires a synchronization.
    • The definition of these web services should not change from version to version to guarantee the integration with different Openbravo ERP versions.

    Non-Functional Requirements

    These are general requirements that impact in the technical decisions:
    • The final system should scale correctly to support high traffic loads.
    • Security is key since we are performing commercial translations and dealing with confidential data.
    • It is important that all process within Openbravo ERP are automatic (e.g.: see blocking issue 4322)

    Open Discussion Items

    • Which e-commerce platform is better to do the example integration?