Java debugging - problems with standard input
Hi
I hope somebody can help me with this problem.
I'm developing a Java app that reads from the standard input. I use System.in.read() to do that. When I debug it, I use the Standard I/O window instead of the Run Log window to pass in values, but nothing happens (i.e. the line following the read() is never reached). I also tried to run the app and then attach the debugger to use the Run Log window as standard input, with the same result. If I add a breakpoint before the call to read(), the debugger pauses the execution, so I suppose the breakpoints are OK.
In the executable Info window, Debugging tab, I use the pseudo terminal with the Java debugger.
So my question is: how can I enter values from the standard input in debugging mode?
I believe that you are seeing these problems because we have found the
current versions of RMI found in the JDK to be inherently unscalable -- we
do not listen for them. As you noticed, we recommend that you use our
packages for now, and then do the simple change that you found if you decide
that you do not like WLS. (If you do decide that you do not like us, please
definitely let us know why you chose the way you did!)
Thanks,
Michael
Michael Girdley
Product Manager, WebLogic Server & Express
BEA Systems Inc
"Tim Dawson" <[email protected]> wrote in message
news:397b8cc2$[email protected]..
We're developing a J2EE application on NT using WLS 5.1, SP3, but we don't
want to be tied to any particular J2EE server, so we're making sure that
none of our code is weblogic specific.
In keeping with this philosophy, I created an RMI service that used the
standard java.rmi.* imports instead of weblogic.rmi.* and used thestandard
RMIC compiler rather than the weblogic.rmic compiler.
Unfortunately, I couldn't get the system to work. I kept getting
"java.rmi.MarshalException: Error marshaling transport header; nested
exception is: java.io.EOFException" whenever I'd call Naming.lookup().
Of course, when I did the search & replace with java.rmi.* with
weblogic.rmi.*, and switched from the standard rmic to weblogic.rmic,
everything started working just fine. This is the ONLY change I made!
Has anyone else run into similar problems?
Tim Dawson
Sr. Software Architect
is.com
Similar Messages
-
Problem with the input file format to be stored in database
Hi,
I am facing some problem with the input format. I am using the table name as data.employee. But i could not able to process the message forward. I am getting this error,
com.ibm.db2.jcc.c.SqlException: java.sql.Connection.close() requested while a transaction is in progress on the connection.The transaction remains active, and the connection cannot be closed.
Can you please help me prposing a solution for this format.
Thanks,
SOoryaI think you are missing out the COMMIT operation.
At the DB2 end before closing the connection if you do a 'COMMIT' then this may remove your error.
i.e. after you close the Resultset>close the statement object> perform 'COMMIT' operation--> then close the connection.
Also refer :-
http://www.dbforums.com/archive/index.php/t-976407.html
http://www.dbforums.com/showthread.php?t=1628183
I hope this will help you.
Thanks,
Vijaya -
Crystal Report with standard Input-Parameters in InfoView
Hi there,
i've created a crystal report which has non-optional input parameters, e.g, Date from ... Date to ...
I've managed to fill this parameter with standard parameters if the user does not choose a value. e.g. date is today - 14 days.
If i start the report in crystal and do not enter a input-parameter, it gets it input parameer automatically, see:
(if not hasvalue({?PARA_TA_von}) then ({PW_BO_HU_TA.LTAP-WDATU}>=CurrentDate-14) else ({PW_BO_HU_TA.LTAP-WDATU}>={?PARA_TA_von}))
It works perfectly in crystal. But if i start the Report in Webintelligence Infoview, it doesn't work and i get the message to enter the input-parameters....
Any idea ?
Thanks,
SebastianHi Ingo,
I have tried the sample reports and other crystal reports created with data sources other than SAP which all work fine. The problem happens on all clients and the server when running reports with SAP data source.
I did find an error in the Tomcat logs.
[/SAP].[jsp] Thread [http-8080-Processor24]; Servlet.service() for servlet jsp threw exception
java.lang.NoClassDefFoundError: com/crystaldecisions/Utilities/LengthLimitedDataInputStream
I did manage to run one report which had 4 records but the other reports which vary from 432 - 2500 records return the error found in the tomcat logs.
I will be installing BOE XI 3.1 on my desktop to see if the still issue occurs in this release.
Thanks and Regards,
Paul. -
Problem with direct input program while uploading data into database
TABLES: BGR00, " Mappensatz
BMM00, " MM01/MM02 BTCI-Kopfdaten
BMMH1, " MM01/MM02 Hauptdaten
BMMH2, " Länderdaten (Steuern)
BMMH3, " Prognosewerte
BMMH4, " Verbrauchswerte
BMMH5, " Kurztexte
BMMH6, " Mengeneinheiten
BMMH7, " Langtexte
BMMH8. " Referentielle EAN's
Satztypen
DATA: MAPPENSATZ LIKE BMM00-STYPE VALUE '0',
KOPFSATZ LIKE BMM00-STYPE VALUE '1',
HAUPTSATZ LIKE BMM00-STYPE VALUE '2',
KUN_SATZ LIKE BMM00-STYPE VALUE 'Z',
LANDSATZ LIKE BMM00-STYPE VALUE '3',
PROGSATZ LIKE BMM00-STYPE VALUE '4',
VERBSATZ LIKE BMM00-STYPE VALUE '5',
KTEXTSATZ LIKE BMM00-STYPE VALUE '6',
MESATZ LIKE BMM00-STYPE VALUE '7',
TEXTSATZ LIKE BMM00-STYPE VALUE '8',
EANSATZ LIKE BMM00-STYPE VALUE '9'.
Common Data Bereich fuer die extern aufgerufenen Routinen
Initialstrukturen
DATA: BEGIN OF COMMON PART RMMMBIMY.
DATA: BEGIN OF I_BMM00.
INCLUDE STRUCTURE BMM00. " Kopfdaten
DATA: END OF I_BMM00.
DATA: BEGIN OF I_BMMH1.
INCLUDE STRUCTURE BMMH1. " Haupdaten
DATA: END OF I_BMMH1.
DATA: BEGIN OF I_BMMH2.
INCLUDE STRUCTURE BMMH2. " Länderdaten
DATA: END OF I_BMMH2.
DATA: BEGIN OF I_BMMH3.
INCLUDE STRUCTURE BMMH3. " Prognosewerte
DATA: END OF I_BMMH3.
DATA: BEGIN OF I_BMMH4.
INCLUDE STRUCTURE BMMH4. " Verbrauchswerte
DATA: END OF I_BMMH4.
DATA: BEGIN OF I_BMMH5.
INCLUDE STRUCTURE BMMH5. " Kurztexte
DATA: END OF I_BMMH5.
DATA: BEGIN OF I_BMMH6.
INCLUDE STRUCTURE BMMH6. " Mengeneinheiten
DATA: END OF I_BMMH6.
DATA: BEGIN OF I_BMMH7.
INCLUDE STRUCTURE BMMH7. " Textzeilen
DATA: END OF I_BMMH7.
DATA: BEGIN OF I_BMMH8.
INCLUDE STRUCTURE BMMH8. " Referentielle EAN's
DATA: END OF I_BMMH8.
DATA: END OF COMMON PART.
DATA: WA LIKE TEDATA-DATA.
Einzelfelder
DATA: GROUP_COUNT(6) TYPE C, " Anzahl Mappen
TRANS_COUNT(6) TYPE C, " alte Definition für rmmmbim0
SATZ_COUNT LIKE MUEB_REST-TRANC, " Trans.zähler neu
H_IND_COUNT LIKE MUEB_REST-D_IND, " Index welches Feld zurücks.
SATZ2_COUNT(6) TYPE C. " Anz. Sätze je Trans. ohne Kopfsatz
DATA: XEOF(1) TYPE C, " X=End of File erreicht
XHAUPTSATZ_EXIST TYPE C, " X=Hauptsatz zum Kopf exi.
NODATA(1) TYPE C. " kein BI für dieses Feld
mk/15.08.94:
DATA: GROUP_OPEN(1) TYPE C. " X=Mappe schon geöffnet
*eject
Konstanten
DATA: C_NODATA(1) TYPE C VALUE '/'. " Default für NODATA
DATA: MATNR_ERW LIKE MARA-MATNR VALUE '0 '.
DATA: MATNR_ERW_INT LIKE MARA-MATNR. "internal sight of '0 '
DATA: MATNR_LAST LIKE MARA-MATNR. "Material number
mk/11.08.94 2.1H:
If this flag is initial, the database updates will be done directly
during background maintenance instead of using a separate update
task. (no usage of this flag in dialogue mode!)
DATA: DBUPDATE_VB(1) VALUE ' '. "note 306628
data: matsync type mat_sync. "wk/99a no update in dialog if called
***INCLUDE ZMUSD070.
TABLES: MARA, "Material Master: General Data
MARC, "Material Master: C Segment
MARD, "Material Master: St Loc/Batch
MBEW, "Material Valuation
MVKE, "Material Master: Sales Data
MLGN, "Material Data per Whse Number
MLAN, "Tax Classification: Material
T001W, "Plants/Branches
TBICU.
DATA: BEGIN OF VALUTAB OCCURS 0.
INCLUDE STRUCTURE RSPARAMS.
DATA: END OF VALUTAB.
DATA: BEGIN OF VARTECH.
INCLUDE STRUCTURE VARID.
DATA: END OF VARTECH.
DATA: PARMS LIKE ZXXDCONV.
DATA: REC_COUNT TYPE I,
REC_COUNT_BAD TYPE I,
ZJOBID LIKE TBIZU-JOBID,
ZJOBCOUNT LIKE TBIZU-JOBCOUNT,
ZMATNR LIKE MARA-MATNR,
ZTEXT(80) TYPE C.
CONSTANTS: LIT_ZERO(18) TYPE C VALUE '000000000000000000',
LIT_CHAR TYPE C VALUE '_',
LIT_CREATE LIKE BMM00-TCODE VALUE 'MM01',
LIT_CHANGE LIKE BMM00-TCODE VALUE 'MM02',
LIT_CHECK(1) TYPE C VALUE 'X'.
DATA: BEGIN OF INP_DATA OCCURS 0,
MATNR(18) TYPE C, " Material code
UMREN(6) TYPE C, " Denominator
MEINH(3) TYPE C, " Alternate UOM
UMREZ(6) TYPE C, " Numerator
END OF INP_DATA.
*eject
SELECTION-SCREEN BEGIN OF BLOCK INOUT WITH FRAME TITLE TEXT-001.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT (13) TEXT-004.
PARAMETERS: P_PC RADIOBUTTON GROUP SRC DEFAULT 'X'.
SELECTION-SCREEN COMMENT (6) TEXT-005.
PARAMETERS: P_UNIX RADIOBUTTON GROUP SRC.
SELECTION-SCREEN COMMENT (6) TEXT-006.
PARAMETERS: P_DS_TYP LIKE ZXXDCONV-DS_TYP
DEFAULT 'ASC'.
SELECTION-SCREEN END OF LINE.
*SELECT-OPTIONS: S_PATH FOR PARMS-PATH
NO INTERVALS
LOWER CASE.
PARAMETERS: P_PATH TYPE RLGRAP-FILENAME.
PARAMETERS: P_HDRLIN LIKE ZXXDCONV-HDR_LINES
DEFAULT 0,
P_JOBNAM LIKE TBICU_S-JOBNAME
MEMORY ID BM1,
P_DI_EXE AS CHECKBOX
DEFAULT LIT_CHECK,
P_MAPPE LIKE BGR00-GROUP
DEFAULT 'MRP_UOM_LOAD'
NO-DISPLAY.
SELECTION-SCREEN END OF BLOCK INOUT.
*eject
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_PATH.
CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
EXPORTING
PROGRAM_NAME = SYST-REPID
DYNPRO_NUMBER = SYST-DYNNR
FIELD_NAME = 'P_PATH'
CHANGING
FILE_NAME = S_PATH-LOW
FILE_NAME = P_PATH
EXCEPTIONS
MASK_TOO_LONG = 1
OTHERS = 2.
AT SELECTION-SCREEN.
Set up parameter record
PARMS-UNIX = P_UNIX.
PARMS-PC = P_PC.
PARMS-DS_TYP = P_DS_TYP.
PARMS-JOBNAME = P_JOBNAM.
PARMS-MAPPE = P_MAPPE.
PARMS-HDR_LINES = P_HDRLIN.
*eject
Main Processing Routine *
START-OF-SELECTION.
Initialization
PERFORM 0000_HOUSEKEEPING.
Initialize transaction data in I_BM00
PERFORM 0500_INIT_BMM00.
Process input files
SORT S_PATH BY SIGN OPTION LOW.
MOVE S_PATH-LOW TO PARMS-PATH.
MOVE P_PATH TO PARMS-PATH.
LOOP AT S_PATH.
AT NEW LOW.
CLEAR INP_DATA.
REFRESH INP_DATA.
Read source data into internal table
PERFORM 1000_GET_SOURCE_DATA TABLES INP_DATA.
Processs each record in internal table
ZTEXT = TEXT-007.
ZTEXT+13 = PARMS-DS_NAME.
PERFORM 4000_PROGRESS_INDICATOR USING ZTEXT.
Initialize transaction data in I_BM00
PERFORM 0500_INIT_BMM00.
LOOP AT INP_DATA.
Reset tables for each record
BMM00 = I_BMM00.
BMMH1 = I_BMMH1.
BMMH6 = I_BMMH6.
Load structures with data
MOVE-CORRESPONDING INP_DATA TO BMM00.
PERFORM 2000_WRITE_OUTPUT USING BMM00.
MOVE-CORRESPONDING INP_DATA TO BMMH1.
PERFORM 2000_WRITE_OUTPUT USING BMMH1.
MOVE-CORRESPONDING INP_DATA TO BMMH6.
PERFORM 2000_WRITE_OUTPUT USING BMMH6.
REC_COUNT = REC_COUNT + 1.
ENDLOOP.
ENDAT.
ENDLOOP.
IF REC_COUNT GT 0
AND P_DI_EXE EQ LIT_CHECK.
PERFORM 3000_START_DI_JOB.
ENDIF.
WRITE: / TEXT-008,
REC_COUNT.
PERFORM 9000_END_OF_JOB.
*eject
Include containing common routines used by direct input programs
INCLUDE ZMUSD071.
*eject
FORM 0500_INIT_BMM00 *
Initialize I_BMM00 with transaction code and views selected *
FORM 0500_INIT_BMM00.
***this changes done by samson**
if not inp_data[] is initial.
select single matnr from mara INTO ZMATNR where matnr = inp_data-matnr.
if sy-subrc = 0.
I_BMM00-TCODE = LIT_CHANGE.
Basic data
I_BMM00-XEIK1 = LIT_CHECK.
else.
I_BMM00-TCODE = LIT_CREATE.
Basic data
I_BMM00-XEIK1 = LIT_CHECK.
endif.
endif.
**this changes above done by samson**
Transaction code
I_BMM00-TCODE = LIT_CHANGE.
Basic data
I_BMM00-XEIK1 = LIT_CHECK.
ENDFORM.
INCLUDE ZMUSD069.
*eject
FORM 0000_HOUSEKEEPING *
Initialization routines *
FORM 0000_HOUSEKEEPING.
PERFORM 0010_LDS_NAME.
PERFORM 0020_DS_NAME.
PERFORM 0030_OPEN_FILE.
PERFORM 0040_INIT_STRUCTS.
ENDFORM.
*eject
FORM 0010_LDS_NAME *
Obtain logical file name from DI job details *
FORM 0010_LDS_NAME.
Check valid job name
SELECT SINGLE * FROM TBICU
WHERE JOBNAME EQ PARMS-JOBNAME.
IF SY-SUBRC EQ 0.
CALL FUNCTION 'RS_VARIANT_VALUES_TECH_DATA'
EXPORTING
REPORT = TBICU-REPNAME
VARIANT = TBICU-VARIANT
IMPORTING
TECHN_DATA = VARTECH
TABLES
VARIANT_VALUES = VALUTAB
EXCEPTIONS
VARIANT_NON_EXISTENT = 1
VARIANT_OBSOLETE = 2
OTHERS = 3.
IF SY-SUBRC EQ 0.
READ TABLE VALUTAB WITH KEY 'LDS_NAME'.
MOVE VALUTAB-LOW TO PARMS-LDS_NAME.
ELSE.
MESSAGE I001 WITH PARMS-JOBNAME.
MESSAGE A099.
ENDIF.
ELSE.
MESSAGE I000 WITH PARMS-JOBNAME.
MESSAGE A099.
ENDIF.
ENDFORM.
*eject
FORM 0040_INIT_STRUCTS *
Initialize structures for direct input records *
FORM 0040_INIT_STRUCTS.
Start of standard SAP initialization from example program RMMMBIME
*------- Write session record -
CLEAR BGR00.
BGR00-STYPE = MAPPENSATZ.
BGR00-GROUP = PARMS-MAPPE.
BGR00-NODATA = C_NODATA.
BGR00-MANDT = SY-MANDT.
BGR00-USNAM = SY-UNAME.
BGR00-START = BGR00-NODATA.
BGR00-XKEEP = BGR00-NODATA.
PERFORM 2000_WRITE_OUTPUT USING BGR00.
*----- Initialize structures -
NODATA = BGR00-NODATA.
PERFORM INIT_STRUKTUREN_ERZEUGEN(RMMMBIMI) USING NODATA.
End of standard SAP initialization from example program RMMMBIME
ENDFORM.
*eject.
FORM 3000_START_DI_JOB *
Start direct input job *
FORM 3000_START_DI_JOB.
ZTEXT = 'Starting '(021).
ZTEXT+9 = TBICU-JOBNAME.
PERFORM 4000_PROGRESS_INDICATOR USING ZTEXT.
CALL FUNCTION 'BI_START_JOB'
EXPORTING
JOBID = ' '
JOBTEXT = TBICU-JOBNAME
REPNAME = TBICU-REPNAME
SERVER = TBICU-EXECSERVER
VARIANT = TBICU-VARIANT
NEW_JOB = 'X'
CONTINUE_JOB = ' '
START_IMMEDIATE = 'X'
DO_NOT_PRINT = 'X'
USERNAME = SY-UNAME
IMPORTING
JOBID = ZJOBID
JOBCOUNT = ZJOBCOUNT
EXCEPTIONS
JOB_OPEN_FAILED = 1
JOB_CLOSE_FAILED = 2
JOB_SUBMIT_FAILED = 3
WRONG_PARAMETERS = 4
JOB_DOES_NOT_EXIST = 5
WRONG_STARTTIME_GIVEN = 6
JOB_NOT_RELEASED = 7
WRONG_VARIANT = 8
NO_AUTHORITY = 9
DIALOG_CANCELLED = 10
JOB_ALREADY_EXISTS = 11
PERIODIC_NOT_ALLOWED = 12
ERROR_NUMBER_GET_NEXT = 13
OTHERS = 14.
IF SY-SUBRC EQ 0.
WRITE: / 'Direct input job'(022), TBICU-JOBNAME, 'started'.
ELSE.
WRITE: / 'Direct input failed with return code'(023), SY-SUBRC.
ENDIF.
FORM 0020_DS_NAME.
CALL FUNCTION 'FILE_GET_NAME'
EXPORTING
CLIENT = SY-MANDT
LOGICAL_FILENAME = PARMS-LDS_NAME
OPERATING_SYSTEM = SY-OPSYS
IMPORTING
FILE_NAME = PARMS-DS_NAME
EXCEPTIONS
FILE_NOT_FOUND = 1
OTHERS = 2.
IF SY-SUBRC NE 0.
MESSAGE E002 WITH PARMS-LDS_NAME.
MESSAGE A099.
ENDIF.
ENDFORM.
*eject
FORM 0030_OPEN_FILE *
Open physical file for output *
FORM 0030_OPEN_FILE.
OPEN DATASET PARMS-DS_NAME FOR OUTPUT IN TEXT MODE. "thg191105
OPEN DATASET PARMS-DS_NAME FOR OUTPUT IN TEXT MODE
encoding default. "thg191105
IF SY-SUBRC NE 0.
MESSAGE E003 WITH PARMS-DS_NAME.
MESSAGE A099.
ENDIF.
ENDFORM.
*eject
FORM 1000_GET_SOURCE_DATA *
Read source data into internal table *
--> INP_DATA " Name of internal table passed as parameter *
FORM 1000_GET_SOURCE_DATA TABLES INP_DATA.
CALL FUNCTION 'Z_FILE_UPLOAD'
EXPORTING
UNIX = PARMS-UNIX
PC = PARMS-PC
FILETYPE = PARMS-DS_TYP
FILENAME = PARMS-PATH
HDR_LINES = PARMS-HDR_LINES
TABLES
DATA_TAB = INP_DATA
EXCEPTIONS
CONVERSION_ERROR = 1
FILE_OPEN_ERROR = 2
FILE_READ_ERROR = 3
INVALID_TABLE_WIDTH = 4
INVALID_TYPE = 5
NO_BATCH = 6
UNKNOWN_ERROR = 7
INVALID_SOURCE = 8
OTHERS = 9.
ENDFORM.
*eject
FORM 2000_WRITE_OUTPUT *
Write record in standard SAP structure to UNIX file *
--> I_STRUCT " Name of record passed as parameter *
*FORM 2000_WRITE_OUTPUT USING I_STRUCT."SRY28NOV05
FORM 2000_WRITE_OUTPUT USING I_STRUCT TYPE ANY. "SRY28NOV05
TRANSFER I_STRUCT TO PARMS-DS_NAME.
IF SY-SUBRC NE 0.
MESSAGE E004 WITH PARMS-DS_NAME.
MESSAGE A099.
ENDIF.
ENDFORM.
*eject
*& Form 2100_WS_DOWNLOAD
text *
--> p1 text
<-- p2 text
FORM 2100_WS_DOWNLOAD TABLES INP_DATA.
DATA: FILENAME LIKE RLGRAP-FILENAME. "SRY28NOV05
DATA: W_FILENAME TYPE STRING. "SRY28NOV05
DATA: W_FTYP(10) TYPE C VALUE 'DAT'. "SRY28NOV05
MOVE PARMS-DS_NAME TO FILENAME. "SRY28NOV05
MOVE PARMS-DS_NAME TO W_FILENAME. "SRY28NOV05
*BEGIN OF BLOCK COMMENT BY SRY28NOV05
CALL FUNCTION 'WS_DOWNLOAD'
EXPORTING
BIN_FILESIZE = ' '
CODEPAGE = ' '
FILENAME = FILENAME
FILETYPE = 'DAT'
MODE = ' '
WK1_N_FORMAT = ' '
WK1_N_SIZE = ' '
WK1_T_FORMAT = ' '
WK1_T_SIZE = ' '
COL_SELECT = ' '
COL_SELECTMASK = ' '
importing
filelength =
TABLES
DATA_TAB = INP_DATA
FIELDNAMES =
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_WRITE_ERROR = 2
INVALID_FILESIZE = 3
INVALID_TABLE_WIDTH = 4
INVALID_TYPE = 5
NO_BATCH = 6
UNKNOWN_ERROR = 7
OTHERS = 8.
*END OF BLOCK COMMENT BY SRY28NOV05
*BEGIN OF BLOCK ADDED BY SRY28NOV05
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
FILENAME = W_FILENAME
FILETYPE = W_FTYP
TABLES
DATA_TAB = INP_DATA
EXCEPTIONS
FILE_WRITE_ERROR = 1
NO_BATCH = 2
GUI_REFUSE_FILETRANSFER = 3
INVALID_TYPE = 4
NO_AUTHORITY = 5
UNKNOWN_ERROR = 6
HEADER_NOT_ALLOWED = 7
SEPARATOR_NOT_ALLOWED = 8
FILESIZE_NOT_ALLOWED = 9
HEADER_TOO_LONG = 10
DP_ERROR_CREATE = 11
DP_ERROR_SEND = 12
DP_ERROR_WRITE = 13
UNKNOWN_DP_ERROR = 14
ACCESS_DENIED = 15
DP_OUT_OF_MEMORY = 16
DISK_FULL = 17
DP_TIMEOUT = 18
FILE_NOT_FOUND = 19
DATAPROVIDER_EXCEPTION = 20
CONTROL_FLUSH_ERROR = 21
OTHERS = 22.
IF SY-SUBRC NE 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
*END OF BLOCK ADDED BY SRY28NOV05
ENDFORM. " 2100_WS_DOWNLOAD
*eject
FORM 4000_PROGRESS_INDICATOR *
Write progress text to status bar *
--> TEXT " Text passed as parameter *
FORM 4000_PROGRESS_INDICATOR USING TEXT.
CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
EXPORTING
PERCENTAGE = 0
TEXT = TEXT
EXCEPTIONS
OTHERS = 1.
ENDFORM.
*eject.
FORM 9000_END_OF_JOB *
Close files on UNIX *
FORM 9000_END_OF_JOB.
CLOSE DATASET PARMS-DS_NAME.
ENDFORM.
FORM 1000_GET_SOURCE_DATA TABLES INP_DATA.
CALL FUNCTION 'Z_FILE_UPLOAD'
EXPORTING
UNIX = PARMS-UNIX
PC = PARMS-PC
FILETYPE = PARMS-DS_TYP
FILENAME = PARMS-PATH
HDR_LINES = PARMS-HDR_LINES
TABLES
DATA_TAB = INP_DATA
EXCEPTIONS
CONVERSION_ERROR = 1
FILE_OPEN_ERROR = 2
FILE_READ_ERROR = 3
INVALID_TABLE_WIDTH = 4
INVALID_TYPE = 5
NO_BATCH = 6
UNKNOWN_ERROR = 7
INVALID_SOURCE = 8
OTHERS = 9.
ENDFORM.
*eject
FORM 2000_WRITE_OUTPUT *
Write record in standard SAP structure to UNIX file *
--> I_STRUCT " Name of record passed as parameter *
*FORM 2000_WRITE_OUTPUT USING I_STRUCT."SRY28NOV05
FORM 2000_WRITE_OUTPUT USING I_STRUCT TYPE ANY. "SRY28NOV05
TRANSFER I_STRUCT TO PARMS-DS_NAME.
IF SY-SUBRC NE 0.
MESSAGE E004 WITH PARMS-DS_NAME.
MESSAGE A099.
ENDIF.
ENDFORM.
*eject
*& Form 2100_WS_DOWNLOAD
text *
--> p1 text
<-- p2 text
FORM 2100_WS_DOWNLOAD TABLES INP_DATA.Hi,
Thnaks for your reply, This is my requirement.
Here my problem is i am trying to upload the data from flatfile which contain materil number, denominator, Actual UOM, Nominator field values.
Which is the data i need to upload into MM02 and MM01, if material number is new then it has to create the material, if material is already existing it has to update the UOM values.
here i am getting data into my internal table INP_DATA, from that i am trying to upload the data to database by using job name MRP_MATERIAL_MASTER_DATA_UPLOAD with direct input program RMDATIND.
when i execute my program i am getting success message all the records writtin from flatfile to application server. and job started message.
then if i go into sm37 screen there i execute the job it is also giving active message. if i refresh it it is showing job completed message.
then i look at job log status. there i found that for existing material it is expecting material type, for new material it is giving some gravity error.
So could u help me in this it will be gr8.
Thanks & Regards,
RamNV -
JAVA arithmetic problem with double ?
If I try to work double precision numbers I get a unintelligible result, but what do I do wrong ?
Are there any inaccuracy in the JAVA double precision numbers arithmetic or what's the problem with this very simple example code ? How can I get correct result ?
Simple example code :
================
for (double i = 0; i < 10; i = i + 0.01)
System.out.println(i);
On the output :
===========
0.0
0.01
0.02
0.03
0.04
0.05
0.060000000000000005
0.07
0.08
0.09
0.09999999999999999
0.10999999999999999
0.11999999999999998
0.12999999999999998
0.13999999999999999
0.15
0.16
0.17
0.18000000000000002
0.19000000000000003
0.20000000000000004
0.21000000000000005
0.22000000000000006
0.23000000000000007
0.24000000000000007
0.25000000000000006
0.26000000000000006
0.2700000000000001
0.2800000000000001
0.2900000000000001
0.3000000000000001
0.3100000000000001
0.3200000000000001
0.3300000000000001
0.34000000000000014
0.35000000000000014
0.36000000000000015
0.37000000000000016
0.38000000000000017
0.3900000000000002
0.4000000000000002
0.4100000000000002
0.4200000000000002
0.4300000000000002
0.4400000000000002
0.45000000000000023
0.46000000000000024
0.47000000000000025
0.48000000000000026
0.49000000000000027
0.5000000000000002
0.5100000000000002
0.5200000000000002
0.5300000000000002
0.5400000000000003
0.5500000000000003
0.5600000000000003
0.5700000000000003
0.5800000000000003
0.5900000000000003
0.6000000000000003
0.6100000000000003
0.6200000000000003
0.6300000000000003
0.6400000000000003
0.6500000000000004
0.6600000000000004
0.6700000000000004
0.6800000000000004
0.6900000000000004
0.7000000000000004
0.7100000000000004
0.7200000000000004
0.7300000000000004
0.7400000000000004
0.7500000000000004
0.7600000000000005
0.7700000000000005
0.7800000000000005
0.7900000000000005
0.8000000000000005
0.8100000000000005
0.8200000000000005
0.8300000000000005
0.8400000000000005
0.8500000000000005
0.8600000000000005
0.8700000000000006
0.8800000000000006
0.8900000000000006
0.9000000000000006
0.9100000000000006
0.9200000000000006
0.9300000000000006
0.9400000000000006
0.9500000000000006
0.9600000000000006
0.9700000000000006
0.9800000000000006
0.9900000000000007
1.0000000000000007
1.0100000000000007
1.0200000000000007
1.0300000000000007
1.0400000000000007
1.0500000000000007
1.0600000000000007
1.0700000000000007
1.0800000000000007
1.0900000000000007
1.1000000000000008
1.1100000000000008
1.1200000000000008
1.1300000000000008
1.1400000000000008
1.1500000000000008
1.1600000000000008
1.1700000000000008
1.1800000000000008
1.1900000000000008
1.2000000000000008
1.2100000000000009
1.2200000000000009
1.2300000000000009
1.2400000000000009
1.2500000000000009
1.260000000000001
1.270000000000001
1.280000000000001
1.290000000000001
1.300000000000001
1.310000000000001
1.320000000000001
1.330000000000001
1.340000000000001
1.350000000000001
1.360000000000001
1.370000000000001
1.380000000000001
1.390000000000001
1.400000000000001
1.410000000000001
1.420000000000001
1.430000000000001
1.440000000000001
1.450000000000001
1.460000000000001
1.470000000000001
1.480000000000001
1.490000000000001
1.500000000000001
1.5100000000000011
1.5200000000000011
1.5300000000000011
1.5400000000000011
1.5500000000000012
1.5600000000000012
1.5700000000000012
1.5800000000000012
1.5900000000000012
1.6000000000000012
1.6100000000000012
1.6200000000000012
1.6300000000000012
1.6400000000000012
1.6500000000000012
1.6600000000000013
1.6700000000000013
1.6800000000000013
1.6900000000000013
1.7000000000000013
1.7100000000000013
1.7200000000000013
1.7300000000000013
1.7400000000000013
1.7500000000000013
1.7600000000000013
1.7700000000000014
1.7800000000000014
1.7900000000000014
1.8000000000000014
1.8100000000000014
1.8200000000000014
1.8300000000000014
1.8400000000000014
1.8500000000000014
1.8600000000000014
1.8700000000000014
1.8800000000000014
1.8900000000000015
1.9000000000000015
1.9100000000000015
1.9200000000000015
1.9300000000000015
1.9400000000000015
1.9500000000000015
1.9600000000000015
1.9700000000000015
1.9800000000000015
1.9900000000000015
2.0000000000000013
2.010000000000001
2.020000000000001
2.0300000000000007
2.0400000000000005
2.0500000000000003
Thanks for answerers !
JosephThis result is entirely unsurprising, and the flaw lies in your program, not in Java.
Java represents numbers in 2's complement [SEM] form (read the Java Language Specification (JLS), according to agreed standards. When you specify a fractional number that appears to be nice and easy to work with, you are thinking in decimal notation, not binary, and you are giving it a number that cannot be precisely represented. It is a little like asking you to write down exactly what pi is (all its digits ;-)).
So the number you get is not precisely what you asked for (one very insignificant error). But then you compound it by adding an inaccurately represented number to an inaccurately represented number, and so on, until the bit errors combine to make a very inaccurate number.
The correct way to approach what you are trying to do would be to perform the addition using integers, and multiply each time you want to scale it to a double.
This has been asked many times - I would suggest you:
- Search the forums
- Check out the language spec
- or do a degree in CompSci :-)
A calculator is a little more accurate because it does not have to conform to agreed standards, and so can use special logic to minimise such errors. The average pocket calulator also works to a much lower level of accuracy (usu 8 digits), and therefore masks the errors to you. You'd find that you got the same effect if you played with it long enough.
Hope this helps -
Java installation problem with N95
Hi!
did anyone experience this?
i can't install any java file (.jar or .jad) to my n95.
i was able to install any jar app but suddenly i can't install any jar file
any ideas?
i tried to install both to memory card or to phone memory.
while the installation bar is in progress suddenly an alert says "unable to install"...
i have no problem with sys and sysx files...I had same problem. Here's where...
http://java.sun.com/j2se/1.4.2/system-configurations.html
Supported System Configurations
JavaTM 2 Platform, Standard Edition
Version 1.4.2
These configurations apply to both the Java 2 SDK and Java 2 Runtime Environment (J2RE).
IA32 Windows
System Requirements
32-bit: SDK J2RE
Windows 98 (1st & 2nd Editions) Windows Active & Classic Desktop -
Java API, problem with secondary keys using multi key creator
Hi,
I'm developing an application that inserts a few 100k or so records into a Queue DB, then access them using one of four Hash SecondaryDatabases. Three of these secondary dbs use a SecondaryMultiKeyCreator to generate the keys, and one uses a SecondaryKeyCreator. As a test, I'm trying to iterate through each secondary key. When trying to iterate through the keys of any of the secondary databases that use a SecondaryMultiKeyCreator, I have problems. I'm attempting to iterate through the keys by:
1: creating a StoredMap of the SecondaryDatabase
2: getting a StoredKeySet from said map
3: getting a StoredIterator on said StoredKeySet
4: iterate
The first call to StoredIterator.next() fails at my key binding (TupleBinding) because it is only receiving 2 bytes of data for the key, when it should be getting more, so an Exception is thrown. I suspected a problem with my SecondaryMultiKeyCreator, so I added some debug code to check the size of the DatabaseEntries it creates immediately before adding them to the results key Set. It checks out right. I also checked my key binding like so:
1: use binding to convert the key object to a DatabaseEntry
2: use binding to convert the created DatabaseEntry back to a key object
3: check to see if the old object contains the same data as the new one
Everything checked out ok.
What it boils down to is this: my key creator is adding DatabaseEntries of the correct size to the results set, but when the keys are being read back later on, my key binding is only receiving 2 bytes of data. For the one SecondaryDatabase that doesn't use a SecondaryMultiKeyCreator, but just a SecondaryKeyCreator, there are no issues and I am able to iterate through its secondary keys as expected.
EDIT: New discovery: if I only add ONE DatabaseEntry to the results set in my SecondaryMultiKeyCreator, I am able to iterate through the keys as I would like to.
Any ideas or suggestions?
Thank you for your attention,
-Justin
Message was edited by:
SteamrollerHi Justin,
Sorry about the delayed response here. I have created a patch that resolves the problem.
If you apply the patch to your 4.6.21 source tree, and then rebuild Berkeley DB, the improper behavior should be resolved.
Regards,
Alex
diff -rc db/db_am.c db/db_am.c
*** db/db_am.c Thu Jun 14 04:21:30 2007
--- db/db_am.c Fri Jun 13 11:20:28 2008
*** 331,338 ****
F_SET(dbc, DBC_TRANSIENT);
! switch (flags) {
! case DB_APPEND:
* If there is an append callback, the value stored in
* data->data may be replaced and then freed. To avoid
--- 331,337 ----
F_SET(dbc, DBC_TRANSIENT);
! if (flags == DB_APPEND && LIST_FIRST(&dbp->s_secondaries) == NULL) {
* If there is an append callback, the value stored in
* data->data may be replaced and then freed. To avoid
*** 367,388 ****
- * Secondary indices: since we've returned zero from an append
- * function, we've just put a record, and done so outside
- * __dbc_put. We know we're not a secondary-- the interface
- * prevents puts on them--but we may be a primary. If so,
- * update our secondary indices appropriately.
- * If the application is managing this key's data, we need a
- * copy of it here. It will be freed in __db_put_pp.
- DB_ASSERT(dbenv, !F_ISSET(dbp, DB_AM_SECONDARY));
- if (LIST_FIRST(&dbp->s_secondaries) != NULL &&
- (ret = __dbt_usercopy(dbenv, key)) == 0)
- ret = __db_append_primary(dbc, key, &tdata);
* The append callback, if one exists, may have allocated
* a new tdata.data buffer. If so, free it.
--- 366,371 ----
*** 390,401 ****
/* No need for a cursor put; we're done. */
goto done;
! default:
! /* Fall through to normal cursor put. */
! break;
! if (ret == 0)
ret = __dbc_put(dbc,
key, data, flags == 0 ? DB_KEYLAST : flags);
--- 373,379 ----
/* No need for a cursor put; we're done. */
goto done;
! } else
ret = __dbc_put(dbc,
key, data, flags == 0 ? DB_KEYLAST : flags);
diff -rc db/db_cam.c db/db_cam.c
*** db/db_cam.c Tue Jun 5 21:46:24 2007
--- db/db_cam.c Thu Jun 12 16:41:29 2008
*** 899,905 ****
DB_ENV *dbenv;
DB dbp, sdbp;
DBC dbc_n, oldopd, opd, sdbc, *pdbc;
! DBT olddata, oldpkey, newdata, pkey, temppkey, tempskey;
DBT all_skeys, skeyp, *tskeyp;
db_pgno_t pgno;
int cmp, have_oldrec, ispartial, nodel, re_pad, ret, s_count, t_ret;
--- 899,905 ----
DB_ENV *dbenv;
DB dbp, sdbp;
DBC dbc_n, oldopd, opd, sdbc, *pdbc;
! DBT olddata, oldpkey, newdata, pkey, temppkey, tempskey, tdata;
DBT all_skeys, skeyp, *tskeyp;
db_pgno_t pgno;
int cmp, have_oldrec, ispartial, nodel, re_pad, ret, s_count, t_ret;
*** 1019,1026 ****
* should have been caught by the checking routine, but
* add a sprinkling of paranoia.
! DB_ASSERT(dbenv, flags == DB_CURRENT || flags == DB_KEYFIRST ||
! flags == DB_KEYLAST || flags == DB_NOOVERWRITE);
* We'll want to use DB_RMW in a few places, but it's only legal
--- 1019,1027 ----
* should have been caught by the checking routine, but
* add a sprinkling of paranoia.
! DB_ASSERT(dbenv, flags == DB_APPEND || flags == DB_CURRENT ||
! flags == DB_KEYFIRST || flags == DB_KEYLAST ||
! flags == DB_NOOVERWRITE);
* We'll want to use DB_RMW in a few places, but it's only legal
*** 1048,1053 ****
--- 1049,1107 ----
goto err;
have_oldrec = 1; /* We've looked for the old record. */
+ } else if (flags == DB_APPEND) {
+ /*
+ * With DB_APPEND, we need to do the insert to populate the
+ * key value. So we swap the 'normal' order of updating
+ * secondary / verifying foreign databases and inserting.
+ *
+ * If there is an append callback, the value stored in
+ * data->data may be replaced and then freed. To avoid
+ * passing a freed pointer back to the user, just operate
+ * on a copy of the data DBT.
+ */
+ tdata = *data;
+ /*
+ * If this cursor is going to be closed immediately, we don't
+ * need to take precautions to clean it up on error.
+ */
+ if (F_ISSET(dbc_arg, DBC_TRANSIENT))
+ dbc_n = dbc_arg;
+ else if ((ret = __dbc_idup(dbc_arg, &dbc_n, 0)) != 0)
+ goto err;
+
+ pgno = PGNO_INVALID;
+
+ /*
+ * Append isn't a normal put operation; call the appropriate
+ * access method's append function.
+ */
+ switch (dbp->type) {
+ case DB_QUEUE:
+ if ((ret = __qam_append(dbc_n, key, &tdata)) != 0)
+ goto err;
+ break;
+ case DB_RECNO:
+ if ((ret = __ram_append(dbc_n, key, &tdata)) != 0)
+ goto err;
+ break;
+ default:
+ /* The interface should prevent this. */
+ DB_ASSERT(dbenv,
+ dbp->type == DB_QUEUE || dbp->type == DB_RECNO);
+
+ ret = __db_ferr(dbenv, "DBC->put", 0);
+ goto err;
+ }
+ /*
+ * The append callback, if one exists, may have allocated
+ * a new tdata.data buffer. If so, free it.
+ */
+ FREE_IF_NEEDED(dbenv, &tdata);
+ pkey.data = key->data;
+ pkey.size = key->size;
+ /* An append cannot be replacing an existing item. */
+ nodel = 1;
} else {
/* Set pkey so we can use &pkey everywhere instead of key. */
pkey.data = key->data;
*** 1400,1405 ****
--- 1454,1465 ----
skip_s_update:
+ * If this is an append operation, the insert was done prior to the
+ * secondary updates, so we are finished.
+ */
+ if (flags == DB_APPEND)
+ goto done;
+ /*
* If we have an off-page duplicates cursor, and the operation applies
* to it, perform the operation. Duplicate the cursor and call the
* underlying function. -
Problem with standard Routine "Seniority"
Hi gurus,
I have a problem with the routine "Seniority" that evaluate the length of service for the infoObject 0SRVCLEN - Length of Service. It is a standard routine in the update rule 0HR_PA_0.
The problem occurs when the Employee has less than a year of service. The result of the routine is "0" but in the BW query "0" is interpreted like "#" - Not assigned.
How can I change the value of the Not assigned result?
This is the main part of the routine:
IF NOT EMPLOYEE_WA-ENTRYDATE IS INITIAL.
RESULT = ULTIMO0(4) - EMPLOYEE_WA-ENTRYDATE0(4).
IF ULTIMO4(4) LT EMPLOYEE_WA-ENTRYDATE4(4).
RESULT = RESULT - 1.
endif.
ENDIF.
Thanks
AlbertoSonal,
To find the number of items please correct the code as below:
Determine number of PO item lines
LOOP AT TKOMV WHERE<b> KNUMV = TKOMV-KNUMV</b>
AND NOT KPOSN IS INITIAL.
AT NEW KPOSN.
I = I + 1.
ENDAT.
ENDLOOP.
Keep rest all code as it is.
Let me know if this works,
Thanks. -
Java/OpenJDK problem with OSS/osspd/ALSA/pulseaudio [SOLVED]
I've got problems with sound output of java programs, which usually try to hog /dev/dsp, using pulseaudio and openjdk 7.
Some rare java apps' sound methods surprisingly do work. Others (which the majority of java programs seem to use) do not. In Sun Java I could make those work by using 'padsp', however this method apparently fails on Archlinux with both latest Oracle Java (formerly worked on Ubuntu w/ Sun Java 6) and with OpenJDK too.
So I tried 'osspd' (package is called 'ossp') and it shows the root process "/usr/sbin/osspd --dsp-slave=/usr/sbin/ossp-padsp" been started, but the java applications will still not provide sound which I find pretty odd. I tried adding 'soundcore.preclaim_oss=0' to the 'kernel..' line in my grub's menu.lst, but that didn't help either.
Last edited by Jindur (2012-05-20 02:59:20)It's been quite a while, but I finally found a solution (read: big ugly hack).
Someone literally created a biguglyhack and posted it here:
http://lifein19x19.com/forum/viewtopic. … 243#p98243
(downloadable file there: javadummymixer_biguglyhack.zip [12.97 KiB] -> rename it from .zip to .jar and move it into your java's lib/ext folder -> profit!)
I applied it to OpenJDK 6 (should be same for 7 though) and all my java sound works flawlessly now, with pulseaudio, without any need for padsp stuff or osspd or whatever.
My sound.properties file reads:
javax.sound.sampled.Clip=com.sun.media.sound.DirectAudioDeviceProvider
javax.sound.sampled.Port=com.sun.media.sound.PortMixerProvider
javax.sound.sampled.SourceDataLine=com.sun.media.sound.DirectAudioDeviceProvider
javax.sound.sampled.TargetDataLine=com.sun.media.sound.DirectAudioDeviceProvider
but actually I'm not sure whether that even matters at all.
(Side note: The linked thread also mentions a "-D.sun.." command-line parameter that supposedly forces java to avoid disfunctional audio methods. The above biguglyhack however worked for me without any need of applying that command-line parameter.)
Last edited by Jindur (2012-05-20 02:58:05) -
Problem with tokenized input from command line
I am trying to take an input from the command line, parse it to tokens and perform whatever operation is needed depending on the name of the token, on a binary tree of stacks for example, if i type 1 2 1 3 printLevelOrder, then the root of the tree should have 3, 2,1 in the stack, the left child should have 1 and the right child should be empty. and then a level order print of the tree should be performed.
however what is happening when i run this code is the numbers are being put into the right stacks of the tree, but any commands such as printLevelOrder or PrintPopRoot are entering the code that is for placing numbers onto the stack instead of executing that command and skipping past this piece of code.
so my question is, why is the if statement if (word =="printLevelOrder") not being executed when thats whats in the word ?
example input and output shown below code fragment.
try {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
String line = "";
while (line != "***") {
System.out.print("> prompt ");
line = in.readLine();
StringTokenizer tokenizer = new StringTokenizer(line," ");
String word = new String();
while (tokenizer.hasMoreTokens()) {
word = tokenizer.nextToken();
boolean notCommand = true;
if (word =="printLevelOrder") {
theTree.printLevelOrder();
System.out.println("(word ==printLevelOrder)");
notCommand=false;
if (word == "printPopLevelOrder") {
theTree.printPopLevelOrder();
notCommand=false;
if (word == "printPopInorder") {
theTree.printPopInorder();
notCommand=false;
if (word == "printPopPreorder") {
theTree.printPopPreorder();
notCommand=false;
if (word == "printPopRoot") {
theTree.printPopRoot();
notCommand=false;
if (word == "***") {
notCommand=false;
if (notCommand == true) {
System.out.println("(notCommand == true)");
boolean notPlaced = true;
int v = 1;
while ((notPlaced==true) && (v < theTree.size())) {
if (theTree.element(v).isEmpty()) {
theTree.element(v).push(Integer.valueOf(word));
System.out.println("Inserting"+word);
System.out.println("in empty stack at location: "+v);
notPlaced=false;
if (notPlaced==true) {
if ( Integer.valueOf(word) >= Integer.valueOf( theTree.element(v).top().toString() ) ) {
theTree.element(v).push(Integer.valueOf(word));
System.out.println("Inserting"+word);
System.out.println("in stack at location: "+v);
notPlaced=false;
v++;
}valid inputs: int value, printLevelOrder, printPopLevelOrder, printPopInorder, p
rintPopPreorder, printPopRoot, *** to quit
prompt 1 3 2 4 2 printLevelOrder(notCommand == true)
Inserting1
in empty stack at location: 1
(notCommand == true)
Inserting3
in stack at location: 1
(notCommand == true)
Inserting2
in empty stack at location: 2
(notCommand == true)
Inserting4
in stack at location: 1
(notCommand == true)
Inserting2
in stack at location: 2
(notCommand == true)
Exception in thread "main" java.lang.NumberFormatException: For input string: "printLevelOrder"
at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
at java.lang.Integer.parseInt(Integer.java:447)
at java.lang.Integer.valueOf(Integer.java:553)
at TreeStack.main(TreeStack.java:73)
Press any key to continue . . .lol aww, shame that you forgot to do that. i had 10 / 10 for mine, and seing as the deadline is now well and trully over,
here is the entire source for anybody who was following the discussion or whatever and wanted to experiment.
additional files needed >
http://users.cs.cf.ac.uk/Paul.Rosin/CM0212/Stack.java
http://users.cs.cf.ac.uk/Paul.Rosin/CM0212/ArrayStack.java
http://users.cs.cf.ac.uk/Paul.Rosin/CM0212/StackEmptyException.java
http://users.cs.cf.ac.uk/Paul.Rosin/CM0212/StackFullException.java
/*TreeStack.java - reads command line input of values and assigns them to stacks in a binary tree and performs
operations on the ADT. valid inputs: <int>, printLevelOrder, printPopLevelOrder,
printPopInorder, printPopPreOrder, printPopRoot. Terminates on invalid input.
Written by George St. Clair.
S/N:0208456 22/11/2005
import java.util.Vector;
import java.io.*;
import java.util.StringTokenizer;
public class TreeStack {
private final int TREE_CAPACITY = 7 + 1;
private final int STACK_CAPACITY = 10;
Vector tree = new Vector(TREE_CAPACITY) ;
//collect input from command line, add values to stacks at nodes of the teee
//and perform required operations on the treestack
public static void main (String [] args) {
//create a tree of stacks
TreeStack theTree = new TreeStack ();
try {
//collect standard input
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
String line = "";
while (line != null) {
System.out.print("");
line = in.readLine();
//tokenise input
StringTokenizer tokenizer = new StringTokenizer(line," ");
String word = new String();
while (tokenizer.hasMoreTokens()) {
//assign word to the token
word = tokenizer.nextToken();
boolean notCommand = true;
//perform operation on treestack depending on what word is
if (word.equals("printLevelOrder")) {
System.out.println("printLevelOrder");
theTree.printLevelOrder();
notCommand=false;
if (word.equals("printPopLevelOrder")) {
System.out.println("printPopLevelOrder");
theTree.printPopLevelOrder();
notCommand=false;
if (word.equals("printPopInorder")) {
System.out.println("printPopInorder");
theTree.printPopInorder();
notCommand=false;
if (word.equals("printPopPreorder")) {
System.out.println("printPopPreorder");
theTree.printPopPreorder();
notCommand=false;
if (word.equals("printPopRoot")) {
System.out.println("printPopRoot");
theTree.printPopRoot();
notCommand=false;
//if word was not a command it must be a number
if (notCommand == true) {
boolean notPlaced = true;
int v = 1;
//starting at the root, find suitable place for number
while ((notPlaced==true) && (v < theTree.size())) {
//if the stack at v is empty, number goes here
if (theTree.element(v).isEmpty()) {
theTree.element(v).push(Integer.valueOf(word));
System.out.println("inserting: "+word);
System.out.println("in empty stack at location: "+(v-1));
notPlaced=false;
//if the stack is not empty
if (notPlaced==true) {
//if the value on the top of the stack is smaller than number, number goes onto the stack
if ( Integer.valueOf(word) > Integer.valueOf( theTree.element(v).top().toString() ) ) {
theTree.element(v).push(Integer.valueOf(word));
System.out.println("inserting: "+word);
System.out.println("in stack at location: "+(v-1));
notPlaced=false;
//if that node was no good, check the next one for suitability
v++;
catch (Exception e) {
//occurs when user inputs something that is neither a command, or a number, or upon EOF, or stack is full
public TreeStack () {
//create the TreeStack ADT by adding stacks in the vector, note vector 0 is instantiated but not used.
for (int i = 1;i<=TREE_CAPACITY;i++)
tree.add(new ArrayStack(STACK_CAPACITY));
public int size() {
//return the size of the tree +1 (as 0 is not used)
return tree.size();
public ArrayStack element (int v) {
//return the ArrayStack at v
return (ArrayStack)tree.get(v);
public int leftChild (int v ) {
//return left child of v
return v*2;
public int rightChild (int v ) {
//return the right child of v
return v*2+1;
public boolean children (int v ) {
//search for children of v and return true if one exists
for (int i =v;i<size();i++) {
if (i/2==v ) {
//left child found at i
return true;
if ((i-1)/2==v ) {
//right child found at i
return true;
//no children found
return false;
public boolean isInternal (int v ) {
//test whether node v is internal (has children)
if (children (v)== true) {
//has children
return true;
return false;
//print the top value in each stack encountered on a level-order traversal of tree
public void printLevelOrder() {
//for every node of tree v
for (int v = 1;v<size();v++) {
if (!element(v).isEmpty() ) {
//print the top value in stack v
System.out.println(" "+element(v).top());
else {
//stack at v is empty
System.out.println(" -");
//pop off and print the top value in each stack encountered on a level-order traversal of tree
public void printPopLevelOrder () {
//pop off and print the top value in stack v
for (int v = 1;v<size();v++) {
//for each node of tree v
if (!element(v).isEmpty() ) {
//if v isnt empty print the top value in stack v
System.out.println(" "+element(v).top());
//pop the top value in the stack at v
element(v).pop();
else {
//stack at v is empty
System.out.println(" -");
//pop off and print the top value in each stack encountered on an in-order traversal of tree
public void printPopInorder () {
printPopInorder (1);
public void printPopInorder (int v) {
boolean isInternal = false;
if (isInternal (v)) {
//use a boolean for isInternal to save on running the method twice
isInternal = true;
//recursively search left subtree
printPopInorder (leftChild(v));
//pop off and print the top value at v
if (element(v).isEmpty() ) {
//stack at v is empty
System.out.println(" -");
else {
//if v isnt empty print the top value in stack v then pop
System.out.println(" "+element(v).top());
element(v).pop();
if (isInternal ) {
//recursively search right subtree
printPopInorder (rightChild(v));
//pop off and print the top value in each stack encountered on an pre-order traversal of tree
public void printPopPreorder() {
printPopPreorder(1);
public void printPopPreorder(int v) {
//pop off and print the top value at v
if (!element(v).isEmpty() ) {
//if v isnt empty print the top value in stack v then pop
System.out.println(" "+element(v).top());
element(v).pop();
else {
//stack at v is empty
System.out.println(" -");
if (isInternal (v)) {
//recursively search left and right subtrees
printPopPreorder (leftChild(v));
printPopPreorder (rightChild(v));
//pop off and print all values from the stack at the root
public void printPopRoot (){
//while the root stack has values left
while (!element(1).isEmpty()) {
//print, then pop
System.out.println(" "+element(1).top());
element(1).pop();
} -
Problem with midi input in Mainstage
Hi all,
I have a keyboard connected to my mac via USB midi interface.
When I'm trying to play midi instruments in Garage Band - it works very well, no significant latency and no other problems.
But in Mainstage the situation with the midi input is different. When I press a key on my keyboard, it plays the sound, then stops responding to other midi commands for about 2-3 seconds. And then after I press another key, it plays it, and stops responding again.
The "CPU" and "Memory" indicators at the top show a low load.
All in all, it's just impossible to play a midi instrument in Mainstage.
As the midi interface is working correctly in GarageBand and doesn't work well in Mainstage, I suspect that it's a Mainstage's software problem. But I haven't found anything like that on the Internet. Any ideas?
Devices: Macbook Pro 13" (2011), M-Audio MidiSport Uno...
Thanks!I can input Chinese in Firefox, but there are
problems with the display of characters in input
fields for searches, etc.
Can you provide a specific example of a particular search box (url) and exactly what the "problem" is (TC or SC, characters involved, etc)? I would like to try and duplicate it. Perhaps the encoding in View > Text Encoding needs to be adjusted for that page for some reason (though normally that should affect all browsers).
Since Apple has nothing to do with FireFox, you might want to report the issue to the people responsible for that program (mozilla.org I think), since it may be a bug they can fix. -
Problems with Standard Apps views (eBusiness Suite)
Hi all,
I am working with Oracle Application Express and Oracle eBusiness Suite 11.5.10. We have integrated OAE with EBS, but now we are having problems with the standard views (owner APPS).
I would need the help from somebody that works with OAE and EBS.
Once we want to query one of the standard views, like ap_invoices, it is necessary to initialize the session with a script like this:
begin
DBMS_APPLICATION_INFO.SET_CLIENT_INFO(219);
end;
This script lets us to access to the data from the table AP_INVOICES_ALL using the view AP_INVOICES.
Once I have run the script from SQL Commands (SQL Workshop), I try to run a query using the standard view, for example:
SELECT * FROM apps.ap_invoices
From a Report or from SQL Commands (SQL Workshop) always I get the next error:
"ORA-01722: invalid number."
However, if I run this query from SQL Plus (same db user), there is any problem, the query works and retrieves rows.
If I get the source code of the view, remove all the columns, keeping the next SQL:
SELECT 1
FROM ap.AP_INVOICES_ALL
WHERE NVL(ORG_ID,NVL(TO_NUMBER(DECODE(SUBSTRB(USERENV('CLIENT_INFO'),1,1),' ',NULL,SUBSTRB(USERENV('CLIENT_INFO'),1,10))),-99)) = NVL(TO_NUMBER(DECODE(SUBSTRB(USERENV('CLIENT_INFO'),1,1),' ',NULL,SUBSTRB(USERENV('CLIENT_INFO'),1,10))),-99)
Run this SQL in OAE and I obtain the error again, however from SQL Plus the query works correctly.
I suppose somebody that works this EBS and OAE has had this problem. How did you solve it?
Thanks in advance.
Regards, Luis
PD. I have tried to not used the views and use the tables filtering the ORG_ID and looks it can work, but I do not like this option.Luis - I don't know where you are running these blocks - the SQL Command Processor in APEX? Anyway, for every APEX page request the engine executes something like the following, depending on your version: begin
dbms_application_info.set_client_info(g_user);
dbms_session.set_identifier(substr(g_user,1,(64 - length(g_instance)-1))||':'||to_char(g_instance));
dbms_application_info.set_module('APEX:APPLICATION '||to_char(g_flow_id),'PAGE '||to_char(g_flow_step_id));
exception when others then null;
end;In the above code, the value of g_user is the logged-in username, perhaps ADMIN in your case.
Keep in mind that when you do a set_client_info in the database session, that persists only for the duration of the session. On the next page request, you'll get a new database session (or a recycled one).
Scott -
Problems with standard checkings
Hi,
We'd like to know if someone has worked in a proyect with two different Systems S1 and S2, data cannot be copied (transfered) from one to the other but we must check data from system S1 refering to data in tables in system S2.
This scenario is a problem when standard checkings are done in the tables, due to of course checkings are done over tables of current system.
Do anybody know how to manage standar checkings in current system S1 to allow the checkings against tables in system S2?
Thank u very much !!!!!!!!
Best Regards.The solution was proposed from another point of view. Thanks to all for your help.
Best Regards. -
Problem with sound input/output settings
Hello--
Last night, my iBook suddenly stopped playing any sounds at all: itunes, CDs, etc, won't play at all. I looked in system preferences/sound, and the computer told me that there are no input or output devices at all. What's more, the sound seems to me on permanent mute, and it won't allow me to change it at all (F4 and F5 functions just show a "mute" sign under the volume bar). Is this a problem with the software, hardware, or what? Thanks in advance for any advice,
JB Colemanhere is a set of weird but probable solutions. Good luck
Solutions -
Problem with increasing input field length in module pool programming.
Hi All,
I have created a screen in which i have used table control wizard. In my table control I have an input field. The problem is, this input filed only takes 23 inputs at a time. I need to make this field unfixed. This is an quantity field. I am not understanding why this is happening. Can anybody plz help me in this regard ?
Thanks in advance.
Tripod.HI Tripod ,
YOu can add Lines to Table control .
Add one button by name ADD LINES : give func code 'ADD'
IN PBO ...
if it_mat[] is not initial .
describe table it_mat lines ln .
tab_ctrl-lines = ln .
endif.
case sy-ucomm .
when 'ADD' .
perform add_lines .
endcase .
form add_lines .
ln = ln + 1 .
clear it_mat .
append initial line to it_mat .
endform .
regards
deepak.
Maybe you are looking for
-
How to change the default time?
when you finish the action of dialing ,the CCM system recognize your finish after 10s .How to change the default time in Service Parameters ,which is the detail Parameters ?
-
Since new iTunes version, iPhone is no longer scyncing with Outlook. Any help?
No problem wiht previous iTunes version.
-
HP psc 1315 not detected as scanner on MacBook Pro Mac OSX 10.8.2
I just got a new MacBook Pro in September. I have the newest Software update Mac OS X Version 10.8.2, and I am attempting to scan from my hp psc 1315 all-in-one printer-scanner-copier to this computer. I am using the USB connector that came stock wit
-
MIR7 Park an not GR'd document with line item reference
Hi I have also left this message in the MM forum. Scenario 1 is how the system currently works, scenario 2 is what we want to achieve, so Parked, unreciepted document but would like the line item details to appear in MIR7 so we an trace it and report
-
How to create our own XML Schema (.xsd) in Weblogic WorkShop
Hi, I am new to Weblogic Workshop.I want to create one xml schema with custom elements. when I am creating a file xml schema(.xsd).The file contains default namespace and no child elements in it.I don't know how to add elements to that file. please t