<br />
<b>Warning</b>:  is_readable(): open_basedir restriction in effect. File(./rss/rss10.template) is not within the allowed path(s): (/home/chrismic/:/tmp/:/var/tmp/:/opt/alt/php81/usr/share/pear/:/dev/urandom:/usr/local/php56/lib/:/usr/local/php81/lib/:/usr/local/php71/lib/:/usr/local/php74/lib/:/usr/local/php56/lib/:/usr/local/lib/php/) in <b>/home/chrismic/domains/chrismichaelides.eu/public_html/admin/lifetype-1.2.12/class/file/file.class.php</b> on line <b>208</b><br />
<br />
<b>Warning</b>:  file_exists(): open_basedir restriction in effect. File(./rss/rss10.template) is not within the allowed path(s): (/home/chrismic/:/tmp/:/var/tmp/:/opt/alt/php81/usr/share/pear/:/dev/urandom:/usr/local/php56/lib/:/usr/local/php81/lib/:/usr/local/php71/lib/:/usr/local/php74/lib/:/usr/local/php56/lib/:/usr/local/lib/php/) in <b>/home/chrismic/domains/chrismichaelides.eu/public_html/admin/lifetype-1.2.12/class/template/smarty/Smarty.class.php</b> on line <b>1642</b><br />
<br />
<b>Warning</b>:  is_readable(): open_basedir restriction in effect. File(./rss/rss10.template) is not within the allowed path(s): (/home/chrismic/:/tmp/:/var/tmp/:/opt/alt/php81/usr/share/pear/:/dev/urandom:/usr/local/php56/lib/:/usr/local/php81/lib/:/usr/local/php71/lib/:/usr/local/php74/lib/:/usr/local/php56/lib/:/usr/local/lib/php/) in <b>/home/chrismic/domains/chrismichaelides.eu/public_html/admin/lifetype-1.2.12/class/file/file.class.php</b> on line <b>208</b><br />
<br />
<b>Warning</b>:  Cannot modify header information - headers already sent by (output started at /home/chrismic/domains/chrismichaelides.eu/public_html/admin/lifetype-1.2.12/class/file/file.class.php:208) in <b>/home/chrismic/domains/chrismichaelides.eu/public_html/admin/lifetype-1.2.12/class/view/view.class.php</b> on line <b>328</b><br />
<br />
<b>Warning</b>:  Cannot modify header information - headers already sent by (output started at /home/chrismic/domains/chrismichaelides.eu/public_html/admin/lifetype-1.2.12/class/file/file.class.php:208) in <b>/home/chrismic/domains/chrismichaelides.eu/public_html/admin/lifetype-1.2.12/class/view/view.class.php</b> on line <b>175</b><br />
<br />
<b>Warning</b>:  is_readable(): open_basedir restriction in effect. File(./rss/rss10.template) is not within the allowed path(s): (/home/chrismic/:/tmp/:/var/tmp/:/opt/alt/php81/usr/share/pear/:/dev/urandom:/usr/local/php56/lib/:/usr/local/php81/lib/:/usr/local/php71/lib/:/usr/local/php74/lib/:/usr/local/php56/lib/:/usr/local/lib/php/) in <b>/home/chrismic/domains/chrismichaelides.eu/public_html/admin/lifetype-1.2.12/class/file/file.class.php</b> on line <b>208</b><br />
<br />
<b>Warning</b>:  Cannot modify header information - headers already sent by (output started at /home/chrismic/domains/chrismichaelides.eu/public_html/admin/lifetype-1.2.12/class/file/file.class.php:208) in <b>/home/chrismic/domains/chrismichaelides.eu/public_html/admin/lifetype-1.2.12/class/view/smartyview.class.php</b> on line <b>245</b><br />
<br />
<b>Warning</b>:  is_readable(): open_basedir restriction in effect. File(./rss/rss10.template) is not within the allowed path(s): (/home/chrismic/:/tmp/:/var/tmp/:/opt/alt/php81/usr/share/pear/:/dev/urandom:/usr/local/php56/lib/:/usr/local/php81/lib/:/usr/local/php71/lib/:/usr/local/php74/lib/:/usr/local/php56/lib/:/usr/local/lib/php/) in <b>/home/chrismic/domains/chrismichaelides.eu/public_html/admin/lifetype-1.2.12/class/file/file.class.php</b> on line <b>208</b><br />
<?xml version="1.0" encoding="iso-8859-1"?>
<?xml-stylesheet href="http://chrismichaelides.eu/admin/lifetype-1.2.12/styles/rss.css" type="text/css"?>
<rdf:RDF
  xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
  xmlns:dc="http://purl.org/dc/elements/1.1/"
  xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
  xmlns:admin="http://webns.net/mvcb/"
  xmlns="http://purl.org/rss/1.0/"
