rom chatterjee

Ranch Hand
+ Follow
since Dec 11, 2001
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by rom chatterjee

My apologies.
This tech tip from Sun seems to cover what you are trying to do. I shall check back to if this still isn't what you need.
19 years ago
Hi there,
I think you need to stop for a moment and ask yourself what you're coding. I dont mean this harshly, but Im sure that anyone new to coding is going to go steaght in and make something work. It is satisfying, but not pretty!
You have used the main method 3 times, did you really mean this? Remember the main method is your entry point to an application. Once you're up and running, why start more applications? This may be your problem (although I've not tested it).
Try to describe your application first. Name some objects that you think you might need, what methods they might have and what those methods will do.
For example this sounds like some kind of text filter application. So your class with the main method could be FileFilterApp. You could maybe have a TokenList (a list of all the tokens to remove), that would suggest a Token. These might be used by a FileFilter.
So, lets expand on that a bit:
A Token could have some methods like:
public Token(String token) //constructor
public String getToken() //get the Token value
A TokenList could have:
public TokenList() //create an empty list
public addToken(Token token) //add a token to the list
public removeToken(Token token) //remove a token forn the list
public iterator() //get the token list iterator for walking the list
A FileFilter could have
public TextFilter(TokenList list) // create a filter using this token list
public File filter(File file) // filter file based on list
public String filter(File file) // filter file based on list
public StringBuffer filter(File file) // filter file based on list
Finally, your FileFilterApp might look something like:

This is intended only as a starting point, so come back if you need more help.
19 years ago
Hi
Unicast/Multicast is a network (IPv4) concept. Briefly, Unicast is delivering a message to one node, whereas multicast is delivering a message to many nodes. In both cases you send only once. Incidentally, IPv6 introduces the concept of anycast.
In java you can see this in use in RMI in the remote reference layer.
This is very brief, but hopefully helps point you in the right direction
19 years ago
OK Im not sure if this will be of much help, but jedit is an open source editor that is stable, widely used and handles plugins. The source code is avialable at sourceforge.
Might be a good place to start investigating..
19 years ago
Check out the documentation for java.lang.Math (you should try the round() and floor() methods).
Come back if you are still having problems
19 years ago
Why are you wanting to integrate VC++ with Java. Are you aiming eventually for a full Java solution but need to use legacy code for now? In which case decide no your ninterfaces and use JNI. If it is because you have too much VC++ code to port then maybe you shouldnt be adding Java into the mix... BTW I think Java is great and getting better, but it is not the always the answer to every problem!
Check out code samples
19 years ago
Silly question, but why do you want to do this? Personally, I like knowing what has gone before. If it is because of a style choice, then maybe you shouldnt (not everyone may agree with you).
However, if you wish to claer the screen for security reasons, why not have a native script that captures the secure information, clears the screen using the normal shell command, and calls your java program passing the secure information.
Hope this helps!
19 years ago
Ihad problems with this too. Make sure that the path to the shared object used by the java program is in the LD_LIBRARY_PATH. Worked for me!
19 years ago
Dont know if this too hacky, but you could extend Color adding static IDs, eg MYColor.RED_ID=1, MYColor.BLUE_ID=2, and then switch on the ID.
19 years ago
Hi
You are nearly there. You have read the file into the DOM in memory. The change you have made is in memory. You now just need to write the code for persisting the change to file. Have a look at the DOMSerializer documentation.
Good luck!
19 years ago
Visit the Sun web services tutorial its a good place to start.
19 years ago
Why would you need to? The question being if you think of a well known singleton class eg. Math. It has no state, therefore theres no reason for having different instances flying around, and theres no need to reload it.
What does your singleton do
19 years ago
Hi
When you compile a *.java file you get a *.class file. Your classpath tells the compiler and jvm where to find your compiled classes. As long as your classes live in a directory that is in the classpath they will be found.
A .jar file is a java archive file. It is comperessed files that can include any number of files. jar files have to be explicitly named in your classpath otherwise they wont be found.
However, it sounds like you just got the source but didnt maybe get all of it. Try checking that you got everything first. Then checkout java.sun.com for tutorials. These should get you going.
19 years ago
Just something elese to think about. You may wamt to think a bit more about your class structure in simple terms (its never too soon!).
Try making your ClassDemo a Book class (thats what it seems to be). Then all the attributes (title,author, etc) should be made private and accessor methods used for setting and getting the values.

Then add a toString() method, which is what I think you were originally doing. All your future classes should have a toString() method. There is a book (Effecitve Java: 50 ways to improve your programming) That has good advice for general class design/usage).
Lastly you can add a main method to the Book class to test it the method can create a Book set its attributes, get them and finally call toString(). Alternatively have an other class purely for creating and using a book.

When you're ready (there's no rush) check out JUnit for testing your classes
19 years ago
What you need to understand is that the command 'java' starts an instance of the jvm. The jvm interprets the Test.class file handling the execution,etc.
When starting one instance of the jvm and asking it to interpret the Test.class file, the jvm loads the class file.
[LIST]
[*]It stores one copy of Test.bigName which will be available to any instances of Test running within the same jvm
[*]Each instance of Test will have access to its own instance var name
[*]For each instance of Test, the local var anotherName will only be available to the instance method changeName during the period of the method invocation
If you start many jvms and ask them all to interpret Test.class, the above will be true for each jvm. However the jvms will not have knowledge of each other. ie The static var bigName in jvm1 will not be available to instances of Test in jvm2
Hope this helps
19 years ago