Thursday, September 18, 2014

Compare RESTful vs SOAP Web Services

SOAP vs REST Web Services
There are many differences between SOAP and REST web services. The important 10 differences between SOAP and REST are given below:

No.
SOAP
REST
1)
SOAP is a protocol.
REST is an architectural style.
2)
SOAP stands for Simple Object Access Protocol.
REST stands for REpresentational State Transfer.
3)
SOAP can't use REST because it is a protocol.
REST can use SOAP web services because it is a concept and can use any protocol like HTTP, SOAP.
4)
SOAP uses services interfaces to expose the business logic.
REST uses URI to expose business logic.
5)
JAX-WS is the java API for SOAP web services.
JAX-RS is the java API for RESTful web services.
6)
SOAP defines standards to be strictly followed.
REST does not define too much standards like SOAP.
7)
SOAP requires more bandwidth and resource than REST.
REST requires less bandwidth and resource than SOAP.
8)
SOAP defines its own security.
RESTful web services inherits security measures from the underlying transport.
9)
SOAP permits XML data format only.
REST permits different data format such as Plain text, HTML, XML, JSON etc.
10)
SOAP is less preferred than REST.
REST more preferred than SOAP.





 Compare RESTful vs SOAP Web Services
There are currently two schools of thought in developing Web Services – one being the standards-based traditional approach [ SOAP ] and the other, simpler school of thought [ REST ].
This article quickly compares one with the other -


REST
SOAP
Assumes a point-to-point communication model–not usable for distributed computing environment where message may go through one or more intermediaries
Designed to handle distributed computing environments
Minimal tooling/middleware is necessary. Only HTTP support is required
Requires significant tooling/middleware support
URL typically references the resource being accessed/deleted/updated
The content of the message typically decides the operation e.g. doc-literal services
Not reliable – HTTP DELETE can return OK status even if a resource is not deleted
Reliable
Formal description standards not in widespread use. WSDL 1.2, WADL are candidates.
Well defined mechanism for describing the interface e.g. WSDL+XSD, WS-Policy
Better suited for point-to-point or where the intermediary does not play a significant role
Well suited for intermediated services
No constraints on the payload
Payload must comply with the SOAP schema
Only the most well established standards apply e.g. HTTP, SSL. No established standards for other aspects.  DELETE and PUT methods often disabled by firewalls, leads to security complexity.
A large number of supporting standards for security, reliability, transactions.
Built-in error handling (faults)
No error handling
Tied to the HTTP transport model
Both SMTP and HTTP are valid application layer protocols used as Transport for SOAP
Less verbose
More verbose

Wall Paper Change in Ubuntu


Short description of programs for your choose:
  • Walch: (sudo apt-get install wallch) very simple, for those, who just want only program for wallpaper change.
  • DesktopNova: (sudo apt-get install desktopnova) - similiar to Walch, little more advanced, but you'll not find in it for example settings of image sizing.
  • Variety: (sudo add-apt-repository ppa:peterlevi/ppa && sudo apt-get update && sudo apt-get install variety) - it's advanced wallpaper changer, with all features you'd want from wallpaper changer (sizing, auto-downloading, effects etc.). Just for those, who want something more from wallpaper changer.

JavaScript Compressor


Title: JavaScript Compressor


From Website:

Or,
First make a folder and keep all files:
  1. yuicompressor-2.4.2.jar
  2.  compiler.jar
  3.  input file(yui-min.js)
Then go to folder path using cd command.

cd ..../yourFolder/

Then follow these 2 command.

java -jar compiler.jar --js yui-min.js --js_output_file yui-min.js.closure.js

java -jar yuicompressor-2.4.2.jar yui-min.js -o yui-min.js.ycomp.js --charset utf-8

What is a foreign key?

What is a foreign key?
A foreign key means that values in one table must also appear in another table.
The referenced table is called the parent table while the table with the foreign key is called the child table. The foreign key in the child table will generally reference a primary key in the parent table.
A foreign key can be defined in either a CREATE TABLE statement or an ALTER TABLE statement.
Using a CREATE TABLE statement
The syntax for creating a foreign key using a CREATE TABLE statement is:
CREATE TABLE table_name
(
column1 datatype null/not null,
column2 datatype null/not null,
...

CONSTRAINT fk_column
FOREIGN KEY (column1, column2, ... column_n)
REFERENCES parent_table (column1, column2, ... column_n)
);
For Example
CREATE TABLE supplier
( supplier_id numeric(10) not null,
supplier_name varchar2(50) not null,
contact_name varchar2(50),
CONSTRAINT supplier_pk PRIMARY KEY (supplier_id)
);

CREATE TABLE products
( product_id numeric(10) not null,
supplier_id numeric(10) not null,
CONSTRAINT fk_supplier
FOREIGN KEY (supplier_id)
REFERENCES supplier(supplier_id)
);
In this example, we've created a primary key on the supplier table called supplier_pk. It consists of only one field - the supplier_id field. Then we've created a foreign key called fk_supplier on the products table that references the supplier table based on the supplier_id field.
We could also create a foreign key with more than one field as in the example below:
CREATE TABLE supplier<
( supplier_id numeric(10) not null,
supplier_name varchar2(50) not null,
contact_name varchar2(50),
CONSTRAINT supplier_pk PRIMARY KEY (supplier_id, supplier_name)
);

