Menus

Jul 29, 2016

Package and Interface in Java

Course contents:
  1. Content
  2. Defining a package
  3. Access protection
  4. Importing packages
  5. Defining interfaces
  6. Applying interfaces 

An interface is similar to a class that can contain only constants, group of related method signatures, and nested types. There is no method body that is we cannot define methods inside the interface.

Interfaces cannot be instantiated they can only be implemented by classes or extended by other interfaces. Those classes that implement the interface must define the methods that are declared inside the interface. An interface is defined much like class.

The general syntax of interface definition is
Access specifier interface interfacename
{
 return type method-name1(parameter-list);
 return type method-name1(parameter-list);
 return type method-name1(parameter-list);
 return type method-name1(parameter-list);
 type variable-name1 = value;
 type variable-name2 = value;
 ……………..
 …………….
 return type methodnameN(parameter-list);
 type variable-nameN = value;
}
Here, access specifier is optional. When an access sepecifier is not specified then interface is only available to members of the package in which it is declared. When it is declared as public, the interface can be used by any other code.

Java nested class, call-by calue, call-by-reference

Nested class
A class defined within another class is known as nested class. The scope of a nested class is bounded by the scope of its enclosing class. Thus if class B is defined within class A, then B is known to A, but not outside of A.

A nested class (that is inner class) has access to the members, including private members of the class in which it is nested. However, the enclosing class does not have access to the members of the nested class.
WAP that demonstrate the concept of an inner class
class Outer
{
 int outer_x=100;
 void test()
 {
 Inner inn = new Inner();
 inn.display();
 }
 class Inner// this is a inner class
 {
 void display()
 {
 System.out.println("Display:outer_x = " +outer_x);
 }
 }
}

class InnerClassDemo
{
 public static void main(String args[])
 {
 Outer out = new Outer();
 out.test();
 }
}

Jul 25, 2016

Java Inheritance, method overriding, visibility control

Course Contents:
  1. Reference
  2. Super and sub class
  3. Multilevel hierarchy
  4. Method overriding
  5. Dynamic method dispatching
  6. Abstract class


Inheritance
The process of deriving a new class from an old one is called inheritance or derivation. The oldclass is referred to as the base class or super class or parent class and new one is called the derived class or subclass or child class. 

The derived class inherits some or all of the properties from the base class. A class can inherit properties from more than one class or from more than one level. The main purpose of derivation or inheritance is reusability. Java strongly supports the concept of reusability. 

The Java classes can be reused in several ways. Once a class has been written and tested, it can be used by another by another class by inheriting the properties of parent class.

Defining a subclass

A subclass can be defined as follows:
class subclassname extends superclassname
{
 Variable declaration;
 Method declaration;
}
The keyword extends signifies that the properties of the superclassname are extended to the subclassname. 

Jul 23, 2016

Introduction to Java Class and Object

Course Contents:
  1. Form of class
  2. Objects declaration
  3. Methods
  4. Constructors
  5. This keyword
  6. Garbage collection


Class
A class is a user defined data type that is used to define its properties. A class consists of data member and member functions. The data or variables defined within a class are called instance variables because each instance of the class (that is each object of the class) contains its own copy of these variables.

The functions defined or declared within the class are known as methods. The method and variables defined within a class are called member of the class. In class the data for one object is separate and unique from the data for another.

The general syntax of class definition is:
Class classname
{
 Type instance_variable1;
 Type instance_variable2;
 ………;
 ……….;
 Type methodname(parameter list)
{
 //body of the method
}
Type methodname(parameter list)
{
 //body of method
}
 …………..
 Type method(parameter list)
 {
 //body of method
}
}

Jul 22, 2016

Java Operators and Control Statements

Course Contents:

  1. Arithmetic operators
  2. Bitwise operator
  3. Boolean logical operator
  4. Relational operator
  5. Assignment operator
  6. The ?: Operator
  7. Operator precedence
  8. Java selection statements
  9. Iteration statements
  10. Jump statements

Operator

An operator is a symbol that tells the computer to perform certain mathematical or logical manipulations. Operators are used in programs to manipulate data and variables. Java operators can be classified into a number of related categories as below:

