If I have two things which are hex, can I someone how append their binary together to get a value?
In C++,
say I have
unsigned char t = 0xc2; // 11000010
unsigned char q = 0xa3; // 10100011
What I want is somehow,
1100001010100011, is this possible using bit-wise operators?
I want to extract the binary form of t and q and append t...
I know in a lot of asynchronous communication, the packet begins starts with a start bit.
But a start bit is just a 1 or 0. How do you differentiate a start bit from the end bit from the last packet?
Ex.
If I choose my start bit to be 0 and my end bit to be 1.
and I receive 0 (data stream A) 1 0 (data stream B) 1,
what's there to stop...
In which cases would you use which? Is there much of a difference? Which I typically used by persistence engines to store booleans?
...
I would like to write a utility that will provide me with a relatively unique ID in Java. Something pretty simple, like x bits from timestamp + y bits from random number.
So, how would I implement the following method:
long getUniqueID()
{
long timestamp = System.currentTimeMillis();
long random = some random long
...
...
Please tell me how do I print a bit, like printf("%d",bit);
Thanks a lot
...
Help me people
Last week I asked about unicode conversion.I got only one reply.I need more suggestions.
I need to convert strings in Python to other types such as unsigned and signed int 8 bits,unsigned and signed int 16 bits,unsigned and signed int 32 bits,unsigned and signed int 64 bits,double,float,string,unsigned and signed 8 bi...
I have looked at http://stackoverflow.com/questions/141525/absolute-beginners-guide-to-bit-shifting but I still find the concept of bit shifting difficult to understand.
Can someone point me in the direction of a more basic guide to bit shifting in C. I expect it will be something really long since it will need to cover the whole subjec...
I use a view based on a complex query with 17 joins (both inner and left/right outer) and subqueries. All view rows are shown in about 5 seconds.
SELECT * FROM a_view;
One of the view columns has type BIT. And when I filter view rows comparing it with 1, a query works again about 5 seconds.
SELECT * FROM a_view WHERE c = 1;
But wh...
I'm looking for the fastest way of counting the number of bit transitions in an unsigned int.
If the int contains: 0b00000000000000000000000000001010
The number of transitions are: 4
If the int contains: 0b00000000000000000000000000001001
The number of transitions are: 3
Language is C
...
I get the following error when I try to concatenate
Operand type clash: text in incompatible with bit
Invalid operator for datatype: Operator equals Add, Type equal bit
SELECT
F.SubmissionId, F.FormId,
F.DocumentTitle + F.Archive AS DocumentTitle,
F.Keywords, F.PublishDate, F.PostedDate, F.ExpiredDate,
F.IsFlag, F.IsAdminOnly,...
I'm having some problems with the following:
I want to get the first visible AND frozen column of a column collection.
I think this will do it:
DataGridViewColumnCollection dgv = myDataGridView.Columns;
dgv.GetFirstColumn(
DataGridViewElementStates.Visible | DataGridViewElementStates.Frozen);
Is it also possible to make a bi...
How to print the bit representation of a string
std::string = "\x80";
void print (std::string &s) {
//How to implement this
}
...
I'm trying to convert an RGB image to an ARGB image, basically just adding 255 in for the alpha channel. I was wondering if there is any pack method to do this without iteration? So to iterate over my RGB data and append the 255 to each pixel.
...
Something any sophomore in CS should be able to answer, but I can't seem to wrap my head around it...
I have a set of bits, and I need to replace some of the bits with a different set. In a simplified example:
10101010 -original bit set
00001111 -mask showing replacement positions
00001100 -new bit values
10101100 -resulting bit se...
Hi I am using hibernate and Mysql. I have a class with a boolean attribute called 'active'.
The generated database table has the BIT data type. So far so good.
I want to query this value but I don't know how to do it.
I've tried
SELECT * from table where active = 1
doesn't work, neither the following
SELECT * from table where act...
Suppose I have any data stored in bytes. For example:
0110001100010101100101110101101
How can I store it as printable text? The obvious way would be to convert every 0 to the character '0' and every 1 to the character '1'. In fact this is what I'm currently doing. I'd like to know how I could pack them more tightly, without losi...
I have table with some fields that the value will be 1 0. This tables will be extremely large overtime. Is it good to use bit datatype or its better to use different type for performance? Ofcource all fields should be indexed.
...
I'm trying to make something like this:
int count = new Select().From(tblSchema).Where("Type & 1").IsEqualTo("1").GetRecordCount();
And the error message is:
Incorrect syntax near '&'.
Must declare the scalar variable "@Deleted".
Is it possible to do that with SubSonic?
...
Lets say I have a byte with 6 unknown values:
???1?0??
and I want to swap bits 2 and 4 (without changing any of the ? values):
???0?1??
But how would I do this in one operation in C?
I'm performing this operation thousands of times per second on a microcontroller so performance is the top priority.
EDIT
It would be fine to "toggle...
Hi,
I was scanning a third party source code using Findbugs (just to be cautious before integrating into it mine), and found the following warning:
long a = b << 32 | c
Bug: Integer shift by 32 Pattern id:
ICAST_BAD_SHIFT_AMOUNT, type: BSHIFT,
category: CORRECTNESS
The code performs an integer shift by
a constant amount...