Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

I do agree that we should be careful with how the government interacts with our lives. As in 1984, the government first restricts small liberties which virtually do not affect its people. Over time though, these restrictions became fascist until the government was no longer run by the people. Also, I'd like to mention the movie "I, Robot". Hah.. A somewhat interesting and exciting movie. But it brings about a good point. The computer program who tried to take over the entire human race used the logic that humans' worst enemies are themselves.. and it is best to protect humanity from itself. While such logic is truly 'undeniable' it is also inhumane, and against what we as a society want. We should be very careful how the government handles civil situations.. we do not want to end up under complete control of totalitarian rulers.

From the CIA thread:

personally think the CIA is kick-a$$, and should be allowed to do whatever the hell they want.. So long as America is not attacked I really don't care how the CIA handles their business. I think it would be awesome to work for them.. or the NSA.

Do you not see how these two viewpoints are completely at odds with one another? You can't have it both ways. Choose wisely and keep these things in mind when elections and key legislature votes come up.

Quoting Ben Franklin:
"They who would give up an essential liberty for temporary security, deserve neither …

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Well it is just general curtsy to stub it out while eating, what about asthmatics? No one thinks of the suffering they have to go thorough near smokers. And also why do all the smokers have to smoke in the door way to places?!? I want to get into a store without getting a puff of toxic crap in my face.

Rather liberal uses of "no one" and "all" there don't you think? Some of us "smoking fools" do actually consider those around us and make every effort to keep our smoke away from non-smokers. Keep that in mind before you make ignorant blanket statements about "all smokers". Some of us do actually afford others common courtesy (not curtsy) - even those who most likely do not deserve it.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Actually, none of the responses even touch on the nature of the original post.

I am also married to a lovely wife. But due to the American Immigration policy I have been separated from my wife for last 18 months. I could not bring her with me after marriage since current immigration laws prohibits spouses and kids of lawful permanent residents(Green card holders) to bring them right away after marriage. The law do not consider them "immediate relative".

The issue is that spouses and children are not considered immediate relatives. Personally, I can't think of any way in which they would not be considered as such.

I am not supporting an effort to change it necessarily, but I did want to emphasize the distinction. This is a technicality of our current legal immigration rules and has nothing to do with illegal immigration.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

... they don't choose to inhale smoke, and they do not enjoy the atmosphere. But, hell.. if every restaurant is like that what can you do? Who doesn't enjoy the occasional trip to a restaurant for good food?

Non-smokers in the absence of smoking bans?

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Smoking in public is banned in the UK.

I assume this is indoor public areas? Any allowances for pubs?

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

You have defined 'columns' locally inside a try-catch block and are attempting to use it in another block. Move the declaration outside the first block so that it is visible to the second.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Nicotine rivals heroin in terms of addictive power. This in itself makes it difficult to just stop. The rest of equation comes from the psychological adaptations ingrained into the smoker - the "self-brainwashing" if you will. Until someone has smoked for a period of time, they cannot know the extent to which it can become ingrained into your life: your mundane daily routines, self-image, stress coping mechanisms, sense of satisfaction, and many other areas we don't usually consciously give a lot of thought to.

Do not discount the difficulty of giving up nicotine for most people. Many of us smokers keep smoking wishing we could quit; that one day we would just magically stop. We can quit of course, but it really screws with your head for a few weeks and is very stressful.

Personally, I've been "seriously going to quit" for about nine months now - and the quit date stays the same - "soon".

Keep in mind, every smoker eventually quits.

In the same vein that all bleeding stops - eventually...

