Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Think about how the different entities interact. An inventory is simply a collection of things. Each of those things have properties such as a name, price, etc.

If you were using an inventory, what would it need to do? Perhaps list it's items, add a new item, remove an item. Arrays and other things like vectors allow you to manage a collection of things.

The things in the collection have various properties that describe them. To interact with each one, they provide methods to let you get or set their various properties and perhaps they may have other functions they can do. These methods define what you can do with a type of thing.

Keeping that in mind, consider how your inventory would keep track of many CDs, add a new CD, etc. A new CD object does not have any definition (or "state") until you set those properties on it.

I hope that helps a bit. I'm being a bit vague on purpose so that you will consider the parts of your program and how they should interact. Try to build them to act as real world entities, each with their own state and abilities.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

What class uses the CD class? A person or store may have many CDs and that would be an appropriate use for an array.

Compactdisk[] myCDs = new Compactdisk[100];
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Try starting with Sun's J2EE tutorial trail:
http://java.sun.com/javaee/5/docs/tutorial/doc/

There is a lot of information there. Specifically you will want to focus on basic JSP and Servlets. Take a look through those and perhaps Google "JSP servlet tutorial" for some extra info. If you have specific questions that you can't seem to get past then feel free to post them here for help :)

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

That was part of my misunderstanding. I was going to create an array for each variable. (I thought each variable would be a different type and require its own array).
Now I understand that I can use a single array for all field types. I just left in named cdaName because that made the most sence to me, it will be an array of cd information.
My problem now is that I do not understand where to put this array. I want it to be populated with information input from the user, so I think I need to keep all my get and set code, but where does my array tie in? Do I need to create another class completley?
I think my array should look something like

String cdaName[]= new String{cdName, price, itemno, nstock};

but I cannot find any examples of such a beast for me to learn and build off of.

Actually, that is not going to help you in the way that you think it might. With the array you have, you will have string entries for the name of each field - but no values for them. Now, you could use a two dimensional array to allow for the name/value pair, but how does that make your class more functional? It doesn't. It just makes it more confusing to use.

In short, there is no compelling reason for you to combine all your variables into an array at this point. Keep them as …

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Glad it works for you. Keep in mind the points jwenting mentioned though. I don't think you will have those issues with the code I pasted, but testing is your best friend.

Be sure you release the lock and close the channel when you no longer need them:

lock.release();
lockChannel.close();
lockFile.delete();
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

I'll vote in the democrat and republican primaries :)

Obama is my man on the dems, but I have no idea who I want to win on the republican side..

Bah, you're lucky in that Texas has an open primary. No such luck for me and I'm registered independent - can't vote in the primaries at all :(

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Drugs change the way people think - permanently in many cases. And they usually make people more careless. Accidents caused by drug use are sufficient alone to keep them illegal.

Stupidity causes accidents as well, though as yet it is still legal.
Talking to someone in the car while driving causes accidents - legal.
Taking too much cough syrup, allergy medication, or sleeping aids may cause accidents - legal.

At some point people must be responsible for and held accountable for their own behavior. The accountable part is where government comes in. Making everything illegal is not the solution to keeping everyone safe from their own irresponsible behavior.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Why do you wish to use an array for cd name? A cd only has a single name.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

ppl i have no idea wut u ppl are talkin about but if it is smokin then i have to say that i love it i smoke pipe weed dont see me as a nerd the pc is my 2nd hobby my first is babes ;) and cause of babes i smoke :@ but i am loving it hahahha so no body talks trash about smokin yall understand u bit***s

Was that English?

christina>you commented: hahaha +20
EnderX commented: A variation on the English Slanguage, maybe. +4
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

I hope to cash mine in for coffee mugs, teeshirts and other prizes.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Take another look at the line you have bolded - the return line. Does it match any variable in your program?

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Have you tried using the following?

Writer out   = new BufferedWriter(new OutputStreamWriter(new FileOutputStream("someFile")));

If your default encoding will not work correctly, you can specify encoding on the OutputStreamWriter (UTF-8 probably) by using the constructor that accepts a charset parameter.

If your default encoding (in Java, determined by your own system settings) works fine for Farsi, you can use the easier form of the writer:

Writer out = new BufferedWriter(new FileWriter("someFile"));
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

lockfiles are extremely risky.
What if the running instance of the application crashes (or the computer it's running on crashes which has the same effect)?

The lockfile will still be there when you start it again, causing it to never start until the file is manually removed.

Yes, depending on how you implement it, that is a risk. My code opens a FileChannel and obtains a lock with tryLock(). If the app crashes, this lock is lost. It deletes the existing lock file if one is present, so it doesn't really care if a previous lock was already there. I haven't been able to break it so far, but that doesn't mean it's bulletproof :)

