Search Discussion-Lab

Wednesday, September 28, 2011

Easy concept: Bitwise right and left shift << / >>

">>" is called the Bitwise right shift operator and "<<" is called the Bitwise left shift. Why bitwise? Cause this operator is used as a easy tool for programmers working with bytes. If you just think about the results of two numbers compared with this operator you will be fixed. Cause, this operator changes bit orders in a number. If you don't have the knowledge of bytes or bits simply read this lesson. Now for the clear concept let's see the actual calculation by this operator in decimal.


A << B = A * (2^B)


Here "^" is the "to the power", not any other operator. Now see some example:


2 << 3 = 16 1 << 2 = 4 20 >> 2 = 5
120 >> 3 = 15


Now you are fixed, as I told you. Let's see the same examples in binary expression:


10 << 3 = 10000 1 << 2 = 100 10100 >> 2 = 101
1111000 >> 3 = 1111
A << B = C


What happened on above examples? The left shift (<<) adds B number of zeros to the end of A. And the right shift cut's off B number of zeros from the end of A. This is all about Left/Right shift.

Wednesday, June 1, 2011

Nokia bookmark file format - BMK specification

What is a BMK File?

BMK stands for "BooMarK". It is used in most Nokia phones to keep a address of a file. The address can be any of HTTP, RTSP, MAILTO, FILE etc. There is a title of the file can be saved in this file.

It's a tiny file format.




The tree is looked like such as:

[Startar bytes data]
[Title text data]
[Separator detector bytes]
[Address text data]
[End of bmk format bytes]





That's all in a bmk. It's very simply understandable format.



Starter bytes data

It's a 12 bytes long data. There is no logical complex in them. They are mandatory to initiate.

These values are:

03, 01, 6A, 00, 45, C6, 7F, 01, 87, 15, 11 and 03.


It's the valid bmk indicator bytes.




Title text data


It's just some texts as bytes. Plainly write them.



Separator detector bytes


It's 7 bytes long mandatory data. These bytes are used to detect the Title and the Address separately.


Here they are:

20, 00, 01, 87, 17, 11 and 03.




Address text data


It's simple text bytes like the title bytes.




End of bmk format bytes


It's 14 bytes long data. They indicates the final portion of bmk file.


Here's they are:

00, 01, 87, 10, 03, 49, 43, 4F, 4E, 00, 11, 01, 01 and 01.


Now it's all you know about BMK format. Simply apply them in mobile applications with the link of the vendor's web site to get more hit!

Thursday, May 26, 2011

Byte - Basic concept & simple implementation

According to computer science Byte is combination of two words "By eight". Why eight comes? Read throughly, you will be known of this later. You have seen files saved in hard disc or any memory card. What are these files what are they contain of? Files are a series of numbers like 1, 2, 100, 7, ... ... etc. These numbers take place one after another and makes a file. File size depends on how many numbers of numbers they cosist of. Now, what are these numbers. Simply, these are Bytes. If a file has 5 bytes like 10, 19, 105, 10 and 2 it will be 5 bytes long. If a file has 1024 bytes it will be 1 killow bytes long. As like as
QuantityUnit
1024 B1 KB
1024 KB1 MB
1024 MB1 GB
1024 GB1 TB
725 B0.71 KB

A byte can have a value from 0 to 255 total 256 values. As most computer processor works on 2 base calculation, bytes are calculated by base 2, Binary. As you know binary numbers charecter can be only 0 and 1 these are called bit. Computer processor calculates 1 as true or yes or circuit connected 0 as, false or no or circuit disconnected. So,
DecimalBinary
100000001
200000010
1000001010
10501101001
25511111111

Did you noticed I have used 8 digits to express a binary number. Here is the reson of "By eight". A number between 0 to 255 is maximum 8 bit long in binary. So they are called "Byte". Now you have to know more advanced. If you go to working practically you will face a problem. You will find negetive byte value like -1 or -50. As I have told bytes can have values 0 to 255 that isn't incorrect in hexadecimal or binary but incorrect in decimal. Actualy byte values sequence is like this

0, 1, 2, 3, ... ... 126, 127, -128, -127, -126, ... ... -3, -2, -1

Here are 256 values.

ValuesTotal
01
1 to 127127
-128 to -1128
All total:256

But in hexadecimal or binary these values are like
DecimalHexadecimalBinary
10x0100000001
-10xFF11111111
730x4901001001
-990x9D10011101

Now you can have a simple glimpse how bytes in file used. If you want to express a text charecter like "A" in a file there is a byte with value 65. Another charecter like "¤" contains two bytes 194 (-62) and 164 (-92). You can see more byte values of text charecter surfing the internet. Another usage in image files to express colors in RGB or ARGB. Now you know the basics of bytes. Everithing nowadays like video, text, image, sound can be express within bytes in a file concept.