Tushar Goel

Ranch Hand
+ Follow
since Dec 29, 2013
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Tushar Goel

Very strange it works fine for H2 database but when i use postgress it doesn't work. I only changed properties file and no other changes done
Hi

Could you please help me to solve one JPA issue? I trying to make 1 project for learning but struck here.

I have 3 entities with OneToMany relation like below:



Now What i want is for a particular period i want to fetch all the related tags and all the related transactions. But whenever i query it always return Period and Tag but transactions is empty.

This query returns only period/tag. Transaction are empty.


But when i used join than it will fetch values in pairs

 

I want result like 1 with transactions value. Please help me.
this multiply the result with n factorial..

so, if you have say n = 3, result = 2 in that case it calculates 3! (factorial) and multiply it with 2.
5 years ago

Vaibhav Gargs wrote:We have to cache some data to improve the performance. The application will be deployed in multiple clusters. Which cache will be better to use here: Redis or Memcache?



Do you want to persist the cached data in storage as well. If yes, i think Redis is the option. Memcache is pure cache, it doesn't provide feature of persisting data.
5 years ago

Campbell Ritchie wrote:Please provide more details; the screenshots aren't opening correctly.



I guess someone corrected or it got automatically corrected.. Thanks whoever did this.
5 years ago

Liutauras Vilda wrote:@OP

Are you able to share the interview question details as well as your solution? Please double check in their policy.



no policies was mentioned.
5 years ago
Hi,

Recently i have given an interview in which i asked to design a system (as per screenshot).. I am unable to design and failed to think from where to start.. can anyone suggest?

Or you can see on my github link




5 years ago

Does updating version number here `<version>1.3.3.RELEASE</version>` and here `<version>4.2.5.RELEASE</version>` for the dependency good enough to use the latest version of Spring boot? OR is it going to break things?



Yes by updating to higher version may break things.
6 years ago
you need to add spring-web dependency

<!-- https://mvnrepository.com/artifact/org.springframework/spring-web -->
<dependency>
   <groupId>org.springframework</groupId>
   <artifactId>spring-web</artifactId>
   <version>5.1.0.RELEASE</version>
</dependency>
6 years ago

Stephan van Hulst wrote:
strings.collect(
 Collectors.groupingBy(
   string -> Arrays.asList(
     string.codePoints().sorted().toArray()
   )
 )
)
[/code]



Sorry but it is giving me compilation error. What i am doing wrong here?

words.stream().collect(
            Collectors.groupingBy(
                s -> Arrays.asList(
                                   s.codePoints().sorted.toArray()
                       )
               )
       );
6 years ago
actually it teaches me 1 more thing.. importance of pencil and paper before jumping over the code..

I will try next time to emulate the steps on paper first..
6 years ago
@Piet, Thanks for the nice and detailed explanation.. I have understood every single step you tried....

I was missing condition where i need to reset if from goes negative.. Anyway it was cool .. Thanks Again...


@Liutauras Vilda, Sorry for the confusion.. It was long time i have not involved in any serious coding.. So, i miss many points... Anyway, i am back now
and will have more discussion in coming days.. Sorry again for the confusion..
6 years ago

Jeanne Boyarsky wrote:Tushar,



So simple and i made it overly complicated... aha...

You are genius. anyway it is good learning for developing better coding.. Thanks...
6 years ago
So , i have updated my main method by adding some print statements. Hope it helps to understand what i am getting:



My Software class:



The output looks like as below:


printing file contents
[Software [osName=Linux, softwareName=winscp, version=9.0], Software [osName=Linux, softwareName=winscp, version=10.0], Software [osName=Linux, softwareName=notepad++, version=11.0], Software [osName=Linux, softwareName=java, version=6.0], Software [osName=Ubuntu, softwareName=winscp, version=9.9], Software [osName=Ubuntu, softwareName=notepad++, version=11.1], Software [osName=Ubuntu, softwareName=notepad++, version=10.0], Software [osName=Ubuntu, softwareName=java, version=7.0], Software [osName=Windowa, softwareName=winscp, version=10.1], Software [osName=Windowa, softwareName=notepad++, version=10.0], Software [osName=Windowa, softwareName=java, version=8.0], Software [osName=MAC, softwareName=winscp, version=7.0], Software [osName=MAC, softwareName=notepad++, version=9.0], Software [osName=MAC, softwareName=java , version=10.0]]
------------------------
printing contents of the map grouped by OS

{Ubuntu={java=[Software [osName=Ubuntu, softwareName=java, version=7.0]], winscp=[Software [osName=Ubuntu, softwareName=winscp, version=9.9]], notepad++=[Software [osName=Ubuntu, softwareName=notepad++, version=11.1], Software [osName=Ubuntu, softwareName=notepad++, version=10.0]]},

Linux={java=[Software [osName=Linux, softwareName=java, version=6.0]], winscp=[Software [osName=Linux, softwareName=winscp, version=9.0], Software [osName=Linux, softwareName=winscp, version=10.0]], notepad++=[Software [osName=Linux, softwareName=notepad++, version=11.0]]},

Windowa={java=[Software [osName=Windowa, softwareName=java, version=8.0]], winscp=[Software [osName=Windowa, softwareName=winscp, version=10.1]], notepad++=[Software [osName=Windowa, softwareName=notepad++, version=10.0]]},

MAC={winscp=[Software [osName=MAC, softwareName=winscp, version=7.0]], java =[Software [osName=MAC, softwareName=java , version=10.0]], notepad++=[Software [osName=MAC, softwareName=notepad++, version=9.0]]}}
------------------------
printing contents of the map grouped by software in a OS

[{java=[Software [osName=Ubuntu, softwareName=java, version=7.0]], winscp=[Software [osName=Ubuntu, softwareName=winscp, version=9.9]], notepad++=[Software [osName=Ubuntu, softwareName=notepad++, version=11.1], Software [osName=Ubuntu, softwareName=notepad++, version=10.0]]},

{java=[Software [osName=Linux, softwareName=java, version=6.0]], winscp=[Software [osName=Linux, softwareName=winscp, version=9.0], Software [osName=Linux, softwareName=winscp, version=10.0]], notepad++=[Software [osName=Linux, softwareName=notepad++, version=11.0]]},

{java=[Software [osName=Windowa, softwareName=java, version=8.0]], winscp=[Software [osName=Windowa, softwareName=winscp, version=10.1]], notepad++=[Software [osName=Windowa, softwareName=notepad++, version=10.0]]},

{winscp=[Software [osName=MAC, softwareName=winscp, version=7.0]], java =[Software [osName=MAC, softwareName=java , version=10.0]], notepad++=[Software [osName=MAC, softwareName=notepad++, version=9.0]]}]
------------------------

is there any winscp version older than 9?
Software [osName=MAC, softwareName=winscp, version=7.0]
6 years ago
So, guys, i have just completed online course on Java 8. So to test my knowledge i got following question from my colleague:

We have a csv file in which 3 fields are their. 1) osName 2) Software 3) version

So we need to return outdated software version. User will provide the software and version name. File looks like as below:




So, after spending few hours i come up with the solution but its looking very much complicated. Any idea how to improve it further:

6 years ago