Sanjoy Roy

[MCM, MCP, SCJP] – Senior PHP Programmer

Navman white or black screen fix


s_NavmanPanoramic_1_624

When my unit turns on, it only displays a white or black screen. How can I fix this?

To resolve the white screen issue on your unit, please follow the steps below:

1. Connect Navman GPS to PC via mini-USB cable.
2. Go to ‘Start’
3. Go to ‘My Computer’
4. Open the Navman Unit
5. Open the ‘Navman’ folder
6. Open the ‘Database’ folder
7. Delete the following file only – ‘database.db’
8. Close the folders
9. Disconnect the mini-USB cable then restart the Navman GPS by sliding the switch to ‘Restart’ then back to ‘On’ after 10 seconds

Please Note: The database.db file will be generated automatically once the folder is closed.

Resource: link

Javascript Validate two input fields with the same name?


<div style=”” id=”shipping-new”>
<table class=”form”>
<tr>
<td><span class=”required”>*</span> Post Code:</td>
<td><input type=”text” class=”large-field” value=”” name=”postcode”><span class=”error”>Sorry, we cannot deliver to your area!</span></td>
</tr>
</table>
</div> Read more of this post

Copy recursively directory structure using Linux Command


How to copy a directory/folder structures in a single command
Create a new directory
Cd new_directory
Run the following command
Where “../catalog” is the source location
***Remember to backup before running this script.

e.g

find ../catalog -type d -printf “%P\n” | xargs mkdir -p

find ../admin -type d -printf “%P\n” | xargs mkdir -p

Great JS Webtool for Developers: Aardvark


Clean up unwanted banners and surrounding “fluff,” especially prior to printing a page See how the page is created, block by block View the source code of one or more elements

http://karmatics.com/aardvark/

Once you have installed Aardvark as a bookmarklet (it takes about ten seconds!), you may start it at any time by selecting it from the bookmarks menu or toolbar. Aardvark will run until you press the “Q” key to quit, or leave the page or refresh it.

Example of red highlightingAs you glide the mouse over the page, you will see a red rectangle framing each element under the cursor. You will also see a little yellow caption showing the HTML element type and its class or id if they exist. Pressing certain keys on the keyboard (see below) will do various things, as described in the Keystroke list below.

Online ICON (*.ico) File Creator


iConvertv2.9 converts and creates Windows, Mac and Linux icons in one step!

http://iconverticons.com/online

iConvert Icons has been carefully designed to make it as easy as possible to create and convert icons. It creates icons in all of the popular icon formats, including png, ico, and icns. It is also the only icon converter to support converting directly from SVG. All you need to do is drag and drop – iConvert Icons converts the images into icons with only a single click. 

Free Canon DSLR Photgraphy Course


Canon’s Photography 101 online class:
http://web.canon.jp/imaging/enjoydslr/

Topics covered include:

  1. Shooting Modes
  2. Aperture
  3. Shutter-Speed
  4. ISO
  5. Depth of field
  6. Lenses (normal, telephoto, wide-angle, macro, fish-eye, tilt-shift)
  7. Sensor size (APS-C, APS-H, Full-frame)

It’s very good reading. I went and read the whole web page and I found a couple nuggets.

This is a great free resource for beginner & intermediate photographers.

jQuery UI icons


Here you can find the list: jQuery UI icons

  • .ui-icon-carat-1-n
  • .ui-icon-carat-1-ne
  • .ui-icon-carat-1-e
  • .ui-icon-carat-1-se
  • .ui-icon-carat-1-s
  • .ui-icon-carat-1-sw
  • .ui-icon-carat-1-w
  • .ui-icon-carat-1-nw
  • .ui-icon-carat-2-n-s
  • .ui-icon-carat-2-e-w Read more of this post

Top Free Secure SFTP Clients for Windows


Top Free Secure SFTP Clients for Windows
If you want to transfer files to Linux; use one of the most recommended tools below:

  • WinSCP
  • PSCP and PSFTP (from PuTTY)
  • Filezilla
  • FireFTP
  • CoreFTP LE
  • Swish – SFTP from Windows Explorer
  • BitKinex

