Skip to main content

Posts

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="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></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>

How to give your Web apps a real speed boost?

Few tips published on the The Next Web on how to speed up your website and making sure user experience is not impacted especially on mobile.

Check for unnecessary or oversized imagesDon't ignore AndroidConsistent measurementMultitask
The article also introduced a few tools to get you started.

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("https://chart.googleapis.com/chart?chs=200x200&cht=qr&chl=BEGIN:VCARD%0AN:" & 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