PHP – HTML5
PHP
Starting with PHP 5, the object model was rewritten to allow for better performance and more features. This was a major change from PHP 4. PHP 5 has a full object model.
features in PHP 5 are the inclusions of visibility, abstract and final classes and methods, additional magic methods, interfaces, cloning and typehinting.
PHP treats objects in the same way as references or handles, meaning that each variable contains an object reference rather than a copy of the entire object. See Objects and References
Features
Visibility : The visibility of a property or method can be defined by prefixing the declaration with the keywords public, protected or private.
HTML
How do you improve the performance of a website.
- code unification :Each CSS file must be loaded before the page can be displayed in an internet browser.
- compress css and javascript files:We can compress a CSS file by removing unnecessary spaces, comments,
- Using sprite images instead of multiple images
- Always put javascripts at the bottom of the page.
What is bootstrap ?
Bootstrap is CSS framework for developing responsive, mobile first projects on the web. Current version of bootstrap is v3.3.6. Bootstrap also comes with two preprocessors: less and saas.
Bootstrap uses 12 column grid system. Bootstrap’s grid system is responsive, and the columns will re-arrange depending on the screen size
What new features has been added in bootstrap 3?
- New Glyphicons icon font!
- Smallest file size.
- New grid system.
- its uses CSS compressors (Less/Saas)
Difference between container and container-fluid in bootstrap?
.container has a max width pixel value, whereas .container-fluid is max-width 100%.
.container-fluid continuously resizes as you change the width of your window/browser by any amount.
.container resizes in chunks at several certain widths, controlled by media queries (technically we can say it’s “fixed width”
because pixels values are specified, but if you stop there, people may get the
impression that it can’t change size – i.e. not responsive.)
Tell me latest jquery version ?
Latest version of jquery is V-3.1.0 (11-8-2016)
Difference between html5 tag and normal tag ?
HTML5 tag are called as semantic tags.
A semantic element clearly describes its meaning to both the browser and the developer.
<article>
<aside>
<details>
<figcaption>
<figure>
<footer>
<header>
<main>
<mark>
<nav>
<section>
<summary>
<time>
Difference between live and bind function in jquery.
The bind() method attaches one or more event handlers for selected elements, and specifies a function to run when the event occurs.
The live() method was deprecated in jQuery version 1.7, and removed in version 1.9. Use the on() method instead.
Some new fautures of css3?
- border-radius (border-radius: 25px;)
- box-shadow (box-shadow:3px 3px 3px 2px #797979;)
- Text Shadow ( text-shadow: #aaa 2px 2px 2px;)
- Multiple Backgrounds
.container {
/* fallback */
background: url(image/bg1.png) no-repeat;
/* modern browsers */
background: url(image/bg1.png) 0 0 no-repeat,
url(image/bg2.png) 100% 0 no-repeat;
}
- Transition
We can add animation to an element using transition. We need to specify these parameters.
- transition-property
- transition-duration
- transition-timing-function
- transition-delay
div {
width: 150px;
height: 150px;
background: red;
/* For Safari 3.1 to 6.0 */
-webkit-transition-property: height;
-webkit-transition-duration: 2s;
-webkit-transition-timing-function: ease-in-out;
-webkit-transition-delay: 1s;
/* Standard syntax */
transition-property: height;
transition-duration: 2s;
transition-timing-function: linear;
transition-delay: 1s;
}
what is closest in jquery ? What’s the difference between .closest() and .parents(‘selector’)?
.closest() method begins its search with the element itself before progressing up the DOM tree, and stops when current element matches the selector.
.parents() Begins with the parent element, get the parent of each element in the current set of matched elements
What is json?
JSON stands for JavaScript Object Notation. JSON is language independent, lightweight data interchange format. JSON data is written as key value pairs.
Eg :”name”:”Selva”
Explain position property in css?
The CSS positioning properties allow you to position an element. There are four different positioning methods: Static, Fixed, relative, absolute.
Difference between $(this) and this in jquery?
Keyword ‘this’ is a native DOM element. $(this) is a jQuery object that allows you to call functions such as .addClass() on it.
Will HTML5 canvas supported in IE ?
HTML5 canvas is not supported in IE version less than 9. ExplorerCanvas(excanvas) a JS library is the option to render HTML5 canvas for IE6, 7, and 8.
what is jsonp?
JSONP is nothing but JSON with padding. JSONP is mostly used in RESTFull APIs(Cross domain request). JSONP is a simple trick to overcome XMLHttpRequest same domain policy. (As you know one cannot send AJAX (XMLHttpRequest) request to a different domain.). JSONP request appends the callback function with URL. Eg: http://www.abcs.com/example.php?callback=simplecallback
Whenever the server receives the callback it will return the data. The data can be accessed using that call back function.
A simple implementation of JSONP request.
//
(function() {
var flickerAPI = “http://api.flickr.com/services/feeds/photos_public.gne?jsoncallback=?”;
$.getJSON( flickerAPI, {
tags: “mount rainier”,
tagmode: “any”,
format: “json”
})
.done(function( data ) {
$.each( data.items, function( i, item ) {
$( “” ).attr( “src“, item.media.m ).appendTo( “#images” );
if ( i === 3 ) {
return false;
}
});
});
})();
// ]]>
How do you create a simple plugin in jquery?
Sample plugin creation code is given below:
(function($){
$.fn.showLinkLocation = function() {
return this.filter(‘a’).each(function(){
$(this).append(
‘ (‘ + $(this).attr(‘href’) + ‘)’
);
});
};
}(jQuery));
// Usage example:
$(‘a’).showLinkLocation();
List out some CSS Frameworks for creating responsive templates?
Bootstrap
-> Bootstrap is mobile first framework. It includes predefined classes for easy layout options, as well as powerful mixins for generating more semantic layouts.
Foundation 3
-> Foundation 3 is built with Sass, a powerful CSS preprocessor. “Pricing Tables” is an interesting componenet in foundation 3. Pricing tables are suitable for marketing site for a subscription-based product. It also offers super cool features like Right-to-left text direction support.
Skeleton
Skeleton is a small collection of CSS files that can help to rapidly develop sites that look beautiful at any size, be it a 17″ laptop screen or an iPhone.
YAML 4
YAML 4 is built on SAAS. You can check the documentation in the above link.
ResponsiveAeon
Responsive Aeon is a simple, fast, Intuitive css framework. It contains almost 120 lines of code and only 1kb minified.
What is the difference between canvas and svg?
<canvas> is an HTML element which can be used to draw graphics using JavaScript. This can be used to draw graphs, create animations etc.
The <canvas> element is not supported in older browsers, but is supported in recent versions of all major browsers.
The default size of the canvas is 300 px × 150 px (width × height). But custom sizes can be defined using the HTML height and width property. The declaration is as follows.
<canvas id=”animate” width=”250″ height=”250″></canvas>
SVG stands for Scalable Vector Graphics (SVG) is based on XML markup language, for describing 2D vector graphics.
Can you explain the difference between cookies, sessionStorage and localStorage.?
LocalStorage stores data with no expiration date, and gets cleared only through JavaScript, or clearing the Browser Cache / Locally Stored Data – unlike cookie expiry.
Local storage and session storage are perfect for non sensitive data. The data stored in localStorage and sessionStorage can easily be read or changed from within the client/browser
so should not be relied upon for storage of sensitive or security related data within applications.
Data stored in the SessionStorage is only available for the duration of the browser session (and is deleted when the window is closed) – it does however survive page reloads.
In cookie, we can store 4096 bytes of data. Data stored in the cookie can be hacked by the user, unless the site uses SSL. We can also prevent injections like Cross-Site Scripting (XSS)/Script injection using httponly in the header.
Explain about quirks mode?
There are three modes used by the layout engines in web browsers: quirks mode, almost standards mode, and full standards mode.
Quirks mode is turned on when there is no correct DOCTYPE declaration, and turned off when there is a DOCTYPE definition.
However, invalid HTML – with respect to the chosen DOCTYPE – can also cause the browser to switch to quirks mode.
What is meant by hardware acceleration?
It means the graphical rendering is done on dedicated hardware (your GPU / graphics card) rather than your CPU. Hardware acceleration generally produces more fluid animation.In general you should always enable hardware acceleration as it will result in better performance of your application.
This will usually be a higher frame rate (the number of images displayed per second), and the higher the frame rate, the smoother the animation.
How can you load css resources conditionally?
Using CSS media querises we can load CSS contidionally. If you want to load the stylesheet for the device less than 600px, then you can declare as below.
<link rel=”stylesheet” media=”screen and (min-width: 600px)” href=”small.css”>
This style sheet will only load for screen size less than 600px.
Difference between article and section tag in HTML5. How can you nest them in your document?
The section element represents a generic section of a document or application. A section, in this context, is a thematic grouping of content, typically with a heading.
So basically the section element should contain related information bunched under a common heading.
The HTML5 <article> element represents a complete composition in a web page or web application that is independently distributable or reusable, e.g. in syndication.
This could be a forum post, a magazine or newspaper article, a blog entry, a user-submitted comment, an interactive widget or gadget, or any other independent item of content.
We can nest article inside a section tag and vice versa. This is completely legal interms of HTML5.
What happen when you dont use doctype?
When omitted, browsers tend to use a different rendering mode that is incompatible with some specifications.
Also HTML5 tags such as < article >,< footer >, < header >, < nav >, < section > may not be supported if the Doctype is not declared.
What are data- attributes good for?
The data-* attributes is used to store custom data related to the page or application.The custom data can be used in JavaScript to complete events or animations.
Which set of definitions, HTML attributes or CSS properties, take precedence?
CSS properties take precedence over HTML attributes. If both are specified, HTML attributes will be displayed in browsers without CSS support but won’t have any effect in browsers with CSS support.
How do I eliminate the blue border around linked images?
in your CSS, you can specify the border property for linked images:
a img { border: none ; }
However, note that removing the border that indicates an image is a link makes it harder for users to distinguish quickly and easily which images on a web page are clickable.
Explain about HTML5 local storage ?
There are two ways to store data in HTML as objects locally :
- localStorage – store data across session acess
- sessionStorage – storing data for current session only
Data will be stored in key/value pair format.
example:
localStorage.empid=”420″;
sessionStorage.companyname = “Thiruvarur info tech ”;
explain CSS media queries ?
CSS media queries are used to develop responsive templates for different layout of screen, print, mobile , tablet or any other resolutions
CSS media queries can be added in 3 ways as like CSS style sheet :
Internal stylesheet : <style type=”text/css”>
@media only screen and (max-width: 600px){
/* rules apply to the device resolution is 480px or less */
}
</style>
Imported stylesheet : @import “tablet.css” (min-width: 800px) and (max-width: 1200px);
External stylesheet: <link rel=”stylesheet” type=”text/css” href=”deskto.css” media=”screen and (min-width: 1200px), print and (min-resolution: 300dpi)” />
explain css inheritance ?
Inheritance propagates property values from parent elements to their children. The inherited value of a property on an element is the computed value of the property on the element’s parent element. For the root element, which has no parent element, the inherited value is the initial value of the property.
<div class=”firstClass secondClass thirdClass fourthClass ” > </div >
what is javascript inheritance ?
In simple terms, inheritance is the concept of one thing gaining the properties or behaviours of something else.
Inherited children inherit their parent’s behaviour To say A inherits from B, is saying that A is a type of B.
In JavaScript You must use a special object called prototype.
function Animal() {}; // This is the Animal *Type*
Animal.prototype.eat = function () {
alert(“All animals can eat!”);
};
function Bird() {}; // Declaring a Bird *Type*
Bird.prototype = new Animal(); // Birds inherit from Animal
Bird.prototype.fly = function() {
alert(“Birds are special, they can fly!”);
};
The effect of this is that any Birds you create (called an instance of Bird) all have the properties of Animals
var aBird = new Bird(); // Create an instance of the Bird Type
aBird.eat(); // It should alert, so the inheritance worked
aBird.fly(); // Important part of inheritance, Bird is also different to Animal
var anAnimal = new Animal(); // Let’s check an instance of Animal now
anAnimal.eat(); // Alerts, no problem here
anAnimal.fly(); // Error will occur, since only Birds have fly() in its prototype
explain javascript associative array ?
Associative arrays are where we can associate a key string with a value string
JavaScript objects are also associative arrays.
i.e the property emp.Name can also be read by calling emp[‘Name’]
We can access each property by entering the name of the property as a string into the array
it refers to accessing the DOM elements of HTML also [as object or associative array]
explain JS Namespace ?
Namespacing is a technique employed to avoid collisions with other objects or variables in the global namespace
and also helps to organize blocks of functionality into easily manageable groups that can be uniquely identified.
JavaScript doesn’t builtin support of namespacing but using objects and closures we can achieve a similar effect.
javascript Namespacing patterns :
1) Single global variables :
var myApplication = (function(){
function(){
/*…*/
},
return{
/*…*/
}
})();
2) Object literal notation :
var myApplication = {
getInfo:function(){ /**/ },
// we can also populate our object literal to support
// further object literal namespaces containing anything
// really:
models : {},
views : {
pages : {}
},
collections : {}
};
3) Nested namespacing :
var myApp = myApp || {};
// perform a similar existence check when defining nested
// children
myApp.routers = myApp.routers || {};
myApp.model = myApp.model || {};
myApp.model.special = myApp.model.special || {};
// nested namespaces can be as complex as required
4) Immediately-invoked Function Expressions :
// an (anonymous) immediately-invoked function expression
(function(){ /*…*/})();
// a named immediately-invoked function expression
(function foobar(){ /*..*/}());
// this is technically a self-executing function which is quite different
function foobar(){ foobar(); }
5) Namespace injection :
// define a namespace we can use later
var ns = ns || {}, ns2 = ns2 || {};
// the module/namespace creator
var creator = function(val){
var val = val || 0;
this.next = function(){
return val++
};
this.reset = function(){
val = 0;
}
}
creator.call(ns);
// ns.next, ns.reset now exist
creator.call(ns2, 5000);
// ns2 contains the same methods
// but has an overridden value for val
// of 5000
Type of webservice ?
there are two types of web service….1. SOAP [Simple Object Access Protocol] Webservice and 2. RESTful [REpresentational State Transfer] Webservice.
SOAP is a messaging protocol , REST is a design philosophy , not a protocol.
SOAP:
you define your interface in a .wsdl file, which describes exactly which input parameters are expected and how the return values will look like
there are tools to generate the .wsdl files out of java class hirarchies. JAXB for example
there are also tools to generate java objects/classes as part of eclipse for example (don’t know the name in the moment).
SOAP is very strict. Every request is validatet against the wsdl before processing.
A good but not so easy to start with framework for SOAP WS is Apache CXF
REST: (no hands on experience up to now, feel free to correct and improve 😉 ):
a way to access a webserver or web application to retrieve data from or send to it.
it’s only negotiated, how it is accessed.
common is something like this http://server.domain.com/app/type/id=123 to retrieve object of type type with id=123 very intuitive, but no automatic validation of requests.
The main advantages of REST web services are:
- Lightweight – not a lot of extra xml markup
- Human Readable Results
- Easy to build – no toolkits required
SOAP also has some advantages:
- Easy to consume – sometimes
- Rigid – type checking, adheres to a contract
- Development tools
What is namespacing?
In many programming languages, namespacing is a technique employed to avoid collisions with other objects or variables in the global namespace. They’re also extremely useful for helping organize blocks of functionality in your application into easily manageable groups that can be uniquely identified.Namespacing Fundamentals
- Single global variables
- Object literal notation
- Nested namespacing
- Immediately-invoked Function Expressions
- Namespace injection
Single global variables
One popular pattern for namespacing in JavaScript is opting for a single global variable as your primary object of reference. A skeleton implementation of this where we return an object with functions and properties can be found below:
var myApplication = (function(){
function(){
/*…*/
},
return{
/*…*/
}
})();
Object literal notation
Object literal notation can be thought of as an object containing a collection of key:value pairs with a colon separating each pair of keys and values. It’s syntax requires a comma to be used after each key:value pair with the exception of the last item in your object, similar to a normal array.
var myApplication = {
getInfo:function(){ /**/ },
// we can also populate our object literal to support
// further object literal namespaces containing anything
// really:
models : {},
views : {
pages : {}
},
collections : {}
};
One can also opt for adding properties directly to the namespace:
myApplication.foo = function(){
return “bar”;
}
myApplication.utils = {
toString:function(){
/*..*/
},
export: function(){
/*..*/
}
}
- Nested namespacing
- Immediately-invoked Function Expressions (IIFE)s
- Namespace injection
- Explain about css specificity
- what is the use of box shadow and tell me the syntax.
- how to acheive rounded corners in css3.
- How will you improve the performance of a website.
- What is the use of sprite images.
- What are the different font formats and how will you include in your css stylesheet.
- What is responsive web page layout.
- What is fluid layout and advantages of it ?
- What do you know about css animations. Will you do css3 animation if we give google access?
- what are the css frameworks you know. have you ever used any css frameworks like LESS SAAS?
- Difference between HTML4 and HTML5?
- What is the use of canvas ? have you ever used it.
- What is the main difference between canvas and svg?
- What are semantic tags in html5. What is the main advantage of it.
- How will you add a jquery to your page.
- What is the diiference between javascript and jquery?
- Tell me the difference between document.ready and onload function in jquery?
- how can u apply css in jquery?
- Can you dynamicaaly add a div using jquery ?
- What are filters in jquery?
- What is an anonymous function in jquery and how will you define it?
- Have you ever heared about MVC in javascript?
- Javascript or Jquery which is faster ?
- How can you animate using Jquery?
- Tell me the use of is() , eq() methods in jquery?
- Why we use index() method in jquery.
- Tell me jquery.noConflict() method.
- Have you ever contributed any plugin?
- Tell me what are the Jquery UI you know. And how can you customize them.?
Google Introduces Search Engine Apps : Springboard
Springboard is designed and marketed towards business and enterprise users of Google’s productivity apps — particularly those that have to regularly sort and search through large numbers of documents and files.
Within the same announcement Google also announce a significant upgrade to Google Sites, which is a tool designed by the company for creating web pages. The update will allow users to easily pull in information from other Google apps, and features all fully responsive designs for all of its layouts.
Both Springboard and the upgrade to Sites are currently being tested amongst a select group of users in Google’s early adopter program. If you’re interested in getting an early look at Springboard you can sign up here. An official public release date was not mentioned in the announcement.
Get line number of the code
<!--?
class myTest
{
function addMyAddress($street)
{
echo "
In class function at:".__LINE__;
echo "
class function called from:";
$e = new Exception();
$trace = $e->getTrace();
echo '
';print_r($trace);
// OR print_r(debug_backtrace());
}
}
echo "
Class created at:".__LINE__; $obj = new myTest();
echo "
Function called at:".__LINE__; $obj->addMyAddress('A/13 Skyline');
?>
Get any Website Page Title From URL in PHP
Hey guys,here below describe the how to get the page title form any website page using URL. Here for getting the page title we are using the file_get_contents function.This one also achieve using fopen( ) but in some servers disabled this function now a days due to some security reasons.
Here below shows the PHP code to get the page title form the URL.
<!--?php
function pageTitle($page_url)
{
$read_page=file_get_contents($page_url);
preg_match("/<title.*?>[\n\r\s]*(.*)[\n\r\s]*<\/title>/", $read_page, $page_title);
if (isset($page_title[1]))
{
if ($page_title[1] == '')
{
return $page_url;
}
$page_title = $page_title[1];
return trim($page_title);
}
else
{
return $page_url;
}
}
?>
Jquery Timeago Implementation with PHP.
Nowadays timeago is the most important functionality in social networking sites, it helps to updating timestamps automatically. Recent days I received few requests from 9lessons readers that asked me how to implement timeago plugin with dynamic loading live data using PHP. In this post I am just presenting a simple tip to implement timeago in a better way.
Why Live Query
LiveQuery utilizes the power of jQuery selectors by binding events or firing callbacks for matched elements auto-magically, even after the page has been loaded and the DOM updated.
Code
Contains javascipt code. $(this).timeago()- here this element is refers to timeagoclass selector of the anchor tag.
// <![CDATA[
javascript” src=”js/jquery.min.js”>
// ]]>
// <![CDATA[
javascript” src=”js/jquery.livequery.js”>
// ]]>
// <![CDATA[
javascript” src=”js/jquery.timeago.js”>
// ]]>
<script type=”text/javascript”>
$(document).ready(function(){
$(“.timeago”).livequery(function() // LiveQuery
{
$(this).timeago(); // Calling Timeago Funtion
});
});
</script>//HTML & PHP Code
<!–?php
$time=time(); // Current timestamp eg: 1371612613
$mtime=date(“c”, $time); // Converts to date formate 2013-06-19T03:30:13+00:00
?>You opened this page <a href=’#’ class=’timeago’ title=”<!–?php echo$mtime; ?>“></a>
Login with Facebook using PHP SDK in CakePHP
Here we used PHP SDK 3.0 and CakePHP 2.X for the process of authentication and authorizing users for your app.
For Creating an App, which you can obtain from the App Dashboard.
You need App Id and App Secret for integration of the facebook login in cakephp.
In this CakePHP module we included the Facebook PHP SDK 3.0 in vendors of the app directory.And we define Some variables in Core.php
And We create one file which is facebook.php in config folder for the define of AppId and Appsecret.
$config
=
array
(
'Facebook'
=>
array
(
'appId'
=>
'YOUR APP ID'
,
'secret'
=>
'YOUR APP SECRET'
,
)
);
We create one Controller which is FacebookCpsController.php
<?php
App::uses(
'Controller'
,
'Controller'
);
App::import(
'Vendor'
,
'Facebook'
,
array
(
'file'
=>
'Facebook'
.DS.
'facebook.php'
));
class
FacebookCpsController
extends
AppController {
public
$name
=
'FacebookCps'
;
public
$uses
=
array
();
public
function
index(){
$this
->layout=false;
}
function
login()
{
Configure::load(
'facebook'
);
$appId
=Configure::read(
'Facebook.appId'
);
$app_secret
=Configure::read(
'Facebook.secret'
);
=
new
Facebook(
array
(
'appId'
=>
$appId
,
'secret'
=>
$app_secret
,
));
$loginUrl
=
->getLoginUrl(
array
(
'scope'
=>
'email,read_stream, publish_stream, user_birthday, user_location, user_work_history, user_hometown, user_photos'
,
'redirect_uri'
=> BASE_URL.
'facebook_cps/facebook_connect'
,
'display'
=>
'popup'
));
$this
->redirect(
$loginUrl
);
}
function
facebook_connect()
{
Configure::load(
'facebook'
);
$appId
=Configure::read(
'Facebook.appId'
);
$app_secret
=Configure::read(
'Facebook.secret'
);
=
new
Facebook(
array
(
'appId'
=>
$appId
,
'secret'
=>
$app_secret
,
));
$user
=
->getUser();
if
(
$user
){
try
{
$user_profile
=
->api(
'/me'
);
$params
=
array
(
'next'
=> BASE_URL.
'facebook_cps/facebook_logout'
);
$logout
=
->getLogoutUrl(
$params
);
$this
->Session->write(
'logout'
,
$logout
);
}
catch
(FacebookApiException
$e
){
error_log
(
$e
);
$user
= NULL;
}
}
else
{
$this
->Session->setFlash(
'Sorry.Please try again'
,
'default'
,
array
(
'class'
=>
'msg_req'
));
$this
->redirect(
array
(
'action'
=>
'index'
));
}
}
function
facebook_logout(){
$this
->Session->
delete
(
'User'
);
$this
->Session->
delete
(
'logout'
);
$this
->redirect(
array
(
'action'
=>
'index'
));
}
}
?>
Here We create two view files for the FacebookCpsController which are located in app/View/FacebookCps directory.
index.ctp
<!--DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
>
<head>
<meta http-equiv=
"Content-Type"
content=
"text/html; charset=utf-8"
/>
<title>Login with Facebook In CakePHP</title>
<?php
echo
$this
->Html->script(
'oauthpopup'
); ?>
<script type=
"text/javascript"
>
$(document).ready(
function
(){
$(
'#facebook'
).click(
function
(e){
$.oauthpopup({
path:
'facebook_cps/login'
,
width:600,
height:300,
callback:
function
(){
window.location.reload();
}
});
e.preventDefault();
});
});
</script>
</head>
<body>
<?php
$ses_user
=
$this
->Session->read(
'User'
);
$logout
=
$this
->Session->read(
'logout'
);
if
(!
$this
->Session->check(
'User'
) &&
empty
(
$ses_user
)) {
echo
$this
->Html->image(
'facebook.png'
,
array
(
'id'
=>
'facebook'
,
'style'
=>
'cursor:pointer;float:left;margin-left:550px;'
));
}
else
{
echo
'<img src="https://graph.facebook.com/'
.
$ses_user
[
'id'
] .
'/picture" width="30" height="30"/><div>'
.
$ses_user
[
'name'
].
'</div>'
;
echo
'<a href="'
.
$logout
.
'">Logout</a>'
;
}
?>
</body>
</html>
facebook_connect.ctp
<script type=
"text/javascript"
>
window.close();
</script>
Here I used one jquery plugin oauthpopup.jswhich is used for popup
(this file is located in app/webroot/js directory)
oauthpopup.js
(function (jQuery) {
jQuery.oauthpopup = function (options) {
options.windowName = options.windowName || ‘ConnectWithOAuth’;
options.windowOptions = options.windowOptions || ‘location=0,status=0,width=’+options.width+’,height=’+options.height+’,scrollbars=1′;
options.callback = options.callback || function () {
window.location.reload();
};
var that = this;
that._oauthWindow = window.open(options.path, options.windowName, options.windowOptions);
that._oauthInterval = window.setInterval(function () {
if (that._oauthWindow.closed) {
window.clearInterval(that._oauthInterval);
options.callback();
}
}, 1000);
};
})(jQuery);
In the PHP SDK 3.0,we change the facebook.php file.For the Session We uses the CakePHP core data source which is CakeSession. facebook.php file is located at app/Vendor/Facebook directory
facebook.php
//included this line the above class
App::uses(
'CakeSession'
,
'Model/Datasource'
);
public
function
__construct(
$config
) {
if
(!session_id()) {
//insted of session_start() we used CakeSession::start()
CakeSession::start();
}
parent::__construct(
$config
);
if
(!
empty
(
$config
[
'sharedSession'
])) {
$this
->initSharedSession();
}
}
Step-by-Step guide to Facebook Conversion Tracking
Step 1: Once you log in to your ‘Ads Manager’ tab, click on the Conversion Tracking button on the left side bar.
Step 2: Then click on the ‘Create Conversion Pixel’ tab to begin the process.
Step 3: You will be directed to this pop-up, which will ask you for a:
1. Name: An appropriate name will help you remember what you are tracking. (Example: Lead Generation – GATE Ad)
2. Category: This will help you decide the type of action that you want to track on your site. You can choose from the following:
1. Checkouts
2. Registrations
3. Leads
4. Key Page Views
5. Adds to Cart
6. Other Website Conversions
(For the purpose of this example, we have selected ‘Leads’).
Step 4: You will be able to see a pop-up window with a JavaScript code. This is the code that you will have to add to the page where the conversion will happen. This will let you track the conversions back to ads which you are running on Facebook.
The code should be placed on the page that a user will finally see when the transaction is complete.
Here is the tricky part. The code should not go on all pages. For that matter, it should not even go to the landing page of your product. The code should be placed on the page that a user will finally see when the transaction is complete.
For Example: If you want to track when students register for your GATE coaching, paste the code on the registration confirmation page/thank you page and not on the form that they need to submit.
How do you confirm that your conversion is working properly?
1. Check that the javascript snippet has been placed on the correct conversion page. Visit the page where the pixel has been embedded, right click and go to ‘View Page Source’ to find the pixel. The code should have the tag of the HTML. See image below.
2. Check that Facebook is receiving the conversion events from your website. Go to the conversion tracking tab in your Ads Manager account. There you will see a list of the conversion tracking pixels that you have created. If the conversion tracking pixel has been successfully implemented and a conversion event has been recorded, it will be reflected in the Pixel Status column. If the status shows active, it means that the page which contains the pixel has been viewed by users. If it shows inactive, it means that over the last 24 hours, the page with the pixel has not been viewed.
3.Later, when you create your Facebook ad , you need to check the track conversions box under the campaign, pricing and schedule tab to enable tracking.
Important security bulletin for WordPress users
A large distributed brute force attack against WordPress websites is understood to be occurring recently across the internet. A large botnet with thousands of attacking servers is attempting to log in by cycling through different usernames and passwords to get into the WordPress Admin dashboard. This is a global attack which is affecting thousands of servers globally.
To ensure that your websites are secure and safeguarded from this attack, we recommend the following steps to be implemented immediately if you are using WordPress:
1) Update your WordPress installation to the latest available version. If you have any plugins and themes installed under WordPress, please make sure that you update them to the latest version as well.
2) Use a strong alphanumeric password for your WordPress Admin login. You can use a password generator like http://www.strongpasswordgenerator.com
3) Password protect the WordPress admin directory (wp-admin) so that it will have an additional protection. You can do that through cPanel > Security > Password Protect Directories
Note: If it breaks the Ajax functionality or shows 404 errors in the dashboard, you may have to add the following in .htaccess file:
Order allow,deny
Allow from all
Satisfy any
4) If you have a static IP address, you can lock down the WordPress Admin access using .htaccess file with the following rules:
RewriteEngine on
RewriteCond %{REQUEST_URI} ^/wp-login\.php(.*)$ [OR]
RewriteCond %{REQUEST_URI} ^/wp-admin$
RewriteCond %{REMOTE_ADDR} !^72\.72\.72\.72$ [OR]
RewriteCond %{REMOTE_ADDR} !^72\.72\.72\.73$ [OR]
RewriteCond %{REMOTE_ADDR} !^72\.72\.72\.74$
RewriteRule ^(.*)$ – [R=403,L]
(Replace 72.72.72.72, 72.72.72.73, 72.72.72.74 with your actual PC IPs)
5) Install security plugins like:
http://wordpress.org/extend/plugins/limit-login-attempts/
http://wordpress.org/extend/plugins/better-wp-security/
India soon to be the biggest source of PHP developers?
The number of Indian PHP developers has been growing at a large pace in the last few years, when compared to other countries. A few years ago, India was just one of the top ten countries with more PHP developers. Now India is number 2 and is almost surpassing United States, which is still number 1.
While it is difficult to take such broad conclusions seriously based on member statistics of a single community, PHPClasses does have a large user base and can arguably be considered representative. Any article tagged India and software these days attract the usual crap about how Indian developers are the worst and how everybody who outsources to India never does it again. So I was surprised when some of the usually ‘silent’ majority of the client base who continue outsourcing development to India came out to defend their decision.
I did come away with a very interesting statistic; Indian developers have won most awards this year for their contribution against sizable competition. Most Indian developers I meet have difficulty understanding the concept of giving back to the community, so it’s always refreshing to see a number of people doing exactly that.
Facebook buys facial-recognition startup
Facebook Inc (FB.O) is paying $55 million to $60 million to buy Face.com, according to people familiar with the matter, acquiring the company that provides the facial-recognition technology used by the world’s largest social network to help users identify and tag photos.
The deal bolsters one of Facebook’s most popular features — the sharing and handling of photos — but the use of the startup’s
has spurred concerns about user privacy.
The No. 1 social network will pay cash and stock for Face.com, potentially paying as much as $60 million, two sources with knowledge of the deal said. Media reports in past weeks have pegged the transaction at $80 million to $100 million.
Neither Facebook nor Face.com disclosed terms of the deal, which is expected to close in coming weeks.
Facebook, which will acquire the technology and the employees of the 11-person Israeli company, said in a statement that the deal allows the company to bring a “long-time technology vendor in house.”
Face.com, which has raised nearly $5 million from investors including Russian Web search site Yandex (YNDX.O), launched its first product in 2009. The company makes standalone applications that consumers can use to help them identify photos of themselves and of their friends on Facebook, as well as providing the technology that Facebook has integrated into its service.
Facebook uses the technology to scan a user’s newly uploaded photos, compares faces in the snapshots with previous pictures, then tries to match faces and suggest name tags. When a match is found, Facebook alerts the person uploading the photos and invites them to “tag,” or identify, the person in the photo.
Responding to inquiries from U.S. and European privacy advocates, Facebook last year made it easier for users to opt out of its controversial facial-recognition technology for photographs posted on the website, an effort to address concerns that it had violated consumers’ privacy.
The deal is the latest in a string of acquisitions by Facebook in recent months, including the $1 billion acquisition of mobile photo-sharing service Instagram. U.S. antitrust regulators are undertaking an extended review of the Instagram deal, which Facebook expects to close by the end of the year.
Shares of Facebook, which continue to trade below the price at which they were offered during the initial public offering in May, closed Monday’s regular session up 4.7 percent at $31.41.
Related articles
- Facebook buys Face.com facial recognition company (huffingtonpost.com)
- Facebook to buy facial-recognition startup (business.financialpost.com)
- Even bigger Big Brother: Facebook purchases Israeli facial recognition company Face.com (EndtheLie.com)
- Facebook buys facial recognition startup Face.com (venturebeat.com)
- Facebook buys facial-recognition startup (stuff.co.nz)
Recent Comments