Aditya Sirohi

Ranch Hand
+ Follow
since Jan 05, 2010
Aditya likes ...
Eclipse IDE VI Editor Linux
Boston, MA
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
2
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Aditya Sirohi

Hi All,

I am writing a dummy class to see how ObjectInputStream works. I was able to successfully serialize an Object, but have issue reading it.

Here is my Address Object class:




Class used to serialize object:





Class used to read serialized object from a file:




When i run my Deserializer class i am seeing this error:




Issue is with this line in the Deserializer class: address = (ArrayList<Address>) ois.readObject();


What can be the issue here?

Thanks
Adi
8 years ago
Hi All,

I am writing a dummy class to see how ObjectInputStream works. I was able to successfully serialize an Object, but have issue reading it.

Here is my Address Object class:




Class used to serialize object:





Class used to read serialized object from a file:




When i run my Deserializer class i am seeing this error:




Issue is with this line in the Deserializer class: address = (ArrayList<Address>) ois.readObject();


What can be the issue here?

Thanks
Adi
8 years ago
Thanks for making me think!!

9 years ago
I am missing something in the REGEX, what the current REGEX do is to look for occurrence of [A-Za-z0-9] in the input String? I am not sure.. sorry!!!
9 years ago
This is a dirty code, but it solves the purpose. Any idea to optimize it?

9 years ago
I did this, but it does not gives print true. Am i missing something?

9 years ago
Hi All,

How to find the occurrence of one from each alphanumeric categories in a String?
Upper Case: [A-Z]
Lower Case: [a-z]
Digits: [0-9]

Example:
Aa1Bb2 = returns true
aa1bb = returns false as there is no upper case character
aaBab = returns false as there is no digits.

I am using following regex pattern --> "^[a-zA-Z0-9]+$"
But it not seem seem to return false when any one of the character is missing from the above catogories.

Thanks
Adi
9 years ago
I wanted to share this now:

9 years ago
Hi All,

Is there a way to use Java Regex to count number of non alphanumeric characters in the String.

For example:
a1b2c3$3# should return 2

I have something like this:
Pattern p = Pattern.compile(".*\\W+.*");
Matcher m = p.matcher(test);

But this returns if String contains non alphanumeric characters and not the count.

Any help or suggestion is appreciated.
Thanks,
Aditya
9 years ago
Thanks, aah my eyes.. This is what happens when you work 2nights straight back on back

This change worked:- String replacedVal = remoteDirMSI.replaceAll("/", "\\\\\\\\");

Regards
Adi
10 years ago
10 years ago
Jeff Verdegan: does that make it better?
10 years ago



Where as the output i was expecting was:


What am i doing wrong here??

-Adi

10 years ago
Hello,


I want to replace "|DEPLOYDIR|" expression in the string test.

String test = "cmd /c start /wait |DEPLOYDIR|\\setup";
test = test.replaceAll("|^DEPLOYDIR|$", "testvalue"); --> does not seem to work!!

I want an output like:
cmd /c start /wait testvalue\\setup

How can i do this??

-Adi
10 years ago