Wednesday, October 28, 2015

how to write css in different browser..Prevent Bootstrap Modal from disappearing when clicking outside or pressing escape?

1.Prevent Bootstrap Modal from disappearing when clicking outside or pressing escape?

If using javascript then:

$('#myModal').modal({
    backdrop: 'static',
    keyboard: false
})
and if HTML:
<a data-controls-modal="your_div_id" data-backdrop="static" data-keyboard="false" href="#">

**************************************************************************************************
2.how to find ip address in php
<?php echo $_SERVER["REMOTE_ADDR"];     ?>
********************************************************
3.how to get base url
<?php echo getcwd(); ?>
********************************************************
4. how to write css in different browser..
.safari { /* Safari only */ }
.mac { /* Mac only */ }
.safari.mac { /* Safari Mac */ }
html:not(.safari) { /* All browsers except for Safari */ }
html:not(.safari.mac) { /* All browsers except for Safari Mac */ }
**************************************************************************

What are the key differences between HTML and HTML5? Which is better?

1. HTML5 Is a Work in Progress

2. Simplified Syntax

3. The New <canvas> Element

4. The <header> and <footer> Elements

5. New <section> and <article> Elements

6. New <menu> and <figure> Elements

8. New <audio> and <video> Elements

8. New Forms

The new <form> and <forminput> elements are looking good. If you do much with forms, you may want to take a look at what these have to offer.

9. Kiss <b> and <font> Goodbye!

CSS, all the time.
All the time, CSS.

10. No More <frame>, <center>, <big>

I bet you’re going to miss these.


Difference in Tags:


• <!DOCTYPE  html> : In  HTML 4.01, there are three different <!DOCTYPE> declarations  but  In HTML 5 there is only one  <! DOCTYPE html>

•  <a >:  In HTML 4.01, the <a> tag could be either a hyperlink or an anchor. In HTML5, the <a> tag is always a hyperlink, but if it has no href attribute, it is only a placeholder for a hyperlink.

• <acronym> : The <acronym> tag is not supported in HTML5. Use the <abbr> tag instead. The <acronym> tag was used to define acronyms in HTML 4.01.

• <applet>: The <applet> tag is not supported in HTML5.  Use the  <object> tag instead.

• <strong>: In HTML 4.01, the <strong> tag defines strong emphasized text, but in HTML5 it defines important text.

• <body> :   In HTML5, all <body> specific attributes are removed, while in HTML 4.01 they were deprecated.

• <hr>: In HTML 4.01, the <hr> tag represented a horizontal rule. In HTML5, the <hr> tag defines a thematic break. The <hr> element is used to separate content (or define a change) in an HTML page.


• <map> : In HTML5, if the id attribute of the <map> tag is also specified, it must have the same value as the name attribute.

• <meta> :  The scheme attribute is not supported in HTML5.


HTML5 has a new attribute, charset, which makes it easier to define charset:


HTML5 has a new attribute, charset, which makes it easier to define charset:

HTML 4.01: <Meta http-equiv="content-type" content="text/html; charset=UTF-8">
            
HTML5 : <meta charset="UTF-8”>

• <script> : The "type" attribute is required in HTML 4, but optional in HTML5.

•<small >  : In HTML 4.01 the small element is displayed as smaller text. In HTML5 the small element defines small text and other side comments, and is displayed as smaller text.

•<table>:  Only the "border" attribute is supported in HTML5, and it only allows the values " " or "1".

New Semantic/Structural Elements :


HTML5 offers new elements for better structure:
      

           
<article>  :  Defines an article

           
<aside>  :  Defines content aside from   the page content

           
<bdi>   :  Isolates a part of text that might be formatted in a   different
direction from other text outside it
           

<command>   :   Defines a command button   that a user can invoke
           

<details>   :   Defines additional details   that the user can view or hide
           

<summary>    :    Defines a visible heading   for a <details> element
           

<figure>   :  Specifies self-contained   content, like illustrations, diagrams, photos, code listings, etc.
           

<figcaption>   : Defines a caption for a   <figure> element
           

<footer>   :  Defines a footer for a   document or section.

      
<header>   :   Defines a header for

