Plz help iam new to java

hi,
i have a requirement where in i must print dates between two given dates.
strFromDate and strToDate are the two input dates and i must print all the list of dates between them.
Below is the code i have written.but its not working pls suggest.thanx in advance.
int year=Integer.parseInt(strFromDate.substring(0,4));
int month=Integer.parseInt(strFromDate.substring(5,7));
int day=Integer.parseInt(strFromDate.substring(8,10));
Calendar cal = Calendar.getInstance();
cal.set(year,(month-1),day);
String formatString = "yyyy-MM-dd";
SimpleDateFormat sdf = new SimpleDateFormat(formatString);
String previousDate = sdf.format(cal.getTime());
String between="";
int i=1;
do{
     cal.add(Calendar.DAY_OF_MONTH, +i);
     between = sdf.format(cal.getTime());
     out.println("Dates=="+between);
     int year1=Integer.parseInt(between.substring(0,4));
     int month1=Integer.parseInt(between.substring(5,7));
     int day1=Integer.parseInt(between.substring(8,10));
     cal.set(year1,(month1-1),day1);
     between=sdf.format(cal.getTime());
     i++;
}while(strToDate.equals(between));

First of all i am sorry for not following the rules.Now coming to my prob, i have written my code in a jsp.My intention is to print list of dates between two given dates.I have used Calendar.add method for incrementing the starting date.
My code is
String strFromDate="2008-02-01",strToDate="2008-02-07",strBetween="";
int i=1;
int year=Integer.parseInt(strFromDate.substring(0,4));
int month=Integer.parseInt(strFromDate.substring(5,7));
int day=Integer.parseInt(strFromDate.substring(8,10));
Calendar cal = Calendar.getInstance();
cal.set(year,(month-1),day);
String formatString = "yyyy-MM-dd";
SimpleDateFormat sdf = new SimpleDateFormat(formatString);
do{
     cal.add(Calendar.DAY_OF_MONTH, +i);
     strBetween= = sdf.format(cal.getTime());
     out.println("BetweenDate="+strBetween);
     int byear=Integer.parseInt(strBetween.substring(0,4));
     int bmonth=Integer.parseInt(strBetween.substring(5,7));
     int bday=Integer.parseInt(strBetween.substring(8,10));
     cal.set(byear,(bmonth-1),bday);
     strBetween=sdf.format(cal.getTime());
     i++;
}while(strToDate.equals(strBetween));Edited by: anu_avadutha on Feb 26, 2008 9:44 PM