1. Arithmetic operators
Arithmetic operators are used in mathematical expressions in the same way that they are used in algebra. The following are the arithmetic operators:
+, -, *, /, %, ++, +=, -=, *=, /=, %=, --.

The operands of the arithmetic operators must be of a numeric type.

Jul 20, 2016

Java Data types, Variables and Arrays

Course Contents:

  1. Integers
  2. Floating-point
  3. Characters
  4. Boolean
  5. Variables
  6. Declaration
  7. Dynamic initialization
  8. The scope and lifeline of variables
  9. Type casting

Variable

A variable is an identifier that denotes a storage location used to store a data value. A variable takes different value at a different time during program execution.

Rules for constructing variable in Java
- They must not begin with a digit.
- Uppercase and lowercase are distinct. This means that Sum is not the same as sum and SUM.

- It should not be a keyword.
- White space is not allowed.
- Variable length can be of any length.

Jul 17, 2016

Introduction to java

Course Contents:
  1. Introduction
  2. History and development of java
  3. Platform independence
  4. Byte code
  5. Object-oriented characteristics
  6. How to write and execute?

History and development of Java
Year
Development
1990
Sun Microsystems decided to develop special software that could used to manipulate consumer electronic devices.
1991
After exploring the possibility of using the most popular object-oriented language C++, the team of Sun Microsystems announced a new language “OAK”.
1992
They use their new language to control a list of home appliances using hand held devices with a tiny touch sensitive screen.
1993
The team came up with idea of developing web applets (tiny programs) using the new language that could run on all types of computers connected to internet.
1994
The team developed a web browser called “HotJava” to locate and run applet program on internet. This becomes the most popular among the internet users.
1995
Oak was renamed “Java”. Java is just a name not an acronym and many popular companies like Netscape and Microsoft also support this language.

Jul 16, 2016

How to solve Error:(23, 17)"Failed to resolve: junit:junit:4.12" in Android Studio





Make sure that you are connected to internet.

Expand the Gradle Scripts

Double click on build.gradle (Module: app)

And paste following code below line apply plugin: 'com.android.application'
repositories {
    maven { url 'http://repo1.maven.org/maven2' }
    jcenter { url "http://jcenter.bintray.com/" }
}


Run your project and now it should work.

Jul 2, 2016

Explain System Analysis and Design

Unit 1: The Context of System Analysis and Design

Introduction
Systems are created to solve the problems. A system approach in any field can be defined as an organized way of dealing with a problem. A system can be defined as a collection of components that work together to achieve some objectives. Basically there are three major components in a system, input, processing and
output.
Fig: Basic System Components
System Analysis and Design (SAD) is a formal approach in system development that deals with systematic analysis of all the requirements and carrying out the systematic design taking into considerations of all the available resources.

Jun 14, 2016

HTML 5 Introduction

HTML 5
Introduction
HTML 5 is nothing different than HTML, it is an advanced & modified version of HTML standers which most of new browsers supports this standard. HTML 5 has introduced some new tags and removed some unnecessary tags from the HTML standers.
The first web browser, Mosaic, was introduced in 1993. A year later Netscape, based on Mosaic, was introduced and the net began to become popular. HTML was used in both browsers, but there was no "standard" HTML until the introduction of HTML 2.0.
HTML 2.0 was first published in 1995.* HTML 3.0 was published two years later and 4.01 two years after that. HTML 4.01 has been the work horse of the net ever since.
The first "working draft" of HTML5 came out in January of 2008 and it already has surprisingly broad browser support. However HTML5 is not yet fully implemented and won't be for some years yet.
Two groups, the W3C and the WHATWG (Web Hypertext Application Technology Working Group), are in charge of developing HTML5.
In many ways HTML5 is not all that different that 4.01. Certain tags, such as the <font> tag that were "deprecated" but worked in HTML 4.01 don't work in HTML5. There are a number of other odds and ends that have been changed, but they tidy up old messes rather than introduce fundamental changes.

Some rules for HTML5 were established:
  • New features should be based on HTML, CSS, DOM, and JavaScript
  • Reduce the need for external plugins (like Flash)
  • Better error handling
  • More markup to replace scripting
  • HTML5 should be device independent
  • The development process should be visible to the public

