Friday, 26 August 2016

How to Configure MongoDB with PHP for WampServer on Windows

How to Configure MongoDB with PHP for WampServer on Windows

Follow the below simple steps to configure Mongodb with PHP.



Question: How to connect MongoDb Drivers with PHP?
$m = new MongoClient();



Thursday, 25 August 2016

How to put online your WampServer? - Access Local code globally

How to put online your WampServer - Access Local code globally

We have done some R&D on How to Put Online Your WampServer?
Now, If any one have code in their local WampServer.
For Example:
http://localhost/myproject1
Access with
http://192.168.0.17/myproject1

It can be access with globally using the same network.

Benefits:
Suppose you have code in local system, But you want to test the functionality in different Mobile devices and Ipad.
With use of this, you can do the same without push the code in LIVe.


Question:How to do this?
Following the Below steps.
Step 1
Get to know the your Private IP.
Go to command prompt and type ipconfig and press enter. You will get simiar to following response.
C:\>ipconfig
  Connection-specific DNS Suffix  . :
  IP Address. . . . . . . . . . . . : 192.168.0.17
  Subnet Mask . . . . . . . . . . . : 255.255.255.0
  Default Gateway . . . . . . . . . : 192.168.1.1

Now 192.168.0.17 is your local Ip Address.
Step 2
Make sure Windows Firewall is disabled
How to check/update windows firewall
Control Panel=>System and Security=>Windows Firewall=>Turn windows firewall on/off
Turn windows firewall on/off


Step 3
means
http://192.168.0.17/myproject1
can be access globally within same network.



Question:How to apache listen multiple port?
Each system have one unique Ip Address.
But you can set multiple port with same ip address.
Open httpd.conf file in your wamp server
I have http.conf in following location.
E:\wamp\bin\apache\apache2.2.22\conf\httpd.conf

Add following port as below after "Listen 80"
Listen 5555
Listen 5556
Listen 5557
Listen 5558

(I have added port 5555-5558, you can choose your own)

Question: I am using Virtual host for my local websites? Can we access globally for this also?
Yes, You can do the same. Just add the following code in your http-vhosts.conf file.

 <VirtualHost 192.168.0.17:5555>
    DocumentRoot "E:\wamp\www\myproject2\public_html"  
    <Directory "E:\wamp\www\myproject2\public_html">
        AllowOverride All
        Order allow,deny
        Allow from all
    </Directory>
</VirtualHost>

Please modify URL and IP Address above as per your system.

Now can Access With
http://192.168.0.17:5555

Wednesday, 24 August 2016

Braintree payment with Paypal OR Credit card - Easy Payment


Braintree Payment Form

Braintree Payment Form


Pay with Credit Card

Pay with Credit Card


Pay with Paypal

Pay with Paypal


<div>
<form action="/payment.php" id="checkout" method="post">
<div id="payment-form">
</div>
<input type="submit" value="Pay $10" />
    </form>
