peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

I think you come to wrong forum. We do not do others people homework/coursework/assigments, we try to help and solve problems with in code you already writen.
So if you did your work and have problem with code, please kindly post your code with problem description and we will try to help you.
Otherwise do your job and come back when you face difficulties...

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

I think you forgot to change URL to string, so you can't apply String method replaceAll() to url
This can help you

import java.net.URL;
import java.net.MalformedURLException;

public class ReplaceChar
{
	public static void main(String[] args)
	{
		try
		{			
			URL url = new URL("http://www.peter-peter.pe");
			url = new URL(url.toString().replaceAll("e", "i"));
			System.out.println(url.toString());
		}
		catch(MalformedURLException mue)
		{
			mue.printStackTrace();
		}
	}
}
peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

take it like this, you have three classes
One.java(have the main)
Two.java
Three.java

One can call any method of two and three. Two and three can call method of each other but can only do computing for one or they will return some values once they finish they job.

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

There is only one main!
So there is your problem ...

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster
input = stdin.readLine();

does return string and you are looking for integer. Does it help :cheesy: ?

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

nice explanation on wikipedia

bellow is how do I get data from my db about events in calendar

CalendarData[] eArr = new CalendarData[exists];
try
{				
	int i=0;
	strQuery = "select event_type, ev_date, ev_time, ev_description from calendar_events where userName='" + strUser + "' and cal_id='" + calId + "'";
	rs = stmt.executeQuery( strQuery);
	while( rs.next())
	{
		eArr[i] = new CalendarData();
		eArr[i].setEventType(rs.getString("event_type") );
		eArr[i].setEventDate(rs.getString("ev_date") );
		eArr[i].setEventTime(rs.getInt("ev_time") );
		eArr[i].setEventDescription(rs.getString("ev_description") );
		i++;					
	} // end while loop
	session.setAttribute("eventArray", eArr);
	CalendarData[] test = (CalendarData[]) session.getAttribute("eventArray");

Also do not connect to DB from JSP use servlets

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

If you can be specific about confusion on loops, arrays and if/else we can try to help you. Also there is always java tutorial site
if/else
switch
do-while/while
for
array

and do lot of practice

volscolts16 commented: Thank You the Java Tutorial looks like it might be a big help. I appreciate it!! +1
peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster
if (iInput == 1) {
        newcd();
        }    
        if (iInput == 2) {
        artistdisplay();
        }
        if (iInput == 3) {
        genredisplay();
        }
        if (iInput == 4) {
        yeardisplay();
        }
        if (iInput == 5) {
        ratingdisplay();
        }
        else {
        System.out.println("Thank you for using CDSystem");
    }
    }
}

If I understand correctly you try call this methods to do something?
I don't see any place in your code where you declare it, so I asume there in other class. To call this method from second class you do following

SecondClass secondClass = new SecondClass();
if (iInput == 1) {
        secondClass.newcd();
        }

Hope this helped, if not please provide detailed problem description

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

Why don't you store whole databse into bean and then on button press request next set

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster
peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

There is nothing wrong with that code , are you shure you didn't made any adjustment on the code?

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

Would you mind post rest of the code? As from that one line we can't find anything

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

I don't know what is the purpose if that port number over there?
I posted small part of code which I usualy use in other thread http://www.daniweb.com/techtalkforums/post316412-2.html
so you can have look and compare it with your one

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

