verruckt24 438 Posting Shark

I didn't see the dates at all. Sorry. @sarath_p_j: The OP has long gone.

verruckt24 438 Posting Shark

Go through the javadocs, endsWith() is a method not a return value. Also I suggested you using the split method. Read the javadocs for the String class.

verruckt24 438 Posting Shark

You could use the split method to split the filename on the period (.) then check what the latter part of the splitted content contains you could behave accordingly say return "Text File" if it contains .txt and "Non-text File" otherwise.

You cannot return anything apart from true/false from a method that returns a boolean after all thats what it is supposed to do, if you need to return multiple values say "Text File", "Executable file", "Image File" then why not return a String ?

verruckt24 438 Posting Shark

State the exact error you are getting, or the part of the code that isn't working according to plan.

verruckt24 438 Posting Shark

No problem in the class. When you run the program you need to use just the class name drop the .java file extension. javac invokes the compiler and transforms the source file (.java) into a bytecode file (.class) then you run the program by supplying the compiled bytecode file (.class) to the java command that invokes the JVM.

verruckt24 438 Posting Shark

I used to use Firefox previously now I like the lightweight Google Chrome. But it is true that firefox has some best add-ons xmarks,download manager and Adblock plus so in my opinon yes it is the best one around.

Also I have noticed while developing web apps that IE produces some of the best rendered pages with great texture, buttons etc and the entire page sort of takes a new life so that if i am giving a demostration of some web app we created with gr8 themes, looknfeel etc I would prefer IE over firefox.

verruckt24 438 Posting Shark

I am using CruiseControl Binary Release 2.8.2 and I am sending mails using this. I can only send the url for log file generated by the software. So I need to add some text to email body and attach a file. So can you please tell me how should I edit config.xml file for this?

I don't think this is a Java Question, check the software's manual/guide for this.

verruckt24 438 Posting Shark

@OP: On reading your question again, I guess you are asking for something different. Elaborate on your question.

verruckt24 438 Posting Shark

Firstly, an abstract class from definition contains atleast one abstract method so this means that not every method in an abstract class should be abstract. So if the add() method is identical for every student you could place it in the Student class instead of the specific sub-classes. This way you would have saved yourself the effort of writing three identical methods in three different classes. Also this is good for maintenance as you will soon learn.

Secondly, as you want a more convenient option of inserting the elements into the db what you could do is to write a method say insertToStorage() in the Db class that takes parameters to be inserted into the db pretty much like a SOP does and then puts them in the database. This will abstract away the database communication from your class and will keep it restricted to the db class itself. This is also good from another point of view which is say tomorrow if you need to change your storage to a flat file instead of a db then you do not need to change all of the sub-classes but you need to simply implement a file-storage specific class that offers a similar method insertToStorage() and your storage would have changed in minutes.

About the opening/closing of database connections, yes you would have to open/close connections for anything that you would want to do involving a database. But through the database specific class your connection handling and other db …

verruckt24 438 Posting Shark

I guess you need to return from a method whose return type is declared as void. Just put the return keyword without specifying anything after it.

public void check(){
// code for the method
return;
}
verruckt24 438 Posting Shark

Why is everybody handing out code snippets to the OP here ? Since when did it became the most easiest way of giving solns ? Not to mention some of you have got the assignment wrong completely.

If you could see two of the more senior posters here have both given the solution without providing the code for it. Thats the way it should be done, you make him understand the solution by outlining steps using pseudocode, Simple English etc but I guess not many people here know that way.

verruckt24 438 Posting Shark

Why is everybody handing out code snippets to the OP here ? Not to mention some of you have got the assignment wrong completely.

If you could see two of the more senior pros here have both given the solution without providing the code for it. Thats the way it should be done, you make him understand the solution by outlining steps using pseudocode, Simple English etc but I guess not many people here know that way.

PS: I don't know how and edit caused it to be posted twice, just ignore the next post of mine.

verruckt24 438 Posting Shark

Check the signature for the main method.

verruckt24 438 Posting Shark

>AbhikGhosh

What do you think you are doing by giving away code like this ? It is for him to do and for us to help him do it on his own, thats the whole essence. I suggest you try to avoid this in the future.

verruckt24 438 Posting Shark

Hmmm, I guess you missed the "We-offer-help-only-to-those-who-show effort" theme of this site. Please take a careful look around and while you are it drop the IM/chat speak we give more respect to full words. ;)

