Thursday, July 8, 2021

ForEach Methods in Java 8

 

 

 

 

 

This method takes a single parameter which is a functional interface. So, you can pass lambda expression as an argument.


default void forEach(Consumer<super T>action) 

 

 
Exmaple of foreach() Method: 
 
import java.util.*;  
public class Example{  
    public static void main(String[] args) {       
       List<String> list=new ArrayList<String>();  
       list.add("a");         
       list.add("b");       
       list.add("b");         
       list.add("c");         
       list.add("d");                
       list.forEach(          
           // lambda expression        
           (names)->System.out.println(names)         
       );     
    }  
}
 
 
 
 

Default methods

 

 

 

 

A method in the interface that has a predefined body is known as the default method. It uses the keyword default. default methods were introduced in Java 8 to have 'Backward Compatibility in case JDK modifies any interfaces. 

 

In case a new abstract method is added to the interface, all classes implementing the interface will break and will have to implement the new method. 

 

With default methods, there will not be any impact on the interface implementing classes. default methods can be overridden if needed in the implementation. Also, it does not qualify as synchronized or final.

 

Default methods are declared using the new default keyword. These are accessible through the instance of the implementing class and can be overridden.

@FunctionalInterface // Annotation is optional 
public interface Foo() { 
// Default Method - Optional can be 0 or more 
public default String HelloWorld() { 
return "Hello World"; 
} 
// Single Abstract Method 
public void bar(); 
}

 

 This feature will help us in extending interfaces with additional methods, all we need is to provide a default implementation.

 

 

 Most Important Examples:


Scenerio1:

What if our class is implementing 2 interfaces and both of them have same default method.

Solution:

There can be 2 solution to this problem like below:


public interface Circle { default void print() { System.out.println("I am a circle!"); } }
public interface Square {

   default void print() {
      System.out.println("I am a Square!");
   }
}

 

 

First solution is to create an own method that overrides the default implementation.

 
 
public class Shape implements Circle, Square { public void print() { System.out.println("I am neither circle nor a square but I am a rectangle!"); } }

Second solution is to call the default method of the specified interface using super.

 

public class Shape implements Circle, Square {

   public void print() {
      Circle.super.print();
   }
}




 

 

 

 

 

 

 

Lambda Expression

 

 

 

 
Lambda expression is a new and important feature of Java which was included in Java SE 8. It provides a clear and concise way to represent one method interface using an expression.

 

A lambda expression is characterized by the following syntax.

(parameters) -> expression

 Java 8 Functional Interfaces and Lambda Expressions help us in writing smaller and cleaner code by removing a lot of boiler-plate code.

 

In general programming language, a Lambda expression (or function) is an anonymous function, i.e., a function with no name and any identifier.

 

The most important feature of Lambda Expressions is that they execute in the context of their appearance. So, a similar lambda expression can be executed differently in some other context (i.e. logic will be the same but results will be different based on different parameters passed to function).

 

Example: 

 

For example, the given lambda expression takes two parameters and returns their addition.

Based on the type of a and b, the expression will be used differently. If the parameters match to Integer the expression will add the two numbers. If the parameters of type String the expression will concat the two strings.

 

 (a, b) -> a + b    

 

One more Exmple of Lambda Expressions:

 
interface IntegerOperation {

    public String addTwoInteger(Integer a, Integer b);
} 
 
public class Example {

   public static void main(String args[]) {
        // lambda expression with multiple arguments
    	Integer s = (a, b) -> a + b;
        System.out.println("Result: " + s);
    }
}

 

 

 Important Points to be noted:

1. When there is a single parameter, if its type is inferred, it is not mandatory to use parentheses. 

 a -> return a*a.


2. If there are more than 1 statments in the body then they should be enclosed in the braces like below.


(parameters) -> { statements; }





Functional Interfaces

 

 

 

