Maurizio Nagni

Ranch Hand
+ Follow
since May 29, 2004
Merit badge: grant badges
SCPJ 1.4
For More
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Maurizio Nagni

If can add my 10 cents..... In Linux is quite straight to execute any command to a remote machine. The "secret" tool is called SSH.
As explained in the ssh man pages "ssh (SSH client) is a program for logging into a remote machine and for executing commands on a remote machine."

For example

Obviously the problem is if you want to executes all the commands as batch file: in this case how solve the SSH login prompt? Your smart solution would be to use an automatic logging throught "key authentication". You can find info about this last point here.

At this point, if you really want to do more magic things, you can just use SCP to copy a batch file into the remote machine and call it through SSH whenever you need.

ok... that were my 10 cents
15 years ago
Diksha, I guess that all you need is something like

15 years ago
You are right it is a curious situation, but with some logic we can get out of this "paradox".
The private signature forbidden any call outside the class it is defined, that's clear, and that's why anyway you cannot call from your ovrerridden method: because is private, it calls the "speak" method of the class the call is in.
May be to make it more clear try to compare your code with

you will receive an error because speak() is private

To make it worthly work your code should look something like

now the oroginal method is protected, but it print out "My Frog is speaking..." as you expected because the method can be called outside the class it is defined.
15 years ago
Dear Vamsi,

could you please better explain your task? You say

i need a collection which don't accept dulicate values and orderd this case ordering is a property given by the Comparable interface


How can we get the values from LinkedHashMap in insertion order

...... in this case LinkedHasMap work as you ask (anyway same key will remain in the same position not promoted in a higher position)

so, before of all, which are your needs?
15 years ago
I would like to add my 5 cents....
For sure we agree that a Java class (as well a C++) containing a main method, starts a process but, at the same time, to make the main alive, the JVM starts a thread, eventually the father of all the next generated threads, right?
In this case, supposing a java/C++ application (it is for simplicty), thought as collection of N etherogeneous software, each one called throught a main method, can we affirm that the application can contains at least N process, that is, at least the number of main methods? In other words is a process the first thread to be created?
If so the difference between Process and Thread could be compared to a tree where the trunk (the main methods) and the branches (the thread) are "functionally" almost the same, if not that cutting the trunk will kill the whole process, but anatomically are just the same.
Do you agree?
There is no secret: preapare a clean, extensive, well indented web.xml template and..... try to memorize it.
good luck
The answer is definitely: no, scriptlet and directive are two well distinguished items.
In a MVC vision, the scriptlet code directly interferes with the business logic of the page (it can generate new methods inside the servlet generated from the page) and that's why is is discouraged, because parameters manipulation should be controlled ONLY from your classes NOT from your page; in the page you can choose what to show and what not BUT you should not be able to change the data (oh well at least you can POST new data but this does not mean it will be changed if your business logic forbidden that operation).

On the other hand the directives handles "just" the view-side of the page (page, include, taglib): they do not manipulate your page parameters.

If you now look at the EL expressions you will see that you can compare or show some parameters but still you cannot change their inner value. Anyway if you want to have a pure MVC schema you know, I guess, that you can use the isELenabled disable also the EL and (surprise, surprise!) both script and EL can be be set per page

or per servlet (in web.xml)

but still no way to disable the directive because, again, they do not interfere with the business logic.
15 years ago
just to make clear the point. Whe you write

Object item = new Object();

you are making item referencing to the created Object

when you write

Object itemCopy = item;

you are referring another object to the previously created object. Note that item and itemCopy are links to one object, that is they are not the object!

Now, suppose you progam runs for 100 years, even if you DO NOT use both item or itemCopy for 100 years the garbage collector will never throw away the object because item and itemCopy refer to it.
To authorize the garbage collector to destroy the object it should be necessary that
1) the virtual machine is going out of memory then the garbage collector try to clean something
2) garbage collector can delete the object previously created only if
item = null;
intemCopy = null;

in this situation no link refer to the previously created object so the garbage collector is authorized to take back its memory space. Anway remember: the garbage collector runs ONLY when IT WANTS to run
15 years ago
please allow me to guess.... did you used something like

ResourceBundle.getBundle(String name) ?

if it is so the compiler check references to links not to String. More technically the bundle is retrieved according to the ClassLoader associated to the class which call the getBundle and because the compiler cannot know the used ClassLoader you cannot check it in the way you want. If you see the Resourcebundle specification you can acquire some deeper hints
15 years ago
Well yes you can... but may be is a bit different from what you expect.

As you can see the lock is based on two different objects, so two different threads can call them indipendently. Anway is up to you verify that they do not destroy the class integrity, that is you do not write some class property while the other method is trying to read it, but as far concern method internal properties you are free.
15 years ago
The aa variable is implicitely public static final both are correct (if you remember to add a method to your classes and commas).
The advantage of the a.aa style is that the code is easier to read because you know from where it came the aa parameter.
Just a final note: do not start class names with non-capital letter... it is better you get used to some java standard
15 years ago
For sure in Java you can do it. You can do even more. Java can help you with a lot of support like NetBeans or Eclipse. Anyway you should have knowledge of the libraries and/or available tools even if you have knowlege of the language and that, as you understand is the hard part but internet can help you a lot on this search.
Anyway if you are looking for a simple batch language for fast prototyping I can suggest you also the Python language. It has not so extensive IDEs but has a lot of ready to be used libraries. Personally I used it to retrieve data from sites, synchronize the work of several programs and manipolate the file system. It could be worth to take a lot at it too.

have luck
15 years ago
ehm... what do you think to simplify your code using something like this below?
15 years ago
Supposing I do not know in which extension you mean "I know the basic concepts"

could be also written as

where the super() call the empty constructor of Base.

would require

but now if you write

you will receive an error because Base already contains a constructor so the default one is not created (by default), that is you cannot call the "super()" constructor.
15 years ago
Finally with a score of 85% I did it! My preparation was done mostly on already classic, and great, text "Head First". Moreover it could not be complete without the proper exercises and practical tests; for such test I used the Enthuware software: one test per day in the evening then, on the next day, I made analysis of the errors and a new test in the evening and then....
Anyway, even if you understand all of the Servlet JSP architecture, my biggest suggestion could be a very simple: memorize the web.xml, the Servlet and all the derived classes, the JspTag and the derived classses.
A practical and simple example of the this technique is to write down the Servlet class and its main methods then write down the GeneralServlet and ONLY its NEW main methods NOT the ones inerithed from the Servlet one; this kind of schema also give you a better understanding of the general architecture because it shows you WHERE and WHEN a method, or a class, appears.
What next? well I already submitted my Java Developer task and I am waiting for the second part of the exam but may be I will start to plan something out of Java like MySQL certification, before "attack" some other Sun Certifications

Still thanks to all of you