So how do we go about it in simple enviroment where most schools/universities use Tomcat and MySQL? I found (didn't know before) that my login data are stored in tomcat-users.xml under conf folder.

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

jwenting, can I ask why to pass username and password seperately? Is there any particular reason or it is your profesional recomodation? I'm interested as I usualy do it the way as the code above shows...

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

First thing, please do not use JSP to connect to database. Pass data to servlet for validation, or use JavaScript to valildate them in JSP, and setup connection inside servlet and then by the needs go back to previous page to pick up correct/new data or move to nex page
this is usual peace of code which I re-use often

public class SomeClassName extends HttpServlet
{
Connection conn;
Statement stmt;
	
public void init() throws ServletException
{
	try
	{
		Class.forName("com.mysql.jdbc.Driver").newInstance();
	}
	catch (Exception ex)
	{
		System.out.println("Exception is : " + ex.toString() );
	}
}
	
public void doPost( HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
{
	try
	{
		conn = DriverManager.getConnection("jdbc:mysql://localhost/" 
													+ "database_name?user=my_username&password=my_password");
		stmt = conn.createStatement();
	}
	catch(SQLException ex)
	{
		System.out.println("SQLException : " + ex.getMessage() );
	}

PS: I will request this post to be move to JSP section, it is where it actualy belong and where you can find more similar questions and answers

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

I never heard that something like that happens, as long you designed your database properly it will never ocure. The primary key is unique for only one user or item

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster
select max(table1_id) from table1
peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

I think you should reconsider your for loop

for(i='A';i<'D';i++)

I never heard that in java you can increase value of character type variable, this is possible but in Perl
Create array of characters and with use of "i" get the character from the array
so if char[] myArray = { 'A', 'B', 'C'}
then if i = 1
you get character B

ajay_tabbu commented: nice +1
peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

I think you didn't read the rules of this forum, we help here to people which willing to learn and we do not produce code on demand. There are other sites where they will happily do it for you just don't forget ready your "plastic money"

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

it has nothing to do with JSP either (and anyone doing something like this in a JSP should be shot, preferably in the gut, and left for the vultures).

Hmmmm, was this addressed to me :?:

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

Did you tried a random function as I sugested???

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

I did few small changes to your files

CARDS change in card constructor

public Card(int f, int s)
{
    // initialise instance variables
    face = f;
    suit = s;        //you had suit = SPADE
}

DECK change your constructor public Deck() (with 2 for loops) to a method to initialize cards, I call it public void setCards()

DRIVER use the new method setCards() before you suffle cards

if (choices[0].equals((String) selected))
{
            inDeck.setCards();
            inDeck.shuffle();
            System.out.println("card mixed");
            playCards();}

I would create random function to get my set of cards and check if these cards hasn't been dealt. So dealt cards should be store somewhere :?:

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

good day ,

i am new to java ,

i am using two different databases and i want to insert data from one table to other empty table using jdbc .and it consists of null values in one table along with some data .when ever we add new data to one table it should insert into other table and existence data should be updated after insert is executed.

can i have one example with these details.

Sorry, I don't see any problem with this as all datas which you save in first database are still stored in their original variables plus same string you use on first database can be send to second one, or may be modified before sending as neccesary. So what you do I presume is recive data from form, validate them, store in varables, open conection with first database, save data, close conection, open connection to second database, save data and close connection. Then go to other page or refresh original...

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

Yes you can runn PHP on same machine, even on Tomcat but that is more complex to set up

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

you need just one instalation and I would recomend you follow the setup from website to which I gived to you link

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

When do I finaly learn where to use this bracklets ;) ?
data.length will return size of your array so you do not have to exactly say loop only 4 times then stop, you just ask for size of array and loop till you get last element in array

your index is just variable which you declared and then you tried to increase its value with each loop. To do this with index = 1, you get infinitive loop.

Plus you don't have to declare "i" outside of for statement

Nice job cassyjack, you doing well. Nice to see some mebers which do not only ask for code but actualy do their workload

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

what about this

int i;
int index = 0;
int largest;
largest = data[0];
for(i =0; i < data.lenght(); i++)
if(largest < data[i])
{
largest = data[i];
index = i;
}
return index;
peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

First instalation is the one which you need as you only wish to practice on your home pc/laptop. The second option is to setup hosting service I believe.
There is plenty of good tutorials on net, I personaly like this one http://mpcon.org/apacheguide/jsp.php which shows you how to set also Apache with PHP, plus MySQL, My phpAdmin and Rubby (you may want to install MySQL later on)

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

no-argument constructor is your one

public Circle()
{
diameter = 30;
xPosition = 20;
yPosition = 60;
color = "blue";
isVisible = false;
}

constructor with argument is something like this dude

public Circle( int d, int x, int y, String str, boolean b)
{
diameter = d;
xPosition = x;
yPosition = y;
color = str;
isVisible = b;
}

you want to past values and not to set them default only... :mrgreen:

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

onclick="document.answer.Tim10.value = 'Having papers from the registering body that attest to their ancestry. A tracking registry.';"

IS NOT a JavaScript, it is only action taken once button pressed, which will triget this action. So as it is on its own that code will do nothing

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

Secondly what you provided is not JavaScript only onClick action which take place on press of submit button. So put one and one together you are trying to steal somebody's work and have no idea what JavaScript is

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

thanks alot let me try that

mate get copy of Deitel & Deitel JAVA How to Program 6th Edition and look up chapter 24 Case Study (but don't try to cheat your teach will know it :twisted: )

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

didn't know that you want to slice so many images. I see only two options then, 1st to try get in touch with person who came up with this script and ask him directly or 2nd try to find forum which is more related to photoshop. I'm not saying that daniweb hasn't got one but it is rarely used and often i'm answering questions over there

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

wouldn't be easier to use ImageReady which you have with your copy of Photoshop and manually slice image then use dodgy script?

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

Can you please tell me what exactly you are trying to do so I can help you more efficiently?

Just collect some info from user and display it on other page or you want to store it somewhere and use on different palces on your site?

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

what you have to do is design a bean which will hold what ever information you want to and pass to any other page on your site
this can be done before a link was clicked or when you click link you run process which set-up bean for you, then on other side you just call bean and pull your info from it

there is plenty of tutorials on google

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

lol, had similar coursework

took me 2 days to finish it :cheesy:

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

This should give you basic idea

http://www.cryer.co.uk/resources/javascript/script13_gallery.htm#_self

plus you need to implement random number generator

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

I don't think so, usualy you can get a site for £4 a month. Best thing is to instal Tomcat on your pc together with database(MySQL) and practice there

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster
Debug[B]1[/B] d = new Debug1(); // this was Debug d = new Debug();
peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

[Hey Guys
:eek:
Im having mega issues uploading my files from dreamweaver to my host... leesonwedding.com. Im not sure whats up but it is not putting the dependant files. If anyone has any suggestions it would be greatly appreciated.

bassettbrandi2@hotmail.com]:!: :lol:

sorry I didn't get it what you mean by dependant files?

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

JCreator is very simple to use. Just create new document give it jsp extension and point to place where you want document to be saved. Than do your coding and compile. Everything done. Be carefull with beans which are usually placed in separated folder than rest of classes( folder classes holds your compiled java files and some people like to put there another folder called beans). What I mean is, if beans saved in other directory then servlets, JCreator will create new folder inside beans called beanes and put there your compiled bean classes. Once you try run your servlet you get error telling you your bean classes can't be find

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

Is firewall configuarted to allow Dreamweaver access Internet?

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

help with the path for servlets

I'm runnning Tomcat Appache 5.5.15 wth JAVA 1.5.06. To get servlets run on my laptop I only copied and past servlet-api.jar & jsp-api.jar into following directory

C:\Program Files\Java\jdk1.5.0_06\jre\lib\ext

which is where java is installed

you can find this jar files in tomcat as follow

C:\Tomcat 5.5\common\lib

and to setting path for java, don't forget put on end of path semicolum " ; " or some pc refuse to work with java

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

No, because you will always access this bigones no matter how mutch you resize them, their are still same data size. You better do scale-down version of them.

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

Sorry my friend, you are in wrong forum. This JavaScript and DHTML for developers. You should go here

http://www.daniweb.com/techtalkforums/forum29.html

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

You my do that by simply applying filter settings to img tag

<img src="yourimage" style="filter:DropShadow(color=#C0C0C0, OffX=25, OffY=10)">

Is this what you whant type css filter: DropShadow in google and there is lot of examples like this two

http://www.fred.net/dhark/demos/css/css_filter_examples.html
http://www.w3schools.com/dhtml/dhtml_css.asp

Hope this is what you are looking for

peter_budo 2,532 Code tags enforcer Team Colleague Featured Poster

I am still new to CSS, how would I add a drop shadow around the main conent of this page? www.racexpressions.com I have been trying for a while but I can't seem to get it to work. Thanks!

Do you mean somting like this

<div style="height: 125; width: 400; filter:DropShadow(color=#C0C0C0, OffX=10, OffY=10)">
Text with shadow
</div>