bytearray

An accurate running statistical mean of a large array of bytes

I have a two dimensional array of bytes which looks like this: int n = 100000; int d = 128; byte[][] samples = new byte[n][d] /* proceed to fill samples with some delicious data */ byte[] mean = new byte[d]; findMean(mean,samples); My findMean function proceeds to fill mean such that: mean[k] = mean(samples[:][k]) Simple enough so ...

Wrapping a bitmap byte array with BitmapImage in C#.

Hi there, the problem is as follows: I have got a rendered bitmap in a byte array (together with the bitmap header). Now I want to manipulate the content of a bitmap. For that purpose I need to wrap this array with some high-level class, say BitmapImage . I want to avoid copying the array, or its data part etc. I want just to force .N...

Efficient bitmap manipulation in WPF (C#).

Hi there, the problem is as follows: I have got a rendered bitmap in a byte array (together with the bitmap header). Now I want to manipulate the content of a bitmap. For that purpose I need to wrap this array with some high-level class, say BitmapImage . I want to avoid copying the array, or its data part etc. I want just to force .NE...

Read or convert to Int32 from TWO byte arrays

I have the 4 bytes that represent an integer stored in 2 separate byte arrays. I would like to convert these into an Int32 WITHOUT copying to a third byte array and reading that using memorystream. The reason the data is split across two byte arrays is because this is a simplified example of my issue which involves huge amounts of data ...

Byte Array to Word Array to String

I have this byte[]: 00 28 00 60 00 30 10 70 00 22 FF FF. I want to combine each pair of bytes into a word: 0028 0060 0030 1070 0022 FFFF. I also want to turn the word array into a string: "0028 0060 0030 1070 0022 FFFF" (without using byte[]). I fixed SLaks code and it works: StringBuilder sb = new StringBuilder(); for(var i = 0; i <...

c# Read from huge MemoryStream

I use a BinaryReader(MemoryStream(MyByteArray))) to read variable sized records and process them all in memory. This works well as long as my bytestream which is in the array is less than about 1.7G in size. After that (which is the maximum size of an integer in my 64bit system) you cannot create a larger bytearray, although I have enoug...

Byte Arrays as member variables in Objective-C: Why isn't the value sticking around?

I'm sure I've got a basic problem in my C knowledge. I have one variable defined in the @interface: uint * theBytes; and then I have a method for checking the values of that array. - (IBAction) checkNow { NSLog(@"now? %d %d %d", theBytes[0], theBytes[1], theBytes[2]); } - (void)viewDidLoad { [super viewDidLoad]; uint tryThis[3...

iPhone SDK: Converting/uploading an image to a SOAP service

I'm having issues converting/uploading a camera image to a remote SOAP web service. Here's the code for converting the image to a byte array: UIImage *image = [info objectForKey:UIImagePickerControllerEditedImage]; if (image == nil) image = [info objectForKey:UIImagePickerControllerOriginalImage]; NSData *imageData = [NSDa...

Re-interpreting a byte array as an array of structs

I've got a byte array that I want to re-interpret as an array of blittable structs, ideally without copying. Using unsafe code is fine. I know the number of bytes, and the number of structs that I want to get out at the end. public struct MyStruct { public uint val1; public uint val2; // yadda yadda yadda.... } byte[] stru...

Reading a Shapefile with ColdFusion

I am trying to read a binary file and parse the bytes I have the white paper spec on Shapefiles to know how to parse the file, however I cannot seem to find the correct functions in ColdFusion to handle reading bytes and deciding what to do with them. <cffile action="READBINARY" file="mypath/www/_Dev/tl_2009_25_place.shp" var...

Silverlight 4, image to byte array

Let say I have application menus in a database with their icon images (binary data). I extract those menus with the icons being byte[] type. However if there's no icon set, then I would like to use default icon which comes not from database, but from xap (inside Resources folder). To display icons coming from database I use IConverter (b...

Java: object to byte[] and byte[] to object converter (for Tokyo Cabinet)

I need to convert objects to a byte[] to be stored in the Tokyo Cabinet key-value store. I also need to unbyte the byte[] to an Object when reading from the key-value store. Are there any packages out there that will help me with this task? Or would the best solution to implement it myself? ...

AS3 Custom Object to ByteArray then to Custom Object

Having problem reading bytearray of custom objects. Any help is appreciated public class CustomObject extends Object { public function CustomObject() { public var _x:Number = 100 public var _y:Number = 10 public var _z:Number = 60 } } var cObj:CustomObject = new CustomObject() var bytes:ByteArray = new ByteArray() bytes.writeObject(c...

Convert Byte Array into HTML Image with Rails?

I have a Byte Array field being returned to me by the database, and in the view, I need to somehow output that as an image. How would I do that in Rails? Many thanks, M ...

how do convert string to byte[] in C#

How do you get a byte array out of a string in C#? I would like to pass a string to this method. ...

Apply byte[] effect in c#

Hello, I have a bitmap image and a byte[]. The byte[] contains an effect such as noise (in my case, byte[] contains custom effect). I want to apply this byte[] effect to the bitmap image and save the resulted bitmap. I have the BitmapData and byte[] but I don't know how to mix merge these together? Thanks Update: Well the byte[] con...

How can I reverse the byte order of an NSInteger or NSUInteger in objective-c

This is a somewhat of a follow up to this posting (http://stackoverflow.com/questions/2718712/how-to-convert-byte-value-into-int-in-objective-c) but with a different question so I felt I should ask in a separate thread. I am at the point where I have four consecutive bytes in memory that I have read in from a file. I'd like to store ...

Flex: ByteArray to string

How can I convert a ByteArray to string. The toString() is not working as I have some special characters and it shows me only the first character. Here is a sample: 49, 48, 54, 0, 50, 54, 51, 48, 57, 52, 52, 49, 48, 48, 48, 56, 0, 49, 0, 49, 0, 73, 77, 0, 52, 0, 0, 0, 0, 0, 0, 0, 0, 49, 0, 49, 0, 50, 54, 51, 49, 53, 56, 50, 52, 48, 48,...

Flash upload progress

Hi, I'm making a bandwidth test in flash, and I want to display a progress bar and the current calculated speed. For the download part this is pretty straightforward, but for the upload part it gets a bit trickier. As I've understood the only way to track upload progress is by using FileReference. But as I'm uploading a dynamically gener...

error in my byte[] to WPF BitmapImage conversion?

I'm saving a BitmapImage to a byte[] for saving in a DB. I'm pretty sure the data is being saved and retrieved accurately so it's not an issue there. On my byte[] to BitmapImage conversion I keep getting an exception of "System.NotSupportedException: No imaging component suitable to complete this operation was found." Can anyone see w...