Getting client ip address in PHP

$_SERVER is an array containing information such as  headers, paths, and script locations.The entries in this array are created by the web server

Setting Up MongoDB with PHP and MAMP

If you haven’t already installed mongodb in your system:

Then, to install latest Mongodb driver using PECL:

  • Install autoconf using homebrew or Mac Ports:

  •   Download latest stable PHP  source from php.net.
  •  Create  phpx.x.x/include/ (example: php5.5.10)  folder in

  • Rename uncompressed php source folder from php-x.x.x to php and paste it in this folder

  •   Using the terminal open php folder and run ./configur

 

  • Add MAMP bin to your ~/.bash_profile

  •  Install latest mongo

  • Edit php.ini

  •   Restart MAMP server  :)

How to get, set and select elements with data attributes ?

Using jquery,

In plain Javascript,

 

Hide index.php in the url, Yii

  • Add an .htaccess file to your webroot ( project directory) eg. /var/www/yourproject/.htacess
  • Open that .htaccess file and add the following text there

  • In /protected/config/main.php at component , set:

 

 

Including js and css files in Yii

Including core js files

Including other js and css files

 

javaScript window navigator

The window.navigator object contains information about the visitor’s browser.

The window.navigator object can be written without the window prefix.

 

Some of its properties are tabulated below…

Name
Description
Version
appCodeName
Specifies the code name of the browser.
Implemented in JavaScript 1.0
appName
Specifies the name of the browser.
Implemented in JavaScript 1.0
appVersion
Specifies version information for the Navigator.
Implemented in JavaScript 1.0
language
Indicates the translation of the Navigator being used.
Implemented in JavaScript 1.2
mimeTypes
An array of all MIME types supported by the client.
Implemented in JavaScript 1.1
platform
Indicates the machine type for which the Navigator was compiled.
Implemented in JavaScript 1.2
plugins
An array of all plug-ins currently installed on the client.
Implemented in JavaScript 1.1
userAgent
Specifies the user-agent header.
Implemented in JavaScript 1.0

 

 

Warning !!!

The information from the navigator object can often be misleading, and should not be used to detect browser versions because:

  • The navigator data can be changed by the browser owner
  • Some browsers misidentify themselves to bypass site tests
  • Browsers cannot report new operating systems, released later than the browser

Differences between javaScript setTimeout and setInterval

The important difference is that, whereas setTimeout() triggers expression only once after the timeout , setInterval() keeps triggering expression again and again in intervals (unless you tell it to stop).