shashank dwivedi

Ranch Hand
+ Follow
since Mar 06, 2012
Merit badge: grant badges
For More
BENGALURU
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by shashank dwivedi

I want to achieve something like this in functional way. Any help ?

5 years ago
I am sorry. FileWalkTree already gives what I wanted. Just was a little bit concerned about memory usages as it also uses DirectoryStream.
6 years ago
I want to collect directory structure to a given depth (It can be huge recursive structure!).
Which approach should perform better and consumes less memory?

Approach 1: Using DirectoryStream




OR

Approach 2:



Q. As java doc says -


    * <p> Note that the {@link java.nio.file.Files} class defines the {@link
    * java.nio.file.Files#newDirectoryStream(Path) newDirectoryStream} method
    * to open a directory and iterate over the names of the files in the
    * directory. This may use less resources when working with very large
    * directories.



I am visiting directories in DFS manner(recursive approach), will java.io.File#listFiles perform better than DirectoryStream as stream entries won't be garbage collected till whole structure is visited (not sure on this) causing more memory usages?

6 years ago
annotations

I have to validate parameters in a method using custom annotation.
I am trying to get parameters (dataRequest  and token) in annotation handler.
Can someone help, I am not able to make this work. Here is what I have done so far.

Example:




annotation declaration







7 years ago
I missed setting state properly.

Hi friends,

I am trying to execute three threads in sequence. Any help what I am missing?

I am expecting output to be:

thread1: 1
thread2: 1
thread3: 1
thread1: 2
thread2: 2
thread3: 2
thread1: 3
thread2: 3
thread3: 3


Hi folks,
I am stuck while trying to implement classical pattern mainly to learn best practices in js. I am not able to understand why my call to inherit method fails? Any help is much appreciated. Sorry for any layman's mistake.
Below is program.



What does it mean by @Retention(value=RUNTIME) in annotations?
Does it mean this annotation can be ignored at compile time even if the annotation class doesn't exist?
What if at runtime JVM fails to inject annotation using reflection (considering annotation doesn't exist)?

Found this link:
http://stackoverflow.com/questions/3567413/why-doesnt-a-missing-annotation-cause-a-classnotfoundexception-at-runtime

Please help me understand this concept.
9 years ago
Hi All,

I am trying a add a registration form(written in javafx) to my swing application.
I wanted to display this form as a popup , once register button is clicked.
I have written demo class below so far.The problem is JOptionPane is not able to display whole form.I am new to both swing and javafx.
Any help much appreciated.

Thanks.

10 years ago
I am new to JPA and need some help understanding persisting JPA parent entity along with it's child (through Mapping).
Say I have following two entities



Now I am trying to save Employee setting Address Entity to it.But it throws a foreign key validation exception because e_id is auto_increment and is generated by database while save.
Does JPA provide some mechanism to handle this ?

Thanks Rico and Henry for clearing my doubts..
yes correct but then while childThread is executing(say it is going to complete after 5 min) , can't its parent thread release the lock?


here lets say a thread is accessing synchronized method() and a new childThread is started at line 1.
can some other thread access synchronized method while childThread is still running??