Faking input into a console

Hello All,
I was just wondering how I'd go about faking input into a console, I want to be able to do this for test purposes.
Thanks in advance.

This is what I have got at the moment
public void inputToConsole(String input) {
          BufferedInputStream in = new BufferedInputStream(
                    new StringBufferInputStream(input));
          System.setIn(in);
     }The problem is that it continues to be read in, is there a way that I could get the input stream to end once it's been read?
Edited by: Y.S.Wheeler on Oct 19, 2008 10:41 PM

Similar Messages

  • Inputing into variables.

    I'm a C++ programmer, but my teacher wants me to program a herkle game in Java. I could easily do it in C++, and I know that the two languages are similar, but I dont know alot of the keywords, like in C++, you'd use cout <<. In java, you'd use system.out.println(". What i'm trying to get to is I need to learn how to input into variables. Like let the user assign a value to a variable or string. Thaks for any help

    Gui = Graphical User Interface; Command Line = DOS
    also, just use this file, save it as PrimitiveInput.java and compile it with the javac tool that comes with the Java Development Kit:
    import java.io.*;
    * This class provides a collection of basic methods to perform
    * primitive type console input.
    public class PrimitiveInput
    static BufferedReader in = new BufferedReader(
    new InputStreamReader(System.in));
    * read the next line from the keyboard as a String
    * @return the line as a String
    * @throws IOException
    public static String readString() throws IOException
    return in.readLine() ;
    * read the first character on the line
    * @return the first character on the line
    * @throws IOException
    public static char readCharacter() throws IOException
    String s = in.readLine();
    if (s.length() == 0)
    return '\0';
    else
    return s.charAt(0);
    * read the next line as an integer
    * @return the line as an integer
    * @throws IOException
    public static int readInteger() throws IOException
    try
    String line = in.readLine();
    int i = Integer.valueOf(line.trim()).intValue();
    return i;
    catch (Exception e)
    throw new IOException("invalid integer format");
    * read the next line as a float
    * @return the line as a float
    * @throws IOException
    public static float readFloat() throws IOException
    try
    String line = in.readLine();
    return Float.valueOf(line.trim()).floatValue();
    catch (Exception e)
    throw new IOException("invalid float format");
    * read the next line as a double
    * @return the line as a double
    * @throws IOException
    public static double readDouble() throws IOException
    try
    String line = in.readLine();
    return Double.valueOf(line.trim()).doubleValue();
    catch (Exception e)
    throw new IOException("invalid double format");
    } // End PrimitiveInput.java

  • Error logging into OIM Console as xelsysadm

    We have installed IDM11g (11.1.1.3) with WLS 10.3.3 several times successfully on RHEl5.6. This last time we ran our installation, everything "appeared" to go normally until we tried to access the OIM console as xelsysadm.
    Usually this brings us to the challenge question screen and we simply enter whatever values and move on never seeing this screen again (and not caring to).
    This time when entering the screen for the first time, after entering the values and pressing Submit... a message popped up:
    "Password successfully changed but challenge question registration failed"
    There if no other recourse than to press "OK"... we are left in the challenge question screen and have to close the brower or sign out to exit. We never attempted to change the password and have never had an issue with accessing this screen.
    Can we modify an xml to not have to enter the challenge questions? Did something not install? We found no errors in the any of the server log files indicating an issue with the user or the screen.

    Thank you for your response... we did disable the challenge questions in the OIM PTY table -- and a few other attributes -- and were able to at least get into the console. Even though we are able to access the console now, that does not fix the "password" issue. When we execute LDAPConfigPostSetup.sh, we have gotten 2 separate errors -- we received these during separate executions of LDAPConfigPostSetup.sh.
    1) Invalid Credential -- we think this is pointing at the xelsysadm account
    2) Invalid ScheduleTask Defiinition
    If we re-enable the challenge questions the issue reappears... but we are at least able to access the console. This, however, does not completely give a warm-fuzzy thinking that there is an issue we cannot find or truly resolve. Since this was a new install, Oracle's fix was to reinstall everything. That sounds easy -- and if our customer would allow it without having to jump through 2 months of hoops to get there -- but it is not.
    At this point, unless we can determine the underlying issue -- which is not a password issue but errors seem to manifest as that -- and since we at this point do not provision users within our product (our sso participants maintain their own users)... the OIM console will not be a priority. On our next install (few months) we will reinstall eveyrthing and this becomes moot.
    Thanks for your input... we still hope to determine the underlying issue, but have a "workaround" or sorts....

  • How can I have multiple inputs into the selector terminal of a case structure

    Hi everyone
    I have a question on how to wire multiple inputs in to the selector terminal of a case structure. 
    Currently, I have three switches, each switch determines different case. So if I switch the switch 1 is on, the numeric indicator will show 1. If the switch 2 is on, the numeric indicator will show 2, so on and so forth. However, the selector terminal will not allow me to wire multiply inputs into the case structure, I tried Bundle by Name, Bundle and Array to Cluster, but they did not work. I set the case structure with 3 cases, they are 1, 2 and 3.
    Could someone help me please. I have attach an image and the VI of the work I did so far.
    I have another question, is there a function which can toggle other switches to off when there is a switch has been toggled on.
    Thank you very much
    Tommy
    Attachments:
    Trial - Case Structure.vi ‏7 KB

    Tommy, attached find a cheeseball way of doing this that has given me a LOT of mileage over the years.  IT lends itself nicely to a couple of really good practices that NI recommend, but I have given you the bare-bones to "see under the hood".  
    The recommended practices:
    1. You can make this a nice tight sub-vi where you can put it into a core library of routines that you'll use over the years, even extending the logic to look only for changes, etc.
    2.  If you are thinking about Front Panel design considerations, you'll want to use arrays of controls where possible, as that's a nice neat way of containerizing your switch for both the FP and Block Diagram.
    Have fun.  I have TONS of these types of things, so feel free to PM me if you have any other needs.
    Wes
    Wes Ramm, Cyth UK
    CLD, CPLI
    Attachments:
    Boolean Switch Logic.vi ‏11 KB

  • Animations in Flash ads blocking text input into rich-text editor (IE)

    We've been able to reproduce that Flash ads, that are currently animating, block text input into rich-text areas.  Has anyone heard of this?

    I should add, they do not block all text input, just every 10th (or so) character.

  • Unable to log into Directory Console

    Hi,
    I am using Directory server 5.2.
    When I try to login to my directory console , I keep getting HttpException: Response: HTTP/1.1 500 Server Error . I tried both admin and directory manager. I am sure that my user id, password and port is correct, and the admin server is running. I notice some warnings in the admin server logs, but do not know what to make out of it.
    [11/Sep/2004:10:36:11] info ( 6194): successful server startup
    [11/Sep/2004:10:36:11] info ( 6194): SunONE-WebServer-Enterprise/6.0SP3 B05/14/2003 17:58
    [11/Sep/2004:10:36:11] warning ( 6194): admin40_check_ds_availability_init(): WARNING: Unable to determine the location of the User and Group DS (unable to set User/Group baseDN)
    [11/Sep/2004:10:36:11] failure ( 6194): Warning! admin40_task_eval_init(): unable to build User Group Info (unable to set User/Group baseDN)
    [11/Sep/2004:10:36:11] failure ( 6194): admin40_host_ip_init(): PSET failure: Failed to create PSET handle (pset error = Authentication failed)
    [11/Sep/2004:10:36:11] info ( 6196): Installing a new configuration
    [11/Sep/2004:10:36:11] info ( 6196): [LS ls1] http://ldap.mic.com, port 390 ready to accept requests
    [11/Sep/2004:10:36:11] info ( 6196): A new configuration was successfully installed
    [11/Sep/2004:10:36:12] info ( 6196): Using the Java HotSpot(TM) Server VM v1.4.1_01a from Sun Microsystems Inc.
    [11/Sep/2004:10:36:12] info ( 6196): Loading IWSSessionManager by default.
    [11/Sep/2004:10:36:12] info ( 6196): IWSSessionManager: Maximum number of sessions is 1000
    [11/Sep/2004:10:36:12] security ( 6196): for host 0.0.0.0 trying to GET /, admin40_host_ip_check reports: Unauthorized host ip=0.0.0.0, connection rejected
    [11/Sep/2004:10:36:57] security ( 6196): for host ldap. trying to GET /admin-serv/authenticate, admin40_host_ip_check reports: Unauthorized host ip=::ffff:192.168.176.12, connection rejected
    Any advice is much appreciated.
    Thanks.

    here is solution:
    Sunsolve.sun.com
    Document ID:     75322
    Resolution:     Top
    The reason you cannot log in to the console is because a password
    has expired. That password belongs to the admin-serv-<hostname>
    user.  Don't confuse this user with the normal
    admin user in LDAP.  Unfortunately, the admin-serv-<hostname>
    user is not like the Directory Manager; that is, the password for the
    admin-serv-<hostname> user will expire unless you take some
    corrective action beforehand, such as adding the user to a group with
    passwords that never expire or adding a specific password policy
    to the user.
    Every time a user (Directory Manager, Admin, and so on) logs in to the
    console, the user (admin-serv-<hostname>) needs to successfully bind
    to the directory server.  If the password has expired, that bind cannot
    happen.
    To find the user (admin-serv-<hostname>), perform the following steps.
    Step 1:  Locate the User With the Expired Password
    Search for the user (admin-serv-<hostname>) using the following
    syntax as an example:
    root/edog# ldapsearch -D "cn=Directory Manager" -w <password> -h <hostname>
    -p <port> -b o=netscaperoot "cn=admin-serv-*"
    The following provides an example of an search for the user:
       root/edog# ldapsearch -D "cn=Directory Manager" -w dirmanager -b
       o=netscaperoot cn=admin-serv-edog
       cn=admin-serv-edog, cn=Netscape Administration Server, cn=Server Group,
       cn=edog.labnet.east.sun.com, ou=labnet.east.sun.com, o=NetscapeRoot
       objectClass=top
       objectClass=netscapeServer
       objectClass=nsAdminServer
       objectClass=nsResourceRef
       objectClass=groupOfUniqueNames
       cn=admin-serv-edog
       nsServerID=admin-serv
       serverRoot=/usr/iplanet/ds5
       serverProductName=Administration Server
       serverHostName=edog.labnet.east.sun.com
       uniqueMember=cn=admin-serv-edog, cn=Netscape Administration Server,
       cn=Server Group, cn=edog.labnet.east.sun.com, ou=labnet.east.sun.com,
       o=NetscapeRoot
       installationTimeStamp=20021218212731Z
       userPassword={SSHA}kZeUzbMMbisvxMnALP3tjk3KGaNmIb8Ih29ddw==
    Step 2:  Manually Change the User's Password
    a) Use the Directory Manager to change the user password attribute in
       the following entry (returned by the command in Step 1).
       cn=admin-serv-edog, cn=Netscape Administration Server, cn=Server Group,
       cn=edog.labnet.east.sun.com, ou=labnet.east.sun.com, o=NetscapeRoot
    b) Use the ldapmodify command, as in the following example, with a new
       password, such as "abcd1234":
       ./ldapmodify -D "cn=Directory Manager" -w dirmanager -h <hostname> -p
       <port>
       dn: cn=admin-serv-edog, cn=Netscape Administration Server, cn=Server
       Group,
       cn=edog.labnet.east.sun.com, ou=labnet.east.sun.com, o=NetscapeRoot
       changetype:modify
       replace:userpassword
       userpassword: abcd1234
    Step 3: Edit the adm.conf File (<server root>/adm-serv/config)
    a) Stop the Administration Server:
       ./stop-admin
    Now, change the password in the Administration Server's
    adm.conf file so it knows to use the new password to bind
    to the directory server.
    b) Change the directory:
        cd <server root>/admin-serv/config
    c) Use the vi text editor in the adm.conf file to find a line that is
       similar to the following:
        siepid:   admin
    d) Edit the adm.conf file so the siepid value matches the new password
        that you created Step 2:
        siepid:   abcd1234
    e) Start the Administration Server and make certain that you see no
       "PSET failed" errors in the errors log.  These errors indicate that
       there was a problem loading the o=netscaperoot information.
    Now, you should have no problem logging into the console.

  • I'm trying Facetime with my Mac Mini with OS 10.7.5 and an Acer H243HX monitor (w/ HDMI, USB). I can get the webcam-in , but even with settings in Sounds set to have the input come through the Acer monitor, I still cannot get any sound input into the Mac.

    I'm trying Facetime with my Mac Mini with OS 10.7.5 and an Acer H243HX monitor (w/ HDMI, USB). I can get the webcam-in , but even with settings in Sounds set to have the input come through the Acer monitor, I still cannot get any sound input into the Mac. Any suggestions or ideas? Thanks!

    I'm trying Facetime with my Mac Mini with OS 10.7.5 and an Acer H243HX monitor (w/ HDMI, USB). I can get the webcam-in , but even with settings in Sounds set to have the input come through the Acer monitor, I still cannot get any sound input into the Mac. Any suggestions or ideas? Thanks!

  • Triggering input into a MIO-16XE-50 using a DIO-96

    Hi there,
    I was wondering if anyone knows how to trigger input into an MIO16XE50 using a DIO-96 card. I want to send out a digital pulse to a BNC-2090 that is connected to both the MIO16XE50 and the DIO96 using the DIO96 card. After this digital pulse, I want to collect data before the trigger and after. I am using NIDAQ Tools for Igor Pro to acquire data from the MIO16XE50 and I am using MatLab to send the trigger pulse from the DIO96. Should I use the external trigger option in NIDAQ Tools, or is there a better way to do it? Thanks a lot!
    Arul Thangavel

    Arul;
    The best way to go about that is to set a digital trigger analog input acquisition, and have the trigger channel to be PFI0. Then, you need to make the digital trigger pulse to be wired to the PFI0 pin of your DAQ device connector.
    You can also configure your Software to acquire some points before the trigger. It will acquire data after the trigger by default. The parameter you need to set to acquire data before the trigger is "pre-trigger number of points".
    Hope this helps.
    Filipe A.
    Applications Engineer
    National Instruments

  • Making a jframe that i can put input into....

    hey guys i was wondering if i could have a very easy beginer code sample ofr making a small jframe that i can put input into....and can we display our own home written code on the forums i checks the conduct thingy but it didnt say...tyvm for the help
    System.out.println("JAVA FOR LIFE!!!");

    [http://java.sun.com/docs/books/tutorial/uiswing/index.html]

  • Turn mic input into another speaker output on G60-235DX?

    On other computers I have had, I could turn the mic input into a second headphone/speaker jack but I do not know how to do it with this laptop and I'm new to Vista as well. On page 5 of the Notebook Tour User Guide located here it says "This table describes factory settings. For information about changing factory settings, refer to the user guides located in Help and Support." but I just do not know what "Help and Support" it is referring to exactly. When I am on the G60-235DX page and I click a link in the "Support for this product" box in the lower right, I can never seem to chase down any info on this subject. I have periodically done a search and then given up and now I realize I am just not going to be able to do it without bothering someone else for the answer. Thanks for any help!

    See my answer to the other thread you opened. When you do that, you have a double conversion (first D/A, then A/D - though I don't know what actually happens when you use a capturing software like AudioHijack), you might create a hum etc.

  • IPhone 4 feeds handfrees Mic input into your Headphones

    Hello. I have got my iPhone 4 and i have been using it with the Apple in-ear headphones with mic. But i have noticed that my iphone feed the mic input into the headphones as well. Which i didn't notice from my previous generation iPhone, i wonder if anyone experienced the same problem. Is it me or everyone's ?
    Angus

    you are not alone. also noticed this strange issue which wasn't there on my original iphone.
    really hope it's not a hardware issue

  • Keyboard will not input into search bar on IOS5 Iphone 4

    I have been using iOS 5 for a few days and an hour ago or so the keyboard stopped inputting text into maps, search bars, etc. It still inputs into the body of emails though. I tried restarting and resetting the phone which did not fix the issue. Anyone else having this problem?

    I have exactly the same problem with my iPodTouch 4th gen and my wifes iPhone 3GS. When you login to icloud on the settings page it says the password is incorrect then the device locks up. It's fine on my iPad and both our Mac laptops.
    iCloud fail so far 8(...

  • Can pages input into microsoft dot format document?

    trying to input into a template created in Microsoft word with dot extension

    To clarify:
    Pages Exports to .doc/x files, it does not save to Word templates because it does not use Word files as native files.
    If you want the .dot file to be a .dot file you will need to resave a .doc/x file in Word as a template.
    Peter

  • Pipe input into systemctl edit

    Howdy all,
    Trying to automate some setup - overriding systemd services;
    ~$ cat <<-'EOF' | sudo systemctl edit sabnzbd
    [Service]
    Group=media
    EOF
    Received SIGHUP or SIGTERM
    Buffer written to /etc/systemd/system/sabnzbd.service.d/.override.confe61282feb5338872.save
    editor failed with error code 1.
    Edition of /etc/systemd/system/sabnzbd.service.d/override.conf canceled: temporary file empty
    ~$ cat /etc/systemd/system/sabnzbd.service.d/.override.confe61282feb5338872.save
    [Service] Group=media
    any tips for piping input into systemctl edit ?

    advantage of using systemctl is I can do this for multiple services at the same time, and have it create the correct directories
    EDITOR=nano
    echo -e "[Service]\nGroup=media" | nano -
    nano <(echo -e "[Service]\nGroup=media")
    works
    sudo systemctl edit sabnzbd <(echo -e "[Service]\nGroup=media")
    doesn't
    https://github.com/systemd/systemd/blob … tl.c#L5761
    Last edited by bond (2015-04-08 01:22:33)

  • Stuck at gdm how do i drop back into the console?

    okay first off i'm ashamed to get stuck at this spot after spending a long time figuring out how to install/configure anything. long story short i got my system core installed, installed fluxbox, and then installed gdm. unfortunately now gdm loads and wont let me back into the console(even if i try the command ctrl+alt+backspace). why is that bad? because i forgot to add a normal user and gdm wont allow me to login with root.
    my question: how do i drop back to the console?

    If you are satisfied, you should change the topic to "[SOLVED] stuck at gdm how do i drop back into the console?" so the rest of us know you are happy :-)

Maybe you are looking for

  • HELP my imported SWF

    I have created an animation of a superman like character flying with the animation being his cape flapping, his eye moving occasionally, and he moves up and down slightly to imitate the movement of flight. I exported that animation as a SWF movie. I

  • Making a Directory Structure with JTree.

    Hello, Can anyone boss here help me to code to make a File System Directory structure through JTree? The outlook should be like the Windows Explorer... From : [email protected]

  • Creating a delta graph

    hello, we are trying to create a graph that will show the changes from month to month, along the year. example: the data in the cube: Jan - 12, Feb - 20. the graph will show: Feb - 8. Our best solution so far was to create a new cube that will save t

  • Automatic lot creation on fixed frequency

    Hi All, Please suggest a way to do automatic lot creation for a particular material on a defined frequency. Can I use audit inspection to generate inspection lots automatically. I will be having an inspection plan assigned to this material. Scenario

  • How long will iPod hold Charge

    Let's try this question: How long should a 2nd Gen iPod hold a charge if it's fully charged and hasn't been removed from the dock?