The doctype declaration
At the very top of the page you will see the doctype declaration:
<!DOCTYPE html>
Like any language, HTML5 has a grammar and a vocabulary.
Grammar: <!DOCTYPE html> goes at the top of every HTML5 page.
Vocabulary: The HTML5 word <!DOCTYPE html> means "this page is written in HTML5"

A Sample HTML5 Document
Text Box: <!DOCTYPE html>
<html>
    <head> 
        <title>Title of the document</title>
   </head>
  <body>
      The content of the document......
  </body>
</html>

<NAV> tag
The <nav> tag defines a set of navigation links.
A Sample HTML5 Document
Text Box: <nav>
  <a href="/html/">HTML</a> |
  <a href="/css/">CSS</a> |
  <a href="/js/">JavaScript</a> |
  <a href="/jquery/">jQuery</a>
</nav>

HTML5 Video
Many modern websites show videos. HTML5 defines a new element which specifies a standard way to embed a video/movie on the web page: the <video> element. In HTML 4.01 or older version browsers shows the videos through a plug-ins (like flash player).
Example:
Text Box: <video width="320" height="240" controls="controls">
    <source src="movie.mp4" type="video/mp4" />
    <source src="movie.ogg" type="video/ogg" />
   Your browser does not support the video tag.
</video>
·         You should also insert text content between the <video> and </video> tags for browsers that do not support the <video> element.
·         The <video> element allows multiple <source> elements. <source> elements can link to different video files. The browser will use the first recognized format.
·         The control attribute adds video controls, like play, pause, and volume.

HTML Video Tags:
<video> : Defines a video or movie
<source> : Defines multiple media resources for media elements, such as <video> and <audio>
<track> : Defines text tracks in mediaplayer.
Note: The <track> tag is not supported in any of the major browsers.

HTML5 Audio
Similarly to video before HTML5 standard browsers use the plug-ins to play the audio file. HTML5 defines a new element which specifies a standard way to embed an audio file on a web page: the <audio> element.
Example:
Text Box: <audio controls="controls">
    <source src="song.mp3" type="audio/mpeg" />
    <source src="song.ogg" type="audio/ogg" />
   Your browser does not support the audio tag.
</audio>

·         The control attribute adds audio controls, like play, pause, and volume.
·         You should also insert text content between the <audio> and </audio> tags for browsers that do not support the <audio> element.
·         The <audio> element allows multiple <source> elements. <source> elements can link to different audio files. The browser will use the first recognized format.

HTML5 Canvas
The canvas concept was originally introduced by Apple to be used in Mac OS X WebKit to create dashboard widgets. Before the arrival of canvas, you could only use drawing APIs in a browser through plug-ins such as Adobe plug-ins for Flash and Scalable Vector Graphics (SVG), Vector Markup Language (VML) only in Internet Explorer, or other clever JavaScript hacks.
When you use a canvas element in your web page, it creates a rectangular area on the page. By default, this rectangular area is 300 pixels wide and 150 pixels high, but you can specify the exact size and set other attributes for your canvas element.
A Basic Canvas Element:
<canvas></canvas>
Once you have added a canvas element to your page, you can use JavaScript to manipulate it any way you want. You can add graphics, lines and text to it, you can draw on it, and you can even add advanced animations to it.
The canvas API supports the same two-dimensional drawing operations that most modern operating systems and frameworks support.
To programmatically use a canvas, you have to first get its context. You can then perform actions on the context and finally apply those actions to the context. You can then perform actions on the context and finally apply those actions to the context.

Canvas Coordinates
Canvas coordinates start at x=0, y=0 in the upper-left corner, which we will refer to as the origin and increase (in pixels) horizontally over the x-axis and vertically over the y-axis.

Adding a Canvas to a page
Adding a canvas element in an HTML page is pretty straight-forward.
Example:
<canvas id="diagonal" style="border: 1px solid;" width="200" height="200"></canvas>
Note the addition of the ID="diagonal" to make it easy to locate this canvas element programmatically. An ID attribute is crucial to any canvas because all the useful operations on this element must be done through scripting.