Salem commented: Yes! +19
verruckt24 438 Posting Shark

From what I have understood you need to do, it is something like this:
You have created/worked on the project on a different computer on eclipse and now you want to switch the machine for some reason. If this is what you need to do, follow the below mentioned:
1. From the main menu bar, select File > Import.... The Import wizard opens.
2. Select General > Existing Project into Workspace and click Next.
3. Choose either Select root directory or Select archive file and click the associated Browse to locate the directory or file containing the projects.
4. Under Projects select the project or projects which you would like to import.
5. Click Finish to start the import.

This is straight from the Eclipse Help Contents, for further details select Help Contents from Help menu and type "importing existing projects".

Tell me if this helps.

verruckt24 438 Posting Shark

You are going right here such a menu would require a nested switch implementation which you are on your way to do, so what are the errors you are getting and where do you need our help ?

Also stop starting multiple threads for the same question, be patient if the replies take time to come by and more appropriately please read the replies if someone has already written them.

verruckt24 438 Posting Shark

The problem is in these two lines:

if (User = textLogUser)

and

if (Pass = PassEcho)

User and Pass are strings whereas textLogUser is a JTextField and PAssEcho is a JPasswordField. Also you are not even comparing here, what you assume to be doing, but rather just assigning these values to the Strings directly. If you need to compare the values from the text/password fields to the ones in the Strings what you should be doing is this:

If(User.equals(textLogUser.getText()))

and

If (Pass.equals(new String(PassEcho.getPassword())))

Note: We are using the getPassword method here which returns a char [] and hence we use the String class' appropriate constructor to convert it into a String object before being passed to the equals method.

verruckt24 438 Posting Shark

> AbhikGhosh

Firstly, the getActionCommand() methods of the ActionEvent class returns a string which he is comparing to another string using equals, thats correct behaviour. And secondly the toString method will not necessarily return the action command associated with it, but the string representation of the object. It depends on how the toString() method is implemented in the lowest class in the hierarchy, since the toString method belongs to the Object Class.

verruckt24 438 Posting Shark

I have not gone through your code, but from what you suggest about the task at hand I guess you would have to do something like this:

1. Print a menu/ or Show GUI about various operations/tasks a user can perform. Such as Add Char, Edit Char, Remove Char, Search Char etc
2. Then print a menu/ show GUI depending on the initial menu selection. Say for example in the Add Char menu you might first have to ask the name of the character, then the race class, other details etc. For the Edit Character menu you would first have to ask for a character name to be edited, then search the character in the existing db and allow the character to be modified if such a character exists and so on and so forth for the remove and search menus.
3. Once you gathered added/modified information for the character you need to bother yourself with the manipulation of such information in the database. This can be done by connecting with a database through a driver using JDBC. As you say if you aren't aware of what database connectivity and JDBC is you can find more information about it here.

I suggest you could write classes dedicated to each function such as one for showing the GUI/ or a menu class, one for implementation of the business logic say for example if you want to work upon the characters and their values in anyway …

verruckt24 438 Posting Shark

Please use code tags while posting code. Also mention the section that you are getting this particular error in.

Incompatible type errors are generated when the compiler expects an identifier to be of a certain type and finds one having another. So just try and find out if you can where such a situation might be happening in your code.

verruckt24 438 Posting Shark

Hi,

Can anybody point me out to good resources on "automating form filing and submission through Java App". The various types of forms are as given below:
1. Standard form with Form_Name, text boxes and submit button
2. Standard form with Form_Name, text boxes and submit image or JS based submit
3. Standard form without Form_name.
4. Standard form without submit button/image
5. HTACCESS based pop-up browser window login

I kinda searched the net but without much success, if anybody has a good article or some similar stuff putting light on this particular topic it would be of help.

Thanks already.

verruckt24 438 Posting Shark

new keyword dynamically allocates memory for an object..

http://java.sun.com/docs/books/tutorial/java/javaOO/objectcreation.html

refer to the above link....
and you two plz dnt fight here....its nt a battleground..

Good you woke up from your sleep, but before posting please check the dates. Nobody was fighting on the thread and whatever the matter was was long closed before you decided to reopen it by bumping the thread. And one more thing the OP is certainly not waiting till now to know what the new keyword really does.

verruckt24 438 Posting Shark

I have no idea as to what to do.

