Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Typically a Queue is used for that, often a BlockingQueue. Workers take items off the queue as they become available to process. Is there a reason that you need to leave them in a Map?

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

my email is ...

about to be deleted again. I guess this particular trainer is going to take a bit longer for you...

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

It depends on what is being processed and what information you need to retain. Also, if your keys are just a sequenced index, you don't even need a Map implementation. A List would work fine. You can either mark the object processed or roll them off to another List of processed items.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

I can't see any reason that you would want to. It would render the map useless.

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

Then ask specific questions. We aren't going to explain every single line of that code for you.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Have you used the search feature here? There are a ton of threads just like this begging for a project idea.

Write a program to do something you find interesting. We don't know a thing about your interests or skill set, so how do you figure we're going to pick a project for you? What areas of CS interest you? If you don't know, then why are you in CS in the first place?

If you refuse to take any initiative to think for yourself in CS, you're user name is going to be sadly apt for a long time.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

It doesn't matter what you are testing so long as it evaluates to a boolean. If it's true then the statement is executed, otherwise the else{} portion is executed.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

There are conditions. Simply trace them for yourself. Also, you should get in the habit of always using the braces around the statements following the conditional, even if it is a single statement.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Sure, just like you would in any other program or in a paper ledger:
NetPay = GrossPay-Witholdings

Of course, a more specific question might get a more specific answer...

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Why would you need to declare them? If you're going to multiply matrices then they would be the parameters to the method. Perhaps you need to post your method signature and intent if that is not applicable to your goal.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

You should have a set and get method for each of the properties in the class. That is how your other classes will interact with an instance of that class.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

You need to re-examine your notes on class design and object-oriented concepts. You don't stuff all the code in a class in a static main() method.
http://java.sun.com/docs/books/tutorial/java/concepts/index.html

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

It looked silly six months ago when it first came up. Now it doesn't even rise to the level of silly - it's just lame.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

blah blah blah

/yawn
This isn't even good trolling. Three posts of dead-horse beating over non-issues. Astroturf elsewhere.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Also, you should always include braces around the statement block with if(),for(),while(), etc. The spec does allow a single statement without braces, but you're just begging for a bug to arise later when you decide to add another statement to the implied block. It's worth the time to put in the braces.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

"otherwise ok" except he declared the method to return an int, but used a double for cost (and your own code does not define the variable cost at all you might notice).

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

I don't see any reason not to delete them. They offer absolutely nothing to the content of the forums. Legitimate questions on project implementation may be useful, but "give me teh codez" posts are a waste of storage space (and so are the posters for that matter).

Salem commented: WOMBAT's the lot of 'em ;p +36
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

You didn't post a question...

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Then you need to write "d" code.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Um, yeah, right.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

by the way,,i found the solution,,
Sams Teach Yourself CGI in 24 Hours(Second Edition)

but it has no free ebook,,do you have free ebook on this??

If that's the "solution" you need, then buy the book. Do you think the author spent time writing it just because he liked to type? If he did then he would have released it as a free book himself.

It's a pretty simple decision really: pay a little bit for his work to save you time or spend time figuring it out for yourself from the free tutorials available that you have already been given. The burden is on you to expend the effort.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Yeah, what I was hoping to do was take a button and it's function. The vehix site has all my cars on it and on the individual car page there is a button for sending that car's information to the customer's cel phone via sms. I'd like to offer the same information via the same simple button and not have to pay extra for it.

So you basically just want to steal that functionality for your own site so you don't have to put any effort into it or pay someone to provide that service...

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

To copy single dimension arrays, use System.arraycopy() or Arrays.copyOf().

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Why did you start a duplicate thread on this?
http://www.daniweb.com/forums/thread148397.html

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Use English, not IM-speak. This isn't a chat room.
See the forum rules: http://www.daniweb.com/forums/faq.php?faq=daniweb_policies

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Personally, I've never used it for anything myself, but yeah it's in there. I usually find a simple text box, combo box, or slider more useful. I think repeatedly clicking an arrow to increment something is more tedious than helpful in most situations.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Your exact usage is a little bit vague, but it sounds like you want to use a Map structure. The Hashtable that JavaAddict mentioned is one implementation of that, though it's an older one and HashMap is generally preferred now. There are a couple of other implementations as well that offer specific features.

You can read about the various Collections and their usage here: http://java.sun.com/docs/books/tutorial/collections/index.html

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

That is probably the worst suggestion you could make for this. Separate classes is appropriate design for this. Just because Java will let you create a procedural program by stuffing everything into static methods and variables doesn't mean it's the correct way to use the language.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

And you need to use [code]

[/code] tags around the code that you post.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Swing does have that component. It's called a Spinner. Here's the tutorial link on it: http://java.sun.com/docs/books/tutorial/uiswing/components/spinner.html

