Insertion point

Hello, I'm studying for the certification exam, and I got this question:
Given a properly prepared String array containing five elements, which range of results could a proper invocation of Arrays.binarysearch() produce?
A. 0 through 4
B. 0 through 5
C. - 1 through 4
D. -1 through 5
E. - 5 through 4
F. -5 through 5
G. -6 through 4
H. - 6 through 5
They say the correct answer is 'G' but for me is 'E', because if the maximum number to insert an element is at position 4 then the insertion point would be at -5, so the range would be -5 through 4. Am I wrong?
Thank you.

Elsymenab wrote:
They say the correct answer is 'G' but for me is 'E', because if the maximum number to insert an element is at position 4 then the insertion point would be at -5, so the range would be -5 through 4. Am I wrong?
...Yes, you are wrong.
String[] array = {"A","B","C","D","E"};
System.out.println(Arrays.binarySearch(array, "F")); // prints -6
System.out.println(Arrays.binarySearch(array, "E")); // prints  4

Similar Messages

  • [CS3] [JS] add XML  Element to Insertion Points

    hi list,
    i'll do some text parsing in indesign cs3 intended to add some xml elements to my document.
    i just wonder why i can't markup an insertion point. is the following approach correct? The code works fine, only the return value (stored in the _xml variable) is not the new element but the parent element. The same code works without using the insertion point (marking up the text object [xmlElements.add(_dokument.xmlTags.item("index") , erg[0]))] ).
    Any ideas or thoughts?
    var _dokument = app.activeDocument;
    main ();
    // ** main ()
    function main() {
    //Set the find options.
    app.findGrepPreferences = NothingEnum.nothing;
    app.changeGrepPreferences= NothingEnum.nothing;
    //find any string encloased by @
    app.findGrepPreferences.findWhat = "@.*?@";
    erg = _dokument.findGrep();
    while (erg.length > 0) {
    _xml = _dokument.xmlElements[0].xmlElements.item("text").xmlElements.add(_dokument.xmlTags.item( "index") , erg[0].insertionPoints[0]);
    erg[0].contents = "";
    erg = _dokument.findGrep();

    hi dave,
    gui testing is always a good idea :-) but in this case the behaviour is different:
    your observation is correct (anyway at least a strange behaviour compared to any xml editing tool i know == how adobe intended to insert an empty element?), tagging in the gui a tagged insertion point tags the whole story.
    in the script a new element is added but the return value is the parent element (the xmlElement of the whole story).
    this causes a problem when i add an attribute (the intention of the above script is to add references) which is added to the parent element.
    gregor

  • [AS] How to make cross reference at insertion point

    Hi,
    I have a book ("indb") including several documents with several "anchors"
    (german translation: "Textanker") where cross references from different documents are linked to.
    What I already got is to reference all anchors and collect them in a list.
    Now I would like to make a new cross reference at the insertion point
    in a text frame of the active document - can't get it to run :-(
    Is anybody out there who can post a AS-sample doing this?
    Thanks in advance!
    Here is the reference to an already existing anchor:
    {hyperlink text destination id 44155 of document "kapitel 2.indd" of application "Adobe InDesign CS4"}
    The code I tried to make a new cross reference looks like this - but of course doesn't work:
    tell application "Adobe InDesign CS4"
    tell active document
    make new hyperlink with properties {name:"new hyperlink", destination:hyperlink text destination id 44155 of document "kapitel 2.indd"}
    end tell
    end tell

    Thanks a lot - got it now!
    Maybe it could be helpful for others to look at your answer  
    with the placeholders replaced by "real" strings as it was hard for me
    to figure out the right form:
    tell document 1
    set theDest to make hyperlink text destination with properties {name:"Some name", destination text:<a reference to the relevant text>}
    this line for example looks like this =>
    set theDest to make hyperlink text destination with properties {name:"Some name", destination text:insertion point 902 of story id 44083 of document "kapitel 3.indd" of application "Adobe InDesign CS4"}
    set theSource to make cross reference source with properties {name:"Some name",source text:< reference to the relevant text>}
    this line for example looks like this =>
    set theSource to make cross reference source with properties {name:"Some name", source text:cursorPosition, applied format:cross reference format id 44305 of document "kapitel 1.indd" of application "Adobe InDesign CS4"}
    where "cursorPosition" was defined before by
    set cursorPosition to object reference of selection
    (the cross reference source needs the applied format reference too)
    make hyperlink with properties {source:theSource, destination:theDest, visible:true, highlight:invert, width:thick, border color:dark green, border style:dashed, name:"Whatever" }
    this line for example looks like this =>
    make hyperlink with properties {source:theSource, destination:hyperlink text destination id 44184 of document "kapitel 3.indd" of application "Adobe InDesign CS4", border color:black, highlight:none, border style:solid, hidden:false, visible:true, width:thin}
    end tell

  • How to locate the first insertion point on every page?

    I need to paste some same anchored objects on every page for exporting RTF format.
    So I need to locate the first insertion point on every page.
    Then, I use the code below (make a simple example):
    for(i = 0; i < app.documents[0].pages.length; i ++){
         app.select(app.documents[0].pages[i].textFrames[0].insertionPoints[0])
         app.paste()
    But when a file has a very long table spread over several pages, the location operation will select the insertion point before the table --- the starting point of the table.
    For instance, a table start on page 3 and end on page 10
    app.documents[0].pages[4~10].textFrames[0].insertionPoints[0])  can't select the first insertion point from page 4 to page 10. (In terms of scripting, the insertion point exists before the very long table starting on page 3.)
    How can I solve the problem? Thanks in advance.

    I dont know exactly what you are trying to do but you can try this. If you have table which runs trough multiple pages, you can first divede this tabel, that cells on separate pages would represent stand alone table. Than you can fit textframe to this table. When addressing indention poin you will get right position.
    In your case when table start at 3rd and ends on 10th page you would get 8 tables in 8 textframes on its own page. If textframes are linked and table is smaller than textframe you will have problem when addressing first insertion point on 4th or any other page. That why you should fit textframe to table:
    var bl=app.activeDocument.pages[1].textFrames[0].insertionPoints[0].baseline
    var tf=app.activeDocument.pages[1].textFrames[0];
    var gb=[tf.geometricBounds[0],tf.geometricBounds[1],bl,tf.geometricBounds[3]];
    tf.geometricBounds=gb;
    Now when you set
    app.activeDocument.pages[1].textFrames[0].insertionPoints[0] you will get position before table or
    app.activeDocument.pages[1].textFrames[0].insertionPoints[-1] you will get position after table

  • How can i insert the insertion point in each paragraph first

    Hi all
    Please find the below script, this script place the insertion point in end of the each paragraph, but i need to place the insertion point in first letter of the each paragraph. Please help.
    var myDoc=app.documents.item(0)
    var myLib=app.libraries.item(0)
    app.findTextPreferences=null;
    app.changeTextPreferences=null;
    app.findChangeTextOptions.caseSensitive=false;
    app.findChangeTextOptions.includeFootnotes=false;
    app.findTextPreferences.appliedParagraphStyle="TX"
    app.findTextPreferences.findWhat="^p"
    var myFinds=myDoc.findText()
    for(i=0; i<myFinds.length; i++)
    var myIcon=myLib.assets.item("Para").placeAsset(myFinds[i].insertionPoints[0])[0]
    myIcon.appliedObjectStyle=myDoc.objectStyles.item("Para No")
    Thanks & Regards
    Nithin

    @Nithin – inserting the anchor by placing the asset is changing the position of the next anchor, because the script's for-loop is running from the first found instance to the last found one.
    If you go through all the found instances from back to forth would be one solution.
    var myDoc=app.documents.item(0)
    var myLib=app.libraries.item(0)
    app.findGrepPreferences=null;
    app.changeGrepPreferences=null;
    app.findChangeGrepOptions.includeFootnotes=false;
    app.findGrepPreferences.appliedParagraphStyle="TX"
    app.findGrepPreferences.findWhat=".+\\r"
    var myFinds=myDoc.findGrep()
    for(i=myFinds.length-1; i>=0; i--)
    var myIcon=myLib.assets.item("Para").placeAsset(myFinds[i].insertionPoints[0])[0]
    myIcon.appliedObjectStyle=myDoc.objectStyles.item("Para No")
    Another one would be doing the search from back to forth and not changing the for-loop:
    var myFinds=myDoc.findGrep(true);
    Array of Text findGrep ([reverseOrder: bool])
    Finds text that matches the find what value.
    Uwe

  • [JS][CS3] Insertion Point

    HI All
    I need to get a hold of an insertion point between 2 characters and add some negative kerning to the characters either side.
    I have tried:
    myInsertion = myPara.characters[-3].insertionPoints;
    and many variations of that line, but with no joy.
    Can someone please help me out here?
    Cheers (as always)
    Roy

    This will set the kerning on each side of that character to a specific value:
    myPara.characters[-3].insertionPoints.everyItem().kerningValue = -25;
    If you want to use different values, then:
    myPara.characters[-3].insertionPoints[0].kerningValue = leftKern;
    myPara.characters[-3].insertionPoints[1].kerningValue = rightKern;
    where leftKern and rightKern hold the values you want.
    Dave

  • How do I let Apple know they need to include an option for controlling the insertion point cursor in system preferences?

    As described above.
    I have spent far too much time investigating this issue! All I would like to do is have the insertion point cursor (the 'I' shaped text thing) not dissapear when navigating text in a word document with the arrow keys.
    Some forums say it's an apllication issue, i.e. microsoft, others say you used to be able to do it in older versions of mac os'.
    This isn't a problem for Mac programmes. Obviously it is an issue when Microsoft programmes cross over to Mac. If the computer was a PC then I could customise the blinking rate, turn it on or off etc under the control panel options. With a Mac running MS Office I have not got this option.
    So how do I go about telling Apple of my displeasure? So hopefully for future editions of OS or Office for Mac this very minor but completely infuriating problem gets ironed out?
    Cheers x

    Thank you Ralph n Kurt, very quick off the mark boys, well done
    Just checking in to inform you that today, after putting up with the issue for over a year, it has sorted itself out, MIRACLE! I don't know how but I've got a fully trackable insertion point when I navigate with my arrow keys!!
    Do you think it's the big-wigs (because I complained to both Mac n MS) tweaking my computer behind the secenes? and if so which one would've done it? My money's on the geniusii.
    Either way I am well chuffed and thanks again!
    x

  • How do I change "At Insertion Point" to "Below Current Line" globally?

    Hello,
    I have a book that I will be converting to Structured FrameMaker. All of the graphics are referenced to the chapters with the Anchored Frame set to:
    "At Insertion Point"
    "Distance Above Baseline: 0.0 pt"
    If I do not change the Anchor Frame to "Below Current Line", then all of my graphics will float above the text, when in Structured FrameMaker and I will have to manually set each graphic to "Below Current Line".
    Since I have already set all the graphics to "At Insertion Point", I was wondering if there was a way I could change this to "Below Current Line" - either through Find/Change or through some plugin.
    I appreciate any/all suggestions related to this topic.
    Thanks,
    Jim

    Hi Jim,
    You could save the documents as MIF and search/replace the correct MIF codes (the MIF files are plain text files). Otherwise, you could use FrameScript or the FDK to do it. If you are interested in a FrameScript solution, please contact me offlist. Thank you very much.
    Rick Quatro
    585-659-8267
    rick at frameexpert dot com

  • How to make an insertion point

    Sorry I'm new here... I have tried searching and looked through the tutorials but how do you make an insertion point using CS5?

    Can you elaborate?
    Are you following a tutorial?
    As a guess, you click anywhere on the web page (to make an insertion point) and then go to the next step.

  • Insertion point thickness--help for the visually impaired

    I experience difficulty in seeing the blinking 'insertion point' bar or carat.
    I have increased the size of the cursor and I beam using the preference panel controls. I can see these clearly.
    It would help if I could make the 'insertion point' thicker and increase the rate of blink. (I know its height is fixed by the point size of the font used).
    I have looked at the Mighty Mouse software which allows you to customise cursors but not the 'insertion point'.
    Grateful for help, advice, or guidance as to a way of solving this problem.
    Many thanks
    B:o)

    Malcolm,
    Thank you for your speedy reply.
    Much appreciated. Have looked at these products and they look great. Sadly they don't appear to address the 'insertion bar' point that I'm seeking to solve.
    Even so thank you for responding to my cry for help.
    Best wishes
    B:o)

  • Placing Insertion Point for Images

    Virtually all of the instructions for inserting images in
    Dreamweaver tell you to first "place the insertion point in the
    document where you want the image." How can I (Move) that is place
    the cursor at a particular place on the blank page without using
    carriage returns, tabs, etc that add unnecessary code.
    Thank you for your assistance on what must be a trivial
    matter for those more experienced than I

    You cannot. You must build an HTML infrastructure that allows
    your
    insertion point to be placed where you want it on the page.
    For example, if you want an image to be placed 100px down
    from the top of
    the page, and 100px to the right of the left margin, you
    could do that by
    building an HTML table with a cell that falls at exactly that
    point. Then
    you would just drop the image into that cell.
    See - web authoring is not like using Microsoft Word, or a DT
    Publishing
    application. Unfortunately, you need to have some
    understanding of the
    underlying HTML/CSS to begin to work efficiently.
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.dreamweavermx-templates.com
    - Template Triage!
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    http://www.macromedia.com/support/search/
    - Macromedia (MM) Technotes
    ==================
    "Intlcom" <[email protected]> wrote in
    message
    news:f2l2p7$7hh$[email protected]..
    > Virtually all of the instructions for inserting images
    in Dreamweaver tell
    > you
    > to first "place the insertion point in the document
    where you want the
    > image."
    > How can I (Move) that is place the cursor at a
    particular place on the
    > blank
    > page without using carriage returns, tabs, etc that add
    unnecessary code.
    >
    > Thank you for your assistance on what must be a trivial
    matter for those
    > more
    > experienced than I
    >

  • [JS CS5] Accessing an inline frame from an insertion point

    Given an insertion point, how can I determine if it contains an inline/anchored frame? And if so, how do I reference the inline/anchored frame?
    I know how to reference the surrounding paragraph, characters, etc., but can't figure out how to get to the inline/anchored graphic.
    I normally would just loop through all the inline graphics in the document, but it this case I need to access the inlines via their insertion points.

    As far as I know, Insertion point can't hold inline/anchored object, but character does.
    If you select text and run this line
    alert(app.selection[0].pageItems.length);
    it will return number of anchor/inline objects inside selected text.
    Another way is to check parent of object. Parent of anchor/inline object is always character.
    Example script that copies all anchor/inline objects to new layer: http://bit.ly/aV9WMF
    Hope that helps.
    Marijan (tomaxxi)
    http://indisnip.wordpress.com/
    http://inditip.wordpress.com/

  • Metadata load - Invalid tree insertion point

    Dear all,
    Does anyone know what this means?
    Invalid tree insertion point
    Show Details:
    Error Reference Number: {5ECBFF51-F653-48D6-811B-6AB494B42047};User Name: BConley@MSAD
    Num: 0x80042483;Type: 0;DTime: 10/19/2012 6:21:45 PM;Svr: TEPM-APP;File: CHsvMetadataLoadACV.cpp;Line: 347;Ver: 11.1.2.1.000.3082;
    Thanks for your help!

    Hi Bconley,
    This kind of error usually occurs when there are any errors in the hierarchy. So Make sure that there are no errors in hierarchy of the custom dimension Load the metadata with "Clear All" Metadata Before Loading option selected.
    Check if there are any special characters in the metadata file.
    Hope this helps,
    Thank you,
    Charles Babu J

  • Metadata Load - Invalid tree insertion point error

    Does any one know what this error means when you get it trying to load a metadata file? Invalid tree insertion point error
    Renaming members...
    Scenario
    Entity
    Account
    Custom1
    Custom2
    Custom3
    Custom4
    Currency
    [ConsolMethods]
    No consolidation method section
    Currencies...
    Currencies OK
    Entities...
    Error: Invalid tree insertion point
    Error: Invalid tree insertion point
    Load ended at: 12:39:40
    Elapsed time: 00:00:18

    Hi all,
    I have a question,
    Have you tried to rearrange the hierarchies and move a lower generation parent higher in dimension?
    So, for example:
    Current tree:
    Parent 1
         Parent2
              Base
    New tree:
    Parent2
         Parent1
              Base
    Regards,
    Thanos

  • [JS] CS3 Apply document defaults to insertion point

    Is there any way to apply the document defaults to an insertion point? I
    have a script that is looping through a whole bunch of text files,
    formatting them (with thinks like tab stops and indents). The thing is I
    don't want any of the tab stops, indents etc. to be left over from the
    previous import. Is there any way to apply the default document
    formatting before I import the next text file or do I have to manually
    remove all tab stops, indents, etc.?

    I think you can use:
    myIP.properties = myDoc.textDefaults.properties;
    although to be safe, you might be better off doing:
    myIP.paragraphs[0].properties = myDoc.textDefaults.properties;
    Actually, both seem to work.
    Dave

