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

<channel>
	<title>Zo'C &#187; Tutorial</title>
	<atom:link href="http://www.z-oc.com/blog/category/tutorial/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.z-oc.com/blog</link>
	<description>The Science of Web Art, Design and Development</description>
	<lastBuildDate>Wed, 03 Feb 2010 15:10:21 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Colour reduction algorithms in Photoshop</title>
		<link>http://www.z-oc.com/blog/2009/01/colour-reduction-algorithms-phothoshop/</link>
		<comments>http://www.z-oc.com/blog/2009/01/colour-reduction-algorithms-phothoshop/#comments</comments>
		<pubDate>Fri, 30 Jan 2009 01:40:35 +0000</pubDate>
		<dc:creator>Guilherme Zühlke O'Connor</dc:creator>
				<category><![CDATA[On The Web]]></category>
		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://www.z-oc.com/blog/2009/03/untitled/</guid>
		<description><![CDATA[]]></description>
			<content:encoded><![CDATA[<p><img  class= "left"  src= "http://www.z-oc.com/blog/wp-content/uploads/2009/01/colour-reduction-algorithms-in-phtoshop.png"  alt= "Colour Reduction Algorithms in Phtosho title="" /></p>
<p>When you export graphics to be used in web pages, file size is important and for as obsolete as Gifs may seem to the eyes of some, don&#8217;t be mistaken,<br />
the indexed color system isn&#8217;t going anywhere. Even if Gifs are a bit in decline, Png files can use the indexed color system and this is actually very useful.</p>
<p>Despite the predominance of Jpegs and support to millions of colours, many images are simple enough that they could benefit of using more modest color systems<br />
like indexed color which allows for up to 256 colours but allows you to control with precision which colours these would be and exactly how many, allowing for<br />
extremely compact image sizes.</p>
<p><span id="more-367"></span><br />
The RGB system allows you to represent up to 16,777,216 colours. Each colour is represented by 24bits; 8 bits for each of the red, green and blue channels.</p>
<p>This is the cost of having a wide colour spectrum for an image, which is much welcome for that picture you took at the paradisiac island you went on your last holidays.<br />
You need blues and greens for skies and sea, yellows, oranges and reds for the flowers and exotic birds and so on. You can&#8217;t settle for less.</p>
<p>Now, how about the icons on your navigation bar? Say they are 16px tall and 16pixels wide. They have only 256 pixels overall, so you can&#8217;t possibly have more<br />
than 256 colours, even if no two pixels share the same.</p>
<p>Of course is very rare that an image has every single pixel of a different colour, so in practice you have significantly bigger images with no more than 256 colours.<br />
Further, there are types of images that, for as big as they can be, they have a limited number of colours, for instance, illustrations and drawings with no gradients<br />
or with small ones.</p>
<p>This is where the indexed color system comes in handy.</p>
<p>In this mode, you can have only up 8 bits per pixel. Compared with 24 in RGB, that is a third of the uncompressed size. Very tempting and even more so when<br />
you discover that you can specify the image depth (the amount of bits per pixel) to any amount up to 8. So, if you can afford to have only 16 colours, you only<br />
need 4 bits per pixel.</p>
<p>Photoshop, just as any other half-decent image editor, will allow you to work in RGB for flexibility and to export files in indexed colour on Gif or PNG format for<br />
the web (and on several other formats, that I won&#8217;t cover here).</p>
<p>Now, it is a fact that if we remove some of the colours of a colourful image we won&#8217;t notice. In fact, this is how the Jpeg compression algorithm works; it will discard<br />
colour information to reduce the file size.</p>
<p>The GIF and PNG compression algorithms are quite different and, in fact you can use that to your advantage, because while the Jpeg will always discard colour information,<br />
the GIF and PNG compression algorithms are conservative and they will preserve your image intact. This is particularly important for drawings and illustrations that have<br />
much less details than photographs and even little losses can be quite damaging.</p>
<p>But having said that, you can use photoshop to discard some of the colours in the image before you export them as GIF or PNG.</p>
<p>To save images for the web in Photoshop, you have to go to File &rarr; &#8220;Save for web &amp; Devices&#8221;. A dialog will open showing you the original image and how the final image will look like.</p>
<p>Now, in the right pane, you&#8217;ll see several options and if you select either PNG-8 or GIF, you will have a box for the colour reduction algorithm that allows you to chose<br />
from </p>
<ul>
<li>Perceptual</li>
<li>Selective</li>
<li>Adaptive</li>
<li>Restrictive (Web)</li>
<li>Custom</li>
<li>Black &amp; White</li>
<li>Grayscale</li>
<li>MacOS</li>
<li>Windows</li>
</ul>
<p>Let&#8217;s start for the easy ones. Black &amp; white will make pixels either black or white. No shades of gray, no colours, only one bit for each pixel. Grayscale will use<br />
8 bits per pixel and will approximate each pixel to a shade of gray, the resulting image will have no colour, but will have shades of gray. MacOS and Windows will<br />
approximate the colours on the image to the closest colour of the basic palette of these systems and custom will allow you to pick the colours you want on your palette.</p>
<p>Custom is very powerful, but can also be very annoying. Also, very often you already selected some colours that you&#8217;ve put on your image and you want to preserve.</p>
<p>This is where Perceptual, Selective and Adaptive come in.</p>
<p>If the original image contains more colours than the output file (you can select the number of colours on the right pane, up to 256) some will have to be adapted.</p>
<p>The <em>Perceptual</em> algorithm will create a palette that prioritizes the colours that the human eye has greater sensitivity. This means that colours that appear more<br />
frequently may not be present in the resulting image at all.</p>
<p>The <em>Selective</em> algorithm will prioritize broad regions of colours. If you want to keep your colours as faithful as possible<br />
to the original, this one is more likely to do that.</p>
<p>The <em>Adaptive</em> algorithm on the other hand will prioritize the colours present in more pixels across the image. Predominant hues will have more tones<br />
in the palette.</p>
<p>Finally, <em>Restritive (web)</em> is a bit out of fashion these days but in the old days when was uncommon for computer monitors to show more than 256 colours<br />
a special palette was created for the web with colours that any monitor would be able to show. This palette is made of 6 equidistant shades of each of the three<br />
RGB channels. The tones are 0&#215;00, 0&#215;33, 0&#215;66, 0&#215;99, 0xcc and 0xff. Meaning that you can combine these to form the 216 colours of the web palette, for instance<br />
the colour 0&#215;33ffcc is a web safe colour. You may never need this last one, but it won&#8217;t hurt to know either, right?</p>
<a href="http://www.z-oc.com/blog/powerblogroll/">Zo'C powerblogroll</a> - A plugin to make powerful blorgrolls with favicons, descriptions, notes and RSS links]]></content:encoded>
			<wfw:commentRss>http://www.z-oc.com/blog/2009/01/colour-reduction-algorithms-phothoshop/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Domain redirect wizardry with .htaccess rules</title>
		<link>http://www.z-oc.com/blog/2009/01/htaccess-redirect-wizardry/</link>
		<comments>http://www.z-oc.com/blog/2009/01/htaccess-redirect-wizardry/#comments</comments>
		<pubDate>Fri, 02 Jan 2009 17:10:47 +0000</pubDate>
		<dc:creator>Guilherme Zühlke O'Connor</dc:creator>
				<category><![CDATA[Server Side]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[domain]]></category>
		<category><![CDATA[redirect]]></category>
		<category><![CDATA[wizardry]]></category>

		<guid isPermaLink="false">http://www.z-oc.com/blog/2009/01/untitled/</guid>
		<description><![CDATA[So you decided your domain doesn&#8217;t fit you as well as you&#8217;d like. And you are also afraid you&#8217;ll be losing all the old links and search
engine ranking if you move to a new one. Maybe you also want to use the current domain for a different project that suits it best.
Or maybe you just [...]]]></description>
			<content:encoded><![CDATA[<p>So you decided your domain doesn&#8217;t fit you as well as you&#8217;d like. And you are also afraid you&#8217;ll be losing all the old links and search<br />
engine ranking if you move to a new one. Maybe you also want to use the current domain for a different project that suits it best.</p>
<p>Or maybe you just want to change the structure of your URLs or you want a different URI structure in the new domain.</p>
<p>Let&#8217;s see how to write some htaccess rules so Apache can do the magic for you.</p>
<p><span id="more-342"></span></p>
<h3>Redirect the whole domain</h3>
<p>Redirecting a whole domain with .htaccess rules is easy. All you have to do is to put the rules below in an file named .htaccess<br />
in the root directory for your old domain.</p>
<pre><code>
RewriteEngine on
RewriteRule ^(.&lowast;)$ http://www.newdomain.com/$1 [R=301,L]
</code>
</pre>
<p>Let&#8217;s see how the magic happens.</p>
<p>The first line is merely to turn on the Rewrite engine on apache and enable the rewrite rules to be interpreted.</p>
<p>The second line is composed of 4 parts.</p>
<ol>
<li>The RewriteRule keyword</li>
<li>A regular expression (regex) to match the original URI</li>
<li>The URI to be redirected to and </li>
<li>Parameters</li>
</ol>
<p>The regular expression in this case is <code>^(.*)$</code>. The dot, in a regular expression matches a character, any character except the newline.<br />
That means that any letter, number or symbol container in a URL will be matched. The asterisk <code>(&lowast;)</code> means that you want to repeat the regex it affects<br />
zero or more times.</p>
<p>Simply put, <code>(.&lowast;)</code> matches any amount of non-newline characters, including zero.</p>
<p>Additionally, the carat <code>(^)</code> represents the start of a line and the dollar sign <code>($)</code> represents the end, so the whole expression<br />
matches a line of zero or more non-newline characters, i.e., the whole path of your URI inside your domain.</p>
<p>The third part is the URI to redirect to. As you see, is pretty straightforward, the only tricky bit is the <code>$1</code>.</p>
<p>The reason for it is that you don&#8217;t want to redirect any URI in the old domain to the root of your new domain. What you want is to redirect<br />
each page for the equivalent in the new one. For instance this URI</p>
<pre><code>http://www.oldomain.com/path/to/page</code></pre>
<p>Should redirect to</p>
<pre><code>http://www.newomain.com/path/to/page</code></pre>
<p>Now, for every regular expression inside parenthesis the text it matches is stored for use in the third part as a variable. The variables are called<br />
<code>$1</code>, <code>$2</code>, <code>$3</code> and so on. We have only one Regex matching the whole path (remember the domain name is not included)<br />
so we have the whole path stored in <code>$1</code>.</p>
<h3>Altering the URI structure</h3>
<p>It may be the case that you don&#8217;t like the current structure of your URI&#8217;s. If your blog has URIs like this</p>
<pre><code>www.olddomain.com/blog/category/2009-12-20-post-title</code></pre>
<p>Say we decide dates are not that important, we only want to keep the year, and we want it separated by a slash, rather than a dash. Additionally,<br />
we want to get rid of the &#8216;blog&#8217; keyword, since the whole domain is for the blog. The following rule will do the trick.</p>
<pre><code>
RewriteEngine on
RewriteRule ^blog/(.&lowast;)/([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])-(.&lowast;)$ http://www.newdomain.com/$1/$2/$5 [R=301,L]
</code></pre>
<p>Here we have 5 matches being put into variables, one for each pair of parenthesis.</p>
<dl>
<dt>The category ($1)</dt>
<dd>Matches the first set of non-newline characteres after &#8216;blog/&#8217; and the before the following slash.</dd>
<dt>The Year ($2)</dt>
<dd>Matches 4 consecutive digits after the second slash and before the first dash after that</dd>
<dt>The Month ($3)</dt>
<dd>Matches 2 consecutive digits between the first and second dashes after the second slash</dd>
<dt>The day ($4)</dt>
<dd>Matches 2 consecutive digits between the second and third dashes after the second slash</dd>
<dt>The Post Slug ($5)</dt>
<dd>Matches all the rest of the line</dd>
</dl>
<p class="warning">Before we proceed, notice a peculiarity here. Because the rule starts with the carat (^) and ends with the dollar sign ($) you are<br />
matching the whole line in this format. If the URI doesn&#8217;t start exactly with &#8220;blog/&#8221; and has the exact amount of slashes and dashes<br />
we specified it won&#8217;t be a match and will be ignored. Also, the category may be empty, as long as the two slashes are there, but the digits<br />
must be present in exact amounts. That, of course, is to be expected of any previously valid URL on the domain.
</p>
<p>Now that we have the five variables with the orginal information parsed, we can use them as we want. We decided to get rid of the blog part (which we<br />
are matching literally, instead of via regex, because it&#8217;s too simple), month and day and reorganize category, year and post slug. We will use the<br />
first, second and fifth variables and simply ignore the rest.</p>
<pre><code>http://www.newdomain.com/$1/$2/$5/</code></pre>
<p>If you don&#8217;t want to redirect to a new domain but just rearrange the URIs within it, you may simply omit the domain on the redirection and use these rules</p>
<pre><code>RewriteEngine on
RewriteRule ^blog/(.&lowast;)/([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])-(.&lowast;)$ /$1/$2/$5 [R=301,L]
</code></pre>
<h3>Reusing the domain for a different project</h3>
<p>More often than not, after a domain redirect, the old domain will remain merely as an entry point for redirection. People do that for several reasons,<br />
one of them is that readers can be confused to find the old URLs being redirected to a new site and the domain being used for a new site.</p>
<p>But deciding whether or not to reuse your domain is outside the scope of this post. You may be splitting your site in two and you&#8217;ll leave part of it in<br />
the old domain or after a few years, links to your old domain may be minimal or, simply, you may have a better strategy that I can thing while writing this.</p>
<p>In any case, if you want to reuse your domain at some point, you must be aware of a few things.</p>
<p>All the URI&#8217;s redirected are taken and can&#8217;t be reused without disabling the redirection. You guessed that, of course, but you have to keep in mind that<br />
when you are using regexes for your redirects you are matching a whole class of URIs, even some that have not being used but match the pattern.</p>
<p>If you hurried up and used the first rule (repeated below) you are matching every single URI within the old domain and it means that any content there<br />
will be unreachable because the redirection rules will take precedence.</p>
<pre><code>
RewriteEngine on
RewriteRule ^(.&lowast;)$ http://www.newdomain.com/$1 [R=301,L]
</code></pre>
<p>If you used the second rule (repeated below) you are targetting a much more specific set of URIs. Anything that doesn&#8217;t have the exact format described<br />
(/blog/[characters]/[4digits]-[2digits]-[2digits]-[characters]) will be reachable.</p>
<pre><code>
RewriteEngine on
RewriteRule ^blog/(.&lowast;)/([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])-(.&lowast;)$ http://www.newdomain.com/$1/$2/$5 [R=301,L]
</code></pre>
<p>You&#8217;ll be able to even run a blog under <code>http://www.olddomain.com/blog/</code> as long as you don&#8217;t use the exact same URI structure. Again<br />
whether or not this is a good idea is up to you to decide.</p>
<h3>301 or 302 redirects</h3>
<p>Finally, you may have noticed that one of the parameters on the last part of the rules is the number 301. This is the type of redirection you are<br />
performing. You can use either 301 or 302 as redirection codes, 301 stands for a permanent redirection, whereas 302 stands for a temporary redirection.</p>
<p>Redirection codes are informed to user agents (browsers), search bots and anyone else who may want to know. While both redirection codes will take you<br />
to the new URI, there are important consequences of choosing either.</p>
<p>Because user agents and bots are informed of the redirection code, they can take actions based on them.</p>
<p>A temporary redirection is equivalent to an &#8220;Out For Lunch&#8221; sign. For some reason, the page is being redirected, but you are confirming the user is on<br />
the permanent URI for the resource. Bear in mind that &#8220;temporary&#8221; doesn&#8217;t imply in any length of time, you are only saying &#8220;Yes, this is the URI. We<br />
are operating there right now, but come back here the next time&#8221;.</p>
<p>Reasons for that could be:</p>
<dt>Maintenance page</dt>
<dd>You may want to redirect the whole traffic of your page for a few minutes or hours while you are performing an upgrade</dd>
<dt>Feedburner redirect</dt>
<dd>If you use feedbuner, you may want people to subscribe to an URI within your domain, but redirect to feedburner. If<br />
    one day you want to use a different service, all your subscribers use your URI, so they will be automatically redirected.</dd>
<p>A permanent redirection is stronger, it is equivalent to say &#8220;We moved, we are now operating there and we are not coming back. Next time<br />
you may prefer to go there straight away&#8221;. The consequence of that<br />
is that search bots, intelligent user agents, social bookmarking sites and whoever else may care, can update their links to the new location.</p>
<p>This is what is going to make possible for Search Engines to transfer the status of your site to the new structure.</p>
<a href="http://www.z-oc.com/blog/powerblogroll/">Zo'C powerblogroll</a> - A plugin to make powerful blorgrolls with favicons, descriptions, notes and RSS links]]></content:encoded>
			<wfw:commentRss>http://www.z-oc.com/blog/2009/01/htaccess-redirect-wizardry/feed/</wfw:commentRss>
		<slash:comments>23</slash:comments>
		</item>
		<item>
		<title>Categorizing Pages and Posts in Wordpress</title>
		<link>http://www.z-oc.com/blog/2008/05/post-and-page-categories/</link>
		<comments>http://www.z-oc.com/blog/2008/05/post-and-page-categories/#comments</comments>
		<pubDate>Sat, 03 May 2008 18:30:47 +0000</pubDate>
		<dc:creator>Guilherme Zühlke O'Connor</dc:creator>
				<category><![CDATA[On The Web]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[Blogging]]></category>
		<category><![CDATA[categories]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://www.z-oc.com/blog/2008/05/post-and-page-categories/</guid>
		<description><![CDATA[Having authored a plugin to display sub categories on wordpress, I&#8217;m often faced with users that realize they can&#8217;t use categories on pages, and they turn to me to explain how can be done. This post is meant to help all these people that want to learn why they can&#8217;t use categories on pages and, [...]]]></description>
			<content:encoded><![CDATA[<p>Having authored a plugin to display sub categories on wordpress, I&#8217;m often faced with users that realize they can&#8217;t use categories on pages, and they turn to me to explain how can be done. This post is meant to help all these people that want to learn why they can&#8217;t use categories on pages and, show you that this doesn&#8217;t mean you can&#8217;t categorize pages at all.</p>
<h3>Pages and subpages</h3>
<p><img  src= 'http://www.z-oc.com/blog/wp-content/uploads/2008/05/parent-pages-templates.png'  alt= 'Parent pages and layouts'  class= "right" title="" />In a conventional CMS, pages within a web site are classified in sections and subsections. Each section tipically contain a description of what the section is about and links to its subsections and pages.</p>
<p>Each CMS has its own way to do it and often its own jargon but, ultimately, it is the same philosophy.</p>
<p>Wordpress is not different in this respect. If you want to use it to run a regular (non-blog) web-site, you can.</p>
<p>Wordpress has a feature called pages, which are very similar to posts in many aspects, but they differ, essentially, in the fact that there is no chronology associated to it, pretty much like traditional web pages.</p>
<p>In order to run a non-blog website with Wordpress, you&#8217;ll rely on pages, rather than posts, to publish your content, and this also means that the publish date of this content will be much less important than in a blog, if important at all.</p>
<p>That might be good enough for a small site with half a dozen pages, but what if you have slightly bigger ambitions and you need to categorize your content?</p>
<h3>Time for an example</h3>
<p>Say you run a cooking site (not blog!) and you need the following pages/sections: Recipes, Desserts, Nutritional facts and an About page.</p>
<p><img  src= 'http://www.z-oc.com/blog/wp-content/uploads/2008/05/food-menu.png'  alt= 'Food Menu' title="" /></p>
<p>In Wordpress, the way to do it is to create a page for each one. Each page in Wordpress can have a parent page and all pages can be parents as well. These will be the topmost pages, so they have no parent but some of these pages will also work as sections by being parents of other pages.</p>
<p>For the rest of the content, each time you publish a recipe, you will create a page for it, and you will set the main recipes page as a parent. In this way, all recipes are sub pages of the recipes page, and the recipes page immediately becomes a category, as much as a page.</p>
<p>The same goes for the recipes and nutritional facts, but let&#8217;s give a bit of attention to the about page.</p>
<p>Although the about page will be categorized as a root page and be on the same level than the main categories, the about page can merely be a plain a simple page with no children.</p>
<p>Because of the way pages are categorized as sub-pages of other pages, you don&#8217;t have to distinguish sections from regular pages. In addition, if one day you want to add sections the the about page (eg, about the authors, our history, etc) you can simply create the pages and set the about page as parent.</p>
<p>Thanks to the ability to create different page templates, you can even style each section or page differently.</p>
<h3>Posts and categories</h3>
<p><img  src= 'http://www.z-oc.com/blog/wp-content/uploads/2008/05/categories.png'  alt= 'Post Categories in Wordpress'  class= "right" title="" />For a person with a background stronger in blogs than in static websites, categories might seem missing for pages on Wordpress, but actually is the other way around. For someone coming from a static sites background, the problem might seem to be quite the opposite.</p>
<p>The only basic difference between pages in static sites and posts in a blog is that posts follow a chronological sequence, while pages just sit there and the sequence in which they were written is not quite important.</p>
<p>Although this is the only remarkable difference, this radically changes the way authors and readers approach to each kind of website, and consequently the features a CMS needs to implement for each one.</p>
<p>For instance, blogs are meant to be followed over time. The latest information is supposed to be the most important at a given time and that is why posts are presented in reverse chronological order. It shouldn&#8217;t have to be like this, but is quite convenient.</p>
<p>Now, having said that, this doesn&#8217;t imply that older posts aren&#8217;t useful, and they should be made available in and presented in an organized way. But because the chronological factor, a blog has a few extra challenges on the organization subject.</p>
<ul>
<li>Usually, much more content is created for a blog than for a static site</li>
<li>With the continuous addition of new content, classifications can grow obsolete pretty quicly</li>
<li>New sections may be needed and accommodate them must be made easy</li>
<li>Posts might belong to more than one section as time goes by</li>
</ul>
<p>Regarding a section of pages as a page on itself does make sense, but a post section being regarded as a post makes no sense at all. I explain:</p>
<p>A post is characterized as such by its chronological aspect while categories&#8217; creation date on themselves usually have no importance at all. Hence, there is no sense in regarding a category as a post. Actually, if you come to think of it, this paragraph is almost unnecessary as this though is pretty much counter-intuitive.</p>
<p><strong>Enter categories!</strong></p>
<p>Categories are simply a name you can create and you can relate posts with, pretty much as parent pages.</p>
<p>And similarities don&#8217;t stop there. A category might have a parent category, just like pages.</p>
<p>Also, you might not be aware, but Wordpress allow you to create different pages for displaying each category, so if you have a limited number of them or if you want to highlight some, you can actually style a template that work as parent page in most aspects. But this is out of the scope of this post and in material for a future discussion.</p>
<a href="http://www.z-oc.com/blog/powerblogroll/">Zo'C powerblogroll</a> - A plugin to make powerful blorgrolls with favicons, descriptions, notes and RSS links]]></content:encoded>
			<wfw:commentRss>http://www.z-oc.com/blog/2008/05/post-and-page-categories/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
		<item>
		<title>Tutorial: A category based archive on Wordpress</title>
		<link>http://www.z-oc.com/blog/2008/03/category-based-archive/</link>
		<comments>http://www.z-oc.com/blog/2008/03/category-based-archive/#comments</comments>
		<pubDate>Sat, 29 Mar 2008 02:21:20 +0000</pubDate>
		<dc:creator>Guilherme Zühlke O'Connor</dc:creator>
				<category><![CDATA[Server Side]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[page]]></category>
		<category><![CDATA[template]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://www.z-oc.com/blog/2008/03/category-based-archive/</guid>
		<description><![CDATA[I followed Lorelle&#8217;s advice advice and added a category based archive on Zo&#8217;C&#8217;s archive page, and now I&#8217;m going to tell you how to create yours.
At the end of this post, you&#8217;ll find the complete code in a single piece.
Step 1: Create the template file and find the content area
The first thing to do is [...]]]></description>
			<content:encoded><![CDATA[<p>I followed <a href="http://www.z-oc.com/blog/2008/02/a-powerful-archive-page-for-your-wordpress-blog/#comment-1111">Lorelle&#8217;s advice</a> advice and added a category based archive on <a href="http://www.z-oc.com/blog/archive/">Zo&#8217;C&#8217;s archive page</a>, and now I&#8217;m going to tell you how to create yours.</p>
<p>At the end of this post, you&#8217;ll find the complete code in a single piece.</p>
<h3>Step 1: Create the template file and find the content area</h3>
<p>The first thing to do is create a new template page for your theme. The easiest way to do it is by duplicating your default page template which is the file &#8220;page.php&#8221;. Login via FTP, SSH or your favorite method an copy that file to &#8220;category_archive.php&#8221; and start editing.</p>
<p>Edit your file so at the very beginning it has the following lines, they are responsible for telling Wordpress this is a template page and its name.</p>
<p><code>
<pre>&lt;?php
/*
Template Name: CategoryArchive
*/
?&gt;</pre>
<p></code></p>
<p>The reason why we copied the default page instead of starting from the scratch is that any theme has is peculiarities (footer, sidebar, header, this and that) and we want to preserve them all, we just want to change the content. So, now, you must find the content.</p>
<p><span id="more-268"></span></p>
<p>It is probably different on your theme, but in mine, I find content starts after this</p>
<p><code>
<pre>&lt;div id="main"&gt;
&lt;div id="container"&gt;
&lt;?php include("menu-sec.php"); ?&gt;
	&lt;div id="content"&gt;</pre>
<p></code></p>
<p>And ends just before this</p>
<p><code>
<pre>	&lt;/div&gt;&lt;!-- content --&gt;
&lt;/div&gt;&lt;!-- container --&gt;

&lt;?php get_sidebar(); ?&gt;
&lt;div class="clearer"&gt;&lt;/div&gt;
&lt;/div&gt;&lt;!-- main --&gt;

&lt;?php get_footer(); ?&gt;</pre>
<p></code></p>
<h3>Step 2: Find the categories and loop through them</h3>
<p>Once you have located the content area let&#8217;s get to the PHP code to make the magic happen.</p>
<p>First you have to inquiry Wordpress for the categories</p>
<p><code>
<pre>&lt;?php $cats = get_categories("hierarchical=0"); ?&gt;</pre>
<p></code></p>
<p>Then loop through them and display them. Don&#8217;t forget to check for NULL entries: a sanity check. In case something goes wrong and no categories are returned the script will do nothing instead of crashing.</p>
<p><code>
<pre>
&lt;?php if($cats != NULL) { ?&gt;
		&lt;ul&gt;
		&lt;?php foreach ($cats as $cat) { ?&gt;
			&lt;li&gt;
			&lt;?php if($cat != NULL) {
				$base_url = get_bloginfo('home') . "/category/" . $cat-&gt;slug; ?&gt;
				&lt;h3&gt;&lt;a href="&lt;?php echo $base_url?&gt;"&gt;&lt;?php echo $cat-&gt;cat_name?&gt;&lt;/a&gt;&lt;/h3&gt;
			&lt;?php } ?&gt;

			&lt;?php // Show category description
				if ($cat-&gt;category_description != NULL) ?&gt;
					&lt;p&gt;&lt;?php echo $cat-&gt;category_description ?&gt;&lt;/p&gt;</pre>
<p></code></p>
<p>For each category, we are presenting the title and the description. Additionally, the category name is a link to the regular category listing page, so people can dig further on a category, if they want to.</p>
<h3>Step 3: Find the posts filed under each category and display them</h3>
<p>On each iteration of the loop above, besides presenting the category info, we need to query the posts filed under that particular category and display them. Start by querying Wordpress about the posts of the category you are in.</p>
<p><code>
<pre>&lt;?php $myposts = get_posts("numberposts=-1&#038;category=$cat->cat_ID"); ?&gt;</pre>
<p></code></p>
<p>(UPDATE: get_posts parameters updated to avoid the default limit of 5 posts, thanks Chuck for <a href="http://www.z-oc.com/blog/2008/03/category-based-archive/#comment-1224">pointing out the problem</a>.)</p>
<p>And then, loop through them displaying its name and permalink. And, once we have our hands on it, lets add it a touch of class and display the date in which it was published.</p>
<p><code>
<pre>&lt;ul&gt;
&lt;?php foreach($myposts as $post) : ?&gt;
	&lt;li&gt;&lt;?php the_time('M d') ?&gt;. &lt;a href="&lt;?php the_permalink(); ?&gt;"&gt;&lt;?php the_title(); ?&gt;&lt;/a&gt;&lt;/li&gt;
&lt;?php endforeach; ?&gt;
&lt;/ul&gt;</pre>
<p></code></p>
<p>Don&#8217;t forget to close the outer loop:</p>
<p><code>
<pre>&lt;?php } ?&gt;</pre>
<p></code></p>
<h3>Step 4: Create a page using the layout you just made</h3>
<p><img  src= 'http://www.z-oc.com/blog/wp-content/uploads/2008/03/selecting_template.png'  alt= 'Selecting The Template'  class= "right" title="" />Now that you have created a page template for your category based archive, you must create a page using it.</p>
<p>Go to the admin panel on your blog, to the write page interface and create your page normally, except that on the right panel, under &#8220;Page Template&#8221; you&#8217;ll chose &#8220;CategoryArchive&#8221;. Chose a nice Post Slug for it if you want and a descriptive title but you don&#8217;t need to put any content because it won&#8217;t show anyway.</p>
<h3>The complete code to copy and paste</h3>
<p>If you find it difficult to copy and paste all the pieces of this tutorial, here is the complete code that you can just copy and paste inside the  content of your page template. </p>
<p>Just remember that this is NOT the complete template, as it changes from theme to theme, this is only the juicy part of it, enjoy.</p>
<p><code>
<pre>&lt;?php $cats = get_categories("hierarchical=0"); ?&gt;

&lt;?php if($cats != NULL) { ?&gt;
		&lt;ul&gt;
		&lt;?php foreach ($cats as $cat) { ?&gt;
			&lt;li&gt;

			&lt;?php if($cat != NULL) {
				$base_url = get_bloginfo('home') . "/category/" . $cat-&gt;slug; ?&gt;
				&lt;h3&gt;&lt;a href="&lt;?php echo $base_url?&gt;"&gt;&lt;?php echo $cat-&gt;cat_name?&gt;&lt;/a&gt;&lt;/h3&gt;
			&lt;?php } ?&gt;

			&lt;?php // Show category description
				if ($cat-&gt;category_description != NULL) ?&gt;
					&lt;p&gt;&lt;?php echo $cat-&gt;category_description ?&gt;&lt;/p&gt;

				&lt;?php $myposts = get_posts("category=$cat-&gt;cat_ID"); ?&gt;
				&lt;ul&gt;
				&lt;?php foreach($myposts as $post) : ?&gt;
					&lt;li&gt;&lt;?php the_time('M d') ?&gt;. &lt;a href="&lt;?php the_permalink(); ?&gt;"&gt;&lt;?php the_title(); ?&gt;&lt;/a&gt;&lt;/li&gt;
				&lt;?php endforeach; ?&gt;
				&lt;/ul&gt;
			&lt;/li&gt;
	&lt;?php } ?&gt;
		&lt;/ul&gt;
&lt;?php } ?&gt;</pre>
<p></code></p>
<h3>Who is using it</h3>
<ul>
<li><a href="http://pshero.com/gallery/">PS Hero</a></li>
<li><a href="http://www.morphodesigns.com/article-time-machine/">Morpho Designs</a></li>
</ul>
<a href="http://www.z-oc.com/blog/powerblogroll/">Zo'C powerblogroll</a> - A plugin to make powerful blorgrolls with favicons, descriptions, notes and RSS links]]></content:encoded>
			<wfw:commentRss>http://www.z-oc.com/blog/2008/03/category-based-archive/feed/</wfw:commentRss>
		<slash:comments>70</slash:comments>
		</item>
		<item>
		<title>Animation in Photoshop &#8211; Video Tutorial</title>
		<link>http://www.z-oc.com/blog/2008/03/animation-in-photoshop-tutorial/</link>
		<comments>http://www.z-oc.com/blog/2008/03/animation-in-photoshop-tutorial/#comments</comments>
		<pubDate>Tue, 11 Mar 2008 16:47:51 +0000</pubDate>
		<dc:creator>Guilherme Zühlke O'Connor</dc:creator>
				<category><![CDATA[Art & Design]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[Design]]></category>
		<category><![CDATA[Podcast]]></category>

		<guid isPermaLink="false">http://www.z-oc.com/blog/2008/03/animation-in-photoshop-tutorial/</guid>
		<description><![CDATA[
Zo&#8217;C has entered the age of video. It took me a while to get all things right, but better safe than sorry isn&#8217;t it?
I intend to periodically share some videos on web design and development things. That can be Photoshop, Illustrator, how to install a tool, CSS tricks and so on. It could just as [...]]]></description>
			<content:encoded><![CDATA[<p><object type="application/x-shockwave-flash" data="http://blip.tv/scripts/flash/showplayer.swf?enablejs=true&#038;file=http%3A%2F%2Fzoc%2Eblip%2Etv%2Frss%2Fflash%2F&#038;showplayerpath=http%3A%2F%2Fblip%2Etv%2Fscripts%2Fflash%2Fshowplayer%2Eswf" width="500" height="318" allowfullscreen="true" id="showplayer"><param name="movie" value="http://blip.tv/scripts/flash/showplayer.swf?enablejs=true&#038;file=http%3A%2F%2Fzoc%2Eblip%2Etv%2Frss%2Fflash%2F&#038;showplayerpath=http%3A%2F%2Fblip%2Etv%2Fscripts%2Fflash%2Fshowplayer%2Eswf" /><param name="quality" value="best" /><embed src="http://blip.tv/scripts/flash/showplayer.swf?enablejs=true&#038;file=http%3A%2F%2Fzoc%2Eblip%2Etv%2Frss%2Fflash%2F&#038;showplayerpath=http%3A%2F%2Fblip%2Etv%2Fscripts%2Fflash%2Fshowplayer%2Eswf" quality="best" width="500" height="318" name="showplayer" type="application/x-shockwave-flash"></embed></object></p>
<p>Zo&#8217;C has entered the age of video. It took me a while to get all things right, but better safe than sorry isn&#8217;t it?</p>
<p>I intend to periodically share some videos on web design and development things. That can be Photoshop, Illustrator, how to install a tool, CSS tricks and so on. It could just as well be about videoblogging.</p>
<p>For my first  tutorial on this new era I&#8217;m going to teach you how to create a cool animation in Photoshop like the one on my last <a href="http://www.z-oc.com/blog/2008/03/podcasting-videoblogging-and-social-screencasting-tools-and-ideas/">post about videoblogging and podcasting</a> and I&#8217;ll show you how to export it in several video formats including Flash video, Quicktime .mov and animated Gif&#8217;s.</p>
<p>Have a lot of fun!</p>
<p>Oh, and did I mention that you can <a href="itpc://zoc.blip.tv/rss/itunes/">subscribe via iTunes</a> or any other tool via <a href="http://www.z-oc.com/blog/feed/mediafeed">media feed</a>.</p>
<a href="http://www.z-oc.com/blog/powerblogroll/">Zo'C powerblogroll</a> - A plugin to make powerful blorgrolls with favicons, descriptions, notes and RSS links]]></content:encoded>
			<wfw:commentRss>http://www.z-oc.com/blog/2008/03/animation-in-photoshop-tutorial/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Podcasting, Videoblogging and Social Screencasting: tools and ideas</title>
		<link>http://www.z-oc.com/blog/2008/03/podcasting-videoblogging-and-social-screencasting-tools-and-ideas/</link>
		<comments>http://www.z-oc.com/blog/2008/03/podcasting-videoblogging-and-social-screencasting-tools-and-ideas/#comments</comments>
		<pubDate>Sat, 01 Mar 2008 14:55:22 +0000</pubDate>
		<dc:creator>Guilherme Zühlke O'Connor</dc:creator>
				<category><![CDATA[On The Web]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[Blogging]]></category>
		<category><![CDATA[screencasting]]></category>
		<category><![CDATA[social]]></category>
		<category><![CDATA[videoblogging]]></category>
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://www.z-oc.com/blog/2008/03/podcasting-videoblogging-and-social-screencasting-tools-and-ideas/</guid>
		<description><![CDATA[The so called Web 2.0 is the medium where readers are also writers or, in a more general sense, consumers are also producers. Every single comment you leave on a blog is content you produce and use to expose yourself while, hopefully, contributing to the whole online community one crumb at a time.
While probloggers build [...]]]></description>
			<content:encoded><![CDATA[<p><img  src= 'http://www.z-oc.com/blog/wp-content/uploads/2008/03/out_of_syntony_tv.gif'  alt= 'Out of Syntony TV'  class= "left"  style= "border:none" title="" />The so called Web 2.0 is the medium where readers are also writers or, in a more general sense, consumers are also producers. Every single comment you leave on a blog is content you produce and use to expose yourself while, hopefully, contributing to the whole online community one crumb at a time.</p>
<p>While probloggers build monetization and authority strategies for blogs and internet media sites, millions of other people just share their pictures in social sites like <a href="http://flickr.com/">flickr</a>, videos on <a href="http://www.youtube.com/">youtube</a> and so on.</p>
<p>The curious thing is that, to a certain measure, people are more interested in spontaneity than production. The fact that most people on the internet have access to rather advanced technology, makes it less interesting to see the technology by itself and more interesting to focus on each one&#8217;s perspective and enables people to use the technology to share those unique skills and ideas each one has.</p>
<p><a href="http://michaelmartine.com/2008/02/03/start-video-blogging-in-five-easy-steps/">Michael Martine</a> would go as far as to say:</p>
<blockquote><p>Over-analyzing before you begin is the best way to kill something before it even has a chance. Just go for it.</p></blockquote>
<p>But of course you can&#8217;t do anything if you can&#8217;t handle this technology, so here is a quick guide of interesting stuff around the web, either if you want to be a web video entrepreneur or if you just want to share videos with your friends</p>
<p><span id="more-230"></span></p>
<h3>How do I make a video easily?</h3>
<p>The straight answer would be</p>
<ol>
<li>Get a webcam</li>
<li>Configure it</li>
<li>Make test videos (and don&#8217;t bother to edit them)</li>
<li>Make a real video</li>
<li>Upload it and spread the word</li>
</ol>
<p>It is a little rude to put things like that, but it can actually be that easy. Check <a href="http://michaelmartine.com/2008/02/03/start-video-blogging-in-five-easy-steps/">Michael Martine&#8217;s post</a> to read details on each of these points</p>
<h3>How do I create a video show?</h3>
<p><img  src= 'http://www.z-oc.com/blog/wp-content/uploads/2008/03/blip_tv.jpg'  alt= 'Blip TV'  class= "right" title="" />Well, if you want to publish a videoblog, then you have to start to concern about other things like giving your video posts a sense of sequence and identity. In other words, you need to think of it as a show.</p>
<p>Youtube isn&#8217;t probably the best tool. You&#8217;ll need a system that offers you more that merely hosting your videos, you&#8217;ll need a system that allows you to host your show. That means, hosting a series of videos that have a chronology, and help you build and maintain your show&#8217;s identity.</p>
<p>I found the <a href="http://blip.tv/">Blip.tv</a> service very good for hosting a show. They accept most video formats and they won&#8217;t resize your video, so you can actually put online a show with the resolution you need.</p>
<h3>How do I do live broadcasting?</h3>
<p>If you want to create a live show and keep the archives, then you can use <a href="http://www.ustream.tv/">Ustream.tv</a>. Ustream.tv is free and allows you to create a program based on live broadcasting and all you need is a camera and a microphone connected to your computer, and your webcam counts.</p>
<h3>How do I create a videoblog?</h3>
<p>Is nice to have a show at Blip.tv or similar service, but you&#8217;ll like to have your own webpage for that, won&#8217;t you. Not only a static page, but you&#8217;ll like the videos to be displayed on it just like a blog and you want a feed for it so people can get your podcast directly from iTunes.</p>
<p>There is a very nice and easy to follow <a href="http://www.freevlog.org/index.php/category/tutorial/">tutorial on Freevlog</a> that helps you with most of that.</p>
<p>You can learn more at <a href="http://blip.tv/learning/">Blip.tv Learning Section</a>, they will even help you monetize your show.</p>
<h3>How do I create a screencast?</h3>
<p>Screencast are videos of your computer screen taken just like old fashioned screenshots, but animated. You can watch <a href="http://www.z-oc.com/blog/2008/02/video-tutorials-on-how-to-configure-the-powerblogroll-plugin/">these two I made</a>, to get the idea.</p>
<p>Screencasts are videos just like any other, so the only question that remains unanswered is how to record one.</p>
<p>There are a lot of screencast options avaliable out there and some of them are free.</p>
<p>As a Mac user, I personally have been playing with three</p>
<dl>
<dt><a href="http://danicsoft.com/projects/copernicus/">Copernicus</a></dt>
<dd>Is distributed free, handles screencasts beautifully but doesn&#8217;t record sound. It is ideal if you want to add sound in post production or if you want (or don&#8217;t mind) to record sound separately. You can use <a href="http://audacity.sourceforge.net/">Audacity</a> for that either in Mac OS, Windows or Linux.</dd>
<dt><a href="http://www.screencast-o-matic.com/">Screencast-o-Matic</a></dt>
<dd>Screencast-o-Matic is a java appication that runs online. No need to install anything, is platform independent and is fully featured. Works like a charm and you can use it wherever you are, even on a cyber cafe in the middle of nowhere. They will even host your video if you want, but you can also export it as a .mov to your computer. The downside is that you can only record in either 640&#215;480, 800&#215;600 or 1024&#215;768px and if you chose to host it with them, they&#8217;ll downsize it to a max of 800&#215;600px</dd>
<dt><a href="http://www.jingproject.com/">Jing</a></dt>
<dd>Jing is exist in Mac OS and Windows flavors and is a cute little application that sits in your desktop and allows you to record upload and share screencasts from a simple and intuitive interface. It is made to work together with <a href="http://screencast.com/">screencast.com</a>, but you can also configure it to share files in any server (or your local computer) via FTP. It also handles snapshots and uploads them directly to flicrk, or any ftp server of your choice.</dd>
</dl>
<p><a href='http://www.z-oc.com/blog/wp-content/uploads/2008/02/jing_snapshot.jpg' title='Jing'><img  src= 'http://www.z-oc.com/blog/wp-content/uploads/2008/02/jing_snapshot.jpg'  alt= 'Jing'  class= "right" title="" /></a></p>
<p>If you&#8217;d like to see a longer list of software available to other platforms, you can check <a href="http://www.webdesignarchive.org/2008/01/13/free-screencast-software-for-linux-mac-os-x-and-windows/">this one</a>. This is where I learned about Jing and copernicus, but I haven&#8217;t tested any of the Linux and Windows options yet.</p>
<h3>Social Screencasting?</h3>
<p>Ok, ok, ok. Not everyone wants to be the star of her own show. Some people just want to use the power of video to show someone distant a screencast and make her understand things as if she were there.</p>
<p><a href="http://www.jingproject.com/">Jing</a> is a tool that allows you to do just that!</p>
<p><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="462" height="153"><param name="movie" value="http://content.screencast.com/bootstrap.swf"></param><param name="quality" value="high"></param><param name="bgcolor" value="#FFFFFF"></param><param name="flashVars" value="thumb=http://content.screencast.com/media/3c09a515-cf71-48d9-be25-0ea8a0f4e7fb_cec8fb39-4dcb-4aa8-9be9-73ca1f5bbfb2_static_0_0_Thumbnail.gif&#038;content=http://content.screencast.com/media/978fd610-6280-476d-9612-653a8ecc5dd1_cec8fb39-4dcb-4aa8-9be9-73ca1f5bbfb2_static_0_0_00000024.swf&#038;width=462&#038;height=153"></param><param name="allowFullScreen" value="true"></param><param name="scale" value="showall"></param><param name="allowScriptAccess" value="always"></param> <embed src="http://content.screencast.com/bootstrap.swf" quality="high" bgcolor="#FFFFFF" width="462" height="153" type="application/x-shockwave-flash" allowScriptAccess="always" flashVars="thumb=http://content.screencast.com/media/3c09a515-cf71-48d9-be25-0ea8a0f4e7fb_cec8fb39-4dcb-4aa8-9be9-73ca1f5bbfb2_static_0_0_Thumbnail.gif&#038;content=http://content.screencast.com/media/978fd610-6280-476d-9612-653a8ecc5dd1_cec8fb39-4dcb-4aa8-9be9-73ca1f5bbfb2_static_0_0_00000024.swf&#038;width=462&#038;height=153" allowFullScreen="true" scale="showall"></embed></object></p>
<p>By clicking on the little icon that might stand on your desktop (if you want it to) you can start recoding and immediately upload it. You don&#8217;t need a blog or any production. All you need to do is create a screencast account of configure an FTP you have. It will automatically give you embedding code and urls for agile publishing or sharing.</p>
<p>And, hey, why I am explaining this? <a href="http://video.techsmith.com/jing/latest/demo/introvideo/index.html?keepThis=true&#038;TB_iframe=true&#038;height=440&#038;width=640">There is a video</a> that show it much better.</p>
<a href="http://www.z-oc.com/blog/powerblogroll/">Zo'C powerblogroll</a> - A plugin to make powerful blorgrolls with favicons, descriptions, notes and RSS links]]></content:encoded>
			<wfw:commentRss>http://www.z-oc.com/blog/2008/03/podcasting-videoblogging-and-social-screencasting-tools-and-ideas/feed/</wfw:commentRss>
		<slash:comments>15</slash:comments>
		</item>
		<item>
		<title>A powerful Archive Page for your wordpress blog</title>
		<link>http://www.z-oc.com/blog/2008/02/a-powerful-archive-page-for-your-wordpress-blog/</link>
		<comments>http://www.z-oc.com/blog/2008/02/a-powerful-archive-page-for-your-wordpress-blog/#comments</comments>
		<pubDate>Sun, 10 Feb 2008 20:30:01 +0000</pubDate>
		<dc:creator>Guilherme Zühlke O'Connor</dc:creator>
				<category><![CDATA[On The Web]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[archive]]></category>
		<category><![CDATA[Blogging]]></category>
		<category><![CDATA[page]]></category>
		<category><![CDATA[powerful]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://www.z-oc.com/blog/2008/02/a-powerful-archive-page-for-your-wordpress-blog/</guid>
		<description><![CDATA[Tired of that old Archive page that displays the months in which you have posts? Even worse, tired of that bulk on your sidebar?
If you come to think of it, it is probably helping your visitors very little, unless they are looking for a specific post and have a rather good idea of when it [...]]]></description>
			<content:encoded><![CDATA[<p>Tired of that old Archive page that displays the months in which you have posts? Even worse, tired of that bulk on your sidebar?</p>
<p>If you come to think of it, it is probably helping your visitors very little, unless they are looking for a specific post and have a rather good idea of when it was published. But if they do know that much, they are more likely to use the search box instead.</p>
<p><span id="more-226"></span></p>
<p>I consider that archives <a href="http://www.z-oc.com/blog/2007/10/the-right-amount-of-information-to-make-them-useful/">need the right amount if information to make them useful</a>, not more, not less. And in this case, an archive needs more.</p>
<p>In this post I&#8217;ll show you how to create a separate Wordpress page that lists all your posts in reverse chronological order and categorized by month, just like <a href="http://www.z-oc.com/blog/archive/">mine</a>.</p>
<p>This will benefit your blog because you&#8217;ll have a permanent reference for all your posts with name and dates, so users can always refer to it, when looking for a post they seen, or digging your site for more.</p>
<h3>Step 1: Create a new template</h3>
<p>This part is easy, you have to duplicate a file in your theme called page.php and name the copy with a name you like. I&#8217;ll call it powerarchive.php.</p>
<p>Open powerarchive.php and Make sure the file starts with this</p>
<p><code>
<pre>&lt;?php
/*
Template Name: PowerArchive
*/
?&gt;</pre>
<p></code></p>
<p>Technically this is a PHP comment, meaning that it won&#8217;t be seen by the PHP interpreter. In practice, the wordpress applications looks for some special comments to find specific files. In this case, the comment is telling wordpress that the file is a page template and its name is Powerarchive. We are going to use this later, when we publish the archive page.</p>
<h3>Step 2: Hollow the layout</h3>
<p>Now, a tricky part. You must find where is the core-content part of the layout. This changes from theme to theme, but you must look for some signs. For isntance, on my theme, you&#8217;d find something like this</p>
<p><code>
<pre>&lt;div id="content" class="hfeed"&gt;

	&lt;h1 class="entry-title"&gt;&lt;a href="&lt;?php the_permalink() ?&gt;" rel="bookmark" title="&lt;?php echo __('View').' &quot;'.the_title('', '', false).'&quot;'; ?&gt;"&gt;&lt;?php the_title(); ?&gt;&lt;/a&gt;&lt;/h1&gt;

&lt;?php /* more php code */ ?&gt;

   &lt;?php endwhile; endif; ?&gt;

&lt;/div&gt;&lt;!-- content --&gt;
</pre>
<p></code></p>
<p>The &lt;div&gt; opened just before the &lt;h1&gt; and closed just after the end of the loop (&lt;?php endwhile; endif; ?&gt;) is the container we are looking for. Just hollow that div, except for the page title and maybe some other information you might want to keep.</p>
<h3>Step 3: Change the content</h3>
<p>So far, we have managed to have an empty page with a title. So our next step has to be change the way it behaves, and show the archives just after the title we left.</p>
<p>The whole idea is to get all the posts in reverse chronological order (newer first), cycle through them and, as we go, print the month name and year as a header for the set of posts on that month.</p>
<p>The first thing to have in mind is that, as we cycle through the posts, is that we must be able to compare a post and the previous one and see if they are on the same month, because if the month has changed, the header for the month must be displayed.</p>
<p>Let&#8217;s initialize a variable that will hold the date for the post being analyzed and another one for the date of the previous post.</p>
<p><code>
<pre>
  &lt;?php
        $prev_date = NULL;
        $date = NULL;
    ?&gt;
</pre>
<p></code></p>
<p>Then, get all posts in the blog</p>
<p><code>
<pre>
&lt;?php query_posts("posts_per_page=-1&#038;order=DESC"); ?&gt;
</pre>
<p></code></p>
<p>Loop through getting the month and year of each one, as well as setting the date of the current post for the sake of comparing it with the previous one.</p>
<p><code>
<pre>
    &lt;?php if (have_posts()) : while (have_posts()) : the_post(); ?&gt;

    &lt;?php
        $date  = get_the_time('m.Y');
        $year  = get_the_time('Y');
        $month = get_the_time('m');
        $baseUrl = get_bloginfo('url');
</pre>
<p></code></p>
<p>If the current date (containing month and year) is different from the previous one, this is because we have started to list posts from a different month, so we should start by printing the header with a link to the listing of those posts. Don&#8217;t forget to start by opening the list tag for the post titles.</p>
<p><code>
<pre>
        if($date != $prev_date)
        {
            if ($prev_date) echo "&lt;/ul&gt;&#92;n";
            $prev_date = $date;
            echo "&lt;h3&gt;";
            echo "&lt;a href='" . $baseUrl ."/". $year ."/". $month . "'&gt;";
            echo get_the_time('F Y');
            echo "&lt;/a&gt;";
            echo "&lt;/h3&gt;";
            echo "&lt;ul&gt;";
        }
    ?&gt;
</pre>
<p></code></p>
<p>Finally, let&#8217;s print the post date and post title into a list item, close the loop and the list tag</p>
<p><code>
<pre>
    &lt;li&gt;&lt;?php the_time('M d') ?&gt;. &lt;a href="&lt;?php the_permalink() ?&gt;"&gt;&lt;?php the_title() ?&gt;&lt;/a&gt;&lt;/li&gt;

    &lt;?php endwhile; endif; ?&gt;

    &lt;/ul&gt;
</pre>
<p></code></p>
<p>Here is how the code should look</p>
<p><code>
<pre>
  &lt;?php
        $prev_date = NULL;
        $date = NULL;
    ?&gt;

    &lt;?php query_posts("posts_per_page=-1&#038;order=DESC"); ?&gt;

    &lt;?php if (have_posts()) : while (have_posts()) : the_post(); ?&gt;

    &lt;?php
        $date  = get_the_time('m.Y');
        $year  = get_the_time('Y');
        $month = get_the_time('m');
        $baseUrl = get_bloginfo('url');

        if($date != $prev_date)
        {
            if ($prev_date) echo "&lt;/ul&gt;&#92;n";
            $prev_date = $date;
            echo "&lt;h3&gt;";
            echo "&lt;a href='" . $baseUrl ."/". $year ."/". $month . "'&gt;";
            echo get_the_time('F Y');
            echo "&lt;/a&gt;";
            echo "&lt;/h3&gt;";
            echo "&lt;ul&gt;";
        }
    ?&gt;

    &lt;li&gt;&lt;?php the_time('M d') ?&gt;. &lt;a href="&lt;?php the_permalink() ?&gt;"&gt;&lt;?php the_title() ?&gt;&lt;/a&gt;&lt;/li&gt;

    &lt;?php endwhile; endif; ?&gt;

    &lt;/ul&gt;
</pre>
<p></code></p>
<a href="http://www.z-oc.com/blog/powerblogroll/">Zo'C powerblogroll</a> - A plugin to make powerful blorgrolls with favicons, descriptions, notes and RSS links]]></content:encoded>
			<wfw:commentRss>http://www.z-oc.com/blog/2008/02/a-powerful-archive-page-for-your-wordpress-blog/feed/</wfw:commentRss>
		<slash:comments>33</slash:comments>
		</item>
		<item>
		<title>How to manage all your mail in Gmail: Filters, Labels, multiple Id&#8217;s and even Backups</title>
		<link>http://www.z-oc.com/blog/2007/10/how-to-manage-all-your-mail-in-gmail-filters-labels-multiple-ids-and-even-backups/</link>
		<comments>http://www.z-oc.com/blog/2007/10/how-to-manage-all-your-mail-in-gmail-filters-labels-multiple-ids-and-even-backups/#comments</comments>
		<pubDate>Thu, 11 Oct 2007 20:18:30 +0000</pubDate>
		<dc:creator>Guilherme Zühlke O'Connor</dc:creator>
				<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://www.z-oc.com/blog/2007/10/how-to-manage-all-your-mail-in-gmail-filters-labels-multiple-ids-and-even-backups/</guid>
		<description><![CDATA[Gmail says &#8220;Search, don&#8217;t Sort&#8221; and by all means this is a good idea and they also tell you not to ever delete a message again, which is interesting, at least for the messages that have any value.
But if you do this you probably have copious amounts of email in a single archive and while [...]]]></description>
			<content:encoded><![CDATA[<p>Gmail says &#8220;Search, don&#8217;t Sort&#8221; and by all means this is a good idea and they also tell you not to ever delete a message again, which is interesting, at least for the messages that have any value.</p>
<p>But if you do this you probably have copious amounts of email in a single archive and while sorting is not the solution, Labels and Filters can give you a hand with all this.</p>
<p>If you <a href="http://www.z-oc.com/blog/2007/06/manage-all-your-email-accounts-with-gmail/">Manage all your emails accounts in Gmail</a> then for sure you need further help by now to manage you gather-all Gmail account.</p>
<p>In either case, you might find useful to use Labels to organize them as  or need a second Gmail account as .</p>
<p>This post will explain</p>
<ol>
<li><a href="http://www.z-oc.com/blog/2007/10/how-to-manage-all-your-mail-in-gmail-filters-labels-multiple-ids-and-even-backups/#search">Why search is better than sort</a></li>
<li><a href="http://www.z-oc.com/blog/2007/10/how-to-manage-all-your-mail-in-gmail-filters-labels-multiple-ids-and-even-backups/#labels">How to set labels</a></li>
<li><a href="http://www.z-oc.com/blog/2007/10/how-to-manage-all-your-mail-in-gmail-filters-labels-multiple-ids-and-even-backups/#filters">How to use filters</a></li>
<li><a href="http://www.z-oc.com/blog/2007/10/how-to-manage-all-your-mail-in-gmail-filters-labels-multiple-ids-and-even-backups/#filterslabels">How to use Filters to set Labels</a> as suggested by Peter Cruickshank (<a href="http://www.z-oc.com/blog/2007/06/manage-all-your-email-accounts-with-gmail/#comment-532">See comment</a>)</li>
<li><a href="http://www.z-oc.com/blog/2007/10/how-to-manage-all-your-mail-in-gmail-filters-labels-multiple-ids-and-even-backups/#multiple">How to use handle multiple Gmails accounts</a> as suggested by Pramod (<a href="http://www.z-oc.com/blog/2007/06/manage-all-your-email-accounts-with-gmail/#comment-552">see his comment</a>)</li>
<li>As a bonus I even tell you <a href="http://www.z-oc.com/blog/2007/10/how-to-manage-all-your-mail-in-gmail-filters-labels-multiple-ids-and-even-backups/#backup">how to deal with server backups sent by mail to you</a></li>
</ol>
<p><span id="more-185"></span></p>
<p><a name="search"><br />
<h3>Search don&#8217;t sort</h3>
<p></a></p>
<p><a href='http://www.z-oc.com/blog/2007/10/how-to-manage-all-your-mail-in-gmail-filters-labels-multiple-ids-and-even-backups/search-dont-sort/' rel='attachment wp-att-174' title='Search, Don’t sort'><img  class= "right"  src= 'http://www.z-oc.com/blog/wp-content/uploads/2007/10/search_dont_sort.png'  alt= 'Search, Don’t sort' title="" /></a>The first thing to keep in mind is that Gmail philosophy is &#8220;Search, don&#8217;t sort&#8221;, meaning that instead of organizing mail in folders as soon as you read it, you could search it afterwards when you need it.</p>
<p>Why searching is better that sorting? I would say it is for three reasons.</p>
<ol>
<li>
<p>The first one is that it is just too hard to know in advance what kind of organizing system you will need in a year time, sometimes even in a month time.</p>
<p>If you have a powerful search system you don&#8217;t need to think of this, you will only worry about it when you need to find that archived email.</p>
</li>
<li>
<p>The second one is that in traditional mail archives you can only sort an email in one folder. You might have a folder &#8220;Funnies&#8221; and a folder &#8220;Mom&#8221;, and you will have to decide either time where to put the funnies your mom sends you.</p>
<p>Also you have to be consistent, because as your archive grows it will be hard to know where that funny your Mom sent you was archived in.</p>
</li>
<li>
<p>The third one is that periodically, as your archive grows, you need to re-sort all your mail. One thing is to have a &#8220;Funnies&#8221; folder with twenty messages, a completely different beast to tame is a &#8220;Funnies&#8221; folder with a thousand messages.</p>
<p>And then when you re-organize your archive the original problem arises, how would you do it? Would you organize it by sender (Funnies-Mom, Funnies-John, Funnies-Paul,&#8230;), by theme&#8230;
</li>
</ol>
<p>Search instead of sorting allows you to refine the granularity of your classification on the very moment you need it and through the criteria just pop in your mind at the moment.</p>
<p>Yes, a good search system is really hard to build! But, hey, that is what Google is famous for being good at, so let&#8217;s trust them and move along.</p>
<p><a name="labels"><br />
<h3>Labels: Just like folders but with search properties</h3>
<p></a></p>
<p><a href='http://www.z-oc.com/blog/2007/10/how-to-manage-all-your-mail-in-gmail-filters-labels-multiple-ids-and-even-backups/labels-list-in-gmail/' rel='attachment wp-att-175' title='Labels List in Gmail'><img   class= "left"  src= 'http://www.z-oc.com/blog/wp-content/uploads/2007/10/labels_list.png'  alt= 'Labels List in Gmail' title="" /></a>A label in Gmail is pretty much a predefined search.</p>
<p>You can find a Labels box in the sidebar on the left, in green, just below the &#8220;Quick Contacts&#8221; section.</p>
<p>Say you frequently search for email your Mom sent you, well, you can create a label Mom and tag all email from her with this label. </p>
<div class="right"><a href='http://www.z-oc.com/blog/2007/10/how-to-manage-all-your-mail-in-gmail-filters-labels-multiple-ids-and-even-backups/label-settings/' rel='attachment wp-att-176' title='Label settings'><img  src= 'http://www.z-oc.com/blog/wp-content/uploads/2007/10/label_settings.png'  alt= 'Label settings' title="" /></a></div>
<p>To do this you first create the label by clicking &#8220;Edit labels&#8221; on the bottom of the box. A management interface appears with a form in the bottom that reads &#8220;Create a new label&#8221;. Just fill in the name you want for your label and hit &#8220;Create&#8221;.</p>
<p>To apply label to a particular message, you can select the message(s) either with the checkbox in a list view or just opening the message for reading and select from the upper menu &#8220;More actions&#8230;&#8221; &raquo; &#8220;Apply Label: Mom&#8221;.</p>
<p><a href='http://www.z-oc.com/blog/2007/10/how-to-manage-all-your-mail-in-gmail-filters-labels-multiple-ids-and-even-backups/apply-label-in-gmail/' rel='attachment wp-att-177' title='Apply Label in Gmail'><img  class= "left"  src= 'http://www.z-oc.com/blog/wp-content/uploads/2007/10/apply_label.png'  alt= 'Apply Label in Gmail' title="" /></a>If later you want to search for messages labeled &#8220;Mom&#8221; just click on the appropriate name in the Labels list on the sidebar.</p>
<p>So far so good! Seems great, but this is not anything better that having folders and is not much different that sorting. Indeed, is not, but stick with me because now things will start to get really interesting.</p>
<p>Say you have another label: &#8220;Funnies&#8221;. Your mom sends you a funny, which label to put? Both!</p>
<p>Now you find that particular mail when you select the &#8220;Mom&#8221; label and also when you select the  &#8220;Funnies&#8221; label.</p>
<p>Now, selecting each label for each message by hand, like this, is a terrible annoyance and it is hard to make an extense use of them. What you can do is to set up some filters to automate this all.</p>
<p><a name="filters"><br />
<h3>Gmail Filters: Automate your decisions</h3>
<p></a></p>
<p>Once you have a clear rule of what has to be done with incoming (and outgoing) email, a filter is a handy way to let Gmail perform the actions for you.</p>
<div><a href='http://www.z-oc.com/blog/2007/10/how-to-manage-all-your-mail-in-gmail-filters-labels-multiple-ids-and-even-backups/filter-list-in-gmail/' rel='attachment wp-att-179' title='Filter list in Gmail'><img  src= 'http://www.z-oc.com/blog/wp-content/uploads/2007/10/filter_list.png'  alt= 'Filter list in Gmail' title="" /></a></div>
<p>In our example, each email you recieve from you &#8220;Mom&#8221; will be tagged with the label Mom. Moreover, all mail sent to your mother will be tagged too.</p>
<div class="right"><a href='http://www.z-oc.com/blog/2007/10/how-to-manage-all-your-mail-in-gmail-filters-labels-multiple-ids-and-even-backups/setting-a-label-filter/' rel='attachment wp-att-180' title='Setting a Label Filter'><img  src= 'http://www.z-oc.com/blog/wp-content/uploads/2007/10/setting_label_filter.png'  alt= 'Setting a Label Filter' title="" /></a></div>
<p>Piece of cake. Go to &#8220;Settings&#8221; on the top-right menu and then select &#8220;Filters&#8221;. On the bottom you&#8217;ll find a link &#8220;Create a new filter&#8221;.</p>
<p>A filter is composed of two parts. In the first one you define the select criteria. That is, which messages the filter will be applied to. In the second part you define what to do with the messages that match the criteria defined in the first part.</p>
<p>In this case, we want to select the messages sent from and to mom@mommail.com, so we need two filters: one for incoming and one for outgoing mail.</p>
<p>[The search criteria for a filter allows you to enter information for the field "from:" and field "to:", but keep in mind that you if you specify both as mom@mommail.com you will only select messages that are both from and to you mom, and not messages that either from or to her. That is why we need two filters.]</p>
<p>On the first filter we put mom@mommail.com on the field &#8220;from:&#8221; and click &#8220;Next step&raquo;&#8221;. On the second part select &#8220;Apply Label&#8221; and select &#8220;Mom&#8221;, then click &#8220;Create Filter&#8221;. Now all incoming mail from you Mom will be automatically tagged.</p>
<p>To tag also the outgoing mail create another filter. Put mom@mommail.com in the &#8220;To:&#8221; filter and then chose &#8220;Apply label: Mom&#8221; on the second step. Done! All email from and to your Mom will be tagged.</p>
<p>Well, this is all nice and cool, but not beyond the basic use of it. Now we mastered Labels and Filters let&#8217;s move to three uses that can really be handy.</p>
<p><a name="filterslabels"><br />
<h3>Label mail if you Manage all your email accounts with Gmail</h3>
<p></a></p>
<p>If you <a href="http://www.z-oc.com/blog/2007/06/manage-all-your-email-accounts-with-gmail/">use Gmail to manage all your email accounts</a> then you have managed to gather all your mail to a very handy and powerful interface. Now you might want to classify your incoming mail depending on where it was originally sent to.</p>
<p>For each account create a label with an appropriate name, something like &#8220;myoriginalmail@myserver.com&#8221; should be good enough.</p>
<p>Then, for each acount create two filters. One for incoming and one for outgoing mail.</p>
<p>For incoming mail, in the first part use your original email address (myoriginalmail@oldserver.com) on the &#8220;To:&#8221; field. On the second part, select the appropriate label.</p>
<p>For outgoing mail, in the first part use your original email address (myoriginalmail@oldserver.com) on the &#8220;From:&#8221; field. On the second part, select the appropriate label (remember that <a href="http://www.z-oc.com/blog/2007/06/manage-all-your-email-accounts-with-gmail/">you can select which email identity to use</a> when writing an email).</p>
<p>Now, every message received or sent is labeled accordingly depending of the specific account it was used.</p>
<p><a name="multiple"><br />
<h3>Sending email to different Gmail Accounts</h3>
<p></a></p>
<p>Some people like to have more than one Gmail account, or sometimes they need to.</p>
<p>In my opinion having two email accounts is a great hassle and is better to avoid when possible, that is why I manage all my email on one account in the first place, but, if you need to have more than one, it is better to organize well.</p>
<p>As far as I can see, with all the organizational resources we have discussed here, the only reason to have multiple Gmail accounts is lack of space. If a second (or third, or fourth&#8230;) account is needed to store your mail I would chose between two policies.</p>
<ul>
<li>Use a Gmail account until it fills, then move to another</li>
<li>Use different Gmail accounts different uses (ie, work, personal, blog)</li>
</ul>
<p>In my opinion, a nice solution is:</p>
<ol>
<li>Send all your mail to a main Gmail account</li>
<li>Set up filters to redirect selected mail to other accounts</li>
</ol>
<p>If you are filling one account at a time and moving to another, the solution is fairy simple, you just have to set a forward rule, that is an especial kind of filter even easier to configure.</p>
<p><a href='http://www.z-oc.com/blog/2007/10/how-to-manage-all-your-mail-in-gmail-filters-labels-multiple-ids-and-even-backups/forwarding-mail/' rel='attachment wp-att-183' title='Forwarding mail'><img  src= 'http://www.z-oc.com/blog/wp-content/uploads/2007/10/forwarding_mail.png'  alt= 'Forwarding mail' title="" /></a></p>
<p>A main account is a good idea even if you are filling one account at a time, because that is the only place you ever need to reconfigure as your needs grow. You can send all your mail to this account and give this address to friends, even if you check your mail through another account.</p>
<ol>
<li>Go to Settings &raquo; &#8220;Forwarding and POP&#8221; &raquo; Forward</li>
<li>Check the option to forward email</li>
<li>Fill in the email you want your email redirected to</li>
<li>Select &#8220;Delete Gmail&#8217;s copy&#8221; From the drop down menu.</li>
<li>Save Changes</li>
</ol>
<p>One day your secondary account will be full. Go to Go to :Settings &raquo; Forwarding and POP &raquo; Forward&#8221; and edit your filter so mail is forwarded to a third account you should have.</p>
<p>If instead, you are forwarding mail according to some criteria you can set a specific filter for redirecting mail to specific accounts.</p>
<p>To make it simple, let&#8217;s say have 3 different Gmail accounts for different purposes:</p>
<dl>
<dt>One for work</dt>
<dd>All mail that comes from domains myworkdomain.com is considered work and goes to myworkemail@gmail.com</dd>
<dt>One for your blog</dt>
<dd>Yes, you have a blog and all email the server sends to you has the string [myblog] on the subject. For instance &#8220;[myblog] Please moderate post X&#8221;. All mail from your blog should go to myblogemail@gmail.com</dt>
<dt>One for all the rest</dt>
<dd>Finally, you have an email for all the rest and in this case it is just easier to use the main account for that.</dd>
</dl>
<p>So, we need to set up two filters to handle this.</p>
<p>For the first one, we must filter all the email coming from work.</p>
<ol>
<li>Go to Settings &raquo; Filters &raquo; &#8220;Create a new filter&#8221;</li>
<li>Put &#8220;*@myworkdomain.com&#8221; on the &#8220;From:&#8221; field and press &#8220;Next&raquo;&#8221; (The asterisk means &#8220;all&#8221;)</li>
<li>Check &#8220;Forward it to:&#8221; and put the email address on the form (myworkemail@gmail.com in the example)</li>
<li>Check also &#8220;Delete it&#8221; so it doesn&#8217;t remain on your original mailbox.</li>
<li>Create Filter</li>
</ol>
<p>For the second one, we must filter all email coming from your blog</p>
<ol>
<li>Go to Settings &raquo; Filters &raquo; &#8220;Create a new filter&#8221;</li>
<li>Put &#8220;[myblog]&#8221; on the &#8220;subject&#8221; field and press &#8220;Next&raquo;&#8221;</li>
<li>Check &#8220;Forward it to:&#8221; and put the email address on the form (myblogemail@gmail.com in the example)</li>
<li>Check also &#8220;Delete it&#8221; so it doesn&#8217;t remain on your original mailbox.</li>
<li>Create Filter</li>
</ol>
<p>You can also <a href="http://www.z-oc.com/blog/2007/06/manage-all-your-email-accounts-with-gmail/#step3">set up your secondary emails to send email as your original identity</a></p>
<p><a name="backup"><br />
<h3>Receiving backup files from your server</h3>
<p></a></p>
<p>As a last example here, I will describe how I manage the backup from my blog.</p>
<p>Once <del datetime="2008-02-20T08:28:17+00:00">a day</del> an hour, z-oc.com emails me a backup of the database using <a href="http://www.ilfilosofo.com/blog/wp-db-backup">this plugin</a>. I like this policy because if anything happens to the site, no matter how serious, I have a complete database backup outside the site, and no better place for this than my Gmail.</p>
<p>The email comes always with a very specific Subject and Text and also has an attachment, so it is easy to make a filter for it.</p>
<p>As I first idea I might want to apply a label &#8220;Database Backup&#8221; to all those messages. Also I never have to even look at these messages unless something happens to the site, so I can also archive then by default.</p>
<p>Even if something happens with the site, I only need the last one, so I can go to &#8220;All Mail&#8221; and retrieve the last one.</p>
<p>This filter will work well but still you would have to periodically select all messages labeled &#8220;Database backup&#8221; and delete all but the last, but there is a better solution.</p>
<p><a href='http://www.z-oc.com/blog/2007/10/how-to-manage-all-your-mail-in-gmail-filters-labels-multiple-ids-and-even-backups/daily-database-backup-in-the-trash/' rel='attachment wp-att-182' title='Daily database backup in the trash'><img  src= 'http://www.z-oc.com/blog/wp-content/uploads/2007/10/database_backup.png'  alt= 'Daily database backup in the trash' title="" /></a></p>
<p>All email deleted in Gmail goes to the trash bin and remains there for a month before it is automatically deleted forever. So, why not send the backup straight to the trash by applying a &#8220;Delete it&#8221; rule to the filter?</p>
<p>If nothing happens, gmail will receive a daily backup, keep it for you for 30 days and then discard it automatically. If something happens to your site you have 30 days to go to your Trash folder and get the last one. Just remember not to empty the Trash by hand, or at least remember not to exclude the last backup, just in case your site crashes that very day.</p>
<p>And you? What kind of use do make of Filters and Labels in Gmail?</p>
<a href="http://www.z-oc.com/blog/powerblogroll/">Zo'C powerblogroll</a> - A plugin to make powerful blorgrolls with favicons, descriptions, notes and RSS links]]></content:encoded>
			<wfw:commentRss>http://www.z-oc.com/blog/2007/10/how-to-manage-all-your-mail-in-gmail-filters-labels-multiple-ids-and-even-backups/feed/</wfw:commentRss>
		<slash:comments>17</slash:comments>
		</item>
		<item>
		<title>Compact digital cameras Vs. DSLR</title>
		<link>http://www.z-oc.com/blog/2007/08/compact-digital-cameras-vs-dslr/</link>
		<comments>http://www.z-oc.com/blog/2007/08/compact-digital-cameras-vs-dslr/#comments</comments>
		<pubDate>Sat, 25 Aug 2007 04:38:02 +0000</pubDate>
		<dc:creator>Guilherme Zühlke O'Connor</dc:creator>
				<category><![CDATA[Photography]]></category>
		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://www.z-oc.com/blog/2007/08/compact-digital-cameras-vs-dslr/</guid>
		<description><![CDATA[This is the 6th and final part of a tutorial about photography basics. So far we&#8217;ve seen

Some physics background related to photography
The pinhole camera and the basics of camera building
The lenses: Zoom, Focus and Aperture
The ISO value: Films and CCD sensors
Mastering the Shutter speed

Finally, we have seen all the necessary elements to build a camera. [...]]]></description>
			<content:encoded><![CDATA[<p>This is the 6th and final part of a tutorial about photography basics. So far we&#8217;ve seen</p>
<ul>
<li><a href="http://www.z-oc.com/blog/2007/08/some-physics-background-related-to-photography/">Some physics background related to photography</a></li>
<li><a href="http://www.z-oc.com/blog/2007/08/the-pinhole-camera-and-the-basics-of-camera-building/">The pinhole camera and the basics of camera building</a></li>
<li><a href="http://www.z-oc.com/blog/2007/08/the-lenses-zoom-focus-and-aperture/">The lenses: Zoom, Focus and Aperture</a></li>
<li><a href="http://www.z-oc.com/blog/2007/08/the-iso-value-films-and-ccd-sensors/">The ISO value: Films and CCD sensors</a></li>
<li><a href="http://www.z-oc.com/blog/2007/08/mastering-the-shutter-speed/">Mastering the Shutter speed</a></li>
</ul>
<p>Finally, we have seen all the necessary elements to build a camera. The black box, the lens, and the shutter.</p>
<p>Traditionally, there were two kinds of film cameras. Cameras with Direct Viewfinder and SLR (Sinlge Lens Reflex, or just Reflex) cameras.</p>
<p><span id="more-127"></span></p>
<p>Direct Viewfinder cameras have and eyepiece that allow to look at the scene to be photographed and the lens that captured the image to be projected on the film to make the picture.</p>
<p>This camera is very simple to make, but brings up a problem. Because the scene you see and the scene you shot are slightly displaced the picture might not be what you expect, heads sometimes are chopped off the picture, and things like that.</p>
<p>This problem is called Paralax Error, and becomes more of a trouble as the the object photographed is closer to the camera. For landscape photography might even be no problem at all, but for close ups is a huge deal.</p>
<div class="left"><a href='http://www.z-oc.com/blog/wp-content/uploads/2007/07/slr-diagram.png' title='SLR cameras diagram'><img  src= 'http://www.z-oc.com/blog/wp-content/uploads/2007/07/slr-diagram.thumbnail.png'  alt= 'SLR cameras diagram' title="" /></a><br />SRL camera internal diagram</div>
<p>SLR cameras work in a very different way. The image you see on the viewfinder is the same that will be photographed. This is accomplished by reflecting the light inside the camera with a mirror and a pentaprism.</p>
<p>Do you remember refraction we talked about on the first post? When a light passes from a medium with higher refractive index to one with a lower one the refracted angle is wider than the incident angle.</p>
<p>Well, when the incident angle is wide enough the refraction angle will be 90 degrees, and what if the angle is even wider? Then an effect called <a href="http://en.wikipedia.org/w iki/Total_internal_reflection">Total Internal Refraction</a> in which the surface behaves like a mirror. This is also how to <a href="http://en.wikipedia.org/wiki/Optical_fiber">Optical Fiber</a> works.</p>
<div class="left"><img  src= 'http://www.z-oc.com/blog/wp-content/uploads/2007/08/totalinternalrefraction.png'  alt= 'Total Internal Refraction' title="" /><br />Total Internal Refraction</div>
<p>A pentaprism is a pentagon extruded on the third dimension. Just like a cilinder but with a pentagonal base, instead of a circular one.</p>
<p>If a pentaprism is made with an adequate geometry and refractive index, it is possible to make light to enter it perpendicular to one face, reflect internally and leave it perpendicular to another face.</p>
<p>Then, the light enters the camera through the lens, reflects on a mirror put at 45 degrees, and enters the pentaprism perpendicularly (see the image for details).</p>
<p>When the shutter is pressed, the mirror is lifted, the curtain behind it is opened and the image is formed either on the film or the CCD.</p>
<p>Now a question, where is the image formed when the mirror is down? It can&#8217;t be directly on our eyes, mostly because the image must be formed at a certain distance that is the focal length, and would be very hard to make this to be our retina.</p>
<p>Actually the bottom face of the pentaprism is what is called Unpolished Glass. That means that is a rough, translucent surface, just like the translucent paper we used on the black box model. Because the surface is rough the image forms on it, but because it is translucent the light goes through, then looking from behind, through the pentaprism one can see the image formed on it.</p>
<p>All this is very nice, precise and sophisticated, but is not all rainbows. A camera like this is heavier, more expensive, more noisy and inherently more fragile because there are more things that can break.</p>
<p>Modern digital cameras are also categorized in compact cameras and Digital SLRs (known as DSLRs). While some compact digital cameras still have Direct Viewfinders, they can also use the sensor to capture the image and show it on a digital viewfinder that is not only more comfortable, but also don&#8217;t have paralax error. Because most people prefer use this digital viewfinder, more and more, digital compact cameras are coming without the direct viewfinder.</p>
<p>A DSLR camera works exactly like the traditional SLR film cameras, except they have a CCD instead on film. Because the sensor is exposed only at the very moment of taking the picture, there is no way for it to continuosly display the image on the LCD viewfinder, you have to use the eyepiece and.</p>
<p>A compact digital camera&#8217;s sensor is continuously exposed to the light that comes from the lens. When taking a picture, it just saves one of the many frames that it is continuously receiving. This is very handy, but by far is not as precise as the mechanical scheme of a SLR that can achieve speeds of 1/8000 of a second and faster.</p>
<a href="http://www.z-oc.com/blog/powerblogroll/">Zo'C powerblogroll</a> - A plugin to make powerful blorgrolls with favicons, descriptions, notes and RSS links]]></content:encoded>
			<wfw:commentRss>http://www.z-oc.com/blog/2007/08/compact-digital-cameras-vs-dslr/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Mastering the Shutter speed</title>
		<link>http://www.z-oc.com/blog/2007/08/mastering-the-shutter-speed/</link>
		<comments>http://www.z-oc.com/blog/2007/08/mastering-the-shutter-speed/#comments</comments>
		<pubDate>Tue, 21 Aug 2007 08:38:00 +0000</pubDate>
		<dc:creator>Guilherme Zühlke O'Connor</dc:creator>
				<category><![CDATA[Photography]]></category>
		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://www.z-oc.com/blog/2007/08/mastering-the-shutter-speed/</guid>
		<description><![CDATA[This is the 5th part of a six-part tutorial about photography basics. So far we&#8217;ve seen

Some physics background related to photography
The pinhole camera and the basics of camera building
The lenses: Zoom, Focus and Aperture
The ISO value: Films and CCD sensors

By now, we have seen that, by changing the ISO value we can change the amount [...]]]></description>
			<content:encoded><![CDATA[<p>This is the 5th part of a six-part tutorial about photography basics. So far we&#8217;ve seen</p>
<ul>
<li><a href="http://www.z-oc.com/blog/2007/08/some-physics-background-related-to-photography/">Some physics background related to photography</a></li>
<li><a href="http://www.z-oc.com/blog/2007/08/the-pinhole-camera-and-the-basics-of-camera-building/">The pinhole camera and the basics of camera building</a></li>
<li><a href="http://www.z-oc.com/blog/2007/08/the-lenses-zoom-focus-and-aperture/">The lenses: Zoom, Focus and Aperture</a></li>
<li><a href="http://www.z-oc.com/blog/2007/08/the-iso-value-films-and-ccd-sensors/">The ISO value: Films and CCD sensors</a></li>
</ul>
<p>By now, we have seen that, by changing the ISO value we can change the amount of light needed for a picture, in exchange for quality. We have also seen that, by changing the aperture value, we can change the amount of light actually entering the camera, in exchange for bigger and smaller depth of field.</p>
<p>But increasing the Aperture value is not the only way to increase the amount of light in a picture.</p>
<p><span id="more-126"></span></p>
<p>In a film camera, you need light to make the silver halides react, hence a clear solution would be just to increase the time the film is exposed. The more time the film is exposed, the more light it gets, the more it reacts, even with few light.</p>
<p>Curiously, this is another similarity on digital photography. The more a sensor is exposed, the more light the photo sensors accumulate and the brighter the picture becomes.</p>
<p>You might want to close the aperture to get more sharp pictures and you can compensate this by increasing exposure time, if you have a tripod and a still subject you can take a very slow picture with bad lighting conditions and closed aperture and the picture might look great.</p>
<p>The rule is simple. Camera apertures are measured in f/ stops. Each f/ stop multiplies or divides the amount for a certain factor. To compensate, divide or multiply the exposure by the same factor.</p>
<p>If you half the aperture you must double your exposure time. Simple as that. Most modern cameras can handle this by themselves, and even if yours don&#8217;t you don&#8217;t have to do the math all the time, the camera photometer will do this for you and signal when light is Ok.</p>
<div class="right" style="width:300px"><a href='http://www.z-oc.com/blog/wp-content/uploads/2007/08/shutter_speed_90.jpg' title='Picture at speed 1/90'><img  src= 'http://www.z-oc.com/blog/wp-content/uploads/2007/08/shutter_speed_90_t.jpg'  alt= 'Smaller version of picture at 1/90' title="" /></a><a href='http://www.z-oc.com/blog/wp-content/uploads/2007/08/shutter_speed_5001.jpg' title='Picture at speed 1/500'><img  src= 'http://www.z-oc.com/blog/wp-content/uploads/2007/08/shutter_speed_500_t.jpg'  alt= 'Smaller version of picture at 1/500' title="" /></a><br />Pictures taken with speeds of 1/90 and 1/500 of a second. The water in the slowest picture is blurred while in the fastest is sharper. Regard that the slowest picture had a closer aperture and hence a deeper depth of field. You can see the background is sharper in the slowest.</div>
<p>Altering the shutter speed has a trade-off, of course.</p>
<p>What happens in a long exposition is that the sensor collects more light to analize and create the image, but the problem is that this light has to be the same. If the intensity or color change during the exposure the results won&#8217;t be accurate.</p>
<p>Typically, if either the camera shakes or the subject moves, the light reaching the sensor will change and will interfere.</p>
<p>If a single pixel on the sensor receive light information from different sources, then multiple images will impress the same region and the same object will be imprinted on many regions of the sensor, as a result the image will be blurred.</p>
<p>Now, there are at least two ways you can take blur to your advantage. One is when part of the picture is in motion and you want this part to be blurred while the rest is sharp, one common use for this is with running water.</p>
<p><a href="http://www.flickr.com/photos/guioconnor/1141095014/" title="Photo Sharing"><img   class= "right"  src= "http://farm2.static.flickr.com/1032/1141095014_9155ebdd2a_m.jpg"  width= "240"  height= "166"  alt= "Riding in Piazza Fiera" title="" /></a><br />
The second one is called <em>panning</em> and consist in photographing a moving subject by following with the camera while it moves, by doing this, the background will have a motion blur and the main subject will be focused. This is, of course, much difficult that the first one and requires some more experimentation.</p>
<p>In case you wonder how would that be o film, it is the exact same, but is the silver halide instead of the sensor pixel.</p>
<a href="http://www.z-oc.com/blog/powerblogroll/">Zo'C powerblogroll</a> - A plugin to make powerful blorgrolls with favicons, descriptions, notes and RSS links]]></content:encoded>
			<wfw:commentRss>http://www.z-oc.com/blog/2007/08/mastering-the-shutter-speed/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The ISO value: Films and CCD sensors</title>
		<link>http://www.z-oc.com/blog/2007/08/the-iso-value-films-and-ccd-sensors/</link>
		<comments>http://www.z-oc.com/blog/2007/08/the-iso-value-films-and-ccd-sensors/#comments</comments>
		<pubDate>Sat, 18 Aug 2007 08:03:52 +0000</pubDate>
		<dc:creator>Guilherme Zühlke O'Connor</dc:creator>
				<category><![CDATA[Photography]]></category>
		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://www.z-oc.com/blog/1999/11/the-iso-value-films-and-ccd-sensors/</guid>
		<description><![CDATA[The ISO value: Films and CCD sensors
This is the 4th part of a six-part tutorial about photography basics. So far we&#8217;ve seen

Some physics background related to photography
The pinhole camera and the basics of camera building
The lenses: Zoom, Focus and Aperture

We have seen how it is possible to project an image on a surface, but we [...]]]></description>
			<content:encoded><![CDATA[<p>The ISO value: Films and CCD sensors</p>
<p>This is the 4th part of a six-part tutorial about photography basics. So far we&#8217;ve seen</p>
<ul>
<li><a href="http://www.z-oc.com/blog/2007/08/some-physics-background-related-to-photography/">Some physics background related to photography</a></li>
<li><a href="http://www.z-oc.com/blog/2007/08/the-pinhole-camera-and-the-basics-of-camera-building/">The pinhole camera and the basics of camera building</a></li>
<li><a href="http://www.z-oc.com/blog/2007/08/the-lenses-zoom-focus-and-aperture/">The lenses: Zoom, Focus and Aperture</a></li>
</ul>
<p>We have seen how it is possible to project an image on a surface, but we haven&#8217;t seen so far how to transform the projected image, into a photography that can be seen further in time.</p>
<p>In this post, we will see basics of how films and digital sensors work and how to use ISO value on your own advantage.</p>
<p><span id="more-125"></span></p>
<h3>A little bit of Film History and the Digital Sensors</h3>
<p>Originally photography was brought to existence because some extremely brilliant people were able to use the knowledge of some chemical substances that react to light and become other substances.</p>
<p>When exposed to light, these substances form sliver cristals which are opaque and dark, hence enabling people to capture black and white images based on whether the light has or hasn&#8217;t hit the surface on a particular point.</p>
<p>One of these cases is the family of the silver halides. That is, compounds made of silver and a halogen, usually chlorine, bromine and iodine.</p>
<p>Many years have passed and countless improvements over this led to very high quality photography material and further, enabled people to think on electronic, not chemical, devices capable to do the same, that is, capture images and represent them as a matrix of points, instead of an array of silver cristals.</p>
<p>And digital photography was born.</p>
<p>As you see, film photography and digital photography walk hand in hand for a very long way, despite the internals are completely different, the way they behave is very similar in many aspects, that is why the basics for film photography are very much the same than the basics for digital photography.</p>
<h3>Sensitivity and ISO values</h3>
<div class="right">
<img  src= 'http://www.z-oc.com/blog/wp-content/uploads/2007/08/iso_values_200.jpg'  alt= 'ISO values: ISO200' title="" /><br />
<img  src= 'http://www.z-oc.com/blog/wp-content/uploads/2007/08/iso_values_1600.jpg'  alt= 'ISO values: ISO 1600' title="" /></p>
<p>Two pictures of the same scene, taken with ISO200 and ISO1600 respectively. The image taken with ISO 1600 has visible noise.
</p></div>
<p>In film, there is something called sensitivity of film. The more grains of silver halides in the film, the more sharp  the image, but also, the more light you need. That is why film sensitivity is also commonly nicknamed film speed.</p>
<p>Film speeds where classified by agencies like ASA and DIN in standards like ASA 100, ASA 400 or DIN 27. Then ISO took standards over and films where named ISO 100 or ISO 400.</p>
<p>These standards describe the amount of light needed to take a picture with a film, the lower the ISO value, the more light needed and, usually, the higher the quality.</p>
<p>There are many other factors that influence the speed and quality of film, but roughly speaking, the amount of silver halides is the main reason. The amount and size of grains are equivalent to what is known in digital photography as <em>resolution</em>.</p>
<p>Digital photography has adopted the ISO film standards to describe sensor speeds and the trade-offs are about the same: the higher the ISO, the less light you need, but instead the lower the quality, which means that the image definition, contours and details, is poorer.</p>
<p>In digital photography, the ISO doesn&#8217;t affect the amount of pixels of the final image, hence the resolution. Instead, affects the quality of each individual pixel.</p>
<p>The higher the ISO value set on a digital camera, the less light you need, but also, the harder it gets to detect an image through the incoming light, producing noise on the picture.</p>
<p>The noise produced by a high ISO digital photography is similar, but not the same than low quality of high ISO film photography, which instead of noise is called <em>granulation</em>.</p>
<p>Anyway, roughly speaking, the trade-off with digital ISO is the same as in film ISO, you need more light to get more quality.</p>
<a href="http://www.z-oc.com/blog/powerblogroll/">Zo'C powerblogroll</a> - A plugin to make powerful blorgrolls with favicons, descriptions, notes and RSS links]]></content:encoded>
			<wfw:commentRss>http://www.z-oc.com/blog/2007/08/the-iso-value-films-and-ccd-sensors/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>The lenses: Zoom, Focus and Aperture</title>
		<link>http://www.z-oc.com/blog/2007/08/the-lenses-zoom-focus-and-aperture/</link>
		<comments>http://www.z-oc.com/blog/2007/08/the-lenses-zoom-focus-and-aperture/#comments</comments>
		<pubDate>Thu, 16 Aug 2007 04:37:48 +0000</pubDate>
		<dc:creator>Guilherme Zühlke O'Connor</dc:creator>
				<category><![CDATA[Photography]]></category>
		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://www.z-oc.com/blog/2007/08/the-lenses-zoom-focus-and-aperture/</guid>
		<description><![CDATA[This is the 3rd part of a six-part tutorial about photography basics. So far we&#8217;ve seen

Some physics background related to photography
The pinhole camera and the basics of camera building

We have seen in the previous post, that by isolating rays of light through a tiny hole, we can separate and project images of objects. The smaller [...]]]></description>
			<content:encoded><![CDATA[<p>This is the 3rd part of <a href="http://www.z-oc.com/blog/2007/08/understanding-cameras-and-photography/">a six-part tutorial about photography</a> basics. So far we&#8217;ve seen</p>
<ul>
<li><a href="http://www.z-oc.com/blog/2007/08/some-physics-background-related-to-photography/">Some physics background related to photography</a></li>
<li><a href="http://www.z-oc.com/blog/2007/08/the-pinhole-camera-and-the-basics-of-camera-building/">The pinhole camera and the basics of camera building</a></li>
</ul>
<p>We have seen in the previous post, that by isolating rays of light through a tiny hole, we can separate and project images of objects. The smaller the whole, the sharper and darker the image, and vice-versa.</p>
<p>It would be really great if we could find a way to widen the aperture of the camera and correct the rays of light and project all diverging rays of light the same point, isn&#8217;t it? That would provide a sharp image that is also very illuminated.</p>
<p>In this post, I&#8217;ll show you the lens basics and how to use focus and aperture to your advantage in pictures.</p>
<p><span id="more-124"></span></p>
<div class="right"><img  src= 'http://www.z-oc.com/blog/wp-content/uploads/2007/08/refraction.png'  alt= 'Refraction of light title="" /><br />Refraction of light</div>
<p>There is a phenomenon that occurs with light called refraction. Refraction occurs when light passes from one medium to another. If light passes in an oblique angle between the media it will change its direction.</p>
<p>Each transparent medium allows light to cross with a certain speed, this is what is called <a href="http://en.wikipedia.org/wiki/Refractive_index">refractive index</a>.</p>
<p>When a light beam hits a surface between two transparent media with an oblique angle, the first part of it to hit it reduces its speed and forces the beam to bend and change its angle, this is called refraction. By cleverly shaping the surface between the two media, it is possible to do some great tricks, like concentrate rays of light, which is exactly what we want.</p>
<div class="left"><img  src= 'http://www.z-oc.com/blog/wp-content/uploads/2007/08/magnifyingglass.png'  alt= 'Magnifying Glass on a sunny day' title="" /><br />Magnifying glass on a sunny day</div>
<p>Thanks to this properties, we have the magnifying glass. If you put a sheet of paper under the sun, infinite sun rays are projected on the paper. These are images of the sun, casted on the paper and they cover all the extension of it.</p>
<p>By using a magnifying glass, it is possible to change direction of the sun rays and make them converge to one single point. This point is called focus. By doing this on a sunny day, the amount of energy in the focus is so great, that you can, literally, burn the paper.</p>
<p>Well, that is the way to go, by using these properties to build lenses we can put in the black box we can increase the size of the hole and keep the focus at the same time.</p>
<p>As you might have guessed already, the focus of the lens must be exactly over the projection surface (translucent paper, photographic paper, film, CCD). So the longer the box is, the greater the focal length should be, and vice-versa.</p>
<div class="left"><img  src= 'http://www.z-oc.com/blog/wp-content/uploads/2007/08/blackboxlens.png'  alt= 'Black box with lens' title="" />
<p>A correction lens in the aperture of the camera to correct divergent rays of light.</p>
</div>
<p>A single lens like this would only be able to focus objects at a certain distance, just like a magnifying glass. By combining multiple lenses you can have a focusing ring that allows you to chose the range in which objects will be focused. Objects positioned closer or farther that this value will be blurred.</p>
<p>How much the objects off-distance will be blurred largely depends on the size of the opening in the lens, the smaller the diameter the less blurred, but the darker the whole scene becomes. The greater the diameter the lighter the picture, but the more blurred the off-distance images become.</p>
<p class="pullout">
The range that will be focused at a certain aperture is called Depth-of-Field.
</p>
<div style="width:150px">
<div class="left"><a href='http://www.z-oc.com/blog/wp-content/uploads/2007/08/depth-of-field_f4_8-t.jpg' title='Depth of field at f/4.8'><img  src= 'http://www.z-oc.com/blog/wp-content/uploads/2007/08/depth-of-field_f4_8-t.thumbnail.jpg'  alt= 'Depth of field at f/4.8' title="" /></a><br />Deep depth of field at aperture f/32</div>
<div class="left"><a href='http://www.z-oc.com/blog/wp-content/uploads/2007/08/depth-of-field_f32-t.jpg' title='Depth of field at f/32'><img  src= 'http://www.z-oc.com/blog/wp-content/uploads/2007/08/depth-of-field_f32-t.thumbnail.jpg'  alt= 'Depth of field at f/32' title="" /></a><br />Shallow depth of field at aperture f/4.8</div>
</div>
<p>This is obviously a trade-off and that is why almost all lenses for professional cameras and even a lot of the amateur cameras as well come with an <a href="http://en.wikipedia.org/wiki/Aperture">aperture</a> device that, roughly speaking, allows you to control the diameter of the inner hole of the lens.</p>
<p>The aperture of a lens is measured in f/ stops like f/2.8, f/4.6 or f/32. What these numbers represent is too technical and is outside the scope of this tutorial, but you should keep in mind that the smaller the number, more luminous the lens and better&#8230; and more expensive.</p>
<p>On the inner side of the camera, using a similar idea, we can also lengthen the focal distance of the lens and keep the focus over the projecting film or CCD while putting the lenses closer or farther to it, changing the approximation and perspective accentuation of the image. This is called a zoom lens.</p>
<p>Another trade-off, of course, is that all this technology is more expensive and requires more knowledge to handle, so you end up having a huge range of cameras to buy, from cheap to obscenely expensive and from very simple to very complex ones.</p>
<p>The more you understand about this and the more the camera lets you explore your knowledge, the more you are able to take gorgeous, fantastic photos and hopefully, this is why you are reading this text.</p>
<a href="http://www.z-oc.com/blog/powerblogroll/">Zo'C powerblogroll</a> - A plugin to make powerful blorgrolls with favicons, descriptions, notes and RSS links]]></content:encoded>
			<wfw:commentRss>http://www.z-oc.com/blog/2007/08/the-lenses-zoom-focus-and-aperture/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Some physics background related to photography</title>
		<link>http://www.z-oc.com/blog/2007/08/some-physics-background-related-to-photography/</link>
		<comments>http://www.z-oc.com/blog/2007/08/some-physics-background-related-to-photography/#comments</comments>
		<pubDate>Fri, 10 Aug 2007 04:37:41 +0000</pubDate>
		<dc:creator>Guilherme Zühlke O'Connor</dc:creator>
				<category><![CDATA[Photography]]></category>
		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://www.z-oc.com/blog/2007/08/some-physics-background-related-to-photography/</guid>
		<description><![CDATA[This is the 1st part of a six-part tutorial about photography basics.
Visual properties of objects
Every material, has some visual properties like color, brightness and opacity. Visual properties are directly related to what happen to incident rays of light.
 Say you are on a room with white walls, illuminated by an light bulb. We see the [...]]]></description>
			<content:encoded><![CDATA[<p>This is the 1st part of <a href="http://www.z-oc.com/blog/2007/08/understanding-cameras-and-photography/">a six-part tutorial about photography</a> basics.</p>
<h3>Visual properties of objects</h3>
<p>Every material, has some visual properties like color, brightness and opacity. Visual properties are directly related to what happen to incident rays of light.</p>
<p><a href='http://www.z-oc.com/blog/wp-content/uploads/2007/07/unordered_reflection.png' title='Unordered Reflection'><img  class= "left"  src= 'http://www.z-oc.com/blog/wp-content/uploads/2007/07/unordered_reflection.thumbnail.png'  alt= 'Unordered Reflection' title="" /></a> Say you are on a room with white walls, illuminated by an light bulb. We see the walls because the light that is emitted by the bulb is made of light rays that, as they hit the walls, are reflected. The ability of reflecting the rays is a property of these walls.</p>
<p>But the wall is a rough surface, even a wall that is smooth to the touch has enough ups and downs to be rough to light dimensions. So, any point of it will reflect light like if there was a mirror, tangent to the wall in the very point of the incident ray.</p>
<p><span id="more-122"></span></p>
<p>The light ray will be reflected with a reflection angle that is equal to the incident angle, but because the wall is rough, every light ray will arrive in a different angle and each one will have a different reflection angle, as a result, any ray of light will go to a different direction, in a very unordered way.</p>
<p>That is why, when we look at a wall we don&#8217;t see an image reflected on it, like we do when we look at a mirror. Nevertheless, what we see on the wall is an image of everything on the room that is emitting or reflecting light.</p>
<p>At the same time, any point of the wall receives rays of light that come from many (we could say infinite) other points of the room. So, any point of the wall is reflecting light from infinite other points that come in many colors. The red one from a shirt, the blue from the flower vase, the green from the leaves, the yellow from the flower, and so on.</p>
<p>A red object is red, because, it absorbs all rays of light except the red ones that are reflected. The light that reflects in a red object and the reflects to our eyes is darker than the original, because two thirds of the incident light will be absorbed by it. It will also be red, because those the third reflected is made of only one frequency range: the red range.</p>
<p><img  src= 'http://www.z-oc.com/blog/wp-content/uploads/2007/08/surface_absorbing_light.png'  alt= 'Red Surface absobing light' title="" /></p>
<p>Still on the subject, blacks are black because they absorb every single ray of light and none is reflected, that is why we say that black is the absence of color.</p>
<p>What makes a wall white? Well, is just that it has the ability (or property) to reflect all kinds of colors and absorb none. When all these rays of light hit your eyes, the light is &#8220;added up&#8221; and you don&#8217;t see all the individual rays, but the sum of them.</p>
<h3>The structure of the human eye</h3>
<p>Human eyes have photoreceptor structures <a href="http://hyperphysics.phy-astr.gsu.edu/hbase/vision/rodcone.html">called cones</a> that can detect red, green and blue rays of light. No other color is perceived by the human eye, what happens is that the brain mixes amounts of these three seamlessly and we feel like seeing other colors.</p>
<p>People use to say that red, green and blue are primary colors because they are the primary components of white light. This is not untrue, but we must realize that this is only true when associated with human perception of light, not with light itself.</p>
<p>Anyway, ultimately, all light we see can be divided into three parts, and we can rely on understanding only these three to study all the light we see.</p>
<p><img  src= 'http://www.z-oc.com/blog/wp-content/uploads/2007/07/additive-colors.gif'  alt= 'Aditive colors animated gif' title="" /></p>
<h3>Subtractive colors</h3>
<p>As you probably know since kindergarten adding paints does not bring white into the picture. The more colored paint you add, the darker it gets.</p>
<p>That is because the paint absorbs all the incident rays except the ones on the paint color, that are reflected. So, the more paint you add, the more rays are absorbed, eventually fading to black. </p>
<h3>The Newton&#8217;s Color Wheel</h3>
<p>Just because adding colored paint turns into black, it doesn&#8217;t mean that &#8220;white is the sum of all colors&#8221; is not true, fiction or just a theoretical model, but you have to make sure you are adding light, and not only paint.</p>
<p>We can do an experiment that shows that the sum of colors is white. Take a disc and divide it in three circular sectors, then paint each one with one of these colors: red, green and blue.</p>
<p>If you nail the circle by its center and spin it fast enough the circle will seem white. Looking at any point of the circle will make you eye receive a rapid succession of intermit red, green and blue, so fast that the eye will blend them together and see white.</p>
<p>This is called the Newton&#8217;s Color Wheel.</p>
<h3>Conclusion</h3>
<p>A rough object, like the wall on the example, reflects light on every possible direction and builds infinite images that are projected all around the place and mix with images of other objects.</p>
<p>Our eyes only see reds, greens and blues and they are sent to the brain that mixes them, based on amount of light, incapable of separate the different rays or images formed.</p>
<p>To take a picture we need to isolate one of these images from the others and keep it.</p>
<a href="http://www.z-oc.com/blog/powerblogroll/">Zo'C powerblogroll</a> - A plugin to make powerful blorgrolls with favicons, descriptions, notes and RSS links]]></content:encoded>
			<wfw:commentRss>http://www.z-oc.com/blog/2007/08/some-physics-background-related-to-photography/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Understanding Cameras and Photography</title>
		<link>http://www.z-oc.com/blog/2007/08/understanding-cameras-and-photography/</link>
		<comments>http://www.z-oc.com/blog/2007/08/understanding-cameras-and-photography/#comments</comments>
		<pubDate>Tue, 07 Aug 2007 06:46:49 +0000</pubDate>
		<dc:creator>Guilherme Zühlke O'Connor</dc:creator>
				<category><![CDATA[Photography]]></category>
		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://www.z-oc.com/blog/2007/08/understanding-cameras-and-photography/</guid>
		<description><![CDATA[In 2001 I was hired by a government sponsored project to teach a photography course with a very peculiar approach. I had to teach High School teachers so they could use photography as a tool in the regular classes like Physics, Chemistry (it wasn&#8217;t digital photography back then), History, Art, and so on.
As a part [...]]]></description>
			<content:encoded><![CDATA[<p><img  src= 'http://www.z-oc.com/blog/wp-content/uploads/2007/08/srlcamera.thumbnail.png'  alt= 'SRL camera diagram'  class= "left" title="" />In 2001 I was hired by a government sponsored project to teach a photography course with a very peculiar approach. I had to teach High School teachers so they could use photography as a tool in the regular classes like Physics, Chemistry (it wasn&#8217;t digital photography back then), History, Art, and so on.</p>
<p>As a part of the course I wrote a tutorial that was quite handy for some people over the years and now, in a time when film photography is almost extinct I thought it was time to refresh the text and make a handy manual on photography in six parts.</p>
<p>Every three days, on August 9th, 12th, 15th, 18th, 21th and 24th I will publish each one of the six parts of the manual, see the list below.</p>
<ul>
<li><a href="http://www.z-oc.com/blog/2007/08/some-physics-background-related-to-photography/">Some physics background related to photography</a></li>
<li><a href="http://www.z-oc.com/blog/2007/08/the-pinhole-camera-and-the-basics-of-camera-building/">The pinhole camera and the basics of camera building<!--/a--></li>
<li><a href="http://www.z-oc.com/blog/2007/08/the-lenses-zoom-focus-and-aperture/">The lenses: Zoom, Focus and Aperture</a></li>
<li><a href="http://www.z-oc.com/blog/2007/08/the-iso-value-films-and-ccd-sensors/">The ISO value: Films and CCD sensors</a></li>
<li><a href="http://www.z-oc.com/blog/2007/08/mastering-the-shutter-speed/">Mastering the Shutter speed</a></li>
<li><a href="http://www.z-oc.com/blog/2007/08/compact-digital-cameras-vs-dslr/">Compact digital cameras Vs. DSLR</a></li>
</dl>
<a href="http://www.z-oc.com/blog/powerblogroll/">Zo'C powerblogroll</a> - A plugin to make powerful blorgrolls with favicons, descriptions, notes and RSS links]]></content:encoded>
			<wfw:commentRss>http://www.z-oc.com/blog/2007/08/understanding-cameras-and-photography/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Manage all your email accounts with Gmail</title>
		<link>http://www.z-oc.com/blog/2007/06/manage-all-your-email-accounts-with-gmail/</link>
		<comments>http://www.z-oc.com/blog/2007/06/manage-all-your-email-accounts-with-gmail/#comments</comments>
		<pubDate>Wed, 20 Jun 2007 18:34:18 +0000</pubDate>
		<dc:creator>Guilherme Zühlke O'Connor</dc:creator>
				<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://www.z-oc.com/blog/2007/06/manage-all-your-email-accounts-with-gmail/</guid>
		<description><![CDATA[Since I first met Gmail, in the very beginning of the service, I became addicted to the interface and, this days, I can hardly imagine myself using something else.
Yet using public email addresses is a big problem because if one day you change to another service you will have the headache of telling everybody about [...]]]></description>
			<content:encoded><![CDATA[<p>Since I first met Gmail, in the very beginning of the service, I became addicted to the interface and, this days, I can hardly imagine myself using something else.</p>
<p>Yet using public email addresses is a big problem because if one day you change to another service you will have the headache of telling everybody about your new address. Having your own domain and your email within it is much better.</p>
<p>You may also want to handle old email accounts within Gmail transparently.</p>
<p>In this article, I will show you how to configure Gmail to manage multiple accounts in a transparent way and using your own domain email address or any other you may like.</p>
<p>Update: See the sequel of this article and learn <a href="http://www.z-oc.com/blog/2007/10/how-to-manage-all-your-mail-in-gmail-filters-labels-multiple-ids-and-even-backups/">How to manage all your main in Gmail: Filters, Labels multiple Id’s and even backups</a></p>
<p><span id="more-94"></span></p>
<p><a name="step1"><br />
<h3>Step 1 &#8211; Forward your current addresses to Gmail</h3>
<p></a></p>
<p>The first thing to do is to put a forwarding rule on all your other email addresses.</p>
<p>If you own a domain, creating fordward email accounts is probably very simple, on your registrar&#8217;s site. You can create an email you@yourdomain.com that has no mailbox associated and the email will be simply be forwarded to you@gmail.com.</p>
<p>If you own an email from a free mail service, it is likely that you can configure a forward rule to another address. Some email systems don&#8217;t allow you to do that. If that is the case you won&#8217;t be able to manage it through Gmail.</p>
<p class="pullout">
Keep in mind that if your email system doesn&#8217;t allow you to create a forward rule this is a very good reason to get rid of it as soon as possible.
</p>
<p>With this done, you will receive all your mail on your Gmail account.</p>
<p>So far, so good, but this is pretty basic, huh? We are suppose to handle all email through Gmail and not just receive forwaded mail, correct?</p>
<p>Read on, gentle reader, you&#8217;ll find your answers.</p>
<p><a name="step2"><br />
<h3>Step 2 &#8211; Defining an email management policy</h3>
<p></a></p>
<p>So far you have set up all email accounts you have to forward to Gmail. But still, if you reply a message addressed to you@yourdomain.com the sender will still be you@Gmail.com. So your managing address will be shown and this may bring up two problems</p>
<ul>
<li>You lose the authority of your domain on email you replied.</li>
<li>You are disclosing an address you don&#8217;t want email to be directly sent to.</li>
</ul>
<p>If people send email to you@yourdomain.com, they expect a reply from this account. If you send a reply from a different account that may undermine trust and authority your domain has. To say the least, you will disclose how your inner email management system works.</p>
<p>The second problem is even worse. If one day you want to quit Gmail and use something else to manage your mail, you will have to care about people sending email directly to your Gmail account.</p>
<p>Say that one day, someone manages to get access to your Gmail account and takes over it (I&#8217;ve know cases like this before), you&#8217;ll need a new one. If you don&#8217;t receive direct email to that account, you only have to redirect you@yourdomain to your_new_account@Gmail.com.</p>
<p>So you what we want is</p>
<ul>
<li>All email you want to manage should be replied from the same account it was sent to</li>
<li>All email sent to obsolete accounts should arrive, but should be replied with the new address</li>
<li>Set a default address attached to your identity, and not to Gmail or any other public email service</li>
</ul>
<p><a name="step3"><br />
<h3>Step 3 &#8211; Setting Gmail to assume different identities</h3>
<p></a></p>
<p>Now, we want Gmail to assume a different Identity for different email accounts you have forwarded to it.</p>
<p>For this, let&#8217;s assume you have these accounts forwarded to your Gmail:</p>
<dl>
<dt>you@yourdomain.com</dt>
<dd>Your account within your domain. An account you plan to keep for countless years and have full power to manage.</dd>
<dt>contact@yourdomain.com</dt>
<dd>Your contact account within your domain. You want to keep it as a separate identity because one day your little business may grow so much that you&#8217;ll need to hire someone else to handle contact email while you play CEO.</dd>
<dt>you@oldwebmail.com</dt>
<dd>An old account of yours in a web provider you don&#8217;t really like but you can&#8217;t get rid of because people still send you email to it.</dd>
<dt>grandma@GrandmaCakes.com</dt>
<dd>Your grandma&#8217;s account. She is not quite good at email, but she needed a contact address since she launched a website to sell her wonderful cakes out. She left you in charge of handling customers on her behalf (she will bake your favorite cake in return)</dd>
</dl>
<p>What we want is:</p>
<ul>
<li>Your default email will be you@yourdomain.com. Every email you start writing will be sent with this identity.</li>
<li>Incoming mail to you@yourdomain.com will be replied as you@yourdomain.com</li>
<li>Incoming mail to contact@yourdomain.com will be replied as contact@yourdomain.com</li>
<li>Incoming mail to you@oldwebmail.com should be replied as the default identity, once you&#8217;d like this account to be lost forever instead of perpetuated</li>
<li>Incoming mail to grandma@GrandmaCakes.com will be replied assuming the nice old lady&#8217;s identity.</li>
</ul>
<p>Now, let&#8217;s do it.</p>
<ol>
<li>
The first thing to do is to set up the default reply mail policy. Go to Settings&raquo;Accounts and click in <em>Reply from the same address the message was sent to</em>. With this, if a message is sent to an email managed by Gmail, when it is replied, Gmail will use as sender the same identity the email was sent to.
</li>
<p><img  src= 'http://www.z-oc.com/blog/wp-content/uploads/2007/06/configuring_gmail_1.png'  alt= 'Configuring Gmail 1' title="" /></p>
<li>
Now, let&#8217;s configure your default mail. Click <em>Add another email address</em> and put your name and the email address you want as default, you@yourdomain.com in our example.</p>
<p>Gmail will send this address a confirmation email to verify that you own it. Because is already redirected in our example, you will receive the message on your Gmail account, no problems about it.
</li>
<p><img  src= 'http://www.z-oc.com/blog/wp-content/uploads/2007/06/configuring_gmail_2.png'  alt= 'Configuring Gmail 2' title="" /></p>
<li>
Then, repeat the process to contact@yourdomain and grandma@GrandmaCakes.com, but do <em>not</em> include you@oldwebmail.com. Why? Just because you don&#8217;t want to manage that account, it is already redirected to you, but you don&#8217;t want that identity anymore.</p>
<p>If you don&#8217;t include an email account, Gmail will not assume its identity as sender, and the default address will be used. Now you are able to read mail from this account, but you won&#8217;t send email from it.
</li>
<li>
The Last step is setting your default account. Right now is you@gmail.com. That means that all email you start and all email sent to unmanaged accounts that are redirected to it, will be replied with this identity. But you want to hide your Gmail account from public, so click on the <em>make default</em> link to the right of you@your_domain.com.
</li>
<p><img  src= 'http://www.z-oc.com/blog/wp-content/uploads/2007/06/configuring_gmail_3.png'  alt= 'Configuring Gmail 3' title="" />
</ol>
<p>Now you are done. You can manage all your email within Gmail and nobody will even know you have one.</p>
<a href="http://www.z-oc.com/blog/powerblogroll/">Zo'C powerblogroll</a> - A plugin to make powerful blorgrolls with favicons, descriptions, notes and RSS links]]></content:encoded>
			<wfw:commentRss>http://www.z-oc.com/blog/2007/06/manage-all-your-email-accounts-with-gmail/feed/</wfw:commentRss>
		<slash:comments>99</slash:comments>
		</item>
		<item>
		<title>&#8220;Order By&#8221; in SQL queries and random selection of database items</title>
		<link>http://www.z-oc.com/blog/2007/06/order-by-in-sql-queries-and-random-selection-of-database-items/</link>
		<comments>http://www.z-oc.com/blog/2007/06/order-by-in-sql-queries-and-random-selection-of-database-items/#comments</comments>
		<pubDate>Thu, 14 Jun 2007 17:20:10 +0000</pubDate>
		<dc:creator>Guilherme Zühlke O'Connor</dc:creator>
				<category><![CDATA[Server Side]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[mySQL]]></category>
		<category><![CDATA[random]]></category>
		<category><![CDATA[SQL]]></category>

		<guid isPermaLink="false">http://www.z-oc.com/blog/2007/06/order-by-in-sql-queries-and-random-selection-of-database-items/</guid>
		<description><![CDATA[Simple hint, how to select a number random items from a MySQL database:

SELECT *
FROM your_table
ORDER BY rand()
LIMIT 2;

The code above, selects all the fields from a database table named &#8220;your_table&#8221; orders the results randomically and gets the first two. Change two for your favourite number.

Want to see an example of this working? Just look to [...]]]></description>
			<content:encoded><![CDATA[<p>Simple hint, how to select a number random items from a MySQL database:</p>
<pre>
<code>SELECT *
FROM your_table
ORDER BY rand()
LIMIT 2;</code>
</pre>
<p>The code above, selects all the fields from a database table named &#8220;your_table&#8221; orders the results randomically and gets the first two. Change two for your favourite number.</p>
<p><img  src= 'http://www.z-oc.com/blog/wp-content/uploads/2007/06/recommended.png'  class= "instant"  alt= 'Recommended Reading'  style= "float:left;margin: 0px 10px 10px 0" title="" /></p>
<p>Want to see an example of this working? Just look to your right! On the sidebar, there is a section named &#8220;Recommended Reading&#8221;. This is a section with books I like and recommend. I keep a list of books on a database and I pick <del datetime="2007-07-02T02:40:41+00:00">two</del> six at random with a query like this, each time a page is loaded.</p>
<p>Maybe you did knew this command already, or at least you heard about the ORDER BY command, but do you exactly know how it works and how further you can go with it?</p>
<p>I&#8217;ll show you some nice things in this article.</p>
<p><span id="more-96"></span></p>
<p>[All the code on this page works in MySQL, <a href="http://www.petefreitag.com/item/466.cfm">SQL syntax may vary</a> in other Database Management Systems, but the same ideas apply to all]</p>
<h3>How does ORDER BY works</h3>
<p>The ORDER BY statement on a SQL query atributes an indexing number on each entry of the table.</p>
<p>When you do a </p>
<pre>
<code>SELECT *
FROM recommendations
ORDER BY price;</code>
</pre>
<p>An indexing value will be calculated for each entry, based on the expression after the ORDER BY statement. The <em>price</em> will work as variable. The value of the registry will be used as indexing value for it, then the whole list will be sorted based on it. This is how it works.</p>
<p>So, if you use a custom method to set the indexing value you can have your own sorting system. For instance, see this query</p>
<pre>
<code>SELECT *
FROM recommendations
ORDER BY price - discount;</code>
</pre>
<p>For each entry, the discount will be subtracted from the price, this number will be set as indexing value for the entry, then, the results will be sorted based on it.</p>
<p>In practice the indexing value will be the final value to be paid, lowest prices first. You can reverse this using descending order.</p>
<pre>
<code>SELECT *
FROM recommendations
ORDER BY price - discount DESC;</code>
</pre>
<h3>Order By using functions</h3>
<p>MySQL comes with a lot of <a href="http://dev.mysql.com/doc/refman/5.0/en/functions.html">predefined funcions</a> (and you can create funcions of your own, but this will not be covered on this post).</p>
<p>One of theese funcions is rand(). The rand() function returns a random number every time it is called.</p>
<pre>
<code>SELECT *
FROM recommendations
ORDER BY rand();</code>
</pre>
<p>When used in a query like the one above, the rand() funcion will be called for each entry and a random number will be set as indexing value for them. The table will, then, be sorted based on theese numbers. The result would by, obviously, that entries will appear in random places.</p>
<p>If you only want to select, say, 2 random entries from the table, you can limit your search using</p>
<pre>
<code>SELECT *
FROM recommendations
ORDER BY rand()
LIMIT 2;</code>
</pre>
<h3>Boolean searching criteria, one step beyond</h3>
<p>[Now, before anything else, I must give credit to Benjamin Wilger for <a href="http://www.ilovejackdaniels.com/blog/useful-sql-snippet/comments/#comment1">his comment</a> on <a href="http://www.ilovejackdaniels.com/blog/useful-sql-snippet/">Dave's blog</a>.]</p>
<p>What if you want to just sort through boolean criteria. For instance, what if you <em>don&#8217;t</em> want to sort by item final price, but you do want those who don&#8217;t have a discount to come before who have?</p>
<pre>
<code>SELECT *
FROM recommendations
ORDER BY (discount > 0);</code>
</pre>
<p>Now, this is tricky, so let&#8217;s see it carefully.</p>
<p>The expression <code>(discount > 0)</code> is a logical statement, not an arithmetic one. This means that the answer to that is either true or false instead of a number.</p>
<p>But in databases, everything are numbers on the lowest level. False is actually a zero and true is actually a one.</p>
<p>When you set the result of (discount > 0) as the indexing value, you are actually setting zeroes and ones as sorting criteria and, because zero comes first, the entries in which the expression evaluated as false come first.</p>
<p>If you want the items with discount to come first, you can sort in descending order</p>
<pre>
<code>SELECT *
FROM recommendations
ORDER BY (discount > 0) DESC;</code>
</pre>
<a href="http://www.z-oc.com/blog/powerblogroll/">Zo'C powerblogroll</a> - A plugin to make powerful blorgrolls with favicons, descriptions, notes and RSS links]]></content:encoded>
			<wfw:commentRss>http://www.z-oc.com/blog/2007/06/order-by-in-sql-queries-and-random-selection-of-database-items/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Managing obsolete pages with one line of code</title>
		<link>http://www.z-oc.com/blog/2007/05/managing-obsolete-pages-with-one-line-of-code/</link>
		<comments>http://www.z-oc.com/blog/2007/05/managing-obsolete-pages-with-one-line-of-code/#comments</comments>
		<pubDate>Mon, 07 May 2007 20:36:58 +0000</pubDate>
		<dc:creator>Guilherme Zühlke O'Connor</dc:creator>
				<category><![CDATA[Server Side]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[Apache]]></category>

		<guid isPermaLink="false">http://www.z-oc.com/blog/2007/05/managing-obsolete-pages-with-one-line-of-code/</guid>
		<description><![CDATA[When I switched from Blogger to Wordpress I had to deal with the problem of how to deal with the old pages.
Blogger style of archiving was static. That means that for every post you created, the Blogger system created a static HTML page.
Wordpress on the other side creates pages dynamically, meaning that there is no [...]]]></description>
			<content:encoded><![CDATA[<p>When I switched from <a href="http://www.blogger.com">Blogger</a> to <a href="http://www.wordpress.org">Wordpress</a> I had to deal with the problem of how to deal with the old pages.</p>
<p>Blogger style of archiving was static. That means that for every post you created, the Blogger system created a static HTML page.</p>
<p>Wordpress on the other side creates pages dynamically, meaning that there is no .html file whatsoever, the page is created on the fly whenever you request it. A change in the database automatically reflects on the page.</p>
<p>Now, the problem is, the address of the new pages doesn&#8217;t match the address of the old ones.</p>
<p><span id="more-64"></span></p>
<p>While old posts where in <acronym>URL</acronym>s like this</p>
<pre><code>http://www.z-oc.com/blog/2006/09/food-links.html</code></pre>
<p>the new posts where called through PHP queries like this</p>
<pre><code>http://www.z-oc.com/blog/2006/09/food-links</code></pre>
<p>But, as long as the <a href="http://codex.wordpress.org/Writing_Posts#Advanced_Post_Editing_Screen">post slug</a> is the exact name of the blogger page (without the .html extension) putting the following rule on your <a href="http://httpd.apache.org/docs/1.3/howto/htaccess.html">.htaccess</a> file should do the trick.</p>
<pre><code>RewriteRule ^(.*)\.html$ http://www.site.com/$1 [R=301,L]</code></pre>
<p>This rule will simple redirect the html page to the new address that is exactly the same, but without the .html extension.</p>
<p>Keep in mind though, that this will redirect <em>all</em> pages in your site that end with and .html extension, so take care if you have some .html files around.</p>
<p>You can apply this rule on a per-directory basis or you can put aditiona rules to take care of those in particular.</p>
<p>This way of redirecting is particularly good for <acronym>SEO</acronym>, because search engines will be notified that the page was permanently moved, helping them to properly index you site.</p>
<a href="http://www.z-oc.com/blog/powerblogroll/">Zo'C powerblogroll</a> - A plugin to make powerful blorgrolls with favicons, descriptions, notes and RSS links]]></content:encoded>
			<wfw:commentRss>http://www.z-oc.com/blog/2007/05/managing-obsolete-pages-with-one-line-of-code/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>How to build an events agenda with SQL</title>
		<link>http://www.z-oc.com/blog/2007/03/how-to-build-an-events-agenda-with-sql/</link>
		<comments>http://www.z-oc.com/blog/2007/03/how-to-build-an-events-agenda-with-sql/#comments</comments>
		<pubDate>Fri, 30 Mar 2007 16:55:00 +0000</pubDate>
		<dc:creator>Guilherme Zühlke O'Connor</dc:creator>
				<category><![CDATA[Server Side]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[agenda]]></category>
		<category><![CDATA[events]]></category>
		<category><![CDATA[mySQL]]></category>
		<category><![CDATA[SQL]]></category>

		<guid isPermaLink="false">http://www.z-oc.com/blog/2007/03/how-to-build-an-events-agenda-with-sql/</guid>
		<description><![CDATA[In my opinion, one of the coolest things of the site I&#8217;ve built to Paulo gazela is the event agenda on the navigation bar.
Of course there are many calendar programs around to add to your site and it&#8217;s also possible to integrate google calendar or a similar tool, but all Paulo needed was a way [...]]]></description>
			<content:encoded><![CDATA[<p>In my opinion, one of the coolest things of the site <a href="http://www.z-oc.com/blog/2007/03/paulo-gazela-site-design-by-guilherme/">I&#8217;ve built</a> to <a href="http://www.paulogazela.com.br">Paulo gazela</a> is the event agenda on the navigation bar.</p>
<p>Of course there are many calendar programs around to add to your site and it&#8217;s also possible to integrate google calendar or a similar tool, but all Paulo needed was a way to show the events he was going to be in for the folowing, say, 15 days, and an easy interface to add them.</p>
<p>The solution is very simple. We&#8217;ve built a database with the date, time and details of the events and we created a SQL query to get all the events 15 days from the current date.</p>
<p>A single SQL query like the one below can handle everything</p>
<pre><code>
SELECT *
FROM event, place
WHERE event.place=place.id
  AND CURDATE() < = event.thedate
  AND DATE_ADD(CURDATE(),INTERVAL 15 DAY) >= event.thedate
ORDER BY
  event.thedate ASC,
  event.thetime ASC;
</code></pre>
<p>If you want to understand better what this is, to build the database tables and get some more detail, read on. </p>
<p><span id="more-55"></span></p>
<p>I will assume you have the basic knowledge about connecting to the database system in your server, but I&#8217;ll try go through all steps that are common for every system.</p>
<p>This is an ad hoc tutorial and I won&#8217;t explain a lot o SQL syntax, but if you want to really learn SQL in a generic sense, I encourage you to start learning <a href="http://www.w3schools.com/sql">here</a></p>
<p>First of all, you need to create the database and the tables. The SQL command to create the event table is similar to this</p>
<pre><code>
CREATE TABLE event (
  id INT UNIQUE NOT NULL AUTO_INCREMENT,
  thedate DATE,
  thetime TIME,
  place INT,
  name VARCHAR(40)
);
</code></pre>
<p>The reason why eventplace is an INT field is because the place in itself has a lot of information and good practice on databases (normal forms) require that places have to be stored on its own table.</p>
<pre><code>
CREATE TABLE place (
  id INT UNIQUE NOT NULL AUTO_INCREMENT,www.
  name VARCHAR(40),
  address VARCHAR(100),
  website VARCHAR(50),
  phone VARCHAR(20)
);
</code></pre>
<p>Now we have the database tables set up!</p>
<p>First thing to do is to create a place where one or more events will happen. The SQL to do that is something like:</p>
<pre><code>
INSERT INTO place (name, address, website, phone)
VALUES ('A cool place', 'Cool St. 42','www.coolplace.im','555-1234');
</code></pre>
<p>The id field is going to fill automatically with a unique number and the value will be set up to the next free number. As this is our first insertion, &#8220;Cool Place&#8221; register will have id 1, but we are not suppose to know this by heart, stick with me and I&#8217;ll show you how to do it. For now, let&#8217;s just assume we know that.</p>
<p>So, let&#8217;s insert an event to happen on a couple of days on Cool Place, which has id=1.</p>
<pre><code>
INSERT INTO event (thedate, thetime, place, name)
VALUES ('2007-04-05', '14:30:00', 1 ,'A Cool Event');
</code></pre>
<p>And this event will happen again next month.</p>
<pre><code>
INSERT INTO event (thedate, thetime, place, name)
VALUES ('2007-05-27', '14:30:00', 1 ,'A Cool Event');
</code></pre>
<p>Note that the third parameter, place, does not come into quotes, because is a numerical value rather than a string.</p>
<p>Ok, we&#8217;re set and done with the database, by repeating this procedures, we can insert as many places as we want, and events associated with these places. What we want to do now, is to list the events that will happen in the next 15 days.</p>
<p>Before we do that, let&#8217;s just see how to retrieve the information. We should issue a command to select the entries we want in the database.</p>
<p>The simplest query is something similar to</p>
<pre><code>
SELECT *
FROM event;
</code></pre>
<p>This means, select all fields on the table &#8216;events&#8217;, the asterisk stands for &#8216;all fields&#8217;. A somehow more complex query would be like this</p>
<p>But now, we want to know the name and address of the place where the event will occur, instead of the event id. So we want something like this:</p>
<pre><code>
SELECT
  thedate as date,
  thetime as time,
  event.name as e_name,
  place.name as p_name,
  address as addr
FROM event, place
WHERE event.place=place.id;
</code></pre>
<p>To show the events that will happen within 15 days from now, we must select all entries where the date is greater than today and lesser than today + 15 days.</p>
<pre><code>
SELECT
  event.thedate as d,
  event.thetime as t,
  event.name as e_name,
  place.name as p_name,
  place.address as addr
FROM event, place
WHERE event.place=place.id
  AND CURDATE() < = event.thedate
  AND DATE_ADD(CURDATE(),INTERVAL 15 DAY) >= event.thedate;
</code></pre>
<p>And how about to order entries by date and time? First order the entries by the date, adn then, events that have the same date will be ordered by the time.</p>
<pre><code>
SELECT
  event.thedate as d,
  event.thetime as t,
  event.name as e_name,
  place.name as p_name,
  place.address as addr
FROM event, place
WHERE event.place=place.id
  AND CURDATE() < = event.thedate
  AND DATE_ADD(CURDATE(),INTERVAL 15 DAY) >= event.thedate
ORDER BY
  event.thedate ASC,
  event.thetime ASC;
</code></pre>
<p>Ok, that&#8217;s it! This is the SQL we need.</p>
<p>A PHP implementation of the query would be something like this</p>
<pre><code>
&lt;?php
$con = mysql_connect("mysql.myserver.com","user","password");
if (!$con)
{
  die('Could not connect: ' . mysql_error());
}

$query = &quot;
    SELECT
      event.thedate as d,
      event.thetime as t,
      event.name as e_name,
      place.name as p_name,
      place.address as addr
    FROM event, place
    WHERE event.place=place.id
      AND CURDATE() < = event.thedate
      AND DATE_ADD(CURDATE(),INTERVAL 15 DAY) >= event.thedate
    ORDER BY
      event.thedate ASC,
      event.thetime ASC&quot;;

echo &quot;&lt;table&lt;&quot;;
$result = mysql_query($query);
while($row = mysql_fetch_array($result))
{
    echo &quot;&lt;tr&gt;&quot;;
    echo &quot;&lt;td&gt;&quot; . $row['date'] . &quot;&lt;/td&gt;&quot;;
    echo &quot;&lt;td&gt;&quot; . $row['time'] . &quot;&lt;/td&gt;&quot;;
    echo &quot;&lt;td&gt;&quot; . $row['name'] . &quot;&lt;/td&gt;&quot;;
    echo &quot;&lt;td&gt;&quot; . $row['place'] . &quot;&lt;/td&gt;&quot;;
    echo &quot;&lt;td&gt;&quot; . $row['addr'] . &quot;&lt;/td&gt;&quot;;
    echo &quot;&lt;td&gt;&quot; . $row['website'] . &quot;&lt;/td&gt;&quot;;
    echo &quot;&lt;td&gt;&quot; . $row['phone'] . &quot;&lt;/td&gt;&quot;;
    echo &quot;&lt;td&gt;&quot; . $row['descr'] . &quot;&lt;/td&gt;&quot;;
    echo &quot;&lt;/tr&gt;&quot;;
}
echo &quot;&lt;/table&lt;&quot;;
?&gt;
</code></pre>
<a href="http://www.z-oc.com/blog/powerblogroll/">Zo'C powerblogroll</a> - A plugin to make powerful blorgrolls with favicons, descriptions, notes and RSS links]]></content:encoded>
			<wfw:commentRss>http://www.z-oc.com/blog/2007/03/how-to-build-an-events-agenda-with-sql/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
