Solution for Oracle, Java, Php, Javascript, Mybatis. Introduction on Free Document Management System.
Monday, March 19, 2012
How to stop an open port listening on Windows forcefully
netstat -a -o -n
2) find the PID number for that port number
Proto Local Address Foreign Address State PID
TCP 0.0.0.0:8009 0.0.0.0:0 LISTENING 5840
TCP 0.0.0.0:8080 0.0.0.0:0 LISTENING 5840
3) In command prompt type
taskkill /F /PID 5840
This will kill process 5840 forcefully and release port 8009, 8080.
Oracle Savepoint example
ID NUMBER PRIMARY KEY
);
CREATE OR REPLACE PROCEDURE TEST_PROC
IS
BEGIN
INSERT INTO TEST(ID) VALUES(5);
FOR I IN 1..10 LOOP
SAVEPOINT A;
DECLARE
V_NUM NUMBER:=5;
BEGIN
INSERT INTO TEST(ID) VALUES(I);
COMMIT;
EXCEPTION WHEN OTHERS THEN
ROLLBACK TO A;
END;
END LOOP;
END;
/
Wednesday, February 1, 2012
Handling null values in Oracle Select Statements
create table emp(
emp_id number,
emp_name varchar2(20),
emp_age number);
alter table emp add constraint emp_pk primary key (emp_id);
insert into emp values(1,'mahesh',null);
insert into emp values(2,null,20);
insert into emp values(3,null,23);
insert into emp values(4,null,null);
An employee table contain column named emp_name that can have null values. When emp_name column is compared with "like" operator the rows with null values for emp_name columns are not evaluated by the select statement.
select * from emp where emp_name like '%';
EMP_ID EMP_NAME EMP_AGE
------ -------------------- ----------
1 mahesh
To evaluate column that can have null values, nvl function can be handled for emp_name column for null values as shown below.
select * from emp
where nvl(emp_name,'!') like '%';
EMP_ID EMP_NAME EMP_AGE
------ -------------------- ----------
1 mahesh
2 20
3 23
4
Sunday, January 15, 2012
How To Make Dynamic Sql Query Using Mybatis
Sample 1 demonstrate the simple test of condition when S_EMP_NAME parameter is not null
#Sample 1
SELECT A.EMP_ID,A.EMP_NAME,B.DEPT_ID B
FROM EMP A,DEPT B
WHERE A.DEPT_ID=B.DEPT_ID
AND A.EMP_ID=#{EMP_ID}
<if test="S_EMP_NAME !=null ">
AND A.EMP_NAME LIKE #{S_EMP_NAME} || '%'
</if>
Sample 2 demonstrate the build of total "where" condition. The previxOverrides variable is "AND | OR' is generated dynamically to make the statement complete.
#Sample 2
SELECT A.EMP_ID,A.EMP_NAME
FROM EMP A
<trim prefix="WHERE" prefixOverrides="AND |OR ">
<if test="S_EMP_ID !=null ">
A.EMP_ID=#{S_EMP_ID}
</if>
<if test="S_EMP_NAME !=null ">
A.EMP_NAME LIKE #{S_EMP_NAME}||'%'
</if>
</trim>
Sample 3 demonstrate build of like search for EMP_NAME only when S_EMP_ID parameter is null
#Sample 3
SELECT A.EMP_ID,A.EMP_NAME
FROM EMP A
<trim prefix="WHERE" prefixOverrides="AND |OR ">
<if test="S_EMP_ID !=null ">
A.EMP_ID=#{S_EMP_ID}
</if>
<if test="S_EMP_ID ==null ">
<if test="S_EMP_NAME !=null ">
A.EMP_NAME LIKE #{S_EMP_NAME}||'%'
</if>
</if>
</trim>
Thursday, January 12, 2012
How To Return Oracle Cursor Using Mybatis in Oracle stored procedure call
Employee class to hold the single employee.
public class EMPLOYEE {
private Integer EMP_ID;
private String EMP_NAME;
public void setEMP_ID(Integer eMP_ID) {
EMP_ID = eMP_ID;
}
public Integer getEMP_ID() {
return EMP_ID;
}
public void setEMP_NAME(Integer eMP_NAME) {
EMP_NAME = eMP_NAME;
}
public String getEMP_NAME() {
return EMP_NAME;
}
}
Code To Access Cursor in java
Map map = new HashMap();
map.put("EMP_ID",11111);
myConnection.insert("cursor_exec", map);
List
for (int i = 0; i < emp.size(); i++) {
System.out.println(emp.get(i).getEMP_ID() || emp.get(i).getEMP_NAME() );
}
Mybatis Mapping for returning Oracle Cursor during procedure call
<resultMap id="getCursor" type="office.main.EMPLOYEE">
</resultMap>
<select id="cursor_exec" statementType="CALLABLE" parameterType="java.util.Map">
{call
proc_name(#{EMP_ID,jdbcType=NUMERIC},#{EMP,jdbcType=CURSOR,mode=OUT,javaType=java.sql.ResultSet,resultMap=getCursor})}
</select>
How To Pass or Parameterize Name of Table in Sql Select Statements in Mybatis
Below is the sample example shown below.
<select id="getName" resultType="java.lang.String" parameterType="java.util.Map">
SELECT COL_NAME1 FROM ${TABLE_NAME}
WHERE PARAM_1=#{PARAM_1}
AND PARAM_2=#{PARAM_2}
AND PARAM_3=#{PARAM_3}
</select>
Function and Procedure call Mybatis
<select id="getEmpName" parameterType="java.util.Map" resultType="java.lang.String">
select getEmpName(#EMP_ID) from dual
</select>
<update id="proc_emp_update" statementType="CALLABLE" parameterType="java.util.Map" >
{call
emp_update(#{EMP_ID},#{EMP_NAME},#{DEPT_ID,jdbcType=NUMERIC},#
{DEPT_NAME,jdbcType=VARCHAR,mode=OUT})
}
</update>
The getEmpName function returns employee name. The statementType="CALLABLE" knows that is the procedure invocation. The jdbcType=NUMERIC must be provided for nullable fields during the procedure invocation. The jdbcType can be supported data type provided by Mybatis such as jdbcType=DATE for Date , jdbcType=VARCHAR for String, jdbcType=CURSOR for Cursor. mode=OUT defines that it is out parameter returned by the procedure.
Using Sql Queries in Mybatis
<select id="getEmployee" parameterType="java.util.Map" resultType="java.util.Map">
select * from employee
where emp_id=#{EMP_ID}
and emp_name like #{EMP_NAME}||'%'
</select>
<insert id="insertEmployee" parameterType="java.util.Map">
insert into employee(emp_id,emp_name) values (#{EMP_ID},#{EMP_NAME})
</insert>
<update id="updateEmployee" parameterType="java.util.Map">
update employee set emp_name=#{EMP_NAME}
where emp_id=#{EMP_ID}
</update>
<delete id="deleteEmployee" parameterType="java.util.Map">
delete from employee
where emp_id=#{EMP_ID}
</delete>
Unlike SQL statements in oracle semi-colon must be avoided in the DML statements at the end.
Wednesday, January 4, 2012
Using CASE WHEN Oracle SQL
CREATE TABLE DEPT(
DEPT_ID NUMBER,
DEPT_NAME VARCHAR2(100));
ALTER TABLE DEPT ADD CONSTRAINT DEPT_PK PRIMARY KEY (DEPT_ID);
CREATE TABLE EMP(
EMP_ID NUMBER,
EMP_NAME VARCHAR2(100),
DEPT_ID NUMBER);
ALTER TABLE EMP ADD CONSTRAINT EMP_PK PRIMARY KEY (EMP_ID);
ALTER TABLE EMP ADD CONSTRAINT EMP_FK FOREIGN KEY (DEPT_ID)
REFERENCES DEPT(DEPT_ID);
INSERT INTO DEPT VALUES(1,'Human Resource');
INSERT INTO EMP VALUES(100,'Employee One',1);
INSERT INTO EMP VALUES(101,'Employee Two',null);
COMMIT;
SELECT A.EMP_ID,A.EMP_NAME,A.DEPT_ID,
CASE
WHEN A.DEPT_ID IS NOT NULL THEN
(SELECT DEPT_NAME FROM DEPT WHERE DEPT_ID=A.DEPT_ID)
ELSE
''
END DEPT_NAME
FROM EMP A
Monday, January 2, 2012
Object Programming in Oracle
The procedure INSERT_EMP takes TBL_EMP type as its only IN parameter. If the count is greater than zero the program inserts into emp table.
CREATE OR REPLACE TYPE OBJ_EMP AS OBJECT (EMP_ID NUMBER , EMP_NAME VARCHAR2(100));
CREATE OR REPLACE TYPE TBL_EMP AS TABLE OF OBJ_EMP;
create table emp (
emp_id number,
emp_name varchar2(100)
);
alter table emp add constraint emp_pk primary key (emp_id);
CREATE OR REPLACE PROCEDURE INSERT_EMP( P_EMP TBL_EMP)
IS
v_obj_emp OBJ_EMP;
BEGIN
--insert into emp select * from table(p_emp);
IF P_EMP.COUNT > 0 THEN
FOR i IN 1 .. P_EMP.COUNT LOOP
v_obj_emp := P_EMP( i );
INSERT INTO emp ( emp_id,emp_name )
VALUES ( v_obj_emp.emp_id,v_obj_emp.emp_name);
END LOOP;
END IF;
END;
/
The INSERT_EMP procedure is invoked from anonymous block of plsql below. Here an employee object is intialized and table of employee type created. Employee type object t_emp is extend to create a row in the table object. The index of table object start with one which we assign to p_obj_emp object initially created. The t_emp table object is extended again and assigned to newly intialized p_obj_emp. Finally, INSERT_EMP procedure is invoked with t_emp object as parameter.
declare
p_obj_emp obj_emp := new obj_emp(1,'mahesh prajap');
t_emp tbl_emp := new tbl_emp();
begin
t_emp.extend();
t_emp(1):=p_obj_emp;
t_emp.extend();
p_obj_emp.emp_id:=2;
p_obj_emp.emp_name:='aarav prajap';
t_emp(2):=p_obj_emp;
INSERT_EMP(t_emp);
end;
/
The object programming concept in oracle can be evenly used with object oriented programming languages like java. List of objects can be passed directly to oracle procedure so that we can manipulate those passed objects in oracle as tables. There will be need and requirement in business logic that whole object be passed as tables and oracle plsql procedure takes control over the business procedures. The single object procedure call makes multiple call to procedure that makes more connection to oracle database and much of the time may be spent on such database connections.
Tuesday, November 15, 2011
Document Management System Guide Part 2
Registered user can login to the application through their user name and password. The URL can be obtained from the system administrator of Document Management System. |

Customer Registration Customers involved in the business process can be registered. This helps in generating report based on the customer identity. |

Document Transaction Steps and flow diagram 1. Document Entry. 2. Document Forward. 3. Document Review. 4. Document Authorize. 5. Document Reject |

Document Transaction Generation This is the document transaction generation module. In the screen shot Document Type, Customer list and forwarder lists is auto populated from the initial setups. User can select appropriate values from the list to generate document transaction. A document may contain multiple files as shown below in the screen shot. Some Useful Notes: 1. Document Type is user defined and parameterized document. It helps to differentiate the type of document generated. As per the configuration, a document number may contain document short string, document date and document serial number.eg AO060720100000000019. 2. “Forward To” user field is the default user the document to be forwarded to. It must not be empty. The block “User Forwarder List” contain list of users in the priority list to be forwarded one by one from left side simultaneously. If a default user, that is user in “Forward To” field do not respond within DOCUMENT TIME OUT (DOCUMENT_TIMEOUT) parameter default set to 30 minutes, then the document is revoked from “Forward To” user (admin) and auto forwarded to first user in User “Forwarded List” (surendras). If “surendars” do not respond within DOCUMENT TIME OUT, then the document is revoked from the user and auto forwarded to user “dhrubab”. During the document auto forward process, whenever any one of the user (admin, surendras, dhrubab or malikad) respond, the users in the forwarder chain are cancelled from the priority list. Then the document is processed as per the action (FORWARD, REVOKE, AUTHORIZE, REJECT) taken by the forwarder user. 3. Document No: It is system generated number to uniquely identify the document being generated. Document number generated depends upon the configuration of document type definition. A Document Number can contain multiples related files with the document. Screen shot show a Bank Guarantee document that contain citizen ship certificate and guarantee fill up form in portable document format. 4. + sign button indicates the addition of the file in the document to be generated. Clik on the + sign button to add new row to the document. 5. – sign button on each row indicates the deletion of the file from the document. Click on the –sign button to delete the current row from the document. 6. Remarks on the each document can be included in the remarks field that should be informative to the user receiving the document. Remarks are also show on document flow report. 7. The application supports files names in portable document format (PDF) for preview during document processing. Files in other formats are not available for preview but they can be downloaded to the local computer and opened as per user demand. It is suggested to process files in portable document format as the time to generate preview for portable document format is much lesser than file downloads. Avoid processing document files other than portable document format (PDF) to minimize bandwidth usage. 8. Extensions of filenames are mandatory in “File Name” field. The system returns error and file could not be transmitted if extension are avoided. For instance, if only name of file “citizen” is placed in “File Name” field, application would return error during file upload process. So, it is required to enter extension of the file with their file name that is “citizen.pdf” in “File Name” field. 9. Files must be stored in Application Home Directory default to “C:\docman”. The default Application Home Directory can be changed upon request to the administrator. 10. “Save” Button saves the files and generates a unique Document Number for transaction. 11. Email alert is sent to the default user (admin) upon Document Transaction Generation. 12. Refer to the screen shot shown below. Screen shot of Document Transaction Entry: |

Document Forward/Revoke/Authorize/Reject The Document Authorize/Forward/Reject/Review grid shows the list of document forwarded to login user for approval. Click on the record to display the details of the document. Document file in portable document format (PDF) can be previewed while other file formats need to be downloaded to the local computer. As per the requirement, a document can be processed for: 1. REVIEW document. 2. FORWARD for next level approval. 3. AUTHORIZE document. 4. REJECT document. |

User Actions: 1. REVIEW Document Whenever modification is required in the document, it is sent for review. User performing review can be same user that forward the document or any other user in the user list. 2. FORWARD Document Whenever approval is sought from next authority level, then the document is forwarded to the respective user. 3. AUTHORIZE Document Permit the document to carry on the business process. 4. REJECT Documents Disallow to process the business activity. A remark is mandatory while processing the document. The document recipient can track the state of the document and business process from the remarks as well. So, remarks must be precise and clear that can be taken as reference to authenticate the document. Remarks are also shown on document flow report. Screen shot of File preview |

Invalid Documents: During document transaction processing, if file name specified in file name field does not exist in Application Home Directory, the resulting document number is marked as Invalid Document. Invalid Documents can be processed from Invalid Document menu from “Invalid Document” Grid as show in the screen shot below. Respective files can be placed in Application Home Directory and process “Upload File” button to validate the resulting document. |

Email Notification and Alerts Email Notification in the form of alerts is sent to the user that have been forwarded a document or sent for review. During AUTHORIZE and REJECT of document, email is sent to all the users involved for the document processing. This will help user to know the state of the document as well. Background process for Auto Email Notification can be started and stopped from Email Notify menu. |

User Reports Reports are embedded in the application and rendered in Portable Document Format (pdf). Screen shot of List of Documents |

Screen shot of Document Flow Report |
Sunday, November 13, 2011
Document Management System Guide Part 1
Registered user can login to the application through their user name and password.

Context Menu is loaded at the left hand side panel and log in information is shown at the right side panel. Middle panel is the working area where forms are loaded.
Usage of Refresh Button:
- Clear And Reload Form:
Refresh button has been placed at the top of each form. It helps to clear and reload form without visiting context menu at right hand side panel.
- Retrieval of Online Data:
The data grid (Manage User) is not auto loaded after modification in the existing record and after creation of new record (user) as well. For example, if new user is registered, need to press refresh button to load the new user registered (changes) in the “Manage User” grid.

Data is loaded on the grid for further processing. When user clicks on the specific record, the details are loaded on the processing block (User Register), so that it can be modified as required. The user form controls such as “Add”, “Update”, and “Delete” buttons are loaded as per role granted to the user and their access on the each working forms. Search in Drop down List: The drop down list can be used for searching your required data as shown in the screen below. The list searches your data on each “Enter Key”. Type your text, to search in the list and enter the “Enter Key”. The list then returns filtered or matched data to the user that can be selected. |

Role Based Access Control Mechanism Role can be created from Manage Role menu. Required forms can be selected from the list and privilege on specific controls can be permitted and revoked. Mark required controls (“Insert”, ”Update”, ”Delete”, ”Cancel”, ”Verify”) to provide access on forms and unmark those controls that are not permitted to the role. There is no need to grant access permission on each form to the users. The user belonging to the role directly has access control to the role forms. |

Steps for Role Creation: Add 1. Enter Role Name, Description and select Authority level from list. 2. Select Add Group Authority and check mark the record to give access in the forms. Specific operation can be allowed and disallowed by marking and unmarking the operation. 3. The press “Add” button to save the Role information. Screen shot of Role creation (First Tab View) |

Screen shot of Role creation (Second Tab View) |

Modify 1. Select record from the “Role Setup” data grid. 2. Make necessary changes. 3. Press “Update” button. Delete 1. Select record from the “Role Setup” data grid. 2. Press “Delete” button. |
| User Creation and password management User can be created with ease with necessary information on “User Register” block. The user belonging to the role can be selected from the Role list. The user receives access permission from the role assigned. Date can be selected from the date box. Valid email address is required. This email address is used during document Forward process. |

Steps for User Creation: Add 1. Enter username and password. 2. Select Role, Authority from list. 3. Enter valid email address, date and employee id for the user. 4. The press “Add” button to save the user information. Modify 1. Select record from the “Manage User” data grid. 2. Make necessary changes. 3. Press “Update” button. Delete 1. Select record from the “Manage User” data grid. 2. Press “Delete” button. Screen shot user creation |

Define your own Document Type DMS allows define your own document involved in the business process. New document type can be added as a part of the business process. Document number is generated based on the document type definition. The document number is parameterized and can include two digit message string, document message date and ten digit message serial numbers. Document number AO060720100000000019 represents Account Open document on 6th July 2010 with serial number 19. This document category has starting serial number set to zero. |

System Parameters System parameters define the behavior of the application. 1. EMAIL_NOTIFICATION : Enable or disable email notification service in the application. The value of “Y” enables the email notification service else not. 2. DOCUMENT_TIMEOUT: Timeout in minutes for processing forwarded documents. If recipient do not respond to the document for DOCUMENT_TIMEOUT period, then document is marked as timeout and forwarded to next user in the priority list. 3. AUTO_FORWARD_TIME: Time specified in minutes, application waits to process document in priority list. 4. DOC_REPOSITORY: It is the central repository for storing the processed documents. 5. WORKING_DIRECTORY: It is used temporarily during file download process. 6. MAX_FILE_TRF_SIZE: Maximum File Transfer Size in Bytes application can handle. The application will not entertain file size greater than MAX_FILE_TRF_SIZE parameter. Screen shot of the system parameter is shown below: |
Wednesday, November 9, 2011
Code to Pass ArrayList From java to Oracle Database
import java.sql.*;
import java.sql.Connection;
public class Conn {
static String url = "jdbc:oracle:thin:@localhost:1521:oradb";
static String user = "username";
static String pass = "password";
public static Connection getConnection() {
try {
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection conn = DriverManager.getConnection(Conn.url, Conn.user,
Conn.pass);
return conn;
} catch (Exception ms) {
ms.printStackTrace();
return null;
}
}
public static void main(String ss[]) {
Connection conn = Conn.getConnection();
}
}
public class TableTest {
int id;
String name;
String attribute1;
String attribute2;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getAttribute1() {
return attribute1;
}
public void setAttribute1(String attribute1) {
this.attribute1 = attribute1;
}
public String getAttribute2() {
return attribute2;
}
public void setAttribute2(String attribute2) {
this.attribute2 = attribute2;
}
}
import java.sql.Array;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import oracle.jdbc.OraclePreparedStatement;
import oracle.sql.ARRAY;
import oracle.sql.ArrayDescriptor;
import oracle.sql.STRUCT;
import oracle.sql.StructDescriptor;
public class OracleStoredProcedure {
private final String ORACLE_STRUCT = "T_TYPE";
private final String ORACLE_ARRAY = "TB_T_TYPE";
public void insertAll(List
Connection conn = null;
StructDescriptor structDescriptor = null;
ArrayDescriptor arrayDescriptor = null;
int iSize = records.size();
Object[] arrObj = null;
Object[][] recObj = null;
try {
conn = Conn.getConnection();
structDescriptor = StructDescriptor.createDescriptor(ORACLE_STRUCT,
conn);
arrayDescriptor = ArrayDescriptor.createDescriptor(ORACLE_ARRAY,
conn);
arrObj = new Object[3];
recObj = new Object[iSize][3];
// Structuring obj and arrays
for (int j = 0; j < iSize; j++) {
TableTest ob = (TableTest) records.get(j);
recObj[j][0] = ob.name;
recObj[j][1] = ob.attribute1;
recObj[j][2] = ob.attribute2;
// arrObj[j] = new STRUCT(structDescriptor, conn, recObj[j]);
}
ARRAY arr = new ARRAY(arrayDescriptor, conn, recObj);
oracle.jdbc.OraclePreparedStatement preparedStatement = (OraclePreparedStatement) conn
.prepareStatement("{call POPULATE_TABLE_TEST (?)}");
preparedStatement.setArray(1, arr);
preparedStatement.execute();
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
if (conn != null) {
conn.close();
}
} catch (SQLException e2) {
e2.printStackTrace();
}
}
}
public static void main(String a[]) {
List
TableTest ab = new TableTest();
ab.setId(1);
ab.setName("user1");
ab.setAttribute1("m1");
ab.setAttribute1("m2");
list.add(ab);
TableTest abc = new TableTest();
abc.setId(2);
abc.setName("user2");
abc.setAttribute1("a1");
abc.setAttribute1("a2");
list.add(abc);
new OracleStoredProcedure().insertAll(list);
}
}
Javascript : Apply method
A function named Person has three parameters and initialize the object property with the passed arguments. Here "this" refer to the object that invoke the apply method ie Aperson object. Aperson function applies Person attributes with itself as first argument and array as its parameters.
function Person(firstname,middlename,lastname)
{
this.firstname = firstname;
this.middlename= middlename;
this.lastname = lastname;
}
function Aperson(age, firstname, middlename, lastname)
{
this.age = age;
Person.apply(this, new Array(firstname, middlename, lastname))
}
aperson = new Aperson(31,"Bill","Jill","King")
console.log(aperson.firstname + " " + aperson.middlename + " " + aperson.lastname + " is " + aperson.age +" years old.") ;
Output
Bill Jill King is 31 years old.
Tuesday, November 8, 2011
Javascript: Array functions Push, Unshift, Pop, Shift
var arraydata = ['a','b'] ;
arraydata.push('c');
arraydata.push('d','e');
console.log(arraydata);
Output
['a','b','c','d','e']
Unshift :The unshift method adds an element to the start of the array. If the method takes more than one elements, they are appended from right to left order.
var arraydata = ['b','a'] ;
arraydata.unshift('c');
arraydata.unshift('e','d');
console.log(arraydata);
Output
["e", "d", "c", "b", "a"]
Pop: The pop method removes an element from the end of the array and returns it.
var arraydata= ['a','b','c','d','e'];
console.log(arraydata.pop());
console.log(arraydata);
Output:
e
["a", "b", "c", "d"]
Shift : The shift method removes an element from the start of the array and returns it.
var arraydata= ['a','b','c','d','e'];
console.log(arraydata.shift());
console.log(arraydata);
Output:
a
["b", "c", "d", "e"]
arguments property of Javascript function
argumentExample=function()
alert(arguments.length);
for loop counter between 0 and arguments.length
alert(arguments[counter]);
argumentExample("firstItem","secondItem",232,"fourthItem");
Callback in javascript
In javascript we can pass function as an argument and execute that passed function from the called function. We can execute passed function from the called function using the predefiend function property "call". The first parameter to the call back function acts as scope of the function and other parameters can be accessed normal way.
Lets take an example. Here function named "func" is the main function that takes an argument. Inside the function object "p" is created that has two property named "name" and "lastname". Similarly "company" object is created with property named "name" and "address". Also variable named "fullname" is created.
Another function test is created with two parameters "param1" and "param2". Here alert is given for the passed parameters and scope provided to the test from the called function.
Now we call the function "func" with the function "test" as parameter.
The line
a.call(p,fullname,company);
calls back the passed function "test". The first parameter "p" here acts as scope of the function during callback and can be accessed using keyword "this" as done on lline
alert(this.name+' ' +this.lastname);
func=function(a){
p={};
p.name='myname';
p.lastname='mylastname';
var fullname= 'abc xyz ';
company = new Object();
company.name='My Tech P. Ltd';
company.address='Nepal';
a.call(p,fullname,company);
}
test=function(param1,param2){
alert(param1);
alert(param2.name+param2.address);
alert(this.name+' ' +this.lastname);
}
func(test);
Program to send Email in Php with Authentication
PEAR is an extension for PHP. These days PEAR is included with PHP, but you need to install it yourself. I use PEAR on all my PHP developments.
Installing PEAR:
Open a command line window (i.e. Start->Run->cmd)
Go to the PHP directory, in my case C:\php. Type go-pear.bat. Follow the instructions.
The PEAR extension get installed in C:\php\PEAR directory.
Once PEAR is installed, go to the php.ini file in your Apache2 directory. Find the
Code:
;include_path = ".;c:\php\includes"
Remove the semi-colon (to un-comment it), and then add C:\php\PEAR to it
Code:
include_path = ".;c:\php\includes;C:\php\PEAR"
;include_path = ".;C:\wamp\php\includes;C:\wamp\php\PEAR"
---------------------------------------------------------------------------------------------
** The 'pear' command is not currently in your PATH, so you need to
** use 'c:\wamp\php\pear.bat' until you have added
** 'C:\wamp\php' to your PATH environment variable.
* WINDOWS ENVIRONMENT VARIABLES *
For convenience, a REG file is available under C:\wamp\php\PEAR_ENV.reg .
This file creates ENV variables for the current user.
Double-click this file to add it to the current user registry.
-----------------------------------------------------------------------------------------------
#########Pear mail package Installation################
go to http://pear.php.net/package/Mail/download/ for supported Mail packages
pear install Mail-1.1.14
pear install --alldeps Mail-1.1.14
########Email with authentication#############
";
$to = "XYZ ";
$subject = "Hi!";
$body = "Hi,\n\nHow are you? This is test php mail.";
$host = "mail.domain.com";
$username = "user@myserver.com";
$password = "sdfdsf";
$headers = array ('From' => $from,
'To' => $to,
'Subject' => $subject);
$smtp = Mail::factory('smtp',
array ('host' => $host,
'auth' => true,
'username' => $username,
'password' => $password));
$mail = $smtp->send($to, $headers, $body);
if (PEAR::isError($mail)) {
echo("
" . $mail->getMessage() . "
");} else {
echo("
Message successfully sent!
");}
?>
Sunday, November 6, 2011
Document Management System
Content
- About Document Management System.
- How to use Document Management System.
- Customer Registration.
- Document Transaction steps and flow diagram.
- Document Transaction Generation.
- Document Forward/Revoke/Authorize/Reject.
- Invalid Document.
- Email Notification and Alerts.
- User Reports.
Document Management System
A document management system (DMS) is a computer system (or set of computer programs) used to track and store electronic documents and/or images of paper documents. Document management systems are becoming more important as it becomes increasingly obvious that the paperless office is an ideal that may never be achieved. Instead, document management systems strive to create systems that can handle paper and electronic documents together.
Document management system handles documents in such a way that information can be created, shared, organized and stored efficiently and appropriately. The focus of document management system is on the organization and storage of documents. Documents are stored in an organized and secure way and allow documents to be found easily. There is a move within large organizations to use document management software to help them do this. This system is designed to make handling electronic files more efficient and effective way.Document Management system enables the automatic routing of documents to the user responsible for working on them. Enterprises can rely on documents to be processed efficiently through a step-by-step process and there is no risk that they can be lost or overlooked. Workflow can be defined for the document processing and ensures that documents are forwarded to the appropriate user automatically at specified times, alerting the user of the necessity to process them through emails. This system ensures the smooth flow of documents through the enterprise.
In any enterprise it is vital that the security of electronic documents is appropriately managed. Document Management system ensure that access to the system is restricted only to those with the correct access permissions, both to ensure the integrity of data and to reduce the number of documents presented to the user only to those documents that are relevant to his or her role.
Document Transaction Steps and flow diagram
- Document Entry.
- Document Forward.
- Document Review.
- Document Authorize.
- Document Reject

Technical Details
- Full Open Source Implementation
- ZK
- JDK 1.6
- Spring Web Application Development Framework
- Apache Tomcat v6/ Jetty
- MySql
- Rsync
- Jasper Reports
- Linux/Fedora
- Enterprise Eclipse Platform for Software Development
Core Features
- Web Based Application
- Role Based Menu Access Control
- User Access Control
- User File Management
- Auto Email Notification
- Reports on Portable Document Format(PDF)
- Version Control
- Security/Access Control
- Support Multiple File Types
- Reports/Metrics
- Backup/Recovery