Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Use GridLayout or GridBagLayout.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

See response in your other thread about JTable and MSAccess.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

The jar file only contains the compiled class files. Generally, if open source code is available, it is included in a separate directory or zip/jar file. If this is a jar that you downloaded, look in the directory you placed the downloaded files in for the source. If it is not there, check the web page where you downloaded the jar. There may be a separate download for the source.


If you locate the source you can use the Library Manager in Netbeans to specify the location of that source code ("Sources" tab) and then you will be able to browse the code and step into if with the debugger if you wish.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

There may be some custom open-source code available out on the net somewhere, but there is no native component to do what you want.

To get data into a JTable, you will need to establish a JDBC connection (with JDBC-ODBC bridge for Access), obtain a ResultSet via a query, and then build a table model from those results.

If you look in your JDK installation directory there is a directory called "demo". If you go to "demo\jfc\TableExample", there are several examples of using tables with database connections. Those should provide plenty of sample code to get you started.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

I was playing around a bit scraping quotes from Yahoo and found a URL that will give you the quote as CSV text. You might see if this bit of code below helps you out:

try {
    // Create a URL for the desired symbol
    String symbol = "FFIDX";
    URL url = new URL("http://download.finance.yahoo.com/d/quotes.csv?s="+symbol+"&f=sl1d1t1c1ohgv&e=.csv");
    // Read all the text returned by the server
    BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
    String inputLine;
    StringBuilder doc = new StringBuilder();
    while ((inputLine = in.readLine()) != null){
        doc.append(inputLine);
    }
    if (doc!=null){
        String[] parsed = doc.toString().split(",");
        System.out.println("Symbol: "+parsed[0]);
        System.out.println("Price: "+parsed[1]);
    }

    in.close();
} catch (MalformedURLException e) {
} catch (IOException e) {
}
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Since you have an address that accepts the symbol as a request parameter, it should be trivial to scrape the quote from the HTML response. Take a look at this article I ran across in a quick search for "stock quote web service". The article is using C# but given the similarity to Java you shouldn't have any trouble with it:
http://dotnetjunkies.com/Article/A3E8CA89-9AA1-4C3B-BCC6-901C92A523E9.dcik

joshSCH commented: Thanks for helping me :) +12
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Yes, all "rights" are based upon societal expectations of the norm. Nature does not grant any right innately - miscarriage and other such incidents of pre-birth death belie even the right to be born.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

If you are using Firefox (which of course you SHOULD be!! :) ), you might find this add-on useful in picking through how a site is doing things:
Web Developer : https://addons.mozilla.org/en-US/firefox/addon/60

It adds a toolbar that lets you inspect all kinds of things going on in a page.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Has anyone here read any of Steven Erikson's "Malazan Book of the Fallen" series (epic fantasy)? I picked up the second of the series "Deadhouse Gates" at the airport awhile back just to have a long book to read on a trip. It took a bit to get into, but overall was a really good story. I still haven't read the first, nor any of the others (seven I believe).

Just curious if anyone has read any of the other books in the series and what their thoughts were.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Eh, well.. We haven't ever encountered something with infinite mass, infinite energy, infinite time (immortal), etc. Infinity is just a mathematical concept used to perform certain calculations.. it is quite useful; however, I don't think it is applicable in the case of the universe..

Just curious, but why do you think that it is not applicable to the universe? We've certainly not managed to glimpse or detect the whole of it, so I would assume it unknowable at this point in time.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Regular expressions can be tricky to learn, but they are very powerful once you get the hang of them.

I wrote up a small reg ex testing form that I often use to help me test and tune the behavior of a particular pattern. I'll post it here and perhaps it will help in your learning and testing. The numbered fields at the bottom contain the match groups returned by the Matcher that is generated when you click "Test":

/*
 * RegExTest.java
 */

import java.awt.Dimension;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.swing.UIManager;

public class RegExTest extends javax.swing.JFrame {
    
    /** Creates new form RegExTest */
    public RegExTest() {
        try {
            UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
        } catch (Exception ex) {        }
        Dimension screenDim = getToolkit().getScreenSize();
        initComponents();
        setBounds((screenDim.width-getBounds().width)/2, (screenDim.height-getBounds().height)/2, getBounds().width, getBounds().height);
        getRootPane().setDefaultButton(btnTest);
    }
    
    private javax.swing.JButton btnTest;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JLabel lblResult;
    private javax.swing.JTextField txt0;
    private javax.swing.JTextField txt1;
    private javax.swing.JTextField txt2;
    private javax.swing.JTextField txt3;
    private javax.swing.JTextField txt4;
    private javax.swing.JTextField txt5;
    private javax.swing.JTextField txtPattern;
    private javax.swing.JTextField txtText;

