Search Results

Search found 510 results on 21 pages for 'crystal'.

Page 15/21 | < Previous Page | 11 12 13 14 15 16 17 18 19 20 21  | Next Page >

  • UPK Pre-built Content Now Available for Additional Product Lines

    - by Karen Rihs
    UPK pre-built content development efforts are always underway and growing, and now include the recent release of new UPK pre-built content modules for three additional product lines! Oracle Utilities for Meter Data Management 2.0.1 Administrative Setup User Tasks VEE and Usage Rules Working with Measurement Data Fusion 11g Release 1 Functional Setup Manager General Ledger Global Human Resources Project Portfolio Management Self Service Procurement Oracle Crystal Ball 11.1.2 Oracle Crystal Ball For the most recent list of modules currently available for each product line, visit the UPK Resource Library on Oracle.com. For more information on how your organization can take advantage of UPK pre-built content, see our previous blog, The Value of UPK Pre-Built Content.  - Karen Rihs, UPK Outbound Product Management

    Read the article

  • Help file formats - MSHA files v CHM files

    - by TATWORTH
    Recently I was tasked with producing a help file from a C#/WPF/Crystal Reports application using Sandcastle. I have previously blogged about the problems in doing that and the change that is going into the next version of Sandcastle that allows the vagaries of Crystal (this missing BusinessObjects.Licensing.KeycodeDecoder) to be handled. At http://social.msdn.microsoft.com/Forums/en-US/devdocs/thread/0b110502-f5bb-4c56-96a5-4347a2a7a68a/, I describe how I tried each of the formats. Two of the formats could not be built and the error messages were not exactly helpful as to the cause. These two formats turned out to be obsolete. The MSHA format worked but was not suitable for a standalone application, so that left me with the older CHM format. I therefore asked on that thread "will the HTML Help 1 (CHM) format continue to be supported for the foreseeable future?".Rob Chandler, MVP in help systems, gave a very helpful answer, to the effect that there is not yet a replacement for the CHM format.

    Read the article

  • need to know whether report is launched or not

    - by user313085
    i am developing web application.in that i creating report using crystal report. The crystal report gives report as pdf file. i need to know whether report is generated and launched or not. if not i will give alert to user ie "Report is not generated" if anybody know please reply me Thanks -Kotesh

    Read the article

  • Sorting in Hash Maps in Java

    - by Crystal
    I'm trying to get familiar with Collections. I have a String which is my key, email address, and a Person object (firstName, lastName, telephone, email). I read in the Java collections chapter on Sun's webpages that if you had a HashMap and wanted it sorted, you could use a TreeMap. How does this sort work? Is it based on the compareTo() method you have in your Person class? I overrode the compareTo() method in my Person class to sort by lastName. But it isn't working properly and was wondering if I have the right idea or not. getSortedListByLastName at the bottom of this code is where I try to convert to a TreeMap. Also, if this is the correct way to do it, or one of the correct ways to do it, how do I then sort by firstName since my compareTo() is comparing by lastName. import java.util.*; public class OrganizeThis { /** Add a person to the organizer @param p A person object */ public void add(Person p) { staff.put(p.getEmail(), p); //System.out.println("Person " + p + "added"); } /** * Remove a Person from the organizer. * * @param email The email of the person to be removed. */ public void remove(String email) { staff.remove(email); } /** * Remove all contacts from the organizer. * */ public void empty() { staff.clear(); } /** * Find the person stored in the organizer with the email address. * Note, each person will have a unique email address. * * @param email The person email address you are looking for. * */ public Person findByEmail(String email) { Person aPerson = staff.get(email); return aPerson; } /** * Find all persons stored in the organizer with the same last name. * Note, there can be multiple persons with the same last name. * * @param lastName The last name of the persons your are looking for. * */ public Person[] find(String lastName) { ArrayList<Person> names = new ArrayList<Person>(); for (Person s : staff.values()) { if (s.getLastName() == lastName) { names.add(s); } } // Convert ArrayList back to Array Person nameArray[] = new Person[names.size()]; names.toArray(nameArray); return nameArray; } /** * Return all the contact from the orgnizer in * an array sorted by last name. * * @return An array of Person objects. * */ public Person[] getSortedListByLastName() { Map<String, Person> sorted = new TreeMap<String, Person>(staff); ArrayList<Person> sortedArrayList = new ArrayList<Person>(); for (Person s: sorted.values()) { sortedArrayList.add(s); } Person sortedArray[] = new Person[sortedArrayList.size()]; sortedArrayList.toArray(sortedArray); return sortedArray; } private Map<String, Person> staff = new HashMap<String, Person>(); public static void main(String[] args) { OrganizeThis testObj = new OrganizeThis(); Person person1 = new Person("J", "W", "111-222-3333", "[email protected]"); Person person2 = new Person("K", "W", "345-678-9999", "[email protected]"); Person person3 = new Person("Phoebe", "Wang", "322-111-3333", "[email protected]"); Person person4 = new Person("Nermal", "Johnson", "322-342-5555", "[email protected]"); Person person5 = new Person("Apple", "Banana", "123-456-1111", "[email protected]"); testObj.add(person1); testObj.add(person2); testObj.add(person3); testObj.add(person4); testObj.add(person5); System.out.println(testObj.findByEmail("[email protected]")); System.out.println("------------" + '\n'); Person a[] = testObj.find("W"); for (Person p : a) System.out.println(p); System.out.println("------------" + '\n'); a = testObj.find("W"); for (Person p : a) System.out.println(p); System.out.println("SORTED" + '\n'); a = testObj.getSortedListByLastName(); for (Person b : a) { System.out.println(b); } } } Person class: public class Person implements Comparable { String firstName; String lastName; String telephone; String email; public Person() { firstName = ""; lastName = ""; telephone = ""; email = ""; } public Person(String firstName) { this.firstName = firstName; } public Person(String firstName, String lastName, String telephone, String email) { this.firstName = firstName; this.lastName = lastName; this.telephone = telephone; this.email = email; } public String getFirstName() { return firstName; } public void setFirstName(String firstName) { this.firstName = firstName; } public String getLastName() { return lastName; } public void setLastName(String lastName) { this.lastName = lastName; } public String getTelephone() { return telephone; } public void setTelephone(String telephone) { this.telephone = telephone; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public int compareTo(Object o) { String s1 = this.lastName + this.firstName; String s2 = ((Person) o).lastName + ((Person) o).firstName; return s1.compareTo(s2); } public boolean equals(Object otherObject) { // a quick test to see if the objects are identical if (this == otherObject) { return true; } // must return false if the explicit parameter is null if (otherObject == null) { return false; } if (!(otherObject instanceof Person)) { return false; } Person other = (Person) otherObject; return firstName.equals(other.firstName) && lastName.equals(other.lastName) && telephone.equals(other.telephone) && email.equals(other.email); } public int hashCode() { return this.email.toLowerCase().hashCode(); } public String toString() { return getClass().getName() + "[firstName = " + firstName + '\n' + "lastName = " + lastName + '\n' + "telephone = " + telephone + '\n' + "email = " + email + "]"; } }

    Read the article

  • Introspection of win32com module / pythoncom module

    - by crystal
    Hi, what is the best way to see what all functions that can be performed using pythoncom module? Specifically, i was working with the win32com module to operate upon excel files. I was not able to find introspection for it as we do for the rest of the modules. Can anyone please suggest how can i retrieve this information?

    Read the article

  • Using getters/setters in Java

    - by Crystal
    I'm having some trouble with the idea of accessing variables from other classes. I had a post here: http://stackoverflow.com/questions/3011642/having-access-to-a-private-variable-from-other-classes-in-java where I got some useful information, and thought an example would be better show it, and ask a separate question as well. I have a form that I can input data to, and it has a List variable. I didn't make it static at first, but I thought if I needed to get the total size from another class, then I wouldn't create an instance of that class in order to use the function to getTotalContacts. I basically want to update my status bar with the total number of contacts that are in my list. One of the members said in the above post to use the original Foo member to get the contacts, but I'm not sure how that works in this case. Any thoughts would be appreciated. Thanks. import java.awt.*; import java.awt.event.*; import javax.swing.*; import java.util.List; import java.util.ArrayList; public class AddressBook { public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { AddressBookFrame frame = new AddressBookFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JMenuBar menuBar = new JMenuBar(); frame.setJMenuBar(menuBar); JMenu fileMenu = new JMenu("File"); JMenuItem openItem = new JMenuItem("Open"); JMenuItem saveItem = new JMenuItem("Save"); JMenuItem saveAsItem = new JMenuItem("Save As"); JMenuItem printItem = new JMenuItem("Print"); JMenuItem exitItem = new JMenuItem("Exit"); fileMenu.add(openItem); fileMenu.add(saveItem); fileMenu.add(saveAsItem); fileMenu.add(printItem); fileMenu.add(exitItem); menuBar.add(fileMenu); JMenu editMenu = new JMenu("Edit"); JMenuItem newItem = new JMenuItem("New"); JMenuItem editItem = new JMenuItem("Edit"); JMenuItem deleteItem = new JMenuItem("Delete"); JMenuItem findItem = new JMenuItem("Find"); JMenuItem firstItem = new JMenuItem("First"); JMenuItem previousItem = new JMenuItem("Previous"); JMenuItem nextItem = new JMenuItem("Next"); JMenuItem lastItem = new JMenuItem("Last"); editMenu.add(newItem); editMenu.add(editItem); editMenu.add(deleteItem); editMenu.add(findItem); editMenu.add(firstItem); editMenu.add(previousItem); editMenu.add(nextItem); editMenu.add(lastItem); menuBar.add(editMenu); JMenu helpMenu = new JMenu("Help"); JMenuItem documentationItem = new JMenuItem("Documentation"); JMenuItem aboutItem = new JMenuItem("About"); helpMenu.add(documentationItem); helpMenu.add(aboutItem); menuBar.add(helpMenu); frame.setVisible(true); } }); } } class AddressBookFrame extends JFrame { public AddressBookFrame() { setLayout(new BorderLayout()); setTitle("Address Book"); setSize(DEFAULT_WIDTH, DEFAULT_HEIGHT); AddressBookToolBar toolBar = new AddressBookToolBar(); add(toolBar, BorderLayout.NORTH); AddressBookStatusBar aStatusBar = new AddressBookStatusBar(); add(aStatusBar, BorderLayout.SOUTH); AddressBookForm form = new AddressBookForm(); add(form, BorderLayout.CENTER); } public static final int DEFAULT_WIDTH = 500; public static final int DEFAULT_HEIGHT = 500; } /* Create toolbar buttons and add buttons to toolbar */ class AddressBookToolBar extends JPanel { public AddressBookToolBar() { setLayout(new FlowLayout(FlowLayout.LEFT)); JToolBar bar = new JToolBar(); JButton newButton = new JButton("New"); JButton editButton = new JButton("Edit"); JButton deleteButton = new JButton("Delete"); JButton findButton = new JButton("Find"); JButton firstButton = new JButton("First"); JButton previousButton = new JButton("Previous"); JButton nextButton = new JButton("Next"); JButton lastButton = new JButton("Last"); bar.add(newButton); bar.add(editButton); bar.add(deleteButton); bar.add(findButton); bar.add(firstButton); bar.add(previousButton); bar.add(nextButton); bar.add(lastButton); add(bar); } } /* Creates the status bar string */ class AddressBookStatusBar extends JPanel { public AddressBookStatusBar() { setLayout(new FlowLayout(FlowLayout.LEFT)); this.statusBarString = new JLabel("Total: " + AddressBookForm.getTotalContacts()); add(this.statusBarString); } public void updateLabel() { contactsLabel.setText(AddressBookForm.getTotalContacts().toString()); } private JLabel statusBarString; private JLabel contactsLabel; } class AddressBookForm extends JPanel { public AddressBookForm() { // create form panel this.setLayout(new GridLayout(2, 1)); JPanel formPanel = new JPanel(); formPanel.setLayout(new GridLayout(4, 2)); firstName = new JTextField(20); lastName = new JTextField(20); telephone = new JTextField(20); email = new JTextField(20); JLabel firstNameLabel = new JLabel("First Name: ", JLabel.LEFT); formPanel.add(firstNameLabel); formPanel.add(firstName); JLabel lastNameLabel = new JLabel("Last Name: ", JLabel.LEFT); formPanel.add(lastNameLabel); formPanel.add(lastName); JLabel telephoneLabel = new JLabel("Telephone: ", JLabel.LEFT); formPanel.add(telephoneLabel); formPanel.add(telephone); JLabel emailLabel = new JLabel("Email: ", JLabel.LEFT); formPanel.add(emailLabel); formPanel.add(email); add(formPanel); // create button panel JPanel buttonPanel = new JPanel(); JButton insertButton = new JButton("Insert"); JButton displayButton = new JButton("Display"); ActionListener insertAction = new AddressBookListener(); ActionListener displayAction = new AddressBookListener(); insertButton.addActionListener(insertAction); displayButton.addActionListener(displayAction); buttonPanel.add(insertButton); buttonPanel.add(displayButton); add(buttonPanel); } public static int getTotalContacts() { return addressList.size(); } //void addContact(Person contact); private JTextField firstName; private JTextField lastName; private JTextField telephone; private JTextField email; private JLabel contacts; private static List<Person> addressList = new ArrayList<Person>(); private class AddressBookListener implements ActionListener { public void actionPerformed(ActionEvent e) { String buttonPressed = e.getActionCommand(); System.out.println(buttonPressed); if (buttonPressed == "Insert") { Person aPerson = new Person(firstName.getText(), lastName.getText(), telephone.getText(), email.getText()); addressList.add(aPerson); } else { for (Person p : addressList) { System.out.println(p); } } } } } My other question is why do I get the error, "int cannot be dereferenced contactsLabel.setText(AddressbookForm.getTotalContacts().toString()); Thanks!

    Read the article

  • operator overloading of stream extraction operator in C++ help

    - by Crystal
    I'm having some trouble overloading my stream extraction operator in C++ for a hw assignment. I'm not really sure why I am getting these compile errors since I thought I was doing it right... Here is my code: Complex.h #ifndef COMPLEX_H #define COMPLEX_H class Complex { //friend ostream &operator<<(ostream &output, const Complex &complexObj) const; public: Complex(double = 0.0, double = 0.0); // constructor Complex operator+(const Complex &) const; // addition Complex operator-(const Complex &) const; // subtraction void print() const; // output private: double real; // real part double imaginary; // imaginary part }; #endif Complex.cpp #include <iostream> #include "Complex.h" using namespace std; // Constructor Complex::Complex(double realPart, double imaginaryPart) : real(realPart), imaginary(imaginaryPart) { } // addition operator Complex Complex::operator+(const Complex &operand2) const { return Complex(real + operand2.real, imaginary + operand2.imaginary); } // subtraction operator Complex Complex::operator-(const Complex &operand2) const { return Complex(real - operand2.real, imaginary - operand2.imaginary); } // Overload << operator ostream &Complex::operator<<(ostream &output, const Complex &complexObj) const { cout << '(' << complexObj.real << ", " << complexObj.imaginary << ')'; return output; // returning output allows chaining } // display a Complex object in the form: (a, b) void Complex::print() const { cout << '(' << real << ", " << imaginary << ')'; } main.cpp #include <iostream> #include "Complex.h" using namespace std; int main() { Complex x; Complex y(4.3, 8.2); Complex z(3.3, 1.1); cout << "x: "; x.print(); cout << "\ny: "; y.print(); cout << "\nz: "; z.print(); x = y + z; cout << "\n\nx = y + z: " << endl; x.print(); cout << " = "; y.print(); cout << " + "; z.print(); x = y - z; cout << "\n\nx = y - z: " << endl; x.print(); cout << " = "; y.print(); cout << " - "; z.print(); cout << endl; } Compile erros: complex.cpp(23) : error C2039: '<<' : is not a member of 'Complex' complex.h(5) : see declaration of 'Complex' complex.cpp(24) : error C2270: '<<' : modifiers not allowed on nonmember functions complex.cpp(25) : error C2248: 'Complex::real' : cannot access private member declared in class 'Complex' complex.h(13) : see declaration of 'Complex::real' complex.h(5) : see declaration of 'Complex' complex.cpp(25) : error C2248: 'Complex::imaginary' : cannot access private member declared in class 'Complex' complex.h(14) : see declaration of 'Complex::imaginary' complex.h(5) : see declaration of 'Complex' Thanks!

    Read the article

  • Does <httpRedirect> in web.config work in a mono setup? Or is it IIS7 specific?

    - by Crystal
    We had some content restructure recently and I'd like to put in some redirect rules into web.config so bookmarks to the old pages can get routed to their new locations/pages. I tried using this approach: <location path="~/product/productA.aspx"> <system.webServer> <httpRedirect enabled="true" destination="~/product/category/productA.aspx" exactDestination="false" childOnly="true" httpResponseStatus="Permanent" /> </system.webServer> </location> But all I'm getting when I go to "http://www.oursite.com/product/productA.aspx" is our http 404 page. Am I doing something wrong, or is the httpRedirect tag in web.config not supported in mono? worked, but not ideal for what we want to achieve. Thank you :)

    Read the article

  • Returning searched results in an array in Java without ArrayList

    - by Crystal
    I started down this path of implementing a simple search in an array for a hw assignment without knowing we could use ArrayList. I realized it had some bugs in it and figured I'd still try to know what my bug is before using ArrayList. I basically have a class where I can add, remove, or search from an array. public class AcmeLoanManager { public void addLoan(Loan h) { int loanId = h.getLoanId(); loanArray[loanId - 1] = h; } public Loan[] getAllLoans() { return loanArray; } public Loan[] findLoans(Person p) { //Loan[] searchedLoanArray = new Loan[10]; // create new array to hold searched values searchedLoanArray = this.getAllLoans(); // fill new array with all values // Looks through only valid array values, and if Person p does not match using Person.equals() // sets that value to null. for (int i = 0; i < searchedLoanArray.length; i++) { if (searchedLoanArray[i] != null) { if (!(searchedLoanArray[i].getClient().equals(p))) { searchedLoanArray[i] = null; } } } return searchedLoanArray; } public void removeLoan(int loanId) { loanArray[loanId - 1] = null; } private Loan[] loanArray = new Loan[10]; private Loan[] searchedLoanArray = new Loan[10]; // separate array to hold values returned from search } When testing this, I thought it worked, but I think I am overwriting my member variable after I do a search. I initially thought that I could create a new Loan[] in the method and return that, but that didn't seem to work. Then I thought I could have two arrays. One that would not change, and the other just for the searched values. But I think I am not understanding something, like shallow vs deep copying???....

    Read the article

  • Passing a comparator syntax help in Java

    - by Crystal
    I've tried this a couple ways, the first is have a class that implements comparator at the bottom of the following code. When I try to pass the comparat in sortListByLastName, I get a constructor not found error and I am not sure why import java.util.*; public class OrganizeThis implements WhoDoneIt { /** Add a person to the organizer @param p A person object */ public void add(Person p) { staff.put(p.getEmail(), p); //System.out.println("Person " + p + "added"); } /** * Remove a Person from the organizer. * * @param email The email of the person to be removed. */ public void remove(String email) { staff.remove(email); } /** * Remove all contacts from the organizer. * */ public void empty() { staff.clear(); } /** * Find the person stored in the organizer with the email address. * Note, each person will have a unique email address. * * @param email The person email address you are looking for. * */ public Person findByEmail(String email) { Person aPerson = staff.get(email); return aPerson; } /** * Find all persons stored in the organizer with the same last name. * Note, there can be multiple persons with the same last name. * * @param lastName The last name of the persons your are looking for. * */ public Person[] find(String lastName) { ArrayList<Person> names = new ArrayList<Person>(); for (Person s : staff.values()) { if (s.getLastName() == lastName) { names.add(s); } } // Convert ArrayList back to Array Person nameArray[] = new Person[names.size()]; names.toArray(nameArray); return nameArray; } /** * Return all the contact from the orgnizer in * an array sorted by last name. * * @return An array of Person objects. * */ public Person[] getSortedListByLastName() { PersonLastNameComparator comp = new PersonLastNameComparator(); Map<String, Person> sorted = new TreeMap<String, Person>(comp); ArrayList<Person> sortedArrayList = new ArrayList<Person>(); for (Person s: sorted.values()) { sortedArrayList.add(s); } Person sortedArray[] = new Person[sortedArrayList.size()]; sortedArrayList.toArray(sortedArray); return sortedArray; } private Map<String, Person> staff = new HashMap<String, Person>(); public static void main(String[] args) { OrganizeThis testObj = new OrganizeThis(); Person person1 = new Person("J", "W", "111-222-3333", "[email protected]"); Person person2 = new Person("K", "W", "345-678-9999", "[email protected]"); Person person3 = new Person("Phoebe", "Wang", "322-111-3333", "[email protected]"); Person person4 = new Person("Nermal", "Johnson", "322-342-5555", "[email protected]"); Person person5 = new Person("Apple", "Banana", "123-456-1111", "[email protected]"); testObj.add(person1); testObj.add(person2); testObj.add(person3); testObj.add(person4); testObj.add(person5); System.out.println(testObj.findByEmail("[email protected]")); System.out.println("------------" + '\n'); Person a[] = testObj.find("W"); for (Person p : a) System.out.println(p); System.out.println("------------" + '\n'); a = testObj.find("W"); for (Person p : a) System.out.println(p); System.out.println("SORTED" + '\n'); a = testObj.getSortedListByLastName(); for (Person b : a) { System.out.println(b); } System.out.println(testObj.getAuthor()); } } class PersonLastNameComparator implements Comparator<Person> { public int compare(Person a, Person b) { return a.getLastName().compareTo(b.getLastName()); } } And then when I tried doing it by creating an anonymous inner class, I also get a constructor TreeMap cannot find symbol error. Any thoughts? inner class method: public Person[] getSortedListByLastName() { //PersonLastNameComparator comp = new PersonLastNameComparator(); Map<String, Person> sorted = new TreeMap<String, Person>(new Comparator<Person>() { public int compare(Person a, Person b) { return a.getLastName().compareTo(b.getLastName()); } }); ArrayList<Person> sortedArrayList = new ArrayList<Person>(); for (Person s: sorted.values()) { sortedArrayList.add(s); } Person sortedArray[] = new Person[sortedArrayList.size()]; sortedArrayList.toArray(sortedArray); return sortedArray; }

    Read the article

  • JUnit testing, exception in threa main

    - by Crystal
    I am new to JUnit and am trying to follow my prof's example. I have a Person class and a PersonTest class. When I try to compile PersonTest.java, I get the following error: Exception in thread "main" java.lang.NoSuchMethodError: main I am not really sure why since I followed his example. Person.java public class Person implements Comparable { String firstName; String lastName; String telephone; String email; public Person() { firstName = ""; lastName = ""; telephone = ""; email = ""; } public Person(String firstName) { this.firstName = firstName; } public Person(String firstName, String lastName, String telephone, String email) { this.firstName = firstName; this.lastName = lastName; this.telephone = telephone; this.email = email; } public String getFirstName() { return firstName; } public void setFirstName(String firstName) { this.firstName = firstName; } public String getLastName() { return lastName; } public void setLastName(String lastName) { this.lastName = lastName; } public String getTelephone() { return telephone; } public void setTelephone(String telephone) { this.telephone = telephone; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public int compareTo(Object o) { String s1 = this.lastName + this.firstName; String s2 = ((Person) o).lastName + ((Person) o).firstName; return s1.compareTo(s2); } public boolean equals(Object otherObject) { // a quick test to see if the objects are identical if (this == otherObject) { return true; } // must return false if the explicit parameter is null if (otherObject == null) { return false; } if (!(otherObject instanceof Person)) { return false; } Person other = (Person) otherObject; return firstName.equals(other.firstName) && lastName.equals(other.lastName) && telephone.equals(other.telephone) && email.equals(other.email); } public int hashCode() { return this.email.toLowerCase().hashCode(); } public String toString() { return getClass().getName() + "[firstName = " + firstName + '\n' + "lastName = " + lastName + '\n' + "telephone = " + telephone + '\n' + "email = " + email + "]"; } } PersonTest.java import org.junit.Test; // JDK 5.0 annotation support import static org.junit.Assert.assertTrue; // Using JDK 5.0 static imports import static org.junit.Assert.assertFalse; // Using JDK 5.0 static imports import junit.framework.JUnit4TestAdapter; // Need this to be compatible with old test driver public class PersonTest { /** A test to verify equals method. */ @Test public void checkEquals() { Person p1 = new Person("jj", "aa", "[email protected]", "1112223333"); assertTrue(p1.equals(p1)); // first check in equals method assertFalse(p1.equals(null)); // second check in equals method assertFalse(p1.equals(new Object())); // third chk in equals method Person p2 = new Person("jj", "aa", "[email protected]", "1112223333"); assertTrue(p1.equals(p2)); // check for deep comparison p1 = new Person("jj", "aa", "[email protected]", "1112223333"); p2 = new Person("kk", "aa", "[email protected]", "1112223333"); assertFalse(p1.equals(p2)); // check for deep comkparison } }

    Read the article

  • Constructor ambiguous quesiton

    - by Crystal
    I'm trying to create a simple date class, but I get an error on my main file that says, "call of overloaded Date() is ambiguous." I'm not sure why since I thought as long as I had different parameters for my constructor, I was ok. Here is my code: header file: #ifndef DATE_H #define DATE_H using std::string; class Date { public: static const int monthsPerYear = 12; // num of months in a yr Date(int = 1, int = 1, int = 1900); // default constructor Date(); // uses system time to create object void print() const; // print date in month/day/year format ~Date(); // provided to confirm destruction order string getMonth(int month) const; // gets month in text format private: int month; // 1 - 12 int day; // 1 - 31 int year; // any year int checkDay(int) const; }; #endif .cpp file #include <iostream> #include <iomanip> #include <string> #include <ctime> #include "Date.h" using namespace std; Date::Date() { time_t seconds = time(NULL); struct tm* t = localtime(&seconds); month = t->tm_mon; day = t->tm_mday; year = t->tm_year; } Date::Date(int mn, int dy, int yr) { if (mn > 0 && mn <= monthsPerYear) month = mn; else { month = 1; // invalid month set to 1 cout << "Invalid month (" << mn << ") set to 1.\n"; } year = yr; // could validate yr day = checkDay(dy); // validate the day // output Date object to show when its constructor is called cout << "Date object constructor for date "; print(); cout << endl; } void Date::print() const { string str; cout << month << '/' << day << '/' << year << '\n'; // new code for HW2 cout << setfill('0') << setw(3) << day; // prints in ddd cout << " " << year << '\n'; // yyyy format str = getMonth(month); // prints in month (full word), day, year cout << str << " " << day << ", " << year << '\n'; } and my main.cpp #include <iostream> #include "Date.h" using std::cout; int main() { Date date1(4, 30, 1980); date1.print(); cout << '\n'; Date date2; date2.print(); }

    Read the article

  • Making your class an event source in Java

    - by Crystal
    I'm making a custom button in Java that has two states, mousePressed, and mouseReleased. At the same time, if I wanted to reuse this button, so that other event listeners can register with it, are these the appropriate steps I should do: override addActionListener(ActionListener action) override removeActionListener(ActionListener action) have a private variable like List <ActionListener> list = new List <ActionListener>() to keep track of when events get added and some sort of function with for loop to run all the actions: public void runListeners() { for (ActionListener al : list) { al.actionPerfomed; } } I'm not really sure if this is the way you can do it or if there are other things I am missing. Like does my custom class have to be implements ActionListener? Thanks.

    Read the article

  • Unable to update the snapshot view in clearcase on linux

    - by crystal
    Hi I am trying to create a new snapshot view on my machine and i am using the following procedure: creating the view using ct mkview -snapshot -tag testview -vws /home/store/testview.vws /home/view/testview here the view gets created but fails to register which i register using the ct update on this /home/view/testview location tried to change the configspec using ct edcs & but got error "cleartool: Error: Cannot get view info for current view: not a ClearCase object." explicitly modifying the config_spec using vi editor, and the updating the view ends up creating a log...but no files are copied :( Can someone please direct me as to where i am going wrong?

    Read the article

  • Help with Hashmaps in Java

    - by Crystal
    I'm not sure how I use get() to get my information. Looking at my book, they pass the key to get(). I thought that get() returns the object associated with that key looking at the documentation. But I must be doing something wrong here.... Any thoughts? import java.util.*; public class OrganizeThis { /** Add a person to the organizer @param p A person object */ public void add(Person p) { staff.put(p, p.getEmail()); System.out.println("Person " + p + "added"); } /** * Find the person stored in the organizer with the email address. * Note, each person will have a unique email address. * * @param email The person email address you are looking for. * */ public Person findByEmail(String email) { Person aPerson = staff.get(email); return aPerson; } private Map<Person, String> staff = new HashMap<Person, String>(); public static void main(String[] args) { OrganizeThis testObj = new OrganizeThis(); Person person1 = new Person("J", "W", "111-222-3333", "[email protected]"); testObj.add(person1); System.out.println(testObj.findByEmail("[email protected]")); } }

    Read the article

  • Calling delegate methods and calling selectors

    - by Crystal
    I'm new to the concept of delegates and selectors when used with notifications. So my first question is, 1) Let's say you have a button that has a delegate that implements some doWork method. If you want the same functionality that's in the method, is it 'ok' to just call that method? I didn't know if that was considered good coding practices and/or if you should do that, or do something different in getting that type of functionality. Like if that is ok architecture? 2) Similarly, with NSNotificationCenter, I see some code that posts a notification. Then there's a HandleSegmentedControl:(NSNotification *)notification method. If I want to manually have that functionality, but without pressing the segment control, is it 'ok' to just take that functionality out of that method and put it in a new method so it would look like this: Original: - (void)HandleSegmentedControl:(NSNotification *)notification { NSDictionary *dict = [userInfo notification]; // do stuff with the dictionary } New: - (void)HandleSegmentedControl:(NSNotification *)notification { NSDictionary *dict = [userInfo notification]; [self newMethod:dict]; } - (void)newMethod:(NSDictionary *)dict { // do stuff with the dictionary } - (void)myOtherMethodThatNeedsTheSameFunctionality { NSDictionary *dict = // create some dictionary [self newMethod:dict]; } Sorry if these are basic questions. I'm not sure what the best practices are for things like this and wanted to start the right way. Thanks.

    Read the article

  • Calculating volume for sphere in c++

    - by Crystal
    This is probably an easy one, but is the right way to calculate volume for a sphere in c++. My getArea() seems to be right, but when I call getVolume() it doesn't output the right amount. With a sphere of radius = 1, it gives me the answer of pi, which is incorrect: double Sphere::getArea() const { return 4 * Shape::pi * pow(getZ(), 2); } double Sphere::getVolume() const { return (4 / 3) * Shape::pi * pow(getZ(), 3); }

    Read the article

  • Enumeration classes in Java

    - by Crystal
    I have one class that declares an enumeration type as: public enum HOME_LOAN_TERMS {FIFTEEN_YEAR, THIRTY_YEAR}; Is this type usable in another class? I'm basically trying to complete a homework assignment where we have two types of loans, and one loanManager class. When I try to use the HOME_LOAN_TERMS.THIRTY_YEAR in my loanManager class that does not extend or implement the loan class, I get an error saying it 'cannot find symbol HOME_LOAN_TERMS.' So I did not know if my loanManager class needed to implement the two different loan classes. Thanks.

    Read the article

  • Help with method logic in Java, hw

    - by Crystal
    I have a Loan class that in its printPayment method, it prints the amortization table of a loan for a hw assignment. We are also to implement a print first payment method, and a print last payment method. Since my calculation is done in the printPayment method, I didn't know how I could get the value in the first or last iteration of the loop and print that amount out. One way I can think of is to write a new method that might return that value, but I wasn't sure if there was a better way. Here is my code: public abstract class Loan { public void setClient(Person client) { this.client = client; } public Person getClient() { return client; } public void setLoanId() { loanId = nextId; nextId++; } public int getLoanId() { return loanId; } public void setInterestRate(double interestRate) { this.interestRate = interestRate; } public double getInterestRate() { return interestRate; } public void setLoanLength(int loanLength) { this.loanLength = loanLength; } public int getLoanLength() { return loanLength; } public void setLoanAmount(double loanAmount) { this.loanAmount = loanAmount; } public double getLoanAmount() { return loanAmount; } public void printPayments() { double monthlyInterest; double monthlyPrincipalPaid; double newPrincipal; int paymentNumber = 1; double monthlyInterestRate = interestRate / 1200; double monthlyPayment = loanAmount * (monthlyInterestRate) / (1 - Math.pow((1 + monthlyInterestRate),( -1 * loanLength))); System.out.println("Payment Number | Interest | Principal | Loan Balance"); // amortization table while (loanAmount >= 0) { monthlyInterest = loanAmount * monthlyInterestRate; monthlyPrincipalPaid = monthlyPayment - monthlyInterest; newPrincipal = loanAmount - monthlyPrincipalPaid; loanAmount = newPrincipal; System.out.printf("%d, %.2f, %.2f, %.2f", paymentNumber++, monthlyInterest, monthlyPrincipalPaid, loanAmount); } } /* //method to print first payment public double getFirstPayment() { } method to print last payment public double getLastPayment() { }*/ private Person client; private int loanId; private double interestRate; private int loanLength; private double loanAmount; private static int nextId = 1; } Thanks!

    Read the article

  • Getter/Setter (composition, Java, HW)

    - by Crystal
    I have one class called Person that basically looks like: public class Person { String firstName; String lastName; String telephone; String email; public Person() { firstName = ""; lastName = ""; telephone = ""; email = ""; } public Person(String firstName, String lastName, String telephone, String email) { this.firstName = firstName; this.lastName = lastName; this.telephone = telephone; this.email = email; } public String getFirstName() { return firstName; } public void setFirstName(String firstName) { this.firstName = firstName; } .... Using that class, I setup an abstract class called Loan that looks like: public abstract class Loan { public void setClient(Person client) { this.client = client; } public Person getClient() { return client; } public void setLoanId(int nextId) { loanId = nextId; nextId++; } public int getLoanId() { return loanId; } public void setInterestRate(double interestRate) { this.interestRate = interestRate; } public double getInterestRate() { return interestRate; } public void setLoanLength(int loanLength) { this.loanLength = loanLength; } public int getLoanLength() { return loanLength; } public void setLoanAmount(double loanAmount) { this.loanAmount = loanAmount; } public double getLoanAmount(double loanAmount) { return loanAmount; } private Person client; private int loanId; private double interestRate; private int loanLength; private double loanAmount; private static int nextId = 1; } I have to extend the Loan class with CarLoan and it looks like: public class CarLoan extends Loan { public CarLoan(Person client, double vehiclePrice, double downPayment, double salesTax, double interestRate, CAR_LOAN_TERMS length) { super.setClient(client); super.setInterestRate(interestRate); this.client = client; this.vehiclePrice = vehiclePrice; this.downPayment = downPayment; this.salesTax = salesTax; this.length = length; } public void setVehiclePrice(double vehiclePrice) { this.vehiclePrice = vehiclePrice; } public double getVehiclePrice() { return vehiclePrice; } public void setDownPayment(double downPayment) { this.downPayment = downPayment; } public double getDownPayment() { return downPayment; } public void setSalesTax(double salesTax) { this.salesTax = salesTax; } public double getSalesTax() { return salesTax; } public String toString() { return getClass().getName() + "[vehiclePrice = " + vehiclePrice + '\n' + "downPayment = " + downPayment + '\n' + "salesTax = " + salesTax + "]"; } public enum CAR_LOAN_TERMS {TWO_YEAR, THREE_YEAR, SIX_YEAR}; private double vehiclePrice; private double downPayment; private double salesTax; Few questions. (a) Is what I did in the Loan class to setClient correct given what I have in the Person class? (e.g.this.client = client) (b) Can I call super twice in a method? I have to set two attributes from the Loan class from the constructor in the CarLoan class and I thought that would be a way to do it. (c) Do you have to set attributes for enumeration types differently in a constructor or getter/setter methods? I get an error for (this.length = length) in my CarLoan class and I was unsure of how enumeration values should be set. Thanks!

    Read the article

  • Unresolved external symbol error in c++

    - by Crystal
    I am trying to do a simple hw problem involving namespace, static data members and functions. I am getting an unresolved external symbol error Error 1 error LNK2001: unresolved external symbol "private: static double JWong::SavingsAccount::annualInterestRate" (?annualInterestRate@SavingsAccount@JWong@@0NA) SavingsAccount.obj SavingsAccount And I don't see why I am getting this error. Maybe I don't know something about static variables compared to regular data members that is causing this error. Here is my code: SavingsAccount.h file #ifndef JWONG_SAVINGSACCOUNT_H #define JWONG_SAVINGSACCOUNT_H namespace JWong { class SavingsAccount { public: // default constructor SavingsAccount(); // constructor SavingsAccount(double savingsBalance); double getSavingsBalance(); void setSavingsBalance(double savingsBalance); double calculateMonthlyInterest(); // static functions static void modifyInterestRate(double newInterestRate); static double getAnnualInterestRest(); private: double savingsBalance; // static members static double annualInterestRate; }; } #endif SavingsAccount.cpp file #include <iostream> #include "SavingsAccount.h" // default constructor, set savingsBalance to 0 JWong::SavingsAccount::SavingsAccount() : savingsBalance(0) {} // constructor JWong::SavingsAccount::SavingsAccount(double savingsBalance) : savingsBalance(savingsBalance) {} double JWong::SavingsAccount::getSavingsBalance() { return savingsBalance; } void JWong::SavingsAccount::setSavingsBalance(double savingsBalance) { this->savingsBalance = savingsBalance; } // returns monthly interest and sets savingsBalance to new amount double JWong::SavingsAccount::calculateMonthlyInterest() { double monthlyInterest = savingsBalance * SavingsAccount::annualInterestRate / 12; setSavingsBalance(savingsBalance + monthlyInterest); return monthlyInterest; } void JWong::SavingsAccount::modifyInterestRate(double newInterestRate) { SavingsAccount::annualInterestRate = newInterestRate; } double JWong::SavingsAccount::getAnnualInterestRest() { return SavingsAccount::annualInterestRate; }

    Read the article

  • Creating ActionEvent object for CustomButton in Java

    - by Crystal
    For a hw assignment, we were supposed to create a custom button to get familiar with swing and responding to events. We were also to make this button an event source which confuses me. I have an ArrayList to keep track of listeners that would register to listen to my CustomButton. What I am getting confused on is how to notify the listeners. My teacher hinted at having a notify and overriding actionPerformed which I tried doing, but then I wasn't sure how to create an ActionEvent object looking at the constructor documentation. The source, id, string all confuses me. Any help would be appreciated. Thanks! code: import java.awt.*; import java.awt.event.*; import javax.swing.*; import java.util.List; import java.util.ArrayList; public class CustomButton { public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { CustomButtonFrame frame = new CustomButtonFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setVisible(true); } }); } public void addActionListener(ActionListener al) { listenerList.add(al); } public void removeActionListener(ActionListener al) { listenerList.remove(al); } public void actionPerformed(ActionEvent e) { System.out.println("Button Clicked!"); } private void notifyListeners() { ActionEvent event = new ActionEvent(CONFUSED HERE!!!!; for (ActionListener action : listenerList) { action.actionPerfomed(event); } } List<ActionListener> listenerList = new ArrayList<ActionListener>(); } class CustomButtonFrame extends JFrame { // constructor for CustomButtonFrame public CustomButtonFrame() { setTitle("Custom Button"); CustomButtonSetup buttonSetup = new CustomButtonSetup(); this.add(buttonSetup); this.pack(); } } class CustomButtonSetup extends JComponent { public CustomButtonSetup() { ButtonAction buttonClicked = new ButtonAction(); this.addMouseListener(buttonClicked); } // because frame includes borders and insets, use this method public Dimension getPreferredSize() { return new Dimension(200, 200); } public void paintComponent(Graphics g) { Graphics2D g2 = (Graphics2D) g; // first triangle coords int x[] = new int[TRIANGLE_SIDES]; int y[] = new int[TRIANGLE_SIDES]; x[0] = 0; y[0] = 0; x[1] = 200; y[1] = 0; x[2] = 0; y[2] = 200; Polygon firstTriangle = new Polygon(x, y, TRIANGLE_SIDES); // second triangle coords x[0] = 0; y[0] = 200; x[1] = 200; y[1] = 200; x[2] = 200; y[2] = 0; Polygon secondTriangle = new Polygon(x, y, TRIANGLE_SIDES); g2.drawPolygon(firstTriangle); g2.setColor(firstColor); g2.fillPolygon(firstTriangle); g2.drawPolygon(secondTriangle); g2.setColor(secondColor); g2.fillPolygon(secondTriangle); // draw rectangle 10 pixels off border int s1[] = new int[RECT_SIDES]; int s2[] = new int[RECT_SIDES]; s1[0] = 5; s2[0] = 5; s1[1] = 195; s2[1] = 5; s1[2] = 195; s2[2] = 195; s1[3] = 5; s2[3] = 195; Polygon rectangle = new Polygon(s1, s2, RECT_SIDES); g2.drawPolygon(rectangle); g2.setColor(thirdColor); g2.fillPolygon(rectangle); } private class ButtonAction implements MouseListener { public void mousePressed(MouseEvent e) { System.out.println("Click!"); firstColor = Color.GRAY; secondColor = Color.WHITE; repaint(); } public void mouseReleased(MouseEvent e) { System.out.println("Released!"); firstColor = Color.WHITE; secondColor = Color.GRAY; repaint(); } public void mouseEntered(MouseEvent e) {} public void mouseExited(MouseEvent e) {} public void mouseClicked(MouseEvent e) {} } public static final int TRIANGLE_SIDES = 3; public static final int RECT_SIDES = 4; private Color firstColor = Color.WHITE; private Color secondColor = Color.DARK_GRAY; private Color thirdColor = Color.LIGHT_GRAY; }

    Read the article

  • static const double in c++

    - by Crystal
    Is this the proper way to use a static const variable? In my top level class (Shape) #ifndef SHAPE_H #define SHAPE_H class Shape { public: static const double pi; private: double originX; double originY; }; const double Shape::pi = 3.14159265; #endif And then later in a class that extends Shape, I use Shape::pi. I get a linker error. I moved the const double Shape::pi = 3.14... to the Shape.cpp file and my program then compiles. Why does that happen? thanks.

    Read the article

  • Passing ActionListeners in Java, pack()

    - by Crystal
    Two questions. First question is I'm trying to create a simple form that when you press a button, it adds a Person object to the ArrayList. However, since I am not used to GUIs, I tried creating one and am first just trying to get the user input from the JTextField, create an ActionListener object of the appropriate type, so once that works, then I can pass in all the JTextField inputs to create my Person object. Unfortunately, I am not getting any data when I type in something to the firstName JTextField and was wondering if someone could look at my code below. import java.awt.*; import java.awt.event.*; import javax.swing.*; import java.util.List; import java.util.ArrayList; public class AddressBook { public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { AddressBookFrame frame = new AddressBookFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JMenuBar menuBar = new JMenuBar(); frame.setJMenuBar(menuBar); JMenu fileMenu = new JMenu("File"); JMenuItem openItem = new JMenuItem("Open"); JMenuItem saveItem = new JMenuItem("Save"); JMenuItem saveAsItem = new JMenuItem("Save As"); JMenuItem printItem = new JMenuItem("Print"); JMenuItem exitItem = new JMenuItem("Exit"); fileMenu.add(openItem); fileMenu.add(saveItem); fileMenu.add(saveAsItem); fileMenu.add(printItem); fileMenu.add(exitItem); menuBar.add(fileMenu); JMenu editMenu = new JMenu("Edit"); JMenuItem newItem = new JMenuItem("New"); JMenuItem editItem = new JMenuItem("Edit"); JMenuItem deleteItem = new JMenuItem("Delete"); JMenuItem findItem = new JMenuItem("Find"); JMenuItem firstItem = new JMenuItem("First"); JMenuItem previousItem = new JMenuItem("Previous"); JMenuItem nextItem = new JMenuItem("Next"); JMenuItem lastItem = new JMenuItem("Last"); editMenu.add(newItem); editMenu.add(editItem); editMenu.add(deleteItem); editMenu.add(findItem); editMenu.add(firstItem); editMenu.add(previousItem); editMenu.add(nextItem); editMenu.add(lastItem); menuBar.add(editMenu); JMenu helpMenu = new JMenu("Help"); JMenuItem documentationItem = new JMenuItem("Documentation"); JMenuItem aboutItem = new JMenuItem("About"); helpMenu.add(documentationItem); helpMenu.add(aboutItem); menuBar.add(helpMenu); frame.setVisible(true); } }); } } class AddressBookFrame extends JFrame { public AddressBookFrame() { setLayout(new BorderLayout()); setTitle("Address Book"); setSize(DEFAULT_WIDTH, DEFAULT_HEIGHT); AddressBookToolBar toolBar = new AddressBookToolBar(); add(toolBar, BorderLayout.NORTH); AddressBookStatusBar aStatusBar = new AddressBookStatusBar("5"); add(aStatusBar, BorderLayout.SOUTH); AddressBookForm form = new AddressBookForm(); add(form, BorderLayout.CENTER); } public static final int DEFAULT_WIDTH = 500; public static final int DEFAULT_HEIGHT = 500; } /* Create toolbar buttons and add buttons to toolbar */ class AddressBookToolBar extends JPanel { public AddressBookToolBar() { setLayout(new FlowLayout(FlowLayout.LEFT)); JToolBar bar = new JToolBar(); JButton newButton = new JButton("New"); JButton editButton = new JButton("Edit"); JButton deleteButton = new JButton("Delete"); JButton findButton = new JButton("Find"); JButton firstButton = new JButton("First"); JButton previousButton = new JButton("Previous"); JButton nextButton = new JButton("Next"); JButton lastButton = new JButton("Last"); bar.add(newButton); bar.add(editButton); bar.add(deleteButton); bar.add(findButton); bar.add(firstButton); bar.add(previousButton); bar.add(nextButton); bar.add(lastButton); add(bar); } } /* Creates the status bar string */ class AddressBookStatusBar extends JPanel { public AddressBookStatusBar(String statusBarString) { setLayout(new FlowLayout(FlowLayout.LEFT)); this.statusBarString = new JLabel("Total number of people: " + statusBarString); add(this.statusBarString); } private JLabel statusBarString; private int totalContacts; } class AddressBookForm extends JPanel { public AddressBookForm() { this.setLayout(new GridLayout(2, 1)); JPanel formPanel = new JPanel(); formPanel.setLayout(new GridLayout(4, 2)); JTextField firstName = new JTextField(20); JTextField lastName = new JTextField(20); JTextField telephone = new JTextField(20); JTextField email = new JTextField(20); JLabel firstNameLabel = new JLabel("First Name: ", JLabel.LEFT); formPanel.add(firstNameLabel); formPanel.add(firstName); JLabel lastNameLabel = new JLabel("Last Name: ", JLabel.LEFT); formPanel.add(lastNameLabel); formPanel.add(lastName); JLabel telephoneLabel = new JLabel("Telephone: ", JLabel.LEFT); formPanel.add(telephoneLabel); formPanel.add(telephone); JLabel emailLabel = new JLabel("Email: ", JLabel.LEFT); formPanel.add(emailLabel); formPanel.add(email); add(formPanel); JPanel buttonPanel = new JPanel(); JButton insertButton = new JButton("Insert"); JButton displayButton = new JButton("Display"); // create button actions AddressBookManager insertAction = new AddressBookManager(firstName.getText()); insertButton.addActionListener(insertAction); buttonPanel.add(insertButton); buttonPanel.add(displayButton); add(buttonPanel); } private List<Person> addressList = new ArrayList<Person>(); private class AddressBookManager implements ActionListener { public AddressBookManager(String text) { // addressList.add( setName(text); System.out.println("Test" + text); } public void actionPerformed(ActionEvent e) { System.out.println("Hello" + name); } public void setName(String name) { this.name = name; } private String name; } } Second question is, how do I make my form not take up the whole center space. I don't like the stretch look and was hoping the JTextFields could be just one line long, not a big box. Same thing with the buttons. Any thoughts? Thanks.

    Read the article

< Previous Page | 11 12 13 14 15 16 17 18 19 20 21  | Next Page >