byte

.net byte[] to List<List<Point>>

Is is possible to convert a byte array back to a List<List<Point>> ? LE: I am saving the List<List<Point>> in a database BLOB field. When I retrieve it, I want to convert it back to a List<List<Point>>. The data is kept into an SQLite database and gets set with: ... cmd.Parameters.AddWithValue("@bynaryData", theList); ... So I have...

View returned file from Webservice method

I already have a method in my webservice that returns a byte[] containing only the bytes of the file downloading. The invocation is something like: http://www.mysite.com/myWebservice.asmx with: string fileId = "123"; bytes[] fileContent = myWebservice.Download(fileId); What I wanted to do is be able to invoke this method or other (to...

Does providing an IFormatProvider to byte.ToString("x2") matter?

If you are calling ToString on a byte to convert it to a 2 digit hex value does it matter if you use a format provide of CultureInfo.CurrentCulture or CultureInfo.InvariantCulture in any way? Example: public string CalculateMD5Hash(string input) { MD5 md5 = System.Security.Cryptography.MD5.Create(); byte[] inputBytes = System.T...

Convert 2 bytes to a number

I have a control that has a byte array in it. Every now and then there are two bytes that tell me some info about number of future items in the array. So as an example I could have: ... ... Item [4] = 7 Item [5] = 0 ... ... The value of this is clearly 7. But what about this? ... ... Item [4] = 0 Item [5] = 7 ... ... Any idea on...

Custom byte size?

So, you know how the primitive of type char has the size of 1 byte? How would I make a primitive with a custom size? So like instead of an in int with the size of 4 bytes I make one with size of lets say 16. Is there a way to do this? Is there a way around it? ...

Simple question on 8086 assembly language

I'm studying 8086 assembly language at high school and I have this question: For example I have this number ABCD (hex). How is it stored on the memory? Does the AB go for example to memory address 01 and the CD goes to address 02? ...

Converting integer to a bit representation

How can I convert a integer to its bit representation. I want to take an integer and return a vector that has contains 1's and 0's of the integer's bit representation. I'm having a heck of a time trying to do this myself so I thought I would ask to see if there was a built in library function that could help. Thanks! Edit: Excellent i...

ruby c extensions: character values over 127

I am trying to make a C extension for Ruby that includes a method returning a string, which will sometimes have character values that need to be in an unsigned char. In http://github.com/shyouhei/ruby/blob/trunk/README.EXT, all of the functions listed for turning C strings into Ruby strings take signed chars. So I couldn't do this: unsi...

byte[] to image android

Hi everybody, My issue is as follows : I have stored a few pictures into the sqlite database, using the blob format, which seems to work ok. now i want to get my pictures out of the DB and put then back into images... to complicate the matter, their format is variable (png, jpg, maybe something else, im not sure) Is there a way of doing...

how to convert byte value into int in objective-c

Hello, Please tell me how to convert bytes to NSInteger/int in objective-c in iPhone programming? ...

Oracle guid to other table

At the moment I'm writing a small conversion program, it will convert the primary key strategy to the using of GUIDs in stead of integers. This is a simple client induced requirement and I can't change that. I've added a substitute pk candidate of the RAW(16) to every table in the database and filled each record with a SYS_GUID(). I di...

an Array of bytes throw write(String) like writeBytes(String)

I am writing string and int values in an array ob bytes with c#. writeUTF(String ) in Java is giving me other results as the write(String) method on C#. I need to modify C# so that both gives the same result. Is there other write() method on C# Working like this Method in Java? WriteUTF(String) Writes a string to the underlying outp...

Passing Byte (VB.NET)

Hi I need to pass encoded string to php page. To convert string to iso: Dim result As Byte() = Encoding.Convert(Encoding.UTF8, Encoding.GetEncoding("iso-8859-1"), input) I have this code to pass string, but how I must do it to pass Byte (variable result) instead of the string (variable MyVarString)? Dim client As WebClient Dim dat...

Efficient way to calculate byte length of a character, depending on the encoding

What's the most efficient way to calculate the byte length of a character, taking the character encoding into account? The encoding would be only known during runtime. In UTF-8 for example the characters have a variable byte length, so each character needs to be determined individually. As far now I've come up with this: char c = getCha...

Playing with bytes...need to convert from java to C#

Hi fellow programmers, I am not used to manipulate bytes in my code and I have this piece of code that is written in Java and I would need to convert it to its C# equivalent : protected static final int putLong(final byte[] b, final int off, final long val) { b[off + 7] = (byte) (val >>> 0); b[off + 6] = (byte) (val >>> 8); ...

Modify this code to read bytes in the reverse endian?

Hi, I have this bit of code which reads an 8 bytes array and converts it to a int64. I would like to know how to tweak this code so it would work when receiving data represented with the reverse endian... protected static long getLong(byte[] b, int off) { return ((b[off + 7] & 0xFFL) >> 0) + ((b[off + 6]...

Take most significant 8 bytes of the MD5 hash of a string as a long (in Ruby)

Hey Friends, I'm trying to implement a java "hash" function in ruby. Here's the java side: import java.nio.charset.Charset; import java.security.MessageDigest; /** * @return most significant 8 bytes of the MD5 hash of the string, as a long */ protected long hash(String value) { byte[] md5hash; md5hash = md5Digest.digest(value.g...

Function that copies into byte vector reverses values

Hey, I've written a function to copy any variable type into a byte vector, however whenever I insert something it gets inserted in reverse. Here's the code. template <class Type> void Packet::copyToByte(Type input, vector<uint8_t>&output) { copy((uint8_t*) &input, ((uint8_t*) &input) + sizeof(Type), back_inserter(output)); } Now ...

Characters to Bytes

What's a good estimate/conversion/formula to figure out X# characters = Y# bytes? ...

Javascript Getting a string into kb format

I am new to javascript and I just wanted to convert a string into a format that a person like me can read. Here is an example of what I am trying to do... string2size(string){ //some awesome coding I have no clue how to make return awesomeAnswer } now the return should give me something like 56 bytes or 12kb or 1mb depending how much...