Tuesday, June 29, 2021
Transaction Propagation Types in Spring
Transaction Propagation Types in Spring
Saturday, February 1, 2020
What is Deposit Insurance
If a person deposits his/her money in a bank then maximum ₹5 lakhs money is insured according to the new budget proposal. So, if the person wants to withdraw his/her money from the bank, then he will guaranteed get minimum of (deposited money OR insured 5 lakhs amount).
Previously this limit was of ₹1 lakh.
This scheme insures all types of bank deposits including savings, fixed and recurring with an insured bank.
The bank deposits are insured by Deposit Insurance and Credit Guarantee Corporation (DICGC), a subsidiary of the Reserve Bank of India. The agency does not directly charge any premium from bank depositors but banks pay a nominal premium for the cover.
This ₹5 lakhs insurance amount includes both principle and interest amount.
This insured amount is summed up for all the branches of a bank, but not for different banks. So, if we keep money in multiple banks then from each bank we will get maximum deposit insurance of 5 lakhs.
Ex:
Bank1(branch1) : deposit amount - 2 lakhs
Bank1(branch2) : deposit amount - 4 lakhs
Bank2(branch1) : deposit amount - 7 lakhs
Bank3(branch1) : deposit amount - 3 lakhs
if all the banks bank1, bank2 and bank3 are getting closed at the same time(although it is very unlikely to happen), then from bank1 we will get guaranteed 5 lakhs. same as from bank2 and from bank3 we will get 3 lakhs.
so, total we can loose 1 lakh(from bank1), 2 lakhs(from bank2) and 0 (from bank3).
If you have any doubt or need more information about the topic, please write down in the comment section, will get clarified soon.
Wednesday, January 15, 2020
Multi Threading Short Notes
Thread vs Process:
- Process actually does not run but threads run. So, internally (in the process) there will be at least one thread which will be doing the actual task/work.
- Threads (of the same process) run in a shared memory space, while processes run in separate memory spaces.
- Thread is termed as 'light weight process', since it is similar to a real process but executes within the context of a process and shares the same resources (address space/process memory, data) allotted to the process by the kernel.
Main Thread:
- JVM starts the main thread.
- This is the first thread that is created after Java application gets started.
- It is the thread from which other 'child' threads will be spawned.
- It must be the last thread to finish execution bcz it performs various shutdown actions.
Thread class: (in java.lang package)
- states: available as enums in Thread class.
Image: represents the state diagram
- A thread is in the blocked state, if it tries to access a protected section of code that is currently locked by some other thread. Whenever thr protected section is unblocked, the scheduler picks one thread (from blocked states) and moves that thread to runnable state from the blocked state.
- A thread is in the waiting state when it waits for another thread on a condition, when this condition is fulfilled, the scheduler is notified and waiting thread is moved to runnable state.
t.getState() : method to get the current state.
Synchronized Method vs Block:
Synchronized Block :
- reduces the scope of the lock
- we can use arbitrary any lock(object) for mutual exclusion.
- can throw NullPointerException if the lock expression is null.
Synchronized Method:
- Entire method will be synchronized.
- lock will be on 'this' object or on the class (if the method is static)
- will not be null, so will not throw NullPointerException.
Inter-thread Communication:
object lock == monitor
- Communication happens via 3 ways: (wait(), notify() or notifyAll())
- These methods are called from the synchronized context (otherwise IllegalMonitorStateException will be thrown if a thread has been instructed to wait for an object's monitor that the specified thread does not have ownership of.)
wait() method: (defined in Object class)
- Can be called on the object, on which the current thread has lock.
- Necessary to have lock on that object.
- Thread will release the lock on the object and will go in wait state.
- Should call wait() method inside while loop instead of if block bcz it's possible that thread wakes up spuriously even the waiting condition is not changed.
Race Condition:
majorly occurs in 2 situations:
1. Check and act
2. Read modify write
(The problem here is our assumption that each line of code is atomic, BUT it is NOT).
ex: '++' operator is not an atomic operation.
- Check and Act:
Ex1:
if(!hashTable.contains(key)){
hashTable.put(key, value);
}
Here, both the operations (contains() and put()) are atomic individually but are not atomic together.
So, here race condition can occur, if 2 threads checks the same result of contains() method.
Ex2:
public Singleton getInstance(){
if(_instance == null){
_instance = new Singleton();
}
}
Here also, if 2 threads read _instance's value as null -> both the threads will enter inside if block. Same problem will occur.
- Read Update Write:
i++ is not an atomic operation.
so, if not synchronized then race condition will occur here.
OR
we can use AtomicInteger, which is internally thread-safe. Then no need to synchronized externally.
Thread Safety:
- Immutable objects are thread-safe.
- Readonly or final variables are thread-safe.
- Local variables are thread-safe bcz each thread has there own copy.
- Vector, concurrentHashMap, HashTable, String classes are thread-safe classes.
Dead Lock:
when 2 or more threads are waiting for each other to release the resource they need (lock) and get stuck for infinite time.
ex:
public void method1(){
synchronized(String.class){
synchronized(Integer.class){
System.out.println("acquired both the locks and reached here");
}
}
}
public void method2{
synchronized(Integer.class){
synchronized(String.class){
System.out.println("acquired both the locks and reached here");
}
}
}
Here, a good chance is present of deadlock.
Solution: should acquire locks in same order.
Important Methods inside Thread class:
1. join() method:
- final method
- nonstatic method
Ex: if we have 3 threads: T1, T2, T3
need to make sure that initially T1 will complete it's task then T2 will complete and then T3 will complete.
In this requirement, we can use join() method.
t1.join(); // from T2
t2.join(); // from T3
Ex:
Thread exThread = new Thread() {
public void run() {
try{
System.out.println(Thread.currentThread().getName() + "started");
};
exThread.start();
exThread.join();
System.out.println(Thread.currentThread().getName() + "ended");
Please comment down any query/doubt regarding the topic, will try to clarify that ASAP.
Tuesday, January 14, 2020
Comparisons between Indian Domestic flights
Common things for each flight:
1. We have to reach approx 2 hours before the departing time of flight/
2. We have to first check in either web check-in or counter check-in.
3. We have to present 25 minutes prior on the boarding gates in any way if we don't want to miss the flight.
4. You should have one photo id card (issued by some govt. institution or gov. org.), Passport, voter id, driving licence or Aadhar card will work, I assume.
a) Checked Baggage b) Cabin baggage or hand baggage.
6. Baggage limit will be 15kg(checked-in baggage) + 7kg(cabin baggage).
1. Vistara: It is the best domestic flight. All the reviews on different web-sites are good.
Pros:
1. Gives free food.
2. All the people/cabin crew in Vistara will be very helpful and very polite.
Cons:
1. Cost may be higher than other flights.
(2) Go Air: According to reviews on different sites, it is not very much good flight to be prefered unless you are out of other option. I found only negative points and reviews on web for Go Air.
Some informative facts about Go Air:
1. This does not provide free food.
2. Also the cost is average.
3. Cabin crew is not very much helpful and polite.
4. Not good in punctuality.
(3) Indigo: This is the mostly preferred flight for domestic within India.
Pros and Cons:
1. Cost is average and affordable.
2. Gives free food (not so sure about this)
(4) Air India: This is the another best flight to be preferred.
Pros and Cons:
1. Gives free food.
2. Seating space is good.
Privacy Policy Disclaimer
Privacy Policy for ankmit.blogspot.com
At ankmit.blogspot.com, accessible from ankmit.blogspot.com, one of our main priorities is the privacy of our visitors. This Privacy Policy document contains types of information that is collected and recorded by ankmit.blogspot.com and how we use it.
If you have additional questions or require more information about our Privacy Policy, do not hesitate to contact us.
Log Files
ankmit.blogspot.com follows a standard procedure of using log files. These files log visitors when they visit websites. All hosting companies do this and a part of hosting services' analytics. The information collected by log files include internet protocol (IP) addresses, browser type, Internet Service Provider (ISP), date and time stamp, referring/exit pages, and possibly the number of clicks. These are not linked to any information that is personally identifiable. The purpose of the information is for analyzing trends, administering the site, tracking users' movement on the website, and gathering demographic information.
Google DoubleClick DART Cookie
Google is one of a third-party vendor on our site. It also uses cookies, known as DART cookies, to serve ads to our site visitors based upon their visit to www.website.com and other sites on the internet. However, visitors may choose to decline the use of DART cookies by visiting the Google ad and content network Privacy Policy at the following URL – https://policies.google.com/technologies/ads
Privacy Policies
You may consult this list to find the Privacy Policy for each of the advertising partners of ankmit.blogspot.com. Our Privacy Policy was created with the help of the Privacy Policy Generator and the Privacy Policy Generator Online.
Third-party ad servers or ad networks uses technologies like cookies, JavaScript, or Web Beacons that are used in their respective advertisements and links that appear on ankmit.blogspot.com, which are sent directly to users' browser. They automatically receive your IP address when this occurs. These technologies are used to measure the effectiveness of their advertising campaigns and/or to personalize the advertising content that you see on websites that you visit.
Note that ankmit.blogspot.com has no access to or control over these cookies that are used by third-party advertisers.
Third Party Privacy Policies
ankmit.blogspot.com's Privacy Policy does not apply to other advertisers or websites. Thus, we are advising you to consult the respective Privacy Policies of these third-party ad servers for more detailed information. It may include their practices and instructions about how to opt-out of certain options. You may find a complete list of these Privacy Policies and their links here: Privacy Policy Links.
You can choose to disable cookies through your individual browser options. To know more detailed information about cookie management with specific web browsers, it can be found at the browsers' respective websites. What Are Cookies?
Children's Information
Another part of our priority is adding protection for children while using the internet. We encourage parents and guardians to observe, participate in, and/or monitor and guide their online activity.
ankmit.blogspot.com does not knowingly collect any Personal Identifiable Information from children under the age of 13. If you think that your child provided this kind of information on our website, we strongly encourage you to contact us immediately and we will do our best efforts to promptly remove such information from our records.
Online Privacy Policy Only
This Privacy Policy applies only to our online activities and is valid for visitors to our website with regards to the information that they shared and/or collect in ankmit.blogspot.com. This policy is not applicable to any information collected offline or via channels other than this website.
Consent
By using our website, you hereby consent to our Privacy Policy and agree to its Terms and Conditions.
Wednesday, September 13, 2017
देखिये मोदी का पहला भाषण, जब वे प्रधान मंत्री बने थे (Modi's First Speech After Winning 2014 Elections)
Modi's First Speech After Winning 2014 Elections.
Source: https://www.youtube.com/watch?v=Nj6Nn7MzwGQ&feature=player_embedded
Sunday, January 29, 2017
रेलवे टिकट को कैसे cancel करें | How to Cancel a Train Ticket Partially
हेलो दोस्तों, क्या कभी आपके साथ ऐसा हुआ है कि आपने train की टिकट बुक करवा ली है और वो टिकट कन्फर्म भी है लेकिन कुछ समय बाद किसी वजह से आपका प्लान cancel हो जाता है और आप अब वो यात्रा नहीं कर सकते है। ऐसे समय पर आपके पास २ ही विकल्प होते है की या तो आपने उस टिकट के लिए जो खर्चा किया है वो भूल जाईये और वो रूपये बर्बाद हो जाएंगे। दूसरा विकप्ल ये है की आप वो टिकट irctc की साइट पर जाकर cancel कर सकते हैं।
इसमें भी मान लीजिये आपने टिकट में ३ लोगो का टिकट करवाया था और तीनो का ही प्लान cancel हो जाता है तो आप पूरी टिकट ही cancel करना चाहेंगे मगर यदि आप तीनो में से किसी १ का प्लान cancel हो जाता है तब आप तो यही चाहोगे कि केवल १ ही टिकट cancel हो जाए, नहीं तो आपको पूरी टिकट cancel करवा कर फिर से २ लोगो की टिकट बुक करवानी पड़ेगी। इसके अलावा हो सकता है कि अब आपको कन्फर्म टिकट मिले भी नहीं।
ऐसे में आप बिलकुल नहीं चाहेंगे कि आप पहले से मिली हुई कन्फर्म २ सीट्स भी गवा बैठे। तो यह पर irctc हमें ये सुविधा देता है कि हम कुछ टिकट कैंसिल कर ले और कुछ टिकट वैसे ही रहे जैसे की कैंसिल से पहले थी।
तो मै आज आपको यही बताने जा रहा हू कि train की टिकट में से कुछ tickets को कैसे कैंसिल कर सकते हैं।
मैंने यह पर पहले से ही ३ सीट्स बुक की हुयी है और उसमे से मै यहाँ एक सीट cancel करके बताऊंगा । उसके बाद लगभग 1 -2 सप्ताह में आपका रिफंड अमाउंट आपके बैंक अकाउंट में आ जाएगा ।
Step 1 : सबसे पहले तो आपको आई. आर. सी. टी. सी. (irctc) कि वेबसाइट पर जाना है। उसमे आपको अपना username और password से लॉगिन करना है। irctc की साइट के लिए नीचे मैंने लिंक दिया हुआ है।
https://www.irctc.co.in/eticketing/loginHome.jsf
Step 2: लॉगिन करने के बाद आपको कुछ दिखाए हुए image की तरह दिखेगा। उसके बाद आपको ऊपर बाईं तरफ My-Transaction बटन पर क्लिक करना है, जैसा कि नीचे चित्र में दिखाया है :-
Step 3: यहाँ पर अब आपको Booked Ticket History पर क्लिक करना है।
Step 4 : अब आपको वह टिकट सलेक्ट करनी है जो कि आप कैंसिल करना चाहते हैं।
Step 5: सलेक्ट करने के बाद आपको कुछ ऐसा दिखेगा :-
Step 6: अब आपको Cancel Ticket पर क्लिक करना है।
Step 7: अब एक नई पॉप-अप (pop -up) विंडो खुलेगी, उसमें आपको वह सीट सलेक्ट करनी है जो आप कैंसिल करना चाहते हैं। वह सीट सलेक्ट करने के बाद Cancel Ticket बटन पर क्लिक करना है।
Step 8: उसके बाद एक कन्फर्मेशन (confirmation ) विंडो खुलेगी, उसमे आपको OK पर क्लिक करना है।
Step 9 : Congratulations..!! आपने सफलतापूर्वक अपनी टिकेट कैंसिल कर ली है। अब आपको अपनी कैंसिल की हुई टिकेट की जानकारी दिखाई देगी। यहाँ पर CAN का मतलब cancelled ticket है।
-------------------------------------
Conclusion :
तो मैंने आज बताया कि आप ट्रैन की टिकट में कुछ सीट्स को कैसे cancel क्र सकते हैं। आपकी बाकि की सीट्स को ज्यों का त्यों रखते हुए। टिकेट सफलता पूर्वक cancel होने के बाद कुछ दिनों में लगभग 10 से 15 दिनों में आपका बचा हुआ amount आपके अकाउंट में transfer हो जाएगा।
अगर आपको अभी भी कुछ भी और confusion या doubt रह गया हो इस topic के बारे मे तो आप नीचे comment क्र सकते है। में आपका reply जरूर करूंगा।








