Trip to Akkalkot, Tuljapur and Pandarpur from Pune





Akkalkot:

Akkalkot was the home to Shri Swami Samarth Maharaj, a 19th-century saint who is believed by his devotees to be an incarnation of Lord Dattatreya..

Tuljapur:

Tuljabhavani Temple is a Hindu temple dedicated to the goddess Bhavani. It is located in Tuljapur in Osmanabad district of Maharashtra and is considered as one of the 51 Shakti Pithas.

Pandarpur:

The Pandharpur temple was built in the middle of the thirteenth century by King Visnuvardhana of the Hoysala dynasty.

The Vithoba Temple, Pandharpur, officially known as Shri Vitthal-Rukmini Mandir. There is also a small temple of Shri. Vitthal-Rukmini, which is as old as the main Vitthal-Rukmini Mandir, in Isbavi area of Pandharpur known as Wakhari Va Korti Devalayas and also known as Visava mandir, the Hindu temples in Pandharpur in the Indian state of Maharashtra.

 

Duration Of Stay:
Min: 4 hrs. enough to visit Akkalkot place.
Max: 1 day

Min:2- 4 hrs enough to visit Tuljapur temple
Max : 1day

Min: 2- 4 hrs enough to visit Pandarpur temple
Max: 1 day

Route and time taken to reach Akkalkot:
It takes 4.5 -5 hrs to reach from Akkalkot from Pune.

How to reach Akkalkot
From Pune

Drive up to Hadapsar

Take Solapur highway
Reach Solapur.
From Solapur, take road to Akkalkot.

Map:




Spots to visit:
-Tuljapur Temple
-Akkalkot Temple
-Pandarpur Temple
-Siddheshar temple (solapur)

Last month I got an opportunity to plan a trip to 3 of the well-known pilgrimage places in Maharashtra.
We planned our trip from Pune. To make it easy and less hectic we started the journey on Thursday around 5 PM. I normally travel to Tuljapur on weekends but since last few years I have seen that there is huge crowd to any tourist place, so this time planned it for week days.

How was the plan:
Pune- Start on Thursday 5 PM
Akkalkot – Reach akkalkot via Pune Solapur highway. It takes around 3.5 – 4 hrs to reach Solapur and from there it takes 45 minutes to reach Akkalkot(Stay)
Tuljapur – Reach Tuljapur via Nuldurge road.
Solapur – Reach Solapur via Tuljapur Solapur road.
Bale – 5 kms from Solapur
Pandarpur – via Mohal
Pune – Via Phaltan

Toll till solapur on Solapur highway:

5 tolls – 290/-




बायको म्हणजे !!!




💁 बायको जर नसेल तर राजवाडा पण सुना आहे
बायकोला नावं ठेवणे हा 🙅‍ खरंच गंभीर गुन्हा आहे ! 🙅

💁खरं पाहिलं तर तिच्याशिवाय 🍃 पानही हालत नाही…
घरातलं कोणतंच सुख बायको शिवाय फुलत नाही !💃

💁 नोकरी अन पगाराशिवाय नवऱ्याजवळ आहे काय?🙆
तुलनाच जर केली तर सांगा, तुम्हाला येतं काय?🙇

💁 स्वच्छ, सुंदर,पवित्र घर 🏡 बायकोमुळेच असतं…
नवरा नावाचं विचित्र माणूसतिलाच हसत बसतं !

वय कमी असून सुद्धा बायको समजदार असते..👩👱
बायकोपेक्षा नवऱ्याचे वय👴👨म्हणूनच जास्त असते !

💁तिचा दोष काय तर म्हणे चांगल्या सवयी लावते !
कुटुंबाच्या कल्याणासाठी🏃दिवस रात्र धावते !

🙅 चिडत असेल अधून मधून सहनशीलता संपल्यावर;
तुम्हीच सांगा काय होणार चोवीस तास जुंपल्यावर ?

बायकोची टिंगल करून फिदी फिदी हसू नका..😁
तिच्या यादीत मूर्ख स्थानी नंबर एक वर बसू नका…🙇

💁बायको म्हणजे अंगणातला प्राजक्ताचा सडा !🌸🌼🌺
बायको म्हणजे पवित्र असा अमृताचा घडा !⚱

