Fastest way to search large list

User will enter their account number into a web page. I then get a list from my database (will be about 100,000+ entries), and search to see if the account number is present, and forward to a new web page based on the results of the search.
Any thoughts on the fastest way to search a large list? The list has will have other data in it besides the account number.
My thoughts:
1. get the list
2. sort the list
3. use binary search?
List accountNumberList = getTheList();
Collections.sort(accountNumberList );Message was edited by:
chet0264

The first thing that comes to mind is "you should
learn some SQL".Yeah. Don't retrieve 100,000 entries from the database when you only need 1. Learn how to write a sql statement to retrieve only the account number you want.

Similar Messages

  • Is there a way to search contact list by keyboard

    is there a way to search the contacts list with the keyboard rather than scrolling down via letters? i have like 2000 contacts and some letters are really long. would be much better if there was a search box (like that for SMS) where I could input letters via the keyboard.
    does that exist? have i missed it?

    That feature is not available
    You can request it here:
    http://www.apple.com/feedback/iphone.html

  • Best way to handle large list of results in recordsets?

    Hello all.
    I'm using Dreamweaver CS3, MySQL and ASP/VBScript.
    My database of users behind my website is now approaching 25,000.
    I often have to "move" items in the database from one user record to another.
    Up and until now, I've done this simply by way of a drop down menu/list that is populated with the user ID# and Name of each and every user in the database.   This previously allowed me to simply select the ID of the Customer I wanted to "Move" the record to.
    The problem, is that the system is of course now trying to load a list of almost 25,000 user ID's each time I view the relevant site page, which is now taking so long to load it's uncomfortable.
    I've seen other sites that allow you to start typing something in to a text box and it starts filtering the results that match as you type, showing a list below.
    I assume (but am happy to be advised otherwise) that this is likely to be my best way forward, but I haven't the first clue how to do it.
    Can anyone advise?
    Regards
    David.

    You're looking for a 'type ahead' control. Try searching the web, although you may have trouble finding example code for classic asp. I did find some asp.net solutions out there.

  • Faster way to search linked list?

    I'm pretty new to programming and I have to write a kind of psuedo implementation of a cache using a linked list (has to be a linked list). The problem is when I'm setting the maximum size of the linked list to a high number (like 2000), it goes incredibly slow. I don't know how I can make this faster.
    Here are the 2 main methods I'm using for it:
    public void addObject(Object toAdd){
         cacheList.addFirst(toAdd);
         if(cacheList.size()>=maxAllowedSize){
              removeObject(maxAllowedSize-1);
    public boolean containsObject(Object toFind){
         boolean test=false;
         for(int x=0;x<cacheList.size();x++){
              if(toFind.equals(cacheList.get(x))){
                   test=true;
                   hits++;
                   removeObject(x);
                   addObject(toFind);
                   x=cacheList.size(); //ends for loop
         total++;
         return test;
    }Where maxAllowedSize is a command line argument and removeObject just calls cacheList.remove(index).
    For testing, I'm using a text file with something over 1.3 million words and using scanner to read them. Here is the code that calls the two methods:
    if(!cache.containsObject(currentWord)){
         cache.addObject(currentWord);
    }Since containsObject adds the word itself, this calls addObject if the word isn't found (added to the front of the list).
    Any help is greatly appreciated.

    darkambivalence wrote:
    Linked list is what was specified in my assignment.
    Then to be honest I expect that part of the learning of assignment is to see how a LinkedList is a poor choice for a list that you want to search.
    Why will that run poorly? Because what do you think remove is doing? The remove has to search to find the thing you want to remove. So it's doing that search twice. So it will be twice as slow.
    There really isn't much you can do to make this faster. LinkedLists are great for many reasons but "random" accessing (for searching for example) is not one of them. I suppose if one really wanted to squeeze out performance you could keep the list sorted. So when inserting insert into the "right" place in the list and then as you search if a value would fall in between two buckets and doesn't exist in your list you can stop there. A doubly linked list would probably help for this implementation.
    In the real world though you would either not use a LinkedList at all or a Map depending on the needs.

  • Fastest way to do a bitwise comparison of 2 large files

    Hello All,
    I have two relatively large files (memory dumps) of approx. 1 MB. Both files have the same size.
    I need to do a bitwise comparison of both the files. (one is the reference file, the other is the measured file)
    What is the fastest way of doing this? I need to know how many bitwise differences there are.
    I need to present the user with a percentage of how good the match between both files is and also the number of differences.
    Mayby later on I also need to list the differences.
    I was thinking about opening the files in binary mode, reading them out and converting them to boolean arrays and with the autoindexing of for-loops determining if there are differences. Probably there are much better ways for doing this.
    Your help is greatly appreciated!
    noxus.

    OK, here's a quick draft (LV 8.0) of what I meant. I assume you know how to read a file as U8 binary array, so let's start with two U8 arrays of equal length.
    The lookup table needs to be calculated only once, then you can replace it with a diagram constant. Still, it is very cheap to do.
    I doubt you can count the number of bit differences much faster that this.
    DIsplay all arrays in binary so you see what's going on. (# of differences" should probably be labeled # of bitwise differences").
    Message Edited by altenbach on 02-14-2007 02:50 PM
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    CountBitDifferences.png ‏8 KB
    CountBitDifferences.vi ‏13 KB

  • Fastest way to create a group from list of recived emails

    I thought this would be as easy as drag and drop but no such luck.
    Here's the situation.  I had a class of 25 students email me from their mobile phones all using the same subject.  Now I'd like to create a mailing list / group so that I can easly contact all of them if need be.  I tried creating a new group and dragging all of the emails into it to no avail.  I also tried right clicking and checking the menus to see if there were any options which there weren't.
    Anyone have any suggestions?  I'd be open to using automator or something similar if it worked.
    Thanks,
    Greg

    I think the fastest way to do this is in Mail>Message>Add to Address Book, then in AB>File>New Smart Group>Card:>Was updated After... say yesterday, then select all those & make a new (not Smart) Group to drag them to so it won't change after that.
    Unless you could get them all to eMail with some other unique that AB can see as a Group field.

  • The most efficient way to search a large String

    Hi All,
    2 Quick Questions
    QUESTION 1:
    I have about 50 String keywords -- I would like to use to search a big String object (between 300-3000 characters)
    Is the most efficient way to search it for my keywords like this ?
    if(myBigString.indexOf("string1")!=1 || myBigString.indexOf("string2")!=1 || myBigString.indexOf("string1")!=1 and so on for 50 strings.)
    System.out.println("it was found");
    QUESTION 2:
    Can someone help me out with a regular expression search of phone number in the format NNN-NNN-NNNN
    I would like it to return all instances of that pattern found on the page .
    I have done regular expressions, in javascript in vbscript but I have never done regular expressions in java.
    Thanks

    Answer 2:
    If you have the option of using Java 1.4, have a look at the new regular expressions library... whose package name I forget :-/ There have been articles published on it, both at JavaWorld and IBM's developerWorks.
    If you can't use Java 1.4, have a look at the jakarta regular expression projects, of which I think there are two (ORO and Perl-like, off the top of my head)
    http://jakarta.apache.org/
    Answer 1:
    If you have n search terms, and are searching through a string of length l (the haystack, as in looking for a needle in a haystack), then searching for each term in turn will take time O(n*l). In particular, it will take longer the more terms you add (in a linear fashion, assuming the haystack stays the same length)
    If this is sufficient, then do it! The simplest solution is (almost) always the easiest to maintain.
    An alternative is to create a finite state machine that defines the search terms (Or multiple parallel finite state machines would probably be easier). You can then loop over the haystack string a single time to find every search term at once. Such an algorithm will take O(n*k) time to construct the finite state information (given an average search term length of k), and then O(l) for the search. For a large number of search terms, or a very large search string, this method will be faster than the naive method.
    One example of a state-search for strings is the Boyer-Moore algorithm.
    http://www-igm.univ-mlv.fr/~lecroq/string/tunedbm.html
    Regards, and have fun,
    -Troy

  • Best way to block a large list of IP addresses

    I'm in the process of taking further steps to protect my home Web / SSH server from malicious attacks. The next thing I'd like to try doing is block a large list of known malicious IP addresses that I have listed in a text file.
    I followed the Arch Wiki and set up a simple stateful firewall using iptables, but now I'm a bit stuck...
    I tried using a little bash script to tell iptables to block all of the addresses in the list. It seemed clunky since it takes about 30 seconds for the script to run. Also, I'm not even sure where the best place would be to run the script in Arch Linux.
    I considered saving all of those blocked IP addresses in my actual iptables settings file, but I feel that would make it difficult for me to easily download and use a new list of malicious IP addresses.
    I looked into some other firewall applications. None of them seem to have the simplicity of iptables, but I may just be uneducated on the topic.
    So... Does anyone have a suggestion for easily blocking a large list of malicious IP addresses on my home server? Is it feasable to do with iptables? Should I use a different firewall application? Is it even worth it, security wise, to block these addresses?
    Thank you.

    Thank you for the suggestions. I like the how ipset is a software companion to iptables, so I decided to use that.
    ...and OH BOY has it been hard to grasp. I think I got it, though.
    Ok, so I have iptables loaded in my DAEMONS array. I created the directory "/etc/ipset/deny/" which now contains five files filled with lists of naughty IP addresses from here. I then created the script "/etc/ipset/init-deny" like so:
    #!/bin/bash
    # Create a set of naughty IP addresses
    ipset create denyset hash:net -quiet
    # Add the addresses to the set
    for ipaddress in $(egrep -h -v -E "^#|^$" /etc/ipset/deny/*); do
    ipset add denyset $ipaddress -quiet
    done
    # Tell iptables to ignore all addresses in the set
    iptables -I INPUT -m set --match-set denyset src -j DROP
    and call it from "/etc/rc.local". I think it works. (I can't ping any naughty addresses anymore) I think the only part I couldn't really understand was the match set line: whether I should use "--match-set denyset src" or "--match-set denyset src,dst".
    I'd love anymore feedback about this setup, especially in regards to where would be the proper place to load the ipset commands. "/etc/rc.local" just feels clunky.
    ...also, FYI, for some reason the Arch Linux forums IP address (176.9.18.112) is totally in that guy's list of "exploited" IP addresses.

  • Fastest way to print to screen?

    I am writing a chess program and I want to print to screen a series of moves, one on each line. E.g.
    A1->C3
    D2->E3
    A3->E3
    I am currently using System.out.print() to print each line separately, and I am wondering what is the fastest way to print them out to screen since the list of moves can get pretty long. I tried concatenating all the moves into a single large string then printing it out at once, but that seemed to be slower than printing each line individually.

    I wrote a simple program that looped, printing "XX->YY" to the cmd window in XP. A thousand lines printed in 110 milliseconds (1/10 of a second.)
    I think thats pretty fast. You probably have some other problem.

  • What's the fastest way to look up a User's Work Items?

    Hi, my SCSM environment has a few different service desks and plenty of customer drive-by's.  Sometimes when a customer comes up and asks for a status, the SD personnel can't find their ticket quickly. The fastest way right now is to 1.) click on CONFIGUATION
    ITEMS; 2.) Search for the Affected User; 3.) Click on the Affected User; 4.) Click on the Affected User's Related Items; 5.) Search the related items for the proper Work Item; 6.) Load the Work Item.
    It's not bad, but it's a lot of steps and I'm wondering if anybody has a faster method in place.

    Just to poke holes in the salesmanship, Consider that you might have an easier time in doing any of the following:
    Create a view that lists all open incidents, and make the first column Affected User. Analysts can filter or sort by this column to get quick info
    The search box in the top right corner can be set to users, right click the down arrow to see all options. 
    the search box in the top right can be used to search work item IDs or titles.

  • PowerShell - what is the most efficient/fastest way to find an object in an arraylist

    Hi
    I Work with a lot of array lists in PowerShell when working as a sharepoint administrator. I first used arrays but found them slow and jumped over to array lists.
    Often i want to find a specific object in the array list, but the respons-time varies a lot. Does anyone have code for doing this the most efficient way?
    Hope for some answers:-)
    brgs
    Bjorn

    Often i want to find a specific object in the array list, but the respons-time varies a lot. Does anyone have code for doing this the most efficient way?
    As you decided to use an ArrayList, you must keep your collection sorted, and then use the method BinarySearch() to find the objects your looking for.
    Consider using a dictionary, and if your objects are string type, then a StringDictionary.
    You stil fail to understand that he slowness is no in the arraylist.  It is in the creating of the arraylist which is completely unnecessary.  Set up a SharePoint servefr and create a very large list and test..  You will see. An arraylist
    with 10000 items takes forever to create. A simple SharePoint search can be done in a few milliseconds.
    Once created the lookup in any collection is dependent on the structure of the key and the type of collection.  A string key can be slow if it is a long key.
    The same rules apply to general database searches against an index.
    The main point here is that SharePoint IS a database and searching it as a database is the fastesst method.
    Prove me wrong devil!    Submit!  Back to your cage! Fie on thee!
    ¯\_(ツ)_/¯
    You seem to be making a lot of assumptions about what he's doing with those arraylists that doesn't seem justified based on no more information than there is in the posted question.
    [string](0..33|%{[char][int](46+("686552495351636652556262185355647068516270555358646562655775 0645570").substring(($_*2),2))})-replace " "

  • Different Color Text of Topic Titles by Child Project in Search Results List

    Does anyone know how I can change the text color to indicate the source project of a topic as displayed in the Search Results list?
    I have followed Peter Grainge's directions for setting up a parent project that has several child projects, one of which contains outdated version-specific information. Thanks, Peter!
    I would like it to be obvious to the user before they open a topic from the Search Results list that it is from the old legacy project.
    I have found where the font is set, (thanks to the RoboWizard), but I am not a Javascript programmer and am uncertain how to code the "if document is from this project, then use this font" logic.
    I would also like to put a "caption" below the "Search Results per page" line to explain the purpose of the color change.
    I am using RoboHelp HTML 8.0.2. I generate WebHelp output which is then FTP'd to our server.
    Thanks in advance!

    Hi Leon,
         Let me make sure that I understand your suggestion - I should change the title of each topic in the "legacy" knowledge base so that they each include a short identifier, such as "First Topic - Legacy"? If so, I suppose that would work, but I'd have to change 1,000 topics. The topic titles would no longer match the filenames (I'm trying to freeze changes to the old knowledge base to which there are many links from our user forum), which I suppose is not a big concern at this point.  I'll run some tests.
         That has also raised another question in my mind, but I'll post that separately. It's about the way Robohelp selects the text that is shown immediately after the title of the topic in the Search Results list.
         Thanks for taking the time to help!

  • Is there any way to tell which formulas a particular cell is in, reverse look-up style? That is, is there a way to search somehow for which formulas in a sheet contain a particular cell in them without opening all of them up? If not, it would be nice

    Is there any way to tell which formulas a particular cell is in, reverse look-up style? That is, is there a way to search somehow for which formulas in a sheet contain a particular cell in them without opening all of them up? If not, it would be nice.
    I'm fixing a Numbers document that I use in business daily that's become overly complicated, but while I want to clear/delete a number of cells in it to clean it up, I'm not sure if those cells are being used as source for other formulas on the page. I don't have to open all my formulas one by one to see if that cell is in there, do I?! That'd be a huge amount of work if I wanted to eliminate say 10 cells to search each formula on the page to see if it is in there or watch all the cells when I delete that cell to see if the numbers change! There's got to be an easier way! Right click doesn't seem to be any help.
    I don't want to damage my daily tool to make it cleaner and reorganize it. Is there really no way to do a reverse look-up of which formulas a particular cell is in?! Any time I click on a formula it highlights all the CELLS in that formula. Why can't I (or can I?) do the reverse and see all the FORMULAS that contain a particular cell?
    As a Numbers document ages or gets used frequently, you can sometimes forget which cells are tied to which formulas. You just look for the results of your formulas. Would be a nice thing to be able to do. Thoughts? Work-arounds? Answers?

    Answer would be no unless application provided such feature. Numbers does not as far as I know.
    Note that even if you have complete list of formulae used in a table, identifying formulae referencing any given cell is not simple.
    E.g., cell T20 is referenced not only in
    =T20+1
    but also in
    =SUM(T)
    =SUM(20:20)
    =SUM(S19:U22)
    =OFFSET(S1,19,1,1,1)
    =INDIRECT("T"&(10*2))
    In order to identify such formula, we have to actually evaluate it to see if it references the given cell. Especially such formula as OFFSET() and INDIRECT() may not be found by static parser because their parameters can be dynamic.
    Sorry to be the bearer of bad tidings.
    H

  • Is there a way to search for skipped songs in my iTunes library?

    I'd like to know whether there's a quicker way to find songs that are being skipped in my iTunes library, than simply manually checking each one.  I've been rearranging and deleting music files in Windows Explorer recently, so I know that there is a chance that I have demolished the link iTunes had to some of the files, but there's no way I can remember what all the modified albums are.  I know how to reestablish the links when I do find a song that is being skipped, but I'd love to go through the whole library and be able to find them all at once.
    The last time I did this, manually - and it seemed to take hours - I did find quite a lot of songs that were being skipped, and was able to reestablish the links or in some cases just delete the song from iTunes since i hadn't wanted it anyway.  But even then it was a little hard, since after manually checking in the quickest way I could - going through the song list and briefly playing each one for a second or fraction of a second - there was no way of sorting the songs by whether they were skipped or not.  I just had to be very careful as I scrolled, to catch each one that had the symbol indicating non-playability.
    All that to say - is there some better, automatic way of searching for non-playable, skipped songs, and is there some way of sorting them out from the rest so one can address them, and not miss any?

    Same question. Used to have an iPod. Lost it (best digital player ever), now I use other portable device. The mp3 files have their id3tag edited in the original file, but the .m4a don't!.
    Want to know someway to write the info from the library to the original .m4a files.

  • In the Podcasts app, is there any way to remove the list of recent podcasts that can be downloaded?

    Hi there,
    I'm wondering whether there's any way to remove all those recent podcasts (either unplayed or only partially played) listed as downloadable from the Podcasts app on the iPhone. If I'd wanted all these additional episodes on the phone, I would have put them there. I don't want them there, yet the app insists upon larding up my podcast lists with these useless episodes. Nor do I want to mark them all as "played." There's a reason some of them are only partially played and others not at all. I prefer to keep them marked that way in my master list. But I do not want them on the iPhone.
    I've tried searching online, but am not coming up with a solution. Do I have to go to some third-party app to have cleaner, tidier, and smaller lists? When I intend to carry around only three or four episodes for a given podcast, it is really REALLY annoying to have to pick through a list of forty-some-odd offerings to find the ones I want.
    I sure am hoping some techie-inclined soul has a solution for me.
    Odile

    we are working on server to server APIs that will allow you to fetch data (items) from node.
    when that is available you'll be able to get the user list from the UserManager node.

Maybe you are looking for

  • Editable regions in child page

    Hi all. Dreamweaver 8. I have a template with two editable regions, Header and Body. I have a new page, and I want to apply the template. I am prompted to move the content to the new regions. Is my new child page supposed to have editable regions wit

  • N8 Belle camera problem

    Hi  my N8 camera problem is when im click photos its not clearity im upgraded Anna to Belle Refresh also in Nokia Care plz help me for my N8 nd whats the problem gone Solved! Go to Solution. Attachments: 2013-03-19-025.jpg ‏1372 KB

  • How to See FM (RFFMS007)? What exactly is it?

    How to see FM (RFFMS007) in the system? What exactly is it? How do we use the tables in SAP? How to look for tables in FI and FM? What are the uses? How do we see the contents of the tables?

  • Script busy or not working

    FF or Google or Extreme Security cause? Upon opening FF, it crashes occasionally. I have version 3.6.23 with a Google FF search page and I use Zone Alarm Extreme Security's latest firewall, etc. When it does crash, I get a message as follows: A scrip

  • Can image metadata be a live link on a site?

    There is a photo portal. I upload images and I notice that the description and some other metada, shows as text below the photo. Is it possible to have that text  below the photo be a live link to a website? i.e. anchor text going out. thanks.