Script code for Example canvas:
<script>
function drawDiagonal(){
        //Get the canvas element and its drawing context
        var canvas = document.getElementById('diagonal');
        var context = canvas.getContext('2d');

        //Create a path in absolute coordinates
        context.beginPath();
        context.moveTo(70,140);
        context.lineTo(140,70);

        //Stroke the line onto the canvas
        context.stroke();
}
        window.addEventListener("load", drawDiagonal, true);
</script>
        The drawing methods moveTo() and lineTo() do not actually create the line; you finalize a canvas operation and draw the line by calling the context.stroke() method.
Lets examine the JavaScript code used to create the diagonal line. It is a simple example, but it captures the essential flow of working with the Canvas API. You should know the detail of Canvas API for further drawing advance at canvas.

HTML5 Scalable Vector Graphics (SVG)
Vector graphics are quite different. Vector graphics represent images with mathematical descriptions of geometry. A vector image contains all of the information needed to draw an image from high-level geometric objects such as lines and shapes.
As you can tell by the name, SVG is an example of vector graphics.
When you magnify, rotate, or otherwise transform SVG content, all of the lines making up the image are crisply redrawn. SVG scales without losing quality.
Example: Adding SVG to Page
<!doctype html>
<svg width="200" height="200">
</svg>

Adding Simple Shapes to the SVG:
The SVG language includes basic shape elements such as rectangles, circles, and ellipses. The size and position of shape elements are defined with attributes. For rectangles, these are width and height.
Exmaple:
<!doctype html>
<svg width="200" height="200">
<rect x="10" y="20" width="100" height="80" stroke="red" fill="#ccc" />
<circle cx="120" cy="80" r="40" stroke="#00f" fill="none" stroke-width="8" />
</svg>


Transforming SVG Elements
There are organizational elements in SVG intended to combine multiple elements so that they can be transformed or linked to as units. The <g> element stands for “group.” Groups can be used to combine multiple related elements. As a group, they can be referred to by a common ID. A group can also be transformed as a unit. If you add a transform attribute to a group, all of that group’s contents are transformed. The transform attribute can include commands to rotate, translate, scale, and skew.
Example:
<svg width="200" height="200">
<g transform="translate(60,0) rotate(30) scale(0.75)" id="ShapeGroup">
<rect x="10" y="20" width="100" height="80" stroke="red" fill="#ccc" />
<circle cx="120" cy="80" r="40" stroke="#00f" fill="none" stroke-width="8" />
</g>
</svg>
Reusing Content:
SVG has a <defs> element for defining content for future use. It also has an element named <use> that you can link to your definitions. This lets you reuse the same content multiple times and eliminate redundancy. Figure below shows a group used three times at different transformed positions and scales. The group has the id ShapeGroup, and it contains a rectangle and a circle. The actual rectangle and circle shapes are just defined the one time inside of the <defs> element. The defined group is not, by itself, visible. Instead, there are three <use> elements linked to the shape group, so three rectangles and three circles appear rendered on the page.
Example:
<svg width="200" height="200">
<defs>
<g id="ShapeGroup">
<rect x="10" y="20" width="100" height="80" stroke="red" fill="#ccc" />
<circle cx="120" cy="80" r="40" stroke="#00f" fill="none" stroke-width="8" />
</g>
</defs>
<use xlink:href="#ShapeGroup" transform="translate(60,0) scale(0.5)"/>
<use xlink:href="#ShapeGroup" transform="translate(120,80) scale(0.4)"/>
<use xlink:href="#ShapeGroup" transform="translate(20,60) scale(0.25)"/>
</svg>



SVG Text:
SVG also supports text. Text in SVG is selectable within the browser (see Figure 3-11). Should they choose to, browsers and search engines could also allow users to search for text inside of SVG text elements. This has major usability and accessibility benefits.
SVG Text has attributes that are similar to CSS style rules for HTML.
Example:
<svg width="600" height="200">
<text x="10" y="80"
font-family="Droid Sans"
stroke="#00f" fill="#0ff" font-size="40px"
font-weight="bold">
Select this text!
</text>
</svg>


Contact Form

Name

Email *

Message *