Merging RTP streams and writing to file

I'm am in the middle of project using JMF i'm trying to merge incoming RTP streams and write them to file but i always have problem with formats. I have created processor with merged DataSource i set ContentDescriptor to different FileTypeDescriptors and tried to transcode the RTP streams to different formats, but always processor couldnt realize because of this error:
Unable to handle format: LINEAR, 8000.0 Hz, 16-bit, Mono, LittleEndian, Signed
Unable to handle format: LINEAR, 8000.0 Hz, 16-bit, Mono, LittleEndian, Signed
Could someone tell me what content descriptors i need to use and what formats to solve this problem. Any help will be appreciated.
Message was edited by:
kaligula

Hello,
Here is a procedure i wrote to write on text files the content of any table (and also generate the insert SQL order)
http://oracle.developpez.com/sources/?page=developpement#Extraction_table
You can download the script file here http://sheikyerbouti.developpez.com/src/extraction_table.zip
Hope this help you.
Francois

Similar Messages

  • File importer detected an inconsistency in the file stucture of (file name). Reading and writing this file's metadata (XMP) has been disabled.

    I have duplicated a project to work on another computer. The project opens fine but when I import new footage/audio files I get this message. "File importer detected an inconsistency in the file stucture of (file name). Reading and writing this file's metadata (XMP) has been disabled." Then I can't play my timeline and Premier Pro crashes.  I have to force quit and restart my computer to continue working. What does this error really mean? How do you rectify?
    Our workflow requires that we duplicate projects to make updates because we are frequently revising but need to keep original project unchanged and intact.

    I have a similar issue and message , but occurs when I import AVI clips from OnLocation CS4 to Premier Pro CS4.

  • Rreading and writing this file's metadata (xmp) has been disabled. Renders unplayable/corrupted files

    Hi everyone,
    I've been using Premiere Pro CC for a while now, as I have a YouTube channel, and I've rendered, exported and edited around a dozen different videos, and have had no issues until now. I haven't done anything to my settings, but randomly, I am now unable to export any videos. I've tried exporting multiple times, using different formats, and I still get the same error:
         File importer detected an inconsistency in the file structure of [FILE NAME]. Reading and writing this file’s metadata (XMP) has been disabled.
    I've looked around, and I've seen just about no help in fixing the issue, so I was hoping that someone could help me out.
    Some of my computer details are:
    Premiere Pro CC
    Toshiba Z10T
    Windows 8.1
    Hopefully that's enough to go by
    Thanks guys

    After moving LR3.5 and catalogs to a new computer running Windows 7 and LR from an XP system, I suddenly had 6400 files with exclamation points--failure to synch metadata or similar warnings on every file.  If I thought I had one without the error, if I clicked on it--there error showed up.    It was very frustrating and I was wondering if I was going to have to keep my old computer forever.
    After I searched for a couple of hours and found that there have been several discussions concerning failures to sync xmp sidecar files and failures to write metadata on this forum and others.  Some of the postings had angry rants against Adobe.  On my system, it was not Adobe that should be blamed, it was Microsoft:
    On one of the Adobe threads, I noticed a post that the person had multiple external drives and the problem did not show itself on one drive.  The person said that changing the permissions on the other hard drives solved the problem.   I tried this and it worked for me.  I did not have this problem with this same drive on my XP system.  I will try to find that other forum and thank the person who gave me the solution.

  • Play an rtp stream and save at the same time

    Hello
    How cam i play and save at the same time an rtp stream.
    can anyone help me about this.
    Thanks

    Hello
    How cam i play and save at the same time an rtp stream.
    can anyone help me about this.
    Thanks

  • Reading and Writing to files in JARs

    I'm making a card game (TriPeaks). I need to store the scores for the users in files. Everything worked fine until I packaged it into a JAR. I tried using getClass().getResource(fileName); and then converting the URL to a URI to create the File object. That gave me an error saying the URI wasn't hierarchical.
    So I Googled around and found that I can use:
    InputStream is = getClass().getResourceAsStream(fileName);
    try {
        BufferedReader in = new BufferedReader(new InputStreamReader(is));
        //read the file, etc.
        is.close();
    catch (IOException eIO) { }That works both in and out of the JAR. However, I still can't write the scores to the files. I know that you can write to a file inside a JAR because I created another program that writes its settings to a file. However, that program has its settings file in the same folder (the root of the JAR) as the .class file in the JAR. The scores, however, are in a subfolder in the JAR file.
    How would I write to the files in the subfolder in the JAR file?

    Vetruvet wrote:
    Why wouldn't there be such a useful feature in the API?Because it's extremely difficult to implement. Let me give you a quick description of how a jar file is structured. It uses the ZIP format that's been around for about 30 years now. The contents of a ZIP archive are arranged like this:
    - Header information
    - Compressed file #1
    - Compressed file #2
    - ... and so on ...
    - Directory with pointers to offsets of the compressed files.
    So when you want to get a file from the archive, you go to the end and find the directory. You search it for the file you want to get and find its offset, then you go there and decompress the file that's there.
    Now consider trying to update one of these files. The compressed version of the new file may well differ in size from the existing file in the archive. So you'd have to do something intrusive and expensive like moving all the files after it, including the directory, or just adding it after the last compressed file and moving the directory.
    And doing this would mess up things in the case where another thread or process or object (e.g. a URLClassLoader) was already using the archive.
    It just isn't practical. So consider JAR and ZIP archives as read-only. That's what they were designed for in the first place anyway.

  • RTP streaming and Cisco IP phones problem

    Hello,
    I'm trying to write an application that should dial some numbers and play the voice message from the file into the phone line using Cisco JTAPI and Java Media Framework.
    I've found some samples, that seems useful for me, but unfortunately they does not work. There are no any errors and no exceptions, I have no idea what to do.
    Small brief: I make a call from one Cisco IP phone (7960) to another using Cisco JTAPI, then I catch the CiscoRTPInputStartedEv event, get the IP and port of the IP Phone and call the RTPStreamer class constuctor with them. It gives no any errors or exceptions (just a message shown below), but there is only silence in the phone line. Message:
    Should b streamin'...
    Encoding ok?: true
    streams is [Lcom.sun.media.multiplexer.RawBufferMux$RawBufferSourceStream;@53d : 1
    sink: setOutputLocator rtp://192.168.1.22:20794/audio
    Please see the RTFStreamer class code below.
    I set the packet size to 160 as reccomended for Cisco IP phones, I use the greeting.wav from Cisco example that properties are 8Khz 8bit mono, but it still doesn't work.
    Could you help me? Thank you for any advice!
    import java.io.* ;
    import java.util.* ;
    import java.net.* ;
    import javax.media.* ;
    import javax.media.control.* ;
    import javax.media.format.* ;
    import javax.media.protocol.* ;
    import stream.*;
    public class RtpStreamer
         public static int PlayCounter = 0;
         private RtpStreamer()
              // not supported
         public RtpStreamer(String IP, String Port)
              PlayCounter++;
              new RtpStreamer("rtp://" + IP + ":" + Port + "/");
         public RtpStreamer(String CurrentMediaUrl)
              PlayCounter++;
         System.out.println("Should b streamin'...");
         // Create a Processor for the selected file. Exit if the
         // Processor cannot be created.
         Processor processor = null;
         StateHelper sh = null;
         try
                   String mediaUrl = "file:\\C:\\greetings.wav";
         processor = Manager.createProcessor( new MediaLocator(mediaUrl));
         sh = new StateHelper(processor);
         catch (IOException e)
         System.out.println("Exception occured (1a): " + e);
         catch (NoProcessorException e)
         System.out.println("Exception occured (1b): " + e);
         // for loggin purpose
         //sh.setContext( getServletContext() );
         // configure the processor
         if (!sh.configure(10000))
         System.out.println("Configuration failed!!");
         // Block until the Processor has been configured
         TrackControl track[] = processor.getTrackControls();
         boolean encodingOk = false;
         // Go through the tracks and try to program one of them to
         // output ulaw data.
         for (int i = 0; i < track.length; i++)
         if (!encodingOk && track[i] instanceof FormatControl)
         if (((FormatControl)track).setFormat( new AudioFormat(AudioFormat.ULAW_RTP,8000,8,1)) == null)
         track[i].setEnabled(false);
         else
         encodingOk = true;
         else
         // we could not set this track to ulaw, so disable it
         track[i].setEnabled(false);
                   // set packet size to 160
                   try
                        Codec codec[] = new Codec[3];
                        codec[0] = new com.ibm.media.codec.audio.rc.RCModule();
                        codec[1] = new com.ibm.media.codec.audio.ulaw.JavaEncoder();
                        codec[2] = new com.sun.media.codec.audio.ulaw.Packetizer();
                        ((com.sun.media.codec.audio.ulaw.Packetizer)codec[2]).setPacketSize(160);
                        ((TrackControl)track[i]).setCodecChain(codec);
                   catch (Exception e)
                        System.out.println("Error setting packet size in 160: " + e + " in " + e.getMessage());
         System.out.println("Encoding ok?: " + encodingOk );
         // At this point, we have determined where we can send out
         // ulaw data or not.
         // realize the processor
         if (encodingOk)
         if (!sh.realize(10000))
         System.out.println("Realization failed!!");
         // block until realized.
         // get the output datasource of the processor and exit
         // if we fail
         DataSource ds = null;
         try
         ds = processor.getDataOutput();
         catch (NotRealizedError e)
         System.out.println("Exception occured(2): "+e);
         // hand this datasource to manager for creating an RTP
         // datasink.
         // our RTP datasink will multicast the audio
         try
         //String mediaUrl= "rtp://192.168.1.12:20002/audio/1"; // it works without errors
                        String mediaUrl= CurrentMediaUrl + "audio";
         MediaLocator m = new MediaLocator(mediaUrl);
         DataSink d = Manager.createDataSink(ds, m);
         d.open();
         d.start();
         catch (Exception e)
         System.out.println("Exception occured(3): "+e);

    BTW is there any solution to figure out if the RTP application makes any network activity or not?

  • Create and writing xml file

    Hi all.
    I'm starting to learn Java. In my project, I have a class data structure, and I want to save its information into xml file for record. But I'm not sure how to do..
    Does java provide easier interface to construct an XML file ? or I need to use OutputStream ?
    Can anyone give me some examples or teach me how to do?
    many thanks

    Hi,
    The code you have written looks great and nothing really needs to be changed. I will offer a couple of comments though.
    The first is that there is an easier API for adding attributes that you might wish to use. The following:
    rootElement.setAttribute(Tag_Version, "3");Is equivalent to:
    Attr atr = document.createAttribute(Tag_Version);
    atr.setValue("3");
    rootElement.setAttributeNode(atr);Also whenever possible I prefer to use standard APIs rather than proprietary ones. I took your code and rewrote it using JAXP APIs, more code is required since JAXP does not offer the same convenience as the XDK but multiple parsers support the JAXP standard (including the XDK) and this makes your code portable across different parser implementations.
    import java.io.FileOutputStream;
    import java.io.OutputStream;
    import javax.xml.parsers.DocumentBuilder;
    import javax.xml.parsers.DocumentBuilderFactory;
    import javax.xml.transform.Transformer;
    import javax.xml.transform.TransformerFactory;
    import javax.xml.transform.dom.DOMSource;
    import javax.xml.transform.stream.StreamResult;
    import org.w3c.dom.Document;
    import org.w3c.dom.Element;
    public class Example {
        private static String Tag_Main = "main";
        private static String Tag_Version = "version";
        private static String Tag_SetupName = "setup-name";
        private static String Tag_Remarks = "remarks";
        public static void main(String[] args) throws Exception {
            OutputStream outStream = new FileOutputStream("abc.xml");
            DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
            DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
            Document document = documentBuilder.newDocument();
            Element rootElement = document.createElement(Tag_Main);
            rootElement.setAttribute(Tag_Version, "3");
            document.appendChild(rootElement);
            Element em = document.createElement(Tag_SetupName);
            em.appendChild(document.createTextNode("Setup 1"));
            rootElement.appendChild(em);
            em = document.createElement(Tag_Remarks);
            em.appendChild(document.createTextNode("My Testing"));
            rootElement.appendChild(em);
            TransformerFactory transformerFactory = TransformerFactory.newInstance();
            Transformer transformer = transformerFactory.newTransformer();
            DOMSource source = new DOMSource(document);
            StreamResult result = new StreamResult(outStream);
            transformer.transform(source, result);
            outStream.flush();
            outStream.close();
    }-Blaise

  • Reading and writing to file , getting null when i try to  read file content

    i start by apologizing incase i have posted this question in the wrong forum
    i am trying to iterate through a directory tree and pick all the subdirectories and put them in an arraylist . on the other hand , i am picking all the files and putting them in a different arraylist . After that i iterate through the arraylist , pick a folder , create a file in it search for all the files of the same type in its subfolders and write them to the newly created file
    The problem i am running into is i i can't read the files and hence i can't write to the file .
    My directory tree is in the format
    c:\KPCData\\01\01\01\01\01\ file1_type1
    c:\KPCData\\01\01\01\01\02\ file2_type1
    where one one of the types is "covers" . i know this could be asking too much but i am at my tethers end , could someone please have a look at the code and tell me where i might be going wrong . you could zero in on the part where i have ************ before the a line of code thank you package directories;
    import java.io.*;
    import java.util.*;
    public class Directories {
    private static  ArrayList direcs= new ArrayList();
    private static  ArrayList census= new ArrayList();
    private static ArrayList vagrant= new ArrayList();
    private static ArrayList hotel= new ArrayList();
    private static ArrayList emigrant= new ArrayList();
    private static ArrayList traveller= new ArrayList();
    private static ArrayList longform= new ArrayList();
    private static ArrayList cover= new ArrayList();
    private static String parentPath = null;
    private static File mycover = null;
    private static File mytravel = null;
    private static File myemigrant = null;
    private static File mylong= null;
    private static File myinstitution = null;
    private static File myvagrant = null;
    private static BufferedReader in;
    private static BufferedWriter out;
    private static String read,toread;
    //function for listing the folder contents
    class compareDirs implements Comparator
    public int compare(Object one, Object two)
         int val=0;
         File file1 = (File)one;
         File file2= (File)two;
         String name1 = file1.toString();
         String name2= file2.toString();
         if (name1.length()==name2.length())
         val= name1.compareTo(name2);
         else
              if( name1.length()>name2.length())
                   val=-1;
              if (name1.length()<name2.length())
                   val=1;
         return val;
    private  ArrayList recurs(File dir,File file) throws IOException
         File []files=dir.listFiles();
         for(int index=0;index<files.length ;index++)
              if(files[index].isDirectory())
                   recurs(files[index],file);          
              }//if
              else
                  census.add(files[index]);     
         }//for index
         return census;
    } //recurs
    //function for determining the number and paths of the folders
    private ArrayList numDirs(File dirs)
         File []files=dirs.listFiles();
         for(int index=0;index<files.length ;index++)
              if(files[index].isDirectory())
                   if (direcs.contains(files[index])==false)
                   direcs.add(files[index]);
                   numDirs(files[index]);     
              }//if
         }//for index
         return direcs;
    public static void main(String[]args) throws IOException
              File myfile = new File("C:\\KPCData");
         File myfile2= new  File("C:\\KPCData\test.txt");
         Directories dir = new Directories();
         if (myfile.isDirectory())
         ArrayList myList=dir.recurs(myfile,myfile2);
         ArrayList mydir1 = dir.numDirs(myfile);
        ArrayList mydirs = new ArrayList();
        mydirs.add(mydir1.get(0));
         for (int x=0;x<mydir1.size();x++)
         {  int count=0;
              for (int y=0;y<mydirs.size();y++)
                   if (x==y)
                        count++;
              if (count<1)
                   mydirs.add(mydir1.get(x));
         Collections.sort( mydirs,dir.new compareDirs() );     
            for(int index1 =0 ;index1<mydirs.size();index1++)//print out directories
              File mydir=(File)mydirs.get(index1);
              File directory= (File)mydirs.get(index1);
              if(!mydir.getPath().contains("00"))//// if not leave node  create files for each file type
                   String name1 =mydir.getPath();
                   ArrayList ray=new ArrayList();
                   String name="K";
                 for (int index=0;index<name1.length();index++ )
                          if (name1.charAt(index)!='\\'&&name1.charAt(index)!='C'&&name1.charAt(index)!=':'&&name1.charAt(index)!='K'&&name1.charAt(index)!='P'&&name1.charAt(index)!='D'&&name1.charAt(index)!='a'&&name1.charAt(index)!='t')
                       name =name+(String.valueOf(name1.charAt(index)));
              // create a string
                  name= name.substring(1);
                   String trial = name+"_cover.dat";
                   mycover = new File ( mydir,trial);
                     if (mycover.exists()) {
                          mycover.delete();
                          mycover.createNewFile();
                      } else {
                           mycover.createNewFile();
                     String addit = mydir.getParent().toString();
                    mylong = new File (addit+"\\_long.dat");
                    if (mylong .exists()) {
                          mylong.delete();
                          //mylong.createNewFile();
                      } else {
                            //mylong.createNewFile();
                              myemigrant = new File (mydir.getParent()+"\\_emigrant.dat");
                              if (myemigrant.exists()) {
                                   myemigrant.delete();
                                  // myemigrant.canWrite();
                                } else {
                                     //  myemigrant.canWrite();
                   mytravel= new File (mydir.getParent().toString()+"\\_traveller.dat");
                    if (mytravel.exists()) {
                        mytravel.delete();
                       // mytravel.createNewFile();
                      } else {
                           //mytravel.createNewFile();
                    myinstitution = new File (mydir.getParent().toString()+"\\_institution.dat");
                    if (myinstitution.exists()) {
                          myinstitution.delete() ;
                         // myinstitution.createNewFile();
                      } else {
                           //myinstitution.createNewFile();
                    myvagrant = new File (mydir.getParent().toString()+"\\_vagrant.dat");
                    if (myvagrant .exists()) {
                         myvagrant.delete();
                        // myvagrant.createNewFile();
                      } else {
                           //myvagrant.createNewFile();
         //}//initial
              for( int index2 =0;index2<myList.size();index2++)//loop the second one for individual files
                   File file= (File)myList.get(index2);
                   if (file.getParent().contains("00"))//leave node
                        parentPath =file.getParent().substring(0, file.getParent().length()-4);
                   else
                        parentPath =file.getParent().substring(0, file.getParent().length()-3);
                   if (parentPath.toString().compareTo(directory.getParent())==0&file.getName().contains("cover"))
                        try {
                             in = new BufferedReader(new FileReader(file));
                             out = new BufferedWriter( new  FileWriter(mycover));
                        ************     while ((read =in.readLine())!=null)
                             System.out.println("testing");//test whether i ever get in this section !!!
                             out.write(read);               
                             out.close();
                             in.close();
                        catch(NullPointerException e)
                             System.out.println(e);
                        catch(IOException e)
                             System.out.println("There was a problem:" + e);
    }//class Directories

    kingspalace wrote:
    Dr Clap
    The problem i am having is that whereas i am very sure that there are contents in the files i am trying to read , this part of the code Print the Values of parentPath,directory.getParent() and file.getName() here .In the start of this if condition to get a idea what stuff is coming here.
    if (parentPath.toString().compareTo(directory.getParent())==0&file.getName().contains("cover"))
                   {Are you trying to compare parentPath and directory.getParent() as Strings ? How about using equals() ?
    Also are you aware that a single & and && are not one and the same ?
    & will check nevertheless even if the string comparison on the parentPath returns true or false.
    && will not check file.getName() part if the String comparison part fails.
                        try {
                             in = new BufferedReader(new FileReader(file));
                             out = new BufferedWriter( new FileWriter(mycover));
                        ************     while ((read =in.readLine())!=null)
                             System.out.println("testing");//test whether i ever get in this section !!!
                             out.write(read);               
                             out.close();
                             in.close();
                        catch(NullPointerException e)
                             System.out.println(e);
                        catch(IOException e)
                             System.out.println("There was a problem:" + e);
                             }How about adding a simple Exception catch block here ,in case you miss anything ?
    never gets executed executed (meaning ,according to the code, the files am reading have no content ). i am a bit new to files and directories in java . i am hence seeking advice on what i could be doing wrong .IN short,debugging your code will help you a lot.

  • File adapter  reading and writing large files

    Hi we are getting error when trying to process large files using file adapters. files of size 80 to 100 MB. we need to read the inbound files and write them to another folder in another server. the error we are getting is out of memory. gracias

    Hi,
    Use the asynchronous process or a checkpoint(); to see your instance before it time-out.
    --Khaleel                                                                                                                                                                                                                           

  • READING AND WRITING TXT FILE, GUI COMPONENTS.

    HI GUYS I AM JUST NEW TO JAVA AND I AM TRYING TO LEARN SOME MORE IN JAVA. SO I NEED HELP FROM YOU GREAT GUYS WHO KNOWS MORE & MORE THING THAN ME. I CODE A GUI FOR THIS PROGRAM. THE CODE IS BELOW.
    This program has to read a txt file to create Food objects which will consist of a food name, a serving size, and a number of calories. A text file is read which contains the calories contained in specific food items. From this data, an array of Food objects will be created and used to populate a combo box for user selection. The Food objects will also be used in calculating the balance calories for a given user on a given day.
    User input will be used to create User objects which will be user name, age, gender, height, weight, and Food Diary objects (composition). The Food Diary objects will consist of Date (composition), Food object (composition), number of servings, and a balance. Food Diary objects will consist of the activity on any given day (see text area in sample output screen below). All User objects are saved to a file as objects and can be retrieved on subsequent runs of the program.
    The program will calculate the number of calories the user is allowed per day to maintain the user�s current weight (see below for formula to use for this).
    BMRMen = 66 + (13.7 * weightPounds/2.2) + (5 * heightInches*2.54) - (6.8 * age)
    BMRWomen = 655 + (9.6 * weightPounds/2.2) + (1.8 * heightInches*2.54) - (4.7 * age)
    GUI CODE
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    public class FoodDiaryGUI extends JFrame implements ActionListener {
         JLabel               lblName, lblAge, lblWeight,lblHeight,lblFemale,lblMale,lblFood;
         JTextField          txtName, txtAge, txtWeight,txtHeight;
         JButton               btnSave, btnNewUser;
         JTextArea           outputArea;
         JComboBox          cbFood;
         int currentIndex=0, lastIndex=4;
         public FoodDiaryGUI()
              super ("Food Diary Calculator");
              lblName=               new JLabel("Name: ");
              lblAge=                    new JLabel("Age: ");
              lblWeight=               new JLabel("Weight(lbs): ");
              lblHeight=               new JLabel("Height(inches): ");
              lblFemale=               new JLabel("Female: ");
              lblMale=               new JLabel("Male: ");
              lblFood=               new JLabel("Choose a Food: ");
              txtName=               new JTextField(15);
              txtAge=                    new JTextField(3);
              txtWeight=               new JTextField(6);
              txtHeight=               new JTextField(6);
              outputArea=               new JTextArea(9,20);     
              cbFood=                    new JComboBox();
              cbFood.setPreferredSize(new Dimension(100, 20));
              Container c = getContentPane();
              JPanel northPanel = new JPanel();
              northPanel.setLayout(new FlowLayout());
              btnSave=               new JButton("SAVE");
              northPanel.add(btnSave);
              btnNewUser=               new JButton("NEW USER");
              northPanel.add(btnNewUser);
              btnSave.addActionListener(this);
              btnNewUser.addActionListener(this);
              JPanel centerPanel = new JPanel();
              centerPanel.setLayout(new FlowLayout());
              centerPanel.add(lblName);
              centerPanel.add(txtName);
              centerPanel.add(lblAge);
              centerPanel.add(txtAge);
              centerPanel.add(lblWeight);
              centerPanel.add(txtWeight);
              centerPanel.add(lblHeight);
              centerPanel.add(txtHeight);
              centerPanel.setLayout(new FlowLayout());
              JRadioButton rbMale = new JRadioButton(maleString);
         birdButton.setMnemonic(KeyEvent.VK_M);
         birdButton.setActionCommand(maleString);
         birdButton.setSelected(true);
         JRadioButton rbFemale = new JRadioButton(femaleString);
         catButton.setMnemonic(KeyEvent.VK_F);
         catButton.setActionCommand(femaleString);
         //Group the radio buttons.
         ButtonGroup group = new ButtonGroup();
         group.add(rbMale);
         group.add(rbFemale);
         //Register a listener for the radio buttons.
         rbMale.addActionListener(this);
         rbFemale.addActionListener(this);
         public void actionPerformed(ActionEvent rb) {
         picture.setIcon(new ImageIcon("images/"
         + rb.getActionCommand()
         + ".gif"));
              radioGroup.add(rbMale);
              radioGroup.add(rbFemale);
              centerPanel.add(rbMale);
              centerPanel.add(rbFemale);
              centerPanel.add(lblFood);
              centerPanel.add(cbFood);
              JPanel southPanel = new JPanel();
              southPanel.setLayout(new FlowLayout());
              southPanel.add (outputArea);
              c.add(northPanel,BorderLayout.NORTH);
              c.add(centerPanel,BorderLayout.CENTER);
              c.add(southPanel,BorderLayout.SOUTH);
              setSize(650,300);
              setVisible(true);
              //add listener to button components.
              public void actionPreformed(ActionEvent e)
                   if (e.getSource()==btnSave)
                        currentIndex++;
                        currentIndex--;
              public static void main (String[] args)
                   FoodDiaryGUI application = new FoodDiaryGUI();
                   application.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              public void actionPerformed(ActionEvent arg0) {
                   // TODO Auto-generated method stub
    THE .txt file is as:
    1000 ISLAND, SALAD DRSNG,LOCAL*1 TBSP*25
    1000 ISLAND, SALAD DRSNG,REGLR*1 TBSP*60
    100% NATURAL CEREAL *1 OZ*135
    40% BRAN FLAKES, KELLOGG'S*1 OZ*90
    40% BRAN FLAKES, POST*1 OZ*90
    ALFALFA SEEDS, SPROUTED, RAW*1 CUP*10
    ALL-BRAN CEREAL*1 OZ*70
    ALMONDS, WHOLE*1 OZ*165
    ANGELFOOD CAKE, FROM MIX*1 PIECE*125
    APPLE JUICE, CANNED*1 CUP*115
    i hope this forum site has to many java professionals and this problem is nothing for them. for me it is great.

    Stick to using a single userid and a single posting of a question:
    http://forum.java.sun.com/thread.jspa?threadID=731264&tstart=0

  • Problem with intermittent sampling and writing to file(s)

    I am describing the functionality that I am trying to achieve via the attached VI.
    The VI opens with a sequence structure. In the first sequence step analog output voltages for 2 AO channels are set
    The next sequence step consists of analog data acquisition
    Custom linear scales for 3 input channels are specified, to convert input ‘volts’ to respective physical quantity being measured
    The input voltage signal is with +/- 10V but the physical quantity (forces) are greater than 10N
    The headers for the data files are created as strings
    The acquisition is set for finite sample acquisition
    The VI is set for periodic acquisition, wherein the data is acquired for specific time period given by ‘Sampling on’ and then ignored for time period specified by ‘Interval off’.
    The VI is set to write instantaneous data to multiple files. Each time the While loop is executed the instantaneous data, number of samples read (sampling rate x Sampling on time),  is written to a ‘.dat’ file.
    Statistical operations on data collected for each While loop execution is performed. These values (average & st. dev) are then written to another file ‘*.sum’ with respective headers
    The headers for the ‘*.sum’ file are written only for the first execution of the While loop
    The VI is designed to run for a specific duration after which the execution of  While loop is stopped
    Certain safety features are incorporated to terminate the execution of the While loop if the ratio of measured quantities exceeds a preset limit.
    In the last sequence the analog outputs are set to zero
    I am having following problems with the execution of the VI:
    The VI does not write instantaneous data to data files (*.dat)
    The VI writes the averaged data for *.sum file for only the first execution of the While loop.
    It also truncates the values to around 10.5 written in *.sum file. While implies that the custom scale is not working as intended.
    I would really appreciate if you would tell me how to fix these bugs with the VI. I would really appreciate your help.
    Have a happy holiday season.
    Thanks,
    Dinesh
    Attachments:
    VLBT_Sequence_AnalogIP_2.vi ‏437 KB

    Lynn, he may actually not be to blame for the diagram size. It does not change if you "clean" it, which leads me to believe that this is what he did. But a very entertaining diagram it is. A true case study :-)
    Now, the strange thing is that stuff like this remains in it:
    As Lynn said, the reason why the file is updated only once is that there must be an error after the first acquisition completes. The only way to figure out which one it is (in order to avoid or correct it) is to debug your code in situ (using a probe on the error wires). It might be because you try to restart your acquisition within the loop (you probably should stop it first if you really want to restart it anyhow). I would put the start out of the while loop and try this way. The error might occur elsewhere though or for another reason...
    Since you recreate your dat file at each iteration, the second giving you nothing because of an (unknown) error, will essentially erase your first successful iteration.
    I don't understand the truncation statement.

  • Downloading via XHR and writing large files using WinJS fails with message "Not enough storage is available to complete this operation"

    Hello,
    I have an issue that some user are experiencing but I can't reproduce it myself on my laptop. What I am trying to do it grab a file (zip file) via XHR. The file can be quite big, like 500Mb. Then, I want to write it on the user's storage.
    Here is the code I use:
    DownloadOperation.prototype.onXHRResult = function (file, result) {
    var status = result.srcElement.status;
    if (status == 200) {
    var bytes = null;
    try{
    bytes = new Uint8Array(result.srcElement.response, 0, result.srcElement.response.byteLength);
    } catch (e) {
    try {
    Utils.logError(e);
    var message = "Error while extracting the file " + this.fileName + ". Try emptying your windows bin.";
    if (e && e.message){
    message += " Error message: " + e.message;
    var popup = new Windows.UI.Popups.MessageDialog(message);
    popup.showAsync();
    } catch (e) { }
    this.onWriteFileError(e);
    return;
    Windows.Storage.FileIO.writeBytesAsync(file, bytes).then(
    this.onWriteFileComplete.bind(this, file),
    this.onWriteFileError.bind(this)
    } else if (status > 400) {
    this.error(null);
    The error happens at this line:
    bytes = new Uint8Array(result.srcElement.response, 0, result.srcElement.response.byteLength);
    With description "Not enough storage is available to complete this operation". The user has only a C drive with plenty of space available, so I believe the error message given by IE might be a little wrong. Maybe in some situations, Uint8Array
    can't handle such large file? The program fails on a "ASUSTek T100TA" but not on my laptop (standard one)
    Can somebody help me with that? Is there a better way to write a downloaded binary file to the disk not passing via a Uint8Array?
    Thanks a lot,
    Fabien

    Hi Fabien,
    If Uint8Array works fine on the other computer, it should not be the problem of the API, but instead it could be the setting or configuration for IE.
    Actually using XHR for 500MB zip file is not suggested, base on the documentation:
    How to download a file, XHR wraps an
    XMLHttpRequest call in a promise, which is not a good approach for big item download, please use
    Background Transfer instead, which is designed to receive big items.
    Simply search on the Internet, and looks like the not enough storage error is a potential issue while using XMLHttpRequest:
    http://forums.asp.net/p/1985921/5692494.aspx?PRB+XMLHttpRequest+returns+error+Not+enough+storage+is+available+to+complete+this+operation, however I'm not familiar with how to solve the XMLHttpRequest issues.
    --James
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Reading and Writing large Excel file using JExcel API

    hi,
    I am using JExcelAPI for reading and writing excel file. My problem is when I read file with 10000 records and 95 columns (file size about 14MB), I got out of memory error and application is crashed. Can anyone tell me is there any way that I can read large file using JExcelAPI throug streams or in any other way. Jakarta POI is also showing this behaviour.
    Thanks and advance

    Sorry when out of memory error is occurred no stack trace is printed as application is crashed. But I will quote some lines taken from JProfiler where this problem is occurred:
              reader = new FileInputStream(new File(filePath));
              workbook = Workbook.getWorkbook(reader);
              *sheeet = workbook.getSheet(0);* // here out of memory error is occured
               JProfiler tree:
    jxl.Workbook.getWorkBook
          jxl.read.biff.File 
                 jxl.read.biff.CompoundFile.getStream
                       jxl.read.biff.CompoundFile.getBigBlockStream Thanks

  • Very slow painting while reading and writing doubles into file

    for 15MB length file i = 7662080
    for 50MB length file i = 12414368
    Part of Code for writing into file follows like this:
    try{
    fos = new FileOutputStream("Angel.txt");
    File f = new File("Angel.txt");
         if(f.length() >=4)
         f.delete();
    fos = new FileOutputStream("Angel.txt");     
    dos = new DataOutputStream(new BufferedOutputStream(fos,1000000));
    int x=0;
    double y_last, y_new;
    for(int j=0 ;j<i ;j++)
    if(some condition)
    y_new = ....;
    try{
    //previously in vectors
    y_last = y_new;
    vect.add(new Line2D.Double(x, y_last, x, y_new)_;
    dos.writeDouble(y_new);
         }catch(Exception e){System.out.println(e);}
    dos.close();
    fos.close();
    x++;
    }catch(Exception excp){System.out.println(excp);}
    part of code for reading from file follows like this:
    public void paint(Graphics g)
    try{
         double y1, y2 =0;               
         Line2D.Double doub;
         raf = new RandomAccessFile("Angel.txt","r");
         dis = new DataInputStream(new BufferedInputStream(new FileInputStream(raf.getFD(),1000000)));
         raf.seek((rect.x*8));
         for (int i = 0/any value; (i < value as per choice); i++)
              g2.setStroke(new BasicStroke(0)); //2
              y1 = y2;
         y2 =dis.readDouble();
              doub=new Line2D.Double(i,y1,i,y2);
              g2.draw(doub);
    dis.close();
         raf.close();
    }catch(Exception excp){System.out.println(excp);}
    I tried using Object Streams but NotSerializable Exception is thrown as Line2D.Double objects
    are not serialized.
    Any idea to make reading and writing into file specially from MB files faster is appreciated.

    Why are you reading in the file in the paint method ?
    Create your data once before painting.
    I think you should explain what is your goal and what behavior you want.
    Denis

  • Question around UTL_FILE and writing unicode data to a file.

    Database version : 11.2.0.3.0
    NLS_CHARACTERSET : AL32UTF8
    OS : Red Hat Enterprise Linux Server release 6.3 (Santiago)
    I did not work with multiple language characters and manipulating them. So, the basic idea is to write UTF8 data as Unicode file using UTL_FILE. This is fairly an empty database and does not have any rows in at least the tables I am working on. First I inserted a row with English characters in the columns.
    I used utl_file.fopen_nchar to open and used utl_file.put_line_nchar to write it to the file on the Linux box. I open the file and I still see English characters (say "02CANMLKR001".
    Now, I updated the row with some columns having Chinese characters and ran the same script. It wrote the file. Now when I "vi" the file, I see "02CANè¹æ001" (some Unicode symbols in place of the Chinese characters and the regular English.
    When I FTP the file to windows and open it using notepad/notepad++ it still shows the Chinese characters. Using textpad, it shows ? in place of Chinese characters and the file properties say that the file is of type UNIX/UTF-8.
    My question : "Is my code working and writing the file in unicode? If not what are the required changes?" -- I know the question is little vague, but any questions/suggestions towards answering my question would really help.
    sample code:
    {pre}
    DECLARE
       l_file_handle   UTL_FILE.file_type;
       l_file_name     VARCHAR2 (50) := 'test.dat';
       l_rec           VARCHAR2 (250);
    BEGIN
       l_file_handle := UTL_FILE.fopen_nchar ('OUTPUT_DIR', l_file_name, 'W');
       SELECT col1 || col2 || col3 INTO l_rec FROM table_name;
       UTL_FILE.put_line_nchar (l_file_handle, l_rec);
       UTL_FILE.fclose (l_file_handle);
    END;
    {/pre}

    Regardless of what you think of my reply I'm trying to help you.
    I think you need to reread my reply because I can't find ANY relation at all between what I said and what you responded with.
    I wish things are the way you mentioned and followed text books.
    Nothing in my reply is related to 'text books' or some 'academic' approach to development. Strictly based on real-world experience of 25+ years.
    Unfortunately lot of real world projects kick off without complete information.
    No disagreement here - but totally irrevelant to anything I said.
    Till we get the complete information, it's better to work on the idea rather than wasting project hours. I don't think it can work that way. All we do is to lay a ground preparation, toy around multiple options for the actual coding even when we do not have the exact requirements.
    No disagreement here - but totally irrevelant to anything I said.
    And I think it's a good practice rather than waiting for complete information and pushing others.
    You can't just wait. But you also can't just go ahead on your own. You have to IMMEDIATELY 'push others' as soon as you discover any issues affecting your team's (or your) ability to meet the requirements. As I said above:
    Your problems are likely:
    1. lack of adequate requirements as to what the vendor really requires in terms of format and content
    2. lack of appropriate sample data - either you don't have the skill set to create it yourself or you haven't gotten any from someone else.
    3. lack of knowledge of the character sets involved to be able to create/conduct the proper tests
    If you discover something missing with the requirements (what character sets need to be used, what file format to use, whether BOMs are required in the file, etc) you simply MUST bring that to your manager's attention as soon as you suspect it might be an issue.
    It is your manager's job, not yours, to make sure you have the tools needed to do the job. One of those tools is the proper requirements. If there is ANYTHING wrong, or if you even THINK something is wrong with those requirements it is YOUR responsibility to notify your manager ASAP.
    Send them an email, leave a yellow-sticky on their desk but notify them. Nothing in what I just said says, or implies, that you should then just sit back and WAIT until that issue is resolved.
    If you know you will need sample data you MUST make sure the project plan includes SOME means to obtain sample data witihin the timeline needed by your project. As I repeated above if you don't have the skill set to create it yourself someone else will need to do it.
    I did not work with multiple language characters and manipulating them.
    Does your manager know that? If the project requires 'work with multiple language characters and manipulating them' someone on the project needs to have experience doing that. If your manager knows you don't have that experience but wants you to proceed anyway and/or won't provide any other resource that does have that experience that is ok. But that is the manager's responsibility and that needs to be documented. At a minimum you need to advise your manager (I prefer to do it with an email) along the following lines:
    Hey - manager person - As you know I have little or no experience to 'work with multiple language characters and manipulating them' and those skills are needed to properly implement and test that the requirements are met. Please let me know if such a resource can be made available.
    And I'm serious about that. Sometimes you have to make you manager do their job. That means you ALWAYS need to keep them advised of ANY issue that might affect the project. Once your manager is made aware of an issue it is then THEIR responsibility to deal with it. They may choose to ignore it, pretend they never heard about it or actually deal with it. But you will always be able to show that you notified them about it.
    Now, I updated the row with some columns having Chinese characters and ran the same script.
    Great - as long as you actually know Chinese that is; and how to work with Chinese characters in the context of a database character set, querying, creating files, etc.
    If you don't know Chinese or haven't actually worked with Chinese characters in that context then the project still needs a resource that does know it.
    You can't just try to bluff your way through something like character sets and code conversions. You either know what a BOM (byte order mark) is or you don't. You have either learned when BOMs are needed or you haven't.
    That said, we are in process of getting the information and sample data that we require.
    Good!
    Now make sure you have notified your manager of any 'holes' in the requirements and keep them up to date with any other issues that arise.
    NONE of the above suggests, or implies, that you should just sit back and wait until that is done. But any advice offered on the forums about specifics of your issue (such as whether you need to even worry about BOMs) is premature until the vendor or the requirements actually document the precise character set and file format needed.

Maybe you are looking for