M Mistroni

Ranch Hand
+ Follow
since Oct 03, 2005
Merit badge: grant badges
For More
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 Mistroni

Hi guys
 i have been writing Java code for the last 17 years (3 years ago i moved to Python and Scala)
I was SCJP 1.5 and want now to get certified for 1.8  ... and  was wondering what is the best way forward?
I am not sure there is a Java 1.5 to 8 upgrade exam, and also i am not sure if i shall go directly to OCP 1.8 rather than going via OCA 1.8 - OCA seems basic, having code professionally in Java for most of my professional experience..

Thanks in advance and regards
Marco
Hello Pierre
i m currently reading your book FP in Java, it's really cool!
One question for you though.. on the fibonacci implementation with two accumulators
Why , even wtih two accumulators, the code will still end up with a STackOverflow error? is it because java still use the stack even though the last call in the function is a call to itself?
From previous page, i understood that if the last call of a recursive function is a call to itself, nothing needs to be put on the stack?

thanks in advance and regards
Marco
6 years ago
Hi
i am stumbling across this few years later as part of another Coursera Scala course
i followed advices here as well as looking throuhg the Water Pouring problem, but somehow my code is spinning out of control as it seems to never end
Ideally, the from method should end when there are no more neighbours , correct?

So presumably the block representing Block(goal, goal) shold return no neighbours.... is that correct?

thanks in advance and regards
marco
7 years ago
HI all
i am working on an existing standalone app which, in its logic does the following
- authenticates itself usign SSL and a certificate with a remote REST application
- call a jax-ws webservice
- perform some computation

I have generated the jax-ws stubs using wsimport, and the WSLD location is on an https:// site

Because the application is launched using -Djavax.ssl property specifying a certificate , when i do the jaxws call jaxws picks up the certificate (which has been generated for the REST CALL) and fail miserably
If i dont' use the certificate in the -D call, i can successfully retrieve data from jaxws site, but i cannot authenticate to the REST app

I have a workaround, which would be to first call the JAXWS, and then programmatically set the -Djavax.ssl property to use certificate before i call the REST application.. but i was wondering if there is a way
for jax-ws generatd stubs to skip ssl validation

Anyone could help?
kindest regards
marco






9 years ago
HI all
i currently have SCJP 1.5 and i'd like to take the 1.7 exam.
Questions:
1 - is there an upgrade exam or do i have to to for the full 1.7 exam
2 - are there any books available to study for the exam?

w/kindest regards
Marco
Hi all
i was asked a synchronization question during a java interview......(which i failed btw)...
question was
suppose i have following class



There is a main thread which creates 10 instances of MyThread and start them.
- What are the possible values you see on the screen ?
- What is the minimum value you see
- What is the max value you see

I said that, as the counter is not synchronized, you will see values oscillating between 1 and potentially 100,. with values potentially
going up and down as thread increment the counter.

He replied (answer that is still bothering me) that the minimum value could be zero... because the JVM could just store the counter variable in
memory and forget about updating it.

I took his answer for granted (as i failed the interview)... but the more i think about it, the more it seems i got it right and he got it completely wrong

The variable is static. why java woudl it put in a memory location and forget about updating it, as the variable is shared between all MyThread instances?

I thought for a moment that he confused himself and forgot that he told me that the variable is static,. But then again, if the variable is not static, each counter
will be cached locally for each thread, and still get incremented.

Could anyone explain me how is it possible that i could see the value zero in the output?

w/kindest regards
Marco














Hello Lester..

thanks for the suggestion..

my current code uses split etc, and i have thought that regexp could help me doing it in a better way...

i'll stick to what i have then

thanks and regards
marco

13 years ago
Hello all
i am trying to parse a fix protocol string using a regular expression, but somehow i am failing and i don't understand why. do bear in mind, i have never used regexp before and even though i read
many tutorials, there's still something i am missing.

Here's the string i am trying to parse. it's a Fix protocol string that starts always with 8=Fix and end always with 10=\\d{3} (3 digit string).

8=Fix4.2;49=TW;35=A;56=ISLD;34=1;10=140;8=Fix4.1;49=ZZ;35=D;56=IS;34=44;10=140;

As you can notice, there are 2 messages in the string above.
I am using this regexp to parse it

8=Fix.*\\D10=\\d{3};

But whenever i use that pattern, the 'match' found is the whole string, as effectively it starts with 8=Fix and ends with 10=140.

It should match the two substring, one that starts at 8=Fix4.2 and ends at 10=140 and the other that starts at 8=Fix4.1 and ends at 10=140

could anyone help ?

rgds
marco






i am guessing it's not the correct one... that pattern says match everything between 8=Fix and 10= followed by 3 digits.



13 years ago
Hello all
i m a java developer which has been coding serverside code for a long time.
I decided to spend some time trying to learn Swing...

i was wondering if anyone is aware of what's the best architecture for a standalone Swing GUI?

I have found MVC, or MVC using Observable classes etc

Could anyone point me to the best way to design a Swing GUI? I m interested in your opinion based on experience, not on
some google 'Swing MVC tutorial' ...

thanks and regards
marco
14 years ago
Hello all,
i passed SCBCD 1.3 about one year and a half ago...
now i would like to 'upgrade' to SCBCD .....
anyone can tell me if there's any material for that?
secondly.. i am not sure if i should go for the upgrade xam or straight to the 5.0 exam..

anyone could advise?

thanks and regards
marco
hi all,
suddenly i m having a doubt about serialization and cannot find answers on the net.
If i serialize an object using JVM1, and then try to deserialize it using JVM2, will it work?
i mean, serialization / deserialization works across different java virtual machines?
i m guessing that answer is yes...

thanks and regards
marco
hi all,
i m going thru scjp 1.5 exams, i have produced a class that was mentioned in a question
here it is:


here's the output
Comparing:Good vs Bad
a-o=26
Comparing:Good vs Ugly
g-o=32
Comparing:Bad vs Ugly
g-a=37
UglyBadGood----
Ugly
a
o

i can't figure out why 'a' - 'o' will produce 26.. where does that number come from?

anyone could help?

thanks and regards
marco
hello,
i m studying for SCJP 1.5 upgrade and , in formatting, i cannot understand what's the difference between 0 and #, as it seems that they both represents
integer digits.....

anyone could help?

thanks and regards
marco
hi all,
i m reading book for 1.5 certifications.
i am on the section of formatting
it's not clear to me why this fail

System.out.format("%d", 124.34) - trying to format a float using %d(integer)

while this one does not

System.out.format("%s", new Long("123")); - trying to format a LOng using %s(String)

anyone could clarify?

thanks and regards
marco
Hello,
thanks for the reply..
i didnt say using dao.create is totally bad..
beside, doing a google search for integration testing, i was not able to find a single result that uses a create() method for populating the database..

i take your point that if data is simple, you'd go for using a create() statement.
let's assume then that there's something wrong with your dao.create such as the population of the db fails.

then, for each and every testMethod method - where you should test the invocation of method Method - , you are actually calling 2 methods of your class - the create, and the methodMethod.

where would you go to find what is the problem? is it your create method or is your Method method that is causing the problem? or is it a change in the internal state of your object between create and method Method that is causing the problem? or everything is fine, it's just a mouse that step on the db server cable?
or create is fine and it's just method Method that is failing?

Personally, i would not use the code that i have written in order to populate the database for testing the code that i have written.
I'd use a robust framework that has been designed just for that.

It might be just my personal opinion though...

thanks for your feedback

regards
marco
16 years ago