This week's book giveaway is in the Android forum.
We're giving away four copies of Head First Android and have David & Dawn Griffiths on-line!
See this thread for details.
Win a copy of Head First Android this week in the Android forum!

Peter Petrov

Greenhorn
+ Follow
since Feb 03, 2006
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 Peter Petrov

All I have is SCJP 1.4 exam taken. I took it in 2007 or so.

Can I now just go and take the current Java 7 upgrade exam

Java 7 Upgrade Exam

or other there other requirements I need to meet first?

Please point me to some official references which give the answer to my question.

Many thanks in advance.



Does anybody know what the Hibernate stack trace below means (some details & fix tips)?
I found a few sources on the web but not too explanatory, I think.
Some references or links would also be appreciated about this issue and its cause.

I mean I just would like to understand and fix the issue below.

Also, seems to me the id field is annotated property in the ReportEntry entity class.



But if so - what is the problem then?

Any help would be appreciated.
Many thanks in advance.







Your approach worked for me, thanks for that.

I found your post after doing a google search
for "debug third-party code with Intellij IDEA".

Which version of IntelliJ IDEA are you using?
I am currently working by using Intellij IDEA 7.0.5.

But I was expecting to get that behaviour (which you describe) by
adding the third party sources to the Application Server definition:
-> Click "Run"
-> Click "Edit Configurations"
-> Choose some Tomcat/JBoss server configuration which you already defined in IntelliJ IDEA
-> From the right container, from the server tab choose "Configure"
-> Click "Attach Sources"

So my question is: if my expectation is wrong, what is
the meaning of "Attach Sources" there (where I described) ?

Thanks in advance.

Well, thanks. That's amazing ;) After your reply I tried this
c = c + s;
this does not compile OK - it gives errors.

I never knew this I think, I thought the two assignments are just synonyms.
Did not suspect there's some difference in their semantics.

Is this something introduced after Java 1.4 ( new in 5.0 / 6.0 ) ?
12 years ago
This method compiles fine.



All variables are defined as long except the variable 'c'.

What am I missing?

12 years ago
MsJdbcCon or MsDBCon, what is the name of your class?

Seems it is the second one.

And in your source file (i.e. in your JSP) you define
your variable to be of type MsJdbcCon...
And as far as I understand the compiler just
says: "well, i do not know any class named MsJdbcCon"
which is quite logical. You import MsDBCon in your JSP
but you trying to use a class named MsJdbcCon.

Hope this helps.
[ June 03, 2006: Message edited by: Peter Petrov ]
15 years ago
JSP
http://www.excelsior-usa.com/landing/jet-exe.html

This one might be interesting to you.

Also you can open www.google.com and write there
".class files to exe convert" (without the quotation marks)
or something similar.

You will find lots of information with that google search.

Regards.
[ March 10, 2006: Message edited by: Peter Petrov ]
15 years ago
Well, Strings do not sleep

And judging by your excitement from the Thread.sleep()
method I suggest you start from here:
http://java.sun.com/docs/books/tutorial/essential/threads/

Regards.
15 years ago
Seems Reid M. Pinchback is right about the reflection.

Maybe in the previous versions of Java (before 1.4) there was
such option to call methods which you normally have no access to
via Java Reflection, I don't know.

I don't remember why I have left with that impression.
Maybe I've had a slightly different scenario.

The second solution though which I offered above should work
as I have had the same problem many times before. Just take
the source files you want to change, change the access
modifiers from default to public, then recompile only those
source files and put them somewhere in the classpath before
the normal/original library class (jar) files of EHCache.

This should do the job. And yes, I agree this is not a
performance question

Regards.
[ March 10, 2006: Message edited by: Peter Petrov ]
15 years ago
I am not very sure but I think with Java Reflection you can
basically call any method no matter private or default or
whatever the access modifier is. I know it is ugly idea but
maybe it could do the job.

Another solution is also possible. If that EHCache product is free and
open source you can just patch the binary distribution by changing
these access modifiers in the appropriate source file and then just recompile the source.

Then put the recompiled version of your patched class before
the EHCache distribution (probably it's some JAR I guess) in
your classpath and that's it. I do not
think this is any violation of their licence as you do not
redestribute the original EHCache product.

Hope one of these two ideas could help.

Regards.
[ March 09, 2006: Message edited by: Peter Petrov ]
15 years ago
Hello,

If you have a chat program why is it so hard for you to send those
X and Y? In your chat program you are probably sending strings in one
way or another. Well, then ... Where is the difference between that
and sending your X and Y for example? Maybe your problem is that you
need some sort of callback methods? I mean maybe you want that not
only your client can call the server but you also want the server
to be able to call the client in some situations. Is that so?

Regards.
I am not an expert but I would say the exams don't get upgraded.

A while after JDK 5.0 has appeared the corresponding SCJP exam
also appears. And that is SCJP 5.0.
The old exam for SCJP 1.4 is still available.

There's another thing called "Upgrade Exam" but it is for people
who let's say have the SCJP 1.4 already taken and want to just
get tested on the differences between 5.0 and 1.4 so that they
can also get the SCJP 5.0 title. This way they take a "smaller"
exam (than the full one for 5.0) but also get the title SCJP 5.0.

I hope this helps.
The compiler is not assuming this
The interpreter is assuming this because this
is what you tell him to assume.

Think a bit about it.

With the code you show you are actually going through the table
[1,2,3]
[4,5,6]
[7,8,9]
in the order 1->4->7->2->5->8->3->6->9
while you want to go that way:
1->2->3->4->5->6->7->8->9

Hope this helps.
[ February 15, 2006: Message edited by: Peter Petrov ]
Of course there's a formula.

The short (the integral type) is 16 signed bits.

So if s is Short (the wrapper type) we have
s.byteValue() = ( s.shortValue() & 0x00FF );
Let's denote this value so far by X.
So X = s.byteValue() = ( s.shortValue() & 0x00FF );
Then as a second step you want to see what is the
result of X % 128. But as we have the relation
-128 <= X <= 127
then it is pretty obvious that

X % 128 = 0 if and only if X == -128 ( but note that X can never be -128 ! )
X % 128 = X if and only if X != -128

Finally we can summarize this as follows:
for all values of s (being a Short wrapper object) we have:
(1) s.byteValue() % 128 = 0
if the last 8 bits of s (the less significant byte of s )
are 1000 0000 (this being the byte value -128 in decimal)

and

(2) s.byteValue() % 128 = ( s.shortValue() & 0x00FF )
in all other cases (all other cases for the less significant
byte of s).

Hope this helps. Note that the conclusion is that the
result which you are looking for depends only on the less
significant byte of s.
[ February 15, 2006: Message edited by: Peter Petrov ]
I think the question would have been much nicer if it was a real Thread-programming question and not one which just aims you to overlook that start() is called illegally. Anyway. What do you think would be the answer if we modify only the main() method like this:

[ February 14, 2006: Message edited by: Peter Petrov ]