Well in that case a simple solution is to go back and ask the assignment giver for a more detailed explanation on what to do.

verruckt24 438 Posting Shark

Hi MARUN,

As I see there are some discrepancies in your queries here. First you say that you want to limit the entrants to 20 but then in the second one you say you want to limit the enquiries to 20 so that has me a bit confused over your actual requirements but here's my suggestion from what I have understood, point out if I am wrong.

My suggestion is similar to what kylegetson has offered but it has one critical change, since a web form can be seen by n number of people simultaneously instead of checking the rows prior to generating the form you can generate the form unconditionally and then just check while inserting if the rows are <20, if they aren't you can generate a friendly message informaing them of the event or instead you could also add them to a different table registering them early for the next's months batch and informing them accordingly.

verruckt24 438 Posting Shark

Firstly languages such as Java do not offer such "consealing" feature cause they are not meant to be used that way. Secondly as masijade has rightly pointed out executables are not all safe. Though it requires good knowledge of such they can be broken too.
Read about obfuscation and what it does in order to make your code "unfriendly" or harder to understand to others. But this too isn't 100% safe rather quite far from it.

The only way to protect such source code is through the use of appropriate licenses that prohibit others from using your code in a way different from the one you intend them to use.

This has been well mentioned by the then moderator and current super mod s.o.s and masijade in a previous thread, you can find it if you want.

verruckt24 438 Posting Shark

Firstly is there any criteria as to on which you could separate the data ?
Say for example if there is any auto_increment field you could certainly use this to tuncate only those rows with id <= last_id, if not is there any timestamp value which could be used in the same way.
If there are such fields it would most rightly serve you to take the dump without locking the tables and then truncating accordingly, since locks are always going to hinder performance. Also if the dump takes a lot of time to finish, other insert/update processes might get a "lockwait timeout exceed"

If the above is not feasible due to absence of such a column on which rows could easily be separated, then what you could do is before starting with the mysqldump, create a table identical to the original one with the 'CREATE TABLE %tablename%... AS SELECT * from %originaltablename%' syntax then run mysqldump on this table and then finally drop the duplicate table. This wouldn't require locking at all (apart from the one that the mysql server itself would enforce while creating the table) and inserts could go on on the original table while you are taking the mysldump of the duplicate table.

If both the above mentioned options aren't feasible to you, you could use explicit locking on tables during the mysqldump and truncate commands and release them only after the truncate command has finished.

verruckt24 438 Posting Shark

ask the user for a year and a month in numbers. Output the number of days in a month. Be careful of leap years

Full marks for putting down the question correctly, now lets see what you do about the answer.

BestJewSinceJC commented: haha. very good. +8
verruckt24 438 Posting Shark

This code snippets shows how to reverse a string using a stack.

verruckt24 438 Posting Shark

I have seen several posters asking for help on programs converting an Infix expression to a Postfix one. I have written a program to convert a simple Infix expression to a Postfix one so that people here can be directed towards some sample code from which they get the idea to writing one. I have also provided comments describing what the code part is supposed to do in that block, the idea here is to discourage blind copying and to encourage the understanding of the program. Once the idea behind such a program is undestood, even a beginner can write one for himself.
There can be many ways in which a particular solution can be implemented, this impementation is based on this text.
Lastly I want to mention why I call this program one that converts a simple Infix expression. Thats because I haven't written it to take into consideration complex expressions with paranthesis in them, also I haven't written it for an exhaustive list of operators (the operators I have taken into account are mentioned in the source code). Programmers can take an hint from this simple program and add their own additions to it.

verruckt24 438 Posting Shark

If I have to develop a project I'd rather like it to be some topic I am fantastically interested in, so I'd rather suggest you dig deep into your mind to find concepts/ideas that you really find your natural interest in and I am sure you wont have to dig too deep, the ideas would soon start flowing.

If you aren't able to draw ideas of your own, I suggest to roam the net finding about about enough topics from which you can find one to interest you.

To list out a few of my favourites, I am interested in Data structures and Algorithms so Trees, Hash tables, etc find my interest always. To make a project involving one of this, I would very much like to make a Constant Database in Java, or a Tree based Search algorithm, or a Compression algorithm in Java etc.

To find out what a constant db is consider google your friend. ;-)

Salem commented: Well said +36
verruckt24 438 Posting Shark

P.S. Some people will never change. They are always whining.
Bah! Nevermind.

