Sunday, October 2, 2022

Secrete code in mobile phone

  1. *#07# : To check the SAR value
    SAR stands for Specific Absorption Rate which is measure of the amount of radio frequency energy absorbed by the body when using a mobile phone.
    Federal Communications Commission (FCC) has adopted limits for safe exposure to radio frequency (RF) energy which is 1.6 watts per kilogram (1.6 W/kg).
    Any smartphone at or below this SAR levels is “safe” to use. SAR below 1.6 watts per kilogram (1.6 W/kg) then it is OK otherwise you are advised to change your smartphone immediately.
    SAR level of smartphones:
      • iPhone 6: >> 1.59 W/kg 
      • LG G3: >> 0.99 W/kg 
      • LG G2: >> 1.44 W/kg 
      • Samsung Galaxy Note 2: >> 0.42 W/kg 
      • Samsung Galaxy Note 3: >> 1.07 W/kg 
      • Samsung Galaxy Note 4: >> 1.20 W/kg 
      • Samsung Galaxy S5: >> 1.28 W/kg 
      • HTC One (M8): >> 1.29 W/kg 

  2. *#67# : To check call forwarding
  3. *#61# : To get more Info on Call Forwarding
  4. *646# : To check available minutes
  5.  *225# : To check Your Bill Balance
  6. *#06# : To Display IMEI number
  7. #31# : Hide Phone From Caller ID 
  8. *3282#: Check Your Billing Cycle 
  9. *5005*7672# :SMS Message Center
  10. *43# : Activate Call Waiting
  11. *#7353# : Quick Test Menu (Samsung Galaxy Only) 
  12. *#1234# : Firmware (Samsung Galaxy Only) 

Saturday, November 27, 2021

JAVA Tricky

