Can you see the error ?
Here is the code (a few lines removed) :
public class Alone{
static final int PACKET_SIZE = 8192;
public static int nbPackets = 0;
Vector[] queue;
Thread[] thread;
boolean run;
int id;
public Alone(int port) throws Exception{
queue = new Vector[NB_OF_QUEUES];
for(int i=0;i<NB_OF_QUEUES;i++){
queue[i] = new Vector();
thread = new Thread[NB_OF_THREADS];
thread[T_RECEIVE] = new Receive(this);
public DatagramPacket getPacket(int q){
DatagramPacket dp;
if(q==FREE && queue[FREE].isEmpty()){
nbPackets++;
dp = new DatagramPacket(new byte[PACKET_SIZE],PACKET_SIZE);
}else{
synchronized(queue[q]){
dp = (DatagramPacket)queue[q].firstElement();
queue[q].remove(0);
return dp;
}I'm calling the "getPacket" method from a thread which receives DatagramPacket through a DatagramSocket this way :
public class Receive extends Thread {
private Alone alone;
public Receive(Alone c){
alone = c;
setName("Receive");
public void run(){
DatagramPacket dp = alone.getPacket(Alone.FREE);
try{
while(alone.getRun()){
System.out.println(getName() +":sleeping");
alone.socket.receive(dp);
System.out.println(getName() +":wake up");
System.out.println(getName() +" >>> packet received");
alone.addPacket(Alone.RECEIVED, dp, Alone.T_REDIRECT);
}catch(Exception e){
System.out.println(e);
}But when it gets to the "alone.socket.receive(dp);" it raises a "java.lang.NullPointerException". So i guess theres is a problem in the passing of the DatagramPacket's reference, but I just can't point out where the error is. Anyone see the problem ?
Okay thanks for the advice ! i'll follow it from now on.
//in class Receive
public void run(){
DatagramPacket dp = alone.getPacket(Alone.FREE);
while(alone.getRun()){
System.out.println(getName() +":sleeping");
try{
alone.socket.receive(dp);
}catch(IOException e){e.printStackTrace();}
System.out.println(getName() +":wake up");
System.out.println(getName() +" >>> packet received");
alone.addPacket(Alone.RECEIVED, dp, Alone.T_REDIRECT);
//in class Alone
public DatagramPacket getPacket(int q){
DatagramPacket dp;
if(q==FREE && queue[FREE].isEmpty()){
System.out.println("instanciating a new DatagramPacket");
nbPackets++;
dp = new DatagramPacket(new byte[PACKET_SIZE],PACKET_SIZE);
}else{
synchronized(queue[q]){
dp = (DatagramPacket)queue[q].firstElement();
queue[q].remove(0);
return dp;
}running this will prompt
instanciating a new DatagramPacket
Receive:sleeping
java.lang.NullPointerException
at alone.Receive.run(Receive.java:19)
Similar Messages
-
Can you see the problem?
i'm trying to write a simple image viewer application.
Can you see the problem. i can't. i'll appreciate any advice or help?
import java.awt.*;
import java.awt.image.*;
import java.awt.event.*;
import java.io.*;
public class SimpleViewer extends Frame {
protected Image awtImage;
public void loadAndDisplay(String filename) {
Image img = readImage(filename);
awtImage = img;
int width = img.getWidth(this);
int height = img.getHeight(this);
displayImage(img, width, height);
public void displayImage(Image img, int width, int height) {
addWindowListener(
new WindowAdapter() {
public void windowClosing(WindowEvent e){
System.exit(0);
setTitle("Simple Viewer ");
pack();
setSize(new Dimension(width, height));
show();
repaint();
public image readImage(String filename) {
Image image = Toolkit.getDefaultToolkit().getImage(imageName);
MediaTracker imageTracker = new MediaTracker(this);
imageTracker.addImage(image, 0);
try{
imageTracker.waitForID(0);
}catch(InterruptedException e){ return null;}
return image;
public void paint(Graphics g){
Rectangle rect = this.getBounds();
if(awtImage != null) {
g.drawImage(awtImage, 0,0,rect.width, rect.height, this);
public static void main(String[] args){
SimpleViewer ip = new SimpleViewer();
if(args.length <1) {
System.out.println("Enter a valid image file name");
System.exit(0);
ip.loadAndDisplay(args[0]);
}check this line and tell me what you see... after all, it's the source of your compiler errors...
public image readImage(String filename) {
Image image = Toolkit.getDefaultToolkit().getImage(imageName);once you figure that out, it will work...
( hint : check variable names and capitalization of names )
- MaxxDmg...
- ' He who never sleeps... ' -
Where can I see the error msg in the below code.
Hi Gurus,
Please have a look at the code.
if abc is initial.
return-message = cl_bsp_runtime=>get_otr_text( 'ZXYZ/ERR_EMPID' ).
append test to test_tab.
endif.
In the above code, Emp id input field is being checked as its mandatory. I would like to know where can I see the error message per the above code. what is get_otr_test??go to SE63 and see it from there..
SE63-> Translation->OTR Objects->Short Text
in field <b>Package</b> key in 'ZXYZ'
and in field <b>Text from OTR</b> key in 'ERR_EMPID'
and go forward.
I hope this helps.
For more info see the link below
http://help.sap.com/saphelp_nw2004s/helpdata/en/2a/6ad43aa654be55e10000000a11402f/content.htm
http://help.sap.com/saphelp_nw04/helpdata/en/93/bccd3a00746f4ae10000000a11402f/frameset.htm
<i>If useful answer..reward points and close the thread.</i>
A.<b></b> -
Can you see the delivery destination on the tracking information?
I'm thinking that I made a mistake on my delivery address.
When I realize the mistake, I changed the address. from IL to FL.
I received the email from Apple, that my new order has been shipped (Ipad).
When I track my order on FEDEX, I only can see PICKED UP. on Nashville TN.
And I can't see the destination city or area. (normally all the Fedex shipments have information about destination).
And the tracking is still on PICKED UP, why is not IN TRANSIT? (2 days picking the package up??)
I live in FL.
Can you see the delivery information on your tracking orders?
Will my package be deliver in IL or FL?Call Apple and see what they can do. My guess would be that if you tried to change your order in any way after the status was changed from Processing, you won't have success. And if the address was listed as IL, not Florida at the time of shipping, your item is likely headed to IL. If your item is listed as picked up, it's not in transit because all iPads are being held at the shipper until the 16th as the earliest delivery date.
-
For Boot Camp, if you save a file when you are on the Windows side, when you return to the Mac side, can you see the file or can it only be "seen" on the operating side you create it in?
Why don't you (generic most every post lacks critical details) be clear and say you never used Mac OS etc.
But, I did try to anticipate and give you what you needed.
Excel is one of those rare programs that, if they are extremely large complex spreadsheets still tend to run better under Office for Windows.
A VM won't do for that but it does make it easier to transition. As in: install Windows natively, then use VMware Fusion or Parallels to attach to the partition and OS. That way you can run Windows as Guest OS VM under Mac; and still run Windows natively dual-boot when needed.
The word "see" was not what you wanted, was it? really? you want to open and make changes and keep it on Windows side rather than Save As or copy to Mac
You use Windows and don't know it has NTFS (NT FileSystem)?
http://en.wikipedia.org/wiki/NTFS
http://en.wikipedia.org/wiki/Hierarchical_File_System (HFS) native file system used by Apple
And there is much more UEFI style "bios" and other things I suppose.
Great thing about Google and encyclopedias or dictionary, you can look up what you don't know. -
How can i see the error message?
hi, i have written a procedure in the database 10g, with my own error, and it works. but, when my exception occurs, i want to see my ora-20000-message in the footer of the isql-screen in the same way like normal ora-errors do it. because, now the code handles the exeption, but i can not se any message.
thx.
(zahl1 in number, zahl2 in number)
as
maxvertrag number;
ergebnis number;
myerror exception;
pragma exception_init(myerror, -20000);
begin
select max(vertragsnr) into maxvertrag from robertl.tblugovor;
ergebnis := zahl1+zahl2+maxvertrag;
if ergebnis>104
then
RAISE_APPLICATION_ERROR (-20000, 'Result is > 104!');
end if;
exception when myerror then
ergebnis:=0;
end;This is answered in how can i se the error message?.
As a side note, you generally don't need to cross-post in these two fora, as many of us frequent both.
Cheers, APC -
Workflow starts then cancel, where can I see the error and why it's canceled?
Hi, I have a workflow for a document library that starts when a new document is created. i click on the workflow status at the document library list, and it shows
Internal Status:
Canceled
and I never got the email that the workflow supposed to send. Where can I find out more about what cause my workflow to cancel?
Thank you.Hi,
I think so for sending mails you need to configure SMTP Service. Can you check the below link.
http://technet.microsoft.com/en-in/library/cc288949(v=office.14).aspx
Regards,
MS -
HELP Can you see the missing parenthesis ?!
Dear People,
I am doing a simple program that creates a ContactBook and allows keyboard entry of lastName, telephoneNumber and emailAddress.
I have a few error messages that say parenthesis missing but I don't
see any missing ! :
"Note.java": Error #: 200 : '{' expected at line 15
"Note.java": Error #: 200 : '}' expected at line 59
"TryContactBook.java": Error #: 200 : ')' expected at line 30
"TryContactBook.java": Error #: 200 : ')' expected at line 42
below is the coding
thank you in advance
Stan
import java.util.*;
public class TryContactBook
private Note note;
public static void main(String[] args)
ContactBook myContactBook = new ContactBook();
FormattedInput input = new FormattedInput();
Note note = new Note();
System.out.println("Enter the number of new notes you wish to record ");
int numberOfNotes = input.readInt();
System.out.println("Ready to record " + numberOfNotes + "note(s) ");
for (int i = 0; i < numberOfNotes; i++)
try
System.out.print("Enter a last name: ");
note.setLastNaame(input.readString());
System.out.println("last name input is: " + notes.getLastName());
catch (InvalidUserInputException e)
System.out.println("InvalidUserInputException thrown when inputting last name. \n" +
e.getMessage());
try
System.out.println("Enter a telephone number ");
note.setTelephoneNumber(input.readString();
System.out.println("telephone number input is: " + notes.getTelephoneNumber());
catch (InvalidUserInputException e)
System.out.println("InvalidUserInputException thrown when inputting last name. \n" +
e.getMessage());
try
System.out.println("Enter an e-mail address ");
note.setTelephoneNumber(input.readString();
System.out.println("e-mail address input is: " + notes.getEmailAddress());
catch (InvalidUserInputException e)
System.out.println("InvalidUserInputException thrown when inputting last name. \n" +
e.getMessage());
=====================================================================
import java.util.*;
* A class to maintain an arbitrarily long list of contacts.
* Notes are numbered for external reference by a human user.
* In this version, note numbers start at 0.
* @author Stan Dominski
public class ContactBook
// Storage for an arbitrary number of notes.
private ArrayList notes;
* Perform any initialization that is required for the
* notebook.
public ContactBook()
notes = new ArrayList();
* Store a new note into the notebook.
* @param note The note to be stored.
public void storeNote(String note)
notes.add(note);
* @return The number of notes currently in the notebook.
public int numberOfNotes()
return notes.size();
* Show a note.
* @param noteNumber The number of the note to be shown.
public void showNote(int noteNumber)
if(noteNumber < 0 || noteNumber > numberOfNotes())
// This is not a valid note number, so do nothing.
else
// This is a valid note number, so we can print it.
System.out.println(notes.get(noteNumber));
* Remove a note from the notebook if it exists.
* @param noteNumber The number of the note to be removed.
public void removeNote(int noteNumber)
if(noteNumber < 0 || noteNumber > numberOfNotes())
System.out.println("noteNumber is not valid.");
else
notes.remove(noteNumber);
* List all the notes in the notebook
public void listNotes()
Iterator i = notes.iterator();
Iterator myIterator = notes.iterator();
while(i.hasNext() && myIterator.hasNext())
System.out.print(notes.indexOf(i.next() ) + ":" );
System.out.println("" + myIterator.next());
=======================================================================
import java.util.*;
public class Note
private ArrayList contactInfo;
private String lastName;
private String telephoneNumber;
private String emailAddress;
public class Note()
contactInfo = new ArrayList();
this.lastName = lastName;
this.telephoneNumber = telephoneNumber;
this.emailAddress = emailAddress;
public void setLastName(String lastName)
this.lastName = lastName;
public String getLastName()
return lastName;
public void setTelephoneNumber(String telephoneNumber)
this.telephoneNumnber = telephoneNumber;
public String getTelephoneNumber()
return telephoneNumber;
public void setEmailAddress(String emailAddress)
this.emailAddress = emailAddress;
public String getEmailAddress()
return emailAddress;
======================================================================
import java.io.*;
import java.util.*;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
public class FormattedInput
public String readString() throws InvalidUserInputException
if(readToken() == tokenizer.TT_WORD || ttype == '\"' || ttype == '\'')
return tokenizer.sval;
else
throw new InvalidUserInputException(" readString() failed. ..... Input data is not a string");
// Method to read an int value
public int readInt() throws InvalidUserInputException
if (readToken() != tokenizer.TT_NUMBER)
throw new InvalidUserInputException(" readInt() failed. " + " input data not numeric");
else
return (int)tokenizer.nval; // value is numeric so return as int
//helper method to read the next token
private int readToken()
try
ttype = tokenizer.nextToken();
return ttype;
catch(IOException e)
e.printStackTrace(System.err);
System.exit(1);
return 0;
//object to tokenize input from the standard input stream
private StreamTokenizer tokenizer = new StreamTokenizer(
new BufferedReader(
new InputStreamReader(System.in)));
private int ttype; //stores the token type code
======================================================================
import java.io.StreamTokenizer;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.BufferedReader;
public class InvalidUserInputException extends Exception
public InvalidUserInputException() { }
public InvalidUserInputException(String message)
super(message);I have out comments on the errors I found. There might be more.
I couldn't get the indentation to work so it will look a bit funny.
//David
"Note.java": Error #: 200 : '{' expected at line 15
"Note.java": Error #: 200 : '}' expected at line 59
"TryContactBook.java": Error #: 200 : ')' expected at
line 30
"TryContactBook.java": Error #: 200 : ')' expected at
line 42
import java.util.*;
public class TryContactBook
private Note note;
public static void main(String[] args)
ContactBook myContactBook = new ContactBook();
FormattedInput input = new FormattedInput();
Note note = new Note();
System.out.println("Enter the number of new notes you wish to record ");
int numberOfNotes = input.readInt();
System.out.println("Ready to record " + numberOfNotes + "note(s) ");
for (int i = 0; i < numberOfNotes; i++)
try
System.out.print("Enter a last name: ");
note.setLastNaame(input.readString());
System.out.println("last name input is: " +
is: " + notes.getLastName());
catch (InvalidUserInputException e)
System.out.println("InvalidUserInputException
xception thrown when inputting last name. \n" +
e.getMessage());
try
System.out.println("Enter a telephone
telephone number ");
note.setTelephoneNumber(input.readString()); // 1 error
System.out.println("telephone number input
er input is: " + notes.getTelephoneNumber());
catch (InvalidUserInputException e)
System.out.println("InvalidUserInputException
xception thrown when inputting last name. \n" +
e.getMessage());
try
System.out.println("Enter an e-mail address
l address ");
note.setTelephoneNumber(input.readString()); // 2 error
System.out.println("e-mail address input
ss input is: " + notes.getEmailAddress());
catch (InvalidUserInputException e)
System.out.println("InvalidUserInputException
xception thrown when inputting last name. \n" +
e.getMessage());
=======================================================
=============
import java.util.*;
* A class to maintain an arbitrarily long list of
contacts.
* Notes are numbered for external reference by a human
user.
* In this version, note numbers start at 0.
* @author Stan Dominski
public class ContactBook
// Storage for an arbitrary number of notes.
private ArrayList notes;
* Perform any initialization that is required for
for the
* notebook.
public ContactBook()
notes = new ArrayList();
* Store a new note into the notebook.
* @param note The note to be stored.
public void storeNote(String note)
notes.add(note);
* @return The number of notes currently in the
the notebook.
public int numberOfNotes()
return notes.size();
* Show a note.
* @param noteNumber The number of the note to be
o be shown.
public void showNote(int noteNumber)
if(noteNumber < 0 || noteNumber >
umber > numberOfNotes())
// This is not a valid note number, so do
mber, so do nothing.
else
// This is a valid note number, so we can
, so we can print it.
System.out.println(notes.get(noteNumber));
* Remove a note from the notebook if it exists.
* @param noteNumber The number of the note to be
o be removed.
public void removeNote(int noteNumber)
if(noteNumber < 0 || noteNumber >
mber > numberOfNotes())
System.out.println("noteNumber is not
is not valid.");
else
notes.remove(noteNumber);
* List all the notes in the notebook
public void listNotes()
Iterator i = notes.iterator();
Iterator myIterator = notes.iterator();
while(i.hasNext() && myIterator.hasNext())
System.out.print(notes.indexOf(i.next() )
f(i.next() ) + ":" );
System.out.println("" +
println("" + myIterator.next());
=======================================================
===============
import java.util.*;
public class Note
private ArrayList contactInfo;
private String lastName;
private String telephoneNumber;
private String emailAddress;
public class Note()
contactInfo = new ArrayList();
this.lastName = lastName;
this.telephoneNumber = telephoneNumber;
this.emailAddress = emailAddress;
public void setLastName(String lastName)
this.lastName = lastName;
public String getLastName()
return lastName;
public void setTelephoneNumber(String
neNumber(String telephoneNumber)
this.telephoneNumnber =
telephoneNumnber = telephoneNumber;
public String getTelephoneNumber()
return telephoneNumber;
public void setEmailAddress(String
lAddress(String emailAddress)
this.emailAddress = emailAddress;
public String getEmailAddress()
return emailAddress;
}} // 3 error
=======================================================
==============
import java.io.*;
import java.util.*;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
public class FormattedInput
public String readString() throws
rows InvalidUserInputException
if(readToken() == tokenizer.TT_WORD || ttype ==
ype == '\"' || ttype == '\'')
return tokenizer.sval;
else
throw new InvalidUserInputException("
eption(" readString() failed. ..... Input data is not
a string");
// Method to read an int value
public int readInt() throws
InvalidUserInputException
if (readToken() != tokenizer.TT_NUMBER)
throw new InvalidUserInputException(" readInt()
nt() failed. " + " input data not numeric");
else
return (int)tokenizer.nval; // value is numeric
eric so return as int
//helper method to read the next token
private int readToken()
try
ttype = tokenizer.nextToken();
return ttype;
catch(IOException e)
e.printStackTrace(System.err);
System.exit(1);
return 0;
//object to tokenize input from the standard
andard input stream
private StreamTokenizer tokenizer = new
= new StreamTokenizer(
new
new
new
new BufferedReader(
new
new
new
new
new
new
new
new InputStreamReader(System.in)));
private int ttype; //stores
stores the token type code
=======================================================
==============
import java.io.StreamTokenizer;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.BufferedReader;
public class InvalidUserInputException extends
Exception
public InvalidUserInputException() { }
public InvalidUserInputException(String
tring message)
super(message); -
I'm getting the error 'Column not allowed here'.
Here's the code and description of resulting table:
CREATE OR REPLACE PROCEDURE prod_sales_sum_sp
IS
CURSOR cur_sales
IS
SELECT bi.idproduct id,
TO_CHAR(b.dtordered,'MON') mth,
TO_CHAR(b.dtordered, 'YYYY') yr,
SUM(bi.quantity) quantity,
SUM(bi.quantity*bi.price) totalsum
FROM bb_basket b INNER JOIN bb_basketitem bi
USING (idbasket)
WHERE b.orderplaced = 1
GROUP BY bi.idproduct,TO_CHAR(b.dtordered,'MON'),TO_CHAR(b.dtordered, 'YYYY');
BEGIN
FOR rec_sales IN cur_sales LOOP
INSERT INTO bb_prod_sales (idproduct, month, year, qty, total)
VALUES (id, mth, yr, quantity, totalsum);
END LOOP;
END;
SQL> desc bb_prod_sales
Name Null? Type
IDPRODUCT NUMBER(2)
MONTH CHAR(3)
YEAR CHAR(4)
QTY NUMBER(5)
TOTAL NUMBER(6,2)
SQL> select * from bb_prod_sales;
no rows selectedBasically, we see that the table has five columns: idproduct, month, year, qty, and total. It also has no values at this point in time.
I'm trying to create this procedure to update the table by inserting values into the table.
With the error being provided, isn't that basically saying I'm using a column name while I'm trying to insert my values? I've set alias names so there are no conflicts, and it's still giving me the error.
Can you guys see anythign?Hi,
The way to reference columns in a record is record_name.column_name, so you should say:
VALUES (rec_sales.id, rec_sales.mth, rec_sales.yr, rec_sales.quantity, rec_sales.totalsum); -
Could someone look at my code, I can't see the error myself
Hi,
I have been working on a small game, and have been able to make most of it run.
However, every now and again when i try to start it, it loads the frame and graphics, but don't start the game loop.
I think i have been starring at it too long, because i can't see WHY?
Here is the code, i assume its something connected to the boolean "waitingForKeyPress"
Sorry about the commentss being in danish, but its a quite simple program, so im sure it makes sense.
public class EagleFlight extends Canvas {
private static final long serialVersionUID = 1L;
//Strategybuffer til page flipping, samt grafiske variable.
private BufferStrategy strategy = null;
//private BufferedImage backbuffer = null;
private ImageEntity background = null;
//private Graphics2D g;
//private BufferedImage expl;
private BufferedImage[] explosion2;
private boolean gameRunning = true;
//Lister over entiteter i spillet.
private ArrayList<Entity> entities = new ArrayList<Entity>();
private ArrayList<ShipEntity> shipAnimation = new ArrayList<ShipEntity>();
//Lister over entiteter der evt skal fjernes i gameLoop.
private ArrayList<Entity> removeList = new ArrayList<Entity>();
private ArrayList<Entity> removeAsteroid = new ArrayList<Entity>();
//Variable til spillerens skib.
private ShipEntity ship, shipL, shipR, eagleM;
private double moveSpeed = 300;
private long lastFire = 0;
private long firingInterval = 500;
private String message = "";
//Booleans til keyInput og spilkontrol.
private boolean waitingForKeyPress = true;
private boolean leftPressed = false;
private boolean rightPressed = false;
private boolean firePressed = false;
private boolean isThrusting = false;
private Boolean shipHit = false;
private Boolean animation = false;
//Klasser der bruges i spillet.
private FXSound fxSound = null;
private Music music;
int score =0;
private int astroidCount = 0;
//Variable til ekspoltionsanimation.
private int v = 0, x = 0, y = 0, eksp = 0;
//Opretter JFrame og tilf�jer JPanel.
public EagleFlight(){
JFrame container = new JFrame("Eagle Flight 1999");
JPanel panel = (JPanel) container.getContentPane();
panel.setPreferredSize(new Dimension(800,600));
panel.setLayout(null);
//Tilf�jer EagleFlight canvas til JPanel
setBounds(0,0,800,600);
panel.add(this);
//S�ttes til true, s� for�get graphics har ansvaret.
setIgnoreRepaint(true);
//Pakker og synligg�r vinduet.
container.pack();
container.setResizable(false);
container.setVisible(true);
// Tilf�jer windows close funktion
container.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
System.exit(0);
// Tilf�jer keyListener og inputhandler.
addKeyListener(new KeyInputHandler());
//S�tter fokus til dette vindue-
requestFocus();
// Laver buffering strategy til accelerated graphics
createBufferStrategy(2);
strategy = getBufferStrategy();
// Tilf�jer midlertidigt Entities, s� startsk�rmen ikke er tom.
initEntities();
}//End of EagleFlight().
//Nulstiller variable og lister.
private void startGame() {
entities.clear();
initEntities();
shipHit = false;
leftPressed = false;
rightPressed = false;
firePressed = false;
gameRunning = true;
music = new Music();
music.start();
waitingForKeyPress = false;
}//end of startgame().
private void initEntities() {
//Laver 3 skibe til thrusteranimationen.
ship = new sprite.ShipEntity(this,"eagle.png",370,430);
shipL = new sprite.ShipEntity(this,"eagle1.png",370,430);
shipR = new sprite.ShipEntity(this,"eagle2.png",370,430);
shipAnimation.add(ship);
shipAnimation.add(shipL);
shipAnimation.add(shipR);
//Opretter baggrundsbillede.
new BufferedImage(800,600,BufferedImage.TYPE_INT_RGB);
background = new ImageEntity("stars.png",0,0);
//Klarg�r special effect lyd.
fxSound = new FXSound();
//Opretter eksplotionsanimation
explosion2 = new ExplotionImages().explosion();
//Laver en pokkers bunke asteroider og placerer dem "over" JPanel, s� de falder naturligt.
for (int row=0;row<6;row++) {
for (int x=0;x<10;x++) {
Entity astroid = new sprite.Astroid(this,"asteroid1.png",20+(x*120),(-2800)+row*400);
entities.add(astroid);
astroidCount++;
for (int row=0;row<6;row++) {
for (int x=0;x<10;x++) {
Entity astroid = new sprite.Astroid(this,"asteroid4.png",20+(x*120),(-3800)+row*400);
entities.add(astroid);
astroidCount++;
for (int row=0;row<6;row++) {
for (int x=0;x<10;x++) {
Entity astroid = new sprite.Astroid(this,"asteroid2.png",20+(x*120),(-4800)+row*400);
entities.add(astroid);
astroidCount++;
for (int row=0;row<6;row++) {
for (int x=0;x<10;x++) {
Entity astroid = new sprite.Astroid(this,"asteroid3.png",20+(x*120),(-5800)+row*400);
entities.add(astroid);
astroidCount++;
}//end of initEntities()
//Fjerner de entities der ikke bruges mere.
//@param entiteten der skal fjernes.
public void removeEntity(Entity entity)
removeList.add(entity);
}//end of removeEntity().
//Tilf�jer ramte asteroider til remove listen.
//@param entiteten der skal tilf�jes.
public void removeAsteroid(Entity doomed){
removeAsteroid.add(doomed);
}//End of removeAsteroid().
//Udf�res n�r spilleren d�r.
public void notifyDeath() {
message = "All your base are belong to us!";
shipHit = true;
removeAsteroid.add(eagleM);
shipAnimation.clear();
}//End of notifyDeath().
//Fors�ger at affyre v�ben, hvis reload er ok og skibet ikke er ramt.
public void tryToFire() {
// check that we have waiting long enough to fire
if (System.currentTimeMillis() - lastFire < firingInterval) {
return;
if (!shipHit){
lastFire = System.currentTimeMillis();
ShotEntity shot = new sprite.ShotEntity(this,"shot.gif",ship.getX()+23,ship.getY()-15);
entities.add(shot);
fxSound.fxSound1();
}//End of tryToFire().
//Metode til at vinde spillet.
public void notifyAlienKilled() {
astroidCount--;
score++;
fxSound.fxSound3();
if (astroidCount == 0) {
}//End of notifyAlienKilled()
public void gameLoop() {
long lastLoopTime = System.currentTimeMillis();
long timeInGame = 0;
// I dette loop udf�res spillets grafik og logik.
while (gameRunning) {
// Beregner tid for hvor meget de enkelte grafiske enheder skal flyttes
long delta = System.currentTimeMillis() - lastLoopTime;
lastLoopTime = System.currentTimeMillis();
timeInGame = (timeInGame + System.currentTimeMillis()/100000);
// Skaffer den grafiske acceleration.
// Tegner baggrunden.
Graphics2D g = (Graphics2D) strategy.getDrawGraphics();
background.draw(g);
//Cykler rundt mellem asteroider og flytter dem.
if (!waitingForKeyPress) {
for (int i=0;i<entities.size();i++) {
Entity entity = (Entity) entities.get(i);
entity.move(delta);
//Bev�ger de 3 skibe i sync.
for (int e=0;e<shipAnimation.size();e++) {
ShipEntity fakeeaglemove = (ShipEntity) shipAnimation.get(e);
fakeeaglemove.move(delta);
// Cykler rundt mellem entities og tegner dem.
for (int i=0;i<entities.size();i++) {
Entity entity = (Entity) entities.get(i);
entity.draw(g);
//Tegner det skib der er i brug.
for (int e=0;e<shipAnimation.size();e++)
eagleM = (ShipEntity) shipAnimation.get(e);
if (leftPressed)
{eagleM = shipL;
if (rightPressed)
{eagleM = shipR;
else if ((!leftPressed) && (!rightPressed))
{eagleM = ship;
eagleM.draw(g);
//Brute force detection p� skibet og asteroider.
try {
for (int c = 0; c < entities.size(); c++) {
for (int m = 0; m < shipAnimation.size(); m++) {
Entity me = (Entity) shipAnimation.get(m);
Entity him = (Entity) entities.get(c);
if (me.collidesWith(him)) {
//removeAlien.add(him);
me.collidedWith(him);
him.collidedWith(me);
} catch (Exception e) {
//Brute force detection p� skud og asteroider.
try {
for (int p = 0; p < entities.size(); p++) {
for (int s = p + 1; s < entities.size(); s++) {
Entity me = (Entity) entities.get(p);
Entity him = (Entity) entities.get(s);
if (me.collidesWith(him)) {
me.collidedWith(him);
him.collidedWith(me);
} catch (Exception e) {
//Explotion animation.
for (int i=0;i<removeAsteroid.size();i++) {
Entity entity = (Entity) removeAsteroid.get(i);
explosion(entity);
if (animation){
int sequence[] = { 0,1,2,3,4,5,5,4,3,2,1,0};
eksp = sequence[v];
g.drawImage(explosion2[eksp], x-100,y-100, null);
//Afslutter spillet hvis spillerens skib er ramt.
if (eksp == 0 || v == 12){
if (shipHit){
animation = false;
waitingForKeyPress = true;
music.stop();
if(isThrusting){
fxSound.StopThruster();
animation = false;
v = 0;
eksp = 0;
v++;//Opdaterer image nummer for eksplotionsanimation til n�ste genneml�b.
// Fjerner entities der ikke er med mere.
entities.removeAll(removeList);
entities.removeAll(removeAsteroid);
//Nulstiller removelisterne
removeList.clear();
removeAsteroid.clear();
// Mens der ventes p� keyinput vises dette.
if (waitingForKeyPress) {
g.setColor(Color.white);
g.drawString(message,(800-g.getFontMetrics().stringWidth(message))/2,250);
g.drawString("Insert coin",(800-g.getFontMetrics().stringWidth("Insert coin"))/2,300);
timeInGame = 0;
g.setColor(Color.white);
g.drawString("Score: "+score,720,595);
g.drawString("Time in Flight: "+timeInGame/1000000000+" Secs",5,595);
// Graphics ryttes op og bufferen flippes.
g.dispose();
strategy.show();
// Nulstiller skibets bev�gelse.
ship.setHorizontalMovement(0);
shipL.setHorizontalMovement(0);
shipR.setHorizontalMovement(0);
//Tilpasser skibets horizontale bev�gelseshastighed til input.
if ((leftPressed) && (!rightPressed))
ship.setHorizontalMovement(-moveSpeed);
shipL.setHorizontalMovement(-moveSpeed);
shipR.setHorizontalMovement(-moveSpeed);
else if ((rightPressed) && (!leftPressed))
ship.setHorizontalMovement(moveSpeed);
shipL.setHorizontalMovement(moveSpeed);
shipR.setHorizontalMovement(moveSpeed);//animationtest ship changed to eagle
//Affyrings sekvens
if (firePressed)
tryToFire();
// Lille pause til andre ting.
try { Thread.sleep(10); } catch (Exception m) {}
}//End of gameLoop
//Metode til kontrol af thrusterlyden.
private void thrusterSound(){
if (!isThrusting){
fxSound.fxSound2();
isThrusting = true;
}//End of thrusterSound
//Metode til at inds�tte eksplotion p� den rette plads.
//@param den ramte entitet.
private void explosion(Entity entity){
x = entity.getX();
y = entity.getY();
animation = true;
}//End of explosion
//Inner class der klarer input fra keybard.
private class KeyInputHandler extends KeyAdapter {
//S�tter t�ller til 1, s� wait for input virker.
private int pressCount = 1;
//@param den trykkede tast.
public void keyPressed(KeyEvent e) {
// Ser f�rst om der ventes p� input til start.
if (waitingForKeyPress) {
return;
//Er spillet igang udf�res input
if (e.getKeyCode() == KeyEvent.VK_LEFT) {
leftPressed = true;
thrusterSound();
if (e.getKeyCode() == KeyEvent.VK_RIGHT) {
rightPressed = true;
thrusterSound();
if (e.getKeyCode() == KeyEvent.VK_SPACE) {
firePressed = true;
} //End of keyPressed
//Stopper handlingen fra input
//@param den trykkede tast.
public void keyReleased(KeyEvent e) {
// if we're waiting for an "any key" typed then we don't
// want to do anything with just a "released"
if (waitingForKeyPress) {
return;
if (e.getKeyCode() == KeyEvent.VK_LEFT) {
leftPressed = false;
fxSound.StopThruster();
isThrusting = false;
if (e.getKeyCode() == KeyEvent.VK_RIGHT) {
rightPressed = false;
fxSound.StopThruster();
isThrusting = false;
if (e.getKeyCode() == KeyEvent.VK_SPACE) {
firePressed = false;
}//End of keyReleased
//Metode til at starte spillet med any key.
//@param den trykkede tast.
public void keyTyped(KeyEvent e) {
if (waitingForKeyPress) {
if (pressCount == 1) {
// Starter spillet.
waitingForKeyPress = false;
startGame();
//pressCount = 0;
} else {
pressCount++;
// Tilf�jer esc key til at afslutte spillet.
if (e.getKeyChar() == 27) {
System.exit(0);
}//End of KeyTyped.
public static void main(String args[])
EagleFlight ef = new EagleFlight();
ef.gameLoop();
}//End of main.
}//End of class EagleFlight.Mondariz wrote:
It was a copy/paste job from Eclipse, not suer why it formatted like this. You need to add code tags.
[edit: do what Darryl says... as opposed to my crap version that did not format properly either]
As far as the tracing goes. It shouldn't be taking hours. Start by putting them in where your program starts and move on. -
HT2509 Can you see the list of fonts in the actual font?
Is it possible to see the name of the font in the list in the actual font?
If you are looking for a third-party utility that can display the various font faces in a list, then there might be one available (I'm not sure which is the best one, but there may be a good free one out there); however, if you want to view them in various font menus that you access in the system then as I mentioned above this will be an application-specific behavior, and some will support it whereas others will not.
Despite this, one crude approach to previewing fonts is to use Apple's "Stacks" view for folders in the Dock. To do this, go to the Macintosh HD/Library/Fonts/ folder and drag it to the Dock next to the trash. Then click it to open it and you will see your fonts listed, with capital and lower-case A characters in the font face. You can then highlight a font either by hovering over it with your mouse or by using the arrow keys, and then press the Space bar to show a preview of it for you to get a better sense of its style.
The fonts on the system will be in the following folders:
Macintosh HD/Library/Fonts
Macintosh HD/System/Library/Fonts
Macintosh HD/Users/username/Library/Fonts (this library folder is hidden but can be revealed by holding Option then opening the Go meny in the Finder). -
Where can you see the time of the movie
Hello to you all, i have a question about Imovie 11. A friend send me 3 small video's from his phone, with a description wich fragments to use.
Example: Movie 1: from 00.00.35 - 00:01:27 and from 00:02.40 - 00:002.49, etc.
But I don't see a timeline? I can't see where I am in the movie.
I need to select fragments based on time, it would seem to me that this is really basic functionality?
Thanks in advance,
SimonHmm, it works for the project, but not in the library, then you just get the title of the date and time the video has been imported. (And that is the place where I would like to see the original time changing)
If I use the information in the project, I can't cut several pieces of time, because than the time of the second fragment wouldn't be right anymore..
Thanks for you reply! -
Where can you see the size of your image?
Hi all,
For contests and such, I need to know the size of my images. I don't know where the size--in inches--displays in LR, so I always have to export to Photoshop to see what the size of the image is at different resolutions (240ppi, 300ppi, 600ppi). There must be a way, can anyone fill me in?
Thanks!
AlecYou wrote:
"images are by and large worthless in the real world unless they are printed in some fashion which requires inches"
Yes, but that does not mean that images on your computer (your hard drive) have a dimension in inches. The size in inches is determined on output for printing and varies according to the resolution that you choose for the print. For instance if you have an image with a pixel size of 2000 x 3000 pixels - if you print it at a resolution of 300 ppi / dpi the image size in inches will be 6.66" x 10". If you print it with a resolutin of 200 ppi / dpi the size in inches will be 10" x 15"; and if you print it with a resolution of 100 ppi / dpi the size will be 20" x 30". Of course, a print resolution of 100 ppi / dpi is only theoretical, because the quality of the print will be awful, and if you want to print an image of 2000 x 3000 ppi in a size of 20' x 30' you have to upsample (enlarge) it first.
So size of an image in inches is detyermind by the formula: pixel amount / resolution in ppi/dpi.
ppi = pixels per inch - ppi is used when we talk about an image on screen
dpi = dots per inch - dpi is used when we talk about print output.
You also wrote:
"LR printing is fine for snapshots but insufficient for printing from large format printers for fine art."
Why, do you say that? Printing from LR is not substantially different than printing from Photoshop. LR gives you the same printing options as does Photoshop.
I suggest you have a second look at the Print Module in LR.
WW -
How can you see the progress when using a ForEach loop?
Hi,
I have an array with about 100 containers in it. My main thread uses a ForEach loop with an inner case structure with six possibilities. My previous program had all the steps in a very long list, executing them one by one. I find this new approach is much nicer to look at, and easier to change, but there isn't really any way of telling how far along the test is (unless you know it by heart). In the long list approach, you could see all the Done/Passed outcomes and how many remained, now there is no way of telling.
Any tips on making some kind of progress indication?
Solved!
Go to Solution.As ObjectReference parameter, you should use 'Nothing'. The last parameter (synchronuous?) you can choose true or false. Please refer to the documentation of PostUIMessageEx for further information.
The numeric parameter should range between 0-100. Since it is "Progress Percent", this makes sense, does it?
The status bar has several panes, one e.g. displaying the logged in user or the used process model. The pane on the right most side will display the Progress Percent if used in your sequence.
The default reporting, as already stated, includes this feature. So if you have a sequence with e.g. 500 steps, the reporting "will have a visible progress" in that pane (with less than 100 steps, it is most often too fast to see). Remember that NI Sequence Editor and the Full Featured User Interfaces do have this feature, the Simple UI does not have it.
Norbert
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it. -
This isn't known until you actually save the file. The size will also depend on how you save.
File > Save - always bigger, nothing ever deleted
File > Save as - dead stuff removed
File > Save as with Fast Web View (may be default) - duplicate backgrouds combined, but extra information added for web view
So, save it, then use command+D to get info.
Maybe you are looking for
-
Filter and general access issues from planning to essbase
Hi all, V 9.3.1 Planning I am working on a planning system where the business owners would like to restrict the lock and sending of data via smartview. Basically, users are bypassing parts of planning and going directly to essbase rather than forms.
-
Problems with subclassing in Forms 6i
When I subclass text fields and canvases in Forms I am not able to see them when they are compiled. The layout does not include any of the text fields for entering in data. When I un-subclass all the elements from an Oracle form I am able to see ever
-
Activation of Infotype for Interactive reporting
I know that from SAP CRM 7.0 EHP 1.0 sap provides support for interactive report on Service requests. My question - Is there any standard interactive report on service request provided by SAP CRM? I checked in ORDYWB(Interactive workbench), I did not
-
Making catalog free text item editable
Hi Guys, We are working wirh SRM 7.0, SP09 for extended classic scenario. One of our requirement to make the catalog free text item editable was achieved by a solution as suggested in below thread. Editing of catalog transfered item in SC This soluti
-
Basic Autenticaation without weblogi.xml failed
Hello, I have a problem with the Basic-Authentication, in a simple Webapp contains with a Servlet called "servlet1", enable Security in Weblogic 7.0 and add new Role called "testrole" for the Webapp,in the Defaultrealm. Now configuration the web.xml