Pages

August 29, 2019

'Nazar' actor Harsh Rajput felicitated for his excellence!

Harsh Rajput, who is currently enthralling the audience with his brilliant performance in Gul Khan's popular show Nazar, turned nostalgic after getting felicitated by Mumbai University for his contribution in the field of acting.

August 27, 2019

Part 10: Java Thread Interview Questions & Answers (ReentrantLock and ReentrantReadWriteLock)

What are Reentrant Locks?

  • ReentrantLock in Java is added on java.util.concurrent package in Java 1.5 along with other concurrent utilities like CountDownLatch, Executors, and CyclicBarrier.
  • ReentrantLock is a concrete implementation of the Lock interface provided in the Java concurrency package from Java 1.5 onwards. 
  • Reentrant Locks are provided in Java to provide synchronization with greater flexibility.
  • The code which manipulates the shared resource is surrounded by the calls to lock and unlock method. This gives a lock to the current working thread and blocks all other threads which are trying to take a lock on the shared resource.
  • A ReentrantLock allows threads to enter into the lock on a resource more than once. When the thread first enters into the lock, a hold count is set to one. Before unlocking the thread can re-enter into lock again and every time hold count is incremented by one. For every un-lock request, the hold count is decremented by one and when the hold count is 0, the resource is unlocked.
  • Fairness parameter is provided while creating an instance of ReentrantLock in the constructor. The fairness parameter used to construct the lock object decreases the throughput of the program.
  • ReentrantLock provides the same visibility and ordering guarantee, provided by implicitly locking, which means, unlock() happens before another thread gets lock().
  • If you forget to call the unlock() method in the finally block, it will lead to bugs in the program. Make sure that the lock is released before the thread exits.

Part 9: Java Thread Interview Questions & Answers (All About Java Semaphore and Mutex)

Why do we need Semaphore?

  • Let's say our application calls a service, which is quite slow. Because the service is slow, only 5 calls can be made at a time.
  • Now let's say their are 50 threads present in the application, and they all try to access the service. We need a mechanism, by which we can restrict the call to slow service. This can be achieved using Semaphore.
  • A Semaphore will act as a layer, with a limited number of permits (in our case permits=5). 
  • A thread 1 wants to access the service, it will call the acquire() method to get the permit. Semaphore will check the number of available permits (in our case it's 5), if it's available it will give a permit to thread 1 and then decrease the permit by 1 (now the permit=4).
  • While thread 1 is accessing the slow service, thread 2 comes. The Semaphore again checks the available permit (which is 4) and gives it to thread 2.
  • Let's say threads 3, 4 and 5 come and get the permit. While these 5 threads are accessing the slow service thread 6 comes, since now the permit is 0 Semaphore will block thread 6.
  • In the meantime, Thread 1 completes the work from slow service, it will call the release() method. The release() method will increment the permit(which was 0) by 1. Now the permit is 1, and the Semaphore gives access to Thread 6 and decrements the permit (new value will be 0).

August 21, 2019

Ullu App ready to make web-series in Bangla


Ullu is India’s one of the popular OTT platforms with more than 4 million mobile downloads and is available in over 100 countries. The digital platform currently offers Hindi web-series across various genres, which are dubbed in regional languages like Marathi, Bhojpuri, Bangla, Telgu etc. Now, Ullu is all set to embark a new journey and will soon start producing web-series in regional languages starting with Bangla.

When contacted Vibhu Agarwal, CEO at Ullu Digital Pvt Ltd, told us, "We have received amazing feedback for our web-series like Singardan, Halala, Panchali from the regional viewers. Since regional content is the demand of the hour, we are planning to create original content in regional languages on topics that resonate with regional culture and viewers."


Ullu will start exploring the regional market with a bang by producing dozens of web-series in Bangla. Confirming the same Vibhu said, "Bengal has a rich and vibrant culture, which always fascinates me. That's the reason, we are starting our regional debut with Bangla web-series. We are planning to come up with more than 25 web-series within a year."

He further added, "There is a phenomenal amount of talent in Bengal, which we want to utilize. We are looking forward to work with the regional artists and shoot in the exotic locals of West Bengal and Bangladesh."

For those uninitiated, popular Bengali actor Riju Biswas, who has done several Bengali TV serials like Checkmate, Tomay Amay Mile (the Bengali adaptation of popular Hindi show Diya Aur Baati Hum), and Bou Kotha Kao is playing the lead role in Ullu's upcoming web-series 'Size Matters'.  

August 04, 2019

Purpose of Spring's @Qualifier

NoUniqueBeanDefinitionException while Autowiring
@Autowired annotation is used to inject a dependency in Spring explicitly. By default, Spring resolves autowired entries by type. In some cases this annotation alone isn't enough for Spring to understand which bean to inject.

August 03, 2019

Oracle Interview Questions

  1. What is abstraction and encapsulation in java? (solution)
  2. If we didn't declare any exception in super class then in subclass can we declare any checked/custom exception.(solution)
  3. Can I have only try block in code? (solution)
  4. Why wait(), notify() and notifyAll() are defined in Object class? (solution)
  5. Can we override wait() or notify() methods? (solution)
  6. Difference between wait(), sleep() and yield()? (solution)
  7. What is the purpose of join()? (solution)
  8. Explain Singleton design pattern.
  9. Write a program to swap two numbers with out using third variable?

Deloitte India Interview Questions

Database
  1. What is the difference between a function and a stored procedure. (solution)
  2. What is the difference between a Unique and a primary key. 
  3. Difference between truncate and delete command. (solution)
  4. Can I use use a function in where clause?
Hibernate
  1. How many types of cache is available in Hibernate?
  2. What is the difference between get and load in Hibernate? (solution)
  3. How many tables will be created in @ManyToMany mapping? (solution)
  4. What is HQL?
  5. What is Nativel SQL?
Spring
  1. What is the default scope of Spring?
  2. How can I change the scope of bean in Spring?
  3. What is the advantage of Spring Boot?

August 01, 2019

Bulley Shah's 'Rab Rab Karde Budhe Hoo Gaye' Meaning In English..


रब-रब करदे बुड्ढे हो गए, मुल्ला पंडित सारे.  
रब दा खोज खरा न लब्बा, सजदे कर कर हारे..