<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Mark Leong Web Development &#38; Design</title>
	<atom:link href="http://www.mark-leong.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.mark-leong.com</link>
	<description>Freelance Web Development &#38; Design</description>
	<lastBuildDate>Fri, 13 Apr 2012 09:14:18 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Generate a random public IP address in PHP</title>
		<link>http://www.mark-leong.com/generate-a-random-public-ip-address-in-php/</link>
		<comments>http://www.mark-leong.com/generate-a-random-public-ip-address-in-php/#comments</comments>
		<pubDate>Fri, 13 Apr 2012 09:14:18 +0000</pubDate>
		<dc:creator>Mark Leong</dc:creator>
				<category><![CDATA[Coding]]></category>

		<guid isPermaLink="false">http://www.mark-leong.com/?p=928</guid>
		<description><![CDATA[The requirements Valid IP addresses are in the form xxx.xxx.xxx.xxx, where xxx is a number from 0-255. RFC 1918 specfies that the 10.0.0.0-10.255.255.255, 172.16.0.0-172.31.255.255 and 192.168.0.0-192.168.255.255 address ranges are restricted for use in private internets only. I needed a PHP function that would generate a random IP address excluding the IP ranges restricted by RFC [...]]]></description>
			<content:encoded><![CDATA[<h2>The requirements</h2>
<p>Valid IP addresses are in the form <code>xxx.xxx.xxx.xxx</code>, where <code>xxx</code> is a number from 0-255. <a href="http://www.faqs.org/rfcs/rfc1918.html">RFC 1918</a> specfies that the <code>10.0.0.0-10.255.255.255</code>, <code>172.16.0.0-172.31.255.255</code> and <code>192.168.0.0-192.168.255.255</code> address ranges are restricted for use in private internets only.</p>
<p>I needed a PHP function that would generate a random IP address excluding the IP ranges restricted by RFC 1918. The following is what I came up with.</p>
<h2>The code</h2>
<p>For the sake of clarity, the code is more verbose then necessary. Remove line breaks and add ternary operators to your liking for production.</p>
<pre name="code" class="php">
/**
 * Returns a random valid public IP address. For the definition of a
 * public IP address see http://www.faqs.org/rfcs/rfc1918.html
 * @return string The IP address
 */
function random_valid_public_ip() {
  // Generate a random IP
  $ip =
      mt_rand(0, 255) . '.' .
      mt_rand(0, 255) . '.' .
      mt_rand(0, 255) . '.' .
      mt_rand(0, 255);

  // Return the IP if it is a valid IP, generate another IP if not
  if (
      !ip_in_range($ip, '10.0.0.0', '10.255.255.255') &#038;&#038;
      !ip_in_range($ip, '172.16.0.0', '172.31.255.255') &#038;&#038;
      !ip_in_range($ip, '192.168.0.0', '192.168.255.255')
  ) {
    return $ip;
  } else {
    return random_valid_public_ip();
  }
}

/**
 * Returns true if the IP address supplied is within the range from
 * $start to $end inclusive
 * @param string $ip The IP address to be checked
 * @param string $start The start IP address
 * @param string $end The end IP address
 * @return boolean
 */
function ip_in_range($ip, $start, $end) {
  // Split the IP addresses into their component octets
  $i = explode('.', $ip);
  $s = explode('.', $start);
  $e = explode('.', $end);

  // Return false if the IP is in the restricted range
  return in_array($i[0], range($s[0], $e[0])) &#038;&#038;
      in_array($i[1], range($s[1], $e[1])) &#038;&#038;
      in_array($i[2], range($s[2], $e[2])) &#038;&#038;
      in_array($i[3], range($s[3], $e[3]));
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.mark-leong.com/generate-a-random-public-ip-address-in-php/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Tweaking .htaccess for website performance on DreamHost</title>
		<link>http://www.mark-leong.com/tweaking-htaccess-for-website-performance-on-dreamhost/</link>
		<comments>http://www.mark-leong.com/tweaking-htaccess-for-website-performance-on-dreamhost/#comments</comments>
		<pubDate>Fri, 02 Mar 2012 03:49:54 +0000</pubDate>
		<dc:creator>Mark Leong</dc:creator>
				<category><![CDATA[Coding]]></category>

		<guid isPermaLink="false">http://www.mark-leong.com/?p=927</guid>
		<description><![CDATA[Add expires headers # Add Proper MIME-Type for Favicon AddType image/x-icon .ico # Expires headers ExpiresActive on # Set default to 3 days ExpiresDefault A259200 # Set static content to 2 weeks &#60;FilesMatch "\.(gif&#124;jpe?g&#124;png&#124;css&#124;js&#124;ico)$"&#62; ExpiresDefault "access plus 2 weeks" &#60;/FilesMatch&#62; Turn off Etags # Turn of Etags Header unset ETag FileETag None Enable Gzip # [...]]]></description>
			<content:encoded><![CDATA[<h2>Add expires headers</h2>
<p><code># Add Proper MIME-Type for Favicon<br />
AddType image/x-icon .ico</code></p>
<p><code># Expires headers<br />
ExpiresActive on<br />
# Set default to 3 days<br />
ExpiresDefault A259200<br />
# Set static content to 2 weeks<br />
&lt;FilesMatch "\.(gif|jpe?g|png|css|js|ico)$"&gt;<br />
ExpiresDefault "access plus 2 weeks"<br />
&lt;/FilesMatch&gt;</code></p>
<h2>Turn off Etags</h2>
<p><code># Turn of Etags<br />
Header unset ETag<br />
FileETag None</code></p>
<h2>Enable Gzip</h2>
<p><code># Enable Gzip<br />
&lt;IfModule mod_deflate.c&gt;<br />
AddOutputFilterByType DEFLATE text/text text/html text/plain text/xml text/css application/x-javascript application/javascript<br />
&lt;/IfModule&gt;</code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.mark-leong.com/tweaking-htaccess-for-website-performance-on-dreamhost/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Installing PHP and PHPUnit on Windows 7</title>
		<link>http://www.mark-leong.com/installing-php-and-phpunit-on-windows-7/</link>
		<comments>http://www.mark-leong.com/installing-php-and-phpunit-on-windows-7/#comments</comments>
		<pubDate>Thu, 01 Mar 2012 09:55:34 +0000</pubDate>
		<dc:creator>Mark Leong</dc:creator>
				<category><![CDATA[Coding]]></category>

		<guid isPermaLink="false">http://www.mark-leong.com/?p=926</guid>
		<description><![CDATA[Download PHP Windows downloads of PHP are available here. If you are not sure of which version to get, check out this Stack Overflow page. I used the VC9 thread safe PHP 5.3.10 download. Install PHP Once you&#8217;ve downloaded the installer, run it and install PHP in C:\php\ (or wherever you like, only remember this [...]]]></description>
			<content:encoded><![CDATA[<h2>Download PHP</h2>
<p>Windows downloads of PHP <a href="http://windows.php.net/download">are available here</a>. If you are not sure of which version to get, check out <a href="http://stackoverflow.com/questions/5793751/which-version-of-php-should-i-install">this Stack Overflow page</a>. I used the VC9 thread safe PHP 5.3.10 download.</p>
<h2>Install PHP</h2>
<p>Once you&#8217;ve downloaded the installer, run it and install PHP in <code>C:\php\</code> (or wherever you like, only remember this path for later). Choose your webserver (or none if you don&#8217;t have a webserver installed) and select any additional components as needed, including PEAR.</p>
<p>Once PHP is installed open a command prompt. Check that PHP is set up correctly by running<br />
<code>php -v</code></p>
<p>It should give you output something like<br />
<code>PHP 5.3.10 (cli) (built: Feb 2 2012 20:27:51)<br />
Copyright (c) 1997-2012 The PHP Group<br />
Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies<br />
</code></p>
<p>If you don&#8217;t get this output something has gone wrong with the PHP install or in the modification of your environment variables. Get this fixed before proceeding with the guide.</p>
<h2>Install PEAR</h2>
<p>In the command prompt, switch to the directory that you installed PHP to by running<br />
<code>cd C:\php\ </code></p>
<p>Then install PEAR by running<br />
<code>go-pear</code></p>
<p>Press Enter to accept the default when it asks you &#8220;Are you installing a system-wide PEAR or a local copy?&#8221;<br />
Press Enter again to accept the file layout.<br />
Press Enter to finish.</p>
<h2>Install PHPUnit</h2>
<p>Run the following commands (they may take a while to update, be patient):<br />
<code>pear channel-update pear.php.net<br />
pear upgrade-all<br />
pear channel-discover pear.phpunit.de<br />
pear channel-discover components.ez.no<br />
pear channel-discover pear.symfony-project.com<br />
pear update-channels</code></p>
<p>To install PHPUnit, run<br />
<code>pear install --alldeps --force phpunit/PHPUnit</code></p>
<p>To test that PHPUnit was successfully installed, run<br />
<code>phpunit -v</code></p>
<p>If all is fine, it should print out something like <code>PHPUnit 3.6.10 by Sebastian Bergmann</code> followed by the help contents.</p>
<h2>Problems?</h2>
<p>If you get a problem with PEAR refusing to install the dependencies for PHPUnit, try running this command: <code>pear clear-cache</code>. If the underlying problem is this error <code>SECURITY ERROR: Will not write to C:\php\...rest.cacheid as it is symlinked to C:\php\...rest.cacheid - Possible symlink attack</code> then clearing the cache should fix it.</p>
<p>If you get stuck with no helpful error messages while installing PHPUnit, check the PHP error log. To locate it, open your <code>php.ini</code> file (<code>c:\php\php.ini</code>) and look for a line like <code>error_log="C:\Windows\temp\php-errors.log"</code>. Open the log file at the location specified and look at the bottom of the log for any recent errors. Copy the error message and Google for solutions.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mark-leong.com/installing-php-and-phpunit-on-windows-7/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>HTML Purifier</title>
		<link>http://www.mark-leong.com/html-purifier/</link>
		<comments>http://www.mark-leong.com/html-purifier/#comments</comments>
		<pubDate>Tue, 14 Feb 2012 02:19:05 +0000</pubDate>
		<dc:creator>Mark Leong</dc:creator>
				<category><![CDATA[Coding]]></category>

		<guid isPermaLink="false">http://www.mark-leong.com/?p=918</guid>
		<description><![CDATA[The problem I want to allow users to input HTML-formatted text, but I only want them to use certain tags and never any JavaScript. Sometimes users will copy and paste WYSIWYG formatted HTML, with it&#8217;s associated CSS classes and inline style rules &#8211; but I don&#8217;t want that to mess up my site design. A [...]]]></description>
			<content:encoded><![CDATA[<h2>The problem</h2>
<p>I want to allow users to input HTML-formatted text, but I only want them to use certain tags and never any JavaScript. Sometimes users will copy and paste WYSIWYG formatted HTML, with it&#8217;s associated CSS classes and inline style rules &#8211; but I don&#8217;t want that to mess up my site design.</p>
<p>A simplistic approach is to attempt to use regular expressions to filter out unwanted HTML tags, but this becomes tedious and is always fraught with risk because it is notoriously difficult to anticipate and catch all the possible permutations of HTML tags and their attributes.</p>
<p>A more successful approach is to use a psuedo markup language like bbCode or WikiText, but both of these require users to learn another markup language, which is likely to deter users from posting.</p>
<h2>Is there a better alternative?</h2>
<p>Yes there is! <a href="http://htmlpurifier.org/" rel="nofollow" target="_blank">HTML Purifier</a> is a standards-compliant HTML filter library written in PHP. HTML Purifier will not only remove all malicious code (better known as XSS) with a thoroughly audited, secure yet permissive whitelist, it will also make sure your documents are standards compliant, something only achievable with a comprehensive knowledge of W3C&#8217;s specifications.</p>
<p>HTML Purifier works by decomposing the whole document into tokens and removing non-whitelisted elements, checking the well-formedness and nesting of tags, and validating all attributes according to their RFCs.</p>
<h2>Why HTML Purifier</h2>
<p>I&#8217;ve used HTML Purifier because it</p>
<ul>
<li>uses a whitelist (e.g. allow only b, p, br, ul, ol and li tags)</li>
<li>outputs valid XHTML</li>
<li>protects againts XSS</li>
<li>can remove attibutes and classes from tags without removing the tags</li>
</ul>
<h2>Before and after</h2>
<p>An example of HTML that a user may enter:</p>
<pre name="code" class="html">
&lt;P style="MARGIN: 0cm 0cm 0pt; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" class=MsoNormal&gt;&lt;st1:Lorem w:st="on"&gt;&lt;st1:place w:st="on"&gt;&lt;B&gt;LOREM IPSUM&lt;/B&gt;&lt;/st1:place&gt;&lt;/st1:Lorem&gt;&lt;B&gt;LOREM IPSUM&lt;/B&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0cm 0cm 0pt; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" class=MsoNormal&gt;&lt;st1:place w:st="on"&gt;&lt;st1:PlaceName w:st="on"&gt;Lorem&lt;/st1:PlaceName&gt; &lt;st1:PlaceType w:st="on"&gt;Ipsum&lt;/st1:PlaceType&gt;&lt;/st1:place&gt;Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque at augue vitae nisl sodales interdum. &lt;st1:City w:st="on"&gt;&lt;st1:place w:st="on"&gt;Lorem &lt;/st1:place&gt;&lt;/st1:City&gt; Pellentesque erat enim, ullamcorper eget vehicula feugiat, auctor non nunc. Quisque vel molestie eros. Cras erat nulla, faucibus eget pretium at, cursus eu enim. &lt;st1:place w:st="on"&gt;&lt;st1:PlaceType w:st="on"&gt;lorem&lt;/st1:PlaceType&gt; &lt;st1:PlaceType w:st="on"&gt;Ipsum&lt;/st1:PlaceType&gt;&lt;/st1:place&gt; Integer et eros lorem, eget pharetra justo. Maecenas accumsan eleifend leo, a ullamcorper justo venenatis ut. Vestibulum bibendum diam vel turpis lobortis bibendum.&lt;/P&gt;
&lt;P style="MARGIN: 0cm 0cm 0pt; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" class=MsoNormal&gt;&lt;B&gt;Lorem / Ipsum&lt;/B&gt; &lt;/P&gt;
</pre>
<p>After it has been passed through the filter:</p>
<pre name="code" class="html">
&lt;p&gt;&lt;b&gt;LOREM IPSUM&lt;/b&gt;&lt;b&gt;LOREM IPSUM&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;Lorem Ipsum Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque at augue vitae nisl sodales interdum. Lorem Pellentesque erat enim, ullamcorper eget vehicula feugiat, auctor non nunc. Quisque vel molestie eros. Cras erat nulla, faucibus eget pretium at, cursus eu enim. lorem Ipsum Integer et eros lorem, eget pharetra justo. Maecenas accumsan eleifend leo, a ullamcorper justo venenatis ut. Vestibulum bibendum diam vel turpis lobortis bibendum.&lt;/P&gt;
&lt;p&gt;&lt;b&gt;Lorem / Ipsum&lt;/b&gt;&lt;/p&gt;
</pre>
<p>This is the code used to achieve the before/after example:</p>
<pre name="code" class="php">
require_once '/path_to/HTMLPurifier/HTMLPurifier.auto.php';
$config = HTMLPurifier_Config::createDefault();
$config-&gt;set('HTML.AllowedElements', 'b,i,p,br,ul,ol,li');
$config-&gt;set('Attr.AllowedClasses', '');
$config-&gt;set('HTML.AllowedAttributes', '');
$config-&gt;set('AutoFormat.RemoveEmpty', true);
$purifier = new HTMLPurifier($config);

$remarks = 'the text to be filtered';
$remarks = preg_replace('/&lt;\?xml[^&gt;]+\/&gt;/im', '', $remarks);
$remarks_cleaned = $purifier-&gt;purify($remarks);
</pre>
<p>The only other line of code here doing work apart from the HTML Purifier is the regex to remove <code>&lt;?xml ... ?&gt;</code> namespace tags from MS Word.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mark-leong.com/html-purifier/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Yes 4G mobile broadband</title>
		<link>http://www.mark-leong.com/yes-4g-mobile-broadband/</link>
		<comments>http://www.mark-leong.com/yes-4g-mobile-broadband/#comments</comments>
		<pubDate>Mon, 17 Jan 2011 17:37:36 +0000</pubDate>
		<dc:creator>Mark Leong</dc:creator>
				<category><![CDATA[Internet]]></category>

		<guid isPermaLink="false">http://www.mark-leong.com/?p=909</guid>
		<description><![CDATA[Yes, it is fast! This evening I had the privilege to try out Yes, YTL Communication&#8217;s new mobile broadband solution. Above is a screenshot of a speed test I did about midnight. As anyone who is used to Malaysian broadband can attest, clocking in a download speed of 10.5 Mbps is pretty good. Yes has [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.mark-leong.com/wp-content/uploads/2011/01/yes-speedtest.png" alt="" title="Yes speedtest" width="550" height="294" class="alignnone size-full wp-image-908" /></p>
<h3>Yes, it is fast!</h3>
<p>This evening I had the privilege to try out <strong>Yes</strong>, YTL Communication&#8217;s new mobile broadband solution. Above is a screenshot of a speed test I did about midnight. As anyone who is used to Malaysian broadband can attest, clocking in a download speed of 10.5 Mbps is pretty good.</p>
<p><strong>Yes</strong> has a simple pay-as-you-use price plan: 9 sen for a 1-minute call, 1 SMS, or 3 MB of data. Coverage of Peninsular Malaysia is <a href="http://www.soyacincau.com/2010/11/20/yes-4g-coverage-in-peninsular-malaysia/">said to be</a> at about 65%. </p>
<p>For more info, price plans, videos and coverage maps, see <a href="http://www.yes.my/">http://www.yes.my/</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mark-leong.com/yes-4g-mobile-broadband/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Gravatars: Globally recognized avatars</title>
		<link>http://www.mark-leong.com/gravatars-globally-recognized-avatars/</link>
		<comments>http://www.mark-leong.com/gravatars-globally-recognized-avatars/#comments</comments>
		<pubDate>Mon, 06 Dec 2010 08:39:41 +0000</pubDate>
		<dc:creator>Mark Leong</dc:creator>
				<category><![CDATA[Social media]]></category>

		<guid isPermaLink="false">http://www.mark-leong.com/?p=904</guid>
		<description><![CDATA[A what&#8230;? Most people have never heard of an online avatar, let alone a Gravatar, so let&#8217;s begin with some definitions. An online avatar is an image or icon used to represent you on the Internet, usually associated with some contribution you have made, such as a comment or a post on a forum. A [...]]]></description>
			<content:encoded><![CDATA[<h2>A what&#8230;?</h2>
<p>Most people have never heard of an online avatar, let alone a Gravatar, so let&#8217;s begin with some definitions. </p>
<p>An <strong>online avatar</strong> is an image or icon used to represent <em>you</em> on the Internet, usually associated with some contribution you have made, such as a comment or a post on a forum. </p>
<p>A <strong>Gravatar</strong> is an avatar that is hosted by a third-party (Gravatar.com), which is associated with your email address. When you contribute a comment or post on a website that supports Gravatars, such as a WordPress blog, it will check with Gravatar.com and display your avatar if you have an account with Gravatar.com.</p>
<p>From the Gravatar.com website:</p>
<blockquote><p>Your Gravatar is an image that follows you from site to site appearing beside your name when you do things like comment or post on a blog. Avatars help identify your posts on blogs and web forums, so why not on any site?</p></blockquote>
<h2>Why get a Gravatar?</h2>
<p><img src="http://www.mark-leong.com/wp-content/uploads/2010/12/mystery-man.jpeg" alt="" title="Mystery man" width="96" height="96" class="alignright size-full wp-image-905" /> You should sign up for a Gravatar so that on websites that support Gravatars, you will have a profile picture next to your comment or entry, instead of a generic icon, like the one on the right. On such websites, having a Gravatar helps distinguish your comments or posts from the others around it.</p>
<h2>Setting up a Gravatar</h2>
<ol>
<li>Prepare your image:
<ul>
<li>It must be square</li>
<li>It can be up to 512 pixels wide</li>
<li>It will be displayed at 80 pixels by 80 pixels by default</li>
</ul>
</li>
<li>Go to <a href="http://www.gravatar.com/">http://www.gravatar.com/</a> and click on the sign up button.</li>
<li>Check your email Inbox and follow the instructions in the email from Gravatar.com.</li>
<li>Upload your image.</li>
<li>Try out your new Gravatar by leaving a comment on this post!</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://www.mark-leong.com/gravatars-globally-recognized-avatars/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Speaking on &#8220;How to set up an online blogshop&#8221;</title>
		<link>http://www.mark-leong.com/speaking-on-how-to-set-up-an-online-blogshop/</link>
		<comments>http://www.mark-leong.com/speaking-on-how-to-set-up-an-online-blogshop/#comments</comments>
		<pubDate>Fri, 26 Nov 2010 18:00:27 +0000</pubDate>
		<dc:creator>Mark Leong</dc:creator>
				<category><![CDATA[News]]></category>

		<guid isPermaLink="false">http://www.mark-leong.com/?p=901</guid>
		<description><![CDATA[A few weeks ago I had the privilege of joining the Emmagem.com team in conducting a workshop at an event co-organised by the New Straits Times (NST) and Gorgeous Geeks on how to start an online business. The event attracted just under 100 participants, one from as far away as Perlis! Thankfully my journey from [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.mark-leong.com/wp-content/uploads/2010/11/nst-01.jpg" alt="Workshop on &quot;How to set up an online blogshop&quot;" title="Workshop on &quot;How to set up an online blogshop&quot;" width="550" height="272" class="aligncenter size-full wp-image-902" /></p>
<p>A few weeks ago I had the privilege of joining the <a href="http://www.emmagem.com/">Emmagem.com</a> team in conducting a workshop at an event co-organised by the <a href="http://www.nst.com.my/">New Straits Times</a> (NST) and <a href="http://www.gorgeousgeeks.net/">Gorgeous Geeks</a> on how to start an online business. The event attracted just under 100 participants, one from as far away as Perlis! Thankfully my journey from home didn’t have to start as early as his, as the workshop was held at the NST office in Bangsar.</p>
<p>My session was on &#8220;How to set up an online blogshop&#8221;. I began by introducing online shops and blogshops, and then moved on to the main part of the session, walking the participant through how to set a blogshop up at zero cost. Then I gave an overview of upgrades and expansion options, before concluding with a discussion on longer term strategies for running a blogshop. (In case you’re wondering, a blogshop is an online shop that uses a blog engine as its Content Management System.)</p>
<p><img src="http://www.mark-leong.com/wp-content/uploads/2010/11/nst-02.jpg" alt="Workshop on &quot;How to set up an online blogshop&quot;" title="Workshop on &quot;How to set up an online blogshop&quot;" width="550" height="272" class="aligncenter size-full wp-image-903" /></p>
<p>The two-day event was part of the WOMEN NETPRENEUR 2010 (WNET2010) programme organised by Gorgeous Geeks, MDeC, the US Embassy, Warisan Global, Emmagem.com and NST. Other workshops that weekend covered topics including business strategy, product sourcing, marketing, eBay, PayPal and product photography.</p>
<p>I enjoyed facilitating my part of the workshop, especially in being able to help the participants get to grips with some new tools and technologies to help them develop their businesses. Many thanks to Emmagem.com, Gorgeous Geeks and NST for the opportunity to get involved!</p>
<p>Photo credits: <a href="http://www.facebook.com/womennetpreneur">Women Netpreneur</a> on Facebook.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mark-leong.com/speaking-on-how-to-set-up-an-online-blogshop/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to register a Malaysian business online</title>
		<link>http://www.mark-leong.com/how-to-register-a-malaysian-business-online/</link>
		<comments>http://www.mark-leong.com/how-to-register-a-malaysian-business-online/#comments</comments>
		<pubDate>Fri, 12 Nov 2010 14:21:31 +0000</pubDate>
		<dc:creator>Mark Leong</dc:creator>
				<category><![CDATA[Business]]></category>

		<guid isPermaLink="false">http://www.mark-leong.com/?p=896</guid>
		<description><![CDATA[Types of registration Suruhanjaya Syarikat Malaysia (The Companies Commission of Malaysia) offers two types of registration: business and company. Business registrations may be either sole proprietorships or partnerships. They are relatively easy to do yourself and cost below RM100. Company registration involves the formation of a new legal entity, either a Private Limited Company (Sdn [...]]]></description>
			<content:encoded><![CDATA[<h2>Types of registration</h2>
<p><strong>Suruhanjaya Syarikat Malaysia</strong> (The Companies Commission of Malaysia) offers two types of registration: business and company.</p>
<ul>
<li>Business registrations may be either sole proprietorships or partnerships. They are relatively easy to do yourself and cost below RM100.</li>
<li>Company registration involves the formation of a new legal entity, either a Private Limited Company (Sdn Bhd) or a Limited Company (Bhd). Registering a company is a lot more expensive and complicated.</li>
</ul>
<p>This write-up is on how to register a business online.</p>
<h2>Why should you register a business?</h2>
<blockquote><p>Pursuant to section 5A(1) of the Registration of Businesses Act 1956, the person responsible for a business has to, not later than 30 days from the date of the commencement of the business, apply to the Registrar to register that business.</p></blockquote>
<h2>Registering a business online</h2>
<h3>Government portal registration</h3>
<ol>
<li>Register at <a href="http://www.malaysia.gov.my/">http://www.malaysia.gov.my/</a> (registration link at top right of page)</li>
</ol>
<h3>SSM Subscriber Registration</h3>
<ol>
<li>Login at <a href="http://www.malaysia.gov.my/">http://www.malaysia.gov.my/</a></li>
<li>Go to <a href="http://www.ssm.com.my/en/eLodgement-services/">http://www.ssm.com.my/en/eLodgement-services/</a></li>
<li>Click on the link entitled <strong>SSM Subscriber Registration</strong></li>
<li>Follow the instructions to register</li>
<li>Complete payment of RM5</li>
</ol>
<h3>Name enquiry</h3>
<ol>
<li> Go to <a href="http://www.ssm.com.my/en/eLodgement-services/">http://www.ssm.com.my/en/eLodgement-services/</a></li>
<li>Click on the link entitled <strong>Application for Business Name Approval (ROB)</strong></li>
<li>Follow the instructions and submit the form</li>
<li>Wait for the confirmation email – repeat this section if your name is rejected</li>
</ol>
<h3>Business name registration</h3>
<ol>
<li> Copy the ROB approval number e.g. ROB12112010-xxxxxxxxxSB</li>
<li>Go to <a href="http://www.ssm.com.my/en/eLodgement-services/">http://www.ssm.com.my/en/eLodgement-services/</a></li>
<li>Click on the link entitled <strong>Online Registration of Business (ROB)</strong></li>
<li>Follow the instructions and submit the form</li>
<li>Complete the payment of RM30 (owner’s name) or RM60 (trade name)</li>
<li>Wait for the confirmation email</li>
</ol>
<h2>What to do if you something doesn’t work</h2>
<ul>
<li> If it is a problem with windows/tabs not loading, try turning off your pop-up blocker or switching to another web browser.</li>
<li>Use the contact form, email address or phone numbers listed on <a href="http://www.malaysia.gov.my/EN/Site/ContactUs/Pages/ContactUs.aspx">http://www.malaysia.gov.my/EN/Site/ContactUs/Pages/ContactUs.aspx</a></li>
</ul>
<h2>More info</h2>
<ul>
<li>The SSM Guidelines for Registration of New Business: <a href="http://www.ssm.com.my/files/GUIDELINES%20FOR%20REGISTRATION%20OF%20NEW%20BUSINESS.pdf">http://www.ssm.com.my/files/GUIDELINES%20FOR%20REGISTRATION%20OF%20NEW%20BUSINESS.pdf</a> [PDF]</li>
<li>The SSM FAQ on business registration: <a href="http://www.ssm.com.my/en/faq/">http://www.ssm.com.my/en/faq/</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.mark-leong.com/how-to-register-a-malaysian-business-online/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>WordPress hack: Force wp_list_pages() to print current_page_item class</title>
		<link>http://www.mark-leong.com/wordpress-hack-force-wp_list_pages-to-print-current_page_item-class/</link>
		<comments>http://www.mark-leong.com/wordpress-hack-force-wp_list_pages-to-print-current_page_item-class/#comments</comments>
		<pubDate>Sat, 17 Jul 2010 10:26:15 +0000</pubDate>
		<dc:creator>Mark Leong</dc:creator>
				<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://www.markyleong.com/?p=870</guid>
		<description><![CDATA[The wp_list_pages() function displays a list of WordPress pages as links and is often used to display navigation menus. When it prints the list of links, it adds a CSS class current_page_item to the list item tag of the current page. This allows custom styling to be applied to the link e.g. to highlight a [...]]]></description>
			<content:encoded><![CDATA[<p>The <code>wp_list_pages()</code> function displays a list of WordPress pages as links and is often used to display navigation menus. When it prints the list of links, it adds a CSS class <code>current_page_item</code> to the list item tag of the current page. This allows custom styling to be applied to the link e.g. to highlight a link to indicate the page that the visitor is on.</p>
<p><strong>The limitation with this is that it only works if you are viewing a page or an attachment, or are on the posts page (as set in Settings > Reading).</strong></p>
<p>I was working on an archive page for a custom taxonomy and wanted to have the <code>current_page_item</code> CSS class added to the list item of a particular link of my choice. After poking around a bit in the <code>wp_list_pages()</code> code listing, I discovered it’s possible to hack the <code>$wp_query</code> object to make <code>wp_list_pages()</code> do what I wanted it to.</p>
<p>Here’s how:</p>
<pre name="code" class="php">
// Get the ID of the link you want highlighted. Either:
// - hardcode it (as below)
// - or query the database to get it
$the_id = "1";

// Make a copy of the $wp_query object
$temp_query = clone $wp_query;

// Trick WordPress into thinking we're on a page with ID $the_id
$wp_query->is_page = 1;
$wp_query->queried_object_id = $the_id;

// Display pages
wp_list_pages("title_li=");

// Reset $wp_query
$wp_query = clone $temp_query;
</pre>
<p><strong>Notes:</strong></p>
<ul>
<li><code>$wp_query->is_page</code> needs to be set to <code>1</code> (true) because <code>wp_list_pages()</code> does not set a current page unless <code>is_page()</code> or <code>is_attachment()</code> or <code>$wp_query->is_posts_page</code> returns true.</li>
<li>If you only want this code to run when you are on certain page you can wrap it in an <code>if</code> statement that checks a WordPress <a href="http://codex.wordpress.org/Conditional_Tags">conditional tag</a>. In my case I only wanted to run this code when a taxonomy archive was being displayed so I used <code>is_tax()</code>.</li>
<li>See <a href="http://www.jenst.se/2008/03/17/wordpress-get-id-by-post-or-page-name/">http://www.jenst.se/2008/03/17/wordpress-get-id-by-post-or-page-name/</a> on how to query the database by post/page name to get an ID.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.mark-leong.com/wordpress-hack-force-wp_list_pages-to-print-current_page_item-class/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
		</item>
		<item>
		<title>Website launched: Riverside Church</title>
		<link>http://www.mark-leong.com/website-launched-riverside-church/</link>
		<comments>http://www.mark-leong.com/website-launched-riverside-church/#comments</comments>
		<pubDate>Thu, 08 Jul 2010 22:51:51 +0000</pubDate>
		<dc:creator>Mark Leong</dc:creator>
				<category><![CDATA[Website launch]]></category>

		<guid isPermaLink="false">http://www.markyleong.com/?p=869</guid>
		<description><![CDATA[Over the last few months, I&#8217;ve been working on a redesign of the website of my church in Birmingham, Riverside Church. Today the new website went live! Home page: Normal content page: Please let me know what you think by leaving a comment, thanks!]]></description>
			<content:encoded><![CDATA[<p>Over the last few months, I&#8217;ve been working on a redesign of the website of my church in Birmingham, <a href="http://www.riverside-church.org.uk/">Riverside Church</a>. Today the new website went live!</p>
<p><strong>Home page:</strong></p>
<p><a href="http://www.riverside-church.org.uk/"><img src="/wp-content/uploads/2010/07/riverside_church_01_thumb.png" alt="" width="480" height="361" class="alignnone size-full wp-image-867" /></a></p>
<p><strong>Normal content page:</strong></p>
<p><a href="http://www.riverside-church.org.uk/about/about-riverside/"><img src="/wp-content/uploads/2010/07/riverside_church_02_thumb.png" alt="" width="480" height="361" class="alignnone size-full wp-image-868" /></a></p>
<p>Please let me know what you think by leaving a comment, thanks!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mark-leong.com/website-launched-riverside-church/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