</div>
<script src="https://js.braintreegateway.com/js/braintree-2.27.0.min.js"></script>
<script>
    var clientToken = "eyJ2ZXJzaW9uIjoyLCJhdXRob3JpemF0aW9uRmluZ2VycHJpbnQiOiJlZDMyNDY2YmY3NjEyODAxZTk1YmVkMzYyY2Y2NzQ5OThjZWJlZGU2OTgzMDI4MzY3NmJmOTZhNDI0NzI1YTJkfGNyZWF0ZWRfYXQ9MjAxNi0wOC0yNFQwNjowNzo1NS43MTUzNDUyNDIrMDAwMFx1MDAyNm1lcmNoYW50X2lkPTM0OHBrOWNnZjNiZ3l3MmJcdTAwMjZwdWJsaWNfa2V5PTJuMjQ3ZHY4OWJxOXZtcHIiLCJjb25maWdVcmwiOiJodHRwczovL2FwaS5zYW5kYm94LmJyYWludHJlZWdhdGV3YXkuY29tOjQ0My9tZXJjaGFudHMvMzQ4cGs5Y2dmM2JneXcyYi9jbGllbnRfYXBpL3YxL2NvbmZpZ3VyYXRpb24iLCJjaGFsbGVuZ2VzIjpbXSwiZW52aXJvbm1lbnQiOiJzYW5kYm94IiwiY2xpZW50QXBpVXJsIjoiaHR0cHM6Ly9hcGkuc2FuZGJveC5icmFpbnRyZWVnYXRld2F5LmNvbTo0NDMvbWVyY2hhbnRzLzM0OHBrOWNnZjNiZ3l3MmIvY2xpZW50X2FwaSIsImFzc2V0c1VybCI6Imh0dHBzOi8vYXNzZXRzLmJyYWludHJlZWdhdGV3YXkuY29tIiwiYXV0aFVybCI6Imh0dHBzOi8vYXV0aC52ZW5tby5zYW5kYm94LmJyYWludHJlZWdhdGV3YXkuY29tIiwiYW5hbHl0aWNzIjp7InVybCI6Imh0dHBzOi8vY2xpZW50LWFuYWx5dGljcy5zYW5kYm94LmJyYWludHJlZWdhdGV3YXkuY29tLzM0OHBrOWNnZjNiZ3l3MmIifSwidGhyZWVEU2VjdXJlRW5hYmxlZCI6dHJ1ZSwicGF5cGFsRW5hYmxlZCI6dHJ1ZSwicGF5cGFsIjp7ImRpc3BsYXlOYW1lIjoiQWNtZSBXaWRnZXRzLCBMdGQuIChTYW5kYm94KSIsImNsaWVudElkIjpudWxsLCJwcml2YWN5VXJsIjoiaHR0cDovL2V4YW1wbGUuY29tL3BwIiwidXNlckFncmVlbWVudFVybCI6Imh0dHA6Ly9leGFtcGxlLmNvbS90b3MiLCJiYXNlVXJsIjoiaHR0cHM6Ly9hc3NldHMuYnJhaW50cmVlZ2F0ZXdheS5jb20iLCJhc3NldHNVcmwiOiJodHRwczovL2NoZWNrb3V0LnBheXBhbC5jb20iLCJkaXJlY3RCYXNlVXJsIjpudWxsLCJhbGxvd0h0dHAiOnRydWUsImVudmlyb25tZW50Tm9OZXR3b3JrIjp0cnVlLCJlbnZpcm9ubWVudCI6Im9mZmxpbmUiLCJ1bnZldHRlZE1lcmNoYW50IjpmYWxzZSwiYnJhaW50cmVlQ2xpZW50SWQiOiJtYXN0ZXJjbGllbnQzIiwiYmlsbGluZ0FncmVlbWVudHNFbmFibGVkIjp0cnVlLCJtZXJjaGFudEFjY291bnRJZCI6ImFjbWV3aWRnZXRzbHRkc2FuZGJveCIsImN1cnJlbmN5SXNvQ29kZSI6IlVTRCJ9LCJjb2luYmFzZUVuYWJsZWQiOmZhbHNlLCJtZXJjaGFudElkIjoiMzQ4cGs5Y2dmM2JneXcyYiIsInZlbm1vIjoib2ZmIn0";

    braintree.setup(clientToken, "dropin", {
        container: "payment-form"
    });
</script>


Demo



After Successfully payment with Credit Card OR Paypal, Server will an Get Response similar to below.
Array
(
    [payment_method_nonce] => e91cdbff-d914-485f-817a-51f473b18445
)
This token is known as payment nonce. You can use this nonce once and can be used to get the payment from user account.
$paymentNonce=$POST[payment_method_nonce];//this is nonce
$result = Braintree_Transaction::sale([
  'amount' => '10.00',
  'paymentMethodNonce' => $paymentNonce,
  'options' => [
    'submitForSettlement' => True
  ]
]);

Monday, 22 August 2016

MongoDb Technical Interview Questions and Answers

MongoDb Technical Interview Questions and Answers

Question: What is MongoDb in technical terms?
MongoDb is No-SQL database. MongoDb is document oriented means store data in JSON Format called BSON. Designed with High Scalability.


Question: What is Replication?
Replication is the process of synchronizing data across multiple servers. It provides redundancy and increases data availability with multiple copies of data on different database servers.


