bytearray

Displaying images derived from a byte-array dynamically on a page

I'm calling a webservice that is returning an unknown quantity of images in the form of an a collection of byte arrays. (I can't change this) I need to display each image on a single aspx webpage. I'm currently using the Microsoft.Web.GeneratedImage control; http://www.codeplex.com/aspnet/Release/ProjectReleases.aspx?ReleaseId=16449 to...

Does reading from a telnet stream into a large byte array wait until the byte array is full?

From reading a few questions and answers here, it seems that a telnet stream never really closes. Using DataAvailable() will not return. I've inherited some code that took a very very long time to complete and we thought it was the telnet server that was the problem. However, there is a byte[32757] which the code tries to store the res...

string to byte/binary arrays in php

How do I convert a string to a binary array in php? ...

How to convert hex to a byte array?

I copied and pasted this binary data out of sql server, which I am unable to query at this time. 0xBAC893CAB8B7FE03C927417A2A3F6A60BD30FF35E250011CB25507EBFCD5223B How do I convert it back to a byte array in c#? ...

Write PDF from binary in database

Okay, I have a SQL 2005 database with a stored PDF. The column uses the image type. So when the PDF gets stores it is a byte[] array. So here is the hard part. I can get it to store the data but I am not sure how to go about getting the byte[] array back into PDF format and display it on the web page. I am using a 3rd part tool to gen...

Getting null terminated string from System.Text.Encoding.Unicode.GetString

I have an array of bytes that I receive from an external entity. It is a fixed size. The bytes contain a unicode string, with 0 values to pad out the rest of the buffer: So the bytes might be: H \0 E \0 L \0 L \0 \0 \0 \0 \0 \0 ... etc I'm getting that buffer and converting it to a string like so: byte[] buffer = new byte[buffSize...

String to byte array in php

How can I get the byte array from some string witch can contains numbers,letters and so on!? If u are familiar with java I am looking for same functionality of getBytes() method. I tried with snippet like this one: for($i = 0; $i < strlen($msg); $i++){ $data.=ord($msg[$i]); //or $data[]=ord($msg[$1]); } but without succe...

Why is System/mscorlib code so much faster? Especially for loops?

This is just a personal project I've been digging into. Basically, I parse a text file (say from 20mb up to about 1gb) using StreamReader. The performance is pretty solid, but still... I've been itching to see what would happen if I parse it in binary. Don't misunderstand, I'm not prematurely optimizing. I am defintely micro-optimizing o...

Create a thumbnail and then convert to byte array

I'm having a heck of a time with creating thumbnails and then converting them into a byte array. I've tried three methods, and all 3 times I get an error. The first was using Bitmap.GetThumbnailImage, which I have used in the past and then saved directly into Response.OutputStream The second was using System.Drawing.Graphics with Draw...

Append 2+ byte arrays in C#

Is there a best(see below) way to append two byte arrays in C#? Pretending I have complete control, I can make the first byte array sufficiently large to hold the second byte array at the end and use the Array.CopyTo function. Or I can loop over individual bytes and make an assignment. Are there better ways? I can't imagine doing som...

How can I convert a Silverlight ImageSource to a byte[]?

Hi folks, I've got a simple ImageSource silverlight control which i have on my canvas. Works fine. Is there any way I can extract the content of an ImageSource to a byte array? cheers! PS. Any version of SL will be fine. ...

retrieve the value of a timestamp field with adodb - how to read a byte array from classic asp

I'm working with asp and adodb, querying a database (ms sql 2005) I have a field named stamp, of type timestamp in asp I get the following field.ActualSize: 8 field.DefinedSize: field.Name: Stamp field.Type: adBinary (128) field.Attributes: 528 (adFldFixed (16) + adFldRowVersion (512) ) (so adFldLong is NOT turned on, so I can't u...

C#: What takes up more memory? A string or bytearray?

C#: What takes up more memory? A string or bytes? Let's say I have a line that reads "My Text", in which form would that line use up more memory, as a byte or a string? ...

C#: Store byte array in XML

What would be a simple way to store a Byte[] array in XML (using C#) ? ...

How to convert a byte array to a string?

Hi, Using the function from: http://msdn.microsoft.com/en-us/library/system.security.cryptography.rijndaelmanaged.aspx public static byte[] encryptStringToBytes_AES(string plainText, byte[] Key, byte[] IV) As you can see it returns a byte array, I want to convert the byte array to a string. How can I convert it from a byte array to ...

Flash -> ByteArray -> AMFPHP -> Invalid Image !??

Hi, Im loading images into Flash and using JPGEncoder to encode the image to a ByteArray and send this to AMF PHP which writes out the bytearray to a file. This all appears to work correctly and I can download the resulting file in Photoshop CS4 absolutely fine. When i try to open it from the desktop or open it back in Flash it doesnt w...

C#: byte array in xml CData

Hi all, I have a WCF service that is returning a block of xml. One element is a CData[] section. My application reads an HTML file out of the database and converts it to a PDF byte[] array using ABCPDF. Then in my XmlWriter Im adding the bytes to the CData section. The problem is the resulting xml looks like this: <![CDATA[System.B...

Why is JPGEncoded bytearray sent from AS3 to AMFPHP resulting in an invalid image?

Hi, Im loading images into Flash and using JPGEncoder to encode the image to a ByteArray and send this to AMF PHP which writes out the bytearray to a file. This all appears to work correctly and I can download the resulting file in Photoshop CS4 absolutely fine. When i try to open it from the desktop or open it back in Flash it doesnt w...

What is the fastest way to find if an array of byte arrays contains another byte array?

I have some code that is really slow. I knew it would be and now it is. Basically, I am reading files from a bunch of directories. The file names change but the data does not. To determine if I have read the file, I am hashing it's bytes and comparing that to a list of hashes of already processed files. There are about 1000 files in each...

Find First Specific Byte in a Byte[] Array c#

Hi there, I have a byte array and wish to find the first occurance (if any) of a specific byte. Can you guys help me with a nice, elegant and efficient way to do it? /// Summary /// Finds the first occurance of a specific byte in a byte array. /// If not found, returns -1. public int GetFirstOccurance(byte byteToFind, byte[] byteArra...