Uni student needs helps

hello,
i need some help in understanding my applet. i have little experience programming and i am required to write the following small applet as part of an exam for this the first thursday in june.
http://www-csfy.cs.ualberta.ca/~c114/LabExams/LElocations/lbe28.html
I also am restricted to using the following classes and methods:
http://www-csfy.cs.ualberta.ca/~c114/LabExams/LElocations/library.html
What I am trying to do is output each entry in the stack that is created previously using the draw method until the stack is empty. I have tried to do this but I get null pointer exceptions. What I need to understand is what part of my thought process am I omitting? Once again any responses are always appreciated.
this is the code that I have written so far:
import java.awt.*;
import java.applet.*;
import java.awt.event.*;
import java.util.*;
public class Exam28 extends Applet implements ActionListener {
private final static String enter = "Enter";
private final static String reverse = "Reverse";
private final static int increment=20;
private String aString, anotherString;
private Button anEnterButton, aReverseButton;
private TextField aTextField;
private Stack aStack = new Stack();
private int numberLine;
     public void init() {
          this.aTextField = new TextField(20);
          this.add(aTextField);
          this.anEnterButton = new Button(Exam28.enter);
          this.anEnterButton.addActionListener(this);
          this.add(this.anEnterButton);
          this.aReverseButton = new Button(Exam28.reverse);
          this.aReverseButton.addActionListener(this);
          this.add(this.aReverseButton);
          repaint();
     public void paint( Graphics g ) {
          this.numberLine=40;
          g.drawString(anotherString, 10,this.numberLine);
          this.numberLine=this.numberLine+Exam28.increment;
          repaint();
     public void actionPerformed(ActionEvent event){
//enters the text from the textfield and puts it into the stack
     String enterButton = event.getActionCommand();
     if (enterButton.equals(Exam28.enter)){
          this.aString = aTextField.getText();
          this.aStack.push(aString);
//how do I empty the stack and print it's output from here using the paint method?
//And print each output of the stack on a different line?
     String reverseButton=event.getActionCommand();
     if (reverseButton.equals(Exam28.reverse)){
          if (this.aStack.empty()){
     else
         anotherString =(String)this.aStack.pop();

In your reverseButton action, just call repaint ...only.
Inside your paint method ...do all the logic to empty and print the stack like this:
    while(!aStack.isEmpty()) {
      anotherString =(String)this.aStack.pop();
      g.drawString(anotherString, 10,this.numberLine);
      this.numberLine=this.numberLine+Exam28.increment;
    this.numberLine=40; // reset the counter for next time... so you can do it all again.You have to do it all at once, right inside paint, because a new call to paint will clear any previous output.

Similar Messages

  • Im a Uni student&need help:JAVA Final Year Project: Undo Manager Problem

    Hey all,
    Im writing a Final Year Project and have minimal experience writing in JAVA.
    It is an information visualisation assignment which involves reproducing code/text in a reduced format. Sort of to do with Line oriented statistics.
    http://www.cc.gatech.edu/aristotle/Tools/tarantula/continuous.gif
    This image will give you an idea of what im talking about.
    Anyway, i need to know if its possible to get information about individual undos/edits from an undomanager.
    Basically i need to be able to say, for example,
    there are 12 undos
    undo 12 occurs at line X
    undo 11 occurs at line Y
    etc etc
    I need to be able to get this information without actually invoking the Undo last edit call.
    Im bringing the Java undomanager tutorial home but from what ive read it seems like impossible?
    Any and all help appreciated.
    Regards,
    P

    When I was at uni I had to implement that for the text area of an IDE. All I did was rip off the code from the Notepad.java that comes with the SDK.

  • Uni student needs help

    hello,
    i need some help in understanding my applet. i have no little experience programming and i am required to write the following small applet as part of an exam for this the first thursday in june.
    http://www-csfy.cs.ualberta.ca/~c114/LabExams/LElocations/lbe29.html
    This is the code that I have written so far:
    import java.awt.*;
    import java.applet.*;
    import java.awt.event.*;
    public class Exam29 extends Applet implements ActionListener {
    private final static String square = "Square";
    private final static String circle = "Circle";
    private final static String draw = "Draw";
    private final static String noShape = "Not a shape";
    private String someText;
    private Button drawButton;
    private TextField aTextField;
         public void init() {
              this.aTextField = new TextField(20);
              this.add(aTextField);
              this.drawButton = new Button(Exam29.draw);
              this.add(drawButton);
              repaint();
    public void actionPerformed(ActionEvent event){
         String aDrawButton = event.getActionCommand();
         if (aDrawButton.equalsIgnoreCase(Exam29.draw))
              this.someText=aTextField.getText();
         public void paint( Graphics g ) {
              g.drawString(noShape,10,40);
         if (Exam29.square.equalsIgnoreCase(this.someText))
              g.drawRect(10,40,10,10);
         else if (Exam29.circle.equalsIgnoreCase(this.someText))
              g.drawOval(10,40,10,10);
         else
              g.drawString(noShape,10,40);
    Now my problem is that it doesn't respond to input. it just goes through the program and executes the last statement of my last condition.
    I know this is simple. But simple things always escape me. What is wrong with my understanding of the problem?
    I don't want people to write the program for me, i just want to know where i am going wrong.
    Thanks in advance to all who respond.
    screefer

    try this code.
    import java.awt.*;
    import java.applet.*;
    import java.awt.event.*;
    public class Exam29 extends Applet implements ActionListener {
    private final static String square = "Square";
    private final static String circle = "Circle";
    private final static String draw = "Draw";
    private final static String noShape = "Not a shape";
    private String someText;
    private Button drawButton;
    private TextField aTextField;
    public void init() {
    this.aTextField = new TextField(20);
    this.add(aTextField);
    this.drawButton = new Button(Exam29.draw);
    // actionListener added needed to call actionPerformed()
    this.drawButton.addActionListener(this);
    this.add(drawButton);
    repaint();
    public void actionPerformed(ActionEvent event){
    String aDrawButton = event.getActionCommand();
    if (aDrawButton.equalsIgnoreCase(Exam29.draw))
    this.someText=aTextField.getText();
    // need to repaint after button click
    repaint();
    public void paint( Graphics g ) {
    //   g.drawString(noShape,10,40);
       if (Exam29.square.equalsIgnoreCase(this.someText))
          g.drawRect(10,40,10,10);
       else if (Exam29.circle.equalsIgnoreCase(this.someText))
          g.drawOval(10,40,10,10);
       else
          g.drawString(noShape,10,40);
    }cheers
    jamie

  • Uni student needs help... again 8(

    hello,
    i need some help in understanding my applet. i have little experience programming and i am required to write the following small applet as part of an exam for this the first thursday in june.
    http://www-csfy.cs.ualberta.ca/~c114/LabExams/LElocations/lbe28.html
    I also am restricted to using the following classes and methods:
    http://www-csfy.cs.ualberta.ca/~c114/LabExams/LElocations/library.html
    I have written some of the code for this exercise and it compiles fine, but when I try to push the enter button and push the string object into the stack I get a nullpointerException. Does anyone know why this would be the case? What would be my fix and why?
    Once again Thanks in Advance to all who respond.
    This is the code that I have written so far:
    import java.awt.*;
    import java.applet.*;
    import java.awt.event.*;
    import java.util.*;
    public class Exam28 extends Applet implements ActionListener {
    private final static String enter = "Enter";
    private final static String reverse = "Reverse";
    private String aString;
    private Button anEnterButton, aReverseButton;
    private TextField aTextField;
    private Stack aStack;
         public void init() {
              this.aTextField = new TextField(20);
              this.add(aTextField);
              this.anEnterButton = new Button(Exam28.enter);
              this.anEnterButton.addActionListener(this);
              this.add(this.anEnterButton);
              this.aReverseButton = new Button(Exam28.reverse);
              this.aReverseButton.addActionListener(this);
              this.add(this.aReverseButton);
              repaint();
         public void paint( Graphics g ) {
         public void actionPerformed(ActionEvent event){
         String enterButtonPicked=event.getActionCommand();
         if (enterButtonPicked.equals(Exam28.enter)){
              aString=aTextField.getText();
              aStack.push(aString);

    you need to initialize your Stack before you push anything on to it.
    you could do it when you declare itat the top, like:
    private Stack aStack = new Stack();
    cheers
    jamie

  • Help ex student need help ASAP

    Hello I'm in need of immediate help !!! I am a graduate of a design course visual communications and purchased the design suite under student ID. I am no longer a student and have currently had a computer crash and needed a new hard drive. As I needed to reinstall suite but I don't have a serial number anymore! Can someone help me I'm  currently doing a job for someone with a few days remaining on trial so this is errant!! 

    https://www.adobe.com/account.html for your Adobe orders page
    When you buy software via download you should ALWAYS write the download itself, and a text file with your serial number, to AT LEAST one "off your computer" backup... be that to a DVD or a USB hard drive
    If you can't find your serial number on your orders page, nobody can help

  • New Java Programming Student Needs Help

    Hey everyone,
    I've just started taking a Java programming class at Penn State University, and I have had some prior experience with programming, i.e. C, C++, HTML, SQL. However, this will be my first attempt at Java. I know there are a lot of similarities between C++ and Java, but I'm still a little lost on some methodology.
    To get myself going, I've been looking through the textbook a little and came across a problem that gave me some difficulty. I'll write out the outline:
    A company pays its employees as managers (who receive a fixed weekly salary), hourly workers (who receive a fixed hourly wage for up to the first 40 hours they work and time and a half (i.e. 1.5 times their hourly wage) for overtime hours worked, commission workers (who receive $250 plus 5.7% of their gross weekly sales), and pieceworkers (who receive a fixed amount of money per item for each of the items they produce � each pieceworker in this company works on only one type of item).
    +Define a Java class named EmployeePayment that includes functionality to compute the weekly pay for each employee. You do not know the number of employees in advance. Each type of employee has its own pay code: Managers have paycode 1, hourly workers have paycode 2, commission workers have paycode 3 and pieceworkers have paycode 4.+
    +Define a main method that creates an instance of the EmployeePayment class, and calls the setManagerPay method to set the managers weekly salary to $625.00. The main method should then prompt the user for the paycode ��Enter paycode (-1 to end): �, validate the input and perform the associated processing for that paycode. Your program should allow the user to process employees until a paycode of -1 has been entered. Use a switch structure to compute each employee�s pay, based on the employee�s paycode. Within the switch, prompt the user (i.e. the payroll clerk) to enter the appropriate facts your program needs to calculate each employee�s pay based on that employee�s paycode, invoke the respective method (defined below) to perform the calculations and return the weekly pay for each type of employee, and print the returned weekly pay for each employee.+
    +Define a setManagerPay method that accepts and stores the fixed weekly salary value for managers.+
    +A private instance variable weeklyManagerPay should be defined in the EmployeePayment class to support these accessor and mutator methods.+
    +Define a calcManagerPay method that has no parameters and returns the fixed weekly salary.+
    +Define a calcHourlyWorkerPay method that accepts the hourly salary and total hours worked as input parameters and returns the weekly pay based on the hourly worker pay code description.+
    +Define a calcCommWorkerPay method that accepts the gross weekly sales as an input parameter and returns the weekly pay based on the commission worker pay code description.+
    +Define a calcPieceWorkerPay method that accepts the number of pieces and wage per piece as input parameters and returns the weekly pay based on the piece worker pay code description.+
    +Once all workers have been processed, the total number of each type of employee processed should be printed. Define and manage the following private instance variables (*numManager*, numHourlyWorker, numCommWorker, and numPieceWorker) within the EmployeePayment class. What are the ways in which these variables can be updated?+
    Sorry for the length, but I wanted this to be thorough. Basically, I'm having the most trouble writing the switch statement, and outputting the total number of each type of employee...
    Any help and pointers will be greatly appreciated...thanks all.

    You said you've written C and C++ code before. I don't have an excellent memory but from the little code that I wrote in C, I believe the switch statement is exactly the same.
    Read this: [http://java.sun.com/docs/books/tutorial/java/nutsandbolts/switch.html]
    If you're having trouble understanding something post what your specific problem is. No one is going to write your homework for you, but many, myself included, would be more than willing to help if you're really stumped. Just post your concise problem.
    Edited by: sheky on Mar 12, 2008 9:52 PM

  • Google Fonts, DIVS, student needs help

    For a class project I am trying to replicate this magazine page I selected.  The idea of the project is to use things such as google web fonts.
    So far, I have done this - the font's don't have to match.  It just needs to have the same sort of look:
    OK, so far so good.  But I KNOW that this isn't semantic markup!  The name "Andre Benjamin" should be the <h1>, but I cannot figure out how to do that using google web fonts since the heading used 3 different fonts and different sizes. 
    Additionally, though it looks great in firefox this is how it renders in IE - No google font showing up, the divs are not lining up right.  The site is not "live", this is the view from previewing in IE.  Maybe IE needs it loaded on a server for google font to show?:
    So thanks for any help you can provide.  I know that I need to clean up this code before I go much further.
    The html is:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Untitled Document</title>
    <link href="typography.css" rel="stylesheet" type="text/css" />
    <link href='http://fonts.googleapis.com/css?family=Ewert' rel='stylesheet' type='text/css'><!--A-->
    <link href='http://fonts.googleapis.com/css?family=Asset' rel='stylesheet' type='text/css'><!--NDR-->
    <link href='http://fonts.googleapis.com/css?family=Chivo:900' rel='stylesheet' type='text/css'><!--E-->
    </head>
    <body>
    <div id="container">
    <div id="largeH1">A</div>
    <div id="medH1">NDR</div>
    <div id="medH1_2">&eacute</div>
    <div id="smallH1">BENJAMIN</div>
    </div><!--container-->
    </body>
    </html>
    The CSS is:
    @charset "utf-8";
    body {
        background-color: #333;
    #container {
        height: 1242px;
        width: 960px;
        margin-top: 20px;
        margin-right: auto;
        margin-bottom: 20px;
        margin-left: auto;
        background-image: url(images/bgNapkin.jpg);
        border: thin solid #ADC2A1;
    #largeH1 {
        font-family: 'Ewert', cursive;
        font-size: 300px;
        color: #d94730;
        margin-left: 35px;
        height: 300px;
        width: 215px;
        float: left;
    #medH1 {
        font-family: 'Asset', cursive;
        font-size: 75px;
        margin-left: 200px;
        color: #D94730;
        padding-top: 60px;
    #medH1_2 {
        font-family: 'Chivo', sans-serif;
        color: #D94730;
        font-size: 110px;
        margin-left: 625px;
        margin-top: -120px;
    #smallH1 {
        font-family: 'Chivo', sans-serif;
        color: #D94730;
        font-size: 36px;
        letter-spacing: 40px;
        margin-left: 255px;
        margin-top: -10px;

    Read up on nth-child pseudo-selectors.
    http://css-tricks.com/how-nth-child-works/
    Below, a quick and dirty example with span tags.
    CSS:
    span:nth-child(1)
    {font-size:250%}
    span:nth-child(2)
    {font-size:150%}
    span:nth-child(3)
    {font-size:100%}
    span:nth-child(4)
    {font-size:75%}
    span:nth-child(5)
    {font-size:50%}
    HTML:
    <h1><span>This</span> <span>is</span> <span>a</span> <span>spanned</span> <span>heading</span></h1>
    The result:
    Nancy O.
    Alt-Web Design & Publishing
    Web | Graphics | Print | Media  Specialists 
    http://alt-web.com/
    http://twitter.com/altweb

  • First Java Programming Assignment - Grad student needs Help

    Thank-you to whomever helps me out here (I have been waiting for the Professor to respond for 2 days now, and our asignment is due by midnight 2-nite. Here is my problem. We have a value called nPer. This value is defined as a double (it needs to since, it perfoms lots of calculations). Now the assigment calls for the print line to display the field in its integer format. So I have done the following:
    nPer=Math.ceil(nPer);
    This has caused the value to be represented as 181.0. Not good enough! The value needs to be truncated and represented as 181.
    The professor has provided us with directions that use the following syntax
    (int)181.0
    Putting that exact code in my program causes JBuilder to create an error message. Ergo, its not right. I have serached all over the tutorial looking for the proper method to resolve this, however - no luck. Could some kind sole please help??? Thank-you.

    You can look at either java.math.BigDecimal, if the
    true representation of the value and rounding are a
    concern, or java.text.NumberFormat if it's simply a
    matter of display.
    Your professor must be an old C programmer. Casting a
    double to an int? Oh, my. - MODBut that's what his assignment says, display it as an int. And the cast would work; I'm assuming he just didn't use it right.

  • Web Design/Graphic Arts Student needs help choosing a Macbook.

    First post on board so greetings!
    I have went back through all the archives and read every post I could on purchasing a Macbook for Web Design/Graphics but would like more info.
    Being a first time Mac user I am a little overwelmed by the all the guru talk. I will be going back to college next month for mainly Web Design/Development with Graphic Arts thrown into the program. The College has Mac Desktops to use but some of my classes will be online and I would like the portability of a Macbook to work from home with.
    I will be having to use Adobe Creative Suite (all 10 programs within it) and Autodesk 3ds Max. Being that I will be dealing with graphics I am willing to pay for the 15" Retina Screen. I have read that the Quadcore I7 processor may be over kill since alot of programs will never use the extra cores but with technology changing all the time I don't want to have tot upgrade in 2 years.
    So I'm looking for suggestions and will gladly add more info to help make my choice...
    Thanks in advance!

    lespaul75 wrote:
    First post on board so greetings!
    I will be having to use Adobe Creative Suite (all 10 programs within it) and Autodesk 3ds Max.
    I don't want to have tot upgrade in 2 years.
    welcome to the ASC-
    I would buy quadcore, with RAM maxed out and the largest HD for your specified needs.
    Web Design/Graphic Arts you will have many software packages running simultaneously to do your work.

  • Java Intro student needs help on arrays

    As my first assignment I have created a program called RobotRat which has a "Rat" move north, south, east, or west on an array floor. I have the program running but am having trouble creating my "floor" using a two-dimensional array. My teacher also wants us to use boolean values for our array. I am drawing a blank on how to create this. From my books I have gathered the following code but cannot get it to work. Any help would be greatly appreciated:
    1.public class RobotRatArray
    2.{
    3.
    4. dataType RobotRatArray[] [];
    5. int matrix [] [];
    6. matrix = new int [20] [20];
    7.
    8.
    9.}

    Okay, I just spoke with a classmate of mine and they said my array isn't in another window. I need to do some system.out.print commands so they print out on my dos window. I am just so confused with this program. I am going to copy and paste it in here in case anyone has any guidance for me. It would be greatly appreciated. (Sorry, I can't figure out how to get my line numbers to populate from textpad when I paste in this message)
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.util.*;
    public class RobotRat extends JFrame implements ActionListener
         private JPanel panel1 = null;
         private JPanel panel2 = null;
         private JPanel panel3 = null;
         private JLabel label1 = null;
         private JLabel label2 = null;
         private JLabel label3 = null;
         private JTextField textfield1 = null;
         private JButton button1 = null;
         private JButton button2 = null;
         private JButton button3 = null;
         private JButton button4 = null;
         private boolean[][] floor = null;
         private int current_column = 21;
         private int current_row = 21;
         private static final int UP = 1;
         private static final int DOWN = 0;
         private static final int NORTH = 0;
         private static final int EAST = 1;
         private static final int SOUTH = 2;
         private static final int WEST = 3;
         private int pen_position = UP;
         private int rats_direction = EAST;
    public RobotRat()
    super("RobotRat");
    label1 = new JLabel("Spaces: ");
    textfield1 = new JTextField(40);
    button1 = new JButton("Move North");
    button2 = new JButton("Move South");
    button3 = new JButton("Move East");
    button4 = new JButton("Move West");
    button1.addActionListener(this);
    button2.addActionListener(this);
    button3.addActionListener(this);
    button4.addActionListener(this);
    this.getContentPane().setLayout(new FlowLayout());
    this.getContentPane().add(label1);
    this.getContentPane().add(textfield1);
    this.getContentPane().add(button1);
    this.getContentPane().add(button2);
    this.getContentPane().add(button3);
    this.getContentPane().add(button4);
    this.setSize(600, 100);
    this.setLocation(100, 100);
    this.show();
    public void togglePen()
         switch(pen_position)
              case (UP): pen_position = DOWN;
              label1.setText("DOWN");
              break;
              case (DOWN): pen_position = UP;
              label1.setText("UP");
              break;
              default: break;
    public void turnLeft()
         switch(rats_direction)
              case NORTH: rats_direction = WEST;
              label3.setText("WEST");
              break;
              case EAST: rats_direction = NORTH;
              label3.setText("NORTH");
              break;
              case SOUTH: rats_direction = EAST;
              label3.setText("EAST");
              break;
              case WEST: rats_direction = SOUTH;
              label3.setText("SOUTH");
              break;
    public void move()
         int spaces_to_move = 0;
         try
              spaces_to_move=Integer.parseInt(textfield1.getText());
         catch(Exception e)
         switch(pen_position)
              case UP:
                   switch(rats_direction)
                        case NORTH: ;
                        case SOUTH: ;
                        case WEST: ;
                        case EAST: ;
              break;
              case DOWN:
                   switch(rats_direction)
                        case NORTH: ;
                        case SOUTH: ;
                        case WEST: ;
                        case EAST: ;
              break;
    public void actionPerformed(ActionEvent e)
         if (e.getActionCommand().equals("TogglePen")) {
         togglePen();
         else if (e.getActionCommand().equals("TurnLeft")) {
         turnLeft();
    public static void main(String[] args)
         RobotRat rr = new RobotRat();

  • Collage Students need help with Java project(Email Server) whats analysis?

    Hi im studying in collage at the moment and i have just started learning java this semester, the thing is my teacher just told us to do an project in java , since we just started the course and i dont have any prior knowledge about java i was wondering if some one could help me with the project.
    i choose Email Sevice as my project and we have to submit an analysis and design document , but how the hell am i suppose to know what analysis is ? i just know we use ER diagrams & DFD's in the design phase but i dont know what analysis means ?
    could some one tell me what analysis on an email service might be? and what analysis on a subject means? is it the codeing involved or some thing coz the teacher told us not to do any codeing yet so im completly stumped,
    oh and btw we are a group of 3 students who are asking u the help here coz all of us in our class are stupmed ?

    IN case any one is interested this is the analysis i wrote
    ANALYSIS
    Analysis means figuring out what the problem is, maybe what kinds of solutions might be appropriate
    1.     Introduction:-
    The very definition of analysis is an investigation of the component parts of a whole and their relations in making up the whole. The Analysis done here is for an emailing service called Flashmail, the emailing service is used to send out mails to users registered with our service, these users and there log activities will be stored in some where, the most desirable option at this time is a Database, but this can change as the scope of the project changes.
    2.     Customer Analysis:-
    We are targeting only 30 registered users at the moment but this is subject to change as the scale changes of the project .Each user is going to be entitled to 1MB of storage space at this time since we lack the desired infrastructure to maintain anything higher than 1MB but the end vision of the project is to sustain 1000 MB of storage space while maintaining a optimal bandwidth allocation to each user so as to ensure a high speed of activity and enjoyment for the Customer.
    The Service will empower the user to be able to send, read, reply, and forward emails to there specified locations. Since we are working on a limited budget we can�t not at this time enable the sending of attachments to emails, but that path is also left open by modularity of java language, so we can add that feature when necessary.
    3.     Processor Load Analysis:-
    The number of messages per unit time processing power will be determined on hand with various algorithms, since it is best not to waste processor power with liberally distributing messages per unit time. Hence the number of messages will vary with in proportion to the number of registered users online at any given time.
    4.     Database Decision Analysis:-
    The High level Requirements of the service will have to be decided upon, the details of which can be done when we are implementing the project itself. An example of high level requirements are database management, we have chosen not to opt for flat files because of a number of reasons, first off a flat files are data files that contain records with no structured relationships additional knowledge is required to interpret these files such as the file format properties. The disadvantages associated with flat files are that they are not fast, they can only be read from top to bottom, and usually they have to be read all the way through. Though there is are advantages of Flat files they are that it takes up less space than a structured file. However, it requires the application to have knowledge of how the data is organized within the file.
    Good databases have key advantage over flat files concurrency. When you just read stuff from file it�s easy, but tries to synchronize multiple updates or writes into flat file from scripts that run in different process spaces.
    Whereas a flat file is a relatively simple database system in which each database is contained in a single table. In contrast, relational database systems can use multiple tables to store information, and each table can have a different record format.
    5.     Networking Analysis:-
    Virtually every email sent today is sent using two popular protocols known as SMTP (Simple Mail Transfer Protocol) and MIME (Multipurpose Internet Mail Extensions).
    1.     SMTP (Simple Mail Transfer Protocol)
    The SMTP protocol is the standard used by mail servers for sending and receiving email. In order to send email we will first establish a network connection to our SMTP server. Once you have finished sending your email message it is necessary that you disconnect from the SMTP server
    2.     MIME (Multipurpose Internet Mail Extensions)
    The MIME protocol is the standard used when composing email messages.

  • Does the % drop the decimal before or after calculation? Student needs help

    I'm a student taking a course on Java at home and I need to know if in a calculation, the % switch drops the decimal before or after calculation?

    % as in mod, as in remainder? I believe this only works on int/long values, in which case, it would probably be before... but I have been known to be wrong.

  • Student needs help....

    We have to develop a web-site using JSP and servlets, so I thought it would be good idea to throw most of the site template info into a bean. Thought it was easy until I got the following recurring error from Tomcat (4.0.1)... any help would be greatly appreciated as my Professor knows less than I do...
    type Exception report
    message Internal Server Error
    description The server encountered an internal error (Internal Server Error) that prevented it from fulfilling this request.
    exception
    org.apache.jasper.JasperException: Cannot find any information on property 'Header' in a bean of type 'assignment3.HomesOnlineSiteTemplate'
         at org.apache.jasper.runtime.JspRuntimeLibrary.getReadMethod(JspRuntimeLibrary.java:701)
         at org.apache.jasper.compiler.GetPropertyGenerator.generate(GetPropertyGenerator.java:104)
         at org.apache.jasper.compiler.JspParseEventListener$GeneratorWrapper.generate(JspParseEventListener.java:831)
         at org.apache.jasper.compiler.JspParseEventListener.generateAll(JspParseEventListener.java:241)
         at org.apache.jasper.compiler.JspParseEventListener.endPageProcessing(JspParseEventListener.java:197)
         at org.apache.jasper.compiler.Compiler.compile(Compiler.java:215)
         at org.apache.jasper.servlet.JspServlet.loadJSP(JspServlet.java:546)
         at org.apache.jasper.servlet.JspServlet$JspServletWrapper.loadIfNecessary(JspServlet.java:177)
         at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:189)
         at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:382)
         at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:474)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:201)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
         at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2344)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
         at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
         at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:462)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:163)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
         at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:1011)
         at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1106)
         at java.lang.Thread.run(Thread.java:484)
    The bean is locted in tomcat\webapps\ROOT\Web-Inf\classes\assignment3:
    package assignment3;
    public class HomesOnlineSiteTemplate{
    // Locations of the images used in this bean
    private String TopBanner = "file://C:\\Program Files\\Adobe\\Photoshop\\Samples\\top-banner2.gif";
    // props
    private String Header="";
    private String HeaderBegin="<HTML><HEAD><META NAME=\"GENERATOR\" Content=\"Microsoft Visual Studio 6.0\">";
    private String HeaderTitleBegin="<TITLE>";
    private String Title="";
    private String HeaderTitleEnd="</TITLE>";
    private String Script="";
    private String HeaderEnd="</HEAD>";
    private String BodyBeginA="<BODY topmargin=0 leftmargin=0 marginheight=0 marginwidth=0><TABLE cellSpacing=0 cellPadding=0 width=\"100%\" border=0><TR><TD colspan=2><IMG src=\"";
    private String BodyBeginB="\"></TD></TR>";
    private String BodyBegin="";
    private String BodyEnd="</table></body></html>";
    private String BannerLeftLogon="<table><tr><td><font color=White><form name=\"login\" onSubmit=\"javascript:formValidate(this)\" action=\"doLogin.jsp\" method=\"post\">UserName:<br>  <INPUT type=\"text\" size=10 name=\"name\"><br>Password:<br>  <input type=\"password\" name=\"pw\" size=\"10\"><br><br><center><input type=\"submit\" value=\"Login\"></center></form></font></td></tr></table>";
    private void Init(){
    BodyBegin=BodyBeginA + TopBanner + BodyBeginB;
    public String getBannerLeftLogon(){
    // This method will return the left side banner with a logon form
    return BannerLeftLogon;
    public String getBodyBegin(){
    // This method will return the BodyBegin String
    return BodyBegin;
    public void setBodyBegin(String newBegin){
    // This method will allow client to create new Body beginning (<body>)
    BodyBegin=newBegin;
    public String getBodyEnd(){
    // This method returns the BodyEnd property
    return BodyEnd;
    public void setBodyEnd(String newEnd){
    // This method allows resetting of BodyEnd to new BodyEnd
    BodyEnd = newEnd;
    public String getHeader(){
    // This routine returns the Header as established. Client should use setScript() if there is to be any <script> elements
    // added to header PRIOR to calling this method
    if (Header!=""){
    return Header;
    else{
    Header = HeaderBegin + HeaderTitleBegin + Title + HeaderTitleEnd + Script + HeaderEnd;
    return Header;
    public void setHeader(String TempHeader){
    // This method allows the user to define a custom Header vAriable from the calling page
    Header = TempHeader;
    public void setScript(String TempScript){
    // This method will set Variable Script to the appropriate value defined by Parameter TempScript
    Script = TempScript;
    public void setTitle(String TempTitle){
    // This method will set Variable Title to the appropriate value defined by Parameter TempTitle
    Title = TempTitle;
    public void setTopBanner(String newBanner){
    TopBanner=newBanner;
    BodyBegin=BodyBeginA+TopBanner+BodyBeginB;
    and the JSP script is in tomcat\webapps\ROOT
    <!-- bean driver jsp
    <jsp:useBean id="template" class="assignment3.HomesOnlineSiteTemplate"/>
    <jsp:setProperty name="template" property="Title" value="Testing"/>
    </jsp:useBean>
    <jsp:getProperty name="template" property="Header"/>
    <jsp:getProperty name="template" property="BodyBegin"/>
    <h1>This is yet another test of a redesigned JavaBean</h1>
    <jsp:getProperty name="template" property="BodyEnd"/>

    Your problem is very simple really. In your bean if you have properties (header, name, age, etc) then you can have (setHeader(), setName(), setAge() etc). But in your case, it is Header (Please look into the case). Your jsp will look for the property 'header' ('h' in lower case) but not for 'Header'.
    So, you rename the property in your bean,
    private String header=""; This holds good for rest of the properties too.
    and in Jsp, <jsp:getProperty name="template" property="header"/>
    Hope this helps. Don't forget the dukes if it works for you.
    Sudha

  • Intro To Java Programming student needing help on how to download java SDK on 10.6.8

    Hey Ladies and Gents,
    For the past hour I have been trying to download Java SDK for my 10.6.8 Mac. Can someone point me in the right direction. I am taking a course in intro to Java programming and the book I am using isnt as helpful as I hoped.

    SE 6 development kits support SE 5 constructs.  Just watch that you use only SE 5 constructs.  Texts on 5 will not list the 6 constructs, and texts on 6 are available that tell what came when.
    There is another forum (https://discussions.apple.com/community/developer_forums) where "developers" troll for questions to answer, and your developer questions will stay at the top of the list longer than in MacbookPro forum.

  • AS3 student needs help!

    Hi readers I'm new to AS3 and Im not too sure who to ask for help so I thought I would try here first! (If some can recommend a better place please do!)
    I'm trying to work out txt boxes....
    I cant figure out what's going wrong here.
    I wasn't able to use the Number variable to store inputs from the text boxes. So I looked up how to convert them to strings... I thought that would solve all my problems but now I just get a return of "NaN" when I press my button. Anyone know what's wrong with my Script??
    import flash.events.MouseEvent;
    // HomeWork week 2 - Jack McCallum - 3/8/2011
    // Take input from 4 text fields. The number of fruit and payment.
    // Output in a textbox the change from the transaction
    stop(); //a wee stop button
    var pricePlum:Number = 2.0;
    var priceGrape:Number = 2.10;
    var pricePeach:Number = 2.90;
    // super cool variable names go here
    var numPlum = Number(input1);
    var numGrape = Number(input2);
    var numPeach = Number(input3);
    var payment = Number(input4);
    var changy:Number;
    // It wouldnt let me input using "number" variable so I tryed coverting them all to strings and then ouput as strings
    var input1:String;
    var input2:String;
    var input3:String;
    var input4:String;
    var outputText = String(changy);
    fruitButton.addEventListener(MouseEvent.CLICK, nextClick);//if I click the button stuff happens
    //below is the main function wich calls the other functions. it is suposed to take buyFruit ouput and put it in a text box.
    function nextClick(myNextEvent:MouseEvent):void{
    captureText();
    buyFruit();
    textChange.text = outputText;
    // hmmm why wont you work?
    function captureText():void {
    input1 = textPlum.text;
    input2 = textGrape.text;
    input3 = textPeach.text;
    input4 = textPayment.text;
    //calculates the change by: payment minus number of fruit times price etc.
    function buyFruit():Number
    return changy = payment -((numPlum * pricePlum)+(numGrape * priceGrape)+(numPeach * pricePeach));

    the text property of a textfield is always a string, even if it looks like a number to you.  to coerce flash into treating what looks like a number to you to a number that flash can handle use the Number() function:
    var n:Number=Number(yourtextfield.text);
    also, make sure your textfields are NOT multiline.

Maybe you are looking for