Question: What are benefits of Replication?
  1. (24*7) availability of data
  2. Disaster Recovery
  3. No downtime for maintenance
Question: What is data warehouse?
A data warehouse is a relational database that is designed for query and analysis rather than for processing. It usually contains historical data derived from transaction data. It separates analysis workload from transaction workload and enables an organization to consolidate data from several sources.


Question: What is auto sharding in MongoDB?
Sharding is a method for distributing data across multiple machines. MongoDB uses sharding to support deployments with very large data sets and high throughput operations.


Question: Why sharding used in MongoDB?
  1. In replication all writes go to master node
  2. Latency sensitive queries still go to master
  3. Memory can't be large enough when active dataset is big
  4. Local Disk is not big enough
  5. Vertical scaling is too expensive



Question: What are data type support by MongoDB?
String : This is most commonly used datatype to store the data.
Integer : This type is used to store a numerical value. Integer can be 32 bit or 64 bit depending upon your server.
Boolean : Store a boolean (true/ false) value.
Double : This type is used to store floating values.
Min/ Max keys : This type is used to compare a value against the lowest and highest BSON elements.
Arrays : This type is used to store multiple values into one key.
Timestamp : ctimestamp. This can be handy for recording when a document has been added or modified.
Object : This datatype is used for embedded documents.
Null : This type is used to store a Null value.
Symbol : This datatype is used identically to a string however, it's generally reserved for languages that use a specific symbol type.
Date : This datatype is used to store the current date or time in UNIX time format.
Object ID : This datatype is used to store the document's ID.
Binary data : This datatype is used to store binay data.
Code : This datatype is used to store javascript code into document.
Regular expression : This datatype is used to store regular expression.



Question: How to connect to MongoDb databae through PHP?
$db = new Mongo('mongodb://localhost', array(
    'username' => 'abc',
    'password' => 'abc@123',
    'db'       => 'abc'
));



Question: How to Export database in MongoDb?
mongodump



Question: How to Import database in MongoDb?
mongorestore



Friday, 19 August 2016

How to change the Internet Zone security level from High to Medium and Vice Versa

Just follow the Below steps to change the  Internet Zone security level from High to Medium and Vice Versa
How to change the Internet Zone security level




How to change the Internet Zone security level from High to Medium and Vice Versa




What happen to websites when we change the setting:
https://blogs.technet.microsoft.com/steriley/2008/09/16/internet-explorer-security-levels-compared/


MongoDB Interview Questions and Answers


 MongoDB Interview Questions and Answers


Question: What is MongoDB?
MongoDB is a cross-platform document-oriented database and classified as a NoSQL database. Its not relational database.
MongoDB works on concept of collection and document.


Question: Is it similar to SQL/MySQL?
No, Its totally different from Relational database.


Question: In which language, MongoDB is written?
C/C++, JavaScript


Question: When First MongoDB was released?
2009


Question: When latest MongoDB was released?
13 July 2016


Question: What is latest version of MongoDB?
3.2.8


Question: Is it opensource?
Yes, It is free to use.


Question: What is offical website of MongoDB?
https://www.mongodb.org


Question: Compare the Terminology of MongoDB and RDBMS?
RDBMS MongoDB
Database Database
Table Collection
Tuple/Row Document
column Field
Table Join Embedded Documents
Primary Key Primary Key (Default key _id provided by mongodb itself)



Question: Compare the Feature of MongoDb?
Feature MySQL MongoDB
Rich Data Model No Yes
Dyamic Schema No Yes
Typed Data Yes Yes
Data Locality No Yes
Field Updates Yes Yes
Easy for Programmers No Yes
Complex Transactions Yes No
Auditing Yes Yes
Auto-Sharding No Yes



Question: What are main feature of MongoDB?
  1. Document-oriented
  2. Ad hoc queries
  3. Indexing
  4. Replication
  5. Load balancing
  6. File storage
  7. Aggregation
  8. Server-side JavaScript execution
  9. Capped collections



Question: What is NoSQL?
It is database which provides a mechanism for storage and retrieval of data that is modeled in means other than the tabular relations used in relational databases like SQL, Oracle, etc.


