grisha83 26 Junior Poster in Training

Hello,
I wasn't sure where to post it so i decided to do it here.
I want to create a calendar compatible with iphone, smart phone that runs on android and google calendar. This calendar will be posted on a website and be available to visitors. I don't know where to start. Could you please send me in the right direction?
P.S. this is a not-for-profit project
Thank you

grisha83 26 Junior Poster in Training

Hello there
I am trying to enable php and apache on my mac and i think, i mixed up my settings. Is anyway i could reset my web settings, in particular the line "LoadModule php5_module modules/libphp5.so" is missing.
Thank you for your input

grisha83 26 Junior Poster in Training

I should ask you the same question: Is this your thing (solving threads)? Instead of simple ignoring my question (since you don't have the solution to it). You inefficiently wasting space on server by leaving meaningless comments.
Cheers!

grisha83 26 Junior Poster in Training

I've been messing around with my terminal on my mac and i think i messed it up.
Is any way to reset the web setting on Snow Leopard?
Thank you

grisha83 26 Junior Poster in Training

Hey guys,
I am trying to do the basic :hello world" in PHP
When i compile the code, my browser doesn't display "hello world" it is giving me an error:
"You tried to access the address http://localhost/PhpProject1/index.php, which is currently unavailable. Please make sure that the Web address (URL) is correctly spelled and punctuated, then try reloading the page."
Why does it do that?
Is it possible that the reason is that i am using Opera?
Thanks ahead for your input

grisha83 26 Junior Poster in Training

Thank you

grisha83 26 Junior Poster in Training

Hello,
I am new to Python.
I am trying to start writing some simple programs in it.
Which IDE would you suggest? I am currently using NeatBeans for my Java programs but i don't think i can use it for Python
P.S. I am using Mac OS X 10.5.7
Thank you

grisha83 26 Junior Poster in Training

Well its working now after I moved the prompt from the user to input Node values to my main. But anyway, here is the entire program:
// Node

public class Node {
    public int data;
    public Node left;
    public Node right;

    public Node()   // No argumennt constructor initializing the variables
    {
        data = 0;   // Node value
        left = null; // Left Node
        right = null; // Right Node
    }
    public Node(int val)   // One argumennt constructor initializing the variables
    {
     data = val; // Node value
     left = null;  // Right Node
     right = null; // Left Node
    }

// Class BinarySearchTree

public class BinarySearchTree {

    private Node root;

    public BinarySearchTree() {
        root = null;
    }

    public Node DummyNode(int val) // Dummy Node with initial value of any number
    {
        if (root == null) {
            root = new Node(val);
        } else {
            insertRoot(val);
        }

        return root;
    }

    public int insertRoot(int num) // Insertion of a new Node with value
    {


        if (num > root.data) // When new Node is smaller then root
        {
            if (root.right == null) {
                root.right = new Node(num);

            } else {
                root = root.right;
                insertRoot(num);
            }
        }
        if (num < root.data) // When new Node is larger then root
        {
            if (root.left == null) {
                root.left = new Node(num);
            } else {
                root = root.left;
                insertRoot(num);
            }
        }
        return num;
    }

    public void print() // Printing Nodes in-order
    {
        System.out.print("Nodes organized in 'in-order' are: ");
        moveToNext(root);
    }

    public void moveToNext(Node root) // …
grisha83 26 Junior Poster in Training

hehe, i did hit enter. I am not sure if it will help you but the problem disappears if i remove reading of the user input in Switch in case 'I' and place it in my method. In fact, this is where I intended to have it in the beginning (i thought this would be cleaner). Well then i had another error popping up which only allowed me to enter up to 2 Nodes max but at least the program worked.

grisha83 26 Junior Poster in Training

Hello,
I am getting out of bound error whenever i run the program and trying to add a Node (this would be in my switch). but the error that i am getting is just above my switch statement. Can anyone help me to figure out what it is that i am doing wrong?

import java.util.*;
public class BSTTest {

 
    public static void main(String[] args)
    {
        // Creating Scanner object
        Scanner in = new Scanner(System.in);
        // Local variables
        boolean done  = false;
        char choice;
        String s;
        

        // Constructor call
        BinarySearchTree tree =  new BinarySearchTree();
        tree.DummyNode(29);     // calling on the Dummy Node


        while (!done)   // While statemnt that allows user to keep making selections until requested otherwise
        {
       System.out.println(" Please make a selection:");    // Requesting user to make selection
       s= in.nextLine();        // Reading input from the user as a String
       choice = s.charAt(0);    // Converting String to a Char

       // Swicth statement with selction alternatives
       switch(choice)
        {
            case 'I': 
            case 'i':

                int num;
                System.out.println("Please enter the value of the Node you want to add:");   // Reading user input
                num = in.nextInt();
                tree.insertRoot(num);  // This method is not working well. Only allows to input number once or twice and then something wrong happens
               // tree.search(29);
               // tree.print();
                break;
            case 'D':
            case 'd':
                tree.delete(1);
                System.out.println("test for D");
                break;
            case 'P':
            case 'p':
                tree.print();
                break;
            case 'Q':
            case 'q':
                done = true;
                System.out.println("test for Q");
                System.out.println("Thank you program has exited");
                break;
            default:
               System.out.println("You haven't made right selection. Please re-enter");
               break;
        }
    }
  } …
grisha83 26 Junior Poster in Training

Does anyone know whether 3G iphones will drop in price when the new ones come out? If yes, what is the expected price will be?
Thank you

grisha83 26 Junior Poster in Training

As per my knowledge, I think you should not check objects against null.... Problem with for loop..

You are right!

grisha83 26 Junior Poster in Training

My method is not working for some reason, even though i have done in exactly the same way the books showed.
Could you please take a look at it and let me know what went wrong?
Thank you
P.S. I tried to use DEBUG technique and it seems that the method doesn't even go through the list.

public static IntNode listSearch(IntNode head, int target) {

        IntNode cur;

        for (cur = head; cur != null; cur = cur.link) 
            if (target == cur.data){
                System.out.println("DEBUG" + cur.data);
            }
            else
              System.out.println("DEBUG" + null); 
        return null;

}

this is how i call my method in main my.listSearch(null, 21); // method does not work

grisha83 26 Junior Poster in Training

Thanks guys

grisha83 26 Junior Poster in Training

Hello,
I wrote an add method but for some reason it does not add more than 3 values. Could anyone tell me why?
here is my method:

public void addValue(int value) {
        IntNode cur = head;
        IntNode prev =  cur;
        IntNode t = new IntNode(value);

        if (value <= cur.data){ // if the value of the new node t is greater then the value of previos node
           
            t.link =head;    
            head =t;
        }
        else{
          while(value > cur.data){
            cur = cur.link;
        }
        t.link = cur;
        prev.link = t;
        }
    
    }

Thank you

grisha83 26 Junior Poster in Training

Thank you

grisha83 26 Junior Poster in Training

Thanks to everyone for explanations.

grisha83 26 Junior Poster in Training

Hello,
I was wondering why do we need to assign value of -1 to the top of the stack?
topOfStack = -1;
Thank you

grisha83 26 Junior Poster in Training

awk
um would you no of a website that does?
thnaks

Try Yahoo answers.

grisha83 26 Junior Poster in Training

Hello,
For some reason, my program prints out extra zero from my linked list
Can anyone tell me why?
Thank you

public class Main {

    public static void main(String[] args) {

        IntNode my = new IntNode(5,null);
        LinkedList list =  new LinkedList();
        list.createList(0);
        list.addValue(1);
        list.addValue(23);
        list.addValue(3);
        list.addValue(4);
        list.print();
        list.getLength();
}
}
public class LinkedList {

    private IntNode head;
    private IntNode next;
    private IntNode prev;

    public LinkedList() {
        head = null;


    } // Create(int value) – this method should create an integer singly list and return the head.

    public IntNode createList(int n) {
        while(head== null){
        head = new IntNode(n, head);
        }
        head.addNodeAfter(n);
        return head;
    }
    // Add(int value) – this function should add a value in sorted order (low to high) to the list

    public void addValue(int value) {
        IntNode cur = head;
        head.addNodeAfter(value);
        if (value <= cur.data){
            head=cur.link;
        }
        else{
            head=cur;
        }
        }

    // Remove(int value) to remove all the nodes with the value

    public boolean removeAll(int target) {
         IntNode cur;
        IntNode targetNode;
        targetNode = IntNode.listSearch(head, target);

        if (targetNode == null){
             return false;
         }

         else  {
            // I am not sure what to do next (ask Prof)
            head = targetNode.link;
         }

        System.out.println(" The List is empty, there is nothing to remove");
return true;
    }

    //	GetLength() to get the length
    public void getLength() {
        int count=0;
        IntNode cur= null;
      // while (cur.link != null);
        for (cur = head; cur != null; cur = cur.link) {
            count++;
        }
        System.out.println("Test for count:"+ count);
    }
//	Reverse () to …
grisha83 26 Junior Poster in Training

I don't think this is the right place to ask for a code :).
Is this a homework assignment? If it is you wont be able to get anything here.

grisha83 26 Junior Poster in Training

Hello,
I have an assignment where i have to create few methods using linked lists. one of them is method that should create an integer singly list and return the head. While i know how to add a single node i am not sure how to create list of them. Should i use something like a for loop or something?
Thank you

grisha83 26 Junior Poster in Training

Actually, please disregard my last reply. What i couldn't understand was how to actually create LinkedLists and Nodes. Apparently i have to create one class Node, and another class LinkedList then i have to initialize both and only then i can implement addition and removal methods.
Thank you

grisha83 26 Junior Poster in Training

It kind of makes sense. I guess my problem is not being able to imagine the design and implementation part of it. Sorry for jumping from one thing to another but i have read the chapter through and they have an exercise where i have to add new node and make it a second node. In case if there are no nodes i have to add it as new node. So here is my code. When i print my method output i get "test: IntNode @10d448", which tells me that i use wrong type of variable(passing improper data type) Am i correct?.
Anyway here is my code:

public class Main {

  
    public static void main(String[] args) {

        IntNode myint = new IntNode(20,null);
        //selection.addNewNode(3);

        myint.addNewNode(3, null);
        System.out.println("test:" + myint.addNewNode(3, null));
    }

}
public class IntNode {
    private int data;
    private IntNode link;

    public IntNode(int initialdata, IntNode initiallink){
        data =  initialdata;
        link = initiallink;
    }

    public IntNode addNewNode(int element, IntNode link){
        if (link !=null){
            link = new IntNode(element,link);
        }
        else{
            link = new IntNode(element,link);
        }
        return link;
    }

}
grisha83 26 Junior Poster in Training

Ok,
here is the thing its not a specific problem its just a concept but before i implement it i have to know how.
Let me try to create a problem so you can visualize what i don't understand:
lets say for instance i have 4 nodes 1st with value 10 that links to the 2nd with value 20 that links to the 3rd node with value 42 that links to the 4th node with value 30 that links to null(its a tail node)
so the book says if i want to remove node with value 42(3rd node) i have to set up a selection first and then implement a remove method:
...Activating the following method removes the node after the seleced node:
selection.removeNodeAfter();
implementation of removeNodeAfter needs only one statement t accomplish its work:
link = link.link;
so i am not even sure myself what they mean exactly

grisha83 26 Junior Poster in Training

Oops sorry,
I am using Java. Also, im not sure where i am using it. I was just reading my textbook and the author has noted that i have to select a node after which i want to input new node.

grisha83 26 Junior Poster in Training

Hello, I was reading a book and it says that when we want to add new Node that is not in the Head we have make a selection i.e. selection.addNodAfter(element), before we initiate our method. The question is where do i have to do this "selection"? in my main or how else do i implement it?
Thank you

grisha83 26 Junior Poster in Training

My bad,
here is the code fragment that is causing the problem I capitalized my comments next tho the line of code:

public void addAtBegin(int n, int m) // adding an integer at the beginning of the array
    {
        a = n;
        a1 = m;
        int i;
        
        if (a <= MAX_VAL)
        {
        int [] b = new int [a];
        
        for (i = 0; i < b.length; i++)
            b[i] = i;
       // System.out.println("test display:" + b[i]);

        for(i = a; i >= 0; i--)        // move all the integers by one
        b[i+1] = b[i]; // THIS RIGHT HERE IS CAUSING THE OUTBOUND ERROR
        b[0] = a1;
        
        for (i =0; i < b.length; i++)
               System.out.println("All Values of the Array including the new added value is: ");
            System.out.println(+ b[i]);
        }
        else
        {
            System.out.println("Error");
        }
        

    }
grisha83 26 Junior Poster in Training

Hello,
I am working on the problem.
Here is the wording:
6) Specify, design and implement a class that can store an array of integer. The number of Maximum element can be 100. Write methods to :
a. Add an integer at the beginning of the array
b. Add an integer at the end of the array
c. Remove an integer at the beginning of the array
d. Remove an integer at the end of the array
e. Insert an integer at any location except beginning and end
f. Remove an integer at any location except beginning and end
I am currently working on a and b.
I keep getting "outofbound" exception, which I can't resolve.
Can you help?
here is my code

Main//

import java.io.*;
public class ArrayMain {

    
    public static void main(String[] args) throws IOException
    {

        BufferedReader stdin = new BufferedReader(new InputStreamReader( System.in ) );
    int a = 0;
    int b = 0;
    String temp;
        ArrayC c = new ArrayC();

    System.out.println("Enter the size of the array so it can be filled: ");
	temp = stdin.readLine();
	a = Integer.parseInt( temp ); // convert inS to int using wrapper classes

    System.out.println("Enter an integer number that will be allocated to the approprite place in the array: ");
	temp = stdin.readLine();
	b = Integer.parseInt( temp ); // convert inS to int using wrapper classes
   
     c.addAtBegin(a, b);
     c.addAtEnd(a, b);
    }
}

//CLASS

public class ArrayC
{
    // …
grisha83 26 Junior Poster in Training

I think i get it.
Thank you for the thorough explanations.

grisha83 26 Junior Poster in Training

Hello,
I was wondering why do we need constructors with arguments?
Thank you

grisha83 26 Junior Poster in Training

Thank you. I was able to fix this bug.

grisha83 26 Junior Poster in Training

You should post your code in code tags. This way it will be easier to read it. If you look closely in the edit box you will see some help in the edit box that's in light-grey text.

// put your code here

And post entire program so people can help you

Salem commented: Well said +30
grisha83 26 Junior Poster in Training

Hello,
I have a program called Date. While this program compiles and runs, I have noticed something weird. I have an output line that displays my values twice.
Sample Run:
The word date output is: February 12 2009
The numeric output of the date is: 2/12/2009
The next incremented date is: 2/12/2009

The next incremented date is: 2/13/2009
Why is that? I have the same issue in my other program. There is something i am overlooking on the consistent basis
Any help will be appreciated:
Code:

// Main

import java.io.*;
public class Main {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args)throws IOException
    {
       BufferedReader stdin = new BufferedReader (new InputStreamReader(System.in)); // Calling on java class which allow to read user input
    // Local Variables
    String temp;
    int month;
    int day;
    int year;

    Date myDate = new Date();
    // Reading user input for month
    System.out.println("Please enter month in numeric format 1-12:");
    temp = stdin.readLine();
    month = Integer.parseInt(temp);                                     // Converting a string into int
    // Reading user input for day of the month
    System.out.println("Please enter day of the month in numeric format 1-31:");
    temp = stdin.readLine();
    day = Integer.parseInt(temp);                                     // Converting a string into int
    // Reading user input for the year
    System.out.println("Please enter year:");
    temp = stdin.readLine();
    year = Integer.parseInt(temp);                                  // Converting a string into int
    // Calling methods from a class Date
    myDate.outputDate(month,day,year);
    myDate.increment(month,day,year);
    }

}

// Class Date

public class Date …
grisha83 26 Junior Poster in Training

Thank you

grisha83 26 Junior Poster in Training

I have two methods. One method was to set location of 2 points x and y. Another method was to copy that location. I used arrays. Well the program compiles but it doesn't display my values properly. Error message says: [D@af9e22. Does anyone know what this is?
Thank you
// MAIN

import java.io.*;
public class Display {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) throws IOException
    {
        
BufferedReader stdin = new BufferedReader ( new InputStreamReader( System.in ) );   // Initiating a class BufferedReader
       // Variables to be implemented in called methods
       double x,y;
       String temp;

       // READING USER INPUT
      {
       // Reading x value
       System.out.println("x value: ");
       temp = stdin.readLine();
       x = Double.parseDouble( temp ); // convert temp to double using wrapper classes
       // Reading y value
       System.out.println("y value: ");
       temp = stdin.readLine();
       y = Double.parseDouble( temp ); // convert temp to double using wrapper classes
      }
     // Calling methods
     Point d = new Point();       // Initiating a class
     d.setLocation(x,y);              // Set Location method call
     d.pointsCopy(d.setLocation(x,y));

     System.out.println("Coordinates of points are:" + d.setLocation(x, y));
     System.out.println("Copied values of setLocation method are: " + d.pointsCopy(d.setLocation(x,y)));
    }

}

// CLASS POINTS

import java.util.Arrays;

public class Point implements Cloneable
{

    // instance variables 

    double points [];
    double x;
    double y;
    /**
     * Constructor for objects of class Position
     */
    public Point()           // This is a no-argument constructor
    {
    // initialise instance variables to zero
    double points [] = {0, 0};
    double x = 0; …
grisha83 26 Junior Poster in Training

Hello,
I was trying to get hold of arrays and read lots of stuff.
So when i started coding, i got an error message saying incompatible types. I checked with general compliance and it should be ok. Maybe netbeans causing it?
Anyway, any kind of help will be appreciated

public class Point implements Cloneable
{

    // instance variables 

    double points [];
    double x;
    double y;
    /**
     * Constructor for objects of class Position
     */
    public Point()           // This is a no-argument constructor
    {
    // initialise instance variables to zero
    double points []  = {0, 0};
    double x = 0;
    double y = 0;

    }

    /**
     * setLocation()
     * This method sets initial location of a point in 2D
     *
     * @param  x,y all doubles 
     * @return   array points
     */
    public double setLocation( double x, double y)
    {
        // Temporary variables that take values from the user input
        
        points [0] = x;
        points [1] = y;

        System.out.println("Initial location of points is: " + points);
        return points; 
    }

}
grisha83 26 Junior Poster in Training

Thank you

grisha83 26 Junior Poster in Training

Hello,
I feel embarrassed to ask these types of questions but i can't get answers to them in my text book. So here you go:
I have an assignment of copying the constructor writing clone() method and add() method. While i understand the idea of creating of clone and add methods i am having difficulty understanding why do we need to copy a constructor? And also, where do we copy it to? Should i create a separate class to copy the constructor or should i do it in the same class?

Thank you

grisha83 26 Junior Poster in Training

Thank you. I had it fixed

grisha83 26 Junior Poster in Training

Hello,
I am working on the problem of creating an abstract class Shape also with Package shape and then creating a subclasses Circle, Square and etc.
I belive, i don't have a complete understanding of an abstract. Anyways i keep getting an error: " Shape.Circle is not abstract and does not override abstract method perimeter() in Shape.Shape
I am not sure what that means. Does anyone know whats going on?

Here is my main, abstract class and subclass circle:

// Main
Package Shape;

import java.io.*;
public class Main {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) throws IOException
    {

        BufferedReader stdin = new BufferedReader ( new InputStreamReader( System.in ) );       // Initiating Input Stream from the user

        String temp;
        double r;

        Circle c =  new Circle();           // Class Circle initiation
        Square s = new Square ();           // Class Circle initiation
        Rectangle rad = new Rectangle ();   // Class Circle initiation
        // User input reader
        System.out.println("Please enter the necessary component to calculate the area (radius, side etc.): ");
        temp = stdin.readLine();
        r = Double.parseDouble(temp);
        // Circle output
        System.out.println("The area of a Circle is " + c.area(r) + " squared units");
        System.out.println("The perimeter of a Circle is " + c.perimeter(r) + " units");

// Abstract class Shape
Package Shape;

abstract public class Shape
{
    public String color;

	public void setColor(String c) {
		color = c;
	}
	public String getColor() {
		return color;
	}
	abstract  double area();
    abstract  double perimeter();
} …
grisha83 26 Junior Poster in Training

Hello,
I am having a hard time with understanding arrays and most importantly implementing them in methods and etc. Does anyone know a good source to learn about arrays from a to z? I m looking for things like book, website or some other media. I do know about Sun micro systems but i dont find them helpful in this particular area. I really need to nail down these guys. Any help will be appreciated
Thank you

grisha83 26 Junior Poster in Training

Hello,
I am having a hard time with understanding arrays and most importantly implementing them in methods and etc. Does anyone know a good source to learn about arrays from a to z? I really need to nail down these guys. Any help will be appreciated
Thank you

grisha83 26 Junior Poster in Training

Thanks Bunch!
Very explicit and efficient reply

grisha83 26 Junior Poster in Training

Hello,I have a user input and trying to write a precondition that will give an error if the user inputs number or some other odd character (except ' and .)
I am thinking of writing and if statement that if my search method finds anything like that it will prompt user to re-enter. The problem is i dont know how to implement the search method. Can you help me?

here is a small piece of my code:
[ System.out.println("Please enter name of the employee:");
name = stdin.readLine();
if ("search will find numbers or weird characters in the input")
then
{

}
]

grisha83 26 Junior Poster in Training

I see
Thank you for the insight

grisha83 26 Junior Poster in Training

What language are you programming in?

Sorry, its C++

grisha83 26 Junior Poster in Training

Hello,
does anybody know how to read in the data from a file into a program and vise versa when i am programming on mac? To be more precise, i dont have a txt., i only have rtf. extensions. Every time i run the console, i get an error message that the file cannot be found.
Thank you

grisha83 26 Junior Poster in Training

Hello,
I am working on small program that reads in a string consisting of minimum two words and a space between them. My dilemma is that i keep getting an error message. Can anyone twlm me what it is that i a ding wrong?
here is my code:

#include <iostream>
#include <string>
using namespace std;

// Prtototype
void stringmod(string, string&, string&);


int main()
{
    string string_in;
    string string1;
    string string2;

    cout << "Please enter the string with spaces: " << endl;
    cin >> string_in;
    stringmod(string_in, string1, string2);
    cout << string1 << string2;
    return 0;


}

// Function Definition

void stringmod( string string_in, string& string1, string& string2)
{
    string positionSpace, length;

    positionSpace = string_in.find (' ');
    string1 = string_in.substr(0,positionSpace);
    string2 = string_in.substr(positionSpace,string_in.length()-1);
}
grisha83 26 Junior Poster in Training

Hello,
it the same old program calculator
i have corrected errors that were preventing me from running the program. Now that i have done it i am facing another issue; It doesnt perform needed computations such as +-* and etc. It must be my switch fn. Any help will be appreciated

#include<cmath>
#include<cmath>
#include<iostream>
#include<string>
using namespace std;


// Functions prototypes
void instruct();
char displayMenu(char);
float do_next_op(char, float, float);




int main()
{
	char Q, q;
	char choice;				// option to the user to quit or to continue
	char oper;
	float accumVal = 0;;
	float num;
    string input;

	 // Instructions function

	instruct();					// Greetings and Instructions


	do
	{

	    cout << "Please enter the operator first and then the number or type q or Q to exit     the program: " << endl;
        cin >> input;
        
	    oper= input.at(0);
	    accumVal = do_next_op(oper, num, accumVal);
	    cout << accumVal << endl;

	} while (oper != 'q' || oper != 'Q');


	cout << "Your Final Result is: " << accumVal << endl;

	//cout << "Please type in your choice: " << endl;
	//cin >> choice;		//choice = displayMenu(choice);			// Menu function call


	system("pause");
	return 0;
}

// Functions defenitions
float do_next_op(char operat, float num, float accumVal)/*The function below deteremines  the
														 user input and does the appropriate calculations*/
{

	accumVal = 0;
	cout << "Please choose your command: " << operat << endl;
	cin >> operat;

	switch(operat)
	{
		case 'q': case 'Q':
			cout << "Your Final Result is: " << accumVal << "Thank you for …