Javascript Lazy loading

var scriptTag = document.createElement(‘script’);
scriptTag.src = ‘https://www.dropbox.com/static/api/2/dropins.js’; // set the src attribute
scriptTag.type = ‘text/javascript’; // if you have an HTML5 website you may want to comment this line out
scriptTag.async = true; // the HTML5 async attribute
scriptTag.id = ‘dropboxjs’; // the HTML5 Id
scriptTag.setAttribute(‘data-app-key’, ‘dropbox-key’) // Set Dropbox API key
var headTag = document.getElementsByTagName(‘head’)[0];
headTag.appendChild(scriptTag);

Find distance between two points on earth

MySQL Function

delimiter //

CREATE FUNCTION `distance`(`lat_1` DOUBLE, `lon_1` DOUBLE, `lat_2` DOUBLE, `lon_2` DOUBLE, `unit` CHAR(2))
RETURNS double
COMMENT ”
BEGIN

DECLARE PI FLOAT DEFAULT 3.14/180;
DECLARE ret_dist DOUBLE;
SET ret_dist = ACOS(SIN( lat_1 * PI) * SIN(lat_2 * PI) + COS( lat_1 * PI) * COS(lat_2 * PI) * COS(( lon_1 – lon_2 ) * PI)) / PI * 60 * 1.1515;
IF unit = ‘MI’ THEN
SET ret_dist = ret_dist;
ELSEIF unit = ‘KM’ THEN
SET ret_dist = ret_dist * 1.609344 ;
ELSEIF unit = ‘ME’ THEN
SET ret_dist = ret_dist * 1.609344 * 1000;
END IF;

RETURN ret_dist;

END
//

delimiter ;

PHP Code:

What is difference b/w Functional Oriented and Object Oriented Desgin?

First we must have to know how many things involved in program

1) Data (Which stores state of program, usually variables)

2) Function(Which process on data)

If we are not getting desired result/output in our system this could be happen due to two possibilities 

1) Algorithm problem

2) Problem in data

If we have logical problem then we know in which function we have to change but if problem in our data we don’t know which functions will be effected if we changed.

In Functional Oriented.

  1. Function knows which data I am using but data does not know which functions are using me(data)
  2. Functions and data are not combine together
  3. So data is globalized (not localized)

While in Object Oriented (OO)

  1. Function(method) knows which data I am using and data also know which functions are using me(data). In OO data is localized to this class.
  2. Functions and  data combine together
  3. So data is localized(not globalized)

Q) Why we prefer Object Oriented Over Functional Oriented?

In OO our maintenance is very easy due to data localization in a class.

Mostly 2/3 time is spend in software maintenance.

 

Outdoor Advertising Assets

Overview

OAA is an online marketplace designed to offer convenience for players engaged in the “out-of-home” (OOH) media and advertising industry.

It has been developed as an online hub that enables better communication between the OOH media owners (sellers) and advertisers (buyers), bringing them closer than ever before.

Tools/Techonologies

  • Zend Framework 2 and MySQL
  • dojo

Link/ URL

http://oaa.com.pk/

PHP Interview questions

  1. How would you find out if a string contains another string in PHP?
  2. Find time taken by any loop?
  3. What is associative array?
  4. What is cURL and why we use cURL?
  5. Is it possible to draw image? if yes than how?
    <img src=”image.php”>
  6. Count number of words in paragraph
  7. Count speciifc number of word in paragraph
  8. How to make global variable?
  9. Upload data is not uploading due to maxsize, tell these factors?
  10. How would you find out if a string contains another string in PHP?
  11. which oop concept is not in PHP?
  12. Print your name with out using loop?
  13. Diff b/w require and include?
  14. Diff b/w unlink and unset?
  15. What is the result of following statements$a = 5; // answer
    echo $a; 5
    echo “result is $a”; result is 5
    echo ‘result is $a’;