Friday, March 14, 2008

Customizing editplus with java tools...

Customizing the applications to the way i need exactly had been an interest of me for a very long time..., I always feel that there is something always missing in the application that i'm using.., may be it is a ms word or photoshop or editplus or netbeans..
Then i felt that there is one way to go beyond this.., "plugins" or sometimes called extensions or user tools...
Here i'm going to give u a small example of how you can extend the functionality of editplus with the custom java plugins or tools that you write which makes ur life simpler...

Use Case: I'm going to use a simple use case which i felt was the most time consuming thing to do and which was a missing feature in the editplus.
Being a java developer most of the time i write a lot of System.out.println() (sop) statements in my java code which helps a lot in debugging and let me know how where my program is going.
At the same time it becomes a big burden for me when i have to remove these sops...
Here i'll give you an example of how you can remove the sop statments in a java source file with a custom tool..,in our case a simple java class file.(You can think of any other functionality that you might be concerned with may be adding or deleting content and anything more.., by allmeans you are playing with files...)

People who are familiar with editplus might be knowing how the editplus can be integrated with the java compiler and the java runtime.With the java compiler you can compile your java class file and with the java runtime you can actually run your compiled class file
more information on this please visit editplus faq:http://www.editplus.com/faq.html

Following are the snapshots on how you can do this..

In my scenario java is installed on my machine at the following location..
D:\Program Files\Java\jdk1.6.0_01
Location of javac.exe
D:\Program Files\Java\jdk1.6.0_01\bin\javac.exe
Location of java.exe
D:\Program Files\Java\jdk1.6.0_01\bin\java.exe

Java Compiler settings:

























Java Runtime settigs:


























These two settings help you compile a java src file and run it..., what we are looking for is writing a tool of our own and configure it with ediplus.
First we start with writing a java src file with exactly does the action we wanted to do.., place the whole logic in the main method and with the arguments if required.
Here im giving you the example i tried, the logic for my tool in RemoveSOP.java
(Click on the image for a better view to open it in a different window or tab)


/*
* RemoveSOP.java
*
* Created on March 15, 2008, 11:40 AM
*
* To change this template, choose Tools Template Manager
* and open the template in the editor.
*/

/**
*
* @author Bhasker
*/
import java.io.FileReader;
import java.io.FileWriter;
import java.io.BufferedReader;
import java.io.PrintWriter;
import java.io.IOException;

public class RemoveSOP {

/** Creates a new instance of RemoveSOP */
public RemoveSOP() {
}

public static void main(String[] args) throws IOException {
BufferedReader inputStream = null;
PrintWriter outputStream = null;

try {
inputStream =
new BufferedReader(new FileReader(args[0]));
outputStream =
new PrintWriter(new FileWriter(args[0]+"_Modified"));

String l;
while ((l = inputStream.readLine()) != null) {
//System.out.println(l);
if(l.contains("System.out.println(")){

while (!(l.contains(");"))){
l = inputStream.readLine();
}
}
else{
outputStream.println(l);
System.out.println(l);
}
}
} finally {
if (inputStream != null) {
inputStream.close();
}
if (outputStream != null) {
outputStream.close();
}

}
}

}

Here is how you configure the JavaTool class file with its editplus as a user tool...


Here is my java source file MyJavaSrcFile.java with which im going to test for my javaplugintool...



/*
* MyjavaSrcFile.java
*
* Created on March 15, 2008, 11:47 AM
*
* To change this template, choose Tools Template Manager
* and open the template in the editor.
*/

/**
*
* @author Bhasker
*/
public class MyjavaSrcFile {

/** Creates a new instance of MyjavaSrcFile */
public MyjavaSrcFile() {
}

public static void main(String args[]){

System.out.println("****************************************************************************\n" +
" xdebug : " + " Welcome to the dummy program... :D ");
int num1 = 4;
int num2 = 5;
int num3;

System.out.println("****************************************************************************\n" +
" xdebug : " + " Ready to do the multiplication of "+num1+" with " +
""+num2+" times");

System.out.println("Result ... : "+num1+" X "+num2+" = "+num1*num2+"\n");

num3 = num1*num2;

System.out.println("****************************************************************************\n" +
" xdebug : " + " Have a nice day good bye.... :) ");


}

}