बायको म्हणजे सप्तरंगी🌈 इंद्रधनुष्य घरातलं !
देवासाठी गायलेलं भजन गोड स्वरातलं !🎶

🙎नवरोजी 💁बायकोकडे माणूस म्हणून पहा..
तिचं मन जपण्यासाठी थोडं शांत रहा..😷🙅‍

कधीतरी कौतुकाचे दोन शब्द बोलावे🙋
तिच्या वाट्याचे एखादं कामं तरी आनंदाने झेलावे !🙆

👌🏻सर्व स्त्रियांना समर्पित👌🏻




Dispose Vs Finalize

What are unmanaged resources?

File handler, Database connection, socket connection are example of unmanaged resource.

.Net garbage collector is designed to handle managed code. We need to implement IDisposable interface when we are using unmanaged resource directly.

There are 2 ways to call dispose method:

  1. Using : If object is implementating IDisposable interface we can use Using keyword, which will call objects Dispose method.
  2. Try/Catch/Finally: We can call Dispose in finally.

IDisposable and the inheritance hierarchy
A base class with subclasses that should be disposable must implement IDisposable as follows.
You should use this pattern whenever you implement IDisposable on any type that isn’t sealed.

It should provide one public, non-virtual Dispose() method and a protected virtual Dispose(Boolean disposing) method.

The Dispose() method must call Dispose(true) and should suppress finalization for performance.

The base type should not include any finalizers.

To implement Dispose method for custom class, you need to implement IDisposable interface.
IDisposable interface expose Dispose method where code to release unmanaged resource will be written.

Finalize

Finalize method is called destructor of the class. Finalize method can not be called explicitly in the code. Only Garbage collector can call the the Finalize when object become inaccessible. Finalize method cannot be implemented directly it can only be implement via declaring destructor.

Rule

For a class owning managed resources, implement IDisposable (but not a finalizer).
For a class owning at least one unmanaged resource, implement both IDisposable and a finalizer.

To avoid code duplication, Dispose() and the finalizer should be implemented like this (in pseudo-code):

public void Dispose() {
Dipose(true);
GC.SuppressFinalize(this);
}

GC.SuppressFinalize() simply prevents the finalizer from being called. Since the finalizer’s only task is to free unmanaged data, it doesn’t need to be called if Dispose() was already called (and already freed all unmanaged data by calling the finalizer).
Using GC.SuppressFinalize() give a small performance improvement but nothing more.

The default dispose implementation pattern used in the previous sections create a method called Dispose(bool). This method is protected virtual and is meant to be overridden by child classes – in case they need to dispose some data of their own.

In C#, an implementation must:

first check whether it already has been disposed
then dispose everything
and then call the base method

The base method is called last to ensure that child classes are disposed before their parent classes.

Garbage collector in .Net

Garbage collector is .net way of memory management of managed resources.

GC is not able to release memory from unmanaged resource like File handlers, window handlers, network sockets, database connections etc.

System.GC.Collect() forces garbage collector to run. This is not recommended but can be used if situations arise

Threading in C#

What is Process?

Process is nothing but executing program. Process has a unique process ID. We can view the process within which program is being executed using windows task manager.

Here we can see different programs running under different process.

Another example is calculator program. When we start calculator program, calculator process will start.

What is Threading?

Thread is light weight process. A single process can have multiple threads.

Threads are the smallest unit of execution scheduled by the operating system.
Any program or application has a minimum of one thread be it web application or a console window application.

There are 2 types of threads:

  • Foreground Thread
  • Background Thread

Main purpose of threading is do parallel code execution. By default foreground thread is created. Even if main application quits, then also foreground thread will continue to execute.

In case of background thread,when main application quits, background thread quits.

Namespace: System.Threading

Purpose: To make Application responsive.

How to debug Thread?

  • Name the Threads
  • When we are debugging 1 thread another thread is paused/halt
  • If we want to debug 1 thread and pause another thread using freeze option and start it using Thaw option.
  • Use break point option- conditional debugging.

Thread Safe:

If object is behaving abnormally in multi threaded environment, it is not thread safe.