>
 <channel rdf:about="http://chrismichaelides.eu/admin/lifetype-1.2.12/rss.php?blogId=1&amp;profile=rss10">
  <title>Chris Michaelides | Tech Artist</title>
  <link>http://chrismichaelides.eu/admin/lifetype-1.2.12/index.php?blogId=1</link>
  <description></description>
    <dc:creator>chris</dc:creator>
  <dc:date>2014-12-30T13:59:16Z</dc:date>
  <admin:generatorAgent rdf:resource="http://www.lifetype.net" />
  <items>
   <rdf:Seq>
       <rdf:li rdf:resource="http://chrismichaelides.eu/admin/lifetype-1.2.12/index.php?op=ViewArticle&amp;articleId=17&amp;blogId=1" />
       <rdf:li rdf:resource="http://chrismichaelides.eu/admin/lifetype-1.2.12/index.php?op=ViewArticle&amp;articleId=16&amp;blogId=1" />
       <rdf:li rdf:resource="http://chrismichaelides.eu/admin/lifetype-1.2.12/index.php?op=ViewArticle&amp;articleId=15&amp;blogId=1" />
       <rdf:li rdf:resource="http://chrismichaelides.eu/admin/lifetype-1.2.12/index.php?op=ViewArticle&amp;articleId=14&amp;blogId=1" />
       <rdf:li rdf:resource="http://chrismichaelides.eu/admin/lifetype-1.2.12/index.php?op=ViewArticle&amp;articleId=13&amp;blogId=1" />
       <rdf:li rdf:resource="http://chrismichaelides.eu/admin/lifetype-1.2.12/index.php?op=ViewArticle&amp;articleId=12&amp;blogId=1" />
       <rdf:li rdf:resource="http://chrismichaelides.eu/admin/lifetype-1.2.12/index.php?op=ViewArticle&amp;articleId=11&amp;blogId=1" />
       <rdf:li rdf:resource="http://chrismichaelides.eu/admin/lifetype-1.2.12/index.php?op=ViewArticle&amp;articleId=10&amp;blogId=1" />
       <rdf:li rdf:resource="http://chrismichaelides.eu/admin/lifetype-1.2.12/index.php?op=ViewArticle&amp;articleId=9&amp;blogId=1" />
       <rdf:li rdf:resource="http://chrismichaelides.eu/admin/lifetype-1.2.12/index.php?op=ViewArticle&amp;articleId=8&amp;blogId=1" />
      </rdf:Seq>
  </items> 
 </channel>
  <item rdf:about="http://chrismichaelides.eu/admin/lifetype-1.2.12/index.php?op=ViewArticle&amp;articleId=17&amp;blogId=1">
  <title>How to get an image out of a given URL with PHP</title>
  <link>http://chrismichaelides.eu/admin/lifetype-1.2.12/index.php?op=ViewArticle&amp;articleId=17&amp;blogId=1</link>
  <dc:description>&lt;p&gt;&lt;img style=&quot;margin: 5px;&quot; src=&quot;http://chrismichaelides.eu/admin/lifetype-1.2.12/gallery/1/PHP.png&quot; alt=&quot;alt&quot; /&gt;&lt;br /&gt;Sometimes there are URLs which point to images. While it&#039;s easy to just&lt;br /&gt;[code]&lt;br /&gt;&amp;lt;img src=&quot;URL&quot; /&amp;gt;&lt;br /&gt;[/code]&lt;/p&gt;