The log is as follows...



/*
* MyjavaSrcFile.java
*
* Created on March 15, 2008, 11:47 AM
*
* To change this template, choose Tools Template Manager
* and open the template in the editor.
*/

/**
*
* @author Bhasker
*/
public class MyjavaSrcFile {

/** Creates a new instance of MyjavaSrcFile */
public MyjavaSrcFile() {
}

public static void main(String args[]){


int num1 = 4;
int num2 = 5;
int num3;




num3 = num1*num2;




}

}

With the my java source file opened i click on the java tool button or ctrl+ so as to run the tool on this file.This will create a new file +_Modifed with all the sops removed which i can replace the whole of the source in my file after i confirm the changes with a compare tool like beyond compare.

Here are the results that you can compare....
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEikfE_wcTaH_no_CTSvPfL4Q-Zw_pVBJq5FA-O90mp8LE3eplJ9yWr34uLT4xG8RQX0Wtu5NqmLg8nK8sbwuHlKUVqr6Isy4DiZl9Nc4JmpwBDxb1fdJoHzp-mqyKnvkYhJLPZxp3JldTo/s1600-h/compare.PNG
























He he..,the sops are removed in just second....
I came to hear from ppl that there are something called macros which does the same work more simply..., I'm yet to make my hands dirty with that....
Also the way i mentioned is not just limited to java tools but you can configure any other exe or jar or any file in a similar way..


Monday, November 19, 2007

Exploring Google maps and exploiting them to the best... :)

I'm one of the hard core fan of Google and love to explore everthing that comes in google applicatons.
Here i would introduce some of the new features of the Google maps.

For the guys who are new to google maps,Google maps is one of the famous google application through which you can view the map of any region of the world for free.
You can see the maps, find the routes, spot the locations of intrest.
You can also draw your own routes,mark your important places.
Also you can share you map with your friends and most important of all .. you can do all this for free with just a simple google account.

When you are in the google maps web page and after you have panned to a place or have some places/route marked in the Map you can then click on the link icon which gives you two things.
1.URL link to this map so that you can share with ur friends.
eg:http://maps.google.com/maps?f=q&hl=en&geocode=&q=surnida.bhaskar&sll=17.37161,78.563232&sspn=0.454794,1.028595&ie=UTF8&cd=1&ll=17.424029,78.52478&spn=0.909317,2.05719&z=9
2.IFrame Html code which you can embed in your html pages as below.
eg:
Sample Code :


View Larger Map


An Embedded Map region with above IFRAME Code.


View Larger Map

So what are you waiting for ... go to Google Maps now and exploit it at your best... :)

Sunday, July 15, 2007

Dot Net Express Editions downloads from microsoft website


http://go.microsoft.com/fwlink/?linkid=57037
http://go.microsoft.com/fwlink/?linkid=57033
http://go.microsoft.com/fwlink/?linkid=57035
http://go.microsoft.com/fwlink/?linkid=57034
http://go.microsoft.com/fwlink/?linkid=57036

My First CSS


maxstyle.css

