• missing xbfish.com image
Uncategorized
missing xbfish.com image
Posted on

[Math] Change of base formula for Logarithm

More often than not, I need to apply change of base formula in the field of Digital Logic Design.

The change of base formula is as follow:

logbx = logax / logab

where / denotes divide, and a = any integer for the base

Uncategorized
missing xbfish.com image
Posted on

Linux & Windows side by side

on my dual-monitor set up:

missing xbfish.com image

I.T Concepts
missing xbfish.com image
Posted on

Rules of Simplification for Karnaugh Map

The video below explains the concept of simplification when using K-Map to find the minimal Sum-of-Expressions (SOP):

Programming
missing xbfish.com image
Posted on

Redirect URLs using .htaccess

Suppose you want to redirect http://example.com/folder to http://anotherfolder.example.com, you can add the following line in your .htaccess file:

Redirect permanent /folder http://anotherfolder.example.com

Reference :: http://www.besthostratings.com/articles/htaccess-redirects.html

Software
missing xbfish.com image
Posted on

[Linux] Resolving “PHP Deprecated” error when executing command

A while ago, I was facing the following error when running Facebook Command Line on my Linux:

PHP Deprecated: Comments starting with ‘#’ are deprecated in /etc/php5/cli/conf.d/mcrypt.ini on line 1 in Unknown on line 0

To resolve this issue, open mcrypt.ini located at /etc/php5/cli/conf.d

You will see the following code snippet:

# configuration for php MCrypt module
extension=mcrypt.so

Replace the # with ;:

; configuration for php MCrypt module
extension=mcrypt.so

Hope this helps :)

Life
missing xbfish.com image
Posted on

Finally, getting into the tutorial slot I wanted

NUS CORS is a bullshit system. I ranked a tutorial slot as my first choice and I didn’t get in. Ironically, I got a friend who ranked it as 3rd choice got in.

xbfish.com

After camping for the whole day today, I finally get into the tutorial slot that I wanted.

xbfish.com

“Guan Yin Ma” blessed me… :)

Uncategorized
missing xbfish.com image
Posted on

A clever way to recycle your old PC casing

missing xbfish.com image

Brillant, isn’t it? :)

I.T Concepts
missing xbfish.com image
Posted on

Conversion of Binary & Gray codes

First of all, you need to understand the truth table for Exclusive-OR gate:

Input Output
0 0 0
0 1 1
1 0 1
1 1 0

With this in mind, we move on to converting binary code to gray code.

Suppose we want to convert decimal 10, binary value of 1010 to gray code, the first step is to retain the most significant bit(MSB) of the binary. Hence,

1 0 1 0 (binary)
1 x x x (gray)

where x is still unknown.

Then, we take the adjacent pair of binary code to derive the 2nd significant bit of the gray code. Based on the truth table, 1 and 0 give us a 1 :

1 0 1 0 (binary)
1 1 x x (gray)

Then we move on to the next adjacent pair of binary code to get the 3rd significant bit of the gray code, with reference from the OR truth table :

1 0 1 0 (binary)
1 1 1 x (gray)

and lastly,

1 0 1 0 (binary)
1 1 1 1 (gray)

Therefore, the gray code of 1010 (decimal 10) is 1111.

Now, to convert gray code to binary code, we employ the same technique with the exception that we take the previous significant bit of the gray code and the next binary code to get the output.

Suppose we want to convert decimal 6, gray code value of 0101 to binary code, the first step is still to retain the MSB of the binary. Hence,
0 1 0 1 (gray)
0 x x x (binary)

where x is still unknown.

From here, we move on to take the previous significant bit of the gray code and the next binary code, which is 1 and 0. 1 and 0 give us 1.

0 1 0 1 (gray)
0 1 x x (binary)

and then we move on….

0 1 0 1 (gray)
0 1 1 x (binary)

0 1 0 1 (gray)
0 1 1 0 (binary)

Thus, the binary code of 0101 (decimal 6 in binary) is 0110.

Automotive
missing xbfish.com image
Posted on

Yamaha T135 Stock Battery

This is the stock factory battery for Yamaha T135 a.k.a Yamaha Spark 135:

missing xbfish.com image

This is a wet battery and its rating is 12V with a size of 5Ah.

I.T Concepts
missing xbfish.com image
Posted on

Converting 2-complement to decimal

To convert a decimal to 2-complement (2s), you first convert the decimal to binary and invert the bit. From there, you plus one and that would be the 2s of the decimal.

For example, a decimal 5 in binary would be: 0101 (in 4 bits)

The 2-complement of 5, which is -5, is:

First step: Invert the bits of 5 in binary -> 1010

Second step: Plus one to the inverted bits -> 1011

Hence, the 2-complement of 5 would be 1011

Now, to convert a 2-complement back to a decimal….

The algorithm is as follows:

“If it is positive, simply convert it to decimal. If it is negative, make it positive by inverting the bits and adding one. Then, convert the result to decimal. The negative of this number is the value of the original binary.” quoted from Mississippi College.

For example, convert 1101 to decimal.

First step: The sign bit of 1101 shows that it’s a negative decimal. Hence, we invert the bits -> 0010

Second step: We add one to the inverted bits -> 0011

0011 in decimal is 3. The negative of 3 is -3. Hence, the original binary value of 1101 is -3.