<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/" version="2.0">
  <channel>
    <title>AWD Knowledge Base</title>
    <description>The pages in this section contain knowledge (information) about things related to Information Technology (IT), Web Design, Development, PHP, Zend Framework and things like standards, hints and tips. You will also find things concerning programming. Whenever I stumble upon something that might be useful in the future or to others I will write it down here. Most of this information is therefore written and based upon experience and not necessarily to kill time and write about stuff I heard somewhere.</description>
    <pubDate>Wed, 22 May 2013 14:41:57 -0500</pubDate>
    <generator>Zend_Feed_Writer 1.11.11 (http://framework.zend.com)</generator>
    <link>http://www.adrianworlddesign.com/Knowledge-Base</link>
    <copyright>All rights reserved, 2009-2013</copyright>
    
    <atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/AWD-KnowledgeBase" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="awd-knowledgebase" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><image><link>http://www.adrianworlddesign.com</link><url>http://www.adrianworlddesign.com/images/awd-logo_100x60.jpg</url><title>AWD Knowledge Base</title></image><item>
      <title>Speed and performance myths</title>
      <description><![CDATA[I read a lot that the Zend Framework is slow, lacks speed and has an overall bad performance compared to other frameworks. This page will bust some myths about the Zend Framework in terms of performance. The usual blame is on a bloated library, inheritance, abstraction, interfaces. The problem is usually that people don't understand what slows a system down and what causes bad performance. In other words they are not able to identify bottlenecks and blame the framework.]]></description>
      <pubDate>Fri, 17 May 2013 11:37:06 -0500</pubDate>
      <link>http://www.adrianworlddesign.com/Knowledge-Base/Zend-Framework/OAQ---Occasionally-asked-questions/Speed-and-performance-myths</link>
      <guid>http://www.adrianworlddesign.com/Knowledge-Base/Zend-Framework/OAQ---Occasionally-asked-questions/Speed-and-performance-myths</guid>
      <content:encoded><![CDATA[<p>Lets bust some myths about the <strong>Zend Framework's performance</strong> and its apparent <em>lack of speed</em>.</p>
<p>I read a lot that the <em>Zend Framework is slow</em>, lacks speed and has an overall <em>bad performance compared to other frameworks</em>. The usual blame and consensus is on a bloated library, inheritance, abstraction, interfaces and other stuff that ultimately just doesn't make sense me. If it would be a factor it could be measures on a single instance, but you can't because each one is such a small fraction of a millisecond. Even combined it's still nothing.</p>
<p>The problem is usually not the framework, and I mean any framework. The real real problem is that <strong></strong><strong>most people do not understand what slows down a system</strong>, i.e. what factors affect performance. Specifically they are not able to <strong>identify bottlenecks</strong>.</p>
<p>When they mention only some clues but never anything specific then they don't know it from cold hard facts. It's all hearsay. This very website runs the Zend Framework and ships code under 0.3 second which is pretty darn fast compared to other websites and I think I still have some room for improvements in the future. Which is entirely my fault and not the framework's problem.</p>
<p>Plus,  it is very difficult to set benchmarks for comparing frameworks but first, lets look at bootlenecks,</p>
<h3>Bottlenecks</h3>
<p>If you have a problem with performance, like speed of an application or system, one of the most important things you have to identify is the bottleneck.</p>
<p>You can have the fastest most reliable database server in the world but when your connection to that server is bad and not optimized then your website is slowed down by that connection.</p>
<p>Every system is as strong as its weakest link and as fast as its slowest component.</p>
<p>I can easily think of about two dozen potential bottlenecks and depending on your application or system you need different tools and ways to find these bottlenecks.</p>
<p>To demonstrate a bottleneck in action and especially how little it takes to slow down a system, a Zend Framework application in my case, I have a perfect example. Surprisingly it has absolutely nothing to do with the framework.</p>
<h4>Example Windows versus Linux</h4>
<p>The example is right in front of me. I have a Windows Vista Home Premium 64-bit PC with an Intel Core Quad 2.40 GHz CPU and 6GB RAM. Installed is an older version of VMware 2.0.1 and it runs two virtual hosts. One virtual host runs Windows XP 64-bit with the XAMPP stack. The other virtual host runs CentOS 6 Linux plain vanilla without X window and an Apache (httpd) daemon.</p>
<p>So far, so good. Time for a little test and comparison. I measure the time in milliseconds from the first line in the index.php to the last line and print the difference as an HTML comment and the final output. This is a very simple and basic test to see how long it takes for my web application to complete the whole request.</p>
<p>I open a webpage from one of my Zend Framework applications on Windows and it takes ~0.85 seconds. Oh, now there is a sign for our bad Zend Framework performance. However, the very same web page on Linux takes only ~0.42 seconds.</p>
<p>Now, is Windows our bottleneck, Linux far superior and can we blame this simply on Windows?</p>
<p>No we cannot. Although the whole hardware and software configuration appears to be identical with VMware we have a different web configuration; plus I have Eclipse and other stuff running on this XP system. Not to mention that the XP system is not the latest Windows version (10 years old!) and not even an optimized server version. Unlike the CentOS virtual host without X Window which is the latest version and optimized as a server.</p>
<p>But wait there is more; I also mentioned the web configuration. The XP systems has an older version of XAMPP which is still running PHP 5.2, Apache 2.0 and maybe a lot of other garbage that came with XAMPP. For a fair comparison I should install the latest Windows Server version and the latest XAMPP stack. I should also make sure that the Apache and PHP configuration is the same on both systems and take a closer look at the TCP/IP configuration, like frame sizes.</p>
<p>Just to complete this example the same web page running on a small <abbr title="Amazon Web Services">AWS</abbr> <abbr title="Elastic computing cloud">EC2</abbr> Linux instance takes about 0.28 seconds. I wonder if there will be a difference once I move to a larger instance.</p>
<h3>Factor of bottlenecks</h3>
<p>As we can see in this very simple example we have a speed difference from 0.28 to 0.85 which is a factor of three (3). The very same Zend Framework application on different hardware and operating systems and different configurations.</p>
<p>With this example how can you compare one framework with another.</p>
<p>If you want to <strong>compare the Zend Framework to another framework</strong> you should really make sure you have the absolute same environment and here is the difficult part. You have to create the absolute same real world web application. Only then we have a fair comparison.</p>
<p>So far what I hear and see nobody has really done that in a reliable fashion. The best I have seen so far is some "Hello World" comparison which is a very bad example and I don't consider this a real world example.</p>
<h3>Data and databases</h3>
<p>The "Hello World" test is a very bad comparison because it avoids most of the real world bottlenecks. The Zend Framework is doing a lot of work in the bootstrap process you  will not need for a "Hello World" page but for a real world web  application.</p>
<p>The real world bottlenecks are data and especially working with the data.</p>
<p>With the little "Hello World" test page we don't have to query data, verify data, sanitize data and do a lot of things we do for a secure and stable web application. To compare two frameworks you have to include and handle data and work with database queries based on the request.</p>
<h4>Data filtering</h4>
<p>One of the problems inflicted by developers is using methods like <strong>fetchAll()</strong> on the mapper for large database table. If this is a large table&#8212;and maybe you don't even need all data&#8212;you have to wait for all the data being fetched from the database. Just because Zend makes it easy for your with fetchAll() to get a table doesn't mean you should not use it without any SELECT and WHERE clauses.</p>
<h4>Database Profiler</h4>
<p>For the Zend Framework we even have a tool to see what is going on with our database queries. You can add or rather activate the <strong>Zend_Db_Profiler</strong> in your <strong>Zend database adapter</strong>. For detailed information see the <a title="Zend Programmer's Reference Guide: Db Profiler" href="http://framework.zend.com/manual/en/zend.db.profiler.html" target="_blank">Zend_Db_Profiler documentation</a> with the Zend manual website.</p>
<h3>If ... then</h3>
<p>The main problem and performance loss is somewhere else in most Zend Framework applications, though.</p>
<p>It's all the <strong>ifs</strong> and <strong>thens</strong> that slows down an web application. If (!) we want a stable and secure application then (!) we have to add a lot of code to an otherwise simple and slim script.</p>
<p>We have to inspect, validate and understand the request which usually requires a few steps. The deeper the path or complex the request the more validations have to be done before we even know if the request is valid.</p>
<p>Once we understand the request we have to either return an error message or fetch the data from somewhere. Depending on your application this can be a quick and simple query to the database; like a request for a simple text document.</p>
<p>Many application however are a complex combination of different requests. Your application may have to check various values in the request. The request may require a special way of presentation. You may have to change or restrict the result based on who is requesting the information.</p>
<p>Based on some factors in the request you may have to add additional widgets or add-ons, offers or upsells and whatnot to the final page.</p>
<h3>Inspect your Controller</h3>
<p>To find the real bottleneck you have to carefully inspect what happens in your controller. If you have a simple Zend Framework application it all happens in your IndexController.php. Measure time in millisecond from the beginning of your controller to the end of it.</p>
<p>A simple way to measure the time is getting the time in <strong>preDispatch</strong> and <strong>postDispatch</strong> of the controller. There are several ways to make this work and I leave this up to you.</p>
<p>When you compare these measurement against the beginning and end of the whole request you will be surprised to learn that your application uses most of the time between these two measure points in the controller.</p>
<p>What happens or rather begins and ends in your controller is usually where your own PHP code is at work. If you use a lot of component from the library you can of course blame a lot on the library but it usually takes a lot of your own code to connect these library items. Even though you use components from the Zend Framework it is overall straight forward PHP code written by you.</p>
<h4>Example revisited</h4>
<p>Let me add the numbers here from my example with my virtual Linux server where the request takes ~0.42 seconds.</p>
<p>From the start of the index.php to the beginning of the IndexController it takes about ~0.1 seconds; sometimes a couple hundreds less and sometimes a couple hundreds more. Overall I can say that the whole bootstrap and routing routine takes about 1/10 of a second.</p>
<p>From the end of the IndexController and to the end of the index.php, that includes rendering of the view, it usually takes about 0,03 seconds. If we add these two numbers we can say that the whole MVC process of the Zend Framework <span style="text-decoration: underline;">on my less then perfect Linux server</span> takes under 0.15 seconds. Now what about the difference to 0.42 seconds?</p>
<p>My web application doing quite a few things besides just immediately pulling the data from the database (based on the routing information) takes roughly 0.27 seconds. Although there are a few components taken from the Zend library it is mostly my code&#8212;my fault.</p>
<p>And frankly: the parts taken from the library? If I wouldn't have the code from the library I would have to write the same code anyway. Maybe not quite as extensive but still I would have written a comparable number of lines if not more.</p><img src="http://feeds.feedburner.com/~r/AWD-KnowledgeBase/~4/wAvJXCwil-M" height="1" width="1"/>]]></content:encoded>
    </item>
    <item>
      <title>Controllers and Actions</title>
      <description><![CDATA[Not sure what Controllers and Actions are for in Zend Framework. This tutorial is about the concept behind this and how you can write powerful applications with it.]]></description>
      <pubDate>Tue, 05 Mar 2013 11:57:05 -0600</pubDate>
      <link>http://www.adrianworlddesign.com/Knowledge-Base/Zend-Framework/Introduction/Controllers-and-Actions</link>
      <guid>http://www.adrianworlddesign.com/Knowledge-Base/Zend-Framework/Introduction/Controllers-and-Actions</guid>
      <content:encoded><![CDATA[<p>Looking through forums I sense that many people have a problem to <em>understand the concept</em> behind <strong>Controllers</strong> and <strong>Action</strong> in something like the <strong>Zend Framework</strong>.</p>
<p>Before I dive into this you should know that this is not an invention or thing with the <em>Zend Framework</em> but a common concept associated to the <strong>MVC pattern</strong>. The&#160; more you know and understand about this MVC pattern the better you will understand Controllers and Actions in Zend Framework.</p>
<p>I'll have a very, very brief introduction into MVC here and I highly recommend that you learn everything there is to know about MVC.</p>
<h3>MVC pattern</h3>
<p>The <abbr title="Model View Controller">MVC</abbr> stands for <strong>Model View Controller</strong>. As you can see we already have our controller here in this pattern definition. Lets break down the MVC real quick before we talk about the controller. To understand Controllers and Actions it is vital to understand the MVC pattern.</p>
<p>The main idea is to break down a request in a web application into certain pieces and deal with them individually. Therefore the three parts in MVC are different areas and they all have different responsibilities in a web request. Lets have a look at them.</p>
<h4>Model</h4>
<p>The model is usually responsible for anything data related. Whenever you need work with data (and be free and open minded to think what data means) have to think model. What this exactly means or how models look like doesn't matter right now but really anything that is related to managing data should be dealt with in a model class.</p>
<h4>View</h4>
<p>The view is somewhat self explaining. Whatever it takes to print/echo data back to the user is done in the view part. The Model just mentioned should deliver all the necessary data in a pretty much raw form and it must the responsability of the view to format the data for the requested and intended purpose.</p>
<p>Here's a very quick example for this. Your model could deliver one single piece of data but you could have one view that delivers the data in HTML, another view the same data in XML and maybe a third one that returns it as JSON.</p>
<p>As you can see you can have a regular HTML website with data but also a API returning XML or JSON and for the data part you have to write code only once. The view part in this pattern does the formating of this data.</p>
<h4>Controller</h4>
<p>Finally the controller will piece these two parts together. The Controller is the part interpreting the request by the user (actually the user agent, aka browser) calling the Model for the data and then passing the data to the approriate view for rendering.</p>
<p>The controller also takes on the responsability of returning the final construct and sets the appropriate header information, like document format, language, caching information and what not.</p>
<h3>Controller taking Action</h3>
<p>Now that we have a very basic understanding of MVC we can look at the Controller and <em>what Actions are doing in Zend Framework</em>.</p>
<p>In ZF we have this thing called routing. Looking at routing we have some sort of a guideline as to how many Controllers and also Actions we will have in our Zend Framework web application. Although we have to keep in mind that we can do quite a few things to change this in one way (getting less) or another (have even more).</p>
<p>The basic and general rule in ZF for routing is to have a link path matching up with controllers and actions. There are also modules but for this topic and a basic setup you can see that the first part matches a controller and the second an action.</p>
<dl class="code_example"><dd>www.yourdomain.com/controller/action</dd></dl>
<p>In this basic setup routing will dispatch to the corresponding controller by the same name and within it to the named action. When we follow this basic rule we will end up with a number of controllers that matches our number of paths we like to have in our website. Without an action name in the path we have a default action which is usually name index, i.e. an indexAction() method. The same goes for the Controller; without a controller name in the path we have a default controller usually named index, i.e. a IndexController class and with its indexAction() method.</p>
<p>Now you are pretty much free to structure the paths and with it the contollers. You can basically create a root path for every piece of functionality of you website and end up with as many controller (with one or more actions) but also combine everything within one base path and hence one controller but as many actions as you have nodes in that path.</p>
<h3>Little Example</h3>
<p>To illustrate all this here's a little example how this may look like on a website.</p>
<p>As we have seen from MVC above Controllers and their actions interpret requests and should only delegate to models and views. Especially models may require a lot of methods to perform tasks. It may be beneficial to keep these methods in their own classes. How you structure this methods and classes is up to you. The Zend way is to keep them in your own application library, e.g. sending emails should be held and performed by a separate class in your own application library (next to and maybe extending Zend classes).</p>
<p>If you have a contact page you could have a /contact link with a ContactController. The indexAction will delegate everything to present the form page. The form could have a /contact/submit link for the submit button and a corresponding submitAction will hook up your email library class and send out the email. The submitAction finally may call something like _redirect('/submit/thankyou') or even /submit/error. As you may guess by now there will be a thankyouAction responsible for presenting a Thank you page or a errorAction to let the user know there was an error.</p><img src="http://feeds.feedburner.com/~r/AWD-KnowledgeBase/~4/wA_2jhZ8E1I" height="1" width="1"/>]]></content:encoded>
    </item>
    <item>
      <title>Quickest way for Indexing</title>
      <description><![CDATA[Want to know the simplest and most important quickest way for indexing a new webpage with Google? You probably already use it but you don't know it. I'll tell you what it is in this document.]]></description>
      <pubDate>Wed, 27 Feb 2013 09:31:55 -0600</pubDate>
      <link>http://www.adrianworlddesign.com/Knowledge-Base/seo/Google/Quickest-way-for-Indexing</link>
      <guid>http://www.adrianworlddesign.com/Knowledge-Base/seo/Google/Quickest-way-for-Indexing</guid>
      <content:encoded><![CDATA[<p>So, you want to know the <strong>fastest, quickest way for indexing a new webpage</strong> with Google? You probably use it already  but you don't know it yet.</p>
<p>When people think about SEO they usually think of magic and tricks. Actually, you just have to use some logic. Like that type of logic a web developer will use to build his own search engine. I don't have my own search engine but I think about it and then most things I read about SEO is just baloney.</p>
<p>In this document I will not only tell you what it takes to get your new webpage indexed in no time but also why Google's crawler, aka <strong>GoogleBot</strong>, will find it in no time.</p>
<p>To learn only about this fastest way you can <a title="Skip ahead to the fastest way indexing in Google" href="#fast-furious">skip ahead</a> but please read on to understand why it is happening. I will also list other ways how Google will learn about a new webpage.</p>
<h3>How do they know</h3>
<p>First lets talk about some background and what Google is or more importantly does. Actually, not just Google. We need to understand how any search engine (like Bing, Yahoo et al) knows that there even is a webpage available on any given website.&#160;The most common way are <strong>hyperlinks</strong>. Hyperlinks is the technical term for links in a document and a search engine discovers a webpages by finding URL (these hyperlinks) in a webpage.</p>
<h4>Internal links</h4>
<p>Ordinarily this is the menu on your website or on some pages you have a full list with all the links of a certain section. These are commonly known as <em>internal links</em>.</p>
<p>As an example look at my website and this very document. This webpage or document has a parent folder which in my system is called a chapter in a book and it has a chapter list; you could see that following upwards with the breadcrumbs above. Oh and the links in the breadcrumbs work, too. However, in a perfect world the pages in the breadcrumbs should be already known to a search engine.</p>
<p>If you don't have internal links you have to wait for external links to tell Google that you have a new webpage. We should always have internal links just for our visitors, allowing them to browse our website and hopefully even click through to a document.</p>
<p>Just think about it. Without internal links even visitors wouldn't know a webpage exists.</p>
<h4>sitemap.xml</h4>
<p>Another way is to maintain a sitemap.xml. For a very large website you may not want to have all the webpages in that single file. Just the basic structure and from there the crawler bots should find their way to each document with mentioned section lists. A sitemap should be a starting point for any web crawler but there is in fact no need to have each and every webpage listed.</p>
<h4>Webmaster Tools</h4>
<p>Then there is Google's Webmaster Tools website. In the "Diagnostics" section you will find the "Fetch as Googlebot" page. Add the link and Google will secretly add this list to its index.</p>
<h3 id="fast-furious">Fast and furious</h3>
<p>Now for the fast and furious methods to let Google know that you have new webpage. Lets begin with the runner up</p>
<h4>FeedBurner</h4>
<p>If you have an RSS feed you may be using <a title="Link to Google feedburner" href="http://feedburner.google.com" target="_blank">FeedBurner</a>. If not consider it and ping the crawler if you have new content.</p>
<p>FeedBurner used to be an independent company but is now part of Google. Whenever the FeedBurner crawler visits your site it will automatically check or sync all pages with the search index. If a new document link is found it will be added to Google's crawler list.</p>
<h4>Google Analytics</h4>
<p>The winner by fare is certainly <strong>Google Analytics</strong>. If you have Google Analytics installed you <em>simply open your new webpage once</em> so Google Analytics can do its work in the background. Like above with FeedBurner it will check any webpage against the search index.</p>
<p>From experience with this website and looking at the first GoogleBot appearence in my logs it usually takes <strong>less than an hour</strong> for any of my webpages to be visited by the GoogleBot crawler.</p>
<h3>Final warning</h3>
<p>Or maybe also sort of a disclaimer. Don't confuse all the activities of a search engine and think they will happen all at once.</p>
<p>As a web developer I would not program all these into one single program. They would be independent modules and I bet that Google and all other search engines do the same.Follow is a little break down what should and probably happens with all search engines.</p>
<p>First a search engine has to learn about a link and somehow manage all the links. This will be an API like program that accepts links and maintains a list with all the links in a simple database table. Note that this is pretty much the <span style="text-decoration: underline;">only activity</span> we have some sort of a control.</p>
<p>Following that the search engine can go about crawling the website with the link and download the content. This will be the program usually known as the crawler, spider or web bot. Its only function really is to fetch the content and store it somewhere.</p>
<p>Next activity in line will be a program that evaluates the content of the downloaded page. It will do what we usually understand as indexing. It picks out all the link references and determines keywords in the document. Indexing basically links the URL of the document to other information; like keywords or hyperlinks, other URLs.</p>
<p>Finally it happens what we now as ranking and all the fuse is about with SEO. Based on the information in the indexing process a search engine will create some sort of a value or importance factor for you new page. This ultimately will be measures against other documents on the web and determine your ranking in search results.</p><img src="http://feeds.feedburner.com/~r/AWD-KnowledgeBase/~4/9jOYnVfkivQ" height="1" width="1"/>]]></content:encoded>
    </item>
    <item>
      <title>Zend Guard Loader download</title>
      <description><![CDATA[You can download the Zend Guard loader module from Zend's website but be careful to select the correct version. This document will guide in the right direction for downloading the correct version.]]></description>
      <pubDate>Tue, 26 Feb 2013 08:42:27 -0600</pubDate>
      <link>http://www.adrianworlddesign.com/Knowledge-Base/Web-Hosting/Zend-Guard/Zend-Guard-Loader-download</link>
      <guid>http://www.adrianworlddesign.com/Knowledge-Base/Web-Hosting/Zend-Guard/Zend-Guard-Loader-download</guid>
      <content:encoded><![CDATA[<p>You can download the Zend Guard Loader module for free from Zend's <a title="Zend Guard Download Page" href="http://www.zend.com/products/guard/downloads" target="_blank">Download Page</a> but be careful to select the correct version. In this document I'll tell what you have to watch out for.</p>
<h3>Auto select Operating System</h3>
<p>Zend's website will <span style="text-decoration: underline;">detect your current Operating System</span> and open the corresponding tab for you. For instance: When you visit from a Windows desktop you will get the Windows tab, from an Android smartphone it shows the Linux tab and guess what with the iPod, the tab for Mac OS X.</p>
<p>So, watch out and choose wisely!</p>
<h4>Manually select correct tab</h4>
<p>Unfortunately the design and the text within the tabs isn't very helpful or distinct in telling what operating system and versions you are looking at. If you work from a Windows system but need the Linux module for CentOS make sure you clicked the Linux tab.</p>
<p>Within each tab you have versions for Zend Guard (the <strong>encoding</strong> application) followed by the two different modules Zend Optimizer and Zend Guard Loader. You will need one of these modules for <strong>decoding</strong> the encoded pages.</p>
<h4>Optimizer versus Guard Loader</h4>
<p>If you have PHP 5.2 or earlier you will need Zend Optimizer whereas the Guard Loader must be used for PHP 5.3; we don't know yet what the future holds for 5.4.</p>
<p>If you don't know what PHP version is on your system simply run <span style="font-family: monospace;">php -v</span> command. It'll tell you the version on the first line.</p>
<h3>32-bit versus 64-bit</h3>
<p>Now, for <em>Zend Guard Loader on Linux</em> you have two options, a 32-bit version and a 64-bit version. It is important that you install the correct version and while the download (tar.gz) packages have distinct names the filename for the actual module itself <strong>ZendGuardLoader.so</strong> is the same for both versions.</p>
<p>In case you don't know what processor your Linux system has you can run the following command</p>
<dl class="code_example"><dd>[root@centos ~]# uname -p</dd> <dd>x86-64&#160; <span class="code_description">// this would be a 64-bit system</span></dd></dl>
<h4>Download on the command line</h4>
<p>If you follow this for an installation where you work remotely with ssh/PuTTY and wonder <strong>how to download on the command line in Linux</strong> here is a hint for how to download the file. If you already know you can skip ahead, of course.</p>
<p>There is a handy little utility called <strong>wget</strong> for retrieving files with HTTP or FTP protocols. Once you have the correct link name from above you can paste it to the <span style="font-family: monospace;">wget</span> command and download the file from Zend directly to your Linux box. Extract the tar.gz and you should be ready for the next steps.</p>
<p>If you don't have wget yet and use CentOS Linux you can find and install it with yum.</p>
<p>When you have your download and the module extracted it is time for the installation.</p>
<h3>Install the module</h3>
<p>For installing the Zend Guard Loader module I wrote another document. The webpage <a title="How to install Zend Guard loader on CentOS Linux" href="http://www.adrianworlddesign.com/Knowledge-Base/Web-Hosting/Zend-Guard/Zend-Guard-Loader-on-CentOS">Zend Guard Loader on CentOS</a> will tell you how to install this module primarily on Linux but the procedures for Windows are basically very similar.</p><img src="http://feeds.feedburner.com/~r/AWD-KnowledgeBase/~4/x58L_GFjHUw" height="1" width="1"/>]]></content:encoded>
    </item>
    <item>
      <title>Zend Optimizer for PHP 5.4</title>
      <description><![CDATA[Zend Optimizer only supports PHP till version 5.2. For 5.3 you will need Zend Guard Loader and for 5.4 and as of this writing there is no decoder version.]]></description>
      <pubDate>Fri, 22 Feb 2013 08:33:59 -0600</pubDate>
      <link>http://www.adrianworlddesign.com/Knowledge-Base/Web-Hosting/Zend-Guard/Zend-Optimizer-for-PHP-54</link>
      <guid>http://www.adrianworlddesign.com/Knowledge-Base/Web-Hosting/Zend-Guard/Zend-Optimizer-for-PHP-54</guid>
      <content:encoded><![CDATA[<p>I see a lot of questions about <strong>Zend Optimizer for PHP 5.4</strong> in my analytics, hence I think it is a good idea when I address this topic here with an answer to this burning question.</p>
<h3>Use Zend Guard Loader and PHP 5.3</h3>
<p>First off real quick what you probably already know is that <strong>Zend Optimizer</strong> does not work with PHP 5.4. In fact Zend Optimizer also <em>does not work on PHP 5.3</em>. However, for PHP 5.3 you will have to use another decoder which is named <strong>Zend Guard Loader</strong> and this will work with PHP 5.3. Unfortunately that is the only version Zend Guard Loader supports and still not PHP 5.4.</p>
<h3>Supported decoder for PHP 5.4</h3>
<p>As of today 2/8/2013 and a short visit to the <a title="Download Zend Guard" href="http://www.zend.com/products/guard/downloads" target="_blank">Zend download page</a> for the decoders tells me that there is still no support for PHP 5.4 available. Also looking around their website I still see no sign or information when we can expect support PHP 5.4.</p>
<p>The only solution or latest version and combination that works is running PHP 5.3 with Zend Guard Loader. There's also <strong>IonCube</strong> but the latest info as of today is that they also don't have a 5.4 supported version yet.</p>
<h3>Additional reading</h3>
<p>For some more information see my other documents</p>
<dl class="additional_reading"> <dd><a title="Differences between Optimizer and Guard Loader" href="http://www.adrianworlddesign.com/Knowledge-Base/Web-Hosting/Zend-Guard/Zend-Optimizer-versus-Guard-Loader">Differences between Optimizer vs Guard Loader</a> </dd> <dd>and <a title="Download Zend Guard" href="http://www.adrianworlddesign.com/Knowledge-Base/Web-Hosting/Zend-Guard/Zend-Guard-Loader-download">Zend Guard Loader download</a></dd><dt> 
<hr />
External sources</dt><dd>Zend Forum - <a title="Zend Forum" href="http://forums.zend.com/viewtopic.php?f=57&#38;t=49643&#38;start=10" target="_blank">Does Zend Guard 5.5 support php 5.4?</a><br /></dd> </dl>
<p>For further question feel free to leave a comment.</p><img src="http://feeds.feedburner.com/~r/AWD-KnowledgeBase/~4/BMgMyCHp8Ew" height="1" width="1"/>]]></content:encoded>
    </item>
    <item>
      <title>Viewport History</title>
      <description><![CDATA[This page has some of the history of the viewport. The viewport has gained some popular because it is a somewhat important factor when you design or develop for mobile devices like smartphones (iPhone, Android or even iPod and iPad). If you develop or design for mobile devices and you like to know some fundamentals and history about the viewport this page should provide the necessary information.]]></description>
      <pubDate>Thu, 21 Feb 2013 08:30:10 -0600</pubDate>
      <link>http://www.adrianworlddesign.com/Knowledge-Base/MobileDevices/Fundamentals/Viewport-History</link>
      <guid>http://www.adrianworlddesign.com/Knowledge-Base/MobileDevices/Fundamentals/Viewport-History</guid>
      <content:encoded><![CDATA[<p>The <strong>viewport</strong> is nothing new and has been pretty much overlooked until recently. It has gained interest by developers and designers who create a <em>web pages for mobile devices like smartphones</em>.</p>
<p>First thing to know and remember if your curiosity is spured by an  iPhone or Android project <em>the viewport has nothing to do with the  device</em>. Many Google searches come here like this: "<em>android viewport</em>" or "<em>iPhone viewport</em>".</p>
<p>The <strong>viewport is the browser</strong> and more precisely the window of the browser.</p>
<h3>First appearance</h3>
<p>I don't think this is the first appearance but the <a title="Link to w3c.org and the CSS2 specification" href="http://www.w3.org/TR/2009/CR-CSS2-20090908/visuren.html#viewport" target="_blank">CSS2 specification. Section 9.1.1</a> has some words about the viewport. In Internet years when CSS2 came about is a long, long time ago, right? Lets have a quick look at this specification's definition of the viewport.</p>
<p>There are quite a few things in this specification we have to understand. First it refers to devices that interpret HTML or CSS documents as <strong>user agents</strong> and second these user agents are categorized as <strong>media types</strong>. To grasp media types we have to remember that there are other "things" that understand HTML. Not just web browsers and <a title="Link to w3c.org and Web Content Accessibility" href="http://www.w3.org/TR/WCAG10-HTML-TECHS/" target="_blank">Web Content Accessibility</a> is the magic term here. So, every piece of software (not device) that can read and understand HTML and CSS is user agent and belong into one of the media types.</p>
<h4>Continuous media group</h4>
<p>If that isn't enough already the specification combines media types into <strong>media groups</strong>. The specification has one group labeled as "<strong>continuous</strong> or <strong>paged</strong>" and if look around some it defines all <em>continuous media</em> user agents as <strong>viewports</strong>. Then we also find the media type <strong>screen</strong> which is a continuous media.</p>
<p>Important note here: This <em>media type</em> <strong>screen</strong> is not a reference to the monitor or the desktop computer. It is a reference to the <em>software rendering HTML and CSS</em>.</p>
<p>We can therefore assume and say that <em>a browser is a) a user agent</em>, but also b) a <em>continuous media </em>and last but not least c) a <em>viewport</em>.</p>
<h3>I give you the &#60;meta&#62; tag</h3>
<p>Nobody really cared about the term viewport and this definition in CSS until, according to some sources, Apple "invented" the term. As we now know this is not true, they "only" borrowed the name for their iPhone/Safari browser and invented the <strong>viewport meta tag</strong>.</p>
<p>As it stands right now the viewport meta tag is not a standard and besides mobile devices has not a real meaning. If you think that your viewport meta tag is ignore it might well be that it is support by that particular browser. Desktop browser simply ignore this tag because they don't know this meta tag.</p>
<p>Lets also note here that Apple decided to specify the iPhone as media type <em>screen</em> and not <em>handheld</em>. Ergo, Android devices are also of media type screen. It does not make things easier at first but I bet Apple's intend was to catch all web pages in their original size.</p>
<dl class="additional_reading"> <dt>If you like to know more about the viewport I have some other pages you might be interested in.</dt><dd>How to use the viewport meta tag for mobile device you might like my other document: <a title="Link to my Understanding the Viewport" href="http://www.adrianworlddesign.com/Knowledge-Base/MobileDevices/Fundamentals/Understanding-the-Viewport">Understanding the Viewport</a>. </dd><dd>I also have some <a title="Link to Viewport Demo pages" href="http://www.adrianworlddesign.com/Viewport-Demo">test pages for the Viewport</a>; however, these pages work best if viewed with a smartphone. There are a few things you can do with a desktop browser but it is not as informative.</dd> </dl><img src="http://feeds.feedburner.com/~r/AWD-KnowledgeBase/~4/zGIX5e8gHwA" height="1" width="1"/>]]></content:encoded>
    </item>
    <item>
      <title>Zend Optimizer for PHP 5.3</title>
      <description><![CDATA[Zend Optimizer is an older runtime decoder and only supported until PHP 5.2. For 5.3 you will need Zend Guard Loader.]]></description>
      <pubDate>Fri, 15 Feb 2013 11:49:16 -0600</pubDate>
      <link>http://www.adrianworlddesign.com/Knowledge-Base/Web-Hosting/Zend-Guard/Zend-Optimizer-for-PHP-53</link>
      <guid>http://www.adrianworlddesign.com/Knowledge-Base/Web-Hosting/Zend-Guard/Zend-Optimizer-for-PHP-53</guid>
      <content:encoded><![CDATA[<p>I see quite a few questions about <strong>Zend Optimizer for PHP 5.3</strong> in my Analytics page, hence I will give an answer to this burning question.</p>
<h3>Use Zend Guard Loader for PHP 5.3</h3>
<p>When you have searched for <em>Zend Optimizer for PHP 5.3</em> here is something you may not know:&#160;<strong></strong><strong>Zend Optimizer does not work with PHP 5.3</strong>.</p>
<p>Zend Optimizer is only supported for PHP up until version 5.2 and you have to use another decoder for PHP 5.3.</p>
<p>What you need for PHP 5.3 is a runtime decoder named <strong>Zend Guard Loader</strong> and it works only with PHP 5.3. There is a free download on the <a title="Download Zend Guard" href="http://www.zend.com/products/guard/downloads" target="_blank">Zend Download page</a>. For more information about downloading Zend Guard Loader so the link below.</p>
<h3>What about PHP 5.4</h3>
<p>As of today 2/8/2013 and a short visit to the <a title="Download Zend Guard" href="http://www.zend.com/products/guard/downloads" target="_blank">Zend download page</a> for the decoders tells me that there is still no support for PHP 5.4 available. Also looking around their website I still see no sign or information when we can expect some encoding and with that decoder support for PHP 5.4.</p>
<p>The only solution or latest version and combination that works is running PHP 5.3 with Zend Guard Loader.</p>
<h3>Additional reading</h3>
<p>For some more information see my other documents</p>
<dl class="additional_reading"> <dd><a title="Differences between Optimizer and Guard Loader" href="http://www.adrianworlddesign.com/Knowledge-Base/Web-Hosting/Zend-Guard/Zend-Optimizer-versus-Guard-Loader">Differences between Optimizer vs Guard Loader</a> </dd> <dd>and <a title="Download Zend Guard" href="http://www.adrianworlddesign.com/Knowledge-Base/Web-Hosting/Zend-Guard/Zend-Guard-Loader-download">Zend Guard Loader download</a></dd> </dl>
<p>For further question feel free to leave a comment.</p><img src="http://feeds.feedburner.com/~r/AWD-KnowledgeBase/~4/_m9zFNlnfTA" height="1" width="1"/>]]></content:encoded>
    </item>
    <item>
      <title>Zend Guard Loader for PHP 5.4</title>
      <description><![CDATA[Zend Guard Loader is for PHP 5.3 and for any version before that we have Zend Optimizer. But what about PHP 5.4?]]></description>
      <pubDate>Fri, 08 Feb 2013 13:37:56 -0600</pubDate>
      <link>http://www.adrianworlddesign.com/Knowledge-Base/Web-Hosting/Zend-Guard/Zend-Guard-Loader-for-PHP-54</link>
      <guid>http://www.adrianworlddesign.com/Knowledge-Base/Web-Hosting/Zend-Guard/Zend-Guard-Loader-for-PHP-54</guid>
      <content:encoded><![CDATA[<p>I see a lot of questions about <strong>Zend Guard Loader for PHP 5.4</strong> in my analytics, hence I think it is about time to provide an answer to this burning question.</p>
<h3>Zend Guard Loader and PHP 5.3</h3>
<p>First off real quick what you probably already know is that <strong>Zend Guard Loader</strong> does not work with PHP 5.4. In pretty much the same way like Zend Optimizer does not work with 5.3<em></em>. Unfortunately the only version Zend Guard Loader supports is PHP 5.3 and nothing past that version.</p>
<h3>Supported decoder for PHP 5.4</h3>
<p>As of today 2/8/2013 and a short visit to the <a title="Download Zend Guard" href="http://www.zend.com/products/guard/downloads" target="_blank">Zend download page</a> for the decoders tells me that there is still no support for PHP 5.4 available. Also looking around their website I still see no sign or information when we can expect support PHP 5.4.</p>
<p>The only solution or latest version and combination that works is running PHP 5.3 with Zend Guard Loader.</p>
<h3>Additional reading</h3>
<p>For some more information see my other documents</p>
<dl class="additional_reading"> <dd><a title="Differences between Optimizer and Guard Loader" href="http://www.adrianworlddesign.com/Knowledge-Base/Web-Hosting/Zend-Guard/Zend-Optimizer-versus-Guard-Loader">Differences between Optimizer vs Guard Loader</a> </dd> <dd>and <a title="Download Zend Guard" href="http://www.adrianworlddesign.com/Knowledge-Base/Web-Hosting/Zend-Guard/Zend-Guard-Loader-download">Zend Guard Loader download</a></dd> </dl>
<p>For further question feel free to leave a comment.</p><img src="http://feeds.feedburner.com/~r/AWD-KnowledgeBase/~4/2Me5Qsqh-AE" height="1" width="1"/>]]></content:encoded>
    </item>
    <item>
      <title>Apache configuration</title>
      <description><![CDATA[For the Zend Framework on an Apache Web server you need some configuration, mainly the .htaccess file. This page breaks down the rewrite rules for the Apache .htaccess configuration. The information for the RewriteRule is widely available but it is not explained well anywhere and digging through the Apache documentation and understand all the single can be daunting.]]></description>
      <pubDate>Mon, 21 Jan 2013 14:02:22 -0600</pubDate>
      <link>http://www.adrianworlddesign.com/Knowledge-Base/Zend-Framework/Helpful-Tips/Apache-configuration</link>
      <guid>http://www.adrianworlddesign.com/Knowledge-Base/Zend-Framework/Helpful-Tips/Apache-configuration</guid>
      <content:encoded><![CDATA[<p>If you use the <strong>Zend Framework</strong> on an <strong>Apache Web server</strong> you have to deal with some <strong>configuration</strong>, mainly the <strong>.htaccess</strong> file. This is certainly the case when you have a Linux server but also on other operating systems or if you use any of the WAMP packages like XAMPP, MAMP and LAMP just to name a few.</p>
<p>Although, the overall information for the <strong>RewriteRule</strong> with the Zend Framework is widely available, like with the <a title="Zend Framework Quickstart Guide" href="http://framework.zend.com/manual/en/zend.controller.quickstart.html" target="_blank">Quickstart Guide</a>, it is not explained well anywhere. Digging through the Apache documentation and understand all the single lines and fragments can be daunting.</p>
<p>In this document I will <em>explain the htaccess rules configuration</em> by breaking it down line by line.</p>
<h3>Quick Start</h3>
<p>The Quickstart Guide start instructs you to edit and add the following lines to the .htaccess file.</p>
<dl class="code_example"> <dd>RewriteEngine On</dd> <dd>RewriteCond %{REQUEST_FILENAME} -s [OR]</dd> <dd>RewriteCond %{REQUEST_FILENAME} -l [OR]</dd> <dd>RewriteCond %{REQUEST_FILENAME} -d</dd> <dd>RewriteRule ^.*$ - [NC,L]</dd> <dd>RewriteRule ^.*$ index.php [NC,L]</dd> </dl>
<p>So far so good but what does it all mean and what are the possible pitfalls when you have some existing directives?</p>
<h3>Processing order</h3>
<p>The first pitfall is the <strong>processing or execution order</strong>.</p>
<p>I already have a document explaining the <a title="Apache .htaccess Execution order" href="http://www.adrianworlddesign.com/Knowledge-Base/Web-Hosting/Apache-Web-Server/Execution-order">Execution Order</a> but in a nutshell it goes from top to bottom. So, if you have other directives they most likely have to be executed and set before these rules.</p>
<p>Another important part is the last line and <strong>RewriteRule</strong> for the <em>index.php</em>; it is something like your last resort and <strong>if all fails then</strong> rule. Hence your best bet for this to work is to place it as the last line of rules.</p>
<p>Now lets look at the directives line by line</p>
<h3>The Rewrite module</h3>
<p>All the lines require an active <strong>Apache module</strong> named <strong>mod_rewrite</strong> and the <a title="Apache mod_rewrite documentation" href="http://www.adrianworlddesign.com/This module uses a rule-based rewriting engine (based on a regular-expression parser) to rewrite requested URLs on the fly." target="_blank">Apache Module mod_rewrite</a> documentation has all the detailed information.From this document we have the following information what the module is.</p>
<blockquote>This module uses a rule-based rewriting engine (based on a regular-expression parser) to rewrite requested URLs on the fly.</blockquote>
<p>Somewhere earlier in the <strong>httpd.conf</strong> configuration file this module has to be activated. However, the mentioned <em>rewriting engine</em> is not active yet.</p>
<h4>Turn on your engines</h4>
<p>The first line and directive <strong>RewriteEngine On</strong> is an instruction to start the engine and this makes the following lines work. Within the whole Apache environment this directive needs to be set only once but I think that just to be sure it is often used multiple times.</p>
<p>So, if you see the RewriteEngine On directive earlier you don't have to repeat this line.</p>
<h4>Selecting conditions</h4>
<p>The following three lines are a collection of conditions in an if statement. The [OR] flag links the three lines together into one statement. This means the following rewrite rule only (or already) applies if at least one of the three directives results in a true condition. Now we like to know that these three conditions are.</p>
<p>All lines obviously are looking for a filename. The only difference are the letters with the dash. These letters are known as the condition pattern or <strong>CondPattern</strong>.</p>
<p>The <strong>CondPattern -s</strong> in the first condition is looking for an existing file by that name and if it exists its size has be greater 0 (zero), i.e. not an empty file. This would be certainly true if the request is for a css file.</p>
<p>Next we have the <strong>CondPattern -l</strong> in the second line is looking for an existing symbolic link by that name. Like the first conditions this would be true if you have a symbolic to a central css file, i.e. you could share one stylesheet among many environments with symbolic links.</p>
<p>Finally the <strong>CondPattern -d</strong> in the third line is looking for an existing directory path. If you have a directory for instance where people can download some files with http instead of ftp.</p>
<p>So far so good. If only one of this rules is true the following RewriteRule in next line is executed. What is important here is that <span style="text-decoration: underline;">the conditions only apply to the very next rule</span>! In our example the next line for the index.php is <span style="text-decoration: underline;">not</span> affected!</p>
<h3>Rules rule</h3>
<p>Almost done, only two more lines to go and these are the rewrite rules.</p>
<p>It was just said but this is really important: The first of these two is only executed when one of the conditions is true but the conditions don't have any effect on the second rule! Important!</p>
<p>Before we look at the two rules lets break down the syntax of each lines.</p>
<p>The first part behind <strong>RewriteRule</strong> is the pattern for a regular expression and also has to be true. However, this specific pattern in both rules <strong>^.*$</strong> matches pretty much everything and should always result in true. To be  false this pattern should be more specific lets say for a specific  filename or extension. Important to know for the first rule: If this rule would be false it will not apply  despite the match in the previous <strong>RewriteCond</strong> success.</p>
<p>The second part is a  substitution and tells the rewrite engine what to use&#8212;rewrite&#8212;instead of what was requested. Now the two rules and we begin with the first rule which as we remember only applies if one <strong>RewriteCond</strong> was successful.</p>
<h4>The dash substitution</h4>
<p>So one of the conditions is true, lets say it is for a css file and it exists, i.e. the first condition has been met. Also the pattern matches we are good to go and rewrite the request with a -(dash)? What is a dash?</p>
<p>The dash is a special indicator and basically tells the rewrite engine to do nothing. Lets say the request was for a css file and that file according to the RewriteCond exists then in fact we want the rewrite engine to do nothing. However, we like something else and that is the [L] flag. The [NC] flag by the way means that the pattern has to be no-case or case-insensitive. The [L] means last as in this is the last <strong>RewriteRule</strong> you have to follow. Any other rules following are ignore we can actually say the processing of the rewrite engine is pretty much done at this point.</p>
<p>For our example the css stylesheet is return and all is well.</p>
<h4>Run Script run</h4>
<p>At last the final rule which I think you can figure out by yourself. The pattern matches everything case-insensitive [NC] so we rewrite the request with the index.php file and the [L] means it is the last instruction.</p>
<p>Well done, now you know why the Zend Framework needs these rules on an Apache web server.</p><img src="http://feeds.feedburner.com/~r/AWD-KnowledgeBase/~4/mHM3R_XcWus" height="1" width="1"/>]]></content:encoded>
    </item>
    <item>
      <title>How does a redirect work</title>
      <description><![CDATA[Do you wonder: "How does a redirect work?" This tutorial tells you what a redirect is and what is going on when a page reloads because a 30x status code was sent like 301 or 303 in HTTP. I will explain some fundamentals behind a redirect or reload. It does not have any implementation specific details on how to configure your web server or do it PHP, the Zend Framework or any of the other platforms like WordPress, Joomla and Drupal.]]></description>
      <pubDate>Fri, 14 Dec 2012 12:53:21 -0600</pubDate>
      <link>http://www.adrianworlddesign.com/Knowledge-Base/Web-Standards/Things-about-Hypertext/How-does-a-redirect-work</link>
      <guid>http://www.adrianworlddesign.com/Knowledge-Base/Web-Standards/Things-about-Hypertext/How-does-a-redirect-work</guid>
      <content:encoded><![CDATA[<p>Redirecting is basically a simple procedure within HTML or rather HTTP. Forcing a <strong>reload and redirect (like 301 or 303) for a webpage with HTTP</strong> is working in the background and cannot be seen under normal circumstances. So much so, that your final redirected page should show a regular <strong>200 OK status code</strong>.</p>
<p>If you like to know what is going on in the background you are at the right place. This page will tell you how this is working and what is going on in the background. If you have any further <span style="font-weight: bold;">Questions: Please leave a comment at the end!</span></p>
<p>This page explains some of the fundamentals for redirecting but not any implementation details. However, at the end of this document you will find some links to resources on the web for how to implement a redirect.</p>
<h3>Fundamentals for request and response</h3>
<p>Before we begin with redirects I would like to make sure we understand and therefore explain <em>how a regular and plain normal document transfer works in HTTP</em>. It is the foundation for redirects because ultimately the end result will be a regular request and response with a 200 OK status code.</p>
<h4>A normal response</h4>
<p>Well then, here is how a "normal" transactions works in HTTP. Note that HTML is about the document's content only. For any webpage,&#160;<em>the document transfer is the responsability of HTTP, not HTML</em>.</p>
<p>A user-agent (browser) sends a <strong>request</strong> for a document with the URI that looks something like this: <span style="font-family: monospace;">http://www.domainname.com/path/documentnam.html</span>. The leading http indicates the requested transfer method for the document. The browser in this regular case will send the request to TCP port 80 of the server named as www.domainname.com in this example. The server in return sends a <strong>response</strong>. Keep these two things in mind, they always work together: request&#8594;response.</p>
<p>The response always contains a <a title="Link to status code definitions at W3C (w3.org)" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10" target="_blank">status code</a> which is <strong>200 OK</strong> if everything is normal. If there are problems or special situations like our redirects the response has a different number. Watch out: The status codes are part of the HTTP specification; not HTML!</p>
<p>When we redirect we send a response telling the requester to send a  different request! In a nutshell, that is the whole secret of  redirecting; but we are not there yet.</p>
<h4>Other server responses</h4>
<p>Before we dive into redirects lets look at two other common types of response by a web server. These are status code 404 and 500 which are not redirects but nevertheless do not return the expected web page.</p>
<p>Although we sometimes see the code in the browser, a user agent itself should and does not care about it in terms of telling you this. The number you may see is coming from the server with the error document which is nothing more than a regular HTML document. A user agent like your browser simply displays this HTML document error page submitted by the server. In fact, we can send any regular HTML document but with an error code and a user will never know what happened just by looking at the page.</p>
<p><strong>Page not found</strong>: If the server cannot locate the requested path or document its response is 404. Together with the response a web page is returned, which is either the default page specified with the server for this type of error or a specially designed page and configured into the server.</p>
<p><strong>Internal Server Error</strong>: If the web server has to send the request to a script engine like PHP (CGI) and does not get back a proper response (or in time) it will return a 500 error. Like before a web page is returned as well.</p>
<p>There are other types of error plus we can add real redirect options into the web server.&#160;</p>
<h4>Why redirect</h4>
<p>Why or when do we need a redirect? Like we have seen before if a document is not found our web server should respond with a 404 status code.</p>
<p>If the user just typed some silly request this is okay but it is not very smart (or polite) when we know we have moved or renamed the document. In all these cases we should catch the request and <strong>redirect</strong> to the new location or new document name.</p>
<p>A very simple and common method is to leave a page with a note about the move and a link to the new location so the user can update any bookmarks or links on a web page. We can do a little more with this simple method. Within the HTML document we can place <strong>a "refresh" meta tag</strong>. The refresh tag will cause a reload for the page after a defined period to a specified new location.</p>
<p><strong>Note:</strong> This is not considered a real redirect and a thing handled by browsers once the whole page has been loaded and not a part of HTTP and actually not a standard defined in HTML either. In terms of informing the user this might be a good and valid option but it has some limitations as explained in <a title="Link to W3C and a dcoument about refresh meta tag" href="http://www.w3.org/QA/Tips/reback.html" target="_blank">this document at W3C.</a></p>
<h3>Redirect with HTTP</h3>
<p>Again, the refresh meta tag is a method implemented in HTML and not a standard and the preferred method. The preferred method should be a redirect in HTTP. This method basically forces HTTP to reload the page, i.e. send a new  request based on this information.  Because HTTP is part of the network  protocol suite (IP stack) a user agent (like your browser) is not immediately aware of this redirect.</p>
<p>The status code goes inside to what is known as the <strong>header</strong>. The header is part of HTTP and not HTML. This is somewhat important to understand for developers because you will realize that you have to find the solution outside of anything related to creating a HTML document.</p>
<h4>Web Server redirects</h4>
<p>In general and as a first approach this should be done inside the web server, like we have seen above with regular transfers and error codes. You have to consult your web server software and the corresponding documentation for how you can do that.</p>
<h5>Apache httpd redirects</h5>
<p>In Apache there are basicaly two methods or modules to be precise. One is <strong>Alias: <a title="Apache Alias module manual" href="http://httpd.apache.org/docs/2.2/mod/mod_alias.html#redirect" target="_blank">module mod_alias</a></strong> with a few <em>Redirect directives</em> and the other is <strong>Rewrite: module mod_rewrite&#160;</strong> (<a title="URL Rewriting Guide" href="http://httpd.apache.org/docs/current/rewrite/" target="_blank">see URL Rewriting Guide</a>) with the <a title="Apache Rewrite Rewrite flag manual" href="http://httpd.apache.org/docs/2.2/rewrite/flags.html#flag_r" target="_blank"><em>R|edirect flag</em></a>. With the rewrite module the redirect flag is usually in combination with a condition and the <a title="Apache Rewrite module manual" href="http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html#rewritecond" target="_blank">RewriteCond directive</a>.</p>
<p>If you have a web application (like a CMS, WordPress, Joomla or Drupal) you have dynamic content and probably links change within that content. Maybe you reorganize your document structure and move some documents around. Again, you could set those redirects in your web server but you may prefer a solution to set your HTTP redirects within your application or scripts.</p>
<p>Hence, you have to find where or how you can set the header information. As a rule of thumb for basically all these scenarios you will have to set you header information before any form of HTML code (this includes a simple space) has been send to the web server. Once the web server is receiving HTML code the header process is closed. Header information always have to precede document information.</p>
<h3>Can I see the header information</h3>
<p>It depends what you are looking for. In case of the HTTP redirect you will have a hard time to see it without a sniffer (see last option). The nature of this redirect is to work in the background and force a regular valid request, without you knowing about it. Therefore you cannot see the redirect under normal circumstances. For all other cases we have this.</p>
<p>On the server-side: If you are looking for the header information before you send your document you may have functions to see what has been sent. Check and know your scripting language.</p>
<p>If you want to know what the user sees you simply cannot because this is server-side. Once your scripting engine has sent the data to the web server you are done with your server-side process. Maybe there is some javascript that can collect and send information back to you but this is not a regular procedure and in terms of our HTTP redirect no document data should be submitted by the web server.</p>
<p>You can however query your own page programmatically and act as a client, if you must. Then you must have functions to get header information which will give you a client's point of view, sort of. Since the HTTP redirect works in the background you won't see it, though. You can use this in a test application to see the final result or error codes but you should not use this in the same procedure sending your page.</p>
<p>On the client-side: In theory, a browser would be able to query HTTP for the header information but because you should end up with the final redirected webpage  which is a regular response and the 200 OK status code you  simply cannot see the redirect in the browser itself. I have looked at all major browser but have found none giving you header information by default. Only with some developer extensions you can get and see the response header.</p>
<p>Google's Chrome browser has a Web Developer extension by <a title="Link to chrispederick.com and Web Devloper for Chrome" href="http://chrispederick.com/work/web-developer/chrome/" target="_blank">chrispederick.com</a><em></em>. Firefox has <a title="Link to Firefox Web Developer add-on" href="https://addons.mozilla.org/en-US/firefox/addon/web-developer/" target="_blank">this web developer</a> add-on and guess what; also by <a title="Link to chrispederick.com and Web Devloper" href="http://chrispederick.com/work/web-developer/" target="_blank">chrispederick.com</a>. In both tools you go to <em>Information</em> and all the way at the end or bottom you will see <em>View Response Headers</em>. As far as I know these are about the only two browsers and location where you can find out what the response status code is.</p>
<p>If you have your web site in Google's <a title="Link to Google Webmaster Tools" href="http://www.google.com/webmasters/tools/" target="_blank">Webmaster Tools</a> you can use "Fetch as Googlebot" in Diagnostics. Once you get the success link you can click that and you will see the whole page including header information.</p>
<p>The last extreme solution to figure out the status code is a network sniffer or get your own web page with telnet.</p>
<h3>Redirects and error codes</h3>
<p>Do not use the redirects for the error codes for two reasons. First you want to return a document telling what went wrong. Second the Redirector is supposed to terminate with exit and therefore is not returning a document. Whatever you would write is thrown away, lost.</p>
<p>If you can set an error status code you should always create and submit a document explaining what went wrong.</p>
<h3>Links for Implementation</h3>
<p>Last but not least some links to resources helping you implement a redirect.</p>
<p>For an <strong>Apache web server</strong> this is usually within the <em>.htaccess file</em> as a  redirect or a rewrite [R]. Here is the link  to the <a title="Link to apache.org and the mod_rewrite documentation" href="http://httpd.apache.org/docs/2.2/rewrite/" target="_blank">mod_rewrite documentation</a> for Apache 2.2.</p><img src="http://feeds.feedburner.com/~r/AWD-KnowledgeBase/~4/8dJOfg4azhY" height="1" width="1"/>]]></content:encoded>
    </item>
    <item>
      <title>Enable FTP in EC2</title>
      <description><![CDATA[You want to enable FTP in passive mode in Amazon's elastic computing cloud web service? Hence you need to know in a AWS EC2 what TCP ports are required in the security group and settings in vsftpd, iptables or selinux. This document has information about the pitfalls you want to avoid when setting up FTP in Amazon's cloud.]]></description>
      <pubDate>Wed, 12 Dec 2012 07:50:05 -0600</pubDate>
      <link>http://www.adrianworlddesign.com/Knowledge-Base/Web-Hosting/Amazon-Web-Services/Enable-FTP-in-EC2</link>
      <guid>http://www.adrianworlddesign.com/Knowledge-Base/Web-Hosting/Amazon-Web-Services/Enable-FTP-in-EC2</guid>
      <content:encoded><![CDATA[<p>You'd think that setting up <strong><abbr title="File Transfer Protocol">FTP</abbr> in an <abbr title="Amazon Web Services">AWS </abbr><abbr title="Amazon Elastic Compute Cloud">EC2</abbr> instance</strong> is simple. Actually it is but there are a few pitfalls. If you don't know them you will spend a lot of time until you get it to work. In this tutorial document I will show you the pitfalls I encountered when I you set up FTP in my Amazon cloud server.</p>
<p>Before we start lets talk about the configuration and environment. The information here is based on a regular <strong>AWS EC2 Linux server instance</strong> and with yum I installed <strong>vsftpd</strong> as the <em>FTP Server</em>. From my local client I use <strong>FileZilla</strong> as the <em>FTP client</em> and transfer is set to <strong>Passive Mode</strong>. This will add a few more pitfalls as I will explain in this document.</p>
<p>I also assume everything is properly installed and please understand that the following is <em>only about the configuration</em>, i.e. not installation of anything. Now lets get started with this tutorial.</p>
<h3>Security Group</h3>
<p>Lets begin with the access control from the outside world and for an EC2 instance access is controlled by the security group. Unless you have a security group applied that allows basically anything. In such a <span style="text-decoration: underline;">very unrecommended</span> case you can skip this part.</p>
<p>As an initial thought you enable the two default FTP ports; TCP 20 and 21 for data transfer and communication. While you are adding these two ports also allow a TCP port range from like 1024-1048; I will explain later, just trust me on this one for now.</p>
<p>With this we are basically ready to accept all passive mode traffic for FTP to the server. Now lets look at the server.</p>
<h3>Server Setup</h3>
<p>Before we dive into the vsftpd configuration a couple words first about the server setup and something you might check just to be sure. If you have a local Linux setup (like CentOS) you should really check this steps as well.</p>
<h4>SELinux</h4>
<p>If you use a basic Linux instance in your EC2 you should not have to worry about SELinux but you might want to check first, like this:</p>
<dl class="code_example"><dd># sestatus</dd> <dd>SELinux status:&#160;&#160;&#160;disabled</dd></dl>
<p>If your status is enabled you will also make sure that the file and context permissions are properly set. I will not go into details here, maybe in a separate document later because it seems SELinux is not enabled in most AWS Linux instances.</p>
<h4>iptables</h4>
<p>Your basic Linux instance should not be using any iptables. You might want to check this as well, like this:</p>
<dl class="code_example"> <dd># iptables -L</dd> <dd>Chain INPUT (policy ACCEPT)</dd> <dd>target&#160;&#160;&#160;&#160; prot opt source &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; destination</dd> <dd>Chain FORWARD (policy ACCEPT)</dd> <dd>target&#160;&#160;&#160;&#160; prot opt source &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; destination</dd> <dd>Chain OUTPUT (policy ACCEPT)</dd> <dd>target&#160;&#160;&#160;&#160; prot opt source &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; destination<br /></dd></dl>
<p>If you have any settings here I assume it was you who added them and hence know how to deal with it. The default instances don't have anything in place here.</p>
<h3>vsftpd.conf</h3>
<p>Now lets go about the configuration of <strong>vsftpd</strong> and the settings you have to add.</p>
<p>In your Linux system and for a <strong>vsftpd</strong> installation you will find the config as <code>/etc/vsftpd/vsftpd.conf</code> and don't forget to look at the man pages as <code>man vsftpd.conf</code>.</p>
<h4>Passive Address: pasv_address</h4>
<p>The <strong>pasv_address</strong> is an important setting in EC2 and it essentially will allow passive mode specifically if you use a client like FileZilla. If you have a Windows client and use the command line ftp application you will be fine without this settings. FileZilla however will sort of hang like this:</p>
<dl class="code_example"> <dd>Status:&#160;&#160;&#160; Retrieving directory listing...</dd> <dd>Command:&#160; PWD</dd> <dd>Response:&#160; 257 "/"</dd> <dd>Command:&#160; TYPE I</dd> <dd>Response:&#160; 200 Switching to Binary mode.</dd> <dd>Command:&#160; PASV</dd> <dd>Error:&#160; Disconnected from server: ECONNABORTED - Connection aborted</dd> <dd>Error:&#160; Failed to retrieve directory listing</dd> </dl>
<p>Note that the last command <strong>PASV</strong> asked for passive mode but it never completes. That's because FileZilla is verifying something in the background. Unfortunately you cannot see an error even when you turn on debugging. If you have ftp logging on for vsftpd you can see the response like this, though:</p>
<dl class="code_example"><dd>"227 Entering Passive Mode (10,12,35,53,75,191)."</dd></dl>
<p>Note the first four numbers in the parenthesis. This is the host's IP address. If you don't set the <strong>pasv_address</strong> which has to be your  external IP address (usually the elastic IP) vsftpd will submit the  local server IP address which for an EC2 instance is a 10.x.x.x private address; 10.12.35.53 in this example.</p>
<p>Because FileZilla does not know this address it refuses to proceed; it explicitly expects the external IP address which is the address it knows and is connected to. I don't know if this is a bug in FileZilla, i.e. why there is no error message or any other form of event telling you this.</p>
<h4>Passive ports</h4>
<p>Finally you will need to set the passive ports which might be a little bit unusual but I will try to explain it. That's also where we talk about the settings for the security group I asked you set in the beginning.</p>
<p>Why do we need this port range, you wonder? Besides the two standard TCP ports 20 and 21 there are in fact more ports required in passive mode. Usually you don't have to worry about this because many hosting environment don't offer an external firewall for your environment or at least none you have to manage yourself. Unlike the AWS where we have a firewall and use security groups to control access. The security groups are simply <strong>firewall rules</strong> and I assume you use them properly.</p>
<p>Many server setups either don't have any internal firewall for access control or standard rules (like in <strong>iptables</strong>) allowing new ports for established sessions.</p>
<p>In <strong>iptables</strong> you would setup and have something like this:</p>
<dl class="code_example"> <dd>Chain INPUT (policy ACCEPT)</dd> <dd>target&#160;&#160; prot opt source&#160;&#160;&#160;&#160;&#160;&#160; destination</dd> <dd>ACCEPT&#160;&#160; all&#160; --&#160; anywhere&#160;&#160;&#160;&#160; anywhere</dd> <dd>ACCEPT&#160;&#160; all&#160; --&#160; anywhere&#160;&#160;&#160;&#160; anywhere&#160;&#160;&#160;&#160; state RELATED,ESTABLISHED</dd> </dl>
<p>So what is happening now in the background with passive mode? FTP servers like vsftpd ask the client to connect to a new port for further transactions when in passive mode. If your server does not have any access control the request is granted but if you a control like iptables above your request is accepted as well because it is part of an established sessions. That's the server part but we have a firewall.</p>
<p>Because we have an external firewall (with security groups) this will be blocked unless we open some ports. So, if you have set the port range I mention earlier you can add the min and max port as <strong>pasv_min_port</strong> and <strong>pasv_max_port</strong> in your <strong>vsftpd</strong> configuration. You can basically set any number range but I would not set this to far apart.</p>
<p>The little annoying part here is that FileZilla leaves you clueless  in the dark&#8212;again. Once you are past  the PASV command you will hang right after the next command which should  be the LIST command. The ftp command line client in Windows seems to begin with or fall back to port 20.</p><img src="http://feeds.feedburner.com/~r/AWD-KnowledgeBase/~4/21E53uW0pSs" height="1" width="1"/>]]></content:encoded>
    </item>
    <item>
      <title>Understanding the Viewport</title>
      <description><![CDATA[This is all about the viewport, its meaning and how you can use it with the meta tag and explains definitions for the width and initial scale. The viewport meta tag is an important setting when you design or develop for mobile devices like smartphones (iPhone, Android or even iPod and iPad). This page also has links to viewport demonstration pages.]]></description>
      <pubDate>Sun, 02 Dec 2012 14:05:38 -0600</pubDate>
      <link>http://www.adrianworlddesign.com/Knowledge-Base/MobileDevices/Fundamentals/Understanding-the-Viewport</link>
      <guid>http://www.adrianworlddesign.com/Knowledge-Base/MobileDevices/Fundamentals/Understanding-the-Viewport</guid>
      <content:encoded><![CDATA[<p>The <strong>viewport</strong> has become a new thing for developers and designers when <em>creating web pages for mobile devices, aka smartphones</em>, like iPhone, Android or even iPod and iPad. However, the viewport is nothing real new and has been pretty much overlooked as a term and idea until recently.</p>
<p>Here's the first little secret you need to know. The viewport is just a generic term in specification for what we usually know as a web browser. The only new thing is the <strong>viewport meta tag</strong> first seen with Apple's iPhone.</p>
<p>If you like to know more about the "history" of the viewport you can read my other document titled <a title="Link to document about Viewport History" href="http://www.adrianworlddesign.com/Knowledge-Base/MobileDevices/Fundamentals/Viewport-History">Viewport History</a>. This page is about how you can use the viewport in your project.</p>
<h3>A few words first</h3>
<p>If your curiosity is spurred by an  iPhone or Android project here's a first important thing to remember: <em>The viewport has nothing to do with the  device</em>. <strong>The viewport is the browser</strong> or more precisely the window of the browser. At first, this may sound wrong for a smartphone but it is not.</p>
<p>If you have an <strong>iPhone or Android smartphone</strong> you can test things in my <a title="Viewport Demo page" href="http://www.adrianworlddesign.com/Viewport-Demo" target="_blank">Viewport Demo pages</a>. Note that most demonstrations are only valuable (i.e. work) when you view them with an iPhone or Android phone browser and not a desktop browser.</p>
<h3>Viewport and media queries</h3>
<p>Now, this may come as a first surprise for you. We don't have to worry too much about the viewport. We could live and work without knowing about it. That's because we don't usually deal with the viewport directly&#8212;we deal with the media type.</p>
<p>A viewport is defined as a media type and therefore we access a viewport as a media type. Our primary choice for access is usually CSS, cascading style sheets. In CSS we deal with media types through the media queries. If you need some background about this you should really read my other document <a title="Link to document about Viewport History" href="http://www.adrianworlddesign.com/Knowledge-Base/MobileDevices/Fundamentals/Viewport-History">Viewport History</a>.</p>
<p>The media query can be used to "query" some information from the media type. If the media type is <strong>screen</strong> we usually deal with a web browser. Conversely it is the browser's responsibility to say how big it's window is; the window is the viewport.</p>
<p>I use media queries in my <a title="Link to a test page about viewport and media queries" href="http://www.adrianworlddesign.com/Viewport-Demo/viewport" target="_blank">Viewport Demo page</a> to show the width of the browser window; which as we know now is also the viewport. If you go to that page with a desktop browser you can drag and re-size the window. You will see how the pixels number changes according to the width.</p>
<p>Now that we know a little bit about the media queries lets talk about browsers in mobile devices. Lets keep in mind that the browser is also a media type (screen) and the viewport.</p>
<h3>Browsers in Mobile Devices</h3>
<p>Okay, so most people will realize immediately one thing and point out that you cannot re-size the browser window in a mobile device. Does this mean the browser has a fixed dimension and if yes how many pixels does a browser or viewport have on a certain device? The answer is no, there is no burned in pixel width with any device or browser! There are quite a few factors weighing in for determining the width of the viewport.</p>
<h3>&#60;meta&#62; tag</h3>
<p>Thanks to Apple we have the &#60;meta&#62; tag with name="viewport". It helps to some degree control the size of the viewport. The meta tag's content value can have two name/value pairs&#8212;<em>width</em> and <em>initial-scale</em> are the names.</p>
<h4>&#60;meta&#62; tag: width</h4>
<p>The <strong>width</strong> as you might guess sets the width for the viewport. The value must be a numeric value (integer) or "device-width" (string). The number forces the browser to have the set width and calculate everything from this value. Note that this width will be the same in portrait and landscape, which could be a little bit problematic. The "device-width" forces the browser to take a value provided by the device. Because this depends on the device the value may or may not change from portrait to landscape mode.</p>
<h4>&#60;meta&#62; tag: initial-scale</h4>
<p>The <strong>initial-scale</strong> sets something you can think of as the initial zoom level but scale in terms of the canvas is the correct term. Initial means how the page loads and is presented; the user can still zoom in/out with gestures.</p>
<p>The value is a numeric value where 1 is something like default and &#60;1 is scale (zoom) out and +1 is scale in. If you take an iPhone or iPod touch your viewport at a scale of 1 will be either 320 (portrait) or 480 (landscape). At 0.5 these values change to 640/960 and at 0.25 to 1280 and 1920. Wee, High Definition! No, not really. Also, a value of 2 squishes your viewport and screen to 160 or 240 pixels in width. Android phones will have similar but not the same results.</p>
<p>If you like to see a useful demonstration of the viewport and test your mobile device and browser you can use <a title="Test page for meta tag settings" href="http://www.adrianworlddesign.com/Viewport-Demo/metatag" target="_blank">my test page</a> (/Viewport-Demo/metatag) to verify. Note it does not show anything relevant if you try it with a desktop browser because they do not care about the viewport meta tag.</p>
<p>So, "How do you use the meta tag?", you wonder. Easy as with all meta tags this goes into the header</p>
<dl class="code_example"><dd>&#60;meta name="viewport" content="width=device-width, initial-scale=1"/&#62;</dd></dl>
<p>Do not use this particular setting, though. I believe the best setting for all devices is "initial-scale=1". Use my test page to try it out and see for yourself.</p>
<p>If you limit the screen to a special width you will force the users to constantly re-size their screen. This is especially true in combination with an initial-scale.</p>
<h3>HTML elements width</h3>
<p>An important thing has not been mentioned yet, but it is about time now. While the settings in the meta tag define the default width, any element which is greater in size has an influence on the overall width of the browser window. We suddenly have the browser width separated from the viewport width!</p>
<p>It is best to understand with an example: If you set the viewport width to 800px but you have a 1000px element in your web page then the default width, e.g. for calculating a 100% width, is 800px; the viewport sets the default width! But, the window overall has, of course, a width of 1000pixels.</p>
<p>With my <a title="Test page for meta tag settings" href="http://www.adrianworlddesign.com/Viewport-Demo/metatag" target="_blank">test page</a> I also have some settings where you can set a specific width to elements.</p><img src="http://feeds.feedburner.com/~r/AWD-KnowledgeBase/~4/KWUKrsd0Dvg" height="1" width="1"/>]]></content:encoded>
    </item>
    <item>
      <title>Doing curl_multi_exec the right way</title>
      <description><![CDATA[curl_multi_exec is a function to simultanioully download content in parallel but the documentation is not very good. Let me show a few insights and tricks for better performance with loop and ease the load on your CPU or your web server.]]></description>
      <pubDate>Sat, 01 Dec 2012 13:41:07 -0600</pubDate>
      <link>http://www.adrianworlddesign.com/Knowledge-Base/php/Download-content-with-cURL/Doing-curlmultiexec-the-right-way</link>
      <guid>http://www.adrianworlddesign.com/Knowledge-Base/php/Download-content-with-cURL/Doing-curlmultiexec-the-right-way</guid>
      <content:encoded><![CDATA[<p>If you want to <strong>download content with PHP</strong> like either webpages in HTML or feeds with XML the best tool for this job is certainly <strong>cURL</strong>. Actually it is a combination of a variety of cURL functions.</p>
<p>For accessing a few handles, i.e.<em> downloading multiple pages</em> at the same time, and in parallel instead of serial like in a foreach loop, the <strong>curl_multi_exec()</strong> function seems to be right tool. Unfortunately, the documentation is a little hazy on how to exactly use this function.</p>
<p>Although it mentions that it processes each of the handles in the stack and it can be called whether or not a handle needs to read or write data there are a few unsolved mysteries with the examples.</p>
<h3>Why all the loops</h3>
<p>If you look at the example in the <a title="curl_multi_exec manual at php.net" href="http://us2.php.net/manual/en/function.curl-multi-exec.php" target="_blank">curl_multi_exec manual</a> you'll notice that they suggest two <span style="font-family: monospace;">do-while</span> loops. And yes the second loop with curl_multi_exec is yet in another while loop. So, there are actually three loops. You wonder, why? Lets look at the example real quick.</p>
<p>Note that we only worry about curl_multi_exec here and that we don't look at setting up each handle, only the multi handle sequence.</p>
<dl class="code_example"> <dd class="code_description"> //execute the handles</dd> <dd>do {</dd> <dd>&#8195;$mrc = curl_multi_exec($mh, $active);</dd> <dd>} while ($mrc == CURLM_CALL_MULTI_PERFORM);</dd> <dd>&#160;</dd> <dd>while ($active &#38;&#38; $mrc == CURLM_OK) {</dd> <dd>&#8195;if (curl_multi_select($mh) != -1) {</dd> <dd>&#8195;&#8195;do {</dd> <dd>&#8195;&#8195;&#8195;$mrc = curl_multi_exec($mh, $active);</dd> <dd>&#8195;&#8195;} while ($mrc == CURLM_CALL_MULTI_PERFORM);</dd> <dd>&#8195;} </dd> <dd>}</dd> </dl>
<p>The loop that confused me the most is the first one. Especially because the curl_multi_exec command is issued again in the second loop. Why would you send this command twice and why loop over it twice? Interesting question right?</p>
<h4>First loop is for nothing</h4>
<p>Turns out the first loop is actually for nothing. If you look at the multi_curl_exec function long enough and wonder about what $mrc, $mh and $active are or do it suddenly dawns on you.</p>
<h4>What is $mrc</h4>
<p>First the $mrc variable and from the manual we learn that the response is a cURL code defined in the cURL <a class="link" href="http://us2.php.net/manual/en/curl.constants.php">Predefined Constants</a>. In esssence it is a regular response and as with any other PHP function curl_multi_exec is no different and only returns a response once it is finished. Which means there should be only ONE response. In a perfect world this single response is 0 (zero) or equal to the predefined constant CURLM_OK.</p>
<p>Feel free and try this</p>
<dl class="code_example"> <dd>$c = 0;</dd> <dd>&#8195;do {</dd> <dd>&#8195;&#8195;$mrc = curl_multi_exec($mh, $active);</dd> <dd>&#8195;&#8195;$c++;</dd> <dd>&#8195;} while ($mrc == CURLM_CALL_MULTI_PERFORM);</dd> <dd>echo $c;<span>&#8195;// surprise, this is 1</span></dd></dl>
<p>When I did this I was almost 100% sure $c = 1 and not something in the thousands or even millions. What is really troubling is if there is a serious problem with one handle the function will never return CURLM_OK. So, if something has failed we just go ahead and try it again and it may or may not solve the problem? If it does not we simply end up in an infinite loop. Awesome!</p>
<p>If you echo $active you will see that it is probably equal to the number of handles. Our curl_multi_exec has <em>executed</em> all the handles and they are running now independendly in the background. The function as is is done like any other PHP function but the handles are still running. So lets look at this $active variable.</p>
<h4>What is $active</h4>
<p>If you look at the second loop and other examples on the Internet you will notice that the <strong>$active</strong> variable must change somehow. This somehow is based on what is happening insight curl_multi_exec.</p>
<p>As we have just learned above it tells us how many handles are still running. How does this work? The only way this is going to work is when the variable is set by reference inside the function. Indeed, the documentation says this is "a reference to a flag to tell whether the operations are still running."</p>
<p>Once you realize this you know we don't need the first loop with the curl_multi_exec function inside it. What we really need is a loop over the $active variable.</p>
<h3>Mind your CPU</h3>
<p>By the way and in case you are not aware of this. When you do a loop on something like this that just ends at some point your system's CPU will spike at 100% during the whole process.</p>
<p>Worse in this case! While it loops over the curl_multi_exec function asking "are you done?" it is doing this at lightning speed. Because of this it is also taking away CPU power from other process, like our handles and network connection in the background or the whole web server. Our web server and especially our curl handles are competing against this loop. It's like your boss or client yelling at you ever second "are you done yet?" until you're done with your project. It doesn't really help you finish quicker, right?</p>
<p>For how to solve this problem lets look at another function called <strong>curl_multi_select</strong> and the next document. (coming soon)</p><img src="http://feeds.feedburner.com/~r/AWD-KnowledgeBase/~4/LRWsLsBVpP0" height="1" width="1"/>]]></content:encoded>
    </item>
    <item>
      <title>Message rejected: Address blacklisted</title>
      <description><![CDATA[Let me tell you here what this error "Message rejected: Address blacklisted" is all about. You may get this error when you send emails with Amazon SES; and it is a little annoying and misleading.]]></description>
      <pubDate>Fri, 23 Nov 2012 16:50:36 -0600</pubDate>
      <link>http://www.adrianworlddesign.com/Knowledge-Base/Web-Hosting/Amazon-Web-Services/Message-rejected-Address-blacklisted</link>
      <guid>http://www.adrianworlddesign.com/Knowledge-Base/Web-Hosting/Amazon-Web-Services/Message-rejected-Address-blacklisted</guid>
      <content:encoded><![CDATA[<p>What is this error "<strong>Message rejected: Address blacklisted</strong>" all about you wonder. You probably send some emails with <strong>Amazon <abbr title="Simple Email Service">SES</abbr></strong> and this message is returned instead of some success message.</p>
<h3>Misleading message</h3>
<p>First off, the error is a little annoying because the message is misleading. Well technically speaking the message is correct, your message has been rejected and and an address is blacklisted. The misleading part is that it doesn't tell you why an address is blacklisted. Not to mention which address and you will always have two addresses at least, a sender and a recipient address. The good news it's most likely not the sender.</p>
<h3>Hard bounce</h3>
<p>The blacklisted address is probably the result of a <em>hard bounce</em>. When you send an email to an address and the destination mail server doesn't have a mailbox for the address it will return a message telling you that there isn't an account. This hard bounce is also known as <strong>persistent delivery failure</strong>. as in: no matter how often you will try this it will fail. I'm sure you have come across such an error with your own emails.</p>
<p>The problem here with Amazon's SES is that they take some, lets call it precautionary, action with such a return message. To some extend I agree with this but then again I don't.</p>
<p>As just mentioned, if you have your regular email account you will see such a <strong>hard bounce</strong> in your email inbox usually within seconds or at least with your next replication or log in. With Amazon SES you may not get the bounce message because for the most part this&#160;<em>Simple Email Service</em> does is nothing like your regular email client. Its main purpose is to send and not receive messages.</p>
<p>That's a major differnet and a serious problem and especially if you don't have a valid and verified <strong>Return-Path</strong> in your email message the bounce message goes nowhere. Well, actually it goes back to Amazon's SES but there it dissapears because it is not a mail server, i.e. it cannot deliver such a message because there is no mailbox. Your application incorporating the service cannot behave like an email client and if you don't have a proper <em>Return-Path</em> set in all your email you will never learn about any bounce.</p>
<p>I'm afraid that's why Amazon takes <em>precautionary</em> action and returns an error once it knows about an invalid email address.</p>
<p>See the following for more information about the <a title="Amazon SES: Anatomy of an email message" href="http://docs.amazonwebservices.com/ses/latest/DeveloperGuide/Intro.AnatomyOfMessage.html" target="_blank">Anatomy of an Email Message</a> written by the good folks at Amazon SES. You should also take the time and look at the other documents in that documentation.</p>
<h4>Soft bounce</h4>
<p>Just for completeness, a <em>soft bounce</em> is failure which is temporary or not persistent. The message has not been delivered to the addressed mailbox because of a problem like a full mailbox or other limitations like a attachment that is to big.</p>
<h3>SES Blog</h3>
<p>In their <a title="Amazon SES Blog: &#34;Address Blacklisted&#34; Error" href="http://sesblog.amazon.com/post/Tx334TMAWDDN4OF/The-Amazon-SES-Address-Blacklisted-Error" target="_blank">Amazon SES Blog</a>, author Jenn Steele, addresses this error and that they set a bounced address on a 14 day blacklist.</p>
<p>So in essence the error is for letting you know that there is a problem because if your email application using Amazon SES is not designed to learn about a hard bounce you will never know. By rejecting your whole message you probably will learn about it, though.</p>
<p>Again, I believe it is annoying to reject the whole message and not mentioning which address is the culprit but that's how it is. Find the failing address from your recipient list and you should be good to go again.</p><img src="http://feeds.feedburner.com/~r/AWD-KnowledgeBase/~4/AaElUXx_7TY" height="1" width="1"/>]]></content:encoded>
    </item>
    <item>
      <title>Test if htaccess is working</title>
      <description><![CDATA[This page has a simple test and "How to" check if the htaccess is working, enabled or even read. This simple test works wherever you have Apache (httpd) installed like on Linux, Windows, Apple and with bundles like XAMPP, LAMP, WAMP or MAMP.]]></description>
      <pubDate>Mon, 12 Nov 2012 07:21:47 -0600</pubDate>
      <link>http://www.adrianworlddesign.com/Knowledge-Base/Web-Hosting/Tips-and-Tricks/Test-if-htaccess-is-working</link>
      <guid>http://www.adrianworlddesign.com/Knowledge-Base/Web-Hosting/Tips-and-Tricks/Test-if-htaccess-is-working</guid>
      <content:encoded><![CDATA[<p>When you set up a new website with an <strong>Apache (httpd) Web Server</strong> you may use the <strong>.htaccess configuration file</strong> with some site specific configuration directives. For some unexpected reason every rule fails and you wonder if the<em> htaccess configuration file is even enabled or read. </em>Why is it not working?</p>
<p>When all rules fail first thing we should do is verify if the htaccess file is accessed and the configuration loaded. There is obviously no need to look over the rules when it's not touched.</p>
<h3>Force an error</h3>
<p>The simple solution to verify and check if the .htacess configuration file is even touched and parsed is forcing an error. More precisely a <strong>500 Internal Server Error</strong>.</p>
<h4>Force an Internal Server Error</h4>
<p>In order to do that you simple add something to the first line of the config file that doesn't make any sense. This could be a single letter or number, a word, basically anything that is not  a directive.</p>
<p>If you get the 500 Internal Server Error you know that the file has been read because that line triggered the error.</p>
<p>If you don't get an error your server setup is wrong because your .htaccess has not even been touched. Check out the other documents in my knowledge base for answers to that question.</p>
<h3 id="what_is_htaccess">Further help</h3>
<p>If you are not sure what the .htaccess file is, here's a quick info straight from the <a title="Apache's Configuration Files" href="http://httpd.apache.org/docs/current/configuring.html" target="_blank">Apache Configuration Files</a> documentation.</p>
<blockquote>Apache allows for decentralized management of configuration via special files placed inside the web tree. The special files are usually called .htaccess, but any name can be specified in the AccessFileName directive. Directives placed in .htaccess files apply to the directory where you place the file, and all sub-directories. The .htaccess files follow the same syntax as the main configuration files. Since .htaccess files are read on every request, changes made in these files take immediate effect.</blockquote>
<p>For more information check out the <a title="Apache tutorial: .htaccess file" href="http://httpd.apache.org/docs/current/howto/htaccess.html" target="_blank">Apache tutorial</a> or the link above.</p><img src="http://feeds.feedburner.com/~r/AWD-KnowledgeBase/~4/zvA9UfnZxrc" height="1" width="1"/>]]></content:encoded>
    </item>
    <item>
      <title>Add date to filename in cron </title>
      <description><![CDATA[How do you add a date to a filename in crontab? When you run some scripts in Linux with a cron job you may want to redirect the output to log. Adding a date to that log filename is a little tricky and I show how it works. ]]></description>
      <pubDate>Tue, 06 Nov 2012 12:00:30 -0600</pubDate>
      <link>http://www.adrianworlddesign.com/Knowledge-Base/Linux/Helpful-tips/Add-date-to-filename-in-cron-</link>
      <guid>http://www.adrianworlddesign.com/Knowledge-Base/Linux/Helpful-tips/Add-date-to-filename-in-cron-</guid>
      <content:encoded><![CDATA[<p>When you run some scripts in <strong>Linux</strong> with a <strong>cron job</strong> you will add this to <em>crontab</em> and may want to redirect the output to log file. Adding a date to this log's filename is a little tricky in <strong>crontab</strong>. Let me show you how it works.</p>
<h3>Command Line (CLI)</h3>
<p>Adding a date to a filename for a output redirect on the command line is fairly easy. It goes like this:</p>
<p class="code_example">echo 'Hello world' &#62; /var/log/somelog`date +%Y%d%m`.log</p>
<p>You simple put the  date command with its parameters in grave accents, usually called single back quotes or back-ticks. This is known as command substitution. The problem is this doesn't seem to work in crontab but there is just a little trick you need to know and it will work just fine in a cron job too.</p>
<h3>date command in cron</h3>
<p>The date command in cron tab works exactly the same but the percent sign (%) we have for the date format is the problem. The <strong>percent sign</strong> has a special meaning in cron and this is throwing off the whole thing and actually causing the whole cron job to fail. The easy solution is to escape the percent sign with a backslash.</p>
<p>Some <em>backslash to escape the % sign</em> is all that is required.</p><img src="http://feeds.feedburner.com/~r/AWD-KnowledgeBase/~4/3WLOdzNkc5s" height="1" width="1"/>]]></content:encoded>
    </item>
    <item>
      <title>Create a unique ID</title>
      <description><![CDATA[This document has a few tips for generating a unique ID in PHP. Ever since I wrote the document with information for how to generate, get or make a unique request ID for each webpage I receive a lot of traffic from Google specific about to PHP or even the Zend Framework. There is actually no need to handle or find it in Zend, Wordpress, Joomla or any other framework. With PHP and Apache you have a unique request ID generator at your fingertips and this page combines all information.]]></description>
      <pubDate>Wed, 31 Oct 2012 07:26:35 -0500</pubDate>
      <link>http://www.adrianworlddesign.com/Knowledge-Base/Zend-Framework/OAQ---Occasionally-asked-questions/Create-a-unique-ID</link>
      <guid>http://www.adrianworlddesign.com/Knowledge-Base/Zend-Framework/OAQ---Occasionally-asked-questions/Create-a-unique-ID</guid>
      <content:encoded><![CDATA[<p>Ever since I wrote an article about <em>how to get a unique ID in Apache</em> I have traffic from Google with questions about how to get or create a <strong>unique ID in PHP</strong> or the Zend Framework and even Wordpress, Drupal or Joomla.</p>
<p>If you need <em>a unique ID</em> in your web application written with <strong>PHP</strong>, which includes my specialty the <strong>Zend Framework</strong>, or other frameworks like CodeIgniter, Drupal, Yii or CMS systems like Wordpress and Joomla, then you have several choices.</p>
<h3>How unique</h3>
<p>First we need to find an answer to the question about how unique this ID has to be. I guess it all depends on the requirement for this ID.</p>
<p>You may need a unique ID for a log file to identify each single web request, i.e. you like to see all log events resulting from the same request. If you have Apache you are lucky because your <strong>Apache web server</strong> can provide you with an ID for each single web request. How you can use this can be found in my other document I mentioned: <a title="Unique ID per request with Apache and mod_unique_id" href="http://www.adrianworlddesign.com/Knowledge-Base/Web-Hosting/Apache-Web-Server/Unique-ID-per-request">Unique ID per request</a>.</p>
<p>If you need a unique ID to identify more than just one single web request you could still use this unique ID from the Apache module. Catch it with the first request and keep using it.</p>
<h3>PHP function: uniqid</h3>
<p>If that previous method does not work for you because you maybe use Microsoft's <abbr title="Internet Information Service">IIS</abbr> you have another option which is a PHP function named <strong>uniqid</strong>. See the PHP documentation <a title="PHP uniqid manual" href="http://php.net/manual/en/function.uniqid.php" target="_blank">uniqid</a> for how to use it.</p>
<p>Because we have this PHP function there is in fact no need to handle or find it in your Zend Framework. And actually WordPress, Joomla, Drupal, Cake or any other framework.</p>
<p>Apache's module way should also work for other web languages like Perl, ASP, Ruby or whatever language you are using.</p><img src="http://feeds.feedburner.com/~r/AWD-KnowledgeBase/~4/qpr8dmAPz0Q" height="1" width="1"/>]]></content:encoded>
    </item>
    <item>
      <title>IP in network validator</title>
      <description><![CDATA[This is the documentation page for the IpInNetwork php class on github.org that works as a validator extending to the Zend Framework library and set of validators. If you have an IP address and like to test or validate if this address belongs to or is part of a known network segment, block or range then you will like this validator class. Add the network and call isValue() and it will let you know with a booleand true or false if this IP is part of the network or not.]]></description>
      <pubDate>Sat, 20 Oct 2012 08:52:16 -0500</pubDate>
      <link>http://www.adrianworlddesign.com/Knowledge-Base/git/Code/IP-in-network-validator</link>
      <guid>http://www.adrianworlddesign.com/Knowledge-Base/git/Code/IP-in-network-validator</guid>
      <content:encoded><![CDATA[<p>This is the documentation page for my IpInNetwork <a title="IpInNetwork php class on Github" href="https://github.com/awd-git/Awd/blob/master/Validate/IpInNetwork.php" target="_blank">php class on github.org</a>. This <em>php class</em> is part of my own framework built on top of the <strong>Zend Framework</strong>. Hence this <em>validator</em> extends to the Zend Framework library and set of validators. In case you are not familiar with validators see below <a title="Takes you down to the title &#34;What are validators?&#34;" href="#validator">What are validators</a>.</p>
<p>In case you are looking for a webpage that converts betwween IP range and CIDR notation check out this <a title="Convert CIDR notation to IP range" href="http://magic-cookie.co.uk/iplist.html" target="_blank">magic-cookie</a> webpage.</p>
<h3>IP and network basics</h3>
<p>Lets first answer the question what the problem is and why we need such a validator.</p>
<p>Basically every computer network based on <abbr title="Transmission Control Protocol/Internet Protocol">TCP/IP</abbr> is divided into segments or blocks usually connected by <strong>routers</strong>. The routers hold the information about the routes in a routing table. The Internet as the largest network of computers, of course, is no different.</p>
<p>All the server for a company (or at least a big chunk of them) are usually found within such a segment. Lets say we have a visit by a computer with IP <a title="Link to domaintools. and whois for the IP" href="http://whois.domaintools.com/66.249.68.183" target="_blank">66.249.68.183</a> which belongs to Google. If you click the link you can see that this IP resides in a network with the following information</p>
<dl class="code_example"><dd>NetRange: 66.249.64.0 - 66.249.95.255</dd> <dd>CIDR: 66.249.64.0/19</dd></dl>
<p>From the visit we also learn some referrer information in HTTP_REFERER which for this visit would look like this</p>
<dl class="code_example"><dd>Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)</dd></dl>
<p>Now it is very easy to check the referrer and think that the visit is from Google but we cannot really trust the referrer. Of course, we can also click the website and verify manually each and ervery single time. Either way, we can only be sure the visit is indeed from a certain source when we verify the <strong>request IP address</strong> against a known network information.</p>
<p>Besides visits from Facebook, Google, Bing (MSN), Yahoo et al my framework also looks out for spam robots  which are mostly well known addresses and even infiltrated whole networks.</p>
<p>For cases like these and probably some more&#8212;that's where the validator comes into play.</p>
<h3>Validate IP in network</h3>
<p>Unfortunately the Zend Framework does not have such a validator so I wrote my own which is now on github for your pleasure.</p>
<p>This class validates any given IPv4 address against a provided network notation. So the next question is: What kind of network notations can you add to the class?</p>
<h4>Accepted network notations</h4>
<p>The network notation can be a network range or a network address with a <abbr title="Classless Inter-Domain Routing">CIDR</abbr> or 32-bit decimal subnet mask notation. For the network notation note that the main validation method always uses the CIDR notation, i.e a bitmask will be converted into a CIDR. If you don't fell comfortable with network notations or actually have a different type of use you can always use the network range which does not need to be a valid "routable" subnet and network segment. Following are some examples for network range and network notations.</p>
<h5>Examples for network notations</h5>
<dl class="code_example"> <dt>Network Range:</dt> <dd>128.0.0.12-128.0.0.19</dd> <dd class="code_description">true for all IP addresses inclusively in this range (i.e. from .12 to .19)</dd> <dt>CIDR notation:</dt> <dd>128.0.0.8/30</dd> <dd class="code_description">block with 4 hosts true for IP addresses from .8-.11 (i.e. .8, .9, .10, .11)</dd> <dt>Subnet mask notation:</dt> <dd>128.0.0.8/255.255.255.252</dd> <dd class="code_description">same as CIDR notation</dd></dl>
<h5>Special Notes:</h5>
<p>Following are a few nifty things about the validator:</p>
<p>1) The network notations are validated, i.e. you have to pass a valid network and CIDR or subnet mask combination. For the network range the two values are validated and therefore must be valid IP addresses.</p>
<p>2) A CIDR notation of /32, subnet mask /255.255.255.255 or a range with two equal addresses is a valid network. In such a case it will validate for one host, i.e. the result is true if the network address or the range addresses are identical to the IP address.</p>
<p>3) The network notation or a range has to be set prior to calling isValid() as is custom with all Zend validators. The notation can be set when instantiating the object as an array and 'network' as the index. The setter method is setNetworkNotation($notation) and expects a string as the argument.</p>
<h3>Download Link</h3>
<p>As mentioned above the class is available from my github account. Following is the direct link to the <a title="Link to validator class on github.org" href="https://github.com/awd-git/Awd/blob/master/Validate/IpInNetwork.php" target="_blank">IpInNetwork class</a>.</p>
<h3 id="validator">What are validators?</h3>
<p>In case you are not familiar with validators here is a hint straight from the Zend documentation page <a title="Zend Framework Programmer's Reference Guide" href="http://framework.zend.com/manual/en/zend.validate.introduction.html" target="_blank">Zend_Validate - Introduction</a> and the Programmer's Reference Guide.</p>
<blockquote>The Zend_Validate component provides a set of commonly needed validators. It also provides a simple validator chaining mechanism by which multiple validators may be applied to a single datum in a user-defined order.</blockquote>
<p>In other words, a validator examines its input with respect to some requirements and produces a <strong>Boolean </strong>result, i.e. whether the input successfully validates against the requirements. If the input does not meet the requirements, a validator may additionally provide information about which requirement(s) the input does not meet.</p><img src="http://feeds.feedburner.com/~r/AWD-KnowledgeBase/~4/ZlRVnHgsTa8" height="1" width="1"/>]]></content:encoded>
    </item>
    <item>
      <title>Administratively denied</title>
      <description><![CDATA[Sorry, your mail was administratively denied. (#5.7.1) or unimplemented (#5.5.1) are responses you may see when you try to send an email with SMTP relay. This page has some information about why you may see the error. I don't know if this only applies to GoDaddy or with other hosting providers. This applies to all mail applications like Zend_Mail]]></description>
      <pubDate>Fri, 12 Oct 2012 09:04:27 -0500</pubDate>
      <link>http://www.adrianworlddesign.com/Knowledge-Base/Web-Hosting/GoDaddy/Administratively-denied</link>
      <guid>http://www.adrianworlddesign.com/Knowledge-Base/Web-Hosting/GoDaddy/Administratively-denied</guid>
      <content:encoded><![CDATA[<p>Some error messages are just plain annoying nonsense. This one is a perfect example and can be found when you send an email with SMTP:</p>
<dl class="code_example"><dd>sorry, your mail was administratively denied. (#5.7.1)</dd></dl>
<p>It appears as if this is the default error message from an application and does not exclusively apply to the web hosting company like in my case, GoDaddy.</p>
<p>One important thing first. This error comes from a <strong>mail server</strong>, i.e. this is not about your local application like an email client (<em>Outlook, Thunderbird, Gmail </em>etc). It also does not come from your daemons like <em>mailx</em> or libraries like <em>Zend_Mail</em>. They simply funnel this error response they get back to you.</p>
<p>So, while this <strong>error message</strong> might be actually useful for an administrator of the <strong>SMTP server</strong> it just rings through to their helpless clients.</p>
<p>Whatever the reason, following is an explanation why the error actually shows up.</p>
<h3>SMTP Relay</h3>
<p>I ran into this problem because GoDaddy has some weird and special SMTP relay setup. So special that their support is incapable creating documents that show up either in their knowledge base or in Google at the top of the list. Furthermore and for some weird reason they are not interessed in clearly communicating the proper setup. At least, I have not found it where you think it should be.</p>
<h4>Internal relay</h4>
<p><span>Depending on where you are sending an email from </span><span>you have to use a different relay agent. If you have a web application hosted with GoDaddy and wish to send an email&#160;from your application you have to use the <strong>internal relay</strong>.</span></p>
<p><span>You cannot use the <strong>external relay</strong> from your application. You may know the external relay for your email client.</span> If you attempt to use the external relay with your hosted application you will get a "Connection time out" error.</p>
<p>We can only speculate why but I think they simply don't have a routing from the internal network to their outside smtp relay address. It beats me why not. It would be so much easier with one address and setup especially when you test from your external network; see why later below.</p>
<p><span>Anywho! From your hosted web application you have to use their <em>internal relay SMTP agent</em> as follows:</span></p>
<dl class="code_example"><dd>SMTP Server:&#160;relay-hosting.secureserver.net</dd><dd class="code_description">Note: This internal relay does not require a username and password</dd></dl>
<p>There is a tiny little problem, though.</p>
<p>Lets say you have a form and once the user hits the submit button in your form you want to send an email to some email inbox. Because this is not just some info email message you may want the user's email address from the form as the sender. With that you could easily hit the reply button in your email client and send your answer to the request.</p>
<p>That's when you will run into the error above: <em>your email gets administratively denied</em>. For an unknown and paranoid reason they still expect that the sender  address in the email head is an account that matches one of your GoDaddy  email domains.</p>
<p>You cannot use the user's email address to send an email despite the fact that you cannot use the relay form outside their network and they will always know who you are&#8212;even without a username and password.</p>
<h4>Use Reply-To instead</h4>
<p>So here's how you can fix that. First, make sure you use one of your GoDaddy email accounts as the sender in the email head. Second, you can use the user's email address but you have set it in the Reply-To field. With the user's email address in that field you can still hit the reply button when you receive the email and respond to the request.</p>
<h4>External relay</h4>
<p>If you want to test your web application on a server in your network you have to use a different configuration. If you use this internal relay configuration for sending emails from your private network you will face another problem. If you use the internal relay address from your private network you will face the following error:</p>
<dl class="code_example"><dd>unimplemented (#5.5.1)</dd></dl>
<p>Because setting up the external relay has a similar problem I have a separate document. The config and potential problem with that error message is in the document titled <a title="Link to error document Envelope sender in badmailfrom list" href="http://www.adrianworlddesign.com/Knowledge-Base/Web-Hosting/GoDaddy/Envelope-Sender-in-badmailfrom-list">Envelope sender in badmailfrom list</a>.</p><img src="http://feeds.feedburner.com/~r/AWD-KnowledgeBase/~4/O5-vkPlwiJw" height="1" width="1"/>]]></content:encoded>
    </item>
    <item>
      <title>Connection aborted</title>
      <description><![CDATA[The ftp error "Disconnected from server: ECONNABORTED - Connection aborted" in FileZilla is usually a sign that there is a problem with the IP address for the FTP server in passive mode. This document provides some insights into the problem and how to resolve it.]]></description>
      <pubDate>Wed, 19 Sep 2012 08:02:09 -0500</pubDate>
      <link>http://www.adrianworlddesign.com/Knowledge-Base/Web-Hosting/Tips-and-Tricks/Connection-aborted</link>
      <guid>http://www.adrianworlddesign.com/Knowledge-Base/Web-Hosting/Tips-and-Tricks/Connection-aborted</guid>
      <content:encoded><![CDATA[<p>The problem I explain here is usually <em>related to <abbr title="File Transfer Protocol">FTP</abbr> in passive mode</em> and when you use <strong>VSFTPD on Linux</strong> as your <strong>FTP server</strong> and <strong>FileZilla</strong> as the <strong>FTP client</strong>. Your FTP server in this case is usually also behind a firewall.</p>
<p>If you use a command line ftp client or other GUI FTP clients you may  be just fine without seeing any problems. Or maybe see other forms of  error messages.</p>
<p>In case you face the problem described here while setting up <strong>FTP in the Amazon cloud</strong>, I have a document <a title="How to enable FTP in EC2" href="http://www.adrianworlddesign.com/Knowledge-Base/Web-Hosting/Amazon-Web-Services/Enable-FTP-in-EC2">Enable FTP for passive mode</a> that has more detailed information specific to <abbr title="Amazon Web Services">AWS</abbr> <abbr title="Elastic Computing Cloud">EC2</abbr>.</p>
<h3>Connection aborted</h3>
<p>When you have a FTP server your FileZilla client may sort of hang like this:</p>
<dl class="code_example"> <dd>Status:    Retrieving directory listing...</dd> <dd>Command:  PWD</dd> <dd>Response:  257 "/"</dd> <dd>Command:  TYPE I</dd> <dd>Response:  200 Switching to Binary mode.</dd> <dd>Command:  PASV</dd> <dd>Error:  Disconnected from server: ECONNABORTED - Connection aborted</dd> <dd>Error:  Failed to retrieve directory listing</dd> </dl>
<p>Note that the line <strong>Command: PASV</strong> asked for passive mode but it never completes.</p>
<p>That's because FileZilla is verifying something in the background. Unfortunately you cannot see an error even when you turn on debugging. Because this problem is most likely linked to your own FTP server and you use <em>vsftpd as your FTP server</em> you can turn on ftp logging and then you will find a response that looks somehting like this:</p>
<dl class="code_example"><dd>"227 Entering Passive Mode (10,12,35,53,75,191)."</dd></dl>
<p>Note the first four numbers in the parenthesis 10,12,35,53. This is the host's local IP address. In this case a private 10.x.x.x range.</p>
<p>If that server is shielded from the Internet with <abbr title="Network Address Translation">NAT</abbr> (Network Address Translation) your FileZilla client will receive this number as the IP for passive mode and compare it with its known public address. Because it is not the same address it will terminate, i.e. disconnect from the server. Connection aborted!</p>
<h3>Set passive address</h3>
<p>The solution is rather simple. You will have to set the <strong>public IP address</strong> into the VSFTPD configuration. Look in the man pages for <strong>pasv_address</strong> for more information.</p>
<p>If you don't set the <strong>pasv_address</strong> which has to be your <strong>external IP address</strong> vsftpd will submit the local server IP address which is 10.12.35.53 in the example I've shown above.</p><img src="http://feeds.feedburner.com/~r/AWD-KnowledgeBase/~4/flw4U1vFS00" height="1" width="1"/>]]></content:encoded>
    </item>
    <item>
      <title>Prefixes versus Namespaces</title>
      <description><![CDATA[Zend Framework 2 (ZF2) requires PHP 5.3 or higher and used namespaces. However, its autoloader class also supports older concepts like prefixes. This document sheds some light on difference between prefixes and namespaces and concepts in =Zend autoloader.]]></description>
      <pubDate>Mon, 27 Aug 2012 10:16:39 -0500</pubDate>
      <link>http://www.adrianworlddesign.com/Knowledge-Base/zf2/Fundamentals/Prefixes-versus-Namespaces</link>
      <guid>http://www.adrianworlddesign.com/Knowledge-Base/zf2/Fundamentals/Prefixes-versus-Namespaces</guid>
      <content:encoded><![CDATA[<p>As you may know, the <strong>Zend Framework 2</strong> (ZF2) requires <strong>PHP 5.3</strong> or higher and uses <strong>PHP namespaces</strong>. ZF2 also is missing all the <span style="font-family: monospace;">require_once</span> statements and relies on autoloading of all the classes in the framework; in turn <em>autoloading depends on PHP namespaces</em>. In other words you will need some sort of an autoloader even when you like to use <em>ZF2 only as a library</em> plus it won't hurt to have some understanding about namespaces.</p>
<p>For ZF2 alone this requires some changes to the autoloader class and methods to get all the classes in your project without any <span style="font-family: monospace;">require_once</span> or <span style="font-family: monospace;">include_once</span> statements and based on a <strong>class namespace</strong>.</p>
<p>However, this new autoloader class also supports older concepts like <strong>prefixes</strong> which have been the standard in the previous framework releases.</p>
<p>This document sheds some light on the <em>difference between namespace and prefix</em> and how do you have use these two parameters and concepts in the Zend autoloader.</p>
<h3>StandardAutoloader</h3>
<p>If you found this page via Google or other search engine I assume you looked at the <strong>StandardAutloader class</strong> and noticed the two different methods (well actually four) between namespace and prefix. Like for the methods registerNamespace() or registerPrefix().</p>
<p>The difference between these two is quite simple.</p>
<h4>Prefix</h4>
<p>If you are familiar with previous release of the Zend Framework then you should be well aware of the prefixes. All the class names are matching a directory and filename path via the underscore in its name. If you wanted a radio form element you were looking for the Radio class like this:</p>
<dl class="code_example"><dd>class Zend_Form_Element_Radio { ... }</dd> <dd>// matching folder and filename Zend/Form/Element/Radio.php</dd> </dl>
<p>For an autoloader to work it has to replace the underscore characters for the directory separators. Now with ZF2 and namespaces this has changed, of course.</p>
<h4>Namespace</h4>
<p>According to the example above we have a new name for the same class, like this:</p>
<dl class="code_example"><dd>namespace ZendFormElement; </dd><dd>class Radio { ... }</dd> <dd>// also matching the same folder and filename like above</dd> </dl>
<p>Our new autoloader has to basically match the namespace with the filename and in terms of Windows we could say we are good to go. However, the StandardLoader is a little bit more thorough here and changes all directory separators to forward slashes.</p>
<p>By the way, if you have Windows and are wondering about this forward slashes note that this is works very well on Windows for quite some time with PHP. You could say that the good ol' days of using DIRECTORY_SEPARATOR in fact are over.</p>
<h3>Usage of StandardAutoloader</h3>
<p>Finally a quick example of how you would use the StandardAutoloader class in a project where you use ZF2 as library and not the full MVC framework.</p>
<dl class="code_example"> <dd>use ZendLoaderStandardAutoloader;  <span class="code_description">// add to top of this file</span> </dd><dd> ... </dd> <dd class="code_description">// a require_once at least one more time</dd> <dd>require_once PATH_TO_LIBRARY.'Zend/Loader/StandardAutoloader.php';</dd> <dd>$loader = new StandardAutoloader();</dd> <dd>$loader-&#62;registerNamespace('Zend' =&#62; PATH_TO_LIBRARY.'/Zend'));</dd> <dd class="code_description">// finally send namespaces and prefixes to the autoloader SPL</dd><dd>$loader-&#62;register(); </dd> </dl>
<p>If have more namespaces you can simple add them one by one or use the registerNamespaces() method and pass in an array with the names and paths.</p>
<p>If you have some "legacy" library or framework with underscores or as we now know prefixes us the registerPrefix() method. If you have more than one you'll see a registerPrefixes() method where you can add more than one as an array.</p>
<p>Finally you can also send an array when you initiate the class. The constructor uses the setOptions() which, finally, is another method to add your namespaces or prefixes to the autoloader class before registering.</p><img src="http://feeds.feedburner.com/~r/AWD-KnowledgeBase/~4/SAeiMSrl2Ns" height="1" width="1"/>]]></content:encoded>
    </item>
    <item>
      <title>Why the 960-grid exists</title>
      <description><![CDATA[If you are a web designer you will probably use it in your web designs or at least have heard about the 960-grid. Some of you might wonder why do we have a 960 grid. Why not 900, 950 or 1000. It is rather simply and the answer at the end not a big surprise and this web page will tell you what the little secret is.]]></description>
      <pubDate>Wed, 22 Aug 2012 15:14:40 -0500</pubDate>
      <link>http://www.adrianworlddesign.com/Knowledge-Base/Web-Standards/Cascading-Style-Sheets/Why-the-960-grid-exists</link>
      <guid>http://www.adrianworlddesign.com/Knowledge-Base/Web-Standards/Cascading-Style-Sheets/Why-the-960-grid-exists</guid>
      <content:encoded><![CDATA[<p>If you are a web designer you will probably use it in your web designs or at least have heard about the 960-grid for (Cascading Style Sheets) CSS in web design.</p>
<p>Some of you might wonder: <em>"Why do we have a 960 grid?"</em> Why not a 850, 900, 950 or 1000 grid system? What is so special or unique about this number 960 versus all the other dimensions that it seems everybody is using it?</p>
<h3>It is a binary world</h3>
<p>The secret lies in the fact that a web page is a computer generated page and that means binary code. More importantly it is about the pixels with one pixel as the smallest unit.</p>
<h4>What is binary again, you ask?</h4>
<p>In simple terms and to stay focused on our question and problem at hand we keep it simple. Binary means we have always a multiplication of 2 (two) beginning with 1 (one). Look at this:</p>
<dl class="code_example"><dd>1 - 2 - 4 - 8 - 16 - 32 - 64</dd><dd>32 + 64 = 96 * 10 = 960</dd><dd class="code_description">I think you already know where this is going.</dd></dl>
<p>The nice thing about this is that the numbers in this sequence when divided always end up in 10 (ten). You can have a grid with a lot of segments that will nicely fit and work with the pixels in web page.</p>
<h3>It begins and ends with 1 pixel</h3>
<p>So, this is the real great thing about the 960 grid. We take either two or three columns as the starting grid, i.e. [320+640] or [3 x 320]. Then we can split these columns in two and go on until we end up at ten pixel (or actually 5 pixels)&#8212;because it all begins with one unit of 10 pixels. Whatever we do we have an even distribution in 10 pixel steps.</p>
<p>Even better, of course, would be a 1280 pixels grid but this would be too big for the real estate of most monitors. When a monitor has more pixels in width it usually is also bigger in inches and the user prefers to make the browser (viewport) smaller.</p><img src="http://feeds.feedburner.com/~r/AWD-KnowledgeBase/~4/LonGy6qe-b4" height="1" width="1"/>]]></content:encoded>
    </item>
    <item>
      <title>Changes in Meta Content Language</title>
      <description><![CDATA[The content language meta tag defines the language for a particular web page. I added the Content-Language meta information to my web site because I thought it is a good idea; then a few weeks later I noticed a sharp drop in Google's Webmaster tool. Looking into Analytics I discovered that the numbers for the United States are constant but not for the rest of the world. This page will have a more detailed look into the results and if the Content-Language meta tag effects the search results in Google.]]></description>
      <pubDate>Tue, 14 Aug 2012 09:08:40 -0500</pubDate>
      <link>http://www.adrianworlddesign.com/Knowledge-Base/seo/Google/Changes-in-Meta-Content-Language</link>
      <guid>http://www.adrianworlddesign.com/Knowledge-Base/seo/Google/Changes-in-Meta-Content-Language</guid>
      <content:encoded><![CDATA[<p>You can add a meta tag named <strong>Content-Language</strong> to an HTML document. The purpose for this meta tag is to indicate the language for the web page.</p>
<p>While adding some language support to my framework I thought it would be proficient to add this meta tag to my own web site and pages. The documents are primarily in English so why not indicate that the content is in English.</p>
<p>Because this seemed like a no-brainer, I immediately forgot about this little change</p>
<h3>A few weeks later</h3>
<p>In the following weeks I was puzzled when I noticed a sharp drop in Google's Webmaster tool and also Analytics. Looking into Analytics and the map overlay I discovered that the numbers for the United States are somewhat the same but not for the rest of the world. Note that this "rest of the world" includes the United Kingdom and Australia&#8212;countries where people actually speak English.</p>
<p>It really did not make any sense. At first, I thought that Google must have made some changes to their algorithm and indeed they did. They rolled out yet another Panda update and coincidentally this one to other languages all over the world according to their <a title="Google Webmaster Central blog article" href="http://googlewebmastercentral.blogspot.com/2011/08/high-quality-sites-algorithm-launched.html" target="_blank">Webmaster Central</a> blog.</p>
<p>At this point I remembered the change I have made with the Content-Language meta tag. Unfortunately, it happened pretty much at about the same time.</p>
<p>Now I am stumped what causes the drop. Is it their "improved" algorithm  or could it really be that my change effects the global ranking in  Google's search results?</p>
<h3>Content-Language and ranking</h3>
<p>If you search for SEO and Content-language it is almost universally believed that this meta tag has no effect; some even think it is actually beneficial. However, with the Panda updates rolled out now I would say all bets are off. Time to find out!</p>
<p>I have temporarily disabled the meta tag and we will see what happens in the following weeks if the results are coming back or not.</p>
<p>Change took place on 9/4/2011. I hope I will be able to see some results in a few weeks. From experience I think it will take about 2-3 weeks until I see some changes.</p>
<h4>Update 9/26/2011</h4>
<p>So far no change and the results are even worse. Don't know really what the Panda change did, i.e. why the page views have dropped. The rankings for most pages has actually improved but the impressions are down by about 60-70% and more.</p>
<h4>Update 10/12/2011</h4>
<p>I can now safely say that it was not the meta tag&#8212;it was the Panda that struck my web site. Beats me why the pages that ranked well are not up there anymore. Depending on the search terms they still do, though. It's interesting to see how simple little changes in the search terms return completely different results. Order of words and spelling seems to have a way larger impact now.</p>
<h4>Final update 8/14/2012</h4>
<p>Things have considerably changed since the last update for the better. Result in many ways are great and some adjustments seems to pay off. Unfortunately, I still can't tell if or what the meta content-language does and it might be time to just declare: "<em>The content language meta tag does nothing in terms of SEO</em>."</p><img src="http://feeds.feedburner.com/~r/AWD-KnowledgeBase/~4/tEpToYDgNwM" height="1" width="1"/>]]></content:encoded>
    </item>
    <item>
      <title>Empty white screen</title>
      <description><![CDATA[Do you want to know why you have an empty, blank and white page on your screen and how you can fix it? The problem is most likely the settings for your error reporting or error output. No matter if you use the Zend Framework, Wordpress, Joomla, Drupal any other framework or just plain PHP, the problem is primarily in your script and the setting for error reporting or output.]]></description>
      <pubDate>Sat, 11 Aug 2012 09:03:53 -0500</pubDate>
      <link>http://www.adrianworlddesign.com/Knowledge-Base/Zend-Framework/Error-Messages/Empty-white-screen</link>
      <guid>http://www.adrianworlddesign.com/Knowledge-Base/Zend-Framework/Error-Messages/Empty-white-screen</guid>
      <content:encoded><![CDATA[<p>So, you work on a website and suddenly you are looking at a <strong>white screen</strong>, a <strong>blank page</strong> in your browser? No error message, nothing, just emptiness? White silence? Well then here's your answer, read on.</p>
<h3>White Screen of Death</h3>
<p>What you see what is commonly known as the <em>White Screen of Death</em> (<abbr title="White Screen of Death">WSOD</abbr>). So, what happened? First the bad news.</p>
<p>The primary cause is you have an <em>error in your script</em>. This tutorial will not help you with this error but why you <strong>cannot see an error message</strong>. The cause for this&#8212;the white screen&#8212;is pretty simple actually and following in this tutorial is how to fix it.</p>
<h3>The problem</h3>
<p>As just explained the initial problem is always the same. Whenever PHP finds a structural  error in your script it triggers an error and brings execution of the  script to a halt and here's your problem with the white screen. Your error settings tell PHP what to do next, i.e. if it displays an error message or not and what's causing the white screen and needs to be fixed.</p>
<p>The white screen is a result from settings in either the <a title="Links to PHP manual for error_reporting" href="http://us.php.net/manual/en/function.error-reporting.php" target="_blank">error_reporting</a> or <a title="Link to php.net and display_error description" href="http://us.php.net/manual/en/errorfunc.configuration.php#ini.display-errors" target="_blank">display_error</a> in your current environment. If you saw errors before you may have accidentally changed some settings or you work in a different environment with different settings.</p>
<h3>The solution</h3>
<p>There are two settings in PHP causing a white screen: one is the <a title="Links to PHP manual for error_reporting" href="http://us.php.net/manual/en/function.error-reporting.php">error_reporting</a> and the other is <a title="Link to php.net and display_error description" href="http://us.php.net/manual/en/errorfunc.configuration.php#ini.display-errors" target="_blank">display_error</a>. Set them to the appropriate level in your environment.</p>
<p>In production you should turn them both off because you should have fixed all structural errors in your scripts, i.e. catch them and show a meaningful error message to the visitor. The visitor should not be bothered with funny looking error messages. In your development environment you must see and get as much as possible, though.</p>
<p>The <strong>error_reporting</strong> is a configuration setting in your php.ini file but also has its own function to make changes at runtime. The following is the default setting for it</p>
<p class="code_example">error_reporting(E_ALL ^ E_NOTICE);</p>
<p>This is probably the best for your development environment.</p>
<p>The <strong>display_error</strong> is a configuration setting you have to set in your php.ini file or at runtime with <strong>ini_set</strong>. Mind the notes at <a title="Link to php.net and display_error description" href="http://us.php.net/manual/en/errorfunc.configuration.php#ini.display-errors" target="_blank">php.net for display_errors</a>. Setting it at runtime would look like this</p>
<p class="code_example">ini_set('display_errors', 1);</p>
<p>If you are working in a development environment you may want to have these two lines fro error_reporting and display_error very early in your index.php script to see and catch errors from the first line on.</p>
<p>Note that this is not a recommended case in your production environment where you actually should do quite the opposite. The Zend Framework has its own handling for this and is next.</p>
<h3>Zend Framework Configuration</h3>
<p>Here is a special note about the Zend Framework which may be overlooked by many. A lot of tutorials and forums recommend setting the display_errors in the <em>application.ini </em>file. They usually recommend you have two separate settings for development and production.</p>
<p>Within the production section you may have the following line</p>
<p class="code_example">phpSettings.display_errors = 0<br /> phpSettings.error_reporting = "30711" // in PHP 5.3.x</p>
<p>Note that <strong>phpSettings</strong> will do the same within Zend as setting the lines above. With the first line we get <span style="font-family: monospace;">ini_set(display_error,0)</span> set at run time and the second line is equal to the <span style="font-family: monospace;">error_reporting(E_ALL * E_NOTICE)</span>. Note that the settings in the Zend configuration require a numeric value for the <a title="PHP manual about Predefined Constants" href="http://www.php.net/manual/en/errorfunc.constants.php" target="_blank">Predefined Constants</a>.</p>
<p>The setting above will result in a <abbr title="Blank Screen Of Death">BSOD</abbr> in your website whenever the script has an fatal error. Although the error_reporting would show such errors the display_error says to show nothing.</p>
<h3>Zend Guard</h3>
<p>This is an important note if you are using <strong>Zend Guard</strong>, especially the 14-day <strong>trial version</strong>. If not then never mind but if you have encoded your  application with the Zend Guard trial version you should ask  yourself if  14 days have passed since you started the evaluation.</p>
<p>Depending on how much you have encoded and how your application configuration looks like you may end up with a white screen instead of an error message.</p>
<p>Once  the  evaluation is over the pages will trigger an error. If your error management is inside your configuration you will see a blank screen&#8212;no funny expiration   message.</p>
<p>As an example: In the Zend Framework this error management is usually inside your application.ini configuration file and if any file of your application is encoded before that error management is implemented you won't see an error.</p>
<p>If you have more   questions surrounding Zend Guard check out the <a title="Documents about Zend Guard" href="http://www.adrianworlddesign.com/Knowledge-Base/Web-Hosting/Zend-Guard">Zend Guard</a> section in my Knowledge Base. Now on to the "simple" problems giving you a <em>blank, empty and white screen of death</em> plus a headache for free.</p>
<h3>Conclusion</h3>
<p>Because this problem is a thing with PHP it can happen with all sorts of platforms or frameworks. For you it may be the Zend Framework but actually you might run into the same problem when you develop for WordPress, Joomla, Drupal or whatever you use as your content management system.</p><img src="http://feeds.feedburner.com/~r/AWD-KnowledgeBase/~4/Tv7oZ3FGTms" height="1" width="1"/>]]></content:encoded>
    </item>
    <item>
      <title>Background image in web site</title>
      <description><![CDATA[How to add an image in Zend Framework is not tricky but you need to understand the framework first. Actually the Zend Framework is not even designed for this. I will try to answer this question here and what ZF can really do for you.]]></description>
      <pubDate>Wed, 08 Aug 2012 09:24:23 -0500</pubDate>
      <link>http://www.adrianworlddesign.com/Knowledge-Base/Zend-Framework/OAQ---Occasionally-asked-questions/Background-image-in-web-site</link>
      <guid>http://www.adrianworlddesign.com/Knowledge-Base/Zend-Framework/OAQ---Occasionally-asked-questions/Background-image-in-web-site</guid>
      <content:encoded><![CDATA[<p>If you are a seasoned developer in Zend Framework you will say that this is a rather silly question "<em>How to put background image in web site in Zend Framework</em>".</p>
<p>Surprisingly many people ask me <strong>how to add images in Zend Framework</strong> so maybe you like to know how to do that, too.</p>
<h3>Add background images</h3>
<p>Well, unfortunately for you the short answer is: No, you cannot add images somehow magically in Zend Framework because <em>the framework is not designed for this</em>. The <strong>Zend Framework is designed for the development process</strong> and not content management. Images are content.</p>
<p>I think there is a little bit of a misconception or misunderstanding about what the Zend Framework is and what it can do. The framework is not a finished web site management system (like WordPress, Joomla or even Drupal to some degree) where you just point and click and it does things by magic.</p>
<p>Zend Framework is more like what I call <strong>PHP on steroids</strong>. As such and for me as a developer it does what PHP does but faster and most of the time better. Most importantly, I don't have to reinvent the wheel for many things.</p>
<p>PHP by itself, and with a few exceptions, is "only" a script language and doesn't do much in terms of HTML or creating a web page. That's where the framework steps in and helps you create things you usually have to do for many web pages over and over again.</p>
<p>The main focus here is managing data and layouts. You manage data with controllers, handle data with models and layouts with views. That's what is known as the Model-View-Controller pattern, MVC for short. The result are HTML web pages.</p>
<h3>Content, Style, Behavior</h3>
<p>Content, style and behavior are the key pillars of good web design.  Content is usually represented by HTML, style by CSS and behavior by  JavaScript (jscript).</p>
<p>Unfortunately, a background image in a web site is not (should not be) part of a HTML web page because you should handle it with CSS, cascading style sheets.</p>
<p>Your focus with the Zend Framework is not handling style or behavior&#8212;only content. With Zend Framework you concentrate on creating and managing the content. What you can do easily as well is add CSS or JavaScript to your layout. However, if you like to manage the styles or behavior you have to create your own management for these.</p>
<h3>Application Management</h3>
<p>If you have a web application (web site) build with the Zend Framework and somehow know that there is a way you can handle the background image then it is part of that particular web application build with the Zend Framework but not somehting that Zend Framework does by itself. In other words, somebody build a module or model that is capable of managing your styles and the background image.</p>
<p>So, the original question might be quite legitimate but it is not the framework's responsibility and cannot be done directly with framework.</p><img src="http://feeds.feedburner.com/~r/AWD-KnowledgeBase/~4/9wHqpQjmoEA" height="1" width="1"/>]]></content:encoded>
    </item>
    <item>
      <title>Zend Optimizer versus Guard Loader</title>
      <description><![CDATA[For what the difference is between Zend Optimizer and Zend Guard Loader just read this webpage. It has all the information you need in a nutshell because there is actually not much you need to know.]]></description>
      <pubDate>Wed, 25 Jul 2012 11:44:22 -0500</pubDate>
      <link>http://www.adrianworlddesign.com/Knowledge-Base/Web-Hosting/Zend-Guard/Zend-Optimizer-versus-Guard-Loader</link>
      <guid>http://www.adrianworlddesign.com/Knowledge-Base/Web-Hosting/Zend-Guard/Zend-Optimizer-versus-Guard-Loader</guid>
      <content:encoded><![CDATA[<p>If you are wondering what is the <em>difference between Zend Optimizer and Zend Guard Loader</em> then you will get the answer here. In a nutshell it all depends on your version of PHP on your system.</p>
<p>If you are looking for the difference to the <strong>Zend Framework</strong> please see the bottom and <a title="Jump to Zend Framework" href="#zend_framework">What is the Zend Framework</a>.</p>
<p>Both modules <strong>Zend Optimizer</strong> and <strong>Zend Guard Loader</strong> are doing the same; they are both <em>runtime decoders</em>. Both are free applications that enable PHP to run scripts you have previously encoded with Zend Guard.</p>
<h3>When you need a runtime decoder</h3>
<p>Now that you know that you will need one of these modules when you have encoded your PHP scripts with Zend Guard: <em>"What is Zend Guard?"</em></p>
<p><strong>Zend Guard</strong> just by itself is <em>a desktop application encoding PHP scripts</em>. As an [<span style="text-decoration: underline;">en-]coder</span> you don't use Zend Guard on your server. On a server you will need a <span style="text-decoration: underline;">[de-]coder</span>, though&#8212;that's right Zend Optimizer or Zend Guard Loader.</p>
<p>Why or when do you want to encode your PHP scripts? With encoded scripts you are able to widely distribute your PHP applications without revealing your intellectual property. Zend Guard does this by compiling your PHP source code which essentially encodes your script into intermediate code files.</p>
<h3>Check your PHP Version</h3>
<p>Once your files are encoded you will need software that decodes your scripts on the server at runtime. Hence the term <strong>runtime decoders</strong> which these free modules are. The only difference between them is the PHP version on your server.</p>
<p>If you have PHP 5.2 or earlier you will need <strong>Zend Optimizer</strong> whereas the <strong>Zend Guard Loader</strong> must be used for PHP 5.3.</p>
<p>As of this writing I don't see any information yet what the future holds for 5.4 but I assume we can still use Zend Guard Loader.</p>
<p>If you don't know what PHP version is on your system simply run <span style="font-family: monospace;">php -v</span> command. It'll tell you the version on the first line.</p>
<p>Besides this webpage I have more pages about <a title="Zend Guard documents overview" href="http://www.adrianworlddesign.com/Knowledge-Base/Web-Hosting/Zend-Guard"><strong>Zend Guard</strong></a> and if you have any problems please look out for them in this chapter;  use the breadcrumbs list above or the Prev/Next links at the end of the  document.</p>
<h3 id="zend_framework">What is the Zend Framework</h3>
<p>Lately I see questions via Google what the difference is between either of these modules above and the Zend Framework. Since there seems to be some confusion let me address this real quick.</p>
<p>The Zend Framework (ZF) is an open source web application framework implemented in PHP 5 and the project is guided by the Zend Company. Which is also the company behind PHP and, of course, the two modules mentioned above.</p>
<p>A web application framework is designed to help web developers build web applications. It usually doesn't provide a ready to go website or webpages like Content Management Systems but it allows developers to quickly set up the environment to build websites from small to large projects.</p>
<p>As explained above the modules Zend Optimizer and Zend Guard Loader are runtime decoders and therefore have nothing in common with the Zend Framework except that they are provided by the same company.</p>
<p>&#160;</p><img src="http://feeds.feedburner.com/~r/AWD-KnowledgeBase/~4/Cke-_CCA1LY" height="1" width="1"/>]]></content:encoded>
    </item>
    <item>
      <title>Viewport Meta</title>
      <description><![CDATA[ I often see the question if there are any Android specific meta tags. For Android smartphones the term viewport is often searched and people tend to have some problem in understanding what the viewport really is. In simple terms the browser on the smartphone is the viewport but there is more to it. This page will shed some light on these questions and have additional links to further information about the viewport for Android Smartphones.]]></description>
      <pubDate>Tue, 24 Jul 2012 08:55:43 -0500</pubDate>
      <link>http://www.adrianworlddesign.com/Knowledge-Base/MobileDevices/Android-Smartphones/Viewport-Meta</link>
      <guid>http://www.adrianworlddesign.com/Knowledge-Base/MobileDevices/Android-Smartphones/Viewport-Meta</guid>
      <content:encoded><![CDATA[<p>I see a lot of questions in forums and other places about the <strong>viewport meta tag for Android</strong> or they like to know if there are any <strong>Android specific meta tags</strong>.</p>
<p>It seems people are puzzled with <em>meta tags</em> for <em>smartphones</em> and Android devices in particular. So let me shed some light on this topic real quick.</p>
<h3>A viewport is a browser</h3>
<p>First and foremost we have to get one thing out of the way which is <em>the Android phone</em>. When we surf the web on a smartphone we get an HTML page and this page is rendered by what we know as a <strong>viewport</strong>. The simple answer to what a viewport is: <strong>On a smartphone a viewport is a browser!</strong> Dead simple&#8212;the same as on your computer.</p>
<p>This should already answers the question if there are any Android specific meta tags. No, <strong>there are no Android specific tags</strong> <em>per se</em> because the phone is just a computer and it is the responsibility of the viewport, aka browser!</p>
<p>If you only use or think about the pre-installed browser on your Android phone then it might look like it is a Android specific meta tag but ... you can install other browsers and meta tags are in fact a viewport (browser) specific thing.</p>
<p>So, if you really want to understand what is going on with a webpage on a smartphone like an Android <em>you have to understand the viewport</em>!</p>
<p>The term viewport has been specified in the <a title="Link to w3c.org and the CSS2 specification" href="http://www.w3.org/TR/2009/CR-CSS2-20090908/visuren.html#viewport">CSS2 specification, Section 9.1.1</a> which quite frankly was a long time ago. All applications interpreting HTML or CSS documents are called <strong>user agents</strong> and grouped into <strong>media types</strong>. One group is labeled as <strong>continuous media</strong> and these devices are called <strong>viewports</strong> in the specification.</p>
<p>Continuous in the specification means you can scroll the pages and view the page on a screen. The application in this case are of course browsers and that's where the confusion for some people begins.</p>
<h3>A smartphone is a computer</h3>
<p>Many people still see their smartphone as a cell phone and not what it really is: <em>a computer which is also a phone</em>. The phone is actually an application running on a small handheld computer.</p>
<p>If you watch a video or listen to music you are using a media player application. You install apps on your smartphone. The thing you are using to browse the web is&#8212;well an application known as a browser. Most Android smartphones have pre-installed the default Android browser but you can install other browsers. Just go to your Android Market and search for browser. You will find browsers like Firefox, Skyfire, Dolphin, Opera Mini, Fennec and some others.</p>
<h3>The viewport meta tag</h3>
<p>Finally the question about the meta tags and probably the real source for the confusion&#8212;the viewport meta tag. I see the following questions a lot:</p>
<ul class="list_elements">
<li>"<em>Does Android support the viewport meta tag</em>"</li>
<li><em>"Are there any Android specific meta tags"</em></li>
</ul>
<p>As we have just learned these questions are not correct and cannot be answered. The meta tags as you may know are part of the head section inside the HTML document. Hence, it has nothing to do with the device. It is safe to assume that today all browsers for Android smartphones support the viewport meta tag but that there are probably no other specific tags.</p>
<p>If you have a Android device you can do some tests on my <a title="Link to Viewport Demo pages" href="http://www.adrianworlddesign.com/Viewport-Demo/viewport">Viewport Demo</a> web page.</p>
<dl class="additional_reading"> <dt>If you like to know more about the viewport I have some other pages you might be interested in.</dt><dd>How to use the viewport meta tag for mobile device you might like my other document: <a title="Link to my Understanding the Viewport" href="http://www.adrianworlddesign.com/Knowledge-Base/MobileDevices/Fundamentals/Understanding-the-Viewport">Understanding the Viewport</a>. </dd><dd>Something about the <a title="Link to Viewport History page" href="http://www.adrianworlddesign.com/Knowledge-Base/MobileDevices/Fundamentals/Viewport-History">Viewport History</a> but not much more than you already know now.</dd></dl>
<p>Final note: Although Apple more or less invented the meta tag for their devices like iPhone, iPod or iPad it is in fact used by its Safari web browser&#8212;not the devices.</p><img src="http://feeds.feedburner.com/~r/AWD-KnowledgeBase/~4/vLyMhzIPKvw" height="1" width="1"/>]]></content:encoded>
    </item>
    <item>
      <title>Array List with Countries</title>
      <description><![CDATA[If you are looking for a long list with countries, territories, continents and regions as a PHP array you can use in your application, even sorted by continent or region, you should take a look at the Zend Framework, in particular the Zend_Locale class. Zend_Locale as everything you need to get such a list and since all classes work independent you can virtually use it anywhere you have PHP. Best of all, you can get in not only in an array but in a wide array of languages.]]></description>
      <pubDate>Sun, 22 Jul 2012 12:56:40 -0500</pubDate>
      <link>http://www.adrianworlddesign.com/Knowledge-Base/Zend-Framework/Helpful-Tips/Array-List-with-Countries</link>
      <guid>http://www.adrianworlddesign.com/Knowledge-Base/Zend-Framework/Helpful-Tips/Array-List-with-Countries</guid>
      <content:encoded><![CDATA[<p>Are you <strong>looking for a list with countries <span style="color: red;">then please read on</span></strong>!</p>
<p>If you <strong>have a problem finding things like such lists</strong> here's a little tip. The list you are looking for should not have the words from your seach in it. Unfortunately, your search engine (like Google) will not find such lists by magic because they are matching the words in your search against webpages like this one. They find this page because I write about country lists but you have to read. So, again please read on because most likely <strong>following I have the links to the country list you are looking for</strong>.</p>
<p>I do have webpages with some data about continents, regions, territories and countries. I also have them in different formats like in a PHP array with the ISO abbreviation as the index key. I even have translations in multiple languages.</p>
<h3>Quick Answers</h3>
<p>First I have a couple quick and dirty answers and then a more elaborate answer for those working with PHP whole to include a countries list into their website:</p>
<div><ol class="list_elements">
<li>For a simple countries list go to my <a title="Countries List website" href="http://www.countries-list.info/" target="_blank">Countries List</a>&#160;website. There you can generate and download country lists not only sorted by continents or regions but also in different languages and formats.</li>
<li>If you can't read or understand English and just scan the page for a download link then here is one:<br /><a title="Download link for a countries list document" href="http://www.countries-list.info/Download-List/download" target="_blank">DOWNLOAD COUNTRIES LIST</a><br />You should really read point 1 and select that link, though. The list in this link is only a unsorted simple countries list. No continents, regions, languages or formats like a PHP array or XML. </li>
<li>If you need something more elaborate and versatile which fits and works in your PHP project you can use <strong>Zend_Locale</strong> with the territories list from the Zend Framework. In fact, that's what this page is about.</li>
</ol></div>
<p>So, you can search the web for <strong>Zend_Locale</strong> and <strong>Zend Framework</strong> and help yourself or just read on. If you need more information about Zend_Locale is and how to pull a countries list please then this page is all about.</p>
<h3>The power of Zend_Locale</h3>
<p>If you don't know Zend Framework then a hearty welcome to Zend Framework and the power of Zend_Locale. If you feel comfortable with a large and somewhat complex application framework you will love Zend_Locale and what it can do for you in terms of country lists. Especially when you need the list in many different languages. In this little tutorial I will show you how to work with Zend_Locale and get a list with almost all the countries in this world in many different languages.</p>
<h3>First some background</h3>
<p>According to t<a title="Zend Framework - Introduction Zend_Locale" href="http://framework.zend.com/manual/en/zend.locale.introduction.html" target="_blank">he documentation</a> <em>"Zend_Locale is the Frameworks answer to the question, "How can the same application be used around the whole world?"</em> ... and some more. Besides all the main purposes in <strong>Zend_Locale</strong> there is this little hidden treasure which might be overlooked by most people. Zend_Locale uses an impressive amount of XML lists with all sorts of data and you are basically able to pull aggregated lists of this data. Including a list of all continents, territories and countries.</p>
<p>As with all Zend classes you don't need a full installation and implementation of the framework. You just need to make sure you get the path right.&#160;The Zend_Locale class can be used independently and most methods are implemented as static methods, i.e. you don't even have to create an object of the class.</p>
<h3>The easy solution</h3>
<p>To get a list from Zend_Locale you will use a method named "getTranslationList". You can pass three arguments:</p>
<dl class="code_example"><dd>$type - This is the name for the list you want [required]</dd> <dd>$locale - The language you want [optional] - default is your browser/system default</dd> <dd>$value - Some types allow detailed lists which can be selected with this [optional]</dd> </dl>
<p>This is almost all you need to know to get your list with all countries in the world. So, what are the values we need for the arguments? Lets begin with type where we say that we like to get the countries.</p>
<p>If you have guessed "country" you guessed wrong and will see an exception. Agreed, this is a bit confusing or lets say misleading and why it might be overlooked by many. The correct type for country is "Territory" and the value is "2". Without a value you will get the list with actual territories plus continents and countries. That might be too much, though. So, you will type this</p>
<dl class="code_example"><dt class="code_description">// just make sure you have the class available</dt><dd>$countryArray = Zend_Locale::getTranslationList('Territory','en_US',2);</dd></dl>
<p>and you will get an array as the return with roughly 263 countries in English. Be warned, that other languages will have different results since the list gathers information from the XML files mentioned above. It all depends how complete (accurate) those lists are.</p>
<h4>Language List</h4>
<p>There are over 508 languages, mind you, and you can get that list the exact same way, just use type "language"; no value is required for that.</p>
<dl class="code_example"><dt class="code_description">// just use a different type</dt><dd>$languageArray = Zend_Locale::getTranslationList('Language','en_US');</dd></dl>
<h4>Sorting by continents or regions</h4>
<p>If you are wondering now how to sort this list, e.g. by continent we have to dig deeper into Zend_Locale and other supported types. In the next tutorial document I will explain what types you need and how then to <a title="Link to document for sorting an array list with countries" href="http://www.adrianworlddesign.com/Knowledge-Base/Zend-Framework/Helpful-Tips/Sorting-the-Country-List" target="_self">sort the country list</a> by continents or regions.</p>
<p>A list with all the supported types for Zend_Locale can be found in the <a title="Zend Framework - Using Zend_Locale" href="http://framework.zend.com/manual/en/zend.locale.functions.html" target="_blank">official documentation</a>; search the page for getTranslationList.</p>
<h3>Final Note</h3>
<p>Note that there have been some changes from earlier versions; this information should be accurate as of Version 1.10. Notably there used to be a type "country" which now throws an exception. There is still a method getCountryTranslationList but it is labeled as deprecated and actually triggers a E_USER_NOTICE error.</p><img src="http://feeds.feedburner.com/~r/AWD-KnowledgeBase/~4/dFJR6zjdmmE" height="1" width="1"/>]]></content:encoded>
    </item>
    <item>
      <title>Dynamic Classnames</title>
      <description><![CDATA[In PHP and Zend Framework (ZF2) you may call a different class because of dynamic content. Before namespaces this was simple and is still simple but with a little pitfall. This document tells what to look for with dynamic class name in a variable for namespaces.]]></description>
      <pubDate>Sat, 21 Jul 2012 16:19:13 -0500</pubDate>
      <link>http://www.adrianworlddesign.com/Knowledge-Base/zf2/Fundamentals/Dynamic-Classnames</link>
      <guid>http://www.adrianworlddesign.com/Knowledge-Base/zf2/Fundamentals/Dynamic-Classnames</guid>
      <content:encoded><![CDATA[<p>When you work in Zend Framework 2 (ZF2) or just PHP you may have a situation where you like to call a different class because of some dynamic content. Before PHP 5.3 and the introduction of namespaces this was simple. It is still simple but with a little pitfall.</p>
<h3>Fully Qualified Class Name</h3>
<p>When you like to call a class in PHP with namespaces and use a string in variable this must be a full qualified class name. Nevermind that you have set the use statement at the top of your file or that the class is even in the same namespace.</p>
<p>If you have string in a variable PHP will assume that is a dynamic call and that you could not have set a use statement. Therefore, it will demand the full class string or as it is known a <em>fully qualified class name</em>.</p>
<h3>Example</h3>
<p>Here is a little example for this case. <span style="color: red;">Note that the namespace declarations are actually backslashes and I have to cheat with forward slashes</span> because I cannot set them in my framework for whatever reason.</p>
<dl class="code_example"> <dd class="code_description">// assume this would be your two class</dd> <dd>namespace My/Directions;<br />class Left { ... }<br />class Right { ... }</dd> <dd class="code_description">// this would be some code calling either of the classes</dd> <dd>use My/Directions;</dd> <dd>if ( 'left' === $direction ) {<br />&#160;&#160; $classname = 'Left';<br />} else {<br />&#160;&#160; $classname = 'Right';<br />}</dd> <dd class="code_description">// the following will trigger an error because it cannot be resolved</dd> <dd>$object = new $classname();</dd><dd class="code_description">// and that's how you have to set the variable<br /></dd> <dd>$fullyqualified_classname = 'My/Directions'.$classname;<br />$object = new $fullyqualified_classname();</dd> </dl>
<p>So keep in mind: <em>Classes, constants and functions must be referenced as fully qualified class name strings</em> when you use namespaces in PHP.</p><img src="http://feeds.feedburner.com/~r/AWD-KnowledgeBase/~4/4ppZpjYbPmM" height="1" width="1"/>]]></content:encoded>
    </item>
    <item>
      <title>Zend Guard Loader on CentOS</title>
      <description><![CDATA[Installing Zend Guard Loader on Linux, that's what this document is all about. Where to get the ZendGuardLoader.so module, where to put it and add/use the config is all in this document. It does not have any quick or dirty tricks just plain and simple what you have to do to get it running on your Linux Web Server. If you have an instance in the Amazon Cloud AWS EC2 this is the procedure you are looking for.]]></description>
      <pubDate>Sun, 15 Jul 2012 09:00:48 -0500</pubDate>
      <link>http://www.adrianworlddesign.com/Knowledge-Base/Web-Hosting/Zend-Guard/Zend-Guard-Loader-on-CentOS</link>
      <guid>http://www.adrianworlddesign.com/Knowledge-Base/Web-Hosting/Zend-Guard/Zend-Guard-Loader-on-CentOS</guid>
      <content:encoded><![CDATA[<p>How to install Zend Guard Loader on Linux CentOS, that's what this document is all about. See below for more information <a title="Jumps down to Title About other Operating Systems" href="#other_os">About other Operating Systems</a>.</p>
<h3>Download the correct version</h3>
<p>First task is downloading the correct version. When you go to Zend and the <a title="Zend Guard Download Page" href="http://www.zend.com/products/guard/downloads" target="_blank">Download Page</a> for the modules you will get the Operating System tab for your current system. When I visit from my Windows desktop I will get the Windows tab, my Android shows the Linux tab and the iPod, guess what, the Mac OS X.</p>
<p>So, watch out and choose wisely!</p>
<h4>Select Linux tab</h4>
<p>Unfortunately the design and the text within the tabs isn't very helpful or distinct in telling what operating system and versions you are looking at. For CentOS make sure you clicked the Linux tab and you should see five versions. On top Zend Guard followed by Zend Optimizer and Zend Guard Loader.</p>
<h4>Optimizer versus Guard Loader</h4>
<p>Now you may be wondering what is the <em>difference between Zend Optimizer and Zend Guard Loader</em>?</p>
<p>If you have PHP 5.2 or earlier you will need <strong>Zend Optimizer</strong> whereas the <strong>Zend Guard Loader</strong> must be used for PHP 5.3.x; we don't know yet what the future holds for 5.4.</p>
<p>If you don't know what PHP version is on your system simply run <span style="font-family: monospace;">php -v</span> command. It'll tell you the version on the first line.</p>
<p>Note that I don't have PHP &#60;5.3 on CentOS so Zend Optimizer for me is not an option and I cannot verify and show this process. If you have PHP 5.2 or earlier you will need the Zend Optimizer runtime and I guess the process will be pretty much the same. I simply cannot see and therefore verify the final result.</p>
<h4>32-bit versus 64-bit</h4>
<p>Now, for Zend Guard Loader on Linux you have two options, a 32-bit version and a 64-bit version. It is important that you install the correct version and while the download (tar.gz) packages have distinct names the filename for the actual module itself <strong>ZendGuardLoader.so</strong> is the same for both versions.</p>
<p>In case you don't know what processor your system has you can run the following command</p>
<dl class="code_example"><dd>[root@centos ~]# uname -p</dd> <dd>x86-64&#160; <span class="code_description">// this would be a 64-bit system</span></dd></dl>
<h4>Download on the command line</h4>
<p>If you follow this for an installation where you work remotely with ssh/PuTTY and wonder <strong>how to download on the command line in Linux</strong> here is a hint for how to download the file. If you already know you can skip ahead, of course.</p>
<p>There is a handy little utility called <strong>wget</strong> for retrieving files with HTTP or FTP protocols. Once you have the correct link name from above you can paste it to the <span style="font-family: monospace;">wget</span> command and download the file from Zend directly to your Linux box. Extract the tar.gz and you should be ready for the next steps. If you don't have wget yet on your Linux server you can find and install it with yum.</p>
<p>When you have your download and the module extracted it is time for the installation.</p>
<h3>Install the module</h3>
<p>Installing the Zend Guard Loader module requires three simple things: copy the module file to a special place, add this path to a php config file and restart your web server.</p>
<p>Now lets break down the three steps.</p>
<h4>Copy the module</h4>
<p>As you can see in the downloaded package the Zend Guard Loader is only a single file. Zend calls it a runtime but in terms of the installation on your Linux system this file is known as a module. You can or should copy this module to one specific location but it is up to your preference because in the next step you can add an absolute path.</p>
<p>The best location is with all the other PHP modules. The PHP modules directory on CentOS should be <span style="font-family: monospace;">/usr/lib64/php/modules/</span> and it should contain some other modules.</p>
<h4>Add path to config (php.ini)</h4>
<p>Note the final step but the one that ties all together is adding the path to the php config which has a few options&#8212;with the <strong>php.ini</strong> as the common and default option. PHP actually allows you to have multiple configuration files, i.e. not just the <em>default php.ini file</em>.</p>
<p>Your downloaded file has a template for what you have to add. Following is the bare minimum you will need. Note that the path in zend_extension is an example and maybe be different on your system.</p>
<dl class="code_example"> <dd class="code_description">; Enable ZendGuard loader module</dd> <dd>zend_extension=/usr/lib64/php/modules/ZendGuardLoader.so<br /></dd> <dd class="code_description">; Enables loading encoded scripts. The default value is On</dd> <dd>zend_loader.enable=1</dd> <dd class="code_description">; Disable license checks (for performance reasons)</dd> <dd>zend_loader.disable_licensing=0</dd> <dd class="code_description">; The Obfuscation level supported by Zend Guard Loader. The levels are detailed in the official Zend Guard Documentation. 0 - no obfuscation is enabled</dd><dd>zend_loader.obfuscation_level_support=0</dd><dd class="code_description">; Path to where licensed Zend products should look for the product license. For more information on how to create a license file, see the Zend Guard User Guide</dd> <dd>; zend_loader.license_path=</dd></dl>
<p>I personally use a dedicated <strong>zendguard.ini</strong> file in my <span style="font-family: monospace;">/etc/php.d/</span> directory. the naming doesn't matter because PHP looks at and loads all ini files in this directory. In fact, you should already find a few ini files in that directory.</p>
<p>Note that these files are only touched once (see next step) hence the overhead for such an additional file is basically zero. Note that these files are uses under the term <strong>dynamic extensions</strong> which may be confusing</p>
<p>They are loaded dynamically when the web server is started, again see next step. Dynamic in this sense means they are not compiled into the PHP core and <span style="text-decoration: underline;">not</span> that dynamically for every request.</p>
<h4>Reload httpd configuration</h4>
<p>Last but not least you reload the PHP configuration. In case you don't know when this happens:  when you restart your web server.</p>
<p>For our CentOS Linux system this usually means you have an Apache web server. For an Apache httpd to reload the configuration you have the following options.</p>
<dl class="code_example"> <dd>[root@centos ~]# service httpd graceful</dd> <dd>[root@centos ~]# service httpd reload</dd> <dd>[root@centos ~]# service httpd restart</dd> <dd class="code_description">For the different options please see the manual</dd> </dl>
<p>And that's all she wrote for the installation! Except for maybe verifying if all went well. Please read on.</p>
<h3>Verify your Zend Guard Installation</h3>
<p>To see if this all was successful follow the next document and <a title="How to test if ZendGuardLoader.so is installed and working" href="http://www.adrianworlddesign.com/Knowledge-Base/Web-Hosting/Zend-Guard/Verify-Zend-Guard-installation">How to verify a Zend Guard Installation</a>.</p>
<h3 id="other_os">About other Operating Systems</h3>
<p>This document is mainly about CentOS but the process for other Linux distributions should not be any different, though. Back to <a title="Gets you back on top of the page" href="#header">Top of page</a>.</p>
<h4>RedHat</h4>
<p>CentOS is based on RedHat so there shouldn't be any differences in the procedure.</p>
<h4>Other Linux distributions</h4>
<p>There might be some differences in paths but overall the procedure should be the same. If you know your distribution you should know what the correct path is.</p>
<h4>Amazon AWS EC2 cloud</h4>
<p>If you have a Linux instance in the Amazon Cloud <abbr title="Amazon Web Services">AWS</abbr> <abbr title="Elastic compute cloud">EC2</abbr> and need Zend Guard Loader for your web application this procedure is  the same because most default instances are based on CentOS/RedHat.</p>
<h4>What about Windows?</h4>
<p>If you are looking for installing Zend Guard Loader on Windows and  XAMPP in particular I will have a document up soon&#8212;unless I forget. If  you have any problems with the Zend Guard Loader please check out the  other documents in this section. Use the breadcrumbs above to get to the  parent webpage's overview.</p><img src="http://feeds.feedburner.com/~r/AWD-KnowledgeBase/~4/RRDJUYCjqhI" height="1" width="1"/>]]></content:encoded>
    </item>
    <item>
      <title>Apple touch icon</title>
      <description><![CDATA[You may find some errors in your logs for png files with the name beginning with apple-touch-icon. This document sheds some light what this is about and where you can more details.]]></description>
      <pubDate>Sat, 14 Jul 2012 11:17:12 -0500</pubDate>
      <link>http://www.adrianworlddesign.com/Knowledge-Base/MobileDevices/Apple/Apple-touch-icon</link>
      <guid>http://www.adrianworlddesign.com/Knowledge-Base/MobileDevices/Apple/Apple-touch-icon</guid>
      <content:encoded><![CDATA[<p>It was quiet in my log files for quite some time but recently I see more and more of these error requests for various types of <strong>png image files</strong> containing some <strong>apple-touch-icon</strong> string in their names. Time for some digging and what this is all about.</p>
<h3>Apple mobile devices</h3>
<p>One thing seems to be clear. According to the names it has something to do with Apple's mobile devices. Also looking at the User Agent string in the requests indicates that it is related to mobile devices. However, for some unknown reason I also have some Android devices in between. However, with these requests the browser seems to be Apple's Safari mobile browser for Android although I could not find this browser for installation on my Android phone. Well, never mind that's not important for our discussion here.</p>
<p>Now the picture gets clearer that all is related to Apple's mobile browser Safari but the final information can be found somewhere else.</p>
<h3>Web Applications for Apple</h3>
<p>Search for information at Apple's websites is not that easy but I came across the iOS Developer Library which is primarily about writing native applications for their mobile devices.</p>
<p>You have to do quite some digging in this library and it is not listed under the regular menu but there is a <a title="Links to Apple's Safari Web Content Guide" href="https://developer.apple.com/library/ios/documentation/AppleApplications/Reference/SafariWebContent/Introduction/Introduction.html#//apple_ref/doc/uid/TP40002051" target="_blank">Safari Web Content Guide</a>. Within this guide we will find a chapter labeled "Configure Web Applications" and the first document is <a title="Links to Apple's iOS Developer Ligrary" href="http://bit.ly/OCYiMl" target="_blank">Specifying a Webpage Icon for Web Clip</a> and this is the answer for our <em>apple-touch-icon images</em>.</p>
<p>So, Apple uses these icons for what they call <strong>Web Clip</strong>.</p>
<h3>What is Web Clip</h3>
<p>So our new question would be about this <strong>Web Clip</strong> thingy. The Web Clip is labeled as a feature but we will see it is more than that. This <em>Web Clip feature</em> is available for quite some time and since iOS 4.2 for different device resolutions.</p>
<p>A Web Clip is basically what we have or know in Windows as an icon for links. We can add an icon to a shortcut link or an application provides its own set of icons, often in a dll file. In iOS (as the mobile operating system) and hence on your Apple mobile device all <em>the images for your app buttons are called Web Clips</em>.</p>
<p>When you go to your <strong>App Store</strong> and install an app from there the application will have this Web Clip. Additionally you can also add a link for a webpage to your <strong>Home Screen</strong>. For this webpage/app link the Safari browser will look for these png files on your website.</p>
<p>If you are in your web browser on your Apple mobile device and click the link symbol at the bottom you will see the "Add to Home Screen" button. When you click this option you have a link on your screen to this webpage.</p>
<h3>Image formats</h3>
<p>Now lets look and talk about the format for this images for the Web Clips. There is three things we have look at: the image size, name and location.</p>
<h4>Image size</h4>
<p>The default size for a Web Clip is 57x57 pixels but as mentioned above there is support for different sizes. There seems to be two other standard sizes whit one being a 72 pixel square and the square is 114 pixels. Looking at document and information we see for these two squares it gets a little weird. Apparently the 72 pixels square is for the iPad while the 114 pixels square is for iPhone4.</p>
<p>There is also this <a title="Links to Apple's iOS Developer Library" href="https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/MobileHIG/IconsImages/IconsImages.html#//apple_ref/doc/uid/TP40006556-CH14-SW1" target="_blank">Custom Icon and Image Creation Guidelines</a> document in the same library and here we get some more information about the actual sizes. In Table 8.1 we look at the first row for "Application icon (required for all apps)".</p>
<ul class="list_elements">
<li>iPhone and iPod touch (regular display) 57 pixels</li>
<li>iPhone and iPod touch (high-res display) 114 pixels</li>
<li>iPad (regular display) 72 pixels</li>
<li>iPad (high-res display) 144 pixels</li>
</ul>
<p>Hence we have one more size which is the 144 pixels square. The High-Resolution definition is the other word for what is known as the Retina display.</p>
<h4>Image names</h4>
<p>For the names we have to either work with the defaults or we set our own definition. Lets see the defaults first and another funny definition&#8212;precomposed.</p>
<p>If you prepare a perfectly square image then iOS will add rounded corners and a drop shadow to the image. However you can create, i.e. style your own Web Clip and then the iOS will not add any effects to the icon. These images have to be labeled as "<strong>precomposed</strong>".</p>
<p>These indicates that we can (or must) have two images files for basically every image size. That would be 8 images but according to the documentation the scan should only look for 4 file names. Following is what we will end up with</p>
<ul class="list_elements">
<li>An option for the size <br />apple-touch-icon-57x57-precomposed.png <br />apple-touch-icon-57x57.png</li>
<li>The default image names <br />apple-touch-icon-precomposed.png <br />apple-touch-icon.png</li>
</ul>
<p>So, how do we have to define the other dimensions? That would be where the location comes into place.</p>
<h4>Image location</h4>
<p>The default location for the images is the root of your web server. Depending on the setup of your web server this could be tricky or maybe you don't even have proper access or rights to add the images to this location.</p>
<p>The only valid option here is to add a link element with this information to the document head on your webpages. In a perfect world you will identify the USER_AGENT string first and add this meta tag only for the appropriate requests and not just as a default to every request you get to your website.</p>
<p>The link element will have rel attribute name "apple-touch-icon" with a href attribute and a path information. Plus you can add the size here to provide more information for the use of the image. This would all look something like this in your document's head:</p>
<dl class="code_example"> <dd>&#60;link rel="apple-touch-icon" href="touch-icon-iphone.png" /&#62;</dd> <dd>&#60;link rel="apple-touch-icon" sizes="72x72" href="touch-icon-ipad.png" /&#62;</dd> <dd>&#60;link rel="apple-touch-icon" sizes="114x114" href="touch-icon-iphone4.png" /&#62; </dd></dl>
<p>As you can see here you could use any name and path as the location but you have to provide the appropriate information with multiple link elements in your document head.</p>
<p>Personally I still don't know what to think of it but Apple seems to really give a damn about web designers and developers. To some degree it's nice to have this option but not everyone is surfing our site with a iPhone or iPad and yet we have to set up and design our websites to make it work just as if.</p><img src="http://feeds.feedburner.com/~r/AWD-KnowledgeBase/~4/Iz80_boZzVA" height="1" width="1"/>]]></content:encoded>
    </item>
    <item>
      <title>Verify .htaccess is read</title>
      <description><![CDATA[If your Apache (httpd) Web Server and .htaccess configuration is not working then first thing you want to know is if the .htaccess file is even touched or accessed, read and executed. There is obviously no need to look over the rules if it is not used, right? So, how to you test that? This document has the simple answer to this question.]]></description>
      <pubDate>Thu, 12 Jul 2012 08:44:33 -0500</pubDate>
      <link>http://www.adrianworlddesign.com/Knowledge-Base/Web-Hosting/Apache-Web-Server/Verify-htaccess-is-read</link>
      <guid>http://www.adrianworlddesign.com/Knowledge-Base/Web-Hosting/Apache-Web-Server/Verify-htaccess-is-read</guid>
      <content:encoded><![CDATA[<p>You set up a new website with your <strong>Apache (httpd) Web Server</strong> and add a default <strong>.htaccess configuration file</strong> to its web root folder with some site specific configuration directives. For some unknown and unexpected reason the rules fail, though. In other words the <em>Apache htaccess configuration rules are not working</em>.</p>
<p>First thing you should do in this case is check if your .htaccess file is even executed, i.e. accessed and load. There is obviously no need to look over the rules if it is not touched, right?</p>
<p>If you need more information about what the .htaccess is then see below <a title="Jump to title What is .htaccess again" href="#what_is_htaccess">What is .htaccess again?</a></p>
<h3>Force an error</h3>
<p>The simple solution to verify if the .htacess configuration file is even touched and parsed is forcing an <strong>500 Internal Server Error</strong>.</p>
<h4>Force an Internal Server Error</h4>
<p>So, how do you force such a 500 Internal Server Error from a configuration file? Simple, add something to the first line of the .htaccess that doesn't make sense. Like just a single letter or number, a word, basically anything that is not  a directive or complete directive in any form.</p>
<p>If you get the 500 Internal Server Error you will know that the file is accessed or touched and read; that first (garbage) line you added triggers the error.</p>
<p>If you don't get the error than your server setup is wrong, i.e. your .htaccess is either ignored or not found. Check out the other documents in my knowledge base for answers to that question.</p>
<h3 id="what_is_htaccess">What is .htaccess again?</h3>
<p>If you are not sure what the .htaccess file is, here's a quick info straight from the <a title="Apache's Configuration Files" href="http://httpd.apache.org/docs/current/configuring.html" target="_blank">Apache Configuration Files</a> documentation.</p>
<blockquote>Apache allows for decentralized management of configuration via special files placed inside the web tree. The special files are usually called .htaccess, but any name can be specified in the AccessFileName directive. Directives placed in .htaccess files apply to the directory where you place the file, and all sub-directories. The .htaccess files follow the same syntax as the main configuration files. Since .htaccess files are read on every request, changes made in these files take immediate effect.</blockquote>
<p>For more information check out the <a title="Apache tutorial: .htaccess file" href="http://httpd.apache.org/docs/current/howto/htaccess.html" target="_blank">Apache tutorial</a> or the link above.</p><img src="http://feeds.feedburner.com/~r/AWD-KnowledgeBase/~4/djni1hvEG74" height="1" width="1"/>]]></content:encoded>
    </item>
    <item>
      <title>ZF classes as stand alone objects</title>
      <description><![CDATA[The Zend Framework is a broad library of loosely-coupled pieces and can be used in two ways. As a full Web 2.0 application with the industry standard design pattern MVC or use the library classes as stand alone objects. This page will show you how to use the Zend Framework as a library with their classes as stand alone objects. There are only few little things you need to know to use the full power of the Zend Framework library in your project. You can include and use these classes easily in your existing application even if it is a framework like Wordpress, Joomla, Drupal and whatnot.]]></description>
      <pubDate>Tue, 10 Jul 2012 07:42:47 -0500</pubDate>
      <link>http://www.adrianworlddesign.com/Knowledge-Base/Zend-Framework/Helpful-Tips/ZF-classes-as-stand-alone-objects</link>
      <guid>http://www.adrianworlddesign.com/Knowledge-Base/Zend-Framework/Helpful-Tips/ZF-classes-as-stand-alone-objects</guid>
      <content:encoded><![CDATA[<p>The Zend Framework can be used in two ways: a) as a <strong>stand alone library</strong> with objects and b) as a web application with a <strong>Model-View-Controller (MVC) pattern</strong>. Unfortunately there is not much emphasis in the official documentation about it.</p>
<p>In many places the <strong>reference guide</strong> (manual) fails to mention the subtle differences, i.e. if something applies to the MVC method or only stand alone. Once you know it all it's obvious but until then you are pretty much doomed with it. For instance, the <em>Quick Start guide</em> dives right into the <abbr title="Model View Controller Pattern">MVC</abbr> introduction and setup and it does not mention <em>how to use the <abbr title="Zend Framework">Zend</abbr> library stand alone</em> and the classes within as independent objects.</p>
<p>If you like to use the<strong> library in Zend Framework stand alone</strong> in your existing project this little <em>tutorial</em> will show you how to work with the classes. You can include the library in basically any other PHP project and framework like WordPress, Joomla, Drupal and whatnot.</p>
<h3>Stand alone setup</h3>
<p>The setup for the Zend Framework as a stand alone library is pretty simple: Get the Zend folder and add the parent folder to your PHP include path. Lets look at this in detail.</p>
<h4>Download and move</h4>
<p>Download any of the packages in the <a title="Link to Zend and the download page for the latest release of ZF" href="http://framework.zend.com/download/current/" target="_blank">latest ZF release webpage</a>. Extract the downloaded file. Inside the extracted folder you should find the <strong>library/Zend</strong> folder. What you need is this Zend folder.</p>
<p>You can copy or move that folder to wherever you like in your web server; or how about a <a title="Link to document about how to set a symbolic link " href="http://www.adrianworlddesign.com/Knowledge-Base/Web-Hosting/Tips-and-Tricks/File-and-Folder-Links">symbolic link</a>. Before you make a decision I recommend that you continue reading, though. It may well be that you already have a perfect location for it.</p>
<h4>Include the library</h4>
<p>Now, lets look at the PHP environment. It does not really matter where you set this up in your current project but when. <em>You have to set it up before you call your first Zend class</em>.</p>
<p>We will need a path to the parent folder of the Zend folder in the PHP environment which is defined in your <strong>PHP include path</strong>. If you already have a library or similar folder in your include path&#8212;even better. In that case, you just add the Zend folder to that folder and you are all set and don't need the following at all and jump to testing the setup.</p>
<p>If you don't have a library or similar folder yet then you have to create one and add the Zend folder. Then you add this parent library folder of your Zend folder to your PHP path. <strong>Note</strong>: That is the parent folder, not the Zend folder!</p>
<h4>Why the include path?</h4>
<p>The Zend classes have a lot dependance between each other, i.e. many classes make use of other classes. For this to work we have <strong>require_once()</strong> statements all over and these statements use a relative path to the Zend folder. You may already use or want to take a look at <a title="Go to php.net for autoloading classes" href="http://us.php.net/manual/en/language.oop5.autoload.php" target="_blank">autoloading classes</a> but this is not a requirement so I will skip over that. (Note: This will change in ZF2.)</p>
<p>This means that PHP will loop through its path information and concatenate this Zend folder references and look out for the requested file. If you add the Zend folder it will look for the file in a Zend/Zend folder which does not exist! If you run the library on a Linux system be aware of case sensitive nature of Linux, i.e. the folder's name must be Zend not zend.</p>
<p>You can add the include path in your PHP configuration (php.ini file) or at run time. If you want to set this library path directly in your php.ini that's just fine. If not then the following is how to set it up at run time. An index.php is always a great place for this.</p>
<dl class="code_example"><dt class="code_description">// define an absolute path to library directory<br />// you don't have to set a constant but it is just good practice <br />// you can also use a variable or add the path directly below</dt> <dd>define('APPLICATION_LIBRARY','path/to/your/library')); </dd> <dt class="code_description">// <strong>Note again</strong>: the path is the parent of your Zend folder, not the Zend folder itself.<br /> // now set the include path </dt> <dd> set_include_path(implode(PATH_SEPARATOR, array(<br />&#160;&#160;APPLICATION_LIBRARY, get_include_path(),<br />)));</dd></dl>
<p>We are almost done.</p>
<h3>Test the setup</h3>
<p>Finally just some little test if all worked out</p>
<dl class="code_example"> <dt class="code_description">// Note: you don't have to use this if statement<br />// but this would tell you why it is not working<br /></dt> <dd>if ( file_exists(APPLICATION_LIBRARY . '/Zend') ) {<br /> &#160;&#160;require_once('Zend/Filter/Word/CamelCaseToDash.php');<br /> &#160;&#160;$zf_filter = new Zend_Filter_Word_CamelCaseToDash();<br /> &#160;&#160;echo $zf_filter-&#62;filter('HelloWorld');<br /> </dd> <dt class="code_description">&#160;&#160;// echos <strong><span class="code_description" style="color: orange;">Hello-World</span></strong></dt> <dd>} else {<br /> &#160;&#160;exit('The Zend library folder is missing!');<br /> } </dd></dl>
<p>If you get the <em>Hello-World</em> with the dash you are all set and are able to use the Zend Framework library and the classes as independent objects in your project. If you use an autoloader you should not have to use the initial require statement, but that's another story.</p><img src="http://feeds.feedburner.com/~r/AWD-KnowledgeBase/~4/3IZ0V0nqM6U" height="1" width="1"/>]]></content:encoded>
    </item>
    <item>
      <title>Execution order</title>
      <description><![CDATA[Is your rewrite rule (RewriteRule) in your Apache's .htaccess configuration file not working? Looking around forums I see this problem a lot and surprisingly many people don't really understand how the htaccess config file works. They sometimes ignore or don't seem to understand the concept of execution order which is crucial for the htaccess file to work--or not work.]]></description>
      <pubDate>Fri, 29 Jun 2012 12:17:48 -0500</pubDate>
      <link>http://www.adrianworlddesign.com/Knowledge-Base/Web-Hosting/Apache-Web-Server/Execution-order</link>
      <guid>http://www.adrianworlddesign.com/Knowledge-Base/Web-Hosting/Apache-Web-Server/Execution-order</guid>
      <content:encoded><![CDATA[<p>If you are looking for specific rewrite rules with the Zend Framework please see see this other <a title="Apache configuration for Zend Framework" href="http://www.adrianworlddesign.com/Knowledge-Base/Zend-Framework/Helpful-Tips/Apache-configuration">Apache Configuration</a> document.</p>
<p>Is your <strong>RewriteRule</strong> in your Apache's <strong>.htaccess</strong> configuration file not working as expected?</p>
<p>Your <strong>httpd web server daemon</strong> may <em>ignore the rewrite rule</em> because you don't follow the rules of execution. In such a case it works perfect but your rules simply don't apply, they are ignored. Your logic in the files execution is ... well, illogical.</p>
<p>Looking around forums I see this problem a lot and I think a lot of people don't really understand how the .htaccess config file works. Sometimes they ignore or don't seem to understand the concept of <strong>execution order</strong>. Unfortunately this is crucial for the htaccess file to work&#8212;or not work.</p>
<p>If you understand the execution order you can solve many problems with your Apache configuration like the .htaccess very easy.</p>
<h3>Top to bottom</h3>
<p>Any configuration file for an Apache web server is like a batch script and such scripts are executed in sequence. This sequence is from top to bottom. An .htaccess config file is therefore no different and executed from top to bottom.</p>
<p>Each line in a configuration file is a directive. There are also sections but the rules and how the directives within them behave are pretty much the same. See <a title="Apache Configuration Sections and merging" href="http://httpd.apache.org/docs/2.2/sections.html#mergin" target="_blank">How the sections are merged</a> for information about <strong>Configuration Sections</strong>.</p>
<p>Long story short, a configuration file is interpreted line by line from top to bottom by the Apache server daemon&#8212;that's httpd on a Linux system.</p>
<h4>Exit now!</h4>
<p>What is also important to know here is that <strong>certain rules cause an immediate exit</strong>.</p>
<p>If the rule defines an external redirect the server will perform that redirect immediately and all following rules are therefore ignored. Just think about it. If your directive orders a redirect it does not make any sense to read and execute any other conditions or rules.</p>
<p>If this redirect leads back to the same server and configuration file then it is just a new game with the rules! In a perfect world that previous redirect rule does not apply anymore it is on to the next rule. In a not so perfect world where the rule still applies&#8212;which is unfortunately your fault and not Apache's&#8212;you end up in a loop.</p>
<p>There is a similar thing with a RewriteRule that matches and has the [L] flag, either alone or in combination with another flag. The [<strong>L] flag stands for Last</strong> as in <em>This is our <strong>[L]ast rewrite rule</strong></em> or <em>Stop the rewriting process here and don't apply any more rewrite rules</em>. This last sentence is a quote straight from the <a title="Apache mod_rewrite Manual" href="http://httpd.apache.org/docs/2.0/mod/mod_rewrite.html" target="_blank">Apache mod_rewrite documentation</a>. Note that this will not immediately end the processing of the configuration, though. The [L] is flag for rewrite rules and only applies to the rewrite rules.</p>
<p>However, the <strong>RewriteRule</strong> also have a <strong>[R]</strong> flag and stands for <strong>[R]edirect</strong> to the mentioned path. You will usually use and find these two <strong>[L,R]</strong> flags together. If the condition in the rewrite true is true then the redirect will happen immediately and the <strong>[L]ast</strong> flag is actually implied.</p>
<p>Just note that for a redirect the [L] flag alone does nothing for you.</p>
<h3>Be logical</h3>
<p>Now you only have to pretend to be Captain Spock and be logical. Simply apply some logic in your configuration file which is mainly taking care of the order for your directives.</p>
<p>Any request for a redirect should be fairly early in the script. It does not matter in this case if the redirect is caused by any of the <a title="Apache Redirect directives" href="http://httpd.apache.org/docs/2.2/mod/mod_alias.html#redirect" target="_blank">Redirect directives</a> or a RewriteRule (see mod_rewrite link above). If that condition is met the execution will stop and send a redirect response to the browser. The browser will send a new request and we have a new game.</p>
<p>If you use <strong>SetEnv</strong> for environment variables you don't have to set them before any redirects. If a redirect applies the environment variable has been set for nothing. Although just a millisecond it is really a waste of your server time.</p>
<h3>The last resort</h3>
<p>If you work with the Zend Framework you will learn and copy from the manual some RewriteRule to an index.php file.</p>
<p>Such a RewriteRule to an index.php is something we will add very late at the end and bottom of the .htaccess file.</p>
<p>Just think of it as your last resort&#8212;like an <em>if all fails then</em> rule. It does not matter if this is the Zend Framework or any other application you funnel through an index.php or other script for that matter. You can add many <strong>RewriteCond</strong> directives and send them to specific files. Just don't forget to add the [L] flag. If the RewriteCond is true and you don't have the [L]ast flag the execution of the configuration goes on and may result in an unwanted result.</p><img src="http://feeds.feedburner.com/~r/AWD-KnowledgeBase/~4/nbnEKQm7Ktk" height="1" width="1"/>]]></content:encoded>
    </item>
    <item>
      <title>Redirect 404 error page</title>
      <description><![CDATA[This page will tell you how to send a redirect 404 error page in Zend Framework or straight PHP. It will also tell you that there actually is not such thing as a 404 redirect.]]></description>
      <pubDate>Mon, 25 Jun 2012 10:54:21 -0500</pubDate>
      <link>http://www.adrianworlddesign.com/Knowledge-Base/Zend-Framework/OAQ---Occasionally-asked-questions/Redirect-404-error-page</link>
      <guid>http://www.adrianworlddesign.com/Knowledge-Base/Zend-Framework/OAQ---Occasionally-asked-questions/Redirect-404-error-page</guid>
      <content:encoded><![CDATA[<p>Lately I see links to one of my other pages for questions like <strong>404 page error</strong> or <strong>how to redirect 404 in PHP or Zend.</strong></p>
<p>Unfortunately that webpage is not specifically about 404 redirects so let me address this questions here about 404 error pages in PHP or Zend.</p>
<h3>Redirect versus Error page</h3>
<p>We have to clarify one thing. If you came to this page for precisely questions like <em>404 redirect</em> or <em>how to redirect to 404 error page</em> then I see it as my obligation to tell you that there is no such thing as a <span style="text-decoration: underline;">404 redirect</span>.</p>
<h4>What is a redirect 3xx</h4>
<p>A redirect means to send a special message to a browser to look for another document with another link. A redirect tells a browser explicitly to look for the request somewhere else, i.e. you have to <em>return a new link to the browser</em>. A redirect requires a 3xx status codes which tells a browser to load the page with the new link.</p>
<p>Furthermore, for a redirect you don't have to return a HTML document because the browser should terminate the current request and then load and render the document with the submitted link. With php no HTML document will be submitted and therefore ever be seen.</p>
<p>If your web application has decided to send a redirect and added all the required header data it can be terminated immediately.</p>
<p>For more information see my other document for how to actually use <a title="Refresh, redirect in Zend Framework or PHP" href="http://www.adrianworlddesign.com/Knowledge-Base/Zend-Framework/Helpful-Tips/How-to-use-redirect">redirect in the Zend Framework</a> and also PHP.</p>
<h4>What is an error 4xx</h4>
<p>Now, error pages are slightly different. The only thing similar is that we also add special information to the header which is then returned to the client's browser. For an error we have to use one of 4xx status codes.</p>
<p>When we return a 4xx status code one immediate difference compared to a redirect is that any of these codes instructs the browser to do&#8212;nothing!</p>
<p>A browser doesn't do much it seems. However, all caching systems in between and the browser will act differently in terms of how to save the document.</p>
<p>Depending on the error certain browsers may not even send a new request when a user refreshes the page. It simply reloads the error page from its cache. You may see that in your server logs, i.e. you don't see any new requests no matter how often you hit F5 in your browser. With some error codes you told the browser the document is gone, so why bother even trying again. Another result is Google and other search engines who will not index such a page.</p>
<p>The other and main difference to a redirect is that you will have to craft and return an HTML document.</p>
<h3>How to send 4xx error</h3>
<p>Finally the answer to how to send an 4xx error?</p>
<p>First you must know or decide what type of error code. The official and technical source is <a title="W3C: HTTP Status code definition" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html" target="_blank">W3C Error codes</a> list. There is also a Wikipedia page with a <a title="Wikipedia: List with HTTP Status codes" href="http://en.wikipedia.org/wiki/List_of_HTTP_status_codes" target="_blank">HTTP status codes</a> page.</p>
<p>A special note here: The redirect and error codes are actually called <strong>Status Codes</strong> and belong to the HTTP specification. Although you use them for your HTML webpages they are not part of an HTML document.</p>
<p>This special note immediately points out a very important fact. You cannot add the codes anywhere in your HTML document. They have to go into the header of the response which has <span style="text-decoration: underline;">nothing</span> to do with the <span style="font-family: monospace;">&#60;head&#62;</span> section of the HTML document.</p>
<h4>Header information in PHP</h4>
<p>We can set header information with the aptly named <a title="Link to php.net and header function" href="http://us.php.net/manual/en/function.header.php" target="_blank">header()</a> function in PHP. See the manual for details.</p>
<h4>Header information in Zend Framework</h4>
<p>Just to make this clear, the Zend Framework doesn't do anything different. The helper class does exactly the same and uses the header() PHP function.</p>
<dl class="code_example"><dd>$error_404 = 'HTTP/1.1 404 Not Found';</dd><dd> $this-&#62;getResponse()-&#62;setRawHeader($error_404);</dd></dl>
<p>Note that has to go inside your controller.</p>
<h3>Final warning</h3>
<p>Just remember and look out for two things.</p>
<p>First: You have to see all  header information before you echo anything. Anything means also no  empty spaces which some can happen accidentally when you have a simple  space or even a empty line before <span style="font-family: monospace;">&#60;?php</span> opening tag. The same can be true at the end, i.e. a simple space or a newline after a <span style="font-family: monospace;">?&#62;</span> closing tag. That's why many php pages don't use the closing tag.</p>
<p>Second: You should always create and return some meaningful message. In other words and error message in many cases should not be much different than your regular webpages except that it should contain some information for the user telling what went wrong and maybe how to fix the problem.</p>
<p>The error may be temporary so you have to mention that. If it is permanent then of course can say that, too. If you look around the web you will see and find some creative solutions for error pages. That's all up to you and outside my jurisdiction.</p><img src="http://feeds.feedburner.com/~r/AWD-KnowledgeBase/~4/CPyfqIQfYfw" height="1" width="1"/>]]></content:encoded>
    </item>
    <item>
      <title>Empower Network SEO Genius?</title>
      <description><![CDATA[This article is about the Empower Network but NOT a question or even remotely an answer if their business model is a scam or a fraud. It is a quick wrap up about the SEO tactics and it is quite interesting if not genius. See what is special about their online marketing strategy and why their SEO is almost genius.]]></description>
      <pubDate>Sat, 23 Jun 2012 10:05:05 -0500</pubDate>
      <link>http://www.adrianworlddesign.com/Knowledge-Base/seo/Watch-out-for/Empower-Network-SEO-Genius</link>
      <guid>http://www.adrianworlddesign.com/Knowledge-Base/seo/Watch-out-for/Empower-Network-SEO-Genius</guid>
      <content:encoded><![CDATA[<p class="inpage_disclaimer"><span class="disclaimer_title">Disclaimer:</span> Although this article is about the Empower Network, it is NOT a question or even remotely an attempt to answer if their business model is a scam or a fraud. Simply because I don't care and have the time to study their business model! I mention their name solely so you are able to do your own research. It is quite amazing what they did in terms of online marketing and SEO. If you want to know more about their business google it and be surprised. That's what this article is about!</p>
<p>Before we take a closer look at their SEO tactics let me ask you this question:</p>
<ul class="list_elements" style="list-style-type: none;">
<li><em>"How do you counteract negative or bad publicity about your business in the World Wide Web?"</em></li>
</ul>
<h3>Scam or fraud business</h3>
<p>Again this is not about this company<span class="complementary_text"> and a question if Empower Network is scam or fraud</span>, just as simple question. Lets assume you want to start a business which might be conceived by some people as a scam or fraudulent business. What will happen in today's world in the Internet?</p>
<p>Within in a short period of time some webpages will pop up reviewing your business and red flag it as a scam or fraudulent business. We have seen in other cases that some people even devote a whole website to such a business or thing.</p>
<p>When people begin to search in Google, Bing, Yahoo or whatever search engine they may find these articles on the first page; right next to your company website. Not very pleasing, isn't it? If they add the word <em>review</em>, <em>fraud</em> or <em>scam</em> next to your name it gets even worse because your company's website does not have these words anywhere, ergo your company's website will be virtually blacked out from the search results.</p>
<p><em>So, what do you do to counteract?</em></p>
<h3>Write positive reviews</h3>
<p>Lets assume there are about 100 negative reviews published. How do you balance the search results? Can we even make them disappear?</p>
<h4>A company statement</h4>
<p>First you should add such words to your website to even get listed at all. You might want to start with a statement on your company website about this by using these words. Great, that will be 1 positive webpage against 100 negative webpages. If you are lucky this statement ranks on the first page but people, most likely, will not even consider and respect this article.</p>
<h4>Have people write statements</h4>
<p>You might find some websites, blogs where people are willing to write positive reviews about your places but againg they have to include these words. You can ask your clients to write something positive about your business on their blog and tell them to specifically write against the scam and fraud allegations, i.e. using these words. Don't forget to tell them to post that on Facebook, LinkedIn and send tweets with Twitter. Digg it, delicious it, do lots of all that.</p>
<p>If you are really busy asking around and people are writing positive reviews you could end up with 100 positive reviews weighing against some 100 negative reviews.</p>
<p>In theory we find now 200 articles in our search result which more or less ping-pong from positive to negative. Even if you have 200 against 100 there will still be some back and forth going on with the reviews.</p>
<p>Now here comes the genius part with the Empower Network and their SEO and online marketing strategy.</p>
<h3>Search Engine Dominance (SED)</h3>
<p>Lets say an even count is not good enough for us! Can we even outweigh the negative search result? Make them&#8212;poof&#8212;disappear?</p>
<p>I think we can and we need a new term here: <em>Search Engine Dominance</em> or SED for short. That's what I think is the real genius with the people behind the Empower Network. Online marketing at its best.</p>
<p>As I said in the disclaimer I don't care about their business and I don't make any judgement or allegations about their business. I was just entering their company name into Google and could not really believe what I saw. It is almost genius what they are doing.</p>
<h4>Blog as blog can</h4>
<p>You can go page after page in Google and find almost exclusively blog after blog all somehow independent yet still related to their business. There are probably hundreds if not already thousands of blogs out there and all are linked to their business.</p>
<p>All these blogs have information about fraud and scam very dominantly in the title, description and lead but within the article immediately change to basically selling the business. If you look randomly at some of the blogs and other articles in them it is all about their business.</p>
<p>With their business model they give each client a blog which is probably preloaded with <em>positive articles about their business</em>. Note, I don't even question if some of these blogs have real people behind them, i.e. if these are real clients but just think about it. <strong>Give all your clients a blog.</strong> You don't even have to ask if they have a blog and if they would like to write a positive review&#8212;it's already there. Google it and it is there. Buying a silly domainname and setup a blog is rather cheap nowadays.</p>
<p>Now this is genius and Search Engine Dominance that will outweigh every negative article for a long, long time. If you start a business give all your clients a blog which is preloaded with some positive review about business.</p>
<h4>Is Empower Network a scam, fraud?</h4>
<p>Again, I don't care about MLM business. I just think what they did in terms of SEO and online marketing is almost genius. They created such a dominance in search engine that this article and virtually every other article about their business will not make it into the top 10 pages in Google, Bing, Yahoo or any other search engine on the web.</p>
<p>Why do I even write this? Nobody will ever find it.</p><img src="http://feeds.feedburner.com/~r/AWD-KnowledgeBase/~4/0hn-0Q4B89g" height="1" width="1"/>]]></content:encoded>
    </item>
    <item>
      <title>Pixels per inch do not matter</title>
      <description><![CDATA[Do pixels per inch really matter if you want to design or develop for mobile devices like smartphones. I say no and this page will tell you way. Forget about those stupid pixels and ponder about what really matters. Pixels per inch (ppi) don't matter.]]></description>
      <pubDate>Wed, 30 May 2012 10:09:56 -0500</pubDate>
      <link>http://www.adrianworlddesign.com/Knowledge-Base/MobileDevices/Fundamentals/Pixels-per-inch-do-not-matter</link>
      <guid>http://www.adrianworlddesign.com/Knowledge-Base/MobileDevices/Fundamentals/Pixels-per-inch-do-not-matter</guid>
      <content:encoded><![CDATA[<p>Developing for <strong>mobile devices</strong>, like <em>iPhone</em>, <em>Android</em> or <em>Blackberry</em> <strong>smartphones</strong>? Wondering how do you squeeze a webpage into this darn little screen? The first time I searched for information surprisingly a lot of information was about pixels and <strong>pixels per inch</strong>, aka <abbr title="pixels per inch">ppi</abbr>.</p>
<p>While most information is true and makes sense for the visual experience (the key term here is <strong>density</strong>) I didn't really buy that we have to know and worry about about <em>ppi in terms of web design</em>.</p>
<p>I've come to the conclusion it doesn't matter. Curious? Then read on why not!</p>
<h3>Never did, never will, never could</h3>
<p>As web designers or web developers we don't have to worry about pixels and inches because: <em>we never did, never will and never could to begin with</em>. I already wrote a <a title="Links to my thoughts about pixels per inch and why we don't care" href="http://www.adrianworlddesign.com/Knowledge-Base/Web-Standards/Various-Standards/The-magic-number-72" target="_self">long article with my general thoughts</a> about ppi.</p>
<p>When you designed or developed a webpage before the dawn of smartphones you never wasted a thought about how many pixels per inch the user will see. So, why in the world should we have to worry about ppi now?</p>
<p>What you maybe&#8212;just maybe&#8212;want to know is what kind of screen resolution the user has. You get these numbers from the statistics in Google Analytics or other counters. Now I have an interesting question: Do you really care about it and does it tell us how a user sees our page? Probably no and definitely no!</p>
<p>The stats tells us that a lot of users still have screens with 1280 in width and a small but still significant number has a 1024 screen. Plus a handful with 800x600&#8212;shoot them!</p>
<p>Down the list you suddenly see that we have visitors with a lot of weird numbers; all below 1000 pixels in either direction. Those are most likely your mobile visitors but hold your breath for another minute.</p>
<p>If I would visit one of your sites you would see 1920x1080. You would not see and know though, that I have dual monitors (so actually 3640x1080) with my desktop or if I surf and watch from my living room with my HDTV. You also don't know (and care) if the browser is maximized or how large it is floating around.</p>
<p>The screen resolution alone does not tell us how the users sees the page.</p>
<p>Another example I used in my other article. I bring you the giant screen in the Dallas Cowboys Stadium&#8212;apparently 2423 x 1088 pixels. That's the number you will probably see in your stats. Do you want to know the number of pixels per inch? Actually inches per pixels would be more appropriate but the answer is no.</p>
<p>So, do we need to know the pixels per inch for a mobile device? NO!</p>
<h3>What do we need</h3>
<p>I hope you are convinced now but I understand that you still have some doubts or questions about pixels and mobile devices. You are right this is not the end and we could care about something in terms of pixels.</p>
<p>We could have some thoughts about what our eyes are doing.</p>
<p>When Apple started with their Macs a long long time ago they have spend some thoughts about how to show things on their first monitors. They have been very interested in a "What you see is what you get" (WYSIWYG) feeling from their screen to print output. That's why they became so popular with the printing and graphic people. They basically thought about duplicating paper and came up with the 72ppi which for many today is a conundrum.</p>
<p>If anything, these 72 pixels per inch are a very pleasing density of pixels for humans sitting in front of a desktop monitor screen. On a TV screen this number can be smaller because we don't sit that close and looking at the ever bigger screens in our sport stadiums it may be even a fraction of an inch. Looking to the other side of the spectrum and our tiny smartphone the density has to be higher.</p>
<h3>Please, please me</h3>
<p>So we could ask: "What is the pleasing pixel number for a mobile device?" If we look at an iPod or iPhone then Apple set the trend with 320x480 pixels. Now do we need to worry about this number? I don't think so because Apple with the retina display already doubled the dimensions.</p>
<p>What we have to learn and understand by this is that we don't have to worry about pixel dimensions at all. Especially not the physical pixels of a display.</p>
<p>There is a logical pixel unit and the hidden secret is that the browser will take care of this thing. Plus HTML and CSS have a few secrets of their own. One secret is named <strong>viewport</strong>. For testing and illustration how some of the viewport settings influence a mobile webpage I have created <a title="Testpages to illustrate viewport settings." href="http://www.adrianworlddesign.com/Viewport-Demo" target="_blank">some special webpages</a>. Don't look at those pages from a desktop, though. They must be viewed from a mobile device! I also have an <a title="Link to an article about the viewport" href="http://www.adrianworlddesign.com/Knowledge-Base/MobileDevices/Fundamentals/Understanding-the-Viewport" target="_self">article dedicated to the viewport</a> that will discuss some of the things we need to know about it.</p>
<h3>Still puzzled</h3>
<p>If you are puzzled now about what is going on with this logical pixels and what we need to know about them, here it is: We don't care about pixels for mobile devices. It will only drive you mad.</p>
<p>If you have some images or graphics you have to watch out for these logical pixels, though. However, in terms of design you should free your mind from all pixels and don't care about them. Instead <a title="Link to an article about the viewport" href="http://www.adrianworlddesign.com/Knowledge-Base/MobileDevices/Fundamentals/Understanding-the-Viewport" target="_self">learn more about the viewport</a>.</p><img src="http://feeds.feedburner.com/~r/AWD-KnowledgeBase/~4/9ABGa2JWmvo" height="1" width="1"/>]]></content:encoded>
    </item>
    <item>
      <title>File and Folder Links</title>
      <description><![CDATA[If you need a file or folder more than once in different places you don't have to copy and paste them everywhere. In a web server environment a very common task and of course you have tools (commands) to set links to a single file or folder from many places. No need to copy file and worry about content being out of sync.]]></description>
      <pubDate>Sat, 28 Apr 2012 11:48:03 -0500</pubDate>
      <link>http://www.adrianworlddesign.com/Knowledge-Base/Web-Hosting/Tips-and-Tricks/File-and-Folder-Links</link>
      <guid>http://www.adrianworlddesign.com/Knowledge-Base/Web-Hosting/Tips-and-Tricks/File-and-Folder-Links</guid>
      <content:encoded><![CDATA[<p>If you work with a server you usually do some things differently; like with your desktop or laptop computer. It is a little bit of this, lets say, misconception what you can do with a Windows computer versus a Linux computer, or a Mac (lets not forget about them).</p>
<h3>History Lesson</h3>
<p>Some words about operating systems (OS) first. Windows was developed and invented for the personal computer (PC) as an extension to DOS. I know it was a long time ago but still, Windows OS programs have been and still are created with "personal" users in mind. This is also true for Apple's Mac and it was the first to have a visual experience for users. That's why they attracted the graphic geeks and are popular in that industry.</p>
<p>Linux on the other hand has different roots, the UNIX servers. That's right, attracting the server geeks. Linux server admins (and users) learn the following from the get-go. For Windows users the concept alone can be startling, even for server admins. Don't know about Apple users, you are left behind here, sorry!</p>
<h3>Where is your file or folder</h3>
<p>Windows trained users always look for files in terms or relation of drives and directories (aka folders). This is some leftover from the days of DOS.</p>
<p>Physically, on a hard disk there is not such thing, though. Well, there are partitions but that is another story. There is primarily a thing called a master file table (MFT) pointing to locations on the hard disk. It is like the table of contents (TOC) or better yet the index at the end of a book pointing to page numbers. Therefore it should be no problem to have more than one instance pointing at one file.</p>
<p>Albeit, it took quite a while for Microsoft to adjust the file table in Windows. The words you might want to google for are FAT and NTFS. However, it was still a missing piece until Windows 2000 with the updated version known as NTFS5 and with it the reparse points. Still, they have not included options in any of the GUI tools; they offered command line tools to work with reparse points! I am still clueless why Microsoft did not bother to include this tools into their operating systems from the beginning, not even with the server versions. You had to get (i.e. buy) the so called Resource Kit. Good news: There should be a tool included now, since Vista.</p>
<h3>Get the lingo</h3>
<p>Great, now we know you can set pointers from many places to a single file or folder. What is next?</p>
<p>Before I continue and tell you what you need and how you do it we have to talk about words, the lingo for these file and directory pointers in Windows.</p>
<p>From the top of my head I know of about five words floating around: shortcuts, link, junction, hard link and symbolic link.</p>
<h4>Shortcuts</h4>
<p>Shortcuts are well known but don't work from a programming point of view and that is not what you need on a web server. They do not work from PHP and with it Zend Framework, WordPress, Joomla, Drupal you name it.</p>
<p>Shortcuts are more like regular files, stored in the file table, with the .lnk extension. Windows Explorer is basically the only program who can make sense out of them. Note that the "File open ..." menu item you find in programs is hooked up into Windows Explorer; they do not query the file table directly!</p>
<h4>(simply) Link</h4>
<p>I mention the term "links" here because there are some sort of links available. First off, link is just a way to general term. Second most of these links are usually nothing more than hyperlinks similar to links in a web page. These are sometimes HTML or Java based programs. They are not in any way or sense related with the MFT of the OS.</p>
<h4>Junction</h4>
<p>Now it gets interesting. The junction is probably the first known existence of anything that resembles a link to something from more than one point in the file table. Junctions are also known as (because implemented through) reparse points I mentioned earlier with NTFS5. Junctions are limited to local directories! The Resource Kit packages since Windows 2000 have a command line program called <strong>linkd</strong> to set and read junctions.</p>
<p>There is also a <a title="Links to Microsoft Technet about junction" href="http://technet.microsoft.com/en-us/sysinternals/bb896768" target="_blank">program called junction</a>, originally developed by Sysinternals and Mark Russinovich&#8212;Sysinternals is now part of Microsoft Technet.</p>
<h4>Hard Link</h4>
<p>Because the junction is limited to directories we need something else for a regular file and that would be the hard link. <a title="Links to Microsoft Technet about fsutil" href="http://technet.microsoft.com/en-us/library/cc753059%28WS.10%29.aspx" target="_blank">Windows propagated <strong>fsutil</strong></a> as the program for managing hard links. It is actually capable of doing more than just that, including reparse point (used for junctions) and wreck your system if you are not careful.</p>
<p>Here is <a title="Links to MSDN for Hard Links and Junctions" href="http://msdn.microsoft.com/en-us/library/aa364215%28v=VS.85%29.aspx" target="_blank">some information at MSDN</a> about hard links and junctions from a software programming point of view.</p>
<h4>Symbolic Link</h4>
<p>Today with the latest versions of Windows we have (only) symbolic links. And check this out, we can do everything with Symbolic Links&#8212;and some more. And it gets even better! The command line program <strong>mklink</strong> ships with your choice of Windows since Vista (I hope). Still no GUI, though, at least it has not raised its head for me!</p>
<p>Here is <a title="Links to MSDN for Symbolic Links" href="http://msdn.microsoft.com/en-us/library/aa365680%28v=VS.85%29.aspx" target="_blank">some information at MSDN</a> about symbolic links, again from a strictly programming point of view.</p>
<p>If you develop and work with Vista or higher you should be good to go. If it is XP (like I do) or less you have to revert to the tools mentioned earlier.</p>
<h3>How to create these links</h3>
<p>Finally, you say! Well, most things have been said already; these are command line programs and if you call them with /? you will get the help menu. That should do it, but wait ...</p>
<h4>What was the question again?</h4>
<p>Lets take a little example and where you can use these links. I don't know how or why you came to this page; maybe you wonder what the problem or question is. What are these links good for and why should I bother? So, here is why.</p>
<p>When you have more than one web application or environment running on your test/development server or with your hosting provider you may have a situation like the following. You have some standard, default JavaScript and since they must be available within the application's public directory you copy single files or a whole directory. You don't have to, use symbolic links instead; or hard links and junctions.</p>
<p>Here is the key point. If you update the file it is instantly available wherever you have your link. First you don't have to access the main file in the repository and second the content is always in sync with all your applications. This first point might be a little bit scary to some people and why Microsoft is so petrified in propagating this feature. So my advice: Be careful and know what you are doing!</p>
<h4>With hosting providers</h4>
<p>One important message first: You cannot manage symbolic links with FTP!</p>
<p>If you have a hosting provider and a hosting plan with Windows Server you depend on your provider and if they have an option in their interface which is normally named something like "File Manager". Unless you have some hosting plan with a dedicated server where you have Terminal Server access. If you have a hosting plan with Linux Server and don't know much about Linux you have to look in the File Manager, too. Linux servers have a thing called telnet (secure shell) but some providers don't allow telnet and this is not about Linux. Honestly, I don't work much with Linux and don't talk about stuff I don't know much, that's why.</p>
<p>In the File Manager look out for the copy, rename, delete and whatnot options. If you are lucky, one of that options might be labeled symlink. That would be your option to create a symbolic link for the selected file or directory. If you don't see anything contact their support but chances are your provider does not support it. I know of a couple providers who for some reason have Linux hosting exclusively but don't have symbolic links in their file manager and don't grant telnet access either. It is mind-boggling!</p>
<h4>Your Windows Server</h4>
<p>First off and like if have mentioned, all programs are command line tools and therefore require command line access. There are some tools with a GUI out in the wild (see bottom for more) but this is about official tools provided and supported by Microsoft. If you don't have command line access, for whatever reason, you are out of luck.</p>
<h5>mklink</h5>
<p>In your command window type mklink first and if you get the help you are good to go. The help should pretty much tell you all you need.</p>
<p>The symbolic link options ([empty]=default and [/d]) allow you to actually go beyond the current drive and even system, i.e. with the symbolic option you can link to a file or directory on another drive and even the network. You cannot do that with hard links and junctions&#8212;in general and with the options [/h] and [/j]!</p>
<p>If nasuser1movies is your network share with some movies and you like to have a symbolic link named "videos" in the current directory you can do this:</p>
<dl class="code_example"><dt class="code_description">:: Create a directory symbolic link</dt><dd>mklink /d videos nasuser1movies</dd><dt class="code_description">:: Delete the directory symbolic link</dt><dd>rmdir videos</dd><dt class="code_description">:: Create a file symbolic link</dt><dd>mklink video1.avi nasuser1moviesshow.avi</dd><dt class="code_description">:: Delete a file symbolic link</dt><dd>del video1.avi</dd></dl>
<p>Does this mean I recommend symlinks to a share on a web server? No, it does not, I am just making a point here. You can symlink to a network share from your personal computer but I would be very cautious symlinking to a network share. Ask yourself this question: Does my web application crash if the source is not available? Make sure you have file_exist, try/catch or something in place!</p>
<h5>linkd and fsutil</h5>
<p>If you did not get the help with mklink you probably have an older system like Windows XP and you have to find a download for the Resource Kit. I resist to give a link because in the past Microsoft moved the location so frequently it was not funny. I don't know if they still do that but I am clearly a burned child here. Once you have linkd or fsutil drop them in your system root directory or wherever, just remember where you put them and how to call one.</p>
<p>If  d:repositoryjavascripts is your repository with some of your default JavaScript you can do this:</p>
<dl class="code_example"><dt class="code_description">:: Create the junction</dt> <dd>linkd d:wwwserver1publicjscripts d:repositoryjavascripts</dd><dt class="code_description">:: Delete the junction</dt> <dd>linkd d:wwwserver1publicjscripts /d</dd><dt class="code_description">:: Create the hardlink</dt><dd>fsutil hardlink create d:wwwserver1publicnewscripts.js d:repositoryjavascriptsexistingscript.js</dd><dt class="code_description">:: Delete the hardlink</dt><dd>del d:wwwserver1publicnewscripts.js</dd></dl>
<p>Well, that's about it. Happy linking and again be careful, know what you're doing!</p>
<h3>Additonal GUI tools</h3>
<p>If you know about a GUI tool or other options let me know; I'll add it to the list below. Please use them at your own discretion and again, know what you're doing.</p>
<p><a title="Link Shell Extension" href="http://schinagl.priv.at/nt/hardlinkshellext/hardlinkshellext.html" target="_blank">Link Shell Extension</a> or same via <a title="Link Shell Extension on CNet" href="http://download.cnet.com/Link-Shell-Extension/3000-2248_4-10971924.html" target="_blank">CNet</a> Thanks to Tristram (Freelance Designer UK)</p><img src="http://feeds.feedburner.com/~r/AWD-KnowledgeBase/~4/Y-K3wUe4IFs" height="1" width="1"/>]]></content:encoded>
    </item>
    <item>
      <title>Verify Zend Guard installation</title>
      <description><![CDATA[This document has information for how to detect or test if Zend Guard Loader is installed and running on your system. It may even tell you if some problems exists. Verifying the Zend Guard installation, i.e. if Zend Guard Loader (module ZendGuardLoader.so) is running or not, is made easy this way.]]></description>
      <pubDate>Fri, 27 Apr 2012 08:05:01 -0500</pubDate>
      <link>http://www.adrianworlddesign.com/Knowledge-Base/Web-Hosting/Zend-Guard/Verify-Zend-Guard-installation</link>
      <guid>http://www.adrianworlddesign.com/Knowledge-Base/Web-Hosting/Zend-Guard/Verify-Zend-Guard-installation</guid>
      <content:encoded><![CDATA[<p>This page is tells you how to test or detect if the <em>Zend Guard Loader is installed and running</em>. We usually need this to sort out things before we go into deeper territory and fix some problems with a <em>Zend Guard installation</em>. Note that you can also test and detect Zend Optimizer this way.</p>
<p>Besides this webpage I have more pages about <strong>Zend Guard</strong> and if you have any problems please look out for them in this chapter; use the breadcrumbs list above or the Prev/Next links at the end of the document.</p>
<h3>Check configuration</h3>
<p>So, <em>how do you check if the ZendGuardLoader.so module is loaded</em> properly and maybe even get some additional information what the problem might be?</p>
<p>One simple test to see if the module is even touched or was attempted to load is on the console with the php <abbr title="Command Line Interface">CLI</abbr> and as demonstrated in the following.</p>
<p>Note that the example is on Linux and for Windows you might go into the php directory to run it from the command line; it all depends on your setup, i.e. the path environment. The command and result should be the same, though.</p>
<dl class="code_example"> <dt class="code_description">First, this is how it should look like</dt> <dd>[root@centos ~]# <strong>php -v</strong></dd> <dd>PHP 5.3.3 (cli) (built: Jan 11 2012 19:53:01)</dd> <dd>Copyright (c) 1997-2010 The PHP Group</dd> <dd>Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies</dd> <dd> with Zend Guard Loader v3.3, Copyright (c) 1998-2010, by Zend Technologies</dd> <dt class="code_description">This is how it looks if your loader has not been touched, i.e. your configuration is not aware that you want to load</dt> <dd>[root@centos ~]# <strong>php -v</strong></dd> <dd>PHP 5.3.3 (cli) (built: Jan 11 2012 19:53:01)</dd> <dd>Copyright (c) 1997-2010 The PHP Group</dd> <dd>Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies</dd> </dl>
<p>If you don't see any information what-so-ever about the Loader in this response message then your configuration for the ZendGuardLoader.so is not properly set in the php.ini or any other php configuration file.</p>
<p>To fix this problem you have to make sure that you are working in the actually php.ini file and not some other copy of the file. Either use <a title="phpinfo function reference at php.net" href="http://php.net/manual/en/function.phpinfo.php" target="_blank">phpinfo() </a>or while you have your console use the following commands to learn about the path for the php.ini file(s).</p>
<dl class="code_example"> <dt class="code_description">// for Linux users</dt> <dd>[root@centos ~]# <strong>php -i |grep -i 'php.ini'</strong></dd> <dd>Configuration File (php.ini) Path =&#62; /etc  <span class="code_description">// the default path</span></dd> <dd>Loaded Configuration File =&#62; /etc/php.ini  <span class="code_description">// the actual location</span></dd> <dt class="code_description">// for Windows users</dt> <dd>&#62; <strong>php -i | find /i "php.ini"</strong></dd> <dd>Configuration File (php.ini) Path =&#62; C:WINDOWS  <span class="code_description">// the default path</span></dd> <dd>Loaded Configuration File =&#62; E:/xampp/php/php.ini  <span class="code_description">// the actual location</span></dd> </dl>
<p>An important note here: The configuration can also be added to additional .ini files. Use grep (find) again but look out for this string: 'additional'; it will tell you if additional files are used and which.</p>
<p>And that's all she wrote. Look out for the other <a title="Zend Guard documents overview" href="http://www.adrianworlddesign.com/Knowledge-Base/Web-Hosting/Zend-Guard">Zend Guard documents</a> if this does not solve your problem.</p><img src="http://feeds.feedburner.com/~r/AWD-KnowledgeBase/~4/nFxUaQ-qc9w" height="1" width="1"/>]]></content:encoded>
    </item>
    <item>
      <title>Set property meta tag</title>
      <description><![CDATA[When you use a Facebook Like (share) button you'll need Open Graph protocol meta tags to dynamically set the title, description and image. For setProperty() in Zend Framework you may see error "Invalid value passed to set; please use setMeta()" and there is an easy solution for it.]]></description>
      <pubDate>Mon, 23 Apr 2012 09:23:56 -0500</pubDate>
      <link>http://www.adrianworlddesign.com/Knowledge-Base/Zend-Framework/Helpful-Tips/Set-property-meta-tag</link>
      <guid>http://www.adrianworlddesign.com/Knowledge-Base/Zend-Framework/Helpful-Tips/Set-property-meta-tag</guid>
      <content:encoded><![CDATA[<p>When you use the <strong>Open Graph protocol</strong>&#160;[<a title="Open Graph protocol website" href="http://ogp.me/" target="_blank">og</a>] you need <strong>meta tags</strong> in your HTML document's head. If you want to use a <strong>Facebook</strong> Like (share) button you will have to use Open Graph in your document.</p>
<h3>ZF view helper headMeta</h3>
<p>In <strong>Zend Framework</strong> you can use the <em>headMeta view helper and setProperty()</em> to add the name and content value. Most likely you will see error "<em>Invalid value passed to set; please use setMeta()</em>".</p>
<p>You may wonder why because that will not work, i.e. the message to use setMeta is wrong. There is a simple reason for this and an easy solution.</p>
<h3>DocType RDFa</h3>
<p>The simple reason is that Open Graph is part of or relies on another protocol by the short name <abbr title="Resource Description Framework - attributes">RDFa</abbr>. From <a title="W3C RDFa specification" href="http://www.w3.org/TR/rdfa-in-html/" target="_blank">W3C RDFa specification</a> we have the follow short introduction:</p>
<blockquote>RDFa is intended to solve the problem of marking up machine-readable data in HTML documents. RDFa provides a set of HTML attributes to augment visual data with machine-readable hints. Using RDFa, authors may turn their existing human-visible text and links into machine-readable data without repeating content.</blockquote>
<p>RDFa stand for Resource Description Framework-attributes by the way. For more information about RDF see <a title="RDF on Wikipedia" href="http://en.wikipedia.org/wiki/Resource_Description_Framework" target="_blank">Wikipedia</a>.</p>
<h4>Set new doctype</h4>
<p>Unfortunately the metaHead view helper uses an&#160;<span style="font-family: monospace;">_isValid()</span>&#160;method that checks the doctype set for your view. If it is not RDFa the method simply returns false and triggers the rather meaningless error message telling you "please use setMeta()" which is not the correct solution for the error.</p>
<p>So, the easily solution is to add a new doctype with the Zend Framework before you use <span style="font-family: monospace;">setProperty()</span>.</p>
<dl class="code_example"> <dd>$this-&#62;view-&#62;doctype('XHTML1_RDFA');  <span class="code_description">// controller</span></dd> <dd>$this-&#62;doctype('XHTML1_RDFA');  <span class="code_description">// view</span></dd></dl>
<p>Now you should be able to add all the propery values.</p><img src="http://feeds.feedburner.com/~r/AWD-KnowledgeBase/~4/U7yWKFDGlBs" height="1" width="1"/>]]></content:encoded>
    </item>
    <item>
      <title>Referrer data</title>
      <description><![CDATA[Are you missing the query data (the search words) in Google's referrer links? Google announce that they will make search more secure. This includes stripping some information from the HTTP_REFERER link you could check for the query string. This document has some information about this announcement.]]></description>
      <pubDate>Mon, 16 Apr 2012 10:04:03 -0500</pubDate>
      <link>http://www.adrianworlddesign.com/Knowledge-Base/seo/Google/Referrer-data</link>
      <guid>http://www.adrianworlddesign.com/Knowledge-Base/seo/Google/Referrer-data</guid>
      <content:encoded><![CDATA[<p>Are you missing the <strong>query data</strong> (the <strong>searched words</strong>) in <strong>Google's referrer links</strong>?</p>
<p>There used to be a time when the HTTP_REFERER string contained the information what a user was <em>"googling"</em> for. Looking at the traffic I can see that this is gone in many requests.</p>
<h3>The announcement</h3>
<p>The <a title="Google Official Blog: Making search more secure" href="http://googleblog.blogspot.com/2011/10/making-search-more-secure.html" target="_blank">announcement</a> came in October 2011 and the impact on the query string was not quite obvious in this brief statement.</p>
<p>There will be even more <a title="Google Webmaster Blog: Upcoming changes in Google's HTTP Referrer" href="http://googlewebmastercentral.blogspot.com/2012/03/upcoming-changes-in-googles-http.html" target="_blank">Upcoming changes in Google's HTTP Referrer</a> (March 2012) and introduces the proposed <strong>meta referrer tag (<a title="Meta referrer wiki" href="http://wiki.whatwg.org/wiki/Meta_referrer" target="_blank">WHATWG wiki link</a>) </strong> on their search website.</p>
<p>The change as it stands right now happens only when somebody searches over SSL, i.e. if a user uses <span style="font-family: monospace;">https://www.google.com</span> for searching. In all these cases the URL will be altered in the submitted HTTP referrer string.</p>
<p>Although you can still see that the traffic came via a Google search you can say Bye-bye to search terms in the link.</p>
<h3>Google Analytics</h3>
<p>This also causes some changes in the statistics you have with Google Analytics. Because it works only on the client it can only inspect the referrer and not the Google website itself.</p>
<p>As much as you are missing now the keywords in your logs you will be missing them in Google Analytics.</p>
<h3>Webmaster Tools</h3>
<p>There is little hope with the Webmaster Tools but quite frankly it was never really that informative since it only shows some top keyword strings and not a complete list of everything.</p>
<p>Overall I am afraid we have to get used to it and we will see probably even more restrictions. I wouldn't be too surprised if this will be extended to any type of search at some point in the future.</p><img src="http://feeds.feedburner.com/~r/AWD-KnowledgeBase/~4/ZkOVmNF7VQE" height="1" width="1"/>]]></content:encoded>
    </item>
    <item>
      <title>What media type for smartphones</title>
      <description><![CDATA[There was this question: "What media type for smartphones." It might be simple but there are a few hiccups with this question and how to answer it. This document will shed some light on what a media type is and where a iPhone or Android phone fit in. Is it a handheld or screen?]]></description>
      <pubDate>Sun, 15 Apr 2012 18:46:46 -0500</pubDate>
      <link>http://www.adrianworlddesign.com/Knowledge-Base/MobileDevices/Occasionally-asked-questions-OAQ/What-media-type-for-smartphones</link>
      <guid>http://www.adrianworlddesign.com/Knowledge-Base/MobileDevices/Occasionally-asked-questions-OAQ/What-media-type-for-smartphones</guid>
      <content:encoded><![CDATA[<p>A pretty legitimate question which is not easy to answer, i.e. in one word or a short sentence. It will require even more than one paragraph.</p>
<h3>What is a media type</h3>
<p>To answer this question we have to understand what kind of devices or better yet applications work with HTML documents.</p>
<h4>What is a user agent</h4>
<p>Every application (not device)&#8212;or <strong>media</strong>&#8212;which is capable of rendering a web page (an HTML document) is a <strong>user-agent</strong>.</p>
<p>Got it? No? Lets read this sentence once more but backwards kinda. <em>A user agent is capable of rendering a web page.</em> In other words, the piece of software that understands HTML and interprets the document is called a user-agent.</p>
<p>The user-agent and piece of software we are most familiar with is the web  browser. However there are other applications that work with HTML  document. Just think about a document for people who are blind which  basically reads the document to a person.</p>
<h4>Different user-agent characteristics</h4>
<p>The various user-agents can be grouped according to some common characteristics into a <strong>media group</strong>.</p>
<p>Now back to our media type. Although a <strong>media type</strong> seems to define a device it actually defines the characteristics for CSS, cascading style sheets. However, a <em>media type</em> has a relationship with <em>media groups</em> which in return links a certain user-agent to a media type.</p>
<h4>List of media groups and types</h4>
<p>The media types are specified by W3C and are part of the <a title="Link to w3c.org and the CSS2 specification" href="http://www.w3.org/TR/CSS2/media.html" target="_blank">CSS2 specification</a>. The specification has the list with all the available media types.</p>
<h3>Who defines the media type?</h3>
<p>Good question. There is no clear definition which means the producer of a user-agents is free to decide in which media group the device fits. From there a media type can be selected and assigned.</p>
<h4>Media Type: screen</h4>
<p>Many will assume that a desktop monitor is a user agent and screen is the media type for the monitor&#8212;which is false. You may also assume that when we print a page the printer is the user-agent and the media type is print. False again! It is the browser in either case! As stated earlier a user agent must be able to render a HTML document. A monitor knows nothing about HTML and so does the printer. Only the browser knows how to render a HTML document.</p>
<p>The browser is the user-agent and fits into the <em>continuous</em> and <em>page</em> media groups. A web browser in your desktop computer and for viewing handles <em>continuous</em> media and should identify itself as media type <em>screen</em>. If a user decides to print the web page the browser handles a <em>page</em> media. The browser now fits into the <em>page</em> media group and identifies itself as media type <em>print</em>.</p>
<h3>What about handheld</h3>
<p>So, what about the iPhone or Android phone, our smartphone devices we hold in our hands?</p>
<p>Looking at all the media types we see a type named <em>handheld</em>. Is a smartphone a handheld device? I would say so, yes. However, looking at the definition above it is not the physical device who defines the media type, it is the user-agent. With our new smartphones the user-agent would be a browser.</p>
<p>Beginning with the iPhone and the Safari browser up to Android phones with Firefox, Opera and whatever is available, they all have decided to identify themselves as media type <em>screen</em>.</p><img src="http://feeds.feedburner.com/~r/AWD-KnowledgeBase/~4/GjXqYV1y-ug" height="1" width="1"/>]]></content:encoded>
    </item>
    <item>
      <title>Offset elements</title>
      <description><![CDATA[You can easily hide an element from view with an offset. Why you should set it to left and not the top has been seen lately by Facebook's like button. Because they set an line style of top -2000px the element suddenly appears when the Like button is below that range.]]></description>
      <pubDate>Thu, 12 Apr 2012 13:51:37 -0500</pubDate>
      <link>http://www.adrianworlddesign.com/Knowledge-Base/Web-Standards/Cascading-Style-Sheets/Offset-elements</link>
      <guid>http://www.adrianworlddesign.com/Knowledge-Base/Web-Standards/Cascading-Style-Sheets/Offset-elements</guid>
      <content:encoded><![CDATA[<p>I've just discovered a little style problem with the Facebook Like button. Somewhere within all the elements is a div that holds the iFrame element. This div element has an inline style <span style="font-family: monospace;">"top: -2000px"</span>.</p>
<p>This is clearly not good, i.e. how you should hide an element with an offset!</p>
<h3>Offset elements</h3>
<p>You can easily hide an element from view with offset. Lets see what they did in Facebook</p>
<p class="code_example">&#60;div style="position: absolute; top: -2000px; "&#62;<br />...<br />&#60;/div&#62;</p>
<p>The <strong>position</strong> attribute takes the element out of the current flow. The negative value from the <strong>top</strong> attribute positions the element 2000px above its current place; which is relative to the parent usually defined with a <span style="font-family: monospace;">"position: relative"</span> style.</p>
<h4>Left versus top</h4>
<p>Now here's why this is not a good thing.</p>
<p>If such a element on your page is somewhere below the 2000px range the element suddenly becomes visible again in your webpage.</p>
<p>On some pages on this website I have decided to place the Facebook Like button at the end of the document which some times is longer than 2000px. I don't know when this started because this is created via their JavaScript and therefore it is more or less outside my influence. The only option: I have to move the Like button above the document.</p>
<p>A better solution is to move an element to the left. There is usually no way you can scroll ever to the left. With a style like "left: -2000px" an element will be always out of site.</p><img src="http://feeds.feedburner.com/~r/AWD-KnowledgeBase/~4/CVLertEM6Dk" height="1" width="1"/>]]></content:encoded>
    </item>
    <item>
      <title>Character sets for man pages</title>
      <description><![CDATA[In Linux man pages you might see weird, strange characters mainly garbled single quotes (apostrophe). This document shows the origin for this problem and how to fix it.]]></description>
      <pubDate>Thu, 12 Apr 2012 08:26:28 -0500</pubDate>
      <link>http://www.adrianworlddesign.com/Knowledge-Base/Linux/Helpful-tips/Character-sets-for-man-pages</link>
      <guid>http://www.adrianworlddesign.com/Knowledge-Base/Linux/Helpful-tips/Character-sets-for-man-pages</guid>
      <content:encoded><![CDATA[<p>If you read a manual in Linux, known as <strong>man pages</strong>, you might see some<em> weird, strange characters</em>. You are even able to identify some of this garbled text as an <strong>apostrophe</strong> (single quote character).</p>
<p>You may also be able to pin this problem to the character set but what is the correct <strong>charset</strong>?</p>
<h3>Default language</h3>
<p>The character set, i.e. how text has to be printed/shown, is defined by the language setting. In Linux this is defined with the environment variable <strong>LANG</strong>.</p>
<dl class="code_example"> <dd>[user@host ~]$ set | grep -i lang</dd> <dd>LANG=en_US.UTF-8</dd> </dl>
<p>Although this looks perfectly fine it is in fact our problem.</p>
<p>The language should be only <strong>en_US</strong> or maybe whatever your preferred language is. The appendix <span style="font-family: monospace;">UTF-8</span> throws certain characters off in your man pages and the apostrophe is usually one character you see a lot&#8212;or actually you don't see it.</p>
<h4>Export en_US</h4>
<p>So, all you have to do is set <span style="font-family: monospace;">export LANG=en_US</span> as the language.</p><img src="http://feeds.feedburner.com/~r/AWD-KnowledgeBase/~4/kHY-LrMHEGg" height="1" width="1"/>]]></content:encoded>
    </item>
    <item>
      <title>Is it a secure application?</title>
      <description><![CDATA[Is the Zend Framework a secure application? Can it be used to secure your website? Can I expect security with and rely on Zend Framework's authentication or authorization procedure? These are questions you might have and I like to address and answer in this document. While the simple answer is yes it takes a little bit more to understand why this simple answer cannot be taken for granted]]></description>
      <pubDate>Tue, 10 Apr 2012 10:59:14 -0500</pubDate>
      <link>http://www.adrianworlddesign.com/Knowledge-Base/Zend-Framework/OAQ---Occasionally-asked-questions/Is-it-a-secure-application</link>
      <guid>http://www.adrianworlddesign.com/Knowledge-Base/Zend-Framework/OAQ---Occasionally-asked-questions/Is-it-a-secure-application</guid>
      <content:encoded><![CDATA[<p>I saw this question in a forum once and I think I should add this to my website with an answer.</p>
<blockquote>Is the Zend Framework a secure option for a web application with authentication and authorization?</blockquote>
<p>Well, the simple answer is yes, there is <em>some security</em> with the <strong>Zend Framework</strong> but this could be very misleading and dangerous. Hence, what follows is a more detailed answer to this important question. Surprisingly, most of it has nothing to do with the Zend Framework but security in general.</p>
<h3>Security is your responsibility</h3>
<p>One thing has to be addressed first. <strong>Security</strong> for a website, a web application <strong>is your responsibility</strong> or delegated to somebody who knows and understands security like me. Dead simple.</p>
<p>Delegating or relying on an application doing it for you in some fancy or magic way is flat out dangerous. This is not only a nail in to the coffin for the Zend Framework but for any website and application&#8212;WordPress, Joomla, Drupal, PHP, Perl, Ruby, ASP you name it.</p>
<p>Even straight and simple HTML. If you don't protect access to your simple HTML pages somebody might be able to change the content. This might be little damage and not a big deal but still&#8212;it shows where the problem is.</p>
<h3>Communication layers</h3>
<p>To understand security we have to understand the different levels of access control. Lets call them layers for a few paragraphs, though.</p>
<h4>OSI Model</h4>
<p>In networking there is a model called <abbr title="Open Systems Interconnection">OSI</abbr>, which stands for <strong>Open Systems Interconnection</strong>. For a brief introduction into the OSI model you can read more about it on <a title="OSI Model on Wikipedia" href="http://en.wikipedia.org/wiki/OSI_model" target="_blank">Wikipedia</a>.</p>
<p>The model has seven (7) layers and each layer defines how computer systems communicate with each other on that particular layer. Interesting part here is that we are more or less able to control access on each and every layer.</p>
<h4>Firewalls</h4>
<p>Over a few of these layers we can control access with what is commonly known as a firewall. There are other types of applications doing similar things, i.e. control access, but are not necessarily called firewalls. Be careful here when you talk to networking pros&#8212;they are sometimes a little peculiar.</p>
<h4>Application control</h4>
<p>Which brings us to the top layer in our OSI Model, the <strong>application layer</strong>.</p>
<p>Now strictly speaking this application layer does not apply to an application like the Zend Framework but <strong>your web server and HTTP</strong>. The OSI model is about the communication between computer systems and they talk HTTP with each other.</p>
<p>If you are familiar with a web server like <strong>Apache</strong>, <strong>nginx</strong> or <strong><abbr title="Internet Information Service">IIS</abbr></strong> you know that you have quite a few options to control access with your web server.</p>
<h3>File System Security</h3>
<p>Which brings us to another layer of security but lets go back to level now. Once we have reached our web server we have to control access on the file system level.</p>
<h4>WWW root</h4>
<p>A major problem I see with many hosting providers and applications is that your directory where all your files are is also the www root folder.</p>
<p>When <strong>all your application files</strong> are in the <strong>web's root folder</strong> it is easy to understand that this is not good, I think. See below why the Zend Framework in this regard is different. Now, although you will not list your application's files publicly they are still there.</p>
<p>If it is a well known application people will know it anyway and when you don't take any other precautions to prevent access you are asking for troubles.</p>
<p>Many hosting providers offer an <em>easy installation</em> for web applications like WordPress, Joomla, phpMyAdmin and the installation goes right into this www root folder. Because these are very well known applications their file structures are well known and any vulnerabilities. Go figure!</p>
<h4>Vulnerability example</h4>
<p>Want an example? My website gets constantly probed to see if I have WordPress or phpMyAdmin installed. The file names are well known and they are well exposed; sometimes even intentional like the wp-login.php file.</p>
<p>Nothing wrong with this wp-login.php file actually except that everybody knows. I can only imagine what will happen if they would find any of these on my servers.</p>
<p>First you should really avoid having your application and files in your www root. If this is not an option with your current hosting provider you should seriously consider moving to another provider or make absolutely sure these files are not accessible and protect them with appropriate file system security.</p>
<h3>Data and database security</h3>
<p>Most applications today use a database in one way or another. However, many users have little to absolutely no knowledge about databases and database security. They follow some standard procedures or recommendations like installing phpMyAdmin without knowing how to use it exactly, i.e. they install it but don't use it. Sad but true I've seen it.</p>
<p>Like I mentioned in the example above my website gets constantly probed for phpMyAdmin. For good reasons because a surprising high number uses this application and with direct access from the Internet.</p>
<h3>What about the Zend Framework</h3>
<p>If you came here to know if the Zend Framework is a secure application I hope the introduction showed you where your main concern should be. You should be familiar and comfortable with security on many levels.</p>
<p>If you want to rely for security on a web application alone like the Zend Framework, WordPress, Joomla or which ever you are living a dangerous Internet presence.</p>
<p>Know your application and know how to install and operate it in a secure way.</p>
<h4>More secure than others</h4>
<p>The Zend Framework for me is more secure than other web applications for two very simple reasons.</p>
<p>First you have to download and install it yourself. You don't see any <strong>Install button</strong> like you see that for WordPress and others. So far I have not seen any of the common hosting providers offering an easy-peasy-lemon-squeezy Zend Framework installation. There are others, like me with my <a title="Zend Development Services" href="http://www.adrianworlddesign.com/Services/zend-development">Zend Develoment Services</a>, who offer tailored and ready to use installations but that's a different story.</p>
<p>Second reason and where the Zend Framework is a little bit different is the clear separation between the public www root folder and the application plus library folder. There is the bar minimum of a index.php in your www root folder and everything else is outside of view to the public by default.</p>
<h4>Authentication and authorization</h4>
<p>Last but not least you have a pretty strong authentication library in the Zend Framework.</p>
<p>The tiny little problem here is that it is only a library and not a finished and ready to use module you pop into your application. You have to write your own access and authentication procedure but with the help of the library you can build your own security package very quickly.</p>
<p>The good thing about this is that it is your own implementation which gives little clues on how it actually works. Nobody will know if there are any vulnerabilities like a default admin account with a default password.</p>
<h3>Need help?</h3>
<p>If you need any help with the Zend Framework in terms of setup, hosting and security I will be more than happy to help. See my <a title="Contact Page" href="http://www.adrianworlddesign.com/contact">Contact page</a> and use the <a title="Contact Form Page" href="http://www.adrianworlddesign.com/contact/form">contact form</a> to get a quote.</p><img src="http://feeds.feedburner.com/~r/AWD-KnowledgeBase/~4/dGfsak-D2fc" height="1" width="1"/>]]></content:encoded>
    </item>
    <item>
      <title>How to refresh page</title>
      <description><![CDATA[How to refresh or reload a page in Zend Framework or with PHP and HTML? I see this question quite often and the secret is simple. You have to redirect the page to itself or use the refresh meta tag. This document is a collection of the different types and with answer and solution for each type.]]></description>
      <pubDate>Sun, 01 Apr 2012 15:14:23 -0500</pubDate>
      <link>http://www.adrianworlddesign.com/Knowledge-Base/Zend-Framework/Helpful-Tips/How-to-refresh-page</link>
      <guid>http://www.adrianworlddesign.com/Knowledge-Base/Zend-Framework/Helpful-Tips/How-to-refresh-page</guid>
      <content:encoded><![CDATA[<p><em>How to refresh or reload a page in Zend Framework?</em> I see this question quite often and the secret is simple but there are a different types of <strong>refresh</strong> or <strong>reload</strong> and they require different types of solution.</p>
<p>First we have to find out <strong>what type of refresh</strong> do you want. For some I already have a document with a solution, hence this document provides answers to some problems but also links to the other existing documents and solution provided there.</p>
<p>To get the full picture and understanding I recommend you check out all links no matter what.</p>
<h3>What defines a refresh or reload</h3>
<p>First lets find out what type of refresh you are looking for and just so we are clear about the problem I will explain what I consider a <em>refresh <span style="text-decoration: underline;">or</span> reload</em>. For me it is basically what I see as a user in my browser, i.e. the page gets loaded fresh from the server.</p>
<h4>Refresh vs. reload</h4>
<p>The most common way for a user is to hit the F5 button to refresh the same page or right-click and then select <strong>Refresh</strong> in Internet Explorer and <strong>Reload</strong> in basically all other browsers. We can see right here that we have a difference in terminology. Personally, I like the technical term which is <em>reload</em> but I think the common user prefers <em>refresh</em> over <em>reload</em>.</p>
<p>So, a user can hit F5 but how do we force a reload as web developers or designers? There are basically two ways which we can describe as either an HTML based and client-side or HTTP based and server-side solution. Of course, there is a third solution with JavaScript but I will not venture into that field because JavaScript ultimately will do the same.</p>
<h3>Force reload client-side</h3>
<p>If we force a reload or refresh of a page on the client-side we have to resort to HTML and an "unofficial" solution&#8212;again, we don't look at JavaScript. Unofficial means that it is not documented and not supported by the HTML standard; nonetheless, most browsers support it as a <em>legacy</em> standard. The W3C has an explanation for how to <a title="Use standard redirect at w3.org" href="http://www.w3.org/QA/Tips/reback.html" target="_blank">Use standard redirects</a> and why it is not a good solution.</p>
<p>I consider this a client-side solution because a full initial page has to be submitted and loaded by the browser. Then the client based on some information reloads refreshes the page.</p>
<p>This information needed and "unofficial" solution is adding a <strong>refresh meta tag</strong> to the document head. If the browser supports this meta tag it will act according to the settings which are described following</p>
<dl class="code_example"> <dd class="code_description">// refresh the same page after 10 seconds</dd> <dd>&#60;meta http-equiv="refresh" content="10"&#62;</dd> <dd class="code_description">// reload another page after 5 seconds</dd> <dd>&#60;meta http-equiv="refresh" content="5; url=http://example.com/"&#62;</dd> </dl>
<h4>Refresh http-equiv meta with Zend</h4>
<p>In terms of Zend Framework there is not much we have to do than add the meta tag into the view like this</p>
<dl class="code_example"> <dd class="code_description">// this goes inside the controller</dd> <dd class="code_description">// this will reload the same page every 10 seconds</dd><dd>$this-&#62;view-&#62;headMeta()-&#62;appendHttpEquiv('refresh','10');</dd> <dd class="code_description">// this will reload another page after 5 seconds</dd><dd>$this-&#62;view-&#62;headMeta()-&#62;appendHttpEquiv('refresh','5; url=http://example.com/');</dd> </dl>
<p>Of course you can manually add or echo the string directly in the layout but I think that you don't want a static solution. The headMeta() method inside a controller is the best way to wrap that inside some condition.</p>
<h3>Force reload server-side</h3>
<p>We can refresh or reload a page with another feature when we use HTTP and for this we have to introduce a third term: <strong>redirect</strong>. Because we don't have to send a full page for this redirect I call this a server-side reload.</p>
<p>Usually we want to refresh or reload a webpage from the server-side when we have a form submission, i.e. some POST request. We will send a status code inside the HTTP header which will cause a redirect and forces the client to a GET request. This is commonly known as the PRG (POST/REDIRECT/GET) pattern. For the user this looks like a refresh or reload of the page. Note that this redirect results in the same page but usually it is meant to redirect to another URL and webpage.</p>
<p>For the redirect procedure I already have two documents</p>
<ul class="list_elements">
<li><a title="How does a redirect work" href="http://www.adrianworlddesign.com/Knowledge-Base/Web-Standards/Things-about-Hypertext/How-does-a-redirect-work">How does a redirect work</a> - Basics</li>
<li><a title="How to use redirect" href="http://www.adrianworlddesign.com/Knowledge-Base/Zend-Framework/Helpful-Tips/How-to-use-redirect">How to use redirect</a> in PHP or Zend</li>
</ul>
<p>The first link is a more basic information about how a redirect works whereas the second document is how to implement it in PHP or the Zend Framework.</p><img src="http://feeds.feedburner.com/~r/AWD-KnowledgeBase/~4/XZK4Z4C4fyQ" height="1" width="1"/>]]></content:encoded>
    </item>
    <item>
      <title>Current application config</title>
      <description><![CDATA[How to get the current configuration (aka the application config) from your application.ini file in your Zend Framework MVC project. This article tells you not only how you can retrieve the configuration but also how the application config gets from the index.php to the bootstrap object. Once you know all this you know how to get stuff from your application.ini.]]></description>
      <pubDate>Sun, 01 Apr 2012 08:02:46 -0500</pubDate>
      <link>http://www.adrianworlddesign.com/Knowledge-Base/Zend-Framework/Helpful-Tips/Current-application-config</link>
      <guid>http://www.adrianworlddesign.com/Knowledge-Base/Zend-Framework/Helpful-Tips/Current-application-config</guid>
      <content:encoded><![CDATA[<p>Have you ever wondered <em>how to get the current configuration</em> from your <em>application.ini</em> file in your <strong>Zend Framework MVC project</strong>?</p>
<p>In this article I'm not only going to tell you where you get the configuration from but also how the Zend application put it there in the first place&#8212;plus as a bonus an interesting tip. Please also read the <a title="Jumps to the disclaimer title" href="#page_disclaimer">disclaimer</a> at the bottom!</p>
<h3>Follow the path</h3>
<p>When you search for this question you will find many interesting answers but they all are a little bit weird; most of them don't match my understanding about the Zend Framework. So, I figured lets do some more research and dig through some code.</p>
<p>The first question I have is this one: "What happens with the application.ini file anyway?" When you have this answer it quickly leads to the solution for the initial question.</p>
<p>And here is the&#160;<strong>bonus tip</strong>&#160;I have promised: <em>If you want to find the answer about something in the Zend Framework then just look at the code</em>. After all, isn't that why we love <abbr title="Open Source Software">OSS</abbr>?</p>
<h3>The config is an option</h3>
<p>If you run your MVC Zend Framework based on the more or less default instruction then you will have the following line of code in your index.php file:</p>
<dl class="code_example"><dt><span class="code_description">// Create application, bootstrap, and run</span></dt><dd>$application = new Zend_Application(</dd><dd>&#160;&#160;APPLICATION_ENV,</dd><dd>&#160;&#160;APPLICATION_PATH . '/configs/application.ini' );</dd><dd>$application-&#62;bootstrap()-&#62;run();</dd></dl>
<p>Now we simply follow the path in the code of the Zend_Application class and we will discover two things:</p>
<ol class="list_elements">
<li>the configuration gets stored in a "_option" property</li>
<li>the Zend_Application object is passed into the bootstrap object</li>
</ol>
<p>Second question: "What happens in the bootstrap class?"</p>
<p>Looking at our bootstrap.php file which extends down to the BootstrapAbstract.php file and the constructor we discover another thing:</p>
<ul class="list_elements">
<li>the configuration is stored in yet another "_option" property</li>
</ul>
<p>This time it belongs to the bootstrap object, though.</p>
<h3>Fetch the bootstrap</h3>
<p>So, there you have it. All is left now is fetch your bootstrap and call the getOptions method. If you are in a controller you can use getInvokeArg and in other places you get the frontController first. Here's the full code</p>
<dl class="code_example"><dt><span class="code_description">// use this in a controller class</span></dt><dd>$currentConfig = $this-&#62;getInvokeArg('bootstrap')-&#62;getOptions();</dd> <dt><span class="code_description">// use this in other places</span></dt><dd></dd><dd>$front = Zend_Controller_Front::getInstance()-&#62;getParam('bootstrap')-&#62;getOptions()</dd></dl>
<h4 id="page_disclaimer">Disclaimer</h4>
<p>Two important things to note and understand about this getOptions() method.</p>
<ol class="list_elements">
<li>The returned data is a regular PHP array and not a <strong>Zend_Config</strong> or <strong>Zend_Config_Ini</strong> object as you might suspect.</li>
<li>You will get the <strong>current</strong> configuration only, i.e. the tree depending on your environment set with APPLICATION_ENV. Although Zend_Application reads the whole file it only adds the active configuration to the option property!</li>
</ol>
<p>If you want to fetch the whole configuration, i.e. the whole content of the application.ini you will have to get the file itself with Zend_Config_Ini if it is an ini file.</p><img src="http://feeds.feedburner.com/~r/AWD-KnowledgeBase/~4/zwLC8aeYpV4" height="1" width="1"/>]]></content:encoded>
    </item>
    <item>
      <title>How to use redirect</title>
      <description><![CDATA[This page is about how to use redirect in PHP or the Zend Framework, i.e. how can you send a response to the request with a redirect code 30x like 301 causing the browser to reload or refresh a page and getting another (or a fresh) page. The redirector action helper (plugin) is your preferred choice here. At the end there is also some information how to set 404 errors in Zend.]]></description>
      <pubDate>Sat, 24 Mar 2012 09:58:27 -0500</pubDate>
      <link>http://www.adrianworlddesign.com/Knowledge-Base/Zend-Framework/Helpful-Tips/How-to-use-redirect</link>
      <guid>http://www.adrianworlddesign.com/Knowledge-Base/Zend-Framework/Helpful-Tips/How-to-use-redirect</guid>
      <content:encoded><![CDATA[<p>Redirecting is basically a simple procedure within HTML or rather HTTP. Forcing a <strong>redirect, refresh and reload of a page</strong> from within a script like <strong>PHP</strong> is also pretty simple and the same is true for the <strong>Zend Framework</strong>. There is a slight little problem: "You need to know how!"</p>
<p>If you need some fundamentals on how a redirect works (and I think you should) then you may want to read first <a title="Link to a document about how a redirect works" href="http://www.adrianworlddesign.com/Knowledge-Base/Web-Standards/Things-about-Hypertext/How-does-a-redirect-work" target="_blank">How does a redirect work</a> and then come back here.</p>
<p>This page dives directly into how to <strong>redirect in PHP plus the Zend Framework</strong>.</p>
<span class="complementary_text">
<h3>Fundamentals for redirecting</h3>
<p>First some fundamentals to make sure we are talking about the same thing, i.e. we have an understanding what a redirect is.</p>
<h4>A normal response</h4>
<p>Lets look at the web server how a "normal" transactions works.</p>
<p>A user-agent (browser) sends a <strong>request</strong> for a document with the URI as domain/path/documentname. The server in return sends a <strong>response</strong>. Keep these two things in mind, they always work together: request&#8594;response. When we redirect we send a response telling the requester to send a different request! That is the whole secret of redirecting in a nutshell, but we are not there yet.</p>
<p>The response contains a <a title="Link to status code definitions at W3C (w3.org)" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10" target="_blank">status code</a> which is <strong>200 OK</strong> if everything is normal. If there are problems or special situations like our redirects the response has a different number. Watch out: The status codes are part of the HTTP specification; not HTML!</p>
<h4>Other server responses</h4>
<p>Before we dive into redirects lets look at two other common types of response by a web server. These are status code 404 and 500 which are not redirects but nevertheless do not return the expected web page.</p>
<p>Although we sometimes see the code in the browser, a user agent itself should and does not care about it. A user agent simply displays the HTML document page submitted by the server along with the status code. You could send any page with an error code and a user would not know.</p>
<p><strong>Page not found</strong>: If the server cannot locate the requested path or document its response is 404. Together with the response a web page is returned, which is either the default page specified with the server for this type of error or a specially designed page and configured into the server.</p>
<p><strong>Internal Server Error</strong>: If the web server has to send the request to a script engine like PHP (CGI) and does not get back a proper response (or in time) it will return a 500 error. Like before a web page is returned as well.</p>
<p>There are other types of error plus we can add real redirect options into the web server. For an Apache web server this is usually within the .htaccess file as a redirect or a rewrite [R]. We will not look at the server configuration in more detail because this is about PHP and Zend but here is the link to the <a title="Link to apache.org and the mod_rewrite documentation" href="http://httpd.apache.org/docs/2.2/rewrite/" target="_blank">mod_rewrite documentation</a> for Apache 2.2.</p>
<h4>Why redirect</h4>
<p>Why or when do we need a redirect? Like we have seen before if a document is not found our web server should respond with a 404 status code.</p>
<p>If the user just typed some silly request this may be okay but it is not very smart (or polite) when we know we have moved or renamed the document. In all these cases we should catch the request and <strong>redirect</strong> to the new location or new document name.</p>
<h4>A reason to reload or refresh</h4>
<p>You have a page and for some reason you like to refresh or reload the page for the user. Most prominent is the POST/GET pattern. A user submits a form with a POST request and there is this little problem when a user hits the refresh (F5) button. The browser would resubmit the form and data which is not only annoying for your user but may also introduce some problem with your application. To avoid all this you respond with a redirect. This not only actively refreshes or reloads the page for the user it forces the browser in a GET request state, i.e. if the user hits F5 the page just reloads or refreshes but no form data is resubmitted.</p>
</span>
<h3>HTML redirects</h3>
<p>Before we talk about PHP and Zend Framework redirect here is something else you may have seen in other places. Especially when a page has been moved, i.e. can be found with another URL, aka link.</p>
<p>In such cases a common method is having a page with a note about the move and a link to the new location so the user can update any bookmark or link on a web page. Within the HTML document we can place a "refresh" meta tag. The refresh tag will cause a reload for the page after a defined period to a specified new location.</p>
<p><strong>Note:</strong> This is <span style="text-decoration: underline;">not</span> a real redirect and a thing handled by browsers once the whole page has been loaded. It is also not a part of HTTP and actually not a standard defined in HTML either. PHP is not much involved either because you'll just need it to probably echo some HTML code. In terms of informing the user this might be a good and valid option but it has some limitations as explained in <a title="Link to W3C and a dcoument about refresh meta tag" href="http://www.w3.org/QA/Tips/reback.html" target="_blank">this document at W3C.</a></p>
<p>If you don't want to use the meta refresh tag you have to send a status code and a new  location forcing HTTP to reload the page, i.e. send a new request based on this information.  Because HTTP is part of the network protocol suite (IP stack) a browser is not aware of this redirect to some degree.</p>
<p>Well, that is actually&#160;not&#160;true because a browsers under hood handles HTTP. Lets just say between a user and a browser the user is not aware of this redirect.</p>
<p>Back to working on the redirect we also need a way to communicate with HTTP and that's were we need PHP.</p>
<h3>Redirect with PHP</h3>
<p>So, how do we work with HTTP in PHP? Working with HTTP means the header information. Because we only have to make changes to the header it is very simple. We can set header information with the aptly named <a title="Link to php.net and header function" href="http://us.php.net/manual/en/function.header.php" target="_blank">header()</a> function in PHP.</p>
<p>The only tricky thing is to add the information before you have any sort of output, i.e. echo, print or any other form of data. Note that a file include containing spaces outside your &#60;?php ?&#62; marks might be enough to throw the function off and trigger an error.</p>
<p>Once you have set all information with the header function you can or actually have to terminate your script by calling exit() or die(). Whatever else you send or do will have no effect after you have set the redirect header information.</p>
<p>The information in the header, as the response to the requester, causes HTTP to request the new document. Again, a browser (I mean the user) is usually not aware what just happened. They get note of the new URI when they see the updated address field, though. Other than that this process is very transparent.</p>
<h4>Can I see the header information</h4>
<p>It depends what you are looking for.</p>
<p>On the server-side: If you are looking for the header information before you send your document you can use <a title="Link to php.net and header_list function" href="http://us.php.net/manual/en/function.headers-list.php" target="_blank">header_list()</a> to see what is ready for the header and <a title="Link to php and header_send function" href="http://us.php.net/manual/en/function.headers-sent.php" target="_blank">header_send()</a> if or what has been sent. If you want to know what the user sees you simply cannot with PHP because this is server-side scripting. Maybe there is some JavaScript that can collect and send information back to you but this is about PHP and Zend Framework and not Jscript.</p>
<p>You can however query your own page and act as a client, if you must. You can call your own link with <a title="Link to php.net and get_headers function" href="http://us.php.net/manual/en/function.get-headers.php" target="_blank">get_headers()</a> which will give a client's point of view, sort of. You can use this in a test application but you should not use this in the same procedure sending your page.</p>
<p>On the client-side: In theory, a browser is able to query HTTP for the header information but there are two problems. First you cannot see the reload only the new page and second I have looked at all major browser but have found none giving you header information by default. Only with some developer extensions you can get and see the response header.</p>
<p>Google's Chrome browser has a Web Developer extension by <a title="Link to chrispederick.com and Web Devloper for Chrome" href="http://chrispederick.com/work/web-developer/chrome/" target="_blank">chrispederick.com</a><em></em>. Firefox has <a title="Link to Firefox Web Developer add-on" href="https://addons.mozilla.org/en-US/firefox/addon/web-developer/" target="_blank">this web developer</a> add-on and guess what; also by <a title="Link to chrispederick.com and Web Devloper" href="http://chrispederick.com/work/web-developer/" target="_blank">chrispederick.com</a>. In both tools you go to <em>Information</em> and all the way at the end or bottom you will see <em>View Response Headers</em>. As far as I know these are about the only two browsers and location where you can find out what the response status code is.</p>
<p>If you have your web site in Google's <a title="Link to Google Webmaster Tools" href="http://www.google.com/webmasters/tools/" target="_blank">Webmaster Tools</a> you can use "Fetch as Googlebot" in Diagnostics. Once you get the success link you can click that and you will see the whole page including header information.</p>
<p>The last extreme solution to figure out the status code is a network sniffer or get your own web page with telnet.</p>
<h3>Redirect with the Zend Framework</h3>
<p>First of all, it really raises the question if you want to use the Framework's methods because they are not going to do anything more than what we have above. Although, since we have the methods and like to stay consistent in some way we should use it.</p>
<p>Before we start also a special remark about redirects in the Zend Framework. We are talking here about HTTP redirects. Zend Framework also uses internal redirects, i.e. you can redirect to modules or other controllers and actions. This is <span style="text-decoration: underline;">not</span> about internal redirects!</p>
<p>First thing to know about redirect in Zend Framework is that it is a <strong>Action Helper</strong>. If you are not familiar with Action Helpers think of it as a plugin. Action Helpers are plugins for action methods inside a controller though and because of this it means we have to work inside a controller.</p>
<p>If you use a MVC pattern and want to redirect from within a <strong>model</strong> class&#8212;and work properly&#8212;you can (should) not do this directly from the model. You should either return an appropriate response from your model or provide an access to a property in your model indicating that a redirect is necessary. Your controller then initiates the redirect.</p>
<p>There is a <em>redirect() method </em>inside the controller class but I am not very fond of it. Because I already extend <strong>Zend_Controller</strong> for other thing I included a getter method for the Action helper <strong>"Redirector"</strong> plus I can set the redirect status code as an argument. Most of the time you need and do the same things with a redirect so it might be worth to add a special method in your own controller.</p>
<p>On we go, first we get the helper which is named&#160;<strong>Redirector</strong>. Here is how you fetch the redirector:</p>
<dl class="code_example"><dt class="code_description">// $this is your zend controller class</dt><dd>$redirector = $this-&#62;_helper-&#62;getHelper('Redirector');</dd></dl>
<p>Now that you have the object you can work with it, like calling the methods to add the data for the redirect. As you see the methods can be chained, i.e. they return $this. For readability I would not chain everything but this is up to you.</p>
<dl class="code_example"><dd>$redirector-&#62;setCode(301)-&#62;setUseAbsoluteUri();</dd><dd>$newPath = 'http://www.newdomain.com/newpath/newdocument.html';</dd><dd> $redirector-&#62;gotoUrl($newPath);</dd></dl>
<p>And we are basically done but what is happening here?</p>
<p>First we set the status code. Important fact here, the code has to be an integer and not a string (I learned it the hard way). Of course, the code has to be one of the valid HTTP <a title="Link to status code definitions at W3C (w3.org)" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10" target="_blank">status codes</a> and is not a code only known to or defined somewhere in Zend Framework.</p>
<p>Second, set an absolute URI to make sure it is a valid path and not inadvertently a relative path breaking the new request.</p>
<p>Last, the redirector by default and the final call to method <strong>gotoUrl()</strong> will terminate the framework, i.e. it will call the <strong>exit()</strong> function. The call to exit as a default can be postponed for whatever reason by calling&#160;<strong>setExit(false)</strong> earlier. Once you are ready to finally leave you can call <strong>redirectAndExit()</strong> which will finally terminate the framework and trigger the redirect.</p>
<h4>Redirects and error codes</h4>
<p>Do not use the redirects for the error codes for two reasons. First you want to return a document telling what went wrong. Second the Redirector is supposed to terminate with exit and therefore is not returning this document. Whatever you would write is thrown away, lost.</p>
<p>You can set an error status code with Zend Framework like this:</p>
<dl class="code_example"><dd>$error_404 = 'HTTP/1.1 404 Not Found';</dd><dd> $this-&#62;getResponse()-&#62;setRawHeader($error_404);</dd></dl>
<p>Note again that all this goes inside your controller.</p><img src="http://feeds.feedburner.com/~r/AWD-KnowledgeBase/~4/Zxrnykm2_Jc" height="1" width="1"/>]]></content:encoded>
    </item>
    <item>
      <title>What does i18n or l10n mean</title>
      <description><![CDATA[This document sheds some light on what the two abbreviations i18n and l10n mean. The meaning is probably known to some but why we write them like this may still be puzzling to some. Here is a brief an simply answer what they mean.]]></description>
      <pubDate>Sat, 24 Mar 2012 09:48:36 -0500</pubDate>
      <link>http://www.adrianworlddesign.com/Knowledge-Base/Web-Standards/Various-Standards/What-does-i18n-or-l10n-mean</link>
      <guid>http://www.adrianworlddesign.com/Knowledge-Base/Web-Standards/Various-Standards/What-does-i18n-or-l10n-mean</guid>
      <content:encoded><![CDATA[<p>When we discuss support of (native) <strong>languages</strong> in programing and of course web pages we usually bump into <strong>i18n and l10n</strong>.</p>
<p>The two acronyms or abbreviations are used a lot because we need these two words a lot and this is what they mean or actually stand for:</p>
<ul class="list_elements">
<li>Internationalization</li>
<li>Localization</li>
</ul>
<p>Now that we know what i18n and l10n stands for you may wonder <strong>why are they used</strong> for these two long words when we discuss language support.</p>
<h3>Programmers (people) are lazy</h3>
<p>Because we use these words a lot and especially programmers are used to avoid duplication and long unnecessary strings an abbreviation was required. Maybe it wasn't just programmers and everybody was tired of writing these long words over and over again.</p>
<p>The abbreviation looks a little bit weird at first but when we look at only the numbers and think long and hard enough it is simple and obvious.</p>
<p>We use only the first and last letter of each word, and count then replace the intermediate letters by their number telling how many letters there are.</p>
<dl class="code_example"><dt class="code_description">internationalization is a string with 20 characters</dt><dd>i + 18 + n = i18n</dd><dt class="code_description">localization is a string with 12 characters</dt><dd>l + 10 + n = l10n</dd></dl>
<p>That's all, simple once you know it!</p><img src="http://feeds.feedburner.com/~r/AWD-KnowledgeBase/~4/BxDEC3_CzZw" height="1" width="1"/>]]></content:encoded>
    </item>
    <item>
      <title>Run-time support missing</title>
      <description><![CDATA[If you see the webpage with the title Zend Guard Run-time support missing! you may have some serious doubts about using Zend Guard. The problem may be in many places but also with SELinux when you use Zend Guard Loader on Linux. This document has some information about the cause and the solution for this problem.]]></description>
      <pubDate>Thu, 15 Mar 2012 15:50:03 -0500</pubDate>
      <link>http://www.adrianworlddesign.com/Knowledge-Base/Web-Hosting/Zend-Guard/Run-time-support-missing</link>
      <guid>http://www.adrianworlddesign.com/Knowledge-Base/Web-Hosting/Zend-Guard/Run-time-support-missing</guid>
      <content:encoded><![CDATA[<p>When you start <strong>Zend Guard</strong> for the first time, i.e. the <strong>Loader</strong> module <strong>ZendGuardLoader.so</strong>, chances are you run into some problems and you will see the "<em>Zend Guard Run-time support missing</em>" page.</p>
<p>The main problem for this error is that the <em>Zend Guard loader module</em> is not loaded/installed properly. Unfortunately the error page may be the result of not just one single problem so we have to cycle through the possibilities.</p>
<p>This page will help you find the problem and I will even throw in some additional information you might need if you are not so computer savvy. Note the <a href="#env_disclaimer">Environment Disclaimer</a> at the bottom for my setup details.</p>
<h3>Initial tests</h3>
<p>Before we dive into deeper territory you should do a few tests first to sort out things.</p>
<h4>Proper installation result</h4>
<p>The first question is how do you even know if Zend Guard Loader is loaded and working properly. Does the configuration even see the information and is doing something. I have a webpage to answer just this question so please see <a title="How to test if ZendGuardLoader.so is installed and working" href="http://www.adrianworlddesign.com/Knowledge-Base/Web-Hosting/Zend-Guard/Verify-Zend-Guard-installation">How to test if ZendGuardLoader.so is installed and working</a>.</p>
<p>If you don't see anything about the Zend Guard Loader with that test you have found your first and hopefully only problem. Please check your configuration with that test before proceeding here.</p>
<h4>Simple loading problems</h4>
<p>Some other tests are about two simple loading problems.</p>
<p>First what do you get when you use the wrong version, i.e. the 32-bit instead of the 64-bit. This problem is the same on Linux and Windows system. Unfortunately the two libraries use the exact same name. Second what happens if you have the wrong path information in the config (or the file in the wrong place) or misspelled the information. Check out my document <a title="How to see ZendGuardLoader.so loading problems" href="http://www.adrianworlddesign.com/Knowledge-Base/Web-Hosting/Zend-Guard/Zend-Guard-loading-problems">How to see ZendGuardLoader.so loading problems</a>.</p>
<p>The problem and fixes are obviously easy but not how the problem raises its head. The document tells where to look and find the signs.</p>
<p>If all has been checked and you still have a problem it is time for this.</p>
<h3>SELinux problems</h3>
<p>First! If you have Windows and still a problem: This is not for you! I am very sorry but as the title implies this is specific to Linux. Unfortunately I don't have any other suggestions for Windows users beyond the previous points.</p>
<p>Okay, you have a Linux system and you have cleared the previous hurdles but you still see the webpage with the title <strong>Zend Guard Run-time support missing!</strong> and you have some serious doubts about using Zend Guard? I guess you are looking at some problems involving SELinux like I did.</p>
<h4>Do you have SELinux</h4>
<p>The first answer we need is if we even have SELinux running. This can be tested easily with the following:</p>
<table class="code_example" border="0" width="90%">
<tbody>
<tr>
<td colspan="3">[root@centos ~]# sestatus</td>
</tr>
<tr>
<td>SELinux status:</td>
<td colspan="2">enabled</td>
</tr>
<tr>
<td>SELinuxfs mount:</td>
<td colspan="2">/selinux</td>
</tr>
<tr>
<td>Current mode:</td>
<td colspan="2">enforcing</td>
</tr>
<tr>
<td>Mode from config file:</td>
<td colspan="2">enforcing</td>
</tr>
<tr>
<td>Policy version:</td>
<td colspan="2">24</td>
</tr>
<tr>
<td>Policy from config file:</td>
<td>targeted</td>
<td width="50%">&#160;</td>
</tr>
</tbody>
</table>
<p>If you see this it means SELinux is installed and enabled.</p>
<h4>Is SELinux causing a problem</h4>
<p>The second answer we need is if SELinux is causing the problem with Zend Guard Loader. Luckily this can be easily tested as well. It is so easy that you will find this answer in many places as the solution. Which I think it is not, it's just a simple workaround. Anyhow, try this</p>
<table class="code_example" border="0" width="90%">
<tbody>
<tr>
<td colspan="3">[root@centos ~]# echo 0 &#62;/selinux/enforce</td>
</tr>
<tr>
<td colspan="3">[root@centos ~]# service httpd restart</td>
</tr>
<tr>
<td>Stopping httpd:</td>
<td colspan="2">[  OK  ]</td>
</tr>
<tr>
<td>&#160;</td>
<td>[  OK  ]</td>
<td width="50%">&#160;</td>
</tr>
<tr>
<td colspan="3">[root@centos ~]# echo 1 &#62;/selinux/enforce</td>
</tr>
</tbody>
</table>
<p>This will turn off SELinux temporarily and when you restart httpd you should be fine and see your webpages correctly. If that is the case SELinux is your problem. Now, if the following should not get your problem solved you will have to check the file access in terms of SELinux, i.e. context. I will not go into details how to fix that because such an problem is not specific to this Zend Guard module.</p>
<p>Before we go to the solution I have a nasty little secret. If you use <strong>php -v</strong> as described in other places to see if Zend Guard Loader is loaded this will look great as you can see here</p>
<table class="code_example" border="0" width="90%">
<tbody>
<tr>
<td>[root@centos ~]# php -v</td>
</tr>
<tr>
<td>PHP 5.3.3 (cli) (built: Jan 11 2012 19:53:01)</td>
</tr>
<tr>
<td>Copyright (c) 1997-2010 The PHP Group</td>
</tr>
<tr>
<td>Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies <span class="code_focus">with Zend Guard Loader v3.3</span>, Copyright (c) 1998-2010, by Zend Technologies</td>
</tr>
</tbody>
</table>
<p>It looks as if Zend Guard is loaded properly but your website will tell you it isn't. If SELinux is your problem you have to look somewhere else for clues.</p>
<h4>Check the httpd error_log</h4>
<p>The definitive traces and a hint if SELinux is the culprit can be found in the httpd/error_log and like I mentioned above with php there is another nasty little secret with httpd/error_log.</p>
<p>To see the problem you have to restart your daemon twice! For whatever reason, on my system, I cannot see the problem in the log the first time around. If you don't see it the first time you should see  the follow line the second time.</p>
<table class="code_example" border="0" width="90%">
<tbody>
<tr>
<td>Failed loading /usr/lib64/httpd/modules/ZendGuardLoader.so:</td>
</tr>
<tr>
<td>/usr/lib64/httpd/modules/ZendGuardLoader.so: cannot enable executable stack as shared object requires: Permission denied</td>
</tr>
</tbody>
</table>
<p>This is a problem with the ZendGuardLoader.so file itself provided by Zend. I am not sure if they are aware of the problem or how this should be tackled and fixed from their side but following is the solution to fix this problem on your system.</p>
<h3>Executable stack</h3>
<p>For the solution I think we don't have to go into detail about what <strong>cannot enable executable stack as shared object requires</strong> really means but I have found this <a name="Security Enhancements in Red Hat Enterprise Linux" href="http://www.akkadia.org/drepper/nonselsec.pdf" target="_blank">Security Enhancements[pdf]</a> doc that explains the story behind it. It also contains the solutions which I have next.</p>
<h4>Header Information</h4>
<p>The problem lies in the header information of the file and SELinux makes sure these conditions are met.</p>
<p>If you want to check your file first and see what the problem is run the following. If you are curious you can use it without fgrep if you like, the output is only a little more than a dozen lines. If you don't have eu-readelf try readelf. It has a similar output but not everything is on one line so you have to run it without grep.</p>
<table class="code_example" border="0" width="90%">
<tbody>
<tr>
<td>[root@centos ~]# eu-readelf -l /usr/lib64/httpd/modules/ZendGuardLoader.so |fgrep STACK</td>
</tr>
<tr>
<td>GNU_STACK      0x0000000000000000 0x0000000000000000 0x0000000000000000  RWE 0x8</td>
</tr>
</tbody>
</table>
<p>In this file an executable stack seems to be required because of the letter E in RWE at the end but in fact none is available and the flag was set unintentional. Unfortunately the linker defaults to the safe side and marks the executable as requiring a stack.</p>
<h4>execstack</h4>
<p>Ordinarily this means that the executable should be compiled accordingly but there is a tool that fixes just the header information for our purpose. The tool to query or set the executable stack flag is execstack and part of prelink package. You can find and install that package with yum. After that you simply run this command:</p>
<table class="code_example" border="0" width="90%">
<tbody>
<tr>
<td>execstack -c /usr/lib64/httpd/modules/ZendGuardLoader.so</td>
</tr>
</tbody>
</table>
<p>If you check the header information again you will see that the E is gone and only RW remains. Restart your httpd daemon and your webpage should load. You may want to restart the daemon twice to have a proper log. In my log the old error still shows up after the first restart.</p>
<h3 id="env_disclaimer">Environment Disclaimer</h3>
<p>The error and fixes is not specific to any platform because it is mostly related to PHP. The describtion above should apply to operating systems like Linux, Windows or Apple and you should only have to substitute the paths for your OS. The solutions should also work for cloud environments like Amazon's AWS EC2. Because it is PHP centric the problem is not related to a framework like Zend, WordPress, Joomla, Drupal.</p>
<h4>My environment</h4>
<p>Here is some information about the environment. Although my experience  and instructions are specific to Linux and as just mentione a lot will apply to other systems like Windows as  well especially when you use Apache or some of the WAMP packages like  XAMPP.</p>
<p>The <strong>Initial tests</strong> above are in fact similar on Linux and  Windows and the links to my documents about Zend Guard in that first  section apply for all platforms.</p>
<p>In my case and the examples listed here are about PHP 5.3.3 with Zend  Guard on Linux and CentOS 6/x86_64. As you can see this is about 64-bit  but I think that the results (problems) will be similar for a 32-bit  loader. All software installations on my system are done with <strong>yum</strong> so any paths I will mention my be different if you don't have the same Linux distribution and don't use <strong>yum</strong>.</p>
<p>&#160;</p><img src="http://feeds.feedburner.com/~r/AWD-KnowledgeBase/~4/aHDFhM9Terg" height="1" width="1"/>]]></content:encoded>
    </item>
    <item>
      <title>Browsers refresh, reload your pages?</title>
      <description><![CDATA[Does your web pages reload, refresh or redirect to other pages on your site at random? There are a couple things causing a browser to get a certain document once more or loads an entirely different pages. This page will try to explain what is happening in the background.|This page is like tutorial telling something about page reloads or refreshes triggered outside of your application. If you are PHP web developer and something is not as expected you usually look at your application first. It the problem is not within your application, though, it will drive you mad.]]></description>
      <pubDate>Thu, 15 Mar 2012 08:27:21 -0500</pubDate>
      <link>http://www.adrianworlddesign.com/Knowledge-Base/Zend-Framework/Helpful-Tips/Browsers-refresh-reload-your-pages</link>
      <guid>http://www.adrianworlddesign.com/Knowledge-Base/Zend-Framework/Helpful-Tips/Browsers-refresh-reload-your-pages</guid>
      <content:encoded><![CDATA[<p><strong>Special Note: </strong>If you are looking for how to refresh a webpage with PHP or in Zend Framework you have to read one of the following documents:</p>
<ul class="list_elements">
<li>Basic stuff about refresh: <a title="Explains how a redirect work" href="http://www.adrianworlddesign.com/Knowledge-Base/Web-Standards/Things-about-Hypertext/How-does-a-redirect-work">How does a redirect work</a></li>
<li>Refresh in PHP and Zend: <a title="Explains how to use redirect" href="http://www.adrianworlddesign.com/Knowledge-Base/Zend-Framework/Helpful-Tips/How-to-use-redirect">How to use redirect</a></li>
</ul>
<p>Refresh is a term we should use <em>client-side</em>, i.e. what a user or a browser is doing. Forcing a page to refresh from the <em>server-side</em> is known as a&#160;<em>redirect</em>.</p>
<p>This document is about browsers and why they refresh so if that is causing you a headache with your web application, please read on. For server-side refresh, called <em>redirecting</em>, check out the links above.</p>
<h3>Your application problem</h3>
<p>Is your web application all of a sudden not working as expected as if somebody is messing with it in the background? Do you see a sharp increase in the log files because of duplicate entries and you have no clue why a page shows up twice just within seconds? Well, it could be that the problem is coming from the browser and not necessarily your web application.</p>
<p>If you have verified and are sure you don't send a redirect from your web application to the browser you will have to look at the client, i.e. the browser.</p>
<p>There are quite a few reasons why a browser requests a page for a second time or even more. Some will be rather obvious once you know about it but others are still a wee bit of a riddle. Lets take a look at the obvious ones first.</p>
<h3>Link prefetching</h3>
<p>One obvious problem caused by browsers is what they call link prefetching. In most cases this is business as usual but it can cause a serious problem when you work with session state.</p>
<p>Let me say this first, though: As it looks right now only Firefox is actively using link prefechting but I think others might follow soon.</p>
<h4>Why browser prefetch</h4>
<p>Lets say you want users to experience a faster Internet. One simple way is downloading the next page while the user is still reading the current page. Once the user clicks the link the page is already downloaded and ready to render. However, they need some assistance.</p>
<p>Mozilla Developer Network has <a title="Link to MDN and Link Prefetching FAQ" href="https://developer.mozilla.org/en/Link_prefetching_FAQ">an excellent FAQ</a> about how they do it. They are looking for &#60;meta&#62; or &#60;link&#62; tags in the head section; in the &#60;link&#62; tag its the rel and next attributes.</p>
<p>If you place these tags into the head section the browser will go ahead and download the page in the background. When the user finally clicks the link the browser can load the page from its cache.</p>
<h4>A problem for session state</h4>
<p>At first prefetching seems to be a wonderful thing but not if you work with session state.</p>
<p>When you work with forms and need to know if the user is following a certain path you usually do that with session state. A prefetch can easily advance your state when there is no real action by the user yet.</p>
<h4>The background conundrum</h4>
<p>Prefetching works in the background, you do not see it. The browser displays the initially requested page as if nothing happened. You can print some debug messages into your pages and you probably will not get what you expected.</p>
<p>If you set a counter to your session and echo the value to your page it probably will skip a beat, every time. If you suspect your application is doing this it will drive you absolutely mad.</p>
<p>You will need log files recording in the background. The log files should finally convince you that the browser sends requests within seconds which causes your application to set a different state as well as advance the counter. Consequently a next button in your form may lead to an unexpected result because your session state is already past that event.</p>
<p>There are ways you can handle this behavior in your application but overall I believe it is easier to simply avoid the &#60;meta&#62; or &#60;link&#62; tags if you work with forms and session state.</p>
<h3>Browser cache handling</h3>
<p>Now the next problem is quite a riddle. You can look up all sorts of word combinations in Google but nothing will lead to anything explaining why. There have been bug reports in Firefox and some funny stories about encoding and such but none really matches. Finally, here is something that may lead to the cause of the problem and the solutions.</p>
<h4>Duplicate, double log entries</h4>
<p>This also works in the background and rears its ugly head in the log files. What are the odds, eh?</p>
<p>This case has interesting pattern. If you look at the HTTP_REFERER in the first entry it is the previous page as expected but the referer in second entry is the same page. With this pattern it looks like the browser for some reason reloaded the page; refering to iself.</p>
<p>In most cases also try to test with different browsers. In this case Firefox 3.x, Internet Explorer and Opera did not cause a second entry. Only Firefox 4.x, Google's Chrome and Apple's Safari. Why are they requesting the page twice?</p>
<p>Looking at the Apache server log you will not see anything new, only what you already know. The requests are clean GET requests followed by the 200, Ok response. You can use a network monitor (sniffer) to analyze the IP packets, nothing new either. In terms of Firefox and if it were something like a prefetch you should see a message like&#160;<strong>X-Moz: prefetch</strong> in the request.</p>
<p>I did some additional tests with the help of sessions. I was curious if the page I see is the page from the first or from the second request. I added timestamp values to the session and then printed the session values to the page. Surprise, surprise: I cannot see the second timestamp in the same page. I see the second timestamp when I call the next page, a clear sign that the value has been added later.</p>
<h4>XHTML 1.1 versus XHTML 1.0</h4>
<p>Browsers act differently on the doctype and you may have changed the doctype from <strong>XHTML 1.0 Transitional</strong> to <strong>XHTML 1.1</strong>. If you did see what happens if you revert back or simply use a different doctype.&#160;Especially when you have XHMTL 1.1!&#160;</p>
<p>I have looked at quite some documents but all clues, reasonable or not, did not indicate why a browser should have to reload the page when you have DOCTYPE XHTML 1.1. There are some hints about some difference in the configuration of the server and the document like charset or cache and expiration settings. These things apparently cause some browsers to think something is wrong requesting anew with different settings.</p>
<p>The problem is probably not the doctype you are using but the cache settings.</p>
<h4>Pragma: No-cache</h4>
<p>Take a look into caching for your web page and confirm that whatever expiration setting or date you set that it is really included in the header.</p>
<p>If you see a <strong>Pragma: No-cache</strong> in your server's response something is not setup properly; it should not be there. This directive is intended for browsers (in the request) and not the server (in the response).</p>
<p>Some sources suggest it is coming from the web server, in many cases Apache. Looking through all the settings and more googling you will not find it there, though. It is coming from PHP.</p>
<p>If you are working with sessions you will have to take a closer look at this function: <a title="Link to documentation at php.net" href="http://us.php.net/manual/en/function.session-cache-limiter.php" target="_blank">session_cache_limiter</a>. This function handles some cache settings&#8212;by default! As soon as you start your session with <em>session_start</em> your cache limiter settings are placed into the header.</p>
<p>You can still overwrite some of the settings but remove one is not easy. There is a header_remove() function but only in the latest php versions. But I think you should take control of caching yourself, i.e. eliminating this pragma directive and the cache limiter function altogether.</p>
<p>Once I have completely disable cache limiter with <strong>session_cache_limiter(false)</strong>, in my index.php, two things happend: a) the double entries are gone and b) suprise, the browsers suddenly respected the expiration date and did not even bothered to contact the server. Silence in my sniffer!</p>
<p>Now, I control all cache settings myself within the application, no more defaults messing up browser. Still the question remains, why browsers react to badly.</p>
<p>If you work with Zend Framework and use <strong>Zend_Session</strong> you don't have to set the function. You can pass it in the configuration for Zend_Session::start(). The config has an option for cache_limiter which you can set to false or whatever setting you like. I believe the other settings are just like the php function.</p>
<h3>Page Refresh F5</h3>
<p>Now that I have my cache problems under control I&#160;thought everything will be find, but there is still one more funny thing causing double entries.</p>
<p>Firefox for some reason is requesting the page twice when you hit F5, i.e. reload the page. Reloading the very same page also takes considerably longer to load in Firefox than with other browser.</p>
<h4>Broken image links</h4>
<p>Looking at the log files I see that Firefox for some reason is sending the second request for images&#160;<strong>Accept: image/png,image/*;q=0.8,*/*;q=0.5</strong>. At first I had no clue what this is all about. It took a while but it suddenly hit me: I had a broken link for a tiny little image I somehow forgot and overlooked. Firefox 4.x as probably the only browser cares to send another request triggering my application to process everything twice and even the browser to take twice as long. Not sure if this is a bug with Mozilla but once I fixed the broken link the log finally showed what I was looking for&#8212;just one entry for one request, not two, double, twice or even more. Almost!</p>
<h3>Browser Add-ons</h3>
<p>Last but not least we have the add-ons in our modern browsers. Turns that some of them also trigger a reload of refresh. Since I noticed less problems in vanilla Firefox installations like, my visitors, I disable most of obvious culprits early on. Once I added one by some indeed cause the same neightmare. Not sure if I really want to dig into this mess but for reliable testing I think I just revert to browsers without any add-ons.</p>
<h3>Conclusion</h3>
<p>Sometimes I wish we only had one browser, like back in the days with Internet Explorer. Bad thought, bad thought! But still the new wave of browsers, HTML5/CSS3, add-ons and now the latest new releases causes new problems in more than just one corner. That is probably the main problem here.</p>
<p>It is almost impossible to be up-to-date on all changes and when or how they are relevant, i.e. if you have to make changes on your site and pages.</p>
<p>One lesson is certainly to do your testing with plain vanilla browser installations and handle the caching correctly on the server side. Once that all is verified and working properly we can go on and do some funky stuff like add-ons.</p>
<p>I also wonder what monitoring tools like Google Analytics are doing with such duplicate reloads. Seriously, are they recording everything twice?</p><img src="http://feeds.feedburner.com/~r/AWD-KnowledgeBase/~4/1xyR0iL9M7w" height="1" width="1"/>]]></content:encoded>
    </item>
    <item>
      <title>Zend Cache Quick and Easy</title>
      <description><![CDATA[The Zend_Cache classes can be used in many ways but I found there is a particular quick and easy way to implement it. If you have data you get over and over that rarely changes there is real quick and easy way with this method. Check it out.]]></description>
      <pubDate>Mon, 12 Mar 2012 13:13:36 -0500</pubDate>
      <link>http://www.adrianworlddesign.com/Knowledge-Base/Zend-Framework/Helpful-Tips/Zend-Cache-Quick-and-Easy</link>
      <guid>http://www.adrianworlddesign.com/Knowledge-Base/Zend-Framework/Helpful-Tips/Zend-Cache-Quick-and-Easy</guid>
      <content:encoded><![CDATA[<p>I bet you have data you query from a database or another source that rarely changes and even then you can live with it for, lets say, 24 hours. If so, you might want to think about the <strong>Zend_Cache</strong> class. Especially for cases like this there is a particular <strong>quick and easy</strong> way to setup and <em>implement Zend_Cache</em> for caching small chunks of data you use over and over again.</p>
<h3>Quick and easy</h3>
<p>Where you place this method is up to you and if you implement this setup for Zend_Cache as a static method (like I will demonstrate in this tutorial) is also up to you.</p>
<p>It seems that people have some difficulties with Zend_Cache because they have to deal with the fact that we have to provide a frontend and a backend. As long as you don't want to implement crazy stuff you can create a simple method that does great things for you. For our simple method we need to worry about and provide only three things:</p>
<h4>Core - Frontend</h4>
<p>First off, the <strong>Core</strong> in the frontend. Don't bother about what the <em>Core</em> is or does; it's just what you need to get started. If you look at the <a title="Zend Cache Core documentation" href="http://framework.zend.com/manual/en/zend.cache.frontends.html" target="_blank">Zend_Cache_Core documentation</a> you will find the sentence " It is a generic cache frontend and is extended by other classes." Nuff said, I think.</p>
<h4>File - Backend</h4>
<p>Second we have <strong>File</strong> for the backend which simply means that we want to save the data into a file. To make this work you have to provide a filepath for a directory where the cache files will reside.</p>
<h4>Lifetime</h4>
<p>The lifetime simply means how long the data is valid. The value is in second, i.e. 60 is a minute, 3600 an hour and so on.</p>
<h3>The Code</h3>
<p>Now that we have all the information here is the code how you can craft your method in bare minimum. My method actually has a few more things in it but that would not be quick and easy anymore.</p>
<dl class="code_example"> <dd>public static function initializeCache(</dd><dd>&#160;&#160;$lifetime = 3600, $frontend = 'Core', $backend = 'File)</dd><dd> {</dd><dd>&#160;&#160;&#160;&#160;$cache_dir = '/path/to/your/local/cache/directory'</dd> <dd>&#160;&#160;&#160;&#160;$automatic_serialization = true;</dd> <dd>&#160;&#160;&#160;&#160;$frontendOptions = compact('lifetime', 'automatic_serialization');</dd> <dd>&#160;&#160;&#160;&#160;$backendOptions  = compact('cache_dir');</dd> <dd>&#160;&#160;&#160;&#160;</dd> <dd>&#160;&#160;&#160;&#160;return Zend_Cache::factory(</dd> <dd>&#160;&#160;&#160;&#160;&#160;&#160;$frontend,$backend,$frontendOptions,$backendOptions);</dd> <dd>}</dd></dl>
<p>Now all you have to do is get the object and you can save and load data to the cache object. Quick and easy.</p>
<dl class="code_example"> <dd>$cache = MyClass::initializeCache(60);</dd> <dd>$cache_id = 'data1'; </dd><dd>$data1 = $cache-&#62;load($cache_id); </dd><dd>if (empty($data1)) { </dd> <dd>&#160;&#160;$data1 = array(1=&#62;'my data'); <span class="code_description">// usually this would be your DB method</span></dd> <dd>&#160;&#160;$cache-&#62;save($data1,$cache_id); </dd> <dd class="code_description">&#160;&#160;// next time (within 60 seconds) the data will come from the cache</dd> <dd>}</dd> </dl>
<p>Once you have the object you can do a lot of other things but for the quick and easy part that is all you need for caching with Zend_Cache. Hope you like it.</p><img src="http://feeds.feedburner.com/~r/AWD-KnowledgeBase/~4/3n58D7Rzs4Q" height="1" width="1"/>]]></content:encoded>
    </item>
    <item>
      <title>Unique ID per request</title>
      <description><![CDATA[This document has information for how to generate/make or actually get a unique request ID for each webpage. It requires an Apache web server but with it you can have a unique request id for your PHP, ASP, Ruby and whatnot application. No need to handle or find it in Zend, Wordpress, Joomla or any other framework. With Apache you have a unique request ID generator at your fingertips.]]></description>
      <pubDate>Mon, 05 Mar 2012 14:07:55 -0600</pubDate>
      <link>http://www.adrianworlddesign.com/Knowledge-Base/Web-Hosting/Apache-Web-Server/Unique-ID-per-request</link>
      <guid>http://www.adrianworlddesign.com/Knowledge-Base/Web-Hosting/Apache-Web-Server/Unique-ID-per-request</guid>
      <content:encoded><![CDATA[<p>If you need <em>a unique request ID for each webpage</em> and you run an <strong>Apache</strong> web server you are all set. There is no need to generate or create a unique request id yourself in PHP, ASP, Ruby or whatever.</p>
<h3>mod_unique_id</h3>
<p>Apache has a module labeled <a title="Apache documentation for unique_id module" href="http://httpd.apache.org/docs/current/mod/mod_unique_id.html" target="_blank">mod_unique_id</a> that provides a unique request id for each webpage access from your website. If the module is loaded (active) you can find the unique ID in your server and execution environment information. In PHP this would be&#160;the global <strong>$_SERVER</strong>&#160;array as follows</p>
<p class="code_example">$_SERVER['UNIQUE_ID']</p>
<p>Not sure about other languages but I guess you will know where to look for it.</p>
<p>If you already know and have the <strong>UNIQUE_ID</strong> on one system but it is  empty and not available on another system then it is not loaded  (commented out) in your <strong>httpd.conf</strong> file. The module is usually not loaded by default.</p>
<p>Note in the documentation that is says <em>This feature isn't supported on Windows NT.</em> I have an XAMPP server on Windows XP and it available so I guess they refer to the good ol' NT 4.0 times. If you have Apache on Windows just give it a try if you don't have it yet. Again it is usually not loaded by default.</p>
<h4>Language and framework independent</h4>
<p>Because this is coming from your Apache web server there is no need to generate a unique ID with <a title="PHP uniqid manual" href="http://php.net/manual/en/function.uniqid.php" target="_blank">uniqid</a> in PHP. There is also no need to handle or find it in Zend, WordPress, Joomla, Drupal, Cake or any other framework.</p>
<p>The same is true, of course, for other web languages like Perl, ASP, Ruby or whatever language you are using.</p><img src="http://feeds.feedburner.com/~r/AWD-KnowledgeBase/~4/zWdE-In0yOo" height="1" width="1"/>]]></content:encoded>
    </item>
    <item>
      <title>Trailing slashes</title>
      <description><![CDATA[If you have trailing slashes in your website this might be a good thing and the default but for certain web applications this could lead to some problems with duplicate content. Unfortunately I cannot tell you how to avoid it in your application but at least make you aware of it.]]></description>
      <pubDate>Thu, 01 Mar 2012 11:34:45 -0600</pubDate>
      <link>http://www.adrianworlddesign.com/Knowledge-Base/seo/Watch-out-for/Trailing-slashes</link>
      <guid>http://www.adrianworlddesign.com/Knowledge-Base/seo/Watch-out-for/Trailing-slashes</guid>
      <content:encoded><![CDATA[<p>It might be a good thing when your webpages have links with a <strong>trailing slash</strong> and the default but for certain web applications this could lead to some <strong>problem with duplicate content</strong>.</p>
<p>You will have trouble with duplicate content you may not even be aware off&#8212;but search engines are.</p>
<h3>Duplicate Content and SEO</h3>
<p>So, why should you care about duplicate content in search engines?</p>
<p>Unfortunately duplicate content does not mean your page gets listed twice and pushes the competition further down the <em>ranks in search engine results page</em>, aka <abbr title="Search Engine Results Page">SERP</abbr>. Because this would naturally happen search engines have to take care of this problem.</p>
<p>It is not clear if this also has an impact on your overall rank in search results but one thing is sure: Google recognizes the duplicate content.</p>
<p>There are hints and rumors that Google may not only <em>penalize your webpages</em> but your whole website for presenting the same content more than once; unless you specifying a <a title="Link to Google and information about the canonical link element" href="http://www.google.com/support/webmasters/bin/answer.py?answer=139394" target="_blank">canonical link</a> in your document's head.</p>
<h3>Parameter links</h3>
<p>You probably wonder, "What are you talking about?" To understand what I am talking about we have to dig deeper into how the web evolved.</p>
<p>Well, it all began with the desire to show dynamic content and the parameters in the URL. These parameters would be the links with the question mark and trailing information which looks something like this</p>
<dl class="code_example"><dd>/index.php?id=343&#38;name=adrian-world</dd></dl>
<p>From a search engine's point of view this is not necessarily a bad thing or problem to work with. Nevertheless search engines are not very fond of this for one simple reason. The parameters can be used for so many things and can result in so many different results. In the begin they were mostly used to reorder or filter content of one single page.</p>
<p>Many search engines decided to simply strip the parameters. If the parameters are used to simply reorder or filter the content&#8212;like in a table&#8212;then the different results are not worth indexing. In the example above they would only request the /index.php file no matter how many different links they discovered with different parameters.</p>
<p>Unfortunately, along came the developers who funneled all request through one single index.php. Take one single php file and give each page an id and  you are basically able to present an infinite number of unique and  different pages. This works fine for users and browsers but many search  engines simply stripped the parameters and never indexed the individual  pages.</p>
<h3>SEO friendly links</h3>
<p>Once people realized that the search engines are not indexing the different pages they came up with what is known as <strong>SEO friendly links</strong>.</p>
<p>Now just so we are clear: the human readable text is not the real trick&#8212;spider bots and indexing engines don't care about human readability. <strong>Unique and properly formatted links</strong>, i.e. avoiding the parameters, defines a SEO friendly link.</p>
<p>If a human readable text benefits the ranking may or may not be true but the real benefit is really to <span style="text-decoration: underline;">get your webpages indexed in the first place</span>.</p>
<h3>Back to the future</h3>
<p>While SEO friendly links are great because our pages are indexed and probably are ranked higher due to the readable text we are confronted with a new problem. We thought we went into the future but actually:</p>
<p>SEO friendly links are a step back in time and how web servers with static HTML pages behave. Lets go back to the beginnings of the web and look at how a typical static website and server setup may look like:</p>
<dl class="code_example"> <dt>server file setup: <strong>/index.html</strong></dt><dd class="code_description">&#8594; possible other link: <strong>/</strong></dd> <dt>server file setup: <strong>/about/index.html</strong></dt><dd class="code_description">&#8594;&#160;possible other link: <strong>/about/</strong></dd> <dt>server file setup: <strong>/contact/index.html</strong></dt><dd class="code_description">&#8594;&#160;possible other link: <strong>/contact/</strong></dd> </dl>
<p>With this simple structure we can set links like in the file setup but also note that second possible other link and particularly the trailing forward slash. Why does it work and result in a valid response from the web server?</p>
<p>Because the web server recognizes the slash as a directory and it is usually configured to look for a file named index.html in such a directory if no filename was provided; as simple as that.</p>
<h3>Why again is this a problem?</h3>
<p>This trailing slash will be a problem when we have a web application that creates SEO friendly links and does not care about requests <span style="text-decoration: underline;">with</span> the trailing slash.</p>
<p>In a web application we usually don't have any html files. A web application that creates SEO friendly links does not even need or care about any file extensions like a .html or .htm. If you have a link like /about it will understand the request and respond the very same way as our static example above with a link like /about/index.html or /about/.</p>
<p>So, what about search engines? What if a search engine is curious about the missing html extension? Is this /about link a file and webpage (like about.html) or a directory (hence more like /about/)? It probably will not send a request for the first case and an about.html file but how about a /about/ request just to see what happens? How will your web application respond?</p>
<p>There are a couple problems that could go wrong. First the web application may complain that information is missing and returns a 4xx error or worse it results and ends in a crash of the application. Second it could simply ignore the missing information and respond like there is no trailing slash. This second case is exactly where we will have a problem with duplicate content and possibly SEO.</p>
<p>A search engine will get a valid 200 OK response from both requests and it will just so happen that the content is identical.</p>
<p>If you have <strong>Google's Webmaster Tools</strong> it should be ease to spot these problems in the <strong>Diagnostics</strong> section and <strong>HTML suggestions</strong> and some duplicate meta descriptions or title tags.</p>
<h3>Send a redirect</h3>
<p>To avoid this duplicate my framework handles this by sending an 301 redirect to the same link but without the trailing slash. Feel free to give it try here.</p><img src="http://feeds.feedburner.com/~r/AWD-KnowledgeBase/~4/1QdFKh_Ohjg" height="1" width="1"/>]]></content:encoded>
    </item>
    <item>
      <title>html for dummies</title>
      <description><![CDATA[This document is an attempt to explain some of the main things you should know about HTML. For many people HTML (similar to HTTP) is exactly four letters and a little hard to grasp and understand what it really means. As the standard for writing a web page and creating a browser it is the main thing that links all the pages in the World Wide Web (WWW) and we use when we surf the Internet.]]></description>
      <pubDate>Wed, 29 Feb 2012 08:17:35 -0600</pubDate>
      <link>http://www.adrianworlddesign.com/Knowledge-Base/Web-Standards/Things-about-Hypertext/html-for-dummies</link>
      <guid>http://www.adrianworlddesign.com/Knowledge-Base/Web-Standards/Things-about-Hypertext/html-for-dummies</guid>
      <content:encoded><![CDATA[<h3>What this is about</h3>
<p>For most people <abbr title="Hypertext Markup Language">HTML</abbr> is exactly four letters (similar to <a title="Link to HTTP for dummies" href="http://www.adrianworlddesign.com/Knowledge-Base/Web-Standards/Things-about-Hypertext/http-for-dummies">HTTP</a>) and a little hard to grasp and understand what it really means or does. In this page I will explain some of <em>the main things you should know about the HTML web standard</em>.&#160;</p>
<p>I will keep this on a general level and not go into details about the HTML versions and differences or the <strong>markup language</strong> itself. In fact, there is not really much you have to know on a general level about HTML as a standard.</p>
<h3>What this is not about</h3>
<p>As just mentioned this is not about the <strong>markup language</strong> itself, i.e. how you write documents in HTML. There is way&#160; too much to know for that and there are already excellent resources out there if you like to learn and write HTML.</p>
<p>The best and most of all free resource is <a title="Link to www.w3schools.com" href="http://www.w3schools.com/html/default.asp" target="_blank">W3Schools</a> which has basically everything there is to know about writing HTML. So, if you like to know what HTML is read this page first and then if you like to know how to write HTML head over to W3Schools. Oh, and thanks for visiting.</p>
<h3>About the Standard</h3>
<p>First thing you need to know and understand is that HTML is a standard.</p>
<p>"<em>What is a standard good for?"</em> you ask. Well, two things mainly. With a standard everybody should know (a) how to use a certain thing but also (b) how to implement this thing.</p>
<p>As a practical example and on one side we have the people who make a web browser and with the standard they know what they have to implement into their web browser software. On the other side we have the web designers and developers who thanks to the standard know how to write a web page.</p>
<p>If the web browser does not conform to a standard the web developer will have a problem to write a web page. On the other side if the web developer creates a web page without writing proper code the web browser will have a problem displaying the page. Only when both sides comply to the standard we see a properly functioning web page and have a perfect browsing experience.</p>
<h4>The Internet Explorer Standard</h4>
<p>If you heard about problems with Internet Explorer and its compliance this is exactly one of this areas where we have (or had) a disconnect between these two sides. To be fair here, we have to acknowledge that most of these problems are gone in the current IE versions and not everything was historically so bad in the beginning--when Microsoft had a de facto monopoly. There was basically just one browser and all designers and developers followed this Internet Explorer Standard.</p>
<h4>The Browser Standard Rallies</h4>
<p>The problems basically surfaced when Mozilla with Firefox came along and others like Opera, Safari and Chrome began their rallies as well. They all made a pledge to conform to the "official" standard as much as possible and revealed Microsoft's interpretation of the standard in <abbr title="Internet Explorer">IE</abbr>.</p>
<p><em>Does this mean that all browsers act the same way now? </em>Unfortunately no!</p>
<p>Still today, for some rules in the standard it is not exactly clear how it has to be interpreted. Hence, some browsers have their own interpretation and there are little differences. Also the change to HTML5 (Version 5) is causing some problems because not all browsers are updating the standard in the same pace.</p>
<h3>Main Characteristics</h3>
<p>Second thing you need to know is the main characteristics of the markup language. What does the standard do or help to achieve.</p>
<p>Speaking striktly about the standard, the main characteristic of HTML lies in the two characters ML which stands for <em>markup language</em>. Markup language in its most simple terms means how to describe or annotate text.</p>
<p>Try it for yourself with an simple example: Take a magazine, newspaper or book and try to describe the text. You will end up with things like title, paragraph, chapter, head, foot, body and whatnot. This is markup and thanks to the HTML standard we all have the rules to <em>markup</em> the text for creating a web page. The word <em>markup</em> here and in the previous sentence is italic or emphasized. I used markup language to make it look that way.</p>
<p>If you like to see markup language in full swing and you look at this on a PC simply right click on your mouse and depending on your browser you will see something like "View Page Source". Once you click that you should get a new page or window and see HTML, the markup for that particular web page.</p>
<p>Which leaves us puzzling with HT, the first two characters in HTML, which stands for <em>hypertext</em>. Hypertext can be seen as &#252;bertext&#8212;there is something over or beyond the (current) text. Probably overlooked by many people but actually one of the main characterics about web pages are the links. Not surprisingly they are in fact called hyperlinks. Thanks to links we have more text, text over and beyond the current text. Back in the 1960s, i.e. long before the Internet, somebody by the name of Ted Nelson thought about such a concept. Instead of calling it overtext or beyondtext he coined the term hypertext.</p>
<p>When we say <em>we surf the Internet</em> and spend hours and hours by just jumping from one page to the next&#8212;by using these <em>hyperlinks</em>&#8212;we see and hopefully enjoy <em>hypertext</em>. If you like you can call it <em>hypertexting</em>, but don't expect people to understand what you are saying.</p>
<p>In my opinion, the <em>hyperlink</em> is really the most revolutionary thing that Tim Berners-Lee created when he introduced HTML and the World Wide Web.</p><img src="http://feeds.feedburner.com/~r/AWD-KnowledgeBase/~4/4qIJpeKgAKw" height="1" width="1"/>]]></content:encoded>
    </item>
    <item>
      <title>Access denied on system files</title>
      <description><![CDATA[Do you try to update a system file like the hosts file in drivers etc and you get an access denied although everything looks fine? Well here are some clues what is wrong with Windows, i.e. why you get the message and why you are unable to update the file.]]></description>
      <pubDate>Tue, 28 Feb 2012 13:03:58 -0600</pubDate>
      <link>http://www.adrianworlddesign.com/Knowledge-Base/Microsoft-Windows/Common-problems/Access-denied-on-system-files</link>
      <guid>http://www.adrianworlddesign.com/Knowledge-Base/Microsoft-Windows/Common-problems/Access-denied-on-system-files</guid>
      <content:encoded><![CDATA[<p>You have this computer with some Windows operating system client and everything works fine. Then you have some internal network or another reason to add a DNS name to the <strong>hosts file</strong> in %systemroot%<strong>system32driversetc</strong>.</p>
<p>No big deal you thought. Wrong! You have a major problems and you cannot find the problem and solution.</p>
<p>Unfortunately <em>there is no single cause and quick solution</em> for this problem; hence, we need to check a few things (step by step) until we have fixed this problem. So, make sure you read everything from top till buttom or until you get it to work.</p>
<h3>Access denied</h3>
<p>So, lets start. The first thing you encounter is the <strong>Access Denied</strong> message when you like to save the update in the file. Even worse you are not even allowed to temporarily save the file with another name in the same folder. Actually, you discover that you have neither change nor delete access to that folder at all.</p>
<p>Of course, you think about the Read-only thing which for some stupid reason responds with an Access Denied message. You check your hosts file properties, everything is fine. Next you look at your security settings for the file. You check the <em>Administrators</em> group and you check your membership, i.e. that you are indeed an <strong>Administrator</strong>. Everything is exactly as it should be. You even use the <em>Effective Permissions</em> to verify. All clear but still: You have no update priviledges to your folder and files.</p>
<h3>Folder is Read Only</h3>
<p>Somehow you wonder about inheritance and if something is wrong with the parent folders in your system32 tree. Although, if there were some funny security settings you should have seen them in the Security tab through inheritance. Nevertheless, you check and there in the properties window you see <strong>Read-only</strong> for the folder and the funny message <strong>only applies to files in folder</strong>. No wonder you think and you try unchecking that setting.</p>
<p>Once you hit OK next you see is some warning followed by some other message that administrative priviledges are required. You even get a button to proceed with such priviledges. Nothing really happens though and ultimately the Read-only setting is still there and access is still denied. Awesome!</p>
<h4>Windows Explorer mishaps</h4>
<p>Lets step back for a moment and talk about the Windows Explorer. The famous Explorer is probably not one of the worst applications in the world but close. I think Microsoft never really thought about completely overhauling or better yet write the application from scratch. Not to mention that it is still integrated and linked somehow with <em>Internet Explorer</em> and the whole host window, but that is another story.</p>
<p>The mishap here is that if something changes like a folder or a file, i.e. goes wrong with the file system, our dear Windows Explorer has no clue what is going on and in desperation it makes a wild guess. Actually not that wild, just two guesses.</p>
<p><strong>Access denied</strong> is the preferred choice for a direct action (like open, save) on a object and <strong>Read-only</strong> in the properties window for an object. Object here means a file or a folder.</p>
<p>Simple as that: If Windows Explorer encounters a problem with an object its response is one of these two. If it is in fact Access denied it does not care, it does not know it cannot tell. Same with read-only in the properties window. Oh something is not as planned, lets mark it Read-only. Easy as pie!</p>
<h4>Command line dir and attrib</h4>
<p>We don't really need Windows Explorer to see things different and hopefully a little bit clearer. There is our command line program, <strong>cmd.exe</strong>. Unfortunately looking at the folder with <em>dir</em> and <em>attrib</em> does not show anything suspicious. Furthermore, <strong>attrib</strong> does not show any read-only marks, not even system attributes!</p>
<h3>User Account Control (UAC)</h3>
<p>I really lost contact, meaning indepth knowledge, with the latest versions of Windows but I have to use Vista and Windows 7. So, I am not sure what the exact levels and results are with User Account Control but this is where we will find our problem&#8212;if you have checked everything I mentioned before but you still have no access.</p>
<p>Microsoft introduced this concept, I believe, mostly or only for the dummy home user and the Home Editions. As if the security settings and other measures weren't enough. So, they came up with this <strong>User Account Control (UAC)</strong> that basically goes far above and beyond any security settings. Worst of all, it flies under the radar of most tools&#8212;yes including Windows Explorer. Nobody sees what is going on, everybody is blind.</p>
<p>Windows Explorer is totally oblivious to its existance as are all the command line tools. Well done!</p>
<p>UAC shields the operating systems and most of the files and folders from random changes. Don't get me wrong, I think this is not entirely a bad thing, but why create something new and not update the tools? All the pop ups and questions for every little change are the result of UAC. For executable files this seem to work fine however it does not go well if you access the files directly in the system folder.</p>
<h3>Conclusion</h3>
<p>If you have to make changes to the system folders directly you have to turn UAC completely off. UAC shields access beyond the current file level security.</p>
<p>Depending on your confidence level and what sort of programs you are likely to run and use on your computer you should set UAC back to the previous level.&#160;</p><img src="http://feeds.feedburner.com/~r/AWD-KnowledgeBase/~4/l9e_w79CRxY" height="1" width="1"/>]]></content:encoded>
    </item>
    <item>
      <title>Delete a remote branch</title>
      <description><![CDATA[How do you delete a remote branch on GitHub. If all has failed for you, too, then check this out. It really was a tough nut to crack but I finally managed to solve the problem. Time to share the information here in this document.]]></description>
      <pubDate>Mon, 27 Feb 2012 12:28:23 -0600</pubDate>
      <link>http://www.adrianworlddesign.com/Knowledge-Base/git/Helpful-tips/Delete-a-remote-branch</link>
      <guid>http://www.adrianworlddesign.com/Knowledge-Base/git/Helpful-tips/Delete-a-remote-branch</guid>
      <content:encoded><![CDATA[<p>How do you delete a remote branch on GitHub? I found quite a few answers but all have failed. The problem is most likely the use of <strong>origin</strong>.</p>
<p>In tutorials and examples the use of <em>"origin"</em> is very convenient but it is ambiguous and  quite fatal if you don't know what <em>"origin"</em> is or stands for.</p>
<h3>Push origin</h3>
<p>Lets go through some of the answers I found and who failed. The first answer that sounded promising looked like this</p>
<dl class="code_example"><dd>$ git push origin :serverfix</dd> <dd class="code_description">// serverfix in this example would be the branch name</dd></dl>
<p>I found this in the <em>stackoverflow</em> forum and it got so many votes that I thought it must work but look what I got instead for my "library" branch</p>
<dl class="code_example"><dd>$ git push origin :library</dd><dd>fatal: 'origin' does not appear to be a git repository</dd><dd>fatal: The remote end hung up unexpectedly</dd> <dd class="code_description">// there is another command but I got the very same result</dd> <dd>$ git push origin --delete library</dd> </dl>
<p>That doesn't look good, does it?</p>
<p>From my first experiments with git I knew that 'origin' must or should exist because that's how all the examples work. It is unfortunate that it is used in all the documentation and examples you find everywhere and the reference above from the forum is exactly such an example.</p>
<p>However, I already changed a few things with additional directories and branches. So, <em>"What is origin</em>?" has become the new question in the house.</p>
<h3>What is origin?</h3>
<p>The answer is in the <strong>Git User's Manual</strong> which comes with your git installation and found in the Git directory at&#160;<em>./doc/git/html/user-manual.html</em>. Somewhere in there you will find this sentence:</p>
<blockquote>Note that the name "origin" is just the name that git uses by default to refer to the repository that you cloned from.</blockquote>
<p>At first that does not help but it dawned on me very quickly that 'origin' is probably just an alias and I definitely had to use something else and probably the actual repository name.</p>
<h3>A git repository representation</h3>
<p>As the error said <em>"'origin' does not appear to be a git repository"</em> and the name for my repository was of course something else: library&#8212;yes, the same as the branch but I don't believe that was the problem.</p>
<p>Anyway I tried the follow with the familiar result at first</p>
<dl class="code_example"><dd>$ git push library :library</dd> <dd>fatal: 'library' does not appear to be a git repository</dd> <dd>fatal: The remote end hung up unexpectedly</dd> <dd class="code_description">// and I also tried this but same result</dd> <dd>$ git push library.git :library</dd> </dl>
<p>Somehow I knew I was on the right track, though. Just what is the correct representation for the repository in this command?</p>
<p>Somehow I also understood that a repository with GitHub is using a different string and in your account you can find a ssh link. The following for the library was mine and note the colon [:].</p>
<dl class="code_example"><dd>git@github.com:awd-git/library.git</dd> <dd class="code_description">// and how I used it</dd> <dd>$ git push ssh://git@github.com:awd-git/library.git :library</dd><dd>ssh: connect to host github.com:awd-git port 22: Bad file number</dd><dd>fatal: The remote end hung up unexpectedly</dd> </dl>
<p>We are not there yet but the response looked familiar. The colon triggered a port connection request. So, what about a regular path, I thought.</p>
<dl class="code_example"> <dd>$ git push ssh://git@github.com/awd-git/library.git :library</dd> <dd>To ssh://git@github.com/awd-git/library.git</dd> <dd> - [deleted]         library</dd></dl>
<p>Now I got it. A quick check on the webpage and sure enough the branch was finally gone on the server. Now, I am not sure if the ssh is really need or if it would work with html, too. I think it just requires some sort of valid representation for your library on the host. There are other representations that I have found like "remote_host" and "choose_remote_name"; maybe one of these would work as well.</p>
<h3>Conclusion</h3>
<p>If you read the documentation and examples you will find things like <code>git push origin master</code> a lot. It gives the impression that this is some local to remote representation which it is not. In the examples 'origin' is very convenient but it is ambiguous and quite fatal for newbies to git what 'origin' is or stands for, I think.</p><img src="http://feeds.feedburner.com/~r/AWD-KnowledgeBase/~4/a5eYry43UQk" height="1" width="1"/>]]></content:encoded>
    </item>
    <item>
      <title>Installing Zend Guard Loader</title>
      <description><![CDATA[This page shows you how to install Zend Guard Loader on a Linux instance in Amazon's elastic compute cloud AWS EC2. It requires a few simple steps and you should be good to go and have your PHP code protected in the cloud.]]></description>
      <pubDate>Wed, 22 Feb 2012 09:55:40 -0600</pubDate>
      <link>http://www.adrianworlddesign.com/Knowledge-Base/Web-Hosting/Amazon-Web-Services/Installing-Zend-Guard-Loader</link>
      <guid>http://www.adrianworlddesign.com/Knowledge-Base/Web-Hosting/Amazon-Web-Services/Installing-Zend-Guard-Loader</guid>
      <content:encoded><![CDATA[<p>Installing Zend Guard Loader is a simple process. You copy the module file into a directory add a few lines to the php configuration and reload your httpd web server configuration.</p>
<p>Because I already have a document explaining this steps for CentOS (most Linux instances for Amazon's AWS EC2 are based on CentOS/RedHat) I will link you to the document <a title="Installing Zend Guard Loader on CentOS" href="http://www.adrianworlddesign.com/Knowledge-Base/Web-Hosting/Zend-Guard/Zend-Guard-Loader-on-CentOS">Zend Guard Loader on CentOS</a>. The only thing missing is probably how to upload the module to the cloud. For that see the hint below.</p>
<p>Note that the parent webpage for the other document will have an overview to documents about Zend Guard. If you run into some troubles they will help you find and fix the problem.</p>
<h3>Upload the module</h3>
<p>The tricky part is probably uploading the module file to you Linux instance and there are several methods which, unfortunately, will not go into detail here. I assume you have to upload other docouments anyway and already found your solution. If you haven't found a way check out my document for how to <a title="How to enable FTP in EC2" href="http://www.adrianworlddesign.com/Knowledge-Base/Web-Hosting/Amazon-Web-Services/Enable-FTP-in-EC2">Enable FTP in EC2</a>. That should do the trick and give you all you need to upload other documents to your cloud server.</p>
<p>&#160;</p><img src="http://feeds.feedburner.com/~r/AWD-KnowledgeBase/~4/EVosz75D17k" height="1" width="1"/>]]></content:encoded>
    </item>
    <item>
      <title>List of countries</title>
      <description><![CDATA[Looking for a list with all countries/territories in the world? Maybe sorted by continents or regions? This page has some information and a collection of links to pages where you can get a list with all the countries or territories in the world and sorted by continent.]]></description>
      <pubDate>Wed, 22 Feb 2012 07:47:21 -0600</pubDate>
      <link>http://www.adrianworlddesign.com/Knowledge-Base/Web-Standards/General-information/List-of-countries</link>
      <guid>http://www.adrianworlddesign.com/Knowledge-Base/Web-Standards/General-information/List-of-countries</guid>
      <content:encoded><![CDATA[<p>If you are looking for a list with all the countries or territories in the world sorted by continent then you will appreciate this page. Especially if you need them in your PHP or Zend Framework project as an array. It will actually work in other frameworks or CMS like WordPress, Joomla or Drupal.</p>
<p>The information and links here have either a download ready list with countries or you can get some information for how to create your own country lists in your project yourself. For developer or designer this might be a more interesting solution or way to get an array with countries in PHP.</p>
<h3>Download Lists</h3>
<p>First of the easy download version. I created a website where you can select and download your own list with countries/territories and continents or regions in a few different ways (including different languages). You can either copy/paste the lists or download a file in a few different formats. Following is the link to this website</p>
<ul class="list_elements">
<li><a title="Link to my Country Lists project" href="http://www.countries-list.info/Download-List" target="_blank">Countries List</a> Website</li>
</ul>
<p>The lists with countries and territories in that page are created with the Zend Framework and you can actually use the framework in your project for free. Just see the following.</p>
<h3>Create with Zend Framework</h3>
<p>If you are a web developer or web designer and looking for some programmatic way to integrate a country list on the fly with PHP into a form you might want to take a look at this.</p>
<p>The Zend Framework has a class named Zend_Locale which allows you to create your own country list. I have written two documents explaining in one how to get the list and the second how to actually sort the list by continents. Unfortunately the Zend_Locale does not have a method to do it all in once.</p>
<ul class="list_elements">
<li><a title="Link to document for getting an array list with countries" href="http://www.adrianworlddesign.com/Knowledge-Base/Zend-Framework/Helpful-Tips/Array-List-with-Countries">Array List with Countries</a></li>
<li><a title="Link to document for sorting an array list with countries" href="http://www.adrianworlddesign.com/Knowledge-Base/Zend-Framework/Helpful-Tips/Sorting-the-Country-List">Sorting the Country List</a></li>
</ul>
<p>For how to get the Zend Framework take a look at <a title="Link to Zend Framework download page" href="http://framework.zend.com/download" target="_blank">Zend</a> directly.</p><img src="http://feeds.feedburner.com/~r/AWD-KnowledgeBase/~4/Z1rghDP_sEM" height="1" width="1"/>]]></content:encoded>
    </item>
    <item>
      <title>Sorting the Country List</title>
      <description><![CDATA[This is a tutorial complementing another document. That document is about how to get a long list of countries you can use in your application. This list generated with the Zend Framework, in particular the Zend_Locale class. Zend_Locale is everything you need to get such a list and since all classes work independent you can virtually use it anywhere you have PHP. The list has a shortcoming, the list is not sorted by continent. This document will help you with the final steps to sort the country list by continents or territories.]]></description>
      <pubDate>Tue, 21 Feb 2012 08:36:36 -0600</pubDate>
      <link>http://www.adrianworlddesign.com/Knowledge-Base/Zend-Framework/Helpful-Tips/Sorting-the-Country-List</link>
      <guid>http://www.adrianworlddesign.com/Knowledge-Base/Zend-Framework/Helpful-Tips/Sorting-the-Country-List</guid>
      <content:encoded><![CDATA[<p>If you are looking for only a list with countries sorted by continents or regions ready for download you should visit my <a title="Countries List website" href="http://www.countries-list.info/Download-List" target="_blank">Countries List</a> project web site.</p>
<p>With the other website you don't need to know anything about programming. You can generate and download lists with countries sorted by continent or region in a few formats and ready to go in your project. Even with translations in many languages.</p>
<p>This webpage is mainly about programming in PHP and <em>how to sort a list from Zend_Locale</em> in the <strong>Zend Framework</strong> library.</p>
<h3>Extending Zend_Locale</h3>
<p>This document is a tutorial complementing the document  <a title="Link to document for getting an array list with countries" href="http://www.adrianworlddesign.com/Knowledge-Base/Zend-Framework/Helpful-Tips/Array-List-with-Countries" target="_blank">Array List with Countries</a> and tells you how to sort the country list we receive with  Zend_Locale from the Zend Framework.</p>
<p>The list we get with that method has a little shortcoming, though. The list is wildly sorted and you have no option for sorting the countries in the array by continent. Well, here is help and again: Welcome, to the power of Zend_Locale.</p>
<p>If you have not read the other document and don't know how to get the country list, read  <a title="Link to document for getting an array list with countries" href="http://www.adrianworlddesign.com/Knowledge-Base/Zend-Framework/Helpful-Tips/Array-List-with-Countries" target="_blank">Array List with Countries</a> first. I am not going to repeat certain things; you have been warned!</p>
<h3>Territory versus Region</h3>
<p>The secret to solve our riddle are two other $type arguments named <strong>TerritoryToRegion</strong> and the upsyturvy <strong>RegionToTerritory</strong>.</p>
<p>Before we go any further we have to understand two things here. What is a territory and what a region.</p>
<h4>What is a territory?</h4>
<p>Territory roughly means a country but also other things. It is not exact science.</p>
<h4>What is a region?</h4>
<p>Also not exact science but regions are collections of countries or other regions. The problems is here that regions can have  children or, of  course, parents. The top dog is [001] =&#62; World.</p>
<p>Why those names? Look at the name for the Zend class: it is named Zend_Locale. The main purpose of  Zend_Locale is not providing the country list, that is just a byproduct.  Zend_Locale offers many lists about many things which are grouped in regions and territories. It  just so happens that a country is grouped in one or more regions but also acts as a territory. If you like to know more about Zend_Locale here is <a title="Link to Zend the the Zend_Locale documentation" href="http://framework.zend.com/manual/en/zend.locale.functions.html" target="_blank">the official documentation</a>.</p>
<p>You can get a list with everything except countries the same way as the country list described in the other document. Simply use a different $value argument</p>
<dl class="code_example"><dt class="code_description">// use 1 as the $value argument<br /></dt><dd>$territoryArray = Zend_Locale::getTranslationList('Territory','en_US',1);</dd><dt class="code_description">// and this is what you get</dt><dd> Array (     [001] =&#62; World     [002] =&#62; Africa     [003] =&#62; North America     [005] =&#62; South America     [009] =&#62; Oceania     [011] =&#62; Western Africa     [013] =&#62; Central America     [014] =&#62; Eastern Africa     [015] =&#62; Northern Africa     [017] =&#62; Middle Africa     [018] =&#62; Southern Africa     [019] =&#62; Americas     [021] =&#62; Northern America     [029] =&#62; Caribbean     [030] =&#62; Eastern Asia     [034] =&#62; Southern Asia     [035] =&#62; South-Eastern Asia     [039] =&#62; Southern Europe     [053] =&#62; Australia and New Zealand     [054] =&#62; Melanesia     [057] =&#62; Micronesian Region     [061] =&#62; Polynesia     [062] =&#62; South-Central Asia     [142] =&#62; Asia     [143] =&#62; Central Asia     [145] =&#62; Western Asia     [150] =&#62; Europe     [151] =&#62; Eastern Europe     [154] =&#62; Northern Europe     [155] =&#62; Western Europe     [172] =&#62; Commonwealth of Independent States     [200] =&#62; Czechoslovakia     [419] =&#62; Latin America and the Caribbean     [830] =&#62; Channel Islands     [QO] =&#62; Outlying Oceania     [QU] =&#62; European Union ) </dd></dl>
<h3>Linking Regions to Territories</h3>
<p>Now lets get everything together.</p>
<p>Our country list from the other page was pulled with type Territory  and value 2.  What we have to do next is pull basically the same list again but this time with <strong>TerritoryToRegion</strong>. Instead of a list with names we  have the countries (plus everything else) with their associated region. With RegionToTerritory we have  more or less the same just the  other way around.</p>
<p>Once we have all our lists with countries, regions, territories and some understand about all the terms we can finally go to work and link our countries to the appropriate regions. Which is a little bit tricky.</p>
<p>Lets take for example Mexico [MX]. When we look at the list from TerritoryToRegion we see MX =&#62; 013 and looking at the regions list this is [013] =&#62; Central America. Looking at the RegionToTerritory list we see that 013 is in a region [019] =&#62; Americas but also [003] =&#62; North America and [419] =&#62; Latin America and the Caribbean.</p>
<p>If you look around some more you will find all sorts of combinations which leads me to say: Do whatever you want, the possibilities are almost endless.</p>
<p>You can create a great amount of sorting here in almost any way possible. The only thing you need to look out for are duplicates because some countries are listed directly in various regions but through inheritance even more. Ultimately they are all linked to the top dog [001] =&#62; World!</p><img src="http://feeds.feedburner.com/~r/AWD-KnowledgeBase/~4/OxExkkhHMTo" height="1" width="1"/>]]></content:encoded>
    </item>
    <item>
      <title>Array List with Languages</title>
      <description><![CDATA[Looking for a list with all languages in this world? Maybe even in all these different languages? Then welcome to the power of Zend_Locale. This page has some information how you can get an array list with all languages in the world with PHP and the Zend Framework.]]></description>
      <pubDate>Tue, 21 Feb 2012 08:25:25 -0600</pubDate>
      <link>http://www.adrianworlddesign.com/Knowledge-Base/Zend-Framework/Helpful-Tips/Array-List-with-Languages</link>
      <guid>http://www.adrianworlddesign.com/Knowledge-Base/Zend-Framework/Helpful-Tips/Array-List-with-Languages</guid>
      <content:encoded><![CDATA[<p>Are you looking for a list with some data about languages? Preferably in a PHP array and even with the translations in all these languages?</p>
<h3>The power of Zend_Locale</h3>
<p>If you don't know <strong>Zend Framework</strong> then a hearty welcome to Zend Framework and especially the power of <strong>Zend_Locale</strong>. If you feel comfortable with a large and somewhat complex application framework you will love Zend_Locale and what it can do for you in terms of a language list. Especially when you need the list in exactly these different languages. In this little tutorial I will show you how to work with Zend_Locale and get a list with almost all the languages in this world in almost all these languages.</p>
<h3>First some background</h3>
<p>According to t<a title="Zend Framework - Introduction Zend_Locale" href="http://framework.zend.com/manual/en/zend.locale.introduction.html" target="_blank">he documentation</a> <em>"Zend_Locale is the Frameworks answer to the question, "How can the same application be used around the whole world?"</em> ... and some more. Besides all the main purposes in <strong>Zend_Locale</strong> there is this little hidden treasure which might be overlooked by most people. Zend_Locale uses an impressive amount of XML lists with all sorts of data and you are basically able to pull aggregated lists of this data. Including a list of all languages but also continents, territories and countries. Check out my other page about the <a title="Link to Zend_Locale about countries and territories" href="http://www.adrianworlddesign.com/Knowledge-Base/Zend-Framework/Helpful-Tips/Array-List-with-Countries">Countries Lists</a>.</p>
<p>As with all Zend classes you don't need a full installation and implementation of the framework. You just need to make sure you get the path right. The Zend_Locale class can be used independently and most methods are  implemented as static methods, i.e. you don't even have to create an  object of the class. Check out <a title="Link to ZF classes as stand alone objects" href="http://www.adrianworlddesign.com/Knowledge-Base/Zend-Framework/Helpful-Tips/ZF-classes-as-stand-alone-objects">ZF classes as stand alone objects</a> for more info.</p>
<h3>The easy solution</h3>
<p>To get a list from Zend_Locale you will use a method named "getTranslationList". You can pass three arguments:</p>
<dl class="code_example"><dd>$type - This is the name for the list you want [required]</dd> <dd>$locale - The language you want [optional] - default is your browser/system default</dd> <dd>$value - Some types allow detailed lists which can be selected with this [optional]</dd> </dl>
<p>This is almost all you need to know to get your list with all languages in the world. So, what are the values we need for the arguments? First is the type where we say that we like to get the languages. Second you set a locale to get the list in the language you want or leave it empty to get it in the browser's default language. No value is require for the value argument.</p>
<dl class="code_example"><dt class="code_description">// just use a different locale to get different languages<br /></dt><dd>$languageArray = Zend_Locale::getTranslationList('language','en_US');</dd></dl>That's basically all you need to get your language list. Easy as pie.
<p>A list with all the supported types for Zend_Locale can be found in the <a title="Zend Framework - Using Zend_Locale" href="http://framework.zend.com/manual/en/zend.locale.functions.html" target="_blank">official documentation</a>; search the page for getTranslationList.</p>
<h3>Download a list</h3>
<p>Unfortunately at this time I don't have a list yet ready for download. I have plans to create a web site similar to the <a title="Link to my Country Lists project" href="http://www.countries-list.info/" target="_blank">Countries List</a> website where you can generate your own language lists. Once that is complete I will have a link here to that site.</p>
<p>As for now you need Zend_Locale and  what this page is all about. This page will show you how to create a languages list.</p><img src="http://feeds.feedburner.com/~r/AWD-KnowledgeBase/~4/LGRkBrN1Os4" height="1" width="1"/>]]></content:encoded>
    </item>
    <item>
      <title>Zend Guard loading problems</title>
      <description><![CDATA[It is a little bit tricky it seems to see if there was a problem to load a ZendGuardLoader.so module. This document has some information for how to see if Zend Guard is loaded properly on your system and of course how to fix it if some problems exists.]]></description>
      <pubDate>Sat, 04 Feb 2012 13:29:47 -0600</pubDate>
      <link>http://www.adrianworlddesign.com/Knowledge-Base/Web-Hosting/Zend-Guard/Zend-Guard-loading-problems</link>
      <guid>http://www.adrianworlddesign.com/Knowledge-Base/Web-Hosting/Zend-Guard/Zend-Guard-loading-problems</guid>
      <content:encoded><![CDATA[<p>I assume you have searched in Google, Bing, Yahoo or other search engine because you see this <strong>Zend Guard run-time support is missing</strong> titled webpage on your website and I hope you will find some help here.</p>
<p>Besides this webpages I have more pages about this problem so look out for them in this chapter; use the breadcrumbs list above or the Prev/Next links at the end of the document. This page is just to see and test if the <strong>Zend Guard Loader</strong> has been found and loaded properly.</p>
<p><span style="text-decoration: underline;">Note:</span> Because I don't have a system with PHP &#60;5.3 running I cannot see or test what that will look like but I guess the results will be somewhat similar. Most important, though, if you still use 5.2 or lower you will need the <strong>Zend Optimizer</strong> and not the <strong>Zend Guard Loader</strong>.</p>
<h3>Simple loading problems</h3>
<p>Now lets look at the two simple loading problems; well, actually three.</p>
<h4>32-bit versus 64-bit module</h4>
<p>First lets see what you get when you use the wrong version, i.e. the 32-bit instead of the 64-bit on a host system. Unfortunately the two libraries use the exact same name; hence it can be an easy mistake to use the wrong module file.</p>
<p>If you have a Linux system and restart your httpd daemon you won't see a thing on the command line but you can see the problem in two places. One place is the /var/log/httpd/error_log where you should see this line</p>
<dl class="code_example"> <dd>Failed loading /usr/lib64/httpd/modules/ZendGuardLoader.so:</dd><dd>&#160;&#160; /usr/lib64/httpd/modules/ZendGuardLoader.so: wrong ELF class: ELFCLASS32</dd> </dl>
<p>I don't have a Windows system but assume you might see a similar message for this in the application's Event Log somewhere when you restart <abbr title="Internet Information Service">IIS</abbr>. For Apache (incl. WAMP, XAMPP et al) you should have a log directory in the /apache folder and find an error.log file in it.</p>
<p>The other place is with php and the php command line interface. This works the same on Windows but you might need to go to the directory where your PHP executable is. It depends on your setup, i.e. path information, though.</p>
<dl class="code_example"> <dd>[root@centos ~]# php -v</dd> <dd>Failed loading /usr/lib64/httpd/modules/ZendGuardLoader.so: /usr/lib64/httpd/modules/ZendGuardLoader.so: wrong ELF class: ELFCLASS32</dd> <dd>PHP 5.3.3 (cli) (built: Jan 11 2012 19:53:01)</dd> <dd>Copyright (c) 1997-2010 The PHP Group</dd> <dd>Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies</dd> </dl>
<p>Now if you get this <em>Failed loading</em> message in either place this is easy to fix. You have the wrong module version and you simply copy/replace the proper version file.</p>
<h4>Wrong place or type</h4>
<p>The second case is actually two separate loading causes but the result is equal. If you have the wrong path information in the config (or the file in the wrong place) or misspelled you will see the following error:</p>
<dl class="code_example"> <dt class="code_description">// in the httpd/error_log </dt><dd>Failed loading /usr/lib64/httpd/modules/ZendguardLoader.so: </dd> <dd>&#160;&#160; /usr/lib64/httpd/modules/ZendguardLoader.so: cannot open shared object file: No such file or directory</dd> <dt class="code_description">// and with php</dt> <dd>[root@centos ~]# php -v</dd> <dd>Failed loading /usr/lib64/httpd/modules/ZendguardLoader.so: /usr/lib64/httpd/modules/ZendguardLoader.so: cannot open shared object file: No such file or directory</dd> <dd>PHP 5.3.3 (cli) (built: Jan 11 2012 19:53:01)</dd> <dd>Copyright (c) 1997-2010 The PHP Group</dd> <dd>Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies</dd> </dl>
<p>As you can see all it takes on Linux is a lower-case typo in the configuration where I wrote <strong>ZendguardLoader</strong> instead of ZendGuardLoader. The file in this case could not be found by the OS. I don't have to tell you how to fix this, I reckon.</p>
<p>The good news in this second case is that your configuration is working. If you don't see an error message or a Zend Guard Loader message with PHP but you are sure you have a module file then your configuration is not working. In this case see the other document <a title="How to test if ZendGuardLoader.so is installed and working" href="http://www.adrianworlddesign.com/Knowledge-Base/Web-Hosting/Zend-Guard/Verify-Zend-Guard-installation">How to test if ZendGuardLoacer.so is installed</a>.</p>
<p>If this solved your problem, great! If not then look out for the other documents in this chapter.</p><img src="http://feeds.feedburner.com/~r/AWD-KnowledgeBase/~4/eHFF5qBLPJw" height="1" width="1"/>]]></content:encoded>
    </item>
    <item>
      <title>Envelope Sender in badmailfrom list</title>
      <description><![CDATA["Sorry, your envelope sender is in my badmailfrom list (#5.7.1)" is an error you may see when you send an email over a SMTP relay agent. This page has some information about when and why you see the error plus, of course, the remedy for this problem.]]></description>
      <pubDate>Thu, 02 Feb 2012 08:57:09 -0600</pubDate>
      <link>http://www.adrianworlddesign.com/Knowledge-Base/Web-Hosting/GoDaddy/Envelope-Sender-in-badmailfrom-list</link>
      <guid>http://www.adrianworlddesign.com/Knowledge-Base/Web-Hosting/GoDaddy/Envelope-Sender-in-badmailfrom-list</guid>
      <content:encoded><![CDATA[<p>Don't you agree? Some error messages are just plain annoying nonsense. This one is another perfect example and can be found when you send an email:</p>
<dl class="code_example"><dd><em>sorry, your envelope sender is in my badmailfrom list (#5.7.1).</em></dd></dl>
<p>I don't think this error exclusively applies to the web hosting company GoDaddy because it looks like the default error message in a product they use, but they are certainly in the crossfire here.</p>
<p>This <strong>badmailfrom list</strong> message might be meaningful and actually useful if you are the administrator of the SMTP server but as a hosting company this error rings through to their clients.</p>
<p>Whatever the reason, following is an explanation why the error for your <strong>envelope sender</strong> actually shows up when you send an email.</p>
<h3>SMTP Relay</h3>
<p>The error is a problem with the SMTP relay and in case of GoDaddy they have some special setup. They use two different relay setups depending on where you are connecting from.  It's so special that not even their support is capable of creating documents that show up in their knowledge base or Google. I have not found it where you think you will find it and it requires a lot of guessing. Beats me why they are not interested in clearly communicating the proper setup.</p>
<h4>External relay</h4>
<p>If you have an account with GoDaddy and wish to send an email&#160;from your application&#160;but you are hosting the application <span style="text-decoration: underline;">outside</span> their network you can do that. This is basically what you do with your email client. In that case you will use their relay SMTP agent as follows:</p>
<dl class="code_example"><dd>SMTP Server:&#160;smtpout.secureserver.net</dd><dd class="code_description">This relay requires a username and password which is any of your GoDaddy email accounts</dd></dl>
<p>There is a tiny little problem, though. This is almost exclusively intended for your email client software like Microsoft's Outlook, Mozilla's Thunderbird and others. They expect that the sender address in the email head&#8212;<strong>envelope sender</strong>&#8212;is an account that matches one of your GoDaddy email domains. If this email sender is not one of your email accounts with GoDaddy it is automatically treated as in "my <strong>badmailfrom list</strong>."</p>
<p>So far so good if you only use it with your email client because that's the regular case. If you have a web application with a sign up form you may want to use the SMTP relay a little bit differently, though.</p>
<p>If you have a form and once the user hits the submit button you may want to send an email to some email inbox. You may also want to set the email address provided by the requester as the sender's email address; as if s/he send the email. With that you could easily hit the reply button in your email client and send your answer to the request and also easily add it to your address book.</p>
<p>That's not in GoDaddy's mind and when you will run into the error above. You cannot use the user's email address to send the email to your whatever email account over their agent. Although you provide a valid user account and password they verify the sender's email address, too.</p>
<h4>Use Reply-To instead</h4>
<p>So first, make sure you use your account as the sender in the email head. Second, you can use the user's email address in the Reply-To field. With the user's email address in that field you can still hit the reply button when you receive the email and respond to the request. Adding the sender to your contacts will probably not work, though.</p>
<h4>Internal relay</h4>
<p>If you have your web application on a server with GoDaddy you have to use a different configuration. If you use this configuration for sending emails from your web application you will face another problem.</p>
<p>Your application will timeout and get a "Connection time out" error. We can only speculate but I think they simply don't have a routing from the internal network to their outside SMTP relay address. It beats me why not.</p>
<p>Because setting up the internal relay has a similar problem but different error message I have a separate document. The config and potential problem with that error message is in the document titled <a title="Link to Administratively denied error message" href="http://www.adrianworlddesign.com/Knowledge-Base/Web-Hosting/GoDaddy/Administratively-denied">Administratively Denied</a>.</p><img src="http://feeds.feedburner.com/~r/AWD-KnowledgeBase/~4/aHSI9VWFJr4" height="1" width="1"/>]]></content:encoded>
    </item>
    <item>
      <title>http:// in a nutshell</title>
      <description><![CDATA[If you only need a really quick note what HTTP is this hopefully is what you are looking for. This page has a short description of the Hypertext Transfer Protocol (HTTP) as the title says HTTP in a nutshell. ]]></description>
      <pubDate>Thu, 26 Jan 2012 08:41:11 -0600</pubDate>
      <link>http://www.adrianworlddesign.com/Knowledge-Base/Web-Standards/Things-about-Hypertext/http-in-a-nutshell</link>
      <guid>http://www.adrianworlddesign.com/Knowledge-Base/Web-Standards/Things-about-Hypertext/http-in-a-nutshell</guid>
      <content:encoded><![CDATA[<p>This is a simple and quick explanation of what the Hypertext Transfer Protocol (HTTP) is and does. If you need just a little more information than what fits into a nutshell you can read the next page <a title="Link to HTTP for dummies" href="http://www.adrianworlddesign.com/Knowledge-Base/Web-Standards/Things-about-Hypertext/http-for-dummies">http:// for dummies</a>. Nevertheless, this document <em>http:// in a nutshell</em> lets you almost talk like a pro because there is not much you need to know.</p>
<h3>First: The Abbreviation</h3>
<p>HTTP stands for <em><strong>H</strong>yper<strong>T</strong>ext <strong>T</strong>ransfer <strong>P</strong>rotocol</em>. The three words are explained next.</p>
<h3>Second: The protocol</h3>
<p>The P defines HTTP as a protocol. A protocol can be explained as a standard, a convention, a definition, a set of rules or whatever works for you in this regard. The protocol helps multiple parties understand how they have to implement or work with the process defined in the protocol. This protocol is just a small part of a larger collection of protocols commonly known as the <em>Network Protocols</em>.</p>
<h3>Third: The Transfer</h3>
<p>The protocol defines how a document (webpage) is transfered in a network between computer systems. It begins with the initial contact (open a session), request/send/receive the document and finally ending the connection (close the session). We can also note here that HTTP is known as a <strong>stateless</strong> protocol. By definition there is no state linking pages (stateful) on a protocol level.</p>
<h3>Fourth: Hypertext</h3>
<p>Although there are other things (like cookies, style sheets, scripts, images, graphics, video etc.) HTTP is primarly about a webpage as a document which is a collection of text, also known and refered to as the <strong>content</strong>. The text has links to other documents which is also: more text. <strong>Hyper means over or beyond</strong> and therefore, the links in a webpage are not just links to another webpage they are links <em>over</em> or <em>beyond</em> to more text. The Internet is not only a huge collection of webpages it is a huge collection of hypertext.</p>
<h3>Summary</h3>
<p>HTTP in a nutshell: <em>It is the convention how hypertext gets transferred in a network</em>.</p><img src="http://feeds.feedburner.com/~r/AWD-KnowledgeBase/~4/1QGcP9VlVq8" height="1" width="1"/>]]></content:encoded>
    </item>
    <item>
      <title>NoCase option not supported</title>
      <description><![CDATA[This document has some background information about the warning "[warn] RewriteCond: NoCase option for non-regex pattern '-d' is not supported and will be ignored" you may see in your apache error_log.]]></description>
      <pubDate>Tue, 24 Jan 2012 10:13:46 -0600</pubDate>
      <link>http://www.adrianworlddesign.com/Knowledge-Base/Web-Hosting/Apache-Web-Server/NoCase-option-not-supported</link>
      <guid>http://www.adrianworlddesign.com/Knowledge-Base/Web-Hosting/Apache-Web-Server/NoCase-option-not-supported</guid>
      <content:encoded><![CDATA[<p>I think you looked at your apache error_log and found the following warning:</p>
<blockquote><em>"[warn] RewriteCond: NoCase option for non-regex pattern '-d' (-l and -s) is not supported and will be ignored"</em></blockquote>
<p>Now you have searched for some explanation and I am glad you clicked my website because the answer about this <strong>NoCase</strong> is actually simple&#8212;in this case.</p>
<h3>mod_rewrite</h3>
<p>As you may have guessed and already know the problem is with your rewrite rule and one or more lines RewriteCond in your .htaccess file. Now you wonder: why?</p>
<p>Well then, lets look at the <a title="Apache mod_rewirte documentation" href="http://httpd.apache.org/docs/current/mod/mod_rewrite.html" target="_blank">mod_rewrite documentation</a>.&#160;Go to the section for the <strong>RewriteCond Directive</strong>.&#160;If you go to the bottom of that section you will find this line:</p>
<blockquote>Remember: CondPattern is a perl compatible regular expression with some additions:</blockquote>
<p>This line does not look like much but under listing 3. you see the explanation for the <strong>nocase|NC (no case)</strong> flag. Pay attention here to the last sentence!</p>
<blockquote>This makes the test case-insensitive - differences between 'A-Z' and 'a-z' are ignored, both in the expanded TestString and the CondPattern. This flag is effective only for comparisons between TestString and CondPattern. It has no effect on filesystem and subrequest checks.</blockquote>
<p>Did you see it?<strong> "no effect on filestystem"</strong></p>
<p>The parameter-like '-d' (directory) '-f' (regular file) and '-l' (symbolic link) are your&#160;<strong>CondPattern</strong>&#160;for the perl compatible regular expression in the directive.</p>
<p>Unfortunately it is not explicitely written but these CondPatterns already are not case-sensitive. Hence, you can savely remove the [NC] from your rewrite condition if it is for filesystem requests.&#160;</p><img src="http://feeds.feedburner.com/~r/AWD-KnowledgeBase/~4/EsuQKc1jRjk" height="1" width="1"/>]]></content:encoded>
    </item>
    <item>
      <title>Attribute rel with nofollow</title>
      <description><![CDATA[I don't know what is holding them up but the support for rel="nofollow" attribute in an anchor element created in the navigation view helper menu is still an open issue in the Zend Framework. If you like to know how to add the path yourself here is how and where.]]></description>
      <pubDate>Sat, 21 Jan 2012 10:39:33 -0600</pubDate>
      <link>http://www.adrianworlddesign.com/Knowledge-Base/Zend-Framework/Helpful-Tips/Attribute-rel-with-nofollow</link>
      <guid>http://www.adrianworlddesign.com/Knowledge-Base/Zend-Framework/Helpful-Tips/Attribute-rel-with-nofollow</guid>
      <content:encoded><![CDATA[<p>Let me first say that this is not about bickering or complaining. This is simply about helping and providing a solution for a problem that has already been addressed but unfortunately is not implemented yet.</p>
<p>I guess the problem with the open issue is someting we have to accept and deal with in free <abbr title="Open Source Software">OSS</abbr> and free participation or contribution to a project.</p>
<h3>Current issue status</h3>
<p>The problem is about the support for the <strong>rel="nofollow"</strong> attribute in an anchor element. Although you can define the attribute in Zend Framework it is not actually printed in the navigation view helper menu. This is still an open issue in the Zend Framework as of&#160;12/30/2011. I found two trackers for this&#160;</p>
<p>First we have an issue ZF-7733 asking for support of the rel attribute in Zend_Navigation_Page. While I quite understand why it was denied I wonder why there is no progress in ZF-9300.</p>
<p>Although, I agree why the suggested patch has not been implemented because there are more options than just the "nofollow".&#160;If you can't wait for the official support and need <strong>rel="nofollow"</strong> in your menu links here's what you have to do.</p>
<h3>Adding rel attribute</h3>
<p>The frustrating part with this open problem is that the following is already available and makes you wonder why does it not work?</p>
<dl class="code_example"> <dd class="code_description">// if you already have your navigation page object</dd> <dd>$navPage-&#62;setRel(array('nofollow'=&#62;'nofollow'));</dd> <dd class="code_description">// or the config you would add to a navigation page object</dd> <dd>array(</dd><dd>&#160;&#160;'uri'=&#62;'/your-link',</dd><dd>&#160;&#160;'label'=&#62;'My Link',</dd><dd>&#160;&#160;'rel'=&#62;array('nofollow'=&#62;'nofollow')</dd><dd>);</dd></dl>
<p>Note in both cases that rel expects an array and that the index is a string with the same value, i.e. you cannot pass an array with numeric index.</p>
<p>So far so good. The problem at this point is that it only works for meta tags but up to version 1.11.11&#160;the navigation helper doesn't do anything with it for links (the &#60;a&#62; anchor element). Here come the actual fixes.</p>
<h3>Updating htmlify</h3>
<p><strong>Note:</strong>&#160;Before you begin a little warning. <em>You should usually not make changes in the main library.</em> If you do and later upgrade your Zend Framework make sure to verify the current status of the fixes. You've been warned!</p>
<p>Following are the two fixes required to have a rel attribute with the value in your anchor element. You have to update a method named <strong>htmlify</strong> and unfortunately in two places.</p>
<p>First we have an abstract class named <strong>Zend_View_Helper_Navigation_HelperAbstract</strong> and depending on your version the htmlify method should be around line 675. The second class is <strong>Zend_View_Helper_Navigation_Menu</strong> (line ~209) actually overridding <em>htmlify</em>&#160;in the abstract helper class.</p>
<p>Now you add the following in both methods; I did it just before the return.&#160;I basically replicated what you see in the <strong>$href</strong> condition and the menu class.</p>
<dl class="code_example"> <dd class="code_description">// does page has rel</dd> <dd>if ( $rel = $page-&#62;getRel() ) {</dd> <dd>&#160;&#160;&#160;&#160;$attribs['rel'] = $rel;</dd> <dd>}</dd> </dl>
<p>That should do it and add the rel="nofollow" string to the anchor element. In fact it should add whatever you add to rel in the navigation page. What could be added is a check to see if the value is allowed according to the <a title="HTML5 Link types specification" href="http://www.w3.org/TR/html5/links.html#linkTypes" target="_blank">HTML5 Linktypes</a> specification.</p><img src="http://feeds.feedburner.com/~r/AWD-KnowledgeBase/~4/-mBKHXHCcVc" height="1" width="1"/>]]></content:encoded>
    </item>
    <item>
      <title>External Links</title>
      <description><![CDATA[This document has a collection of links with basic information about Linux.]]></description>
      <pubDate>Fri, 20 Jan 2012 13:42:02 -0600</pubDate>
      <link>http://www.adrianworlddesign.com/Knowledge-Base/Linux/Basics/External-Links</link>
      <guid>http://www.adrianworlddesign.com/Knowledge-Base/Linux/Basics/External-Links</guid>
      <content:encoded><![CDATA[<p>This page is a collection of valuable sources with information about the Linux operating system and the distributions.</p>
<h3>Distributions</h3>
<p>Following are the links to the official documentations for the listed Linux distributions.</p>
<h4>Red Hat</h4>
<p>Red Hat has a nice overview page for all the documentation.</p>
<p>Main Link: <a title="Link to redhat.com and the product documentation" href="http://docs.redhat.com/docs/en-US/index.html" target="_blank">Red Hat documentation</a></p>
<p>In the main section you will find the links to all the various RH products. The links will send you to an overview page with all versions and links to various types of formats. This would be the <a title="Red Hat Enterprise Linux documentation" href="http://docs.redhat.com/docs/en-US/Red_Hat_Enterprise_Linux/index.html" target="_blank">Red Hat Enterprise Linux</a> overview link.</p>
<p>You can also use the left side menu to find your product and within in the version. <strong>Look out for</strong> the small icon next to each document which will allow you to get the different document types including PDF.</p>
<h4>CentOS</h4>
<p>As far as I know and understand there is not dedicated documentation for CentOS and you can or have to use the Red Hat documentation.</p><img src="http://feeds.feedburner.com/~r/AWD-KnowledgeBase/~4/34HQwvoYJkY" height="1" width="1"/>]]></content:encoded>
    </item>
    <item>
      <title>How to get all your modules</title>
      <description><![CDATA[If you use modules in your Zend Framework application you might wonder how to get the names of all your modules. It seems there is no universal getAllModules() method anywhere in the framework. There is an easy solution to this problem. This page will help you get the names of all your modules and controllers.]]></description>
      <pubDate>Tue, 17 Jan 2012 10:25:41 -0600</pubDate>
      <link>http://www.adrianworlddesign.com/Knowledge-Base/Zend-Framework/Helpful-Tips/How-to-get-all-your-modules</link>
      <guid>http://www.adrianworlddesign.com/Knowledge-Base/Zend-Framework/Helpful-Tips/How-to-get-all-your-modules</guid>
      <content:encoded><![CDATA[<p>If you like to find all registered modules in your Zend application you have to use a little trick and use the <strong>getControllerDirectory()</strong> method. It will list the module directories and with it the controllers. For a more extensive answer please read on.</p>
<h3>Working with modules in Zend Framework</h3>
<p>If you have a little application in Zend Framework you will have all your controllers and actions as well as the models in the default application directory. If you write a larger application you want a modular approach and not add everything into this default application. The framework basically allows as many modules as you like.</p>
<p>As a side note: It is not obvious but internally <em>the default <strong>application</strong> is a module</em>, too.</p>
<p>Now lets see what happens with our modules when run our Zend web application. You start the whole ZF application with the following code:</p>
<dl class="code_example"><dt class="code_description">// Create application, bootstrap, and run</dt> <dd>$application = new Zend_Application(</dd> <dd>&#8195;APPLICATION_ENV,</dd> <dd>&#8195;APPLICATION_CONFIG . '/application.ini'</dd> <dd>);</dd> <dd>$application-&#62;bootstrap()-&#62;run();</dd></dl>
<p>If you look at the <strong>run()</strong> method in the bootstrap class you will find two calls; one goes to <strong>$front-&#62;getDefaultModule()</strong> and the other to <strong>$front-&#62;getControllerDirectory()</strong>.</p>
<p>Now the big question: Aside from the default module, how do I get a list with the names of all my modules? There is no universal method for that, like <strong>getAllModules()</strong> in the framework. There is a surprisingly easy and actually not so unexpected answer to this question.</p>
<h3>First some background</h3>
<p>Knowledge is power so before I present the solution I provide some background. Feel free to jump ahead, though.</p>
<p>According to the <a title="Zend Framework Documentation - Front Controller" href="http://framework.zend.com/manual/en/zend.controller.front.html" target="_blank">documentation</a> "<em>Each module should be in its own directory and mirror the directory structure of the default module</em>" and with this a controller directory and at least one controller class. First we see the hint that the default application is a module but second we need at least one controller class. When we look at the front controller we see two interesting methods: One is named addModuleDirectory($path) and the other getModuleDirectory($module).</p>
<p>Now first about the getter method. If you pass in the module name you get the path to that module. If you pass in [null] you will get the path of the active module, not a list! Bummer, I know! However, the add method gives a little hint.</p>
<p>Method addModuleDirectory($path) according to the doc "<em>allows you to pass the name of a directory containing one or more module directories. It then scans it and adds them as controller directories to the front controller.</em>"</p>
<p>Two interesting things we have to note here: a) we can have more than just one module directory and b) did you notice the phrase "<em>it then scans and adds them <strong>as controller directories</strong> to the front controller</em>"? That's right, the front controller keeps track not so much of all the modules but all the controller directories in the framework! Sweet, ain't it?</p>
<h3>The easy solution</h3>
<p>The front controller has a method called getControllerDirectory($name). What is not obvious here is that the $name argument means a module's name. Every module should have its own controller directory and the front controller keeps track of them. Better yet, if you don't pass a parameter to the method you will not get the currently active module but a list of all controller directories, indexed by the module's name! The method returns an array and the index keys are your names of all your modules no matter where they are.</p>
<dl class="code_example"><dt class="code_description">// get the front controller instance</dt><dd>$front = Zend_Controller_Front::getInstance();</dd><dd>$cd = $front-&#62;getControllerDirectory();</dd><dd>$moduleNames = array_keys($cd);</dd><dt class="code_description">// print the result</dt><dd>print_r($moduleNames);</dd><dd style="color: #22f;"> array (<br /> &#160;&#160;[0] =&#62; default<br /> &#160;&#160;[1] =&#62; mo_admin<br /> &#160;&#160;[2] =&#62; mo_blog<br /> &#160;&#160;[3] =&#62; mo_catalog<br /> )</dd></dl>
<p>So, that's how you get all your module names.</p>
<p>I have a getAllModules() method now. How and where you implement your method is up to you. Enjoy!</p><img src="http://feeds.feedburner.com/~r/AWD-KnowledgeBase/~4/YJkJ4d6iCAo" height="1" width="1"/>]]></content:encoded>
    </item>
    <item>
      <title>Array List with U.S. States</title>
      <description><![CDATA[If you need an array list (code snippet) ready for copy and paste that has all the US states in a list for your PHP or Zend Framework project then you are lucky here. With some little changes it probably works for other languages, too. US here means of course the United States of America or USA.]]></description>
      <pubDate>Sat, 31 Dec 2011 11:22:25 -0600</pubDate>
      <link>http://www.adrianworlddesign.com/Knowledge-Base/Zend-Framework/Helpful-Tips/Array-List-with-US-States</link>
      <guid>http://www.adrianworlddesign.com/Knowledge-Base/Zend-Framework/Helpful-Tips/Array-List-with-US-States</guid>
      <content:encoded><![CDATA[<h3>US states list</h3>
<p>So, you need a php array list with all the US states? Right on, I have the list ready for you in a php array and even as a static method you can add to a class object.&#160;</p>
<p>If you click the following link you will get a simple txt document with the US states list. This makes it real easy for you to copy/past the list into your PHP project. You can see how the array in the link will look like below.</p>
<ul class="list_elements">
<li> <a title="Array with US states" href="http://www.adrianworlddesign.com/downloads/usStates.txt">US-States.txt</a></li>
</ul>
<p>If you like to read why I have this copy/paste list then see below. Actually it is more about search engines. Without it they would not index this page. That's how SEO works, I guess.</p>
<h3>PHP Array</h3>
<p>I have this page and list because I had a problem and maybe you have a similar problem.</p>
<p>You work with the Zend Framework (or another CMS like Wordpress, Joomla or just a plain PHP project). You project requires a form with a select element where users can select the US state they live in. Therefore, you need this: a <em>PHP array with the United States (US)</em>.</p>
<p>If you work with the Zend Framework you might think there is a solution with Zend_Locale, just like the one for the <a title="How you get an array with all countries in Zend Framework" href="http://www.adrianworlddesign.com/Knowledge-Base/Zend-Framework/Helpful-Tips/Array-List-with-Countries">country list</a>. Unfortunately there is none and revert to Google to find either a list or some array ready for copy/pase.</p>
<p>Hence, I was looking for an <strong>array</strong> (not just a list) ready with all these <strong>United States</strong> in America (USA). What I found was web pages with all sorts of lists but a page where you can easily copy/paste a ready to go PHP array with all states? Not one that exactly had what I was looking for. Most of them were not properly formatted or even worse behind lots and lots of annoying ads and other garbage.</p>
<p>So I create this page with the <a title="Array with US states" href="http://www.adrianworlddesign.com/downloads/usStates.txt">US-States.txt</a> document. I contains all the United States of America in an array, in case you need one as simple as that.</p>
<p>I have even included the whole array as a static function. You can paste the function into a class as a method. It sports an argument for retrieving just one single state with the abbreviation.</p>
<p>If you are looking for the array on this page here it is below. Although, I highly recommend the txt document above&#8212;it is way better for copy/paste.</p>
<dl class="code_example"><dt class="code_description">// a simple PHP array for copy/paste</dt><dd>$usStates = array(<br />&#160;&#160;'AL' =&#62; 'Alabama',<br />&#160;&#160;'AK' =&#62; 'Alaska',<br />&#160;&#160;'AZ' =&#62; 'Arizona',<br />&#160;&#160;'AR' =&#62; 'Arkansas',<br />&#160;&#160;'CA' =&#62; 'California',<br />&#160;&#160;'CO' =&#62; 'Colorado',<br />&#160;&#160;'CT' =&#62; 'Connecticut',<br />&#160;&#160;'DE' =&#62; 'Delaware',<br />&#160;&#160;'FL' =&#62; 'Florida',<br />&#160;&#160;'GA' =&#62; 'Georgia',<br />&#160;&#160;'HI' =&#62; 'Hawaii',<br />&#160;&#160;'ID' =&#62; 'Idaho',<br />&#160;&#160;'IL' =&#62; 'Illinois',<br />&#160;&#160;'IN' =&#62; 'Indiana',<br />&#160;&#160;'IA' =&#62; 'Iowa',<br />&#160;&#160;'KS' =&#62; 'Kansas',<br />&#160;&#160;'KY' =&#62; 'Kentucky',<br />&#160;&#160;'LA' =&#62; 'Louisiana',<br />&#160;&#160;'ME' =&#62; 'Maine',<br />&#160;&#160;'MD' =&#62; 'Maryland',<br />&#160;&#160;'MA' =&#62; 'Massachusetts',<br />&#160;&#160;'MI' =&#62; 'Michigan',<br />&#160;&#160;'MN' =&#62; 'Minnesota',<br />&#160;&#160;'MS' =&#62; 'Mississippi',<br />&#160;&#160;'MO' =&#62; 'Missouri',<br />&#160;&#160;'MT' =&#62; 'Montana',<br />&#160;&#160;'NE' =&#62; 'Nebraska',<br />&#160;&#160;'NV' =&#62; 'Nevada',<br />&#160;&#160;'NH' =&#62; 'New Hampshire',<br />&#160;&#160;'NJ' =&#62; 'New Jersey',<br />&#160;&#160;'NM' =&#62; 'New Mexico',<br />&#160;&#160;'NY' =&#62; 'New York',<br />&#160;&#160;'NC' =&#62; 'North Carolina',<br />&#160;&#160;'ND' =&#62; 'North Dakota',<br />&#160;&#160;'OH' =&#62; 'Ohio',<br />&#160;&#160;'OK' =&#62; 'Oklahoma',<br />&#160;&#160;'OR' =&#62; 'Oregon',<br />&#160;&#160;'PA' =&#62; 'Pennsylvania',<br />&#160;&#160;'RI' =&#62; 'Rhode Island',<br />&#160;&#160;'SC' =&#62; 'South Carolina',<br />&#160;&#160;'SD' =&#62; 'South Dakota',<br />&#160;&#160;'TN' =&#62; 'Tennessee',<br />&#160;&#160;'TX' =&#62; 'Texas',<br />&#160;&#160;'UT' =&#62; 'Utah',<br />&#160;&#160;'VT' =&#62; 'Vermont',<br />&#160;&#160;'VA' =&#62; 'Virginia',<br />&#160;&#160;'WA' =&#62; 'Washington',<br />&#160;&#160;'WV' =&#62; 'West Virginia',<br />&#160;&#160;'WI' =&#62; 'Wisconsin',<br />&#160;&#160;'WY' =&#62; 'Wyoming',<br />);</dd></dl><img src="http://feeds.feedburner.com/~r/AWD-KnowledgeBase/~4/70RNBXppTXM" height="1" width="1"/>]]></content:encoded>
    </item>
    <item>
      <title>What are branches</title>
      <description><![CDATA[This document has hopefully the answer for you about what branches are in Git. I was dumbfounded for a while and it was even tougher to find an answer.]]></description>
      <pubDate>Thu, 29 Dec 2011 10:58:38 -0600</pubDate>
      <link>http://www.adrianworlddesign.com/Knowledge-Base/git/Base-Concepts/What-are-branches</link>
      <guid>http://www.adrianworlddesign.com/Knowledge-Base/git/Base-Concepts/What-are-branches</guid>
      <content:encoded><![CDATA[<p>&#160;This document has the answer (hopefully) about what branches are in Git. I was dumbfounded for a while and it was even tougher to find an answer but I think I get it now.</p>
<h3>History</h3>
<p>The answer to what branches are in Git lies in the history. At least that's where I found the answer.</p>
<p>I could just simply point you to the Git User's Manual where I found the answer but I don't. You should find that in your Git installation at <em>./doc/git/html/user-manual.html</em> . Oh, actually I have just pointed to the manual but I will also give an excerpt here and some additional thoughts of mine.</p>
<h4>Understanding history</h4>
<p>Oh I love this title because I love history. We can learn so much from history and especially in IT; it's so much easier when you know how things evolved.</p>
<p>In this case it is a little bit different with history, though. In Git every change is (should be) logged with <strong>commits</strong>. All these commits comprise the "<em>history in Git</em>".</p>
<p>Accordingly the User's Manual has a chapter aptly named <strong>Understanding History: Commits</strong>.</p>
<h3>What is a branch?</h3>
<p>Within this chapter we also have a sub-chapter <em>What is a branch?</em>&#160;with a very short answer to what branches are. Here's the excerpt from it</p>
<blockquote>When we need to be precise, we will use the word "branch" to mean a line of development, and "branch head" (or just "head") to mean a reference to the most recent commit on a branch. ... However, when no confusion will result, we often just use the term "branch" both for branches and for branch heads.</blockquote>
<p>Got it? No? I didn't really at first but there is a little example just above this sub-chapter and reference in this quote.</p>
<h4>Diagrams</h4>
<p>It will become clearer when we look at that example which is about <strong>History diagrams</strong>.</p>
<p>The example looks like this</p>
<dl class="code_example"> <dd>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;o--o--o &#60;-- Branch A</dd> <dd>&#160;&#160;&#160;&#160;&#160;&#160;/</dd> <dd>o--o--o &#60;-- master</dd> <dd>&#160;&#160;&#160;&#160;&#160;&#160;\</dd> <dd>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;o--o--o &#60;-- Branch B</dd> </dl>
<p>In the manual it says about diagrams "<em>We will sometimes represent git history using diagrams ...</em>" and this makes it somewhat clear what branches as a concept indeed are.</p>
<p>In this diagram each letter "o" represent a commit and we can see that branches divert&#8212;or branch out&#8212;from the master. <strong>Branch A</strong> and <strong>Branch B</strong> are different development paths or as we now have learned branches.</p>
<p>The idea behind this is to develop without touching the master. At least, that's how I see it.</p>
<p>The other idea and thing to understand about this concept is that we have to later "<strong>merge</strong>" the branch back into the master. I guess you have also seen and wondered about the <strong>merge command</strong>.</p>
<h4>Merge branches</h4>
<p>Since I have this final understanding about branches, <strong>merge</strong> becomes clear, too. I will end here and not dive into merge and maybe have another article about that later. When I know more about it!</p><img src="http://feeds.feedburner.com/~r/AWD-KnowledgeBase/~4/vmBMX-687TU" height="1" width="1"/>]]></content:encoded>
    </item>
    <item>
      <title>Official Documentation</title>
      <description><![CDATA[This page has the links and some additional information to the official Zend Framework documentation.]]></description>
      <pubDate>Sun, 25 Dec 2011 12:07:47 -0600</pubDate>
      <link>http://www.adrianworlddesign.com/Knowledge-Base/Zend-Framework/Introduction/Official-Documentation</link>
      <guid>http://www.adrianworlddesign.com/Knowledge-Base/Zend-Framework/Introduction/Official-Documentation</guid>
      <content:encoded><![CDATA[<h3>It's official</h3>
<p><strong>Important</strong>: Please, I really hope you don't jump right at the following link and leave this page because you should at least read the first steps before you do so.</p>
<p>The official documentation of the Zend Framework is called the <a title="Zend Framework - Programmer's Reference Guide" href="http://framework.zend.com/manual/en/" target="_blank">Programmer's Reference Guide</a>. If you look at the heading of the page you will see the words <em>documentation </em>and <em>manual</em>&#160;but it is more like what you see in the title of the page--it is a Reference Guide. Please, read on!</p>
<h4>Your first steps</h4>
<p>I have mentioned in the front page that the documentation for the Zend Framework is quite extensive and actually pretty well written. There is a little problem, though. It is right in the title of the first page. It is a "Reference Guide" an even more: for "Programmers". If you think of (and expect) a documentation to take you by the hand and lead you through all steps you will find something like that but only in the first two chapters</p>
<p><a title="Zend Framework - Introduction" href="http://framework.zend.com/manual/en/introduction.html" target="_blank">Introduction to Zend Framework</a> and&#160;<a title="Zend Framework - Learning" href="http://framework.zend.com/manual/en/learning.html" target="_blank">Learning Zend Framework</a></p>
<p>Unfortunately, that will be not enough to fully understand the framework. After that you are pretty much left alone and you need a basic but good understanding of the framework to understand anything.</p>
<p>If you just fly over the first two chapters it will not stick, it will not be enough. If you don't make it stick in your head and venture into the next chapter I promise you, you will be lost and frustrated. I speak from experience: It happened to me! I hope you will take this advise serious and stop and go over and over and over these first two chapters until you completely understand them. Use the examples and complete them repeatedly.</p>
<h4>Coding Standards</h4>
<p>The Zend Framework has and follows a&#160;<a title="Zend Framework Coding Standard for PHP" href="http://framework.zend.com/manual/en/coding-standard.html" target="_blank">Coding Standard</a>&#160;for PHP.&#160;The chapter is, unfortunately, not at the beginning of the documentation.&#160;I urge you to read this standard very early and stick to them when you begin hacking your own code.</p>
<h4>The MVC pattern</h4>
<p>I have decided to give this topic a <a title="MVC pattern in the Zend Framework and Reference Guide" href="http://www.adrianworlddesign.com/Knowledge-Base/Zend-Framework/Introduction/MVC-Pattern">separate page</a> in the introduction. Please read on, though, and then click the next link at the bottom of this page. You should really read that page if you want to unlock the full potential of the framework but also for understanding the reference guide.</p>
<h4>The next steps</h4>
<p>The following and third chapter, <a title="Zend Framework - Reference" href="http://framework.zend.com/manual/en/reference.html" target="_blank">Zend Framework Reference</a>, is&#160;exactly&#160;what it says it is. A reference [guide] usually singles out parts and explains these parts in more details. They also usually expect you to bring a certain knowledge to the table and do not reiterate things that are written somewhere else. If you are lucky you will have a link to that piece but mostly you don't find one. The <a title="Zend Framework Reference" href="http://framework.zend.com/manual/en/reference.html" target="_blank">Zend Framework Reference</a> is no different. It explains the different main classes in the framework. Since the framework is based on object-oriented program (OOP) you must have a good understanding of classes in PHP. How they work and how to use them and work with them. If you don't have that knowledge yet you will be up for a coaster ride and throw the reference and the framework away.</p><img src="http://feeds.feedburner.com/~r/AWD-KnowledgeBase/~4/jA6mCAiwQZw" height="1" width="1"/>]]></content:encoded>
    </item>
    <item>
      <title>Hypertext Markup Language (HTML)</title>
      <description><![CDATA[This is a quick overview about links to other documents here and on the web discussing topics revolving around the Hypertext Markup Language(HTML).]]></description>
      <pubDate>Sun, 25 Dec 2011 12:03:19 -0600</pubDate>
      <link>http://www.adrianworlddesign.com/Knowledge-Base/Web-Standards/Things-about-Hypertext/Hypertext-Markup-Language-HTML</link>
      <guid>http://www.adrianworlddesign.com/Knowledge-Base/Web-Standards/Things-about-Hypertext/Hypertext-Markup-Language-HTML</guid>
      <content:encoded><![CDATA[<h3>Overview</h3>
<p>This is similar to <a title="HTTP in my Knowledge Base" href="http://www.adrianworlddesign.com/Knowledge-Base/Web-Standards/Things-about-Hypertext/Hypertext-Transfer-Protocol-HTTP">HTTP</a>. When we talk about the World Wide Web (WWW) then we should also be talking about the Hypertext Markup Language (HTML). There would be simply no web or a Internet as we know it without HTML.</p>
<p>There are not many articles here (yet) because this standard is very well documented already.  However, there is something new on the horizon&#8212;HTML5. Most, if not all, web pages are written at least based upon version 4 but the next version is almost here. As of this writing, the support for the new version in the current browsers is still weak. The more we get support the more I will add documents about things in HTML5 for sure.</p>
<h3>Standards Documentation</h3>
<p>First of some links to other sources. As I already said HTML4 is already very well documented so here are also some links focusing on that version.</p>
<p>Learn at W3C - <a title="Learn HTML at W3C.org" href="http://www.w3.org/html/wiki/Learn" target="_blank">Learn - HTML</a></p>
<p>WHATWG - <a title="WHATWG - HTML Living Standard" href="http://www.whatwg.org/specs/web-apps/current-work/multipage/" target="_blank">HTML Living Standard</a></p>
<p>Tutorial at w3schools.com - <a title="HTML Tutorial at w3schools.com" href="http://www.w3schools.com/html/default.asp" target="_blank">HTML Tutorial</a></p>
<p>Wikipedia - <a title="Wikipedia HTML English" href="http://en.wikipedia.org/wiki/HTML" target="_blank">English</a> - <a title="Wikipedia HTML German" href="http://de.wikipedia.org/wiki/Hypertext_Markup_Language" target="_blank">Deutsch</a> - <a title="Wikipedia HTML Spain" href="http://es.wikipedia.org/wiki/HTML" target="_blank">Espanol</a> - <a title="Wikipedia HTML French" href="http://fr.wikipedia.org/wiki/Hypertext_Markup_Language" target="_blank">Francais</a> - <a title="Wikipedia HTML Italian" href="http://it.wikipedia.org/wiki/HTML" target="_blank">Italiano</a></p>
<h3>Articles</h3>
<p>Following is an overview of my articles:</p>
<ul style="font-size: 1.25em; list-style-types: none;">
<li>HTML for dummies</li>
</ul>
<p>Again, it not much yet and but as time goes by and HTML5 becomes an established standard I will have more and more documents added to this chapter.</p><img src="http://feeds.feedburner.com/~r/AWD-KnowledgeBase/~4/JhmPUkeCO7E" height="1" width="1"/>]]></content:encoded>
    </item>
    <item>
      <title>Hypertext Transfer Protocol (HTTP)</title>
      <description><![CDATA[This is a quick overview about links to other documents here and on the web discussing topics revolving around the Hypertext Transfer Protocol (HTTP).]]></description>
      <pubDate>Sun, 25 Dec 2011 12:00:16 -0600</pubDate>
      <link>http://www.adrianworlddesign.com/Knowledge-Base/Web-Standards/Things-about-Hypertext/Hypertext-Transfer-Protocol-HTTP</link>
      <guid>http://www.adrianworlddesign.com/Knowledge-Base/Web-Standards/Things-about-Hypertext/Hypertext-Transfer-Protocol-HTTP</guid>
      <content:encoded><![CDATA[<h3>Overview</h3>
<p>When we talk about the World Wide Web (WWW) then we should also be talking about the Hypertext Transfer Protocol (HTTP). There would be simply no WWW without HTTP. I have only two other articles here because this protocol is not overly complicated and most importantly we--as developers, designers and users--under any normal circumstances don't have to care about it.</p>
<p>Nevertheless, sometimes people are just so darn curious and they have questions. Those two documents is how I usually tell the story about HTTP.</p>
<h3>Standards Documentation</h3>
<p>First of some links to other sources. Most importantly the first one which is the official documentation by W3 Consortium.</p>
<p>W3C - <a title="W3C HTTP - Hypertext Protocol" href="http://www.w3.org/Protocols/" target="_blank">Complete Protocol Overview</a></p>
<p>Wikipedia - <a title="Wikipedia HTTP English" href="http://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol" target="_blank">English</a>&#160;- <a title="Wikipedia HTTP Deutsch" href="http://de.wikipedia.org/wiki/Hypertext_Transfer_Protocol" target="_blank">Deutsch</a>&#160;- <a title="Wikipedia HTTP Spain" href="http://es.wikipedia.org/wiki/Hypertext_Transfer_Protocol" target="_blank">Espanol</a> - <a title="Wikipedia HTTP Francais" href="http://fr.wikipedia.org/wiki/Hypertext_Transfer_Protocol" target="_blank">Francais</a> - <a title="Wikipedia HTTP Italian" href="http://it.wikipedia.org/wiki/Hypertext_Transfer_Protocol" target="_blank">Italiano</a> -</p>
<h3>Articles</h3>
<p>Following are the links to these two articles:</p>
<ul style="font-size: 1.25em; list-style-type: none;">
<li><a title="HTTP in a nutshell" href="http://www.adrianworlddesign.com/Knowledge-Base/Web-Standards/Things-about-Hypertext/http-in-a-nutshell">http:// in a nutshell</a></li>
<li><a title="HTTP for dummies" href="http://www.adrianworlddesign.com/Knowledge-Base/Web-Standards/Things-about-Hypertext/http-for-dummies">http:// for dummies</a></li>
</ul>
<p>Again, it is not much because there is not really a lot you have to know about HTTP. It is certainly a good thing to know it exists and maybe why it exists but we normally don't have to worry about it.</p>
<p>&#160;</p><img src="http://feeds.feedburner.com/~r/AWD-KnowledgeBase/~4/70KDhapKs-8" height="1" width="1"/>]]></content:encoded>
    </item>
    <item>
      <title>Index.php mystery</title>
      <description><![CDATA[Thanks but no thanks. Firefox sends a index.php request as only index. I don't know why some application developers sometimes come up with some decisions. In the document here I write about my discovery of the lost php extension. The developers behind Firefox for some weird reason decided to submit requests to index.php without the extension.]]></description>
      <pubDate>Mon, 19 Dec 2011 08:37:00 -0600</pubDate>
      <link>http://www.adrianworlddesign.com/Knowledge-Base/Web-Browsers/Firefox/Indexphp-mystery</link>
      <guid>http://www.adrianworlddesign.com/Knowledge-Base/Web-Browsers/Firefox/Indexphp-mystery</guid>
      <content:encoded><![CDATA[<p>Thanks but no thanks. I have just spend, read wasted, about an hour tracing a little mystery which turned out to be some funny stuff with the browser, in my case Firefox.</p>
<p>I was testing a new module that captures and analyzes requests to certain file types, like the well known index.php. I don't really support the index.php file on my systems but some people (aka hackers) think (for whatever reasons) to send requests to an /index.php URI anyway.</p>
<p>With the new module I will be able to log such goofy requests in a special log file but also simply redirect to the root, aka homepage. <em>Nice try, dude! Here's your homepage.</em></p>
<h3>Stripping an extension</h3>
<p>Now, there might be other people who (for also whatever unknown reason) think they have to send a request with an html or htm extension, like <strong>/home.html</strong>, <strong>/contact.html</strong> or <strong>/about.html</strong>. I may even have such a page but without the html.</p>
<p>Because I want my application to be a smart system this should be handled in a certain smart way and not just return a <strong>404 Not found</strong> error page. The new module will actually do that now.</p>
<p>It will simply redirect the request without the extension. The module strips the extension and sends a <strong>301 Moved permanently </strong>redirect because the page never has and never will exist.</p>
<p>I don't care and test at this point if there even is a page with that name. The redirect will solve this riddle anyway. If there happens to be a page with that name all is great with <strong>200 OK</strong> response and if not, well, they get the 40x error code and page.</p>
<h4>So far so good.</h4>
<p>I used my Firefox browser and send a /index.php request and expected to see my debug message to work on the task at hand. Instead I received my 40x error page and an even bigger surprise the URL in the browser showed an URL without the extension. As if it was redirected like any other page I described above.</p>
<h3>Firefox stripped php extension</h3>
<p>After a lot of swearing, head banging and other insults thrown at my monitor screens I came to the conclusion that Firefox must send my index.php request as only index, i.e. <span style="text-decoration: underline;">they</span> strip the php extension.</p>
<p>Whatever request I send with Firefox worked like clockwork but only the index.php did not. I finally fired up another browser and sure enough I suddenly see my debug message as expected. Back to Firefox it did not work.</p>
<p>Now, I don't know why some application developers sometimes come up with some decisions, i.e. making decisions for the user. I cannot really tell if the developers behind Firefox for some weird reason decided to always submit requests to index.php without the extension or if there is some caching going on or if it is one of the Add-ons.</p>
<p>On another system Firefox did work like expected but just not on my primary system. So thanks but no thanks to the developers who decided to strip the php extension. You wasted a hour of my life.</p><img src="http://feeds.feedburner.com/~r/AWD-KnowledgeBase/~4/00wzxBusm4Y" height="1" width="1"/>]]></content:encoded>
    </item>
    <item>
      <title>open basedir prohibits opening</title>
      <description><![CDATA[If you encounter this error "safe_mode/open_basedir prohibits opening" then you might have a problem like I did. It is quite frankly one of these stupid error messages which leads you in a completely wrong direction. The solution is pretty simple.]]></description>
      <pubDate>Thu, 20 Oct 2011 14:59:48 -0500</pubDate>
      <link>http://www.adrianworlddesign.com/Knowledge-Base/Zend-Framework/Error-Messages/open-basedir-prohibits-opening</link>
      <guid>http://www.adrianworlddesign.com/Knowledge-Base/Zend-Framework/Error-Messages/open-basedir-prohibits-opening</guid>
      <content:encoded><![CDATA[<p>If you try to load an SQLite DB file and suddenly encounter this error "<strong>safe_mode/open_basedir prohibits opening</strong>" then you might have the same problem I had. In my case it took me almost 6 hours until I discovered the tiny little problem. It took so long because the error message is quite frankly one of these stupid cases where it leads you in a completely wrong direction.</p>
<p>Following are all the details about my case and the solution at the end.</p>
<h3>Loading a SQLite db file</h3>
<p>The SQLite database file I was loading was actually outside the regular base directory [<em>adding insult to injure</em>]. Ergo at first, the error made total sense until I discovered that I don't have any of these settings in place. Also because I use other database files without a hitch and they are actually also outside the basedir.</p>
<p>At some point it dawned on me that there must be a problem with the path for the db file. The path with the db filename acts as the database name in PDO for SQLite.</p>
<p>Actually, I was using the <em>realpath()</em> function to make sure that the path is properly formatted&#8212;which turned out to be my problem because I made two crucial mistakes in this case. First I did not care about the returned result and second I did not verify the path I sent to the realpath function.</p>
<p>The <em>realpath()</em> function not only formats the path it also verifies if the path is valid, i.e. if this directory or file exists. If not it returns a Boolean false value and that's what I got because I used a constant with a path that was wrong. I never realized and verified what I was passing as the value into the Zend_Config_Ini object as the dbname and in return to the Zend_Db factory method. For the longest time I was not aware that the db filename actually was a Boolean false value.</p>
<h3>dbname empty</h3>
<p>So, it turned out to be real simple my problem; although, the error message was totally wrong and led me into the wrong direction.</p>
<h4>Lesson learned</h4>
<p>If you pass an empty or a non string value to PDO/SQLite you will get this "<strong>safe_mode/open_basedir prohibits opening</strong>" error.</p>
<p>Note that if you pass a string, which resembles somewhat of a directory but the file cannot be located, you will get an appropriate response which is usually "<strong>unable to open database file</strong>."</p><img src="http://feeds.feedburner.com/~r/AWD-KnowledgeBase/~4/qAEFW_tqwtU" height="1" width="1"/>]]></content:encoded>
    </item>
    <item>
      <title>Connection Speed</title>
      <description><![CDATA[This page does not have any data based on connection speed tests. Just subjective experience browsing my web sites hosted on FatCow. Depending on where you live and what type Internet access you have your experience might be different.]]></description>
      <pubDate>Fri, 16 Sep 2011 04:11:45 -0500</pubDate>
      <link>http://www.adrianworlddesign.com/Knowledge-Base/Web-Hosting/FatCow/Connection-Speed</link>
      <guid>http://www.adrianworlddesign.com/Knowledge-Base/Web-Hosting/FatCow/Connection-Speed</guid>
      <content:encoded><![CDATA[<p>The main part is about my experiences from September, 2010. There is an update at the bottom from June 2011.</p>
<p>Based on the IP address I was given for my account&#8212;and nslookup&#8212;it looks as if the server and presumably data center is in Dallas, Texas. Which should be great because I am in Texas, too. Hence, the connection speed should be fairly well. So, I thought!</p>
<h3>First impression: Static content</h3>
<p>As with probably all hosting provider you don't get a free test account where you can find out if this provider is any good, speed-wise. You have to buy a one year contract or let yourself rope in to an even longer plan with great savings, though.</p>
<p>Good news first, the static HTML web pages I set up first are popping up blazing fast in my browser. I mean split second fast. You hit enter and the page is there before you can blink or say: "Awesome!"</p>
<h3>Second impression: PHP</h3>
<p>Once I switched over to PHP things changed considerably. Even simple basic PHP test scripts in a "Hello World" manner take anywhere from 1 to 6 seconds.</p>
<p>Then I uploaded my whole Zend Framework application and not much of a surprise here&#8212;the response time is even worse. Pages in average take anywhere from 6 to 14 seconds to arrive at my desktop.</p>
<p>In my internal network setup (within a VMware virtual host) this takes 2 or maybe 3 seconds&#8212;tops. With another provider I use, i.e. over the Internet, for this same application it takes even less than 2 seconds. However, I had some other <em>issues</em> with that provider why I thought I need a backup solution and gave FatCow a try.</p>
<h3>Conclusion</h3>
<p>I cannot really tell without more in-depth testing what the real problem is where the delays are coming from. One thing I know for sure, though. It seems to be some internal problem within the server environment. Some network tests revealed that the page is requested and then nothing happens for some seconds. The whole page and data usually is delivered with .5 seconds.</p>
<p>For one thing there is no FastCGI available which could speed up things with PHP but I have no real experience in this regard and if this would make any difference.</p>
<p>My feeling is that they have some problems with the internal network or setup of servers. As mentioned, if you have a few static pages everything works fine. If you have to access a whole bunch of files in a framework you are asking for trouble. It might be either I/O file requests to remote storage (SAN,NAS) or memory limitations for your virtual server, resulting in page faults. Hard to tell without proper access to the server and thus tools to measure performance.</p>
<h3>Update Note</h3>
<p>June 2011</p>
<p>I never really used FatCow in production because of this initial experience. Then I came back and did some tests again in June 2011. Things have vastly improved and response time is usually around an acceptable 2 seconds.</p>
<p>There are still other issues, though. Because of this I would not recommend this provider for any of my clients and a production environment.</p><img src="http://feeds.feedburner.com/~r/AWD-KnowledgeBase/~4/dqgHLZBSVys" height="1" width="1"/>]]></content:encoded>
    </item>
    <item>
      <title>http:// for dummies</title>
      <description><![CDATA[This document is an attempt to explain some of the main things you should know about HTTP. For many people HTTP (similar to HTML) is exactly four letters and a little hard to grasp and understand what it really means. As the protocol or standard that moves a web page from a server to a browser it is the main thing that drives the World Wide Web (WWW) and we use when we surf the Internet.]]></description>
      <pubDate>Tue, 06 Sep 2011 05:14:33 -0500</pubDate>
      <link>http://www.adrianworlddesign.com/Knowledge-Base/Web-Standards/Things-about-Hypertext/http-for-dummies</link>
      <guid>http://www.adrianworlddesign.com/Knowledge-Base/Web-Standards/Things-about-Hypertext/http-for-dummies</guid>
      <content:encoded><![CDATA[<h3>What this is about</h3>
<p>For many people <abbr title="Hypertext Transfer Protocol">HTTP</abbr> (similar to <a title="Link to HTML for dummies" href="http://www.adrianworlddesign.com/Knowledge-Base/Web-Standards/Hypertext-Markup-Language-HTML/html-for-dummies">HTML</a>) is exactly four letters and a little hard to grasp and understand what it really means or does. In this page I will try to explain some of the main things you should know about HTTP.</p>
<p>I will keep this on a general level and not go into specific details. Therefore, this will be very brief because there is not really much you have to know on a general level.</p>
<h3>What this is not about</h3>
<p>There is nothing here besides the protocol and as said I keep it basic at a very general level. If you need a complete reference about HTTP see the <a title="Link to W3C and protocol overview" href="http://www.w3.org/Protocols/" target="_blank">W3C Protocol Overview</a>. Check out the <a title="Link to HTTP in Wikipedia" href="http://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol" target="_blank">Wikipedia</a> article if you are interested in a more detailed overview about it. Thanks for visiting anyway!</p>
<h3>About the Protocol</h3>
<p>First thing you need to know and understand is that HTTP is a protocol. That would be the P character in the acronym. What is a protocol good for? Many, many years ago one teacher tried to explain a protocol this way and I cannot think of any better way.</p>
<p>If you are going to visit the Queen of England (or any other of those blue blooded people) you are confronted with a list of things you are allowed to do and things you should not do under any circumstances. This list is called the <strong>royal protocol</strong>. There are also protocols in diplomacy. Other terms in this regard are <em>Etiquette</em>, <em>Manners</em> or <em>Conventions</em>.</p>
<p>Protocols in the computer world are certainly nothing like etiquette but more or less like the manners how computer components interact with each other. Convention is probably the most fitting term other than protocol.</p>
<h3>Network Protocols</h3>
<p>Our protocol here belongs to a family of protocols which are referred to as the network protocols. If you ever wondered about how computers communicate with each other then go, find and read all the network protocols. Before you begin you should read about and understand the layers in the OSI Model, though. I digress, I intended to keep this basic.</p>
<p>You see, HTTP is just a small piece in a very complex model of layers and protocols. So, lets stick with the main purpose of the protocol, which is the second T in the acronym. The T and the P together are the <em>transfer protocol</em>. Very basic and simple, this protocol has all the conventions for how something gets transfered in the network. Now, guess what! If you say it must be about the first two characters you are correct. The HT, or hypertext, is the thing that gets transferred with this protocol.</p>
<p>Long story short and very basic: <em>HTTP is the convention how hypertext gets transferred in a network</em>.</p>
<h3>A little more specific</h3>
<p>Oh, you are feisty! First what is <em>hypertext</em>. Lets say I create a link to my other web page about HTML <a title="Link to HTML for dummies" href="http://www.adrianworlddesign.com/Knowledge-Base/Web-Standards/Hypertext-Markup-Language-HTML/html-for-dummies" target="_self">like this</a> where I already wrote something about hypertext. What have I done exactly? In computer parlance I have set a <em>hyperlink</em> to more text, text beyond this text, &#252;bertext, overtext. We call it <em>hypertext</em>, though. When you surf the Internet and jump from one page to the next you see hypertext in full swing, you are <em>hypertexting</em>.</p>
<p>Because we are hypertexting in a network we need some rules, conventions or how about a protocol between all parties on how this hypertext is transferred. The parties in this transfer are mainly two. There are many more like switches, routers, firewalls but for our basic understanding we need only two: two computers!</p>
<p>Believe it or not but your computer (or smartphone, iPod/iPhone/iPad, tablet etc.) somewhere has the hypertext transform protocol installed. Together with a bunch of other network protocols which is known as the IP stack, the Internet Procol Suite or the TCP/IP model or architecture. As a user you don't have to worry about this because the web browser of your choice does all the work and deals with it. The browser sends a request to the IP stack which does all the rest. In regards to our protocol it sends the request according to the rules set in the protocol over the network.</p>
<p>On the other side of the network we essentially have nothing more than your computer but instead of a browser with another piece of software, a web server. Of course, that computer also has HTTP installed. Here the protocol is linked with this web server software which will get the request and according to it will answer with a response. This response, again according to the rules set in the protocol, will be send back to your computer where the browser will understand what is going on and present the response to you.</p>
<p>Is it that simple, really? If we strictly talk about HTTP, yes! There is not much we have to do and quite frankly can do. If you dig deep into your operating system and look for this protocol you might not find more than an on/off switch. There is not much that can go wrong and will go wrong in terms of this protocols. There are others, though and dozens of other things can go wrong between your browser and the web server but not with HTTP. So, don't worry&#8212;be happy!</p><img src="http://feeds.feedburner.com/~r/AWD-KnowledgeBase/~4/OTHQjBCkNfQ" height="1" width="1"/>]]></content:encoded>
    </item>
    <item>
      <title>What is your position</title>
      <description><![CDATA[The positioning of HTML elements is a little bit of tricky business. The rules are in fact really simple, though. This web page will shed some light on the basics on the CSS position statement and what you need to know to make it work.]]></description>
      <pubDate>Sat, 03 Sep 2011 03:33:31 -0500</pubDate>
      <link>http://www.adrianworlddesign.com/Knowledge-Base/Web-Standards/Cascading-Style-Sheets/What-is-your-position</link>
      <guid>http://www.adrianworlddesign.com/Knowledge-Base/Web-Standards/Cascading-Style-Sheets/What-is-your-position</guid>
      <content:encoded><![CDATA[<p>Positioning of HTML elements in a webpage seems to be quite a challenge for many people. I have to confess it took some for me as well to understand some things. Following are some of thoughts and experience about the position statement in CSS and how to make it work.</p>
<h3>Relativity theory</h3>
<p>Lets talk about the famous Albert Einstein for a quick moment.</p>
<p><strong>... to be continued and finished, soon!</strong> 8/20/2011</p><img src="http://feeds.feedburner.com/~r/AWD-KnowledgeBase/~4/4nWTfnkadZY" height="1" width="1"/>]]></content:encoded>
    </item>
    <item>
      <title>The magic number 72</title>
      <description><![CDATA[This page has some information about the magic number 72ppi and pixels per inch in general. Where this myth about pixels per inch is coming from and why it actually doesn't really matter.]]></description>
      <pubDate>Sun, 07 Aug 2011 08:37:40 -0500</pubDate>
      <link>http://www.adrianworlddesign.com/Knowledge-Base/Web-Standards/Various-Standards/The-magic-number-72</link>
      <guid>http://www.adrianworlddesign.com/Knowledge-Base/Web-Standards/Various-Standards/The-magic-number-72</guid>
      <content:encoded><![CDATA[<p>It always amazes me that certain things, despite having no real meaning, are discussed and tossed around almost forever. The magic number 72ppi, as I call it, is one of these things that I run into every now and then.</p>
<p>It is even a little disturbing what some people throw in as their two cents. So, I feel very comfortable throwing in my two cents.</p>
<h3>Some background and history</h3>
<p>A lack of computer history and therefore fundamentals is probably the reason why some people have difficulties to understand what pixels per inch (ppi) like the 72ppi really mean&#8212;and why it doesn't really matter.</p>
<p>It is probably a fact that the 72ppi is linked and originated with Apple, but who cares! To understand the number and ppi we have to look at computers and how they generate output. Note that I wrote computer and not monitor. That is important!</p>
<h4>Back in the days</h4>
<p>Way back in the days of the first dinosaur computers they had no screens, displays, monitors or whatever you want to call them.</p>
<p>Now, when we think about how a computer in those days presented information like a simple result we have to think ink, print and paper. No images, just text in a line by line format. When we progress and think about how the first monitor looked like it was pretty much the same.</p>
<p>Still no images, just line by line test because that's what they dearly needed. Instead of waiting for the print out they could see the results instantly on a screen. What an improvement!</p>
<p>As an interesting side note: In programming languages we still have commands named "print" for sending data to the output device. The other word is "echo" for sending text to the screen.</p>
<p>Therefore the big question was: <em>"How can we display text on a screen?"</em> There are two problems to this question. First, and obvious for most people: <em>"How do you create a monitor screen and  show text?"</em> However, that is not the real problem! The not so obvious question is the toughie and real problem: <em>"How should a computer create text for display?"</em> That second question will lead us to the magic number.</p>
<h4>The big chessboard</h4>
<p>The engineers at that time had to figure it out and when you think about what a computer does it is really simple. The only thing a computer really does is turning things on and off. Take a chessboard and you know exactly what or where 3B is. Imagine a monitor screen with 8-by-8 squares and you can tell anybody to turn on or off the square representing 3B. Even a stupid computer!</p>
<p>On those first monochrome screens you could in fact see the raster and those little squares. The letters had to be drawn in ways to work with these squares.</p>
<p>Since then not much has really changed simply because computers still only do one thing. Exactly, turning on and off things and a raster is maybe not the only way but most efficient way you can tell a computer to present something on screen. However, things have become smaller and smaller and of course, faster and faster. Oh, and the squares became a new name&#8212;Meet the <em>Pixels</em>.</p>
<h4>Smaller is bigger</h4>
<p>Along came Apple and they thought about how to present text on their first model and screens. At that time the squares became colorful and they also got smaller and smaller. In other words, the density of pixels got bigger on monitor screens. Apple settled for a density or raster representing 72 pixels per inch (ppi). There is a lot of information on the web about how they came up with the number but to some degree it just does not really matter.</p>
<p>What we have to keep in mind is the somewhat fact that 72ppi was and still is a rather pleasing density for looking at a screen.</p>
<h3>Your real estate</h3>
<p>Despite the fact that screens are bigger today the density is roughly the same. What has changed is the resolution; we kept the density but added some real estate, i.e. more pixels to width and height.</p>
<h4>Some math</h4>
<p>If you look at the monitor settings in your computer you might see the numbers 1920 x 1080. This would be what we now understand as <em>Full High Definition</em> (FullHD or FullHDTV). This means that the computer (or your  HDTV) creates an image with 1080 lines and 1920 pixels side-by-side.</p>
<p>When we divide the resolution pixels with the inches of our screen we will get a number near the 72ppi. It is all we really need for human eyes in front of a computer screen.</p>
<p>Or lets do it the other way around: Take a screen at 1080 lines and with 72ppi it should be exactly 15 inches high. With a 16:9 ratio the screen would be 26 2/3 inches wide which, of course, is the same as 1920 divided by 72. Some Pythagorean theorem and you are looking at a 30 1/2 inch screen.</p>
<h4>Resolution belongs to computers</h4>
<p>So, does this all mean the computer or TV monitor has exactly 1080 lines? Surprising truth: Maybe but we don't know for sure without looking at the technical specification of the monitor. Important fact: Resolution is what the computer is doing&#8212;not the monitor!</p>
<p>Not convinced? Lets step back in time once more. Nowadays we buy flat screen monitors and TVs. Until just a few years ago we bought tubes, CRT monitors. They worked a little bit different and the resolution was something we changed at will. In the early days CRT monitors have been able to show a far better density than the resolution a computer was able to calculate in a timely manner. The time factor by the way is something we should not forget about the old days. The higher the resolution the more computing power is required to generate a fresh image; which is not really true in computer graphics, but that is not the point here.</p>
<p>With flat screens today we usually do not change the resolution. We (should) stick with the default settings. Why? Because, unlike the CRTs, they have those tiny little light bulbs side by side and line by line. If you would change the resolution to anything different than the exact number of little light bulbs some parts of the image would not look so great because a lot of information for the image submitted by the computer falls between two light bulbs, i.e. it gets cut off. Unless you have at least twice the number but we don't waste any thoughts on that.</p>
<h3>What really matters</h3>
<p>What really matters is the computer's resolution and the number of pixels in that particular resolution. In terms of web design or actually anything presented on any monitor pixels per inch means absolutely nothing. It is also irrelevant how many pixels the screens has or how big or small they are. Simply because we cannot control the size of the output device. We never did and probably never will.</p>
<p>If you design a webpage at 960 pixels wide and it is shown on the giant screen at the Cowboys Stadium in Dallas with 72ppi it would be 13 1/3 inches wide. Doh! Because the pixels on that board are different we would not have to worry about it anyway. What we should know is, that screen appearently corresponds to 2423 x 1088 pixels. Therefore such a web page would look just fine unless the operator for the giant screen would be able to set the resolution to 800 x 600. Then your 960 pixels web page is suddenly cut off. Simply because the only thing that matters is the resolution; not pixels per inch.</p>
<h4>Outlook into smartphones</h4>
<p>Now here is why I came up with this article. If you look at some discussions about designing for smartphones some people honestly throw in their two cents with inches and pixels per inches. It does not matter! Here is a little scoop at what matters with smartphones, though.</p>
<p>Lets review: As we saw with the giant screen above, even with fist size pixels, the image will look fine because of the distance for the viewer. The 72ppi is only a magic number for viewing a computer screen and even when this number is lower for your TV screen it will be still just fine because you usual don't sit that close watching TV, do you? So, what about smartphone? The quick answer: The number of pixels per inch has to be higher but it still does not matter.</p>
<p>The screen for an iPod or iPhone is about 3 inches high in portrait view and the first generation of displays apparently had 320 x 480 pixels. That's a whopping 160ppi and Apple has doubled this number. According to their tech spec the retina display in the iPhone 4 has 326 pixels per inch!</p>
<p>Now the big question for us as designers and developers is this: Will there be any changes for the design process? Not much because pixels per inch does not matter to us! With the Apple's iPhone and all the other smartphones we are not even dealing with screen resolution anymore. There is something different called the viewport and media.</p>
<p>What clearly is changing is the density of the screen (the number of the little light bulbs) and these are in fact squares per inch. Take your magnifying glass and you see the squares. The smartphone's computer resolution in pixels seems to be of interest but actually it is not. What really matters here is a number which in this case are the pixels for the viewport or media. This means the size of the browser.</p>
<p>Hence, what really matters for smartphones in terms of design is, not pixels per inch, the number or size of squares (light bulbs), but the number of pixels for the viewport.</p>
<p>If you want to find out how to design for a smartphone look out for the dimensions of <a title="Link to an article about the viewport" href="http://www.adrianworlddesign.com/Knowledge-Base/MobileDevices/Fundamentals/Understanding-the-Viewport">the viewport</a>.</p><img src="http://feeds.feedburner.com/~r/AWD-KnowledgeBase/~4/H_phydW28CQ" height="1" width="1"/>]]></content:encoded>
    </item>
    <item>
      <title>Allowed Memory size exhausted</title>
      <description><![CDATA[The document gives you some background information about this error and not just some workaround. When you work with PHP you may run into this Fatal Error telling you something like "Allowed memory size of 33554432 bytes exhausted (tried to allocate 384 bytes) in file/something.php on line 245". The root cause is probably an error in your script and not something in the configuration. To find the root cause you need some background information.]]></description>
      <pubDate>Sun, 09 Oct 2011 15:43:51 -0500</pubDate>
      <link>http://www.adrianworlddesign.com/Knowledge-Base/Zend-Framework/Error-Messages/Allowed-Memory-size-exhausted</link>
      <guid>http://www.adrianworlddesign.com/Knowledge-Base/Zend-Framework/Error-Messages/Allowed-Memory-size-exhausted</guid>
      <content:encoded><![CDATA[<h3>Quick answer</h3>
<p>Somewhere in you application you are pulling data and storing the data in a variable which exceeds the limit set in the PHP configuration. The data set you pull is either too big or you are causing a loop adding data to memory until the limit is reached.</p>
<p>But please, read on.</p>
<h3>What memory size?</h3>
<p>Don't we like errors just like this one? You get a <strong>Fatal Error</strong> and you have no clue what it is about. Everything works fine with your web server, PHP or Zend application and suddenly you run into this error telling you</p>
<dl class="code_example"><dd>"Fatal Error: <strong>Allowed memory size of 33554432 bytes exhausted</strong> (tried to allocate 384 bytes) in file/something.php on line 245".</dd></dl>
<p>You think: <em>"What the heck, I have 4GB of RAM in my server or PC."</em> You also know that the operating system handles virtual memory and an application usually gets about 2GB of virtual memory. So, what is the real problem here?</p>
<h4>Memory configuration</h4>
<p>One thing is clear, it is neither a problem with physical memory nor the virtual memory allocated by the OS. It is a limitation set in the configuration by PHP. Now the big question is this: "Do we have enough memory set in the configuration?" The answer is "probably yes" because the real problem is something else! Lets think about what is happening with memory in general.</p>
<h4>Cause and Reaction</h4>
<p>Every application uses memory to store data, temporarily, at run time. The application in our case is PHP and we should not worry about it. It handles everything but it has set its own limit in the configuration, that is where <em>exhausted</em> is coming from. Check your php.ini file or phpinfo and search for <strong>memory_limit</strong>. Within <strong>phpinfo</strong> it is in the PHP Core section. In my case it is set to 32M (MegaBytes) which in most cases is enough.</p>
<p>First thing to know, memory stores data from all the files we load and with them all the variables, functions and classes. Keep in mind that properties in classes store data. Although the Zend Framework (or other frameworks and CMS like Wordpress, Joomla, Drupal for that matter) opens and stores a lot of files the sum of all this data is far from that limit. Imagine, <em>the whole Zend library</em> is only 22.3MBytes and never ever is the whole library loaded. The bigger question is what other data makes its way into memory.</p>
<h4>Data stored in memory</h4>
<p>Basically every framework has a database in the background. So, our biggest concern here are the databases. When we pull data from a database we store the data in local variables or the properties in our classes.</p>
<p>Lets take a look at the php.net website and the page about the <a title="PHP: Description of core php.ini directives" href="http://php.net/manual/en/ini.core.php" target="_blank">resource limit</a>. There is these nice little sentence and what the resource limit is for: "This helps prevent poorly written scripts for eating up all available memory on a server." Well, there we have it! If we hit this fatal error we probably have a problem in our script.</p>
<h3>The Solution</h3>
<p>If you run into this fatal error on a regular basis you should really look at how you are handling data that you pull from a database. Ask yourself some of the following questions. Do you pull data with fetchAll or do use use filters? Do you pull the same data over and over again and do you stored it in different variables?</p>
<p>I occasionally run into this fatal error when I made some change in a script and this forced the execution for some&#8212;I have to admit it&#8212;stupid reason into a loop. The loop is pulling data repeatedly from the database and stores the result at every cycle into memory until the memory, as the error says, is exhausted. If it was not for the data we would eventually run into the next error which is the max_execution_time limit for the scripts, i.e. the&#160; execution time runs out and we get the error for that.</p>
<p>Hopefully we know when, what or where we made the change that forced the loop and can fix it immediately. If not, good lucky debugging your scripts and find the change that causes the trouble.</p>
<h3>Special Note</h3>
<p>The fatal error has a file mentioned. Note that this file is probably not the source of your problem! It is only the point where the latest request for memory was coming from. However, if it is some file related to databases you can bet your life that the problem is exactly what I have mentioned above. You are pulling and storing to much data in what ever way from the database.</p><img src="http://feeds.feedburner.com/~r/AWD-KnowledgeBase/~4/XP9c0TA7B50" height="1" width="1"/>]]></content:encoded>
    </item>
    <item>
      <title>Valid Credit Card Numbers</title>
      <description><![CDATA[If you have to test some scripts for credit card validation you need some numbers that work. Not real numbers in a sense of existing credit cards but numbers that are real in a sense that they pass validation. This page has some information and a little list with valid credit numbers.]]></description>
      <pubDate>Sun, 09 Oct 2011 15:44:16 -0500</pubDate>
      <link>http://www.adrianworlddesign.com/Knowledge-Base/Zend-Framework/Helpful-Tips/Valid-Credit-Card-Numbers</link>
      <guid>http://www.adrianworlddesign.com/Knowledge-Base/Zend-Framework/Helpful-Tips/Valid-Credit-Card-Numbers</guid>
      <content:encoded><![CDATA[<p>If you develop a shopping cart you will have to test your scripts and also perform some credit card validation. In Zend Framework we have Zend_Validate_Creditcard which actually validates the number against a variety of credit card institutes; hence, you need some numbers that work. Not real numbers in a sense of existing credit cards (unless you are eager to use your own credit cards) but numbers that are real in a sense that they pass validation..</p>
<p>I found it very hard and somewhat unbelievable that there are no sources out there with some lists or even a generator. What I found are quite a bunch of websites that tell you how to validate a number. Who needs that?</p>
<p>I have not found a valid number generator so far and I am thinking about writing one but right now I am super busy. So, like a true human being and as such a hunter-gatherer I came back with some numbers I found. Here is a little list of valid credit numbers.</p>
<dl class="code_example"> <dt>AMEXCO *</dt><dd>378282246310005</dd><dd>371449635398431</dd> <dt>MASTERCARD</dt><dd>5555555555554444</dd><dd>5105105105105100</dd> <dt>VISA</dt><dd>4111111111111111</dd><dd>4012888888881881</dd> <dt>DINERS CLUB</dt><dd>38520000023237 **</dd><dd>30569309025904 **</dd> <dt>DISCOVER</dt><dd>6011111111111117</dd><dd>6011000990139424</dd> <dt>JCB</dt><dd>3530111333300000 **</dd><dd>3566002020360505 **</dd> </dl>
<p style="font-size: 1.125em;">* Note that for AMEXCO if you have to run validation tests that the CVV number is 4 digits. All other CC institutes have 3-digit number.</p>
<p style="font-size: 1.125em;">** I have not found time yet to test these numbers with Zend_Validate_Creditcard but the rest works fine and passes validation.</p>
<p>Maybe some time later I will also find some time to write a little generator so we can create a bunch of numbers at will. As for now the list outta do it.</p><img src="http://feeds.feedburner.com/~r/AWD-KnowledgeBase/~4/GZbTf-ndNao" height="1" width="1"/>]]></content:encoded>
    </item>
    <item>
      <title>Text Shadows</title>
      <description><![CDATA[The "text-shadow" is one of the new exciting properties in CSS3. Except for Microsoft's IE (up to and with Version 8) it is one of the properties that is already widely supported. Surprisingly there is much more to it than just shadows. With a little knowledge you can make your fonts and letters glow, neon, emboss and some other stunning effects.]]></description>
      <pubDate>Fri, 24 Jun 2011 11:59:21 -0500</pubDate>
      <link>http://www.adrianworlddesign.com/Knowledge-Base/Web-Standards/Cascading-Style-Sheets/Text-Shadows</link>
      <guid>http://www.adrianworlddesign.com/Knowledge-Base/Web-Standards/Cascading-Style-Sheets/Text-Shadows</guid>
      <content:encoded><![CDATA[<h3>Basic functions</h3>
<p><strong>Warning</strong>: If you use Internet Explorer (up to and with IE8) this will not work because it is not supported!</p>
<p>The basic function for text-shadow is very simple and adds a shadow to your text as expected, i.e. the letters of your selected font. No surprise here really. You provide three values for the shape of the shadow and a fourth value for the color. The examples below are separated to demonstrate the three values for the shape.</p>
<div class="css-example">
<p>First is the h-shadow value, horizontal position of the shadow</p>
<p>text-shadow: 5px 0px 0px #f00;&#160;<span style="font-size: 1.25em; text-shadow: 5px 0px 0px #f00;">Horizontal Shadow</span></p>
<p>The same but with a minus value, moving the shadow to the left</p>
<p>text-shadow: -5px 0px 0px #f00; &#160;<span style="font-size: 1.25em; text-shadow: -5px 0px 0px #f00;">Horizontal Shadow</span></p>
</div>
<div class="css-example">
<p>Second is the v-shadow value, vertical position of the shadow</p>
<p>text-shadow: 0px 5px 0px #f00;&#160;<span style="font-size: 1.25em; text-shadow: 0px 5px 0px #f00;">Vertical Shadow</span></p>
<p>The same but with a minus value, moving the shadow above the text</p>
<p>text-shadow: 0px -5px 0px #f00;&#160;<span style="font-size: 1.25em; text-shadow: 0px -5px 0px #f00;">Vertical Shadow</span></p>
</div>
<div class="css-example">
<p>Third is the blur value, without a blur the text is basically just duplicated in the background as you can see in the examples above</p>
<p>text-shadow: 0px 0px 5px #f00; &#160;<span style="font-size: 1.25em; text-shadow: 0px 0px 5px #f00;">Blur Shadow</span></p>
</div>
<div class="css-example">
<p>Fourth is the color value and the example has all values combined</p>
<p>text-shadow: 1px 1px 2px #a55; &#160;<span style="font-size: 1.25em; text-shadow: 1px 1px 2px #a55;">Text with shadow</span></p>
<p>text-shadow: -1px -1px 2px #a55; &#160;<span style="font-size: 1.25em; text-shadow: -1px -1px 2px #a55;">Text with shadow</span></p>
</div>
<p>As you can see in the fourth example you will get a different results with negative values for the offsets. Depending on the font, letter and font-size you may increase the values but in many cases it will require some fine tuning to find the best effect.</p>
<h3>Extending the effects</h3>
<p>Now, if you just stick to this basic function of the text-shadow you are missing out. The fun part begins because you can add more than just one statement to the property and they will complement each other. You can add some stunning effects to your letters and fonts.</p>
<h4>3D Effect</h4>
<p>We can create a 3D effect very easily with offset on a couple hard shadows. Notice also the change in the color from dark to light.</p>
<p>Stack three hard shadows</p>
<div class="css-example">
<p>text-shadow: 1px 1px 0px #aaa, 2px 2px 0px #bbb, 3px 3px 0px #ccc;<br /><span style="font-size: 1.5em; text-shadow: 1px 1px 0px #aaa, 2px 2px 0px #bbb, 3px 3px 0px #ccc;">Cool 3D Effect</span></p>
</div>
<p>Consider adding some space to shadows but especially with 3D effects.</p>
<div class="css-example">
<p><strong>letter-spacing: 1px;<br /></strong>text-shadow: 1px 1px 0px #aaa, 2px 2px 0px #bbb, 3px 3px 0px #ccc;</p>
<p><span style="font-size: 1.5em; letter-spacing: 1px; text-shadow: 1px 1px 0px #aaa, 2px 2px 0px #bbb, 3px 3px 0px #ccc;">Cool 3D Effects</span></p>
</div>
<p>Especially for large letters you will want a smoother transition. Simply stack the shadows with a soft blur instead of adding more shadows.</p>
<div class="css-example">
<p>letter-spacing: 1px;<br />text-shadow: 2px 2px 0px #aaa, 4px 4px 0px #bbb, 5px 5px 0px #ccc;</p>
<p style="font-size: 4em; letter-spacing: 1px; text-shadow: 2px 2px 0px #aaa, 4px 4px 0px #bbb, 5px 5px 0px #ccc;">Hard 3D Effect</p>
<p>letter-spacing: 1px;<br />text-shadow: 2px 2px 1px #aaa, 4px 4px 1px #bbb, 5px 5px 1px #ccc;</p>
<p style="font-size: 4em; letter-spacing: 1px; text-shadow: 2px 2px 1px #aaa, 4px 4px 1px #bbb, 5px 5px 1px #ccc;">Soft 3D Effect</p>
</div>
<h4>Glow Effect</h4>
<p>Do you like to add some glow to the letters? Simple, stack different sizes and colors, it makes a letter and text glow. We don't need any offsets just a narrow blur with a contrasting color. This will add the glow around the letter. Next, depending on your background you will have to add a second wider blur behind the glow in yet another contrasting color. This will finally make the glow stand out. Note that the order in which you apply the settings is crucial.</p>
<div class="css-example">
<p>letter-spacing: 1px;<br />text-shadow: text-shadow: 0px 0px 1px yellow, 0px 0px 4px #444;</p>
<p style="font-size: 3em; letter-spacing: 1px; text-shadow: 0px 0px 1px yellow, 0px 0px 4px #444;">Let it glow</p>
</div>
<h4>Neon Effect</h4>
<p>How about some neon effect. Keep playing with the glow effect. First we have to make the font's color brighter. Then we add some hard shadows around all four sides with a similar, although, darker color. Finally a larger blur around everything with a similar and bright color and you will have your nice neon effect. Neon effects require some space; don't forget to add some.</p>
<div class="css-example">
<p><strong>letter-spacing: 5px;<br />color: #fdd;</strong><br />text-shadow: 1px 1px 0px #f00, -1px -1px 0px #f00, 1px 1px 8px #eaa;</p>
<p style="font-size: 3em; color: #fdd; letter-spacing: 5px; text-shadow: 1px 0px 0px #f00, 0px 1px 0px #f00, -1px 0px 0px #f00, 0px -1px 0px #f00, 1px 1px 8px #b00;">Some Neon Effect</p>
</div>
<h4>Emboss Effect</h4>
<p>By now you should get the hang of it and your imagination going. By adding some contrasting shadows around all four sides and a soft blur you will get a nice emboss effect.</p>
<div class="css-example">
<p><strong>letter-spacing: 5px;<br />background-color: #aab;<br />color: #677;</strong><br />text-shadow: 1px 1px 1px #eef,-1px 0px 1px #001, 0px -1px 1px #001, -1px -1px 1px #001;</p>
<div style="background-color: #aab;">
<p style="text-align: center; font-size: 3em; color: #667; letter-spacing: 5px; text-shadow: 1px 1px 1px #eef,-1px 0px 1px #001, 0px -1px 1px #001, -1px -1px 1px #001;">Emboss This</p>
</div>
</div>
<h4>Deboss Effect</h4>
<p>Of course, we can make the opposite effect of emboss; simply swap the colors and we have a relief or deboss effect.</p>
<div class="css-example">
<p>letter-spacing: 5px;<br />background-color: #aab;<br />color: #677;<br />text-shadow: 1px 1px 1px #eef,-1px 0px 1px #001, 0px -1px 1px #001, -1px -1px 1px #001;</p>
<div style="background-color: #aab;">
<p style="text-align: center; font-size: 3em; color: #667; letter-spacing: 5px; text-shadow: 1px 1px 1px #001,-1px 0px 1px #eef, 0px -1px 1px #eef, -1px -1px 1px #eef;">Deboss That</p>
</div>
</div>
<h4>Number of Shadows</h4>
<p>Looking at the emboss effect note that there are subtle but sometimes noticeable differences, especially when you work with larger letters. Pay attention to the little changes in the number of shadow statements. Especially around the four axis and with that the corners. In the example to the right, a simple -3px -3px offset alone does not produce smooth transitions around the corners, you will have to add -3px 0px and 0px -3px as well for a smooth transition to the bottom left and to the top right.</p>
<div class="css-example">
<p>letter-spacing: 5px; background-color: #aab; color: #677; font-size: 4em;</p>
<p>CSS for 1. Order:<br />text-shadow: -3px -3px 4px #001, <strong>-3px 0px 4px #001, 0px -3px 4px #001</strong>, 3px 3px 4px #eef;</p>
<p>CSS for 2. Order:<br />text-shadow: 3px 3px 4px #eef, -3px -3px 4px #001;</p>
<div style="background-color: #aab;">
<p style="text-align: center; font-size: 3em; color: #667; letter-spacing: 5px;"><span style="font-size: 4em; text-shadow: -3px -3px 4px #001, -3px 0px 4px #001, 0px -3px 4px #001, 3px 3px 4px #eef;">SE</span> vs. <span style="font-size: 4em; text-shadow: 3px 3px 4px #eef, -3px -3px 4px #001;">SE</span></p>
</div>
</div>
<h4>Order of Shadows</h4>
<p>Another thing you will have to take care of is the order of the statements; the statements are cascading. Again, the differences are subtle but sometimes noticeable and mostly around the corners.</p>
<div class="css-example">
<p>letter-spacing: 5px; background-color: #aab; color: #677; font-size: 4em;</p>
<p>CSS for 1. Order:<br />text-shadow: -3px 0px 4px #001, 0px -3px 4px #001, -3px -3px 4px #001, <strong>3px 3px 4px #eef</strong>;</p>
<p>CSS for 2. Order:<br />text-shadow: <strong>3px 3px 4px #eef</strong>, -3px 0px 4px #001, 0px -3px 4px #001, -3px -3px 4px #001;</p>
<div style="background-color: #aab;">
<p style="text-align: center; font-size: 3em; color: #667; letter-spacing: 5px;"><span style="font-size: 4em; text-shadow: -3px 0px 4px #001, 0px -3px 4px #001, -3px -3px 4px #001, 3px 3px 4px #eef;">SE</span> vs.  <span style="font-size: 4em; text-shadow: 3px 3px 4px #eef, -3px 0px 4px #001, 0px -3px 4px #001, -3px -3px 4px #001;">SE</span></p>
</div>
</div>
<h4>Other Effects</h4>
<p>From here on you can really go over board and make all kinds of effects. Stack shadows like crazy, work with colors and the axis. Just make sure you use them on rather large letters and give some room to breath.</p>
<p>There is a different result with every colors, shadow or change of axis. Below is just one example.</p>
<p>Again, if you don't see anything special you are probably looking at it with an older browser, like Internet Explorer Version 8 or less.</p>
<div class="css-example">
<p>font-size: 6em;<br />color: #aae;<br />letter-spacing: 5px;<br />text-shadow:<br />3px 0px 0px #aaa, 0px 3px 0px #aaa, 3px 3px 0px #aaa,<br />-3px 0px 0px #222, 0px -3px 0px #222, -3px -3px 0px #222,<br />1px 1px 16px #000, -1px -1px 16px #135;</p>
<p style="font-size: 6em; color: #aae; letter-spacing: 5px; text-shadow: 3px 0px 0px #aaa, 0px 3px 0px #aaa, 3px 3px 0px #aaa, -3px 0px 0px #222, 0px -3px 0px #222, -3px -3px 0px #222, 1px 1px 16px #000, -1px -1px 16px #135;">Crazy Effects</p>
</div>
<div class="css-example">
<p>font-size: 4em;<br />color: #eef;<br />letter-spacing: 5px;<br />text-shadow:<br />Line 1: -1px -1px 0px #f33<br />Line 2: 1px 1px 0px #33f<br />Line 3: 1px 1px 0px #f3f, 1px 1px 5px #3d3, 3px 3px 3px #5f5</p>
<p style="font-size: 4em; color: #eef; letter-spacing: 5px;"><span style="text-shadow: -1px -1px 0px #f33;">Check This Out!</span><br /><span style="text-shadow: 1px 1px 0px #33f;">How about this?</span><br /><span style="text-shadow: 1px 1px 0px #f3f, 1px 1px 5px #3d3, 3px 3px 3px #5f5;">Hope you liked it.</span></p>
</div><img src="http://feeds.feedburner.com/~r/AWD-KnowledgeBase/~4/6AhdHpU-jus" height="1" width="1"/>]]></content:encoded>
    </item>
    <item>
      <title>Prefetching documents</title>
      <description><![CDATA[There are various ways to make the web faster. Some are rather blunt other are very sharp but maybe just not what you expected or your application. One method is to prefetch a page, i.e. load a page before the document has even been requested by the user. This document will shed some light on this technique.]]></description>
      <pubDate>Mon, 20 Jun 2011 02:42:50 -0500</pubDate>
      <link>http://www.adrianworlddesign.com/Knowledge-Base/Web-Browsers/Tips-and-Tricks/Prefetching-documents</link>
      <guid>http://www.adrianworlddesign.com/Knowledge-Base/Web-Browsers/Tips-and-Tricks/Prefetching-documents</guid>
      <content:encoded><![CDATA[<p>Making the web faster is always a good idea one might think but sometimes it backfires. Your web application may all of a sudden not work as expected as if somebody is messing with it in the background? You may see sharp increases in the log files because of duplicate entries and you have no clue why a page shows up twice just within seconds?</p>
<p>The secret thing going on in the background might be this:</p>
<h3>Link prefetching</h3>
<p>One obvious problem caused by browsers is what they call link prefetching. In most cases this is business as usual but I had a serious problem because of that.</p>
<p>Let me say this first, though: As it looks right now only Firefox is actively using this method but I think others might follow soon.</p>
<h4>Why browser prefetch</h4>
<p>Lets say you want users to experience faster loading web pages. One simple way is downloading the next page while the user is still reading the current page. However, they need some assistance. Mozilla Developer Network has <a title="Link to MDN and Link Prefetching FAQ" href="https://developer.mozilla.org/en/Link_prefetching_FAQ">an excellent FAQ</a> about how they do it. They are looking for &#60;meta&#62; or &#60;link&#62; tags in the head section; for link its the rel and next attribute. If you place these tags into the head section the browser will go ahead and download the page in the background. When the user finally clicks the link the browser can load the page from its cache.</p>
<h4>A problem for session state</h4>
<p>At first prefetching seems to be a wonderful thing but for me it was messing with my session state.</p>
<p>If you work with forms and need to know if the user is following a certain path you usually do that with session state. A prefetch can easily mess with your state.</p>
<h4>The background conundrum</h4>
<p>Prefetching works in the background, you do not see it unless you peek into your log files. The browser displays the initially requested page as if nothing happened. You can print some debug messages into your pages as long as you want; you will not see what you expect or helps in the browser window.</p>
<p>If you set a counter to your session and echo the value to your page it probably will skip a beat, every time. If you suspect your application is doing this it will drive you absolutely mad.</p>
<p>The log files finally convinced me that the browser was sending requests which caused my application to set a different state as well as advance the counter. Consequently the next button in my form lead to an unexpected result.</p>
<p>There are ways you can handle this behavior in your application but overall I believe it is easier to simply avoid the &#60;meta&#62; or &#60;link&#62; tags if you work with forms and session state.</p><img src="http://feeds.feedburner.com/~r/AWD-KnowledgeBase/~4/N8m3h-9IO_A" height="1" width="1"/>]]></content:encoded>
    </item>
    <item>
      <title>Entity not found in XML</title>
      <description><![CDATA[This page has information about why you might see this error saying something like "Entity 'copy' not found in file ...". One problem is that you have an entity reference and the other that you do not have a declaration for the entity. Likewise there are two solutions. Avoid entities with numeric reference or add the declaration. Both solutions are explained here.]]></description>
      <pubDate>Sun, 09 Oct 2011 15:45:40 -0500</pubDate>
      <link>http://www.adrianworlddesign.com/Knowledge-Base/Zend-Framework/Error-Messages/Entity-not-found-in-XML</link>
      <guid>http://www.adrianworlddesign.com/Knowledge-Base/Zend-Framework/Error-Messages/Entity-not-found-in-XML</guid>
      <content:encoded><![CDATA[<p>XML seems to be very simple when you take a first look at it, after all HTML when properly written is XML; hence, XHMTL. Once you dive deeper into XML it gets more difficult and you may encounter a problem like this one: <strong>Entity not found</strong>.</p>
<p>It usually happens when you load XML and try parsing the data. What is an even bigger problem is finding an answer for this problem because the whole topic seems to be so advanced (nerdy) that most pages on the web expect you to be already proficient in this field.</p>
<p>Now, this here is not a quicky into <strong>XML for dummies</strong> but to understand what is going on we have to talk about some fundamentals. I try to keep it very simple, though.</p>
<h3>The main problem</h3>
<p>When you load an XML file in php you are probably using <strong>simplexml_load_file</strong> or <strong>DOMDocument::load</strong>. Either way, the main error message is the same: "<em>Entity 'entityname' not found ...</em>". Additionally <strong>simplexml</strong> will add some more lines with the actual line of text.</p>
<p>It should not take you long to realize that one or more of the funny characters is the culprit, maybe a copyright sign &#169; (&#38;copy;) somewhere in a paragraph.</p>
<h4>Computers are stupid</h4>
<p>We sometimes forget it but computers are incredibly stupid&#8212;you have to tell them everything!</p>
<p>Parsing an XML document is no exception. There are in fact a couple pitfalls in the characteristic of XML itself. Mainly the tags with the <em>less than sign (&#60;)</em> and <em>greater than sign (&#62;)</em> plus the <em>double-quotes (")</em> around the value in attributes.</p>
<p>Imagine you want to save some HTML in XML. No doubt, you have some of the signs or double-quotes in your HTML data. Your XML parser will have a problem with them. Here is an example:</p>
<dl class="code_example"><dt class="code_description">&#60;!-- an XML element holding HTML data --&#62;</dt><dd>&#60;somexmltag&#62;<br /><span class="code_focus">&#160; Some HTML text with a &#60;span class="special"&#62;special&#60;/span&#62; word</span><br />&#60;/somexmltag&#62;</dd></dl>
<p>This will clearly not work because XML has absolutely no way to know why the &#60;span&#62; tag is not a valid XML tag. If we need valid XML we have to somehow tell XML, i.e. escape these characters. The way we do that in XML are <strong>character references</strong>.</p>
<p>This brings us to the next pitfall. XML knows or has a basic set of character references, called <strong>entity references</strong>, and miraculously knows what to do with this entities. What is not obvious is that an entity reference like &#38;quot; has to be translated internally. XML parsers are looking for this ampersand pattern. If they recognize a pattern but it does not match the limited internal set they throw our error.</p>
<p>The big problem: Next to this limited number of references we have a lot more references to work around some problems with character encoding in different character sets and languages. In fact there is a large list with lots of character references.</p>
<p>Wait a minute, you say. What about HTML and these funny character references? Why is there only a problem in XML and not HTML with these characters? Because we tell browsers how to deal with these "other" character references in HTML.</p>
<h3>DOCTYPE</h3>
<p>Ever wondered why web pages have this weird first line of text starting with the word&#160;<strong>DOCTYPE</strong>? No? Well, there is your answer.</p>
<h4>Document Type Definition (DTD)</h4>
<p>The DOCTYPE itself is meaningless but the <strong>DTD</strong>&#160;defined inside the DOCTYPE is where all the fun stuff is happening. Like with CSS or Scripts we can define the data either internally, inside the document, or externally, by providing a file path to the definition. The DOCTYPE in HTML usually has the link to a .dtd file as <a title="Link to W3C and DTDs" href="http://www.w3.org/TR/xhtml1/dtds.html#h-A1">defined at www.w3c.org</a>. Feel free to copy the link in a DOCTYPE statement from any web page and paste it into the address field; it should pop up the file download window in your browser. Save it and take a look at it. The file is a regular text file, no secrects there.</p>
<p>Inside the file we have all the <strong>Document Type Definitions</strong> telling the browser what to do with all the tags and attributes including some other stuff. One of this other staff is the information to the funny character references.</p>
<h3>Character References</h3>
<p>The proper name for the funny characters is <strong>Character References</strong>. You will find them almost at the top of a dtd file and labeled <em>Character mnemonic entities</em> in the comment line.</p>
<p>There we have three types of entity sets and you will also see references to file names (as .ent files). Don't try downloading these files, they are nowhere to be found at w3c.org for download. I suspect they don't want you to directly link to them (and indeed you should not) and I think it is no secret, browsers have them already stored internally as well as the .dtd files. These files rarely change.</p>
<p>So, how do we know what is in those .ent files? If you haven't looked at the whole page in the earlier link above here it is again but this time directly to the entity sets at <a title="Link to W3C and DTDs" href="http://www.w3.org/TR/xhtml1/dtds.html#h-A2">www.w3c.org</a>. There you see the DTD sets for&#160;<strong>Latin-1 characters</strong>, <strong>Special characters</strong> and <strong>symbols</strong>.</p>
<h4>Entity versus Numeric</h4>
<p>Before we can discuss the solution to our problem with the missing entity error lets have a few words about what entity (or entities) stands for.</p>
<p>Lets take the copyright sign as an example. Within the DTD we see the following line:</p>
<dl class="code_example"><dd>&#60;!--ENTITY copy&#160; "&#38;#169;"--&#62;</dd><dd class="code_description">&#8195;&#8195;&#60;!-- copyright sign, U+00A9 ISOnum --&#62;</dd></dl>
<p>Note the word <em>copy</em> and the number <em>169</em>.</p>
<p>In terms of characters a computer always works with numbers internally, actually with their binary value as a byte. What this means is that browsers and XML parser always know what to do with &#38;#169;&#8212;which is a <strong>numerich character reference</strong>. Note: For simplicity we don't add and talk about the hex values.</p>
<p>For humans this is not a fun thing to remember; however, copy for copyright is. Character references with words instead of numbers are called <strong>character entity references</strong>.. Therefore we can say, the DTD for the entity sets is nothing more than a translation for conversion table. We tell the computer program what to do with entity references, how to translate/convert them into numeric references.</p>
<p>You can actually create your entity references in a DTD. Say you want a entity reference as &#38;company you simply have to add the ENTITY definition into a DTD.</p>
<p>Now you know why browsers for HTML can secretly work with entities. XML parsers on the other hand (like <strong>DOMDocument</strong> or <strong>simplexml</strong>) cannot as long as they don't have any form of DTD telling what to do with entities.</p>
<h3>The solution</h3>
<p>There are two solutions to the problem.</p>
<h4>Solution 1:<br />Provide a document type definition</h4>
<p>Provide the definition DTD in your XML files either internally or externally with a .dtd file.</p>
<p>Here lies the real reason, I believe, why you cannot link or download the definitions from w3c.org. Imagine everyone would add the link to the .ent files at w3c.org into their XML files. Every time a XML file is loaded and a XML parser kicks into gear a connection to their servers is opened. An absolute waist of bandwidth in the Internet to three files that rarely if ever change.</p>
<p>So if anything keep these files local or better yet use ...</p>
<h4>Solution 2:<br />avoid character entity references</h4>
<p>Instead, work exclusively with numeric characters.</p>
<p>I will later/soon have some links to a dtd file you can download and then link into your XML files locally as well as some script to translate/convert entity references into numeric references and vice versa. Which ever solution you prefer for your environment.</p><img src="http://feeds.feedburner.com/~r/AWD-KnowledgeBase/~4/LZNyPR5CfFE" height="1" width="1"/>]]></content:encoded>
    </item>
    <item>
      <title>Display vs Screen for resolution</title>
      <description><![CDATA[Not sure what display or screen resolution is and what to do with the pixel numbers? This page has some information about what screen resolution is what number of pixels you should use.]]></description>
      <pubDate>Fri, 13 May 2011 12:08:47 -0500</pubDate>
      <link>http://www.adrianworlddesign.com/Knowledge-Base/Web-Standards/Various-Standards/Display-vs-Screen-for-resolution</link>
      <guid>http://www.adrianworlddesign.com/Knowledge-Base/Web-Standards/Various-Standards/Display-vs-Screen-for-resolution</guid>
      <content:encoded><![CDATA[<p>Most people do not think much about display or screen resolution and when they probably have a good understanding of what it or they mean. No matter if you have no idea at all or think you know the answer read on and let me tell you what I know about resolution with displays and screens for your monitor and computer.</p>
<h3>Some Background</h3>
<p>Lets begin with some background knowledge first and how we came to the point where we are today. I think it really helps to understand what the numbers mean when you know how computers generate output.</p>
<h4>Back in the days</h4>
<p>Way back in the days of the first dinosaur computers they had no screens, displays or monitors. Now, when we think about how a computer in those days presented information or a result we have to think ink, print and paper. No images, just text in a line by line format. When we progress and think about how the first monitor display looked like it was pretty much the same. Still no images, just text line by line because that was what they dearly needed. Instead of waiting for the print out they could see the results instantly on the screen. As an interesting side note: In programming languages we still have commands named "print" for sending data to the output device. The other word is "echo" for sending text to the screen.</p>
<p>Therefore the big question was: How do you display text on a screen? There are two problems to this story and what people forget. First and obvious for most people is how do you create a monitor and  show text. That is not the real problem, though. The not so obvious question is the toughie: "How does a computer create text for display?" That second problem will lead us to the answer for resolution.</p>
<h4>The big chessboard</h4>
<p>The engineers at that time had to figure it out and when you think about what a computer does it is simple. The only thing a computer really does is turning things on and off. Take a chessboard and you know exactly what or where 3B is. Imagine a monitor screen with 8-by-8 squares and you can tell anybody to turn on or off the square representing 3B. Even a stupid computer!</p>
<p>On those first monochrome monitors you could in fact see the raster and those little squares. The letters had to be drawn in ways to work with these squares.</p>
<p>Since then not much has really changed simply because computers still only do one thing. Exactly, turning on and off things and a raster is maybe not the only way but most efficient way you can tell a computer to present something on screen. However, things have become smaller and smaller and of course, faster and faster. Oh, and the squares became a new name&#8212;Meet the <em>Pixels</em>.</p>
<h4>Smaller is bigger</h4>
<p>Along came Apple and they thought about how to present text on their first computer and monitors. At that time the squares became colorful and they also got smaller and smaller. In other words, the densitity of pixels got bigger on monitor screens. For their first monitor Apple settled for a density or raster of 72 pixels per inch (ppi). There are many informations on the web about how they came up with the number but to some degree it just does not really matter.</p>
<h3>Your real estate</h3>
<p>Despite the fact that screens are bigger today the density is roughly the same. What has changed are the dimensions; we kept the density but added some real estate, i.e. more bigger screens and with it more pixels to width and height.</p>
<h4>Early standards</h4>
<p>Some people remember VGA (Video Graphics Array) as one of the first standards. Among other things the standard was known for its dimensions: 640x480. Followed by SVGA with 800x600, XGA 1024x768. Other interesting standards and numbers are HDTV (High Definition TV) with 1280x720 and FullHD with 1920x1080. These number are the total of pixels in a width (horizontal) by height (vertical) direction. An important and often overlooked fact is that these numbers are the computer's display resolution; not the monitor screen's resolution. It is the resolution the computer (plus the graphic card/chip) are meant to produce and send to the monitor's screen.</p>
<p>If you like to know the resolution of the screen you have to look at the technical specification of the monitor not the computer.</p>
<h4>Resolution belongs to computers</h4>
<p>Not convinced? Lets step back in time once more. Nowadays we buy flat screen monitors and TVs. Until just a few years ago we bought tubes, CRT monitors. They worked a little bit different and the display resolution was something we changed at will. In the early days CRT monitors have been able to show a far better density than the resolution a computer was able to calculate in a timely manner. The time factor by the way is something we should not forget about the old days. The higher the resolution the more computing power is required to generate a fresh image; which is not really true in computer graphics, but that is not the point here.</p>
<p>With flat screens today we usually do not change the resolution. We (should) stick with the default settings. Why? Because, unlike the CRTs, they have those tiny little light bulbs side by side and line by line. If you would change the resolution to anything different than the exact number of little light bulbs some parts of the image would not look so great because a lot of information for the image submitted by the computer falls between two light bulbs, i.e. it gets cut off. Unless you have at least twice the number but we don't waste any thoughts on that.</p>
<p>Usually with flat screens we have a match between screen resolution and display resolution.</p>
<h3>What really matters</h3>
<p>What really matters is the computer's display resolution and the number of pixels in that particular resolution.</p>
<p>When you think about the giant screen at the Cowboys Stadium in Dallas you might wonder how many pixels that are. The pixels on that board are different for sure and appearently that gigantic screens corresponds to only 2423 x 1088 pixels. Now, are these actual pixels with the monitor screen? It does not matter because the only thing that matters is the computer and the resolution it produces.</p>
<p>The screen, monitor or whatever we want to call the device connected to the computer is irrelant in terms of the actual number of pixels or what we usually see and understand as resolution. The monitor only needs to understand how it has to display the resolution set and send by the computer.</p><img src="http://feeds.feedburner.com/~r/AWD-KnowledgeBase/~4/8SSR4Fu3RJQ" height="1" width="1"/>]]></content:encoded>
    </item>
    <item>
      <title>MVC Pattern</title>
      <description><![CDATA[The framework and the build in MVC pattern really rock but they don't talk much about it in the documentation. Knowledge about the MVC pattern is implied in the documentation. This page will have some information about Model-View-Controller patterns in the framework]]></description>
      <pubDate>Sun, 09 Oct 2011 15:12:47 -0500</pubDate>
      <link>http://www.adrianworlddesign.com/Knowledge-Base/Zend-Framework/Introduction/MVC-Pattern</link>
      <guid>http://www.adrianworlddesign.com/Knowledge-Base/Zend-Framework/Introduction/MVC-Pattern</guid>
      <content:encoded><![CDATA[<h3>With or without MVC is up to you</h3>
<p>A thing you have to look out for in the Zend Framework is the MVC pattern. If you don't know and completely understand the MVC pattern  you can still use the framework. That's fine, great actually! I bet that  many developers use the framework without MVC. However, if you have to write a  web site from scratch with more than just a few dynamic pages and you don't take  advantage of the MVC pattern you are missing out on the framework.</p>
<p>Unfortunately, and no matter which way you are going to use the framework, the reference guide mixes up  things in many places. They either bring in stuff that applies  only to MVC (and they don't make it clear) or you will have to figure it  out by yourself. How do I squeeze that specific class into their MVC  pattern. This is tricky especially for developers who don't know the MVC  pattern, they will not spot the sometimes subtle differences.</p>
<h3>What the heck is MVC</h3>
<p>If you had to take a break and look up what  the heck MVC stands for you, you will have the exact same problem in the reference guide. I knew what MVC was but never used or worked with a MVC pattern. I constantly had to look up stuff elsewhere. It comes natural to me now and the framework is actually awesome to learn and see MVC at  work--but it was a tough and rocky start. The framework and the build in  MVC pattern really rock but they don't talk much about it in the reference guide. Knowledge about the MVC pattern is implied, a prerequisite they do not mention.</p>
<p>Again, you can use the pieces in the Zend  Framework for your project without thinking about and using any MVC  pattern. But, if you want to unlock the full potential of the framework  you will have to read, learn and understand MVC. If you still don't know what  MVC stands for here it is: Model-View-Controller. Feel better?</p>
<p>I might write some pages later about the MVC  pattern or at least a collection with some links but I am not there  yet. So, please bear with me.</p><img src="http://feeds.feedburner.com/~r/AWD-KnowledgeBase/~4/qGH6-003VrM" height="1" width="1"/>]]></content:encoded>
    </item>
    <item>
      <title>Knowledge Base Overview</title>
      <description><![CDATA[The pages in this section contain knowledge (information) about things related to Information Technology (IT), Web Design, Development, PHP, Zend Framework and things like standards, hints and tips. You will also find things concerning programming. Whenever I stumble upon something that might be useful in the future or to others I will write it down here. Most of this information is therefore written and based upon experience and not necessarily to kill time and write about stuff I heard somewhere.]]></description>
      <pubDate>Thu, 29 Dec 2011 10:53:37 -0600</pubDate>
      <link>http://www.adrianworlddesign.com/Knowledge-Base</link>
      <guid>http://www.adrianworlddesign.com/Knowledge-Base</guid>
      <content:encoded><![CDATA[<h3>Why a Knowledge Base (KB)</h3>
<p>Whenever you stumble upon something that makes you curious you have to do some research, right? That is probably the reason you landed here. Same for me; however, sometimes for me this launches a full blown investigation. Most of the time I also want to keep it for later. Hence, I write it down.</p>
<h4>Protect my knowledge</h4>
<p>You will never know when you might need it again and&#160;especially&#160;if you still remember everything correctly. Another good part about writing down stuff in your own words (as opposed to copy/paste or just links and bookmarks) is, that you have to think about the topic in different ways. Writing down and publishing these things forces me to go deeper than what I actually needed. If forces me to have a better understanding about certain things.</p>
<h4>Share my failures</h4>
<p>So, most of this information is therefore written and based upon my experience&#8212;failed experiments, if you will. Things I learned the hard way. It is not about killing time and writing a complete story about something. It is about little individual things I had to research, learn and understand. Instead of keeping it to myself I will share it here. I hope it will come in handy for me and some of you, too.</p>
<h3>Where you find what</h3>
<p>The articles are grouped in main topics which themselves will have different areas. Think of it as my notes in different binders with tabbed separators, or books with chapters.</p>
<h4>Main Topics</h4>
<p>Following is a list of links to some main topics. The main topics will have further links to chapters and the documents in them.</p>
<div>
    <dl class="subpage_menu">
        <dd><a href="http://www.adrianworlddesign.com/Knowledge-Base/Web-Standards" title="The information and pages in this part are related to web standards">Web Standards</a></dd>
        <dd><a href="http://www.adrianworlddesign.com/Knowledge-Base/php" title="Basic stuff related to PHP">PHP bare-bones</a></dd>
        <dd><a href="http://www.adrianworlddesign.com/Knowledge-Base/Zend-Framework" title="The information and pages in this part are related to the Zend Framework">Zend Framework</a></dd>
        <dd><a href="http://www.adrianworlddesign.com/Knowledge-Base/zf2" title="Information about version 2 of the Zend Framework">Zend Framework 2</a></dd>
        <dd><a href="http://www.adrianworlddesign.com/Knowledge-Base/git" title="Some experience and knowledge about Git and Github">Git - Github</a></dd>
        <dd><a href="http://www.adrianworlddesign.com/Knowledge-Base/seo" title="Knowledge about SEO (Search Engine Optimization)">Search Engine Optimization</a></dd>
        <dd><a href="http://www.adrianworlddesign.com/Knowledge-Base/Web-Hosting" title="The information and pages in this part are related to Web Hosting">Web Hosting</a></dd>
        <dd><a href="http://www.adrianworlddesign.com/Knowledge-Base/Linux" title="Things I know and learned about Linux">Linux</a></dd>
        <dd><a href="http://www.adrianworlddesign.com/Knowledge-Base/Microsoft-Windows" title="Here are some things I know and learned about Windows">Microsoft Windows</a></dd>
        <dd><a href="http://www.adrianworlddesign.com/Knowledge-Base/Web-Browsers" title="The information and pages in this part are related to Web Browsers">Web Browsers</a></dd>
        <dd><a href="http://www.adrianworlddesign.com/Knowledge-Base/MobileDevices" title="Information about developing for mobile devices like smartphones">Mobile Devices</a></dd>
    </dl>
</div>
<p>I am working on a search box and function but for the time being you will have to browse through the chapters. It is not a lot yet anyways.</p>
<h4>Special Notes</h4>
<p>Note that some articles may appear in more than just one location. In my web site's framework I am able to share articles among different pages.</p>
<p>Also note that this will never be a complete repository of information about a certain topic. As I have explained in the first paragraph it is based on and happens when I work on something. However, I will add some content on topics not only just when I see it for the first time but also things I experienced at some point in the past and that have surfaced again. Now that I have the chance and the web site to write it down I will revisit, revise and write down my experience.</p><img src="http://feeds.feedburner.com/~r/AWD-KnowledgeBase/~4/jFskTlYFCkk" height="1" width="1"/>]]></content:encoded>
    </item>
  </channel>
</rss>
