Parse data

hi i'm comunnicating with a UDC (Universal digital controller from honeywell) 3000 using VB 6 and the CWSERIAL, but i have a couple of problems the first is that when i send him some data for example when i ask for the temperatura he send me back the next response:
0080C1,120,150 the first 6 digit tell about the communication if it was right or wrong the next 3 digits is the thing that i want to read for example the temperature or the Set point , and the last 3 digits is the value of the thing that im reading in this case the Temperature, what i need yo do is take this and the last value wil be put in a isevensegment the firts 6 digit i have to compare to look for some mistakes, so how can i parse this in 3 parts? i look some example in this page but it gives me type dismatch error i try something like this
response= cwserial1.tasks("Dato").parse(data)
text1.text= response(0)
text2.text=response (1)
text3.text=response (2)
2)And the other question is that i want to know how can i send a data to cwserial and put the option that someone could fill a part of the data , let me explain it better with this example:
when i want to change the Set point of the temperatura i need to send this :
03,0204,65,18,153,200.0,\13\10 and i do that and that's fine the problem is that this program will be used for other people and i want that they only put the value of the temperature and that's all ( the value of the new temperature is the one in red the 200.0). How can i put some text box or something like that, that when someone put some value like 100.0 and the program then send the array of bytes that i put and put the 100.0 where is the 200.0 ?
Appreciating all the help you could give me Tomás Estrada

hi , sorry for that, i already solved the problem of communicating with the udc 3000 and the first problem that i put in this post about parse the data with vb 6, the only problem that i can't  fix is how send a data like i say before i need to send this data
02,0204,65,18,125,100.0,\13\10
the part in red the 100.0 is the value that i need to put to change the Set point of the controllers, and i want  to know how can i send this data but adding the value of the new set point from a text box for example that i can put the value in some text box like 200 and that value save it and put in the data 02,0204,65,18,125,value,\13\10 and the send the data to the controller.
Tomás Estrada

