PM and PP integeration
Dear PM experts,
I want to do integrate PM and PP so that when there is a preventive maintenance order or any maintenance order on a specific equipment , any production order should be blocked, i know that i should attach the pp w/c to the equipment location what else should i do? Putting into consideration that a PP w/c might be a group of Equipments and i want this equipment only to be blocked not the whole W/C
Thank you in advance
For anyone who find this thread , the solution is:
A) PM should do the following:
1- in configuration maintain system conditions to be reserved by PM by the path :
spro-> PM & CS->maintenance and service processing->maintenance and service order->general data->create system conditions and make 0 reserved by PM
2- in the equipment location tab please insert the production work center
3- in your maintenance order please make the system condition 0
B) PP will do:
In transaction OIOI for both business view 1 &2 in capacity availabilty un flag the no check and and make the collect conversion 3.
...This is what solved my issue and it took alot of searching to get it so i shared it with you hope it helps ..
Similar Messages
-
Determining Largest and Smallest integers, without creating multiple ints
I created a program that reads a list of numbers (doubles) terminated by a sentinal value, and outputs the average. The do-while statement with the sentinal value termination uses only one specified integer, changed with the input of each new number. Now without specifying more integers is there a way i can determine the largest and smallest number on the list?
import java.util.*;
public class LabThree
public static void main(String[] args)
Scanner keyboard = new Scanner(System.in);
int totaldoubles, max, min;
double total, nextnum;
String answer;
do
System.out.println();
System.out.println("Enter a list of nonnegative integers");
System.out.println("When you are finished with the list, enter a negative number");
System.out.println();
System.out.println("I will tell you the largest and smallest integer");
System.out.println("and give you the average the list");
totaldoubles = 0 ;
total = 0;
nextnum = keyboard.nextDouble();
while (nextnum >= 0)
total = total + nextnum;
totaldoubles++;
nextnum = keyboard.nextDouble();
if (totaldoubles > 0)
System.out.println("The average is: " + (total/totaldoubles));
else
System.out.println("No scores to average");
System.out.println();
System.out.println("Do you want to average another list?");
System.out.println("Enter Yes or No");
answer = keyboard.next();
}while (answer.equalsIgnoreCase("yes"));
}Message was edited by:
thecynicle1
Message was edited by:
thecynicle1ok i tried this:
import java.util.*;
public class LabThree
public static void main(String[] args)
Scanner keyboard = new Scanner(System.in);
int totaldoubles;
double total, nextnum, max, min;
String answer;
do
System.out.println();
System.out.println("Enter a list of nonnegative integers");
System.out.println("When you are finished with the list, enter a negative number");
System.out.println();
System.out.println("I will tell you the largest and smallest integer");
System.out.println("and give you the average the list");
totaldoubles = 0 ;
total = 0;
nextnum = keyboard.nextDouble();
max = nextnum;
min = nextnum;
while (nextnum >= 0)
total = total + nextnum;
totaldoubles++;
nextnum = keyboard.nextDouble();
if (nextnum > max)
max = nextnum;
else if (nextnum < min)
min = nextnum;
if (totaldoubles > 0)
System.out.println("The average is: " + (total/totaldoubles));
System.out.println("The largest number was: " + max);
else
System.out.println("No scores to average");
System.out.println();
System.out.println("Do you want to average another list?");
System.out.println("Enter Yes or No");
answer = keyboard.next();
}while (answer.equalsIgnoreCase("yes"));
But now the compiler is saying that the underlined "else" is without an if
Message was edited by:
thecynicle1
Message was edited by:
thecynicle1
Message was edited by:
thecynicle1 -
Time remapping and non integers
why does premiere occasionally decide to make make your timeline based remapping a non whole number? Why does it stick? How do you get rid of it?
Currently got a clip which goes from whole number to 50.26, I can change it, I'm going to have to delete that keyframe and re-do all the others that come after it. NiceFor several years I "carried the flag" for requesting that Time Remapping be included in PPro, since I (and I'm sure others) used it frequently in AE. Then, when it was finally added and they completely changed this effect/workflow from the way it is done in AE, it was a major disappointment.
Time Remapping in PPro is really klunky and reminds me of the Premiere 6.5 interface. In AE you simply add a keyframe and ramp the time up or down...copy/paste keyframes...and audio gets mapped too. I also like filling a section of the timeline and then NOT having my clip change length when adjusting TR.
The real head shaker was that this was done when Adobe was emphasizing "seamless integration" between the suite....and TR in PPro wasn't even recognized in AE when released. I don't mean to rant, because Adobe has made great strides in the last couple realeases, but this one was tough...a very fundamental aspect of the editing workflow, that was not made consistent across the two apps.
I would really, really like to see "Time Remapping AE" added to PPro, or possibly just a modification to this effect in a future release.
And looking at PPro now, I think the "Effects Controls" window in general will likely be redesigned to be more elegant and responsive as well. TR is a good example of how working in this window can be pretty laborious. -
Code returns "null" and "0"s in main module - why?
I am coding a program that is in two modules. The main module serves it's standard function. The inventory class/module has three functions - 1) request stock input on 4 data points (1 String and 3 integers, one of which is a double) - 2) calculate the value of the inventory, and - 3) return string which reads out the 4 data points and the calculation showing the total value of the inventory. I've created the 3 functions in the inventory class/module, but obviously don't have them referring to each other correctly because when we come to the end of the program the output is null for the String and "0"s for the int/doubles. The code is below - any ideas about how to overcome the empty output? The code compiles fine and acts like it is going to work, but when it comes to the final command line it outputs
"null, which is item number 0, has 0 currently in stock at a price of 0.00 each. The total value of inventory in stock is 0.00"
Main module:
public class Main {
@SuppressWarnings("static-access")
public static void main(String[] args) {
Inventory inventory = new Inventory(); //call Inventory class
inventory.inventoryInput();
Inventory results = new Inventory();
results.inventoryResults(); //call for inventoryResults in Inventory class
}Inventory module:
import java.util.Scanner;
import static java.lang.System.out;
public class Inventory
//declare and initialize variables
int itemNumber = 0;
String productName;
int stockAmount = 0;
double productCost = 0;
double totalValue = 0;
String inventoryResults;
//initialize scanner
Scanner input = new Scanner(System.in);
public void inventoryInput ()
out.println("Please enter item number: "); //prompt for item number
itemNumber = input.nextInt();
out.println( "Enter product name/description: "); //prompt for product name
productName = input.next();
out.println("Quantity in stock: ");
stockAmount = input.nextInt(); // prompt for stock quantity
out.println("What is the product cost for each unit? ");
productCost = input.nextDouble(); // prompt for product cost
} // end inventoryInput
public double totalValue( double stockAmount, double productCost )
totalValue = stockAmount * productCost;
return totalValue; // return stock value
} // end totalValue
public void inventoryResults()
out.printf("%s, which is item number %d, has %d currently in stock at a " +
"price of %.2f each. The total value of inventory in stock is " +
"%.2f\n.", productName, itemNumber, stockAmount, productCost, totalValue);
} // end inventoryResult
}// end methodjustStartingOut wrote:
Actually my final solution was quite simple - I moved the calculation and final formated print text statements into the body of Inventory's class code. It now works. "Works" scares me a bit.
Someone cooking dinner might rummage about in the fridge and the cupboards to see what's there. Do imaginative things with what they come up with. And, with a bit of luck come up with something tasty or, at any rate edible.
A physician deciding on a medical treatment would do well to try a more cautious approach. A specific aim would be a good thing. And a calculated appreciation of the documented effects of each medicine. And how they interact.
It's up to you to determine which approach your coding should resemble. But it seems to me that your original Main class had a perfectly good reason to exist. It was a driver class whose purpose seemed to be to create and use an Inventory. (And using an Inventory is a very different thing from being an Inventory, so it made perfect sense to have two different classes.) To me it works or not, depending on whether it fufills that purpose. And what you have done is not so much solve the problem of it not working, as avoid that problem.
(If by "moved" you mean that the outputting now occurs as part of - or is called from - inventoryInput() then that is not a good thing. The input method should input: just input.)
I think that is because once the original input was loaded into the program (when I entered product number, name, price and value), the entries were dropped when the code switched to the next step. I think your intuition is entirely correct. In particular look at what your original main() method does (my comments replacing yours):
Inventory inventory = new Inventory(); // (A) Create an inventory...
inventory.inventoryInput(); // ... and put stuff into it
// (B) Create some new entirely different (and empty) inventory...
Inventory results = new Inventory();
results.inventoryResults(); // ... and print its contentsInstead of creating a second inventory, try printing the results of the first one.
Edited by: pbrockway2 on Apr 22, 2008 12:37 PM
Whoops ... just read reply 2.
It might sense, though to call totalValue() at the end your input method (because at that point the total value has changed). Or do away with that method - which you worked on getting right in your other thread ;) -
I've had this 2D array problem for ages and would apprecoate any help :)
I've posted a few times about this in the past and with your guys help I have gradually advanced.
Basically, all I want to do at the moment is fill the lowest position a counter can go in in a game of Connect Four.
The first counter goes to the bottom, then if you place another counter in the same column it goes above the previous counter you put in that same column and so on...
I have set up my 2D array and initialised integers for each player so when a counter is red the player = 1 and when yellow player = 2.
Here is my code...
CircleGrid [][] cArray = new CircleGrid[col][row]; //Declare array
static final int row = 6;
static final int col = 7;
for (int i = 0; i < col; i++)
for (int h = 0; h < row; h++)
cArray[i][h] = new CircleGrid();
gameCenter.add(new CircleGrid());
JOptionPane.showConfirmDialog(game, "Welcome to Frenzy Fours. Press 'OK to begin or 'Cancel' to go back.", "Game", JOptionPane.OK_CANCEL_OPTION);
/*if (cArray[col-1][row] && cArray[col-2][row] == 1) //This doesn't work at all...array out of bounds !?
System.out.println("testing");
public class CircleGrid extends JPanel implements MouseListener, MouseMotionListener
int ifRed;
int notIfRed;
boolean ifEmpty;
String currentColour = "White";
final int empty = 0;
final int competitorOne = 1;
final int competitorTwo = 2;
public CircleGrid()
ifRed = 1;
notIfRed = 0;
int redCircles = 0;
int yellowCircles = 0;
ifEmpty = true;
addMouseListener(this);
public void alternateColour()
ifEmpty = !ifEmpty;
repaint(); //Repaint upon changes
public void paintComponent(Graphics g)
if (ifEmpty)
g.setColor(Color.WHITE); //Set all of the ovals to white
else if (ifRed == clicks)
position--;
addMouseListener(this);
g.setColor(Color.RED); //Paint red
currentColour = "Red";
System.out.println(getColour());
System.out.println(playerOneMove());
else if (notIfRed == clicks)
addMouseListener(this);
g.setColor(Color.YELLOW); //Paint yellow
currentColour = "Yellow";
System.out.println(getColour());
System.out.println(playerTwoMove());
g.fillOval(5, 10, 42, 42); //Draw and fill oval
public String getColour()
return currentColour;
public int playerOneMove()
return competitorOne;
public int playerTwoMove()
return competitorTwo;
public void mousePressed(MouseEvent ev)
alternateColour(); //Use commands from this method
if (clicks == 0)
clicks = 1;
repaint(); //Paint oval red
number--; //Decrement number of counters left by 1
counterNo1.setText(number + " counters left.");
move++;
moveCount1.setText(move + " moves.");
else if (clicks > 0)
clicks = 0;
repaint(); //Paint oval yellow
number2--;
counterNo2.setText(number2 + " counters left.");
move2++;
moveCount2.setText(move2 + " moves.");
}I think that is all of the code which matters for this!
I didn't choose to do this project and it is really stressing me out! If anybody could give me a nudge in the right direction (in really simple steps) that would be awesome. I appreciate you guys do this voluntarily (and for some even work) so I would be deeply grateful for any assistance in this matter.
Thank you. :)
- Jay
Edited by: Aurora88 on Mar 5, 2008 7:18 AMpublic class CircleGrid extends JPanel implements MouseListener, MouseMotionListener
int ifRed;
int notIfRed;
boolean ifEmpty;
String currentColour = "White";
final int empty = 0;
final int competitorOne = 1;
final int competitorTwo = 2;
static final int row = 6;
static final int col = 7;
Circle [][] cArray = new Circle[col][row]; //Declare array
Circle circle = new Circle(0,0);
public CircleGrid()
ifRed = 1;
notIfRed = 0;
int redCircles = 0;
int yellowCircles = 0;
ifEmpty = true;
addMouseListener(this);
public void alternateColour()
ifEmpty = !ifEmpty;
repaint(); //Repaint upon changes
public void paintComponent(Graphics g)
if (ifEmpty)
g.setColor(Color.WHITE); //Set all of the ovals to white
else if (ifRed == clicks)
position--;
addMouseListener(this);
g.setColor(Color.RED); //Paint red
currentColour = "Red";
System.out.println(getColour());
System.out.println(playerOneMove());
else if (notIfRed == clicks)
addMouseListener(this);
g.setColor(Color.YELLOW); //Paint yellow
currentColour = "Yellow";
System.out.println(getColour());
System.out.println(playerTwoMove());
g.fillOval(5, 10, 42, 42); //Draw and fill oval
public String getColour()
return currentColour;
public int playerOneMove()
return competitorOne;
public int playerTwoMove()
return competitorTwo;
public void mousePressed(MouseEvent ev)
alternateColour(); //Use commands from this method
if (clicks == 0)
clicks = 1;
repaint(); //Paint oval red
number--; //Decrement number of counters left by 1
counterNo1.setText(number + " counters left.");
move++;
moveCount1.setText(move + " moves.");
else if (clicks > 0)
clicks = 0;
repaint(); //Paint oval yellow
number2--;
counterNo2.setText(number2 + " counters left.");
move2++;
moveCount2.setText(move2 + " moves.");
for (int i = 0; i < col; i++)
for (int h = 0; h < row; h++)
cArray[i][h] = new Circle();
gameCenter.add(cArray[i][h]);
System.out.println("LOCATION");
System.out.println("Row: " + circle.getRow());
System.out.println("Col: " + circle.getCol());
public void mouseClicked(MouseEvent ev)
public void mouseReleased(MouseEvent ev)
if (number < 0)
JOptionPane.showMessageDialog(game, "Error! You have no counters left.", "Error 001", JOptionPane.ERROR_MESSAGE);
System.out.println(countersGone()); //Display error when all counters are used
number = 22; move = 0; number2 = 22; move2 = 0;
counterNo1.setText(number + " counters left.");
moveCount1.setText(move + " moves.");
counterNo2.setText(number2 + " counters left.");
moveCount2.setText(move2 + " moves.");
clicks = 0;
game.dispose();
public void mouseEntered(MouseEvent ev)
public void mouseExited(MouseEvent ev)
public void mouseMoved(MouseEvent ev)
public void mouseDragged(MouseEvent ev)
public int getClickCount()
return clicks; //Record number of mouse clicks
public int getCounterNumber(int numberP1)
numberP1 = number; //Assigned number to numberP1
return number;
public int getCounterNumber2(int numberP2)
numberP2 = number;
return number2;
public int moveCounter1(int counterOne)
counterOne = move;
return move;
public int moveCounter2(int counterTwo)
counterTwo = move2;
return move2;
public String countersGone()
return "You have used up all of your counters!";
class Circle
int rowNum, colNum;
boolean occupied;
String color;
public Circle(int r, int c)
rowNum = r;
colNum = c;
occupied = false;
public int getRow()
return rowNum;
public int getCol()
return colNum;
}new Circle - cannot find symbol
gameCenter.add - cannot find symbol
Circle has been declared so I don't know why this is happening. :S -
Datatype Problems between Java and COBOL
I am calling a COBOL stored procedure from a Java Servlet. The COBOL stored procedure needs compressed numeric values and Java sends it Integer values. I'm getting an error saying my parameters don't match up. I'm wondering if it's because COBOL needs a compressed value. Has anyone else dealt with this or a similar problem? Please HELP!!!!
Thanks so much.I need to add more information...
I am using JDBC. I am passing in 4 parameters from my Java code: 2 shorts and 2 ints. In the COBOL parameter definition they are 2 SMALLINTs and 2 INTEGERs. In the COBOL stored proc the 2 SMALLINTs are S9(04) comp and the 2 INTEGERs are S9(09) Usage comp. Example values that I am passing in are:
(short) 2000
(short) 22
(int) 1749
(int) 164
The stored procedure is on a DB2 database. Hopefully this gives you a little more information to go on...
Thanks. -
hi. i was trying to learn this fileinput and output stream in java. i was trying to solve this exercise problem in which a user need to ask for the inputfile (Which i have created mydata.txt which has 5 positive numbers and 5 negative numbers ). my program will ask the user for the input file and then output the results in 2 seperate files one output will be for positive integers which the program will extract from myData,txt and negative integers to another output file. i am very confused. my program does not give me any error msgs but outputs a number 0.
import java.util.Scanner;
import java.io.*;
class fileEg {
public static void main (String[] args) throws IOException
int num=0, num1;
Scanner user = new Scanner(System.in);
String inputFileName, outputFileName, fileName;
System.out.println("Input File Name ");
inputFileName = user.nextLine().trim();
File input = new File (inputFileName);
Scanner scan = new Scanner(input);
System.out.print("Output File Name: ");
outputFileName = user.nextLine().trim();
File output = new File( outputFileName );
PrintStream print = new PrintStream( output );
while(scan.hasNextInt()) {
if(num == '+') {
print.println( "the numbers are " + num);
else {
print.println("The numbers ares " + num);
print.close();
}any help will be really appreciated. any theories or example.
Thanksimport java.util.Scanner;
import java.io.*;
class fileEg {
public static void main (String[] args) throws IOException
int num;
Scanner user = new Scanner(System.in);
String inputFileName, outputFileName, negativeFileName;
System.out.println("Input File Name ");
inputFileName = user.nextLine().trim();
File input = new File (inputFileName);
Scanner scan = new Scanner(input);
System.out.print("Output File positive Name: ");
outputFileName = user.nextLine().trim();
File output1 = new File( outputFileName );
PrintStream positiveNumbers = new PrintStream( output1 );
System.out.print("Output File negative Name: ");
negativeFileName = user.nextLine().trim();
File output = new File( negativeFileName );
PrintStream negativeNumbers = new PrintStream( output );
while(scan.hasNextInt()) {
num= scan.nextInt();
if (num >0) {
positiveNumbers.println( "the numbers are " + num);
} else {
negativeNumbers.println("The numbers ares " + num);
positiveNumbers.close();
negativeNumbers.close();
}Thanks paul
Message was edited by:
fastmike -
Dear All,
During the transaction /n/sapapo/ccr (Reconsilation of transaction data) in client SCP 950, system displays the run time error which are attached herewith.
This is the activity a used to execute regularly (Daily) and first time i recieved this message - -
Runtime Errors ASSERTION_FAILED
Date and Time 13.07.2007 10:13:37
ShrtText
The ASSERT condition has been violated.
What happened?
In the current application program, the system recognized a situation
involving the ASSERT statement that should not occur. A runtime error
occurred, either because there was no activation ID entered or because
the ID of the activation mode used was set to "Cancel.
What can you do?
Print out the error message (using the "Print" function)
and make a note of the actions and input that caused the
error.
To resolve the problem, contact your SAP system administrator.
You can use transaction ST22 (ABAP Dump Analysis) to view and administer
termination messages, especially those beyond their normal deletion
date.
is especially useful if you want to keep a particular message.
Error analysis
The following activation ID was used: "No checkpoint group specified"
If the FIELDS addition was used with this ASSERT statement, the content
of the first 8 fields is as follows:
" (not used) "
" (not used) "
" (not used) "
" (not used) "
" (not used) "
" (not used) "
" (not used) "
" (not used) "
How to correct the error
Probably the only way to eliminate the error is to correct the program.
You may able to find an interim solution to the problem
in the SAP note system. If you have access to the note system yourself,
use the following search criteria:
"ASSERTION_FAILED" C
"/SAPAPO/SAPLTIMESTAMP" or "/SAPAPO/LTIMESTAMPU08"
"/SAPAPO/TIMESTAMP_DIFFERENCE"
If you cannot solve the problem yourself and you wish to send
an error message to SAP, include the following documents:
1. A printout of the problem description (short dump)
To obtain this, select in the current display "System->List->
Save->Local File (unconverted)".
2. A suitable printout of the system log
To obtain this, call the system log through transaction SM21.
Limit the time interval to 10 minutes before and 5 minutes
after the short dump. In the display, then select the function
"System->List->Save->Local File (unconverted)".
3. If the programs are your own programs or modified SAP programs,
supply the source code.
To do this, select the Editor function "Further Utilities->
Upload/Download->Download".
4. Details regarding the conditions under which the error occurred
or which actions and input led to the error.
System environment
SAP Release.............. "640"
Application server....... "scmprd"
Network address.......... "172.16.10.47"
Operating system......... "AIX"
Release.................. "5.3"
Hardware type............ "0002BFAAD700"
Character length......... 16 Bits
Pointer length........... 64 Bits
Work process number...... 0
Short dump setting....... "full"
Database server.......... "scmprd"
Database type............ "ORACLE"
Database name............ "SCP"
Database owner........... "SAPSCP"
Character set............ "C"
SAP kernel............... "640"
Created on............... "Jan 18 2006 20:47:39"
Created in............... "AIX 1 5 00538A4A4C00"
Database version......... "OCI_920 "
Patch level.............. "109"
Patch text............... " "
Supported environment....
Database................. "ORACLE 9.2.0.., ORACLE 10.1.0.., ORACLE
10.2.0.."
SAP database version..... "640"
Operating system......... "AIX 1 5, AIX 2 5, AIX 3 5"
Memory usage.............
Roll..................... 16192
EM....................... 196923232
Heap..................... 0
Page..................... 98304
MM Used.................. 186636840
MM Free.................. 1895288
SAP Release.............. "640"
User and Transaction
Client.............. 950
User................ "SCMATP"
Language key........ "E"
Transaction......... "/SAPAPO/CCR "
Program............. "/SAPAPO/SAPLTIMESTAMP"
Screen.............. "SAPMSSY0 1000"
Screen line......... 6
Information on where terminated
The termination occurred in the ABAP program "/SAPAPO/SAPLTIMESTAMP" in
"/SAPAPO/TIMESTAMP_DIFFERENCE".
The main program was "/SAPAPO/CIF_DELTAREPORT3 ".
The termination occurred in line 61 of the source code of the (Include)
program "/SAPAPO/LTIMESTAMPU08"
of the source code of program "/SAPAPO/LTIMESTAMPU08" (when calling the editor
610).
Source Code Extract
Line SourceCde
31 lv_time_int_low TYPE i,
32 lv_timediff_int TYPE i,
33 lv_datediff_int TYPE i,
34 lv_time TYPE t,
35 ls_time TYPE tstr_timestr.
36
37 * check timestamp parameter
38 * ASSERT NOT iv_timestamp_high IS INITIAL.
39 * ASSERT NOT iv_timestamp_low IS INITIAL.
40 * ASSERT iv_timestamp_low <= iv_timestamp_high.
41 IF iv_timestamp_high IS INITIAL
42 OR iv_timestamp_low IS INITIAL.
43 RAISE invalid_parameter.
44 ENDIF.
45 IF iv_timestamp_high < iv_timestamp_low.
46 RAISE invalid_parameter.
47 ENDIF.
48
49 * prepare timestamps
50 * .. split into date and time integers
51 ls_timestamp_high = iv_timestamp_high.
52 lv_date_int_high = ls_timestamp_high-date.
53 lv_time_int_high = ls_timestamp_high-time.
54 ls_timestamp_low = iv_timestamp_low.
55 lv_date_int_low = ls_timestamp_low-date.
56 lv_time_int_low = ls_timestamp_low-time.
57
58 * .. calc date diff
59 * .. check against max. allowed integer difference
60 lv_datediff_int = lv_date_int_high - lv_date_int_low.
>>>>> ASSERT lv_datediff_int <= lc_datediff_intmax.
62
63 * calc time diff
64 lv_timediff_int = lv_time_int_high - lv_time_int_low.
65 IF lv_timediff_int < 0.
66 ADD 86400 TO lv_timediff_int.
67 SUBTRACT 1 FROM lv_datediff_int.
68 ENDIF.
69
70 * calc total duration
71 lv_duration_int = lv_datediff_int * 86400 + lv_timediff_int.
72 lv_time = lv_timediff_int.
73 ls_time = lv_time.
74 ls_duration-hours = lv_duration_int DIV 3600.
75 ls_duration-minutes = ls_time-minute.
76 ls_duration-seconds = ls_time-second.
77
78 ev_duration_packed = ls_duration.
79 ev_duration_integer = lv_duration_int.
80 ENDFUNCTION.
Contents of system fields
Name Val.
SY-SUBRC 0
SY-INDEX 0
SY-TABIX 1
SY-DBCNT 1
SY-FDPOS 6
SY-LSIND 0
SY-PAGNO 0
SY-LINNO 1
SY-COLNO 1
SY-PFKEY
SY-UCOMM
SY-TITLE CIF - Comparison/Reconciliation of Transaction Data
SY-MSGTY
SY-MSGID
SY-MSGNO 000
SY-MSGV1
SY-MSGV2
SY-MSGV3
SY-MSGV4
Active Calls/Events
No. Ty. Program Include Line
Name
5 FUNCTION /SAPAPO/SAPLTIMESTAMP /SAPAPO/LTIMESTAMPU08 61
/SAPAPO/TIMESTAMP_DIFFERENCE
4 FORM /SAPAPO/SAPLCIF_DELTA3 /SAPAPO/LCIF_DELTA3F17 349
COMPARE_ORDER_HEADER
3 FUNCTION /SAPAPO/SAPLCIF_DELTA3 /SAPAPO/LCIF_DELTA3U03 125
/SAPAPO/CIF_DELTA3_COMP_ORDER
2 FUNCTION /SAPAPO/SAPLCIF_DELTA3 /SAPAPO/LCIF_DELTA3U01 871
/SAPAPO/CIF_DELTA3_COMP
1 EVENT /SAPAPO/CIF_DELTAREPORT3 /SAPAPO/CIF_DELTAREPORT3 189
START-OF-SELECTION
Chosen variables
Name
Val.
No. 5 Ty. FUNCTION
Name /SAPAPO/TIMESTAMP_DIFFERENCE
IV_TIMESTAMP_HIGH
#q1###
02073899
2001125C
IV_TIMESTAMP_LOW
##q!####
00720899
2011125C
EV_DURATION_INTEGER
0
0000
0000
EV_DURATION_PACKED
000000
00000C
SYST-REPID
/SAPAPO/SAPLTIMESTAMP
0000000000000000000000000000000000000000
0000000000000000000000000000000000000000
2545454254545444554452222222222222222222
F31010FF310C49D5341D00000000000000000000
%_SPACE
0
0
2
0
LS_TIMESTAMP_HIGH
22000713182959
00000000000000
00000000000000
33333333333333
22000713182959
LV_DATE_INT_HIGH
803363
0042
0C23
LS_TIMESTAMP_HIGH-DATE
22000713
00000000
00000000
33333333
22000713
LV_TIME_INT_HIGH
66599
0002
0147
LS_TIMESTAMP_HIGH-TIME
182959
000000
000000
333333
182959
LS_TIMESTAMP_LOW
20071210182959
00000000000000
00000000000000
33333333333333
20071210182959
LV_DATE_INT_LOW
733021
0025
0BFD
LS_TIMESTAMP_LOW-DATE
20071210
00000000
00000000
33333333
20071210
LV_TIME_INT_LOW
66599
0002
0147
LS_TIMESTAMP_LOW-TIME
182959
000000
000000
333333
182959
SY-UNAME
SCMATP
000000000000
000000000000
544455222222
33D140000000
SCREEN-INPUT
1
0
0
3
1
LV_DATEDIFF_INT
70342
001C
0126
LV_TIMEDIFF_INT
0
0000
0000
SYST
#######################################Ō###############################################䵘 C#Ԁ##
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000
000000000000000000000000000000000000000100000000000000000000000000000000000000000000000D000500
0000000000000000000000000000000800000004000000000000000000000000000000000000010900000005240000
0000010200000000000001060100010C0000000C0000000002000000000000000000000000000B000001000803000C
SY-REPID
/SAPAPO/SAPLTIMESTAMP
0000000000000000000000000000000000000000
0000000000000000000000000000000000000000
2545454254545444554452222222222222222222
F31010FF310C49D5341D00000000000000000000
%_DUMMY$$
0000
0000
2222
0000
No. 4 Ty. FORM
Name COMPARE_ORDER_HEADER
SYST-REPID
/SAPAPO/SAPLCIF_DELTA3
0000000000000000000000000000000000000000
0000000000000000000000000000000000000000
2545454254544445444543222222222222222222
F31010FF310C396F45C413000000000000000000
GC_APPEND_MODE
3
0
0
3
3
LS_FIELDS_TO_COMPARE-DUEDATE
X
0
0
5
8
SYST
#######################################Ō###############################################䵘 C#Ԁ##
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000
000000000000000000000000000000000000000100000000000000000000000000000000000000000000000D000500
0000000000000000000000000000000800000004000000000000000000000000000000000000010900000005240000
0000010200000000000001060100010C0000000C0000000002000000000000000000000000000B000001000803000C
LS_APO_ORDER-ORDTYPE
5
0
0
3
5
GC_PLANNED_ORDER
5
0
0
3
5
LS_R3_ORDER-STATUSCNF
0
0
2
0
GC_ORDER_STATUS_NO_CONF
1
0
0
3
1
LS_APO_ORDER-STATUSCNF
0
0
2
0
GC_PRED_OUT_DEL
A
0
0
4
1
GC_TND_DELETE
CN
00
00
44
3EDear Sajit,
Go through the following OSS Notes:
<a href="https://websmp110.sap-ag.de/form/handler?_APP=01100107900000000342&_EVENT=REDIR&_NNUM=901957&_NLANG=E">901957</a>, <a href="https://websmp110.sap-ag.de/form/handler?_APP=01100107900000000342&_EVENT=REDIR&_NNUM=1036880&_NLANG=E">1036880</a>, <a href="https://websmp110.sap-ag.de/~form/handler?_APP=01100107900000000342&_EVENT=REDIR&_NNUM=1067414&_NLANG=E">1067414</a>
Regards,
Naveen. -
DBSequence entity attribute type not available
Hi OTN,
I want to set an entity attribute type to DBSequence. But there's no such type in a drop-down list, only Java types.
I tried to set the type in source manually but at runtime framework doesn't assign a negative integer to the attribute at Create operation.
In simple test application DBSequence type is available and negative integers get assigned.
I have found a proper thread (Re: DBSequence type no longer available for entity attributes? but the solution there is to recreate the whole datamodel. That isn't suitable for me.
Maybe there is a better solution now?
Jdeveloper 11.1.1.2, ADF BC
Thanks.I logged Bug 9380578 - "SQL FLAVOUR" AND "TYPE MAP" CAN BE CHANGED IN "PROJECT PROPERTIES"
(published in My Oracle Support).
NB: in JDeveloper 9.x, it was possible to change the "SQL Dialect" (as it was called at that time), but the ADF BC objects and the custom code weren't changed;
hence it was decided to gray out that choice after the Project creation.
Regards,
Didier. -
Problems in changing Thousand's separator appearance
I am having problems in changing the thousands separator appearance. I am based out of India and here the thousands separator works in format - 1,00,00,000 (i.e. 2 digits after last 3 digits). I want to change this into standard 3 digit thousands separator - 1,000,000,000. However not able to do this. Kindly suggest any workaround for this.
Yes! You can definitely change and customize integers.
Its a little tricky to explain how you have to do this in the Numbers interface but follow below:
Select cells or table > open Inspector > select Cells tab (4th from the left) > Use the drop down list under "Cell Format" and select "Custom" at the bottom....
From here you can edit your own intergers by dragging elements from below onto the field above (See example below). Don't worry if the elements do NOT match what you want below... You add the element by dragging it, THEN once in the field you can click on it and edit how many digits there are, as represented by '#' simply by pressing Up and Down on the keyboard, Or clicking on its own little drop down arrow to access features like "Remove separator". Then in between these elements simply type a comma " , " and drag the next element, keep editing away like that and you should get something like what I have below:
Feel free to ask any more questions PrashKot :] -
Cannot reslove symbol class Date
I am trying to get a clock to show the time in my program. However, when I try to compile the program a "cannot resolve symbol class Date" error appears. I can't figure out where the problem in my program is. Here is my source code. I would appreciate any help.
import javax.swing.*;
import java.io.*;
import java.lang.*;
import java.awt.*;
import java.applet.*;
import java.awt.event.*;
//import java.util.*;
import java.math.*;
public class store
public static void main(String[] args)
String dataInput;
dataInput = JOptionPane.showInputDialog(null, "Input item data: ");
JOptionPane.showMessageDialog(null, "" + dataInput);
EasyReader console = new EasyReader();
int i, j, k, inum, icom, min, nswaps; inum = 0; boolean swap = false;
double num[] = new double[100]; double dsum, T;
do
System.out.println(); System.out.println("Command Menu"); System.out.println();
System.out.println("1 = Display the data");
System.out.println("2 = Bubble Sort the numbers");
System.out.println("3 = Selection Sort the numbers");
System.out.println("4 = Insertion Sort the numbers");
System.out.println("5 = Binary Search for a number");
System.out.println("0 = Exit the program"); System.out.println();
System.out.print("Enter Command - ");
icom = console.readInt(); System.out.println();
switch (icom)
case 1: // Display the data
Display(inum, num);
break;
case 2: // Bubble sort
nswaps = 0;
for (i = 0; i < (inum-1); i++ )
for (j = (i+1); j < inum; j++)
if (num[i] > num[j])
T = num;
num[i] = num[j];
num[j] = T;
nswaps++;
System.out.println("The number of swaps was - " + nswaps);
Display(inum, num);
break;
case 3: // Selection sort
nswaps = 0;
for (i = 0; i < inum - 1; i++) {
min = i; swap = false;
for (j = i + 1; j < inum; j++)
if (num[j] < num[min]) { min = j; swap = true; }
if (swap) {T = num[min];
num[min] = num[i];
num[i] = T;
nswaps++;}
System.out.println("The number of swaps was - " + nswaps);
Display(inum, num);
break;
case 4: // Selection sort
nswaps = 0;
for (i = 1; i < inum; i++)
j = i; T = num[i];
while ((j > 0) && (T < num[j-1]))
num[j] = num[j-1]; j--; nswaps++;
num[j] = T; nswaps++;
System.out.println("The number of swaps was - " + nswaps);
Display(inum, num);
break;
case 5: // Binary Search
System.out.println("Your numbers will be sorted first");
System.out.println();
for (i = 1; i < inum; i++)
j = i; T = num[i];
while ((j > 0) && (T < num[j-1]))
num[j] = num[j-1]; j--;
num[j] = T;
System.out.print("Enter the number to locate - ");
T = console.readDouble(); nswaps = 0; System.out.println();
int left = 0, right = inum, middle; k = -1;
while (left <= right)
middle = (left + right) / 2;
if (T > num[middle]) {left = middle + 1; nswaps++;}
else if (T < num[middle]) {right = middle - 1; nswaps++;}
else { k = middle; break; }
if (k == -1) System.out.println("Your number was not located in the array");
else System.out.println("Your number " + T + " is in position " + (k+1));
System.out.println();
System.out.println(nswaps + " comparisons were needed to search for your number");
Display(inum, num);
break;
} while (icom != 0);
public static void Display(int inum, double num[])
{ int k;
System.out.println();
System.out.println("");
System.out.println();
for (k = 0; k < inum; k++)
System.out.println((k+1) + " - " + num[k]);
return;
class Clock extends Thread
//A Canvas that will display the current time on the calculator
Canvas Time;
//A Date object that will access the current time
private Date now;
//A string to hold the current time
private String currentTime;
//The constructor for Clock, accepting a Label as an argument
public Clock(Canvas _Time)
Time = Time; //Time is passed by reference, so Time
//now refers to the same Canvas
start(); //start this thread
//The overriden run method of this thread
public void run()
//while this thread exists
while (true)
try
draw_clock(); //calls the draw_clock method
sleep(1000); //puts this thread to sleep for one
//second
//catches an InterruptedException that the sleep() method might throw
catch (InterruptedException e) { suspend(); }
//catches a NullPointerException and suspends the thread if one occurs
catch (NullPointerException e) { suspend(); }
//A method to draw the current time onto the Time Canvas on the applet
public void draw_clock()
try
//Obtains the Graphics object from the Canvas Time so that it can
//be manipulated directly
Graphics g = Time.getGraphics();
g.setColor(Color.gray); //sets the color of the Graphics object
//to gray for the rectangle background
g.fillRect(0,0,165,25); //fills the Canvas area with a rectangle
//starting at 0,0 coordinates of the Canvas
//and extending to the length and width
g.setColor(Color.orange); //sets the color of the Graphics object
//to orange for the text color
get_the_time(); //calls the get_the_time() method
//calls the drawString method of the Graphics object g, which will
//draw a string to the screen
//Accepts a string and two integers to represent the coordinates
g.drawString("Current Time - " + currentTime, 0, 17);
//catches a NullPointerException and suspends the thread if one occurs
catch (NullPointerException e) { suspend(); }
//A method to obtain the current time, accurate to the second
public void get_the_time()
//creates a new Date object for "now" every time this is called
now = new Date( );
//integers to hold the hours, minutes and seconds of the current time
int a = now.getHours();
int b = now.getMinutes();
int c = now.getSeconds();
if (a == 0) a = 12; //if hours are zero, set them to twelve
if (a > 12) a = a -12; //if hours are greater than twelve, make a
//conversion to civilian time, as opposed to
//24-hour time
if ( a < 10) //if hours are less than 10
//sets the currentTime string to 0, appends a's value and a
//colon
currentTime = "0" + a + ":" ;
else
//otherwise set currentTime string to "a", append a colon
currentTime = a +":";
if (b < 10) //if minutes are less than ten
//append a zero to string currentTime, then append "b" and a colon
currentTime = currentTime + "0" + b + ":" ;
else
//otherwise append "b" and a colon to currentTime string
currentTime = currentTime + b + ":" ;
if (c < 10) //if seconds are less than ten
//append a zero to string currentTime, then append "c" and a colon
currentTime = currentTime + "0" + c ;
else
//otherwise append "c" to currentTime string
currentTime = currentTime + c;
} //end of the Clock classWow.
1) Please in future use the code tags to format code you post so that it doesn't think you have italics in your code and render it largely1 unreadable. Read this
http://forum.java.sun.com/help.jspa?sec=formatting
2) You commented out the import of java.util which is the problem you are complaining about.
3) Are you planning to stick all the code you ever write into the one source file? Why is all this stuff rammed together. Yoinks. -
Help with slooooow function...
Hi
I have written a function which converts a python list structure, represented as a string (as produced by str(List)) to a java Vector. The list may consist of an arbitrary depth of other lists or integers. E.g the string may look like this:
"[[23, 34, 3], 3, 4, [23, 2, 5]]"
which would produce a Vector of Vectors and Integers.
The function:
/* Converts a python list (of lists and/or ints), represented by
* a string, to a java vector (of vectors and/or Integers) */
public static Vector pythonListToJavaVector(String pythonList)
int i, m, depth, start;
char c;
Vector javaVector = new Vector();
StringBuffer number = new StringBuffer();
char listStart = '[';
char listEnd = ']';
char sep = ',';
/* Check for the empty list */
if (pythonList.equals("[]"))
return new Vector();
/* depth is how many lists are wrapped around us */
depth = 0;
start = 0;
/* Next: Fill javaVector. We don't care about the start and end brackets
* because they are implicit when we get here */
for (i = 1, m = pythonList.length() - 1; i < m; i++)
c = pythonList.charAt(i);
if (c == listStart)
if (depth == 0)
/* Store starting index of new list */
start = i;
depth++;
else if (c == listEnd)
depth--;
if (depth == 0)
/* End of new list found */
javaVector.addElement(pythonListToJavaVector(pythonList.substring(start, i + 1)));
else if (depth == 0 && Character.isDigit(c))
/* We only care about digits on the right depth */
/* First digit of a number was found */
number.append(c);
/* Look for rest of the number */
while (i + 1 < m && Character.isDigit(pythonList.charAt(i + 1)))
i++;
c = pythonList.charAt(i);
number.append(c);
javaVector.addElement(new Integer(Integer.parseInt(number.toString())));
/* Clear StringBuffer */
number.delete(0, number.length());
return javaVector;
}It works but is painfully slow... I have an equivalent function in Python (converting a python list represented as a string to an actual list), and it is approximately 25 times faster!.
So, if you can spot any bootlenecks in my function or alternate ways of doing the same thing, don't hesitate to post your thoughts.
regards toresThe following version eliminates a lot of overhead, but realistically, the technique used seems quite fast as it is. My measurements (on a 1.2 GHz PIII notebook running JSE 5.0 shows that the avarage execution time to convert a fairly complex string to a list takes only around 12 microseconds - not much room for improvement. Your original version took about 4 times as long pimarily due to cost of StringBuffer and conversion of string to int which mine avoids. The use of ArrayList instead of Vector had little effect.
NOTE - microbenchmarks are a little tricky and therefore your mileage may vary.
import java.util.ArrayList;
public class Test {
* @param args
public static void main(String[] args) {
long start = System.nanoTime();
for (int i = 0; i < 1000; ++i) {
pythonListToJavaVector("[1,2,3,4,[1000,2000,3000,4000,5000],6,[5,6,7,8,9],90,91,92,93,94,95,96,97,98,99]");
System.out.println("" + ((System.nanoTime() - start) / 1000000.0)
+ " microseconds");
start = System.nanoTime();
for (int i = 0; i < 1000; ++i) {
pythonListToJavaVector("[1,2,3,4,[1000,2000,3000,4000,5000],6,[5,6,7,8,9],90,91,92,93,94,95,96,97,98,99]");
System.out.println("" + ((System.nanoTime() - start) / 1000000.0)
+ " microseconds");
start = System.nanoTime();
for (int i = 0; i < 1000; ++i) {
pythonListToJavaVector("[1,2,3,4,[1000,2000,3000,4000,5000],6,[5,6,7,8,9],90,91,92,93,94,95,96,97,98,99]");
System.out.println("" + ((System.nanoTime() - start) / 1000000.0)
+ " microseconds");
start = System.nanoTime();
for (int i = 0; i < 1000; ++i) {
pythonListToJavaVector("[1,2,3,4,[1000,2000,[1,2,3],3000,4000,5000],6,[5,6,7,8,9],90,91,92,93,94,95,96,97,98,99]");
System.out.println("" + ((System.nanoTime() - start) / 1000000.0)
+ " microseconds");
start = System.nanoTime();
for (int i = 0; i < 1000; ++i) {
pythonListToJavaVector("[1,2,3,4,5,6,7,8,9,90,91,92,93,94,95,96,97,98,99]");
System.out.println("" + ((System.nanoTime() - start) / 1000000.0)
+ " microseconds");
private static final char listStart = '[';
private static final char listEnd = ']';
public static ArrayList pythonListToJavaVector(String pythonList) {
ArrayList javaList = new ArrayList(100);
/* Check for the empty list */
if (!pythonList.equals("[]")) {
/* depth is how many lists are wrapped around us */
int depth = 0;
int start = 0;
* Next: Fill javaVector. We don't care about the start and end
* brackets because they are implicit when we get here
for (int i = 1, m = pythonList.length() - 1; i < m; i++) {
char c = pythonList.charAt(i);
if (c == listStart) {
if (depth == 0) {
/* Store starting index of new list */
start = i;
depth++;
} else if (c == listEnd) {
depth--;
if (depth == 0) {
/* End of new list found */
javaList.add(pythonListToJavaVector(pythonList
.substring(start, i + 1)));
} else if (depth == 0 && Character.isDigit(c))
/* We only care about digits on the right depth */
/* First digit of a number was found */
int number = buildInteger(0, c);
/* Look for rest of the number */
while (i + 1 < m
&& Character.isDigit(pythonList.charAt(i + 1))) {
i++;
c = pythonList.charAt(i);
number = buildInteger(number, c);
javaList.add(new Integer(number));
/* Clear StringBuffer */
number = 0;
return javaList;
private static int buildInteger(int current, char nextChar) {
return (current * 10) + (nextChar - '0');
}Chuck -
Custom order of priority queue
I am a novice in Java. I intend to use a priority queue which holds objects. The objects have a string and two integers. I have to order the priority queue based on one of the integer.
I write syntax according to my understanding please correct me.
PriorityQueue<Object> pr = new PriorityQueue<Object>();
comparable(){
sort(Object.int2)// this is the place where I am confused
}Here's an example:
public class Caller
public static void main(String[] args)
Flight f1 = new Flight( "java", 2, 34 );
Flight f2 = new Flight( "java", 2, 3 );
Flight f3 = new Flight( "java", 2, 4 );
Flight f4 = new Flight( "java", 2, 64 );
Flight f5 = new Flight( "java", 2, 22 );
Flight f6 = new Flight( "java", 2, 12 );
PriorityQueue pq = new PriorityQueue();
pq.add(f1);
pq.add(f2);
pq.add(f3);
pq.add(f4);
pq.add(f5);
pq.add(f6);
System.out.println(pq.poll());
System.out.println(pq.poll());
System.out.println(pq.poll());
System.out.println(pq.poll());
System.out.println(pq.poll());
System.out.println(pq.poll());
public class Flight implements Comparable
private String airlinename;
private int flightnumber;
private int number;
public int compareTo(Object o)
Flight f = (Flight) o;
return number - f.getNumber();
public String toString()
return airlinename + " - " + number;
public Flight(String airname, int num1, int num2)
airlinename = airname;
flightnumber = num1;
number = num2;
public String getAirlinename()
return airlinename;
public void setAirlinename(String airlinename)
this.airlinename = airlinename;
public int getFlightnumber()
return flightnumber;
public void setFlightnumber(int flightnumber)
this.flightnumber = flightnumber;
public int getNumber()
return number;
public void setNumber(int number)
this.number = number;
}Got it? -
How to test if a decimal is even or odd in labview
i made a VI that tests for even and odd integers using the quotient/remainder function and the Select function but when i test a decimal it does not work properly.
i have my VI testing to see if the input diveded by 2 gives you a remainder equal to 0, and if it does then it is even and the VI displays a messege saying "Even", but when i put in a decimal ( for example 7.2) the remainder is spitting out 1.2 which is not equal to 0 making my VI not work properly, if anybody can help me with this i would greatly appreciate it and if you could attached a photo that would help me understand what my mistake is, Thanks i have attached my VI for you to look at
Attachments:
P 3.7.vi 34 KBAs has been already said, odd/even is only defined for integers, so you need to tell us what you expect for e.g. 7.2.
Do you want to know if the last decimal digit is even or odd?
Do you want to know if the nearest integer is even or odd?
While you are at it, you might also think a bit more about your program design:
What is the purpose of your "select" primitive? What do you think would be different if you just leave it out completely?
Why do you test for "equal zero" and "not equal zero"? One is just the inversion of the other and knowing one also determines the other automatically.
Why do you use two dialog boxes? Do one comparison and use "select" to switch between the two messages. Only one express dialog needed.
Don't mix blue and orange. Select the correct representation for your diagram constants.
There is a primitive for "equal zero"
Never use equal and not equal comparison with orange numeric data (DBL). You might not get expected results.
LabVIEW Champion . Do more with less code and in less time . -
Java.io.EOFException in Object file transfer
Greetings,
I am having a problem sending a file across a network. At one point it was working, however I am not sure where along the way it became broken.
Stack Trace:
java.io.EOFException
at java.io.ObjectInputStream$PeekInputStream.readFully(Unknown Source)
at java.io.ObjectInputStream$BlockDataInputStream.readShort(Unknown Sour
ce)
at java.io.ObjectInputStream.readStreamHeader(Unknown Source)
at java.io.ObjectInputStream.<init>(Unknown Source)
at WBServer.unpackVectors(WBServer.java:283)
at fileListener.run(WBServer.java:374)
public void getWBContent(String hid) throws java.rmi.RemoteException //<- Send all object vectors and relevant integers...
setPageNum(pageCount-1);
HID=hid;
packVectors(null);
new Thread() {
public void run(){
try{javax.swing.SwingUtilities.invokeLater(
new Runnable(){
public void run(){
try{ //Yes...
java.net.Socket s = new java.net.Socket(HID, 1113); //<- Make a network port
java.io.BufferedWriter sos = new java.io.BufferedWriter(new java.io.OutputStreamWriter(s.getOutputStream())); //<-Open a stream
sos.write("vectordata.dat"); //<-Send the name of the file
sos.close(); //<- Close the stream
s.close(); //<- Close the port
String anchor = getClass().getResource("WBServer.class").getPath();
java.net.Socket ns = new java.net.Socket(HID, 1113); //<- Open a new port to the same place
java.io.FileInputStream fio = new java.io.FileInputStream(anchor.substring(0, anchor.lastIndexOf('/')+1)+"vectordata.dat"); //<- Open the file to stream
//java.io.DataInputStream dia = new java.io.DataInputStream(fio); //<- Open the stream to read
java.io.BufferedInputStream bia = new java.io.BufferedInputStream(fio);
java.io.BufferedOutputStream boa = new java.io.BufferedOutputStream(ns.getOutputStream());//<- Open the data stream for the port
int read=0; //<- Byte Read Counter
byte[] fbuffer = new byte[1024]; //<- Byte Read Buffer
boolean EOF=false;
while(!EOF){ //<- Until we reach the end of the stream...
try{read=bia.read(fbuffer);
boa.write(fbuffer, 0, read);} //<- ...send the number of bytes stored in the buffer at the time.
catch(java.io.EOFException e){ EOF=true;}
boa.flush(); //<- Make sure the stream is cleared
boa.close(); //<- Close the port's stream
bia.close(); //<- Close the reading stream
fio.close(); //<- Close the file's stream
ns.close(); //<- Close the port...
catch(Exception e)
{SimpleFormatter sf = new SimpleFormatter();
LogRecord tempLog = new LogRecord(Level.WARNING, "File Send Error: "+e.toString());
sf.format(tempLog);
logFile.publish(tempLog);}
catch(Exception e)
{SimpleFormatter sf = new SimpleFormatter();
LogRecord tempLog = new LogRecord(Level.WARNING, "Error running getWBContent() send file thread: "+e.toString());
sf.format(tempLog);
logFile.publish(tempLog);}
}}.start();
public void packVectors(String filePath) { //This function writes all the objects in memory to a file for transport.
String anchor = getClass().getResource("WBServer.class").getPath();
if(filePath==null){filePath=anchor.substring(0, anchor.lastIndexOf('/')+1)+"data/vectordata.dat";}
System.out.println("From packVectors(): "+filePath);
java.io.File ovFile = new java.io.File(filePath); //Setup out data file
try{if(!ovFile.exists()){ovFile.createNewFile();}else{ovFile.delete(); ovFile.createNewFile();} //If it's not there...make one. If it is, delete it and make a new one.
java.io.ObjectOutputStream oojStream = new java.io.ObjectOutputStream(new java.io.FileOutputStream(ovFile)); //Ready the writer for writingness.
oojStream.writeObject(PageHolder); //Pages to file...
oojStream.writeObject(ImgPage); //Images for the Pages to file...
oojStream.writeObject(WBStack); //Current object stack to file...
oojStream.writeInt(objCount); //Current object count to file...
oojStream.writeInt(pageCount); //Current page count to file...
oojStream.writeInt(pageCount-1); //Current page number to file...
oojStream.flush(); //<-Commit final write operations...
oojStream.close();} //<- Close the file...
catch(Exception e)
{SimpleFormatter s = new SimpleFormatter();
LogRecord tempLog = new LogRecord(Level.WARNING, "Persistence save error: "+e.toString());
s.format(tempLog);
e.printStackTrace();
logFile.publish(tempLog);}
public void unpackVectors(String filePath) { //This function reads objects from a file that was previously written by packVectors().
String anchor = getClass().getResource("WBServer.class").getPath();
if(filePath==null){filePath=anchor.substring(0, anchor.lastIndexOf('/')+1)+"data/vectordata.dat";}
System.out.println("From unpackVectors(): "+filePath);
java.io.File ivFile = new java.io.File(filePath); //Setup the file to read from.
try{if(!ivFile.exists()){ //If the file doesn't exist, we're screwed...
SimpleFormatter s = new SimpleFormatter();
LogRecord tempLog = new LogRecord(Level.WARNING, "Persistence load error: File vectordata.dat does not exist!");
s.format(tempLog);
logFile.publish(tempLog);
}else{
java.io.ObjectInputStream iojStream = new java.io.ObjectInputStream(new java.io.FileInputStream(ivFile)); //Ready the reader for readingness...
PageHolder = (java.util.Vector)iojStream.readObject(); //Pages from file...
ImgPage = (java.util.Vector)iojStream.readObject(); //images for Pages from file...
WBStack = (java.util.Vector)iojStream.readObject(); //Current object stack from file...
objCount = iojStream.readInt(); //Current object count from file...
pageCount = iojStream.readInt(); //Current number of pages from file...
pageNum = iojStream.readInt();//iojStream.readInt(); //Current page number from file...
iojStream.close();}} //Close the file...
catch(Exception e)// We screwed up somewhere.....
{SimpleFormatter s = new SimpleFormatter();
LogRecord tempLog = new LogRecord(Level.WARNING, "Persistence load error: "+e.toString());
s.format(tempLog);
e.printStackTrace();
logFile.publish(tempLog);}
class fileListener extends Thread {
public fileListener(WBServer wb) //<-Constructor
try{ms = new java.net.ServerSocket(1113);} //<- Listener socket
catch(Exception e){e.toString();}
server = wb; //<- Referencial variable back to the server
public fileListener(WBServer wb, int port) //<- Constructor with port
try{ms = new java.net.ServerSocket(port);} //<- Listener socket
catch(Exception e){e.toString();}
server = wb; //<- Referencial variable back to the server
public void run() {
String filepath; //<- Holder for file path operations...
while(!disconnect) {
try{java.net.Socket cs = ms.accept(); //<- Accept incoming request.
server.fileStat = 1;
java.io.BufferedReader str = new java.io.BufferedReader(new java.io.InputStreamReader(cs.getInputStream())); //<- Open communications with client
String checkStr = str.readLine(); //<- Grab the file name from the client
System.out.println(checkStr);
String anchor = getClass().getResource("fileListener.class").getPath();
if(checkStr.equalsIgnoreCase("vectordata.dat"))
{filepath=anchor.substring(0, anchor.lastIndexOf('/')+1)+"data/"+checkStr;}
else{filepath=anchor.substring(0, anchor.lastIndexOf('/')+1)+"scans/"+checkStr;}
System.out.println(filepath);
str.close(); //<- Close communications with client
cs.close(); //<- Close socket
//System.out.println("Recieved File Name: "+filepath);//Debugging
java.io.File inFile = new java.io.File(filepath); //<- Make a file in memory on the host computer with the specified name.
inFile.createNewFile(); //<- Create an empty file of that name within the local file system
java.net.Socket ds = ms.accept(); //<- Accept incoming request
java.io.FileOutputStream fos = new java.io.FileOutputStream(inFile); //<- Open file stream for writing...
java.io.BufferedInputStream bis = new java.io.BufferedInputStream(ds.getInputStream()); //<- Open communications with client for data/
byte[] fbuffer = new byte[1024]; //<- Byte read buffer
int read=0; //<- Byte read counter
server.fileStat = 2;
while((read=bis.read(fbuffer))!=-1){ //<-Until we reach the end of the stream...
fos.write(fbuffer, 0, read); System.out.print(read+":");}// <- ...write the buffer to the file.
fos.flush(); //<- Clear the file stream
fos.close(); //<- Close the file stream
bis.close(); //<- Close the data stream from the client
if(checkStr.equalsIgnoreCase("vectordata.dat"))
{server.fileStat = 3; // ...otherwise, we show loading...
server.unpackVectors(null);
server.sendRefresh(true);
server.fileStat=0;}
else //If it's the sych data, unpack it and load the data
{server.fileStat = 3; // ...otherwise, we show loading...
server.passImage(inFile); //<-Load the file into the image vector...
server.sendRefresh(true); //<- Ensure that the client updates properly
server.fileStat=0;}
ds.close(); //<- Close the client socket
catch(Exception e){e.toString();}
//System.out.println("Listener Shutdown");//Debugging
try{ms.close();} catch(Exception e){e.toString();} //<- Close the listening socket
public boolean disconnect = false; //<- Flag for killing the "file server" prematurely
private static WBServer server; //<- Referencial variable to the whiteboard server
private java.net.ServerSocket ms; //<- Listener socket
}I'm stumped as to where it is going wrong. I know that packVectors() and unpackVectors() both work, as they are used in a local save function. I suspect the problem lies between the getWBContent(String hid) and the fileListener class, but I am not certain where. Any help would be appreciated.First, you are expecting read(buffer,offset,count) to throw an EOFException. It doesn't, it returns -1 at EOF.
Second, you are using a Writer to write binary data (resulting from serialization). This will corrupt it. Use an OutputStream.
Third, what I really don't get is why would you (i) write local data to a file and (ii) start a new thread to (iii) read it back and (iv) send it over not one but two sockets, when you could just return the data as the result of the remote method without the file, the thread, or the Sockets.
And in any case this sort of thing is most definitely not what SwingtUtilites.invokeLater() is for. (What it is for is updating Swing components and ensuring it all happens in the Swing thread, being the only correct way to write Swing code as Swing is not thread-safe by design.) If your server has a Swing GUI, which doesn't seem likely, it will stall for the duration of all this I/O. If it doesn't, why start the Swing thread at all?
Just define a serializable object that contains all the data you are passing to writeObject()/writeInt() and return it as the result of the remote method.
You will save yourself a lot of latency and code in the process, and you could reduce all this to about six lines of code, something like:
return new WBContent(
PageHolder, //Pages to file...
ImgPage, //Images for the Pages to file...
WBStack, //Current object stack to file...
objCount, //Current object count to file...
pageCount, //Current page count to file...
pageCount-1 //Current page number to file...
); where WBContent is a serializable class with the appropriate members and constructor, and is the return type of getWBContent().
Maybe you are looking for
-
Problem with the Clipboard after upgrade
We had been using Intermedia, along with the Clipboard and WebAgent in Oracle 8.1.5. A few days ago we upgraded to 8.1.6 (I performed the Intermedia upgrade as well). Oracle is Installed on a Solaris 7 server. We installed everything into a new Oracl
-
Error in installing ATI catalyst control center after formatting my laptop
please see this thread. thankyou http://h30434.www3.hp.com/t5/Notebook-Operating-Systems-and/error-in-installing-ATI-catalyst-control...
-
Questions about moving from Mobile Me to iCloud
I just upgraded my iPhone to iOS5 and am curious about the move to iCloud for my mobileme account. I know there are articles out there, but they seem very generic and do not put my fears to rest. Here are my questions and concerns. I figure they wil
-
CO-product configuration in REM scenario
I am trying to configure co-product scenario with REM process. Is it possible? If any one worked on this scenario please let me know what are the special consideration we need to take or any SAP note available? Thanks in advaice. Rajesha Vittal
-
Earlier this week I was able to select "object/insert html/paste Youtube embed code" and it worked like a charm. Now that same process does not seem to work. All I see is a white space where before I saw a black place holder for the video. I've tried