Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Nope, I'll take a look at it.

For a good cookie-cutter hero epic fantasy, Robert Jordan's Wheel of Time is good, if a bit overly long...

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Try "MyApp.Main" instead of just "Main". It looks like Main is in a package called MyApp.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Dragging this up from the dust bin to mention another great series I've been reading.

For anyone who enjoys the fantasy genre, I'd highly recommend the Song of Ice and Fire series by George R.R. Martin. The plot lines and character development are much deeper and more complex than the typical hero vs villain paradigm commonly seen. There is much more gray than black-and-white to the numerous characters in the multi-sided conflict and, in the brutal games of war and politics, harsh endings are just as likely as victories. It's not another "against all odds, the heroes prevail" cookie-cutter by any means.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Have you tried using a JTreeTable?

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Ask the author or find a page that includes a download link for the source.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Coldplay (no laughing.)

:icon_lol:

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

I'm not sure what you are using to compile it, but that message may stem from the fact that you have no closing brace for the end of the class (assuming you posted the whole thing). There certainly isn't a line 72 in what you posted.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Well, I'm not sure what you're compiling it with, since that error is certainly not a Java compiler error.

The syntax is passably Java, assuming the presence of read() and write() methods in the class and I don't see any glaring errors with it.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Well, since you are a "professional" why can you not suggest one for her?

Better yet, she could take some initiative and actually do a little bit of research to come up with her own - which is kind of the point of tasking the student to decide upon the project, rather than just telling them what to do.

Salem commented: Quite so. Industry wants people who can think for themselves, not dolts waiting to be spoon fed (though they do have their uses). +21
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

The: cboStart.addItem(new Integer(1)) will add Integer objects to the ComboBox and you will have to cast them to Integer when you get the values.
I Think the second is wrong since if I remember correctly the addItem() method takes Objects as arguments.

With Java 1.5 or later, Integer.valueOf(1) would be preferable to constructing a new Integer.

The second method, cboStart.addItem(1) also works just fine because auto-boxing will make the conversion to an Integer object for you.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

No, Im trying to help him with the simplest way as you can see he is newbie.

Even, im a newbie. im just sharing my knowledge here :) If im wrong, you seniors are here to help us.

Regards,
PuneetK

No, you fixed some of his code and then provided no explanation of what you did or why, which does nothing to promote learning. javaAddict was merely trying to provide the explanation that you did not bother to give.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

The Obamessiah ("voluntary mandatory national service", etc.) isn't YET in office, so that can still be avoided.

Abuses of the next administration may yet be avoided, but those of the current cannot.
:-/

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Ok, here are a couple of trivial examples.

// phone list
Map<String,String> phoneNumbers = new HashMap<String,String>();

phoneNumbers.put("Bob","234-3456");
phoneNumbers.put("Mary","444-5555");
phoneNumbers.put("Tom","777-9900");

System.out.println("Bob's phone number is: "+phoneNumbers.get("Bob"));
System.out.println();
System.out.println("All phone entries");
System.out.println("-----------------");
for (Map.Entry<String,String> entry : phoneNumbers.entrySet()){
    System.out.println(entry.getKey()+": "+entry.getValue());
}

// counting the number of times a letter appears in text
System.out.println();
String text = "'If trees could scream, would we be so cavalier about cutting them down? We might, if they screamed all the time, for no good reason.' - Jack Handy";
Map<Character,Integer> letterCounts = new TreeMap<Character,Integer>();
for (char c : text.toCharArray()){
    if (Character.isLetter(c)){
        Integer count = letterCounts.get(Character.toLowerCase(c));
        letterCounts.put(Character.toLowerCase(c), 
          count==null ? 1 : count+1);
    }
}

System.out.println(text);
System.out.println("");
System.out.println("Letter occurences:");
System.out.println("-------------------");
for (Map.Entry<Character,Integer> entry : letterCounts.entrySet()){
    System.out.println(entry.getKey()+": "+entry.getValue());
}
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

... And how do you propose someone help you, when you have not posted a clear question nor any code?

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

This question makes no sense at all. Are you sure that you meant to post this in the Java programming forum?

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Canceled by Executive Order until further notice.

Get back to work. Move along.

Dave Sinkula commented: Obama hasn't been elected yet. :icon_razz: -3
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

what is the scope of JAVA? Tell me if I make my career in JAVA. what points I should take to sucess in this career. I am a computer graduate.

Hijacking someone else's thread to ask an unrelated question is considered rude. If you have a question to ask, start a new thread of your own.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Do you mean code to use a HashMap or an implementation of a hash map data structure?

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Career advice: Learn to communicate in a professional manner if you expect to be taken seriously. No company recruits individuals who believe "IM speak" is appropriate outside of a chat room or SMS message.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

At least McCain knows how to interrogate prisoners...

he was interrogated

Yes, that part is obvious. What is unclear is what you feel that implies:

That he knows the brutally effective ways to get people to talk?
That he knows "morally right" way to do it? (Which would be what exactly, in your own estimation?)
That Obama does not know how? (Is he supposed to?)
That someone who is familiar with interrogation is the most appropriate candidate for the Presidency?

Someone above agreed that you had a good point. I fail to see how it's a relevant point at all, given the complete ambiguity of your uncompleted assertion.

scru commented: Agreed. +3
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Well I don't know if this would be an overkill (especially if you just need to start up) but when it comes to concurrency, I liked Java Concurrency in Practice By Brian Goetz

Yes, Java Concurrency in Practice would be my suggestion as well for thorough coverage of concurrency.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Sure, that's a great idea...
until you actually think about it for more than one second.

VernonDozier commented: Ha Ha +7
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Am I missing something?

The correct forum perhaps? This is the Java forum.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

