Palindrome of Number and string in same user Input.

PALINDROME  OF A NUMBER AND A STRING  IN SAME USER INPUT  :



I have gone through lots of palindrome programs but did not find any Program which give me palindrome of string and Integer in same input.
I have used   Function Overloading Concept.
Following is code snippet.


 import java.util.Scanner;  
 public class PalStringAndNumber {  
      public static void main(String args[])  
       {  
           Scanner sca =new Scanner(System.in);  
           System.out.println(" Enter Number or string to check whether it is palindrome");  
 while (sca.hasNext()){  
                String input=sca.nextLine();  
                if(!input.matches("^\\d*$")){  // check for if ( string contain numbers..?)  
                     isPalindrome(input);     // call to  isPalindrome(String str) method   
                      if(isPalindrome(input)){  
                           System.out.println("you Entered " +input + " is Palindrome ");  
                      }  
                      else{  
                           System.out.println("you Entered " +input + " is NOT Palindrome");  
                      }  
                 }  
                 if( input.matches("^\\d*$")){  
                           // System.out.println("you entered number");  
                           if(isPalindrome(input)){  
            System.out.println("you Entered " +input + " is Palindrome ");  
                           }  
                           else{  
            System.out.println("you Entered " +input + " is NOT Palindrome");  
                           }  
                          }  
                 }  
       }  
       public static boolean isPalindrome(String str) {  
            int i;  
            int n=str.length();  
            String revstr="";  
            for(i=n-1;i>=0;i--)  
            revstr=revstr+str.charAt(i);  
            if(revstr.equals(str))  
            return true;  
            else  
            return false;  
 }  
       public static boolean isPalindrome(int number) {  
            int palindrome = number; // copied number into variable  
            int reverse = 0;  
          while (palindrome != 0) {  
            int remainder = palindrome % 10;  
            reverse = reverse * 10 + remainder;  
            palindrome = palindrome / 10;  
          }  
          // if original and reverse of number is equal means  
          // number is palindrome in Java  
          if (number == reverse) {  
            return true;  
          }  
          return false;  
        }  
 } 
Output :
  Enter Number or string to check whether it is palindrome  
 adi4444ida  
 you Entered adi4444ida is Palindrome   
In code
 if( input.matches("^\\d*$")) ("^\\d*$")) is regex 
 You can read more about regex in followiong link. 

Know Regex 

 Copy this code in your IDE and play around it.
If any problem in code let me know.

Happy Coding


What is JDK ,JVM,JRE,JIT ..?

 Why it is necessory to know this terms very well ..?

            What you need to run java program on your computer . JVM..??    
           NO.

JVM is not enough even only JRE is not enough. You will need JDK [ Big Boss ] for it. But what are these terms lets  know  about JDK, JRE, JVM and JIT.
In this post we are going to explore following things :

1. Why we need to understand this..?    [As i mention above in intro .]

2. Flow Dig [ who uses whom ]

3. JDK   [shipped for free to us by Sun ]

4. JVM   [ Real game changer ]

5. JRE   [cares about device specific features ie, java runs on MS,    
                      Mac, Linus ]
5. JIT  [ speed up the process ]

6. Summary. [ Sticky notes]               


  Flow Dig :


  JDK ( Java Development Kit ) :


JDK (Java Development Kit)  it  contains 2 things :

          1.    JRE    ( To run the proggram ).

           2.  development tools like Java libraries, Java compilers, debuggers,  
                bundling  and deployment tools and API’s.  
   
          If you want to only run java program then you only require JRE.



  JVM ( Java Virtual Machine ) :


  •  Converts bytecode (i.e. .class file) to 'system specific' code. Now, since    system specific code, as the   
  •  Name suggests is dependent on OS . JVM do this by implementing JRE.( implementing....?? read JRE you ‘ll get it).

JVM is platform dependent but it makes the Java platform independent.

  JRE ( Java Runtime Environment)  :



  • JRE is not part/subset of JVM.           
  •  JRE is an implementation of JVM (e.g. Oracle, MySQL, DB2 etc. are implementations of a specification named RDBMS).
  • What actually happens here  is - when we compile a Java file, the compiler converts Java code in a byte-code. This byte-code is nothing but instructions which are understandable by an implementation of JVM (i.e. JRE)

Now  the  job of JRE ( if JDK tells him to do) is - to read byte-code, and convert it into another byte-code which is understandable by underlying OS.

  • JRE is runtime interpreter as JVM implement (uses) JRE to convert (.class) byte code to OS specific machine readable code.

  JIT ( Just in time Compiler ) :

  • JIT is the part of the Java Virtual Machine (JVM) used to speed up the execution time.
  •  JIT compiles parts of the byte code that have similar functionality at the same time, and hence reduces the amount of time needed for compilation. Here the term “compiler” refers to a translator from the instruction set of a Java virtual machine (JVM) to the instruction set of a specific CPU.


 Summary :

  • If you  able to run successfully java program on your machine then you are using JRE.
  • JDK is important if you want to develop and run code (as it contain JRE and Compiler with other libraries).
  • JIT is just used to save run time.