If you notice the above interface code, you will notice @FunctionalInterface annotation. Functional interfaces are a new concept introduced in Java 8. An interface with exactly one abstract method becomes a Functional Interface. We don’t need to use @FunctionalInterface annotation to mark an interface as a Functional Interface.

Functional interfaces are new additions in java 8 which permit exactly one abstract method inside them. These interfaces are also called Single Abstract Method interfaces (SAM Interfaces).

@FunctionalInterface annotation is a facility to avoid the accidental addition of abstract methods in the functional interfaces. You can think of it like @Override annotation and it’s best practice to use it. java.lang.Runnable with a single abstract method run() is a great example of a functional interface.

One of the major benefits of the functional interface is the possibility to use lambda expressions to instantiate them. We can instantiate an interface with an anonymous class but the code looks bulky.

 

Runnable r = new Runnable(){
            @Override
            public void run() {
                System.out.println("My Runnable");
            }};

Since functional interfaces have only one method, lambda expressions can easily provide the method implementation. We just need to provide method arguments and business logic. For example, we can write above implementation using lambda expression as:

Runnable r1 = () -> {
            System.out.println("My Runnable");
        };

If you have single statement in method implementation, we don’t need curly braces also. For example above Interface1 anonymous class can be instantiated using lambda as follows:

Interface1 i1 = (s) -> System.out.println(s);
         
i1.method1("abc");
 

So lambda expressions are a means to create anonymous classes of functional interfaces easily. There are no runtime benefits of using lambda expressions, so I will use it cautiously because I don’t mind writing a few extra lines of code.

A new package java.util.function has been added with bunch of functional interfaces to provide target types for lambda expressions and method references. Lambda expressions are a huge topic, I will write a separate article on that in the future.

 

 

Important Points to be noted in Functional Interfaces: 

1. only one abstract method is allowed in any functional interface. Second abstract method is not not permitted in a functional interface. If we remove @FunctionInterface annotation then we are allowed to add another abstract method, but it will make the interface non-functional interface.

 2. This is valid even if we are not using @FunctionalInterface annotation. It is only for informing the compiler to enforce single abstract method inside interface.

 3. Addition of default methods to the functional interface is acceptable as long as there is only one abstract method declaration:

You can follow the below example. 
 
@FunctionalInterface public interface Foo { String method(String string); default void defaultMethod() {} }
 
4.  

Java 8 new Features

 Java 8 new Features

 

 

Oracle released a new version of Java as Java 8 in March 18, 2014.

 Java 8 provides following new features:

  • Lambda expressions,
  • Method references,
  • Functional interfaces,
  • Stream API,
  • Default methods,
  • Base64 Encode Decode,
  • Static methods in interface,
  • Optional class,
  • Collectors class,
  • ForEach() method,
  • Parallel array sorting,
  • Nashorn JavaScript Engine,
  • Parallel Array Sorting,
  • Type and Repating Annotations,
  • IO Enhancements,
  • Concurrency Enhancements,
  • JDBC Enhancements etc.

 




Wednesday, June 30, 2021

Make a Basic Spring Boot Project

 Make a Basic Spring Boot Project

  

Hello All, Today we will create a new Spring boot project from the scratch. It will be a bare minimum possible project. We will add the minimum dependency in the project.

 

We will use Intellij as an IDE.

 

First we will go to below link:

 https://start.spring.io/

 

You can fill the Group, Artifact, Name, Description of the project and packaging.

 

It is shown in the below image as well.

 

After entering the above details, you will click on 'Generate' button. It will save the project on your local system.

 



Now, import the project in Intellij IDE.

 

After importing it will be like below:




Congratulations!! you have made your first very basic and simplest possible spring boot project.

 

 

Now, we will run this project.

 

Go to follwoing path in the project:

src -> main -> java -> com -> example -> learningdemo -> LearningdemoApplication.java

 

Now, click on the run icon and click on the first option to run the main method of LearningdemoApplication class.

 

 

