file-format

Will random data appended to a JPG make it unusable?

六眼飞鱼酱① 提交于 2019-12-04 16:38:57
问题 So, to simplify my life I want to be able to append from 1 to 7 additional characters on the end of some jpg images my program is processing*. These are dummy padding (fillers, etc - probably all 0x00) just to make the file size a multiple of 8 bytes for block encryption. Having tried this out with a few programs, it appears they are fine with the additional characters, which occur after the FF D9 that specifies the end of the image - so it appears that the file format is well defined enough

C++ The compiler is changing the alignment of my structures. How can I prevent this?

妖精的绣舞 提交于 2019-12-04 12:31:26
I am writing some code to read bitmap files. Here is the struct I am using to read the bitmap header. See also: https://msdn.microsoft.com/en-us/library/windows/desktop/dd183374(v=vs.85).aspx struct BITMAPFILEHEADER { WORD bfType; // 2 DWORD bfSize; // 6 WORD bfReserved1; // 8 WORD bfReserved2; // 10 DWORD bfOffBits; // 14 }; // should add to 14 bytes If I put the following code in my main function: std::cout << "BITMAPFILEHEADER: " << sizeof(BITMAPFILEHEADER) << std::endl; the program prints: BITMAPFILEHEADER: 16 It appears to be re-aligning the data in the struct on 4-byte boundaries,

CHM format alternatives?

六眼飞鱼酱① 提交于 2019-12-04 09:45:01
问题 Microsoft CHM format is great as provide such facilities: Table of contends with tree view. Index. Indexed search. Based on HTML source. But this format is outdated and have many drawbacks: Have security issues (allow execute JavaScript code). Don't know about new HTML formats. Not documented. Can not properly handle different character codings (like UTF-8). Are there any alternatives for CHM which have reader and compiler for all desctop OSes? PS . I hear that QT come this something like,

Most efficient way to store a big DNA sequence?

怎甘沉沦 提交于 2019-12-04 08:30:59
问题 I want to pack a giant DNA sequence with an iOS app (about 3,000,000,000 base pairs). Each base pair can have a value A , C , T or G . Storing each base pair in one bytes would give a file of 3 GB, which is way too much. :) Now I though of storing each base pair in two bits (four base pairs per octet), which gives a file of 750 MB. 750 MB is still way too much, even when compressed. Are there any better file formats for efficiently storing giant base pairs on disk? In memory is not a problem

filter file content to sorted tables

拟墨画扇 提交于 2019-12-04 06:43:49
问题 I have a file that contains the following lines of code. here the file displays a schedules which are sorted one by one . at 12:00 the schedule of james version1 is : first_task:eating:nothing second_task:rest:onehour third_task:watching:nothing at 12:00 the schedule of james version2 is : first_task:eating:fruits second_task:rest:twohour third_task:watching:manga at 12:00 the schedule of alex version1 is : first_task:eating:fruit second_task:rest:halfhour third_task:watching:horrorfilm at 12

Synthesia plays well midi file without any note off event?

此生再无相见时 提交于 2019-12-04 05:19:45
问题 I have a .mid file - this one specifically. Appart from the header chunk here is the relevant part of the midi. The first track chunk contains only meta events and is described as 4D 54 72 6B 00 00 00 52 // Track chunk #1 info 00 FF 58 04 04 02 18 08 // Meta event 00 FF 59 02 00 00 // Meta event 00 FF 51 03 15 CC 5B // Meta event 81 88 70 FF 51 03 16 E3 60 // Meta event 81 70 FF 51 03 1A 28 6E // Meta event 81 70 FF 51 03 1C 9C 38 // Meta event 81 70 FF 51 03 1E 84 80 // Meta event 81 70 FF

Command line option to open mac formatted file in Vim

◇◆丶佛笑我妖孽 提交于 2019-12-04 04:20:27
I have a file with mac format, I know I can use :e! ++ff=mac to change to the correct fileformat. What I'd like to know is if there is a command line option I can pass when I open the file to open it directly with the correct fileformat. You can do this using the command line, try: $ vim -c "set fileformat=mac" -c <command> executes before loading the first file. As jammessan has noted, this will only affect the first file that is loaded, subsequent files will require that you change fileformat for each buffer. If that doesn't work, you can also try: $ vim -c "e ++ff=mac" But it's better to

How can I say a file is SVG without using a magic number?

旧街凉风 提交于 2019-12-04 02:59:27
An SVG file is basically an XML file so I could use the string <?xml (or the hex representation: '3c 3f 78 6d 6c' ) as a magic number but there are a few opposing reason not to do that if for example there are extra white-spaces it could break this check. The other images I need/expect to check are all binaries and have magic numbers. How can I fast check if the file is an SVG format without using the extension eventually using Python? XML is not required to start with the <?xml preamble, so testing for that prefix is not a good detection technique — not to mention that it would identify every

How to identify whether an Excel file conforms to Excel 95 or Excel 97 specifications?

不问归期 提交于 2019-12-04 02:31:40
How to identify where the Excel file use Excel 95 or Excel 97 specifications? i.e., which version of BIFF they uses. You can find the necessary information in the MICROSOFT OFFICE EXCEL 97-2007 BINARY FILE FORMAT SPECIFICATION available from Microsoft. See page 11 for the following explanation: BIFF Microsoft Office Excel version --------------------------------------------------- BIFF5 Microsoft Excel version 5.0 (XL5) BIFF7 Microsoft Excel 95 (XL7) (also called Microsoft Excel version 7) BIFF8 Microsoft Excel 97 (XL8), Microsoft Excel 2000 (XL9), Microsoft Excel 2002 (XL10), Microsoft Office

Perforce: Keeping Perforce from altering text-file format

故事扮演 提交于 2019-12-04 01:37:53
Is there a way to tell Perforce to leave text files alone without setting the file-type as binary? Or barring that, is there a way to tell the Perforce client to diff binaries? Binary usually isn't desirable, because I lose the ability to diff. To clarify: If I edit and make changes to a *.txt file on my window client, newlines will have CR+LF as per the DOS format. But if I P4 sync on a Unix client, it will have LF only. I need Perforce to keep the format as-is, regardless of where the Perforce client lives. That said, I do have a work-around: Set file-type as binary; and/or create a branch