Maybe you are looking for

  • Voluntary Repossession?

    My credit is poor so a trade in is not an option since when I have spoken with several dealerships that will require between $2-4K down payment. Capital One Auto loan, $18K balance, at best the car is worth $14K and at worst $10K. Car payment is $640

  • PCA Values are Zero in KEAT

    Dear Experts,       I am using New GL Profit Centers. In KEAT activity all values are comparing properly I mean COPA to SD to FI. But PCA values are showing Zero values... I had checked in FI level all values are flowing to PCA properly through Docum

  • Safari always crashes on launch

    Today I DL'ed the Safari update hoping it would fix the way Safari continually crashes on me. The symptoms are pretty straigh forward, I click the Safari icon in the Dock, Safari launches with a blank page and then the beachball start spinning. After

  • H.264 + Annotations/Metadata = No go

    I am using QuickTime 7 Pro to convert some DV footage into MPEG-4 H.264 encoded files. I use the Movie Properties menu to add metadata (or "annotations") such as Artist, Author, Comments, etc. The problem I'm having is, once the video is exported out

  • Clever bulk collect working with 9.2 and up for snaps .

    Hi, I'm doing snaps of v$sysstat with 1 second delay to count some metrics like that: select name,value from v$sysstat where name in ('execute count', 'parse count (hard)', 'parse count (total)',                           'physical read total IO requ