Similar Messages

  • Plz help Either new idea nor tune this query

    Hi,
    I had two queries like below(1 &2).And As per my requirement i need to merge two queries to as one query and i wrote that one using decode(please see Resulted query3).But it's taking too much time .PLease help to tune the
    3rd query or suggest me a new idea.
    1)
    select ts.institution_id,tsd.test_alias,count(1) from test_detail td,test_session_detail tsd,test_session ts where td.test_detail_id=tsd.test_detail_id and tsd.test_session_id=ts.test_session_id and TRUNC(test_start_date) BETWEEN to_date('02/01/2009', 'MM/DD/YYYY') AND to_date('08/04/2009', 'MM/DD/YYYY') group by ts.institution_id,tsd.test_alias
    2)
    select a.INST_SITE_ID, a.INSTITUTION_ID_DISPLAY, a.institution_name, a.SITE_ID_DISPLAY, a.site_name, a.region_name,CASE WHEN a.state_name = 'Other' THEN a.OTHER ELSE a.state_name END state_name from vueinstitutionsite a,(select distinct institution_id from test_session a,test_session_detail b where a.test_session_id=b.test_session_id and trunc(test_start_date) between to_date('08/01/2009','MM/DD/YYYY') and to_date('08/04/2009','MM/DD/YYYY'))b where a.inst_site_id=b.institution_id order by a.INSTITUTION_ID_DISPLAY
    Resulted query
    *3)*
    SELECT max(a.institution_id_display)institution_id
    ,max(a.institution_name)institution_name,max(a.site_id_display)site_id,
    max(a.site_name)site_name,max(a.region_name)region_name,
    count(decode(tsd.test_alias,'rd',tsd.test_alias))rd,
    count(decode(tsd.test_alias,'ss',tsd.test_alias))ss,
    count(decode(tsd.test_alias,'resk',tsd.test_alias))resk,
    count(decode(tsd.test_alias,'snmn',tsd.test_alias))snmn,
    count(decode(tsd.test_alias,'clm',tsd.test_alias))clm,
    count(decode(tsd.test_alias,'lgus',tsd.test_alias))lgus,
    count(decode(tsd.test_alias,'loeplis',tsd.test_alias))loeplis,
    count(decode(tsd.test_alias,'arit',tsd.test_alias))arit,
    count(decode(tsd.test_alias,'alge',tsd.test_alias))alge,
    count(decode(tsd.test_alias,'wp_i3',tsd.test_alias))wp_i3,
    count(decode(tsd.test_alias,'wp_esl',tsd.test_alias))wp_esl,
    count(decode(tsd.test_alias,'css',tsd.test_alias))css,
    count(decode(tsd.test_alias,'crd',tsd.test_alias))crd,
    count(decode(tsd.test_alias,'carit',tsd.test_alias))carit,
    count(decode(tsd.test_alias,'calge',tsd.test_alias))calge,
    count(decode(tsd.test_alias,'cclm',tsd.test_alias))cclm,
    count(decode(tsd.test_alias,'cresk',tsd.test_alias))cresk,
    count(decode(tsd.test_alias,'csnmn',tsd.test_alias))csnmn,
    count(decode(tsd.test_alias,'clgus',tsd.test_alias))clgus,
    count(decode(tsd.test_alias,'csp',tsd.test_alias))csp,
    count(decode(tsd.test_alias,'cspb',tsd.test_alias))cspb,
    count(decode(tsd.test_alias,'localtest',tsd.test_alias))localtest
    FROM test_detail td,test_session_detail tsd,test_session ts,vueinstitutionsite a
    WHERE td.test_detail_id = tsd.test_detail_id
    AND tsd.test_session_id = ts.test_session_id
    and a.inst_site_id = ts.institution_id
    AND TRUNC(test_start_date) BETWEEN to_date('08/27/2009', 'MM/DD/YYYY') AND to_date('09/02/2009', 'MM/DD/YYYY')
    GROUP BY ts.institution_id
    order by institution_id
    Plz help me ASAP
    thanks,
    Raj

    I'm posting DDL scripts as a two posts due to maximum exceeding length
    *5 tables are in Underlying view*
    1)INSTITUTION
      CREATE TABLE "CATTEMP"."INSTITUTION"
       (     "INSTITUTION_ID" NUMBER NOT NULL ENABLE,
         "LEVEL_TYPE_ID" NUMBER NOT NULL ENABLE,
         "REGION_CODE" VARCHAR2(4 BYTE) NOT NULL ENABLE,
         "BELONGS_TO" NUMBER NOT NULL ENABLE,
         "NAME" VARCHAR2(200 BYTE) NOT NULL ENABLE,
         "DESCRIPTION" VARCHAR2(200 BYTE),
         "ADDRESS_1" VARCHAR2(100 BYTE),
         "ADDRESS_2" VARCHAR2(100 BYTE),
         "CITY" VARCHAR2(30 BYTE),
         "STATE" VARCHAR2(30 BYTE),
         "ZIP" VARCHAR2(20 BYTE),
         "COUNTRY" VARCHAR2(30 BYTE),
         "LOCATION" VARCHAR2(30 BYTE),
         "PHONE" VARCHAR2(20 BYTE),
         "FAX" VARCHAR2(20 BYTE),
         "OTHER" VARCHAR2(30 BYTE),
         "INSTITUTION_CATEGORY" VARCHAR2(100 BYTE),
         "INSTITUTION_TYPE" VARCHAR2(30 BYTE),
         "IS_CB_MEMBER" CHAR(1 BYTE),
         "ATB_TESTING" CHAR(1 BYTE),
         "HOW_DID_YOU_HEAR" VARCHAR2(100 BYTE),
         "FIRST_LOGIN_DATE" DATE,
         "ACTIVE_STATUS" VARCHAR2(20 BYTE),
         "AVAILABLE_TEST_UNITS" NUMBER,
         "STUDENT_BODY_SIZE" VARCHAR2(30 BYTE),
         "CREATED_ON" DATE DEFAULT SYSDATE,
         "MODIFIED_ON" DATE DEFAULT SYSDATE,
         "CREATED_BY" NUMBER,
         "MODIFIED_BY" NUMBER,
         "ACCUPLACER_USER" CHAR(1 BYTE),
         "RESEND_MAIL_DATE" DATE,
         "LAST_ACTIVITY_DATE" DATE,
         "ACCT_ACTIVATION_DATE" DATE,
         "INSTITUTION_ID_DISPLAY" VARCHAR2(10 BYTE),
         "LAST_CB_UPDATE" DATE,
          CONSTRAINT "PK_INSTITUTION" PRIMARY KEY ("INSTITUTION_ID")
      USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255
      STORAGE(
      BUFFER_POOL DEFAULT) LOCAL
    (PARTITION "SYS_P8001"
       TABLESPACE "CAT_IDX_TB1",
    PARTITION "SYS_P8002"
       TABLESPACE "CAT_IDX_TB2",
    PARTITION "SYS_P8003"
       TABLESPACE "CAT_IDX_TB3",
    PARTITION "SYS_P8004"
       TABLESPACE "CAT_IDX_TB4",
    PARTITION "SYS_P8005"
       TABLESPACE "CAT_IDX_TB5")  ENABLE,
          CONSTRAINT "UK_INSTITUTION" UNIQUE ("INSTITUTION_ID_DISPLAY")
      USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS
      STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
      TABLESPACE "CAT"  ENABLE,
          CONSTRAINT "FK_INSTITUTION1" FOREIGN KEY ("LEVEL_TYPE_ID")
           REFERENCES "CATTEMP"."LEVEL_TYPE_MASTER" ("LEVEL_TYPE_ID") ENABLE,
          CONSTRAINT "FK_INSTITUTION2" FOREIGN KEY ("REGION_CODE")
           REFERENCES "CATTEMP"."REGION" ("REGION_CODE") ENABLE,
          CONSTRAINT "FK_INSTITUTION3" FOREIGN KEY ("BELONGS_TO")
           REFERENCES "CATTEMP"."INSTITUTION" ("INSTITUTION_ID") ENABLE
       ) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255
      STORAGE(
      BUFFER_POOL DEFAULT)
      TABLESPACE "CAT_DATA"
      PARTITION BY HASH ("INSTITUTION_ID")
    (PARTITION "SYS_P8001"
       TABLESPACE "CAT_DATA",
    PARTITION "SYS_P8002"
       TABLESPACE "CAT_DATA",
    PARTITION "SYS_P8003"
       TABLESPACE "CAT_DATA",
    PARTITION "SYS_P8004"
       TABLESPACE "CAT_DATA",
    PARTITION "SYS_P8005"
       TABLESPACE "CAT_DATA") ;
       COMMENT ON COLUMN "CATTEMP"."INSTITUTION"."LEVEL_TYPE_ID" IS 'IDENTIFIES WHETHER THIS IS AN INSTITUTION OR SITE';
       COMMENT ON COLUMN "CATTEMP"."INSTITUTION"."REGION_CODE" IS 'REGION TO WHICH THE INSTITUTION BELONGS TO';
       COMMENT ON COLUMN "CATTEMP"."INSTITUTION"."PHONE" IS 'PHONE NUMBER';
       COMMENT ON COLUMN "CATTEMP"."INSTITUTION"."FAX" IS 'FAX NUMBER';
       COMMENT ON COLUMN "CATTEMP"."INSTITUTION"."HOW_DID_YOU_HEAR" IS 'HOW DID YOU HEAR INFORMATION';
       COMMENT ON COLUMN "CATTEMP"."INSTITUTION"."FIRST_LOGIN_DATE" IS 'USED TO FIND FIRST LOGIN DATE INFORMATION';
       COMMENT ON COLUMN "CATTEMP"."INSTITUTION"."ACTIVE_STATUS" IS 'CURRENT ACTIVATION STATUS';
       COMMENT ON COLUMN "CATTEMP"."INSTITUTION"."AVAILABLE_TEST_UNITS" IS 'AVAILABLE TEST UNITS WITH THE INSITUTION';
       COMMENT ON COLUMN "CATTEMP"."INSTITUTION"."STUDENT_BODY_SIZE" IS 'STUDENT SIZE UNDER THE INSTITUTION';
       COMMENT ON COLUMN "CATTEMP"."INSTITUTION"."CREATED_ON" IS 'INSITUTION CREATION DATE';
       COMMENT ON COLUMN "CATTEMP"."INSTITUTION"."MODIFIED_ON" IS 'LAST MODIFIED DATE';
       COMMENT ON TABLE "CATTEMP"."INSTITUTION"  IS 'USED TO STORE THE DETAILS OF AN INSTITUTE (INSTITUTION, SITE)';
      CREATE INDEX "CATTEMP"."FK_INSTITUTION1_I" ON "CATTEMP"."INSTITUTION" ("LEVEL_TYPE_ID")
      PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS
      STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
      TABLESPACE "CAT" ;
      CREATE INDEX "CATTEMP"."FK_INSTITUTION2_I" ON "CATTEMP"."INSTITUTION" ("REGION_CODE")
      PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS
      STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
      TABLESPACE "CAT" ;
      CREATE INDEX "CATTEMP"."INSTITUTION_IDX1" ON "CATTEMP"."INSTITUTION" ("BELONGS_TO", "LEVEL_TYPE_ID", "ACTIVE_STATUS")
      PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS
      STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
      TABLESPACE "CAT" ;
      CREATE INDEX "CATTEMP"."INSTI_ID_NAME_COUN_DISP_IDX" ON "CATTEMP"."INSTITUTION" ("INSTITUTION_ID", "NAME", "COUNTRY", "INSTITUTION_ID_DISPLAY")
      PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS
      STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
      TABLESPACE "CAT_DATA" ;
      CREATE INDEX "CATTEMP"."INSTUTITION_NC_IDX" ON "CATTEMP"."INSTITUTION" ("NAME")
      PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS
      STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
      TABLESPACE "CAT_DATA" ;
      CREATE INDEX "CATTEMP"."INST_ID_DISP_IDX" ON "CATTEMP"."INSTITUTION" (SUBSTR("INSTITUTION_ID_DISPLAY",8,3))
      PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS
      STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
      TABLESPACE "CAT_DATA" ;
      CREATE UNIQUE INDEX "CATTEMP"."PK_INSTITUTION" ON "CATTEMP"."INSTITUTION" ("INSTITUTION_ID")
      PCTFREE 10 INITRANS 2 MAXTRANS 255
      STORAGE(
      BUFFER_POOL DEFAULT) LOCAL
    (PARTITION "SYS_P8001"
       TABLESPACE "CAT_IDX_TB1",
    PARTITION "SYS_P8002"
       TABLESPACE "CAT_IDX_TB2",
    PARTITION "SYS_P8003"
       TABLESPACE "CAT_IDX_TB3",
    PARTITION "SYS_P8004"
       TABLESPACE "CAT_IDX_TB4",
    PARTITION "SYS_P8005"
       TABLESPACE "CAT_IDX_TB5") ;
      CREATE UNIQUE INDEX "CATTEMP"."UK_INSTITUTION" ON "CATTEMP"."INSTITUTION" ("INSTITUTION_ID_DISPLAY")
      PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS
      STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
      TABLESPACE "CAT" ;2)COUNTRY
      CREATE TABLE "CATTEMP"."COUNTRY"
       (     "COUNTRY_CODE" VARCHAR2(10 BYTE) NOT NULL ENABLE,
         "COUNTRY_NAME" VARCHAR2(30 BYTE),
         "CREATED_ON" DATE DEFAULT SYSDATE,
         "MODIFIED_ON" DATE DEFAULT SYSDATE,
         "CREATED_BY" NUMBER,
         "MODIFIED_BY" NUMBER,
          CONSTRAINT "PK_COUNTRY" PRIMARY KEY ("COUNTRY_CODE")
      USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255
      STORAGE(
      BUFFER_POOL DEFAULT) LOCAL
    (PARTITION "SYS_P7936"
       TABLESPACE "CAT_IDX_TB1",
    PARTITION "SYS_P7937"
       TABLESPACE "CAT_IDX_TB2",
    PARTITION "SYS_P7938"
       TABLESPACE "CAT_IDX_TB3",
    PARTITION "SYS_P7939"
       TABLESPACE "CAT_IDX_TB4",
    PARTITION "SYS_P7940"
       TABLESPACE "CAT_IDX_TB5")  ENABLE,
          CONSTRAINT "UK_COUNTRY" UNIQUE ("COUNTRY_NAME")
      USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS
      STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
      TABLESPACE "CAT"  ENABLE
       ) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255
      STORAGE(
      BUFFER_POOL DEFAULT)
      TABLESPACE "CAT_DATA"
      PARTITION BY HASH ("COUNTRY_CODE")
    (PARTITION "SYS_P7936"
       TABLESPACE "CAT_DATA",
    PARTITION "SYS_P7937"
       TABLESPACE "CAT_DATA",
    PARTITION "SYS_P7938"
       TABLESPACE "CAT_DATA",
    PARTITION "SYS_P7939"
       TABLESPACE "CAT_DATA",
    PARTITION "SYS_P7940"
       TABLESPACE "CAT_DATA") ;
      CREATE UNIQUE INDEX "CATTEMP"."PK_COUNTRY" ON "CATTEMP"."COUNTRY" ("COUNTRY_CODE")
      PCTFREE 10 INITRANS 2 MAXTRANS 255
      STORAGE(
      BUFFER_POOL DEFAULT) LOCAL
    (PARTITION "SYS_P7936"
       TABLESPACE "CAT_IDX_TB1",
    PARTITION "SYS_P7937"
       TABLESPACE "CAT_IDX_TB2",
    PARTITION "SYS_P7938"
       TABLESPACE "CAT_IDX_TB3",
    PARTITION "SYS_P7939"
       TABLESPACE "CAT_IDX_TB4",
    PARTITION "SYS_P7940"
       TABLESPACE "CAT_IDX_TB5") ;
      CREATE UNIQUE INDEX "CATTEMP"."UK_COUNTRY" ON "CATTEMP"."COUNTRY" ("COUNTRY_NAME")
      PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS
      STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
      TABLESPACE "CAT" ;
    3)REGION
      CREATE TABLE "CATTEMP"."REGION"
       (     "REGION_CODE" VARCHAR2(4 BYTE) NOT NULL ENABLE,
         "REGION_NAME" VARCHAR2(50 BYTE) NOT NULL ENABLE,
         "CREATED_ON" DATE DEFAULT SYSDATE,
         "MODIFIED_ON" DATE DEFAULT SYSDATE,
         "CREATED_BY" NUMBER,
         "MODIFIED_BY" NUMBER,
          CONSTRAINT "PK_REGION" PRIMARY KEY ("REGION_CODE")
      USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255
      STORAGE(
      BUFFER_POOL DEFAULT) LOCAL
    (PARTITION "SYS_P8101"
       TABLESPACE "CAT_IDX_TB1",
    PARTITION "SYS_P8102"
       TABLESPACE "CAT_IDX_TB2",
    PARTITION "SYS_P8103"
       TABLESPACE "CAT_IDX_TB3",
    PARTITION "SYS_P8104"
       TABLESPACE "CAT_IDX_TB4",
    PARTITION "SYS_P8105"
       TABLESPACE "CAT_IDX_TB5")  ENABLE,
          CONSTRAINT "UK_REGION" UNIQUE ("REGION_NAME")
      USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS
      STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
      TABLESPACE "CAT"  ENABLE
       ) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255
      STORAGE(
      BUFFER_POOL DEFAULT)
      TABLESPACE "CAT_DATA"
      PARTITION BY HASH ("REGION_CODE")
    (PARTITION "SYS_P8101"
       TABLESPACE "CAT_DATA",
    PARTITION "SYS_P8102"
       TABLESPACE "CAT_DATA",
    PARTITION "SYS_P8103"
       TABLESPACE "CAT_DATA",
    PARTITION "SYS_P8104"
       TABLESPACE "CAT_DATA",
    PARTITION "SYS_P8105"
       TABLESPACE "CAT_DATA") ;
      CREATE UNIQUE INDEX "CATTEMP"."PK_REGION" ON "CATTEMP"."REGION" ("REGION_CODE")
      PCTFREE 10 INITRANS 2 MAXTRANS 255
      STORAGE(
      BUFFER_POOL DEFAULT) LOCAL
    (PARTITION "SYS_P8101"
       TABLESPACE "CAT_IDX_TB1",
    PARTITION "SYS_P8102"
       TABLESPACE "CAT_IDX_TB2",
    PARTITION "SYS_P8103"
       TABLESPACE "CAT_IDX_TB3",
    PARTITION "SYS_P8104"
       TABLESPACE "CAT_IDX_TB4",
    PARTITION "SYS_P8105"
       TABLESPACE "CAT_IDX_TB5") ;
      CREATE UNIQUE INDEX "CATTEMP"."UK_REGION" ON "CATTEMP"."REGION" ("REGION_NAME")
      PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS
      STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
      TABLESPACE "CAT" ;
    4)
    LEVEL_TYPE_MASTER
      CREATE TABLE "CATTEMP"."LEVEL_TYPE_MASTER"
       (     "LEVEL_TYPE_ID" NUMBER NOT NULL ENABLE,
         "LEVEL_TYPE_NAME" VARCHAR2(50 BYTE) NOT NULL ENABLE,
         "DESCRIPTION" VARCHAR2(100 BYTE),
         "CREATED_ON" DATE DEFAULT SYSDATE,
         "MODIFIED_ON" DATE DEFAULT SYSDATE,
         "CREATED_BY" NUMBER,
         "MODIFIED_BY" NUMBER,
          CONSTRAINT "PK_LEVEL_TYPE_MASTER" PRIMARY KEY ("LEVEL_TYPE_ID")
      USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255
      STORAGE(
      BUFFER_POOL DEFAULT) LOCAL
    (PARTITION "SYS_P8031"
       TABLESPACE "CAT_IDX_TB1",
    PARTITION "SYS_P8032"
       TABLESPACE "CAT_IDX_TB2",
    PARTITION "SYS_P8033"
       TABLESPACE "CAT_IDX_TB3",
    PARTITION "SYS_P8034"
       TABLESPACE "CAT_IDX_TB4",
    PARTITION "SYS_P8035"
       TABLESPACE "CAT_IDX_TB5")  ENABLE,
          CONSTRAINT "UK_LEVEL_TYPE_MASTER" UNIQUE ("LEVEL_TYPE_NAME")
      USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS
      STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
      TABLESPACE "CAT"  ENABLE
       ) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255
      STORAGE(
      BUFFER_POOL DEFAULT)
      TABLESPACE "CAT_DATA"
      PARTITION BY HASH ("LEVEL_TYPE_ID")
    (PARTITION "SYS_P8031"
       TABLESPACE "CAT_DATA",
    PARTITION "SYS_P8032"
       TABLESPACE "CAT_DATA",
    PARTITION "SYS_P8033"
       TABLESPACE "CAT_DATA",
    PARTITION "SYS_P8034"
       TABLESPACE "CAT_DATA",
    PARTITION "SYS_P8035"
       TABLESPACE "CAT_DATA") ;
      CREATE UNIQUE INDEX "CATTEMP"."PK_LEVEL_TYPE_MASTER" ON "CATTEMP"."LEVEL_TYPE_MASTER" ("LEVEL_TYPE_ID")
      PCTFREE 10 INITRANS 2 MAXTRANS 255
      STORAGE(
      BUFFER_POOL DEFAULT) LOCAL
    (PARTITION "SYS_P8031"
       TABLESPACE "CAT_IDX_TB1",
    PARTITION "SYS_P8032"
       TABLESPACE "CAT_IDX_TB2",
    PARTITION "SYS_P8033"
       TABLESPACE "CAT_IDX_TB3",
    PARTITION "SYS_P8034"
       TABLESPACE "CAT_IDX_TB4",
    PARTITION "SYS_P8035"
       TABLESPACE "CAT_IDX_TB5") ;
      CREATE UNIQUE INDEX "CATTEMP"."UK_LEVEL_TYPE_MASTER" ON "CATTEMP"."LEVEL_TYPE_MASTER" ("LEVEL_TYPE_NAME")
      PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS
      STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
      TABLESPACE "CAT" ;
    5)STATE
    CREATE TABLE "CATTEMP"."STATE"
    (     "STATE_NAME" VARCHAR2(30 BYTE) NOT NULL ENABLE,
         "STATE_CODE" VARCHAR2(10 BYTE),
         "COUNTRY_CODE" VARCHAR2(10 BYTE) NOT NULL ENABLE,
         "REGION_CODE" VARCHAR2(4 BYTE),
         "CREATED_ON" DATE DEFAULT SYSDATE,
         "MODIFIED_ON" DATE DEFAULT SYSDATE,
         "CREATED_BY" NUMBER,
         "MODIFIED_BY" NUMBER,
         CONSTRAINT "PK_STATE" PRIMARY KEY ("STATE_NAME", "COUNTRY_CODE")
    USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255
    STORAGE(
    BUFFER_POOL DEFAULT) LOCAL
    (PARTITION "SYS_P8131"
    TABLESPACE "CAT_IDX_TB1",
    PARTITION "SYS_P8132"
    TABLESPACE "CAT_IDX_TB2",
    PARTITION "SYS_P8133"
    TABLESPACE "CAT_IDX_TB3",
    PARTITION "SYS_P8134"
    TABLESPACE "CAT_IDX_TB4",
    PARTITION "SYS_P8135"
    TABLESPACE "CAT_IDX_TB5") ENABLE,
         CONSTRAINT "UK_STATE" UNIQUE ("STATE_CODE")
    USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS
    STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
    PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
    TABLESPACE "CAT" ENABLE,
         CONSTRAINT "FK_STATE1" FOREIGN KEY ("COUNTRY_CODE")
         REFERENCES "CATTEMP"."COUNTRY" ("COUNTRY_CODE") ENABLE,
         CONSTRAINT "FK_STATE2" FOREIGN KEY ("REGION_CODE")
         REFERENCES "CATTEMP"."REGION" ("REGION_CODE") ENABLE
    ) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255
    STORAGE(
    BUFFER_POOL DEFAULT)
    TABLESPACE "CAT_DATA"
    PARTITION BY HASH ("STATE_NAME","COUNTRY_CODE")
    (PARTITION "SYS_P8131"
    TABLESPACE "CAT_DATA",
    PARTITION "SYS_P8132"
    TABLESPACE "CAT_DATA",
    PARTITION "SYS_P8133"
    TABLESPACE "CAT_DATA",
    PARTITION "SYS_P8134"
    TABLESPACE "CAT_DATA",
    PARTITION "SYS_P8135"
    TABLESPACE "CAT_DATA") ;
    CREATE INDEX "CATTEMP"."FK_STATE1_I" ON "CATTEMP"."STATE" ("COUNTRY_CODE")
    PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS
    STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
    PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
    TABLESPACE "CAT" ;
    CREATE INDEX "CATTEMP"."FK_STATE2_I" ON "CATTEMP"."STATE" ("REGION_CODE")
    PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS
    STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
    PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
    TABLESPACE "CAT" ;
    CREATE UNIQUE INDEX "CATTEMP"."PK_STATE" ON "CATTEMP"."STATE" ("STATE_NAME", "COUNTRY_CODE")
    PCTFREE 10 INITRANS 2 MAXTRANS 255
    STORAGE(
    BUFFER_POOL DEFAULT) LOCAL
    (PARTITION "SYS_P8131"
    TABLESPACE "CAT_IDX_TB1",
    PARTITION "SYS_P8132"
    TABLESPACE "CAT_IDX_TB2",
    PARTITION "SYS_P8133"
    TABLESPACE "CAT_IDX_TB3",
    PARTITION "SYS_P8134"
    TABLESPACE "CAT_IDX_TB4",
    PARTITION "SYS_P8135"
    TABLESPACE "CAT_IDX_TB5") ;
    CREATE INDEX "CATTEMP"."STATE_NAME_CODE_IDX" ON "CATTEMP"."STATE" ("STATE_NAME", "STATE_CODE")
    PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS
    STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
    PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
    TABLESPACE "CAT_DATA" ;
    CREATE INDEX "CATTEMP"."STATE_NAME_STATE_IDX" ON "CATTEMP"."STATE" ("STATE_NAME")
    PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS
    STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
    PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
    TABLESPACE "CAT_DATA" ;
    CREATE UNIQUE INDEX "CATTEMP"."UK_STATE" ON "CATTEMP"."STATE" ("STATE_CODE")
    PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS
    STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
    PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
    TABLESPACE "CAT" ;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Help needed, new to java programming

    hi,
    I have craeted a Frame with some check boxes and button called "button1".
    Can anyone tell me how can i count the number of CHECKED check boxes so that when i press the button1 in my code it should display the result as number of checked check boxes divided by total number of check boxes. It should display the result in a textfield here RESULT textfield in my code
    Thanks in advance ...i am sending the code i have written so far....
    public class Frame extends java.awt.Frame {
        /** Creates new form Frame */
        public Frame() {
            initComponents();
            setSize(600, 600);
        /** This method is called from within the constructor to
         * initialize the form.
         * WARNING: Do NOT modify this code. The content of this method is
         * always regenerated by the Form Editor.
        private void initComponents() {
            buttonGroup1 = new javax.swing.ButtonGroup();
            checkbox1 = new java.awt.Checkbox();
            checkbox2 = new java.awt.Checkbox();
            checkbox3 = new java.awt.Checkbox();
            button1 = new java.awt.Button();
            textField1 = new java.awt.TextField();
            setLayout(null);
            addWindowListener(new java.awt.event.WindowAdapter() {
                public void windowClosing(java.awt.event.WindowEvent evt) {
                    exitForm(evt);
            checkbox1.setLabel("checkbox1");
            add(checkbox1);
            checkbox1.setBounds(160, 50, 84, 20);
            checkbox2.setLabel("checkbox2");
            add(checkbox2);
            checkbox2.setBounds(160, 70, 84, 20);
            checkbox3.setLabel("checkbox3");
            add(checkbox3);
            checkbox3.setBounds(160, 90, 84, 20);
            button1.setLabel("button1");
            button1.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    button1ActionPerformed(evt);
            add(button1);
            button1.setBounds(150, 180, 57, 24);
            textField1.setText("Result");
            textField1.setName("Result");
            add(textField1);
            textField1.setBounds(260, 180, 44, 20);
            pack();
        private void button1ActionPerformed(java.awt.event.ActionEvent evt) {
            // Add your handling code here:
        /** Exit the Application */
        private void exitForm(java.awt.event.WindowEvent evt) {
            System.exit(0);
         * @param args the command line arguments
        public static void main(String args[]) {
            new Frame().show();
        // Variables declaration - do not modify
        private java.awt.Button button1;
        private javax.swing.ButtonGroup buttonGroup1;
        private java.awt.Checkbox checkbox1;
        private java.awt.Checkbox checkbox2;
        private java.awt.Checkbox checkbox3;
        private java.awt.TextField textField1;
        // End of variables declaration
    }

    Two problems in the code you repost-ed:
    1. It lacks import statements.
    2. There is an extraneous } at the end of the button1ActionPerformed method.
    Correct them and it'll work fine. Posting the full source code:
    import java.awt.Component;
    import java.awt.Checkbox;
    public class Frame extends java.awt.Frame
         /** Creates new form Frame */
         public Frame()
              initComponents();
          * This method is called from within the constructor to initialize the form.
          * WARNING: Do NOT modify this code. The content of this method is always
          * regenerated by the Form Editor.
         private void initComponents()
              checkbox1 = new java.awt.Checkbox();
              checkbox2 = new java.awt.Checkbox();
              checkbox3 = new java.awt.Checkbox();
              button1 = new java.awt.Button();
              textField1 = new java.awt.TextField();
              setLayout( null );
              addWindowListener( new java.awt.event.WindowAdapter()
                   public void windowClosing( java.awt.event.WindowEvent evt )
                        exitForm( evt );
              checkbox1.setLabel( "checkbox1" );
              add( checkbox1 );
              checkbox1.setBounds( 120, 40, 84, 20 );
              checkbox2.setLabel( "checkbox2" );
              add( checkbox2 );
              checkbox2.setBounds( 120, 60, 84, 20 );
              checkbox3.setLabel( "checkbox3" );
              add( checkbox3 );
              checkbox3.setBounds( 120, 80, 84, 20 );
              button1.setLabel( "button1" );
              button1.addActionListener( new java.awt.event.ActionListener()
                   public void actionPerformed( java.awt.event.ActionEvent evt )
                        button1ActionPerformed( evt );
              add( button1 );
              button1.setBounds( 50, 170, 57, 24 );
              textField1.setText( "textField1" );
              add( textField1 );
              textField1.setBounds( 240, 170, 60, 20 );
              pack();
         private void button1ActionPerformed( java.awt.event.ActionEvent evt )
              // Add your handling code here:
              Component[] components = getComponents();
              int numOfCheckBoxes = 0;
              int numChecked = 0;
              for ( int i = 0; i < components.length; i++ )
                   if ( components[i] instanceof Checkbox )
                        numOfCheckBoxes++;
                        Checkbox checkBox = (Checkbox) components;
                        if ( checkBox.getState() )
                             numChecked++;
              double ratio = (double) numChecked / (double) numOfCheckBoxes;
              textField1.setText( Double.toString( ratio ) );
         /** Exit the Application */
         private void exitForm( java.awt.event.WindowEvent evt )
              System.exit( 0 );
         * @param args the command line arguments
         public static void main( String args[] )
              new Frame().show();
         // Variables declaration - do not modify
         private java.awt.Button button1;
         private java.awt.Checkbox checkbox1;
         private java.awt.Checkbox checkbox2;
         private java.awt.Checkbox checkbox3;
         private java.awt.TextField textField1;
         // End of variables declaration
    I can see from the code that the GUI was generated by a tool. Since you're new to Java programming, I'd recommend ditching the tool and writing everything by hand, otherwise you're not learning much. It's just like when you're learning proofs in Maths, where you start with first principles before making use of the proofs on their own.
    Also, it'll help tremendously if you could spend some time going through the Java Tutorial (http://java.sun.com/docs/books/tutorial/). It's free, and I find it very useful.
    Hth.

  • Plz help me with WFTest.java

    Hii, Please can any 1 provide me with the WFTest.java file . My mail id is [email protected]
    [email protected]
    I have tried to search fro it in the specified locn of
    D:\Oracle\product\10.1.0\db_1\wf\java\oracle\apps\fnd\wf
    but the required WFTest.java file is not over there.
    So please do mail me the file as soon as possible
    Thanks & Regards
    Prashant Neeraj

    Thnx Vijay. The WFTest.class is present in the wfapi.jar which is in the jlib diectory . Thnx i have found the class file and using the dcompiler i have got the WFTest.java
    Thnx for u'r help and support. Can i ave u'r personal mail id so that in case of any immediate help i could contact u directly. I am a fresher and just started working on Oracle Workflow. Take care
    Thanks & Regards
    Prashant Neeraj

  • Hi iam new to java can u tell me  how to convert from hashmap to string

    how to convert from hashmap to string

    Hi,
    This is not pure Java forum. Its more on JDBC and data connectivity to Orcle db from Java API.
    This link may answer your question:
    http://stackoverflow.com/questions/960807/hashmapkey-string-value-arraylist-returns-an-object-instead-of-arraylist
    Twinkle

  • Plz help me I'm new to java

    I've created simple data base in sql and a simple html page,here is the code:
    <%@ page import="java.util.*" import="java.sql.*" %>
    <%!
    private String emp_code, emp_name, emp_dept, emp_title, emp_doj, emp_dob;
    private String error, info, create;
    private short age;
    private Statement stmt;
    %>
    <%
    //load the JDBC driver
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    Connection conn = DriverManager.getConnection("jdbc:odbc:Master","","");
    Statement s = conn.createStatement();
    s.executeUpdate("insert into employee_info values('" + emp_code + "', '" + emp_name + "','" + emp_dept + "','" + emp_title + "', '" + emp_doj + "','" + emp_dob + "') ");
    System.out.println ("It has been successfully added");
    %>
    <HTML>
    <HEAD>
         <TITLE> ---: New Employee Information :--- </TITLE>
    </HEAD>
    <BODY>
    <DIV ALIGN="center">
         <H2> New Employee Information </H2></DIV>
    <DIV ALIGN="center">
         <p> � </p></DIV>
         <FORM METHOD = "POST" ACTION = "NewEmp.jsp">
    <H4>Employee Code: <INPUT TYPE= "text" NAME = "first1" SIZE = "17">����
    Name: <INPUT TYPE = "TEXT" NAME = "first" SIZE = "51">�������
    <font size="3">Title:�<SELECT name="Grade">
    <OPTION SELECTED> - Select -
    <OPTION >Programmer
    <OPTION >Technetion
    <OPTION>System Analyst
    <OPTION>Network Administrator
    </SELECT>�</font>
              </H4>
    <H4><font size="3">�</font>
              </H4>
    <H4><font size="3">Department Code:�</font><select name="Dept">
    <OPTION SELECTED> - Select -
    <OPTION >IT
    <OPTION >Admin
    <OPTION>MGM
    <OPTION>CSD
    <OPTION>SM
    <OPTION>FIN
    </SELECT>
    ��������
    <font size="3"><b>DOB: </b> </font> <INPUT TYPE = "TEXT" NAME = "first2" SIZE = "18">������
    <b><font size="3">DOJ: </font></b><INPUT TYPE = "TEXT" NAME = "first3" SIZE = "18">
              </H4>
    <p>�
              </p>
    <P align="center">
    <INPUT TYPE = "SUBMIT" VALUE = "Submit">     
    <INPUT TYPE = "RESET">
    <input type="button" value="Cancel" name="Cancel" onClick='javascript:window.close();'> </FORM>
    <p align="center">�</p>
    </BODY>
    </HTML>
    But I couldn't complete it or make the connection to the database, I want to fill in the blanks and then add it to the data base.
    My database name is doctrak and the table name is employee_info and below the design of the table :
    emp_code     char     10
    emp_name char     30     
    emp_dept     char     15     
    emp_title     char     10     
    emp_doj     datetime     8     
    emp_dob     datetime     8     
    I've installed the apatchi tomcat 401 and make the java environment.
    So plz can any one help me in that?
    Thanks

    But I don't know how to handel the code, I didn't
    study JSP or Java. I'm trying to learn it by doing
    this, so please can you write the code for me in jsp
    and how to put it in html then , how to do the
    connection to my database?Iam sorry to disappoint you, but no.
    If you are new to java and jsp taking up such a task to learn it is not ideal, nor
    viable. I would suggest you learn the basics of the language first, then the basics
    of jsp, then some jdbc and finally graduate to the example in question. There are
    excellent tutorials avbl for all on the net.
    Maybe someone else would even post the code here, but suggest you dont
    waste time waiting on it.
    All the best.
    Cheers,
    ram.

  • PLz Help New To Java

    Hey im brand new to java and i just downloaded and installed jdk-1_5_0_01-windows-i586-p now im tryin to set up the PATH permanently but i have no clue how to i went to the install notes and typed in C:\Program Files\Java\jdk1.5.0_<windows>\bin in the command.com but everytime i do it says access is denied. i have no clue how to set up the path permanently beside what i tried plz help!!!

    You didn't which OS you are running, but it's fairly similar for all windows.
    Start->settings->control panel->system->advanced->environment variables
    Go to System variables, click on path, click edit button and add a semicolon and the path at the end. DO NOT REPLACE EVERYTHING THAT'S THERE NOW.
    I don't have 1.5 installed on this computer, but I'm willing to bet the real path doesn't have '<windows>' in it. Use Windows Explorer to find out where java.exe actually exists on the hard disk and use that path

  • PLZ help me out i'm very new and confused to java

    Hi~
    I'm very new to java and I just brought a phone (Nokia 6670). It's capable of J2ME, as it says in the instrusction book, but I'm not so sure which Java to download. (THERE ARE SO MANY). Please help me out, I'm not sure what to do, since I'm putting games in Java.

    you want to develop your own game or just want to have some games on your new device?
    your phone has java runtime already, and that's all you need to run java games .. you can download them from several locations
    if you want to develop your own game then download Sun's J2ME Wireless Toolkit; also have a look at Nokia Developer's Suite and emulator for your device...

  • Plz help using ms access as database,i want to create a login page in java

    hye frnz... plz help me m new to java
    m using ms access as database and try to create a login page where user type username and pw
    i had enter valid user entries in database i checked connectivity is working i want as user login the main window must open after checking username and pw field to database but
    now there is an error class not found exception sun:jdbc...... error
    plz help me i had stuck frm 4 days */
    import java.sql.DriverManager;
    import java.sql.Connection;
    import java.sql.Statement;
    import java.sql.ResultSet;
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    class Login extends JFrame
    //Component Declarations
    JLabel jlb1,jlb2;
         JTextField jtf1;
         JPasswordField jpf1;
         JButton jb1,jb2;
         //Constructor
         Login()
         //frame settings
              setTitle("Login Dialog");
              setLayout(new GridBagLayout());
              GridBagConstraints gbc = new GridBagConstraints();
              setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
              Dimension d= Toolkit.getDefaultToolkit().getScreenSize();
              setBounds(d.width/2-175,d.height/2-100,350,200);
              gbc.insets=new Insets(7,7,7,7);
         //adding components
              jlb1=new JLabel("User ID");
              gbc.gridx=0;
              gbc.gridy=0;
              add(jlb1,gbc);
              jlb2=new JLabel("Password");
              gbc.gridx=0;
              gbc.gridy=1;
              add(jlb2,gbc);
              jtf1=new JTextField(10);
              gbc.gridx=1;
              gbc.gridy=0;
              add(jtf1,gbc);
              jpf1=new JPasswordField(10);
              gbc.gridx=1;
              gbc.gridy=1;
              add(jpf1,gbc);
              jb1=new JButton("Login");
              gbc.gridx=0;
              gbc.gridy=2;
              add(jb1,gbc);
              jb1.addActionListener(new ActionListener()
                   public void actionPerformed(ActionEvent ae)
                   Connection conn=null;
                        Statement stmt=null;
                        boolean found=false;
                   try
                             Class.forName("sun.jdbc.driver.JdbcOdbcDriver");
                             String dataSourceName = "Inventory";
                             String dbURL = "jdbc:odbc:" + dataSourceName;
                             conn=DriverManager.getConnection(dbURL, "","");
                             stmt=conn.createStatement();
                             ResultSet rst=stmt.executeQuery("Select * from User");
                             System.out.println(jtf1.getText()+"/t"+jpf1.getPassword());
                             while(rst.next())
                                  System.out.println( rst.getString(1) +"/t"+ rst.getString(2));
              if(jtf1.getText().equals(rst.getString(1).trim()) && new String(jpf1.getPassword()).equals(rst.getString(2).trim()))
                                       found=true;
                                       rst.close();
                                       dispose();
                                       MainWindow mw= new MainWindow();     /*created min window object created to be opend after login but not working*/     
                                       break;
                             rst.close();
                             stmt.close();
                             conn.close();                    
                        catch(ClassNotFoundException e){System.out.print(e);}
                        catch(Exception e){System.out.print(e);}
                        if(found==false) /*this portion is executing and dialog box appears invalid name and pw with class not found exception sun:jdbc.......on console */
                             JOptionPane.showMessageDialog(null,"Invalid username or password",
                                  "Error Message",JOptionPane.ERROR_MESSAGE);
              jb2=new JButton("Clear");
              gbc.gridx=1;
              gbc.gridy=2;
              add(jb2,gbc);
              jb2.addActionListener(new ActionListener()
                   public void actionPerformed(ActionEvent ae)
                        jtf1.setText("");
                        jpf1.setText("");
                        jtf1.requestFocus();
              setSize(350,200);
              setVisible(true);
              jtf1.requestFocus();
         public static void main(String args[])
    Login l=new Login();
    Edited by: 795772 on Sep 19, 2010 4:44 AM

    795772 wrote:
    hye frnz... plz help me m new to java
    m using ms access as database and try to create a login page where user type username and pw
    i had enter valid user entries in database i checked connectivity is working i want as user login the main window must open after checking username and pw field to database but
    now there is an error class not found exception sun:jdbc...... error
    plz help me i had stuck frm 4 days */
    <snip>The subject of this forum is Oracle databases. How does your problem relate to that subject?
    Two bits of advice:
    1) Make sure you ask questions in a forum related to your problem.
    2) If you want to be taken seriously as a professional, drop the MS IM Speak and use the language of the forum. In this forum it is English, which is successfully used by many people for whom English is far from their native language.

  • How can  I access my java class file in a .jar file ...PLz Help anyone!!

    Hi Folks,
    I am new in Java programming, have a .jar file that contains .java files that I want no access and use from another .java file. These files in the .jar file basically form a library thus have no main-method. However I can not declare an instance of the library (in the .jar file) and use it within my program.
    Plz help ...I have tried all I know in vain.
    Thanks.

    temba wrote:
    Hi Folks,
    I am new in Java programming, have a .jar file that contains .java files that I want no access and use from another .java file. These files in the .jar file basically form a library thus have no main-method. However I can not declare an instance of the library (in the .jar file) and use it within my program. You are making little sense. You can't instantiate .java files.
    Plz help ...I have tried all I know in vain.
    Thanks.Could you post WHAT you have tried and also post what error messages you received?

  • How to use padding scheme FIPS81 in java plz help?

    Plz refer the below code using this code I m trying to decrypt XLS file using pass phrase.
    I m using the same pass phrase which was used @ the time of encryption.
    But the problem I m facing is that the file was encrypted in DOT NET_ using padding scheme FIPS81 and there impelmentation of FIPS81 is not available in JAVA so that it gives exception at the time of decryption which is given below
    Exception : javax.crypto.BadPaddingException: Given final block not properly padded
    I urgently need the solution of this problem so somebody plz help me to find the solution of this problem.....Ur reply would be appriciated.....!!
    The File is Encrypted using below mechanism
    ALGORITHM : AES
    MODE : ECB
    PADDING SCHEME : FIPS81
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.FileOutputStream;
    import java.io.IOException;
    import java.io.UnsupportedEncodingException;
    import java.security.MessageDigest;
    import java.security.NoSuchAlgorithmException;
    import javax.crypto.*;
    import javax.crypto.spec.*;
    public class DecryptTest {
         public static void main(String[] s){
              String passPhrase = "passphrase";
              String encFileName = "encsample.xls";
              String decFileName = "decsample.xls";
              FileInputStream encFileIn = null;
              FileOutputStream decFileOut = null;
              File f = null;
              byte[] message;
              try {
                   f = new File(encFileName);
                   encFileIn = new FileInputStream(f);
                   decFileOut = new FileOutputStream(decFileName);
                   message = new byte[encFileIn.available()]; //Read the encrypted file in from disk
                   encFileIn.read(message);
                   SecretKeySpec spec = new SecretKeySpec(passwordToKey (passPhrase), "AES");
                   //decrypt it
                   Cipher c = Cipher.getInstance("AES/ECB/NoPadding");
                   c.init(Cipher.DECRYPT_MODE, spec);
                   System.out.println("Block Size is >-->" + c.getBlockSize());
                   String decryptedString = new String(c.doFinal(message));
                   System.out.println("Decrypted message: " + decryptedString);
                   //To write into another files
                   decFileOut.write(decryptedString.getBytes());
              }catch (Exception e) {
                   System.out.println(e);
              }finally {
                   try {
                        encFileIn.close();
                        decFileOut.close();     
                   } catch (IOException ioe) {
         }Is there any mechanism is available for FIPS81 or Is there any third party Provider available for it plz reply........????????

    I suggest you look in google http://www.google.co.uk/search?q=SWF+java

  • Plz help to install java plug-ins

    hi everybody,
    i am new to the world of java, i want to install java plug-ins in mozilla 1.7 on redhat linux 9.
    how to do it, plz help, thanx in advance..

    If Java was installed prior to Mozilla, it should have automatically installed.
    If not, or Mozilla was installed first, use these instructions from Mozilla:
    http://plugindoc.mozdev.org/linux.html

  • Java Mail Project HELP Required....URGENT PLZ HELP!!!

    hello there!!
    i took up a pjct for my engineering on java mail..got the code..and i thought that ill analyse it...the code is submitting the mail to the smtp server but after dat its failing to deliver to the client..as i can see this error in the logs on SMTP server...can anyone help me out in analysing this code!!!
    plz help, exams are near...(am new to java)
    //java FINAL!
    import javax.swing.*;
    import java.net.URL;
    import javax.mail.*;
    import javax.mail.internet.*;
    import java.util.*;
    import java.awt.*;
    import java.awt.event.*;
    public class EmailProg extends JPanel implements ActionListener {
    protected JTextArea textArea;
    protected String newline = "\n";
    static final private String composemail = "compose";
    static final private String sendmail = "send";
    static final private String about = "about";
    static final private String submit = "submit";
    static final private String exit = "exit";
    JLabel lSubmit = new JLabel("Submit");
    JButton subbutton = new JButton();
    JTextArea emailfrom = new JTextArea(1,1);
    JTextArea emailto = new JTextArea(1, 1);
    JTextArea emailsubject = new JTextArea(1, 1);
    JTextArea emailmessage = new JTextArea(25, 1);
    //------BAG LAYOUT
    JLabel lFrom = new JLabel("From:");
    JTextField cFrom = new JTextField(32);
    JLabel lTo = new JLabel("To:");
    JTextField cTo = new JTextField(32);
    JFrame frame2 = new JFrame("Compose New");
    JLabel lSubject = new JLabel("Subject");
    JTextField cSubject = new JTextField(32);
    JLabel lMessage = new JLabel("Body");
    JTextArea cMessage = new JTextArea(5,32);
    //====================================
    public EmailProg() {
    super(new BorderLayout());
    //Create the toolbar.
    JToolBar toolBar = new JToolBar();
    addButtons(toolBar);
    //Create the text area used for output. Request
    //enough space for 5 rows and 30 columns.
    textArea = new JTextArea(5, 30);
    textArea.setEditable(false);
    textArea.setText("Welcome to Jeff's email program! With this program you can compose and send emails. I hope I get a good grade on thise, and marine world finds a good use for it :-D:-D (implements really just testing the scroller!!!)");
    JScrollPane scrollPane = new JScrollPane(textArea);
    //Lay out the main panel.
    setPreferredSize(new Dimension(450, 110));
    add(toolBar, BorderLayout.NORTH);
    add(scrollPane, BorderLayout.CENTER);
    //==================================
    protected void addButtons(JToolBar toolBar) {
    JButton button = null;
    //first button
    button = makeNavigationButton("/toolbarButtonGraphics/general/ComposeMail24.gif", composemail ,"Compose new Email", "compose new");
    toolBar.add(button);
    //second button
    button = makeNavigationButton("toolbarButtonGraphics/general/SendMail24.gif", sendmail,"Send The Mail","send");
    toolBar.add(button);
    //third button
    button = makeNavigationButton("toolbarButtonGraphics/general/About24.gif", about,"About","About");
    toolBar.add(button);
    //exit button
    button = makeNavigationButton("toolbarButtonGraphics/general/Stop24.gif", exit, "Exit", "Exit");
    toolBar.add(button);
    //===================================
    protected JButton makeNavigationButton(String imageName, String actionCommand, String toolTipText, String altText) {
    //Look for the image.
    String imgLocation = imageName;
    URL imageURL = EmailProg.class.getResource(imgLocation);
    //Create and initialize the button.
    JButton button = new JButton();
    button.setActionCommand(actionCommand);
    button.setToolTipText(toolTipText);
    button.addActionListener(this);
    if (imageURL != null) {                      //image found
    button.setIcon(new ImageIcon(imageURL));
    } else {                                     //no image found
    button.setText(altText);
    System.err.println("Resource not found: "+ imgLocation);
    return button;
    //=============================
    public void actionPerformed(ActionEvent e) {
    String cmd = e.getActionCommand();
    String description = null;
    // Handle each button.
    if (exit.equals(cmd)){
    textArea.setText("");
    description = "EXITING";
    System.exit(0);
    if (composemail.equals(cmd)) { //first button clicked
    textArea.setText("");
    description = "Write new mail.";
    composeWindow();
    } else if (sendmail.equals(cmd)) { // second button clicked
    textArea.setText("");
    description = "This button does'nt do anything yet :x";
    } else if (about.equals(cmd)) { // third button clicked
    textArea.setText("");
    description = "About this program. (See pop-up)";
    coolWindow();
    else if (submit.equals(cmd))
    if (cFrom.getText().equals("")||cTo.getText().equals("")||cSubject.getText().equals("")||cMessage.getText().equals(""))
    textArea.setText("One or more of the fields was not filled in.");
    else{
    try {
    String smtpServer="serverhere";
    String to=cTo.getText();
    String from=cFrom.getText();
    String subject=cSubject.getText();
    String body=cMessage.getText();
    send(smtpServer, to, from, subject, body);
    textArea.setText("");
    description = "Mail Sent.";
    JOptionPane.showMessageDialog(null, "Message Sent.");
    catch (Exception ex)
    System.out.println("Usage: java com.lotontech.mail.SimpleSender"
    +" smtpServer toAddress fromAddress subjectText bodyText");
    //CLOSE THE FRAME2 WINDOW IIIIIIIIFFFFFFF SENDING IS SUCCESSFUL!!
    }//end of else during send
    }//end of if of submit
    displayResult(description);
    //============================
    protected void displayResult(String actionDescription) {
    textArea.append(actionDescription + newline);
    //=============================
    public void coolWindow() {
    JFrame frame = new JFrame("About");
    JTextArea filecontents = new JTextArea();
    filecontents.setText("Use the tool bar to compose\n compose new emails, in which you can\n send to anyone on the\n srvhs email server. \n Fill in all the blanks before pressing send. If you dont\n you will receive an error! \n For more information about this program click on the\n information button.");
    frame.getContentPane().add(filecontents, BorderLayout.CENTER);
    frame.pack();
    frame.setResizable(false);
    frame.setSize(300,200);
    frame.setVisible(true);
    //===============================
    public void composeWindow() {
    frame2.getContentPane().setLayout(new GridBagLayout());
    frame2.setResizable(false);
    frame2.setSize(600,500);
    frame2.setVisible(true);
    GridBagConstraints gbc = new GridBagConstraints();
    gbc.insets = new Insets(5, 10, 5, 10);
    cMessage.setLineWrap(true);
    subbutton = makeNavigationButton("toolbarButtonGraphics/general/SendMail24.gif", submit,"submit","submit");
    addRow(gbc, lFrom, cFrom);
    addRow(gbc, lTo, cTo);
    addRow(gbc, lSubject, cSubject);
    addRow(gbc, lMessage, cMessage);
    addRow(gbc, lSubmit, subbutton);
    //===============================
    private void addRow(GridBagConstraints gbc, Component left, Component right) {
    gbc.gridx = GridBagConstraints.RELATIVE;
    gbc.gridy = GridBagConstraints.RELATIVE;
    gbc.gridheight = 1;
    gbc.gridwidth = 1;
    gbc.anchor = GridBagConstraints.EAST;
    frame2.getContentPane().add(left, gbc);
    gbc.gridwidth = GridBagConstraints.REMAINDER;
    gbc.anchor = GridBagConstraints.WEST;
    frame2.getContentPane().add(right, gbc);
    frame2.pack();
    //=======================
    public static void send(String smtpServer, String to, String from, String subject, String body) {
    try {
    Properties props = System.getProperties();
    props.put("localhost", smtpServer);
    Session session = Session.getDefaultInstance(props, null);
    System.out.println(smtpServer);
    // -- Create a new message --
    Message msg = new MimeMessage(session);
    // -- Set the FROM and TO fields --
    msg.setFrom(new InternetAddress(from));
    msg.setRecipients(Message.RecipientType.TO, InternetAddress.parse(to, false));
    // -- We could include CC recipients too --
    // if (cc != null)
    // msg.setRecipients(Message.RecipientType.CC
    // ,InternetAddress.parse(cc, false));
    // -- Set the subject and body text --
    msg.setSubject(subject);
    msg.setText(body);
    // -- Set some other header information --
    msg.setHeader("X-Mailer", "LOTONtechEmail");
    msg.setSentDate(new Date());
    // -- Send the message --
    Transport.send(msg);
    System.out.println("Message sent OK.");
    catch (Exception ex)
    ex.printStackTrace();
    public static void main(String[] args) {
    JFrame frame = new JFrame("EmailProg");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    EmailProg newContentPane = new EmailProg();
    newContentPane.setOpaque(true);
    frame.setContentPane(newContentPane);
    //Display the window.
    frame.pack();
    frame.setVisible(true);
    }

    The code to retrieve the messages from SMTP
    finally all working fine...
    thanx guys!!!
    package EmailProg;
    import javax.mail.*;
    import javax.mail.internet.*;
    import java.util.*;
    import java.io.*;
      * A simple email receiver class.
    public class SimpleReceiver
        * Main method to receive messages from the mail server specified
        * as command line arguments.
      public static void main(String args[])
        try
          String popServer=args[0];
          String popUser=args[1];
          String popPassword=args[2];
          receive(popServer, popUser, popPassword);
        catch (Exception ex)
          System.out.println("Usage: java com.mail.SimpleReceiver" +" popServer popUser popPassword");
        System.exit(0);
         * "receive" method to fetch messages and process them.
       public static void receive(String popServer, String popUser, String popPassword)
         Store store=null;
         Folder folder=null;
         try
           // -- Get hold of the default session --
           Properties props = System.getProperties();
           Session session = Session.getDefaultInstance(props, null);
           // -- Get hold of a POP3 message store, and connect to it --
           store = session.getStore("pop3");
           store.connect(popServer, popUser, popPassword);
           // -- Try to get hold of the default folder --
           folder = store.getDefaultFolder();
           if (folder == null) throw new Exception("No default folder");
           // -- ...and its INBOX --
           folder = folder.getFolder("INBOX");
           if (folder == null) throw new Exception("No POP3 INBOX");
           // -- Open the folder for read only --
           folder.open(Folder.READ_ONLY);
           // -- Get the message wrappers and process them --
           Message[] msgs = folder.getMessages();
           for (int msgNum = 0; msgNum < msgs.length; msgNum++)
             System.out.println(msgs[msgNum]);
         catch (Exception ex)
           ex.printStackTrace();
         finally
           // -- Close down nicely --
           try
             if (folder!=null) folder.close(false);
             if (store!=null) store.close();
           catch (Exception ex2) {ex2.printStackTrace();
      }

  • Plz help me to close new window !  !  !  !  !  !  !

    Hi all,
    i'm a fresher in jsp. i write a jsp page with a 'text box' & a button. when i click the button, i want to see the html page that can choose somthing from it & then, i want to see the selected data in the 'text box' of jsp page of previous window. but, when i run my code, the jsp page open, then when i click the button, the html page appear with new window. but, when i choose one & click the submit button, it call the jsp page again in new window. i don't want to see the jsp page again in new window. but in previous window with the data i selected in the 'text box'.
    How can i do it? where can i change?
    Plz help me.
    Here my coding ..........
    \\\\\\\\\\ 13p3.jsp \\\\\\\\\\\\\\\\\\\\\\
    <%@ page language="java" info="form processing page" %>
    <html>
    <head><title></title></head>
    <body>
    <%! String sid; %>
    <%
    sid = request.getParameter("id");
    %>
    <input type="text" name="ID" size=20 value=<%= sid %>>
    <%= sid %>
    <input type="button" name="ControlButton" value="Start." onClick="window.open('13p2.html','ControlWindow','width=250, height=225')">
    </body>
    </html>
    \\\\\\\\\\\\\ 13p2.html \\\\\\\\\\\\\\\\\
    <html>
    <head><title></title></head>
    <body>
    <form method=post action="13p3.jsp">
    <table width=100% border=2 bordercolor=#00ffdd>
    <tr><td colspan=2>
    <table bgcolor=#A5A6C6#00ffdd width=100%><td width=50%><center>ID</center></td><td width=50%><center>Name</center></td></table>
    </td></tr>
    <tr><td width=50%><center><input type=radio name="id" value=1>1</center></td><td width=50%>Ma The The</td></tr>
    <tr><td width=50%><center><input type=radio name="id" value=2>2</center></td><td width=50%>Ma Mar Mar</td></tr>
    <tr><td width=50%><center><input type=radio name="id" value=3>3</center></td><td width=50%>Ma Mie Mie</td></tr>
    </table>
    <table width=100% border=0>
    <tr><td width=100%><center><input type=submit value=Submit></center></td></tr>
    </table>
    </form>
    </body>
    </html>
    \\\\\\\\\\End
    thanks ...
    icyrock.

    This isn't a JSP problem. Brush up on your Javascript.

  • Convert C++ prog into Java( I m new in java)help urgent

    hi all,
    i am very new in java. i have code of C++.i have to convert it in to Java.please help me on urgent basis.plz provide me solution.
    I am looking for positive response.code is below:
    #include <stdio.h>
    #include <string.h>
    #include <stdlib.h>
    #include <sys/stat.h>
    #include <fstream.h>
    #include <iostream.h>
    //#include <sha.h> //24112003
    //#include<wincrypt.h>
    char ntc(unsigned char n){
    if (n<26) return 'A'+n;
    if (n<52) return 'a'-26+n;
    if (n<62) return '0'-52+n;
    if (n==62) return '+';
    if (n==63)return '/';
    unsigned char ctn(char c){
    if (c=='/') return 63;
    if (c=='+') return 62;
    if ((c>='A')&&(c<='Z')) return c-'A';
    if ((c>='a')&&(c<='z')) return c-'a'+26;
    if ((c>='0')&&(c<='9')) return c-'0'+52;
    if (c=='~') return 80;
    return 100;
    int b64decode(char from,char to,int length){
    unsigned char c,d,e,f;
    char A,B,C;
    int i;
    int add;
    char *tot=to;
    for (i=0;i+3<length;){
    add=0;
    A=B=C=0;
    c=d=e=f=100;
    while ((c==100)&&(i<length)) c=ctn(from[i++]);
    while ((d==100)&&(i<length)) d=ctn(from[i++]);
    while ((e==100)&&(i<length)) e=ctn(from[i++]);
    while ((f==100)&&(i<length)) f=ctn(from[i++]);
    //if (f==100) return -1; /* Not valid end */
    if (c<64) {
    A+=c*4;
    if (d<64) {
    A+=d/16;
    B+=d*16;
    if (e<64) {
    B+=e/4;
    C+=e*64;
    if (f<64) {
    C+=f;
    to[2]=C;
    add+=1;
    to[1]=B;
    add+=1;
    to[0]=A;
    add+=1;
    to+=add;
    if (f==80) return to-tot; /* end because '=' encountered */
    return to-tot;
    int b64get_encode_buffer_size(int l,int q){
    int ret;
    ret = (l/3)*4;
    if (l%3!=0) ret +=4;
    if (q!=0){
    ret += (ret/(q*4));
    /* if (ret%(q/4)!=0) ret ++; */ /* Add space for trailing \n */
    return ret;
    int b64strip_encoded_buffer(char *buf,int length){
    int i;
    int ret=0;
    for (i=0;i<length;i++) if (ctn(buf)!=100) buf[ret++] = buf [i];
    return ret;
    int b64encode(char from,char to,int length,int quads){
    // 3 8bit numbers become four characters
    int i =0;
    char *tot=to;
    int qc=0; // Quadcount
    unsigned char c;
    unsigned char d;
    while(i<length){
    c=from[i];
    *to++=ntc(c/4);
    c=c*64;
    i++;
    if (i>=length) {
    *to++=ntc(c/4);
    *to++='~';
    *to++='~';
    break;
    d=from[i];
    *to++=ntc(c/4+d/16);
    d=d*16;
    i++;
    if (i>=length) {
    *to++=ntc(d/4);
    *to++='~';
    break;
    c=from[i];
    *to++=ntc(d/4+c/64);
    c=c*4;
    i++;
    *to++=ntc(c/4);
    qc++; /* qz will never be zero, quads = 0 means no linebreaks */
    if (qc==quads){
    *to++='\n';
    qc=0;
    /* if ((quads!=0)&&(qc!=0)) to++='\n'; / /* Insert last linebreak */
    return to-tot;
    char* mEncryptPassword(char* mPassword)
    char mEncryptedPassword[200]; // To hold encrypted password.
    //char* mEncryptedPassword = new char[200];
    char mPrimEncryptedPassword[200];
    char * temp = new char[200];
    //unsigned char* md; // 19122003
    //md = new unsigned char[100]; // 19122003
    memset(mEncryptedPassword, '\0', sizeof(mEncryptedPassword));
    memset(mPrimEncryptedPassword, '\0', sizeof(mPrimEncryptedPassword));
    strcpy(mPrimEncryptedPassword, mPassword);
    //strcpy(mPrimEncryptedPassword, (char*) SHA1((unsigned char*) mPassword, strlen(mPassword), NULL));
    //strcpy(mEncryptedPassword, (char*) SHA((unsigned char*) mPassword, strlen(mPassword), md)); // 19122003
    //strcpy(mEncryptedPassword, (char*) SHA((unsigned char*) mPassword, strlen(mPassword), md)); //19122003
    b64encode(mPrimEncryptedPassword, mEncryptedPassword, strlen(mPrimEncryptedPassword), 0);
    // If successfully encrypts..
    if (mEncryptedPassword != NULL)
    //char * temp = new char[strlen(mEncryptedPassword)+1];
    strcpy(temp,mEncryptedPassword);
    // strcpy(mRetVal,mEncryptedPassword);
    return (char*)temp;
    //return (mEncryptedPassword);
    //return (char*) md; // 19122003
    else
    return ("Error");
    char* mDecryptPassword(char* mPassword)
    char mDecryptedPassword[200]; // To hold decrypted password.
    char mPrimDecryptedPassword[200];
    char * temp = new char[200];
    // 02032007
    memset(mDecryptedPassword, '\0', sizeof(mDecryptedPassword));
    memset(mPrimDecryptedPassword, '\0', 200);
    strcpy(mPrimDecryptedPassword, mPassword);
    b64decode(mPrimDecryptedPassword, mDecryptedPassword, strlen(mPrimDecryptedPassword));
    // If successfully decrypts..
    if (mDecryptedPassword != NULL)
    //char * temp = new char[strlen(mEncryptedPassword)+1];
    strcpy(temp,mDecryptedPassword);
    // strcpy(mRetVal,mDecryptedPassword);
    return (char*)temp;
    //return (mEncryptedPassword);
    //return (char*) md; // 19122003
    else
    return ("Error");
    void main(int argc, char* argv[])
    cout << mEncryptPassword(argv[1])<<endl<<flush;
    cout << mDecryptPassword(mEncryptPassword(argv[1]))<<endl<<flush;
    Anubhav

    endasil wrote:
    I just thought of how ridiculous this would sound in any other profession:
    Surgeons:
    plz plz help I have patient dying need to insert new kidney into 90yr old patient plz someone come do itLawyers:
    Help client guilty need good defense (I m new in law)help urgentHow come we get stuck with the lazy low-lifes?Because there's no legal requirement that a software developer must be licensed

Maybe you are looking for

  • Cisco SA520 - Unable to block all torrents and Poor Performance

    Hi, I have installed a Cisco SA520W Appliance at a Client who has about 40-50 PC's, the device has the latest firmware 2.1.7 and latest IPS signature (17) installed, the client is quite disappointed about the performance of the device as he believes

  • Start Screen Microsoft Office 2013 tiles are completely empty

    This is very weird. It started with Outlook and every few weeks another one loses its values. The tiles are colored boxes but have no text or icon in them.  There is nothing to tell me which tile is Outlook, Word, OneNote, Excel or Lync.  InfoPath De

  • Publishing a book as a pdf

    Good morrow,  I have a book that I want to be able to publish but in a way that the purchaser cannot copy or print it.  How can I do this without giving them a password to open it?

  • Reference attributes from different CS

    Hi! I have the following situation: There are two Oracle MA, that imports data from HR-system. The first MA imports persons, the second one imports departments.  It isn't suitable for me to combine them. The department object has an atribute "chiefID

  • Working with Date

    Hi: I need to calculate 30 days usage from activation date. I've a table as below: ACTIVATION USER USAGE USAGE_DATE 5/8/2013 ROB 20 7/8/2013 6/8/2013 HANS 50 7/8/2013 6/8/2013 MIKE 0 7/8/2013 5/8/2013 PIETER 30 7/8/2013 5/8/2013 ROB 90 9/8/2013 6/8/2