Need help with Sound Methods
Hi, I am new to java and need help with sound methods.
q: create a new method that will halve the volume of the positive values and double the volume of the negative values.
Message was edited by:
Apaula30
duplicate message #2
Similar Messages
-
I'm new to Java, trying to pass a required class so I can graduate this semester, and I need help figuring out what is wrong with the code below. My assignment is to create a program to convert celsius to fahrenheit and vice versa using Scanner for input. The program must contain 3 methods - main, convert F to C, method, and convert C to F method. Requirements of the conversion methods are one parameter which is an int representing temp, return an int representing calculated temp after doing appropriate calculation, should not display info to user, and should not take in info from user.
The main method is required to ask the user to input a 1 for converting F to C, 2 for C to F, and 3 to end the program. It must include a while loop that loops until the user enters a 3, ask the user to enter a temp, call the appropriate method to do the conversion, and display the results. I'm having trouble calling the conversion methods and keep getting the following 2 compiler errors:
cannot find symbol
symbol : method farenheitToCelsius(int)
location: class WondaPavoneTempConverter
int celsius = farenheitToCelsius(intTemp);
^
cannot find symbol
symbol : method celsiusToFarenheit(int)
location: class WondaPavoneTempConverter
int farenheit = celsiusToFarenheit(intTemp);
The code is as follows:
public static void main(String[] args) {
// Create a scanner
Scanner scanner = new Scanner(System.in);
// Prompt the user to enter a temperature
System.out.println("Enter the temperature you wish to convert as a whole number: ");
int intTemp = scanner.nextInt();
System.out.println("You entered " + intTemp + " degrees.");
// Prompt the user to enter "1" to convert to Celsius, "2" to convert to
// Farenheit, or "3" to exit the program
System.out.println("Enter 1 to convert to Celsius, 2 to convert to Farenheit, or 3 to exit.");
int intConvert = scanner.nextInt();
// Convert temperature to Celsius or Farenheit
int celsius = farenheitToCelsius(intTemp);
int farenheit = celsiusToFarenheit(intTemp);
while (intConvert >= 0) {
// Convert to Celsius
if (intConvert == 1) {
System.out.println("Celsius is " + celsius + " degrees.");
// Convert to Farenheit
else if (intConvert == 2) {
System.out.println("Farenheit is " + farenheit + " degrees.");
// Exit program
else if (intConvert == 3) {
break;
else {
System.out.println("The number you entered is invalid. Please enter 1, 2, or 3.");
//Method to convert Celsius to Farenheit
public static int celsiusToFahrenheit(int cTemp) {
return (9 / 5) * (cTemp + 32);
//Method to convert Farenheit to Celsius
public static int fahrenheitToCelsius(int fTemp) {
return (5 / 9) * (fTemp - 32);
I readily admit I'm a complete dunce when it comes to programming - digital media is my area of expertise. Can anyone point me in the right direction? This assignment is due very soon. Thanks.1) consider using a boolean variable in the while statement and converting it to true if the input is good.
while (inputNotValid)
}2) put the code to get the input within the while loop. Try your code right now and enter the number 30 when your menu requests for input and you'll see the infinite loop.... and why you need to request input within the loop.
3) Fix your equations. You are gonig to have to do some double calcs, even if you convert it back to int for the method return. Otherwise the results are just plain wrong. As a good test, put in the numbers -40, 0, 32, 100, and 212. Are the results as expected? (-40 is the only temp that is the same for both cent and fahr). I recommend doing double calcs and then casting the result to int in the return. for example:
int a = (int) (20 + 42.0 / 3); // the 42.0 forces the compiler to do double calc.4) One of your equations may still be plain wrong even with this fix. Again, run the test numbers and see.
5) Also, when posting your code, please use code tags so that your code will be well-formatted and readable. To do this, either use the "code" button at the top of the forum Message editor or place the tag [code] at the top of your block of code and the tag [/code] at the bottom, like so:
[code]
// your code block goes here.
[/code] -
Please i need help with sound application! please?
hey there people heres the deal I need to complete this before 5 today but im completely stumped...we have to make a sound file player with a swing interface I have it playing(kind of!) but where now...I would be forever in your debt as my masters degree hangs in the balance! de de duhhhh! cheers
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import java.io.*;
import javax.swing.event.*;
import java.io.File;
import java.io.IOException;
import javax.sound.sampled.*;
import javax.sound.sampled.AudioFormat;
import javax.sound.sampled.AudioInputStream;
import javax.sound.sampled.AudioSystem;
import javax.sound.sampled.Clip;
import javax.sound.sampled.DataLine;
import javax.sound.sampled.LineEvent;
import javax.sound.sampled.LineListener;
import javax.sound.sampled.LineUnavailableException;
public class AudioPlayer extends JFrame implements ActionListener, ChangeListener{
boolean playing;
boolean looping;
String filename = File.separator+"tmp";
File selFile;
Clip clip;
JFileChooser fc = new JFileChooser();
JButton btnOpen = new JButton("Open");
JButton btnPlay = new JButton("Play");
JButton btnStop = new JButton("Stop");
JButton btnPause = new JButton("Pause");
JButton btnLoop = new JButton("Loop");
JSlider volume = new JSlider(SwingConstants.HORIZONTAL,0,100,0);
JSlider panning = new JSlider(SwingConstants.HORIZONTAL,0,100,0);
public AudioPlayer(){
Container contentPane = getContentPane();
contentPane.setLayout(new FlowLayout());
contentPane.add(btnOpen);btnPlay.addActionListener(this);
contentPane.add(btnPlay);btnPlay.addActionListener(this);
contentPane.add(btnStop);btnStop.addActionListener(this);
contentPane.add(btnPause);btnPause.addActionListener(this);
contentPane.add(btnLoop);btnLoop.addActionListener(this);
// Show open dialog; this method does not return until the dialog is closed
fc.showOpenDialog(this);
selFile = fc.getSelectedFile();
volume.addChangeListener(this);
panning.addChangeListener(this);
volume.putClientProperty("JSlider.isFilled", Boolean.TRUE);
volume.setPaintTicks(true);volume.setPaintLabels(true);
volume.setMajorTickSpacing(20);volume.setMinorTickSpacing(10);
contentPane.add(volume);
panning.putClientProperty("JSlider.isFilled", Boolean.TRUE);
panning.setPaintTicks(true);panning.setPaintLabels(true);
panning.setMajorTickSpacing(20);panning.setMinorTickSpacing(10);
contentPane.add(panning);
addWindowListener(
new WindowAdapter () {
public void windowClosing(WindowEvent e){
setVisible(false);
public void actionPerformed(ActionEvent e){
int returnVal = JFileChooser.APPROVE_OPTION;
//Handle open file action.
if (e.getSource() == btnOpen)
System.out.println("FA1");
returnVal = fc.showOpenDialog(AudioPlayer.this);
if (returnVal == JFileChooser.APPROVE_OPTION)
{ selFile = fc.getSelectedFile();
//This is where a real application would open the file.
else
if(e.getSource() == btnPlay)
playAudio();
public void stateChanged(ChangeEvent e)
public static void main(String[] args)
AudioPlayer audioPlayer = new AudioPlayer();
audioPlayer.setSize(400,400);
audioPlayer.show();
public void playAudio ()
playing = true;
AudioInputStream audiosource = null;
try
audiosource = AudioSystem.getAudioInputStream(selFile);
System.out.println("here");
//System.out.println(audiosource.getFormat());
DataLine.Info dataLineInfo = new DataLine.Info(Clip.class,audiosource.getFormat());
clip = (Clip)AudioSystem.getLine(dataLineInfo);
clip.open(audiosource);
catch (UnsupportedAudioFileException e)
catch (LineUnavailableException e)
catch (IOException e)
//catch (Exception e) {}
if (looping)
clip.loop(clip.LOOP_CONTINUOUSLY);
else
clip.loop(0);
playing = false;
}import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import java.io.*;
import javax.swing.event.*;
import javax.sound.sampled.*;
* Description of the Class
*@author rsmazara
*@created 28 February 2003
public class AudioPlayer extends JFrame implements ActionListener, ChangeListener {
File selFile;
JFileChooser fc = new JFileChooser();
JButton btnOpen = new JButton( "Open" );
JButton btnPlay = new JButton( "Play >" );
JButton btnStop = new JButton( "Stop" );
JButton btnPause = new JButton( "Pause ||" );
JCheckBox btnLoop = new JCheckBox( "Loop" );
JSlider volume = new JSlider( SwingConstants.HORIZONTAL, 0, 100, 0 );
JSlider panning = new JSlider( SwingConstants.HORIZONTAL, 0, 100, 0 );
JLabel label = new JLabel( " " );
public AudioPlayer() {
Container contentPane = getContentPane();
contentPane.setLayout( new FlowLayout() );
btnOpen.addActionListener( this );
contentPane.add( btnOpen );
btnPlay.addActionListener( this );
contentPane.add( btnPlay );
btnPlay.addActionListener( this );
contentPane.add( btnStop );
btnStop.addActionListener( this );
contentPane.add( btnPause );
btnPause.addActionListener( this );
contentPane.add( btnLoop );
btnLoop.addActionListener( this );
btnPlay.setEnabled( false );
btnStop.setEnabled( false );
btnPause.setEnabled( false );
// Show open dialog; this method does not return until the dialog is closed
// fc.showOpenDialog( this );
// selFile = fc.getSelectedFile();
volume.addChangeListener( this );
panning.addChangeListener( this );
volume.putClientProperty( "JSlider.isFilled", Boolean.TRUE );
volume.setPaintTicks( true );
volume.setPaintLabels( true );
volume.setMajorTickSpacing( 20 );
volume.setMinorTickSpacing( 10 );
contentPane.add( volume );
panning.putClientProperty( "JSlider.isFilled", Boolean.TRUE );
panning.setPaintTicks( true );
panning.setPaintLabels( true );
panning.setMajorTickSpacing( 20 );
panning.setMinorTickSpacing( 10 );
contentPane.add( panning );
contentPane.add( label );
addWindowListener(
new WindowAdapter() {
public void windowClosing( WindowEvent e ) {
setVisible( false );
System.exit( -100 );
public void actionPerformed( ActionEvent e ) {
int returnVal = JFileChooser.APPROVE_OPTION;
//Handle open file action.
System.out.println( e.getActionCommand() );
///open
if ( e.getSource() == btnOpen ) {
System.out.println( "FA1" );
returnVal = fc.showOpenDialog( AudioPlayer.this );
if ( returnVal == JFileChooser.APPROVE_OPTION ) {
selFile = fc.getSelectedFile();
player = new Player( selFile );
label.setText( "File loaded : " + selFile.getAbsolutePath() );
btnPlay.setEnabled( true );
btnStop.setEnabled( false );
btnPause.setEnabled( false );
//This is where a real application would open the file.
} else {
//play
if ( e.getSource() == btnPlay ) {
player.go( btnLoop.isSelected() );
btnPlay.setEnabled( false );
btnStop.setEnabled( true );
btnPause.setEnabled( true );
// playAudio();
// pause
if ( e.getSource() == btnPause ) {
player.pause();
btnPlay.setEnabled( true );
btnStop.setEnabled( true );
btnPause.setEnabled( false );
if ( e.getSource() == btnStop ) {
player.finish();
btnPlay.setEnabled( true );
btnStop.setEnabled( false );
btnPause.setEnabled( false );
public void stateChanged( ChangeEvent e ) {
private Player player = null;
public static void main( String[] args ) {
AudioPlayer audioPlayer = new AudioPlayer();
audioPlayer.setSize( 400, 400 );
audioPlayer.show();
* Description of the Class
*@author rsmazara
*@created 28 February 2003
class Player {
Clip clip;
private java.io.File selectedFile = null;
private boolean looping = false;
public Player( File file ) {
selectedFile = file;
AudioInputStream audiosource = null;
try {
audiosource = AudioSystem.getAudioInputStream( selectedFile );
System.out.println( "here" );
//System.out.println(audiosource.getFormat());
DataLine.Info dataLineInfo = new DataLine.Info( Clip.class, audiosource.getFormat() );
clip = ( Clip ) AudioSystem.getLine( dataLineInfo );
clip.open( audiosource );
} catch ( UnsupportedAudioFileException e1 ) {
e1.printStackTrace();
} catch ( LineUnavailableException e2 ) {
e2.printStackTrace();
} catch ( IOException e3 ) {
e3.printStackTrace();
private boolean work = false;
public void go( boolean loop ) {
looping = loop;
playAudio();
public void finish() {
clip.stop();
public boolean isWorking() {
return clip.isRunning();
long pausePosition = ( long ) 0;
public void pause() {
pausePosition = clip.getMicrosecondPosition();
clip.stop();
public void restart() {
clip.setMicrosecondPosition( pausePosition );
playAudio();
public void loop( boolean loop ) {
looping = loop;
private void playAudio() {
if ( looping ) {
clip.loop( clip.LOOP_CONTINUOUSLY );
} else {
clip.loop( 0 ); -
Need help with drawLine method
Hello,
I've been having trouble with a recent programming assignment and the prof isn't being very helpful. I need to call the drawLine method to plot a line between (0,0) and two coordinates entered by the user; is there a way to do this without a JPanel? Here are the specs:
I've already done Part 1., just posting it to give a complete representation of the assignment.
Part 1. Implement a ComplexNumber class to represent complex numbers (z = a + bi).
1) Instance variables:
private int real; /* real part */
private int imag; /* imaginary part */
2) Constructor:
public ComplexNumber ( int realVal, int imagVal )
{ /* initialize real to realVal and imag to imagVal */ }
3) Get/Set functions:
public int getReal ( )
{ /* returns the real part */ }
public int getImag ( )
{ /* returns the imaginary part */ }
public void setReal ( int realVal )
{ /* sets real to realVal */ }
public void setImag ( int imagVal )
{ /* sets imag to imagVal */ }
Part 2. Implement a ComplexNumberPlot class (with a main method) that gets complex
numbers from the user and plots them. The user will be prompted a complex number until
he/she enters 0. The numbers will be input from the keyboard (System.in) and displayed
in the plot as they are entered. Assume that the user will enter the numbers in blank
separated format. For example, if the user wants to enter three complex numbers: 3 + 4i,
5 + 12i, and 15 + 17i, the input sequence will be:
3 4
5 12
15 17
0 0
To plot a complex number, you need to draw a line between (0,0) and (real, imag) using
the drawLine method.
Name your classes as ComplexNumber and ComplexNumberPlot.
For simplicity, you can assume that the complex numbers input by the user fall
into the first quadrant of the complex plane, i.e. both real and imaginary values
are positive.
Thanks for any help!Ok I've made some progress, here is what I've got.
public class ComplexNumber
private int real;
private int imag;
public ComplexNumber (int realVal, int imagVal)
real = realVal;
imag = imagVal;
public int getReal()
return real;
public int getImag()
return imag;
public void setReal(int realVal)
real = realVal;
public void setImag(int imagVal)
imag = imagVal;
import java.util.Scanner;
import java.awt.*;
import javax.swing.*;
public class ComplexNumberPlot
public static void main (String [] args)
ComplexNumber num = new ComplexNumber (1,0);
Scanner scan = new Scanner (System.in);
System.out.println("Enter a complex number(s):");
num.setReal(scan.nextInt());
num.setImag(scan.nextInt());
while (num.getReal() + num.getImag() != 0)
num.setReal(scan.nextInt());
num.setImag(scan.nextInt());
System.out.println();
JFrame frame = new JFrame ("ComplexNumberPlot");
frame.setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE);
ComplexPanel panel = new ComplexPanel();
frame.getContentPane().add(panel);
frame.pack();
frame.setVisible(true);
class ComplexPanel extends JPanel
public ComplexPanel()
setPreferredSize (new Dimension(150,150));
public void PaintComponent (Graphics page)
super.paintComponent(page);
page.drawLine(0,0,100,100);
However
1) The JPanel pops up but no line is drawn.
2) I am not sure how to get the variables I'm scanning for to work in the drawLine method
Thanks for all your help so far. -
Need Help with Sound Recording
Hi,
I'm a Comp. Sys. Eng. student in my final year and I've been trying to record sound with java for a couple of months now and its driving me stupid. I've looked around on just about every java source site I could find and have found many similar examples of sound recording, none seem to work on my machine. The problem is that I keep on getting either IOExceptions, or empty .wav files (as in the code below). The code included below is a shortened and modified version of some code I got from jsresources.org, the full link is http://www.jsresources.org/examples/AudioCommon.java.html.
I have not had any experience with multimedia in java before.
Can somebody please tell me what is wrong with this code? or is my java environment to blame?
Am I declaring my AudioFormat correctly?
Am I controlling my AudioInputStream correctly?
I'm using JDK1.4 in eclipse. Any help would be greatly appreciated.
* AudioCommon.java
* This file is part of jsresources.org
* Copyright (c) 1999 - 2001 by Matthias Pfisterer
* All rights reserved.
import java.io.File;
import java.io.IOException;
import javax.sound.sampled.AudioFileFormat;
import javax.sound.sampled.AudioFormat;
import javax.sound.sampled.AudioSystem;
import javax.sound.sampled.DataLine;
import javax.sound.sampled.Line;
import javax.sound.sampled.LineUnavailableException;
import javax.sound.sampled.Mixer;
import javax.sound.sampled.SourceDataLine;
import javax.sound.sampled.TargetDataLine;
public class AudioCommon
private static boolean DEBUG = true;
public static void main(String Args[]){
AudioFormat audioFormat = new AudioFormat(AudioFormat.Encoding.PCM_SIGNED,
44100.0F, 16, 2, 4, 44100.0F, false);
TargetDataLine dataLine = getTargetDataLine("AK5370 ",
audioFormat,
5);
File outputFile = new File("C:\\testRecorder.wav");
try{
outputFile.createNewFile();
} catch(IOException ioe){
System.err.println("Couldn't create a new file: " + ioe);
AudioFileFormat.Type targetType = AudioFileFormat.Type.WAVE;
SimpleAudioRecorder recorder = new SimpleAudioRecorder(
dataLine,
targetType,
outputFile);
out("Press ENTER to start the recording.");
try
System.in.read();
catch (IOException e)
e.printStackTrace();
recorder.start();
out("Recording...");
long millis = System.currentTimeMillis();
while(System.currentTimeMillis() < millis + 5000);
recorder.stopRecording();
out("Recording stopped.");
if(outputFile.exists()){
System.out.println("File Exists.");
} else {
System.err.println("File does not Exist.");
System.exit(0);
public static TargetDataLine getTargetDataLine(String strMixerName,
AudioFormat audioFormat,
int nBufferSize)
Asking for a line is a rather tricky thing.
We have to construct an Info object that specifies
the desired properties for the line.
First, we have to say which kind of line we want. The
possibilities are: SourceDataLine (for playback), Clip
(for repeated playback) and TargetDataLine (for
recording).
Here, we want to do normal capture, so we ask for
a TargetDataLine.
Then, we have to pass an AudioFormat object, so that
the Line knows which format the data passed to it
will have.
Furthermore, we can give Java Sound a hint about how
big the internal buffer for the line should be. This
isn't used here, signaling that we
don't care about the exact size. Java Sound will use
some default value for the buffer size.
TargetDataLine targetDataLine = null;
DataLine.Info info = new DataLine.Info(TargetDataLine.class,
audioFormat, nBufferSize);
try
if (strMixerName != null)
Mixer.Info mixerInfo = getMixerInfo(strMixerName);
if (mixerInfo == null)
out("AudioCommon.getTargetDataLine(): mixer not found: " + strMixerName);
return null;
Mixer mixer = AudioSystem.getMixer(mixerInfo);
targetDataLine = (TargetDataLine) mixer.getLine(info);
else
if (DEBUG) { out("AudioCommon.getTargetDataLine(): using default mixer"); }
targetDataLine = (TargetDataLine) AudioSystem.getLine(info);
* The line is there, but it is not yet ready to
* receive audio data. We have to open the line.
if (DEBUG) { out("AudioCommon.getTargetDataLine(): opening line..."); }
targetDataLine.open(audioFormat, nBufferSize);
if (DEBUG) { out("AudioCommon.getTargetDataLine(): opened line"); }
catch (LineUnavailableException e)
if (DEBUG) { e.printStackTrace(); }
catch (Exception e)
if (DEBUG) { e.printStackTrace(); }
if (DEBUG) { out("AudioCommon.getTargetDataLine(): returning line: " + targetDataLine); }
return targetDataLine;
EOF<<<<<<<<<<<<<<<<import java.io.File;
import javax.sound.sampled.*;
class SimpleAudioRecorder extends Thread{
private TargetDataLine m_line;
private AudioFileFormat.Type m_targetType;
private AudioInputStream m_audioInputStream;
private File m_outputFile;
public SimpleAudioRecorder(TargetDataLine line,
AudioFileFormat.Type targetType,
File file)
m_line = line;
m_audioInputStream = new AudioInputStream(line);
m_targetType = targetType;
m_outputFile = file;
public void stopRecording(){
m_line.stop();
m_line.flush();
m_line.close();
EOF<<<<<<<<<<<<<<<<your asking the quest in the jmf forum and using some old type of handling the media
sun has given you very good frame work which reduce lot of coding and makes the life easy
then why are you going to old way.
first go and read jmf tutorial and implement your self dont go to get the code which some other people have written. do your self . you have energy to do. why are depending on others
read well tutorial and design. you will win i am sure
jmf makes life easy -
If you have 1 sound file playing on say frame 1, how do you
get frame 2 to play a different sound, without playing frame one's
sound as well? Right now 'frame 2' is playing both sound files. If
I use the commande 'stopAllSounds' the frame 2 sound file will not
play either.
Please help. Thank you.nwbgator wrote:
> If you have 1 sound file playing on say frame 1, how do
you get frame 2 to play
> a different sound, without playing frame one's sound as
well? Right now 'frame
> 2' is playing both sound files. If I use the commande
'stopAllSounds' the
> frame 2 sound file will not play either.
The sound once started will play for as long as you loop it
or as long as its length
is (if not loop is define). Even sound run independent to
timeline so if you enter
frame 2 it will simply play another sound.
You need to make some on/off switches on frames or actions
that will control the
sound. Entering another frame won't do it and using
stopAllSounds works like purge
and clear player from all its sounds. The only way to get
sound back will be by
reloading the entire movie. One of these actions that not
many of us are using.
Best Regards
Urami
!!!!!!! Merry Christmas !!!!!!!
Happy New Year
<urami>
If you want to mail me - DO NOT LAUGH AT MY ADDRESS
</urami> -
Could someone please help me out. I am so close to having
this sound scrubber work.
Here is what is not working:
--The slider thumb does not move when the music is playing
and it should.
--Also when you slide the slider thumb, the musical score
(frame) should change and it doesn't.
This is a bit different from scrubbers for Mp3 or other SWA
files.
You can go to
http://www.bachharpsichord.com/AudioCD.zip
and get the <1Meg file and xtra (they have to be in the same
folder and the extra is in demo mode (which is free for all to
try)).
When you try to run the program you need to put a music CD in
your CD drive. The first track should be around 3 minutes. I have
cuepoints in the program which move to the next frame(page) while
the music is playing.
Thank to all you geniuses!!Something like this?
http://nonlinear.openspark.com/tips/sound/panvolume/ -
Need help with sound on media and itunes. not working
The media player and itunes sound does not work. need help
You either need to kill all sounds when they click the
Next/Back buttons OR you could disable the buttons until the sound
completes.
Hope that helps! -
I am re-writing this method because it does not return the expected data. I
am still somewhat new to coding in Forte. Please help if you can. The
error exception message I receive when I run is.....
This error is a TOOL CODE ERROR
Detected In:
Class: RPTClientNumberList
Method: DBCursor::Open
Location: 0
Forte Error Message is:
No input values supplied for the SQL statement.
Additional Information:
**** End of Error ****
No matter what changes I make to the SQL I still receive this error.
//: Parameters: pReportCriteria : ClientNumberListReportCriteria
//: Returns: Array of ClientNumberListReportData
//: Purpose: To get the data required for the ClientNumberListReportData.
//: Logic
//: History: mm/dd/yy xxx comment
lClientTransfersArray : Array of ClientNumberListReportData = new();
lResultArray : Array of ClientNumberListReportData =
new();
lReportData : ClientNumberListReportData;
lReportInfo :
ClientNumberListReportTransactions;
lThis : TextData =
'ReportSQLAgent.SelectClientNumberListReportData()';
lSQL : TextData = new();
lSQL.SetValue(
'SELECT C.ClientName aClientName, \
CN.ClientNumber aClientNumber, \
CN.ClientNumberID aClientNumberID, \
T.TeamNumber aIsTeamID, \
AM.FirstName aFirstName, \
AM.MiddleName aMiddleName, \
AM.LastName aLastName \
FROM SUPER_DBA.Client C, \
SUPER_DBA.ClientN CN, \
SUPER_DBA.Team T, \
SUPER_DBA.OASUSER AM \
WHERE CN.ClientID = C.ClientID and \
CN.ISTeamID = T.TeamID
and \
CN.IsActive = \'Y\' AND
CN.AccountMgrID = AM.UserID ');
// If the criteria contains an ISTeamID, search by it.
if pReportCriteria.aISTeamID <> cEmptyDropListValue then
lSQL.concat( ' and CN.ISTeamID = ');
lSQL.concat( pReportCriteria.aISTeamID );
end if;
begin transaction
lDynStatement : DBStatementHandle;
lInputDesc : DBDataset;
lOutputDesc : DBDataset;
lOutputData : DBDataset;
lRowType : Integer;
lStatementType : Integer;
// The prepare method parses the SQL statement, verifying the
// syntax and returns a statement identifier (the handle
lDynStatement)
// to use as a reference
lDynStatement = DefaultDBSession.prepare( lSQL, lInputDesc,
lStatementType );
// The opencursor method positions the cursor before the first row
// in the result set
lRowType = DefaultDBSession.OpenCursor( lDynStatement, lInputDesc,
lOutputDesc );
lNumRows : Integer;
while true do
lNumRows = DefaultDBSession.FetchCursor( lDynStatement,
lOutputData );
if lNumRows <= 0 then
exit;
end if;
lReportData = new();
lReportData.aFirstName = TextData(
lOutputData.GetValue(ColumnName='aFirstName')).value;
lReportData.aMiddleName = TextData(
lOutputData.GetValue(ColumnName='aMiddleName')).value;
lReportData.aLastName = TextData(
lOutputData.GetValue(ColumnName='aLastName')).value;
lReportData.aClientName = TextData(
lOutputData.GetValue(ColumnName='aClientName')).value;
lReportData.aClientNumber = DoubleNullable(
lOutputData.GetValue(ColumnName='aClientNumber')).TextValue.value;
lReportData.aClientNumberID = DoubleNullable(
lOutputData.GetValue(ColumnName='aClientNumberID')).integervalue;
lReportData.aIsTeamID = IntegerNullable(
lOutputData.GetValue(ColumnName='aIsTeamID')).TextValue.value;
lResultArray.AppendRow( lReportData );
end while;
// Close the cursor
DefaultDBSession.CloseCursor( lDynStatement );
// Remove the cursor to free resources
DefaultDBSession.RemoveStatement( lDynStatement );
end transaction;
for lEach in lResultArray do
lHistorySQL : TextData = new();
lHistorySQL.SetValue(
'SELECT CNH.isActive aIsActive, \
T.TeamNumber aTeamID, \
CNH.ModifyDateTime
aTransactionDate \
FROM SUPER_DBA.ClientNH CNH, \
SUPER_DBA.Team T \
WHERE CNH.ISTeamID = T.TeamID and \
CNH.ClientNumberID =
:lResultArray.aClientNumberID ');
// If a date range was specified, include it in the SQL
if NOT pReportCriteria.aStartDate.IsNull then
lHistorySQL.concat( ' and CNH.ModifyDateTime between
:pReportCriteria.aStartDate ');
lHistorySQL.concat( ' and :pReportCriteria.aEndDate ');
end if;
begin transaction
lDynStatement : DBStatementHandle;
lInputDesc : DBDataset;
lOutputDesc : DBDataset;
lOutputData : DBDataset;
lRowType : Integer;
lStatementType : Integer;
// The prepare method parses the SQL statement, verifying
the
// syntax and returns a statement identifier (the handle
lDynStatement)
// to use as a reference
lDynStatement = DefaultDBSession.prepare( lHistorySQL,
lInputDesc, lStatementType );
// The opencursor method positions the cursor before the
first row
// in the result set
lRowType = DefaultDBSession.OpenCursor( lDynStatement,
lInputDesc, lOutputDesc );
lNumRows : Integer;
while true do
lNumRows = DefaultDBSession.FetchCursor(
lDynStatement, lOutputData );
if lNumRows <= 0 then
exit;
end if;
lReportInfo = new();
lReportInfo.aIsActive = TextData(
lOutputData.GetValue(ColumnName='aIsActive')).value;
lReportInfo.aISTeamID =
IntegerNullable(
lOutputData.GetValue(ColumnName='aTeamID')).TextValue.value;
lReportInfo.aTransactionDate = DateTimeData(
lOutputData.GetValue(ColumnName='aTransactionDate'));
lResultArray.AppendRow( lReportData );
end while;
// Close the cursor
DefaultDBSession.CloseCursor( lDynStatement );
// Remove the cursor to free resources
putline( '%1: Removing the cursor.', lThis );
DefaultDBSession.RemoveStatement( lDynStatement );
end transaction;
lLastTeamNumber : string = cEmptyText;
lKeepRecord : boolean = False;
if lReportInfo.aISTeamID <> lLastTeamNumber then
lLastTeamNumber = lReportInfo.aISTeamID;
lReportInfo.aTransactionDescription = 'New Team Assignment';
lResultArray.appendRow( lReportInfo );
end if;
if lReportInfo.aIsActive = 'N' then
lReportInfo.aTransactionDescription = 'Team Number Deleted';
lResultArray.appendRow( lReportInfo );
end if;
end for;
// Success! Excellent!! Return the ClientNumberListReportData!
return lResultArray;
exception
when e : GenericException do
LogException( e, lThis );
raise e;
Lisa M. Tucci - Applications Programmer
Business Applications Support and Development - West Corporation
tel.: (402) 964-6360 ex: 208-4360 stop: W8-IS e-mail: lmtucciwest.comI am re-writing this method because it does not return the expected data. I
am still somewhat new to coding in Forte. Please help if you can. The
error exception message I receive when I run is.....
This error is a TOOL CODE ERROR
Detected In:
Class: RPTClientNumberList
Method: DBCursor::Open
Location: 0
Forte Error Message is:
No input values supplied for the SQL statement.
Additional Information:
**** End of Error ****
No matter what changes I make to the SQL I still receive this error.
//: Parameters: pReportCriteria : ClientNumberListReportCriteria
//: Returns: Array of ClientNumberListReportData
//: Purpose: To get the data required for the ClientNumberListReportData.
//: Logic
//: History: mm/dd/yy xxx comment
lClientTransfersArray : Array of ClientNumberListReportData = new();
lResultArray : Array of ClientNumberListReportData =
new();
lReportData : ClientNumberListReportData;
lReportInfo :
ClientNumberListReportTransactions;
lThis : TextData =
'ReportSQLAgent.SelectClientNumberListReportData()';
lSQL : TextData = new();
lSQL.SetValue(
'SELECT C.ClientName aClientName, \
CN.ClientNumber aClientNumber, \
CN.ClientNumberID aClientNumberID, \
T.TeamNumber aIsTeamID, \
AM.FirstName aFirstName, \
AM.MiddleName aMiddleName, \
AM.LastName aLastName \
FROM SUPER_DBA.Client C, \
SUPER_DBA.ClientN CN, \
SUPER_DBA.Team T, \
SUPER_DBA.OASUSER AM \
WHERE CN.ClientID = C.ClientID and \
CN.ISTeamID = T.TeamID
and \
CN.IsActive = \'Y\' AND
CN.AccountMgrID = AM.UserID ');
// If the criteria contains an ISTeamID, search by it.
if pReportCriteria.aISTeamID <> cEmptyDropListValue then
lSQL.concat( ' and CN.ISTeamID = ');
lSQL.concat( pReportCriteria.aISTeamID );
end if;
begin transaction
lDynStatement : DBStatementHandle;
lInputDesc : DBDataset;
lOutputDesc : DBDataset;
lOutputData : DBDataset;
lRowType : Integer;
lStatementType : Integer;
// The prepare method parses the SQL statement, verifying the
// syntax and returns a statement identifier (the handle
lDynStatement)
// to use as a reference
lDynStatement = DefaultDBSession.prepare( lSQL, lInputDesc,
lStatementType );
// The opencursor method positions the cursor before the first row
// in the result set
lRowType = DefaultDBSession.OpenCursor( lDynStatement, lInputDesc,
lOutputDesc );
lNumRows : Integer;
while true do
lNumRows = DefaultDBSession.FetchCursor( lDynStatement,
lOutputData );
if lNumRows <= 0 then
exit;
end if;
lReportData = new();
lReportData.aFirstName = TextData(
lOutputData.GetValue(ColumnName='aFirstName')).value;
lReportData.aMiddleName = TextData(
lOutputData.GetValue(ColumnName='aMiddleName')).value;
lReportData.aLastName = TextData(
lOutputData.GetValue(ColumnName='aLastName')).value;
lReportData.aClientName = TextData(
lOutputData.GetValue(ColumnName='aClientName')).value;
lReportData.aClientNumber = DoubleNullable(
lOutputData.GetValue(ColumnName='aClientNumber')).TextValue.value;
lReportData.aClientNumberID = DoubleNullable(
lOutputData.GetValue(ColumnName='aClientNumberID')).integervalue;
lReportData.aIsTeamID = IntegerNullable(
lOutputData.GetValue(ColumnName='aIsTeamID')).TextValue.value;
lResultArray.AppendRow( lReportData );
end while;
// Close the cursor
DefaultDBSession.CloseCursor( lDynStatement );
// Remove the cursor to free resources
DefaultDBSession.RemoveStatement( lDynStatement );
end transaction;
for lEach in lResultArray do
lHistorySQL : TextData = new();
lHistorySQL.SetValue(
'SELECT CNH.isActive aIsActive, \
T.TeamNumber aTeamID, \
CNH.ModifyDateTime
aTransactionDate \
FROM SUPER_DBA.ClientNH CNH, \
SUPER_DBA.Team T \
WHERE CNH.ISTeamID = T.TeamID and \
CNH.ClientNumberID =
:lResultArray.aClientNumberID ');
// If a date range was specified, include it in the SQL
if NOT pReportCriteria.aStartDate.IsNull then
lHistorySQL.concat( ' and CNH.ModifyDateTime between
:pReportCriteria.aStartDate ');
lHistorySQL.concat( ' and :pReportCriteria.aEndDate ');
end if;
begin transaction
lDynStatement : DBStatementHandle;
lInputDesc : DBDataset;
lOutputDesc : DBDataset;
lOutputData : DBDataset;
lRowType : Integer;
lStatementType : Integer;
// The prepare method parses the SQL statement, verifying
the
// syntax and returns a statement identifier (the handle
lDynStatement)
// to use as a reference
lDynStatement = DefaultDBSession.prepare( lHistorySQL,
lInputDesc, lStatementType );
// The opencursor method positions the cursor before the
first row
// in the result set
lRowType = DefaultDBSession.OpenCursor( lDynStatement,
lInputDesc, lOutputDesc );
lNumRows : Integer;
while true do
lNumRows = DefaultDBSession.FetchCursor(
lDynStatement, lOutputData );
if lNumRows <= 0 then
exit;
end if;
lReportInfo = new();
lReportInfo.aIsActive = TextData(
lOutputData.GetValue(ColumnName='aIsActive')).value;
lReportInfo.aISTeamID =
IntegerNullable(
lOutputData.GetValue(ColumnName='aTeamID')).TextValue.value;
lReportInfo.aTransactionDate = DateTimeData(
lOutputData.GetValue(ColumnName='aTransactionDate'));
lResultArray.AppendRow( lReportData );
end while;
// Close the cursor
DefaultDBSession.CloseCursor( lDynStatement );
// Remove the cursor to free resources
putline( '%1: Removing the cursor.', lThis );
DefaultDBSession.RemoveStatement( lDynStatement );
end transaction;
lLastTeamNumber : string = cEmptyText;
lKeepRecord : boolean = False;
if lReportInfo.aISTeamID <> lLastTeamNumber then
lLastTeamNumber = lReportInfo.aISTeamID;
lReportInfo.aTransactionDescription = 'New Team Assignment';
lResultArray.appendRow( lReportInfo );
end if;
if lReportInfo.aIsActive = 'N' then
lReportInfo.aTransactionDescription = 'Team Number Deleted';
lResultArray.appendRow( lReportInfo );
end if;
end for;
// Success! Excellent!! Return the ClientNumberListReportData!
return lResultArray;
exception
when e : GenericException do
LogException( e, lThis );
raise e;
Lisa M. Tucci - Applications Programmer
Business Applications Support and Development - West Corporation
tel.: (402) 964-6360 ex: 208-4360 stop: W8-IS e-mail: lmtucciwest.com -
NEED HELP with Sound Blaster 5.1 digital LIVE! IM FED UP WITH THIS PEICE OF JUNK SOUND C
yes i installed the Sound Blaster 5. digital LIVE! into my system and i got a new updated installation cd from creative and everything .. now heres the problem everytime i try to do an upgrade or download stuff from creative i always get an error message sayin MY SOUND CARD IS NOT INSTALLED .. but everything on my computer says it is installed and working properly .. so what the hell is going on ??? im a first time buyer of creative products and i purchased this from word of mouth on how good it was and i tell you what this sound card is a peice of **bleep** ... i have never in my life had such a problem installing something .. well i cant even use diagnostics cause i get the same message " MY SOUND CARD IS NOT INSTALLED ... i have tried uninstalling everything and so for and still nuthing .. i get sound through it but i cannot access any of the features from the cd or upgrade any of the drivers or anything .. SOOOOOOOOOOOOOOOO WHAT AM I SUSPOSED TO DO ?? IM ALSO GOING AS FAR AS SENDING THIS BACK TO CREATIVE FOR A REPLACEMENT CAUSE THIS CARD HAS TO BE DEFECTIVE .........ANYONE WITH SOME ANSWERS PLEASE LET ME KNOW ?
ok i found my directx program and opened it and did sound test and other tests and it says theres no problems found .
so this leads me back to my problem i stll get the error message saying that MY SOUND CARD CANNOT BE DETECTED ON MY SYSTEM . PLEASE MAKE SURE YOU SOUND CARD IS PROPERLY INSTALLED ...
i went to creative to do the autoupdate install so it would auto check my system and i get a error message saying theres components that are corrupted and it closes and does nuthing ..
and everytime i try to do an update i get the no sound card error message so im back to square ,
i have done everything i can possibly think of and also everything the techs told me to do nd this **bleep** still dont work and i still cant use any of the features that came on the disc (i.e.) diagnostics and others etc.etc.etc.
my only conclusion is i have a deffecti've sound card ..........unless someone can think of a miracle fix i dont see anything else it could be
Message Edited by theviper on -06-2005 :00 AM -
Java Newbie needs help with multi method dialog calculator
Our example for the unit was the example below... we now must create a 5 method program for a calculator... 1 main method and 4 for the standard operations(+ - * /). It is supposed to utilize Swing for graphics/dialog boxes that ask you for the operation you would like to use(if statements based on which operation they enter), and a prompt that asks you separately for the 2 numbers used.... anyone feel like drawing this skeleton out? I am in class right now and none of my neighbors can figure it out either....
import javax.swing.JOptionPane;
public class Payroll
public static void main(String[] args)
String name; //the user's name
String inputString; //holds input
int hours; //hours worked
double payRate; //hourly pay wage
double grossPay; //total pay
//getUser
name = JOptionPane.showInputDialog("What is your name?");
//getHours
inputString = JOptionPane.showInputDialog("How many hours did you work?");
hours = Integer.parseInt(inputString);
//getRate
inputString = JOptionPane.showInputDialog("What is your hourly pay rate?");
payRate = Double.parseDouble(inputString);
//setGross
grossPay = payRate * hours;
//showGross
JOptionPane.showMessageDialog(null, "Hello " + name + ". Your gross pay is: " + grossPay);
//End
System.exit(0);
}import javax.swing.JOptionPane;
public class CalcDiag
public static void main(String[] args)
String operation;
String inputString;
double num1, num2, total=0;
inputString = JOptionPane.showInputDialog("What is your first number?");
num1 = Double.parseDouble(inputString);
inputString = JOptionPane.showInputDialog("What is your second number?");
num2 = Double.parseDouble(inputString);
inputString = JOptionPane.showInputDialog("Please indicate which operation you would like to use: A,S,M,D ?");
operation = inputString;
if (operation.equals("A"))
total = getAdd(num1, num2);
if (operation.equals("S"))
total = getSub(num1, num2);
if (operation.equals("M"))
total = getMult(num1, num2);
if (operation.equals("D"))
total = getDiv(num1, num2);
JOptionPane.showMessageDialog(null,"Total = "+total);
System.exit(0);
public static double getAdd(double x, double y)
return x+y;
public static double getSub(double x,double y)
return x-y;
public static double getMult(double x, double y)
return x*y;
public static double getDiv(double x, double y)
return x/y;
}your welcome -
I need help with this method, i don't know how to call it correct.
public void method397(byte byte0, int i)
if(byte0 != 6)
for(int j = 1; j > 0; j++);
aByteArray1405[anInt1406++] = (byte)(i + cacheMod.method246());
}This code is for a Game client im making for a 2dmmorpg, the method was refactored by a friend but he isn't online at the moment because his on holiday; This method sends a packet to the server, i have handled it in the server;
So i would think you would call it like this;
super.engineStream.method397((byte)6, 103);But that gives me a huge exception, so please could someone explain how i could fix?
Thanks
Ill get the error in a second.Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at Gui.ClientStreamLoader(Gui.java:328)
at Gui.actionPerformed(Gui.java:323)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.AbstractButton.doClick(Unknown Source)
at javax.swing.plaf.basic.BasicMenuItemUI.doClick(Unknown Source)
at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(Unknow
Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source) -
Need help with sound editing in FCE 4
I want to remove certain background sounds from my HDV video.. (ex. a baby screams in the background, I want to remove it).
Is there some way to separate different sounds within the video and delete that specific sound?
Also, I want to keep certain voices within the video, but have everything else have just white noise for the sound.
(I've read the parts of the manual, but haven't seen where I can completely edit and replace the audio in a recorded video)
Is this something that can be done using Soundtrack Pro 1.5 in FCE 3.5 HD?Well.. I can see the waveforms that I basically want to remove and delete.
If I can delete it or cut it out, can I tie in the 'loose ends' of the audio?
(I don't want dead silence for 2-3 seconds of the film)
Also, is there a way to 'line up' the audio to each frame? I want to use a sound to play everytime someone's mouth opens. -
I need help with Sound Blaster Live 5.1 Digital
...because I cannot install it. I formated my Windows XP and since then my Audio Card isn't working because my PC hasn't auto-installed it like everything other. The bad news are that I have lost my installing cd and I don't know what to do... Please...heeeelp!!!
Have you try using the Li'veDrvUni driver?
Jason -
Need help with threads?.. please check my approach!!
Hello frnds,
I am trying to write a program.. who monitors my external tool.. please check my way of doing it.. as whenever i write programs having thread.. i end up goosy.. :(
first let me tell.. what I want from program.. I have to start an external tool.. on separate thread.. (as it takes some time).. then it takes some arguments(3 arguments).. from file.. so i read the file.. and have to run tool.. continously.. until there are arguments left.. in file.. or.. user has stopped it by pressing STOP button..
I have to put a marker in file too.. so that.. if program started again.. file is read from marker postion.. !!
Hope I make clear.. what am trying to do!!
My approach is like..
1. Have two buttons.. START and STOP on Frame..
START--> pressed
2. check marker("$" sign.. placed in beginning of file during start).. on file..
read File from marker.. got 3 arg.. pass it to tool.. and run it.. (on separate thread).. put marker.. (for next reading)
Step 2.. continously..
3. STOP--> pressed
until last thread.. stops.. keep running the tool.. and when last thread stops.. stop reading any more arguments..
Question is:
1. Should i read file again and again.. ?.. or read it once after "$" sign.. store data in array.. and once stopped pressed.. read file again.. and put marker ("$" sign) at last read line..
2. how should i know when my thread has stopped.. so I start tool again??.. am totally confused.. !!
please modify my approach.. if u find anything odd..
Thanks a lot in advance
gerviniHello,
I have no experience with threads or with having more than run "program" in a single java file. All my java files have the same structure. This master.java looks something like this:
---master.java---------------------------------------------------
import java.sql.*;
import...
public class Master {
public static void main(String args []) throws SQLException, IOException {
//create connection pool here
while (true) { // start loop here (each loop takes about five minutes)
// set values of variables
// select a slave process to run (from a list of slave programs)
execute selected slave program
// check for loop exit value
} // end while loop
System.out.println("Program Complete");
} catch (Exception e) {
System.out.println("Error: " + e);
} finally {
if (rSet1 != null)
try { rSet1.close(); } catch( SQLException ignore ) { /* ignored */ }
connection.close();
-------end master.java--------------------------------------------------------
This master.java program will run continuously for days or weeks, each time through the loop starting another slave process which runs for five minutes to up to an hour, which means there may be ten to twenty of these slave processes running simultaneously.
I believe threads is the best way to do this, but I don't know where to locate these slave programs: either inside the master.java program or separate slave.java files? I will need help with either method.
Your help is greatly appreciated. Thank you.
Logan
Maybe you are looking for
-
NEW 2011 15" Macbook Pro SDD or HDD in place of the Optical Bay.
I am going to purchase the new 15' 2.2GHz MBP. I am just unsure right now about which Data drive to get. I currently have a 500GB 7200rpm HDD that I would like to put in my NEW Macbook Pro with the OWC Data Doubler( http://eshop.macsales.com/item/Oth
-
Unrepairable Disc after 10.4.8 update
After using software update to install the current combined 10.4.8, I am now unable to start my mac due to a kernal panic that happens at startup. I used disc utilitis to check and repair my disc, I find that the illigeal name, unable to repair 1 vol
-
Error adding file type item using portal api
We are using portal 3.0.8. I can add text and url type items fine but when i try to add a file type item, i get following error. ERROR at line 1: ORA-29532: Java call terminated by uncaught Java exception: java.lang.SecurityException: relative pathna
-
Populating multiple blocks on one form
I have two blocks on the same form, all blocks are from tables in the same database. I am using 'EXECUTE_QUERY' in the 'WHEN-NEW-FORM-INSTANCE' trigger to populate the blocks but only one block is populated. Any suggestions? Thanks in advance.
-
ADS:com.adobe.Processing Exception:Could not retrive(200101)
I am trying to create an Interactive ADOBE form. Created the form through SFP transaction and coded the print program also. When I am trying to give the EDITing fascility to my form I am getting error saying "ADS:com.adobe.Processing Exception:Could