Question: What are different type of NoSQL?
  1. Key Value
  2. Column Oriented
  3. Document Oriented
  4. Graph



Question: What is Namespace in MongoDB?
A Namespace is the concatenation of the "database name" and "collection name"


Question: Does  MongoDB provide drivers for PHP?
MongoDB provide the drivers for C, C++, C#, Java, Node.js, Perl, PHP, Python, Ruby, Scala, Go and Erlang.


Question: What difference between MongoDB and SQL?
MongoDB allows a highly flexible and scalable document structure.
For e.g. one data document in MongoDB can have five columns &  other one in the same collection can have ten columns. Also, MongoDB database are faster as compared to SQL databases due to efficient indexing and storage techniques.


Question: Does MongoDB support foreign key relationships in MongoDB?
No,Its does not support
But we achieve this concept by embedding one document inside another.


Does MongoDB need lot of RAM?
No, It need less than as compare to other database like SQL,MySQL.
MongoDB dynamically allocates and de-allocates RAM based on the requirements of other processes.


Question: What is the structure of ObjectID in MongoDB?
ObjectID is a 12-byte BSON type with:
4 bytes value representing seconds
3 byte machine identifier
2 byte process id
3 byte counter


Question: How many indexes does MongoDB create by default for a new collection?
By default, MongoDB created the _id collection for every collection.


Question: Explain what are indexes in MongoDB?
Indexes are special structures in MongoDB, which stores a small portion of the data set in an easy to traverse form.


Question: What is sharding in MongoDB?
The procedure of storing data records across multiple machines is referred as Sharding.


Question: How can you see the connection used by Mongos?
To see the connection used by Mongos use db_adminCommand ('connPoolStats');


Question: Explain what is a replica set?
A replica set is a group of mongo instances that host the same data set.


Question: Mention what is the command syntax for inserting a document?
database.collection.insert (document).


Question: Explain what is GridFS in MongoDB?
For storing and retrieving large files such as images, video and audio GridFS is used.


Question: What are alternatives to MongoDB?
Cassandra, CouchDB, Redis, Riak, HBase


Thursday, 18 August 2016

How to get visitor location with JavaScript ?

How to get visitor location with JavaScript ?

Today there are lots Free/Paid API avaiable which give you client information.
Following are two example which give you client information like city, country, country code, ip, local date time, timezone etc with javascript.
Question: How to get visitor location javascript with freegeoip.net?
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script>
$(document).ready( function() {
   $.getJSON("http://freegeoip.net/json/", function(result){
       console.log(result);                        

       });
   });

Output
{  "ip": "112.196.3.177",
  "country_code": "IN",
  "country_name": "India",
  "region_code": "PB",
  "region_name": "Punjab",
  "city": "Mohali",
  "zip_code": "",
  "time_zone": "Asia/Kolkata",
  "latitude": 30.78,
  "longitude": 76.69,
  "metro_code": 0
}



Question: How to get visitor location javascript with ipinfo.io?

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script>
$(document).ready( function() {
   $.getJSON('http://ipinfo.io', function(data){
    console.log(data)
  })
    }); 
</script>

Output
  {"ip": "112.196.3.177",
  "hostname": "No Hostname",
  "city": "Mohali",
  "region": "Punjab",
  "country": "IN",
  "loc": "30.7800,76.6900",
  "org": "AS17917 Quadrant Televentures Limited"
}



Wednesday, 17 August 2016

Bootstrap Interview Questions and Answers for 3 Month Experience

Bootstrap Interview Questions and Answers for 3 Month Experience

Question: Why Use Bootstrap?
  1. Responsive features: Website built using bootstrop will automatically adjust themselves on all devices like all type phone, ipad, and all type of desktop/laptop.
  2. Bootstrap is compatibile with all browser (mobile and desktop).
  3. Easy to start.
  4. Fast development


Question: How to start Bootstrap without downloading?
Just including following files in web page, and start working on bootstrp.

<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"></link>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>


Question: What doctype use by bootstrap?
Just including following files in web page, and start working on bootstrap.
HTML5 doctype



Question: What are meta tag require to set for proper rending in mobile?
<meta name="viewport" content="width=device-width, initial-scale=1">


