bytearray

How to convert a simple string to Byte Array in VBA?

I need to convert a simple string in a Byte array using excel VBA. Then this byte array is used as the request's body. How can I do that? Thanks. ...

sending byte[] ( more than 20 KB) throught wcf to silverlight

i am sending byte[] (image) through wcf to silverlight, and from silverlight to wcf, everything works well as long as the byte[] (image) is less than 20KB, but when it's bigger, it doesn't work when i try to save the image uploaded in silverlight and send it to wcf to save it in the DB i receive: The remote server returned an error: Not...

byte[] to string in c#

I have a .NET byte[] that is loaded from a file that I happen to known contains UTF-8. In some debugging code, I need to convert it to a string. Is there a one liner that will do this? Under the covers it should be just an allocation and a memcopy so even if it is not implemented, it should be possible. ...

C# Array Subset fetching

I have an array of bytes and i want to determine if the contents of this array of bytes exists within another larger array as a continuous sequence. What is the simplest way to go about doing this? ...

How to convert a byte array to its numeric value (Java)?

Hi everyone, I have an 8 byte array and I want to convert it to its corresponding numeric value. e.g. byte[] by = new byte[8]; // the byte array is stored in 'by' // CONVERSION OPERATION // return the numeric value I want a method that will perform the above conversion operation. ...

Changing the MaxArrayLength property on the XmlDictionaryReaderQuotas object used when creating the XML reader....

I'm getting the following exception while sending ( or receiving ) a byte array to a C# service. There was an error deserializing the object of type System.Byte[]. The maximum array length quota (16384) has been exceeded while reading XML data. This quota may be increased by changing the MaxArrayLength property on the XmlDictionaryR...

Can someone explain the conversion from byte array to hex string?

I recently started looking at MD5 hashing (in Java) and while I've found algorithms and methods to help me accomplish that, I'm left wondering how it actually works. For one, I found the following from this URL: private static String convertToHex(byte[] data) { StringBuffer buf = new StringBuffer(); for (int i = 0; i < data.len...

Convert BYTE buffer (0-255) to float buffer (0.0-1.0)

How can I convert a BYTE buffer (from 0 to 255) to a float buffer (from 0.0 to 1.0)? Of course there should be a relation between the two values, eg: 0 in byte buffer will be .0.f in float buffer, 128 in byte buffer will be .5f in float buffer, 255 in byte buffer will be 1.f in float buffer. Actually this is the code that I have: for (...

Image display within GridBagLayout Java

My image is passed into my program from a server and saved as a string. I want to convert that string into an image, and then in turn display that image within a label inside of a GridBagLayout. When I execute the below code, I get a blank frame. No exceptions during execution. When I look at the image object from the ToolKit in debug, i...

I wanna have an Extension method "Equals" between 2 byte arrays.

Hi! I am doing some byte[] comparisons. I tried == but this is just like the base Equals, which: byte[] a = {1,2,3}; byte[] b = {1,2,3}; bool equals = a == b; //false equals = a.Equals(b); //false I tried to add an extension method, but since the overloaded base class' Equals takes the same arguments, it goes to the base method rath...

Upload Video using new FileReference class

With the changes to the FileReferance rules for FP10 it is now possible to upload a local file directly to the client side application without the server roundtrip. For loading an image I use this code to deal with the ByteArray: private function completeHandler(e:Event):void { loader = new Loader(); var f:FileReference = FileRe...

How Do I Insert A Byte[] Into an SQL Server VARBINARY column

Hi there, I have a byte array highlighted below, how do I insert it into a SQL Server database Varbinary column? byte[] arraytoinsert = new byte[10]{0,1,2,3,4,5,6,7,8,9,10}; string sql = string.format ( "INSERT INTO mssqltable (varbinarycolumn) VALUES ({0});",WHATTODOHERE ); Thanks in advance guys! ...

Array Searching code challenge

Here's my (code golf) challenge: Take two arrays of bytes and determine if the second array is a substring of the first. If it is, output the index at which the contents of the second array appear in the first. If you do not find the second array in the first, then output -1. Example Input: { 63, 101, 245, 215, 0 } { 245, 215 } Expecte...

How to convert an Stream into a byte[] in C#?

Is there a simple way or method to convert an Stream into a byte[] in C#? ...

How do i compare a byte[] to string?

I want to compare the first few bytes in byte[] with a string. How can i do this? ...

byte[] buffer or ref/pointer? in C#

I have a raw buffer with it i need to make 3 others, the head which is always the first 8 bytes, body which is always from byte 8 to ? then foot which is from ? to the end of he file. How do i make a buffer from an already existing buffer so i can fill in body and foot. also how do i create head to use the first 16 bytes. I am assuming ...

List<Byte> to String, can you help refactor this ( small ) method ?

Hello, We use this small utility method. But we dont like it. Since it's not very crucial ( that work anyway ... ) , we have forget it. But that's ugly, because we have to go through the whole array, only to convert it from Byte[] to byte[]. I'm looking for a way to cast the Byte [] in byte [] without go throu it or for a utility m...

C# - Converting a Sequence of Numbers into Bytes

I am trying to send a UDP packet of bytes corresponding to the numbers 1-1000 in sequence. How do I convert each number (1,2,3,4,...,998,999,1000) into the minimum number of bytes required and put them in a sequence that I can send as a UDP packet? I've tried the following with no success. Any help would be greatly appreciated! List<b...

Convert byte array to short array in C#

I'm currently reading a file and wanted to be able to convert the array of bytes obtained from the file into a short array. How would I go about doing this? ...

8192 bytes when creating file

In my Java code I have function that gets file from the client in http request and converts that in to the file. I have this line there: byte[] buffer = new byte[8192]; what does 8192 bytes (8 kb) means here? This is one of the responses that I got, and want to make sure that I understand that code. ...