StringBuilder replace method query

I have just joined the forum.
I am attempting to search a password and replace a character with another character.
e.g. password = "abcdlefg"
partial code is:
int startIndex = 0;
int endIndex = 0;
for (int i = 1; i <= password.length(); i++)
startIndex = password.indexOf("l", 0);
endIndex = startIndex + 1;
password.replace(startIndex, endIndex, "_");
return password;
I'm getting the following:
"Exception: java.lang.StringIndexOutOfBoundsException: String index out of range: -1"
But I don't understand why. Can anyone explain?
Regards,
Ewizard...

http://forum.java.sun.com/thread.jspa?threadID=5273487&tstart=0
Double posting butthole!
Help provided in other thread. DO NOT REPLY HERE!

Similar Messages

  • What is the replacement method for preventDefault() on iOS?

    Using preventDefault() in response to orientationChanging is a well-documented technique for preventing rotation on iOS. What is the recommended replacement method for this call when manually managing device rotation events?
    From the release notes: preventDefault() is not honored for the ORIENTATION_CHANGING event on iOS. This is a behavior change from AIR 3.4 and will remain so. (3324338)

    Auto-orientation has drastically changed in iOS 6. Some of the auto-orientation callbacks have been completely deprecated in iOS 6. This change affects the screen orientation API's in AIR too and support for the new callbacks have been added in AIR 3.5 beta release. The deprecated callbacks informed the application about the new orientation it was being rotated to. Hence, application could decide whether it wanted to rotate to the new orientation or not. However, the new callbacks do not give us such information. The application is only queried about what orientations are currently supported. If this value returned by the new callbacks matches the new orientation stage is being rotated to, the stage automatically rotates. Otherwise it does not. As a result of this limitation of the new callbacks, support from preventDefault() was deprecated on iOS in AIR 3.5(built with iOS 6 SDK). The application will still receive the ORIENTATION_CHANGING event. But calling preventDefault() inside the ORIENTATION_CHANGING event handler won't prevent the stage from being rotated to the new orientation. It is important to note that apps packaged with iOS 6 and running on iOS 5.1 devices or lower will also see this behavior change of not able to control auto orientation by using preventDefault(). This was done to make this change consistent across iOS devices.

  • Why does a find and replace method remove whitespace?

    I have method that searches for a string in a FM document and replaces it with a variable. If for example, there was a string foobar that I wanted to replace with the variable barfoo. Then, I expect this text:
    Lorem ipsum dolor sit amet, foobar consectetur adipiscing elit. Vivamus sed purus urna, ac tristique tortor. Nam auctor tellus non enim pulvinar a vestibulum neque tincidunt.
    To be changed to this text:
    Lorem ipsum dolor sit amet, barfoo consectetur adipiscing elit. Vivamus sed purus urna, ac tristique tortor. Nam auctor tellus non enim pulvinar a vestibulum neque tincidunt.
    However, while the text does do the replace it also removes the whitespace between the variable and the text that appears right after the variable so it actually looks looks like this:
    Lorem ipsum dolor sit amet, barfooconsectetur adipiscing elit. Vivamus sed purus urna, ac tristique tortor. Nam auctor tellus non enim pulvinar a vestibulum neque tincidunt.
    Why is the find and replace method removing the whitespace and how do I prevent that from happening? The method is provided below.
    function FindAndReplaceString(pDoc, findString, replaceVariable)
        if (typeof pDoc != 'undefined'&&typeof findString != 'undefined'&&typeof replaceVariable != 'undefined'&&pDoc.ObjectValid()&&findString.length>0&&replaceVariable.length>0)
            var vVarFmtStatus=checkVarFmStatus (pDoc, replaceVariable);
            if (vVarFmtStatus=='In Doc')
                var tr = new TextRange();
                var findParams = new PropVals();
                var frame = pDoc.MainFlowInDoc.FirstTextFrameInFlow;
                var restoreTR = pDoc.TextSelection;
                tr.beg.obj = tr.end.obj = frame.FirstPgf;
                tr.beg.offset = tr.end.offset = 0;
                findParams = AllocatePropVals(1);
                findParams[0].propIdent.num = Constants.FS_FindText;
                findParams[0].propVal.valType = Constants.FT_String;
                findParams[0].propVal.sval = findString;
                tr = pDoc.Find(tr.beg, findParams);
                var vLoopCounter=0;
                while(FA_errno === Constants.FE_Success&&vLoopCounter++< 1000)
                    pDoc.TextSelection = tr;
                    pDoc.Clear(0);
                    var newVar = pDoc.NewAnchoredFormattedVar(replaceVariable, tr.beg);
                    var varLength = newVar.TextRange.end.offset - newVar.TextRange.beg.offset;
                    tr.beg.offset += varLength;
                    tr = pDoc.Find(tr.beg, findParams);
                if (vLoopCounter>0)
                    Log (vLogFileName, 'In the document \''+pDoc.Name+'\', the string \''+findString+'\' was replaced with the variable \''+replaceVariable+'\' '+vLoopCounter+' times.\n')
                if (vLoopCounter>1000)
                    recordErrors (vErrorLog, 'ERROR: In the document "'+pDoc.Name+'", the find and replace operation was stopped after executing '+vLoopCounter+' times. The term being searched for is "'+findString+'" the replacement variable is "'+ replaceVariable+'".')
                pDoc.TextSelection = restoreTR;
                pDoc.ScrollToText(restoreTR);
                } else {
                    recordErrors (vErrorLog, 'ERROR: The find and replace operation failed because the variable '+replaceVariable+' does not exist in the following doc: '+pDoc.Name)
            } else {
                recordErrors (vErrorLog,'Invalid or unitialized parameter passed to function FindAndReplaceString')

    Hi,
    Not at the moment. Please post in http://forums.adobe.com/community/muse/ideas so other users can vote on the feature request.
    Thanks,
    Abhishek

  • Not able to replace new query in old workbook

    Hi All,
    I am having a workbook on a query which was developed long back,due to few changes i created new query and now i want to replace that query in old workbook which it is not allowing also tried to create new workbook with new query but when i run workbook it shows no applicable data found ,when i run query the data is coming.
    I need all your suggestion on this
    Regards
    Deva

    Hi Dev,
    Open your Workbook and Go to the Sheet in which the desired query (to be removed) is embedded.
    In the "BEx Toolbar" 3rd Last Icon if you place cursor on  it it will say "Tools" > Click on Tools and you will see an Option "Remove Query" or if you want to remove All queries from Work book there is another option Tools> All Queries in Workbook --> Detach.
    This will remove the Query from Workbook.
    Then in same Tools--> you can see Insert Query click on it and point (select) your new Query.
    This will insert the new query in Workbook.
    Save the Workbook.
    Hope this will resolve your issue.
    Do post back if you face any probs.
    Thanks
    CK

  • SQL Developer replacement for Query Builder?

    Our developers use query builder to quickly develop sql code w/conditions, joins, where clauses, etc. I just installed release 2 of SQL Developer and am trying to figure out if this is a viable replacement for query builder. Is there a graphical "query builder" component as part of SQL Developer?

    Barry, I would agree that it should be clean and easy to use. I started using Data Browser 2.0 and migrated to Query Builder 6.0.7.1.0 and while Query Builder is no longer it's own product it's integrated into Reports Developer 10g. The basic layout and operation has been consistent thru the life cycle and I would think you'd keep the "look and feel" consistent with what's currently available. (might simplify integrating it too). My biggest complaint with Query Builder 6.0.7 (se don't use the 10g version) is that it errors when opening a schema with more than 8192 objects. As an E-Business Suite 11.5.10 customer this is an issue for our developers when logging in as the standard APPS user.
    So here would be my "wish list"
    1. consistent look and feel with "older" versions of Browser/Query Builder
    2. removal of 8192 object limitation
    3. ability to open older .brw format files
    Certainly more improvements would be possible by integrating with SQL Developer and would be welcomed - this wish list is coming from a user who has MANY .brw files in the older 6.0.7 format.

  • Need replacement method for FM: REUSE_ALV_GRID_DISPLAY.

    Hi
    i need a replacement method for FM: REUSE_ALV_GRID_DISPLAY from the class CL_GUI_ALV_GRID,
    kindly let me know if someone knows the solution for it.
    regards
    mano

    Method set_table_for_first_display, look at [ALV Grid Control (BC-SRV-ALV)|http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCSRVALV/BCSRVALV.pdf]
    Regards

  • Preselection-variable (replacment-path: replacement with query)

    Hello Expert's
    Can you explain me, how we can set up a pre-query with characteristics and key figures.
    e.g.
    Due the performace reason in the olap process, we have the calculate a range of values before
    in query 1. This query contains characteristics and key figures.
    In the query 2 we've preselection-variable (replacment-path: replacement with query) to query 1.
    My question is, how we can get also the key figures-values from query 1, to continue to use the values for query 2?
    Thanks for feedbacks,
    Regards

    Hi,
    As this is the variable restriction and variable restrictions are not put on key figure values (except RKF). As I know you will not be able to get key figure values using replacemtn path with query.
    Regards,
    Durgesh.

  • Understanding Regex replace method call involving delegate

    Hello,
    I am trying to understand the $regex.replace static method call below (I came across this code snippet in the cookbook).
    $replacer = {
    param($match)
    $chars = $match.Groups[0].Value.ToCharArray()
    [Array]::Reverse($chars)
    $chars -join ''
    $regex = [Regex] "\w+"
    $regex.Replace("Hello World wide", $replacer)
    What I do not understand is the below overloaded definitions for replace method do not seem to match the above replace call. So how exactly is this working? The above call has 2 parameters passed where as none of the below overloads have less than
    3 parameters.
    PS C:\WINDOWS> [regex]::replace
    OverloadDefinitions
    static string Replace(string input, string pattern, string replacement)
    static string Replace(string input, string pattern, string replacement, System.Text.RegularExpressions.RegexOptions options)
    static string Replace(string input, string pattern, string replacement, System.Text.RegularExpressions.RegexOptions options, timespan matchTimeout)
    static string Replace(string input, string pattern, System.Text.RegularExpressions.MatchEvaluator evaluator)
    static string Replace(string input, string pattern, System.Text.RegularExpressions.MatchEvaluator evaluator, System.Text.RegularExpressions.RegexOptions options)
    static string Replace(string input, string pattern, System.Text.RegularExpressions.MatchEvaluator evaluator, System.Text.RegularExpressions.RegexOptions options, timespan
    matchTimeout)

    What you are looking at are the static methods ([regex]::) and their appropriate parameters which in this case have a minimum of 3 parameters to properly perform the Replace using the input, pattern and replacement
    value. If you were to use the constructor of [regex] to create a pattern like this:
    $Regex = [regex]'\w'
    You will see that the Replace method here allows for only 2 parameters because you have already satisfied the pattern when you created the Regex object.
    $Regex.Replace
    OverloadDefinitions
    string Replace(string input, string replacement)
    string Replace(string input, string replacement, int count)
    string Replace(string input, string replacement, int count, int startat)
    string Replace(string input, System.Text.RegularExpressions.MatchEvaluator evaluator)
    string Replace(string input, System.Text.RegularExpressions.MatchEvaluator evaluator, int count)
    string Replace(string input, System.Text.RegularExpressions.MatchEvaluator evaluator, int count, int startat)
    Boe Prox
    Blog |
    Twitter
    PoshWSUS |
    PoshPAIG | PoshChat |
    PoshEventUI
    PowerShell Deep Dives Book

  • SCCM Replace method migration for XP-to-W7 without creating computer associations?

    Hi all
    We want to use the Replace Method for our XP-W7 migration but do we have to create a computer association between the old and new machine name for every machine to be migrated (2500+)? If so, this does not appear to be practical because we don’t know what
    the new machine name will be for every old machine to be migrated until we image machines with Windows 7, which is likely to be on the same day.
    So, how can we use the Replace Method without creating computer associations please?
    Best regards
    Scott

    MDT 2012 SP1 is integrated with ConfigMgr 2012.
    We are testing a UDI solution, however, when we click “Preview” on the Refresh stage group we get the error “Unable to launch wizard in preview mode – OSDSetupWizard.exe was not found in the expected path”.  This is preventing us from
    checking that the changes we have made to the capture/restore settings will work or not. This error does not occur when we "Preview" the NewComputer stage group and we have checked OSDSetupWizard.exe does exist in \\<server>\MDT Toolkit\Tools\x64
    and \\<server>\MDT Toolkit\Tools\x86.
    1. How do we overcome this error to allow us to preview the Refresh stage group please?
    2. Do we need to specify the DEPLOYMENTTYPE variable in the customsettings.ini and if so, do we need 3 different customsettings.ini files for each scenario (DEPLOYMENTTYPE=NewComputer, DEPLOYMENTTYPE=Refresh and DEPLOYMENTTYPE=Replace)?
    Kind regards
    Scott

  • E-REC - WebDynpro Exception: Subclass of must overwrite/replace method

    Hi All,
    We are encountering an issue with an E-Recruiting web dynpro, hrrcf_a_candidate_registration, all of the sudden throwing the below error message:
    - WebDynpro Exception: Subclass of must overwrite/replace method
    Any thoughts/ideas would be helpful.
    Thanks!

    Hi Dhinesh,
    We found the following note:
    Note 1108840 - Error message when
    using browser that is not supported
    Regards,
    Nathan

  • GObject : Replace Method

    Hello. I am working with labview scripting in order to create a script that will replace all selected indicators with an indicator from a ctl file. However, I can't seem to figure out the GObject method "Replace". Attached is my current script. I was wondering if anyone could let me know what I am doing wrong or if what I am trying to do is even possible. Thanks.
    Solved!
    Go to Solution.
    Attachments:
    IndicatorReplace.png ‏17 KB

    A few tips.
    It looks like you are using the selection on the BD, therefore the objects you find will be ControlTerminals.  You need to get the corresponding Control property and call its replace method.
    To handle this, and allow for other random objects in your selection I would use To More Specific Class to cast each object to a ControlTerminal.  If there is no error, then get the Control Property and call the replace method.  If there is an error, simply do nothing.  This way if there is a wire or two in the selection you are ok.
    It also appears that you are using this from the Tools Menu, which is cool.  You can add a check of the VI.FPIsFrontmost property to detect if you are calling from the FP or BD.  If it is the FP, you can simply cast everything in the SelList[] to a Control and for the successful ones call the Replace method.

  • How to feed a query using a variable defined as Replacement Path-Query

    Scenario description : BI NetW 2004S - InfoCube with the following characteristics Customer, OrderDate, OrderYear and the following KeyFigure Number of Pieces.
    Objective: I need a query "QB" that shows how many pieces a set of customers has ordered in the year 2008. The set of customers is defined as all customers that in the previous years (the user can select one or more years) have ordered more than 500 pieces within the same year.
    Implementation: In general terms the idea is to build a query "QB" with the characteristic "Customer"  that is restricted (filtered) using a variable that is fed by another query "QA" (Replacement Path-Query).
    In order to have the selection of customers that for each of previous years (2007, 2006, 2005,...) have ordered more than 500 pieces, in the query "QA":
    - I put OrderYear as filter and defined a variable in order to ask the user which year/s he wants to analyse to define the selection
    - I put Customer and OrderYear in row
    - I put the KeyFigure Number of Pieces in column
    - I've defined the following condition: Number of Pieces > 500 with the option Caracteristic Assignment = All Characteristics in the Drilldown Indipendently
    Now if I run the query "QA" it works correctly showing me all customers that in the selected years have ordered more than 500 pieces within of the same year.
    If I run the query "QB" it shows a correct result only if I enter only one year (for example 2006) in the OrderYear field (coming from the query "QA"); if I enter more than one year (for example 2006 and 2007) the selection of customers showed is not the same defined by the first query "QB": I was expecting to see all customers defined from the first query less all customers that have no ordered any piece in 2008.
    Questions
    1) Why is query "QA" working on a different selection of customers when the user selects more than one year?
    2) Cosidering the scenario and the objective described above do you have any other idea?
    Thanks
    Ciao
    Roberto

    Hi Christophe,
         it's ok for me if I consider the customer only once in the final selection of customers that feeds the final query, this is my objective.
    However as test I've created 2 "input" queries, one related to 2006 and one related to 2007, and then in my destination query I've tried to restrict the customer using 2 variables of type replacement path-query (one attached to the 2006 query and one attached to the 2007 query). Unfortunately when I try to check and save the destination query, Query Designer tells me it is not possible to restrict the characteristic in this way.
    Could you please describe me steps you run in to order to restrict a characteristic using more than one variable of type replacement path-query?
    Thank you in advance for your answer.
    Ciao,
    Roberto

  • How do I...Conditionally control Replacement Path Query execution?

    Hello SDN:
    We are on BW 3.5 SP16.
    We are currently using a replacement path Query(RP) with variables
    to populate a variable in another Query(T).
    The problem we are having is with performance.
    The entry of variables in replacement path Query(RP) is optional (This is necessary there cannot be required values)
    When results from Replacement Path Query are small performance is fine. (e.g. 10 seconds)
    When results from Replacement path query are large performance suffers. (e.g. 1+ minutes)
    Users are free to leave the replacement path query variables empty resulting in a large set of data to be replaced. This is the worst performance case.
    We would like to discover a way to conditionally execute the replacement path query. That is, if users do not enter values for the replacement Query(RP) variables do not execute the replacement path query(RP).
    Does anyone know if this is possible within reason and in customer exit space?
    We have reviewed the situation from all angles and the requirement for the replacement path FUNCTIONALITY and the freedom for the user to leave variable values blank remains.
    I've been searching and reading SDN and SAP notes for about a week and do not find threads which address this situation.
    We are also exploring Customer variable exits to mimic replacement path functionality
    (different topic subject="How do I...Mimic Replacement Path with Query using Customer Variable Exits?")
    Any help will be appreciated
    Many thanks
    David Schuh

    Hello SDN:
    We are on BW 3.5 SP16.
    We are currently using a replacement path Query(RP) with variables
    to populate a variable in another Query(T).
    The problem we are having is with performance.
    The entry of variables in replacement path Query(RP) is optional (This is necessary there cannot be required values)
    When results from Replacement Path Query are small performance is fine. (e.g. 10 seconds)
    When results from Replacement path query are large performance suffers. (e.g. 1+ minutes)
    Users are free to leave the replacement path query variables empty resulting in a large set of data to be replaced. This is the worst performance case.
    We would like to discover a way to conditionally execute the replacement path query. That is, if users do not enter values for the replacement Query(RP) variables do not execute the replacement path query(RP).
    Does anyone know if this is possible within reason and in customer exit space?
    We have reviewed the situation from all angles and the requirement for the replacement path FUNCTIONALITY and the freedom for the user to leave variable values blank remains.
    I've been searching and reading SDN and SAP notes for about a week and do not find threads which address this situation.
    We are also exploring Customer variable exits to mimic replacement path functionality
    (different topic subject="How do I...Mimic Replacement Path with Query using Customer Variable Exits?")
    Any help will be appreciated
    Many thanks
    David Schuh

  • Fetching data using the method query

    Hi experts
    Using the class /scmtms/if_lcp and using the method query, how to fetch the data from the business objects.
    my requirement is i need to fetch the data from the BO /SCMTMS/FRIEGHTORDER and  /SCMTMS/SHIPMENTREQUEST.
    If any one can send the sample code for this, it will be very usefull for me.
    Thanks in advance
    sai
    Edited by: sai sai on Jun 17, 2009 5:21 PM

    report  z_fo_read.
    data:
      lr_fro        type ref to /scmtms/if_lcp,
      lr_lcp_transaction type ref to /scmtms/if_lcp_transaction.
    * step 1
    lr_lcp_transaction = /scmtms/cl_lcp_factory_adapter=>get_lcp_transaction_handler( ).
    * Schritt 2:
    lr_fro = lr_lcp_transaction->/scmtms/if_lcp_facade~get_lcp( in_bo_name = /scmtms/if_freightorder=>co_bo_name ).
    constants: co_do_prefix_root_tpcharges type string value 'TRANSPORTCHARGES.ROOT'.
    * Schritt 3:
    data:
      ls_params        type /scmtms/s_srq_rt_a_block value is initial,
      ls_root_data     type /scmtms/if_freightorder=>ty_root,
      ls_selection     type /scmtms/s_selection_parameter,
      lt_out_messages  type /scmtms/if_srvmgr_types=>ty_messages,
      lt_out_node_ids  type /scmtms/t_bo_node_id,
      lt_root_data     type /scmtms/if_freightorder=>tt_root,
      lt_items_data    type /scmtms/if_freightorder=>tt_transportchargesinfo,
      ls_items_data    type /scmtms/if_freightorder=>ty_transportchargesinfo,
      lt_selections    type /scmtms/t_selection_parameters,
      lv_action_name   type string,
    *     Notification structure
      ls_change_notifications type /scmtms/if_srvmgr_types=>ty_change_notifications.
    * A) Root-ID des SRQ holen, der ge-/entsperrt werden soll:
    ls_selection-attribute_name = /scmtms/if_freightorder=>co_attr-root-for_id. " ID.
    ls_selection-sign   = 'I'.
    ls_selection-option = 'EQ'.
    ls_selection-low    = '00000000000000000000000000000000800'.
    *ls_selection-high   = '00000000000000000000000000000000427'.
    append ls_selection to lt_selections.
    call method lr_fro->query
      exporting
        in_bo_node_name         = /scmtms/if_freightorder=>co_bo_node-root
        in_query_name           = /scmtms/if_freightorder=>co_query-root-root
        in_selection_parameters = lt_selections
      importing
        out_node_ids    = lt_out_node_ids
        out_messages    = lt_out_messages.
    * B) Daten holen:
    call method lr_fro->retrieve
      exporting
        in_bo_node_name        = /scmtms/if_freightorder=>co_bo_node-root
        in_node_ids            = lt_out_node_ids
      importing
        out_data               = lt_root_data
        out_messages           = lt_out_messages.
    read table lt_root_data into ls_root_data index 1.
    The above code is a snippet, extract useful information for you.

  • Beginner Java: Replace method solved

    Hi all,
    Having some issues in java, decided to take an intro to programming this semester
    I want to use the replace method to replace multiple integers with characters,
    public class ReplacementTester
    public static void main(String[] args)
    String greeting = "H3770, 371t3 hack3r!";
    // your work here
    // call the replace method four times
    System.out.println(modifiedGreeting);
    System.out.println("Expected: Hello, elite hacker!");
    I think I need to use
    String modifiedGreeting = greeting.replace("7", "l");
    in there, which works, but I don't know how to continue it to put more replacements in it. I cant seem to use the same argument again like this, it seems to ignore the second line.
    String modifiedGreeting = greeting.replace("7", "l");
    String modifiedGreeting = greeting.replace("3", "e");
    I know I gotta be missing something relatively simple,
    Any ideas?
    Last edited by proxima_centauri (2009-01-15 22:33:45)

    You keep recreating the modifiedGreeting reference, so the previous String objects stored their (edit: there) get deleted. I haven't used Java in a long time, but assuming your description of the replace method is correct, the following should work:
    public class ReplacementTester {
    public static void main(String[] args) {
    String greeting = "H3770, 371t3 hack3r!";
    String modifiedGreeting = greeting.replace("7", "l");
    modifiedGreeting = modifiedGreeting.replace("3", "e");
    System.out.println(modifiedGreeting);
    System.out.println("Expected: Hello, elite hacker!");
    or to be more concise:
    public class ReplacementTester {
    public static void main(String[] args) {
    String greeting = "H3770, 371t3 hack3r!";
    String modifiedGreeting = greeting.replace("7", "l").replace("3", "e");
    System.out.println(modifiedGreeting);
    System.out.println("Expected: Hello, elite hacker!");
    Last edited by dsr (2009-01-15 21:44:55)

Maybe you are looking for

  • How to find out the Number range object for Incident number

    How to find out the Number range object for Incident number ? CCIHT_IAL-IALID regards, lavanya

  • Set the input cursor i.e. "set cursor" in ABAP

    In ABAP Dynpro, I have the possibility to set the cursor to a specified input field using the "set cursor" command. In ABAP Web Dynpro it seems that I always have to place the cursor first using the mouse. Is there an equivalent to "set cursor" in AB

  • New FileChooser doesn't allow choosing a directory?

    Am I just missing something obvious? The new javafx.stage.FileChooser class (beta build 36) doesn't seem to allow the user to choose a directory. I.e., I can select a directory in the dialog and click the 'open' button, but it just takes me into that

  • Forcing a symbol within a symbol to play out when a button on the main timeline is clicked?

    I have a buttons that play to symbols on the timeline. Once another button is clicked on the timeline the symbol will playout then start playing the next symbol. This is the code used on the onClick event on the introduction button. var current = sym

  • Boot-Up & Sleep Issues

    Recently my G4 has been taking forever to boot-up to the Login Screen. The gray screen sits for about a minute, then the clear blue screen is up for over 5 minutes, until it finally gets to the login screen. Also, in putting the computer to sleep, it