Array key question

I need an array with Strings as keys. Something like this:
String arr[] = null;
arr["somekey"] = "abc";
arr["something"] = "bca";
arr["anything"] = "cba";
The thought is that then I'll be able to search through the array after a given key, and then print out it's value.
How can I do this?
Thanks :)

Made a complete example:
String searchKey = "Juice";
TreeMap tm = new TreeMap();
tm.put("soda", "coke");
tm.put("Juice", "orange");
tm.put("SODA", "7-up");
Set set = tm.entrySet();
Iterator iterator = set.iterator();
while( iterator.hasNext() ) {
Map.Entry entry = (Map.Entry)iterator.next();
if(entry.getKey().equals(searchKey)){
System.out.println("searchKey '"+searchKey+"' value is: "+entry.getValue());
What do you think? Anything obvious that can be improved?

Similar Messages

  • Satellite - randomly the arrow keys, question mark key and z key will not work

    Sometime the arrow keys, question mark and z key work fine (like now) and sometimes they just don't work at all (like a minute ago).  I will just be typing and they will work and then just stop working, then work again.  They either all work or all do not work. This has been happening since about a week after I got the computer.  It is so annoying.  Can you please help me fix this problem?  I have a Satellite T135-S1309.
    Many thanks.

    Hi, 
    I've posted recently about keyboard problem, and have tried everything as everybody else, finally and oddly :-) the solution for my problem was to reconnect little flat cable that connects keyboard and MB :-D shown in step 10 on the following link:
    http://www.irisvista.com/tech/laptops/Toshiba-Satellite-X205/take-apart-laptop-2.htm
    ..so maybe your keyboard somehow strangely detached itself from mother-board just a bit and started creating all sorts of strange problems as mine... one cable line was without contact because flat cable was not attached properly anymore and mentioned keys stop working... I have also downloaded keyboard tester software that helped me find all keys and combination of keys that stop working ... so guys, try that and good luck!    

  • T430s or T431s? and a key question concerning the T431s mSATA slot

    T431s or T430s?
    First let me apologize for my English, sorry if reading through this cause you any headache…
    I gave away my T410 (bad bad decision) the day after I got a i7 Yoga 13 with 256G SSD, and bought a M4 256G which I planned to put in the free mSATA slot, only to find out i can't live with that yoga keyboard and that huge off-center touchpad which gets in the way all the time a few days later... anyway, end up returned that yoga13 and is using my heavily abused limping T500 now with a replaced motherboard... I was looking to go back to thinkpad and buy a T430s right away but Lenovo announced T431s one day afterwards. now i dont know what to choose, although leaning towards T431s a little bit.
    things i'm looking for in my next laptop: first X1C is not an option for me, I can’t accept that screen with high dot pitch.
    l  weight: less than my T410, it doesnt have to be light as an Acer S7 or Samsung 9, just reasonably lighter, and as slim as possible.
    l  Processing power: doesn’t really matter, anything i5 or i7, M or U… all fine to me, I can run Lightroom, DPP and video processing applications on my desktop and I don’t play games. 8G or more RAM is needed.
    l  Storage: comes with 256GB SSD or user upgradeable to 256GB SSD is an absolute minimum requirement, but I really prefer any flexibility to configure a second drive, HDD or SSD, is a big plus, preferably HDD as the second drive.
    l  Screen: wouldn’t mind squeezing my eyes on a FHD screen, but I can only settle on a 900p, afterall I’m looking for a thinkpad, have to live with that screen, right?
    l  Tough… every one of my laptop gets dropped once or twice… many many times in the case of my old T410… so it needs to be tough…
    l  Not much else…
    So, T431s is lighter, slimmer, user replaceable 7mm SSD, mSATA available (a concerning question later), all good, and I like the new look. And I don’t care much about the indicators, lid lock, flipped logo or that new touchpad (I think I can manage, maybe…).
    So what do I have to sacrifice if I choose T431s? removable battery, ultrabay for optical drive and HDD, full voltage cpu, and possibly a couple hundred dollars… since we don’t know for sure how much optional parts will cost in customized build, and of course the risk of buying an unproven, newly designed product. Did I miss any other key point?
    If I didn’t miss many advantages that T430s have, I probably should go with T431s, it was all good until I found a video which shows how to disassembled a T431s (http://v.youku.com/v_show/id_XNTI5NzIxMzg4.html) and at about 4 mins in, it shows that the WWAN card is secured by a single retaining screw in the middle on the outer edge, unlike typical mSATA SSD which should be secured on the 2 corners of the board. Does this mean users can no longer install a mSATA SSD on T431s? if so, I can only have one 7mm SSD instead of having OS installed on a 256G mSATA, and have a 500G HDD to storage all the photos and videos, which I was intended to do, that maybe a deal breaker…
    I don’t really understand these hardware upgrades, can some one please tell me for sure whether the mSATA slot on T431s, as shown in the video, can be used to intall a regular mSATA SSD. If I can, I’ll probably still struggle to make the decision, if it can’t be used to install SSD, T430s it is.
    Any help is appreciated!
    Kai
    Solved!
    Go to Solution.

    thanks, yes, it's the new NGFF M.2, and the new form factor is a lot more complicated than the old mSATA slot, different dimensions for different storage size, and it maybe single side for WWAN, cashe drive, or double side for actual SSD perfermance... 
    if i'm gonna get a T431s, i'll just buy the 320G 5400RPM low end drive, make a recovery media from Win8, and reset to factory setting after intall a 512GB 840 Pro, or the much cheaper M4... 

  • License key question with regards to upgrading from 7/8.1 to 10

    Hi, I hope I've posted my question in the right area of the forum:
    I understand that Windows 10 will be a free upgrade for Win7/Win8 users.
    That's really wonderful but I was wondering what the exact mechanism with regards to our 7/8 license keys. Here's a couple examples to clarify my question:
    first, example: I have Windows 7 Pro license and say I upgrade to 10 within the first year. Let's say I need to reinstall Windows after that first year is finished will I still be able to use that same license key I used to upgrade 7 to 10 to install a fresh
    copy of Windows 10 or will I need to purchase a new license because the year is elapsed? 
    Here's another scenario. I upgrade to Windows 10 from 7 and after trying Windows 10 for while, I decide to uninstall 10 and go back to 7... because I'm crazy like that.... Will I be able to use my original Key for Windows 7 or is the upgrade a one way road:
    where the 7 key turns into a Windows 10 key and can no longer be used to activate Windows 7?
    Thanks for the feedback!

    Hi Momashi
    Here's another scenario. I upgrade to Windows 10 from 7 and after trying Windows 10 for while, I decide to uninstall 10 and go back to 7...
    because I'm crazy like that.... Will I be able to use my original Key for Windows 7 or is the upgrade a one way road: where the 7 key turns into a Windows 10 key and can no longer be used to activate Windows 7?
    If you Upgrade to Windows 10 and do not like it, for whatever reason.
    Before you upgrade to Windows 10.
    Create an image of windows 7 to an external HD and a recovery CD, using windows 7 Backup and Restore.
    You can re-install windows 7 in the SAME SYSTEM using the recovery CD without using  a key.
    Hope it helps
    Where did you get your outlandish information about a Windows 7 key turning into a Windows 10 key?  Nothing in the past has ever happened like this before, so what makes you think it will happen with Windows 10?
    My Windows ME did not turn into a Windows XP key!
    My Windows XP key did not turn into a Windows Vista key!
    My Windows Vista key did not turn into a Windows 7 key!
    And so on!
    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread. ”

  • What are the key questions for third party order process?

    hi all,
    what type of questions can i receive for third party order process?
    pls.. do the needful
    thanks to all.

    Hi arun,
    Process Flow for 3rd Party Sales
    Customize the third party sales in summary:
    1. Create Vendor XK01
    2. Create Material – Material Type as "Trading Goods". Item category group as "BANS".
    3. Assign Item Category TAS to Order type that you are going to use.
    4. A sale order is created and when saved a PR is generated at the background 
    5. With reference to SO a PO is created (ME21N). The company raises PO to the vendor.
    6. Vendor delivers the goods and raises bill to company. MM receives the invoice MIRO 
    7. Goods receipt MIGO 
    8. Goods issue
    9. The item cat TAS or Schedule line cat CS is not relevant for delivery which is evident from the config and,   therefore, there is no delivery process attached in the whole process of Third party sales.
    10. Billing     
    SD -  3rd party sales order Create Sales Order
    VA01
          Order Type
          Sales org, distr chnl, div
          Enter
          Sold to
          PO #
          Material
          Quantity
          Enter
          Save
    SD -  3rd party sales order View the PR that is created with a third party sales order
    VA01
          Order Number
          Goto Item Overview
          Item ->Schedule Item
    SD -  3rd party sales order View the PR that is created
    ME52N
          Key in the PR number
          Save
    SD -  3rd party sales order Assign the PR to the vendor and create PO
    ME57
          Key in the PR number
          Toggle the "Assigned Purchase Requisition"
          Execute
          Check the box next to the material
          Assign Automatically button
          Click on "Assignments" button
          Click on "Process assignment"
          The "Process Assignment Create PO" box , enter
          Drag the PR and drop in the shopping basket
          Save
    SD -  3rd party sales order Receive Goods
    MIGO_GR
          PO Number
          DN Number
          Batch tab , click on classification
          Serial Numbers tab
          Date of Production
          Flag Item OK
          Check, just in case
          Post
          Save
    SD -  3rd party sales order Create Invoice
    MIRO
          Invoice Date
          Look for the PO , state the vendor and the Material
          Check the box
          Clilck on "Copy"
          Purchase Order Number (bottom half of the screen)
          Amount
          State the baseline date
          Simulate & Post
          Invoice Number
          *Invoice blocked due to date variance
    SD -  3rd party sales order Create a delivery order
    VL01N
          In the order screen , go to the menu Sales Document , select "Deliver"
          Go to "picking" tab
          State the qty and save
    SD -  3rd party sales order Create a billing document
    VF01
          Ensure that the delivery document is correct in the
          Enter
          Go to edit -> Log
          Save
    Pl. be clear on this process.
    Also understand how migo and miro are handled.
    The item categories used.
    How the company knows of the shipment of goods to the customer.
    How returns are handled.
    Hope it helps. Please reward if useful.
    Thanks & Regards
    Sadhu Kishore

  • The arrays class question

    consider the code below
    int[] list = {2, 4, 7, 10};
    java.util.Arrays.fill(list, 7);
    java.util.Arrarys.fill(list, 1, 3, 8);
    System.out.print(java,util.Arrays.equals(list, list));i understand line 2, it gonna fill 7 into the array,so the output would be Line 2: list is {7, 7, 7, 7}
    my question is line 3, how come the output would be {7, 8, 8,7} what does 1 and 3 represent in a arrary?
    the line 4 output would be {7, 8,8,7} again why?
    Thank you guys whoever is gonna take to respond me questions

    zerogpm wrote:
    but which 2 lists were comparing ? since i have list list with the same name1) You're not comparing lists, you're comparing arrays.
    2) You're comparing a single array with itself.
    3) Objects, including arrays, do not have names. Classes, variables, and methods have names. Objects do not.

  • Array output question

    Hello,
    I'm trying to get this foreach to output to HTML.
    What I need help with is how to make this report output the array data.
    $MyCollection = @()
    $arrViewPropertiesToGet = "Name","Summary.Runtime.PowerState","Config.GuestFullName","Summary.Config.Annotation","CustomValue","AvailableField"
    foreach ($cluster in Get-Cluster) {
        Get-View -ViewType VirtualMachine -Property $arrViewPropertiesToGet -SearchRoot $cluster.id | Select `
      @{n="VM name"; e={$_.Name}},
            @{n="Cluster"; e={$cluster.name}},
      #@{n="PowerState"; e={$_.Summary.Runtime.PowerState}},
            @{n="Guest OS"; e={$_.Config.GuestFullName}},
            @{n="Notes"; e={$_.Summary.Config.Annotation}},
            ## just using the data already retrieved; far faster
            @{n="Tier"; e={$viewThisVM = $_; ($viewThisVM.CustomValue | ?{$_.Key -eq ($viewThisVM.AvailableField | ?{$_.Name -eq "Tier"}).Key}).Value}}
      $MyCollection += $viewThisVM
    } ## end foreach
    $MyCollection | ConvertTo-HTML -Fragment | Set-Content c:\temp\test.htm
    Invoke-Expression C:\temp\test.htm
    Here is what I know how to do, but need help with the array part, everything else is working great.
    #Sample Code
    Get-Service | Select-Object Status, Name, DisplayName | ConvertTo-HTML | Out-File C:\Scripts\Test.htm
    Invoke-Expression C:\Scripts\Test.htm
    Thanks,
    -Mike

    Hi sneddo,
    That is the complete script.
    $MyCollection = @()
    $arrViewPropertiesToGet = "Name","Summary.Runtime.PowerState","Config.GuestFullName","Summary.Config.Annotation","CustomValue","AvailableField"
    foreach ($cluster in Get-Cluster) {
        Get-View -ViewType VirtualMachine -Property $arrViewPropertiesToGet -SearchRoot $cluster.id | Select `
      @{n="VM name"; e={$_.Name}},
            @{n="Cluster"; e={$cluster.name}},
      #@{n="PowerState"; e={$_.Summary.Runtime.PowerState}},
            @{n="Guest OS"; e={$_.Config.GuestFullName}},
            @{n="Notes"; e={$_.Summary.Config.Annotation}},
            ## just using the data already retrieved; far faster
            @{n="Tier"; e={$viewThisVM = $_; ($viewThisVM.CustomValue | ?{$_.Key -eq ($viewThisVM.AvailableField | ?{$_.Name -eq "Tier"}).Key}).Value}}
      $MyCollection += $viewThisVM # we can delete this line, I was testing here.
    } ## end foreach
    $MyCollection | ConvertTo-HTML -Fragment | Set-Content c:\temp\test.htm
    If you test this part in your lab it works great.
    $arrViewPropertiesToGet = "Name","Summary.Runtime.PowerState","Config.GuestFullName","Summary.Config.Annotation","CustomValue","AvailableField"
    foreach ($cluster in Get-Cluster) {
        Get-View -ViewType VirtualMachine -Property $arrViewPropertiesToGet -SearchRoot $cluster.id | Select `
      @{n="VM name"; e={$_.Name}},
            @{n="Cluster"; e={$cluster.name}},
      #@{n="PowerState"; e={$_.Summary.Runtime.PowerState}},
            @{n="Guest OS"; e={$_.Config.GuestFullName}},
            @{n="Notes"; e={$_.Summary.Config.Annotation}},
            ## just using the data already retrieved; far faster
            @{n="Tier"; e={$viewThisVM = $_; ($viewThisVM.CustomValue | ?{$_.Key -eq ($viewThisVM.AvailableField | ?{$_.Name -eq "Tier"}).Key}).Value}}
    } ## end foreach
    I just need this part to export to a HTML Web Page.
    Thanks,

  • Primary key question with PHPmysql database

    I know that updating the primary key is taboo, but I have a a newsletter subscription form set up that works perfectly, but I can't figure out how to create the primary key.  I tried using the subscriber email address (because its unique, but in trying to add an update function I realize that the email address may need to be updated.
    My question is how do I get a primary key that will work when I'm relying on a form variable to create the record and therefore have no control over assigning one?
    Is there a way to have one automatically assigned when a subscriber hits the submit button?

    Bingo.
    I wrote:
    ALTER TABLE email_list  ADD (      id MEDIUMINT NOT NULL AUTO_INCREMENT,      name CHAR(30) NOT NULL,      PRIMARY KEY (id)  )
    I got my primary key column.  thank you so much!!!

  • SharePoint remote provider hosted apps - confusion around key questions

    For some time, I have been trying to get a provider hosted app setup to work, and I am afraid that I - as a relative novice - must have missed some key points despite hours of googling and reading. Here's my questions:
    A remote, provider hosted app, would have its AppWeb in a domain that is different from the host SharePoint Farm in which it is gets installed and used. In other words, the AppWeb may be located at remote.contoso-apps.com, where as the SharePoint farm uses
    for instance spslocal.mycorp.com. However, when you - in the SharePoint host farm - set up your App Domain/App isolation - you can only provide one value - which in this case would then need to be remote.contoso-apps.com??? Does that mean that each SharePoint
    Farm can only contain Apps from one vendor delivering remote apps? Or is the key in hard coding the app web in the manifest? (However, even if I've tried this it seems like the token SPAppWebUrl still translates into the pattern defined in the App Isolation
    Settings in the host farm???).
    Back to the AppWeb: Many bloggers have mentioned that you have to add some kind of SharePoint element to your App project (not the Web Project part) to get the AppWeb provisioned from Visual Studio 2013. But at what stage are these SharePoint elements actually
    provisioned - during some kind of publish operation of the Web Project part (the Pages, Scripts etc.) or when you install the app package (hardly the latter, since the first installation may be when a customer installs the app???). The reason I ask is (of
    course) that my SharePoint Elements do not seem to get provisioned. And just to test my very basic understanding: the AppWeb can be any pure IIS web site from the start - i.e., not a SharePoint Web App?
    Thanks for any help on these challenging issues!

    Paul,
    thanks for your effort, but unfortunately the answers do not get me much further.
    Question 1: You write "You can only use one domain, because cross-domain IFrame requests are blocked in SharePoint 2013". This is contrary to numerous other articles that explain how the SharePoint cross-domain library (SP.RequestExecutor.js) can be
    used to communicate across domains. From the outset, the whole idea about an AppWeb is - according to Microsoft documentation - that the AppWeb should be isolated from the HostWeb and therefore in a separate domain. 
    This article,
    http://msdn.microsoft.com/en-us/library/office/jj612823(v=office.15).aspx, even talks about scenarios where the SharePoint Host Web and App Web are in different security zones!
    So according to a load of other documentation it is indeeed a valid scenario I am addressing, but I still miss the key answers to the questions above. I suspect that the key is to hardcode certain URIs in your app that points to the cloud AppWeb
    (so the single App Domain specified in the Host Farm is not used at all), but I have failed to find the necessary documentation on this.
    Question 2: The article mentioned does not talk about the issues that I have asked about, specifically when the SharePoint elements in the App are created.
    Anyone with experience in this area? Thanks!

  • Composite Primary Key question

    I have a new question regarding composite primary keys on another table I have created.
    I have the following table with the following definition:
    CREATE TABLE "APSOM"."CPULIST"
    ( "CPU_ID" VARCHAR2(10 BYTE),
    "SERVER_ID" VARCHAR2(10 BYTE),
    "CREATED_DATETIME" TIMESTAMP (6),
    "UPDATED_DATETIME" TIMESTAMP (6)
    with the following composite PK definition:
    ALTER TABLE "APSOM"."CPULIST" ADD CONSTRAINT "CPULIST_PK" PRIMARY KEY ("CPU_ID", "SERVER_ID")
    Then, I inserted data in the following way:
    insert into CPULIST
    values ('CPU1', 'P1', SYSDATE, SYSDATE);
    with following CPU ID values from 'CPU1' to 'CPU16' for SERVER ID value 'P1' also inserted as well.
    Now, I am trying to insert values for SERVER ID value 'P2'
    insert into CPULIST
    values ('CPU1', 'P2', SYSDATE, SYSDATE);
    and I am getting the following error message:
    Error starting at line 1 in command:
    insert into CPULIST
    values ('CPU1', 'P2', SYSDATE, SYSDATE)
    Error report:
    SQL Error: ORA-00001: unique constraint (APSOM.XPKCPULIST) violated
    00001. 00000 - "unique constraint (%s.%s) violated"
    *Cause: An UPDATE or INSERT statement attempted to insert a duplicate key.
    For Trusted Oracle configured in DBMS MAC mode, you may see
    this message if a duplicate entry exists at a different level.
    *Action: Either remove the unique restriction or do not insert the key.
    Using the following SQL command:
    select column_name from all_cons_columns
    where constraint_name = 'CPULIST_PK'
    and owner = 'APSOM';
    I get the following records
    1. CPU_ID
    2. SERVER_ID
    This error does not make sense to me. Any help would be appreciated.
    Thanks,
    Patrick Quinn
    Operations
    Turning Point Global Solutions

    So, if there is a hidden unique constraint XPKCPULIST that cannot be pulled the all_cons_column table and I drop the XPXCPULIST constraint with the following SQL:
    alter table CPULIST drop constraint XPKCPULIST;
    Error starting at line 1 in command:
    alter table CPULIST drop constraint XPKCPULIST
    Error report:
    SQL Error: ORA-02443: Cannot drop constraint - nonexistent constraint
    02443. 00000 - "Cannot drop constraint - nonexistent constraint"
    *Cause:    alter table drop constraint <constraint_name>
    *Action:   make sure you supply correct constraint name.
    What can I do to get past this so I can perform the following insert and receive this error message??
    insert into CPULIST
    values ('CPU1', 'P2', SYSTIMESTAMP, SYSTIMESTAMP);
    Error starting at line 1 in command:
    insert into CPULIST
    values ('CPU1', 'P2', SYSTIMESTAMP, SYSTIMESTAMP)
    Error report:
    SQL Error: ORA-00001: unique constraint (APSOM.XPKCPULIST) violated
    00001. 00000 - "unique constraint (%s.%s) violated"
    *Cause:    An UPDATE or INSERT statement attempted to insert a duplicate key.
    For Trusted Oracle configured in DBMS MAC mode, you may see
    this message if a duplicate entry exists at a different level.
    *Action:   Either remove the unique restriction or do not insert the key.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Copying arrays, performance questions

    Hello there
    The JDK offers several ways to copy arrays so I ran some experiments to try and find out which would be the fastest.
    I was measuring the time it takes to copy large arrays of integers. I wrote a program that allocates arrays of various sizes, and copy them several times using different methods. Then I measured the time each method took using the NetBeans profiler and calculated the frequencies.
    Here are the results I obtained (click for full size):  http://i.share.pho.to/dc40172a_l.png
    (what I call in-place copy is just iterating through the array with a for loop and copying the values one by one)
    I generated a graph from those values:  http://i.share.pho.to/049e0f73_l.png
    A zoom on the interesting part: http://i.share.pho.to/a9e9a6a4_l.png
    According to these results, clone() becomes faster at some point (not sure why). I've re-ran these experiments a few times and it seems to always happen somewhere between 725 and 750.
    Now here are my questions:
    - Is what I did a valid and reliable way to test performances, or are my results completely irrelevant? And if it's not, what would be a smarter way to do this?
    - Will clone be faster than arraycopy past 750 items on any PC or will these results be influences by other factors?
    - Is there a way to write a method that would copy the array with optimal performances using clone and arraycopy, such that the cost of using it would be insignificant compared to systematically using one method over the other?
    - Any idea why clone() can become faster for bigger arrays? I know arraycopy is a native method, I didn't try to look into what it does exactly but I can't imagine it's doing anything more complicating than copying elements from one location in the memory to another... How can another method be faster than that?
    (just reminding I'm copying primitives, not objects)
    Thanks!
    Message was edited by: xStardust! Added links, mr forum decided to take away my images

    yeh, everyone thinks that at some point. it relies,
    however, on you being perfect and knowing everything
    in advance, which you aren't, and don't (no offence,
    the same applies to all of us!). time and time again,
    people do this up-front and discover that what they
    thought would be a bottleneck, isn't. plus,
    the JVM is much smarter at optimizing code than you
    think: trust it. the best way to get good performance
    out of your code is to write simple, straightforward
    good OO code. JVMs are at a point now where they can
    optimize java to outperform equivalent C/C++ code
    (no, really) but since they're written by human
    beings, who have real deadlines and targets, the
    optimizations that make it into a release are the
    most common ones. just write your application, and
    then see how it performs. trust me on this
    have a read of
    [url=http://java.sun.com/developer/technicalArticles/I
    nterviews/goetz_qa.html]this for more info anda chance to see where I plagiarized that post from :-)
    Thanks for that link you gave me :)
    Was usefull to read.
    About time and money of programming, that is not really an issue for me atm since i'm doing this project for a company, but through school (it's like working but not for money).
    Of course it should not last entirely long but I got time to figure out alot of things.
    For my next project I will try to focus some more on building first, optimizing performance later (if it can be done with a good margin, since it seems the biggest bottlenecks are not the code but things outside the code).
    @promethuuzz
    The idea was to put collection objects (an object that handles the orm objects initialized) in the request and pass them along to the jsp (this is all done through a customized mvc model).
    So I wanted to see if this method was performance heavy so I won't end up writing the entire app and finding out halve of it is very performance heavy :)

  • Array Module Question

    Hi,
    I am currently working on designing phase for an Array Module. We are planning to track the Array information and store it's content to database. Currently I am finalizing the data model and I have following question.
    --We need to track the Geneology of the Sample through out the whole system (Especially the results of Transfers). Is it better to have all that relationship in one flat table with columns for location (like PlateWell, GelLane…..) and columns for Content (Column like . LocationType  LocationId   ContentType ContentId) or is it better to store all the content of location as a ArrayType? Or is there any other option available in the Market?
    In the first case database rows for that table will increate very very fast plus to find out the geneology of the location in Array , I have to use Connect By Prior which will take good amount of time(Is there any other option available?). I don’t have much idea about second option but I think retrieval individual content is going to be a problem.
    Any help is really appreciated.
    Thanks in Advance
    Raj

    Made a complete example:
    String searchKey = "Juice";
    TreeMap tm = new TreeMap();
    tm.put("soda", "coke");
    tm.put("Juice", "orange");
    tm.put("SODA", "7-up");
    Set set = tm.entrySet();
    Iterator iterator = set.iterator();
    while( iterator.hasNext() ) {
    Map.Entry entry = (Map.Entry)iterator.next();
    if(entry.getKey().equals(searchKey)){
    System.out.println("searchKey '"+searchKey+"' value is: "+entry.getValue());
    What do you think? Anything obvious that can be improved?

  • ESB DbAdapter primary key question

    Hi,
    I have an ESB process that pushes data from a legacy table into the GL_INTERFACE table in Oracle E-Business Suite.
    The DbAdapter for reading from the legacy table had two primary keys defined. We've recently learned that these two fields do not always uniquely identify a record. If I had two records with the same data in these two fields, they would both be inserted into the destination table, but the data inserted for both records would be the same as that of the first record (seemingly ignoring the second record). I solved this problem by defining a third primary key relationship in the DbAdapter, and that worked fine.
    My question is this: why did both records inserted into the destination table contain the same data?
    Any ideas?
    Thanks in advance.

    The the table in the database doesn't have a primary key defined, but, of course, Oracle's DBAdapter requries primary keys defined. There were actually two records in the database, with the same information in the columns that I defined as primary keys, but other information was different for the two records. It seems as though the ESB used the data from the first record when it encountered the second. Am I correct that this is what happened?

  • Primary Key Question

    Probably a silly question - I'm fairly new to APEX and trying to design a small system. I come from a FORMS background, and would always have had my support tables with character keys e.g. Clubs - Club_code, varchar2(3), Club_name varchar2(30) with values like "ABC" and "CDE" as mnemonic primary keys. APEX seems to want a sequential PK on the tables used - is it feasible to use character PK fields, or better to go with the default functionality?
    Thanks
    Malcolm

    Hi Mal,
    like you I'm not a fan of sequence generated keys on everything, I think this was a design choice made by the Apex team in the early days of Apex (HTMLDB) when the intention was that Apex would be intended primarily for non-technical users. To me its an implementation choice and has nothing to do with relational design theory, and when working with new interfaces to existing systems, it may be a choice the developer does not have. I think it would just be simpler if the Apex developer had that choice when using the wizards.
    For ordinary forms it is not too difficult.
    1. Create a new page as a "Form on a Table with Report". Identify the PK field and set this as populated from an existing trigger.
    2. Edit the form page that was created. Edit the item created for the PK field. Set the "Display As" property under "Name" to "text field".
    3. Set the "Read Only Condition Type" property under "Read Only" to "Value of Item in Expression 1 is NOT NULL". Enter the name of the item in "Expression 1".
    Now when you run the report page, depending whether the table is empty you may see some rows. Regardless, you can click on the create button and it will take you to the form page with the PK text field enterable. You can enter a row of data and click create and you are taken back to the report page. Now when you click the edit link for a row in the report you will see that you are taken to the form page with the PK field is now Read Only. (Correct behaviour as PKs should not be updateable)
    Depending how you specified the link in the report page, you may also want to change the PK column to show the value of the column rather than an edit graphic. This can be done by editing the report page and then editing the Report Attributes of the report region. Edit the PK column from the list of columns and set the Link Text in the Column Link to the column name surrounded by # character. ie #P30_COL_NAME#. This can be quickly achieved by clicking the column name quick link just below.
    Unfortunately there is easy fix with the tabular forms wizard. You either have to create new Multi Row Update processes or possibly use the updateable views and instead of triggers method.
    Regards
    Andre

  • Math / array / matrix-question

    Hallo everybody,
    first of all: it's not a indesignscripting-  but general math-javascriptquestion. please be patient
    I've got a first (matrixlike-)array (won't change)
    var containers = [
    'container11', 'container12', 'container13', 'container14', 'container15',
    'container21', 'container22', 'container23', 'container24', 'container25',
    'container31', 'container32', 'container33', 'container34', 'container35',
    'container41', 'container42', 'container43', 'container44', 'container45',
    'container51', 'container52', 'container53', 'container54', 'container55'
    and I've got a second array:
    ["container14", "container25", "container34", "container44", "container54"] //this array may contain 3 up to 8 items
    My aim is to check if a part of 5 to 3 items of the second array is part of or equal to a row or column of the matrix-like-array.
    For example: "container34", "container44", "container54" or "container11", "container12", "container13", "container14" (as part of second array) would be a result I#m looking for. Note: I only want to find the 'biggest charge'!
    Hope it's getting clear and one of the math-cracks will have a idea.
    Addittional: there's no MUST to work with arrays. I can also store the data to a object or mixture ... and may fill it with numbers instead of strings ...
    To get it visible:
    https://dl.dropboxusercontent.com/spa/3ftsuc9opmid3j4/Exports/fourWins/fourWins.html
    Items can be dragged and dropped. After every dropp the arrays have to be compared ... and I#m searching for a nice and elegant solution
    May be someone's interested
    Hans

    Hi Hans,
    Just a quick note although your question is solved.
    Provided that your matrix is 5×5 you could easily map any element to a single character in the set { A, B..., Z } (for example).
    Then your problem can be reduced to some pattern matching algorithm, that is, finding the longest part of the input string within a 'flat string' that just concatenates the rows and the columns of the search matrix in the form ROW1|ROW2...|COL1|COL2...|COL5
    And you can create RegExp on the fly to compute the solution(s) with almost no effort:
    const MX_ORDER = 5;
    const MIN_MATCH = 3; // We need at least 3 contiguous items
    var bestMatrixMatch = function F(/*str[]*/ROWS, /*str*/ND)
    // NB: No check is made on ROWS, so make sure you supply
    //     MX_ORDER strings, each being MX_ORDER-sized
        // Put in cache some subroutines
        F.RES_TO_STR ||(F.RES_TO_STR = function()
                return localize("'%1' found in %2", this.result, this.location);
        F.ROWS_TO_HS ||(F.ROWS_TO_HS = function(R, C,i,j)
                for( i=0,C=[] ; i < MX_ORDER ; ++i )
                for( C[i]='',j=0 ; j < MX_ORDER ; C[i]+=R[j++][i] );
                return R.concat(C).join('|');
        // Vars
        var haystack = F.ROWS_TO_HS(ROWS),
            candidates = ND &&
                haystack.match( new RegExp('['+ND+']{'+MIN_MATCH+',}','g') ),
            t, p;
        if( !candidates ) return null;
        // Sort the candidates by increasing size
        candidates.sort( function(x,y){return x.length-y.length} );
        // Grab the matches and keep the best
        while( t=candidates.pop() )
            if( 0 > ND.indexOf(t) ) continue;
            p = 1+~~(haystack.indexOf(t)/(1+MX_ORDER));
            return {
                result:   t,
                location: (p<=MX_ORDER)?('Row #'+p):('Col #'+(p-MX_ORDER)),
                toString: F.RES_TO_STR,
        return null;
    // =================
    // Sample code
    // =================
    var rows = [
        "ABCDE",
        "FGHIJ",
        "KLMNO",
        "PQRST",
        "UVWXY"
    var needle = "EKLMINSX";
    // get the result
    var result = bestMatrixMatch(rows, needle);
    alert(
        "Searching the longest part of '" + needle + "' in:\r\r" +
        ' '+rows.join('\r').split('').join(' ') +
        '\r\r===============\r\r' +
        (result || "No result.")
    @+
    Marc

Maybe you are looking for

  • How to update Data Services (ALDSP 2.5) from WebLogic Server 9.2 correctly?

    Hi, I need to update some physical data service in ALDSP 2.5 on WLS 8.1 SP6 (8.1.6) via Static Mediator API from WebLogic Server 9.2 MP2 (9.2.2) application. I have reviewed the article about interoperability of ALDSP 2.5 and WLS 9 here: http://edocs

  • Problem with operations on photoshop layers

    I have a problem when I try to do some operations on the layouts like resize and rotate. To reproduce the problem follow these steps. Create a new creative suit extension project, select adobe Photoshop extended as csaw libraries. In the testPhotosho

  • No such option in settings bug

    Can anyone advise on how to go about reporting a bug in iTunes? iTunes support for Windows has an article which directs a user to select the [mobile] phone in the iTunes window and then "Click Settings and then select "Convert higher bit rate songs t

  • Problem in third party processing billing document

    dear all, I am facing problem in creating the billing document for third party processing. The error is : Item category ZEXM TAS cannot be invoiced by using billing type ZFAZ. I think the problem is  in copy control for billing document item . Kindly

  • How do I prevent losing work when down saving from CC to CS6?

    I'm working on a design and I have CC. I need to share it with a coworker, but they only have CS6. Will we have any problems working on the design on both platforms?