binary-data

Is it safe to convert a mysqlpp::sql_blob to a std::string?

I'm grabbing some binary data out of my MySQL database. It comes out as a mysqlpp::sql_blob type. It just so happens that this BLOB is a serialized Google Protobuf. I need to de-serialize it so that I can access it normally. This gives a compile error, since ParseFromString() is not intended for mysqlpp:sql_blob types: protobuf.Pars...

vector <unsigned char> vs string for binary data

Which is a better c++ container for holding and accessing binary data? std::vector<unsigned char> or std::string Is one more efficient than the other? Is one a more 'correct' usage? ...

Human-readable binary data using Python

My work requires that I perform a mathematical simulation whose parameters come from a binary file. The simulator can read such binary file without a problem. However, I need to peek inside the binary file to make sure the parameters are what I need them to be, and I cannot seem to be able to do it. I would like to write an script in P...

Python binary data reading

A urllib2 request receives binary response as below: 00 00 00 01 00 04 41 4D 54 44 00 00 00 00 02 41 97 33 33 41 99 5C 29 41 90 3D 71 41 91 D7 0A 47 0F C6 14 00 00 01 16 6A E0 68 80 41 93 B4 05 41 97 1E B8 41 90 7A E1 41 96 8F 57 46 E6 2E 80 00 00 01 16 7A 53 7C 80 FF FF Its structure is: DATA, TYPE, DESCRIPTION 00 00 00 01, 4 bytes...

C#, writing binary data

I have a problem tring to write to a binary file. //This is preparing the counter as binary int nCounterIn = ...; int nCounterTotalInNetwork = System.Net.IPAddress.HostToNetworkOrder(nCounterIn); byte[] byteFormat = BitConverter.GetBytes(nCounterTotalInNetwork); char[] charFormat = System.Text.ASCIIEncoding.ASCII.GetChars(byteFormat); ...

Performance in tables with binary data/images

I made a people maintenance screen. The client want me to store the photo of every person in the database, and I made it without problems. I have a separate table for the images with two fields, Id_person,and Image. I'm a little worried because it's the first time that i work with images in database. will I have problems of performance ...

Java libraries for reading meta data from .img, .osc and .mccd files

I need to read meta data from .img, .osc and .mccd files. Can you anyone recommend any libraries or provide any pointers as to how I would go about doing this. Eventually I need to put that meta-data into an XML file so it can be harvested by a repository. ...

Create binary data using Ruby ??

i was palying with the ruby sockets, so i ended up trying to put an IP packet togather, then i took an ip packet and try to make a new one just like it. now my problem is: if the packet is: 45 00 00 54 00 00 40 00 40 01 06 e0 7f 00 00 01 7f 00 00 01, and this is obviously hexadecimal, so i converted it into a decimal, then into a binary...

Read/Write compressed binary data.

I read all over the place people talk about compressing objects on a bit by bit scale. Things like "The first three bits represent such and such, then the next two represent this and twelve bits for that" I understand why it would be desirable to minimize memory usage, but I cannot think of a good way to implement this. I know I would p...

Overcoming .NET problem of displaying binary columns in a DataGridView

If a DataSet contains a column that is a timestamp or other binary value, its associated DataGridView throws an ArgumentException, when displaying any data in that column. That is, assume you have some table containing a binary column such as: CREATE TABLE [dbo].[DataTest]( [IdStuff] INT IDENTITY(1,1) NOT NULL, [ProblemColumn] T...

Parallel Binary DeSerialization?

I have a solution where I need to read objects into memory very quickly, however the binary stream might be cached compressed in memory to save time on disk io. I've tinkered around with different solutions, obviously XmlTextWriter and XmlTextReader wasnt so good and neither was the built-in binary serialization. Protobuf-net is excel...

Best way to read a large file into byte array in C#?

I have a web server which will read large binary files (several megs) into byte arrays. The server could be reading several files at the same time (different page requests) so I am looking for the most optimized way for doing this without taxing the CPU too much. Is the code below good enough? public byte[] FileToByteArray(string fileN...

How do I get SVN to realize a binary file's changed if the filesize is fixed.

I'm working with a program that writes data to fixed-size binary files that I store in a subversion archive. The problem, however, is SVN (both the command-line client and TortiseSVN) thinks that since the size of the file didn't change, the file itself didn't change and it shouldn't commit it. Is there a way to change what diffing met...

PHP unpack question

list(,$nfields) = unpack ( "N*", substr ( $response, $p, 4 ) ); $p += 4; The question is, why "N*" if substr should return 4 bytes, and they will be unpacked as N? And why double assignment? UPD: This code is part of Sphinx native PHP connector. After some code hacking it became clear that this code extracts 4-byte integer. But logic ...

Translate binary characters to a human readable string?

So let's say we have a string that is like this: ‰û]M§Äq¸ºþe Ø·¦ŸßÛµÖ˜eÆÈym™ÎB+KºªXv©+Å+óS—¶ê'å‚4ŒBFJF󒉚Ү}Fó†ŽxöÒ&‹¢ T†^¤( OêIº ò|<)ð How do I turn it into a human readable string of chars, cuz like it was a wierd output of HTML from a webserver that is text I think cuz half the web page loaded correctly. Do I need to read it with...

How can I import raw binary data into an image in Actionscript 2.0/Flash 8?

Let me preface this by saying that I am something of an actionscript newbie. We have a system that allows a user to upload any image, which we store on the server. Of course, it is simple to load an image (that you know the path to) using loadMovie, but I also want to load certain pieces of meta data about the image that is precalculat...

How to serve a file with JSP?

This may sound totally stupid, but is a case of real life :( I'm able to display a HTML table with a "virtual" link name. Something like this: Xyz description <a href="docId=123">document.doc</a> Xyz description <a href="docId=456">documentB.doc</a> Xyz description <a href="docId=798">documentC.doc</a> This doc id represents ...

Random access and BinaryWriter?

I'm working on a project where I'm building a byte array that's almost like a serialization of the object graph. Each class is responsible for writing out it's own data, so I'm thinking about using a BinaryWriter and pass that instance around to my child objects and let them serialize themselves into this instead of creating temporary bu...

Unpacking 3-byte/24-bit data chunks with Ruby

I am building a pure-Ruby WAV file read/write library, learning deeper Ruby functionality as I go. It currently works well with 16-bit audio, as I am able to use String.unpack('s*') to pull individual audio samples out into an array of signed integers. I am having trouble wrapping my mind around how to go about dealing with 24-bit audio,...

C++ print packaged binary to stdout

I need to print packaged binary data to stdout in C++. Are there any STL libraries that can accomplish this? I know perl has this functionality but I need to be able to do it in only C++. If c++ does not have this functionality can someone please guide me on how I would go about programming something like this. Thank you. ...