Thiru Narayanan

Greenhorn
+ Follow
since Apr 30, 2001
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 Thiru Narayanan

I am using an application using Swing. I have to have a number of images to be displayed in the UI.
Which method will be better in terms of performance and speed?
1) Having a String array of the image file name and constructing an ImageIcon.
or
2) Constructing ImageIcons separately for each individual image file.
Thank you in advance.
THIRU
18 years ago
JDO
There is an exception when using Sybase with the JDO engine availabe with Forte4J. Can anybody suggest some solution to this please?
The exception that we get :::
*******************************
NestedException: com.sybase.jdbc.SybSQLException: ASA Error -131: Syntax error near ' '
FailedObjectArray: [com.eq.smile.models.Exercise@1050be] at
com.sun.forte4j.persistence.internal.runtime.core.SqlStore.executeSql (SqlStore.java:741) at
com.sun.forte4j.persistence.internal.runtime.core.SqlStore.update(SqlStore.java:2085)at com.sun.forte4j.persistence.internal.runtime.core.SqlStore.execute(SqlStore.java:424) at com.sun.forte4j.persistence.internal.runtime.core.SqlStateManager.updatePersistent SqlStateManager.java:885) at com.sun.forte4j.persistence.internal.runtime.jdo.PersistenceManagerImpl.beforeCompletion PersistenceManagerImpl.java:805) at com.sun.forte4j.persistence.internal.runtime.jdo.PersistenceManagerImpl.internalFlush (PersistenceManagerImpl.java:1209) at com.sun.forte4j.persistence.internal.query.QueryImpl.flush(QueryImpl.java:459) at com.sun.forte4j.persistence.internal.query.QueryImpl.execute(QueryImpl.java:336)
*******************************
From the Help Documentation of Sybase, the error no. 131(error no. stated in the exception ), states that these type of error occurs only when the field name is a keyword, but we don't use any keywords as field names in the table.
Hi,
What happened to the initial hype of JDO? I thought some 6 months back JavaRanch Saloon would have seperate JDO section.
Still many of the products are in beta and no supports of even the available products!
Anybody has some inside info?
Hi,
It is surprising that in such a busy site with so many sheriefs, et.al. there is no reply to this message for more than a year!
I just have a doubt with JDO and came searching for an answer. But will I get an answer?
THIRU
Thank you vishal. That is how I am doing it now. Just wanted to know whether it is possible.
THIRU
18 years ago
JSP
We can pass a parameter to the setProperty tag with the "value=" attribute. Is it possible to pass a parameter to the getProperty tag? If so, can the same "value=" attribute be used?
Thank you,
THIRU
18 years ago
JSP
Thank you Manfred.
I was under the impression that the static block will just print the empty string. Overlooked the fact that startsWith() method returns a boolean value.
19 years ago
Thank you very much Jane
19 years ago
public class Q1 {
static void processorB() {
System.out.println(" is a boolean Operator.");
}

static Q1 processorA(){
Q1 q=null;
if (("java").startsWith("null"))
return q;
else
return null;
}

static {
System.out.print("Java".startsWith(""));
}

public static void main(String[] args) {
processorA().processorB();
}
}
The answer for this program is given as "true is a boolean operator". Can anyone please explain how it comes?
This one is one of the toughest I have encountered so far! I thought the answer should be only "is a boolean operator"
THIRU
19 years ago
Thank you Jane & Manfred.
Can you please clarify my understanding one of the corollary from this solution.
"When you cast a primitive of higher capacity to a lower capacity then the sign may get changed"
for example, in the above case if:
byte a = -61;
byte b = (byte)~a;
Even though the right most (32nd bit) is 1 (i.e. negative), because of the casting the result will be positive (+60).
THIRU

Originally posted by Manfred Leonhardt:
b = ~a
1. Convert a from byte to integer:
a = 0000 0000 0000 0000 0000 0000 0011 1100
b = ~(0000 0000 0000 0000 0000 0000 0011 1100)
2. Flip all bits:
b = 1111 1111 1111 1111 1111 1111 1100 0011
At this point we have an integer variable being assigned to a byte variable. The compiler will complain about the sizing difference so you need to perform the cast (which you have done).
4. b = (byte)(1111 1111 1111 1111 1111 1111 1100 0011)
5. b = 1100 0011 = -61
Regards,
Manfred.


19 years ago
Thank you Manfred,
That is really useful.
THIRU
19 years ago
Thank you Annie.
Can anybody please clarify one more point.
If a value is returned from the 'finally' block, when the exception is not caught what will happen?
THIRU
19 years ago
Thank you Jyotsna & Andrew,
I do not think there is any need to check it, as the short circuit '&&' will not execute the second part if the first part returns a 'false'
THIRU
19 years ago
public class RR10
{
public static void main(String[] args)
{
byte a = 60;
byte b = (byte)~a;
System.out.println("a is " + a);
System.out.println("b is " + b);
}
}
In the topic with the same name (which is unforutnately locked) the reason for getting the value "b is -61" is given as b being an integer variable. But even if we cast the ~a to byte value, the answer is same. Is it because the '~' operator works only on integers? Even if so, after casting it should be only 8 bits long, is it not?
Can any one please help..
19 years ago
The answer A is surely wrong. Because the wait method is not defined in the Thread Class but in "OBJECT" class.
THIRU
19 years ago
Given the following definition:
String s = null;
Which code fragment will cause an exception of type NullPointerException to be thrown.
A. if ((s != null) & (s.length()>0))
B. if ((s != null) && (s.length()>0))
C. if ((s != null) | (s.length()>0))
D. if ((s != null) | | (s.length()>0))
The answer is given as all the options. My understanding was that the correct answers are only A, C & D. Since the second part of option 'B' will not get executed. Can you please clarify this?
THIRU
19 years ago