• missing xbfish.com image

Category Archives: I.T Concepts

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):

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.

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.

Difference between Refresh and Hard Refresh

In the context of web browser, a refresh by pressing (F5) refreshes the page by pulling content from browser cache whenever possible; if the data has already been cached during the last visit.

A hard refresh, (Ctrl + F5), forces the web browser to pull the content from the web server instead of from the browser cache. Therefore, you might have noticed that the page reloads slower in hard refresh.

At times, you need not clear ALL your browser cache just to see some changes you made to a page. You can just do a hard refresh on it by pressing Ctrl + F5.

Hope this helps :)

[Prestashop] “Last items in stock!” is wrong

If you find that the product page is showing “Last items in stock!” where it shouldn’t be (inventory still have more than 1 item), you could be missing out the configuration of product. This is one of the most common mistakes that people make.

To resolve this issue, login to your Back-Office, go to Preferences tab -> Products.

Look for the following:

missing xbfish.com image

Set the value to 1 if you would like Prestashop to display “Last items in stock!” when it is really the last item in the inventory.

[Prestashop] Friendly URL not working?!

If Friendly URL in Prestashop is not working for you, try my method of resolving below:

Step 1 – Login to your back-office.

Step 2: Navigate to Preferences -> SEO & URLs (SEO for Prestashop older than v1.4.2.5).

Step 3: Give every page a friendly URL except for index.php as shown below –

missing xbfish.com image

Step 4: Go to the Modules tab to disable and re-enabled CMS block -

missing xbfish.com image

Step 5: Lastly, go to Tools -> Generators and generate a new .htaccess file with Friendly URL check-box checked

missing xbfish.com image

And you’re done with it. Hope this method works for you…

Download videos from Youku

Forget about using clipnabber to download videos from youku. It doesn’t work anymore.

Try using Sony YouTube!

missing xbfish.com image

Working correctly as of today!

[Prestashop] Paypal orders does not show up in Back Office

If you happen to face this problem, try checking the checking out this guide :: Fixing Paypal Problems in Prestashop.

If all else fails, are you in Localhost environment while trying to test out Paypal orders?

This is because the notify_url in Prestashop is “http://localhost/…”. Paypal will never be able to reach the page. As such, Paypal orders in Prestashop are not showing up in the back office because there is no update from Paypal whether the payment is Completed.

Below is a diagram that illustrate the “failed” process:

missing xbfish.com image

Try uploading Prestashop into a live server to test. Paypal orders should be able to go on smoothly.

[Prestashop 1.4] Fatal error on Loyalty points page

When you upgrade Prestashop from version 1.3 to 1.4, you are likely to encounter “Fatal Error” message on your Loyalty points page (Front-Office).

If this happens, login to your Back-Office and go to Modules -> Customer loyalty and rewards. Click on Configure.

Set the categories that customers are able to use the loyalty points on:

missing xbfish.com image

After that, click on Save.

Once this is done, My loyalty points page should starts working correctly.

Check HDB season parking validity

The website for Renewal of HDB season parking is not user-friendly at all. It doesn’t shows when is the expiry date of your season parking, nor does it shows when you last renewed to.

It just asks you to input the start date of the renewal of season parking:

missing xbfish.com image

There is a way to work around and finds out when your season parking ends.

Login to My HDBPage. Take note that you need to have SingPass in order to login.

After that, go to My Vehicle:

missing xbfish.com image

Then, click on Season Parking follow by Transfer of Season Parking.

Here, you will be able to see the expiry date of your Vehicle season parking:

missing xbfish.com image