Difference in Tags:


• <!DOCTYPE  html> : In  HTML 4.01, there are three different <!DOCTYPE> declarations  but  In HTML 5 there is only one  <! DOCTYPE html>

•  <a >:  In HTML 4.01, the <a> tag could be either a hyperlink or an anchor. In HTML5, the <a> tag is always a hyperlink, but if it has no href attribute, it is only a placeholder for a hyperlink.

• <acronym> : The <acronym> tag is not supported in HTML5. Use the <abbr> tag instead. The <acronym> tag was used to define acronyms in HTML 4.01.

• <applet>: The <applet> tag is not supported in HTML5.  Use the  <object> tag instead.

• <strong>: In HTML 4.01, the <strong> tag defines strong emphasized text, but in HTML5 it defines important text.

• <body> :   In HTML5, all <body> specific attributes are removed, while in HTML 4.01 they were deprecated.

• <hr>: In HTML 4.01, the <hr> tag represented a horizontal rule. In HTML5, the <hr> tag defines a thematic break. The <hr> element is used to separate content (or define a change) in an HTML page.


• <map> : In HTML5, if the id attribute of the <map> tag is also specified, it must have the same value as the name attribute.

• <meta> :  The scheme attribute is not supported in HTML5.


HTML5 has a new attribute, charset, which makes it easier to define charset:


HTML5 has a new attribute, charset, which makes it easier to define charset:

HTML 4.01: <Meta http-equiv="content-type" content="text/html; charset=UTF-8">
            
HTML5 : <meta charset="UTF-8”>

• <script> : The "type" attribute is required in HTML 4, but optional in HTML5.

•<small >  : In HTML 4.01 the small element is displayed as smaller text. In HTML5 the small element defines small text and other side comments, and is displayed as smaller text.

•<table>:  Only the "border" attribute is supported in HTML5, and it only allows the values " " or "1".

New Semantic/Structural Elements :


HTML5 offers new elements for better structure:
      

           
<article>  :  Defines an article

           
<aside>  :  Defines content aside from   the page content

           
<bdi>   :  Isolates a part of text that might be formatted in a   different
direction from other text outside it
           

<command>   :   Defines a command button   that a user can invoke
           

<details>   :   Defines additional details   that the user can view or hide
           

<summary>    :    Defines a visible heading   for a <details> element
           

<figure>   :  Specifies self-contained   content, like illustrations, diagrams, photos, code listings, etc.
           

<figcaption>   : Defines a caption for a   <figure> element
           

<footer>   :  Defines a footer for a   document or section.

      
<header>   :   Defines a header for a   document or section

           
<hgroup>   :   Groups a set of <h1>   to <h6> elements when a heading has multiple levels.

           
<mark>   :   Defines marked/highlighted   text.

           
<meter>  :   Defines a scalar   measurement within a known range (a gauge).

           
<nav>   :    Defines navigation links.

           
<progress>   :   Represents the progress of   a task.

           
<ruby>    :   Defines a ruby annotation   (for East Asian typography).

           
<rt>   :  Defines an   explanation/pronunciation of characters (for East Asian typography).

           
<rp>   :   Defines what to show in browsers that do not support ruby   annotations
    

        
<section>   :  Defines a section in a   document
    

        
<time>  :  Defines a date/time
    

<wbr>  :  Defines a possible line-break .

New Media Elements :


HTML5 offers new elements for media content:
      

           
<audio>  :  Defines sound content.
           
<video>  :  Defines a video or movie.
           
<source>  :  Defines multiple media   resources for <video> and <audio>.
           
<embed>  :  Defines a container for an external application or   interactive content (a plug-in).
           
<track>  :   Defines text tracks for   <video> and <audio>.


Examples :


<video> :


