To day I'm going to explain about most important thing for computer users. How to search anything on your computer in just second. I used for this everything software. You can download it from this http://filehippo.com/download_everything/ link or other any sites. After install you can play with it.
Friday, September 15, 2017
Monday, August 21, 2017
Creating APIs - Enterprise Service Bus
This page describes how you can create an API
that allows URL parameters to be sent directly into the ESB.
Goto wso2 developer Studio.
01 . Create ESB Solution Project
Click Developer Studio -> Open Dashboard ->
Click ESB Solution Project
ESB Project Name is TestAPI
Remove Create Registry Resources Project and
Create Connector Exporter Project. Only tick Create Composite Application
Project. Then click Finish.
02. Create REST API
Right click on created project(Left side)
New =>REST API =>Create A New API Artifact
Enter bellow parameters to text fields
You can see created API in leftside
Select Source code
<?xml version="1.0" encoding="UTF-8"?>
<api context="/service" hostname="localhost" name="urlParameterAPI" port="8280" xmlns="http://ws.apache.org/ns/synapse">
<resource methods="GET">
<inSequence/>
<outSequence/>
<faultSequence/>
</resource>
</api>
Then Change it like bellow code
<?xml version="1.0" encoding="UTF-8"?>
<api context="/service" hostname="localhost" name="urlParameterAPI" port="8280" xmlns="http://ws.apache.org/ns/synapse">
<resource methods="GET">
<inSequence>
<log level="full">
<property expression="get-property('username')" name="====USERNAME===="/>
</log>
</inSequence/>
<outSequence/>
<faultSequence/>
</resource>
</api>
Now its ok.
http://localhost:8280/service?username=Priyantha_Samaraweera
<api context="/service" hostname="localhost" name="urlParameterAPI" port="8280" xmlns="http://ws.apache.org/ns/synapse">
<resource methods="GET">
<inSequence>
<log level="full">
<property expression="get-property('username')" name="====USERNAME===="/>
</log>
</inSequence/>
<outSequence/>
<faultSequence/>
</resource>
</api>
Now its ok.
http://localhost:8280/service?username=Priyantha_Samaraweera
Wednesday, August 16, 2017
Abstract Class in Java
A class that is declared using “abstract” keyword is known as abstract class.
Abstract is a process of hiding the data implementation details and showing only functionality to the user.Abstraction lets you focus on what the object does instead of how it does it.
Main things of abstract class
- Abstraction class may or may not contain abstraction method.(There can be non abstract method) Point : An abstract method is method that declare that is declared without an implementation (without braces, and followed by a semicolon), like this: Ex : abstract void moveTo(double deltaX, double deltaY);
- But, If a class has at least one abstract method then class must be abstract
- If a class is declared abstract, it cannot be instantiated (Abstract classes may not be instantiated) {You are not allowed to create object of Abstract class}
- To use abstract class you have to inherit it from another class. Provide implementation to all the abstract method in it.
- If you inherit abstract class, You have to provide implementation to all the abstract method in it.
Declare abstract class
Specifying abstract keyword before the class during declaration, make it abstract. Have look below code:
abstract class AbstractDemo{ }
Declare abstract method
Specifying abstract keyword before the method during declaration, make it abstract. Have look below code
abstract void moveTo();//no body
Why we need to abstraction class
In an object-oriented drawing application, you can draw circles, rectangles, lines, Bezier curves, and many other graphic object. These object all have certain states(for ex -: position, orientation, line color, fill color) and behaviors(for ex -: moveTo, rotate, resize, draw) in common. Some of these states and behaviors are the same for all graphic objects (for ex : fill color,position, and moveTo). Others require different implementation(for ex: resize or drow). All GraphicObject must be able to draw or resize themselves; they just differ in how they do it. This is a perfect situation for abstract superclass. You can take advantage of the similarities and declare all the graphic object to inherit from the same abstract parent object(for ex : GraphicObject) as shown in the following figure.
First, you declare an abstract class, GraphicObject, to provide member variables and method that are wholly shared by all subclasses, such as the current position and the move to method.GraphicObject also declared abstract methods for abstract methods, such as drow or resize, that need to be a implemented by all subclasses but must be implemented in different ways. The GraphicObject class can look something like this:
abstract class GraphicObject {
void moveTo(int x, int y) {
//Inside this method we have to do change position of the graphic object
void moveTo(int x, int y) {
//Inside this method we have to do change position of the graphic object
// according to x,y .This changes same to every graphic object.
//Then we can implement here.
}
abstract void draw(); //But every graphic object drawing case is unique.
abstract void draw(); //But every graphic object drawing case is unique.
// Not common. Then we have to create that case
// inside each class . Then create these method as abstract
abstract void resize();
}
}
Usage of abstract method in sub classes
Each non abstract subclasses of GraphicObject, such as Circle and Rectangle, must provide implementations for the draw and resize method.
class Circle extends GraphicObject {
void draw() {
//Add to some implementation here
}
void resize() {
//Add to some implementation here
void draw() {
//Add to some implementation here
}
void resize() {
//Add to some implementation here
}
}
class Rectangle extends GraphicObject {
void draw() {
//Add to some implementation here
}
void resize() {
//Add to some implementation here
}
class Rectangle extends GraphicObject {
void draw() {
//Add to some implementation here
}
void resize() {
//Add to some implementation here
}
}
}
Inside the main method you can call all methods like this
Public static void main(String args[]){
GraphicObject c = new Circle();
c.drow();
c.resize();
c.moveTo(4,5);
}
Ways to achieve abstraction in java
There are two ways to achieve abstraction in java
- Abstract class(0 to 100%)
- Interface(100%)
Abstraction class having construction, data member, method etc
abstract class GraphicObject {
GraphicObject (){
System.out.println("GraphicObject is created");
}
void moveTo(int y, int x) {
System.out.println("Change position according to "+ x+ " and " + y);
}
abstract void draw();
}
class Circle extends GraphicObject {
void draw() {
System.out.println("Draw the Circle");
}
}
class TestAbstract
{
public static void main(String args[]){
GraphicObject grObj = new Circle ();
grObj.draw();
grObj.moveTo(4,6);
}
}
Output:
GraphicObject is created
Draw the CircleChange position according to 6 and 4
Remember two rules:
- If the class is having few abstract methods and few concrete methods: declare it as abstract class.
- If the class is having only abstract methods: declare it as interface.
References:
Tuesday, August 15, 2017
WSO2 Enterprise Service Bus Quick Start Guide
Before you working start with wso2 esb tool you have to download two different tool.
Enterprise Service Bus Tool
Developer Studio Tool
Developer Studio Tool
Download wso2 esb tool
- Go to this link
- Select binary type of 5.0.0 version
- Enter your details and select and Select submit. It will download esb tool
When downloaded it you can extract and ready to use it
Download Developer studio tool(Current best version)
- This developed on the eclipse mars version.
- Go to this link
- Click download button
- Enter your email and click Download Tooling
- Select your operating system(OS) then it will start download
Congratulation! Now you are ready to work with wso2 esb product.
Friday, August 4, 2017
What is the Compiler, JVM in java
When we type code using some IDE like eclipse, netbeans it's only can understand us. But computer can't understand it. There for compiler and JVM help to machine to understand this code. How ever compiler , compile the code to the bite code. And java virtual machine(JVM) convert that byte code to the ascii value using Just in Time (JIT). That's why java slow compatibility.
Wednesday, July 19, 2017
Tuesday, July 18, 2017
How to find any website URL IP address using command prompt
Why came website URL address
Think like this. Any person has his name and Identity
number. According to bellow image girl name is Kristina and her Identity number is 205.
If someone need to call her he can call "Hi Kristina". But other way is calling to her like "Hi 205".
But here is some problem. What is that. People not familiar with the number. They are familiar with names. They are don't like to use number to identify something. When you need to call google you type in the address bar www.google.com. But you don't like to type google IP address in the address bar like 172.217.26.68 . That is why came like these URLs because people are not familiar with numbers. Now I think you have some idea about this matter
Lets move to our task
I'm going to find google(www.google.com) IP addres
01. open the command prompt . Then type
ping www.google.com
Now you can see google IP address in the command prompt (Highlighted ares). Then copy it and past in the address bar of any browser. You will able to see google home page
Also try with ping www.facebook.com
You can fined URL IP address of any website like this
Subscribe to:
Posts (Atom)