Is my code correct?
"Each set of items in the data file is terminated by an empty line. Therefore, when the text read in is equal to the empty string (""), you know that there are no more items for the
current category."
while ((line= in.read()) = ""
System.out.println ("There are no more items for the current category");Is this the most effective way?
What everyone is telling is:
No, it is not right. It is not even a correct approach to do it and it is probably not even the correct Java expression to use.
First off:
Are you responsible for doing the read operation for your project? From what you have said so far, you are just detecting the end of an item list--IF THIS IS THE CASE, then you accept the already read in character as an argument and do your checking. (this caps characters does not mean I am yelling at you--I just want you to not miss it) YOU WILL NOT READ. YOUR PROJECT SHOULD ONLY HAVE ONE READ STATEMENT TO GET YOUR DATA, otherwise, you are NOT going to be able to tell what is list and what is end condition.
2ndly:
a WHILE is a loop. What ever is in the conditional while(condition){} defines when the block it controls is run. The block is run continuously until the conditional evaluates to false. Unless you are responsible for the main read loop, you SHOULD NOT BE READING to change the conditional in the first place.
3rdly:
You need to look through your notes, read the book, study the tutorial, ask the teacher or TA what "=" does.
Similar Messages
-
Dbx cannot locate the (DLM) source codes correctly for 64bit app
It's hard for me to prepare a test case. Because it seems for a simple "hello world" it works.
The reason I raise this issue here is because my project was recently upgraded to compile with 64bit. And since then dbx cannot locate the source codes correctly, especially for some DLM codes. (sometimes it shows to "/usr/include/iso/..." which it should never be!). While it works fine on a 32bit compiled mode.
Did anyone experience the similar situation and can share your idea?
Thanks in advance.Can't think of any good reason why going to 64 bit would confuse dbx (except for unknown bug in dbx, which is not impossible).
I'd first look for changes in your build - for example, 32-bit code used to go to bin/ directory, but 64-bit goes to bin/sparcv9, which happens to be a symlink somewhere else or something like that. Symlinks might sometimes confuse dbx, please read
(dbx) help finding-filestopic (in dbx console, type "help finding-files").
Since you are using CC 5.9 that generates DWARF info by default, location and even presence of .o files is not important. All debug info should be in the shared library itself.
Here's another idea: inspect DWARF info by hand and see if it looks correct to you.
$ dwarfdump a.out | lessLook for
DW_AT_name a.ccand
DW_AT_comp_dir /home/maxim/tempThose two should give location of source file (/home/maxim/temp/a.cc in my case). Maybe this will give you some clue. -
SNOTE (Note Assistant) list expected "source code corrections" of a note?
Is it possible, in current versions of SNOTE, to print the "source code corrections" that the note is supposed to contain?
This was possible in "good old OSS" and also, I think, in early versions of SNOTE.
Why do I ask?
Sometimes you have a note that SNOTE cannot handle by itself. You must then open the "splitscreen editor" and guide SNOTE through the process.
In such cases I like to have a listing, on paper, of the expected changes, so that I keep some overview and that I can check the corrections as I go through them.I have found a second possibility - the following little program based on some code found in the 4.6C implementation of SNOTE.
report zztmp_snote_displ line-size 080.
type-pools bcwbn.
parameter p_note like cwbnthead-numm.
data gs_note type bcwbn_note.
start-of-selection.
clear gs_note.
select numm versno
from cwbnthead
into (gs_note-key-numm,gs_note-key-versno)
where numm = p_note
and incomplete = space
order by primary key.
endselect.
if not ( gs_note-key is initial ) .
call function 'SCWB_NOTE_READ'
exporting
iv_read_attributes = 'X'
iv_read_short_text = 'X'
iv_read_all_texts = 'X'
iv_read_validity = 'X'
iv_read_corr_instructions = 'X'
iv_read_customer_logfile = 'X'
iv_use_fallback_languages = 'X'
iv_read_loghndl = 'X'
iv_read_fixes = 'X'
iv_read_customer_attributes = 'X'
* IV_READ_READ_BY_USER = ' '
* IV_READ_SOL_MGR_REFERENCE = ' '
* IV_READ_SAP_STATUS = ' '
changing
cs_note = gs_note
exceptions
note_not_found = 1
language_not_found = 2
unreadable_text_format = 3
corr_instruction_not_found = 4
others = 5
if sy-subrc eq 0.
call function 'SCWB_NOTE_DISPLAY'
changing
cs_note = gs_note.
endif.
endif. -
Rebuilt my website in Serif WebPlus X6.<br />
Using Google Chrome or Internet Explorer the site is displayed correctly as is the source code.<br />
In Firefox 18.0.1 Code is being read wrongly. Cleared Cache and fault still there. Checked in Wifes laptop – still the same fault on her Firefox and okay on Chrome and IE.<br />
Code should read - span class="Body-C-C9">“Why won’t the doctors listen”?<pre><nowiki></span></p>
But firefox is showing - span class="Body-C-C9">“Why won’t the doctors listen�</span></p></nowiki></pre>
There are further similar faults throughout the website.<br />
Why is Firefox not reading the code correctly?<br />
Please help.That is an encoding issue.<br />
It looks that the page is in UTF-8 Unicode and the server sends this page as a Western or Windows encoding.<br />
So you see the Unicode characters as the individual bytes that they consist of.
You can inspect this in Tools > Page Info > General and you can also use the Web Console (Web Developer > Web Console;Ctrl+Shift+K) to check the response header.<br />
If the server sends a content type via the HTTP response headers then Firefox doesn't honor a meta tag in the file or otherwise switch the encoding.
*https://developer.mozilla.org/en/Properly_Configuring_Server_MIME_Types -
How can i run this code correctly?
hello, everybody:
when i run the code, i found that it dons't work,so ,i hope somebody can help me!
the Ball class is this :
package {
import flash.display.Sprite;
[SWF(width = "550", height = "400")]
public class Ball extends Sprite {
private var radius:Number;
private var color:uint;
private var vx:Number;
private var vy:Number;
public function Ball(radius:Number=40, color:uint=0xff9900,
vx:Number =0, vy:Number =0) {
this.radius= radius;
this.color = color;
this.vx = vx;
this.vy = vy;
init();
private function init():void {
graphics.beginFill(color);
graphics.drawCircle(0,0,radius);
graphics.endFill();
and the Chain class code is :
package {
import flash.display.Sprite;
import flash.events.Event;
[SWF(width = "550", height = "400")]
public class Chain extends Sprite {
private var ball0:Ball;
private var ball1:Ball;
private var ball2:Ball;
private var spring:Number = 0.1;
private var friction:Number = 0.8;
private var gravity:Number = 5;
//private var vx:Number =0;
//private var vy:Number = 0;
public function Chain() {
init();
public function init():void {
ball0 = new Ball(20);
addChild(ball0);
ball1 = new Ball(20);
addChild(ball1);
ball2 = new Ball(20);
addChild(ball2);
addEventListener(Event.ENTER_FRAME, onEnterFrame);
private function onEnterFrame(event:Event):void {
moveBall(ball0, mouseX, mouseY);
moveBall(ball1, ball0.x, ball0.y);
moveBall(ball2, ball1.x, ball1.y);
graphics.clear();
graphics.lineStyle(1);
graphics.moveTo(mouseX, mouseY);
graphics.lineTo(ball0.x, ball0.y);
graphics.lineTo(ball1.x, ball1.y);
graphics.lineTo(ball2.x, ball2.y);
private function moveBall(ball:Ball,
targetX:Number,
targetY:Number):void {
ball.vx += (targetX - ball.x) * spring;
ball.vy += (targetY - ball.y) * spring;
ball.vy += gravity;
ball.vx *= friction;
ball.vy *= friction;
ball.x += vx;
ball.y += vy;
thanks every body's help!ok, thanks for your reply ! I run this code in the Flex builder 3!and the Ball class and the Chain class are all in the same AS project!
and i changed the ball.pv property as public in the Ball class, and the Chain class has no wrong syntactic analysis,but the AS code don't run.so this is the problem.
2010-04-21
Fang
发件人: Ned Murphy <[email protected]>
发送时间: 2010-04-20 23:01
主 题: how can i run this code correctly?
收件人: fang alvin <[email protected]>
I don't see that the Ball class has a pv property, or that you even try to access a pv property in the Chain class. All of the properties in your Ball class are declared as private, so you probably cannot access them directly. They would need to be public. Also, I still don't see where you import Ball in the chain class such that it can use it. -
I have an itunes gift card which I cannot redeem. I enter the code correctly and am prompted to sign in over and over again. I have tried resetting the iPhone but the laptop I had itunes on is broken, is there another way?
See this support article:
http://support.apple.com/kb/TS1292
If you can't get to work after perusing that page, contact the iTunes Store Support; instructions are at the bottom of that article.
Good luck. -
I am having trouble with my iTunes Gift card code. It says I have not entered the code correctly when I have…repeatedly. How can I redeem my iTunes voucher?
If the card was issued in the same country as you and your account are based and the page that you posted from doesn't help, then you will need to try contacting iTunes Support (you will probably need to give them images of the front and back of the card, and possibly its receipt) : http://www.apple.com/support/itunes/contact/ - click on Contact iTunes Store Support on the right-hand side of the page, then iTunes Cards And Codes
-
How do I combine two actions in code correctly?
I figured out how to create my playback controls, however I still have a problem. I want to have an additional button that links to a website (I have coded this correctly with actionscript and works great. Now I have two seperate projects...one project has my playback controls and the other has a button that links to a website.
I am having problems combining both action script codes and having everything working properly. My code for each is below. How do I arrange them into one?
Code for link to website:
website_btn.addEventListener(MouseEvent.CLICK,gotoWebsite);
function gotoWebsite(evtObj:Event):void{
var theSite:URLRequest = new URLRequest("http://www.website.com");
navigateToURL(theSite,"_blank");
Code for playback controls:
go.addEventListener(MouseEvent.CLICK,startplaying);
hault.addEventListener(MouseEvent.CLICK,stopplaying);
function startplaying(event:MouseEvent):void{
play();
function stopplaying(event:MouseEvent):void{
stop();the only way that could make sense is to use:
go.addEventListener(MouseEvent.CLICK,startplaying);
hault.addEventListener(MouseEvent.CLICK,stopplaying);
function startplaying(event:MouseEvent):void{
play();
var theSite:URLRequest = new URLRequest("http://www.website.com");
navigateToURL(theSite,"_blank");
function stopplaying(event:MouseEvent):void{
stop();
var theSite:URLRequest = new URLRequest("http://www.website.com");
navigateToURL(theSite,"_blank"); -
** RFC to JDBC scenario - Need not source code - Correct ?
Hi Friends,
I am doing RFC to JDBC scenario. It is a synchronous scenario. I think it is need not required to write any code in the source code tab of RFC. Is it correct ...? (Only Import and Export parameters are enough.)
Kindly reply, friends.
Kind Regards,
Jeg P.Hi,
RFC needs only configuration and we will call remote method in R/3. Actual logic present in R/3.
Thanks,
RamuV -
I am new in Java, I need help for small correction of applet code(I'm not confident how to make this correctly)- I need clean a popup banner at applet loading. The about part , which appears by click on 'about' button, can be left without changes, it does not prevent me.
Part of a code containing a popup:
import a.*;
import java.applet.Applet;
import java.applet.AppletContext;
import java.awt.*;
import java.awt.event.*;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.*;
public final class dbView extends Applet
implements Runnable, ActionListener, o, ItemListener
public void stop()
if(A != null)
A.dispose();
if(t != null)
t.dispose();
private void _mthvoid()
B = a.i.a(getClass(), "Begin.gif");
e = a.i.a(getClass(), "Right.gif");
z = a.i.a(getClass(), "Left.gif");
u = a.i.a(getClass(), "End.gif");
b = a.i.a(getClass(), "Redo.gif");
J = a.i.a(getClass(), "Binocular.gif");
m = a.i.a(getClass(), "Home.gif");
MediaTracker mediatracker = new MediaTracker(this);
mediatracker.addImage(B, 0);
mediatracker.addImage(e, 0);
mediatracker.addImage(z, 0);
mediatracker.addImage(u, 0);
mediatracker.addImage(b, 0);
mediatracker.addImage(J, 0);
mediatracker.addImage(m, 0);
try
mediatracker.waitForAll();
catch(InterruptedException interruptedexception) { }
private int _mthdo(String s1, String s2)
return s1.indexOf(s2);
public String getAppletInfo()
return "Name: Beer Viewer.java\r\nLager Beer: 1.01\r\nPromouter: Best Beer\r\nBest Beer in the world!\r\nFamous light brand.\r\nLegendary Lager Beer\r\ne-mail: [email protected]";
private void a(Graphics g1)
g1.setColor(Color.white);
g1.drawString("Best Beer in the world!", 125, 260);
g1.drawString("Famous light brand.", 125, 270);
g1.drawString("Legendary Lager Beer", 125, 280);
g1.drawString("e-mail: [email protected]", 125, 290);
private final void _mthfor(String s1)
if(s1 == null || s1.length() == 0)
d = false;
StringBuffer stringbuffer = new StringBuffer();
stringbuffer.append("Beer Viewer\n");
if(d)
stringbuffer.append("Ask for beer: ").append(s1).append("\n");
stringbuffer.append("Best Beer in the world!, Famous light brand\n");
stringbuffer.append("Legendary Lager Beer\n");
stringbuffer.append("Codebase: ").append(getCodeBase().toString()).append("\n");
stringbuffer.append("Documentbase: ").append(getDocumentBase().toString()).append("\n");
k = stringbuffer.toString();
if(d)
o = new c(this, k);
private void f()
remove(q);
q.invalidate();
_mthvoid();yes
-
Hi Experts
Please correct the ABAP CODE written as Field routine in Transformations
Requirment
If ZB_AMT = '0.00'
then result should be '0.00'
If ZB_AMT '0.00' and
SOURCE_FIELDS-/BIC/ZB_TPE1 = 'AMOUNT'
the result should be
CONCATENATE '$' SOURCE_FIELDS-/BIC/ZB_AMT INTO RESULT.
If ZB_AMT '0.00' and
SOURCE_FIELDS-/BIC/ZB_TPE1 = 'PERCENTAGE'
the result should be
CONCATENATE SOURCE_FIELDS-/BIC/ZB_AMT '%' INTO RESULT.
The code below is not working as it should please update me where i went wrong
Source Fields
SOURCE_FIELDS-/BIC/ZB_AMT (CHAR)
SOURCE_FIELDS-/BIC/ZB_TPE1 (CHAR)
CODE
IF SOURCE_FIELDS-/BIC/ZB_AMT = '0.00'.
RESULT = '0.00'.
ELSE.
IF SOURCE_FIELDS-/BIC/ZB_TPE1 = 'AMOUNT' AND
SOURCE_FIELDS-/BIC/ZB_AMT '0.00'.
CONCATENATE '$' SOURCE_FIELDS-/BIC/ZBON_AMT INTO RESULT.
IF SOURCE_FIELDS-/BIC/ZB_TPE1 = 'PERCENTAGE' AND
SOURCE_FIELDS-/BIC/ZB_AMT '0.00'.
CONCATENATE SOURCE_FIELDS-/BIC/ZB_AMT '%' INTO RESULT.
ENDIF.
ENDIF.
ENDIF.If ZB_AMT '0.00' and
SOURCE_FIELDS-/BIC/ZB_TPE1 = 'AMOUNT'
the result should be
CONCATENATE '$' SOURCE_FIELDS-/BIC/ZB_AMT INTO RESULT.
If ZB_AMT '0.00' and
SOURCE_FIELDS-/BIC/ZB_TPE1 = 'PERCENTAGE'
the result should be
CONCATENATE SOURCE_FIELDS-/BIC/ZB_AMT '%' INTO RESULT.
if zb_amt = '0.00' and SOURCE_FIELDS-/BIC/ZB_TPE1 = 'AMOUNT'.
CONCATENATE '$' SOURCE_FIELDS-/BIC/ZB_AMT INTO RESULT.
endif.
if zb_amt = '0.00' and SOURCE_FIELDS-/BIC/ZB_TPE1 = 'PERCENTAGE'.
CONCATENATE SOURCE_FIELDS-/BIC/ZB_AMT '%' INTO RESULT.
endif.
you can use a case statement as well
if zb_amt = '0.00'.
case SOURCE_FIELDS-/BIC/ZB_TPE1.
when 'AMOUNT'.
CONCATENATE '$' SOURCE_FIELDS-/BIC/ZB_AMT INTO RESULT.
when 'PERCENTAGE'.
CONCATENATE SOURCE_FIELDS-/BIC/ZB_AMT '%' INTO RESULT.
endcase.
endif. -
I purchased an iTunes card, I have entered to code four times correctly, it then told me the card was not activated correctly. What do I do?
If it's saying that it hasn't been activated properly then are you able to take it back to the store that you bought it from and ask them to activate it properly ? If not then you will need to try contacting iTunes Support (you will probably need to give them images of the front and back of the card, and possibly its receipt) : http://www.apple.com/support/itunes/contact/ - click on Contact iTunes Store Support on the right-hand side of the page, then iTunes Cards And Codes
-
Payroll Log, correction code, correction indicators
Hi Gurus Please help me with the below question thanks for your valuable time?<br />
What is a Payroll Log ?
What is a correction indicator which is assigned to infotype 0003?
What is a payroll correction run code '" w "?
Thanks for your valuable time for reading the question and replying to it, please explain with examples...
Warm Regards,
Zulfikarlos
A simple search in the forum will helps you to find out the answers
EditedHi Zulfikarlos,
Payroll Log: It shows the entry and output of wagetypes in pcr's. Here you can see how the wage type has been evaluated, calculated etc. It also shows whether there is any error in payroll run for the employee. Normally when payroll is run for large number of employees you shall not display payroll log as it can cause runtime error. But even you do not choose payroll log when you run payroll payroll log will be displayed for employees who have error in payroll.
About correction run code and correction indicator in SAP help i says:
"The system sets the Payroll correction indicator if an employee is rejected by the payroll program because of errors in his or her master or time data. The personnel numbers of employees rejected by the payroll program are written to matchcode W on the basis of the Payroll correction indicator. If you want to delete the rejected employee from matchcode W, you can do so by deactivating the Payroll correction indicator ."
http://help.sap.com/saphelp_40b/helpdata/en/48/35c7f74abf11d18a0f0000e816ae6e/content.htm -
Code correction, please!
Hi,
The following code throws an error. Correct it please.
myGrid.addEventListener(Event:ListEvent.ITEM_CLICK, gridItemClick);
function gridItemClick (e:ListEvent):void{
var urlR:URLRequest=new URLRequest(e.target.getItemAt(e.rowIndex).PDF)
navigateToURL(urlR, "_blank");
I am getting the followign error:
1084: Syntax error: expecting rightparen before colon.
And it highlights the following line:
myGrid.addEventListener(Event:ListEvent.ITEM_CLICK, gridItemClick);
Thanks.myGrid.addEventListener(ListEvent.ITEM_CLICK, gridItemClick);
-
Dreamweaver not displaying PHP code correctly
I'm new to PHP, but have used DreamWeaver for a while for
static and .asp pages. A 3rd party coder developed a site in PHP,
and it's up to me to populate it. When I open any of the pages in
DreamWeaver it doesn't look remotely how it renders on the web, and
makes it difficult to manipulate in "design view." Everything runs
down the right side of the page and has a dark background - Any
ideas on how this can be fixed?
help - the newbeeHi,
I guess the other developer gave you php pages where the
"visible" parts are actually embedded in "echo" statements, similar
to this example:.
<?php echo "<table width='90%' border='1'
bordercolor='000000' align='center' bgcolor='#eaeaea'>"; ?>
Please switch to DW´s "code view" and check if my
assumption is true -- if yes, the html code that´s embedded
this way can´t be displayed by DW, and there´s not much
you could do except tearing the given stuff apart and manually
transform it into something DW is able to render correctly, like...
<table width="90%" border="1" bordercolor="000000"
align="center" bgcolor="#eaeaea">
<tr>
<td><?php echo $variable; ?></td>
</tr>
</table> -
Phone shuts down. sim code correct.
I turned my phone off at the airport and somehow(???) got my sim code wrong 3 times. Even tho when it asked me to put in sim, and it was correct, it refused to operate. It got to a point of ' Phone is disabled. Connect to itunes. I had a tech guy from an Apple store in Byron Bay restore it but it has done same again and again. It is my business phone so HELP!!!
Its only 2years old.Viborg wrote:
This is not a battery issue because the phone is being charged while driving.
Only if you have chosen 2D raher than 3D, as output of CR-200 only 750mA which is not enough if number of background applications running!
Happy to have helped forum in a small way with a Support Ratio = 37.0
Maybe you are looking for
-
30g Ipod Video keeps rebooting
I just got the new Itunes 9.0 and synced my Ipod video as usual, but now it just keeps rebooting and is stuck on the black screen with the white apple. I have tried (twice) going into disk mode, and restoring the Ipod, but it still has the same issue
-
How to populate listbox on a screen and get the selected record.
I have place a edit box and converted to listbox . It should diplay T001-Bukrs values. When the user selects a value I should get the selected value ... How can I do that? The screen is a '0100'. not the normal 1000 selection screen. Regards. Erkan.
-
Two questions, one is probably easy, the other I don't know.... First off, I have a website with a flash start page. When I load the site, a box appears around the flash movie saying "click to activate and use this control". If i click on it, it goes
-
I recieved the Adobe Photoshop Elements 12 discs for Christmas, along with a MacBook Air. Unfortunately the MacBook Air does not have a disc drive. Is there a way that I can download it using the serial number that came with it?
-
Hi 1 downloaded the media on N97 but i dont know the path where i have downloaded the file what is the path of it 2 How to add music from mass storage drive it doesnt ask for to add the songs 3 Which is the best browser for N97?