It is shown in follwing snap:


 

 

Now, you will see the output of the project like below;



Congratulations Again !! you have run the very basic and simplest spring boot project.






 

 

 

 

Tuesday, June 29, 2021

Transaction Isolation Levels in RDBMS

 Transaction Isolation Levels in RDBMS

 
A transaction is a single unit of operation we either execute it entirely or do not execute it at all.
 
ACID properties must be followed for a transaction operation to maintain the integrity of the database.
 
 
 
A: Atomicity
C: Consistency
I: Isolation
D: Durability
 
 
 
 
Atomicity: Either the transaction will be execute entirely or will not be executed at all.
 
 
Consistency: When the transaction has been executed then the database will move from one consistent state to another consistent state.
 
 
Isolation: Transaction should be executed in isolation of other transactions. 
So, during the current  transaction execution, intermediate transaction results of another (concurrently running) transaction should not be available to each other.
 
Two concurrent transactions should not impact the another transaction's flow/data. Even if these 2 transactions are running concurrently, but the result should be like as they would have run sequentially.
Although, we will talk about this in detail later in this article.
 
 
Durability: After successful completion of the transaction, the changes in the database should persist. Even if the application server/system gets restarted or failed.
 
 
 
 
 
- Different isolation levels describe - how changes applied by concurrent transactions are visible to each other.
- Each isolation level prevents zero or more concurrency side effects on a transaction. Ex: dirty read, nonrepeatable-read, phantom read.



1. Dirty Read: Read the uncommitted changes of a concurrent transaction.
2. Non Repeatable Read: Get different value on re-read(in a single transaction only) of a row if a concurrent transaction updates the same row and commits.
3. Phantom Read: Get different rows after re-execution of a range query if another transaction adds or removes some rows in the range and commits.





Different Transaction Isolation Levels:

There are 5 types of isolation levels:
 
 
1. READ_UNCOMMITTED: 
- This is the lowest level isolation(not supported in Postgres, Oracle)
- We can set isolation level for method or class.
- This level suffers from all the 3 above mentioned concurrency side effects.
- This level allows for most concurrent access.
 
 
 
2. READ_COMMITTED: (Default in Postgres, SQL Server, Oracle)
- This isolation level prevents dirty read. So, any uncommitted changes in concurrent transactions have no impact on us, but if a transaction commits it's changes then we can get different results when we do re-query.



3. REPEATABLE_READ: (Default in Mysql, Oracle doesn't support)
- This isolation level prevents dirty and non-repeatable reads. So,we are not affected by uncommitted changes in concurrent transactions.
- When we re-query for a row, we don't get different result but if we re-execute the range query , we might get newly added or removed rows.
- This is the minimum required isolation level to prevent the lost update. (Lost Update happens when 2 or more concurrent transactions read and update the same row.)
- This level does not allow simultaneous access to row at all. Hence lost update can't happen.



4. SERIALIZABLE:
- This is the highest level of isolation.
- This isolation level prevents all the side effects.
- In this isolation level, lowest concurrent access rate, since this level executes concurrent calls sequentially.


 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Transaction Propagation Types in Spring

Transaction Propagation Types in Spring



There are 7 types of propagation types:

1. Propagation.REQUIRED

@Transactional(propagation=Propagation.REQUIRED)

- This is default propagation type.
- If there is already an active transaction, then this propagation does not do anything and uses that transaction scope only. In another case, where there is not any active transaction, then it creates new transaction.



2. Propagation.SUPPORTS

@Transactional(propagation=Propagation.SUPPORTS)
 
- If there is already an active transaction, then this propagation does not do anything and uses that transaction scope only. Otherwise, this method runs non-transactional.



3. Propagation.MANDATORY

 @Transactional(propagation=Propagation.MANDATORY)
 
- If there is already an active transaction, then this propagation does not do anything and uses that transaction scope only. Otherwise throws an IllegalTransactionStateException.



4. Propagation.NEVER

@Transactional(propagation=Propagation.NEVER)
 
 - If there is already an active transaction, then this propagation throws an IllegalTransactionStateException.
 
 
 

5. Propagation.NOT_SUPPORTED

@Transactional(propagation=Propagation.NOT_SUPPORTED)
 
 - If there is already an active transaction, then this propagation suspends that transaction and runs non-transactional.


 

6. Propagation.REQUIRES_NEW

@Transactional(propagation=Propagation.REQUIRES_NEW)
 
 - If there is already an active transaction, then this propagation suspends that transaction and creates a new transaction.
- In another case of not having any active transaction, this creates new transaction.


 

7. Propagation.NESTED

@Transactional(propagation=Propagation.NESTED)
 
 - If there is already an active transaction, then spring marks a savepoint, so if the method throws any exception then transaction gets rollback to this savepoint.
- In another case of not having any active transaction, works as Propagation.REQUIRED.
























Saturday, February 1, 2020

What is Deposit Insurance

Bank 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");
             Thread.sleep(2000);
             System.out.println(Thread.currentThread().getName() + "ended");
         }catch(InterruptedException e){
             System.out.println("Exception caught");
         }
    }
};
exThread.start();
exThread.join();
             System.out.println(Thread.currentThread().getName() + "ended");


