Searching 2D array for duplicates

Hi There. I wonder if someone can help.
I have a 2D array of strings (resulting from a database query) One col is a list of job numbers and the other is a list of dates. My SQL query produces results for distinct job numbers and distinct dates. So if there are entries in the database where a job number is split between two or more dates, there will be two (or more) entries.
SELECT DISTINCT SONumber, DateEstimatedShip FROM JobDetails WHERE jobdetails.status <700
What I am trying to do is search through the list of job numbers and list out in a separate array the numbers that are duplicated. I've tried to do this by passing the raw 2D array into a indexing tunnel in a for loop. Then check if there are any duplicates from the next position down in the array to the end. This works fine, but if there are any items that are duplicated more than once I get two entries in my list of duplicates - as in my example below job number 3466 is listed twice as it has three entries in the raw sql table.
How can I turn this array into a list of just the numbers that are duplicated (with no duplicates within it)
I hope I've explained this to a satisfactory level.
Any thoughts will be greatly appreciated.

You can perform a second search on your 'list of duplicates' array using the same input as your first search, then if the second search index is <0 you can insert into the 'list of duplicates' array.
(Norbert beat me by a few seconds...)
Message Edited by Phillip Brooks on 12-02-2009 07:58 AM
Now is the right time to use %^<%Y-%m-%dT%H:%M:%S%3uZ>T
If you don't hate time zones, you're not a real programmer.
"You are what you don't automate"
Inplaceness is synonymous with insidiousness

