p********7 发帖数: 18007 | 1 • 听说最迟明天最晚周日有什么事要发生 -ych2000- 给 ych2000 发送悄悄话
ych2000 的博客首页 ych2000 的个人群组 (754 bytes) (607 reads) 11/29/12
• 我最想听的利好就是WS15搞定啦 -JieHu-- ♂ 给 JieHu- 发送悄悄话 JieHu-
的博客首页 JieHu- 的个人群组 (0 bytes) (21 reads) 11/29/12
• 目前还不清楚利好究竟是什么 -ych2000- 给 ych2000 发送悄悄话 ych2000
的博客首页 ych2000 的个人群组 (85 bytes) (159 reads) 11/29/12
• 俺也听到一些传闻,目前不能确定 -ccvip_usa- 给 ccvip_usa 发送悄悄话
ccvip_usa 的博客首页 ccvip_usa 的个人群组 (0 bytes) (24 reads) 11/29/12
• 米兔。说不定大家听到的都一样 :) -JieHu-- ♂ 给 JieHu- 发送悄悄话
JieH... 阅读全帖 |
|
s***e 发帖数: 122 | 2 public static byte revByte(byte b) {
int ib = (b >= 0) ? b : b+256;
int ic = 0;
for (int i = 0; i < 8; ++i) {
ic = (ic*2) + (ib%2);
//System.out.printf("%d", ib%2);
ib /= 2;
}
//System.out.printf(" = %d\n", (byte)ic);
return (byte)ic;
}
or use bit operators:
public static byte revByte(byte b) {
int ib = b;
int ic = ib & 1;
//System.out.printf("%d", ib & 1);
for (int i = 1; i < 8; ++i) {
ib >>>= 1;
ic = (ic << 1) | (ib & 1);
//System.out.printf("%d", ib & 1);
}
//System.out.printf(" = %d\n", (byt |
|
D****A 发帖数: 360 | 3 interesting. 估计是每个byte取一位做连接符, 是1就看下一个byte否则结束
每个byte只有7位有效位,两个byte应该能表示一个integer的低14位
0xA0=10100000
0x81=10000001
0x20=00100000
因为一个byte只能encode7位,所以0xA0的最高位1应该在0x81里的有效最低位,
另外0xA0的低7位应该在0x20里,0xA0和0x20的低七位相通,说明这种encoding
把每个byte的最高位用做连接符了
综上转换公式应该是 do x = (x << 7)|(b[i] & 0x7f) until (b[i] & 0x80) == 0 |
|
M*******8 发帖数: 85 | 4 【 以下文字转载自 Programming 讨论区 】
发信人: Mueller08 (简单,真实), 信区: Programming
标 题: 怎么把 integer 转为 multi-byte integer format?
发信站: BBS 未名空间站 (Sun Feb 21 16:01:15 2010, 美东)
下面的例子是怎么把0xA0 转为 0x81 和 0x20 的? 看不懂, 能不能给讲讲, 谢谢
How to transfer an integer to multi-byte integer format?
For example, the integer value 0xA0 would be encoded with the two-byte
sequence 0x81 0x20. The integer value 0x60 would be encoded with the one-
byte sequence 0x60. |
|
s*****g 发帖数: 1055 | 5 Found the quote:
"In the ATM reference model, the cell header is only 4 bytes long at the ATM
layer. The Transmission Convergence (TC) sublayer calculates and appends
the fifth byte (header error control [HEC]), which is a checksum of the ATM
cell header in the ATM physical layer. The TC sublayer handles functions
such as cell delineation and error detection and correction by adding a 1-
byte CRC. Because cell relay acts in the ATM layer, and for alignment and
efficiency reasons, the HEC byte is |
|
n******8 发帖数: 172 | 6 String a="test string";
bytes[] bt=a.getBytes();
StringBuffer bsb=new StringBuffer();
bsb.append(bt);
question, is there any simple way to parse out byte[] stored in the bsb as a
string? or I have to get it byte by byte?
couldn't google out a good answer. |
|
s*****x 发帖数: 3679 | 7 【 以下文字转载自 DealGroup 俱乐部 】
发信人: wiiRhappy (wiiRhappy), 信区: DealGroup
标 题: 【$】K-Byte 1GB DDR PC-3200 Dimm of Ram - $7.50, 1GB DDR2 PC-5300 Dimm - $5.50, 2GB DDR2 PC-5300 Dimm - $9.50, Staples Clearance B&M YMMV
发信站: BBS 未名空间站 (Sun Jun 20 20:56:52 2010, 美东)
I walked in a Staples here in Pittsburgh and saw three types of Ram on
Clearance for really cheap. Here they are:
K-Byte 1GB DDR PC-3200 Dimm of Ram - $7.50 each
SKU: 673881
-Picked up a pair of these
K-Byte 1GB DDR2 PC-5300 Dimm of Ram - $5.50 |
|
s*****g 发帖数: 1055 | 8 8 bytes if control word is implemented (4 bytes control word + 4 bytes
original header). Why asking? at least it is obvious to me. |
|
l*****c 发帖数: 1153 | 9 I assume everyone knows what goodbug said, what he said is well known right.
But, there is "raw bytes". What I did not say clear is, it is the raw bytes
of a specific encoding.
Say, you encode the string "今狐冲" in UTF-8, it is actually store in memory
as "E4 BB 8A E7 8B 90 E5 86 B2" (of course, when I paste it here, it is
encoded in another encoding schema). What I need is each of these individual
raw bytes.
C++ or Java. There is only default encoding. |
|
y****n 发帖数: 192 | 10 恩, 我犯糊涂了。
按照这个思路写了一下:
public static byte[] getByteDataFromFile(){
File f = new File(rawDataFile);
RandomAccessFile rf;
byte[] rawByteData = null;
try {
rf = new RandomAccessFile(rawDataFile, "r");
rawByteData = new byte[(int) rf.length()];
} catch (FileNotFoundException e2) {
e2.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
BufferedInputStream in = null;
|
|
M*******8 发帖数: 85 | 11 下面的例子是怎么把0xA0 转为 0x81 和 0x20 的? 看不懂, 能不能给讲讲, 谢谢
How to transfer an integer to multi-byte integer format?
For example, the integer value 0xA0 would be encoded with the two-byte
sequence 0x81 0x20. The integer value 0x60 would be encoded with the one-
byte sequence 0x60. |
|
z*******w 发帖数: 79 | 12 Date: Fri, 17 Nov 2000 16:37:04 +0200
From: Ofir Arkin
To: B*****[email protected]
Subject: Using the TOS Byte's Unused Bit (Fingerprinting
WIN2K,
ULTRIX and more)
Background:
Each IP Datagram has an 8-bit field called the "TOS Byte",
which represents the IP support for prioritization and
Type-of-Service handling.
The "TOS Byte" consists of three fields.
The "Precedence field", which is 3-bit long, is intended to
prioritize the IP Datagram. It has eight l |
|
w*******y 发帖数: 60932 | 13 I walked in a Staples here in Pittsburgh and saw three types of Ram on
Clearance for really cheap. Here they are:
K-Byte 1GB DDR PC-3200 Dimm of Ram - $7.50 each
SKU: 673881
-Picked up a pair of these
K-Byte 1GB DDR2 PC-5300 Dimm of Ram - $5.50 each
SKU: unknown - there weren't any left
K-Byte 2GB DDR2 PC-5300 Dimm of Ram - $9.50 each
SKU: 718749
This DIMM is also featured in this thread for $25.50.
Since these are on Clearance they are of course B&M and YMMV. Good luck
everyone!
I talked to a S |
|
d********e 发帖数: 321 | 14 上周被问到一个计算 某正整数的比特位, 比如 3 有2个 比特位,我给秒了
然后被追问,如果输入是一个byte[] array,长度为n,问如何计算数组里全部的比特
位?我说挨个数,然后自然是 O(8n),但是面试小哥说要更快的算法,也就是降低常数
项8,我想不出来了,请问有啥好办法?
我记得lc里有一个是数 1 ... n的连续整数的比特位,但是这题是给的byte[]数组 |
|
h*d 发帖数: 19309 | 15 Half Byte Loader R100 Released
greg | September 8, 2010
Wololo and Co. just unveiled Half Byte Loader (HBL) R100. That means
homebrew on firmware 5.03 to 6.20 by way of the Patapon 2 Demo, and for
those who’ve upgraded to 6.30 or 6.31 for whatever reason, you can now
enjoy homebrew using Hot Shots Golf: Open Tee — the PSN or UMD version.
A few caveats with homebrew on OFW 6.30/6.31 though… Wololo notes HBL is
not as stable for Hot Shots Golf as it is for the Patapon 2 demo. If you
wish to help o |
|
d********r 发帖数: 199 | 16 Servlet的IO吞吐瓶颈在哪里?为什么测下来只有3M bytes 左右?
想测一下Tomcat servlet 的输出能力,就写了如下代码段:
1. Server: P4 3.0G, 1G DDR400 memory
输出一个100M bytes的http 文本。servlet key code segment 如下: |
|
m****r 发帖数: 6639 | 17 i get the binary bytes from somewhere, that is the key i am suppose to use
when i sign my document.
the api for javax.xml.crypto.dom.DOMCryptoContext wants a java.security.Key
object, not byte[]. but just looking at the api's, it's not clear to me how
i can go from one thing to the other. anyone can help?
thanks |
|
m******t 发帖数: 2416 | 18
You need to ask that "somewhere" how to convert these bytes into a key. They
can be anything for all we know - exported ascii, raw bytes of a keystore
file, a serialized Key object, etc. |
|
e****o 发帖数: 76 | 19 how do you reverse the bit order of a byte. let's say:
byte n = 34; // 00100010
after reverse, it should be 01000100
I had problem with the sign bit.
Thank you. |
|
g*****g 发帖数: 34805 | 20 What do you mean raw bytes? String is always in certain encoding, you
get different bytes in different encoding, internally, java used
Unicode-16 encoding. |
|
o***g 发帖数: 2784 | 21 你的思路不对
java里string的意义是一串char
char的意义是一个字符,这个字符跟byte无关
internal memory block是char或者string隐藏的东西了,一般情况下,你没必要知道
人家愿意放一个图片存这个char,那是人家愿意。
另外,jvm隐藏了memory block。即便Array,人家也不保证这些元素是连续的空间存放的
你不能做这个假设
string同理
encoding
C
byte. |
|
g*****g 发帖数: 34805 | 22 new String(byte[] bytes, String charsetName)
a |
|
y****n 发帖数: 192 | 23 public static byte[] getRawByteDataFromFile(){
StringBuffer sb = new StringBuffer();
String s = null;
byte[] rawByteData = null;
BufferedReader in = null;
try {
in = new BufferedReader(new FileReader(rawDataFile));
while((s=in.readLine())!=null){
sb.append(s+"\n");
}
} catch (FileNotFoundException e1) {
e1.printStackTrace();
} catch (IOException e) {
e.printStackTra |
|
y****n 发帖数: 192 | 24 我知道FileInputStream, 但它的read()方法质只读进一个byte,我想得到所有数据
的byte[] |
|
b***y 发帖数: 2799 | 25 ☆─────────────────────────────────────☆
jyu (jyu) 于 (Fri Mar 14 16:55:32 2008) 提到:
hi All,
I have a problem casting a 4 byte unsigned char into integer.
here is my code:
this is C++ code:
// header is just a structure with a field of 4 byte unsigned char
unsigned int sequence = *(reinterpret_cast(header->m_sequenceNum
));
and the sequence is always some overflow #!
all comments/help are appreciated!
Thank you very much!
☆─────────────────────────────────────☆
Xentar (思考猪) 于 |
|
g*****g 发帖数: 34805 | 26 这叫multi-byte character,我没听说multi-byte string这个说法。 |
|
k***r 发帖数: 4260 | 27 have you heard of "unicode string"? :)
I think it's just a short form of string composed of all
unicode characters. similarly multi-byte string, to me,
means string composed of all multi-byte characters. |
|
M*******8 发帖数: 85 | 28 多谢指点!
这个
do x = (x << 7)|(b[i] & 0x7f) until (b[i] & 0x80) == 0
是从multi-byte integer format转为regular integer 吧?
如何从integer转为 multi-byte integer format? 谢谢 |
|
s**i 发帖数: 30 | 29 【 以下文字转载自 Linux 讨论区 】
【 原文由 suyi 所发表 】
Is byte swap needed if I want to access data file generated
by other unix machine (SGI for example) on a pc running linux?
I know that Windows machine and Unix machine has different byte order
in saving data. Is this inherent property of hardware architechture or
operating system? |
|
w*********g 发帖数: 30882 | 30 中缅铁路项目被缅政府取消
来源: 大圣造反 于 2014-07-20 05:39:43 [档案] [旧帖] [给我悄悄话] 本文已被阅
读:632 次 (3415 bytes)
字体:调大/重置/调小 | 加入书签 | 打印 | 所有跟帖 | 加跟贴 | 当前最热讨论主题
ZT
按:注意两点:1)一个多月前专家还在为这条铁路造势,信心满怀,欢欣鼓舞,而今
余音绕梁未绝,却遭缅方无情否定。专家们的判断力完全不可信赖。2) 缅方以人民意
愿为由停建伊江大坝,再以人民意愿为由折腾莱比塘,又以人民意愿为由宣布取消铁路
项目,但同时却又违逆民意积极推进萨江大坝,以保护大坝建设 为名调兵遣将大打出
手。自相矛盾违反逻辑,其中必有恶意。专家一叶障目一错再错,商人利令智昏火中取
栗,西南外交危险。
缅甸铁道交通部称,缅甸和中国签订的皎漂-昆明铁路项目理解备忘录(MOU)已经期满
失效。
缅甸铁道交通部官员Myint Wai周五说,中方没有就签订另一份合同提出任何申请,而
且由于缅甸人民和社会组织的反对,这个项目将不可能实施。
他说,按2011年4月签署的理解备忘录,皎漂-昆明铁路项目预期在三年内实施,... 阅读全帖 |
|
w*********g 发帖数: 30882 | 31 中印签了重大协议,中国承诺投资2000亿
来源: 霸天虎 于 2014-09-18 23:17:56 [档案] [旧帖] [给我悄悄话] 本文已被阅读
:275 次 (103 bytes)
字体:调大/重置/调小 | 加入书签 | 打印 | 所有跟帖 | 加跟贴 | 当前最热讨论主题
好像是边界争论可以了解了
没看到印度承诺什么 |
|
S*********4 发帖数: 5125 | 32 中央对“占中”已作“最坏打算”
来源: 老马识途 于 2014-10-14 13:51:06 [档案] [博客] [旧帖] [给我悄悄话] 本文
已被阅读:63 次 (4357 bytes)
字体:调大/重置/调小 | 加入书签 | 打印 | 所有跟帖 | 加跟贴 | 当前最热讨论主题
多维网2014年10月14日报道:香港中联办主任张晓明日前出席民建联在深圳举行的
路向营时,除了表明中央高度关注香港当前局势外,还抛出“中央对占领事件已作最坏
打算”的说法。另外,特区政府也作了评估,内部厘定以“底线策略”应变,包括预计
事件最差将拖至11月仍未解决,因APEC峰会将在北京举行,若集结人士进一步冲击政府
总部,则会弃用催泪弹而直接使用警棍,极有可能出现流血冲突。
综合媒体10月14日报道,民建联11日起一连两日在深圳举行路向营。据了解,在路向营
首晚,出席的约260名民建联成员分成11个小组进行分组讨论。张晓明周日出席分组讨
论后的总结环节,听取各小组组长汇报意见,其后发表逾一小时讲话,转述中央对占领
行动的看法,除了将事件定性为“斗争”,并研判有外国势力介入。
民建联主席谭耀宗在接受媒... 阅读全帖 |
|
S*********4 发帖数: 5125 | 33 中国将向美国波士顿出口284辆地铁车辆
来源: mrict. 于 2014-10-23 05:51:08 [档案] [旧帖] [给我悄悄话] 本文已被阅读
:16 次 (370 bytes)
字体:调大/重置/调小 | 加入书签 | 打印 | 所有跟帖 | 加跟贴 | 当前最热讨论主题
中国将向美国波士顿出口284辆地铁车辆 【中国向美国出口地铁】中国开始向美国
出口地铁车辆了。美国当地时间22日下午,马萨诸塞州交通局批准,向中国北车采购
284辆地铁车辆,装备波士顿地铁。清朝时波士顿就有地铁了(1897年),是世界最早
建地铁的城市之一。 |
|
|
h****1 发帖数: 33 | 35 Byte是组成信息的载体,今天Windows已经是64位了,简单的二进制,排列组合现在世
界所以信息可能都能存储下去。
DNA是蛋白质组成结构载体,只要4个独立碱基对,3位组合就足够表现今天实际所有生
物了。
相信进化是要勇气的。 |
|
c**********e 发帖数: 2007 | 36 Find the bits that are one in a byte (in C) |
|
c*******g 发帖数: 1996 | 37 什么意思?找到BYTE(8个bit)中为1的bit的position?还是找有多少个为1? |
|
h*******o 发帖数: 778 | 38 用空间换时间,用一个256数组存一下每个byte比特位数。 |
|
z*********n 发帖数: 1451 | 39 n -= n & -n 可以消掉最低bit 位,用这个方法可以降低常数项到每个byte平均bit数*
n,
当然最坏还是8n。 |
|
S*********g 发帖数: 24893 | 40 这个bit coin跟 byte coin比有什么优势吗? |
|
G**Y 发帖数: 33224 | 41 【 以下文字转载自 Hardware 讨论区 】
发信人: GGYY (唧唧歪歪), 信区: Hardware
标 题: 把20G的文件改动1个byte,多少disk i/o?
发信站: BBS 未名空间站 (Fri Aug 22 03:05:02 2014, 美东)
学过电脑的来说一下?
推论:能在ssd上run virtualbox吗?似乎没觉得快。但是每次推出。那个几个G硬盘文
件都会更改。 |
|
b*****y 发帖数: 26 | 42 Hello, this is a data set for data mining.
I believe the experiences on this case should be helpful in general.
The questions is, how to make fast queries on large tables
(>=800 million records, 10G bytes of data)
with ordinary machines ?
Below are some details:
There is only one table, with the following fields:
cabId CHAR(8), timestamps DATETIME, longitude FLOAT, latitude FLOAT, status
CHAR(1)
We want to be able to query on cabId, timestamps, latitude, and longitude.
We also need to find out a |
|
t*****g 发帖数: 1275 | 43 Have you ever considered a non-DB approach?
The data structure looks pretty straightforward. You may find a way (need
some compression) to put all data including a unique key (8 bytes) into a
16GB 64bit machine.
Now think about the reverse index.You need to build index on cabid/timestamp
/longitude/latitude, each index could fit into a single machine.
When queries come in, get sets of unique keys from all indices and find the
intersect.
Do your final query on the datahost to return result.
I wou |
|
b******y 发帖数: 9224 | 44 dumb solution:
you make a hashtable of all possible combinations of the byte n and its
reversed value.
Then, just look up the hashtable based on the input ;-)
This is the fastest way. Seems like an interview question... |
|
c*****t 发帖数: 1879 | 45 It isn't necessarily the fastest approach. The main reason is that
a pre-defined table:
byte[] table = { ... };
can cause a slow start up time since each entries are executed as
an assignment statement. There are other ways to generate the table,
but not as simple. |
|
j******n 发帖数: 108 | 46 很简单的一个问题,把 byte[] 转换成相应的 int[]
我写了一个循环,每次转换 4byte
因为需要转换的数量可能比较大,有几十万的int
我测了一下时间,还是不大能满足我的要求
请问,还有没有比较优化的方法么?比如类似 c 里面的 memcp
4byte 到 int 的转换如下:
int x = ((buf[start] & 0xFF) << 24)
| ((buf[start+1] & 0xFF) << 16)
| ((buf[start+2] & 0xFF) << 8)
| (buf[start+3] & 0xFF);
还是说,大概只能达到这个水平,很难再优化了?
非常感谢! |
|
l*****c 发帖数: 1153 | 47 用String.charAt()得到的是字符,是經過encoding的。怎麼能得到第i個raw byte?
getBytes()似乎得到的也是encoding過的。 |
|
l*****c 发帖数: 1153 | 48 Or say, I want the string internal memory block, I do not want any encoding
applied when I retrieve this memory block. I'm C++ guru, not Java guru. In C
++, I always have the raw memory block.
Currently, when I call String.charAt(), it does the encoding for me. Say,
they string is Unicode, it give me the the ith char, but I want the ith byte. |
|
c*****t 发帖数: 1879 | 49 Why don't you use byte[] for stuff read in? Why did you have to use
String in the first place? How did you get your data into String?
statement. |
|
g*****g 发帖数: 34805 | 50 If you need to encode your string in UTF-8, use
String.getBytes("UTF-8") and you'll get it.
String.getBytes(charset) does encoding
new String(bytes, charset) does decoding
statement. |
|