CREATE TABLE products
( product_id numeric(10) not null,
supplier_id numeric(10) not null,
supplier_name varchar2(50) not null,
CONSTRAINT fk_supplier_comp
FOREIGN KEY (supplier_id, supplier_name)
REFERENCES supplier(supplier_id, supplier_name)
);
In this example, our foreign key called fk_foreign_comp references the supplier table based on two fields - the supplier_id and supplier_name fields.
Using an ALTER TABLE statement
The syntax for creating a foreign key in an ALTER TABLE statement is:
ALTER TABLE table_name
add CONSTRAINT constraint_name
FOREIGN KEY (column1, column2, ... column_n)
REFERENCES parent_table (column1, column2, ... column_n);
For Example
ALTER TABLE products
add CONSTRAINT fk_supplier
FOREIGN KEY (supplier_id)
REFERENCES supplier(supplier_id);
In this example, we've created a foreign key called fk_supplier that references the supplier table based on the supplier_id field.
We could also create a foreign key with more than one field as in the example below:
ALTER TABLE products
add CONSTRAINT fk_supplier
FOREIGN KEY (supplier_id, supplier_name)
REFERENCES supplier(supplier_id, supplier_name);


Others: Department and Students Table

create table department
(dept_id numeric(10) not null,
dept_name varchar2(30) not null,
constraint department_pk primary key(dept_id)
); 
 
create table students
(std_id numeric(10) not null,
std_name varchar2(30) not null,
dept_id numeric(10) not null,
constraint student_pk primary key(std_id),
constraint fk_department
foreign key (dept_id)
references department(dept_id)
);


Remove file, folder and lock of folder using linux command


Title : Remove file, folder and lock of folder using linux command

How to remove all files from a folder(folder name=eclipse) ?
sudo rm -rf eclipse/*

How to remove a folder (folder name = eclipse)?
sudo rm -rf eclipse

Install Java update version from this page.

Uninstall Java from ubuntu

Install eclipse

For removing lock of a folder or file access(I want to access all files from the folder named by .ssh)
sudo chmod -R 777 /home/pdm-rizvi/.ssh/

Firebug Debugger


Firebug Debugger:
  • Return – Shift + F8
  • Continue – F8
  • Step Into – F11
  • Step Over – F10
  • Step Out – Shift + F11

Breakpoint use করলে Refresh দিলে ঐ breakpoint এর আগ পর্যন্ত Load হবে। তারপর undefined show করবে ।

Return : Return your document যে position এ breakpoint দিয়েছি সেখানে back করার জন্য এটা use করা হয়।

Continue : এটা দিলে বোঝাবে যে Application OK আছে।সুতরাং পুরোটাই Load হবে। but breakpoint এর position সে select করে রাখবে।
যদি again কোন checking এ যাইতে চাই, তবে অবশ্যই breakpoint টা তুলে দিতে হবে। নতুবা problem হবে।

Step Into(F11) : এটা next step এ কি হবে তা show করবে।

Step Over(F10) : Skip the entire block. একটা function block কে skip করার জন্য এটা use করা হয়।

Step Out(Shift + F11) : Go back to the function এর আগের যে function execute করেছে সেই function এ back করবে।
before calling function → before calling function → up to breakpoint.

Java Install and Path Setup in Ubuntu


 Title: Java Install and Path Setup in Ubuntu

1.Follow this for Sun Java Installation:

It helps for checking:


2.Follow this after installation:

3.
If you already know what you want to set JAVA_HOME and CLASSPATH to, you can just run
Code:
$ sudo gedit /etc/environment
JAVA_HOME="/usr/lib/jvm/jdk1.6.0_32"
JRE_HOME="/usr/lib/jvm/jdk1.6.0_32/jre"
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:$JAVA_HOME:$JRE_HOME"

http_proxy="http://localhost:80/"
https_proxy="https://localhost:80/"
ftp_proxy="ftp://localhost:80/"



If you want to install openjdk then follow this site
http://openjdk.java.net/install/


interface implements interfaces?


interface implements interfaces?




I think I am overlooking a very basic concept here... Why can't we have an Interface that implements an Interface? Or is it that Interfaces should always be top level, there cannot be an Interface somewhere in between a hierarchy tree?

Note: Text content in the code blocks is automatically word-wrapped

interface ParentInterface{  
       void myMethod();  
}  
  
interface SubInterface implements ParentInterface{  
       void anotherMethod();  
       void myMethod();  
}  

Ans:  i) Interface extends another interface but not implements it, because interface will not contain the implementation (you cannot provide implementation in the interface). So you can just extend it but not implement it.                             

Ans:ii) Implements denotes defining an implementation for the methods of an interface. However interfaces have no implementation so that's not possible. An interface can however extend another interface, which means it can add more methods and inherit its type.

Note: Text content in the code blocks is automatically word-wrapped
interface ParentInterface{  
       void myMethod();  
}  
  
interface SubInterface extends ParentInterface{  
       void anotherMethod();  
}