Recursive print / overwriting output-file

Hi there,
at the moment i am doing some research to Genetic Programming. I have implemented some expression trees ((a + b) * c) but have some problems printing the tree. Therefor i use a recursive method like tihs:
public void printInOrder(){
if(left != null){
System.out.print(" (");
left.printInOrder();               
System.out.print(" " + op);
if(right != null){
right.printInOrder();
System.out.print(" )");
Left and Right represent the Left-node and the Right-node of a Root-node. Look at the example function, the root is '*' and the left is a '+' and the right a 'c' etc..
+ c
a b
This works perfect and i have no problems printing the tree. The output is just as i wanted: (a + b) * c. But now i want everything to print to some output-file to save my trees. The problems is that the recursive method overwrites my file everytime it starts this method and therefor i only see the last part of the tree in the output-file.
Can someone say how i can print my trees without overwriting the output-file?
thnx Tindo

1. You could pass a stringBuffer to this method, append to it, and later print it.
2. Open the file in an append mode.

Similar Messages

  • Print a output file programatically

    Hi All,
    i work on 11.5.10 oracle applications. Issue is with printing the output file of a report.
    We have a requirement to print the out put of a report automatically to a printer.
    THe setup in the program definition for the report just prints for TEXT output and not for bitmap/pdf outputs. As i have barcode present in my report.
    So my main question is if i ahve an output file present in the db. can i use some plsql code to print it to a specific printer.
    The other option is to have a unix shell script. called by a concurretn pprog.
    CAn any help me with if its possible using plsql.
    Thanks

    You're best doing the printing from the operating system level and then from within PL/SQL you can use DBMS_SCHEDULER to schedule a job to run immediately to call the relevant operating system command/script.

  • Print to Output File

    Hi hope someone can help me,
    Just bought a hp wireless officejet 6500a plus printer.  I cannot get it to print as it goes as far as the final print then a small box comes up saying OUTPUT FILE and wants the output file.  The 'print to file' box in the File print menu is unticked so I am a bit at a loss how to fix it!
    Thanks
    ChristineK

    http://msdn.microsoft.com/en-us/library/cc280502.aspx
    Best Regards,Uri Dimant SQL Server MVP,
    http://sqlblog.com/blogs/uri_dimant/
    MS SQL optimization: MS SQL Development and Optimization
    MS SQL Consulting:
    Large scale of database and data cleansing
    Remote DBA Services:
    Improves MS SQL Database Performance
    SQL Server Integration Services:
    Business Intelligence

  • Adobe PDF printer - saves output file as filetype+filename need it to save only as filename

    I am using windows xp pro, when i create the pdf file with adobe PDF printer it creates the file name "Ami Pro - filename.pdf"  I really need it to create the file name as "filename.pdf".  Can you please help me - thank you

    Thank you Bernd - Explorer will let us change the file name one at a time, however I am creating numerous pdfs at a time, and its a pain to correct them one at a time, or to create a bat file to do this.  Does anyone know if the Adobe PDF printer has a feature that will eliminate the file type? thanks

  • How do you configure AME CS5.5 to overwrite existing output files?

    How do you configure AME CS5.5 to overwrite existing output files?  So far the only options I have found are to increment the output file name or fail.  From the explaination of file increment I would have expected overwrite to be the alternative.  We work daily with the same file(s) on an hourly basis and convert via watch folder to over a dozen file types and network mapped destinations.  Re-using the same file name is critical to the final project (updating website content). Does anyone have any suggestions?

    Has there been any updates on overwriting output files in CS6? This would be extremely helpful.

  • How to print a HTML file in browser look using DocPrintJob

    Hello guys,
    Does anyone know how to print HTML output/file into browser look?
    I'm using DocPrintJob and the DocFlavor set to DocFlavor.INPUT_STREAM.AUTOSENSE.
    posted below is my code :
    public class BasicPrint {
        public static void main(String[] args) {
            try {
                // Open the image file
                String testData = "C:/new_page_1.html";
                InputStream is = new BufferedInputStream(new FileInputStream(testData));
                DocFlavor flavor =  DocFlavor.INPUT_STREAM.AUTOSENSE;
                // Find the default service
                PrintService service = PrintServiceLookup.lookupDefaultPrintService();
                System.out.println(service);
                // Create the print job
                DocPrintJob job = service.createPrintJob();
                Doc doc= new SimpleDoc(is, flavor, null);
                // Monitor print job events; for the implementation of PrintJobWatcher,
                // see e702 Determining When a Print Job Has Finished
                PrintJobWatcher pjDone = new PrintJobWatcher(job);
                // Print it
                job.print(doc, null);
                // Wait for the print job to be done
                pjDone.waitForDone();
                // It is now safe to close the input stream
                is.close();
            } catch (PrintException e) {
                e.printStackTrace();
            } catch (IOException e) {
                e.printStackTrace();
        static class PrintJobWatcher {
            // true iff it is safe to close the print job's input stream
            boolean done = false;
            PrintJobWatcher(DocPrintJob job) {
                // Add a listener to the print job
                job.addPrintJobListener(new PrintJobAdapter() {
                    public void printJobCanceled(PrintJobEvent pje) {
                        allDone();
                    public void printJobCompleted(PrintJobEvent pje) {
                        allDone();
                    public void printJobFailed(PrintJobEvent pje) {
                        allDone();
                    public void printJobNoMoreEvents(PrintJobEvent pje) {
                        allDone();
                    void allDone() {
                        synchronized (PrintJobWatcher.this) {
                            done = true;
                            PrintJobWatcher.this.notify();
            public synchronized void waitForDone() {
                try {
                    while (!done) {
                        wait();
                } catch (InterruptedException e) {
    }the printed ouput for this code will be look like this
    <html>
    <body>
    <div style="page-break-after:'always';
                background-color:#EEEEEE;
                width:400;
                height:70">
         testPrint</div>
    ABCDEFGHIJK<p>
     </p>
    </body>
    </html>however, the output that i want is the HTML in browser look not HTML code itself.
    i've tried to change the DocFlavor into any TEXT_HTML type but it gives error:
    sun.print.PrintJobFlavorException: invalid flavor if you guys has any idea or solution, can you share with me... already search in Google but still not found any solution
    Thanks in advanced.

    hi,
    do the following
    URL url = null;
    try
         url = new URL("http://www.xyz.com");
    catch (MalformedURLException e)
          System.out.println("URL not correct " + e.toString());
    if (url != null)
           getAppletContext().showDocument(url,"_blank"); //shows the page in a new unnamed top level browser instance.
    }hope that helpz
    cheerz
    ynkrish

  • Virtual Printer - Saving prints as a file

    Hi,
    I need to setup a virtual printer such that, if anything is printed on that, it is saved as a file. This file sould contain printer instruction, which can then be sent to 3rd party for printing.
    Something like Microsoft Document Imaging.
    All this has to run in background.
    Can anyone help?
    Regards,
    Vikas

    Here's how to set up a virtual printer:
    Tx; SPAD-> create a device type -> in change mode clikck on access method tab -> from edit menu select Command set-> command set id field shows up -> enter a letter,  for ex:A , Doubble click on the field-> give a description-> enter cp &F /tmp/vpfile in command to transfer print data field -> enter echo ok in the last field.
    Host spool access method should be L in the printer definition.
    When you print using this printer, the output file copied to /tmp/vpfile folder.
    Regards
    Sridhar
    Message was edited by:
            Sridhar K

  • No printing :I can't print anymore, printing the same file with another programs is ok, printing form LR: Preparing  and Printing indicatorbar in the left hand upper corner are running, but no output at all rom my printer. I have been printing before. I u

    No printing :I can't print anymore, printing the same file with another program is ok, printing form LR (in the same system and printer of course :-) ): Preparing  and Printing indicatorbar in the left hand upper corner are running and completing, but no output at all to my printer. I have been printing before. Next I upgraded to LR5.7.1 but the problem stays. Perhaps some adjustment is changed by me unintentionally, but I have no idea. Does anybody know what to check? Printing to file is also strange,the canvas only seems to accept A4, and crops any image relative to that size, so a 10x15 cm print on 10 x 15 cm paper is cropped to 10x15/2. Anybody any idea? (system win 8.1 64, printer HP B8550)

    I accidentally solved my mystery.  For some reason it was set to "print to file".  I changed it to "printer" and now I am able to print.

  • Printing messages in Log File and Output File using Dbms_output.put_line

    Hi,
    I have a requirement of printing messages in log file and output file using dbms_output.put_line instead of fnd_file.put_line API.
    Please let me know how can I achieve this.
    I tried using a function to print messages and calling that function in my main package where ever there is fnd_file.put_line. But this approach is not required by the business.
    So let me know how I can achieve this functionality.
    Regards
    Sandy

    What is the requirement that doesn't allow you using fnd_file.put_line?
    Please see the following links.
    https://forums.oracle.com/forums/search.jspa?threadID=&q=Dbms_output.put_line+AND+Log+AND+messages&objID=c3&dateRange=all&userID=&numResults=15&rankBy=10001
    https://forums.oracle.com/forums/search.jspa?threadID=&q=%22dbms_output.put_line+%22+AND+concurrent&objID=c3&dateRange=all&userID=&numResults=15&rankBy=10001
    Thanks,
    Hussein

  • When I open up an e-mail attachment a box pops up PRINT TO FILE below that line OUTPUT FILE NAME with an empty line for the file name vs. simply going to my default printer?

    when I open up an e-mail attachment a box pops up PRINT TO FILE below that line OUTPUT FILE NAME with an empty line for the file name vs. simply going to my default printer?

    Make sure that '''''Print to File''''' isn't selected in the native print dialog box ''(see screenshot below)'' middle-right, and make sure your Printer is selected at the top of that dialog box.
    ''I'm a little confused why an email attachment would need to go directly to the printer, but that's what you asked about.''

  • Can I print to AdobePDF with a pre-determined output file name?

    I have a list of PDF files that I need to reduce in size. I have tried many combinations of Adobe's "Save As Reduced PDF", "Save As Optimized PDF", as well as several compression programs. The best results I've found have been to print the PDF via AdobePDF, using the standard quality settings.
    This leads me to my problem. It's simple to batch the print process to print multiple files to AdobePDF, however each one requires the user to specify the output file name. Is there a way to interface with the AdobePDF tool in a way that the output file name is already determined? I.e. passed into the program as an argument? Any help would be greatly appreciated.
    Thanks,
         Dan
    EDIT: Under the Adobe PDF Settings, the option for Adobe PDF OUtput Folder is set for Prompt for Adobe PDF filename. There is also an option to dump to Documents\*.pdf, which retains the original filename. Is there a way to specify a different directory, rather than Documents, while retaining the *.pdf argument? Again, thank you.

    You would probably get better results printing from Acrobat. The HTMLLoader rasterizes the image first. You could possibly add a JavaScript function inside the PDF that prints and call that from your AIR app.
    See http://www.adobe.com/devnet/air/flex/quickstart/scripting_pdf.html for information on calling JS functions in a pdf file from AIR.

  • Email conc program output file by using printer driver

    Hi ,
    we have one interface program which has been scheduled every week.
    My req is that after completing successfully/error the interface program i need to send an email to the given email address with output file as attachment.
    This should be happened through priter driver.
    Could anyone please help me on this.
    Thanks,
    Malla

    Hi Bhaskar,
    I appreciate for your reply.
    What I am looking for is that without writing any shell script is there any possible solution.
    Now I am getting an email without writing shell script but attachment is not coming with the email.
    My current process is that
    I am registering a printer and when create a driver for this i am giving parametes for command mode as
    $ uuencode $PROFILES$.FILENAME $PROFILES$.FILENAME_out|mailx -s $ $PROFILES$.FILENAME [email protected]
    I am able to get the email but no attachment.
    So Could you please tell me how to do that.
    Thanks,
    Malla

  • Capturing Lookout Print Panel Output to File

    I have tried setting my default printer to the FILE: port but do not get a dialog asking for the file to save to. All other programs printing to this printer ask for a filename but Lookout does not. How can I capture the panel printout to an EPS file?

    I've installed a while ago HP LaserJet 2100 Series PS driver and now I've tried to set up this driver to create an .eps file from Lookout panels. And, this worked pretty well with Lookout 5.0.
    1. Set the PS (postscript) printer driver to be default
    2. Configure the driver to point to a FILE: port (see image 1)
    3. Configure the driver to generate an .eps (General>Printing Preferences>Advanced>PostScript Options>PostScript Output Option set it to EPS (see image 2)
    4. Print Panel you will be prompt for file name and you could type e.g. c:\temp\testpanel.eps)
    Other PostScript printer should work defenitly too. You might consult your postscript printer manual on how to set it up to print a .eps
    Hope this helps.
    Roland
    PS: It might be the printer dri
    ver that does not prompt you. Which driver are you using? Which version of Lookout are you using?
    Attachments:
    PS2File.jpg ‏559 KB
    PSConfig.jpg ‏483 KB

  • Output Options -- Overwrite existing files

    I OCR multiple files from different locations routinely and need a better method to identify what files have previously been OCR'd.  My question has to do with the Output Options of the OCR multiple files function of Adobe 9.  It would seem to me that if I add "ocr" to the filename and check the overwrite existing files option that I would not end up with 2 files -- the original file and the OCR'd file with "ocr" added to the filename, but that is what happens.  Am I  doing something wrong or am I misinterpreting that function.
    Regards,
    Steve

    "Overwrite existing files" would control whether, if the file name you have chosen is already in use, whether that file is overwritten. There is no offer to "delete input file".

  • Cannot Print - Output File Name Requsted - Help

    I'm having problems printing.  I am using Reader 8 and everytime i try to print, a print to file box pops up, and requests and output file name and i don't know what that is.  Can anyone please tell me what this means and how i can resolve this issue. I can print everything else and there is no problem with my printer. I think the problem is w/ Reader.  Thanks.

    Delete ALL instances of your printer in the Printes & Faxes control panel. If your printer isn't using the latest drivers from the manufacturer Website, download/install them, then reconnect to your printer to add it back to your system. Once the printer with the latest drivers is reinstalled, see if Reader doesn't print correctly now.
    Let me know how it goes!
         Michael

Maybe you are looking for

  • HD NTSC to PAL Debacle

    Dear Compression sages, I'm attempting to convert my NTSC DVCpro HD 720 Quicktime to PAL to make a PAL DVD in DVDSP. So I need a PAL mpeg2. My trouble starts here. In compression I followed all the settings to convert to PAL. The resulting mpeg was a

  • IN Clause in Report

    Hi, I want to give mutiple parameters in report e.g. my query is select * from dept where departname in (Mutiple Values). When the report will run, user can enter either one OR mutiple departments.... Thanks John

  • Neither Firefox nor the profile manager will start. In my task manager, the process is using 50% of my cpu but does nothing. I love browsing with firefox, how can I fix this?

    I've tried restarting my computer, the I tried uninstalling and reinstalling, then uninstalling, erasing all firefox files and folders, then restarting and reinstalling. I've also tried opening the profile manager to change my profile. After reinstal

  • Sync encounters an unknown error everytime I try to sync

    Firefox Sync stopped working all of a sudden. It always says "Sync encountered an error while syncing: Unknown error. Sync will automatically retry this action." I've retried many many times. I even deactivated my Desktop account and then added it ag

  • How to remove I tunes competely?

    I have Windows XP, Service pack 3.  I touch 64 older version. My I touch crashed during upgrade to OS 4.3, and now I cannot recover lost data. This really ticks me off. I tried upgrading Itunes to 10.2.2.10, or the latest version. I think it is corru