Methods - HELP!
Just wanted to ask, I have the following method which is invoked somewhere else. I am using the eclipse development environment and have used breakpoints to see exactly where the code is not being 'followed' by the program. I know that the method is getting invoked. It works up until the first for loop and then from what I can see just goes to the brace ending the method. Can you think why this may be?
public void euclidean(){
theSum =new int [theCount];
sum = new int [theRowCount][theCount];
/* Comparing each record attribute with the next record. The sum stores the value of the
* differences between records (based on single attributes). The first for stmt looks at
* one row at a time- the second for stmt the compares this row to all the other rows.
* For every row comparison all the attributes are considered. NOTE: the second for stmt
* starts at 2 so that the second row is considered (the first row is dealt with in the
* first for stmt).*/
for (int i=1; i<theRowCount; ++i){
for (int all = 2; all <= theRowCount; ++all){
for (int k=1; k<theCount; ++k)//attributes
/* Carry out the calculations to work out the euclidean distance. If the attribute value being
* considered of type int then an exception occurrs and is caught in the catch clause- if the
* 2 values differ then the distace is equal to 1 else it is equal to 0.*/
try{
for (int c=1; c<theSum.length; ++c){
theSum[c]=(sum[i][k] - sum[all][k]);
/*Returns the squared result of the difference found between different record for the same
* attribute.*/
for (int m=0; m<theSum.length; ++m )//need to square each element of theSum.
theSum[m] = theSum[m]*theSum[m];
/*Add all the attribute differences together and then square them. Stores the resulting values
* in an array. */
for (int ts=0; ts<theSum.length-1; ++ts){
int tts[];
tts = new int[0];/*check this-need to ensure that a value is being stored
for all the rows, ie, don't want it so that each calculation replaces the other without the result
being displayed in the matrix */
tts[0] =tts[0]+ theSum[ts];
distance = Math.sqrt((double)tts[ts]);//get square root of tts
}//end try
catch (NumberFormatException nfe){
if (sum[i][k] == sum[all][k]){
distance = 0;
else if (sum[i][k] == sum[all][k]){
distance =1;
}//end catch
/*Devise the matrix. For the tuples being considered ther Squared Euclidean distance is entered in the
* corresponding element of the array.This produces a matrix with the same number of column as rows.
* The size of the matrix changes since it stores some calculations that
* have been carried out on database rows. As a result the number of rows
* that the database has is called for and this determines the size of the
* matrix.*/
int row1= theRowCount, row2= theCount;
double [][] distanceMatrix;
distanceMatrix= new double [row1][row2];
for (i=1;i<row1; ++i){
for (all = 1; all<row2; ++row2)
distanceMatrix[i][all] =distance;
getMatrix(distanceMatrix);/*The distance matrix is passed call-by-refernce*/
}
When you are debugging your program, take a look at the values of the variables.
Similar Messages
-
Source2wsdd: ServiceGen does not contain a start method - help!
Hello all Weblogic Users!
I would greatly appreciate any help with this problem.
I am getting this error when I do my build on Linux.
[source2wsdd] source2wsdd: Doclet class weblogic.webservice.tools.ddgen.ServiceGen does not contain a start method.
Previously I was getting an error where the ServiceGen class could not be found. This was occuring both in Windows and Linux.
For Windows, this can be fixed in two ways. 1) Run setWLSEnv.cmd first (in weblogic81/server/bin. 2) (Unconfirmed but try it) Add the tools.jar, weblogic.jar, and webservices.jar to the ant runtimes lib in Eclipse (see preferences/ant/runtimes/global entries. - This will let you run the task inside Eclipse)
In Linux, I added the webloigc.jar and webservices.jar to the user's special ~/'.ant/lib directory (see ant documentation). This too fixed the problem of being unable to find the ServiceGen class. But now I am getting the error above. I am ripping my hair out trying to fix it.
Any help would be appreciated.
Thanks to all....Hi bkshn,
This error is caused by the missing "Main" method in your project. it is the entry point of your project.
If you want to create a EF project, you could follow the way in the aricle below.
https://msdn.microsoft.com/en-us/data/ee712907#codefirst
The Main method is like below.
class Program
static void Main(string[] args)
using (var db = new BloggingContext())
// Create and save a new Blog
Console.Write("Enter a name for a new Blog: ");
var name = Console.ReadLine();
var blog = new Blog { Name = name };
db.Blogs.Add(blog);
db.SaveChanges();
// Display all Blogs from the database
var query = from b in db.Blogs
orderby b.Name
select b;
Console.WriteLine("All blogs in the database:");
foreach (var item in query)
Console.WriteLine(item.Name);
Console.WriteLine("Press any key to exit...");
Console.ReadKey();
And you could start to learn the EF from the following MSDN blogs.
https://msdn.microsoft.com/en-us/data/ee712907
If you have any other concern regarding this issue, please feel free to let me know.
Best regards,
Youjun Tang
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey. -
Unsatisfied link when callind dll from run method Help Please?
Hi,
I get an unsatisfied link error while trying to calling a dll at a certain time period in a run method. The same dll works fine called in another setup and even called in a loop.
Can anyone help please?
import java.util.Timer;
import java.util.TimerTask;
* Schedule a task that executes once every second.
public class TimeRetrieve {
Timer timer;
public TimeRetrieve() {
timer = new Timer();
timer.schedule(new RemindTask(),
0, //initial delay
1*1000); //subsequent rate
class RemindTask extends TimerTask
String string_A;
double d1;
double d2;
double d3;
double d4;
double d5;
double d6;
double d7;
double d8;
int numIter = 3;
int start = 1;
public void run()
if (numIter > 0) {
cinterface(start, string_A, d1, d2, d3, d4, d5, d6, d7, d8 );
System.out.println("In Java action performed start button, after call to dll \n");
System.out.println(" string_A = :" +string_A );
System.out.println("doubles , \t d1 \t d2 \t d3 \t d4 \t d5 \t d6 \t d7 \t d8");
System.out.println(d1 +"\t" +d2+"\t"+d3+"\t"+d4+"\t"+d5+"\t"+d6+"\t"+d7+"\t"+d8);
numIter--;
} else
System.out.println("End Looping!");
System.exit
System.exit(0);
public static void main(String args[]) {
System.out.println("Starting Data Retrieval.");
new TimeRetrieve();
// Load shared library which contains implementation of native methods
public native void cinterface(int start, String string_A, double d1, double d2, double d3, double d4,
double d5, double d6, double d7, double d8 );
static
try
System.out.println ("load cinterface"); //unsatisfied link
System.loadLibrary("cinterface");
catch (UnsatisfiedLinkError ee)
System.out.println
("Caught unsatisfied link error for dlls" );
System.out.println
("get local msg = " + ee.getLocalizedMessage() );
System.out.println ("getMessage " + ee.getMessage() );
// System.out.println ("print Stack Trace " +ee.printStackTrace() );My mistake! I found it. Had some wrong names.
-
WebDynpro Methods help for objects in ABAP editor
Hi,
is there a possibility to see the methods that can be used by an specific object?
For example which methods I can use with the object wd_this.
Thank You!You will need to drill into the underlying class to view its methods.
http://help.sap.com/saphelp_nw04s/helpdata/en/35/447741b0d6157de10000000a155106/frameset.htm
Regards,
Rich Heilman -
Object SELFITEM/SENDTASKDESCRIPTION method help needed
Hi All,
I am working on Credit Release workflow for SD documents.
- I have a mail sending step in workflow definition.
- In this step I have created a task which is using SELFITEM object & SENDTASKDESCRIPTION method.
- When I logged into the system with default language (EN) I can see all the details in the mail body.
- When I logged into the system with some other language (Say JA) I can not see all the information in mail body
- Some information like currency of the order value is not shown in mail body when logged in with some other language.
Can anybody will help me to resolve this issue.
Thank you all in advance.
Best Regards,
Deepa KulkarniTry like below:
Data: lv_logon TYPE t002-spras,
lv_text TYPE char80.
lv_logon = sy-langu
if lv_logon EQ 'E'.
lv_text = "English text"
elsif lv_logon EQ 'J'.
lv_text = " Japanese text".
endif.
SWC_SET_ELEMENT CONTAINER 'TEXT' lv_text.
Note...if your content is having multiple lines...then you can go with table parameter instead of variable. -
Non-static method help..
Hello..
I am new to Java and trying to create a Binary Tree, however I have encountered an error "non-static methos cannot be referenced from static context?" and I am unsure how to correct it.. I have C++ background and am unfamiliar with this type of error?
My BTNode class:
public class BTNode
private Object data;
private BTNode left, right;
public BTNode(Object initialData, BTNode initialLeft, BTNode initialRight)
data = initialData;
left = initialLeft;
right = initialRight;
public BTNode()
{ this(null, null, null); }
public BTNode(Object newdata)
{ this(newdata, null, null); }
//NODE methods
public Object getData() //return and set data in node
{return data;}
public void setData(Object data)
{this.data = data; }
public BTNode getLeft() //return and set left child
{return left; }
public void setLeft(BTNode left)
{this.left = left; }
public BTNode getRight() //return and set right child
{return right; }
public void setRight(BTNode right)
{this.right = right; }
public boolean isLeaf() //return true if this is leaf node
{return (left == null)&&(right == null); }
// TREE Methods - for tree starting at this node
// get specific data from a tree
public Object getLeftmostData()
{ if(left == null)
return data;
else
return left.getLeftmostData(); }
public Object getRightmostData()
{ if(right == null)
return data;
else
return right.getRightmostData(); }
// print data in a tree
public void inorderPrint()
if (left != null)
left.inorderPrint( );
System.out.println(data);
if (right != null)
right.inorderPrint( ); }
public void preorderPrint()
System.out.println(data);
if (left != null)
left.preorderPrint( );
if (right != null)
right.preorderPrint( ); }
public void postorderPrint()
if (left != null)
left.postorderPrint( );
if (right != null)
right.postorderPrint( );
System.out.println(data); }
// pretty print a tree
//public void print(int depth);
//Interface for Nodes in Binary Tree (3)
//removing nodes from a tree
//returns reference to tree after removal of node
public BTNode removeLeftmost()
if (left == null) // we are as deep as we can get
return right; // remove this node by returning right subt ree
else
{ // keep going down recursively
left = left.removeLeftmost( );
// when done, return node that act ivated this
// method as root of t ree
return this; }}
public BTNode removeRightmost()
if (right == null) // we are as deep as we can get
return left; // remove this node by returning left subt ree
else
{ // keep going down recursively
right = right.removeRightmost( );
// when done, return node that activated this
// method as root of tree
return this; }}
//returns number of nodes in tree
public static long treeHeight(BTNode root)
if (root == null)
return -1;
else
return 1 + Math.max(treeHeight(root.left),
treeHeight(root.right));
public static long treeSize(BTNode root)
if (root == null)
return 0;
else
return 1 + treeSize(root.left) + treeSize(root.right);
//copying a tree: returns reference to root of copy
// public BTNode treeCopy(BTNode root);
public static BTNode insertNode(BTNode root, int key){
if (root == null) // null tree, so create node at root
return new BTNode(new Integer(key));
Integer data_element = (Integer) root.data;
if (key <= data_element.intValue())
root.setLeft(insertNode(root.left, key));
else root.setRight(insertNode(root.right, key));
return root; }
public static BTNode findNode(BTNode root,int key){
if (root == null)
return null; // null tree
Integer data_element = (Integer) root.data;
if (key == data_element.intValue())
return root;
else
if (key <= data_element.intValue())
return findNode(root.left, key);
else return findNode(root.right, key); }
public static BTNode removeNode(BTNode root, int key){
if (root == null) return null;
Integer data_element = (Integer) root.data;
if (key < data_element.intValue())
root.setLeft(removeNode(root.left, key));
else if (key > data_element.intValue())
root.setRight(removeNode(root.right,key));
else { // found it
if (root.right == null) root = root.left;
else if (root.left == null) root = root.right;
else { //two children
Integer temp = (Integer)
root.left.getRightmostData();
root.setData(temp);
root.setLeft(root.left.removeRightmost());
return root; }
Main class:
import java.util.Random;
public class Lab21 {
/** Creates a new instance of Lab21 */
* @param args the command line arguments
public static void main(String[] args) {
int UpperLimit = 50000;
int Num_Nodes = 500;
Random generator = new Random();
int TR_create = generator.nextInt(UpperLimit);
Integer cast = new Integer(TR_create); // Needed to cast initial value to BTNode object
BTNode Tree_Root = new BTNode(cast); // Creating root object
BTNode result = new BTNode(); // Creating new node object to use for tree
result.insertNode(Tree_Root,TR_create); // Inserting first Node
if (UpperLimit <=0)
throw new IllegalArgumentException("UpperLimit must be positive: " + UpperLimit);
if (Num_Nodes <=0)
throw new IllegalArgumentException("Size of returned List must be greater than 0.");
for( int x = 0; x < Num_Nodes; ++x)
int value = generator.nextInt(UpperLimit);
result.insertNode(Tree_Root,value);
//BTNode.inorderPrint();
System.out.println("The height of this tree is " + BTNode.treeHeight(Tree_Root));
System.out.println("The smallest number in the tree is " + BTNode.getLeftmostData());
}The error is occuring with the last line where I am trying to access getLeftmostData();
Any help would be apprecited with this..
ThankyouUser 557835:
You need to use the name of the instance rather than the name of the class. It should be something like this:System.out.println("The smallest number in the tree is " + result.getLeftmostData());User 135880 -
*JSP*Calling method *Help*
Hello Every1,
I have an JSP page, wich at the top of the page I have a method (Declared Global <%!%>), and at the buttom of tha page I have a JSP form which takes the users data, but I donr know how to call it, can any1 help me plaese, my JSP method is
public void insertIntoCustomers(String Name, String userid, String Address,
String Email, String Password, String type) {
Connection con = null;
Statement stmt = null;
ResultSet rs = null;
try {
con = getDatabaseCon();
stmt = con.createStatement();
String queryText = "insert into customers values ('" + Name+ "', '" + userid + "','" + Address + "','" + Email + "','"+ Password + "','" + type + "')";
int i = stmt.executeUpdate(queryText);
} catch (Exception ex) {
ex.printStackTrace();
}and My jsp form is:
<FORM METHOD="POST" ACTION="register">
<H1>test</H1><p>
Enter your name: <INPUT TYPE=TEXT NAME="name"> <BR>
Enter your address: <INPUT TYPE=TEXT NAME="address"> <BR>
Enter your email: <INPUT TYPE=TEXT NAME="email"> <BR>
Enter your password: <INPUT TYPE=TEXT NAME="password"> <BR><p>
<INPUT TYPE="SUBMIT" VALUE="Register">
</FORM>
my code:
if (request.getParameter("action").equals("register")
{// String Name = request.getParameter("name");
String Address = request.getParameter("address");
String Email = request.getParameter("email");
String Password = request.getParameter("password");
}But I dont know how to link them to the method????
Anyone can help me please,,,
Thank youHi,
This:
<html>
<head><title></title>
</head>
<body>
<FORM METHOD="POST" ACTION="register.jsp">
<H1>test</H1>
Enter your name: <INPUT TYPE=TEXT NAME="name"> <BR>
Enter your address: <INPUT TYPE=TEXT NAME="address"> <BR>
Enter your email: <INPUT TYPE=TEXT NAME="email"> <BR>
Enter your password: <INPUT TYPE=TEXT NAME="password"> <BR>
<INPUT TYPE="SUBMIT" VALUE="Register">
</FORM>
</body>
</html>should be on a page called something like: getUserInfo.htm. The action attribute of the form tag should specify your .jsp page:
<FORM METHOD="POST" ACTION="register.jsp">
When the user clicks on submit, the information entered on the form automatically will be sent to register.jsp. Your register.jsp page will look like this:
<%!
public void insertIntoCustomers(String Name, String userid, String Address,
String Email, String Password, String type) {
Connection con = null;
Statement stmt = null;
ResultSet rs = null;
try {
con = getDatabaseCon();
stmt = con.createStatement();
String queryText = "insert into customers values ('" + Name+ "', '" + userid + "','" + Address + "','" + Email + "','"+ Password + "','" + type + "')";
int i = stmt.executeUpdate(queryText);
} catch (Exception ex) {
ex.printStackTrace();
if (request.getParameter("action").equals("register.jsp")
String Name = request.getParameter("name");
String Address = request.getParameter("address");
String Email = request.getParameter("email");
String Password = request.getParameter("password");
/****/ insertIntoCustomers(Name, Address, Email, Password);
%>However, you have not defined Connection, Statement and ResultSet before using those names, so you are going to get errors. -
The method below will not compile. The error reads" void is an invalid type for the variable selectionSort". What should I do? Also how would I invoke the method?
public static void selectionSort(double[] score, String[] name)
for (int i=scores.length-1; i>=1; i--)
double currentMax=scores[0];
int currentMaxIndex=0;
for (int j=1; j<=i; j++)
if (currentMax<scores[j])
currentMax=scores[j];
currentMaxIndex=j;
if (currentMaxIndex!=i)
scores[currentMaxIndex]=scores;
scores[i]=currentMax;
String temp=names[currentMaxIndex];
names[currentMaxIndex]=names[i];
names[i]=temp;
}Thanks.meepton wrote:
show me how.Why? you didn't write it, you don't understand it so I don't see any beneficial reason to help you. I suggest reading some tutorials about creating and using methods.
Mel -
Synchronize complex TableModel methods help required
Hello everyone,
I am working on a Client/Server Swing application that holds rapidly changing data displayed and manipulated via a JTable(On the client side of course). The server manages a couple hundred simultaneous client connections all working on the same data. All clients are being updated constantly when any data changes (initiated by any users). My table model uses a ArrayList to hold the data row Objects (Object[] to be precise). My TableModel holds all the methods to manipulate the Table content ArrayList, this mean that two different methods often access the same Object simultaneously (update one row and delete an other row in my Table content ArrayList for example). Therefore my ArrayList should be synchronized. But when I try to synchronize my ArrayList like this:
List rvContent = Collections.synchronizedList((ArrayList) in.readObject());
I have to cast my List as an ArrayList every time I need to use it, and even then somehow the application doesn't work anymore.
I was thinking that maybe I could synchronize access to some methods contained in my TableModel, but then how do I synchronize multiple methods in a way that if one method is beeing accessed, all other access request to other synchronized methods within that class are being cued as well?
Fact is that so far, when a lot of data is being manipulated, the client application tends to throw nullPointerExceptions (index out of bound for instance) ex: when a thread deletes one row while another one is calling a fireTableCellUpdated() on the same row.
So I hope I could explain my dilemma clearly enough, despite of my bad English.
Could any expert give me some quality help please on how to manage this kind of task, I am out of resources.
Thanks a lot to this great comunitymdundek, It is very important to know EXACTLY what you are doing when you mess with Threads in a Swing Application. Always follow the following rule --> NEVER CAUSE AN UPDATE BE MADE TO A SWING VISUAL COMPONENT OUTSIDE OF THE AWT-EVENT DISPATCH THREAD. Simple.
I have a huge amount of experience doing exactly what you are trying to do - I'll assume that your clients are RMI-based and that the server is calling a "callback" object. The best way of doing this is to have an AsyncReceiver object, a Controller object and an AsyncUpdate object.
Controller: The purpose of the controller is to update your Swing Data Models but NOT to cause the GUI Components to update (ie. do not fireTableDataChanged() or whatever).
AsyncReceiver: When your (Remote) client receives the callback it passes it along to the async-receiver. The async-receiver uses SwingUtilities.invokeLater() to tell the Controller to update the data models, which will then be updated in the AWT Event-Dispatch Thread.
AsyncUpdate: use the javax.swing.Timer class to periodically update your screen (ie. call fireTableDataChanged() or whatever on your Swing data models). The reason for this is that it is a throttle on the paint() method, which is very expensive. If your GUI receives many updates per second, then calling a fireDataChanged() each time can considerably slow the GUI down. Instead update the data models separately, say every half-second. This is usually plenty.
Other tips are to cache exactly which Table cells have been changed between the half-second updates, and tell the table to only re-paint those cells. When we implemented this in our app, CVPU usage dropped by a factor of about 5.
Anyway, the point is - be very wary about creating explicitly your own Threads within a GUI. This should be done ONLY when you want to execute an expensive piece of work without "freezing" the GUI (in which case you should use the SwingWorker construct (http://java.sun.com/products/jfc/tsc/articles/threads/threads2.html). When you update the GUI, always cause the update to be made in the AWT Event-Dispatch thread through use of the SwingUtilities class./**
* THE AsyncReceiver
public class AsyncReceiver {
private Controller controller_;
public void remoteCallback(final EventObject e) {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
controller_.update(e);
* NOW FOR THE AsyncUpdate
public class AsyncUpdate {
private MyApplication app_;
public void startAsyncUpdates() {
//Redraw every 500 millis
Timer t =
new Timer(
500,
new ActionListener() {
public void actionPerformed() {
app_.causeScreenToRedraw();
t.start();
} -
hello friends,
I need some basic stuff on Method like what actually there role is in ABAP as i am shifting to OOPS . I have read some document but all are explaning methods with classes , kindly reply with some stuff which should be conceptually good.
regards
joshiHi,
We can create class by using these simple steps.
class has declaration step, in this we can define call componets like
methods, attributes,evnts..
*local class creation
CLASS <class> DEFINITION.
METHOD <meth>. "for defining methods.
ENDMETHOD.
ENDCLASS.
class has implementation section, in this section we can provide implementations to all the definitions which are declared in class declaration section.
CLASS <class> IMPLEMENTATION.
ENDCLASS.
simple example;
CLASS C_COUNTER DEFINITION.
PUBLIC SECTION. " here declare public components
METHODS: SET_COUNTER IMPORTING VALUE(SET_VALUE) TYPE I,
INCREMENT_COUNTER,
GET_COUNTER EXPORTING VALUE(GET_VALUE) TYPE I.
PRIVATE SECTION. "here declare local components
DATA COUNT TYPE I.
ENDCLASS.
CLASS C_COUNTER IMPLEMENTATION.
METHOD SET_COUNTER. " method implemetation
COUNT = SET_VALUE.
ENDMETHOD.
METHOD INCREMENT_COUNTER.
ADD 1 TO COUNT.
ENDMETHOD.
METHOD GET_COUNTER.
GET_VALUE = COUNT.
ENDMETHOD.
ENDCLASS.
Follow these steps to declare object to class.
data: obj type ref to <name of the class>. "here refarence variable is created
CREATE OBJECT obj. "here object is created
*global class creation
we can create global class in CLASS BUILDER, for that one we work with SE24.
check the below links lot of info and examples r there
http://www.sapgenie.com/abap/OO/index.htm
http://www.geocities.com/victorav15/sapr3/abap_ood.html
http://www.brabandt.de/html/abap_oo.html
Check this cool weblog:
/people/thomas.jung3/blog/2004/12/08/abap-persistent-classes-coding-without-sql
/people/thomas.jung3/blog/2004/12/08/abap-persistent-classes-coding-without-sql
http://help.sap.com/saphelp_nw04/helpdata/en/c3/225b6254f411d194a60000e8353423/frameset.htm
http://www.sapgenie.com/abap/OO/
http://www.sapgenie.com/abap/OO/index.htm
http://help.sap.com/saphelp_nw04/helpdata/en/c3/225b5654f411d194a60000e8353423/content.htm
http://www.esnips.com/doc/375fff1b-5a62-444d-8ec1-55508c308b17/prefinalppt.ppt
http://www.esnips.com/doc/2c76dc57-e74a-4539-a20e-29383317e804/OO-abap.pdf
http://www.esnips.com/doc/5c65b0dd-eddf-4512-8e32-ecd26735f0f2/prefinalppt.ppt
http://www.allsaplinks.com/
http://www.sap-img.com/
http://www.sapgenie.com/
http://help.sap.com
http://www.sapgenie.com/abap/OO/
http://www.sapgenie.com/abap/OO/index.htm
http://www.sapgenie.com/abap/controls/index.htm
http://www.esnips.com/doc/2c76dc57-e74a-4539-a20e-29383317e804/OO-abap.pdf
http://www.esnips.com/doc/0ef39d4b-586a-4637-abbb-e4f69d2d9307/SAP-CONTROLS-WORKSHOP.pdf
http://www.sapgenie.com/abap/OO/index.htm
http://help.sap.com/saphelp_erp2005/helpdata/en/ce/b518b6513611d194a50000e8353423/frameset.htm
http://www.sapgenie.com/abap/OO/
these links
http://help.sap.com/saphelp_47x200/helpdata/en/ce/b518b6513611d194a50000e8353423/content.htm
For funtion module to class
http://help.sap.com/saphelp_47x200/helpdata/en/c3/225b5954f411d194a60000e8353423/content.htm
for classes
http://help.sap.com/saphelp_47x200/helpdata/en/c3/225b5c54f411d194a60000e8353423/content.htm
for methods
http://help.sap.com/saphelp_47x200/helpdata/en/08/d27c03b81011d194f60000e8353423/content.htm
for inheritance
http://help.sap.com/saphelp_47x200/helpdata/en/dd/4049c40f4611d3b9380000e8353423/content.htm
for interfaces
http://help.sap.com/saphelp_47x200/helpdata/en/c3/225b6254f411d194a60000e8353423/content.htm
For Materials:
1) http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCABA/BCABA.pdf -- Page no: 1291
2) http://esnips.com/doc/5c65b0dd-eddf-4512-8e32-ecd26735f0f2/prefinalppt.ppt
3) http://esnips.com/doc/2c76dc57-e74a-4539-a20e-29383317e804/OO-abap.pdf
4) http://esnips.com/doc/0ef39d4b-586a-4637-abbb-e4f69d2d9307/SAP-CONTROLS-WORKSHOP.pdf
5) http://esnips.com/doc/92be4457-1b6e-4061-92e5-8e4b3a6e3239/Object-Oriented-ABAP.ppt
6) http://esnips.com/doc/448e8302-68b1-4046-9fef-8fa8808caee0/abap-objects-by-helen.pdf
7) http://esnips.com/doc/39fdc647-1aed-4b40-a476-4d3042b6ec28/class_builder.ppt
8) http://www.amazon.com/gp/explorer/0201750805/2/ref=pd_lpo_ase/102-9378020-8749710?ie=UTF8
1) http://www.erpgenie.com/sap/abap/OO/index.htm
2) http://help.sap.com/saphelp_nw04/helpdata/en/ce/b518b6513611d194a50000e8353423/frameset.htm
Regards,
Padmam. -
String Methods Help Please~```
Hi, I have a question that goes like this:
Write a Java class called KillWhiteSpace, which defines a main() method that asks the user to enter a String s, and displays a new String consisting of all the characters in s, but with the leading and trailing white space removed. In addition, every sequence of spaces within the String is reduced to one space only. You MUST NOT use any methods defined in the String class other than charAt() and length().
So far, I wrote
import java.until.Scanner;
public class KillWhiteSpace{
public static void main(String args[]){
System.out.println("Please enter a bunch of texts");
Scanner keyboard=new Scanner(System.in);
String w=keyboard.nextLine();
Now I know what charAt() and length() does but I don't know how to use it to satisfy the requirements above. Any helps?
Edited by: Lillian_Cao on Oct 20, 2008 8:17 PMI don't want to give you too much since this is clearly an educational exercise, but to get you going, it looks like you you want to iterate over all the characters in the string, analyze each one, keeping track of previous characters and construct your new string as you go.
Good luck and have fun. -
Altering a text file using methods, help please!
Hi I'm new to this forum so please bear with me, my problem is I have written a program for a gym using methods, my program works fine but i need to add another switch (case 5:) to my program, this new switch needs to take the information from case 4: and enable me to change any details and store these changes into a new text file, I know i need a filewriter to store new details into a new text file but i cant figure out how to get the details from case 4: into case 5: and be able to alter these details on screen??, hope this is enough information as to what my problem is. Thnx
import javax.swing.JOptionPane;
import java.io.*;
class GymProgram1
static void menu(String gym[][])
int choice = 0;
while (choice < 1 || choice > 5)
String input = JOptionPane.showInputDialog("Enter a numerical choice to...\n1: Find customers who smoke, lost weight, use cycles, treadmills, steps, skis or weights \n2: Find customers over a certain age \n3: Find average of all customers \n4: Find a customers details \n5: Exit");
if (input == null)
menu(gym);
try
choice = Integer.parseInt(input);
catch (NumberFormatException e)
switch (choice)
case 1: search(gym, choice);
break;
case 2: age(gym, choice);
break;
case 3: average(gym, choice);
break;
case 4: details(gym, choice);
break;
default: System.exit(0);
menu(gym);
static void search(String gym[][], int choice)
String output = "";
int column = 0;
boolean printed = false;
switch(choice)
case 1: int yessearch = 0;
while (yessearch < 1 || yessearch > 7)
String input = JOptionPane.showInputDialog("Enter a numerical choice to...\n1: Find customers that smoke \n2: Find customers who lost weight \n3: Find customers who use cycles \n4: Find customers who use treadmill \n5: Find customers who use steps \n6: Find customers who use ski's \n7: Find customers who use weights ");
if (input == null)
JOptionPane.showMessageDialog(null, "Cancel pressed");
menu(gym);
try
yessearch = Integer.parseInt(input);
catch (NumberFormatException e)
switch (yessearch)
case 1: column = 3;
break;
case 2: column = 4;
break;
case 3: column = 5;
break;
case 4: column = 6;
break;
case 5: column = 7;
break;
case 6: column = 8;
break;
default:column = 9;
for (int row = 0;row < gym.length ;row++ )
if (gym[row][column].equalsIgnoreCase("yes"))
output += gym[row][0] + " " + gym[row][1] + '\n';
printed = true;
if (printed == false)
output = "No data found......";
display(output);
static void age(String gym[][], int choice)
String output = "";
int column = 2;
boolean printed = false;
int ageentered=0;
int customerage=0;
String input=JOptionPane.showInputDialog("Enter an age");
if (input==null)
JOptionPane.showMessageDialog(null, "Cancel pressed");
menu(gym);
try
ageentered =Integer.parseInt(input);
catch (NumberFormatException e)
switch(choice)
case 2:
for (int row = 0;row < gym.length ;row++ )
customerage=Integer.parseInt(gym[row][column]);
if (ageentered <= customerage)
output += gym[row][0] + " " + gym[row][1] + " = " + gym[row][2] + '\n';
printed = true;
if (printed == false)
output = "No data found......";
display(output);
menu(gym);
static void display(String output)
JOptionPane.showMessageDialog(null, output);
static void average(String gym[][], int choice)
boolean printed=false;
String output="";
int column = 0;
int counter=0;
int totalage=0;
int average=0;
switch (choice)
case 3:
column = 2;
for (int row = 0;row < gym.length ;row++ )
counter++;
totalage+=Integer.parseInt(gym[row][2]);
printed = true;
average=totalage/counter;
if (printed == false)
output = "No data found......";
output="Average age = " + average;
display(output);
menu(gym);
static void details(String gym[][], int choice)
String customer = "";
String output = "";
int column = 1;
boolean printed = false;
switch (choice)
case 4: customer = JOptionPane.showInputDialog("Enter a customers surname");
if (customer == null)
JOptionPane.showMessageDialog(null, "Cancel pressed");
menu(gym);
for (int row = 0;row < gym.length ;row++ )
if (gym[row][column].equalsIgnoreCase(customer))
output += gym[row][0] + " " + gym[row][1] + "\n age = " + gym[row][2] + "\n smoke = " + gym[row][3] + "\n weight loss = " + gym[row][4] + "\n cycles = " + gym[row][5]+ "\n treadmills = " + gym[row][6] + "\n steps = " + gym[row][7] + "\n skis = " + gym[row][8] + "\n weights = " + gym[row][9] + '\n';
printed = true;
if (printed == false)
output = "No data found......";
display(output);
static String[][] inputData()
String gym[][] = new String[25][10];
try
FileReader file = new FileReader ("a:/assign.txt");
BufferedReader buff = new BufferedReader(file);
for (int row = 0;row<gym.length ;row++ )
for (int column = 0; column < 10;column ++)
gym[row][column] = buff.readLine();
buff.close();
catch (IOException e)
System.out.println("Error - - " + e.toString());
return gym;
public static void main(String[] args)
String gym[][] = inputData();
menu(gym);
for (int row = 0;row < gym.length ;row++ )
System.out.println(gym[row][0] + " " + gym[row][1] + " " + gym[row][2] + " " + gym[row][3] + " " + gym[row][4] + " " + gym[row][5] + " " + gym[row][6] + " " + gym[row][7] + " " + gym[row][8] + " " + gym[row][9]);
}Thnx for the reply TJ, I'm still confused about this problem, heres what ive done now and i still cant get the details of a customer up on the screen for me to change their details, i havnt pasted the whole program this time just what ive altered in the menu and case 5:, hope you can help.
static void menu(String gym[][])
int choice = 0;
while (choice < 1 || choice > 6)
String input = JOptionPane.showInputDialog("Enter a numerical choice to...\n1: Find customers who smoke, lost weight, use cycles, treadmills, steps, skis or weights \n2: Find customers over a certain age \n3: Find average of all customers \n4: Find a customers details \n5: Update a customers details \n6: Exit");
if (input == null)
menu(gym);
try
choice = Integer.parseInt(input);
catch (NumberFormatException e)
switch (choice)
case 1: search(gym, choice);
break;
case 2: age(gym, choice);
break;
case 3: average(gym, choice);
break;
case 4:
case 5: details(gym, choice);
break;
default: System.exit(0);
menu(gym);
static void details(String gym[][], int choice)
String customer = "";
String output = "";
int column = 1;
boolean printed = false;
switch (choice)
case 4: customer = JOptionPane.showInputDialog("Enter a customers surname");
if (customer == null)
JOptionPane.showMessageDialog(null, "Cancel pressed");
menu(gym);
for (int row = 0;row < gym.length ;row++ )
if (gym[row][column].equalsIgnoreCase(customer))
output += gym[row][0] + " " + gym[row][1] + "\n age = " + gym[row][2] + "\n smoke = " + gym[row][3] + "\n weight loss = " + gym[row][4] + "\n cycles = " + gym[row][5]+ "\n treadmills = " + gym[row][6] + "\n steps = " + gym[row][7] + "\n skis = " + gym[row][8] + "\n weights = " + gym[row][9] + '\n';
printed = true;
if (printed == false)
output = "No data found......";
display(output);
case 5:
try
String display1 = "assign.txt";
FileInputStream fi = new FileInputStream(display1);
byte inData[] = new byte[fi.available()];
fi.read(inData);
fi.close();
String text = new String(inData);
String textToAppend = "kjkjhjhKJ";
byte outData[] = textToAppend.getBytes();
FileOutputStream fo = new FileOutputStream(display1,true);
fo.write(outData);
fo.close();
catch(Exception e)
System.out.println("Error - - " + e.toString());
display(output);
menu (gym);
} -
AreaSeries areaFill method help????
Can anyone please help me with the following code.
Apparently I'm not able to use the areaFill, areaStroke
function on the areaSeries object.
It return "no such porperty or method error"
Thanks in advance
Pranay
aSeries = new AreaSeries();
aSeries.id = "series"+i+""+j;
aSeries.xField = "x";
aSeries.yField = "y"+j;
aSeries.displayName = seriesArr
.SeriesY[j];
aSeries.areaFill = new SolidColor(0xFD8820, 0.20);
aSeries.areaStroke = new Stroke(0xFD8820, 0.20);
aSeries.fill = new SolidColor(0xFD8820, 0.20);
aSeries.radius = 3;
aSeries.form = "segement";http://forum.java.sun.com/thread.jsp?forum=31&thread=517166
-
Hi!
There are two classes: CDRack and Record(which is done).
I have problems with methods
-getNumberOfCDs()
Should I write a new field numberOfCDs, or do I get it in other way?
-ideas how to accomplish
method move(CDRack anotherRack) ?
thanks a lot!
ps.How can I put Duke Dollars to my question? I`ve searched
information but haven't found.
Class CDRack represents collections of compact discs. Discs are located
in the rack in slots numbered from zero upwards. The discs are
represented by Record objects and empty slots by null values.
public class CDRack extends Object {
private Record[] collection;
private int size;
private Record record;
private int slot;
/** Creates a new, empty CD rack.
Parameters:
size - the size of the new rack, i.e. the number of slots it has */
public CDRack(int size) {
collection = new Record[size];
this.size = size;
this.slot = slot;
Returns the size of the rack, i.e. the number of slots it has.
Returns:
the size of the rack
public int getSize() {
return this.size;
/** Returns the number of CDs in the rack.
Returns:
the number of discs in the rack
public int getNumberOfCDs() {
Returns the cd in the given rack slot.
Parameters:
slot - a slot number
Returns:
the cd in the given slot or null if the slot is empty
public Record getCD(int slot) {
if (collection[slot].equals(null) )
return null;
else {
record = collection[slot];
return record;
/** Inserts a cd in the given rack slot if the slot in question is empty.
Parameters:
disc - the cd to be added in the rack
slot - the number of a (hopefully empty) slot
Returns:
a boolean value indicating if the insertion was successful. */
public boolean insert(Record disc,
int slot) {
if (collection[slot].equals(null)) {
collection[slot] = record;
return true;
else
return false;
/** Removes a CD from the given rack slot.
Parameters:
slot - the slot to be emptied
Returns:
the removed cd or null if the given slot was empty */
public Record remove(int slot) {
if (collection[slot].equals(null))
return null;
else {
record = collection[slot];
collection[slot] = null;
return record;
/** Determines if the given disc object is stored in the rack.
Parameters: disc - a disc to be located in the rack
Returns:
the slot number of the given cd if it is in the rack or a negative number if it is not */
public int find(Record disc) {
if (collection[slot].equals(null))
return -1;
else {
record = collection[slot];
return slot;
/** Inserts the given cd in the first empty rack slot (if there is even
one empty slot in the rack).
Parameters: disc - the disc to be added in the rack
Returns:
the number of the slot where the disc was added, or a negative number
if the rack was already full */
public int insert(Record disc) {
if (collection[slot].equals(null)) {
record = collection[slot];
return slot;
else
return -1;
/** Moves all the discs from the given cd rack to this rack. The cds from the
other rack are inserted in the empty slots of this rack (in ascending numerical
order of slot numbers) in the order in which they are located in the other rack.
The moved discs are removed from their original rack. Even if there is not enough space
for all the discs in this rack, as many cds are moved as possible.
Parameters:
anotherRack - another rack whose cds are to be moved into this one
Returns:
the number of cds moved from the other rack to this one */
public int move(CDRack anotherRack) {
In another class Record I have
-constructor Record(String artist, String name, String category), which
creates a new record with the given properties.
and methods:
-String getArtist() Returns the name of the artist.
-String getCategory() Returns the category in which the recording has been pigeonholed.
-String getName() Returns the name of the recordpublic int getNumberOfCDs() {
int count = 0;
for (int c=0; c<collection.length; c++) {
if (collection[c]!=null) {
count++;
return count;
public int insert(Record disc) {
for (int c=0; c<collection.length; c++) {
if (collection[c]!=null) {
collection[c] = disk;
return c;
return -1; // not enough place
public int move(CDRack anotherRack) {
for (int c=0; c<collection.length; c++) {
if (collection[c]!=null) {
if (anotherRack.insert(collection[c])<0) {
throw new RuntimeException("no more empty slot");
} else {
collection[c] = null;
}Btw, you don't really need such members as "slot", "record", "size". -
Doubt in working of Arrays.sort method. help needed !!!!
Hello Friends,
I am not able to understand output of Arrays.sort method. Here is the detail of problem
I wrote one program :
public static void main(String[] args) throws ClassNotFoundException
Object[] a = new Object[10];
a[0] = new String("1");
a[1] = new String("2");
a[2] = new String("4");
a[3] = new String("3");
a[4] = new String("5");
a[5] = new String("20");
a[6] = new String("6");
a[7] = new String("9");
a[8] = new String("7");
a[9] = new String("8");
/* Sort entire array.*/
Arrays.sort(a);
for (int i = 0; i < a.length; i++)
System.out.println(a);
and output is :
1
2
20
3
4
5
6
7
8
9
Question : Does this output is correct? If yes then on which basis api sort an array? I assume output should be 1 2 3 4 5 6 7 8 9 20.
Can here any one please explain this?
Thanks in advance.
Regards,
Rajesh Rathodjverd wrote:
"20" and "3" are not numbers. They are strings, and "20" < "3" is exactly the same as "BA" < "C"The above is
... quote 20 quote less than quote 3 quote...
but shows up as
... quote 20 quote less than quote...
Weird. -
i created a new apple id on the computer and when i go to use it on the iphone i have to review my account and it asks for payment method, is there any way around this.
You could see if this post from mountaingoatgirl lets you review your account without entering card details : https://discussions.apple.com/message/24303054
If not then you will need to create a new account, and this time follow the instructions on this page when creating it : http://support.apple.com/kb/HT2534
If you want to use the same email address then you will need to replace it on that account first e.g. by tapping on it in Settings > iTunes & App Store on your phone, via the Store > View Account menu option on your computer's iTunes or via http://appleid.apple.com
Creating an account with 'none' :
computer's iTunes : https://discussions.apple.com/message/24321860
iPhone : https://discussions.apple.com/message/24700173
Maybe you are looking for
-
Pricing Procedure for Special case of Excise 0 and CST 2%
Dear Friends, This is peculiar requirement for my client, we need to create a pricing procedure which is not had excise and cess value and it shout calculate VAT or CST. The requirement is i need to calculate Excise duty and cess on Basic price but t
-
How do I connect my Mac Desktop to my work windows
how do i connect my Mac desktop computer to my work windows computer
-
Convert .txt file to .pdf using java code
Hi, My requirement is to read the .txt file and convert it into .pdf file after changing certain text. Searched the net got a document on iText ..is it the only way for conversion or any other method....please help. Thanks in advance. Pooja
-
What is the best way to back up a project on another hard drive? including all media. Do I have to clone the drive or is there an easier way? Vince
-
Profit center line for free of charge items
Hi all Is it possible to force SAP to write the create a profit center items for free of charge items of SD invoice (positions TANN), of course with zero value but with the quantity data? Thanks. Davide