Help with getting input from the console

Hey Experts , wish you are good ? .... i have a problem and wish you figure it out for me , well tell me how can store the input values in a text file and pass the file from the command line ? , i have compiled the program so well , but i could not using text file , thats the code :
import java.util.Scanner ;
class TestScanner {
public static void main (String[] args) {
Scanner scanner = new Scanner(System.in);
System.out.print("Enter an interger : ");
int intValue = scanner.nextInt();
System.out.println(" You entered an interger " + intValue);
System.out.print("Enter a double value : ");
double doubleValue = scanner.nextDouble();
System.out.println("You entered a double value " + doubleValue);
System.out.print("Enter a string without space: ");
String string = scanner.next();
System.out.println("You entered the string " + string);
}and i created a file with value like that :
file name is input
5
23.55
Java
true
i just want to know the correct order to compile it .
thanks in advance

The Java Tutorials: [_Basic I/O_|http://java.sun.com/docs/books/tutorial/essential/io/index.html]
db

Similar Messages

  • How do i get input from the user?

    For example if i wanted to ask "Whats your favorite number" and then get the input from the user and assign it to a variable how would i go about doing that?

    hi,
    if you want to get input from your console your should work with io(input and output).The BufferedReader class, InputStreamReader class
    you should import "java.io.BufferedReader" and "java.io.InputStreamReader" package, and do something like this:
    BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
    String favoriteNumber;
    System.out.println("Whats your favorite number ");
    favoriteNumber = input.readLine();
    System.out.println ("Your favorite Number Is " + favoriteNumber);
    if its a gui you should import "javax.swing.JOptionPane" and do the following
    String favoriteNumber = JOptionPane.showInputDialog(null, "Enter your favorite Number", "Favorite Number", JOptionPane.INFORMATION_MESSAGE);
    anjiie([email protected]).

  • Help with getting values from request. Very Strange!!

    Hello,
    My very strange problem is the following.
    I have created three dynamic list boxes. When the user select
    the first list box, the second becomes populated with stuff
    from a database. The third becomes populated when the second
    is selected. Now, I have used hidden values in order for
    me to get the selected value from the first listbox. The
    following code is my first listbox:
    <SELECT NAME="resources" onChange="document.hiddenform.hiddenObject.value = this.option [this.selectedIndex].value; document.hiddenform.submit();">
    <OPTION VALUE =""> Resource</OPTION>
    <OPTION VALUE ="soil"> Soil </OPTION>
    <OPTION VALUE ="water"> Water </OPTION>
    <OPTION VALUE ="air"> Air </OPTION>
    <OPTION VALUE ="plants"> Plants </OPTION>
    <OPTION VALUE ="animals"> Animals </OPTION>
    </SELECT>
    I use the getRequest method to get the value of hiddenObject.
    At this time I am able to get the value of hiddenObject to populate
    the second list box.
    But, when the user selects an item from the second list box
    and the second form is also submitted,
    I lose the value of hiddenObject. Why is this??
    The code to populate my second listbox is the following:
    <SELECT NAME ="res_categories" onChange="document.hiddenform2.hiddenObject2.value = this.options[this.selectedIndex].value; document.hiddenform2.submit(); ">
    <OPTION VALUE ="" SELECTED> Category</OPTION>
    Here I access a result set to populate the list box.
    Please help!!

    Form parameters are request-scoped, hence the request.getParameter("hiddenObject"); call after the submission of the second form returns a null value because the hiddenObject parameter does not exist within the second request.
    A solution would be to add a hiddenObject field to your second form and alter the onChange event for res_categories to read
    document.hiddenform2.hiddenObject.value=document.1stvisibleformname.resources.option[document.1stvisibleformname.resources.selectedIndex].value;
    document.hiddenform2.hiddenObject2.value = this.options[this.selectedIndex].value;
    document.hiddenform2.submit();You will then come across a similar problem with your third drop-down if indeed you need to resubmit the form...
    A far better approach would be to create a session scoped bean, and a servlet to handle these requests. Then when the servlet is called, it would set the value of the bean property, thus making it available for this request, and all subsequent requests within the current session. This approach would eliminate the need for the clunky javascript, making your application far more stable.

  • Help with timing, input from Daq, output sound

    Hi
    I am a student member of OSA, working on a laser listener project to be used in examples for high schools students. It is a pretty old and simple experiment but something I think students would be into. {any suggestions for other experiments anyone might have I would love to hear} 
    I read a voltage from a Daq off a reciever circuit, that signal is noisey so I filter it for the human voice range, 60Hz - 2000Hz. Then that filtered signal goes to the play waveform express VI. It works but the snag is I keep getting a "beeping" in the output sound, I believe this is from the loop cycling.  I have thought of something like a master/slave loops, storing the data in an array then waiting a sec or two and playing the sound from this data so I dont have to wait on the Daq to acquire new data. Any help or suggestions are greatly apprciated.
    This is a rough version sorry about the mess. I think it should also be noted that if the "Time Duration" is larger that 0.02 then that makes the number of samples larger than what the Daq can handle.
    Thank you very much in advance for all of the help and your time.
    Jason
    Attachments:
    OSA example.vi ‏42 KB

    Hi Jason,
    I took a look at what is happening in the play waveform express VI and the issue may be related to starting/stopping the sound card every time the loop iterates, similar to what I suggested with the DAQmx VIs in my previous post. To look into the code behind an express VI, you should copy the express VI to another section of your code or to another VI completely, because once you show the block diagram for it, you will not be able to use the express VI configuration dialog anymore for that instance of the VI. Once you copy the play waveform express VI, right click on the copy and select "Open Front Panel." Then, navigate to the block diagram and keep opening the subVIs until you find the "Simple Write" VI (see below for a screenshot of this VI). Here, you will see that there is a "Sound Output configure" VI as well as a "Sound Output Clear" VI. Since these are within the while loop of your top level VI, the "beeping" in your output may be caused by the constant configuring and stopping of the sound card with these VIs. What I suggest is that you use the code in the express VI as an example to code your own sound output vi that is configured once outside the while loop and stopped once after the while loop. Hope this helps!

  • I need help with this tutorial from the Adobe website

    I'm almost done with my flash game which I created with flash pro cc. And i have been looking for tutorials to integrate my game to the Facebook and this is the only one I found. http://www.adobe.com/devnet/games/articles/getting-started-with-facebooksdk-actionscript3. html
    Am I on the right track?? The editor uses Flash Builder but I'm using Flash Pro cc.
    --- On Step 2: "Set up a development server for the Flash app",
            Sub-step #2. "To simplify the development process, configure Flash Builder to compile into your htdocs/fbdemo folder and run (or debug) the app on your server (see Figure 2)."
    1) But I can't find "ActionScript Build Path"(which is highlighted on the Figure 2 screenshot) or anything like that in Flash pro. Same for the "Output folder URL".
    Can I actually do the same things with Flash Pro cc?? Also #3 is "Verify that your app runs from your server." How do you run your app from your server??
    ---- On Step 4: "Initialize the Facebook JS SDK",
    2) so if I setup a server on a localhost just like the tutorial, I don't need to change the following? This is on line #6.
    channelUrl : 'www.YOUR_DOMAIN.COM/channel.html'
    can i just leave it like that ?
    3) So if I complete the tutorial, can facebook users play my game? or do i have more things to do?
    4) is there any other tutorial for Flash Pro CC to Facebook integration???
    Thank you so much for your help and time.

    this is an excerpt from http://www.amazon.com/Flash-Game-Development-Social-Mobile/dp/1435460200/ref=sr_1_1?ie=UTF 8&qid=1388031189&sr=8-1&keywords=gladstien
    The simplest way to hook into Facebook is to add their Plugins to add a Like button, Send button, Login button etc to your game.  If you only want to add a Like button to a page on your website, you can use the following iframe tag anywhere (between the body tags) in your html document where you want the Facebook Like button to appear:
    <iframe src="http://www.facebook.com/plugins/like.php?href=yoursite.com/subdirectory/page.html" scrolling="no" frameborder="0" style="border:none; width:500px; height:25px"></iframe> 
    Where the href attribute is equal to the absolute URL to your html file.  For example:
    <iframe src="http://www.facebook.com/plugins/like.php?href=kglad.com/Files/fb/" scrolling="no" frameborder="0" style="border:none; width:500px; height:25px"></iframe>
    points to index.html in kglad/com/Files/fb.
    However, to get the most out of Facebook you will need to use JavaScript or the Facebook ActionScript API and register your game on the Facebook Developer App page.  Before you can register your game with Facebook, you will need to be registered with Facebook and you will need to Login. 
    Once you are logged-in, you can go to https://developers.facebook.com/apps and click Create New App to register your game with Facebook.  (See Fig11-01.) 
    ***Insert Fig11-01.tif***
    [Facebook's Create New App form.]
    Enter your App Name (the name of your game) and click continue.  Complete the Security Check (see Fig11-02) and click Submit.  You should see the App Dashboard where you enter details about your game.  (See Fig11-03.)
    ***Insert Fig11-02.tif***
    [Security Check form.]
    ***Insert Fig11-03.tif***
    [App Dashboard with Basic Settings selected.]
    If you mouse over a question mark, you will see an explanation of what is required to complete this form.  Enter a Namespace, from the Category selection pick Games, and then select a sub-category. 
    Your game can integrate with Facebook several ways and they are listed above the Save Changes button. You can select more than one but for now only select Website with Facebook Login and App on Facebook, enter the fully qualified URL to your game and click Save Changes. (See Fig11-04.)
    ***Insert Fig11-04.tif***
    [Facebook integration menu expanded.]
    You can return to https://developers.facebook.com/apps any time and edit your entries.  Your game(s) will be listed on the left and you can use the Edit App button to make changes and the Create New App button to add another game.
    Click on the App Center link on the left.  (See Fig11-05a and Fig11-05b.)  Fill in everything that is not optional and upload all the required images. Again, if you mouse over the question marks you will see requirement details including exact image sizes for the icons, banners and screenshots.
    ***Insert Fig11-05a.tif***
    [Top half of the App Center form.]
    ***Insert Fig11-05b.tif***
    [Bottom half of the App Center form.]
    When you are finished click Save Changes and Submit App Detail Page.  You should then see Additional Notes and Terms. (See Fig11-06.)
    ***Insert Fig11-06.tif***
      [Additional Notes and Terms.]
    Tick the checkboxes and click Review Submission.  If everything looks acceptable, click Submit.  You should then see something like Fig11-07.
    ***Insert Fig11-07.tif***
      [After agreeing with Facebook's terms, you should be directed back to App Center and see this modal window.]
    You are now ready to integrate your game with Facebook's API.  Because there is a Facebook ActionScript API that communicates with Facebook's API, you need not work directly with the Facebook API.
    But before I cover Adobe's Facebook ActionScript API, I am going to cover how you can use the Facebook JavaScript API directly.  There no reason to actually do that while the Facebook ActionScript API still works but by the time you read this, the Facebook ActionScript API may no longer work.
    In addition, this section shows the basics needed to use any JavaScript API so it applies to any social network that has a JavaScript API including the next "hot" social network that will arise in the future.

  • A little help with getting varaibles from another class

    hey,
    so i have these two classes and they both are GUI's. the first main class is called GUI (very original) and he second is called adder. so when i click a button on GUI it creates and shows the adder GUI wich gets user input, when the user clicks the done button on the adder gui it does this this:
          * method to dispose of the gui without deleting the object
         public void close()
             addWindow.dispose();
          * method for when the done button is clicked
         private void buttonClicked()
         personName = ename.getText();
            personPin = epin.getText();
            personAddress = address.getText();
            close();
        }then we go to the GUI class and do this:
    public void addPart2()
            lm.addElement(adder.personName + "-" + adder.personID + "-" + adder.personAddress + "-" + adder.personPin );
        }(all varibless are public by the way), so when i go and have a method directly call adderPart2 right after the adder gui is closed it comes up with all variables bieng null, but if i go in and manualy call the method without doing anything else it works, can anyone explainthis and/or hellp me?

    so does anyone have a solution for this problem or at least know what is happening?
    Thanks a-bundle,
    Mike M

  • Need help with getting variable from static

    Hello,
    What I am building is an application that prompts for username/password before it shows the main screen. Once they have successfully logged in, I need to assign the username that they used, in order to use it for a button event if the make any updates.
    Here is the code that I have tried to use.
    public String username;
    ///This set's the public variable username
    public void setUserName(String UserName){
    username = UserName;
    /////////////////Here is where they login, and assign the name to setUsername
    public static void main(String args[]) throws SQLException {
    java.awt.EventQueue.invokeLater(new Runnable() {
    public void run() {
    JFrame frame = new JFrame();
    JTextField userName = new JTextField();
    JTextField passWord = new JTextField();
    Object[] options = {"OK","CANCEL"};
    Object[] msg = {"UserName:", userName, "Password:", passWord};
    final JOptionPane op = new JOptionPane(msg, JOptionPane.PLAIN_MESSAGE, JOptionPane.OK_CANCEL_OPTION){};
    JDialog dialog = op.createDialog(frame, "Please Login");
    dialog.show();
    int result = JOptionPane.OK_OPTION;
    try {
    result = ((Integer)op.getValue()).intValue();
    }catch(Exception uninitializedValue){}
    if(result == JOptionPane.OK_OPTION) {
    String userID = userName.getText();
    String passID = passWord.getText();
    Main myMain = new Main();
    myMain.setUserName(userID);
    if(!userID.equals("") && !passID.equals("")) {
    new Main().setVisible(true);
    }else {
    // user cancelled
    ////here is the button event that also will need the username
    private void selButtonActionPerformed(java.awt.event.ActionEvent evt) {
    Connection conn = null;
    Statement stmt3 = null;
    Statement stmt4 = null;
    ResultSet rset3 = null;
    ResultSet rset4 = null;
    String usernum = null;
    String xemu = null;
    String loc = null;
    String ustat = null;
    String manager = null;
    String dept = null;
    String Add = "Add";
    String Update = "Update";
    String groupID = "9999";
    Vector columnNames = new Vector();
    Vector data = new Vector();
    String Manager_info[] = {"managerindex", "managers", "managername"};
    String Account_info[] = {"acctypeindex", "acctype", "acctypedesc"};
    String Group_info[] = {"groupnum", "groups", "groupcode"};
    String System_info[] = {"systemindex", "systems", "systemname"};
    String Dept_info[] = {"departindex", "departments", "departname"};
    String Xemu_info[] = {"xemuindex", "xemulator", "xemudesc"};
    String Location_info[] = {"locindex", "location", "locdesc"};
    String Ustatus_info[] = {"ustatusindex", "userstatus", "ustatusdesc"};
    Date myDate = new Date();
    SimpleDateFormat formatter = new SimpleDateFormat("dd-MMM-yy");
    String today = formatter.format(myDate);
    System.out.println(username);
    I am trying to set the public username variable to what the person enters, however since I am creating a seperate instance of it, I don't believe it will work. Any help would be very much appreciated.
    Thanks.
    Josh

    I am developing in Netbeans. If I try to remove the static keyword from main(), netbeans canno't find a main to run. I have created the User class.
    Here is the main again to show what I have done.
    public static void main(String args[]) throws SQLException {
    java.awt.EventQueue.invokeLater(new Runnable() {
    public void run() {
    User user = new User();
    JFrame frame = new JFrame();
    JTextField userName = new JTextField();
    JTextField passWord = new JTextField();
    Object[] options = {"OK","CANCEL"};
    Object[] msg = {"UserName:", userName, "Password:", passWord};
    final JOptionPane op = new JOptionPane(msg, JOptionPane.PLAIN_MESSAGE, JOptionPane.OK_CANCEL_OPTION){};
    JDialog dialog = op.createDialog(frame, "Please Login");
    dialog.show();
    int result = JOptionPane.OK_OPTION;
    try {
    result = ((Integer)op.getValue()).intValue();
    }catch(Exception uninitializedValue){}
    if(result == JOptionPane.OK_OPTION) {
    String userID = userName.getText();
    String passID = passWord.getText();
    user.setName(userID);
    user.setPassword(passID);
    if(!userID.equals("") && !passID.equals("")) {
    //Auth.setUserName(userID);
    //Auth.setPassword(passID);
    new Main().setVisible(true);
    }else {
    // user cancelled
    This set's the variables
    Here is the beginning of the evt that I am using to try and get the data.
    private void selButtonActionPerformed(java.awt.event.ActionEvent evt) {                                         
    Connection conn = null;
    Statement stmt3 = null;
    Statement stmt4 = null;
    ResultSet rset3 = null;
    ResultSet rset4 = null;
    String usernum = null;
    String xemu = null;
    String loc = null;
    String ustat = null;
    String manager = null;
    String dept = null;
    String Add = "Add";
    String Update = "Update";
    String groupID = "9999";
    Vector columnNames = new Vector();
    Vector data = new Vector();
    User user = new User();
    String User = user.getName();
    System.out.println(User);
    String Manager_info[] = {"managerindex", "managers", "managername"};
    String Account_info[] = {"acctypeindex", "acctype", "acctypedesc"};
    String Group_info[] = {"groupnum", "groups", "groupcode"};
    String System_info[] = {"systemindex", "systems", "systemname"};
    String Dept_info[] = {"departindex", "departments", "departname"};
    String Xemu_info[] = {"xemuindex", "xemulator", "xemudesc"};
    String Location_info[] = {"locindex", "location", "locdesc"};
    String Ustatus_info[] = {"ustatusindex", "userstatus", "ustatusdesc"};
    Date myDate = new Date();
    SimpleDateFormat formatter = new SimpleDateFormat("dd-MMM-yy");
    String today = formatter.format(myDate);
    String [] str = {
    "EmpID", "Account", "System", "Type", "Status", "UserID", "Group"
    This gives me a null on the println, how can I get the data that was entered in main()?
    Thanks,
    Josh

  • Help with getting links from HTML page

    Hello all. I found the sun tutorial for getting HREF values from a tags in an HTML document at <http://java.sun.com/developer/TechTips/1999/tt0923.html>. My question now is how would a person add the ability to get the text of the link to this code?
    For example:
    Provided the HTML code:<a href="link.html">example</a>Returned is: href=link.html text=example

    I think the TechTip you've linked too is quite old (1999). I would write a simple SAXParser that uses TagSoup (http://www.ccil.org/~cowan/XML/tagsoup/) as its input source. In your handler, simply set a flag and reset a StringBuffer to collect the contents of any <a>...</a> element. Simplified:
        public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
            if ("a".equals(localName)) {
                currentHref = attributes.getValue("href");
                if (currentHref != null && currentHref.length() > 0) {
                    inLink = true;
                    //reset the string buffer
                    buffer.setLength(0);
        public void characters(char[] ch, int start, int length) throws SAXException {
            if (inLink) buf.append(ch, start, length);
        public void endElement(String uri, String localName, String qName) throws SAXException {
            if ("a".equals(localName) && inLink) {
                inLink = false;
                //add link to the stack
                links.add(new Link(currentHref, buffer.toString()));
        }Completely untested, of course... .Good luck...

  • I need help with viewing files from the external hard drive on Mac

    I own a 2010 mac pro 13' and using OS X 10.9.2(current version). The issue that I am in need of help is with my external hard drive.
    I am a photographer so It's safe and convinent to store pictures in my external hard drive.
    I have 1TB external hard drive and I've been using for about a year and never dropped it or didn't do any thing to harm the hardware.
    Today as always I connected the ext-hard drive to my mac and click on the icon.
    All of my pictures and files are gone accept one folder that has program.
    So I pulled up the external hard drive's info it says the date is still there, but somehow i can not view them in the finder.
    I really need help how to fix this issue!

    you have a notebook, there is a different forum.
    redundancy for files AND backups, and even cloud services
    so a reboot with shift key and verify? Recovery mode
    but two or more drives.
    a backup, a new data drive, a drive for recovery using Data Rescue III
    A drive can fail and usually not if, only when
    and is it bus powered or not

  • Please help : How to print a matrix from the console...

    Hi..
    Please help:
    How to print a matrix on the console , but i want to take all the input from the console.. like...
    if the matrix is of size...
    mxn
    where
    m : row
    n : column
    and the all the elements of the matrix from the console it self... .
    Please help...

    Thanks...
    I am able to print the elements of the array but i am not able to assign those values to the array ....
    How to do that...
    I just did a little change in my code...
    import java.util.Scanner;
    public class CreatingAMatrix {
        public static void main(String[] args) {
         // TODO Auto-generated method stub
         System.out.print("Enter the number of rows: ");
         Scanner scanner1 = new Scanner(System.in);
         int m = scanner1.nextInt();
         System.out.print("Enter the number of coulmns:");
         Scanner scanner2 = new Scanner(System.in);
         int n = scanner2.nextInt();
         System.out.println("The size of the matrix is : " +m+" x "+n );
         int[][] a = new int[100][100];
         for(int i=0;i<=m;i++)
             for(int j =0; j <= n; j++)
              Scanner scanner3 = new Scanner(System.in);
              int o = scanner3.nextInt();
             System.out.println();
         for(int i=0;i<=m;i++)
             for(int j =0; j <= n; j++)
              System.out.print(a[i][j] + "\t");
             System.out.println();
    }I am getting an output as this
    output:
    Enter the number of rows: 2
    Enter the number of coulmns:1
    The size of the matrix is : 2 x 1
    1
    2
    1
    2
    3
    5
    0     0     
    0     0     
    0     0     
    how should i assig those input values to my array..
    Please help

  • Getting input from textbox as "console"

    Hi all. I am learning C# and have a Windows forms project that I am working on to learn various techniques. Basically it has a text box that I use to mimic a console. The user enters a command followed by the Enter key and the program reads that in and interprets
    it. I also have some rudimentary "batch" commands, such as IF/THEN, INPUT and PRINT.
    The application has two main components: The form and a class. The form takes care of interpreting the commands that the user enters and the class implements the three batch commands (more to follow in the near future). The issue that I am having is that
    sometimes (maybe 2%) the INPUT functionality does not work. When I enter a string and press Enter an empty string is returned. I have tried to debug this as much as I can, but it is difficult since this problem only happens once in a while.
    I have extracted the INPUT functionality and duplicated it in a simple app which I present here. The test app contains one button called btnConRead and a multi line text box called txtConsole. Clicking the button "forces" the app into "run"
    mode where the batch commands are interpreted. For this example I run the code that runs when an INPUT command is being processed. The app prompts with "OK" and waits for the user to type something in. When the user presses the Enter key the entered
    string is echoed on the console. The form module contains this code:
    string sKBBuf = ""; //App wide KB buffer when form Key preview is enabled.
    bool bEnter;
    private delegate void DisplayMsgDelegate(string sMsg);
    private void cEventPrint(object sender, PrintDataEventArgs e)
    Display(txtConsole, e.sPrintLine);
    private void cEventRead(object sender, ReadDataEventArgs e)
    //Event that reads text from the console and returns it.
    //This event requires input from the user. It traps the program here until the user
    //presses Enter.
    //Clear the KB buffer.
    sKBBuf = "";
    //Loop incessantly until user presses Enter key or Stop key (s).
    do
    //Braindead.
    } while (!bEnter);
    if (bEnter)
    //User pressed the Enter key, return the KB buffer.
    e.sReadLine = sKBBuf;
    //Empty buffer.
    sKBBuf = "";
    //Reset Enter key flag.
    bEnter = false;
    //Push CRLF to console.
    Display(txtConsole, Environment.NewLine);
    private void DisplayMsg(string sMsg)
    txtConsole.AppendText(sMsg);
    private void Display(TextBox txtOutput, string sMsg, bool bToCon = true)
    //Check output to console flag.
    if (bToCon)
    if (txtOutput.InvokeRequired)
    txtOutput.Invoke(new DisplayMsgDelegate(DisplayMsg), sMsg);
    else
    txtOutput.AppendText(sMsg);
    private void GetConInput()
    clsExample cEx = new clsExample();
    cEx.ReadData += cEventRead;
    cEx.PrintData += cEventPrint;
    System.Threading.Thread runThread = new System.Threading.Thread(() =>
    cEx.Process();
    this.KeyPreview = false;
    this.KeyPreview = true;
    runThread.Start();
    private void btnReadCon_Click(object sender, EventArgs e)
    //Prep stuff
    sKBBuf = "";
    txtConsole.Focus();
    Display(txtConsole, "OK" + Environment.NewLine);
    //Read console textbox
    GetConInput();
    private void Form1_KeyPress(object sender, KeyPressEventArgs e)
    bEnter = e.KeyChar == 13;
    //Save to buffer. At this time I am not distinguishing from letter or digits.
    //But I do need to check for a BS.
    if (e.KeyChar == 8)
    //Yeah, BS, remove the last char, if any.
    if (sKBBuf.Length > 0)
    sKBBuf = sKBBuf.Substring(0, sKBBuf.Length - 1);
    else
    sKBBuf += e.KeyChar;
    The class is called clsExample and contains the following code:
    //Event raised when data needs to be printed to console.
    public event EventHandler<PrintDataEventArgs> PrintData;
    //Event raised when data needs to be read from console.
    public event EventHandler<ReadDataEventArgs> ReadData;
    protected virtual void OnReadData(ReadDataEventArgs e)
    EventHandler<ReadDataEventArgs> handler = ReadData;
    if (handler != null)
    handler(this, e);
    protected virtual void OnPrintData(PrintDataEventArgs e)
    EventHandler<PrintDataEventArgs> handler = PrintData;
    if (handler != null)
    handler(this, e);
    public void Process()
    ReadDataEventArgs argsRead = new ReadDataEventArgs();
    PrintDataEventArgs args = new PrintDataEventArgs();
    string sMsg = "";
    //Get input from user.
    OnReadData(argsRead);
    if (argsRead.sReadLine.Length > 0)
    //I have something
    sMsg = argsRead.sReadLine;
    else
    //No data
    sMsg = "*";
    args.sPrintLine = sMsg + Environment.NewLine;
    OnPrintData(args);
    Plus two more support classes for the Print and Read events:
    public class PrintDataEventArgs : EventArgs
    public string sPrintLine { get; set; }
    public class ReadDataEventArgs : EventArgs
    public string sReadLine { get; set; }
     All the above was necessary so that the Process procedure running in a different thread could interact with the UI elements in the main form. The above mostly works, but I wonder if I am doing it the right way. I don't particularly like the use of
    global flags, such as bEnter or having empty loops to just "kill" time, such as the one found in the cEventRead procedure.
    In the cEventRead procedure I had the if() block immediately following the empty loop inside
    the loop and moved it out of there to see if this made any difference, but apparently it did not. Can anyone provide any feedback or suggestions of what I could change to make it work 100% of the time? I appreciate your time and effort. Thank you, Saga
    You can't take the sky from me

    Hi all. I am learning C# and have a Windows forms project that I am working on to learn various techniques. Basically it has a text box that I use to mimic a console. The user enters a command followed by the Enter key and the program reads that in and interprets
    it. I also have some rudimentary "batch" commands, such as IF/THEN, INPUT and PRINT.
    //Loop incessantly until user presses Enter key or Stop key (s).
    do
    //Braindead.
    } while (!bEnter);
    Hi Saga,
    Please don't use such kind of loop in your code, if you want to monitor the user input, just use the KeyPress event provided by the TextBox control.
    Control.KeyPress
    Event
    If you just want to execute some standard commands, I recommend that you use
    Process to start cmd.exe to execute the command, for example:
    void ExecuteCommand(string command)
    int exitCode;
    ProcessStartInfo processInfo;
    Process process;
    processInfo = new ProcessStartInfo("cmd.exe", "/c " + command);
    processInfo.CreateNoWindow = true;
    processInfo.UseShellExecute = false;
    // *** Redirect the output ***
    processInfo.RedirectStandardError = true;
    processInfo.RedirectStandardOutput = true;
    process = Process.Start(processInfo);
    process.WaitForExit();
    // *** Read the streams ***
    string output = process.StandardOutput.ReadToEnd();
    string error = process.StandardError.ReadToEnd();
    exitCode = process.ExitCode;
    Console.WriteLine("output>>" + (String.IsNullOrEmpty(output) ? "(none)" : output));
    Console.WriteLine("error>>" + (String.IsNullOrEmpty(error) ? "(none)" : error));
    Console.WriteLine("ExitCode: " + exitCode.ToString(), "ExecuteCommand");
    process.Close();
    If it's powershell script, you can also use the existing library to execute it, check this blogpost:
    Executing PowerShell scripts from C#
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Is there another way of getting apps from the appstore without putting your credit card number in, ive heard about the itunes gift card thing can anybody just give me more info about that and how i can buy free things free things from the appstorepls help

    Is there another way of getting apps from the appstore without putting your credit card number in, ive heard about the itunes gift card thing can anybody just give me more info about that and how i can buy free things free things from the appstore...pls help as im only a teenager and have no credit credit and my parents dont trust me with theres and they dont care about the fact that you can set up a password/.... PLEASE SOMEONE HELP I WILL BE SO GRATEFUL... And i would really like to get the iphone 4 but if there is no way of etting apps without your credit number then i would have to get a samsung galaxy s3 maybe ...

    You can set up an Apple ID without a credit card.
    Create iTunes Store account without credit card - Support - Apple - http://support.apple.com/kb/ht2534

  • Hi, just updated hubby's iPhone 4 and all of his music has disappeared from the iPhone and from the iTunes library! He does have music still stored on his iPod, but can't get it from the library on his iPod back to phone or itunes. technophobe help pls!

    and all of his music has disappeared from the iPhone and from the iTunes library! Luckily he does have music still stored on his iPod, but I can't get it from the library on his iPod back to the phone or to itunes.Please help, but technophobe so put it in simple english please!

    Sounds like the music you had on your phone was not the same music on his computer. The iPhone/iPod touch is not designed to be a storage device. When you sync with a computer that doesn't have your music, it deletes your music from your phone.
    Was this music you purchased from iTunes? if so, and you are in the US, tap on itunes app, tap updates, tap purchased and tap on the cloud icon to get each song back. If you're not int he us, get iOS5 update later this week and do the same.
    But you need to move your itunes library to his computer. Create a user account on his macbook pro for you. From your external drive backup, load your itunes library on it. Then sync as usual! (Don't tell me you don't have a backup for your computer!)

  • Need Urgent Help With Getting Intl Service from Bangkok

    Before I arrived in Bangkok, I spoke with Verizon CS from the US because I needed Intl Service on my Iphone 4. My boyfriend has an Iphone 5 and was able to add a calling plan in 5 minutes of calling Verizon CS. I then called Verizon CS, and was told that my Iphone 4 cannot be used in Thailand. I told the CS Rep that my boyfriend just added the service on his Iphone 5, and did the same on a trip to Thailand last year with an Iphone 4. She told me that with an Iphone 5 he also cannot use the service in Thailand without a Sim Card or Global Phone? I then put him on the phone with her, and they spoke for ten minutes about this before my plane departed.
    I have been in Bangkok since 04MAR14 trying to reach Verizon by web, Instant Chat, phone, and even called Verizon 611 from my boyfriend's handset. he call Failed! He then gave me this number to call Verizon Global Support: 908-559-4899. I have called this number numerous times from the hotel. The recording does not recognize when I "Press 1" or "Press 2", and proceeded to hang up on me several times. Is there no human at Verizon that help me????? I have spent approx 3 hours now trying to contact Verizon since 04MAR14. I am supposed to be enjoying my vacation here. Can someone please address these questions immediately?
    1. Am I currently being charged to use WIFI in Thailand?
    2. I transited Tokyo on 03MAR, and tried to call Verizon Support from my Handset, which Failed. Am I being charged for that?
    3. What message do my contacts receive when they text me in the US?
    4. Can I activate message response to contacts in the US now telling them that I am out of the country until the evening of 11MAR14?
    Please help me, I am extremely frustrated, as I desparately want Phone service here in Thailand, and I am transiting back to Tokyo on 10MAR14, arriving there at 245pm, and I will need Phone service there as well.
    Sincerely,
    Nancy
    Private info removed as required by the Terms of Service.
    Message was edited by: Admin Moderator

        I'm so sorry you haven't been able to get any service while traveling NancyStuckInThaiWithNoService, as well as for not being able to get a hold of anyone to assist you. I'm happy to answer your questions here. As you mentioned, the iPhone 4 is not a Global phone. Therefore, you can only use on a CDMA network, (not GSM). Thailand is GSM/Global, Japan/Tokyo is CDMA; therefore, you can use phone there. (It could be settings were not set correctly to use in Tokyo.
    1. If you're using WiFi, there is no charge. Its best to turn Mobile Data off in Settings to avoid any International charges.
    2. Japan/Tokyo calls are $1.99/minute. However, if trying to reach Global Support, you will not be charged.
    3. Your contacts don't receive any notification when they text you. They may get some alert days later, that the message was not received by you/ or it has been timed out, but it won't say why.
    4. If you're able to use another phone, and call your mobile number, you can press # when you hear your voice mail greeting, enter password, then # again, to change personal greeting. You're able to update greeting with notification that you're traveling.
    ** When back in Tokyo, you can go to Settings & make sure Airplane Mode is OFF. Also, you can go to General, (from Settings),> Network> Cellular Data- ON> Data Roaming- ON.***
    Here are rates while in Japan/Tokyo http://vz.to/18TRKVE
    Lastly, it may be easier to reach us on Facebook at Verizon Wireless, or on Twitter at @VZWSupport
    Thank you,
    VanessaS_VZW
    Follow us on Twitter @VZWSupport

  • How to execute BAPIs by getting the input from the user through the browser

    Hi,
    I have created a simple xMII transaction using BAPI. It is a simple BAPI with one input. Now i want the transaction to be executed by getting the input from the user through browser. Once the user enters the value and clicks on a button, I want the result of the BAPI to be displayed in the grid. How to link the BAPI/transaction with applet/Javascript coding.
    Thanks.

    The first thing I would recommend would be for you to collaborate with your colleague Vinodh, since his/her recent thread is very similar to yours:  Calling a BAPI from web page
    In your case, the iGrid applet will run the Xacue query template and automatically display the results from your output parameter.
    I would encourage you to take a look at the sticky thread at the top of the forum entitled "MII Manufacturing Templates Updated" since this MII project is full of samples for you and your colleague to learn from.

Maybe you are looking for

  • SSo between Portal 6.0 and  Portal 7.0

    Hi, We want to enable single sign on between Portal 6.0 and  Portal 7.0. Our scenario is, In Portal 7.0 on click of  role or workset, Portal 6.0 have to be opened in a new window without asking user ID and Password. What are the steps, I need to foll

  • Help! My MacBook is running very slow

    My MacBook is running very slow all of a sudden. I ran the EtreCheck from Etresoft.com and here is the printout: Thanks for your help!!! Terrie* Hardware Information:     MacBook (13-inch, Mid 2010)     MacBook - model: MacBook7,1     1 2.4 GHz Intel

  • Default account assignment for Rate difference for sales a/c

    When we try to clear the vendor through F110 we are facing error. Document posted with SDRU currency. It is expiry currency. It need to clear through USD . Vendor contain customer in the master data. But we are unable post in System No 1 Another syst

  • Workflow and Portal Short URLs

    Hi all, I have created a custom link for a workflow that uses a portal short URL.  if I run the URL by itself, then it works fine.  When I add it to the URL link in the workflow, it doesn't show up in the workflow e-mail.  Something is confusing the

  • Can you help me use PSE9 with CS5 as an external editor?

    Hello, I much prefer the Elements Organizer to Bridge, and have a large catalog with tags that I don't want to give up.  95% of the time, I am perfectly happy with the PSE9 editor.  However, for the other 5% of the time, CS5 is the ticket (even if on