Impressive WordPress Themes

Opencart Removing Estimate Shipping & Taxes v1.5.1


1. Login to admin (backend)
2. Choose Extensions ->Order Totals
3. Edit “Shipping”
4. Set “Shipping Estimator:”: Disabled.
5. Press Save button.
6. Done

২০১৩ সালের সেরা ৫০ ওয়েবসাইট


২০১৩ সালের সেরা ৫০ ওয়েবসাইট

 প্রতিবছর মার্কিন প্রকাশনা টাইম ম্যাগাজিন বিভিন্ন ক্ষেত্রে সেরাদের তালিকা প্রকাশ করে। সম্প্রতি টাইম ম্যাগাজিনের দৃষ্টিতে ২০১৩ সালের সেরা ৫০টি ওয়েবসাইটের তালিকা প্রকাশ করেছে। এতে ১০টি ক্যাটাগরিতে ৫০টি ওয়েবসাইট শীর্ষ তালিকায় এসেছে। সেসব ওয়েবসাইট নিয়েই এবারের মেইনবোর্ড। দ্বিতীয় কিস্তিতে আজ থাকছে ওয়েব টুলস এবং সামাজিক যোগাযোগের সাইট|

ওয়েব টুলস বিষয়ক সাইট

ফিডলি
Feedly.com

গুগল যেখানে অনেক মানুষের প্রিয় আরএসএস ফিডার নিয়ে আশা-আকাঙ্ক্ষার প্রতিফলন ঘটাতে পারেনি সেখানে এর উত্তম প্রতিস্থাপন করার সম্ভাবনা দেখা দিয়েছে। বলা হচ্ছে, এই সাইটটি গুগলের তুলনায় ভালো আরএসএস ফিডারের সার্ভিস চালু করেছে এবং তা হালনাগাদসহ এই সার্ভিসের উন্নয়ন ঘটাতে তৎপর রয়েছে।

মাই পারমিশন্স
Mypermissions.org 

ওয়েবে এটি একটি কমিউনিটি সার্ভিস, যেখানে ব্যক্তিগত নিরাপত্তা সংরক্ষিত রেখে ফেইসবুক, টুইটার, গুগল এবং অন্যান্য সামাজিক নেটওয়ার্ক সাইটে আপনার অ্যাকাউন্ট ব্যবহারের অনুমতি চাইবে। আর অনুমতি দেওয়া হলে লিংকের মাধ্যমে নির্দিষ্ট তথ্য এক্সেস করা যাবে। যখন আপনার ফেইসবুকসহ অন্যান্য অ্যাপস হতে আপনার ব্যক্তিগত তথ্য এক্সেস করা হবে তখন স্বয়ংক্রিয়ভাবে আপনি অ্যালার্ট পাবেন এবং চাইলে একটিমাত্র ক্লিকের মাধ্যমে তা মুছে ফেলতে পারবেন। ব্যক্তিগত তথ্যসমূহ সুরক্ষিত রাখতে এই টুল ব্যবহার করা যেতে পারে।
Read more of this post

Some Linux useful IP commands


Display Current Config for all NIC’s: ifconfig

Display Current Config for eth0: ifconfig eth0

Assign IP: ifconfig eth0 192.168.1.2

Ping: ping -c 3 192.168.1.1

Assign multiple IP’s: ifconfig eth0:0 192.168.1.2

Assign second IP: ifconfig eth0:1 192.168.1.3

Disable network card: ifconfig eth0 down

Enable network card: ifconfig eth0 up

View current routing table: route “or” route -n

View arp cache: arp “or” arp -n

Assign IP/Subnet: ifconfig eth0 192.168.1.2 netmask 255.255.255.0

Assign Default Gateway: route add default gw 192.168.1.1

Trace Route: traceroute http://www.whatismyip.com

Trace Path: tracepath http://www.whatismyip.com

DNS Test: host http://www.whatismyip.com

Advanced DNS Test: dig http://www.whatismyip.com

Reverse Lookup: host 66.11.119.69

Advanced Reverse Lookup: dig -x 66.11.119.69