    private void initComponents() {
        java.awt.GridBagConstraints gridBagConstraints;

        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        txtPattern = new javax.swing.JTextField();
        txtText = new javax.swing.JTextField();
        lblResult = new javax.swing.JLabel();
        btnTest = new javax.swing.JButton();
        txt0 = new javax.swing.JTextField();
        txt1 = new javax.swing.JTextField();
        txt2 = new javax.swing.JTextField();
        jLabel3 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        txt3 = new javax.swing.JTextField();
        jLabel7 = new …
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Have you read the Tomcat documentation? I would imagine there are tuning parameters that you can adjust. JVM heap size is usually specified on the command line that starts the java application using the -Xms and -Xmx parameters.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

I know, right? In senior English we read like 3-4 sex books... I swear, they were all about sex, and had just about every curse word in the English language..

It's the only way to get high school seniors to read anything! :)

Rashakil Fol commented: Dun dun dun! On-topic. +6
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Anyway, I finished reading the first eight chapters of Crime and Punishment and I'm suprised that my school is having us read books where the protagonist is a cereal killer. It's a very interesting book though.

Yes, the scene in which the killer chokes the young Frosted Flakes to death is fairly brutal... and when he bludgeons that old Apple Jack with a pipe I had to put the book down for a few minutes.

:P

Just teasing! I actually never have read that book and probably should.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

I an a newbie at Java so I don't know much about Vector of ArrayList.

Ah, sorry that was a typo that shoud have read Vector or ArrayList. They are merely array-backed collections of objects that provide for iteration and also random access (insertion, removal, retrieval).

Anyway I solved it by creating a temp LinkedList. I don't know if it's the most effective solution......

[B]public [/B][B]static [/B][B]int[/B] countCards(LinkedList<Card> content){
[B]int[/B] total = 0;
LinkedList<Card> temp = [B]new[/B] LinkedList<Card>();
temp = content;
 
[B]while[/B] (!temp.isEmpty()){
total += temp.removeFirst().rank();
}
 
[B]return[/B] total;
}

Thanks again for all input.

You don't really need to remove from the list just to examine things in the list. You can simply iterate the collection with a "for each" loop, so your example code becomes:

[B]public [/B][B]static [/B][B]int[/B] countCards(LinkedList<Card> content){
[B]int[/B] total = 0;
for (Card card : content){
  total += card.rank();
}
 
[B]return[/B] total;
}
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

If we are talking about book sales ~ the bible wins.
nothing comes close to the amount of those that have been sold

I don't think we were talking about sales, but great books. Those are not necessarily congruent.

It looks like your flamebait worked though...

Rashakil Fol commented: Rerail! Yay. +6
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

>If someone has a strong opinion, it's impossible to change their mind with logic.

I agree with you in regards that when dealing with normal people, logic and science rarely are effective. What is usaully effective is raising peoples' misplaced emotions, that always works. But with scientists and other academics and highly intelligent people I do not believe this is the case. For example in Richard Dawkins's The God Delusion he briefly mentioned a scientist who for 15 years did not believe in Golgi Bodies. This all changed when a scientist delivered a presentation, essentially proving, beyond reasonable doubt, the existence of Golgi Bodies. After the presentation he stood up and said "I've been wrong for 15 years." Did he have a dogmatic and illogical opposition to Golgi Bodies? Was he indoctrinated at birth to believe in Golgi Bodies? No, he just felt that the evidence was not there. And when it was presented to him, he immediately changed his mind. There is nothing wrong with admitting you were wrong. This Richard Dawkins said "brought tears to his eyes."

I would agree. I could accept the existence of (a) God if there was conclusive evidence of such. As it stands, I've yet to find any. I do not count a collection of edited, translated, and subscripted writings of long dead men as compelling evidence at this point in time.
(No, this is not an invitation to discuss "what is evidence?", as it's a tired topic that I will not …

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Hmm.. Well yea, I'm a bit different from most of the atheists that I know. Perhaps its because I'm young, and think that I can easily persuade people with science and logic.. however, I have found this method to be inapplicable in most situations..

Yeah, you will give up on that eventually - after all the scars from beating your head against the wall grow calloused and faded :)

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

I don't think you can create a media player skin from Java. It seems to have it's own SDK. It doesn't sound too complicated though. Here is the MSDN page on how to create skins:
http://msdn2.microsoft.com/en-us/library/aa393417.aspx

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Plus, they get all uppity when it comes to theological questions.

That depends entirely on the question, however it can be difficult to have a serious conversation about something you find to be utter nonsense.

I long ago learned that debating anything of a religious nature is futile and only leads to resentment on both sides. Neither side is going to convince or "win over" the other. Discussion is perfectly possible, but as soon as one party tries to disavow the validity of the other viewpoint and press their own as the only correct one the discussion is essentially moot.

If you wish to make generalities about atheists, then the best fitting is perhaps that they become exceedingly irritated when religious people take it upon themselves to try to foist their belief system upon others. Most atheists that I have ever been around, including myself, do not make it a mission to convert others to atheism and seldom really talk about it much.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

I do not think you want to use fingerprint scanning for attendance. Not only is print recognition a complex process, but many people will not be happy being forced to present fingerprints for attendance.

I would recommend a barcode-based card approach instead. Barcode software and readers are widely available and easy to use.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Apache is a web server. Tomcat is a JSP/Servlet engine. Apache by itself has no mechanism to process the JSP or servlet request and must delegate these to Tomcat and return the result. Tomcat does have limited ability to act as a web server, however it does not offer the performance, scalability, or control that Apache will.

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

I think you would get a lot better advice if you posted this over in one of the Web Development forums. This forum is dedicated to the Java programming language (not the same as JSP or JavaScript).

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

The code below may work for you. I can't guarantee it won't give you some mistaken replacements, since I don't know the details of your potential inputs, but you should be able to tweak it to your needs.

I made a small test file "csv.txt" that consisted of the following entries:

1,"Bob","Just Bob"
2,"Mike","Not Bob, but Mike, a different guy"
3,,"Unknown,, two commas there"

and used the following code for parsing the entries:

try {
    BufferedReader reader = new BufferedReader(new FileReader("c:/temp/csv.txt"));
    Pattern pat = Pattern.compile(",(\".+?\")");
    String line=null;
    while ((line=reader.readLine())!=null){
        Matcher matcher = pat.matcher(line);
        StringBuffer sb = new StringBuffer();
        while (matcher.find()){
            matcher.appendReplacement(sb,","+matcher.group(1).replaceAll(",","&comm"));
        }
        matcher.appendTail(sb);
        String[] fields = sb.toString().split(",");
        for (int i=0;i<fields.length;i++){
            String out = fields[i]!=null ? fields[i].replaceAll("&comm",",") : "";
            System.out.println(out);
        }
    }
} catch (FileNotFoundException ex) {
    ex.printStackTrace();
} catch (IOException ex) {
    ex.printStackTrace();
}

My example just prints each separate field to System.out, but I'm sure you can see how you would pipe them to whatever destination you needed.

Hope that helps a bit.

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

So you solved your issue or you still have a question? You haven't actually made a function there - just used an existing String function, but perhaps that is all you needed to do?

Note that if you are trimming input from a text box, you will want to first make sure that the string is not null as well

String inStr = aTextField.getText();
if (inStr != null)
  inStr = inStr.trim();
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

I would imagine you are getting the exception because you are trying to access an Account object in your array but you have not actually created any Account objects. The line

database=new Account[MAXACC];

creates an array of Account references, but those are still null until you assign an element an object like so

database[0] = new Account();

In your createnew() method, you are trying to call a method on an array member that does not yet have a valid object in it:

database[acc_logged_in].SETname(str);

You must create the Account object first before you reference it, so add

database[acc_logged_in] = new Account();

before you try to use any methods on that object.

There are several other OO organizational issues with the structure of the program, but that should help you deal with the null pointer.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

>>Narue was trying to explain her hate of christians.. lol jp
I have nothing against Christians. They're very pleasant people to be around when they keep their mouths shut.

Very aptly stated.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Tolkein's original intention?

>The Hobbit was largely backstory for the LotR trilogy.

Thats why I said prequel

I hate stories with so much detail.. useless detail too.

About 20 years ago I received a box set of the LoTR paperback series as a gift. I read a lot of fantasy back then and started in on The Hobbit immediately. Six months later I still hadn't bothered getting past the first quarter (if that) of the book - mired in seemingly trivial detail page after page, I was bored to tears with it.

After The Fellowship of the Ring movie came out a few years ago, my wife picked up the Lord of the Rings trilogy (single volume) and convinced me to read it after going on and on about how good it was. It was really a great book (or three technically)!

I still haven't gone back and taken another go at The Hobbit to see if perhaps my perspective of it was different now, but if you stopped reading LoTR because The Hobbit bored you, you may want to start with The Fellowship of the Ring and see if that suits you better. It certainly did me.

Rashakil Fol commented: Another on-topic post. +6
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

I also recommend this link below:

Start and First program:
http://www.programmerstalk.net/thread723.html

Ugh, I would definitely NOT recommend a link to that forum - unless you want to read pages of "hlp pls, jva program" posts by people wanting their homework done for them. Granted, it is a new forum and may improve over time, but at this point it is just awful.

Stay here if you honestly need help with something!

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

You can also set the classpath as a parameter when you execute javac:

javac -cp "c:/program..swing-layout-1.0.jar" myCode.java
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

> thats cuz they're retarded

I'm not a jehova's witness, but please don't insult them.

pity them, perhaps...

Rashakil Fol commented: When trains derail, you're supposed to push them back on, not flip out and kill people. Er, threads. -1
christina>you commented: Equalizer +18
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Am I mistaken and List is not a class? What about this. However, you right List can be also interface but with less option then List class

Ah, yes, sorry I misread his intent. I was not thinking of the awt UI component, but rather the collection interface List.

Please disregard that bit about List :)

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

Hi thanks,
I have tried that also.Its now showing erro like"variable local_jlistmight not have been initialized"

This just means that you must set a value for the variable before it is used. You could change it's declaration to

public List local_jlist = null;
// or this
public List local_jlist = new ArrayList();

Note, you cannot simply say new List(), since List is an interface and not a class. You need to choose one of the List implementations to create.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Also, it has been requested of the poster that he use code tag at least 5 times and yet he still refuses.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

But they don't say what they want inspiration for. they can't do the tasks in QBasic..... so?

also "it will listen" makes no sense, i think they meant I.

I think he may have meant "It will sound silly...".

The rest was merely a tantrum with no clear objective.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Our project here at work is one file shy of 666 class files...

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Transcript of congressional hearing on this, May 9th, 2001:
http://www.skyaid.org/Skycar/congress_may_9_2001.htm

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Yes, the pork-barreling is deplorable, but unlike the aircraft thing at least most of those projects do get completed and benefit someone (roads, bridges, etc).

I just still cannot believe they are allowed to attach completely unrelated expenditure items like those to a bill they know must pass.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

As Jwenting mentioned, you need to start a new thread with your question and place your code between code tags to make it more readable. See the post at the top of the forum about code tags.

An illegal start of expression means that you have misformatted your code and it cannot be parsed correctly. This would include things like missing braces or parens, declaring a method within a method, missing semi-colon, etc.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

In my opinion, operator overloading provides no other functionality other than readability. Personally, why bother.

And the languages that do support overloading, I would doubt they support overloading of the intergal symbol.

Yes, I agree with you there. It does provide readability and code brevity in some cases, but in other cases it can be a source of confusion as well. I don't lament being unable to overload operators in Java.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Yeah, I wasn't sure if he wanted to display/parse a special symbol or implement something like operator overloading.

If you (mody2007), are wanting to overload an operator, Java does not provide any facility for that. You have to use class methods for things like that.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

We switched over to SVN about 6 months ago from VSS and like it a lot better. Not having locked "checked out" files has really made things much easier and it's pretty rare that we even have to manually resolve a merge conflict. Very nice to work with.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Ill try to answear the question there…
1. Are programmers the most frustrated lot among all the IT professional in the recent years?
Nope, because its just a some option for all off u to keep stay exist. in this case not only in IT’ers too but in every section that need ur brain to think some brand new in some section..
2. If yes, then what the reasons are?
For as mu assumption here… thas all because a depretion off some deadline. But i thing it will be paid by some feed back from the company (if works in office) by some bonus fee or some additional intensive money, let said like steve *see on the images at the top*. And it will be fine too if he have been sell some software / web in good price (if only work alone) and thats all

3. Many have been telling me that most of the graduate programmers leave the programming field for good just after 5 years on average. Is it any way true?
Its well come back in every steeps to see and term condition off the problem. Because theres nothing closed chance if he have some chance to changes a carrer in export import and will be a billioner in some times right ?
4. If yes, then what they do after leaving programming for good?
Like i have said before. Its will be back to the self off each …

iamthwee commented: Me too! +10
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

The following link should provide applets A to Z:
http://www.google.com/search?q=applet+tutorial&btnG=Search&hl=en

iamthwee commented: Doesn't include 'Q' or 'X' -2
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Directly from the API doc for Calendar class...

Like other locale-sensitive classes, Calendar provides a class method, getInstance, for getting a generally useful object of this type. Calendar's getInstance method returns a Calendar object whose calendar fields have been initialized with the current date and time: Calendar rightNow = Calendar.getInstance();