tag:blogger.com,1999:blog-5257723850294207762024-02-08T12:17:03.684-08:00QAPHPAdminhttp://www.blogger.com/profile/14542194883814306401noreply@blogger.comBlogger5125tag:blogger.com,1999:blog-525772385029420776.post-22527114264425430002012-07-24T04:58:00.000-07:002012-07-24T05:01:57.424-07:00What is JSON?<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="background-color: white; font-family: Verdana, sans-serif;"><b>JSON</b> is JavaScript Object Notation. It is a lightweight data-interchange format and language independent also. It is easy for humans to </span><span style="background-color: white; font-family: Verdana, sans-serif;">read and write. It is easy for machines to parse and generate. It is based on a subset of the JavaScript Programming Language. <b>JSON</b> is a </span><span style="background-color: white; font-family: Verdana, sans-serif;">text format that is completely language independent but uses conventions that are familiar to programmers of the C-family of languages, </span><span style="background-color: white; font-family: Verdana, sans-serif;">including C, C++, C#, Java, JavaScript etc. These properties make <b>JSON </b>an ideal data-interchange language.</span><br />
<span style="background-color: white; font-family: Verdana, sans-serif;"><br /></span><br />
<span style="background-color: white; font-family: Verdana, sans-serif;">JSON data comes in two structures</span><br />
<ol style="text-align: left;">
<li><span style="background-color: white;"><span style="font-family: Verdana, sans-serif;">Name/Value pairs </span></span></li>
<li><span style="background-color: white;"><span style="font-family: Verdana, sans-serif;">An ordered list of values</span></span></li>
</ol>
<span style="background-color: white; font-family: Verdana, sans-serif;">These are universal data structures. Virtually all modern programming languages support them in one form or another.</span><br />
<span style="font-family: Verdana, sans-serif;">JSON value can be string, number, null, array, object.</span><br />
<span style="background-color: white; font-family: Verdana, sans-serif;">JSON data can one of these form(s).</span><br />
<span style="background-color: white; font-family: Verdana, sans-serif;"><br /></span><br />
<b style="background-color: white; font-family: Verdana, sans-serif;">Name/Value pair</b><br />
<span style="font-family: Verdana, sans-serif;">JSON data is written as name/value pairs.</span><br />
<span style="font-family: Verdana, sans-serif;">A name/value pair consists of a field name in double quotes, followed by a colon, followed by a value.</span><br />
<span style="font-family: Verdana, sans-serif;">e.g. "age" : "28"</span><br />
<span style="font-family: Verdana, sans-serif;"><br /></span><br />
<b style="background-color: white; font-family: Verdana, sans-serif;">JSON Objects</b><br />
<span style="font-family: Verdana, sans-serif;">JSON objects are written inside curly brackets,</span><br />
<span style="font-family: Verdana, sans-serif;">Objects can contain multiple name/values pairs:</span><br />
<span style="font-family: Verdana, sans-serif;">e.g. { "Name":"John" , "age":"28" } </span><br />
<span style="font-family: Verdana, sans-serif;"><br /></span><br />
<b style="background-color: white; font-family: Verdana, sans-serif;">JSON Arrays</b><br />
<span style="font-family: Verdana, sans-serif;">JSON arrays are written inside square brackets.</span><br />
<span style="font-family: Verdana, sans-serif;">An array can contain multiple objects:</span><br />
<span style="font-family: Verdana, sans-serif;">e.g. {</span><br />
<span style="font-family: Verdana, sans-serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>"employees": </span><br />
<span style="font-family: Verdana, sans-serif;"> [</span><br />
<span style="font-family: Verdana, sans-serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>{ "Name":"John" , "age":"28" },</span><br />
<span style="font-family: Verdana, sans-serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>{ "Name":"mick" , "age":"23" }</span><br />
<span style="font-family: Verdana, sans-serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span> ]</span><br />
<span style="font-family: Verdana, sans-serif;"> }</span><br />
<span style="font-family: Verdana, sans-serif;"><br /></span><br />
<span style="font-family: Verdana, sans-serif;">The MIME type for JSON text is "application/json".</span></div>Adminhttp://www.blogger.com/profile/14542194883814306401noreply@blogger.com0tag:blogger.com,1999:blog-525772385029420776.post-55515478610036045912012-06-11T23:49:00.002-07:002012-07-09T03:03:52.823-07:00What is codec?<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="font-family: Verdana, sans-serif;"><br /></span><br />
<div style="margin-bottom: .0001pt; margin: 0in;">
<span style="font-family: Verdana, sans-serif;">A<span class="apple-converted-space"> </span><b>codec</b><span class="apple-converted-space"> </span>is a program, capable of encoding or
decoding a digital data stream or signal. The word codec is a short form
of "compressor - decompressor" or "<b>coder - decoder</b>",
takes a raw data file and turns it into a compressed file.<o:p></o:p></span></div>
<div style="margin-bottom: .0001pt; margin: 0in;">
<span style="font-family: Verdana, sans-serif;">A<span class="apple-converted-space"> </span><b>codec</b><span class="apple-converted-space"> </span>encodes a data stream or<span class="apple-converted-space"> </span><b>signal</b><span class="apple-converted-space"> </span>for transmission, storage or
encryption, or decodes it for playback or editing.<o:p></o:p></span></div>
<div style="margin-bottom: .0001pt; margin: 0in;">
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div style="margin-bottom: .0001pt; margin: 0in;">
<span style="font-family: Verdana, sans-serif;"><b>Why we need codec?</b><o:p></o:p></span></div>
<div style="margin-bottom: .0001pt; margin: 0in;">
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div style="margin-bottom: .0001pt; margin: 0in;">
<span style="font-family: Verdana, sans-serif;">video and audio files are
large, so difficult to transfer across the Internet quickly. To help speed up
downloads, mathematical "<b>codecs</b>" were built to encode
("shrink") a signal for transmission and then decode it for viewing
or editing. Without<span class="apple-converted-space"> </span><b>codecs</b>,
downloads would take three to five times longer than they do now.<o:p></o:p></span></div>
<div style="margin-bottom: .0001pt; margin: 0in;">
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div style="margin-bottom: .0001pt; margin: 0in;">
<span style="font-family: Verdana, sans-serif;"><b><span style="background-color: white;">What are the
common codecs people use?</span></b><o:p></o:p></span></div>
<div style="margin-bottom: .0001pt; margin: 0in;">
<span style="font-family: Verdana, sans-serif;"><b><br />
</b><span style="background-color: white;">Some<span class="apple-converted-space"> </span><b>codec<span class="apple-converted-space"> </span></b>examples are MP3, WMA, RealVideo,
RealAudio, DivX and XviD. There are many other more obscure<span class="apple-converted-space"> </span><b>codecs</b>.</span><o:p></o:p></span></div>
<div style="margin-bottom: .0001pt; margin: 0in;">
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div style="line-height: 13.5pt; margin-bottom: .0001pt; margin: 0in;">
<span style="font-family: Verdana, sans-serif;"><b><span style="background-color: white;">what is Audio codec?</span></b><o:p></o:p></span></div>
<div style="line-height: 13.5pt; margin-bottom: .0001pt; margin: 0in;">
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div style="line-height: 13.5pt; margin-bottom: .0001pt; margin: 0in;">
<span style="font-family: Verdana, sans-serif;"><span style="background-color: white;">An audio<span class="apple-converted-space"> </span><b>codec<span class="apple-converted-space"> </span></b>converts analog audio signals into
digital signals for transmission or storage. A receiving device then converts
the digital signals back to analog using an audio decompressor, for playback.
Example of this are the codecs used in the sound cards of personal computers.</span><o:p></o:p></span></div>
<div style="line-height: 13.5pt; margin-bottom: .0001pt; margin: 0in;">
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div style="margin-bottom: .0001pt; margin: 0in;">
<span style="font-family: Verdana, sans-serif;"><b><span style="background-color: white;">what is Video
codec?</span></b><o:p></o:p></span></div>
<div style="margin-bottom: .0001pt; margin: 0in;">
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div style="margin-bottom: .0001pt; margin: 0in;">
<span style="background-color: white; font-family: Verdana, sans-serif;">An video<span class="apple-converted-space"> </span><b>codec<span class="apple-converted-space"> </span></b>converts analog video signals into
digital signals for transmission or storage. A receiving device then converts
the<span class="apple-converted-space"> </span><b>digital signals</b><span class="apple-converted-space"> </span>back to analog using video
decompressor.</span></div>
<div style="line-height: 18.0pt; margin-bottom: .0001pt; margin: 0in;">
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div style="line-height: 18.0pt; margin-bottom: .0001pt; margin: 0in;">
<span style="font-family: Verdana, sans-serif;"><span style="background-color: white; color: #333333;">Means if there is a string with double quotes and if you
place a variable in that, it will substitute its value in string.</span><o:p></o:p></span></div>
<div style="margin-bottom: .0001pt; margin: 0in;">
<span style="font-family: Verdana, sans-serif;"><span style="color: #333333;">This is the main difference.</span><o:p></o:p></span></div>
<span style="background-color: white; font-family: Verdana, sans-serif; line-height: 115%;">Reference : </span><span style="line-height: 115%;"><a href="http://www.scriptvenue.com/2011/10/difference-between-double-quotes-and-single-quotes-in-php/" target="_blank"><span style="font-family: Verdana, sans-serif; line-height: 115%;">http://www.scriptvenue.com/2011/10/difference-between-double-quotes-and-single-quotes-in-php/</span></a></span></div>Adminhttp://www.blogger.com/profile/14542194883814306401noreply@blogger.com0tag:blogger.com,1999:blog-525772385029420776.post-3313699445774189042012-06-11T23:48:00.004-07:002012-06-12T06:40:05.894-07:00What is a Payment Gateway?<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="font-family: Verdana, sans-serif;"><br /></span><br />
<div style="margin-bottom: .0001pt; margin: 0in;">
<span style="font-family: Verdana, sans-serif;">A<span class="apple-converted-space"> </span><a href="http://www.scriptvenue.com/2012/05/what-is-a-payment-gateway/"><span style="color: #000fff;">payment
gateway</span></a><span class="apple-converted-space"> </span>is a
technique to process transactions electronically. Payment gateways provide the
tools to process payments between customers, businesses, and banks.A payment<span class="apple-converted-space"> </span><a href="http://www.scriptvenue.com/2012/05/what-is-a-payment-gateway/"><span style="color: #000fff;">gateway</span></a><span class="apple-converted-space"> </span>is a necessary part of the transaction
between customer, business and the banking institutions that both are using. A
payment gateway is used to facilitate electronic transactions. These are
very safe, as it uses Encryption of payment and personal data.<o:p></o:p></span></div>
<div style="margin-bottom: .0001pt; margin: 0in;">
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div style="margin-bottom: .0001pt; margin: 0in;">
<span style="font-family: Verdana, sans-serif;">Reference : </span><a href="http://www.scriptvenue.com/2012/05/what-is-a-payment-gateway/"><span style="font-family: Verdana, sans-serif;">http://www.scriptvenue.com/2012/05/what-is-a-payment-gateway/</span></a><span style="font-family: Verdana, sans-serif;"> </span><span style="font-size: 13.5pt;"><o:p></o:p></span></div>
</div>Adminhttp://www.blogger.com/profile/14542194883814306401noreply@blogger.com0tag:blogger.com,1999:blog-525772385029420776.post-55921662248634863792012-06-11T23:48:00.002-07:002012-06-12T06:40:23.028-07:00What is CURL ?<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="font-family: Verdana, sans-serif;"><br /></span><br />
<div class="MsoNormal" style="line-height: 13.5pt; margin-bottom: .0001pt; margin-bottom: 0in;">
<a href="http://www.scriptvenue.com/2012/05/what-is-curl/" target="_blank"><span style="color: blue; font-family: Verdana, sans-serif;"><br />
</span><span style="color: blue; font-family: Verdana, sans-serif;">cURL</span></a><span style="font-family: Verdana, sans-serif;"> </span><span style="font-family: Verdana, sans-serif;">means</span><span style="font-family: Verdana, sans-serif;"> </span><a href="http://www.scriptvenue.com/2012/05/what-is-curl/" target="_blank"><b><span style="color: blue; font-family: Verdana, sans-serif;">client URL</span></b></a><span style="font-family: Verdana, sans-serif;">, allows you to connect and communicate to many
different types of servers with many different types of protocols.<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: 13.5pt; margin-bottom: .0001pt; margin-bottom: 0in;">
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div class="MsoNormal" style="line-height: 13.5pt; margin-bottom: .0001pt; margin-bottom: 0in;">
<span style="font-family: Verdana, sans-serif;">It supports the</span><span style="font-family: Verdana, sans-serif;"> </span><b><span style="font-family: Verdana, sans-serif;">http,
https, ftp, gopher, telnet, dict, file</span></b><span style="font-family: Verdana, sans-serif;">, and</span><span style="font-family: Verdana, sans-serif;"> </span><b><span style="font-family: Verdana, sans-serif;">ldap</span></b><b><span style="font-family: Verdana, sans-serif;"> </span></b><span style="font-family: Verdana, sans-serif;">protocols.<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: 13.5pt; margin-bottom: .0001pt; margin-bottom: 0in;">
<span style="font-family: Verdana, sans-serif;">To use CURL we use libcurl library. libcurl library is by
default built-in in XAMPP. To check weather it is supports or not, check a
phpinfo() program to see if you now have curl support listed. if it is not,
then <o:p></o:p></span></div>
<ul type="disc">
<li class="MsoNormal"><span style="font-family: Verdana, sans-serif;">find php.ini
file.<o:p></o:p></span></li>
<li class="MsoNormal"><span style="font-family: Verdana, sans-serif;">search for the
line ;extension=php_curl.dll <o:p></o:p></span></li>
<li class="MsoNormal"><span style="font-family: Verdana, sans-serif;">remove the
semicolon from the beginning of the line.<o:p></o:p></span></li>
<li class="MsoNormal"><span style="font-family: Verdana, sans-serif;">save the file
and restart apache.<o:p></o:p></span></li>
</ul>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div class="MsoNormal" style="line-height: 13.5pt; margin-bottom: .0001pt; margin-bottom: 0in;">
<span style="font-family: Verdana, sans-serif;">check a</span><span style="font-family: Verdana, sans-serif;"> </span><b><span style="font-family: Verdana, sans-serif;">phpinfo()</span></b><span style="font-family: Verdana, sans-serif;"> </span><span style="font-family: Verdana, sans-serif;">again. it is supportable now.<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: 13.5pt; margin-bottom: .0001pt; margin-bottom: 0in;">
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div class="MsoNormal" style="line-height: 13.5pt; margin-bottom: .0001pt; margin-bottom: 0in;">
<span style="font-family: Verdana, sans-serif;">libcurl also supports HTTPS certificates, HTTP POST, HTTP PUT etc.<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: 13.5pt; margin-bottom: .0001pt; margin-bottom: 0in;">
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div class="MsoNormal" style="line-height: 13.5pt; margin-bottom: .0001pt; margin-bottom: 0in;">
<b><span style="font-family: Verdana, sans-serif;">There are some function which we use, while using libcurl.</span></b><span style="font-family: Verdana, sans-serif;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<ul type="disc">
<li class="MsoNormal"><span style="font-family: Verdana, sans-serif;">curl_init() :
It Initialize a cURL session.<o:p></o:p></span></li>
<li class="MsoNormal"><span style="font-family: Verdana, sans-serif;">curl_setopt :
It sets an option for a cURL transfer.e.g. (CURLOPT_URL, CURLOPT_POSTFIELDS, CURLOPT_RETURNTRANSFER
etc. these are some predefined constants.)<o:p></o:p></span></li>
<li class="MsoNormal"><span style="font-family: Verdana, sans-serif;">curl_exec()
: Run a cURL session.<o:p></o:p></span></li>
</ul>
<span style="font-family: Verdana, sans-serif; line-height: 115%;">curl_close() : Close a cURL session.</span></div>Adminhttp://www.blogger.com/profile/14542194883814306401noreply@blogger.com0tag:blogger.com,1999:blog-525772385029420776.post-86163844946088689392012-06-11T23:17:00.000-07:002012-06-12T06:40:33.129-07:00Difference between double quotes and single quotes in PHP<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="font-family: Verdana, sans-serif;"><br /></span><br />
<div style="margin-bottom: .0001pt; margin: 0in;">
</div>
<div style="margin-bottom: .0001pt; margin: 0in;">
<span style="font-family: Verdana, sans-serif;"><span style="background-color: white; color: #333333;">In PHP
string data is enclosed in quotes either single or double quotes. But sometimes
programmers get confused in difference between single quote and double quote.</span><o:p></o:p></span></div>
<div style="margin-bottom: .0001pt; margin: 0in;">
<span style="font-family: Verdana, sans-serif;"><span style="color: #333333;">Let me tell you what is main<span class="apple-converted-space"> </span></span><a href="http://www.scriptvenue.com/2011/10/difference-between-double-quotes-and-single-quotes-in-php/" target="_blank">difference
between single quotes and double quotes</a><span class="apple-converted-space"><span style="color: #333333;"> </span></span><span style="color: #333333;">theoretically & also practically too.</span><o:p></o:p></span></div>
<div style="margin-bottom: .0001pt; margin: 0in;">
<span style="font-family: Verdana, sans-serif;"><span style="color: #333333;">Single quotes do not support
variable expansion but double quotessupport.Means if there is a string with
single quotes and if you place a variable in that, it won’t substitute its
value in string.</span><o:p></o:p></span></div>
<div style="line-height: 18.0pt; margin-bottom: .0001pt; margin: 0in;">
<span style="font-family: Verdana, sans-serif;"><span style="color: #333333;">e.g.</span><o:p></o:p></span></div>
<div style="line-height: 18.0pt; margin-bottom: .0001pt; margin: 0in;">
<span style="font-family: Verdana, sans-serif;"><span style="color: #333333;"><?PHP</span><o:p></o:p></span></div>
<div style="line-height: 18.0pt; margin-bottom: .0001pt; margin: 0in;">
<span style="font-family: Verdana, sans-serif;"><span style="color: #333333;"> $str = 'QAPHP';</span><o:p></o:p></span></div>
<div style="line-height: 18.0pt; margin-bottom: .0001pt; margin: 0in;">
<span style="font-family: Verdana, sans-serif;"><span style="color: #333333;"> echo '$str is a Blog which provides
Question & Answers.';</span><o:p></o:p></span></div>
<div style="line-height: 18.0pt; margin-bottom: .0001pt; margin: 0in;">
<span style="font-family: Verdana, sans-serif;"><span style="color: #333333;">?></span><o:p></o:p></span></div>
<div style="line-height: 18.0pt; margin-bottom: .0001pt; margin: 0in;">
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div style="line-height: 18.0pt; margin-bottom: .0001pt; margin: 0in;">
<span style="font-family: Verdana, sans-serif;"><span style="color: #333333;">Output
will be:: $str is a site which provides Question & Answers.</span><o:p></o:p></span></div>
<div style="line-height: 18.0pt; margin-bottom: .0001pt; margin: 0in;">
<span style="font-family: Verdana, sans-serif;"><span style="color: #333333;">In
case of double quoted string…</span><o:p></o:p></span></div>
<div style="line-height: 18.0pt; margin-bottom: .0001pt; margin: 0in;">
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div style="line-height: 18.0pt; margin-bottom: .0001pt; margin: 0in;">
<span style="font-family: Verdana, sans-serif;"><span style="color: #333333;"><?PHP</span><o:p></o:p></span></div>
<div style="line-height: 18.0pt; margin-bottom: .0001pt; margin: 0in;">
<span style="font-family: Verdana, sans-serif;"><span style="color: #333333;"> $str = 'QAPHP';</span><o:p></o:p></span></div>
<div style="line-height: 18.0pt; margin-bottom: .0001pt; margin: 0in;">
<span style="font-family: Verdana, sans-serif;"><span style="color: #333333;"> echo "$str is a site which
provides tips.";</span><o:p></o:p></span></div>
<div style="line-height: 18.0pt; margin-bottom: .0001pt; margin: 0in;">
<span style="font-family: Verdana, sans-serif;"><span style="color: #333333;">?></span><o:p></o:p></span></div>
<div style="line-height: 18.0pt; margin-bottom: .0001pt; margin: 0in;">
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div style="line-height: 18.0pt; margin-bottom: .0001pt; margin: 0in;">
<span style="font-family: Verdana, sans-serif;"><span style="color: #333333;">Output
will be:: QAPHP is a Blog which provides Question & Answers.</span><o:p></o:p></span></div>
<div style="line-height: 18.0pt; margin-bottom: .0001pt; margin: 0in;">
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div style="line-height: 18.0pt; margin-bottom: .0001pt; margin: 0in;">
<span style="font-family: Verdana, sans-serif;"><span style="background-color: white; color: #333333;">Means if there is a string with double quotes and if you
place a variable in that, it will substitute its value in string.</span><o:p></o:p></span></div>
<div style="margin-bottom: .0001pt; margin: 0in;">
<span style="font-family: Verdana, sans-serif;"><span style="color: #333333;">This is the main difference.</span><o:p></o:p></span></div>
<span style="font-family: Verdana, sans-serif;"><span style="background-color: white; line-height: 115%;">Reference : </span><span style="line-height: 115%;"><a href="http://www.scriptvenue.com/2011/10/difference-between-double-quotes-and-single-quotes-in-php/" target="_blank"><span style="line-height: 115%;">http://www.scriptvenue.com/2011/10/difference-between-double-quotes-and-single-quotes-in-php/</span></a></span></span></div>Adminhttp://www.blogger.com/profile/14542194883814306401noreply@blogger.com0