Question: Which main class need to declare for fixed layout and fluid layout?
.container For fixed layout.
.container-fluid For fluid layout.


Question: How many column are allowed in Bootstrap Grid System?
12


Question: How many Grid Classes are available in Bootstrap Grid System?
4
  1. xs: phones
  2. sm : tablets
  3. md : desktops
  4. lg : large desktops



Question: Basic Structure of a Bootstrap Grid?
<div class="row">
<div class="col-*-*">
</div>
</div>
<div class="row">
<div class="col-*-*">
</div>
<div class="col-*-*">
</div>
<div class="col-*-*">
</div>
</div>




Question: What are Structure of Bootstrap Grid?
What are Structure of Bootstrap Grid



Question: What are the classes used for Success and warning?
.bg-primary: Important message.
.bg-success: successful message.
.bg-info: Informatoinal message.
.bg-warning: Warning message.
.bg-danger: Represent message.



Question: How to make an image Rounded Corners?
Just add below class in img tag.
.img-rounded



Question: How to make an image Responsive?
Just add below class in img tag.
.img-responsive



Question: How to make an youtube video as Responsive?
Just add below class in iframe tag.
.embed-responsive-item



Question: How to make an div with rounded border?
Just add below class in tag.
.well



Question: How to make display successful or failure message with cross link?

<div class="container">
<h2>
Alerts</h2>
The .fade and .in classes adds a fading effect when closing the alert message.<br />
<div class="alert alert-success fade in">
<a aria-label="close" class="close" data-dismiss="alert" href="https://www.blogger.com/blogger.g?blogID=5911253879674558037#">&#215;</a>
    <strong>Success!</strong> Successful Message.
  </div>
<div class="alert alert-info fade in">
<a aria-label="close" class="close" data-dismiss="alert" href="https://www.blogger.com/blogger.g?blogID=5911253879674558037#">&#215;</a>
    <strong>Info!</strong> Informational Message.
  </div>
<div class="alert alert-warning fade in">
<a aria-label="close" class="close" data-dismiss="alert" href="https://www.blogger.com/blogger.g?blogID=5911253879674558037#">&#215;</a>
    <strong>Warning!</strong> Warning Message.
  </div>
<div class="alert alert-danger fade in">
<a aria-label="close" class="close" data-dismiss="alert" href="https://www.blogger.com/blogger.g?blogID=5911253879674558037#">&#215;</a>
    <strong>Danger!</strong> Something danger.
  </div>
</div>



Thursday, 11 August 2016

How to Convert Youtube Data API V3 video duration format to seconds in PHP?

How to Convert Youtube Data API V3 video duration format to seconds in PHP?

We get the youTube Video duration in below way from Youtube V3 API.
 "contentDetails": {
    "duration": "PT15S",
    "dimension": "2d",
    "definition": "sd",
    "caption": "false",
    "licensedContent": true,
    "projection": "rectangular"
   },

Now, We need to convert the duration to number of seconds.
Following are Simple PHP Function which convert the API V3 video duration format to number of seconds.
 function duration($ytDuration) {
    $di = new DateInterval($ytDuration);
    
    $totalSec = 0;
    if ($di->h > 0) {
      $totalSec+=$di->h*3600;
    }
    if ($di->i > 0) {
      $totalSec+=$di->i*60;
    }
    $totalSec+=$di->s;
    
    return $totalSec;
  }
$youtubeTime = 'PT15S';
 echo duration($youtubeTime);//15
 
 
$youtubeTime = 'PT2M55S'; 
echo duration($youtubeTime);//175

$youtubeTime = 'PT1H35M23S'; 
echo duration($youtubeTime);//5723

Wednesday, 10 August 2016

Twitter Bootstrap Interview Questions and Answers


Twitter Bootstrap Interview Questions and Answers

Question: How to make twitter bootstrap menu dropdown on hover rather than click?
ul.nav li.dropdown:hover > ul.dropdown-menu {
    display: block;    
}



Question: How can I make Bootstrap columns all the same height??
.row {
  display: -webkit-box;
  display: -webkit-flex;
  display: -ms-flexbox;
  display: flex;
  flex-wrap: wrap;
}
.row > [class*='col-'] {
  display: flex;
  flex-direction: column;
}



