bits

安装oracle11g win64 版本后,使用plsql登录时,报错

不羁岁月 提交于 2019-11-30 02:14:37
安装oracle11g win64 版本后,使用plsql登录时,出现报错: make sure you have the 32 bits oracle client installed,这里有两种解决方式 1、安装32位Oracle 11g Client; 2、如果已经安装了64位Oracle 11g Client ,进行如下操作: 1)在oracle官网(http://www.oracle.com/technetwork/topics/winsoft-085727.html)下载文件: instantclient-basic-nt-11.2.0.3.0.zip ; 2) 将文件解压到任一文件夹下,如D:\instantclient_11_2; 3) 打开PL/SQL developer,登录时点击取消,进入PL/SQL developer,选择Tools->>Preferences 4)修改参数: Oracle Home :OraDb11g_home1 OCI Library :D:\instantclient_11_2\oci.dll 5)配置环境变量,添加两个变量 变量一:指定 数据库 使用的编码,如果不设置,所看到的中文数据都会是乱码。 变量名:NLS_LANG 变量值:SIMPLIFIED CHINESE_CHINA.ZHS16GBK 变量二

What are the INFINITY constants in Java, really?

萝らか妹 提交于 2019-11-30 01:23:37
I just recently ran across the constants in the primitive type wrapper classes like Double.POSITIVE_INFINITY and Double.NEGATIVE_INFINITY . In the API, it defines the first as: A constant holding the positive infinity of type double. It is equal to the value returned by Double.longBitsToDouble(0x7ff0000000000000L). The others have definitions along these same lines. What I'm having trouble with is understanding what these constants actually are. They can't actually be or represent positive/negative infinities, because the system is by nature finite. Is it just some arbitrary setting of bits

Best way to convert 8 boolean to one byte?

一世执手 提交于 2019-11-29 23:47:15
问题 I want to save 8 boolean to one byte and then save it to a file(this work must be done for a very large data), I've used the following code but I'm not sure it is the best one(in terms of speed and space): int bits[]={1,0,0,0,0,1,1,1}; char a='\0'; for (int i=0;i<8;i++){ a=a<<1; a+=bits[i] } //and then save "a" can anyone give me a better code(more speed) ? 回答1: If you don't mind using SSE intrinsics, then _mm_movemask_epi8 is an excellent fit. It uses 16 bytes, but you can just set the

Perform logical shift using arithmetic shift operator in C [duplicate]

那年仲夏 提交于 2019-11-29 17:28:20
This question already has an answer here: Implementing Logical Right Shift in C 8 answers Right now I am reading the book Computer Systems : Programmer Perspective. One problem in the book says to perform a logical right shift on a signed integer, I can't figure out how to start on this. The following is the actual question from the book: Fill in code for the following C functions. Function srl performs a logical right shift using an arithmetic right shift (given by value xsra ), followed by other operations not including right shifts or division. Function sra performs an arithmetic right

Convert integer to bits

最后都变了- 提交于 2019-11-29 10:29:37
问题 I have byte to binary string function, std::string byte_to_binary(unsigned char byte) { int x = 128; std::ostringstream oss; oss << ((byte & 255) != 0); for (int i = 0; i < 7; i++, x/=2) oss << ((byte & x) != 0); return oss.str(); } How can i write an int to bits in same way? I don't want extra 0's at the beginning of binary string so that is why i can't figure out how to create a variable length each time. Also, i'm not using std::bitset. 回答1: I'll just post this as an answer. It is shorter,

How is 0x80000000 equated to -2147483648 in java?

半腔热情 提交于 2019-11-29 10:13:28
Taking the binary of 0x80000000 we get 1000 0000 0000 0000 0000 0000 0000 0000 How does this equate to -2147483648 . I got this question with this program. class a { public static void main(String[] args) { int a = 0x80000000; System.out.printf("%x %d\n",a,a); } } meow@VikkyHacks:~/Arena/java$ java a 80000000 -2147483648 EDIT I learned that 2's complement is used to represent negative numbers. When I try to equate this with that 1's complement would be 1's Comp. :: 0111 1111 1111 1111 1111 1111 1111 1111 2's Comp. :: 1000 0000 0000 0000 0000 0000 0000 0000 which again does not make any sense,

Get an array of the bit positions within a 64-bit integer

隐身守侯 提交于 2019-11-29 07:25:41
问题 OK, it may sound a bit complicated, but this is what I'm trying to do : Take e.g. 10101010101 And return { 0, 2, 4, 6, 8, 10 } - an array with all of the positions of bits which are set This is my code : UINT DQBitboard::firstBit(U64 bitboard) { static const int index64[64] = { 63, 0, 58, 1, 59, 47, 53, 2, 60, 39, 48, 27, 54, 33, 42, 3, 61, 51, 37, 40, 49, 18, 28, 20, 55, 30, 34, 11, 43, 14, 22, 4, 62, 57, 46, 52, 38, 26, 32, 41, 50, 36, 17, 19, 29, 10, 13, 21, 56, 45, 25, 31, 35, 16, 9, 12,

Javascript - convert integer to array of bits

眉间皱痕 提交于 2019-11-28 19:11:09
I am trying in javascript to convert an integer (which I know will be between 0 and 32), to an array of 0s and 1s. I have looked around but couldn't find something that works.. So, if I have an integer as 22 (binary 10110), I would like to access it as: Bitarr[0] = 0 Bitarr[1] = 1 Bitarr[2] = 1 Bitarr[3] = 0 Bitarr[4] = 1 Any suggestions? Many thanks convert to base 2: var base2 = (yourNumber).toString(2); access the characters (bits): base2[0], base2[1], base2[3], etc... var a = 22; var b = []; for (var i = 0; i < 5; i++) b[i] = (a >> i) & 1; alert(b); Assuming 5 bits (it seemed from your

Bit length of a positive integer in Python

删除回忆录丶 提交于 2019-11-28 18:11:49
1 = 0b1 -> 1 5 = 0b101 -> 3 10 = 0b1010 -> 4 100 = 0b1100100 -> 7 1000 = 0b1111101000 -> 10 … How can I get the bit length of an integer, i.e. the number of bits that are necessary to represent a positive integer in Python? SilentGhost In python 2.7+ there is a int.bit_length() method: >>> a = 100 >>> a.bit_length() 7 >>> len(bin(1000))-2 10 >>> len(bin(100))-2 7 >>> len(bin(10))-2 4 Note : will not work for negative numbers, may be need to substract 3 instead of 2 Gilles If your Python version has it (≥2.7 for Python 2, ≥3.1 for Python 3), use the bit_length method from the standard library.

How many values can be represented with n bits?

北城以北 提交于 2019-11-28 16:21:13
For example, if n=9 , then how many different values can be represented in 9 binary digits (bits)? My thinking is that if I set each of those 9 bits to 1, I will make the highest number possible that those 9 digits are able to represent. Therefore, the highest value is 1 1111 1111 which equals 511 in decimal. I conclude that, therefore, 9 digits of binary can represent 511 different values. Is my thought process correct? If not, could someone kindly explain what I'm missing? How can I generalize it to n bits? 2 9 = 512 values, because that's how many combinations of zeroes and ones you can