Saturday, 28 February 2015

HTML5 interview Questions and Answers for Fresher and Experienced

HTML5 interview Questions and Answers for Fresher and Experienced
HTML5 is a core technology markup language of the Internet used for structuring and presenting content for the World Wide Web. 

As of October 2014  this is the final and complete fifth revision of the HTML standard of the World Wide Web Consortium (W3C). The previous version, HTML 4, was standardised in 1997.

From- http://en.wikipedia.org/wiki/HTML5



Question: What is file extension of HTML5?
.html


Question: What is initilize date of Html5?
28 October 2014


Question: What are the new features in HTML5?
Following are new features in HTML5
Local storage.
New form controls like calendar, date, time, email, URL and search etc.
canvas element is provided for 2D drawing.
video and audio elements for media playback.
New elements are provided. For e.g. article, header, footer, nav, section.


Question: What are the various elements provided by HTML 5 for media content?
audio - It defines sound content.
video - It defines a video.
source - This tag defines the source of video and audio.
embed - It provides a container for an external application.
track - It defines text tracks for videoand audio.


Question: What are the new Form elements made available in HTML5?
datalist - It specifies a list of options for input controls
keygen - This tag defines a key-pair generator field.
output - It defines the result of a calculation.


Question: What are the various tags provided for better structuring in HTML5?
article - This tag defines an article.
aside - It defines content other than the page content.
bdi - This tag isolates a part of text for formatting.
command - It defines a command button to be invoked by the user.
details - It defines additional details that can be viewed .
dialog - It defines a dialog box.
figure - This tag specifies content like illustrations, diagrams, photos, code listings etc.
figcaption - It is used to provide a caption for a figure element .
footer - This tag defines a footer for a document or section.
header - This tag is used to define a header for a document .
hgroup - When there are multiple levels in a heading, it groups a set of h1 to h6 elements.
mark - It defines highlighted text.
meter - It defines a scalar measurement within a known range.
nav - It defines links for navigation.
progress - This tag exhibits the progress of a task.
ruby - It defines a ruby annotation for East Asian typography.
rt - It defines an explanation/pronunciation of characters for East Asian typography.
rp - This tag tells the system what to display in browsers that do not support ruby annotations.
section - It defines a section in a document.
summary - It provides a visible heading for a details element.
time - This tag defines a date/time.
wbr - This tag defines a line-break.


Question: What is SVG?
SVG is the abbreviation for Scalable Vector Graphics and is recommended by W3C.
It is used to define vector-based graphics for the Web


Question: What is a Canvas? What is the default border size of a canvas?
Canvas is a rectangular area on a HTML page, specified with the canvas tag.
By default, It has no border. To get a border style attribute can be used.


Question: Differentiate between Canvas and SVG?
Canvas is resolution dependent while SVG is not.
Canvas does not provide any support for event handlers while SVG does provide the support for event handlers.
Canvas is suitable for graphic-intensive games while SVG is not suitable for gaming.
Canvas is suitable for small rendering areas while SVG is suitable for large rendering areas like Google maps.


Question: HTML 5 provides drag and drop facility. How do you make an image draggable?
<img draggable="true" />

Question: What is HTML5 Web Storage?
It store the data locally in the user's browser


Question: Differentiate between session Storage and local Storage objects?
Session Storage object stores the data only for one session while local Storage object stores the data without an expiry date.


Question: What is a Manifest file?
A Manifest file is a simple text file that tells the browser what to cache and what not to cache.


Question: What is a Web Worker?
A web worker is a JavaScript which runs in the background.


Question: What is the purpose of HTML5 versus XHTML?
HTML5 is the next version of HTML 4.01, XHTML 1.0 and DOM Level 2 HTML. Its aim to reduce the need for proprietary plug-in-based rich internet application (RIA) technologies such as Adobe Flash, Microsoft Silverlight etc.


Question: WHAT are some other advantages of HTML5?
Cleaner markup than earlier versions of HTML
Additional semantics of new elements like header, nav, and time


Question: What is the !DOCTYPE? Is it mandatory to use in HTML5?
The !DOCTYPE is an instruction to the web browser about what version of HTML the page is written in. The !DOCTYPE tag does not have an end tag. It is not case sensitive.



Question: What are various tags which are not available in HTML5?

acronym
applet
basefont
big
center
dir
font
frame
frameset
noframes
strike
tt




Question: How to link an email address?
<a href="mailto:myemialid@wten.in">Email Me</a>





