binaryfiles

delete some sequence of bytes in Powershell [duplicate]

◇◆丶佛笑我妖孽 提交于 2019-12-01 14:46:26
This question already has an answer here: Methods to hex edit binary files via Powershell 4 answers I have a *.bin file. How can I delete with poweshell some part of bytes (29 bytes, marked yellow) with repeatig sequence of bytes (12 bytes, marked red pen)? Thanks a lot!! Using a very helpful article and ditto function I found here , it seems it is posible to read a binary file and convert it to a string while not altering any of the bytes by using Codepage 28591. With that (I slightly changed the function), you can do this to delete the bytes in your *.bin file: function ConvertTo

delete some sequence of bytes in Powershell [duplicate]

被刻印的时光 ゝ 提交于 2019-12-01 13:25:03
问题 This question already has answers here : Methods to hex edit binary files via Powershell (4 answers) Closed 4 months ago . I have a *.bin file. How can I delete with poweshell some part of bytes (29 bytes, marked yellow) with repeatig sequence of bytes (12 bytes, marked red pen)? Thanks a lot!! 回答1: Using a very helpful article and ditto function I found here, it seems it is posible to read a binary file and convert it to a string while not altering any of the bytes by using Codepage 28591.

Java loading binary files

淺唱寂寞╮ 提交于 2019-12-01 13:23:23
问题 Please show me the best/fast methods for: 1) Loading very small binary files into memory. For example icons; 2) Loading/reading very big binary files of size 512Mb+. Maybe i must use memory-mapped IO? 3) Your common choice when you do not want to think about size/speed but must do only thing: read all bytes into memory? Thank you!!! P.S. Sorry for maybe trivial question. Please do not close it;) P.S.2. Mirror of analog question for C#; 回答1: For memory mapped files, java has a nio package:

Grep thinks text file is binary, but it isn't

寵の児 提交于 2019-12-01 11:56:24
问题 I came across a .cpp file in our codebase that is seen as binary by grep. So I can't grep it like a text file, which is annoying and obviously not how things ought to be. So I want to know why grep thinks the file is binary and address the issue. I tried to find any characters out of the ordinary using the command grep -Pna --color -r "[\x00-\x08]|[\x10-\x19]|[\x80-\xFF]" test.cpp but it doesn't yield any matches. How can figure out the cause of this problem? I should mention I'm on windows

Converting data stored in Fortran 90 binaries to human readable format

我们两清 提交于 2019-12-01 11:54:22
In your experience, in Fortran 90, what is the best way to store large arrays in output files? Previously, I had been trying to write large arrays to ASCII text files. For example, I would do something like this (thanks to the recommendation at the bottom of the page In Fortran 90, what is a good way to write an array to a text file, row-wise? ): PROGRAM testing1 IMPLICIT NONE INTEGER :: i, j, k INTEGER, DIMENSION(4,10) :: a k=1 DO i=1,4 DO j=1,10 a(i,j)=k k=k+1 END DO END DO OPEN(UNIT=12, FILE="output.txt", ACTION="WRITE", STATUS="REPLACE") DO i=1,4 DO j=1,10 WRITE(12, "(i2,x)", ADVANCE="NO")

Writing Byte Array To Binary File Javascript

老子叫甜甜 提交于 2019-12-01 11:27:16
I am trying to write a script that generates random numbers these number then are converted to groups of 4Bytes each then these 4-bytes-groups are put into an Uint8Array finally I try to save the array to binary file. Here is my code: <html> <head> <title>Raandom Number Generator</title> </head> <body> <script src="http://code.jquery.com/jquery-1.11.0.min.js"></script> <script src="filesaver.min.js"></script> <script type="text/javascript"> $(function() { if (!Date.now) { Date.now = function() { return new Date().getTime(); }; } alert("started"); var currentMousePos = { x : -1, y : -1 }; var

Haskell read/write binary files complete working example

一个人想着一个人 提交于 2019-12-01 08:07:33
I wish if someone gives a complete working code that allows to do the following in Haskell: Read a very large sequence (more than 1 billion elements) of 32-bit int values from a binary file into an appropriate container (e.g. certainly not a list, for performance issues) and doubling each number if it's less than 1000 (decimal) and then write the resulting 32-bit int values to another binary file. I may not want to read the entire contents of the binary file in the memory at once. I want to read one chunk after the previous. I am confused because I could find very little documentation about

Getting good mixing with many input datafiles in tensorflow

☆樱花仙子☆ 提交于 2019-12-01 06:23:32
I'm working with tensorflow hoping to train a deep CNN to do move prediction for the game Go. The dataset I created consists of 100,000 binary data files, where each datafile corresponds to a recorded game and contains roughly 200 training samples (one for each move in the game). I believe it will be very important to get good mixing when using SGD. I'd like my batches to contain samples from different games AND samples from different stages of the games. So for example simply reading one sample from the start of 100 files and shuffling isn't good b/c those 100 samples will all be the first

Reading binary file into R

本小妞迷上赌 提交于 2019-12-01 06:22:23
I'm trying to read a binary file into R but this file has rows of data written in binary code. So it doesnt have one full set of data belonging to one column instead it is stored as rows of data. Here's what my data looks like: Bytes 1-4: int ID Byte 5: char response character Bytes 6-9: int Resp Dollars Byte 10: char Type char anyone can help me figure out how to read this file into R? Hi Guys, Here's the code ive tried so far. I tried a couple of things with limited success. Unfortunately, I cant post any of the data on public sites, apologies. I’m relatively new to R, so I need some help in

C++ writing and reading doubles from a binary file

旧时模样 提交于 2019-12-01 05:47:15
问题 I want to perform disk I/O operations for a program that takes too much RAM. I use matrices of doubles and think writing them to disk as bytes is the fastest way (I need to preserve the double precision). How to do it with portability? I found this code (here) but the author says it's not portable... #include <iostream> #include <fstream> int main() { using namespace std; ofstream ofs( "atest.txt", ios::binary ); if ( ofs ) { double pi = 3.14; ofs.write( reinterpret_cast<char*>( &pi ), sizeof