M. Gagnon

Ranch Hand
+ Follow
since Feb 18, 2004
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by M. Gagnon

Originally posted by M Beck:
that's a pretty slow machine, overall. i doubt you'll get much of anything to run quickly on such hardware, i'm afraid.



I really don't think that the processor or OS are causing the kind of delays I'm seeing. Yes, MS Word is very slow on my machine, but Java apps, including Sun's NetBeans IDE, move at a fraction of a snail's pace. Honestly, it's so slow that the apps are rendered useless.
14 years ago
I'm running Windows 98 on an AMD K2-6 processor.
14 years ago
Just as a bit of good object-oriented design advice, it is probably best to define the add(), subtract() and multiply() methods in the Matrix class. An object should encapsulate the data it's representing as well as the methods used to manipulate that data.

I really should have carefully read your post before replying. Sorry about that.
14 years ago
Ah, one more thing. You mention you get an error for accessing Matrix a.

Originally posted by Timothy Leong:


public class MatrixMain{
public static void main(String args[])
{
Matrix a = new a();
......
}

public static option1()
{
//Do adding here....
//Get error for accessing Matrix a here
}
}



You have declared Matrix a within the main() method. To access Matrix a in the option1() method, you will have to pass it as a parameter or declare it as an instance variable of the class and make it a static instance variable at that.
14 years ago
Well, if it's written in Java (provided it compiles and runs), it's object oriented by definition. Except for the primitive data types, everything in Java is an object.

What I did notice about your code is that you define a class, MatrixMain, and then create an object of type Matrix using:

Matrix a = new a();

What you need at this line is:

Matrix a = new Matrix();
14 years ago
Thanks. I ran your code and it looks like I am using the Sun JVM. The first few lines of output are:

java.runtime.name: Java(TM) 2 Runtime Environment, Standard Edition
sun.boot.library.path: C:\J2SDK_NB\J2SDK1.4.2\JRE\bin
java.vm.version: 1.4.2-b28
java.vm.vendor: Sun Microsystems Inc.
java.vendor.url: http://java.sun.com/

So, any ideas why Java GUI apps are SOOOOOOOO slow on my machine?
14 years ago
I'm also fond of TextPad, enough so that I did pay for it ;-)

I think it was about $40.

http://www.textpad.com/
14 years ago

Originally posted by daniel hyslop:

120/0.0 is infinity

Would someone be kind enough to tell me what causes the difference in output when a varialbles initialiser is changed , please



According to Horstman and Cornell in "Core Java", that is the normal behavior for types float and double:

". . . the result of dividing a positive number by 0 is positive infinity."

I think it's probably because floating point numbers always have a limited precision.
14 years ago
I have noticed that all Java Swing apps run painfully slowly on my machine. Actually, painfully doesn't begin to describe how slowly they run. I believe I read somewhere that this phenomenon is the result of running Microsoft's JVM rather than Sun's. How can I find which JVM my machine is running and change it to Sun's JVM if I have Microsoft's?

Thanks in advance.
14 years ago
I think Malli's answer is a good one. When you have the init() method you can do things like the following:

MyClassWithLotsOfStaticMethods.setDbConnStr(getServletContext().getInitParameter("dbconn"));

With the above I can simply change the database connection string I need in the deployment descriptor when I change from one environment to another with no need to recompile anything. Way cool!
14 years ago
I think Padma is onto something. I remember trying the EL in my JSPs on my machine at home where it worked with no problem. Then I uploaded everything to my live site only to discover that my hosting service was still using JSP 1.2 and Servlets 2.3. If memory serves, the EL expressions were rendered literally.
14 years ago
I think Sanjeev is right. Do you have an import statement in the example you've posted here that we're not seeing?

<%@ include file="SomeOtherPage.jsp" %>

If so, that file must also have the same <useBean> tag in it.
14 years ago

Originally posted by Anthony Watson:
Store the bean in session scope and get it in the servlet with



Don't forget that you can store the bean in scopes other than session. If your bean has application scope, you'll need to get it from the ServletContext. For example:

YourClass yourClassInstance = (YourClass)getServletContext().getAttribute("yourBeanInstance");
14 years ago

Originally posted by david allen:

. . . the value that is actually being passed to the custom tag is
<c ut value=�${bean.name}� /> and not the value of bean.name.



I see you're using ${bean.name} in the JSTL <cout> tag value parameter. Are you using the same thing in your custom tag? For example:

<myLib:myTag myParam="${bean.name}" />
14 years ago
JSP

Originally posted by Bear Bibeault:
You should remove the web.xml entires entirely and let Tomcat auto-discover the TLDs.



Oo, can I give that a try, too? Didn't know it was possible!
14 years ago
JSP