&lt;p&gt;in HTML, there are cases where this is not possible, or will not work.&lt;/p&gt;
&lt;p&gt;In such cases, this handy PHP method will come to the solution:&lt;/p&gt;
&lt;p&gt;[code]&lt;br /&gt;&amp;lt;?php &lt;br /&gt;function remoteImage($URL) {&lt;br /&gt;&lt;br /&gt;$remoteImage = htmlentities($URL);&lt;br /&gt;$imginfo = exif_imagetype($remoteImage);&lt;br /&gt;&lt;br /&gt;$image = false;&lt;br /&gt;switch ($imginfo) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; case &quot;IMAGETYPE_JPEG&quot;:&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; $image = imagecreatefromjpeg($remoteImage);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; $imginfo = &quot;image/jpeg&quot;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; $type = &quot;imagejpeg&quot;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; $filename = time().mt_rand().&#039;.jpg&#039;; // if you want to save it locally&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; break;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; case &quot;IMAGETYPE_PNG&quot;:&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; $image = imagecreatefrompng($remoteImage);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; $imginfo = &quot;image/png&quot;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; $type = &quot;imagepng&quot;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; $filename = time().mt_rand().&#039;.png&#039;; // if you want to save it locally&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; break;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; case &quot;IMAGETYPE_GIF&quot;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; $image = imagecreatefromgif($remoteImage);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; $imginfo = &quot;image/gif&quot;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; $type = &quot;imagegif&quot;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; $filename = time().mt_rand().&#039;.gif&#039;; // if you want to save it locally&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; break;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;if ($image) {&lt;br /&gt;&lt;br /&gt;&amp;nbsp; ob_start();&lt;br /&gt;&amp;nbsp; header( &quot;Content-type: &quot;.$imginfo );&lt;br /&gt;&amp;nbsp; $type( $image, NULL, 100 );&lt;br /&gt;&amp;nbsp; imagedestroy( $image );&lt;br /&gt;&amp;nbsp; $i = ob_get_clean();&lt;br /&gt;&amp;nbsp; return &quot;data:&quot; . $imginfo . &quot;;base64,&quot; . base64_encode( $i );&lt;br /&gt;&amp;nbsp; &lt;br /&gt;}&lt;br /&gt;else return false;&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;?&amp;gt;&lt;br /&gt;[/code]&lt;/p&gt;
&lt;p&gt;And you can call it like this:&lt;/p&gt;
&lt;p&gt;[code]&lt;br /&gt;&amp;lt;?php&lt;br /&gt;$remoteImage = remoteImage(&quot;http://www.example.com/somefile_that_generates_an_image&quot;);&lt;br /&gt;if ($remoteImage) echo &quot;&amp;lt;img src=&#039;&quot;. $remoteImage .&quot;&#039; /&amp;gt;&quot;;&lt;br /&gt;else echo &quot;Image not found!&quot;;&lt;br /&gt;?&amp;gt;&lt;br /&gt;[/code]&lt;/p&gt;</dc:description>
      
    <dc:subject>Web Development</dc:subject>
     
    
  <dc:date>2014-12-30T13:39:25Z</dc:date>
    <dc:creator>chris</dc:creator>
 </item>
  <item rdf:about="http://chrismichaelides.eu/admin/lifetype-1.2.12/index.php?op=ViewArticle&amp;articleId=16&amp;blogId=1">
  <title>Git pull, push, and commit - Quick tutorial</title>
  <link>http://chrismichaelides.eu/admin/lifetype-1.2.12/index.php?op=ViewArticle&amp;articleId=16&amp;blogId=1</link>
  <dc:description>&lt;p&gt;&lt;img style=&quot;margin: 5px;&quot; src=&quot;http://chrismichaelides.eu/admin/lifetype-1.2.12/gallery/1/130712_git_github_topdenota1.jpg&quot; alt=&quot;alt&quot; /&gt;&lt;/p&gt;
&lt;p&gt;GitHub&#039;s a great tool to maintain your code, but it&#039;s definitely a little confusing the first time around (and, possibly, a few times after that). Here is a quick guide on how to use it efficiently.&lt;/p&gt;
&lt;p&gt;To start working with GitHub, first you have to &lt;a href=&quot;https://github.com/&quot; target=&quot;_blank&quot;&gt;sign up on the GitHub&lt;/a&gt; frontpage. Once you&#039;ve signed up, &lt;a href=&quot;https://help.github.com/articles/create-a-repo/&quot; target=&quot;_blank&quot;&gt;create a repository&lt;/a&gt; where all your project&#039;s code will be maintained.&lt;/p&gt;
&lt;p&gt;Once you are all set on the GitHub site, you have to &lt;a href=&quot;http://git-scm.com/downloads&quot; target=&quot;_blank&quot;&gt;install git&lt;/a&gt; on your local machine.&lt;/p&gt;
&lt;p&gt;Now you are ready to upload your local files to your repository. To do that, first we must initialize some settings in git:&lt;/p&gt;
&lt;p&gt;Open up a terminal and enter the following two commands:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;git config --global user.name &quot;Your Name Here&quot;&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;git config --global user.email &quot;your_email@youremail.com&quot;&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Make sure that you give your GitHub email address as user.email. As user.name you can enter whatever you like.&lt;/p&gt;
&lt;p&gt;After the initial configuration is done, you can synchronize your local files with your repository. Go to the local directory where your project&#039;s files reside and enter the command:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;git init&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;With git, you synchronize yor files through commits. Each commit contains files that you specify to be uploaded to GitHub. To add files to a commit enter:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;git add example.php&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;The above will add example.php to the next commit. If you want to add all files and folders, you enter the command:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;git add -A&lt;br /&gt;&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Once you are happy with the files you want uploaded to GitHub, enter the command:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;git commit -m &quot;optional message. usually the purpose of this commit, eg. why changes were made&quot;&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;This will get all files you added ready for uploading to GitHub. To actually upload them, you enter the commands:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;git remote add origin https://github.com/yourusername/nameofyourrepository&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;git push origin master&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;If you get an error message, it can be that the GitHub repository contains files not currently on your local folder. In that case you have to &quot;pull&quot;(download) them first from GitHub, before you can synchronize your project. To pull files from GitHub you enter the command:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;git pull https://github.com/yourusername/nameofyourrepository&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;After &quot;pulling&quot; has finished, you can try to &quot;push&quot;(upload) your commit again:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;git push origin master&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;That&#039;s it! You&#039;ve &quot;pushed&quot; your local files to your GitHub repository.&lt;/p&gt;
&lt;p&gt;Now whenever you make changes to your local files, you can add them to a commit and push them to the repository. You can also pull from the repository to work on other people&#039;s commits (if you&#039;re working on a team&#039;s projects). Another scenario is that you can revert to a previous commit in GitHub, and pull the files from that commit to your local folder to work on them.&lt;/p&gt;</dc:description>
      
    <dc:subject>Web Development</dc:subject>
     
    
  <dc:date>2014-12-26T17:06:24Z</dc:date>
    <dc:creator>chris</dc:creator>
 </item>
  <item rdf:about="http://chrismichaelides.eu/admin/lifetype-1.2.12/index.php?op=ViewArticle&amp;articleId=15&amp;blogId=1">
  <title>My thoughts about TheGrid.io</title>
  <link>http://chrismichaelides.eu/admin/lifetype-1.2.12/index.php?op=ViewArticle&amp;articleId=15&amp;blogId=1</link>
  <dc:description>&lt;p&gt;&lt;img style=&quot;margin: 5px;&quot; src=&quot;http://chrismichaelides.eu/admin/lifetype-1.2.12/gallery/1/thegrid.png&quot; alt=&quot;TheGrid.io&quot; height=&quot;350&quot; width=&quot;564&quot; /&gt;&lt;/p&gt;
&lt;p&gt;A lot of hype on the social media about TheGrid.io.&lt;br /&gt;The Grid will supposedly harness the power of artificial intelligence to take  everything you throw at it - videos, images, text, urls and more - and  automatically shape them into a custom website unique to you.&lt;/p&gt;
&lt;p&gt;Let&#039;s have a closer look at this.&lt;/p&gt;
&lt;p&gt;First let&#039;s take a look at their own site &lt;a href=&quot;http://thegrid.io&quot;&gt;thegrid.io&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;This site was built with TheGrid AI, and immediately we can identify it as a modern landing page.&lt;br /&gt;As it seems the AI knows how to create landing pages. The layout is good, responsive, and feels modern like any other landing page template. What is revolutionary here is the automation of content, so users with no HTML knowledge can use TheGrid as simple as posting on their Facebook page. TheGrid AI takes care of color matching and arranging content in a neat layout.&lt;/p&gt;
&lt;p&gt;But let&#039;s dig a little deeper...&lt;/p&gt;
&lt;p&gt;First of all, TheGrid AI seems like it can only render landing pages. For every new page you want to add to your site, you will have to get a new design. Complex stuff that are needed by sites that are not just personal/portfolio/presentation sites are not possible. To get complex stuff working you still have to get your hands dirty and dig into the code. Compatibility issues and hitting walls thoughts come to mind...&lt;/p&gt;
&lt;p&gt;Each TheGrid site will be posted on github, so you (and others) can look at the code of your site (and make changes) whenever you need to. TheGrid.io website is also posted on github. Let&#039;s take a look at it:&lt;/p&gt;
&lt;p&gt;&lt;a class=&quot;ot-anchor aaTEdf&quot; dir=&quot;ltr&quot; rel=&quot;nofollow&quot; href=&quot;https://github.com/the-domains/the-grid/blob/gh-pages/index.html&quot; target=&quot;_blank&quot;&gt;https://github.com/the-domains/the-grid/blob/gh-pages/&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Here you can see that each page is a new design.&lt;br /&gt;Also what strikes most is the size of the pages! Take a look at the index.html page:&lt;/p&gt;
&lt;p&gt;&lt;a class=&quot;ot-anchor aaTEdf&quot; dir=&quot;ltr&quot; rel=&quot;nofollow&quot; href=&quot;https://github.com/the-domains/the-grid/blob/gh-pages/index.html&quot; target=&quot;_blank&quot;&gt;https://github.com/the-domains/the-grid/blob/gh-pages/index.html&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Their homepage index.html file is 1887.137 kb&lt;strong&gt;&lt;/strong&gt;! Incredibly huge! That simply won&#039;t do.&lt;/p&gt;
&lt;p&gt;Now if you go to their website, you will see a perfect example of dishonest marketing and over-exaggeration. A lot of big claims and framing  everything in a mysterious science-fiction &quot;AI&quot; context. This may be  good marketing to target certain people but I just find it dishonest.&lt;br /&gt;&lt;br /&gt;What  do those blue dots and edges represent on the little girl photo? Face  detection algorithms (Viola-Jones, CNNs etc) usually don&#039;t work like  this. Are you doing single-photo 3D reconstuction? Or maybe, just maybe,  you just put whatever looks cool and evokes futuristic feelings in the  viewer...&lt;br /&gt;&lt;br /&gt;This just seems like a web template for personal sites  that figures out how to lay out your content boxes in some table  arrangement according to a certain optimization criterion. I&#039;m not  impressed.&lt;/p&gt;
&lt;p&gt;Not  to mention they&#039;re going to host all this, so the idea of no walled  garden is just a lie. You can take everything that&#039;s been rendered, but  you wont be able to build any more pages. Since no templates etc.  you&#039;re completely locked in unless you get a new design.&lt;br /&gt;&lt;br /&gt;It all sounds nice until you dig into the details...&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Conclusion:&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;TheGrid.io is just a good example of excellent marketing. &amp;nbsp;It&#039;s nothing new, just an extremely improved (but also very limiting) WYSIWYG web builder.&lt;/p&gt;
&lt;p&gt;I look at this Grid product and see it as a glorified website builder,  using the same old stock templates, and then making &quot;decisions&quot; based on  Analytics and market data. The thinking part goes to maximize return  while minimizing negative reactions. So the best version of safe.&lt;/p&gt;
&lt;div class=&quot;Aq DK Bt UR gA&quot;&gt;
&lt;div class=&quot;Ct&quot;&gt;Design,  branding and strategy will always be needed and a necessity for many.  Likewise, &amp;ldquo;run-of-the-mill&amp;rdquo; products like TheGrid.io will be good enough for many others. There  are businesses and then there are businesses &amp;mdash; the smart ones will  continue to stand apart for many reasons, this one included.&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;There will always be people in search of a quick fix. This tool is for  all the people who wouldn&#039;t pay for a professional website anyway.&lt;/p&gt;
&lt;p&gt;But let the kids enjoy their new shiny toys and let TheGrid cash out their  money, nothing I or anyone educated enough to know what this really  is can do anything about it. They are already hyped its done.&lt;/p&gt;</dc:description>
      
    <dc:subject>Web Design</dc:subject>
     
    
  <dc:date>2014-12-25T09:18:26Z</dc:date>
    <dc:creator>chris</dc:creator>
 </item>
  <item rdf:about="http://chrismichaelides.eu/admin/lifetype-1.2.12/index.php?op=ViewArticle&amp;articleId=14&amp;blogId=1">
  <title>How to make an iframe fit its parent element (or in any part of a page for that matter)</title>
  <link>http://chrismichaelides.eu/admin/lifetype-1.2.12/index.php?op=ViewArticle&amp;articleId=14&amp;blogId=1</link>
  <dc:description>&lt;p&gt;&lt;img src=&quot;http://www.startupgreece.gov.gr/sites/default/files/iframe_0.jpg&quot; alt=&quot;alt&quot; height=&quot;140&quot; width=&quot;280&quot; /&gt;&lt;/p&gt;
&lt;div class=&quot;post-text&quot;&gt;
&lt;p&gt;Since we are in the age of CSS3, you can do this by using  viewport units. These units allow you to specify sizes in terms of  percentages of the viewport width and viewport height. This is the  user&#039;s viewport, also known as screen. However, in all major browsers  I&#039;ve tried it, if you put an iframe inside a div, which is inside  another div and positioned relative, the viewport units are relative to  this div. And since 100 viewport height units mean 100% height, you can  do like this:&lt;/p&gt;
&lt;p&gt;[code]&lt;br /&gt;&amp;lt;div id=&quot;parent&quot;&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;div id=&quot;wrapper&quot; style=&quot;position:relative&quot;&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;iframe style=&quot;position:absolute;top:0px;width:100%;height:100vh;&quot; src=&quot;http://anydomain.com&quot;&amp;gt;&amp;lt;/iframe&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/div&amp;gt;&lt;br /&gt;&amp;lt;/div&amp;gt;&lt;br /&gt;[/code]&lt;/p&gt;
&lt;p&gt;I find this to be the best solution possible, since it is &lt;strong&gt;cross-domain&lt;/strong&gt;, and displays exactly like you want it without any javascript or other complex stuff.&lt;/p&gt;
&lt;p&gt;And most importantly, it works on all browsers, even mobile ones (tested on android and iphone)!&lt;/p&gt;
&lt;/div&gt;</dc:description>
      
    <dc:subject>Web Design</dc:subject>
     
    
  <dc:date>2014-03-13T18:42:10Z</dc:date>
    <dc:creator>chris</dc:creator>
 </item>
  <item rdf:about="http://chrismichaelides.eu/admin/lifetype-1.2.12/index.php?op=ViewArticle&amp;articleId=13&amp;blogId=1">
  <title>The Zen of Python</title>
  <link>http://chrismichaelides.eu/admin/lifetype-1.2.12/index.php?op=ViewArticle&amp;articleId=13&amp;blogId=1</link>
  <dc:description>&lt;h3&gt;&lt;img src=&quot;http://thezenofpython.com/xpython-logo-master-v3-TM.png.pagespeed.ic.WwZSb3B1-6.png&quot; alt=&quot;The Zen of Python&quot; height=&quot;203&quot; width=&quot;601&quot; /&gt;&lt;/h3&gt;
&lt;h3&gt;Programming (and Life) Principles:&lt;/h3&gt;
&lt;p&gt;Beautiful is better than ugly.&lt;/p&gt;
&lt;p&gt;Explicit is better than implicit.&lt;/p&gt;
&lt;p&gt;Simple is better than complex.&lt;/p&gt;
&lt;p&gt;Complex is better than complicated.     Flat is better than nested.&lt;/p&gt;
&lt;p&gt;Sparse is better than dense.&lt;/p&gt;
&lt;p&gt;Readability counts.&lt;/p&gt;
&lt;p&gt;Special cases aren&#039;t special enough to break the rules.&lt;/p&gt;
&lt;p&gt;Although practicality beats purity.&lt;/p&gt;
&lt;p&gt;Errors should never pass silently.&lt;/p&gt;
&lt;p&gt;Unless explicitly silenced.&lt;/p&gt;
&lt;p&gt;In the face of ambiguity, refuse the temptation to guess.&lt;/p&gt;
&lt;p&gt;There should be one-- and preferably only one --obvious way to do it.&lt;/p&gt;
&lt;p&gt;Although that way may not be obvious at first unless you&#039;re Dutch.&lt;/p&gt;
&lt;p&gt;Now is better than never.&lt;/p&gt;
&lt;p&gt;Although never is often better than *right* now.&lt;/p&gt;
&lt;p&gt;If the implementation is hard to explain, it&#039;s a bad idea.&lt;/p&gt;
&lt;p&gt;If the implementation is easy to explain, it may be a good idea.&lt;/p&gt;
&lt;p&gt;Namespaces are one honking great idea -- let&#039;s do more of those!&lt;/p&gt;</dc:description>
      
    <dc:subject>General</dc:subject>
     
    
  <dc:date>2014-02-27T01:11:13Z</dc:date>
    <dc:creator>chris</dc:creator>
 </item>
  <item rdf:about="http://chrismichaelides.eu/admin/lifetype-1.2.12/index.php?op=ViewArticle&amp;articleId=12&amp;blogId=1">
  <title>Download a file with cURL</title>
  <link>http://chrismichaelides.eu/admin/lifetype-1.2.12/index.php?op=ViewArticle&amp;articleId=12&amp;blogId=1</link>
  <dc:description>&lt;p&gt;&lt;img src=&quot;http://curl.haxx.se/pix/curl-refined.jpg&quot; alt=&quot;alt&quot; height=&quot;175&quot; width=&quot;471&quot; /&gt;&lt;/p&gt;
&lt;p&gt;In many situations you want to download a file (or a page) from another server to your server. You can do this with cURL! Here is a function which does that, written in PHP.&lt;/p&gt;
&lt;p&gt;[code]&amp;lt;?php&lt;br /&gt;function downloadFile($url, $path=&#039;&#039;, $file=&#039;&#039;, $options = array())&lt;br /&gt;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; //make sure the options is an array&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (!is_array($options)) $options = array();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; //add default options. You can remove these from here, but make sure you give the options you removed, when you call this method&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; $options = array_merge(array(&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &#039;connectionTimeout&#039; =&amp;gt; 5, // seconds&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &#039;timeout&#039; =&amp;gt; 10, // seconds&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &#039;sslVerifyPeer&#039; =&amp;gt; false,&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &#039;followLocation&#039; =&amp;gt; false, // if true, limit recursive redirection by&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &#039;maxRedirs&#039; =&amp;gt; 1, // setting value for &quot;maxRedirs&quot;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; ), $options&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; );&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; // if no filename given, create a random filename (with no extension)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (empty($filename)) $filename = rand();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; // create a file (we are assuming that we can write to the system&#039;s directory)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; $FileName = $path.$filename;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; $fh = fopen($FileName, &#039;w&#039;);&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; $curl = curl_init($url);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; curl_setopt($curl, CURLOPT_FILE, $fh);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, $options[&#039;connectionTimeout&#039;]);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; curl_setopt($curl, CURLOPT_TIMEOUT, $options[&#039;timeout&#039;]);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; curl_setopt($curl, CURLOPT_HEADER, false);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, $options[&#039;sslVerifyPeer&#039;]);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; curl_setopt($curl, CURLOPT_FOLLOWLOCATION, $options[&#039;followLocation&#039;]);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; curl_setopt($curl, CURLOPT_MAXREDIRS, $options[&#039;maxRedirs&#039;]);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; curl_exec($curl);&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; curl_close($curl);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; fclose($fh);&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return $FileName;&lt;br /&gt;&amp;nbsp; }&lt;br /&gt;?&amp;gt;[/code]&lt;/p&gt;</dc:description>
      
    <dc:subject>Web Development</dc:subject>
     
    
  <dc:date>2014-02-26T10:07:50Z</dc:date>
    <dc:creator>chris</dc:creator>
 </item>
  <item rdf:about="http://chrismichaelides.eu/admin/lifetype-1.2.12/index.php?op=ViewArticle&amp;articleId=11&amp;blogId=1">
  <title>New iOS flaw makes devices susceptible to covert keylogging, researchers say!</title>
  <link>http://chrismichaelides.eu/admin/lifetype-1.2.12/index.php?op=ViewArticle&amp;articleId=11&amp;blogId=1</link>
  <dc:description>&lt;p&gt;&lt;img src=&quot;http://cdn.arstechnica.net/wp-content/uploads/2014/02/iphone-640x360.jpg&quot; alt=&quot;alt&quot; height=&quot;360&quot; width=&quot;640&quot; /&gt;&lt;/p&gt;
&lt;h2 class=&quot;standalone-deck&quot;&gt;Proof-of-concept app in Apple&#039;s App Store sent keystrokes to remote server.&lt;/h2&gt;
&lt;p&gt;Researchers said they have identified a flaw in Apple&#039;s iOS that  makes it possible for attackers to surreptitiously log every touch a  user makes, including characters typed into the keyboard, TouchID  presses, and adjustments to the volume control.&lt;/p&gt;
&lt;p&gt;The vulnerability affects even non-jailbroken iPhones and iPads  running iOS versions 7.0.4, 7.0.5, and 7.0.6, as well as those running  on 6.1.x, researchers from security firm FireEye wrote in a &lt;a href=&quot;http://www.fireeye.com/blog/technical/2014/02/background-monitoring-on-non-jailbroken-ios-7-devices-and-a-mitigation.html&quot;&gt;blog post published Monday night&lt;/a&gt;.  They said attackers could carry out the covert monitoring using an app  that bypasses Apple&#039;s stringent app review process. The app uses &lt;a href=&quot;http://support.apple.com/kb/ht4211&quot;&gt;multitasking capabilities built into iOS&lt;/a&gt; to capture user inputs.&lt;/p&gt;
&lt;p&gt;The disclosure comes three days after Apple patched an extremely  critical iOS vulnerability that gave attackers an easy way to bypass  encryption many browsers and other types of apps use to prevent  eavesdropping of passwords and other sensitive data. Dubbed &quot;goto fail,&quot;  after one of the lines of code responsible for the bug, the flaw &lt;a href=&quot;http://arstechnica.com/security/2014/02/extremely-critical-crypto-flaw-in-ios-may-also-affect-fully-patched-macs/&quot;&gt;remains unfixed in OS X 10.9.0 and 10.9.1&lt;/a&gt;. Apple has yet to say when a patch will be released.&lt;/p&gt;</dc:description>
      
    <dc:subject>Technology</dc:subject>
     
    
  <dc:date>2014-02-26T06:35:13Z</dc:date>
    <dc:creator>chris</dc:creator>
 </item>
  <item rdf:about="http://chrismichaelides.eu/admin/lifetype-1.2.12/index.php?op=ViewArticle&amp;articleId=10&amp;blogId=1">
  <title>PHP function to return PhantomJS result</title>
  <link>http://chrismichaelides.eu/admin/lifetype-1.2.12/index.php?op=ViewArticle&amp;articleId=10&amp;blogId=1</link>
  <dc:description>&lt;p&gt;&lt;img style=&quot;margin: 5px;&quot; src=&quot;http://chrismichaelides.eu/admin/lifetype-1.2.12/gallery/1/phantomjs-wordle.png&quot; alt=&quot;alt&quot; /&gt;&lt;/p&gt;
&lt;p&gt;If you want a function that will return the result of a PhantomJS script, you may find this handy.&lt;/p&gt;
&lt;p&gt;It takes an array of options to be passed as arguments to the phantomJS file, executes it, and returns its results.&lt;/p&gt;
&lt;p&gt;I guess you have already installed phantomJS on your server, and configured it to run with no problems for the current user, right?&lt;/p&gt;
&lt;p&gt;Here is the code:&lt;/p&gt;
&lt;p&gt;[code]&amp;lt;?php&lt;br /&gt;/**&lt;br /&gt;* To get this to work on my server for user &quot;axxis&quot; I had to edit /etc/sudoers and add:&lt;br /&gt;* axxis ALL=(ALL) NOPASSWD: /usr/bin/phantomjs&lt;br /&gt;**/&lt;br /&gt;// // Enable Error Reporting&lt;br /&gt;// ini_set(&#039;display_errors&#039;,1);&lt;br /&gt;// ini_set(&#039;display_startup_errors&#039;,1);&lt;br /&gt;// error_reporting(-1);&lt;br /&gt;&lt;br /&gt;// A check to see that console commands work. Displays also the current user&lt;br /&gt;//$user = exec(&quot;whoami&quot;);&lt;br /&gt;//echo &quot;Current user: &quot;.$user;&lt;br /&gt;&lt;br /&gt;// the important stuff...&lt;br /&gt;function callPhantom($options) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; $proxySettings &amp;nbsp;&amp;nbsp;&amp;nbsp; = isset($options[&#039;proxy&#039;]) ? $options[&#039;proxy&#039;] : &#039;&#039;; //&quot;--proxy=ip:port --proxy-type=https&quot;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; $scripttoload &amp;nbsp;&amp;nbsp;&amp;nbsp; = $options[&#039;phantomfile&#039;]; // phantomjs script that loads the url&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; $URLtoload &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; = $options[&#039;url&#039;]; // the url with the jacascript&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; $Referer&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; = isset($options[&#039;referer&#039;]) ? $options[&#039;referer&#039;] : &#039;&#039;; //&#039;Me&#039;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; $UserAgent&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; = isset($options[&#039;useragent&#039;]) ? $options[&#039;useragent&#039;] : &#039;&#039;; //&#039;MyBrowser&#039;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if ($options[&#039;args&#039;]) { // any args you want to send to the loaded url, eg. time=198322&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; $args = &#039;&#039;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; foreach ($options[&#039;args&#039;] as $arg) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; $args .= escapeshellarg($now); // Don&#039;t forget to escape args!&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; } // To grab the args in the js file, that&#039;s another story (and another article!) ;)&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; $cmd = &#039;phantomjs&#039; . &#039; &#039;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; . $proxy . &#039; &#039;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; . &quot;--web-security=no&quot; . &#039; &#039;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; . $scripttoload . &#039; &#039;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; . $args . &#039; &#039;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; . escapeshellarg($URLtoload) . &#039; &#039;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; . escapeshellarg($Referer) . &#039; &#039;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; . escapeshellarg($UserAgent) . &#039; &#039;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; . &#039; 2&amp;gt;&amp;amp;1&#039;; // let&#039;s capture STDERR as well&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; // execute phantomjs script, let the javascript on this page execute,&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; // and get the finished page in a variable: $code_of_loaded_content&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; exec($cmd, $op, $er);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; $code_of_loaded_content = implode(&quot;&quot;,$op);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (!empty($er)) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; echo &quot;&amp;lt;h1&amp;gt;ERRORS&amp;lt;/h1&amp;gt;&quot;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; echo $er;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; //echo &quot;&amp;lt;h1&amp;gt;RESULT&amp;lt;/h1&amp;gt;&quot;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return $code_of_loaded_content;&lt;br /&gt;}&lt;br /&gt;// EXAMPLE&lt;br /&gt;/*&lt;br /&gt;echo callPhantom(array(&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &#039;phantomfile&#039; =&amp;gt; DIRNAME(__FILE__).&#039;/take_screenshot.js&#039;,&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &#039;url&#039; =&amp;gt; &#039;http://chrismichaelides.eu/&#039;&lt;br /&gt;));&lt;br /&gt;*/&lt;br /&gt;?&amp;gt;[/code]&lt;/p&gt;
&lt;p&gt;The function passes the given options over to the phantom js file, but to see how they are being handled, you&#039;ll have to wait for the next article! :)&lt;/p&gt;</dc:description>
      
    <dc:subject>Web Development</dc:subject>
     
    
  <dc:date>2014-02-25T07:16:12Z</dc:date>
    <dc:creator>chris</dc:creator>
 </item>
  <item rdf:about="http://chrismichaelides.eu/admin/lifetype-1.2.12/index.php?op=ViewArticle&amp;articleId=9&amp;blogId=1">
  <title>Execute code only on the last call of a re-used method</title>
  <link>http://chrismichaelides.eu/admin/lifetype-1.2.12/index.php?op=ViewArticle&amp;articleId=9&amp;blogId=1</link>
  <dc:description>&lt;p&gt;&lt;img style=&quot;margin: 5px;&quot; src=&quot;http://chrismichaelides.eu/admin/lifetype-1.2.12/gallery/1/slide-image-5.jpg&quot; alt=&quot;alt&quot; /&gt;&lt;/p&gt;
&lt;p&gt;There are situations where you call a method which recalls itself multiple times, or calls other methods which recall the original method. But you want code of the original method execute only one time, and that, on the last call! What do you do?&lt;/p&gt;
&lt;p&gt;A static variable is the solution to this situation. And it&#039;s a very simple solution too.&lt;br /&gt;Here is how you do it:&lt;br /&gt;[code]&lt;br /&gt;&amp;lt;?php&lt;br /&gt;function recall($option) {&lt;br /&gt;&amp;nbsp; static $times=0;&lt;br /&gt;&amp;nbsp; //on method entry you always add to the $times variable&lt;br /&gt;&amp;nbsp; $times++;&lt;br /&gt;&amp;nbsp; &lt;br /&gt;&amp;nbsp; //some code that re-calls this method...&lt;br /&gt;&amp;nbsp; // eg. a file inclusion or another method call which re-calls this method&lt;br /&gt;&amp;nbsp; // or a recall straight from within the method.&lt;br /&gt;&amp;nbsp; // for any of the above scenarios $option is assumed to change on each call, and the re-calls can only happen on certain $options&lt;br /&gt;&amp;nbsp; // this way we avoid falling in an endless loop...&lt;br /&gt;&amp;nbsp; &lt;br /&gt;&amp;nbsp; //Now make sure only the last call of this method gets to execute this code below...&lt;br /&gt;&amp;nbsp; if ($times&amp;gt;0) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; // put here any code you want executed only at the last call of the function.&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; // it is important that you put this below the code that would eventually recall the function&lt;br /&gt;&amp;nbsp; }&lt;br /&gt;&amp;nbsp; &lt;br /&gt;&amp;nbsp; // when done, make sure you set $times back to 0&lt;br /&gt;&amp;nbsp; $times = 0;&lt;br /&gt;}&lt;br /&gt;[/code]&lt;/p&gt;
&lt;p&gt;So, what&#039;s basically happening here, is that each call is nested, and since PHP is a synchronous language, each call has to wait for the &quot;child&quot; call to finish execution, in order to proceed with its own execution.&lt;/p&gt;
&lt;p&gt;Example: &lt;span style=&quot;background-color: #ffffff;&quot;&gt;Call A($times=1) =&amp;gt; Call B($times=2) =&amp;gt; Call C($times=3)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Now based on the above sample code, &lt;strong&gt;Call A&lt;/strong&gt; has to wait for&lt;strong&gt; Call B&lt;/strong&gt; to finish, before evaluating &lt;span style=&quot;background-color: #c0c0c0;&quot;&gt;&lt;em&gt;if ($times&amp;gt;0)&lt;/em&gt;&lt;/span&gt;.&lt;br /&gt;And &lt;strong&gt;Call B&lt;/strong&gt; has to wait for&lt;strong&gt; Call C &lt;/strong&gt;to finish, before continuing with its own evaluation.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Call C&lt;/strong&gt; doesn&#039;t have to wait for anybody, and simply continues execution until the end of the method. It evaluates that &lt;span style=&quot;background-color: #c0c0c0;&quot;&gt;&lt;em&gt;$times&amp;gt;0&lt;/em&gt;&lt;/span&gt; (3), and executes the code that should be executed only on the last call. Then it goes to the end of the method, and sets $times=0.&lt;/p&gt;
&lt;p&gt;Execution of&lt;strong&gt; Call C&lt;/strong&gt; is finished, so now &lt;strong&gt;Call B&lt;/strong&gt; can resume execution. It evaluates &lt;em&gt;&lt;span style=&quot;background-color: #c0c0c0;&quot;&gt;$times&amp;gt;0&lt;/span&gt;&lt;/em&gt; as false (since &lt;strong&gt;Call C&lt;/strong&gt; has set &lt;span style=&quot;background-color: #c0c0c0;&quot;&gt;&lt;em&gt;$times&lt;/em&gt;&lt;/span&gt; to 0), and correctly doesn&#039;t execute the code that shouldn&#039;t be executed. Same happens to &lt;strong&gt;Call A&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;At the end, the method is at its initial state, and waits for new calls. One time calls will be executed just fine, and nested calls will always execute restricted code only on the last call.&lt;/p&gt;
&lt;h2&gt;The problem that lead to the solution&lt;/h2&gt;
&lt;p&gt;In my years of PHP coding, I haven&#039;t ever met a situation where I needed this. Until today!&lt;br /&gt;I am developing a CMS from scratch, basically because I want something that can work on any HTML template, and because on many situations the available CMSes are overkill (call me Joomla/WordPress), or simply weak and ugly (no names here). My CMS is simple, fast, lightweight, and can be used on any HTML template out there. Anyway, the situation that gave me this problem (and made me think of the solution) is this:&lt;/p&gt;
&lt;p&gt;My CMS produces SEF URLs. On page load, it has to parse these URLs back to original URLs and redirect to the correct file, based on the URL. Now, there are situations where a file may redirect to another file, based on user input, data processing, etc. This is very common in other CMS platforms as well. In such situations, we don&#039;t want the URL to change (header locations are a no-go), but we do want the page contents to change. It is also important that we do not re-load the page, because we don&#039;t want to renew anything on the PHP side. We want all properties, variables, objects, etc. to remain intact!&lt;/p&gt;
&lt;p&gt;My CMS redirects by the &lt;span style=&quot;background-color: #ffffff;&quot;&gt;&lt;strong&gt;redirect($uri)&lt;/strong&gt;&lt;/span&gt; method, parses the &lt;span style=&quot;background-color: #c0c0c0;&quot;&gt;&lt;em&gt;$uri&lt;/em&gt;&lt;/span&gt;, and includes the appropriate file. After inclusion, it adds all its metadata, styles, and scripts to the head of the buffered document, and then outputs it to the browser.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&amp;lt;head&amp;gt;&lt;/strong&gt; data change according to which page is loaded, and what is needed. Eg. page title, description, and Open Graph properties need to change according to the loaded page.&lt;/p&gt;
&lt;p&gt;A second redirection made a double inclusion of everything! Metadata from both pages were added to a single &lt;span style=&quot;background-color: #ffffff;&quot;&gt;&lt;em&gt;&amp;lt;head&amp;gt; &lt;/em&gt;&lt;/span&gt;making a mess!&lt;/p&gt;
&lt;p&gt;By adding the inclusion code inside the &lt;em&gt;&lt;span style=&quot;background-color: #c0c0c0;&quot;&gt;if ($times&amp;gt;0)&lt;/span&gt;&lt;/em&gt; block, I made sure the &lt;span style=&quot;background-color: #ffffff;&quot;&gt;&lt;em&gt;&amp;lt;head&amp;gt;&lt;/em&gt;&lt;/span&gt; information of only the last page was inserted to the document.&lt;/p&gt;
&lt;p&gt;Do you know any other situations were this solution might be useful?&lt;/p&gt;</dc:description>
      
    <dc:subject>Web Development</dc:subject>
     
    
  <dc:date>2014-02-24T08:12:44Z</dc:date>
    <dc:creator>chris</dc:creator>
 </item>
  <item rdf:about="http://chrismichaelides.eu/admin/lifetype-1.2.12/index.php?op=ViewArticle&amp;articleId=8&amp;blogId=1">
  <title>Costumes for Programmers!</title>
  <link>http://chrismichaelides.eu/admin/lifetype-1.2.12/index.php?op=ViewArticle&amp;articleId=8&amp;blogId=1</link>
  <dc:description>&lt;p&gt;I know Halloween is over, but back here in Europe it&#039;s Carnival time.&lt;/p&gt;
&lt;p&gt;Here are some nice ideas for programmers who want to impress!!&lt;/p&gt;
&lt;p&gt;&lt;img style=&quot;margin: 5px;&quot; src=&quot;http://chrismichaelides.eu/admin/lifetype-1.2.12/gallery/1/halloweenCostumesForProgrammers1.png&quot; alt=&quot;alt&quot; /&gt;&lt;/p&gt;
&lt;p&gt;&lt;img style=&quot;margin: 5px;&quot; src=&quot;http://chrismichaelides.eu/admin/lifetype-1.2.12/gallery/1/halloweenCostumesForProgrammers.png&quot; alt=&quot;alt&quot; /&gt;&lt;/p&gt;</dc:description>
      
    <dc:subject>General</dc:subject>
     
    
  <dc:date>2014-02-24T07:34:10Z</dc:date>
    <dc:creator>chris</dc:creator>
 </item>
 </rdf:RDF>