BODY {
MARGIN: 0px; FONT-FAMILY: verdana,arial,helvetica
}
A:link {
COLOR: #003399
}
A:visited {
COLOR: #660099
}
A:hover {
COLOR: #ff3300
}
H1 {
FONT-SIZE: 175%; MARGIN: 0px
}
H2 {
MARGIN-TOP: 1em; FONT-SIZE: 155%; MARGIN-BOTTOM: 0px; BORDER-BOTTOM: #ddd 1px solid
}
H3 {
FONT-SIZE: 145%; MARGIN-BOTTOM: 0px
}
H4 {
FONT-SIZE: 120%; MARGIN-BOTTOM: 0px
}
H5 {
FONT-SIZE: 100%; MARGIN-BOTTOM: 0px
}
H6 {
FONT-SIZE: 100%; MARGIN-BOTTOM: 0px
}
TD {
FONT-SIZE: 68%
}
TH {
FONT-SIZE: 68%
}
P {
MARGIN-TOP: 0.5em; MARGIN-BOTTOM: 1em; LINE-HEIGHT: 1.5em
}
P.label {
FONT-WEIGHT: bold; COLOR: #6e6e6e; POSITION: relative; TOP: -9px
}
TT {
FONT-FAMILY: monospace
}
HR {
COLOR: #cccccc; HEIGHT: 1px
}
UL {
MARGIN-TOP: 6px; MARGIN-BOTTOM: 6px; MARGIN-LEFT: 25px
}
OL {
MARGIN-TOP: 6px; MARGIN-BOTTOM: 6px; MARGIN-LEFT: 25px
}
UL LI {
MARGIN-BOTTOM: 0.5em; LINE-HEIGHT: 1.5em
}
UL LI LI {
LIST-STYLE-TYPE: disc
}
OL LI {
MARGIN-BOTTOM: 0.7em
}
DIV {
MARGIN-TOP: 5px; MARGIN-LEFT: 15px; MARGIN-RIGHT: 15px
}
TABLE.DATA {
BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 5px; PADDING-BOTTOM: 5px; BORDER-LEFT: #cccccc 1px solid; PADDING-TOP: 5px; BORDER-BOTTOM: #cccccc 1px solid; BORDER-COLLAPSE: collapse
}
TH.DATA {
BORDER-RIGHT: #cccccc 1px solid; BORDER-TOP: #cccccc 1px solid; BORDER-LEFT: #cccccc 1px solid; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee
}
TD.DATA {
BORDER-RIGHT: #cccccc 1px solid; BORDER-TOP: #cccccc 1px solid; FONT-WEIGHT: normal; BORDER-LEFT: #cccccc 1px solid; BORDER-BOTTOM: #cccccc 1px solid
}
TABLE.clsStd TH {
PADDING-RIGHT: 2px; PADDING-LEFT: 2px; FONT-WEIGHT: bold; PADDING-BOTTOM: 2px; VERTICAL-ALIGN: top; PADDING-TOP: 2px; BACKGROUND-COLOR: #ddd; TEXT-ALIGN: left
}
TABLE.clsStd TD {
PADDING-RIGHT: 2px; PADDING-LEFT: 2px; PADDING-BOTTOM: 2px; VERTICAL-ALIGN: top; PADDING-TOP: 2px; BACKGROUND-COLOR: #eee
}
.clsNote {
PADDING-RIGHT: 10px; BORDER-TOP: gold 1px solid; PADDING-LEFT: 10px; PADDING-BOTTOM: 10px; PADDING-TOP: 10px; BORDER-BOTTOM: gold 1px solid; BACKGROUND-COLOR: #ffffcc
}
.clsImportant {
PADDING-RIGHT: 10px; BORDER-TOP: #cc0033 1px solid; PADDING-LEFT: 10px; PADDING-BOTTOM: 10px; PADDING-TOP: 10px; BORDER-BOTTOM: #cc0033 1px solid; BACKGROUND-COLOR: #ffcccc
}
.glInfo {
COLOR: #999999
}
UL.toc {
MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px; PADDING-BOTTOM: 0px; PADDING-TOP: 0px
}
LI.toc {
MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px; PADDING-BOTTOM: 0px; LINE-HEIGHT: 1.5em; PADDING-TOP: 0px; LIST-STYLE-TYPE: disc
}
TABLE.bin {
PADDING-RIGHT: 5px; BORDER-TOP: #990000 1px solid; PADDING-LEFT: 5px; PADDING-BOTTOM: 5px; BORDER-LEFT: #990000 1px solid; PADDING-TOP: 5px; BORDER-COLLAPSE: collapse
}
TH.bin {
BORDER-RIGHT: #990000 1px solid; PADDING-LEFT: 2px; MARGIN-LEFT: 2px; COLOR: #ffffff; BORDER-BOTTOM: #990000 1px solid; FONT-FAMILY: Arial, Helvetica, sans-serif; BACKGROUND-COLOR: #990000
}
TD.bin {
BORDER-RIGHT: #990000 1px solid; PADDING-RIGHT: 15px; FONT-WEIGHT: normal; MARGIN-RIGHT: 15px; BORDER-BOTTOM: #990000 1px solid; BACKGROUND-COLOR: #f1f1f1
}
UL.bin {
MARGIN-TOP: 0px; PADDING-LEFT: 0px; MARGIN-BOTTOM: 0.5em; PADDING-BOTTOM: 0px; COLOR: #cccccc; LINE-HEIGHT: 1.5em; PADDING-TOP: 0px
}
LI.bin {
MARGIN-TOP: 0px; PADDING-LEFT: 0px; MARGIN-BOTTOM: 0.5em; PADDING-BOTTOM: 0px; COLOR: #003399; LINE-HEIGHT: 1.5em; PADDING-TOP: 0px; LIST-STYLE-TYPE: disc
}