Question: What is sr-only in Bootstrap 3??
It is class used to hide information intended only for screen readers from the layout of the rendered page.


Question: How to disallow twitter bootstrap modal window from closing?
<a data-backdrop="static" data-controls-modal="my_div_id" data-keyboard="false" href="https://www.blogger.com/blogger.g?blogID=5911253879674558037#"></a>



Question: What are different 4 tiers in twitter bootstrap?
  1. Extra small devices like smartphones (.col-xs-*)
  2. Small devices like tablets(.col-sm-*)
  3. Medium devices like laptops (.col-md-*)
  4. large devices like laptops/desktops(.col-lg-*)



Question: How to use media queries in twitter bootstrap 3?
@media(max-width:767px){}
@media(min-width:768px){}
@media(min-width:992px){}
@media(min-width:1200px){}



Question: How to use media queries in twitter bootstrap 4?
@media(min-width:34em){}
@media(min-width:48em){}
@media(min-width:62em){}
@media(min-width:75em){}



Question: What is an em?
An em is a unit in the field of typography, One em is equal to the 16 point size.



Question: How to open a Bootstrap modal?
$('#myModalId').modal('toggle');
$('#myModalId').modal('show');
$('#myModalId').modal('hide');
 



Question: How to make responsive image with align center?
.img-responsive {
    margin: 0 auto;
}
 



Question: How to create Confirm box before deleting modal/dialog?
Add data-target="#confirm-delete-id" in A tag

<a data-href="/delete-rec?id=203" data-target="#confirm-delete-id" data-toggle="modal" href="https://www.blogger.com/blogger.g?blogID=5911253879674558037#">Delete record #203</a>
 

Add HTML for confirmation box
<div aria-hidden="true" aria-labelledby="myModalLabel" class="modal fade" id="confirm-delete-id" role="dialog" tabindex="-1">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
</div>
<div class="modal-body">
</div>
<div class="modal-footer">
<button class="btn btn-default" data-dismiss="modal" type="button">Cancel</button>
                <a class="btn btn-danger btn-ok" href="https://www.blogger.com/null">Delete</a>
            </div>
</div>
</div>
</div>

 



Question: How to disabled the button?
$('#buttonId').prop('disabled', true);
 



Tuesday, 9 August 2016

What is RTMP, RTMPT, RTMPE, RTMPTE and RTMPS protocol?

What is  RTMP, RTMPT, RTMPE, RTMPTE and RTMPS protocol?

Question: What is RTMP?
The Real-Time Messaging Protocol (RTMP) is a streaming protocol designed by Adobe for transmission of audio, video between the flash player and server.


Question: What is RTMPT?
RTMPT is tunneled Version of RTMP.
RTMPT is designed to get rid of firewalls by sending stream packets through the standard web port.


Question: Which is better RTMP OR RTMPT?
RTMP performance is better that RTMPT.
We should use RTMPT only when RTMP is not possible due to firewalls.


Question: What is RTMPE?
RTMPE is encrypted version of RTMP.
Basically In RTMPE there is an additional security level as compare to RTMP.


Question: What is RTMPTE?
RTMPTE is encrypted version of RTMPT.
Basically In RTMPTE there is an additional security level as compare to RTMPT.


Question: What is RTMPS?
RTMPS is RTMP over a TLS/SSL connection.


Question: What is RTMFP?
Full form of RTMFP is  Secure Real-Time Media Flow Protocol. This protocol is developed by Adobe Systems for encrypted. It is efficient multimedia delivery through both client-server and peer-to-peer models over the Internet.


Question: Who uses the 1935 port by default?
RTMP and RTMPE with TCP Transport.
RTMFP with with UDP Transport.



Question: What are different ports used by Media Servers?
Following are different default ports used by Media Server.
Port Protocol Transport
1935 RTMP/E TCP
1935 RTMFP UDP
80 RTMP, RTMPT, HTTP TCP
8134 HTTP TCP
1111 HTTP, RTMP TCP

