binary-data

Is there any perfomormance differences between binary and XML serialization?

折月煮酒 提交于 2019-12-09 17:56:04
问题 in terms of both parsing (serializing, deserializing) and sending packets over the network is there any good estimation of performance differences between binary and xml serialization? 回答1: Nope. It depends highly on what sort of data is inside the XML document itself. If you have a lot of structured data, the overhead for XML will be large. For example, if your data looks like: <person> <name>Dave</dave> <ssn>000-00-0000</ssn> <email1>xxxxxx/email1> </person> ... You'll have a lot more

Finding a number of maximally different binary vectors from a set

耗尽温柔 提交于 2019-12-09 05:22:28
问题 Consider the set, S , of all binary vectors of length n where each contains exactly m ones; so there are n-m zeros in each vector. My goal is to construct a number, k , of vectors from S such that these vectors are as different as possible from each other. As a simple example, take n =4, m =2 and k =2, then a possible solution is: [1,1,0,0] and [0,0,1,1]. It seems that this is an open problem in the coding theory literature (?). Is there any way (i.e. algorithm) to find a suboptimal yet good

Storing PDF files as binary objects in SQL Server, yes or no?

依然范特西╮ 提交于 2019-12-09 05:06:11
问题 I have to find a design decision for the following task: I have a SQL Server database and it contains a table of orders. PDF documents will be uploaded by users through a simple file upload from a web page and assigned to an order. There is not more than one document per order (perhaps no document, never more than one). For this purpose a user opens a web page, enters an order number, gets the order displayed and clicks on an upload button. So I know to which order the uploaded document

Sending printer specific commands

ⅰ亾dé卋堺 提交于 2019-12-09 03:26:40
问题 I have an issue here, which I am trying to encode magnetic stripe data to an Fargo DTC400 printer, in the specifications it says I need to send the following string commands from example notepad, wordpad etc etc : ~1%TRACK NUMBER ONE? ~2;123456789? ~3;123456789? this example encodes the string in track one, and the numbers 123456789 in both track 2 and 3.. this works from Notepad.exe. EDIT: Current delphi code I use works on another printer: procedure SendQuote(MyCommand : AnsiString); var

R: Create binary data from a data frame

时间秒杀一切 提交于 2019-12-08 11:31:28
问题 i need some advise for the following problem: I have a dataframe with two columns, one containing the date, the other the frequency of a an event. Now i want to add a third column to this dataframe, wich should contain some binary data: 1 for days with a frequency of 100 and higher, 0 for the lower ones. Has anyone an idea how to do this in a smart way (i'm affraid of writing it by hand;-)? Thanks for your answer in advance! 回答1: df$freq.gt.100 = as.integer(df$freq >= 100) The bit inside

How to convert a 4-byte “string” to an uint32_t?

陌路散爱 提交于 2019-12-08 05:44:11
问题 Basically, I have a byte-string of data like: \x00\x00\x00\x00 \x08\x00\x00\x00 \x05\x00\x00\x00 (spaces are used only for visibility, there are no space bytes in the actual byte-string). The data is little-endian. Now, I need to extract the second 4-byte group ( \x08\x00\x00\x00 , which is 128 ) and turn them it an unsigned long. So, uint32_t type. Basically, what I'm doing is: moveBlock(&gdata->str[4], &second_group, 4); Where moveBlock is a macro: #define moveBlock(src,dest,size) memmove

How to upload binary data using POST

假装没事ソ 提交于 2019-12-08 05:22:27
问题 I have something like this in my code: String boundary = "thisIsMyBoundaryString"; StringBuilder body = new StringBuilder(); ... byte[] data = bos.toByteArray(); body.append(new String(data)); body.append("\r\n--" + boundary + "--\r\n"); String entity = body.toString(); I'm building a POST request and need to insert some binary data (JPEG compressed bitmap). After appending byteArray, I want to append newLine and boundary string, but the StringBuilder gets corrupted - seems that the bytes

Retrieving binary data [varbinary(max)] from SQL Server 2008 using JSP

大憨熊 提交于 2019-12-08 05:16:13
问题 Here is the query I am using to create and insert binary data in SQL Server 2008 Create query: CREATE TABLE Employees ( Id int, Photo varbinary(max) not null, Name varchar(50) not null, Sound varbinary(max) not null ) Insert query: INSERT INTO Employees SELECT '10', (SELECT BulkColumn AS E FROM OPENROWSET ( BULK 'd:\1.jpg', Single_Blob) bc), 'John', (SELECT BulkColumn AS E FROM OPENROWSET ( BULK 'd:\2.wav', Single_Blob) bc) One of the files is .jpg and the other is .wav How can i know the

python unhexlify not working as expected

落花浮王杯 提交于 2019-12-08 02:48:21
Whenever a program opens a file it sees the file as binary data. It translates it to a higher interpretive language i.e. octal, hex, ascii , etc. In this case it displays hexadecimal in the LH pane and ansi (windows 7 so it should be CP1252) in the RH pane. The 3 pictures below illustrate the original view, then the desired alteration, and the 3rd is the actual change made by the code: with open(tar,'rb') as f: data = binascii.hexlify(f.read(160)) if old in data: print 'found!' data = data.replace(old, new) else: print 'not found' with open(tar+'new', 'wb') as fo: binascii.unhexlify(data) fo

Help Reading Binary Image Data from SQL Server into PHP

时间秒杀一切 提交于 2019-12-08 01:46:34
问题 I cannot seem to figure out a way to read binary data from SQL server into PHP. I am working on a project where I need to be able to store the image directly in the SQL table, not on the file system. Currently, I have been using a query like this one: INSERT INTO myTable(Document) SELECT * FROM OPENROWSET(BULK N'C:\image.jpg', SINGLE_BLOB) as BLAH This works fine to actually insert the image into the table, but I haven't yet figured a way to retrieve it and get my image back. I am doing this