Sunday, November 8, 2015

AngularJs Issues and Solutions - 1

AngularJS Issues and Solutions (working with angularjs 1.4.x)
  • Even we write AngularJS hello world sample as below, it doesn’t work.




  • It shows error and doesn’t print actual result. It happens with the version of angular you are using.
  • Earlier versions of Angular allowed the ability to assign controller functions to the global scope like you did. Then this ability was removed from angular. There are still a lot of tutorials around that reference this older style however.

Migrating from 1.2 to 1.3

Due to 3f2232b5, $controller will no longer look for controllers on window. The old behavior of looking on window for controllers was originally intended for use in examples, demos, and toy apps. We found that allowing global controller functions encouraged poor practices, so we resolved to disable this behavior by default. You can go to below link for further details.Further Details

Saturday, November 7, 2015

Getting Ready for Technical Interviews - 3

Java Constructors

It is like a method that used to initialize the instance variables of an object invoked at the time of object creation. 

  • Every constructor has either this() call or super() call as its first statement. If we don't define custom constructor then it implicitly put super() for default constructor.
  • Never be inherited and never be overridden.
  • But it can be overloaded. 
  • Normally public, default,private and protected access modifiers can be used. 
  • Constructors name same as class name. But no return type.
  • Default constructor always no argument constructor and it has same access modifier as class.

Basic Java concepts

  • Inheritance
  • Polymorphism
  • Abstraction
  • Encapsulation

Define Inheritance ?

It is the process of where one object acquires properties and behaviors of another object of another class. It represents IS_A relationship and used for code re usability and method overloading.

What is  Polymorphism ?

It short meaning is, same thing in different form. It is ability of an object to take on many forms. 

Abstraction

It means ignoring irreverent features, properties or functions and emphasizing the relevant ones. It helps to deal with creating, understanding and managing complex systems. 

Encapsulation

Enclosing proper attributes and methods inside a single class. Benefits of encapsulation are given below.
  • Ability to modify our implemented code without breaking the code of others who use our code.
  • Maintainability
  • Flexibility
  • Extensible ability of our code 

Previous    

Getting Ready for Technical Interviews - 2

Today I am going to continue previous post (Getting Ready for Technical Interviews - 1) by adding more key areas related to technical interviews.

Debugging 

Programming errors called bugs. The process of tracking bugs down and correcting them is called debugging.

Why java is called platform independent ? 

Because translating a program into byte code instead of machine code. So it makes easier to run a program in a wide variety of environments, because only JVM needs ti be implemented for each platform. Although the details of the JVM will differ from platform to platform, all understand the same java byte code.

What do you mean by platform independent ?

We can write and compile the java source code in one platform (e.g. Windows) and can execute the class file in any other supported platform (e.g. Linux, Solaris etc)

Pointers

It is a reference which can be used to handle a memory location. Improper handling of pointers leads to memory leaks and reliability issues. Hence java doesn't support the usage of pointers.

Base class of all java classes ?

java.lang.Object

Just-In-Time Compiler (JIT) with java

It is used to improve the performance. 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.

Previous                                                                                         Next



Thursday, November 5, 2015

Getting Ready for Technical Interviews - 1

After long time I get chance to continue writing my blog. I thought include some basic java concepts and more technical concepts with this post. There is no any order of concepts. I just put things that I have focused when I was getting ready for interviews.

Ok lets start. 

JDK - Java Development Kit

A bundle of software with tools needed to develop java program such as compiler (javac.exe), java app launcher (java.exe) etc. This is mainly targeted for java development, compile a java file and run a java file. So it is clear even it providing facilities for development purpose, it includes execution environment also. 

JRE - Java Runtime Environment

This can be known as the implementation of java virtual machine which actually executes java programs. Therefore it is mainly targeted for execution of java files. 

JRE = JVM + Java Packages (util,lang etc) + Run time Libraries 

JVM - Java Virtual Machine


An implementation of the Java Virtual Machine Specification, interprets compiled Java binary code (called bytecode) for a computer's processor ( or "hardware platform") so that it perform a Java program's intructions. Java was designed to allow application programs to be built that could be run on any platform without having to be rewritten or recompiled by the programmer for each separate platform. A JVM makes this possible because it is aware of specific instruction lengths and other particularities of the platform.


Execution of a java program. Java is a both compiled and interpreted language.


Next


OOP With Java-Part 2

                                                    Access Modifiers
      There are three main access modifiers available in java.

  1. Private
  2. Protected
  3. Public                
    Other than these three access modifiers there is one more access level called default access level, which does not include any access modifier. Class can be modified only with public modifier or use default access level. (Private and protected not allowed) .If class A need to access members(variables or methods) in class B, class B must be accessible from class A.

                                          Private Access Modifier
  • Private access modifier restricts the accessibility to the class level.
  • It can be applied to member variables and methods.(both static and instance)
  • Constructors can be modified with private.
  • Classes can NOT be applied with private.
  • Method local variables can NOT be modified with private.
                void m(private int x){} //CE
  • Private variables and methods do NOT inherit to sub classes.
                                     Protected Access Modifier
  • Protected modifier is visible to all the class in the same package and to the sub classes outside the package.(Package+Kids)
  • Can be applied to variables(static/instance) and methods (static/instance)
  • Constructors can be modified with protected.
  • Can NOT be applied to top level classes.
  • Can NOT be applied to method local variables.
  • Accessing a protected member in a different package can be done only through inheritance.

     Other modifier applicable for class other than access modifier.
  1. abstract
  2. final
  3. strictfp
                                  Abstract classes and methods
  • "abstract" class can NOT instantiate (can not create objects out of abstract classes)
  • Only classes and methods can be marked as abstract.
  • "abstract" methods do not have a body.
                   public abstract void m(int x);
  • If a class has one or more abstract methods that class MUST be abstract.
  • "abstract" class can have both abstract and non abstract methods.
  • Even without a single abstract method, class can be marked as abstract.
                               abstract class A
                                {
                                          void m(){}
                                }
  • When an abstract method inherited down we must OVERRIDE  the abstract method in the first concrete (non abstract) subclass. If not CE(Compile Error).

Show Part 1