Monday, December 24, 2018

Lyrics response

Lyrics of the song "I wish I was your lover"
You know I got this feeling that I just can't hide
I try to tell you how I feel
I try to tell you but I'm me
Words don't come easily
When you get close I share them
I watch you when you smile
I watch you when you cry
And I still don't understand
I can't find the way to tell you
I wish I was your lover
I wish that you were mine
Baby I got this feeling
That I just can't hide
Don't try to run away
There's many things I wanna say
No matter how it ends
Just hold me when I tell you
I wish I was your lover
I wish that you were mine
Baby I got this feeling
That I just can't hide
I wish I was your lover
I wish that you were mine
Baby I got this feeling
That I just can't hide
Oh I need is a miracle
Oh baby all I need is you
All I need is a love you give
Oh baby




And my response



Don't try to hide your feelings
I know what you have got inside
I am all yours darling
You have me at your side

I am sorry I had to run away
And you know the reason why
But I will always hold you
No matter where you are, I will stand by

You watch me when I smile
But I can never see you cry
You have said it all
Now you don't have to find a way

Love in itself is a miracle
Don't know it happened how
You have all my love dear
So you have to be happy now

Yes you are my lover
Yes you are the one.


Thursday, September 20, 2018

After a long time


I felt like being on the seventh sky,
Being with you just made me high,
I lost myself in your eyes,
And missed being with you all the time

The look in your eyes made me fall for you,
The butterflies in my stomach, what could I do,
Never felt like this, ever before,
Want to love you more and more

You came in my life like a dream,
The dream was short and reality struck in a hard way,
I broke your heart and moved away,
But with that, even mine couldn't stay.

The burden of responsibilities made me scared,
I cannot explain what i dread,
The worst had seemed not so hard to endure,
Seeing the worst shook my soul


Thursday, April 12, 2018

Webservices

Q) When to use REST vs SOAP?
Ans https://dzone.com/articles/web-services-architecture
https://stormpath.com/blog/rest-vs-soap

  • SOAP is good for applications that require formal contracts between the API and consumer since it can enforce the use of formal contracts by using WSDL (Web Services Description Language).
  • Additionally, SOAP has built in WS-Reliable messaging to increase security in asynchronous execution and processing.
  • Finally, SOAP has built-in stateful operations. REST is naturally stateless, but SOAP is designed to support conversational state management.

Q) How to handle security in REST webservices?
Ans https://dzone.com/articles/top-5-rest-api-security-guidelines

Q) In Restful webservices, what are the methods and their use?
Ans -POST for CREATE, PUT for update, DELETE for deletion, GET for retrieval, PATCH for partial updates  and OPTION for checking before making a GET request

Reason- POST is idempotent as per HTTP specification and a creation request should be idempotent
PATCH is also idempotent

Q) Things to keep in mind while designing a restful web service?



Useful links:
REST web services - https://www.youtube.com/watch?v=xkKcdK1u95s&list=PLCCK2CzCX8EXTVHe12NLKMHq5GytRJSUj

Monday, April 9, 2018

Spring interview questions

Q) What are bean scopes?

Q) Lifecycle of a bean?
http://javainsimpleway.com/spring-bean-life-cycle/

Q) Why is @component used?

Q) How to create a web request in spring MVC?

Q) When to use @service and @component annotations?

Q) Transaction management in Spring?

Q) What are different types of handler mappings and view resolvers in spring?

Q) How to create a synchronized bean in spring?
Ans: https://tarunsapra.wordpress.com/2011/08/21/spring-singleton-request-session-beans-and-thread-safety/
https://javabeat.net/spring-singleton-java-singleton/

Q) What is dependency injection?
Ans Dependency injection is a design pattern and IOP is the way spring achieves it

Q) How to handle internationalization and localization in spring MVC?
Ans - Steps
1) Include two links-English and French on top of jsp page
2) Register an interceptor with the name localeChangeInterceptor  in the spring cofiguration file
3) Include an entry of cookieLocaleResolver bean in the spring's configuration file

Q) Difference between bean id and bean name and their uses?
Ans - Every bean has one or more ids (also called identifiers, or names; these terms refer to the same thing). These ids must be unique within the container the bean is hosted in. A bean will almost always have only one id, but if a bean has more than one id, the extra ones can essentially be considered aliases.
When using XML-based configuration metadata, you use the 'id' or 'name' attributes to specify the bean identifier(s). The 'id' attribute allows you to specify exactly one id, and as it is a real XML element ID attribute, the XML parser is able to do some extra validation when other elements reference the id; as such, it is the preferred way to specify a bean id. However, the XML specification does limit the characters which are legal in XML IDs. This is usually not a constraint, but if you have a need to use one of these special XML characters, or want to introduce other aliases to the bean, you may also or instead specify one or more bean ids, separated by a comma (,), semicolon (;), or whitespace in the 'name' attribute.

