Binary File Operations

I need to collect 64-bit blocks from a file to pass to an encryption method which will perform a few permutations and use various binary operators on the block and a series of keys. The easiest way to program the encryption method will be to use an array of boolean values to manipulate the binary data. I need to get this array from the file somehow.
I am sure there is a simple way to create an array of 64 boolean objects directly from the file but can't for the life of me find a way to do it simply.
Thanks for the help

Thanks for your reply. Havent used bitset before but
I will look into it. I was trying to avoid converting
from byte just because it seems strange that I cant
access the raw binary data. What do you mean by 'cant access raw binary data'?
You can, but unfortunately in formats that are not very convenient for you:
long,int,byte[], whatever DataInputStream provides. I am more surprised by the fact that BitSet does not have a constructor that takes a byte[], and perhaps a getBytes() method.
If I do have to do this whats the easiest method?
Just using the divide by two and check remainder or
is there a better way?I would do this inside a loop:
boolArray[ i ] = (( value & 1 ) == 0 );
value = (value >> 1);

Similar Messages

  • The first binary file write operation for a new file takes progressively longer.

    I have an application in which I am acquiring analog data from multiple
    PXI-6031E DAQ boards and then writing that data to FireWire hard disks
    over an extended time period (14 days).  I am using a PXI-8145RT
    controller, a PXI-8252 FireWire interface board and compatible FireWire
    hard drive enclosures.  When I start acquiring data to an empty
    hard disk, creating files on the fly as well as the actual file I/O
    operations are both very quick.  As the number of files on the
    hard drive increases, it begins to take considerably longer to complete
    the first write to a new binary file.  After the first write,
    subsequent writes of the same data size to that same file are very
    fast.  It is only the first write operation to a new file that
    takes progressively longer.  To clarify, it currently takes 1 to 2
    milliseconds to complete the first binary write of a new file when the
    hard drive is almost empty.  After writing 32, 150 MByte files,
    the first binary write to file 33 takes about 5 seconds!  This
    behavior is repeatable and continues to get worse as the number of
    files increases.  I am using the FAT32 file system, required for
    the Real-Time controller, and 80GB laptop hard drives.   The
    system works flawlessly until asked to create a new file and write the
    first set of binary data to that file.  I am forced to buffer lots
    of data from the DAQ boards while the system hangs at this point. 
    The requirements for this data acquisition system do not allow for a
    single data file so I can not simply write to one large file.  
    Any help or suggestions as to why I am seeing this behavior would be
    greatly appreciated.

    I am experiencing the same problem. Our program periodically monitors data and eventually save it for post-processing. While it's searching for suitable data, it creates one file for every channel (32 in total) and starts streaming data to these files. If it finds data is not suitable, it deletes the files and creates new ones.
    On our lab, we tested the program on windows and then on RT and we did not find any problems.
    Unfortunately when it was time to install the PXI on field (an electromechanic shovel on a copper mine) and test it, we've come to find that saving was taking to long and the program screwed up. Specifically when creating files (I.E. "New File" function). It could take 5 or more seconds to create a single file.
    As you can see, field startup failed and we will have to modify our programs to workaround this problem and return next week to try again, with the additional time and cost involved. Not to talk about the bad image we are giving to our costumer.
    I really like labview, but I am particularly upset beacuse of this problem. LV RT is supposed to run as if it was LV win32, with the obvious and expected differences, but a developer can not expect things like this to happen. I remember a few months ago I had another problem: on RT Time/Date function gives a wrong value as your program runs, when using timed loops. Can you expect something like that when evaluating your development platform? Fortunately, we found the problem before giving the system to our costumer and there was a relatively easy workaround. Unfortunately, now we had to hit the wall to find the problem.
    On this particular problem I also found that it gets worse when there are more files on the directory. Create a new dir every N hours? I really think that's not a solution. I would not expect this answer from NI.
    I would really appreciate someone from NI to give us a technical explanation about why this problem happens and not just "trial and error" "solutions".
    By the way, we are using a PXI RT controller with the solid-state drive option.
    Thank you.
    Daniel R.
    Message Edited by Daniel_Chile on 06-29-2006 03:05 PM

  • Changing oaj2se.exe binary file for form operations

    Hi,
    When you open the form service in R12.1.3, you encounter a page with the following message.
    In order to access this application, you must install the J2SE Plugin version 1.6.0_07. To install this plugin, click here to download the oaj2se.exe executable. Once the download is complete, double-click the oaj2se.exe file to install the plugin. You will be prompted to restart your browser when the installation is complete.
    If you need the newer version - let's say 1.6.0.10 - than 1.6.0.07. Then, going through click here will give still the old binary file.
    For this kind of cases, it would be good if the binary file just gives the latest one when clicked to download j2se plugin.
    So, here the questions come.
    Q1.
    Is it safe to replace the old binary file with the latest jre file from Oracle site?
    Q2.
    How can this be done? I mean, where is the location and is it ok just to replace the binary file?
    Does anyone have any idea on this?
    Thanks,

    Hi,
    Please see
    Deploying Sun JRE (Native Plug-in) for Windows Clients in Oracle E-Business Suite Release 12 [ID 393931.1]
    This doc looks big, But it is straight forward and very easy to do
    Thanks

  • Report using Binary file

    Hi All , can anyone help me here ...
    I used “Write to Binary” to  write my report , at first stage this file is writing headers , including column  headings . at 2nd writing stage it is writing  data in columns.  This file can be viewed in .doc or .xls format. I have three issues
    1.         If I want to print this file from Front Panel  , what I should do?
    2.         other thing is if I stop logging and then start for another span , it starts writing from the first line instead of from last line  , because of this problem it is causing over-writing .
    3          another thing  , lets say if for 2nd or 3rd logging , I want to display sub-headings (test-1 , test-2) , how to insert , for example :
    MAIN HEADING (COMPANY NAME , REPORT TITLE )
    DATE , PRODUCT INFO , OPERATOR NAME
    COL1              COL2              COL3              COL4
    Subheading (test-1)
    Value1             Value2             Value3             Valye4
    Value1             Value2             Value3             Valye4
    Value1             Value2             Value3             Valye4
    Subheading (Test-2)
    Value1             Value2             Value3             Valye4
    Value1             Value2             Value3             Valye4
    Value1             Value2             Value3             Valye4
    Any help in this regard will be highly appreciated.
    Regards
    Faiyaz
    Attachments:
    report-writing-binaryfile.vi ‏68 KB
    02-display-subVI.vi ‏12 KB

    Hi Faiyaz,
    1. How Do I Print a File Programmatically From LabVIEW?
    2. Please the Programming >> File I/O >> Advanced File Functions >> Set File Position function on the block diagram after the Open/Create/Replace File function and set the from input to "end." This will append new data to the end of the file.
    3. You can simply add that information to the Format into String you are writing to the second Write to Binary file.
    Michael K.
    | Michael K | Project Manager | LabVIEW R&D | National Instruments |

  • How do you open multiple binary files and plot them all on the same graph?

    I have three different binary files and I want to plot all 3 of them onto a graph.
    I am familiar with opening and reading a single binary file. (Thanks to the help examples!) 
    But to do multiple numbers at the same time?  I was thinking of putting 3 different 'reading from binary file' blocks with the rest of the 'prompts', 'data type', etc.. and then connecting them on the same wire.
    However, I got into a mess already when I tried to read one .bin file to dynamic data type --> spectral measurements --> graph waveform.  The error was Not enough memory to complete this operation...  Why is that?  That didnt happen in the help example "Read Binary File.vi"...  Has it got something to do with the dynamic data type?
    Thank you for your time.
    Jud~

    Have a look at the image below and attached VI.  Simply enter the different paths into the PathArray control.
    R
    Message Edited by JoeLabView on 07-30-2008 09:59 PM
    Attachments:
    multipleBinary2Graph.vi ‏18 KB
    multipleBinary.PNG ‏5 KB

  • Firefox crashed when I try to download a binary file

    In this instance it is IE8 which I am trying to download (for business purposes I need Activex controls). When I currently open IE it runs as a process rather than an application. I have tried to download IE8 and google's Chrome but Firefox crashes as soon as I try to save the Binary files.

    Sorry you are having problems. Can you give an example preferably of some small publicly available file and the site you are trying to download it from ?
    As a simple example of a download (ok it is a .png image file not not a .exe file) but can you try to download a copy of your avtar/icon, as used on these forums. In Windows one method is that you right click & should get an option save. <br/> Mine alongside uses the link
    * https://support.mozilla.com/media/uploads/avatars/avatar-257447.png
    Are you able to download such an image, then see it in your download manager, and find it on your computer.
    Once you have got Firefox to save your binary file you can use it. In the case of the .exe file you are trying to download that should be usable as intended with your Windows Operating System, the avatar also should be easily opened and viewed.
    P.S.
    You could try installing the add-on https://addons.mozilla.org/en-US/firefox/addon/opendownload-10902/ if you wished to adapt Firefox to run .exe files instead of just save them.

  • The binary file processing in PDA device (LabVIEW PDA Module)

    To whom it may concern,
    I created a VI application, which should read some binary files and transform them to waveforms shown in the Waveform Graph. I implemented it with Mobile/PDA module. This application runs successfully on my desktop, that is, on the Labview Front Panel. However, when I run it on "Windows Mobile 5.0 Pocket PC Device" (a PDA has been already connected to the PC), all the windows, menus, buttons are displayed correctly, the only thing wrong is that the waveform can't be shown in the Waveform Graph. So, I wonder whether the Windows Mobile system will automatically modify the binary file format a little when I copy them from the PC to my PDA so that the original VI can't process it as what I expected in PC execution. Or, are there any requirements for the programs that will be executed in actual Windows Mobile Device?
    Thanks a lot for any comments and suggestion. 

    Thanks, Jeremy,
    I used LabVIEW 8.5.1.  I rechecked and debugged the VI. The problem is not due to the Waveform Graph. I set an indicator after the Read File unit, in both PC Front Panel and PDA Front Panel. As I described before, when I run it in the PC Front Panel, the indicator could show the right values read from the file. But when I switch to PDA Device Front Panel, the indicator shows zero (invalid values), which demonstrate that the data is not accessed from original files.
    The units I used are shown as follows:
    File Dialog ---> Open/Create/Replace File ---> Get File Size ---> Read From Binary File (Here I set an indicator, no values read from the file, but if run in PC, correct values will be shown).
    In this case, I guess the problem should come from the transfer (copy operation) of the file from PC to PDA. Or the operation behavior for LabVIEW  Read File unit is a little different for PDA implementation from its PC implementation.
    If you want more information, including the original binary file or VI, please let me know. Thanks a lot.

  • When I try to download a .exe file extension, Firefox designates it as a binary file which is useless to me.

    using Windows 7 with i3 processor all the latest updates. Firefox is the ONLY browser that gives me this problem. I should not have to turn off my antivirus or go into my config files, write code or anything to have this simple task to work. If I buy a download for a program and get one shot at the download which is an executable file, I should not have it come up as a Binary file and can not use it to load the program that I just ordered.

    Sorry you are having problems. Can you give an example preferably of some small publicly available file and the site you are trying to download it from ?
    As a simple example of a download (ok it is a .png image file not not a .exe file) but can you try to download a copy of your avtar/icon, as used on these forums. In Windows one method is that you right click & should get an option save. <br/> Mine alongside uses the link
    * https://support.mozilla.com/media/uploads/avatars/avatar-257447.png
    Are you able to download such an image, then see it in your download manager, and find it on your computer.
    Once you have got Firefox to save your binary file you can use it. In the case of the .exe file you are trying to download that should be usable as intended with your Windows Operating System, the avatar also should be easily opened and viewed.
    P.S.
    You could try installing the add-on https://addons.mozilla.org/en-US/firefox/addon/opendownload-10902/ if you wished to adapt Firefox to run .exe files instead of just save them.

  • How to Find the Latest Version of Cluster Binary Files available at Microsoft website

    How we can find the latest version of Cluster binary files available for download at Microsoft Website and which Cluster Binaries should be update to make the Cluster services stable healthy.

    @AnatolySV : I believe you need to put some efforts to understand what he is asking.
    You may find the latest version of Cluster Binaries by entering the required keywords for Microsoft Failover Clustering. Some of the main Cluster binaries(Keywords) are:-
    Clusres.dll (For Cluster Resources like Disk, Application or Service, Cluster IP)
    Clussvc.exe (Cluster Service)
    TCPIP.sys (If the Storage is presented to the cluster Nodes via ISCSI Network).
    MPIO.sys / ISCSIprt.sys (If we are using Multipathing for the disks to be presented).
    RHS.exe (Resource Host Subsystem)
    So, the Answer to your question is: You need to enter the binary name "Clusres.dll" and mention the Operating System you want to install your binaries to "Windows Server 2008 R2 Sp1" on Bing (Preferred for Microsoft Hotfixes). In Result you will get the
    list of hotfixes for clusres.dll
    You need to try this multiple times in order to get the latest version as Microsoft does not have a single Link.
    Hope this answers your query. Feel free to leave a message incase you need more help.
    Maybe) 
    But hey, you`ve got +1 from me for clarification) 
    Anyway, I still think that the initial question could be more clear and exact. 

  • Binary file with File adapter

    Hi gurus,
    I am getting binary file as base64binary (not a text/xml file) in a request XML tag. I need to write this file to a file directory with the file adapter after retrieving it from the request message by a message/java mapping and use another field in XML as the file name.
    I followed the blog `how to send binary data through PI` but in that case, the request message is also the same. Mine requires a mapping to be executed and in this case I cannot use dummy names for message types/interfaces as Enterprise Repository development is required.
    How can I achieve this?
    Thanks
    Gokhan

    Just solved the problem actually
    As I was trying to write a binary file directly with the receiver file adapter, I wasn't sure how to define a data type / message type for it. I developed a java mapping that decodes the base64 to binary data and writes it to the output stream, and used a dummy message type / data type for the service interface as the target in Operation Mapping
    And it worked!
    Regards,
    Gökhan

  • Binary file moving by PI 7.1

    Hello!!
    i  am using PI 7.1 
    according to many article on this forum,,  no ESR object and then no need to operation mapping  in interface determination, 
    but it's madatory fields(OM) on the screen.
    please explain binary file for moving from aa folder to bb folder.
    thanks
    bangbang

    Hi,
    You don't need any ESR object in file to file scenario if there is no mapping involved.
    Refer the below blog:
    /people/william.li/blog/2006/09/08/how-to-send-any-data-even-binary-through-xi-without-using-the-integration-repository
    -Supriya.

  • Writing a binary file

    Hi,
    I have trouble when writing a binary file. Here is what I do:
    I have some VI's collecting various data for a fixed period of time. I put all the data into 1D arrays at a fixed frequency (they all have the same size). Once it is done I merge all the arrays into one 2D array and I write that to a binary file. If I wait about 10 seconds after writing the file and I repeat the whole thing, everything is fine and the timing is correct. If I wait for a shorter period of time (say a sec, and this is the maximum I can wait to have a usable application) then the timing is wrong in the first part of the loop (the time-critical data-acquisition one). Of course, if I don't write the file, everything is fine (I have to wait about 250 msec between two runs, but that's ok). Any advice ?
    I also tried several things like streaming the data to disk during the time-critical period and this works fine only if the file allready exists. If not I experience jitters again. I don't really want to stream the data in real time, but it could work if I can get rid of the jitters. Again, any advice ?
    I'm using LV7.1 and the real time module running on a PC (ETS).
    Another, sort of related, topic: I noticed that when using 2D arrays within time critical loops all the process are slowdown whereas if I use several 1D arrays everything is fine... Any idea why ?
    Thanks,
    Laurent

    Hello,
    File I/O transfer rates during streaming to disk depends on several factors: CPU speed and load, hard drive technology (IDA / Serial ATA / SCSI ...), quality of programming. High jitter is always due to bad programming. File I/O operations are not deterministic. So, file I/O VI's must not be called in the critical task. Data must be saved in the normal priority VI's in order to keep jitter as low as possible. This is the reason why an application in RT is based on RT FIFO to transfer data from the critical loop and the normal priority VI.
    You will find a lot of tutorials detailing the key concepts for RT programming at the link below:
    * Real-Time Module
    http://zone.ni.com/devzone/devzone.nsf/webcategories/C25F8C664230613A862567DF006ABB06
    Moreover, memory allocation in LabVIEW is implicit. You must use large set of data carefully because some function reallocate new buffers for their outputs instead of reusing the input buffers (like the function "build an array"). You will find an example of how we can decrease the memory use with array in LabVIEW in the tutorials linked above.
    If you need more specific advices, you can post a sample code that reproduce the behavior that you does not understand. I will try to look at this and give you my feedback.
    Sincerely.
    Matthieu Gourssies, NIF.

  • Can a binary file be read incrementally?

    I have a situation where I would like to do repeated incremental reads (i.e., N bytes at a time) from a binary file. My understanding of the Read Binary File VI is that you open the file, read N bytes from the file, and close the file - i.e., do a SINGLE read. I don't want to read the WHOLE file into memory at one gulp; I want to keep repeating the N-byte read operation in an indefinite loop, until I say to stop. On each read I will be updating a graph with the last data read.
    (OK, some more detail: I am monitoring 32 digital lines using some external equipment that writes the file. Each time one of the digital lines changes value, 10 bytes are written: a 48-bit timestamp and 32 bits for the current digital values. The file is a continuous little-endian raw concatenation of these 10-byte records, with no header or record markers. In LV 8.21 (under WinXP) I want to generate a scrollable display of the 32 digital traces, by reading a block of data as needed whenever I want to advance the display.)
    What is the suggested way to handle this kind of binary reading? (I am willing to write C code if necessary.) Any useful responses will be appreciated.
    dhfx

    This may be lower level than you were looking for.  As already mentioned, the big problem may be having two applications accessing the file simultaneously.
    Jim
    Jim
    LV 2013
    Attachments:
    ReadBinary.png ‏4 KB

  • Saving ResultList as binary file

    Hi,
    I like to store my ResultList as binary on file drive. The aim is to safe drive space and execution time for creating the report (XML or ASCII) for each UUT.
    At the moment i had nothing figured out doing such stuff in TS.
    Thats the reason why I started this thread to discuss with you what is possible or impossible.
    Do not care about the programming language. LV,CVI,C++,C# or anything else is welcome.
    My idea sounds simple
    1.) Creating : Take the address space of the ResultList and save it to disk. Problem: Size of Buffer !!
    2.) Consuming: Take the Binary file and put it back to TS and let a the TestReport (XML, ASCII or whatever you want) Callback running.
    Greetings from the lake of Constance, Germany
    Juergen
    =s=i=g=n=a=t=u=r=e= Click on the Star and see what happens :-) =s=i=g=n=a=t=u=r=e=

    Hi Johann,
    Thanks for your answer. But unfortunately it pointed not out what I really want to know. Or lets say what i want to discuss.
    The major task is: Is there a way to safe a the complete ResultList (if you take a look into the TestReport-Callback it will be variable "Parameters.MainSequenceResults") as a binary-file without any modifiactions or generator/parser stuff.
    The first aim of this procedure should be no loss of data by saving huge number of file drive space. The Second is saving execution time for generating the report file in the Testreport callback.
    The last few "lunch-breaks" I have dealed with this question to figure out a useful solution.
    I have found several things in TS4.0 that deal with this topic the serialization of data
    One the one hand there is a Engine method "SerializeObjects" . I got this running (I hoped so) for binary data but for re-building
    just for visualizing the data to an Operator. I found no running solution. On the other hand there is PropertyObject method
    "Serialize" This stuff was working fine. But data always have been stored in INI-Format on file. So there was no great benefit
    on file size.
    While looking on the TS4.0 poster on the wall i was focused on PropertyObjectFile. And with it found a resonable solution for this task. It is simple. Create a  PropertyObjectFile, do some settings like binary and path, get the parent PropertyObject from it, and ceate a new varaiable in the data folder. Now take the ResultList, clone and add it to your variable. The last step is saving.
    A comparsion to the XML-Report (shipped with NI)
    Binary  <-->  XML
    Filesize: 23 kB  <--> 2202 kB  that is a reduction of filedrive space of over 95% !!!
    Executiontime 160ms <--> 1960ms  that means i have to spent only 8% of time as in XML
    I have attached an example. It writes the report on Root C:\report.dat
    For you and all other members feel free to test it and please tell me what you think about it.
    If there is an other solution so lets discuss it.
    Greetings 
    juergen
    =s=i=g=n=a=t=u=r=e= Click on the Star and see what happens :-) =s=i=g=n=a=t=u=r=e=
    Attachments:
    ResultListAsBinary.seq ‏12 KB

  • "Read From Binary File" function Help ambiguity

    I must be getting tired, but for some reason a doubt crept in my mind as I was designing a new piece of code this morning:
    "is the "Read From Binary File" using the last file position or is it starting from the beginning of the file?"
    "That's a stupid question", I told myself.
    "I used this function a million times and have always assumed it is reusing the last file position. Moreover, there is no file offset input to that function, so WTH am I afraid of?"
    So, for kicks, I fired up the Help window and read the following description (*):
    Reads binary data from a file and returns it in data. How the data is read depends on the format of the specified file. This function does not work for files inside an LLB.
    (*) BTW, has anybody ever complained that you can't select and copy anything from the floating Help Window?
    Not much there. I particularly admire the phrasing of the second sentence... What about: "This function can do a lot of things, but it would much to complex to describe this is extensive details, so if you are asking, you probably can't afford using it"?
    Anyhow, I clicked on the "Detailed Help" and got this (among other things):
    Use the Set File Position function if you need to perform random access.
    WHAT? I am pretty darn sure I DO NOT USE the Set File Position when I read a file in successive and contiguous chunks. I just pass the file refnum into a shift register and back to the function and that's it.
    Now, the description of the "Refnum Out" ouput says: If file is a refnum or if you wire refnum out to another function, LabVIEW assumes that the file is still in use until you close it. Translated in plain English, is that supposed to mean that if the file is not closed it is open, or is that implying that it contains more info that just "the file is open and can be found here"?
    I started searching around and finally ended up with the entry for "refnums, file I/O". Down the bottom of the (long) article, I found this under the heading "References to Objects or Applications" (but nothing specific to files, BTW):
    ...LabVIEW creates a refnum associated with that file, device, or network connection...
    [...]  LabVIEW remembers information associated with each refnum, such as the current location for reading from or writing to the object and the degree of user access, so you can perform concurrent but independent operations on a single object. If a VI opens an object multiple times, each open operation returns a different refnum. LabVIEW automatically closes refnums for you when a VI finishes running, but it is a good programming practice to close refnums as soon as you are finished with them to most efficiently use memory and other resources.
    So it seems that my recollection was correct. I do not know what the "degree of user access" for a file is, but that's not the topic of today's post. 
    So, my point is: the Help File for this function is incomplete or ambiguous at best. Please correct it. And provide a link to the "refnum, file I/O" Help entry in its detailed Help. It would H E L P...
    Thanks for reading.

    Reading in succesive chunks is *NOT* random access. An open file always has
    a current position, which is updated with each read or write operation.
    You only need to set the file position if you want to start elsewhere.
    LabVIEW Champion . Do more with less code and in less time .

Maybe you are looking for

  • Message not delivered

    I have an Iphone 4 and sometimes when I send a text I get the message it was not delivered.  When I press the ! it gives me a couple of options and one is to send as a text message.  I select that and it sends the message.  Anyone have that issue and

  • Another request for Lumia 830 Denim update information

     I have the AT&T variant of the Lumia 830 and am waiting for a firmware update to fix two issues. However, there has been no communication as to when this firmware update will be released. I have only a short window to return this device and if I do

  • LAP 1242AG Can't use as a repeater

    i bought 2 aironet LAP 1242AG AP's. first i didn't know i had to have a cisco controller to configure/use these. so i flashed the OS to ISO the newest one. so now i can go to the GUI and configure. this is that i need these 2 AP's to do. there for a

  • E-Commerce for ERP and CUA

    We are installing the E-Commerce module for ERP and we are running into an issue with the User Management peice.  We are unable to create new users.  The error we are getting is: 1.- You do not have authorization to maintain users in the central syst

  • Dynamic Actions for Rehire

    Hi All: I've been trying to write a dynamic action to take the termination date from infotype 0041 and based on that data change the benefit eligibility date and rehire date on infotype 0041. Can anyone explain how can this be done? Thanks Venkat