Similar Messages

  • How do i parse data from the second jframe back to the first?

    Hello.
    I have a jFrame were I promt users to keep a list of Names in a jTable. (I keep data for something else, but lets say names.. ) Anyway, afterwords I want to add some extra parameters for each name. So I created a new frame, which is opened when user press an Edit button. The new frame opens and users can add for the specific name some extra data, like age, height, color, sex.. etc. that characterizes this person.
    On this second form i have a save button, which when its pressed i would like to keep this information for this name, so as when user press edit again from the first frame on the same Name the data that previously entered will be loaded (lets say that the user can not enter the say name again)
    I haven' t figured the code for the save Button, but with the rest I am fine.
    Can you give any ideas with structures that I have to use and how the action listener will have to be??
    When I set visible the new form i have made a constructor that loads the new form which have a label with the name of the person that is edited., but how do i parse data from the second form back to the first that is already opened??
    Thanks very much..

    I found it.. it was not so hard afterall..
    anyway, i quote the new code..
    package namelist;
    // Java core packages
    import java.awt.event.*;
    import java.util.*;
    // Java extension packages
    import javax.swing.*;
    import javax.swing.table.*;
    public class NamesGUI extends javax.swing.JFrame {
        //Variables for managing the jTables
        DefaultTableModel tableModel;
        Vector rows,cols;
        String[] colName1 = {"List of Names"};
        ManageJTables mJT = new ManageJTables();
        Hashtable h;
        /** Creates new form ProsAgentGUI */
        public NamesGUI() {
            h = new Hashtable();
            initComponents();
        /** This method is called from within the constructor to
         * initialize the form.
         * WARNING: Do NOT modify this code. The content of this method is
         * always regenerated by the Form Editor.
        private void initComponents() {
            Panel = new javax.swing.JPanel();
            ToolBar = new javax.swing.JToolBar();
            ADD = new javax.swing.JButton();
            EDIT = new javax.swing.JButton();
            REMOVE = new javax.swing.JButton();
            jButton1 = new javax.swing.JButton();
            TScrollPane = new javax.swing.JScrollPane();
            Table = new javax.swing.JTable();
            setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
            setTitle("Names");
            setBackground(new java.awt.Color(0, 51, 51));
            Panel.setBorder(javax.swing.BorderFactory.createTitledBorder("List of Names"));
            ToolBar.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1));
            ADD.setText("ADD");
            ADD.setToolTipText("");
            ADD.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
            ADD.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    ADDActionPerformed(evt);
            ToolBar.add(ADD);
            EDIT.setText("EDIT");
            EDIT.setToolTipText("");
            EDIT.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
            EDIT.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    EDITActionPerformed(evt);
            ToolBar.add(EDIT);
            REMOVE.setText("REMOVE");
            REMOVE.setToolTipText("");
            REMOVE.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
            REMOVE.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    REMOVEActionPerformed(evt);
            ToolBar.add(REMOVE);
            jButton1.setText("jButton1");
            jButton1.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    jButton1ActionPerformed(evt);
            ToolBar.add(jButton1);
            rows=new Vector();
            cols= new Vector();
            cols=mJT.addColumns(colName1, cols);
            tableModel =new DefaultTableModel();
            tableModel.setDataVector(rows,cols);
            Table.setModel(tableModel);
            TScrollPane.setViewportView(Table);
            org.jdesktop.layout.GroupLayout PanelLayout = new org.jdesktop.layout.GroupLayout(Panel);
            Panel.setLayout(PanelLayout);
            PanelLayout.setHorizontalGroup(
                PanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                .add(ToolBar, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 210, Short.MAX_VALUE)
                .add(TScrollPane, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 210, Short.MAX_VALUE)
            PanelLayout.setVerticalGroup(
                PanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                .add(PanelLayout.createSequentialGroup()
                    .add(ToolBar, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 34, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                    .add(TScrollPane, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 159, Short.MAX_VALUE))
            org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
            getContentPane().setLayout(layout);
            layout.setHorizontalGroup(
                layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                .add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup()
                    .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .add(Panel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .addContainerGap())
            layout.setVerticalGroup(
                layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                .add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup()
                    .addContainerGap(29, Short.MAX_VALUE)
                    .add(Panel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .addContainerGap())
            pack();
        private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
    // TODO add your handling code here:
            System.out.println(h.toString());
    public void updateNamesTable (int id, String na){
         Integer i2 = new Integer(id);
         Object o2 = (Object)i2;
         if (h.containsKey(o2)){
            Name a = (Name)h.get(o2);
            a.name = na;
            h.put(o2,a);
         else {
             Name aa = new Name();
             aa.name=na;
             h.put(o2,(Object)aa);
        private void EDITActionPerformed(java.awt.event.ActionEvent evt) {
    // TODO add your handling code here:
            String name = Table.getValueAt(Table.getSelectedRow(),0).toString();
            int rowNum= Table.getSelectedRow();
            Integer i = new Integer(rowNum);
            Object o = (Object)i;
            updateNamesTable (rowNum, name);
            //public NameEditor(Name n,  Hashtable h, int id)
            NameEditor re = new NameEditor((Name)h.get(o), h, rowNum );
            re.setVisible(true);
        private void REMOVEActionPerformed(java.awt.event.ActionEvent evt) {
    // TODO add your handling code here:
            mJT.deleteRow(Table.getSelectedRow(), rows, Table);
        private void ADDActionPerformed(java.awt.event.ActionEvent evt) {
    // TODO add your handling code here:
            mJT.addRow(rows, Table);
         * @param args the command line arguments
        public static void main(String args[]) {
            java.awt.EventQueue.invokeLater(new Runnable() {
                public void run() {
                    new NamesGUI().setVisible(true);
        // Variables declaration - do not modify
        javax.swing.JButton ADD;
        javax.swing.JButton EDIT;
        javax.swing.JPanel Panel;
        javax.swing.JButton REMOVE;
        javax.swing.JScrollPane TScrollPane;
        javax.swing.JTable Table;
        javax.swing.JToolBar ToolBar;
        javax.swing.JButton jButton1;
        // End of variables declaration
    public class NameEditor extends javax.swing.JFrame {
        Hashtable h;
        Name n;
        int id;
        /** Creates new form NameEditor */
        public NameEditor() {
            initComponents();
        public NameEditor(Name n,  Hashtable h, int id) {
            this.h=h;
            this.n=n;
            this.id=id;
            initComponents();
            NameField.setText(n.name);
            jTextField2.setText(n.weight);
            jTextField1.setText(n.height);
            setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        /** This method is called from within the constructor to
         * initialize the form.
         * WARNING: Do NOT modify this code. The content of this method is
         * always regenerated by the Form Editor.
        private void initComponents() {
            NameLabel = new javax.swing.JLabel();
            NameField = new javax.swing.JTextField();
            SaveBut = new javax.swing.JButton();
            jLabel3 = new javax.swing.JLabel();
            jLabel4 = new javax.swing.JLabel();
            jTextField1 = new javax.swing.JTextField();
            jTextField2 = new javax.swing.JTextField();
            setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
            setTitle("Name Editor");
            getAccessibleContext().setAccessibleName("Name Editor");
            NameLabel.setText("Name: ");
            NameField.setEditable(false);
            NameField.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    NameFieldActionPerformed(evt);
            SaveBut.setText("SAVE");
            SaveBut.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    SaveButActionPerformed(evt);
            jLabel3.setText("Height");
            jLabel4.setText("Weight");
            org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
            getContentPane().setLayout(layout);
            layout.setHorizontalGroup(
                layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                .add(layout.createSequentialGroup()
                    .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
                        .add(layout.createSequentialGroup()
                            .addContainerGap()
                            .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                                .add(layout.createSequentialGroup()
                                    .add(jLabel4)
                                    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED))
                                .add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup()
                                    .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                                        .add(jLabel3)
                                        .add(NameLabel))
                                    .add(16, 16, 16)))
                            .add(17, 17, 17)
                            .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                                .add(NameField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 138, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING, false)
                                    .add(org.jdesktop.layout.GroupLayout.LEADING, jTextField2)
                                    .add(org.jdesktop.layout.GroupLayout.LEADING, jTextField1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 46, Short.MAX_VALUE))))
                        .add(org.jdesktop.layout.GroupLayout.LEADING, layout.createSequentialGroup()
                            .add(127, 127, 127)
                            .add(SaveBut)))
                    .addContainerGap())
            layout.setVerticalGroup(
                layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                .add(layout.createSequentialGroup()
                    .addContainerGap()
                    .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                        .add(NameLabel)
                        .add(NameField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                    .add(30, 30, 30)
                    .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                        .add(jLabel3)
                        .add(jTextField1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                    .add(12, 12, 12)
                    .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                        .add(jLabel4)
                        .add(jTextField2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 27, Short.MAX_VALUE)
                    .add(SaveBut)
                    .addContainerGap())
            pack();
        public void updateNameTable (){
         Integer i2 = new Integer(id);
         Object o2 = (Object)i2;
         h.put(o2,n);       
        private void SaveButActionPerformed(java.awt.event.ActionEvent evt) {                                       
    // TODO add your handling code here:
            n.height= jTextField1.getText();
            n.weight = jTextField2.getText();
        private void NameFieldActionPerformed(java.awt.event.ActionEvent evt) {
    // TODO add your handling code here:
         * @param args the command line arguments
        public static void main(String args[]) {
            java.awt.EventQueue.invokeLater(new Runnable() {
                public void run() {
                    new NameEditor().setVisible(true);
        // Variables declaration - do not modify
        javax.swing.JTextField NameField;
        javax.swing.JLabel NameLabel;
        javax.swing.JButton SaveBut;
        javax.swing.JLabel jLabel3;
        javax.swing.JLabel jLabel4;
        javax.swing.JTextField jTextField1;
        javax.swing.JTextField jTextField2;
        // End of variables declaration
    }

  • How do I create individual xml files from the parsed data output of a xml file?

    I have written a program (DOM Parser) that parses data from a XMl File. I would like to create an individual file with the corresponding name for each set of data parsed from the xml document. If the parsed output is Single, Double, Triple, I would like to create an individual xml file (Single.xml, Double.xml, Triple.xml)with those corresponding names. How do I create the xml files and give each file the name of my parsed data output? Thanks in advance for your help.
    import java.io.IOException;
    import javax.xml.parsers.DocumentBuilder;
    import javax.xml.parsers.DocumentBuilderFactory;
    import javax.xml.parsers.ParserConfigurationException;
    import org.w3c.dom.Document;
    import org.w3c.dom.Element;
    import org.w3c.dom.Node;
    import org.w3c.dom.NodeList;
    import org.xml.sax.SAXException;
    public class MyDomParser {
      public static void main(String[] args) {
      DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
      try {
      DocumentBuilder builder = factory.newDocumentBuilder();
      Document doc = builder.parse("ENtemplate.xml");
      doc.normalize();
      NodeList rootNodes = doc.getElementsByTagName("templates");
      Node rootNode = rootNodes.item(0);
      Element rootElement = (Element) rootNode;
      NodeList templateList = rootElement.getElementsByTagName("template");
      for(int i=0; i < templateList.getLength(); i++) {
      Node theTemplate = templateList.item(i);
      Element templateElement = (Element) theTemplate;
      System.out.println("Template" + ": " +templateElement.getAttribute("name")+ ".xml");
      } catch (ParserConfigurationException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
      } catch (SAXException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
      } catch (IOException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();

    Ive posted the new code but now I'm getting a FileAlreadyExistException error. How do I handle this exception error correctly in my code?
    import java.io.IOException;
    import java.nio.file.FileAlreadyExistsException;
    import java.nio.file.Files;
    import java.nio.file.Paths;
    import javax.xml.parsers.DocumentBuilder;
    import javax.xml.parsers.DocumentBuilderFactory;
    import javax.xml.parsers.ParserConfigurationException;
    import org.w3c.dom.Document;
    import org.w3c.dom.Element;
    import org.w3c.dom.Node;
    import org.w3c.dom.NodeList;
    import org.xml.sax.SAXException;
    public class MyDomParser {
      public static void main(String[] args) {
      DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
      try {
      DocumentBuilder builder = factory.newDocumentBuilder();
      Document doc = builder.parse("ENtemplate.xml");
      doc.normalize();
      NodeList rootNodes = doc.getElementsByTagName("templates");
      Node rootNode = rootNodes.item(0);
      Element rootElement = (Element) rootNode;
      NodeList templateList = rootElement.getElementsByTagName("template");
      for(int i=0; i < templateList.getLength(); i++) {
      Node theTemplate = templateList.item(i);
      Element templateElement = (Element) theTemplate;
      System.out.println(templateElement.getAttribute("name")+ ".xml");
      for(int i=0; i < templateList.getLength(); i++) {
      Node theTemplate = templateList.item(i);
      Element templateElement = (Element) theTemplate;
      String fileName = templateElement.getAttribute("name") + ".xml";
      Files.createFile(Paths.get(fileName));
      System.out.println("File" + ":" + fileName + ".xml created");
      } catch (ParserConfigurationException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
      } catch (SAXException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
      } catch (IOException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();

  • Help parse date : MMM dd, yyyy hh:mm:ss a zzz

    I don't know how to get this to work. It parses but give me a wrong date all the time:
    import java.text.ParseException;
    import java.text.SimpleDateFormat;
    import java.util.Date;
    public class DateParserTest {
        public DateParserTest() {
        public static void main(String [] argv) {
            //Nov 17, 2006 1:00:00 PM MST<
            String sdate = "Nov 17, 2006 1:00:00 PM MST";
            Date date = extractDate(sdate);
            System.out.println("Orig date: " + sdate);
            System.out.println("Current date: " + date.toString());
        public static Date extractDate(String data) {
            SimpleDateFormat sdf = new SimpleDateFormat("MMM dd, yyyy hh:MM:ss a zzz"); //zzz
            try {
                Date date = sdf.parse(data);
                return date;
            } catch (ParseException ex) {
                ex.printStackTrace();
                return null;
    }

    Instead of:
    "MMM dd, yyyy hh:MM:ss a zzz"you should have:
    "MMM dd, yyyy hh:mm:ss a zzz"Minutes are lowercase m's

  • Parsing date from JSON response

    Is there any helper method to parse date time value being returned in JSONResponse to get java.util.Date. For example, 2012-06-26T15:51:59.078-05:00. I have done simple java method using SimpleDateFormat, but that does not handle all possible formats. Anyone has ideas on libraries that can be used for this purpose?
    Chandresh

    Oh I see you receive different formats from different services, who's backend you can not modify.
    I found this, it should help you get the job done:
    http://stackoverflow.com/questions/4024544/how-to-parse-dates-in-multiple-formats-using-simpledateformat
    Note however, that his problem is only relatively simplistic, yours on the other hand seems to be one of a kind where you have to be set up a pretty nifty algorithm taking care of all the different possible formats. That being said, there is no method which can parse ANY format you throw at it. you must write one yourself which knows which possible formats to expect.
    If its only those two formats you can expect:
    2012-06-26T15:51:59.078-05:00
    2012-06-26T15:51:59-05:00
    it should be an easy try-catch construct within a helper method. just be sure to use the right letters when setting up your SimpleDateFormat parse object, it's case sensitive and one quickly gets lost in all those letters.
    Edit:
    Again this should do the trick:
    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSz");
    Just make sure you remove the last ":" from the JSONString (simple string manipulation) and then have two cases
    //removing last ":" from JSONString
    //====
    //Parsing string to date or gregCalendar
    GregorianCalendar time= new GregorianCalendar();
    try{
    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSz");
    time.setTime(sdf.parse(JSONString));
    catch{
    SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssz");
    time.setTime(sdf2.parse(JSONString));
    Edited by: Pascal B on 05.07.2012 04:50
    Edited by: Pascal B on 05.07.2012 04:55

  • Parsing Date with SimpleDateFormat

    Hi,
    In my application, i want to parse date which is in String format.
    The format of Date in String is "yyyyMMdd'T'HHmmss.SSS'Z'" (ex:- 20031201T100116.000Z).
    //Happy Case - Input Param "20031201T100116.000Z"
    //Output : 2003-12-01 10:01:16.0 is the expected output ------- works well.
    //Exception case Input param Value "00000000T000000.000Z"
    But the above case breaks as the expected output is "0000-00-00 00:00:00 ". But the output what i get is
    "0002-11-30 00:00:00.0"
    Greatly appreciate your inputs...,
    Here is my code for the above stated case....
    private static void printDateFormat(String str) throws Exception
    String format = "yyyyMMdd'T'HHmmss.SSS'Z'"; //Desired Format
    ParsePosition pos = new ParsePosition(0);
    SimpleDateFormat sdf = new SimpleDateFormat(format);
    Date date = sdf.parse(str, pos);
    Calendar cal = Calendar.getInstance();
    cal.setTime(date);
    System.out.println("[After Formatting]" + date.toString());
    java.sql.Timestamp ts = new java.sql.Timestamp(cal.getTime().getTime());
    System.out.println(ts.toString());
    Thanks !
    Priya.Jlus
    IIMS-NZ.

    SimpleDateFormat is set to lenient date parsing by default, so it's trying it's best to come up with an actual date for 0000-00-00 (what would you say a 'zero' month should be?). You can prevent this "approximation" by using "setLenient(false)", but then you will get a null Date reference for non-parseable dates like the one you're using.
    The bottom line is that you're going to have to do some validation for the user input and handle exceptional conditions.
    Hope this helps! :o)

  • Implementing Database codes FAIL /error in parsing data into jsp page

    Hi there,
    I have this problem trying to build a portal application. I am using the JSPDynPage, jsp page and a bean to build a page.
    I have this problem parsing data from JSPDynPage to the beans and to the jsp page.
    I tested out the connection between the beans and the jsp page. There is no error parsing information from the beans to the jsp page.
    So i tried to test out the codes for the database from the beans.
    Will this work? Because it does not display the results i want.
    I need an Solution asap to find out wad is wrong also also the correct codes to the database.
    public String db(){
    try {
                 InitialContext iC = new InitialContext();
                 DataSource dataSource = (DataSource)iC.lookup("java:env/jdbc/mySQL");
                 java.sql.Connection connection = dataSource.getConnection();
                 PreparedStatement st = connection.prepareStatement("SELECT name FROM test WHERE id='123'");
                 ResultSet resultSet = st.executeQuery();
                 while (resultSet.next()){
                      name = resultSet.getString("name");
                      name = name.toString();
                 connection.close();
                 return name;
                 } catch(Exception n){
                      e = "Exception";
                      return e;
    This is the method i put in the beans to test out the database connection.
    Thanks Loads
    Quatre

    Hi there,
    Thanks for the reply, i thought that no one is going to reply me anymore. Thanks loads.
    Bean Class name: Bean1
    Bean Packeage name: Beans1
    Bean id : myBean1
    Jsp Codes
    <%@ taglib uri="tagLib" prefix="hbj" %>
    <jsp:useBean id="myBean1" scope="application" class="Beans1.Bean1" />
    <hbj:content id="myContext" >
      <hbj:page title="PageTitle">
       <hbj:form id="myFormId" >
       <hbj:textView id = "ll" text="lalalalalalalalalasasa" />
      <%--
    <hbj:textView id = "l">
                   <% l.setName(myBean1.getName());%>
    </hbj:textView>
    --%>
    <hbj:textView
                    id="appraisal_yr_label"
                    text="Apprasial Year:">
                    </hbj:textView>
                    <hbj:textView id = "la" >
                    <% la.setText(myBean1.getName());%>
                    </hbj:textView>
       </hbj:form>
      </hbj:page>
    </hbj:content>
    Beans1.java
    package Beans1;
    import java.io.Serializable;
    public class Bean1 implements Serializable{
    private String name = new String();
    private String e = new String();
    private String year = new String();
         public void setName(String name){
              this.name = name;
         public String getName(){
              return name;
    JSPDynPage
    import Beans1.Bean1;
    import com.sapportals.htmlb.*;
    import com.sapportals.htmlb.enum.*;
    import com.sapportals.htmlb.event.*;
    import com.sapportals.htmlb.page.*;
    import com.sapportals.portal.htmlb.page.*;
    import com.sapportals.portal.prt.component.*;
    public class testDBv5 extends PageProcessorComponent {
    import Beans1.Bean1;
    import com.sapportals.htmlb.*;
    import com.sapportals.htmlb.enum.*;
    import com.sapportals.htmlb.event.*;
    import com.sapportals.htmlb.page.*;
    import com.sapportals.portal.htmlb.page.*;
    import com.sapportals.portal.prt.component.*;
    public class testDBv5 extends PageProcessorComponent {
      public DynPage getPage(){
        return new testDBv5DynPage();
      public static class testDBv5DynPage extends JSPDynPage{
        private Bean1 myBean1= null;
        private String name = new String();
        public void doInitialization(){
              try{
                                  IntitialContext context = new javax.naming.InitialContext();
                                  DataSource dataSource = (DataSource)context.lookup("java:env/jdbc/appDB");
                                  Connection connection = dataSource.getConnection();
                                  Statement stmt = connection.createStatement();
                                  ResultSet rs = stmt.executeQuery("Select AppraisalYear From tblAppraisal Where AppraisalYear='2007'");
                                          while(rs.next()){
                                            year = rs.getString("AppraisalYear");
                                            rs.close();
                                            stmt.close();
                                            connection.close();
                                            return year;
                                       }catch (Exception n){
                                            n.printStackTrace();
              IPortalComponentProfile profile = ((IPortalComponentRequest)getRequest()).getComponentContext().getProfile();
                     Object o = profile.getValue("myBean1");
                     if(o==null || !(o instanceof Bean1)){
                        myBean1 = new Bean1();
                        profile.putValue("myBean1",myBean1);
                     } else {
                          myBean1 = (Bean1) o;
                        Object value = request.getSession().getValue("myBeans1");
                        if (value==null || (value instanceof Bean1)){
                             myBean1 = new Bean1();
                        request.getSession().putValue("myBean1", Object value);
              DataBase cn = new DataBase();
              name = cn.dataBaseConnection();
              myBean1.setName(name);
    //name = "gir";
    //myBean1.setName(name);
    // IPortalComponentRequest request = (IPortalComponentRequest) this.getRequest();
    //IPortalComponentContext myContext = request.getComponentContext();
    //Bean1 myNameContainer = (Bean1) myContext.getValue("myBean1");
    //myNameContainer.setName(name);
          // fill your bean with data here...
        public void doProcessAfterInput() throws PageException {
        public void doProcessBeforeOutput() throws PageException {
          this.setJspName("testDBv5.jsp");
    //testing purpose
      public static void main (String[] arg){
         testDBv5DynPage ef = new testDBv5DynPage();
               ef.doInitialization();
    Thanks Loads
    Quatre

  • Parse Data between states

    Data parsing
    Hi, I was wondering if any1 could help me out with a problem
    I have in Flex2, Im still a beginner in flex2 and Im looking ways
    to parse data from a selected item in a combo box to a next state
    in my canvas? also I need to know how to query XML from flex 2 so I
    can filter out results in a, say, a data grid.
    thanks a lot, for helping out a newbie...

    The shift register is the right tool for this job.  It follows the left to right data flow paradigm, unlike other solutions (such as using a local variable).  I am sure you will get a few other opinions but I think that the shift register is the way to go.
    CLA, CLED, CTD,CPI, LabVIEW Champion
    Platinum Alliance Partner
    Senior Engineer
    Using LV 2013, 2012
    Don't forget Kudos for Good Answers, and Mark a solution if your problem is solved.

  • Parsing data and unmerging cells

    Does anyone know how to parse data in Numbers? This is the "text to columns" feature in excel, that allows you to select a vertical range of cells, and have it parse the data into different columns based on a decision rule (e.g. fixed width, or particular separators?)
    Similarly, I am also trying to "unmerge" cells. The buttons under "Merge and split" in the Table Inspector does not do what I need, since it actally creates new columns in the spreadsheet, rather than split the cell into existing columns. Any advice would be appreciated.

    Thanks to all for the responses, but they do not resolve the underlying questions.
    1) Regardless of whether there are an even or odd number of columns, Numbers still seems to add columns, rather than split the cell into existing columns, when I use the merge / split function in the Table Inspector. The only "work-around" I've come up with (if you can call it that) is to go to the nearest column that does not have any merged cells, add a column to the right or left, and then copy and paste the non-merged cells, and retype the merged cells from the old column into the unmerged cells of the new column. Very clunky.
    2) Regarding parsing, if I have to get involved in text functions, then it only helps me do fixed width text-to-columns, and it is also quite clunky. If I want to parse using tabs, spaces, commas, etc. do I really need to save the contents of the cells into a separate text file, and then re-import??? There has to be a better way, no?

  • "Error parsing data-sources config" when I restart JDeveloper

    I am using JDeveloper. Every time I got the same server error - "Error parsing data-sources config" when I restart JDeveloper and even if i use a project it works before JDeveloper is restarted.
    Firstly, I import EAR file to the JDev, then I work on my code, everything is fine and compile.
    But If I restart the JDeveloper and open the same project again, it has the error Error parsing data-sources config, Exception: The factory-class cannot be empty.
    And I need to everything again, import EAR file, get the changes from my previous project. It really slows down my working efficiency.
    Do you know what the problem is?
    2008-06-24 12:13:46.289 Exception processing legacy data source. Exception: The factory-class cannot be empty.
    2008-06-24 12:13:46.289 Exception processing legacy data source. Exception: The factory-class cannot be empty.
    2008-06-24 12:13:46.305 Application Deployer for dvt-faces-test-13 FAILED.
    2008-06-24 12:13:46.321 WARNING: DeployerRunnable.run java.lang.InstantiationException: Error parsing data-sources config at file:/C:/Documents and Settings/ytang.WALT-DCNT/Application Data/JDeveloper/system11.1.1.0.30.50.26/o.j2ee/embedded-oc4j/application-deployments/dvt-faces-test-13/data-sources.xml: DataSourceConfigException: The factory-class cannot be empty.oracle.oc4j.admin.internal.DeployerException: java.lang.InstantiationException: Error parsing data-sources config at file:/C:/Documents and Settings/ytang.WALT-DCNT/Application Data/JDeveloper/system11.1.1.0.30.50.26/o.j2ee/embedded-oc4j/application-deployments/dvt-faces-test-13/data-sources.xml: DataSourceConfigException: The factory-class cannot be empty.
    2008-06-24 12:13:46.321 at oracle.oc4j.admin.internal.DeployerBase.execute(DeployerBase.java:136)
    2008-06-24 12:13:46.321 at oracle.oc4j.admin.jmx.server.mbeans.deploy.OC4JDeployerRunnable.doRun(OC4JDeployerRunnable.java:52)
    2008-06-24 12:13:46.321 at oracle.oc4j.admin.jmx.server.mbeans.deploy.DeployerRunnable.run(DeployerRunnable.java:82)
    2008-06-24 12:13:46.321 at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885)
    2008-06-24 12:13:46.321 at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
    2008-06-24 12:13:46.321 at java.lang.Thread.run(Thread.java:619)
    2008-06-24 12:13:46.321 Caused by: java.lang.InstantiationException: Error parsing data-sources config at file:/C:/Documents and Settings/ytang.WALT-DCNT/Application Data/JDeveloper/system11.1.1.0.30.50.26/o.j2ee/embedded-oc4j/application-deployments/dvt-faces-test-13/data-sources.xml: DataSourceConfigException: The factory-class cannot be empty.
    2008-06-24 12:13:46.321 at com.evermind.server.deployment.EnterpriseArchive.parseDataSources(EnterpriseArchive.java:1680)
    2008-06-24 12:13:46.321 at com.evermind.server.deployment.EnterpriseArchive.parseDataSources(EnterpriseArchive.java:1666)
    2008-06-24 12:13:46.321 at com.evermind.server.deployment.EnterpriseArchive.parseDeploymentMainNode(EnterpriseArchive.java:588)
    2008-06-24 12:13:46.321 at com.evermind.xml.XMLConfig.parseRootNode(XMLConfig.java:344)
    2008-06-24 12:13:46.321 at com.evermind.server.deployment.EnterpriseArchive.parseRootNode(EnterpriseArchive.java:2561)
    2008-06-24 12:13:46.321 at com.evermind.xml.XMLConfig.init(XMLConfig.java:224)
    2008-06-24 12:13:46.321 at com.evermind.server.J2EEComponent.initDeployment(J2EEComponent.java:264)
    2008-06-24 12:13:46.321 at com.evermind.server.J2EEComponent.initDeployment(J2EEComponent.java:194)
    2008-06-24 12:13:46.321 at com.evermind.server.deployment.EnterpriseArchive.<init>(EnterpriseArchive.java:348)
    2008-06-24 12:13:46.321 at oracle.oc4j.admin.internal.ApplicationDeployer.initArchive(ApplicationDeployer.java:468)
    2008-06-24 12:13:46.321 at oracle.oc4j.admin.internal.ApplicationDeployer.doDeploy(ApplicationDeployer.java:206)
    2008-06-24 12:13:46.321 at oracle.oc4j.admin.internal.DeployerBase.execute(DeployerBase.java:99)
    2008-06-24 12:13:46.321 ... 5 more
    oracle.jdeveloper.deploy.DeployException: Deployment Failed
    at oracle.jdevimpl.deploy.common.Jsr88RemoteDeployer.distributeApplicationToTargets(Jsr88RemoteDeployer.java:672)
    at oracle.jdevimpl.deploy.common.Jsr88RemoteDeployer.deployApp(Jsr88RemoteDeployer.java:1108)
    at oracle.jdevimpl.deploy.common.Jsr88RemoteDeployer.deployImpl(Jsr88RemoteDeployer.java:183)
    at oracle.jdeveloper.deploy.common.AbstractDeployer.deploy(AbstractDeployer.java:94)
    at oracle.jdevimpl.deploy.fwk.WrappedDeployer.deployImpl(WrappedDeployer.java:39)
    at oracle.jdeveloper.deploy.common.AbstractDeployer.deploy(AbstractDeployer.java:94)
    at oracle.jdeveloper.deploy.common.BatchDeployer.deployImpl(BatchDeployer.java:82)
    at oracle.jdeveloper.deploy.common.AbstractDeployer.deploy(AbstractDeployer.java:94)
    at oracle.jdevimpl.deploy.fwk.WrappedDeployer.deployImpl(WrappedDeployer.java:39)
    at oracle.jdeveloper.deploy.common.AbstractDeployer.deploy(AbstractDeployer.java:94)
    at oracle.jdevimpl.deploy.fwk.DeploymentManagerImpl.deploy(DeploymentManagerImpl.java:435)
    at oracle.jdeveloper.deploy.DeploymentManager.deploy(DeploymentManager.java:209)
    at oracle.jdevimpl.runner.adrs.AdrsStarter$4$1.run(AdrsStarter.java:1252)
    #### Cannot run application dvt-faces-test-13 due to error deploying to DefaultServer.
    [Application dvt-faces-test-13 stopped and undeployed from Server Instance DefaultServer]
    Thanks a lot

    By the way, I am using Windows Platform. For any version of JDeveloper from June I used has the same problem.

  • Parse Date To Matrix DateColumn

    Hello all,
    How do parse date to Matrix DateColumn using vb.net
    Thanks

    Hi Prince Annie,
    Date values, in all controls, are stored in the ANSI format: yyyymmdd.
    Just like decimals (ANSI format): . separated values, with no decoration.
    Regards,
    Eric

  • Parsing data from indexed field

     
    Hi,
    A contractor is developing a program to parse data from a form that I created in LiveCycle. There are some tables in the form where text fields in the same column have the same base name and are assigned an index by LiveCycle. For instance, there might be a CompanyName column with 6 text fields in each of 6 rows, where the text fields are named as follows: CompanyName [0], CompanyName [1], CompanyName [2], CompanyName [3], CompanyName [4], CompanyName [5].
    The programmer of the parsing program is having trouble parsing the data for those indexed fields from the XML.  Any pointers you could give me (that I would pass on to the programmer) for how to parse data from fields with indexed names like these?  I know just a little about what he is trying to do.  He said he is using a third-party DLL called iTextSharp for the parsing.  If any pointers come to mind on what he might do, please let me know.
    Thanks,
    Emily

    When design Adobe forms, you can have multiple fields with same name; as you mentioned your fields can be named as
    CompanyName [0], CompanyName [1], CompanyName [2], CompanyName [3], CompanyName [4], CompanyName [5]
    However when the form is submitted the form data (in the form of XML) would look like as follows:
    <xdp:xdp xmlns:xdp="http://ns.adobe.com/xdp/">
        <xfa:datasets xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/">
            <xfa:data>
                <form1>
                        <page1>
                                  <yourSubform>
                                           <CompanyName>My Company 1</CompanyName>
                                            <CompanyName>My Company 2</CompanyName>
                                            <CompanyName>My Company 3</CompanyName>
                                            <CompanyName>My Company 4</CompanyName>
                                            <CompanyName>My Company 5</CompanyName>
                                            <CompanyName>My Company 6</CompanyName>
                                  </yourSubform>
                        </page1>
                </form1>  
            </xfa:data>
        </xfa:datasets>
    </xdp:xdp>
    Note that all the CompanyName fields are named without any indexing.
    If you explain this format to your programmer, he will be able to understand and write a logic to retrieve all CompanyName field's values.

  • Exception while Parsing date

    When i try to parse date like this :
    Date date = new Date();
    date = DateFormat.getDateInstance(DateFormat.SHORT).parse("08.02.05");
    out.println(date);
    At run time i get the following Exception:
    Exception in thread "main" java.text.ParseException: Unparseable date: "08.02.05"
    at java.text.DateFormat.parse(DateFormat.java:335)
    at demo.main(demo.java:12)
    I had seen this working in an example and now this is not working.....can anyone tell me Why.................

    It probably depends on your regional settings. You should specify the pattern instead of using DateFormat.SHORT.
    Kaj

  • How to parse data from a text file with no convenient delimiters?

    I need to read data from a text file.  This file contains one line of data with the repeating pattern "time 00 ADVar2: ___ Height: ____ time 01 ADVar2: ___ Height: ___ ..."  I need LabView to parse out the "time" and "height" values, build an array with the values, and graph the correlation on an X&Y plot.  Does Labview have an automated way to read to the input data file and parse out the correct values, even without convenient delimiters?  Thank you.

    You actually do have a convenient delimiter: "time". Thus, you can make an array using that as the delimiter. Only caveat is that the first array element will be empty. Then you can conveniently use the Scan From String function in a for-loop. Something like this:
    Message Edited by smercurio_fc on 11-21-2008 03:13 PM
    Attachments:
    Example_VI.png ‏9 KB

  • Parsing data from Serial Port one byte at a time

    Hi everyone,
            What I want to do is read in from the serial port byte by byte and parse each byte that I am reading in. The size of the data read in varies. How do I do that? I can do using .dll but I want to learn how to do it in labview. I searched through the forum for something similar but no luck. I have seen some that puts the VISA read in a while loop and others that puts the property node,  "bytes at Port" in a while loop. What is the difference in doing either way? I am using Labview 7.1 Can anyone point me in the right direction?
    Thanks

    Hi guys..
    I'm still a beginner in using labview tcp/ip function. for now, i have a project to read the labview data with java programming language so that i can monitor that data using any devices that using java, such as PC or cell phone. my task for now is to determine the format of data that being sent (its type, length, etc), coz as far as i done until now, the data that read in the java is still a raw material so that i dont know how to gain the information from that data.
    my question is :
    - how does the type cast work in changing the data format from one to another?
    - how does the bytes to read in tcp read work? coz when i'm changing the length of bytes to read constant from 4 bytes to another, the data is becoming mess up. As far as i know, the bytes to read only read the first "constant number" byte in the tcp read to determine the length and type of the data..
    thanks

Maybe you are looking for

  • How does one use punch in with v 5.5?

    Hello,  just downloaded the trial in hopes the punch in functions were straightened out (my terminology) vs. version 3. So far I haven't found a way to use this (non) feature.  I can punch in but then what does one do to select and merge the best tak

  • Spry Photo Gallery not visible other than in Safari

    Hi, I created a photo gallery using Spry using the step-by-step instructions found at http://www.adobe.com/devnet/dreamweaver/articles/spry_photo_album.html. The problem is that my gallery only can be viewed in Safari - Firefox, Netscape and Explorer

  • Web Page Composer Multi Language Content

    Hi, can the content of WPC pages language-dependant? What is the strategy for multi-languages web sites with WPC? I have the request of a customer who wants to display WPC content on pages dependant on the language selected by user personalization #T

  • Hiding buttons on stadard web template

    Hi We are working on BW 3.5 version Client does not want to see 'Information broadcast' and 'CSV Download' buttons in the SAP standard web template (0ADHOC) output. How do i make these two buttons invisible?  Note: I have very limited knowledge of HT

  • My friend in vietnam use my account itunes. He wants to buy credits in app wephone,but he can't, What's happening?

    My friend in vietnam use my account itunes. He wants to buy credits in app wephone,he can't buy it, but i can .My account itunes have 100$ more ( gift card), What's happening?