Magento EE – Punch Hole in Full Page Cache

hole

Magento is slow, it’s a truth . because of its slowness, Magento have some cache mechanisms to make your site faster, so your customers will be happy. Many people choose to use all of caching options available. according to their opinions, the best cache solution for Magento is Full Page Cache (FPC), and it’s one feature from Magento Enterprise.

implementing FPC means you will have all your page content cached. it’s good for speed, but what will happen when you have several block that need to be updated after each request, or may be you want a shorter cache life for it ? The following tutorial will show you how to punch some holes in your FPC pages so you can solve above problems.

Continue reading

Unix – Worst way to disable annoyance from auto execute or startup program

Banner-Gears

Is there any programs that you don’t want it to be triggered by any reason ? if so, this article will show you how to deal with it.
There’re many ways and tools that help you to disable programs from startup or auto triggered by other applications in Windows enviroment, and they’re efficient!
Using Unix-based systems, you have less choices to do such thing, and sometime you find it hard and confusing. And, if you hate some annoying programs like me, there’s a dirty method that will free you from annoyance :). All you have to do is to remove execute permission for bin file.
Open your termial and execute the following command :

chmod -x /path/to/file

may be you’ll need to use sudo because some programs require root permissions

Magento – Fix integrity constraint violation issue

Database-banner

Sometimes, you face database issues like this ‘integrity constraint violation: 1062 Duplicate entry ‘100000001’ for key’ . if you are not familiar with Magento, may be you will feel blind (like i was), debugging won’t go smoothly as usual.

After studying Magento deeper to its core, i found that Magento numbering system depends on a table called ‘eav_entity_store’. this table stores increment ids of many entities from Magento.

Continue reading

Magento – price helper code snippet

This piece of codes will help you get final price with tax and formatted nicely using your store currency


<?php
$_coreHelper = $this->helper(’core’);
$_taxHelper = $this->helper(’tax’);
$_finalPriceInclTax = $_taxHelper->getPrice($_product, $_product->getFinalPrice(), true);
$_finalPriceInclTaxNicelyFormated = $_coreHelper->currency($_finalPriceInclTax,true,false);
echo $_finalPriceInclTaxNicelyFormated;

?>

Hope you find it useful ! 😀

WordPress – reset your admin password using Command line (quick way)

Sometimes, you lose your credential to your wordpress admin dashboard, i guess many of you had this question in mind : what is the quickest way to reset my admin password ?

error-wp1

In WordPress, there is more than one way to set your password. In normal circumstances, you can do it through the WordPress interface. If you forget your password, WordPress has a built in recovery mechanism that uses email.

But on some hosts, especially when email isn’t working right, sometimes you have to take different steps to reset your password. in this article, i’ll show you how to reset you admin password using command line:

1. log in to MySQL

mysql -u root -p

Continue reading

Amazon EC2 common problems – there’s no swap space

Ubuntu EC2 EBS images don’t come with swap space configured (for 11.04 at least). The “regular” instance-type images do have a swap partition, though only 896 MB.

amazonec2

If some process blows up and you don’t have enough memory or a swap space, your server could come to a crawling halt for a good while before the OOM (out of memory) killer kicks in, whereas with swap, it merely gets slow. For that reason, I always like to have swap space around, even with enough RAM.

Continue reading

Redirect Magento with global messages

Open the controller that contains your logic, put these lines at terminate point of your code:


Mage::getSingleton('core/session')->addError('your message goes here');

$this->_redirect('redirect location');

return;

Above example will redirect and dispay an Error message, you can also display other type of message with the following methods from singleton Core/session

  • addWarning
  • addNotice
  • addSuccess

How to Protect the wordpress wp-config.php File

The wp-config.php file contains very sensitive information about your WordPress installation, including your database access, table prefix and Secret Keys.

The wp-config.php file is a standard part of your WordPress installation. It defines the configuration settings required to access your MySQL database. If your self-hosting WordPress, there’s no way of getting around not using it.

It’s your job to protect it! You certainly don’t want this file falling into the wrong hands in the event of a server problem. You can protect it by encrypting it’s content when you upload and denying access to it.
Continue reading

Auto update script for pathogen bundles


#vim auto update bundle script
 #author : Atheotsky

#locate self location & move to it
 cd `dirname $0`

#update function
 updatePlugins()
 {
 cd "$1"
 echo "updating $1 ......"
 git pull
 cd ..
 }

#build array of folder under current location
 directories=$(ls -l | egrep '^d' | awk '{print $9}')

#use loop with array
 for directory in $directories; do
 #execute function
 updatePlugins $directory
 done

echo "Update completed!"