Q) What are the new features in spring 4.0 and spring 4.1
Ans -
  •  spring-webmodule provides support over websocket based communication in web applications
  • spring 4.0 is based on servlet 3.0+ implementations
  • @RestController annotation is introduced to use with Spring applications
  • Spring 4.1 introduces @JMSListener annotations to easily register JMS listener endpoints
  • Spring 4.1 supports Jcache(JSR- 107) annotations using spring's existing cache configuration
  • Jackson's @Jsonviewisdirectlysupportedon @ResponseBodyandResponseEntitycontroller methods
Q) Difference between singleton pattern and spring singleton bean
Ans. Singleton pattern supports singleton for one object per JVM whereas spring singleton scope is one bean per application context.

Q) How is validation done using spring framework
Ans Using Validator interface

Q) Steps to create a spring mvc application

1) create a maven project with archetype as maven-archetype-webapp
2) Modify pom.xml and include spring dependencies
3) Modify web.xml to specify dispatcher servlet (Front Controller) class
4) create spring-dispatcher-servlet.xml (front controller) and specify handler mapping, controller class and view resolver settings.(Can use annotations for handler mapping and controller)
5) Create controller class

Q) Types of controllers in spring MVC?






Useful links:
http://www.baeldung.com/spring-mvc-and-the-modelattribute-annotation
https://www.youtube.com/watch?v=8V4ArtwNuwk&list=PLBgMUB7xGcO31B2gBmy1igpZn6LK78-CJ&index=12
https://docs.spring.io/spring/docs/3.1.x/spring-framework-reference/htmlsingle/spring-framework-reference.html#mvc-ann-requestparam


Tuesday, April 3, 2018

Java interview questions

Q) How to find out minor gc(garbage collection) vs major gc using gc logs
Ans:2014-11-18T16:39:37.728-0800: 88.808: [Full GC [PSYoungGen: 116544K->12164K(233024K)] [PSOldGen: 684832K->699071K(699072K)] 801376K->711236K(932096K) [PSPermGen: 2379K->2379K(21248K)], 3.4230220 secs] [Times: user=3.40 sys=0.02, real=3.42 secs]

In the above statement, gc means minor gc and Full gc means major/full gc.

 https://dzone.com/articles/understanding-garbage-collection-log
http://karunsubramanian.com/websphere/troubleshooting-gc-step-by-step-instructions-to-analyze-verbose-gc-logs/

Q) How a marker interface works internally?

Q) What does ? super T and ? extends T mean in generics?
Ans http://www.oracle.com/technetwork/articles/java/juneau-generics-2255374.html

Q) Difference between port and porttype in a wsdl file
Ans: https://www.predic8.com/wsdl-reading.htm


Q) How to consume a webservice in Java/
Ans https://howtodoinjava.com/spring/spring-boot/spring-soap-client-webservicetemplate/

Q) How to render soap webservice over https?

Q) How do indexes work internally?
Ans http://www.dba-oracle.com/concepts/index_administration.htm
 https://docs.oracle.com/cloud/latest/db112/CNCPT/indexiot.htm#CNCPT1170

Q) Why do indexes slow performance?

Q) Code review checklist
Ans https://www.java-success.com/30-java-code-review-checklist-items/

Q) Explain the significance of marker interface
Q) Garbage collection algorithms
Q) sort an arraylist with US, India, Canada at the top
Q) slow updates in prod..how to fix
Q) diff in Java memory model in java8
Q) difference between transient and static
Q) Does serialzation create same object or different object? How does JVM differentiates
Q) How does spring boot work internally
Q) what is ssl
Q) Hibernate child object is lazily loaded. What happens if you call get after a session close(LazyIntiialization exception)
Q) How to add an extra parameter from database in the entity class  (Use transient)
Q) What logging is used in spring boot
Q) When does lazyinitialization exception occur
Q) Second level cache- When does it caches objects
Q) WHat are propagation levels
Q) What is metaspace
Q) How to mark an entity to be caches in second level cache (Use @Cacheacle)
Q) WHat are GC algorithms
Q) Production application -Slow Insertion-Steps to be taken
Q) How to create listener in angular application
Q) Benefits of Enum
Q) Program to find the number of repeated letters in a word
Q) Soft vs weak reference
Q) What is @embedded in hibernate
Q) Component vs contoller
Q) wsdl vs REST. why use soap?
Q) internal working of concurrenthashmap
Q) hashmap vs synchronized map
Q) Why REST is used so much?
Q) Two threads one genrate evn an other odd ?
Q) BlockingQueue
Q) An employee class with hascode returning 1 and equal returning "true". how many objects in the map if 3 are put?
Q) final list = new ArrayList(), Can i use list.set?
Q) Hww to customize serialization
Q) SOLID principles
Q) Aggregation vs composition
Q) Comparable vs comparator
Q) Clone method is in which class? How can we create a sutom marker interface?
Q) @ManytoMany Mapping in hibernate between two entities? How many tables?
Q) Bean scope in @RestController? How does it handle mutiple request?
Q) how to calcualte the frequency of a string in a list of 100 strings?
Ans: Use a map for keeping the count of a string
Q) How to create an immutable list - no cloning allowed
Q) How does @RestController handle multiple requests
Q) How does a servlet handle multiple requests?
Q) Two synchronized methods- two threads t1 and t2? Can they access at the same time?
Q) Fail fast and fail safe- How and why?
Q) Changes in Hashmap in java 8?
Q) Why are functional interfaces created?
Q) Microservices -static URLs /dynamic URLs