At least McCain knows how to interrogate prisoners...

Care to clarify a bit?

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Well, it's very odd that all of the keywords like import, public, void, implements, class, etc. are missing from the code.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Just to answer the question on waiting for one thread to finish before starting the next, here's a trivial example using the join() method

public class JoinExample {

    public static void main(String args[]) {
        Thread t1 = new Thread(new FirstTask());
        Thread t2 = new Thread(new SecondTask());
        
        t1.start();
        try {
            // wait for t1 to complete
            t1.join();
        } catch (InterruptedException ex) {
            Thread.currentThread().interrupt();
        }
        // start the next
        t2.start();
    }
    
    static class FirstTask implements Runnable {
        int counter=0;
        
        public void run() {
            try {
                while (counter<10){
                    System.out.println(++counter);
                    Thread.sleep(500);
                }
            } catch (InterruptedException e) {
                Thread.currentThread().interrupt();
            }
        }
    }
    
    static class SecondTask implements Runnable {
        int counter=64;
        
        public void run() {
            try {
                while (counter<74){
                    System.out.println(Character.toChars(++counter));
                    Thread.sleep(1000);
                }
            } catch (InterruptedException e) {
                Thread.currentThread().interrupt();
            }
        }
    }
}
peter_budo commented: Thank you for advice +10
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

I'm curious, why you are wanting to use separate threads for what seems to be a synchronous process? You describe wanting to process another song after the current one is finished, but haven't mentioned anything that would require a concurrent process.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Yes, the Threads in your example don't really do anything. You need to extend Thread and override run() or supply a Runnable to the constructor. Have you looked through the tutorial on concurrency as a starting point?
http://java.sun.com/docs/books/tutorial/essential/concurrency/runthread.html

The java.util.concurrent package adds a lot of new higher level support structure for asynchronous operations as well. It's covered further towards the end of the tutorial trail.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Advice: Explain yourself more clearly.

What kind of system? What programming language? What kind of light?

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

You have mixed two different ways of giving input to the program together but you haven't separated them to be independent of one another.

Everything that deals with the args[] is working with parameters that were passed on the command line when you execute the program.

The Scanner code is used to collect input from the user while the program is running.

The code that is expecting args[] will fail if there are none, which is why you are getting that index error. You can't access the first element (0) of an array that is empty.

You need to either separate the two input processing sections, perhaps with an if statement

if (args.length > 0){
   // use the args
} else {
  // use the Scanner
}

Or delete the code that is relying on args.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

If you copied that directly from a textbook, you need to throw it in the garbage. Not one of the declarations (import, class, and method) is correct.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

If you are not including arguments on the command line when you execute the program, then this line will exit the program immediately

if (args.length != 1) System.exit(0);

Edit: Posted the same time as VernonDozier. He mentions the same.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

One man's(woman's) pork is another's sustenance.

It is, however, disingenuous to paint Palin as being anti-pork - even McCain said so.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

That works as well :)
Any onerous labor that serves the public at large, especially work that would otherwise be paid for with government funds, would be fit punishment for them.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

>really many thanks to you.. i wish i could do something for you too

Well, you could mark the thread as "Solved" and leave him a favorable reputation comment on the post.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Wrong. That code would not compile on any JVM for any platform. You stated that it did and masijade's response was completely correct.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

You do realize you are going to have to so some actual work to develop the signal processing algorithm, right? Asking repeatedly here for someone to give you an algorithm is not going to work out.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Did it depend on where you wore it?

hehe! Yes, I imagine the effects would vary depending upon where it was worn.

Worn on the fingers: Forget it, you weren't getting any. No chance of reproduction.

Worn... elsewhere: Could cause difficulties, but some people really get into that kind of thing!

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Those were shown to cause reproductive harm if worn longer than a day.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

One hour of community service (picking up litter, public land and utilities maintenance and improvements, etc) per spam email sent.

1,000,000 emails sent, mandatory 12 hour work day imposed = 228 years labor.

Sounds reasonable to me.

scru commented: I like it. +3
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Well, I didn't tell him how to get one.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

for what is this site???
i can make money here...?

Only if you have the secret decoder ring...

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Actually, disregard the comment on the inner class. I just noticed that it is not actually an inner class of ColorForms.

Since the "jumping" occurs on a top-level repaint of the containment heirarchy and CanvasPanel is a component of "bottomPanel", the new transform seems to be created relative to the bottomPanel graphics context when the paintComponent() call comes down from that container. Your other events are calling repaint directly on the CanvasPanel and the transform is fine on those.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

The problem is originating with your creation of the affine transform that you are rotating:

AffineTransform af = new AffineTransform ();

If you change that to pass the original transform to the constructor, it works just fine:

AffineTransform af = new AffineTransform (orig);

Without backtracing the stack on every repaint() call, I can't tell you for certain, but I would guess the new transform is getting generated against the frame context when you resize and using the CanvasPanel on the other events. The fact that it's an inner class of another visual component further clouds the issue.

Honestly, you don't need to create a new transform from scratch anyway. Just call rotate directly on the graphics context

g2.rotate(angle, ovalCenterX, ovalCenterY);

and it behaves just fine.

Also, if you move the setVisible() call to the end of the ColorForms constructor, it will paint the components you added properly on construction.

VernonDozier commented: Very helpful. +7
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

If your algorithm can isolate single words from the audio signal, then getting whatever timing metrics you need should be trivial. Isolation of the signal from baseline shouldn't be too difficult.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Well, they were right about the "blank" part.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

i need help java programming

Well, perhaps you might want to post in the Java Forum then... in your own new thread, rather than one dragged up from years ago...

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

You'll have to rephrase the question. As stated, it's not clear at all what you are wanting to do.