Friday, 27 February 2015

SAML Interview Questions and Answers

Security Assertion Markup Language (SAML, pronounced sam-el) is an XML-based, open-standard data format for exchanging authentication and authorization data between parties, in particular, between an identity provider and a service provider.

SAML is a product of the OASIS Security Services Technical Committee.

From: http://en.wikipedia.org/wiki/Security_Assertion_Markup_Language




Question: What is full form of SAML?
Security Assertion Markup Language


Question: What is SAML?
SAML is XML based data format for exchanging authentication and authorization information between two domains.


Question: Is it Open Standard?
Yes, It is.


Question: Why SAML is designed?
It is designed for Authentication and Authorization to business-to-business (B2B) and business-to-consumer(B2C) clients.


Question: What are three assertions in SAML?
Authentication, Attribute, Authorization.


Question: What is Difference between Authentication, Attribute and Authorization?
Authentication validates the user's identity whether user is valid OR Not.
Attribute assertion contains specific information about the particular user.
Authorization identifies whether user have specific permission or not, after the successful authentication.


Question: With which protocol SAML works?
  • Hypertext Transfer Protocol (HTTP)
  • Simple Mail Transfer Protocol (SMTP)
  • File Transfer Protocol (FTP)
  • BizTalk
  • Electronic Business XML (ebXML)


Question: What is latest Version of SAML?
SAML 2.0 became an OASIS Standard in March 2005.


Question: What is differences between V2.0 and V1.1?
SAML 2.0 and SAML 1.1 are substantial. Although the two standards address the same use case, SAML 2.0 is incompatible with its predecessor.


Question: What are Main Features of SAML?
Following are main features of SAML
  • Seamless integration
  • Exchange of information among different security domains
  • Backoffice Transaction.
  • Single-Sign-On – user's ability to authenticate in one security domain and to use the protected resources of another security domain.
  • XML-based framework for security-related sharing information over Internet.
  • Question: What is similar between OpenID and SAML? SAML2 and OpenID are for authentication/Authorization


Question: What is the difference between OpenID and SAML?
Following are difference between OpenId and SAML

  • SAML2 supports single sign-out but OpenID does not support single sing out.
  • SAML2 has different bindings while the only binding OpenID has is HTTP.
  • SAML2 can be Service Provider (SP) OR Identity Provider (IdP) initiated. But OpenID always SP initiated.
  • SAML 2 is based on XML while OpenID is not.



Thursday, 26 February 2015

What is UPnP in Skype?



What is UPnP in skype?
UPnP means Universal Plug and Play. UPnP is program that automatically connect to the router and set the ports automatically without you having to do it setup up port manually.
For more information: http://en.wikipedia.org/wiki/Universal_Plug_and_Play


What does enable UPnP do in skype?
If we check the checkbox in front of UPnP, It means we have enabled the UPnP.
When we enable the UPnP, It will connect to the router and set the port automatically.


What does disable UPnP do in skype?
If we un-check the checkbox in front of UPnP, It means we have disabled the UPnP.
When we disabled the UPnP, It will not connect to the router and never the port automatically.


Wednesday, 25 February 2015

How to store array in Cookie and retrieve array from cookie

How to store array in Cookie and retrieve array from cookie

How to store array in Cookie
We need to json_encode the array then save the data with setcookie function.
$arrayData=array(
    'web technology experts',
    'web technology experts Notes',
    'web technology experts Notes  php technology'    
);
setcookie('cookieData', json_encode($arrayData));


How to Retrieve array in Cookie
As we have encoded the array above, So we need to json_decode the array before use.
$arrayData = json_decode($_COOKIE['cookieData']);


How to set time in cookies
$arrayData=array(
    'web technology experts',
    'web technology experts Notes',
    'web technology experts Notes  php technology'    
);
setcookie('cookieData', json_encode($arrayData), time()+3600);// set time for 1 hour [1 hour=3600 seconds]


 


How to delete Content of File in windows and unix?


Sometimes there are need to empty a file without opening the file. We can do the same with following two methods.

Method 1.
Delete the file and re-create the file with same name and extension.


Method 2.
Follow the simple steps.
1. Press window+R
2. Type the cmd and press enter key.
3. Now you are not window command prompt area.
4. Go to the same folder where file exits to delete the content.
5. Type the following command (replace the demo.txt with your file name)
 copy /y nul demo.txt
6. Now check its empty.



