Help With Program Please

Hi everybody,
I designed a calculator, and I need help with the rest of the scientific actions. I know I need to use the different Math methods, but what exactly? Also, it needs to work as an applet and application, and in the applet, the buttons don't appear in order, how can I fix that?
I will really appreciate your help with this program, I need to finish it ASAP. Please e-mail me at [email protected].
Below is the code for the calcualtor.
Thanks in advance,
-Maria
// calculator
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.border.*;
public class calculator extends JApplet implements
ActionListener
private JButton one, two, three, four, five, six, seven,
eight, nine, zero, dec, eq, plus, minus, mult, div, clear,
mem, mrc, sin, cos, tan, asin, acos, atan, x2, sqrt, exp, pi, percent;
private JLabel output, blank;
private Container container;
private String operation;
private double number1, number2, result;
private boolean clear = false;
//GUI
public void init()
container = getContentPane();
//Title
//super("Calculator");
JPanel container = new JPanel();     
container.setLayout( new FlowLayout( FlowLayout.CENTER
output = new JLabel("");     
output.setBorder(new MatteBorder(2,2,2,2,Color.gray));
output.setPreferredSize(new Dimension(1,26));     
getContentPane().setBackground(Color.white);     
getContentPane().add( "North",output );     
getContentPane().add( "Center",container );
//blank
blank = new JLabel( " " );
container.add( blank );
//clear
clear = new JButton( "CE" );
clear.addActionListener(this);
container.add( clear );
//seven
seven = new JButton( "7" );
seven.addActionListener(this);
container.add( seven );
//eight
eight = new JButton( "8" );
eight.addActionListener(this);
container.add( eight );
//nine
nine = new JButton( "9" );
nine.addActionListener(this);
container.add( nine );
//div
div = new JButton( "/" );
div.addActionListener(this);
container.add( div );
//four
four = new JButton( "4" );
four.addActionListener(this);
container.add( four );
//five
five = new JButton( "5" );
five.addActionListener(this);
container.add( five );
//six
six = new JButton( "6" );
six.addActionListener(this);
container.add( six );
//mult
mult = new JButton( "*" );
mult.addActionListener(this);
container.add( mult );
//one
one = new JButton( "1" );
one.addActionListener(this);
container.add( one );
//two
two = new JButton( "2" );
two.addActionListener(this);
container.add( two );
//three
three = new JButton( "3" );
three.addActionListener(this);
container.add( three );
//minus
minus = new JButton( "-" );
minus.addActionListener(this);
container.add( minus );
//zero
zero = new JButton( "0" );
zero.addActionListener(this);
container.add( zero );
//dec
dec = new JButton( "." );
dec.addActionListener(this);
container.add( dec );
//plus
plus = new JButton( "+" );
plus.addActionListener(this);
container.add( plus );
//mem
mem = new JButton( "MEM" );
mem.addActionListener(this);
container.add( mem );
//mrc
mrc = new JButton( "MRC" );
mrc.addActionListener(this);
container.add( mrc );
//sin
sin = new JButton( "SIN" );
sin.addActionListener(this);
container.add( sin );
//cos
cos = new JButton( "COS" );
cos.addActionListener(this);
container.add( cos );
//tan
tan = new JButton( "TAN" );
tan.addActionListener(this);
container.add( tan );
//asin
asin = new JButton( "ASIN" );
asin.addActionListener(this);
container.add( asin );
//acos
acos = new JButton( "ACOS" );
cos.addActionListener(this);
container.add( cos );
//atan
atan = new JButton( "ATAN" );
atan.addActionListener(this);
container.add( atan );
//x2
x2 = new JButton( "X2" );
x2.addActionListener(this);
container.add( x2 );
//sqrt
sqrt = new JButton( "SQRT" );
sqrt.addActionListener(this);
container.add( sqrt );
//exp
exp = new JButton( "EXP" );
exp.addActionListener(this);
container.add( exp );
//pi
pi = new JButton( "PI" );
pi.addActionListener(this);
container.add( pi );
//percent
percent = new JButton( "%" );
percent.addActionListener(this);
container.add( percent );
//eq
eq = new JButton( "=" );
eq.addActionListener(this);
container.add( eq );
//Set size and visible
setSize( 190, 285 );
setVisible( true );
public static void main(String args[]){
//execute applet as application
     //applet's window
     JFrame applicationWindow = new JFrame("calculator");
applicationWindow.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
     //applet instance
     calculator appletObject = new calculator();
     //init and start methods
     appletObject.init();
     appletObject.start();
} // end main
public void actionPerformed(ActionEvent ae)
JButton but = ( JButton )ae.getSource();     
//dec action
if( but.getText() == "." )
//if dec is pressed, first check to make shure there
is not already a decimal
String temp = output.getText();
if( temp.indexOf( '.' ) == -1 )
output.setText( output.getText() + but.getText() );
//clear action
else if( but.getText() == "CE" )
output.setText( "" );
operation = "";
number1 = 0.0;
number2 = 0.0;
//plus action
else if( but.getText() == "+" )
operation = "+";
number1 = Double.parseDouble( output.getText() );
clear = true;
//output.setText( "" );
//minus action
else if( but.getText() == "-" )
operation = "-";
number1 = Double.parseDouble( output.getText() );
clear = true;
//output.setText( "" );
//mult action
else if( but.getText() == "*" )
operation = "*";
number1 = Double.parseDouble( output.getText() );
clear = true;
//output.setText( "" );
//div action
else if( but.getText() == "/" )
operation = "/";
number1 = Double.parseDouble( output.getText() );
clear = true;
//output.setText( "" );
//eq action
else if( but.getText() == "=" )
number2 = Double.parseDouble( output.getText() );
if( operation == "+" )
result = number1 + number2;
else if( operation == "-" )
result = number1 - number2;
else if( operation == "*" )
result = number1 * number2;
else if( operation == "/" )
result = number1 / number2;
//output result
output.setText( String.valueOf( result ) );
clear = true;
operation = "";
//default action
else
if( clear == true )
output.setText( "" );
clear = false;
output.setText( output.getText() + but.getText() );

Multiple post:
http://forum.java.sun.com/thread.jsp?forum=31&thread=474370&tstart=0&trange=30

Similar Messages

  • Need help with Program Please!

    // Name: John Weir 02/03/2006
    Please read the comments as they will explain what help I need.
    All help greatly appreciated! Am new to working with GUI.
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.util.*;
    public class FeverDiagnosis extends JFrame
         // diagnoisis constants
         private final String MENIGITIS = "menigitis";
         private final String DIGESTIVE_TRACT_INFECTION = "digestive tract infection";
         private final String PNEUMONIA_OR_AIRWAYS_INFECTION  ="pneumonia or airways infection";
         private final String VIRAL_INFECTION = "viral infection";
         private final String THROAT_INFECTION = "throat infection";
         private final String KIDNEY_INFECTION = "kidney infection";
         private final String URINARY_INFECTION = "urinary tract infection";
         private final String SUNSTROKE_OR_HEAT_EXHAUSTION = "sunstroke or heat exhaustion";
         // symptom constants
         private final String FEVER = "fever";
         private final String COUGHING = "coughing";
         private final String HEADACHE = "headache";
         private final String BREATHING_WITH_DIFFICULTY = "shortness of breath, wheezing, or coughing up phlegm";
         private final String ACHING_BONES_JOINTS = "aching bones or joints";
         private final String RASH = "rash";
         private final String SORE_THROAT = "sore throat";
         private final String BACK_PAIN_AND_CHILLS_AND_FEVER = "back pain just above the waist with chills and fever";
         private final String URINARY_DIFFICULTY = "pain urinating or are urinating more often";
         private final String TOO_MUCH_SUN = "sun overexposure due to spending the day in the sun or in hot conditions";
         public final String VOMITING_OR_DIARRHEA = "vomitting spell or diarrhea";
         private final String MENIGITIS_POSSIBILITIES =
                          "pain when bending your head forward,\n"
                        + "    nausea or vomiting, eye ache from \n"
                        + "    bright lights, drowsiness or confusion";
         // GUI varibles
         private JTextArea textArea;
         private JFrame theFrame;
         private JLabel stuff2;
         private JButton b1;
         private JButton b2;
         // instance variable
         private String symptoms = "";
         private Scanner cin = new Scanner (System.in);
         char response;
         String input;
         public FeverDiagnosis()
              JFrame.setDefaultLookAndFeelDecorated(true);
              JFrame theFrame = new JFrame("John Weir");
              theFrame.setSize(650, 400);
              Dimension frameSize = theFrame.getSize();
              Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
              theFrame.setLocation((screenSize.width - frameSize.width)/2,(screenSize.height - frameSize.height)/2);
              theFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              Container contentPane = theFrame.getContentPane();
              theFrame.getContentPane().setLayout(new FlowLayout());
              JLabel stuff2 = new JLabel("Test");
              textArea = new JTextArea(12,50);
              textArea.setEditable(true);
              textArea.setBackground(Color.black);
              textArea.setForeground(Color.green);
              textArea.setFont(new Font("Serif", Font.ITALIC, 16));
              textArea.setLineWrap(true);
              textArea.setWrapStyleWord(true);
              b1 = new JButton("Yes");
              b2 = new JButton("No");
              contentPane.add(stuff2);
              contentPane.add(new JScrollPane(textArea));
              contentPane.add(b1);
              b1.setEnabled(true);
              contentPane.add(b2);
              b2.setEnabled(true);
              ActionListener l = new ActionListener()
                public void actionPerformed(ActionEvent e)
                   if((e.getSource() == b1))
                   //   HELP NEEDED
                   //   NEED BUTTON TO PASS
                   //   STRING VALUE "Y" TO
                   //   METHOD: have(String s)
                   input.equals("y");
                   else
                   if((e.getSource() == b2))
              b1.addActionListener(l);
              b2.addActionListener(l);
              theFrame.setVisible(true);
              theRules();
    public void theRules()
         displayNote();
         if (! have(FEVER) )
              displayUnsure();
         else
         if(are(COUGHING))
              if( are(BREATHING_WITH_DIFFICULTY))
                   addSymptom( PNEUMONIA_OR_AIRWAYS_INFECTION );
                   displayDiagnosis(PNEUMONIA_OR_AIRWAYS_INFECTION);
              }else
              if(have(HEADACHE))
                   addSymptom( VIRAL_INFECTION );
                   displayDiagnosis(VIRAL_INFECTION);
              }else
              if(have(ACHING_BONES_JOINTS))
                   addSymptom( VIRAL_INFECTION );
                   displayDiagnosis(VIRAL_INFECTION);
              }else
              if(have(RASH))
                   displayUnsure();
              }else
              if(have(SORE_THROAT))
                   addSymptom( THROAT_INFECTION );
                   displayDiagnosis(THROAT_INFECTION);
              }else
              if(have(BACK_PAIN_AND_CHILLS_AND_FEVER))
                   addSymptom( KIDNEY_INFECTION );
                   displayDiagnosis(KIDNEY_INFECTION);
              }else
              if(have(URINARY_DIFFICULTY))
                   addSymptom( URINARY_INFECTION );
                   displayDiagnosis(URINARY_INFECTION);
              }else
              if(have(TOO_MUCH_SUN))
                   addSymptom( SUNSTROKE_OR_HEAT_EXHAUSTION );
                   displayDiagnosis(SUNSTROKE_OR_HEAT_EXHAUSTION);
              }else
                   displayUnsure();
              else
              if(have(HEADACHE))
                   addSymptom(VIRAL_INFECTION);
                   displayDiagnosis(VIRAL_INFECTION);
              }else
              if(are(MENIGITIS_POSSIBILITIES))
                   addSymptom( MENIGITIS );
                   displayDiagnosis(MENIGITIS);
              }else
              if(are(VOMITING_OR_DIARRHEA))
                   addSymptom( DIGESTIVE_TRACT_INFECTION );
                   displayDiagnosis(DIGESTIVE_TRACT_INFECTION);
              }else
              displayUnsure();
         public void displayNote()
              textArea.append("\n\n"
                   + "Fever Diagnostic Tool\n"
                   + "---------------------\n\n"
                   + "Please note that this program performs no true diagnostic activity.\n"
                   + "No decisions should be made based upon the tool's analysis. If users\n"
                   + "have a fever, they should contact their doctor.\n\n");
         public boolean have(String s)
              // prompt and extract
              textArea.append("Do you have you " + s + " (y, n): " + "\n");
              // NEED BUTTON TO PASS STRING  FROM ActionPerformed
              // AND HAVE IT RETURNED AS A CHAR RESPONCE!
              input = cin.nextLine();
              response = (char) Character.toLowerCase(input.charAt(0));
              while ( (response != 'y') && (response != 'n') )
                   textArea.append("Are you " + s + " (y, n): " + "\n");
                   input = cin.nextLine();
                   response = (char) Character.toLowerCase(input.charAt(0));
              textArea.append("");
              return response == 'y';
         private boolean are(String s)
              textArea.append("Are you " + s + " (y, n): " + "\n");
              input = cin.nextLine();
              char response = (char) Character.toLowerCase(input.charAt(0));
              while ( (response != 'y') && (response != 'n') )
                   textArea.append("Are you " + s + " (y, n): " + "\n");
                   input = cin.nextLine();
                   response = (char) Character.toLowerCase(input.charAt(0));
              textArea.append("");
              return response == 'y';
         public void addSymptom(String s)
              symptoms += "*   " + s + "\n";
         public void displayDiagnosis(String diagnosis)
              textArea.setText("");
              textArea.append("\nSymptoms:\n" + symptoms + "\n" + "Diagnosis"
                   + "\n   Possibilities include " + diagnosis  + "\n");
              textArea.append("\n");
              //System.exit(0);
         public void displayUnsure()
              textArea.append("\nInsufficient information to make a diagnosis" + "\n");
              textArea.append("\n");
              //System.exit(0);
         public static void main(String[] args)
              new FeverDiagnosis();
    }

    If you're looking to use a JTextArea as a console you can use these two classes
    you are free to use and modify these classes but please do not change the package or take credit for it as your own work.
    TextAreaReader.java
    =================
    * Created on Jul 7, 2005 by @author Tom Jacobs
    package tjacobs;
    import java.awt.TextArea;
    import java.awt.event.KeyEvent;
    import java.awt.event.KeyListener;
    import java.awt.event.TextEvent;
    import java.awt.event.TextListener;
    import java.io.BufferedInputStream;
    import java.io.BufferedReader;
    import java.io.IOException;
    import java.io.InputStream;
    import java.io.Reader;
    import javax.swing.JFrame;
    import javax.swing.JTextArea;
    public class TextAreaReader extends Reader implements KeyListener {
         JTextArea mJArea;
         TextArea mAWTArea;
         Object mKeyLock = new Object();
         Object mLineLock = new Object();
         String mLastLine;
         int mLastKeyCode = 1;
         public TextAreaReader(JTextArea area) {
              super();
              mJArea = area;
              mJArea.addKeyListener(this);
         public TextAreaReader(TextArea area) {
              super();
              mAWTArea = area;
              mAWTArea.addKeyListener(this);
         public void keyPressed(KeyEvent ke) {
              mLastKeyCode = ke.getKeyCode();
              synchronized(mKeyLock) {
                   mKeyLock.notifyAll();
              if (ke.getKeyCode() == KeyEvent.VK_ENTER) {
                   if (mJArea != null) {
                        String txt = mJArea.getText();
                        int idx = txt.lastIndexOf('\n', mJArea.getCaretPosition() - 1);
                        mLastLine = txt.substring(idx != -1 ? idx : 0, mJArea.getCaretPosition());//txt.length());
                        synchronized(mLineLock) {
                             mLineLock.notifyAll();
                   else {
                        String txt = mAWTArea.getText();
                        int idx = txt.lastIndexOf('\n', mAWTArea.getCaretPosition() - 1);
                        mLastLine = txt.substring(idx != -1 ? idx : 0, mAWTArea.getCaretPosition());//txt.length());
                        synchronized(mLineLock) {
                             mLineLock.notifyAll();
         public void keyReleased(KeyEvent ke) {
         public void keyTyped(KeyEvent ke) {
         public int read(char[] arg0, int arg1, int arg2) throws IOException {
              throw new IOException("Not supported");
         public String readLine() {
              synchronized(mLineLock) {
                   try {
                        mLineLock.wait();
                   catch (InterruptedException ex) {
              return mLastLine;
         public int read() {
              synchronized(mKeyLock) {
                   try {
                        mKeyLock.wait();
                   catch (InterruptedException ex) {
              return mLastKeyCode;
         public void close() throws IOException {
              // TODO Auto-generated method stub
         public static void main(String args[]) {
              JFrame f = new JFrame("TextAreaInput Test");
              JTextArea area = new JTextArea();
              final TextAreaReader tar = new TextAreaReader(area);
              f.add(area);
              Runnable r1 = new Runnable() {
                   public void run() {
                        while (true) {
                             int code = tar.read();
                             System.out.println("read: " + code);
              Runnable r2 = new Runnable() {
                   public void run() {
                        while (true) {
                             String line = tar.readLine();
                             System.out.println("read line: " + line);
              Thread t1 = new Thread(r1);
              Thread t2 = new Thread(r2);
              t1.start();
              t2.start();
              f.setBounds(100, 100, 200, 200);
              f.setVisible(true);
         public InputStream toInputStream() {
              return new MyInputStream();
         private class MyInputStream extends InputStream {
              public int read() {
                   return TextAreaReader.this.read();
    ==================
    TextAreaOutputStream
    ==================
    * Created on Mar 13, 2005 by @author Tom Jacobs
    package tjacobs;
    import java.io.IOException;
    import java.io.OutputStream;
    import javax.swing.JTextArea;
    import javax.swing.text.JTextComponent;
    public class TextAreaOutputStream extends OutputStream {
         public static final int DEFAULT_BUFFER_SIZE = 1;
         JTextArea mText;
         byte mBuf[];
         int mLocation;
         public TextAreaOutputStream(JTextArea component) {
              this(component, DEFAULT_BUFFER_SIZE);
         public TextAreaOutputStream(JTextArea component, int bufferSize) {
              mText = component;
              if (bufferSize < 1) bufferSize = 1;
              mBuf = new byte[bufferSize];
              mLocation = 0;
         @Override
         public void write(int arg0) throws IOException {
              //System.err.println("arg = "  + (char) arg0);
              mBuf[mLocation++] = (byte)arg0;
              if (mLocation == mBuf.length) {
                   flush();
         public void flush() {
              mText.append(new String(mBuf, 0, mLocation));
              mLocation = 0;
              try {
                   Thread.sleep(1);
              catch (Exception ex) {}
    }

  • Help with message please:  Warning: mysql_free_result() expects parameter 1 to be resource, null given in...... line

    I would really appreciate some help with my search & results page that is now throwing up the following error:
    Warning: mysql_free_result() expects parameter 1 to be resource, null given in...... line (the line number refers to the following code:
    mysql_free_result($RSsearchforsale);
    mysql_free_result($RsSearchForSale2);
    mysql_free_result($RsSearchForSale3);
    mysql_free_result($RsSearchForSale4);
    I am new to php and am setting up a dynamic site in Dreamweaver (thanks to the Missing Manual – very helpful). I apologise in advanced for my lengthy description of the problem (perhaps get yourself a drink before continuing!)
    I have a Search page with 4 list menus where the user can select an option from ANY or ALL of the menus, if a menu is not selected the value posted to the results page will be 'zzz'.
    On the results page I have 4 recordsets, all getting the correct results, only one recordset is required to run depending on how many of the menus from the search page have been selected and a test is run before executing the sql using a SWITCH statement checking how many of the menus had passed the 'zzz' values from the Search page if you see what I mean. The results page  has Repeating Regions, Recordset Paging and Display Record Count. The exact result that I require are generated by this method.
    THE PROBLEM, when a user makes a selection the first page of 10 results is fine, but the error message above is shown at the bottom of the page, AND when the user clicks NEXT to go to the next page of results THERE ARE NO RESULTS.
    This is exactly what happens depending on how many menus selected and which recordset is used:
    4 menus selected from Search: runs RSsearchforsale, results correct but 3 error messages on 1st page relating to mysql_free_result($RsSearchForSale2),mysql_free_result($RsSearchForSale3), & mysql_free_result($RsSearchForSale4). The display record count shows correct results found. NEXT page is empty of results and still shows the correct display record count as if it should be displaying the records, also has the same 3 error messages.
    3 menus selected from Search:  runs RsSearchForSale2, results correct but 3 error messages on 1st page relating to mysql_free_result($RSsearchforsale),mysql_free_result($RsSearchForSale3), & mysql_free_result($RsSearchForSale4). The display record count shows correct number of results. NEXT page shows results from the  DEFAULT setting of the recordset and the Display record count reflects this new set of results. Also still shows the 3 mysql_free_results for RsSearchForSale2, 3 and 4.
    2 menus selected from Search: runs   RsSearchForSale3, results correct but 2 error messages on 1st page relating to  mysql_free_result($RSsearchforsale) & mysql_free_result (RsSearchForSale4). The display record count is correct. NEXT page does exactly the same as described in above 3 menus selected.
    1 menu selected from search: runs RsSearchForSale4, results correct but 1 error meaasge on 1st page, mysql_free_result($RSsearchforsale). Display record count is correct and again when NEXT page is selected does as described in above where 2 or 3 menus selected.
    If you have gotten this far without falling asleep then thank you and well done! I have pasted my code below and I know its a lot to ask but please please can you give me an idea as to where or why I have gone wrong. I felt I was so close at perfecting this search and have been working on it for weeks now. I feel sure the problem is because I have 4 recordsets on the page but I could find no other way to get the exact results I wanted from the menus.
    Looking forward to any help.
    <?php require_once('Connections/propertypages.php'); ?>
    <?php if (!function_exists("GetSQLValueString")) {
    function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
      $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
      $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
      switch ($theType) {
        case "text":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;   
        case "long":
        case "int":
          $theValue = ($theValue != "") ? intval($theValue) : "NULL";
          break;
        case "double":
          $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
          break;
        case "date":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;
        case "defined":
          $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
          break;
      return $theValue;
    $currentPage = $_SERVER["PHP_SELF"];
    $maxRows_RSsearchforsale = 10;
    $pageNum_RSsearchforsale = 0;
    if (isset($_GET['pageNum_RSsearchforsale'])) {
      $pageNum_RSsearchforsale = $_GET['pageNum_RSsearchforsale'];
    $startRow_RSsearchforsale = $pageNum_RSsearchforsale * $maxRows_RSsearchforsale;
    $varloc_RSsearchforsale = "mpl";
    if (isset($_POST['location'])) {
      $varloc_RSsearchforsale = $_POST['location'];
    $vartype_RSsearchforsale = "vil";
    if (isset($_POST['type'])) {
      $vartype_RSsearchforsale = $_POST['type'];
    $varprice_RSsearchforsale = "pr9";
    if (isset($_POST['price'])) {
      $varprice_RSsearchforsale = $_POST['price'];
    $varbed_RSsearchforsale = "b5";
    if (isset($_POST['beds'])) {
      $varbed_RSsearchforsale = $_POST['beds'];
    switch (true) {
    case ($varloc_RSsearchforsale != 'zzz' && $vartype_RSsearchforsale != 'zzz' && $varprice_RSsearchforsale != 'zzz' && $varbed_RSsearchforsale != 'zzz'):
    mysql_select_db($database_propertypages, $propertypages);
    $query_RSsearchforsale = sprintf("SELECT DISTINCT trueprice,`desc`, `propid`, `bathrooms`, `photo1`, locationtable.loc, typetable.style, bedtable.`number` FROM detailstable JOIN locationtable ON detailstable.location=locationtable.locid JOIN typetable ON detailstable.type=typetable.typeid JOIN pricetable ON detailstable.price=pricetable.priceid JOIN bedtable ON detailstable.beds=bedtable.bedid WHERE location=%s AND price=%s AND type=%s AND beds=%s ORDER BY detailstable.trueprice ASC", GetSQLValueString($varloc_RSsearchforsale, "text"),GetSQLValueString($varprice_RSsearchforsale, "text"),GetSQLValueString($vartype_RSsearchforsale, "text"),GetSQLValueString($varbed_RSsearchforsale, "text"));
    $query_limit_RSsearchforsale = sprintf("%s LIMIT %d, %d", $query_RSsearchforsale, $startRow_RSsearchforsale, $maxRows_RSsearchforsale);
    $RSsearchforsale = mysql_query($query_limit_RSsearchforsale, $propertypages) or die(mysql_error());
    $row_RSsearchforsale = mysql_fetch_assoc($RSsearchforsale);
    if (isset($_GET['totalRows_RSsearchforsale'])) {
      $totalRows_RSsearchforsale = $_GET['totalRows_RSsearchforsale'];
    } else {
      $all_RSsearchforsale = mysql_query($query_RSsearchforsale);
      $totalRows_RSsearchforsale = mysql_num_rows($all_RSsearchforsale);
    $totalPages_RSsearchforsale = ceil($totalRows_RSsearchforsale/$maxRows_RSsearchforsale)-1;
    $queryString_RSsearchforsale = "";
    if (!empty($_SERVER['QUERY_STRING'])) {
      $params = explode("&", $_SERVER['QUERY_STRING']);
      $newParams = array();
      foreach ($params as $param) {
        if (stristr($param, "pageNum_RSsearchforsale") == false &&
            stristr($param, "totalRows_RSsearchforsale") == false) {
          array_push($newParams, $param);
      if (count($newParams) != 0) {
        $queryString_RSsearchforsale = "&" . htmlentities(implode("&", $newParams));
    $queryString_RSsearchforsale = sprintf("&totalRows_RSsearchforsale=%d%s", $totalRows_RSsearchforsale, $queryString_RSsearchforsale); } ?>
    <?php require_once('Connections/propertypages.php'); ?>
    <?php if (!function_exists("GetSQLValueString")) {
    function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
      $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
      $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
      switch ($theType) {
        case "text":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;   
        case "long":
        case "int":
          $theValue = ($theValue != "") ? intval($theValue) : "NULL";
          break;
        case "double":
          $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
          break;
        case "date":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;
        case "defined":
          $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
          break;
      return $theValue;
    $currentPage = $_SERVER["PHP_SELF"];
    $maxRows_RsSearchForSale2 = 10;
    $pageNum_RsSearchForSale2 = 0;
    if (isset($_GET['pageNum_RsSearchForSale2'])) {
      $pageNum_RsSearchForSale2 = $_GET['pageNum_RsSearchForSale2'];
    $startRow_RsSearchForSale2 = $pageNum_RsSearchForSale2 * $maxRows_RsSearchForSale2;
    $varloc2_RsSearchForSale2 = "mpl";
    if (isset($_POST['location'])) {
      $varloc2_RsSearchForSale2 = $_POST['location'];
    $varprice2_RsSearchForSale2 = "p9";
    if (isset($_POST['price'])) {
      $varprice2_RsSearchForSale2 = $_POST['price'];
    $vartype2_RsSearchForSale2 = "vil";
    if (isset($_POST['type'])) {
      $vartype2_RsSearchForSale2 = $_POST['type'];
    $varbed2_RsSearchForSale2 = "b5";
    if (isset($_POST['beds'])) {
      $varbed2_RsSearchForSale2 = $_POST['beds'];
    switch (true) {
    case ($varloc2_RsSearchForSale2 == 'zzz'):
    case ($varprice2_RsSearchForSale2 == 'zzz'):
    case ($vartype2_RsSearchForSale2 == 'zzz'):
    case ($varbed2_RsSearchForSale2 == 'zzz'):
    mysql_select_db($database_propertypages, $propertypages);
    $query_RsSearchForSale2 = sprintf("SELECT DISTINCT trueprice,`desc`, `propid`, `bathrooms`, `photo1`, locationtable.loc, typetable.style, bedtable.`number` FROM detailstable JOIN locationtable ON detailstable.location=locationtable.locid JOIN typetable ON detailstable.type=typetable.typeid JOIN pricetable ON detailstable.price=pricetable.priceid JOIN bedtable ON detailstable.beds=bedtable.bedid WHERE (location=%s AND price=%s AND type=%s) OR (location=%s AND price=%s AND beds=%s) OR (location=%s AND type=%s AND beds=%s) OR (price=%s AND type=%s AND beds=%s) ORDER BY detailstable.trueprice ASC", GetSQLValueString($varloc2_RsSearchForSale2, "text"),GetSQLValueString($varprice2_RsSearchForSale2, "text"),GetSQLValueString($vartype2_RsSearchForSale2, "text"),GetSQLValueString($varloc2_RsSearchForSale2, "text"),GetSQLValueString($varprice2_RsSearchForSale2, "text"),GetSQLValueString($varbed2_RsSearchForSale2, "text"),GetSQLValueString($varloc2_RsSearchForSale2, "text"),GetSQLValueString($vartype2_RsSearchForSale2, "text"),GetSQLValueString($varbed2_RsSearchForSale2, "text"),GetSQLValueString($varprice2_RsSearchForSale2, "text"),GetSQLValueString($vartype2_RsSearchForSale2, "text"),GetSQLValueString($varbed2_RsSearchForSale2, "text"));
    $query_limit_RsSearchForSale2 = sprintf("%s LIMIT %d, %d", $query_RsSearchForSale2, $startRow_RsSearchForSale2, $maxRows_RsSearchForSale2);
    $RsSearchForSale2 = mysql_query($query_limit_RsSearchForSale2, $propertypages) or die(mysql_error());
    $row_RsSearchForSale2 = mysql_fetch_assoc($RsSearchForSale2);
    if (isset($_GET['totalRows_RsSearchForSale2'])) {
      $totalRows_RsSearchForSale2 = $_GET['totalRows_RsSearchForSale2'];
    } else {
      $all_RsSearchForSale2 = mysql_query($query_RsSearchForSale2);
      $totalRows_RsSearchForSale2 = mysql_num_rows($all_RsSearchForSale2);
    $totalPages_RsSearchForSale2 = ceil($totalRows_RsSearchForSale2/$maxRows_RsSearchForSale2)-1;
    $queryString_RsSearchForSale2 = "";
    if (!empty($_SERVER['QUERY_STRING'])) {
      $params = explode("&", $_SERVER['QUERY_STRING']);
      $newParams = array();
      foreach ($params as $param) {
        if (stristr($param, "pageNum_RsSearchForSale2") == false &&
            stristr($param, "totalRows_RsSearchForSale2") == false) {
          array_push($newParams, $param);
      if (count($newParams) != 0) {
        $queryString_RsSearchForSale2 = "&" . htmlentities(implode("&", $newParams));
    $queryString_RsSearchForSale2 = sprintf("&totalRows_RsSearchForSale2=%d%s", $totalRows_RsSearchForSale2, $queryString_RsSearchForSale2);
    }?>
    <?php require_once('Connections/propertypages.php'); ?>
    <?php if (!function_exists("GetSQLValueString")) {
    function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
      $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
      $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
      switch ($theType) {
        case "text":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;   
        case "long":
        case "int":
          $theValue = ($theValue != "") ? intval($theValue) : "NULL";
          break;
        case "double":
          $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
          break;
        case "date":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;
        case "defined":
          $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
          break;
      return $theValue;
    $currentPage = $_SERVER["PHP_SELF"];
    $maxRows_RsSearchForSale3 = 10;
    $pageNum_RsSearchForSale3 = 0;
    if (isset($_GET['pageNum_RsSearchForSale3'])) {
      $pageNum_RsSearchForSale3 = $_GET['pageNum_RsSearchForSale3'];
    $startRow_RsSearchForSale3 = $pageNum_RsSearchForSale3 * $maxRows_RsSearchForSale3;
    $varloc3_RsSearchForSale3 = "mpl";
    if (isset($_POST['location'])) {
      $varloc3_RsSearchForSale3 = $_POST['location'];
    $varprice3_RsSearchForSale3 = "p9";
    if (isset($_POST['price'])) {
      $varprice3_RsSearchForSale3 = $_POST['price'];
    $vartype3_RsSearchForSale3 = "vil";
    if (isset($_POST['type'])) {
      $vartype3_RsSearchForSale3 = $_POST['type'];
    $varbed3_RsSearchForSale3 = "b5";
    if (isset($_POST['beds'])) {
      $varbed3_RsSearchForSale3 = $_POST['beds'];
    switch (true) {
    case ($varloc3_RsSearchForSale3 == 'zzz' && $varprice3_RsSearchForSale3 == 'zzz'):
    case ($varprice3_RsSearchForSale3 == 'zzz' && $vartype3_RsSearchForSale3 == 'zzz'):
    case ($vartype3_RsSearchForSale3 == 'zzz' && $varbed3_RsSearchForSale3 == 'zzz' ):
    case ($varbed3_RsSearchForSale3 == 'zzz' && $varloc3_RsSearchForSale3 == 'zzz'):
    case ($varloc3_RsSearchForSale3 == 'zzz' && $vartype3_RsSearchForSale3 == 'zzz'):
    case ($varprice3_RsSearchForSale3 == 'zzz' && $varbed3_RsSearchForSale3 == 'zzz'):
    mysql_select_db($database_propertypages, $propertypages);
    $query_RsSearchForSale3 = sprintf("SELECT DISTINCT trueprice,`desc`, `propid`, `bathrooms`, `photo1`, locationtable.loc, typetable.style, bedtable.`number` FROM detailstable JOIN locationtable ON detailstable.location=locationtable.locid JOIN typetable ON detailstable.type=typetable.typeid JOIN pricetable ON detailstable.price=pricetable.priceid JOIN bedtable ON detailstable.beds=bedtable.bedid WHERE (location=%s AND price=%s) OR (location=%s AND  type=%s) OR (location=%s AND beds=%s) OR ( type=%s AND beds=%s) OR (price=%s AND type=%s) OR (price=%s AND beds=%s) ORDER BY detailstable.trueprice ASC", GetSQLValueString($varloc3_RsSearchForSale3, "text"),GetSQLValueString($varprice3_RsSearchForSale3, "text"),GetSQLValueString($varloc3_RsSearchForSale3, "text"),GetSQLValueString($vartype3_RsSearchForSale3, "text"),GetSQLValueString($varloc3_RsSearchForSale3, "text"),GetSQLValueString($varbed3_RsSearchForSale3, "text"),GetSQLValueString($vartype3_RsSearchForSale3, "text"),GetSQLValueString($varbed3_RsSearchForSale3, "text"),GetSQLValueString($varprice3_RsSearchForSale3, "text"),GetSQLValueString($vartype3_RsSearchForSale3, "text"),GetSQLValueString($varprice3_RsSearchForSale3, "text"),GetSQLValueString($varbed3_RsSearchForSale3, "text"));
    $query_limit_RsSearchForSale3 = sprintf("%s LIMIT %d, %d", $query_RsSearchForSale3, $startRow_RsSearchForSale3, $maxRows_RsSearchForSale3);
    $RsSearchForSale3 = mysql_query($query_limit_RsSearchForSale3, $propertypages) or die(mysql_error());
    $row_RsSearchForSale3 = mysql_fetch_assoc($RsSearchForSale3);
    if (isset($_GET['totalRows_RsSearchForSale3'])) {
      $totalRows_RsSearchForSale3 = $_GET['totalRows_RsSearchForSale3'];
    } else {
      $all_RsSearchForSale3 = mysql_query($query_RsSearchForSale3);
      $totalRows_RsSearchForSale3 = mysql_num_rows($all_RsSearchForSale3);
    $totalPages_RsSearchForSale3 = ceil($totalRows_RsSearchForSale3/$maxRows_RsSearchForSale3)-1;
    $queryString_RsSearchForSale3 = "";
    if (!empty($_SERVER['QUERY_STRING'])) {
      $params = explode("&", $_SERVER['QUERY_STRING']);
      $newParams = array();
      foreach ($params as $param) {
        if (stristr($param, "pageNum_RsSearchForSale3") == false &&
            stristr($param, "totalRows_RsSearchForSale3") == false) {
          array_push($newParams, $param);
      if (count($newParams) != 0) {
        $queryString_RsSearchForSale3 = "&" . htmlentities(implode("&", $newParams));
    $queryString_RsSearchForSale3 = sprintf("&totalRows_RsSearchForSale3=%d%s", $totalRows_RsSearchForSale3, $queryString_RsSearchForSale3);
    } ?>
    <?php require_once('Connections/propertypages.php'); ?>
    <?php if (!function_exists("GetSQLValueString")) {
    function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
      $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
      $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
      switch ($theType) {
        case "text":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;   
        case "long":
        case "int":
          $theValue = ($theValue != "") ? intval($theValue) : "NULL";
          break;
        case "double":
          $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
          break;
        case "date":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;
        case "defined":
          $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
          break;
      return $theValue;
    $currentPage = $_SERVER["PHP_SELF"];
    $maxRows_RsSearchForSale4 = 10;
    $pageNum_RsSearchForSale4 = 0;
    if (isset($_GET['pageNum_RsSearchForSale4'])) {
      $pageNum_RsSearchForSale4 = $_GET['pageNum_RsSearchForSale4'];
    $startRow_RsSearchForSale4 = $pageNum_RsSearchForSale4 * $maxRows_RsSearchForSale4;
    $varloc4_RsSearchForSale4 = "mpl";
    if (isset($_POST['location'])) {
      $varloc4_RsSearchForSale4 = $_POST['location'];
    $vartype4_RsSearchForSale4 = "vil";
    if (isset($_POST['type'])) {
      $vartype4_RsSearchForSale4 = $_POST['type'];
    $varprice4_RsSearchForSale4 = "p9";
    if (isset($_POST['price'])) {
      $varprice4_RsSearchForSale4 = $_POST['price'];
    $varbed4_RsSearchForSale4 = "b5";
    if (isset($_POST['beds'])) {
      $varbed4_RsSearchForSale4 = $_POST['beds'];
    switch (true) {
    case ($varloc4_RsSearchForSale4 == 'zzz' && $vartype4_RsSearchForSale4 =='zzz' && $varprice4_RsSearchForSale4 == 'zzz'):
    case ($varloc4_RsSearchForSale4 == 'zzz' && $varprice4_RsSearchForSale4 =='zzz' && $varbed4_RsSearchForSale4 == 'zzz'):
    case ($varloc4_RsSearchForSale4 == 'zzz' && $varbed4_RsSearchForSale4 =='zzz' && $vartype4_RsSearchForSale4 == 'zzz'):
    case ($varbed4_RsSearchForSale4 == 'zzz' && $vartype4_RsSearchForSale4 =='zzz' && $varprice4_RsSearchForSale4 == 'zzz'):
    mysql_select_db($database_propertypages, $propertypages);
    $query_RsSearchForSale4 = sprintf("SELECT DISTINCT trueprice,`desc`, `propid`, `bathrooms`, `photo1`, locationtable.loc, typetable.style, bedtable.`number` FROM detailstable JOIN locationtable ON detailstable.location=locationtable.locid JOIN typetable ON detailstable.type=typetable.typeid JOIN pricetable ON detailstable.price=pricetable.priceid JOIN bedtable ON detailstable.beds=bedtable.bedid WHERE location=%s OR price=%s OR type=%s OR beds=%s ORDER BY detailstable.trueprice ASC", GetSQLValueString($varloc4_RsSearchForSale4, "text"),GetSQLValueString($varprice4_RsSearchForSale4, "text"),GetSQLValueString($vartype4_RsSearchForSale4, "text"),GetSQLValueString($varbed4_RsSearchForSale4, "text"));
    $query_limit_RsSearchForSale4 = sprintf("%s LIMIT %d, %d", $query_RsSearchForSale4, $startRow_RsSearchForSale4, $maxRows_RsSearchForSale4);
    $RsSearchForSale4 = mysql_query($query_limit_RsSearchForSale4, $propertypages) or die(mysql_error());
    $row_RsSearchForSale4 = mysql_fetch_assoc($RsSearchForSale4);
    if (isset($_GET['totalRows_RsSearchForSale4'])) {
      $totalRows_RsSearchForSale4 = $_GET['totalRows_RsSearchForSale4'];
    } else {
      $all_RsSearchForSale4 = mysql_query($query_RsSearchForSale4);
      $totalRows_RsSearchForSale4 = mysql_num_rows($all_RsSearchForSale4);
    $totalPages_RsSearchForSale4 = ceil($totalRows_RsSearchForSale4/$maxRows_RsSearchForSale4)-1;
    $queryString_RsSearchForSale4 = "";
    if (!empty($_SERVER['QUERY_STRING'])) {
      $params = explode("&", $_SERVER['QUERY_STRING']);
      $newParams = array();
      foreach ($params as $param) {
        if (stristr($param, "pageNum_RsSearchForSale4") == false &&
            stristr($param, "totalRows_RsSearchForSale4") == false) {
          array_push($newParams, $param);
      if (count($newParams) != 0) {
        $queryString_RsSearchForSale4 = "&" . htmlentities(implode("&", $newParams));
    $queryString_RsSearchForSale4 = sprintf("&totalRows_RsSearchForSale4=%d%s", $totalRows_RsSearchForSale4, $queryString_RsSearchForSale4);
    }?>

    Hi David,
    Thank you for your reply and patience, we are getting closer in spite of me!
    Of course i needed to change the name of the recordset, i did that the first time i did it (when i got the error), the when i re did it i forgot, in my defense i was also trying to get a full understanding of the code using the W3Schools php reference and writing by the side of the code on a piece of paper what it meant in English.
    Anyway after re doing the code correctly it still displayed all the records of my database but i realised that was because i was POSTING from the search form and when i changed it to the GET method I now get results when all 4  list menus are selected from and the paging works. After reading about the POST / GET method i chose the POST option, is the GET method a better option in my circumstance?
    On my site now if the user selects from 1,2 or 3 of the menus rather than selecting the relevant records it displays the NO RESULT page, I would like my users to be able to select from all of the menus or ANY combination of the menus and find exact results for their search, for example if they only select a location and a price i want it display all records that match that location and price with any number of bedrooms and any Type of property: Perhaps this is due to how my list menus are set up, for each menu the first Item label is Location (or Beds or Type or Price) and the value i have left blank which i believe means that it will use the item label as the value, the second Item label for all menus is Any and again the value has been left blank. All other item labels have values relevant to database records.  
    I do look forward to your reply and cannot thank you enough for following this through with me, please continue to bare with me just a little more,
    best regards
    Tessimon
    Date: Wed, 11 Nov 2009 06:56:24 -0700
    From: [email protected]
    To: [email protected]
    Subject: Help with message please:  Warning: mysql_free_result() expects parameter 1 to be resource, null given in...... line
    You're not adding the WHERE clause to the SQL query. My example code uses $query_search. You need to change that variable to match the name of your recordset, i.e. $query_RSsearchforsale.
    Moreover, the WHERE clause needs to go before ORDER BY.
    $query_RSsearchforsale = "SELECT trueprice,`desc`, `propid`, `bathrooms`, `location`, `type`, `price`, `beds`, `photo1`, locationtable.loc, typetable.style, bedtable.`number` FROM detailstable JOIN locationtable ON detailstable.location=locationtable.locid JOIN typetable ON detailstable.type=typetable.typeid JOIN pricetable ON detailstable.price=pricetable.priceid JOIN bedtable ON detailstable.beds=bedtable.bedid ";
    // Set a flag to indicate whether the query has a WHERE clause
    $where = false;
    // Loop through the associatiave array of expected search values
    foreach ($expected as $var => $type) {
      if (isset($_GET[$var])) {
        $value = trim(urldecode($_GET[$var]));
        if (!empty($value)) {
          // Check if the value begins with > or <
          // If so, use it as the operator, and extract the value
          if ($value[0] == '>' || $value[0] == '<') {
            $operator = $value[0];
            $value = ltrim(substr($value, 1));
          } elseif (strtolower($type) != 'like') {
            $operator = '=';
          // Check if the WHERE clause has been added yet
          if ($where) {
            $query_RSsearchforsale .= ' AND ';
          } else {
            $query_RSsearchforsale .= ' WHERE ';
            $where = true;
          // Build the SQL query using the right operator and data type
          $type = strtolower($type);
          switch($type) {
            case 'like':
              $query_RSsearchforsale .= "`$var` LIKE " . GetSQLValueString('%' .
    $value . '%', "text");
              break;
            case 'int':
            case 'double':
            case 'date':
              $query_RSsearchforsale .= "`$var` $operator " .
    GetSQLValueString($value, "$type");
              break;
            default:
            $query_RSsearchforsale .= "`$var` = " . GetSQLValueString($value,
    "$type");
    $query_RSsearchforsale .= ' ORDER BY detailstable.trueprice ASC';
    >

  • Search help with programming

    Hai,
    Can any one give example for search help with Programming?
    I hope we can create search help with help of coding.
    With Regards,Jaheer.

    yes u can create search help by using match code in programs
    for eq
    go with abap editor se 38
    provide the name of program
    parameters : vendor like lfa1-lifnr matchcode object yzob.
    double click on yzob
    provide description for search help
    provide selection method
    provide search help parameter
    enable check box for import and export
    provide lpos
               spos
    save check activate
    press f4 for check and import values i.e it will display a records list available in database table
    rewards points please

  • Combo box and Check box..help with code please?

    Here is my problem...i have a list of check boxes and according to which one is checked, i need combo boxes to populate different choices.
    as an easy example im only using 2 check boxes and two combo boxes.
    the check boxes are named Choice 1or2 with export values of 1 and 2
    the Combo Boxes are named List A and List B..
    both containing options that say you checked box 1 and you checked box 2
    any help would be greatly appreciated

    Implode wrote:
    "Help with code please."
    In the future, please use a meaningful subject. Given that you're posting here, it's kind of a given that you're looking for help with the code. The whole point of the subject is to give people a high level idea of what KIND of help with what KIND of code you need, so they can decide if they're interested and qualified to help.
    Exception in thread "main" java.lang.NumberFormatException: For input string: "fgg"
         at java.lang.NumberFormatException.forInputString(Unknown Source)
         at java.lang.Integer.parseInt(Unknown Source)
         at java.lang.Integer.parseInt(Unknown Source)
         at assignment1.Game.Start(Game.java:120)
         at assignment1.RunGame.main(RunGame.java:18)This error message is telling you exactly what's wrong. At line 120 of Game.java, in the Start method (which should start with lowercase "s" to follow conventions, by the way), you're calling Integer.parseInt, but "fgg" is not a valid int.

  • I have need help with something Please respond Quickly :)

    I have need help with something Please respond Quickly  ok so i have the linksys wrt54g Version 2.2 and i upgraded the firmware to V4.21.4 from this site http://homesupport.cisco.com/en-us/wireless/lbc/WRT54G and i clicked V2.2 for the router. So after i upgraded i lost internet ability i can't use the internet so i had to downgrade back to V4.21.1 but i want the things that newer update sloves. Please Help. Everything thing says DNS error? aka Modem.
    $$Cgibbons$$

    Ya i tried that i tried restoring and redoing everything when i downgrade back to .1 it works fine though?
    $$Cgibbons$$

  • Hi I got an email from itunes saying that my pre order was ready and when I click on the link from my ipad it takes me to the itunes store app and then it doesn't do anything help with this please.

    Hi I got an email from itunes saying that my pre order was ready and when I click on the link from my ipad it takes me to the itunes store app and then it doesn't do anything help with this please .
    <Link Edited By Host>

    Thanks for your advice, I went to the apple shop today for a face to face meeting with a tech and he checked everything and could not figure out why I was having this problem so we decided to give up on that account and create a whole new one for me using a different email address.
    Now I can download apps on both my iPhone and ipad2.
    If anyone is reading this in Brisbane Australia go to the Chermside apple shop and ask for Wade. He was fantastic!
    Jan

  • Itunes istallation freezes at 'Publishing Product Information'.  Can anyone help with this please?

    Itunes istallation freezes at 'Publishing Product Information'.  Can anyone help with this please?

    You need more memory. 4 GB is not enough:
      1.12 GB Page-outs
      [killed] com.apple.CallHistoryPluginHelper.plist
      [killed] com.apple.CallHistorySyncHelper.plist
      [killed] com.apple.cmfsyncagent.plist
      [killed] com.apple.coreservices.appleid.authentication.plist
      [killed] com.apple.sbd.plist
      [killed] com.apple.security.cloudkeychainproxy.plist
      [killed] com.apple.telephonyutilities.callservicesd.plist
      7 processes killed due to memory pressure
    Problem System Launch Daemons: ℹ️
      [killed] com.apple.ctkd.plist
      [killed] com.apple.icloud.findmydeviced.plist
      [killed] com.apple.softwareupdate_download_service.plist
      [killed] com.apple.wdhelper.plist
      4 processes killed due to memory pressure

  • Help with program to remove comments from chess(pgn) text files

    Hi
    I would like to make a java program that will remove chessbase comments from pgn files (which are just based text files).
    I have done no java programming on text files so far and so this will be a new java adventure for me. Otherwise I have limited basic java experience mainly with Java chess GUI's and java chess engines.
    I show here a portion of such a pgn text file with the chessbase comments which are between the curly braces after the moves:
    1. e4 {[%emt 0:00:01]} c6 {[%emt 0:00:10]} 2. d4 {[%emt 0:00:03]} d5 {
    [%emt 0:00:01]} 3. e5 {[%emt 0:00:01]} Bf5 {[%emt 0:00:01]} 4. h4 {
    [%emt 0:00:02]} e6 {[%emt 0:00:02]}
    I want to make a java program if possible that removes these comments, so just leaving the move notation eg:
    1. e4 c6 2. d4 d5 3. e5 Bf5 4. h4 e6
    I am just starting with this. As yet I am unsure how to begin and do this and I would be extremely grateful for any help and advice to get me going with this project.
    I look forward to replies, many thanks

    I found a simple java text editor (NutPad-with sourcecode) and have tried to adapt it to incorporate the regular expressions code suggested by ChuckBing and renamed it CleanCBpgnPad.
    Presently this won't compile! (not surprising).
    I copy the code here:
    //CleanCBpgnPad by tR2 based on NutPad text editor
    // editor/NutPad.java -- A very simple text editor -- Fred Swartz - 2004-08
    // Illustrates use of AbstractActions for menus.
    //http://www.roseindia.net/java/java-tips/45examples/20components/editor/nutpad.shtml
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import java.io.*;
    public class CleanCBpgnPad extends JFrame {
    //-- Components
    private JTextArea mEditArea;
    private JFileChooser mFileChooser = new JFileChooser(".");
    //-- Actions
    private Action mOpenAction;
    private Action mSaveAction;
    private Action mExitAction;
    private Action mCleanAction;
    //===================================================================== main
    public static void main(String[] args) {
    new CleanCBpgnPad().setVisible(true);
    }//end main
    //============================================================== constructor
    public CleanCBpgnPad() {
    createActions();
    this.setContentPane(new contentPanel());
    this.setJMenuBar(createMenuBar());
    this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    this.setTitle("CleanCBpgnPad");
    this.pack();
    }//end constructor
    ///////////////////////////////////////////////////////// class contentPanel
    private class contentPanel extends JPanel {       
    //========================================================== constructor
    contentPanel() {
    //-- Create components.
    mEditArea = new JTextArea(15, 80);
    mEditArea.setBorder(BorderFactory.createEmptyBorder(2,2,2,2));
    mEditArea.setFont(new Font("monospaced", Font.PLAIN, 14));
    JScrollPane scrollingText = new JScrollPane(mEditArea);
    //-- Do layout
    this.setLayout(new BorderLayout());
    this.add(scrollingText, BorderLayout.CENTER);
    }//end constructor
    }//end class contentPanel
    //============================================================ createMenuBar
    /** Utility function to create a menubar. */
    private JMenuBar createMenuBar() {
    JMenuBar menuBar = new JMenuBar();
    JMenu fileMenu = menuBar.add(new JMenu("File"));
    fileMenu.add(mOpenAction); // Note use of actions, not text.
    fileMenu.add(mSaveAction);
    fileMenu.add(mCleanAction);
    fileMenu.addSeparator();
    fileMenu.add(mExitAction);
    return menuBar;
    }//end createMenuBar
    //============================================================ createActions
    /** Utility function to define actions. */
    private void createActions() {
    mOpenAction = new AbstractAction("Open...") {
    public void actionPerformed(ActionEvent e) {
    int retval = mFileChooser.showOpenDialog(CleanCBpgnPad.this);
    if (retval == JFileChooser.APPROVE_OPTION) {
    File f = mFileChooser.getSelectedFile();
    try {
    FileReader reader = new FileReader(f);
    mEditArea.read(reader, ""); // Use TextComponent read
    } catch (IOException ioex) {
    System.out.println(e);
    System.exit(1);
    mSaveAction = new AbstractAction("Save") {
    public void actionPerformed(ActionEvent e) {
    int retval = mFileChooser.showSaveDialog(CleanCBpgnPad.this);
    if (retval == JFileChooser.APPROVE_OPTION) {
    File f = mFileChooser.getSelectedFile();
    try {
    FileWriter writer = new FileWriter(f);
    mEditArea.write(writer); // Use TextComponent write
    } catch (IOException ioex) {
    System.out.println(e);
    System.exit(1);
    mCleanAction = new AbstractAction ("Clean"){
    public void actionPerformed (ActionEvent e) {
    int retval = mFileChooser.showCleanDialog(CleanCBpgnPad.this);
    if (retval== JFileChooser.APPROVE_OPTION){
    File f = mFileChooser.getSelectedFile();
    try {
    FileCleaner cleaner = new FileCleaner (c);
    mEditArea.clean(cleaner); // Use TextComponent clean
    }catch (IOException ioex){
    String str = "1. e4 {[%emt 0:00:01]} c6 {[%emt 0:00:10]} 2. d4 {[%emt 0:00:03]} d5 {[%emt 0:00:01]} " + "3. e5 {[%emt 0:00:01]} Bf5 {[%emt 0:00:01]} 4. h4 {[%emt 0:00:02]} e6 {[%emt 0:00:02]}";
    str = str.replaceAll("\\{.*?\\}", "");
    System.out.println(str);
    System.exit(1);
    mExitAction = new AbstractAction("Exit") {
    public void actionPerformed(ActionEvent e) {
    System.exit(0);
    }//end createActions
    }//end class CleanCBpgnPad
    As seen I added a newAction mClean.
    4 errors arise starting with line 101-cannot find symbol method showCleanDialog
    then 3 errors on line 104 tryfilecleaner
    Can anyone help me with this please?
    Can I incorporate the regular expression code to remove these text comments into this text editor code and if so how?
    Obviously a lot of this code is new to me and I will continue to study it and hope to learn to understand most , if not all of it!
    Again I look forward to replies,thanks

  • Need Help With Home Please

    If anyone here is good with Java, I need serious help with my homework, please give me your instant messenger screen name and we can chat, thanks alot!!
    Angela

    I don't understand how people get themselves into
    these situations as school, if you don't want to learn
    it don't sign up for the class.....You never got yourself into this situation.... I think everyone has on occassion.
    My very first "serious" university program was to solve a second order, non-linear differential equation using the Runge-Kutta method. This is NOT the easy way to learn a computer language and I have to admit I did take "shortcuts" using more experienced people than me.
    That was before the web though...
    God am I really that old?

  • Further help with sound please

    further help with the sound.
    i have a sound in stage channel 1 which i want to play as soon as the movies starts. and the user is able to control it by pressing the pause button
    property pPaused
    on beginSprite me
    pPaused = 0
    end
    on mouseUp me
    if pPaused then sound(1).play()
    else sound(1).pause()
    pPaused = not pPaused
    end
    i have  other sounds in songs (2 sounds ) and nursery rhymes (4 sounds ) with the behaviour added to the buttons as below etc,
    on mouseDown me
      sound(5).play( member("ABCSong") )
    end
    on endSprite me
      sound(5).stop()
    end
    this stops the sound playing when i leave the frame but doesn't stop the sound in the stage channel 1.
    i only want to play 1 sound at a time perferly when the button is pressed and stop 
    could anyone  please advise of how to solve this problem. only using intermediate/basic lingo as i need to understand it.
    any help is much appreciated
    thank you

    Try:
    on mouseDown me
      sound(1).pause()
      sound(5).play( member("ABCSong") )
    end
    on endSprite me
      sound(1).play()
      sound(5).stop()
    end

  • Can anyone help with programming co ordinates.

    how do i develop a class specification for class points.
    //pointTest.java
    main(...)     
         Point P1;
         P1.create(24,16); // create a point with coordinates {24,16}
         P1.display(); // display the {X,Y} coordinates of P1
    can anyone help with coding to program two points. can anyone elaborate on the stubs shown above to develop one point.

    There's already a Point class. So use that.
    Unless this is a homework in which case, well, it's your homework isn't it? So why are you asking us?

  • Help With Indirection Please

    I'm having a hard time understanding all of the options and patterns for indirection. Here is what I would like to accomplish: I have three tables represented by Parent and Child classes joined by a ParentChildJoin class. I am instantiating the join class because that table also holds the ordering attribute. I would like to be able to instantiate all of the Parent objects without any of the Join or Child objects. Then when I ask a Parent for its Join objects, I would like to get all of the Join and Child objects for that Parent, in order, and as efficiently as possible, preferably in one trip to the database. It appears that with Indirection, 'addBatchReadAttribute', and so forth I should be able to accomplish this, but I would like some help with the details, please.
    Thanks!

    Please let me know if this is the best approach. I'll use this picture to illustrate my example:
    |----------|          |----------|          |----------|
    |          |1   A    *|          |*   B    1|          |
    |          |--------->|          |<---------|          |
    | Parent   |          |  PCJoin  |          |  Child   |
    |          |<---------|          |--------->|          |
    |          |1   C    1|          |1   D    1|          |
    |----------|          |----------|          |----------|If I use Indirection on all the relations (A,B,C, and D), then I can load all of the Parent objects with one query, when I access relation A another query is triggered to populate the collection of PCJoin objects, and then as I iterate through those and access relation D, another query is issued for each child. This situation is 2+N (or 'big oh' N), which is what I wanted to avoid.
    So now I have A and B marked as Indirect and checked 'Use Batch Reading' on all four relations. What appears to be happening now is one query for the Parent, then when I access relation A, I get one query for the PCJoin objects, and an additional query each for the Parent and Child objects related to those, for a total of 4 queries (or 'big oh' 1). Much better.
    It seems ideally one could get away with two queries, but I would like to be able to have this behavior whichever end of the join I start at, so I just want to verify that I've done the best I can (and also to provide an example, in case anyone else had the same question.)

  • Need help with debugging PLEASE

    Hi,
    I'm new to Java and was given an assignment to debug a program. I am completely lost and really havent gone over most of the stuff that is in this program. I would greatly appreciate any help with this that I can get.
    Here is my code:
    import java.util.*;
    import javax.swing.*;
    public class IndexHitFrequency
    private final int NUMBER_OF_SIMULATIONS = 1000;
    private int indexHit[] = new int [10];
    public IndexHitFrequency()
    Random generator = new Random(); // for generating random number
    int array[] = {6, 2, 4, 8, 5, 0, 1, 7, 3, 9 };
    //convert to ArrayList and sort it
    List list = new ArrayList(Arrays.asList(array));
    for (int i = 0; i < NUMBER_OF_SIMULATIONS; i++)
    //generate random number
    int randomNumber = generator.nextInt(array.length);
    // get index hit
    int index = Collections.binarySearch(list, randomNumber) ;
    // save index hit to array
    if(index > -1)
    indexHit[index]++;
    }//end for
    String output = "Index\tFrequency\t\n";
    //append the frequency of index hit to output
    for (int i = 0; i < indexHit.length; i++)
    output += i + "\t" + indexHit[i] + "\t\n";
    //display result
    JTextArea outputArea = new JTextArea();
    outputArea.setText(output);
    JOptionPane.showMessageDialog(null, outputArea, "Search random number 1000 times" ,
    JOptionPane.INFORMATION_MESSAGE);
    System.exit(0);
    }// end constructor
    public static void main (String [] args)
    new IndexHitFrequency();
    } // end class IndexHitFrequency
    I get these errors after trying to compile:
    "IndexHitFrequency.java": Error #: 300 : method asList(int[]) not found in class java.util.Arrays at line 17, column 40
    "IndexHitFrequency.java": Error #: 300 : method binarySearch(java.util.List, int) not found in class java.util.Collections at line 24, column 34

    C:\Java\Tutorial\rem>javac IndexHitFrequency.java
    IndexHitFrequency.java:15: asList(java.lang.Object[]) in java.util.Arrays cannot
    be applied to (int[])
    List list = new ArrayList(Arrays.asList(array));
                                    ^
    IndexHitFrequency.java:22: cannot find symbol
    symbol  : method binarySearch(java.util.List,int)
    location: class java.util.Collections
    int index = Collections.binarySearch(list, randomNumber) ;
                           ^
    2 errors
    C:\Java\Tutorial\rem>Copied source and compiled in DOS window ( XP's cmd.exe) and got these error messages...
    I think these error are more clear than the ones you posted, so this should help you resolve the problem...
    - MaxxDmg...
    - ' He who never sleeps... '

  • Need help with Fancybox please

    Hola
    I need some help with Fancybox.
    I bought this template and it came without facybox, so I thought
    that this will be a great help to learn some about jQuerry, but I'm lost
    Why is NOT working on my page?
    I just cannot figure this out.
    Can you please check my page?
    http://tummytime.biz/pages/portfolio_fancy.html
    I got Windows 8, Dreamweaver CC
    Thanks a lot.

    There are a couple things that could be causing a couple browsers' collective heads to implode.
    Remove the <! right before your </head> tag...
    </script>
    <!
    </head>
    <body>
    You have two calls to the fancybox css file, you only need one.
    Aside from that I'm not seeing any code problems jump out at me.
    EDIT: Ah, didn't scroll far enough. You have more than one reference to the jquery library. Typically, only one is needed and two or more will cause them all to fail. Usually, you can use the "latest" link and cover all your bases.
    If you aren't using those referenced scripts at the bottom of your page, delete them.

Maybe you are looking for

  • How do I fix my iMessage on iPhone 5s?

    My iMessage has stopped working on my iPhone 5s, but only with ONE person. I have reset it multiple times, i reset the network, and I reset all the setting on the phone. I'm quite confused and need to know what's going on.    

  • How to PI and UN/EDIFACT scenarios?

    Hi folks, I’ll start soon a new PI project with EDI scenarios. It will be my first XI-EDI project and I don’t have any experience with this kind of scenarios. I already read some documentation, as well as some info at SDN, but I still have some incon

  • Firefox and other program icons are pictured as media

    all of the icons are the same, in this case they're all media. dont' know how this happened. instead of opening firefox, it says it can't and it thinks its a media file, along with other programs i use, bearshare, yahoo messenger etc. pls help.

  • Problem in thread to post code

    hello Please check the following thread in this thread when i post code then preview is not perfert only problem in this thread not othere Re: Hierarchical sequential List

  • HT201407 Iphone 4 wont activate after i0s7 update, please help!!?

    Iphone starts up but with 'no service' and it says it cant be activated because the server cannot be reached. What do i do!?