<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>snippets &#8211; stoimen&#039;s web log</title>
	<atom:link href="/category/snippets/feed/" rel="self" type="application/rss+xml" />
	<link></link>
	<description>on web development</description>
	<lastBuildDate>Tue, 13 Feb 2018 08:18:15 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=5.0.3</generator>
	<item>
		<title>es6 swap variables</title>
		<link>/2018/02/13/es6-swap-variables/</link>
		<comments>/2018/02/13/es6-swap-variables/#respond</comments>
		<pubDate>Tue, 13 Feb 2018 08:18:15 +0000</pubDate>
		<dc:creator><![CDATA[Stoimen]]></dc:creator>
				<category><![CDATA[javascript]]></category>
		<category><![CDATA[snippets]]></category>
		<category><![CDATA[es6]]></category>
		<category><![CDATA[gist]]></category>
		<category><![CDATA[snippet]]></category>
		<category><![CDATA[swap]]></category>

		<guid isPermaLink="false">/?p=3666</guid>
		<description><![CDATA[<div class='yarpp-related-rss'>

Related posts:<ol>
<li><a href="/2010/09/03/the-better-way-to-unset-variables-in-php/" rel="bookmark" title="The Better Way to Unset Variables in PHP">The Better Way to Unset Variables in PHP </a></li>
</ol>
</div>
]]></description>
				<content:encoded><![CDATA[<p><script src="https://gist.github.com/stoimen/e81f9fd9f16ccaddbade7b0bf826c379.js"></script></p>
<div class='yarpp-related-rss'>
<p>Related posts:<ol>
<li><a href="/2010/09/03/the-better-way-to-unset-variables-in-php/" rel="bookmark" title="The Better Way to Unset Variables in PHP">The Better Way to Unset Variables in PHP </a></li>
</ol></p>
</div>
]]></content:encoded>
			<wfw:commentRss>/2018/02/13/es6-swap-variables/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Send Authenticated POST Request with Zend_Http_Client</title>
		<link>/2010/06/28/send-authenticated-post-request-with-zend_http_client/</link>
		<comments>/2010/06/28/send-authenticated-post-request-with-zend_http_client/#respond</comments>
		<pubDate>Mon, 28 Jun 2010 19:01:44 +0000</pubDate>
		<dc:creator><![CDATA[Stoimen]]></dc:creator>
				<category><![CDATA[micro tutorial]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[snippets]]></category>
		<category><![CDATA[web development]]></category>
		<category><![CDATA[zend framework]]></category>
		<category><![CDATA[Computer networking]]></category>
		<category><![CDATA[Computing]]></category>
		<category><![CDATA[Cross-site request forgery]]></category>
		<category><![CDATA[Form]]></category>
		<category><![CDATA[http]]></category>
		<category><![CDATA[Hypertext Transfer Protocol]]></category>
		<category><![CDATA[Network protocols]]></category>
		<category><![CDATA[post]]></category>
		<category><![CDATA[Representational State Transfer]]></category>
		<category><![CDATA[Technology/Internet]]></category>
		<category><![CDATA[World Wide Web]]></category>

		<guid isPermaLink="false">/?p=1697</guid>
		<description><![CDATA[There is an easy way to send requests with Zend_Http_Client either in GET and POST. Actually you can request not only with GET and POST methods, but with any other http request method. $httpClient = new Zend_Http_Client('http://..../'); // request via post $response = $httpClient->request(Zend_Http_Client::POST); // or get $response = $httpClient->request(Zend_Http_Client::GET); However the interesting and useful &#8230; <a href="/2010/06/28/send-authenticated-post-request-with-zend_http_client/" class="more-link">Continue reading <span class="screen-reader-text">Send Authenticated POST Request with Zend_Http_Client</span> <span class="meta-nav">&#8594;</span></a><div class='yarpp-related-rss'>

Related posts:<ol>
<li><a href="/2011/04/13/post-with-zend_http_client/" rel="bookmark" title="POST with Zend_Http_Client">POST with Zend_Http_Client </a></li>
<li><a href="/2010/04/14/zend_http_client-and-case-sensitivity/" rel="bookmark" title="Zend_Http_Client and Case Sensitivity">Zend_Http_Client and Case Sensitivity </a></li>
<li><a href="/2010/03/23/read-remote-file-content-type-with-zend_http_client/" rel="bookmark" title="Read Remote File Content-Type with Zend_Http_Client">Read Remote File Content-Type with Zend_Http_Client </a></li>
<li><a href="/2010/03/25/send-mail-with-zend-framework/" rel="bookmark" title="Send Mail with Zend Framework">Send Mail with Zend Framework </a></li>
</ol>
</div>
]]></description>
				<content:encoded><![CDATA[<p><a href="/wp-content/uploads/2010/06/authentication.jpg"><img src="/wp-content/uploads/2010/06/authentication.jpg" alt="" title="authentication" width="300" height="230" class="aligncenter size-full wp-image-1716" /></a><br />
There is an easy way to send requests with <a title="Zend_Http_Client" href="http://framework.zend.com/manual/en/zend.http.client.html" target="_blank">Zend_Http_Client</a> either in GET and POST. Actually you can request not only with GET and POST methods, but with any other http request method.</p>
<pre lang="php">
$httpClient = new Zend_Http_Client('http://..../');
// request via post
$response = $httpClient->request(Zend_Http_Client::POST);
// or get
$response = $httpClient->request(Zend_Http_Client::GET);
</pre>
<p>However the interesting and useful thing is that you can perform authenticated requests:</p>
<pre lang="php">
$httpClient = new Zend_Http_Client('http://username:password@example.com/');
// or define it later
$httpClient = new Zend_Http_Client('http://example.com/');
$httpClient->setAuth('username', 'password');
</pre>
<p>That&#8217;s an opportunity to send/receive authenticated POST requests.</p>
<pre lang="php">
$httpClient = new Zend_Http_Client('http://username:password@example.com/');
// now post
$httpClient->request(Zend_Http_Client::POST);
</pre>
<div class='yarpp-related-rss'>
<p>Related posts:<ol>
<li><a href="/2011/04/13/post-with-zend_http_client/" rel="bookmark" title="POST with Zend_Http_Client">POST with Zend_Http_Client </a></li>
<li><a href="/2010/04/14/zend_http_client-and-case-sensitivity/" rel="bookmark" title="Zend_Http_Client and Case Sensitivity">Zend_Http_Client and Case Sensitivity </a></li>
<li><a href="/2010/03/23/read-remote-file-content-type-with-zend_http_client/" rel="bookmark" title="Read Remote File Content-Type with Zend_Http_Client">Read Remote File Content-Type with Zend_Http_Client </a></li>
<li><a href="/2010/03/25/send-mail-with-zend-framework/" rel="bookmark" title="Send Mail with Zend Framework">Send Mail with Zend Framework </a></li>
</ol></p>
</div>
]]></content:encoded>
			<wfw:commentRss>/2010/06/28/send-authenticated-post-request-with-zend_http_client/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jQuery: Get the Selected Option Text</title>
		<link>/2010/06/22/jquery-get-the-selected-option-text/</link>
		<comments>/2010/06/22/jquery-get-the-selected-option-text/#comments</comments>
		<pubDate>Tue, 22 Jun 2010 17:33:56 +0000</pubDate>
		<dc:creator><![CDATA[Stoimen]]></dc:creator>
				<category><![CDATA[javascript]]></category>
		<category><![CDATA[micro tutorial]]></category>
		<category><![CDATA[snippets]]></category>
		<category><![CDATA[Computer programming]]></category>
		<category><![CDATA[Computing]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[markup]]></category>
		<category><![CDATA[Markup languages]]></category>
		<category><![CDATA[select]]></category>
		<category><![CDATA[snippet]]></category>
		<category><![CDATA[Technical communication]]></category>

		<guid isPermaLink="false">/?p=1660</guid>
		<description><![CDATA[What&#8217;s the Task? First of all let me explain what is the task. If there&#8217;s a select menu with several options, each of which are with a given value attribute, the task is to get the text into the option tag, and not that of the value attribute. In that scenario let&#8217;s assume that we &#8230; <a href="/2010/06/22/jquery-get-the-selected-option-text/" class="more-link">Continue reading <span class="screen-reader-text">jQuery: Get the Selected Option Text</span> <span class="meta-nav">&#8594;</span></a><div class='yarpp-related-rss'>

Related posts:<ol>
<li><a href="/2010/09/27/jquery-setting-up-a-vector-path-fill-color/" rel="bookmark" title="jQuery: Setting Up a Vector Path Fill Color">jQuery: Setting Up a Vector Path Fill Color </a></li>
<li><a href="/2011/04/05/jquery-unbind/" rel="bookmark" title="jQuery.unbind()">jQuery.unbind() </a></li>
<li><a href="/2010/02/16/jquery-tooltip-plugin/" rel="bookmark" title="jQuery tooltip plugin!">jQuery tooltip plugin! </a></li>
<li><a href="/2010/04/06/jquery-what-about-this-title/" rel="bookmark" title="jQuery: what about this.title?">jQuery: what about this.title? </a></li>
</ol>
</div>
]]></description>
				<content:encoded><![CDATA[<h2>What&#8217;s the Task?</h2>
<p>First of all let me explain what is the task. If there&#8217;s a select menu with several options, each of which are with a given value attribute, the task is to get the text into the option tag, and not that of the value attribute.</p>
<p>In that scenario let&#8217;s assume that we have the following HTML:</p>
<pre lang="html4strict">
<select id="my-select">
    <option value="1">value 1</option>
    <option value="2">value 2</option>
</select>
</pre>
<p><a href="/wp-content/uploads/2010/06/Picture-1.png"><img src="/wp-content/uploads/2010/06/Picture-1.png" alt="select menu" title="Select Menu" width="181" height="95" class="alignleft size-full wp-image-1671" /></a><br />
Note that in the official jQuery doc page, the selector is described in the same context, but with a different markup:</p>
<pre lang="html4strict">
<select id="my-select">
    <option>value 1</option>
    <option>value 2</option>
</select>
</pre>
<p>than the jQuery snippet looks like that:</p>
<pre lang="javascript">
$(document).ready(function() {
    $("#my-select").change(function() {
        alert($(this).val());
    });
});
</pre>
<p>Here&#8217;s interesting to note that there&#8217;s no value attribute set to the options, thus the selection of an element is correct and the returned value is correct. The problem is that this code doesn&#8217;t work correctly once you&#8217;ve a different value attribute, from the value enclosed into the option tag. In our case we&#8217;ve the markup shown on the first code snippet and we&#8217;d like to get the &#8220;value 2&#8221; string instead of &#8220;2&#8221;.<br />
<a href="/wp-content/uploads/2010/06/Picture-2.png"><img src="/wp-content/uploads/2010/06/Picture-2.png" alt="" title="Alert screen" width="329" height="130" class="alignleft size-full wp-image-1672" srcset="/wp-content/uploads/2010/06/Picture-2.png 329w, /wp-content/uploads/2010/06/Picture-2-300x118.png 300w" sizes="(max-width: 329px) 100vw, 329px" /></a></p>
<h2>Source Code</h2>
<pre lang="html4strict">
<select id="my-select">
    <option value="1">value 1</option>
    <option value="2">value 2</option>
</select>
</pre>
<pre lang="javascript">
$(document).ready(function() {
    $("#my-select").change(function() {
        alert($(this).val());
    });
});
</pre>
<h2>Solution</h2>
<p>Finally the solution, is pretty simple and clear, but this time is not to so &#8220;native&#8221; and it&#8217;s definitely something you couldn&#8217;t expect! The only thing you&#8217;ve to do is to change the selector!</p>
<pre lang="javascript">
$(document).ready(function() {
    $("#my-select).change(function() {
        alert($('#my-select option:selected').html());
    });
});
</pre>
<div class='yarpp-related-rss'>
<p>Related posts:<ol>
<li><a href="/2010/09/27/jquery-setting-up-a-vector-path-fill-color/" rel="bookmark" title="jQuery: Setting Up a Vector Path Fill Color">jQuery: Setting Up a Vector Path Fill Color </a></li>
<li><a href="/2011/04/05/jquery-unbind/" rel="bookmark" title="jQuery.unbind()">jQuery.unbind() </a></li>
<li><a href="/2010/02/16/jquery-tooltip-plugin/" rel="bookmark" title="jQuery tooltip plugin!">jQuery tooltip plugin! </a></li>
<li><a href="/2010/04/06/jquery-what-about-this-title/" rel="bookmark" title="jQuery: what about this.title?">jQuery: what about this.title? </a></li>
</ol></p>
</div>
]]></content:encoded>
			<wfw:commentRss>/2010/06/22/jquery-get-the-selected-option-text/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>JavaScript Comparision Snippet</title>
		<link>/2010/03/21/javascript-comparision-snippet/</link>
		<comments>/2010/03/21/javascript-comparision-snippet/#comments</comments>
		<pubDate>Sun, 21 Mar 2010 06:35:23 +0000</pubDate>
		<dc:creator><![CDATA[Stoimen]]></dc:creator>
				<category><![CDATA[javascript]]></category>
		<category><![CDATA[snippets]]></category>
		<category><![CDATA[compare]]></category>
		<category><![CDATA[operators]]></category>
		<category><![CDATA[snippet]]></category>

		<guid isPermaLink="false">/?p=1371</guid>
		<description><![CDATA[== vs. === I know this is really for beginners, but have you ever asked yourself what are the differences between == and === when comparing in JavaScript, and when to use it? Here&#8217;s an example: var a = false; alert(a === 0); // prints false That&#8217;s false. Even when both the zero and the &#8230; <a href="/2010/03/21/javascript-comparision-snippet/" class="more-link">Continue reading <span class="screen-reader-text">JavaScript Comparision Snippet</span> <span class="meta-nav">&#8594;</span></a><div class='yarpp-related-rss'>

Related posts:<ol>
<li><a href="/2011/10/21/does-javascript-undefined-equals-undefined/" rel="bookmark" title="Does JavaScript undefined Equals undefined?">Does JavaScript undefined Equals undefined? </a></li>
<li><a href="/2009/03/09/flex-javascript-communcation-example/" rel="bookmark" title="Flex Javascript communcation example">Flex Javascript communcation example </a></li>
<li><a href="/2010/02/12/how-to-detect-a-variable-existence-in-javascript/" rel="bookmark" title="How to detect a variable existence in JavaScript?">How to detect a variable existence in JavaScript? </a></li>
<li><a href="/2009/07/08/javascript-closures-in-brief/" rel="bookmark" title="JavaScript closures in brief">JavaScript closures in brief </a></li>
</ol>
</div>
]]></description>
				<content:encoded><![CDATA[<h2>== vs. ===</h2>
<p>I know this is really for beginners, but have you ever asked yourself what are the differences between <strong>==</strong> and <strong>===</strong> when comparing in JavaScript, and when to use it? Here&#8217;s an example:</p>
<pre lang="javascript">var a = false;
alert(a === 0); // prints false</pre>
<p>That&#8217;s false. Even when both the zero and the variable are faulty the entire operation is false. Because the 0 is a number and the variable a is boolean, therefore their different types give us the answer. If there was a comparision only with == the result would be true:</p>
<pre lang="javascript">var a = false;
alert(a == 0); // prints true</pre>
<p>It&#8217;s good when you expect some variable to match certain type to compare with ===. So the correct code is:</p>
<pre lang="javascript">var a = false;
alert(a === false); // prints true</pre>
<p>Here the type of a compares with boolean. See the complete <a href="http://www.stoimen.com/projects/javascript.comparision/" target="_blank">demo</a>.</p>
<div class='yarpp-related-rss'>
<p>Related posts:<ol>
<li><a href="/2011/10/21/does-javascript-undefined-equals-undefined/" rel="bookmark" title="Does JavaScript undefined Equals undefined?">Does JavaScript undefined Equals undefined? </a></li>
<li><a href="/2009/03/09/flex-javascript-communcation-example/" rel="bookmark" title="Flex Javascript communcation example">Flex Javascript communcation example </a></li>
<li><a href="/2010/02/12/how-to-detect-a-variable-existence-in-javascript/" rel="bookmark" title="How to detect a variable existence in JavaScript?">How to detect a variable existence in JavaScript? </a></li>
<li><a href="/2009/07/08/javascript-closures-in-brief/" rel="bookmark" title="JavaScript closures in brief">JavaScript closures in brief </a></li>
</ol></p>
</div>
]]></content:encoded>
			<wfw:commentRss>/2010/03/21/javascript-comparision-snippet/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>jQuery cssText Helps You Improve Browser Reflows</title>
		<link>/2010/03/17/jquery-csstext-helps-you-improve-browser-reflows/</link>
		<comments>/2010/03/17/jquery-csstext-helps-you-improve-browser-reflows/#comments</comments>
		<pubDate>Wed, 17 Mar 2010 08:32:17 +0000</pubDate>
		<dc:creator><![CDATA[Stoimen]]></dc:creator>
				<category><![CDATA[javascript]]></category>
		<category><![CDATA[snippets]]></category>
		<category><![CDATA[cssText]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[reflow]]></category>
		<category><![CDATA[snippet]]></category>

		<guid isPermaLink="false">/?p=1343</guid>
		<description><![CDATA[cssText You know you can manage to redraw an element with single browser reflow. Instead of using .style.property &#8230; you can simply add all CSS properties you&#8217;d like to change with simply appending to style.cssText property. var csstxt = $('#selector').css('cssText') + ';top:100;left:100;border:1px solid red;color:#f00;'; $('#selector').css('cssText', csstxt); That code is a replacement for $('#selector').css({ left : &#8230; <a href="/2010/03/17/jquery-csstext-helps-you-improve-browser-reflows/" class="more-link">Continue reading <span class="screen-reader-text">jQuery cssText Helps You Improve Browser Reflows</span> <span class="meta-nav">&#8594;</span></a><div class='yarpp-related-rss'>

Related posts:<ol>
<li><a href="/2009/12/23/csstext-and-how-it-can-be-very-very-useful/" rel="bookmark" title="cssText and how it can be very very useful">cssText and how it can be very very useful </a></li>
<li><a href="/2009/11/04/jquery-css-selectors-change-one-or-more-css-properties/" rel="bookmark" title="jQuery CSS selectors. Change one or more CSS properties!">jQuery CSS selectors. Change one or more CSS properties! </a></li>
<li><a href="/2010/03/11/css-priority-the-difference-between-a-my-class-and-my-class/" rel="bookmark" title="CSS Priority: The Difference Between a.my-class and .my-class">CSS Priority: The Difference Between a.my-class and .my-class </a></li>
<li><a href="/2009/03/19/jquery-ajax-script-call/" rel="bookmark" title="JQuery ajax script call">JQuery ajax script call </a></li>
</ol>
</div>
]]></description>
				<content:encoded><![CDATA[<h2>cssText</h2>
<p>You know you can manage to redraw an element with single browser <em>reflow</em>. Instead of using .style.property &#8230; you can simply add all CSS properties you&#8217;d like to change with simply appending to <em>style.cssText</em> property.</p>
<pre lang="javascript">var csstxt = $('#selector').css('cssText') + ';top:100;left:100;border:1px solid red;color:#f00;';
$('#selector').css('cssText', csstxt);</pre>
<p>That code is a replacement for</p>
<pre lang="javascript">$('#selector').css({
   left : '100px',
   top : '100px',
   border : '1px solid red',
   color : '#f00'
});</pre>
<p>enjoy!</p>
<div class='yarpp-related-rss'>
<p>Related posts:<ol>
<li><a href="/2009/12/23/csstext-and-how-it-can-be-very-very-useful/" rel="bookmark" title="cssText and how it can be very very useful">cssText and how it can be very very useful </a></li>
<li><a href="/2009/11/04/jquery-css-selectors-change-one-or-more-css-properties/" rel="bookmark" title="jQuery CSS selectors. Change one or more CSS properties!">jQuery CSS selectors. Change one or more CSS properties! </a></li>
<li><a href="/2010/03/11/css-priority-the-difference-between-a-my-class-and-my-class/" rel="bookmark" title="CSS Priority: The Difference Between a.my-class and .my-class">CSS Priority: The Difference Between a.my-class and .my-class </a></li>
<li><a href="/2009/03/19/jquery-ajax-script-call/" rel="bookmark" title="JQuery ajax script call">JQuery ajax script call </a></li>
</ol></p>
</div>
]]></content:encoded>
			<wfw:commentRss>/2010/03/17/jquery-csstext-helps-you-improve-browser-reflows/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>JavaScript Zen</title>
		<link>/2010/03/17/javascript-zen/</link>
		<comments>/2010/03/17/javascript-zen/#comments</comments>
		<pubDate>Wed, 17 Mar 2010 08:15:42 +0000</pubDate>
		<dc:creator><![CDATA[Stoimen]]></dc:creator>
				<category><![CDATA[javascript]]></category>
		<category><![CDATA[snippets]]></category>
		<category><![CDATA[Bo]]></category>
		<category><![CDATA[Crockford]]></category>
		<category><![CDATA[Defined and undefined]]></category>

		<guid isPermaLink="false">/?p=1338</guid>
		<description><![CDATA[Is undefined equal to undefined? That&#8217;s the question! Crockford says it is not, but let see the experiment. var a, b; console.log(typeof a); console.log(a === b); the answer is &#8211; it is.<div class='yarpp-related-rss'>

Related posts:<ol>
<li><a href="/2009/07/27/javascript-what-is-typeof-typeof/" rel="bookmark" title="javascript: what is typeof typeof">javascript: what is typeof typeof </a></li>
<li><a href="/2011/10/21/does-javascript-undefined-equals-undefined/" rel="bookmark" title="Does JavaScript undefined Equals undefined?">Does JavaScript undefined Equals undefined? </a></li>
<li><a href="/2009/05/24/javascript-typeof-operator/" rel="bookmark" title="JavaScript typeof operator">JavaScript typeof operator </a></li>
<li><a href="/2009/07/08/javascript-closures-in-brief/" rel="bookmark" title="JavaScript closures in brief">JavaScript closures in brief </a></li>
</ol>
</div>
]]></description>
				<content:encoded><![CDATA[<h2>Is undefined equal to undefined?</h2>
<p>That&#8217;s the question! <a href="http://www.crockford.com/">Crockford</a> says it is not, but let see the experiment.</p>
<pre lang="javascript">var a, b;
console.log(typeof a);
console.log(a === b);
</pre>
<p>the answer is &#8211; it is.</p>
<p><a href="/wp-content/uploads/2010/03/Picture-21.png"><img class="aligncenter size-full wp-image-1339" title="JavaScript zen" src="/wp-content/uploads/2010/03/Picture-21.png" alt="" width="430" height="147" srcset="/wp-content/uploads/2010/03/Picture-21.png 430w, /wp-content/uploads/2010/03/Picture-21-300x102.png 300w" sizes="(max-width: 430px) 100vw, 430px" /></a></p>
<div class='yarpp-related-rss'>
<p>Related posts:<ol>
<li><a href="/2009/07/27/javascript-what-is-typeof-typeof/" rel="bookmark" title="javascript: what is typeof typeof">javascript: what is typeof typeof </a></li>
<li><a href="/2011/10/21/does-javascript-undefined-equals-undefined/" rel="bookmark" title="Does JavaScript undefined Equals undefined?">Does JavaScript undefined Equals undefined? </a></li>
<li><a href="/2009/05/24/javascript-typeof-operator/" rel="bookmark" title="JavaScript typeof operator">JavaScript typeof operator </a></li>
<li><a href="/2009/07/08/javascript-closures-in-brief/" rel="bookmark" title="JavaScript closures in brief">JavaScript closures in brief </a></li>
</ol></p>
</div>
]]></content:encoded>
			<wfw:commentRss>/2010/03/17/javascript-zen/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Retrieving YouTube Channel&#8217;s Videos with Zend_Gdata_YouTube</title>
		<link>/2010/03/16/retrieving-youtube-channels-videos-with-zend_gdata_youtube/</link>
		<comments>/2010/03/16/retrieving-youtube-channels-videos-with-zend_gdata_youtube/#comments</comments>
		<pubDate>Tue, 16 Mar 2010 11:53:32 +0000</pubDate>
		<dc:creator><![CDATA[Stoimen]]></dc:creator>
				<category><![CDATA[micro tutorial]]></category>
		<category><![CDATA[snippets]]></category>
		<category><![CDATA[zend framework]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[Application programming interface]]></category>
		<category><![CDATA[Atom]]></category>
		<category><![CDATA[Computing]]></category>
		<category><![CDATA[GData]]></category>
		<category><![CDATA[Google Inc.]]></category>
		<category><![CDATA[http]]></category>
		<category><![CDATA[PHP programming language]]></category>
		<category><![CDATA[RSS]]></category>
		<category><![CDATA[Technology/Internet]]></category>
		<category><![CDATA[Web 2.0]]></category>
		<category><![CDATA[Web application frameworks]]></category>
		<category><![CDATA[World Wide Web]]></category>
		<category><![CDATA[YouTube Inc]]></category>

		<guid isPermaLink="false">/?p=1329</guid>
		<description><![CDATA[Zend_Gdata Zend Framework gives you the possibility to interact with Gdata services, which are provided by most of the Goolge services. You can find more on the docs page of Zend_Gdata. The basic principle is that you can connect a service with you API key, given by Google. What I&#8217;m about to show you is &#8230; <a href="/2010/03/16/retrieving-youtube-channels-videos-with-zend_gdata_youtube/" class="more-link">Continue reading <span class="screen-reader-text">Retrieving YouTube Channel&#8217;s Videos with Zend_Gdata_YouTube</span> <span class="meta-nav">&#8594;</span></a><div class='yarpp-related-rss'>

Related posts:<ol>
<li><a href="/2010/05/21/check-youtube-video-existence-with-zend_gdata_youtube/" rel="bookmark" title="Check YouTube Video Existence with Zend_Gdata_YouTube">Check YouTube Video Existence with Zend_Gdata_YouTube </a></li>
<li><a href="/2010/04/22/iterate-over-youtube-channel-with-zend_gdata_youtube/" rel="bookmark" title="Iterate over YouTube Channel with Zend_Gdata_YouTube">Iterate over YouTube Channel with Zend_Gdata_YouTube </a></li>
<li><a href="/2011/04/13/post-with-zend_http_client/" rel="bookmark" title="POST with Zend_Http_Client">POST with Zend_Http_Client </a></li>
<li><a href="/2010/06/28/send-authenticated-post-request-with-zend_http_client/" rel="bookmark" title="Send Authenticated POST Request with Zend_Http_Client">Send Authenticated POST Request with Zend_Http_Client </a></li>
</ol>
</div>
]]></description>
				<content:encoded><![CDATA[<h2>Zend_Gdata</h2>
<p><a title="Zend Framework" href="http://framework.zend.com/" target="_blank">Zend Framework</a> gives you the possibility to interact with <a title="gdata" href="http://code.google.com/apis/gdata/" target="_blank">Gdata</a> services, which are provided by most of the Goolge services. You can find more on the docs page of <a href="http://framework.zend.com/manual/en/zend.gdata.html" target="_blank">Zend_Gdata</a>. The basic principle is that you can connect a service with you API key, given by Google. What I&#8217;m about to show you is how do connect such a service.</p>
<p>In theory Zend_Gdata depends on <a title="Zend_Http_Client" href="http://framework.zend.com/manual/en/zend.http.html" target="_blank">Zend_Http_Client</a> and you&#8217;ve to connect it with an instance of this class.</p>
<pre lang="php">// 1. setup API key
$apiKey = 'your_api_key_here';

// 2. retrieve videos via GData Atom
$client = new Zend_Http_Client();
$gdata = new Zend_Gdata_YouTube(null, 'my-app', null, $apiKey);</pre>
<p>Note that you&#8217;ve to replace your API key in the chunk above.</p>
<p>Now once that you&#8217;ve connected the YouTube service you can iterate through the entries from the video feed.</p>
<pre lang="php">$videoFeed = $gdata->getUserUploads('username');
foreach ($videoFeed as $entry) {
    echo $entry->getTitle();
}</pre>
<p>The thing is that you can modify a bit the code above. As ZF docs says if you don&#8217;t setup a Zend_Http_Client a default with default configuration, so you can omit this and simple write:</p>
<pre lang="php">// 1. setup API key
$apiKey = 'your_api_key_here';

// 2. retrieve videos via GData Atom
$gdata = new Zend_Gdata_YouTube(null, 'my-app', null, $apiKey);</pre>
<div class='yarpp-related-rss'>
<p>Related posts:<ol>
<li><a href="/2010/05/21/check-youtube-video-existence-with-zend_gdata_youtube/" rel="bookmark" title="Check YouTube Video Existence with Zend_Gdata_YouTube">Check YouTube Video Existence with Zend_Gdata_YouTube </a></li>
<li><a href="/2010/04/22/iterate-over-youtube-channel-with-zend_gdata_youtube/" rel="bookmark" title="Iterate over YouTube Channel with Zend_Gdata_YouTube">Iterate over YouTube Channel with Zend_Gdata_YouTube </a></li>
<li><a href="/2011/04/13/post-with-zend_http_client/" rel="bookmark" title="POST with Zend_Http_Client">POST with Zend_Http_Client </a></li>
<li><a href="/2010/06/28/send-authenticated-post-request-with-zend_http_client/" rel="bookmark" title="Send Authenticated POST Request with Zend_Http_Client">Send Authenticated POST Request with Zend_Http_Client </a></li>
</ol></p>
</div>
]]></content:encoded>
			<wfw:commentRss>/2010/03/16/retrieving-youtube-channels-videos-with-zend_gdata_youtube/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>Force Zend Casting and Help the IDE Autocompletion</title>
		<link>/2010/03/15/force-zend-casting-and-help-the-ide-autocompletion/</link>
		<comments>/2010/03/15/force-zend-casting-and-help-the-ide-autocompletion/#comments</comments>
		<pubDate>Mon, 15 Mar 2010 14:28:02 +0000</pubDate>
		<dc:creator><![CDATA[Stoimen]]></dc:creator>
				<category><![CDATA[micro tutorial]]></category>
		<category><![CDATA[snippets]]></category>
		<category><![CDATA[zend framework]]></category>
		<category><![CDATA[Autocomplete]]></category>
		<category><![CDATA[YouTube]]></category>
		<category><![CDATA[Zend_Gdata_YouTube_VideoEntry]]></category>

		<guid isPermaLink="false">/?p=1320</guid>
		<description><![CDATA[IDEs and Autocompletion One of my favorite things in IDEs, in my case Eclipse for Mac, is that they offer you the option of autocompletion. No developer knows the entire set of functions of the language he uses, neither the set of parameters of them. That&#8217;s why IDEs come to help. In many cases when &#8230; <a href="/2010/03/15/force-zend-casting-and-help-the-ide-autocompletion/" class="more-link">Continue reading <span class="screen-reader-text">Force Zend Casting and Help the IDE Autocompletion</span> <span class="meta-nav">&#8594;</span></a><div class='yarpp-related-rss'>

Related posts:<ol>
<li><a href="/2010/04/22/iterate-over-youtube-channel-with-zend_gdata_youtube/" rel="bookmark" title="Iterate over YouTube Channel with Zend_Gdata_YouTube">Iterate over YouTube Channel with Zend_Gdata_YouTube </a></li>
<li><a href="/2010/03/16/retrieving-youtube-channels-videos-with-zend_gdata_youtube/" rel="bookmark" title="Retrieving YouTube Channel&#8217;s Videos with Zend_Gdata_YouTube">Retrieving YouTube Channel&#8217;s Videos with Zend_Gdata_YouTube </a></li>
<li><a href="/2010/05/21/check-youtube-video-existence-with-zend_gdata_youtube/" rel="bookmark" title="Check YouTube Video Existence with Zend_Gdata_YouTube">Check YouTube Video Existence with Zend_Gdata_YouTube </a></li>
<li><a href="/2010/04/26/mysql-expressions-in-zend-framework/" rel="bookmark" title="MySQL Expressions in Zend Framework">MySQL Expressions in Zend Framework </a></li>
</ol>
</div>
]]></description>
				<content:encoded><![CDATA[<h2>IDEs and Autocompletion</h2>
<p>One of my favorite things in IDEs, in my case Eclipse for Mac, is that they offer you the option of autocompletion. No developer knows the entire set of functions of the language he uses, neither the set of parameters of them. That&#8217;s why IDEs come to help.</p>
<p style="text-align: center;"><a href="/wp-content/uploads/2010/03/Eclipse.Autocompletion.png"><img class="aligncenter size-full wp-image-1325" title="Eclipse Autocompletion" src="/wp-content/uploads/2010/03/Eclipse.Autocompletion.png" alt="" width="430" height="185" srcset="/wp-content/uploads/2010/03/Eclipse.Autocompletion.png 430w, /wp-content/uploads/2010/03/Eclipse.Autocompletion-300x129.png 300w" sizes="(max-width: 430px) 100vw, 430px" /></a></p>
<p>In many cases when casting is not obvious and method call chain is to large your IDE may refuse to help you with this brilliant functionality. To be more precise let me give you an example.</p>
<p>In Zend Framework I was trying to fetch a RSS via Gdata interface. Something like that:</p>
<pre lang="php" escaped="true">$videoFeed = $gdata-&gt;getUserUploads('youtube_username');
foreach ($videoFeed as $entry) {
    // do something
}
</pre>
<p>The problem is that whenever I try to do <strong>$entry-&gt;</strong> in the body of the <strong>foreach</strong> loop I don&#8217;t see what methods are supported by the <strong>Zend_Gdata_YouTube_VideoEntry</strong> class. So I tried to force the casting of $entry to this class definition and it worked like a charm for me. The thing I&#8217;ve done was to add a definition of $entry before the loop body:</p>
<pre lang="php" escaped="true">$videoFeed = $gdata-&gt;getUserUploads('youtube_username');
$entry = new Zend_Gdata_YouTube_VideoEntry();
foreach  ($videoFeed as $entry) {
    // do something
}
</pre>
<p>Than whenever you try to type $entry-&gt; you&#8217;d receive a list of methods from the class definition of <strong>Zend_Gdata_YouTube_VideoEntry</strong>.</p>
<p>Thanks to <a href="http://ganoro.blogspot.com/">Roy Ganor</a> there&#8217;s a more elegant way to do this, simply by adding @var comment:</p>
<pre lang="php">
/* @var $entry Zend_Gdata_YouTube_VideoEntry */
</pre>
<div class='yarpp-related-rss'>
<p>Related posts:<ol>
<li><a href="/2010/04/22/iterate-over-youtube-channel-with-zend_gdata_youtube/" rel="bookmark" title="Iterate over YouTube Channel with Zend_Gdata_YouTube">Iterate over YouTube Channel with Zend_Gdata_YouTube </a></li>
<li><a href="/2010/03/16/retrieving-youtube-channels-videos-with-zend_gdata_youtube/" rel="bookmark" title="Retrieving YouTube Channel&#8217;s Videos with Zend_Gdata_YouTube">Retrieving YouTube Channel&#8217;s Videos with Zend_Gdata_YouTube </a></li>
<li><a href="/2010/05/21/check-youtube-video-existence-with-zend_gdata_youtube/" rel="bookmark" title="Check YouTube Video Existence with Zend_Gdata_YouTube">Check YouTube Video Existence with Zend_Gdata_YouTube </a></li>
<li><a href="/2010/04/26/mysql-expressions-in-zend-framework/" rel="bookmark" title="MySQL Expressions in Zend Framework">MySQL Expressions in Zend Framework </a></li>
</ol></p>
</div>
]]></content:encoded>
			<wfw:commentRss>/2010/03/15/force-zend-casting-and-help-the-ide-autocompletion/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
	</channel>
</rss>