Suits me if the whining is about correct things, Which if you follow the thread you will come to know, but alas...you opted not to.

verruckt24 438 Posting Shark

I looked at the manual and did not understand it. I like forums where people post their own examples and not just refer to "manuals"

Yeah why would newbies like you like to take any pains preparing your food, when it is thrown ready made at you, what you say is pretty obvious for your kinds.

And FYI the "referring to manuals" or any other information/resource thing that you are cribbing about is sort of the culture over here, go read the rules, they clearly say "we offer help only to those who show effort" and I afraid but the "effort" on your part and on the part of similar people like you is often severely lacking.

verruckt24 438 Posting Shark

The environment of my application is as mentioned below :

The application is a Router/Accounter library used to identify an appropriate Route (and also the price for that) when a destination for a Mobile number is queried through the API. The Route to be used for sending an SMS message depends on two things the, one the destination prefix and the two the user/client sending the SMS message.

To explain the environment in more detail, lets say an External application queries my library with details of a mobile number say 919833XXXXXX, and user say smssender. Now the route to be used for sending this message will be identified by checking if the user is have a mapping for any of the prefixes in the destination say 91 or 919833. This is where my problem lies. Given a destination I want to find out all the prefixes for the destination and then check if the user has a mapping for any of these. I am currently using a HashMap to store the Prefixes (from the Prefix master) as Keys and their details as the Values. So to find a prefix I simply run a

containsKey()

method with a substring of the destination which gives me the prefix.

I want to know whether is there any faster more optimized way to do this search, maybe some data structure which is more suitable to such lookups than the HashMap or anything else that would possibly optimize my looking up …

verruckt24 438 Posting Shark

It is unclear what you exactly want to achieve. Bot hof your queries are identical.

verruckt24 438 Posting Shark

Could you copy and paste your code? Have you used any css?

so use regexp for this issue.

Whats code got to do with it ? And what the hell is the css doing there in a question related to MySQL ? And how are you going to use regex Mr. ? If you don't know the answer don't post there's no point in pointing someone in the wrong direction or even asking unnecessary questions.

@OP : Use the REPLACE function in MySQL.
http://dev.mysql.com/doc/refman/5.0/en/replace.html

verruckt24 438 Posting Shark

www.mysql.com should be where you should be looking for all materials. Reading about, working with and trying out different things is what would be the best possible approach for gathering knowledge.

So download the MySQL Server, install it (following the guidelines mentioned in the reference manual) and start working out different things with it. MySQL Server's reference manual is considered to be the best source of information about it. It is more than 2000 pages long, with detailed information about the internal working of all things. You can download the manual from the site's documentation pages. Working with the reference manual you can try out the different configurations of the server and get to know which is best suited for what type of use, you can learn about all the data types and how to use the disk space judiciously by assigning the best suited data type for a parameter, you can find out the different storage engines or tables types and what typr of locking mechanism do they use, figure out which storage engine is capable of doing what and hence when to use which, the manual also lists about optimizations that could be done so that your database achieves best performace and a lot of other things that informs you about the best practices of operating a MySQL Server.

You could also look at the Certifications offered by MySQL, these are a way of assurance of your knowlegde to a prospective employer. So you …

verruckt24 438 Posting Shark

thanks verruckt24, but the link don't contain exams for 310-065.....

Yes those questions are for SCJP in general, but you could as easily search for the required exams' mock questions in google. :)

verruckt24 438 Posting Shark

Here are many links to SCJP mock exam questions. Also if you need some more you can search "SCJP Mock Exam" in Google anytime ;)

verruckt24 438 Posting Shark

Hi all I need to read an Excel sheet using java and I need to know how many columns are there in that excel sheet. Please drop a code snippet to this thread

Don't ask lamely for ready-made code snippets no one's going to give you that.

If you are ready to do something for your self take a look here : http://poi.apache.org/

verruckt24 438 Posting Shark

Do you need to do this automaticaly all the time?
If it is just something you need to do once in a while and would like to see the differences graphically I would suggest you use our tool SQLMerger for this, this is an easy and a preferable solution.

What is the syntax error you get?

The first view should be:

create view john_doe_rentals as
select b.bid
from sailor s, boat b, rental r
where s.sid = r.sid and ( s.name = 'John Doe') and r.date > "5/5/09" and rbid = b.bid;

Added "s.name"