Question: What is TCP?
Full form of TCP is Transmission Control Protocol.
It is standard that defines how to establish and maintain a network conversation.
It can also work with IP (internet protocol), which define how to exchange packet of data with each other.
TCP keep maintained the connection til the programs finished their exchanging messages.


Question: What is UCP?
Full form of UDP is User Datagram Protocol.
UDP is communications protocol to TCP used primarily for establishing low-latency and loss tolerating connections between applications on the Internet.




Friday, 5 August 2016

What html tags are allowed by wordpress.com?

What html tags are allowed by wordpress.com?

Question: What html tags are allowed by wordpress.com?
Following HTML Tags are allowed in wordpress.com
.
 
address,
a, 
abbr, 
acronym, 
area, 
article, 
aside, 
b, 
big, 
blockquote, 
br, 
caption, 
cite, 
class, 
code, 
col, 
del, 
details, 
dd, 
div, 
dl, 
dt, 
em, 
figure, 
figcaption, 
footer, 
font, 
h1, h2, h3, h4, h5, h6, header, hgroup, hr, i, img, ins, kbd, li, map, ol, p, pre, q, s, section, small, span, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, var





Question: Can we add javascript in wordpress.com?
No, You can add.
script Tags are not allowed.



Question: How to embed youtube video?
Just add following code in post.
[youtube=http://www.youtube.com/watch?v=w0wflz6Iwqs]



Question: Give list of URL which videos is allowed by wordpress.com?
 
YouTube
Vimeo
DailyMotion
blip.tv
Flickr (both videos and images)
Viddler
Hulu
Qik
Revision3
Scribd
Photobucket
PollDaddy
Google Video
WordPress.tv (only VideoPress-type videos for the time being)
SmugMug (WordPress 3.0+)
FunnyOrDie.com (WordPress 3.0+)



Tuesday, 2 August 2016

How to install Laravel 5 on wamp server

How to install Laravel 5 on wamp server

We are going to install Laravel5.0 on wamp server in windows.


Question: What are system requirement for laravel5.0?
Following are system requirements:
  1. PHP >= 5.4, PHP < 7
  2. Mcrypt PHP Extension
  3. OpenSSL PHP Extension
  4. Mbstring PHP Extension
  5. Tokenizer PHP Extension



Question: How to install Laravel5.0?
  1. You must have composer. If not install composer.
  2. Create a folder where you want to install the laravel. Supppose
    E:\wamp\www\laravel
  3. Login to Command Prompt and go the "E:\wamp\www\laravel" using cd command.
  4. Execute following command
    composer create-project laravel/laravel laravel "5.0.*" --prefer-dist
  5. Set the document_path to "E:\wamp\www\laravel\public" OR You can use virtual host for this. In any ways file must point to public folder first.



Monday, 1 August 2016

Laravel cache interview questions and answers


Question: How to Store an value in cache?
$expiresAt = Carbon::now()->addMinutes(10);
Cache::put('name', 'My Name is Anurag', $expiresAt); //store for 20 mins



Question: How to Check an value stored in cache?
if (Cache::has('name'))
{
    
}



Question: How to Get an value stored in cache?
if (Cache::has('name'))
{
    $name = Cache::get('name');//My Name is Anurag
    
}



Question: How to Get an value from cache, If Not set get Default?
    $name = Cache::get('name2','unknown');//Return "unknown"



Question: How to Store an value in cache Permanently?
Cache::forever('name', 'My Name is Anurag'); //store Permanently



Question: Get value from cache, If not then set a default value?
$expiresAt = Carbon::now()->addMinutes(10);
$value = Cache::remember('users', $expiresAt, function(){
    return DB::table('users')->get();
});



Question: Get value from cache, If not then Delete?
$value = Cache::pull('name');



Question: Remove an Item from cache?
Cache::forget('name');



Question: Store an Integer value in cache?
Cache::put('sr', 10);



Question: Increase the Integer value in cache?
Cache::increment('sr');//change from 10 to 11



Question: Decrease the Integer value in cache?
Cache::decrement('sr');//change from 11 to 10



Question: Store an value in cache with tag?
Cache::tags('Tag1','Tag2')->put('name', 'My Name is Anurag', $minutes);