logo
Apr
18

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}"...
Apr
10

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...
Jan
20

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 ...
Jan
5

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(); },...
Aug
20

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...
Jul
29

Magento : Front controller reached 100 router match iterations

In Magento basic urls look like this ‘{name-of-the-module}/{controller}/{action}’ , If the url looks like this ‘{name-of-the-module}/{controller}/’ it’s equivalent to ‘{name-of-the-module}/{controller}/index’ , If the url looks like this ‘{name-of-the-module}/’ it’s equivalent to ‘{name-of-the-module}/index/index’. For categories and products there is a routing table...
Jul
27

Zend_Db_Statement_Exception with message ‘SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry’

Exception ‘Zend_Db_Statement_Exception’ with message ‘SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry” while Catalog Url Indexing Error: Next exception ‘Zend_Db_Statement_Exception’ with message ‘SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry ‘xxxx/xxx/xxx-’ for key...
Jun
16

Magento Show Out of Stock Configurable Options – Magento 1.5+

To show Out of Stock options in configurable products, we need to make these changes: Create a Local Module : Mindgeek_Outofstock /app/code/local/Mindgeek/Outofstock/Product/Block/Product/View/Type/Configurable.php /app/code/local/Mindgeek/Outofstock/etc/config.xml /app/code/etc/modules/Mindgeek_Outofstock.xml Rewrite...
May
19

Disable Magento Visitor Logs – For Better Performance

Disabling Magento Visitor Logs can’t possible from Admin. Disabling Visitor Logs helps in store performance as well as reduces sql queries while surfing the store which decreases MySQL Server load. It also causes Integrity Constraint Error sometimes. So to disable Visitor logs you need rewrite a Core Model: /app/code/core/Mage/Log/Model/Visitor.php – Mage_Log_Model_Visitor Find the below coding...
May
13

Amazon SES Request Expired, it must be within 300secs/of server time.

While using Amazon Simple Email Service, sometimes we encounter this error message: ” AWS Error Code: RequestExpired, AWS Error Message: Request timestamp: Sun, 13 Mar 2011 06:10:27 GMT expired. It must be within 300 secs/ of server time.” This error probably means that Amazon SES time differs from your system clock time. If you’re using the command-line tools then you may need to adjust...
May
13

Import a CSV File to Mysql Database

To Import a CSV File in MySQL Database execute this query with path to the csv file you need to import: LOAD DATA LOCAL INFILE ‘filetoimport.csv’ INTO TABLE <tablename> FIELDS TERMINATED BY ‘,’ LINES TERMINATED BY ‘\n’ (field1, field2, field3….,field-n); Remember to match the columns in your csv and MySQL table.
Apr
16

JavaScript – Executing Multiple window.onload events on a webpage

For executing multiple window.onload add this script to the head head section: <script language=”javascript” > function addLoadEvent(func) { var oldonload = window.onload; if (typeof window.onload != ‘function’) { window.onload = func } else { window.onload = function() { if (oldonload) { oldonload() } func() } } } </script> Add Function to window.onload event use...
Apr
1

Magento Load Related, Upsell and crosssell Products by Ajax using dynamic block creation

To load related products using Ajax just pass current product id by Ajax request and create a controller and add the following code to load the related products: //Register the Current Magento Product Mage::register(‘product’, Mage::getModel(‘catalog/product’)->load($productId)); $block =...
Apr
1

Magento URL Rewrites in a Collection

To Enable Url rewrites while using a Magento collection just add this to the end of collection: ->addUrlRewrite() which adds URL rewrites to collection flag
Apr
1

Setup Pure-FTPd Daemon in Linux

Install Pure-FTPd In a Linux shell run the following: Ubuntu - apt-get install pure-ftpd-common pure-ftpd Red Hat, Centos- yum install pure-ftpd-common pure-ftpd Now we need to create a new system group for pureftpd: groupadd ftpgroup Now we add a user for the group and give that user no permission to a home directory or a shell: useradd -g ftpgroup -d /dev/null -s /etc ftpuser Create a new user Lets...

« Previous Entries

logo
Powered by WordPress | Designed by Elegant Themes