Example: Divide by number program in loop where we set Num1 = 0 and Num2 = 0 after Num1/Num2.
Here  DividebyZero exception is raised.

So user needs to ensure that only 1 thread is accessing the critical section.

Different types of locks:

  • Lock(Monitor)
  • Mutex
  • Semaphore

Mutex:

  • Mutex works across multiple programs/Process.
  • We can have global mutex.
  • Mutex are objects that are owned by owned by thread at a time. Other threads are forced to wait until first thread releases it.

Example

There is 1 room having 1 key to it.Now 3 persons want to use it. Person who has key can access the room.

Similarly Mutex is object owned by thread so there is ownership in mutex. Mutex allow 1 thread to access the resource.

Semaphore:

  • A Semaphore restricts the number of simultaneous users of a shared resource up to a maximum number.
  • Thread can request access to the resource(decrementing the semaphore) & can signal that they have finished using the resource(incremeting the semaphore)
  • Semaphore is signalling mechanism. It allows a number of thread to access shared resources.

Example:

A  semaphore is like nightclub, it has certain capacity enforced by bouncer. Once it is full no more people can enter & a queue is build up outside. Then for each perosn that leaves, one person enters from the head of the queue.

TPL: Task parallel Library

Problems around Threading:

We want to run the logic parallely and it should use the CPU power to maximum. If my machine is 2 core processor then it should run half the iterations on 1 processor and another half on second processor. However that doesn’t happen and everything runs on 1 processor.

This can be verified using perfmon tool.

Single processor ->
Thread 1 and Thread 2 – It switches time between threads. it is called time slicing or context switching.

Two Processors-> Expectation is Processor 1 should execute Thread 1 and Processor 2 should execute Thread 2.
Processor 1 -> Thread 1
Processor 2 -> Thread 2

Namespace: System.Threading.Task

Purpose: To utilize CPU power to maximum. TPL encapsulates multi-core execution from end user.

How TPL does thread pooling?

Designing an online booking system

When we want to design something, there are multiple things that needs to be considered.

  1. Use case: How many users will be using it?
  2. Traffic: What is the estimated traffic?
  3. Database – SQL/NoSQL

Primary design goals:

  • Highly concurrent
  • Database ACID compliant
  • Distributed message queue to push notifications





We need following things when we think about a online booking system software:

  1. User Interface
  2. Database
  3. Caching
  4. Logging
  5. Load balancing
  6. Payment API
  7. Notifications

Thinking in terms of Objects:

  • Movie
  • City
  • Theatre
  • Show
  • User
  • Booking
  • Seat





What does these objects consist of?

  • Movie : MovieID ,Name, Description
  • City: CityID, CityName
  • Theatre: TheatreID, Name, Address, CityID
  • Show: ShowID,TheatreID, CityID, MovieID, Date, Timing
  • User: UserID, Name, Email, Phone
  • Booking: BookingID, UserID, ShowID, Amount, Date
  • Seat: SeatID, BookingID, SeatStatus

 

Popular online booking system: Book My Show.



Object Oriented Programming Concept

What is OOP?
Object oriented programming is a way of thinking. It is one of the software development approach. Thinking real world items/things in terms of object.

Different ways of programming

Programming started with the invention of computers. Programming is nothing but giving instructions to the computer or machine.

  • Machine language (bits)
  • Assembly Language (Example ADD A,C)
  • Structured programming( if- else, functions) Emphasis on functionality and not on data. Sharing data globally
  • Object Oriented Programming

Example :






Badminton court online booking.

There are basically 2 categories of people: 1 Technical 2. Non-Technical. It is not necessary that person who gives you requirement as technical back ground. It becomes difficult for non-technical person to interact with technical person.

Technical person thinks in terms of language to use(Asp.net, Angular js), database (oracle, Mysql, SQL), hosting environment etc.
Non technical person thinks in terms of users, number of courts, availability, security guards, light supply etc.

In real life we talk about objects and not functionality. In day-to-day life we come across multiple objects like TV, Fan,watch, Car,AC etc.All these are objects and we are thinking in terms of object. So there was need to correlate/represent these objects with software to be developed.

Court ——————-> Court object

User ———————> User Object