O/P: 
Thread-0 started
Thread-0 ended
main ended


2. sleep() method:
- static method
- pauses the current thread for specified miliseconds.
- does not release the lock.

Other ways to pause the current thread:

TimeUnit.SECONDS.sleep(4);
TimeUnit.MINUTES.sleep(4);
TimeUnit.HOURS.sleep(2);
TimeUnit.DAYS.sleep(1);

-> above are available in java.util.concurrent package (since Java 5).

3. yield() method:
- static method
- current thread goes from running state to runnable state and gives chance to another thread to go into running state. 
- So, after calling yield() method scheduler checks if there is any thread with same or higher priority than this thread. If found -> then it will move current thread to read/runnable state and give processor to other thread.















Please comment down any query/doubt regarding the topic, will try to clarify that ASAP.



Tuesday, January 14, 2020

Comparisons between Indian Domestic flights

Comparisons among 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.
5. Baggage: There are two types of baggages:
a) Checked Baggage b) Cabin baggage or hand baggage.
6. Baggage limit will be 15kg(checked-in baggage) + 7kg(cabin baggage). 
Dimensions: 


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.

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 जरूर करूंगा।






Thursday, January 26, 2017

Binary Tree Pre Order Traversing Code

PreOrder Traversing Code in BST:

=>

    public void printPreOrder(){
       
        if(root == null){
            return;
        }
       
        Stack stack = new Stack(numNodes);
       
        stack.push(root);
       
        while(! stack.isEmpty()){
           
            Node node = stack.pop();
            System.out.println(node.data);
           
            if(node.right ! = null){
                stack.push(node.right);
            }
            if(node.left != null){
                stack.push(node.left);
            }
        }
    }

Binary Tree Inorder Traversal


Code for Inorder Traversal:

=>

    public void printInOrder(){
      
        if(root == null){
            return;
        }
      
        Stack stack = new Stack(numNodes);
        Node node = root;
        while(node != null){
            stack.push(node);
            node = node.left;
        }
      
        while(! stack.isEmpty()){
          
            node = stack.pop();
            System.out.println(node.data);
            if(node.right != null){
                stack.push(node);
                node = node.left;
            }
          
        }
   }

Various Job Profiles in the field of Computer Science / Information Technology





The job profiles or the designations offered by various top recruiters include the following:


> Computer Programmer
> Systems Analyst
> Software Developer
> Hardware Engineer
> Consultant
> System Engineer
> System Designer
> Networking Engineer
> Database Administrator
> Web Developer
> E-commerce Specialist
> Programmer
> Quality Analyst
> Software Test Engineer
> Technical Engineer
> Technical Support Engineer

