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

Similar Messages

  • How to count words in a PDF file?

    Is there any way I can count words in a PDF file without resorting to Acrobat Reader (which apparently has that feature)?
    That's a massive program, which I actually don't like.
    I need to count words in the PDF file because I write my papers with LaTeX, and they're full of my extensive comments.
    Do you know of any alternative?

    that utility IIRC cannot be found on xpdf (the official Archlinux package) anymore and its part of poppler
    edit: its pdftotext btw
    Last edited by dolby (2008-05-11 13:35:05)

  • How to search a pattern in a file and loop

         I have a csv config file:
    HLR, /data/hlr1.csv
    HLR, /data/hlr2.csv
    PCMR, /data/pcmr.csv
    XYZ, /pkg/xyz4.csv
    I have a shell script which will be passed a parameter. This parameter I need to lookup in the first field of the cofig file and display the corresponding second field in the config file. For example if the parameter passed to shell script is HLR I need to lookup the config file and should retrieve:
    /data/hlr1.csv
    /data/hlr2.csv

    An example (it might be done in other ways) :
    # cat config.csv
    HLR, /data/hlr1.csv
    HLR, /data/hlr2.csv
    PCMR, /data/pcmr.csv
    XYZ, /pkg/xyz4.csv
    # grep HLR config.csv | cut -f2 -d" "
    /data/hlr1.csv
    /data/hlr2.csv
    # grep XYZ config.csv | cut -f2 -d" "
    /pkg/xyz4.csv
    If you need a loop you can do something like this
    # cat config.sh
    grep $1 config.csv | cut -f2 -d" " | while read FILE
    do
            echo $FILE
            # do here something else
    done

  • How to count number of lines in a file?

    I am using a BufferedReader to read my file, but I like to know how to count the number of lines in a file is there a way to do that in Buffered Reader or do I have to use FileInputLineStream?

    Well, if you know how to read one line with a Buffered reader, and you know how to keep reading lines until you run out, then all you have to to is initialize a counter to zero before you start reading, add 1 to it each time you read a line, and then examine its value when you're done.
    Try that, and post again if you get stuck.
    Just be careful how you construct your loop. "Off by one" errors are a common way to get bitten. It could happen if you count what you think is the last line, but you've actually already counted all the lines and you end up counting one extra for "there are no more lines".

  • How to count no. of pages in tif file

    Hi all,
    how to count the no. of pages in tiff file?

    Well google could tell you.
    The first hit on tif java pages gave me this link
    [http://java.sun.com/products/java-media/jai/iio.html|http://java.sun.com/products/java-media/jai/iio.html]
    On that page it has a desctiption of waht you want and even a link to a code sample..
    HTH,
    Lima

  • Count the number of occurences of a pattern in some files

    Hi,
    I am trying to extract some patterns in files using regex. I can easily extract the patterns using my program. I also wanted to count the number of occurences of the pattern in the files. For that I have written this code:
    int count=0;
              while (m.find())
                 System.out.println("Found Patterns: "+m.group());
                 count++;
           System.out.println(count);  //giving error saying identifier expectedUnfortunately I am getting an error saying identifier expected at the count line. What to do?
    Thanks

    Cheapside-Poultry wrote:
    Move the } down one line so the count is in scope.No, it looks like he just forgot the opening { with the while.                                                                                                                                                                                                                                                                                                                                       

  • How to count the number or rows in file

    Hi Experts,
    I am file as source and Oracle as target. My file containing the some data which is going to load to the target.
    My requirement is that I want to count the number of rows which my file contains. Please help me how to count the total number of rows in file.
    Thx,
    Sahadeva.

    Hi,
    You won't give a name DEST_USER_NAME:ODI will get these information.
    it is important  Command on source and Command on Source side .
    -Pls write jython code on Command on Source side
    -And Command On Target side Choose technology as Oracle and set logical schema to HR_logical
    Sorry my mistake.İt is related jython syntax.Here is code:
    import java.lang as lang
    import java.sql as sql
    import java.lang.String
    import os
    lang.Class.forName("<%=snpRef.getInfo("DEST_JAVA_DRIVER")%>")
    cons=sql.DriverManager.getConnection("<%=snpRef.getInfo("DEST_JAVA_URL")%>", "<%=snpRef.getInfo("DEST_USER_NAME")%>", "<%=snpRef.getInfo("DEST_PASS")%>")
    dblinks= cons.createStatement()
    file1=open('EMP.txt','r')
    count=0
    line=file1.readline()
    while line !='':
         count+=1
         line=file1.readline()
    file1.close()
    sqlQuery = "insert into HR.ETL_FILE_LOG (FILE_COUNT) values (count)"
    rqQuery= dblinks.execute(sqlDBLink)
    cons.close()
    Regards

  • How can I remove the 'all files' pattern in the file dialog?

    Is it possible to remove the *.* pattern from the file dialog? I want my users to only see my own made patterns...
    Thx!

    Hi Dennis,
    you can add custom patterns with the pattern input, but you cannot remove the "All files (*.*)" pattern. To remove it was the question.
    But I'm sorry I have also no solution to this.
    Waldemar
    Waldemar
    Using 7.1.1, 8.5.1, 8.6.1, 2009 on XP and RT
    Don't forget to give Kudos to good answers and/or questions

  • Reg: how to count no.of records in flat file

    Hi,
    Very god morning to all, i faced a one problem like this, i am new to jython code.my problem is i want count the no.of records flat file before loading to the table, is there any easiest way to count the number records in file rather than jython ?
    please share immediately.
    Regards,
    sh

    Hi actdi,
    Thanks for giving reply, i am working in windows environment, and my previous project developers use the coding like
    below:
    filesrc = open('#filename','r')
    first=filesrc.readline()
    lines = 0
    while first:
    lines+=1
    first=filesrc.readline()
    s1=str(lines)
    s2= ' in the file ------'
    s3='#filename'
    final = s1 + s2 + s3
    raise ' \n\n The Number of Lines in the File are ---' , final
    see this code they are wrote in a procedure but i have a doubt with this , where it finally stores the row count.
    Kindly share if u have any solutions reg this in windows env.
    Regards,
    sh.

  • How to Count total number of Words in PDF?

    I am used Adobe Acrobat javascript inbuilt function getPageNumWords(<pagenumber>) it return the number of words present in specified page, but while am copy and paste text content from PDF file to MS Word, Words count given by MS Word is little bit differ, so any one know in which aspect Acrobat count the words?
    Which words count result is correct?
    Shall is go with Acrobat Words count result or MS Words count result?
    But I want to count the total number of words in PDF file (my input is PDF file) else can I go with iText?
    Words count in PDf using iText is possible?

    Word counts are likely to vary a little according to how you count. For instance, are hyphenated words one or two words? What if the hyphen is at the end of a line? Do numbers count as words? Headers and footers? Captions?
    Generally, you just accept a slight variation. If you are counting words in a professional context, i.e. where payment is per word, you probably need a contractual definition of how words are to be counted; in the absence of one, I suggest you use Word.

  • How come pages won't open PDF files made by Pages?

    How come pages won't open PDF files made by Pages?
    I have files I made with Pages and exported as PDF but I can't open them with pages to edit?
    Also, where are the recent files created by pages located? Can't find those to open either..

    Hi Tom,
    I was delighted when I signed up for Pages. Clunky yes, but it worked. I've been a graphic designer on a Mac for 25 plus years and have logged too many horror stories of "upgrade" wars which cost me massive lost time, data and money forcibly extracted just so I could finish a project.
    When I first used Pages in April of 2012? or there about, I was able to open Word documents exported to .pdf format, emailed to me, which I then dragged into Pages. I could make the changes I needed to make, export as a .pdf, return it back to my client which they could then edit on whatever it was they were using. I'm not a neophyte with this. I've had Original Photoshop as a stand alone, Quark (which locked users out 6 months after I purchased it.) Quark again, Freehand, Pagemaker, Illustrator, Photoshop again, Creative Suite for several upgrades, Acrobat Pro. 2 years ago I lost 6 years of Quicken data and had to and "upgrade" start over. This last go around I  had to "upgrade" my Apple ID - yes I had 2 on purpose, lost my Pandora One and my ability to get into the Tulsa County Library website.
    At this point, I'm retired and feel like what I've paid for in the past should WORK today. I have a 100+ page cookbook in Quark which I was able to export as a .pdf, that I've lost the tags too, Easier to start over. I have artwork that is hundreds of megs in Photoshop. Not the least bit interested in anybody's "cloud".
    Thanks for letting me vent. I'm determined to keep my equipment and software up to date so I can enjoy the skills I've acquired, but I completely cringe at Apple's antics. I truly hate it when I have to respond to some new "tip" or product offer. BooHiss. Happy Turkey Day. Pages is a "turkey" program.
    Best regards, mbd

  • How can i export a 24bit avi file from photoshop for mac?

    how can i export a 24bit avi file from photoshop for mac? i have a client that specificly needs the files to be avi and in 24bit what are the settings that i need to use to export the video using photoshop on a mac?

    Hello,
      To make a 24-bit AVI file in Photoshop, go to File>Export>Render Video. Then, under File Options, choose AVI from the Quicktime Export drop-down menu. Click the Settings button. Click the Settings button in the AVI Settings window. Change Compression to None, and then choose "Millions of Colors" from the Depth drop-down under Compression.
      The Millions of Colors option is for 24-bit video (8-bit R+G+B channels, 8x3=24). Millions of Colors+ is for 32-bit video (24-bit video plus an 8-bit alpha channel).
    -Brett

  • How can I delete the photos or files in my iCloud storage that is no longer needed?

    How can I delete the photos or files in my icloud storage that is no longer needed?

    Explain how it didn't work and what you are trying to delete.  Since icloud doesn't store photos except for those in a backup (then delete the backup); photos in photo stream do not count towards your storage limit.

  • How can I convert the ringtone (m4r file) I made into an mp3 file on itunes?

    How can I convert the ringtone (m4r file) that I made into an mp3 file on iTunes? I want to put it on a CD, but I can't figure out how to convert it. I didn't buy it, I made it by converting a YouTube video into an mp3 (I wanted to get the little song in the video for a ringtone.) I'm not sure what to do. 

    Hello ed2345,
    Thanks for the help, but this is not the problem.
    It's hard to describe the problem, but I'll try it again, this time with pictures.
    I was left with the following folders in the iTunes Downloads folder.
    http://www.picfront.org/d/7yb3
    These TMP Folders have a download.m4a and a Info.plist file.
    After moving the audio files in iTunes a bit I get this.
    http://www.picfront.org/d/7yb2
    As you can see no other Information for the download.m4a than the length.
    That's how the .m4p file looks like
    http://www.picfront.org/d/7yb1
    And this is how the same .m4a file currently looks
    http://www.picfront.org/d/7yb0
    Like I said, I could edit all these download.m4a files by myself but that would leave some information out.
    Note: Sorry, I hope the links do not spam you with annoying ads. I don't get any but I was told that there can be some annoying one.

  • How to count number of autoextents that had took place between a period.

    urgent question
    Hi all
    how to provide me a report for getting the result of the Disk Drive Space usage (drive letter) that shows how quickly the space is being used up by the database(dbf files).
    Or how to count the number of autoextents that had took place between a certain period of time.
    either by cmd promt or OEM would be fine
    Oracle database 10g(single instance)
    OS:Windows 2003 server
    thanks
    Anto

    hi justin and Pavan
    First Thanks for your immediate responce,
    Secoundly client has asked for the growth report at the OS level and not at the database level. but the growth is with respect to the autoextent feature that oracle has over the datafiles.
    I was thinking that i could get a view or some history log to get this data retrieved from the past may be of a months data.I normally manually check the data base growth with the following script
    SELECT total_space,free_space,
    (NVL(total_space,2)-NVL(free_space,2) ) used_space
    FROM (select round(SUM(Bytes/1024/1024/1024),2) Total_space
    from DBA_data_files
    (select round(SUM(Bytes/1024/1024/1024),2) free_space
    from DBA_free_space
    but this is Oracle DB level.
    Any ideas for the report.like a query or somewhere in OEM
    Thanks
    Anto

Maybe you are looking for

  • Nat/pat asa 5505 asdm ver 8.4

    hi all, i have a problem with portfoarwarding on asa 5505. i have this situation: internet ---> pubblic ip address-> router albacom -- 10.0.0.15 ---> -nat farward port 80--10.0.0.1 -outside -firewall asa -inside - 192.168.0.1------------server web 19

  • Storing Foreign Characters in oracle 9i Lite Client Database.

    Hi All, My Database configuration Is RDBMS VERSION 9.0.1.1.1 NLS_CHARACTERSET AL32UTF8 NLS_NCHAR_CHARACTERSET AL16UTF16 NLS_LANGUAGE AMERICAN NLS_TERRITORY AMERICA Operating System Windows 2000 My Oracle Lite configuration Is Oracle9i Lite Release 5.

  • Records insert differently with FK?

    I have a parent and child with a foreign key (nothing special, just alter table add constraint foregin key). If I add the FK 1st then populate both tables, a join takes 4+ seconds. If I populate 1st then add the FK, the join is almost instant. Is Ora

  • HOW I CHECK WEBSITE IN SAFARI 7.0.3 IN WINDOWS

    HOW I CHECK WEBSITE IN SAFARI 7.0.3 IN WINDOWS. Is there any method to check online?

  • Sir i have deleted recovery partition from my laptop

    sir how to get recovery partition back to my hard disc without using dvd's into which i hav rided recovery media creation