Skip to main content

Posts

Dual Screen Script for Ubuntu

I have experienced problems when installing two monitors in Ubuntu. Following script will help you to solve this problem. I had problems when saving below values so I created a script and put it to the startup. #!/bin/sh xrandr --output VGA-0 --mode 1920x1080 --pos 1280x0 --rotate normal --output DVI-I-1 --off --output DVI-I-0 --mode 1280x1024 --pos 0x0 --rotate normal --output HDMI-0 --off

MYSQL Compare data in different Databases

Following statement will compare values in two databases and gives you records that not matched. SELECT stage,live,path,scope_id FROM ( SELECT (CASE WHEN (S.value = L.value) THEN '' ELSE 'N/M' END) as matched, S.scope_id, S.path, S.value AS 'stage', L.value AS 'live' FROM cin_stage.core_config_data S INNER JOIN cin_live.core_config_data L ON S.path = L.path ) RES WHERE matched = 'N/M' ORDER BY scope_id

Magento DB access denied

I got this error suddenly while accessing the magento site. SQLSTATE[HY000] [1129] Host 'user.workgroup' is blocked because of many connection errors; unblock with 'mysqladmin flush-hosts' Solution use below command in console mysqladmin flush-hosts or log in to  mysql with a different host if its implemented on network environment and use below statement; FLUSH HOSTS; Or Restart the mysql server

PHP URL Checker using CSV

<?php /* | File: url_checker.php | Info: Take CSV as inpu and check url status. | Usage: php url_checker.php | | CSV file contain URLS | | ex: | www.site.com/url1 | www.site.com/url2 | www.site.com/url3 | www.site.com/url4 | www.site.com/url5 | www.site.com/url6 | www.site.com/url7 | */ $file = fopen("urls.csv","r"); while(! feof($file)) { $row = fgetcsv($file); $handle = curl_init($row[0]); curl_setopt($handle, CURLOPT_RETURNTRANSFER, TRUE); $response = curl_exec($handle); $httpCode = curl_getinfo($handle, CURLINFO_HTTP_CODE); if($httpCode!=200) { //Following will use teminal colors to echo "\033[01;31m{$httpCode} \033[0m {$row[0]} \n"; } else { echo $httpCode."\n"; } } echo "Finished fetching..."; fclose($file); ?>

Magento Generate Google Sitemap using Cron

I had a problem with generating the Google sitemap using cron job. To do that you can simply change following database value. SELECT * FROM core_config_data WHERE path = 'crontab/jobs/sitemap_generate/schedule/cron_expr' Change the value as you set time in cron jobs. EX: Generate the Sitemap for every 5 minutes value = */5 * * * * That's it. Now you have to worry about cron is working or not. Just type following in your browser and hit enter. http://youresite.com/cron.php

Delete Order details from Magento

SET FOREIGN_KEY_CHECKS=0; TRUNCATE `sales_flat_creditmemo`; TRUNCATE `sales_flat_creditmemo_comment`; TRUNCATE `sales_flat_creditmemo_grid`; TRUNCATE `sales_flat_creditmemo_item`; TRUNCATE `sales_flat_invoice`; TRUNCATE `sales_flat_invoice_comment`; TRUNCATE `sales_flat_invoice_grid`; TRUNCATE `sales_flat_invoice_item`; TRUNCATE `sales_flat_order`; TRUNCATE `sales_flat_order_address`; TRUNCATE `sales_flat_order_grid`; TRUNCATE `sales_flat_order_item`; TRUNCATE `sales_flat_order_payment`; TRUNCATE `sales_flat_order_status_history`; TRUNCATE `sales_flat_quote`; TRUNCATE `sales_flat_quote_address`; TRUNCATE `sales_flat_quote_address_item`; TRUNCATE `sales_flat_quote_item`; TRUNCATE `sales_flat_quote_item_option`; TRUNCATE `sales_flat_quote_payment`; TRUNCATE `sales_flat_quote_shipping_rate`; TRUNCATE `sales_flat_shipment`; TRUNCATE `sales_flat_shipment_comment`; TRUNCATE `sales_flat_shipment_grid`; TRUNCATE `sales_flat_shipment_item`; TRUNCATE `sales_flat_shipment_track`; TRUNCATE `sale

Delete Customer Details from Magee using SQL

SET FOREIGN_KEY_CHECKS=0; -- reset customers TRUNCATE customer_address_entity; TRUNCATE customer_address_entity_datetime; TRUNCATE customer_address_entity_decimal; TRUNCATE customer_address_entity_int; TRUNCATE customer_address_entity_text; TRUNCATE customer_address_entity_varchar; TRUNCATE customer_entity; TRUNCATE customer_entity_datetime; TRUNCATE customer_entity_decimal; TRUNCATE customer_entity_int; TRUNCATE customer_entity_text; TRUNCATE customer_entity_varchar; TRUNCATE log_customer; TRUNCATE log_visitor; TRUNCATE log_visitor_info; ALTER TABLE customer_address_entity AUTO_INCREMENT=1; ALTER TABLE customer_address_entity_datetime AUTO_INCREMENT=1; ALTER TABLE customer_address_entity_decimal AUTO_INCREMENT=1; ALTER TABLE customer_address_entity_int AUTO_INCREMENT=1; ALTER TABLE customer_address_entity_text AUTO_INCREMENT=1; ALTER TABLE customer_address_entity_varchar AUTO_INCREMENT=1; ALTER TABLE customer_entity AUTO_INCREMENT=1; ALTER TABLE customer_entity_datetime AUTO_INCREME