-----------------------------------------IRIS----------------------------------------------------------
Q) Design patterns - Prototype, Decorator
Q) sorting hashmap by value
Q) Custom hashmap- immutable
Q) SOLID principles - Examples
Q) Interface examples
Q) design patterns in Java libraries 
Q) @Qualifier 
Q) Reentrant lock - 
Q) Predicate, Supplier , Consumer
Q) How to restrict to 3 objects only 
Q) Multiple default methods in one interface?
Q) ExecutorService-> new fixed thread pool vs cache pool
Q) Context Class Loader
Q) When the application is up and running, send an email to support team. Spring
Q) Design a cache - LRU and last read
Q) millions of customers- how to handle load- Design
Q) Check out of memory in production
Q) json to string?
Q) Hashmap key - hashcode and equals - Immutable - no setters, how to set 
Q) How to validate a input json in REST
Q) Hibernate- cascading?
Q) How to handle transactions in hibernate
Q) How will you cache the data inside GET API mehtod
Q) Redis cache. How does it share data between microservics
Q) How do 2 APIs/microservices communicate with each other
Q) How to design an application with millions of users
-------------------------------------------------------------------------------------------------------
_________________________________________________________________________________

Ericsson

Q) One java application wants to connect with a third party application. Which design pattern should be used?
Ans Adapter

Q) In apache camel how do we integrate two different applications?

Q) There is an employee POJO. and a new field is required to be added without touching the existing code. What to do?
And Use inheritance

Q) How to reproduce a memory leak issue that occured in production environment to a local environment?
https://www.jahia.com/about-us/news-events/blog/tips-and-tricks-for-analyzing-java-virtual-machine-heap-memory-dumps
http://javaeesupportpatterns.blogspot.in/2011/11/hprof-memory-leak-analysis-tutorial.html

Q) Which collection to use in case of a lot of reads and few write operations?
Ans ArrayList

Q) Challenges faced in any projects?
_________________________________________________________________________________

Q) Which Java API should be used to fetch data from a legacy system?

Q) Use case- A weather service - How to reduce load on this service?
Ans Observer pattern

Q) Comparable vs comparator- which to use when?

Q) Things to keep in mind while designing a system?

Q) How to do performance management based on some input for an application?

Q) What happens if you call destroy from init in a servlet?

Q) Find third largest salaried employee in the employee table
________________________________________________________________________________

ING internal

Q) a function is not performing well in the application. What approach to find the problem. Environment is production

Q) how do you handle security in your application

Q) multithreading- fixed thread pool of 10 threads. 100 tasks are submitted. How many threads. how does submit and execute work internally.

Q) What does an angular application made of- where is template define. How to create an injectable service

Q) Where do you use functional interface in your application
Ans https://stackoverflow.com/questions/36881826/what-is-use-of-functional-interface-in-java-8/36882003?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa

Q) How do you use Apache camel in your application

Q) How to make a custom object as key to a hashmap in java 8
Ans https://dzone.com/articles/java-8-hashmaps-keys-and-the-comparable-interface
https://stackoverflow.com/questions/35164645/is-it-a-bug-that-java-8s-hashmap-misbehaves-if-the-keys-implement-comparable-in
https://www.javaworld.com/article/2073618/java-s-system-identityhashcode.html

Q) Why to use lambda expressions in java8?
Ans. https://www.nagarro.com/en/perspectives/post/26/Lambda-Expressions-in-Java-8-Why-and-How-to-Use-Them

Q) How does executor framework work internally. What does runnable.execute or callable.submit do?
Ans







Good links:
Functional interface uses: http://www.baeldung.com/java-8-lambda-expressions-tips
https://netjs.blogspot.in/2016/03/effectively-final-in-java-8.html

-->

Friday, January 12, 2018

Couplets

Nishaan-e-mard-e Momin ba too goyam?
choon marg aayad, tobassum bar lab-e-ost
(You ask me for the signs of a man of faith?
When death comes to him
He has a smile on his lips.)


