Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp

Nevin kumar

Ranch Hand
+ Follow
since Mar 15, 2008
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 Nevin kumar

Dear Ranchers,

while marshalling If we don't initialize a few jaxb object properties it will not show those properties in the marshalled String(StringWriter ) but in my case I need to show all the elements irrespective of whether there are initialized or not.If it is a String there is no problem I'm initializing to empty ,but the problem is when I had datatypes like int,boolean and date also.In this case if I need to show the elements I need to show the elements with default values such 0,false which is not proper to show like that.

example:

Imagine employee object has properties like name,age etc

what it returns is(ignoring age as I didn't initialize)

but I'm expecting in either this form

or this form

If I initialize age(datatype is primitive int ) to default value in java code, it will return like this which doesn't make sense,age as 0.

Is there any to to show empty elements when uninitialized.Any help highly appreciated, I'm really struggling with this ,
7 years ago
I used jaxb earlier but there whatever input message I pass is an object which is same as my wsdl's input xsd so I don't have any
problem but now I had a web service which is expecting String as input message for a particular operation but that input String
is of nested xml elements,Considering the fact it's a huge set of nested xml elements I reckon I will use jaxb,but how to pass this object as an xml string.
I'm using spring ws 1.5

Typical spring ws client call looks like this.

Response1 response1 = (Response1) template.marshalSendAndReceive(url,request1);

Any guidance highly appreciated.
7 years ago
which version of IE are you using ?
8 years ago
JSP
I had used an open source ssh client api in java.I was successfully able to connect to linux box from windows machine,but when I tried connecting to windows from unix box.It says connection refused.I had no idea what is the problem ?I had given hostName, userId and password.Any suggestions highly appreciated.


java.net.ConnectException: Connection refused


8 years ago
Dear Rob,

I need to access a particular folder and check how many files are present and get their names and check the file size of each file not zero.some type of file operations.


8 years ago
@Ulf,

When I say connect I mean should be able to access windows from unix machine using a java program.Sometime back I used a ssh client (SFTP connection) for connecting from one mac book to other but I forgot the api .May you suggest any open source and free java api which will full fill my requirement.

@Paul

I need to check whether both the systems are connected in windows Network.



Guys, Thank you very much for your time.
8 years ago
Dear Ranchers,

From the java application which is running on a unix box, need to connect to windows machine and need to do some file operations.


Any help highly appreciated.
8 years ago
It depends on the company and how many times you switched your company.I know a few colleagues of mine are paid around 4 and 6 lakh' s.But on an average I can say it's around 5 lakh's.

If your target foreign companies you can get more than what indian companies pay.Rule is simple indian companies work only for profit and foreign companies(establish indian branches)primarily for cost cutting and then profit. That's the difference.
8 years ago
I reckon you can try jasypt library.
Dear Pramod,

It throws as exception because ? has special meaning in regular expressions.
? means Zero or one occurrence

change this line from arr = str.split("?"); to arr = str.split("\\?"); It

Reason:
String p = "?"; // regex sees this as the "?" metacharacter
String p = "\?"; // the compiler sees this as an illegal Java escape sequence
String p = "\\?"; // the compiler is happy, and regex sees a question mark, not a metacharacter

8 years ago
Dear Shaid,

The output should be "its A" and it is.

At this statement t.foo("test"); the behaviour of compiler and JVM as below:


compile time:

At compile time the compiler checks whether the parent class has any method which is compatible with single argument String as it is allows you to compile.

runtime :
At runtime as the parent class method is not overridden, child object has both methods(from parent as well as from child). So JVM calls child class method only in case when the parent class method is overridden.In this case it is not overridden because
foo(String... a) and foo(String a) are not same.


You can try Google's java collections,lambdaj features. you can apply filtering on all sort of collections.

8 years ago
you can use type=chain to navigate from one action to another in struts2

example :
<action name="makerDetails" class="abcAction">
<result name="redirect-abc" type="chain">
<param name="actionName">venus</param>
<param name="namespace">/wm</param>
</result>
</action>
8 years ago
Dear Amol,

You can get a hashing algorithm here http://www.webtoolkit.info/javascript/page/4 if required.As Henry suggested there is no reason to decryt the password,you can store the hashed password in the database directly and compare the same on login.The better way is always hashing and salting together.

regards,
Naveen

8 years ago