Skip to main content


Showing posts from October, 2013

HtmlEncode and HtmlDecode In JavaScript

In web development, we often need to encode a string especially input from user so data with potential malicious intention when displayed will be safe. On server side, we can use e.g. HtmlUtility.HtmlEncode (in ASP.NET for encode) and HtmlUtility.HtmlDecode (in ASP.NET for decode).

What if we need one in JavaScript? Here's how to do just that!

<script src=""></script> <script language="javascript" type="text/javascript"> <!-- function htmlEncode(value) { return $('<div/>').text(value).html(); } function htmlDecode(value) { return $('<div/>').html(value).text(); } var s = "<b>hello's world</b>"; var encoded = htmlEncode(s); var decoded = htmlDecode(encoded); alert(encoded); alert(decoded); //--> </script>

This Visual Guide Outlines How Men's Suits Should Fit

A visual guide on what how men's suits should fit so it look fit and neither too small nor big. A good general knowledge.

Generate VCard as QR Code Using Google Docs

Should you have lots of contacts to be imported into your phone, it can get pretty time consuming to input one at a time. One time saving tip is to have them entered into a spreadsheet and have them converted into VCard format. Google Docs does have a feature to generate VCard as QR Code which you may then use any QR Code reader to read them.

This article demonstrates exactly just how to do that.

A quick summary:
Create a new Google Spreadsheet

Setup 5 columns i.e. First Name, Last Name, Phone, Contacts, QR Code.

First 4 columns should be self-explanatory. As for the last column, it shall be a formula to generate QR Code. Copy and paste below formula.

=image("" & A2 & "%20" & B2 & "%0ATEL;CELL:" & C2 & "%0AEMAIL:" & D2 & "%0AEND:VCARD")
Hope it helps.

What is "Exit Rate" and "Bounce Rate"?

Exit rate

The number of times a visitor leaves your domain from a page, divided by that page’s total views. Generally expressed as a percentage.

Bounce rate

The number of times a visitor enters a domain on a page but leaves before viewing any other page in the domain, divided by the total number of views of that page. Also generally expressed as a percentage.

Responsive Design for Websites and Email