Row mein hai raks oer umar
Kahaam deykheeye thamen,
Na haath baagh par hai
Na pa nakaali mein
(My life runs at a galloping pace
who knows where it will come to a stop
The reins are not in my hands
my feet are not in the stirrups)


Khuda tujhe kisee toofan se aashna kar day
Keh terey beher kee maujon mein iztirab naheen
(May God bring a storm in your life
There is no agitation on the waves of your life's ocean)


Jhoot vee aseen bolney aan
Ghutt vee aseen tolney aan
Par sachey Padshaah
Teyra naa vee aseen Lainey aan
(We admit we tell lies,
We also give short measures
But O True King of Kings
We also take your name.)


Too dil mein to aataa hai
Samajh mein nahin aataa
Bas jaan gayaa teyree pahchaan yahee hai
(You come into my heart,
But my mind cannot comprehend you
I understand this is the only way to know you.)


Sunee hikayat-i-haste to darmiyaan say sunee
Na ibtida kee khabar hai, na intiha maaloom
(All we have heard of the story of life is its middle
We know not its beginning, we know not its end)


Dhoondta phirta hoon main, ai Iqbal apney aap ko
aap hee Goya musaafir, aap hi manzil hoon main
(O Iqbal, I go about everywhere looking for myself
As if I was the wayfarer as well as the destination)


Akhiyan dee laalee pay dasdee
Tusee vee roey ho, roey asee vee haan
(The redness in our eyes has no secret
If you have cried, we too have wept)


Sarsaree nazar maaree jahaan andar
Zindgi varg utthalya main
Daaman koee na milya rafeeq mainoo
Maar kafan dee bukkal tay challiya main
(I gave a cursory glance at the world,
I turned a few pages of the book of my life,
I Daaman could find no companion - so
I fling my shroud over my shoulder. And I go)


Mullah, gar asar ha dua mein
To Masjid hila kay dikha
Gar nahin, to do ghoont pee
Aur Masjid ko hilta deykh
(Mullah, if there is power in your prayer
Let me see you shake the ground
If not, take a couple of swigs of liquor
And see the mosque shake on its own)


Voh waqt bhee deykha taareekh ki ghariyon ney
Lamhon ne khataa ki thee
Sadiyon nay sazaa payee
(The ages of history have recorded times
when for an error made in few seconds
centuries had to pay the price)
(On operation Blue Star 1984)


Sana-e-khud bakhud guftan
Na Zebad Mard-e-daana ra
Choon Zan pistan-e-khud maalad
Kuja lazzat shaved Baakee?
(It does not behove a man of wisdom
to use his tongue in praise of himself
What pleasure does a woman beget
If with her own hands she rubs her breasts?)


Jahaan mein ahle-eemaan soorat-e-khursheed jeetey hain
Idhar doobey udhar nikley;udhar doobey, idhar nikley
(In this world men of faith and self confidence are like the Sun
They go down on one side to come up on the other)


Shauq-e-tool-o-peych is zulmat qade mein hai agar
Bengalee ke baat sun aur Bengalan kay baal deykh
(If you like to add length to a story, put a twist in its tail
Hear a Bengali talk(endlessly) and gaze upon his woman's long hair)


If you would not be forgotten
As soon as you are dead and rotten
Either write things worth reading
Or do things worth writing





And so many years have passed

Wow!! Finally I opened my blog to write something again. All these years, there have been numerous times when I have thought about writing something... anything...but never actually did it. So feeling good to be back. I just hope that I maintain it as a routine and improve my writing skills..huhu..

So much time has passed and I am grown up now. Not that I was a kid earlier, but yeah, with age I feel matured. Most importantly, I am a mom now, to a beautiful 8 months old girl. She is the centre of my world. In fact, she is my whole world. The feeling of being a mother is something that cannot be described in words. It has to be experienced to be able to understand it.
I pray and wish that my baby gets all the happiness in the world.

Life has been a roller coaster ride in the past few years. Still trying to calm the rough seas and looking for a shore.

Hope to come back here soon.

Same caste marriage

My cousin recently got engaged to an Asamese girl. He works in Canada and comes to India every year in December. This year when we met him, which was shortly after his roka with his Asamese girlfriend, the hot topic of discussion,of course, was his upcoming wedding. During the chit chat, I said something about this being an inter caste marriage and all. He said in a confused tone "no no, this is not an inter caste marriage. Both of us are Hindus only" I said You are a Punjabi while the girl is Asamese. On this, he said ..so that makes it an inter state marriage but not inter caste. I was short of words on hearing this.
At that moment, I felt respect for him and felt proud at the same time.

On giving a deeper thought to this, if all the people in India start thinking this way, half of India's problems will be solved. There will be no agitations for reservations. The face of India's politics will change as it is majorly caste based politics. Most importantly, the number of love marriages will increase and I think this can improve people's personal lives to a great extent.