Say I've got an integer, 13941412, that I wish to separate into bytes (the number is actually a color in the form 0x00bbggrr). How would you do that? In c, you'd cast the number to a BYTE and then shift the bits. How do you cast to byte in Python?
I'm writing a websercive in C# that will generate pdf-files and send back to the caller as a byte[]. The pdf file is generated using a third party component, but I'm struggling with the conversion. The pdf is just an in-memory object in the web service, and I can't find any good way of converting the generated pdf to a byte[] before returning it to…
How can I convert a integer to it's byte representation. I want to take an integer and return a vector that has contains 1's and 0's of the integers byte representation.
I'm having a heck of a time trying to do this myself so I'd thought I would ask to see if there was a built in library function that could help.
Thanks!
How to write byte by byte to socket in PHP?
For example how can I do something like:
socket_write($socket,$msg.14.56.255.11.7.89.152,strlen($msg)+7);
The pseudo code concatenated digits are actually bytes in dec. Hope you understand me.
Hi,
I have a byte array of around 10,000 bytes which is basically a blob from delphi that contains char, string, double and arrays of various types. This need to be read in and updated via C#.
I've created a very basic reader that gets the byte array from the db and converts the bytes to the relevant object type when accessing the property which…
Question about Byte-Pairing for data compression. If byte pairing converts two byte values to a single byte value, splitting the file in half, then taking a gig file and recusing it 16 times shrinks it to 62,500,000. My question is, is byte-pairing really efficient? Is the creation of a 5,000,000 iteration loop, to be conservative, efficient? I…
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>>.
So I have the byte[], but I cannot figure out how to convert it. How should the de/serialization look like…
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 data As…
I just got something I can't understand, so we have 1 byte, which is 8 bits, which is 2^8. Now 2 bytes should be 2 * 1 byte, which is 2 * 2^8 = 2^9, but actually 2 bytes is 2^16. What I'm missing here? I mean, it seems like 2 bytes isn't 2 * 1 byte, it's more like 1 byte * 1 byte, but this should give you byte^2, which doesn't make sense.…
Hi,
How can I see if the input string is a two byte character or one byte character; and from which encoding system the character is coming from?
I am using C# and SilverLight; I assume I could find the encoding the computer is running and then the character? Any code snippet?
Thank you,
Rune
// Get a UTF-32 encoding by…
We're parsing an XML document using JAXB and get this error:
[org.xml.sax.SAXParseException: Invalid byte 1 of 1-byte UTF-8 sequence.]
at javax.xml.bind.helpers.AbstractUnmarshallerImpl.createUnmarshalException(AbstractUnmarshallerImpl.java:315)
What exactly does this mean and how can we resolve this??
We are executing…
I asked this question a few days ago but it seems to have gone cold fairly quickly. What I want to do is pretty simple and I can't believe someone hasn't figured it out.
Solution needs to be JScript classic ASP. I am reading a file from a remote server and I want to process that (binary) file on my server and spit the…
I have a byte array of some binary data that i need to send over the network using WCF and NetTcpBinding. My problem is that i need to send only the part of the array. Is there any way to do this, other than copying that part to a separate array, and sending that one. This extra copying degrades performance, and i would…
Hi,
I have a byte array of around 10,000 bytes which is basically a blob from delphi that contains char, string, double and arrays of various types. This need to be read in and updated via C#.
I've created a very basic reader that gets the byte array from the db and converts the bytes to the relevant object type when…
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?
I have a MyFaces Facelets application, where the page coding is a bit rugged. Anyway, it's developed with Eclipse and built with Ant, and kindof runs ok in Tomcat 2.0.26. So far so good.
Now, I'd rather build with Maven, so I made a couple of pom-files, opened them in Netbeans and built, and now I have a war file that…
I'm trying to figure out how to create personalized urls for double-byte languages.
For example, this url from Amazon Japan has Japanese characters within the querystring (specifically, the path):
http://www.amazon.co.jp/????????-DVD-???/dp/B00005R5J3/ref=sr_1_3?ie=UTF8&s=dvd&qid=1269891925&sr=8-3
What I…
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) +…
For some inexplicable reason the byte primitive type is signed in Java. This mean that valid values are -128..127 instead of the usual 0..255 range representing 8 significant bits in a byte (without a sign bit).
This mean that all byte manipulation code usually does integer calculations and end up masking out the…