SXPG_COMMAND_EXECUTE 1.) cd dir1 then 2.) mv myfile.txt ../dir2

Is it possible to execute a change directory with SXPG_COMMAND_EXECUTE and then again with a move statement?
Currently I get no error when I do the change directory command, but when I do a move file command, I get an error that the file could not be found?

Hi,
I would advise using this FM 'ARCHIVFILE_SERVER_TO_SERVER' and then delete the file (using DELETE DATASET or FM such as 'ISH_N2_DELETE_FILE_APP_SERVER') .
This way, you won't be annoyed if your server changes (to Windows, ...).
Best regards,
Guillaume

Similar Messages

  • Inconsistent "End of file error" on "open for access "myFile.txt"

    I have a script that accesses a txt file containing info needed for values in the script. Sometimes the script works flawless, but once I get the "End of file error," it won't work right anymore unless I log out and log back in or if I dump the file and rewrite it. Below is a copy of the portion of script having the problem:
    +set _fileRef to open for access "Library:Preferences:MyTextFile.txt" with permission+
    + set ReadMyTextFile to read _fileRef as string+
    + close access _fileRef+
    Is there a way to reset the "End of file" status so that I can access it later with the same script in one login session? I have a feeling that the first time it opens, that it reads to the end of the file and then closes the file. When it opens again the script starts to read where it left off at the end of the file. Does that sound right?
    Any help would be great.

    OK, it looks like if you are going to use the open for access..close access, you need to keep tack of the EOF yourself, so you can just read to the EOF - for example:
    <pre title="this text can be pasted into the Script Editor" style="font-family: Monaco, 'Courier New', Courier, monospace; font-size: 10px; padding: 5px; width: 720px; color: #000000; background-color: #E0E0E0; overflow: auto"> set TheOpenFile to open for access (choose file)
    try
    set SomeText to paragraphs of (read TheOpenFile to eof as text)
    close access TheOpenFile
    on error
    close access TheOpenFile
    end try
    choose from list SomeText with prompt "File text:" with empty selection allowed
    </pre>
    If there isn't any particular reason to explicitly open and close the file, you can use something like:
    <pre title="this text can be pasted into the Script Editor" style="font-family: Monaco, 'Courier New', Courier, monospace; font-size: 10px; padding: 5px; width: 720px; color: #000000; background-color: #E0E0E0; overflow: auto"> set SomeText to paragraphs of (read (choose file) as text)
    choose from list SomeText with prompt "File text:" with empty selection allowed
    </pre>
    In the above examples I used paragraphs of in order to use the choose from list, since it displays stuff like this a little bit better - see this article for a tutorial on file read/write in AppleScript.

  • How can I create a Document object from a text file (myFile.txt)

    Hi everybody:
    Thank you for reading this message.
    I am trying to find a method to convert a text file ( I have it in a File object) to a Document object.
    I read the Java API but it is strange, I do not know if I have to create an AbstractDocument, it is really strange for me.
    Any comment is welcome,
    Regards,
    JB

    Document is an interface, and AbstractDocument is abstract, so you
    can't create either of those directly. Assuming you are dealing with a
    a plain text file, you could do something like
    // Not catching any exceptions that get thrown
    File file = /* file you already have */
    String eol = System.getProperty( "line.separator" );
    int eolLen = eol.length();
    FileReader reader = new FileReader( file );
    BufferedReader buffer = new BufferedReader( reader );
    PlainDocument doc = new PlainDocument();
    for ( String line = buffer.readLine() ; line != null ; line = buffer.readLine() ) {
        int len = doc.getLength();
        if ( len > 0 ) {
            doc.insertString( len, eol, null );
            len += eolLen;
        doc.insertString( len, line, null );
    }and now you have a document.
    : jay

  • Reading in from File w/out path name

    Does anyone know why netbeans requires an entire path name to read from a file? I am trying to read from a file and I want the program to just look in the directory that the jar file is in to find the file to read from. I do not want the file to be IN the jar file, just inside that directory...

    As I understand it, when your code runs, it does not run relative to the folder that the jar file that contains it exists in. If you want to know where the code is running from in order to use relative path instead of absolute path, put this in your code and examine the output it generates:
    File file =new File("");
    System.out.println( file.getAbsolutePath() );
    Example: if the print out shows your code is running in:
    c:/ dir1 /dir2 / dir3
    and your file is in
    c: / dir2 /dirN / myFile.txt
    then your relative path would be:
    ../dirN/myFile.txt
    where starting from c:/ dir1 /dir2 / dir3, ../ means go one folder level "up" (to c:/ dir2 ), and dirN/ means from there, go down into the folder dirN (which would be c: / dir2 /dirN )

  • How to find a specific word in sentence in each line?

    How to find a specific word in sentence in each line and output will show start from the beginning from specific word plus with small description from each sentence?
    For example: I need to find a "+Wednesday+" and "+Thursday+" word in each sentence by line by line from "myfile.txt".
    Go ballet class next Wednesday.
    On the Wednesday is going to swim class.
    We have a meeting on Thursday at Panda's.
    Then it will show the output:
    Wednesday : ballet class
    Wednesday : swim class
    Thursday: meeting at Panda's
    I am going to figure out in Java console to read from a file for specific word from each line and how to make it output in correct way. I know already to make input/file codes.

    I got it and understand much better. Thank you very much. There is a problem with it because I knew how to make
    a specific word in sentence but how I should make Output for specific word and some words from sentence.
    For example:
    Input:
    +"On Thursday go to ballet class"+
    +"Swim class on Friday one time a month at 2 p.m."+
    I used the codes for that:
    class FindSchedule{
         String firstline = "On Thursday go to ballet class ";
         String secondline = "Swim class on Friday one time a month ";
         FindSchedule(){
              System.out.println(firstline + findTheIndex("Thursday", firstline));
              System.out.println(secondline + findTheIndex("Friday", secondline));
         public int findTheIndex(String word, String sentence){
              int index;
              index = sentence.indexOf(word);
              return index;
         public static void main (String[] args){
              new FindSchedule();
    }The output will be:
    Thursday: ballet class
    Friday: 14:00 swim class one time a week
    Notice that time is changing in output complete different from input.
    I need to find out how to extract some words from each sentence for output. Do you know how to do it?

  • Error while sending a text file to client as attachment

    I want to download a file on clicking a button. Here is my button code
    <input type="button" onClick="showdownloadwindow()" value="Download My file">
    The java script showdownloadwindow() should invoke a jsp that has code to construct the text file to be downloaded
    Here is the javascript function
    <script>
         function showdownloadwindow()
              var url = 'http://<%=request.getServerName()%>'+':'+<%=request.getServerPort()%>+'/downloadtextfile.jsp';     
              window.open(url,"","");
    </script>
    the downloadtextfile.jsp looks something like this
    <%
              response.setContentType("text/plain");
              response.setHeader("Content-disposition","attachment; filename=myfile.txt" );
              BufferedOutputStream bos = new BufferedOutputStream(response.getOutputStream());
              String temp="Put some text string for now";
              bos.write(temp.getBytes());
              bos.flush();
              bos.close();
              response.flushBuffer();
    %>
    i have two problems
    1. when the button "Download My file" is clicked a separate window is opened and then the save file dialog box appears. How can I change my code
    so that it only shows download window only ( not another browser window)
    2. myfile.txt contains some error in addition to the temp string
    Here is the error from myfile.txt
    <BR><H3>Original Exception: </H3>
    <B>Error Message: </B>SRVE0199E: OutputStream already obtained<BR>
    <B>Error Code: </B>500<BR>
    <B>Target Servlet: </B>/downloadtextfile.jsp<BR>
    <B>Error Stack: </B><BR>
    java.lang.IllegalStateException: SRVE0199E: OutputStream already obtained
    <BR>    
         at com.ibm.ws.webcontainer.srt.SRTServletResponse.getWriter&#40;SRTServletResponse.java:467&#41;
    <BR>    
         at org.apache.jasper.runtime.JspWriterImpl.initOut&#40;JspWriterImpl.java:170&#41;
    <BR>    
         at org.apache.jasper.runtime.JspWriterImpl.flushBuffer&#40;JspWriterImpl.java:163&#41;
    <BR>    
         at org.apache.jasper.runtime.PageContextImpl.release&#40;PageContextImpl.java:217&#41;
    <BR>    
         at org.apache.jasper.runtime.JspFactoryImpl.internalReleasePageContext&#40;JspFactoryImpl.java:149&#41;
    <BR>    
         at org.apache.jasper.runtime.JspFactoryImpl.releasePageContext&#40;JspFactoryImpl.java:117&#41;
    <BR>    
         at com.ibm._jsp._downloadtextfile._jspService&#40;_downloadtextfile.java:93&#41;
    <BR>    
         at com.ibm.ws.jsp.runtime.HttpJspBase.service&#40;HttpJspBase.java:88&#41;
    <BR>    

    > Channel FILE_TLE_Sender_SalesOrder_CC: Empty document found - proceed without sending message.
    > Can someone tell me why this error is happening? 
    Maybe your source file is empty?
    This is exact what the error message says.

  • Why can't install Oracle 8.1.7 in Redhat 7,1

    Please see this page first: http://linuxfab.cx/indexEasy.php
    if you really want to install, please run these files first:
    compat-glibc-6.2-2.1.3.2.i386.rpm
    compat-egcs-c++-6.2-1.1.2.9.i386.rpm
    compat-libs-6.2-3.i386.rpm
    compat-egcs-6.2-1.1.2.14.i386.rpm
    and try again.

    Here's the easy way to do it.
    1. Install EVERYTHING into your drive from Redhat 7.1; that's right choose 'EVERYTHING' when prompted at the 7.1 install.
    (You need about 2GB to fit the 7.1 install plus the additional 2GB for oracle)
    (Make a user named 'oracle' who will load and administer the database)
    2. Type the following at the root command prompt:
    groupadd oinstall
    groupadd dba
    groupadd oper
    useradd oracle -g oinstall -G dba,oper
    passwd oracle (it will prompt you for the password)
    3. (Now let's make the directories and assign ownership starting from the root directory)
    cd /
    mkdir oraclestage
    mkdir orahome
    mkdir ora1
    mkdir ora2
    mkdir ora3
    (the ora1,2,...etc should be mount points on different physical disks, but just make directories if you only have one disk)
    4. (Now assign ownership to the directories)
    chown oracle.dba /oraclestage
    chmod 775 /oraclestage
    chown oracle.dba /orahome
    chmod 775 /orahome
    chown oracle.dba /ora1
    chmod 775 /ora1
    chown oracle.dba /ora2
    chmod 775 /ora2
    chown oracle.dba /ora3
    chmod 775 /ora3
    (Next log out as root and log in as oracle using the password you assigned)
    5. (Now set up environmental variables IF YOU SCREW THIS UP IT WONT WORK!!!SO PAY ATTENTION)
    (Go into the place where user oracle's environment variables are kept...)
    cd /home/oracle
    more .bash_profile
    (look at your .bash_profile file. You're going to replace it with the one below...
    the easiest way to do this is to copy the contents of this file into Linux and save it as 'myfile', then place it in the /home/oracle directory. Then type:
    cp myfile .bash_profile
    at the command prompt. Say yes if asked to replace file)
    Here's the file contents:
    # .bash_profile
    # Get the aliases and functions
    if [ -f ~/.bashrc ]; then
    . ~/.bashrc
    fi
    # User specific environment and startup programs
    #PATH=$PATH:$HOME/bin
    #BASH_ENV=$HOME/.bashrc
    #export BASH_ENV PATH
    #unset USERNAME
    export LD_ASSUME_KERNEL=2.2.5
    ./usr/i386-glibc21-linux/bin/i386-glibc21-linux-env.sh
    ORACLE_BASE=/orahome; export ORACLE_BASE
    ORACLE_HOME=/orahome; export ORACLE_HOME
    ORACLE_SID=ORCL; export ORACLE_SID
    PATH=$PATH:/orahome/bin; export PATH
    CLASSPATH=:/orahome/jdbc/lib/classes111.zip; export CLASSPATH
    LD_LIBRARY_PATH=/orahome/lib; export LD_LIBRARY_PATH
    umask 022
    ORA_NLS33=/u01/app/oracle/product/8.1.7/ocommon/nls/admin/data; export ORA_NLS33
    NLS_LANG=american; export NLS_LANG
    5.1(notice the following lines:
    export LD_ASSUME_KERNEL=2.2.5
    ./usr/i386-glibc21-linux/bin/i386-glibc21-linux-env.sh
    These are designed to make oracle compatible with LINUX. The ./usr/i386...etc. is a script that has to fire off to make oracle 817 run off a backward version of the glibc library. If this script fails when logging into the box as user oracle, then run it from the command line after you get into the box. You may have to run it from root, but fire it off.
    6. Get your oracle817 tar file and copy it to the 'oraclestage' folder. Log in as root and untar it to expand it. The command is:
    tar xvf linux*...etc (whatever...)
    7. Next get the jdk118_v3 file from http://java.sun.com and put that on in your user/local directory. As the root user, untar it and make a symbolic link as follows:
    ln -s /usr/local/jdk118_v3 /usr/local/java)
    8. Go back to the /oraclestage as user 'oracle' and do a 'cd Disk1' at the command prompt and then do a './runInstaller' from the prompt. Keep in mind that you have to be in xwindows for the latter to work. Put oracle into the 'orahome' directory. You don't need all the obnoxious 12-mile-long path statements, just put the thing into orahome.
    That will get oracle817 going on your Redhat 7.1 box. It works for me. You don't have to deal with all that 'compat-glibc' loading shit. Just do an 'everything' install and it will work. Beside, what if you want to start using the box as a Linux box also? Do you want to keep searching for *.rpm files when you need extra functionality? Just throw them all in when you install.
    null

  • Java Program with Adapter / Facade Pattern

    Hey All:
    I'm very new to the Java language and have been given a fairly complicated (to me) program to do for a course I'm taking. The following is the scenario. I'll post code examples I have and any help will be greatly appreciated. Let me apologize ahead of time for all the code involved and say thank you in advance :).
    The program is the follow the following logic:
    Organizations A's Client (Org_A_Client.java) uses Organization A's interface (Org_A_Interface.java) but we want A's Client to also be able to use Organization B's services as well (Org_B_FileAuthorMgr.java, Org_B_FileDateMgr.java, Org_B_FileIOMgr.java).
    Now a portion of this program also involves validating an xml file to it's dtd, extracting information from that source xml file through the use of a XMLTransformation file, and applying the transformation to produce a targetxml file which is then validated against a target DTD. (I've done this portion as I have a much better understanding of XML).
    At this point we have been given the following java classes:
    Org_A_Client.java
    package project4;
    /* This class is the Organization A Client.
    It reads a source xml file as input and it invokes methods defined in the
    Org_A_Doc_Interface Interface on a class that implements that interface */
    import java.io.*;
    import java.util.Scanner;
    public class Org_A_Client {
         // Define a document object of type Org_A_Doc_Interface
         private Org_A_Doc_Interface document;
         // The Org_A_Client constructor
         public Org_A_Client() {
              // Instanciate the document object with a class that implements the
              // Org_A_Doc_Interface
              this.document = new Adapter();
         // The Main Method
         public static void main(String Args[]) {
              // Instanciate a Client Object
              Org_A_Client client = new Org_A_Client();
              // Create a string to store user input
              String inputFile = null;
              System.out.print("Input file name: ");
              // Read the Source xml file name provided as a command line argument
              Scanner scanner = new Scanner(System.in);
              inputFile = scanner.next();
              // Create a string to store user input
              String fileID = null;
              System.out.print("Input file ID: ");
              // Read the Source xml file name provided as a command line argument
              fileID = scanner.next();
              //Convert the String fileID to an integer value
              int intFileID = Integer.parseInt(fileID);
              if (inputFile != null && !inputFile.equals("")) {
                   // Create and empty string to store the source xml file
                   String file = "";
                   try {
                        // Open the file
                        FileInputStream fstream = new FileInputStream(inputFile);
                        // Convert our input stream to a
                        // BufferedReader
                        BufferedReader d = new BufferedReader(new InputStreamReader(
                                  fstream));
                        // Continue to read lines while
                        // there are still some left to read
                        String temp = "";
                        while ((temp = d.readLine()) != null) {
                             // Add file contents to a String
                             file = file + temp;
                        d.close();
                        // The Client Calls the archiveDoc Method on the Org_A_Document
                        // object
                        if (!file.equals("")) {
                             client.document.archiveDoc(file, intFileID);
                   } catch (Exception e) {
                        System.err.println("File input error");
              } else
                   System.out.println("Error: Invalid Input");
    Org_A_Doc_Interface.java
    package project4;
    /* This class is the Standard Organization A Document Interface.
    * It defines various methods that any XML document object
    * in Organization A should understand
    public interface Org_A_Doc_Interface {
         void archiveDoc(String XMLSourceDoc, int fileID);
         String getDoc(int fileID);
         String getDocDate(int fileID);
         void setDocDate(String date, int fileID);
         String[] getDocAuthors(int fileID);
         void setDocAuthor(String authorname, int position, int fileID);
    Org_B_FileAuthorMgr.java
    package project4;
    public class Org_B_FileAuthorMgr {
         // This function returns the list of file authors for the file that matches
         // the given fileID. For the purpose of the assignment we have not
         // provided any implementation
         public String[] getFileAuthors(String fileID) {
              // Since we do not have any implementation, we just return a
              // null String array of size 2
              return new String[2];
         // This function sets the authorname at a given position for the file that
         // matches the given fileID.
         // For the purpose of the assignment we have not provided any
         // implementation
         public void setFileAuthor(String authorname, int position, String fileID) {
    Org_B_FileDateMgr.java
    package project4;
    public class Org_B_FileDateMgr {
         // This function returns the creation date for the file that matches
         // the given fileID. For the puprposes of the assignment we have not
         // provided any implementation but only return a date string.
         String getFileDate(String fileID) {
              return "1st Nov 2007";
         // This function sets the creation datefor the file that
         // matches the given fileID.
         // For the puprposes of the assignment we have not provided any
         // implementation
         void setFileDate(String date, String fileID) {
    Org_B_FileIOMgr.java
    package project4;
    import java.io.*;
    public class Org_B_FileIOMgr {
         // This class variable stores the file location for all files
         private String fileLocation;
         // This function stores the given String of XMLTargetFile at the
         // fileLocation which is set using the setFileLocation method
         boolean storeFile(String XMLTargetFile, String fileID) {
              if (this.fileLocation != null) {
                   FileOutputStream out; // declare a file output object
                   PrintStream p; // declare a print stream object
                   try {
                        // Create a new file output stream
                        // connected to "myfile.txt"
                        out = new FileOutputStream(fileLocation);
                        // Connect print stream to the output stream
                        p = new PrintStream(out);
                        p.println(XMLTargetFile);
                        p.close();
                        System.out.println("MSG from Org_B_FileIOMgr: Target File Successfully Saved with ID " + fileID);
                   } catch (Exception e) {
                        System.err.println("Error writing to file");
                        return false;
                   return true;
              System.out.println("MSG from Org_B_FileIOMgr: Please set the File Location before storing a file");
              return false;
         // This function sets the fileLocation where the file will be stored for
         // archive
         void setFileLocation(String fileLocation) {
              this.fileLocation = fileLocation;
         // This function retreives the file that matches the given fileID and
         // returns its contents as a string
         // Only for the puprposes of the assignment we have not provided any
         // implementation
         String retrieveFile(String fileID) {
              return "This is the retreived file";
    }Also, we've been given the following two classes which I believe are used to help with the xml transformation using SAX (I've done alot of research regarding parsing XML using SAX/DOM so I understand how it works, but I'm really struggling with the integration...)
    FileDetailsProvider.java
    package project4;
    /* This is the FileDetailsProvider Class which implements the Singleton design pattern.
    The class can be used in the following manner:
         // Declare a object of the class type
            FileDetailsProvider fp;
            // Get the single instance of this class by calling the getInstance static method
            fp= FileDetailsProvider.getInstance();
            // Initialize the class with providing it the file name of our configuration XML file
              fp.loadConfigFile("C:\\assignment4\\XMLTransformerConfig.xml");
    import java.io.File;
    import javax.xml.parsers.SAXParser;
    import javax.xml.parsers.SAXParserFactory;
    public class FileDetailsProvider {
         private InputHandler handler;
         private SAXParserFactory factory;
         private SAXParser saxParser;
         private final static FileDetailsProvider INSTANCE = new FileDetailsProvider();
         // Private constructor suppresses generation of a (public) default
         // constructor
         private FileDetailsProvider() {
              // Create the content handler
              handler = new InputHandler();
              // Use the default (non-validating) parser
              factory = SAXParserFactory.newInstance();
              // Validate the XML as it is parsed by the SAX Parser: only works
              // for dtd's
              factory.setValidating(true);
              try {
                   saxParser = factory.newSAXParser();
              } catch (Throwable t) {
                   t.printStackTrace();
                   System.exit(0);
         // This is the public static method that returns a single instance of the
         // class everytime it is invoked
         public static FileDetailsProvider getInstance() {
              return INSTANCE;
         // After instantiation this method needs to be called to load the XMLTransformer Configuration xml
         // file that includes the xsl file details needed
         // for our assignment
         public void loadConfigFile(String configFile) {
              try {
                   INSTANCE.saxParser.parse(new File(configFile), INSTANCE.handler);
              } catch (Throwable t) {
                   t.printStackTrace();
                   // Exceptions thrown if validation fails or file not found
                   System.out.println();
                   System.out.println("C:\\Documents and Settings\\Jig\\Desktop\\Project 4\\Project4\\Transform.xsl");
                   System.exit(0);
         // This method return the xsl file name
         public String getXslfileName() {
              return handler.getXslfileName();
         // This method returns the xsl file location
         public String getXslfileLocation() {
              return handler.getXslfileLocation();
    InputHandler.java
    package project4;
    /* This class is used by the FileDetailsProvider Class to read the XMLTranformerConfig xml
    * file using a SAX parser which is a event based parser
    import org.xml.sax.Attributes;
    import org.xml.sax.SAXException;
    import org.xml.sax.SAXParseException;
    import org.xml.sax.helpers.DefaultHandler;
    public class InputHandler extends DefaultHandler {
         private String xslfileName = "";
         private String xslfileLocation = "";
         int fileName = 0, fileLoc = 0, DTDUrl = 0;
         boolean endOfFile = false;
         public InputHandler() {
         // Start XML Document Event
         public void startDocument() throws SAXException {
              super.startDocument();
         // End XML Document Event
         public void endDocument() throws SAXException {
              super.endDocument();
              // display();
         public void display() {
              System.out.println(xslfileName);
              System.out.println(xslfileLocation);
         public void startElement(String uri, String localName, String qName,
                   Attributes attributes) throws SAXException {
              String eName = localName; // element name
              if ("".equals(eName))
                   eName = qName; // not namespace-aware
              if (eName.equals("File Name:")) {
                   fileName++;
              } else if (eName.equals("File Location:")) {
                   fileLoc++;
         public void endElement(String uri, String localName, String qName)
                   throws SAXException {
              String eName = localName; // element name
              if ("".equals(eName))
                   eName = qName; // not namespace-aware
         public void characters(char ch[], int start, int length)
                   throws SAXException {
              String str = new String(ch, start, length);
              // Getting the Transform File Location
              if (fileLoc == 1 && xslfileLocation.equals("C:\\Documents and Settings\\Jig\\Desktop\\Project 4\\Project4\\")) {
                   xslfileLocation = str;
              // Getting the Transform File Name
              if (fileName == 1 && xslfileName.equals("Transform.xsl")) {
                   xslfileName = str;
         public void processingInstruction(String target, String data)
                   throws SAXException {
         // treat validation errors as fatal
         public void error(SAXParseException e) throws SAXParseException {
              throw e;
         // This method return the xsl file name
         public String getXslfileName() {
              return xslfileName;
         // This method returns the xsl file location
         public String getXslfileLocation() {
              return xslfileLocation;
    }I need to do the following:
    1. Create an adapter class and a facade class that allows Client A through the use of Organization's A interface to to use Organization B's services.
    2. Validate the Source XML against its DTD
    3. Extract information regarding the XSL file from the given XMLTransformerConfig xml file
    4. Apply the XSL Transformation to the source XML file to produce the target XML
    5. Validate the Target XML against its DTD
    Now I'm not asking for a free handout with this program completed as I really want to learn how to do a program like this, but I really don't have ANY prior java experience other than creating basic classes and methods. I don't know how to bring the whole program together in order to make it all work, so any guidance for making this work would be greatly appreciated.
    I've researched over 100 links on the web and found alot of useful information on adapter patterns with java and facade patterns, as well as SAX/DOM examples for parsing xml documents and validation of the DTD, but I can't find anything that ties this all together. Your help will be saving my grade...I hope :). Thanks so much for reading this.

    No one has anything to add for working on this project? I could really use some help, especially for creating the code for the adapter/facade pattern classes.

  • QUESTION ABOUT OUTPUTTING to a .txt File???

    I want to output some input to 3 different Output and then read those in later... my problem is HOW DO I SET 3 DIFFERENT OUTPUT FILES THAT WILL BE ABLE TO GET THE INPUT EVERY TIME THE PROGRAM IS RUN....?? I DO NOT WANT THE USER TO BE ABLE TO NAME THOSE FILES... I WANT THOSE FILES TO BE OPENED OR CREATED WHEN THE PROGRAM IS RUN... RIGHT NOW I JUST HAVE ALL THE INPUT GOING TO THE SCREEN AND THAT'S NOT WHAT I WANT IT TO DO.. I WANT THE INPUT TO GO TO SEPARATE 3 FILES...
    THANKS..
    import java.io.*;
    import java.lang.*;
    import java.util.*;
    public class Assemble
         public static void main(String args[]) throws IOException
              if (args.length > 0)
                   System.out.println("");
                   System.out.println("");
                   System.out.println("");
                   System.out.println("Assemble.class is a small program that");
                   System.out.println("takes in as input a body of text and then");
                   System.out.println("outputs the text in an order according to");
                   System.out.println("the tags that are placed in the input.");
              else
                   System.out.println("");
                   System.out.flush();     
         BufferedReader in = new BufferedReader (new InputStreamReader( System.in ));
         String input;                
         while (true)
              input = in.readLine();
              if (input == null)                          
                   break;
              else if ( (input.compareTo("<HEAD>")) == 0)
                   do
                        input = in.readLine();
                        if ( (input.compareTo("</HEAD>")) != 0)
                             System.out.println(input);
                   while ( (input.compareTo("</HEAD>")) != 0);
              else if ( (input.compareTo("<BODY>")) == 0)
                   do
                        input = in.readLine();
                        if ( (input.compareTo("</BODY>")) != 0)
                             System.out.println(input);
                   while ( (input.compareTo("</BODY>")) != 0);
              else if ( (input.compareTo("<FOOT>")) == 0)
                   do
                        input = in.readLine();
                        if ( (input.compareTo("</FOOT>")) != 0)
                             System.out.println(input);
                   while ( (input.compareTo("</FOOT>")) != 0);

    To write to a file, use PrintStream. It has a method println() like System.out, except you can specify a File as the target, e.g.:
    PrintStream ps=new PrintStream(new FileOutputStream(new File("myfile,.txt")));And to write a string to this file,
    ps.println(String);

  • Alex voice copyright question

    I'd like to know if apple has a copyright on the "Alex" voice itself. I'm a writer and I'm writing a series of poems about technology and computers. I really like the way the poems sound when read by a synthesized voice since it fits in with the technical vibe that I'm going for.
    If I was to record "Alex" reading my poems into an mp3, add some mood music using garage band, what are the copyright considerations? I'm looking for several answers to the different facets of this question, such as:
    Can I legally record the voice at all?
    Can I legally record the voice and release it as free content?
    Can I legally record the voice and release it as paid content (specifically, I'd like to release a companion CD with a book of poems)?
    If so, is it simply a matter of giving apple credit and a citation for the voice? Or would I actually owe them money since I used their voice to read my content and made some (small amount) of money off of it?
    If it's really an issue I can read the poems myself, trying to simulate a computerized voice, but I really like the "Alex" voice. It sounds like a neat mix of human and machine, sounding mechanical a large part of the time, but creepily human in others. It's a great effect, and really adds to the mood I am trying to establish with my series of tech poems.
    Anyway, thanks for your replies. I'm looking forward to anyone who can shed some light on this.

    I cannot comment on the legality issue.
    However I would like to give some guidance on how to record poetry using Alex.
    (1) You can record directly into an audio file.
    * Put your text into a plain text file (not formatted or rich text). One way to do this is with TextEdit.
    * Run Terminal, navigate (using "cd") to the folder containing that file. e.g. MyFile.txt
    * type the following:
    say -v Alex -f MyFile.txt
    You should then hear the text spoken by Alex. If it sounds the way you like it, then type
    say -v Alex -f MyFile.txt -o MyFile.aiff
    You will not hear anything, but the file "MyFile.aiff" will be created in the same directory. You can play this in the Finder, put it into iTunes, work with it in GarageBand, etc.
    The advantage of doing this, rather than plugging the audio output of your Mac into a recording device, is that the quality is maximum, there is no distortion, no added noise, no spectral imbalance, and the signal-to-noise ratio will be as good as it gets.
    (2) When recording poetry (or anything else), liberally add punctuation. Particularly in poetry at the ends of lines. Commas add a pause and a falling-rising pitch pattern. Exclamation marks will raise the pitch peaks of preceding accented words. An intervening blank line causes a new paragraph to begin, which inserts a larger pause and does lots of things to the pitch.
    Compare Alex synthesis of the following two passages. To do so, select all the text and then choose
    Safari>Services>Speech>Start Speaking Text
    Hit it once
    Big Frank bunts?
    Cepeda runs to field the ball, so does Hiller, so does Miller
    Miller hollers Hiller
    Hiller hollers Miller
    Haller hollers Hiller points to Miller with his fist
    And that's the Miller, Hiller, Haller hallelujah twist
    Hit it once,
    Big Frank bunts,
    Cepeda runs to field the ball, so does Hiller, so does Miller.
    Miller hollers Hiller,
    Hiller hollers Miller,
    Haller hollers Hiller, points to Miller with his fist.
    And that's the Miller Hiller Haller hallelujah twist!
    (this is from a song by Danny Kaye)
    You might not like that particular set of punctuation, but it illustrates the point.

  • Retrieving .txt file from jar for an applet

    I guess this is a newbie question but i checked the tutorial sessions and i am doing exactly what it says there but still...no luck:
    I'm trying to access a .txt. file stored in the .jar file where my applet .class file is stored. I'm using:
    String s = "myfile.txt";
    // get current Class loader
    ClassLoader cl = this.getClass().getClassLoader();
    FileInputStream is = new FileInputStream((cl.getResource(s)).toString());
    BufferedReader in = new BufferedReader(new InputStreamReader(is));But when the applet is viewer from the browser or from the appletviewer, i'm getting the FileNotFoundException:
    java.io.FileNotFoundException: jar:file:\C:\FeatureSelection\sFeatureSelection.jar!\myfile.txt (The filename, directory name, or volume label syntax is incorrect)
    I tried to use the following instead:
    FileInputStream is = new FileInputStream((myApplet.class.getResource(s)).toString());orFileInputStream is = new FileInputStream((getClass().getResource(s)).toString());but the same exception is still there.
    The jar file and the html file are all stored in this directory C:\FeatureSelection\
    The signed jar file is called sFeatureSelection.jar
    Any help would be greatly appreciated!
    Thanks.

    One way to get at files in a jar is to put the jar in the CLASSPATH and then just refer to the resource by its path in the jar. If the same path occurs in two different jars, then you only get the first one, based on the order of the jars in CLASSPATH, I think.
    The classloader is involved, which can be confusing, but an easy way to try this is:
    String s = "myfile.txt";
    URL u = this.class.getClassLoader().getResource(s);
    Object o = u.getContent();Now, you only really know that something matched that path and now it is in a URL.
    I think the Object will be a stream and you have to read() it or something.
    BTW: I encourage you to examine the URL, but it is not necessary to do so.
    If you have somehitng like a GIF image, then here is an example of how to work with that:
    http://www.devx.com/tips/Tip/5697
    Here is a way to get the bytes without involved the ClassLoader:
    http://www.javaworld.com/javaworld/javatips/jw-javatip49.html
    Take your pick.

  • Client_text_io does not write the file but does create it.

    Hello there!
    I have a form which generates a .txt file using client_text_io webutil function.
    this is the procedure:
    PROCEDURE CREA_FILE IS
    MYFILE CLIENT_TEXT_IO.FILE_TYPE;
    OUTFILE CLIENT_TEXT_IO.FILE_TYPE;
    MFILE VARCHAR2(1000);
    MLINE VARCHAR2(5000);
    RESP NUMBER;
    BEGIN
    MLINE:='LINE TO WRITE...';
    MFILE := C:\test.txt;
    OUTFILE := CLIENT_TEXT_IO.FOPEN(MFILE,'w');
    CLIENT_TEXT_IO.put_line(OUTFILE, MLINE || ' 123');
    CLIENT_TEXT_IO.Fclose(OUTFILE);
    EXCEPTION
         WHEN OTHERS THEN
         CLIENT_TEXT_IO.Fclose(MYFILE);
         message('ERROR: '||SQLERRM);
    END;
    It works on OAS 10g + forms 10g. the file is created fine, BUT I have tried with forms 11g unsuccessful.
    My forms 11g are running under weblogic and the RedHat server.
    Im running the forms app from my laptop Windows XP.
    I configured webutil as the MOS note said, the thing is, the file is created, but no data is writted.
    I can open the file test.txt but the line I tried to print is not there, the same thing with 10g and the file is good.
    help me please.

    What are you doing after writing to the file? Are you leaving the form? Forms performs event bundling when sending data over to java beans;
    v_FILE_HANDLE := CLIENT_TEXT_IO.FOPEN (FPATH, 'W'); most certainly uses get_custom_property at the end to retrieve the file handle from the bean which will cause a "synchronize" as data must be retrieved from the bean before continuing in the PL/SQL code whereas
    CLIENT_TEXT_IO.Put_line(v_FILE_HANDLE,v_string_prov);
    CLIENT_TEXT_IO.FCLOSE (v_FILE_HANDLE); most certainly uses set_custom_property which is a one-way street and data is bundled up and sent as one package. If you have e.g. a exit_form right after those calls there is a chance that forms waits for some other data to be sent over to the bean but won't send it, as the form doesn't exist anymore after the exit_form. The same would happen if you'd do a
    v_FILE_HANDLE := CLIENT_TEXT_IO.FOPEN (FPATH, 'R');
    CLIENT_TEXT_IO.FCLOSE (v_FILE_HANDLE); right after writing your form as fopen will cause the sync (with the possibility that java will still hold a file lock on the file as the fclose method won't be called).
    cheers

  • How to print only fatal error in log file in tomcat4.1

    Hi all ,i m using tomcat4.1
    1> i want to print only fatal error in log file ,but it print all thing in log file ,how i can avoid it(because i think this process is consuming my resource)
    assume below ip address is corect:
    this is exact printing in my log file
    .12.2.3.3  - - [24/Oct/2007:00:00:00 5050] "GET /menu/ir.jsp HTTP/1.1" 200 2828
    12.2.3.3  - - [24/Oct/2007:00:00:00 5050] "GET /menu/bottomAdv.jsp HTTP/1.1" 200 528
    12.2.3.3  - - [24/Oct/2007:00:00:02 5050] "GET /menu/alerts.jsp HTTP/1.1" 200 323
    12.2.3.3  - - [24/Oct/2007:00:00:02 5050] "GET /alerts/createAlertShow.jsp HTTP/1.1" 200 26140
    123.2.3. - - [24/Oct/2007:00:00:05 5050] "GET /menu/getsensex.jsp HTTP/1.1" 200 642
    12.2.3.3 - - [24/Oct/2007:00:00:05 5050] "GET /menu/latestRecommendation.jsp HTTP/1.1" 200 5210
    12.2.3.3 - - [24/Oct/2007:00:00:05 5050] "GET /portfolio/watchlist/displayWatchlistItemsShow.jsp?watchlistId=20070509013642953_1&watchlistName=First&refreshRate=900&flag=1 HTTP/1.1" 500 7257
    12.2.3.3  - - [24/Oct/2007:00:00:05 5050] "GET /menu/iwealthNewsScroller.jsp HTTP/1.1" 200 2828
    112.23.3  - - [24/Oct/2007:00:00:06 5050] "GET /menu/alerts.jsp HTTP/1.1" 200 323
    112.23.3 - - [24/Oct/2007:00:00:06 5050] "GET /menu/bottomAdv.jsp HTTP/1.1" 200 528
    12.2.3.3  - - [24/Oct/2007:00:00:07 5050] "GET /menu/alerts.jsp HTTP/1.0" 200 323
    12.2.3.3 - - [24/Oct/2007:00:00:09 5050] "POST /Transaction/equity/modifyConfirmShow.jsp?DelId=0 HTTP/1.1" 200 28661
    12.2.3.3  - - [24/Oct/2007:00:00:09 5050] "GET /menu/getsensex.jsp HTTP/1.1" 200 6422>what will happen if i change timestamp="false" and what is the significance of verbosity="1" or "2" or "3" ,or "4" and what happen if i change debug="1" or other in below code
    <Logger className="org.apache.catalina.logger.FileLogger" debug="0" directory="logs" prefix="www.xyz_log." suffix=".txt" timestamp="true" verbosity="4"/>Edited by: Deepak23 on Oct 24, 2007 10:41 PM
    Edited by: Deepak23 on Oct 24, 2007 11:16 PM

    One of my standard answers (which will explain the use of Directory Objects)...
    The UTL_FILE_DIR parameter has been deprecated by oracle in favour of direcory objects because of it's security problems.
    The correct thing to do is to create a directory object e.g.:
    CREATE OR REPLACE DIRECTORY mydir AS 'c:\myfiles';Note: This does not create the directory on the file system. You have to do that yourself and ensure that oracle has permission to read/write to that file system directory.
    Then, grant permission to the users who require access e.g....
    GRANT READ,WRITE ON DIRECTORY mydir TO myuser;Then use that directory object inside your FOPEN statement e.g.
    fh := UTL_FILE.FOPEN('MYDIR', 'myfile.txt', 'r');Note: You MUST specify the directory object name in quotes and in UPPER case for this to work as it is a string that is referring to a database object name which will have been stored in uppercase by default.

  • How do I open to a specific page or destination in a pdf file using Buddy API Xtra?

    Hello,
    I'm working with a CD ROM catalog that utilizes the Buddy API Xtra to open PDF files when a link is clicked. The client would like to be able to open to a specific page within a pdf file.
    I can open a pdf file using the Buddy API baOpenfile() function but I'm having trouble opening to a specific page when I add #page=4:
    baOpenfile("@\pdfs\Powder Cores\Magnetics_Powder_Core_Catalog_2011.pdf#page=4","normal")
    I've also tried working with the code below which seems to me like it should work... I didn't realize that the "open..." part of it was a function in Director.
    on mouseUp me
      pageNum = 4
      theApp = baShortFileName(baFindApp("pdf"))
      theDoc = baShortFileName("@\pdfs\Powder Cores\Magnetics_Powder_Core_Catalog_2011.pdf")
      theArgs = "/s /A page=" & string(pageNum)   & "&pagemode=bookmarks"
      -- (translates to "/A page=4" in this example)
      open theApp && theArgs && theDoc
    end
    Thoughts?
    Thank you in advance!

    Thank you Dee! This works perfect!
    It would be cool to know how to use bashell() for this.
    The help files give the following examples:
    Result = baShell( Operation, Filename, Args, WorkDir, State )
    ok = baShell( "open", "c:\windows\notepad.exe", "myfile.txt" , "", "normal" )
    ok = baShell( "edit", "myfile.htm" , "", "", "normal" )
    So I tried:
    on mouseUp me
      -- Close the program group
      tWindowList = baWindowList( "" , "pdf" , false )
      if tWindowList <> [] and count(tWindowList) > 0 then  baCloseWindow(tWindowList[1])
      pageNum = 4
      theApp = baFindApp("pdf")
      theDoc = _movie.path & "pdfs\Powder Cores\Magentics Powder Core Catalog.pdf"
      theArgs = "/A "&QUOTE&"page="&string(pageNum)&"=OpenActions"&QUOTE
      baShell( "open", theApp, theDoc , theArgs, "normal" )
    end
    It opens the pdf file without going to a specific page. Any thoughts as to why it wouldn't accept theArgs?
    Thanks again!

  • How to copy a file from one folder to another folder in Linux

    Hello everyone,
    Oracle forms 11g 11.1.2.0.0
    OS: Oracle Linux
    We use webutil to upload files to the application server from the client machine, and stores them in a folder named JOB_DOCS on the application server (This folder is created as a databse directory too). File types are JPEG, GIF, PDF, TXT, BMP, DOC, XLS etc...
    At a later stage when the user tries to view the uploaded documents, this was not getting displayed on the screen
    on our windows server, when the user clicks on the print button we copy the file from the JOB_DOCS folder to the forms\java folder using the below command
    HOST('COPY ' ||d:\JOB_DOCS\test.pdf||' '||'c:\oracle\middleware\as\forms\java\test.pdf ,NO_SCREEN);
    once the file is under the forms\java folder then it is getting displayed on the screen to print or save, and later we remove the file from forms\java folder.
    But my problem here is, recently we have installed our application on Oracle Linux server, and we have JOB_DOCS folder there, and the users can upload files to this folder also. How can we copy the file test.pdf from JOB_DOCS to forms/java in linux?
    And what could be the reson for the document cannot be accessed from the folder where it is saved? We tried giving folder permissions, adding the folder to PATH variable etc.

    For copying and moving directories you can use the cp and mv commands just like you use them with files. Yeah, I know. If you've already tried to copy a directory with cp, you've probably noticed that cp just complains at you. Probably it says something like cp: omitting directory yadda yadda. You see, the cp command wants you to use the -r option if you want to copy a directory with its contents. The -r means "copy recursively":
    $ cp -r dir1 dir2
    The above creates a directory named dir2 whose contents will be identical to dir1. However, if dir2 already exists, nothing will be overwritten: the directory dir1 will be copied into the dir2 directory under the name dir2/dir1.
    When renaming directories, you use the mv command exactly the same way as with files:
    $ mv dir1 dir2
    When dealing with directories, mv works a bit like cp does. If dir2 doesn't exist, the above will rename dir1 to dir2, but if dir2 exists, the directory dir1 will be moved into the dir2 directory under the name dir2/dir1.
    ref http://www.tuxfiles.org/linuxhelp/dirman.html

Maybe you are looking for

  • How do I use NI-Motion tools to directly control a P70360?

    I can currently control a P70360 via modbus commands. I am interested in using NI-Motion routines to do this, if possible. But all the examples and VIs seem to assume there is an intermediary controller card, between the AC Drive and my labview app.

  • Background image and buttons

    I got 4 different images. I want to use these images as a background. They have to change as soon as the buttons is clicked. I got four buttons. Name of the pichtures image1.jpg etc the buttons btn1 etc I think its possible but i dont know how to wor

  • Save As options in photoshop

    Hi All, my folder structure is D:\Work\final\webfiles. i have files in webfolder as RGB mode and i need to save as CMYK in the D:\Work\final folder. Please help us to solve. Regards, Vinoth

  • [SOLVED]Yajl 2.0 disabled yaourt

    after upgrading to yajl 2.0 today every yaourt operation about package results in: package-query: error while loading shared libraries: libyajl.so.1: cannot open shared object file: No such file or directory is there any temporary way to workaround i

  • LR and networked HP B9180

    Hi there, Just wondering if anyone has the above set up, and manages to print out more than 10 pages of contacts at a time? I've moved over from a Canon printer, and finding it very difficult to get a smooth work flow - the contacts get sent to the p