Booking —————–> Booking object

Way of simulating real life thinks into code is nothing but object oriented programming.


Object Oriented Programming Pillars

    • Objects : Object is instance of a class.
      • Attributes and functionality(behavior)
      • Example Court
        • Court attributes: Size/Dimension, surface(grass, tiles, soil, cement),  color
        • Functionality: DoCourtBooking()/ DoCourtCleaning()
      • Attributes are variables or data-members and Functionality is function.
    • Class :
      • Class is blueprint of object. It is specification of the object. How object will look like.
      • Example Student:
        • Attributes: Name, marks,RollNo
        • Functionality: SetMarks(),GetMark(), ExtracurricullarPerformance()
        • Change in attribute results in change in behavior. As the students mark changes, his performance improves.
      • Example 2 – Transaction class
        • Attribute: TransactionID, Amount, TransactionYear
        • Functionality: AddTransaction(), UpdateTransaction(), DeleteTransaction()




  • Abstraction:
    • It is way of showing the necessary details and ignoring the rest.
    • Example Student class:
      • Attributes: There are multiple attributes of student like his Name, RollNo, height, weight, address, hobbies, friends, Age, Marks, shoe size etc. Out of this we need to select few which are required for our application.
      • Here we select Name, RollNo, Marks – This is one view point of abstraction to pick required attributes
      • Behaviour: Communction skills, punctionality, Sports, curricularPerformance etc.
      • Here we pick curricularPerformance  and extra- curricularPerformance
    • For developers pick relevant attributes and function
    • Second part of abstraction – API development
      • We don’t know the implementation part nor bother about it.
  • Encapsulation:
    • Data and functionality is encapsulated within class.
    • Controlling the access of data using access specifier.
    • Capsule :
    • Correlation: Medicine Capsule:
      • In order to prevent any reaction with atmospheric ingredient, medicine content is added in capsule for protection.
    • Similarly in software application we need to protect data.
    • First we put attributes and function within class
    • Second we use access specifier to achieve encapsulation.
    • Different access specifier: Private, protected, internal, public.
    • Ideally attributes are marked private and required functions are made public.
    • Example: AC
      • We have remote as interface to increase temp, decrease temp, on/off
  • Polymorphism
    • Having many forms
    • Same function applied on different object gives you different results.
    • Static polymorphism:
      • Function overloading
      • Operator Overloading
    • Runtime polymorphism
      • Virtual method
    • Example Washing vegetables:
      • Washing potatoes, brinjal and tomatoes.
      • Same command of washing is different for each vegetable based on its class.
  • Inheritance
    • Deriving a class from another class is called inheritance.
    • Creating object using the properties of parent is called inheritance
    • In real life there is relation ship. object works in terms of relation ship
      • Country – Citizen, Parent- Child, Teacher – student
    • Inheritance is way to simulate relationship.
    • Re-usability + Extensibility




Coding best practices !!!

What is good code?

Code can be called as good code when it is

  • Understandable
  • Readable
  • Reusable
  • Maintainable
  • Reviewed



How to write good code? What are coding best practices?

In order to write good code, we need to follow/define coding best practices which should be followed by Junior Developer to Sr. Developer.

Below are some of the coding best practices i have come across:

  1. Naming convention: Decide which name convention to follow for variables/Methods/Classes etc
  2. Code refactoring: Remove dead code, duplicate code/Make reuse of code
  3. Simple code design: Keep design simple so that it is understandable to everyone and easy to maintain. Keep method/class size small.
  4.  Pair programming: In case of complex code or when there are multiple scenarios to be implemented/tested, its better to do pair programming
  5. Continuous Integration: Make sure latest code is available to everyone working on project so that there are no integration issues later.It is always good practice to have common code base.
  6. Test driven development:Use tools like Nunit
  7. Making use of code review tools: Use tools like Fxcop, Stylecop or resharper for code reviews.




Test first vs Debugging approach:

It’s always good to have test driven development so that we have test cases ready and can be used by everyone. Debugging efforts are wasted and only helps for person who is working on it  to write quality code. If same person continues to work on that module, he will not face much problem in identifying and verifying the scenarios.However there is no guarantee that all the scenarios will be tested.