Similar Messages

  • How can I search my library for duplicates?

    Is it possible for iPhoto to search the entire library for duplicate photos?

    Hi iMikey,
    No, iPhoto does not have this option.
    You might wait until iPhoto diet gets updated for iPhoto 6 and then try it. Please read all the documentation first.
    To get back some of the space your iPhoto Library is taking up on your hard drive you can use http://pages.cpsc.ucalgary.ca/~fuhrer/personal/freestuff/iphotodiet/iPhoto Diet
    Quoted from the web site:
    iPhoto Diet is a utility that helps to slim down your iPhoto library by manipulating your photos in the following ways:
    *eliminate duplicate photos created internally by iPhoto or imported by yourself
    *remove iPhoto's backups of rotated or modified photos
    *strip the thumbnail icons of your photos
    *remove thumbnail photos that have become mixed up with your high resolution photos
    *identify photos which have not been added to albums
    weed out unnecessary folders and files from the library
    and more!
    I suggest you read through the entire page because it expalins what iPhoto does and how it does it.
    If you say to yourself "I can go through the originals folders right in the Finder and get rid of the images I no longer want" then you need to read On iPhoto 5, Originals, and GUI Scripting which will explain what happens if you do it yourself.

  • How to Search and Array for multiple occurrences of a value

    Hi,
    I am trying to search an array of doubles for a number and report the index location(s) of a number. I.e. -allow for repetition. Search and report all index[i] where the number is contained in the array. For example I have
    double[] myInputArray = new double[5];
    double[] myInputArray = { 1, 2, 3, 3, 5 }I know how to search through the array ONCE and return the first occurrence of a number:
    public double GetIndexOf(double Number) {
        for (int i=0; i<myInputArray.length; i++) {
             if (myInputArray[i] == Number){
                  return(i);
        return(-1);
      }How do I expand this code to report multiple index[i] locations if the number reoccurs in the array like the number 3 does in my example array above?

    The way the Java libraries do this type of operation (String.indexOf(), etc) is to specify the starting index along with what you want to find.
    Changing your example slightly (notice how I fixed your naming and more importantly, your return type):
    public int indexOf(double num) {
       return indexOf(num, 0);
    public int indexOf(double num, int fromIndex) {
        for (int i=fromIndex; i<myInputArray.length; i++) {
             if (myInputArray[i] == num){
                  return(i);
        return(-1);
    //usage to get all indices:
    for ( int index = -1; (index = indexOf(num, index+1)) != -1; ) {
       System.out.println(index);
    }Note that due to how floating point numbers work, you may find doing this on doubles (or any other operation that uses == with double arguments) to give you unexpected results.

  • Search timestamp array for a specific value

    Hello,
    I need some help creating a VI that will allow me to do some data post-processing.  The problem is multifaceted, so help on any aspect will be of great help.  The end goal of the VI will allow the user to select two times, intial and final, and create a plot based on the corresponding data vs. the time selected, and output to a .jpg. 
    1.  How do I find the index of the time array?  Right now, no matter what time value i input, the index is zero.  The time input should only be significant at most to seconds.
    2.  How do i select all the values between the two chosen times?
    3.  Is there a better way to read in my .tdm file?
    4.  Documentation on exporting plots?  I also have Diadem.
    Attached is the VI that im working with.  The post unfortunately does not allow .tdm files.  I can't say that i've gotten very far, so any advice would be much appreciated.
    Alex
    Attachments:
    post-analysis.vi ‏50 KB

    The "Threshold 1D Array" works in a similar manner as the "Search 1D Array" except that it doesn't try to find an exact match. It finds the two array elements between which your search value falls. It then tells you a fractional index that basically tells you where it falls between those two values. So, a value of 2.5 means it falls smack in the middle between the third and fourth elements of the array. A value of 2.1 means it would fall just after the third element, and a value of 2.9 means it would fall just before the fourth element. The one caveat is that the array must be monotonically increasing. The "Interpolate 1D Array" can be used to interpolate a value given the fractional index. In your case it isn't really necessary - I was showing it for demonstration.
    As to your specific question, I'm not sure which array you're talking about. When you run the VI does the "32bit ingerer" indicator give you the correct index based on the timestamp that you're looking for?

  • Searching 1D array for data present in lookup 1D array.

    Hi!,
    I have a sorted 1D array of strings(say initial array) and I have
    three lookup array of string(say array A, array B and array C). I want
    to search the initial array with array A, array B and array C and then
    create a new array Final which will contain the elements of array A,
    if any, its start index and its last index and then element sof
    arrayB, if any found, its start index and its end index and then
    element of array C its start index and its end index.
    The start index and end index are stored in different indicatrs for
    all the three found.
    How do I search elements of 1D array with another 1D array?
    TIA,
    RK

    There are probably several ways to do it. One way to do it you would create a For Loop with the initial array run into it with auto-indexing turned off. You would then run array A into it with auto-indexing turned on. Inside of the loop, you would use a Search Array to find the index (if any) of the element in the initial array that matched the auto-indexed element of Array A. You will want to either build an array of only the indexes >=0 (trapping the "not found" -1) or you can autoindex the results and have you later code deal with them.
    You will need three of these loops, one for each searching array. Or better, you could push it into a subVI and call it three times.
    I hope that this helps!
    Bob Young
    Bob Young - Test Engineer - Lapsed Certified LabVIEW Developer
    DISTek Integration, Inc. - NI Alliance Member
    mailto:[email protected]

  • PSE10 Crashes when searching for duplicate photos

    Hello,
    I recently upgraded to PSE10 and imported my catalog from a different machine (which had been running XP).  Unfortunately, I ended up with a bunch of duplicate entries in the catalog, one with the path c:\users\... the other with c:\my documents\...  These paths both point to the same image on the hard drive.
    When I try to Search for Duplicate Photos (from Find>By Visual Searches), PSE invariably crashes.  I am running PSE10 under Windows 7 (full system info at the end of this message).
    Any idea why this might be happening, and is there a different way I can remove the duplicate entries in the catalog?
    Thanks,
    Chris
    Full system info:
    Elements Organizer 10.0.0.0
    Core Version: 10.0 (20110914.m.17521)
    Language Version: 10.0 (20110914.m.17521)
    Current Catalog:
    Catalog Name: My Photos
    Catalog Location: C:\ProgramData\Adobe\Elements Organizer\Catalogs\My Photos\
    Catalog Size: 52.3MB
    Catalog Cache Size: 391.7MB
    System:
    Operating System Name: Windows 7
    Operating System Version: 6.1
    System Architecture: Intel CPU Family:6 Model:5 Stepping:2 with MMX, SSE Integer, SSE FP
    Built-in Memory: 3.8GB
    Free Memory: 705.3MB
    Important Drivers / Plug-ins / Libraries:
    Microsoft DirectX Version: 9.0
    Apple QuickTime Version: Not installed
    Adobe Reader Version: 10.1
    Adobe Acrobat Version: Not installed
    CD and DVD drives:
    F: (hp DVDRAM BUS: 1 ID: 1 Firmware: GT20L)

    If I understand well, what you are calling 'duplicates' are duplicate entries in the catalog, the same media being called either by its original path+filename or shortcut path+filename.
    The organizer will try open two different files to compare them, but when trying to open the second 'shortcut', the file will be already blocked (in use). That could explain the failure of the comparison for similarity.
    Try creating a new catalog with similar images, for instance jpegs and png copies. Does the visual search work ?
    About backup and restore : If my supposition is right, that should work if you try to restore to a new custom location with keeping the file structure : the backup should create real file duplicates on different paths. If it works, finding visual duplicate should work, although this process may take a very long time.

  • Tell me Logic for search for duplicate words(or strings) in a large file.

    Search for duplicate words (or strings) in a text file containing one word per line. For each word that occurs more than once in the flat file output should be as follows
    <word> <number of occurrences> <line numbers in the file where the word occurs>
    For example, if the word Hello occurs thrice in a file at lines 100, 178 and 3456 the output should read
    Hello, 3, [100, 178, 3456]

    Incidentally i wrote similar code some days back. You need to do some modifications to get the exact output you want, but i hope it will be of some help.
    One more thing its written using JAVA5
    public class Test
         private static final String COLLECTIONS_TEXT = "C:\\Documents and Settings\\amrainder\\Desktop\\Collections.txt";
         public static void main(String[] args) throws IOException
              findDuplicateWords();
         private static void findDuplicateWords() throws IOException
              Collection<String> words = new LinkedHashSet<String>();
              File file = new File(COLLECTIONS_TEXT);
              StreamTokenizer streamTokenizer = new StreamTokenizer(new FileReader(file));
              int token = streamTokenizer.nextToken();
              while(token != StreamTokenizer.TT_EOF)
                   if(token == StreamTokenizer.TT_WORD)
                        words.add(streamTokenizer.sval);
                   token = streamTokenizer.nextToken();
              System.out.println(words);
    }Cheers,
    Amrainder

  • Optimizing a search for duplicate files in a filesystem

    We have a large directory that people have been dumping to for years (~200k files), and I want to go through and look for duplicate files. The first part of this was just scanning through and checking for duplicate file names.  I wrote a simple VI to serarch for duplicates, but it is very inefficiant because of multiple string comparisons. Even optimized as much as I could think to do, I'm only scanning about 1k files / minute.  I have attached my code - any help would be appreciated.
    Attachments:
    search.vi ‏22 KB

    This is trivial using the variant attributes mentioned earlier.  Attached is my method which uses the Variant Repository XNode I developed.  Not sure on performance comparisions.
    EDIT:  I'm betting the thing that will take the longest will be performing the MD5, I'm sure a CRC32 could be done faster which is probably just as good in this situation, or even a sum of the bytes of the file as a quick way of identifying the file.
    Unofficial Forum Rules and Guidelines - Hooovahh - LabVIEW Overlord
    If 10 out of 10 experts in any field say something is bad, you should probably take their opinion seriously.
    Attachments:
    Find Duplicate Files.vi ‏23 KB

  • Can I search for duplicates in iPhoto 9.2.3?

    I believe earlier versions had a "search for duplicates" function.

    No, no earlier version did.
    For dealing with duplicates in iPhoto check out Duplicate Annihilator or Decloner or iPhoto Duplicate Cleaner

  • No "search for Duplicates" found in address book

    Hey, on my intel imac I've got no "search for duplicates" available to me in Address Book. It shows up in my macbook, and my lampstand powerbook. All three are running 10.4.10, Adressbook is Version 3.1.2 (321)
    Also, when I sync with .Mac it doubles up all of my entries in the libraries on both computers.
    Any ideas?

    AB search should search notes. quit Address book and delete the file homedirectory/library/application support/address book/AddressBook-v22.abcddb. then start Address Book and see if search works correctly now. if it doesn't reindex your hard drive with spotlight. add your hard drive to spotlight's privacy pane for a few seconds and then remove it from there. wait for reindexing to finish and try AB search again.

  • How can I search for duplicate photos in iPhoto libraries?

    How can I search for duplicate photos in iPhoto 9.5.1 library.  Installed on iMac 2.7 GHz Intel Core i5, Mavericks 10.9.5.

    These applications will identify and help remove duplicate photos from an iPhoto Library:
    iPhoto Library Manager - $29.95
    Duplicate Annihilator - $7.95 - only app able to detect duplicate thumbnail files or faces files when an iPhoto 8 or earlier library has been imported into another.
    PhotoSweeper - $9.95 - This app can search by comparing the image's bitmaps or histograms thus finding duplicates with different file names and dates.
    DeCloner - $19.95 - can find duplicates in iPhoto Libraries or in folders on the HD.
    DupliFinder - $7 - shows which events the photos are in.
    iPhoto AppleScript to Remove Duplicates - Free
    PhotoDedupo - $4.99 (App Store) -  this app has a "similar" search feature which is like PhotoSweeper's bitmap comparison.  It found all duplicates
    Duplicate Cleaner for iPhoto - free - was able to recognize the duplicated HDR and normal files from an iPhone shooting in HDR
    Some users have reported that PhotoSweeper did the best in finding all of the dups in their library: iphoto has duplicated many photos, how...: Apple Support Communities.
    If you have an iPhone and have it set to keep the normal photo when shooting HDR photos the two image files that are created will be duplicates in a manner of speaking (same image) but there are only twp apps that detected the iPhone HDR and normal photos as being duplicates:  PhotoSweeper and Duplicate Cleaner for iPhoto.  None of the other apps detected those two files as being duplicates as they look for file name as well as other attributes and the two files from the iPhone have different file names.
    iPLM, however, is the best all around iPhoto utility as it can do so much more than just find duplicates.  IMO it's a must have tool if using iPhoto.

  • How to search for duplicate files?

    Is there a quick and easy way to search for duplicate files? (and other space hogs) I would like to do some hard drive spring cleaning. Trying to free up some space. Any suggestions? Thanks in advance, Carl

    Here are some apps to try:
    Singular, http://www.emeraldion.it/software/macosx/singular.html
    DupeCheck, http://dfay.fastmail.fm/dupecheck/ (uses the terminal suff and Spotlight under the hood)
    FileBuddy, http://www.skytag.com/filebuddy/

  • Search for duplicate

    hi there.
    i am running though an issue with looking for duplicates.
    right now. my vi is searching for the duplicate, once it is found, it will display "duplicate found".
    i am facing a new problem. lets say i have 10 devices and 10 positions those devices goes into my test box.
    position 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
    the device that read position 0, and 2 is close to one another. so when a device is put into position 0, it can be read on position 2. 
    and 2 can be read on position 4, 
    and 4 can be read on position 6,
    so then 1,3 --- and 3,5 ---- and 5,7 
    and so forth.
    thats because the hardware i designed didn't take into that consideration. 
    so now i think its best to fix the  software.
    does anyone have an idea of how to get rid of the DUPLICATE if the position is 2 positions away?
    i have created a vi that generated what i started. 
    Message Edited by krispiekream on 08-18-2008 06:00 PM
    Best regards,
    Krispiekream
    Attachments:
    duplicatefound.vi ‏21 KB
    untitled.PNG ‏14 KB

    i think this is what i have in mind.
    Message Edited by krispiekream on 08-18-2008 08:27 PM
    Best regards,
    Krispiekream
    Attachments:
    duplicatefound_mod2.vi ‏31 KB
    untitled.PNG ‏39 KB

  • Is it possible to search for Duplicates in Aperture v3.1

    Hi Guys,
    I'm hoping you guys can help me,
    I'm re-scanning my family photo archive at a much higher resolution,
    and i can't seem to find a way of searching for duplicates of the same image, but at different resolutions.
    i have achieved this in the past using "ExpressionMedia2" (previously called "iViewMediaPro"),
    This program had a command to "Search for Similar",
    with a slider to move from close match to exact match,
    which was pretty accurate, no matter what size the images were.
    I'm tempted to use this program,
    but i'm not sure how Aperture will handle images that have been deleted by another program.
    and how can i strip orphaned previews out of the Aperture Library ?
    I'm new to Aperture, and like it's way of working,
    but, it's very powerful and does have many un-intuitive commands within it
    Hoping you guys can help me,
    billy

    Aperture has no in-library dupe detection. It only has it on import.
    As for other apps deleting files from the Aperture library -- they shouldn't do that. If they are merely deleting a file at the Finder level ( that is referenced into AP), then that image will be marked as Missing in Aperture. You can do a Find for all those your self, or you can make a smart album, then delete at your convenience.

  • Searching bookmarks for duplicates?

    I am wondering if there is a utility that will allow me to search my favorites/bookmarks etc for duplicates and alllow me to trim them down. IE in OS9 holds a lot of them but I have a similar problem in other programs. Thanks

    Hi, Glen -
    Don't know about other apps, but in IE you can use IE's built-in search function in its Favorites to manually check.
    To do that, the Favorites (bookmarks) window must be frontmost - select Organize Favorites from the Favorites menu (the Organize Favorites item itself - not any of its submenus). This will open the Favorites window and bring it to the front (I leave it open all the time in the background).
    Then just press Command-F - a standard search box will come up. Enter your search string and click the Find button. Command-G can be used to do additional finds using the same search string.

Maybe you are looking for

  • Find Index for max value of array

    I can use arrayMax to get the max value for a small array, but I need to get which index the max value is located. That will determine which page the user goes to next. Here is my code: array: <cfset arrAverages[1]="#qryFairness.fairness#"/> <cfset a

  • Display no longer functions correctly after update

    After updating this morning (the only package updated being wayland), the display on my main computer (laptop still works fine) no longer works properly. It is a bit difficult to describe the problem: there is a constantly changing display of symbols

  • Tables for Basic end date and work center for operation

    Hi! I need table name to fetch the basic end date of a maintenance order and maintenance work centers with respect to each operation in maintenance order. Regards, VM Edited by: V M on Jul 20, 2010 7:22 AM Edited by: V M on Jul 20, 2010 7:35 AM

  • Smart form conversion in PDF

    Hi Guys, I have one query in the smartforms, I can able to convert the smartform to PDF and saving the PDF in my DESKTOP directly with showing the POP_UP, when i choose the print preview in the POP-UP screen. *My Requirement is : I need to display th

  • Need Formatted html output from Xalan

    We use xalan xslt processor to convert xml document to html. Everything works fine, except the output is unformatted html. (ie. several HTML elements appear on the same line. Some lines are longer than 1000 characters). This happens inspite of me spe