Putty Error – Server Unexpectedly Closed Network Connection

Many reasons to show the error “server unexpectedly closed network
connection”. Please check the following things.

1. Are you able to ping the server from client PC?
2. How many attempts have you tried? Some cases system block the user
attempting more then three attempts or whatever settings you
mentioned in configuration file.
3. Is there any firewall settings who block your IP?


Issue with SI CAPTCHA on WooCommerce Registration Form

To supporting SI CAPTCHA on WooCommerce registration form place below code in functions.php

// Let’s try some anti-spam on user registration
add_filter( ‘woocommerce_process_registration_errors’, ‘op_woocommerce_sicaptcha_registration_filter’ );
function op_woocommerce_sicaptcha_registration_filter($errors) {
if (class_exists(‘siCaptcha’)) {
$si_image_captcha = new siCaptcha();
$errors = $si_image_captcha->si_captcha_register_post($errors);

Append button or span jquery click event

Appended buttons or span click events generated by using “document” option.
jQuery(document).on(“click”,”#menu-item-1559 a .link_text”,function() {
jQuery(document).on(“click”,”.active_anc”,function() {

Magento Files and Folders Structure


App directory of magento

“app” directory play very important role in the magento. This directory contains allapplication development related files. app is on the root in the magento directory structure. Word app comes from word application. This directory contains following type of file:

  1. Different configuration files related to magento application like database configuration file, module configuration files etc.
  2. All module of the magento.
  3. Design and theme related files
  4. Language related files

app directory has following 4 sub directories.

  1. code
  2. design
  3. etc
  4. locale

/app/code directory: code directory is the directory for the developer. All magento code is placed in the /app/code directory. code directory has following 3 sub directories.

  1. core
  2. local
  3. community

/app/code/core directory: This directory contains all magento core modules. All magento modules clubbed in Mage namespace.
/app/code/local directory: This directory contains all locally developed module. Locally developed module means if you are customizing any core magento feature by creating any module then you can create your module in /app/code/local module.
/app/code/community directory: This directory contain module installed by magento connect.

/app/design directory: This is directory for the designer. /app/design magento directory contains all design related files of the admin and frontend interface. /app/design directory has following 3 sub directories.

  1. frontend : Contains design file related to fronted of your magento
  2. adminhtml : Contains design file related to admin interface of your magento
  3. install : Contains design file related to magento installer.

/app/etc directory: This directory primarily contains xml files. These xml files contains all configuration related information of your store. Following are some example of the configuration files of your magento store:

  1. /app/etc/local.xml file contains database server information and router information
  2. /app/etc/config.xml file contains all directory related information
  3. /app/etc/modules folder contains all module loading configuration files.

/app/locale directory: This directory contains the language string file. For example if you are running your magento store in 2 language then you need to create locale folder for every language.

So in magento directory structure app folder play very important role. If you want to learn customization of magento then you should be completely aware about the app directory structure of the magento.

Downloader directory

This directory contains files related to magento files downloading. This directory contains file which used to install the extension from magento connect.download directory is place on the root of magento directory structure.

errors directory

This directory contains different error processor and template files. Like 404 error or 503. Usually people do not touch this directory. This directory is paced on the root of magento directory structure.

includes directory

This directory contains some middle ware code file. All model files first parsed and moved into this folder and magento directly loads files from this directory. Once you made any change in your module’s model file then it first parsed and moved into the include folder. This directory is paced on the root of magento directory structure.

js directory

js  directory of the magento contains all core JavaScript library used in the magento fronted and admin area. For example extjs, prototype.js, tiny_mce etc. In next part we will explore all opensource library used by magento.

lib directory

Magento lib directory contains all php library used by magento. Some of the them are created by varien(magento company) and some other opensource library like zend framework, pear,

media directory

This directory contains all media file used in your store. For example all images uploaded in the product and category catalog. This directory also contains dynamic images used in 3rd party module. So all dynamic media files used in the magento is placed in media folder.

skin directory

skin folder is again a folder in magento directory structure in which we store media files. But in skin folder only contains media related to the design of your fronted and admin area. Skin folder contains image, css and JavaScript of all of your theme of the magento. Skin folder has further 3 main sub directory:

  1. skin/frontend: This directory contain css, js and image files of fronted magento themes
  2. skin/adminhtml: This directory contains css,js and images of admin theme of magento.
  3. skin/install: This directory contains media related to magento installer.

var directory

In magento directory structure var directory play important role. Var directory contains mainly temporary files and data. Or in other terms it contains the middleware files generated  by magento like cache, error, log, session and locks. Following are the sub-directory of the var directory:

  1. var/cache: This folder contains all magento middle ware cached data. If you will enable the caching then magento will just onetime loads some variable from XML and store in the serialized variable in a text file in cache directory. It increases the performace of you ecommerce stores.
  2. var/locks : This directory contains the table locking information.
  3. /var/session: If you will store session in the files then magento create a file in var/session directory and store all php session data in specific file of this directory.
  4. var/log: If you will enable the logging of your magento store then log will be store in this directory.

var directory is paced on the root of magento directory structure.

If you want you can slightly change the magento directory structure by using the configuration file of magento. For example you can open app/etc/config.xml and change the path of following directory:

  1. app directory.
  2. media
  3. skin
  4. var

Hope now you have clear understanding of magento directory structure.

HTML tags in Textarea

<form action=”” name=”myForm” method=”post”>
[&nbsp;<span class=”intLink” onclick=”insertMetachars(‘&lt;strong&gt;’,’&lt;\/strong&gt;’);”><strong>B</strong></span> | <span class=”intLink” onclick=”insertMetachars(‘&lt;em&gt;’,’&lt;\/em&gt;’);”><em>I</em></span> | <span class=”intLink” onclick=”var newURL=prompt(‘Enter the full URL for the link’);if(newURL){insertMetachars(‘&lt;a href=\u0022’+newURL+’\u0022&gt;’,’&lt;\/a&gt;’);}else{document.myForm.new_subspecify.focus();}”>URL</span>]<br>
<input type=”text” id=”doct_specialty” value=”” name=”new_subspecify”><br>
<input type=”submit” value=”Save” id=”butt_specialty” name=”hosp_services”>
function insertMetachars(sStartTag, sEndTag) {
var bDouble = arguments.length > 1, oMsgInput = document.myForm.new_subspecify, nSelStart = oMsgInput.selectionStart, nSelEnd = oMsgInput.selectionEnd, sOldText = oMsgInput.value;
oMsgInput.value = sOldText.substring(0, nSelStart) + (bDouble ? sStartTag + sOldText.substring(nSelStart, nSelEnd) + sEndTag : sStartTag) + sOldText.substring(nSelEnd);
oMsgInput.setSelectionRange(bDouble || nSelStart === nSelEnd ? nSelStart + sStartTag.length : nSelStart, (bDouble ? nSelEnd : nSelStart) + sStartTag.length);

Reduce window size using jQuery

      var height = $(this).height() - $("#header").height() + $("#footer").height() - 35
      $('#content2').css('marginTop', height); // <-- set here

Find Latitude, Longitude based on address

function getCoordinates($address){

$address = str_replace(” “, “+”, $address); // replace all the white space with “+” sign to match with google search pattern

$url = “http://maps.google.com/maps/api/geocode/json?sensor=false&address=$address“;

$response = file_get_contents($url);

$json = json_decode($response,TRUE); //generate array object from the response from the web

return ($json[‘results’][0][‘geometry’][‘location’][‘lat’].”,”.$json[‘results’][0][‘geometry’][‘location’][‘lng’]);

Split function in jQuery


var href = window.location;


var urlsplit = href.split(“/”);

var username = urlsplit[2];


jQuery(‘#commentform p img’).attr(‘src’, urlsplit);