byte

Open pdf in Iframe passing byte data

Is there any way to open pdf on <iframe> or <object> passing byte[] data? i have pdf on byte form.i am using c# ...

How to declare and use 1D and 2D byte arrays in Verilog?

How to declare and use 1D and 2D byte arrays in Verilog? eg. how to do something like byte a_2D[3][3]; byte a_1D[3]; // using 1D for (int i=0; i< 3; i++) { a_1D[i] = (byte)i; } // using 2D for (int i=0; i< 3; i++) { for (int j=0; j< 3; j++) { a_2D[i][j] = (byte)i*j; } } ...

How can I store a sbyte value in a byte variable?

I am programming in C#. I have a sbyte variable. Say it holds -10 which in binary is 11110110. I want to store the binary representation of this value in a byte variable. So when I copy the sbyte (-10) to the byte the bytes value would be 245. If I try to use Convert.ToByte(sbyte) it throws an exception which makes sense. I really don't...

use vbscript to get 32 bit floating point into binary byte or word representation

Hello, I don't know how to do two somewhat related task within vbscript (not vb) -I need to break a 32 bit floating point into it's 4 byte binary representation. -I need to break a 32 bit floating point into it's 2 word(aka16bit) binary representation. For example, 65535.0 in format binary is 1000111011111111111111100000000 65535.0 in ...

.NET Regular expressions on bytes instead of chars

Hi, I'm trying to do some parsing that will be easier using regular expressions. The input is an array (or enumeration) of bytes. I don't want to convert the bytes to chars for the following reasons: Computation efficiency Memory consumption efficiency Some non-printable bytes might be complex to convert to chars. Not all the bytes ...

Add bytes to binary file using only PHP?

I am trying to add random bytes to binary (.exe) files to increase it size using php. So far I got this: function junk($bs) { // string length: 256 chars $tmp = 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

Convert a byte into a boolean array of length 4 in Java

I need to convert a byte into an array of 4 booleans in Java. How might I go about this? ...

how to create in PHP analog of C# ' private const int ' and ' private const byte '?

So in C# I create something like private const int HEADER_LENGTH = 13; private const byte SIGNATURE1 = 0x46; How to create its analog in PHP? ...

What is PHP for C# ReadBytes(stream langth)?

What is PHP for C# (asuming we open some local (on server) file instead of OpenFileDialog private const int HEADER_LENGTH = 13; stream = File.OpenRead(openFileDialog.FileName); header = ReadBytes(stream, HEADER_LENGTH); And will we be able to do something like this in PHP as a next step private const byt...

Why do C#'s binary operators always return int regardless of the format of their inputs?

If I have two bytes a and b, how come: byte c = a & b; produces a compiler error about casting byte to int? It does this even if I put an explicit cast in front of a and b. Also, I know about this question, but I don't really know how it applies here. This seems like it's a question of the return type of operator &(byte operand, by...

what is a byte[] array?

This could be a very simple CS question but I just still do not get what byte array is in the context of .net framework. I am familiar with standard definitions like array and byte and very familiar with EE concepts such as Byte. But I fail to connect it in terms of CS concepts. I see it used every where and I use it with out really unde...

Handling of extra '=' characters in an SMTP session when appended to \r\n line terminator

I'm working on a project which requires us developing our own intermediate SMTP relay to handle some outgoing mail so that it abides by certain rules. For the most part, I have everything functioning but I am having an odd issue that does not seem to be addressed by the SMTP spec. I'm not super familiar with sockets, either, so that isn'...

How do I convert a int to an array of byte's and then back?

I need to send an integer through a NetworkStream. The problem is that I only can send bytes. Thats why I need to split the integer in four byte's and send those and at the other end convert it back to a int. For now I need this only in C#. But for the final project I will need to convert the four bytes to an int in Lua. [EDIT] How abo...

converting bytes to int in Java

I need to convert 2 bytes (2's complement) into an int in Java code. how do I do it? toInt(byte hb, byte lb) { } ...

James Gosling's explanation of why Java's byte is signed

I was initially surprised that Java decides to specify that byte is signed, with a range from -128..127 (inclusive). I'm under the impression that most 8-bit number representations are unsigned, with a range of 0..255 instead (e.g. IPv4 in dot-decimal notation). So has James Gosling ever been asked to explain why he decided that byte is...

Reading/Writing Nibbles (without bit fields) in C/C++

Hello all, Is there an easy way to read/write a nibble in a byte without using bit fields? I'll always need to read both nibbles, but will need to write each nibble individually. Thanks! ...

convert from short to byte and viceversa in Java

Hi there, I'm trying to convert a short into 2 bytes...and then from those 2 bytes try to get the same short value. For that, I've written this code: short oldshort = 700; byte 333= (byte) (oldshort); byte byte2= (byte) ((oldshort >> 8) short newshort = (short) ((byte2 << 8) + byte1); Sy...

Byte precision of value in Python?

I have a hash function in Python. It returns a value. How do I see the byte-size of this return value? I want to know if it is 4-bytes or 8 or what. Reason: I want to make sure that the min value is 0 and the max value is 2**32, otherwise my calculations are incorrect. I want to make sure that packing it to a I struct (unsigned int) ...

How can you nibble (nybble) bytes in C#?

I am looking to learn how to get two nibbles (high and low) from a byte using C# and how to assembly two nibbles back to a byte. I am using C# and .Net 4.0 if that helps with what methods can be done and what libraries may be available. ...

Please help figure out what this C# method is doing?

I am a little confused as to what is being accomplished by this method. It seems to be attempting to break bytes into nibbles and reassemble the nibbles with nibbles from other bytes to form new bytes and then return a new sequence of bytes. However, I didn't think, you could take nibbles from a byte using modulus and subtraction and d...