Any input methods to get strings or integers?

I'm looking for an imput method to get a string or an integer from the command line. If anyone would help me and give me a command to do this, it would be much appreciated. Also, to include source would be nice too.

import java.io.*;
public class TrivialApplication {
     public static void main(String args[]) throws IOException {
          BufferedReader readInput = new BufferedReader(new InputStreamReader(System.in));
          int numbernames;
String numnames;
          int i, j;
          String temp;
          int sortby;
          int clearbuff;
          System.out.println( "Input the number of names that you'd like." );
numnames = readInput.readLine();
numbernames = Integer.parseInt(numnames);
          String names[] = new String [numbernames];
          String ages[] = new String [numbernames];
          for (i = 0; i < numbernames; i++)
               System.out.println( "What's the name?");
               names[i] = readInput.readLine();
               System.out.println( "What's the age?");
ages[i] = readInput.readLine();
          System.out.println( "Do you want to sort by name or age(1 for name, 2 for age)");
          do
               sortby = System.in.read() - 48;
          while (sortby != 1 && sortby != 2);
     if (sortby == 1)
          for (i = 0; i < numbernames; i++)
               for (j = 0; j < numbernames - 1; j++)
                    if (names[j].compareTo(names[j+1]) > 0)
                         temp = names[j];
                         names[j] = names[j+1];
                         names[j+1] = temp;
                         temp = ages[j];
                         ages[j] = ages[j+1];
                         ages[j+1] = temp;
     if (sortby == 2)
          for (i = 0; i < numbernames; i++)
               for (j = 0; j < numbernames - 1; j++)
                    if (ages[j].compareTo(ages[j+1]) > 0)
                         temp = names[j];
                         names[j] = names[j+1];
                         names[j+1] = temp;
                         temp = ages[j];
                         ages[j] = ages[j+1];
                         ages[j+1] = temp;
     System.out.println( "Here they are again for you" );
     System.out.println( "---------------------------" );
     for (i = 0; i < numbernames; i++)
          System.out.println (i + ".) " + names[i] + "\t" + ages);

Similar Messages

  • Do we have any native methods to get object instances which are alive ?

    Do we have any native methods to get object instances which are alive ?
    Help appreciated.

    If you are looking for accessing objects that are eligible for GC but are not GC,than it should be very difficult.As Java does not give you memory access to its variables.

  • Is there any native method for converting String value to Hungarian notat..

    Hello. there.
    This might be very simple question. but I'm just curious about this.
    I am wondering if Java API offer the any native method for converting uppercased string value to lowercase which obey the Hungarian notation.
    What I'm going to do is using Reflection for excuting RFC function on SAP. I was found it is very similar to JDBC Programming.
    Please refer to blow codes.
    //mTable
    JCoTable mTable = function.getTableParameterList().getTable(rtnTblNm);
        for (int i = 0; i < mTable.getNumRows(); i++) {
         mTable.setRow(i);
         HashMap tmpData = new HashMap ();
              for (int j=0; j < mTable.getNumColumns(); j++) {
                     // I want to set key String [userNo] instead of  [USER_NO] here.
              tmpData.put(mTable.getMetaData().getName(j).toLowerCase(), mTable.getString(j));
              result.add(tmpData);
    } Basically, The idea was from ibatis framework [com.ibatis.common.beans.classInfo] dropcase();
    Any idea would be very helpful for me. Thank you.
    Edited by: hosung.seo on Aug 30, 2009 10:42 PM
    Edited by: hosung.seo on Aug 30, 2009 10:50 PM

    ejp wrote:
    Hungarian notation is a representation of logical/arithmetic expressions in postfix form. Not what you're talking about.
    So your title is very confusing to the people here who know what it means, which is probably all of them, because people read threads based on their title.From now on, I will pay more attention when I post an question.
    If the titile as " +Is there any native method for converting String value to camelcase?"+ would be easier to what i'm pointing at.
    As I mentioned in above sorce code, converting [USER_NO] to [userNo] isn't relevant Hungarian notation. yes, it was ambiguous. Agree! :)
    But some answer wasn't fit to converting case or recognizing "underscore" delimiter. I was expecting toCamelCase() such as blew. Thanks.
        public static String toCamelCase(String name) {
            String lowerName = name.toLowerCase();
            String[] pieces = lowerName.split("_");
            if (pieces.length == 1) {
                return lowerName;
            StringBuffer result = new StringBuffer(pieces[0]);
            for (int i = 1; i < pieces.length; i++) {
                result.append(Character.toUpperCase(pieces.charAt(0)));
    result.append(pieces[i].substring(1));
    return result.toString();

  • RE: (forte-users) Any inputs on PutFormulas(...) method ofCrystal Repor

    Hi Jagadish,
    The OLE error code of 0x80020003 translates to "Member not found." This may
    indicate that the parameter is not properly defined as a Parameter field in
    the Crystal Report you're using.
    Additionally, the date format you're using is wrong. Crystal requires that
    you pass a date as "Date(yyyy, mm, dd)." Your example, then, should read:
    l_tdParam : TextData = New();
    l_tdParam.SetValue('Date(2000, 03, 15)');
    l_CrystalRepObj.PutParameterFields(0, l_tdParam.Value);
    I hope this helps.
    -Katie
    Katie Tierney
    Akili Systems Group
    601 Jefferson, Suite 3975
    Houston, Texas 77002
    Office: (713) 655-1400
    Cell: (409) 255-1643
    "The bitterness of poor quality remains long after the sweetness of low
    price is forgotten" --Larry Anderson
    -----Original Message-----
    From: Jagadish_Kumarnacre.com [mailto:Jagadish_Kumarnacre.com]
    Sent: Wednesday, March 15, 2000 9:11 PM
    To: Katie Tierney; kamranaminyahoo.com
    Subject: RE: (forte-users) Any inputs on PutFormulas(...) method of
    Crystal Report's ActiveX object
    Hi Katie,
    I am thankful for your time and effort.
    I have a problem here. I did exactly the way you have suggested, but I get
    this
    exception.
    SYSTEM ERROR: Error during Invoke; status code: -2147352573(0x80020003)
    Class: OLEException with ReasonCode: OLE_ER_RESOURCE
    Last TOOL statement: method DebugState.RaiseException
    The parameter I want to set is a date type. This is the only parameter in
    the
    report.
    First trial:
    l_tdParam : TextData = New();
    l_tdParam.SetValue('03/15/2000');
    l_CrystalRepObj.PutParameterFields(0, l_tdParam.Value);
    Second Trail:
    l_dtdParam : DateTimeData = New();
    l_dtdParam.SetCurrent(DR_DAY);
    l_CrystalRepObj.PutParameterFields(0, l_dtdParam.TextValue.Value);
    Do you think I am going wrong somewhere here. Please suggest.
    Once again, I am thankful for your time and effort.
    Regards,
    Jagadish K Kumar
    May I suggest:
    1. Talk to Forte Consulting and get ReportKit. It's inexpensive, and the
    Forte Consultant can help you get it set up quickly. It's a great product.
    2. The following code has worked for me in the past (I have no way of
    testing it now, but think it should still work):
    // ptd_Parameter_Array is an ARRAY of TextData containing the
    // VALUES to be placed in the parameter fields.
    // Since Crystal Reports uses a zero-based array numbering
    // scheme, we need to set up a counter and set its initial
    // value to 0.
    li_Counter : integer = 0;
    for eachParam in ptd_Parameter_Array do
    self.PutParameterFields(index = li_counter, param2 =
    eachParam.Value);
    li_Counter = li_counter + 1;
    end for;
    The VariantVoidResult is NIL by default, and you shouldn't need to worry
    about it at all. It's the result that the Crystal OCX sends back to Forte.
    The Index starts at 0, and continues to the number of parameters - 1.
    The Param2 value is the string that contains the actual parameter value.
    For example, if I have defined a Crystal parameter called "Country," then I
    would send "USA" as the string value for param2.
    I hope this helps (and I STRONGLY suggest ReportKit).
    Regards,
    -Katie
    Katie Tierney
    Akili Systems Group
    601 Jefferson, Suite 3975
    Houston, Texas 77002
    Office: (713) 655-1400
    Cell: (409) 255-1643
    "The bitterness of poor quality remains long after the sweetness of low
    price is forgotten" --Larry Anderson
    -----Original Message-----
    From: Jagadish_Kumarnacre.com [mailto:Jagadish_Kumarnacre.com]
    Sent: Wednesday, March 15, 2000 9:43 AM
    To: kamranaminyahoo.com
    Subject: (forte-users) Any inputs on PutFormulas(...) method of Crystal
    Report's ActiveX object
    Hi,
    Could someone give me inputs on how to use PutFormulas(index: i2, param2:
    string, _VariantVoidResult = NIL) method of Crystal ActiveX object.
    I want to use this method to modify Crystal Report formulas. I would like to
    know
    1. index parameter - what is the domain, or expected values to this
    parameter
    2. param2 parameter - How to formulate this?; a sample template please;
    3. _VariantVoidResult parameter - what is the significance of this
    parameter?
    A working example will help me a lot.
    Thanks in advance.
    Jagadish K Kumar

    Hi Katie,
    I am thankful for your time and effort.
    I have a problem here. I did exactly the way you have suggested, but I get this
    exception.
    SYSTEM ERROR: Error during Invoke; status code: -2147352573(0x80020003)
    Class: OLEException with ReasonCode: OLE_ER_RESOURCE
    Last TOOL statement: method DebugState.RaiseException
    The parameter I want to set is a date type. This is the only parameter in the
    report.
    First trial:
    l_tdParam : TextData = New();
    l_tdParam.SetValue('03/15/2000');
    l_CrystalRepObj.PutParameterFields(0, l_tdParam.Value);
    Second Trail:
    l_dtdParam : DateTimeData = New();
    l_dtdParam.SetCurrent(DR_DAY);
    l_CrystalRepObj.PutParameterFields(0, l_dtdParam.TextValue.Value);
    Do you think I am going wrong somewhere here. Please suggest.
    Once again, I am thankful for your time and effort.
    Regards,
    Jagadish K Kumar
    May I suggest:
    1. Talk to Forte Consulting and get ReportKit. It's inexpensive, and the
    Forte Consultant can help you get it set up quickly. It's a great product.
    2. The following code has worked for me in the past (I have no way of
    testing it now, but think it should still work):
    // ptd_Parameter_Array is an ARRAY of TextData containing the
    // VALUES to be placed in the parameter fields.
    // Since Crystal Reports uses a zero-based array numbering
    // scheme, we need to set up a counter and set its initial
    // value to 0.
    li_Counter : integer = 0;
    for eachParam in ptd_Parameter_Array do
    self.PutParameterFields(index = li_counter, param2 =
    eachParam.Value);
    li_Counter = li_counter + 1;
    end for;
    The VariantVoidResult is NIL by default, and you shouldn't need to worry
    about it at all. It's the result that the Crystal OCX sends back to Forte.
    The Index starts at 0, and continues to the number of parameters - 1.
    The Param2 value is the string that contains the actual parameter value.
    For example, if I have defined a Crystal parameter called "Country," then I
    would send "USA" as the string value for param2.
    I hope this helps (and I STRONGLY suggest ReportKit).
    Regards,
    -Katie
    Katie Tierney
    Akili Systems Group
    601 Jefferson, Suite 3975
    Houston, Texas 77002
    Office: (713) 655-1400
    Cell: (409) 255-1643
    "The bitterness of poor quality remains long after the sweetness of low
    price is forgotten" --Larry Anderson
    -----Original Message-----
    From: Jagadish_Kumarnacre.com [mailto:Jagadish_Kumarnacre.com]
    Sent: Wednesday, March 15, 2000 9:43 AM
    To: kamranaminyahoo.com
    Subject: (forte-users) Any inputs on PutFormulas(...) method of Crystal
    Report's ActiveX object
    Hi,
    Could someone give me inputs on how to use PutFormulas(index: i2, param2:
    string, _VariantVoidResult = NIL) method of Crystal ActiveX object.
    I want to use this method to modify Crystal Report formulas. I would like to
    know
    1. index parameter - what is the domain, or expected values to this
    parameter
    2. param2 parameter - How to formulate this?; a sample template please;
    3. _VariantVoidResult parameter - what is the significance of this
    parameter?
    A working example will help me a lot.
    Thanks in advance.
    Jagadish K Kumar

  • How to get String out of  void method

    I have a problem to get String out of void method. I override method actionPerformed(), and I need to use String from this method in other methods. I get nothing in smth. Can anyone help me with this.
    class
    StringBuffer smth = new StringBuffer();
    StringBuffer s;
          public void actionPerformed(ActionEvent event){
              String vnos;
              if(event.getSource() == btn_vnos){
                   input = field.getText();
                   s = new StringBuffer(input);
                    smth = s;
                }             Thanks

    You have needs to use a static variable or somehow pass an instance reference, through a list or array or some such thing, perhaps through the constructor. Or think up some other jazz, like adding a method "public String getMyStinkin'String" ;~)
    ~Cheers

  • Why do I get "Select Input Method" dialog when trying to open tabs on some sites?

    This is what I'm experiencing with Firefox mobile on an Android tablet.
    On some sites, when I click a button which should open a new tab, I get the "Select Input Method" dialog box. First, I don't know why this dialog is popping up. Second, it is an empty dialog; there is nothing to select, only a heading that says "Select Input Method". When I touch the heading, I get another "Select Input Method" dialog, this time with "Android Keyboard" as the sole item to be selected. It is already selected. Touching it or backing up to dismiss it leaves me on the page I started on. Touching the original button which should open a new tab simply repeats the entire dialog sequence. Backing up from the original, empty dialog, does the same thing.
    Once or twice, by magic or something, I was able to get the page to open the new tab. But I cannot confirm what sequence of selecting or backing up out of the dialogs may have led to the correct behavior.
    Any help would be appreciated.

    kbrosnan,
    Thanks for the reply. Sorry it took so long to get back to you.
    My wife is working on a project so I'm a little light on details. Apparently she figured out that her Javascript is calling ShowModalDialog and this was what was causing the Select Input Method dialog to open. I don't fully understand the details but she's looking for a different way to do this. I believe she said she subsequently found out that the Firefiox mobile browser doesn't support ShowModalDialog.
    She's new to mobile web development (and I know nothing about it) so she's kind of feeling her way. If you have a good resource for how the FF Android mobile browser differs from the normal desktop browser, that wouldbe a big help, I think. Otherwise, thanks for you reply and she'll keep plugging away discovering what she needs to change in her program to make it work for mobile.
    Thanks.

  • In iCal - I keep getting the error message " This calendar was created by Mail" and it will not accept any input; why..??

    In iCal - I keep getting the error message “ This calendar was created by Mail” and it will not accept any input; why..??

    use Disk Utility and Verify Permisions then fix and Verify Disk and fix, this should fix it.

  • Is there any other method so that I can contact Apple to get IMEI number ? since the phone was shyncronized several times in apple store / iCloud.

    Hello community members, my iPhone has been stolen and I tried to contact police, they are asking for IMEI number of the phone. Unfortunately I could not read the IMEI number on the box due to moisture wiped out most of the number on it. I sacanned it in and enhanced, I'm still unable to read out the number. Is there any other method so that I can contact Apple to get IMEI number ? since the phone was shyncronized several times in apple store / iCloud.

    If you backed up your iPhone in iTunes on your computer -
    Open iTunes - Edit - Preferences - Devices - See Device Backups in the Window.
    Hover mouse/curser on any backup. Read IMEI and Serial no. your of iPhone.

  • Method to Get the INPUT parameter CONTENT byte length

    method to get the INPUT parameter CONTENT byte length

    Dear "clown of forums",
    Please read the forum rules and ask understandable questions -> one thread per properly formulated question after having searched.
    Thread locked.

  • Strange problem. I have upgraded to OSX 10.9.1 but cant get wifi to work so forced to be hard wired. Any inputs appreciated.

    Hi All,
    Strange problem. I have upgraded to OSX 10.9.1 but cant get wifi to work so forced to be hard wired. Any inputs appreciated. Problem is I cant even reinstall it as I saw on a thread reason, it needs wifi to begin.

    It only needs an internet connection - wired or wireless.
    Fixing a Mavericks Installation Problem
    How to manage a failed OS X Mavericks installation | MacFixIt - CNET Reviews.
    Try these in order:
    1. a. Resetting your Mac's PRAM and NVRAM
        b. Intel-based Macs: Resetting the System Management Controller (SMC)
    2. Restart the computer in Safe Mode, then restart again, normally. If this doesn't help, then:
         Boot to the Recovery HD: Restart the computer and after the chime press and hold down the
         COMMAND and R keys until the Utilities menu screen appears. Alternatively, restart the computer and
         after the chime press and hold down the OPTION key until the boot manager screen appears.
         Select the Recovery HD and click on the downward pointing arrow button.
    3. Repair the Hard Drive and Permissions: Upon startup select Disk Utility from the Utilities menu. Repair the Hard Drive and Permissions as follows.
    When the recovery menu appears select Disk Utility. After DU loads select your hard drive entry (mfgr.'s ID and drive size) from the the left side list.  In the DU status area you will see an entry for the S.M.A.R.T. status of the hard drive.  If it does not say "Verified" then the hard drive is failing or failed. (SMART status is not reported on external Firewire or USB drives.) If the drive is "Verified" then select your OS X volume from the list on the left (sub-entry below the drive entry,) click on the First Aid tab, then click on the Repair Disk button. If DU reports any errors that have been fixed, then re-run Repair Disk until no errors are reported. If no errors are reported click on the Repair Permissions button. Wait until the operation completes, then quit DU and return to the main menu. Select Restart from the Apple menu.
    4. Reinstall Lion/Mountain Lion, Mavericks: Reboot from the Recovery HD. Select Reinstall Lion/Mountain Lion, Mavericks from the Utilities menu, and click on the Continue button.
    Note: You will need an active Internet connection. I suggest using Ethernet if possible because it is three times faster than wireless.

  • JNI: Getting String | StringBuffer  to Java from C using input argument

    I've written a native method in C which takes command String from Java, executes the command, and obtains both an integer return_code and a C-string result_string as an output. The return_code goes back to Java from the return statement at the end of the native method...my problem is, that I would like to pass into the native method either a String or StringBuffer, and use that to relay the result_string back to the Java code, as well. Eg., loosely, if I have a
    JNIEXPORT jint JNICALL ExecuteCmd
    (JNIEnv *env, jclass jcls, jstring cmdString, jobject returnBuffer)
    where jobject returnBuffer is a StringBuffer created as StringBuffer(2048), I'd like to take return_string once I have it and do something like
    returnBuffer = env->NewStringUTF(result_string);
    (I know the syntax env->NewStringUTF is a bit different to what's in the JNI book, but it's what works on the HP-UX system I'm using.)
    I know already that this particular bit of code doesn't work. My question is, does the general idea have any potential to work, or am I trying to do something that's impossible?

    Your general approach works just fine. What you have to do is use JNI to find the appropriate method for the StringBuffer class, and invoke it.

  • Why string has an extra blank when I use EJB business method to get it

    I have the following code:
    Person bean = home.create("Jon", 10, "Huge", 1.0);
    java.util.Enumeration result = home.findAll();
    if (result.hasMoreElements()) {
    Person bean1 =(Person) javax.rmi.PortableRemoteObject.narrow(result.nextElement(), Person.class);
    getTraceWriter().println(" ** name = " + bean1.getName() + ", rank = " + bean1.getRank() +
    ", power = " + bean1.getPower() + ", rating = " + bean1.getRating());
    bean1.remove();
    I found the bean1.getName is "Jon " instead of "Jon". why???? Does sb. have a clue?
    Thanks,
    JST

    Here is the code. Thanks very much!
    import javax.ejb.*;
    import java.sql.*;
    import javax.sql.DataSource;
    import java.util.Vector;
    import java.util.Enumeration;
    import javax.naming.Context;
    public class PersonBean implements EntityBean {
    public String name;
    public int rank;
    public String power;
    public double rating;
    public EntityContext context;
    private DataSource ds = null;
    private String user = "db2admin";
    private String password = "db2admin";
    * ejbCreate method
    * @param name String The person name
    * @exception javax.ejb.CreateException
    public PersonKey ejbCreate(String name)
    throws CreateException {
    return ejbCreate(name, 0, "default", 0.0);
    * ejbCreate method
    * @param name String The person name
    * @param rank int The person rank
    * @param power String The person power
    * @param rating double Rating of the person
    * @exception javax.ejb.CreateException
    public PersonKey ejbCreate(String name, int rank, String power, double rating)
    throws CreateException {
    if (name == null || name.length() == 0) {
    throw new CreateException("Invalid parameter: name cannot be null");
    else if (power == null || power.length() == 0) {
    throw new CreateException("Invalid parameter: power cannot be null");
    this.name = name;
    this.rank = rank;
    this.power = power;
    this.rating = rating;
    Connection con = null;
    PreparedStatement ps = null;
    try {
    System.err.println("before getconnection");
    con = this.getConnection();
    System.err.println("after getconnection");
    ps = con.prepareStatement("insert into TESTMEN values (?,?,?,?)");
    ps.setString(1, name);
    ps.setInt(2, rank);
    ps.setString(3, power);
    ps.setDouble(4, rating);
    if (ps.executeUpdate() != 1) {
    throw new CreateException("Failed to add (" + name + "," + rank + "," +
    power + "," + rating + ") to database.");
    PersonKey pk = new PersonKey(name);
    return pk;
    catch (javax.naming.NamingException ne) {
    throw new EJBException (ne);
    catch (SQLException sqle) {
    throw new EJBException(sqle);
    finally {
    try {
    if (ps != null) ps.close();
    if (con != null) con.close();
    catch (SQLException sqle) {
    sqle.printStackTrace();
    public void ejbPostCreate(String name, int rank, String power, double rating) {
    // empty for now
    public void ejbPostCreate(String name) {
    // empty for now
    * ejbFindPrimaryKey
    * Find bean by primary key
    * @return PersonKey Primary key object for the bean
    * @exception FinderException
    * @exception ObjectNotFoundException
    public PersonKey ejbFindByPrimaryKey(PersonKey key)
    throws FinderException, ObjectNotFoundException {
    Connection con = null;
    PreparedStatement ps = null;
    ResultSet rs = null;
    boolean found = false;
    boolean multipleFound = false;
    try {
    con = this.getConnection();
    ps = con.prepareStatement("select name from TESTMEN where name = ?");
    ps.setString(1, key.name);
    rs = ps.executeQuery();
    found = rs.next();
    if (found) {
    multipleFound = rs.next();
    if (!multipleFound) {
    return key;
    else {
    throw new FinderException("Multiple objects found with name = " + name);
    else {
    throw new ObjectNotFoundException("Cannot find object with name = " + name);
    catch (javax.naming.NamingException ne) {
    throw new EJBException (ne);
    catch (SQLException sqle) {
    throw new EJBException(sqle);
    finally {
    try {
    if (rs != null) rs.close();
    if (ps != null) ps.close();
    if (con != null) con.close();
    catch (SQLException sqle) {
    sqle.printStackTrace();
    * setEntityContext method
    public void setEntityContext(EntityContext context) {
    this.context = context;
    * unsetEntityContext method
    public void unsetEntityContext() {
    context = null;
    * ejbFindAll method
    * Find all the beans.
    * @return java.util.Enumeration Enumeration of all beans
    public Enumeration ejbFindAll(){
    Connection con = null;
    Statement stmt = null;
    ResultSet rs = null;
    try {
    con = this.getConnection();
    stmt = con.createStatement();
    rs = stmt.executeQuery("select * from TESTMEN");
    Vector keys = new Vector();
    while (rs.next()) {
    keys.addElement(new PersonKey(rs.getString("name")));
    return keys.elements();
    catch (javax.naming.NamingException ne) {
    throw new EJBException (ne);
    catch (SQLException sqle) {
    throw new EJBException(sqle);
    finally {
    try {
    if (rs != null) rs.close();
    if (stmt != null) stmt.close();
    if (con != null) con.close();
    catch (SQLException sqle) {
    sqle.printStackTrace();
    * ejbActivate() method
    public void ejbActivate() {}
    * ejbPassivate method
    public void ejbPassivate() {}
    * ejbLoad method
    public void ejbLoad() {
    PersonKey pk = (PersonKey) context.getPrimaryKey();
    Connection con = null;
    PreparedStatement ps = null;
    ResultSet rs = null;
    try {
    con = this.getConnection();
    ps = con.prepareStatement("select * from TESTMEN where name = ?");
    ps.setString(1, pk.name);
    rs = ps.executeQuery();
    if (rs.next()) {
    name = pk.name;
    rank = rs.getInt("rank");
    power = rs.getString("power");
    rating = rs.getDouble("rating");
    else {
    throw new EJBException("No record found in ejbLoad()");
    catch (javax.naming.NamingException ne) {
    throw new EJBException (ne);
    catch (SQLException sqle) {
    throw new EJBException(sqle);
    finally {
    try {
    if (rs != null) rs.close();
    if (ps != null) ps.close();
    if (con != null) con.close();
    catch (SQLException sqle) {
    sqle.printStackTrace();
    * ejbStore method
    public void ejbStore() {
    Connection con = null;
    PreparedStatement ps = null;
    try {
    con = this.getConnection();
    ps = con.prepareStatement("update TESTMEN set " +
    "name = ?, rank = ?, power =?, rating = ? where name = ?");
    ps.setString(1, name);
    ps.setInt(2, rank);
    ps.setString(3, power);
    ps.setDouble(4, rating);
    ps.setString(5, name);
    if (ps.executeUpdate() != 1) {
    throw new EJBException("Failed in updating database in ejbSotre().");
    catch (javax.naming.NamingException ne) {
    throw new EJBException (ne);
    catch (SQLException sqle) {
    throw new EJBException(sqle);
    finally {
    try {
    if (ps != null) ps.close();
    if (con != null) con.close();
    catch (SQLException sqle) {
    sqle.printStackTrace();
    * ejbRemove method
    public void ejbRemove() {
    Connection con = null;
    PreparedStatement ps = null;
    try {
    con = this.getConnection();
    ps = con.prepareStatement("delete from TESTMEN where name = ?");
    ps.setString(1, name);
    if (ps.executeUpdate() != 1) {
    throw new EJBException("cannot remove by name = " + name);
    catch (javax.naming.NamingException ne) {
    throw new EJBException (ne);
    catch (SQLException sqle) {
    throw new EJBException(sqle);
    finally {
    try {
    if (ps != null) ps.close();
    if (con != null) con.close();
    catch (SQLException sqle) {
    sqle.printStackTrace();

  • LSMW Direct input method error

    Hi experts,
       I created the LSMW using direct input method (PR Creation).
       In the create batch input session step (executed) i am getting below
    message and follwed bt processing terminated message and going out
      Transaction 0: transaction code / not supported
    what could be the problem ? any problem in specifying logical path .
    pls let me know the solution.
    Thanks
    sai

    Hi chenna,
       Thanks for reply, I added the tcode and now getting the message like the session was created
    but when i see in sm35 there is no  seesion created and there is no log also.
    what could be the reason? pls explain
    thanks
    sai

  • How to STOP OS X from automatically changing between language input methods

    I want to know if there is a way in OS X Leopard to stop the system from automatically changing the language input method. I use English and Japanese on my computer, but this would apply to anyone using more than one input method.
    For example, when I click on a Japanese-language file, the system automatically changes input to Kotoeri (the Japanese-language input method). When I then click on an English-language file it usually, but not always, changes back to English input. But I almost never want to TYPE in Japanese. I just need to be able to read Japanese and to cut and paste from Japanese language files. It is very annoying when I start typing in an English-language file and find the input method has been changed to kotoeri without me realizing it—everything comes out in meaningless Japanese. When I want to type in Japanese, I want to manually change to the Japanese input system. That is, I want English to always be the default input method even if I am manipulating Japanese-language files.
    So, I’m wondering if there’s a way to set the computer so that it never AUTOMATICALLY switches between the input methods. I want to be able to switch only manually. In the old days of System 7, 8, and 9, there was a third-party control panel you could get that would do this (I think it was called Stay There!) and I don't remember this being a problem in Tiger or earlier versions of OS X. Is anyone aware of any way to do this in Leopard?
    Thank you!
    Colin

    Well, I do have it set that way, and I can look up there to see where I am, but in the work I do time is critical and I move back and forth between the two languages frequently. It is really a pain and a waste of time to have to look and make a change that should be unnecessary. The problem is not so much that I don't know where I am. It's that I don't want to ever have to think I MIGHT be in anything but English input unless I specifically want to be. In other words, I need to be able to forget about this problem even being a possibility.
    Message was edited by: Colin Talcroft

  • How can I reinstall the Chinese input method on Lion

    If I can not reinstall it, then how should I rest the input method, clear all learning phrases and all these stuff.
    Any ideas? I tried to rm all the files in ~/Library/Dictionaries/, but it did work for me, when I launch the input method, it still has the previous input phrases and frequency suggestiongs. I really want to get rid of that, I need a brand fresh unused input method.

    Hey Tom,
    I did what it is said in Yale website, but it does not work, I even removed all the dictionaries in ROOT directory=,=
    I will go to google groups for further info.
    Thanks anyway.
    But, I mean, these dictionaries or whatever it is which stores the user's previous inputs must be somewhere in the **** disk, I will find out.

Maybe you are looking for

  • Firefox 4 crashes on Mac OS X 10.6.6 every time when I run any bangla site

    Generally I downloaded fonts from [http://ekushey.org/?page/osx_fonts here] here. It worked fine with previous version of firefox. But in FF4 is crashing frequently. Please give solution

  • SOAP Response change from http 200 to http 204

    Hello I must change for a application, that call a webservice on the pi, change the SOAP Response from HTTP 200 OK to HTTP 204. I think that must chnage on the SOAP Adapter and wei can't change in the messages or mapping. Also wit a Fault Messages is

  • Problem in istalling 11g express edition

    I have successfully istaled oracle 11g express edition.When I pressing start database an error is displaying "windows cannot find 'http://127.0.0.1:%HTTPPORT%apex/f?p==4950'.Make sure you typed the name correctly and try again'". And there is no opti

  • Trace a mapped_file in kernel dump back to a user/process

    I am troubleshooting a paged pool consumption issue (MmSt and other tags related to ntfs.sys being top consumers) on a Windows2003 R2 SP2. I see from a kernel dump taken when server was unresponsive, using !memusage, around 80000 files listed as mapp

  • Photos distort when creating an iMovie in iDVD

    Hey People.... Really need your help ASAP. The creation process goes flawlessly in iMovie & iDVD, BUT, the pictures distort slightly (but very noticeable) halfway into the beginning of the entering transition and remains that way thru the duration of