Get rid of the initial asterisk when using PasswordField masking in console

Hi!
How can I get rid of the initial astrerisk when using the PasswordField script from Sun?
I've tried to check whether the BufferedReader is empty or not, but with no succes.
Here comes the code:
PasswordField.java
import java.io.*;
public class PasswordField {
    *@param prompt The prompt to display to the user
    *@return The password as entered by the user
   public static String readPassword (String prompt) {
      EraserThread et = new EraserThread(prompt);
      Thread mask = new Thread(et);
      mask.start();
      BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
      String password = "";
      try {
         password = in.readLine();
      } catch (IOException ioe) {
        ioe.printStackTrace();
      // stop masking
      et.stopMasking();
      // return the password entered by the user
      return password;
}EraserThread
import java.io.*;
class EraserThread implements Runnable {
   private boolean stop;
    *@param The prompt displayed to the user
   public EraserThread(String prompt) {
       System.out.print(prompt);
    * Begin masking...display asterisks (*)
   public void run () {
      stop = true;
      while (stop) {
         System.out.print("\010*");
      try {
         Thread.currentThread().sleep(1);
         } catch(InterruptedException ie) {
            ie.printStackTrace();
    * Instruct the thread to stop masking
   public void stopMasking() {
      this.stop = false;
}

Hello Yajai,
The example program will use the default value for timeout, 10 seconds. To change this, you will have to set the Stream.Timeout value. I inserted this function into the example and set it equal to -1, and the program will wait indefinitely for the trigger signal without timing out. Please see the attached image to how this was implemented.
I hope this help. Let me know if you have any further questions.
Regards,
Sean C.
Attachments:
SetTimeout.bmp ‏2305 KB

Similar Messages

  • How to get rid of the "time out" when using DAQ AI in the example program

    I try an example file called "AcqVoltageSamples_IntClkDigRef" (Visual C++ .NET). It works great. However, if the program has not recieved the data, it sent out a timeout message. How to get rid of the "time out"? I cannot find anywhere in the code. Is this a property I have to reset somewhere else?
    Thank you,
    Yajai.

    Hello Yajai,
    The example program will use the default value for timeout, 10 seconds. To change this, you will have to set the Stream.Timeout value. I inserted this function into the example and set it equal to -1, and the program will wait indefinitely for the trigger signal without timing out. Please see the attached image to how this was implemented.
    I hope this help. Let me know if you have any further questions.
    Regards,
    Sean C.
    Attachments:
    SetTimeout.bmp ‏2305 KB

  • I cannot get rid of the permissions box when using flash player in firefox

    Hi
    I have explored on the web about this problem.  When attempting to use flash player in firefox, I cannot click on the allow button to allow my video camera and microphone to be used on sites.  I CAN go to Global settings and allow the sites by putting their URL, but this makes no difference, the little permissions box keeps appearing and won't go away.
    Anyone know what else to try if changing global setting permissions doesn't work?
    Barry

    This sounds like a bug.  The direction that we're heading is to have the browsers present these permission dialogs, and to eliminate them from Flash completely.  It is unlikely these native dialogs will support an "always allow" or "remember" option.
    If you're not able to click the button in the dialog when it's displayed, that's problematic.  We have a couple things in the pipeline to make the dialog bigger.  Usually those problems are resolution specific, although if there's moving video behind the dialog, that can trip our security controls.  We do a bunch of checks to ensure that the dialog you're clicking isn't obscured by something else, so that we're sure you know that you're clicking and approve button.
    There is an improvement in the pipeline to make these dialogs bigger.  They were originally designed for 640x480 screens (they've been around *that* long), and they're way too small on modern high-density displays.
    Anyway, you're welcome to file a bug at http://bugbase.adobe.com/.  Please be sure to include a link to the problem content, and the configuration you're using (OS and browser version, and screen resolution would be particularly useful -- these are often resolution-dependent issues). 

  • How do I get rid of the 3d effect when opening home screen? It gives me a headache.

    How do I get rid of the 3d effect when opening home screen? It gives me a headache.

    jimginakouri wrote:
    It's more of a "zoom-in/zoom-out" every time you turn on home screen or open/close an app.
    THAT you can't change. Silly of Apple not to provide a setting to back out the animation effects either as a whole or individually.

  • Is there a way of getting rid of the "Top Sites" when you go in to Google?

    Is there a way of getting rid of the "Top Sites" when you go in to Google?

    Safari menu > Preferences > General > "New windows open with" and "New tabs open with"
    Choose from the available selections.

  • How do I get rid of the green hue when connecting to my TV?

    how do I get rid of the green hue when connecting to my TV?

    On the TV or iMac display and is Mirroring On or Off?
    First check all of your cables, connectors and connections.
    If it's a really strong green hue, then there is probably something wrong with the cabling or a connection.
    If it is only slightly off hue, then go to: System Preferences > Displays > select the Color tab for whichever  and try selecting a different Display Profile or setting a new Profile by selecting the Calibrate.... button.
    also see > ColorSync for Mac OSX
    Dennis

  • How do get rid of the twitter app when there's no trace of it except for update notices on app store and that too with a stranger's id ??

    How do get rid of the twitter app when there's no trace of it except for update notices on app store and that too with a stranger's id ??

    ayk74,
    so you have no idea where some of your installed software originally came from?

  • Getting rid of "Warning:  JavaScript Window" when using xfa.host.response()

    When I use xfa.host.response() I get that javascript warning. Is there a way to get rid of it?
    Thanks.

    The only way I know of to get rid of this warning is to Certify the document. Once the document has been certified, any javascript interaction either through the Dialog Manager or xfa.host.response will not have the warning.
    However, The only way to certify the document is to use Document Security Server or manually through Acrobat by adding a blank signature.
    I also dont know if this will work with Dynamic forms without breaking the certification. It worked in Static / Acrobat 6 compatible PDF's.
    Any scripting or dynamic rebuild of the form will break the certification and the message comes back.
    So basically, stick with the warning for now or else you need to make sure you revalidate the signature after EVERY piece of script using the signatureValidate() method of the AcroForm Field.

  • How do you get rid of the encrypted text when forwarding an email to somebody

    When forwarding an email to others it comes up like this. Can I get rid rid of this
    Return-Path: <[email protected]>
    Received-Spf: pass (domain of insideapple.apple.com designates 17.254.6.227 as permitted sender)
    X-Ymailisg: W7LWasUWLDvp3Cg68NzuIQ0Ep5ImO4cFdWjwTQdjltqL3QAf gD3Lr..KHbkfZ_CEjNYmy.ZOOVWmbG2a9ON5_4ijshqlqQm.jegCy2LxGi1w Wa4mNROcNgpAuIfLj5DPHALQE.x5PePw4PRG4.mg_Bvr.1Zp9yJnwNkZhmbo vrzFzdamoL37v3UZU3Lb1oSt9YBWjCeJHymCV.VX_rR2FAgFu3.vxzanr3WS 3gFTlxNl8_RcTmQo.j2TenoxBQ4zJPfP1ZtYDy7CmioCjcaK0b2lGKdcW.tC FNjt2wJbJbeIEuILfBKQnby9aqeyNY9uFv3.jNm4250whlg.ctxptojQZuvo 5n9YGOiku9MPSb472G6sqvZCzLWOBuk7uvUBOLjwN0MhjkO6xAZnMSAnI4Th CKts2RZ9phG8o3AI7oTowZs6PT6pw0FeQbRtZ0jImq8p2PmCkNp5nFsDSs4M rWVZLrVaE6HanQy7VVdkaGPovL.Bi_28F4__xgXWvS41uXAAMunFO.ttp93y gQYSdXde83BRm6t9ac.O.SM_Hwfre.0jmYtyfzIRJNHUFrnAcBIuaL5XRRHo PnlBp2_b1qEIVFr667ykmrEKo8zkowsrki0mChrh82LnLt2Or02Hdb8c1IBO RD_iA1vyP9UhXlX16RtQBz461b0H7PkSSfyTzFykjmI8wuFJBrHEsVBcr2R. SOT0vNAWF7Sy0Y3ALSZGc2Qz7IU1A_upXmhFUz7J34OnshGfIdnZUgr0eX0M uRrsCZf92nQ7OrjxIfLl24wTbCuazlvZ7onnVFixo35sBRXBwukiHjDQJJXM MluCZ22xu8aDv15rLfQ3_msFWxD_E1WZaWCNAP2MsxXNV_V1QoE_F.kNZMdi jiTCnQ7FuCwcGRkg96nTeaJ_KjKwNdKrsl0KyR23AyzKdzfWN6awJeojwkwt 8lWwTBZeW9ezyfI3QJMGoGaEOCS9fcvjTshiUNEAE99Lk7qyXRlxXgXzPBDC SIhHNfos8adrrEwg0IVWGJE6NcbYgowsoDfMp1dK54ZO6A51ghQH7LV.LHzQ h1ox71sQme1NhdTUhdz7bebec._ZEnvICwS8PwHgcIIMDiTGRjN3NgLTJK8c SHNwHCpAQif4Wn1ZWk7f31aX9JnahSiEifLAEirxA8iDZF1R5IzZuMUMddXm t_kirHAfiGfGc6Pt6ZKdVZWQt6RZGh6cLCHsS4.gpQsxwnXcpQ.g43V.L2vN RFQR12bLS8aGd7IPjfTynqVBxjyijDaTK.OtBYbjIV8swj1JT0zfRL60ZXRZ jvS1j687mV_mcSVtYfnBBravEwY_79Eks5nS61xG2gVLgrgUgf0DUWhN2R5H Fne9_eIL7ZXbnlT8X121Gnu2YIBixj356ZyUNsrjWhrtdG2sUZNWQUOczdqH q0devPqLTmN3TEoXHR07Ai.oxum4ZpBuTD9xxOQoTjfDA4Qdld1vT_MusOcw jUdrEKN9P35wFrP3wB03ybHlwzwwD4OKoiEZnys9Pu.3nkoR8w--

    Do exactly what it implies on the screen.  Connect the device to the computer via the sync cable and let iTunes restore it.

  • How do I get rid of the page border when I publish a page?

    As you can see from this photo, there is a line around the page which I'd like to get rid of.  All the border strokes are set to 0 in Muse, but it's still there when I publish.  Any help would be greatly appreciated

    You have a 1 pt black stroke on your page.
    Deselect everything, and set the stroke to 0 or the stroke color to none.

  • How do i get rid of the flickering lines when I open photo booth

    It doesn't show up on my normal screen
    But every time I use my laptop camera there are these flickering coloured lines that I cant get rid of

    1. Reset SMC.     http://support.apple.com/kb/HT3964
        Choose the method for:
        "Resetting SMC on portables with a battery you should not remove on your own"
    2.Reset PRAM. http://support.apple.com/kb/PH4405
    If this does not help, take the computer to the Apple store to have it checked out.
    Best.

  • Is there a way to get rid of the space left when I delete a field?

    I have a document that I am editing and I have deleted some fields but that leaves big white spaces in the document.  Is there some way that I can get rid of those spaces without having to manually move up all the subsequent fields one by one?

    Not really. There are things you can do to make the process easier, but you can't just highlight the white space and hit 'delete' to bump everything up.
    You can select all of the items below what you removed on the heirarchy tree (that are on the same page) and move them all up at once.
    You could make the document flowed and enclose the whole area in a subform, but that presents its own set of challenges if the fields and such do not already take up entire lines (or close to it). It does make the process easier in the future if you have to add/remove more items again.

  • Can I get rid of the"allow"feature when I change sites?

    whenever I change websites a bar shows up and wants me to click on the word "allow". Can I get rid of this feature.

    yes--thank you

  • How do I get rid of the tinted layer when trying to use text?  I don't get a seperate text layer

    When I try to use text I get a tinted layer over the background layer.  I don't get a text layer like I should.  I tried resetting preferneces but that didn't work.

    That did it.  Thank you.
    Robert Rosen
    LocalEdge
    Google AdWords Certified Professional
    White Directory Publishers, a Division of Hearst Communications, Inc.
    39 Mechanic St
    Westbrook, Me 04092
    Office (207) 883-1350 Ext 12057
    Cell: (207) 232-9057
    [email protected]
    www.localedge.com

  • Get rid of the mouse cursor when on desktop touch devices

    Hi there,
    I'm using sap.ui.commons controls to build my application. However, this application will sometimes be used on touch devices like large touch screen HDTV connected to a desktop Windows PC.
    When clicking on a button, the button gets focussed. However, as clicking on a control moves the mouse cursor, too, the button gets a mouse over look and feel and the focus style applied.
    Is there a way to disable the mouse over events and style sheets for desktop controls in an easy way? I want to get a similar behaviour like using an application on a device without a pointer (like a tablet or smartphone). No mouse over, no focus.
    Regards
    Tobias

    Hey Tobias,
    have a look at this Thread: javascript - Disable hover effects on mobile browsers - Stack Overflow
    It helped me and might contain a solution to your problem as well!
    Regards,
    Timo

Maybe you are looking for

  • Error while reading ID of own business system from the SLD for system DPI

    Hi All, My sceanrio is Proxy to JDBC. and its B2B. am sending the data from BI system and based on the country field from the source, table is decided and value is updated in the table. In RWB->Component Monitoring->Adapter Engine->Test Message, I ha

  • Is there any list / report to see the material posted to COST Center

    Hi ... I have created a Purchase Order for raw material with Account category "K" cost center and prepared a goods receipts for that. As I was expecting this GR doesn't increase the stock of Plant mentioned in Purchase Order But I was expecting that

  • Wierd process chain in BI 2004s(SP 18)

    Dear Experts, The following is our process chain design. Process chain A contain process chain A1 Process chain B contain process chain B1 Process chain Z contain process chain A then B (Must serial!!) A1 and B1 have 3 object : StartinfopackageDTP (T

  • Alc-on found.... compiler error 1063

    i run the config, i set the paths...... here is what they look like--- .bashrc source /cygdrive/c/Alchemy/alchemy-setup PATH=/cygdrive/c/Alchemy/achacks:/cygdrive/c/Flex3.2.0/3.2.0/bin:$PATH export PATH alchemy-setup #!/bin/bash # This file was gener

  • IPhone will not turn on, charge or connect to a PC

    My iPhone will not turn on, I was installing the iOS update on 4% battery which i've realised is bad and now my phone won't charge, turn on or even connect to a pc, i've tried pressing the two buttons to try fix it but nothing happens the screen rema