How to Install WordPress Plugins Without FTP Access?

Have you ever wondered the reason why your friend’s blog doesn’t prompt him for FTP access while your blog do? This is because you did not grant WordPress the “Write” access to “wp-content” folder.

Do the following to grant the “Write” access in Windows Server:

  1. Access your blog’s root folder.
  2. Right-click “wp-content” folder and click on “Properties”.
  3. Click on the “Security” tab and click on the “Edit…” button.
  4. Grant “Full Control” for the “Users” group and click on the “Apply” button.


How to Download Dailymotion Video?

If you are having problems with Dailymotion slow streaming issue and you are considering on downloading the video beforehand, then you have came to the correct place.

Do the following steps to download Dailymotion video:
Note: So far we have tested it in Chrome and it works. For Firefox, we noticed that the browser simply ignored the Java Applet without any security prompting (this might due to our browser setting).

  1. Copy the Dailymotion video’s url that you wished to download.
  2. Go to KeepVid ( and paste the Dailymotion’s url in the “Download” text field and click on the “Download” button.
  3. By default, Chrome will prompt for your permission if you wish to run the Java Applet. Click on “Run this time” or “Always run on this site” depending on your comfortable level.
  4. Checked “I accept the risk and want to run this application.” and click on the “Run” button.
  5. Drag the download link to a new tab.
  6. Press Ctrl + S and save the video to your desired directory.

(Theory) Resize Image On The Fly

One of the best practices to improve your website performance is to optimize your images according to the image’s dimension needed. For example, a particular image can appear in more than one places (Homepage and Event Detail Page) and the image’s dimension will varies as follows:

    • Homepage – 90px x 90px
    • Event Detail Page – 200px x 200px
    • Event Detail Page (when the user clicks on the image to enlarge it) – dimension varies (max at 800px x 800px)

I must admit that it is always tempting to serve the large possible image’s size and resize the image using CSS. But by doing so, the page load size will be “bloated” with the unnecessarily data (which indirectly might affect the page download speed). Imagine an Event Listing Page that displays 20 events per page, you will have roughly 4.5mb of un-scaled images compared to just 300kb of optimized images. Hence I have decided to spend my entire afternoon googling on this topic and most pages that I have read are debating if they should deliver the resize images on the fly or stored the images somewhere.

While going thru the pages, I was thinking “Why not have both?”. A “hybrid” approach that resizes the image only when the cache copy does not exists. The approach will involves the following (without going thru the codes):

    • A new folder that stored your optimized images (in our case, we have name the folder as “cache”).
    • All image tags (<img>) that required optimizing should reference the optimized images in the “cache” folder (even if the optimized copy does not exists).
    • page (or servlet) that will resize the image on the fly and stored it in the “cache” folder. It will also return the optimized image back to the user.
    • A Javascript function that attached an onError event listener to images tag that required to be optimized. In events whereby the optimized copy of image does not exist, it will fetch the image directly from the page.

Javascript Code (jQuery)
The following jQuery code will attach an onError event listener to all image tags with ‘resize’ class in the page (<img src=’xxx.jpg’ class=’resize’ />). In events whereby the resize cache image does not exist, the onError event listener will be fired and the image’s src will be changed to page (/fetch?path=?).

$(document).ready(function () {
    $(".resize").on("error.img", function (e) {
        var n = $(e.currentTarget);
        n.attr("src", "/fetch?path=" + n.attr("src")).off("error.img");

Not really good at putting my thoughts into words hence let proceed with a scenario example:

In this scenario, let us assume that Image A has just been uploaded to the server hence there is no resize copy in the cache folder. The image A tag in homepage will looks like this:
<img src=’/cache/images/a/xxx_90x90.jpg‘ class=’resize’ />

When user tried to access Image A for the first time in the homepage, the onError event listener will be triggered as the image tag is unable to locate the resize image from “/cache/images/a/xxx_90x90.jpg”. The onError event listener will execute a javascript function that change the image tag src and make it point to the page, as shown below:
<img src=’/fetch?path=/cache/images/a/xxx_90x90.jpg‘ class=’resize’ />

The browser will do a reflow and the page will be been triggered. Depending on the path keyed, the server will verify if the original image exists. If it exists, it will proceed to resize the image according to the dimension indicated in the filename (“_90x90.jpg”) and stored the resize image in the cache folder. Once the resize process is completed, the page will return the resize image as an attachment.

And the image will load perfectly (without the user realizing it). Subsequent visits to Image A in the homepage will not trigger the page as the resize image copy has been successfully created in the cache folder.

What are we trying to achieve here?
Using above approach, we are hoping that we can off-load the process of verifying if the resize image exists to the client’s side. This would save us some overheads in terms of the response time as we can skip:

  • the process of having to look up to the respective file directory for the resize image (or a lookup table stored in cache)
  • and avoid hitting a seperate page

This approach will also gives us the flexibility to resize the image dimension easily and reduce the unnecessarily network.

(Bug) MySQL Workbench: Current Profile Has no WMI enabled

For unknown reason, we have been encountering “Current Profile Has no WMI enabled” whenever we tried to access server instance in the “Server Administration” column for the first time (note: we only encounter this issue with our vps and dedicated server).

Do the following to replicate the issue:

  1. Install MySQL Workbench for the first time.
  2. Click on “New Server Instance” under “Server Administration” column and add the new server instance.
  3. Double click on the new instance that you have just created.
  4. An error message will pop up, it will read “Current Profile Has no WMI enabled”.

To resolve the issue, simply click on “Manage Server Instances” under “Server Administration” column and close the screen again.
Now click on the instance again, the issue should be fixed.

Youtube / Flash Overlaps with Drop-down Menu

Every now and then, we would encounter videos overlapping with dropdown menu issues and most of the time, the culprit would be IE! If you encountered the same issue, hopefully this blog post will help you.

Flash Overlapping Issue

If you are encountering Flash overlapping issue, add vmode=”transparent” to your flash’s parameter:

<ob.ject width=”560″ height=”315″>
<param name=”vmode” value=”transparent”></param>

Youtube Overlapping Issue

There is currently 2 ways in embedding your Youtube videos. The first method is to embed the Youtube video thru Flash, if you encounter overlapping issue with it, please see the solution above.

The other method is to embedded Youtube video using iframe (which is the most recommended way, as it allows the browser to have the flexible to decide if it should render as html5 player or flash). If you are encountering overlapping issue with the iframe, append “?wmode=transparent” behind the url:

< width=”560″ height=”315″ src=”” frameborder=”0″ allowfullscreen></>

Where can I find sun.misc.BASE64Decoder?

Have you ever tried to import “sun.misc.BASE64Decoder” before? Or are you looking for sun.miscBASE64Decoder jar? Chances are that your IDE are returning you the following error (at least for me):
“Access restriction: The type BASE64Decoder is not accessible due to restriction on required library ”

Instead of sourcing for BASE64Decoder jar, you might want to replace it with javax.xml.bind.DatatypeConverter. It provides the same encoding and decoding methods as BASE64Decorder and its claimed by others that its faster as well.

Before Java 6.0:
sun.misc.BASE64Decoder dec = new sun.misc.BASE64Decoder();
byte[] cipherData = dec.decodeBuffer(cipherText);

With javax.xml.bind.DatatypeConverter:
byte[] cipherData = DatatypeConverter.parseBase64Binary(cipherText);

Hope its helps!

How to Share Common JARs with Various Portlets in Liferay

Do the following steps to share common jars with various portlets in Liferay:

  1. Deposit your common jars at ${liferay folder}/${tomcat}/webapps/ROOT/WEB-INF/lib
  2. Locate your “” file in your portlet and add in the follow line:
    portal-dependency-jars=canon-commons.jar (in this case, canon-commons.jar is our common jar’s name)

    For multiple jars, add in “,” as its seperator:


How to Disable Javascript Validation in Eclipse

One of the best practices to speed up your website is to minimize the number of HTTP requests required by a page and one of the simplest way is to combined all external javascript files into one. This will become an issue for Eclipse developers at certain point of our life, as the more javascript we write, the more time Eclipse need to validate when we press the ctrl+s button. Which sometimes led to IDE not responding.

To Disable Javascript Validation in Eclipse, try the following method:

  1. Go to Windows > Preferences > Validation and select “…” for Client-side Javascript Validator. Create an “Exclude Group” rule and exclude validation with .js extension.
  2. (if it does not work, proceed to this step) Go to Project > Properties > Builders, unchecked Javascript Validator

Hope its help! Do welcome more suggestions on how to improve Eclipse performance 🙂

Windows Messenger Contacts Appear Offline

I have encountered a strange issue with my Windows Live Messenger 2011 today. All of my msn contacts appear offline. Despite how many times I have tried to restart my com, reset my internet connection, and even flush my dns, the result is still the same. Like usual, i decided to google and this is the solution that i have found:

For Windows 7 users

  1. Close your Window Messenger application.
  2. Go to C:Users<your Windows login name>AppDataLocalMicrosoftWindows Live.
  3. Delete the Contacts folder.
  4. Start your messenger, it should work now 🙂

Contacts in Windows Live Messenger appear Offline when they are Online