Help with program to remove comments from chess(pgn) text files

Hi
I would like to make a java program that will remove chessbase comments from pgn files (which are just based text files).
I have done no java programming on text files so far and so this will be a new java adventure for me. Otherwise I have limited basic java experience mainly with Java chess GUI's and java chess engines.
I show here a portion of such a pgn text file with the chessbase comments which are between the curly braces after the moves:
1. e4 {[%emt 0:00:01]} c6 {[%emt 0:00:10]} 2. d4 {[%emt 0:00:03]} d5 {
[%emt 0:00:01]} 3. e5 {[%emt 0:00:01]} Bf5 {[%emt 0:00:01]} 4. h4 {
[%emt 0:00:02]} e6 {[%emt 0:00:02]}
I want to make a java program if possible that removes these comments, so just leaving the move notation eg:
1. e4 c6 2. d4 d5 3. e5 Bf5 4. h4 e6
I am just starting with this. As yet I am unsure how to begin and do this and I would be extremely grateful for any help and advice to get me going with this project.
I look forward to replies, many thanks

I found a simple java text editor (NutPad-with sourcecode) and have tried to adapt it to incorporate the regular expressions code suggested by ChuckBing and renamed it CleanCBpgnPad.
Presently this won't compile! (not surprising).
I copy the code here:
//CleanCBpgnPad by tR2 based on NutPad text editor
// editor/NutPad.java -- A very simple text editor -- Fred Swartz - 2004-08
// Illustrates use of AbstractActions for menus.
//http://www.roseindia.net/java/java-tips/45examples/20components/editor/nutpad.shtml
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.io.*;
public class CleanCBpgnPad extends JFrame {
//-- Components
private JTextArea mEditArea;
private JFileChooser mFileChooser = new JFileChooser(".");
//-- Actions
private Action mOpenAction;
private Action mSaveAction;
private Action mExitAction;
private Action mCleanAction;
//===================================================================== main
public static void main(String[] args) {
new CleanCBpgnPad().setVisible(true);
}//end main
//============================================================== constructor
public CleanCBpgnPad() {
createActions();
this.setContentPane(new contentPanel());
this.setJMenuBar(createMenuBar());
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.setTitle("CleanCBpgnPad");
this.pack();
}//end constructor
///////////////////////////////////////////////////////// class contentPanel
private class contentPanel extends JPanel {       
//========================================================== constructor
contentPanel() {
//-- Create components.
mEditArea = new JTextArea(15, 80);
mEditArea.setBorder(BorderFactory.createEmptyBorder(2,2,2,2));
mEditArea.setFont(new Font("monospaced", Font.PLAIN, 14));
JScrollPane scrollingText = new JScrollPane(mEditArea);
//-- Do layout
this.setLayout(new BorderLayout());
this.add(scrollingText, BorderLayout.CENTER);
}//end constructor
}//end class contentPanel
//============================================================ createMenuBar
/** Utility function to create a menubar. */
private JMenuBar createMenuBar() {
JMenuBar menuBar = new JMenuBar();
JMenu fileMenu = menuBar.add(new JMenu("File"));
fileMenu.add(mOpenAction); // Note use of actions, not text.
fileMenu.add(mSaveAction);
fileMenu.add(mCleanAction);
fileMenu.addSeparator();
fileMenu.add(mExitAction);
return menuBar;
}//end createMenuBar
//============================================================ createActions
/** Utility function to define actions. */
private void createActions() {
mOpenAction = new AbstractAction("Open...") {
public void actionPerformed(ActionEvent e) {
int retval = mFileChooser.showOpenDialog(CleanCBpgnPad.this);
if (retval == JFileChooser.APPROVE_OPTION) {
File f = mFileChooser.getSelectedFile();
try {
FileReader reader = new FileReader(f);
mEditArea.read(reader, ""); // Use TextComponent read
} catch (IOException ioex) {
System.out.println(e);
System.exit(1);
mSaveAction = new AbstractAction("Save") {
public void actionPerformed(ActionEvent e) {
int retval = mFileChooser.showSaveDialog(CleanCBpgnPad.this);
if (retval == JFileChooser.APPROVE_OPTION) {
File f = mFileChooser.getSelectedFile();
try {
FileWriter writer = new FileWriter(f);
mEditArea.write(writer); // Use TextComponent write
} catch (IOException ioex) {
System.out.println(e);
System.exit(1);
mCleanAction = new AbstractAction ("Clean"){
public void actionPerformed (ActionEvent e) {
int retval = mFileChooser.showCleanDialog(CleanCBpgnPad.this);
if (retval== JFileChooser.APPROVE_OPTION){
File f = mFileChooser.getSelectedFile();
try {
FileCleaner cleaner = new FileCleaner (c);
mEditArea.clean(cleaner); // Use TextComponent clean
}catch (IOException ioex){
String str = "1. e4 {[%emt 0:00:01]} c6 {[%emt 0:00:10]} 2. d4 {[%emt 0:00:03]} d5 {[%emt 0:00:01]} " + "3. e5 {[%emt 0:00:01]} Bf5 {[%emt 0:00:01]} 4. h4 {[%emt 0:00:02]} e6 {[%emt 0:00:02]}";
str = str.replaceAll("\\{.*?\\}", "");
System.out.println(str);
System.exit(1);
mExitAction = new AbstractAction("Exit") {
public void actionPerformed(ActionEvent e) {
System.exit(0);
}//end createActions
}//end class CleanCBpgnPad
As seen I added a newAction mClean.
4 errors arise starting with line 101-cannot find symbol method showCleanDialog
then 3 errors on line 104 tryfilecleaner
Can anyone help me with this please?
Can I incorporate the regular expression code to remove these text comments into this text editor code and if so how?
Obviously a lot of this code is new to me and I will continue to study it and hope to learn to understand most , if not all of it!
Again I look forward to replies,thanks

Similar Messages

  • I had a very bad experience with apple maps. It is not at all useful. How such application is developed by apple I dont undersatand. Pl help me how to remove it from my Iphone. Vijay from Hyderabad. India

    I had a very bad experience with apple maps. It is not at all useful. How such application is developed by apple I dont undersatand. Pl help me how to remove it from my Iphone. Vijay from Hyderabad. India

    Tell Apple.
    http://www.apple.com/feedback/iphone.html

  • How can i remove comments from the "tell your frie...

    How can I remove comments from the "tell your friends how you're doing" section?

    Please do a Skype reset.
    Exit Skype : From the system tray >> right click on the skype icon and click "Quit"
    Press WinKey+R
    Type: %appdata% and press Enter.
    Rename the folder "Skype" to "Old_Skype"
    Run Skype.
    You will need your password to re-log on, and re-set any options from default
    Regards,
    Tamim
    Location - Dhaka | Bangladesh - Standard Time Zone: GMT/UTC + 06:00 hour
    If one of my replies has adequately addressed your issue, please click on the “Accept as Solution” button. If you found a post useful then please "Give Kudos" at the bottom of my post, so that this information can benefit others.

  • Help with writing and retrieving data from a table field with type "LCHR"

    Hi Experts,
    I need help with writing and reading data from a database table field which has a type of "LCHR". I have given an example of the original code but don't know what to change it to in order to fix it and still read in the original data that's stored in the LCHR field.
    Basically we have two Function modules, one that saves list data to a database table and one that reads in this data. Both Function modules have an identicle table which has an array of fields from type INT4, CHAR, and type P. The INT4 field is the first one.
    Incidentally this worked in the 4.7 non-unicode system but is now dumping in the new ECC6 Unicode system.
    Thanks in advance,
    C
    SAVING THE LIST DATA TO DB
    DATA: L_WA(800).
    LOOP AT T_TAB into L_WA.
    ZDBTAB-DATALEN = STRLEN( L_WA ).
    MOVE: L_WA to ZDBTAB-RAWDATA.
    ZDBTAB-LINENUM = SY-TABIX.
    INSERT ZDBTAB.
    READING THE DATA FROM DB
    DATA: BEGIN OF T_DATA,
                 SEQNR type ZDBTAB-LINENUM,
                 DATA type ZDBTAB-RAWDATA,
               END OF T_TAB.
    Select the data.
    SELECT linenum rawdata from ZDBTAB into table T_DATA
         WHERE repid = w_repname
         AND rundate = w_rundate
         ORDER BY linenum.
    Populate calling Internal Table.
    LOOP AT T-DATA.
    APPEND T_DATA to T_TAB.
    ENDLOOP.

    Hi Anuj,
    The unicode flag is active.
    When I run our report and then to try and save the list data a dump is happening at the following point
    LOOP AT T_TAB into L_WA.
    As I say, T_TAB consists of different fields and field types whereas L_WA is CHAR 800. The dump mentions UC_OBJECTS_NOT_CONVERTIBLE
    When I try to load a saved list the dump is happening at the following point
    APPEND T_DATA-RAWDATA to T_TAB.
    T_DATA-RAWDATA is type LCHR and T_TAB consists of different fields and field types.
    In both examples the dumps mention UC_OBJECTS_NOT_CONVERTIBLE
    Regards
    C

  • I need help with controlling two .swf's from third.

    Hi, thanks for reading!
    I need help with controlling two .swf's from third.
    I have a problem where I need to use a corporate designed
    .swf in a digital signage solution, but have been told by the legal
    department that it can not be modified in any way, I also can't
    have the source file yada yada. I pulled the .swfs from their
    website and I decompiled them to see what I was up against.
    The main swf that I need to control is HCIC.swf and the
    problem is it starts w/ a preloader, which after loading stops on a
    frame that requires user input (button press) on a play button,
    before the movie will proceed and play through.
    What I have done so far is to create a container swf,
    HCIC_container.swf that will act as Target for the HCIC.swf, and
    allow me to send actionscript to the file I'm not allowed to
    modify.
    I managed to get that done with the help of someone on
    another forum. It was my hope that the following script would just
    start HCIC.swf at a frame past the preloader and play button, and
    just play through.
    var container:MovieClip = createEmptyMovieClip("container",
    getNextHighestDepth());
    var mcLoader:MovieClipLoader = new MovieClipLoader();
    mcLoader.addListener(this);
    mcLoader.loadClip("MCIC.swf", container);
    function onLoadInit(mc:MovieClip) {
    mc.gotoAndPlay(14);
    But unfortunately it didn't solve my problem. Because there
    is a media-controller.swf, that is being loaded by HCIC.swf that
    has the controls including the play button to start HCIC.swf.
    Here's a link to a .zip file with all 3 .swf files, and all 3
    .fla files.
    http://www.axiscc.com/temp/HCIC.zip
    What I need to do is automatically start the HCIC.swf file
    bypassing the pre-loader and play button without editing it or the
    media-controller.swf in anyway. So all the scripting needs to be
    done in HCIC_container.swf.
    I know this is confusing, and its difficult to explain, but
    if you look at the files it should make sense.
    ActionScripting is far from my strong point, so I'm
    definitely over my head here.
    Thanks for your help.

    Got my solution on another forum.
    http://www.actionscript.org/forums/showthread.php3?t=146827

  • Search help with programming

    Hai,
    Can any one give example for search help with Programming?
    I hope we can create search help with help of coding.
    With Regards,Jaheer.

    yes u can create search help by using match code in programs
    for eq
    go with abap editor se 38
    provide the name of program
    parameters : vendor like lfa1-lifnr matchcode object yzob.
    double click on yzob
    provide description for search help
    provide selection method
    provide search help parameter
    enable check box for import and export
    provide lpos
               spos
    save check activate
    press f4 for check and import values i.e it will display a records list available in database table
    rewards points please

  • Can someone help with a previous post labeled "Writing to a data file with time stamp - Help! "

    Can someone possibly help with a previous post labeled "Writing to a data file with time stamp - Help! "
    Thanks

    whats the problem?
    Aquaphire
    ---USING LABVIEW 6.1---

  • Best way to remove last line-feed in text file

    What is the best way to remove last line-feed in text file? (so that the last line of text is the last line, not a line-feed). The best I can come up with is: echo -n "$(cat file.txt)" > newfile.txt
    (as echo -n will remove all trailing newline characters)

    What is the best way to remove last line-feed in text file? (so that the last line of text is the last line, not a line-feed). The best I can come up with is: echo -n "$(cat file.txt)" > newfile.txt
    (as echo -n will remove all trailing newline characters)
    According to my experiments, you have removed all line terminators from the file, and replaced those between lines with a space.
    That is to say, you have turned a multi-line file into one long line with no line terminator.
    If that is what you want, and your files are not very big, then your echo statement might be all you need.
    If you need to deal with larger files, you could try using the 'tr' command, and something like
    tr '
    ' ' ' <file.txt >newfile.txt
    The only problem with this is, it will most likely give you a trailing space, as the last newline is going to be converted to a space. If that is not acceptable, then something else will have to be arranged.
    However, if you really want to maintain a multi-line file, but remove just the very last line terminator, that gets a bit more complicated. This might work for you:
    perl -ne '
    chomp;
    print "
    " if $n++ != 0;
    print;
    ' file.txt >newfile.txt
    You can use cat -e to see which lines have newlines, and you should see that the last line does not have a newline, but all the others still do.
    I guess if you really did mean to remove all newline characters and replace them with a space, except for the last line, then a modification of the above perl script would do that:
    perl -ne '
    chomp;
    print " " if $n++ != 0;
    print;
    ' file.txt >newfile.txt
    Am I even close to understanding what you are asking for?

  • I need help with programs from my MacBookAir.

    Hello. I've intalled programs on my MacbookAit that I don't need anymore and I have no idea how to remove them from my laptop. I've been a PC user and I knew there how to remove them but here I just don't know. I know that dragging them to the trash won't work. I want to remove them and free the space that is taking. I hope you guys can help me with this. Thank you Very Much!!!

    Uninstalling Software: The Basics
    Most OS X applications are completely self-contained "packages" that can be uninstalled by simply dragging the application to the Trash.  Applications may create preference files that are stored in the /Home/Library/Preferences/ folder.  Although they do nothing once you delete the associated application, they do take up some disk space.  If you want you can look for them in the above location and delete them, too.
    Some applications may install an uninstaller program that can be used to remove the application.  In some cases the uninstaller may be part of the application's installer, and is invoked by clicking on a Customize button that will appear during the install process.
    Some applications may install components in the /Home/Library/Applications Support/ folder.  You can also check there to see if the application has created a folder.  You can also delete the folder that's in the Applications Support folder.  Again, they don't do anything but take up disk space once the application is trashed.
    Some applications may install a startupitem or a Log In item.  Startupitems are usually installed in the /Library/StartupItems/ folder and less often in the /Home/Library/StartupItems/ folder.  Log In Items are set in the Accounts preferences.  Open System Preferences, click on the Accounts icon, then click on the LogIn Items tab.  Locate the item in the list for the application you want to remove and click on the "-" button to delete it from the list.
    Some software use startup daemons or agents that are a new feature of the OS.  Look for them in /Library/LaunchAgents/ and /Library/LaunchDaemons/ or in /Home/Library/LaunchAgents/.
    If an application installs any other files the best way to track them down is to do a Finder search using the application name or the developer name as the search term.  Unfortunately Spotlight will not look in certain folders by default.  You can modify Spotlight's behavior or use a third-party search utility, Easy Find, instead.  Download Easy Find at VersionTracker or MacUpdate.
    Some applications install a receipt in the /Library/Receipts/ folder.  Usually with the same name as the program or the developer.  The item generally has a ".pkg" extension.  Be sure you also delete this item as some programs use it to determine if it's already installed.
    There are many utilities that can uninstall applications.  Here is a selection:
    AppZapper 2.0.1
    AppDelete 3.2.6
    Automaton 1.50
    Hazel
    AppCleaner 2.1.0
    CleanApp
    iTrash 1.8.2
    Amnesia
    Uninstaller 1.15.1
    Spring Cleaning 11.0.1
    Look for them at VersionTracker or MacUpdate.
    For more information visit The XLab FAQs and read the FAQ on removing software.

  • Help with making start up disk from .dmg image on hard drive

    HI Guys hope you can help i have a .DMG image of my OSX install files and need to know how i burn this onto a dvd so i can use it as a start up disk or do a reinstall.
    Never had to even think about any of this before so an idiots guide would be most useful burned the .dmg image to a disk but it wont work as a start up disk and if i open it once inserted it wont work using the start up disk application within system preferences
    Any help appreciated

    An image of your hard drive? No. A copy of Tiger DVD?
    It could be done under Panther with a program called BootCD, but not Tiger.
    Why? when you can easily clone your system to a FW drive partition and use that as needed. Or use TechTool Pro 4.5.1 to put an "eDrive" on your boot drive or another drive (~7GB) just for emergencies.
    You can use Disk Utility to Restore your boot drive to a disk image and back if you want to store it on another drive and in the event of disaster striking and you need to erase and restore.

  • Help with using a web page from disk after saved from web

    Hi, I almost forgot the little I learned about web page development, so, I'm a total noob when it comes to this and I need your help.
    I saved as a complete web page on my hard disk this web page but when I open it in Firefox or IE, it doesn't display as much as I need it. I'm mostly interested  in displaying the logo images as they appear on the original web page. The browsers just show them briefly when refreshing but hide them right away. I can see the image files downloaded to my hard drive and if I open the page in Dreamweaver it displays these images  in the preview pane but I can't make them show in the browsers. From Dreamweaver I saved the page as in the folder where the images are and this also updated the code with the relative image links but the browsers still don't show them.
    I will greatly appreciate your help with this.

    I'm sorry, but your post is very confusing
    I saved as a complete web page on my hard disk this web page
    Does this include site definitions?
    when I open it in Firefox or IE, it doesn't display as much as I need it.
    I dont know what this means...are there images that are not being displayed?  Is there styling that is not being rendered?
    . I'm mostly interested  in displaying the logo images as they appear on the original web page. The browsers just show them briefly when refreshing but hide them right away.
    Again, I dont know what this means?
    I can see the image files downloaded to my hard drive and if I open the page in Dreamweaver it displays these images  in the preview pane but I can't make them show in the browsers. From Dreamweaver I saved the page as in the folder where the images are and this also updated the code with the relative image links but the browsers still don't show them.I will greatly appreciate your help with this.
    Do you have a link to the page, and perhaps some explanation that is more clear as to what your issue is.
    Gary

  • Help With Program Please

    Hi everybody,
    I designed a calculator, and I need help with the rest of the scientific actions. I know I need to use the different Math methods, but what exactly? Also, it needs to work as an applet and application, and in the applet, the buttons don't appear in order, how can I fix that?
    I will really appreciate your help with this program, I need to finish it ASAP. Please e-mail me at [email protected].
    Below is the code for the calcualtor.
    Thanks in advance,
    -Maria
    // calculator
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.border.*;
    public class calculator extends JApplet implements
    ActionListener
    private JButton one, two, three, four, five, six, seven,
    eight, nine, zero, dec, eq, plus, minus, mult, div, clear,
    mem, mrc, sin, cos, tan, asin, acos, atan, x2, sqrt, exp, pi, percent;
    private JLabel output, blank;
    private Container container;
    private String operation;
    private double number1, number2, result;
    private boolean clear = false;
    //GUI
    public void init()
    container = getContentPane();
    //Title
    //super("Calculator");
    JPanel container = new JPanel();     
    container.setLayout( new FlowLayout( FlowLayout.CENTER
    output = new JLabel("");     
    output.setBorder(new MatteBorder(2,2,2,2,Color.gray));
    output.setPreferredSize(new Dimension(1,26));     
    getContentPane().setBackground(Color.white);     
    getContentPane().add( "North",output );     
    getContentPane().add( "Center",container );
    //blank
    blank = new JLabel( " " );
    container.add( blank );
    //clear
    clear = new JButton( "CE" );
    clear.addActionListener(this);
    container.add( clear );
    //seven
    seven = new JButton( "7" );
    seven.addActionListener(this);
    container.add( seven );
    //eight
    eight = new JButton( "8" );
    eight.addActionListener(this);
    container.add( eight );
    //nine
    nine = new JButton( "9" );
    nine.addActionListener(this);
    container.add( nine );
    //div
    div = new JButton( "/" );
    div.addActionListener(this);
    container.add( div );
    //four
    four = new JButton( "4" );
    four.addActionListener(this);
    container.add( four );
    //five
    five = new JButton( "5" );
    five.addActionListener(this);
    container.add( five );
    //six
    six = new JButton( "6" );
    six.addActionListener(this);
    container.add( six );
    //mult
    mult = new JButton( "*" );
    mult.addActionListener(this);
    container.add( mult );
    //one
    one = new JButton( "1" );
    one.addActionListener(this);
    container.add( one );
    //two
    two = new JButton( "2" );
    two.addActionListener(this);
    container.add( two );
    //three
    three = new JButton( "3" );
    three.addActionListener(this);
    container.add( three );
    //minus
    minus = new JButton( "-" );
    minus.addActionListener(this);
    container.add( minus );
    //zero
    zero = new JButton( "0" );
    zero.addActionListener(this);
    container.add( zero );
    //dec
    dec = new JButton( "." );
    dec.addActionListener(this);
    container.add( dec );
    //plus
    plus = new JButton( "+" );
    plus.addActionListener(this);
    container.add( plus );
    //mem
    mem = new JButton( "MEM" );
    mem.addActionListener(this);
    container.add( mem );
    //mrc
    mrc = new JButton( "MRC" );
    mrc.addActionListener(this);
    container.add( mrc );
    //sin
    sin = new JButton( "SIN" );
    sin.addActionListener(this);
    container.add( sin );
    //cos
    cos = new JButton( "COS" );
    cos.addActionListener(this);
    container.add( cos );
    //tan
    tan = new JButton( "TAN" );
    tan.addActionListener(this);
    container.add( tan );
    //asin
    asin = new JButton( "ASIN" );
    asin.addActionListener(this);
    container.add( asin );
    //acos
    acos = new JButton( "ACOS" );
    cos.addActionListener(this);
    container.add( cos );
    //atan
    atan = new JButton( "ATAN" );
    atan.addActionListener(this);
    container.add( atan );
    //x2
    x2 = new JButton( "X2" );
    x2.addActionListener(this);
    container.add( x2 );
    //sqrt
    sqrt = new JButton( "SQRT" );
    sqrt.addActionListener(this);
    container.add( sqrt );
    //exp
    exp = new JButton( "EXP" );
    exp.addActionListener(this);
    container.add( exp );
    //pi
    pi = new JButton( "PI" );
    pi.addActionListener(this);
    container.add( pi );
    //percent
    percent = new JButton( "%" );
    percent.addActionListener(this);
    container.add( percent );
    //eq
    eq = new JButton( "=" );
    eq.addActionListener(this);
    container.add( eq );
    //Set size and visible
    setSize( 190, 285 );
    setVisible( true );
    public static void main(String args[]){
    //execute applet as application
         //applet's window
         JFrame applicationWindow = new JFrame("calculator");
    applicationWindow.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
         //applet instance
         calculator appletObject = new calculator();
         //init and start methods
         appletObject.init();
         appletObject.start();
    } // end main
    public void actionPerformed(ActionEvent ae)
    JButton but = ( JButton )ae.getSource();     
    //dec action
    if( but.getText() == "." )
    //if dec is pressed, first check to make shure there
    is not already a decimal
    String temp = output.getText();
    if( temp.indexOf( '.' ) == -1 )
    output.setText( output.getText() + but.getText() );
    //clear action
    else if( but.getText() == "CE" )
    output.setText( "" );
    operation = "";
    number1 = 0.0;
    number2 = 0.0;
    //plus action
    else if( but.getText() == "+" )
    operation = "+";
    number1 = Double.parseDouble( output.getText() );
    clear = true;
    //output.setText( "" );
    //minus action
    else if( but.getText() == "-" )
    operation = "-";
    number1 = Double.parseDouble( output.getText() );
    clear = true;
    //output.setText( "" );
    //mult action
    else if( but.getText() == "*" )
    operation = "*";
    number1 = Double.parseDouble( output.getText() );
    clear = true;
    //output.setText( "" );
    //div action
    else if( but.getText() == "/" )
    operation = "/";
    number1 = Double.parseDouble( output.getText() );
    clear = true;
    //output.setText( "" );
    //eq action
    else if( but.getText() == "=" )
    number2 = Double.parseDouble( output.getText() );
    if( operation == "+" )
    result = number1 + number2;
    else if( operation == "-" )
    result = number1 - number2;
    else if( operation == "*" )
    result = number1 * number2;
    else if( operation == "/" )
    result = number1 / number2;
    //output result
    output.setText( String.valueOf( result ) );
    clear = true;
    operation = "";
    //default action
    else
    if( clear == true )
    output.setText( "" );
    clear = false;
    output.setText( output.getText() + but.getText() );

    Multiple post:
    http://forum.java.sun.com/thread.jsp?forum=31&thread=474370&tstart=0&trange=30

  • Help with calling a java application from inside another one

    Hello!
    I am having this problem which is getting on my nerves and dont know how to solve..
    I want to call from my java application, another java application. So i use the exec command. Then i want to read the output of this execution from my own application, (the "parent" process).
    But it doesn work properly. Something seems to happen and i dont get the whole output.
    The java program i want to call is created for running an application created with Matlab java builder.
    This program works when called from cmd, but seems not to work when called from inside a java application.
    The code of my java application is:
    Runtime rt = Runtime.getRuntime();
    Process child;
    // The java class getmagic is a special kind of java file that uses classes that work in matlab. It uses a component (.jar) file that is created from matlab java builder. thats why it wants the -classpath and the rest options.
    //I hope you wont get messed up in here.
    String[] callAndArgs = {"java","-classpath",".;C:\\Program Files\\MATLAB\\R2006b\\toolbox\\javabuilder\\jar\\javabuilder.jar;..\\MagicDemoComp\\magicsquare\\distrib\\magicsquare.jar -Djava.library.path=C:\\Program Files\\MATLAB\\R2006b\\bin\\win32;","getmagic","4"};
    try{
    child = rt.exec(callAndArgs);
    InputStream is = child.getInputStream();
    InputStreamReader isr = new InputStreamReader(is);
    BufferedReader br = new BufferedReader(isr);
    String line;
    while ((line = br.readLine()) != null)
    System.out.println(line);
    is.close();
    System.out.println(child.waitFor());
    System.out.println("Finished");
    }catch(IOException e) {
    System.err.println("IOException starting process!");
    }catch(InterruptedException e) {
    System.err.println("InterruptedException starting process!");
    The java program (getmagic) thats uses matlab gives the following output (after some time) when called in cmd with argument 4
    Magic square of order 4
    16 2 3 13
    5 11 10 8
    9 7 6 12
    4 14 15 1
    My program shown above only prints:
    Magic square of order 4
    1
    Finished.
    Do i do something wrong? How can i get the rest of the output???
    Thank you very much in advance,
    Stacey
    PS: I am sorry for the length of my post.

    Hello CaptainMorgan08, thanx for the instant reply.
    I tried, but no, i cant.
    Because i cannot include this java aplication that uses matlab into my application, cause 1) it needs special arguments in the compiler and during execution so it can be run and 2) it uses classes that java doesnt have. only the java-like matlab code.
    For example it uses:
    import com.mathworks.toolbox.javabuilder.*;
    import magicsquare.*; //the component which is made from matlab java builder.
    So i cannot compile it with my application!
    If you know of a way, please let me know!
    I know i might be missing something.. something that is obvious to you.. but i ve been working days=nights hardly no sleep..so you can excuse me if i say something foolish..
    Message was edited by:
    Stacey_Gr

  • Errors with program that prevent skype from respon...

    Is anyone else having problems with program not responding? It seems to be related to ads because once the pop up box is closed, the ad shows up.... 
    jdm246

    What is the version of Internet Explorer installed on your computer?
    In Internet Explorer go to Help -> About Internet Explorer.
    Do you have the latest Adobe Flash Player for Interneet Explorer installed?
    What do you see when you open this link in your Internet Explorer?
    http://www.adobe.com/software/flash/about/
    P.S. Please, don’t say that you are not using Internet Explorer. This is irrelevant. Skype depends on Internet Explorer.

  • Help with selecting chuncks of data from a table

    Hi all,
    I need help with a query that should do the following.
    I have a table with vessel messages, and I need to get the last "NumMsgs" messages from a group of vessels.
    The problem I have is that if I order the table by Vessel_ID, MessageDate DESC, I can´t do ROWNUM < NumMsgs (<-- Then number of messages to be shown is a user parameter)
    I know it should be something like:
    select * from (
    select *
    from Messages m
    where TRIM(m.V_ID) = '11597' /* I was trying for a single vessel atm */
    order by m.V_ID, m.MESSAGEDATE desc
    where rownum < :NumMsgs
    Any ideas?
    Thanks in advance !

    Hi,
    What about :
    select *
    from (
    select m.*, row_number() (order by m.V_ID, m.MESSAGEDATE desc) rn
    from Messages m
    where TRIM(m.V_ID) = '11597' /* I was trying for a single vessel atm */
    where rn < :NumMsgsAnyway, I don't very well understand your problem, your query work fine, see for example :
    SQL> ed
    Wrote file afiedt.buf
      1  select object_name, object_id
      2  from
      3  (select object_name, object_id, row_number() over (order by object_id desc) as rn
      4   from dba_objects)
      5* where rn < 4
    SQL> /
    PS_TL_MTCHD_118     71763
    PS_TL_MTCHD_117     71762
    PS_TL_MTCHD_116     71761
    SQL> ed
    Wrote file afiedt.buf
      1  select object_name, object_id
      2  from
      3  (select object_name, object_id
      4   from dba_objects
      5   order by object_id desc)
      6* where rownum < 4
    SQL> /
    PS_TL_MTCHD_118     71763
    PS_TL_MTCHD_117     71762
    PS_TL_MTCHD_116     71761
    SQL> Nicolas.
    Message was edited by:
    N. Gasparotto

Maybe you are looking for