Recompiling invalid Objects in a database

Encountering Invalid Objects in database is a common problem to everyone.
Use the scripts below to recompile the objects.Each script is best suited for a given no. of invalid objects

Invcheck.sql:Script used to check the invalid schema objects



Set heading off; set feedback off; set echo off; Set lines 999;

Select 'No of Invalid Pkg specs and bodys : '||

(SELECT count(*) FROM dba_objects WHERE status = 'INVALID' AND object_type in ('PACKAGE','PACKAGE BODY') AND (object_name like 'CSI%'or object_name like 'OE_%'))

FROM dual;

SELECT owner AS Schema,object_name AS object,object_type AS Type,status,last_ddl_time AS lastModified FROM dba_objects WHERE status = 'INVALID' AND object_type in ('PACKAGE','PACKAGE BODY') AND (object_name like 'CSI_%'or object_name like 'OE_%');

show errors;

exit;


Invrecomp.sql



set feedback off;
set echo off;
Set lines 999;

Select 'No of Invalid Pkg specs and bodys : '||
(SELECT count(*) FROM dba_objects WHERE status = 'INVALID' AND object_type in ('PACKAGE','PACKAGE BODY') AND (object_name like 'CSI%'or object_name like 'OE_%'))
FROM dual;


Spool run_invalid.sql

select
'ALTER ' || OBJECT_TYPE || ' ' ||
OWNER || '.' || OBJECT_NAME || ' COMPILE;'
from
dba_objects
where
status = 'INVALID'
and
object_type in ('PACKAGE','FUNCTION','PROCEDURE')
and
(object_name like 'CSI%'or object_name like 'OE_%')
;

spool off;

set heading on;
set feedback on;
set echo on;

@run_invalid.sql
show errors;

exit;



Invrecompcur.sql



Set heading off;
SET SERVEROUTPUT ON SIZE 1000000
BEGIN
FOR cur_rec IN (SELECT owner,
object_name,
object_type,
DECODE(object_type, 'PACKAGE', 1,
'PACKAGE BODY', 2, 2) AS recompile_order
FROM dba_objects
WHERE object_type IN ('PACKAGE', 'PACKAGE BODY')
AND status != 'VALID'
AND (object_name like 'CSI%'or object_name like 'OE_%')
ORDER BY 4)
LOOP
BEGIN
IF cur_rec.object_type = 'PACKAGE' THEN
EXECUTE IMMEDIATE 'ALTER ' || cur_rec.object_type ||
' "' || cur_rec.owner || '"."' || cur_rec.object_name || '" COMPILE';
ElSE
EXECUTE IMMEDIATE 'ALTER PACKAGE "' || cur_rec.owner ||
'"."' || cur_rec.object_name || '" COMPILE BODY';
END IF;
EXCEPTION
WHEN OTHERS THEN
DBMS_OUTPUT.put_line(cur_rec.object_type || ' : ' || cur_rec.owner ||
' : ' || cur_rec.object_name);
END;
END LOOP;
END;
/
commit;
show errors;
exit;



Invrecompdep.sql


set serveroutput on size 1000000

declare
sql_statement varchar2(200);
cursor_id number;
ret_val number;
begin

dbms_output.put_line(chr(0));
dbms_output.put_line('Re-compilation of Invalid Objects');
dbms_output.put_line('---------------------------------');
dbms_output.put_line(chr(0));

for invalid in (select object_type, owner, object_name
from sys.dba_objects o,
sys.order_object_by_dependency d
where o.object_id = d.object_id(+)
and o.status = 'INVALID'
and o.object_type in ('PACKAGE', 'PACKAGE BODY',
'FUNCTION',
'PROCEDURE', 'TRIGGER',
'VIEW')
order by d.dlevel desc, o.object_type) loop