maybe that is where the syntax error comes from?

The only useful thing you have suggested in here was already suggested in my post (see above) but you did not read it or, more appropriately, did not want to read it, otherwise how would have your product been advertised then, isn't it ?

verruckt24 438 Posting Shark
create view john_doe_rentals as
select b.bid
from sailor s, boat b, rental r
where s.sid = r.sid and ( = 'John Doe') and r.date > "5/5/09" and rbid = b.bid;

Here I guess you have forgotten to mention what equals to 'John Doe'.

create view john_doe_rentals as
select b.bid
from sailor s, boat b, rental r
where s.sid = r.sid and ( = 'John Doe') and r.date > "5/5/09" and rbid = b.bid;

Here what is result ? Or should it be rentals.

verruckt24 438 Posting Shark

adatapost>You are in very aggressive mood. Cool down verruckt24.

No I am not. But I don't think I or anyone for that matter can stand somebody lying into his/her face. You might feel the way you are feeling and I can understand someone feeling that way, but my mood is in fact quite in contrast to that, that is the reason I said, "accept what you did and move on" it's not like that we are going to shoot him for that. But keeping on repeating that he was knowing it, when the fact was that he wasn't isn't a thing that could go down well with the members here, or atleast me for certain.

Admitting to a one's mistake is the first step in correcting it, or atleast avoiding oneself from repeating it.

As far as your concern goes, I am in a good mood really, see I am laughing too :)

verruckt24 438 Posting Shark

To compile a Java program, use the Java compiler javac.
http://linux.die.net/man/1/javac-java-1.6.0-openjdk

Why not the Sun's JDK ?

verruckt24 438 Posting Shark

I know it is a java program I'm not that stupid to not know it is c++ or java?

Yes you are, if not what do you make of this statement.

wether is it in c++ or Java.

Don't try giving excuses for what you have done especially lying, accept what you did and move on. The more you say I ain't stupid, I ain't dumb the more I will prove that you are. You cannot counter hard proof with lame excuses.

As far as the compiling and understanding help required part goes, I have already mentioned that's not a problem, this forum exists for that very reason.

Also,I'm only in my second grade at the college and I want to know how to compile a program in linux (Operating System)

Java programs would be compiled the same way that they are compiled on a Windows platform. If you have a Java SDK installed you need to run the command:
javac filename.java to compile a file; then
java filename to run the file.

verruckt24 438 Posting Shark

While compiling you need to specify the .java file, you are right on that part, but while running the file through the java command you cannot specify the .java file, such a file won't simply run, the JVM would need a .class file. So you would have to execute the command in this way :
javac HelloWorldApp the class loader would look for a file with that name and a .class extension.

verruckt24 438 Posting Shark

Thats because you haven't have implemented the toString method for your objects Address and Name. You need to implement them to define the behaviour of the toString method for your object. For e.g: for the Name object it could be :

public String toString(){
    return this.firstName + " " + this.lastName;
}

In case you do not provide such an information the toString() method as defined in the Object class would be executed, which just returns a string representation of the object concerned.

Note : Incase you are worried from where does the question of the toString method getting called arises in the first place, well that is the method that would be called when you attempt tp print out a copy of that object.

verruckt24 438 Posting Shark

Where do you think you should look for them ? Not certainly on the portals of MS-SQL, Oracle or DB-2 systems.

http://dev.mysql.com/downloads/connector/

verruckt24 438 Posting Shark

If your select queries work but deletes and inserts take time it should have been a problem of locking. Basically it could have been a case where one of the previous operations put a lock on the table which wasn't released, hence the delete query could never obtain the exclusive lock it needed and hence kept waiting. Yet in this situation you should have got a "Lock wait timeout exceeded" error. Your mention that it was sorted on a restart of MySQL server makes me believe more about this being related to locking.

It would be good if you could take a look at the Table Type/ Storage Engine for your table and check what type of locking scheme it supports, it would certainly help understand and hence sort out future such incidents.

verruckt24 438 Posting Shark

:I know it is java program

Don't lie to our faces we would screw you for that.

wether is it in c++ or Java.

I tried to compile it in linux but it didn't work.

And don't give lame excuses either; You haven't written this piece of code and you had no idea about it whatsoever, till the forum members told you about it, and thats a fact. Asking for help isn't a bad thing but lying in somebody's face and picking up code not written by you certainly is.