Set timezone of Mysql Server

Many times timezone issues with your database server causes wrong information to be entered in reports, transaction tables etc. To fix timezone issues with your mysql server, just login to your mysql and execute following query: SET GLOBAL time_zone = ‘<REQUIRED TIMZONE>; E.g. SET GLOBAL time_zone = ‘+5:30′; If you have to get the  current timezone, use this- SELECT TIMEDIFF(NOW(),...

Nginx show/set real ip address(public) from Amazon ELB Load Balancer address

To make it work, we need to add following lines to nginx configuration file: real_ip_header X-Forwarded-For; set_real_ip_from; It makes nginx to trust an X-Forwarded-For header from anyone, which makes Real Ip visible on logs and can be used in other programs where real ip is required.

Nginx allow cross domain ajax requests

To enable Nginx for Cross Origin calls add this in nginx configuration for the domain  : location /{ add_header ‘Access-Control-Allow-Origin’ ‘http://subdomain.mind-geek.net’; add_header ‘Access-Control-Allow-Credentials’ ‘true’; add_header ‘Access-Control-Allow-Methods’ ‘GET’; } That’s it, it will enable GET requests from http

Automate Magento Image Cache – Don’t let your website down when catalog image cache is flushed!

Problem - How to remove Magento Image Cache selectively, when you need to replace existing images and Clicking “Flush Catalog Image Cache” on Magento Cache Management will empty the cache folder which consumes lot of cpu plus memory, and for replacing few images Magento will generate all product images (say for replacing 2 product images it will remove all your 3000 product catalog image...

Magento Inventory Management – Desktop Tool

Download Magento Desktop Tool allows you to easily manage inventory on your Magento Store.   This application allows Store Owners to update product stock on their website. It also allows user to setup a  Gmail(Google) SMTP A/c so that they will get a copy of uploaded stock csv file, which allows them to keep record of stock updation over their store. Download here. Requirements: - Magennto API...

Remove Double Extensions in Linux

  Following script will help you to remove double extensions which can be added by some programs or by user mistakes and need to be corrected in bulk. Here is the solution, You have to perform this in the current working directory (non-recursively). vim fix_extension.sh Content of fix_extension.sh #!/bin/bash echo "Existing Extension" $1 echo "Converted Extension" $2 for file in *$1 do mv "${file}"...

Check Application Memory usage using simple command

To check the total amount of memory used by any program’s child processes: Create a shell script # vim checkmem.sh Contents: echo “————————————-Memory Checkup————————————”; ps -ylC $1 –sort:rss | awk ‘!/RSS/ { s+=$8 } END { printf...

Redis : Delete Keys by checking/matching expiry time remaining.

Sometimes we need to remove specific group of keys which are created earlier or have a specific expiry time remaining. You can simply delete Redis Key-value pairs by checking their expiry time remaining and running this simple script on your console: redis-cli -h <hostname> keys  “*” | while read LINE ; do TTL=`redis-cli -h <hostname> ttl $LINE`; if [ $TTL -ge ...

PhantomJs: Convert a String to an Image/PDF.

To convert a string or HTML to PNG or PDF using phantomjs: Create a File say texttoimage.js Add this code: var page = require(‘webpage’).create(); page.viewportSize = { width: 200, height : 200 }; page.content =  “This Text will be converted to Image”; page.setContent(page.content,page); window.setTimeout(function () { page.render(‘newimage.png’); phantom.exit(); },...

Add an External JS in Magento

To Add an External JS without any problem use this in XML Layout: <reference name="head"><block type="core/text" name="google.cdn.jquery"> <action method="setText"><text><![CDATA[<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script><script...

« Previous Entries