if invalid.object_type = 'PACKAGE BODY' then
sql_statement := 'alter package '||invalid.owner||'.'||invalid.object_name||
' compile body';
else
sql_statement := 'alter '||invalid.object_type||' '||invalid.owner||'.'||
invalid.object_name||' compile';
end if;

/* now parse and execute the alter table statement */
cursor_id := dbms_sql.open_cursor;
dbms_sql.parse(cursor_id, sql_statement, dbms_sql.native);
ret_val := dbms_sql.execute(cursor_id);
dbms_sql.close_cursor(cursor_id);

dbms_output.put_line(rpad(initcap(invalid.object_type)||' '||
invalid.object_name, 32)||' : compiled');
end loop;

end;
/
commit;
show errors;
exit;
Runinvalid.sql

Set heading off;
set feedback off;
set echo off;
Set lines 999;

Spool run_invalid.sql

select
'ALTER ' || OBJECT_TYPE || ' ' ||
OWNER || '.' || OBJECT_NAME || ' COMPILE;'
from
dba_objects
where
status = 'INVALID'
and
object_type in ('PACKAGE','FUNCTION','PROCEDURE')
and
(object_name like 'MTL%'or object_name like 'OE_%')
;

spool off;

set heading on;
set feedback on;
set echo on;

@run_invalid.sql
show errors;

Converting a Scanned Image to Text

The exact way to scan an image into Adobe Acrobat depends on which version of Acrobat that you are using. With earlier versions you go into the File menu and select Import then Scan. With more recent versions you go into the File menu and select Create PDF then From Scanner. You can then select the device driver to use for the scan and commence scanning the page. You can continue scanning as many pages as you want and they will load in one below the other. Just let Acrobat know when you are finished. You should now save the scanned image to avoid having to rescan if your computer crashes during the following process.

To convert the text in your scanned image from a picture of the text into actual text (and hence reduce the size of the resultant file) is also slightly different between versions. With earlier versions you go into the tools menu and select Paper Capture then Capture Pages while with later versions you go into the Document menu and select Paper Capture then Start Capture. This will run the character recognition process and attempt to convert everything on the pages that you select into text.

Acrobat cannot do a perfect job of converting your text so anything it cannot properly identify will be left as a graphic. To convert these to text you go into Paper Capture again and this time select Show Capture Suspects. This will highlight all of the sections of your document that Acrobat thinks are text but which it was unable to convert. You can then go into Paper Capture a third time and select Show First Suspect or Find First OCR Suspect (depending on which version of Acrobat that you are using) to start stepping through these one at a time to manually correct them.

You should now save your document again (which should now be much smaller).

If you want to transfer the text from your acrobat document into some other program, you can do so one page at a time by using edit then select all (or CTRL-A) followed by edit then Copy (or CTRL-C). This copies the text from the current page (without the formatting unfortunately) to the clipboard from which you can paste it into the program of your choice.


Copied from:http://www.felgall.com/dtpac1.htm

Thursday, June 28, 2007

Demobld.sql


--Demobld.sql used to create all the sample tables very frequently used in sql/plsql examples

--
-- Copyright (c) Oracle Corporation 1988, 2000. All Rights Reserved.
--
-- NAME
-- demobld.sql
--
-- DESCRIPTION
-- This script creates the SQL*Plus demonstration tables in the
-- current schema. It should be STARTed by each user wishing to
-- access the tables. To remove the tables use the demodrop.sql
-- script.
--
-- USAGE
-- From within SQL*Plus, enter:
-- START demobld.sql

SET TERMOUT ON
PROMPT Building demonstration tables. Please wait.
SET TERMOUT OFF

DROP TABLE EMP;
DROP TABLE DEPT;
DROP TABLE BONUS;
DROP TABLE SALGRADE;
DROP TABLE DUMMY;

CREATE TABLE EMP
(EMPNO NUMBER(4) NOT NULL,
ENAME VARCHAR2(10),
JOB VARCHAR2(9),
MGR NUMBER(4),
HIREDATE DATE,
SAL NUMBER(7, 2),
COMM NUMBER(7, 2),
DEPTNO NUMBER(2));