*You MUST be at the ROOT user to make/save any changes. Linux users, your distribution will determine the location of your network config file which will need to be updated and saved in order for the changes to remain in effect after rebooting. Network cards are referred to as eth0, eth1, eth2, etc based on their position on the PCI bus.
*Special thanks to Gergely for the Linux commands!

 

Ext.NET Examples Explorer (Version 1.6)

Frame not found in cellmap


You have to be careful how complex your HTML layout is. In fact I’ve found the simpler, the better (and yes, that means the use of HTML tables quite often).
The reason this error was occurring was because I had a DIV tag that was spanning onto two pages. The fix was super easy; I simply changed the DIV tag to a SPAN.
This also seems to occur with tags; again I replaced these with a span tag.

OpenCart – How to customize the order confirmation and registration email?


To change the order confirmation email, access your store files on FTP and go to the following directory:

catalog/language/english/mail/

Open the order.php file to make the changes you need. You will see the text to edit in quotation marks on the right when you open the file.

In order to edit the the customer registration email, on your FTP go to:

admin/language/english/mail/

and make your changes to the customer.php file.

How to show the default cookie set page if you are not allowed to visit a page


setcookie("testcookie", "testvalue");
if(!isset( $_COOKIE['testcookie'] ) && $_SERVER['SCRIPT_NAME'] != '/enable-cookies.php' && $_SERVER['SCRIPT_NAME'] != '/index.php'  && $_SERVER['SCRIPT_NAME'] != '/contact_us.php') tep_redirect(tep_href_link('enable-cookies.php'));

Block Google and bots using htaccess and robots.txt


Robots.txt
User-agent: *
Disallow: /

.htaccess

RewriteEngine on
RewriteCond %{HTTP_USER_AGENT} AltaVista [OR]
RewriteCond %{HTTP_USER_AGENT} Googlebot [OR]
RewriteCond %{HTTP_USER_AGENT} msnbot [OR]
RewriteCond %{HTTP_USER_AGENT} Slurp
RewriteRule ^.*$ “http\:\/\/domainname\.com.au” [R=301,L]

How to force browser to resize when window resizing doesn’t work

How to hide window scrollbar for IE, FF and Google Chrome


It is easy if you add the attribute scrollbars=no inside the window.open()‘s window attributes. But what if you wish to hide them when the popup window is already open. Thank you CSS! Yes, it is possible by using Javascript and accessing the window style’s property overflow. However, there is a cross-browser issue. Both IE and Firefox/Google Chrome have different codes that make this work. You can place both their codes in the same page and/or Javascript function. If the browser does not understand the property, it will ignore it anyway so there is no need to do a browser check to execute the code specific to that certain browser.
The code below does the trick:

document.documentElement.style.overflow = 'hidden'; // firefox, chrome
document.body.scroll = "no"; // ie only

Just in case you wish to disable either just the horizontal or vertical scrollbar, this code works for non IE browsers

document.documentElement.style.overflowX = 'hidden'; // horizontal scrollbar will be hidden
document.documentElement.style.overflowY = 'hidden'; // vertical scrollbar will be hidden

Bluehost error: [an error occurred while processing this directive]


ISSUE RESOLVED:

For the benefit of anyone encountering a similar problem, try the steps that follow:

– Go to cPanel
– Open File Manager from Files section
– Navigate to domain folder
– Check “Perms” column on far right hand side
– Files should be set to: 0644 (this is the UNIX file permissions)
– Folders should be set to: 0755

This will change your file permissions to their proper settings for the Bluehost file system. Additionally, if you have PHP code within.htm or .html files, you will need to add an additional Apache handler to tell Bluehost to parse these files as PHP. Do this using Apache Handlers in cPanel:

HANDLER: application/x-httpd-php5s
EXTENSIONS: .php .htm .html

Opencart coupon history not working with Paypal


in catalog/model/checkout/coupon.php
change:

