Help needed reg this code
& Include MZFBPS_TRREQTOP Module poo
PROGRAM SAPMZFBPS_TRREQ .
tables : ZFBPS_TRPTR_REQ,
ZFBPS_CONT_HD,
ZFBPS_CONT_DT.
data: OK_CODE like sy-ucomm,
save_ok(4).
data : it_gate like standard table of ZFBPS_TRPTR_REQ,
wa_gate like line of it_gate.
TYPES: BEGIN OF values,
TRANSPORTER_CODE TYPE ZFBPS_CONT_HD-TRANSPORTER_CODE,
TRUCK_CODE TYPE ZFBPS_CONT_DT-TRUCK_CODE,
DESTINATION TYPE ZFBPS_CONT_DT-DESTINATION,
END OF values.
DATA: TRANS(5) TYPE c,
TRUCK(15) TYPE c.
DATA: progname TYPE sy-repid,
dynnum TYPE sy-dynnr,
dynpro_values TYPE TABLE OF dynpread,
field_value LIKE LINE OF dynpro_values,
values_tab TYPE TABLE OF values.
*& Module INIT OUTPUT
text
MODULE INIT OUTPUT.
progname = sy-repid.
dynnum = sy-dynnr.
CLEAR: field_value, dynpro_values.
field_value-fieldname = 'TRANS'.
APPEND field_value TO dynpro_values.
ENDMODULE. " INIT OUTPUT
*& Module VALUE_TRANS INPUT
text
MODULE VALUE_TRANS INPUT.
CALL FUNCTION 'F4IF_FIELD_VALUE_REQUEST'
EXPORTING
tabname = 'ZFBPS_CONT_HD'
fieldname = 'TRANSPORTER_CODE'
dynpprog = progname
dynpnr = dynnum
dynprofield = 'TRANS'.
ENDMODULE. " VALUE_TRANS INPUT
*& Module VALUE_TRUCK INPUT
text
MODULE VALUE_TRUCK INPUT.
CALL FUNCTION 'DYNP_VALUES_READ'
EXPORTING
dyname = progname
dynumb = dynnum
translate_to_upper = 'X'
TABLES
dynpfields = dynpro_values.
READ TABLE dynpro_values INDEX 1 INTO field_value.
SELECT ATRANSPORTER_CODE BTRUCK_CODE b~DESTINATION
FROM ( ZFBPS_CONT_DT AS B INNER JOIN ZFBPS_CONT_HD AS A
ON ACONTRACT_NUM EQ BCONTRACT_NUM )
INTO CORRESPONDING FIELDS OF TABLE values_tab
WHERE A~TRANSPORTER_CODE = field_value-fieldvalue.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
retfield = 'TRUCK_CODE'
dynpprog = progname
dynpnr = dynnum
dynprofield = 'TRUCK'
value_org = 'S'
TABLES
value_tab = values_tab.
ENDMODULE. " VALUE_TRUCK INPUT
In values_tab I have three fields and I wish to return all the three fields,but at present I am able to return only one field (TRUCK). How to return other fields.
Please suggest a solution.
Regards,
Deepak.
Do not pass the dynprofield parameter and check.
Regards,
Ravi
Similar Messages
-
Hi guys, I need help in debugging this code I made, which is a GUI minesweeper. Its extremely buggy...I particularly need help fixing the actionListener part of the code as everytime I press a button on the GUI, an exception occurs.
help please!
package minesweeperGUI;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class MinesweeperGUI implements ActionListener
//Declaration of attributes
static int length = 0;
JMenuItem menuItemNew = new JMenuItem();
JRadioButtonMenuItem rbEasy = new JRadioButtonMenuItem();
JRadioButtonMenuItem rbHard = new JRadioButtonMenuItem();
JMenuItem menuItemExit = new JMenuItem();
JButton buttonReset = new JButton();
JButton buttonGrid[][] = null;
JFrame frame = new JFrame();
int getBombsTotal = 0;
JLabel setBombsLabel = new JLabel();
int a = 0;
int b = 0;
//No constructor created. Uses default constructor
//Create the menu bar
public JMenuBar newMenuBar()
//Sets up the menubar
JMenuBar menuBar = new JMenuBar();
//Sets up the Game menu with choice of new, grid size, and exit
JMenu menu = new JMenu ("Game");
menuBar.add (menu);
menuItemNew = new JMenuItem ("New");
menuItemNew.addActionListener (this);
menu.add (menuItemNew);
menu.addSeparator();
//Sets up sub-menu for grid size with choice of easy and hard radio buttons
JMenu subMenu = new JMenu ("Grid Size");
rbEasy = new JRadioButtonMenuItem ("Easy: 5x5 grid");
rbEasy.addActionListener (this);
subMenu.add (rbEasy);
rbHard = new JRadioButtonMenuItem ("Hard: 10x10 grid");
rbHard.addActionListener (this);
subMenu.add (rbHard);
menu.add (subMenu);
menu.addSeparator();
menuItemExit = new JMenuItem ("Exit");
menuItemExit.addActionListener (this);
menu.add (menuItemExit);
return menuBar;
//Setting up of Bomb Grid
public int [][] setGrid (int length)
int grid[][] = null;
grid = new int[length][length];
for (int i = 0; i < length; i++)
for (int j = 0; j < length; j++)
grid[i][j] = ((int)Math.round(Math.random() * 10))% 2;
return grid;
//Setting up of the of the graphical bomb grid
public JButton[][] setButtonGrid (int length)
JButton buttonGrid[][] = null;
buttonGrid = new JButton[length][length];
for (int i = 0; i < length; i++)
for (int j = 0; j < length; j++)
buttonGrid[i][j] = new JButton();
return buttonGrid;
//Setting up of a way to count the total number of bombs in the bomb grid
public int getBombsTotal (int length, int setGrid[][])
int bombsTotal = 0;
for (int i = 0; i < length; i++)
for (int j = 0; j < length; j++)
if (setGrid[i][j] == 1)
bombsTotal += 1;
return bombsTotal;
//Create a label for number of bombs left
public JLabel setBombsLabel (int getBombsTotal)
JLabel bombsLabel = new JLabel(String.valueOf (getBombsTotal) + " Bombs Left");
return bombsLabel;
//Setting up a way to count the number of bombs around a button
public String setBombs (int length, int setGrid[][], int x, int y)
int bombs[][] = new int[length][length];
String bombsString = null;
for (int i = 0; i < length; i++)
for (int j = 0; j < length; j++)
if (i == 0 && j == 0)
bombs[i][j] = setGrid[i][j+1] + setGrid[i+1][j] +
setGrid[i+1][j+1];
else if (i ==0 && j == (length - 1))
bombs[i][j] = setGrid[i][j-1] + setGrid[i+1][j-1] +
setGrid[i+1][j];
else if (i == (length - 1) && j == 0)
bombs[i][j] = setGrid[i-1][j] + setGrid[i-1][j+1] +
setGrid[i][j+1];
else if (i == (length - 1) && j == (length - 1))
bombs[i][j] = setGrid[i-1][j-1] + setGrid[i-1][j] +
setGrid[i][j-1];
else if (i == 0 && j != 0 && j != (length - 1))
bombs[i][j] = setGrid[i][j-1] + setGrid[i][j+1] +
setGrid[i+1][j-1] + setGrid[i+1][j] +
setGrid[i+1][j+1];
else if (i == (length - 1) && j != 0 && j != (length - 1))
bombs[i][j] = setGrid[i-1][j-1] + setGrid[i-1][j] +
setGrid[i-1][j+1] + setGrid[i][j-1] +
setGrid[i][j+1];
else if (i != 0 && i != (length - 1) && j == 0)
bombs[i][j] = setGrid[i-1][j] + setGrid[i-1][j+1] +
setGrid[i][j+1] + setGrid[i+1][j] +
setGrid[i+1][j+1];
else if (i != 0 && i != (length - 1) && j == (length - 1))
bombs[i][j] = setGrid[i-1][j-1] + setGrid[i-1][j] +
setGrid[i][j-1] + setGrid[i+1][j-1] +
setGrid[i+1][j];
else
bombs[i][j] = setGrid[i-1][j-1] + setGrid[i-1][j] +
setGrid[i-1][j+1] + setGrid[i][j-1] +
setGrid[i][j+1] + setGrid[i+1][j-1] +
setGrid[i+1][j] + setGrid[i+1][j+1];
bombsString = String.valueOf (bombs[x][y]);
return bombsString;
//create the panel for the bombs label and reset button
public JPanel newTopPanel(int length)
int setGridNew [][] = null;
setGridNew = new int[length][length];
int getBombsTotalNew = 0;
JLabel setBombsLabelNew = new JLabel();
setGridNew = setGrid (length);
getBombsTotalNew = getBombsTotal (length, setGridNew);
setBombsLabelNew = setBombsLabel (getBombsTotalNew);
JPanel topPanel = new JPanel ();
topPanel.setLayout (new BorderLayout (50,50));
JLabel bombsLabel = new JLabel ();
bombsLabel = setBombsLabelNew;
topPanel.add (bombsLabel, BorderLayout.WEST);
buttonReset = new JButton("Reset");
buttonReset.addActionListener (this);
topPanel.add (buttonReset, BorderLayout.CENTER);
return topPanel;
//create the panel for the play grids
public JPanel newBottomPanel(int length)
JButton setButtonGridNew[][] = null;
setButtonGridNew = new JButton [length][length];
setButtonGridNew = setButtonGrid (length);
JPanel bottomPanel = new JPanel ();
bottomPanel.setLayout (new GridLayout (length, length));
buttonGrid = new JButton[length][length];
for (a = 0; a < length; a++)
for (b = 0; b < length; b++)
buttonGrid[a] = setButtonGridNew[a][b];
buttonGrid[a][b].addActionListener (this);
bottomPanel.add (buttonGrid[a][b]);
return bottomPanel;
//Overiding of abstract method actionPerformed
public void actionPerformed(ActionEvent e)
if (e.getSource() == menuItemNew)
launchFrame(length);
else if (e.getSource() == menuItemExit)
frame.setVisible (false);
System.exit(0);
else if (e.getSource() == rbEasy)
length = 5;
launchFrame(length);
else if (e.getSource() == rbHard)
length = 10;
launchFrame(length);
else if (e.getSource() == buttonReset)
launchFrame(length);
else if (e.getSource() == buttonGrid[a][b])
int setGridNew [][] = null;
setGridNew = new int[length][length];
JButton bombButton [][] = null;
bombButton = new JButton [length][length];
String bombString [][] = null;
bombString = new String[length][length];
setGridNew = setGrid (length);
bombString[a][b] = setBombs (length, setGridNew, a, b);
bombButton[a][b] = new JButton (bombString[a][b]);
if (setGridNew[a][b] == 0)
buttonGrid[a][b] = bombButton[a][b];
getBombsTotal--;
JLabel setBombsLabelNew = new JLabel();
setBombsLabelNew = setBombsLabel (getBombsTotal);
else if (setGridNew[a][b] == 1 )
buttonGrid[a][b] = new JButton("x");
JOptionPane.showMessageDialog (null, "Game Over. You hit a Bomb!");
System.exit(0);
//create the content pane
public Container newContentPane(int length)
JPanel topPanel = new JPanel();
JPanel bottomPanel = new JPanel();
topPanel = newTopPanel(length);
bottomPanel = newBottomPanel (length);
JPanel contentPane = new JPanel();
contentPane.setOpaque (true);
contentPane.setLayout (new BorderLayout(50,50));
contentPane.add (topPanel, BorderLayout.NORTH);
contentPane.add (bottomPanel, BorderLayout.CENTER);
return contentPane;
public void launchFrame (int length)
//Makes sure we have nice window decorations
JFrame.setDefaultLookAndFeelDecorated(true);
//Sets up the top-level window
frame = new JFrame ("Minesweeper");
//Exits program when the closed button is clicked
frame.setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE);
JMenuBar menuBar = new JMenuBar();
Container contentPane = new Container();
menuBar = newMenuBar();
contentPane = newContentPane (length);
//Sets up the menu bar and content pane
frame.setJMenuBar (menuBar);
frame.setContentPane (contentPane);
//Displays the window
frame.pack();
frame.setVisible (true);
public static void main (String args[])
//Default length is 5
length = 5;
MinesweeperGUI minesweeper = new MinesweeperGUI();
minesweeper.launchFrame(length);hi, thanks. that removed the exception; although now the buttons action listener won't work :(
here is the revised code:
To anyone out there, can you guys run this code and help me debug it?
I'm really desperate as this is a school project of mine and the deadline is 7 hours away. I have already been working on it for 3 days, but the program is still very buggy.
thanks!
/* Oliver Ian C. Wee 04-80112
* CS12 MHRU
* Machine Problem 2
package minesweeperGUI;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class MinesweeperGUI implements ActionListener
//Declaration of attributes
static int length = 0;
JMenuItem menuItemNew = new JMenuItem();
JRadioButtonMenuItem rbEasy = new JRadioButtonMenuItem();
JRadioButtonMenuItem rbHard = new JRadioButtonMenuItem();
JMenuItem menuItemExit = new JMenuItem();
JButton buttonReset = new JButton();
JButton buttonGrid[][] = null;
JFrame frame = new JFrame();
int getBombsTotal = 0;
JLabel setBombsLabel = new JLabel();
int a = 0;
int b = 0;
//No constructor created. Uses default constructor
//Create the menu bar
public JMenuBar newMenuBar()
//Sets up the menubar
JMenuBar menuBar = new JMenuBar();
//Sets up the Game menu with choice of new, grid size, and exit
JMenu menu = new JMenu ("Game");
menuBar.add (menu);
menuItemNew = new JMenuItem ("New");
menuItemNew.addActionListener (this);
menu.add (menuItemNew);
menu.addSeparator();
//Sets up sub-menu for grid size with choice of easy and hard radio buttons
JMenu subMenu = new JMenu ("Grid Size");
ButtonGroup bg = new ButtonGroup();
rbEasy = new JRadioButtonMenuItem ("Easy: 5x5 grid");
bg.add (rbEasy);
rbEasy.addActionListener (this);
subMenu.add (rbEasy);
rbHard = new JRadioButtonMenuItem ("Hard: 10x10 grid");
bg.add (rbHard);
rbHard.addActionListener (this);
subMenu.add (rbHard);
menu.add (subMenu);
menu.addSeparator();
menuItemExit = new JMenuItem ("Exit");
menuItemExit.addActionListener (this);
menu.add (menuItemExit);
return menuBar;
//Setting up of Bomb Grid
public int [][] setGrid (int length)
int grid[][] = null;
grid = new int[length][length];
for (int i = 0; i < length; i++)
for (int j = 0; j < length; j++)
grid[i][j] = ((int)Math.round(Math.random() * 10))% 2;
return grid;
//Setting up of the of the graphical bomb grid
public JButton[][] setButtonGrid (int length)
JButton buttonGrid[][] = null;
buttonGrid = new JButton[length][length];
for (int i = 0; i < length; i++)
for (int j = 0; j < length; j++)
buttonGrid[i][j] = new JButton();
return buttonGrid;
//Setting up of a way to count the total number of bombs in the bomb grid
public int getBombsTotal (int length, int setGrid[][])
int bombsTotal = 0;
for (int i = 0; i < length; i++)
for (int j = 0; j < length; j++)
if (setGrid[i][j] == 1)
bombsTotal += 1;
return bombsTotal;
//Create a label for number of bombs left
public JLabel setBombsLabel (int getBombsTotal)
JLabel bombsLabel = new JLabel(" " +String.valueOf (getBombsTotal) + " Bombs Left");
return bombsLabel;
//Setting up a way to count the number of bombs around a button
public String setBombs (int length, int setGrid[][], int x, int y)
int bombs[][] = new int[length][length];
String bombsString = null;
for (int i = 0; i < length; i++)
for (int j = 0; j < length; j++)
if (i == 0 && j == 0)
bombs[i][j] = setGrid[i][j+1] + setGrid[i+1][j] +
setGrid[i+1][j+1];
else if (i ==0 && j == (length - 1))
bombs[i][j] = setGrid[i][j-1] + setGrid[i+1][j-1] +
setGrid[i+1][j];
else if (i == (length - 1) && j == 0)
bombs[i][j] = setGrid[i-1][j] + setGrid[i-1][j+1] +
setGrid[i][j+1];
else if (i == (length - 1) && j == (length - 1))
bombs[i][j] = setGrid[i-1][j-1] + setGrid[i-1][j] +
setGrid[i][j-1];
else if (i == 0 && j != 0 && j != (length - 1))
bombs[i][j] = setGrid[i][j-1] + setGrid[i][j+1] +
setGrid[i+1][j-1] + setGrid[i+1][j] +
setGrid[i+1][j+1];
else if (i == (length - 1) && j != 0 && j != (length - 1))
bombs[i][j] = setGrid[i-1][j-1] + setGrid[i-1][j] +
setGrid[i-1][j+1] + setGrid[i][j-1] +
setGrid[i][j+1];
else if (i != 0 && i != (length - 1) && j == 0)
bombs[i][j] = setGrid[i-1][j] + setGrid[i-1][j+1] +
setGrid[i][j+1] + setGrid[i+1][j] +
setGrid[i+1][j+1];
else if (i != 0 && i != (length - 1) && j == (length - 1))
bombs[i][j] = setGrid[i-1][j-1] + setGrid[i-1][j] +
setGrid[i][j-1] + setGrid[i+1][j-1] +
setGrid[i+1][j];
else
bombs[i][j] = setGrid[i-1][j-1] + setGrid[i-1][j] +
setGrid[i-1][j+1] + setGrid[i][j-1] +
setGrid[i][j+1] + setGrid[i+1][j-1] +
setGrid[i+1][j] + setGrid[i+1][j+1];
bombsString = String.valueOf (bombs[x][y]);
return bombsString;
//create the panel for the bombs label and reset button
public JPanel newTopPanel(int length)
int setGridNew [][] = null;
setGridNew = new int[length][length];
int getBombsTotalNew = 0;
JLabel setBombsLabelNew = new JLabel();
setGridNew = setGrid (length);
getBombsTotalNew = getBombsTotal (length, setGridNew);
setBombsLabelNew = setBombsLabel (getBombsTotalNew);
JPanel topPanel = new JPanel ();
topPanel.setLayout (new BorderLayout (20,20));
JLabel bombsLabel = new JLabel ();
bombsLabel = setBombsLabelNew;
topPanel.add (bombsLabel, BorderLayout.WEST);
buttonReset = new JButton("Reset");
buttonReset.addActionListener (this);
topPanel.add (buttonReset, BorderLayout.CENTER);
return topPanel;
//create the panel for the play grids
public JPanel newBottomPanel(int length)
JButton setButtonGridNew[][] = null;
setButtonGridNew = new JButton [length][length];
setButtonGridNew = setButtonGrid (length);
JPanel bottomPanel = new JPanel ();
bottomPanel.setLayout (new GridLayout (length, length));
buttonGrid = new JButton[length][length];
for (int i = 0; i < length; i++)
for (int j = 0; j < length; j++)
buttonGrid[i][j] = setButtonGridNew[i][j];
buttonGrid[i][j].addActionListener (this);
bottomPanel.add (buttonGrid[i][j]);
return bottomPanel;
//Overiding of abstract method actionPerformed
public void actionPerformed(ActionEvent e)
if (e.getSource() == menuItemNew)
closeFrame();
launchFrame(length);
else if (e.getSource() == menuItemExit)
frame.setVisible (false);
System.exit(0);
else if (e.getSource() == rbEasy)
closeFrame();
length = 5;
launchFrame(length);
else if (e.getSource() == rbHard)
closeFrame();
length = 10;
launchFrame(length);
else if (e.getSource() == buttonReset)
closeFrame();
launchFrame(length);
else if (e.getSource() == buttonGrid[a])
int setGridNew [][] = null;
setGridNew = new int[length][length];
JButton bombButton [][] = null;
bombButton = new JButton [length][length];
String bombString [][] = null;
bombString = new String[length][length];
setGridNew = setGrid (length);
for (int i = 0; i < length; i++)
for (int j = 0; j < length; j++)
bombString[i][j] = setBombs (length, setGridNew, i, j);
bombButton[i][j] = new JButton (bombString[i][j]);
if (setGridNew[a][b] == 0)
buttonGrid[a][b] = bombButton[a][b];
getBombsTotal--;
JLabel setBombsLabelNew = new JLabel();
setBombsLabelNew = setBombsLabel (" " String.valueOf (getBombsTotal) " Bombs Left");
else if (setGridNew[a][b] == 1 )
buttonGrid[a][b] = new JButton("x");
JOptionPane.showMessageDialog (null, "Game Over. You hit a Bomb!");
System.exit(0);
//create the content pane
public Container newContentPane(int length)
JPanel topPanel = new JPanel();
JPanel bottomPanel = new JPanel();
topPanel = newTopPanel(length);
bottomPanel = newBottomPanel (length);
JPanel contentPane = new JPanel();
contentPane.setOpaque (true);
contentPane.setLayout (new BorderLayout(5,5));
contentPane.add (topPanel, BorderLayout.NORTH);
contentPane.add (bottomPanel, BorderLayout.CENTER);
return contentPane;
public void closeFrame ()
frame = new JFrame ("Minesweeper");
frame.dispose();
public void launchFrame (int length)
//Makes sure we have nice window decorations
JFrame.setDefaultLookAndFeelDecorated(true);
//Sets up the top-level window
frame = new JFrame ("Minesweeper");
//Exits program when the closed button is clicked
frame.setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE);
JMenuBar menuBar = new JMenuBar();
Container contentPane = new Container();
menuBar = newMenuBar();
contentPane = newContentPane (length);
//Sets up the menu bar and content pane
frame.setJMenuBar (menuBar);
frame.setContentPane (contentPane);
//Displays the window
frame.pack();
frame.setVisible (true);
public static void main (String args[])
//Default length is 5
length = 5;
MinesweeperGUI minesweeper = new MinesweeperGUI();
minesweeper.launchFrame(length); -
Help needed with this form in DW
Hi, i have created this form in dreamweaver but ive got this problem.
In the fields above the text field, the client needs to fill in some info such as name, email telephone number etc.
But the problem is when ill get the messages. Only the text from the large text field is there.
What did i do wrong??
http://www.hureninparamaribo.nl/contact.html
Thank you
Anybody??Thank you for your response. So what do i have to do to fix this?
Date: Sun, 20 Jan 2013 07:57:56 -0700
From: [email protected]
To: [email protected]
Subject: Help needed with this form in DW
Re: Help needed with this form in DW
created by Ken Binney in Dreamweaver General - View the full discussion
You have several duplicate "name" attributes in these rows which also appears in the first row
Telefoon:
Huurperiode:
Aantal personen:
Please note that the Adobe Forums do not accept email attachments. If you want to embed a screen image in your message please visit the thread in the forum to embed the image at http://forums.adobe.com/message/5008247#5008247
Replies to this message go to everyone subscribed to this thread, not directly to the person who posted the message. To post a reply, either reply to this email or visit the message page: http://forums.adobe.com/message/5008247#5008247
To unsubscribe from this thread, please visit the message page at http://forums.adobe.com/message/5008247#5008247. In the Actions box on the right, click the Stop Email Notifications link.
Start a new discussion in Dreamweaver General by email or at Adobe Community
For more information about maintaining your forum email notifications please go to http://forums.adobe.com/message/2936746#2936746. -
Can somebody help me with this code?
Can anyone help me with this code? My problem is that i can't
seem to position this form, i want to be able to center it
vertically & horizontally in a div either using CSS or any
other means.
<div id="searchbar"><!--Search Bar -->
<div id="searchcart">
<div class="serchcartcont">
<form action='
http://www.romancart.com/search.asp'
name="engine" target=searchwin id="engine">
<input type=hidden value=????? name=storeid>
<input type=text value='' name=searchterm>
<input type=submit value='Go'> </form>
</div>
</div>
<div class="searchcont">Search For
Products:</div>
</div><!-- End Search Bar -->
Pleasssssseeeeeeee Help
ThanksHi,
Your form is defined in a div named "serchcartcont", you can
use attributes like position and align of the div to do what you
want to do. But there are two more dives above this dive, you will
have define the height width of these before you can center align
the inner most div. If you are not defining the height & width
then by default it decide it automatically to just fit the content
in it.
Hope this helps.
Maneet
LeXolution IT Services
Web Development
Company -
Please someone help me with this code..
hi, i have a big problem trying to figure out how to do this, i get this code somewhere in the net, so it's not me who code this, that's why i got this problem.
this is a MIDlet games, something like gallaga. i like to add some features like the UP and DOWN movement and also i have a problem with his "fire", i can only shoot once after the fire image is gone in the screen, what i liked to have is even i pressed the fire button and press it again the fire will not gone, what i mean continues fire if i pressed everytime the fire button.
i will post the code here so you can see it and give me some feedback. i need this badly, hoping to all you guys! thanks..for this forum.
----CODE BEGIN ---------------
import java.io.IOException;
import java.io.PrintStream;
import java.util.Random;
import javax.microedition.lcdui.*;
import javax.microedition.midlet.MIDlet;
import javax.microedition.midlet.MIDletStateChangeException;
import javax.microedition.rms.RecordStore;
import javax.microedition.rms.RecordStoreException;
public class MobileGalaga extends MIDlet
implements CommandListener, Runnable
class ScoreScreen extends Canvas
public void paint(Graphics g)
g.setColor(0xffffff);
g.fillRect(0, 0, MobileGalaga.WIDTH, MobileGalaga.HEIGHT);
g.setColor(0x160291);
g.setFont(MobileGalaga.fs);
g.drawString("Help", MobileGalaga.CENTERW, 2, 17);
g.setColor(0);
g.drawString("Use left/right and fire", MobileGalaga.CENTERW, 20, 17);
g.drawString("to destory the", MobileGalaga.CENTERW, 30, 17);
g.drawString("incoming alien MobileGalaga", MobileGalaga.CENTERW, 40, 17);
public void keyPressed(int i)
int j = getGameAction(i);
if(j == 8)
display.setCurrent(titlescreen);
ScoreScreen()
class TitleScreen extends Canvas
public void paint(Graphics g)
g.setColor(0xffffff);
g.fillRect(0, 0, MobileGalaga.WIDTH, MobileGalaga.HEIGHT);
g.drawImage(MobileGalaga.logoimg, MobileGalaga.CENTERW, 15, 17);
g.setColor(0);
g.setFont(MobileGalaga.fs);
g.drawString("Press 5 to", MobileGalaga.CENTERW, 43, 17);
g.drawString("see help", MobileGalaga.CENTERW, 53, 17);
public void keyPressed(int i)
int j = getGameAction(i);
if(j == 8)
display.setCurrent(scorescreen);
TitleScreen()
class MainScreen extends Canvas
public void paint(Graphics g)
offg.setColor(0xffffff);
offg.fillRect(0, 0, MobileGalaga.WIDTH, MobileGalaga.HEIGHT);
for(int i = 0; i < MobileGalaga.slen; i++)
if(!MobileGalaga.dead)
offg.drawImage(MobileGalaga.alienimg[MobileGalaga.frame[i]], MobileGalaga.x[i], MobileGalaga.y[i], 17);
if(!MobileGalaga.playerdead)
offg.drawImage(MobileGalaga.playerimg, MobileGalaga.px, MobileGalaga.py, 17);
} else
if(MobileGalaga.explodeframe < 3)
offg.drawImage(MobileGalaga.explosionimg[MobileGalaga.explodeframe], MobileGalaga.px, MobileGalaga.py, 17);
MobileGalaga.explodeframe++;
if(!MobileGalaga.gameover)
MobileGalaga.playerpause++;
if(MobileGalaga.playerpause < 50)
MobileGalaga.playerpause++;
} else
MobileGalaga.playerdead = false;
MobileGalaga.playerpause = 0;
MobileGalaga.px = MobileGalaga.CENTERW;
offg.setColor(0);
offg.drawString(MobileGalaga.scorestr, MobileGalaga.WIDTH, 0, 24);
offg.drawImage(MobileGalaga.playerimg, 0, 0, 20);
offg.drawString(MobileGalaga.lives + "", 12, 0, 20);
if(MobileGalaga.laser)
offg.drawLine(MobileGalaga.laserx, MobileGalaga.lasery, MobileGalaga.laserx, MobileGalaga.lasery + 4);
if(MobileGalaga.showscores)
for(int j = 0; j < 5; j++)
if(j == MobileGalaga.rank)
offg.setColor(0xff0000);
else
offg.setColor(0);
offg.drawString((j + 1) + " .... " + getScoreStr(MobileGalaga.highscore[j]), MobileGalaga.CENTERW, 20 + j * 10, 17);
if(MobileGalaga.showmessage)
offg.setColor(0xff0000);
offg.drawString(MobileGalaga.msg, MobileGalaga.CENTERW, MobileGalaga.CENTERH, 17);
MobileGalaga.messagepause++;
if(MobileGalaga.messagepause > 20)
MobileGalaga.showmessage = false;
MobileGalaga.messagepause = 0;
if(MobileGalaga.gameover)
MobileGalaga.showscores = true;
else
if(MobileGalaga.wavecomplete)
initWave();
g.drawImage(offimg, 0, 0, 20);
public void keyPressed(int i)
int j = getGameAction(i);
if(j == 2)
MobileGalaga.playerLeft = true;
else
if(j == 5)
MobileGalaga.playerRight = true;
else
if(j == 8)
fireLaser();
public void keyReleased(int i)
int j = getGameAction(i);
if(j == 2)
MobileGalaga.playerLeft = false;
else
if(j == 5)
MobileGalaga.playerRight = false;
private Image offimg;
private Graphics offg;
public MainScreen()
offimg = Image.createImage(getWidth(), getHeight());
offg = offimg.getGraphics();
offg.setFont(MobileGalaga.fs);
public MobileGalaga()
rand = new Random();
display = Display.getDisplay(this);
mainscreen = new MainScreen();
titlescreen = new TitleScreen();
scorescreen = new ScoreScreen();
WIDTH = mainscreen.getWidth();
HEIGHT = mainscreen.getHeight();
CENTERW = WIDTH / 2;
CENTERH = HEIGHT / 2;
exitCommand = new Command("Exit", 7, 1);
playCommand = new Command("Play", 1, 1);
quitCommand = new Command("Quit", 1, 1);
againCommand = new Command("Again", 1, 1);
nullCommand = new Command("", 1, 1);
try
alienimg[0] = Image.createImage("/alien1.png");
alienimg[1] = Image.createImage("/alien2.png");
explosionimg[0] = Image.createImage("/explosion1.png");
explosionimg[1] = Image.createImage("/explosion2.png");
explosionimg[2] = Image.createImage("/explosion3.png");
playerimg = Image.createImage("/player.png");
logoimg = Image.createImage("/logo.png");
catch(IOException ioexception)
db("Couldn't get images!");
imgW = alienimg[0].getWidth();
imgH = alienimg[0].getHeight();
edgeH = imgW / 2;
edgeV = imgH / 2;
pimgW = playerimg.getWidth();
pimgH = playerimg.getHeight();
pedgeH = pimgW / 2;
pedgeV = pimgH / 2;
highscore = getHighScores();
public void run()
while(runner)
rp();
updatePos();
try
MobileGalaga _tmp = this;
Thread.sleep(75L);
catch(InterruptedException interruptedexception)
db("interrupted");
runner = false;
MobileGalaga _tmp1 = this;
Thread.yield();
public void startApp()
throws MIDletStateChangeException
display.setCurrent(titlescreen);
addBeginCommands(titlescreen, false);
addBeginCommands(scorescreen, false);
addPlayCommands(mainscreen, false);
public void pauseApp()
public void destroyApp(boolean flag)
runner = false;
th = null;
private void rp()
mainscreen.repaint();
private void startGame()
initGame();
if(th == null)
th = new Thread(this);
runner = true;
th.start();
private void initGame()
px = CENTERW;
py = HEIGHT - pedgeV - pimgH;
packcount = 0;
lives = 3;
score = 0;
scorestr = "000000";
rank = -1;
difficulty = 400;
wave = 1;
initWave();
private void initWave()
for(int i = 0; i < slen; i++)
frame[i] = i % 2;
x[i] = packX[i] = sposX[i];
y[i] = packY[i] = sposY[i];
dx[i] = packdx = alien_dx_right;
dy[i] = packdy = alien_dy_right;
dxcount[i] = dycount[i] = 0;
pmode[i] = 0;
flying[i] = false;
dead[i] = false;
playerLeft = false;
playerRight = false;
laser = false;
playerdead = false;
showscores = false;
showmessage = false;
gameover = false;
wavecomplete = false;
playerpause = 0;
messagepause = 0;
killed = 0;
private void updatePos()
if(playerLeft)
updatePlayerPos(-2);
else
if(playerRight)
updatePlayerPos(2);
fly = Math.abs(rand.nextInt() % difficulty);
if(fly < slen && !flying[fly] && !dead[fly])
if(x[fly] < CENTERW)
setDX(fly, alien_dx_flyright, 2);
setDY(fly, alien_dy_flyright, 2);
} else
setDX(fly, alien_dx_flyleft, 2);
setDY(fly, alien_dy_flyleft, 2);
flying[fly] = true;
for(int i = 0; i < slen; i++)
if(!dead[i])
if(!flying[i])
if(x[i] + edgeH + dx[i][dxcount[i]] > WIDTH)
changePackDir(alien_dx_left, alien_dy_left);
if((x[i] - edgeH) + dx[i][dxcount[i]] < 0)
changePackDir(alien_dx_right, alien_dy_right);
} else
if(y[i] + edgeV + dy[i][dycount[i]] > HEIGHT)
x[i] = packX[i];
y[i] = packY[i];
flying[i] = false;
setDX(i, packdx, 0);
setDY(i, packdy, 0);
if(!playerdead && y[i] <= py + pedgeV && y[i] >= py - pedgeV && x[i] <= px + pedgeH && x[i] >= px - pedgeH)
playerHit();
if(laser && lasery <= y[i] + edgeV && lasery >= y[i] - edgeV && laserx <= x[i] + edgeH && laserx >= x[i] - edgeH)
alienHit(i);
for(int j = 0; j < slen; j++)
if(!dead[j])
if(framecount == 3)
frame[j] = frame[j] + 1 < 2 ? 1 : 0;
lastx = x[j];
lasty = y[j];
x[j] += dx[j][dxcount[j]];
y[j] += dy[j][dycount[j]];
if(pmode[j] == 0)
dxcount[j] = dxcount[j] + 1 < dx[j].length ? dxcount[j] + 1 : 0;
dycount[j] = dycount[j] + 1 < dy[j].length ? dycount[j] + 1 : 0;
} else
if(pmode[j] == 2)
dxcount[j] = dxcount[j] + 1 < dx[j].length ? dxcount[j] + 1 : dxcount[j];
dycount[j] = dycount[j] + 1 < dy[j].length ? dycount[j] + 1 : dycount[j];
packX[j] += packdx[packcount];
packY[j] += packdy[packcount];
packcount = packcount + 1 < packlen ? packcount + 1 : 0;
framecount = framecount + 1 < 4 ? framecount + 1 : 0;
if(laser)
lasery -= 6;
if(lasery < 0)
laser = false;
private void setDX(int i, int ai[], int j)
if(i == -1)
for(int k = 0; k < slen; k++)
if(!flying[k])
dx[k] = ai;
dxcount[k] = 0;
pmode[k] = j;
} else
dx[i] = ai;
dxcount[i] = 0;
pmode[i] = j;
private void setDY(int i, int ai[], int j)
if(i == -1)
for(int k = 0; k < slen; k++)
if(!flying[k])
dy[k] = ai;
dycount[k] = 0;
pmode[k] = j;
} else
dy[i] = ai;
dycount[i] = 0;
pmode[i] = j;
private void changePackDir(int ai[], int ai1[])
setDX(-1, ai, 0);
setDY(-1, ai1, 0);
packdx = ai;
packdy = ai1;
packcount = 0;
private void updatePlayerPos(int i)
plastx = px;
px += i;
if(px + pedgeH > WIDTH || px - pedgeH < 0)
px = plastx;
private void fireLaser()
if(!laser)
laser = true;
laserx = px;
lasery = py;
private void alienHit(int i)
if(!playerdead)
dead[i] = true;
laser = false;
killed++;
if(flying[i])
score += 200;
else
score += 50;
if(killed == slen)
waveComplete();
scorestr = getScoreStr(score);
private void playerHit()
playerdead = true;
playerpause = 0;
explodeframe = 0;
lives--;
if(lives == 0)
gameOver();
private void waveComplete()
wavecomplete = true;
difficulty -= 100;
if(difficulty < 100)
difficulty = 100;
msg = "WAVE " + wave + " COMPLETE";
messagepause = 0;
showmessage = true;
wave++;
score += 1000 * wave;
scorestr = getScoreStr(score);
private void gameOver()
gameover = true;
msg = "GAME OVER";
for(int i = 0; i < 5; i++)
if(score < highscore[i])
continue;
for(int j = 4; j > i; j--)
highscore[j] = highscore[j - 1];
highscore[i] = score;
rank = i;
break;
setHighScores();
showmessage = true;
messagepause = 0;
addEndCommands(mainscreen, true);
private void addBeginCommands(Displayable displayable, boolean flag)
if(flag)
removeCommands();
displayable.addCommand(playCommand);
displayable.addCommand(exitCommand);
displayable.setCommandListener(this);
private void addPlayCommands(Displayable displayable, boolean flag)
if(flag)
removeCommands();
displayable.addCommand(nullCommand);
displayable.addCommand(quitCommand);
displayable.setCommandListener(this);
private void addEndCommands(Displayable displayable, boolean flag)
if(flag)
removeCommands();
displayable.addCommand(againCommand);
displayable.addCommand(quitCommand);
displayable.setCommandListener(this);
private void removeCommands()
Displayable displayable = display.getCurrent();
displayable.removeCommand(nullCommand);
displayable.removeCommand(quitCommand);
displayable.removeCommand(againCommand);
displayable.removeCommand(playCommand);
displayable.removeCommand(exitCommand);
public void commandAction(Command command, Displayable displayable)
if(command == playCommand)
display.setCurrent(mainscreen);
startGame();
if(command == quitCommand)
runner = false;
while(th.isAlive()) ;
th = null;
addPlayCommands(mainscreen, true);
display.setCurrent(titlescreen);
if(command == againCommand)
runner = false;
while(th.isAlive()) ;
th = null;
display.setCurrent(mainscreen);
addPlayCommands(mainscreen, true);
startGame();
if(command == exitCommand)
destroyApp(false);
notifyDestroyed();
private int[] getHighScores()
int ai[] = new int[5];
ai[0] = 5000;
ai[1] = 4000;
ai[2] = 3000;
ai[3] = 2000;
ai[4] = 1000;
byte abyte0[][] = new byte[5][6];
try
hsdata = RecordStore.openRecordStore("MobileGalaga", true);
int i = hsdata.getNumRecords();
if(i == 0)
for(int j = 0; j < 5; j++)
abyte0[j] = Integer.toString(ai[j]).getBytes();
hsdata.addRecord(abyte0[j], 0, abyte0[j].length);
} else
for(int k = 0; k < 5; k++)
abyte0[k] = hsdata.getRecord(k + 1);
String s = "";
for(int l = 0; l < abyte0[k].length; l++)
s = s + (char)abyte0[k][l] + "";
ai[k] = Integer.parseInt(s);
catch(RecordStoreException recordstoreexception)
db("problem with initialising highscore data\n" + recordstoreexception);
return ai;
private void setHighScores()
byte abyte0[][] = new byte[5][6];
try
hsdata = RecordStore.openRecordStore("MobileGalaga", true);
for(int i = 0; i < 5; i++)
abyte0[i] = Integer.toString(highscore[i]).getBytes();
hsdata.setRecord(i + 1, abyte0[i], 0, abyte0[i].length);
catch(RecordStoreException recordstoreexception)
db("problem with setting highscore data\n" + recordstoreexception);
private String getScoreStr(int i)
templen = 6 - (i + "").length();
tempstr = "";
for(int j = 0; j < templen; j++)
tempstr = tempstr + "0";
return tempstr + i;
public static void db(String s)
System.out.println(s);
public static void db(int i)
System.out.println(i + "");
private Display display;
private Command exitCommand;
private Command playCommand;
private Command quitCommand;
private Command againCommand;
private Command nullCommand;
private MainScreen mainscreen;
private TitleScreen titlescreen;
private ScoreScreen scorescreen;
private static int WIDTH;
private static int HEIGHT;
private static int CENTERW;
private static int CENTERH;
private boolean runner;
private Thread th;
private Random rand;
private static final int RED = 0xff0000;
private static final int ORANGE = 0xff9100;
private static final int YELLOW = 0xffff00;
private static final int WHITE = 0xffffff;
private static final int BLACK = 0;
private static final int BLUE = 0x160291;
private static Image alienimg[] = new Image[2];
private static Image explosionimg[] = new Image[3];
private static Image playerimg;
private static Image logoimg;
private static int imgH;
private static int imgW;
private static int pimgH;
private static int pimgW;
private static int edgeH;
private static int edgeV;
private static int pedgeH;
private static int pedgeV;
private static final Font fs = Font.getFont(64, 0, 8);
private static final Font fl = Font.getFont(64, 1, 16);
private static final int sposX[] = {
16, 28, 40, 52, 4, 16, 28, 40, 52, 64,
4, 16, 28, 40, 52, 64
private static final int sposY[] = {
14, 14, 14, 14, 26, 26, 26, 26, 26, 26,
38, 38, 38, 38, 38, 38
private static final int LOOP = 0;
private static final int ONCE = 1;
private static final int HOLD = 2;
private static final int move_none[] = {
0
private static final int alien_dx_right[] = {
1, 1, 1, 1, 1, 1, 1, 1
private static final int alien_dy_right[] = {
0, 0, 1, 1, 0, 0, -1, -1
private static final int alien_dx_left[] = {
-1, -1, -1, -1, -1, -1, -1, -1
private static final int alien_dy_left[] = {
0, 0, -1, -1, 0, 0, 1, 1
private static final int alien_dx_flyright[] = {
1, 1, 1, 0, -1, -1, -1, -1, -1, 0,
1, 1, 2, 3, 4, 5, 6
private static final int alien_dy_flyright[] = {
0, -1, -1, -1, -1, -1, 0, 1, 1, 1,
1, 1, 2, 3, 4, 5, 6
private static final int alien_dx_flyleft[] = {
-1, -1, -1, 0, 1, 1, 1, 1, 1, 0,
-1, -1, -2, -3, -4, -5, -6
private static final int alien_dy_flyleft[] = {
0, -1, -1, -1, -1, -1, 0, 1, 1, 1,
1, 1, 2, 3, 4, 5, 6
private static final int slen;
private static final int ailen;
private static final int packlen;
private static int pmode[];
private static int x[];
private static int y[];
private static int dx[][];
private static int dy[][];
private static int dxcount[];
private static int dycount[];
private static int frame[];
private static boolean flying[];
private static boolean dead[];
private static boolean exploding[];
private static int lastx;
private static int lasty;
private static int fly;
private static int packX[];
private static int packY[];
private static int packdx[];
private static int packdy[];
private static int packcount;
private static int framecount = 3;
private static int px;
private static int py;
private static int plastx;
private static int score;
private static String scorestr;
private static int lives;
private static int killed;
private static boolean playerdead;
private static int explodeframe;
private static int playerpause;
private static int rank;
private static boolean playerLeft;
private static boolean playerRight;
private static boolean laser;
private static int laserx;
private static int lasery;
private static RecordStore hsdata;
private static int highscore[] = new int[5];
private static boolean showmessage;
private static boolean showscores;
private static boolean gameover;
private static boolean wavecomplete;
private static int messagepause;
private static String msg;
private static int difficulty;
private static int wave;
private static String tempstr;
private static int templen;
static
slen = sposX.length;
ailen = alien_dx_flyright.length;
packlen = alien_dx_right.length;
pmode = new int[slen];
x = new int[slen];
y = new int[slen];
dx = new int[slen][ailen];
dy = new int[slen][ailen];
dxcount = new int[slen];
dycount = new int[slen];
frame = new int[slen];
flying = new boolean[slen];
dead = new boolean[slen];
exploding = new boolean[slen];
packX = new int[slen];
packY = new int[slen];
packdx = new int[packlen];
packdy = new int[packlen];
----END OF CODE ----------------hi sorry if it's too big! i hope i can explain this very well (you know i only got this code in the net), if you try to run the program in emulator, the and lunch it will it will first display the title screen and if you hit the pressed key 5 it will display help,
so my problem is how to move UP and DOWN and also if i pressed the fire button it will continue to fire. here is the code.
//Code for the Left,Right,UP and Down movement and also the fire
public void keyPressed(int i)
int j = getGameAction(i);
if(j == 2)
MobileGalaga.playerLeft = true; //this is ok
else
if(j == 5)
MobileGalaga.playerRight = true; //this is ok
else
if(j==1)
MobileGalaga.playerUp = true; //i add this only, this has a problem
else
if(j==6)
MobileGalaga.playerDown = true; //i add this only, this has a problem
else
if(j == 8)
fireLaser(); //for the release of fire
//for the release of key pressed
public void keyReleased(int i)
int j = getGameAction(i);
if(j == 2)
MobileGalaga.playerLeft = false;
else
if(j == 5)
MobileGalaga.playerRight = false;
//Update the position base on key pressed
private void updatePos()
if(playerLeft)
updatePlayerPos(-5);
else
if(playerUp)
updatePlayerPos1(-4);
else
if(playerDown)
updatePlayerPos1(4);
else
if(playerRight)
updatePlayerPos(5);
fly = Math.abs(rand.nextInt() % difficulty);
if(fly < slen && !flying[fly] && !dead[fly])
if(x[fly] < CENTERW)
setDX(fly, alien_dx_flyright, 2);
setDY(fly, alien_dy_flyright, 2);
} else
setDX(fly, alien_dx_flyleft, 2);
setDY(fly, alien_dy_flyleft, 2);
flying[fly] = true;
for(int i = 0; i < slen; i++)
if(!dead)
if(!flying[i])
if(x[i] + edgeH + dx[i][dxcount[i]] > WIDTH)
changePackDir(alien_dx_left, alien_dy_left);
if((x[i] - edgeH) + dx[i][dxcount[i]] < 0)
changePackDir(alien_dx_right, alien_dy_right);
} else
if(y[i] + edgeV + dy[i][dycount[i]] > HEIGHT)
x[i] = packX[i];
y[i] = packY[i];
flying[i] = false;
setDX(i, packdx, 0);
setDY(i, packdy, 0);
if(!playerdead && y[i] <= py + pedgeV && y[i] >= py - pedgeV && x[i] <= px + pedgeH && x[i] >= px - pedgeH)
playerHit();
if(laser && lasery <= y[i] + edgeV && lasery >= y[i] - edgeV && laserx <= x[i] + edgeH && laserx >= x[i] - edgeH)
alienHit(i);
for(int j = 0; j < slen; j++)
if(!dead[j])
if(framecount == 3)
frame[j] = frame[j] + 1 < 2 ? 1 : 0;
lastx = x[j];
lasty = y[j];
x[j] += dx[j][dxcount[j]];
y[j] += dy[j][dycount[j]];
if(pmode[j] == 0)
dxcount[j] = dxcount[j] + 1 < dx[j].length ? dxcount[j] + 1 : 0;
dycount[j] = dycount[j] + 1 < dy[j].length ? dycount[j] + 1 : 0;
} else
if(pmode[j] == 2)
dxcount[j] = dxcount[j] + 1 < dx[j].length ? dxcount[j] + 1 : dxcount[j];
dycount[j] = dycount[j] + 1 < dy[j].length ? dycount[j] + 1 : dycount[j];
packX[j] += packdx[packcount];
packY[j] += packdy[packcount];
packcount = packcount + 1 < packlen ? packcount + 1 : 0;
framecount = framecount + 1 < 4 ? framecount + 1 : 0;
if(laser)
lasery -= 6;
if(lasery < 0 )
laser = false;
// this will move the object UP,DOWN,Left and Right
private void updatePlayerPos(int i)
plastx = px;
px += i;
if(px + pedgeH > WIDTH || px - pedgeH < 0)
px = plastx;
private void updatePlayerPos1(int i)
plastx = py;
py += i;
if(px + pedgeV > HEIGHT || px - pedgeV < 0)
px = plastx;
// This will fire, if you hit the fire button
private void fireLaser()
if(!laser)
laser = true;
laserx = px;
lasery = py;
sorry if it's too long i just want too explain this. if anyone like to see this and run so that you can see it also, i can send an email.
thanks,
alek -
Used createinstallmedis to make a copy of the Mavericks app for use in a new hard drive install.. Copied find but gave error code 110 and failed to make the flash drive bootable.. Any help in what errror code means?
Did you partition and format the flash drive first? See the following:
Make Your Own Mavericks, Mountain/Lion Installer
After downloading the installer you must first save the Install Mac OS X application. After the installer downloads DO NOT click on the Install button. Go to your Applications folder and make a copy of the installer. Move the copy into your Downloads folder. Now you can click on the Install button. You must do this because the installer deletes itself automatically when it finishes installing.
2. Get a USB flash drive that is at least 8 GBs. Prep this flash drive as follows:
Open Disk Utility in your Utilities folder.
After DU loads select your flash drive (this is the entry with the mfgr.'s ID and size) from the leftside list. Under the Volume Scheme heading set the number of partitions from the drop down menu to one. Set the format type to Mac OS Extended (Journaled.) Click on the Options button, set the partition scheme to GUID then click on the OK button. Click on the Partition button and wait until the process has completed.
Select the volume you just created (this is the sub-entry under the drive entry) from the left side list.
Click on the Erase tab in the DU main window.
Set the format type to Mac OS Extended (Journaled.) Click on the Options button, check the button for Zero Data and click on OK to return to the Erase window.
Click on the Erase button. The format process can take up to an hour depending upon the flash drive size.
Make your own Mavericks flash drive installer using the Mavericks tool:
Mavericks has its own built-in installer maker you use via the Terminal:
You will need a freshly partitioned and formatted USB flash drive with at least 8GBs. Leave the name of the flash drive at the system default, "Untitled." Do not change this name. Open the Terminal in the Utilities folder. Copy this command line after the prompt in the Terminal's window:
sudo /Applications/Install\ OS\ X\ Mavericks.app/Contents/Resources/createinstallmedia --volume /Volumes/Untitled --applicationpath /Applications/Install\ OS\ X\ Mavericks.app --nointeraction
Press RETURN. Enter your admin password when prompted. It will not be echoed to the screen so be careful to enter it correctly. Press RETURN, again.
Wait for the process to complete which will take quite some time. -
Hi all,
I need help in acquiring this
I have a table control,in which i have 3 columns out of which 2 are input/outfields and one is output field.
say i have fld1 fld2 fld3
i entera value for fld1 and fld2 then it bring value in fld3.
but sometimes i.e certain values of fld1 the fld2 should be NA and the fld3 should open up for input.
say fld1 = def is exception
first i enter
fld1 = abc and fld2 =aaa then it brings fld3 =bbb
next i enter
fld1 = def and hit enter then fld2 = NA and fld3 should be available for input.
I have the following code written for this
CONTROLS: TABLECONTROL TYPE TABLEVIEW USING SCREEN 9002.
DATA W_TABLECONTROL LIKE LINE OF TABLECONTROL-COLS.
ITAB IS MY TABLE CONTROL INTERNAL TABLE I.E MY TABLE CONTROL FIELDS ARE ITAB-FLD1,ITAB-FLD2,ITAB-FLD3.
loop at TABLECONTROL-cols into w_TABLECONTROL.
IF w_cTABLECONTROL-screen-group4 = 'NAM'.
loop at iTAB.
IF ITAB-FLD1 EQ 'DEF'.
w_TABLECONTROL-SCREEN-INPUT = '1'.
else.
w_TABLECONTROL-SCREEN-INPUT = '0'.
ENDIF.
modify TABLECONTROL-cols from w_TABLECONTROL.
ENDLOOP.
ENDIF.
ENDLOOP.
WHAT I SEE NOW WITH THIS CODE IS WHEN I ENTER THE FIRST RECORD IN
ITAB-FLD1 AS DEF AND HIT ENTER THE FLD2 IS NA AND FLD3 IS READY FOR OUTPUT
NOW THE SECOND ROW FLD3 IS AVAILABLE FOR INPUT WHICH I DON'T WANT BECAUSE MY FLD1 OF SECOND IS NOT YET KNOW AGAIN IFITS DEF THEN IT SHOULD BE AVAILABLE FOR INPUT OTHERWISE IT SHOULD GREY OUT.
HELP ME IN ACHEIVING THIS.
THANKSHi,
Have this code inside the LOOP AT ...ENDLOOP of the PBO..
PROCESS BEFORE OUTPUT.
LOOP AT ITAB INTO WA..
<b>MODULE UPDATE_DATA..</b>
ENDLOOP.
MODULE UPDATE_DATA.
LOOP AT SCREEN.
IF WA-FIELD1 = 'DEF'.
Add the group for the field3 in the attributes..
IF SCREEN-GROUP1 = 'G1'.
Enable for input...
SCREEN-INPUT = '1'.
MODIFY SCREEN.
ENDIF.
ELSE.
IF SCREEN-GROUP1 = 'G1'.
disable for input for other values.
SCREEN-INPUT = '0'.
MODIFY SCREEN.
ENDIF.
ENDIF.
ENDLOOP.
ENDLOOP.
Thanks,
Naren -
Urgent Help Needed in this Report
hi frd. help me in this report.
parameter : plant,material no,company code,storage location.
display: material no, material desc, UOM, ROL, warehouse, open po, open po qty, open pr no, open pr qty.
Kindly Give me tips for doing this report.
thank u
Pari Vendhan.RHi Pari,
Go to se38 --Abap editior..
chose the includes u like to be as
Include <>_top.
Include <>_subr.
then follow the events....
Initialization.
( as per requirement).
At selection-screen.
Perform fetch _data.
Perform fefilloutput.
any other logic to be followed for u r report.
end-of-selection.
Perform output.
In include top.
Put the declarartion part and the selection-screen block.
SELECTION SCREEN
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
PARAMETERS : pa_werks LIKE table name-werks
pa_material no like tablename-field.
SELECTION-SCREEN END OF BLOCK b1.
like wise u need to put the logic for the requirement
Thanks
Mohinder Singh Chauhan -
Help Needed with HTML code for Image Positioning
Hi All,
Need a little help with some code for positioning images.
I initially used the following:
This is fine, but the border automatically puts a black border around the photo - how do I change it to white? Is there a way to set margins too, to prevent the text butting up against the photo?
I also used the following code with success:
<style type="text/css"
img
float:right;
border:2px solid white;
margin: 0px 0px 15px 20px
</style>
This code works, however the problem with it is it is not individual to just one photo - it moved all my photos and on that page, I wanted one photo floated to left and another to the right.
If I use this code, how can I make it photo specific, so that it only affects the placement, margins and borders of one photo?
Any help would be great.
ThanksCSS question, not iWeb question. Regardless, use inline CSS styling for the image. You can also wrap the image in its own tag and declare an id or simply declare an id for the img tag, then set the style for the id_name:
<style type="text/css"
img#id_name
float:right;
border:2px solid white;
margin: 0px 0px 15px 20px
</style>
If you want to control the style of more than one image on a page but not all then use a class instead of an id.
the border automatically puts a black border around the photo - how do I change it to white? Is there a way to set margins too, to prevent the text butting up against the photo?
I believe you have discovered a solution for this according to your CSS code. You have set the border to white by looking at the code and adjusting it appropriately. Your margin is declared in the CSS also, adjust the pixels appropriately.
Read up some more on CSS to educate yourself further. I suggest w3schools.com or a CSS forum instead of the iWeb forum if you have CSS questions. It's kind of like if you drive your auto to the supermarket so you decide to go to the supermarket and ask everyone in the produce section to help when you have car problems. All the supermarket does is provide a place to park your auto. If you have car problems then ask a mechanic. iWeb (and most of its users) doesn't specialize in code, it simply provides an area for you to place it. Granted you might get lucky and find a mechanic in the produce section of the supermarket, but you're more likely to find a specialist at an auto swap meet (or CSS coding forum)! -
Help me with this code..
need help with this code... i am new to java programming.. and having difficulties with the code below...
import java.awt.*;
import javax.swing.*;
import java.net.*;
public class DisplayImage extends JApplet
public void init()
int[] imageData = {0x47,0x49,0x46,0x38,0x39,0x61,0x38,0x00,0x12,0x00,0xF3,0x00,0x00,0xFB,0x0B,0x0E,0xFF,0x24,0x00,0xFF,0x3C,0x00,0xFF,0xFF,0xFF,0xFF,0x00,0x7B,0xFF,0x00,0x1E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x2C,0x00,0x00,0x00,0x00,0x38,0x00,0x12,0x00,0x00,0x04,0x68,0x10,0xC8,0x49,0xAB,0xBD,0x38,0xEB,0xCD,0xBB,0x0E,0x5E,0x26,0x84,0x64,0x69,0x9E,0xE6,0xA0,0x0E,0xD5,0xEA,0x4E,0xEE,0x4A,0xBD,0xA8,0x2A,0xD9,0x30,0xCB,0xE1,0x00,0xCE,0x93,0xBC,0x9F,0x6E,0x13,0x1C,0xF6,0x8C,0xA7,0x62,0x47,0x99,0x43,0xDD,0x8C,0x31,0x64,0x73,0xFA,0xAC,0xC9,0xA8,0x3F,0xEA,0x71,0x26,0x2D,0x65,0xB9,0x96,0xAC,0xEF,0x9B,0xEA,0x6E,0x5B,0xD2,0xA8,0x53,0x0B,0x6E,0x67,0xC8,0x44,0xA8,0x4E,0x88,0x14,0xCB,0x93,0xF3,0xFB,0xD9,0x3D,0x85,0x2F,0xAF,0x5C,0x64,0x82,0x80,0x6B,0x16,0x04,0x85,0x88,0x6B,0x05,0x89,0x12,0x11,0x00,0x3B};
ImageIcon icon = null;
try
icon = ImageIcon(ImageDate[]);
catch(IOException e)
System.out.println("Failed to create URL:\n" + e);
return;
loadImage(image);
int imageWidth = icon.getIconWidth(); // Get icon width
int imageHeight = icon.getIconHeight(); // and its height
resize(imageWidth,imageHeight); // Set applet size to fit the image
//Create panel a showing the image
ImagePanel imagePanel = new ImagePanel(icon.getImage());
getContentPane().add(imagePanel); // Add the panel to the content pane
// Class representing a panel displaying an image
class ImagePanel extends JPanel
public ImagePanel(Image image)
this.image = image;
public void paint(Graphics g)
g.drawImage(image, 0, 0, this); // Display the image
Image image; // The image
}Thanks in advance...
Uzairyeah true.... its not that i need someone to write the code.. just cos this code is giving me some problems thought i could get code from others...
i noticed the extra bracket ending the init().. but thats not what i have problem with....
It is with how to use ImageIcon(byte[])
it is something that i need to use this thing in particular... as i am asked to do.... -
Can anybody help me with this code?
I am a beginner to J2ME. The following is a small program I wrote just for test.
Theoretically, in my opinion, I shall see in the screen a number increase from 1 to 29999 rapidly after execute the code. But instead, it displays nothing but only displays 29999 after several seconds . Can some body point out what's wrong with this code? Thanks.
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
public class Test extends MIDlet{
int x=1;
String b="";
private Display display;
public Test() {
display = Display.getDisplay(this);
public void startApp() {
MyCanvas mc = new MyCanvas() ;
display.setCurrent(mc) ;
while(x<30000){
b=String.valueOf(x);
mc.repaint();
x++;
public void pauseApp() {
public void destroyApp(boolean unconditional) {
class MyCanvas extends Canvas{
public void paint(Graphics g){
g.drawString(b,10,10,0);thanks, I have already got the answer. you are right, if repaint in a high speed the screen will show nothing. here is the code for it, thanks the expert of nokia forum.
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
//Counter
//Need to know when a number has been painted and need to wait a for a fraction of a sec before
//painting the next number. This wait also allows other events like "Exit" to be processed
//Use double buffering to avoid flicker
//Paint in a different thread to keep the UI responsive
public class MyMIDlet extends MIDlet{
int x=1;
String b="";
private Display display;
Thread t = null;
MyCanvas mc = null;
public MyMIDlet() {
display = Display.getDisplay(this);
public void startApp() {
mc = new MyCanvas();
t = new Thread(mc) ;
display.setCurrent(mc) ;
b=String.valueOf(x);
t.start();
public void callbackPaintDone(){
try{
//provides the delay between every repaint and also time to react to Exit
synchronized(this){
wait(1);
}catch(Exception e){}
paintNextNumber();
private void paintNextNumber(){
if(x<30000){
x++;
b=String.valueOf(x);
mc.doPaint = true; //signals that next number can be painted
public void pauseApp() {
public void destroyApp(boolean unconditional) {
class MyCanvas extends Canvas implements Runnable{
Image buf = null;
Graphics bg = null;
public boolean doPaint = true;
public MyCanvas(){
buf = Image.createImage(getWidth(),getHeight());
bg = buf.getGraphics();
public void paint(Graphics g){
bg.setColor(255,255,255);
bg.fillRect(0,0,getWidth(),getHeight());
bg.setColor(0);
bg.drawString(b,10,10,0);
g.drawImage(buf,10,10,Graphics.TOP|Graphics.LEFT);
// Callback for next number to be painted
MyMIDlet.this.callbackPaintDone();
public void run(){
while(true){
if(doPaint){ //only paints when a number has been painted, and next one is ready to be painted
doPaint = false;
repaint();
serviceRepaints(); -
import java.util.Date;
import java.net.*;
public class DateTest{
public static void main(String arr[]){
try{
URL url = new URL("http://www.google.com");
HttpURLConnection url1 = (HttpURLConnection)url.openConnection();
// System.out.println(url1.getExpiration());
System.out.println((new Date(url1.getExpiration())).toString());
catch(Exception e){
System.out.println(e);
IS MY EXPIRATION DATE LOGICALLY A CORRECT ONE im a beginner help me in this codehere's the output of your code:
dt: Wed Jun 08 10:47:12 CST 2005
Thu Jan 01 08:00:00 CST 1970
the first line is the sysdate of my pc
and the second line is the date of the expiration date
as you can see it isn't correct to be expired at that time because the web or url isn't well established at that time -
Help on upgrading this code to Java 5
Hi guys,
I was trying to upgrading the following code to comply with Java 5 using generics, but I failed. Hope somebody here can help me out of this.
This is the original code:
import java.util.*;
public class TestJava5{
public static void main(String [] args){
TestJava5 t = new TestJava5();
Collection strs = t.getAll(String.class);
for(Iterator i = strs.iterator(); i.hasNext();){
System.out.println(i.next());
private Collection getAll(Class c){
Collection rs = new ArrayList ();
if(String.class.equals(c)){
rs.add("str1");
rs.add("str2");
}else if(StringBuffer.class.equals(c)){
rs.add(new StringBuffer("buffer1"));
rs.add(new StringBuffer("buffer2"));
return rs;
}and this is the code I tried to use generics, but obviously, I cannot add a String or StringBuffer into a Collection<T>.
import java.util.*;
public class TestJava5{
public static void main(String [] args){
TestJava5 t = new TestJava5();
Collection<String> strs = t.getAll(String.class);
for(String str:strs){
System.out.println(str);
private <T> Collection<T> getAll(Class<T> c){
Collection<T> rs = new ArrayList<T>();
if(String.class.equals(c)){
rs.add("str1");
rs.add("str2");
}else if(URI.class.equals(c)){
rs.add(new StringBuffer("buffer1"));
rs.add(new StringBuffer("buffer2"));
return rs;
}Actually, now I've looked at it, it's even worse than that!
You create a collection with type T, but this type is not fixed at compile type (by definition, obviously). So when you come to add something to the collection (either a String or a StringBuffer), the compiler cannot guarantee that your collection is of the correct type.
This code is really on a hiding to nothing, I would suggest. But... the following should relieve your immediate compilation problems. However, it is likely to cause further problems when trying to use the returned collection:
private <T> Collection<?> getAll2(Class<T> c) {
if (String.class.equals(c)) {
Collection<String> rs = new ArrayList<String>();
rs.add("str1");
rs.add("str2");
return rs;
} else if (URI.class.equals(c)) {
Collection<StringBuffer> rs = new ArrayList<StringBuffer>();
rs.add(new StringBuffer("buffer1"));
rs.add(new StringBuffer("buffer2"));
return rs;
} else {
return null; // or something else like new ArrayList<Object>()
} -
Hi all,
In the below code, if condition is failing. what might be the reason.......??
String mAmtBaseStr = "-00000000000200.00";
if (mAmtBaseStr.substring(0).equals("-"))
//strip "-" from first char
int len1 = mAmtBaseStr.length();
mAmtBaseStr = mAmtBaseStr.substring((1 - 0),len1);
//put the stripped "-" at last
mAmtBaseStr = mAmtBaseStr + "-";
I tried other options like,
if (mAmtBaseStr.substring(0,1).equals("-")) etc etc......Hi,
This code fails because of this reason
_problem1 _
String mAmtBaseStr = "-00000000000200.00";
mAmtBaseStr.substring(0)-------> -00000000000200.00 [as substring(0) returns entire string starting from index zero.]
when you are writing
if (mAmtBaseStr.substring(0).equals("-"))
You are tryring to check if the value mAmtBaseStr.substring(0) [ "-00000000000200.00"] is equal to string "-" or not.
As you can see the strings are not equal the if condition never returns you true value.
_Problem2_
you are nowhere checking whether the inbound string is null or empty. In case the string comes as null or empty java will throw an exception and your mapping will fail. So if input string does not begin with an hyphen you need to pass it as it is
Thus I would modify your code a little bit to make it work
public static String removeHyphen(String mAmtBaseStr)
if (mAmtBaseStr!=null && mAmtBaseStr!="" && mAmtBaseStr.substring(0,1).equals("-"))
//strip "-" from first char
int len1 = mAmtBaseStr.length();
mAmtBaseStr = mAmtBaseStr.substring((1 - 0),len1);
//put the stripped "-" at last
mAmtBaseStr = mAmtBaseStr + "-";
return mAmtBaseStr;
This code works and produces required output
input: -00000000000200.00
output: 00000000000200.00-
Regards
Anupam -
Any one can help me from this code?
can someone tell me what the code DBUtil.getMarks(msg),DBUtil.setIndex(pn,rsp)
may do on the code below that i've downloaded this files from [http://sourceforge.net/projects/asimplesmssende/files/|http://sourceforge.net/projects/asimplesmssende/files/] I cant see any DBUtil.java or DBUtil method on the source codes I want to fixed this code coz it has a error because of DBUtil coz i want to create my own codes like this
import org.soham.sms.*;
import java.util.*;
class Q extends SMSUtil
Q() throws Exception{
super("Com16");
public void processSMS(String pn,String msg) throws Exception
String rsp=DBUtil.getMarks(msg);
this.sendSMS(pn,rsp);
DBUtil.setIndex(pn,rsp);
public int getCurrentMsgIndex() throws Exception{
return DBUtil.getIndex();
public static void main(String[] args) throws Exception{
SMSUtil util=new Q();
//util.sendSMS("9830740684","Shubho Maha Shashthi Baba...Babun");
ArrayList al=new ArrayList();
util.startReceive(al,1000);
Thread.sleep(60000);
/*util.stopReceivingSMS();
int s=al.size();
for(int i=0;i<s;i++){
String x=((String[])al.get(i))[0];
String m=((String[])al.get(i))[1];
System.out.println(x+" ***** "+m);
}advance thanks ^^Download the DBUtil class from that site as well, then, as that is, seemingly, another "self-written" class. You seemingly need to find a better site from which to plagarise your assignments, it seems.
Maybe you are looking for
-
Today i want to purchace Ipad mini for gift, but i saw no option for engraving in uae on ine store thanks shinoy
-
OK, am a bit confused about what has happened, and not sure if this is a recognised problem or not. I have an iMac running leopard with iPhoto '08. I bought a MacBook Pro running snow leopard with iPhoto '09. I shared some of the photo library onto t
-
Mail photo attachment changes format after being sent?
When I take a photo using the iPad camera and send it as an attachment in mail, how can I ensure the photo will maintain the same format after sending it, as it did when I took the photo? Recipients of my email with a portrait photo attachment, will
-
i am trying to make a remote file browser in j2me. it will be done by internet/http connection. By this, i want to browse remote files from my mobile. if anybody can give me the source code or do any kind of help, i will remain thankful... Edited by:
-
I just bought a new hard drive to replace my exhausted 12G HD in my G3 iMac DV graphite. I started up using the original OS 9 disc and the HD was not recognized. I loaded OS9 onto the new HD via fire wire from my G5 successfully, still no joy. So her