Difficulty in counting common words in two files

Hi friends
below is my code for comparing two text files and find out number of common words between them. but my code returns a number which exceeds the number of the total words of smaller file .WHY? it may be counting 2 if the same word appears twice in the larger file. How can I correct so that It should count 1 irrespective of the nu of occurences ?
public static void countsharing()
          counter=0;
          Iterator it=seta.iterator();
          while(it.hasNext())
               String compareString=(String)it.next();
               if(setb.contains(compareString))
                    counter++;
          System.out.println(counter);
          pw.println("total sharing : "+counter);
          pw.close();
Thanks

Hi Kajbj
Thanks for your reply. Still I having problem
My code is ike this can you please tell me where am I wrong. The count is cummulative.
reader1=new BufferedReader(new FileReader("C:\\data\\frequency\\final\\"+startNode));
               line1=reader1.readLine();
               while(line1 != null)
                    list1.add(line1);
                    startCounter++;
                    line1=reader1.readLine();     
               System.out.println(startNode+" keywords - "+startCounter);
               //pw.println(startNode+" keywords - "+startCounter);
               reader1.close();
               //t=br.readLine();
               //targetNode=t+".txt";
               targetCounter=0;
               reader2=new BufferedReader(new FileReader("C:\\data\\frequency\\final\\"+targetNode));
               line2=reader2.readLine();
               while(line2 != null)
                    targetCounter++;
                    list2.add(line2);
                    //System.out.println(line2);
                    line2=reader2.readLine();
               System.out.println(targetNode+"keywords - "+targetCounter);
                              //pw.println(targetNode+" keywords - "+targetCounter);
               reader2.close();
               countsharing();
               pw.close();
               s=br.readLine();     
     //sharing
     public static void countsharing()
          List common=new ArrayList(list1);
          common.retainAll(list2);
          System.out.println(common.size());
Thanks a lot once again.