Code:

  public function getCoupon($code) {

to

Code:

 public function getCoupon($code,$noverify=0) {

AND change

Code:

       if ($status) {
             return array(

to

Code:

       if (($status)||($noverify)) {
             return array(

Next, in catalog/model/total/coupon.php in the confirm function right near the bottom change

Code:

    $coupon_info = $this->model_checkout_coupon->getCoupon($code);

to

Code:

    $coupon_info = $this->model_checkout_coupon->getCoupon($code,1);

Here is the VQMod xml file:

<?xml version="1.0" encoding="utf-8"?>
<modification>
<id>Fix Coupon Codes (so they register after using paypal or similar payment gateway)</id>
<version>1.0.0</version>
<vqmver>2.1.0</vqmver>
<author>Sanjoy Roy </author>
<file name="catalog/model/checkout/coupon.php">
<operation>
<search position="replace"><![CDATA[ public function getCoupon($code) { ]]></search>
<add><![CDATA[ public function getCoupon($code, $verify = true) { ]]></add>
</operation>
<operation>
<search position="replace"><![CDATA[ if ($status) { ]]></search>
<add><![CDATA[ if ($status || $verify === false) { ]]></add>
</operation>
</file>

<file name="catalog/model/total/coupon.php">
<operation>
<search position="replace"><![CDATA[ $coupon_info = $this->model_checkout_coupon->getCoupon($code); ]]></search>
<add><![CDATA[ $coupon_info = $this->model_checkout_coupon->getCoupon($code, false); ]]></add>
</operation>
</file>
</modification>

Combining animation and ActionScript using Flash Professional CS5 and Flash Builder 4

Adobe Configuration Error 130:10


Configuration Error 130:10

How to bypass Apache password protected directories without showing popup login

.htaccess for CMSMS


 Options +FollowSymLinks
 DirectoryIndex index.htm index.html index.php
 Options -Indexes 
  order allow,deny
  deny from all 
 ErrorDocument 403 /forbidden403.shtml
 ServerSignature Off

.htaccess for creloaded or osCommerce root


Options +FollowSymLinks
DirectoryIndex index.htm index.html index.php
RewriteEngine On
# proc/self/environ? no way!
RewriteCond %{QUERY_STRING} proc/self/environ [OR]
# Block out any script trying to set a mosConfig value through the URL
RewriteCond %{QUERY_STRING} mosConfig_[a-zA-Z_]{1,21}(=|\%3D) [OR]
# Block out any script trying to base64_encode crap to send via URL
RewriteCond %{QUERY_STRING} base64_encode.*(.*) [OR]
 
# Block out any script that includes a  tag in URL
RewriteCond %{QUERY_STRING} (|%3E) [NC,OR]
# Block out any script trying to set a PHP GLOBALS variable via URL
RewriteCond %{QUERY_STRING} GLOBALS(=|[|\%[0-9A-Z]{0,2}) [OR]
# Block out any script trying to modify a _REQUEST variable via URL
RewriteCond %{QUERY_STRING} _REQUEST(=|[|\%[0-9A-Z]{0,2})
# Send all blocked request to homepage with 403 Forbidden error!
RewriteRule ^(.*)$ index.php [F,L]
SetEnvIf User-Agent ".*MSIE.*" \
nokeepalive ssl-unclean-shutdown \
downgrade-1.0 force-response-1.0
php_flag register_long_arrays On
php_flag register_globals On 
php_flag display_errors Off
php_value session.use_trans_sid 0
php_value register_globals 1
php_flag display_errors On
php_flag track_errors Off

www redirect issues Fix


How to change domain.com.au to http://www.domain.com.au?

if ($_SERVER['HTTP_HOST'] != 'www.domain.com.au') header('Location: http://www.domain.com.au' . $_SERVER['REQUEST_URI']);

If we use the cart, the cookies will be stored differently if we don’t use it. So, it will be always storing under domain http://www.domain.com.au. Applied for the client SHE Lights.

Linux – Kill all processes for a user

Magento – how to display a page title and contents from backend


$terms_condtn_title = Mage::getModel('cms/page')->load('terms-and-conditions', 'identifier')->getTitle();
$terms_condtn_content = Mage::getModel('cms/page')->load('terms-and-conditions', 'identifier')->getContent();	
echo $terms_condtn_content;

Add a New system variable in Magento


SQL:

INSERT INTO `amwsales_db`.`core_config_data` (
`config_id` ,
`scope` ,
`scope_id` ,
`path` ,
`value`
)
VALUES (
NULL , 'default', '0', 'design/footer/terms_condtn_txt', 'terms and condition text here'

PHP:

$terms_condtn_txt = Mage::getStoreConfig('design/footer/terms_condtn_txt');

How to getBaseUrl in Magento


When developing in Magento and playing arround with Magento Themes there is some functions you should know.
If you want to get the source url of an image, javascript or file, call one of this functions adding your own path at the end.
Under every function there is an example of the output value:

//http://example.com/
echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
//http://example.com/js/
echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_JS);
//http://example.com/index.php/
echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK);
//http://example.com/media/
echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA);
//http://example.com/skin/
echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN);

Deactivate Magento store using .htaccess temporarily


Here is quick snippet of code that we use all the time when upgrading or moving a Magento store. This will stop people from creating accounts, placing orders, etc… while you are in the middle of heavy database work.
Add this to your .htaccess file in your root directory and only your IP address will be able to view your website. All other visitors will get redirected to an “updating” page.
Add this to your .htaccess file (directly after RewriteEngine On):

RewriteCond %{REMOTE_HOST} !^123.45.67.89
RewriteCond %{REQUEST_URI} !/updating.html$
RewriteRule .*$ /updating.html [R=302,L]

Do not forget to create a file called updating.html and put the message that you want visitors to see while your site is down.

jQuery Cookie Plugins


$.cookie('term_condtn', 'accepted', { expires: 1 });
jQuery.cookie = function(name, value, options) {
    if (typeof value != 'undefined') { // name and value given, set cookie
        options = options || {};
        if (value === null) {
            value = '';
            options.expires = -1;
        }
        var expires = '';
        if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) {
            var date;
            if (typeof options.expires == 'number') {
                date = new Date();
                date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
            } else {
                date = options.expires;
            }
            expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE
        }
        // CAUTION: Needed to parenthesize options.path and options.domain
        // in the following expressions, otherwise they evaluate to undefined
        // in the packed version for some reason...
        var path = options.path ? '; path=' + (options.path) : '';
        var domain = options.domain ? '; domain=' + (options.domain) : '';
        var secure = options.secure ? '; secure' : '';
        document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join('');
    } else { // only name given, get cookie
        var cookieValue = null;
        if (document.cookie && document.cookie != '') {
            var cookies = document.cookie.split(';');
            for (var i = 0; i < cookies.length; i++) {
                var cookie = jQuery.trim(cookies[i]);
                // Does this cookie string begin with the name we want?
                if (cookie.substring(0, name.length + 1) == (name + '=')) {
                    cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
                    break;
                }
            }
        }
        return cookieValue;
    }
};

PHP Mobile Detection Library


Download this ZIP: click MobileESP_Samples.zip

include("mp/php_redirect_sample/code/mdetect.php");
      $iphoneTierHomePage = 'http://m.xyz.com.au/index.php?page=m';
      $genericMobileDeviceHomePage = 'http://m.xyz.com.au/index.php?page=m';
      $desktopHomePage = 'index.php';
      $uagent_obj = new uagent_info();         
      function AutoRedirectToProperHomePage(){
	      global $uagent_obj, $iphoneTierHomePage, $genericMobileDeviceHomePage, $desktopHomePage; 
	      if ($uagent_obj->isTierIphone == $uagent_obj->true) 
          header ('Location: '.$iphoneTierHomePage);          
	      else if ($uagent_obj->DetectMobileQuick() == $uagent_obj->true) 
          header ('Location: '.$genericMobileDeviceHomePage);        
	      else 
          header ('Location: '.$desktopHomePage);
      }  
      AutoRedirectToProperHomePage();

How to user FirePHP


*Install FirePHP FireFox add-ons (get a console like firebug), bottom status console bar in FF
* Copy FirePHP.class.php to the root file location

require("FirePHP.class.php");
$firephp = FirePHP::getInstance(true);
$firephp->log($doc->load($url), 'doc');