Monthly Archives: September 2014

MySQL LOAD DATA INFILE Syntax for Importing from CSV file.

The LOAD DATA INFILE statement reads rows from a text file into a table at a very high speed. LOAD DATA INFILE is the complement of SELECT … INTO OUTFILE. To write data from a table to a file, use SELECT … INTO OUTFILE. To read the file back into a table, use LOAD DATA INFILE. The syntax of the FIELDS and LINES clauses is the same for both statements. Both clauses are optional, but FIELDS must precede LINES if both are specified.


For a sucessful operation, The fields count in the CSV file should match with the column count of the table. Otherwise your operation result will be Invalid/Erroneous. Also path to the CSV file should be correctly specified.

Difference between ‘$(this)’ and ‘this’ keyword selector when using in jQuery

Hey there,

‘this’ and ‘$(this)’ in jQuery refers to the same element. The only difference is the way they are used. ‘this’ is used in traditional sense, when ‘this’ is wrapped in ‘$()’ then it becomes a jQuery object and you are able to use the power of jQuery.

$(this) Example:

this Example:

In the above example, this is an object but since it is not wrapped in $(), we can’t use jQuery method and use the native JavaScript this keyword to get the value of span element.

Load jQuery library from Microsoft, Google, CDNs

Hey there,

There are Mainly 3 popular jQuery CDNs.

1. Google.
2. Microsoft

The Main Advantages of using CDN.

  1.  It reduces the load from your server.
  2.  It saves bandwidth. jQuery framework will load faster from these CDN.
  3.  The most important benefit is it will be cached, if the user has visited any site which is using jQuery framework from any of these CDN

load jQuery from CDN

Code to load jQuery library from Google CDN

Code to load jQuery library from Microsoft CDN

Code to load jQuery library from (EdgeCast CDN)

 load jQuery locally when CDN fails

It is a good approach to always use CDN but sometimes what if the CDN is down (rare possibility though). Below given jQuery code checks whether jQuery is loaded from Google CDN or not, if not then it references the jQuery.js file from your folder.

It first loads the jQuery from Google CDN and then checks the jQuery object. If jQuery is not loaded successfully then it will references the jQuery.js file from hard drive location. In the above code, the jQuery.js is loaded from Scripts folder.