What Is Open Source Software.??? (know IT)

OPEN 
        SOURCE 
                    SOFTWARES   

                                                                ( Abstraction )






OPEN SOURCE == source code is freely available.                //Crap  I know you know this,    
                                                                                                                                       // keep reading few more seconds .

Definition :   Open source is an approach to the design, development, and distribution of software,
                          offering  practical accessibility to a software's source code.

We can Frame Open source vs Standard software's  as :      
                                                    Open Source vs. Standard Software 
                                                                 =
                                                    Linux vs. Microsoft
                                                                 = 
                                                    Innovation vs. Security         // Innovation  How   ..?

CZ  OSS softwares are available free of cost  in terms of executable file  and source code.It means we can develop/extend our ideas with existing software. 
whereas Standard softwares like MS office, Adobe reader , codes are not released publicly considering security reasons like confidentiality and also some business purpose.



 Android apps are open source you can modify your Favorite application this is the magic of OSS  How. ..?  if you really want to develop or modify app code then click below link 
i want to develop/modify android OSS app .

History of Open Source Software's :

   History starts since  1955  from sharing common libraries and IBM's  SHARE user group  to today's famous LINUX.  library sharing means sharing API's in java terminology sharing packages.
 [ know more ]


open source s/w   :
  Open-source s/w :  user can view as well as change the source code of the existing application.  After Initial Phase it undergoes secondary Phase of evolution where thousands of professionals around the Globe give their review ,Fixes and security glitches in the software.

 closed source s/w  : Closed-source s/w : Source code is hidden to prevent the user either viewing or changing the code. small team of developers. It practically not  possible to build a team of hundreds to check the code because the code is deemed proprietary and secret.


Trends :
1. open source in Mobile Industry :
open source in Mobile Industry    


2.Use popular OSS projects :   Linux, Apache web server, and MySQL were the top open source     
                                                  projects.
                         


3. Large Enterprise adopting OSS :





4.  Software Developers use Open Source Scripting Language :




Licencing  :
As i mention before we can make our own Android  APP but, launch app in public dommain we need an OSS licence.
Following are types of OSS licence :

GNU General Public License

BSD License

MIT License
[ know more ]

How Open Source Softwares Earns Money :

If their would be no Concept of Donating for good cause in the World, then probably their would have been no "Wikipedia" available for Information.
Wikipedia Donation
Same concept applies to "Open Source" Technologies. Many people around the Globe invest their Time, Effort and Money for this.
there are many business techniques by which we can earn  money from open source software.
Eg : linux earns money from teaching s/w, and also providing Add-On.
[ know more ]

Advantages of OSS :


  •  we can modify code from existing code, if we  think you have smart solution or an extension to available code. ( yes you can do this).
  • Mostly software are  free or very less cost, Eg.Apache tomcat server, Eclipse , Netbeans are Open source Thanks to all community for this wonderful software's.
  • right to use the software in any way.

 Disadvantages Of OSS :


  •  Most open source software applications are not reliable in terms of high level security.
  •  some s/w have No guarantee of updates since you are not paying for it.
  • No warranties regarding to viruses and performance.
  • we don't have claim and proprietary right on the extensions of open source s/w's we have developed.

Computer Science vs Information Technology

Computer Science VS Information Technology :

Information Technology==computer science or Information Technology != computer science..??

Computer science :

In simple words it is to learn how to proggram computer applications.
Eg .   ATM machine for banking is product of computer science
 ( Because CS has its roots in  electrical engineering  mathematics ) .

Computer Science” is the mixture and application of Electrical Engineering  Mathematics ,and Complex Theory/Algorithms  to understand and/or to  model information.





Information technology :


In simple words it is how to use computer applications , technologies  in  business.

Eg:  visa , Debit card online payment ,online money transfer are product of Information Technology
( Because  IT is use of electronic computers and computer software to convert, store, protect, process, transmit, and retrieve information from anywhere, anytime. )


IT deals with the use of electronic computers and computer software to convert, store, protect, process, transmit, and securely retrieve information.


Information Technology (IT), as defined by the Information Technology Association of America (ITAA), is "the study, design, development, implementation, support or management of computer-based information systems,
 particularly software applications and computer hardware." IT deals with the use of electronic computers and computer software to convert, store, protect, process, transmit, and securely retrieve information.





Who coined term “Information Technology” :
There is some disagreement on its origin
The term Information Technology (IT) is sometimes said to have been coined by Jim Domsic of Michigan in November 1981.  Domsic, who worked as a computer manager for an automotive related industry, is supposed to have created the term to  modernize the outdated phrase "data processing".


Sources :  http://en.wikipedia.org/wiki/Information_technology.