Question: How to delete the content of file in Unix?
Following are three different way, choose which suites to you.
cp /dev/null filename.txt
touch filename.txt
truncate -s 0 filename.txt



Tuesday, 24 February 2015

How to share Embed youtube video on facebook From my website

How to share Embed youtube video on facebook From my website

Following are two steps


1. Get video-code from YouTube URL video URL
Suppose you have following youtube video.

https://www.youtube.com/watch?v=adn45xIFa4g

Now get the video-Code i.e adn45xIFa4g from YouTube URL.

2. Update the following meta tags (fill Video Code)
<meta property="og:title" content="How to share Embed youtube video on facebook From my website"  />
<meta property="og:description" content="How to share Embed youtube video on facebook From my website" />
<meta property="og:url" content="http://www.web-technology-experts-notes.in/2015/02/how-to-share-embed-youtube-video-on-facebook-from-my-website.html" />
<meta property="og:type" content="video" >
<meta property="og:image" content="http://i1.ytimg.com/vi/adn45xIFa4g/maxresdefault.jpg" />
<meta property="og:video" content="http://www.youtube.com/e/adn45xIFa4g" />
<meta property="og:video:height" content="268" />
<meta property="og:video:width" content="480" />

<!-- DON'T FORGET TO ADD META TAGS FOR HTTPS -->
<meta property="og:url:secure_url" content="http://www.web-technology-experts-notes.in/2015/02/how-to-share-embed-youtube-video-on-facebook-from-my-website.html" >
<meta property="og:image:secure_url" content="https://i1.ytimg.com/vi/adn45xIFa4g/maxresdefault.jpg" />
<meta property="og:video:secure_url" content="https://www.youtube.com/e/adn45xIFa4g" >
<!-- DON'T FORGET TO ADD META TAGS FOR HTTPS -->

3. Paste the above meta tags before the closing of head tag (</head>)




Thursday, 19 February 2015

How to send Attachment in Email in zend framework1 - Send PDF File

How to send Attachment in Email in zend framework1 - Send PDF File

Sending an attachment in Email is very easy in zend framework. Attachmnet can be PDF file, image file, text and excel file etc. For Different type of attachment have different types of mime type. For example pdf mime type is "application/pdf" where gif image mime type is "image/gif".

In E-commerce website, when an order is placed by customer on the online website. Customer get the order detail in form of Order PDF File, So that he can keep offline record too.


Following code snippet is for How to attach a PDF file in Email using Zend Framework.
 
  /** Must fill Following detail * */
        $emailTo = 'receipts@no-spam.ws';
        $emailToName = 'receipts Name';
        /** Must fill Following detail * */
        $emailSubject = 'This is subject';
        $emailBody = 'This is HTML Email Body';
        $fromEmail = 'fromemail@no-spam.ws';
        try {
            $config = array(
                'ssl' => 'tls',
                'auth' => 'login',
                'username' => 'SMTP_USERNAME',
                'password' => 'SMTP_PASSWORD'
            );
            $transport = new Zend_Mail_Transport_Smtp('SMTP_HOST', $config);

            $mail = new Zend_Mail();
            $mail->setBodyHtml($emailBody);
            $mail->setFrom($fromEmail);
            $mail->addTo($emailTo, $emailToName);
            $mail->setSubject($emailSubject);
            
            /**PDF Add Attachment **/
            $attachment = new Zend_Mime_Part('path to pdf file');
            $attachment->type        = 'application/pdf';
            $attachment->disposition = Zend_Mime::DISPOSITION_ATTACHMENT;
            $attachment->encoding = Zend_Mime::ENCODING_BASE64;
            $attachment->filename    = 'order.pdf';
            $mail->addAttachment($attachment);
            /** Add Attachment **/            

            if ($mail->send($transport)) {
                echo 'Sent successfully';
            } else {
                echo 'unable to send email';
            }
        } catch (Exception $e) {
            echo $e->getMessage();
        }



Different Types of Attachment 



Tuesday, 17 February 2015

How to send Email in wordpress

How to send Email in wordpress

In Websites, we need to send email on Registration, Forget password, order to our Clients/Customer. If your email template is ready Sending email is a very quick step in WordPress, but sometimes developer gets confused due to not available of correct email sending code.

In this post, We will give you code snippet. This code snippet will send email. You can set the receipt, subject, description, reply-to and header  in email.

$receipt = "user@no-spam.ws"; 
$subject = "This is subject";
$content = 'This is conent of the email.


