What exactly does stand IKB for? - boolean

I have a question which goes as:
IKB is equal to:
(a) 1k bytes (b) 1024 bytes (c) 210 bytes (d) none of these
The answer says (b), but I haven't heard of this before, so my question is what exactly is IKB?

with thanks to Kilobyte
If you do a quick google, you will find a lot of explanations,
something like Bits and Bytes : An Explanation

This is almost certainly supposed to read “1KB” or 1 kilobyte, which is usually taken to mean 1024 bytes rather 1000 bytes.

"1kb" == "1 kilobyte" == 1024 bytes
"IKB" doesn't mean any of these things.
So I guess "d)" is the answer.
Can you say "Trick Question"? ;)

kilobyte (kB) 10^3 kibibyte (KiB) 2^10 = 1.024 × 103
megabyte (MB) 10^6 mebibyte (MiB) 2^20 ≈ 1.049 × 106
gigabyte (GB) 10^9 gibibyte (GiB) 2^30 ≈ 1.074 × 109
terabyte (TB) 10^12 tebibyte (TiB) 2^40 ≈ 1.100 × 1012
petabyte (PB) 10^15 pebibyte (PiB) 2^50 ≈ 1.126 × 1015
exabyte (EB) 10^18 exbibyte (EiB) 2^60 ≈ 1.153 × 1018
zettabyte (ZB) 10^21 zebibyte (ZiB) 2^70 ≈ 1.181 × 1021
yottabyte (YB) 10^24 yobibyte (YiB) 2^80 ≈ 1.209 × 102
This is all SI decimal prefixes(left)and EC binary prefixes(right)
as you can see not one of them used "lkb" so it must be a typo
Source: http://en.wikipedia.org/wiki/Kilobyte

Related

Detect number of bytes required for an arbitrary number in Scala

I'm trying to figure out the simplest way to write a function to detect the amount of bytes required for a number in Scala.
For instance the number
0 should be 0 bytes
1 should be 1 byte
127 should be 1 byte
128 should be 2 bytes
32767 should be 2 bytes
32768 should be 3 bytes
8388607 should be 3 bytes
8388608 should be 4 bytes
2147483647 should be 4 bytes
2147483648 should be 5 bytes
549755813887 should be 5 bytes
549755813888 should be 6 bytes
9223372036854775807 should be 8 bytes.
-1 should be 1 byte
-127 should be 1 bytes
-128 should be 2 bytes
-32767 should be 2 bytes
-32768 should be 3 bytes
-8388607 should be 3 bytes
-8388608 should be 4 bytes
-2147483647 should be 4 bytes
-2147483648 should be 5 bytes
-549755813887 should be 5 bytes
-549755813888 should be 6 bytes
-9223372036854775807 should be 8 bytes
is there any way to do this besides doing the math figuring out where the number is wrt 2^N?
After all the precisions in the comments, I guess the algorithm for negative numbers would be: whatever the answer for their opposite would be; and Long.MinValue is not an acceptable input value.
Therefore, I suggest:
def bytes(x: Long): Int = {
val posx = x.abs
if (posx == 0L) 0
else (64 - java.lang.Long.numberOfLeadingZeros(posx)) / 8 + 1
}
Tests needed.
As I mentioned, you're basically asking for "what's the smallest power-of-2-number larger than my number", with a bit of adjustment for the extra digit for the sign (positive or negative).
Here's my solution, although the result differs for 0 and -128, because, as Bergi commented on your question, you can't really write 0 with 0 bytes, and -128 fits in 1 byte.
import Math._
def bytes(x: Double): Int = {
val y = if (x >= 0) x + 1 else -x
ceil((log(y)/log(2) + 1)/8).toInt
}

HEVC: How to define maximum slice size

I'm trying to define slice's maximum size through parameters of the configuration file.
I set
SliceMode : 2
SliceArgument : 500
but I don't get the corresponding results:
105080 bits
81616 bits
24256 bits
3752 bits
168 bits
128 bits
10488 bits
160 bits
216 bits
73792 bits
What am I doing wrong?
Thank you in advance!

Calculating tape length to store an amount of records

