Search Results

Showing results 1 to 40 of 169
Search took 0.06 seconds.
Search: Posts Made By: ~s.o.s~ ; Forum: Java and child forums
Forum: Java 5 Days Ago
Replies: 8
Views: 168
Posted By ~s.o.s~
Try using the DocumentBuilderFactory instead of explicitly instantiating the parser.public static void main(String args[]) throws Exception {
DocumentBuilder builder =...
Forum: Java 8 Days Ago
Replies: 2
Views: 205
Posted By ~s.o.s~
NumberFormat is an abstract class; use its static factory method to get your choice of number formatter.public class MainTest {

public static void main(String args[]) throws Exception {
...
Forum: Java 10 Days Ago
Replies: 2
Views: 249
Posted By ~s.o.s~
The commas and the brackets are a part of the ArrayList class's toString() implementation. If you need your own row representation, either write your own method which does so or better yet, create a...
Forum: Java 12 Days Ago
Replies: 20
Views: 494
Posted By ~s.o.s~
Use getValues().nextLine().equals("n") instead. The Scanner name is confusing BTW, just name it scanner instead of getValues which is more appropriate for a method name.
Forum: Java 12 Days Ago
Replies: 20
Views: 494
Posted By ~s.o.s~
You are comparing a Scanner object with a String object.
Forum: Java 21 Days Ago
Replies: 16
Solved: Append to array
Views: 749
Posted By ~s.o.s~
What's wrong with the getTime() method of the Date class which returns the number of milliseconds elapsed since January 1970 as long? To get the seconds, just divide by 1000.
Forum: Java 22 Days Ago
Replies: 16
Solved: Append to array
Views: 749
Posted By ~s.o.s~
> is it possible to loop through the contents of two arrays to populate a
> third array with the combined content?

In my code I'm using looping through two Lists and populating a third list...
Forum: Java 23 Days Ago
Replies: 16
Solved: Append to array
Views: 749
Posted By ~s.o.s~
Sadly, this simple a thing becomes pretty clunky to implement when it comes to Java. A sample implementation might be something like:
class YourClass {

private static final List<String>...
Forum: Java 23 Days Ago
Replies: 16
Solved: Append to array
Views: 749
Posted By ~s.o.s~
> Does anybody know how I can append to the array

You can't. The best you can do is perform a copy-on-write if the content to be written is more than the initial capacity with which the array was...
Forum: Java Oct 21st, 2009
Replies: 6
Views: 339
Posted By ~s.o.s~
IMO, though the analysis is correct, the solution provided isn't because an Iterator over a collection of elements of type E isn't the same as an Iterator over a collection of elements of type F...
Forum: Java Oct 5th, 2009
Replies: 4
Solved: Business Apps
Views: 3,277
Posted By ~s.o.s~
There are many good books, blog posts and articles out there for getting started with JEE; your best bet would be the free JEE 5 tutorial (http://java.sun.com/javaee/5/docs/tutorial/doc/)hosted by...
Forum: Java Oct 2nd, 2009
Replies: 4
Solved: Business Apps
Views: 3,277
Posted By ~s.o.s~
> also, would this be something to do with JavaEE instead of JavaSE?

Depends on what you need to learn and where your expertise lies, but yeah, nowadays the core business functionality *is*...
Forum: Java Sep 24th, 2009
Replies: 2
Views: 398
Posted By ~s.o.s~
> But in second, I am getting exception that filenotfound.

Because the file "spring.xml" is not present at the root of the class path; you need to state the hierarchy or the path to your config...
Forum: Java Sep 21st, 2009
Replies: 10
Views: 1,080
Posted By ~s.o.s~
Your second file is missing the class imports. I don't see the declaration of your `Convert' enum class. Your naming conventions are still off.

These are pretty simple error messages to hunt down...
Forum: Java Sep 21st, 2009
Replies: 10
Views: 1,080
Posted By ~s.o.s~
A few observations:
- Always perform resource cleanup in the `finally' block to be rest assured that the cleanup indeed is performed even if the code ends up throwing an exception.
- The way you...
Forum: Java Sep 20th, 2009
Replies: 10
Views: 1,080
Posted By ~s.o.s~
>Thanks a lot guys for the help!

Good luck with the remaining exercises.

> I will flag this as solved when I get my account fixed.

Done and done. :-)
Forum: Java Sep 20th, 2009
Replies: 10
Views: 1,080
Posted By ~s.o.s~
Read the contract of the substring method; substring(4, 6) == 2 characters.

Also get in the habit of using uppercase characters for enums i.e. `BIN' instead of `bin'.
Forum: Java Sep 14th, 2009
Replies: 4
Views: 468
Posted By ~s.o.s~
> How do I do that....I'm very new to Java

Steps:

Declare a TreeSet<String> instance variable for your class
Read the file using Scanner
For each line read, create the PublisherRecord...
Forum: Java Sep 13th, 2009
Replies: 4
Views: 468
Posted By ~s.o.s~
> Using the TreeSet class, how do I accomplish this

It's pretty simple; just keep on reading the lines from the text file and add the last entry i.e. the publisher name to a TreeSet<String>. So...
Forum: Java Sep 13th, 2009
Replies: 2
Views: 601
Posted By ~s.o.s~
> I think I need multiple loops to get rid of the commas, dollar sign, and
> end bracket separately.

Not required IMO; a single application of the replaceAll method of the String class on each...
Forum: Java Aug 8th, 2009
Replies: 5
Views: 350
Posted By ~s.o.s~
>The Java platform supports a simple, deterministic scheduling
>algorithm called fixed-priority scheduling

Any official links? AFAIK, the JVM specification makes no such claim and leaves the...
Forum: Java Jul 26th, 2009
Replies: 7
Views: 382
Posted By ~s.o.s~
Read the Javadocs of the classes ResultSetMetaData and DatabaseMetaData for more details regarding your database/table etc. A simple web search for these classes might give you sample snippets on how...
Forum: Java Jul 10th, 2009
Replies: 2
Views: 957
Posted By ~s.o.s~
You need the mail.jar in your classpath; you need to download the JavaMail jars if you already don't have them.

You would also be needing the Java Activation Framework libraries [activation.jar]...
Forum: Java Jul 10th, 2009
Replies: 3
Solved: Date question
Views: 364
Posted By ~s.o.s~
Also, no need to do calendar.setTime(time) ; the new instance of the calendar has the current time.

BTW, if you find yourself fiddling around a lot with time related methods in your application,...
Forum: Java Jul 5th, 2009
Replies: 4
Views: 404
Posted By ~s.o.s~
Yes, Java 7 indeed seems to bring a lot of interesting things (http://tech.puredanger.com/java7) to the table. More confusion FTW!

> What I meant by "real" file system was simply that [...]

My...
Forum: Java Jul 4th, 2009
Replies: 4
Views: 404
Posted By ~s.o.s~
> but it seems to work with a "real" file system on a "client side".

I'm not really sure what you mean by a `real' file system; the File class provides an `abstract filesystem independent view' of...
Forum: Java Jun 26th, 2009
Replies: 5
Views: 292
Posted By ~s.o.s~
Let's suppose that your program creates regex patterns based on the input provided by the user. Assuming the user enters `*' as the pattern and `hello' as the input string, the regular expression...
Forum: Java Jun 26th, 2009
Replies: 5
Views: 292
Posted By ~s.o.s~
> Is the best way to do this using a Trie?
Judging by its description, it does seem to be a good way of doing things, better than regular expressions at least when used over a large data set.

A...
Forum: Java Jun 23rd, 2009
Replies: 7
Views: 567
Posted By ~s.o.s~
Marking this thread as solved since you already started a new thread which is a continuation of this one.
Forum: Java Jun 23rd, 2009
Replies: 7
Views: 567
Posted By ~s.o.s~
A simple way would be to remove all opening brackets "(" in your String and then split on ")," to get the desired result.

Another way would be to use the Pattern and Matcher object to do the same...
Forum: Java Jun 9th, 2009
Replies: 3
Views: 208
Posted By ~s.o.s~
Look into the batch execution capabilities (http://java.sun.com/j2se/1.3/docs/guide/jdbc/spec2/jdbc2.1.frame6.html) of JDBC.
Forum: Java Jun 5th, 2009
Replies: 5
Solved: JNI
Views: 362
Posted By ~s.o.s~
> want to learn JNI , please suggest me some basic guide.

If you are doing it for fun, refer to the links posted above. But if you actually plan on writing a *real* application which requires...
Forum: Java May 26th, 2009
Replies: 12
Views: 797
Posted By ~s.o.s~
Posting complete solutions never has and never will help. How about giving the OP a chance to try out a few things before handing out a solution?
Forum: Java May 26th, 2009
Replies: 12
Views: 797
Posted By ~s.o.s~
Let me again point you to my first post in this thread which clearly mentioned:

Does that ring a bell? Think what could have gone wrong, give it a second try and reproduce the entire session again...
Forum: Java May 25th, 2009
Replies: 12
Views: 797
Posted By ~s.o.s~
Post the code of the class "as it is" without *any* modification, including the package declaration. Also paste the *exact* error message along with a screenshot of the entire session.

This...
Forum: Java May 25th, 2009
Replies: 12
Views: 797
Posted By ~s.o.s~
> 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

A typo maybe? It should be java...
Forum: Java May 4th, 2009
Replies: 7
Views: 561
Posted By ~s.o.s~
Like I had previously mentioned, there is no need to loop over the result of the split method call. The split method returns an array whose elements are the host, ip addr and the ping.

Just remove...
Forum: Java May 4th, 2009
Replies: 7
Views: 561
Posted By ~s.o.s~
Post your latest copy of compilable code which exhibits the behavior you mention [i.e. duplicate printing] along with the relevant CSV file.
Forum: Java May 4th, 2009
Replies: 7
Views: 561
Posted By ~s.o.s~
> it duplicates the information its printing out by 3

Because you print out the information in a loop. The solution here is pretty simple; split the string read from the file/stdin using the given...
Forum: Java May 1st, 2009
Replies: 3
Views: 399
Posted By ~s.o.s~
I think the OP is talking about the "copy constructor" like functionality which exists in C++ and can be implemented in Java by:
- implementing the Cloneable interface
- overriding the clone()...
Showing results 1 to 40 of 169

 


About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC