Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

(i != 0)

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Yoga is the answer.

And the real trick is finding the question...

~s.o.s~ commented: Haha :-) +20
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

You will have to utilize a separate thread for the progress update. The easiest would probably be a Timer. See How to Use Timers for more information on this.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

About the only thing that comes to mind is to use System.out.print() (not println) to print the file name and then append periods after it until it's done, and then println "complete" and move along to the next file.
There isn't really a mechanism to overwrite a line of output to the console, so unless you want to print numbers in sequence to represent percent complete, or write them on separate lines, you're limited in what you can display for it.

You might be able to send backspace characters to clear a previous number and then overwrite it, but I have played with it really and it would probably not be platform independent.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

If you really need assistance, let me try to show some examples of double standards. Similar biases are displayed here regularly. And gee, I hope folks here have the ability to read the IBDeditorial article as to why the flag issue has significance.

See, that is where I'm seeing a difference here and not viewing this as part of a double standard. The incidents listed in the Gateway Pundit entry all revolve around the direct involvement of the individual in criminal or highly suspect / egregious behavior. I see no evidence of that in the flag case as yet though. As I mentioned, if Obama himself displayed the flag/picture or indicated approval of it, then I can understand why it would generate pointed questions. Currently though, you have the individual actions of a volunteer prior to the arrival of official staff. As yet there remains no evidence of any approval from Obama nor his campaign staff and that is why I do not see it in the same light as the incidents that you refer to.

I certainly won't defend any of the inconsistencies noted in the links you posted, but without any direct or even officially sanctioned involvement on his part, I do not see that Obama has anything to answer for at this time. Perhaps more will come to light on it that suggests an explanation is warranted, but currently I don't believe he should even deign to acknowledge it.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

You don't show how you are attaching the listeners, but yes, it's a focus issue. The easiest thing for you to do is define the actions for those listeners as small inner classes that extend AbstractAction. That will allow the button and key listeners to share the code for that action. For the buttons, use the setAction(Action a) method to attach the actions. For the keyboard input, map those actions into the InputMap for the frames content pane like so

getRootPane().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE,0),"My Action");
        getRootPane().getActionMap().put("My Action",new MyAction());

This will allow the key binding to respond within the focused window. More info on key binding in this manner can be found here: How To Use Key Bindings

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Somehow, if some Bush supporter had a Confederate flag in volunteer HQ I think it would have been necessary for the candidate himself to kiss the press' ass for at least a week begging forgiveness, disavowing any relationship to the campaign, and jettisoning these erstwhile folks. It's just fun to watch the double standard live.

It is a pathetic attempt to throw out irrelevant incidents and paint them as ominously revealing. I get what you mean, but I don't know that it is so much of a double standard. Both sides do it and it's equally reprehensible in all cases. That doesn't mean you need to buy into it and add to the tide of intellectually dishonest smearing just because you think the "other side" should face the same music. Given the Republican campaigners penchant for this kind of thing ("Swift Boat Veterans for Truth" and the hit jobs they've pulled on their own in the case of McCain), I'm not seeing what "double standard" you feel is evident.

But frankly the point being drawn, much like with the fringe supporters of Ron Paul, is the followers of a candidate reflect on the candidate himself. Does a lack of a candidate response implicitly acknowledge tacit support?

So you feel that a candidate has a duty to acknowledge or disavow the opinions and actions of every single one of their supporters? Do you figure that there are no nutjobs working in support of Huckabee and McCain? Do they owe you a …

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Read the ton of other posts on this. Perhaps you will stumble upon an idea. It's not our place to tell you what you can do for a project though. Only you know your own capabilities and interests and your project should reflect that.