try {
    lockFile = new File( env , "transport.lock");
    if (lockFile.exists())
        lockFile.delete();
    FileOutputStream lockFileOS = new FileOutputStream(lockFile);
    lockFileOS.close();
    lockChannel = new RandomAccessFile(lockFile,"rw").getChannel();
    lock = lockChannel.tryLock();
    if (lock==null) throw new Exception("Unable to obtain lock");
} catch (Exception e) {
    JOptionPane.showMessageDialog(this,"An instance of Job Selector is already running.","Warning",JOptionPane.WARNING_MESSAGE);
    e.printStackTrace();
    System.exit(0);
}

And what if some smartass finds out where the file is and removes it while the application is running? Now he can run as many instances as he wants side by side.

The file can't be deleted due to the lock in this case.

It works for us, but then I never though about the socket binding thing, so that may be an even easier and more well-behaved way to go about it.:)

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

You can use a lock file in your base directory as well. We use that here at work for one particular app that should only be running a single instance.

I hadn't thought about a socket binding though. Interesting alternative.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

This HTML is not really a good candidate for processing with an XPath. Typically the information you are working with in XML is meaningfully marked up in a relational manner with data being found in specific elements or attributes. Here your data is just in a generic TD tag. TD does not describe or annotate the data at all - it's just an HTML tag that could contain anything.

Basically what you are looking at is probably just plain old regex text parsing. Take a look at java regex and see if that works for you.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Although I tried to take this stance once, I realized there is a reason for the current system.

I agree there are reasons, but I still believe that proportional vote distribution of the electors would be preferable to the all-in system.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Seconded.

And "thirded" even.

genocide (I hate to even address someone who chose that as a name), you have shown no effort whatsoever. The only way to learn a language is to use it, which includes debugging. You have not even stated what you think is not working correctly. No one here is going to pick through this for you and attempt to fix it for you. You've made it quite clear you want a "project" done for you and you do not have any interest in learning anything about Java.

Also, some unsolicited advice: have a bit of common sense and decency in choosing a name by which to post.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

There is a difference between acting in a responsible manner and zealotry. Unfortunately many "Environmental Groups" fail to make a distinction =\

Aia commented: A very responsible comment. +6
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Nearly every President has expanded the power of the executive during times of war..

Of course - fear, nationalism, and guilt are a great platform from which to shove whatever you want down the populace's collective throat.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

It is as impossible to man to change the course of this earth as it is impossible for man to extend his arm and reverse the course of the river Mississippi upstream.

Perhaps, but it wouldn't hurt if we at least tried to not trash the hell out of it like we have been for way too many years :)

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Mars.
My wife is from Venus.
Go figure...

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

In addition to what Cerberus mentioned, Sun also has many tutorials available for free that you can learn from:
http://java.sun.com/docs/books/tutorial/

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Yep, Wampserver (one of a few WAMP packages available) is extremely easy to set up - just run the install :)
http://wampserver.com/en/

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

explain what it does..

Well, I would say it is a possible solution to the Dining Philosophers problem, which one quick Google search provided the explanation:
http://en.wikipedia.org/wiki/Dining_philosophers_problem

Are you wanting someone to walk you through how the code works step by step? I'm still not understanding what your question is exactly.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Still have a classpath problem then.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Popular vote has never been used to determine an election in this country.

Yes, I am aware of that fact, thank you. We still cling to an out-dated, gerrymandered electoral college system. Gore nearly won in that system as well and the circus that ensued in Florida demonstrates just how screwed up our election process can become. At the very least, electoral votes should remain intact and not be all thrown in to the majority winner of the state, as most still do. That is blatantly ignoring the voting will of the population.

I think Bush's demagogic abuse of power is criminal and our nation will pay for it for a long time to come. Obviously we have no way to know how Gore would have fared overall, but I doubt that he would have gotten us to this sorry state of national standing that Bush and his cronys have wrought.