Consider a magnetic tape drive with density=1666 bpi and IBG=0.5 inch. How many inches of tape are required to store 50,000 records, each record is 120 bytes. Blocking factor is 45.
I don't understand how to convert the units to an answer...
You don't specify how many bits per byte, but if you assume 8 bits is 1 byte, then each 120 byte record will be 120 * 8 = 960 bits.
The total number of bits in 50,000 records will be 50,000 * 960 = 48000000 bits. At a density of 1666 bpi, this is 48000000 / 1666 = 28811.5 inches.
Then, as your blocking factor (I'm assuming this means the number of records per data block), is 45, and you have 50,000 records, you will need 50,000 / 45 = 1112 blocks (rounded up), so there will be 1111 inter-block gaps (IBG). Therefore, you will have 1111 * 0.5 inches of IBG = 555.5 inches.
In total, you will have 28811.5 + 555.5 = 29367 inches of tape.
You'll need to double-check my assumption of the terminology and also the underlying size of a single byte in bits.

Padding in MD5 Hash Algorithm

I need to understand the Md5 hash algorithm. I was reading a documents and it states
"The message is "padded" (extended) so that its length (in bits) is
congruent to 448, modulo 512. That is, the message is extended so
that it is just 64 bits shy of being a multiple of 512 bits long.
Padding is always performed, even if the length of the message is
already congruent to 448, modulo 512."
I need to understand what this means in simple terms, especially the 448 modulo 512. The word MODULO is the issue. Please I will appreciate simple examples to this. Funny though, this is the first step to MD5 hash! :)
Thanks
Modulo or mod, is a function that results in telling you the remainder when two numbers are divided by each other.
For example:
5 modulo 3:
5/3 = 1, with 2 remainder. So 5 mod 3 is 2.
10 modulo 16 = 10, because 16 cannot be made.
15 modulo 5 = 0, because 15 goes into 5 exactly 3 times. 15 is a multiple of 5.
Back in school you would have learnt this as "Remainder" or "Left Over", modulo is just a fancy way to say that.
What this is saying here, is that when you use MD5, one of the first things that happens is that you pad your message so it's long enough. In MD5's case, your message must be n bits, where n= (512*z)+448 and z is any number.
As an example, if you had a file that was 1472 bits long, then you would be able to use it as an MD5 hash, because 1472 modulo 512 = 448. If the file was 1400 bits long, then you would need to pad in an extra 72 bits before you could run the rest of the MD5 algorithm.
Modulus is the remainder of division. In example
512 mod 448 = 64
448 mod 512 = 448
Another approach of 512 mod 448 would be to divide them 512/448 = 1.142..
Then you subtract 512 from result number before dot multiplied by 448:
512 - 448*1 == 64 That's your modulus result.
What you need to know that 448 is 64 bits shorter than multiple 512.
But what if it's between 448 and 512??
Normally we need to substract 448 by x(result of modulus).
447 mod 512 = 447; 448 - 447 = 1; (all good, 1 zero to pad)
449 mod 512 = 1; 448 - 449 = -1 ???
So this problem solution would be to take higher multiple of 512 but still shorter of 64;
512*2 - 64 = 960
449 mod 512 = 1; 960 - 449 = 511;
This happens because afterwards we need to add 64 bits original message and the full length have to be multiple of 512.
960 - 449 = 511;
511 + 449 + 64 = 1024;
1024 is multiple of 512;

Size of a table (in bytes) in Q

How can I read the size of a table (in bytes) in Q?
I know that hcount returns the size of a file in bytes, but I can't find something similar for tables (or in general any object...)
−22!x is an optimised shortcut to count -8!x
q)(-22!trade)~count -8!trade
1b
q)\t:100 count -8!trade
3596
q)\t:100 -22!trade
839
this is serialized (wire) object size
play around with \w
this will give you object size in memory
q)a:til 10000
q)count -8!a
40014
q)\w
176464 67108864 67108864 0 0 2137387008j
q)b:til 10000
q)\w
242000 67108864 67108864 0 0 2137387008j
q)242000-176464
65536
q)\ts b,a
0 131200j
q)131248%2
65624f
q)
After some searching, it appears that count -8!tablename does the trick.