INSERT INTO EMP VALUES
(7369, 'SMITH', 'CLERK', 7902,
TO_DATE('17-DEC-1980', 'DD-MON-YYYY'), 800, NULL, 20);
INSERT INTO EMP VALUES
(7499, 'ALLEN', 'SALESMAN', 7698,
TO_DATE('20-FEB-1981', 'DD-MON-YYYY'), 1600, 300, 30);
INSERT INTO EMP VALUES
(7521, 'WARD', 'SALESMAN', 7698,
TO_DATE('22-FEB-1981', 'DD-MON-YYYY'), 1250, 500, 30);
INSERT INTO EMP VALUES
(7566, 'JONES', 'MANAGER', 7839,
TO_DATE('2-APR-1981', 'DD-MON-YYYY'), 2975, NULL, 20);
INSERT INTO EMP VALUES
(7654, 'MARTIN', 'SALESMAN', 7698,
TO_DATE('28-SEP-1981', 'DD-MON-YYYY'), 1250, 1400, 30);
INSERT INTO EMP VALUES
(7698, 'BLAKE', 'MANAGER', 7839,
TO_DATE('1-MAY-1981', 'DD-MON-YYYY'), 2850, NULL, 30);
INSERT INTO EMP VALUES
(7782, 'CLARK', 'MANAGER', 7839,
TO_DATE('9-JUN-1981', 'DD-MON-YYYY'), 2450, NULL, 10);
INSERT INTO EMP VALUES
(7788, 'SCOTT', 'ANALYST', 7566,
TO_DATE('09-DEC-1982', 'DD-MON-YYYY'), 3000, NULL, 20);
INSERT INTO EMP VALUES
(7839, 'KING', 'PRESIDENT', NULL,
TO_DATE('17-NOV-1981', 'DD-MON-YYYY'), 5000, NULL, 10);
INSERT INTO EMP VALUES
(7844, 'TURNER', 'SALESMAN', 7698,
TO_DATE('8-SEP-1981', 'DD-MON-YYYY'), 1500, 0, 30);
INSERT INTO EMP VALUES
(7876, 'ADAMS', 'CLERK', 7788,
TO_DATE('12-JAN-1983', 'DD-MON-YYYY'), 1100, NULL, 20);
INSERT INTO EMP VALUES
(7900, 'JAMES', 'CLERK', 7698,
TO_DATE('3-DEC-1981', 'DD-MON-YYYY'), 950, NULL, 30);
INSERT INTO EMP VALUES
(7902, 'FORD', 'ANALYST', 7566,
TO_DATE('3-DEC-1981', 'DD-MON-YYYY'), 3000, NULL, 20);
INSERT INTO EMP VALUES
(7934, 'MILLER', 'CLERK', 7782,
TO_DATE('23-JAN-1982', 'DD-MON-YYYY'), 1300, NULL, 10);

CREATE TABLE DEPT
(DEPTNO NUMBER(2),
DNAME VARCHAR2(14),
LOC VARCHAR2(13) );

INSERT INTO DEPT VALUES (10, 'ACCOUNTING', 'NEW YORK');
INSERT INTO DEPT VALUES (20, 'RESEARCH', 'DALLAS');
INSERT INTO DEPT VALUES (30, 'SALES', 'CHICAGO');
INSERT INTO DEPT VALUES (40, 'OPERATIONS', 'BOSTON');

CREATE TABLE BONUS
(ENAME VARCHAR2(10),
JOB VARCHAR2(9),
SAL NUMBER,
COMM NUMBER);

CREATE TABLE SALGRADE
(GRADE NUMBER,
LOSAL NUMBER,
HISAL NUMBER);

INSERT INTO SALGRADE VALUES (1, 700, 1200);
INSERT INTO SALGRADE VALUES (2, 1201, 1400);
INSERT INTO SALGRADE VALUES (3, 1401, 2000);
INSERT INTO SALGRADE VALUES (4, 2001, 3000);
INSERT INTO SALGRADE VALUES (5, 3001, 9999);

CREATE TABLE DUMMY
(DUMMY NUMBER);

INSERT INTO DUMMY VALUES (0);

COMMIT;

SET TERMOUT ON
PROMPT Demonstration table build is complete.

EXIT