Edit: Oops, I missed page two. I'm referring to the incrementing component you asked about on page one.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

You didn't show how Cell is declared, but you mentioned that it was a nested inner class. I would guess that you didn't declare it static. It would need to be static if you want to use it in a static context. Non-static inner classes require an instance of the enclosing class.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

I'd agree with masijade. It looks like embedded RTF style info to me. Try to save the file as plain text.

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

Check the API doc for JOptionPane. The dialogs have several constructors you can choose from depending on how much you want to specify on it. The docs describe the constants you can supply for each of the parameters.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Perhaps you need to look those words up, Aia.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

while Palin came across as warm, genuine and gutsy (which is what she is).

I guess if "warm, genuine and gutsy" means "vacuous, disingenuous, and smarmy", then yeah, I suppose so...

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Speculation is part of the unknown.

Waving your hands shouting "crazy scientists are going to destroy us all" is not quite the same as thoughtful speculation.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

But I think that the American public has matured since then.

Really? Is there another American public I'm not aware of?
:)

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

if you would have written it correctly, it would've been playing right now, wouldn't it?

Not if he no sound card or his speakers are not connected, not turned on, or turned all the way down :P
Since he stated he wrote it correctly, one of those must be the solution!

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Well, I guess you weren't paying attention at all in class when sorting was discussed. You haven't even started a skeletal implementation of a single algorithm.

I'd say you have some reading to do first: http://en.wikipedia.org/wiki/Sorting_algorithm

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Well, she didn't fall flat on her face, which is what I was hoping to see, but she certainly gave a lot of non-answers and rabbit-trailed off into "folksy" patter that had absolutely no real content. Irritating to listen to if you want a real answer to a question, but it does appeal to her "base". Certainly can't pin the "intellectual elitist" label on her.

>>"Getting knocked out has its advantages."
I guess Joe missed his chance then, because she didn't even wing him, much less knock him out. She did manage to stay on her feet to the end though, doing better than I expected going in.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

I have no idea how to change supported source version from 1.3 to 1.5 in NetBeans. It was simple to do with IntelliJ IDEA but this IDE has currently certain issues with Sony Ericsson WTK which I'm using.
Does anyone know where to change this setting?

Since you mention ME only runs against 1.4, the option may not be available, but just for the sake of info you would normally set that in the Project Properties dialog Sources node, Source/Binary Format setting.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Yeah, she was pretty charming as she vacuously stumbled through the Couric interviews.
:-/

Talking Point Wind-up Doll is a pretty apt description. Maybe she'll get lucky and they'll ask about hockey and moose hunting.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

If you only want the sound to be played on app-triggered repaints and not system-triggered (like repainting on resizes or other windows being dragged over it), you can override the update() method

import java.awt.Color;
import java.awt.Graphics;
import javax.swing.JOptionPane;

public class PaintExample extends java.awt.Frame {

    public PaintExample() {
        initComponents();
    }

    private void doSomething() {
        JOptionPane.showMessageDialog(this, "done");
    }

    private void formKeyPressed(java.awt.event.KeyEvent evt) {
        repaint();
    }

    @Override
    public void paint(Graphics g) {
        // arbitrary long paint process
        int w = getWidth();
        int h = getHeight();
        int reps = 500000;
        g.setColor(Color.BLACK);
        for (int i = 0; i < reps; i++) {
            int y = (int)(i / (float)reps * h);
            g.drawLine(0, y, w, y);
        }
    }

    @Override
    public void update(Graphics g) {
        super.update(g);
        doSomething();
    }

    private void initComponents() {
        setTitle("PaintExample");
        setMinimumSize(new java.awt.Dimension(400, 400));
        addWindowListener(new java.awt.event.WindowAdapter() {
            public void windowClosing(java.awt.event.WindowEvent evt) {
                exitForm(evt);
            }
        });
        addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                formKeyPressed(evt);
            }
        });

        pack();
    }

    private void exitForm(java.awt.event.WindowEvent evt) {                          
        System.exit(0);
    }                         

    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new PaintExample().setVisible(true);
            }
        });
    }

}

Just press a key to trigger the repaint. It will process the doSomething() code after the paint has completed.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Use ".equals()" to compare strings - not "=="

(input.equals("Quit"))

or to avoid potential null pointer exceptions

("Quit".equals(input))

. You also don't need to test booleans for "== true". The boolean, or boolean expression, is true or false by itself

if ( employee[k].getEmployeeName().contains(input) )
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Those are arrays - not ArrayLists - and why are you not using an object to represent each line item instead of three separate arrays for each piece of data?

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

Assuming that each transaction line item is an object in a List, you can simply call Collections.sort(java.util.List, java.util.Comparator) with an appropriate Comparator to compare on amount.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Yep, better get acquainted with these pages: http://java.sun.com/docs/books/tutorial/uiswing/index.html

iamthwee commented: nice link +17