Similar Messages

  • How to Create a batch file to display and count specific words in log file

    Hi All,
    I have requirement Program to be written that will go through a log file and look for following key words.
    Unexpected Essbase error
    And also it will count the # of times the word error appear in a log file.
    You may use batch file or Perl script to complete this task.
    e.g. in the log file - It will flag yes that keyword "Unexpected Essbase error" found and word error occurs 9 times.
    Pls help me in know process to achieve above requirement.
    and pls let me know what is perl scripting ?
    Thanks in Advance
    Regards,
    SM

    Sorry but it sounds like you have been asked to do something and you have pasted the requirement on the forum, have you done any research to find out which scripting language you are going to use or any find examples, there are so many differents examples and help on the internet it just takes a little bit of time and investment.
    Cheers
    John
    http://john-goodwin.blogspot.com/

  • Find word in text file and count specific words

    now I'll try to explain what I need to do. I have file.txt file, It looks like:
    John //first line - name
    One
    Three
    Four
    Peter //first line - name
    Two
    Three
    Elisa //first line - name
    One
    Three
    Albert //first line - name
    One
    Three
    Four
    Nicole //first line - name
    Two
    FourSo I have program's code:
    public class Testing {
            public static void main(String args[]) throws Exception {
                Scanner input = new Scanner(System.in);
                System.out.println("Select word from list:");
                System.out.println();
                try {
                    FileReader fr = new FileReader("src/lt/kvk/i3_2/test/List.txt"); // this is list of words, everything all right here
                    BufferedReader br = new BufferedReader(fr);
                    String s;
                    while((s = br.readLine()) != null) {
                        System.out.println(s);
                    fr.close();
                    String stilius = input.nextLine();   // eneter word which I want to count in File.txt
                    BufferedReader bf = new BufferedReader(new FileReader("src/lt/kvk/i3_2/test/File.txt")); // from this file I need to count word which I entered before
                    int counter = 0;               
                    String line;
                    System.out.println("Looking for information");
                    while (( line = bf.readLine()) != null){
                        int indexfound = line.indexOf(stilius);
                        if (indexfound > -1) {
                             counter++;
                    if (counter > 0) {
                        System.out.println("Word are repeated "+ counter + "times");}
                        else {
                        System.out.println("Error...");
                    bf.close();
                catch (IOException e) {
                    System.out.println("Error:" + e.toString());
            }This program counting specific word (entered by keyboard) in file.txt.
    I need to make this program: for ex.: if I enter word: One It must show:
    Word One repeated 3 times by John, Elisa, AlbertAll what I need to elect by who this word repeated. But I don't know really how to make It, maybe LinkedList or I dont know, someone could help me?
    Thank you very much.

    966676 wrote:
    All what I need to elect by who this word repeated. But I don't know really how to make It, maybe LinkedListYou should choose the simplest type fullfilling your needs. In this case I'd go for <tt>HashSet</tt> or <tt>ArrayList</tt>.
    or I dont know, someone could help me?You need to introduce a variable to store the actual name which must be resetted if an empty line is found and then gets assigned the verry next word in the file.
    bye
    TPD

  • Counting words within a file, please help!

    Hi i have written a program to read in a directories from inside another directory. I then want to count the files inside each of these directories.
    import java.util.*;
    import java.util.regex.Matcher;
    import java.util.regex.Pattern;
    import java.io.*;
    import java.nio.CharBuffer;
    import java.nio.MappedByteBuffer;
    import java.nio.channels.FileChannel;
    import java.nio.charset.Charset;
    import java.nio.charset.CharsetDecoder;
    public class CalculateMax {
              static int indentLevel = -1;
              static void ReadIn(File path) {
                List alist = new ArrayList();
                int count = 0;
                File files[];
                //keep track of directory level
                indentLevel++;
                files = path.listFiles();
                for (int i=0, n=files.length; i < n; i++) {
                  for (int indent=0; indent < indentLevel; indent++) {
                  System.out.println( files);
         try
         FileInputStream in1 = new FileInputStream(files[i]);
         FileChannel channel1 = in1.getChannel();
         int LengthOfFile1 = (int)channel1.size();
         MappedByteBuffer buffer1 = channel1.map(FileChannel.MapMode.READ_ONLY , 0, LengthOfFile1);
         Charset charset = Charset.forName("US-ASCII");
         //Transform the sequence of bytes in charset into Unicode characters.
         CharsetDecoder decoder = charset.newDecoder();
         CharBuffer charBuffer1 = decoder.decode(buffer1);
         Pattern endLine = Pattern.compile (".*$", Pattern.MULTILINE);
         Pattern wBreak = Pattern.compile ("[\\p{Digit}\\p{Punct}\\s]");
         Matcher matchLine1 = endLine.matcher(charBuffer1);
         while( matchLine1.find()) {
         CharSequence line1 = matchLine1.group();
         //Get the words in the line
         String words[] = wBreak.split(line1);
         for (int j = 0, k = words.length; j < k; j++) {
         if(words[j].length() > 0) {
         alist.add (words[j]);
         count++;
         catch(IOException ioe)
         System.err.println ("read error: " + ioe.getMessage());
    System.out.println("count : " + count);
         if (files[i].isDirectory()) {
         ReadIn(files[i]);
         indentLevel--;
         public static void main (String args[]) {
              ReadIn(new File("Data\\amy.smith\\"));
    The problem is that it seems to keeps reading in each inner directory as one files, so that the words in of every file in each directory are being added together instead of counting each seperately. Does anybody know where i am going wrong here? Any help would be greatly appreciated
    Thanks!

    Thanks! Im just after discovering a big problem with this method of reading the files however. I calling a method on each file i read in which returns an int value, what i need to then do is add together the ints within each directory, so for say:
    Data//amy.smith//file1.txt = 1
    Data//amy.smith//file2.txt = 5
    Data//amy.smith//file3.txt = 9
    it should return 15, but within the loop where the int value is returned i cannot find a way to add together only the ints within the same directory
    static void ReadDir(File path) {
                    int totals = 0;
                   int common = 0;
                File files[]; 
                indentLevel++;
                files = path.listFiles();
                for (int i=0, n=files.length; i < n; i++) {
                  for (int indent=0; indent < indentLevel; indent++) {
                   common = (findCommonWords(firstFile(),readFile(files)));
         words = totals(common, totalF1(), totalF2(files[i])));
         //add words together here for the files in each directory
         if (files[i].isDirectory()) {
         ReadDir(files[i]);
         indentLevel--; // and going up
         //System.out.println(list1);
    Does anybody know how i could do this. I would greatly appreciate any help
    Thanks

  • How to get common datas from two int.tables

    hi,
    please tell me , how to i will get the common datas between two int. tables
    & place them in third int. table.
    give me syntax.
    regards
    subhasis.

    Hi Subhasis,
    <b>SORT :</b></u>
    SORT itab.
    Extras:
    1. ... BY f1 f2 ... fn
    2. ... ASCENDING
    3. ... DESCENDING
    4. ... AS TEXT
    5. ... STABLE
    The syntax check performed in an ABAP Objects context is stricter than in other ABAP areas. See Field symbols not allowed as sort criterion.
    Effect
    The entries in the internal table are sorted in ascending order using the key from the table definition (DATA, TYPES).
    Addition 1
    ... BY f1 f2 ... fn
    Effect
    Uses the sort key defined by the sub-fields f1, f2, ..., fn of the table itab instead of the table key. The fields can be of any type; even number fields and tables are allowed.
    You can also specify the sort fields dynamically in the form (name). If name is blank at runtime, the sort field is ignored. If itab is a table with a header line, you can also use a field symbol pointing to the header line of itab as a dynamic sort criterion. A field symbol that is not assigned is ignored. If a field symbol is assigned, but does not point to the header line of the internal table, a runtime error occurs.
    If the line type of the internal table contains object reference variables as components, or the entire line type is a reference variable, you can use the attributes of the object to which a reference is pointing in a line as sort criteria (see Attributes of Objects as the Key of an Internal Table.
    You can address the entire line of an internal table as the key using the pseudocomponent TABLE_LINE. This is particularly relevant for tables with a non-structured line type when you want to address the whole line as the key of the table (see also Pseudocomponent TABLE_LINE With Internal Tables).
    If you use one of the additions 2 to 5 before BY, it applies to all fields of the sort key by default. You can also specify these additions after each individual sort field f1, f2, ..., fn. For each key field, this defines an individual sort rule which overrides the default.
    Addition 2
    ... ASCENDING
    Effect
    Sorts in ascending order. This is also the default if no sort order is specified directly after SORT. For this reason, it is not necessary to specify ASCENDING explicitly as the default sort order.
    With the addition BY, you can also specify ASCENDING directly after a sort field to define ascending order explicitly as the sort sequence for this field.
    Addition 3
    ... DESCENDING
    Effect
    Sorts in descending order. If the addition comes right after SORT, DESCENDING is taken as the default for all fields of the sort key.
    With the addition BY, you can also specify DESCENDING directly after a sort field.
    Addition 4
    ... AS TEXT
    Effect
    Text fields are sorted appropriate to the locale. This means that the relative order of characters is defined according to the text environment being used.
    When an internal mode is opened (in other words, when a roll area is opened), the text environment is automatically set to the logon language specified in the user master record. If necessary, however, you can change the text environment explicitly in your program by using a SET-LOCALE statement.
    If the addition comes directly after itab, locale-specific rules are used for all fields of the sort key where the type of these fields is C or W. After the sort, the sequence of entries usually does not match the sequence which results otherwise, without using the addition AS TEXT, i.e. with binary sorting.
    With the addition BY, you can also specify AS TEXT directly after a sort field, provided it is of type C or W, or a structured type. Otherwise, a runtime error occurs. In sort fields with a structured type, AS TEXT only affects subcomponents with type C or W.
    In case of an invalid character, a SYSLOG message is written, and the respective record is inserted at the end.
    Note
    Please keep the rules for site-specific sorting in mind.
    Example
    Sort a name table with different keys:
    TYPES: BEGIN OF PERSON_TYPE,
             NAME(10)   TYPE C,
             AGE        TYPE I,
             COUNTRY(3) TYPE C,
           END OF PERSON_TYPE.
    DATA: PERSON TYPE STANDARD TABLE OF PERSON_TYPE WITH
                      NON-UNIQUE DEFAULT KEY INITIAL SIZE 5,
          WA_PERSON TYPE PERSON_TYPE.
    WA_PERSON-NAME    = 'Muller'. WA_PERSON-AGE = 22.
    WA_PERSON-COUNTRY = 'USA'.
    APPEND WA_PERSON TO PERSON.
    WA_PERSON-NAME    = 'Moller'. WA_PERSON-AGE = 25.
    WA_PERSON-COUNTRY = 'FRG'.
    APPEND WA_PERSON TO PERSON.
    WA_PERSON-NAME    = 'Möller'. WA_PERSON-AGE = 22.
    WA_PERSON-COUNTRY = 'USA'.
    APPEND WA_PERSON TO PERSON.
    WA_PERSON-NAME    = 'Miller'. WA_PERSON-AGE = 23.
    WA_PERSON-COUNTRY = 'USA'.
    APPEND WA_PERSON TO PERSON.
    SORT PERSON.
    Now, the sequence of the table entries is as follows:
    Miller  23  USA
    Moller  25  FRG
    Muller  22  USA
    Möller  22  USA
    If, for example, you apply German sort rules where the umlaut comes directly after the letter 'o' in the sort, the data record beginning with 'Möller' would not be in the right place in this sequence. It should come second.
    Provided a German-language locale is set (e.g. sorting is according to German grammatical rules, see also SET LOCALE), you can sort the names according to German rules as follows:
    SORT PERSON BY NAME AS TEXT.
    Now, the sequence of table entries is as follows:
    Miller  23  USA
    Moller  25  FRG
    Möller  22  USA
    Muller  22  USA
    Further examples:
    SORT PERSON DESCENDING BY COUNTRY AGE NAME.
    Now, the sequence of table entries is as follows:
    Miller  23  USA
    Möller  22  USA
    Muller  22  USA
    Moller  25  FRG
    SORT PERSON DESCENDING BY AGE ASCENDING NAME AS TEXT.
    Now, the sequence of table entries is as follows:
    Muller  22  USA
    Möller  22  USA
    Miller  23  USA
    Moller  25  FRG
    Addition 5
    ... STABLE
    Effect
    Uses a stable sort, that is, the relative sequence of entries that have the same sort key remains unchanged.
    Unlike additions 2 to 4, you cannot use this addition directly after a sort field.
    Notes
    General:
    The number of sort fields is restricted to 250.
    The sort process is only stable if you use the STABLE addition. Otherwise, a predefined sequence of fields used to sort a list is not usually retained.
    It does not make sense to use the SORT command for a SORTED TABLE. If the table type is statically declared, the system returns a syntax error if you try to SORT the table. If the table type is not statically declared (for example, because the table was passed to a FORM routine as an INDEX TABLE in a parameter), and the system can interpret the SORT statement as an empty operation, it ignores the statement. This is the case when the key in the BY clause corresponds to the beginning of the table key. Otherwise, a runtime error occurs.
    To delete all duplicate entries from a sorted internal table (e.g. just after SORT), you can use the DELETE ADJACENT DUPLICATES FROM itab statement.
    When using the addition AS TEXT, the sequence of entries after the sort does not usually match the sequence resulting from a binary sort, i.e. if the addition AS TEXT is not specified. The consequence of this is that after the SORT, you are not allowed to access with the READ TABLE itab ... BINARY SEARCH statement.
    If you still want to access data sorted apppropriate to the locale with a binary search, you can do this by including an additional component in the table where you can explictly store the data formatted using the CONVERT TEXT ... INTO SORTABLE CODE statement. This is also recommended for performance reasons if you have to re-sort the table several times according to locale-specific criteria.
    If the internal table has more than 2^19 lines or is larger than 12 MB, the system sorts it physically using an external auxiliary file. You can specify the directory in which the file should be created using the SAP profile parameter DIR_SORTTMP. By default, the system uses the SAP data directory (SAP profile parameter DIR_DATA).
    Notes
    Performance:
    The runtime required to sort an internal table increases with the number of entries and the length of the sort key.
    Sorting an internal table with 100 entries with a 50 byte key requires about 1300 msn (standardized microseconds). Using a 30-byte key, the runtime is about 950 msn.
    If one of the specified sort criteria is itself an internal table, SORT may sometimes take much longer.
    The runtime increases if you use a stable sort.
    Physical sorting reduces the runtime required for subsequent sequential processing.
    Reward If Useful.
    Regards,
    Chitra

  • A word on RAW files

    With more hobbyists and prosumers using Aperture, a quick word on RAW files.
    RAW files are not image files in the traditional sense .... in fact they are really gray scale files of luminance (brightness) values that are collected from receptors on the CMOS or CCD array.
    Array, often called a Bayer Array after the engineer who designed the sensor. The CCD/CMOS sensor is an odd affair. It (other than Fuji, Sigma) is invariably a diagonal array of photo receptors, each with a color filter over it. The accuracy of the filter to the defined value of Red, or Green or Blue means that interpretation is needed to make it look the same as the standard value ...... at every brightness level from zero (no light) to full (saturated). These two items, color accuracy and brightness mapping are part of RAW conversion.
    The other non-obvious thin g about the array is that it has more green sensors than reds or blues. Why? Because our eyes see more green in daily life since its in the middle of our visible spectrum. Sensors are rather dumb and stupid about this, not having a brain and all to back them up. Well, they would if we took the jpg's from the camera, but we'd be restricted to whatever the developer said was the "right" answer under all lighting and contrast conditions .... exactly why we want to control the RAW processing, and use our brains and judgement, right?
    So, twice as many greens? Yes. But it gets trickier. Since we want to interpret a tone (color) and shade (brightness) for a pixel, we somehow need to map 3 colors (or as we've just discovered 3 colors and a 2nd green) to each pixel. This feat is called interpolation. How it's done is perhaps as much art as science since our eye does not see colors the same at low light levels as it does at mid or bright levels. That brain again helps out! Again we need to use that same brain to help refine the image we see coming out of the RAW processing engine.
    But there's yet another problem. Our eyes and brain in combination are freakily fantastic. Despite the microscopic size of those sensors on the CCD/CMOS imager, they are in a geometric array .... and although we can't see them directly, we become immediately aware of them when we see output from it. So a "demosaic" or moire filter needs to be applied to soften the geometric nature of the array. And each array is different and needs different filtering.
    So, lots and lots of interpretation is needed before the thing that's captured can be recognized as an image on our screens. How one company (Adobe, Apple, or camera manufacturer etc.) does this is proprietary to them, and so no edits on RAW's can be moved from one software company to another unless you take a resolved version .... jpg, tiff, psd etc.

    Most digital cameras use the Bayer pattern colour filter array for their sensor. In a Bayer Pattern CFA, we have a rectangular array of pixels, and each pixel either has a green, red, or blue filter on it. There are variants to this pattern, the complementary CMY system, RGB+clear etc. Some cameras use diagonal arrays of pixels, but these are less common. Fuji have a pattern with large and small pixels, which is unique to them. I'll talk only about the standard RGGB Bayer Pattern here, that most cameras use.
    The repeating pattern is something like this:
    R G R G
    G B G B
    R G R G
    G B G B
    There are one red, and one blue pixel for every pair of green pixels. This is due to green being the largest component of luma, and hence most easily perceived as contributing most to detail.
    Sensors convert light hitting the pixels into a an electrical charge, then to a voltage that gets converted into a digital signal. This digital signal will represent, linearly, the amount of light that hit that pixel. Black, however, in the raw signal may not be at zero, and blacked off calibration areas of the sensor will be recorded to allow for an absolute value for black to be found, and hence give properly linear data for the RAW conversion.
    The first stage in RAW conversion is to demosaic the data, which is to interpolate the missing values from the CFA, ie what is green on the red and blue pixels, what is blue on the red and green pixels and what is red on the green and blue pixels. Once this is done, we have a red, green and blue value at each pixel. The demosaicing process can be as complex or as simple as you like. There are as many methods as I've had hot dinners, so it's not suitable for me to go through the current work in this field, but a quick google will help you find more info if it's something that interests you. Most algorithms work on a much larger area of pixels than just the immediate surrounding ones for the algorithm, and this can vastly improve the quality of the conversion.
    Demosaicing can lead to image artifacts. These can be exacerbated in cameras that do not have, or do not have adequate optical low pass filtering ahead of the image sensor. That's a topic for another essay though! Moire is one symptom of inadequate filtering, and in Bayer CFAs mostly shows up as chroma moire because there are half as many red and blue pixels as there are green, and hence they are sampled at a lower rate. Chroma Moire, to a great extent, can be visually eliminated with clever RAW processing, however moire in general cannot easily be eliminated once it gets into a image.
    Here are some of the main types of artifacts you may see:
    "zippering" often caused by over-simplistic interpolation on the green pixels. The edges of straight lines can look like a zipper
    "parquet floor" often caused by a simple adaptive algorithm for interpolation getting confused by high local detail
    "chroma fringes" are a problem inherent in Bayer CFAs, but can be made worse by some algorithms, and often eliminated by others.
    The next stage in processing is on the RGB data to perform colour space conversion from the camera RGB space to a known RGB space, and white balance etc. We still have linear data at this point, and that's very important for such calculations. Finally, a tonal curve will be used to map from linear light data to a pleasing tonal representation for viewing.
    Graeme

  • Is there a download and convert in a single step option in the flashdownloader 2.6.8. add-on? I end up with two files, one downloaded original and one converted to my chosen format.

    Files are downloaded and only then encoded, so I end up with two files in the drive.

    That has been like that since Firefox 3.0 was released in June 2008 - 7 major version releases thus far with it like that and the developers haven't changed it - so I wouldn't count on it.
    When I want to save a duplicate bookmark, I just "grab" the website image in the Location Bar and drag it into the Bookmarks Sidebar, into the folder where I want it placed. On Windows and Linux, { Ctrl + B } opens the sidebar and then just drag.

  • How to find out the common things between two rpds?

    How to find out the common things between two rpds? And place the common things in a common RPD.

    I thought of one solution.
    Original RPD = A
    Modified RPD = B
    XML Patch created for A-B = X
    Now open the XML Patch in IE or Mozilla and delete the columns/tables/variable/etc,. from the Original RPD A.
    But its a cumbersome process, if the XML file is of very less size its Ok. If its 10-20 MB then going line by line and deleting the change is not the process to be followed.
    I have to check whether its just the delete or modify or drop.
    Let me know your thoughts.

  • Create PDF from two files in sub folder automation

    I am looking to create an automation tool that does the following to help save time (the current process takes about 20 min):
    First, take two specific files (The first page is a single worksheet excel file that is fitted to one page.  The second is a word document.)  in a user defined location and combine them into one document.  Currently this is done manually through Acrobat 8 via the Create PDF function for each file then the Combine PDF function.
    Second, I would like to have the Bookmark and Attachment pane set for initial view, but there is not a preset option for this.  Is this even possible?  Currently, I set the initial view to bookmarks and page, and include a not one the first page on how to open the attachment pane.
    Third, all external links to documents, via hyperlinks, are added as attachements and the links are changed to point to the attachment so that all information is contained within one document.
    Lastly, this newly created document is posted to an intranet location.
    Any help in part or whole would be great.
    NOTE:  All code must be included as an add-in to Acrobat as this is within a corporate environment and server side scripts are not allowed.

    I have created the following script as a start to trying to figure this out, but I am getting unexpected results.  When I run this script, I get the two files, Temp and Combined.  The Temp file is, as expected, a pdf version of the last file in the array, but the Combined file is where the problem is.  With the Combined file, I have one blank page, then my single worksheet from the workbook, and then only the first page of the word document which is 26 pages.  Any idea what I am doing wrong?
    In addition, is there a way to prompt the user to select the filepath through a Windows Explorer interface?
    Current code:
    var filepath = "/c/filepath/"
    // Create a new PDF document for Profile:
    doc = app.newDoc();
    doc.saveAs({ cPath: filepath + "Temp.pdf" });
    doc.closeDoc(true);
    doc = app.openDoc({cPath: filepath + "Temp.pdf" })
    // List of files of different extensions
    aFiles = new Array( "Doc1.xls", "Doc1.doc");
    for ( var i=0; i < aFiles.length; i++) {
    // Open and convert the document
    newDoc = app.openDoc({
    oDoc: doc,
    cPath: aFiles[i],
    bUseConv: true
    // Save the new PDF file to a temp folder
    newDoc.saveAs({ cPath: filepath + "Combined.pdf" });
    // Close it without notice
    newDoc.closeDoc(true);
    // Now insert that PDF file just saved to the end of the first document
    doc.insertPages ({
    nPage: doc.numPages-1,
    cPath: filepath + "Combined.pdf",
    nStart: 0

  • In your experience what are the most common errors in binding files when deploying?

    As the title suggest I'm interested in discussing the most common errors in binding files when deploying.
    Reason for this is that I'm currently working on a Powershell script that can parse a binding file and create a reader friendly report (rtf format) with various information.
    But the main purpose for this script is to find common errors in the binding file used. And so far these are the ones I've thought of:
    - Tracking enabled for either services or the pipelines they are using (if it's a binding meant for Prod).
    - Orchestrations logical ports not having any ports bound to them.
    - URI containing certain words that's not ok. For example if a binding meant for Prod contains the word "test" anywhere in the URI then that should be reported in the created rtf report. This also applies vice versa.
    So now I need your help with coming up with more ideas on common errors that need to be looked after and reported on if found! 
    Additional features the report should contain:
    - Listing the details of each orchestration, send port, receive port along with their associated receive location(s). To better understand and get a quick overview on exactly what settings are planned to be deployed. Especially the "TransportTypeData"
    section which otherwise can be quite tedious to read.
    - List each unique host instance, so that I can easier see directly which ones might need a restart after an import.
    I'd appreciate if you can come up with any more features that should be included in this script.
    /Christian @ IntegrationAdmin.com

    Filter on send port not on the same line as the Filter tag.
    This one is a nice one, I ran into it several times. Mostly after copy/paste of a port definition for a binding file, because Visual Studio is formatting after paste the XML in a way the filter will get invalid. This leads to a cryptic error
    during importing the binding.
    http://winterdom.com/2008/06/biztalkfiltersnotgettingimported
    Jean-Paul Smit | Didago IT Consultancy
    Blog |
    Twitter | LinkedIn
    MCTS BizTalk 2006/2010 + Certified SOA Architect
    Please indicate "Mark as Answer" if this post has answered the question.

  • Sender File adpater to Pick Two files at a time based on the file name

    Hi Everyone,
    I have a scenario where I need to pick two files at a time using file adapter where the two files names have a common string in between their names.For example , the file names can be sets like
    H123.txt and L123.txt
    H345.txt and L345.txt.
    Now how do we handle this in the File Adapter ?

    Anu,
    Two approaches.
    1.     Use BPM: use a collect pattern to pick those files: L and H files , use multi mapping to merge those files and map to IDoc. Constraint is that there must be a mandatory correlation field in both the files. Say a same po id  in L and H file.
    2.     Use an Adapter module with additional files option in file Adapter. Operate on the Main payload and attachment inside your module code to get a combined contents of both files and proceed.
    Module is preferable in terms of performance, but maintenance is difficult. Deployment after each changes, transport issues, etc.
    BPM is resource intensive, but easy to maintain, transport.
    Choose based on your requirement.
    Regards,
    Sudharshan N A

  • How to count bit patterns in a file ?

    Think of the following:
    You have two files that you want to compare bit by bit.
    A file has been send the other one has been received.
    The two files can be of different size (Connection lost).
    But you not only want to know how many bits are different you want also to know the run length of the different bits.
    For example:
    File 1:                      1010101011101010111101011001
    File 2:                      1011101010001101010111010101
    What is the result ?
    Xor File1 and File2:   0001000001100111101010001100
    Run Length 1:           3
    Run Length 2:           2
    Run Length 3:           0
    Run Length 4:           1
    I hope I didn't make a mistake.
    Think also of using a blocksize for comparison.
    Maybe you don't want to compare the files as a whole but want to know the number of errors for every block that is maybe 256 bit or 1024 bit. So read the files block by block, xor the blocks and count the bit errors by their run length.
    So how can I get this result in LabView ?
    Which data types do I have to take for comparison ? Which VIs do I have to use ?
    Thanx for help and your time

    Hi Allen,
    thanks for your posting.
    I have now a working version.
    For my as LabView newbee this was really hard work.
    So how many bit patterns of "1" or "11" or "111" or "1111" are in the xor result of the two files ?
    Or you can also ask: How long is the error (Burst error) ? And how often does it occur ?
    Look for example for block error codes and this stuff.
    Attached is the VI and two small text files (Both 10 Bytes).
    I've tried a blocksize of 10 Bytes and also 5 Bytes.
    The result is:
    1     2     3      4
    16   5     1      1
    So there 16 errors of run length 1, 5 of run length 2 and so on.
    Would be also nice to count special bit patterns like '1001101010111" or something like that.
    But I think this is more easy.
    Not the pattern is searched. The first 1 and the following 0 is searched.
    The run length is used as index.
    Attachments:
    Filediff 4.vi ‏32 KB
    Kopie1 von REAMDE.txt ‏1 KB
    Kopie2 von REAMDE.txt ‏1 KB

  • With Yahoo! Mail attachments are put together in zip format I can't open, but when I switch to Internet Explorer these same attachments open easily as Word or PDF files; how cn I fix?

    Two recent emails (Yahoo! Mail) each contained multiple attachments which were presented to me as zip files which were in a format that my computer could neither open or convert to files I could open. One was two Word documents; the other was five one-page PDFs. I tried with Firefox on two different computers with same results. When I switched to Internet Explorer, I was able to open the attachments each as separate Word or PDF files, with no trouble. Am I doing something wrong?

    instead of writing such an essay, you could have explained better what you tried to do to get them.

  • Adding of two files occurances

    Hi ,
    I  am adding two files to one and sending to receiver in this if I get N as occurance of file1 and M as occurance of file2 then I need to get N+M occurance for received file
    for exaple if I have 2 occurance and file 1 and 3 occurance for file 2 at this time I need to get 5 as occurance for receiver file
    for this please guid how to achive this logic
    regards
    Krishna

    Hi,
    Since in your case there are 2 source files coming, so you need to use a BPM with 2 receivers for the 2 source files, one each in one of the branches of a fork, i.e you need a fork step with 2 branches. Then after the fork step , you need to insert a transformation step where you have to do the required message mapping.
    After the message mapping, insert a send step which will send the output of the message mapping to the intended receiver.
    In the message mapping, you need to have 2 source structures for the 2 source files i.e. there should be 2 source message types in the message mapping. Then you need to use the count node function for both the source messages to count the number of occurrences of the parent node in each of them, and then use the add  node function to count the total number of occurrences of the target node and map this to the target side's parent node.
    After that, simple map the child node of both the source structures directly to the child node in the target side.
    MT1                                                                               
    <Node1>                                                                               
    <child1>                                                                               
    MT_TARGET
                                                         <NODE>
                                                           <child>
                                                                                    MT2
      <Node2>
            <child2>   
    Map both <child1> and <child2>   with the same child as shown above for <child1> of MT1 of source         
    That's it. Hope this helps you
    Thanks
    Biswajit
    Edited by: 007biswa on Feb 14, 2011 12:16 PM
    Edited by: 007biswa on Feb 14, 2011 12:17 PM

  • Which Algorithm to search two files

    hi everyone, I am a Computer Science student and I am new to java. I just got a project.
    Would anyone please suggest me which algorith is best to use for it, please?
    Thanks a lot:
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    I need to Write a java program which takes two files and tells me which words in the second file also occur in the first file, and which words do not.
    The program should run as fast as possible.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    The Project:
    1)Take in two filenames as arguments
    ---1st file: List of words in alphabetical order, containing 10000 words
    ----2nd file: Set of query words (not ordered), containing 10000 words
    2)Print out the set of query words from the queries file, with beside each word a �y� if the word occurs in the alphabetical-list file, and a �n� if not.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Sample File and output:
    1st file: apple banana cabbage grape
    2nd file: queries.txt: potato cabbage turnip
    java Project1 list.txt queries.txtpotato n
    cabbage y
    turnip n
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Thank you for reading this far.

    I'm not going to do your homework for you, but if you load the list of words into something like a java.util.ArrayList, you can then use the static method java.util.Collections.binarySearch( List list, Object key ).

Maybe you are looking for