Please help me, boolean function

Hello everyone, this is my first post in this forum. I have this function but I cant get it to work because I get this "missing return statement". Im desperate now, I cant figure how to fix it. Please help me.
public static boolean es(String inst) {                              // Verificador de validez
          int ad=inst.indexOf("ADELANTE");
          int at=inst.indexOf("ATRAS");
          int iz=inst.indexOf("IZQUIERDA");
          int de=inst.indexOf("DERECHA");
          int bo=inst.indexOf("BORRAR");
          int ho=inst.indexOf("HOGAR");
          double numero;
          try {
               if ((ad==0)&&(inst.charAt(8)==' ')) {
                    numero = Double.parseDouble(inst.substring(9));
                    if (numero>0)
                         return true;
                    else return false;
               if ((at==0)&&(inst.charAt(5)==' ')) {
                    numero = Double.parseDouble(inst.substring(6));
                    if (numero>0)
                         return true;
                    else return false;
               if ((iz==0)&&(inst.charAt(9)==' ')) {
                    numero = Double.parseDouble(inst.substring(10));
                    if ((numero>0)&&(numero<360))
                         return true;
                    else return false;
               if ((de==0)&&(inst.charAt(7)==' ')) {
                    numero = Double.parseDouble(inst.substring(8));
                    if ((numero>0)&&(numero<360))
                         return true;
                    else return false;
               if (bo==0) return true;
               if (ho==0) return true;
               else return false;
          catch (NumberFormatException ex) {
     }The objective of this function is to check if the user entered one of these words: "adelante", "atras", "izquierda" or "derecha" followed by a positive number. Thank you in advance for your help.

you need to have a return statement at the very end of you method.
here's a rewrite of what you provided...instead of a bunch of returns everywhere, i set a variable to return. i also put else if statements instead of if since you only want to see if one of the instances exist
public static boolean es(String inst) {                              // Verificador de validez
          int ad=inst.indexOf("ADELANTE");
          int at=inst.indexOf("ATRAS");
          int iz=inst.indexOf("IZQUIERDA");
          int de=inst.indexOf("DERECHA");
          int bo=inst.indexOf("BORRAR");
          int ho=inst.indexOf("HOGAR");
          double numero;
          boolean answer = false;
          try {
               if ((ad==0)&&(inst.charAt(8)==' ')) {
                    numero = Double.parseDouble(inst.substring(9));
                    if (numero>0)
                         answer = true;
                    else answer = false;
               else if ((at==0)&&(inst.charAt(5)==' ')) {
                    numero = Double.parseDouble(inst.substring(6));
                    if (numero>0)
                         answer = true;
                    else answer = false;
               else if ((iz==0)&&(inst.charAt(9)==' ')) {
                    numero = Double.parseDouble(inst.substring(10));
                    if ((numero>0)&&(numero<360))
                         answer = true;
                    else answer = false;
               else if ((de==0)&&(inst.charAt(7)==' ')) {
                    numero = Double.parseDouble(inst.substring(8));
                    if ((numero>0)&&(numero<360))
                         answer = true;
                    else answer = false;
               else if (bo==0) answer = true;
               else if (ho==0) answer = true;
               else answer = false;
          catch (NumberFormatException ex) {
answer = false;
          return answer;
Message was edited by:
muzic

Similar Messages

  • Please help regarding method/function sign up validation with mysql jdbc.

    HI guys,
    I am have been fixing this problem for days, hope that someone could help me find the bug on my code.
    I have 3 files:
    1.WithAuth.java - for database jdbc mysql connection
    2.WithAuthMet.java - method that will read any variables that will be passed to it. this method is waiting for two variables, a and b. a for userName and b for userPassword.
    3.WithAuthTest.java - the testing class, this is where i declare my sample control data to test the database connection and query.
    here's the actual codes:
    WithAuth.java
    package com.Auth;
    public class WithAuth {
        static String userName = "root";
        static String userPassword = "";
        static String databaseUrl = "jdbc:mysql://localhost:3306/javatowebservice";
        static String userQuery = "select * from userlogin";
    }WithAuthMet.java
    - this is where the error is and where I messed up.
    package com.Auth;
    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.ResultSet;
    import java.sql.Statement;
    public class WithAuthMet extends WithAuth {
        public void connect(String a, String b)throws Exception{       
            //try {
                Class.forName ("com.mysql.jdbc.Driver").newInstance ();               
                Connection conn = DriverManager.getConnection (databaseUrl, userName, userPassword);
                Statement stat = conn.createStatement();   
                String query = userQuery;
                ResultSet result = stat.executeQuery(query);
                System.out.println("Result(s): ");
                  while (result.next ()){
                      int i = result.getInt("userId");
                      String name=result.getString("userName");
                      String password=result.getString("userPassword");
                          //System.out.println("test data:"+a);
                      if(a.equals(name.equals("userName"))&& b.equals(password.equals("userPassword"))){
                                System.out.println("User is Valid");
                            else{
                                System.out.println("You are not a Valid User");
                                System.out.println("test data:"+name);
                                System.out.println("test data:"+password);
                                System.out.println("test data:"+a);
                                System.out.println("test data:"+b);
                      //conn.close();
                   // }catch(Exception e){
                    //System.out.println("Exception is ;"+e);
                    //System.out.println("Exception is ;");
    //                if(a.equals(name.("userName"))
    //                    && password.equals(password.equals("userPassword"))){
    //                    System.out.println("User is Valid");
    //                else{
    //                    System.out.println("You are not a Valid User");
    } WithAuthTest.java
    package com.Auth;
    public class WithAuthTest extends WithAuthMet{
        public static void main(String[] args) throws Exception{
            WithAuthMet CTD = new WithAuthMet();   
            String a = "dan";
            String b = "password";
            //CTD.connect(String name,String password);
            CTD.connect(a, b);
            //return connect;
    }please help.

    yakultyakultyakult wrote:
    WithAuthMet.java
    - this is where the error is and where I messed up.
    package com.Auth;
    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.ResultSet;
    import java.sql.Statement;
    public class WithAuthMet extends WithAuth {
    public void connect(String a, String b)throws Exception{       
    //try {
    Class.forName ("com.mysql.jdbc.Driver").newInstance ();               
    Connection conn = DriverManager.getConnection (databaseUrl, userName, userPassword);
    Statement stat = conn.createStatement();   
    String query = userQuery;
    ResultSet result = stat.executeQuery(query);
    System.out.println("Result(s): ");
    while (result.next ()){
    int i = result.getInt("userId");
    String name=result.getString("userName");
    String password=result.getString("userPassword");
    //System.out.println("test data:"+a);
    if(a.equals(name.equals("userName"))&& b.equals(password.equals("userPassword"))){
    System.out.println("User is Valid");
    else{
    System.out.println("You are not a Valid User");
    System.out.println("test data:"+name);
    System.out.println("test data:"+password);
    System.out.println("test data:"+a);
    System.out.println("test data:"+b);
    //conn.close();
    // }catch(Exception e){
    //System.out.println("Exception is ;"+e);
    //System.out.println("Exception is ;");
    //                if(a.equals(name.("userName"))
    //                    && password.equals(password.equals("userPassword"))){
    //                    System.out.println("User is Valid");
    //                else{
    //                    System.out.println("You are not a Valid User");
    This is one line that is wrong
                       if(a.equals(name.equals("userName"))&& b.equals(password.equals("userPassword"))){You have 'a' and 'b which are Strings
    and you are comparing them [using equals()] with the boolean return from another set of equals() invocations.
    String equals boolean will always be false (well, maybe not if the String is "TRUE" or "FALSE" - and you would need some more boilerplate to make that work).

  • Please help with some function module

    Dear All,
    We are trying to get data for excise duties based eg. BED, ECS, SECESS in the PO printout. Can anyone please suggest any function module through which excise duty can be calculated. For condition types other than ED we are using function module CALCULATE_TAX_ITEM. Please help.
    Thanks and regards,
    Atanu

    Dear All,
    We are trying to get data for excise duties based eg. BED, ECS, SECESS in the PO printout. Can anyone please suggest any function module through which excise duty can be calculated. For condition types other than ED we are using function module CALCULATE_TAX_ITEM. Please help.
    Thanks and regards,
    Atanu

  • Please help with 'Pricing' function module

    Hi!
    I am trying to use function module 'Pricing' but the table it_komv is still empty even after calling. I am basically trying to print some free of charge items on invoice sapscript and hence I am using 'Pricing' function in the print program. I am passing the below parameters. Please tell me whatelse I need to pass/not to pass.
      wa_komk-mandt = sy-mandt.
          wa_komk-kalsm = vbdkr-kalsm.
          wa_komk-kappl = 'V'.
          wa_komk-waerk = vbdkr-waerk.
         wa_komk-knumv = vbdkr-knumv.
          wa_komk-knuma = vbdkr-knuma.
          wa_komk-vbtyp = vbdkr-vbtyp.
          wa_komk-land1 = vbdkr-land1.
          wa_komk-vkorg = vbdkr-vkorg.
          wa_komk-vtweg = vbdkr-vtweg.
          wa_komk-spart = vbdkr-spart.
          wa_komk-prsdt = vbdkr-erdat.
          wa_komk-kurst = vbdkr-kurst.
          wa_komk-kurrf = vbdkr-kurrf.
          wa_komk-kurrf_dat = vbdkr-kurrf_dat.
          wa_komp-kposn = vbdpr-posnr.
          wa_komp-kursk = vbdpr-kursk.
          wa_komp-kursk_dat = vbdpr-kursk_dat.
          wa_komp-werks = vbdpr-werks.
          CALL FUNCTION 'PRICING'
            EXPORTING
            CALCULATION_TYPE        = 'A'
              comm_head_i             = wa_komk
              comm_item_i             = wa_komp
            PRELIMINARY             = ' '
            NO_CALCULATION          = ' '
         IMPORTING
             comm_head_e             = wa_komk
             comm_item_e             = wa_komp
          TABLES
              tkomv                   = it_komv
            SVBAP                   =
        CHANGING
            REBATE_DETERMINED       = ' '
    Thanks a lot!

    Hi,
    Check this example..
    tables: vbdkr.
    data: s_komk type KOMK.
    data: s_komp type komp.
    data: t_komv like KOMV occurs 0 with header line.
    data: t_komvd like komvd occurs 0 with header line.
    Input
    s_komk-mandt = sy-mandt.
    s_komk-knumv = vbdkr-knumv.
    CALL FUNCTION 'RV_PRICE_PRINT_ITEM'
      EXPORTING
        comm_head_i       = s_komk
        comm_item_i       = s_komp
      tables
        tkomv             = t_komv
        tkomvd            = t_komvd
    You can check the program RVADIN01 for a sample..
    Hope this helps..
    Thanks,
    Naren

  • Please help with search function

    Heya, im currently working on code that will allow me to add, view, search and remove prisoners and wardens from a prison system. So far i have managed to allow the user to add and view. Im a bit stuck on the search part of the code, its a bit temperamental :S, sometimes it will find and display the data, but other times it will not and comes up with the error
    Exception in thread "main" java.lang.NullPointerException
    at Prison.getNum(Prison.java:128)
    at TestPrison.main(TestPrison.java:101)
    Below i have put my Prison and TestPrison Class files and highlighted the lines the compiler said had the error, any help would be really appreciated because i really cant work out wats going on.
    Prison
    public class Prison
    private Prisoner [] thePrisoner;
    private Warden [] theWarden;
    private HighPrisoner [] theHighPrisoner;
    private int maxP;
    private int maxPrisoners;
    private int maxW;
    private int maxWardens;
    private int maxH;
    private int maxHighPrisoners;
    public String prisonName;
    public Prison (String prison, int maxP, int maxW, int maxH)
    prisonName = prison;
    maxPrisoners = maxP;
    maxP = 0;
    thePrisoner = new Prisoner [maxPrisoners];
    maxWardens = maxW;
    maxW = 0;
    theWarden = new Warden [maxWardens];
    maxHighPrisoners = maxH;
    maxH = 0;
    theHighPrisoner = new HighPrisoner [maxHighPrisoners];
    public boolean addPrisoner( Prisoner newPrisoner )
    if ( maxP == maxPrisoners )
    System.out.println("Prisons full");
    return false;
    else
    System.out.println("Prisoner now in Prison");
    thePrisoner[maxP] = newPrisoner;
    maxP++;
    return true;
    public boolean addHighPrisoner( HighPrisoner newHighPrisoner )
    if ( maxH == maxHighPrisoners )
    System.out.println("Prisons full");
    return false;
    else
    System.out.println("High Level Prisoner now in Prison");
    theHighPrisoner[maxH] = newHighPrisoner;
    maxH++;
    return true;
    public boolean addWarden( Warden newWarden )
    if ( maxW == maxWardens )
    System.out.println("We Have Anough Wardens");
    return false;
    else
    System.out.println("Warden now working at Prison");
    theWarden[maxW] = newWarden;
    maxW++;
    return true;
    public void outputAll()
    System.out.println("School Name: " + prisonName );
         System.out.println("");
    outputWardens();
         System.out.println("");
         outputPrisoners();
         System.out.println("");
    outputHighPrisoners();
    System.out.println("");
    public void outputWardens()
    System.out.println("The Wardens:");
    for( int i=0; i < maxW; ++i)
    System.out.println(theWarden);
    public void outputPrisoners()
    System.out.println("The Low Level Prisoners:");
    for( int i=0; i < maxP; ++i)
    System.out.println(thePrisoner[i]);
    public void outputHighPrisoners()
    System.out.println("The High Level Prisoners:");
    for( int i=0; i < maxH; ++i)
    System.out.println(theHighPrisoner[i]);
    public void getNum(String num)
    System.out.println("---------------");
    System.out.println("Search for Prisoner ID:");
    System.out.println("---------------");
    for(Prisoner nextPrisoner : thePrisoner)
         --> 128     if (nextPrisoner.getNum() == num)
              System.out.println(nextPrisoner);
    else
    System.out.println("Sorry no Prisoner ID found");
    for(HighPrisoner nextHighPrisoner : theHighPrisoner)
              if (nextHighPrisoner.getNum() == num)
              System.out.println(nextHighPrisoner);
    else
    System.out.println("Sorry No Prisoner ID found");
    System.out.println("");
    TestPrison
    import java.util.*;
    public class TestPrison
    public static void main(String []args)
         String sN;
    int sS;
         String sA;
         String tN;
    int tS;
         int input;
    String aN;
    int aS;
    String aA;
    int aL;
    String aC;
    String pN;
    String rN;
         Scanner kybd = new Scanner(System.in);
         Prison prison0 = new Prison("Alcatraz",200,200,100);
         do {
              menu();
              System.out.println("Enter Option: ");
              input = kybd.nextInt();
              switch(input) {
              case 1:
                   System.out.println("Enter Name: ");
                   tN = kybd.next();
                   System.out.println("Enter Rank: ");
                   tS = kybd.nextInt();
                   Warden wardenObject = new Warden(tN,tS);
                   prison0.addWarden(wardenObject);
                   System.out.println("\nWarden "+tN+" Added!");
                   break;
    case 2:
    System.out.println("Enter Prisoner Security Level: ");
    aL = kybd.nextInt();
    if (aL > 3)
    System.out.println("Enter Name: ");
                   aN = kybd.next();
                   System.out.println("Enter Remaining Jail Time: ");
                   aS = kybd.nextInt();
                   System.out.println("Enter Prisoner ID: ");
                   aA = kybd.next();
    System.out.println("Can Prisoner Share Cell? ");
    aC = kybd.next();
                   HighPrisoner highprisonerObject = new HighPrisoner(aN,aS,aA,aL,aC);
                   prison0.addHighPrisoner(highprisonerObject);
                   System.out.println("\nPrisoner " + aA + " Added!");
                   break;
    else
    System.out.println("Enter Name: ");
                   sN = kybd.next();
                   System.out.println("Enter Remaining Jail Time: ");
                   sS = kybd.nextInt();
                   System.out.println("Enter Prisoner ID: ");
                   sA = kybd.next();
                   Prisoner prisonerObject = new Prisoner(sN,sS,sA);
                   prison0.addPrisoner(prisonerObject);
                   System.out.println("\nPrisoner " + sA + " Added!");
                   break;
              case 3:
                   prison0.outputAll();
                   break;
              case 4:
                   prison0.outputWardens();
                   break;
              case 5:
                   prison0.outputPrisoners();
         break;
    case 6:
    prison0.outputHighPrisoners();
    break;
    case 7:
    prison0.outputPrisoners();
    prison0.outputHighPrisoners();
    break;
    case 8:
    System.out.println("Enter Prisoner ID: ");
                   pN = kybd.next();
    ---> 101 prison0.getNum(pN);
    break;
              default:
                   System.out.println("Error Selection Does Not Exist");
                   break;
         } while(input >= 0);
    public static void menu() {
         System.out.println("");
         System.out.println("MAIN MENU");
         System.out.println("*********\n");
         System.out.println("1. Add Warden\n");
    System.out.println("2. Add Prisoner\n");
         System.out.println("3. View All\n");
         System.out.println("4. View Wardens\n");
         System.out.println("5. View Low Level Prisoners\n");
    System.out.println("6. View High Level Prisoners\n");
    System.out.println("7. View All Prisoners\n");
    System.out.println("8. Search Prisoner ID\n\n");
    Once again any help would really be appreciated : )

    The nextPrisoner is null, and you can't call getNum() on a null reference.
    Try replacing that line with:if (nextPrisoner != null && nextPrisoner.getNum() == num) Oh, next time you're posting code, please use code tags:
    http://forum.java.sun.com/help.jspa?sec=formatting

  • Please help me : SUBSTR function in Oracle 6i

    Dear all people!
    I have a problem with SUBSTR as follow:
    my code:
    declare
    string1 varchar2(300);
    string2 varchar2(65);
    begin
    string1 := ....
    string2 := substr(string1,1,60);
    end;
    when i run program in debug
    at command "string2 := substr(string1,1,60);" it raise error ORA-06502;
    Please tell me how to assign substr(string1,1,60) to string2 (max length of string2 is 65);
    I'm looking to forward to receiving your response!
    Thank you very much;

    The question was simple:
    I am trying to do is bring in anything after the * in the Id column no matter how long the name is before the * but my calculation is way off L:
    Here is an example of what my data would look like but what I need it to do:
    Id                                                        NEW COLUMN
    TNET*231333                                  231333
    AMER*29283893.2                       29283893.2
    TNEY*21893838                             21893838
    Do you know how to create this calculation?
    Answer: SUBSTR(id,INSTR(id,'*',1)+1,999)
    this was emailed to me from someone on here saying "try to see if this helps" and it did that's why i said thank you.

  • Please help regarding the function module 'MESSAGE_TEXT_BUILD'

    hii i am a new employee.
    can anyone please explain wat the following code is doing
    IF sy-subrc = 0.
    l_mstring = t100-text.
    IF l_mstring CS '&1'.
    REPLACE '&1' WITH wa_messtab-msgv1 INTO l_mstring.
    REPLACE '&2' WITH wa_messtab-msgv2 INTO l_mstring.
    REPLACE '&3' WITH wa_messtab-msgv3 INTO l_mstring.
    REPLACE '&4' WITH wa_messtab-msgv4 INTO l_mstring.
    ELSE.
    REPLACE '&' WITH wa_messtab-msgv1 INTO l_mstring.
    REPLACE '&' WITH wa_messtab-msgv2 INTO l_mstring.
    REPLACE '&' WITH wa_messtab-msgv3 INTO l_mstring.
    REPLACE '&' WITH wa_messtab-msgv4 INTO l_mstring.
    ENDIF.
    CONDENSE l_mstring.
    i am supposed to use a function module for it
    i have got a function module.
    but i am not understanding wat fields shd i put in it
    the function module is
    CALL FUNCTION <b>'MESSAGE_TEXT_BUILD'</b>
    EXPORTING
    msgid =
    msgnr =
    MSGV1 = ' '
    MSGV2 = ' '
    MSGV3 = ' '
    MSGV4 = ' '
    IMPORTING
    MESSAGE_TEXT_OUTPUT =
    can anyone tell wat shd i put on msgid ,msgnr and other fields.
    [email protected]

    Hello,
    Guid for unique identification assigned list
    It think it will generate the one unique key in the program.
    DATA: con_log_guid   TYPE  guid_16.
    CALL FUNCTION 'GUID_CREATE'
      IMPORTING
        ev_guid_16 = con_log_guid.
    WRITE con_log_guid .
    Try this example it is generating a 16number id.

  • Using a tweening function as a rollover.  Please help me restore functionality!

    Ok, I have a movieclip with 3 different tweens applied to it
    by a few functions. The first tween happens on rollover and makes
    the movieclip a little bigger, the second tween happens on rollout
    and makes it smaller. The third tween happens on release and makes
    the clip much bigger. However, when the user clicks the movie clip
    it deletes all of the rollover/rollout/onrelease commands so that
    the user can interact with a swf which is loaded into the mc.
    Here's my code so far:
    //Tweens//
    function grow(who) {
    who.onEnterFrame = function() {
    if (this._xscale<40) {
    this._xscale += 5;
    this._yscale += 5;
    if (this._xscale == 40 && this._yscale == 40) {
    delete this.onEnterFrame;
    function shrink(who) {
    who.onEnterFrame = function() {
    if (this._xscale>16.5) {
    this._xscale -= 5;
    this._yscale -= 5;
    if (this._xscale == 16.5 && this._yscale == 16.5) {
    delete this.onEnterFrame;
    function growBigger(who) {
    who.onEnterFrame = function() {
    if (this._xscale<100) {
    this._xscale += 5;
    this._yscale += 5;
    if (this._xscale == 100 && this._yscale == 100) {
    delete this.onEnterFrame;
    //End Tweens//
    loadMovie("preloader.swf", "preloader_mc");
    preloader_mc._xscale = 21;
    preloader_mc._yscale = 20;
    this.onRollOver = function() {
    grow(this);
    this.onRollOut = function() {
    shrink(this);
    this.onRelease = function() {
    delete onRollOver;
    delete onRollOut;
    delete onRelease;
    _root.MkXpos = _root.touristsMark._x;
    _root.MkYpos = _root.touristsMark._y;
    _root.pan(_root.mapContainer_mc);
    growBigger(this);
    _root.mapContainer_mc.map_mc.dragger_mc._visible = false;
    _root.drag = false;
    All of this works just fine. My only problem is that when the
    user exits the loaded swf I want the button to shrink back down and
    have its functionality restored. Basically when someone clicks the
    exit button on the external swf it runs the shrink(who) function
    and shrinks everything back down. I put a line of code into the
    shrink function when it checks to see if "who" is at 16.5, which
    looked like this:
    if (this._xscale == 16.5 && this._yscale == 16.5) {
    this.onRollOver = function = () {
    grow(this);
    delete this.onEnterFrame;
    However, that didn't restore the functionality. Any help
    would be greatly appreciated! I'm a poor student on a deadline

    I'm such a moron. I never put in a trace command to see if
    the last line of my shrink command was getting executed. It turns
    out the movie doesn't scale perfectly to 16.5 but instead goes to
    16.49etcetc. As a result that last line wasn't being executed. Now
    everything works. But I was wondering if you guys could think of a
    nice way to compartmentalize all of this code, like maybe store it
    all in a variable or something, so I can attach it to several
    different movie clips?

  • PLEASE help..class function not found..

    I am writing a simple email validation and I get a TON of errors.
    1) is Class function not found. on - function validateEmail();
    2) and 11 Undefined variable or class name: document .
    The code is listed below -
    <html>
    <head>
    <meta http-equiv="Content-Language" content="en-us">
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
    <meta name="GENERATOR" content="Microsoft FrontPage 4.0">
    <meta name="ProgId" content="FrontPage.Editor.Document">
    <title>New Page 1</title>
    <%
    function validateEmail();
    if (document.forms[0].EMAIL_ADDRESS.value.length != 0)
    if ( (document.forms[0].EMAIL_ADDRESS.value.indexOf("@") == -1) ||
    (document.forms[0].EMAIL_ADDRESS.value.charAt(0) == ".") ||
    (document.forms[0].EMAIL_ADDRESS.value.charAt(0) == "@") ||
    (document.forms[0].EMAIL_ADDRESS.value.length < 6) ||
    (document.forms[0].EMAIL_ADDRESS.value.indexOf(".") == -1) ||
    (document.forms[0].EMAIL_ADDRESS.charAt(document.forms[0].EMAIL_ADDRESS.value.indexOf("@")+1) == ".") ||
    (document.forms[0].EMAIL_ADDRESS.value.charAt(document.forms[0].EMAIL_ADDRESS.value.indexOf("@")-1) == ".") ||
    (document.forms[0].EMAIL_ADDRESS.value.charAt(0) == ' ') )
    alert ("Please enter valid email address");
    document.forms[0].EMAIL_ADDRESS.focus();
    document.forms[0].EMAIL_ADDRESS.select();
    return false;
    else
    return true;
    %>
    </head>
    -- lots of input fields with the last being -
    <input type="text" name=EMAIL_ADDRESS onBlur="validateEmail();"></td>
    ????

    When I remove tags <% %> all of the function ends up in html and thus on my page.
    <html>
    <head>
    <meta http-equiv="Content-Language" content="en-us">
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
    <meta name="GENERATOR" content="Microsoft FrontPage 4.0">
    <meta name="ProgId" content="FrontPage.Editor.Document">
    <title>New Page 1</title>
    <%
    function validateEmail();
    if (document.forms[0].EMAIL_ADDRESS.value.length != 0)
    if ( (document.forms[0].EMAIL_ADDRESS.value.indexOf("@") == -1) ||
    (document.forms[0].EMAIL_ADDRESS.value.charAt(0) == ".") ||
    (document.forms[0].EMAIL_ADDRESS.value.charAt(0) == "@") ||
    (document.forms[0].EMAIL_ADDRESS.value.length < 6) ||
    (document.forms[0].EMAIL_ADDRESS.value.indexOf(".") == -1) ||
    (document.forms[0].EMAIL_ADDRESS.charAt(document.forms[0].EMAIL_ADDRESS.value.indexOf("@")+1) == ".") ||
    (document.forms[0].EMAIL_ADDRESS.value.charAt(document.forms[0].EMAIL_ADDRESS.value.indexOf("@")-1) == ".") ||
    (document.forms[0].EMAIL_ADDRESS.value.charAt(0) == ' ') )
    alert ("Please enter valid email address");
    document.forms[0].EMAIL_ADDRESS.focus();
    document.forms[0].EMAIL_ADDRESS.select();
    return false;
    else
    return true;
    %>
    </head>
    <body bgcolor="powderblue">
    <Form Name="My Form" Action=userInfoInsert.jsp Method=Post>
    <table border="0" width="100%">
    <tr>
    <td width="100%">
    <table border="0" width="100%">
    <tr>
    <td width="41%">First Name     <input type="text" name=FIRST_NAME ></td>
    <td width="59%">Last Name
    <input type="text" name=LAST_NAME ></td>
    </tr>
    </table>
    </td>
    </tr>
    <tr>
    <td width="100%">Address         
    <input type="text" name=Address ></td>
    </tr>
    <tr>
    <td width="100%">Address         
    <input type="text" name=Address ></td>
    </tr>
    <tr>
    <td width="100%">
    <table border="0" width="100%">
    <tr>
    <td width="32%">City            
       <input type="text" name=CITY size=10></td>
    <td width="18%">State
    <input type="text" name=STATE size=5></td>
    <td width="50%">Zip Code
    <input type="text" name=ZIP_CODE size=10 ></td>
    </tr>
    </table>
    </td>
    </tr>
    <tr>
    <td width="100%">Phone #         
    <input type="text" name=PHONE size="15" ></td>
    </tr>
    <tr>
    <td width="100%">SSN              
    <input type="text" name=SSN size="17" ></td>
    </tr>
    <tr>
    <td width="100%">
    <table border="0" width="100%">
    <tr>
    <td width="41%">Hint Question <input type="text" name=FIRST_NAME ></td>
    <td width="59%">Hint Answer <input type="text" name=LAST_NAME ></td>
    </tr>
    </table>
    </tr>
    <tr>
    <td width="100%">User Name     <input type="text" name=USER_NAME ></td>
    </tr>
    <tr>
    <td width="100%">Password        <input type="text" name=PASSWORD ></td>
    </tr>
    <tr>
    <td width="100%">Re-Password  <input type="text" name=RE_PASSWORD ></td>
    </tr>
    <tr>
    <td width="100%">Email Address
    <input type="text" name=EMAIL_ADDRESS onBlur="validateEmail();"></td>
    </tr>
    </table>
    <INPUT type=Submit Value=Submit>
    </form>
    </body>
    </html>

  • Please HELP iPod somewhat functional

    My 4th gen nano is having some issues. It will not load past the language selection screen. I can reset with the center and menu keys which leads me to believe that it's not the click. but once it get to the language screen none of the buttons work. Also if u plug in the headphones and shake it, it will play music and shake to shuffle. Once the screen goes to sleep or whatever shake to shuffle doesn't work. I have restored it with the latest iTunes but it is still not working.
    Can someone plz help me, it's out o warranty and I can't afford to buy another one. There must be a way to fix this. Thanks in advance for any help/suggestions.

    You have to sync  your iTunes library content to the iPod.
    See this iPod tutorial video.
    Have a nice day!

  • Please help me on recursive function call

        *   The function which build the category tree
        public String categoryTree(Statement stat, boolean isMore, int id) {
            if(!isMore) {
                return "";
            else
               String sql = " select t_category_relation.category_relation_id, t_category_relation.level_in, " +
                            " t_category_item.category_item_id, t_category_item.category_name_jpn_NV from " +
                            " t_category_item, t_category_relation " +
                            " where " +
                            " t_category_item.category_item_id = t_category_relation.category_item_id and " +
                            " t_category_relation.parent_id = " + id + " and t_category_relation.parent_id<>0";
    //           return sql;
               try{
                   ResultSet res = stat.executeQuery(sql);
                   String spacer = "";
                   String input = "";
                   while(res.next()) {
                        int level = res.getInt(2);
                         id = res.getInt(1);
                         for(int i = 0; i < level; i ++) {
                            spacer +="   ";
                         input ="+ id: " +id + " NAME  " + res.getString(4) + "\n</td>\n<td align=center>\n<input type=checkbox value=" +String.valueOf(id) + " name=categoryid>\n</td>\n</tr>\n";
                         return "\t\t<TR>\n\t\t\t<TD>" + spacer + input + categoryTree(stat, true, id);
                   if(spacer.equals("")){
                        return input+categoryTree(stat, false, id);
                }catch(SQLException e) {
                        return "SQL Exception";
                return categoryTree(stat, false, id);
        } I am writing a recusive function which can generate a tree like category tree for customer navigation purpose.I don't know why my will loop only return once which means if category "vegetable" has two child and one of child has another child but the result will only display vegetable-->child-->grand child instead of vegetable-> 2 child -> one grand child of one of the child.Please help exam the codethax in

    Didn't I already answer this?

  • Please help---merge function for two arrays.

    I am trying to create a merge function that merges two sorted arrays into a third array. I know what I am supposed to do, at least in theory, but I have been completely unsuccessful with actually getting the code to work. Since it is private, you can't directly access the arrays, you have to just reference them. could someone please help me out.
    import java.io.*;
    class OrdArray
    private long[] a;
    private int nElms;
    public OrdArray(int max)
    a = new long[max];
    nElms = 0;
    public int size()
    { return nElms;}
    public int find(long searchKey)
    int lowerBound = 0;
    int upperBound = nElms-1;
    int curIn;
    while(true)
    curIn = (lowerBound + upperBound) / 2;
    if(a[curIn]==searchKey)
    return curIn;
    else if (lowerBound > upperBound)
    return nElms;
    else
    if(a[curIn] < searchKey)
    lowerBound = curIn + 1;
    else
    upperBound = curIn - 1;
    public void insert(long value)
    int j;
    for(j=0; j<nElms; j++)
    if(a[j] > value)
    break;
    for(int k=nElms; k>j; k--)
    a[k] = a[k-1];
    a[j] = value;
    nElms++;
    public boolean delete(long value)
    int j = find(value);
    if(j==nElms)
    return false;
    else
    for(int k=j; k<nElms; k++)
    a[k] = a[k+1];
    nElms--;
    return true;
    public void display()
    for(int j=0; j<nElms; j++)
    System.out.print(a[j] + " ");
    System.out.println("");
    public void merge(OrdArray array, OrdArray array1)
    }//this is the start of the merge function. I am stuck and not real sure where to go from here.
    public long getElm(int index)
    return a[index];
    }//end class OrdArray
    class OrderedApp
    public static void main(String[]args)
    int maxSize = 100;
    OrdArray arr, arr1, arr2;
    arr = new OrdArray(maxSize);
    arr1 = new OrdArray(maxSize);
    arr2 = new OrdArray(maxSize);
    arr.insert(77);
    arr.insert(99);
    arr.insert(44);
    arr.insert(55);
    arr.insert(22);
    arr1.insert(88);
    arr1.insert(11);
    arr1.insert(00);
    arr1.insert(66);
    arr1.insert(33);
    arr2.merge(arr, arr1);
    arr.display();
    System.out.println("--------------------");
    arr1.display();
    System.out.println("--------------------");
    arr2.display();
    }

    If I use ArrayList<Long>, would I have to change private long[]a to ArrayList<long>, cause if so, I am not able to do that.
    I am supposed to add a merge() method to megre the two source arrays into an ordered destination array.
    public void merge(OrdArray array, OrdArray array1)
    mergeSize = array.nElems + array1.nElems;
    int i = 0;
    int j = 0;
    int k = 0;
    while (i = 0; i < array.nElems; i++) {
              if {array.getElm(i) < array1.getElm(j)
                                                              //how do you move to the next set of values
                                                              //and to move which variables are incremented
                                                              //how do you test if the flush loop should be      called, hint if( == )
                   while (j = mergeSize - array.nElems; j <= mergeSize; j++) { 
                                   this.a[j] = array1.a;
    //again how do you move to next value and placeholder
         //which indices are incremented
    //copy/paste and change the variables for the other value being smaller
    public long getElm(int index)
    return a[index];
    this is all I have started, but i don't really understand all the comments because I haven't used java in a long time. Like I said, I understand what needs to be done and what order to do it in, but getting the code down to do that is really rough

  • My LCD screen burned out. I have it connected to a tv now, but can't get the menu bar or the function bars to show up. Please help!

    My LCD Screen burned out, but the computer still works. I currently have it connected to an HDTV via, Mini DVI to VGA, VGA to VGA on the tv. Problem is, I can't get the function bar (maybe not the right term) or the bar at the bottom with all my programs on it. I get my screen saver and have managed to drag (by sheer luck since I can't see anything on my iMac screen) some of my pics I had on my desktop over, but nothing else. Please help!

    Hello
    you should have on your key board "mirroring key" , or F7 on old keyboard
    for now your tv is an extended screen for your imac not a miror , so you can not see menue barre on top of screen
    http://docs.info.apple.com/article.html?path=Mac/10.5/en/8525.html
    HOPE you are in 10.6
    http://docs.info.apple.com/article.html?path=Mac/10.6/en/8525.html
    "On some keyboards, you can press the F7 key, or Command-F1, as a shortcut to turn video mirroring on or off."
    HTH
    Pierre

  • My Function is not working (Please help)

    var myDialog = new Window('dialog',"MyTool");
    buildWindow();
    myDialog.show();
    function buildWindow(){
    myDialog.alignChildren = "left";
    // Properties for myReportFolder
    myDialog.preferredSize.width=300
    var myReportFolder=myDialog.add('panel',undefined,"Choose folder to save report:", {borderStyle:'raised'});
    myReportFolder.orientation="row"
    // Properties for mySelectedFolder
    // var mySelectedFolder = myReportFolder.add('group',undefined);
    // Properties for mySelectedPath
    var mySelectedPath = myReportFolder.add('edittext',undefined,"~/Report path");
    mySelectedPath.preferredSize.width = 275;
    // Properties for myBrowseFolder
    var myBrowseFolder = myReportFolder.add('button',undefined,"Choose");
    myBrowseFolder.onClick = function ()
    var myfilePath=Folder.selectDialog ("Choose a Report Folder");
    if(myfilePath != null)mySelectedPath.text=myfilePath.fsName;
    var myPanel1 = myDialog.add('statictext',undefined,"Select Document Language:");
    var theLanguages = app.languagesWithVendors.everyItem().name;
    // Properties for myPanel1.dropDownList
    var dropDownList = myDialog.add('dropdownlist',undefined,undefined,{items:theLanguages}) ;
    dropDownList.selection = 1;
    // Properties for myChoice
    var myChoice = myDialog.add('panel',undefined,"Select your option", {borderStyle:'raised'});
    myChoice.alignChildren = "left";
    // Properties for searchDoubleSpace
    // Properties for searchWrongLanguage
    var searchWrongLanguage = myChoice.add('checkbox',undefined,"Find Languages other than above selected Language");
    searchWrongLanguage.value = false;
    var searchDoubleSpace = myChoice.add('checkbox',undefined,"Find Double Spaces");
    searchDoubleSpace.value = false;
    var unusedParaStyle = myChoice.add('checkbox',undefined,"Find Unused Paragraph Styles");
    unusedParaStyle.value = false;
    var myBleed = myChoice.add('checkbox',undefined,"Check Bleed Value");
    myBleed.value = false;
    // Properties for myDialog.myPanel3
    var myPanel4= myDialog.add('panel',undefined,undefined, {borderStyle:'raised'});
    // Properties for myPanel4.closeButton
    myPanel4.orientation="row"
    myPanel4.closeButton = myPanel4.add('button',undefined,"Close",{name:'cancel'});//tan:add name cancel
    // Properties for myPanel4.goButton
    myPanel4.goButton = myPanel4.add('button',undefined,"RUN",{name:'ok'});//tan: add name ok
    myPanel4.goButton.onClick = function (){
    //Bleed
    var myDocName=app.activeDocument.name;
    var myFilePath1=mySelectedPath.text + "/" + myDocName + ".txt";
    var myTextFile = new File(myFilePath1);
    if ( myTextFile.exists )
    myTextFile.remove(myTextFile);
    flag=false;
    if (myBleed.value == true){//running succesfully
    myDoc=app.activeDocument.documentPreferences
    if ((myDoc.documentBleedTopOffset)!=9){
    write("Document TOP Bleed is not correct "+myDoc.documentBleedTopOffset);
    if ((myDoc.documentBleedBottomOffset)!=9){
    write("Document BOTTOM Bleed is not correct "+myDoc.documentBleedBottomOffset);
    if ((myDoc.documentBleedInsideOrLeftOffset)!=9){
    write("Document INSIDE/LEFT Bleed is not correct "+myDoc.documentBleedInsideOrLeftOffset);
    if ((myDoc.documentBleedOutsideOrRightOffset)!=9){
    write("Document OUTSIDE/RIGHT Bleed is not correct "+myDoc.documentBleedOutsideOrRightOffset);
    }//close if
    //Unused Paragraph style
    if (unusedParaStyle.value == true){
    var myDoc = app.activeDocument;
    var myParStyles = myDoc.paragraphStyles;
    for (j = myParStyles.length-1; j >= 2; j-- ) {
    removeUnusedParaStyle(myParStyles[j]);
    function removeUnusedParaStyle(myPaStyle) {
    app.findTextPreferences = NothingEnum.nothing;
    app.changeTextPreferences = NothingEnum.nothing;
    app.findTextPreferences.appliedParagraphStyle = myPaStyle;
    var myFoundStyles = myDoc.findText();
    if (myFoundStyles == 0) {
    write(myPaStyle.name);
    app.findTextPreferences = NothingEnum.nothing;
    app.changeTextPreferences = NothingEnum.nothing;
    }//close if
    //Search for Double Spaces
    if (searchDoubleSpace.value == true){
    app.findGrepPreferences = NothingEnum.nothing;
    app.changeGrepPreferences = NothingEnum.nothing;
    app.findGrepPreferences.findWhat = " ";
    var result = Number(app.activeDocument.findGrep().length);
    if (result>=1){
    write("Double space found in this document " + result);
    }//close if
    //Search for Wrong Language
    if (searchWrongLanguage.value == true){
    //working
    langList = [];
    for (s=0; s<app.activeDocument.stories.length; s++)
    tr = app.activeDocument.stories[s].textStyleRanges;
    for (t=0; t<tr.length; t++)
    if (!inArray (langList, tr[t].appliedLanguage.name))
    langList.push (tr[t].appliedLanguage.name);
    write ("Number of languages: "+langList.length+"\r(And they are: "+langList.join(", ")+")");
    function inArray (arr, items)
    var check;
    for (check=0; check<arr.length; check++)
    if (arr[check] == items)
    return true;
    return false;
    }//close if
    else (searchWrongLanguage.value == false){
    }//close else if
    }//close onClick function
    }//end buildWindow
    //*****Browse Report Folder and Writing file
    function write(text){
    var myDocument=app.activeDocument;
    var myFilePath1=myDocument.filePath + "/" + "myDocument_Report" + ".txt";
    var myTextFile = new File(myFilePath1);
    if ( myTextFile.exists )
    myTextFile.open("e");
    myTextFile.seek(0, 2);
    else {
    myTextFile.open("w");
    myTextFile.write(text+"\r");
    myTextFile.close()
    myTextFile.execute()
    }Hi All,
    I have created below script. But there is some problem which I am unable to find.
    My two check boxes 1) Find double Spaces and 2) Find Unused Paragraph Styles is not running in this script. When I run this script on ESTK it gives error "Cannot handle the request because a modal dialog or alert is active."
    But every function is working fine as a single script. Please check.
    Thanks in advance for your effort on this.
    Tan
    See my script code below. Its messy but working.

    Thanks for your answer.
    I have tried but couldn't succes.
    Couldn't anybody please help me to run my script successfully.
    Please help. Its urgent.
    Tan

  • I just bought an iPhone 4s. Now the search iphone function is not working. When I swipe the screen to the left, the search box appears but when I type what I want to search for, there is no action. Please help.

    I just got an iphone 4s. Now the search iphone function is not working. When I swipe the start screen, the search box shows up. But when I type what I want to search, there is no action. Please help.

    Try this...
    You will Not Lose Any Data...
    Turn the Phone Off... ( if it isn’t already )
    Press and Hold the Sleep/Wake Button and the Home Button at the Same Time...
    Wait for the Apple logo to Appear and then Disappear...
    Usually takes about 15 - 20 Seconds... (But can take Longer...)
    Release the Buttons...
    Turn the Phone On...

Maybe you are looking for