Also, motorcade or none, at least Gore is bringing attention to some areas of environmental and energy responsibility that have been naively ignored for decades. I certainly won't defend him as a role model for his own message and the man with all the answers, but his work does have value in that at least people are paying attention.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Well, one thing as far as your animation loop goes, you generally want to keep track of the time between draw() returns and use that to calc the next time to draw, instead of using a fixed 1/12 second loop. The reason is that updates may different slightly (or even greatly in some cases) and you will get jumpy refreshes if you don't take that into account. There are a lot of example implementation of this out there if you need a reference. Just Google on "Java animation loop" (I don't have any examples here or I would post for you).

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Well, you have to wonder how much different things would have been these past 7 years if the courts hadn't appointed Bush in the 2000 election. Gore won the popular vote.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Ah, yes a sorted model would require more work on your part. Certainly doable by sorting the row data vector that backs the table model or by implementing the table model interface directly against your data source, but probably more work than it would be worth at this point :)

Glad you got it working to your expectations.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Well, the answer is very straightforward - no.

You are intentionally circumventing the trial period policy. How can you possibly wonder if this was intended to be ok? You are obviously NOT respecting the effort of the maker and DO want to steal the software, otherwise you would pay for the software as intended after the trial period expired.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Scary when you actually start taking notice of government and politics isn't it :P It's a shame many just don't pay any attention.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

C++ with DirectX of OpenGL is certainly a viable possibility - if you are comfortable with C++.

Other options would be Java with JOGL (binding for OpenGL), C#, or perhaps even Python with PyOpenGL.

It really depends on your programming background and what languages you feel comfortable with.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Since when is PDF read/write?

Well, only sort of. There are several writer objects in iText that allow you to import existing PDF content and generate new output content. I think that what the OP is wanting to do would be possible in iText, but I can't say from direct experience there.

Here is a bit of tutorial on manipulating existing docs with iText:
http://itextdocs.lowagie.com/tutorial/general/copystamp/index.html#inaction

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Explain what about it? You haven't asked a question.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

I would tend to think of the Scrollpane as a View of a View anyway. The Viewport references a component that is a View of underlying data. (Maybe Scrollpane is considered a Decorator? I don't know)

I think a more clear example of MVC in the Swing components would be the JTable and TableModel relationship.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Like I said... smoking can be beneficial if used in the right manner.

But most of the time in most people, the outcome is never good.

Well, I wouldn't even say the smoking is beneficial so much as the nicotine component has some beneficial properties. A delivery mechanism other than smoking would definitely be advisable.

(I'm a smoker who harbors no illusion that it's not bad for me)

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Well, I guess this has been around a long time. I never knew license fees like this were expected, but then I have never worked in an establishment with live music. Found a lot more info and discussion here:
http://yro.slashdot.org/article.pl?sid=07/07/08/1836256

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Yeah, that's pretty screwed up, but unfortunately it's not surprising. I wonder if it's just a recent thing or if they have been picking on cover bands like this for years? I thought artistic license was given to such things as "interpretations" or whatever.

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

Since I don't know anything about the details of your code, graphics detail, etc. I couldn't really say. Just start with the 900x600 if you like and see how it turns out :) Once you have the rest of the code finished you'll be in a position to tune and tweak.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Well, you are right that it isn't the most efficient way, but if your table is small and the performance is fine then stick with what works for you :) You can always come back to it if the performance becomes an issue.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

JavaMail is available here:
http://java.sun.com/products/javamail/index.jsp

However, from the following search results:
http://www.google.com/search?hl=en&q=+site:publib.boulder.ibm.com+javamail+websphere
It seems that WebSphere includes JavaMail. Many of the links above are references to older versions, so I am not sure if they have changed any of that, but they are probably worth checking out. It may be a simple alteration to your application classpath to find the jars.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Your max res and fps are probably only going to be determined through experimentation. Level of detail, number of objects updating per frame, complexity of game logic interactions and your own coding efficiency are all going to have an impact on performance.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

What is jaywalking? - and why s it illegal?

In general it's just ignoring pedestrian traffic rules, such as only crossing the road at a crosswalk, etc. Some places have laws about such things, others don't. Even in places who have such laws it is often not enforced for obvious reasons.

http://en.wikipedia.org/wiki/Jaywalking

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Caning for jaywalkers? You people have serious psychological issues. Or maybe just jtwenting.

hehe I should have qualified a bit. I think that is a bit harsh for jaywalking. Petty thieves, vandals, assault perps - yeah, cane them.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Do a lot of people actually go to their high school reunions? I wasn't planning on attending any of mine.. Simply b/c it would be a waste of time AND I'd rather not come back to this crappy town and visit my parents ;)

Skipped my 10, will probably skip the 20 as well.

But you should visit your parents anyway. =P

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

corporal punishmen is not just good for kids.
Public whipping or caning could be a serious deterrent for minor crimes like pickpockets and jaywalkers.

I agree, we could do with a caning policy over here in the States.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

I think the connect 4 idea was good anyways. I hope he comes back and tries it.

I agree :)

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Originally Posted by joshSCH http://www.daniweb.com/forums/myimages/buttons/viewpost.gif
Okay, perhaps you guys are taking this a little bit out of context. A little bit of anything is good. Ever heard of vaccines? Injecting a little bit of a virus into a human is enough to enable the human to build a sufficient immune response. If we look at things at such a microscopic level then just about EVERYTHING is good for you.

Finally.
Thank God for common sense.

Well of course not. It's a virus.

umm ....

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

I highly doubt a little bit of Ebola is good for you.