<!DOCTYPE html>
<html>
<body>
<DIV id='abc' style="z-index:2; position:relative; right:0px; top:10px; background-color:#cccc33; width:400px; height:80px; padding:10px; color:White; border:#ffffcc 1px dashed; font-size:xx-large;">
LogicPace Technologies Pvt.Ltd,Jaipur</DIV><br>
<VIDEO src="atheora.ogv" width="320" height="240"  controls autoplay>
</VIDEO>
</body>
</html> a   document or section

           
<hgroup>   :   Groups a set of <h1>   to <h6> elements when a heading has multiple levels.

           
<mark>   :   Defines marked/highlighted   text.

           
<meter>  :   Defines a scalar   measurement within a known range (a gauge).

           
<nav>   :    Defines navigation links.

           
<progress>   :   Represents the progress of   a task.

           
<ruby>    :   Defines a ruby annotation   (for East Asian typography).

           
<rt>   :  Defines an   explanation/pronunciation of characters (for East Asian typography).

           
<rp>   :   Defines what to show in browsers that do not support ruby   annotations
    

        
<section>   :  Defines a section in a   document
    

        
<time>  :  Defines a date/time
    

<wbr>  :  Defines a possible line-break .

New Media Elements :


HTML5 offers new elements for media content:
      

           
<audio>  :  Defines sound content.
           
<video>  :  Defines a video or movie.
           
<source>  :  Defines multiple media   resources for <video> and <audio>.
           
<embed>  :  Defines a container for an external application or   interactive content (a plug-in).
           
<track>  :   Defines text tracks for   <video> and <audio>.


Examples :


<video> :


<!DOCTYPE html>
<html>
<body>
<DIV id='abc' style="z-index:2; position:relative; right:0px; top:10px; background-color:#cccc33; width:400px; height:80px; padding:10px; color:White; border:#ffffcc 1px dashed; font-size:xx-large;">
LogicPace Technologies Pvt.Ltd,Jaipur</DIV><br>
<VIDEO src="atheora.ogv" width="320" height="240"  controls autoplay>
</VIDEO>
</body>
</html>

 

 

 

 

 

 

 

What's the difference between echo, print, and print_r in PHP?

$values = array(0, 0.0, false, '');

var_dump($values);
print_r ($values);
With print_r you can't tell the difference between 0 and 0.0, or false and '':
array(4) {
  [0]=>
  int(0)
  [1]=>
  float(0)
  [2]=>
  bool(false)
  [3]=>
  string(0) ""
}

Array
(
    [0] => 0
    [1] => 0
    [2] => 
    [3] => 
)


echo
  • Outputs one or more strings separated by commas
  • No return value
    e.g. echo "String 1", "String 2"

    1. echo is a statement i.e used to display the output. it can be used with parentheses echo or without parentheses echo.
    2. echo can pass multiple string separated as ( , )
    3. echo doesn’t return any value
    4. echo is faster then print
print
  • Outputs only a single string
  • Returns 1, so it can be used in an expression
    e.g. print "Hello"
    or, if ($expr && print "foo")
    1. Print is also a statement i.e used to display the output. it can be used with parentheses print( ) or without parentheses print.
    2. using print can doesn’t pass multiple argument
    3. print always return 1
    4. it is slower than echo
print_r()
  • Outputs a human-readable representation of any one value
  • Accepts not just strings but other types including arrays and objects, formatting them to be readable
  • Useful when debugging
  • May return its output as a return value (instead of echoing) if the second optional argument is given
var_dump()
  • Outputs a human-readable representation of one or more values separated by commas
  • Accepts not just strings but other types including arrays and objects, formatting them to be readable
  • Uses a different output format to print_r(), for example it also prints the type of values
  • Useful when debugging
  • No return value
var_export()
  • Outputs a human-readable and PHP-executable representation of any one value
  • Accepts not just strings but other types including arrays and objects, formatting them to be readable
  • Uses a different output format to both print_r() and var_dump() - resulting output is valid PHP code!
  • Useful when debugging
  • May return its output as a return value (instead of echoing) if the second optional argument is given
Notes:
  • Even though print can be used in an expression, I recommend people avoid doing so, because it is bad for code readability (and because it's unlikely to ever be useful). The precedence rules when it interacts with other operators can also be confusing. Because of this, I personally don't ever have a reason to use it over echo.
  • Whereas echo and print are language constructs, print_r() and var_dump()/var_export() are regular functions. You don't need parentheses to enclose the arguments to echo or print (and if you do use them, they'll be treated as they would in an expression).