Beginner Programmer needs help...

I just have a quick question regarding the get(MINUTE) function in the Calendar class. I am using this to display the current time on a webpage, and every thing seems to work fine except that if the current time has the minutes < 10 (ie, 2:04 or 8:09, etc.) then only that single integer is displayed (2:4, 8:9). I understand why this is happening, but I was wondering if there is a simple way to add a leadign '0' to this int. Here is that section of code...
int hour = cal.get(Calendar.HOUR);
int minute = cal.get(Calendar.MINUTE);
String ampm = (cal.get(Calendar.AM_PM) == 0 ? "AM" : "PM");
%>
<p class="body"> Hello <b><%= res.getString("fname") %> <%= res.getString("lname") %></b>.
It is <b><%= hour+":"+minute+" "+ampm+" on "+mo+"/"+dt+"/"+yr %></b>.</p>
This page is in JSP. Thanks a lot for the help!

Replace minute with this. It should format it with a leading zero if needed
new DecimalFormat("00").format(minute)

Similar Messages

  • Non-Programmer Needs Help!!! (desperately)

    Ok, I want to create games for a virtual world website. I also want the website to be a game itself. Right now, I am working on creating a card game for two players (with the option of playing the computer). They each have 2 decks to draw from and a place for 2 cards to be displayed (their "hand") before they place it on the game board. I don't want their opponent to see the cards in their "hand" until they are placed on the game board. When a player has two cards in his hand, I want them to have the capability of enlarging the image of the card to full size in a pop-up type window, so they can calculate their strategy. The game itself is similar to the popular battle card games, so regular playing card games don't help me. I want the image of the card to be displayed on the game board either right side up or upside down depending upon the button pushed by the player. I want each player to play 1 card from one pile (blue-50 cards total) and 4 cards from the other pile (red-200 cards total). They can only draw 1 blue card, and 1 red card on their first turn. After that, they can only draw 1 red card per turn, until they have drawn 4 red cards total. The total number of cards each player can have on the game board is 5 cards, then the round ends. Each deck has the same cards but shuffled in random order. The decks can't be stacked the same, for each player. Each card has a certain value. The card from the blue pile is the main card that the cards from the red pile will add to or subtract from. If the match between the opponents is tied, no score is given to either player, but the cards from both players to go to the corresponding "tie" piles (one red and one blue) that will be randomly distributed by the computer, once each player has exhausted their own decks first. The tie piles are used at the end of the game to play the final round or rounds of the game. After each round, the victor of that round gets the points on his opponents cards, plus 1000 points for winning the round. I want the cards to just "disappear" or placed in the computer's "discard" pile after each round, so they cannot be used again. I want each player to have a turn being first at the beginning or each round. (If player 1 is first in round 1, player 2 will go first in round 2 and so on.) I want the scores for each card to be calculated and placed in a box according to which player the cards belong to. Once the round is ended, the victor will receive the final score in their "total score" box. I also want a "round number" box to indicate which round it is. No winner will be declared until the players use all their cards and/or the computer deals all the tie deck cards (which are shuffled before dealing). At the end of the game, the person with the highest score is the winner.
    I also would like to allow players to challenge each other and accept or decline a challenge. In order to do that, the players must login first. There must also be a list of available players to challenge.
    Is there a program that not only builds the user interface, but also will allow me to insert my graphics? Kind of like WYSIWYG HTML builders? (Preferably FREE) I have a gui builder, but have no clue as to how to put in the graphics or get it to work. I don't have any connections to the programming world, nor am I able to return to school at this time. The programs that Sun offers are not adequate for me, because I need to be able to install it, and run it without going through the "msdos classpath" thingy. I need a "wizard" type program that is truly for "dummies." Something that I can just put in my images and tell it what I want it to do IN PLAIN ENGLISH. For instance, if I want the "login button" to save the login information to a file and/or to the game. The players can have their same login info stored in a file, and they can return without creating a new name. The website service I want to place this on, doesn't allow chmoding for CGI, so I can't use that. Another example, if I want each card to have a differnt point level and either subtract from or add to the blue. Or how to get the pop-up for the card displayed in the player's hand. I don't know what else to do. Any suggestions?

    <blockquote>
    The programs that Sun offers are not adequate for me, because I need to be able to install it, and run it without going through the "msdos classpath" thingy. I need a "wizard" type program that is truly for "dummies." Something that I can just put in my images and tell it what I want it to do IN PLAIN ENGLISH. For instance, if I want the "login button" to save the login information to a file and/or to the game. The players can have their same login info stored in a file, and they can return without creating a new name. The website service I want to place this on, doesn't allow chmoding for CGI, so I can't use that.
    </blockquote>
    This is a surely a joke. You honestly expect to get this for free. Even for an experienced programmer, to write 3/4 decent games - configure them to your network and meet these conditions. You're talking BIG or big-ish project here. As per your request, there is no such thing as point and click programming and there never ever will be.
    Use Macromedia Director. Closest thing you'll get to
    WYSIWYG programming. It's for simpletons and
    non-programmers.Ah, noooo. The shockwave games have been programmed in Lingo, which is quite powerful and much harder as a programming language than java (its also outdated, has some nasty featured and its a definite falling star). Flash gets a bit nearer with a point and click effort and you can do a surprising amount without knowing about programming, also as a media for the Internet its better supported than Shockwave and even java for the Web. But for any sort of worthwhile game need sprogramming knowledge.
    To conclude:
    you don't want to learn to program.
    noone is going to do this for you.
    You're a bit f***ed then aren't you.
    On a brighter note, if you pay me ?1,000.00 (half in advance), I'll think about it - solution in java or Flash, 3 games, ?1,500.00 for both. I can take it or leave it btw, couldn't give a sh*t either way.

  • Lost VB Programmer needs help

    Hi,
    I have created a JFrame with a JSplitPane and placed a JTree in the left side of the SplitPane. I made a class that populates the tree with a tree of options. When the user clicks the tree I want he right pane to change. The treemenu was an event listner that is working fine.
    The problem is the left pane is in a separate .java file called TreeMenu. On the JFrame I simply create a new instance of it and it populates the tree for me.
    As a VB programmer I would declare my TreeMenu to have an event such as MenuChanged("Selected Help"). The JFrame would see the message and call the right pane to update.
    How do I do this in Java? My problem occurs when I move code out to a separate class. If everything was done frm the one frame then I would be fine, but i want to modularise the application.
    Please help.
    Aaran

    Here's a bit of code that may help you with your modularity issues.
    File: Switchboard.java
    interface Switchboard {
        void operator(TreeData identity);
    }File: CallMaker.java
    import java.awt.event.*;
    public class CallMaker implements TreeSelectionListener {
        private TreeData identity;
        private Switchboard destination;
        CallMaker( TreeData id, Switchboard swbd ) {
            identity = id;
            destination = swbd;
        public void valueChanged( TreeSelectionEvent e ) {
            destination.operator( identity );
    }For what you're trying to do I would suggest the following:
    1)Declare the Tree Populator to implement the Switchboard interface.
    2)put the code that populates the table into the operator method, or
    simply call the class/method that populates the tree from the
    operator method.
    3)Use an instance of the CallMaker class as a Listener on your tree.
    It should work something like this:
    public class PanePopulator implements Switchboard;
    //Other code and whatnot...
       public void operator(TreeData td) {
          //Decide how to populate the right pane
          //based on the TreeData.  Call other classes/methods.
    }In a separate file...
    public class TreeSide {
       JTree tree = new JTree();
       //initialize the tree.
       TreeData treeInfo = new TreeData();
       PanePopulator rightPane = new PanePopulator();
       tree.addTreeSelectionListener(new CallMaker(treeInfo, rightPane));
       treeInfo = (TreeData)theCurrentTreeSelection;
    }as long as treeInfo contains the data you need to populate the right pane, you'll be fine.
    When a selection is made the CallMaker instance calls: rightPane.operator(treeInfo);
    This provides your rightPane instance with the information it needs to populate the rightPane.

  • Beginner I need help

    I'm new to LabView and need some help with a program that I must write. For now all I would like to learn is how to light an LED on the front panel using a push button switch. Second, I would like to learn how to generate a wave form graph on the front panel. Any and all help would be greatly appreciated.
    Thanks 

    Hi B-MuRpH,
    what about the 'Getting started' manual that comes with LabView?
    What about all those examples, accessible from the start window of LabView?
    What about a seminar/course given by (experienced) LabView engineers?
    In case you work at a University: what about a course for students?
    In short: RTFM!
    Best regards,
    GerdW
    CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
    Kudos are welcome

  • Beginning Programmer needs help - JSP and databases?

    1. I have never used JSP before, but have been given an assignment to create a webpage to query a database. The database is in Access. Does anyone have a snipet of code in JSP that will query an MS Access database. Is there a function that I can use and pass it an SQL (select statement) and have it return a list of results.
    -OR-
    If there is a way for JSP to transform the MS Access database into a text file that would be good also.
    2. Has anyone created a search functionaly using JSP (or know of a tool) that can search documents, PDF files, HTML files, etc.
    Thank you for any help!

    hi , there is no big deal in JSPs, Servlets, EJBs e.t.c its olnly a matter of committing time and getting urself familar and in areas where you have problems this forum is a nice place for you to share all what u have.
    to start with i will give you some sites where you can start learning jsps, servlets, ejbs and the rest.
    1) http://java.sun.com/j2ee -> look for JSPs , Servlets, EJB, JavaBeans e.t.c
    2) http://www.jspinsider.com
    3) http://www.coreservlets.com
    4) http://www.jakarta.apache.com (download tomcat for your container)
    for databases u can use this code snippet but u will have to read more about databases to be able to chagne some things in this snipper such as your database username, password , url and the rest.
         <%@page import="java.sql.*" %>
         try
            Class.forName ("sun.jdbc.odbc.JdbcOdbcDriver");
            Connection con = DriverManager.getConnection ("jdbc:odbc:test_dsn", "sa", "");
         Statement stat = con.createStatement ();
         ResultSet res = stat.executeQuery("select * from authors");
         while (res.next())
              //process the results of this query
         catch (Exception e)
            //process this also
    %>
    You will need to become farmilar with the java programming language and also database conventions so you have a proper understanding.
    study those db codes and modify to suit your needs.
    buzz on me in case you are stuck.
    Regards

  • Beginner! Need help getting started with recording music.

    I am the definition of 'new' at the moment. I want to record my own music at home and I've been told that using an Apple Mac is one of the better ways to go about it at home.
    I have a number of questions, most of which have probably been asked before (apologies!) starting right from the beginning.
    1. What type of Mac would be best suited as a dedicated tool for recording music? Obviously speed and memory are big factors, but are there any other considerations here (available inputs, drivers, sound cards etc)? I'm hoping to keep the cost below AUS$3000 if possible.
    2. Do i need any other hardware for this application? (this is where you can tell how inexperienced I am haha) such as mixers etc? If I should need a mixer, is there a particular type or brand of mixer that works well with Macs?
    3. Will plugging a guitar amp into the mac improve sound quality over plugging the guitar directly into the Mac? I bought a Griggin Garage Band guitar cable a while ago to record some background music for a friend's DVD, and I found it worked well, but I'm looking for the best quality sound now.
    4. What would be the most effective software to use? I've briefly used Garage Band and found that to be simple and useful, but I've heard that there are better software packages available.
    I'm hoping to be able to record guitar, bass and vocals directly on to the Mac, and create drum tracks using samples and loops. I know how to play music but as you can tell I know very little about recording it! Any help or suggestions would be appreciated!
    Thanks..

    I would presume one line level input will suffice?
    Close, you need a Line Level AND Mic Level input since you'll want to record vocals.
    Thanks for the link to your Q&A page, I found some very useful info there.
    It's showing its age, and will hopeful get updated soon, but most of the info is good at least for a background.
    Anyway, I think I might recommend this Presonus INSPIRE over the FireBox, it'll save you about $100 and since PreSonus makes excellent equipment (and we have an active member here that uses the Inspire), I'm confident that it offers great quality.
    I think the firepod that you use looks great, but might be overkill
    I agree, the FirePod would be serious overkill for your needs. Again, an awesome interface, but you'd be paying for all those Mic PREs, and using 1. That wouldn't make sense, and since the FP isn't cheap...
    my talent and engineering knowledge is quite limited
    Then I would strongly suggest GB as the software, and then do lots of reading. The weakest link in music production is your engineering skills. Mixing and Mastering (especially the latter) are art forms. A bad engineer using a $10,000 bit of software and hardware would make a fantastic performance sound like garbage. With good engineering skills you can make a pro recording with GB.
    The learning curve with something like Logic is dramatically increased, and again, without the skills to take advantage of what it offers, your recordings are not going to sound any better. At the very least, start with GB to learn the skills of Recording/Editing/Mixing/Mastering. The "price of admission" is low enough that if in a year you find that you need a feature GB doesn't offer, your money will not have been wasted, it will have been valuable learning time.
    Hope those more specific answers help
    ~~HangTIme [Will Compute for Food] %-)>
    Note: I am an Amazon Associate, if you purchase this item via my link I will get a small commission)

  • JSP with useBean beginner problems need help

    I start to learn JSP and now I am facing a problem which cannot be solved for a whole day.
    I make a simple JSP and want to use a my defined class to make some logic outside JSP file. It can be built by "ant build".
    But there is always an error-message when I see through browser. Also, I have already "ant deploy" to copy all classes in WEB-INF/classes/...
    Besides, my tomcat can run JSP without importing external class or javaBean.
    Please help. I really have no idea. Thanks.
    The simple Converter.class in Test.Beans package
    package Test.Beans;
    import java.math.*;
    public class Converter {
         static BigDecimal yenRate = new BigDecimal("131.7800");
         static BigDecimal euroRate = new BigDecimal("0.0084");
    public BigDecimal dollarToYen(BigDecimal dollars) {
    BigDecimal result = dollars.multiply(yenRate);
    return result.setScale(2,BigDecimal.ROUND_UP);
    public BigDecimal yenToEuro(BigDecimal yen) {
    BigDecimal result = yen.multiply(euroRate);
    return result.setScale(2,BigDecimal.ROUND_UP);
    public Converter() {}
    The simple JSP:
    <%@ page import="java.math.*" %>
    <jsp:useBean id="c" class="Test.Beans.Converter" scope="page"/>
    <html>
    <head>
         <title>Converter</title>
    </head>
    <body bgcolor="white">
         <FONT SIZE=+1>
         <h1><center>Converter</center></h1>
         <hr>
         <p>Enter an amount to convert:</p>
         <form method="get">
         <input type="text" name="amount" size="25">
         <br>
         <p>
         <input type="submit" value="Submit">
         <input type="reset" value="Reset">
         </form>
         <%
         String amount = request.getParameter("amount");
              if ( amount != null && amount.length() > 0 ) {
              BigDecimal d = new BigDecimal (amount);
         %>
         <%= c.yenToEuro(d) %> Euro.
         <%
         %>
         </FONT>
    </body>
    </html>
    Here is the error message:
    org.apache.jasper.JasperException: /main.jsp(2,0) The value for the useBean class attribute Test.Beans.Converter is invalid.
         org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:510)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:375)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    root cause
    org.apache.jasper.JasperException: /main.jsp(2,0) The value for the useBean class attribute Test.Beans.Converter is invalid.
         org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:39)
         org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:405)
         org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:146)
         org.apache.jasper.compiler.Generator$GenerateVisitor.visit(Generator.java:1174)
         org.apache.jasper.compiler.Node$UseBean.accept(Node.java:1116)
         org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2163)
         org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2213)
         org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2219)
         org.apache.jasper.compiler.Node$Root.accept(Node.java:456)
         org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2163)
         org.apache.jasper.compiler.Generator.generate(Generator.java:3304)
         org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:198)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:295)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:276)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:264)
         org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:563)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:303)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    Message was edited by:
    BillyHui

    Works fine for me, copied and pasted exactly.
    Try recompiling your java class again, to make sure it is valid.
    Check that the class file is copied into the correct place by your ant build.
    Should be WEB-INF/classes/Test/Beans/Converter.class

  • C++ programmer  needs help in Java.

    Greetings, I am new to Java after programming in C++ and am having a few troubles finding parallels to a few essential operations, such as:
    What are the Java equivalents to cout, cin and getch()?
    Or simply, how do you do output, get input from the user, and pause execution?
    Thank you all for any help you can offer.
    Dagkhi

    Look over this group of threads that a search of the Forum using "system.in" listed:
    http://search.java.sun.com/search/java/index.jsp?col=javaforums&qp=%2Bforum%3A54&qt=system.in&x=14&y=6

  • EXHAUSTED PROGRAMMER NEEDS HELP!!!

    I have no idea why my program runs so darn slow. It runs at a snail's pace on the unix machines I'm running on. I'm developing on a Windows box using IntelliJ IDEA and text-transfering my files to the unix machines to compile and run. I'm runing on a data set of around 30MB distributed in 40 files. I am so tired of looking for the problem. Others have done the same program and their's works in 5 minutes or less. Mine is taking around 2 hours!!! Please, if you have a clue and a heart, help me! Code below.
    //* Parser skeleton for processing item-???.xml files. Must be compiled in
    JDK 1.4 or above. */
    /* Instructions:
    This program processes all files passed on the command line (to parse
    an entire diectory, type "java MyParser myFiles/*.xml" at the shell).
    At the point noted below, an individual XML file has been parsed into a
    DOM Document node. You should fill in code to process the node. Some auxiliary methods have been written for you. You may find them
    useful.
    Modified by:
    Will
    import java.io.*;
    import java.text.*;
    import java.util.*;
    import javax.xml.parsers.DocumentBuilder;
    import javax.xml.parsers.DocumentBuilderFactory;
    import javax.xml.parsers.FactoryConfigurationError;
    import javax.xml.parsers.ParserConfigurationException;
    import org.w3c.dom.*;
    import org.xml.sax.SAXException;
    import org.xml.sax.SAXParseException;
    import org.xml.sax.ErrorHandler;
    /* Process one items-???.xml file. */
        static void processFile(File xmlFile) {
            Document doc = null;
            try {
                doc = builder.parse(xmlFile);
            catch (IOException e) {
                e.printStackTrace();
                System.exit(3);
            catch (SAXException e) {
                System.out.println("Parsing error on file " + xmlFile);
                System.out.println("  (not supposed to happen with supplied XML files)");
                e.printStackTrace();
                System.exit(3);
            /* At this point 'doc' contains a DOM representation of an 'Items' XML
            * file. Use doc.getDocumentElement() to get the root Element. */
            System.out.println("Successfully parsed - " + xmlFile);
            /*Open the output files for each relation****************************/
            PrintWriter itemsFile = null, usersFile = null,
                    bidsFile = null, categoriesFile = null;
            /*Open files for writing each of the txt files******************/
            try{
                itemsFile = new PrintWriter(new BufferedOutputStream(new FileOutputStream("Items.dat", true)), true);
                usersFile = new PrintWriter(new BufferedOutputStream(new FileOutputStream("Users.dat", true)), true);
                bidsFile = new PrintWriter(new BufferedOutputStream(new FileOutputStream("Bids.dat", true)), true);
                categoriesFile = new PrintWriter(new BufferedOutputStream(new FileOutputStream("Categories.dat", true)), true);
            }catch(FileNotFoundException e){
                System.out.println("Error trying to open an output file: " + e.getMessage());
                System.exit(0);
            /*Parse content for each relation in turn********************/
            //Write to the Items.txt file
            NodeList itemNodes = doc.getDocumentElement().getElementsByTagName("Item");
            String itemID = null;
            Element[] categories = null;
            NodeList bids = null;
            NodeList eBid = null;
            NodeList bidders = null;
            Element tempElement = null;
            Element itemElement = null;
            Element thisBid = null;
            for(int i=0; i<itemNodes.getLength(); i++){
                //Get the item Element for this iteration
                itemElement = (Element)itemNodes.item(i);
                /*Write out ItemID**************************************/
                itemID = itemElement.getAttribute("ItemID");
                itemsFile.print(itemID + colSep);
                /*Write out Name****************************************/
                itemsFile.print(getElementTextByTagNameNR(itemElement, "Name")+ colSep);
                /*Write out the Currently element***********************/
                itemsFile.print(strip(getElementTextByTagNameNR(itemElement, "Currently")));
                itemsFile.print(colSep);
                /*Write out the Buy_Price element, if it exists*********/
                Element checkNode = null;
                if( (checkNode = (getElementByTagNameNR(itemElement, "Buy_Price"))) != null){
                    itemsFile.print(strip(checkNode.getFirstChild().getNodeValue()));
                itemsFile.print(colSep);
                /*Add the First_Bid element*****************************/
                itemsFile.print(strip(getElementTextByTagNameNR(itemElement, "First_Bid")) + colSep);
                /*Now iterate over the next three elements, adding them in turn*/
                for(int j=0; j<itemTags.length;j++){
                    itemsFile.print(getElementTextByTagNameNR(itemElement, itemTags[j]));
                    itemsFile.print(colSep);
                /*Add the SellerID**************************************/
                itemsFile.print(getElementByTagNameNR(itemElement, "Seller").getAttribute("UserID")
                        + colSep);
                /*Finally, add the description.  Truncate, if necessary*/
                String description = new String();
                description = getElementTextByTagNameNR(itemElement, "Description");
                itemsFile.print(description.substring(0, Math.min(4000, description.length())) + colSep);
                itemsFile.println();
                /*Locate all of the Categories******************************/
                categories = getElementsByTagNameNR(itemElement, "Category");
                /*For every category in this item, write a ItemID-Category pair*/
                for(int j=0; j<categories.length; j++){
                    categoriesFile.print(itemID + colSep);
                    categoriesFile.println(categories[j].getFirstChild().getNodeValue() + colSep);
                if( (bids = itemElement.getElementsByTagName("Bid")) != null){
                    /*Go through the bids, writing the info***********/
                    for(int j=0; j<bids.getLength(); j++){
                        thisBid = (Element)bids.item(j);
                        bidsFile.print(getElementByTagNameNR(thisBid, "Bidder").getAttribute("UserID") + colSep);
                        bidsFile.print(itemID + colSep);
                        bidsFile.print(getElementTextByTagNameNR(thisBid, "Time") + colSep);
                        bidsFile.println(strip(getElementTextByTagNameNR(thisBid, "Amount"))
                                + colSep);
                /*write out userid and rating from any and all bidder nodes*/
                if( (bidders = itemElement.getElementsByTagName("Bidder")) != null){
                    for(int j=0; j<bidders.getLength(); j++){
                        usersFile.print(bidders.item(j).getAttributes().getNamedItem("UserID").getNodeValue() + colSep);
                        usersFile.print(bidders.item(j).getAttributes().getNamedItem("Rating").getNodeValue() + colSep);
                        //If there's a location node, write it
                        if( (getElementByTagNameNR((Element)bidders.item(j), "Location")) != null){
                            usersFile.print(getElementTextByTagNameNR((Element)bidders.item(j), "Location"));
                        usersFile.print(colSep);
                        //If there's a country node, write it
                        if( (getElementByTagNameNR((Element)bidders.item(j), "Country")) != null){
                            usersFile.print(getElementTextByTagNameNR((Element)bidders.item(j), "Country"));
                        usersFile.println(colSep);
                /*Now write out the Seller information*******************/
                usersFile.print(getElementByTagNameNR(itemElement, "Seller").getAttribute("UserID") + colSep);
                usersFile.print(getElementByTagNameNR(itemElement, "Seller").getAttribute("Rating") + colSep);
                usersFile.print(getElementTextByTagNameNR(itemElement, "Location") + colSep);
                usersFile.print(getElementTextByTagNameNR(itemElement, "Country") + colSep);
                usersFile.println();
            itemsFile.close();
            usersFile.close();
            bidsFile.close();
            categoriesFile.close();
        }

    The processing of the DOM is not the problem. Others
    use the same code for the DOM and their's work in a
    small fraction of the time. I am really stumped on
    this one. I've never used a profiler.If you insist that the DOM processing is not the problem then you are going to have to learn to use a profiler.

  • Newbie Java programmer needs help

    Everytime I go to run my program, I get the error
    "the class welcome.Welcome does not exist" and it's right, there is no such thing, nor will there ever be. There is a Welcome.class though, but it doesn't want to see it. Is there some setting I'm missing(i'm using Borland JBuilder 5 Personal) or is my code wrong. Here it is though, please help!
    import javax.swing.JOptionPane;
    public class Welcome
    public static void main( String args[] )
    JOptionPane.showMessageDialog(
    null, "Welcome to Java Programming" );
    System.exit( 0 );
    }

    Your code compiled and ran perfect on my machine.
    Your problem lays in either:
    1) your WYSIWYG (JBuilder or whatever)
    2) your class path
    I may be wrong. I have never used this program that you are talking about. but it seems to me that if you were able to get this program(IDE) running in the first place it should aready have some kind of JRE installed.
    You may wan't to just download the newest JDK if you don't already have it. Or try to locate the path for the command named "java" and try it like this:
    C:\whatever\path\it\is\java Welcome
    while in the same directory of the Welcome class.
    Hope this helps,
    Ian

  • Immature Java Programmer needs help...

    I do not want to generate html code inside my java code, rather open a html page by referencing it in my java code to see it in the browser. For example, here is my code:
    package mrpt;
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    public class Login extends HttpServlet
         public void doGet(HttpServletRequest request, HttpServletResponse response)
         throws ServletException, IOException
              response.setContentType ("text/html");
              PrintWriter out = response.getWriter ();
              response.sendRedirect ("http://localhost:8080/Login.htm");
    The code compiles but when I open it in the browser (.\servlet\mrpt.Login) I get an error page "HTTP Status 500 -". I'm using the Tomcat Apache server. I have my html in the root directory and my .java and .class in the .\webapps\ROOT\WEB-INF\classes\mrpt. Can this be done? Is my code correct?

    I do not want to generate html code inside my java
    code, rather open a html page by referencing it in my
    java code to see it in the browser. For example, here
    is my code:
    package mrpt;
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    public class Login extends HttpServlet
    public void doGet(HttpServletRequest request,
    HttpServletResponse response)
         throws ServletException, IOException
    I don't think this is right. try leaving it out ---          response.setContentType ("text/html");
              PrintWriter out = response.getWriter (); response.sendRedirect
    t ("http://localhost:8080/Login.htm");
    The code compiles but when I open it in the browser
    (.\servlet\mrpt.Login) I get an error page "HTTP
    Status 500 -". I'm using the Tomcat Apache server. I
    have my html in the root directory and my .java and
    .class in the .\webapps\ROOT\WEB-INF\classes\mrpt. Can
    this be done? Is my code correct?

  • C++ programmer needs help w/Java :)

    Hey,
    I'm working on a project and I'm supposed to write it in java. So I've been looking around and haven't been able to figure out exactly how input/output works. My main concern is the input function. I know that in C++ we use cin << and fin << to read in data from the command line or a file. How can I translate this to java code? I'm approaching this program as I would with a c++ program so I probably won't understand if you use html source code in your reply...yes engineers can be dumb...I'm living proof. Or if you could explain how I/O works in java I would apprecitate that as well.
    Thanks,
    Mayo

    I was wrong above. here is the way below.
    I don't know what I was thinkin earlier,
    well you know what you said engineers.:-)
    If there is any questions about the below
    code please feel free to ask.
    import java.io.*;
    public class ReadKeys
         public static void main(String args[])
            BufferedReader bread;
              try {
            bread = new BufferedReader(new InputStreamReader(System.in));
            String str;
            while( (str = bread.readLine()) != null  ) {
              System.out.println(str);
           }catch(IOException io) { }
    }

  • Question from a beginner, really need help

    I am starting to do a little programming these days. The question is about the (program file) format to provide to the end users.
    I can use "javac" "java" to compile or run my code in a command prompt window, or use some development tool. But I do not expect the users of my program to install the jdk (or other software) in order to run the program. How to deal with this?
    What is the usual last format of a Java Program?
    Hope I have made my question clear.
    Thanks
    Xiaohua

    It depends, a good solution is to pack it into a jar file and make it executable, but if you are new to Java (I have no idea how experianced you are) it might give you more trouble than it's worth in the beginning.
    You could distribute your .class file (the .java files are only source and can not be executed) and a .bat file which would contain the command to launch the applicaiton. That's how I would do it as a newbie.
    Check out an installer program like Inno Setup ( http://www.jrsoftware.org/isinfo.php ) if you want a neat way to distribute your files. You can specify a .bat file as being the one executed when the applicaiton is started, that way your program could be run from a start menu entry (sorry, I'm assuming that you are using Windows here, to maintain cross-platform abilities this won't work)
    Does this give you an idea? There are many ways to distribute an application. You should also read up on Java Webstart...

  • Need help with inserting frame with scrolling images

    Hi,
        Im a beginner and need help putting a single box/frame with scrolling images in the middle of my layout, so that when viewed in browser, the header and footer remain in place, while the images and info in the frame in the centre of the page can be scrolled down/up?

    You can use an iframe element <iframe src="" width="" height="" scrolling="yes"> though if you're concerned with crawlers you should avoid frames as much as possible. 

  • Really need help (motor control using labview)

    hi all readers,
    im new beginner. really need help for my project. i've been assigned to monitor/control motor using labview 8.5 (using NI DAQmx). the problem is, the techinician told me that i cant use 3phase motor with this card. things that i need to displayed using labview is :
    torque
    power
    current
    voltage
    speed
    really appreciated if readers can help me with this:
    wut type of motor shud i use that compatible with NI DAQmx
    thanks a lot.

    Hi fauziana,
    NI data acquisition devices are primarily designed to take measurements, so it's a good idea to measure the signals that you have mentioned with a DAQ device.
    You also can use DAQ devices for control tasks, but for reliable and deterministic control behavioryou typically need to use a real-time operating system (not Windows!). If you want to learn more about the pros and cons of using DAQ devices for motion control tasks, please refer to these threads. Still for standard motion control tasks it's much more efficient in terms of development time, to use a dedicated motion control device for the motion control part of your application.
    In general the control part is independant from the motor type, as these devices only generate control signals (+/- 10 V). There are many power drives available, that accept this type of control signal and you should select your motor according to the requirements of your application.
    For a more detailed system consulting, please contact your local NI branch. To select the products that fit best to your application requirements a face to face discussion is much more efficient than a discussion forum thread, because there are a lot of parameters that need to be taken into consideration. If you tell me in which country you are living, I can provide appropriate contact data to you.
    Thanks and kind regards,
    Jochen Klier
    National Instruments

Maybe you are looking for

  • Error in ABZU transaction

    Hello, I am trying to use ABZU transaction to enter a correction in the depreciation of an asset but when I enter transaction type 711 -"Write-up ordinary book depreciation" it appears the following error: You cannot post write-ups Message no. AA402

  • Restore iPod not working...please help!

    I plugged in my nano recently to be met with this message "iTunes has detected an iPod in recovery mode. You must restore it before it can be used with iTunes." So I clicked on the 'restore' button in iTunes. I go through the restore process and it t

  • ,pdf files not showing in iTunes podcast

    I have always successfully included .pdf files as accompanying notes for my students' enhanced podcasts. It's always worked very smoothly and well - up to Feb 2009. Since then this function has ceased to be successful. I have had to create a separate

  • Working with Stills in Premiere Pro

    Are others having problems applying effects to stills or is it just me? Practically all the effects I have tried to apply to a still rather than a video have caused PP CS4 to freeze up or just crash. I now always put a still into a sequence first and

  • Problem unresolved still

    Can anyone help? I have a problem with my MacBook Pro. Airport does not auto connect to network when I start up. And I have no idea how to get Airport to auto connect to network. I have a wireless router, with three other computers in the house (PCs)