Gathering data

i would like to get my radio buttons to display below, a string of text, how would i go about doing that?
* swingMakeup.java requires no other files.
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class swingMakeup implements ItemListener, ActionListener{
    JPanel cards; //a panel that uses CardLayout
    final static String BUTTONPANEL = "Meats";
    final static String TEXTPANEL = "Name Of Customer";
    final static String TEXTPANEL2 = "Number of Subs";
    final static String CHECKPANEL = "Fixins'";
    JRadioButton beef, turkey, sheep;
    JTextField name, number;
    public void addComponentToPane(Container pane) {
        //Put the JComboBox in a JPanel to get a nicer look.
        JPanel comboBoxPane = new JPanel(); //use FlowLayout
        String comboBoxItems[] = { BUTTONPANEL, TEXTPANEL, TEXTPANEL2, CHECKPANEL };
        JComboBox cb = new JComboBox(comboBoxItems);
        cb.setEditable(false);
        cb.addItemListener(this);
        name.addActionListener(this);
        number.addActionListener(this);
        comboBoxPane.add(cb);
        //Create the "cards".
        JPanel card1 = new JPanel();
        card1.add(beef=new JRadioButton("Beef Lips -- $5.00"));
        card1.add(turkey=new JRadioButton("Turkey Liver -- $4.00"));
        card1.add(sheep=new JRadioButton("Sheep Stomach -- $6.00"));
        JPanel card2 = new JPanel();
        card2.add(name=new JTextField("", 20));
        JPanel card3 = new JPanel();
        card3.add(number=new JTextField("", 20));
        JPanel card4 = new JPanel();
        card4.add(new JCheckBox("Lettuce"));
        card4.add(new JCheckBox("Tomato"));
        card4.add(new JCheckBox("Onion"));
        card4.add(new JButton("Submit Order"));
        //Create the panel that contains the "cards".
        cards = new JPanel(new CardLayout());
        cards.add(card1, BUTTONPANEL);
        cards.add(card2, TEXTPANEL);
        cards.add(card3, TEXTPANEL2);
        cards.add(card4, CHECKPANEL);
        pane.add(comboBoxPane, BorderLayout.PAGE_START);
        pane.add(cards, BorderLayout.CENTER);
    public void itemStateChanged(ItemEvent evt) {
        CardLayout cl = (CardLayout)(cards.getLayout());
        cl.show(cards, (String)evt.getItem());
     * Create the GUI and show it.  For thread safety,
     * this method should be invoked from the
     * event-dispatching thread.
    private static void createAndShowGUI() {
        //Create and set up the window.
        JFrame frame = new JFrame("swingMakeup");
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        //Create and set up the content pane.
        swingMakeup demo = new swingMakeup();
        demo.addComponentToPane(frame.getContentPane());
        //Display the window.
        frame.pack();
        frame.setVisible(true);
    public static void main(String[] args) {
        //Schedule a job for the event-dispatching thread:
        //creating and showing this application's GUI.
        javax.swing.SwingUtilities.invokeLater(new Runnable() {
            public void run() {
                createAndShowGUI();
}

1) I don't understand the question
2) The code doesn't compile, so I can't see what you are trying to do
3) Read the Swing tutorial on "Using Radio Button". You where given a link to the tutorial in your last posting.

Similar Messages

  • I subscribed two weeks back and on the iTunes site Step 1 gathering data is still going on. Why is it taking so long?

    I subscribed two weeks back and on the iTunes site Step 1 gathering data is still going on. Why is it taking so long?

    I was also having this problem after having successfully used iTunes Match previously. The problem appears to be when there are two version of songs and one of them has the iCloud icon made using a dotted line. Here's what solved it for me:
    1. Identify your duplicate files. I have a large library, so I elected to use Dupin Light (available on the Mac App store). I suppose I could have used iTunes duplicate finder too, but I prefer the flexibility of Dupin.
    2. Once you have identified your duplicates, find them in iTunes. In my case Dupin identifed 50, from 19,000+ tracks, so for me it was not a large number to check manually.
    3. When you find the duplicates, if one of them has the aforementioned dotted line iCloud icon, this is the one you need to delete. If you accidently delete the other version, you can always download it again if you have purchased it from iTunes. In any case, it seems to be the tracks with this icon that it is causing iTunes Match to stall, so you will need to delete all of these.
    4. Once you have completed step 3, iTunes Match should not proceed and complete.

  • Populate a list with previously gathered data

    I would like to populate a dropdown list with data previously gathered within the same form. How do I do this?

    There are a variety of ways. For example, if 'stooges' is a drop-down list and 'stoogeName'  is a text field, you could put the following JavaScript on the exit event of 'stoogeName',
    // form1.page1.subform1.stoogeName::exit - (JavaScript, client)
    form1.page1.subform1.stooges.addItem(this.rawValue);
    Steve

  • Encoding Problem: Losing German Umlaute from gathering data from Oracle 8i

    my problem does concerns the diplay of german Umlaute such as äöüß etc. The OS is NW65 out of the box with Apache 2.0.49 and tomcat 4.1.28, JVM 1.4.2_02 and JDBC-driver Oracle 8i 8.1.7 JDBC Driver.
    The Data containing Umlaute which are retreived from the Database does somehow lose it´s Umlaute. The Umlaut which are coded in the servlet directly in order to generate the regular HTML does display the Umlaute without any problem.
    The same servlet and request from a Unix Enviroment does work fine. We have checked all Codepage settings (Java, NetWare, Tomcat etc).

    Hi Sven and Ingmar,
    I will try to kill 2 birds with one stone here. First of all you should check the definition of your current database character set and make sure that it can support all the characters that you need to store in your database.
    Please check out
    http://www.microsoft.com/globaldev/reference/iso.asp
    WE8ISO8859P9 is for Turkish and WE8ISO8859P1 is for western European (without Euro support).
    Next you need to set your client NLS_LANG character set (eg. for your SQL*Plus seesion), so that Oracle can convert your client operating system characters correctly into your database character set. The NLS_LANG character set also determines how SQL*Plus interpret/display your characters upon retrieval from the db.
    In both of your cases , I believed that the client NLS_LANG setting was not defined , hence this was defaulting to AMERICAN_AMERICA.US7ASCII. This is telling SQL*PLUS that the your client operating system can handle ASCII data only , hence all the accented characters are converted to ASCII during insertion into the database. Likewise upon data retrieval.
    If you are running SQL*PLUS client on English Windows then you NLS_LANG character set should be WE8MSWIN1252 and for Turkish Windows it should set to TR8MSWIN1254 .
    If the client character set and the database character set are the same , Oracle does not perform any data conversion, that's why if you use a US7ASCII database and set you NLS_LANG character set to US7ASCII .then you can insert all the accented Latin characters , Japanese , Chinese etc. This configuration is not supported, and it can cause many issues.
    For more information on character set configuration and possible problems.
    Please check out the white paper Database Character set migration on http://otn.oracle.com/products/oracle8i/content.html#nls
    And the Globalization Support FAQ at:
    http://technet.oracle.com/products/oracle8i/
    Regards
    Nat
    null

  • Gathering data at high speed and then proccessing it

    Using LV 8.0 I have to read two channels 16000 times at 10Khz. I used an express vi that feeds directly to a write to spreadsheet vi and it works nicely. However I would like to use a polynomial that converts the voltage of one of the channels to a temperature. When I put the polynomial ( in a formular box) in between the express vi and the spreadsheet write by using split and merge data functions everything slows down and wont capture all the data. So I was thinking about using a sequence structure and reading the data in one frame and processing it in the next one. So, I was wondering in what form to pass the data to the second frame, building an array and passing it through a sequence local only gives me one line.
    Any suggestions will be welcomed.

    Using a sequence structure won't solve your problem. All that you're doing is moving the location where it's going to slow down. Besides, you don't need a sequence structure to enforce execution order.
    It sounds like you need to separate the data collection and the data processing so they operatate independently. This can be done in many ways. A queue is one basic way to do this. What is the purpose of the polynomial application? Is it being displayed on a graph? Are you saving it to file? Can you provide a snapshot of the code, or better yet, upload it?

  • Gathering data from different Jpanels

    Hi, I've just started SWING programming and have been doing servlets for quite awhile now. I would like to know if there's a way to gather data from fields in multiple panels into an object and then process them all at once (something like the MVC design pattern). My main problem is passing the object from panel to panel. In servlets, I can store the object in the session or request scope. Is there an equivalent concept in SWING programming?
    Thanks in advance for any assistance.

    In short, yes you can in the staged (extracting to DB) approach, but here are some things you need to conside.
    - You can schedule multiple download schemas to extract from each client as required
    - Consider if any number ranges will clash (you can get round this but it is more work).  You need a unique id for each object you are extracting (OU, Pos, Employee, Job, etc)
    - Think about how you can "join" the data.  You can hard code (not ideal) the additional relationships in your download schema to make these joins.  Or perhaps read them in from a bespoke table in SAP?
    - Is the configuraiton sufficiently similar in each client? Will any data conflict with any other in its meaning?
    - What security do you need on the data if they are from different legal entities?
    Personally we (at ROC) have done this for multiple data sources but in our case one was SAP, one was a legacy system.
    Hope that helps,
    Stephen

  • Gathering data from entire month, from a date within that month

    hello, i have the following code
    select 'Shipped Amount' Descrip,(SELECT ROUND(sum(line_item_amount),2) from v_bi_invoiced_sales
    where client='PROD' and mat_type='CAST'
    and to_char(trunc(invoice_date),'YYYYMM')= TO_CHAR(TO_DATE(:P1_FROM_DATE,'MM/DD/YY'),'YYYYMM')) as Monthly,
    (SELECT sum(line_item_amount) from v_bi_invoiced_sales
    where client='PROD' and mat_type='CAST'
    and to_char(trunc(invoice_date),'YYYY')= TO_CHAR(TO_DATE(:P1_FROM_DATE,'MM/DD/YY'),'YYYY')) as Yearly
    from dualI have a different report that has only one date field, and i want to find whatever total montly shipping from whatever date is entered. Example: today is march 26th, and if this is entered, i want to find all this shipping from march 1st, 2010 through date. Another example: if Jan 6th, 2010 is entered, i want the entire month of Jan2010 shipping in the monthly shipping field displayed.
    thanks
    Corey

    select sum(nvl(total_invoice_amt,0)) from a_invoice_header
    where client ='PROD'
    and invoice_date between :p1_date('01-'||to_char(:p1_date,'MON-RR'),'DD-MON-RR') and last_day(:p1_date)and BILLING_DOC_TYPE ='IN'my ":p1_date" is a date displayed from the date picker (use application format mask) and its source is:
    SELECT TRUNC(SYSDATE) FROM DUALso it is basically the system date, i change everything to :p1_date and am still getting:
    ORA-01403: no data found
    Error ERR-1020 Error in PLSQL item processing (function).
    OK
    corey

  • Data Gathering Application - Architecture Question

    I'm working on revising an existing application that's used to collect data gathered by users from various sources (various computer systems, paper files, discussions/interviews with other employees, etc.) which is then used for analysis and reporting of level of compliance with mandates at various levels (overall, location, individual).
    The existing application gathers data via two basic form types: one is for a specific individual having multiple data points; the other is for everyone in the location with multiple data points. For example, type 1 looks like:
    Person
    Question 1 Response 1
    Question 2 Response 2
    Question N Response N
    While the Type 2 form looks like:
    Location
    Person 1 Question 1 Question 2 ... Question N
    Person 2 Question 1 Question 2 ... Question N
    Person N Question 1 Question 2 ... Question N
    The questions are grouped by types of information being analyzed, so that those questions appear on different pages and may apply to different sets of individuals or locations. Not all locations are required to gather information on the same questions, depending on their compliance level last year. So, location A may have to answer questions 1, 2 and 3, while location B may answer questions 1, 3 and 4.
    My question is this: The table used to store the data is structed like:
    Person ID, location, page, q1, q2, ..., qN
    To continue the above example of locations A and B, both locations would store the responses in columns q1, q2, and q3 since they had three questions that applied to them. We can then reconstruct which question the response applies to by checking which questions applied to the location. We're using the apex api in the query to generate select-list items for the questions with the valid responses for each question (some are yes/no, others allow NA, a number 1-3, or a typed-in positive integer for a couple of questions).
    Since we need to maintain the data from two forms (either for an individual or for all individuals at a location), would it be easier to maintain in APEX using a table that stores each question in a separate row?
    PersonID, location, Page, question, response
    Further, we want to simplify the application which currently uses a separate page for each item type which is customized to the max number of questions for that page for the year. Instead we want to make a more generic set of pages that can at least handle an arbitrary number of items or, ideally, however many questions may be applicable in the future. While we can assume that the practical upper limit would be 30 questions, in the future it is possible we could be mandated to ask several times that number, maybe 100 or more.
    The main goal is to make the application robust to handle the questions consistenly, no matter how many are defined for a type and no matter how many are required for the selected individual or location.
    I'm already working on the page simplification process by replacing literals with session-state and application items, and realize that to make the pages robust we'll have to convert from static queries to generating the query from plsql using generic columns for the report in APEX.
    If anyone could share their thoughts/experience with this type of application, your input is greatly appreciated.
    Thanks,
    Richard

    Hi Richard,
    I find it bad practice to make a table PersonId, location, page, q,q1 .. qN
    it will do more harm in analysing the data than you will benefit in collecting the information.
    In my opinion you should normalize it a bit more. Seperate table for Person, with it's attributes. and if it is a 1 to 1 relation, also an locationId. Then a seperate table to hold the location information. Then you are having questions and awnsers. based on compliance level of the location persons may answer these questions. So in my opinion, youre location-table will have an attribute 'compliance_level' and in the question table also an attribute, like minimum compliance level. so this could be an criteria for showing questions or not.
    To register the answers done bij a person, also an awnser-table will be nesseccary, with relation to the specific question and the personId who answer it. Because of the 1 to 1 relation between person and location, this information does not have to be registerd with the anwsers.
    so in short:
    5 tables =>
    Person (id, name, locationId, etc. )
    Location (id, locationName, complianceLevel)
    Question(id, quetion, minCompliance)
    Anwser(id, questionId, personId, answerId)
    In order to create these forms, i guess a master-detail form will be in place. where for one master (person in this case), the details can be shwon (question) in a tabular form with input for the answers.
    hope this will help!

  • Migration data gathering from ConfigMgr 2007 site is failing

    I have CM12 and CM07 primary sites. In the past I have successfully used the migration features in the CM12 console to migrate data from CM07 source hierarchy. However, to upgrade my CM12 site to R2 I had to stop the data gathering. Now a month later I am
    trying to gather data again but it fails every time. It happens even after cleaning up previous migration data. This is the error I see after 30 minutes of gathering data
    Configuration manager failed to gather data from cm07.domain.local
    The data gathering process failed. Check migmctrl.log.
    Looking at the log these are the only errors I see:
                                                                    ERROR: [Worker]: Microsoft.ConfigurationManagement.Migration.MigrationException:
    1 exceptions occurred during syncing.     at Microsoft.ConfigurationManagement.MigrationManager.SyncAgentJob.<get_ExecutionPlan>d__7.MoveNext()     at Microsoft.ConfigurationManagement.MigrationManager.Job`1.ExecuteNext()
    SMS_MIGRATION_MANAGER 2/27/2014 8:24:46 PM
    6056 (0x17A8)
                                                                    [Worker]: Start processing status
    changed event for MIG_SiteMapping.ID=16777218
    SMS_MIGRATION_MANAGER 2/27/2014 8:24:46 PM
    6056 (0x17A8)
                                                                    [Worker]:        
    Set the schedule item 16777218 end time SMS_MIGRATION_MANAGER
    2/27/2014 8:24:46 PM 6056 (0x17A8)
                                                                    [Worker]:        
    Set the schedule item 16777218 status to Failed
    SMS_MIGRATION_MANAGER 2/27/2014 8:24:46 PM
    6056 (0x17A8)
                                                                    [Worker]: End processing status changed
    event for MIG_SiteMapping.ID=16777218 SMS_MIGRATION_MANAGER
    2/27/2014 8:24:46 PM 6056 (0x17A8)
                                                                    [Worker]: Disposing Job 16777218
    SMS_MIGRATION_MANAGER 2/27/2014 8:24:46 PM
    6056 (0x17A8)
                                                                    [Worker]: Removing Job 16777218 from
    job manager. SMS_MIGRATION_MANAGER
    2/27/2014 8:24:46 PM 6056 (0x17A8)
                                                                    [Worker]: Removing the Job with Id
    16777218. SMS_MIGRATION_MANAGER
    2/27/2014 8:24:46 PM 6056 (0x17A8)
                                                                    [Worker]: Disposing worker
    SMS_MIGRATION_MANAGER 2/27/2014 8:24:46 PM
    6056 (0x17A8)
                                                                    [Worker]: Disposing current site
    connection SMS_MIGRATION_MANAGER
    2/27/2014 8:24:46 PM 6056 (0x17A8)
    ERROR: [MigMCtrl]: FAILED to EXECUTE job. error = Unknown error 0x80131500, 80131500
    SMS_MIGRATION_MANAGER 2/27/2014 8:24:46 PM
    6056 (0x17A8)
    ERROR: [MigMCtrl]: FAILED to EXECUTE job. error = Unknown error 0x80131500, 80131500
    SMS_MIGRATION_MANAGER 2/27/2014 8:24:46 PM
    6056 (0x17A8)
    Now I do see some CM07 objects in my CM12 console (shared DP's and boundary groups) so I know part of the process was successful. Any ideas on my errors above?

    Hi,
    Just like Gerry said, please look through the log to find the problem. The following thread could be helpful.
    http://social.technet.microsoft.com/Forums/en-US/a619f187-9683-4cb2-aa5e-2f9bc619323e/error-during-data-gathering-process?forum=configmanagermigration
    Best Regards,
    Joyce Li
    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.

  • Problem with writing continuous data to excel using using Report Generation vi's

    Hey Everyone,
    I am trying to read the data from DAQ and write to excel continuously using Report Generation vi's. 
    But when I run the VI, it writes only one interation of the while loop (gathering data from DAQ continuously) and doesn't append the data into the same file when I run it again after stoping the VI. 
    I have attached the VI i created. Please let me know if you have any idea to solve this issue. 
    Thanks
    Attachments:
    sample 5.vi ‏35 KB

    There are two problems with your VI.  First, the basic logic of writing/appending to a file (Excel, TDMS, anything) should go something like this:  Open the file, position yourself at the end of the file, then, in the loop, acquire data and write it to the file until you are finished with data acquisition.  When you exit the acquire/write to file loop, then close the file.  In particular, the opening and the closing of the file should not be inside the loop.
    As others have pointed out, writing to Excel might not be optimal, particularly if you are acquiring data at a high rate (and would therefore be writing a lot of data). We actually use Excel in our data acquisition routine, mainly reading from a WorkSheet to get the parameters of a particular stimulus, but also writing the outcome of the response to the stimulus.  As it happens, our "acquisition rate" in this example is on the order of several samples per minute, so there's no problem using Excel (we also sample 16 channels of analog data at 1 KHz -- this gets written as a binary file).
    Second, if you really do want to use Excel, use the (existing) Excel file to which you want to append as the "template" argument of the New Report function.  Then use the Excel Get Last Row function to position yourself at "end of file", as noted above.
    Good Luck.
    Bob Schor

  • Best Method for Saving Data to File?

    Hi, 
    We're using labVIEW 2009 to acquire data from our instrument.  In the past we have used the "write to labview measurement file" express configuration tool to save data to a file. However we had some issues with our VI - occasionally we would lose data or column headers somewhat erratically and were never able to sort out the problem. We would like to rewrite our VI with the best possible solution. 
     Here's a summary of what we would like to do:
    Save 30 variables at a rate of roughly 1 Hz. We would like one set of column headers per file so that the data can be easily imported into labVIEW with the variable names intact. We will be collecting data continuously, so we would like to divide the data into 3-4 files per day. Ideally, the program to start new files at the same times from day to day and the filename could be configured to include the date and time/file number.
    I am hoping that users can provide a little feedback about methods that were most successful and reliable. From what I have read there are a few different ways to do this (express VI, tdms, "write to text file"). Any thoughts or relevant examples would be quite useful for us!
    Thanks for your help!

    Meg T wrote:
    Is it correct to say that in your method, the indexing results in building up the data into one large array of data before saving it to the file with the column headers and filenames appended?  If we are writing data at 1Hz for 6 hours of time, will we run into an issue being able to store all the data?
    Yes the indexing will build up one large array.  If this is a problem due to array size and memory, you will have to write more often.  You can write every second, that should not be a problem.  You should still write the column names to the file first, and have the append input set to False (or nothing wired in since the default is false).  This will create a new file with the headers only.  Then the data write has a True wired in so that the append takes place.  If running for 6 hours and gathering data once per second, your array will contain 36,006 rows of data.  I'm not sure if that would cause a memory problem or not.
    Meg T wrote:
     it also seems difficult to incorporate headers into express VI if you are writing the data continuously as a part of a loop with the "append" option.
    If you write the headers before the loop as I have shown, and use append inside the loop, you will not have problems.
    - tbob
    Inventor of the WORM Global

  • Form Posts & Emails with no Data Returned

    I'm working on a php form that I'm trying to feed through GoDaddy's network.  I have a beginner's understanding and took code to create the php file that was linked in the "actions" part of the DW CS3 form's file.
    The email was sent to me with all the identifiers.  However, nothbing was populated.  Further, the sender's email wasn't posted - this is what was listed for the sender:
    [email protected]
    The form can be reached here: http://www.sophisticup.com/SignUp.php
    I think I'm missing something small but it is having a great effect on my final results.  Can anyone help me?
    Thanks!
    Below is my code for the linked "action" php file:
    <?php
    /* Subject and Email Variables */
    $emailSubject = 'Sign Up Form';
    $webMaster = '[email protected]';
    /* Gathering Data Variables */
    $FNameField = $_POST['firstname'];
    $LNameField = $_POST['lastname'];
    $TitleField = $_POST['title'];
    $Add1Field = $_POST['address1'];
    $Add2Field = $_POST['address2'];
    $CityField = $_POST['city'];
    $StateField = $_POST['state'];
    $ZipField = $_POST['zipcode'];
    $EmailField = $_POST['email'];
    $PhoneField = $_POST['phone'];
    $EmailPhoneField = $_POST['emailorphone'];
    $CallTimeField = $_POST['timetocall'];
    $RevenueField = $_POST['revenue'];
    $GSizeField = $_POST['gsize'];
    $CommentsField = $_POST['comments'];
    $body = <<<EOD
    <br><hr><br>
    firstname: $firstname <br>
    lastname: $lastname <br>
    title: $title <br>
    address1: $address1 <br>
    address2: $address2 <br>
    city: $city <br>
    state: $state <br>
    zipcode: $zipcode <br>
    email: $email <br>
    phone: $phone <br>
    eorph: $emailorphone <br>
    CallTime: $timetocall <br>
    Revenue: $revenue <br>
    GrpSize: $gsize <br>
    Comments: $comments <br>
    EOD;
    $headers = "From: $email\r\n";
    $headers .= "Content-type: text/html\r\n";
    $success = mail($webMaster, $emailSubject, $body, $headers);
    /* Results rendered as HTML */
    $theResults = <<<EOD
    <html>
    <head>
    <title>Sophisticup - Fundraising Boutique for the Home</title>
    <meta http-eequiv="Content-type" content="text/html; charset=iso-8859-1">
    <style type-"text/css">
    <!--
    body {
    background-color: #D3E8A4;
    font-family: Tahoma, sans-serif;
    font-size: 12px;
    font-style: normal;
    line-height: normal;
    font-weight: normal;
    color:  #000000;
    text-decoration: none;
    </style>
    </head>
    <div>
    <div align="center">Thank you for your interest!  If requested, Sophisticup will contact you very soon.</div>
    </div>
    </body>
    </html>
    EOD;
    echo "$theResults";
    ?>
    Thanks in advance!

    Tamist wrote:
    The email was sent to me with all the identifiers.  However, nothbing was populated.
    Not surprising. You assign all the form values to variables that are never used, and use completely different variables that have no values to populate the email. Take this example:
    $FNameField = $_POST['firstname'];
    Then this this what you put in the email:
    firstname: $firstname <br>
    It should be this:
    firstname: $FNameField <br>

  • Problems capturing form data

    I'm new to PHP and I'm having a few problems. I've put
    together a script to process an HTML form and I need it to capture
    the names of all 'checked' checkboxes within my form and exclude
    all unchecked data. I know i must be doing something stoopid but i
    can't work it out. I just get a list of all items with their value
    next to them if checked. Any help would be really appreciated.
    Thanks. Here's my script:
    <?php
    /* Subject and Email Variables */
    $emailSubject = 'Subject';
    $webMaster = '[email protected]';
    /* Gathering Data Variables */
    $A = $_POST['A'];
    $B = $_POST['B'];
    $C = $_POST['C'];
    $D = $_POST['D'];
    $total1 = $_POST['total1'];
    $total2 = $_POST['total2'];
    $total3 = $_POST['total3'];
    $total4 = $_POST['total4'];
    $total5 = $_POST['total5'];
    $day = $_POST['day'];
    $email_address = $_POST['email_address'];
    $comments = $_POST['comments'];
    $body = <<<EOD
    Item A: $A <br>
    Item B: $B <br>
    Item C: $C <br>
    Item D: $D <br>
    <br><hr>
    Price  $total1 <br>
    <hr><br>
    Data A   $total2 <br>
    Data B   $total3 <br>
    Data C   $total4 <br>
    Data D   $total5 <br>
    <br><hr><br>
    Ordered For:   $day <br>
    Email Address:   $email_address <br>
    Instructions/feedback:   $comments
    <br>
    EOD;
    $headers = "From: $email_address\r\n";
    $headers .= "Content-type: text/html\r\n";
    $success = mail($webMaster, $emailSubject, $body, $headers);
    /* Results rendered as HTML */
    $URL='
    http://www.xxx.com/thanks.html';
    header ('Location: '.$URL);
    ?>
    <td><input name="A" onClick="change(this)"
    value="160g" type="checkbox"></td>
    If its relevant, onClick="change(this)" relates to:
    <script type="text/javascript">
    function change(obj) {
    var tr=obj.parentNode.parentNode;
    if(obj.checked) {
    tr.className+=' pink';
    else {
    tr.className=tr.className.replace(' pink', '');
    clickCh();
    Please can someone explain where i'm going wrong?
    Thanks

    My advise is to buy the ColdFusionMX7 Web Application
    Construction Kit. This will answer all of your questions and
    provide you with a solid understanding of ColdFusion basics to
    include: form handling and database interaction..
    http://www.amazon.com/Macromedia-ColdFusion-Web-Application-Construction/dp/0321223675/ref =sr_11_1/105-7037147-7486858?ie=UTF8&qid=1187788238&sr=11-1

  • XML and sending its data by sockets

    In my new project, i need to receive data from an XML file and send it to a client when the client has requested it from my server.
    so far, i've stored the elements into variables (i'll call them item1, item2, and item3 for now). I put this into the protocol so when the client calls upon the server to store itemn to one of its variables, it will do so.
    apperently, all this does is send my String variable output, which starts out as null and doesn't change, and so the output remains null which in turn will close my client. here's my protocol (it gathers data from avalonmap.xml):
    * xmlStorage.java
    * Created on January 3, 2006, 12:23 AM
    * To change this template, choose Tools | Options and locate the template under
    * the Source Creation and Management node. Right-click the template and choose
    * Open. You can then make changes to the template in the Source Editor.
    package mudmap.xml;
    import java.io.*;
    import org.xml.sax.*;
    import org.xml.sax.helpers.DefaultHandler;
    import javax.xml.parsers.SAXParserFactory;
    import javax.xml.parsers.ParserConfigurationException;
    import javax.xml.parsers.SAXParser;
    * @author Fender Bender
    public class mapLoader extends DefaultHandler {
        StringBuffer textBuffer;
        String roomName, region, color, roomOwner,roomCCC, roomCCCID, roomItem,
                roomItemID;
        String directions[];
        String dx,dy;
        static String currentElement;
        /** Creates a new instance of mapLoder() */
        public mapLoader() {
        public String processInput(String input) {
            String output="hello";
            if(input=="getRoom") { // for now, I'll call this item1. if client requests
                output = roomName;  //  it, the output will be roomName
                                                      // which is defined at //============
                                                      // in EchoText()
            return output;
        public static void main(String argv[]) {
            // Use an instance of ourselves as the SAX event handler
            DefaultHandler handler = new mapLoader();
    // Use the default (non-validating) parser
            SAXParserFactory factory = SAXParserFactory.newInstance();
            try {
    // Set up output stream
                out = new OutputStreamWriter(System.out, "UTF8");
                SAXParser saxParser = factory.newSAXParser();
                saxParser.parse( new File("avalonmap.xml"), handler );
            } catch (Throwable t) {
                t.printStackTrace();
            System.exit(0);
        static private Writer out;
        public void startDocument()
        throws SAXException {
            nl();
            nl();
            emit("START DOCUMENT");
            nl();
            emit("<?xml version='1.0' encoding='UTF-8'?>");
        public void endDocument()
        throws SAXException {
            nl();
            emit("END DOCUMENT");
            nl();
            emit(region + "\n" + color + "\n" + roomOwner  + "\n" + roomName + "\n" +
                    dx + "," + dy + "\n" + "room CCCs: " + roomCCC + " (" +
                    roomCCCID + ")\n" + "room items: " + roomItem + " (" +
                    roomItemID +")");
            try {
                nl();
                out.flush();
            } catch (IOException e) {
                throw new SAXException("I/O error", e);
        public void startElement(String namespaceURI,
                String sName, // simple name
                String qName, // qualified name
                Attributes attrs)
                throws SAXException {
            echoText();
            nl();
            emit("ELEMENT: ");
            String eName = sName; // element name
            if ("".equals(eName)) eName = qName; // not namespace-aware
            emit("<"+eName);
            currentElement=eName;
            if (attrs != null) {
                for (int i = 0; i < attrs.getLength(); i++) {
                    String aName = attrs.getLocalName(i); // Attr name
                    if ("".equals(aName)) aName = attrs.getQName(i);
                    nl();
                    emit(" ATTR: ");
                    emit(aName);
                    emit("\t\"");
                    emit(attrs.getValue(i));
                    emit("\"");
            if (attrs.getLength() > 0) nl();
            emit(">");
        public void endElement(String namespaceURI,
                String sName, // simple name
                String qName // qualified name
                throws SAXException {
            echoText();
            currentElement="";
            nl();
            emit("END_ELM: ");
            String eName = sName; // element name
            if ("".equals(eName)) eName = qName; // not namespace-aware
            emit("</"+eName+">");
        public void characters(char buf[], int offset, int len)
        throws SAXException {
            String s = new String(buf, offset, len);
            if (textBuffer == null) {
                textBuffer = new StringBuffer(s);
            } else {
                textBuffer.append(s);
        private void echoText()
        throws SAXException {
            if (textBuffer == null) return;
            nl();
            emit("CHARS:  |" + currentElement + ": ");
            String s = ""+textBuffer;
            if(currentElement=="region") {
                region = s;
            } else if(currentElement=="color") {
                color = s;
            } else if(currentElement=="roomOwner") {
                roomOwner = s;
            } else if(currentElement=="roomName") {
                roomName = s;                                             //============
            } else if(currentElement=="x") {
                dx = s;
            } else if(currentElement=="y") {
                dy = s;
            } else if(currentElement=="roomCCC") {
                roomCCC = s;
            } else if(currentElement=="roomCCCID") {
                roomCCCID = s;
            } else if(currentElement=="roomItem") {
                roomItem = s;
            } else if(currentElement=="roomItemID") {
                roomItemID = s;
            emit("|");
            textBuffer = null;
        private void emit(String s)
        throws SAXException {
            try {
                out.write(s);
                out.flush();
            } catch (IOException e) {
                throw new SAXException("I/O error", e);
        private void nl()
        throws SAXException {
            String lineEnd = System.getProperty("line.separator");
            try {
                out.write(lineEnd);
            } catch (IOException e) {
                throw new SAXException("I/O error", e);
    }

    for one thing, don't use == to compare strings... You have that all over the place, like:
    if(currentElement=="region") {                                                                                                                                                                                                                                                   

  • Modifying existing script - modifying how data is written out to csv

    I have an existing script written in Powershell 3.0 that gathers data from my virtual machines.  It's working to give me the data, but I'd like to modify how it writes it out.  Currently the data looks as follows:
    I would prefer the output to be all one one line as follows:
    Here is my script.  How would I modify this to give me the .csv file with all data for each server on one line?
    #param (
    $inputFile = "C:\Apps\Powershell\IP_Mac\testlist.txt"
    $csvFile = "C:\Apps\Powershell\IP_Mac\results.csv"
    $report = @()
    foreach($Computer in (gc -Path $inputFile)){
    get-wmiobject -computer $Computer win32_logicaldisk -filter "drivetype=3" | ForEach-Object {
    $device = $_.deviceid
    $freespce = ($_.freespace/1GB).tostring("0.00")+"GB"
    $Totalspce = ($_.size/1GB).tostring("0.00")+"GB"
    if(Test-Connection -ComputerName $Computer -Count 1 -ea 0) {
    $Networks = Get-WmiObject Win32_NetworkAdapterConfiguration -ComputerName $Computer | ? {$_.IPEnabled}
    foreach ($Network in $Networks) {
    $IPAddress = $Network.IpAddress[0]
    $SubnetMask = $Network.IPSubnet[0]
    $DefaultGateway = $Network.DefaultIPGateway
    $DNSServers = $Network.DNSServerSearchOrder
    $MACAddress = $Network.MACAddress
    $OutputObj = New-Object -Type PSObject
    $OutputObj | Add-Member -MemberType NoteProperty -Name ComputerName -Value $Computer.ToUpper()
    $OutputObj | Add-Member -MemberType NoteProperty -Name IPAddress -Value $IPAddress
    $OutputObj | Add-Member -MemberType NoteProperty -Name SubnetMask -Value $SubnetMask
    $OutputObj | Add-Member -MemberType NoteProperty -Name Gateway -Value ($DefaultGateway -join “,”)
    $OutputObj | Add-Member -MemberType NoteProperty -Name DNSServers -Value ($DNSServers -join ",")
    $OutputObj | Add-Member -MemberType NoteProperty -Name MACAddress -Value $MACAddress
    $OutputObj | Add-Member -MemberType NoteProperty -Name device -Value $device
    $OutputObj | Add-Member -MemberType NoteProperty -Name Totalspce -Value $Totalspce
    $OutputObj | Add-Member -MemberType NoteProperty -Name freespce -Value $freespce
    #$OutputObj
    $report += $OutputObj
    Write-Output $report
    $report | Select-Object -Property $properties | Export-Csv -Path $csvFile -NoTypeInformation
    Thank you.

    Try it like this:
    #param (
    $inputFile = "C:\Apps\Powershell\IP_Mac\testlist.txt"
    $csvFile = "C:\Apps\Powershell\IP_Mac\results.csv"
    $report = foreach($Computer in (gc -Path $inputFile)){
    $devices = get-wmiobject -computer $Computer win32_logicaldisk -filter "drivetype=3" | ForEach-Object {
    $device = $_.deviceid
    $freespce = ($_.freespace/1GB).tostring("0.00")+"GB"
    $Totalspce = ($_.size/1GB).tostring("0.00")+"GB"
    New-Object PSObject -property @{device=$device;freespce=$freespce;Totalspce=$Totalspce}
    if(Test-Connection -ComputerName $Computer -Count 1 -ea 0) {
    $Networks = Get-WmiObject Win32_NetworkAdapterConfiguration -ComputerName $Computer | ? {$_.IPEnabled}
    foreach ($Network in $Networks) {
    $IPAddress = $Network.IpAddress[0]
    $SubnetMask = $Network.IPSubnet[0]
    $DefaultGateway = $Network.DefaultIPGateway
    $DNSServers = $Network.DNSServerSearchOrder
    $MACAddress = $Network.MACAddress
    $OutputObj = New-Object -Type PSObject
    $OutputObj | Add-Member -MemberType NoteProperty -Name ComputerName -Value $Computer.ToUpper()
    $OutputObj | Add-Member -MemberType NoteProperty -Name IPAddress -Value $IPAddress
    $OutputObj | Add-Member -MemberType NoteProperty -Name SubnetMask -Value $SubnetMask
    $OutputObj | Add-Member -MemberType NoteProperty -Name Gateway -Value ($DefaultGateway -join “,”)
    $OutputObj | Add-Member -MemberType NoteProperty -Name DNSServers -Value ($DNSServers -join ",")
    $OutputObj | Add-Member -MemberType NoteProperty -Name MACAddress -Value $MACAddress
    $i = 0
    Foreach ($dev in $devices) {
    $OutputObj | Add-Member -MemberType NoteProperty -Name device$i -Value $dev.device
    $OutputObj | Add-Member -MemberType NoteProperty -Name Totalspce$i -Value $dev.Totalspce
    $OutputObj | Add-Member -MemberType NoteProperty -Name freespce$i -Value $dev.freespce
    $i ++
    $OutputObj
    Write-Output $report
    $report | Select-Object -Property $properties | Export-Csv -Path $csvFile -NoTypeInformation
    You were writing a row for each drive, I basically just wrote the drive information to an array and looped through that array when adding members.  I tested this and it worked for me.  Note that you can't have the same value names when you add-member
    so I appended a numeral to differentiate them.
    I hope this post has helped!

Maybe you are looking for