~s.o.s~ commented: "all bleeding stops - eventually..." - That was deep :( +23
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

I would hardly call that evidence.. perhaps the smokers where you live are nice, but the ones here in texas are rude.. The evidence needs to be documented and places from all over the USA tested.. or else it isn't valid statistical data..

So you have performed statistical research on the rudeness of Texas smokers then, right? I mean, without that documented evidence, some might think it was merely anecdotal... :wink:

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

If you are using the Java Collections LinkedList class, you can use the size() method to determine the number of elements in the list.

I am wondering though, why not use a different collection to hold the cards? Would a Vector of ArrayList work just as well? Is there a compelling reason you are using LinkedList? You should examine your usage of a collection of objects and choose the collection implementation based upon your needs.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Ok, I missed one other thing on my first glance on the code. Your initialization block is not getting called because it is not static and you are using the class in a static manner. Add the 'static' keyword before your initialization block and it will work fine:

// initialisation block
    static {
        acc_logged_in=-1;
        no_acc_created=0;
        database=new Account[MAXACC];
        [B]for(int i=0;i<MAXACC;i++)
            database[i]=new Account();
[/B]    }

The initialization would have been called if you had created an instance of BankAccount, but in a static context you must also prefix such initialization blocks with the static keyowrd.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Actually, the part in bold was not necessarily what I had in mind - but it does fix the error. You really don't need to create Account objects until they are requested, as in createNew(). You would need to take care to make null checks before performing any operations on an array reference of course.

It would actually be easier if you used an ArrayList or Vector instead of the array for accounts. You would not be limited to a certain number and would not need to worry about null elements in the array. Optionally, you could also use a HashMap to store the account objects and use the account number as the key. This would eliminate having to loop all elements to find the account in login().

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Well, Netbeans has an "auto-correct" suggestion feature that you may be able to glean some ideas from if you want to study the source: http://www.netbeans.info/downloads/dev.php

Joone - Java Object Oriented Neural Engine http://www.jooneworld.com/ might be useful in your neural network development.

While I can see the value in pointing some of these things out to a beginner, you mention a few rules that may not be errors necessarily:

quote=PoovenM;390217

for (int k = 0; k < 10; k++);

will be flagged as a possible semantic error.

This for instance may be intentional depending upon the conditions within the loop itself, i.e. index advancement.

quote=PoovenM;390217

  • Differences between int and double mathematical operators
  • Mathematical analysis of user formulas (to alert programmer of possible outcome). For example pir would be flagged as possibly incorrect with pir^2 as a possible correction.

Deciphering the mixing of int and double operations may prove pretty tricky, though I guess you could make suggestions about casting etc if the compiler is complaining. The formula analysis though will probably be nigh impossible since, from your example of pir, pid is valid as the circumference and r or d has no intrinsic meaning within a program.

Anyway, those considerations aside (and obviously they are just opinions :) ), good luck with the project!

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

If you look at the Project Details section, there is an attribute Programming Language. This will tell you what language the project is written in and therefore how you would need to compile it.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Thanks a lot for your answer.

I would like to ask you something more about split parameter.

How can I make a regular expression that delete the words that is like I. II. III. IV. .... and <P ID=#> <P>.

Well, you will have to work a little bit on the regular expressions to match on your content. The expression "<P ID=\d+>" would match your "<P ID=#>" tags, if they are always of that form. "<P>" by itself will match "<P>", so not much to that one. The roman numerals will be a little trickier, since they are merely a sequence of vertain capital letters followed by a period (in your example at least). You might get away with the pattern "[IVXLCDM]+\." for those, but there is a slight change you might accidently match some of your text by mistake (pretty unlikely I would say though.

Have I to call split a lot of times or can I do it differently?

You can first use the regular expressions to strip things you do not want to capture. If you are reading a line at a time in to a string variable, you can strip things out by calling replaceAll() with your regular expression and an empty string"" for the replacement string. After stripping out the unwanted content, call split(" ") to split on spaces to get your array of words to write out to file.

BufferedReader reader = new BufferedReader(new FileReader("foo.in"));
String inputString = reader.readLine();

// strip out …
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Actually, you should use the split() method of String instead of StringTokenizer and use regular expressions to remove text that you do not wish to include. Split will split your string by whatever delimiter you specify and return the parts as a string array. Regular expressions will allow you to specify patterns to match the pieces you don't want to include. Sun has a tutorial on regular expressions here: http://java.sun.com/docs/books/tutorial/essential/regex/

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Use a BufferedWriter instead of DataOutputStream. You created a BufferedWriter like so:

BufferedWriter writer = new BufferedWriter( new FileWriter("myFile.txt") );

The tutorial that peter_budo linked should provide any other info you need on usage.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

There should be a ton of tutorials on the Net for both of those. I would recommend Googling for them. You might also want to check out http://www.gamedev.net.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Without a doubt, start with 2D if you are not already familiar with game programming concepts and graphics programming.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

You haven't specified any text for your menus. Use the constructor

JMenu gameMenu = new JMenu("Game");

and you will have a top level "Game" menu. Add the text for the other items and you will be set.

Also, you can ditch the getContentPane().add(topMenu). The setJMenuBar is sufficient.