http://www.web-technology-experts-notes.in';
/** Set the Reply -optional field **/
$headers = array(
 'Reply-To' => "replyto@no-spam.ws"
);
/** Set the Reply -optional field **/


/** Send the Html email - optional field **/
add_filter( 'wp_mail_content_type', 'set_html_content_type' );
/** Send the Html email - optional field **/

$status = wp_mail($receipt, $subject, $content, $headers);

if($status){
echo 'Sent Successfully';
}else{
echo 'Not send';
}
  


If above any query regarding above code, Please comment!.


Monday, 16 February 2015

How to Find a Facebook Profile From an Image URL

How to Find a Facebook Profile From an Image URL?

Suppose you have following Profile Picture.


Following is URL of above Image
http://graph.facebook.com/1438566719/picture?type=square

In this Profile Image URL, there is Id i.e. 1438566719. This is Facebook Profile ID.
From this facebook ID, we can get the facebook profile URL.

Following is facebook profile URL.
http://facebook.com/1438566719

You will set it will automatic redirect to https://www.facebook.com/arun.compute.

In Facebook, every things have ID whether it is profile URL, Page OR APP.
when you open http://facebook.com/[ID_NUMBER], It wil be automatic redirect to its specific page.



Sunday, 15 February 2015

Synchronous XMLHttpRequest on the main thread is deprecated

Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience.

If you are getting above issue, It means in Ajax call ( May be using xmlHttpRequest, jQuery.js OR prototype.js etc), Somewhere you have set following:
async: false

Never use "async: false", Because it has been deprecated.

async must be true, whether you are using core ajax, jQuery ajax OR prototype ajax etc.



Wednesday, 11 February 2015

How to integrate Facebook open Graph API in Website

How to integrate Facebook open Graph API in Website

In April of 2010, Facebook launched Open Graph API. Open Graph API let's you get website information  & post on facebook.com. It helps to share your website information globally through facebook.com.

When it was launched within a week around 50,000 website integrate the Facebook Open Graph API. With use of Open Graph API, we can published/post/submit your website's page/article/video on facebook.com and your content will start displaying in Facebook.com


To implement Open Graph API in website, there are two steps and are following.

Step No 1
How to create App in Facebook:
A. Login Facebook, go to the Developers page (https://developers.facebook.com/).
B. Click "Set up a new app" button on the top right corner.
C. Give a name to your new App, "agree" to Facebook terms and conditions, then click on "Create app".
D. Go to Web Site tab, fill up Site URL and Site Domain.
E. Note down the "Application ID" which we will use in Meta Tags.


Step No 2
Following are Different Meta Tags of Open Graph API which you can add in your Website
<!-- Begin Open Graph metadata -->
<meta content='508427595967225' property='fb:app_id'/>
<meta content='en_US' property='og:locale'/>
<meta content='http://www.web-technology-experts-notes.in/2014/12/facebook-comments-integration-in-website.html' property='og:url'/>
<meta content='Facebook comments Integration in website' property='og:title'/>
<meta content='article' property='og:type'/>
<meta content='Web Technology Experts Notes' property='og:site_name'/>
<meta content='https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEihwY-LposUHaskiINc04SYtH2iOmaZoqTTtxnZIK3eDejPPH2V_h1MiBT6Mo9yCzKY9tWfbv0vkuR6g9sFZYmTsMUN_xSatoMayqDAwWS6BxoemOkV05fIyFCo3OsPhTsgPuz-ZbRr52A0/s72-c/facebook+comment+box.png' property='og:image'/>
<meta content='The Comments box lets people comment on your site with Facebok. Add Facebook comments box for you blogger, Generic website, Ecommerce website etc.in few seconds with dynamic URL.' property='og:description'/>
<!-- End Open Graph metadata -->



Want to check your Meta tags on facebook.com:
https://developers.facebook.com/tools/debug/ (This need Fb Login)

Need More info, check offical facebook page:
https://developers.facebook.com/docs/opengraph/getting-started


Tuesday, 10 February 2015

How to Call a javaScript function in PHP



You can't call a javascript function in PHP directly.

But You can Call a Javascript function from outputted HTML by PHP. It means you can call the javaScript function on conditional. See Example Below:
 
$count= empty($_GET['count'])?0:$_GET['count'];
if(empty($count)){
    echo '<script>callFunc1()</script>';
}elseif($count&lt;=10){
echo '<script>callFunc2()</script>';
}else{
echo '<script>callFunc3()</script>';
}

In this way, we call the JavasScript function in PHP.