<?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>Serge&#039;s Technology View &#187; php</title>
	<atom:link href="http://blog.dragonsoft.us/tag/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.dragonsoft.us</link>
	<description>Talk about Technologies, Software Architecture and Management</description>
	<lastBuildDate>Tue, 20 Apr 2010 14:42:38 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>PHP, MySQL and error &#8220;2006: MySQL server has gone away&#8221;</title>
		<link>http://blog.dragonsoft.us/2010/03/24/php-mysql-and-error-2006-mysql-server-has-gone-away/</link>
		<comments>http://blog.dragonsoft.us/2010/03/24/php-mysql-and-error-2006-mysql-server-has-gone-away/#comments</comments>
		<pubDate>Wed, 24 Mar 2010 05:34:07 +0000</pubDate>
		<dc:creator>Serguei Dosyukov</dc:creator>
				<category><![CDATA[Web-design]]></category>
		<category><![CDATA[enable reconnect]]></category>
		<category><![CDATA[error 2006]]></category>
		<category><![CDATA[Gallery 3]]></category>
		<category><![CDATA[menalto]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[MySQL server has gone away]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://blog.dragonsoft.us/?p=1129</guid>
		<description><![CDATA[As a hobby I like to do little photography. Same time I do not like to give my photos to someone else to host, so I have my gallery. It runs on Menalto&#8217;s Gallery 3 engine &#8211; nice, open source, PHP based with MySQL back-end. Not my primary programming language, but allows me to host [...]]]></description>
			<content:encoded><![CDATA[<p>As a hobby I like to do little photography.</p>
<p>Same time I do not like to give my photos to someone else to host, so I have my gallery.</p>
<p>It runs on Menalto&#8217;s Gallery 3 engine &#8211; nice, open source, PHP based with MySQL back-end.</p>
<p>Not my primary programming language, but allows me to host and enhance my blog, keep my gallery and small web-site.</p>
<p>Last night, while bringing some old photos over from my backup gallery (G3 is still under development and I do not want to recreate gallery if anything to happen, and it did &#8211; I killed the setup&#8230;), I noticed that import process start to fail. Several attempts to recover did not give much of the progress and I went digging error logs.</p>
<div>
<p>Well,.. I learned something interesting. I am not a PHP programmer, at least it is not that I do for living, or not at this time&#8230; but even doing simple house work forces you learn things <img src='http://blog.dragonsoft.us/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /><br />
G3 runs on Kohana framework and there is a wrapper for DB access.</p>
<p>What happend was that some of the SQL requests began timing out</p>
<blockquote><p>Database_Exception [ 44 ]: #2006: MySQL server has gone away</p></blockquote>
<p>In case when queries are not optimal, one has to learn how to manage PHP&#8230; through php.ini&#8230;</p>
<p>MySQL timeout related errors are &#8220;fixed&#8221; by telling mysql to reconnect&#8230; and for that &#8220;tricks&#8221; are handy&#8230;<br />
From browsing, reading, browsing, filtering, &#8230; while waiting for G2 Import I have found a solution which lead me <a href="http://www.php.net/manual/en/ini.list.php" target="_blank">here</a>. One of interest is called <strong>mysqli.reconnect</strong>. Little magic - simply adding the following line in PHP.INI would tell MySQL reconnect.</p>
<blockquote><p>mysqli.reconnect=1</p></blockquote>
<p>It may be still slow, but at least connection would recover gracefully.</p>
<p>We can talk about code styles, code protection and error handling, but line above is a hidden gold on the end of the rainbow called PHP.</p>
</div>
<hr/><span style="font-size: 7pt">Copyright &copy; 2010 <strong><a href="http://blog.dragonsoft.us">Serge&#039;s Technology View</a></strong>. This Feed is for personal non-commercial use only.</span>]]></content:encoded>
			<wfw:commentRss>http://blog.dragonsoft.us/2010/03/24/php-mysql-and-error-2006-mysql-server-has-gone-away/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to embed Google Docs document into your page</title>
		<link>http://blog.dragonsoft.us/2009/06/24/how-to-embed-google-docs-document-into-your-page/</link>
		<comments>http://blog.dragonsoft.us/2009/06/24/how-to-embed-google-docs-document-into-your-page/#comments</comments>
		<pubDate>Wed, 24 Jun 2009 16:01:32 +0000</pubDate>
		<dc:creator>Serguei Dosyukov</dc:creator>
				<category><![CDATA[Web-design]]></category>
		<category><![CDATA[embed google docs content]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://blog.dragonsoft.us/?p=985</guid>
		<description><![CDATA[There are plenty of presentations, documents, and spreadsheets we may want to share with the world. We can use homegrown document handling solutions, use commercial 3rd party solutions or&#8230; utilize power provided by Google Docs. When storing articles on Google Docs you are provided with the option to share them with some people only or [...]]]></description>
			<content:encoded><![CDATA[<p>There are plenty of presentations, documents, and spreadsheets we may want to share with the world.</p>
<p>We can use homegrown document handling solutions, use commercial 3rd party solutions or&#8230; utilize power provided by <a href="http://docs.google.com/" target="_blank">Google Docs</a>.</p>
<p>When storing articles on Google Docs you are provided with the option to share them with some people only or with everyone. I like to have option to link my articles from anywhere but I also like to have not just plain page, but a page embedded into my web-site pages.</p>
<p>What it means is that instead of<a href="http://docs.google.com/View?id=dgwckpgv_1t38fmc" target="_blank"> external page</a>, I want to <a href="http://www.dragonsoft.us/articles.php?id=dgwckpgv_1t38fmc" target="_blank">put it in my own box</a>.</p>
<p>There was time when it wasn&#8217;t as easy because of the additional code Google was injecting into articles, but time changed and now it is fairly easy and strait forward.</p>
<h3>Goals</h3>
<ul>
<li>Embed Google Docs document into existing page</li>
<li>PHP. This is not really a requirement per se, it is just code below is PHP.</li>
<li>Retain copyright information</li>
</ul>
<h3>Solution</h3>
<p>The following code snippet allows to get a desired result</p>
<pre class="brush: php;">// id parameter is used to pass Google Docs arcticle id
// Example: mydocview.php?id=nnnnnnnnnnnnnnnn

$id    = $_REQUEST['id'];
if ($id) {
  $started = &quot;0&quot;;
  echo('&lt;div class=&quot;googledocs&quot; &gt;Stored and managed via &lt;a title=&quot;Learn more about Google Docs&quot; href=&quot;http://docs.google.com&quot; target=&quot;_blank&quot;&gt;Google Docs &amp;copy; -- Web word processing, presentations and spreadsheets.&lt;/a&gt;&lt;/div&gt;');

  // Read document content, parse to normalize and output
  $file = fopen (&quot;http://docs.google.com/View?id=&quot; . $id, &quot;r&quot;);
  while (!feof ($file)) {
    $line = fgets ($file, 4096);

    // Parse header info out
    if ($started == &quot;0&quot;) {
      if (substr($line, 0, 5) == '&lt;body') { $started = &quot;1&quot;; }
      else { continue; }
    }

    // Parse body content until document content block is detected
    if ($started == &quot;1&quot;) {
      if (strstr($line, '&lt;div id=&quot;doc-contents&quot;&gt;')) { $started = &quot;2&quot;; }
      else { continue; }
    }

    // Output document content
    if ($started == &quot;2&quot;) {
      // Stop processing, end of content reached
      if (strstr($line, '&lt;div id=&quot;google-view-footer&quot;&gt;')) { break; }

      // Normalize image links to keep link back to google docs
      $line = str_replace('src=&quot;File?id', 'src=&quot;http://docs.google.com/File?id', $line);

      // Normalize links to other articles
      $line = str_replace('href=&quot;View?docid=', 'href=&quot;/mydocview.php?id=', $line);
      $line = str_replace('href=&quot;View?id=', 'href=&quot;/mydocview.php?id=', $line);
      $line = str_replace('href=&quot;View?docID=', 'href=&quot;/mydocview.php?id=', $line);
      $line = str_replace('href=&quot;View?', 'href=&quot;/mydocview.php?', $line);

      // Output result
      echo($line);
    }
  }
  fclose($file);
}</pre>
<p>Sample page:</p>
<pre class="brush: php;">&lt;html&gt;
&lt;head&gt;&lt;/head&gt;
&lt;body&gt;
&lt;? // Include code above here
?&gt;
&lt;/body&gt;
&lt;/html&gt;</pre>
<hr/><span style="font-size: 7pt">Copyright &copy; 2010 <strong><a href="http://blog.dragonsoft.us">Serge&#039;s Technology View</a></strong>. This Feed is for personal non-commercial use only.</span>]]></content:encoded>
			<wfw:commentRss>http://blog.dragonsoft.us/2009/06/24/how-to-embed-google-docs-document-into-your-page/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Delphi for AS/400 is comming back home</title>
		<link>http://blog.dragonsoft.us/2008/03/10/delphi-for-as400-is-comming-back/</link>
		<comments>http://blog.dragonsoft.us/2008/03/10/delphi-for-as400-is-comming-back/#comments</comments>
		<pubDate>Mon, 10 Mar 2008 12:26:48 +0000</pubDate>
		<dc:creator>Serguei Dosyukov</dc:creator>
				<category><![CDATA[Delphi]]></category>
		<category><![CDATA[as/400]]></category>
		<category><![CDATA[delphi]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://blog.dragonsoft.us/2008/03/10/delphi-for-as400-is-comming-back/</guid>
		<description><![CDATA[Delphi for AS/400 is coming back. Some of you might remember this product from long time ago. Well&#8230; it is back. Let put onto our history book. CodeGear just announced a return of long missing child and it is available to try and to purchase. And it is not just Delphi but Delphi for PHP version. As [...]]]></description>
			<content:encoded><![CDATA[<p>Delphi for AS/400 is coming back. Some of you might remember this product from long time ago. Well&#8230; it is back. Let put onto our <a href="http://www.dragonsoft.us/delphi_history.php" target="_blank">history book</a>.</p>
<p>CodeGear <a href="http://biz.yahoo.com/bw/080310/20080310005235.html?.v=1" target="_blank">just announced</a> a return of long missing child and it is available to <a href="http://www.codegear.com/products/delphi/400" target="_blank">try and to purchase</a>. And it is not just Delphi but Delphi for PHP version.</p>
<p>As it appears Delphi/400 was &#8220;<a href="http://www.SystemObjects.com" target="_blank">out of the house</a>&#8221; for quite some time where it was still undergoing development.</p>
<blockquote><p>In 1997, we signed an agreement with Borland, licensing our AS/400 middleware technology, ClientObjects/400 to create a world-class suite of Object-Oriented Development tools. These innovative development applications, Delphi/400, JBuilder for iSeries and C++Builder/400, were designed specifically for the AS/400 developer community.</p>
<p>Since the introduction of Delphi/400 and C++Builder/400, developers and corporations worldwide have been using SystemObjects solutions for application development and deployment.</p>
<p>Our Partner Network provides education, consulting, training and support to thousands of developers and users in all countries.</p>
<p>In February 1999, SystemObjects and Borland entered into a global agreement which:</p>
<p>Consolidates the commitment of both Borland and SystemObjects to providing the highest quality development products for the IBM AS/400 community,<br />
Recognizes the importance of the IBM AS/400 market by focusing future development, distribution and support of its products dedicated to the IBM AS/400,<br />
Entrusts AS/400 experts, such as SystemObjects, with maintaining Borland&#8217;s high quality standards,<br />
Increases Borland&#8217;s investment in the AS/400 market.</p></blockquote>
<p>Full history note is available <a href="http://www.systemobjects.com/presentation.html" target="_blank">here</a>.</p>
<p>What it is exactly then? As it is stated on the web-site and in other places &#8211; it is <a href="http://www.systemobjects.com/homedelphi400.html" target="_blank">Delphi 2006 which has connectivity to AS/400 back-end</a> - see screenshot <a href="http://www.systemobjects.com/images/imaged400_big.gif" target="_blank">here</a>. Also it has ability for easy deployment to iSystem.<br />
I think there was some mentioning of Linux port, but I think it has &#8220;died&#8221; along with Delphi 7/Kylix.</p>
<p>Same applies to <a href="http://www.systemobjects.com/homedelphi400php.html" target="_blank">Delphi/400 for PHP</a>. It is <a href="http://www.systemobjects.com/images/imagephp_big.gif" target="_blank">regular DfPHP</a> with connectivity to back-end.</p>
<hr/><span style="font-size: 7pt">Copyright &copy; 2010 <strong><a href="http://blog.dragonsoft.us">Serge&#039;s Technology View</a></strong>. This Feed is for personal non-commercial use only.</span>]]></content:encoded>
			<wfw:commentRss>http://blog.dragonsoft.us/2008/03/10/delphi-for-as400-is-comming-back/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Create your first Widget for WordPress &#8211; PHPText</title>
		<link>http://blog.dragonsoft.us/2008/01/10/create-your-first-widget-for-wordpress-phptext/</link>
		<comments>http://blog.dragonsoft.us/2008/01/10/create-your-first-widget-for-wordpress-phptext/#comments</comments>
		<pubDate>Fri, 11 Jan 2008 05:22:51 +0000</pubDate>
		<dc:creator>Serguei Dosyukov</dc:creator>
				<category><![CDATA[Web-design]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[sidebar]]></category>
		<category><![CDATA[text]]></category>
		<category><![CDATA[widget]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://blog.dragonsoft.us/2008/01/10/create-your-first-widget-for-wordpress-phptext/</guid>
		<description><![CDATA[There is my first WordPress Widget &#8211; PHP Text &#8211; Text Box which accepts arbitrary PHP code and can execute it inside sidebar block. Another requirement is that it is only be allowed to be entered by Admin User. I have started with the original code for Text Widget and adjusted it to include such [...]]]></description>
			<content:encoded><![CDATA[<p>There is my first WordPress Widget &#8211; PHP Text &#8211; Text Box which accepts arbitrary PHP code and can execute it inside sidebar block.<br />
Another requirement is that it is only be allowed to be entered by Admin User.</p>
<p>I have started with the original code for Text Widget and adjusted it to include such restriction.</p>
<p>It has superseded my IFrame solution discussed in prior post and works well except that CSS is not yet applied.</p>
<p>What has been demonstrated by this little project:</p>
<ul>
<li>how to register your own sidebar widget</li>
<li>how to support multiple instances of the same widget in the sidebar</li>
<li>how to manage widget options from popup options window in Widget  Manager section of your Blog Admin Panel</li>
<li>how to store/read widget options</li>
<li>how to make your widget properly appear at the sidebar</li>
<li>implement some basic user rights manager</li>
</ul>
<p>If you&#8217;d like to use it in your blog, source code is available here &#8211; <a href="http://blog.dragonsoft.us/wp-content/uploads/2008/01/wp-phptext.zip" title="WordPress PHP Text Widget">WordPress PHP Text Widget</a>.</p>
<p>I hope this little example would help you started with Plug-in development for your WordPress Blog.</p>
<p><font color="#ff0000"><strong>WARNING: </strong>Any code injections allowed by dynamic content comes with possible security risk. Please be cautious about what you allow to be executed by the PHP code specified in the widget. I would strongly suggest avoiding use of external sources you have no control over.</font></p>
<hr/><span style="font-size: 7pt">Copyright &copy; 2010 <strong><a href="http://blog.dragonsoft.us">Serge&#039;s Technology View</a></strong>. This Feed is for personal non-commercial use only.</span>]]></content:encoded>
			<wfw:commentRss>http://blog.dragonsoft.us/2008/01/10/create-your-first-widget-for-wordpress-phptext/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
