User mail ID validation with RSCONN01 program
Hi All,
I want to send mail to particular users only.
How can i set there mail IDs , so that when program RSCONN01 runs , it will pick only those mails, which are to be sent only to those users ?
It should not pick the mails for other users.
Thanks.
Hi Roy,
Got one idea how it will be depends on your requirement.
You are saying only to some particular email ids you want to send. In that case where dont you create a table storing the email ids and in the selection screen input validate the email id with a select statement. If your are having any issues to create table because of database considerations, we can also get the input of email ids with in program either by search help or drop down.
How much you can implement from my input revert me back.
Cheers!!
Balu
Similar Messages
-
the problem I have since I upgraded to Mavericks version 10.9.1
The problem appears only with Mail not with other programs, not even with my browser.
When I try to zoom the text of an e-mail I received or sent , I can no longer use the keys Command + to enlarge the text, although I can reduce it with Command -.
As I have a problem with my eyes, This is a serious matter for me.
When I write an e-mail, if I select text and press Command +, it just displaces the text to the right.
Now, my husband has a USB keyboard. If he connects it to my computer, his regular Command + does not work either, but he uses the extended keyboard, then it works. Unfortunately, he needs it for a musical application which does not work with a wireless keyboard.Firefox 3.6.4 and 3.6.6 use a process called, "plugin-container.exe" which was using up most of my CPU when I opened up multiple tabs that contained Adobe Flash files, and caused Firefox to lock up.
My solution was to use Firefox 3.5.10 which you can get from the Mozilla website at [http://www.mozilla.com/en-US/firefox/all-older.html]
I am using Adobe Flash 10.1.53.64 without any problem in this version of Firefox. Check the release notes, I believe it contains all the latest security fixes in "Firefox 3.6.4".
Hopefully, they will fix Firefox 3.6 in the next version (e.g. Firefox 3.6.7), until then you should probably use "Firefox 3.5.10". -
Apple doesn't allow Mail users to open links with Chrome
Apple doesn't allow Mail users to open links with Chrome, Chrome is the deafult browser and it seems that there is a blockage for 3rd party browser, not very nice !!!!!!
Apple doesn't allow Mail users to open links with Chrome, Chrome is the deafult browser and it seems that there is a blockage for 3rd party browser, not very nice !!!!!!
-
How to check list of users from OS level with type and validity AIX+DB2
Hi,
We have 40 clients in our ECC -PRD system. we do not have authorizations to login all clients , only we have 000 accessonly.
we need to check all users type and validity in the system. can any one please help me this script.
regards,
balaramiHello,
Yes you can check the user validity and tye from OS level with DB script.
ORACLE SQL scripts : I assume that schema for your system as sapr3.
First you check the table fields by desc sapr3.usr02;
then can select these fields for user as select <field name1>, <field name2> from sapr3.user02 where uname=<required user name> and mandt=<client>;
check exact details before you execute script @ ORA level*
If you want to see logged on users - you can see them with your '000' ID for all 40 clients.
Hope this helps.
Thanks,
Amit Thombare -
I cannot open a .pdf in an incoming mail (Outlook 2010) with Acrobat Pro XI. It will only allow "preview". I have to copy and paste the .pdf to my desktop and then open it. What do I do to restore the 2x click in Outlook to open the .pdf? As of now, I get the following bracket opening on screen when I click on the Acrobat icon for attachment within the email: Thank you
Adobe Acrobat has stopped working
Windows can check online for a solution to the problem.
-Check online for a solution and close the program
-Close the program
Problem signature:
Problem Event Name: APPCRASH
Application Name: Acrobat.exe
Application Version: 11.0.7.79
Application Timestamp: 536b812b
Fault Module Name: Acrobat.dll
Fault Module Version: 11.0.7.79
Fault Module Timestamp: 536b80ff
Exception Code: c0000005
Exception Offset: 00cbf281
OS Version: 6.1.7601.2.1.0.256.48
Locale ID: 1033
Additional Information 1: 0a9e
Additional Information 2: 0a9e372d3b4ad19135b953a78882e789
Additional Information 3: 0a9e
Additional Information 4: 0a9e372d3b4ad19135b953a78882e789
Read our privacy statement online:
http://go.microsoft.com/fwlink/?linkid=104288&clcid=0x0409
If the online privacy statement is not available, please read our privacy statement offline:
C:\Windows\system32\en-US\erofflps.txtHi Gary,
I have seen this issue occur with users who have this registry setting missing or have improper permissions.
When you double click the attachment to launch the pdf it is saved and opened from the temporary folder unless saved specifically to a location.
If you dont have the below mentioned registry key or improper permissions then attachments fail to open.
Please heck if the following reg key exists:
HKEY_CURRENT_USER\Software\Microsoft\Office\14.0\Outlook\Security
or
HKEY_CURRENT_USER\Software\Policies\Microsoft\Office\14.0\Outlook\Security
Value Name: OutlookSecureTempFolder
If the value exists, and if the value contains a valid path, Outlook 2010 uses that location for its temporary files.
If the registry value does not exist, or if the value points to an invalid location, Outlook 2010, Outlook 2007, or Outlook 2003 creates a new subdirectory under the Temporary Internet Files directory and then puts the temporary file in the new subdirectory. The name of the new subdirectory is unknown and is randomly generated, depending on your version of Outlook.
Please check the following key:
HKEY_CURRENT_USER\Software\Microsoft\Office\14.0\Outlook\Security
Note the location for: OutlookSecureTempFolder key
Check if the same folder exists in the following location and if not create a corresponding folder in the location on C:\Users\<User account name>\Appdata\Local\Software\Microsoft\Windows\......
Regards,
Rave -
How to do the Validations in Report Programming?
How to do the Validations in Report Programming?
how to do screen Validations and Field Validations if posssible can any one send the code regarding the Validation ....
Tks
DurusojuAT SELECTION-SCREEN - selscreen_event
Syntax
| { ON {para|selcrit} }
| { ON END OF selcrit }
| { ON BLOCK block }
| { ON RADIOBUTTON GROUP radi }
| { }
| { ON {HELP-REQUEST|VALUE-REQUEST}
| FOR {para|selcrit-low|selcrit-high} }
| { ON EXIT-COMMAND }.
Alternatives:
1. ... OUTPUT
2. ... ON {para|selcrit}
3. ... ON END OF selcrit
4. ... ON BLOCK block
5. ... ON RADIOBUTTON GROUP radi
6. ... { }
7. ... ON {HELP-REQUEST|VALUE-REQUEST} FOR
{para|selcrit-low|selcrit-high} }
8. ... ON EXIT-COMMAND
Effect
These additions allow individual evaluation of specific elements of the selection screens of the program. The information as to which selection has triggered the event is contained in the system field sy-dynnr.
Alternative 1
... OUTPUT
Effect
This event is triggered at the screen event PBO of a selection screen. In the event block, the selection screen can be prepared through assignments to the data objects of parameters and selection criteria and through dynamic screen modifications.
Note
The assignments to input fields in the event block AT SELECTION-SCREEN OUTPUT always affect the selection screen and overwrite the user inputs from previous displays of the same selection screen. Assignments in the event blocks LOAD-OF-PROGRAM oder INITIALIZATION, on the other hand, only have an effect at first program start.
Alternative 2
... ON {para|selcrit}
Effect
This event is triggered at the screen event PAI of a selection screen if the content of the input field of a parameter para or a line of a selection criterion selcrit was passed to the ABAP program. In the event block, the user input can be checked. Sending a warning or an error message in the event block makes the fields para and selcrit ready for input again.
No parameter that is defined as a radio button can be specified. For this purpose, the addition ON RADIOBUTTON GROUP is provided.
Note
If a user action takes place in the dialog box for the multiple selection of a selection criterion selcrit, the entries of the selection table are passed to the program, line by line. For each line, the event AT SELECTION-SCREEN ON selcrit is triggered.
Alternative 3
... ON END OF selcrit
Effect
This event is triggered after the selection table selcrit has been fully passed to the program after a user action in the dialog box for the multiple selection has taken place. In the event block, the entire selection table can be checked.
Alternative 4
... ON BLOCK block
Effect
This event is triggered at the screen event PAI of a selection screen if all the input fields of a block block of the selection screen were passed to the ABAP program. In the event block, the user inputs can be checked. Sending a warning or an error message in the event block makes all the fields of the block block ready for input again.
Alternative 5
... ON RADIOBUTTON GROUP radi
Effect
This event is triggered at the screen event PAI of a selection screen if all the fields of a radio button group radi of the selection screen were passed to the ABAP program. In the event block, the user input can be checked. Sending a warning or error message in the event block makes all the radion buttons of the block radi ready for input again.
Note
The individual fields of a radio button group are not passed individually and do not trigger the event AT SELECTION-SCREEN ON par.
Alternative 6
Effect
The event AT SELECTION-SCREEN itself is triggered as the last event of selection screen processing if all the input values were passed to the program. In this event block, all the user inputs can be checked. Sending a warning or an error message in the event block makes all the screen fields ready for input once again.
Alternative 7
... ON { HELP-REQUEST | VALUE-REQUEST } FOR
{para|selcrit-low|selcrit-high} }
Effect
The two events ON HELP-REQUEST and ON VALUE-REQUEST are triggered at the screen events POH and POV of a selection screen if - for the input field of a parameter para or one of the input fields of a selection criterion selcrit - the field help F1 or the input help F4 was called. Other selection events are not triggered.
In the event blocks, a self-defined field or input field can be programmed, which overrides any helps possibly defined in the ABAP Dictionary.
Notes
These event blocks can only be implemented for fields of the selection screen that are defined in the same ABAP program and not in a possibly linked logical database.
With the events for the field and input help, no data is transported between the selection screen and the ABAP program. As with general screens, suitable function modules must be used for these. The parameters and selection criteria changed for the input help are transported to the selection screen.
Alternative 8
... ON EXIT-COMMAND
Effect
This event is triggered if the user has called one of the functions Back, Exit or Cancel. In the event block, possible clean-up actions can be executed.
Example
In these executable programs, a standard selection screen and a further selection screen are defined. In the event blocks AT SELECTION-SCREEN, the inputs in the selection screens can be specially handled using the name p_carrid and the screen number in sy-dynnr.
REPORT demo_at_selection_screen.
Global data
DATA: sflight_tab TYPE TABLE OF sflight,
sflight_wa LIKE LINE OF sflight_tab.
Selection screens
PARAMETERS p_carrid TYPE spfli-carrid.
SELECTION-SCREEN BEGIN OF SCREEN 500.
SELECT-OPTIONS s_conn FOR sflight_wa-connid.
DATA s_conn_wa LIKE LINE OF s_conn.
SELECTION-SCREEN END OF SCREEN 500.
Handling selection screen events
AT SELECTION-SCREEN ON p_carrid.
IF p_carrid IS INITIAL.
MESSAGE 'Please enter a value' TYPE 'E'.
ENDIF.
AUTHORITY-CHECK OBJECT 'S_CARRID'
ID 'CARRID' FIELD p_carrid
ID 'ACTVT' FIELD '03'.
IF sy-subrc = 4.
MESSAGE 'No authorization for carrier' TYPE 'E'.
ELSEIF sy-subrc <> 0.
MESSAGE 'Error in authority check' TYPE 'A'.
ELSE.
IF sy-ucomm = 'ONLI'.
CALL SELECTION-SCREEN '0500'.
ENDIF.
ENDIF.
AT SELECTION-SCREEN.
IF sy-dynnr = '0500'.
IF s_conn IS INITIAL.
MESSAGE 'Please enter values' TYPE 'W'.
ELSE.
SELECT *
FROM sflight
INTO TABLE sflight_tab
WHERE carrid = p_carrid AND
connid IN s_conn.
IF sy-subrc <> 0.
MESSAGE 'No flights found' TYPE 'E'.
ENDIF.
ENDIF.
ENDIF.
Main program
START-OF-SELECTION. -
How to send files to others mail id when executing the program
Hi all,
I am getting text file from application server and i am sending total text file data into my internal table.
I am checking this internal table data especially material number and customer number with data base tables mara and kna1.If the matnr and kunnr are existing in database successfully means then only i am creating the sales orders for that text file data.if any record out of 10 records is not success means i am not creating sales orders for total text file data.
My error log file as
file name,date time,total no of records,error record no,error description.
one more text file as
file name,date time,total no of records,succesful records , error records.
I am getting these all data into my one more internal table.
I am appending all data into my internal table.
so i want retrieve only last row of data from that internal table.pls guide me how to get last row from the internal table.
these text files i have to send to my user mail id directly when i am executing the program.
any one knows the any function modules to send that text files to perticular mails.pls send the FM's to me.
Regards,
lokesh.hi
good
go through this report,hope help you to solve your problem
report y_cr17_mail.
data method1 like sy-ucomm.
data g_user like soudnamei1.
data g_user_data like soudatai1.
data g_owner like soud-usrnam.
data g_receipients like soos1 occurs 0 with header line.
data g_document like sood4 .
data g_header like sood2.
data g_folmam like sofm2.
data g_objcnt like soli occurs 0 with header line.
data g_objhead like soli occurs 0 with header line.
data g_objpara like selc occurs 0 with header line.
data g_objparb like soop1 occurs 0 with header line.
data g_attachments like sood5 occurs 0 with header line.
data g_references like soxrl occurs 0 with header line.
data g_authority like sofa-usracc.
data g_ref_document like sood4.
data g_new_parent like soodk.
data: begin of g_files occurs 10 ,
text(4096) type c,
end of g_files.
data : fold_number(12) type c,
fold_yr(2) type c,
fold_type(3) type c.
parameters ws_file(4096) type c default 'c:\debugger.txt'.
Can me any file fromyour pc ....either xls or word or ppt etc ...
g_user-sapname = sy-uname.
call function 'SO_USER_READ_API1'
exporting
user = g_user
PREPARE_FOR_FOLDER_ACCESS = ' '
importing
user_data = g_user_data
EXCEPTIONS
USER_NOT_EXIST = 1
PARAMETER_ERROR = 2
X_ERROR = 3
OTHERS = 4
if sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
fold_type = g_user_data-outboxfol+0(3).
fold_yr = g_user_data-outboxfol+3(2).
fold_number = g_user_data-outboxfol+5(12).
clear g_files.
refresh : g_objcnt,
g_objhead,
g_objpara,
g_objparb,
g_receipients,
g_attachments,
g_references,
g_files.
method1 = 'SAVE'.
g_document-foltp = fold_type.
g_document-folyr = fold_yr.
g_document-folno = fold_number.
g_document-objtp = g_user_data-object_typ.
*g_document-OBJYR = '27'.
*g_document-OBJNO = '000000002365'.
*g_document-OBJNAM = 'MESSAGE'.
g_document-objdes = 'sap-img.com testing by program'.
g_document-folrg = 'O'.
*g_document-okcode = 'CHNG'.
g_document-objlen = '0'.
g_document-file_ext = 'TXT'.
g_header-objdes = 'sap-img.com testing by program'.
g_header-file_ext = 'TXT'.
call function 'SO_DOCUMENT_REPOSITORY_MANAGER'
exporting
method = method1
office_user = sy-uname
ref_document = g_ref_document
new_parent = g_new_parent
importing
authority = g_authority
tables
objcont = g_objcnt
objhead = g_objhead
objpara = g_objpara
objparb = g_objparb
recipients = g_receipients
attachments = g_attachments
references = g_references
files = g_files
changing
document = g_document
header_data = g_header
FOLMEM_DATA =
RECEIVE_DATA =
File from the pc to send...
method1 = 'ATTCREATEFROMPC'.
g_files-text = ws_file.
append g_files.
call function 'SO_DOCUMENT_REPOSITORY_MANAGER'
exporting
method = method1
office_user = g_owner
ref_document = g_ref_document
new_parent = g_new_parent
importing
authority = g_authority
tables
objcont = g_objcnt
objhead = g_objhead
objpara = g_objpara
objparb = g_objparb
recipients = g_receipients
attachments = g_attachments
references = g_references
files = g_files
changing
document = g_document
header_data = g_header
method1 = 'SEND'.
g_receipients-recnam = 'MK085'.
g_receipients-recesc = 'B'.
g_receipients-sndex = 'X'.
append g_receipients.
call function 'SO_DOCUMENT_REPOSITORY_MANAGER'
exporting
method = method1
office_user = g_owner
ref_document = g_ref_document
new_parent = g_new_parent
importing
authority = g_authority
tables
objcont = g_objcnt
objhead = g_objhead
objpara = g_objpara
objparb = g_objparb
recipients = g_receipients
attachments = g_attachments
references = g_references
files = g_files
changing
document = g_document
header_data = g_header.
*-- End of Program
thanks
mrutyun^ -
Developer: How can I let people open files with my program?
Hello Everyone,
I just finished my program for the Mac, and decided to make it an application.
I used Platypus to make my program into an application. Unfortunately when I try to open a file with my program (control + click on file + open with -> other), my application is grayed out and I can't select it. I see it there along with the other applications but I can't select it like I can Mail or TextEdit.
I read somewhere I had to use XCode to let people open files with my program but I have never used XCode and I have no idea how to do that. Any help would be appreciated.
Thanks,
NickYou've posted in the wrong forum. This is the OS X Leopard Installation and Setup forum. You need to post your problem in the Developers forum. Also, since Platypus is not an Apple product, you should visit it's developers forum for assistance. The Apple Discussions is intended to assist users with problems and questions about Apple products only.
To use XCode Tools you need to install it from the Optional Installs folder on your OS X Installer Disc One. It comes with documentation. More assistance can be found at developer.apple.com. -
Does anybody have experience with mail recipient validation against LDAP for instance ?
Any hints and suggestions appreciated.
Thanksthe MTA checks for it's own configuration in the directory pointed by the configutil parameter local.ldaphost and for user/group information in the one pointed by local.ugldaphost if you just made the default installation now both point to the same directory, but if you want your MTA check for user/group infromation against another directory, then you can set it with configutil -o local.ugldaphost <NAME_OF_THE_DIR_HOST>is that what you have in mind?
-
Check data valid with Java Script
Hi, every one,
I made a jsp program and just to check if the data is valid before submit. My problem is even the data is invalid, it still go to next jsp page and display alert message at the same time. But I think if the data is invalid, we can't go to next jsp page. So, any one can tell me what's wrong with my program.
Thanks in advance.
The source code is as follows:
<HTML><HEAD>
<TITLE>TEST PROGRAM</TITLE>
<SCRIPT LANGUAGE="JavaScript">
function validate(){
if(document.form1.yourname.value.length < 1){
alert("please enter your full name");
return false;
if(document.form1.address.value.length < 3){
alert("please enter your address.");
return false;
if(document.form1.phone.value.length < 3){
alert("please enter your phone number");
return false;
return true;
</SCRIPT>
</HEAD>
<BODY>
<H1>FORM EXAMPLE</H1>
Enter the following information. When you press the Display button,
the data you entered will be validated, then sent by e-mail.
<form name="form1" action="a2.jsp" enctype="text/plain" onSubmit="validate();">
<p>
<b>Name:</b><input type="text" length="20" name="yourname">
<p>
<b>Address:</b>
<input type="text" length="30" name="address">
<p>
<b>Phone:</b><input type="text" length="15" name="phone">
<p>
<input type="SUBMIT" value="Submit">
</FORM>
</BODY>
</HTML>Hi,
I have another question. If i have a menu as follows and I just want to check the data valid on the current page. I mean, only value=1, 2,3 is valid, value=0 is invalid. How can I do?
<td valign="middle" width="63%"> <font face="Arial, Helvetica, sans-serif" size="2">
<select name="type">
<option value="0">Please Select One of The Following Reasons</option>
<option value="1">Exchange</option>
<option value="2">Refund</option>
<option value="3">Wrong Product</option>
</select>
</font></td>
</tr>
Thanks.
peter -
User-exit F-02 to avoid program termination.
Hi All.
We've written a small validation in user-exit ZXF48U01 of module function EXIT_SAPLF048_001 od enhacement F180A001.
At certain point, if data is not as requested a proper 'E' message is triggered but this is causing standard to trigger an 'A' message and abort the transaction causing all data to be lost.
message e208(11) with text-e01.
Could you give an alternate use of message to avoid program termination?
We're in 4.6C release, so, message 'E' display like 'S' variant doesn't apply.
Thanks & Regards.Hi, i'm afraid that won't work. In fact, we've switch all message types, but it doesn't seems to work in the way we want.
What we are trying is to validate at item level sgtxt and zuonr field contents, if in certain conditions values don't match specific ones, don't let post the document but stand still in transaction to fix data.
For message type E (and obviously A), validations occurs, but program is terminated and all data entered discarded. For all others message types, we get the message displayed, but document is posted which is suppossed to be restricted.
To be more specific, after this exit finishes, it returns to form fcode_bearbeitung(MF05AFF0_FCODE_BEARBEITUNG) at 'BREAKDOWN_RELATION_FI_DOC' call function, after this, for any error message triggered standard will send an 'A' message, this is what were are trying to avoid.
Hope this helps to clarify scenary. -
User exit for validation of field NEWKO in f-48 tcode in finance
hi,
Previously we validated the Field XBLNR (Reference) in the document header from the table EKKO, for the PO Number. now we want to validate the vendor number(LIFNR) in the field NEWKO from the table EKKO with reference to the PO number entered in the field XBLNR.
we want to find out the correct user exits or any enhancement for the above validation.
pls help me in this regard ,matter most urgent.
Thanks & regards
veerahi,
for f-48 you could use FI-validation with tcode OB28
use an exit (UK...) for your check in Program ZGGBR000
A. -
Add many attachment to CO "Send an E-Mail in Background with Attachment"
Hi, experts:
I create a guided procedure which contain 4 sequential block.
in first 3 block, every user will upload their own file.
In the last block, I want collect all uploaded file, and pass to CO "Send an E-Mail in Background with Attachment" to mail to the user who assign to the fourth block.
Any idea about what block type I should use in fourth block?
Thanks in advance.Hi, Dipankar:
Thanks for your reply. But I have no idea about how to group parameter from all uploaded file to "Send an E-Mail in Background with Attachment" CO?
For the situation, I write a background CO program to get all uploaded file (from first three block) and grouping this customized CO parameter with "Send an E-Mail in Background with Attachment" CO. -
Problems with square root approximations with loops program
i'm having some trouble with this program, this loop stuff is confusing me and i know i'm not doing this correctly at all. the expected values in the tester are not matching up with the output. i have tried many variations of the loop in this code even modifying the i parameter in the loop which i guess is considered bad form. nothing seems to work...
here is what i have for my solution class:
/** A class that takes the inputted number by the tester and squares it, and
* loops guesses when the nextGuess() method is called. The epsilon value is
* also inputted by the user, and when the most recent guess returns a value
* <= epsilon, then the hasMoreGuesses() method should return false.
public class RootApproximator
/** Takes the inputted values from the tester to construct a RootApproximator.
* @param val the value of the number to be squared and guessed.
* @param eps the gap in which the approximation is considered acceptable.
public RootApproximator(double val, double eps)
value = val;
square = Math.sqrt(val);
epsilon = eps;
/** Uses the algorithm where 1 is the first initial guess of the
* square root of the inputted value. The algorithm is defined by
* "If X is a guess for a square root of a number, then the average
* of X and value/X is a closer approximation.
* @return increasingly closer guesses as the method is continually used.
public double nextGuess()
final int TRIES = 10000;
double guess = 1;
for (double i = 1; i < TRIES; i++)
double temp = value / guess;
guess = (guess + temp) / 2.0;
return guess;
/** Determines if there are more guesses left if the difference
* of the square and current guess are not equal to or less than
* epsilon.
* @return the value of the condition.
public boolean hasMoreGuesses()
return (square - guess <= epsilon);
private double square;
private double value;
private double epsilon;
private double guess;
here is the tester:
public class RootApproximatorTester
public static void main(String[] args)
double a = 100;
double epsilon = 1;
RootApproximator approx = new RootApproximator(a, epsilon);
System.out.println(approx.nextGuess());
System.out.println("Expected: 1");
System.out.println(approx.nextGuess());
System.out.println("Expected: 50.5");
while (approx.hasMoreGuesses())
approx.nextGuess();
System.out.println(Math.abs(approx.nextGuess() - 10) < epsilon);
System.out.println("Expected: true");
and here is the output:
10.0
Expected: 1 // not sure why this should be 1, perhaps because it is the first guess.
10.0
Expected: 50.5 // (100 + 1) / 2, average of the inputted value and the first guess.
true
Expected: true
i'm new to java this is my first java course and this stuff is frustrating. i'm really clueless as to what to do next, if anyone could please give me some helpful advice i would really appreciate it. thank you all.i'm new to java this is my first java course and this
stuff is frustrating. i'm really clueless as to what
to do nextMaybe it's because you don't have a strategy for what the program is supposed to do? To me it looks like a numerical scheme for finding the squareroot of a number.
Say the number you want to squarerroot is called value and that you have an approximation called guess. How do you determine whether guess is good enought?
Well in hasMoreGuesses you check whether,
(abs(value-guess*guess) < epsilon)
The above decides if guess is within epsilon of being the squareroot of value.
When you calculate the next guess in nextGuess why do you loop so many times? Aren't you supposed to make just one new guess like,
guess = (guess + value/guess)/2.0
The above generates a new guess based on the fact that guess and value/guess must be on each side of value so that the average of them must be closer too value.
Now you can put the two together to a complete algoritm like,
while (hasMoreGuesses()) {
nextGuess();
}In each iteration of the loop a new "guess" of the squareroot is generated and this continues until the guess is a sufficiently close approximation of the squareroot. -
Need help to draw a graph from the output I get with my program please
Hi all,
I please need help with this program, I need to display the amount of money over the years (which the user has to enter via the textfields supplied)
on a graph, I'm not sure what to do further with my program, but I have created a test with a System.out.println() method just to see if I get the correct output and it looks fine.
My question is, how do I get the input that was entered by the user (the initial deposit amount as well as the number of years) and using these to draw up the graph? (I used a button for the user to click after he/she has entered both the deposit and year values to draw the graph but I don't know how to get this to work?)
Please help me.
The output that I got looked liked this: (just for a test!) - basically this kind of output must be shown on the graph...
The initial deposit made was: 200.0
After year: 1 Amount is: 210.00
After year: 2 Amount is: 220.50
After year: 3 Amount is: 231.53
After year: 4 Amount is: 243.10
After year: 5 Amount is: 255.26
After year: 6 Amount is: 268.02
After year: 7 Amount is: 281.42
After year: 8 Amount is: 295.49
After year: 9 Amount is: 310.27
After year: 10 Amount is: 325.78
After year: 11 Amount is: 342.07
After year: 12 Amount is: 359.17
After year: 13 Amount is: 377.13
After year: 14 Amount is: 395.99
After year: 15 Amount is: 415.79
After year: 16 Amount is: 436.57
After year: 17 Amount is: 458.40And here is my code that Iv'e done so far:
import javax.swing.*;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.RenderingHints;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.lang.Math;
import java.text.DecimalFormat;
public class CompoundInterestProgram extends JFrame implements ActionListener {
JLabel amountLabel = new JLabel("Please enter the initial deposit amount:");
JTextField amountText = new JTextField(5);
JLabel yearsLabel = new JLabel("Please enter the numbers of years:");
JTextField yearstext = new JTextField(5);
JButton drawButton = new JButton("Draw Graph");
public CompoundInterestProgram() {
super("Compound Interest Program");
setSize(500, 500);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
amountText.addActionListener(this);
yearstext.addActionListener(this);
JPanel panel = new JPanel();
panel.setBackground(Color.white);
panel.add(amountLabel);
amountLabel.setToolTipText("Range of deposit must be 20 - 200!");
panel.add(amountText);
panel.add(yearsLabel);
yearsLabel.setToolTipText("Range of years must be 1 - 25!");
panel.add(yearstext);
panel.add(drawButton);
add(panel);
setVisible(true);
public static void main(String[] args) {
DecimalFormat dec2 = new DecimalFormat( "0.00" );
CompoundInterestProgram cip1 = new CompoundInterestProgram();
JFrame f = new JFrame();
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.getContentPane().add(new GraphPanel());
f.setSize(500, 500);
f.setLocation(200,200);
f.setVisible(true);
Account a = new Account(200);
System.out.println("The initial deposit made was: " + a.getBalance() + "\n");
for (int year = 1; year <= 17; year++) {
System.out.println("After year: " + year + " \t" + "Amount is: " + dec2.format(a.getBalance() + a.calcInterest(year)));
@Override
public void actionPerformed(ActionEvent arg0) {
// TODO Auto-generated method stub
class Account {
double balance = 0;
double interest = 0.05;
public Account() {
balance = 0;
interest = 0.05;
public Account(int deposit) {
balance = deposit;
interest = 0.05;
public double calcInterest(int year) {
return balance * Math.pow((1 + interest), year) - balance;
public double getBalance() {
return balance;
class GraphPanel extends JPanel {
public GraphPanel() {
public void paintComponent(Graphics g) {
Graphics2D g2 = (Graphics2D)g;
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g2.setColor(Color.red);
}Your help would be much appreciated.
Thanks in advance.watertownjordan wrote:
http://www.jgraph.com/jgraph.html
The above is also good.Sorry but you need to look a bit more closely at URLs that you cite. What the OP wants is a chart (as in X against Y) not a graph (as in links and nodes) . 'jgraph' deals with links and nodes.
The best free charting library that I know of is JFreeChart from www.jfree.org.
Maybe you are looking for
-
How do I copy my songs from my mac to my iphone
I have an iPhone 6 running iOS 8.0.2 and a PowerBook Pro running Mavericks. I have my music Library (files) stored on my MacBook. I would like to copy my music files from my MacBook to my iPhone. I've tried iTunes 11 sync and that does not move the f
-
How many hard drives can you put in a pavilion p2
Can I put one or two more hard drives into a Pavilion p2 1122? Is there a particular spec or physical size that this must be? This question was solved. View Solution.
-
Should a new custom ESB contract wsdl required for such a scenario?
Hi, I am using AIA 2.4 for my client who is integration Web-center 11g with JDE 9.0. The question is more pertaining to design approach that one needs to take for a scenario as this- The case - an ADF page tries to create a customer in the JDE and us
-
Fix overlapping controls in error cluster (LabVIEW 2013)
In LabVIEW 2013, the "Error In.ctl" and "Error Out.ctl" have overlapping controls. If you run the VI Analyzer, you get an error from this arrangement. That shouldn't happen in something that's built-in.
-
Java Network Programming using UDP protocol
I am trying to send the object using UDP protocol. In my client class it is giving me NullPointer excetion at clientSocket.send(sendPacket); although sendPacket is not null it has the value that I am passing. Here is the code : private boolean client