Wednesday, May 30, 2012

How to update cache manifest

In HTML5, we use cache manifest file for caching contents. While updating the content, there is a problem to view the latest changes as the browser stores the contents as cache. To solve this problem, we type the below command on the browser console to update the cache of the application:
javascript:applicationCache.update()


See the book OpenCart 1.4 Template Design Cookbook.
See the book Joomla Mobile Development Beginners Guide




List of my works:

Opencart Extensions:

  1. Product Based Quantity Wise Shipping: Find it here.
  2. OpenSSLCOMMERZ: integrate SSLCOMMERZ with opencart: Find it here.
  3. Fine Search v.1.0 - Improves Opencart search feature to find relevant: Find it here.
  4. Opensweetcaptcha - An easy way to generate attractive captcha for your system!: Find it here.
  5. Custom Field Product - add unlimited custom fields to the product form: Find it here.
  6. Formcaptcha - add captcha on the register page: Find it here.

My Books:

  1. OpenCart 1.4 Template Design Cookbook.
  2. Joomla Mobile Development Beginners Guide

Thursday, May 24, 2012

jQuery doesn't apply style on dynamically loaded contents

If we add any contents dynamically, the jQuery doesn't apply styles to that contents. Suppose, we add contents using $.html() function of jQuery. But found that the styles are missing on that code block.

To solve this problem, we need to trigger create event on that html element. Like the following:
$.html('some html here').trigger('create');


See the book OpenCart 1.4 Template Design Cookbook.
See the book Joomla Mobile Development Beginners Guide




List of my works:

Opencart Extensions:

  1. Product Based Quantity Wise Shipping: Find it here.
  2. OpenSSLCOMMERZ: integrate SSLCOMMERZ with opencart: Find it here.
  3. Fine Search v.1.0 - Improves Opencart search feature to find relevant: Find it here.
  4. Opensweetcaptcha - An easy way to generate attractive captcha for your system!: Find it here.
  5. Custom Field Product - add unlimited custom fields to the product form: Find it here.
  6. Formcaptcha - add captcha on the register page: Find it here.

My Books:

  1. OpenCart 1.4 Template Design Cookbook.
  2. Joomla Mobile Development Beginners Guide

Tuesday, May 8, 2012

Mount remote file system via ssh

Sometimes we need to sync files with different remote servers. We can use rsync, but we need to use cron for that. And this means at a certain time, a request need to be made. So, this involves some memory usage.
By mounting a remote folder, we can easily make synchronization. For this, first we need to install the sshfs.
sudo apt-get install sshfs
To mount a specific folder, we need to write the below command:
sshfs user@hostname: mount point
If you have a customized port:
sshfs -p 3000 hostname: mountpoint
We can set several options with the command, like allow_others, no_remote_lock etc.
sshfs -p 3000 hostname: mountpoint -o allow_others -o no_remote_lock
You can find other options by typing:
sshfs --help
To unmount it:
fusermount -u mountpoint

See the book OpenCart 1.4 Template Design Cookbook.
See the book Joomla Mobile Development Beginners Guide




List of my works:

Opencart Extensions:

  1. Product Based Quantity Wise Shipping: Find it here.
  2. OpenSSLCOMMERZ: integrate SSLCOMMERZ with opencart: Find it here.
  3. Fine Search v.1.0 - Improves Opencart search feature to find relevant: Find it here.
  4. Opensweetcaptcha - An easy way to generate attractive captcha for your system!: Find it here.
  5. Custom Field Product - add unlimited custom fields to the product form: Find it here.
  6. Formcaptcha - add captcha on the register page: Find it here.

My Books:

  1. OpenCart 1.4 Template Design Cookbook.
  2. Joomla Mobile Development Beginners Guide

How to detect accordion close or open?

jQuery mobile comes up with accordion feature which is the 'collapsable' property. We can detect this accordion event with the below code:
 

Menu 1 : Click to open / close

Paragraph 1.1

Paragraph 1.2

Paragraph 1.3

Menu 2 : Click to open / close

Paragraph 2.1

Paragraph 2.2

Paragraph 2.3


For the above code block, we use the blow script:
$(".ui-collapsible").live ("tap", function (event)
{
  var txt = "";
  if ($("#id1 h1.ui-collapsible-heading-collapsed").length) 
    txt += "Menu 1: closed\n";
  else 
    txt += "Menu 1: open\n";
    
  if ($("#id2 h1.ui-collapsible-heading-collapsed").length) 
    txt += "Menu 2: closed\n";
  else 
    txt += "Menu 2: open\n";
    
  alert (txt);
});
Here we test there the class 'ui-collapsible-heading-collapsed' is present or not.

See the book OpenCart 1.4 Template Design Cookbook.
See the book Joomla Mobile Development Beginners Guide




List of my works:

Opencart Extensions:

  1. Product Based Quantity Wise Shipping: Find it here.
  2. OpenSSLCOMMERZ: integrate SSLCOMMERZ with opencart: Find it here.
  3. Fine Search v.1.0 - Improves Opencart search feature to find relevant: Find it here.
  4. Opensweetcaptcha - An easy way to generate attractive captcha for your system!: Find it here.
  5. Custom Field Product - add unlimited custom fields to the product form: Find it here.
  6. Formcaptcha - add captcha on the register page: Find it here.

My Books:

  1. OpenCart 1.4 Template Design Cookbook.
  2. Joomla Mobile Development Beginners Guide

Wednesday, May 2, 2012

Mount Rackspace clound files

We will cloud fuse to mount cloud files. first we download cloud fuse into the server where we want to mount the cloud files.
git clone git://github.com/redbo/cloudfuse.git

We need the below libraries into our system installed.
sudo apt-get update
sudo apt-get install libcurl4-openssl-dev libxml2-dev libssl-dev libfuse-dev libxml2 gcc fuse-utils

Then we go to the folder and run the make command:
cd cloudfuse/
./configure 
make
sudo make install
which cloud fuse

And then we create a file under the user which will own this file.
sudo vim ~/.cloudfuse

These are the username, api key and auth url to the Rackspace cloud.
username=[username]
api_key=[key]
authurl=https://auth.api.rackspacecloud.com/v1.0

Go to /etc/fstab and add the following command:
cloudfuse       /media/cloudfile       fuse    defaults,gid=33,umask=000,allow_other  0 0

Change the group id, file path and umask as your need.
Now make a folder to the mounting point.
mkdir /media/cloudfile
And finally we mount it.
sudo mount /media/cloudfile

See the book OpenCart 1.4 Template Design Cookbook.
See the book Joomla Mobile Development Beginners Guide




List of my works:

Opencart Extensions:

  1. Product Based Quantity Wise Shipping: Find it here.
  2. OpenSSLCOMMERZ: integrate SSLCOMMERZ with opencart: Find it here.
  3. Fine Search v.1.0 - Improves Opencart search feature to find relevant: Find it here.
  4. Opensweetcaptcha - An easy way to generate attractive captcha for your system!: Find it here.
  5. Custom Field Product - add unlimited custom fields to the product form: Find it here.
  6. Formcaptcha - add captcha on the register page: Find it here.

My Books:

  1. OpenCart 1.4 Template Design Cookbook.
  2. Joomla Mobile Development Beginners Guide

fuse: failed to exec fusermount: No such file or directory

While using cloudfuse to mount device, I have come across the following error:
 fuse: failed to exec fusermount: No such file or directory 

To solve this error, we need to install fuse-utils into our system.
sudo apt-get install fuse-utils


See the book OpenCart 1.4 Template Design Cookbook.
See the book Joomla Mobile Development Beginners Guide




List of my works:

Opencart Extensions:

  1. Product Based Quantity Wise Shipping: Find it here.
  2. OpenSSLCOMMERZ: integrate SSLCOMMERZ with opencart: Find it here.
  3. Fine Search v.1.0 - Improves Opencart search feature to find relevant: Find it here.
  4. Opensweetcaptcha - An easy way to generate attractive captcha for your system!: Find it here.
  5. Custom Field Product - add unlimited custom fields to the product form: Find it here.
  6. Formcaptcha - add captcha on the register page: Find it here.

My Books:

  1. OpenCart 1.4 Template Design Cookbook.
  2. Joomla Mobile Development Beginners Guide

Ecliplse error: incompatible profile file name.

While install eclipse in my machine, I came across this error message for install PDT.
An internal error occurred during: "Computing size". Incompatible profile file name. Expected format is {timestamp}.profile.gz (or {timestamp}.profile) but was ._1328723081571.profile.g
I then found that this is a mac profile issue. To solve this problem, we need to go to the eclipse folder and delete the hidden files. Just run the following command and the error will be gone.
cd /path/to/your/eclipse/folder
find . -iname '._*' -exec rm -rf {} \;

On windows environment, you can't run the above command on command prompt. You need to install the Git Bash. Then run the above command.

See the book OpenCart 1.4 Template Design Cookbook.
See the book Joomla Mobile Development Beginners Guide




List of my works:

Opencart Extensions:

  1. Product Based Quantity Wise Shipping: Find it here.
  2. OpenSSLCOMMERZ: integrate SSLCOMMERZ with opencart: Find it here.
  3. Fine Search v.1.0 - Improves Opencart search feature to find relevant: Find it here.
  4. Opensweetcaptcha - An easy way to generate attractive captcha for your system!: Find it here.
  5. Custom Field Product - add unlimited custom fields to the product form: Find it here.
  6. Formcaptcha - add captcha on the register page: Find it here.

My Books:

  1. OpenCart 1.4 Template Design Cookbook.
  2. Joomla Mobile Development Beginners Guide