Win a copy of OCP Java SE 8 Programmer II Exam Study Guide this week in the OCP forum!

shivanyy gupta

Ranch Hand
+ Follow
since Dec 27, 2017
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
1
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by shivanyy gupta

Hi Everyone,

I have a real time problem which is like:
Salman has a garden with N flower pots arranged in a row. Every morning he walks through the row and plucks flower. He targets to visit the first K pots in the row.
Find the number of different flowers that Salman would pluck on a single walk through K pots.
What is the approach of solution for this problem
Also, let me know where i can find more such problems.

Shivani
Hi Everyone,

One of my colleague, an IT professional, got an job offer from Dubai in Emirates. But he has never been to UAE till date. Can anyone let me know what he is supposed to do with that job offer, like accept it ot Not.
He is a married person and wants to take his wife along. Would he able to save out of 11000 AED after bearing costs of rented apartment, Electricity, TV, internet bills and so on?
All the visa formalities will be done by Emirates.  Can anybody knows what would be the lifestyle and culture in Dubai for this budget. What things he needs to take care and can demands from Emirates on this offer.
The job location would be Dnata Emirates office. Also let us know, what are the Do's and Don't for Dubai.
Guys, please help if you already know someone who is working in Emirates.

Thanks in advance.
2 months ago
Hi Everyone,

Just for understanding, can anybody please explain me the below code.



I know what is the output but i want to understand more on this line:
getSession().createCriteria(Student.class).addOrder(Order.desc("studentID")).list();

How would i read or refer to this line for explaining to my students.?

Thanks
Shivani

Tim Holloway wrote:Sorry, Shivanny, we're not a quick help forum. No one here gets paid, so people aren't sitting around all day available to instantly answer questions.

We also are not a "do my homework" forum. We'll freely help you solve problems, but we're not going to simply write your code for you. As I said, we're not getting paid for any of this, and besides, the world is already overloaded with "developers" who cannot develop because they never took the effort to learn how.



I understand your concern, that's why i asked for re-usable components or a design kind of thing.
I am not saying anyone to code for me but atleast hints work sometimes. If you have seen my earlier post, you can see how much i am active i am and how many times i have shared the code with my issue.
I am not expecting anyone to teach me angular or java here, i know that stuff but a helping hand sometimes proves to be the right decision in short span of time.
2 months ago

Tim Moores wrote:Which phrases have you googled for this? What solutions have you found, and in which ways were those inadequate?

To give you hints we'd have to know what you have done already, and where you are stuck making progress.

Also, this sounds like a homework assignment you should do in order to learn something, so reusing existing solutions is probably not permissible.



Dear, i understand your concern but i have time constraints so looking for quick help, if you can.
2 months ago
Hi Everyone,

I have below requirements as:

Build a ToDo application with option to add/delete and mark it as completed. IT should also have the capability to show pending and completed tasks.
Front End  : Angularjs / Javascript / Html / Css3
Middleware : Spring
Back end   : Hibernate

Please provide some already built in applications links so that i can re-use them or give me a hint for this one.

Thanks
2 months ago
Hi Everyone,

One of my student asked me how to find the longest word (largest length) in the given string provided the string is not separated by space.
e.g. Input  string : fun#4!!Sample
output : Sample

The string "fun#4!!Sample" has no spaces so we can't split it into tokens.
Please share the algorithm/code with minimal time complexity.

Thanks


Can anybody explain me the pictorial representation of this code. How s1 refers to an object of s2.
What does m(this) internally mean?
What S2 obj refers to??
3 months ago

Paul Clapham wrote:Yes, if there was an array with 100 elements in the ArrayList and it was necessary to extend it, then an array with 200 elements is created and the 100 elements are copied from the old array into the new array. The old array is just left to be garbage collected.



Yes, this is main thing i am looking for. I was not sure on, when the resizing will be done then these 2 operations are done or not:
1. Old array elements are copied in to the newly created resized array.
2. The old array after copying will be left for GC.

Thanks a lot
3 months ago
Hi Everyone,

I know the basics of Array and Arraylist class in Java but a bit confused with the performance of ArrayList if resizing is required.
During resizing, a new array has been allocated along with the existing array. So what would happen to the previous array. Does it mapped again after resizing ? Please help me in this with similar type of questions?
Just want to understand the performance hit of Arraylist during resizing when compared with a fixed size array.


Thanks in Advance
3 months ago

Liutauras Vilda wrote:Please post how the code looks like you have started and got stuck on.



Hi, I just thought of an approach for doing this.
Converting my Arraylist in to an Array and then printing the array indexes.

Object[] objects = al.toArray();

        // Printing array of objects
        for (Object obj : objects)
            System.out.print(obj.getidentity[0] + " ");  //The problem here is to how to maintain the index
            System.out.print(obj.getidentity[1] + " ");  
            System.out.print(obj.getidentity[2] + " "); 
    }
3 months ago
Hi Everyone,

I have one question related to Arraylist. Suppose you have an Arraylist of Person.



Now my requirement is to print the arraylist objects in this tabular format.
Serial no.    1           2                    3              4
age            20         52                  19             27
name         ABC      XCV               ERTY         GHTUJ
salary         50K       71K               85K             10K
identity       P44        P85               P90              P32

How would i print such format on the screen.

Thanks
3 months ago
Hi Everyone,

I know what a singleton pattern is and i also know that logging is an example of Singleton. Can somebody help me identifying scenario(s) where singleton can be proved as a cherry on a cake. I am looking for some real time, project specific scenario examples where we can use singleton design pattern. Assume that i am working on a banking (Le'ts say RBS) or telecom project (bharti airtel).
3 months ago