<?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>Pumka.net</title>
	<atom:link href="http://pumka.net/feed/" rel="self" type="application/rss+xml" />
	<link>http://pumka.net</link>
	<description>Project Workshop</description>
	<lastBuildDate>Tue, 31 Jan 2012 15:30:10 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<item>
		<title>Easy way to automatically update commercial WordPress plug-ins</title>
		<link>http://pumka.net/2012/01/27/easy-way-to-automatically-update-commercial-wordpress-plug-ins/</link>
		<comments>http://pumka.net/2012/01/27/easy-way-to-automatically-update-commercial-wordpress-plug-ins/#comments</comments>
		<pubDate>Fri, 27 Jan 2012 19:12:22 +0000</pubDate>
		<dc:creator>Anton Oliinyk</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Tips & Tricks]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[auto update]]></category>
		<category><![CDATA[json]]></category>
		<category><![CDATA[plug-in]]></category>
		<category><![CDATA[Wordress]]></category>

		<guid isPermaLink="false">http://pumka.net/?p=615</guid>
		<description><![CDATA[Commercial plug-ins cannot use WordPress auto-update feature out of the box. Luckily, opensource upgrade me plug-in solves this problem and allows easily enabling automatic updates for a plug-in hosted outside of wordpress.org. ]]></description>
			<content:encoded><![CDATA[<div id="attachment_617" class="wp-caption alignleft" style="width: 310px"><a href="http://pumka.net/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3B1bWthLm5ldC93cC1jb250ZW50L3VwbG9hZHMvMjAxMi8wMS91cGRhdGUxLnBuZw=="><img class="size-medium wp-image-617  " title="Update notification" src="http://pumka.net/wp-content/uploads/2012/01/update1-300x104.png" alt="" width="300" height="104" /></a><p class="wp-caption-text">Update notification for a commercial plug-in</p></div>
<p><a href="http://pumka.net/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3dvcmRwcmVzcy5vcmcv">WordPress CMS</a> has a nice auto update feature that displays update notifications for outdated plug-ins and themes in admin panel. Once you got a notification you can go to Dashboard-&gt;Updates and install all updates with few clicks while WordPress will automatically download and extract archives, remove old versions and reactivate plug-ins for you.</p>
<p>The only problem is  that it works for plug-ins published on <a href="http://pumka.net/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3dvcmRwcmVzcy5vcmc=">wordpress.org</a> which are open-source so it&#8217;s not an option for commercial plug-ins.</p>
<p>Luckily there is a very good solution to this problem: <a href="http://pumka.net/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cHM6Ly9naXRodWIuY29tL21lZ2xpby93cC11cGdyYWRlbWU=">Upgrademe</a> plug-in.<br />
<span id="more-615"></span></p>
<p>Users of most commercial Wordspress plug-ins suffer from painful manual update process which includes deactivation of the plug-in, deleting it, uploading new code and finally activating it. And obviously they do not get update notifications for commercial plug-in directly to their admin panels. This also applies to free plug-ins that aren&#8217;t hosted on wordpress.org for some reason.</p>
<p>Some commercial plug-ins have their own automatic update feature that shows notifications similar to notifications of WordPress auto-update system and some vendors provide their own auto-update plug-ins which are capable of updating their own products. Still their homemade code is limited and not so good and reliable as built-in WordPress update system.</p>
<p>I wish WordPress developers add a way to extend built-in update system with custom information sources but it seems they&#8217;re not willing to do so for some reasons.<br />
Well, while there is no &#8220;official&#8221; way, some hacks are still available and Upgrademe plug-in just uses one of them (and I have to say it does it in a very smart way!).</p>
<p>Once installed on WordPress blog this little plug-in will hack into every WordPress request for fresh update information and add custom data gathered from other sources.  Nothing more! All the  job of displaying update notifications, downloading and installing updates is done by WordPress auto-update subsystem just like it does for any plug-in hosted on wordpress.org.</p>
<p>Enabling auto-updates in your commercial plug-in is extremely easy:</p>
<ol>
<li>Add this small function to the end of your main plug-in file:
<pre class="brush: php; title: ; notranslate">
function &lt;plugin_name&gt;_upgrademe()
{
    return 'http://yoursite.com/latest-version.php';
}
</pre>
<ul>
<li>Replace &lt;plugin_name&gt; with your main plug-in name w/o extension.</li>
<li>Replace http://yoursite.com/latest-version.php with actual URL that will provide JSON data with lates version info. It could be simply static file that you update manually or a script that cooks that data dynamically.</li>
</ul>
</li>
<li>Upload latest version script or static file to the URL provided by the function. See <a href="http://pumka.net/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cHM6Ly9naXRodWIuY29tL21lZ2xpby93cC11cGdyYWRlbWU=">https://github.com/meglio/wp-upgrademe</a> for more info on the JSON structure required.</li>
<li>Deliver your plug-in along with the Upgrademe plug-in to your users and ask them to install and activate Upgrademe plug-in to get automatic updates.</li>
</ol>
<div id="attachment_624" class="wp-caption alignleft" style="width: 215px"><a href="http://pumka.net/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3B1bWthLm5ldC93cC1jb250ZW50L3VwbG9hZHMvMjAxMi8wMS91cGRhdGUyLnBuZw=="><img class="size-medium wp-image-624   " title="Update notifications in admin menus" src="http://pumka.net/wp-content/uploads/2012/01/update2-205x300.png" alt="Update notifications in admin menus" width="205" height="300" /></a><p class="wp-caption-text">All natural: update notifications are coming from WordPress built-in update system</p></div>
<p>There are many benefits of using Upgrademe plug-in but there are also few problems that I believe will be fixed with further development of this great plug-in.</p>
<h2>Pros</h2>
<p>1. Reliable and forward compatible solution as it is based on usage of built-in WordPress auto-update subsystem.</p>
<p>2. Very small  modification to your plug-in code required.</p>
<p>3. One plug-in could serve update information for multiple plug-ins from various vendors.</p>
<h2>Cons</h2>
<p>1. Theme update not supported yet. While I see no problem in adding it. It just needs some research and development work.</p>
<p>2. If you install many update-enabled plug-ins on he same blog you may periodically notice a slowdown. It is caused by the Upgrademe plug-in calling all the latest version info URLs for those plug-ins. It would be better if this requests could be scattered over time.</p>
<p>3. You have to deliver Upgrademe plug-in to the end-user and make him/her activate it along with your plug-in.</p>
<h2>How it works</h2>
<p>Once everything is set up and there is new version available the user will see update notifications for your plug-in like those shown on images above. In fact, those notifications are produced by core WordPress code so if WordPress developers decide to change something in a way they are displayed, you have nothing to worry about.</p>
<p>To notify users about the update upload new version archive to your server and modify JSON version info accordingly. Note that WordPress caches version information for 12 hours so you&#8217;ll not see the notifications immediately.  For testing purposes you can delete &#8217;_site_transient_update_plugins&#8217; option from options table and refresh any page in WordPress admin. This will force WordPress to request update information.</p>
<p>Finally, when the users decides to update the plug-in, WordPress automatically downloads and installs it in the same way as it does for for plug-in hosted on wordpress.org:</p>
<p style="text-align: center;"><a href="http://pumka.net/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3B1bWthLm5ldC93cC1jb250ZW50L3VwbG9hZHMvMjAxMi8wMS91cGRhdGU0LnBuZw=="><img class=" wp-image-632 aligncenter" title="Update process log" src="http://pumka.net/wp-content/uploads/2012/01/update4.png" alt="Update process log" width="759" height="456" /></a></p>
<p>As we wanted to avoid manual work as much as possible, we developed a small script that servers update info for all our plug-ins. The script takes plug-in name from URL query parameter and responds with version number it takes from filename of plug-in&#8217;s archive . So all we have to do now is uploading plug-in archives named  like &lt;plug-in name&gt;.&lt;version&gt;.zip to the server and that automatically fires update notification to end-users. That easy!</p>
<p>That&#8217;s it, with a help of Upgradme plug-in you can easily add great auto-update feature to your commercial WordPress plug-in.</p>
 <img src="http://pumka.net/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=615" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://pumka.net/2012/01/27/easy-way-to-automatically-update-commercial-wordpress-plug-ins/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Admintasia: Awesome Design Template for Web Applications</title>
		<link>http://pumka.net/2011/07/17/admintasia-awesome-design-template-for-web-applications/</link>
		<comments>http://pumka.net/2011/07/17/admintasia-awesome-design-template-for-web-applications/#comments</comments>
		<pubDate>Sun, 17 Jul 2011 16:22:02 +0000</pubDate>
		<dc:creator>Anton Oliinyk</dc:creator>
				<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://pumka.net/?p=564</guid>
		<description><![CDATA[Professional design is a must have for web based applications. However, for many analysis and management applications including web design into project scope is just not affordable. If you're building applications with reach GUI, consider using Admintasia 2.1 theme.]]></description>
			<content:encoded><![CDATA[<p>Unlike desktop applications which rarely use &#8220;skins&#8221;, web applications look ugly and unprofessional w/o a design template. However, building unique design for each project sometimes is just not affordable, especially for back-end, admin and other data analysis and management applications. At the other hand, if you look for free or commercial design templates available, you&#8217;ll find nothing but website templates which doesn&#8217;t have elements like cascading menus, dialog, grid, form elements and others usually required for an application user interface.</p>
<p>Sad but true, except this little thing: <a title=\"Get Admintasia 2.1 with a great discount!\" href="http://pumka.net/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cHM6Ly93d3cuZS1qdW5raWUuY29tL2Vjb20vZ2IucGhwP2NsPTkwNDM2JmFtcDtjPWliJmFtcDthZmY9MTc3MjIw" target=\"ejejcsingle\">Admintasia 2.1</a>. Powered with jQuery and jQuery IU it has all the elements you need to build rich professional user interfaces.<br />
<span id="more-564"></span><br />
Despite what the name says, it&#8217;s not intended for admin areas only but suits great for any kind of rich GUI application. This is likely the only design template of its kind available.<br />
Take a look at some of screenshots:</p>

<a href='http://pumka.net/2011/07/17/admintasia-awesome-design-template-for-web-applications/attachment/01/' title='Theme Overview'><img width="150" height="150" src="http://pumka.net/wp-content/uploads/2011/07/01-150x150.jpg" class="attachment-thumbnail" alt="Theme Overview" title="Theme Overview" /></a>
<a href='http://pumka.net/2011/07/17/admintasia-awesome-design-template-for-web-applications/flexi/' title='Grid'><img width="150" height="150" src="http://pumka.net/wp-content/uploads/2011/07/flexi-150x150.jpg" class="attachment-thumbnail" alt="Grid" title="Grid" /></a>
<a href='http://pumka.net/2011/07/17/admintasia-awesome-design-template-for-web-applications/progress_bar/' title='Progress Bar'><img width="150" height="150" src="http://pumka.net/wp-content/uploads/2011/07/progress_bar-150x150.jpg" class="attachment-thumbnail" alt="Progress Bar" title="Progress Bar" /></a>
<a href='http://pumka.net/2011/07/17/admintasia-awesome-design-template-for-web-applications/slider/' title='Slider'><img width="150" height="150" src="http://pumka.net/wp-content/uploads/2011/07/slider-150x150.jpg" class="attachment-thumbnail" alt="Slider" title="Slider" /></a>
<a href='http://pumka.net/2011/07/17/admintasia-awesome-design-template-for-web-applications/validation/' title='Form Validation'><img width="150" height="150" src="http://pumka.net/wp-content/uploads/2011/07/validation-150x150.jpg" class="attachment-thumbnail" alt="Form Validation" title="Form Validation" /></a>
<a href='http://pumka.net/2011/07/17/admintasia-awesome-design-template-for-web-applications/add_to_table/' title='Modal Dialog'><img width="150" height="150" src="http://pumka.net/wp-content/uploads/2011/07/add_to_table-150x150.jpg" class="attachment-thumbnail" alt="Modal Dialog" title="Modal Dialog" /></a>

<p>I started with Admintasia 1.0 then upgraded to Admintasia 2.1. <a title=\"Buy Admintasia 2.1\" href="http://pumka.net/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cHM6Ly93d3cuZS1qdW5raWUuY29tL2Vjb20vZ2IucGhwP2NsPTkwNDM2JmFtcDtjPWliJmFtcDthZmY9MTc3MjIw" target=\"ejejcsingle\">You can get a professional license just for $99</a>.</p>
<p>Now I&#8217;m going to build an application skeleton by intrating it with <a href="http://pumka.net/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL2ZyYW1ld29yay56ZW5kLmNvbS8=">Zend Framework</a> and adding some usual things like login, email template engine and event logging.<br />
Let me know if you&#8217;re interested.</p>
 <img src="http://pumka.net/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=564" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://pumka.net/2011/07/17/admintasia-awesome-design-template-for-web-applications/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Cascade update fails on MySQL for foreign keys referring to the same table</title>
		<link>http://pumka.net/2011/07/06/cascade-update-fails-on-mysql-for-foreign-keys-referring-to-the-same-table/</link>
		<comments>http://pumka.net/2011/07/06/cascade-update-fails-on-mysql-for-foreign-keys-referring-to-the-same-table/#comments</comments>
		<pubDate>Wed, 06 Jul 2011 12:15:06 +0000</pubDate>
		<dc:creator>Anton Oliinyk</dc:creator>
				<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://pumka.net/?p=547</guid>
		<description><![CDATA[Recently I noticed that ON UPDATE CASCADE rule falis in MySQL on InnoDB tables if a foreign key references the same table, which is usual for tree-like data structured. At the same time ON DELETE CASCADE works fine.]]></description>
			<content:encoded><![CDATA[<p>Recently I noticed that ON UPDATE CASCADE rule falis in <a href="http://pumka.net/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3d3dy5teXNxbC5jb20v">MySQL</a> on <a href="http://pumka.net/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3d3dy5pbm5vZGIuY29tLw==">InnoDB</a> tables if a foreign key references the same table, which is usual for tree-like data structured. At the same time ON DELETE CASCADE works fine.</p>
<p>This  is not corresponding to SQL standard but it&#8217;s already stated in <a href="http://pumka.net/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL2Rldi5teXNxbC5jb20vZG9jL3JlZm1hbi81LjYvZW4vaW5ub2RiLWZvcmVpZ24ta2V5LWNvbnN0cmFpbnRzLmh0bWw=">MySQL</a> manual:</p>
<blockquote><p><strong>Deviation from SQL standards</strong>: If <code>ON UPDATE CASCADE</code> or <code>ON UPDATE SET NULL</code> recurses to update the <em>same table</em> it has previously updated during the cascade, it acts like <code>RESTRICT</code></p></blockquote>
<p>It was also reported as a bug but rejected years ago.<br />
<span id="more-547"></span><br />
There could be some complex workarounds for this problem but my solution is simply avoiding natural primary keys and using surrogate (auto increment) primary keys instead. Surrogate key values won&#8217;t change so you don&#8217;t have to care about ON UPDATE rules at all.</p>
 <img src="http://pumka.net/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=547" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://pumka.net/2011/07/06/cascade-update-fails-on-mysql-for-foreign-keys-referring-to-the-same-table/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Enabling/Disabling HTML elements with jQuery 1.6+</title>
		<link>http://pumka.net/2011/06/27/enabling-disabling-html-elements-with-jquery-1-6/</link>
		<comments>http://pumka.net/2011/06/27/enabling-disabling-html-elements-with-jquery-1-6/#comments</comments>
		<pubDate>Mon, 27 Jun 2011 12:33:13 +0000</pubDate>
		<dc:creator>Anton Oliinyk</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://pumka.net/?p=540</guid>
		<description><![CDATA[After upgrading to jQuery 1.6+ you'll find that code you used to enable/disable elements doesn't work anymore. This is caused by recent modifications to attr method. Now you have to use prop method instead.]]></description>
			<content:encoded><![CDATA[<p>After upgrading to <a href="http://pumka.net/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL2pxdWVyeS5jb20v">jQuery</a> 1.6+ you&#8217;ll find that code you used to enable/disable elements doesn&#8217;t work anymore:</p>
<pre class="brush: jscript; title: ; notranslate">
//This is supposed to enable element(s) before jQuery 1.6:
$(&quot;some-selector&quot;).attr(&quot;disabled&quot;, &quot;&quot;);
//This is supposed to disable element(s) before jQuery 1.6:
$(&quot;some-selector&quot;).attr(&quot;disabled&quot;, &quot;disabled&quot;);
</pre>
<p>But now the code above doesn&#8217;t change anything. So what&#8217;s the problem?</p>
<p><span id="more-540"></span></p>
<p>It&#8217;s caused by recent modifications to <a href="http://pumka.net/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL2FwaS5qcXVlcnkuY29tL2F0dHIv">attr</a> method which was used to set both attributes and properties. Since jQuery 1.6 <a href="http://pumka.net/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL2FwaS5qcXVlcnkuY29tL2F0dHIv">attr</a> method works for attributes only. As for properties like &#8220;disabled&#8221;, you have to use new <a href="http://pumka.net/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL2FwaS5qcXVlcnkuY29tL3Byb3Av">prop</a> method introduced in jQuery 1.6:</p>
<pre class="brush: jscript; title: ; notranslate">
$(&quot;some-selector&quot;).prop(&quot;disabled&quot;, false); //Enables element(s) with jQuery 1.6.
$(&quot;some-selector&quot;).prop(&quot;disabled&quot;, true); //Disables element(s) with jQuery 1.6.
</pre>
<p>But what if you&#8217;re not sure about target jQuery version? Then you can check availability of prop method and use it if available:</p>
<pre class="brush: jscript; title: ; notranslate">
if (typeof jQuery['prop'] === 'function') {
    // Use new prop method:
    $(&quot;some-selector&quot;).prop(&quot;disabled&quot;, false);
} else {
    // Use old-style code:
    $(&quot;some-selector&quot;).attr(&quot;disabled&quot;, &quot;&quot;);
}
</pre>
<p>Similar solutions could be used for other properties previously assigned/accessed by jQuery attr method.</p>
 <img src="http://pumka.net/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=540" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://pumka.net/2011/06/27/enabling-disabling-html-elements-with-jquery-1-6/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tag View Helper: Easily Compose HTML Tags with Complex Logic Beyond Attributes</title>
		<link>http://pumka.net/2011/05/11/tag-view-helper-easily-compose-html-tags-with-complex-logic-beyond-attributes/</link>
		<comments>http://pumka.net/2011/05/11/tag-view-helper-easily-compose-html-tags-with-complex-logic-beyond-attributes/#comments</comments>
		<pubDate>Wed, 11 May 2011 15:15:49 +0000</pubDate>
		<dc:creator>Anton Oliinyk</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Zend Framework]]></category>

		<guid isPermaLink="false">http://pumka.net/?p=501</guid>
		<description><![CDATA[Escaping from HTML is a very cool feature of PHP because it allows to easily inject portions of dynamic content into predefined HTML template. But when you came to HTML tags with many dynamic attributes and relatively complex logic beyond them, this cool feature turns into complete disaster. Tag view helper allows you to generate HTML tags in native PHP way using arrays to specify attributes, classes and styles. ]]></description>
			<content:encoded><![CDATA[<p>Escaping from HTML is a very cool feature of PHP because it allows easily to inject portions of dynamic content into predefined HTML template. But when you come to HTML tags with many dynamic attributes and relatively complex logic beyond them, this cool feature turns into complete disaster. If you constantly develop view templates or web page scripts then you definitely know how many times you hated starting yet another &#8220;&lt;?php echo&#8230;&#8221; just for another attribute value.</p>
<p>Right, even if you strongly pretend to write clean code, multiple dynamic attributes per HTML tag, variable styles or class sets usually result in total mess of HTML and PHP which is very hard to read. This usually happens with form elements or jQuery widgets that require a lot of data converted into HTML attributes, classes and styles.<br />
<span id="more-501"></span><br />
And PHP &#8220;short tags&#8221; (&lt;? ?&gt;) do not really any help here, because they do not save you from PHP/HTML mixture which can easily hide hard-to-find mistakes. Putting each attribute on separate code line is also of little help.</p>
<p>How do you like this bit of code? Can you easily get an idea of it?</p>
<pre class="brush: php; collapse: false; title: ; notranslate">
&lt;li id=&quot;opc-&lt;?php echo $_stepId ?&gt;&quot;
    class=&quot;section &lt;?php echo !empty($_stepInfo['allow'])?'allow':'' ?&gt;
    &lt;?php echo !empty($_stepInfo['complete'])?'saved':'' ?&gt;&quot;
&gt;
</pre>
<p>It was actually taken from default <a href="http://pumka.net/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3d3dy5tYWdlbnRvY29tbWVyY2UuY29tLw==">Magento</a> templates so it&#8217;s relatively &#8220;clean&#8221;. Sometime inside<a href="http://pumka.net/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3dvcmRwcmVzcy5vcmcv"> WordPress</a> you can find some worse, much messy code.</p>
<p>But if some code is more about generated content and data than about static HTML, why not to turn it into just clean PHP? Well, PHP frameworks like <a href="http://pumka.net/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL2ZyYW1ld29yay56ZW5kLmNvbS8=">Zend Framework</a> already contain view helpers for most common HTML elements like form fields and you can easily add your own. But adding a helper for each complex HTML element could be an overkill. What I constantly missed is something more generic which can just render me HTML tag with attributes specified as associative array. As I didn&#8217;t find it, I decided to write it on my own (see download link below) and called it Tag helper.</p>
<p>With the help of my Tag helper we can generate the same HTML as code above does, but using more structured code style:</p>
<pre class="brush: php; collapse: false; title: ; notranslate">
echo $this-&gt;tag('li', '&lt;', array(
    'id' =&gt; &quot;opc-{$_stepId}&quot;,
    'class' =&gt; array(
        'section',
        !empty($_stepInfo['allow'])? 'allow' : NULL,
        !empty($_stepInfo['complete'])? 'saved' : NULL,
    ),
));
</pre>
<p>Yes, it&#8217;s a bit longer but now it&#8217;s quite easy to get an idea and check for errors.</p>
<p>The helper allows you to render full HTML tags with a single function call. It accepts attributes as name=&gt;value associative array. It will skip FALSE or NULL attributes while converting TRUE values to attribute name. This helps deal with logical attributes following XHTML rules.<br />
Class and style attributes can be arrays too and the helper will compose attribute values for you.</p>
<p>The helper also allows rendering opening, closing and self-closed tags. Just send &#8216;&lt;&#8217;, &#8216;&gt;&#8217; or &#8216;&lt;&gt;&#8217; string respectively to content parameter.</p>
<p>Here is an example of rendering some checkbox group from data array with Tag helper:</p>
<pre class="brush: php; collapse: false; title: ; notranslate">
foreach ($items as $key=&gt;$info) {
    echo $this-&gt;tag('div', '&lt;', array(
        'id' =&gt; &quot;{$key}-container&quot;,
    )) . &quot;\n&quot;;
    echo &quot;\t&quot; . $this-&gt;tag('label', '&lt;', array(
        'id' =&gt; &quot;{$key}-label&quot;,
        'for' =&gt; $key,
        'style' =&gt; array(
            'color' =&gt; $info['color'],
            'text-decoration' =&gt; !$info['enabled']? 'line-through' : NULL,
        )
    ));
    echo $this-&gt;tag('input', '&lt;&gt;', array(
        'type' =&gt; 'checkbox',
        'name' =&gt; &quot;item-{$key}&quot;,
        'id' =&gt; $key,
        'value' =&gt; $key,
        'checked' =&gt; $info['value'],
        'disabled' =&gt; !$info['enabled'],
    ));
    echo $info['label'];
    echo $this-&gt;tag('label', '&gt;');
    echo $this-&gt;tag('div', '&gt;');
}
</pre>
<p>And here is equal &#8220;traditional&#8221; PHP code:</p>
<pre class="brush: php; collapse: false; title: ; notranslate">
&lt;?php foreach ($items as $key=&gt;$info): ?&gt;
&lt;div id=&quot;&lt;?php echo $key;?&gt;-container&quot;&gt;
    &lt;label id=&quot;&lt;?php echo $key;?&gt;-label&quot; for=&quot;&lt;?php echo $key; ?&gt;&quot;&gt;
        style=&quot;color: &lt;?php echo $info['color']; ?&gt;;&lt;?php if(!$info['enabled']): ?&gt; line-through&lt;?php endif; ?&gt;&quot;
    &gt;
        &lt;input type=&quot;checkbox&quot;
            name=&quot;item-&lt;?php echo $key; ?&gt;&quot;
            id=&quot;&lt;?php echo $key; ?&gt;&quot;
            value=&quot;&lt;?php echo $key; ?&gt;&quot;
            &lt;?php if($info['value']): ?&gt;checked=&quot;checked&quot;&lt;?php endif; ?&gt;
            &lt;?php if(!$info['enabled']): ?&gt;disabled=&quot;disabled&quot;&lt;?php endif; ?&gt;
        /&gt;
        &lt;?php echo $info['label']; ?&gt;
    &lt;/label&gt;&lt;/div&gt;
&lt;?php endforeach; ?&gt;
</pre>
<p>You can compare the samples above and decide which code is better to write and read, and more important: easy to extend. I don&#8217;t want to say that one have to use my helper everywhere HTML rendering is needed. I feel a bit like reinventing the wheel but it really saves me a lot of time when I deal with relatively complex logic beyond attributes, classes and styles.</p>
<p>Download helper code from here: <a href="http://pumka.net/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3B1bWthLm5ldC93cC1jb250ZW50L3VwbG9hZHMvMjAxMS8wNS9UYWcuemlw">Tag View Helper</a>.<br />
To use it with Zend Framework project(s) create Pumka/View/Helper folder tree inside your library folder and unpack Tag.php file to library/Pumka/View/Helper folder.<br />
Add helper path in your Bootstrap.php (create _initViewSettings method if you don&#8217;t have it):</p>
<pre class="brush: php; title: ; notranslate">
protected function _initViewSettings()
{
    $this-&gt;bootstrap('view');
    $view = $this-&gt;getResource('view');

    $view-&gt;addHelperPath('Pumka/View/Helper', 'Pumka_View_Helper');
}
</pre>
<p>If you do not use a framework, you are still able to use the helper class separately as it doesn&#8217;t really depend on any of Zend Framework components.</p>
 <img src="http://pumka.net/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=501" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://pumka.net/2011/05/11/tag-view-helper-easily-compose-html-tags-with-complex-logic-beyond-attributes/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>PDFmyURL: export web pages with JavaScript elements to PDF on shared hosting</title>
		<link>http://pumka.net/2011/04/22/pdfmyurl-export-web-pages-with-javascript-element-to-pdf-on-shared-hosting/</link>
		<comments>http://pumka.net/2011/04/22/pdfmyurl-export-web-pages-with-javascript-element-to-pdf-on-shared-hosting/#comments</comments>
		<pubDate>Fri, 22 Apr 2011 13:17:15 +0000</pubDate>
		<dc:creator>Anton Oliinyk</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Tips & Tricks]]></category>
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://pumka.net/?p=491</guid>
		<description><![CDATA[PDFmyURL.com is a web service that allows converting web pages with JavaScript graphic elements like canvas to PDF. This is very good alternative to installing conversion tools which usually problematic on shared hosting.]]></description>
			<content:encoded><![CDATA[<p>Customers and users sometimes ask for an ability to save some reports from web applications to PDF files. It could be very tricky to write PDF directly but as far as you already have those reports on web pages you can add printable views of them and then ability to convert HTML/CSS of the pages to PDF, say with <a title=\"dompdf library\" href="http://pumka.net/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL2NvZGUuZ29vZ2xlLmNvbS9wL2RvbXBkZi8=">dompdf library</a>.<br />
This way you can hit two targets: add printing of reports and PDF export. Dompdf is still in beta but at least it could work on shared hosting AFAIK.</p>
<p>But what if you need to export web pages with JavaScript canvas elements like <a title=\"Flot charts\" href="http://pumka.net/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3B1bWthLm5ldC8yMDExLzA0LzAzL2Zsb3QtYW1hemluZy1qYXZhc2NyaXB0LWpxdWVyeS1hamF4LWNoYXJ0aW5nLWxpYnJhcnkv">Flot charts</a> that are plotted on browser side only? All available solutions require installing executables which is usually problematic on shared hosting.</p>
<p>The solution is <a href="http://pumka.net/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3BkZm15dXJsLmNvbS8=">PDFmyURL.com/</a> which you can easily use as a web-service: send GET requests with URL of the page you want to export and get PDF file as a response. The service is based <a href="http://pumka.net/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL2NvZGUuZ29vZ2xlLmNvbS9wL3draHRtbHRvcGRmLw==">wkhtmltopdf</a>. As you can see, it&#8217;s good enough to convert pages with Flot charts:</p>
<p><a href="http://pumka.net/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3BkZm15dXJsLmNvbS8/dXJsPWh0dHA6Ly9wZW9wbGUuaW9sYS5kay9vbGF1L2Zsb3QvZXhhbXBsZXMvYmFzaWMuaHRtbA==">http://pdfmyurl.com/?url=http://people.iola.dk/olau/flot/examples/basic.html</a>.</p>
<p>You can call the service from JavaScript on your pages or from server-side scripts via any HTTP client library like cURL. All wkhtmltopdf options are supported and could be passed as GET request parameters.</p>
<p>Their free service inserts very small watermark to each page which is usually not a problem. But of course you can upgrade to paid service to remove it.</p>
 <img src="http://pumka.net/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=491" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://pumka.net/2011/04/22/pdfmyurl-export-web-pages-with-javascript-element-to-pdf-on-shared-hosting/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Beware: Estimated result count in Google AJAX Search API is incorrect</title>
		<link>http://pumka.net/2011/04/07/beware-estimated-result-count-in-google-ajax-search-api-is-incorrect/</link>
		<comments>http://pumka.net/2011/04/07/beware-estimated-result-count-in-google-ajax-search-api-is-incorrect/#comments</comments>
		<pubDate>Thu, 07 Apr 2011 00:50:36 +0000</pubDate>
		<dc:creator>Anton Oliinyk</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://pumka.net/?p=468</guid>
		<description><![CDATA[If you need to get Google search result count for some query, using estimatedResultCount from Google AJAX Search API sounds like a winner. However, the number reported as estimatedResultCount doesn't match the number displayed on regular search pages and could be different in many times. This is known issue> since 2008 and it seems it will never be fixed.]]></description>
			<content:encoded><![CDATA[<p>If you need to get Google search result count for some query, using estimatedResultCount from <a href="http://pumka.net/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL2NvZGUuZ29vZ2xlLmNvbS9pbnRsL2VuLVVTL2FwaXMvd2Vic2VhcmNoL2RvY3MvcmVmZXJlbmNlLmh0bWw=">Google AJAX Search API</a> sounds like a winner. However, the number reported as estimatedResultCount doesn&#8217;t match the number displayed on regular search pages and could be different in many times. This is <a href="http://pumka.net/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL2NvZGUuZ29vZ2xlLmNvbS9wL2dvb2dsZS1hamF4LWFwaXMvaXNzdWVzL2RldGFpbD9pZD0zMg==">known issue</a> since 2008 and it seems it will never be fixed.</p>
<p>So if you want more correct result count, the extract it from regular Google search page. Alternatively you can use Yahoo or Bing APIs as they report the same numbers  to displayed on their regular search pages.</p>
<p><strong>UPDATE:</strong> It was found that regular Google search pages display even more rough estimated result count than Google AJAX Search API. For example, query for &quot;pumka.net&quot; (w/ quotes) it reports &quot;About 1,380 results&quot; while only finds 284 pages. Bing reports 55 results while finds 50-52 and Yahoo reports 210 results while finds 55. So using Bing or Yahoo API for analysis of result counts is likely more accurate. </p>
 <img src="http://pumka.net/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=468" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://pumka.net/2011/04/07/beware-estimated-result-count-in-google-ajax-search-api-is-incorrect/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Flot: Amazing JavaScript/jQuery/AJAX charting library</title>
		<link>http://pumka.net/2011/04/03/flot-amazing-javascript-jquery-ajax-charting-library/</link>
		<comments>http://pumka.net/2011/04/03/flot-amazing-javascript-jquery-ajax-charting-library/#comments</comments>
		<pubDate>Sun, 03 Apr 2011 13:57:45 +0000</pubDate>
		<dc:creator>Anton Oliinyk</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[charting]]></category>
		<category><![CDATA[flot]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jquery]]></category>

		<guid isPermaLink="false">http://pumka.net/?p=436</guid>
		<description><![CDATA[Thank to Flot library charting for the Web made extremely easy yet powerful and extensible. Flot is jQuery plug-in which means you can use all power of jQuery for setting up the chart and reacting to chart events. Moreover, chart plotting happens on browser side which means your server isn't slowed down by producing chart pictures. And this also means you can add interactive features to your chart like point tooltips, live AJAX updates or applying display options w/o reloading the web page.]]></description>
			<content:encoded><![CDATA[<p>When I developed Windows desktop applications I was tied to ProEssentials library which was powerful yet expensive and had weird and very limiting API. Don&#8217;t want to say anything bad about ProEssentials developers but, OMG, their API contains hundreds of properties and functions you have to go through just to find few ones you really need. Not only do many of them have strange names, but they also do very strange things))).<br />
How do you like &#8220;ForceVerticalPoints&#8221; property? How in this World could points be vertical or horizontal? Well, it&#8217;s actually about point labels&#8230; Enough about that horror.</p>
<p>Thank to <a href="http://pumka.net/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL2NvZGUuZ29vZ2xlLmNvbS9wL2Zsb3Qv">Flot</a> library, charting for the Web made extremely easy yet powerful and extensible. Flot is jQuery plug-in which means you can use all power of jQuery for setting it up, passing data to it and reacting to its events. Moreover, chart plotting happens on the browser side which means your server isn&#8217;t slowed down by producing chart pictures. And this also means you can add interactive features to your chart like point tooltips, zooming, live AJAX updates or display options applied w/o page reload.</p>
<p><span id="more-436"></span><br />
Here are some examples of Flot charts with their code (see <a href="http://pumka.net/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3Blb3BsZS5pb2xhLmRrL29sYXUvZmxvdC9leGFtcGxlcy8=">official examples page</a> for more):<br />
<script src="http://test.pumka.net/flot/jquery.min.js" type="text/javascript"></script><br />
<script src="http://test.pumka.net/flot/jquery.flot.min.js" type="text/javascript"></script></p>
<div id="placeholder1" style="width:600px;height:300px;"></div>
<p><script type="text/javascript">
// <![CDATA[
jQuery(function () { 
var d1 = []; 
for (var i = 0; i < 14; i += 0.5) 
d1.push([i, Math.sin(i)]); 
var d2 = [[0, 3], [4, 8], [8, 5], [9, 13]]; 
var d3 = [[0, 12], [7, 12], null, [7, 2.5], [12, 2.5]]; 
jQuery.plot(jQuery("#placeholder1"), [ d1, d2, d3 ]);
});
// ]]&gt;</script></p>
<pre class="brush: jscript; title: ; notranslate">
$(function () {
    var d1 = [];
    for (var i = 0; i &lt; 14; i += 0.5)
        d1.push([i, Math.sin(i)]);

    var d2 = [[0, 3], [4, 8], [8, 5], [9, 13]];

    // a null signifies separate line segments
    var d3 = [[0, 12], [7, 12], null, [7, 2.5], [12, 2.5]];

    $.plot($(&quot;#placeholder&quot;), [ d1, d2, d3 ]);
});
</pre>
<div id="placeholder2" style="width:600px;height:300px"></div>
<p><script type="text/javascript"> 
// <![CDATA[
jQuery(function () {
    var d1 = [];
    for (var i = 0; i < 14; i += 0.5)
        d1.push([i, Math.sin(i)]);
    var d2 = [[0, 3], [4, 8], [8, 5], [9, 13]];
    var d3 = [];
    for (var i = 0; i < 14; i += 0.5)
        d3.push([i, Math.cos(i)]);
    var d4 = [];
    for (var i = 0; i < 14; i += 0.1)
        d4.push([i, Math.sqrt(i * 10)]);
    var d5 = [];
    for (var i = 0; i < 14; i += 0.5)
        d5.push([i, Math.sqrt(i)]);
    var d6 = [];
    for (var i = 0; i < 14; i += 0.5 + Math.random())
        d6.push([i, Math.sqrt(2*i + Math.sin(i) + 5)]);            
    jQuery.plot(jQuery("#placeholder2"), [
        {
            data: d1,
            lines: { show: true, fill: true }
        },
        {
            data: d2,
            bars: { show: true }
        },
        {
            data: d3,
            points: { show: true }
        },
        {
            data: d4,
            lines: { show: true }
        },
        {
            data: d5,
            lines: { show: true },
            points: { show: true }
        },
        {
            data: d6,
            lines: { show: true, steps: true }
        }
    ]);
});
// ]]&gt;
</script></p>
<pre class="brush: jscript; title: ; notranslate">
$(function () {
    var d1 = [];
    for (var i = 0; i &lt; 14; i += 0.5)
        d1.push([i, Math.sin(i)]);

    var d2 = [[0, 3], [4, 8], [8, 5], [9, 13]];

    var d3 = [];
    for (var i = 0; i &lt; 14; i += 0.5)
        d3.push([i, Math.cos(i)]);

    var d4 = [];
    for (var i = 0; i &lt; 14; i += 0.1)
        d4.push([i, Math.sqrt(i * 10)]);

    var d5 = [];
    for (var i = 0; i &lt; 14; i += 0.5)
        d5.push([i, Math.sqrt(i)]);

    var d6 = [];
    for (var i = 0; i &lt; 14; i += 0.5 + Math.random())
        d6.push([i, Math.sqrt(2*i + Math.sin(i) + 5)]);

    $.plot($(&quot;#placeholder&quot;), [
        {
            data: d1,
            lines: { show: true, fill: true }
        },
        {
            data: d2,
            bars: { show: true }
        },
        {
            data: d3,
            points: { show: true }
        },
        {
            data: d4,
            lines: { show: true }
        },
        {
            data: d5,
            lines: { show: true },
            points: { show: true }
        },
        {
            data: d6,
            lines: { show: true, steps: true }
        }
    ]);
});
</pre>
<div id="placeholder3" style="width:600px;height:300px"></div>
<div id="hoverdata">Mouse hovers at (<span id="x">0</span>, <span id="y">0</span>). <span id="clickdata"></span></div>
<div>
<input id="enableTooltip" type="checkbox">Enable tooltip</div>
<p><script type="text/javascript"> 
// <![CDATA[
jQuery(function () {
    var sin = [], cos = [];
    for (var i = 0; i < 14; i += 0.5) {
        sin.push([i, Math.sin(i)]);
        cos.push([i, Math.cos(i)]);
    }
    var plot = jQuery.plot(jQuery("#placeholder3"),
           [ { data: sin, label: "sin(x)"}, { data: cos, label: "cos(x)" } ], {
               series: {
                   lines: { show: true },
                   points: { show: true }
               },
               grid: { hoverable: true, clickable: true },
               yaxis: { min: -1.2, max: 1.2 }
             });
    function showTooltip(x, y, contents) {
        jQuery('<'+'d'+'i'+'v id="tooltip">' + contents + '<'+ '/div'+'>').css( {
            position: 'absolute',
            display: 'none',
            top: y + 5,
            left: x + 5,
            border: '1px solid #fdd',
            padding: '2px',
            'background-color': '#fee',
            opacity: 0.80
        }).appendTo("body").fadeIn(200);
    }
    var previousPoint = null;
    jQuery("#placeholder3").bind("plothover", function (event, pos, item) {
        jQuery("#x").text(pos.x.toFixed(2));
        jQuery("#y").text(pos.y.toFixed(2));
        if (jQuery("#enableTooltip:checked").length > 0) {
            if (item) {
                if (previousPoint != item.dataIndex) {
                    previousPoint = item.dataIndex;
                    jQuery("#tooltip").remove();
                    var x = item.datapoint[0].toFixed(2),
                        y = item.datapoint[1].toFixed(2);
                    showTooltip(item.pageX, item.pageY,
                                item.series.label + " of " + x + " = " + y);
                }
            }
            else {
                jQuery("#tooltip").remove();
                previousPoint = null;            
            }
        }
    });
    jQuery("#placeholder").bind("plotclick", function (event, pos, item) {
        if (item) {
            jQuery("#clickdata").text("You clicked point " + item.dataIndex + " in " + item.series.label + ".");
            plot.highlight(item.series, item.datapoint);
        }
    });
});
// ]]&gt;
</script></p>
<pre class="brush: jscript; title: ; notranslate">
$(function () {
    var sin = [], cos = [];
    for (var i = 0; i &lt; 14; i += 0.5) {
        sin.push([i, Math.sin(i)]);
        cos.push([i, Math.cos(i)]);
    }

    var plot = $.plot($(&quot;#placeholder&quot;),
           [ { data: sin, label: &quot;sin(x)&quot;}, { data: cos, label: &quot;cos(x)&quot; } ], {
               series: {
                   lines: { show: true },
                   points: { show: true }
               },
               grid: { hoverable: true, clickable: true },
               yaxis: { min: -1.2, max: 1.2 }
             });

    function showTooltip(x, y, contents) {
        $('&lt;div id=&quot;tooltip&quot;&gt;' + contents + '&lt;/div&gt;').css( {
            position: 'absolute',
            display: 'none',
            top: y + 5,
            left: x + 5,
            border: '1px solid #fdd',
            padding: '2px',
            'background-color': '#fee',
            opacity: 0.80
        }).appendTo(&quot;body&quot;).fadeIn(200);
    }

    var previousPoint = null;
    $(&quot;#placeholder&quot;).bind(&quot;plothover&quot;, function (event, pos, item) {
        $(&quot;#x&quot;).text(pos.x.toFixed(2));
        $(&quot;#y&quot;).text(pos.y.toFixed(2));

        if ($(&quot;#enableTooltip:checked&quot;).length &gt; 0) {
            if (item) {
                if (previousPoint != item.dataIndex) {
                    previousPoint = item.dataIndex;

                    $(&quot;#tooltip&quot;).remove();
                    var x = item.datapoint[0].toFixed(2),
                        y = item.datapoint[1].toFixed(2);

                    showTooltip(item.pageX, item.pageY,
                                item.series.label + &quot; of &quot; + x + &quot; = &quot; + y);
                }
            }
            else {
                $(&quot;#tooltip&quot;).remove();
                previousPoint = null;
            }
        }
    });

    $(&quot;#placeholder&quot;).bind(&quot;plotclick&quot;, function (event, pos, item) {
        if (item) {
            $(&quot;#clickdata&quot;).text(&quot;You clicked point &quot; + item.dataIndex + &quot; in &quot; + item.series.label + &quot;.&quot;);
            plot.highlight(item.series, item.datapoint);
        }
    });
});
</pre>
<p>Isn&#8217;t that code clean and simple, right?<br />
As you can see, flot API is well structured. Chart settings could be easily cooked at server-side, say as PHP array(s) and then output to web page with <a href="http://pumka.net/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3BocC5uZXQvbWFudWFsL2VuL2Z1bmN0aW9uLmpzb24tZW5jb2RlLnBocA==">json_encode</a> function.</p>
<p>Last but not least, Flot library is extensible via powerful plug-in system, which I personally found better than digging into long manuals full of functions and properties, all doing not exactly what you need. Sometimes it&#8217;s better to write your own code than rely on features strictly defined by someone else. And Flot library already have many <a href="http://pumka.net/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL2NvZGUuZ29vZ2xlLmNvbS9wL2Zsb3Qvd2lraS9QbHVnaW5z">interesting and useful plug-ins</a> you can use as is or modify as you want.</p>
<p>Flot library and its plug-ins are opensource and free for any use. Compare it to 4-digit prices of commercial libraries. Surprisingly, only one man stands behind development of Flot library core. Well done, <a href="http://pumka.net/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3Blb3BsZS5pb2xhLmRrL29sYXUv">Ole Laursen</a>. Thank you!<br />
This is yet another example of how little opensource &#8220;David&#8221; can beat huge commercial &#8220;Goliath&#8221;. </p>
 <img src="http://pumka.net/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=436" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://pumka.net/2011/04/03/flot-amazing-javascript-jquery-ajax-charting-library/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Beware: stream_copy_to_stream and Zend_Http_Client_Adapter_Socket may hang on old PHP 5.2.x</title>
		<link>http://pumka.net/2011/02/24/beware-stream_copy_to_stream-and-zend_http_client_adapter_socket-may-hang-on-old-php-5-2-x/</link>
		<comments>http://pumka.net/2011/02/24/beware-stream_copy_to_stream-and-zend_http_client_adapter_socket-may-hang-on-old-php-5-2-x/#comments</comments>
		<pubDate>Thu, 24 Feb 2011 18:04:55 +0000</pubDate>
		<dc:creator>Anton Oliinyk</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Zend Framework]]></category>
		<category><![CDATA[HTTP]]></category>

		<guid isPermaLink="false">http://pumka.net/?p=422</guid>
		<description><![CDATA[Zend_Http_Client_Adapter_Socket and stream_copy_to_stream used by it may run into infinite loop on some hosting with old PHP 5.2.x. Find how to workaround the problem.]]></description>
			<content:encoded><![CDATA[<p>Recently we found that our Zend Framework based application was running into infinite loop and terminated by execution timeout on some hostings. The problem was found in Zend_Http_Client_Adapter_Socket class which uses stream_copy_to_stream if you configure Zend_Http_Client for writing data to stream.</p>
<p>The problem already was reported on ZF issue tracker but wasn&#8217;t fixed: <a href="http://pumka.net/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL2ZyYW1ld29yay56ZW5kLmNvbS9pc3N1ZXMvYnJvd3NlL1pGLTkyNjU=">http://framework.zend.com/issues/browse/ZF-9265</a>.<br />
It seems that the cause is a bug in stream_copy_to_stream that was fixed at some point during PHP 5.2.x development.</p>
<p>But as we need to run our code on virtually any hosting we decided to work around this problem by replacing stream_copy_to_stream with fread and fwrite in Zend_Http_Client_Adapter_Socket code.<br />
Notice that Zend_Http_Client_Adapter_Curl is not affected by this problem as it uses internal code for writing to streams. Thus, switching to Zend_Http_Client_Adapter_Curl sounds as the easiest solution. We added automatic switching to it by checking if &#8216;curl_init&#8217; function exists and if so we use Zend_Http_Client_Adapter_Curl as the adapter for Zend_Http_Client.</p>
 <img src="http://pumka.net/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=422" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://pumka.net/2011/02/24/beware-stream_copy_to_stream-and-zend_http_client_adapter_socket-may-hang-on-old-php-5-2-x/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>We moved!</title>
		<link>http://pumka.net/2010/10/28/we-moved/</link>
		<comments>http://pumka.net/2010/10/28/we-moved/#comments</comments>
		<pubDate>Thu, 28 Oct 2010 05:07:14 +0000</pubDate>
		<dc:creator>Anton Oliinyk</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://pumka.net/?p=401</guid>
		<description><![CDATA[We moved to more reliable, faster, and cheaper web-leader.net hosting. Goodbye, GoDaddy!]]></description>
			<content:encoded><![CDATA[<p>We moved to more reliable, faster, and cheaper <a href="http://pumka.net/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3d3dy53ZWItbGVhZGVyLm5ldC9teS1hY2NvdW50L2FmZi5waHA/YWZmPTAxNw==">web-leader.net</a> hosting. Goodbye, GoDaddy!</p>
 <img src="http://pumka.net/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=401" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://pumka.net/2010/10/28/we-moved/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