Sunday, October 23, 2016

[SOLVED] word cannot save or create this file make sure the disk that you want to save the file on is not full, write-protected or damaged.....

word cannot save or create this file make sure the disk that you want to save the file on is not full, write-protected or damaged.....


Solution of this problem:


The entire problem is because of Normal.dot file, which you will see as prompt, after canceling the error message.

What is Normal.dot:  This is the file that Microsoft word uses as the default blank page. You can see this page  while opening MS word. Now think, what will happen..... if this page is not blank any more?????????  

When we have written something into this, this is no more blank, so MS-word prompts us to save another Normal.dot file, and this is the main cause of that irritating prompt / error message.

Solution:: 

We will have to create this Normal.dot file. The steps are following:

1. Go to 'my computer'.
2. Go to Local Disc (which is normally C drive)
3. Then Program Files (x86).
4. Open folder Microsoft Office -> Office16 (which may differ based on office version).
5. Here create one Microsoft word file having name:  'Normal'    (without quotes).
6. Now Enjoy.......:)  That irritating prompt won't come now. 
        
                      I think, this post may be helpful for you. You can comment  or mail me for any further help.





Saturday, October 22, 2016

Experience of First Fiber-net Internet Connection:

Experience of First Fiber-net Internet Connection:


I bought router   "TP-LINK TL-WR841N 300Mbps Wireless N Router" from Flipkart. I bought this router during 'Big Billion Days', so it cost me for 900 ₹. Otherwise, normally cost is around 1050 or above. Though It took around 10 days to arrive :P .

Now comes the connection part, In Bengaluru, ACT is the best in internet connection. So I chose to go with ACT connection. So, First I registered for the connection on their web-site. It took only 5-10 minutes.
     Then next day, one guy called me to confirm my registration. He asked me, when I will be available at home to fill the registration form. Then he came on the same day evening to fill the registration form, following that payments and all other formalities were done.
     Next day, Two guys came for wiring and router installation work. It took only 15-20 minutes. They set the network name and password for the same. After 2-3 hours I was able to see ACT fibernet home page on my device, but it was asking username and password. that I didn't have because last step of verification was left .

     On the same day, I got a call from ACT service center for details verification, which  I had given during registration. Then after verification, I got my username and password. Using that I logged in to ACT fibernet connection. and Yipeeeeee.... , now I was able to access internet.


This is, how I got my internet connection. :) :)

Comment or mail me, if you need any assist. And at last thank you for reading.


Friday, September 9, 2016

How to Cancel train ticket Partially on IRCTC

How to Cancel train ticket Partially on IRCTC



I am going to write about the procedure of cancelling a train ticket online. Here I will cancel for one seat among 3 seats. After that, money gets refunded in few days. For me it took around 1 week.


Step1 : Login to your irctc account from which you have booked your ticket.


following is the login link: 

Step2 : Go to 'My Transaction' link same as the below picture, (which is at the left upper corner of the page):







Step 3: Now click on 'Booked Ticket History' as shown in below picture: 






Step 3: Now select which ticket do you want to cancel.






Step 4: Now, it will look like below after selection:





Step 5: Now click on 'Cancel Ticket' button. 





Step 6: Then a new pop up window will appear. In which all the seats details will be visible. Among them, whichever seat you want to cancel , just select that seat and click on 'Cancel Ticket' button.








Step 7: After clicking 'Cancel Ticket' button, a new confirmation window will pop up. Just click on OK button.  






Step 8:  Congratulations..!! You have done.  You will see cancelled ticket information:
here CAN means cancelled ticket.





--------------------------------------------------------------------------------------------------------------------------


I hope, I have described in very easy way. Even then, if you face any problem or need any advice regarding this topic, write in comment section or mail me at: ankitmittal2306@gmail.com