HELP!! wat is wrong with it?

Hi I've been workin on a project, and it seems something is wrong with this code... i honestly cannot figure it out...
here it is :
Uses the following methods:
public static boolean areEquivalent (String word1, String word2)
This method reutrns true or false depending on whether the two input arguments hae equal numbers of A's, B's, and C's (in any order.) You may assume that each string contains only these lowercase characters, in any order or quantity. For example, areEquivalent("abcbca","ccbbaa... ) would return true, because each input string contains 2 as, 2 bs, and 2cs.
this is the code i have so far:
public static boolean areEquivalent(String word1, String word2)
int count = 0;
String line;
for ( int i = 0; i<char.length; i++)
saasd
if count = as + word 2
true
else count = bs + word 2
true
else count = cs + word 2
true
else as==bs==cs
return true
}>

I don't even know why i come into these ..."HELP!!!"..."URGENT!!!"...."Please do my homework for me!!!!" threads.....sigh...
There should be a mandatory class in College..."How to post on forums 101"
HTH
:)

Similar Messages

  • HELP PLEASE - WHATS WRONG WITH THIS CODE

    Hi. I get this message coming up when I try to compile the code,
    run:
    java.lang.NullPointerException
    at sumcalculator.SumNumbers.<init>(SumNumbers.java:34)
    at sumcalculator.SumNumbers.main(SumNumbers.java:93)
    Exception in thread "main"
    Java Result: 1
    BUILD SUCCESSFUL (total time: 2 seconds)
    I am not sure whats wrong with the code. Any assistance would be nice. The code is below.
    package sumcalculator;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class SumNumbers extends JFrame implements FocusListener {
    JTextField value1;
    JTextField value2;
    JLabel equals;
    JTextField sum;
    JButton add;
    JButton minus;
    JButton divide;
    JButton multiply;
    JLabel operation;
    public SumNumbers() {
    SumNumbersLayout customLayout = new SumNumbersLayout();
    getContentPane().setFont(new Font("Helvetica", Font.PLAIN, 12));
    getContentPane().setLayout(customLayout);
    value1.addFocusListener(this);
    value2.addFocusListener(this);
    sum.setEditable(true);
    value1 = new JTextField("");
    getContentPane().add(value1);
    value2 = new JTextField("");
    getContentPane().add(value2);
    equals = new JLabel("label_1");
    getContentPane().add(equals);
    sum = new JTextField("");
    getContentPane().add(sum);
    add = new JButton("+");
    getContentPane().add(add);
    minus = new JButton("-");
    getContentPane().add(minus);
    divide = new JButton("/");
    getContentPane().add(divide);
    multiply = new JButton("*");
    getContentPane().add(multiply);
    operation = new JLabel();
    getContentPane().add(operation);
    setSize(getPreferredSize());
    addWindowListener(new WindowAdapter() {
    public void windowClosing(WindowEvent e) {
    System.exit(0);
    public void focusGained(FocusEvent event){
    try {
    float total = Float.parseFloat(value1.getText()) +
    Float.parseFloat(value2.getText());
    sum.setText("" + total);
    } catch (NumberFormatException nfe) {
    value1.setText("0");
    value2.setText("0");
    sum.setText("0");
    public void focusLost(FocusEvent event){
    focusGained(event);
    public static void main(String args[]) {
    SumNumbers window = new SumNumbers();
    window.setTitle("SumNumbers");
    window.pack();
    window.show();
    class SumNumbersLayout implements LayoutManager {
    public SumNumbersLayout() {
    public void addLayoutComponent(String name, Component comp) {
    public void removeLayoutComponent(Component comp) {
    public Dimension preferredLayoutSize(Container parent) {
    Dimension dim = new Dimension(0, 0);
    Insets insets = parent.getInsets();
    dim.width = 711 + insets.left + insets.right;
    dim.height = 240 + insets.top + insets.bottom;
    return dim;
    public Dimension minimumLayoutSize(Container parent) {
    Dimension dim = new Dimension(0, 0);
    return dim;
    public void layoutContainer(Container parent) {
    Insets insets = parent.getInsets();
    Component c;
    c = parent.getComponent(0);
    if (c.isVisible()) {c.setBounds(insets.left+24,insets.top+48,128,40);}
    c = parent.getComponent(1);
    if (c.isVisible()) {c.setBounds(insets.left+256,insets.top+48,128,40);}
    c = parent.getComponent(2);
    if (c.isVisible()) {c.setBounds(insets.left+408,insets.top+48,56,40);}
    c = parent.getComponent(3);
    if (c.isVisible()) {c.setBounds(insets.left+488,insets.top+48,152,40);}
    c = parent.getComponent(4);
    if (c.isVisible()) {c.setBounds(insets.left+128,insets.top+136,72,40);}
    c = parent.getComponent(5);
    if (c.isVisible()) {c.setBounds(insets.left+248,insets.top+136,72,40);}
    c = parent.getComponent(6);
    if (c.isVisible()) {c.setBounds(insets.left+368,insets.top+136,72,40);}
    c = parent.getComponent(7);
    if (c.isVisible()) {c.setBounds(insets.left+488,insets.top+136,72,40);}
    c = parent.getComponent(8);
    if (c.isVisible()) {c.setBounds(insets.left+176,insets.top+48,56,40);}
    }

    Thank you. How do i amend this? I have defined value1though.Yes, you did - but after the call to addFocusListener(...). It needs to be before it.
    BTW, you did the same thing with "value2.addFocusListener(this)" and "sum.setEditable(true)" on the next two lines. You're attempting to call a method on an object that doesn't exist yet (i.e., you haven't called new yet).

  • Help? something wrong with my constructor

    public VendingMachine (int inNumCandy, int inNumChips)
              set (inNumCandy, inNumChips);
         }what is wrong with my constructor my compiler says that it cannot find symbol method set (int, int)

    There is no method defined in VendingMachine matching that signature; i.e., set(int, int).
    ~

  • Need help understanding whats wrong with ASP checking for empty fields.

    Can anyone tell me whats wrong with these if statements: If i
    sumbit the
    form providing everything except the dream_inscript field it
    gives me this
    error:
    =================================================
    Microsoft OLE DB Provider for ODBC Drivers error '80040e57'
    [Microsoft][ODBC Microsoft Access Driver]Invalid string or
    buffer length
    /purch_confirm_mail.asp, line 67
    =================================================
    If i submit the form and provide just that field along with
    the first 4
    which are automatically passed from the DB the form submits
    fine and no
    problem.. I know it has something to do with my If
    Statements..
    Basically i want to check the 4 fields:
    dream_inscript If this one is -1 then pass N/A to the db
    dream_price If dream_inscript <> -1 then pass 45 to the
    db
    dream_comm if dream_comm is empty then pass N/A to the db
    custom_inscript if custom_inscript is empty then pass N/A to
    the db
    custom_wanted if this is Y then pass 45 to the db
    custom_comm if this is empty then pass N/A to the db
    MM_editCmd.CommandText = "INSERT INTO tbMailOrders
    (item_number,
    item_summary, item_price, shipping_cost, dream_price,
    dream_inscript,
    dream_comm, custom_comm, custom_price, video_wanted,
    video_price,
    grandtotal, cs_name, pp_email, c_email) VALUES (?, ?, ?, ?,
    MM_editCmd.Prepared = true
    MM_editCmd.Parameters.Append
    MM_editCmd.CreateParameter("param1", 202,
    1, 10, Request.Form("item_number")) ' adVarWChar
    MM_editCmd.Parameters.Append
    MM_editCmd.CreateParameter("param2", 202,
    1, 255, Request.Form("item_summary")) ' adVarWChar
    MM_editCmd.Parameters.Append
    MM_editCmd.CreateParameter("param3", 202,
    1, 10, Request.Form("itemprice")) ' adVarWChar
    MM_editCmd.Parameters.Append
    MM_editCmd.CreateParameter("param4", 202,
    1, 10, Request.Form("shippingcost")) ' adVarWChar
    If cStr(Request.Form("dream_inscript"))<> "-1" Then
    MM_editCmd.Parameters.Append
    MM_editCmd.CreateParameter("param5", 202, 1,
    10, "45") ' adVarWChar
    Else
    MM_editCmd.Parameters.Append
    MM_editCmd.CreateParameter("param5", 202,
    1, 10, "0.00") ' adVarWChar
    End If
    If cStr(Request.Form("dream_inscript"))<> "-1" Then
    MM_editCmd.Parameters.Append
    MM_editCmd.CreateParameter("param6", 203, 1,
    1073741823, Request.Form("dream_inscript")) ' adLongVarWChar
    Else
    MM_editCmd.Parameters.Append
    MM_editCmd.CreateParameter("param6", 203,
    1, 1073741823, "N/A") ' adLongVarWChar
    End If
    If Len(cStr(Request.Form("dream_comm")))= "0" Then
    MM_editCmd.Parameters.Append
    MM_editCmd.CreateParameter("param7", 203,
    1, 1073741823, "N/A") ' adLongVarWChar
    Else
    MM_editCmd.Parameters.Append
    MM_editCmd.CreateParameter("param7", 203,
    1, 1073741823, Request.Form("dream_comm")) ' adLongVarWChar
    End If
    If Len(cStr(Request.Form("custom_inscript")))= "0" Then
    MM_editCmd.Parameters.Append
    MM_editCmd.CreateParameter("param8", 203,
    1, 1073741823, "N/A") ' adLongVarWChar
    Else
    MM_editCmd.Parameters.Append
    MM_editCmd.CreateParameter("param8", 203, 1,
    1073741823, Request.Form("custom_inscript")) ' adLongVarWChar
    End If
    If Request.Form("custom_wanted")= "Y" Then
    MM_editCmd.Parameters.Append
    MM_editCmd.CreateParameter("param9", 202,
    1, 10, "45") ' adVarWChar
    Else
    MM_editCmd.Parameters.Append
    MM_editCmd.CreateParameter("param9", 202,
    1, 10, "0.00") ' adVarWChar
    End If
    If Request.Form("video_wanted")= "Y" Then
    MM_editCmd.Parameters.Append
    MM_editCmd.CreateParameter("param10", 202,
    1, 10, "Yes") ' adVarWChar
    Else
    MM_editCmd.Parameters.Append
    MM_editCmd.CreateParameter("param10", 202,
    1, 10, "No") ' adVarWChar
    End If
    If Request.Form("video_wanted")= "Y" Then
    MM_editCmd.Parameters.Append
    MM_editCmd.CreateParameter("param11", 202, 1,
    10, "15") ' adVarWChar
    Else
    MM_editCmd.Parameters.Append
    MM_editCmd.CreateParameter("param11", 202,
    1, 10, 0.00) ' adVarWChar
    End If
    MM_editCmd.Parameters.Append
    MM_editCmd.CreateParameter("param12", 202,
    1, 10, Request.Form("grand")) ' adVarWChar
    MM_editCmd.Parameters.Append
    MM_editCmd.CreateParameter("param13", 202,
    1, 255, Request.Form("name")) ' adVarWChar
    MM_editCmd.Parameters.Append
    MM_editCmd.CreateParameter("param14", 202,
    1, 255, Request.Form("email")) ' adVarWChar
    MM_editCmd.Parameters.Append
    MM_editCmd.CreateParameter("param15", 202,
    1, 255, Request.Form("email2")) ' adVarWChar
    MM_editCmd.Execute
    MM_editCmd.ActiveConnection.Close
    ASP, SQL2005, DW8 VBScript, Access

    issue corrected.
    ASP, SQL2005, DW8 VBScript, Visual Studio 2005, Visual Studio
    2008
    "Daniel" <[email protected]> wrote in message
    news:[email protected]...
    > Can anyone tell me whats wrong with these if statements:
    If i sumbit the
    > form providing everything except the dream_inscript
    field it gives me this
    > error:
    > =================================================
    > Microsoft OLE DB Provider for ODBC Drivers error
    '80040e57'
    > [Microsoft][ODBC Microsoft Access Driver]Invalid string
    or buffer length
    >
    > /purch_confirm_mail.asp, line 67
    > =================================================
    > If i submit the form and provide just that field along
    with the first 4
    > which are automatically passed from the DB the form
    submits fine and no
    > problem.. I know it has something to do with my If
    Statements..
    >
    > Basically i want to check the 4 fields:
    >
    > dream_inscript If this one is -1 then pass N/A to the db
    > dream_price If dream_inscript <> -1 then pass 45
    to the db
    > dream_comm if dream_comm is empty then pass N/A to the
    db
    >
    > custom_inscript if custom_inscript is empty then pass
    N/A to the db
    > custom_wanted if this is Y then pass 45 to the db
    > custom_comm if this is empty then pass N/A to the db
    >
    >
    >
    >
    > MM_editCmd.CommandText = "INSERT INTO tbMailOrders
    (item_number,
    > item_summary, item_price, shipping_cost, dream_price,
    dream_inscript,
    > dream_comm, custom_comm, custom_price, video_wanted,
    video_price,
    > grandtotal, cs_name, pp_email, c_email) VALUES (?, ?, ?,
    > ?, ?, ?, ?, ?, ?)"
    > MM_editCmd.Prepared = true
    > MM_editCmd.Parameters.Append
    MM_editCmd.CreateParameter("param1", 202,
    > 1, 10, Request.Form("item_number")) ' adVarWChar
    > MM_editCmd.Parameters.Append
    MM_editCmd.CreateParameter("param2", 202,
    > 1, 255, Request.Form("item_summary")) ' adVarWChar
    > MM_editCmd.Parameters.Append
    MM_editCmd.CreateParameter("param3", 202,
    > 1, 10, Request.Form("itemprice")) ' adVarWChar
    > MM_editCmd.Parameters.Append
    MM_editCmd.CreateParameter("param4", 202,
    > 1, 10, Request.Form("shippingcost")) ' adVarWChar
    > If cStr(Request.Form("dream_inscript"))<> "-1"
    Then
    > MM_editCmd.Parameters.Append
    MM_editCmd.CreateParameter("param5", 202, 1,
    > 10, "45") ' adVarWChar
    > Else
    > MM_editCmd.Parameters.Append
    MM_editCmd.CreateParameter("param5", 202,
    > 1, 10, "0.00") ' adVarWChar
    > End If
    > If cStr(Request.Form("dream_inscript"))<> "-1"
    Then
    > MM_editCmd.Parameters.Append
    MM_editCmd.CreateParameter("param6", 203, 1,
    > 1073741823, Request.Form("dream_inscript")) '
    adLongVarWChar
    > Else
    > MM_editCmd.Parameters.Append
    MM_editCmd.CreateParameter("param6", 203,
    > 1, 1073741823, "N/A") ' adLongVarWChar
    > End If
    > If Len(cStr(Request.Form("dream_comm")))= "0" Then
    > MM_editCmd.Parameters.Append
    MM_editCmd.CreateParameter("param7", 203,
    > 1, 1073741823, "N/A") ' adLongVarWChar
    > Else
    > MM_editCmd.Parameters.Append
    MM_editCmd.CreateParameter("param7", 203,
    > 1, 1073741823, Request.Form("dream_comm")) '
    adLongVarWChar
    > End If
    > If Len(cStr(Request.Form("custom_inscript")))= "0" Then
    > MM_editCmd.Parameters.Append
    MM_editCmd.CreateParameter("param8", 203,
    > 1, 1073741823, "N/A") ' adLongVarWChar
    > Else
    > MM_editCmd.Parameters.Append
    MM_editCmd.CreateParameter("param8", 203, 1,
    > 1073741823, Request.Form("custom_inscript")) '
    adLongVarWChar
    > End If
    > If Request.Form("custom_wanted")= "Y" Then
    > MM_editCmd.Parameters.Append
    MM_editCmd.CreateParameter("param9", 202,
    > 1, 10, "45") ' adVarWChar
    > Else
    > MM_editCmd.Parameters.Append
    MM_editCmd.CreateParameter("param9", 202,
    > 1, 10, "0.00") ' adVarWChar
    > End If
    > If Request.Form("video_wanted")= "Y" Then
    > MM_editCmd.Parameters.Append
    MM_editCmd.CreateParameter("param10", 202,
    > 1, 10, "Yes") ' adVarWChar
    > Else
    > MM_editCmd.Parameters.Append
    MM_editCmd.CreateParameter("param10", 202,
    > 1, 10, "No") ' adVarWChar
    > End If
    > If Request.Form("video_wanted")= "Y" Then
    > MM_editCmd.Parameters.Append
    MM_editCmd.CreateParameter("param11", 202, 1,
    > 10, "15") ' adVarWChar
    > Else
    > MM_editCmd.Parameters.Append
    MM_editCmd.CreateParameter("param11", 202,
    > 1, 10, 0.00) ' adVarWChar
    > End If
    > MM_editCmd.Parameters.Append
    MM_editCmd.CreateParameter("param12", 202,
    > 1, 10, Request.Form("grand")) ' adVarWChar
    > MM_editCmd.Parameters.Append
    MM_editCmd.CreateParameter("param13", 202,
    > 1, 255, Request.Form("name")) ' adVarWChar
    > MM_editCmd.Parameters.Append
    MM_editCmd.CreateParameter("param14", 202,
    > 1, 255, Request.Form("email")) ' adVarWChar
    > MM_editCmd.Parameters.Append
    MM_editCmd.CreateParameter("param15", 202,
    > 1, 255, Request.Form("email2")) ' adVarWChar
    > MM_editCmd.Execute
    > MM_editCmd.ActiveConnection.Close
    >
    > --
    > ************************************************
    > ASP, SQL2005, DW8 VBScript, Access
    >

  • Pls help! i duno wat is wrong with my com (suspect is mobo incompatiblity)

    previously used motorola USB surfboard cable modem 4200, whenever online, blue screen appears. it is the usb problem, i think the msg is irq driver not less or equal. disabled HT and no problem. But why i cannot use HT? is it not compatible with the motherboard? i changed motherboard, this is my brand new 2nd mobo (same model). now i switch to wireless to connect to the internet, whenever i try to send a file to my host computer(through irc), it hangs. the network icon is still active, the timer is still running, but just no packets sent or received, cannot even go internet. when i try to disable the card, it stops responding. Only rebooting helps. If i use peer 2 peer programs, the problem will occur in 15-30mins, if i used just for surfing, it can last quite long, like 3-6hours than problem comes back. changed and tried 3 brand new dlink (same model) cards but still the same. updated all to latest driver. using a linksys wrt54g router. do not think it has got to do with router, either wireless pci card or mobo but wireless card i changed 3 times already, and mobo changed once. when i use to transfer mp3 to my Mpio FL 100 mp3 player (USB), there is problem. sometimes it can transfer 2-3 songs, after that it stops, sometimes a msg appears (USB communication error). got the latest firmware and latest mpio manager. Tried it on a old computer, p4 2ghz, and it worked fine.
    my bios i used default settings all along (did not overclock), but i disable the caching as it will make my computer go blue screen. Ht is enabled.
    steps i did - removed all pci cards and left the wireless card alone, but still not responding 15-30mins later if used p2p program, 4-6hrs if do some light surfing
    2) updated all drivers, usb drivers, tried xp sp1, sp2, xp, windows 2000. still cannot solve.
    3) formatted hdd 20 times with different settings, stil cannot.
    4) change brand new wireless cards 3 times.
    5) change brand new msi mobo
    6) change new soundcard and cd-rom
    7) mp3 player new firmware, new software, formatted.
    More info:
    CPU - intel p4 HT 3ghz prescott, mPGA 478, FSB 200, bus spd 800
    mobo - msi ms-6728 2.00 (865PE Neo2), Rev. A2
    bios v3.8
    gcard - inno3d gforce4 mx440 128mb agp4x
    ram - kingston ddr-sdram 512mb pc3200 cl3
             channels - single, performance mode - disabled
              frequency - 200mhz
              fsb:dram - 1:1
              CAS latency - 3.0clocks
              ras to cas delay - 3 clocks
               ras precharge - 3 clocks
                cycle time (tras) - 8 clocks
    sound card - creative aud2
    wireless pci card - dlink dwl-g52-+
    Any1 can advise or have such similar problems? please help!!!! spent few months trying to figure out the problem!!!!!

    thx. but now i never use my modem through my computer usb. i connect my modem to a router. my host computer works fine (also p4 prescott 3ghz but not msi mobo), my computer (client) uses wireless pci card, stops responding after a while if i use bittorrent, tried diff clients, all the same results. used azureus now. can u solve it? all latest drivers already.
    Quote
    Originally posted by Danny
    USB Modem errors and hyperthreading are common. You need to see if you can get updated drivers from the modem manufacturer.

  • Help - What is wrong with my code ?

    I have a cfform that does a db search, using a field and a
    search criteria selected by the user. Here is my code :
    <tr>
    <td align="center" colspan="2">
    <font size="3" face="Arial, Helvetica, sans-serif"
    color="003366">
    <b>Pick Request
    Number: </b></font>
    <input type="text" name="prNumber">
    <select name="search_type">
    <option value="Contains">Contains</option>
    <option value="Begins With">Begins With</option>
    <option value="Ends With">Ends With</option>
    <option value="Is">Is</option>
    <option value="Is Not">Is Not</option>
    <option value="Before">Before</option>
    <option value="After">After</option>
    </select>
    </td>
    </tr>
    Here is the query that I am using :
    <cfquery name="getPRNum" datasource="docuTrack">
    SELECT prNumber, fileName
    FROM dbo.psFileInventory
    <cfif form.search_type is "Contains">
    Where dbo.psFileInventory.prNumber like '%#form.prNumber#%'
    </cfif>
    <cfif form.search_type is "Begins With">
    Where dbo.psFileInventory.prNumber like '#form.prNumber#%'
    </cfif>
    <cfif form.search_type is "Ends With">
    Where dbo.psFileInventory.prNumber like '%#form.prNumber#'
    </cfif>
    <cfif form.search_type is "Is">
    Where dbo.psFileInventory.prNumber = '#form.prNumber#'
    </cfif>
    <cfif form.search_type is "Is Not">
    Where dbo.psFileInventory.prNumber <>
    '#form.prNumber#'
    </cfif>
    <cfif form.search_type is "Before">
    Where dbo.psFileInventory.prNumber <= '#form.prNumber#'
    </cfif>
    <cfif form.search_type is "After">
    Where dbo.psFileInventory.prNumber >= '#form.prNumber#'
    </cfif>
    </cfquery>
    It cannot find any records with any of the search criteria
    except for the = sign. However, when I do each criteria
    individually, it works. For example, lif I enter 'PR8' in the form,
    then like '#form.prNumber#%' in the query will give me all part
    numbers that begin with PR8...etc, so I am pretty sure each of the
    search criteria work.
    But when I run it combined, it cannot find anything except
    for the 'is' (=) criteria.
    Can somebody please tell me what I am doing wrong ? I just
    cannot see it.
    Thanks

    quote:
    ...but wouldn't the query be in the action page ?
    I'm not quite sure what you are asking here. Are
    you asking if you have to run the query again in the action page?
    If that is the question, then the answer is no, because that is why
    I have you assign the query results on your query page
    to a session variable so that you can make it available to
    use just like you would the results of a cfquery on your action
    page. In other words, if you did something like this
    <cfset session.getPRNum_qry = getPRNum> on your query
    page, you can do something like this on your action page...
    <cfif IsDefined("session.getPRNum_qry.prNumber")>
    <cfoutput query = "session.getPRNum_qry">
    #prNumber# #fileName#
    </cfoutput>
    </cfif>
    ... which would loop through your "query" and display your
    prNumber and fileName values for all rows returned. What you do
    with them is up to you.....
    Phil

  • Need help finding whats wrong with my servlet

    I've been trying to create a simple login page following the tutorial found http://www.roseindia.net/mysql/loginauthentication.shtml
    There is a single JSP (AuthenticateLogin.jsp) and a servlet (LoginAuthentication.java). Basically what has to happen is the user enters the login information in the JSP which sends these info to the servlet. The servlet checks whether the username and password exist in the table and if they do it displays the user if not it says to that the username and/or password is invalid. I'm using IntelliJ IDEA as the IDE, Tomcat as the application server and MySQL 5.0.18 for the database. I'm also using Ant as a build tool.
    The following are my code:
    AuthenticateLogin.jsp
    <head>
         <title>Login Page</title>
         <script type="text/javascript">
              function validate() {
                   var user = document.frm.user
                   var pass = document.frm.pass
                   if ((user == null) || (user == "")) {
                        alert("Please enter a username")
                        user.focus()
                        return false
                   if ((pass == null) || (pass == "")) {
                        alert("Please enter a password")
                        pass.focus()
                        return false
         </script>
    </head>
    <body>
    <form name="frm" action="LoginAuthentication" method="post" onsubmit="return validate()">
         Name:       <input type="text" name="user"/>
         <br/>
         Password:   <input type="text" name="pass" />
         <br />
         <input type="submit" value="Sign in"/>     
         <input type="reset" value="Reset"/>
    </form>
    </body>
    </html>{code}
    LoginAuthentication.java
    {code:java}import java.io.*;*
    *import java.sql.*;
    import javax.servlet.*;*
    *import javax.servlet.http.*;
    public class LoginAuthentication extends HttpServlet {
         private ServletConfig config;
         public void init (ServletConfig config) throws ServletException {
              this.config = config;
         public void doPost (HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException{
              PrintWriter out = response.getWriter();
              String connectionUrl = "jdbc:mysql://192.168.0.95:3306/loginTester";
              Connection connection = null;
              ResultSet rs;
              String userName = new String("");
              String passwrd = new String("");
              response.setContentType("text/html");
              try {
                   Class.forName("com.mysql.jdbc.Driver");
                   connection = DriverManager.getConnection(connectionUrl, "root", "");
                   String sql = "select user, password from user";
                   Statement s = connection.createStatement();
                   s.executeQuery(sql);
                   rs = s.getResultSet();
                   while (rs.next()) {
                        userName = rs.getString("user");
                        passwrd = rs.getString("password");
                   rs.close();
                   s.close();
              } catch (Exception e){
                   System.out.println("Exception thrown: ["+e+"}");
              if (userName.equals(request.getParameter("user")) && passwrd.equals(request.getParameter("pass"))) {
    //               response.sendRedirect("http://localhost:8080/xplanner_reports/");
                   out.println("Hello"+userName);
              } else {
                   out.println("Please enter a valid username and password");
                   out.println("<a href='AuthenticateLogin.jsp'><br/>Login again</a>");
    }{code}
    web.xml
    {code:java}<?xml version="1.0" encoding="UTF-8"?>
    <web-app xmlns="http://java.sun.com/xml/ns/javaee"
                 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                 xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
                http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
                 version="2.5">
         <welcome-file-list>
              <welcome-file>AuthenticateLogin.jsp</welcome-file>
         </welcome-file-list>
         <servlet>
              <servlet-name>LoginAuthentication</servlet-name>
              <servlet-class>LoginAuthentication</servlet-class>
         </servlet>
         <servlet-mapping>
              <servlet-name>LoginAuthentication</servlet-name>
              <url-pattern>/LoginAuthentication</url-pattern>
         </servlet-mapping>
    </web-app>
    </web-app>{code}
    The problem I'm facing is the validation (checking whether the username and password match to those in the database) isn't working properly. No matter what I enter as the username and password (even if it is the correct pair) it always shows as my username and/or password is invalid. When I check the tomcat (catalina) log the following entry was found:
    {code:java}Exception thrown: [java.lang.ClassNotFoundException: com.mysql.jdbc.Driver}{code}
    Could someone please show me what I could be doing wrong here? It would be a great help.  Spent a day trying to figure this out :no:                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

    How could I add it to my classpath from Idea?
    By the way the following is my build.xml (ant build file)
    <project name="LoginForm" basedir=".">
        <property name="app.name" value="LoginForm"/>
        <property name="src.dir" location="src"/>
        <property name="build.dir" location="build"/>
        <property name="build.webinf.classes.dir" location="${build.dir}/WEB-INF/classes"/>
        <property name="web.dir" location="web"/>
        <property name="dist.dir" location="dist"/>
        <property name="lib.dir" location="lib"/>
        <property name="tomcat.home" location="/home/ruzaik/software/tomcat/apache-tomcat-5.5.20"/>
        <property name="tomcat.url" value="http://localhost:8080/manager"></property>
        <property name="tomcat.username" value="tomcat"/>
        <property name="tomcat.passward" value="tomcat"/>
        <property name="appserver.deploy.dir" location="${tomcat.url}/webapps"></property>
        <property name="war.file" value="${app.name}.war"/>
        <import file="${tomcat.home}/bin/catalina-tasks.xml"/>
        <path id="project.classpath">
            <dirset dir="${build.dir}"/>
            <fileset dir="${lib.dir}">
                <include name="**/*.jar"/>
            </fileset>
        </path>
        <target name="clean" description="Cleans directories">
            <delete dir="${build.dir}"/>
            <delete dir="${dist.dir}"/>
        </target>
        <target name="init" depends="clean" description="Creates directories">
            <mkdir dir="${build.dir}"/>
            <mkdir dir="${build.webinf.classes.dir}"/>
            <mkdir dir="${dist.dir}" />
        </target>
        <target name="compile" depends="init">
            <javac srcdir="${src.dir}" destdir="${build.webinf.classes.dir}">
                <classpath refid="project.classpath"/>
            </javac>
        </target>
        <target name="copy" description=" : Copy the content of web in to build directoy">
            <copy todir="${build.dir}" preservelastmodified="yes" overwrite="yes">
                <fileset dir="${web.dir}">
                    <include name="**/*"/>
                    <exclude name="**/*.bak"/>
                </fileset>
            </copy>
        </target>
        <target name="war" depends="compile, copy" description=" : Create a war file for deploying">
            <jar destfile="${dist.dir}/${app.name}.war" update="false" compress="true">
                <fileset dir="${build.dir}">
                    <include name="**/*"/>
                </fileset>
            </jar>
        </target>
        <target name="install">
            <deploy url="${tomcat.url}" username="tomcat" password="tomcat" path="/LoginForm"
                    war="${dist.dir}/${war.file}">
            </deploy>
        </target>
        <target name="uninstall">
            <undeploy url="${tomcat.url}" username="tomcat" password="tomcat" path="/LoginForm">
            </undeploy>
        </target>
    </project>and my directory structure could be found here http://img407.imageshack.us/img407/1594/tempf.png
    I think I"ve added it to the classpath.

  • Help - what is wrong with my iMac ?

    Hello
    I'd really appreciate some help and advice with by iMac !
    I'm having a really strange issue and I've no idea whats casuing it.
    After using it for a while whichever window is open starts to black out - you can shut the window down but it remains there - if you click you mouse onto the screen you can pull a square out and it reveals the desktop wall paper underneath !
    You cant force quit the open screens, the only way to stop it is to restart.
    I have posted some photos for you to see - I hope someone can help !
    [url=http://www.flickr.com/photos/52989912@N02/8686257908/][img]http://farm9.staticflickr.com/8538/8686257908_fa4d265b87_c.jpg[/img][/url]
    [url=http://www.flickr.com/photos/52989912@N02/8686257908/]
    [url=http://www.flickr.com/photos/52989912@N02/8685138651/][img]http://farm9.staticflickr.com/8123/8685138651_3fee66c385_c.jpg[/img][/url]
    [url=http://www.flickr.com/photos/52989912@N02/8685138651/]
    thanks

    thanks for replying
    unfortunatle I blew the dust out of the vents before running temperature monitor so I can only say what the temps are now !
    Ambient 16c
    CPU A heatsink 31c
    Graphics processor chip 1 41c
    Graphics processor heatsink 1 41c
    Graphics Processor temp diode 45c
    Power supply 54c
    Just to state again I blew a heck of a lot of dust out (with a compressor) - really amazed at how much there was
    I probably blew too hard though as some dust has gone behind the screen but luckily you cant see it when the screen is on..
    thanks

  • Wat is wrong with this simple query ???

    I am using 10gxe.
    Below is the query which is not working
    Whenever i am executing it a pop up windows is coming up
    and asking me to enter bind variables ..wat shall i do ???
    Here is a prntscrn of the issue .
    http://potupaul.webs.com/at.html
    VARIABLE g_message VARCHAR2(30)
    BEGIN
    :g_message := 'My PL/SQL Block Works';
    END;
    PRINT g_message
    Edited by: user4501184 on May 18, 2010 12:42 AM

    sqlplus "system/sm@test"
    SQL*Plus: Release 10.2.0.2.0 - Production on Tue May 18 12:45:05 2010
    Copyright (c) 1982, 2005, Oracle. All Rights Reserved.
    Connected to:
    Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    SQL> VARIABLE g_message VARCHAR2(30)
    SQL> BEGIN
    2 :g_message := 'My PL/SQL Block Works';
    3 END;
    4 /
    PL/SQL procedure successfully completed.
    SQL> PRINT g_message;
    G_MESSAGE
    My PL/SQL Block Works
    SQL>

  • Help: what's wrong with my code?

    Hi. I'm using JNDI to connect to an SQL Server Database.
    My machine can only handle jcreator or netbeans 4.1
    is it possible for me to deploy or create such connection?
    Please help me.
    All suggestions would be very much appreciated.
    import javax.sql.*;
    import java.sql.*;
    import java.io.*;
    import javax.naming.*;
    import java.util.*;
    public class Test {
        public static void main(String[] args) {
            System.out.println("Starting test.");
            setJVMProperties();
            bindDataSource();
            testDataSource();
            System.out.println("Test finished.");
        public static void setJVMProperties() {
            Properties p = new Properties(System.getProperties());
            p.setProperty("java.naming.factory.initial",
    "com.sun.jndi.fscontext.RefFSContextFactory");
            p.setProperty("java.naming.provider.url", "com.ibm.websphere.naming.WsnInitialContextFactory");
            System.setProperties(p);
        public static void bindDataSource() {
            Context ctx = null;
            try {
    // On the 3 lines below, I get the error: package com.microsoft.jdbc.sqlserver does not exist
    Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
    com.microsoft.jdbc.sqlserver.SQLServerDriver sqlServerDS = new
    com.microsoft.jdbc.sqlserver.SQLServerDriver();
                sqlServerDS.setServerName("PSERVER\\PINST");
                sqlServerDS.setPortNumber("9080");
                sqlServerDS.setDatabaseName("Customer");
                sqlServerDS.setUser("neil");
                sqlServerDS.setPassword("123");
                ctx = new InitialContext();
                ctx.rebind("jdbc/Name", sqlServerDS);
            } catch (Exception e) {
                System.err.println("Error binding datasource with jndi. " +e);
        public static void testDataSource() {
            try {
                 int id;
                Context ctx = new InitialContext();
                DataSource ds = (DataSource)ctx.lookup("jdbc/Name");
                Connection con = ds.getConnection();
                CallableStatement cs = con.prepareCall("{? = Call Login(?,?)}");
                cs.registerOutParameter(1, Types.INTEGER);
                cs.setString(2, "123");
                cs.setString(3, "123");
                cs.execute();
                id = cs.getInt(1);
                System.out.println(id);
               try {
                        cs.close();
                        con.close();
                } catch (Exception e) {System.err.println(e);}
            } catch (Exception e) {
                System.err.println("Problem running db stuff." +e);
    }

    hi. thanks so much for your tip. i followed it and finally my
    com.microsoft.jdbc.sqlserver.SQLServerDriver sqlServerDS = new
    com.microsoft.jdbc.sqlserver.SQLServerDriver();line is now recognized...
    However, i get errors on the next 5 lines
       sqlServerDS.setServerName("PSERVER\\PINST");
                sqlServerDS.setPortNumber("9080");
                sqlServerDS.setDatabaseName("Customer");
                sqlServerDS.setUser("neil");
                sqlServerDS.setPassword("123");the errors i get are something like: cannot find symbol
    symbol : method setUser(java.lang.String)
    location: class com.microsoft.jdbc.sqlserver.SQLServerDriver
    sqlServerDS.setUser("neil");
    as you might have noticed, i'm really new to java programming and i would very much appreciate all the help i can get.

  • Help, what's wrong with my upload function

    Hi,
    I want to write a java Bean (FileUploadBean) to upload the image files. I use a very simple txt file to test my Bean code, I've already know the syntax of the entity body of httpServletRequest object, it's like below:
    "-----------------------------7d327203032e
    Content-Disposition: form-data; name="toefl_form"; filename="C:\transfer\Picasso_ljm\jakarta-tomcat-4.0.1\webapps\junmin\image\test.txt"
    Content-Type: text/plain
    hi, this is a test;
    -----------------------------7d327203032e--
    My original test.txt file is only a line without '\r', '\n'.
    "hi, this is a test."
    But after call my upload function, the saved file is:
    hi, this is a test.
    There are 4 more bytes than the original file. Below is my FileUploadBean file, does anyone can figure out what's wrong in my upload function? Does the readLine read the return carriage and new line charactor too? Thank you very much!
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.ServletInputStream;
    import java.util.Dictionary;
    import java.util.Hashtable;
    import java.io.PrintWriter;
    import java.io.BufferedWriter;
    import java.io.FileWriter;
    import java.io.FileOutputStream;
    import java.io.IOException;
    public class FileUploadBean {
    private String savePath, saveFilename, filepath, filename, contentType;
    // private Dictionary fields;
    public String getFilename() {
    return filename;
    public String getFilepath() {
    return filepath;
    public void setSavePath(String savePath) {
    this.savePath = savePath;
    public void setSaveFilename(String saveFilename) {
    this.saveFilename = saveFilename;
    public String getContentType() {
    return contentType;
    private void setFilename(String s) {
    if (s==null)
    return;
    int pos = s.indexOf("filename=\"");
    if (pos != -1) {
    filepath = s.substring(pos+10, s.length()-1);
    // Windows browsers include the full path on the client
    // But Linux/Unix and Mac browsers only send the filename
    // test if this is from a Windows browser
    pos = filepath.lastIndexOf("\\");
    if (pos != -1)
    filename = filepath.substring(pos + 1);
    else
    filename = filepath;
    private void setContentType(String s) {
    if (s==null)
    return;
    int pos = s.indexOf(": ");
    if (pos != -1)
    contentType = s.substring(pos+2, s.length());
    public void doUpload(HttpServletRequest request) throws IOException {
    ServletInputStream in = request.getInputStream();
    // read boundary
    byte[] line = new byte[256];
    int i = in.readLine(line, 0, 256);
    if (i < 3)
    return;
    int boundaryLength = i - 2;
    String boundary = new String(line, 0, boundaryLength); //-2 discards the newline character
    String newLine = new String(line, 0, i);
    if (newLine.startsWith("Content-Disposition: form-data; name=\""))
    if (newLine.indexOf("filename=\"") != -1) {
    setFilename(new String(line, 0, i-2));
    if (filename==null)
    return;
    //this is the file content
    i = in.readLine(line, 0, 256);
    setContentType(new String(line, 0, i-2));
    // blank line
    i = in.readLine(line, 0, 256);
    // read the first byte of the file
    i = in.read();
    FileOutputStream fo = new FileOutputStream((savePath==null? "" : savePath) + saveFilename);
    while (i != -1) {
    // if this byte is equal to the first byte of the boundary, then first mark this place, and
    // go ahead to check if it encounter the ending boundary. If it belongs to the file, then reset
    // the read position and reread.
    if( (char)i == '\r') {
    in.mark(256);
    i = in.read();
    char c1 = (char)i;
    i = in.read();
    char c2 = (char)i;
    i = in.readLine(line, 0, 256);
    // if it is the end of request body, then close the OutputStream. Since the first byte is
    // read already, then the final boundary size if +3
    if ( (c1 == '\n') && (c2 == '-') && (i==boundaryLength+3) // + 3 is eof
    && (new String(line, 0, i).startsWith(boundary.substring(1)))) {
    i = in.read();
    else {
    // it is not the eof, then write this byte into the outputStream and reset the read position
    fo.write(i);
    in.reset();
    i = in.read();
    } // end if
    // else if (char)i != '-', then write directly to the fileOutputStream
    else {
    fo.write(i);
    i= in.read();
    } // end while
    // close the fileOutputStream
    fo.close();
    }// end function

    HI,
    I find a bug myself. I add a line "i = in.read(line, 0, 256);" in doUpload function in the following position:
    String boundary = new String(line, 0, boundaryLength); //-2 discards the newline character
    i = in.read(line, 0, 256);
    String newLine = new String(line, 0, i);
    But still, when I was trying to read a image file, it even didn't finish reading and quit already! Still has bugs, need help!
    Junmin

  • I need Help what is wrong with my code?

    Hi, well I am doing a class and a driver for a sphere. I need to compute the volume and surface area of the sphere I have the formula but when I run the program I don't get a result for neither. I would like to know what am I doing wrong? Here is my code. Thanks.
    This is my class
    import java.text.DecimalFormat;
        public class Sphere
       //Variable Declarations.
          private int diameter;
          private double radius;
       //Constructor: Accepts and initialize instance data.
           public Sphere(int sp_diameter)
             diameter = sp_diameter;
       //Set methods: Diameter
           public void setDiameter(int new_diameter)
             diameter = new_diameter;
       //Get methods: Diameter
           public int getDiameter()
             return diameter;
       //Compute volume and surface area of the sphere
           public double getVolume()
             return  4 * Math.PI * radius * radius * radius / 3;
           public double getArea()
             return  4 * Math.PI * radius * radius;
       //toString method will return one line description of the sphere
           public String toString()
             DecimalFormat fmt =new DecimalFormat("0.###");
             String sphere = " " + fmt.format(diameter) +fmt.format(getVolume()) + fmt.format(getArea());        
             return sphere;
    Here is the driver
    public static void main(String[]args)
             Sphere sphere1, sphere2, sphere3;
             sphere1 = new Sphere(10);
             sphere2 = new Sphere(12);
             sphere3 = new Sphere(20);
             System.out.println("The sphere diameter are: ");
             System.out.println("\tFirst Sphere diameter is: " + sphere1);
             System.out.println("\tSecond Sphere diameter is: " + sphere2);
             System.out.println("\tThird Sphere diameter is: " + sphere3);
          //Prints the Sphere Volume and  Surface Area.
             System.out.println("\nTheir Volume and Surface Area: ");
             System.out.println("\tSphere1: " + " " + sphere1.getVolume() + " " + sphere1.getArea());
             System.out.println("\tSphere2: " + " " + sphere2.getVolume() + " " + sphere2.getArea());
             System.out.println("\tSphere3: " + " " + sphere3.getVolume() + " " + sphere3.getArea());
          //Change the diameter of the sphere.
             sphere1.setDiameter(11);
             sphere2.setDiameter(15);
             sphere3.setDiameter(25);
             System.out.println("\nNew diameter is: ");
             System.out.println("\tFirst Sphere diameter is: " + sphere1);
             System.out.println("\tSecond Sphere diameter is: " + sphere2);
             System.out.println("\tThird Sphere diameter is: " + sphere3);
          //Prints the Sphere Volume and  Surface Area.
             System.out.println("\nTheir Volume and Surface Area: ");
             System.out.println("\tSphere1: " + " " + sphere1.getVolume() + " " + sphere1.getArea());
             System.out.println("\tSphere2: " + " " + sphere2.getVolume() + " " + sphere2.getArea());
             System.out.println("\tSphere3: " + " " + sphere3.getVolume() + " " + sphere3.getArea());
          //Using the toString Method.
             System.out.println("\nFirst sphere: " + sphere1);
       }

    Maybe try a different constructor for sphere...
    public Sphere(int sp_diameter, int sp_radius)
    diameter = sp_diameter;
    }nd maybe even a setRadius(int newRadius) and
    getRadius().
    Hope that helpsYou should not do it this way. The reason.. The radius is 1/2 the diameter. if you have seperate methods, then the programmer can set the diameter to X and the radius to 10X. not good.
    A better way for the c'tor would be:
        //Constructor: Accepts and initialize instance data.
        public Sphere(int sp_diameter) {
            diameter = sp_diameter;
            radius = (double) diameter/2.0;  //<-- I added this
        }something similar in the setDiameter..

  • Help: What's wrong with my installed Developer 6.0?

    Hi, Everyone,
    I have a Developer 6.0 for Win95/NT4.0 version free downloaded
    from OTN. My development ENV is: ORACLE 8.0.5 in one NT4.0
    machine, OAS4.0.7 in the second NT4.0 machine.
    Oracle8.0.5&OAS4.0.7 are installed and configed successfully.
    Then I installed my Develper6.0 in the second NT4.0 machine. I
    want to config my Develper6.0 Web developing/deployment
    environment to deploy my developed Form/Report/Graphics. But I
    cann't find the "Start->Oracle Developer R6.0->Server Wizard"
    menu as illustrated in the chapter "Configuring your Oracle
    Developer Server environment" of Oracle Developer Online
    Manuals.So I can not config my Developer6.0 Server for Web
    environment automatically. Who can tell me why? Without the
    Server Wizard, how can I config my Form/Report/Graphics Server
    manually?
    Thanks in advance.
    Robby
    null

    I've managed to install the wizard. I've started Oracle
    installer and pointed to nt.prd file on developer 6 CD. Almost
    at the end you find the server configuration wizard. You can
    install him seperately.
    For the whole story i've replied the thread
    'URGENT HELP NEEDED: Configure the Developer 6.0 Web Server u'
    Succes,
    Werner
    Brad (guest) wrote:
    : Robby Shong (guest) wrote:
    : : Hi, Everyone,
    : : I have a Developer 6.0 for Win95/NT4.0 version free
    downloaded
    : : from OTN. My development ENV is: ORACLE 8.0.5 in one NT4.0
    : : machine, OAS4.0.7 in the second NT4.0 machine.
    : : Oracle8.0.5&OAS4.0.7 are installed and configed
    successfully.
    : : Then I installed my Develper6.0 in the second NT4.0 machine.
    I
    : : want to config my Develper6.0 Web developing/deployment
    : : environment to deploy my developed Form/Report/Graphics. But
    I
    : : cann't find the "Start->Oracle Developer R6.0->Server
    Wizard"
    : : menu as illustrated in the chapter "Configuring your Oracle
    : : Developer Server environment" of Oracle Developer Online
    : : Manuals.So I can not config my Developer6.0 Server for Web
    : : environment automatically. Who can tell me why? Without the
    : : Server Wizard, how can I config my Form/Report/Graphics
    Server
    : : manually?
    : : Thanks in advance.
    : : Robby
    : Server Wizard is not currently available you get to do the
    setup
    : manually for now. The installation documentation will guide
    you
    : through.
    : Hope that helps
    null

  • Please wat is wrong with this program

    I want to reverse the user input but when I run this program it only asks for the input and when i key it in and press enter nothing happens.It just freezes.
    Sorry the code is a bit long .
    import java.io.*;
    class StackX
    private int maxSize;
    private char[] stackArray;
    private int top;
    public StackX(int max)  
           maxSize=max;
           stackArray=new char[maxSize];
           top=-1;
    public void push(char j) 
         stackArray[++top]=j;
    public char pop()    
         return stackArray[top--];
    public char peek()  
         return stackArray[top];
    public boolean isEmpty()   
         return (top==-1);
    class Reverser
         private String input;  
         private String output; 
    public Reverser(String in)
         {input = in;}
             public String doRev( )    
         int stackSize=input.length( ); 
         StackX theStack = new StackX(stackSize);
         for(int j=0;j<input.length( );j++)
         char ch=input.charAt(j); 
         theStack.push(ch);
         output ="";
         while( !theStack.isEmpty() )
         char ch=theStack.pop();
         output=output+ch; 
         return output;
    class ReverseApp
         public static void main(String[]args)throws IOException
         String input, output;
         while(true)
         System.out.print("Enter a string:");
         System.out.flush();
         input=getString();
         if( input.equals(""))
          break;
         Reverser theReverser = new Reverser(input);
         output = theReverser.doRev();
         System.out.println("Reversed: " + output);
    public static String getString()throws IOException
         InputStreamReader isr = new InputStreamReader(System.in);
         BufferedReader br= new BufferedReader(isr);
         String s = br.readLine();
         return s;
    }

    One potential problem is that you're using a new reader around system.in every time. I don't know what happens when you do that. Just make it a member variable, or create it once in main and pass it to getString.
    Asid from that, put a bunch of print statements in or use a debugger to see what's happening at each step of the way. You might be getting into an infinite loop somewhere in your reverse operation.

  • What's wrong with my Macbook Air?

    Yesterday I was using it and everything seemed to be working perfectly. I turned it off and when I tried turning it back on, it got stuck on the grey screen with the apple at the beginning and didn't do anything else. I tried pressing shift while I turned it on and it finally worked. Now, it's being really weird, it's showing me a message saying 'Shockwave Flash has crashed' when I try loading a site on the internet, also, my Volume buttons are not working, they seem to be locked and if I turn it off and back on again, it takes forever to load. 
    Help what's wrong with it?

    Try booting to your Recovery Partion, by holding down the OPTION key while booting, and then select the Recovery Partion. Run Disk Utility from there, and Repair your Permissions, then Verify Disk. If Verify Disk finds reason to do so, run Repair Disk.
    Shutdown, and see if it boots normally. If not, boot using the SHIFT key again (Safe Mode). From Safe Mode, update your Flash drom Adobe's site. Retry a normal boot.

Maybe you are looking for

  • Java web start unable to auto download java 1.6.0_14

    Hi, My application runs on java 1.6.0_14 and i want clients to use either 1.6.0_14 or higher while running the application. In the JNLP file i have mentioned j2se version as 1.6.0_14+ If the client machine has a java version lesser than 1.6.0_14, Jav

  • Setup problem with new MX 459

    I have windows 7.  Just bought printer today.  Of course Canon support is closed today.  After downloading the software either on-line or with disc provided, and either for USB or wireless setup.   In step 2 , on screen for "Please allow Insall Wixar

  • Adobe problems

    Hi i have adobe photoshop and illustrator cs2 and have installed them on my macbook pro but when i try to open them the programs just up and quit every time. i have tried to re-intall several times and have done any update i can think of. any help or

  • Connect to wifi but not the Internet

    My iMac is connect to the wifi but not actually online, can anyone help?!

  • Colorized Grayscale Images Do Not Print Correctly

    Hi, we're having trouble getting proper color output when we colorize grayscale TIF files in InDesign. We have just a couple basic grayscale TIF files, no transparency, saved with or without embedded profiles (Dot Gain 20%). We add a foreground and b