JAVA Tricky Questions

  1. Can java overload main method?
    Yes, but JVM only executes original main method. It never calls overloaded main methods

    overloading method- two or more methods in a class have same method name, but must have different parameters

    e.g.

    public class MyMain {

        public static void main(int args){

            System.out.println("This is a int "+args);
        }

        public static void main(boolean args){
            System.out.println("This is a boolean "+args);     
        }

        public static void main(String args[]){

            System.out.println("This is main method");

            MyMain myMain = new MyMain();

            myMain.main(5);

            myMain.main(true);
        } 
    }


  2. In java, can main method override?
    No. In java static method cannot be overridden.

    method override- same method name & same parameters in parent class & child class.
    It can override from parent to child class.
    private, static, final methods can't overridden, but it could be non static to static, non final to final 

  3. In Java, Can create program without main method?
    Yes, we can create class without main method, but it can't be execute because of main method could not find by JVM. It will be error `No such method, "main"`

    e.g.
    public class MyMain{
           System.out.println("This is a class");
    }


  4. Is java pure object oriented language?
    No. Java is not pure object oriented language because
    - java supports byte, Boolean, integers, double, float, characters primitive data type. These keywords are not objects.
    -java does not supports multiple inheritance.


  5. Why multiple inheritance not supports in JAVA? 
    Multiple inheritance is not supported because it leads to deadly diamond problem. Java supports multiple inheritance through interfaces only. A class can implement any number of interfaces but can extend only one class.
    In multiple inheritance class can inherit the properties from one or more parent class. Same signature available in super class & child class. JVM can't determine which method gets call or which class method gets priority.

    e.g.
            class P1{
               void callMe(){
                 System.out.println("I am P1");
  6.            }
              }

          class P2 {
               void callMe(){
                   System.out.println("I am P2");
                   }
                  }

                      class Child extends P1, P2 {
                            public static void main(String args[]){
                                Child c = new Child();
                                  c.callMe();
                                }
                                }

                                    //compilation error

                                      As depicted from code above, on calling the method callMe() using Child object will cause complications such as whether to call P1’s callMe() or P2’s callMe() method. 

                                          e.g.

                                                       class GP{
                                                            void callMe(){
                                                  System.out.println("I am GP");
                                                       }
                                                               }

                                                                   class P1 extends GP{
                                                                        void callMe(){
                                                              System.out.println("I am P1");
                                                                    }
                                                                           }

                                                                                class P2 extends GP{
                                                                                     void callMe(){
                                                                          System.out.println("I am P2");
                                                                                }
                                                                                        }

                                                                                          class Child extends P1, P2 {
                                                                                       public static void main(String args[]){
                                                                                           Child c = new Child();
                                                                                             c.callMe();
                                                                                             }
                                                                                            }

                                                                                                Grand Parent
                                                                                                    /\
                                                                                                     /  \
                                                                                                      /    \
                                                                                                                       /      \
                                                                                                          Parent1 Parent2
                                                                                                                   \      /
                                                                                                                      \    /
                                                                                                                         \  /
                                                                                                                            \/
                                                                                                                         Child

                                                                                                                        -----------------------------------
                                                                                                                          Solution: Java8 support multiple inheritance by interfaces. A class can implement two or more interfaces contains default methods, the implementing class should explicitly specify which default method is to be used, or it should override the default method.

                                                                                                                              interface PI1 {
                                                                                                                                    default void show(){
                                                                                                                                          System.out.println("Default PI1");
                                                                                                                                        }
                                                                                                                                      }
                                                                                                                                         
                                                                                                                                          interface PI2 {
                                                                                                                                                default void show() { 
                                                                                                                                                      System.out.println("Default PI2");
                                                                                                                                                    }
                                                                                                                                                  }
                                                                                                                                                     
                                                                                                                                                      class Test implements PI1, PI2 {
                                                                                                                                                        //override
                                                                                                                                                               public void show(){ 
                                                                                                                                                                    PI1.super.show(); 
                                                                                                                                                                      PI2.super.show();
                                                                                                                                                                    }
                                                                                                                                                                   
                                                                                                                                                                        public static void main(String args[]){
                                                                                                                                                                              Test d = new Test();
                                                                                                                                                                                d.show();
                                                                                                                                                                              }


                                                                                                                                                                                O/P- Default PI1
                                                                                                                                                                                  Default PI2

                                                                                                                                                                                1. what is meaning of public static void main(string[] args)?
                                                                                                                                                                                  why the declaration is standard for main method

                                                                                                                                                                                  public - Access specifier, main method allows to accessible everywhere.
                                                                                                                                                                                  static- main method to get loaded without getting by any object. It access without creating object.
                                                                                                                                                                                  void- return type. does not return any value.
                                                                                                                                                                                  main- method name
                                                                                                                                                                                  String args- String array. defining array of string passing of command line 


                                                                                                                                                                                2. What is static class in JAVA?
                                                                                                                                                                                  static inner class is a nested class which is a static members of outer class. It can can be accessing without instance of outer class
                                                                                                                                                                                  e.g. 
                                                                                                                                                                                  class Outerclass {
                                                                                                                                                                                       public  static String str = "Hello";
                                                                                                                                                                                       public static class NestedClass {
                                                                                                                                                                                           public void m1(){
                                                                                                                                                                                              System.out.println("Hello NestedClass")
                                                                                                                                                                                         }
                                                                                                                                                                                       }

                                                                                                                                                                                      public class InnerClass {
                                                                                                                                                                                           public void m2(){
                                                                                                                                                                                              System.out.println("Hello InnerClass");
                                                                                                                                                                                          }
                                                                                                                                                                                      }
                                                                                                                                                                                  }
                                                                                                                                                                                  public class Main {
                                                                                                                                                                                      public static void main(String[] args) {
                                                                                                                                                                                           //static method call
                                                                                                                                                                                          Outerclass.NestedClass nestedClass = new                  Outerclass.NestedClass();
                                                                                                                                                                                          nestedClass.m1();

                                                                                                                                                                                          //call non static method
                                                                                                                                                                                          Outerclass.InnerClass innerClass = new Outerclass().new InnerClass();
                                                                                                                                                                                         innerClass.m2();

                                                                                                                                                                                         //call non static method 
                                                                                                                                                                                        Outerclass outerclass = new Outerclass();
                                                                                                                                                                                        InnerClass outerclass1 = outerclass.new InnerClass();
                                                                                                                                                                                        outerclass1.m2();
                                                                                                                                                                                         //static keyword call
                                                                                                                                                                                         System.out.println(Outerclass.str);
                                                                                                                                                                                     }   

                                                                                                                                                                                  }

                                                                                                                                                                                3. What is nested class in JAVA?
                                                                                                                                                                                  Class within calss is called nested class. Nested Class can be static or non static
                                                                                                                                                                                  e.g.
                                                                                                                                                                                  class Outerclass {
                                                                                                                                                                                     public  static String str = "Hello";
                                                                                                                                                                                         public static class NestedClass {
                                                                                                                                                                                          public void m1(){
                                                                                                                                                                                              System.out.println("Hello NestedClass");
                                                                                                                                                                                          }
                                                                                                                                                                                      }

                                                                                                                                                                                      public class InnerClass {
                                                                                                                                                                                          public void m2(){
                                                                                                                                                                                              System.out.println("Hello InnerClass");
                                                                                                                                                                                          }
                                                                                                                                                                                      }
                                                                                                                                                                                  }

                                                                                                                                                                                  public class Main {
                                                                                                                                                                                      public static void main(String[] args) {
                                                                                                                                                                                         
                                                                                                                                                                                          //static method call
                                                                                                                                                                                          Outerclass.NestedClass nestedClass = new       Outerclass.NestedClass();
                                                                                                                                                                                          nestedClass.m1();
                                                                                                                                                                                         
                                                                                                                                                                                          //call non static method 
                                                                                                                                                                                          Outerclass.InnerClass innerClass = new Outerclass().new InnerClass();
                                                                                                                                                                                          innerClass.m2();
                                                                                                                                                                                         
                                                                                                                                                                                          //call non static method 
                                                                                                                                                                                          Outerclass outerclass = new Outerclass();
                                                                                                                                                                                          InnerClass outerclass1 = outerclass.new InnerClass();
                                                                                                                                                                                          outerclass1.m2();
                                                                                                                                                                                         
                                                                                                                                                                                          //static keyword call
                                                                                                                                                                                          System.out.println(Outerclass.str);
                                                                                                                                                                                      }   
                                                                                                                                                                                  }


                                                                                                                                                                                   
                                                                                                                                                                                4. What is nested class in JAVA?
                                                                                                                                                                                  Class within calss is called nested class. Nested Class can be static or non static

                                                                                                                                                                                  1. Main difference is of == & eqaul that is operator and method.
                                                                                                                                                                                  2. == is the reference comparison(address comparison) & equals is the content comparison. == is the check both objects points to same memory location.
                                                                                                                                                                                  3. if class does not override the equals, then by default equals method used the closed  of the parent class. 

                                                                                                                                                                                    e.g.
                                                                                                                                                                                    public class EqualsMethod {
                                                                                                                                                                                        public static void main(String[] args) {
                                                                                                                                                                                            String s1 = "HELLO";
                                                                                                                                                                                            String s2 = "HELLO";
                                                                                                                                                                                            String s3 = new String("HELLO");
                                                                                                                                                                                            System.out.println(s1 == s2); // true
                                                                                                                                                                                            System.out.println(s1 == s3); // false
                                                                                                                                                                                            System.out.println(s1.equals(s2)); // true
                                                                                                                                                                                            System.out.println(s1.equals(s3)); // true
                                                                                                                                                                                        }
                                                                                                                                                                                    }

                                                                                                                                                                                5. What is polymorphism?
                                                                                                                                                                                  Polymorphism is a ability of an object takes from many forms. Polymorphism means many forms. Polymorphism is a ability to display messages from different forms. 
                                                                                                                                                                                  Polymorphism allows to perform single action from different ways. Polymorphism allows to implement one interface or multiple interfaces.
                                                                                                                                                                                  Like. The Person at the same time has different characteristics like husband, father, son, brother.

                                                                                                                                                                                  Two types of polymorphism

                                                                                                                                                                                  1. Compile time polymorphism
                                                                                                                                                                                  2. Run time polymorphism

                                                                                                                                                                                  1. Compile time polymorphism: It is also known as static polymorphism. In this polymorphism having method overloading and operator overloading.
                                                                                                                                                                                  Method overloading : method overloading is the one or more methods having same name with different arguments.
                                                                                                                                                                                  e.g.
                                                                                                                                                                                  class Test {
                                                                                                                                                                                  static int multiply(int a, int b){
                                                                                                                                                                                  return a*b;
                                                                                                                                                                                  }
                                                                                                                                                                                  static int multiply(int a, int b, int c){
                                                                                                                                                                                  return a*b*c;
                                                                                                                                                                                  }
                                                                                                                                                                                  }

                                                                                                                                                                                  class PolymorphismTest{
                                                                                                                                                                                  public static void main(String args[]){
                                                                                                                                                                                  System.out.println("Multiply := "+Test.multiply(8, 5));
                                                                                                                                                                                  System.out.println("Multiply := "+Test.multiply(8, 5, 2)); }
                                                                                                                                                                                  }


                                                                                                                                                                                  2. Run time polymorphism: This is also known as Dynamic Method Dispatch. In this polymorphism, method can overriding. Functions call overridden method resolved run time. 

                                                                                                                                                                                  1. e.g. class Parent {
                                                                                                                                                                                    void print(){
                                                                                                                                                                                    System.out.println("This is parent");
                                                                                                                                                                                    }
                                                                                                                                                                                    }
                                                                                                                                                                                    class SubClass extends Parent{
                                                                                                                                                                                        void print(){
                                                                                                                                                                                    System.out.println("This is SubClass");
                                                                                                                                                                                        }
                                                                                                                                                                                    }

                                                                                                                                                                                    class SubClass1 extends Parent{
                                                                                                                                                                                        void print(){
                                                                                                                                                                                    System.out.println("This is SubClass1");
                                                                                                                                                                                        }
                                                                                                                                                                                    }

                                                                                                                                                                                    class Chid {

                                                                                                                                                                                        public static void main(String args[]){

                                                                                                                                                                                            Parent p;
                                                                                                                                                                                            p = new Parent;
                                                                                                                                                                                            p.print();
                                                                                                                                                                                            p = new SubClass();
                                                                                                                                                                                            p.print();
                                                                                                                                                                                            p = new SubClass1();
                                                                                                                                                                                            p.print();
                                                                                                                                                                                        }

                                                                                                                                                                                    }
















                                                                                                                                                                                Monday, March 25, 2019

                                                                                                                                                                                Track App usage in Mobile



                                                                                                                                                                                This functionality is already inbuilt into Android.
                                                                                                                                                                                1. Open your dailer
                                                                                                                                                                                2. Enter *#*#4636#*#*
                                                                                                                                                                                3. Select Usage statistics
                                                                                                                                                                                4. Sort by Launch Count.
                                                                                                                                                                                As far as I know these statistics get reset every time you reset your phone. Hope it helps.



                                                                                                                                                                                IMEI Number - How to get?

                                                                                                                                                                                Every phone or Mobile Broadband device has a unique 15 digit code, called an IMEI number.

                                                                                                                                                                                •  Enter *#06# 
                                                                                                                                                                                Will get unique 15 digit code.

                                                                                                                                                                                Tuesday, October 16, 2018


                                                                                                                                                                                GIT Command 1. Initialize git repository type command in the terminal: $ git init $ git add --all $ git commit -m "Initial Commit" 2. Create a new repository. Login into git repository
                                                                                                                                                                                3. Locate git clone url
                                                                                                                                                                                         e.g.   https://username@your..domain:7999 /yourproject/repo.git

                                                                                                                                                                                4. Push the files to repository
                                                                                                                                                                                        type command in the terminal: $ git remote add origin https ://username@yourname.domain:7999/yourproject/repo.git $ git push -u origin master 5. Error - failed to push some refs to 'https://username@bitbucket.org/yourname/yourproject/repo.git

                                                                                                                                                                                       type command 

                                                                                                                                                                                $ git pull --rebase origin master
                                                                                                                                                                                $ git push origin master
                                                                                                                                                                                
                                                                                                                                                                                
                                                                                                                                                                                hat way, you would replay (the --rebase part) your local commits on top of the newly updated origin/master (or origin/yourBranch: git pull origin yourBranch).
                                                                                                                                                                                --------------------------------------------------------------------------------------------------------------

                                                                                                                                                                                1.    Getting Help

                                                                                                                                                                                Three ways to get the manual page (manpage) help for any of the Git commands

                                                                                                                                                                                $ git help <verb>
                                                                                                                                                                                $ git <verb> --help
                                                                                                                                                                                $ man git <verb>
                                                                                                                                                                                           e.g.  $ git help config
                                                                                                                                                                                2.    Check Your Git Settings
                                                                                                                                                                                $ git config –-list 3. 


                                                                                                                                                                                a.     Check user name
                                                                                                                                                                                To get user name for a specific repository 


                                                                                                                                                                                $ git config user.name Or   $ git config --get user.name
                                                                                                                                                                                Nitin 
                                                                                                                                                                                To get user name for all repositories
                                                                                                                                                                                $ git config --global user.name Or   $ git config --global --get user.name
                                                                                                                                                                                Nitin
                                                                                                                                                                                b.    Check user email
                                                                                                                                                                                To get user email address for a specific repository
                                                                                                                                                                                $ git config user.email Or   $ git config --get user.email
                                                                                                                                                                                nitink@cdac.in
                                                                                                                                                                                To get user email address for all repositories
                                                                                                                                                                                $ git config --global user.email Or   $ git config --global --get user.emailnitink@cdac.in
                                                                                                                                                                                3. Your Identity 
                                                                                                                                                                                Set user name & email address. This is important because every Git commit uses this information
                                                                                                                                                                                 To set user name for a specific repository
                                                                                                                                                                                a.     $ git config user.name “Nitin Karale” 
                                                                                                                                                                                To set username for every repository  
                                                                                                                                                                                a.     $ git config --global user.name “Nitin Karale”
                                                                                                                                                                                b.    $ git config –global user.email nitin.tkarale@gmail.com
                                                                                                                                                                                4. Check remote url        To get remote url of repository $ git config --get remote.origin.urlhttps://nitin_karale@bitbucket.org/nitin_karale/sorghum.git

                                                                                                                                                                                $ git remote show origin
                                                                                                                                                                                * remote origin
                                                                                                                                                                                       Fetch URL: https://username@domain/yourname/repo.git
                                                                                                                                                                                 Push  URL: https://username@bitbucket.org/yourname/repo.git
                                                                                                                                                                                 HEAD branch: master
                                                                                                                                                                                 Remote branches:
                                                                                                                                                                                    SorghumV1                tracked
                                                                                                                                                                                    SorghumV2                tracked
                                                                                                                                                                                    google-play-services_lib tracked
                                                                                                                                                                                    master                   tracked
                                                                                                                                                                                    sorghum-android-studioV2 tracked
                                                                                                                                                                                 Local branch configured for 'git pull':
                                                                                                                                                                                    SorghumV2 merges with remote SorghumV2
                                                                                                                                                                                 Local refs configured for 'git push':
                                                                                                                                                                                    SorghumV2                pushes to SorghumV2                (up to date)
                                                                                                                                                                                    sorghum-android-studioV2 pushes to sorghum-android-studioV2 (up to date)


                                                                                                                                                                                5.  Set remote url in initialize
                                                                                                                                                                                a)    Initialize git first
                                                                                                                                                                                $ git init
                                                                                                                                                                                It shows initialize git
                                                                                                                                                                                b)    Check remote url by using following command
                                                                                                                                                                                $ git remote –v
                                                                                                                                                                                origin  https://username@domain/yourname/repo.git (fetch)
                                                                                                                                                                                origin  https://username@domain/yourname/repo.git (push)

                                                                                                                                                                                If it is empty then use commandE.g. $ git remote add origin {repository-url}

                                                                                                                                                                                6.    Make sure you have not set the GIT_COMMITTER_NAME or GIT_AUTHOR_NAME variables. You can check their values with the following command:
                                                                                                                                                                                a.     $ echo $GIT_COMMITTER_NAME
                                                                                                                                                                                         # prints the value of GIT_COMMITTER_NAME
                                                                                                                                                                                Output - It’s NULL (if not set value)
                                                                                                                                                                                b.    $ echo $GIT_AUTHOR_NAME
                                                                                                                                                                                   # prints the value of GIT_COMMITTER_NAME
                                                                                                                                                                                Output - It’s NULL (if not set value)

                                                                                                                                                                                Set committer name & author name
                                                                                                                                                                                a.     $ GIT_COMMITTER_NAME=Nitin Karale

                                                                                                                                                                                b.     $ GIT_AUTHOR_NAME=Nitin Karale


                                                                                                                                                                                7. Unstage an added file in Git. If you added a file by mistake, you can unstage it (but keep local changes) by saying

                                                                                                                                                                                   $ git reset HEAD path/to/file        This is also what  $ git status will tell you

                                                                                                                                                                                8.    Merging
                                                                                                                                                                                After pull it will get merging
                                                                                                                                                                                HCDC-PC8+Nitin@HCDC-PC8 MINGW64 /e/NVLI/automated-classification-tool (dev|MERGING)
                                                                                                                                                                                Then use following command
                                                                                                                                                                                $ git commit
                                                                                                                                                                                     It shows git commit then use :q command

                                                                                                                                                                                9.    Clone specific branch
                                                                                                                                                                                                $ git clone –b {specific branch} {repository url}
                                                                                                                                                                                      e.g
                                                                                                                                                                                $ git clone –b dev {remote url}
                                                                                                                                                                                10.    Shows remote branches & local branches
                                                                                                                                                                                $ git branch
                                                                                                                                                                                * master
                                                                                                                                                                                
                                                                                                                                                                                $ git branch -a
                                                                                                                                                                                * master
                                                                                                                                                                                  origin/1-2-stable
                                                                                                                                                                                  origin/2-0-stable
                                                                                                                                                                                  origin/2-1-stable
                                                                                                                                                                                  origin/2-2-stable
                                                                                                                                                                                  origin/3-0-unstable
                                                                                                                                                                                  origin/HEAD
                                                                                                                                                                                   origin/master
                                                                                                                                                                                $ git branch -r
                                                                                                                                                                                
                                                                                                                                                                                  origin/1-2-stable
                                                                                                                                                                                  origin/2-0-stable
                                                                                                                                                                                  origin/2-1-stable
                                                                                                                                                                                  origin/2-2-stable
                                                                                                                                                                                  origin/3-0-unstable
                                                                                                                                                                                  origin/HEAD
                                                                                                                                                                                  origin/master
                                                                                                                                                                                11.    Remove local untracked files from the current Git branch
                                                                                                                                                                                a)     If you want to see which files will be deleted you can use the -n option before you run the actual command:
                                                                                                                                                                                     $ git clean –n
                                                                                                                                                                                 E.g.
                                                                                                                                                                                  $ git clean -n
                                                                                                                                                                                 Would remove src/main/webapp/WEB-INF/glassfish-resources.xml

                                                                                                                                                                                b)     Then when you are comfortable (because it will delete the files for real!) use the -f option:
                                                                                                                                                                                $ git clean –f
                                                                                                                                                                                c)     Here are some more options for you to delete directories, files, ignored and non-ignored files
                                                                                                                                                                                ·       To remove directories, run
                                                                                                                                                                                $ git clean –f -d or $ git clean –fd
                                                                                                                                                                                ·       To remove ignored files, run
                                                                                                                                                                                $ git clean –f -X or $ git clean –fX
                                                                                                                                                                                ·       To remove ignored and non-ignored files, run
                                                                                                                                                                                $ git clean –f -x or $ git clean –fx
                                                                                                                                                                                12.    Stash - To record the current state of the working directory
                                                                                                                                                                                      a) To record the current state of the working directory and the index, but want to go back to a clean working directory 
                                                                                                                                                                                                        $ git stash 
                                                                                                                                                                                b)    To show list of stash
                                                                                                                                                                                       $ git stash list 
                                                                                                                                                                                stash@{0}: WIP on submit: 6ebd0e2... Update git-stash documentation
                                                                                                                                                                                stash@{1}: On master: 9cc0589... Add git-stash 
                                                                                                                                                                                Or
                                                                                                                                                                                                    $ git stash show 
                                                                                                                                                                                Update git-stash documentation
                                                                                                                                                                                Add git-stash 
                                                                                                                                                                                c)     To pop stash
                                                                                                                                                                                Remove a single stashed state from the stash list and apply it on top of the current working tree state
                                                                                                                                                                                                        $ git stash pop

                                                                                                                                                                                d)    To “Apply” Like pop, but do not remove the state from the stash list

                                                                                                                                                                                     $ git stash apply stash@{0}

                                                                                                                                                                                e)    “Clear” - Remove all the stash entries. Note that those entries will then be subject to pruning, and may be impossible to recover
                                                                                                                                                                                               $ git stash clear
                                                                                                                                                                                13.   Git ignore file 
                                                                                                                                                                                       .gitignore  Remove ignores files which are tracked before git add

                                                                                                                                                                                            a) Create a .gitignore file in project root

                                                                                                                                                                                             b) Edit .gitignore file in notepad
                                                                                                                                                                                             c) write all the files line by line you don´t want to add on the repository
                                                                                                                                                                                               e.g.   
                                                                                                                                                                                                      
                                                                                                                                                                                           d)Then in your git bash you have to write the following line:
                                                                                                                                                                                                             
                                                                                                                                                                                                             $ git config --global core.excludesfile ~/.gitignore_global

                                                                                                                                                                                             e) Commit all files 
                                                                                                                                                                                                    
                                                                                                                                                                                                            $ git rm -r --cached .

                                                                                                                                                                                                            $ git add .
                                                                                                                                                                                                                   $ git commit -m ".gitignore is now working"