List question

Is there a statement that will set every item of a list to a certain value? I tried:
set l to {0,0,0,........................} -- initialize
set every item of l to 99 -- this does not work though you would think it should?

You raise an interesting and valid issue with your question.
However, the answer isn't exaclty what you'll likely want to hear.
The long and short of it is this: AppleScript doesn't recognize its own object model. Your best option, though not exactly elegant, is a repeat loop.
set myList to {1, 2, 3, 4}
set newList to {}
repeat with m in myList
set end of newList to 0
end repeat
return newList
All that being said, I've heard a few times over the years that AppleScript is one day supposed to gain many of the features of other more traditional languages. Here's hoping because I'd love to see some of the niceties I'm used to in PHP and VB come to AS.
15MBPro    

Similar Messages

  • ADF SelectOneChoice List Question

    I posted the following message in the Toplink forum and they have suggested I try over here:
    Toplink Essentials List Question
    ==================
    I am new to Toplink Essentials. I am using Toplink Essentials inside of JDeveloper 11g, against Oracle Express and ADF/Trinidad and have used JDeveloper's "Entities from Tables" wizard to reverse engineer my database into Toplink pojo objects. After this I used JDeveloper's wizard to create a JavaServiceFacade and then generate a Data Control.
    After expanding the DataControl (which is mapped to the JavaServiceFacade) I have a method queryEntityFindAll(). Under this method I have serval attributes and then a list which represents a "many-side" of this entitie's relationship with another entity. How do I create a selectOneChoice using this list?
    I've tried expanding queryEntityFindAll() and then dragging the list to a jspx page, setting the Base Data Source to "JavaServiceFacade.queryEntityFindAll.listName and then setting the List Data Source to "ListName : JavaServiceFacade.queryRelatedEntityFindAll". However, when I run the page the only thing that appears on the page is the selectOneChoice label... no drop down component appears on the page... no errors are generated to give any clue as to what my problem may be...
    Although I'm working in JDeveloper, I really believe this is a Toplink Essentials question...
    Please help!

    Thanks for the quick response!
    Using the department / employee example... I'm trying to create a form that allows a user to create a new department. I have dragged the "Department" object (located under queryDepartmentFindAll()) over to my jspx form. A form with corresponding fields is created.
    I notice that no field was created for employeeId. I expand the "Department" object (again, under queryDepartmentFindAll()) and observe that "Employee" is present, as a list (expanding Employee provides access to employee object attributes along with another list entitled departmentList).
    I know that it's unlikely that only one employee would be selected in the creation of a department... but I'm sticking to the example...
    So, I drag the "Employee" (again, under queryDepartmentFindAll()) object over to the newly created form and from the pop-up menu I choose selectOneChoice as the desired component. I run the jspx page, Internet Explorer 7 browser pops up and all labels display on the page, all fields but no selectOneChoice component appears on the screen... the space is there for it but it appears to be invisible. I have checked the Employee table and there is data to be displayed... it's just that I must be missing something...

  • Bookmarks list question

    stupid bookmarks list question. how do you remove a bookmark form the bookmark list?

    On the menubar, Safari > Bookmarks > Show all Bookmarks > right click and select delete.
    Or highlight and hit the delete key.

  • Library list question

    I just got a new computer, redownloaded iTunes, and imported my music back into it. Somehow I got most, if not all, my songs in my library twice. It is a pain but I can go through and delete them. My question is that some of the songs now have an exclaimation point icon in front of the title of the song. I was unable to find a list of what the icons mean. I am afraid to start deleting the duplicate songs until I know what the exclaimation point means. Anyone know? Sorry if this is already posted out there somewhere. Thanks.

    Hello,
    The exclamation point icon means that the music file was moved from its original location at some point and is no longer there. So the 'duplicate' ones are the old songs, that have the exclamation points, and can be deleted. However, they are not different files. The songs without exclamation points should be the ones that work (if you click on them they should play.) To be safe, I would check to make sure that the songs without exclamation points work and the ones with them don't work before you delete anything. Hope this helps.
    Victoria

  • A linked list question.

    So, I believe I understand linked lists for the most part, except for two lines....
        boolean add(Transaction item)
            for (Transaction curr = first; curr != null; curr = curr.next)
                if (curr.part_num == item.part_num)
                    return false;
            Transaction newItem = new Transaction();
            newItem.transcode = item.transcode;
            newItem.description = item.description;
            newItem.part_num = item.part_num;
            newItem.quantity = item.quantity;
            newItem.next = first;
            first.next = newItem;
            return true;
        }first is null, so First.next would be the first available space for actual insertion, and this is why it then puts null as newItem.next (the end of the list), and sticks newItem in first.next?
    Im glad I read that pass by value thing earlier at the Java Ranch place...
    Heres my actual question: When newItem.next = first; is called, it just copies null as the next field, but leaves the null in first alone right? And then it takes first.next and makes newItem copy into that field, thus inserting the first real item in the list?
    Please tell me I made that connection right. :-D
    Thanks!!

    Pictures are worth a hundred words with linked lists. Did you even put a pencil and paper next to your computer while doing this program, so that you could draw what is happening when you get confused?
    If first is null, then the for loop is skipped--because first is assigned to curr and the loop only executes when curr is not equal to null.
    So, this happens:
    newItem = new Transaction()
    int Transcode = 0
    String description = null
    int partNumber = 0
    int quantity = 0
    Tranasaction next = nullThen values are assigned to each field:
    newItem
    int Transcode = 10
    String description = "screw"
    int partNumber = 46
    int quantity = 200
    //freeze execution here:
    Tranasaction next = null (what will happen here??)Your assumption was:
    Transaction first = null
    That means first does not refer to a Transaction object. Therefore, first does not have a description member, a quantity member, etc., and this is what things look like just before newItem.next = first; is executed:
    newItem ----> Transaction
                  int Transcode = 10
                  String description = "screw"
                  int partNumber = 46
                  int quantity = 200
                  Tranasaction next = null
    first ------> nullNow,
    When newItem.next = first; is calledthings change to this:
    newItem ----> Transaction
                  int Transcode = 10
                  String description = "screw"
                  int partNumber = 46
                  int quantity = 200
          /-------Tranasaction next
    first ------> null That isn't what you want. When you add() a Transaction object to the end of your linked list, it's next member should be null. It's the end of the chain, so there is no next.
    And then it takes first.next and makes newItem copy
    into that field, thus inserting the first real item in the
    list?No. first is null so it does not refer to a Transaction object, and therefore there is no next member variable and consequently no such thing as first.next. You need to understand that null and a Transaction object that has 0 for every member are not the same.
    But suppose for a minute that null and a Transaction object with zeros for every field were the same thing, so that first.next existed. If that was the case, then you could assign newItem to first.next. But, then you would be left with this:
    first
    int Transcode = 0
    String description = null
    int partNumber = 0
    int quantity = 0
    Tranasaction next = newItemWould you want the first Transaction object in your LinkedList to be almost entirely empty?
    Instead, if first is null, you want to make first refer to newItem, i.e. you want to do this:
    newItem ----> Transaction
                  int Transcode = 10
                  String description = "screw"
                  int partNumber = 46
                  int quantity = 200
                  Tranasaction next = null
    first ----/   nullThen when the add() method ends, since newItem is a local variable, it will be destroyed leaving you with this:
                  Transaction
                  int Transcode = 10
                  String description = "screw"
                  int partNumber = 46
                  int quantity = 200
                  Tranasaction next = null
    first ----/   null

  • Java List question

    Dear all,
    My development tool is JDev. 10.1.3.
    I've a session bean which the list contains several fields. The list defined like this:
    List<cell> List1 = new ArrayList(); cell in a cell.java.
    I created List2, List<cell> List2 = new ArrayList(); which the list contents are copied from List1.
    On the jspx, List1 is on the left hand side, it rendered out as a table, user can select the row and click the button "Add item to List2". On the right hand side, List2 allows user input information. User can choose List1 item to List2 repeatly.
    The question is, e.g. List1 and List2 contain A and B items initially. User inputted information in List2 for A item. And then, choose A item from List1 to List2 again. The new selected item carried the information that user input in List2 before.... I don't know why?
    Then, I modified the List2 like this: List<dupcell> List2 = new ArrayList(); and hope the information will not be carried.
    However, it doesn't work..
    Can anyone help me? Please.
    Thanks for any suggeston!
    Regards.

    Sorry, my English is not good...
    my situation like this:
    "List1" defined in a session bean, "shoppingCart.java", like this:
    List<cell> List1 = new ArrayList();
    In the cell.java code, like this:
    public class cell {
    private String id;
    private String type;
    private Number quantity;
    private String remarks;
    public cell() {}
    public cell(Number id) {
    this.Id = id;
    /** defined getter and setter **/
    In a JSF page1, user selected the id and id will be stored in the session bean. e.g. user selected id "A" and "B".
    Then, user click a button and go to JSF page2.
    This button call a function, the List1 copy to List2, like this:
    public String copy_to_new(){
    List2.addAll(Utils.getShoppingCart().getList1());
    return "page2"; //go to JSF page2
    Two lists were created.
    List1 - user select item, move the item to List2.
    List2 - user input the information: type, quantity and remarks. e.g. user inputted information for id "A": type = "small", quantity = 1, remarks = "urgent".
    Now, user click id "A" from List1 to List2.
    On List2, it shows:
    Id Type Quantity Remarks
    A small 1 urgent
    B
    A small 1 urgent <-- new selected row (I don't want this)
    Question: How can I create a new row that it does not carry the previous information, like this:
    Id Type Quantity Remarks
    A small 1 urgent
    B
    A <-- new selected row
    Thank you very much for any helps!!
    Regards.

  • PLD and Pick List question

    Hello
    I am trying to add ShipToCode from the RDR1 table to the PLD for Pick List, but it gives me a blank column when it should display the text values that are in ShipToCode..
    Is there a way to display the values for ShipToCode?
    Any help is appreciated, thank you

    Hi David,
    Check this thread for your answer:
    Add Order Quantity to Pick List PLD
    If you still have questions, just ask.
    Thanks,
    Gordon

  • Link List question

    This is more of a development question rather than programming I hope its not wrong to post it here. I apologize if I did
    I am developing a Linked List class that handles a list however, there is a potential (in fact almost a certainty) that the nodes could call to itself and cause an endless loop if running through the it. Any suggestion on how to handle such a case ?

    It's kind of hard to say without more details, but the two general approaches that pop to mind are:
    1) Document it. If the user chooses to ignore the docs, they get bad--posisbly undefined--behavior, and that's their problem.
    2) On every relevant operation, do a search for cycles. Keep track of which nodes you've touched so far. Since the size of the list (and hence the length of a cycle) is theoretically unbounded, and searching every possible path for cycles in a large or complex list (which sounds more like a graph than a list) can take mucho time and/or memory, you'll have to set an upper bound on how deep you'll search. If there's a cycle whose path length is longer than this depth, then you're back to #1 anyway.

  • Cor list question

    hi guys,
    i have question regarding cor list or how to setup something like my case. i am trying to setup 2 companies with 1 uc 540. uc 540 has 1 pri and 4 pots lines, so company a will use only pri line, and company b will only use pots lines. so how can i accomplish such thing for inbound and outbound. for inbound, i am okay with but outbound whenever company b dial out, it will then automaticall pick up pri line. i have 2 set dial peer and pri has higher preference than pots line.
    let me know if you guys ever encounter similar case to this and how to approach the solution.
    thank you.

    Hi,
    I would imagine that you could accomplish your goal by implementing 2 different steering digits say 8 for company A and 9 for company B.  Then create 2 trunk groups one for the PRI and another for the FXO ports.  Then you could add restrictions to each company to keep them from dialing the others steering digit or extensions. 
    I hope this gets you on the right path.
    Thanks,
    Jason Nickle

  • Multiline - drop down list question

    Below is my scenario:
    I have a multi-record non-db block showing up in a tab canvas (say T). This tab canvas is supposed to be like detailssection in the form. In this tab canvas, one of the tabs is named 'Recon'. In this tab, there is an drop down list item called 'Purpose', which I am populating with a dynamic query using a look up value table.
    However, since it is a multi-record block, I have about 5 records displayed. My dynamic query populates only the 1st drop down list item ('Purpose'). I can put the query in a loop and populate the remaining drop down 'Purpose' list items.But, how would I know when to stop the loop? i.e., how many records should it loop? Also, let us say the user completes all the 5 records, but then navigates to the 6th record (scrolls down using the scroll bar) then how would I know to populate the drop down list item ('Purpose') in the 6th record?
    Can any one suggest an easy way to accomplish this?
    Thanks,
    Chiru
    Edited by: Megastar_Chiru on May 7, 2010 3:30 PM
    Edited by: Megastar_Chiru on May 7, 2010 3:30 PM
    Edited by: Megastar_Chiru on May 7, 2010 3:31 PM

    Yes. that is a mul-record block. How to populate the list is my question. That is what I am trying to figure out.I asked some information.
    how you are populating your list and on which trigger can you post the code?
    And sure there is nothing code in WHEN-NEW-RECORD-INSTANCE which is refreshing the list? Because when you populate any list for it shows for all records either in multi-record or single record.
    -Ammad

  • ColdFusion List Question

    Hello Community!
    I have two questions regarding CF lists:
    1-) I have a list that has the values 1,2,
    As you can see, the comma at the end of that string will make mymy program break because that list of comma delimited values is being used in a SQL statement: in(1,2,)
    How do I remove that comma at the end of my list?
    2-) I have a list with the values 1,,3
    How do I get rid of that unnecesary comma? How do I fill in the space between , and , with a value so it's 1,value,3 instead?
    Thanks!
    Ysais.

    if mylist = '1,2,'
    then you could make your SQL in(#removechars(mylist, len(mylist), 1)#)
    essentially removing the last character.
    to get rid of the unnecessary comma you could CFLOOP though the list and create another list 'mynewlist' this time not including anything that's blank
    ie if mylist = '1,,3'
    <cfset mynewlist = ''>
    <cfloop list="#mylist#" index="getitem">
    <cfif getitem neq ''>
    <cfset mynewlist = listappend(mynewlist, #getitem#)>
    </cfif>
    </cfloop>
    mynewlist becomes '1,3'

  • Dealer list question.

    Hey guys!
    I'm new to the fourms, quick question the site i'm currently helping out with has a dealer listing, I'm curious if it would be easy to set up a Flex dealer list so I can load it into the flash?
    take a look, let me know your thoughts.
    thanks guys.
    here's the link:  www.manitobah.ca

    Not at all clear on what you are trying to do. It sounds like an easy way to load data into Flex? The easiest way is probably to load some sort of XML document whether it be static or dynamically generated say by a web service.

  • Skype Contact List question

    Quick question...Can anyone tell me why my skype contact list doesn't have the magnifying glass and alphabet listed on the right side of the screen as the phone's internal contact list does? My wife has the exact same iPhone 4, with the same version of skype on it and her skype contact list has the alphabet bar.
    I think it has something to do with my skype account because when I log in with her account on my phone, the alphabet bar show up. Likewise, when I log into my account on her phone, the alphabet bar disappears. Any suggestions? Thanks in advance.

    Hello,
    Are you sure that your client's account hasn't been hacked?
    We don't engage in practices like the one you describe.
    On the contrary, like all responsible organizations, we value and protect our customers' privacy.
    Your first step should be to file with Customer Support (link below)
    Moved to "Security".
    TIME ZONE - US EASTERN. LOCATION - PHILADELPHIA, PA, USA.
    I recommend that you always run the latest Skype version: Windows & Mac
    If my advice helped to fix your issue please mark it as a solution to help others.
    Please note that I generally don't respond to unsolicited Private Messages. Thank you.

  • Delete SharePoint Workflow History List Questions

    I found the code below here :
    https://social.technet.microsoft.com/Forums/sharepoint/en-US/79aa3bd4-d334-4614-9304-15998a95aefb/delete-list-with-43-million-items-workflow-history-list?forum=sharepointadminprevious
    I originally had 81K items in the workflow history list..Dating back to a year ago, which obviously didn't need to be saved in the workflow history list. And we all know Workflows start to have issues when this WF History list get a lot of items in it.
    my questions are now that I have it cleaned up...
    I have workflows that trigger 30 days prior to when an item expires.  so for example if an item expires 12-15-15, the workflow sends an email 11-15-15.  but these expiration dates can be at any time of the year. for example lets say the
    item was entered on  2-2-15 with expire date of 12-15-15 -  workflow is now  triggered so that emails would be send in 11-15-15 ....
    So if I delete the workflow history list item will it affect the workflow waiting to be triggered?
    Is there a way with the code below to capture workflows that have completed, error'd out, or failed to start?
    As I figure those would be safe to delete if deleting items from the workflow history list affects workflows waiting to be triggered?
    or would it be possible for the code below to be modified  to delete based on either ID of list item and or date range?? 
    like  say  delete  completed workflows at 100 items every thirty days?
    but I can not have a current waiting workflow to trigger & history beaffected by the workflow history list delete.
    ********************************** Code **************************************************************
    $weburl = "http://"
    $listname = "Workflow History"
    #param($weburl,$listname)
    #if ($weburl -eq $null -or $listname -eq $null)
    #    write-host -foregroundcolor red "-weburl or -listname are null."
    #    return
    Add-PSSnapin Microsoft.SharePoint.Powershell -EA 0
    $web = get-spweb $weburl
    $list = $web.lists[$listname]
    $stringbuilder = new-object System.Text.StringBuilder
    try
        $stringbuilder.Append("<?xml version=`"1.0`" encoding=`"UTF-8`"?><ows:Batch OnError=`"Return`">") > $null
        $i=0
     $spQuery = New-Object Microsoft.SharePoint.SPQuery
        $spQuery.ViewFieldsOnly = $true
     $spQuery.RowLimit = 1 // # of items to delete
     $items = $list.GetItems($spQuery);
        $count = $items.Count
      $now = Get-Date
     write-host ("Deleting Items from list started at " +$now.toString())
        while ($i -le ($count-1))
            #write-host $i
            $item = $items[$i]
            $stringbuilder.AppendFormat("<Method ID=`"{0}`">", $i) > $null
            $stringbuilder.AppendFormat("<SetList Scope=`"Request`">{0}</SetList>", $list.ID) > $null
            $stringbuilder.AppendFormat("<SetVar Name=`"ID`">{0}</SetVar>", $item.Id) > $null
            $stringbuilder.Append("<SetVar Name=`"Cmd`">Delete</SetVar>") > $null
            $stringbuilder.Append("</Method>") > $null
            $i++
        $stringbuilder.Append("</ows:Batch>") > $null
        $web.ProcessBatchData($stringbuilder.ToString()) > $null
    catch
        Write-Host -ForegroundColor Red $_.Exception.ToString()
       $now = Get-Date
     write-host ("Deleting Items from list ended at " +$now.toString())
     write-host -ForegroundColor Green "done."
    **************************************End of Code***************************************************

    Hi Cowboy,
    Per my knowledge, if we delete the workflow history list items, it will not affect the workflows waiting to be triggered.
    However, if you go to the workflow status page, the history will be empty as the events 
    have been deleted in workflow history list.
    The code in your post will delete 2000 items in workflow history list.
    As there is no status for the items in workflow history list, so I recommend to use the date as the query condition.
    For example, if you want to delete items created between 2015-02-01 and 2015-02-16, then you can change the query as below in your code:
    $query="<Where><And><Geq><FieldRef Name='Created'/><Value Type='DateTime'>2015-02-01T00:00:00Z</Value></Geq><Leq><FieldRef Name='Created' /><Value Type='DateTime'>2015-02-01T00:00:00Z</Value></Leq></And> </Where>"
    $spQuery=$query
    Thanks,
    Victoria
    Forum Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
    [email protected]
    Victoria Xia
    TechNet Community Support

  • Open with list question

    I often download alot of docs that I end up using the OpenWith box. I see there are old versions of apps in this list is there a way that I can remove the older app versions from here so I have one version (the latest) to choose from?
    rd

    If you still have those older versions on your hard drive, I don't believe there's any way to remove them from that list. If you don't still have them, try rebuilding your launch services database:
    http://www.tuaw.com/2009/06/11/terminal-tips-rebuild-your-launch-services-databa se-to-clean-up/

Maybe you are looking for