(Also see the forum rules regarding proper English - "text-speak" is frowned upon: http://www.daniweb.com/forums/faq.php?faq=daniweb_policies#faq_keep_it_clean )

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Well, start by writing a class that represents a gas bill I guess. You already listed two properties it should contain. Add more as needed.

Beyond that, you haven't given enough information to work with.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Who are you to say that Obama didn't place it there? You don't know, and therefore shouldn't make assumptions.

And neither should you. That is why it is a non-issue. If they showed him tacking that to the wall, pointing to it proudly, or bragging about it, that would be something else altogether.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

My problem with Che Guevera If your chosen candidate had a bust of Lenin or portrait of Mao the campaign HQ, I'd be equally appalled.

Oh please, do you think Obama placed that flag there himself? Do you believe that the actions of some junior level staffer have any bearing whatsoever on his platform?

This is just something for the right-wingers to wave their hands and shout over. It's irrelevant and pathetic and they know it, if they can be completely honest with themselves.

Poor taste? Yes. Indicative of Obama's character and intentions? No.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

For this you would use a Process which can be created via Runtime.getRuntime().exec(java.lang.String) or ProcessBuilder.

Process has methods to obtain input/output/error streams as well if needed.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Java has an api for working with images. There is no need to read raw file values.

Take a look at some of the examples here:
http://www.exampledepot.com/egs/java.awt.image/pkg.html

Specifically you will probably want to work with a BufferedImage:
http://www.exampledepot.com/egs/java.awt.image/ImagePixel.html

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

It's merely a number that identifies that build (compilation) of the software. Each build incorporates one or more changes to that software and numbering them allows you to keep track of those changes incrementally and also to roll back if necessary. It's similar to a fine-grained version number in some respects.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

I have a good idea what I am supposed to put but I can't seem to get it right. I have two different files, Server.java and Client.java. I want Client.java to call a method in Server.java. This is what I have figured out so far.

public class Client{
public static void main(String[] args) {
Server otherInstance = new Server();
otherInstance.instanceMethod();
Server.staticMethod();
}
}

I am a complete novice but I think I have to replace the word "other" with the method I am trying to use from the file, Server.java? Any help would be greatly appreciated.

No, you replace "instanceMethod" with the name of the method, unless it is declared to be a static method in Server, in which case you replace "staticMethod".

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

No, you do exactly what the assignment indicates: Use an Iterator (look it up in the API) to walk through each List element and append the String from each element's toString() value to your text area.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Huckabee seems to be a very nice kind person, one whom I'd love to have as a neighbor. But President -- no. We had one president during my lifetime that was a devout Christian (Carter) and he didn't make a very good president either.

Yes, that's my feeling on Huckabee as well. He comes across as a really nice guy. I just don't want someone in office who feels it is government's place to legislate religious values.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

You might want to look into whether you can use Callable for your task instead of Runnable. Callable throws Exception and returns a result. Using that, in conjunction with Future and an Executor perhaps, would be an option.

Since you seem to have a lot of questions on threading lately, you might want to pick up a copy of Java Concurrency in Practice. It covers a lot of ground on multi-threading and concurrency with the Java 5/6 concurrency packages.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

It's not hard to see congressional strings being pulled for this one:
http://arstechnica.com/news.ars/post/20080207-controversial-college-funding-bill-passedp2p-proviso-intact.html

COAA makes a host of changes to the higher education landscape in the US, but for our purposes, the most interesting was the requirement that schools make plans to offer some form of legal alternative to P2P file-swapping and that they also make plans to implement network filtering. Not making such plans would carry no consequences, however, and we're told by House staffers that no one's federal financial aid is in danger.

Regardless of anyone's thoughts on the legal and moral nuances of P2P filesharing, requirements for network filtering have absolutely no place in a college funding bill.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

You already have an ArrayList in ManipulateGymUser and that is the one that alreadyExists() is checking against. Basically you have a big organization problem right now in that you need to decide which class should contain the list and stick with it. If you want the operations in ManipulateGymUser to operate on a list that you pass to it, that's fine - get rid of the array list in that class and work with the one that you pass to the method. If ManipulateGymUser is suppose to maintain the list, get rid of the list in your main driver class and drop the method parameters that take a reference to an arraylist.

You're working with multiple lists right now and until you get that resolved you are going to have issues.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Of course ManipulateGymUser.addMember(arr) is giving you an error. You changed the method signature. If addMember() no longer has any parameters then you have to change those method calls to not use a parameter.

You need to review the basics of methods because they are still eluding you.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

javaAddict already pointed out (and I concurred in an edit to reiterate it) that you need to remove the "UserListIn" parameter from addMember(). You have two arraylist variables of the exact same name, one of which is local to addMember() and the other at the class level.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

This version will not work correctly.

boolean b=false;
     for(GymUser listEntry : UserListIn)
        {
            if(tempID.equals(listEntry.getID()))
            {
                b = true;
            }
                else  b= false;
        }

The result will be set based entirely on whether or not the last entry in the list has the same Id. So only set the flag to true if they are equal - don't set it to false if they aren't (it's false to begin with until a match is found).

Additionally, this piece of code at the end of addMember()

System.out.print("Enter Name: ");
        tempName = keyboard.next();
        System.out.print("Enter Surname:");
        tempSurname = keyboard.next();
        System.out.print("Enter Address:");
        tempAddress = keyboard.next();
        System.out.print("Enter Age:");
        tempAge = keyboard.nextInt();
        System.out.print("Enter Phone:");
        tempPhone = keyboard.nextInt();
        System.out.print("MemberShip Duration:");
        tempDuration = keyboard.next();

Is just collecting info from the keyboard and not doing anything with it at all. So if that is where you are entering the info with the dupe id, it certainly won't check for that Id in your list.

As for the second, don't use == to compare string values. Use .equals()

(listEntry.getID().equals(user.getID())

Why you are using a string to hold an int Id value is beyond me, but if they are strings you have to use .equals(). I did not notice you declared those as strings earlier, so that part slipped by.

You also do not show how you are using this class. There could also be some issues with the way your driver class is calling addMember(). I see you chose to ignore the suggestion to ditch …

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

You can simplify it just a little more with a digit character match like so

\d{0,15}\.\d{0,2}

You might find this small regex testing form that I posted a while back helpful in tweaking patterns as you are experimenting: http://www.daniweb.com/forums/post392585-8.html
The numbered text fields at the bottom are the match group results of the pattern.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Remove the static from alreadyExists(). That method only needed to be static if addMember() was static. You're getting the current error because the static alreadyExists() method is trying to use the UserListIn variable, which is not static.

Static methods can only make use of static class member variables and can only call static methods unless they create or already have access to an instance of the class for that method.

edit: Bottom line - remove all occurrences of the word 'static' from that class.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Take a look at the NeHe OpenGL tutorials found here: http://nehe.gamedev.net/

It should get you up to speed pretty quickly on the basics.

You certainly don't need to use Linux unless you just happen to want to.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

I meant you have to declare the method as static, not the variable that you are using to hold the result of that method call, which is what you did above.

You should actually just remove the static declaration from the addMember() method anyway and make sure you are using an instance of ManipulateGymUser in your other code.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

It has to be declared static because you are calling it from within a static method. Note, making all methods static might be convenient , but it's a very bad idea as a general progamming strategy.

You should be learning to create objects and call methods on those objects, rather than writing what amounts to a procedural program with statics.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

And then they snicker because they know you will nick yourself on the knives all the time :P

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

You very nearly have it but only need the changes I mentioned

public boolean alreadyExists(GymUser user) {
    for(GymUser listEntry : UserListIn) {
        if(listEntry.getId() == user.getId()) {
            return true;
        }
    }
    return false;
}

and that method needs to be defined in the class that contains your "UserListIn".

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

You don't want to compare the list entry against "m_UserrID", you need to compare it against the id value from the parameter that you passed to the method.

That method should also be declared in whatever class has your "UserListIn" list. It doesn't really have anything to do with the definition of a gym user.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Sure, you can use length. The parsing problem is that you are using the indexOf(",") value to start, when you should use indexOf(",")+1. You are getting the comma and it won't parse that.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

There is nothing special about the loop. You just need a plain old for() loop over all of the entries

int idToFind=999;  // example value
for (int i=0; i<list.size(); i++){
  Entry listEntry = (Entry) list.get(i);
  if (listEntry.getId() == idToFind){
    return true;
  }
}
return false;

Obviously, you need to use your own parameter and class type values (not Entry) for the comparison. This is also the "old-fashioned" way to do it with explicit casting. With generics and the for-each loop there is even less to it

int idToFind=999;  // example value
for (Entry listEntry : list){
  if (listEntry.getId() == idToFind){
    return true;
  }
}
return false;
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

2 - McCain is running as a Republican candidate, but his history in office, especially recently, indicates he's of a more 'liberal' mindset, and 'liberal'ism tends to be associated with the Democrats.

MCain actually has a pretty conservative record, but there have been a few notable deviations for which he's received a lot of criticism: http://en.wikipedia.org/wiki/John_mccain#Political_positions

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

That method does not remotely resemble what javaAddict explained. The method needs to loop through the entries in your collection checking each ID. If one of them has that ID then it should return true.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Simple, just ask GWB. It will be the same chauffeur.

Cheney?

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

So far, the two people I know who have had it are happy with the results. Obviously that is purely anecdotal and subject to statistics.

I think I would be a bit nervous as well with even a single digit chance of causing damage.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

The trick is to avoid stressful situations by sleeping 24/7.

Your mortgage and utility companies may disagree.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

@Bennet: During your college years there will be no other time in your life where you will have a continuous flow of chicks. Make the most of it.

Carpe Diem.

It would be "Carpe dame" in that case I guess?

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

On an unrelated age note, Bob Dole was on The Colbert Report the other night and he's holding up pretty darn well at 84.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

I respect age, my grandpapa is in his eighties and still as sharp as a tack. Then of course that is very rare!

Respecting age is one thing - putting it in charge of a world superpower is another. A good many of persons 70+ shouldn't even be operating a motor vehicle :P

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

McCain is 2 years older than Reagan was when he took office.

(But, yeah, he's old :) )

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

Romney's gone.

So we're now assured that a Democrat wins in 2008 -- there are no Republicans running!

Wow, I hadn't heard that yet. That's going to cause quite a stir.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Most other threads are at least intellectually stimulating.. or at least not so irrelevant.

Oh, you mean like "What are you eating/drinking right now?", which has 668 replies so far?

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Of course there is an error - you haven't written the method alreadyExists() yet. That is exactly what javaAddict was trying to tell you in the first place. You can't call methods that you haven't written yet.

Additionally, if you would actually read the API for HashMap, which Phaelex suggested, you would see that it has a method to see if a given key already exists, which makes it even easier on you.

If there is a requirement that you use ArrayList for an assignment, fine, that's valid. But if you're avoiding HashMap just because you don't know how to use it, that's just stubborn, lazy and ignorant.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

You cannot place those assignments ("card[0] ="SPADES Ace";") directly in the class body like that. Additionally, you are not using the template that was provided. You have declared card[] as an array of Deck, when the assignment declares deck[] an array of Card.

It also indicates that in the constructor, you should loop through a suits[] and ranks[] array to create a new Card object for each card in the deck. Your current code is trying to assign a string to each array element where it should be assigning a Card object (once you declare the deck array properly).

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Well, it took about 2 seconds to find with Google:
http://en.wikipedia.org/wiki/Pi#Calculating_.CF.80

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

It doesn't show because you reset the layout on the content pane before you add the text area panel. You can't just change the layout on the container like that midway through adding components. If you need to have separately laid out sections, create panels for those sections and place your components on those panels in whatever layout you need, then add those panels in an appropriate layout to the content pane.

Also, please use code tags when posting code. It is difficult to read the long unformatted mess that results when you put the code straight into the post.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

This is a ridiculously pointless thread..

And that's different from most other threads here how?